298 assume "finite P" from this assms show ?thesis by induct auto |
298 assume "finite P" from this assms show ?thesis by induct auto |
299 qed auto |
299 qed auto |
300 |
300 |
301 lemma (in sigma_algebra) |
301 lemma (in sigma_algebra) |
302 fixes f g :: "'a \<Rightarrow> real" assumes sf: "simple_function M f" |
302 fixes f g :: "'a \<Rightarrow> real" assumes sf: "simple_function M f" |
303 shows simple_function_extreal[intro, simp]: "simple_function M (\<lambda>x. extreal (f x))" |
303 shows simple_function_ereal[intro, simp]: "simple_function M (\<lambda>x. ereal (f x))" |
304 by (auto intro!: simple_function_compose1[OF sf]) |
304 by (auto intro!: simple_function_compose1[OF sf]) |
305 |
305 |
306 lemma (in sigma_algebra) |
306 lemma (in sigma_algebra) |
307 fixes f g :: "'a \<Rightarrow> nat" assumes sf: "simple_function M f" |
307 fixes f g :: "'a \<Rightarrow> nat" assumes sf: "simple_function M f" |
308 shows simple_function_real_of_nat[intro, simp]: "simple_function M (\<lambda>x. real (f x))" |
308 shows simple_function_real_of_nat[intro, simp]: "simple_function M (\<lambda>x. real (f x))" |
309 by (auto intro!: simple_function_compose1[OF sf]) |
309 by (auto intro!: simple_function_compose1[OF sf]) |
310 |
310 |
311 lemma (in sigma_algebra) borel_measurable_implies_simple_function_sequence: |
311 lemma (in sigma_algebra) borel_measurable_implies_simple_function_sequence: |
312 fixes u :: "'a \<Rightarrow> extreal" |
312 fixes u :: "'a \<Rightarrow> ereal" |
313 assumes u: "u \<in> borel_measurable M" |
313 assumes u: "u \<in> borel_measurable M" |
314 shows "\<exists>f. incseq f \<and> (\<forall>i. \<infinity> \<notin> range (f i) \<and> simple_function M (f i)) \<and> |
314 shows "\<exists>f. incseq f \<and> (\<forall>i. \<infinity> \<notin> range (f i) \<and> simple_function M (f i)) \<and> |
315 (\<forall>x. (SUP i. f i x) = max 0 (u x)) \<and> (\<forall>i x. 0 \<le> f i x)" |
315 (\<forall>x. (SUP i. f i x) = max 0 (u x)) \<and> (\<forall>i x. 0 \<le> f i x)" |
316 proof - |
316 proof - |
317 def f \<equiv> "\<lambda>x i. if real i \<le> u x then i * 2 ^ i else natfloor (real (u x) * 2 ^ i)" |
317 def f \<equiv> "\<lambda>x i. if real i \<le> u x then i * 2 ^ i else natfloor (real (u x) * 2 ^ i)" |
343 using f_upper[of _ i] by auto |
343 using f_upper[of _ i] by auto |
344 then show "finite ((\<lambda>x. real (f x i))`space M)" |
344 then show "finite ((\<lambda>x. real (f x i))`space M)" |
345 by (rule finite_subset) auto |
345 by (rule finite_subset) auto |
346 qed |
346 qed |
347 then show "simple_function M (?g i)" |
347 then show "simple_function M (?g i)" |
348 by (auto intro: simple_function_extreal simple_function_div) |
348 by (auto intro: simple_function_ereal simple_function_div) |
349 next |
349 next |
350 show "incseq ?g" |
350 show "incseq ?g" |
351 proof (intro incseq_extreal incseq_SucI le_funI) |
351 proof (intro incseq_ereal incseq_SucI le_funI) |
352 fix x and i :: nat |
352 fix x and i :: nat |
353 have "f x i * 2 \<le> f x (Suc i)" unfolding f_def |
353 have "f x i * 2 \<le> f x (Suc i)" unfolding f_def |
354 proof ((split split_if)+, intro conjI impI) |
354 proof ((split split_if)+, intro conjI impI) |
355 assume "extreal (real i) \<le> u x" "\<not> extreal (real (Suc i)) \<le> u x" |
355 assume "ereal (real i) \<le> u x" "\<not> ereal (real (Suc i)) \<le> u x" |
356 then show "i * 2 ^ i * 2 \<le> natfloor (real (u x) * 2 ^ Suc i)" |
356 then show "i * 2 ^ i * 2 \<le> natfloor (real (u x) * 2 ^ Suc i)" |
357 by (cases "u x") (auto intro!: le_natfloor) |
357 by (cases "u x") (auto intro!: le_natfloor) |
358 next |
358 next |
359 assume "\<not> extreal (real i) \<le> u x" "extreal (real (Suc i)) \<le> u x" |
359 assume "\<not> ereal (real i) \<le> u x" "ereal (real (Suc i)) \<le> u x" |
360 then show "natfloor (real (u x) * 2 ^ i) * 2 \<le> Suc i * 2 ^ Suc i" |
360 then show "natfloor (real (u x) * 2 ^ i) * 2 \<le> Suc i * 2 ^ Suc i" |
361 by (cases "u x") auto |
361 by (cases "u x") auto |
362 next |
362 next |
363 assume "\<not> extreal (real i) \<le> u x" "\<not> extreal (real (Suc i)) \<le> u x" |
363 assume "\<not> ereal (real i) \<le> u x" "\<not> ereal (real (Suc i)) \<le> u x" |
364 have "natfloor (real (u x) * 2 ^ i) * 2 = natfloor (real (u x) * 2 ^ i) * natfloor 2" |
364 have "natfloor (real (u x) * 2 ^ i) * 2 = natfloor (real (u x) * 2 ^ i) * natfloor 2" |
365 by simp |
365 by simp |
366 also have "\<dots> \<le> natfloor (real (u x) * 2 ^ i * 2)" |
366 also have "\<dots> \<le> natfloor (real (u x) * 2 ^ i * 2)" |
367 proof cases |
367 proof cases |
368 assume "0 \<le> u x" then show ?thesis |
368 assume "0 \<le> u x" then show ?thesis |
765 shows "integral\<^isup>S M (indicator A) = \<mu> A" |
765 shows "integral\<^isup>S M (indicator A) = \<mu> A" |
766 proof cases |
766 proof cases |
767 assume "space M = {}" hence "A = {}" using sets_into_space[OF assms] by auto |
767 assume "space M = {}" hence "A = {}" using sets_into_space[OF assms] by auto |
768 thus ?thesis unfolding simple_integral_def using `space M = {}` by auto |
768 thus ?thesis unfolding simple_integral_def using `space M = {}` by auto |
769 next |
769 next |
770 assume "space M \<noteq> {}" hence "(\<lambda>x. 1) ` space M = {1::extreal}" by auto |
770 assume "space M \<noteq> {}" hence "(\<lambda>x. 1) ` space M = {1::ereal}" by auto |
771 thus ?thesis |
771 thus ?thesis |
772 using simple_integral_indicator[OF assms simple_function_const[of 1]] |
772 using simple_integral_indicator[OF assms simple_function_const[of 1]] |
773 using sets_into_space[OF assms] |
773 using sets_into_space[OF assms] |
774 by (auto intro!: arg_cong[where f="\<mu>"]) |
774 by (auto intro!: arg_cong[where f="\<mu>"]) |
775 qed |
775 qed |
776 |
776 |
777 lemma (in measure_space) simple_integral_null_set: |
777 lemma (in measure_space) simple_integral_null_set: |
778 assumes "simple_function M u" "\<And>x. 0 \<le> u x" and "N \<in> null_sets" |
778 assumes "simple_function M u" "\<And>x. 0 \<le> u x" and "N \<in> null_sets" |
779 shows "(\<integral>\<^isup>Sx. u x * indicator N x \<partial>M) = 0" |
779 shows "(\<integral>\<^isup>Sx. u x * indicator N x \<partial>M) = 0" |
780 proof - |
780 proof - |
781 have "AE x. indicator N x = (0 :: extreal)" |
781 have "AE x. indicator N x = (0 :: ereal)" |
782 using `N \<in> null_sets` by (auto simp: indicator_def intro!: AE_I[of _ N]) |
782 using `N \<in> null_sets` by (auto simp: indicator_def intro!: AE_I[of _ N]) |
783 then have "(\<integral>\<^isup>Sx. u x * indicator N x \<partial>M) = (\<integral>\<^isup>Sx. 0 \<partial>M)" |
783 then have "(\<integral>\<^isup>Sx. u x * indicator N x \<partial>M) = (\<integral>\<^isup>Sx. 0 \<partial>M)" |
784 using assms apply (intro simple_integral_cong_AE) by auto |
784 using assms apply (intro simple_integral_cong_AE) by auto |
785 then show ?thesis by simp |
785 then show ?thesis by simp |
786 qed |
786 qed |
1000 |
1000 |
1001 lemma (in measure_space) positive_integral_SUP_approx: |
1001 lemma (in measure_space) positive_integral_SUP_approx: |
1002 assumes f: "incseq f" "\<And>i. f i \<in> borel_measurable M" "\<And>i x. 0 \<le> f i x" |
1002 assumes f: "incseq f" "\<And>i. f i \<in> borel_measurable M" "\<And>i x. 0 \<le> f i x" |
1003 and u: "simple_function M u" "u \<le> (SUP i. f i)" "u`space M \<subseteq> {0..<\<infinity>}" |
1003 and u: "simple_function M u" "u \<le> (SUP i. f i)" "u`space M \<subseteq> {0..<\<infinity>}" |
1004 shows "integral\<^isup>S M u \<le> (SUP i. integral\<^isup>P M (f i))" (is "_ \<le> ?S") |
1004 shows "integral\<^isup>S M u \<le> (SUP i. integral\<^isup>P M (f i))" (is "_ \<le> ?S") |
1005 proof (rule extreal_le_mult_one_interval) |
1005 proof (rule ereal_le_mult_one_interval) |
1006 have "0 \<le> (SUP i. integral\<^isup>P M (f i))" |
1006 have "0 \<le> (SUP i. integral\<^isup>P M (f i))" |
1007 using f(3) by (auto intro!: le_SUPI2 positive_integral_positive) |
1007 using f(3) by (auto intro!: le_SUPI2 positive_integral_positive) |
1008 then show "(SUP i. integral\<^isup>P M (f i)) \<noteq> -\<infinity>" by auto |
1008 then show "(SUP i. integral\<^isup>P M (f i)) \<noteq> -\<infinity>" by auto |
1009 have u_range: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> u x \<and> u x \<noteq> \<infinity>" |
1009 have u_range: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> u x \<and> u x \<noteq> \<infinity>" |
1010 using u(3) by auto |
1010 using u(3) by auto |
1011 fix a :: extreal assume "0 < a" "a < 1" |
1011 fix a :: ereal assume "0 < a" "a < 1" |
1012 hence "a \<noteq> 0" by auto |
1012 hence "a \<noteq> 0" by auto |
1013 let "?B i" = "{x \<in> space M. a * u x \<le> f i x}" |
1013 let "?B i" = "{x \<in> space M. a * u x \<le> f i x}" |
1014 have B: "\<And>i. ?B i \<in> sets M" |
1014 have B: "\<And>i. ?B i \<in> sets M" |
1015 using f `simple_function M u` by (auto simp: borel_measurable_simple_function) |
1015 using f `simple_function M u` by (auto simp: borel_measurable_simple_function) |
1016 |
1016 |
1054 then show "?thesis i" using continuity_from_below[OF 1 2] by simp |
1054 then show "?thesis i" using continuity_from_below[OF 1 2] by simp |
1055 qed |
1055 qed |
1056 |
1056 |
1057 have "integral\<^isup>S M u = (SUP i. integral\<^isup>S M (?uB i))" |
1057 have "integral\<^isup>S M u = (SUP i. integral\<^isup>S M (?uB i))" |
1058 unfolding simple_integral_indicator[OF B `simple_function M u`] |
1058 unfolding simple_integral_indicator[OF B `simple_function M u`] |
1059 proof (subst SUPR_extreal_setsum, safe) |
1059 proof (subst SUPR_ereal_setsum, safe) |
1060 fix x n assume "x \<in> space M" |
1060 fix x n assume "x \<in> space M" |
1061 with u_range show "incseq (\<lambda>i. u x * \<mu> (?B' (u x) i))" "\<And>i. 0 \<le> u x * \<mu> (?B' (u x) i)" |
1061 with u_range show "incseq (\<lambda>i. u x * \<mu> (?B' (u x) i))" "\<And>i. 0 \<le> u x * \<mu> (?B' (u x) i)" |
1062 using B_mono B_u by (auto intro!: measure_mono extreal_mult_left_mono incseq_SucI simp: extreal_zero_le_0_iff) |
1062 using B_mono B_u by (auto intro!: measure_mono ereal_mult_left_mono incseq_SucI simp: ereal_zero_le_0_iff) |
1063 next |
1063 next |
1064 show "integral\<^isup>S M u = (\<Sum>i\<in>u ` space M. SUP n. i * \<mu> (?B' i n))" |
1064 show "integral\<^isup>S M u = (\<Sum>i\<in>u ` space M. SUP n. i * \<mu> (?B' i n))" |
1065 using measure_conv u_range B_u unfolding simple_integral_def |
1065 using measure_conv u_range B_u unfolding simple_integral_def |
1066 by (auto intro!: setsum_cong SUPR_extreal_cmult[symmetric]) |
1066 by (auto intro!: setsum_cong SUPR_ereal_cmult[symmetric]) |
1067 qed |
1067 qed |
1068 moreover |
1068 moreover |
1069 have "a * (SUP i. integral\<^isup>S M (?uB i)) \<le> ?S" |
1069 have "a * (SUP i. integral\<^isup>S M (?uB i)) \<le> ?S" |
1070 apply (subst SUPR_extreal_cmult[symmetric]) |
1070 apply (subst SUPR_ereal_cmult[symmetric]) |
1071 proof (safe intro!: SUP_mono bexI) |
1071 proof (safe intro!: SUP_mono bexI) |
1072 fix i |
1072 fix i |
1073 have "a * integral\<^isup>S M (?uB i) = (\<integral>\<^isup>Sx. a * ?uB i x \<partial>M)" |
1073 have "a * integral\<^isup>S M (?uB i) = (\<integral>\<^isup>Sx. a * ?uB i x \<partial>M)" |
1074 using B `simple_function M u` u_range |
1074 using B `simple_function M u` u_range |
1075 by (subst simple_integral_mult) (auto split: split_indicator) |
1075 by (subst simple_integral_mult) (auto split: split_indicator) |
1232 note l = positive_integral_monotone_convergence_simple[OF this(2,5,1)] this |
1232 note l = positive_integral_monotone_convergence_simple[OF this(2,5,1)] this |
1233 |
1233 |
1234 have inc: "incseq (\<lambda>i. a * integral\<^isup>S M (u i))" "incseq (\<lambda>i. integral\<^isup>S M (v i))" |
1234 have inc: "incseq (\<lambda>i. a * integral\<^isup>S M (u i))" "incseq (\<lambda>i. integral\<^isup>S M (v i))" |
1235 using u v `0 \<le> a` |
1235 using u v `0 \<le> a` |
1236 by (auto simp: incseq_Suc_iff le_fun_def |
1236 by (auto simp: incseq_Suc_iff le_fun_def |
1237 intro!: add_mono extreal_mult_left_mono simple_integral_mono) |
1237 intro!: add_mono ereal_mult_left_mono simple_integral_mono) |
1238 have pos: "\<And>i. 0 \<le> integral\<^isup>S M (u i)" "\<And>i. 0 \<le> integral\<^isup>S M (v i)" "\<And>i. 0 \<le> a * integral\<^isup>S M (u i)" |
1238 have pos: "\<And>i. 0 \<le> integral\<^isup>S M (u i)" "\<And>i. 0 \<le> integral\<^isup>S M (v i)" "\<And>i. 0 \<le> a * integral\<^isup>S M (u i)" |
1239 using u v `0 \<le> a` by (auto simp: simple_integral_positive) |
1239 using u v `0 \<le> a` by (auto simp: simple_integral_positive) |
1240 { fix i from pos[of i] have "a * integral\<^isup>S M (u i) \<noteq> -\<infinity>" "integral\<^isup>S M (v i) \<noteq> -\<infinity>" |
1240 { fix i from pos[of i] have "a * integral\<^isup>S M (u i) \<noteq> -\<infinity>" "integral\<^isup>S M (v i) \<noteq> -\<infinity>" |
1241 by (auto split: split_if_asm) } |
1241 by (auto split: split_if_asm) } |
1242 note not_MInf = this |
1242 note not_MInf = this |
1243 |
1243 |
1244 have l': "(SUP i. integral\<^isup>S M (l i)) = (SUP i. integral\<^isup>S M (?L' i))" |
1244 have l': "(SUP i. integral\<^isup>S M (l i)) = (SUP i. integral\<^isup>S M (?L' i))" |
1245 proof (rule SUP_simple_integral_sequences[OF l(3,6,2)]) |
1245 proof (rule SUP_simple_integral_sequences[OF l(3,6,2)]) |
1246 show "incseq ?L'" "\<And>i x. 0 \<le> ?L' i x" "\<And>i. simple_function M (?L' i)" |
1246 show "incseq ?L'" "\<And>i x. 0 \<le> ?L' i x" "\<And>i. simple_function M (?L' i)" |
1247 using u v `0 \<le> a` unfolding incseq_Suc_iff le_fun_def |
1247 using u v `0 \<le> a` unfolding incseq_Suc_iff le_fun_def |
1248 by (auto intro!: add_mono extreal_mult_left_mono extreal_add_nonneg_nonneg) |
1248 by (auto intro!: add_mono ereal_mult_left_mono ereal_add_nonneg_nonneg) |
1249 { fix x |
1249 { fix x |
1250 { fix i have "a * u i x \<noteq> -\<infinity>" "v i x \<noteq> -\<infinity>" "u i x \<noteq> -\<infinity>" using `0 \<le> a` u(6)[of i x] v(6)[of i x] |
1250 { fix i have "a * u i x \<noteq> -\<infinity>" "v i x \<noteq> -\<infinity>" "u i x \<noteq> -\<infinity>" using `0 \<le> a` u(6)[of i x] v(6)[of i x] |
1251 by auto } |
1251 by auto } |
1252 then have "(SUP i. a * u i x + v i x) = a * (SUP i. u i x) + (SUP i. v i x)" |
1252 then have "(SUP i. a * u i x + v i x) = a * (SUP i. u i x) + (SUP i. v i x)" |
1253 using `0 \<le> a` u(3) v(3) u(6)[of _ x] v(6)[of _ x] |
1253 using `0 \<le> a` u(3) v(3) u(6)[of _ x] v(6)[of _ x] |
1254 by (subst SUPR_extreal_cmult[symmetric, OF u(6) `0 \<le> a`]) |
1254 by (subst SUPR_ereal_cmult[symmetric, OF u(6) `0 \<le> a`]) |
1255 (auto intro!: SUPR_extreal_add |
1255 (auto intro!: SUPR_ereal_add |
1256 simp: incseq_Suc_iff le_fun_def add_mono extreal_mult_left_mono extreal_add_nonneg_nonneg) } |
1256 simp: incseq_Suc_iff le_fun_def add_mono ereal_mult_left_mono ereal_add_nonneg_nonneg) } |
1257 then show "AE x. (SUP i. l i x) = (SUP i. ?L' i x)" |
1257 then show "AE x. (SUP i. l i x) = (SUP i. ?L' i x)" |
1258 unfolding l(5) using `0 \<le> a` u(5) v(5) l(5) f(2) g(2) |
1258 unfolding l(5) using `0 \<le> a` u(5) v(5) l(5) f(2) g(2) |
1259 by (intro AE_I2) (auto split: split_max simp add: extreal_add_nonneg_nonneg) |
1259 by (intro AE_I2) (auto split: split_max simp add: ereal_add_nonneg_nonneg) |
1260 qed |
1260 qed |
1261 also have "\<dots> = (SUP i. a * integral\<^isup>S M (u i) + integral\<^isup>S M (v i))" |
1261 also have "\<dots> = (SUP i. a * integral\<^isup>S M (u i) + integral\<^isup>S M (v i))" |
1262 using u(2, 6) v(2, 6) `0 \<le> a` by (auto intro!: arg_cong[where f="SUPR UNIV"] ext) |
1262 using u(2, 6) v(2, 6) `0 \<le> a` by (auto intro!: arg_cong[where f="SUPR UNIV"] ext) |
1263 finally have "(\<integral>\<^isup>+ x. max 0 (a * f x + g x) \<partial>M) = a * (\<integral>\<^isup>+x. max 0 (f x) \<partial>M) + (\<integral>\<^isup>+x. max 0 (g x) \<partial>M)" |
1263 finally have "(\<integral>\<^isup>+ x. max 0 (a * f x + g x) \<partial>M) = a * (\<integral>\<^isup>+x. max 0 (f x) \<partial>M) + (\<integral>\<^isup>+x. max 0 (g x) \<partial>M)" |
1264 unfolding l(5)[symmetric] u(5)[symmetric] v(5)[symmetric] |
1264 unfolding l(5)[symmetric] u(5)[symmetric] v(5)[symmetric] |
1265 unfolding l(1)[symmetric] u(1)[symmetric] v(1)[symmetric] |
1265 unfolding l(1)[symmetric] u(1)[symmetric] v(1)[symmetric] |
1266 apply (subst SUPR_extreal_cmult[symmetric, OF pos(1) `0 \<le> a`]) |
1266 apply (subst SUPR_ereal_cmult[symmetric, OF pos(1) `0 \<le> a`]) |
1267 apply (subst SUPR_extreal_add[symmetric, OF inc not_MInf]) . |
1267 apply (subst SUPR_ereal_add[symmetric, OF inc not_MInf]) . |
1268 then show ?thesis by (simp add: positive_integral_max_0) |
1268 then show ?thesis by (simp add: positive_integral_max_0) |
1269 qed |
1269 qed |
1270 |
1270 |
1271 lemma (in measure_space) positive_integral_cmult: |
1271 lemma (in measure_space) positive_integral_cmult: |
1272 assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x" "0 \<le> c" |
1272 assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x" "0 \<le> c" |
1273 shows "(\<integral>\<^isup>+ x. c * f x \<partial>M) = c * integral\<^isup>P M f" |
1273 shows "(\<integral>\<^isup>+ x. c * f x \<partial>M) = c * integral\<^isup>P M f" |
1274 proof - |
1274 proof - |
1275 have [simp]: "\<And>x. c * max 0 (f x) = max 0 (c * f x)" using `0 \<le> c` |
1275 have [simp]: "\<And>x. c * max 0 (f x) = max 0 (c * f x)" using `0 \<le> c` |
1276 by (auto split: split_max simp: extreal_zero_le_0_iff) |
1276 by (auto split: split_max simp: ereal_zero_le_0_iff) |
1277 have "(\<integral>\<^isup>+ x. c * f x \<partial>M) = (\<integral>\<^isup>+ x. c * max 0 (f x) \<partial>M)" |
1277 have "(\<integral>\<^isup>+ x. c * f x \<partial>M) = (\<integral>\<^isup>+ x. c * max 0 (f x) \<partial>M)" |
1278 by (simp add: positive_integral_max_0) |
1278 by (simp add: positive_integral_max_0) |
1279 then show ?thesis |
1279 then show ?thesis |
1280 using positive_integral_linear[OF _ _ `0 \<le> c`, of "\<lambda>x. max 0 (f x)" "\<lambda>x. 0"] f |
1280 using positive_integral_linear[OF _ _ `0 \<le> c`, of "\<lambda>x. max 0 (f x)" "\<lambda>x. 0"] f |
1281 by (auto simp: positive_integral_max_0) |
1281 by (auto simp: positive_integral_max_0) |
1373 and fin: "integral\<^isup>P M g \<noteq> \<infinity>" |
1373 and fin: "integral\<^isup>P M g \<noteq> \<infinity>" |
1374 and mono: "AE x. g x \<le> f x" |
1374 and mono: "AE x. g x \<le> f x" |
1375 shows "(\<integral>\<^isup>+ x. f x - g x \<partial>M) = integral\<^isup>P M f - integral\<^isup>P M g" |
1375 shows "(\<integral>\<^isup>+ x. f x - g x \<partial>M) = integral\<^isup>P M f - integral\<^isup>P M g" |
1376 proof - |
1376 proof - |
1377 have diff: "(\<lambda>x. f x - g x) \<in> borel_measurable M" "AE x. 0 \<le> f x - g x" |
1377 have diff: "(\<lambda>x. f x - g x) \<in> borel_measurable M" "AE x. 0 \<le> f x - g x" |
1378 using assms by (auto intro: extreal_diff_positive) |
1378 using assms by (auto intro: ereal_diff_positive) |
1379 have pos_f: "AE x. 0 \<le> f x" using mono g by auto |
1379 have pos_f: "AE x. 0 \<le> f x" using mono g by auto |
1380 { fix a b :: extreal assume "0 \<le> a" "a \<noteq> \<infinity>" "0 \<le> b" "a \<le> b" then have "b - a + a = b" |
1380 { fix a b :: ereal assume "0 \<le> a" "a \<noteq> \<infinity>" "0 \<le> b" "a \<le> b" then have "b - a + a = b" |
1381 by (cases rule: extreal2_cases[of a b]) auto } |
1381 by (cases rule: ereal2_cases[of a b]) auto } |
1382 note * = this |
1382 note * = this |
1383 then have "AE x. f x = f x - g x + g x" |
1383 then have "AE x. f x = f x - g x + g x" |
1384 using mono positive_integral_noteq_infinite[OF g fin] assms by auto |
1384 using mono positive_integral_noteq_infinite[OF g fin] assms by auto |
1385 then have **: "integral\<^isup>P M f = (\<integral>\<^isup>+x. f x - g x \<partial>M) + integral\<^isup>P M g" |
1385 then have **: "integral\<^isup>P M f = (\<integral>\<^isup>+x. f x - g x \<partial>M) + integral\<^isup>P M g" |
1386 unfolding positive_integral_add[OF diff g, symmetric] |
1386 unfolding positive_integral_add[OF diff g, symmetric] |
1387 by (rule positive_integral_cong_AE) |
1387 by (rule positive_integral_cong_AE) |
1388 show ?thesis unfolding ** |
1388 show ?thesis unfolding ** |
1389 using fin positive_integral_positive[of g] |
1389 using fin positive_integral_positive[of g] |
1390 by (cases rule: extreal2_cases[of "\<integral>\<^isup>+ x. f x - g x \<partial>M" "integral\<^isup>P M g"]) auto |
1390 by (cases rule: ereal2_cases[of "\<integral>\<^isup>+ x. f x - g x \<partial>M" "integral\<^isup>P M g"]) auto |
1391 qed |
1391 qed |
1392 |
1392 |
1393 lemma (in measure_space) positive_integral_suminf: |
1393 lemma (in measure_space) positive_integral_suminf: |
1394 assumes f: "\<And>i. f i \<in> borel_measurable M" "\<And>i. AE x. 0 \<le> f i x" |
1394 assumes f: "\<And>i. f i \<in> borel_measurable M" "\<And>i. AE x. 0 \<le> f i x" |
1395 shows "(\<integral>\<^isup>+ x. (\<Sum>i. f i x) \<partial>M) = (\<Sum>i. integral\<^isup>P M (f i))" |
1395 shows "(\<integral>\<^isup>+ x. (\<Sum>i. f i x) \<partial>M) = (\<Sum>i. integral\<^isup>P M (f i))" |
1396 proof - |
1396 proof - |
1397 have all_pos: "AE x. \<forall>i. 0 \<le> f i x" |
1397 have all_pos: "AE x. \<forall>i. 0 \<le> f i x" |
1398 using assms by (auto simp: AE_all_countable) |
1398 using assms by (auto simp: AE_all_countable) |
1399 have "(\<Sum>i. integral\<^isup>P M (f i)) = (SUP n. \<Sum>i<n. integral\<^isup>P M (f i))" |
1399 have "(\<Sum>i. integral\<^isup>P M (f i)) = (SUP n. \<Sum>i<n. integral\<^isup>P M (f i))" |
1400 using positive_integral_positive by (rule suminf_extreal_eq_SUPR) |
1400 using positive_integral_positive by (rule suminf_ereal_eq_SUPR) |
1401 also have "\<dots> = (SUP n. \<integral>\<^isup>+x. (\<Sum>i<n. f i x) \<partial>M)" |
1401 also have "\<dots> = (SUP n. \<integral>\<^isup>+x. (\<Sum>i<n. f i x) \<partial>M)" |
1402 unfolding positive_integral_setsum[OF f] .. |
1402 unfolding positive_integral_setsum[OF f] .. |
1403 also have "\<dots> = \<integral>\<^isup>+x. (SUP n. \<Sum>i<n. f i x) \<partial>M" using f all_pos |
1403 also have "\<dots> = \<integral>\<^isup>+x. (SUP n. \<Sum>i<n. f i x) \<partial>M" using f all_pos |
1404 by (intro positive_integral_monotone_convergence_SUP_AE[symmetric]) |
1404 by (intro positive_integral_monotone_convergence_SUP_AE[symmetric]) |
1405 (elim AE_mp, auto simp: setsum_nonneg simp del: setsum_lessThan_Suc intro!: AE_I2 setsum_mono3) |
1405 (elim AE_mp, auto simp: setsum_nonneg simp del: setsum_lessThan_Suc intro!: AE_I2 setsum_mono3) |
1406 also have "\<dots> = \<integral>\<^isup>+x. (\<Sum>i. f i x) \<partial>M" using all_pos |
1406 also have "\<dots> = \<integral>\<^isup>+x. (\<Sum>i. f i x) \<partial>M" using all_pos |
1407 by (intro positive_integral_cong_AE) (auto simp: suminf_extreal_eq_SUPR) |
1407 by (intro positive_integral_cong_AE) (auto simp: suminf_ereal_eq_SUPR) |
1408 finally show ?thesis by simp |
1408 finally show ?thesis by simp |
1409 qed |
1409 qed |
1410 |
1410 |
1411 text {* Fatou's lemma: convergence theorem on limes inferior *} |
1411 text {* Fatou's lemma: convergence theorem on limes inferior *} |
1412 lemma (in measure_space) positive_integral_lim_INF: |
1412 lemma (in measure_space) positive_integral_lim_INF: |
1413 fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> extreal" |
1413 fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> ereal" |
1414 assumes u: "\<And>i. u i \<in> borel_measurable M" "\<And>i. AE x. 0 \<le> u i x" |
1414 assumes u: "\<And>i. u i \<in> borel_measurable M" "\<And>i. AE x. 0 \<le> u i x" |
1415 shows "(\<integral>\<^isup>+ x. liminf (\<lambda>n. u n x) \<partial>M) \<le> liminf (\<lambda>n. integral\<^isup>P M (u n))" |
1415 shows "(\<integral>\<^isup>+ x. liminf (\<lambda>n. u n x) \<partial>M) \<le> liminf (\<lambda>n. integral\<^isup>P M (u n))" |
1416 proof - |
1416 proof - |
1417 have pos: "AE x. \<forall>i. 0 \<le> u i x" using u by (auto simp: AE_all_countable) |
1417 have pos: "AE x. \<forall>i. 0 \<le> u i x" using u by (auto simp: AE_all_countable) |
1418 have "(\<integral>\<^isup>+ x. liminf (\<lambda>n. u n x) \<partial>M) = |
1418 have "(\<integral>\<^isup>+ x. liminf (\<lambda>n. u n x) \<partial>M) = |
1539 proof |
1539 proof |
1540 assume "\<mu> ?A = 0" |
1540 assume "\<mu> ?A = 0" |
1541 with positive_integral_null_set[of ?A u] u |
1541 with positive_integral_null_set[of ?A u] u |
1542 show "integral\<^isup>P M u = 0" by (simp add: u_eq) |
1542 show "integral\<^isup>P M u = 0" by (simp add: u_eq) |
1543 next |
1543 next |
1544 { fix r :: extreal and n :: nat assume gt_1: "1 \<le> real n * r" |
1544 { fix r :: ereal and n :: nat assume gt_1: "1 \<le> real n * r" |
1545 then have "0 < real n * r" by (cases r) (auto split: split_if_asm simp: one_extreal_def) |
1545 then have "0 < real n * r" by (cases r) (auto split: split_if_asm simp: one_ereal_def) |
1546 then have "0 \<le> r" by (auto simp add: extreal_zero_less_0_iff) } |
1546 then have "0 \<le> r" by (auto simp add: ereal_zero_less_0_iff) } |
1547 note gt_1 = this |
1547 note gt_1 = this |
1548 assume *: "integral\<^isup>P M u = 0" |
1548 assume *: "integral\<^isup>P M u = 0" |
1549 let "?M n" = "{x \<in> space M. 1 \<le> real (n::nat) * u x}" |
1549 let "?M n" = "{x \<in> space M. 1 \<le> real (n::nat) * u x}" |
1550 have "0 = (SUP n. \<mu> (?M n \<inter> ?A))" |
1550 have "0 = (SUP n. \<mu> (?M n \<inter> ?A))" |
1551 proof - |
1551 proof - |
1552 { fix n :: nat |
1552 { fix n :: nat |
1553 from positive_integral_Markov_inequality[OF u pos, of ?A "extreal (real n)"] |
1553 from positive_integral_Markov_inequality[OF u pos, of ?A "ereal (real n)"] |
1554 have "\<mu> (?M n \<inter> ?A) \<le> 0" unfolding u_eq * using u by simp |
1554 have "\<mu> (?M n \<inter> ?A) \<le> 0" unfolding u_eq * using u by simp |
1555 moreover have "0 \<le> \<mu> (?M n \<inter> ?A)" using u by auto |
1555 moreover have "0 \<le> \<mu> (?M n \<inter> ?A)" using u by auto |
1556 ultimately have "\<mu> (?M n \<inter> ?A) = 0" by auto } |
1556 ultimately have "\<mu> (?M n \<inter> ?A) = 0" by auto } |
1557 thus ?thesis by simp |
1557 thus ?thesis by simp |
1558 qed |
1558 qed |
1673 |
1673 |
1674 section "Lebesgue Integral" |
1674 section "Lebesgue Integral" |
1675 |
1675 |
1676 definition integrable where |
1676 definition integrable where |
1677 "integrable M f \<longleftrightarrow> f \<in> borel_measurable M \<and> |
1677 "integrable M f \<longleftrightarrow> f \<in> borel_measurable M \<and> |
1678 (\<integral>\<^isup>+ x. extreal (f x) \<partial>M) \<noteq> \<infinity> \<and> (\<integral>\<^isup>+ x. extreal (- f x) \<partial>M) \<noteq> \<infinity>" |
1678 (\<integral>\<^isup>+ x. ereal (f x) \<partial>M) \<noteq> \<infinity> \<and> (\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) \<noteq> \<infinity>" |
1679 |
1679 |
1680 lemma integrableD[dest]: |
1680 lemma integrableD[dest]: |
1681 assumes "integrable M f" |
1681 assumes "integrable M f" |
1682 shows "f \<in> borel_measurable M" "(\<integral>\<^isup>+ x. extreal (f x) \<partial>M) \<noteq> \<infinity>" "(\<integral>\<^isup>+ x. extreal (- f x) \<partial>M) \<noteq> \<infinity>" |
1682 shows "f \<in> borel_measurable M" "(\<integral>\<^isup>+ x. ereal (f x) \<partial>M) \<noteq> \<infinity>" "(\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) \<noteq> \<infinity>" |
1683 using assms unfolding integrable_def by auto |
1683 using assms unfolding integrable_def by auto |
1684 |
1684 |
1685 definition lebesgue_integral_def: |
1685 definition lebesgue_integral_def: |
1686 "integral\<^isup>L M f = real ((\<integral>\<^isup>+ x. extreal (f x) \<partial>M)) - real ((\<integral>\<^isup>+ x. extreal (- f x) \<partial>M))" |
1686 "integral\<^isup>L M f = real ((\<integral>\<^isup>+ x. ereal (f x) \<partial>M)) - real ((\<integral>\<^isup>+ x. ereal (- f x) \<partial>M))" |
1687 |
1687 |
1688 syntax |
1688 syntax |
1689 "_lebesgue_integral" :: "'a \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> ('a, 'b) measure_space_scheme \<Rightarrow> real" ("\<integral> _. _ \<partial>_" [60,61] 110) |
1689 "_lebesgue_integral" :: "'a \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> ('a, 'b) measure_space_scheme \<Rightarrow> real" ("\<integral> _. _ \<partial>_" [60,61] 110) |
1690 |
1690 |
1691 translations |
1691 translations |
1692 "\<integral> x. f \<partial>M" == "CONST integral\<^isup>L M (%x. f)" |
1692 "\<integral> x. f \<partial>M" == "CONST integral\<^isup>L M (%x. f)" |
1693 |
1693 |
1694 lemma (in measure_space) integrableE: |
1694 lemma (in measure_space) integrableE: |
1695 assumes "integrable M f" |
1695 assumes "integrable M f" |
1696 obtains r q where |
1696 obtains r q where |
1697 "(\<integral>\<^isup>+x. extreal (f x)\<partial>M) = extreal r" |
1697 "(\<integral>\<^isup>+x. ereal (f x)\<partial>M) = ereal r" |
1698 "(\<integral>\<^isup>+x. extreal (-f x)\<partial>M) = extreal q" |
1698 "(\<integral>\<^isup>+x. ereal (-f x)\<partial>M) = ereal q" |
1699 "f \<in> borel_measurable M" "integral\<^isup>L M f = r - q" |
1699 "f \<in> borel_measurable M" "integral\<^isup>L M f = r - q" |
1700 using assms unfolding integrable_def lebesgue_integral_def |
1700 using assms unfolding integrable_def lebesgue_integral_def |
1701 using positive_integral_positive[of "\<lambda>x. extreal (f x)"] |
1701 using positive_integral_positive[of "\<lambda>x. ereal (f x)"] |
1702 using positive_integral_positive[of "\<lambda>x. extreal (-f x)"] |
1702 using positive_integral_positive[of "\<lambda>x. ereal (-f x)"] |
1703 by (cases rule: extreal2_cases[of "(\<integral>\<^isup>+x. extreal (-f x)\<partial>M)" "(\<integral>\<^isup>+x. extreal (f x)\<partial>M)"]) auto |
1703 by (cases rule: ereal2_cases[of "(\<integral>\<^isup>+x. ereal (-f x)\<partial>M)" "(\<integral>\<^isup>+x. ereal (f x)\<partial>M)"]) auto |
1704 |
1704 |
1705 lemma (in measure_space) integral_cong: |
1705 lemma (in measure_space) integral_cong: |
1706 assumes "\<And>x. x \<in> space M \<Longrightarrow> f x = g x" |
1706 assumes "\<And>x. x \<in> space M \<Longrightarrow> f x = g x" |
1707 shows "integral\<^isup>L M f = integral\<^isup>L M g" |
1707 shows "integral\<^isup>L M f = integral\<^isup>L M g" |
1708 using assms by (simp cong: positive_integral_cong add: lebesgue_integral_def) |
1708 using assms by (simp cong: positive_integral_cong add: lebesgue_integral_def) |
1720 |
1720 |
1721 lemma (in measure_space) integral_cong_AE: |
1721 lemma (in measure_space) integral_cong_AE: |
1722 assumes cong: "AE x. f x = g x" |
1722 assumes cong: "AE x. f x = g x" |
1723 shows "integral\<^isup>L M f = integral\<^isup>L M g" |
1723 shows "integral\<^isup>L M f = integral\<^isup>L M g" |
1724 proof - |
1724 proof - |
1725 have *: "AE x. extreal (f x) = extreal (g x)" |
1725 have *: "AE x. ereal (f x) = ereal (g x)" |
1726 "AE x. extreal (- f x) = extreal (- g x)" using cong by auto |
1726 "AE x. ereal (- f x) = ereal (- g x)" using cong by auto |
1727 show ?thesis |
1727 show ?thesis |
1728 unfolding *[THEN positive_integral_cong_AE] lebesgue_integral_def .. |
1728 unfolding *[THEN positive_integral_cong_AE] lebesgue_integral_def .. |
1729 qed |
1729 qed |
1730 |
1730 |
1731 lemma (in measure_space) integrable_cong_AE: |
1731 lemma (in measure_space) integrable_cong_AE: |
1732 assumes borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M" |
1732 assumes borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M" |
1733 assumes "AE x. f x = g x" |
1733 assumes "AE x. f x = g x" |
1734 shows "integrable M f = integrable M g" |
1734 shows "integrable M f = integrable M g" |
1735 proof - |
1735 proof - |
1736 have "(\<integral>\<^isup>+ x. extreal (f x) \<partial>M) = (\<integral>\<^isup>+ x. extreal (g x) \<partial>M)" |
1736 have "(\<integral>\<^isup>+ x. ereal (f x) \<partial>M) = (\<integral>\<^isup>+ x. ereal (g x) \<partial>M)" |
1737 "(\<integral>\<^isup>+ x. extreal (- f x) \<partial>M) = (\<integral>\<^isup>+ x. extreal (- g x) \<partial>M)" |
1737 "(\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) = (\<integral>\<^isup>+ x. ereal (- g x) \<partial>M)" |
1738 using assms by (auto intro!: positive_integral_cong_AE) |
1738 using assms by (auto intro!: positive_integral_cong_AE) |
1739 with assms show ?thesis |
1739 with assms show ?thesis |
1740 by (auto simp: integrable_def) |
1740 by (auto simp: integrable_def) |
1741 qed |
1741 qed |
1742 |
1742 |
1793 (is "\<And>A. _ \<Longrightarrow> _ = ?d A") |
1793 (is "\<And>A. _ \<Longrightarrow> _ = ?d A") |
1794 shows "integral\<^isup>L N g = (\<integral> x. f x * g x \<partial>M)" (is ?integral) |
1794 shows "integral\<^isup>L N g = (\<integral> x. f x * g x \<partial>M)" (is ?integral) |
1795 and "integrable N g = integrable M (\<lambda>x. f x * g x)" (is ?integrable) |
1795 and "integrable N g = integrable M (\<lambda>x. f x * g x)" (is ?integrable) |
1796 proof - |
1796 proof - |
1797 from f have ms: "measure_space (M\<lparr>measure := ?d\<rparr>)" |
1797 from f have ms: "measure_space (M\<lparr>measure := ?d\<rparr>)" |
1798 by (intro measure_space_density[where u="\<lambda>x. extreal (f x)"]) auto |
1798 by (intro measure_space_density[where u="\<lambda>x. ereal (f x)"]) auto |
1799 |
1799 |
1800 from ms density N have "(\<integral>\<^isup>+ x. g x \<partial>N) = (\<integral>\<^isup>+ x. max 0 (extreal (g x)) \<partial>M\<lparr>measure := ?d\<rparr>)" |
1800 from ms density N have "(\<integral>\<^isup>+ x. g x \<partial>N) = (\<integral>\<^isup>+ x. max 0 (ereal (g x)) \<partial>M\<lparr>measure := ?d\<rparr>)" |
1801 unfolding positive_integral_max_0 |
1801 unfolding positive_integral_max_0 |
1802 by (intro measure_space.positive_integral_cong_measure) auto |
1802 by (intro measure_space.positive_integral_cong_measure) auto |
1803 also have "\<dots> = (\<integral>\<^isup>+ x. extreal (f x) * max 0 (extreal (g x)) \<partial>M)" |
1803 also have "\<dots> = (\<integral>\<^isup>+ x. ereal (f x) * max 0 (ereal (g x)) \<partial>M)" |
1804 using f g by (intro positive_integral_translated_density) auto |
1804 using f g by (intro positive_integral_translated_density) auto |
1805 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (extreal (f x * g x)) \<partial>M)" |
1805 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (ereal (f x * g x)) \<partial>M)" |
1806 using f by (intro positive_integral_cong_AE) |
1806 using f by (intro positive_integral_cong_AE) |
1807 (auto simp: extreal_max_0 zero_le_mult_iff split: split_max) |
1807 (auto simp: ereal_max_0 zero_le_mult_iff split: split_max) |
1808 finally have pos: "(\<integral>\<^isup>+ x. g x \<partial>N) = (\<integral>\<^isup>+ x. f x * g x \<partial>M)" |
1808 finally have pos: "(\<integral>\<^isup>+ x. g x \<partial>N) = (\<integral>\<^isup>+ x. f x * g x \<partial>M)" |
1809 by (simp add: positive_integral_max_0) |
1809 by (simp add: positive_integral_max_0) |
1810 |
1810 |
1811 from ms density N have "(\<integral>\<^isup>+ x. - (g x) \<partial>N) = (\<integral>\<^isup>+ x. max 0 (extreal (- g x)) \<partial>M\<lparr>measure := ?d\<rparr>)" |
1811 from ms density N have "(\<integral>\<^isup>+ x. - (g x) \<partial>N) = (\<integral>\<^isup>+ x. max 0 (ereal (- g x)) \<partial>M\<lparr>measure := ?d\<rparr>)" |
1812 unfolding positive_integral_max_0 |
1812 unfolding positive_integral_max_0 |
1813 by (intro measure_space.positive_integral_cong_measure) auto |
1813 by (intro measure_space.positive_integral_cong_measure) auto |
1814 also have "\<dots> = (\<integral>\<^isup>+ x. extreal (f x) * max 0 (extreal (- g x)) \<partial>M)" |
1814 also have "\<dots> = (\<integral>\<^isup>+ x. ereal (f x) * max 0 (ereal (- g x)) \<partial>M)" |
1815 using f g by (intro positive_integral_translated_density) auto |
1815 using f g by (intro positive_integral_translated_density) auto |
1816 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (extreal (- f x * g x)) \<partial>M)" |
1816 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (ereal (- f x * g x)) \<partial>M)" |
1817 using f by (intro positive_integral_cong_AE) |
1817 using f by (intro positive_integral_cong_AE) |
1818 (auto simp: extreal_max_0 mult_le_0_iff split: split_max) |
1818 (auto simp: ereal_max_0 mult_le_0_iff split: split_max) |
1819 finally have neg: "(\<integral>\<^isup>+ x. - g x \<partial>N) = (\<integral>\<^isup>+ x. - (f x * g x) \<partial>M)" |
1819 finally have neg: "(\<integral>\<^isup>+ x. - g x \<partial>N) = (\<integral>\<^isup>+ x. - (f x * g x) \<partial>M)" |
1820 by (simp add: positive_integral_max_0) |
1820 by (simp add: positive_integral_max_0) |
1821 |
1821 |
1822 have g_N: "g \<in> borel_measurable N" |
1822 have g_N: "g \<in> borel_measurable N" |
1823 using g N unfolding measurable_def by simp |
1823 using g N unfolding measurable_def by simp |
1844 lemma (in measure_space) integral_of_positive_diff: |
1844 lemma (in measure_space) integral_of_positive_diff: |
1845 assumes integrable: "integrable M u" "integrable M v" |
1845 assumes integrable: "integrable M u" "integrable M v" |
1846 and f_def: "\<And>x. f x = u x - v x" and pos: "\<And>x. 0 \<le> u x" "\<And>x. 0 \<le> v x" |
1846 and f_def: "\<And>x. f x = u x - v x" and pos: "\<And>x. 0 \<le> u x" "\<And>x. 0 \<le> v x" |
1847 shows "integrable M f" and "integral\<^isup>L M f = integral\<^isup>L M u - integral\<^isup>L M v" |
1847 shows "integrable M f" and "integral\<^isup>L M f = integral\<^isup>L M u - integral\<^isup>L M v" |
1848 proof - |
1848 proof - |
1849 let "?f x" = "max 0 (extreal (f x))" |
1849 let "?f x" = "max 0 (ereal (f x))" |
1850 let "?mf x" = "max 0 (extreal (- f x))" |
1850 let "?mf x" = "max 0 (ereal (- f x))" |
1851 let "?u x" = "max 0 (extreal (u x))" |
1851 let "?u x" = "max 0 (ereal (u x))" |
1852 let "?v x" = "max 0 (extreal (v x))" |
1852 let "?v x" = "max 0 (ereal (v x))" |
1853 |
1853 |
1854 from borel_measurable_diff[of u v] integrable |
1854 from borel_measurable_diff[of u v] integrable |
1855 have f_borel: "?f \<in> borel_measurable M" and |
1855 have f_borel: "?f \<in> borel_measurable M" and |
1856 mf_borel: "?mf \<in> borel_measurable M" and |
1856 mf_borel: "?mf \<in> borel_measurable M" and |
1857 v_borel: "?v \<in> borel_measurable M" and |
1857 v_borel: "?v \<in> borel_measurable M" and |
1858 u_borel: "?u \<in> borel_measurable M" and |
1858 u_borel: "?u \<in> borel_measurable M" and |
1859 "f \<in> borel_measurable M" |
1859 "f \<in> borel_measurable M" |
1860 by (auto simp: f_def[symmetric] integrable_def) |
1860 by (auto simp: f_def[symmetric] integrable_def) |
1861 |
1861 |
1862 have "(\<integral>\<^isup>+ x. extreal (u x - v x) \<partial>M) \<le> integral\<^isup>P M ?u" |
1862 have "(\<integral>\<^isup>+ x. ereal (u x - v x) \<partial>M) \<le> integral\<^isup>P M ?u" |
1863 using pos by (auto intro!: positive_integral_mono simp: positive_integral_max_0) |
1863 using pos by (auto intro!: positive_integral_mono simp: positive_integral_max_0) |
1864 moreover have "(\<integral>\<^isup>+ x. extreal (v x - u x) \<partial>M) \<le> integral\<^isup>P M ?v" |
1864 moreover have "(\<integral>\<^isup>+ x. ereal (v x - u x) \<partial>M) \<le> integral\<^isup>P M ?v" |
1865 using pos by (auto intro!: positive_integral_mono simp: positive_integral_max_0) |
1865 using pos by (auto intro!: positive_integral_mono simp: positive_integral_max_0) |
1866 ultimately show f: "integrable M f" |
1866 ultimately show f: "integrable M f" |
1867 using `integrable M u` `integrable M v` `f \<in> borel_measurable M` |
1867 using `integrable M u` `integrable M v` `f \<in> borel_measurable M` |
1868 by (auto simp: integrable_def f_def positive_integral_max_0) |
1868 by (auto simp: integrable_def f_def positive_integral_max_0) |
1869 |
1869 |
1884 lemma (in measure_space) integral_linear: |
1884 lemma (in measure_space) integral_linear: |
1885 assumes "integrable M f" "integrable M g" and "0 \<le> a" |
1885 assumes "integrable M f" "integrable M g" and "0 \<le> a" |
1886 shows "integrable M (\<lambda>t. a * f t + g t)" |
1886 shows "integrable M (\<lambda>t. a * f t + g t)" |
1887 and "(\<integral> t. a * f t + g t \<partial>M) = a * integral\<^isup>L M f + integral\<^isup>L M g" (is ?EQ) |
1887 and "(\<integral> t. a * f t + g t \<partial>M) = a * integral\<^isup>L M f + integral\<^isup>L M g" (is ?EQ) |
1888 proof - |
1888 proof - |
1889 let "?f x" = "max 0 (extreal (f x))" |
1889 let "?f x" = "max 0 (ereal (f x))" |
1890 let "?g x" = "max 0 (extreal (g x))" |
1890 let "?g x" = "max 0 (ereal (g x))" |
1891 let "?mf x" = "max 0 (extreal (- f x))" |
1891 let "?mf x" = "max 0 (ereal (- f x))" |
1892 let "?mg x" = "max 0 (extreal (- g x))" |
1892 let "?mg x" = "max 0 (ereal (- g x))" |
1893 let "?p t" = "max 0 (a * f t) + max 0 (g t)" |
1893 let "?p t" = "max 0 (a * f t) + max 0 (g t)" |
1894 let "?n t" = "max 0 (- (a * f t)) + max 0 (- g t)" |
1894 let "?n t" = "max 0 (- (a * f t)) + max 0 (- g t)" |
1895 |
1895 |
1896 from assms have linear: |
1896 from assms have linear: |
1897 "(\<integral>\<^isup>+ x. extreal a * ?f x + ?g x \<partial>M) = extreal a * integral\<^isup>P M ?f + integral\<^isup>P M ?g" |
1897 "(\<integral>\<^isup>+ x. ereal a * ?f x + ?g x \<partial>M) = ereal a * integral\<^isup>P M ?f + integral\<^isup>P M ?g" |
1898 "(\<integral>\<^isup>+ x. extreal a * ?mf x + ?mg x \<partial>M) = extreal a * integral\<^isup>P M ?mf + integral\<^isup>P M ?mg" |
1898 "(\<integral>\<^isup>+ x. ereal a * ?mf x + ?mg x \<partial>M) = ereal a * integral\<^isup>P M ?mf + integral\<^isup>P M ?mg" |
1899 by (auto intro!: positive_integral_linear simp: integrable_def) |
1899 by (auto intro!: positive_integral_linear simp: integrable_def) |
1900 |
1900 |
1901 have *: "(\<integral>\<^isup>+x. extreal (- ?p x) \<partial>M) = 0" "(\<integral>\<^isup>+x. extreal (- ?n x) \<partial>M) = 0" |
1901 have *: "(\<integral>\<^isup>+x. ereal (- ?p x) \<partial>M) = 0" "(\<integral>\<^isup>+x. ereal (- ?n x) \<partial>M) = 0" |
1902 using `0 \<le> a` assms by (auto simp: positive_integral_0_iff_AE integrable_def) |
1902 using `0 \<le> a` assms by (auto simp: positive_integral_0_iff_AE integrable_def) |
1903 have **: "\<And>x. extreal a * ?f x + ?g x = max 0 (extreal (?p x))" |
1903 have **: "\<And>x. ereal a * ?f x + ?g x = max 0 (ereal (?p x))" |
1904 "\<And>x. extreal a * ?mf x + ?mg x = max 0 (extreal (?n x))" |
1904 "\<And>x. ereal a * ?mf x + ?mg x = max 0 (ereal (?n x))" |
1905 using `0 \<le> a` by (auto split: split_max simp: zero_le_mult_iff mult_le_0_iff) |
1905 using `0 \<le> a` by (auto split: split_max simp: zero_le_mult_iff mult_le_0_iff) |
1906 |
1906 |
1907 have "integrable M ?p" "integrable M ?n" |
1907 have "integrable M ?p" "integrable M ?n" |
1908 "\<And>t. a * f t + g t = ?p t - ?n t" "\<And>t. 0 \<le> ?p t" "\<And>t. 0 \<le> ?n t" |
1908 "\<And>t. a * f t + g t = ?p t - ?n t" "\<And>t. 0 \<le> ?p t" "\<And>t. 0 \<le> ?n t" |
1909 using linear assms unfolding integrable_def ** * |
1909 using linear assms unfolding integrable_def ** * |
2055 and f: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x" |
2055 and f: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x" |
2056 "\<And>x. x \<in> space M \<Longrightarrow> \<bar>g x\<bar> \<le> f x" |
2056 "\<And>x. x \<in> space M \<Longrightarrow> \<bar>g x\<bar> \<le> f x" |
2057 assumes borel: "g \<in> borel_measurable M" |
2057 assumes borel: "g \<in> borel_measurable M" |
2058 shows "integrable M g" |
2058 shows "integrable M g" |
2059 proof - |
2059 proof - |
2060 have "(\<integral>\<^isup>+ x. extreal (g x) \<partial>M) \<le> (\<integral>\<^isup>+ x. extreal \<bar>g x\<bar> \<partial>M)" |
2060 have "(\<integral>\<^isup>+ x. ereal (g x) \<partial>M) \<le> (\<integral>\<^isup>+ x. ereal \<bar>g x\<bar> \<partial>M)" |
2061 by (auto intro!: positive_integral_mono) |
2061 by (auto intro!: positive_integral_mono) |
2062 also have "\<dots> \<le> (\<integral>\<^isup>+ x. extreal (f x) \<partial>M)" |
2062 also have "\<dots> \<le> (\<integral>\<^isup>+ x. ereal (f x) \<partial>M)" |
2063 using f by (auto intro!: positive_integral_mono) |
2063 using f by (auto intro!: positive_integral_mono) |
2064 also have "\<dots> < \<infinity>" |
2064 also have "\<dots> < \<infinity>" |
2065 using `integrable M f` unfolding integrable_def by auto |
2065 using `integrable M f` unfolding integrable_def by auto |
2066 finally have pos: "(\<integral>\<^isup>+ x. extreal (g x) \<partial>M) < \<infinity>" . |
2066 finally have pos: "(\<integral>\<^isup>+ x. ereal (g x) \<partial>M) < \<infinity>" . |
2067 |
2067 |
2068 have "(\<integral>\<^isup>+ x. extreal (- g x) \<partial>M) \<le> (\<integral>\<^isup>+ x. extreal (\<bar>g x\<bar>) \<partial>M)" |
2068 have "(\<integral>\<^isup>+ x. ereal (- g x) \<partial>M) \<le> (\<integral>\<^isup>+ x. ereal (\<bar>g x\<bar>) \<partial>M)" |
2069 by (auto intro!: positive_integral_mono) |
2069 by (auto intro!: positive_integral_mono) |
2070 also have "\<dots> \<le> (\<integral>\<^isup>+ x. extreal (f x) \<partial>M)" |
2070 also have "\<dots> \<le> (\<integral>\<^isup>+ x. ereal (f x) \<partial>M)" |
2071 using f by (auto intro!: positive_integral_mono) |
2071 using f by (auto intro!: positive_integral_mono) |
2072 also have "\<dots> < \<infinity>" |
2072 also have "\<dots> < \<infinity>" |
2073 using `integrable M f` unfolding integrable_def by auto |
2073 using `integrable M f` unfolding integrable_def by auto |
2074 finally have neg: "(\<integral>\<^isup>+ x. extreal (- g x) \<partial>M) < \<infinity>" . |
2074 finally have neg: "(\<integral>\<^isup>+ x. ereal (- g x) \<partial>M) < \<infinity>" . |
2075 |
2075 |
2076 from neg pos borel show ?thesis |
2076 from neg pos borel show ?thesis |
2077 unfolding integrable_def by auto |
2077 unfolding integrable_def by auto |
2078 qed |
2078 qed |
2079 |
2079 |
2141 { fix x have "0 \<le> u x" |
2141 { fix x have "0 \<le> u x" |
2142 using mono pos[of 0 x] incseq_le[OF _ lim, of x 0] |
2142 using mono pos[of 0 x] incseq_le[OF _ lim, of x 0] |
2143 by (simp add: mono_def incseq_def) } |
2143 by (simp add: mono_def incseq_def) } |
2144 note pos_u = this |
2144 note pos_u = this |
2145 |
2145 |
2146 have SUP_F: "\<And>x. (SUP n. extreal (f n x)) = extreal (u x)" |
2146 have SUP_F: "\<And>x. (SUP n. ereal (f n x)) = ereal (u x)" |
2147 unfolding SUP_eq_LIMSEQ[OF mono] by (rule lim) |
2147 unfolding SUP_eq_LIMSEQ[OF mono] by (rule lim) |
2148 |
2148 |
2149 have borel_f: "\<And>i. (\<lambda>x. extreal (f i x)) \<in> borel_measurable M" |
2149 have borel_f: "\<And>i. (\<lambda>x. ereal (f i x)) \<in> borel_measurable M" |
2150 using i unfolding integrable_def by auto |
2150 using i unfolding integrable_def by auto |
2151 hence "(\<lambda>x. SUP i. extreal (f i x)) \<in> borel_measurable M" |
2151 hence "(\<lambda>x. SUP i. ereal (f i x)) \<in> borel_measurable M" |
2152 by auto |
2152 by auto |
2153 hence borel_u: "u \<in> borel_measurable M" |
2153 hence borel_u: "u \<in> borel_measurable M" |
2154 by (auto simp: borel_measurable_extreal_iff SUP_F) |
2154 by (auto simp: borel_measurable_ereal_iff SUP_F) |
2155 |
2155 |
2156 hence [simp]: "\<And>i. (\<integral>\<^isup>+x. extreal (- f i x) \<partial>M) = 0" "(\<integral>\<^isup>+x. extreal (- u x) \<partial>M) = 0" |
2156 hence [simp]: "\<And>i. (\<integral>\<^isup>+x. ereal (- f i x) \<partial>M) = 0" "(\<integral>\<^isup>+x. ereal (- u x) \<partial>M) = 0" |
2157 using i borel_u pos pos_u by (auto simp: positive_integral_0_iff_AE integrable_def) |
2157 using i borel_u pos pos_u by (auto simp: positive_integral_0_iff_AE integrable_def) |
2158 |
2158 |
2159 have integral_eq: "\<And>n. (\<integral>\<^isup>+ x. extreal (f n x) \<partial>M) = extreal (integral\<^isup>L M (f n))" |
2159 have integral_eq: "\<And>n. (\<integral>\<^isup>+ x. ereal (f n x) \<partial>M) = ereal (integral\<^isup>L M (f n))" |
2160 using i positive_integral_positive by (auto simp: extreal_real lebesgue_integral_def integrable_def) |
2160 using i positive_integral_positive by (auto simp: ereal_real lebesgue_integral_def integrable_def) |
2161 |
2161 |
2162 have pos_integral: "\<And>n. 0 \<le> integral\<^isup>L M (f n)" |
2162 have pos_integral: "\<And>n. 0 \<le> integral\<^isup>L M (f n)" |
2163 using pos i by (auto simp: integral_positive) |
2163 using pos i by (auto simp: integral_positive) |
2164 hence "0 \<le> x" |
2164 hence "0 \<le> x" |
2165 using LIMSEQ_le_const[OF ilim, of 0] by auto |
2165 using LIMSEQ_le_const[OF ilim, of 0] by auto |
2166 |
2166 |
2167 from mono pos i have pI: "(\<integral>\<^isup>+ x. extreal (u x) \<partial>M) = (SUP n. (\<integral>\<^isup>+ x. extreal (f n x) \<partial>M))" |
2167 from mono pos i have pI: "(\<integral>\<^isup>+ x. ereal (u x) \<partial>M) = (SUP n. (\<integral>\<^isup>+ x. ereal (f n x) \<partial>M))" |
2168 by (auto intro!: positive_integral_monotone_convergence_SUP |
2168 by (auto intro!: positive_integral_monotone_convergence_SUP |
2169 simp: integrable_def incseq_mono incseq_Suc_iff le_fun_def SUP_F[symmetric]) |
2169 simp: integrable_def incseq_mono incseq_Suc_iff le_fun_def SUP_F[symmetric]) |
2170 also have "\<dots> = extreal x" unfolding integral_eq |
2170 also have "\<dots> = ereal x" unfolding integral_eq |
2171 proof (rule SUP_eq_LIMSEQ[THEN iffD2]) |
2171 proof (rule SUP_eq_LIMSEQ[THEN iffD2]) |
2172 show "mono (\<lambda>n. integral\<^isup>L M (f n))" |
2172 show "mono (\<lambda>n. integral\<^isup>L M (f n))" |
2173 using mono i by (auto simp: mono_def intro!: integral_mono) |
2173 using mono i by (auto simp: mono_def intro!: integral_mono) |
2174 show "(\<lambda>n. integral\<^isup>L M (f n)) ----> x" using ilim . |
2174 show "(\<lambda>n. integral\<^isup>L M (f n)) ----> x" using ilim . |
2175 qed |
2175 qed |
2203 |
2203 |
2204 lemma (in measure_space) integral_0_iff: |
2204 lemma (in measure_space) integral_0_iff: |
2205 assumes "integrable M f" |
2205 assumes "integrable M f" |
2206 shows "(\<integral>x. \<bar>f x\<bar> \<partial>M) = 0 \<longleftrightarrow> \<mu> {x\<in>space M. f x \<noteq> 0} = 0" |
2206 shows "(\<integral>x. \<bar>f x\<bar> \<partial>M) = 0 \<longleftrightarrow> \<mu> {x\<in>space M. f x \<noteq> 0} = 0" |
2207 proof - |
2207 proof - |
2208 have *: "(\<integral>\<^isup>+x. extreal (- \<bar>f x\<bar>) \<partial>M) = 0" |
2208 have *: "(\<integral>\<^isup>+x. ereal (- \<bar>f x\<bar>) \<partial>M) = 0" |
2209 using assms by (auto simp: positive_integral_0_iff_AE integrable_def) |
2209 using assms by (auto simp: positive_integral_0_iff_AE integrable_def) |
2210 have "integrable M (\<lambda>x. \<bar>f x\<bar>)" using assms by (rule integrable_abs) |
2210 have "integrable M (\<lambda>x. \<bar>f x\<bar>)" using assms by (rule integrable_abs) |
2211 hence "(\<lambda>x. extreal (\<bar>f x\<bar>)) \<in> borel_measurable M" |
2211 hence "(\<lambda>x. ereal (\<bar>f x\<bar>)) \<in> borel_measurable M" |
2212 "(\<integral>\<^isup>+ x. extreal \<bar>f x\<bar> \<partial>M) \<noteq> \<infinity>" unfolding integrable_def by auto |
2212 "(\<integral>\<^isup>+ x. ereal \<bar>f x\<bar> \<partial>M) \<noteq> \<infinity>" unfolding integrable_def by auto |
2213 from positive_integral_0_iff[OF this(1)] this(2) |
2213 from positive_integral_0_iff[OF this(1)] this(2) |
2214 show ?thesis unfolding lebesgue_integral_def * |
2214 show ?thesis unfolding lebesgue_integral_def * |
2215 using positive_integral_positive[of "\<lambda>x. extreal \<bar>f x\<bar>"] |
2215 using positive_integral_positive[of "\<lambda>x. ereal \<bar>f x\<bar>"] |
2216 by (auto simp add: real_of_extreal_eq_0) |
2216 by (auto simp add: real_of_ereal_eq_0) |
2217 qed |
2217 qed |
2218 |
2218 |
2219 lemma (in measure_space) positive_integral_PInf: |
2219 lemma (in measure_space) positive_integral_PInf: |
2220 assumes f: "f \<in> borel_measurable M" |
2220 assumes f: "f \<in> borel_measurable M" |
2221 and not_Inf: "integral\<^isup>P M f \<noteq> \<infinity>" |
2221 and not_Inf: "integral\<^isup>P M f \<noteq> \<infinity>" |
2253 qed |
2253 qed |
2254 |
2254 |
2255 lemma (in measure_space) integral_real: |
2255 lemma (in measure_space) integral_real: |
2256 "AE x. \<bar>f x\<bar> \<noteq> \<infinity> \<Longrightarrow> (\<integral>x. real (f x) \<partial>M) = real (integral\<^isup>P M f) - real (integral\<^isup>P M (\<lambda>x. - f x))" |
2256 "AE x. \<bar>f x\<bar> \<noteq> \<infinity> \<Longrightarrow> (\<integral>x. real (f x) \<partial>M) = real (integral\<^isup>P M f) - real (integral\<^isup>P M (\<lambda>x. - f x))" |
2257 using assms unfolding lebesgue_integral_def |
2257 using assms unfolding lebesgue_integral_def |
2258 by (subst (1 2) positive_integral_cong_AE) (auto simp add: extreal_real) |
2258 by (subst (1 2) positive_integral_cong_AE) (auto simp add: ereal_real) |
2259 |
2259 |
2260 lemma (in finite_measure) lebesgue_integral_const[simp]: |
2260 lemma (in finite_measure) lebesgue_integral_const[simp]: |
2261 shows "integrable M (\<lambda>x. a)" |
2261 shows "integrable M (\<lambda>x. a)" |
2262 and "(\<integral>x. a \<partial>M) = a * \<mu>' (space M)" |
2262 and "(\<integral>x. a \<partial>M) = a * \<mu>' (space M)" |
2263 proof - |
2263 proof - |
2264 { fix a :: real assume "0 \<le> a" |
2264 { fix a :: real assume "0 \<le> a" |
2265 then have "(\<integral>\<^isup>+ x. extreal a \<partial>M) = extreal a * \<mu> (space M)" |
2265 then have "(\<integral>\<^isup>+ x. ereal a \<partial>M) = ereal a * \<mu> (space M)" |
2266 by (subst positive_integral_const) auto |
2266 by (subst positive_integral_const) auto |
2267 moreover |
2267 moreover |
2268 from `0 \<le> a` have "(\<integral>\<^isup>+ x. extreal (-a) \<partial>M) = 0" |
2268 from `0 \<le> a` have "(\<integral>\<^isup>+ x. ereal (-a) \<partial>M) = 0" |
2269 by (subst positive_integral_0_iff_AE) auto |
2269 by (subst positive_integral_0_iff_AE) auto |
2270 ultimately have "integrable M (\<lambda>x. a)" by (auto simp: integrable_def) } |
2270 ultimately have "integrable M (\<lambda>x. a)" by (auto simp: integrable_def) } |
2271 note * = this |
2271 note * = this |
2272 show "integrable M (\<lambda>x. a)" |
2272 show "integrable M (\<lambda>x. a)" |
2273 proof cases |
2273 proof cases |
2363 also have "\<dots> \<le> w x + w x" |
2363 also have "\<dots> \<le> w x + w x" |
2364 by (rule add_mono[OF bound[OF x] u'_bound[OF x]]) |
2364 by (rule add_mono[OF bound[OF x] u'_bound[OF x]]) |
2365 finally have "\<bar>u j x - u' x\<bar> \<le> 2 * w x" by simp } |
2365 finally have "\<bar>u j x - u' x\<bar> \<le> 2 * w x" by simp } |
2366 note diff_less_2w = this |
2366 note diff_less_2w = this |
2367 |
2367 |
2368 have PI_diff: "\<And>n. (\<integral>\<^isup>+ x. extreal (?diff n x) \<partial>M) = |
2368 have PI_diff: "\<And>n. (\<integral>\<^isup>+ x. ereal (?diff n x) \<partial>M) = |
2369 (\<integral>\<^isup>+ x. extreal (2 * w x) \<partial>M) - (\<integral>\<^isup>+ x. extreal \<bar>u n x - u' x\<bar> \<partial>M)" |
2369 (\<integral>\<^isup>+ x. ereal (2 * w x) \<partial>M) - (\<integral>\<^isup>+ x. ereal \<bar>u n x - u' x\<bar> \<partial>M)" |
2370 using diff w diff_less_2w w_pos |
2370 using diff w diff_less_2w w_pos |
2371 by (subst positive_integral_diff[symmetric]) |
2371 by (subst positive_integral_diff[symmetric]) |
2372 (auto simp: integrable_def intro!: positive_integral_cong) |
2372 (auto simp: integrable_def intro!: positive_integral_cong) |
2373 |
2373 |
2374 have "integrable M (\<lambda>x. 2 * w x)" |
2374 have "integrable M (\<lambda>x. 2 * w x)" |
2375 using w by (auto intro: integral_cmult) |
2375 using w by (auto intro: integral_cmult) |
2376 hence I2w_fin: "(\<integral>\<^isup>+ x. extreal (2 * w x) \<partial>M) \<noteq> \<infinity>" and |
2376 hence I2w_fin: "(\<integral>\<^isup>+ x. ereal (2 * w x) \<partial>M) \<noteq> \<infinity>" and |
2377 borel_2w: "(\<lambda>x. extreal (2 * w x)) \<in> borel_measurable M" |
2377 borel_2w: "(\<lambda>x. ereal (2 * w x)) \<in> borel_measurable M" |
2378 unfolding integrable_def by auto |
2378 unfolding integrable_def by auto |
2379 |
2379 |
2380 have "limsup (\<lambda>n. \<integral>\<^isup>+ x. extreal \<bar>u n x - u' x\<bar> \<partial>M) = 0" (is "limsup ?f = 0") |
2380 have "limsup (\<lambda>n. \<integral>\<^isup>+ x. ereal \<bar>u n x - u' x\<bar> \<partial>M) = 0" (is "limsup ?f = 0") |
2381 proof cases |
2381 proof cases |
2382 assume eq_0: "(\<integral>\<^isup>+ x. max 0 (extreal (2 * w x)) \<partial>M) = 0" (is "?wx = 0") |
2382 assume eq_0: "(\<integral>\<^isup>+ x. max 0 (ereal (2 * w x)) \<partial>M) = 0" (is "?wx = 0") |
2383 { fix n |
2383 { fix n |
2384 have "?f n \<le> ?wx" (is "integral\<^isup>P M ?f' \<le> _") |
2384 have "?f n \<le> ?wx" (is "integral\<^isup>P M ?f' \<le> _") |
2385 using diff_less_2w[of _ n] unfolding positive_integral_max_0 |
2385 using diff_less_2w[of _ n] unfolding positive_integral_max_0 |
2386 by (intro positive_integral_mono) auto |
2386 by (intro positive_integral_mono) auto |
2387 then have "?f n = 0" |
2387 then have "?f n = 0" |
2388 using positive_integral_positive[of ?f'] eq_0 by auto } |
2388 using positive_integral_positive[of ?f'] eq_0 by auto } |
2389 then show ?thesis by (simp add: Limsup_const) |
2389 then show ?thesis by (simp add: Limsup_const) |
2390 next |
2390 next |
2391 assume neq_0: "(\<integral>\<^isup>+ x. max 0 (extreal (2 * w x)) \<partial>M) \<noteq> 0" (is "?wx \<noteq> 0") |
2391 assume neq_0: "(\<integral>\<^isup>+ x. max 0 (ereal (2 * w x)) \<partial>M) \<noteq> 0" (is "?wx \<noteq> 0") |
2392 have "0 = limsup (\<lambda>n. 0 :: extreal)" by (simp add: Limsup_const) |
2392 have "0 = limsup (\<lambda>n. 0 :: ereal)" by (simp add: Limsup_const) |
2393 also have "\<dots> \<le> limsup (\<lambda>n. \<integral>\<^isup>+ x. extreal \<bar>u n x - u' x\<bar> \<partial>M)" |
2393 also have "\<dots> \<le> limsup (\<lambda>n. \<integral>\<^isup>+ x. ereal \<bar>u n x - u' x\<bar> \<partial>M)" |
2394 by (intro limsup_mono positive_integral_positive) |
2394 by (intro limsup_mono positive_integral_positive) |
2395 finally have pos: "0 \<le> limsup (\<lambda>n. \<integral>\<^isup>+ x. extreal \<bar>u n x - u' x\<bar> \<partial>M)" . |
2395 finally have pos: "0 \<le> limsup (\<lambda>n. \<integral>\<^isup>+ x. ereal \<bar>u n x - u' x\<bar> \<partial>M)" . |
2396 have "?wx = (\<integral>\<^isup>+ x. liminf (\<lambda>n. max 0 (extreal (?diff n x))) \<partial>M)" |
2396 have "?wx = (\<integral>\<^isup>+ x. liminf (\<lambda>n. max 0 (ereal (?diff n x))) \<partial>M)" |
2397 proof (rule positive_integral_cong) |
2397 proof (rule positive_integral_cong) |
2398 fix x assume x: "x \<in> space M" |
2398 fix x assume x: "x \<in> space M" |
2399 show "max 0 (extreal (2 * w x)) = liminf (\<lambda>n. max 0 (extreal (?diff n x)))" |
2399 show "max 0 (ereal (2 * w x)) = liminf (\<lambda>n. max 0 (ereal (?diff n x)))" |
2400 unfolding extreal_max_0 |
2400 unfolding ereal_max_0 |
2401 proof (rule lim_imp_Liminf[symmetric], unfold lim_extreal) |
2401 proof (rule lim_imp_Liminf[symmetric], unfold lim_ereal) |
2402 have "(\<lambda>i. ?diff i x) ----> 2 * w x - \<bar>u' x - u' x\<bar>" |
2402 have "(\<lambda>i. ?diff i x) ----> 2 * w x - \<bar>u' x - u' x\<bar>" |
2403 using u'[OF x] by (safe intro!: LIMSEQ_diff LIMSEQ_const LIMSEQ_imp_rabs) |
2403 using u'[OF x] by (safe intro!: LIMSEQ_diff LIMSEQ_const LIMSEQ_imp_rabs) |
2404 then show "(\<lambda>i. max 0 (?diff i x)) ----> max 0 (2 * w x)" |
2404 then show "(\<lambda>i. max 0 (?diff i x)) ----> max 0 (2 * w x)" |
2405 by (auto intro!: tendsto_real_max simp add: lim_extreal) |
2405 by (auto intro!: tendsto_real_max simp add: lim_ereal) |
2406 qed (rule trivial_limit_sequentially) |
2406 qed (rule trivial_limit_sequentially) |
2407 qed |
2407 qed |
2408 also have "\<dots> \<le> liminf (\<lambda>n. \<integral>\<^isup>+ x. max 0 (extreal (?diff n x)) \<partial>M)" |
2408 also have "\<dots> \<le> liminf (\<lambda>n. \<integral>\<^isup>+ x. max 0 (ereal (?diff n x)) \<partial>M)" |
2409 using u'_borel w u unfolding integrable_def |
2409 using u'_borel w u unfolding integrable_def |
2410 by (intro positive_integral_lim_INF) (auto intro!: positive_integral_lim_INF) |
2410 by (intro positive_integral_lim_INF) (auto intro!: positive_integral_lim_INF) |
2411 also have "\<dots> = (\<integral>\<^isup>+ x. extreal (2 * w x) \<partial>M) - |
2411 also have "\<dots> = (\<integral>\<^isup>+ x. ereal (2 * w x) \<partial>M) - |
2412 limsup (\<lambda>n. \<integral>\<^isup>+ x. extreal \<bar>u n x - u' x\<bar> \<partial>M)" |
2412 limsup (\<lambda>n. \<integral>\<^isup>+ x. ereal \<bar>u n x - u' x\<bar> \<partial>M)" |
2413 unfolding PI_diff positive_integral_max_0 |
2413 unfolding PI_diff positive_integral_max_0 |
2414 using positive_integral_positive[of "\<lambda>x. extreal (2 * w x)"] |
2414 using positive_integral_positive[of "\<lambda>x. ereal (2 * w x)"] |
2415 by (subst liminf_extreal_cminus) auto |
2415 by (subst liminf_ereal_cminus) auto |
2416 finally show ?thesis |
2416 finally show ?thesis |
2417 using neq_0 I2w_fin positive_integral_positive[of "\<lambda>x. extreal (2 * w x)"] pos |
2417 using neq_0 I2w_fin positive_integral_positive[of "\<lambda>x. ereal (2 * w x)"] pos |
2418 unfolding positive_integral_max_0 |
2418 unfolding positive_integral_max_0 |
2419 by (cases rule: extreal2_cases[of "\<integral>\<^isup>+ x. extreal (2 * w x) \<partial>M" "limsup (\<lambda>n. \<integral>\<^isup>+ x. extreal \<bar>u n x - u' x\<bar> \<partial>M)"]) |
2419 by (cases rule: ereal2_cases[of "\<integral>\<^isup>+ x. ereal (2 * w x) \<partial>M" "limsup (\<lambda>n. \<integral>\<^isup>+ x. ereal \<bar>u n x - u' x\<bar> \<partial>M)"]) |
2420 auto |
2420 auto |
2421 qed |
2421 qed |
2422 |
2422 |
2423 have "liminf ?f \<le> limsup ?f" |
2423 have "liminf ?f \<le> limsup ?f" |
2424 by (intro extreal_Liminf_le_Limsup trivial_limit_sequentially) |
2424 by (intro ereal_Liminf_le_Limsup trivial_limit_sequentially) |
2425 moreover |
2425 moreover |
2426 { have "0 = liminf (\<lambda>n. 0 :: extreal)" by (simp add: Liminf_const) |
2426 { have "0 = liminf (\<lambda>n. 0 :: ereal)" by (simp add: Liminf_const) |
2427 also have "\<dots> \<le> liminf ?f" |
2427 also have "\<dots> \<le> liminf ?f" |
2428 by (intro liminf_mono positive_integral_positive) |
2428 by (intro liminf_mono positive_integral_positive) |
2429 finally have "0 \<le> liminf ?f" . } |
2429 finally have "0 \<le> liminf ?f" . } |
2430 ultimately have liminf_limsup_eq: "liminf ?f = extreal 0" "limsup ?f = extreal 0" |
2430 ultimately have liminf_limsup_eq: "liminf ?f = ereal 0" "limsup ?f = ereal 0" |
2431 using `limsup ?f = 0` by auto |
2431 using `limsup ?f = 0` by auto |
2432 have "\<And>n. (\<integral>\<^isup>+ x. extreal \<bar>u n x - u' x\<bar> \<partial>M) = extreal (\<integral>x. \<bar>u n x - u' x\<bar> \<partial>M)" |
2432 have "\<And>n. (\<integral>\<^isup>+ x. ereal \<bar>u n x - u' x\<bar> \<partial>M) = ereal (\<integral>x. \<bar>u n x - u' x\<bar> \<partial>M)" |
2433 using diff positive_integral_positive |
2433 using diff positive_integral_positive |
2434 by (subst integral_eq_positive_integral) (auto simp: extreal_real integrable_def) |
2434 by (subst integral_eq_positive_integral) (auto simp: ereal_real integrable_def) |
2435 then show ?lim_diff |
2435 then show ?lim_diff |
2436 using extreal_Liminf_eq_Limsup[OF trivial_limit_sequentially liminf_limsup_eq] |
2436 using ereal_Liminf_eq_Limsup[OF trivial_limit_sequentially liminf_limsup_eq] |
2437 by (simp add: lim_extreal) |
2437 by (simp add: lim_ereal) |
2438 |
2438 |
2439 show ?lim |
2439 show ?lim |
2440 proof (rule LIMSEQ_I) |
2440 proof (rule LIMSEQ_I) |
2441 fix r :: real assume "0 < r" |
2441 fix r :: real assume "0 < r" |
2442 from LIMSEQ_D[OF `?lim_diff` this] |
2442 from LIMSEQ_D[OF `?lim_diff` this] |
2616 lemma (in finite_measure_space) integral_finite_singleton: |
2616 lemma (in finite_measure_space) integral_finite_singleton: |
2617 shows "integrable M f" |
2617 shows "integrable M f" |
2618 and "integral\<^isup>L M f = (\<Sum>x \<in> space M. f x * real (\<mu> {x}))" (is ?I) |
2618 and "integral\<^isup>L M f = (\<Sum>x \<in> space M. f x * real (\<mu> {x}))" (is ?I) |
2619 proof - |
2619 proof - |
2620 have *: |
2620 have *: |
2621 "(\<integral>\<^isup>+ x. max 0 (extreal (f x)) \<partial>M) = (\<Sum>x \<in> space M. max 0 (extreal (f x)) * \<mu> {x})" |
2621 "(\<integral>\<^isup>+ x. max 0 (ereal (f x)) \<partial>M) = (\<Sum>x \<in> space M. max 0 (ereal (f x)) * \<mu> {x})" |
2622 "(\<integral>\<^isup>+ x. max 0 (extreal (- f x)) \<partial>M) = (\<Sum>x \<in> space M. max 0 (extreal (- f x)) * \<mu> {x})" |
2622 "(\<integral>\<^isup>+ x. max 0 (ereal (- f x)) \<partial>M) = (\<Sum>x \<in> space M. max 0 (ereal (- f x)) * \<mu> {x})" |
2623 by (simp_all add: positive_integral_finite_eq_setsum) |
2623 by (simp_all add: positive_integral_finite_eq_setsum) |
2624 then show "integrable M f" using finite_space finite_measure |
2624 then show "integrable M f" using finite_space finite_measure |
2625 by (simp add: setsum_Pinfty integrable_def positive_integral_max_0 |
2625 by (simp add: setsum_Pinfty integrable_def positive_integral_max_0 |
2626 split: split_max) |
2626 split: split_max) |
2627 show ?I using finite_measure * |
2627 show ?I using finite_measure * |
2628 apply (simp add: positive_integral_max_0 lebesgue_integral_def) |
2628 apply (simp add: positive_integral_max_0 lebesgue_integral_def) |
2629 apply (subst (1 2) setsum_real_of_extreal[symmetric]) |
2629 apply (subst (1 2) setsum_real_of_ereal[symmetric]) |
2630 apply (simp_all split: split_max add: setsum_subtractf[symmetric]) |
2630 apply (simp_all split: split_max add: setsum_subtractf[symmetric]) |
2631 apply (intro setsum_cong[OF refl]) |
2631 apply (intro setsum_cong[OF refl]) |
2632 apply (simp split: split_max) |
2632 apply (simp split: split_max) |
2633 done |
2633 done |
2634 qed |
2634 qed |