3035 |
3035 |
3036 |
3036 |
3037 subsection \<open>Combining adjacent intervals in 1 dimension.\<close> |
3037 subsection \<open>Combining adjacent intervals in 1 dimension.\<close> |
3038 |
3038 |
3039 lemma has_integral_combine: |
3039 lemma has_integral_combine: |
3040 fixes a b c :: real |
3040 fixes a b c :: real and j :: "'a::banach" |
3041 assumes "a \<le> c" |
3041 assumes "a \<le> c" |
3042 and "c \<le> b" |
3042 and "c \<le> b" |
3043 and "(f has_integral i) {a..c}" |
3043 and ac: "(f has_integral i) {a..c}" |
3044 and "(f has_integral (j::'a::banach)) {c..b}" |
3044 and cb: "(f has_integral j) {c..b}" |
3045 shows "(f has_integral (i + j)) {a..b}" |
3045 shows "(f has_integral (i + j)) {a..b}" |
3046 proof - |
3046 proof - |
3047 interpret comm_monoid "lift_option plus" "Some (0::'a)" |
3047 interpret comm_monoid "lift_option plus" "Some (0::'a)" |
3048 by (rule comm_monoid_lift_option) |
3048 by (rule comm_monoid_lift_option) |
3049 (rule add.comm_monoid_axioms) |
3049 (rule add.comm_monoid_axioms) |
3050 note operative_integral [of f, unfolded operative_1_le] |
3050 from operative_integral [of f, unfolded operative_1_le] \<open>a \<le> c\<close> \<open>c \<le> b\<close> |
3051 note conjunctD2 [OF this, rule_format] |
3051 have *: "lift_option op + |
3052 note * = this(2) [OF conjI [OF assms(1-2)], |
3052 (if f integrable_on {a..c} then Some (integral {a..c} f) else None) |
3053 unfolded if_P [OF assms(3)]] |
3053 (if f integrable_on {c..b} then Some (integral {c..b} f) else None) = |
|
3054 (if f integrable_on {a..b} then Some (integral {a..b} f) else None)" |
|
3055 by (auto simp: split: if_split_asm) |
3054 then have "f integrable_on cbox a b" |
3056 then have "f integrable_on cbox a b" |
3055 apply - |
3057 using ac cb by (auto split: if_split_asm) |
3056 apply (rule ccontr) |
|
3057 apply (subst(asm) if_P) |
|
3058 defer |
|
3059 apply (subst(asm) if_P) |
|
3060 using assms(3-) |
|
3061 apply auto |
|
3062 done |
|
3063 with * |
3058 with * |
3064 show ?thesis |
3059 show ?thesis |
3065 apply - |
3060 using ac cb by (auto simp add: integrable_on_def integral_unique split: if_split_asm) |
3066 apply (subst(asm) if_P) |
|
3067 defer |
|
3068 apply (subst(asm) if_P) |
|
3069 defer |
|
3070 apply (subst(asm) if_P) |
|
3071 using assms(3-) |
|
3072 apply (auto simp add: integrable_on_def integral_unique) |
|
3073 done |
|
3074 qed |
3061 qed |
3075 |
3062 |
3076 lemma integral_combine: |
3063 lemma integral_combine: |
3077 fixes f :: "real \<Rightarrow> 'a::banach" |
3064 fixes f :: "real \<Rightarrow> 'a::banach" |
3078 assumes "a \<le> c" |
3065 assumes "a \<le> c" |
3079 and "c \<le> b" |
3066 and "c \<le> b" |
3080 and "f integrable_on {a..b}" |
3067 and ab: "f integrable_on {a..b}" |
3081 shows "integral {a..c} f + integral {c..b} f = integral {a..b} f" |
3068 shows "integral {a..c} f + integral {c..b} f = integral {a..b} f" |
3082 apply (rule integral_unique[symmetric]) |
3069 proof - |
3083 apply (rule has_integral_combine[OF assms(1-2)]) |
3070 have "(f has_integral integral {a..c} f) {a..c}" |
3084 apply (metis assms(2) assms(3) atLeastatMost_subset_iff box_real(2) content_pos_le content_real_eq_0 integrable_integral integrable_subinterval le_add_same_cancel2 monoid_add_class.add.left_neutral) |
3071 using ab \<open>c \<le> b\<close> integrable_subinterval_real by fastforce |
3085 by (metis assms(1) assms(3) atLeastatMost_subset_iff box_real(2) content_pos_le content_real_eq_0 integrable_integral integrable_subinterval le_add_same_cancel1 monoid_add_class.add.right_neutral) |
3072 moreover |
|
3073 have "(f has_integral integral {c..b} f) {c..b}" |
|
3074 using ab \<open>a \<le> c\<close> integrable_subinterval_real by fastforce |
|
3075 ultimately have "(f has_integral integral {a..c} f + integral {c..b} f) {a..b}" |
|
3076 using \<open>a \<le> c\<close> \<open>c \<le> b\<close> has_integral_combine by blast |
|
3077 then show ?thesis |
|
3078 by (simp add: has_integral_integrable_integral) |
|
3079 qed |
3086 |
3080 |
3087 lemma integrable_combine: |
3081 lemma integrable_combine: |
3088 fixes f :: "real \<Rightarrow> 'a::banach" |
3082 fixes f :: "real \<Rightarrow> 'a::banach" |
3089 assumes "a \<le> c" |
3083 assumes "a \<le> c" |
3090 and "c \<le> b" |
3084 and "c \<le> b" |
3091 and "f integrable_on {a..c}" |
3085 and "f integrable_on {a..c}" |
3092 and "f integrable_on {c..b}" |
3086 and "f integrable_on {c..b}" |
3093 shows "f integrable_on {a..b}" |
3087 shows "f integrable_on {a..b}" |
3094 using assms |
3088 using assms |
3095 unfolding integrable_on_def |
3089 unfolding integrable_on_def |
3096 by (auto intro!:has_integral_combine) |
3090 by (auto intro!: has_integral_combine) |
3097 |
3091 |
3098 |
3092 |
3099 subsection \<open>Reduce integrability to "local" integrability.\<close> |
3093 subsection \<open>Reduce integrability to "local" integrability.\<close> |
3100 |
3094 |
3101 lemma integrable_on_little_subintervals: |
3095 lemma integrable_on_little_subintervals: |
4346 |
4340 |
4347 subsection \<open>Generalize a bit to any convex set.\<close> |
4341 subsection \<open>Generalize a bit to any convex set.\<close> |
4348 |
4342 |
4349 lemma has_derivative_zero_unique_strong_convex: |
4343 lemma has_derivative_zero_unique_strong_convex: |
4350 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
4344 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
4351 assumes "convex s" |
4345 assumes "convex S" "finite K" |
4352 and "finite k" |
4346 and contf: "continuous_on S f" |
4353 and "continuous_on s f" |
4347 and "c \<in> S" "f c = y" |
4354 and "c \<in> s" |
4348 and derf: "\<And>x. x \<in> (S - K) \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within S)" |
4355 and "f c = y" |
4349 and "x \<in> S" |
4356 and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)" |
|
4357 and "x \<in> s" |
|
4358 shows "f x = y" |
4350 shows "f x = y" |
4359 proof - |
4351 proof (cases "x = c") |
4360 { |
4352 case True with \<open>f c = y\<close> show ?thesis |
4361 presume *: "x \<noteq> c \<Longrightarrow> ?thesis" |
4353 by blast |
4362 show ?thesis |
4354 next |
4363 apply cases |
4355 case False |
4364 apply (rule *) |
4356 let ?\<phi> = "\<lambda>u. (1 - u) *\<^sub>R c + u *\<^sub>R x" |
4365 apply assumption |
4357 have contf': "continuous_on {0 ..1} (f \<circ> ?\<phi>)" |
4366 unfolding assms(5)[symmetric] |
4358 apply (rule continuous_intros continuous_on_subset[OF contf])+ |
4367 apply auto |
4359 using \<open>convex S\<close> \<open>x \<in> S\<close> \<open>c \<in> S\<close> by (auto simp add: convex_alt algebra_simps) |
4368 done |
4360 have "t = u" if "?\<phi> t = ?\<phi> u" for t u |
4369 } |
|
4370 assume "x \<noteq> c" |
|
4371 note conv = assms(1)[unfolded convex_alt,rule_format] |
|
4372 have as1: "continuous_on {0 ..1} (f \<circ> (\<lambda>t. (1 - t) *\<^sub>R c + t *\<^sub>R x))" |
|
4373 apply (rule continuous_intros)+ |
|
4374 apply (rule continuous_on_subset[OF assms(3)]) |
|
4375 apply safe |
|
4376 apply (rule conv) |
|
4377 using assms(4,7) |
|
4378 apply auto |
|
4379 done |
|
4380 have *: "t = xa" if "(1 - t) *\<^sub>R c + t *\<^sub>R x = (1 - xa) *\<^sub>R c + xa *\<^sub>R x" for t xa |
|
4381 proof - |
4361 proof - |
4382 from that have "(t - xa) *\<^sub>R x = (t - xa) *\<^sub>R c" |
4362 from that have "(t - u) *\<^sub>R x = (t - u) *\<^sub>R c" |
4383 unfolding scaleR_simps by (auto simp add: algebra_simps) |
4363 by (auto simp add: algebra_simps) |
4384 then show ?thesis |
4364 then show ?thesis |
4385 using \<open>x \<noteq> c\<close> by auto |
4365 using \<open>x \<noteq> c\<close> by auto |
4386 qed |
4366 qed |
4387 have as2: "finite {t. ((1 - t) *\<^sub>R c + t *\<^sub>R x) \<in> k}" |
4367 then have eq: "(SOME t. ?\<phi> t = ?\<phi> u) = u" for u |
4388 using assms(2) |
4368 by blast |
4389 apply (rule finite_surj[where f="\<lambda>z. SOME t. (1-t) *\<^sub>R c + t *\<^sub>R x = z"]) |
4369 then have "(?\<phi> -` K) \<subseteq> (\<lambda>z. SOME t. ?\<phi> t = z) ` K" |
4390 apply safe |
4370 by (clarsimp simp: image_iff) (metis (no_types) eq) |
4391 unfolding image_iff |
4371 then have fin: "finite (?\<phi> -` K)" |
4392 apply rule |
4372 by (rule finite_surj[OF \<open>finite K\<close>]) |
4393 defer |
4373 |
4394 apply assumption |
4374 have derf': "((\<lambda>u. f (?\<phi> u)) has_derivative (\<lambda>h. 0)) (at t within {0..1})" |
4395 apply (rule sym) |
4375 if "t \<in> {0..1} - {t. ?\<phi> t \<in> K}" for t |
4396 apply (rule some_equality) |
|
4397 defer |
|
4398 apply (drule *) |
|
4399 apply auto |
|
4400 done |
|
4401 have "(f \<circ> (\<lambda>t. (1 - t) *\<^sub>R c + t *\<^sub>R x)) 1 = y" |
|
4402 apply (rule has_derivative_zero_unique_strong_interval[OF as2 as1, of ]) |
|
4403 unfolding o_def |
|
4404 using assms(5) |
|
4405 defer |
|
4406 apply - |
|
4407 apply rule |
|
4408 proof - |
4376 proof - |
4409 fix t |
4377 have df: "(f has_derivative (\<lambda>h. 0)) (at (?\<phi> t) within ?\<phi> ` {0..1})" |
4410 assume as: "t \<in> {0..1} - {t. (1 - t) *\<^sub>R c + t *\<^sub>R x \<in> k}" |
4378 apply (rule has_derivative_within_subset [OF derf]) |
4411 have *: "c - t *\<^sub>R c + t *\<^sub>R x \<in> s - k" |
4379 using \<open>convex S\<close> \<open>x \<in> S\<close> \<open>c \<in> S\<close> that by (auto simp add: convex_alt algebra_simps) |
4412 apply safe |
4380 have "(f \<circ> ?\<phi> has_derivative (\<lambda>x. 0) \<circ> (\<lambda>z. (0 - z *\<^sub>R c) + z *\<^sub>R x)) (at t within {0..1})" |
4413 apply (rule conv[unfolded scaleR_simps]) |
4381 by (rule derivative_eq_intros df | simp)+ |
4414 using \<open>x \<in> s\<close> \<open>c \<in> s\<close> as |
4382 then show ?thesis |
4415 by (auto simp add: algebra_simps) |
|
4416 have "(f \<circ> (\<lambda>t. (1 - t) *\<^sub>R c + t *\<^sub>R x) has_derivative (\<lambda>x. 0) \<circ> (\<lambda>z. (0 - z *\<^sub>R c) + z *\<^sub>R x)) |
|
4417 (at t within {0..1})" |
|
4418 apply (intro derivative_eq_intros) |
|
4419 apply simp_all |
|
4420 apply (simp add: field_simps) |
|
4421 unfolding scaleR_simps |
|
4422 apply (rule has_derivative_within_subset,rule assms(6)[rule_format]) |
|
4423 apply (rule *) |
|
4424 apply safe |
|
4425 apply (rule conv[unfolded scaleR_simps]) |
|
4426 using \<open>x \<in> s\<close> \<open>c \<in> s\<close> |
|
4427 apply auto |
|
4428 done |
|
4429 then show "((\<lambda>xa. f ((1 - xa) *\<^sub>R c + xa *\<^sub>R x)) has_derivative (\<lambda>h. 0)) (at t within {0..1})" |
|
4430 unfolding o_def . |
4383 unfolding o_def . |
4431 qed auto |
4384 qed |
|
4385 have "(f \<circ> ?\<phi>) 1 = y" |
|
4386 apply (rule has_derivative_zero_unique_strong_interval[OF fin contf']) |
|
4387 unfolding o_def using \<open>f c = y\<close> derf' by auto |
4432 then show ?thesis |
4388 then show ?thesis |
4433 by auto |
4389 by auto |
4434 qed |
4390 qed |
4435 |
4391 |
4436 |
4392 |
4437 text \<open>Also to any open connected set with finite set of exceptions. Could |
4393 text \<open>Also to any open connected set with finite set of exceptions. Could |
4438 generalize to locally convex set with limpt-free set of exceptions.\<close> |
4394 generalize to locally convex set with limpt-free set of exceptions.\<close> |
4439 |
4395 |
4440 lemma has_derivative_zero_unique_strong_connected: |
4396 lemma has_derivative_zero_unique_strong_connected: |
4441 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
4397 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
4442 assumes "connected s" |
4398 assumes "connected S" |
4443 and "open s" |
4399 and "open S" |
4444 and "finite k" |
4400 and "finite K" |
4445 and "continuous_on s f" |
4401 and contf: "continuous_on S f" |
4446 and "c \<in> s" |
4402 and "c \<in> S" |
4447 and "f c = y" |
4403 and "f c = y" |
4448 and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)" |
4404 and derf: "\<And>x. x \<in> (S - K) \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within S)" |
4449 and "x\<in>s" |
4405 and "x \<in> S" |
4450 shows "f x = y" |
4406 shows "f x = y" |
4451 proof - |
4407 proof - |
4452 have "{x \<in> s. f x \<in> {y}} = {} \<or> {x \<in> s. f x \<in> {y}} = s" |
4408 have xx: "\<exists>e>0. ball x e \<subseteq> {xa \<in> S. f xa \<in> {f x}}" if "x \<in> S" for x |
4453 apply (rule assms(1)[unfolded connected_clopen,rule_format]) |
4409 proof - |
4454 apply rule |
4410 obtain e where "0 < e" and e: "ball x e \<subseteq> S" |
4455 defer |
4411 using \<open>x \<in> S\<close> \<open>open S\<close> open_contains_ball by blast |
4456 apply (rule continuous_closedin_preimage[OF assms(4) closed_singleton]) |
4412 have "ball x e \<subseteq> {u \<in> S. f u \<in> {f x}}" |
4457 apply (rule open_openin_trans[OF assms(2)]) |
|
4458 unfolding open_contains_ball |
|
4459 proof safe |
|
4460 fix x |
|
4461 assume "x \<in> s" |
|
4462 from assms(2)[unfolded open_contains_ball,rule_format,OF this] guess e..note e=conjunctD2[OF this] |
|
4463 show "\<exists>e>0. ball x e \<subseteq> {xa \<in> s. f xa \<in> {f x}}" |
|
4464 apply rule |
|
4465 apply rule |
|
4466 apply (rule e) |
|
4467 proof safe |
4413 proof safe |
4468 fix y |
4414 fix y |
4469 assume y: "y \<in> ball x e" |
4415 assume y: "y \<in> ball x e" |
4470 then show "y \<in> s" |
4416 then show "y \<in> S" |
4471 using e by auto |
4417 using e by auto |
4472 show "f y = f x" |
4418 show "f y = f x" |
4473 apply (rule has_derivative_zero_unique_strong_convex[OF convex_ball]) |
4419 proof (rule has_derivative_zero_unique_strong_convex[OF convex_ball \<open>finite K\<close>]) |
4474 apply (rule assms) |
4420 show "continuous_on (ball x e) f" |
4475 apply (rule continuous_on_subset) |
4421 using contf continuous_on_subset e by blast |
4476 apply (rule assms) |
4422 show "(f has_derivative (\<lambda>h. 0)) (at u within ball x e)" |
4477 apply (rule e)+ |
4423 if "u \<in> ball x e - K" for u |
4478 apply (subst centre_in_ball) |
4424 by (metis Diff_iff contra_subsetD derf e has_derivative_within_subset that) |
4479 apply (rule e) |
4425 qed (use y e \<open>0 < e\<close> in auto) |
4480 apply rule |
|
4481 apply safe |
|
4482 apply (rule has_derivative_within_subset) |
|
4483 apply (rule assms(7)[rule_format]) |
|
4484 using y e |
|
4485 apply auto |
|
4486 done |
|
4487 qed |
4426 qed |
|
4427 then show "\<exists>e>0. ball x e \<subseteq> {xa \<in> S. f xa \<in> {f x}}" |
|
4428 using \<open>0 < e\<close> by blast |
4488 qed |
4429 qed |
|
4430 then have "openin (subtopology euclidean S) {x \<in> S. f x \<in> {y}}" |
|
4431 by (auto intro!: open_openin_trans[OF \<open>open S\<close>] simp: open_contains_ball) |
|
4432 moreover have "closedin (subtopology euclidean S) {x \<in> S. f x \<in> {y}}" |
|
4433 by (force intro!: continuous_closedin_preimage [OF contf]) |
|
4434 ultimately have "{x \<in> S. f x \<in> {y}} = {} \<or> {x \<in> S. f x \<in> {y}} = S" |
|
4435 using \<open>connected S\<close> connected_clopen by blast |
4489 then show ?thesis |
4436 then show ?thesis |
4490 using \<open>x \<in> s\<close> \<open>f c = y\<close> \<open>c \<in> s\<close> by auto |
4437 using \<open>x \<in> S\<close> \<open>f c = y\<close> \<open>c \<in> S\<close> by auto |
4491 qed |
4438 qed |
4492 |
4439 |
4493 lemma has_derivative_zero_connected_constant: |
4440 lemma has_derivative_zero_connected_constant: |
4494 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
4441 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
4495 assumes "connected s" |
4442 assumes "connected S" |
4496 and "open s" |
4443 and "open S" |
4497 and "finite k" |
4444 and "finite k" |
4498 and "continuous_on s f" |
4445 and "continuous_on S f" |
4499 and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)" |
4446 and "\<forall>x\<in>(S - k). (f has_derivative (\<lambda>h. 0)) (at x within S)" |
4500 obtains c where "\<And>x. x \<in> s \<Longrightarrow> f(x) = c" |
4447 obtains c where "\<And>x. x \<in> S \<Longrightarrow> f(x) = c" |
4501 proof (cases "s = {}") |
4448 proof (cases "S = {}") |
4502 case True |
4449 case True |
4503 then show ?thesis |
4450 then show ?thesis |
4504 by (metis empty_iff that) |
4451 by (metis empty_iff that) |
4505 next |
4452 next |
4506 case False |
4453 case False |
4507 then obtain c where "c \<in> s" |
4454 then obtain c where "c \<in> S" |
4508 by (metis equals0I) |
4455 by (metis equals0I) |
4509 then show ?thesis |
4456 then show ?thesis |
4510 by (metis has_derivative_zero_unique_strong_connected assms that) |
4457 by (metis has_derivative_zero_unique_strong_connected assms that) |
4511 qed |
4458 qed |
4512 |
4459 |
6013 fixes f :: "nat \<Rightarrow> real" |
5960 fixes f :: "nat \<Rightarrow> real" |
6014 shows "\<lbrakk>bounded (range f); \<And>n. f n \<le> f (Suc n)\<rbrakk> \<Longrightarrow> \<exists>l. f \<longlonglongrightarrow> l" |
5961 shows "\<lbrakk>bounded (range f); \<And>n. f n \<le> f (Suc n)\<rbrakk> \<Longrightarrow> \<exists>l. f \<longlonglongrightarrow> l" |
6015 using Bseq_mono_convergent[of f] incseq_Suc_iff[of f] |
5962 using Bseq_mono_convergent[of f] incseq_Suc_iff[of f] |
6016 by (auto simp: image_def Bseq_eq_bounded convergent_def incseq_def) |
5963 by (auto simp: image_def Bseq_eq_bounded convergent_def incseq_def) |
6017 |
5964 |
|
5965 (*FIXME: why so much " \<bullet> 1"? *) |
6018 lemma monotone_convergence_interval: |
5966 lemma monotone_convergence_interval: |
6019 fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" |
5967 fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" |
6020 assumes "\<And>k. (f k) integrable_on cbox a b" |
5968 assumes intf: "\<And>k. (f k) integrable_on cbox a b" |
6021 and "\<And>k x. x \<in> cbox a b \<Longrightarrow> (f k x) \<le> f (Suc k) x" |
5969 and le: "\<And>k x. x \<in> cbox a b \<Longrightarrow> (f k x) \<le> f (Suc k) x" |
6022 and "\<And>x. x \<in> cbox a b \<Longrightarrow> ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially" |
5970 and fg: "\<And>x. x \<in> cbox a b \<Longrightarrow> ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially" |
6023 and bounded: "bounded (range (\<lambda>k. integral (cbox a b) (f k)))" |
5971 and bou: "bounded (range (\<lambda>k. integral (cbox a b) (f k)))" |
6024 shows "g integrable_on cbox a b \<and> ((\<lambda>k. integral (cbox a b) (f k)) \<longlongrightarrow> integral (cbox a b) g) sequentially" |
5972 shows "g integrable_on cbox a b \<and> ((\<lambda>k. integral (cbox a b) (f k)) \<longlongrightarrow> integral (cbox a b) g) sequentially" |
6025 proof (cases "content (cbox a b) = 0") |
5973 proof (cases "content (cbox a b) = 0") |
6026 case True |
5974 case True |
6027 then show ?thesis |
5975 then show ?thesis |
6028 by auto |
5976 by auto |
6029 next |
5977 next |
6030 case False |
5978 case False |
6031 have fg: "\<forall>x\<in>cbox a b. \<forall>k. (f k x) \<bullet> 1 \<le> (g x) \<bullet> 1" |
5979 have fg1: "(f k x) \<bullet> 1 \<le> (g x) \<bullet> 1" if x: "x \<in> cbox a b" for x k |
6032 proof safe |
5980 proof - |
6033 fix x k |
5981 have "\<forall>\<^sub>F xa in sequentially. f k x \<bullet> 1 \<le> f xa x \<bullet> 1" |
6034 assume x: "x \<in> cbox a b" |
|
6035 note * = Lim_component_ge[OF assms(3)[rule_format, OF x] trivial_limit_sequentially] |
|
6036 show "f k x \<bullet> 1 \<le> g x \<bullet> 1" |
|
6037 apply (rule *) |
|
6038 unfolding eventually_sequentially |
5982 unfolding eventually_sequentially |
6039 apply (rule_tac x=k in exI) |
5983 apply (rule_tac x=k in exI) |
6040 apply clarify |
5984 using le x apply (force intro: transitive_stepwise_le) |
6041 apply (rule transitive_stepwise_le) |
|
6042 using assms(2)[rule_format, OF x] |
|
6043 apply auto |
|
6044 done |
5985 done |
|
5986 with Lim_component_ge [OF fg] x |
|
5987 show "f k x \<bullet> 1 \<le> g x \<bullet> 1" |
|
5988 using trivial_limit_sequentially by blast |
6045 qed |
5989 qed |
6046 have int_inc: "\<And>n. integral (cbox a b) (f n) \<le> integral (cbox a b) (f (Suc n))" |
5990 have int_inc: "\<And>n. integral (cbox a b) (f n) \<le> integral (cbox a b) (f (Suc n))" |
6047 by (metis integral_le assms(1-2)) |
5991 by (metis integral_le assms(1-2)) |
6048 then obtain i where i: "(\<lambda>k. integral (cbox a b) (f k)) \<longlonglongrightarrow> i" |
5992 then obtain i where i: "(\<lambda>k. integral (cbox a b) (f k)) \<longlonglongrightarrow> i" |
6049 using bounded_increasing_convergent bounded by blast |
5993 using bounded_increasing_convergent bou by blast |
6050 have "\<And>k. \<forall>\<^sub>F x in sequentially. integral (cbox a b) (f k) \<le> integral (cbox a b) (f x) \<bullet> 1" |
5994 have "\<And>k. \<forall>\<^sub>F x in sequentially. integral (cbox a b) (f k) \<le> integral (cbox a b) (f x) \<bullet> 1" |
6051 unfolding eventually_sequentially |
5995 unfolding eventually_sequentially |
6052 by (force intro: transitive_stepwise_le int_inc) |
5996 by (force intro: transitive_stepwise_le int_inc) |
6053 then have i': "\<And>k. (integral(cbox a b) (f k)) \<le> i\<bullet>1" |
5997 then have i': "\<And>k. (integral(cbox a b) (f k)) \<le> i\<bullet>1" |
6054 using Lim_component_ge [OF i] trivial_limit_sequentially by blast |
5998 using Lim_component_ge [OF i] trivial_limit_sequentially by blast |
6055 have "(g has_integral i) (cbox a b)" |
5999 have "(g has_integral i) (cbox a b)" |
6056 unfolding has_integral |
6000 unfolding has_integral |
6057 proof (safe, goal_cases) |
6001 proof clarify |
6058 fix e::real |
6002 fix e::real |
6059 assume e: "e > 0" |
6003 assume e: "e > 0" |
6060 have "\<And>k. (\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
6004 have "\<And>k. (\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
6061 norm ((\<Sum>(x, ka)\<in>p. content ka *\<^sub>R f k x) - integral (cbox a b) (f k)) < e/2 ^ (k + 2)))" |
6005 norm ((\<Sum>(x, ka)\<in>p. content ka *\<^sub>R f k x) - integral (cbox a b) (f k)) < e/2 ^ (k + 2)))" |
6062 apply (rule assms(1)[unfolded has_integral_integral has_integral,rule_format]) |
6006 using intf e by (auto simp: has_integral_integral has_integral) |
6063 using e apply auto |
|
6064 done |
|
6065 then obtain c where c: |
6007 then obtain c where c: |
6066 "\<And>x. gauge (c x)" |
6008 "\<And>x. gauge (c x)" |
6067 "\<And>x p. \<lbrakk>p tagged_division_of cbox a b; c x fine p\<rbrakk> \<Longrightarrow> |
6009 "\<And>x p. \<lbrakk>p tagged_division_of cbox a b; c x fine p\<rbrakk> \<Longrightarrow> |
6068 norm ((\<Sum>(u, ka)\<in>p. content ka *\<^sub>R f x u) - integral (cbox a b) (f x)) |
6010 norm ((\<Sum>(u, ka)\<in>p. content ka *\<^sub>R f x u) - integral (cbox a b) (f x)) |
6069 < e / 2 ^ (x + 2)" |
6011 < e / 2 ^ (x + 2)" |
6071 |
6013 |
6072 have "\<exists>r. \<forall>k\<ge>r. 0 \<le> i\<bullet>1 - (integral (cbox a b) (f k)) \<and> i\<bullet>1 - (integral (cbox a b) (f k)) < e / 4" |
6014 have "\<exists>r. \<forall>k\<ge>r. 0 \<le> i\<bullet>1 - (integral (cbox a b) (f k)) \<and> i\<bullet>1 - (integral (cbox a b) (f k)) < e / 4" |
6073 proof - |
6015 proof - |
6074 have "e/4 > 0" |
6016 have "e/4 > 0" |
6075 using e by auto |
6017 using e by auto |
6076 from LIMSEQ_D [OF i this] guess r .. |
6018 show ?thesis |
6077 then show ?thesis |
6019 using LIMSEQ_D [OF i \<open>e/4 > 0\<close>] i' by auto |
6078 using i' by auto |
|
6079 qed |
6020 qed |
6080 then guess r..note r=conjunctD2[OF this[rule_format]] |
6021 then obtain r where r: "\<And>k. r \<le> k \<Longrightarrow> 0 \<le> i \<bullet> 1 - integral (cbox a b) (f k)" |
6081 |
6022 "\<And>k. r \<le> k \<Longrightarrow> i \<bullet> 1 - integral (cbox a b) (f k) < e / 4" |
6082 have "\<forall>x\<in>cbox a b. \<exists>n\<ge>r. \<forall>k\<ge>n. 0 \<le> (g x)\<bullet>1 - (f k x)\<bullet>1 \<and> |
6023 by metis |
6083 (g x)\<bullet>1 - (f k x)\<bullet>1 < e / (4 * content(cbox a b))" |
6024 have "\<exists>n\<ge>r. \<forall>k\<ge>n. 0 \<le> (g x)\<bullet>1 - (f k x)\<bullet>1 \<and> (g x)\<bullet>1 - (f k x)\<bullet>1 < e / (4 * content(cbox a b))" |
6084 proof (rule, goal_cases) |
6025 if "x \<in> cbox a b" for x |
6085 case prems: (1 x) |
6026 proof - |
6086 have "e / (4 * content (cbox a b)) > 0" |
6027 have "e / (4 * content (cbox a b)) > 0" |
6087 by (simp add: False content_lt_nz e) |
6028 by (simp add: False content_lt_nz e) |
6088 from assms(3)[rule_format, OF prems, THEN LIMSEQ_D, OF this] |
6029 with fg that LIMSEQ_D |
6089 guess n..note n=this |
6030 obtain N where "\<forall>n\<ge>N. norm (f n x - g x) < e / (4 * content (cbox a b))" |
6090 then show ?case |
6031 by metis |
6091 apply (rule_tac x="n + r" in exI) |
6032 then show "\<exists>n\<ge>r. |
6092 apply safe |
6033 \<forall>k\<ge>n. |
6093 apply (erule_tac[2-3] x=k in allE) |
6034 0 \<le> g x \<bullet> 1 - f k x \<bullet> 1 \<and> |
6094 unfolding dist_real_def |
6035 g x \<bullet> 1 - f k x \<bullet> 1 |
6095 using fg[rule_format, OF prems] |
6036 < e / (4 * content (cbox a b))" |
6096 apply (auto simp add: field_simps) |
6037 apply (rule_tac x="N + r" in exI) |
|
6038 using fg1[OF that] apply (auto simp add: field_simps) |
6097 done |
6039 done |
6098 qed |
6040 qed |
6099 from bchoice[OF this] guess m..note m=conjunctD2[OF this[rule_format],rule_format] |
6041 then obtain m where r_le_m: "\<And>x. x \<in> cbox a b \<Longrightarrow> r \<le> m x" |
|
6042 and m: "\<And>x k. \<lbrakk>x \<in> cbox a b; m x \<le> k\<rbrakk> |
|
6043 \<Longrightarrow> 0 \<le> g x \<bullet> 1 - f k x \<bullet> 1 \<and> g x \<bullet> 1 - f k x \<bullet> 1 < e / (4 * content (cbox a b))" |
|
6044 by metis |
6100 define d where "d x = c (m x) x" for x |
6045 define d where "d x = c (m x) x" for x |
6101 show "\<exists>\<gamma>. gauge \<gamma> \<and> |
6046 show "\<exists>\<gamma>. gauge \<gamma> \<and> |
6102 (\<forall>p. p tagged_division_of cbox a b \<and> |
6047 (\<forall>p. p tagged_division_of cbox a b \<and> |
6103 \<gamma> fine p \<longrightarrow> norm ((\<Sum>(x,K)\<in>p. content K *\<^sub>R g x) - i) < e)" |
6048 \<gamma> fine p \<longrightarrow> norm ((\<Sum>(x,K)\<in>p. content K *\<^sub>R g x) - i) < e)" |
6104 apply (rule_tac x=d in exI) |
6049 proof (rule exI, safe) |
6105 proof safe |
|
6106 show "gauge d" |
6050 show "gauge d" |
6107 using c(1) unfolding gauge_def d_def by auto |
6051 using c(1) unfolding gauge_def d_def by auto |
6108 next |
6052 next |
6109 fix p |
6053 fix p |
6110 assume p: "p tagged_division_of (cbox a b)" "d fine p" |
6054 assume p: "p tagged_division_of (cbox a b)" "d fine p" |
6111 note p'=tagged_division_ofD[OF p(1)] |
6055 note p'=tagged_division_ofD[OF p(1)] |
6112 have "\<exists>a. \<forall>x\<in>p. m (fst x) \<le> a" |
6056 obtain s where s: "\<And>x. x \<in> p \<Longrightarrow> m (fst x) \<le> s" |
6113 by (metis finite_imageI finite_nat_set_iff_bounded_le p'(1) rev_image_eqI) |
6057 by (metis finite_imageI finite_nat_set_iff_bounded_le p'(1) rev_image_eqI) |
6114 then guess s..note s=this |
|
6115 have *: "\<forall>a b c d. norm(a - b) \<le> e / 4 \<and> norm(b - c) < e/2 \<and> |
6058 have *: "\<forall>a b c d. norm(a - b) \<le> e / 4 \<and> norm(b - c) < e/2 \<and> |
6116 norm (c - d) < e / 4 \<longrightarrow> norm (a - d) < e" |
6059 norm (c - d) < e / 4 \<longrightarrow> norm (a - d) < e" |
6117 proof (safe, goal_cases) |
6060 proof (safe, goal_cases) |
6118 case (1 a b c d) |
6061 case (1 a b c d) |
6119 then show ?case |
6062 then show ?case |
6135 apply (rule sum_mono) |
6078 apply (rule sum_mono) |
6136 unfolding split_paired_all split_conv |
6079 unfolding split_paired_all split_conv |
6137 unfolding split_def sum_distrib_right[symmetric] scaleR_diff_right[symmetric] |
6080 unfolding split_def sum_distrib_right[symmetric] scaleR_diff_right[symmetric] |
6138 unfolding additive_content_tagged_division[OF p(1), unfolded split_def] |
6081 unfolding additive_content_tagged_division[OF p(1), unfolded split_def] |
6139 proof - |
6082 proof - |
6140 fix x k |
6083 fix x K |
6141 assume xk: "(x, k) \<in> p" |
6084 assume xk: "(x, K) \<in> p" |
6142 then have x: "x \<in> cbox a b" |
6085 then have x: "x \<in> cbox a b" |
6143 using p'(2-3)[OF xk] by auto |
6086 using p'(2-3)[OF xk] by auto |
6144 from p'(4)[OF xk] guess u v by (elim exE) note uv=this |
6087 with p'(4)[OF xk] obtain u v where "K = cbox u v" by metis |
6145 show "norm (content k *\<^sub>R (g x - f (m x) x)) \<le> content k * (e / (4 * content (cbox a b)))" |
6088 then show "norm (content K *\<^sub>R (g x - f (m x) x)) \<le> content K * (e / (4 * content (cbox a b)))" |
6146 unfolding norm_scaleR uv |
6089 unfolding norm_scaleR using m[OF x] |
6147 unfolding abs_of_nonneg[OF content_pos_le] |
6090 by (metis abs_of_nonneg inner_real_def less_eq_real_def measure_nonneg mult.right_neutral mult_left_mono order_refl real_norm_def) |
6148 apply (rule mult_left_mono) |
|
6149 using m(2)[OF x,of "m x"] |
|
6150 apply auto |
|
6151 done |
|
6152 qed (insert False, auto) |
6091 qed (insert False, auto) |
6153 |
6092 |
6154 next |
6093 next |
6155 case 2 |
6094 case 2 |
6156 show ?case |
6095 show ?case |
6157 apply (rule le_less_trans[of _ "norm (\<Sum>j = 0..s. |
6096 apply (rule le_less_trans[of _ "norm (\<Sum>j = 0..s. |
6158 \<Sum>(x, k)\<in>{xk\<in>p. m (fst xk) = j}. content k *\<^sub>R f (m x) x - integral k (f (m x)))"]) |
6097 \<Sum>(x, K)\<in>{xk\<in>p. m (fst xk) = j}. content K *\<^sub>R f (m x) x - integral K (f (m x)))"]) |
6159 apply (subst sum_group) |
6098 apply (subst sum_group) |
6160 apply fact |
6099 apply fact |
6161 apply (rule finite_atLeastAtMost) |
6100 apply (rule finite_atLeastAtMost) |
6162 defer |
6101 defer |
6163 apply (subst split_def)+ |
6102 apply (subst split_def)+ |
6437 by (simp add: has_integral_integral) |
6371 by (simp add: has_integral_integral) |
6438 qed |
6372 qed |
6439 |
6373 |
6440 lemma monotone_convergence_decreasing: |
6374 lemma monotone_convergence_decreasing: |
6441 fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" |
6375 fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" |
6442 assumes "\<And>k. (f k) integrable_on S" |
6376 assumes intf: "\<And>k. (f k) integrable_on S" |
6443 and "\<And>k x. x \<in> S \<Longrightarrow> f (Suc k) x \<le> f k x" |
6377 and le: "\<And>k x. x \<in> S \<Longrightarrow> f (Suc k) x \<le> f k x" |
6444 and "\<And>x. x \<in> S \<Longrightarrow> ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially" |
6378 and fg: "\<And>x. x \<in> S \<Longrightarrow> ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially" |
6445 and "bounded (range(\<lambda>k. integral S (f k)))" |
6379 and bou: "bounded (range(\<lambda>k. integral S (f k)))" |
6446 shows "g integrable_on S \<and> ((\<lambda>k. integral S (f k)) \<longlongrightarrow> integral S g) sequentially" |
6380 shows "g integrable_on S \<and> (\<lambda>k. integral S (f k)) \<longlonglongrightarrow> integral S g" |
6447 proof - |
6381 proof - |
6448 have *: "{integral S (\<lambda>x. - f k x) |k. True} = op *\<^sub>R (- 1) ` (range(\<lambda>k. integral S (f k)))" |
6382 have *: "range(\<lambda>k. integral S (\<lambda>x. - f k x)) = op *\<^sub>R (- 1) ` (range(\<lambda>k. integral S (f k)))" |
6449 apply safe |
6383 by force |
6450 unfolding image_iff |
6384 have "(\<lambda>x. - g x) integrable_on S \<and> (\<lambda>k. integral S (\<lambda>x. - f k x)) \<longlonglongrightarrow> integral S (\<lambda>x. - g x)" |
6451 apply (rule_tac x="integral S (f k)" in bexI) |
|
6452 prefer 3 |
|
6453 apply (rule_tac x=k in exI) |
|
6454 apply auto |
|
6455 done |
|
6456 have "(\<lambda>x. - g x) integrable_on S \<and> |
|
6457 ((\<lambda>k. integral S (\<lambda>x. - f k x)) \<longlongrightarrow> integral S (\<lambda>x. - g x)) sequentially" |
|
6458 proof (rule monotone_convergence_increasing) |
6385 proof (rule monotone_convergence_increasing) |
6459 show "\<And>k. (\<lambda>x. - f k x) integrable_on S" |
6386 show "\<And>k. (\<lambda>x. - f k x) integrable_on S" |
6460 by (blast intro: integrable_neg assms) |
6387 by (blast intro: integrable_neg intf) |
6461 show "\<And>k x. x \<in> S \<Longrightarrow> - f k x \<le> - f (Suc k) x" |
6388 show "\<And>k x. x \<in> S \<Longrightarrow> - f k x \<le> - f (Suc k) x" |
6462 by (simp add: assms) |
6389 by (simp add: le) |
6463 show "\<And>x. x \<in> S \<Longrightarrow> (\<lambda>k. - f k x) \<longlonglongrightarrow> - g x" |
6390 show "\<And>x. x \<in> S \<Longrightarrow> (\<lambda>k. - f k x) \<longlonglongrightarrow> - g x" |
6464 by (simp add: assms tendsto_minus) |
6391 by (simp add: fg tendsto_minus) |
6465 show "bounded (range(\<lambda>k. integral S (\<lambda>x. - f k x)))" |
6392 show "bounded (range(\<lambda>k. integral S (\<lambda>x. - f k x)))" |
6466 using "*" assms(4) bounded_scaling by auto |
6393 using "*" bou bounded_scaling by auto |
6467 qed |
6394 qed |
6468 then show ?thesis |
6395 then show ?thesis |
6469 by (force dest: integrable_neg tendsto_minus) |
6396 by (force dest: integrable_neg tendsto_minus) |
6470 qed |
6397 qed |
6471 |
6398 |