2887 have "norm ((\<Sum>(x, k)\<in>q. content k *\<^sub>R f x) - y) < e" |
2887 have "norm ((\<Sum>(x, k)\<in>q. content k *\<^sub>R f x) - y) < e" |
2888 apply (rule norm_triangle_half_r) |
2888 apply (rule norm_triangle_half_r) |
2889 apply (rule less_trans[OF _ *]) |
2889 apply (rule less_trans[OF _ *]) |
2890 apply (subst N1', rule d(2)[of "p (N1+N2)"]) |
2890 apply (subst N1', rule d(2)[of "p (N1+N2)"]) |
2891 using N1' as(1) as(2) dp |
2891 using N1' as(1) as(2) dp |
2892 apply (simp add: `\<forall>x. p x tagged_division_of cbox a b \<and> (\<lambda>xa. \<Inter>{d i xa |i. i \<in> {0..x}}) fine p x`) |
2892 apply (simp add: \<open>\<forall>x. p x tagged_division_of cbox a b \<and> (\<lambda>xa. \<Inter>{d i xa |i. i \<in> {0..x}}) fine p x\<close>) |
2893 using N2 le_add2 by blast |
2893 using N2 le_add2 by blast |
2894 } |
2894 } |
2895 ultimately show "\<exists>d. gauge d \<and> |
2895 ultimately show "\<exists>d. gauge d \<and> |
2896 (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
2896 (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
2897 norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - y) < e)" |
2897 norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - y) < e)" |
3600 note * = comp_fun_commute.comp_comp_fun_commute [OF comp_fun_commute_monoidal[OF assms(1)]] |
3600 note * = comp_fun_commute.comp_comp_fun_commute [OF comp_fun_commute_monoidal[OF assms(1)]] |
3601 show ?thesis |
3601 show ?thesis |
3602 proof (cases "f x = neutral opp") |
3602 proof (cases "f x = neutral opp") |
3603 case True |
3603 case True |
3604 then show ?thesis |
3604 then show ?thesis |
3605 using assms `x \<notin> s` |
3605 using assms \<open>x \<notin> s\<close> |
3606 by (auto simp: iterate_def support_clauses) |
3606 by (auto simp: iterate_def support_clauses) |
3607 next |
3607 next |
3608 case False |
3608 case False |
3609 with `x \<notin> s` \<open>finite s\<close> support_subset show ?thesis |
3609 with \<open>x \<notin> s\<close> \<open>finite s\<close> support_subset show ?thesis |
3610 apply (simp add: iterate_def fold'_def support_clauses) |
3610 apply (simp add: iterate_def fold'_def support_clauses) |
3611 apply (subst comp_fun_commute.fold_insert[OF * finite_support, simplified comp_def]) |
3611 apply (subst comp_fun_commute.fold_insert[OF * finite_support, simplified comp_def]) |
3612 apply (force simp add: )+ |
3612 apply (force simp add: )+ |
3613 done |
3613 done |
3614 qed |
3614 qed |
3960 show ?case |
3960 show ?case |
3961 proof (cases "content (cbox a b) = 0") |
3961 proof (cases "content (cbox a b) = 0") |
3962 case True |
3962 case True |
3963 show "iterate opp d f = f (cbox a b)" |
3963 show "iterate opp d f = f (cbox a b)" |
3964 unfolding operativeD(1)[OF assms(2) True] |
3964 unfolding operativeD(1)[OF assms(2) True] |
3965 proof (rule iterate_eq_neutral[OF `monoidal opp`]) |
3965 proof (rule iterate_eq_neutral[OF \<open>monoidal opp\<close>]) |
3966 fix x |
3966 fix x |
3967 assume x: "x \<in> d" |
3967 assume x: "x \<in> d" |
3968 then show "f x = neutral opp" |
3968 then show "f x = neutral opp" |
3969 by (metis division_ofD(4) 1(4) division_of_content_0[OF True] operativeD(1)[OF assms(2)] x) |
3969 by (metis division_ofD(4) 1(4) division_of_content_0[OF True] operativeD(1)[OF assms(2)] x) |
3970 qed |
3970 qed |
3988 "(j, v\<bullet>j) \<notin> division_points (cbox a b) d" using True by auto |
3988 "(j, v\<bullet>j) \<notin> division_points (cbox a b) d" using True by auto |
3989 note this[unfolded de_Morgan_conj division_points_def mem_Collect_eq split_conv interval_bounds[OF ab'] bex_simps] |
3989 note this[unfolded de_Morgan_conj division_points_def mem_Collect_eq split_conv interval_bounds[OF ab'] bex_simps] |
3990 note *[OF this(1)] *[OF this(2)] note this[unfolded interval_bounds[OF uv(1)]] |
3990 note *[OF this(1)] *[OF this(2)] note this[unfolded interval_bounds[OF uv(1)]] |
3991 moreover |
3991 moreover |
3992 have "a\<bullet>j \<le> u\<bullet>j" "v\<bullet>j \<le> b\<bullet>j" |
3992 have "a\<bullet>j \<le> u\<bullet>j" "v\<bullet>j \<le> b\<bullet>j" |
3993 using division_ofD(2,2,3)[OF `d division_of cbox a b` as] |
3993 using division_ofD(2,2,3)[OF \<open>d division_of cbox a b\<close> as] |
3994 apply (metis j subset_box(1) uv(1)) |
3994 apply (metis j subset_box(1) uv(1)) |
3995 by (metis `cbox u v \<subseteq> cbox a b` j subset_box(1) uv(1)) |
3995 by (metis \<open>cbox u v \<subseteq> cbox a b\<close> j subset_box(1) uv(1)) |
3996 ultimately have "u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = a\<bullet>j \<or> u\<bullet>j = b\<bullet>j \<and> v\<bullet>j = b\<bullet>j \<or> u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = b\<bullet>j" |
3996 ultimately have "u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = a\<bullet>j \<or> u\<bullet>j = b\<bullet>j \<and> v\<bullet>j = b\<bullet>j \<or> u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = b\<bullet>j" |
3997 unfolding not_less de_Morgan_disj using ab[rule_format,of j] uv(2) j by force } |
3997 unfolding not_less de_Morgan_disj using ab[rule_format,of j] uv(2) j by force } |
3998 then have d': "\<forall>i\<in>d. \<exists>u v. i = cbox u v \<and> |
3998 then have d': "\<forall>i\<in>d. \<exists>u v. i = cbox u v \<and> |
3999 (\<forall>j\<in>Basis. u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = a\<bullet>j \<or> u\<bullet>j = b\<bullet>j \<and> v\<bullet>j = b\<bullet>j \<or> u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = b\<bullet>j)" |
3999 (\<forall>j\<in>Basis. u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = a\<bullet>j \<or> u\<bullet>j = b\<bullet>j \<and> v\<bullet>j = b\<bullet>j \<or> u\<bullet>j = a\<bullet>j \<and> v\<bullet>j = b\<bullet>j)" |
4000 unfolding forall_in_division[OF 1(4)] |
4000 unfolding forall_in_division[OF 1(4)] |
4001 by blast |
4001 by blast |
4002 have "(1/2) *\<^sub>R (a+b) \<in> cbox a b" |
4002 have "(1/2) *\<^sub>R (a+b) \<in> cbox a b" |
4003 unfolding mem_box using ab by(auto intro!: less_imp_le simp: inner_simps) |
4003 unfolding mem_box using ab by(auto intro!: less_imp_le simp: inner_simps) |
4004 note this[unfolded division_ofD(6)[OF `d division_of cbox a b`,symmetric] Union_iff] |
4004 note this[unfolded division_ofD(6)[OF \<open>d division_of cbox a b\<close>,symmetric] Union_iff] |
4005 then guess i .. note i=this |
4005 then guess i .. note i=this |
4006 guess u v using d'[rule_format,OF i(1)] by (elim exE conjE) note uv=this |
4006 guess u v using d'[rule_format,OF i(1)] by (elim exE conjE) note uv=this |
4007 have "cbox a b \<in> d" |
4007 have "cbox a b \<in> d" |
4008 proof - |
4008 proof - |
4009 have "u = a" "v = b" |
4009 have "u = a" "v = b" |
4057 from this(3) guess j .. note j=this |
4057 from this(3) guess j .. note j=this |
4058 def d1 \<equiv> "{l \<inter> {x. x\<bullet>k \<le> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}" |
4058 def d1 \<equiv> "{l \<inter> {x. x\<bullet>k \<le> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}" |
4059 def d2 \<equiv> "{l \<inter> {x. x\<bullet>k \<ge> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}" |
4059 def d2 \<equiv> "{l \<inter> {x. x\<bullet>k \<ge> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}" |
4060 def cb \<equiv> "(\<Sum>i\<in>Basis. (if i = k then c else b\<bullet>i) *\<^sub>R i)::'a" |
4060 def cb \<equiv> "(\<Sum>i\<in>Basis. (if i = k then c else b\<bullet>i) *\<^sub>R i)::'a" |
4061 def ca \<equiv> "(\<Sum>i\<in>Basis. (if i = k then c else a\<bullet>i) *\<^sub>R i)::'a" |
4061 def ca \<equiv> "(\<Sum>i\<in>Basis. (if i = k then c else a\<bullet>i) *\<^sub>R i)::'a" |
4062 note division_points_psubset[OF `d division_of cbox a b` ab kc(1-2) j] |
4062 note division_points_psubset[OF \<open>d division_of cbox a b\<close> ab kc(1-2) j] |
4063 note psubset_card_mono[OF _ this(1)] psubset_card_mono[OF _ this(2)] |
4063 note psubset_card_mono[OF _ this(1)] psubset_card_mono[OF _ this(2)] |
4064 then have *: "(iterate opp d1 f) = f (cbox a b \<inter> {x. x\<bullet>k \<le> c})" |
4064 then have *: "(iterate opp d1 f) = f (cbox a b \<inter> {x. x\<bullet>k \<le> c})" |
4065 "(iterate opp d2 f) = f (cbox a b \<inter> {x. x\<bullet>k \<ge> c})" |
4065 "(iterate opp d2 f) = f (cbox a b \<inter> {x. x\<bullet>k \<ge> c})" |
4066 unfolding interval_split[OF kc(4)] |
4066 unfolding interval_split[OF kc(4)] |
4067 apply (rule_tac[!] "1.hyps"[rule_format]) |
4067 apply (rule_tac[!] "1.hyps"[rule_format]) |
4068 using division_split[OF `d division_of cbox a b`, where k=k and c=c] |
4068 using division_split[OF \<open>d division_of cbox a b\<close>, where k=k and c=c] |
4069 apply (simp_all add: interval_split 1 kc d1_def d2_def division_points_finite[OF `d division_of cbox a b`]) |
4069 apply (simp_all add: interval_split 1 kc d1_def d2_def division_points_finite[OF \<open>d division_of cbox a b\<close>]) |
4070 done |
4070 done |
4071 { fix l y |
4071 { fix l y |
4072 assume as: "l \<in> d" "y \<in> d" "l \<inter> {x. x \<bullet> k \<le> c} = y \<inter> {x. x \<bullet> k \<le> c}" "l \<noteq> y" |
4072 assume as: "l \<in> d" "y \<in> d" "l \<inter> {x. x \<bullet> k \<le> c} = y \<inter> {x. x \<bullet> k \<le> c}" "l \<noteq> y" |
4073 from division_ofD(4)[OF `d division_of cbox a b` this(1)] guess u v by (elim exE) note leq=this |
4073 from division_ofD(4)[OF \<open>d division_of cbox a b\<close> this(1)] guess u v by (elim exE) note leq=this |
4074 have "f (l \<inter> {x. x \<bullet> k \<le> c}) = neutral opp" |
4074 have "f (l \<inter> {x. x \<bullet> k \<le> c}) = neutral opp" |
4075 unfolding leq interval_split[OF kc(4)] |
4075 unfolding leq interval_split[OF kc(4)] |
4076 apply (rule operativeD(1) 1)+ |
4076 apply (rule operativeD(1) 1)+ |
4077 unfolding interval_split[symmetric,OF kc(4)] |
4077 unfolding interval_split[symmetric,OF kc(4)] |
4078 using division_split_left_inj 1 as kc leq by blast |
4078 using division_split_left_inj 1 as kc leq by blast |
4079 } note fxk_le = this |
4079 } note fxk_le = this |
4080 { fix l y |
4080 { fix l y |
4081 assume as: "l \<in> d" "y \<in> d" "l \<inter> {x. c \<le> x \<bullet> k} = y \<inter> {x. c \<le> x \<bullet> k}" "l \<noteq> y" |
4081 assume as: "l \<in> d" "y \<in> d" "l \<inter> {x. c \<le> x \<bullet> k} = y \<inter> {x. c \<le> x \<bullet> k}" "l \<noteq> y" |
4082 from division_ofD(4)[OF `d division_of cbox a b` this(1)] guess u v by (elim exE) note leq=this |
4082 from division_ofD(4)[OF \<open>d division_of cbox a b\<close> this(1)] guess u v by (elim exE) note leq=this |
4083 have "f (l \<inter> {x. x \<bullet> k \<ge> c}) = neutral opp" |
4083 have "f (l \<inter> {x. x \<bullet> k \<ge> c}) = neutral opp" |
4084 unfolding leq interval_split[OF kc(4)] |
4084 unfolding leq interval_split[OF kc(4)] |
4085 apply (rule operativeD(1) 1)+ |
4085 apply (rule operativeD(1) 1)+ |
4086 unfolding interval_split[symmetric,OF kc(4)] |
4086 unfolding interval_split[symmetric,OF kc(4)] |
4087 using division_split_right_inj 1 leq as kc by blast |
4087 using division_split_right_inj 1 leq as kc by blast |
4100 apply (rule iterate_nonzero_image_lemma[unfolded o_def]) |
4100 apply (rule iterate_nonzero_image_lemma[unfolded o_def]) |
4101 apply (rule 1 division_of_finite operativeD[OF 1(3)])+ |
4101 apply (rule 1 division_of_finite operativeD[OF 1(3)])+ |
4102 apply (force simp add: empty_as_interval[symmetric] fxk_ge)+ |
4102 apply (force simp add: empty_as_interval[symmetric] fxk_ge)+ |
4103 done |
4103 done |
4104 also have *: "\<forall>x\<in>d. f x = opp (f (x \<inter> {x. x \<bullet> k \<le> c})) (f (x \<inter> {x. c \<le> x \<bullet> k}))" |
4104 also have *: "\<forall>x\<in>d. f x = opp (f (x \<inter> {x. x \<bullet> k \<le> c})) (f (x \<inter> {x. c \<le> x \<bullet> k}))" |
4105 unfolding forall_in_division[OF `d division_of cbox a b`] |
4105 unfolding forall_in_division[OF \<open>d division_of cbox a b\<close>] |
4106 using assms(2) kc(4) by blast |
4106 using assms(2) kc(4) by blast |
4107 have "opp (iterate opp d (\<lambda>l. f (l \<inter> {x. x \<bullet> k \<le> c}))) (iterate opp d (\<lambda>l. f (l \<inter> {x. c \<le> x \<bullet> k}))) = |
4107 have "opp (iterate opp d (\<lambda>l. f (l \<inter> {x. x \<bullet> k \<le> c}))) (iterate opp d (\<lambda>l. f (l \<inter> {x. c \<le> x \<bullet> k}))) = |
4108 iterate opp d f" |
4108 iterate opp d f" |
4109 apply (subst(3) iterate_eq[OF _ *[rule_format]]) |
4109 apply (subst(3) iterate_eq[OF _ *[rule_format]]) |
4110 using 1 |
4110 using 1 |
4687 and k: "k \<in> Basis" |
4687 and k: "k \<in> Basis" |
4688 obtains d where "0 < d" and "content (cbox a b \<inter> {x. abs(x\<bullet>k - c) \<le> d}) < e" |
4688 obtains d where "0 < d" and "content (cbox a b \<inter> {x. abs(x\<bullet>k - c) \<le> d}) < e" |
4689 proof (cases "content (cbox a b) = 0") |
4689 proof (cases "content (cbox a b) = 0") |
4690 case True |
4690 case True |
4691 then have ce: "content (cbox a b) < e" |
4691 then have ce: "content (cbox a b) < e" |
4692 by (metis `0 < e`) |
4692 by (metis \<open>0 < e\<close>) |
4693 show ?thesis |
4693 show ?thesis |
4694 apply (rule that[of 1]) |
4694 apply (rule that[of 1]) |
4695 apply simp |
4695 apply simp |
4696 unfolding interval_doublesplit[OF k] |
4696 unfolding interval_doublesplit[OF k] |
4697 apply (rule le_less_trans[OF content_subset ce]) |
4697 apply (rule le_less_trans[OF content_subset ce]) |
6110 by (simp add: i_def g_def Dg_def) |
6110 by (simp add: i_def g_def Dg_def) |
6111 also |
6111 also |
6112 have one: "(- 1) ^ p' * (- 1) ^ p' = (1::real)" |
6112 have one: "(- 1) ^ p' * (- 1) ^ p' = (1::real)" |
6113 and "{..<p} \<inter> {i. p = Suc i} = {p - 1}" |
6113 and "{..<p} \<inter> {i. p = Suc i} = {p - 1}" |
6114 for p' |
6114 for p' |
6115 using `p > 0` |
6115 using \<open>p > 0\<close> |
6116 by (auto simp: power_mult_distrib[symmetric]) |
6116 by (auto simp: power_mult_distrib[symmetric]) |
6117 then have "?sum b = f b" |
6117 then have "?sum b = f b" |
6118 using Suc_pred'[OF `p > 0`] |
6118 using Suc_pred'[OF \<open>p > 0\<close>] |
6119 by (simp add: diff_eq_eq Dg_def power_0_left le_Suc_eq if_distrib |
6119 by (simp add: diff_eq_eq Dg_def power_0_left le_Suc_eq if_distrib |
6120 cond_application_beta setsum.If_cases f0) |
6120 cond_application_beta setsum.If_cases f0) |
6121 also |
6121 also |
6122 have "{..<p} = (\<lambda>x. p - x - 1) ` {..<p}" |
6122 have "{..<p} = (\<lambda>x. p - x - 1) ` {..<p}" |
6123 proof safe |
6123 proof safe |
6426 proof - |
6426 proof - |
6427 let ?I = "\<lambda>a b. integral {a..b} f" |
6427 let ?I = "\<lambda>a b. integral {a..b} f" |
6428 { fix e::real |
6428 { fix e::real |
6429 assume "e > 0" |
6429 assume "e > 0" |
6430 obtain d where "d>0" and d: "\<And>x'. \<lbrakk>x' \<in> {a..b}; \<bar>x' - x\<bar> < d\<rbrakk> \<Longrightarrow> norm(f x' - f x) \<le> e" |
6430 obtain d where "d>0" and d: "\<And>x'. \<lbrakk>x' \<in> {a..b}; \<bar>x' - x\<bar> < d\<rbrakk> \<Longrightarrow> norm(f x' - f x) \<le> e" |
6431 using `e>0` fx by (auto simp: continuous_within_eps_delta dist_norm less_imp_le) |
6431 using \<open>e>0\<close> fx by (auto simp: continuous_within_eps_delta dist_norm less_imp_le) |
6432 have "norm (integral {a..y} f - integral {a..x} f - (y - x) *\<^sub>R f x) \<le> e * \<bar>y - x\<bar>" |
6432 have "norm (integral {a..y} f - integral {a..x} f - (y - x) *\<^sub>R f x) \<le> e * \<bar>y - x\<bar>" |
6433 if y: "y \<in> {a..b}" and yx: "\<bar>y - x\<bar> < d" for y |
6433 if y: "y \<in> {a..b}" and yx: "\<bar>y - x\<bar> < d" for y |
6434 proof (cases "y < x") |
6434 proof (cases "y < x") |
6435 case False |
6435 case False |
6436 have "f integrable_on {a..y}" |
6436 have "f integrable_on {a..y}" |
6463 done |
6463 done |
6464 have "norm (integral {a..x} f - integral {a..y} f - (x - y) *\<^sub>R f x) \<le> e * \<bar>y - x\<bar>" |
6464 have "norm (integral {a..x} f - integral {a..y} f - (x - y) *\<^sub>R f x) \<le> e * \<bar>y - x\<bar>" |
6465 using True |
6465 using True |
6466 apply (simp add: abs_eq_content del: content_real_if) |
6466 apply (simp add: abs_eq_content del: content_real_if) |
6467 apply (rule has_integral_bound_real[where f="(\<lambda>u. f u - f x)"]) |
6467 apply (rule has_integral_bound_real[where f="(\<lambda>u. f u - f x)"]) |
6468 using yx True d x y `e>0` apply (auto simp add: Idiff fux_int) |
6468 using yx True d x y \<open>e>0\<close> apply (auto simp add: Idiff fux_int) |
6469 done |
6469 done |
6470 then show ?thesis |
6470 then show ?thesis |
6471 by (simp add: algebra_simps norm_minus_commute) |
6471 by (simp add: algebra_simps norm_minus_commute) |
6472 qed |
6472 qed |
6473 then have "\<exists>d>0. \<forall>y\<in>{a..b}. \<bar>y - x\<bar> < d \<longrightarrow> norm (integral {a..y} f - integral {a..x} f - (y - x) *\<^sub>R f x) \<le> e * \<bar>y - x\<bar>" |
6473 then have "\<exists>d>0. \<forall>y\<in>{a..b}. \<bar>y - x\<bar> < d \<longrightarrow> norm (integral {a..y} f - integral {a..x} f - (y - x) *\<^sub>R f x) \<le> e * \<bar>y - x\<bar>" |
6474 using `d>0` by blast |
6474 using \<open>d>0\<close> by blast |
6475 } |
6475 } |
6476 then show ?thesis |
6476 then show ?thesis |
6477 by (simp add: has_vector_derivative_def has_derivative_within_alt bounded_linear_scaleR_left) |
6477 by (simp add: has_vector_derivative_def has_derivative_within_alt bounded_linear_scaleR_left) |
6478 qed |
6478 qed |
6479 |
6479 |
12195 } note * = this |
12195 } note * = this |
12196 show "norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y)))) \<le> e" |
12196 show "norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y)))) \<le> e" |
12197 using compact_uniformly_continuous [OF assms compact_cbox] |
12197 using compact_uniformly_continuous [OF assms compact_cbox] |
12198 apply (simp add: uniformly_continuous_on_def dist_norm) |
12198 apply (simp add: uniformly_continuous_on_def dist_norm) |
12199 apply (drule_tac x="e / 2 / content?CBOX" in spec) |
12199 apply (drule_tac x="e / 2 / content?CBOX" in spec) |
12200 using cbp `0 < e` |
12200 using cbp \<open>0 < e\<close> |
12201 apply (auto simp: zero_less_mult_iff) |
12201 apply (auto simp: zero_less_mult_iff) |
12202 apply (rename_tac k) |
12202 apply (rename_tac k) |
12203 apply (rule_tac e1=k in fine_division_exists [OF gauge_ball, where a = "(a,c)" and b = "(b,d)"]) |
12203 apply (rule_tac e1=k in fine_division_exists [OF gauge_ball, where a = "(a,c)" and b = "(b,d)"]) |
12204 apply assumption |
12204 apply assumption |
12205 apply (rule op_acbd) |
12205 apply (rule op_acbd) |