6305 unfolding eventually_sequentially |
6311 unfolding eventually_sequentially |
6306 apply (rule_tac x=k in exI) |
6312 apply (rule_tac x=k in exI) |
6307 using * by (simp add: int_f integral_le) |
6313 using * by (simp add: int_f integral_le) |
6308 qed |
6314 qed |
6309 |
6315 |
6310 have int: "(\<lambda>x. if x \<in> S then f k x else 0) integrable_on cbox a b" for a b k |
6316 let ?f = "(\<lambda>k x. if x \<in> S then f k x else 0)" |
|
6317 let ?g = "(\<lambda>x. if x \<in> S then g x else 0)" |
|
6318 have int: "?f k integrable_on cbox a b" for a b k |
6311 by (simp add: int_f integrable_altD(1)) |
6319 by (simp add: int_f integrable_altD(1)) |
6312 have int': "\<And>k a b. f k integrable_on cbox a b \<inter> S" |
6320 have int': "\<And>k a b. f k integrable_on cbox a b \<inter> S" |
6313 using int by (simp add: Int_commute integrable_restrict_Int) |
6321 using int by (simp add: Int_commute integrable_restrict_Int) |
6314 have "(\<lambda>x. if x \<in> S then g x else 0) integrable_on cbox a b \<and> |
6322 have g: "?g integrable_on cbox a b \<and> |
6315 (\<lambda>k. integral (cbox a b) (\<lambda>x. if x \<in> S then f k x else 0)) |
6323 (\<lambda>k. integral (cbox a b) (?f k)) \<longlonglongrightarrow> integral (cbox a b) ?g" for a b |
6316 \<longlonglongrightarrow> integral (cbox a b) (\<lambda>x. if x \<in> S then g x else 0)" for a b |
6324 proof (rule monotone_convergence_interval) |
6317 proof (rule monotone_convergence_interval, goal_cases) |
6325 have "norm (integral (cbox a b) (?f k)) \<le> norm (integral S (f k))" for k |
6318 case 1 |
|
6319 show ?case by (rule int) |
|
6320 next |
|
6321 case 4 |
|
6322 have "norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f k x else 0)) \<le> norm (integral S (f k))" for k |
|
6323 proof - |
6326 proof - |
6324 have "0 \<le> integral (cbox a b) (\<lambda>x. if x \<in> S then f k x else 0)" |
6327 have "0 \<le> integral (cbox a b) (?f k)" |
6325 by (metis (no_types) integral_nonneg Int_iff f0 inf_commute integral_restrict_Int int') |
6328 by (metis (no_types) integral_nonneg Int_iff f0 inf_commute integral_restrict_Int int') |
6326 moreover have "0 \<le> integral S (f k)" |
6329 moreover have "0 \<le> integral S (f k)" |
6327 by (simp add: integral_nonneg f0 int_f) |
6330 by (simp add: integral_nonneg f0 int_f) |
6328 moreover have "integral (S \<inter> cbox a b) (f k) \<le> integral S (f k)" |
6331 moreover have "integral (S \<inter> cbox a b) (f k) \<le> integral S (f k)" |
6329 by (metis f0 inf_commute int' int_f integral_subset_le le_inf_iff order_refl) |
6332 by (metis f0 inf_commute int' int_f integral_subset_le le_inf_iff order_refl) |
6330 ultimately show ?thesis |
6333 ultimately show ?thesis |
6331 by (simp add: integral_restrict_Int) |
6334 by (simp add: integral_restrict_Int) |
6332 qed |
6335 qed |
6333 moreover obtain B where "\<And>x. x \<in> range (\<lambda>k. integral S (f k)) \<Longrightarrow> norm x \<le> B" |
6336 moreover obtain B where "\<And>x. x \<in> range (\<lambda>k. integral S (f k)) \<Longrightarrow> norm x \<le> B" |
6334 using bou unfolding bounded_iff by blast |
6337 using bou unfolding bounded_iff by blast |
6335 ultimately show ?case |
6338 ultimately show "bounded (range (\<lambda>k. integral (cbox a b) (?f k)))" |
6336 unfolding bounded_iff by (blast intro: order_trans) |
6339 unfolding bounded_iff by (blast intro: order_trans) |
6337 qed (use le lim in auto) |
6340 qed (use int le lim in auto) |
6338 note g = conjunctD2[OF this] |
6341 moreover have "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) ?g - i) < e" |
6339 |
6342 if "0 < e" for e |
6340 have "(g has_integral i) S" |
6343 proof - |
6341 unfolding has_integral_alt' |
6344 have "e/4>0" |
6342 apply safe |
6345 using that by auto |
6343 apply (rule g(1)) |
6346 with LIMSEQ_D [OF i] obtain N where N: "\<And>n. n \<ge> N \<Longrightarrow> norm (integral S (f n) - i) < e/4" |
6344 proof goal_cases |
6347 by metis |
6345 case (1 e) |
6348 with int_f[of N, unfolded has_integral_integral has_integral_alt'[of "f N"]] |
6346 then have "e/4>0" |
6349 obtain B where "0 < B" and B: |
6347 by auto |
6350 "\<And>a b. ball 0 B \<subseteq> cbox a b \<Longrightarrow> norm (integral (cbox a b) (?f N) - integral S (f N)) < e / 4" |
6348 from LIMSEQ_D [OF i this] guess N..note N=this |
6351 by (meson \<open>0 < e / 4\<close>) |
6349 note that(2)[of N,unfolded has_integral_integral has_integral_alt'[of "f N"]] |
6352 have "norm (integral (cbox a b) ?g - i) < e" if ab: "ball 0 B \<subseteq> cbox a b" for a b |
6350 from this[THEN conjunct2,rule_format,OF \<open>e/4>0\<close>] guess B..note B=conjunctD2[OF this] |
|
6351 show ?case |
|
6352 apply rule |
|
6353 apply rule |
|
6354 apply (rule B) |
|
6355 apply safe |
|
6356 proof - |
6353 proof - |
6357 fix a b :: 'n |
6354 obtain M where M: "\<And>n. n \<ge> M \<Longrightarrow> abs (integral (cbox a b) (?f n) - integral (cbox a b) ?g) < e / 2" |
6358 assume ab: "ball 0 B \<subseteq> cbox a b" |
6355 using \<open>e > 0\<close> g by (fastforce simp add: dest!: LIMSEQ_D [where r = "e/2"]) |
6359 from \<open>e > 0\<close> have "e/2 > 0" |
6356 have *: "\<And>\<alpha> \<beta> g. \<lbrakk>\<bar>\<alpha> - i\<bar> < e/2; \<bar>\<beta> - g\<bar> < e/2; \<alpha> \<le> \<beta>; \<beta> \<le> i\<rbrakk> \<Longrightarrow> \<bar>g - i\<bar> < e" |
6360 by auto |
|
6361 from LIMSEQ_D [OF g(2)[of a b] this] guess M..note M=this |
|
6362 have **: "norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f N x else 0) - i) < e/2" |
|
6363 proof (rule norm_triangle_half_l) |
|
6364 show "norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f N x else 0) - integral S (f N)) |
|
6365 < e / 2 / 2" |
|
6366 using B(2)[rule_format,OF ab] by simp |
|
6367 show "norm (i - integral S (f N)) < e / 2 / 2" |
|
6368 using N by (simp add: abs_minus_commute) |
|
6369 qed |
|
6370 have *: "\<And>f1 f2 g. \<bar>f1 - i\<bar> < e/2 \<longrightarrow> \<bar>f2 - g\<bar> < e/2 \<longrightarrow> |
|
6371 f1 \<le> f2 \<longrightarrow> f2 \<le> i \<longrightarrow> \<bar>g - i\<bar> < e" |
|
6372 unfolding real_inner_1_right by arith |
6357 unfolding real_inner_1_right by arith |
6373 show "norm (integral (cbox a b) (\<lambda>x. if x \<in> S then g x else 0) - i) < e" |
6358 show "norm (integral (cbox a b) ?g - i) < e" |
6374 unfolding real_norm_def |
6359 unfolding real_norm_def |
6375 apply (rule *[rule_format]) |
6360 proof (rule *) |
6376 apply (rule **[unfolded real_norm_def]) |
6361 show "\<bar>integral (cbox a b) (?f N) - i\<bar> < e/2" |
6377 apply (rule M[rule_format,of "M + N",unfolded real_norm_def]) |
6362 proof (rule abs_triangle_half_l) |
6378 apply (rule le_add1) |
6363 show "\<bar>integral (cbox a b) (?f N) - integral S (f N)\<bar> < e / 2 / 2" |
6379 apply (rule integral_le[OF int int]) |
6364 using B[OF ab] by simp |
6380 defer |
6365 show "abs (i - integral S (f N)) < e / 2 / 2" |
6381 apply (rule order_trans[OF _ i'[rule_format,of "M + N",unfolded real_inner_1_right]]) |
6366 using N by (simp add: abs_minus_commute) |
6382 proof (safe, goal_cases) |
6367 qed |
6383 case (2 x) |
6368 show "\<bar>integral (cbox a b) (?f (M + N)) - integral (cbox a b) ?g\<bar> < e / 2" |
6384 have "(f m x)\<bullet>1 \<le> (f n x)\<bullet>1" if "x \<in> S" "n \<ge> m" for m n |
6369 by (metis le_add1 M[of "M + N"]) |
6385 apply (rule transitive_stepwise_le [OF \<open>n \<ge> m\<close> order_refl]) |
6370 show "integral (cbox a b) (?f N) \<le> integral (cbox a b) (?f (M + N))" |
6386 using dual_order.trans apply blast |
6371 proof (intro ballI integral_le[OF int int]) |
6387 by (simp add: le \<open>x \<in> S\<close>) |
6372 fix x assume "x \<in> cbox a b" |
6388 then show ?case |
6373 have "(f m x)\<bullet>1 \<le> (f n x)\<bullet>1" if "x \<in> S" "n \<ge> m" for m n |
6389 by auto |
6374 apply (rule transitive_stepwise_le [OF \<open>n \<ge> m\<close> order_refl]) |
6390 next |
6375 using dual_order.trans apply blast |
6391 case 1 |
6376 by (simp add: le \<open>x \<in> S\<close>) |
|
6377 then show "(?f N)x \<le> (?f (M+N))x" |
|
6378 by auto |
|
6379 qed |
6392 have "integral (cbox a b \<inter> S) (f (M + N)) \<le> integral S (f (M + N))" |
6380 have "integral (cbox a b \<inter> S) (f (M + N)) \<le> integral S (f (M + N))" |
6393 by (metis Int_lower1 f0 inf_commute int' int_f integral_subset_le) |
6381 by (metis Int_lower1 f0 inf_commute int' int_f integral_subset_le) |
6394 then show ?case |
6382 then have "integral (cbox a b) (?f (M + N)) \<le> integral S (f (M + N))" |
6395 by (simp add: inf_commute integral_restrict_Int) |
6383 by (metis (no_types) inf_commute integral_restrict_Int) |
|
6384 also have "... \<le> i" |
|
6385 using i'[of "M + N"] by auto |
|
6386 finally show "integral (cbox a b) (?f (M + N)) \<le> i" . |
6396 qed |
6387 qed |
6397 qed |
6388 qed |
|
6389 then show ?thesis |
|
6390 using \<open>0 < B\<close> by blast |
6398 qed |
6391 qed |
|
6392 ultimately have "(g has_integral i) S" |
|
6393 unfolding has_integral_alt' by auto |
6399 then show ?thesis |
6394 then show ?thesis |
6400 using has_integral_integrable_integral i integral_unique by metis |
6395 using has_integral_integrable_integral i integral_unique by metis |
6401 qed |
6396 qed |
6402 |
6397 |
6403 have sub: "\<And>k. integral S (\<lambda>x. f k x - f 0 x) = integral S (f k) - integral S (f 0)" |
6398 have sub: "\<And>k. integral S (\<lambda>x. f k x - f 0 x) = integral S (f k) - integral S (f 0)" |
6404 by (simp add: integral_diff assms(1)) |
6399 by (simp add: integral_diff int_f) |
6405 have *: "\<And>x m n. x \<in> S \<Longrightarrow> n\<ge>m \<Longrightarrow> f m x \<le> f n x" |
6400 have *: "\<And>x m n. x \<in> S \<Longrightarrow> n\<ge>m \<Longrightarrow> f m x \<le> f n x" |
6406 using assms(2) by (force intro: transitive_stepwise_le) |
6401 using assms(2) by (force intro: transitive_stepwise_le) |
6407 have "(\<lambda>x. g x - f 0 x) integrable_on S \<and> ((\<lambda>k. integral S (\<lambda>x. f (Suc k) x - f 0 x)) \<longlongrightarrow> |
6402 have gf: "(\<lambda>x. g x - f 0 x) integrable_on S \<and> ((\<lambda>k. integral S (\<lambda>x. f (Suc k) x - f 0 x)) \<longlongrightarrow> |
6408 integral S (\<lambda>x. g x - f 0 x)) sequentially" |
6403 integral S (\<lambda>x. g x - f 0 x)) sequentially" |
6409 apply (rule lem) |
6404 proof (rule lem) |
6410 apply safe |
6405 show "\<And>k. (\<lambda>x. f (Suc k) x - f 0 x) integrable_on S" |
6411 proof goal_cases |
6406 by (simp add: integrable_diff int_f) |
6412 case (1 k x) |
6407 show "(\<lambda>k. f (Suc k) x - f 0 x) \<longlonglongrightarrow> g x - f 0 x" if "x \<in> S" for x |
6413 then show ?case |
6408 proof - |
6414 using *[of x 0 "Suc k"] by auto |
6409 have "(\<lambda>n. f (Suc n) x) \<longlonglongrightarrow> g x" |
6415 next |
6410 using LIMSEQ_ignore_initial_segment[OF fg[OF \<open>x \<in> S\<close>], of 1] by simp |
6416 case (2 k) |
6411 then show ?thesis |
6417 then show ?case |
6412 by (simp add: tendsto_diff) |
6418 by (simp add: integrable_diff assms(1)) |
6413 qed |
6419 next |
6414 show "bounded (range (\<lambda>k. integral S (\<lambda>x. f (Suc k) x - f 0 x)))" |
6420 case (3 k x) |
6415 proof - |
6421 then show ?case |
6416 obtain B where B: "\<And>k. norm (integral S (f k)) \<le> B" |
6422 using *[of x "Suc k" "Suc (Suc k)"] by auto |
6417 using bou by (auto simp: bounded_iff) |
6423 next |
6418 then have "norm (integral S (\<lambda>x. f (Suc k) x - f 0 x)) |
6424 case (4 x) |
6419 \<le> B + norm (integral S (f 0))" for k |
6425 then show ?case |
6420 unfolding sub by (meson add_le_cancel_right norm_triangle_le_diff) |
6426 apply - |
6421 then show ?thesis |
6427 apply (rule tendsto_diff) |
6422 unfolding bounded_iff by blast |
6428 using LIMSEQ_ignore_initial_segment[OF assms(3)[rule_format],of x 1] |
6423 qed |
6429 apply auto |
6424 qed (use * in auto) |
6430 done |
6425 then have "(\<lambda>x. integral S (\<lambda>xa. f (Suc x) xa - f 0 xa) + integral S (f 0)) |
6431 next |
6426 \<longlonglongrightarrow> integral S (\<lambda>x. g x - f 0 x) + integral S (f 0)" |
6432 case 5 |
6427 by (auto simp add: tendsto_add) |
6433 then show ?case |
6428 moreover have "(\<lambda>x. g x - f 0 x + f 0 x) integrable_on S" |
6434 using assms(4) |
6429 using gf integrable_add int_f [of 0] by metis |
6435 unfolding bounded_iff |
6430 ultimately show ?thesis |
6436 apply safe |
6431 by (simp add: integral_diff int_f LIMSEQ_imp_Suc sub) |
6437 apply (rule_tac x="a + norm (integral S (\<lambda>x. f 0 x))" in exI) |
|
6438 apply safe |
|
6439 apply (erule_tac x="integral S (\<lambda>x. f (Suc k) x)" in ballE) |
|
6440 unfolding sub |
|
6441 apply (rule order_trans[OF norm_triangle_ineq4]) |
|
6442 apply auto |
|
6443 done |
|
6444 qed |
|
6445 note conjunctD2[OF this] |
|
6446 note tendsto_add[OF this(2) tendsto_const[of "integral S (f 0)"]] |
|
6447 integrable_add[OF this(1) assms(1)[rule_format,of 0]] |
|
6448 then show ?thesis |
|
6449 by (simp add: integral_diff assms(1) LIMSEQ_imp_Suc sub) |
|
6450 qed |
6432 qed |
6451 |
6433 |
6452 lemma has_integral_monotone_convergence_increasing: |
6434 lemma has_integral_monotone_convergence_increasing: |
6453 fixes f :: "nat \<Rightarrow> 'a::euclidean_space \<Rightarrow> real" |
6435 fixes f :: "nat \<Rightarrow> 'a::euclidean_space \<Rightarrow> real" |
6454 assumes f: "\<And>k. (f k has_integral x k) s" |
6436 assumes f: "\<And>k. (f k has_integral x k) s" |