815 shows "(\<forall>A\<in>sets M. (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. g x * indicator A x \<partial>M)) |
815 shows "(\<forall>A\<in>sets M. (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. g x * indicator A x \<partial>M)) |
816 \<longleftrightarrow> (AE x. f x = g x)" |
816 \<longleftrightarrow> (AE x. f x = g x)" |
817 (is "(\<forall>A\<in>sets M. ?P f A = ?P g A) \<longleftrightarrow> _") |
817 (is "(\<forall>A\<in>sets M. ?P f A = ?P g A) \<longleftrightarrow> _") |
818 proof (intro iffI ballI) |
818 proof (intro iffI ballI) |
819 fix A assume eq: "AE x. f x = g x" |
819 fix A assume eq: "AE x. f x = g x" |
820 show "?P f A = ?P g A" |
820 then show "?P f A = ?P g A" |
821 by (rule positive_integral_cong_AE[OF AE_mp[OF eq]]) simp |
821 by (auto intro: positive_integral_cong_AE) |
822 next |
822 next |
823 assume eq: "\<forall>A\<in>sets M. ?P f A = ?P g A" |
823 assume eq: "\<forall>A\<in>sets M. ?P f A = ?P g A" |
824 from this[THEN bspec, OF top] fin |
824 from this[THEN bspec, OF top] fin |
825 have g_fin: "integral\<^isup>P M g < \<omega>" by (simp cong: positive_integral_cong) |
825 have g_fin: "integral\<^isup>P M g < \<omega>" by (simp cong: positive_integral_cong) |
826 { fix f g assume borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M" |
826 { fix f g assume borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M" |
877 from Q have Q_sets: "\<And>i. Q i \<in> sets M" by auto |
877 from Q have Q_sets: "\<And>i. Q i \<in> sets M" by auto |
878 let ?N = "{x\<in>space M. f x \<noteq> f' x}" |
878 let ?N = "{x\<in>space M. f x \<noteq> f' x}" |
879 have "?N \<in> sets M" using borel by auto |
879 have "?N \<in> sets M" using borel by auto |
880 have *: "\<And>i x A. \<And>y::pextreal. y * indicator (Q i) x * indicator A x = y * indicator (Q i \<inter> A) x" |
880 have *: "\<And>i x A. \<And>y::pextreal. y * indicator (Q i) x * indicator A x = y * indicator (Q i \<inter> A) x" |
881 unfolding indicator_def by auto |
881 unfolding indicator_def by auto |
882 have 1: "\<forall>i. AE x. ?f (Q i) x = ?f' (Q i) x" |
882 have "\<forall>i. AE x. ?f (Q i) x = ?f' (Q i) x" using borel Q_fin Q |
883 using borel Q_fin Q |
|
884 by (intro finite_density_unique[THEN iffD1] allI) |
883 by (intro finite_density_unique[THEN iffD1] allI) |
885 (auto intro!: borel_measurable_pextreal_times f Int simp: *) |
884 (auto intro!: borel_measurable_pextreal_times f Int simp: *) |
886 have 2: "AE x. ?f Q0 x = ?f' Q0 x" |
885 moreover have "AE x. ?f Q0 x = ?f' Q0 x" |
887 proof (rule AE_I') |
886 proof (rule AE_I') |
888 { fix f :: "'a \<Rightarrow> pextreal" assume borel: "f \<in> borel_measurable M" |
887 { fix f :: "'a \<Rightarrow> pextreal" assume borel: "f \<in> borel_measurable M" |
889 and eq: "\<And>A. A \<in> sets M \<Longrightarrow> ?\<nu> A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M)" |
888 and eq: "\<And>A. A \<in> sets M \<Longrightarrow> ?\<nu> A = (\<integral>\<^isup>+x. f x * indicator A x \<partial>M)" |
890 let "?A i" = "Q0 \<inter> {x \<in> space M. f x < of_nat i}" |
889 let "?A i" = "Q0 \<inter> {x \<in> space M. f x < of_nat i}" |
891 have "(\<Union>i. ?A i) \<in> null_sets" |
890 have "(\<Union>i. ?A i) \<in> null_sets" |
909 have "Q0 \<inter> {x\<in>space M. f x \<noteq> \<omega>} \<in> null_sets" "Q0 \<inter> {x\<in>space M. f' x \<noteq> \<omega>} \<in> null_sets" by simp_all |
908 have "Q0 \<inter> {x\<in>space M. f x \<noteq> \<omega>} \<in> null_sets" "Q0 \<inter> {x\<in>space M. f' x \<noteq> \<omega>} \<in> null_sets" by simp_all |
910 then show "(Q0 \<inter> {x\<in>space M. f x \<noteq> \<omega>}) \<union> (Q0 \<inter> {x\<in>space M. f' x \<noteq> \<omega>}) \<in> null_sets" by (rule null_sets_Un) |
909 then show "(Q0 \<inter> {x\<in>space M. f x \<noteq> \<omega>}) \<union> (Q0 \<inter> {x\<in>space M. f' x \<noteq> \<omega>}) \<in> null_sets" by (rule null_sets_Un) |
911 show "{x \<in> space M. ?f Q0 x \<noteq> ?f' Q0 x} \<subseteq> |
910 show "{x \<in> space M. ?f Q0 x \<noteq> ?f' Q0 x} \<subseteq> |
912 (Q0 \<inter> {x\<in>space M. f x \<noteq> \<omega>}) \<union> (Q0 \<inter> {x\<in>space M. f' x \<noteq> \<omega>})" by (auto simp: indicator_def) |
911 (Q0 \<inter> {x\<in>space M. f x \<noteq> \<omega>}) \<union> (Q0 \<inter> {x\<in>space M. f' x \<noteq> \<omega>})" by (auto simp: indicator_def) |
913 qed |
912 qed |
914 have **: "\<And>x. (?f Q0 x = ?f' Q0 x) \<longrightarrow> (\<forall>i. ?f (Q i) x = ?f' (Q i) x) \<longrightarrow> |
913 moreover have "\<And>x. (?f Q0 x = ?f' Q0 x) \<longrightarrow> (\<forall>i. ?f (Q i) x = ?f' (Q i) x) \<longrightarrow> |
915 ?f (space M) x = ?f' (space M) x" |
914 ?f (space M) x = ?f' (space M) x" |
916 by (auto simp: indicator_def Q0) |
915 by (auto simp: indicator_def Q0) |
917 have 3: "AE x. ?f (space M) x = ?f' (space M) x" |
916 ultimately have "AE x. ?f (space M) x = ?f' (space M) x" |
918 by (rule AE_mp[OF 1[unfolded all_AE_countable] AE_mp[OF 2]]) (simp add: **) |
917 by (auto simp: all_AE_countable) |
919 then show "AE x. f x = f' x" |
918 then show "AE x. f x = f' x" by auto |
920 by (rule AE_mp) (auto intro!: AE_cong simp: indicator_def) |
|
921 qed |
919 qed |
922 |
920 |
923 lemma (in sigma_finite_measure) density_unique: |
921 lemma (in sigma_finite_measure) density_unique: |
924 assumes borel: "f \<in> borel_measurable M" "f' \<in> borel_measurable M" |
922 assumes borel: "f \<in> borel_measurable M" "f' \<in> borel_measurable M" |
925 assumes f: "\<And>A. A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. f' x * indicator A x \<partial>M)" |
923 assumes f: "\<And>A. A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. f' x * indicator A x \<partial>M)" |
976 then interpret \<nu>: sigma_finite_measure ?N |
974 then interpret \<nu>: sigma_finite_measure ?N |
977 where "borel_measurable ?N = borel_measurable M" and "measure ?N = \<nu>" |
975 where "borel_measurable ?N = borel_measurable M" and "measure ?N = \<nu>" |
978 and "sets ?N = sets M" and "space ?N = space M" by (auto simp: measurable_def) |
976 and "sets ?N = sets M" and "space ?N = space M" by (auto simp: measurable_def) |
979 from \<nu>.Ex_finite_integrable_function obtain h where |
977 from \<nu>.Ex_finite_integrable_function obtain h where |
980 h: "h \<in> borel_measurable M" "integral\<^isup>P ?N h \<noteq> \<omega>" |
978 h: "h \<in> borel_measurable M" "integral\<^isup>P ?N h \<noteq> \<omega>" |
981 and fin: "\<And>x. x \<in> space M \<Longrightarrow> 0 < h x \<and> h x < \<omega>" by auto |
979 and fin: "\<forall>x\<in>space M. 0 < h x \<and> h x < \<omega>" by auto |
982 have "AE x. f x * h x \<noteq> \<omega>" |
980 have "AE x. f x * h x \<noteq> \<omega>" |
983 proof (rule AE_I') |
981 proof (rule AE_I') |
984 have "integral\<^isup>P ?N h = (\<integral>\<^isup>+x. f x * h x \<partial>M)" |
982 have "integral\<^isup>P ?N h = (\<integral>\<^isup>+x. f x * h x \<partial>M)" using f h |
985 apply (subst \<nu>.positive_integral_cong_measure[symmetric, |
983 by (subst \<nu>.positive_integral_cong_measure[symmetric, |
986 of "M\<lparr> measure := \<lambda> A. \<integral>\<^isup>+x. f x * indicator A x \<partial>M \<rparr>"]) |
984 of "M\<lparr> measure := \<lambda> A. \<integral>\<^isup>+x. f x * indicator A x \<partial>M \<rparr>"]) |
987 apply (simp_all add: eq) |
985 (auto intro!: positive_integral_translated_density simp: eq) |
988 apply (rule positive_integral_translated_density) |
|
989 using f h by auto |
|
990 then have "(\<integral>\<^isup>+x. f x * h x \<partial>M) \<noteq> \<omega>" |
986 then have "(\<integral>\<^isup>+x. f x * h x \<partial>M) \<noteq> \<omega>" |
991 using h(2) by simp |
987 using h(2) by simp |
992 then show "(\<lambda>x. f x * h x) -` {\<omega>} \<inter> space M \<in> null_sets" |
988 then show "(\<lambda>x. f x * h x) -` {\<omega>} \<inter> space M \<in> null_sets" |
993 using f h(1) by (auto intro!: positive_integral_omega borel_measurable_vimage) |
989 using f h(1) by (auto intro!: positive_integral_omega borel_measurable_vimage) |
994 qed auto |
990 qed auto |
995 then show "AE x. f x \<noteq> \<omega>" |
991 then show "AE x. f x \<noteq> \<omega>" |
996 proof (rule AE_mp, intro AE_cong) |
992 using fin by (auto elim!: AE_Ball_mp) |
997 fix x assume "x \<in> space M" from this[THEN fin] |
|
998 show "f x * h x \<noteq> \<omega> \<longrightarrow> f x \<noteq> \<omega>" by auto |
|
999 qed |
|
1000 next |
993 next |
1001 assume AE: "AE x. f x \<noteq> \<omega>" |
994 assume AE: "AE x. f x \<noteq> \<omega>" |
1002 from sigma_finite guess Q .. note Q = this |
995 from sigma_finite guess Q .. note Q = this |
1003 interpret \<nu>: measure_space ?N |
996 interpret \<nu>: measure_space ?N |
1004 where "borel_measurable ?N = borel_measurable M" and "measure ?N = \<nu>" |
997 where "borel_measurable ?N = borel_measurable M" and "measure ?N = \<nu>" |
1041 [simp]: "prod_decode n = (i, j)" by (cases "prod_decode n") auto |
1034 [simp]: "prod_decode n = (i, j)" by (cases "prod_decode n") auto |
1042 have "(\<integral>\<^isup>+x. f x * indicator (A i \<inter> Q j) x \<partial>M) \<noteq> \<omega>" |
1035 have "(\<integral>\<^isup>+x. f x * indicator (A i \<inter> Q j) x \<partial>M) \<noteq> \<omega>" |
1043 proof (cases i) |
1036 proof (cases i) |
1044 case 0 |
1037 case 0 |
1045 have "AE x. f x * indicator (A i \<inter> Q j) x = 0" |
1038 have "AE x. f x * indicator (A i \<inter> Q j) x = 0" |
1046 using AE by (rule AE_mp) (auto intro!: AE_cong simp: A_def `i = 0`) |
1039 using AE by (auto simp: A_def `i = 0`) |
1047 then have "(\<integral>\<^isup>+x. f x * indicator (A i \<inter> Q j) x \<partial>M) = 0" |
1040 from positive_integral_cong_AE[OF this] show ?thesis by simp |
1048 using A_in_sets f |
|
1049 apply (subst positive_integral_0_iff) |
|
1050 apply fast |
|
1051 apply (subst (asm) AE_iff_null_set) |
|
1052 apply (intro borel_measurable_pextreal_neq_const) |
|
1053 apply fast |
|
1054 by simp |
|
1055 then show ?thesis by simp |
|
1056 next |
1041 next |
1057 case (Suc n) |
1042 case (Suc n) |
1058 then have "(\<integral>\<^isup>+x. f x * indicator (A i \<inter> Q j) x \<partial>M) \<le> |
1043 then have "(\<integral>\<^isup>+x. f x * indicator (A i \<inter> Q j) x \<partial>M) \<le> |
1059 (\<integral>\<^isup>+x. of_nat (Suc n) * indicator (Q j) x \<partial>M)" |
1044 (\<integral>\<^isup>+x. of_nat (Suc n) * indicator (Q j) x \<partial>M)" |
1060 by (auto intro!: positive_integral_mono simp: indicator_def A_def) |
1045 by (auto intro!: positive_integral_mono simp: indicator_def A_def) |
1155 { fix x assume *: "RN_deriv M \<nu> x \<noteq> \<omega>" |
1140 { fix x assume *: "RN_deriv M \<nu> x \<noteq> \<omega>" |
1156 have "Real (real (RN_deriv M \<nu> x)) * Real (f x) = Real (real (RN_deriv M \<nu> x) * f x)" |
1141 have "Real (real (RN_deriv M \<nu> x)) * Real (f x) = Real (real (RN_deriv M \<nu> x) * f x)" |
1157 by (simp add: mult_le_0_iff) |
1142 by (simp add: mult_le_0_iff) |
1158 then have "RN_deriv M \<nu> x * Real (f x) = Real (real (RN_deriv M \<nu> x) * f x)" |
1143 then have "RN_deriv M \<nu> x * Real (f x) = Real (real (RN_deriv M \<nu> x) * f x)" |
1159 using * by (simp add: Real_real) } |
1144 using * by (simp add: Real_real) } |
1160 note * = this |
1145 then have "(\<integral>\<^isup>+x. RN_deriv M \<nu> x * Real (f x) \<partial>M) = (\<integral>\<^isup>+x. Real (real (RN_deriv M \<nu> x) * f x) \<partial>M)" |
1161 have "(\<integral>\<^isup>+x. RN_deriv M \<nu> x * Real (f x) \<partial>M) = (\<integral>\<^isup>+x. Real (real (RN_deriv M \<nu> x) * f x) \<partial>M)" |
1146 using RN_deriv_finite[OF \<nu>] by (auto intro: positive_integral_cong_AE) } |
1162 apply (rule positive_integral_cong_AE) |
|
1163 apply (rule AE_mp[OF RN_deriv_finite[OF \<nu>]]) |
|
1164 by (auto intro!: AE_cong simp: *) } |
|
1165 with this this f f' Nf |
1147 with this this f f' Nf |
1166 show ?integral ?integrable |
1148 show ?integral ?integrable |
1167 unfolding lebesgue_integral_def integrable_def |
1149 unfolding lebesgue_integral_def integrable_def |
1168 by (auto intro!: RN_deriv(1)[OF ms \<nu>(2)] minus_cong |
1150 by (auto intro!: RN_deriv(1)[OF ms \<nu>(2)] minus_cong |
1169 simp: RN_deriv_positive_integral[OF ms \<nu>(2)]) |
1151 simp: RN_deriv_positive_integral[OF ms \<nu>(2)]) |