55 fixes f ::"'a \<Rightarrow> pinfreal" |
55 fixes f ::"'a \<Rightarrow> pinfreal" |
56 assumes f: "simple_function f" and x: "x \<in> space M" |
56 assumes f: "simple_function f" and x: "x \<in> space M" |
57 shows "f x = (\<Sum>y \<in> f ` space M. y * indicator (f -` {y} \<inter> space M) x)" |
57 shows "f x = (\<Sum>y \<in> f ` space M. y * indicator (f -` {y} \<inter> space M) x)" |
58 (is "?l = ?r") |
58 (is "?l = ?r") |
59 proof - |
59 proof - |
60 have "?r = (\<Sum>y \<in> f ` space M. |
60 have "?r = (\<Sum>y \<in> f ` space M. |
61 (if y = f x then y * indicator (f -` {y} \<inter> space M) x else 0))" |
61 (if y = f x then y * indicator (f -` {y} \<inter> space M) x else 0))" |
62 by (auto intro!: setsum_cong2) |
62 by (auto intro!: setsum_cong2) |
63 also have "... = f x * indicator (f -` {f x} \<inter> space M) x" |
63 also have "... = f x * indicator (f -` {f x} \<inter> space M) x" |
64 using assms by (auto dest: simple_functionD simp: setsum_delta) |
64 using assms by (auto dest: simple_functionD simp: setsum_delta) |
65 also have "... = f x" using x by (auto simp: indicator_def) |
65 also have "... = f x" using x by (auto simp: indicator_def) |
218 using d `x \<in> A j` `j \<in> P` unfolding disjoint_family_on_def |
218 using d `x \<in> A j` `j \<in> P` unfolding disjoint_family_on_def |
219 by auto |
219 by auto |
220 thus ?thesis |
220 thus ?thesis |
221 unfolding indicator_def |
221 unfolding indicator_def |
222 by (simp add: if_distrib setsum_cases[OF `finite P`]) |
222 by (simp add: if_distrib setsum_cases[OF `finite P`]) |
223 qed |
|
224 |
|
225 lemma LeastI2_wellorder: |
|
226 fixes a :: "_ :: wellorder" |
|
227 assumes "P a" |
|
228 and "\<And>a. \<lbrakk> P a; \<forall>b. P b \<longrightarrow> a \<le> b \<rbrakk> \<Longrightarrow> Q a" |
|
229 shows "Q (Least P)" |
|
230 proof (rule LeastI2_order) |
|
231 show "P (Least P)" using `P a` by (rule LeastI) |
|
232 next |
|
233 fix y assume "P y" thus "Least P \<le> y" by (rule Least_le) |
|
234 next |
|
235 fix x assume "P x" "\<forall>y. P y \<longrightarrow> x \<le> y" thus "Q x" by (rule assms(2)) |
|
236 qed |
223 qed |
237 |
224 |
238 lemma (in sigma_algebra) borel_measurable_implies_simple_function_sequence: |
225 lemma (in sigma_algebra) borel_measurable_implies_simple_function_sequence: |
239 fixes u :: "'a \<Rightarrow> pinfreal" |
226 fixes u :: "'a \<Rightarrow> pinfreal" |
240 assumes u: "u \<in> borel_measurable M" |
227 assumes u: "u \<in> borel_measurable M" |
397 with LIMSEQ_inverse_realpow_zero[of 2, unfolded LIMSEQ_iff, rule_format, of "r - p"] |
384 with LIMSEQ_inverse_realpow_zero[of 2, unfolded LIMSEQ_iff, rule_format, of "r - p"] |
398 obtain n where n: "\<And>N. n \<le> N \<Longrightarrow> inverse (2^N) < r - p" by auto |
385 obtain n where n: "\<And>N. n \<le> N \<Longrightarrow> inverse (2^N) < r - p" by auto |
399 let ?N = "max n (natfloor r + 1)" |
386 let ?N = "max n (natfloor r + 1)" |
400 have "u t < of_nat ?N" "n \<le> ?N" |
387 have "u t < of_nat ?N" "n \<le> ?N" |
401 using ge_natfloor_plus_one_imp_gt[of r n] preal |
388 using ge_natfloor_plus_one_imp_gt[of r n] preal |
402 by (auto simp: max_def real_Suc_natfloor) |
389 using real_natfloor_add_one_gt |
|
390 by (auto simp: max_def real_of_nat_Suc) |
403 from lower[OF this(1)] |
391 from lower[OF this(1)] |
404 have "r < (real (f t ?N) + 1) / 2 ^ ?N" unfolding less_divide_eq |
392 have "r < (real (f t ?N) + 1) / 2 ^ ?N" unfolding less_divide_eq |
405 using preal by (auto simp add: power_le_zero_eq zero_le_mult_iff real_of_nat_Suc split: split_if_asm) |
393 using preal by (auto simp add: power_le_zero_eq zero_le_mult_iff real_of_nat_Suc split: split_if_asm) |
406 hence "u t < of_nat (f t ?N) / 2 ^ ?N + 1 / 2 ^ ?N" |
394 hence "u t < of_nat (f t ?N) / 2 ^ ?N + 1 / 2 ^ ?N" |
407 using preal by (auto simp: field_simps divide_real_def[symmetric]) |
395 using preal by (auto simp: field_simps divide_real_def[symmetric]) |
873 by (auto intro!: setsum_cong simp: pinfreal_SUP_cmult) |
861 by (auto intro!: setsum_cong simp: pinfreal_SUP_cmult) |
874 qed |
862 qed |
875 moreover |
863 moreover |
876 have "a * (SUP i. simple_integral (?uB i)) \<le> ?S" |
864 have "a * (SUP i. simple_integral (?uB i)) \<le> ?S" |
877 unfolding pinfreal_SUP_cmult[symmetric] |
865 unfolding pinfreal_SUP_cmult[symmetric] |
878 proof (safe intro!: SUP_mono) |
866 proof (safe intro!: SUP_mono bexI) |
879 fix i |
867 fix i |
880 have "a * simple_integral (?uB i) = simple_integral (\<lambda>x. a * ?uB i x)" |
868 have "a * simple_integral (?uB i) = simple_integral (\<lambda>x. a * ?uB i x)" |
881 using B `simple_function u` |
869 using B `simple_function u` |
882 by (subst simple_integral_mult[symmetric]) (auto simp: field_simps) |
870 by (subst simple_integral_mult[symmetric]) (auto simp: field_simps) |
883 also have "\<dots> \<le> positive_integral (f i)" |
871 also have "\<dots> \<le> positive_integral (f i)" |
888 show ?thesis unfolding positive_integral_eq_simple_integral[OF *, symmetric] |
876 show ?thesis unfolding positive_integral_eq_simple_integral[OF *, symmetric] |
889 by (auto intro!: positive_integral_mono simp: indicator_def) |
877 by (auto intro!: positive_integral_mono simp: indicator_def) |
890 qed |
878 qed |
891 finally show "a * simple_integral (?uB i) \<le> positive_integral (f i)" |
879 finally show "a * simple_integral (?uB i) \<le> positive_integral (f i)" |
892 by auto |
880 by auto |
893 qed |
881 qed simp |
894 ultimately show "a * simple_integral u \<le> ?S" by simp |
882 ultimately show "a * simple_integral u \<le> ?S" by simp |
895 qed |
883 qed |
896 |
884 |
897 text {* Beppo-Levi monotone convergence theorem *} |
885 text {* Beppo-Levi monotone convergence theorem *} |
898 lemma (in measure_space) positive_integral_isoton: |
886 lemma (in measure_space) positive_integral_isoton: |
1054 proof - |
1042 proof - |
1055 have "(SUP n. INF m. u (m + n)) \<in> borel_measurable M" |
1043 have "(SUP n. INF m. u (m + n)) \<in> borel_measurable M" |
1056 by (auto intro!: borel_measurable_SUP borel_measurable_INF assms) |
1044 by (auto intro!: borel_measurable_SUP borel_measurable_INF assms) |
1057 |
1045 |
1058 have "(\<lambda>n. INF m. u (m + n)) \<up> (SUP n. INF m. u (m + n))" |
1046 have "(\<lambda>n. INF m. u (m + n)) \<up> (SUP n. INF m. u (m + n))" |
1059 proof (unfold isoton_def, safe) |
1047 proof (unfold isoton_def, safe intro!: INF_mono bexI) |
1060 fix i show "(INF m. u (m + i)) \<le> (INF m. u (m + Suc i))" |
1048 fix i m show "u (Suc m + i) \<le> u (m + Suc i)" by simp |
1061 by (rule INF_mono[where N=Suc]) simp |
1049 qed simp |
1062 qed |
|
1063 from positive_integral_isoton[OF this] assms |
1050 from positive_integral_isoton[OF this] assms |
1064 have "positive_integral (SUP n. INF m. u (m + n)) = |
1051 have "positive_integral (SUP n. INF m. u (m + n)) = |
1065 (SUP n. positive_integral (INF m. u (m + n)))" |
1052 (SUP n. positive_integral (INF m. u (m + n)))" |
1066 unfolding isoton_def by (simp add: borel_measurable_INF) |
1053 unfolding isoton_def by (simp add: borel_measurable_INF) |
1067 also have "\<dots> \<le> (SUP n. INF m. positive_integral (u (m + n)))" |
1054 also have "\<dots> \<le> (SUP n. INF m. positive_integral (u (m + n)))" |
1068 by (auto intro!: SUP_mono[where N="\<lambda>x. x"] INFI_bound positive_integral_mono INF_leI simp: INFI_fun_expand) |
1055 apply (rule SUP_mono) |
|
1056 apply (rule_tac x=n in bexI) |
|
1057 by (auto intro!: positive_integral_mono INFI_bound INF_leI exI simp: INFI_fun_expand) |
1069 finally show ?thesis . |
1058 finally show ?thesis . |
1070 qed |
1059 qed |
1071 |
1060 |
1072 lemma (in measure_space) measure_space_density: |
1061 lemma (in measure_space) measure_space_density: |
1073 assumes borel: "u \<in> borel_measurable M" |
1062 assumes borel: "u \<in> borel_measurable M" |
1121 qed |
1110 qed |
1122 from positive_integral_isoton[OF this] |
1111 from positive_integral_isoton[OF this] |
1123 have "?I = (SUP i. positive_integral (\<lambda>x. min (of_nat i) (u x) * indicator N x))" |
1112 have "?I = (SUP i. positive_integral (\<lambda>x. min (of_nat i) (u x) * indicator N x))" |
1124 unfolding isoton_def using borel `N \<in> sets M` by (simp add: borel_measurable_indicator) |
1113 unfolding isoton_def using borel `N \<in> sets M` by (simp add: borel_measurable_indicator) |
1125 also have "\<dots> \<le> (SUP i. positive_integral (\<lambda>x. of_nat i * indicator N x))" |
1114 also have "\<dots> \<le> (SUP i. positive_integral (\<lambda>x. of_nat i * indicator N x))" |
1126 proof (rule SUP_mono, rule positive_integral_mono) |
1115 proof (rule SUP_mono, rule bexI, rule positive_integral_mono) |
1127 fix x i show "min (of_nat i) (u x) * indicator N x \<le> of_nat i * indicator N x" |
1116 fix x i show "min (of_nat i) (u x) * indicator N x \<le> of_nat i * indicator N x" |
1128 by (cases "x \<in> N") auto |
1117 by (cases "x \<in> N") auto |
1129 qed |
1118 qed simp |
1130 also have "\<dots> = 0" |
1119 also have "\<dots> = 0" |
1131 using `N \<in> null_sets` by (simp add: positive_integral_cmult_indicator) |
1120 using `N \<in> null_sets` by (simp add: positive_integral_cmult_indicator) |
1132 finally show ?thesis by simp |
1121 finally show ?thesis by simp |
1133 qed |
1122 qed |
1134 |
1123 |
1965 and "\<And>x. x \<in> space M \<Longrightarrow> \<mu> {x} \<noteq> \<omega>" |
1954 and "\<And>x. x \<in> space M \<Longrightarrow> \<mu> {x} \<noteq> \<omega>" |
1966 shows "finite_measure_space M \<mu>" |
1955 shows "finite_measure_space M \<mu>" |
1967 unfolding finite_measure_space_def finite_measure_space_axioms_def |
1956 unfolding finite_measure_space_def finite_measure_space_axioms_def |
1968 using assms by simp |
1957 using assms by simp |
1969 |
1958 |
1970 lemma (in finite_measure_space) borel_measurable_finite[intro, simp]: |
1959 lemma (in finite_measure_space) borel_measurable_finite[intro, simp]: "f \<in> borel_measurable M" |
1971 fixes f :: "'a \<Rightarrow> real" |
|
1972 shows "f \<in> borel_measurable M" |
|
1973 unfolding measurable_def sets_eq_Pow by auto |
1960 unfolding measurable_def sets_eq_Pow by auto |
|
1961 |
|
1962 lemma (in finite_measure_space) simple_function_finite: "simple_function f" |
|
1963 unfolding simple_function_def sets_eq_Pow using finite_space by auto |
|
1964 |
|
1965 lemma (in finite_measure_space) positive_integral_finite_eq_setsum: |
|
1966 "positive_integral f = (\<Sum>x \<in> space M. f x * \<mu> {x})" |
|
1967 proof - |
|
1968 have *: "positive_integral f = positive_integral (\<lambda>x. \<Sum>y\<in>space M. f y * indicator {y} x)" |
|
1969 by (auto intro!: positive_integral_cong simp add: indicator_def if_distrib setsum_cases[OF finite_space]) |
|
1970 show ?thesis unfolding * using borel_measurable_finite[of f] |
|
1971 by (simp add: positive_integral_setsum positive_integral_cmult_indicator sets_eq_Pow) |
|
1972 qed |
1974 |
1973 |
1975 lemma (in finite_measure_space) integral_finite_singleton: |
1974 lemma (in finite_measure_space) integral_finite_singleton: |
1976 shows "integrable f" |
1975 shows "integrable f" |
1977 and "integral f = (\<Sum>x \<in> space M. f x * real (\<mu> {x}))" (is ?I) |
1976 and "integral f = (\<Sum>x \<in> space M. f x * real (\<mu> {x}))" (is ?I) |
1978 proof - |
1977 proof - |
1979 have 1: "f \<in> borel_measurable M" |
1978 have [simp]: |
1980 unfolding measurable_def sets_eq_Pow by auto |
1979 "positive_integral (\<lambda>x. Real (f x)) = (\<Sum>x \<in> space M. Real (f x) * \<mu> {x})" |
1981 |
1980 "positive_integral (\<lambda>x. Real (- f x)) = (\<Sum>x \<in> space M. Real (- f x) * \<mu> {x})" |
1982 have 2: "finite (f`space M)" using finite_space by simp |
1981 unfolding positive_integral_finite_eq_setsum by auto |
1983 |
1982 |
1984 have 3: "\<And>x. x \<noteq> 0 \<Longrightarrow> \<mu> (f -` {x} \<inter> space M) \<noteq> \<omega>" |
1983 show "integrable f" using finite_space finite_measure |
1985 using finite_measure[unfolded sets_eq_Pow] by simp |
1984 by (simp add: setsum_\<omega> integrable_def sets_eq_Pow) |
1986 |
1985 |
1987 show "integrable f" |
1986 show ?I using finite_measure |
1988 by (rule integral_on_finite(1)[OF 1 2 3]) simp |
1987 apply (simp add: integral_def sets_eq_Pow real_of_pinfreal_setsum[symmetric] |
1989 |
1988 real_of_pinfreal_mult[symmetric] setsum_subtractf[symmetric]) |
1990 { fix r let ?x = "f -` {r} \<inter> space M" |
1989 by (rule setsum_cong) (simp_all split: split_if) |
1991 have "?x \<subseteq> space M" by auto |
|
1992 with finite_space sets_eq_Pow finite_single_measure |
|
1993 have "real (\<mu> ?x) = (\<Sum>i \<in> ?x. real (\<mu> {i}))" |
|
1994 using real_measure_setsum_singleton[of ?x] by auto } |
|
1995 note measure_eq_setsum = this |
|
1996 |
|
1997 have "integral f = (\<Sum>r\<in>f`space M. r * real (\<mu> (f -` {r} \<inter> space M)))" |
|
1998 by (rule integral_on_finite(2)[OF 1 2 3]) simp |
|
1999 also have "\<dots> = (\<Sum>x \<in> space M. f x * real (\<mu> {x}))" |
|
2000 unfolding measure_eq_setsum setsum_right_distrib |
|
2001 apply (subst setsum_Sigma) |
|
2002 apply (simp add: finite_space) |
|
2003 apply (simp add: finite_space) |
|
2004 proof (rule setsum_reindex_cong[symmetric]) |
|
2005 fix a assume "a \<in> Sigma (f ` space M) (\<lambda>x. f -` {x} \<inter> space M)" |
|
2006 thus "(\<lambda>(x, y). x * real (\<mu> {y})) a = f (snd a) * real (\<mu> {snd a})" |
|
2007 by auto |
|
2008 qed (auto intro!: image_eqI inj_onI) |
|
2009 finally show ?I . |
|
2010 qed |
1990 qed |
2011 |
1991 |
2012 end |
1992 end |