|
1 (* Author: John Harrison |
|
2 Author: Robert Himmelmann, TU Muenchen (Translation from HOL light); proofs reworked by LCP |
|
3 *) |
|
4 |
|
5 section \<open>Henstock-Kurzweil gauge integration in many dimensions.\<close> |
|
6 |
|
7 theory Henstock_Kurzweil_Integration |
|
8 imports |
|
9 Derivative |
|
10 Uniform_Limit |
|
11 "~~/src/HOL/Library/Indicator_Function" |
|
12 begin |
|
13 |
|
14 lemmas scaleR_simps = scaleR_zero_left scaleR_minus_left scaleR_left_diff_distrib |
|
15 scaleR_zero_right scaleR_minus_right scaleR_right_diff_distrib scaleR_eq_0_iff |
|
16 scaleR_cancel_left scaleR_cancel_right scaleR_add_right scaleR_add_left real_vector_class.scaleR_one |
|
17 |
|
18 |
|
19 subsection \<open>Sundries\<close> |
|
20 |
|
21 lemma conjunctD2: assumes "a \<and> b" shows a b using assms by auto |
|
22 lemma conjunctD3: assumes "a \<and> b \<and> c" shows a b c using assms by auto |
|
23 lemma conjunctD4: assumes "a \<and> b \<and> c \<and> d" shows a b c d using assms by auto |
|
24 |
|
25 declare norm_triangle_ineq4[intro] |
|
26 |
|
27 lemma simple_image: "{f x |x . x \<in> s} = f ` s" |
|
28 by blast |
|
29 |
|
30 lemma linear_simps: |
|
31 assumes "bounded_linear f" |
|
32 shows |
|
33 "f (a + b) = f a + f b" |
|
34 "f (a - b) = f a - f b" |
|
35 "f 0 = 0" |
|
36 "f (- a) = - f a" |
|
37 "f (s *\<^sub>R v) = s *\<^sub>R (f v)" |
|
38 proof - |
|
39 interpret f: bounded_linear f by fact |
|
40 show "f (a + b) = f a + f b" by (rule f.add) |
|
41 show "f (a - b) = f a - f b" by (rule f.diff) |
|
42 show "f 0 = 0" by (rule f.zero) |
|
43 show "f (- a) = - f a" by (rule f.minus) |
|
44 show "f (s *\<^sub>R v) = s *\<^sub>R (f v)" by (rule f.scaleR) |
|
45 qed |
|
46 |
|
47 lemma bounded_linearI: |
|
48 assumes "\<And>x y. f (x + y) = f x + f y" |
|
49 and "\<And>r x. f (r *\<^sub>R x) = r *\<^sub>R f x" |
|
50 and "\<And>x. norm (f x) \<le> norm x * K" |
|
51 shows "bounded_linear f" |
|
52 using assms by (rule bounded_linear_intro) (* FIXME: duplicate *) |
|
53 |
|
54 lemma bounded_linear_component [intro]: "bounded_linear (\<lambda>x::'a::euclidean_space. x \<bullet> k)" |
|
55 by (rule bounded_linear_inner_left) |
|
56 |
|
57 lemma transitive_stepwise_lt_eq: |
|
58 assumes "(\<And>x y z::nat. R x y \<Longrightarrow> R y z \<Longrightarrow> R x z)" |
|
59 shows "((\<forall>m. \<forall>n>m. R m n) \<longleftrightarrow> (\<forall>n. R n (Suc n)))" |
|
60 (is "?l = ?r") |
|
61 proof safe |
|
62 assume ?r |
|
63 fix n m :: nat |
|
64 assume "m < n" |
|
65 then show "R m n" |
|
66 proof (induct n arbitrary: m) |
|
67 case 0 |
|
68 then show ?case by auto |
|
69 next |
|
70 case (Suc n) |
|
71 show ?case |
|
72 proof (cases "m < n") |
|
73 case True |
|
74 show ?thesis |
|
75 apply (rule assms[OF Suc(1)[OF True]]) |
|
76 using \<open>?r\<close> |
|
77 apply auto |
|
78 done |
|
79 next |
|
80 case False |
|
81 then have "m = n" |
|
82 using Suc(2) by auto |
|
83 then show ?thesis |
|
84 using \<open>?r\<close> by auto |
|
85 qed |
|
86 qed |
|
87 qed auto |
|
88 |
|
89 lemma transitive_stepwise_gt: |
|
90 assumes "\<And>x y z. R x y \<Longrightarrow> R y z \<Longrightarrow> R x z" "\<And>n. R n (Suc n)" |
|
91 shows "\<forall>n>m. R m n" |
|
92 proof - |
|
93 have "\<forall>m. \<forall>n>m. R m n" |
|
94 apply (subst transitive_stepwise_lt_eq) |
|
95 apply (blast intro: assms)+ |
|
96 done |
|
97 then show ?thesis by auto |
|
98 qed |
|
99 |
|
100 lemma transitive_stepwise_le_eq: |
|
101 assumes "\<And>x. R x x" "\<And>x y z. R x y \<Longrightarrow> R y z \<Longrightarrow> R x z" |
|
102 shows "(\<forall>m. \<forall>n\<ge>m. R m n) \<longleftrightarrow> (\<forall>n. R n (Suc n))" |
|
103 (is "?l = ?r") |
|
104 proof safe |
|
105 assume ?r |
|
106 fix m n :: nat |
|
107 assume "m \<le> n" |
|
108 then show "R m n" |
|
109 proof (induct n arbitrary: m) |
|
110 case 0 |
|
111 with assms show ?case by auto |
|
112 next |
|
113 case (Suc n) |
|
114 show ?case |
|
115 proof (cases "m \<le> n") |
|
116 case True |
|
117 with Suc.hyps \<open>\<forall>n. R n (Suc n)\<close> assms show ?thesis |
|
118 by blast |
|
119 next |
|
120 case False |
|
121 then have "m = Suc n" |
|
122 using Suc(2) by auto |
|
123 then show ?thesis |
|
124 using assms(1) by auto |
|
125 qed |
|
126 qed |
|
127 qed auto |
|
128 |
|
129 lemma transitive_stepwise_le: |
|
130 assumes "\<And>x. R x x" "\<And>x y z. R x y \<Longrightarrow> R y z \<Longrightarrow> R x z" |
|
131 and "\<And>n. R n (Suc n)" |
|
132 shows "\<forall>n\<ge>m. R m n" |
|
133 proof - |
|
134 have "\<forall>m. \<forall>n\<ge>m. R m n" |
|
135 apply (subst transitive_stepwise_le_eq) |
|
136 apply (blast intro: assms)+ |
|
137 done |
|
138 then show ?thesis by auto |
|
139 qed |
|
140 |
|
141 |
|
142 subsection \<open>Some useful lemmas about intervals.\<close> |
|
143 |
|
144 lemma empty_as_interval: "{} = cbox One (0::'a::euclidean_space)" |
|
145 using nonempty_Basis |
|
146 by (fastforce simp add: set_eq_iff mem_box) |
|
147 |
|
148 lemma interior_subset_union_intervals: |
|
149 assumes "i = cbox a b" |
|
150 and "j = cbox c d" |
|
151 and "interior j \<noteq> {}" |
|
152 and "i \<subseteq> j \<union> s" |
|
153 and "interior i \<inter> interior j = {}" |
|
154 shows "interior i \<subseteq> interior s" |
|
155 proof - |
|
156 have "box a b \<inter> cbox c d = {}" |
|
157 using inter_interval_mixed_eq_empty[of c d a b] and assms(3,5) |
|
158 unfolding assms(1,2) interior_cbox by auto |
|
159 moreover |
|
160 have "box a b \<subseteq> cbox c d \<union> s" |
|
161 apply (rule order_trans,rule box_subset_cbox) |
|
162 using assms(4) unfolding assms(1,2) |
|
163 apply auto |
|
164 done |
|
165 ultimately |
|
166 show ?thesis |
|
167 unfolding assms interior_cbox |
|
168 by auto (metis IntI UnE empty_iff interior_maximal open_box subsetCE subsetI) |
|
169 qed |
|
170 |
|
171 lemma inter_interior_unions_intervals: |
|
172 fixes f::"('a::euclidean_space) set set" |
|
173 assumes "finite f" |
|
174 and "open s" |
|
175 and "\<forall>t\<in>f. \<exists>a b. t = cbox a b" |
|
176 and "\<forall>t\<in>f. s \<inter> (interior t) = {}" |
|
177 shows "s \<inter> interior (\<Union>f) = {}" |
|
178 proof (clarsimp simp only: all_not_in_conv [symmetric]) |
|
179 fix x |
|
180 assume x: "x \<in> s" "x \<in> interior (\<Union>f)" |
|
181 have lem1: "\<And>x e s U. ball x e \<subseteq> s \<inter> interior U \<longleftrightarrow> ball x e \<subseteq> s \<inter> U" |
|
182 using interior_subset |
|
183 by auto (meson Topology_Euclidean_Space.open_ball contra_subsetD interior_maximal mem_ball) |
|
184 have "\<exists>t\<in>f. \<exists>x. \<exists>e>0. ball x e \<subseteq> s \<inter> t" |
|
185 if "finite f" and "\<forall>t\<in>f. \<exists>a b. t = cbox a b" and "\<exists>x. x \<in> s \<inter> interior (\<Union>f)" for f |
|
186 using that |
|
187 proof (induct rule: finite_induct) |
|
188 case empty |
|
189 obtain x where "x \<in> s \<inter> interior (\<Union>{})" |
|
190 using empty(2) .. |
|
191 then have False |
|
192 unfolding Union_empty interior_empty by auto |
|
193 then show ?case by auto |
|
194 next |
|
195 case (insert i f) |
|
196 obtain x where x: "x \<in> s \<inter> interior (\<Union>insert i f)" |
|
197 using insert(5) .. |
|
198 then obtain e where e: "0 < e \<and> ball x e \<subseteq> s \<inter> interior (\<Union>insert i f)" |
|
199 unfolding open_contains_ball_eq[OF open_Int[OF assms(2) open_interior], rule_format] .. |
|
200 obtain a where "\<exists>b. i = cbox a b" |
|
201 using insert(4)[rule_format,OF insertI1] .. |
|
202 then obtain b where ab: "i = cbox a b" .. |
|
203 show ?case |
|
204 proof (cases "x \<in> i") |
|
205 case False |
|
206 then have "x \<in> UNIV - cbox a b" |
|
207 unfolding ab by auto |
|
208 then obtain d where "0 < d \<and> ball x d \<subseteq> UNIV - cbox a b" |
|
209 unfolding open_contains_ball_eq[OF open_Diff[OF open_UNIV closed_cbox],rule_format] .. |
|
210 then have "0 < d" "ball x (min d e) \<subseteq> UNIV - i" |
|
211 unfolding ab ball_min_Int by auto |
|
212 then have "ball x (min d e) \<subseteq> s \<inter> interior (\<Union>f)" |
|
213 using e unfolding lem1 unfolding ball_min_Int by auto |
|
214 then have "x \<in> s \<inter> interior (\<Union>f)" using \<open>d>0\<close> e by auto |
|
215 then have "\<exists>t\<in>f. \<exists>x e. 0 < e \<and> ball x e \<subseteq> s \<inter> t" |
|
216 using insert.hyps(3) insert.prems(1) by blast |
|
217 then show ?thesis by auto |
|
218 next |
|
219 case True show ?thesis |
|
220 proof (cases "x\<in>box a b") |
|
221 case True |
|
222 then obtain d where "0 < d \<and> ball x d \<subseteq> box a b" |
|
223 unfolding open_contains_ball_eq[OF open_box,rule_format] .. |
|
224 then show ?thesis |
|
225 apply (rule_tac x=i in bexI, rule_tac x=x in exI, rule_tac x="min d e" in exI) |
|
226 unfolding ab |
|
227 using box_subset_cbox[of a b] and e |
|
228 apply fastforce+ |
|
229 done |
|
230 next |
|
231 case False |
|
232 then obtain k where "x\<bullet>k \<le> a\<bullet>k \<or> x\<bullet>k \<ge> b\<bullet>k" and k: "k \<in> Basis" |
|
233 unfolding mem_box by (auto simp add: not_less) |
|
234 then have "x\<bullet>k = a\<bullet>k \<or> x\<bullet>k = b\<bullet>k" |
|
235 using True unfolding ab and mem_box |
|
236 apply (erule_tac x = k in ballE) |
|
237 apply auto |
|
238 done |
|
239 then have "\<exists>x. ball x (e/2) \<subseteq> s \<inter> (\<Union>f)" |
|
240 proof (rule disjE) |
|
241 let ?z = "x - (e/2) *\<^sub>R k" |
|
242 assume as: "x\<bullet>k = a\<bullet>k" |
|
243 have "ball ?z (e / 2) \<inter> i = {}" |
|
244 proof (clarsimp simp only: all_not_in_conv [symmetric]) |
|
245 fix y |
|
246 assume "y \<in> ball ?z (e / 2)" and yi: "y \<in> i" |
|
247 then have "dist ?z y < e/2" by auto |
|
248 then have "\<bar>(?z - y) \<bullet> k\<bar> < e/2" |
|
249 using Basis_le_norm[OF k, of "?z - y"] unfolding dist_norm by auto |
|
250 then have "y\<bullet>k < a\<bullet>k" |
|
251 using e k |
|
252 by (auto simp add: field_simps abs_less_iff as inner_simps) |
|
253 then have "y \<notin> i" |
|
254 unfolding ab mem_box by (auto intro!: bexI[OF _ k]) |
|
255 then show False using yi by auto |
|
256 qed |
|
257 moreover |
|
258 have "ball ?z (e/2) \<subseteq> s \<inter> (\<Union>insert i f)" |
|
259 apply (rule order_trans[OF _ e[THEN conjunct2, unfolded lem1]]) |
|
260 proof |
|
261 fix y |
|
262 assume as: "y \<in> ball ?z (e/2)" |
|
263 have "norm (x - y) \<le> \<bar>e\<bar> / 2 + norm (x - y - (e / 2) *\<^sub>R k)" |
|
264 apply (rule order_trans,rule norm_triangle_sub[of "x - y" "(e/2) *\<^sub>R k"]) |
|
265 unfolding norm_scaleR norm_Basis[OF k] |
|
266 apply auto |
|
267 done |
|
268 also have "\<dots> < \<bar>e\<bar> / 2 + \<bar>e\<bar> / 2" |
|
269 apply (rule add_strict_left_mono) |
|
270 using as e |
|
271 apply (auto simp add: field_simps dist_norm) |
|
272 done |
|
273 finally show "y \<in> ball x e" |
|
274 unfolding mem_ball dist_norm using e by (auto simp add:field_simps) |
|
275 qed |
|
276 ultimately show ?thesis |
|
277 apply (rule_tac x="?z" in exI) |
|
278 unfolding Union_insert |
|
279 apply auto |
|
280 done |
|
281 next |
|
282 let ?z = "x + (e/2) *\<^sub>R k" |
|
283 assume as: "x\<bullet>k = b\<bullet>k" |
|
284 have "ball ?z (e / 2) \<inter> i = {}" |
|
285 proof (clarsimp simp only: all_not_in_conv [symmetric]) |
|
286 fix y |
|
287 assume "y \<in> ball ?z (e / 2)" and yi: "y \<in> i" |
|
288 then have "dist ?z y < e/2" |
|
289 by auto |
|
290 then have "\<bar>(?z - y) \<bullet> k\<bar> < e/2" |
|
291 using Basis_le_norm[OF k, of "?z - y"] |
|
292 unfolding dist_norm by auto |
|
293 then have "y\<bullet>k > b\<bullet>k" |
|
294 using e k |
|
295 by (auto simp add:field_simps inner_simps inner_Basis as) |
|
296 then have "y \<notin> i" |
|
297 unfolding ab mem_box by (auto intro!: bexI[OF _ k]) |
|
298 then show False using yi by auto |
|
299 qed |
|
300 moreover |
|
301 have "ball ?z (e/2) \<subseteq> s \<inter> (\<Union>insert i f)" |
|
302 apply (rule order_trans[OF _ e[THEN conjunct2, unfolded lem1]]) |
|
303 proof |
|
304 fix y |
|
305 assume as: "y\<in> ball ?z (e/2)" |
|
306 have "norm (x - y) \<le> \<bar>e\<bar> / 2 + norm (x - y + (e / 2) *\<^sub>R k)" |
|
307 apply (rule order_trans,rule norm_triangle_sub[of "x - y" "- (e/2) *\<^sub>R k"]) |
|
308 unfolding norm_scaleR |
|
309 apply (auto simp: k) |
|
310 done |
|
311 also have "\<dots> < \<bar>e\<bar> / 2 + \<bar>e\<bar> / 2" |
|
312 apply (rule add_strict_left_mono) |
|
313 using as unfolding mem_ball dist_norm |
|
314 using e apply (auto simp add: field_simps) |
|
315 done |
|
316 finally show "y \<in> ball x e" |
|
317 unfolding mem_ball dist_norm using e by (auto simp add:field_simps) |
|
318 qed |
|
319 ultimately show ?thesis |
|
320 apply (rule_tac x="?z" in exI) |
|
321 unfolding Union_insert |
|
322 apply auto |
|
323 done |
|
324 qed |
|
325 then obtain x where "ball x (e / 2) \<subseteq> s \<inter> \<Union>f" .. |
|
326 then have "x \<in> s \<inter> interior (\<Union>f)" |
|
327 unfolding lem1[where U="\<Union>f", symmetric] |
|
328 using centre_in_ball e by auto |
|
329 then show ?thesis |
|
330 using insert.hyps(3) insert.prems(1) by blast |
|
331 qed |
|
332 qed |
|
333 qed |
|
334 from this[OF assms(1,3)] x |
|
335 obtain t x e where "t \<in> f" "0 < e" "ball x e \<subseteq> s \<inter> t" |
|
336 by blast |
|
337 then have "x \<in> s" "x \<in> interior t" |
|
338 using open_subset_interior[OF open_ball, of x e t] |
|
339 by auto |
|
340 then show False |
|
341 using \<open>t \<in> f\<close> assms(4) by auto |
|
342 qed |
|
343 |
|
344 subsection \<open>Bounds on intervals where they exist.\<close> |
|
345 |
|
346 definition interval_upperbound :: "('a::euclidean_space) set \<Rightarrow> 'a" |
|
347 where "interval_upperbound s = (\<Sum>i\<in>Basis. (SUP x:s. x\<bullet>i) *\<^sub>R i)" |
|
348 |
|
349 definition interval_lowerbound :: "('a::euclidean_space) set \<Rightarrow> 'a" |
|
350 where "interval_lowerbound s = (\<Sum>i\<in>Basis. (INF x:s. x\<bullet>i) *\<^sub>R i)" |
|
351 |
|
352 lemma interval_upperbound[simp]: |
|
353 "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow> |
|
354 interval_upperbound (cbox a b) = (b::'a::euclidean_space)" |
|
355 unfolding interval_upperbound_def euclidean_representation_setsum cbox_def |
|
356 by (safe intro!: cSup_eq) auto |
|
357 |
|
358 lemma interval_lowerbound[simp]: |
|
359 "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow> |
|
360 interval_lowerbound (cbox a b) = (a::'a::euclidean_space)" |
|
361 unfolding interval_lowerbound_def euclidean_representation_setsum cbox_def |
|
362 by (safe intro!: cInf_eq) auto |
|
363 |
|
364 lemmas interval_bounds = interval_upperbound interval_lowerbound |
|
365 |
|
366 lemma |
|
367 fixes X::"real set" |
|
368 shows interval_upperbound_real[simp]: "interval_upperbound X = Sup X" |
|
369 and interval_lowerbound_real[simp]: "interval_lowerbound X = Inf X" |
|
370 by (auto simp: interval_upperbound_def interval_lowerbound_def) |
|
371 |
|
372 lemma interval_bounds'[simp]: |
|
373 assumes "cbox a b \<noteq> {}" |
|
374 shows "interval_upperbound (cbox a b) = b" |
|
375 and "interval_lowerbound (cbox a b) = a" |
|
376 using assms unfolding box_ne_empty by auto |
|
377 |
|
378 |
|
379 lemma interval_upperbound_Times: |
|
380 assumes "A \<noteq> {}" and "B \<noteq> {}" |
|
381 shows "interval_upperbound (A \<times> B) = (interval_upperbound A, interval_upperbound B)" |
|
382 proof- |
|
383 from assms have fst_image_times': "A = fst ` (A \<times> B)" by simp |
|
384 have "(\<Sum>i\<in>Basis. (SUP x:A \<times> B. x \<bullet> (i, 0)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (SUP x:A. x \<bullet> i) *\<^sub>R i)" |
|
385 by (subst (2) fst_image_times') (simp del: fst_image_times add: o_def inner_Pair_0) |
|
386 moreover from assms have snd_image_times': "B = snd ` (A \<times> B)" by simp |
|
387 have "(\<Sum>i\<in>Basis. (SUP x:A \<times> B. x \<bullet> (0, i)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (SUP x:B. x \<bullet> i) *\<^sub>R i)" |
|
388 by (subst (2) snd_image_times') (simp del: snd_image_times add: o_def inner_Pair_0) |
|
389 ultimately show ?thesis unfolding interval_upperbound_def |
|
390 by (subst setsum_Basis_prod_eq) (auto simp add: setsum_prod) |
|
391 qed |
|
392 |
|
393 lemma interval_lowerbound_Times: |
|
394 assumes "A \<noteq> {}" and "B \<noteq> {}" |
|
395 shows "interval_lowerbound (A \<times> B) = (interval_lowerbound A, interval_lowerbound B)" |
|
396 proof- |
|
397 from assms have fst_image_times': "A = fst ` (A \<times> B)" by simp |
|
398 have "(\<Sum>i\<in>Basis. (INF x:A \<times> B. x \<bullet> (i, 0)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (INF x:A. x \<bullet> i) *\<^sub>R i)" |
|
399 by (subst (2) fst_image_times') (simp del: fst_image_times add: o_def inner_Pair_0) |
|
400 moreover from assms have snd_image_times': "B = snd ` (A \<times> B)" by simp |
|
401 have "(\<Sum>i\<in>Basis. (INF x:A \<times> B. x \<bullet> (0, i)) *\<^sub>R i) = (\<Sum>i\<in>Basis. (INF x:B. x \<bullet> i) *\<^sub>R i)" |
|
402 by (subst (2) snd_image_times') (simp del: snd_image_times add: o_def inner_Pair_0) |
|
403 ultimately show ?thesis unfolding interval_lowerbound_def |
|
404 by (subst setsum_Basis_prod_eq) (auto simp add: setsum_prod) |
|
405 qed |
|
406 |
|
407 subsection \<open>Content (length, area, volume...) of an interval.\<close> |
|
408 |
|
409 definition "content (s::('a::euclidean_space) set) = |
|
410 (if s = {} then 0 else (\<Prod>i\<in>Basis. (interval_upperbound s)\<bullet>i - (interval_lowerbound s)\<bullet>i))" |
|
411 |
|
412 lemma interval_not_empty: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i \<Longrightarrow> cbox a b \<noteq> {}" |
|
413 unfolding box_eq_empty unfolding not_ex not_less by auto |
|
414 |
|
415 lemma content_cbox: |
|
416 fixes a :: "'a::euclidean_space" |
|
417 assumes "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i" |
|
418 shows "content (cbox a b) = (\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i)" |
|
419 using interval_not_empty[OF assms] |
|
420 unfolding content_def |
|
421 by auto |
|
422 |
|
423 lemma content_cbox': |
|
424 fixes a :: "'a::euclidean_space" |
|
425 assumes "cbox a b \<noteq> {}" |
|
426 shows "content (cbox a b) = (\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i)" |
|
427 using assms box_ne_empty(1) content_cbox by blast |
|
428 |
|
429 lemma content_real: "a \<le> b \<Longrightarrow> content {a..b} = b - a" |
|
430 by (auto simp: interval_upperbound_def interval_lowerbound_def content_def) |
|
431 |
|
432 lemma abs_eq_content: "\<bar>y - x\<bar> = (if x\<le>y then content {x .. y} else content {y..x})" |
|
433 by (auto simp: content_real) |
|
434 |
|
435 lemma content_singleton[simp]: "content {a} = 0" |
|
436 proof - |
|
437 have "content (cbox a a) = 0" |
|
438 by (subst content_cbox) (auto simp: ex_in_conv) |
|
439 then show ?thesis by (simp add: cbox_sing) |
|
440 qed |
|
441 |
|
442 lemma content_unit[iff]: "content(cbox 0 (One::'a::euclidean_space)) = 1" |
|
443 proof - |
|
444 have *: "\<forall>i\<in>Basis. (0::'a)\<bullet>i \<le> (One::'a)\<bullet>i" |
|
445 by auto |
|
446 have "0 \<in> cbox 0 (One::'a)" |
|
447 unfolding mem_box by auto |
|
448 then show ?thesis |
|
449 unfolding content_def interval_bounds[OF *] using setprod.neutral_const by auto |
|
450 qed |
|
451 |
|
452 lemma content_pos_le[intro]: |
|
453 fixes a::"'a::euclidean_space" |
|
454 shows "0 \<le> content (cbox a b)" |
|
455 proof (cases "cbox a b = {}") |
|
456 case False |
|
457 then have *: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i" |
|
458 unfolding box_ne_empty . |
|
459 have "0 \<le> (\<Prod>i\<in>Basis. interval_upperbound (cbox a b) \<bullet> i - interval_lowerbound (cbox a b) \<bullet> i)" |
|
460 apply (rule setprod_nonneg) |
|
461 unfolding interval_bounds[OF *] |
|
462 using * |
|
463 apply auto |
|
464 done |
|
465 also have "\<dots> = content (cbox a b)" using False by (simp add: content_def) |
|
466 finally show ?thesis . |
|
467 qed (simp add: content_def) |
|
468 |
|
469 corollary content_nonneg [simp]: |
|
470 fixes a::"'a::euclidean_space" |
|
471 shows "~ content (cbox a b) < 0" |
|
472 using not_le by blast |
|
473 |
|
474 lemma content_pos_lt: |
|
475 fixes a :: "'a::euclidean_space" |
|
476 assumes "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i" |
|
477 shows "0 < content (cbox a b)" |
|
478 using assms |
|
479 by (auto simp: content_def box_eq_empty intro!: setprod_pos) |
|
480 |
|
481 lemma content_eq_0: |
|
482 "content (cbox a b) = 0 \<longleftrightarrow> (\<exists>i\<in>Basis. b\<bullet>i \<le> a\<bullet>i)" |
|
483 by (auto simp: content_def box_eq_empty intro!: setprod_pos bexI) |
|
484 |
|
485 lemma cond_cases: "(P \<Longrightarrow> Q x) \<Longrightarrow> (\<not> P \<Longrightarrow> Q y) \<Longrightarrow> Q (if P then x else y)" |
|
486 by auto |
|
487 |
|
488 lemma content_cbox_cases: |
|
489 "content (cbox a (b::'a::euclidean_space)) = |
|
490 (if \<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i then setprod (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis else 0)" |
|
491 by (auto simp: not_le content_eq_0 intro: less_imp_le content_cbox) |
|
492 |
|
493 lemma content_eq_0_interior: "content (cbox a b) = 0 \<longleftrightarrow> interior(cbox a b) = {}" |
|
494 unfolding content_eq_0 interior_cbox box_eq_empty |
|
495 by auto |
|
496 |
|
497 lemma content_pos_lt_eq: |
|
498 "0 < content (cbox a (b::'a::euclidean_space)) \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i)" |
|
499 proof (rule iffI) |
|
500 assume "0 < content (cbox a b)" |
|
501 then have "content (cbox a b) \<noteq> 0" by auto |
|
502 then show "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i" |
|
503 unfolding content_eq_0 not_ex not_le by fastforce |
|
504 next |
|
505 assume "\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i" |
|
506 then show "0 < content (cbox a b)" |
|
507 by (metis content_pos_lt) |
|
508 qed |
|
509 |
|
510 lemma content_empty [simp]: "content {} = 0" |
|
511 unfolding content_def by auto |
|
512 |
|
513 lemma content_real_if [simp]: "content {a..b} = (if a \<le> b then b - a else 0)" |
|
514 by (simp add: content_real) |
|
515 |
|
516 lemma content_subset: |
|
517 assumes "cbox a b \<subseteq> cbox c d" |
|
518 shows "content (cbox a b) \<le> content (cbox c d)" |
|
519 proof (cases "cbox a b = {}") |
|
520 case True |
|
521 then show ?thesis |
|
522 using content_pos_le[of c d] by auto |
|
523 next |
|
524 case False |
|
525 then have ab_ne: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i" |
|
526 unfolding box_ne_empty by auto |
|
527 then have ab_ab: "a\<in>cbox a b" "b\<in>cbox a b" |
|
528 unfolding mem_box by auto |
|
529 have "cbox c d \<noteq> {}" using assms False by auto |
|
530 then have cd_ne: "\<forall>i\<in>Basis. c \<bullet> i \<le> d \<bullet> i" |
|
531 using assms unfolding box_ne_empty by auto |
|
532 have "\<And>i. i \<in> Basis \<Longrightarrow> 0 \<le> b \<bullet> i - a \<bullet> i" |
|
533 using ab_ne by auto |
|
534 moreover |
|
535 have "\<And>i. i \<in> Basis \<Longrightarrow> b \<bullet> i - a \<bullet> i \<le> d \<bullet> i - c \<bullet> i" |
|
536 using assms[unfolded subset_eq mem_box,rule_format,OF ab_ab(2)] |
|
537 assms[unfolded subset_eq mem_box,rule_format,OF ab_ab(1)] |
|
538 by (metis diff_mono) |
|
539 ultimately show ?thesis |
|
540 unfolding content_def interval_bounds[OF ab_ne] interval_bounds[OF cd_ne] |
|
541 by (simp add: setprod_mono if_not_P[OF False] if_not_P[OF \<open>cbox c d \<noteq> {}\<close>]) |
|
542 qed |
|
543 |
|
544 lemma content_lt_nz: "0 < content (cbox a b) \<longleftrightarrow> content (cbox a b) \<noteq> 0" |
|
545 unfolding content_pos_lt_eq content_eq_0 unfolding not_ex not_le by fastforce |
|
546 |
|
547 lemma content_times[simp]: "content (A \<times> B) = content A * content B" |
|
548 proof (cases "A \<times> B = {}") |
|
549 let ?ub1 = "interval_upperbound" and ?lb1 = "interval_lowerbound" |
|
550 let ?ub2 = "interval_upperbound" and ?lb2 = "interval_lowerbound" |
|
551 assume nonempty: "A \<times> B \<noteq> {}" |
|
552 hence "content (A \<times> B) = (\<Prod>i\<in>Basis. (?ub1 A, ?ub2 B) \<bullet> i - (?lb1 A, ?lb2 B) \<bullet> i)" |
|
553 unfolding content_def by (simp add: interval_upperbound_Times interval_lowerbound_Times) |
|
554 also have "... = content A * content B" unfolding content_def using nonempty |
|
555 apply (subst Basis_prod_def, subst setprod.union_disjoint, force, force, force, simp) |
|
556 apply (subst (1 2) setprod.reindex, auto intro: inj_onI) |
|
557 done |
|
558 finally show ?thesis . |
|
559 qed (auto simp: content_def) |
|
560 |
|
561 lemma content_Pair: "content (cbox (a,c) (b,d)) = content (cbox a b) * content (cbox c d)" |
|
562 by (simp add: cbox_Pair_eq) |
|
563 |
|
564 lemma content_cbox_pair_eq0_D: |
|
565 "content (cbox (a,c) (b,d)) = 0 \<Longrightarrow> content (cbox a b) = 0 \<or> content (cbox c d) = 0" |
|
566 by (simp add: content_Pair) |
|
567 |
|
568 lemma content_eq_0_gen: |
|
569 fixes s :: "'a::euclidean_space set" |
|
570 assumes "bounded s" |
|
571 shows "content s = 0 \<longleftrightarrow> (\<exists>i\<in>Basis. \<exists>v. \<forall>x \<in> s. x \<bullet> i = v)" (is "_ = ?rhs") |
|
572 proof safe |
|
573 assume "content s = 0" then show ?rhs |
|
574 apply (clarsimp simp: ex_in_conv content_def split: if_split_asm) |
|
575 apply (rule_tac x=a in bexI) |
|
576 apply (rule_tac x="interval_lowerbound s \<bullet> a" in exI) |
|
577 apply (clarsimp simp: interval_upperbound_def interval_lowerbound_def) |
|
578 apply (drule cSUP_eq_cINF_D) |
|
579 apply (auto simp: bounded_inner_imp_bdd_above [OF assms] bounded_inner_imp_bdd_below [OF assms]) |
|
580 done |
|
581 next |
|
582 fix i a |
|
583 assume "i \<in> Basis" "\<forall>x\<in>s. x \<bullet> i = a" |
|
584 then show "content s = 0" |
|
585 apply (clarsimp simp: content_def) |
|
586 apply (rule_tac x=i in bexI) |
|
587 apply (auto simp: interval_upperbound_def interval_lowerbound_def) |
|
588 done |
|
589 qed |
|
590 |
|
591 lemma content_0_subset_gen: |
|
592 fixes a :: "'a::euclidean_space" |
|
593 assumes "content t = 0" "s \<subseteq> t" "bounded t" shows "content s = 0" |
|
594 proof - |
|
595 have "bounded s" |
|
596 using assms by (metis bounded_subset) |
|
597 then show ?thesis |
|
598 using assms |
|
599 by (auto simp: content_eq_0_gen) |
|
600 qed |
|
601 |
|
602 lemma content_0_subset: "\<lbrakk>content(cbox a b) = 0; s \<subseteq> cbox a b\<rbrakk> \<Longrightarrow> content s = 0" |
|
603 by (simp add: content_0_subset_gen bounded_cbox) |
|
604 |
|
605 |
|
606 lemma interval_split: |
|
607 fixes a :: "'a::euclidean_space" |
|
608 assumes "k \<in> Basis" |
|
609 shows |
|
610 "cbox a b \<inter> {x. x\<bullet>k \<le> c} = cbox a (\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) c else b\<bullet>i) *\<^sub>R i)" |
|
611 "cbox a b \<inter> {x. x\<bullet>k \<ge> c} = cbox (\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) c else a\<bullet>i) *\<^sub>R i) b" |
|
612 apply (rule_tac[!] set_eqI) |
|
613 unfolding Int_iff mem_box mem_Collect_eq |
|
614 using assms |
|
615 apply auto |
|
616 done |
|
617 |
|
618 lemma content_split: |
|
619 fixes a :: "'a::euclidean_space" |
|
620 assumes "k \<in> Basis" |
|
621 shows "content (cbox a b) = content(cbox a b \<inter> {x. x\<bullet>k \<le> c}) + content(cbox a b \<inter> {x. x\<bullet>k \<ge> c})" |
|
622 proof cases |
|
623 note simps = interval_split[OF assms] content_cbox_cases |
|
624 have *: "Basis = insert k (Basis - {k})" "\<And>x. finite (Basis-{x})" "\<And>x. x\<notin>Basis-{x}" |
|
625 using assms by auto |
|
626 have *: "\<And>X Y Z. (\<Prod>i\<in>Basis. Z i (if i = k then X else Y i)) = Z k X * (\<Prod>i\<in>Basis-{k}. Z i (Y i))" |
|
627 "(\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i) = (\<Prod>i\<in>Basis-{k}. b\<bullet>i - a\<bullet>i) * (b\<bullet>k - a\<bullet>k)" |
|
628 apply (subst *(1)) |
|
629 defer |
|
630 apply (subst *(1)) |
|
631 unfolding setprod.insert[OF *(2-)] |
|
632 apply auto |
|
633 done |
|
634 assume as: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i" |
|
635 moreover |
|
636 have "\<And>x. min (b \<bullet> k) c = max (a \<bullet> k) c \<Longrightarrow> |
|
637 x * (b\<bullet>k - a\<bullet>k) = x * (max (a \<bullet> k) c - a \<bullet> k) + x * (b \<bullet> k - max (a \<bullet> k) c)" |
|
638 by (auto simp add: field_simps) |
|
639 moreover |
|
640 have **: "(\<Prod>i\<in>Basis. ((\<Sum>i\<in>Basis. (if i = k then min (b \<bullet> k) c else b \<bullet> i) *\<^sub>R i) \<bullet> i - a \<bullet> i)) = |
|
641 (\<Prod>i\<in>Basis. (if i = k then min (b \<bullet> k) c else b \<bullet> i) - a \<bullet> i)" |
|
642 "(\<Prod>i\<in>Basis. b \<bullet> i - ((\<Sum>i\<in>Basis. (if i = k then max (a \<bullet> k) c else a \<bullet> i) *\<^sub>R i) \<bullet> i)) = |
|
643 (\<Prod>i\<in>Basis. b \<bullet> i - (if i = k then max (a \<bullet> k) c else a \<bullet> i))" |
|
644 by (auto intro!: setprod.cong) |
|
645 have "\<not> a \<bullet> k \<le> c \<Longrightarrow> \<not> c \<le> b \<bullet> k \<Longrightarrow> False" |
|
646 unfolding not_le |
|
647 using as[unfolded ,rule_format,of k] assms |
|
648 by auto |
|
649 ultimately show ?thesis |
|
650 using assms |
|
651 unfolding simps ** |
|
652 unfolding *(1)[of "\<lambda>i x. b\<bullet>i - x"] *(1)[of "\<lambda>i x. x - a\<bullet>i"] |
|
653 unfolding *(2) |
|
654 by auto |
|
655 next |
|
656 assume "\<not> (\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i)" |
|
657 then have "cbox a b = {}" |
|
658 unfolding box_eq_empty by (auto simp: not_le) |
|
659 then show ?thesis |
|
660 by (auto simp: not_le) |
|
661 qed |
|
662 |
|
663 subsection \<open>The notion of a gauge --- simply an open set containing the point.\<close> |
|
664 |
|
665 definition "gauge d \<longleftrightarrow> (\<forall>x. x \<in> d x \<and> open (d x))" |
|
666 |
|
667 lemma gaugeI: |
|
668 assumes "\<And>x. x \<in> g x" |
|
669 and "\<And>x. open (g x)" |
|
670 shows "gauge g" |
|
671 using assms unfolding gauge_def by auto |
|
672 |
|
673 lemma gaugeD[dest]: |
|
674 assumes "gauge d" |
|
675 shows "x \<in> d x" |
|
676 and "open (d x)" |
|
677 using assms unfolding gauge_def by auto |
|
678 |
|
679 lemma gauge_ball_dependent: "\<forall>x. 0 < e x \<Longrightarrow> gauge (\<lambda>x. ball x (e x))" |
|
680 unfolding gauge_def by auto |
|
681 |
|
682 lemma gauge_ball[intro]: "0 < e \<Longrightarrow> gauge (\<lambda>x. ball x e)" |
|
683 unfolding gauge_def by auto |
|
684 |
|
685 lemma gauge_trivial[intro!]: "gauge (\<lambda>x. ball x 1)" |
|
686 by (rule gauge_ball) auto |
|
687 |
|
688 lemma gauge_inter[intro]: "gauge d1 \<Longrightarrow> gauge d2 \<Longrightarrow> gauge (\<lambda>x. d1 x \<inter> d2 x)" |
|
689 unfolding gauge_def by auto |
|
690 |
|
691 lemma gauge_inters: |
|
692 assumes "finite s" |
|
693 and "\<forall>d\<in>s. gauge (f d)" |
|
694 shows "gauge (\<lambda>x. \<Inter>{f d x | d. d \<in> s})" |
|
695 proof - |
|
696 have *: "\<And>x. {f d x |d. d \<in> s} = (\<lambda>d. f d x) ` s" |
|
697 by auto |
|
698 show ?thesis |
|
699 unfolding gauge_def unfolding * |
|
700 using assms unfolding Ball_def Inter_iff mem_Collect_eq gauge_def by auto |
|
701 qed |
|
702 |
|
703 lemma gauge_existence_lemma: |
|
704 "(\<forall>x. \<exists>d :: real. p x \<longrightarrow> 0 < d \<and> q d x) \<longleftrightarrow> (\<forall>x. \<exists>d>0. p x \<longrightarrow> q d x)" |
|
705 by (metis zero_less_one) |
|
706 |
|
707 |
|
708 subsection \<open>Divisions.\<close> |
|
709 |
|
710 definition division_of (infixl "division'_of" 40) |
|
711 where |
|
712 "s division_of i \<longleftrightarrow> |
|
713 finite s \<and> |
|
714 (\<forall>k\<in>s. k \<subseteq> i \<and> k \<noteq> {} \<and> (\<exists>a b. k = cbox a b)) \<and> |
|
715 (\<forall>k1\<in>s. \<forall>k2\<in>s. k1 \<noteq> k2 \<longrightarrow> interior(k1) \<inter> interior(k2) = {}) \<and> |
|
716 (\<Union>s = i)" |
|
717 |
|
718 lemma division_ofD[dest]: |
|
719 assumes "s division_of i" |
|
720 shows "finite s" |
|
721 and "\<And>k. k \<in> s \<Longrightarrow> k \<subseteq> i" |
|
722 and "\<And>k. k \<in> s \<Longrightarrow> k \<noteq> {}" |
|
723 and "\<And>k. k \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b" |
|
724 and "\<And>k1 k2. k1 \<in> s \<Longrightarrow> k2 \<in> s \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow> interior(k1) \<inter> interior(k2) = {}" |
|
725 and "\<Union>s = i" |
|
726 using assms unfolding division_of_def by auto |
|
727 |
|
728 lemma division_ofI: |
|
729 assumes "finite s" |
|
730 and "\<And>k. k \<in> s \<Longrightarrow> k \<subseteq> i" |
|
731 and "\<And>k. k \<in> s \<Longrightarrow> k \<noteq> {}" |
|
732 and "\<And>k. k \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b" |
|
733 and "\<And>k1 k2. k1 \<in> s \<Longrightarrow> k2 \<in> s \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow> interior k1 \<inter> interior k2 = {}" |
|
734 and "\<Union>s = i" |
|
735 shows "s division_of i" |
|
736 using assms unfolding division_of_def by auto |
|
737 |
|
738 lemma division_of_finite: "s division_of i \<Longrightarrow> finite s" |
|
739 unfolding division_of_def by auto |
|
740 |
|
741 lemma division_of_self[intro]: "cbox a b \<noteq> {} \<Longrightarrow> {cbox a b} division_of (cbox a b)" |
|
742 unfolding division_of_def by auto |
|
743 |
|
744 lemma division_of_trivial[simp]: "s division_of {} \<longleftrightarrow> s = {}" |
|
745 unfolding division_of_def by auto |
|
746 |
|
747 lemma division_of_sing[simp]: |
|
748 "s division_of cbox a (a::'a::euclidean_space) \<longleftrightarrow> s = {cbox a a}" |
|
749 (is "?l = ?r") |
|
750 proof |
|
751 assume ?r |
|
752 moreover |
|
753 { fix k |
|
754 assume "s = {{a}}" "k\<in>s" |
|
755 then have "\<exists>x y. k = cbox x y" |
|
756 apply (rule_tac x=a in exI)+ |
|
757 apply (force simp: cbox_sing) |
|
758 done |
|
759 } |
|
760 ultimately show ?l |
|
761 unfolding division_of_def cbox_sing by auto |
|
762 next |
|
763 assume ?l |
|
764 note * = conjunctD4[OF this[unfolded division_of_def cbox_sing]] |
|
765 { |
|
766 fix x |
|
767 assume x: "x \<in> s" have "x = {a}" |
|
768 using *(2)[rule_format,OF x] by auto |
|
769 } |
|
770 moreover have "s \<noteq> {}" |
|
771 using *(4) by auto |
|
772 ultimately show ?r |
|
773 unfolding cbox_sing by auto |
|
774 qed |
|
775 |
|
776 lemma elementary_empty: obtains p where "p division_of {}" |
|
777 unfolding division_of_trivial by auto |
|
778 |
|
779 lemma elementary_interval: obtains p where "p division_of (cbox a b)" |
|
780 by (metis division_of_trivial division_of_self) |
|
781 |
|
782 lemma division_contains: "s division_of i \<Longrightarrow> \<forall>x\<in>i. \<exists>k\<in>s. x \<in> k" |
|
783 unfolding division_of_def by auto |
|
784 |
|
785 lemma forall_in_division: |
|
786 "d division_of i \<Longrightarrow> (\<forall>x\<in>d. P x) \<longleftrightarrow> (\<forall>a b. cbox a b \<in> d \<longrightarrow> P (cbox a b))" |
|
787 unfolding division_of_def by fastforce |
|
788 |
|
789 lemma division_of_subset: |
|
790 assumes "p division_of (\<Union>p)" |
|
791 and "q \<subseteq> p" |
|
792 shows "q division_of (\<Union>q)" |
|
793 proof (rule division_ofI) |
|
794 note * = division_ofD[OF assms(1)] |
|
795 show "finite q" |
|
796 using "*"(1) assms(2) infinite_super by auto |
|
797 { |
|
798 fix k |
|
799 assume "k \<in> q" |
|
800 then have kp: "k \<in> p" |
|
801 using assms(2) by auto |
|
802 show "k \<subseteq> \<Union>q" |
|
803 using \<open>k \<in> q\<close> by auto |
|
804 show "\<exists>a b. k = cbox a b" |
|
805 using *(4)[OF kp] by auto |
|
806 show "k \<noteq> {}" |
|
807 using *(3)[OF kp] by auto |
|
808 } |
|
809 fix k1 k2 |
|
810 assume "k1 \<in> q" "k2 \<in> q" "k1 \<noteq> k2" |
|
811 then have **: "k1 \<in> p" "k2 \<in> p" "k1 \<noteq> k2" |
|
812 using assms(2) by auto |
|
813 show "interior k1 \<inter> interior k2 = {}" |
|
814 using *(5)[OF **] by auto |
|
815 qed auto |
|
816 |
|
817 lemma division_of_union_self[intro]: "p division_of s \<Longrightarrow> p division_of (\<Union>p)" |
|
818 unfolding division_of_def by auto |
|
819 |
|
820 lemma division_of_content_0: |
|
821 assumes "content (cbox a b) = 0" "d division_of (cbox a b)" |
|
822 shows "\<forall>k\<in>d. content k = 0" |
|
823 unfolding forall_in_division[OF assms(2)] |
|
824 by (metis antisym_conv assms content_pos_le content_subset division_ofD(2)) |
|
825 |
|
826 lemma division_inter: |
|
827 fixes s1 s2 :: "'a::euclidean_space set" |
|
828 assumes "p1 division_of s1" |
|
829 and "p2 division_of s2" |
|
830 shows "{k1 \<inter> k2 | k1 k2 .k1 \<in> p1 \<and> k2 \<in> p2 \<and> k1 \<inter> k2 \<noteq> {}} division_of (s1 \<inter> s2)" |
|
831 (is "?A' division_of _") |
|
832 proof - |
|
833 let ?A = "{s. s \<in> (\<lambda>(k1,k2). k1 \<inter> k2) ` (p1 \<times> p2) \<and> s \<noteq> {}}" |
|
834 have *: "?A' = ?A" by auto |
|
835 show ?thesis |
|
836 unfolding * |
|
837 proof (rule division_ofI) |
|
838 have "?A \<subseteq> (\<lambda>(x, y). x \<inter> y) ` (p1 \<times> p2)" |
|
839 by auto |
|
840 moreover have "finite (p1 \<times> p2)" |
|
841 using assms unfolding division_of_def by auto |
|
842 ultimately show "finite ?A" by auto |
|
843 have *: "\<And>s. \<Union>{x\<in>s. x \<noteq> {}} = \<Union>s" |
|
844 by auto |
|
845 show "\<Union>?A = s1 \<inter> s2" |
|
846 apply (rule set_eqI) |
|
847 unfolding * and UN_iff |
|
848 using division_ofD(6)[OF assms(1)] and division_ofD(6)[OF assms(2)] |
|
849 apply auto |
|
850 done |
|
851 { |
|
852 fix k |
|
853 assume "k \<in> ?A" |
|
854 then obtain k1 k2 where k: "k = k1 \<inter> k2" "k1 \<in> p1" "k2 \<in> p2" "k \<noteq> {}" |
|
855 by auto |
|
856 then show "k \<noteq> {}" |
|
857 by auto |
|
858 show "k \<subseteq> s1 \<inter> s2" |
|
859 using division_ofD(2)[OF assms(1) k(2)] and division_ofD(2)[OF assms(2) k(3)] |
|
860 unfolding k by auto |
|
861 obtain a1 b1 where k1: "k1 = cbox a1 b1" |
|
862 using division_ofD(4)[OF assms(1) k(2)] by blast |
|
863 obtain a2 b2 where k2: "k2 = cbox a2 b2" |
|
864 using division_ofD(4)[OF assms(2) k(3)] by blast |
|
865 show "\<exists>a b. k = cbox a b" |
|
866 unfolding k k1 k2 unfolding inter_interval by auto |
|
867 } |
|
868 fix k1 k2 |
|
869 assume "k1 \<in> ?A" |
|
870 then obtain x1 y1 where k1: "k1 = x1 \<inter> y1" "x1 \<in> p1" "y1 \<in> p2" "k1 \<noteq> {}" |
|
871 by auto |
|
872 assume "k2 \<in> ?A" |
|
873 then obtain x2 y2 where k2: "k2 = x2 \<inter> y2" "x2 \<in> p1" "y2 \<in> p2" "k2 \<noteq> {}" |
|
874 by auto |
|
875 assume "k1 \<noteq> k2" |
|
876 then have th: "x1 \<noteq> x2 \<or> y1 \<noteq> y2" |
|
877 unfolding k1 k2 by auto |
|
878 have *: "interior x1 \<inter> interior x2 = {} \<or> interior y1 \<inter> interior y2 = {} \<Longrightarrow> |
|
879 interior (x1 \<inter> y1) \<subseteq> interior x1 \<Longrightarrow> interior (x1 \<inter> y1) \<subseteq> interior y1 \<Longrightarrow> |
|
880 interior (x2 \<inter> y2) \<subseteq> interior x2 \<Longrightarrow> interior (x2 \<inter> y2) \<subseteq> interior y2 \<Longrightarrow> |
|
881 interior (x1 \<inter> y1) \<inter> interior (x2 \<inter> y2) = {}" by auto |
|
882 show "interior k1 \<inter> interior k2 = {}" |
|
883 unfolding k1 k2 |
|
884 apply (rule *) |
|
885 using assms division_ofD(5) k1 k2(2) k2(3) th apply auto |
|
886 done |
|
887 qed |
|
888 qed |
|
889 |
|
890 lemma division_inter_1: |
|
891 assumes "d division_of i" |
|
892 and "cbox a (b::'a::euclidean_space) \<subseteq> i" |
|
893 shows "{cbox a b \<inter> k | k. k \<in> d \<and> cbox a b \<inter> k \<noteq> {}} division_of (cbox a b)" |
|
894 proof (cases "cbox a b = {}") |
|
895 case True |
|
896 show ?thesis |
|
897 unfolding True and division_of_trivial by auto |
|
898 next |
|
899 case False |
|
900 have *: "cbox a b \<inter> i = cbox a b" using assms(2) by auto |
|
901 show ?thesis |
|
902 using division_inter[OF division_of_self[OF False] assms(1)] |
|
903 unfolding * by auto |
|
904 qed |
|
905 |
|
906 lemma elementary_inter: |
|
907 fixes s t :: "'a::euclidean_space set" |
|
908 assumes "p1 division_of s" |
|
909 and "p2 division_of t" |
|
910 shows "\<exists>p. p division_of (s \<inter> t)" |
|
911 using assms division_inter by blast |
|
912 |
|
913 lemma elementary_inters: |
|
914 assumes "finite f" |
|
915 and "f \<noteq> {}" |
|
916 and "\<forall>s\<in>f. \<exists>p. p division_of (s::('a::euclidean_space) set)" |
|
917 shows "\<exists>p. p division_of (\<Inter>f)" |
|
918 using assms |
|
919 proof (induct f rule: finite_induct) |
|
920 case (insert x f) |
|
921 show ?case |
|
922 proof (cases "f = {}") |
|
923 case True |
|
924 then show ?thesis |
|
925 unfolding True using insert by auto |
|
926 next |
|
927 case False |
|
928 obtain p where "p division_of \<Inter>f" |
|
929 using insert(3)[OF False insert(5)[unfolded ball_simps,THEN conjunct2]] .. |
|
930 moreover obtain px where "px division_of x" |
|
931 using insert(5)[rule_format,OF insertI1] .. |
|
932 ultimately show ?thesis |
|
933 by (simp add: elementary_inter Inter_insert) |
|
934 qed |
|
935 qed auto |
|
936 |
|
937 lemma division_disjoint_union: |
|
938 assumes "p1 division_of s1" |
|
939 and "p2 division_of s2" |
|
940 and "interior s1 \<inter> interior s2 = {}" |
|
941 shows "(p1 \<union> p2) division_of (s1 \<union> s2)" |
|
942 proof (rule division_ofI) |
|
943 note d1 = division_ofD[OF assms(1)] |
|
944 note d2 = division_ofD[OF assms(2)] |
|
945 show "finite (p1 \<union> p2)" |
|
946 using d1(1) d2(1) by auto |
|
947 show "\<Union>(p1 \<union> p2) = s1 \<union> s2" |
|
948 using d1(6) d2(6) by auto |
|
949 { |
|
950 fix k1 k2 |
|
951 assume as: "k1 \<in> p1 \<union> p2" "k2 \<in> p1 \<union> p2" "k1 \<noteq> k2" |
|
952 moreover |
|
953 let ?g="interior k1 \<inter> interior k2 = {}" |
|
954 { |
|
955 assume as: "k1\<in>p1" "k2\<in>p2" |
|
956 have ?g |
|
957 using interior_mono[OF d1(2)[OF as(1)]] interior_mono[OF d2(2)[OF as(2)]] |
|
958 using assms(3) by blast |
|
959 } |
|
960 moreover |
|
961 { |
|
962 assume as: "k1\<in>p2" "k2\<in>p1" |
|
963 have ?g |
|
964 using interior_mono[OF d1(2)[OF as(2)]] interior_mono[OF d2(2)[OF as(1)]] |
|
965 using assms(3) by blast |
|
966 } |
|
967 ultimately show ?g |
|
968 using d1(5)[OF _ _ as(3)] and d2(5)[OF _ _ as(3)] by auto |
|
969 } |
|
970 fix k |
|
971 assume k: "k \<in> p1 \<union> p2" |
|
972 show "k \<subseteq> s1 \<union> s2" |
|
973 using k d1(2) d2(2) by auto |
|
974 show "k \<noteq> {}" |
|
975 using k d1(3) d2(3) by auto |
|
976 show "\<exists>a b. k = cbox a b" |
|
977 using k d1(4) d2(4) by auto |
|
978 qed |
|
979 |
|
980 lemma partial_division_extend_1: |
|
981 fixes a b c d :: "'a::euclidean_space" |
|
982 assumes incl: "cbox c d \<subseteq> cbox a b" |
|
983 and nonempty: "cbox c d \<noteq> {}" |
|
984 obtains p where "p division_of (cbox a b)" "cbox c d \<in> p" |
|
985 proof |
|
986 let ?B = "\<lambda>f::'a\<Rightarrow>'a \<times> 'a. |
|
987 cbox (\<Sum>i\<in>Basis. (fst (f i) \<bullet> i) *\<^sub>R i) (\<Sum>i\<in>Basis. (snd (f i) \<bullet> i) *\<^sub>R i)" |
|
988 define p where "p = ?B ` (Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)})" |
|
989 |
|
990 show "cbox c d \<in> p" |
|
991 unfolding p_def |
|
992 by (auto simp add: box_eq_empty cbox_def intro!: image_eqI[where x="\<lambda>(i::'a)\<in>Basis. (c, d)"]) |
|
993 { |
|
994 fix i :: 'a |
|
995 assume "i \<in> Basis" |
|
996 with incl nonempty have "a \<bullet> i \<le> c \<bullet> i" "c \<bullet> i \<le> d \<bullet> i" "d \<bullet> i \<le> b \<bullet> i" |
|
997 unfolding box_eq_empty subset_box by (auto simp: not_le) |
|
998 } |
|
999 note ord = this |
|
1000 |
|
1001 show "p division_of (cbox a b)" |
|
1002 proof (rule division_ofI) |
|
1003 show "finite p" |
|
1004 unfolding p_def by (auto intro!: finite_PiE) |
|
1005 { |
|
1006 fix k |
|
1007 assume "k \<in> p" |
|
1008 then obtain f where f: "f \<in> Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)}" and k: "k = ?B f" |
|
1009 by (auto simp: p_def) |
|
1010 then show "\<exists>a b. k = cbox a b" |
|
1011 by auto |
|
1012 have "k \<subseteq> cbox a b \<and> k \<noteq> {}" |
|
1013 proof (simp add: k box_eq_empty subset_box not_less, safe) |
|
1014 fix i :: 'a |
|
1015 assume i: "i \<in> Basis" |
|
1016 with f have "f i = (a, c) \<or> f i = (c, d) \<or> f i = (d, b)" |
|
1017 by (auto simp: PiE_iff) |
|
1018 with i ord[of i] |
|
1019 show "a \<bullet> i \<le> fst (f i) \<bullet> i" "snd (f i) \<bullet> i \<le> b \<bullet> i" "fst (f i) \<bullet> i \<le> snd (f i) \<bullet> i" |
|
1020 by auto |
|
1021 qed |
|
1022 then show "k \<noteq> {}" "k \<subseteq> cbox a b" |
|
1023 by auto |
|
1024 { |
|
1025 fix l |
|
1026 assume "l \<in> p" |
|
1027 then obtain g where g: "g \<in> Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)}" and l: "l = ?B g" |
|
1028 by (auto simp: p_def) |
|
1029 assume "l \<noteq> k" |
|
1030 have "\<exists>i\<in>Basis. f i \<noteq> g i" |
|
1031 proof (rule ccontr) |
|
1032 assume "\<not> ?thesis" |
|
1033 with f g have "f = g" |
|
1034 by (auto simp: PiE_iff extensional_def intro!: ext) |
|
1035 with \<open>l \<noteq> k\<close> show False |
|
1036 by (simp add: l k) |
|
1037 qed |
|
1038 then obtain i where *: "i \<in> Basis" "f i \<noteq> g i" .. |
|
1039 then have "f i = (a, c) \<or> f i = (c, d) \<or> f i = (d, b)" |
|
1040 "g i = (a, c) \<or> g i = (c, d) \<or> g i = (d, b)" |
|
1041 using f g by (auto simp: PiE_iff) |
|
1042 with * ord[of i] show "interior l \<inter> interior k = {}" |
|
1043 by (auto simp add: l k interior_cbox disjoint_interval intro!: bexI[of _ i]) |
|
1044 } |
|
1045 note \<open>k \<subseteq> cbox a b\<close> |
|
1046 } |
|
1047 moreover |
|
1048 { |
|
1049 fix x assume x: "x \<in> cbox a b" |
|
1050 have "\<forall>i\<in>Basis. \<exists>l. x \<bullet> i \<in> {fst l \<bullet> i .. snd l \<bullet> i} \<and> l \<in> {(a, c), (c, d), (d, b)}" |
|
1051 proof |
|
1052 fix i :: 'a |
|
1053 assume "i \<in> Basis" |
|
1054 with x ord[of i] |
|
1055 have "(a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> c \<bullet> i) \<or> (c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i) \<or> |
|
1056 (d \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i)" |
|
1057 by (auto simp: cbox_def) |
|
1058 then show "\<exists>l. x \<bullet> i \<in> {fst l \<bullet> i .. snd l \<bullet> i} \<and> l \<in> {(a, c), (c, d), (d, b)}" |
|
1059 by auto |
|
1060 qed |
|
1061 then obtain f where |
|
1062 f: "\<forall>i\<in>Basis. x \<bullet> i \<in> {fst (f i) \<bullet> i..snd (f i) \<bullet> i} \<and> f i \<in> {(a, c), (c, d), (d, b)}" |
|
1063 unfolding bchoice_iff .. |
|
1064 moreover from f have "restrict f Basis \<in> Basis \<rightarrow>\<^sub>E {(a, c), (c, d), (d, b)}" |
|
1065 by auto |
|
1066 moreover from f have "x \<in> ?B (restrict f Basis)" |
|
1067 by (auto simp: mem_box) |
|
1068 ultimately have "\<exists>k\<in>p. x \<in> k" |
|
1069 unfolding p_def by blast |
|
1070 } |
|
1071 ultimately show "\<Union>p = cbox a b" |
|
1072 by auto |
|
1073 qed |
|
1074 qed |
|
1075 |
|
1076 lemma partial_division_extend_interval: |
|
1077 assumes "p division_of (\<Union>p)" "(\<Union>p) \<subseteq> cbox a b" |
|
1078 obtains q where "p \<subseteq> q" "q division_of cbox a (b::'a::euclidean_space)" |
|
1079 proof (cases "p = {}") |
|
1080 case True |
|
1081 obtain q where "q division_of (cbox a b)" |
|
1082 by (rule elementary_interval) |
|
1083 then show ?thesis |
|
1084 using True that by blast |
|
1085 next |
|
1086 case False |
|
1087 note p = division_ofD[OF assms(1)] |
|
1088 have div_cbox: "\<forall>k\<in>p. \<exists>q. q division_of cbox a b \<and> k \<in> q" |
|
1089 proof |
|
1090 fix k |
|
1091 assume kp: "k \<in> p" |
|
1092 obtain c d where k: "k = cbox c d" |
|
1093 using p(4)[OF kp] by blast |
|
1094 have *: "cbox c d \<subseteq> cbox a b" "cbox c d \<noteq> {}" |
|
1095 using p(2,3)[OF kp, unfolded k] using assms(2) |
|
1096 by (blast intro: order.trans)+ |
|
1097 obtain q where "q division_of cbox a b" "cbox c d \<in> q" |
|
1098 by (rule partial_division_extend_1[OF *]) |
|
1099 then show "\<exists>q. q division_of cbox a b \<and> k \<in> q" |
|
1100 unfolding k by auto |
|
1101 qed |
|
1102 obtain q where q: "\<And>x. x \<in> p \<Longrightarrow> q x division_of cbox a b" "\<And>x. x \<in> p \<Longrightarrow> x \<in> q x" |
|
1103 using bchoice[OF div_cbox] by blast |
|
1104 { fix x |
|
1105 assume x: "x \<in> p" |
|
1106 have "q x division_of \<Union>q x" |
|
1107 apply (rule division_ofI) |
|
1108 using division_ofD[OF q(1)[OF x]] |
|
1109 apply auto |
|
1110 done } |
|
1111 then have "\<And>x. x \<in> p \<Longrightarrow> \<exists>d. d division_of \<Union>(q x - {x})" |
|
1112 by (meson Diff_subset division_of_subset) |
|
1113 then have "\<exists>d. d division_of \<Inter>((\<lambda>i. \<Union>(q i - {i})) ` p)" |
|
1114 apply - |
|
1115 apply (rule elementary_inters [OF finite_imageI[OF p(1)]]) |
|
1116 apply (auto simp: False elementary_inters [OF finite_imageI[OF p(1)]]) |
|
1117 done |
|
1118 then obtain d where d: "d division_of \<Inter>((\<lambda>i. \<Union>(q i - {i})) ` p)" .. |
|
1119 have "d \<union> p division_of cbox a b" |
|
1120 proof - |
|
1121 have te: "\<And>s f t. s \<noteq> {} \<Longrightarrow> \<forall>i\<in>s. f i \<union> i = t \<Longrightarrow> t = \<Inter>(f ` s) \<union> \<Union>s" by auto |
|
1122 have cbox_eq: "cbox a b = \<Inter>((\<lambda>i. \<Union>(q i - {i})) ` p) \<union> \<Union>p" |
|
1123 proof (rule te[OF False], clarify) |
|
1124 fix i |
|
1125 assume i: "i \<in> p" |
|
1126 show "\<Union>(q i - {i}) \<union> i = cbox a b" |
|
1127 using division_ofD(6)[OF q(1)[OF i]] using q(2)[OF i] by auto |
|
1128 qed |
|
1129 { fix k |
|
1130 assume k: "k \<in> p" |
|
1131 have *: "\<And>u t s. t \<inter> s = {} \<Longrightarrow> u \<subseteq> s \<Longrightarrow> u \<inter> t = {}" |
|
1132 by auto |
|
1133 have "interior (\<Inter>i\<in>p. \<Union>(q i - {i})) \<inter> interior k = {}" |
|
1134 proof (rule *[OF inter_interior_unions_intervals]) |
|
1135 note qk=division_ofD[OF q(1)[OF k]] |
|
1136 show "finite (q k - {k})" "open (interior k)" "\<forall>t\<in>q k - {k}. \<exists>a b. t = cbox a b" |
|
1137 using qk by auto |
|
1138 show "\<forall>t\<in>q k - {k}. interior k \<inter> interior t = {}" |
|
1139 using qk(5) using q(2)[OF k] by auto |
|
1140 show "interior (\<Inter>i\<in>p. \<Union>(q i - {i})) \<subseteq> interior (\<Union>(q k - {k}))" |
|
1141 apply (rule interior_mono)+ |
|
1142 using k |
|
1143 apply auto |
|
1144 done |
|
1145 qed } note [simp] = this |
|
1146 show "d \<union> p division_of (cbox a b)" |
|
1147 unfolding cbox_eq |
|
1148 apply (rule division_disjoint_union[OF d assms(1)]) |
|
1149 apply (rule inter_interior_unions_intervals) |
|
1150 apply (rule p open_interior ballI)+ |
|
1151 apply simp_all |
|
1152 done |
|
1153 qed |
|
1154 then show ?thesis |
|
1155 by (meson Un_upper2 that) |
|
1156 qed |
|
1157 |
|
1158 lemma elementary_bounded[dest]: |
|
1159 fixes s :: "'a::euclidean_space set" |
|
1160 shows "p division_of s \<Longrightarrow> bounded s" |
|
1161 unfolding division_of_def by (metis bounded_Union bounded_cbox) |
|
1162 |
|
1163 lemma elementary_subset_cbox: |
|
1164 "p division_of s \<Longrightarrow> \<exists>a b. s \<subseteq> cbox a (b::'a::euclidean_space)" |
|
1165 by (meson elementary_bounded bounded_subset_cbox) |
|
1166 |
|
1167 lemma division_union_intervals_exists: |
|
1168 fixes a b :: "'a::euclidean_space" |
|
1169 assumes "cbox a b \<noteq> {}" |
|
1170 obtains p where "(insert (cbox a b) p) division_of (cbox a b \<union> cbox c d)" |
|
1171 proof (cases "cbox c d = {}") |
|
1172 case True |
|
1173 show ?thesis |
|
1174 apply (rule that[of "{}"]) |
|
1175 unfolding True |
|
1176 using assms |
|
1177 apply auto |
|
1178 done |
|
1179 next |
|
1180 case False |
|
1181 show ?thesis |
|
1182 proof (cases "cbox a b \<inter> cbox c d = {}") |
|
1183 case True |
|
1184 then show ?thesis |
|
1185 by (metis that False assms division_disjoint_union division_of_self insert_is_Un interior_Int interior_empty) |
|
1186 next |
|
1187 case False |
|
1188 obtain u v where uv: "cbox a b \<inter> cbox c d = cbox u v" |
|
1189 unfolding inter_interval by auto |
|
1190 have uv_sub: "cbox u v \<subseteq> cbox c d" using uv by auto |
|
1191 obtain p where "p division_of cbox c d" "cbox u v \<in> p" |
|
1192 by (rule partial_division_extend_1[OF uv_sub False[unfolded uv]]) |
|
1193 note p = this division_ofD[OF this(1)] |
|
1194 have "interior (cbox a b \<inter> \<Union>(p - {cbox u v})) = interior(cbox u v \<inter> \<Union>(p - {cbox u v}))" |
|
1195 apply (rule arg_cong[of _ _ interior]) |
|
1196 using p(8) uv by auto |
|
1197 also have "\<dots> = {}" |
|
1198 unfolding interior_Int |
|
1199 apply (rule inter_interior_unions_intervals) |
|
1200 using p(6) p(7)[OF p(2)] p(3) |
|
1201 apply auto |
|
1202 done |
|
1203 finally have [simp]: "interior (cbox a b) \<inter> interior (\<Union>(p - {cbox u v})) = {}" by simp |
|
1204 have cbe: "cbox a b \<union> cbox c d = cbox a b \<union> \<Union>(p - {cbox u v})" |
|
1205 using p(8) unfolding uv[symmetric] by auto |
|
1206 have "insert (cbox a b) (p - {cbox u v}) division_of cbox a b \<union> \<Union>(p - {cbox u v})" |
|
1207 proof - |
|
1208 have "{cbox a b} division_of cbox a b" |
|
1209 by (simp add: assms division_of_self) |
|
1210 then show "insert (cbox a b) (p - {cbox u v}) division_of cbox a b \<union> \<Union>(p - {cbox u v})" |
|
1211 by (metis (no_types) Diff_subset \<open>interior (cbox a b) \<inter> interior (\<Union>(p - {cbox u v})) = {}\<close> division_disjoint_union division_of_subset insert_is_Un p(1) p(8)) |
|
1212 qed |
|
1213 with that[of "p - {cbox u v}"] show ?thesis by (simp add: cbe) |
|
1214 qed |
|
1215 qed |
|
1216 |
|
1217 lemma division_of_unions: |
|
1218 assumes "finite f" |
|
1219 and "\<And>p. p \<in> f \<Longrightarrow> p division_of (\<Union>p)" |
|
1220 and "\<And>k1 k2. k1 \<in> \<Union>f \<Longrightarrow> k2 \<in> \<Union>f \<Longrightarrow> k1 \<noteq> k2 \<Longrightarrow> interior k1 \<inter> interior k2 = {}" |
|
1221 shows "\<Union>f division_of \<Union>\<Union>f" |
|
1222 using assms |
|
1223 by (auto intro!: division_ofI) |
|
1224 |
|
1225 lemma elementary_union_interval: |
|
1226 fixes a b :: "'a::euclidean_space" |
|
1227 assumes "p division_of \<Union>p" |
|
1228 obtains q where "q division_of (cbox a b \<union> \<Union>p)" |
|
1229 proof - |
|
1230 note assm = division_ofD[OF assms] |
|
1231 have lem1: "\<And>f s. \<Union>\<Union>(f ` s) = \<Union>((\<lambda>x. \<Union>(f x)) ` s)" |
|
1232 by auto |
|
1233 have lem2: "\<And>f s. f \<noteq> {} \<Longrightarrow> \<Union>{s \<union> t |t. t \<in> f} = s \<union> \<Union>f" |
|
1234 by auto |
|
1235 { |
|
1236 presume "p = {} \<Longrightarrow> thesis" |
|
1237 "cbox a b = {} \<Longrightarrow> thesis" |
|
1238 "cbox a b \<noteq> {} \<Longrightarrow> interior (cbox a b) = {} \<Longrightarrow> thesis" |
|
1239 "p \<noteq> {} \<Longrightarrow> interior (cbox a b)\<noteq>{} \<Longrightarrow> cbox a b \<noteq> {} \<Longrightarrow> thesis" |
|
1240 then show thesis by auto |
|
1241 next |
|
1242 assume as: "p = {}" |
|
1243 obtain p where "p division_of (cbox a b)" |
|
1244 by (rule elementary_interval) |
|
1245 then show thesis |
|
1246 using as that by auto |
|
1247 next |
|
1248 assume as: "cbox a b = {}" |
|
1249 show thesis |
|
1250 using as assms that by auto |
|
1251 next |
|
1252 assume as: "interior (cbox a b) = {}" "cbox a b \<noteq> {}" |
|
1253 show thesis |
|
1254 apply (rule that[of "insert (cbox a b) p"],rule division_ofI) |
|
1255 unfolding finite_insert |
|
1256 apply (rule assm(1)) unfolding Union_insert |
|
1257 using assm(2-4) as |
|
1258 apply - |
|
1259 apply (fast dest: assm(5))+ |
|
1260 done |
|
1261 next |
|
1262 assume as: "p \<noteq> {}" "interior (cbox a b) \<noteq> {}" "cbox a b \<noteq> {}" |
|
1263 have "\<forall>k\<in>p. \<exists>q. (insert (cbox a b) q) division_of (cbox a b \<union> k)" |
|
1264 proof |
|
1265 fix k |
|
1266 assume kp: "k \<in> p" |
|
1267 from assm(4)[OF kp] obtain c d where "k = cbox c d" by blast |
|
1268 then show "\<exists>q. (insert (cbox a b) q) division_of (cbox a b \<union> k)" |
|
1269 by (meson as(3) division_union_intervals_exists) |
|
1270 qed |
|
1271 from bchoice[OF this] obtain q where "\<forall>x\<in>p. insert (cbox a b) (q x) division_of (cbox a b) \<union> x" .. |
|
1272 note q = division_ofD[OF this[rule_format]] |
|
1273 let ?D = "\<Union>{insert (cbox a b) (q k) | k. k \<in> p}" |
|
1274 show thesis |
|
1275 proof (rule that[OF division_ofI]) |
|
1276 have *: "{insert (cbox a b) (q k) |k. k \<in> p} = (\<lambda>k. insert (cbox a b) (q k)) ` p" |
|
1277 by auto |
|
1278 show "finite ?D" |
|
1279 using "*" assm(1) q(1) by auto |
|
1280 show "\<Union>?D = cbox a b \<union> \<Union>p" |
|
1281 unfolding * lem1 |
|
1282 unfolding lem2[OF as(1), of "cbox a b", symmetric] |
|
1283 using q(6) |
|
1284 by auto |
|
1285 fix k |
|
1286 assume k: "k \<in> ?D" |
|
1287 then show "k \<subseteq> cbox a b \<union> \<Union>p" |
|
1288 using q(2) by auto |
|
1289 show "k \<noteq> {}" |
|
1290 using q(3) k by auto |
|
1291 show "\<exists>a b. k = cbox a b" |
|
1292 using q(4) k by auto |
|
1293 fix k' |
|
1294 assume k': "k' \<in> ?D" "k \<noteq> k'" |
|
1295 obtain x where x: "k \<in> insert (cbox a b) (q x)" "x\<in>p" |
|
1296 using k by auto |
|
1297 obtain x' where x': "k'\<in>insert (cbox a b) (q x')" "x'\<in>p" |
|
1298 using k' by auto |
|
1299 show "interior k \<inter> interior k' = {}" |
|
1300 proof (cases "x = x'") |
|
1301 case True |
|
1302 show ?thesis |
|
1303 using True k' q(5) x' x by auto |
|
1304 next |
|
1305 case False |
|
1306 { |
|
1307 presume "k = cbox a b \<Longrightarrow> ?thesis" |
|
1308 and "k' = cbox a b \<Longrightarrow> ?thesis" |
|
1309 and "k \<noteq> cbox a b \<Longrightarrow> k' \<noteq> cbox a b \<Longrightarrow> ?thesis" |
|
1310 then show ?thesis by linarith |
|
1311 next |
|
1312 assume as': "k = cbox a b" |
|
1313 show ?thesis |
|
1314 using as' k' q(5) x' by blast |
|
1315 next |
|
1316 assume as': "k' = cbox a b" |
|
1317 show ?thesis |
|
1318 using as' k'(2) q(5) x by blast |
|
1319 } |
|
1320 assume as': "k \<noteq> cbox a b" "k' \<noteq> cbox a b" |
|
1321 obtain c d where k: "k = cbox c d" |
|
1322 using q(4)[OF x(2,1)] by blast |
|
1323 have "interior k \<inter> interior (cbox a b) = {}" |
|
1324 using as' k'(2) q(5) x by blast |
|
1325 then have "interior k \<subseteq> interior x" |
|
1326 using interior_subset_union_intervals |
|
1327 by (metis as(2) k q(2) x interior_subset_union_intervals) |
|
1328 moreover |
|
1329 obtain c d where c_d: "k' = cbox c d" |
|
1330 using q(4)[OF x'(2,1)] by blast |
|
1331 have "interior k' \<inter> interior (cbox a b) = {}" |
|
1332 using as'(2) q(5) x' by blast |
|
1333 then have "interior k' \<subseteq> interior x'" |
|
1334 by (metis as(2) c_d interior_subset_union_intervals q(2) x'(1) x'(2)) |
|
1335 ultimately show ?thesis |
|
1336 using assm(5)[OF x(2) x'(2) False] by auto |
|
1337 qed |
|
1338 qed |
|
1339 } |
|
1340 qed |
|
1341 |
|
1342 lemma elementary_unions_intervals: |
|
1343 assumes fin: "finite f" |
|
1344 and "\<And>s. s \<in> f \<Longrightarrow> \<exists>a b. s = cbox a (b::'a::euclidean_space)" |
|
1345 obtains p where "p division_of (\<Union>f)" |
|
1346 proof - |
|
1347 have "\<exists>p. p division_of (\<Union>f)" |
|
1348 proof (induct_tac f rule:finite_subset_induct) |
|
1349 show "\<exists>p. p division_of \<Union>{}" using elementary_empty by auto |
|
1350 next |
|
1351 fix x F |
|
1352 assume as: "finite F" "x \<notin> F" "\<exists>p. p division_of \<Union>F" "x\<in>f" |
|
1353 from this(3) obtain p where p: "p division_of \<Union>F" .. |
|
1354 from assms(2)[OF as(4)] obtain a b where x: "x = cbox a b" by blast |
|
1355 have *: "\<Union>F = \<Union>p" |
|
1356 using division_ofD[OF p] by auto |
|
1357 show "\<exists>p. p division_of \<Union>insert x F" |
|
1358 using elementary_union_interval[OF p[unfolded *], of a b] |
|
1359 unfolding Union_insert x * by metis |
|
1360 qed (insert assms, auto) |
|
1361 then show ?thesis |
|
1362 using that by auto |
|
1363 qed |
|
1364 |
|
1365 lemma elementary_union: |
|
1366 fixes s t :: "'a::euclidean_space set" |
|
1367 assumes "ps division_of s" "pt division_of t" |
|
1368 obtains p where "p division_of (s \<union> t)" |
|
1369 proof - |
|
1370 have *: "s \<union> t = \<Union>ps \<union> \<Union>pt" |
|
1371 using assms unfolding division_of_def by auto |
|
1372 show ?thesis |
|
1373 apply (rule elementary_unions_intervals[of "ps \<union> pt"]) |
|
1374 using assms apply auto |
|
1375 by (simp add: * that) |
|
1376 qed |
|
1377 |
|
1378 lemma partial_division_extend: |
|
1379 fixes t :: "'a::euclidean_space set" |
|
1380 assumes "p division_of s" |
|
1381 and "q division_of t" |
|
1382 and "s \<subseteq> t" |
|
1383 obtains r where "p \<subseteq> r" and "r division_of t" |
|
1384 proof - |
|
1385 note divp = division_ofD[OF assms(1)] and divq = division_ofD[OF assms(2)] |
|
1386 obtain a b where ab: "t \<subseteq> cbox a b" |
|
1387 using elementary_subset_cbox[OF assms(2)] by auto |
|
1388 obtain r1 where "p \<subseteq> r1" "r1 division_of (cbox a b)" |
|
1389 using assms |
|
1390 by (metis ab dual_order.trans partial_division_extend_interval divp(6)) |
|
1391 note r1 = this division_ofD[OF this(2)] |
|
1392 obtain p' where "p' division_of \<Union>(r1 - p)" |
|
1393 apply (rule elementary_unions_intervals[of "r1 - p"]) |
|
1394 using r1(3,6) |
|
1395 apply auto |
|
1396 done |
|
1397 then obtain r2 where r2: "r2 division_of (\<Union>(r1 - p)) \<inter> (\<Union>q)" |
|
1398 by (metis assms(2) divq(6) elementary_inter) |
|
1399 { |
|
1400 fix x |
|
1401 assume x: "x \<in> t" "x \<notin> s" |
|
1402 then have "x\<in>\<Union>r1" |
|
1403 unfolding r1 using ab by auto |
|
1404 then obtain r where r: "r \<in> r1" "x \<in> r" |
|
1405 unfolding Union_iff .. |
|
1406 moreover |
|
1407 have "r \<notin> p" |
|
1408 proof |
|
1409 assume "r \<in> p" |
|
1410 then have "x \<in> s" using divp(2) r by auto |
|
1411 then show False using x by auto |
|
1412 qed |
|
1413 ultimately have "x\<in>\<Union>(r1 - p)" by auto |
|
1414 } |
|
1415 then have *: "t = \<Union>p \<union> (\<Union>(r1 - p) \<inter> \<Union>q)" |
|
1416 unfolding divp divq using assms(3) by auto |
|
1417 show ?thesis |
|
1418 apply (rule that[of "p \<union> r2"]) |
|
1419 unfolding * |
|
1420 defer |
|
1421 apply (rule division_disjoint_union) |
|
1422 unfolding divp(6) |
|
1423 apply(rule assms r2)+ |
|
1424 proof - |
|
1425 have "interior s \<inter> interior (\<Union>(r1-p)) = {}" |
|
1426 proof (rule inter_interior_unions_intervals) |
|
1427 show "finite (r1 - p)" and "open (interior s)" and "\<forall>t\<in>r1-p. \<exists>a b. t = cbox a b" |
|
1428 using r1 by auto |
|
1429 have *: "\<And>s. (\<And>x. x \<in> s \<Longrightarrow> False) \<Longrightarrow> s = {}" |
|
1430 by auto |
|
1431 show "\<forall>t\<in>r1-p. interior s \<inter> interior t = {}" |
|
1432 proof |
|
1433 fix m x |
|
1434 assume as: "m \<in> r1 - p" |
|
1435 have "interior m \<inter> interior (\<Union>p) = {}" |
|
1436 proof (rule inter_interior_unions_intervals) |
|
1437 show "finite p" and "open (interior m)" and "\<forall>t\<in>p. \<exists>a b. t = cbox a b" |
|
1438 using divp by auto |
|
1439 show "\<forall>t\<in>p. interior m \<inter> interior t = {}" |
|
1440 by (metis DiffD1 DiffD2 as r1(1) r1(7) set_rev_mp) |
|
1441 qed |
|
1442 then show "interior s \<inter> interior m = {}" |
|
1443 unfolding divp by auto |
|
1444 qed |
|
1445 qed |
|
1446 then show "interior s \<inter> interior (\<Union>(r1-p) \<inter> (\<Union>q)) = {}" |
|
1447 using interior_subset by auto |
|
1448 qed auto |
|
1449 qed |
|
1450 |
|
1451 lemma division_split_left_inj: |
|
1452 fixes type :: "'a::euclidean_space" |
|
1453 assumes "d division_of i" |
|
1454 and "k1 \<in> d" |
|
1455 and "k2 \<in> d" |
|
1456 and "k1 \<noteq> k2" |
|
1457 and "k1 \<inter> {x::'a. x\<bullet>k \<le> c} = k2 \<inter> {x. x\<bullet>k \<le> c}" |
|
1458 and k: "k\<in>Basis" |
|
1459 shows "content(k1 \<inter> {x. x\<bullet>k \<le> c}) = 0" |
|
1460 proof - |
|
1461 note d=division_ofD[OF assms(1)] |
|
1462 have *: "\<And>(a::'a) b c. content (cbox a b \<inter> {x. x\<bullet>k \<le> c}) = 0 \<longleftrightarrow> |
|
1463 interior(cbox a b \<inter> {x. x\<bullet>k \<le> c}) = {}" |
|
1464 unfolding interval_split[OF k] content_eq_0_interior by auto |
|
1465 guess u1 v1 using d(4)[OF assms(2)] by (elim exE) note uv1=this |
|
1466 guess u2 v2 using d(4)[OF assms(3)] by (elim exE) note uv2=this |
|
1467 have **: "\<And>s t u. s \<inter> t = {} \<Longrightarrow> u \<subseteq> s \<Longrightarrow> u \<subseteq> t \<Longrightarrow> u = {}" |
|
1468 by auto |
|
1469 show ?thesis |
|
1470 unfolding uv1 uv2 * |
|
1471 apply (rule **[OF d(5)[OF assms(2-4)]]) |
|
1472 apply (simp add: uv1) |
|
1473 using assms(5) uv1 by auto |
|
1474 qed |
|
1475 |
|
1476 lemma division_split_right_inj: |
|
1477 fixes type :: "'a::euclidean_space" |
|
1478 assumes "d division_of i" |
|
1479 and "k1 \<in> d" |
|
1480 and "k2 \<in> d" |
|
1481 and "k1 \<noteq> k2" |
|
1482 and "k1 \<inter> {x::'a. x\<bullet>k \<ge> c} = k2 \<inter> {x. x\<bullet>k \<ge> c}" |
|
1483 and k: "k \<in> Basis" |
|
1484 shows "content (k1 \<inter> {x. x\<bullet>k \<ge> c}) = 0" |
|
1485 proof - |
|
1486 note d=division_ofD[OF assms(1)] |
|
1487 have *: "\<And>a b::'a. \<And>c. content(cbox a b \<inter> {x. x\<bullet>k \<ge> c}) = 0 \<longleftrightarrow> |
|
1488 interior(cbox a b \<inter> {x. x\<bullet>k \<ge> c}) = {}" |
|
1489 unfolding interval_split[OF k] content_eq_0_interior by auto |
|
1490 guess u1 v1 using d(4)[OF assms(2)] by (elim exE) note uv1=this |
|
1491 guess u2 v2 using d(4)[OF assms(3)] by (elim exE) note uv2=this |
|
1492 have **: "\<And>s t u. s \<inter> t = {} \<Longrightarrow> u \<subseteq> s \<Longrightarrow> u \<subseteq> t \<Longrightarrow> u = {}" |
|
1493 by auto |
|
1494 show ?thesis |
|
1495 unfolding uv1 uv2 * |
|
1496 apply (rule **[OF d(5)[OF assms(2-4)]]) |
|
1497 apply (simp add: uv1) |
|
1498 using assms(5) uv1 by auto |
|
1499 qed |
|
1500 |
|
1501 |
|
1502 lemma division_split: |
|
1503 fixes a :: "'a::euclidean_space" |
|
1504 assumes "p division_of (cbox a b)" |
|
1505 and k: "k\<in>Basis" |
|
1506 shows "{l \<inter> {x. x\<bullet>k \<le> c} | l. l \<in> p \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}} division_of(cbox a b \<inter> {x. x\<bullet>k \<le> c})" |
|
1507 (is "?p1 division_of ?I1") |
|
1508 and "{l \<inter> {x. x\<bullet>k \<ge> c} | l. l \<in> p \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}} division_of (cbox a b \<inter> {x. x\<bullet>k \<ge> c})" |
|
1509 (is "?p2 division_of ?I2") |
|
1510 proof (rule_tac[!] division_ofI) |
|
1511 note p = division_ofD[OF assms(1)] |
|
1512 show "finite ?p1" "finite ?p2" |
|
1513 using p(1) by auto |
|
1514 show "\<Union>?p1 = ?I1" "\<Union>?p2 = ?I2" |
|
1515 unfolding p(6)[symmetric] by auto |
|
1516 { |
|
1517 fix k |
|
1518 assume "k \<in> ?p1" |
|
1519 then guess l unfolding mem_Collect_eq by (elim exE conjE) note l=this |
|
1520 guess u v using p(4)[OF l(2)] by (elim exE) note uv=this |
|
1521 show "k \<subseteq> ?I1" |
|
1522 using l p(2) uv by force |
|
1523 show "k \<noteq> {}" |
|
1524 by (simp add: l) |
|
1525 show "\<exists>a b. k = cbox a b" |
|
1526 apply (simp add: l uv p(2-3)[OF l(2)]) |
|
1527 apply (subst interval_split[OF k]) |
|
1528 apply (auto intro: order.trans) |
|
1529 done |
|
1530 fix k' |
|
1531 assume "k' \<in> ?p1" |
|
1532 then guess l' unfolding mem_Collect_eq by (elim exE conjE) note l'=this |
|
1533 assume "k \<noteq> k'" |
|
1534 then show "interior k \<inter> interior k' = {}" |
|
1535 unfolding l l' using p(5)[OF l(2) l'(2)] by auto |
|
1536 } |
|
1537 { |
|
1538 fix k |
|
1539 assume "k \<in> ?p2" |
|
1540 then guess l unfolding mem_Collect_eq by (elim exE conjE) note l=this |
|
1541 guess u v using p(4)[OF l(2)] by (elim exE) note uv=this |
|
1542 show "k \<subseteq> ?I2" |
|
1543 using l p(2) uv by force |
|
1544 show "k \<noteq> {}" |
|
1545 by (simp add: l) |
|
1546 show "\<exists>a b. k = cbox a b" |
|
1547 apply (simp add: l uv p(2-3)[OF l(2)]) |
|
1548 apply (subst interval_split[OF k]) |
|
1549 apply (auto intro: order.trans) |
|
1550 done |
|
1551 fix k' |
|
1552 assume "k' \<in> ?p2" |
|
1553 then guess l' unfolding mem_Collect_eq by (elim exE conjE) note l'=this |
|
1554 assume "k \<noteq> k'" |
|
1555 then show "interior k \<inter> interior k' = {}" |
|
1556 unfolding l l' using p(5)[OF l(2) l'(2)] by auto |
|
1557 } |
|
1558 qed |
|
1559 |
|
1560 subsection \<open>Tagged (partial) divisions.\<close> |
|
1561 |
|
1562 definition tagged_partial_division_of (infixr "tagged'_partial'_division'_of" 40) |
|
1563 where "s tagged_partial_division_of i \<longleftrightarrow> |
|
1564 finite s \<and> |
|
1565 (\<forall>x k. (x, k) \<in> s \<longrightarrow> x \<in> k \<and> k \<subseteq> i \<and> (\<exists>a b. k = cbox a b)) \<and> |
|
1566 (\<forall>x1 k1 x2 k2. (x1, k1) \<in> s \<and> (x2, k2) \<in> s \<and> (x1, k1) \<noteq> (x2, k2) \<longrightarrow> |
|
1567 interior k1 \<inter> interior k2 = {})" |
|
1568 |
|
1569 lemma tagged_partial_division_ofD[dest]: |
|
1570 assumes "s tagged_partial_division_of i" |
|
1571 shows "finite s" |
|
1572 and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k" |
|
1573 and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i" |
|
1574 and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b" |
|
1575 and "\<And>x1 k1 x2 k2. (x1,k1) \<in> s \<Longrightarrow> |
|
1576 (x2, k2) \<in> s \<Longrightarrow> (x1, k1) \<noteq> (x2, k2) \<Longrightarrow> interior k1 \<inter> interior k2 = {}" |
|
1577 using assms unfolding tagged_partial_division_of_def by blast+ |
|
1578 |
|
1579 definition tagged_division_of (infixr "tagged'_division'_of" 40) |
|
1580 where "s tagged_division_of i \<longleftrightarrow> s tagged_partial_division_of i \<and> (\<Union>{k. \<exists>x. (x,k) \<in> s} = i)" |
|
1581 |
|
1582 lemma tagged_division_of_finite: "s tagged_division_of i \<Longrightarrow> finite s" |
|
1583 unfolding tagged_division_of_def tagged_partial_division_of_def by auto |
|
1584 |
|
1585 lemma tagged_division_of: |
|
1586 "s tagged_division_of i \<longleftrightarrow> |
|
1587 finite s \<and> |
|
1588 (\<forall>x k. (x, k) \<in> s \<longrightarrow> x \<in> k \<and> k \<subseteq> i \<and> (\<exists>a b. k = cbox a b)) \<and> |
|
1589 (\<forall>x1 k1 x2 k2. (x1, k1) \<in> s \<and> (x2, k2) \<in> s \<and> (x1, k1) \<noteq> (x2, k2) \<longrightarrow> |
|
1590 interior k1 \<inter> interior k2 = {}) \<and> |
|
1591 (\<Union>{k. \<exists>x. (x,k) \<in> s} = i)" |
|
1592 unfolding tagged_division_of_def tagged_partial_division_of_def by auto |
|
1593 |
|
1594 lemma tagged_division_ofI: |
|
1595 assumes "finite s" |
|
1596 and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k" |
|
1597 and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i" |
|
1598 and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b" |
|
1599 and "\<And>x1 k1 x2 k2. (x1,k1) \<in> s \<Longrightarrow> (x2, k2) \<in> s \<Longrightarrow> (x1, k1) \<noteq> (x2, k2) \<Longrightarrow> |
|
1600 interior k1 \<inter> interior k2 = {}" |
|
1601 and "(\<Union>{k. \<exists>x. (x,k) \<in> s} = i)" |
|
1602 shows "s tagged_division_of i" |
|
1603 unfolding tagged_division_of |
|
1604 using assms |
|
1605 apply auto |
|
1606 apply fastforce+ |
|
1607 done |
|
1608 |
|
1609 lemma tagged_division_ofD[dest]: (*FIXME USE A LOCALE*) |
|
1610 assumes "s tagged_division_of i" |
|
1611 shows "finite s" |
|
1612 and "\<And>x k. (x,k) \<in> s \<Longrightarrow> x \<in> k" |
|
1613 and "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> i" |
|
1614 and "\<And>x k. (x,k) \<in> s \<Longrightarrow> \<exists>a b. k = cbox a b" |
|
1615 and "\<And>x1 k1 x2 k2. (x1, k1) \<in> s \<Longrightarrow> (x2, k2) \<in> s \<Longrightarrow> (x1, k1) \<noteq> (x2, k2) \<Longrightarrow> |
|
1616 interior k1 \<inter> interior k2 = {}" |
|
1617 and "(\<Union>{k. \<exists>x. (x,k) \<in> s} = i)" |
|
1618 using assms unfolding tagged_division_of by blast+ |
|
1619 |
|
1620 lemma division_of_tagged_division: |
|
1621 assumes "s tagged_division_of i" |
|
1622 shows "(snd ` s) division_of i" |
|
1623 proof (rule division_ofI) |
|
1624 note assm = tagged_division_ofD[OF assms] |
|
1625 show "\<Union>(snd ` s) = i" "finite (snd ` s)" |
|
1626 using assm by auto |
|
1627 fix k |
|
1628 assume k: "k \<in> snd ` s" |
|
1629 then obtain xk where xk: "(xk, k) \<in> s" |
|
1630 by auto |
|
1631 then show "k \<subseteq> i" "k \<noteq> {}" "\<exists>a b. k = cbox a b" |
|
1632 using assm by fastforce+ |
|
1633 fix k' |
|
1634 assume k': "k' \<in> snd ` s" "k \<noteq> k'" |
|
1635 from this(1) obtain xk' where xk': "(xk', k') \<in> s" |
|
1636 by auto |
|
1637 then show "interior k \<inter> interior k' = {}" |
|
1638 using assm(5) k'(2) xk by blast |
|
1639 qed |
|
1640 |
|
1641 lemma partial_division_of_tagged_division: |
|
1642 assumes "s tagged_partial_division_of i" |
|
1643 shows "(snd ` s) division_of \<Union>(snd ` s)" |
|
1644 proof (rule division_ofI) |
|
1645 note assm = tagged_partial_division_ofD[OF assms] |
|
1646 show "finite (snd ` s)" "\<Union>(snd ` s) = \<Union>(snd ` s)" |
|
1647 using assm by auto |
|
1648 fix k |
|
1649 assume k: "k \<in> snd ` s" |
|
1650 then obtain xk where xk: "(xk, k) \<in> s" |
|
1651 by auto |
|
1652 then show "k \<noteq> {}" "\<exists>a b. k = cbox a b" "k \<subseteq> \<Union>(snd ` s)" |
|
1653 using assm by auto |
|
1654 fix k' |
|
1655 assume k': "k' \<in> snd ` s" "k \<noteq> k'" |
|
1656 from this(1) obtain xk' where xk': "(xk', k') \<in> s" |
|
1657 by auto |
|
1658 then show "interior k \<inter> interior k' = {}" |
|
1659 using assm(5) k'(2) xk by auto |
|
1660 qed |
|
1661 |
|
1662 lemma tagged_partial_division_subset: |
|
1663 assumes "s tagged_partial_division_of i" |
|
1664 and "t \<subseteq> s" |
|
1665 shows "t tagged_partial_division_of i" |
|
1666 using assms |
|
1667 unfolding tagged_partial_division_of_def |
|
1668 using finite_subset[OF assms(2)] |
|
1669 by blast |
|
1670 |
|
1671 lemma (in comm_monoid_set) over_tagged_division_lemma: |
|
1672 assumes "p tagged_division_of i" |
|
1673 and "\<And>u v. cbox u v \<noteq> {} \<Longrightarrow> content (cbox u v) = 0 \<Longrightarrow> d (cbox u v) = \<^bold>1" |
|
1674 shows "F (\<lambda>(x,k). d k) p = F d (snd ` p)" |
|
1675 proof - |
|
1676 have *: "(\<lambda>(x,k). d k) = d \<circ> snd" |
|
1677 unfolding o_def by (rule ext) auto |
|
1678 note assm = tagged_division_ofD[OF assms(1)] |
|
1679 show ?thesis |
|
1680 unfolding * |
|
1681 proof (rule reindex_nontrivial[symmetric]) |
|
1682 show "finite p" |
|
1683 using assm by auto |
|
1684 fix x y |
|
1685 assume "x\<in>p" "y\<in>p" "x\<noteq>y" "snd x = snd y" |
|
1686 obtain a b where ab: "snd x = cbox a b" |
|
1687 using assm(4)[of "fst x" "snd x"] \<open>x\<in>p\<close> by auto |
|
1688 have "(fst x, snd y) \<in> p" "(fst x, snd y) \<noteq> y" |
|
1689 by (metis prod.collapse \<open>x\<in>p\<close> \<open>snd x = snd y\<close> \<open>x \<noteq> y\<close>)+ |
|
1690 with \<open>x\<in>p\<close> \<open>y\<in>p\<close> have "interior (snd x) \<inter> interior (snd y) = {}" |
|
1691 by (intro assm(5)[of "fst x" _ "fst y"]) auto |
|
1692 then have "content (cbox a b) = 0" |
|
1693 unfolding \<open>snd x = snd y\<close>[symmetric] ab content_eq_0_interior by auto |
|
1694 then have "d (cbox a b) = \<^bold>1" |
|
1695 using assm(2)[of "fst x" "snd x"] \<open>x\<in>p\<close> ab[symmetric] by (intro assms(2)) auto |
|
1696 then show "d (snd x) = \<^bold>1" |
|
1697 unfolding ab by auto |
|
1698 qed |
|
1699 qed |
|
1700 |
|
1701 lemma tag_in_interval: "p tagged_division_of i \<Longrightarrow> (x, k) \<in> p \<Longrightarrow> x \<in> i" |
|
1702 by auto |
|
1703 |
|
1704 lemma tagged_division_of_empty: "{} tagged_division_of {}" |
|
1705 unfolding tagged_division_of by auto |
|
1706 |
|
1707 lemma tagged_partial_division_of_trivial[simp]: "p tagged_partial_division_of {} \<longleftrightarrow> p = {}" |
|
1708 unfolding tagged_partial_division_of_def by auto |
|
1709 |
|
1710 lemma tagged_division_of_trivial[simp]: "p tagged_division_of {} \<longleftrightarrow> p = {}" |
|
1711 unfolding tagged_division_of by auto |
|
1712 |
|
1713 lemma tagged_division_of_self: "x \<in> cbox a b \<Longrightarrow> {(x,cbox a b)} tagged_division_of (cbox a b)" |
|
1714 by (rule tagged_division_ofI) auto |
|
1715 |
|
1716 lemma tagged_division_of_self_real: "x \<in> {a .. b::real} \<Longrightarrow> {(x,{a .. b})} tagged_division_of {a .. b}" |
|
1717 unfolding box_real[symmetric] |
|
1718 by (rule tagged_division_of_self) |
|
1719 |
|
1720 lemma tagged_division_union: |
|
1721 assumes "p1 tagged_division_of s1" |
|
1722 and "p2 tagged_division_of s2" |
|
1723 and "interior s1 \<inter> interior s2 = {}" |
|
1724 shows "(p1 \<union> p2) tagged_division_of (s1 \<union> s2)" |
|
1725 proof (rule tagged_division_ofI) |
|
1726 note p1 = tagged_division_ofD[OF assms(1)] |
|
1727 note p2 = tagged_division_ofD[OF assms(2)] |
|
1728 show "finite (p1 \<union> p2)" |
|
1729 using p1(1) p2(1) by auto |
|
1730 show "\<Union>{k. \<exists>x. (x, k) \<in> p1 \<union> p2} = s1 \<union> s2" |
|
1731 using p1(6) p2(6) by blast |
|
1732 fix x k |
|
1733 assume xk: "(x, k) \<in> p1 \<union> p2" |
|
1734 show "x \<in> k" "\<exists>a b. k = cbox a b" |
|
1735 using xk p1(2,4) p2(2,4) by auto |
|
1736 show "k \<subseteq> s1 \<union> s2" |
|
1737 using xk p1(3) p2(3) by blast |
|
1738 fix x' k' |
|
1739 assume xk': "(x', k') \<in> p1 \<union> p2" "(x, k) \<noteq> (x', k')" |
|
1740 have *: "\<And>a b. a \<subseteq> s1 \<Longrightarrow> b \<subseteq> s2 \<Longrightarrow> interior a \<inter> interior b = {}" |
|
1741 using assms(3) interior_mono by blast |
|
1742 show "interior k \<inter> interior k' = {}" |
|
1743 apply (cases "(x, k) \<in> p1") |
|
1744 apply (meson "*" UnE assms(1) assms(2) p1(5) tagged_division_ofD(3) xk'(1) xk'(2)) |
|
1745 by (metis "*" UnE assms(1) assms(2) inf_sup_aci(1) p2(5) tagged_division_ofD(3) xk xk'(1) xk'(2)) |
|
1746 qed |
|
1747 |
|
1748 lemma tagged_division_unions: |
|
1749 assumes "finite iset" |
|
1750 and "\<forall>i\<in>iset. pfn i tagged_division_of i" |
|
1751 and "\<forall>i1\<in>iset. \<forall>i2\<in>iset. i1 \<noteq> i2 \<longrightarrow> interior(i1) \<inter> interior(i2) = {}" |
|
1752 shows "\<Union>(pfn ` iset) tagged_division_of (\<Union>iset)" |
|
1753 proof (rule tagged_division_ofI) |
|
1754 note assm = tagged_division_ofD[OF assms(2)[rule_format]] |
|
1755 show "finite (\<Union>(pfn ` iset))" |
|
1756 apply (rule finite_Union) |
|
1757 using assms |
|
1758 apply auto |
|
1759 done |
|
1760 have "\<Union>{k. \<exists>x. (x, k) \<in> \<Union>(pfn ` iset)} = \<Union>((\<lambda>i. \<Union>{k. \<exists>x. (x, k) \<in> pfn i}) ` iset)" |
|
1761 by blast |
|
1762 also have "\<dots> = \<Union>iset" |
|
1763 using assm(6) by auto |
|
1764 finally show "\<Union>{k. \<exists>x. (x, k) \<in> \<Union>(pfn ` iset)} = \<Union>iset" . |
|
1765 fix x k |
|
1766 assume xk: "(x, k) \<in> \<Union>(pfn ` iset)" |
|
1767 then obtain i where i: "i \<in> iset" "(x, k) \<in> pfn i" |
|
1768 by auto |
|
1769 show "x \<in> k" "\<exists>a b. k = cbox a b" "k \<subseteq> \<Union>iset" |
|
1770 using assm(2-4)[OF i] using i(1) by auto |
|
1771 fix x' k' |
|
1772 assume xk': "(x', k') \<in> \<Union>(pfn ` iset)" "(x, k) \<noteq> (x', k')" |
|
1773 then obtain i' where i': "i' \<in> iset" "(x', k') \<in> pfn i'" |
|
1774 by auto |
|
1775 have *: "\<And>a b. i \<noteq> i' \<Longrightarrow> a \<subseteq> i \<Longrightarrow> b \<subseteq> i' \<Longrightarrow> interior a \<inter> interior b = {}" |
|
1776 using i(1) i'(1) |
|
1777 using assms(3)[rule_format] interior_mono |
|
1778 by blast |
|
1779 show "interior k \<inter> interior k' = {}" |
|
1780 apply (cases "i = i'") |
|
1781 using assm(5) i' i(2) xk'(2) apply blast |
|
1782 using "*" assm(3) i' i by auto |
|
1783 qed |
|
1784 |
|
1785 lemma tagged_partial_division_of_union_self: |
|
1786 assumes "p tagged_partial_division_of s" |
|
1787 shows "p tagged_division_of (\<Union>(snd ` p))" |
|
1788 apply (rule tagged_division_ofI) |
|
1789 using tagged_partial_division_ofD[OF assms] |
|
1790 apply auto |
|
1791 done |
|
1792 |
|
1793 lemma tagged_division_of_union_self: |
|
1794 assumes "p tagged_division_of s" |
|
1795 shows "p tagged_division_of (\<Union>(snd ` p))" |
|
1796 apply (rule tagged_division_ofI) |
|
1797 using tagged_division_ofD[OF assms] |
|
1798 apply auto |
|
1799 done |
|
1800 |
|
1801 subsection \<open>Functions closed on boxes: morphisms from boxes to monoids\<close> |
|
1802 |
|
1803 text \<open>This auxiliary structure is used to sum up over the elements of a division. Main theorem is |
|
1804 @{text operative_division}. Instances for the monoid are @{typ "'a option"}, @{typ real}, and |
|
1805 @{typ bool}.\<close> |
|
1806 |
|
1807 lemma property_empty_interval: "\<forall>a b. content (cbox a b) = 0 \<longrightarrow> P (cbox a b) \<Longrightarrow> P {}" |
|
1808 using content_empty unfolding empty_as_interval by auto |
|
1809 |
|
1810 paragraph \<open>Using additivity of lifted function to encode definedness.\<close> |
|
1811 |
|
1812 definition lift_option :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'a option \<Rightarrow> 'b option \<Rightarrow> 'c option" |
|
1813 where |
|
1814 "lift_option f a' b' = Option.bind a' (\<lambda>a. Option.bind b' (\<lambda>b. Some (f a b)))" |
|
1815 |
|
1816 lemma lift_option_simps[simp]: |
|
1817 "lift_option f (Some a) (Some b) = Some (f a b)" |
|
1818 "lift_option f None b' = None" |
|
1819 "lift_option f a' None = None" |
|
1820 by (auto simp: lift_option_def) |
|
1821 |
|
1822 lemma (in comm_monoid) comm_monoid_lift_option: "comm_monoid (lift_option op \<^bold>*) (Some \<^bold>1)" |
|
1823 proof qed (auto simp: lift_option_def ac_simps split: bind_split) |
|
1824 |
|
1825 lemma (in comm_monoid) comm_monoid_set_lift_option: "comm_monoid_set (lift_option op \<^bold>*) (Some \<^bold>1)" |
|
1826 proof qed (auto simp: lift_option_def ac_simps split: bind_split) |
|
1827 |
|
1828 lemma comm_monoid_and: "comm_monoid op \<and> True" |
|
1829 proof qed auto |
|
1830 |
|
1831 lemma comm_monoid_set_and: "comm_monoid_set op \<and> True" |
|
1832 proof qed auto |
|
1833 |
|
1834 paragraph \<open>Operative\<close> |
|
1835 |
|
1836 definition (in comm_monoid) operative :: "('b::euclidean_space set \<Rightarrow> 'a) \<Rightarrow> bool" |
|
1837 where "operative g \<longleftrightarrow> |
|
1838 (\<forall>a b. content (cbox a b) = 0 \<longrightarrow> g (cbox a b) = \<^bold>1) \<and> |
|
1839 (\<forall>a b c. \<forall>k\<in>Basis. g (cbox a b) = g (cbox a b \<inter> {x. x\<bullet>k \<le> c}) \<^bold>* g (cbox a b \<inter> {x. x\<bullet>k \<ge> c}))" |
|
1840 |
|
1841 lemma (in comm_monoid) operativeD[dest]: |
|
1842 assumes "operative g" |
|
1843 shows "\<And>a b. content (cbox a b) = 0 \<Longrightarrow> g (cbox a b) = \<^bold>1" |
|
1844 and "\<And>a b c k. k \<in> Basis \<Longrightarrow> g (cbox a b) = g (cbox a b \<inter> {x. x\<bullet>k \<le> c}) \<^bold>* g (cbox a b \<inter> {x. x\<bullet>k \<ge> c})" |
|
1845 using assms unfolding operative_def by auto |
|
1846 |
|
1847 lemma (in comm_monoid) operative_empty: "operative g \<Longrightarrow> g {} = \<^bold>1" |
|
1848 unfolding operative_def by (rule property_empty_interval) auto |
|
1849 |
|
1850 lemma operative_content[intro]: "add.operative content" |
|
1851 by (force simp add: add.operative_def content_split[symmetric]) |
|
1852 |
|
1853 definition "division_points (k::('a::euclidean_space) set) d = |
|
1854 {(j,x). j \<in> Basis \<and> (interval_lowerbound k)\<bullet>j < x \<and> x < (interval_upperbound k)\<bullet>j \<and> |
|
1855 (\<exists>i\<in>d. (interval_lowerbound i)\<bullet>j = x \<or> (interval_upperbound i)\<bullet>j = x)}" |
|
1856 |
|
1857 lemma division_points_finite: |
|
1858 fixes i :: "'a::euclidean_space set" |
|
1859 assumes "d division_of i" |
|
1860 shows "finite (division_points i d)" |
|
1861 proof - |
|
1862 note assm = division_ofD[OF assms] |
|
1863 let ?M = "\<lambda>j. {(j,x)|x. (interval_lowerbound i)\<bullet>j < x \<and> x < (interval_upperbound i)\<bullet>j \<and> |
|
1864 (\<exists>i\<in>d. (interval_lowerbound i)\<bullet>j = x \<or> (interval_upperbound i)\<bullet>j = x)}" |
|
1865 have *: "division_points i d = \<Union>(?M ` Basis)" |
|
1866 unfolding division_points_def by auto |
|
1867 show ?thesis |
|
1868 unfolding * using assm by auto |
|
1869 qed |
|
1870 |
|
1871 lemma division_points_subset: |
|
1872 fixes a :: "'a::euclidean_space" |
|
1873 assumes "d division_of (cbox a b)" |
|
1874 and "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i" "a\<bullet>k < c" "c < b\<bullet>k" |
|
1875 and k: "k \<in> Basis" |
|
1876 shows "division_points (cbox a b \<inter> {x. x\<bullet>k \<le> c}) {l \<inter> {x. x\<bullet>k \<le> c} | l . l \<in> d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}} \<subseteq> |
|
1877 division_points (cbox a b) d" (is ?t1) |
|
1878 and "division_points (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) {l \<inter> {x. x\<bullet>k \<ge> c} | l . l \<in> d \<and> ~(l \<inter> {x. x\<bullet>k \<ge> c} = {})} \<subseteq> |
|
1879 division_points (cbox a b) d" (is ?t2) |
|
1880 proof - |
|
1881 note assm = division_ofD[OF assms(1)] |
|
1882 have *: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i" |
|
1883 "\<forall>i\<in>Basis. a\<bullet>i \<le> (\<Sum>i\<in>Basis. (if i = k then min (b \<bullet> k) c else b \<bullet> i) *\<^sub>R i) \<bullet> i" |
|
1884 "\<forall>i\<in>Basis. (\<Sum>i\<in>Basis. (if i = k then max (a \<bullet> k) c else a \<bullet> i) *\<^sub>R i) \<bullet> i \<le> b\<bullet>i" |
|
1885 "min (b \<bullet> k) c = c" "max (a \<bullet> k) c = c" |
|
1886 using assms using less_imp_le by auto |
|
1887 show ?t1 (*FIXME a horrible mess*) |
|
1888 unfolding division_points_def interval_split[OF k, of a b] |
|
1889 unfolding interval_bounds[OF *(1)] interval_bounds[OF *(2)] interval_bounds[OF *(3)] |
|
1890 unfolding * |
|
1891 apply (rule subsetI) |
|
1892 unfolding mem_Collect_eq split_beta |
|
1893 apply (erule bexE conjE)+ |
|
1894 apply (simp add: ) |
|
1895 apply (erule exE conjE)+ |
|
1896 proof |
|
1897 fix i l x |
|
1898 assume as: |
|
1899 "a \<bullet> fst x < snd x" "snd x < (if fst x = k then c else b \<bullet> fst x)" |
|
1900 "interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x" |
|
1901 "i = l \<inter> {x. x \<bullet> k \<le> c}" "l \<in> d" "l \<inter> {x. x \<bullet> k \<le> c} \<noteq> {}" |
|
1902 and fstx: "fst x \<in> Basis" |
|
1903 from assm(4)[OF this(5)] guess u v apply-by(erule exE)+ note l=this |
|
1904 have *: "\<forall>i\<in>Basis. u \<bullet> i \<le> (\<Sum>i\<in>Basis. (if i = k then min (v \<bullet> k) c else v \<bullet> i) *\<^sub>R i) \<bullet> i" |
|
1905 using as(6) unfolding l interval_split[OF k] box_ne_empty as . |
|
1906 have **: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i" |
|
1907 using l using as(6) unfolding box_ne_empty[symmetric] by auto |
|
1908 show "\<exists>i\<in>d. interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x" |
|
1909 apply (rule bexI[OF _ \<open>l \<in> d\<close>]) |
|
1910 using as(1-3,5) fstx |
|
1911 unfolding l interval_bounds[OF **] interval_bounds[OF *] interval_split[OF k] as |
|
1912 apply (auto split: if_split_asm) |
|
1913 done |
|
1914 show "snd x < b \<bullet> fst x" |
|
1915 using as(2) \<open>c < b\<bullet>k\<close> by (auto split: if_split_asm) |
|
1916 qed |
|
1917 show ?t2 |
|
1918 unfolding division_points_def interval_split[OF k, of a b] |
|
1919 unfolding interval_bounds[OF *(1)] interval_bounds[OF *(2)] interval_bounds[OF *(3)] |
|
1920 unfolding * |
|
1921 unfolding subset_eq |
|
1922 apply rule |
|
1923 unfolding mem_Collect_eq split_beta |
|
1924 apply (erule bexE conjE)+ |
|
1925 apply (simp only: mem_Collect_eq inner_setsum_left_Basis simp_thms) |
|
1926 apply (erule exE conjE)+ |
|
1927 proof |
|
1928 fix i l x |
|
1929 assume as: |
|
1930 "(if fst x = k then c else a \<bullet> fst x) < snd x" "snd x < b \<bullet> fst x" |
|
1931 "interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x" |
|
1932 "i = l \<inter> {x. c \<le> x \<bullet> k}" "l \<in> d" "l \<inter> {x. c \<le> x \<bullet> k} \<noteq> {}" |
|
1933 and fstx: "fst x \<in> Basis" |
|
1934 from assm(4)[OF this(5)] guess u v by (elim exE) note l=this |
|
1935 have *: "\<forall>i\<in>Basis. (\<Sum>i\<in>Basis. (if i = k then max (u \<bullet> k) c else u \<bullet> i) *\<^sub>R i) \<bullet> i \<le> v \<bullet> i" |
|
1936 using as(6) unfolding l interval_split[OF k] box_ne_empty as . |
|
1937 have **: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i" |
|
1938 using l using as(6) unfolding box_ne_empty[symmetric] by auto |
|
1939 show "\<exists>i\<in>d. interval_lowerbound i \<bullet> fst x = snd x \<or> interval_upperbound i \<bullet> fst x = snd x" |
|
1940 apply (rule bexI[OF _ \<open>l \<in> d\<close>]) |
|
1941 using as(1-3,5) fstx |
|
1942 unfolding l interval_bounds[OF **] interval_bounds[OF *] interval_split[OF k] as |
|
1943 apply (auto split: if_split_asm) |
|
1944 done |
|
1945 show "a \<bullet> fst x < snd x" |
|
1946 using as(1) \<open>a\<bullet>k < c\<close> by (auto split: if_split_asm) |
|
1947 qed |
|
1948 qed |
|
1949 |
|
1950 lemma division_points_psubset: |
|
1951 fixes a :: "'a::euclidean_space" |
|
1952 assumes "d division_of (cbox a b)" |
|
1953 and "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i" "a\<bullet>k < c" "c < b\<bullet>k" |
|
1954 and "l \<in> d" |
|
1955 and "interval_lowerbound l\<bullet>k = c \<or> interval_upperbound l\<bullet>k = c" |
|
1956 and k: "k \<in> Basis" |
|
1957 shows "division_points (cbox a b \<inter> {x. x\<bullet>k \<le> c}) {l \<inter> {x. x\<bullet>k \<le> c} | l. l\<in>d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}} \<subset> |
|
1958 division_points (cbox a b) d" (is "?D1 \<subset> ?D") |
|
1959 and "division_points (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) {l \<inter> {x. x\<bullet>k \<ge> c} | l. l\<in>d \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}} \<subset> |
|
1960 division_points (cbox a b) d" (is "?D2 \<subset> ?D") |
|
1961 proof - |
|
1962 have ab: "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i" |
|
1963 using assms(2) by (auto intro!:less_imp_le) |
|
1964 guess u v using division_ofD(4)[OF assms(1,5)] by (elim exE) note l=this |
|
1965 have uv: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i" "\<forall>i\<in>Basis. a\<bullet>i \<le> u\<bullet>i \<and> v\<bullet>i \<le> b\<bullet>i" |
|
1966 using division_ofD(2,2,3)[OF assms(1,5)] unfolding l box_ne_empty |
|
1967 using subset_box(1) |
|
1968 apply auto |
|
1969 apply blast+ |
|
1970 done |
|
1971 have *: "interval_upperbound (cbox a b \<inter> {x. x \<bullet> k \<le> interval_upperbound l \<bullet> k}) \<bullet> k = interval_upperbound l \<bullet> k" |
|
1972 "interval_upperbound (cbox a b \<inter> {x. x \<bullet> k \<le> interval_lowerbound l \<bullet> k}) \<bullet> k = interval_lowerbound l \<bullet> k" |
|
1973 unfolding l interval_split[OF k] interval_bounds[OF uv(1)] |
|
1974 using uv[rule_format, of k] ab k |
|
1975 by auto |
|
1976 have "\<exists>x. x \<in> ?D - ?D1" |
|
1977 using assms(3-) |
|
1978 unfolding division_points_def interval_bounds[OF ab] |
|
1979 apply - |
|
1980 apply (erule disjE) |
|
1981 apply (rule_tac x="(k,(interval_lowerbound l)\<bullet>k)" in exI, force simp add: *) |
|
1982 apply (rule_tac x="(k,(interval_upperbound l)\<bullet>k)" in exI, force simp add: *) |
|
1983 done |
|
1984 moreover have "?D1 \<subseteq> ?D" |
|
1985 by (auto simp add: assms division_points_subset) |
|
1986 ultimately show "?D1 \<subset> ?D" |
|
1987 by blast |
|
1988 have *: "interval_lowerbound (cbox a b \<inter> {x. x \<bullet> k \<ge> interval_lowerbound l \<bullet> k}) \<bullet> k = interval_lowerbound l \<bullet> k" |
|
1989 "interval_lowerbound (cbox a b \<inter> {x. x \<bullet> k \<ge> interval_upperbound l \<bullet> k}) \<bullet> k = interval_upperbound l \<bullet> k" |
|
1990 unfolding l interval_split[OF k] interval_bounds[OF uv(1)] |
|
1991 using uv[rule_format, of k] ab k |
|
1992 by auto |
|
1993 have "\<exists>x. x \<in> ?D - ?D2" |
|
1994 using assms(3-) |
|
1995 unfolding division_points_def interval_bounds[OF ab] |
|
1996 apply - |
|
1997 apply (erule disjE) |
|
1998 apply (rule_tac x="(k,(interval_lowerbound l)\<bullet>k)" in exI, force simp add: *) |
|
1999 apply (rule_tac x="(k,(interval_upperbound l)\<bullet>k)" in exI, force simp add: *) |
|
2000 done |
|
2001 moreover have "?D2 \<subseteq> ?D" |
|
2002 by (auto simp add: assms division_points_subset) |
|
2003 ultimately show "?D2 \<subset> ?D" |
|
2004 by blast |
|
2005 qed |
|
2006 |
|
2007 lemma (in comm_monoid_set) operative_division: |
|
2008 fixes g :: "'b::euclidean_space set \<Rightarrow> 'a" |
|
2009 assumes g: "operative g" and d: "d division_of (cbox a b)" shows "F g d = g (cbox a b)" |
|
2010 proof - |
|
2011 define C where [abs_def]: "C = card (division_points (cbox a b) d)" |
|
2012 then show ?thesis |
|
2013 using d |
|
2014 proof (induction C arbitrary: a b d rule: less_induct) |
|
2015 case (less a b d) |
|
2016 show ?case |
|
2017 proof cases |
|
2018 show "content (cbox a b) = 0 \<Longrightarrow> F g d = g (cbox a b)" |
|
2019 using division_of_content_0[OF _ less.prems] operativeD(1)[OF g] division_ofD(4)[OF less.prems] |
|
2020 by (fastforce intro!: neutral) |
|
2021 next |
|
2022 assume "content (cbox a b) \<noteq> 0" |
|
2023 note ab = this[unfolded content_lt_nz[symmetric] content_pos_lt_eq] |
|
2024 then have ab': "\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i" |
|
2025 by (auto intro!: less_imp_le) |
|
2026 show "F g d = g (cbox a b)" |
|
2027 proof (cases "division_points (cbox a b) d = {}") |
|
2028 case True |
|
2029 { fix u v and j :: 'b |
|
2030 assume j: "j \<in> Basis" and as: "cbox u v \<in> d" |
|
2031 then have "cbox u v \<noteq> {}" |
|
2032 using less.prems by blast |
|
2033 then have uv: "\<forall>i\<in>Basis. u\<bullet>i \<le> v\<bullet>i" "u\<bullet>j \<le> v\<bullet>j" |
|
2034 using j unfolding box_ne_empty by auto |
|
2035 have *: "\<And>p r Q. \<not> j\<in>Basis \<or> p \<or> r \<or> (\<forall>x\<in>d. Q x) \<Longrightarrow> p \<or> r \<or> Q (cbox u v)" |
|
2036 using as j by auto |
|
2037 have "(j, u\<bullet>j) \<notin> division_points (cbox a b) d" |
|
2038 "(j, v\<bullet>j) \<notin> division_points (cbox a b) d" using True by auto |
|
2039 note this[unfolded de_Morgan_conj division_points_def mem_Collect_eq split_conv interval_bounds[OF ab'] bex_simps] |
|
2040 note *[OF this(1)] *[OF this(2)] note this[unfolded interval_bounds[OF uv(1)]] |
|
2041 moreover |
|
2042 have "a\<bullet>j \<le> u\<bullet>j" "v\<bullet>j \<le> b\<bullet>j" |
|
2043 using division_ofD(2,2,3)[OF \<open>d division_of cbox a b\<close> as] |
|
2044 apply (metis j subset_box(1) uv(1)) |
|
2045 by (metis \<open>cbox u v \<subseteq> cbox a b\<close> j subset_box(1) uv(1)) |
|
2046 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" |
|
2047 unfolding not_less de_Morgan_disj using ab[rule_format,of j] uv(2) j by force } |
|
2048 then have d': "\<forall>i\<in>d. \<exists>u v. i = cbox u v \<and> |
|
2049 (\<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)" |
|
2050 unfolding forall_in_division[OF less.prems] by blast |
|
2051 have "(1/2) *\<^sub>R (a+b) \<in> cbox a b" |
|
2052 unfolding mem_box using ab by(auto intro!: less_imp_le simp: inner_simps) |
|
2053 note this[unfolded division_ofD(6)[OF \<open>d division_of cbox a b\<close>,symmetric] Union_iff] |
|
2054 then guess i .. note i=this |
|
2055 guess u v using d'[rule_format,OF i(1)] by (elim exE conjE) note uv=this |
|
2056 have "cbox a b \<in> d" |
|
2057 proof - |
|
2058 have "u = a" "v = b" |
|
2059 unfolding euclidean_eq_iff[where 'a='b] |
|
2060 proof safe |
|
2061 fix j :: 'b |
|
2062 assume j: "j \<in> Basis" |
|
2063 note i(2)[unfolded uv mem_box,rule_format,of j] |
|
2064 then show "u \<bullet> j = a \<bullet> j" and "v \<bullet> j = b \<bullet> j" |
|
2065 using uv(2)[rule_format,of j] j by (auto simp: inner_simps) |
|
2066 qed |
|
2067 then have "i = cbox a b" using uv by auto |
|
2068 then show ?thesis using i by auto |
|
2069 qed |
|
2070 then have deq: "d = insert (cbox a b) (d - {cbox a b})" |
|
2071 by auto |
|
2072 have "F g (d - {cbox a b}) = \<^bold>1" |
|
2073 proof (intro neutral ballI) |
|
2074 fix x |
|
2075 assume x: "x \<in> d - {cbox a b}" |
|
2076 then have "x\<in>d" |
|
2077 by auto note d'[rule_format,OF this] |
|
2078 then guess u v by (elim exE conjE) note uv=this |
|
2079 have "u \<noteq> a \<or> v \<noteq> b" |
|
2080 using x[unfolded uv] by auto |
|
2081 then obtain j where "u\<bullet>j \<noteq> a\<bullet>j \<or> v\<bullet>j \<noteq> b\<bullet>j" and j: "j \<in> Basis" |
|
2082 unfolding euclidean_eq_iff[where 'a='b] by auto |
|
2083 then have "u\<bullet>j = v\<bullet>j" |
|
2084 using uv(2)[rule_format,OF j] by auto |
|
2085 then have "content (cbox u v) = 0" |
|
2086 unfolding content_eq_0 using j |
|
2087 by force |
|
2088 then show "g x = \<^bold>1" |
|
2089 unfolding uv(1) by (rule operativeD(1)[OF g]) |
|
2090 qed |
|
2091 then show "F g d = g (cbox a b)" |
|
2092 using division_ofD[OF less.prems] |
|
2093 apply (subst deq) |
|
2094 apply (subst insert) |
|
2095 apply auto |
|
2096 done |
|
2097 next |
|
2098 case False |
|
2099 then have "\<exists>x. x \<in> division_points (cbox a b) d" |
|
2100 by auto |
|
2101 then guess k c |
|
2102 unfolding split_paired_Ex division_points_def mem_Collect_eq split_conv |
|
2103 apply (elim exE conjE) |
|
2104 done |
|
2105 note this(2-4,1) note kc=this[unfolded interval_bounds[OF ab']] |
|
2106 from this(3) guess j .. note j=this |
|
2107 define d1 where "d1 = {l \<inter> {x. x\<bullet>k \<le> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}" |
|
2108 define d2 where "d2 = {l \<inter> {x. x\<bullet>k \<ge> c} | l. l \<in> d \<and> l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}" |
|
2109 define cb where "cb = (\<Sum>i\<in>Basis. (if i = k then c else b\<bullet>i) *\<^sub>R i)" |
|
2110 define ca where "ca = (\<Sum>i\<in>Basis. (if i = k then c else a\<bullet>i) *\<^sub>R i)" |
|
2111 note division_points_psubset[OF \<open>d division_of cbox a b\<close> ab kc(1-2) j] |
|
2112 note psubset_card_mono[OF _ this(1)] psubset_card_mono[OF _ this(2)] |
|
2113 then have *: "F g d1 = g (cbox a b \<inter> {x. x\<bullet>k \<le> c})" "F g d2 = g (cbox a b \<inter> {x. x\<bullet>k \<ge> c})" |
|
2114 unfolding interval_split[OF kc(4)] |
|
2115 apply (rule_tac[!] "less.hyps"[rule_format]) |
|
2116 using division_split[OF \<open>d division_of cbox a b\<close>, where k=k and c=c] |
|
2117 apply (simp_all add: interval_split kc d1_def d2_def division_points_finite[OF \<open>d division_of cbox a b\<close>]) |
|
2118 done |
|
2119 { fix l y |
|
2120 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" |
|
2121 from division_ofD(4)[OF \<open>d division_of cbox a b\<close> this(1)] guess u v by (elim exE) note leq=this |
|
2122 have "g (l \<inter> {x. x \<bullet> k \<le> c}) = \<^bold>1" |
|
2123 unfolding leq interval_split[OF kc(4)] |
|
2124 apply (rule operativeD[OF g]) |
|
2125 unfolding interval_split[symmetric, OF kc(4)] |
|
2126 using division_split_left_inj less as kc leq by blast |
|
2127 } note fxk_le = this |
|
2128 { fix l y |
|
2129 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" |
|
2130 from division_ofD(4)[OF \<open>d division_of cbox a b\<close> this(1)] guess u v by (elim exE) note leq=this |
|
2131 have "g (l \<inter> {x. x \<bullet> k \<ge> c}) = \<^bold>1" |
|
2132 unfolding leq interval_split[OF kc(4)] |
|
2133 apply (rule operativeD(1)[OF g]) |
|
2134 unfolding interval_split[symmetric,OF kc(4)] |
|
2135 using division_split_right_inj less leq as kc by blast |
|
2136 } note fxk_ge = this |
|
2137 have d1_alt: "d1 = (\<lambda>l. l \<inter> {x. x\<bullet>k \<le> c}) ` {l \<in> d. l \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}" |
|
2138 using d1_def by auto |
|
2139 have d2_alt: "d2 = (\<lambda>l. l \<inter> {x. x\<bullet>k \<ge> c}) ` {l \<in> d. l \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}" |
|
2140 using d2_def by auto |
|
2141 have "g (cbox a b) = F g d1 \<^bold>* F g d2" (is "_ = ?prev") |
|
2142 unfolding * using g kc(4) by blast |
|
2143 also have "F g d1 = F (\<lambda>l. g (l \<inter> {x. x\<bullet>k \<le> c})) d" |
|
2144 unfolding d1_alt using division_of_finite[OF less.prems] fxk_le |
|
2145 by (subst reindex_nontrivial) (auto intro!: mono_neutral_cong_left simp: operative_empty[OF g]) |
|
2146 also have "F g d2 = F (\<lambda>l. g (l \<inter> {x. x\<bullet>k \<ge> c})) d" |
|
2147 unfolding d2_alt using division_of_finite[OF less.prems] fxk_ge |
|
2148 by (subst reindex_nontrivial) (auto intro!: mono_neutral_cong_left simp: operative_empty[OF g]) |
|
2149 also have *: "\<forall>x\<in>d. g x = g (x \<inter> {x. x \<bullet> k \<le> c}) \<^bold>* g (x \<inter> {x. c \<le> x \<bullet> k})" |
|
2150 unfolding forall_in_division[OF \<open>d division_of cbox a b\<close>] |
|
2151 using g kc(4) by blast |
|
2152 have "F (\<lambda>l. g (l \<inter> {x. x\<bullet>k \<le> c})) d \<^bold>* F (\<lambda>l. g (l \<inter> {x. x\<bullet>k \<ge> c})) d = F g d" |
|
2153 using * by (simp add: distrib) |
|
2154 finally show ?thesis by auto |
|
2155 qed |
|
2156 qed |
|
2157 qed |
|
2158 qed |
|
2159 |
|
2160 lemma (in comm_monoid_set) operative_tagged_division: |
|
2161 assumes f: "operative g" and d: "d tagged_division_of (cbox a b)" |
|
2162 shows "F (\<lambda>(x, l). g l) d = g (cbox a b)" |
|
2163 unfolding d[THEN division_of_tagged_division, THEN operative_division[OF f], symmetric] |
|
2164 by (simp add: f[THEN operativeD(1)] over_tagged_division_lemma[OF d]) |
|
2165 |
|
2166 lemma additive_content_division: "d division_of (cbox a b) \<Longrightarrow> setsum content d = content (cbox a b)" |
|
2167 by (metis operative_content setsum.operative_division) |
|
2168 |
|
2169 lemma additive_content_tagged_division: |
|
2170 "d tagged_division_of (cbox a b) \<Longrightarrow> setsum (\<lambda>(x,l). content l) d = content (cbox a b)" |
|
2171 unfolding setsum.operative_tagged_division[OF operative_content, symmetric] by blast |
|
2172 |
|
2173 lemma |
|
2174 shows real_inner_1_left: "inner 1 x = x" |
|
2175 and real_inner_1_right: "inner x 1 = x" |
|
2176 by simp_all |
|
2177 |
|
2178 lemma content_real_eq_0: "content {a .. b::real} = 0 \<longleftrightarrow> a \<ge> b" |
|
2179 by (metis atLeastatMost_empty_iff2 content_empty content_real diff_self eq_iff le_cases le_iff_diff_le_0) |
|
2180 |
|
2181 lemma interval_real_split: |
|
2182 "{a .. b::real} \<inter> {x. x \<le> c} = {a .. min b c}" |
|
2183 "{a .. b} \<inter> {x. c \<le> x} = {max a c .. b}" |
|
2184 apply (metis Int_atLeastAtMostL1 atMost_def) |
|
2185 apply (metis Int_atLeastAtMostL2 atLeast_def) |
|
2186 done |
|
2187 |
|
2188 lemma (in comm_monoid) operative_1_lt: |
|
2189 "operative (g :: real set \<Rightarrow> 'a) \<longleftrightarrow> |
|
2190 ((\<forall>a b. b \<le> a \<longrightarrow> g {a .. b} = \<^bold>1) \<and> (\<forall>a b c. a < c \<and> c < b \<longrightarrow> g {a .. c} \<^bold>* g {c .. b} = g {a .. b}))" |
|
2191 apply (simp add: operative_def content_real_eq_0 atMost_def[symmetric] atLeast_def[symmetric] |
|
2192 del: content_real_if) |
|
2193 proof safe |
|
2194 fix a b c :: real |
|
2195 assume *: "\<forall>a b c. g {a..b} = g {a..min b c} \<^bold>* g {max a c..b}" |
|
2196 assume "a < c" "c < b" |
|
2197 with *[rule_format, of a b c] show "g {a..c} \<^bold>* g {c..b} = g {a..b}" |
|
2198 by (simp add: less_imp_le min.absorb2 max.absorb2) |
|
2199 next |
|
2200 fix a b c :: real |
|
2201 assume as: "\<forall>a b. b \<le> a \<longrightarrow> g {a..b} = \<^bold>1" |
|
2202 "\<forall>a b c. a < c \<and> c < b \<longrightarrow> g {a..c} \<^bold>* g {c..b} = g {a..b}" |
|
2203 from as(1)[rule_format, of 0 1] as(1)[rule_format, of a a for a] as(2) |
|
2204 have [simp]: "g {} = \<^bold>1" "\<And>a. g {a} = \<^bold>1" |
|
2205 "\<And>a b c. a < c \<Longrightarrow> c < b \<Longrightarrow> g {a..c} \<^bold>* g {c..b} = g {a..b}" |
|
2206 by auto |
|
2207 show "g {a..b} = g {a..min b c} \<^bold>* g {max a c..b}" |
|
2208 by (auto simp: min_def max_def le_less) |
|
2209 qed |
|
2210 |
|
2211 lemma (in comm_monoid) operative_1_le: |
|
2212 "operative (g :: real set \<Rightarrow> 'a) \<longleftrightarrow> |
|
2213 ((\<forall>a b. b \<le> a \<longrightarrow> g {a..b} = \<^bold>1) \<and> (\<forall>a b c. a \<le> c \<and> c \<le> b \<longrightarrow> g {a .. c} \<^bold>* g {c .. b} = g {a .. b}))" |
|
2214 unfolding operative_1_lt |
|
2215 proof safe |
|
2216 fix a b c :: real |
|
2217 assume as: "\<forall>a b c. a \<le> c \<and> c \<le> b \<longrightarrow> g {a..c} \<^bold>* g {c..b} = g {a..b}" "a < c" "c < b" |
|
2218 show "g {a..c} \<^bold>* g {c..b} = g {a..b}" |
|
2219 apply (rule as(1)[rule_format]) |
|
2220 using as(2-) |
|
2221 apply auto |
|
2222 done |
|
2223 next |
|
2224 fix a b c :: real |
|
2225 assume "\<forall>a b. b \<le> a \<longrightarrow> g {a .. b} = \<^bold>1" |
|
2226 and "\<forall>a b c. a < c \<and> c < b \<longrightarrow> g {a..c} \<^bold>* g {c..b} = g {a..b}" |
|
2227 and "a \<le> c" |
|
2228 and "c \<le> b" |
|
2229 note as = this[rule_format] |
|
2230 show "g {a..c} \<^bold>* g {c..b} = g {a..b}" |
|
2231 proof (cases "c = a \<or> c = b") |
|
2232 case False |
|
2233 then show ?thesis |
|
2234 apply - |
|
2235 apply (subst as(2)) |
|
2236 using as(3-) |
|
2237 apply auto |
|
2238 done |
|
2239 next |
|
2240 case True |
|
2241 then show ?thesis |
|
2242 proof |
|
2243 assume *: "c = a" |
|
2244 then have "g {a .. c} = \<^bold>1" |
|
2245 apply - |
|
2246 apply (rule as(1)[rule_format]) |
|
2247 apply auto |
|
2248 done |
|
2249 then show ?thesis |
|
2250 unfolding * by auto |
|
2251 next |
|
2252 assume *: "c = b" |
|
2253 then have "g {c .. b} = \<^bold>1" |
|
2254 apply - |
|
2255 apply (rule as(1)[rule_format]) |
|
2256 apply auto |
|
2257 done |
|
2258 then show ?thesis |
|
2259 unfolding * by auto |
|
2260 qed |
|
2261 qed |
|
2262 qed |
|
2263 |
|
2264 subsection \<open>Fine-ness of a partition w.r.t. a gauge.\<close> |
|
2265 |
|
2266 definition fine (infixr "fine" 46) |
|
2267 where "d fine s \<longleftrightarrow> (\<forall>(x,k) \<in> s. k \<subseteq> d x)" |
|
2268 |
|
2269 lemma fineI: |
|
2270 assumes "\<And>x k. (x, k) \<in> s \<Longrightarrow> k \<subseteq> d x" |
|
2271 shows "d fine s" |
|
2272 using assms unfolding fine_def by auto |
|
2273 |
|
2274 lemma fineD[dest]: |
|
2275 assumes "d fine s" |
|
2276 shows "\<And>x k. (x,k) \<in> s \<Longrightarrow> k \<subseteq> d x" |
|
2277 using assms unfolding fine_def by auto |
|
2278 |
|
2279 lemma fine_inter: "(\<lambda>x. d1 x \<inter> d2 x) fine p \<longleftrightarrow> d1 fine p \<and> d2 fine p" |
|
2280 unfolding fine_def by auto |
|
2281 |
|
2282 lemma fine_inters: |
|
2283 "(\<lambda>x. \<Inter>{f d x | d. d \<in> s}) fine p \<longleftrightarrow> (\<forall>d\<in>s. (f d) fine p)" |
|
2284 unfolding fine_def by blast |
|
2285 |
|
2286 lemma fine_union: "d fine p1 \<Longrightarrow> d fine p2 \<Longrightarrow> d fine (p1 \<union> p2)" |
|
2287 unfolding fine_def by blast |
|
2288 |
|
2289 lemma fine_unions: "(\<And>p. p \<in> ps \<Longrightarrow> d fine p) \<Longrightarrow> d fine (\<Union>ps)" |
|
2290 unfolding fine_def by auto |
|
2291 |
|
2292 lemma fine_subset: "p \<subseteq> q \<Longrightarrow> d fine q \<Longrightarrow> d fine p" |
|
2293 unfolding fine_def by blast |
|
2294 |
|
2295 |
|
2296 subsection \<open>Gauge integral. Define on compact intervals first, then use a limit.\<close> |
|
2297 |
|
2298 definition has_integral_compact_interval (infixr "has'_integral'_compact'_interval" 46) |
|
2299 where "(f has_integral_compact_interval y) i \<longleftrightarrow> |
|
2300 (\<forall>e>0. \<exists>d. gauge d \<and> |
|
2301 (\<forall>p. p tagged_division_of i \<and> d fine p \<longrightarrow> |
|
2302 norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - y) < e))" |
|
2303 |
|
2304 definition has_integral :: |
|
2305 "('n::euclidean_space \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'b \<Rightarrow> 'n set \<Rightarrow> bool" |
|
2306 (infixr "has'_integral" 46) |
|
2307 where "(f has_integral y) i \<longleftrightarrow> |
|
2308 (if \<exists>a b. i = cbox a b |
|
2309 then (f has_integral_compact_interval y) i |
|
2310 else (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> |
|
2311 (\<exists>z. ((\<lambda>x. if x \<in> i then f x else 0) has_integral_compact_interval z) (cbox a b) \<and> |
|
2312 norm (z - y) < e)))" |
|
2313 |
|
2314 lemma has_integral: |
|
2315 "(f has_integral y) (cbox a b) \<longleftrightarrow> |
|
2316 (\<forall>e>0. \<exists>d. gauge d \<and> |
|
2317 (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
|
2318 norm (setsum (\<lambda>(x,k). content(k) *\<^sub>R f x) p - y) < e))" |
|
2319 unfolding has_integral_def has_integral_compact_interval_def |
|
2320 by auto |
|
2321 |
|
2322 lemma has_integral_real: |
|
2323 "(f has_integral y) {a .. b::real} \<longleftrightarrow> |
|
2324 (\<forall>e>0. \<exists>d. gauge d \<and> |
|
2325 (\<forall>p. p tagged_division_of {a .. b} \<and> d fine p \<longrightarrow> |
|
2326 norm (setsum (\<lambda>(x,k). content(k) *\<^sub>R f x) p - y) < e))" |
|
2327 unfolding box_real[symmetric] |
|
2328 by (rule has_integral) |
|
2329 |
|
2330 lemma has_integralD[dest]: |
|
2331 assumes "(f has_integral y) (cbox a b)" |
|
2332 and "e > 0" |
|
2333 obtains d where "gauge d" |
|
2334 and "\<And>p. p tagged_division_of (cbox a b) \<Longrightarrow> d fine p \<Longrightarrow> |
|
2335 norm (setsum (\<lambda>(x,k). content(k) *\<^sub>R f(x)) p - y) < e" |
|
2336 using assms unfolding has_integral by auto |
|
2337 |
|
2338 lemma has_integral_alt: |
|
2339 "(f has_integral y) i \<longleftrightarrow> |
|
2340 (if \<exists>a b. i = cbox a b |
|
2341 then (f has_integral y) i |
|
2342 else (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> |
|
2343 (\<exists>z. ((\<lambda>x. if x \<in> i then f(x) else 0) has_integral z) (cbox a b) \<and> norm (z - y) < e)))" |
|
2344 unfolding has_integral |
|
2345 unfolding has_integral_compact_interval_def has_integral_def |
|
2346 by auto |
|
2347 |
|
2348 lemma has_integral_altD: |
|
2349 assumes "(f has_integral y) i" |
|
2350 and "\<not> (\<exists>a b. i = cbox a b)" |
|
2351 and "e>0" |
|
2352 obtains B where "B > 0" |
|
2353 and "\<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> |
|
2354 (\<exists>z. ((\<lambda>x. if x \<in> i then f(x) else 0) has_integral z) (cbox a b) \<and> norm(z - y) < e)" |
|
2355 using assms |
|
2356 unfolding has_integral |
|
2357 unfolding has_integral_compact_interval_def has_integral_def |
|
2358 by auto |
|
2359 |
|
2360 definition integrable_on (infixr "integrable'_on" 46) |
|
2361 where "f integrable_on i \<longleftrightarrow> (\<exists>y. (f has_integral y) i)" |
|
2362 |
|
2363 definition "integral i f = (SOME y. (f has_integral y) i \<or> ~ f integrable_on i \<and> y=0)" |
|
2364 |
|
2365 lemma integrable_integral[dest]: "f integrable_on i \<Longrightarrow> (f has_integral (integral i f)) i" |
|
2366 unfolding integrable_on_def integral_def by (metis (mono_tags, lifting) someI_ex) |
|
2367 |
|
2368 lemma not_integrable_integral: "~ f integrable_on i \<Longrightarrow> integral i f = 0" |
|
2369 unfolding integrable_on_def integral_def by blast |
|
2370 |
|
2371 lemma has_integral_integrable[intro]: "(f has_integral i) s \<Longrightarrow> f integrable_on s" |
|
2372 unfolding integrable_on_def by auto |
|
2373 |
|
2374 lemma has_integral_integral: "f integrable_on s \<longleftrightarrow> (f has_integral (integral s f)) s" |
|
2375 by auto |
|
2376 |
|
2377 lemma setsum_content_null: |
|
2378 assumes "content (cbox a b) = 0" |
|
2379 and "p tagged_division_of (cbox a b)" |
|
2380 shows "setsum (\<lambda>(x,k). content k *\<^sub>R f x) p = (0::'a::real_normed_vector)" |
|
2381 proof (rule setsum.neutral, rule) |
|
2382 fix y |
|
2383 assume y: "y \<in> p" |
|
2384 obtain x k where xk: "y = (x, k)" |
|
2385 using surj_pair[of y] by blast |
|
2386 note assm = tagged_division_ofD(3-4)[OF assms(2) y[unfolded xk]] |
|
2387 from this(2) obtain c d where k: "k = cbox c d" by blast |
|
2388 have "(\<lambda>(x, k). content k *\<^sub>R f x) y = content k *\<^sub>R f x" |
|
2389 unfolding xk by auto |
|
2390 also have "\<dots> = 0" |
|
2391 using content_subset[OF assm(1)[unfolded k]] content_pos_le[of c d] |
|
2392 unfolding assms(1) k |
|
2393 by auto |
|
2394 finally show "(\<lambda>(x, k). content k *\<^sub>R f x) y = 0" . |
|
2395 qed |
|
2396 |
|
2397 |
|
2398 subsection \<open>Some basic combining lemmas.\<close> |
|
2399 |
|
2400 lemma tagged_division_unions_exists: |
|
2401 assumes "finite iset" |
|
2402 and "\<forall>i\<in>iset. \<exists>p. p tagged_division_of i \<and> d fine p" |
|
2403 and "\<forall>i1\<in>iset. \<forall>i2\<in>iset. i1 \<noteq> i2 \<longrightarrow> interior i1 \<inter> interior i2 = {}" |
|
2404 and "\<Union>iset = i" |
|
2405 obtains p where "p tagged_division_of i" and "d fine p" |
|
2406 proof - |
|
2407 obtain pfn where pfn: |
|
2408 "\<And>x. x \<in> iset \<Longrightarrow> pfn x tagged_division_of x" |
|
2409 "\<And>x. x \<in> iset \<Longrightarrow> d fine pfn x" |
|
2410 using bchoice[OF assms(2)] by auto |
|
2411 show thesis |
|
2412 apply (rule_tac p="\<Union>(pfn ` iset)" in that) |
|
2413 using assms(1) assms(3) assms(4) pfn(1) tagged_division_unions apply force |
|
2414 by (metis (mono_tags, lifting) fine_unions imageE pfn(2)) |
|
2415 qed |
|
2416 |
|
2417 |
|
2418 subsection \<open>The set we're concerned with must be closed.\<close> |
|
2419 |
|
2420 lemma division_of_closed: |
|
2421 fixes i :: "'n::euclidean_space set" |
|
2422 shows "s division_of i \<Longrightarrow> closed i" |
|
2423 unfolding division_of_def by fastforce |
|
2424 |
|
2425 subsection \<open>General bisection principle for intervals; might be useful elsewhere.\<close> |
|
2426 |
|
2427 lemma interval_bisection_step: |
|
2428 fixes type :: "'a::euclidean_space" |
|
2429 assumes "P {}" |
|
2430 and "\<forall>s t. P s \<and> P t \<and> interior(s) \<inter> interior(t) = {} \<longrightarrow> P (s \<union> t)" |
|
2431 and "\<not> P (cbox a (b::'a))" |
|
2432 obtains c d where "\<not> P (cbox c d)" |
|
2433 and "\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> c\<bullet>i \<le> d\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i \<and> 2 * (d\<bullet>i - c\<bullet>i) \<le> b\<bullet>i - a\<bullet>i" |
|
2434 proof - |
|
2435 have "cbox a b \<noteq> {}" |
|
2436 using assms(1,3) by metis |
|
2437 then have ab: "\<And>i. i\<in>Basis \<Longrightarrow> a \<bullet> i \<le> b \<bullet> i" |
|
2438 by (force simp: mem_box) |
|
2439 { fix f |
|
2440 have "\<lbrakk>finite f; |
|
2441 \<And>s. s\<in>f \<Longrightarrow> P s; |
|
2442 \<And>s. s\<in>f \<Longrightarrow> \<exists>a b. s = cbox a b; |
|
2443 \<And>s t. s\<in>f \<Longrightarrow> t\<in>f \<Longrightarrow> s \<noteq> t \<Longrightarrow> interior s \<inter> interior t = {}\<rbrakk> \<Longrightarrow> P (\<Union>f)" |
|
2444 proof (induct f rule: finite_induct) |
|
2445 case empty |
|
2446 show ?case |
|
2447 using assms(1) by auto |
|
2448 next |
|
2449 case (insert x f) |
|
2450 show ?case |
|
2451 unfolding Union_insert |
|
2452 apply (rule assms(2)[rule_format]) |
|
2453 using inter_interior_unions_intervals [of f "interior x"] |
|
2454 apply (auto simp: insert) |
|
2455 by (metis IntI empty_iff insert.hyps(2) insert.prems(3) insert_iff) |
|
2456 qed |
|
2457 } note UN_cases = this |
|
2458 let ?A = "{cbox c d | c d::'a. \<forall>i\<in>Basis. (c\<bullet>i = a\<bullet>i) \<and> (d\<bullet>i = (a\<bullet>i + b\<bullet>i) / 2) \<or> |
|
2459 (c\<bullet>i = (a\<bullet>i + b\<bullet>i) / 2) \<and> (d\<bullet>i = b\<bullet>i)}" |
|
2460 let ?PP = "\<lambda>c d. \<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> c\<bullet>i \<le> d\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i \<and> 2 * (d\<bullet>i - c\<bullet>i) \<le> b\<bullet>i - a\<bullet>i" |
|
2461 { |
|
2462 presume "\<forall>c d. ?PP c d \<longrightarrow> P (cbox c d) \<Longrightarrow> False" |
|
2463 then show thesis |
|
2464 unfolding atomize_not not_all |
|
2465 by (blast intro: that) |
|
2466 } |
|
2467 assume as: "\<forall>c d. ?PP c d \<longrightarrow> P (cbox c d)" |
|
2468 have "P (\<Union>?A)" |
|
2469 proof (rule UN_cases) |
|
2470 let ?B = "(\<lambda>s. cbox (\<Sum>i\<in>Basis. (if i \<in> s then a\<bullet>i else (a\<bullet>i + b\<bullet>i) / 2) *\<^sub>R i::'a) |
|
2471 (\<Sum>i\<in>Basis. (if i \<in> s then (a\<bullet>i + b\<bullet>i) / 2 else b\<bullet>i) *\<^sub>R i)) ` {s. s \<subseteq> Basis}" |
|
2472 have "?A \<subseteq> ?B" |
|
2473 proof |
|
2474 fix x |
|
2475 assume "x \<in> ?A" |
|
2476 then obtain c d |
|
2477 where x: "x = cbox c d" |
|
2478 "\<And>i. i \<in> Basis \<Longrightarrow> |
|
2479 c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or> |
|
2480 c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i" by blast |
|
2481 show "x \<in> ?B" |
|
2482 unfolding image_iff x |
|
2483 apply (rule_tac x="{i. i\<in>Basis \<and> c\<bullet>i = a\<bullet>i}" in bexI) |
|
2484 apply (rule arg_cong2 [where f = cbox]) |
|
2485 using x(2) ab |
|
2486 apply (auto simp add: euclidean_eq_iff[where 'a='a]) |
|
2487 by fastforce |
|
2488 qed |
|
2489 then show "finite ?A" |
|
2490 by (rule finite_subset) auto |
|
2491 next |
|
2492 fix s |
|
2493 assume "s \<in> ?A" |
|
2494 then obtain c d |
|
2495 where s: "s = cbox c d" |
|
2496 "\<And>i. i \<in> Basis \<Longrightarrow> |
|
2497 c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or> |
|
2498 c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i" |
|
2499 by blast |
|
2500 show "P s" |
|
2501 unfolding s |
|
2502 apply (rule as[rule_format]) |
|
2503 using ab s(2) by force |
|
2504 show "\<exists>a b. s = cbox a b" |
|
2505 unfolding s by auto |
|
2506 fix t |
|
2507 assume "t \<in> ?A" |
|
2508 then obtain e f where t: |
|
2509 "t = cbox e f" |
|
2510 "\<And>i. i \<in> Basis \<Longrightarrow> |
|
2511 e \<bullet> i = a \<bullet> i \<and> f \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or> |
|
2512 e \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> f \<bullet> i = b \<bullet> i" |
|
2513 by blast |
|
2514 assume "s \<noteq> t" |
|
2515 then have "\<not> (c = e \<and> d = f)" |
|
2516 unfolding s t by auto |
|
2517 then obtain i where "c\<bullet>i \<noteq> e\<bullet>i \<or> d\<bullet>i \<noteq> f\<bullet>i" and i': "i \<in> Basis" |
|
2518 unfolding euclidean_eq_iff[where 'a='a] by auto |
|
2519 then have i: "c\<bullet>i \<noteq> e\<bullet>i" "d\<bullet>i \<noteq> f\<bullet>i" |
|
2520 using s(2) t(2) apply fastforce |
|
2521 using t(2)[OF i'] \<open>c \<bullet> i \<noteq> e \<bullet> i \<or> d \<bullet> i \<noteq> f \<bullet> i\<close> i' s(2) t(2) by fastforce |
|
2522 have *: "\<And>s t. (\<And>a. a \<in> s \<Longrightarrow> a \<in> t \<Longrightarrow> False) \<Longrightarrow> s \<inter> t = {}" |
|
2523 by auto |
|
2524 show "interior s \<inter> interior t = {}" |
|
2525 unfolding s t interior_cbox |
|
2526 proof (rule *) |
|
2527 fix x |
|
2528 assume "x \<in> box c d" "x \<in> box e f" |
|
2529 then have x: "c\<bullet>i < d\<bullet>i" "e\<bullet>i < f\<bullet>i" "c\<bullet>i < f\<bullet>i" "e\<bullet>i < d\<bullet>i" |
|
2530 unfolding mem_box using i' |
|
2531 by force+ |
|
2532 show False using s(2)[OF i'] |
|
2533 proof safe |
|
2534 assume as: "c \<bullet> i = a \<bullet> i" "d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2" |
|
2535 show False |
|
2536 using t(2)[OF i'] and i x unfolding as by (fastforce simp add:field_simps) |
|
2537 next |
|
2538 assume as: "c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2" "d \<bullet> i = b \<bullet> i" |
|
2539 show False |
|
2540 using t(2)[OF i'] and i x unfolding as by(fastforce simp add:field_simps) |
|
2541 qed |
|
2542 qed |
|
2543 qed |
|
2544 also have "\<Union>?A = cbox a b" |
|
2545 proof (rule set_eqI,rule) |
|
2546 fix x |
|
2547 assume "x \<in> \<Union>?A" |
|
2548 then obtain c d where x: |
|
2549 "x \<in> cbox c d" |
|
2550 "\<And>i. i \<in> Basis \<Longrightarrow> |
|
2551 c \<bullet> i = a \<bullet> i \<and> d \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<or> |
|
2552 c \<bullet> i = (a \<bullet> i + b \<bullet> i) / 2 \<and> d \<bullet> i = b \<bullet> i" |
|
2553 by blast |
|
2554 show "x\<in>cbox a b" |
|
2555 unfolding mem_box |
|
2556 proof safe |
|
2557 fix i :: 'a |
|
2558 assume i: "i \<in> Basis" |
|
2559 then show "a \<bullet> i \<le> x \<bullet> i" "x \<bullet> i \<le> b \<bullet> i" |
|
2560 using x(2)[OF i] x(1)[unfolded mem_box,THEN bspec, OF i] by auto |
|
2561 qed |
|
2562 next |
|
2563 fix x |
|
2564 assume x: "x \<in> cbox a b" |
|
2565 have "\<forall>i\<in>Basis. |
|
2566 \<exists>c d. (c = a\<bullet>i \<and> d = (a\<bullet>i + b\<bullet>i) / 2 \<or> c = (a\<bullet>i + b\<bullet>i) / 2 \<and> d = b\<bullet>i) \<and> c\<le>x\<bullet>i \<and> x\<bullet>i \<le> d" |
|
2567 (is "\<forall>i\<in>Basis. \<exists>c d. ?P i c d") |
|
2568 unfolding mem_box |
|
2569 proof |
|
2570 fix i :: 'a |
|
2571 assume i: "i \<in> Basis" |
|
2572 have "?P i (a\<bullet>i) ((a \<bullet> i + b \<bullet> i) / 2) \<or> ?P i ((a \<bullet> i + b \<bullet> i) / 2) (b\<bullet>i)" |
|
2573 using x[unfolded mem_box,THEN bspec, OF i] by auto |
|
2574 then show "\<exists>c d. ?P i c d" |
|
2575 by blast |
|
2576 qed |
|
2577 then show "x\<in>\<Union>?A" |
|
2578 unfolding Union_iff Bex_def mem_Collect_eq choice_Basis_iff |
|
2579 apply auto |
|
2580 apply (rule_tac x="cbox xa xaa" in exI) |
|
2581 unfolding mem_box |
|
2582 apply auto |
|
2583 done |
|
2584 qed |
|
2585 finally show False |
|
2586 using assms by auto |
|
2587 qed |
|
2588 |
|
2589 lemma interval_bisection: |
|
2590 fixes type :: "'a::euclidean_space" |
|
2591 assumes "P {}" |
|
2592 and "(\<forall>s t. P s \<and> P t \<and> interior(s) \<inter> interior(t) = {} \<longrightarrow> P(s \<union> t))" |
|
2593 and "\<not> P (cbox a (b::'a))" |
|
2594 obtains x where "x \<in> cbox a b" |
|
2595 and "\<forall>e>0. \<exists>c d. x \<in> cbox c d \<and> cbox c d \<subseteq> ball x e \<and> cbox c d \<subseteq> cbox a b \<and> \<not> P (cbox c d)" |
|
2596 proof - |
|
2597 have "\<forall>x. \<exists>y. \<not> P (cbox (fst x) (snd x)) \<longrightarrow> (\<not> P (cbox (fst y) (snd y)) \<and> |
|
2598 (\<forall>i\<in>Basis. fst x\<bullet>i \<le> fst y\<bullet>i \<and> fst y\<bullet>i \<le> snd y\<bullet>i \<and> snd y\<bullet>i \<le> snd x\<bullet>i \<and> |
|
2599 2 * (snd y\<bullet>i - fst y\<bullet>i) \<le> snd x\<bullet>i - fst x\<bullet>i))" (is "\<forall>x. ?P x") |
|
2600 proof |
|
2601 show "?P x" for x |
|
2602 proof (cases "P (cbox (fst x) (snd x))") |
|
2603 case True |
|
2604 then show ?thesis by auto |
|
2605 next |
|
2606 case as: False |
|
2607 obtain c d where "\<not> P (cbox c d)" |
|
2608 "\<forall>i\<in>Basis. |
|
2609 fst x \<bullet> i \<le> c \<bullet> i \<and> |
|
2610 c \<bullet> i \<le> d \<bullet> i \<and> |
|
2611 d \<bullet> i \<le> snd x \<bullet> i \<and> |
|
2612 2 * (d \<bullet> i - c \<bullet> i) \<le> snd x \<bullet> i - fst x \<bullet> i" |
|
2613 by (rule interval_bisection_step[of P, OF assms(1-2) as]) |
|
2614 then show ?thesis |
|
2615 apply - |
|
2616 apply (rule_tac x="(c,d)" in exI) |
|
2617 apply auto |
|
2618 done |
|
2619 qed |
|
2620 qed |
|
2621 then obtain f where f: |
|
2622 "\<forall>x. |
|
2623 \<not> P (cbox (fst x) (snd x)) \<longrightarrow> |
|
2624 \<not> P (cbox (fst (f x)) (snd (f x))) \<and> |
|
2625 (\<forall>i\<in>Basis. |
|
2626 fst x \<bullet> i \<le> fst (f x) \<bullet> i \<and> |
|
2627 fst (f x) \<bullet> i \<le> snd (f x) \<bullet> i \<and> |
|
2628 snd (f x) \<bullet> i \<le> snd x \<bullet> i \<and> |
|
2629 2 * (snd (f x) \<bullet> i - fst (f x) \<bullet> i) \<le> snd x \<bullet> i - fst x \<bullet> i)" |
|
2630 apply - |
|
2631 apply (drule choice) |
|
2632 apply blast |
|
2633 done |
|
2634 define AB A B where ab_def: "AB n = (f ^^ n) (a,b)" "A n = fst(AB n)" "B n = snd(AB n)" for n |
|
2635 have "A 0 = a" "B 0 = b" "\<And>n. \<not> P (cbox (A(Suc n)) (B(Suc n))) \<and> |
|
2636 (\<forall>i\<in>Basis. A(n)\<bullet>i \<le> A(Suc n)\<bullet>i \<and> A(Suc n)\<bullet>i \<le> B(Suc n)\<bullet>i \<and> B(Suc n)\<bullet>i \<le> B(n)\<bullet>i \<and> |
|
2637 2 * (B(Suc n)\<bullet>i - A(Suc n)\<bullet>i) \<le> B(n)\<bullet>i - A(n)\<bullet>i)" (is "\<And>n. ?P n") |
|
2638 proof - |
|
2639 show "A 0 = a" "B 0 = b" |
|
2640 unfolding ab_def by auto |
|
2641 note S = ab_def funpow.simps o_def id_apply |
|
2642 show "?P n" for n |
|
2643 proof (induct n) |
|
2644 case 0 |
|
2645 then show ?case |
|
2646 unfolding S |
|
2647 apply (rule f[rule_format]) using assms(3) |
|
2648 apply auto |
|
2649 done |
|
2650 next |
|
2651 case (Suc n) |
|
2652 show ?case |
|
2653 unfolding S |
|
2654 apply (rule f[rule_format]) |
|
2655 using Suc |
|
2656 unfolding S |
|
2657 apply auto |
|
2658 done |
|
2659 qed |
|
2660 qed |
|
2661 note AB = this(1-2) conjunctD2[OF this(3),rule_format] |
|
2662 |
|
2663 have interv: "\<exists>n. \<forall>x\<in>cbox (A n) (B n). \<forall>y\<in>cbox (A n) (B n). dist x y < e" |
|
2664 if e: "0 < e" for e |
|
2665 proof - |
|
2666 obtain n where n: "(\<Sum>i\<in>Basis. b \<bullet> i - a \<bullet> i) / e < 2 ^ n" |
|
2667 using real_arch_pow[of 2 "(setsum (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis) / e"] by auto |
|
2668 show ?thesis |
|
2669 proof (rule exI [where x=n], clarify) |
|
2670 fix x y |
|
2671 assume xy: "x\<in>cbox (A n) (B n)" "y\<in>cbox (A n) (B n)" |
|
2672 have "dist x y \<le> setsum (\<lambda>i. \<bar>(x - y)\<bullet>i\<bar>) Basis" |
|
2673 unfolding dist_norm by(rule norm_le_l1) |
|
2674 also have "\<dots> \<le> setsum (\<lambda>i. B n\<bullet>i - A n\<bullet>i) Basis" |
|
2675 proof (rule setsum_mono) |
|
2676 fix i :: 'a |
|
2677 assume i: "i \<in> Basis" |
|
2678 show "\<bar>(x - y) \<bullet> i\<bar> \<le> B n \<bullet> i - A n \<bullet> i" |
|
2679 using xy[unfolded mem_box,THEN bspec, OF i] |
|
2680 by (auto simp: inner_diff_left) |
|
2681 qed |
|
2682 also have "\<dots> \<le> setsum (\<lambda>i. b\<bullet>i - a\<bullet>i) Basis / 2^n" |
|
2683 unfolding setsum_divide_distrib |
|
2684 proof (rule setsum_mono) |
|
2685 show "B n \<bullet> i - A n \<bullet> i \<le> (b \<bullet> i - a \<bullet> i) / 2 ^ n" if i: "i \<in> Basis" for i |
|
2686 proof (induct n) |
|
2687 case 0 |
|
2688 then show ?case |
|
2689 unfolding AB by auto |
|
2690 next |
|
2691 case (Suc n) |
|
2692 have "B (Suc n) \<bullet> i - A (Suc n) \<bullet> i \<le> (B n \<bullet> i - A n \<bullet> i) / 2" |
|
2693 using AB(4)[of i n] using i by auto |
|
2694 also have "\<dots> \<le> (b \<bullet> i - a \<bullet> i) / 2 ^ Suc n" |
|
2695 using Suc by (auto simp add: field_simps) |
|
2696 finally show ?case . |
|
2697 qed |
|
2698 qed |
|
2699 also have "\<dots> < e" |
|
2700 using n using e by (auto simp add: field_simps) |
|
2701 finally show "dist x y < e" . |
|
2702 qed |
|
2703 qed |
|
2704 { |
|
2705 fix n m :: nat |
|
2706 assume "m \<le> n" then have "cbox (A n) (B n) \<subseteq> cbox (A m) (B m)" |
|
2707 proof (induction rule: inc_induct) |
|
2708 case (step i) |
|
2709 show ?case |
|
2710 using AB(4) by (intro order_trans[OF step.IH] subset_box_imp) auto |
|
2711 qed simp |
|
2712 } note ABsubset = this |
|
2713 have "\<exists>a. \<forall>n. a\<in> cbox (A n) (B n)" |
|
2714 by (rule decreasing_closed_nest[rule_format,OF closed_cbox _ ABsubset interv]) |
|
2715 (metis nat.exhaust AB(1-3) assms(1,3)) |
|
2716 then obtain x0 where x0: "\<And>n. x0 \<in> cbox (A n) (B n)" |
|
2717 by blast |
|
2718 show thesis |
|
2719 proof (rule that[rule_format, of x0]) |
|
2720 show "x0\<in>cbox a b" |
|
2721 using x0[of 0] unfolding AB . |
|
2722 fix e :: real |
|
2723 assume "e > 0" |
|
2724 from interv[OF this] obtain n |
|
2725 where n: "\<forall>x\<in>cbox (A n) (B n). \<forall>y\<in>cbox (A n) (B n). dist x y < e" .. |
|
2726 have "\<not> P (cbox (A n) (B n))" |
|
2727 apply (cases "0 < n") |
|
2728 using AB(3)[of "n - 1"] assms(3) AB(1-2) |
|
2729 apply auto |
|
2730 done |
|
2731 moreover have "cbox (A n) (B n) \<subseteq> ball x0 e" |
|
2732 using n using x0[of n] by auto |
|
2733 moreover have "cbox (A n) (B n) \<subseteq> cbox a b" |
|
2734 unfolding AB(1-2)[symmetric] by (rule ABsubset) auto |
|
2735 ultimately show "\<exists>c d. x0 \<in> cbox c d \<and> cbox c d \<subseteq> ball x0 e \<and> cbox c d \<subseteq> cbox a b \<and> \<not> P (cbox c d)" |
|
2736 apply (rule_tac x="A n" in exI) |
|
2737 apply (rule_tac x="B n" in exI) |
|
2738 apply (auto simp: x0) |
|
2739 done |
|
2740 qed |
|
2741 qed |
|
2742 |
|
2743 |
|
2744 subsection \<open>Cousin's lemma.\<close> |
|
2745 |
|
2746 lemma fine_division_exists: |
|
2747 fixes a b :: "'a::euclidean_space" |
|
2748 assumes "gauge g" |
|
2749 obtains p where "p tagged_division_of (cbox a b)" "g fine p" |
|
2750 proof - |
|
2751 presume "\<not> (\<exists>p. p tagged_division_of (cbox a b) \<and> g fine p) \<Longrightarrow> False" |
|
2752 then obtain p where "p tagged_division_of (cbox a b)" "g fine p" |
|
2753 by blast |
|
2754 then show thesis .. |
|
2755 next |
|
2756 assume as: "\<not> (\<exists>p. p tagged_division_of (cbox a b) \<and> g fine p)" |
|
2757 obtain x where x: |
|
2758 "x \<in> (cbox a b)" |
|
2759 "\<And>e. 0 < e \<Longrightarrow> |
|
2760 \<exists>c d. |
|
2761 x \<in> cbox c d \<and> |
|
2762 cbox c d \<subseteq> ball x e \<and> |
|
2763 cbox c d \<subseteq> (cbox a b) \<and> |
|
2764 \<not> (\<exists>p. p tagged_division_of cbox c d \<and> g fine p)" |
|
2765 apply (rule interval_bisection[of "\<lambda>s. \<exists>p. p tagged_division_of s \<and> g fine p", OF _ _ as]) |
|
2766 apply (simp add: fine_def) |
|
2767 apply (metis tagged_division_union fine_union) |
|
2768 apply (auto simp: ) |
|
2769 done |
|
2770 obtain e where e: "e > 0" "ball x e \<subseteq> g x" |
|
2771 using gaugeD[OF assms, of x] unfolding open_contains_ball by auto |
|
2772 from x(2)[OF e(1)] |
|
2773 obtain c d where c_d: "x \<in> cbox c d" |
|
2774 "cbox c d \<subseteq> ball x e" |
|
2775 "cbox c d \<subseteq> cbox a b" |
|
2776 "\<not> (\<exists>p. p tagged_division_of cbox c d \<and> g fine p)" |
|
2777 by blast |
|
2778 have "g fine {(x, cbox c d)}" |
|
2779 unfolding fine_def using e using c_d(2) by auto |
|
2780 then show False |
|
2781 using tagged_division_of_self[OF c_d(1)] using c_d by auto |
|
2782 qed |
|
2783 |
|
2784 lemma fine_division_exists_real: |
|
2785 fixes a b :: real |
|
2786 assumes "gauge g" |
|
2787 obtains p where "p tagged_division_of {a .. b}" "g fine p" |
|
2788 by (metis assms box_real(2) fine_division_exists) |
|
2789 |
|
2790 subsection \<open>Basic theorems about integrals.\<close> |
|
2791 |
|
2792 lemma has_integral_unique: |
|
2793 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector" |
|
2794 assumes "(f has_integral k1) i" |
|
2795 and "(f has_integral k2) i" |
|
2796 shows "k1 = k2" |
|
2797 proof (rule ccontr) |
|
2798 let ?e = "norm (k1 - k2) / 2" |
|
2799 assume as: "k1 \<noteq> k2" |
|
2800 then have e: "?e > 0" |
|
2801 by auto |
|
2802 have lem: False |
|
2803 if f_k1: "(f has_integral k1) (cbox a b)" |
|
2804 and f_k2: "(f has_integral k2) (cbox a b)" |
|
2805 and "k1 \<noteq> k2" |
|
2806 for f :: "'n \<Rightarrow> 'a" and a b k1 k2 |
|
2807 proof - |
|
2808 let ?e = "norm (k1 - k2) / 2" |
|
2809 from \<open>k1 \<noteq> k2\<close> have e: "?e > 0" by auto |
|
2810 obtain d1 where d1: |
|
2811 "gauge d1" |
|
2812 "\<And>p. p tagged_division_of cbox a b \<Longrightarrow> |
|
2813 d1 fine p \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - k1) < norm (k1 - k2) / 2" |
|
2814 by (rule has_integralD[OF f_k1 e]) blast |
|
2815 obtain d2 where d2: |
|
2816 "gauge d2" |
|
2817 "\<And>p. p tagged_division_of cbox a b \<Longrightarrow> |
|
2818 d2 fine p \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - k2) < norm (k1 - k2) / 2" |
|
2819 by (rule has_integralD[OF f_k2 e]) blast |
|
2820 obtain p where p: |
|
2821 "p tagged_division_of cbox a b" |
|
2822 "(\<lambda>x. d1 x \<inter> d2 x) fine p" |
|
2823 by (rule fine_division_exists[OF gauge_inter[OF d1(1) d2(1)]]) |
|
2824 let ?c = "(\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)" |
|
2825 have "norm (k1 - k2) \<le> norm (?c - k2) + norm (?c - k1)" |
|
2826 using norm_triangle_ineq4[of "k1 - ?c" "k2 - ?c"] |
|
2827 by (auto simp add:algebra_simps norm_minus_commute) |
|
2828 also have "\<dots> < norm (k1 - k2) / 2 + norm (k1 - k2) / 2" |
|
2829 apply (rule add_strict_mono) |
|
2830 apply (rule_tac[!] d2(2) d1(2)) |
|
2831 using p unfolding fine_def |
|
2832 apply auto |
|
2833 done |
|
2834 finally show False by auto |
|
2835 qed |
|
2836 { |
|
2837 presume "\<not> (\<exists>a b. i = cbox a b) \<Longrightarrow> False" |
|
2838 then show False |
|
2839 using as assms lem by blast |
|
2840 } |
|
2841 assume as: "\<not> (\<exists>a b. i = cbox a b)" |
|
2842 obtain B1 where B1: |
|
2843 "0 < B1" |
|
2844 "\<And>a b. ball 0 B1 \<subseteq> cbox a b \<Longrightarrow> |
|
2845 \<exists>z. ((\<lambda>x. if x \<in> i then f x else 0) has_integral z) (cbox a b) \<and> |
|
2846 norm (z - k1) < norm (k1 - k2) / 2" |
|
2847 by (rule has_integral_altD[OF assms(1) as,OF e]) blast |
|
2848 obtain B2 where B2: |
|
2849 "0 < B2" |
|
2850 "\<And>a b. ball 0 B2 \<subseteq> cbox a b \<Longrightarrow> |
|
2851 \<exists>z. ((\<lambda>x. if x \<in> i then f x else 0) has_integral z) (cbox a b) \<and> |
|
2852 norm (z - k2) < norm (k1 - k2) / 2" |
|
2853 by (rule has_integral_altD[OF assms(2) as,OF e]) blast |
|
2854 have "\<exists>a b::'n. ball 0 B1 \<union> ball 0 B2 \<subseteq> cbox a b" |
|
2855 apply (rule bounded_subset_cbox) |
|
2856 using bounded_Un bounded_ball |
|
2857 apply auto |
|
2858 done |
|
2859 then obtain a b :: 'n where ab: "ball 0 B1 \<subseteq> cbox a b" "ball 0 B2 \<subseteq> cbox a b" |
|
2860 by blast |
|
2861 obtain w where w: |
|
2862 "((\<lambda>x. if x \<in> i then f x else 0) has_integral w) (cbox a b)" |
|
2863 "norm (w - k1) < norm (k1 - k2) / 2" |
|
2864 using B1(2)[OF ab(1)] by blast |
|
2865 obtain z where z: |
|
2866 "((\<lambda>x. if x \<in> i then f x else 0) has_integral z) (cbox a b)" |
|
2867 "norm (z - k2) < norm (k1 - k2) / 2" |
|
2868 using B2(2)[OF ab(2)] by blast |
|
2869 have "z = w" |
|
2870 using lem[OF w(1) z(1)] by auto |
|
2871 then have "norm (k1 - k2) \<le> norm (z - k2) + norm (w - k1)" |
|
2872 using norm_triangle_ineq4 [of "k1 - w" "k2 - z"] |
|
2873 by (auto simp add: norm_minus_commute) |
|
2874 also have "\<dots> < norm (k1 - k2) / 2 + norm (k1 - k2) / 2" |
|
2875 apply (rule add_strict_mono) |
|
2876 apply (rule_tac[!] z(2) w(2)) |
|
2877 done |
|
2878 finally show False by auto |
|
2879 qed |
|
2880 |
|
2881 lemma integral_unique [intro]: "(f has_integral y) k \<Longrightarrow> integral k f = y" |
|
2882 unfolding integral_def |
|
2883 by (rule some_equality) (auto intro: has_integral_unique) |
|
2884 |
|
2885 lemma eq_integralD: "integral k f = y \<Longrightarrow> (f has_integral y) k \<or> ~ f integrable_on k \<and> y=0" |
|
2886 unfolding integral_def integrable_on_def |
|
2887 apply (erule subst) |
|
2888 apply (rule someI_ex) |
|
2889 by blast |
|
2890 |
|
2891 lemma has_integral_is_0: |
|
2892 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector" |
|
2893 assumes "\<forall>x\<in>s. f x = 0" |
|
2894 shows "(f has_integral 0) s" |
|
2895 proof - |
|
2896 have lem: "\<And>a b. \<And>f::'n \<Rightarrow> 'a. |
|
2897 (\<forall>x\<in>cbox a b. f(x) = 0) \<Longrightarrow> (f has_integral 0) (cbox a b)" |
|
2898 unfolding has_integral |
|
2899 proof clarify |
|
2900 fix a b e |
|
2901 fix f :: "'n \<Rightarrow> 'a" |
|
2902 assume as: "\<forall>x\<in>cbox a b. f x = 0" "0 < (e::real)" |
|
2903 have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) < e" |
|
2904 if p: "p tagged_division_of cbox a b" for p |
|
2905 proof - |
|
2906 have "(\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) = 0" |
|
2907 proof (rule setsum.neutral, rule) |
|
2908 fix x |
|
2909 assume x: "x \<in> p" |
|
2910 have "f (fst x) = 0" |
|
2911 using tagged_division_ofD(2-3)[OF p, of "fst x" "snd x"] using as x by auto |
|
2912 then show "(\<lambda>(x, k). content k *\<^sub>R f x) x = 0" |
|
2913 apply (subst surjective_pairing[of x]) |
|
2914 unfolding split_conv |
|
2915 apply auto |
|
2916 done |
|
2917 qed |
|
2918 then show ?thesis |
|
2919 using as by auto |
|
2920 qed |
|
2921 then show "\<exists>d. gauge d \<and> |
|
2922 (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) < e)" |
|
2923 by auto |
|
2924 qed |
|
2925 { |
|
2926 presume "\<not> (\<exists>a b. s = cbox a b) \<Longrightarrow> ?thesis" |
|
2927 with assms lem show ?thesis |
|
2928 by blast |
|
2929 } |
|
2930 have *: "(\<lambda>x. if x \<in> s then f x else 0) = (\<lambda>x. 0)" |
|
2931 apply (rule ext) |
|
2932 using assms |
|
2933 apply auto |
|
2934 done |
|
2935 assume "\<not> (\<exists>a b. s = cbox a b)" |
|
2936 then show ?thesis |
|
2937 using lem |
|
2938 by (subst has_integral_alt) (force simp add: *) |
|
2939 qed |
|
2940 |
|
2941 lemma has_integral_0[simp]: "((\<lambda>x::'n::euclidean_space. 0) has_integral 0) s" |
|
2942 by (rule has_integral_is_0) auto |
|
2943 |
|
2944 lemma has_integral_0_eq[simp]: "((\<lambda>x. 0) has_integral i) s \<longleftrightarrow> i = 0" |
|
2945 using has_integral_unique[OF has_integral_0] by auto |
|
2946 |
|
2947 lemma has_integral_linear: |
|
2948 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector" |
|
2949 assumes "(f has_integral y) s" |
|
2950 and "bounded_linear h" |
|
2951 shows "((h \<circ> f) has_integral ((h y))) s" |
|
2952 proof - |
|
2953 interpret bounded_linear h |
|
2954 using assms(2) . |
|
2955 from pos_bounded obtain B where B: "0 < B" "\<And>x. norm (h x) \<le> norm x * B" |
|
2956 by blast |
|
2957 have lem: "\<And>(f :: 'n \<Rightarrow> 'a) y a b. |
|
2958 (f has_integral y) (cbox a b) \<Longrightarrow> ((h \<circ> f) has_integral h y) (cbox a b)" |
|
2959 unfolding has_integral |
|
2960 proof (clarify, goal_cases) |
|
2961 case prems: (1 f y a b e) |
|
2962 from pos_bounded |
|
2963 obtain B where B: "0 < B" "\<And>x. norm (h x) \<le> norm x * B" |
|
2964 by blast |
|
2965 have "e / B > 0" using prems(2) B by simp |
|
2966 then obtain g |
|
2967 where g: "gauge g" |
|
2968 "\<And>p. p tagged_division_of (cbox a b) \<Longrightarrow> g fine p \<Longrightarrow> |
|
2969 norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - y) < e / B" |
|
2970 using prems(1) by auto |
|
2971 { |
|
2972 fix p |
|
2973 assume as: "p tagged_division_of (cbox a b)" "g fine p" |
|
2974 have hc: "\<And>x k. h ((\<lambda>(x, k). content k *\<^sub>R f x) x) = (\<lambda>(x, k). h (content k *\<^sub>R f x)) x" |
|
2975 by auto |
|
2976 then have "(\<Sum>(x, k)\<in>p. content k *\<^sub>R (h \<circ> f) x) = setsum (h \<circ> (\<lambda>(x, k). content k *\<^sub>R f x)) p" |
|
2977 unfolding o_def unfolding scaleR[symmetric] hc by simp |
|
2978 also have "\<dots> = h (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)" |
|
2979 using setsum[of "\<lambda>(x,k). content k *\<^sub>R f x" p] using as by auto |
|
2980 finally have "(\<Sum>(x, k)\<in>p. content k *\<^sub>R (h \<circ> f) x) = h (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)" . |
|
2981 then have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (h \<circ> f) x) - h y) < e" |
|
2982 apply (simp add: diff[symmetric]) |
|
2983 apply (rule le_less_trans[OF B(2)]) |
|
2984 using g(2)[OF as] B(1) |
|
2985 apply (auto simp add: field_simps) |
|
2986 done |
|
2987 } |
|
2988 with g show ?case |
|
2989 by (rule_tac x=g in exI) auto |
|
2990 qed |
|
2991 { |
|
2992 presume "\<not> (\<exists>a b. s = cbox a b) \<Longrightarrow> ?thesis" |
|
2993 then show ?thesis |
|
2994 using assms(1) lem by blast |
|
2995 } |
|
2996 assume as: "\<not> (\<exists>a b. s = cbox a b)" |
|
2997 then show ?thesis |
|
2998 proof (subst has_integral_alt, clarsimp) |
|
2999 fix e :: real |
|
3000 assume e: "e > 0" |
|
3001 have *: "0 < e/B" using e B(1) by simp |
|
3002 obtain M where M: |
|
3003 "M > 0" |
|
3004 "\<And>a b. ball 0 M \<subseteq> cbox a b \<Longrightarrow> |
|
3005 \<exists>z. ((\<lambda>x. if x \<in> s then f x else 0) has_integral z) (cbox a b) \<and> norm (z - y) < e / B" |
|
3006 using has_integral_altD[OF assms(1) as *] by blast |
|
3007 show "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> |
|
3008 (\<exists>z. ((\<lambda>x. if x \<in> s then (h \<circ> f) x else 0) has_integral z) (cbox a b) \<and> norm (z - h y) < e)" |
|
3009 proof (rule_tac x=M in exI, clarsimp simp add: M, goal_cases) |
|
3010 case prems: (1 a b) |
|
3011 obtain z where z: |
|
3012 "((\<lambda>x. if x \<in> s then f x else 0) has_integral z) (cbox a b)" |
|
3013 "norm (z - y) < e / B" |
|
3014 using M(2)[OF prems(1)] by blast |
|
3015 have *: "(\<lambda>x. if x \<in> s then (h \<circ> f) x else 0) = h \<circ> (\<lambda>x. if x \<in> s then f x else 0)" |
|
3016 using zero by auto |
|
3017 show ?case |
|
3018 apply (rule_tac x="h z" in exI) |
|
3019 apply (simp add: * lem z(1)) |
|
3020 apply (metis B diff le_less_trans pos_less_divide_eq z(2)) |
|
3021 done |
|
3022 qed |
|
3023 qed |
|
3024 qed |
|
3025 |
|
3026 lemma has_integral_scaleR_left: |
|
3027 "(f has_integral y) s \<Longrightarrow> ((\<lambda>x. f x *\<^sub>R c) has_integral (y *\<^sub>R c)) s" |
|
3028 using has_integral_linear[OF _ bounded_linear_scaleR_left] by (simp add: comp_def) |
|
3029 |
|
3030 lemma has_integral_mult_left: |
|
3031 fixes c :: "_ :: real_normed_algebra" |
|
3032 shows "(f has_integral y) s \<Longrightarrow> ((\<lambda>x. f x * c) has_integral (y * c)) s" |
|
3033 using has_integral_linear[OF _ bounded_linear_mult_left] by (simp add: comp_def) |
|
3034 |
|
3035 text\<open>The case analysis eliminates the condition @{term "f integrable_on s"} at the cost |
|
3036 of the type class constraint \<open>division_ring\<close>\<close> |
|
3037 corollary integral_mult_left [simp]: |
|
3038 fixes c:: "'a::{real_normed_algebra,division_ring}" |
|
3039 shows "integral s (\<lambda>x. f x * c) = integral s f * c" |
|
3040 proof (cases "f integrable_on s \<or> c = 0") |
|
3041 case True then show ?thesis |
|
3042 by (force intro: has_integral_mult_left) |
|
3043 next |
|
3044 case False then have "~ (\<lambda>x. f x * c) integrable_on s" |
|
3045 using has_integral_mult_left [of "(\<lambda>x. f x * c)" _ s "inverse c"] |
|
3046 by (force simp add: mult.assoc) |
|
3047 with False show ?thesis by (simp add: not_integrable_integral) |
|
3048 qed |
|
3049 |
|
3050 corollary integral_mult_right [simp]: |
|
3051 fixes c:: "'a::{real_normed_field}" |
|
3052 shows "integral s (\<lambda>x. c * f x) = c * integral s f" |
|
3053 by (simp add: mult.commute [of c]) |
|
3054 |
|
3055 corollary integral_divide [simp]: |
|
3056 fixes z :: "'a::real_normed_field" |
|
3057 shows "integral S (\<lambda>x. f x / z) = integral S (\<lambda>x. f x) / z" |
|
3058 using integral_mult_left [of S f "inverse z"] |
|
3059 by (simp add: divide_inverse_commute) |
|
3060 |
|
3061 lemma has_integral_mult_right: |
|
3062 fixes c :: "'a :: real_normed_algebra" |
|
3063 shows "(f has_integral y) i \<Longrightarrow> ((\<lambda>x. c * f x) has_integral (c * y)) i" |
|
3064 using has_integral_linear[OF _ bounded_linear_mult_right] by (simp add: comp_def) |
|
3065 |
|
3066 lemma has_integral_cmul: "(f has_integral k) s \<Longrightarrow> ((\<lambda>x. c *\<^sub>R f x) has_integral (c *\<^sub>R k)) s" |
|
3067 unfolding o_def[symmetric] |
|
3068 by (metis has_integral_linear bounded_linear_scaleR_right) |
|
3069 |
|
3070 lemma has_integral_cmult_real: |
|
3071 fixes c :: real |
|
3072 assumes "c \<noteq> 0 \<Longrightarrow> (f has_integral x) A" |
|
3073 shows "((\<lambda>x. c * f x) has_integral c * x) A" |
|
3074 proof (cases "c = 0") |
|
3075 case True |
|
3076 then show ?thesis by simp |
|
3077 next |
|
3078 case False |
|
3079 from has_integral_cmul[OF assms[OF this], of c] show ?thesis |
|
3080 unfolding real_scaleR_def . |
|
3081 qed |
|
3082 |
|
3083 lemma has_integral_neg: "(f has_integral k) s \<Longrightarrow> ((\<lambda>x. -(f x)) has_integral -k) s" |
|
3084 by (drule_tac c="-1" in has_integral_cmul) auto |
|
3085 |
|
3086 lemma has_integral_add: |
|
3087 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::real_normed_vector" |
|
3088 assumes "(f has_integral k) s" |
|
3089 and "(g has_integral l) s" |
|
3090 shows "((\<lambda>x. f x + g x) has_integral (k + l)) s" |
|
3091 proof - |
|
3092 have lem: "((\<lambda>x. f x + g x) has_integral (k + l)) (cbox a b)" |
|
3093 if f_k: "(f has_integral k) (cbox a b)" |
|
3094 and g_l: "(g has_integral l) (cbox a b)" |
|
3095 for f :: "'n \<Rightarrow> 'a" and g a b k l |
|
3096 unfolding has_integral |
|
3097 proof clarify |
|
3098 fix e :: real |
|
3099 assume e: "e > 0" |
|
3100 then have *: "e / 2 > 0" |
|
3101 by auto |
|
3102 obtain d1 where d1: |
|
3103 "gauge d1" |
|
3104 "\<And>p. p tagged_division_of (cbox a b) \<Longrightarrow> d1 fine p \<Longrightarrow> |
|
3105 norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - k) < e / 2" |
|
3106 using has_integralD[OF f_k *] by blast |
|
3107 obtain d2 where d2: |
|
3108 "gauge d2" |
|
3109 "\<And>p. p tagged_division_of (cbox a b) \<Longrightarrow> d2 fine p \<Longrightarrow> |
|
3110 norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - l) < e / 2" |
|
3111 using has_integralD[OF g_l *] by blast |
|
3112 show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
|
3113 norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) - (k + l)) < e)" |
|
3114 proof (rule exI [where x="\<lambda>x. (d1 x) \<inter> (d2 x)"], clarsimp simp add: gauge_inter[OF d1(1) d2(1)]) |
|
3115 fix p |
|
3116 assume as: "p tagged_division_of (cbox a b)" "(\<lambda>x. d1 x \<inter> d2 x) fine p" |
|
3117 have *: "(\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) = |
|
3118 (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>p. content k *\<^sub>R g x)" |
|
3119 unfolding scaleR_right_distrib setsum.distrib[of "\<lambda>(x,k). content k *\<^sub>R f x" "\<lambda>(x,k). content k *\<^sub>R g x" p,symmetric] |
|
3120 by (rule setsum.cong) auto |
|
3121 from as have fine: "d1 fine p" "d2 fine p" |
|
3122 unfolding fine_inter by auto |
|
3123 have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) - (k + l)) = |
|
3124 norm (((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - k) + ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - l))" |
|
3125 unfolding * by (auto simp add: algebra_simps) |
|
3126 also have "\<dots> < e/2 + e/2" |
|
3127 apply (rule le_less_trans[OF norm_triangle_ineq]) |
|
3128 using as d1 d2 fine |
|
3129 apply (blast intro: add_strict_mono) |
|
3130 done |
|
3131 finally show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R (f x + g x)) - (k + l)) < e" |
|
3132 by auto |
|
3133 qed |
|
3134 qed |
|
3135 { |
|
3136 presume "\<not> (\<exists>a b. s = cbox a b) \<Longrightarrow> ?thesis" |
|
3137 then show ?thesis |
|
3138 using assms lem by force |
|
3139 } |
|
3140 assume as: "\<not> (\<exists>a b. s = cbox a b)" |
|
3141 then show ?thesis |
|
3142 proof (subst has_integral_alt, clarsimp, goal_cases) |
|
3143 case (1 e) |
|
3144 then have *: "e / 2 > 0" |
|
3145 by auto |
|
3146 from has_integral_altD[OF assms(1) as *] |
|
3147 obtain B1 where B1: |
|
3148 "0 < B1" |
|
3149 "\<And>a b. ball 0 B1 \<subseteq> cbox a b \<Longrightarrow> |
|
3150 \<exists>z. ((\<lambda>x. if x \<in> s then f x else 0) has_integral z) (cbox a b) \<and> norm (z - k) < e / 2" |
|
3151 by blast |
|
3152 from has_integral_altD[OF assms(2) as *] |
|
3153 obtain B2 where B2: |
|
3154 "0 < B2" |
|
3155 "\<And>a b. ball 0 B2 \<subseteq> (cbox a b) \<Longrightarrow> |
|
3156 \<exists>z. ((\<lambda>x. if x \<in> s then g x else 0) has_integral z) (cbox a b) \<and> norm (z - l) < e / 2" |
|
3157 by blast |
|
3158 show ?case |
|
3159 proof (rule_tac x="max B1 B2" in exI, clarsimp simp add: max.strict_coboundedI1 B1) |
|
3160 fix a b |
|
3161 assume "ball 0 (max B1 B2) \<subseteq> cbox a (b::'n)" |
|
3162 then have *: "ball 0 B1 \<subseteq> cbox a (b::'n)" "ball 0 B2 \<subseteq> cbox a (b::'n)" |
|
3163 by auto |
|
3164 obtain w where w: |
|
3165 "((\<lambda>x. if x \<in> s then f x else 0) has_integral w) (cbox a b)" |
|
3166 "norm (w - k) < e / 2" |
|
3167 using B1(2)[OF *(1)] by blast |
|
3168 obtain z where z: |
|
3169 "((\<lambda>x. if x \<in> s then g x else 0) has_integral z) (cbox a b)" |
|
3170 "norm (z - l) < e / 2" |
|
3171 using B2(2)[OF *(2)] by blast |
|
3172 have *: "\<And>x. (if x \<in> s then f x + g x else 0) = |
|
3173 (if x \<in> s then f x else 0) + (if x \<in> s then g x else 0)" |
|
3174 by auto |
|
3175 show "\<exists>z. ((\<lambda>x. if x \<in> s then f x + g x else 0) has_integral z) (cbox a b) \<and> norm (z - (k + l)) < e" |
|
3176 apply (rule_tac x="w + z" in exI) |
|
3177 apply (simp add: lem[OF w(1) z(1), unfolded *[symmetric]]) |
|
3178 using norm_triangle_ineq[of "w - k" "z - l"] w(2) z(2) |
|
3179 apply (auto simp add: field_simps) |
|
3180 done |
|
3181 qed |
|
3182 qed |
|
3183 qed |
|
3184 |
|
3185 lemma has_integral_sub: |
|
3186 "(f has_integral k) s \<Longrightarrow> (g has_integral l) s \<Longrightarrow> |
|
3187 ((\<lambda>x. f x - g x) has_integral (k - l)) s" |
|
3188 using has_integral_add[OF _ has_integral_neg, of f k s g l] |
|
3189 by (auto simp: algebra_simps) |
|
3190 |
|
3191 lemma integral_0 [simp]: |
|
3192 "integral s (\<lambda>x::'n::euclidean_space. 0::'m::real_normed_vector) = 0" |
|
3193 by (rule integral_unique has_integral_0)+ |
|
3194 |
|
3195 lemma integral_add: "f integrable_on s \<Longrightarrow> g integrable_on s \<Longrightarrow> |
|
3196 integral s (\<lambda>x. f x + g x) = integral s f + integral s g" |
|
3197 by (rule integral_unique) (metis integrable_integral has_integral_add) |
|
3198 |
|
3199 lemma integral_cmul [simp]: "integral s (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral s f" |
|
3200 proof (cases "f integrable_on s \<or> c = 0") |
|
3201 case True with has_integral_cmul show ?thesis by force |
|
3202 next |
|
3203 case False then have "~ (\<lambda>x. c *\<^sub>R f x) integrable_on s" |
|
3204 using has_integral_cmul [of "(\<lambda>x. c *\<^sub>R f x)" _ s "inverse c"] |
|
3205 by force |
|
3206 with False show ?thesis by (simp add: not_integrable_integral) |
|
3207 qed |
|
3208 |
|
3209 lemma integral_neg [simp]: "integral s (\<lambda>x. - f x) = - integral s f" |
|
3210 proof (cases "f integrable_on s") |
|
3211 case True then show ?thesis |
|
3212 by (simp add: has_integral_neg integrable_integral integral_unique) |
|
3213 next |
|
3214 case False then have "~ (\<lambda>x. - f x) integrable_on s" |
|
3215 using has_integral_neg [of "(\<lambda>x. - f x)" _ s ] |
|
3216 by force |
|
3217 with False show ?thesis by (simp add: not_integrable_integral) |
|
3218 qed |
|
3219 |
|
3220 lemma integral_diff: "f integrable_on s \<Longrightarrow> g integrable_on s \<Longrightarrow> |
|
3221 integral s (\<lambda>x. f x - g x) = integral s f - integral s g" |
|
3222 by (rule integral_unique) (metis integrable_integral has_integral_sub) |
|
3223 |
|
3224 lemma integrable_0: "(\<lambda>x. 0) integrable_on s" |
|
3225 unfolding integrable_on_def using has_integral_0 by auto |
|
3226 |
|
3227 lemma integrable_add: "f integrable_on s \<Longrightarrow> g integrable_on s \<Longrightarrow> (\<lambda>x. f x + g x) integrable_on s" |
|
3228 unfolding integrable_on_def by(auto intro: has_integral_add) |
|
3229 |
|
3230 lemma integrable_cmul: "f integrable_on s \<Longrightarrow> (\<lambda>x. c *\<^sub>R f(x)) integrable_on s" |
|
3231 unfolding integrable_on_def by(auto intro: has_integral_cmul) |
|
3232 |
|
3233 lemma integrable_on_cmult_iff: |
|
3234 fixes c :: real |
|
3235 assumes "c \<noteq> 0" |
|
3236 shows "(\<lambda>x. c * f x) integrable_on s \<longleftrightarrow> f integrable_on s" |
|
3237 using integrable_cmul[of "\<lambda>x. c * f x" s "1 / c"] integrable_cmul[of f s c] \<open>c \<noteq> 0\<close> |
|
3238 by auto |
|
3239 |
|
3240 lemma integrable_on_cmult_left: |
|
3241 assumes "f integrable_on s" |
|
3242 shows "(\<lambda>x. of_real c * f x) integrable_on s" |
|
3243 using integrable_cmul[of f s "of_real c"] assms |
|
3244 by (simp add: scaleR_conv_of_real) |
|
3245 |
|
3246 lemma integrable_neg: "f integrable_on s \<Longrightarrow> (\<lambda>x. -f(x)) integrable_on s" |
|
3247 unfolding integrable_on_def by(auto intro: has_integral_neg) |
|
3248 |
|
3249 lemma integrable_diff: |
|
3250 "f integrable_on s \<Longrightarrow> g integrable_on s \<Longrightarrow> (\<lambda>x. f x - g x) integrable_on s" |
|
3251 unfolding integrable_on_def by(auto intro: has_integral_sub) |
|
3252 |
|
3253 lemma integrable_linear: |
|
3254 "f integrable_on s \<Longrightarrow> bounded_linear h \<Longrightarrow> (h \<circ> f) integrable_on s" |
|
3255 unfolding integrable_on_def by(auto intro: has_integral_linear) |
|
3256 |
|
3257 lemma integral_linear: |
|
3258 "f integrable_on s \<Longrightarrow> bounded_linear h \<Longrightarrow> integral s (h \<circ> f) = h (integral s f)" |
|
3259 apply (rule has_integral_unique [where i=s and f = "h \<circ> f"]) |
|
3260 apply (simp_all add: integrable_integral integrable_linear has_integral_linear ) |
|
3261 done |
|
3262 |
|
3263 lemma integral_component_eq[simp]: |
|
3264 fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
3265 assumes "f integrable_on s" |
|
3266 shows "integral s (\<lambda>x. f x \<bullet> k) = integral s f \<bullet> k" |
|
3267 unfolding integral_linear[OF assms(1) bounded_linear_component,unfolded o_def] .. |
|
3268 |
|
3269 lemma has_integral_setsum: |
|
3270 assumes "finite t" |
|
3271 and "\<forall>a\<in>t. ((f a) has_integral (i a)) s" |
|
3272 shows "((\<lambda>x. setsum (\<lambda>a. f a x) t) has_integral (setsum i t)) s" |
|
3273 using assms(1) subset_refl[of t] |
|
3274 proof (induct rule: finite_subset_induct) |
|
3275 case empty |
|
3276 then show ?case by auto |
|
3277 next |
|
3278 case (insert x F) |
|
3279 with assms show ?case |
|
3280 by (simp add: has_integral_add) |
|
3281 qed |
|
3282 |
|
3283 lemma integral_setsum: |
|
3284 "\<lbrakk>finite t; \<forall>a\<in>t. (f a) integrable_on s\<rbrakk> \<Longrightarrow> |
|
3285 integral s (\<lambda>x. setsum (\<lambda>a. f a x) t) = setsum (\<lambda>a. integral s (f a)) t" |
|
3286 by (auto intro: has_integral_setsum integrable_integral) |
|
3287 |
|
3288 lemma integrable_setsum: |
|
3289 "\<lbrakk>finite t; \<forall>a\<in>t. (f a) integrable_on s\<rbrakk> \<Longrightarrow> (\<lambda>x. setsum (\<lambda>a. f a x) t) integrable_on s" |
|
3290 unfolding integrable_on_def |
|
3291 apply (drule bchoice) |
|
3292 using has_integral_setsum[of t] |
|
3293 apply auto |
|
3294 done |
|
3295 |
|
3296 lemma has_integral_eq: |
|
3297 assumes "\<And>x. x \<in> s \<Longrightarrow> f x = g x" |
|
3298 and "(f has_integral k) s" |
|
3299 shows "(g has_integral k) s" |
|
3300 using has_integral_sub[OF assms(2), of "\<lambda>x. f x - g x" 0] |
|
3301 using has_integral_is_0[of s "\<lambda>x. f x - g x"] |
|
3302 using assms(1) |
|
3303 by auto |
|
3304 |
|
3305 lemma integrable_eq: "(\<And>x. x \<in> s \<Longrightarrow> f x = g x) \<Longrightarrow> f integrable_on s \<Longrightarrow> g integrable_on s" |
|
3306 unfolding integrable_on_def |
|
3307 using has_integral_eq[of s f g] has_integral_eq by blast |
|
3308 |
|
3309 lemma has_integral_cong: |
|
3310 assumes "\<And>x. x \<in> s \<Longrightarrow> f x = g x" |
|
3311 shows "(f has_integral i) s = (g has_integral i) s" |
|
3312 using has_integral_eq[of s f g] has_integral_eq[of s g f] assms |
|
3313 by auto |
|
3314 |
|
3315 lemma integral_cong: |
|
3316 assumes "\<And>x. x \<in> s \<Longrightarrow> f x = g x" |
|
3317 shows "integral s f = integral s g" |
|
3318 unfolding integral_def |
|
3319 by (metis (full_types, hide_lams) assms has_integral_cong integrable_eq) |
|
3320 |
|
3321 lemma integrable_on_cmult_left_iff [simp]: |
|
3322 assumes "c \<noteq> 0" |
|
3323 shows "(\<lambda>x. of_real c * f x) integrable_on s \<longleftrightarrow> f integrable_on s" |
|
3324 (is "?lhs = ?rhs") |
|
3325 proof |
|
3326 assume ?lhs |
|
3327 then have "(\<lambda>x. of_real (1 / c) * (of_real c * f x)) integrable_on s" |
|
3328 using integrable_cmul[of "\<lambda>x. of_real c * f x" s "1 / of_real c"] |
|
3329 by (simp add: scaleR_conv_of_real) |
|
3330 then have "(\<lambda>x. (of_real (1 / c) * of_real c * f x)) integrable_on s" |
|
3331 by (simp add: algebra_simps) |
|
3332 with \<open>c \<noteq> 0\<close> show ?rhs |
|
3333 by (metis (no_types, lifting) integrable_eq mult.left_neutral nonzero_divide_eq_eq of_real_1 of_real_mult) |
|
3334 qed (blast intro: integrable_on_cmult_left) |
|
3335 |
|
3336 lemma integrable_on_cmult_right: |
|
3337 fixes f :: "_ \<Rightarrow> 'b :: {comm_ring,real_algebra_1,real_normed_vector}" |
|
3338 assumes "f integrable_on s" |
|
3339 shows "(\<lambda>x. f x * of_real c) integrable_on s" |
|
3340 using integrable_on_cmult_left [OF assms] by (simp add: mult.commute) |
|
3341 |
|
3342 lemma integrable_on_cmult_right_iff [simp]: |
|
3343 fixes f :: "_ \<Rightarrow> 'b :: {comm_ring,real_algebra_1,real_normed_vector}" |
|
3344 assumes "c \<noteq> 0" |
|
3345 shows "(\<lambda>x. f x * of_real c) integrable_on s \<longleftrightarrow> f integrable_on s" |
|
3346 using integrable_on_cmult_left_iff [OF assms] by (simp add: mult.commute) |
|
3347 |
|
3348 lemma integrable_on_cdivide: |
|
3349 fixes f :: "_ \<Rightarrow> 'b :: real_normed_field" |
|
3350 assumes "f integrable_on s" |
|
3351 shows "(\<lambda>x. f x / of_real c) integrable_on s" |
|
3352 by (simp add: integrable_on_cmult_right divide_inverse assms of_real_inverse [symmetric] del: of_real_inverse) |
|
3353 |
|
3354 lemma integrable_on_cdivide_iff [simp]: |
|
3355 fixes f :: "_ \<Rightarrow> 'b :: real_normed_field" |
|
3356 assumes "c \<noteq> 0" |
|
3357 shows "(\<lambda>x. f x / of_real c) integrable_on s \<longleftrightarrow> f integrable_on s" |
|
3358 by (simp add: divide_inverse assms of_real_inverse [symmetric] del: of_real_inverse) |
|
3359 |
|
3360 lemma has_integral_null [intro]: |
|
3361 assumes "content(cbox a b) = 0" |
|
3362 shows "(f has_integral 0) (cbox a b)" |
|
3363 proof - |
|
3364 have "gauge (\<lambda>x. ball x 1)" |
|
3365 by auto |
|
3366 moreover |
|
3367 { |
|
3368 fix e :: real |
|
3369 fix p |
|
3370 assume e: "e > 0" |
|
3371 assume p: "p tagged_division_of (cbox a b)" |
|
3372 have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) = 0" |
|
3373 unfolding norm_eq_zero diff_0_right |
|
3374 using setsum_content_null[OF assms(1) p, of f] . |
|
3375 then have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) < e" |
|
3376 using e by auto |
|
3377 } |
|
3378 ultimately show ?thesis |
|
3379 by (auto simp: has_integral) |
|
3380 qed |
|
3381 |
|
3382 lemma has_integral_null_real [intro]: |
|
3383 assumes "content {a .. b::real} = 0" |
|
3384 shows "(f has_integral 0) {a .. b}" |
|
3385 by (metis assms box_real(2) has_integral_null) |
|
3386 |
|
3387 lemma has_integral_null_eq[simp]: "content (cbox a b) = 0 \<Longrightarrow> (f has_integral i) (cbox a b) \<longleftrightarrow> i = 0" |
|
3388 by (auto simp add: has_integral_null dest!: integral_unique) |
|
3389 |
|
3390 lemma integral_null [simp]: "content (cbox a b) = 0 \<Longrightarrow> integral (cbox a b) f = 0" |
|
3391 by (metis has_integral_null integral_unique) |
|
3392 |
|
3393 lemma integrable_on_null [intro]: "content (cbox a b) = 0 \<Longrightarrow> f integrable_on (cbox a b)" |
|
3394 by (simp add: has_integral_integrable) |
|
3395 |
|
3396 lemma has_integral_empty[intro]: "(f has_integral 0) {}" |
|
3397 by (simp add: has_integral_is_0) |
|
3398 |
|
3399 lemma has_integral_empty_eq[simp]: "(f has_integral i) {} \<longleftrightarrow> i = 0" |
|
3400 by (auto simp add: has_integral_empty has_integral_unique) |
|
3401 |
|
3402 lemma integrable_on_empty[intro]: "f integrable_on {}" |
|
3403 unfolding integrable_on_def by auto |
|
3404 |
|
3405 lemma integral_empty[simp]: "integral {} f = 0" |
|
3406 by (rule integral_unique) (rule has_integral_empty) |
|
3407 |
|
3408 lemma has_integral_refl[intro]: |
|
3409 fixes a :: "'a::euclidean_space" |
|
3410 shows "(f has_integral 0) (cbox a a)" |
|
3411 and "(f has_integral 0) {a}" |
|
3412 proof - |
|
3413 have *: "{a} = cbox a a" |
|
3414 apply (rule set_eqI) |
|
3415 unfolding mem_box singleton_iff euclidean_eq_iff[where 'a='a] |
|
3416 apply safe |
|
3417 prefer 3 |
|
3418 apply (erule_tac x=b in ballE) |
|
3419 apply (auto simp add: field_simps) |
|
3420 done |
|
3421 show "(f has_integral 0) (cbox a a)" "(f has_integral 0) {a}" |
|
3422 unfolding * |
|
3423 apply (rule_tac[!] has_integral_null) |
|
3424 unfolding content_eq_0_interior |
|
3425 unfolding interior_cbox |
|
3426 using box_sing |
|
3427 apply auto |
|
3428 done |
|
3429 qed |
|
3430 |
|
3431 lemma integrable_on_refl[intro]: "f integrable_on cbox a a" |
|
3432 unfolding integrable_on_def by auto |
|
3433 |
|
3434 lemma integral_refl [simp]: "integral (cbox a a) f = 0" |
|
3435 by (rule integral_unique) auto |
|
3436 |
|
3437 lemma integral_singleton [simp]: "integral {a} f = 0" |
|
3438 by auto |
|
3439 |
|
3440 lemma integral_blinfun_apply: |
|
3441 assumes "f integrable_on s" |
|
3442 shows "integral s (\<lambda>x. blinfun_apply h (f x)) = blinfun_apply h (integral s f)" |
|
3443 by (subst integral_linear[symmetric, OF assms blinfun.bounded_linear_right]) (simp add: o_def) |
|
3444 |
|
3445 lemma blinfun_apply_integral: |
|
3446 assumes "f integrable_on s" |
|
3447 shows "blinfun_apply (integral s f) x = integral s (\<lambda>y. blinfun_apply (f y) x)" |
|
3448 by (metis (no_types, lifting) assms blinfun.prod_left.rep_eq integral_blinfun_apply integral_cong) |
|
3449 |
|
3450 lemma has_integral_componentwise_iff: |
|
3451 fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space" |
|
3452 shows "(f has_integral y) A \<longleftrightarrow> (\<forall>b\<in>Basis. ((\<lambda>x. f x \<bullet> b) has_integral (y \<bullet> b)) A)" |
|
3453 proof safe |
|
3454 fix b :: 'b assume "(f has_integral y) A" |
|
3455 from has_integral_linear[OF this(1) bounded_linear_component, of b] |
|
3456 show "((\<lambda>x. f x \<bullet> b) has_integral (y \<bullet> b)) A" by (simp add: o_def) |
|
3457 next |
|
3458 assume "(\<forall>b\<in>Basis. ((\<lambda>x. f x \<bullet> b) has_integral (y \<bullet> b)) A)" |
|
3459 hence "\<forall>b\<in>Basis. (((\<lambda>x. x *\<^sub>R b) \<circ> (\<lambda>x. f x \<bullet> b)) has_integral ((y \<bullet> b) *\<^sub>R b)) A" |
|
3460 by (intro ballI has_integral_linear) (simp_all add: bounded_linear_scaleR_left) |
|
3461 hence "((\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) has_integral (\<Sum>b\<in>Basis. (y \<bullet> b) *\<^sub>R b)) A" |
|
3462 by (intro has_integral_setsum) (simp_all add: o_def) |
|
3463 thus "(f has_integral y) A" by (simp add: euclidean_representation) |
|
3464 qed |
|
3465 |
|
3466 lemma has_integral_componentwise: |
|
3467 fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space" |
|
3468 shows "(\<And>b. b \<in> Basis \<Longrightarrow> ((\<lambda>x. f x \<bullet> b) has_integral (y \<bullet> b)) A) \<Longrightarrow> (f has_integral y) A" |
|
3469 by (subst has_integral_componentwise_iff) blast |
|
3470 |
|
3471 lemma integrable_componentwise_iff: |
|
3472 fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space" |
|
3473 shows "f integrable_on A \<longleftrightarrow> (\<forall>b\<in>Basis. (\<lambda>x. f x \<bullet> b) integrable_on A)" |
|
3474 proof |
|
3475 assume "f integrable_on A" |
|
3476 then obtain y where "(f has_integral y) A" by (auto simp: integrable_on_def) |
|
3477 hence "(\<forall>b\<in>Basis. ((\<lambda>x. f x \<bullet> b) has_integral (y \<bullet> b)) A)" |
|
3478 by (subst (asm) has_integral_componentwise_iff) |
|
3479 thus "(\<forall>b\<in>Basis. (\<lambda>x. f x \<bullet> b) integrable_on A)" by (auto simp: integrable_on_def) |
|
3480 next |
|
3481 assume "(\<forall>b\<in>Basis. (\<lambda>x. f x \<bullet> b) integrable_on A)" |
|
3482 then obtain y where "\<forall>b\<in>Basis. ((\<lambda>x. f x \<bullet> b) has_integral y b) A" |
|
3483 unfolding integrable_on_def by (subst (asm) bchoice_iff) blast |
|
3484 hence "\<forall>b\<in>Basis. (((\<lambda>x. x *\<^sub>R b) \<circ> (\<lambda>x. f x \<bullet> b)) has_integral (y b *\<^sub>R b)) A" |
|
3485 by (intro ballI has_integral_linear) (simp_all add: bounded_linear_scaleR_left) |
|
3486 hence "((\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) has_integral (\<Sum>b\<in>Basis. y b *\<^sub>R b)) A" |
|
3487 by (intro has_integral_setsum) (simp_all add: o_def) |
|
3488 thus "f integrable_on A" by (auto simp: integrable_on_def o_def euclidean_representation) |
|
3489 qed |
|
3490 |
|
3491 lemma integrable_componentwise: |
|
3492 fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space" |
|
3493 shows "(\<And>b. b \<in> Basis \<Longrightarrow> (\<lambda>x. f x \<bullet> b) integrable_on A) \<Longrightarrow> f integrable_on A" |
|
3494 by (subst integrable_componentwise_iff) blast |
|
3495 |
|
3496 lemma integral_componentwise: |
|
3497 fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: euclidean_space" |
|
3498 assumes "f integrable_on A" |
|
3499 shows "integral A f = (\<Sum>b\<in>Basis. integral A (\<lambda>x. (f x \<bullet> b) *\<^sub>R b))" |
|
3500 proof - |
|
3501 from assms have integrable: "\<forall>b\<in>Basis. (\<lambda>x. x *\<^sub>R b) \<circ> (\<lambda>x. (f x \<bullet> b)) integrable_on A" |
|
3502 by (subst (asm) integrable_componentwise_iff, intro integrable_linear ballI) |
|
3503 (simp_all add: bounded_linear_scaleR_left) |
|
3504 have "integral A f = integral A (\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b)" |
|
3505 by (simp add: euclidean_representation) |
|
3506 also from integrable have "\<dots> = (\<Sum>a\<in>Basis. integral A (\<lambda>x. (f x \<bullet> a) *\<^sub>R a))" |
|
3507 by (subst integral_setsum) (simp_all add: o_def) |
|
3508 finally show ?thesis . |
|
3509 qed |
|
3510 |
|
3511 lemma integrable_component: |
|
3512 "f integrable_on A \<Longrightarrow> (\<lambda>x. f x \<bullet> (y :: 'b :: euclidean_space)) integrable_on A" |
|
3513 by (drule integrable_linear[OF _ bounded_linear_component[of y]]) (simp add: o_def) |
|
3514 |
|
3515 |
|
3516 |
|
3517 subsection \<open>Cauchy-type criterion for integrability.\<close> |
|
3518 |
|
3519 (* XXXXXXX *) |
|
3520 lemma integrable_cauchy: |
|
3521 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::{real_normed_vector,complete_space}" |
|
3522 shows "f integrable_on cbox a b \<longleftrightarrow> |
|
3523 (\<forall>e>0.\<exists>d. gauge d \<and> |
|
3524 (\<forall>p1 p2. p1 tagged_division_of (cbox a b) \<and> d fine p1 \<and> |
|
3525 p2 tagged_division_of (cbox a b) \<and> d fine p2 \<longrightarrow> |
|
3526 norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p1 - |
|
3527 setsum (\<lambda>(x,k). content k *\<^sub>R f x) p2) < e))" |
|
3528 (is "?l = (\<forall>e>0. \<exists>d. ?P e d)") |
|
3529 proof |
|
3530 assume ?l |
|
3531 then guess y unfolding integrable_on_def has_integral .. note y=this |
|
3532 show "\<forall>e>0. \<exists>d. ?P e d" |
|
3533 proof (clarify, goal_cases) |
|
3534 case (1 e) |
|
3535 then have "e/2 > 0" by auto |
|
3536 then guess d |
|
3537 apply - |
|
3538 apply (drule y[rule_format]) |
|
3539 apply (elim exE conjE) |
|
3540 done |
|
3541 note d=this[rule_format] |
|
3542 show ?case |
|
3543 proof (rule_tac x=d in exI, clarsimp simp: d) |
|
3544 fix p1 p2 |
|
3545 assume as: "p1 tagged_division_of (cbox a b)" "d fine p1" |
|
3546 "p2 tagged_division_of (cbox a b)" "d fine p2" |
|
3547 show "norm ((\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x)) < e" |
|
3548 apply (rule dist_triangle_half_l[where y=y,unfolded dist_norm]) |
|
3549 using d(2)[OF conjI[OF as(1-2)]] d(2)[OF conjI[OF as(3-4)]] . |
|
3550 qed |
|
3551 qed |
|
3552 next |
|
3553 assume "\<forall>e>0. \<exists>d. ?P e d" |
|
3554 then have "\<forall>n::nat. \<exists>d. ?P (inverse(of_nat (n + 1))) d" |
|
3555 by auto |
|
3556 from choice[OF this] guess d .. note d=conjunctD2[OF this[rule_format],rule_format] |
|
3557 have "\<And>n. gauge (\<lambda>x. \<Inter>{d i x |i. i \<in> {0..n}})" |
|
3558 apply (rule gauge_inters) |
|
3559 using d(1) |
|
3560 apply auto |
|
3561 done |
|
3562 then have "\<forall>n. \<exists>p. p tagged_division_of (cbox a b) \<and> (\<lambda>x. \<Inter>{d i x |i. i \<in> {0..n}}) fine p" |
|
3563 by (meson fine_division_exists) |
|
3564 from choice[OF this] guess p .. note p = conjunctD2[OF this[rule_format]] |
|
3565 have dp: "\<And>i n. i\<le>n \<Longrightarrow> d i fine p n" |
|
3566 using p(2) unfolding fine_inters by auto |
|
3567 have "Cauchy (\<lambda>n. setsum (\<lambda>(x,k). content k *\<^sub>R (f x)) (p n))" |
|
3568 proof (rule CauchyI, goal_cases) |
|
3569 case (1 e) |
|
3570 then guess N unfolding real_arch_inverse[of e] .. note N=this |
|
3571 show ?case |
|
3572 apply (rule_tac x=N in exI) |
|
3573 proof clarify |
|
3574 fix m n |
|
3575 assume mn: "N \<le> m" "N \<le> n" |
|
3576 have *: "N = (N - 1) + 1" using N by auto |
|
3577 show "norm ((\<Sum>(x, k)\<in>p m. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p n. content k *\<^sub>R f x)) < e" |
|
3578 apply (rule less_trans[OF _ N[THEN conjunct2,THEN conjunct2]]) |
|
3579 apply(subst *) |
|
3580 using dp p(1) mn d(2) by auto |
|
3581 qed |
|
3582 qed |
|
3583 then guess y unfolding convergent_eq_cauchy[symmetric] .. note y=this[THEN LIMSEQ_D] |
|
3584 show ?l |
|
3585 unfolding integrable_on_def has_integral |
|
3586 proof (rule_tac x=y in exI, clarify) |
|
3587 fix e :: real |
|
3588 assume "e>0" |
|
3589 then have *:"e/2 > 0" by auto |
|
3590 then guess N1 unfolding real_arch_inverse[of "e/2"] .. note N1=this |
|
3591 then have N1': "N1 = N1 - 1 + 1" |
|
3592 by auto |
|
3593 guess N2 using y[OF *] .. note N2=this |
|
3594 have "gauge (d (N1 + N2))" |
|
3595 using d by auto |
|
3596 moreover |
|
3597 { |
|
3598 fix q |
|
3599 assume as: "q tagged_division_of (cbox a b)" "d (N1 + N2) fine q" |
|
3600 have *: "inverse (of_nat (N1 + N2 + 1)) < e / 2" |
|
3601 apply (rule less_trans) |
|
3602 using N1 |
|
3603 apply auto |
|
3604 done |
|
3605 have "norm ((\<Sum>(x, k)\<in>q. content k *\<^sub>R f x) - y) < e" |
|
3606 apply (rule norm_triangle_half_r) |
|
3607 apply (rule less_trans[OF _ *]) |
|
3608 apply (subst N1', rule d(2)[of "p (N1+N2)"]) |
|
3609 using N1' as(1) as(2) dp |
|
3610 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>) |
|
3611 using N2 le_add2 by blast |
|
3612 } |
|
3613 ultimately show "\<exists>d. gauge d \<and> |
|
3614 (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
|
3615 norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - y) < e)" |
|
3616 by (rule_tac x="d (N1 + N2)" in exI) auto |
|
3617 qed |
|
3618 qed |
|
3619 |
|
3620 |
|
3621 subsection \<open>Additivity of integral on abutting intervals.\<close> |
|
3622 |
|
3623 lemma tagged_division_split_left_inj: |
|
3624 fixes x1 :: "'a::euclidean_space" |
|
3625 assumes d: "d tagged_division_of i" |
|
3626 and k12: "(x1, k1) \<in> d" |
|
3627 "(x2, k2) \<in> d" |
|
3628 "k1 \<noteq> k2" |
|
3629 "k1 \<inter> {x. x\<bullet>k \<le> c} = k2 \<inter> {x. x\<bullet>k \<le> c}" |
|
3630 "k \<in> Basis" |
|
3631 shows "content (k1 \<inter> {x. x\<bullet>k \<le> c}) = 0" |
|
3632 proof - |
|
3633 have *: "\<And>a b c. (a,b) \<in> c \<Longrightarrow> b \<in> snd ` c" |
|
3634 by force |
|
3635 show ?thesis |
|
3636 using k12 |
|
3637 by (fastforce intro!: division_split_left_inj[OF division_of_tagged_division[OF d]] *) |
|
3638 qed |
|
3639 |
|
3640 lemma tagged_division_split_right_inj: |
|
3641 fixes x1 :: "'a::euclidean_space" |
|
3642 assumes d: "d tagged_division_of i" |
|
3643 and k12: "(x1, k1) \<in> d" |
|
3644 "(x2, k2) \<in> d" |
|
3645 "k1 \<noteq> k2" |
|
3646 "k1 \<inter> {x. x\<bullet>k \<ge> c} = k2 \<inter> {x. x\<bullet>k \<ge> c}" |
|
3647 "k \<in> Basis" |
|
3648 shows "content (k1 \<inter> {x. x\<bullet>k \<ge> c}) = 0" |
|
3649 proof - |
|
3650 have *: "\<And>a b c. (a,b) \<in> c \<Longrightarrow> b \<in> snd ` c" |
|
3651 by force |
|
3652 show ?thesis |
|
3653 using k12 |
|
3654 by (fastforce intro!: division_split_right_inj[OF division_of_tagged_division[OF d]] *) |
|
3655 qed |
|
3656 |
|
3657 lemma has_integral_split: |
|
3658 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
|
3659 assumes fi: "(f has_integral i) (cbox a b \<inter> {x. x\<bullet>k \<le> c})" |
|
3660 and fj: "(f has_integral j) (cbox a b \<inter> {x. x\<bullet>k \<ge> c})" |
|
3661 and k: "k \<in> Basis" |
|
3662 shows "(f has_integral (i + j)) (cbox a b)" |
|
3663 proof (unfold has_integral, rule, rule, goal_cases) |
|
3664 case (1 e) |
|
3665 then have e: "e/2 > 0" |
|
3666 by auto |
|
3667 obtain d1 |
|
3668 where d1: "gauge d1" |
|
3669 and d1norm: |
|
3670 "\<And>p. \<lbrakk>p tagged_division_of cbox a b \<inter> {x. x \<bullet> k \<le> c}; |
|
3671 d1 fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k) \<in> p. content k *\<^sub>R f x) - i) < e / 2" |
|
3672 apply (rule has_integralD[OF fi[unfolded interval_split[OF k]] e]) |
|
3673 apply (simp add: interval_split[symmetric] k) |
|
3674 done |
|
3675 obtain d2 |
|
3676 where d2: "gauge d2" |
|
3677 and d2norm: |
|
3678 "\<And>p. \<lbrakk>p tagged_division_of cbox a b \<inter> {x. c \<le> x \<bullet> k}; |
|
3679 d2 fine p\<rbrakk> \<Longrightarrow> norm ((\<Sum>(x, k) \<in> p. content k *\<^sub>R f x) - j) < e / 2" |
|
3680 apply (rule has_integralD[OF fj[unfolded interval_split[OF k]] e]) |
|
3681 apply (simp add: interval_split[symmetric] k) |
|
3682 done |
|
3683 let ?d = "\<lambda>x. if x\<bullet>k = c then (d1 x \<inter> d2 x) else ball x \<bar>x\<bullet>k - c\<bar> \<inter> d1 x \<inter> d2 x" |
|
3684 have "gauge ?d" |
|
3685 using d1 d2 unfolding gauge_def by auto |
|
3686 then show ?case |
|
3687 proof (rule_tac x="?d" in exI, safe) |
|
3688 fix p |
|
3689 assume "p tagged_division_of (cbox a b)" "?d fine p" |
|
3690 note p = this tagged_division_ofD[OF this(1)] |
|
3691 have xk_le_c: "\<And>x kk. (x, kk) \<in> p \<Longrightarrow> kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {} \<Longrightarrow> x\<bullet>k \<le> c" |
|
3692 proof - |
|
3693 fix x kk |
|
3694 assume as: "(x, kk) \<in> p" and kk: "kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}" |
|
3695 show "x\<bullet>k \<le> c" |
|
3696 proof (rule ccontr) |
|
3697 assume **: "\<not> ?thesis" |
|
3698 from this[unfolded not_le] |
|
3699 have "kk \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>" |
|
3700 using p(2)[unfolded fine_def, rule_format,OF as] by auto |
|
3701 with kk obtain y where y: "y \<in> ball x \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<le> c" |
|
3702 by blast |
|
3703 then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>" |
|
3704 using Basis_le_norm[OF k, of "x - y"] |
|
3705 by (auto simp add: dist_norm inner_diff_left intro: le_less_trans) |
|
3706 with y show False |
|
3707 using ** by (auto simp add: field_simps) |
|
3708 qed |
|
3709 qed |
|
3710 have xk_ge_c: "\<And>x kk. (x, kk) \<in> p \<Longrightarrow> kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {} \<Longrightarrow> x\<bullet>k \<ge> c" |
|
3711 proof - |
|
3712 fix x kk |
|
3713 assume as: "(x, kk) \<in> p" and kk: "kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}" |
|
3714 show "x\<bullet>k \<ge> c" |
|
3715 proof (rule ccontr) |
|
3716 assume **: "\<not> ?thesis" |
|
3717 from this[unfolded not_le] have "kk \<subseteq> ball x \<bar>x \<bullet> k - c\<bar>" |
|
3718 using p(2)[unfolded fine_def,rule_format,OF as,unfolded split_conv] by auto |
|
3719 with kk obtain y where y: "y \<in> ball x \<bar>x \<bullet> k - c\<bar>" "y\<bullet>k \<ge> c" |
|
3720 by blast |
|
3721 then have "\<bar>x \<bullet> k - y \<bullet> k\<bar> < \<bar>x \<bullet> k - c\<bar>" |
|
3722 using Basis_le_norm[OF k, of "x - y"] |
|
3723 by (auto simp add: dist_norm inner_diff_left intro: le_less_trans) |
|
3724 with y show False |
|
3725 using ** by (auto simp add: field_simps) |
|
3726 qed |
|
3727 qed |
|
3728 |
|
3729 have lem1: "\<And>f P Q. (\<forall>x k. (x, k) \<in> {(x, f k) | x k. P x k} \<longrightarrow> Q x k) \<longleftrightarrow> |
|
3730 (\<forall>x k. P x k \<longrightarrow> Q x (f k))" |
|
3731 by auto |
|
3732 have fin_finite: "finite {(x,f k) | x k. (x,k) \<in> s \<and> P x k}" if "finite s" for f s P |
|
3733 proof - |
|
3734 from that have "finite ((\<lambda>(x, k). (x, f k)) ` s)" |
|
3735 by auto |
|
3736 then show ?thesis |
|
3737 by (rule rev_finite_subset) auto |
|
3738 qed |
|
3739 { fix g :: "'a set \<Rightarrow> 'a set" |
|
3740 fix i :: "'a \<times> 'a set" |
|
3741 assume "i \<in> (\<lambda>(x, k). (x, g k)) ` p - {(x, g k) |x k. (x, k) \<in> p \<and> g k \<noteq> {}}" |
|
3742 then obtain x k where xk: |
|
3743 "i = (x, g k)" "(x, k) \<in> p" |
|
3744 "(x, g k) \<notin> {(x, g k) |x k. (x, k) \<in> p \<and> g k \<noteq> {}}" |
|
3745 by auto |
|
3746 have "content (g k) = 0" |
|
3747 using xk using content_empty by auto |
|
3748 then have "(\<lambda>(x, k). content k *\<^sub>R f x) i = 0" |
|
3749 unfolding xk split_conv by auto |
|
3750 } note [simp] = this |
|
3751 have lem3: "\<And>g :: 'a set \<Rightarrow> 'a set. finite p \<Longrightarrow> |
|
3752 setsum (\<lambda>(x, k). content k *\<^sub>R f x) {(x,g k) |x k. (x,k) \<in> p \<and> g k \<noteq> {}} = |
|
3753 setsum (\<lambda>(x, k). content k *\<^sub>R f x) ((\<lambda>(x, k). (x, g k)) ` p)" |
|
3754 by (rule setsum.mono_neutral_left) auto |
|
3755 let ?M1 = "{(x, kk \<inter> {x. x\<bullet>k \<le> c}) |x kk. (x, kk) \<in> p \<and> kk \<inter> {x. x\<bullet>k \<le> c} \<noteq> {}}" |
|
3756 have d1_fine: "d1 fine ?M1" |
|
3757 by (force intro: fineI dest: fineD[OF p(2)] simp add: split: if_split_asm) |
|
3758 have "norm ((\<Sum>(x, k)\<in>?M1. content k *\<^sub>R f x) - i) < e/2" |
|
3759 proof (rule d1norm [OF tagged_division_ofI d1_fine]) |
|
3760 show "finite ?M1" |
|
3761 by (rule fin_finite p(3))+ |
|
3762 show "\<Union>{k. \<exists>x. (x, k) \<in> ?M1} = cbox a b \<inter> {x. x\<bullet>k \<le> c}" |
|
3763 unfolding p(8)[symmetric] by auto |
|
3764 fix x l |
|
3765 assume xl: "(x, l) \<in> ?M1" |
|
3766 then guess x' l' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note xl'=this |
|
3767 show "x \<in> l" "l \<subseteq> cbox a b \<inter> {x. x \<bullet> k \<le> c}" |
|
3768 unfolding xl' |
|
3769 using p(4-6)[OF xl'(3)] using xl'(4) |
|
3770 using xk_le_c[OF xl'(3-4)] by auto |
|
3771 show "\<exists>a b. l = cbox a b" |
|
3772 unfolding xl' |
|
3773 using p(6)[OF xl'(3)] |
|
3774 by (fastforce simp add: interval_split[OF k,where c=c]) |
|
3775 fix y r |
|
3776 let ?goal = "interior l \<inter> interior r = {}" |
|
3777 assume yr: "(y, r) \<in> ?M1" |
|
3778 then guess y' r' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note yr'=this |
|
3779 assume as: "(x, l) \<noteq> (y, r)" |
|
3780 show "interior l \<inter> interior r = {}" |
|
3781 proof (cases "l' = r' \<longrightarrow> x' = y'") |
|
3782 case False |
|
3783 then show ?thesis |
|
3784 using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto |
|
3785 next |
|
3786 case True |
|
3787 then have "l' \<noteq> r'" |
|
3788 using as unfolding xl' yr' by auto |
|
3789 then show ?thesis |
|
3790 using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto |
|
3791 qed |
|
3792 qed |
|
3793 moreover |
|
3794 let ?M2 = "{(x,kk \<inter> {x. x\<bullet>k \<ge> c}) |x kk. (x,kk) \<in> p \<and> kk \<inter> {x. x\<bullet>k \<ge> c} \<noteq> {}}" |
|
3795 have d2_fine: "d2 fine ?M2" |
|
3796 by (force intro: fineI dest: fineD[OF p(2)] simp add: split: if_split_asm) |
|
3797 have "norm ((\<Sum>(x, k)\<in>?M2. content k *\<^sub>R f x) - j) < e/2" |
|
3798 proof (rule d2norm [OF tagged_division_ofI d2_fine]) |
|
3799 show "finite ?M2" |
|
3800 by (rule fin_finite p(3))+ |
|
3801 show "\<Union>{k. \<exists>x. (x, k) \<in> ?M2} = cbox a b \<inter> {x. x\<bullet>k \<ge> c}" |
|
3802 unfolding p(8)[symmetric] by auto |
|
3803 fix x l |
|
3804 assume xl: "(x, l) \<in> ?M2" |
|
3805 then guess x' l' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note xl'=this |
|
3806 show "x \<in> l" "l \<subseteq> cbox a b \<inter> {x. x \<bullet> k \<ge> c}" |
|
3807 unfolding xl' |
|
3808 using p(4-6)[OF xl'(3)] xl'(4) xk_ge_c[OF xl'(3-4)] |
|
3809 by auto |
|
3810 show "\<exists>a b. l = cbox a b" |
|
3811 unfolding xl' |
|
3812 using p(6)[OF xl'(3)] |
|
3813 by (fastforce simp add: interval_split[OF k, where c=c]) |
|
3814 fix y r |
|
3815 let ?goal = "interior l \<inter> interior r = {}" |
|
3816 assume yr: "(y, r) \<in> ?M2" |
|
3817 then guess y' r' unfolding mem_Collect_eq unfolding prod.inject by (elim exE conjE) note yr'=this |
|
3818 assume as: "(x, l) \<noteq> (y, r)" |
|
3819 show "interior l \<inter> interior r = {}" |
|
3820 proof (cases "l' = r' \<longrightarrow> x' = y'") |
|
3821 case False |
|
3822 then show ?thesis |
|
3823 using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto |
|
3824 next |
|
3825 case True |
|
3826 then have "l' \<noteq> r'" |
|
3827 using as unfolding xl' yr' by auto |
|
3828 then show ?thesis |
|
3829 using p(7)[OF xl'(3) yr'(3)] using as unfolding xl' yr' by auto |
|
3830 qed |
|
3831 qed |
|
3832 ultimately |
|
3833 have "norm (((\<Sum>(x, k)\<in>?M1. content k *\<^sub>R f x) - i) + ((\<Sum>(x, k)\<in>?M2. content k *\<^sub>R f x) - j)) < e/2 + e/2" |
|
3834 using norm_add_less by blast |
|
3835 also { |
|
3836 have eq0: "\<And>x y. x = (0::real) \<Longrightarrow> x *\<^sub>R (y::'b) = 0" |
|
3837 using scaleR_zero_left by auto |
|
3838 have cont_eq: "\<And>g. (\<lambda>(x,l). content l *\<^sub>R f x) \<circ> (\<lambda>(x,l). (x,g l)) = (\<lambda>(x,l). content (g l) *\<^sub>R f x)" |
|
3839 by auto |
|
3840 have "((\<Sum>(x, k)\<in>?M1. content k *\<^sub>R f x) - i) + ((\<Sum>(x, k)\<in>?M2. content k *\<^sub>R f x) - j) = |
|
3841 (\<Sum>(x, k)\<in>?M1. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>?M2. content k *\<^sub>R f x) - (i + j)" |
|
3842 by auto |
|
3843 also have "\<dots> = (\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. x \<bullet> k \<le> c}) *\<^sub>R f x) + |
|
3844 (\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. c \<le> x \<bullet> k}) *\<^sub>R f x) - (i + j)" |
|
3845 unfolding lem3[OF p(3)] |
|
3846 by (subst setsum.reindex_nontrivial[OF p(3)], auto intro!: k eq0 tagged_division_split_left_inj[OF p(1)] tagged_division_split_right_inj[OF p(1)] |
|
3847 simp: cont_eq)+ |
|
3848 also note setsum.distrib[symmetric] |
|
3849 also have "\<And>x. x \<in> p \<Longrightarrow> |
|
3850 (\<lambda>(x,ka). content (ka \<inter> {x. x \<bullet> k \<le> c}) *\<^sub>R f x) x + |
|
3851 (\<lambda>(x,ka). content (ka \<inter> {x. c \<le> x \<bullet> k}) *\<^sub>R f x) x = |
|
3852 (\<lambda>(x,ka). content ka *\<^sub>R f x) x" |
|
3853 proof clarify |
|
3854 fix a b |
|
3855 assume "(a, b) \<in> p" |
|
3856 from p(6)[OF this] guess u v by (elim exE) note uv=this |
|
3857 then show "content (b \<inter> {x. x \<bullet> k \<le> c}) *\<^sub>R f a + content (b \<inter> {x. c \<le> x \<bullet> k}) *\<^sub>R f a = |
|
3858 content b *\<^sub>R f a" |
|
3859 unfolding scaleR_left_distrib[symmetric] |
|
3860 unfolding uv content_split[OF k,of u v c] |
|
3861 by auto |
|
3862 qed |
|
3863 note setsum.cong [OF _ this] |
|
3864 finally have "(\<Sum>(x, k)\<in>{(x, kk \<inter> {x. x \<bullet> k \<le> c}) |x kk. (x, kk) \<in> p \<and> kk \<inter> {x. x \<bullet> k \<le> c} \<noteq> {}}. content k *\<^sub>R f x) - i + |
|
3865 ((\<Sum>(x, k)\<in>{(x, kk \<inter> {x. c \<le> x \<bullet> k}) |x kk. (x, kk) \<in> p \<and> kk \<inter> {x. c \<le> x \<bullet> k} \<noteq> {}}. content k *\<^sub>R f x) - j) = |
|
3866 (\<Sum>(x, ka)\<in>p. content ka *\<^sub>R f x) - (i + j)" |
|
3867 by auto |
|
3868 } |
|
3869 finally show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (i + j)) < e" |
|
3870 by auto |
|
3871 qed |
|
3872 qed |
|
3873 |
|
3874 |
|
3875 subsection \<open>A sort of converse, integrability on subintervals.\<close> |
|
3876 |
|
3877 lemma tagged_division_union_interval: |
|
3878 fixes a :: "'a::euclidean_space" |
|
3879 assumes "p1 tagged_division_of (cbox a b \<inter> {x. x\<bullet>k \<le> (c::real)})" |
|
3880 and "p2 tagged_division_of (cbox a b \<inter> {x. x\<bullet>k \<ge> c})" |
|
3881 and k: "k \<in> Basis" |
|
3882 shows "(p1 \<union> p2) tagged_division_of (cbox a b)" |
|
3883 proof - |
|
3884 have *: "cbox a b = (cbox a b \<inter> {x. x\<bullet>k \<le> c}) \<union> (cbox a b \<inter> {x. x\<bullet>k \<ge> c})" |
|
3885 by auto |
|
3886 show ?thesis |
|
3887 apply (subst *) |
|
3888 apply (rule tagged_division_union[OF assms(1-2)]) |
|
3889 unfolding interval_split[OF k] interior_cbox |
|
3890 using k |
|
3891 apply (auto simp add: box_def elim!: ballE[where x=k]) |
|
3892 done |
|
3893 qed |
|
3894 |
|
3895 lemma tagged_division_union_interval_real: |
|
3896 fixes a :: real |
|
3897 assumes "p1 tagged_division_of ({a .. b} \<inter> {x. x\<bullet>k \<le> (c::real)})" |
|
3898 and "p2 tagged_division_of ({a .. b} \<inter> {x. x\<bullet>k \<ge> c})" |
|
3899 and k: "k \<in> Basis" |
|
3900 shows "(p1 \<union> p2) tagged_division_of {a .. b}" |
|
3901 using assms |
|
3902 unfolding box_real[symmetric] |
|
3903 by (rule tagged_division_union_interval) |
|
3904 |
|
3905 lemma has_integral_separate_sides: |
|
3906 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
|
3907 assumes "(f has_integral i) (cbox a b)" |
|
3908 and "e > 0" |
|
3909 and k: "k \<in> Basis" |
|
3910 obtains d where "gauge d" |
|
3911 "\<forall>p1 p2. p1 tagged_division_of (cbox a b \<inter> {x. x\<bullet>k \<le> c}) \<and> d fine p1 \<and> |
|
3912 p2 tagged_division_of (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) \<and> d fine p2 \<longrightarrow> |
|
3913 norm ((setsum (\<lambda>(x,k). content k *\<^sub>R f x) p1 + setsum (\<lambda>(x,k). content k *\<^sub>R f x) p2) - i) < e" |
|
3914 proof - |
|
3915 guess d using has_integralD[OF assms(1-2)] . note d=this |
|
3916 { fix p1 p2 |
|
3917 assume "p1 tagged_division_of (cbox a b) \<inter> {x. x \<bullet> k \<le> c}" "d fine p1" |
|
3918 note p1=tagged_division_ofD[OF this(1)] this |
|
3919 assume "p2 tagged_division_of (cbox a b) \<inter> {x. c \<le> x \<bullet> k}" "d fine p2" |
|
3920 note p2=tagged_division_ofD[OF this(1)] this |
|
3921 note tagged_division_union_interval[OF p1(7) p2(7)] note p12 = tagged_division_ofD[OF this] this |
|
3922 { fix a b |
|
3923 assume ab: "(a, b) \<in> p1 \<inter> p2" |
|
3924 have "(a, b) \<in> p1" |
|
3925 using ab by auto |
|
3926 with p1 obtain u v where uv: "b = cbox u v" by auto |
|
3927 have "b \<subseteq> {x. x\<bullet>k = c}" |
|
3928 using ab p1(3)[of a b] p2(3)[of a b] by fastforce |
|
3929 moreover |
|
3930 have "interior {x::'a. x \<bullet> k = c} = {}" |
|
3931 proof (rule ccontr) |
|
3932 assume "\<not> ?thesis" |
|
3933 then obtain x where x: "x \<in> interior {x::'a. x\<bullet>k = c}" |
|
3934 by auto |
|
3935 then guess e unfolding mem_interior .. note e=this |
|
3936 have x: "x\<bullet>k = c" |
|
3937 using x interior_subset by fastforce |
|
3938 have *: "\<And>i. i \<in> Basis \<Longrightarrow> \<bar>(x - (x + (e / 2) *\<^sub>R k)) \<bullet> i\<bar> = (if i = k then e/2 else 0)" |
|
3939 using e k by (auto simp: inner_simps inner_not_same_Basis) |
|
3940 have "(\<Sum>i\<in>Basis. \<bar>(x - (x + (e / 2 ) *\<^sub>R k)) \<bullet> i\<bar>) = |
|
3941 (\<Sum>i\<in>Basis. (if i = k then e / 2 else 0))" |
|
3942 using "*" by (blast intro: setsum.cong) |
|
3943 also have "\<dots> < e" |
|
3944 apply (subst setsum.delta) |
|
3945 using e |
|
3946 apply auto |
|
3947 done |
|
3948 finally have "x + (e/2) *\<^sub>R k \<in> ball x e" |
|
3949 unfolding mem_ball dist_norm by(rule le_less_trans[OF norm_le_l1]) |
|
3950 then have "x + (e/2) *\<^sub>R k \<in> {x. x\<bullet>k = c}" |
|
3951 using e by auto |
|
3952 then show False |
|
3953 unfolding mem_Collect_eq using e x k by (auto simp: inner_simps) |
|
3954 qed |
|
3955 ultimately have "content b = 0" |
|
3956 unfolding uv content_eq_0_interior |
|
3957 using interior_mono by blast |
|
3958 then have "content b *\<^sub>R f a = 0" |
|
3959 by auto |
|
3960 } |
|
3961 then have "norm ((\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x) - i) = |
|
3962 norm ((\<Sum>(x, k)\<in>p1 \<union> p2. content k *\<^sub>R f x) - i)" |
|
3963 by (subst setsum.union_inter_neutral) (auto simp: p1 p2) |
|
3964 also have "\<dots> < e" |
|
3965 by (rule k d(2) p12 fine_union p1 p2)+ |
|
3966 finally have "norm ((\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x) - i) < e" . |
|
3967 } |
|
3968 then show ?thesis |
|
3969 by (auto intro: that[of d] d elim: ) |
|
3970 qed |
|
3971 |
|
3972 lemma integrable_split[intro]: |
|
3973 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::{real_normed_vector,complete_space}" |
|
3974 assumes "f integrable_on cbox a b" |
|
3975 and k: "k \<in> Basis" |
|
3976 shows "f integrable_on (cbox a b \<inter> {x. x\<bullet>k \<le> c})" (is ?t1) |
|
3977 and "f integrable_on (cbox a b \<inter> {x. x\<bullet>k \<ge> c})" (is ?t2) |
|
3978 proof - |
|
3979 guess y using assms(1) unfolding integrable_on_def .. note y=this |
|
3980 define b' where "b' = (\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) c else b\<bullet>i)*\<^sub>R i)" |
|
3981 define a' where "a' = (\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) c else a\<bullet>i)*\<^sub>R i)" |
|
3982 show ?t1 ?t2 |
|
3983 unfolding interval_split[OF k] integrable_cauchy |
|
3984 unfolding interval_split[symmetric,OF k] |
|
3985 proof (rule_tac[!] allI impI)+ |
|
3986 fix e :: real |
|
3987 assume "e > 0" |
|
3988 then have "e/2>0" |
|
3989 by auto |
|
3990 from has_integral_separate_sides[OF y this k,of c] guess d . note d=this[rule_format] |
|
3991 let ?P = "\<lambda>A. \<exists>d. gauge d \<and> (\<forall>p1 p2. p1 tagged_division_of (cbox a b) \<inter> A \<and> d fine p1 \<and> |
|
3992 p2 tagged_division_of (cbox a b) \<inter> A \<and> d fine p2 \<longrightarrow> |
|
3993 norm ((\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x)) < e)" |
|
3994 show "?P {x. x \<bullet> k \<le> c}" |
|
3995 proof (rule_tac x=d in exI, clarsimp simp add: d) |
|
3996 fix p1 p2 |
|
3997 assume as: "p1 tagged_division_of (cbox a b) \<inter> {x. x \<bullet> k \<le> c}" "d fine p1" |
|
3998 "p2 tagged_division_of (cbox a b) \<inter> {x. x \<bullet> k \<le> c}" "d fine p2" |
|
3999 show "norm ((\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x)) < e" |
|
4000 proof (rule fine_division_exists[OF d(1), of a' b] ) |
|
4001 fix p |
|
4002 assume "p tagged_division_of cbox a' b" "d fine p" |
|
4003 then show ?thesis |
|
4004 using as norm_triangle_half_l[OF d(2)[of p1 p] d(2)[of p2 p]] |
|
4005 unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric] |
|
4006 by (auto simp add: algebra_simps) |
|
4007 qed |
|
4008 qed |
|
4009 show "?P {x. x \<bullet> k \<ge> c}" |
|
4010 proof (rule_tac x=d in exI, clarsimp simp add: d) |
|
4011 fix p1 p2 |
|
4012 assume as: "p1 tagged_division_of (cbox a b) \<inter> {x. x \<bullet> k \<ge> c}" "d fine p1" |
|
4013 "p2 tagged_division_of (cbox a b) \<inter> {x. x \<bullet> k \<ge> c}" "d fine p2" |
|
4014 show "norm ((\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x)) < e" |
|
4015 proof (rule fine_division_exists[OF d(1), of a b'] ) |
|
4016 fix p |
|
4017 assume "p tagged_division_of cbox a b'" "d fine p" |
|
4018 then show ?thesis |
|
4019 using as norm_triangle_half_l[OF d(2)[of p p1] d(2)[of p p2]] |
|
4020 unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric] |
|
4021 by (auto simp add: algebra_simps) |
|
4022 qed |
|
4023 qed |
|
4024 qed |
|
4025 qed |
|
4026 |
|
4027 lemma operative_integral: |
|
4028 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
|
4029 shows "comm_monoid.operative (lift_option op +) (Some 0) (\<lambda>i. if f integrable_on i then Some (integral i f) else None)" |
|
4030 unfolding comm_monoid.operative_def[OF add.comm_monoid_lift_option] |
|
4031 proof safe |
|
4032 fix a b c |
|
4033 fix k :: 'a |
|
4034 assume k: "k \<in> Basis" |
|
4035 show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) = |
|
4036 lift_option op + (if f integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c} then Some (integral (cbox a b \<inter> {x. x \<bullet> k \<le> c}) f) else None) |
|
4037 (if f integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k} then Some (integral (cbox a b \<inter> {x. c \<le> x \<bullet> k}) f) else None)" |
|
4038 proof (cases "f integrable_on cbox a b") |
|
4039 case True |
|
4040 with k show ?thesis |
|
4041 apply (simp add: integrable_split) |
|
4042 apply (rule integral_unique [OF has_integral_split[OF _ _ k]]) |
|
4043 apply (auto intro: integrable_integral) |
|
4044 done |
|
4045 next |
|
4046 case False |
|
4047 have "\<not> (f integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}) \<or> \<not> ( f integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k})" |
|
4048 proof (rule ccontr) |
|
4049 assume "\<not> ?thesis" |
|
4050 then have "f integrable_on cbox a b" |
|
4051 unfolding integrable_on_def |
|
4052 apply (rule_tac x="integral (cbox a b \<inter> {x. x \<bullet> k \<le> c}) f + integral (cbox a b \<inter> {x. x \<bullet> k \<ge> c}) f" in exI) |
|
4053 apply (rule has_integral_split[OF _ _ k]) |
|
4054 apply (auto intro: integrable_integral) |
|
4055 done |
|
4056 then show False |
|
4057 using False by auto |
|
4058 qed |
|
4059 then show ?thesis |
|
4060 using False by auto |
|
4061 qed |
|
4062 next |
|
4063 fix a b :: 'a |
|
4064 assume "content (cbox a b) = 0" |
|
4065 then show "(if f integrable_on cbox a b then Some (integral (cbox a b) f) else None) = Some 0" |
|
4066 using has_integral_null_eq |
|
4067 by (auto simp: integrable_on_null) |
|
4068 qed |
|
4069 |
|
4070 subsection \<open>Finally, the integral of a constant\<close> |
|
4071 |
|
4072 lemma has_integral_const [intro]: |
|
4073 fixes a b :: "'a::euclidean_space" |
|
4074 shows "((\<lambda>x. c) has_integral (content (cbox a b) *\<^sub>R c)) (cbox a b)" |
|
4075 apply (auto intro!: exI [where x="\<lambda>x. ball x 1"] simp: split_def has_integral) |
|
4076 apply (subst scaleR_left.setsum[symmetric, unfolded o_def]) |
|
4077 apply (subst additive_content_tagged_division[unfolded split_def]) |
|
4078 apply auto |
|
4079 done |
|
4080 |
|
4081 lemma has_integral_const_real [intro]: |
|
4082 fixes a b :: real |
|
4083 shows "((\<lambda>x. c) has_integral (content {a .. b} *\<^sub>R c)) {a .. b}" |
|
4084 by (metis box_real(2) has_integral_const) |
|
4085 |
|
4086 lemma integral_const [simp]: |
|
4087 fixes a b :: "'a::euclidean_space" |
|
4088 shows "integral (cbox a b) (\<lambda>x. c) = content (cbox a b) *\<^sub>R c" |
|
4089 by (rule integral_unique) (rule has_integral_const) |
|
4090 |
|
4091 lemma integral_const_real [simp]: |
|
4092 fixes a b :: real |
|
4093 shows "integral {a .. b} (\<lambda>x. c) = content {a .. b} *\<^sub>R c" |
|
4094 by (metis box_real(2) integral_const) |
|
4095 |
|
4096 |
|
4097 subsection \<open>Bounds on the norm of Riemann sums and the integral itself.\<close> |
|
4098 |
|
4099 lemma dsum_bound: |
|
4100 assumes "p division_of (cbox a b)" |
|
4101 and "norm c \<le> e" |
|
4102 shows "norm (setsum (\<lambda>l. content l *\<^sub>R c) p) \<le> e * content(cbox a b)" |
|
4103 proof - |
|
4104 have sumeq: "(\<Sum>i\<in>p. \<bar>content i\<bar>) = setsum content p" |
|
4105 apply (rule setsum.cong) |
|
4106 using assms |
|
4107 apply simp |
|
4108 apply (metis abs_of_nonneg assms(1) content_pos_le division_ofD(4)) |
|
4109 done |
|
4110 have e: "0 \<le> e" |
|
4111 using assms(2) norm_ge_zero order_trans by blast |
|
4112 have "norm (setsum (\<lambda>l. content l *\<^sub>R c) p) \<le> (\<Sum>i\<in>p. norm (content i *\<^sub>R c))" |
|
4113 using norm_setsum by blast |
|
4114 also have "... \<le> e * (\<Sum>i\<in>p. \<bar>content i\<bar>)" |
|
4115 apply (simp add: setsum_right_distrib[symmetric] mult.commute) |
|
4116 using assms(2) mult_right_mono by blast |
|
4117 also have "... \<le> e * content (cbox a b)" |
|
4118 apply (rule mult_left_mono [OF _ e]) |
|
4119 apply (simp add: sumeq) |
|
4120 using additive_content_division assms(1) eq_iff apply blast |
|
4121 done |
|
4122 finally show ?thesis . |
|
4123 qed |
|
4124 |
|
4125 lemma rsum_bound: |
|
4126 assumes p: "p tagged_division_of (cbox a b)" |
|
4127 and "\<forall>x\<in>cbox a b. norm (f x) \<le> e" |
|
4128 shows "norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p) \<le> e * content (cbox a b)" |
|
4129 proof (cases "cbox a b = {}") |
|
4130 case True show ?thesis |
|
4131 using p unfolding True tagged_division_of_trivial by auto |
|
4132 next |
|
4133 case False |
|
4134 then have e: "e \<ge> 0" |
|
4135 by (meson ex_in_conv assms(2) norm_ge_zero order_trans) |
|
4136 have setsum_le: "setsum (content \<circ> snd) p \<le> content (cbox a b)" |
|
4137 unfolding additive_content_tagged_division[OF p, symmetric] split_def |
|
4138 by (auto intro: eq_refl) |
|
4139 have con: "\<And>xk. xk \<in> p \<Longrightarrow> 0 \<le> content (snd xk)" |
|
4140 using tagged_division_ofD(4) [OF p] content_pos_le |
|
4141 by force |
|
4142 have norm: "\<And>xk. xk \<in> p \<Longrightarrow> norm (f (fst xk)) \<le> e" |
|
4143 unfolding fst_conv using tagged_division_ofD(2,3)[OF p] assms |
|
4144 by (metis prod.collapse subset_eq) |
|
4145 have "norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p) \<le> (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x))" |
|
4146 by (rule norm_setsum) |
|
4147 also have "... \<le> e * content (cbox a b)" |
|
4148 unfolding split_def norm_scaleR |
|
4149 apply (rule order_trans[OF setsum_mono]) |
|
4150 apply (rule mult_left_mono[OF _ abs_ge_zero, of _ e]) |
|
4151 apply (metis norm) |
|
4152 unfolding setsum_left_distrib[symmetric] |
|
4153 using con setsum_le |
|
4154 apply (auto simp: mult.commute intro: mult_left_mono [OF _ e]) |
|
4155 done |
|
4156 finally show ?thesis . |
|
4157 qed |
|
4158 |
|
4159 lemma rsum_diff_bound: |
|
4160 assumes "p tagged_division_of (cbox a b)" |
|
4161 and "\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e" |
|
4162 shows "norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - setsum (\<lambda>(x,k). content k *\<^sub>R g x) p) \<le> |
|
4163 e * content (cbox a b)" |
|
4164 apply (rule order_trans[OF _ rsum_bound[OF assms]]) |
|
4165 apply (simp add: split_def scaleR_diff_right setsum_subtractf eq_refl) |
|
4166 done |
|
4167 |
|
4168 lemma has_integral_bound: |
|
4169 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
|
4170 assumes "0 \<le> B" |
|
4171 and "(f has_integral i) (cbox a b)" |
|
4172 and "\<forall>x\<in>cbox a b. norm (f x) \<le> B" |
|
4173 shows "norm i \<le> B * content (cbox a b)" |
|
4174 proof (rule ccontr) |
|
4175 assume "\<not> ?thesis" |
|
4176 then have *: "norm i - B * content (cbox a b) > 0" |
|
4177 by auto |
|
4178 from assms(2)[unfolded has_integral,rule_format,OF *] |
|
4179 guess d by (elim exE conjE) note d=this[rule_format] |
|
4180 from fine_division_exists[OF this(1), of a b] guess p . note p=this |
|
4181 have *: "\<And>s B. norm s \<le> B \<Longrightarrow> \<not> norm (s - i) < norm i - B" |
|
4182 unfolding not_less |
|
4183 by (metis norm_triangle_sub[of i] add.commute le_less_trans less_diff_eq linorder_not_le norm_minus_commute) |
|
4184 show False |
|
4185 using d(2)[OF conjI[OF p]] *[OF rsum_bound[OF p(1) assms(3)]] by auto |
|
4186 qed |
|
4187 |
|
4188 corollary has_integral_bound_real: |
|
4189 fixes f :: "real \<Rightarrow> 'b::real_normed_vector" |
|
4190 assumes "0 \<le> B" |
|
4191 and "(f has_integral i) {a .. b}" |
|
4192 and "\<forall>x\<in>{a .. b}. norm (f x) \<le> B" |
|
4193 shows "norm i \<le> B * content {a .. b}" |
|
4194 by (metis assms box_real(2) has_integral_bound) |
|
4195 |
|
4196 corollary integrable_bound: |
|
4197 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
|
4198 assumes "0 \<le> B" |
|
4199 and "f integrable_on (cbox a b)" |
|
4200 and "\<And>x. x\<in>cbox a b \<Longrightarrow> norm (f x) \<le> B" |
|
4201 shows "norm (integral (cbox a b) f) \<le> B * content (cbox a b)" |
|
4202 by (metis integrable_integral has_integral_bound assms) |
|
4203 |
|
4204 |
|
4205 subsection \<open>Similar theorems about relationship among components.\<close> |
|
4206 |
|
4207 lemma rsum_component_le: |
|
4208 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
|
4209 assumes "p tagged_division_of (cbox a b)" |
|
4210 and "\<forall>x\<in>cbox a b. (f x)\<bullet>i \<le> (g x)\<bullet>i" |
|
4211 shows "(setsum (\<lambda>(x,k). content k *\<^sub>R f x) p)\<bullet>i \<le> (setsum (\<lambda>(x,k). content k *\<^sub>R g x) p)\<bullet>i" |
|
4212 unfolding inner_setsum_left |
|
4213 proof (rule setsum_mono, clarify) |
|
4214 fix a b |
|
4215 assume ab: "(a, b) \<in> p" |
|
4216 note tagged = tagged_division_ofD(2-4)[OF assms(1) ab] |
|
4217 from this(3) guess u v by (elim exE) note b=this |
|
4218 show "(content b *\<^sub>R f a) \<bullet> i \<le> (content b *\<^sub>R g a) \<bullet> i" |
|
4219 unfolding b inner_simps real_scaleR_def |
|
4220 apply (rule mult_left_mono) |
|
4221 using assms(2) tagged |
|
4222 by (auto simp add: content_pos_le) |
|
4223 qed |
|
4224 |
|
4225 lemma has_integral_component_le: |
|
4226 fixes f g :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
|
4227 assumes k: "k \<in> Basis" |
|
4228 assumes "(f has_integral i) s" "(g has_integral j) s" |
|
4229 and "\<forall>x\<in>s. (f x)\<bullet>k \<le> (g x)\<bullet>k" |
|
4230 shows "i\<bullet>k \<le> j\<bullet>k" |
|
4231 proof - |
|
4232 have lem: "i\<bullet>k \<le> j\<bullet>k" |
|
4233 if f_i: "(f has_integral i) (cbox a b)" |
|
4234 and g_j: "(g has_integral j) (cbox a b)" |
|
4235 and le: "\<forall>x\<in>cbox a b. (f x)\<bullet>k \<le> (g x)\<bullet>k" |
|
4236 for a b i and j :: 'b and f g :: "'a \<Rightarrow> 'b" |
|
4237 proof (rule ccontr) |
|
4238 assume "\<not> ?thesis" |
|
4239 then have *: "0 < (i\<bullet>k - j\<bullet>k) / 3" |
|
4240 by auto |
|
4241 guess d1 using f_i[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d1=this[rule_format] |
|
4242 guess d2 using g_j[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d2=this[rule_format] |
|
4243 obtain p where p: "p tagged_division_of cbox a b" "d1 fine p" "d2 fine p" |
|
4244 using fine_division_exists[OF gauge_inter[OF d1(1) d2(1)], of a b] unfolding fine_inter |
|
4245 by metis |
|
4246 note le_less_trans[OF Basis_le_norm[OF k]] |
|
4247 then have "\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3" |
|
4248 "\<bar>((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - j) \<bullet> k\<bar> < (i \<bullet> k - j \<bullet> k) / 3" |
|
4249 using k norm_bound_Basis_lt d1 d2 p |
|
4250 by blast+ |
|
4251 then show False |
|
4252 unfolding inner_simps |
|
4253 using rsum_component_le[OF p(1) le] |
|
4254 by (simp add: abs_real_def split: if_split_asm) |
|
4255 qed |
|
4256 show ?thesis |
|
4257 proof (cases "\<exists>a b. s = cbox a b") |
|
4258 case True |
|
4259 with lem assms show ?thesis |
|
4260 by auto |
|
4261 next |
|
4262 case False |
|
4263 show ?thesis |
|
4264 proof (rule ccontr) |
|
4265 assume "\<not> i\<bullet>k \<le> j\<bullet>k" |
|
4266 then have ij: "(i\<bullet>k - j\<bullet>k) / 3 > 0" |
|
4267 by auto |
|
4268 note has_integral_altD[OF _ False this] |
|
4269 from this[OF assms(2)] this[OF assms(3)] guess B1 B2 . note B=this[rule_format] |
|
4270 have "bounded (ball 0 B1 \<union> ball (0::'a) B2)" |
|
4271 unfolding bounded_Un by(rule conjI bounded_ball)+ |
|
4272 from bounded_subset_cbox[OF this] guess a b by (elim exE) |
|
4273 note ab = conjunctD2[OF this[unfolded Un_subset_iff]] |
|
4274 guess w1 using B(2)[OF ab(1)] .. note w1=conjunctD2[OF this] |
|
4275 guess w2 using B(4)[OF ab(2)] .. note w2=conjunctD2[OF this] |
|
4276 have *: "\<And>w1 w2 j i::real .\<bar>w1 - i\<bar> < (i - j) / 3 \<Longrightarrow> \<bar>w2 - j\<bar> < (i - j) / 3 \<Longrightarrow> w1 \<le> w2 \<Longrightarrow> False" |
|
4277 by (simp add: abs_real_def split: if_split_asm) |
|
4278 note le_less_trans[OF Basis_le_norm[OF k]] |
|
4279 note this[OF w1(2)] this[OF w2(2)] |
|
4280 moreover |
|
4281 have "w1\<bullet>k \<le> w2\<bullet>k" |
|
4282 by (rule lem[OF w1(1) w2(1)]) (simp add: assms(4)) |
|
4283 ultimately show False |
|
4284 unfolding inner_simps by(rule *) |
|
4285 qed |
|
4286 qed |
|
4287 qed |
|
4288 |
|
4289 lemma integral_component_le: |
|
4290 fixes g f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
|
4291 assumes "k \<in> Basis" |
|
4292 and "f integrable_on s" "g integrable_on s" |
|
4293 and "\<forall>x\<in>s. (f x)\<bullet>k \<le> (g x)\<bullet>k" |
|
4294 shows "(integral s f)\<bullet>k \<le> (integral s g)\<bullet>k" |
|
4295 apply (rule has_integral_component_le) |
|
4296 using integrable_integral assms |
|
4297 apply auto |
|
4298 done |
|
4299 |
|
4300 lemma has_integral_component_nonneg: |
|
4301 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
|
4302 assumes "k \<in> Basis" |
|
4303 and "(f has_integral i) s" |
|
4304 and "\<forall>x\<in>s. 0 \<le> (f x)\<bullet>k" |
|
4305 shows "0 \<le> i\<bullet>k" |
|
4306 using has_integral_component_le[OF assms(1) has_integral_0 assms(2)] |
|
4307 using assms(3-) |
|
4308 by auto |
|
4309 |
|
4310 lemma integral_component_nonneg: |
|
4311 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
|
4312 assumes "k \<in> Basis" |
|
4313 and "\<forall>x\<in>s. 0 \<le> (f x)\<bullet>k" |
|
4314 shows "0 \<le> (integral s f)\<bullet>k" |
|
4315 proof (cases "f integrable_on s") |
|
4316 case True show ?thesis |
|
4317 apply (rule has_integral_component_nonneg) |
|
4318 using assms True |
|
4319 apply auto |
|
4320 done |
|
4321 next |
|
4322 case False then show ?thesis by (simp add: not_integrable_integral) |
|
4323 qed |
|
4324 |
|
4325 lemma has_integral_component_neg: |
|
4326 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
|
4327 assumes "k \<in> Basis" |
|
4328 and "(f has_integral i) s" |
|
4329 and "\<forall>x\<in>s. (f x)\<bullet>k \<le> 0" |
|
4330 shows "i\<bullet>k \<le> 0" |
|
4331 using has_integral_component_le[OF assms(1,2) has_integral_0] assms(2-) |
|
4332 by auto |
|
4333 |
|
4334 lemma has_integral_component_lbound: |
|
4335 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
|
4336 assumes "(f has_integral i) (cbox a b)" |
|
4337 and "\<forall>x\<in>cbox a b. B \<le> f(x)\<bullet>k" |
|
4338 and "k \<in> Basis" |
|
4339 shows "B * content (cbox a b) \<le> i\<bullet>k" |
|
4340 using has_integral_component_le[OF assms(3) has_integral_const assms(1),of "(\<Sum>i\<in>Basis. B *\<^sub>R i)::'b"] assms(2-) |
|
4341 by (auto simp add: field_simps) |
|
4342 |
|
4343 lemma has_integral_component_ubound: |
|
4344 fixes f::"'a::euclidean_space => 'b::euclidean_space" |
|
4345 assumes "(f has_integral i) (cbox a b)" |
|
4346 and "\<forall>x\<in>cbox a b. f x\<bullet>k \<le> B" |
|
4347 and "k \<in> Basis" |
|
4348 shows "i\<bullet>k \<le> B * content (cbox a b)" |
|
4349 using has_integral_component_le[OF assms(3,1) has_integral_const, of "\<Sum>i\<in>Basis. B *\<^sub>R i"] assms(2-) |
|
4350 by (auto simp add: field_simps) |
|
4351 |
|
4352 lemma integral_component_lbound: |
|
4353 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
|
4354 assumes "f integrable_on cbox a b" |
|
4355 and "\<forall>x\<in>cbox a b. B \<le> f(x)\<bullet>k" |
|
4356 and "k \<in> Basis" |
|
4357 shows "B * content (cbox a b) \<le> (integral(cbox a b) f)\<bullet>k" |
|
4358 apply (rule has_integral_component_lbound) |
|
4359 using assms |
|
4360 unfolding has_integral_integral |
|
4361 apply auto |
|
4362 done |
|
4363 |
|
4364 lemma integral_component_lbound_real: |
|
4365 assumes "f integrable_on {a ::real .. b}" |
|
4366 and "\<forall>x\<in>{a .. b}. B \<le> f(x)\<bullet>k" |
|
4367 and "k \<in> Basis" |
|
4368 shows "B * content {a .. b} \<le> (integral {a .. b} f)\<bullet>k" |
|
4369 using assms |
|
4370 by (metis box_real(2) integral_component_lbound) |
|
4371 |
|
4372 lemma integral_component_ubound: |
|
4373 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
|
4374 assumes "f integrable_on cbox a b" |
|
4375 and "\<forall>x\<in>cbox a b. f x\<bullet>k \<le> B" |
|
4376 and "k \<in> Basis" |
|
4377 shows "(integral (cbox a b) f)\<bullet>k \<le> B * content (cbox a b)" |
|
4378 apply (rule has_integral_component_ubound) |
|
4379 using assms |
|
4380 unfolding has_integral_integral |
|
4381 apply auto |
|
4382 done |
|
4383 |
|
4384 lemma integral_component_ubound_real: |
|
4385 fixes f :: "real \<Rightarrow> 'a::euclidean_space" |
|
4386 assumes "f integrable_on {a .. b}" |
|
4387 and "\<forall>x\<in>{a .. b}. f x\<bullet>k \<le> B" |
|
4388 and "k \<in> Basis" |
|
4389 shows "(integral {a .. b} f)\<bullet>k \<le> B * content {a .. b}" |
|
4390 using assms |
|
4391 by (metis box_real(2) integral_component_ubound) |
|
4392 |
|
4393 subsection \<open>Uniform limit of integrable functions is integrable.\<close> |
|
4394 |
|
4395 lemma real_arch_invD: |
|
4396 "0 < (e::real) \<Longrightarrow> (\<exists>n::nat. n \<noteq> 0 \<and> 0 < inverse (real n) \<and> inverse (real n) < e)" |
|
4397 by (subst(asm) real_arch_inverse) |
|
4398 |
|
4399 lemma integrable_uniform_limit: |
|
4400 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
|
4401 assumes "\<forall>e>0. \<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b" |
|
4402 shows "f integrable_on cbox a b" |
|
4403 proof (cases "content (cbox a b) > 0") |
|
4404 case False then show ?thesis |
|
4405 using has_integral_null |
|
4406 by (simp add: content_lt_nz integrable_on_def) |
|
4407 next |
|
4408 case True |
|
4409 have *: "\<And>P. \<forall>e>(0::real). P e \<Longrightarrow> \<forall>n::nat. P (inverse (real n + 1))" |
|
4410 by auto |
|
4411 from choice[OF *[OF assms]] guess g .. note g=conjunctD2[OF this[rule_format],rule_format] |
|
4412 from choice[OF allI[OF g(2)[unfolded integrable_on_def], of "\<lambda>x. x"]] |
|
4413 obtain i where i: "\<And>x. (g x has_integral i x) (cbox a b)" |
|
4414 by auto |
|
4415 have "Cauchy i" |
|
4416 unfolding Cauchy_def |
|
4417 proof clarify |
|
4418 fix e :: real |
|
4419 assume "e>0" |
|
4420 then have "e / 4 / content (cbox a b) > 0" |
|
4421 using True by (auto simp add: field_simps) |
|
4422 then obtain M :: nat |
|
4423 where M: "M \<noteq> 0" "0 < inverse (real_of_nat M)" "inverse (of_nat M) < e / 4 / content (cbox a b)" |
|
4424 by (subst (asm) real_arch_inverse) auto |
|
4425 show "\<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (i m) (i n) < e" |
|
4426 proof (rule exI [where x=M], clarify) |
|
4427 fix m n |
|
4428 assume m: "M \<le> m" and n: "M \<le> n" |
|
4429 have "e/4>0" using \<open>e>0\<close> by auto |
|
4430 note * = i[unfolded has_integral,rule_format,OF this] |
|
4431 from *[of m] guess gm by (elim conjE exE) note gm=this[rule_format] |
|
4432 from *[of n] guess gn by (elim conjE exE) note gn=this[rule_format] |
|
4433 from fine_division_exists[OF gauge_inter[OF gm(1) gn(1)], of a b] |
|
4434 obtain p where p: "p tagged_division_of cbox a b" "(\<lambda>x. gm x \<inter> gn x) fine p" |
|
4435 by auto |
|
4436 { fix s1 s2 i1 and i2::'b |
|
4437 assume no: "norm(s2 - s1) \<le> e/2" "norm (s1 - i1) < e/4" "norm (s2 - i2) < e/4" |
|
4438 have "norm (i1 - i2) \<le> norm (i1 - s1) + norm (s1 - s2) + norm (s2 - i2)" |
|
4439 using norm_triangle_ineq[of "i1 - s1" "s1 - i2"] |
|
4440 using norm_triangle_ineq[of "s1 - s2" "s2 - i2"] |
|
4441 by (auto simp add: algebra_simps) |
|
4442 also have "\<dots> < e" |
|
4443 using no |
|
4444 unfolding norm_minus_commute |
|
4445 by (auto simp add: algebra_simps) |
|
4446 finally have "norm (i1 - i2) < e" . |
|
4447 } note triangle3 = this |
|
4448 have finep: "gm fine p" "gn fine p" |
|
4449 using fine_inter p by auto |
|
4450 { fix x |
|
4451 assume x: "x \<in> cbox a b" |
|
4452 have "norm (f x - g n x) + norm (f x - g m x) \<le> inverse (real n + 1) + inverse (real m + 1)" |
|
4453 using g(1)[OF x, of n] g(1)[OF x, of m] by auto |
|
4454 also have "\<dots> \<le> inverse (real M) + inverse (real M)" |
|
4455 apply (rule add_mono) |
|
4456 using M(2) m n by auto |
|
4457 also have "\<dots> = 2 / real M" |
|
4458 unfolding divide_inverse by auto |
|
4459 finally have "norm (g n x - g m x) \<le> 2 / real M" |
|
4460 using norm_triangle_le[of "g n x - f x" "f x - g m x" "2 / real M"] |
|
4461 by (auto simp add: algebra_simps simp add: norm_minus_commute) |
|
4462 } note norm_le = this |
|
4463 have le_e2: "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g n x) - (\<Sum>(x, k)\<in>p. content k *\<^sub>R g m x)) \<le> e / 2" |
|
4464 apply (rule order_trans [OF rsum_diff_bound[OF p(1), where e="2 / real M"]]) |
|
4465 apply (blast intro: norm_le) |
|
4466 using M True |
|
4467 by (auto simp add: field_simps) |
|
4468 then show "dist (i m) (i n) < e" |
|
4469 unfolding dist_norm |
|
4470 using gm gn p finep |
|
4471 by (auto intro!: triangle3) |
|
4472 qed |
|
4473 qed |
|
4474 then obtain s where s: "i \<longlonglongrightarrow> s" |
|
4475 using convergent_eq_cauchy[symmetric] by blast |
|
4476 show ?thesis |
|
4477 unfolding integrable_on_def has_integral |
|
4478 proof (rule_tac x=s in exI, clarify) |
|
4479 fix e::real |
|
4480 assume e: "0 < e" |
|
4481 then have *: "e/3 > 0" by auto |
|
4482 then obtain N1 where N1: "\<forall>n\<ge>N1. norm (i n - s) < e / 3" |
|
4483 using LIMSEQ_D [OF s] by metis |
|
4484 from e True have "e / 3 / content (cbox a b) > 0" |
|
4485 by (auto simp add: field_simps) |
|
4486 from real_arch_invD[OF this] guess N2 by (elim exE conjE) note N2=this |
|
4487 from i[of "N1 + N2",unfolded has_integral,rule_format,OF *] guess g' .. note g'=conjunctD2[OF this,rule_format] |
|
4488 { fix sf sg i |
|
4489 assume no: "norm (sf - sg) \<le> e / 3" |
|
4490 "norm(i - s) < e / 3" |
|
4491 "norm (sg - i) < e / 3" |
|
4492 have "norm (sf - s) \<le> norm (sf - sg) + norm (sg - i) + norm (i - s)" |
|
4493 using norm_triangle_ineq[of "sf - sg" "sg - s"] |
|
4494 using norm_triangle_ineq[of "sg - i" " i - s"] |
|
4495 by (auto simp add: algebra_simps) |
|
4496 also have "\<dots> < e" |
|
4497 using no |
|
4498 unfolding norm_minus_commute |
|
4499 by (auto simp add: algebra_simps) |
|
4500 finally have "norm (sf - s) < e" . |
|
4501 } note lem = this |
|
4502 { fix p |
|
4503 assume p: "p tagged_division_of (cbox a b) \<and> g' fine p" |
|
4504 then have norm_less: "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g (N1 + N2) x) - i (N1 + N2)) < e / 3" |
|
4505 using g' by blast |
|
4506 have "content (cbox a b) < e / 3 * (of_nat N2)" |
|
4507 using N2 unfolding inverse_eq_divide using True by (auto simp add: field_simps) |
|
4508 moreover have "e / 3 * of_nat N2 \<le> e / 3 * (of_nat (N1 + N2) + 1)" |
|
4509 using \<open>e>0\<close> by auto |
|
4510 ultimately have "content (cbox a b) < e / 3 * (of_nat (N1 + N2) + 1)" |
|
4511 by linarith |
|
4512 then have le_e3: "inverse (real (N1 + N2) + 1) * content (cbox a b) \<le> e / 3" |
|
4513 unfolding inverse_eq_divide |
|
4514 by (auto simp add: field_simps) |
|
4515 have ne3: "norm (i (N1 + N2) - s) < e / 3" |
|
4516 using N1 by auto |
|
4517 have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - s) < e" |
|
4518 apply (rule lem[OF order_trans [OF _ le_e3] ne3 norm_less]) |
|
4519 apply (rule rsum_diff_bound[OF p[THEN conjunct1]]) |
|
4520 apply (blast intro: g) |
|
4521 done } |
|
4522 then show "\<exists>d. gauge d \<and> |
|
4523 (\<forall>p. p tagged_division_of cbox a b \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - s) < e)" |
|
4524 by (blast intro: g') |
|
4525 qed |
|
4526 qed |
|
4527 |
|
4528 lemmas integrable_uniform_limit_real = integrable_uniform_limit [where 'a=real, simplified] |
|
4529 |
|
4530 |
|
4531 subsection \<open>Negligible sets.\<close> |
|
4532 |
|
4533 definition "negligible (s:: 'a::euclidean_space set) \<longleftrightarrow> |
|
4534 (\<forall>a b. ((indicator s :: 'a\<Rightarrow>real) has_integral 0) (cbox a b))" |
|
4535 |
|
4536 |
|
4537 subsection \<open>Negligibility of hyperplane.\<close> |
|
4538 |
|
4539 lemma interval_doublesplit: |
|
4540 fixes a :: "'a::euclidean_space" |
|
4541 assumes "k \<in> Basis" |
|
4542 shows "cbox a b \<inter> {x . \<bar>x\<bullet>k - c\<bar> \<le> (e::real)} = |
|
4543 cbox (\<Sum>i\<in>Basis. (if i = k then max (a\<bullet>k) (c - e) else a\<bullet>i) *\<^sub>R i) |
|
4544 (\<Sum>i\<in>Basis. (if i = k then min (b\<bullet>k) (c + e) else b\<bullet>i) *\<^sub>R i)" |
|
4545 proof - |
|
4546 have *: "\<And>x c e::real. \<bar>x - c\<bar> \<le> e \<longleftrightarrow> x \<ge> c - e \<and> x \<le> c + e" |
|
4547 by auto |
|
4548 have **: "\<And>s P Q. s \<inter> {x. P x \<and> Q x} = (s \<inter> {x. Q x}) \<inter> {x. P x}" |
|
4549 by blast |
|
4550 show ?thesis |
|
4551 unfolding * ** interval_split[OF assms] by (rule refl) |
|
4552 qed |
|
4553 |
|
4554 lemma division_doublesplit: |
|
4555 fixes a :: "'a::euclidean_space" |
|
4556 assumes "p division_of (cbox a b)" |
|
4557 and k: "k \<in> Basis" |
|
4558 shows "(\<lambda>l. l \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> e}) ` {l\<in>p. l \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> e} \<noteq> {}} |
|
4559 division_of (cbox a b \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> e})" |
|
4560 proof - |
|
4561 have *: "\<And>x c. \<bar>x - c\<bar> \<le> e \<longleftrightarrow> x \<ge> c - e \<and> x \<le> c + e" |
|
4562 by auto |
|
4563 have **: "\<And>p q p' q'. p division_of q \<Longrightarrow> p = p' \<Longrightarrow> q = q' \<Longrightarrow> p' division_of q'" |
|
4564 by auto |
|
4565 note division_split(1)[OF assms, where c="c+e",unfolded interval_split[OF k]] |
|
4566 note division_split(2)[OF this, where c="c-e" and k=k,OF k] |
|
4567 then show ?thesis |
|
4568 apply (rule **) |
|
4569 subgoal |
|
4570 apply (simp add: abs_diff_le_iff field_simps Collect_conj_eq setcompr_eq_image[symmetric]) |
|
4571 apply (rule equalityI) |
|
4572 apply blast |
|
4573 apply clarsimp |
|
4574 apply (rule_tac x="l \<inter> {x. c + e \<ge> x \<bullet> k}" in exI) |
|
4575 apply auto |
|
4576 done |
|
4577 by (simp add: interval_split k interval_doublesplit) |
|
4578 qed |
|
4579 |
|
4580 lemma content_doublesplit: |
|
4581 fixes a :: "'a::euclidean_space" |
|
4582 assumes "0 < e" |
|
4583 and k: "k \<in> Basis" |
|
4584 obtains d where "0 < d" and "content (cbox a b \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> d}) < e" |
|
4585 proof (cases "content (cbox a b) = 0") |
|
4586 case True |
|
4587 then have ce: "content (cbox a b) < e" |
|
4588 by (metis \<open>0 < e\<close>) |
|
4589 show ?thesis |
|
4590 apply (rule that[of 1]) |
|
4591 apply simp |
|
4592 unfolding interval_doublesplit[OF k] |
|
4593 apply (rule le_less_trans[OF content_subset ce]) |
|
4594 apply (auto simp: interval_doublesplit[symmetric] k) |
|
4595 done |
|
4596 next |
|
4597 case False |
|
4598 define d where "d = e / 3 / setprod (\<lambda>i. b\<bullet>i - a\<bullet>i) (Basis - {k})" |
|
4599 note False[unfolded content_eq_0 not_ex not_le, rule_format] |
|
4600 then have "\<And>x. x \<in> Basis \<Longrightarrow> b\<bullet>x > a\<bullet>x" |
|
4601 by (auto simp add:not_le) |
|
4602 then have prod0: "0 < setprod (\<lambda>i. b\<bullet>i - a\<bullet>i) (Basis - {k})" |
|
4603 by (force simp add: setprod_pos field_simps) |
|
4604 then have "d > 0" |
|
4605 using assms |
|
4606 by (auto simp add: d_def field_simps) |
|
4607 then show ?thesis |
|
4608 proof (rule that[of d]) |
|
4609 have *: "Basis = insert k (Basis - {k})" |
|
4610 using k by auto |
|
4611 have less_e: "(min (b \<bullet> k) (c + d) - max (a \<bullet> k) (c - d)) * (\<Prod>i\<in>Basis - {k}. b \<bullet> i - a \<bullet> i) < e" |
|
4612 proof - |
|
4613 have "(min (b \<bullet> k) (c + d) - max (a \<bullet> k) (c - d)) \<le> 2 * d" |
|
4614 by auto |
|
4615 also have "\<dots> < e / (\<Prod>i\<in>Basis - {k}. b \<bullet> i - a \<bullet> i)" |
|
4616 unfolding d_def |
|
4617 using assms prod0 |
|
4618 by (auto simp add: field_simps) |
|
4619 finally show "(min (b \<bullet> k) (c + d) - max (a \<bullet> k) (c - d)) * (\<Prod>i\<in>Basis - {k}. b \<bullet> i - a \<bullet> i) < e" |
|
4620 unfolding pos_less_divide_eq[OF prod0] . |
|
4621 qed |
|
4622 show "content (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) < e" |
|
4623 proof (cases "cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} = {}") |
|
4624 case True |
|
4625 then show ?thesis |
|
4626 using assms by simp |
|
4627 next |
|
4628 case False |
|
4629 then have |
|
4630 "(\<Prod>i\<in>Basis - {k}. interval_upperbound (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<bullet> i - |
|
4631 interval_lowerbound (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<bullet> i) |
|
4632 = (\<Prod>i\<in>Basis - {k}. b\<bullet>i - a\<bullet>i)" |
|
4633 by (simp add: box_eq_empty interval_doublesplit[OF k]) |
|
4634 then show "content (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) < e" |
|
4635 unfolding content_def |
|
4636 using assms False |
|
4637 apply (subst *) |
|
4638 apply (subst setprod.insert) |
|
4639 apply (simp_all add: interval_doublesplit[OF k] box_eq_empty not_less less_e) |
|
4640 done |
|
4641 qed |
|
4642 qed |
|
4643 qed |
|
4644 |
|
4645 lemma negligible_standard_hyperplane[intro]: |
|
4646 fixes k :: "'a::euclidean_space" |
|
4647 assumes k: "k \<in> Basis" |
|
4648 shows "negligible {x. x\<bullet>k = c}" |
|
4649 unfolding negligible_def has_integral |
|
4650 proof (clarify, goal_cases) |
|
4651 case (1 a b e) |
|
4652 from this and k obtain d where d: "0 < d" "content (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) < e" |
|
4653 by (rule content_doublesplit) |
|
4654 let ?i = "indicator {x::'a. x\<bullet>k = c} :: 'a\<Rightarrow>real" |
|
4655 show ?case |
|
4656 apply (rule_tac x="\<lambda>x. ball x d" in exI) |
|
4657 apply rule |
|
4658 apply (rule gauge_ball) |
|
4659 apply (rule d) |
|
4660 proof (rule, rule) |
|
4661 fix p |
|
4662 assume p: "p tagged_division_of (cbox a b) \<and> (\<lambda>x. ball x d) fine p" |
|
4663 have *: "(\<Sum>(x, ka)\<in>p. content ka *\<^sub>R ?i x) = |
|
4664 (\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. \<bar>x\<bullet>k - c\<bar> \<le> d}) *\<^sub>R ?i x)" |
|
4665 apply (rule setsum.cong) |
|
4666 apply (rule refl) |
|
4667 unfolding split_paired_all real_scaleR_def mult_cancel_right split_conv |
|
4668 apply cases |
|
4669 apply (rule disjI1) |
|
4670 apply assumption |
|
4671 apply (rule disjI2) |
|
4672 proof - |
|
4673 fix x l |
|
4674 assume as: "(x, l) \<in> p" "?i x \<noteq> 0" |
|
4675 then have xk: "x\<bullet>k = c" |
|
4676 unfolding indicator_def |
|
4677 apply - |
|
4678 apply (rule ccontr) |
|
4679 apply auto |
|
4680 done |
|
4681 show "content l = content (l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})" |
|
4682 apply (rule arg_cong[where f=content]) |
|
4683 apply (rule set_eqI) |
|
4684 apply rule |
|
4685 apply rule |
|
4686 unfolding mem_Collect_eq |
|
4687 proof - |
|
4688 fix y |
|
4689 assume y: "y \<in> l" |
|
4690 note p[THEN conjunct2,unfolded fine_def,rule_format,OF as(1),unfolded split_conv] |
|
4691 note this[unfolded subset_eq mem_ball dist_norm,rule_format,OF y] |
|
4692 note le_less_trans[OF Basis_le_norm[OF k] this] |
|
4693 then show "\<bar>y \<bullet> k - c\<bar> \<le> d" |
|
4694 unfolding inner_simps xk by auto |
|
4695 qed auto |
|
4696 qed |
|
4697 note p'= tagged_division_ofD[OF p[THEN conjunct1]] and p''=division_of_tagged_division[OF p[THEN conjunct1]] |
|
4698 show "norm ((\<Sum>(x, ka)\<in>p. content ka *\<^sub>R ?i x) - 0) < e" |
|
4699 unfolding diff_0_right * |
|
4700 unfolding real_scaleR_def real_norm_def |
|
4701 apply (subst abs_of_nonneg) |
|
4702 apply (rule setsum_nonneg) |
|
4703 apply rule |
|
4704 unfolding split_paired_all split_conv |
|
4705 apply (rule mult_nonneg_nonneg) |
|
4706 apply (drule p'(4)) |
|
4707 apply (erule exE)+ |
|
4708 apply(rule_tac b=b in back_subst) |
|
4709 prefer 2 |
|
4710 apply (subst(asm) eq_commute) |
|
4711 apply assumption |
|
4712 apply (subst interval_doublesplit[OF k]) |
|
4713 apply (rule content_pos_le) |
|
4714 apply (rule indicator_pos_le) |
|
4715 proof - |
|
4716 have "(\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) * ?i x) \<le> |
|
4717 (\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}))" |
|
4718 apply (rule setsum_mono) |
|
4719 unfolding split_paired_all split_conv |
|
4720 apply (rule mult_right_le_one_le) |
|
4721 apply (drule p'(4)) |
|
4722 apply (auto simp add:interval_doublesplit[OF k]) |
|
4723 done |
|
4724 also have "\<dots> < e" |
|
4725 proof (subst setsum.over_tagged_division_lemma[OF p[THEN conjunct1]], goal_cases) |
|
4726 case prems: (1 u v) |
|
4727 have "content (cbox u v \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<le> content (cbox u v)" |
|
4728 unfolding interval_doublesplit[OF k] |
|
4729 apply (rule content_subset) |
|
4730 unfolding interval_doublesplit[symmetric,OF k] |
|
4731 apply auto |
|
4732 done |
|
4733 then show ?case |
|
4734 unfolding prems interval_doublesplit[OF k] |
|
4735 by (blast intro: antisym) |
|
4736 next |
|
4737 have "(\<Sum>l\<in>snd ` p. content (l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})) = |
|
4738 setsum content ((\<lambda>l. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})`{l\<in>snd ` p. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}})" |
|
4739 proof (subst (2) setsum.reindex_nontrivial) |
|
4740 fix x y assume "x \<in> {l \<in> snd ` p. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}}" "y \<in> {l \<in> snd ` p. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}}" |
|
4741 "x \<noteq> y" and eq: "x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} = y \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}" |
|
4742 then obtain x' y' where "(x', x) \<in> p" "x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}" "(y', y) \<in> p" "y \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}" |
|
4743 by (auto) |
|
4744 from p'(5)[OF \<open>(x', x) \<in> p\<close> \<open>(y', y) \<in> p\<close>] \<open>x \<noteq> y\<close> have "interior (x \<inter> y) = {}" |
|
4745 by auto |
|
4746 moreover have "interior ((x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) \<inter> (y \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})) \<subseteq> interior (x \<inter> y)" |
|
4747 by (auto intro: interior_mono) |
|
4748 ultimately have "interior (x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) = {}" |
|
4749 by (auto simp: eq) |
|
4750 then show "content (x \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) = 0" |
|
4751 using p'(4)[OF \<open>(x', x) \<in> p\<close>] by (auto simp: interval_doublesplit[OF k] content_eq_0_interior simp del: interior_Int) |
|
4752 qed (insert p'(1), auto intro!: setsum.mono_neutral_right) |
|
4753 also have "\<dots> \<le> norm (\<Sum>l\<in>(\<lambda>l. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})`{l\<in>snd ` p. l \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d} \<noteq> {}}. content l *\<^sub>R 1::real)" |
|
4754 by simp |
|
4755 also have "\<dots> \<le> 1 * content (cbox a b \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})" |
|
4756 using division_doublesplit[OF p'' k, unfolded interval_doublesplit[OF k]] |
|
4757 unfolding interval_doublesplit[OF k] by (intro dsum_bound) auto |
|
4758 also have "\<dots> < e" |
|
4759 using d(2) by simp |
|
4760 finally show "(\<Sum>ka\<in>snd ` p. content (ka \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d})) < e" . |
|
4761 qed |
|
4762 finally show "(\<Sum>(x, ka)\<in>p. content (ka \<inter> {x. \<bar>x \<bullet> k - c\<bar> \<le> d}) * ?i x) < e" . |
|
4763 qed |
|
4764 qed |
|
4765 qed |
|
4766 |
|
4767 |
|
4768 subsection \<open>A technical lemma about "refinement" of division.\<close> |
|
4769 |
|
4770 lemma tagged_division_finer: |
|
4771 fixes p :: "('a::euclidean_space \<times> ('a::euclidean_space set)) set" |
|
4772 assumes "p tagged_division_of (cbox a b)" |
|
4773 and "gauge d" |
|
4774 obtains q where "q tagged_division_of (cbox a b)" |
|
4775 and "d fine q" |
|
4776 and "\<forall>(x,k) \<in> p. k \<subseteq> d(x) \<longrightarrow> (x,k) \<in> q" |
|
4777 proof - |
|
4778 let ?P = "\<lambda>p. p tagged_partial_division_of (cbox a b) \<longrightarrow> gauge d \<longrightarrow> |
|
4779 (\<exists>q. q tagged_division_of (\<Union>{k. \<exists>x. (x,k) \<in> p}) \<and> d fine q \<and> |
|
4780 (\<forall>(x,k) \<in> p. k \<subseteq> d(x) \<longrightarrow> (x,k) \<in> q))" |
|
4781 { |
|
4782 have *: "finite p" "p tagged_partial_division_of (cbox a b)" |
|
4783 using assms(1) |
|
4784 unfolding tagged_division_of_def |
|
4785 by auto |
|
4786 presume "\<And>p. finite p \<Longrightarrow> ?P p" |
|
4787 from this[rule_format,OF * assms(2)] guess q .. note q=this |
|
4788 then show ?thesis |
|
4789 apply - |
|
4790 apply (rule that[of q]) |
|
4791 unfolding tagged_division_ofD[OF assms(1)] |
|
4792 apply auto |
|
4793 done |
|
4794 } |
|
4795 fix p :: "('a::euclidean_space \<times> ('a::euclidean_space set)) set" |
|
4796 assume as: "finite p" |
|
4797 show "?P p" |
|
4798 apply rule |
|
4799 apply rule |
|
4800 using as |
|
4801 proof (induct p) |
|
4802 case empty |
|
4803 show ?case |
|
4804 apply (rule_tac x="{}" in exI) |
|
4805 unfolding fine_def |
|
4806 apply auto |
|
4807 done |
|
4808 next |
|
4809 case (insert xk p) |
|
4810 guess x k using surj_pair[of xk] by (elim exE) note xk=this |
|
4811 note tagged_partial_division_subset[OF insert(4) subset_insertI] |
|
4812 from insert(3)[OF this insert(5)] guess q1 .. note q1 = conjunctD3[OF this] |
|
4813 have *: "\<Union>{l. \<exists>y. (y,l) \<in> insert xk p} = k \<union> \<Union>{l. \<exists>y. (y,l) \<in> p}" |
|
4814 unfolding xk by auto |
|
4815 note p = tagged_partial_division_ofD[OF insert(4)] |
|
4816 from p(4)[unfolded xk, OF insertI1] guess u v by (elim exE) note uv=this |
|
4817 |
|
4818 have "finite {k. \<exists>x. (x, k) \<in> p}" |
|
4819 apply (rule finite_subset[of _ "snd ` p"]) |
|
4820 using p |
|
4821 apply safe |
|
4822 apply (metis image_iff snd_conv) |
|
4823 apply auto |
|
4824 done |
|
4825 then have int: "interior (cbox u v) \<inter> interior (\<Union>{k. \<exists>x. (x, k) \<in> p}) = {}" |
|
4826 apply (rule inter_interior_unions_intervals) |
|
4827 apply (rule open_interior) |
|
4828 apply (rule_tac[!] ballI) |
|
4829 unfolding mem_Collect_eq |
|
4830 apply (erule_tac[!] exE) |
|
4831 apply (drule p(4)[OF insertI2]) |
|
4832 apply assumption |
|
4833 apply (rule p(5)) |
|
4834 unfolding uv xk |
|
4835 apply (rule insertI1) |
|
4836 apply (rule insertI2) |
|
4837 apply assumption |
|
4838 using insert(2) |
|
4839 unfolding uv xk |
|
4840 apply auto |
|
4841 done |
|
4842 show ?case |
|
4843 proof (cases "cbox u v \<subseteq> d x") |
|
4844 case True |
|
4845 then show ?thesis |
|
4846 apply (rule_tac x="{(x,cbox u v)} \<union> q1" in exI) |
|
4847 apply rule |
|
4848 unfolding * uv |
|
4849 apply (rule tagged_division_union) |
|
4850 apply (rule tagged_division_of_self) |
|
4851 apply (rule p[unfolded xk uv] insertI1)+ |
|
4852 apply (rule q1) |
|
4853 apply (rule int) |
|
4854 apply rule |
|
4855 apply (rule fine_union) |
|
4856 apply (subst fine_def) |
|
4857 defer |
|
4858 apply (rule q1) |
|
4859 unfolding Ball_def split_paired_All split_conv |
|
4860 apply rule |
|
4861 apply rule |
|
4862 apply rule |
|
4863 apply rule |
|
4864 apply (erule insertE) |
|
4865 apply (simp add: uv xk) |
|
4866 apply (rule UnI2) |
|
4867 apply (drule q1(3)[rule_format]) |
|
4868 unfolding xk uv |
|
4869 apply auto |
|
4870 done |
|
4871 next |
|
4872 case False |
|
4873 from fine_division_exists[OF assms(2), of u v] guess q2 . note q2=this |
|
4874 show ?thesis |
|
4875 apply (rule_tac x="q2 \<union> q1" in exI) |
|
4876 apply rule |
|
4877 unfolding * uv |
|
4878 apply (rule tagged_division_union q2 q1 int fine_union)+ |
|
4879 unfolding Ball_def split_paired_All split_conv |
|
4880 apply rule |
|
4881 apply (rule fine_union) |
|
4882 apply (rule q1 q2)+ |
|
4883 apply rule |
|
4884 apply rule |
|
4885 apply rule |
|
4886 apply rule |
|
4887 apply (erule insertE) |
|
4888 apply (rule UnI2) |
|
4889 apply (simp add: False uv xk) |
|
4890 apply (drule q1(3)[rule_format]) |
|
4891 using False |
|
4892 unfolding xk uv |
|
4893 apply auto |
|
4894 done |
|
4895 qed |
|
4896 qed |
|
4897 qed |
|
4898 |
|
4899 |
|
4900 subsection \<open>Hence the main theorem about negligible sets.\<close> |
|
4901 |
|
4902 lemma finite_product_dependent: |
|
4903 assumes "finite s" |
|
4904 and "\<And>x. x \<in> s \<Longrightarrow> finite (t x)" |
|
4905 shows "finite {(i, j) |i j. i \<in> s \<and> j \<in> t i}" |
|
4906 using assms |
|
4907 proof induct |
|
4908 case (insert x s) |
|
4909 have *: "{(i, j) |i j. i \<in> insert x s \<and> j \<in> t i} = |
|
4910 (\<lambda>y. (x,y)) ` (t x) \<union> {(i, j) |i j. i \<in> s \<and> j \<in> t i}" by auto |
|
4911 show ?case |
|
4912 unfolding * |
|
4913 apply (rule finite_UnI) |
|
4914 using insert |
|
4915 apply auto |
|
4916 done |
|
4917 qed auto |
|
4918 |
|
4919 lemma sum_sum_product: |
|
4920 assumes "finite s" |
|
4921 and "\<forall>i\<in>s. finite (t i)" |
|
4922 shows "setsum (\<lambda>i. setsum (x i) (t i)::real) s = |
|
4923 setsum (\<lambda>(i,j). x i j) {(i,j) | i j. i \<in> s \<and> j \<in> t i}" |
|
4924 using assms |
|
4925 proof induct |
|
4926 case (insert a s) |
|
4927 have *: "{(i, j) |i j. i \<in> insert a s \<and> j \<in> t i} = |
|
4928 (\<lambda>y. (a,y)) ` (t a) \<union> {(i, j) |i j. i \<in> s \<and> j \<in> t i}" by auto |
|
4929 show ?case |
|
4930 unfolding * |
|
4931 apply (subst setsum.union_disjoint) |
|
4932 unfolding setsum.insert[OF insert(1-2)] |
|
4933 prefer 4 |
|
4934 apply (subst insert(3)) |
|
4935 unfolding add_right_cancel |
|
4936 proof - |
|
4937 show "setsum (x a) (t a) = (\<Sum>(xa, y)\<in> Pair a ` t a. x xa y)" |
|
4938 apply (subst setsum.reindex) |
|
4939 unfolding inj_on_def |
|
4940 apply auto |
|
4941 done |
|
4942 show "finite {(i, j) |i j. i \<in> s \<and> j \<in> t i}" |
|
4943 apply (rule finite_product_dependent) |
|
4944 using insert |
|
4945 apply auto |
|
4946 done |
|
4947 qed (insert insert, auto) |
|
4948 qed auto |
|
4949 |
|
4950 lemma has_integral_negligible: |
|
4951 fixes f :: "'b::euclidean_space \<Rightarrow> 'a::real_normed_vector" |
|
4952 assumes "negligible s" |
|
4953 and "\<forall>x\<in>(t - s). f x = 0" |
|
4954 shows "(f has_integral 0) t" |
|
4955 proof - |
|
4956 presume P: "\<And>f::'b::euclidean_space \<Rightarrow> 'a. |
|
4957 \<And>a b. \<forall>x. x \<notin> s \<longrightarrow> f x = 0 \<Longrightarrow> (f has_integral 0) (cbox a b)" |
|
4958 let ?f = "(\<lambda>x. if x \<in> t then f x else 0)" |
|
4959 show ?thesis |
|
4960 apply (rule_tac f="?f" in has_integral_eq) |
|
4961 unfolding if_P |
|
4962 apply (rule refl) |
|
4963 apply (subst has_integral_alt) |
|
4964 apply cases |
|
4965 apply (subst if_P, assumption) |
|
4966 unfolding if_not_P |
|
4967 proof - |
|
4968 assume "\<exists>a b. t = cbox a b" |
|
4969 then guess a b apply - by (erule exE)+ note t = this |
|
4970 show "(?f has_integral 0) t" |
|
4971 unfolding t |
|
4972 apply (rule P) |
|
4973 using assms(2) |
|
4974 unfolding t |
|
4975 apply auto |
|
4976 done |
|
4977 next |
|
4978 show "\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> |
|
4979 (\<exists>z. ((\<lambda>x. if x \<in> t then ?f x else 0) has_integral z) (cbox a b) \<and> norm (z - 0) < e)" |
|
4980 apply safe |
|
4981 apply (rule_tac x=1 in exI) |
|
4982 apply rule |
|
4983 apply (rule zero_less_one) |
|
4984 apply safe |
|
4985 apply (rule_tac x=0 in exI) |
|
4986 apply rule |
|
4987 apply (rule P) |
|
4988 using assms(2) |
|
4989 apply auto |
|
4990 done |
|
4991 qed |
|
4992 next |
|
4993 fix f :: "'b \<Rightarrow> 'a" |
|
4994 fix a b :: 'b |
|
4995 assume assm: "\<forall>x. x \<notin> s \<longrightarrow> f x = 0" |
|
4996 show "(f has_integral 0) (cbox a b)" |
|
4997 unfolding has_integral |
|
4998 proof (safe, goal_cases) |
|
4999 case prems: (1 e) |
|
5000 then have "\<And>n. e / 2 / ((real n+1) * (2 ^ n)) > 0" |
|
5001 apply - |
|
5002 apply (rule divide_pos_pos) |
|
5003 defer |
|
5004 apply (rule mult_pos_pos) |
|
5005 apply (auto simp add:field_simps) |
|
5006 done |
|
5007 note assms(1)[unfolded negligible_def has_integral,rule_format,OF this,of a b] |
|
5008 note allI[OF this,of "\<lambda>x. x"] |
|
5009 from choice[OF this] guess d .. note d=conjunctD2[OF this[rule_format]] |
|
5010 show ?case |
|
5011 apply (rule_tac x="\<lambda>x. d (nat \<lfloor>norm (f x)\<rfloor>) x" in exI) |
|
5012 proof safe |
|
5013 show "gauge (\<lambda>x. d (nat \<lfloor>norm (f x)\<rfloor>) x)" |
|
5014 using d(1) unfolding gauge_def by auto |
|
5015 fix p |
|
5016 assume as: "p tagged_division_of (cbox a b)" "(\<lambda>x. d (nat \<lfloor>norm (f x)\<rfloor>) x) fine p" |
|
5017 let ?goal = "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) < e" |
|
5018 { |
|
5019 presume "p \<noteq> {} \<Longrightarrow> ?goal" |
|
5020 then show ?goal |
|
5021 apply (cases "p = {}") |
|
5022 using prems |
|
5023 apply auto |
|
5024 done |
|
5025 } |
|
5026 assume as': "p \<noteq> {}" |
|
5027 from real_arch_simple[of "Max((\<lambda>(x,k). norm(f x)) ` p)"] guess N .. |
|
5028 then have N: "\<forall>x\<in>(\<lambda>(x, k). norm (f x)) ` p. x \<le> real N" |
|
5029 by (meson Max_ge as(1) dual_order.trans finite_imageI tagged_division_of_finite) |
|
5030 have "\<forall>i. \<exists>q. q tagged_division_of (cbox a b) \<and> (d i) fine q \<and> (\<forall>(x, k)\<in>p. k \<subseteq> (d i) x \<longrightarrow> (x, k) \<in> q)" |
|
5031 by (auto intro: tagged_division_finer[OF as(1) d(1)]) |
|
5032 from choice[OF this] guess q .. note q=conjunctD3[OF this[rule_format]] |
|
5033 have *: "\<And>i. (\<Sum>(x, k)\<in>q i. content k *\<^sub>R indicator s x) \<ge> (0::real)" |
|
5034 apply (rule setsum_nonneg) |
|
5035 apply safe |
|
5036 unfolding real_scaleR_def |
|
5037 apply (drule tagged_division_ofD(4)[OF q(1)]) |
|
5038 apply (auto intro: mult_nonneg_nonneg) |
|
5039 done |
|
5040 have **: "finite s \<Longrightarrow> finite t \<Longrightarrow> (\<forall>(x,y) \<in> t. (0::real) \<le> g(x,y)) \<Longrightarrow> |
|
5041 (\<forall>y\<in>s. \<exists>x. (x,y) \<in> t \<and> f(y) \<le> g(x,y)) \<Longrightarrow> setsum f s \<le> setsum g t" for f g s t |
|
5042 apply (rule setsum_le_included[of s t g snd f]) |
|
5043 prefer 4 |
|
5044 apply safe |
|
5045 apply (erule_tac x=x in ballE) |
|
5046 apply (erule exE) |
|
5047 apply (rule_tac x="(xa,x)" in bexI) |
|
5048 apply auto |
|
5049 done |
|
5050 have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - 0) \<le> setsum (\<lambda>i. (real i + 1) * |
|
5051 norm (setsum (\<lambda>(x,k). content k *\<^sub>R indicator s x :: real) (q i))) {..N+1}" |
|
5052 unfolding real_norm_def setsum_right_distrib abs_of_nonneg[OF *] diff_0_right |
|
5053 apply (rule order_trans) |
|
5054 apply (rule norm_setsum) |
|
5055 apply (subst sum_sum_product) |
|
5056 prefer 3 |
|
5057 proof (rule **, safe) |
|
5058 show "finite {(i, j) |i j. i \<in> {..N + 1} \<and> j \<in> q i}" |
|
5059 apply (rule finite_product_dependent) |
|
5060 using q |
|
5061 apply auto |
|
5062 done |
|
5063 fix i a b |
|
5064 assume as'': "(a, b) \<in> q i" |
|
5065 show "0 \<le> (real i + 1) * (content b *\<^sub>R indicator s a)" |
|
5066 unfolding real_scaleR_def |
|
5067 using tagged_division_ofD(4)[OF q(1) as''] |
|
5068 by (auto intro!: mult_nonneg_nonneg) |
|
5069 next |
|
5070 fix i :: nat |
|
5071 show "finite (q i)" |
|
5072 using q by auto |
|
5073 next |
|
5074 fix x k |
|
5075 assume xk: "(x, k) \<in> p" |
|
5076 define n where "n = nat \<lfloor>norm (f x)\<rfloor>" |
|
5077 have *: "norm (f x) \<in> (\<lambda>(x, k). norm (f x)) ` p" |
|
5078 using xk by auto |
|
5079 have nfx: "real n \<le> norm (f x)" "norm (f x) \<le> real n + 1" |
|
5080 unfolding n_def by auto |
|
5081 then have "n \<in> {0..N + 1}" |
|
5082 using N[rule_format,OF *] by auto |
|
5083 moreover |
|
5084 note as(2)[unfolded fine_def,rule_format,OF xk,unfolded split_conv] |
|
5085 note q(3)[rule_format,OF xk,unfolded split_conv,rule_format,OF this] |
|
5086 note this[unfolded n_def[symmetric]] |
|
5087 moreover |
|
5088 have "norm (content k *\<^sub>R f x) \<le> (real n + 1) * (content k * indicator s x)" |
|
5089 proof (cases "x \<in> s") |
|
5090 case False |
|
5091 then show ?thesis |
|
5092 using assm by auto |
|
5093 next |
|
5094 case True |
|
5095 have *: "content k \<ge> 0" |
|
5096 using tagged_division_ofD(4)[OF as(1) xk] by auto |
|
5097 moreover |
|
5098 have "content k * norm (f x) \<le> content k * (real n + 1)" |
|
5099 apply (rule mult_mono) |
|
5100 using nfx * |
|
5101 apply auto |
|
5102 done |
|
5103 ultimately |
|
5104 show ?thesis |
|
5105 unfolding abs_mult |
|
5106 using nfx True |
|
5107 by (auto simp add: field_simps) |
|
5108 qed |
|
5109 ultimately show "\<exists>y. (y, x, k) \<in> {(i, j) |i j. i \<in> {..N + 1} \<and> j \<in> q i} \<and> norm (content k *\<^sub>R f x) \<le> |
|
5110 (real y + 1) * (content k *\<^sub>R indicator s x)" |
|
5111 apply (rule_tac x=n in exI) |
|
5112 apply safe |
|
5113 apply (rule_tac x=n in exI) |
|
5114 apply (rule_tac x="(x,k)" in exI) |
|
5115 apply safe |
|
5116 apply auto |
|
5117 done |
|
5118 qed (insert as, auto) |
|
5119 also have "\<dots> \<le> setsum (\<lambda>i. e / 2 / 2 ^ i) {..N+1}" |
|
5120 proof (rule setsum_mono, goal_cases) |
|
5121 case (1 i) |
|
5122 then show ?case |
|
5123 apply (subst mult.commute, subst pos_le_divide_eq[symmetric]) |
|
5124 using d(2)[rule_format, of "q i" i] |
|
5125 using q[rule_format] |
|
5126 apply (auto simp add: field_simps) |
|
5127 done |
|
5128 qed |
|
5129 also have "\<dots> < e * inverse 2 * 2" |
|
5130 unfolding divide_inverse setsum_right_distrib[symmetric] |
|
5131 apply (rule mult_strict_left_mono) |
|
5132 unfolding power_inverse [symmetric] lessThan_Suc_atMost[symmetric] |
|
5133 apply (subst geometric_sum) |
|
5134 using prems |
|
5135 apply auto |
|
5136 done |
|
5137 finally show "?goal" by auto |
|
5138 qed |
|
5139 qed |
|
5140 qed |
|
5141 |
|
5142 lemma has_integral_spike: |
|
5143 fixes f :: "'b::euclidean_space \<Rightarrow> 'a::real_normed_vector" |
|
5144 assumes "negligible s" |
|
5145 and "(\<forall>x\<in>(t - s). g x = f x)" |
|
5146 and "(f has_integral y) t" |
|
5147 shows "(g has_integral y) t" |
|
5148 proof - |
|
5149 { |
|
5150 fix a b :: 'b |
|
5151 fix f g :: "'b \<Rightarrow> 'a" |
|
5152 fix y :: 'a |
|
5153 assume as: "\<forall>x \<in> cbox a b - s. g x = f x" "(f has_integral y) (cbox a b)" |
|
5154 have "((\<lambda>x. f x + (g x - f x)) has_integral (y + 0)) (cbox a b)" |
|
5155 apply (rule has_integral_add[OF as(2)]) |
|
5156 apply (rule has_integral_negligible[OF assms(1)]) |
|
5157 using as |
|
5158 apply auto |
|
5159 done |
|
5160 then have "(g has_integral y) (cbox a b)" |
|
5161 by auto |
|
5162 } note * = this |
|
5163 show ?thesis |
|
5164 apply (subst has_integral_alt) |
|
5165 using assms(2-) |
|
5166 apply - |
|
5167 apply (rule cond_cases) |
|
5168 apply safe |
|
5169 apply (rule *) |
|
5170 apply assumption+ |
|
5171 apply (subst(asm) has_integral_alt) |
|
5172 unfolding if_not_P |
|
5173 apply (erule_tac x=e in allE) |
|
5174 apply safe |
|
5175 apply (rule_tac x=B in exI) |
|
5176 apply safe |
|
5177 apply (erule_tac x=a in allE) |
|
5178 apply (erule_tac x=b in allE) |
|
5179 apply safe |
|
5180 apply (rule_tac x=z in exI) |
|
5181 apply safe |
|
5182 apply (rule *[where fa2="\<lambda>x. if x\<in>t then f x else 0"]) |
|
5183 apply auto |
|
5184 done |
|
5185 qed |
|
5186 |
|
5187 lemma has_integral_spike_eq: |
|
5188 assumes "negligible s" |
|
5189 and "\<forall>x\<in>(t - s). g x = f x" |
|
5190 shows "((f has_integral y) t \<longleftrightarrow> (g has_integral y) t)" |
|
5191 apply rule |
|
5192 apply (rule_tac[!] has_integral_spike[OF assms(1)]) |
|
5193 using assms(2) |
|
5194 apply auto |
|
5195 done |
|
5196 |
|
5197 lemma integrable_spike: |
|
5198 assumes "negligible s" |
|
5199 and "\<forall>x\<in>(t - s). g x = f x" |
|
5200 and "f integrable_on t" |
|
5201 shows "g integrable_on t" |
|
5202 using assms |
|
5203 unfolding integrable_on_def |
|
5204 apply - |
|
5205 apply (erule exE) |
|
5206 apply rule |
|
5207 apply (rule has_integral_spike) |
|
5208 apply fastforce+ |
|
5209 done |
|
5210 |
|
5211 lemma integral_spike: |
|
5212 assumes "negligible s" |
|
5213 and "\<forall>x\<in>(t - s). g x = f x" |
|
5214 shows "integral t f = integral t g" |
|
5215 using has_integral_spike_eq[OF assms] by (simp add: integral_def integrable_on_def) |
|
5216 |
|
5217 |
|
5218 subsection \<open>Some other trivialities about negligible sets.\<close> |
|
5219 |
|
5220 lemma negligible_subset[intro]: |
|
5221 assumes "negligible s" |
|
5222 and "t \<subseteq> s" |
|
5223 shows "negligible t" |
|
5224 unfolding negligible_def |
|
5225 proof (safe, goal_cases) |
|
5226 case (1 a b) |
|
5227 show ?case |
|
5228 using assms(1)[unfolded negligible_def,rule_format,of a b] |
|
5229 apply - |
|
5230 apply (rule has_integral_spike[OF assms(1)]) |
|
5231 defer |
|
5232 apply assumption |
|
5233 using assms(2) |
|
5234 unfolding indicator_def |
|
5235 apply auto |
|
5236 done |
|
5237 qed |
|
5238 |
|
5239 lemma negligible_diff[intro?]: |
|
5240 assumes "negligible s" |
|
5241 shows "negligible (s - t)" |
|
5242 using assms by auto |
|
5243 |
|
5244 lemma negligible_Int: |
|
5245 assumes "negligible s \<or> negligible t" |
|
5246 shows "negligible (s \<inter> t)" |
|
5247 using assms by auto |
|
5248 |
|
5249 lemma negligible_Un: |
|
5250 assumes "negligible s" |
|
5251 and "negligible t" |
|
5252 shows "negligible (s \<union> t)" |
|
5253 unfolding negligible_def |
|
5254 proof (safe, goal_cases) |
|
5255 case (1 a b) |
|
5256 note assm = assms[unfolded negligible_def,rule_format,of a b] |
|
5257 then show ?case |
|
5258 apply (subst has_integral_spike_eq[OF assms(2)]) |
|
5259 defer |
|
5260 apply assumption |
|
5261 unfolding indicator_def |
|
5262 apply auto |
|
5263 done |
|
5264 qed |
|
5265 |
|
5266 lemma negligible_Un_eq[simp]: "negligible (s \<union> t) \<longleftrightarrow> negligible s \<and> negligible t" |
|
5267 using negligible_Un by auto |
|
5268 |
|
5269 lemma negligible_sing[intro]: "negligible {a::'a::euclidean_space}" |
|
5270 using negligible_standard_hyperplane[OF SOME_Basis, of "a \<bullet> (SOME i. i \<in> Basis)"] by auto |
|
5271 |
|
5272 lemma negligible_insert[simp]: "negligible (insert a s) \<longleftrightarrow> negligible s" |
|
5273 apply (subst insert_is_Un) |
|
5274 unfolding negligible_Un_eq |
|
5275 apply auto |
|
5276 done |
|
5277 |
|
5278 lemma negligible_empty[iff]: "negligible {}" |
|
5279 by auto |
|
5280 |
|
5281 lemma negligible_finite[intro]: |
|
5282 assumes "finite s" |
|
5283 shows "negligible s" |
|
5284 using assms by (induct s) auto |
|
5285 |
|
5286 lemma negligible_Union[intro]: |
|
5287 assumes "finite s" |
|
5288 and "\<forall>t\<in>s. negligible t" |
|
5289 shows "negligible(\<Union>s)" |
|
5290 using assms by induct auto |
|
5291 |
|
5292 lemma negligible: |
|
5293 "negligible s \<longleftrightarrow> (\<forall>t::('a::euclidean_space) set. ((indicator s::'a\<Rightarrow>real) has_integral 0) t)" |
|
5294 apply safe |
|
5295 defer |
|
5296 apply (subst negligible_def) |
|
5297 proof - |
|
5298 fix t :: "'a set" |
|
5299 assume as: "negligible s" |
|
5300 have *: "(\<lambda>x. if x \<in> s \<inter> t then 1 else 0) = (\<lambda>x. if x\<in>t then if x\<in>s then 1 else 0 else 0)" |
|
5301 by auto |
|
5302 show "((indicator s::'a\<Rightarrow>real) has_integral 0) t" |
|
5303 apply (subst has_integral_alt) |
|
5304 apply cases |
|
5305 apply (subst if_P,assumption) |
|
5306 unfolding if_not_P |
|
5307 apply safe |
|
5308 apply (rule as[unfolded negligible_def,rule_format]) |
|
5309 apply (rule_tac x=1 in exI) |
|
5310 apply safe |
|
5311 apply (rule zero_less_one) |
|
5312 apply (rule_tac x=0 in exI) |
|
5313 using negligible_subset[OF as,of "s \<inter> t"] |
|
5314 unfolding negligible_def indicator_def [abs_def] |
|
5315 unfolding * |
|
5316 apply auto |
|
5317 done |
|
5318 qed auto |
|
5319 |
|
5320 |
|
5321 subsection \<open>Finite case of the spike theorem is quite commonly needed.\<close> |
|
5322 |
|
5323 lemma has_integral_spike_finite: |
|
5324 assumes "finite s" |
|
5325 and "\<forall>x\<in>t-s. g x = f x" |
|
5326 and "(f has_integral y) t" |
|
5327 shows "(g has_integral y) t" |
|
5328 apply (rule has_integral_spike) |
|
5329 using assms |
|
5330 apply auto |
|
5331 done |
|
5332 |
|
5333 lemma has_integral_spike_finite_eq: |
|
5334 assumes "finite s" |
|
5335 and "\<forall>x\<in>t-s. g x = f x" |
|
5336 shows "((f has_integral y) t \<longleftrightarrow> (g has_integral y) t)" |
|
5337 apply rule |
|
5338 apply (rule_tac[!] has_integral_spike_finite) |
|
5339 using assms |
|
5340 apply auto |
|
5341 done |
|
5342 |
|
5343 lemma integrable_spike_finite: |
|
5344 assumes "finite s" |
|
5345 and "\<forall>x\<in>t-s. g x = f x" |
|
5346 and "f integrable_on t" |
|
5347 shows "g integrable_on t" |
|
5348 using assms |
|
5349 unfolding integrable_on_def |
|
5350 apply safe |
|
5351 apply (rule_tac x=y in exI) |
|
5352 apply (rule has_integral_spike_finite) |
|
5353 apply auto |
|
5354 done |
|
5355 |
|
5356 |
|
5357 subsection \<open>In particular, the boundary of an interval is negligible.\<close> |
|
5358 |
|
5359 lemma negligible_frontier_interval: "negligible(cbox (a::'a::euclidean_space) b - box a b)" |
|
5360 proof - |
|
5361 let ?A = "\<Union>((\<lambda>k. {x. x\<bullet>k = a\<bullet>k} \<union> {x::'a. x\<bullet>k = b\<bullet>k}) ` Basis)" |
|
5362 have "cbox a b - box a b \<subseteq> ?A" |
|
5363 apply rule unfolding Diff_iff mem_box |
|
5364 apply simp |
|
5365 apply(erule conjE bexE)+ |
|
5366 apply(rule_tac x=i in bexI) |
|
5367 apply auto |
|
5368 done |
|
5369 then show ?thesis |
|
5370 apply - |
|
5371 apply (rule negligible_subset[of ?A]) |
|
5372 apply (rule negligible_Union[OF finite_imageI]) |
|
5373 apply auto |
|
5374 done |
|
5375 qed |
|
5376 |
|
5377 lemma has_integral_spike_interior: |
|
5378 assumes "\<forall>x\<in>box a b. g x = f x" |
|
5379 and "(f has_integral y) (cbox a b)" |
|
5380 shows "(g has_integral y) (cbox a b)" |
|
5381 apply (rule has_integral_spike[OF negligible_frontier_interval _ assms(2)]) |
|
5382 using assms(1) |
|
5383 apply auto |
|
5384 done |
|
5385 |
|
5386 lemma has_integral_spike_interior_eq: |
|
5387 assumes "\<forall>x\<in>box a b. g x = f x" |
|
5388 shows "(f has_integral y) (cbox a b) \<longleftrightarrow> (g has_integral y) (cbox a b)" |
|
5389 apply rule |
|
5390 apply (rule_tac[!] has_integral_spike_interior) |
|
5391 using assms |
|
5392 apply auto |
|
5393 done |
|
5394 |
|
5395 lemma integrable_spike_interior: |
|
5396 assumes "\<forall>x\<in>box a b. g x = f x" |
|
5397 and "f integrable_on cbox a b" |
|
5398 shows "g integrable_on cbox a b" |
|
5399 using assms |
|
5400 unfolding integrable_on_def |
|
5401 using has_integral_spike_interior[OF assms(1)] |
|
5402 by auto |
|
5403 |
|
5404 |
|
5405 subsection \<open>Integrability of continuous functions.\<close> |
|
5406 |
|
5407 lemma operative_approximable: |
|
5408 fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach" |
|
5409 assumes "0 \<le> e" |
|
5410 shows "comm_monoid.operative op \<and> True (\<lambda>i. \<exists>g. (\<forall>x\<in>i. norm (f x - g (x::'b)) \<le> e) \<and> g integrable_on i)" |
|
5411 unfolding comm_monoid.operative_def[OF comm_monoid_and] |
|
5412 proof safe |
|
5413 fix a b :: 'b |
|
5414 show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b" |
|
5415 if "content (cbox a b) = 0" |
|
5416 apply (rule_tac x=f in exI) |
|
5417 using assms that |
|
5418 apply (auto intro!: integrable_on_null) |
|
5419 done |
|
5420 { |
|
5421 fix c g |
|
5422 fix k :: 'b |
|
5423 assume as: "\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e" "g integrable_on cbox a b" |
|
5424 assume k: "k \<in> Basis" |
|
5425 show "\<exists>g. (\<forall>x\<in>cbox a b \<inter> {x. x \<bullet> k \<le> c}. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}" |
|
5426 "\<exists>g. (\<forall>x\<in>cbox a b \<inter> {x. c \<le> x \<bullet> k}. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k}" |
|
5427 apply (rule_tac[!] x=g in exI) |
|
5428 using as(1) integrable_split[OF as(2) k] |
|
5429 apply auto |
|
5430 done |
|
5431 } |
|
5432 fix c k g1 g2 |
|
5433 assume as: "\<forall>x\<in>cbox a b \<inter> {x. x \<bullet> k \<le> c}. norm (f x - g1 x) \<le> e" "g1 integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}" |
|
5434 "\<forall>x\<in>cbox a b \<inter> {x. c \<le> x \<bullet> k}. norm (f x - g2 x) \<le> e" "g2 integrable_on cbox a b \<inter> {x. c \<le> x \<bullet> k}" |
|
5435 assume k: "k \<in> Basis" |
|
5436 let ?g = "\<lambda>x. if x\<bullet>k = c then f x else if x\<bullet>k \<le> c then g1 x else g2 x" |
|
5437 show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b" |
|
5438 apply (rule_tac x="?g" in exI) |
|
5439 apply safe |
|
5440 proof goal_cases |
|
5441 case (1 x) |
|
5442 then show ?case |
|
5443 apply - |
|
5444 apply (cases "x\<bullet>k=c") |
|
5445 apply (case_tac "x\<bullet>k < c") |
|
5446 using as assms |
|
5447 apply auto |
|
5448 done |
|
5449 next |
|
5450 case 2 |
|
5451 presume "?g integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}" |
|
5452 and "?g integrable_on cbox a b \<inter> {x. x \<bullet> k \<ge> c}" |
|
5453 then guess h1 h2 unfolding integrable_on_def by auto |
|
5454 from has_integral_split[OF this k] show ?case |
|
5455 unfolding integrable_on_def by auto |
|
5456 next |
|
5457 show "?g integrable_on cbox a b \<inter> {x. x \<bullet> k \<le> c}" "?g integrable_on cbox a b \<inter> {x. x \<bullet> k \<ge> c}" |
|
5458 apply(rule_tac[!] integrable_spike[OF negligible_standard_hyperplane[of k c]]) |
|
5459 using k as(2,4) |
|
5460 apply auto |
|
5461 done |
|
5462 qed |
|
5463 qed |
|
5464 |
|
5465 lemma comm_monoid_set_F_and: "comm_monoid_set.F op \<and> True f s \<longleftrightarrow> (finite s \<longrightarrow> (\<forall>x\<in>s. f x))" |
|
5466 proof - |
|
5467 interpret bool: comm_monoid_set "op \<and>" True |
|
5468 proof qed auto |
|
5469 show ?thesis |
|
5470 by (induction s rule: infinite_finite_induct) auto |
|
5471 qed |
|
5472 |
|
5473 lemma approximable_on_division: |
|
5474 fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach" |
|
5475 assumes "0 \<le> e" |
|
5476 and "d division_of (cbox a b)" |
|
5477 and "\<forall>i\<in>d. \<exists>g. (\<forall>x\<in>i. norm (f x - g x) \<le> e) \<and> g integrable_on i" |
|
5478 obtains g where "\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e" "g integrable_on cbox a b" |
|
5479 proof - |
|
5480 note * = comm_monoid_set.operative_division[OF comm_monoid_set_and operative_approximable[OF assms(1)] assms(2)] |
|
5481 from assms(3) this[unfolded comm_monoid_set_F_and, of f] division_of_finite[OF assms(2)] |
|
5482 guess g by auto |
|
5483 then show thesis |
|
5484 apply - |
|
5485 apply (rule that[of g]) |
|
5486 apply auto |
|
5487 done |
|
5488 qed |
|
5489 |
|
5490 lemma integrable_continuous: |
|
5491 fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach" |
|
5492 assumes "continuous_on (cbox a b) f" |
|
5493 shows "f integrable_on cbox a b" |
|
5494 proof (rule integrable_uniform_limit, safe) |
|
5495 fix e :: real |
|
5496 assume e: "e > 0" |
|
5497 from compact_uniformly_continuous[OF assms compact_cbox,unfolded uniformly_continuous_on_def,rule_format,OF e] guess d .. |
|
5498 note d=conjunctD2[OF this,rule_format] |
|
5499 from fine_division_exists[OF gauge_ball[OF d(1)], of a b] guess p . note p=this |
|
5500 note p' = tagged_division_ofD[OF p(1)] |
|
5501 have *: "\<forall>i\<in>snd ` p. \<exists>g. (\<forall>x\<in>i. norm (f x - g x) \<le> e) \<and> g integrable_on i" |
|
5502 proof (safe, unfold snd_conv) |
|
5503 fix x l |
|
5504 assume as: "(x, l) \<in> p" |
|
5505 from p'(4)[OF this] guess a b by (elim exE) note l=this |
|
5506 show "\<exists>g. (\<forall>x\<in>l. norm (f x - g x) \<le> e) \<and> g integrable_on l" |
|
5507 apply (rule_tac x="\<lambda>y. f x" in exI) |
|
5508 proof safe |
|
5509 show "(\<lambda>y. f x) integrable_on l" |
|
5510 unfolding integrable_on_def l |
|
5511 apply rule |
|
5512 apply (rule has_integral_const) |
|
5513 done |
|
5514 fix y |
|
5515 assume y: "y \<in> l" |
|
5516 note fineD[OF p(2) as,unfolded subset_eq,rule_format,OF this] |
|
5517 note d(2)[OF _ _ this[unfolded mem_ball]] |
|
5518 then show "norm (f y - f x) \<le> e" |
|
5519 using y p'(2-3)[OF as] unfolding dist_norm l norm_minus_commute by fastforce |
|
5520 qed |
|
5521 qed |
|
5522 from e have "e \<ge> 0" |
|
5523 by auto |
|
5524 from approximable_on_division[OF this division_of_tagged_division[OF p(1)] *] guess g . |
|
5525 then show "\<exists>g. (\<forall>x\<in>cbox a b. norm (f x - g x) \<le> e) \<and> g integrable_on cbox a b" |
|
5526 by auto |
|
5527 qed |
|
5528 |
|
5529 lemma integrable_continuous_real: |
|
5530 fixes f :: "real \<Rightarrow> 'a::banach" |
|
5531 assumes "continuous_on {a .. b} f" |
|
5532 shows "f integrable_on {a .. b}" |
|
5533 by (metis assms box_real(2) integrable_continuous) |
|
5534 |
|
5535 subsection \<open>Specialization of additivity to one dimension.\<close> |
|
5536 |
|
5537 subsection \<open>Special case of additivity we need for the FTC.\<close> |
|
5538 |
|
5539 lemma additive_tagged_division_1: |
|
5540 fixes f :: "real \<Rightarrow> 'a::real_normed_vector" |
|
5541 assumes "a \<le> b" |
|
5542 and "p tagged_division_of {a..b}" |
|
5543 shows "setsum (\<lambda>(x,k). f(Sup k) - f(Inf k)) p = f b - f a" |
|
5544 proof - |
|
5545 let ?f = "(\<lambda>k::(real) set. if k = {} then 0 else f(interval_upperbound k) - f(interval_lowerbound k))" |
|
5546 have ***: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i" |
|
5547 using assms by auto |
|
5548 have *: "add.operative ?f" |
|
5549 unfolding add.operative_1_lt box_eq_empty |
|
5550 by auto |
|
5551 have **: "cbox a b \<noteq> {}" |
|
5552 using assms(1) by auto |
|
5553 note setsum.operative_tagged_division[OF * assms(2)[simplified box_real[symmetric]]] |
|
5554 note * = this[unfolded if_not_P[OF **] interval_bounds[OF ***],symmetric] |
|
5555 show ?thesis |
|
5556 unfolding * |
|
5557 apply (rule setsum.cong) |
|
5558 unfolding split_paired_all split_conv |
|
5559 using assms(2) |
|
5560 apply auto |
|
5561 done |
|
5562 qed |
|
5563 |
|
5564 |
|
5565 subsection \<open>A useful lemma allowing us to factor out the content size.\<close> |
|
5566 |
|
5567 lemma has_integral_factor_content: |
|
5568 "(f has_integral i) (cbox a b) \<longleftrightarrow> |
|
5569 (\<forall>e>0. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
|
5570 norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - i) \<le> e * content (cbox a b)))" |
|
5571 proof (cases "content (cbox a b) = 0") |
|
5572 case True |
|
5573 show ?thesis |
|
5574 unfolding has_integral_null_eq[OF True] |
|
5575 apply safe |
|
5576 apply (rule, rule, rule gauge_trivial, safe) |
|
5577 unfolding setsum_content_null[OF True] True |
|
5578 defer |
|
5579 apply (erule_tac x=1 in allE) |
|
5580 apply safe |
|
5581 defer |
|
5582 apply (rule fine_division_exists[of _ a b]) |
|
5583 apply assumption |
|
5584 apply (erule_tac x=p in allE) |
|
5585 unfolding setsum_content_null[OF True] |
|
5586 apply auto |
|
5587 done |
|
5588 next |
|
5589 case False |
|
5590 note F = this[unfolded content_lt_nz[symmetric]] |
|
5591 let ?P = "\<lambda>e opp. \<exists>d. gauge d \<and> |
|
5592 (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> opp (norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i)) e)" |
|
5593 show ?thesis |
|
5594 apply (subst has_integral) |
|
5595 proof safe |
|
5596 fix e :: real |
|
5597 assume e: "e > 0" |
|
5598 { |
|
5599 assume "\<forall>e>0. ?P e op <" |
|
5600 then show "?P (e * content (cbox a b)) op \<le>" |
|
5601 apply (erule_tac x="e * content (cbox a b)" in allE) |
|
5602 apply (erule impE) |
|
5603 defer |
|
5604 apply (erule exE,rule_tac x=d in exI) |
|
5605 using F e |
|
5606 apply (auto simp add:field_simps) |
|
5607 done |
|
5608 } |
|
5609 { |
|
5610 assume "\<forall>e>0. ?P (e * content (cbox a b)) op \<le>" |
|
5611 then show "?P e op <" |
|
5612 apply (erule_tac x="e / 2 / content (cbox a b)" in allE) |
|
5613 apply (erule impE) |
|
5614 defer |
|
5615 apply (erule exE,rule_tac x=d in exI) |
|
5616 using F e |
|
5617 apply (auto simp add: field_simps) |
|
5618 done |
|
5619 } |
|
5620 qed |
|
5621 qed |
|
5622 |
|
5623 lemma has_integral_factor_content_real: |
|
5624 "(f has_integral i) {a .. b::real} \<longleftrightarrow> |
|
5625 (\<forall>e>0. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a .. b} \<and> d fine p \<longrightarrow> |
|
5626 norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - i) \<le> e * content {a .. b} ))" |
|
5627 unfolding box_real[symmetric] |
|
5628 by (rule has_integral_factor_content) |
|
5629 |
|
5630 |
|
5631 subsection \<open>Fundamental theorem of calculus.\<close> |
|
5632 |
|
5633 lemma interval_bounds_real: |
|
5634 fixes q b :: real |
|
5635 assumes "a \<le> b" |
|
5636 shows "Sup {a..b} = b" |
|
5637 and "Inf {a..b} = a" |
|
5638 using assms by auto |
|
5639 |
|
5640 lemma fundamental_theorem_of_calculus: |
|
5641 fixes f :: "real \<Rightarrow> 'a::banach" |
|
5642 assumes "a \<le> b" |
|
5643 and "\<forall>x\<in>{a .. b}. (f has_vector_derivative f' x) (at x within {a .. b})" |
|
5644 shows "(f' has_integral (f b - f a)) {a .. b}" |
|
5645 unfolding has_integral_factor_content box_real[symmetric] |
|
5646 proof safe |
|
5647 fix e :: real |
|
5648 assume e: "e > 0" |
|
5649 note assm = assms(2)[unfolded has_vector_derivative_def has_derivative_within_alt] |
|
5650 have *: "\<And>P Q. \<forall>x\<in>{a .. b}. P x \<and> (\<forall>e>0. \<exists>d>0. Q x e d) \<Longrightarrow> \<forall>x. \<exists>(d::real)>0. x\<in>{a .. b} \<longrightarrow> Q x e d" |
|
5651 using e by blast |
|
5652 note this[OF assm,unfolded gauge_existence_lemma] |
|
5653 from choice[OF this,unfolded Ball_def[symmetric]] guess d .. |
|
5654 note d=conjunctD2[OF this[rule_format],rule_format] |
|
5655 show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
|
5656 norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content (cbox a b))" |
|
5657 apply (rule_tac x="\<lambda>x. ball x (d x)" in exI) |
|
5658 apply safe |
|
5659 apply (rule gauge_ball_dependent) |
|
5660 apply rule |
|
5661 apply (rule d(1)) |
|
5662 proof - |
|
5663 fix p |
|
5664 assume as: "p tagged_division_of cbox a b" "(\<lambda>x. ball x (d x)) fine p" |
|
5665 show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content (cbox a b)" |
|
5666 unfolding content_real[OF assms(1), simplified box_real[symmetric]] additive_tagged_division_1[OF assms(1) as(1)[simplified box_real],of f,symmetric] |
|
5667 unfolding additive_tagged_division_1[OF assms(1) as(1)[simplified box_real],of "\<lambda>x. x",symmetric] |
|
5668 unfolding setsum_right_distrib |
|
5669 defer |
|
5670 unfolding setsum_subtractf[symmetric] |
|
5671 proof (rule setsum_norm_le,safe) |
|
5672 fix x k |
|
5673 assume "(x, k) \<in> p" |
|
5674 note xk = tagged_division_ofD(2-4)[OF as(1) this] |
|
5675 from this(3) guess u v by (elim exE) note k=this |
|
5676 have *: "u \<le> v" |
|
5677 using xk unfolding k by auto |
|
5678 have ball: "\<forall>xa\<in>k. xa \<in> ball x (d x)" |
|
5679 using as(2)[unfolded fine_def,rule_format,OF \<open>(x,k)\<in>p\<close>,unfolded split_conv subset_eq] . |
|
5680 have "norm ((v - u) *\<^sub>R f' x - (f v - f u)) \<le> |
|
5681 norm (f u - f x - (u - x) *\<^sub>R f' x) + norm (f v - f x - (v - x) *\<^sub>R f' x)" |
|
5682 apply (rule order_trans[OF _ norm_triangle_ineq4]) |
|
5683 apply (rule eq_refl) |
|
5684 apply (rule arg_cong[where f=norm]) |
|
5685 unfolding scaleR_diff_left |
|
5686 apply (auto simp add:algebra_simps) |
|
5687 done |
|
5688 also have "\<dots> \<le> e * norm (u - x) + e * norm (v - x)" |
|
5689 apply (rule add_mono) |
|
5690 apply (rule d(2)[of "x" "u",unfolded o_def]) |
|
5691 prefer 4 |
|
5692 apply (rule d(2)[of "x" "v",unfolded o_def]) |
|
5693 using ball[rule_format,of u] ball[rule_format,of v] |
|
5694 using xk(1-2) |
|
5695 unfolding k subset_eq |
|
5696 apply (auto simp add:dist_real_def) |
|
5697 done |
|
5698 also have "\<dots> \<le> e * (Sup k - Inf k)" |
|
5699 unfolding k interval_bounds_real[OF *] |
|
5700 using xk(1) |
|
5701 unfolding k |
|
5702 by (auto simp add: dist_real_def field_simps) |
|
5703 finally show "norm (content k *\<^sub>R f' x - (f (Sup k) - f (Inf k))) \<le> |
|
5704 e * (Sup k - Inf k)" |
|
5705 unfolding box_real k interval_bounds_real[OF *] content_real[OF *] |
|
5706 interval_upperbound_real interval_lowerbound_real |
|
5707 . |
|
5708 qed |
|
5709 qed |
|
5710 qed |
|
5711 |
|
5712 lemma ident_has_integral: |
|
5713 fixes a::real |
|
5714 assumes "a \<le> b" |
|
5715 shows "((\<lambda>x. x) has_integral (b\<^sup>2 - a\<^sup>2) / 2) {a..b}" |
|
5716 proof - |
|
5717 have "((\<lambda>x. x) has_integral inverse 2 * b\<^sup>2 - inverse 2 * a\<^sup>2) {a..b}" |
|
5718 apply (rule fundamental_theorem_of_calculus [OF assms], clarify) |
|
5719 unfolding power2_eq_square |
|
5720 by (rule derivative_eq_intros | simp)+ |
|
5721 then show ?thesis |
|
5722 by (simp add: field_simps) |
|
5723 qed |
|
5724 |
|
5725 lemma integral_ident [simp]: |
|
5726 fixes a::real |
|
5727 assumes "a \<le> b" |
|
5728 shows "integral {a..b} (\<lambda>x. x) = (if a \<le> b then (b\<^sup>2 - a\<^sup>2) / 2 else 0)" |
|
5729 using ident_has_integral integral_unique by fastforce |
|
5730 |
|
5731 lemma ident_integrable_on: |
|
5732 fixes a::real |
|
5733 shows "(\<lambda>x. x) integrable_on {a..b}" |
|
5734 by (metis atLeastatMost_empty_iff integrable_on_def has_integral_empty ident_has_integral) |
|
5735 |
|
5736 |
|
5737 subsection \<open>Taylor series expansion\<close> |
|
5738 |
|
5739 lemma (in bounded_bilinear) setsum_prod_derivatives_has_vector_derivative: |
|
5740 assumes "p>0" |
|
5741 and f0: "Df 0 = f" |
|
5742 and Df: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow> |
|
5743 (Df m has_vector_derivative Df (Suc m) t) (at t within {a .. b})" |
|
5744 and g0: "Dg 0 = g" |
|
5745 and Dg: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow> |
|
5746 (Dg m has_vector_derivative Dg (Suc m) t) (at t within {a .. b})" |
|
5747 and ivl: "a \<le> t" "t \<le> b" |
|
5748 shows "((\<lambda>t. \<Sum>i<p. (-1)^i *\<^sub>R prod (Df i t) (Dg (p - Suc i) t)) |
|
5749 has_vector_derivative |
|
5750 prod (f t) (Dg p t) - (-1)^p *\<^sub>R prod (Df p t) (g t)) |
|
5751 (at t within {a .. b})" |
|
5752 using assms |
|
5753 proof cases |
|
5754 assume p: "p \<noteq> 1" |
|
5755 define p' where "p' = p - 2" |
|
5756 from assms p have p': "{..<p} = {..Suc p'}" "p = Suc (Suc p')" |
|
5757 by (auto simp: p'_def) |
|
5758 have *: "\<And>i. i \<le> p' \<Longrightarrow> Suc (Suc p' - i) = (Suc (Suc p') - i)" |
|
5759 by auto |
|
5760 let ?f = "\<lambda>i. (-1) ^ i *\<^sub>R (prod (Df i t) (Dg ((p - i)) t))" |
|
5761 have "(\<Sum>i<p. (-1) ^ i *\<^sub>R (prod (Df i t) (Dg (Suc (p - Suc i)) t) + |
|
5762 prod (Df (Suc i) t) (Dg (p - Suc i) t))) = |
|
5763 (\<Sum>i\<le>(Suc p'). ?f i - ?f (Suc i))" |
|
5764 by (auto simp: algebra_simps p'(2) numeral_2_eq_2 * lessThan_Suc_atMost) |
|
5765 also note setsum_telescope |
|
5766 finally |
|
5767 have "(\<Sum>i<p. (-1) ^ i *\<^sub>R (prod (Df i t) (Dg (Suc (p - Suc i)) t) + |
|
5768 prod (Df (Suc i) t) (Dg (p - Suc i) t))) |
|
5769 = prod (f t) (Dg p t) - (- 1) ^ p *\<^sub>R prod (Df p t) (g t)" |
|
5770 unfolding p'[symmetric] |
|
5771 by (simp add: assms) |
|
5772 thus ?thesis |
|
5773 using assms |
|
5774 by (auto intro!: derivative_eq_intros has_vector_derivative) |
|
5775 qed (auto intro!: derivative_eq_intros has_vector_derivative) |
|
5776 |
|
5777 lemma |
|
5778 fixes f::"real\<Rightarrow>'a::banach" |
|
5779 assumes "p>0" |
|
5780 and f0: "Df 0 = f" |
|
5781 and Df: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow> |
|
5782 (Df m has_vector_derivative Df (Suc m) t) (at t within {a .. b})" |
|
5783 and ivl: "a \<le> b" |
|
5784 defines "i \<equiv> \<lambda>x. ((b - x) ^ (p - 1) / fact (p - 1)) *\<^sub>R Df p x" |
|
5785 shows taylor_has_integral: |
|
5786 "(i has_integral f b - (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a)) {a..b}" |
|
5787 and taylor_integral: |
|
5788 "f b = (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a) + integral {a..b} i" |
|
5789 and taylor_integrable: |
|
5790 "i integrable_on {a .. b}" |
|
5791 proof goal_cases |
|
5792 case 1 |
|
5793 interpret bounded_bilinear "scaleR::real\<Rightarrow>'a\<Rightarrow>'a" |
|
5794 by (rule bounded_bilinear_scaleR) |
|
5795 define g where "g s = (b - s)^(p - 1)/fact (p - 1)" for s |
|
5796 define Dg where [abs_def]: |
|
5797 "Dg n s = (if n < p then (-1)^n * (b - s)^(p - 1 - n) / fact (p - 1 - n) else 0)" for n s |
|
5798 have g0: "Dg 0 = g" |
|
5799 using \<open>p > 0\<close> |
|
5800 by (auto simp add: Dg_def divide_simps g_def split: if_split_asm) |
|
5801 { |
|
5802 fix m |
|
5803 assume "p > Suc m" |
|
5804 hence "p - Suc m = Suc (p - Suc (Suc m))" |
|
5805 by auto |
|
5806 hence "real (p - Suc m) * fact (p - Suc (Suc m)) = fact (p - Suc m)" |
|
5807 by auto |
|
5808 } note fact_eq = this |
|
5809 have Dg: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow> |
|
5810 (Dg m has_vector_derivative Dg (Suc m) t) (at t within {a .. b})" |
|
5811 unfolding Dg_def |
|
5812 by (auto intro!: derivative_eq_intros simp: has_vector_derivative_def fact_eq divide_simps) |
|
5813 let ?sum = "\<lambda>t. \<Sum>i<p. (- 1) ^ i *\<^sub>R Dg i t *\<^sub>R Df (p - Suc i) t" |
|
5814 from setsum_prod_derivatives_has_vector_derivative[of _ Dg _ _ _ Df, |
|
5815 OF \<open>p > 0\<close> g0 Dg f0 Df] |
|
5816 have deriv: "\<And>t. a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow> |
|
5817 (?sum has_vector_derivative |
|
5818 g t *\<^sub>R Df p t - (- 1) ^ p *\<^sub>R Dg p t *\<^sub>R f t) (at t within {a..b})" |
|
5819 by auto |
|
5820 from fundamental_theorem_of_calculus[rule_format, OF \<open>a \<le> b\<close> deriv] |
|
5821 have "(i has_integral ?sum b - ?sum a) {a .. b}" |
|
5822 by (simp add: i_def g_def Dg_def) |
|
5823 also |
|
5824 have one: "(- 1) ^ p' * (- 1) ^ p' = (1::real)" |
|
5825 and "{..<p} \<inter> {i. p = Suc i} = {p - 1}" |
|
5826 for p' |
|
5827 using \<open>p > 0\<close> |
|
5828 by (auto simp: power_mult_distrib[symmetric]) |
|
5829 then have "?sum b = f b" |
|
5830 using Suc_pred'[OF \<open>p > 0\<close>] |
|
5831 by (simp add: diff_eq_eq Dg_def power_0_left le_Suc_eq if_distrib |
|
5832 cond_application_beta setsum.If_cases f0) |
|
5833 also |
|
5834 have "{..<p} = (\<lambda>x. p - x - 1) ` {..<p}" |
|
5835 proof safe |
|
5836 fix x |
|
5837 assume "x < p" |
|
5838 thus "x \<in> (\<lambda>x. p - x - 1) ` {..<p}" |
|
5839 by (auto intro!: image_eqI[where x = "p - x - 1"]) |
|
5840 qed simp |
|
5841 from _ this |
|
5842 have "?sum a = (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a)" |
|
5843 by (rule setsum.reindex_cong) (auto simp add: inj_on_def Dg_def one) |
|
5844 finally show c: ?case . |
|
5845 case 2 show ?case using c integral_unique by force |
|
5846 case 3 show ?case using c by force |
|
5847 qed |
|
5848 |
|
5849 |
|
5850 subsection \<open>Attempt a systematic general set of "offset" results for components.\<close> |
|
5851 |
|
5852 lemma gauge_modify: |
|
5853 assumes "(\<forall>s. open s \<longrightarrow> open {x. f(x) \<in> s})" "gauge d" |
|
5854 shows "gauge (\<lambda>x. {y. f y \<in> d (f x)})" |
|
5855 using assms |
|
5856 unfolding gauge_def |
|
5857 apply safe |
|
5858 defer |
|
5859 apply (erule_tac x="f x" in allE) |
|
5860 apply (erule_tac x="d (f x)" in allE) |
|
5861 apply auto |
|
5862 done |
|
5863 |
|
5864 |
|
5865 subsection \<open>Only need trivial subintervals if the interval itself is trivial.\<close> |
|
5866 |
|
5867 lemma division_of_nontrivial: |
|
5868 fixes s :: "'a::euclidean_space set set" |
|
5869 assumes "s division_of (cbox a b)" |
|
5870 and "content (cbox a b) \<noteq> 0" |
|
5871 shows "{k. k \<in> s \<and> content k \<noteq> 0} division_of (cbox a b)" |
|
5872 using assms(1) |
|
5873 apply - |
|
5874 proof (induct "card s" arbitrary: s rule: nat_less_induct) |
|
5875 fix s::"'a set set" |
|
5876 assume assm: "s division_of (cbox a b)" |
|
5877 "\<forall>m<card s. \<forall>x. m = card x \<longrightarrow> |
|
5878 x division_of (cbox a b) \<longrightarrow> {k \<in> x. content k \<noteq> 0} division_of (cbox a b)" |
|
5879 note s = division_ofD[OF assm(1)] |
|
5880 let ?thesis = "{k \<in> s. content k \<noteq> 0} division_of (cbox a b)" |
|
5881 { |
|
5882 presume *: "{k \<in> s. content k \<noteq> 0} \<noteq> s \<Longrightarrow> ?thesis" |
|
5883 show ?thesis |
|
5884 apply cases |
|
5885 defer |
|
5886 apply (rule *) |
|
5887 apply assumption |
|
5888 using assm(1) |
|
5889 apply auto |
|
5890 done |
|
5891 } |
|
5892 assume noteq: "{k \<in> s. content k \<noteq> 0} \<noteq> s" |
|
5893 then obtain k where k: "k \<in> s" "content k = 0" |
|
5894 by auto |
|
5895 from s(4)[OF k(1)] guess c d by (elim exE) note k=k this |
|
5896 from k have "card s > 0" |
|
5897 unfolding card_gt_0_iff using assm(1) by auto |
|
5898 then have card: "card (s - {k}) < card s" |
|
5899 using assm(1) k(1) |
|
5900 apply (subst card_Diff_singleton_if) |
|
5901 apply auto |
|
5902 done |
|
5903 have *: "closed (\<Union>(s - {k}))" |
|
5904 apply (rule closed_Union) |
|
5905 defer |
|
5906 apply rule |
|
5907 apply (drule DiffD1,drule s(4)) |
|
5908 using assm(1) |
|
5909 apply auto |
|
5910 done |
|
5911 have "k \<subseteq> \<Union>(s - {k})" |
|
5912 apply safe |
|
5913 apply (rule *[unfolded closed_limpt,rule_format]) |
|
5914 unfolding islimpt_approachable |
|
5915 proof safe |
|
5916 fix x |
|
5917 fix e :: real |
|
5918 assume as: "x \<in> k" "e > 0" |
|
5919 from k(2)[unfolded k content_eq_0] guess i .. |
|
5920 then have i:"c\<bullet>i = d\<bullet>i" "i\<in>Basis" |
|
5921 using s(3)[OF k(1),unfolded k] unfolding box_ne_empty by auto |
|
5922 then have xi: "x\<bullet>i = d\<bullet>i" |
|
5923 using as unfolding k mem_box by (metis antisym) |
|
5924 define y where "y = (\<Sum>j\<in>Basis. (if j = i then if c\<bullet>i \<le> (a\<bullet>i + b\<bullet>i) / 2 then c\<bullet>i + |
|
5925 min e (b\<bullet>i - c\<bullet>i) / 2 else c\<bullet>i - min e (c\<bullet>i - a\<bullet>i) / 2 else x\<bullet>j) *\<^sub>R j)" |
|
5926 show "\<exists>x'\<in>\<Union>(s - {k}). x' \<noteq> x \<and> dist x' x < e" |
|
5927 apply (rule_tac x=y in bexI) |
|
5928 proof |
|
5929 have "d \<in> cbox c d" |
|
5930 using s(3)[OF k(1)] |
|
5931 unfolding k box_eq_empty mem_box |
|
5932 by (fastforce simp add: not_less) |
|
5933 then have "d \<in> cbox a b" |
|
5934 using s(2)[OF k(1)] |
|
5935 unfolding k |
|
5936 by auto |
|
5937 note di = this[unfolded mem_box,THEN bspec[where x=i]] |
|
5938 then have xyi: "y\<bullet>i \<noteq> x\<bullet>i" |
|
5939 unfolding y_def i xi |
|
5940 using as(2) assms(2)[unfolded content_eq_0] i(2) |
|
5941 by (auto elim!: ballE[of _ _ i]) |
|
5942 then show "y \<noteq> x" |
|
5943 unfolding euclidean_eq_iff[where 'a='a] using i by auto |
|
5944 have *: "Basis = insert i (Basis - {i})" |
|
5945 using i by auto |
|
5946 have "norm (y - x) < e + setsum (\<lambda>i. 0) Basis" |
|
5947 apply (rule le_less_trans[OF norm_le_l1]) |
|
5948 apply (subst *) |
|
5949 apply (subst setsum.insert) |
|
5950 prefer 3 |
|
5951 apply (rule add_less_le_mono) |
|
5952 proof - |
|
5953 show "\<bar>(y - x) \<bullet> i\<bar> < e" |
|
5954 using di as(2) y_def i xi by (auto simp: inner_simps) |
|
5955 show "(\<Sum>i\<in>Basis - {i}. \<bar>(y - x) \<bullet> i\<bar>) \<le> (\<Sum>i\<in>Basis. 0)" |
|
5956 unfolding y_def by (auto simp: inner_simps) |
|
5957 qed auto |
|
5958 then show "dist y x < e" |
|
5959 unfolding dist_norm by auto |
|
5960 have "y \<notin> k" |
|
5961 unfolding k mem_box |
|
5962 apply rule |
|
5963 apply (erule_tac x=i in ballE) |
|
5964 using xyi k i xi |
|
5965 apply auto |
|
5966 done |
|
5967 moreover |
|
5968 have "y \<in> \<Union>s" |
|
5969 using set_rev_mp[OF as(1) s(2)[OF k(1)]] as(2) di i |
|
5970 unfolding s mem_box y_def |
|
5971 by (auto simp: field_simps elim!: ballE[of _ _ i]) |
|
5972 ultimately |
|
5973 show "y \<in> \<Union>(s - {k})" by auto |
|
5974 qed |
|
5975 qed |
|
5976 then have "\<Union>(s - {k}) = cbox a b" |
|
5977 unfolding s(6)[symmetric] by auto |
|
5978 then have "{ka \<in> s - {k}. content ka \<noteq> 0} division_of (cbox a b)" |
|
5979 apply - |
|
5980 apply (rule assm(2)[rule_format,OF card refl]) |
|
5981 apply (rule division_ofI) |
|
5982 defer |
|
5983 apply (rule_tac[1-4] s) |
|
5984 using assm(1) |
|
5985 apply auto |
|
5986 done |
|
5987 moreover |
|
5988 have "{ka \<in> s - {k}. content ka \<noteq> 0} = {k \<in> s. content k \<noteq> 0}" |
|
5989 using k by auto |
|
5990 ultimately show ?thesis by auto |
|
5991 qed |
|
5992 |
|
5993 |
|
5994 subsection \<open>Integrability on subintervals.\<close> |
|
5995 |
|
5996 lemma operative_integrable: |
|
5997 fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach" |
|
5998 shows "comm_monoid.operative op \<and> True (\<lambda>i. f integrable_on i)" |
|
5999 unfolding comm_monoid.operative_def[OF comm_monoid_and] |
|
6000 apply safe |
|
6001 apply (subst integrable_on_def) |
|
6002 unfolding has_integral_null_eq |
|
6003 apply (rule, rule refl) |
|
6004 apply (rule, assumption, assumption)+ |
|
6005 unfolding integrable_on_def |
|
6006 by (auto intro!: has_integral_split) |
|
6007 |
|
6008 lemma integrable_subinterval: |
|
6009 fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach" |
|
6010 assumes "f integrable_on cbox a b" |
|
6011 and "cbox c d \<subseteq> cbox a b" |
|
6012 shows "f integrable_on cbox c d" |
|
6013 apply (cases "cbox c d = {}") |
|
6014 defer |
|
6015 apply (rule partial_division_extend_1[OF assms(2)],assumption) |
|
6016 using comm_monoid_set.operative_division[OF comm_monoid_set_and operative_integrable,symmetric,of _ _ _ f] assms(1) |
|
6017 apply (auto simp: comm_monoid_set_F_and) |
|
6018 done |
|
6019 |
|
6020 lemma integrable_subinterval_real: |
|
6021 fixes f :: "real \<Rightarrow> 'a::banach" |
|
6022 assumes "f integrable_on {a .. b}" |
|
6023 and "{c .. d} \<subseteq> {a .. b}" |
|
6024 shows "f integrable_on {c .. d}" |
|
6025 by (metis assms(1) assms(2) box_real(2) integrable_subinterval) |
|
6026 |
|
6027 |
|
6028 subsection \<open>Combining adjacent intervals in 1 dimension.\<close> |
|
6029 |
|
6030 lemma has_integral_combine: |
|
6031 fixes a b c :: real |
|
6032 assumes "a \<le> c" |
|
6033 and "c \<le> b" |
|
6034 and "(f has_integral i) {a .. c}" |
|
6035 and "(f has_integral (j::'a::banach)) {c .. b}" |
|
6036 shows "(f has_integral (i + j)) {a .. b}" |
|
6037 proof - |
|
6038 note operative_integral[of f, unfolded comm_monoid.operative_1_le[OF add.comm_monoid_lift_option]] |
|
6039 note conjunctD2[OF this,rule_format] |
|
6040 note * = this(2)[OF conjI[OF assms(1-2)],unfolded if_P[OF assms(3)]] |
|
6041 then have "f integrable_on cbox a b" |
|
6042 apply - |
|
6043 apply (rule ccontr) |
|
6044 apply (subst(asm) if_P) |
|
6045 defer |
|
6046 apply (subst(asm) if_P) |
|
6047 using assms(3-) |
|
6048 apply auto |
|
6049 done |
|
6050 with * |
|
6051 show ?thesis |
|
6052 apply - |
|
6053 apply (subst(asm) if_P) |
|
6054 defer |
|
6055 apply (subst(asm) if_P) |
|
6056 defer |
|
6057 apply (subst(asm) if_P) |
|
6058 using assms(3-) |
|
6059 apply (auto simp add: integrable_on_def integral_unique) |
|
6060 done |
|
6061 qed |
|
6062 |
|
6063 lemma integral_combine: |
|
6064 fixes f :: "real \<Rightarrow> 'a::banach" |
|
6065 assumes "a \<le> c" |
|
6066 and "c \<le> b" |
|
6067 and "f integrable_on {a .. b}" |
|
6068 shows "integral {a .. c} f + integral {c .. b} f = integral {a .. b} f" |
|
6069 apply (rule integral_unique[symmetric]) |
|
6070 apply (rule has_integral_combine[OF assms(1-2)]) |
|
6071 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) |
|
6072 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) |
|
6073 |
|
6074 lemma integrable_combine: |
|
6075 fixes f :: "real \<Rightarrow> 'a::banach" |
|
6076 assumes "a \<le> c" |
|
6077 and "c \<le> b" |
|
6078 and "f integrable_on {a .. c}" |
|
6079 and "f integrable_on {c .. b}" |
|
6080 shows "f integrable_on {a .. b}" |
|
6081 using assms |
|
6082 unfolding integrable_on_def |
|
6083 by (fastforce intro!:has_integral_combine) |
|
6084 |
|
6085 |
|
6086 subsection \<open>Reduce integrability to "local" integrability.\<close> |
|
6087 |
|
6088 lemma integrable_on_little_subintervals: |
|
6089 fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach" |
|
6090 assumes "\<forall>x\<in>cbox a b. \<exists>d>0. \<forall>u v. x \<in> cbox u v \<and> cbox u v \<subseteq> ball x d \<and> cbox u v \<subseteq> cbox a b \<longrightarrow> |
|
6091 f integrable_on cbox u v" |
|
6092 shows "f integrable_on cbox a b" |
|
6093 proof - |
|
6094 have "\<forall>x. \<exists>d. x\<in>cbox a b \<longrightarrow> d>0 \<and> (\<forall>u v. x \<in> cbox u v \<and> cbox u v \<subseteq> ball x d \<and> cbox u v \<subseteq> cbox a b \<longrightarrow> |
|
6095 f integrable_on cbox u v)" |
|
6096 using assms by auto |
|
6097 note this[unfolded gauge_existence_lemma] |
|
6098 from choice[OF this] guess d .. note d=this[rule_format] |
|
6099 guess p |
|
6100 apply (rule fine_division_exists[OF gauge_ball_dependent,of d a b]) |
|
6101 using d |
|
6102 by auto |
|
6103 note p=this(1-2) |
|
6104 note division_of_tagged_division[OF this(1)] |
|
6105 note * = comm_monoid_set.operative_division[OF comm_monoid_set_and operative_integrable, OF this, symmetric, of f] |
|
6106 show ?thesis |
|
6107 unfolding * comm_monoid_set_F_and |
|
6108 apply safe |
|
6109 unfolding snd_conv |
|
6110 proof - |
|
6111 fix x k |
|
6112 assume "(x, k) \<in> p" |
|
6113 note tagged_division_ofD(2-4)[OF p(1) this] fineD[OF p(2) this] |
|
6114 then show "f integrable_on k" |
|
6115 apply safe |
|
6116 apply (rule d[THEN conjunct2,rule_format,of x]) |
|
6117 apply (auto intro: order.trans) |
|
6118 done |
|
6119 qed |
|
6120 qed |
|
6121 |
|
6122 |
|
6123 subsection \<open>Second FTC or existence of antiderivative.\<close> |
|
6124 |
|
6125 lemma integrable_const[intro]: "(\<lambda>x. c) integrable_on cbox a b" |
|
6126 unfolding integrable_on_def |
|
6127 apply rule |
|
6128 apply (rule has_integral_const) |
|
6129 done |
|
6130 |
|
6131 lemma integral_has_vector_derivative_continuous_at: |
|
6132 fixes f :: "real \<Rightarrow> 'a::banach" |
|
6133 assumes f: "f integrable_on {a..b}" |
|
6134 and x: "x \<in> {a..b}" |
|
6135 and fx: "continuous (at x within {a..b}) f" |
|
6136 shows "((\<lambda>u. integral {a..u} f) has_vector_derivative f x) (at x within {a..b})" |
|
6137 proof - |
|
6138 let ?I = "\<lambda>a b. integral {a..b} f" |
|
6139 { fix e::real |
|
6140 assume "e > 0" |
|
6141 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" |
|
6142 using \<open>e>0\<close> fx by (auto simp: continuous_within_eps_delta dist_norm less_imp_le) |
|
6143 have "norm (integral {a..y} f - integral {a..x} f - (y - x) *\<^sub>R f x) \<le> e * \<bar>y - x\<bar>" |
|
6144 if y: "y \<in> {a..b}" and yx: "\<bar>y - x\<bar> < d" for y |
|
6145 proof (cases "y < x") |
|
6146 case False |
|
6147 have "f integrable_on {a..y}" |
|
6148 using f y by (simp add: integrable_subinterval_real) |
|
6149 then have Idiff: "?I a y - ?I a x = ?I x y" |
|
6150 using False x by (simp add: algebra_simps integral_combine) |
|
6151 have fux_int: "((\<lambda>u. f u - f x) has_integral integral {x..y} f - (y - x) *\<^sub>R f x) {x..y}" |
|
6152 apply (rule has_integral_sub) |
|
6153 using x y apply (force intro: integrable_integral [OF integrable_subinterval_real [OF f]]) |
|
6154 using has_integral_const_real [of "f x" x y] False |
|
6155 apply (simp add: ) |
|
6156 done |
|
6157 show ?thesis |
|
6158 using False |
|
6159 apply (simp add: abs_eq_content del: content_real_if) |
|
6160 apply (rule has_integral_bound_real[where f="(\<lambda>u. f u - f x)"]) |
|
6161 using yx False d x y \<open>e>0\<close> apply (auto simp add: Idiff fux_int) |
|
6162 done |
|
6163 next |
|
6164 case True |
|
6165 have "f integrable_on {a..x}" |
|
6166 using f x by (simp add: integrable_subinterval_real) |
|
6167 then have Idiff: "?I a x - ?I a y = ?I y x" |
|
6168 using True x y by (simp add: algebra_simps integral_combine) |
|
6169 have fux_int: "((\<lambda>u. f u - f x) has_integral integral {y..x} f - (x - y) *\<^sub>R f x) {y..x}" |
|
6170 apply (rule has_integral_sub) |
|
6171 using x y apply (force intro: integrable_integral [OF integrable_subinterval_real [OF f]]) |
|
6172 using has_integral_const_real [of "f x" y x] True |
|
6173 apply (simp add: ) |
|
6174 done |
|
6175 have "norm (integral {a..x} f - integral {a..y} f - (x - y) *\<^sub>R f x) \<le> e * \<bar>y - x\<bar>" |
|
6176 using True |
|
6177 apply (simp add: abs_eq_content del: content_real_if) |
|
6178 apply (rule has_integral_bound_real[where f="(\<lambda>u. f u - f x)"]) |
|
6179 using yx True d x y \<open>e>0\<close> apply (auto simp add: Idiff fux_int) |
|
6180 done |
|
6181 then show ?thesis |
|
6182 by (simp add: algebra_simps norm_minus_commute) |
|
6183 qed |
|
6184 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>" |
|
6185 using \<open>d>0\<close> by blast |
|
6186 } |
|
6187 then show ?thesis |
|
6188 by (simp add: has_vector_derivative_def has_derivative_within_alt bounded_linear_scaleR_left) |
|
6189 qed |
|
6190 |
|
6191 lemma integral_has_vector_derivative: |
|
6192 fixes f :: "real \<Rightarrow> 'a::banach" |
|
6193 assumes "continuous_on {a .. b} f" |
|
6194 and "x \<in> {a .. b}" |
|
6195 shows "((\<lambda>u. integral {a .. u} f) has_vector_derivative f(x)) (at x within {a .. b})" |
|
6196 apply (rule integral_has_vector_derivative_continuous_at [OF integrable_continuous_real]) |
|
6197 using assms |
|
6198 apply (auto simp: continuous_on_eq_continuous_within) |
|
6199 done |
|
6200 |
|
6201 lemma antiderivative_continuous: |
|
6202 fixes q b :: real |
|
6203 assumes "continuous_on {a .. b} f" |
|
6204 obtains g where "\<forall>x\<in>{a .. b}. (g has_vector_derivative (f x::_::banach)) (at x within {a .. b})" |
|
6205 apply (rule that) |
|
6206 apply rule |
|
6207 using integral_has_vector_derivative[OF assms] |
|
6208 apply auto |
|
6209 done |
|
6210 |
|
6211 |
|
6212 subsection \<open>Combined fundamental theorem of calculus.\<close> |
|
6213 |
|
6214 lemma antiderivative_integral_continuous: |
|
6215 fixes f :: "real \<Rightarrow> 'a::banach" |
|
6216 assumes "continuous_on {a .. b} f" |
|
6217 obtains g where "\<forall>u\<in>{a .. b}. \<forall>v \<in> {a .. b}. u \<le> v \<longrightarrow> (f has_integral (g v - g u)) {u .. v}" |
|
6218 proof - |
|
6219 from antiderivative_continuous[OF assms] guess g . note g=this |
|
6220 show ?thesis |
|
6221 apply (rule that[of g]) |
|
6222 apply safe |
|
6223 proof goal_cases |
|
6224 case prems: (1 u v) |
|
6225 have "\<forall>x\<in>cbox u v. (g has_vector_derivative f x) (at x within cbox u v)" |
|
6226 apply rule |
|
6227 apply (rule has_vector_derivative_within_subset) |
|
6228 apply (rule g[rule_format]) |
|
6229 using prems(1,2) |
|
6230 apply auto |
|
6231 done |
|
6232 then show ?case |
|
6233 using fundamental_theorem_of_calculus[OF prems(3), of g f] by auto |
|
6234 qed |
|
6235 qed |
|
6236 |
|
6237 |
|
6238 subsection \<open>General "twiddling" for interval-to-interval function image.\<close> |
|
6239 |
|
6240 lemma has_integral_twiddle: |
|
6241 assumes "0 < r" |
|
6242 and "\<forall>x. h(g x) = x" |
|
6243 and "\<forall>x. g(h x) = x" |
|
6244 and "\<forall>x. continuous (at x) g" |
|
6245 and "\<forall>u v. \<exists>w z. g ` cbox u v = cbox w z" |
|
6246 and "\<forall>u v. \<exists>w z. h ` cbox u v = cbox w z" |
|
6247 and "\<forall>u v. content(g ` cbox u v) = r * content (cbox u v)" |
|
6248 and "(f has_integral i) (cbox a b)" |
|
6249 shows "((\<lambda>x. f(g x)) has_integral (1 / r) *\<^sub>R i) (h ` cbox a b)" |
|
6250 proof - |
|
6251 show ?thesis when *: "cbox a b \<noteq> {} \<Longrightarrow> ?thesis" |
|
6252 apply cases |
|
6253 defer |
|
6254 apply (rule *) |
|
6255 apply assumption |
|
6256 proof goal_cases |
|
6257 case prems: 1 |
|
6258 then show ?thesis |
|
6259 unfolding prems assms(8)[unfolded prems has_integral_empty_eq] by auto |
|
6260 qed |
|
6261 assume "cbox a b \<noteq> {}" |
|
6262 from assms(6)[rule_format,of a b] guess w z by (elim exE) note wz=this |
|
6263 have inj: "inj g" "inj h" |
|
6264 unfolding inj_on_def |
|
6265 apply safe |
|
6266 apply(rule_tac[!] ccontr) |
|
6267 using assms(2) |
|
6268 apply(erule_tac x=x in allE) |
|
6269 using assms(2) |
|
6270 apply(erule_tac x=y in allE) |
|
6271 defer |
|
6272 using assms(3) |
|
6273 apply (erule_tac x=x in allE) |
|
6274 using assms(3) |
|
6275 apply(erule_tac x=y in allE) |
|
6276 apply auto |
|
6277 done |
|
6278 show ?thesis |
|
6279 unfolding has_integral_def has_integral_compact_interval_def |
|
6280 apply (subst if_P) |
|
6281 apply rule |
|
6282 apply rule |
|
6283 apply (rule wz) |
|
6284 proof safe |
|
6285 fix e :: real |
|
6286 assume e: "e > 0" |
|
6287 with assms(1) have "e * r > 0" by simp |
|
6288 from assms(8)[unfolded has_integral,rule_format,OF this] guess d by (elim exE conjE) note d=this[rule_format] |
|
6289 define d' where "d' x = {y. g y \<in> d (g x)}" for x |
|
6290 have d': "\<And>x. d' x = {y. g y \<in> (d (g x))}" |
|
6291 unfolding d'_def .. |
|
6292 show "\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of h ` cbox a b \<and> d fine p \<longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i) < e)" |
|
6293 proof (rule_tac x=d' in exI, safe) |
|
6294 show "gauge d'" |
|
6295 using d(1) |
|
6296 unfolding gauge_def d' |
|
6297 using continuous_open_preimage_univ[OF assms(4)] |
|
6298 by auto |
|
6299 fix p |
|
6300 assume as: "p tagged_division_of h ` cbox a b" "d' fine p" |
|
6301 note p = tagged_division_ofD[OF as(1)] |
|
6302 have "(\<lambda>(x, k). (g x, g ` k)) ` p tagged_division_of (cbox a b) \<and> d fine (\<lambda>(x, k). (g x, g ` k)) ` p" |
|
6303 unfolding tagged_division_of |
|
6304 proof safe |
|
6305 show "finite ((\<lambda>(x, k). (g x, g ` k)) ` p)" |
|
6306 using as by auto |
|
6307 show "d fine (\<lambda>(x, k). (g x, g ` k)) ` p" |
|
6308 using as(2) unfolding fine_def d' by auto |
|
6309 fix x k |
|
6310 assume xk[intro]: "(x, k) \<in> p" |
|
6311 show "g x \<in> g ` k" |
|
6312 using p(2)[OF xk] by auto |
|
6313 show "\<exists>u v. g ` k = cbox u v" |
|
6314 using p(4)[OF xk] using assms(5-6) by auto |
|
6315 { |
|
6316 fix y |
|
6317 assume "y \<in> k" |
|
6318 then show "g y \<in> cbox a b" "g y \<in> cbox a b" |
|
6319 using p(3)[OF xk,unfolded subset_eq,rule_format,of "h (g y)"] |
|
6320 using assms(2)[rule_format,of y] |
|
6321 unfolding inj_image_mem_iff[OF inj(2)] |
|
6322 by auto |
|
6323 } |
|
6324 fix x' k' |
|
6325 assume xk': "(x', k') \<in> p" |
|
6326 fix z |
|
6327 assume z: "z \<in> interior (g ` k)" "z \<in> interior (g ` k')" |
|
6328 have same: "(x, k) = (x', k')" |
|
6329 apply - |
|
6330 apply (rule ccontr) |
|
6331 apply (drule p(5)[OF xk xk']) |
|
6332 proof - |
|
6333 assume as: "interior k \<inter> interior k' = {}" |
|
6334 have "z \<in> g ` (interior k \<inter> interior k')" |
|
6335 using interior_image_subset[OF assms(4) inj(1)] z |
|
6336 unfolding image_Int[OF inj(1)] by blast |
|
6337 then show False |
|
6338 using as by blast |
|
6339 qed |
|
6340 then show "g x = g x'" |
|
6341 by auto |
|
6342 { |
|
6343 fix z |
|
6344 assume "z \<in> k" |
|
6345 then show "g z \<in> g ` k'" |
|
6346 using same by auto |
|
6347 } |
|
6348 { |
|
6349 fix z |
|
6350 assume "z \<in> k'" |
|
6351 then show "g z \<in> g ` k" |
|
6352 using same by auto |
|
6353 } |
|
6354 next |
|
6355 fix x |
|
6356 assume "x \<in> cbox a b" |
|
6357 then have "h x \<in> \<Union>{k. \<exists>x. (x, k) \<in> p}" |
|
6358 using p(6) by auto |
|
6359 then guess X unfolding Union_iff .. note X=this |
|
6360 from this(1) guess y unfolding mem_Collect_eq .. |
|
6361 then show "x \<in> \<Union>{k. \<exists>x. (x, k) \<in> (\<lambda>(x, k). (g x, g ` k)) ` p}" |
|
6362 apply - |
|
6363 apply (rule_tac X="g ` X" in UnionI) |
|
6364 defer |
|
6365 apply (rule_tac x="h x" in image_eqI) |
|
6366 using X(2) assms(3)[rule_format,of x] |
|
6367 apply auto |
|
6368 done |
|
6369 qed |
|
6370 note ** = d(2)[OF this] |
|
6371 have *: "inj_on (\<lambda>(x, k). (g x, g ` k)) p" |
|
6372 using inj(1) unfolding inj_on_def by fastforce |
|
6373 have "(\<Sum>(x, k)\<in>(\<lambda>(x, k). (g x, g ` k)) ` p. content k *\<^sub>R f x) - i = r *\<^sub>R (\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - i" (is "?l = _") |
|
6374 using assms(7) |
|
6375 apply (simp only: algebra_simps add_left_cancel scaleR_right.setsum) |
|
6376 apply (subst setsum.reindex_bij_betw[symmetric, where h="\<lambda>(x, k). (g x, g ` k)" and S=p]) |
|
6377 apply (auto intro!: * setsum.cong simp: bij_betw_def dest!: p(4)) |
|
6378 done |
|
6379 also have "\<dots> = r *\<^sub>R ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i)" (is "_ = ?r") |
|
6380 unfolding scaleR_diff_right scaleR_scaleR |
|
6381 using assms(1) |
|
6382 by auto |
|
6383 finally have *: "?l = ?r" . |
|
6384 show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f (g x)) - (1 / r) *\<^sub>R i) < e" |
|
6385 using ** |
|
6386 unfolding * |
|
6387 unfolding norm_scaleR |
|
6388 using assms(1) |
|
6389 by (auto simp add:field_simps) |
|
6390 qed |
|
6391 qed |
|
6392 qed |
|
6393 |
|
6394 |
|
6395 subsection \<open>Special case of a basic affine transformation.\<close> |
|
6396 |
|
6397 lemma interval_image_affinity_interval: |
|
6398 "\<exists>u v. (\<lambda>x. m *\<^sub>R (x::'a::euclidean_space) + c) ` cbox a b = cbox u v" |
|
6399 unfolding image_affinity_cbox |
|
6400 by auto |
|
6401 |
|
6402 lemma content_image_affinity_cbox: |
|
6403 "content((\<lambda>x::'a::euclidean_space. m *\<^sub>R x + c) ` cbox a b) = |
|
6404 \<bar>m\<bar> ^ DIM('a) * content (cbox a b)" (is "?l = ?r") |
|
6405 proof (cases "cbox a b = {}") |
|
6406 case True then show ?thesis by simp |
|
6407 next |
|
6408 case False |
|
6409 show ?thesis |
|
6410 proof (cases "m \<ge> 0") |
|
6411 case True |
|
6412 with \<open>cbox a b \<noteq> {}\<close> have "cbox (m *\<^sub>R a + c) (m *\<^sub>R b + c) \<noteq> {}" |
|
6413 unfolding box_ne_empty |
|
6414 apply (intro ballI) |
|
6415 apply (erule_tac x=i in ballE) |
|
6416 apply (auto simp: inner_simps mult_left_mono) |
|
6417 done |
|
6418 moreover from True have *: "\<And>i. (m *\<^sub>R b + c) \<bullet> i - (m *\<^sub>R a + c) \<bullet> i = m *\<^sub>R (b - a) \<bullet> i" |
|
6419 by (simp add: inner_simps field_simps) |
|
6420 ultimately show ?thesis |
|
6421 by (simp add: image_affinity_cbox True content_cbox' |
|
6422 setprod.distrib setprod_constant inner_diff_left) |
|
6423 next |
|
6424 case False |
|
6425 with \<open>cbox a b \<noteq> {}\<close> have "cbox (m *\<^sub>R b + c) (m *\<^sub>R a + c) \<noteq> {}" |
|
6426 unfolding box_ne_empty |
|
6427 apply (intro ballI) |
|
6428 apply (erule_tac x=i in ballE) |
|
6429 apply (auto simp: inner_simps mult_left_mono) |
|
6430 done |
|
6431 moreover from False have *: "\<And>i. (m *\<^sub>R a + c) \<bullet> i - (m *\<^sub>R b + c) \<bullet> i = (-m) *\<^sub>R (b - a) \<bullet> i" |
|
6432 by (simp add: inner_simps field_simps) |
|
6433 ultimately show ?thesis using False |
|
6434 by (simp add: image_affinity_cbox content_cbox' |
|
6435 setprod.distrib[symmetric] setprod_constant[symmetric] inner_diff_left) |
|
6436 qed |
|
6437 qed |
|
6438 |
|
6439 lemma has_integral_affinity: |
|
6440 fixes a :: "'a::euclidean_space" |
|
6441 assumes "(f has_integral i) (cbox a b)" |
|
6442 and "m \<noteq> 0" |
|
6443 shows "((\<lambda>x. f(m *\<^sub>R x + c)) has_integral ((1 / (\<bar>m\<bar> ^ DIM('a))) *\<^sub>R i)) ((\<lambda>x. (1 / m) *\<^sub>R x + -((1 / m) *\<^sub>R c)) ` cbox a b)" |
|
6444 apply (rule has_integral_twiddle) |
|
6445 using assms |
|
6446 apply (safe intro!: interval_image_affinity_interval content_image_affinity_cbox) |
|
6447 apply (rule zero_less_power) |
|
6448 unfolding scaleR_right_distrib |
|
6449 apply auto |
|
6450 done |
|
6451 |
|
6452 lemma integrable_affinity: |
|
6453 assumes "f integrable_on cbox a b" |
|
6454 and "m \<noteq> 0" |
|
6455 shows "(\<lambda>x. f(m *\<^sub>R x + c)) integrable_on ((\<lambda>x. (1 / m) *\<^sub>R x + -((1/m) *\<^sub>R c)) ` cbox a b)" |
|
6456 using assms |
|
6457 unfolding integrable_on_def |
|
6458 apply safe |
|
6459 apply (drule has_integral_affinity) |
|
6460 apply auto |
|
6461 done |
|
6462 |
|
6463 lemmas has_integral_affinity01 = has_integral_affinity [of _ _ 0 "1::real", simplified] |
|
6464 |
|
6465 subsection \<open>Special case of stretching coordinate axes separately.\<close> |
|
6466 |
|
6467 lemma content_image_stretch_interval: |
|
6468 "content ((\<lambda>x::'a::euclidean_space. (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)::'a) ` cbox a b) = |
|
6469 \<bar>setprod m Basis\<bar> * content (cbox a b)" |
|
6470 proof (cases "cbox a b = {}") |
|
6471 case True |
|
6472 then show ?thesis |
|
6473 unfolding content_def image_is_empty image_stretch_interval if_P[OF True] by auto |
|
6474 next |
|
6475 case False |
|
6476 then have "(\<lambda>x. (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)) ` cbox a b \<noteq> {}" |
|
6477 by auto |
|
6478 then show ?thesis |
|
6479 using False |
|
6480 unfolding content_def image_stretch_interval |
|
6481 apply - |
|
6482 unfolding interval_bounds' if_not_P |
|
6483 unfolding abs_setprod setprod.distrib[symmetric] |
|
6484 apply (rule setprod.cong) |
|
6485 apply (rule refl) |
|
6486 unfolding lessThan_iff |
|
6487 apply (simp only: inner_setsum_left_Basis) |
|
6488 proof - |
|
6489 fix i :: 'a |
|
6490 assume i: "i \<in> Basis" |
|
6491 have "(m i < 0 \<or> m i > 0) \<or> m i = 0" |
|
6492 by auto |
|
6493 then show "max (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) - min (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) = |
|
6494 \<bar>m i\<bar> * (b \<bullet> i - a \<bullet> i)" |
|
6495 apply - |
|
6496 apply (erule disjE)+ |
|
6497 unfolding min_def max_def |
|
6498 using False[unfolded box_ne_empty,rule_format,of i] i |
|
6499 apply (auto simp add:field_simps not_le mult_le_cancel_left_neg mult_le_cancel_left_pos) |
|
6500 done |
|
6501 qed |
|
6502 qed |
|
6503 |
|
6504 lemma has_integral_stretch: |
|
6505 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
|
6506 assumes "(f has_integral i) (cbox a b)" |
|
6507 and "\<forall>k\<in>Basis. m k \<noteq> 0" |
|
6508 shows "((\<lambda>x. f (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)) has_integral |
|
6509 ((1/ \<bar>setprod m Basis\<bar>) *\<^sub>R i)) ((\<lambda>x. (\<Sum>k\<in>Basis. (1 / m k * (x\<bullet>k))*\<^sub>R k)) ` cbox a b)" |
|
6510 apply (rule has_integral_twiddle[where f=f]) |
|
6511 unfolding zero_less_abs_iff content_image_stretch_interval |
|
6512 unfolding image_stretch_interval empty_as_interval euclidean_eq_iff[where 'a='a] |
|
6513 using assms |
|
6514 proof - |
|
6515 show "\<forall>y::'a. continuous (at y) (\<lambda>x. (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k))" |
|
6516 apply rule |
|
6517 apply (rule linear_continuous_at) |
|
6518 unfolding linear_linear |
|
6519 unfolding linear_iff inner_simps euclidean_eq_iff[where 'a='a] |
|
6520 apply (auto simp add: field_simps) |
|
6521 done |
|
6522 qed auto |
|
6523 |
|
6524 lemma integrable_stretch: |
|
6525 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
|
6526 assumes "f integrable_on cbox a b" |
|
6527 and "\<forall>k\<in>Basis. m k \<noteq> 0" |
|
6528 shows "(\<lambda>x::'a. f (\<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k)) integrable_on |
|
6529 ((\<lambda>x. \<Sum>k\<in>Basis. (1 / m k * (x\<bullet>k))*\<^sub>R k) ` cbox a b)" |
|
6530 using assms |
|
6531 unfolding integrable_on_def |
|
6532 apply - |
|
6533 apply (erule exE) |
|
6534 apply (drule has_integral_stretch) |
|
6535 apply assumption |
|
6536 apply auto |
|
6537 done |
|
6538 |
|
6539 subsection \<open>even more special cases.\<close> |
|
6540 |
|
6541 lemma uminus_interval_vector[simp]: |
|
6542 fixes a b :: "'a::euclidean_space" |
|
6543 shows "uminus ` cbox a b = cbox (-b) (-a)" |
|
6544 apply (rule set_eqI) |
|
6545 apply rule |
|
6546 defer |
|
6547 unfolding image_iff |
|
6548 apply (rule_tac x="-x" in bexI) |
|
6549 apply (auto simp add:minus_le_iff le_minus_iff mem_box) |
|
6550 done |
|
6551 |
|
6552 lemma has_integral_reflect_lemma[intro]: |
|
6553 assumes "(f has_integral i) (cbox a b)" |
|
6554 shows "((\<lambda>x. f(-x)) has_integral i) (cbox (-b) (-a))" |
|
6555 using has_integral_affinity[OF assms, of "-1" 0] |
|
6556 by auto |
|
6557 |
|
6558 lemma has_integral_reflect_lemma_real[intro]: |
|
6559 assumes "(f has_integral i) {a .. b::real}" |
|
6560 shows "((\<lambda>x. f(-x)) has_integral i) {-b .. -a}" |
|
6561 using assms |
|
6562 unfolding box_real[symmetric] |
|
6563 by (rule has_integral_reflect_lemma) |
|
6564 |
|
6565 lemma has_integral_reflect[simp]: |
|
6566 "((\<lambda>x. f (-x)) has_integral i) (cbox (-b) (-a)) \<longleftrightarrow> (f has_integral i) (cbox a b)" |
|
6567 apply rule |
|
6568 apply (drule_tac[!] has_integral_reflect_lemma) |
|
6569 apply auto |
|
6570 done |
|
6571 |
|
6572 lemma integrable_reflect[simp]: "(\<lambda>x. f(-x)) integrable_on cbox (-b) (-a) \<longleftrightarrow> f integrable_on cbox a b" |
|
6573 unfolding integrable_on_def by auto |
|
6574 |
|
6575 lemma integrable_reflect_real[simp]: "(\<lambda>x. f(-x)) integrable_on {-b .. -a} \<longleftrightarrow> f integrable_on {a .. b::real}" |
|
6576 unfolding box_real[symmetric] |
|
6577 by (rule integrable_reflect) |
|
6578 |
|
6579 lemma integral_reflect[simp]: "integral (cbox (-b) (-a)) (\<lambda>x. f (-x)) = integral (cbox a b) f" |
|
6580 unfolding integral_def by auto |
|
6581 |
|
6582 lemma integral_reflect_real[simp]: "integral {-b .. -a} (\<lambda>x. f (-x)) = integral {a .. b::real} f" |
|
6583 unfolding box_real[symmetric] |
|
6584 by (rule integral_reflect) |
|
6585 |
|
6586 |
|
6587 subsection \<open>Stronger form of FCT; quite a tedious proof.\<close> |
|
6588 |
|
6589 lemma bgauge_existence_lemma: "(\<forall>x\<in>s. \<exists>d::real. 0 < d \<and> q d x) \<longleftrightarrow> (\<forall>x. \<exists>d>0. x\<in>s \<longrightarrow> q d x)" |
|
6590 by (meson zero_less_one) |
|
6591 |
|
6592 lemma additive_tagged_division_1': |
|
6593 fixes f :: "real \<Rightarrow> 'a::real_normed_vector" |
|
6594 assumes "a \<le> b" |
|
6595 and "p tagged_division_of {a..b}" |
|
6596 shows "setsum (\<lambda>(x,k). f (Sup k) - f(Inf k)) p = f b - f a" |
|
6597 using additive_tagged_division_1[OF _ assms(2), of f] |
|
6598 using assms(1) |
|
6599 by auto |
|
6600 |
|
6601 lemma split_minus[simp]: "(\<lambda>(x, k). f x k) x - (\<lambda>(x, k). g x k) x = (\<lambda>(x, k). f x k - g x k) x" |
|
6602 by (simp add: split_def) |
|
6603 |
|
6604 lemma norm_triangle_le_sub: "norm x + norm y \<le> e \<Longrightarrow> norm (x - y) \<le> e" |
|
6605 apply (subst(asm)(2) norm_minus_cancel[symmetric]) |
|
6606 apply (drule norm_triangle_le) |
|
6607 apply (auto simp add: algebra_simps) |
|
6608 done |
|
6609 |
|
6610 lemma fundamental_theorem_of_calculus_interior: |
|
6611 fixes f :: "real \<Rightarrow> 'a::real_normed_vector" |
|
6612 assumes "a \<le> b" |
|
6613 and "continuous_on {a .. b} f" |
|
6614 and "\<forall>x\<in>{a <..< b}. (f has_vector_derivative f'(x)) (at x)" |
|
6615 shows "(f' has_integral (f b - f a)) {a .. b}" |
|
6616 proof - |
|
6617 { |
|
6618 presume *: "a < b \<Longrightarrow> ?thesis" |
|
6619 show ?thesis |
|
6620 proof (cases "a < b") |
|
6621 case True |
|
6622 then show ?thesis by (rule *) |
|
6623 next |
|
6624 case False |
|
6625 then have "a = b" |
|
6626 using assms(1) by auto |
|
6627 then have *: "cbox a b = {b}" "f b - f a = 0" |
|
6628 by (auto simp add: order_antisym) |
|
6629 show ?thesis |
|
6630 unfolding *(2) |
|
6631 unfolding content_eq_0 |
|
6632 using * \<open>a = b\<close> |
|
6633 by (auto simp: ex_in_conv) |
|
6634 qed |
|
6635 } |
|
6636 assume ab: "a < b" |
|
6637 let ?P = "\<lambda>e. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of {a .. b} \<and> d fine p \<longrightarrow> |
|
6638 norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f' x) - (f b - f a)) \<le> e * content {a .. b})" |
|
6639 { presume "\<And>e. e > 0 \<Longrightarrow> ?P e" then show ?thesis unfolding has_integral_factor_content_real by auto } |
|
6640 fix e :: real |
|
6641 assume e: "e > 0" |
|
6642 note assms(3)[unfolded has_vector_derivative_def has_derivative_at_alt ball_conj_distrib] |
|
6643 note conjunctD2[OF this] |
|
6644 note bounded=this(1) and this(2) |
|
6645 from this(2) have "\<forall>x\<in>box a b. \<exists>d>0. \<forall>y. norm (y - x) < d \<longrightarrow> |
|
6646 norm (f y - f x - (y - x) *\<^sub>R f' x) \<le> e/2 * norm (y - x)" |
|
6647 apply - |
|
6648 apply safe |
|
6649 apply (erule_tac x=x in ballE) |
|
6650 apply (erule_tac x="e/2" in allE) |
|
6651 using e |
|
6652 apply auto |
|
6653 done |
|
6654 note this[unfolded bgauge_existence_lemma] |
|
6655 from choice[OF this] guess d .. |
|
6656 note conjunctD2[OF this[rule_format]] |
|
6657 note d = this[rule_format] |
|
6658 have "bounded (f ` cbox a b)" |
|
6659 apply (rule compact_imp_bounded compact_continuous_image)+ |
|
6660 using compact_cbox assms |
|
6661 apply auto |
|
6662 done |
|
6663 from this[unfolded bounded_pos] guess B .. note B = this[rule_format] |
|
6664 |
|
6665 have "\<exists>da. 0 < da \<and> (\<forall>c. a \<le> c \<and> {a .. c} \<subseteq> {a .. b} \<and> {a .. c} \<subseteq> ball a da \<longrightarrow> |
|
6666 norm (content {a .. c} *\<^sub>R f' a - (f c - f a)) \<le> (e * (b - a)) / 4)" |
|
6667 proof - |
|
6668 have "a \<in> {a .. b}" |
|
6669 using ab by auto |
|
6670 note assms(2)[unfolded continuous_on_eq_continuous_within,rule_format,OF this] |
|
6671 note * = this[unfolded continuous_within Lim_within,rule_format] |
|
6672 have "(e * (b - a)) / 8 > 0" |
|
6673 using e ab by (auto simp add: field_simps) |
|
6674 from *[OF this] guess k .. note k = conjunctD2[OF this,rule_format] |
|
6675 have "\<exists>l. 0 < l \<and> norm(l *\<^sub>R f' a) \<le> (e * (b - a)) / 8" |
|
6676 proof (cases "f' a = 0") |
|
6677 case True |
|
6678 thus ?thesis using ab e by auto |
|
6679 next |
|
6680 case False |
|
6681 then show ?thesis |
|
6682 apply (rule_tac x="(e * (b - a)) / 8 / norm (f' a)" in exI) |
|
6683 using ab e |
|
6684 apply (auto simp add: field_simps) |
|
6685 done |
|
6686 qed |
|
6687 then guess l .. note l = conjunctD2[OF this] |
|
6688 show ?thesis |
|
6689 apply (rule_tac x="min k l" in exI) |
|
6690 apply safe |
|
6691 unfolding min_less_iff_conj |
|
6692 apply rule |
|
6693 apply (rule l k)+ |
|
6694 proof - |
|
6695 fix c |
|
6696 assume as: "a \<le> c" "{a .. c} \<subseteq> {a .. b}" "{a .. c} \<subseteq> ball a (min k l)" |
|
6697 note as' = this[unfolded subset_eq Ball_def mem_ball dist_real_def mem_box] |
|
6698 have "norm ((c - a) *\<^sub>R f' a - (f c - f a)) \<le> norm ((c - a) *\<^sub>R f' a) + norm (f c - f a)" |
|
6699 by (rule norm_triangle_ineq4) |
|
6700 also have "\<dots> \<le> e * (b - a) / 8 + e * (b - a) / 8" |
|
6701 proof (rule add_mono) |
|
6702 have "\<bar>c - a\<bar> \<le> \<bar>l\<bar>" |
|
6703 using as' by auto |
|
6704 then show "norm ((c - a) *\<^sub>R f' a) \<le> e * (b - a) / 8" |
|
6705 apply - |
|
6706 apply (rule order_trans[OF _ l(2)]) |
|
6707 unfolding norm_scaleR |
|
6708 apply (rule mult_right_mono) |
|
6709 apply auto |
|
6710 done |
|
6711 next |
|
6712 show "norm (f c - f a) \<le> e * (b - a) / 8" |
|
6713 apply (rule less_imp_le) |
|
6714 apply (cases "a = c") |
|
6715 defer |
|
6716 apply (rule k(2)[unfolded dist_norm]) |
|
6717 using as' e ab |
|
6718 apply (auto simp add: field_simps) |
|
6719 done |
|
6720 qed |
|
6721 finally show "norm (content {a .. c} *\<^sub>R f' a - (f c - f a)) \<le> e * (b - a) / 4" |
|
6722 unfolding content_real[OF as(1)] by auto |
|
6723 qed |
|
6724 qed |
|
6725 then guess da .. note da=conjunctD2[OF this,rule_format] |
|
6726 |
|
6727 have "\<exists>db>0. \<forall>c\<le>b. {c .. b} \<subseteq> {a .. b} \<and> {c .. b} \<subseteq> ball b db \<longrightarrow> |
|
6728 norm (content {c .. b} *\<^sub>R f' b - (f b - f c)) \<le> (e * (b - a)) / 4" |
|
6729 proof - |
|
6730 have "b \<in> {a .. b}" |
|
6731 using ab by auto |
|
6732 note assms(2)[unfolded continuous_on_eq_continuous_within,rule_format,OF this] |
|
6733 note * = this[unfolded continuous_within Lim_within,rule_format] have "(e * (b - a)) / 8 > 0" |
|
6734 using e ab by (auto simp add: field_simps) |
|
6735 from *[OF this] guess k .. note k = conjunctD2[OF this,rule_format] |
|
6736 have "\<exists>l. 0 < l \<and> norm (l *\<^sub>R f' b) \<le> (e * (b - a)) / 8" |
|
6737 proof (cases "f' b = 0") |
|
6738 case True |
|
6739 thus ?thesis using ab e by auto |
|
6740 next |
|
6741 case False |
|
6742 then show ?thesis |
|
6743 apply (rule_tac x="(e * (b - a)) / 8 / norm (f' b)" in exI) |
|
6744 using ab e |
|
6745 apply (auto simp add: field_simps) |
|
6746 done |
|
6747 qed |
|
6748 then guess l .. note l = conjunctD2[OF this] |
|
6749 show ?thesis |
|
6750 apply (rule_tac x="min k l" in exI) |
|
6751 apply safe |
|
6752 unfolding min_less_iff_conj |
|
6753 apply rule |
|
6754 apply (rule l k)+ |
|
6755 proof - |
|
6756 fix c |
|
6757 assume as: "c \<le> b" "{c..b} \<subseteq> {a..b}" "{c..b} \<subseteq> ball b (min k l)" |
|
6758 note as' = this[unfolded subset_eq Ball_def mem_ball dist_real_def mem_box] |
|
6759 have "norm ((b - c) *\<^sub>R f' b - (f b - f c)) \<le> norm ((b - c) *\<^sub>R f' b) + norm (f b - f c)" |
|
6760 by (rule norm_triangle_ineq4) |
|
6761 also have "\<dots> \<le> e * (b - a) / 8 + e * (b - a) / 8" |
|
6762 proof (rule add_mono) |
|
6763 have "\<bar>c - b\<bar> \<le> \<bar>l\<bar>" |
|
6764 using as' by auto |
|
6765 then show "norm ((b - c) *\<^sub>R f' b) \<le> e * (b - a) / 8" |
|
6766 apply - |
|
6767 apply (rule order_trans[OF _ l(2)]) |
|
6768 unfolding norm_scaleR |
|
6769 apply (rule mult_right_mono) |
|
6770 apply auto |
|
6771 done |
|
6772 next |
|
6773 show "norm (f b - f c) \<le> e * (b - a) / 8" |
|
6774 apply (rule less_imp_le) |
|
6775 apply (cases "b = c") |
|
6776 defer |
|
6777 apply (subst norm_minus_commute) |
|
6778 apply (rule k(2)[unfolded dist_norm]) |
|
6779 using as' e ab |
|
6780 apply (auto simp add: field_simps) |
|
6781 done |
|
6782 qed |
|
6783 finally show "norm (content {c .. b} *\<^sub>R f' b - (f b - f c)) \<le> e * (b - a) / 4" |
|
6784 unfolding content_real[OF as(1)] by auto |
|
6785 qed |
|
6786 qed |
|
6787 then guess db .. note db=conjunctD2[OF this,rule_format] |
|
6788 |
|
6789 let ?d = "(\<lambda>x. ball x (if x=a then da else if x=b then db else d x))" |
|
6790 show "?P e" |
|
6791 apply (rule_tac x="?d" in exI) |
|
6792 proof (safe, goal_cases) |
|
6793 case 1 |
|
6794 show ?case |
|
6795 apply (rule gauge_ball_dependent) |
|
6796 using ab db(1) da(1) d(1) |
|
6797 apply auto |
|
6798 done |
|
6799 next |
|
6800 case as: (2 p) |
|
6801 let ?A = "{t. fst t \<in> {a, b}}" |
|
6802 note p = tagged_division_ofD[OF as(1)] |
|
6803 have pA: "p = (p \<inter> ?A) \<union> (p - ?A)" "finite (p \<inter> ?A)" "finite (p - ?A)" "(p \<inter> ?A) \<inter> (p - ?A) = {}" |
|
6804 using as by auto |
|
6805 note * = additive_tagged_division_1'[OF assms(1) as(1), symmetric] |
|
6806 have **: "\<And>n1 s1 n2 s2::real. n2 \<le> s2 / 2 \<Longrightarrow> n1 - s1 \<le> s2 / 2 \<Longrightarrow> n1 + n2 \<le> s1 + s2" |
|
6807 by arith |
|
6808 show ?case |
|
6809 unfolding content_real[OF assms(1)] and *[of "\<lambda>x. x"] *[of f] setsum_subtractf[symmetric] split_minus |
|
6810 unfolding setsum_right_distrib |
|
6811 apply (subst(2) pA) |
|
6812 apply (subst pA) |
|
6813 unfolding setsum.union_disjoint[OF pA(2-)] |
|
6814 proof (rule norm_triangle_le, rule **, goal_cases) |
|
6815 case 1 |
|
6816 show ?case |
|
6817 apply (rule order_trans) |
|
6818 apply (rule setsum_norm_le) |
|
6819 defer |
|
6820 apply (subst setsum_divide_distrib) |
|
6821 apply (rule order_refl) |
|
6822 apply safe |
|
6823 apply (unfold not_le o_def split_conv fst_conv) |
|
6824 proof (rule ccontr) |
|
6825 fix x k |
|
6826 assume xk: "(x, k) \<in> p" |
|
6827 "e * (Sup k - Inf k) / 2 < |
|
6828 norm (content k *\<^sub>R f' x - (f (Sup k) - f (Inf k)))" |
|
6829 from p(4)[OF this(1)] guess u v by (elim exE) note k=this |
|
6830 then have "u \<le> v" and uv: "{u, v} \<subseteq> cbox u v" |
|
6831 using p(2)[OF xk(1)] by auto |
|
6832 note result = xk(2)[unfolded k box_real interval_bounds_real[OF this(1)] content_real[OF this(1)]] |
|
6833 |
|
6834 assume as': "x \<noteq> a" "x \<noteq> b" |
|
6835 then have "x \<in> box a b" |
|
6836 using p(2-3)[OF xk(1)] by (auto simp: mem_box) |
|
6837 note * = d(2)[OF this] |
|
6838 have "norm ((v - u) *\<^sub>R f' (x) - (f (v) - f (u))) = |
|
6839 norm ((f (u) - f (x) - (u - x) *\<^sub>R f' (x)) - (f (v) - f (x) - (v - x) *\<^sub>R f' (x)))" |
|
6840 apply (rule arg_cong[of _ _ norm]) |
|
6841 unfolding scaleR_left.diff |
|
6842 apply auto |
|
6843 done |
|
6844 also have "\<dots> \<le> e / 2 * norm (u - x) + e / 2 * norm (v - x)" |
|
6845 apply (rule norm_triangle_le_sub) |
|
6846 apply (rule add_mono) |
|
6847 apply (rule_tac[!] *) |
|
6848 using fineD[OF as(2) xk(1)] as' |
|
6849 unfolding k subset_eq |
|
6850 apply - |
|
6851 apply (erule_tac x=u in ballE) |
|
6852 apply (erule_tac[3] x=v in ballE) |
|
6853 using uv |
|
6854 apply (auto simp:dist_real_def) |
|
6855 done |
|
6856 also have "\<dots> \<le> e / 2 * norm (v - u)" |
|
6857 using p(2)[OF xk(1)] |
|
6858 unfolding k |
|
6859 by (auto simp add: field_simps) |
|
6860 finally have "e * (v - u) / 2 < e * (v - u) / 2" |
|
6861 apply - |
|
6862 apply (rule less_le_trans[OF result]) |
|
6863 using uv |
|
6864 apply auto |
|
6865 done |
|
6866 then show False by auto |
|
6867 qed |
|
6868 next |
|
6869 have *: "\<And>x s1 s2::real. 0 \<le> s1 \<Longrightarrow> x \<le> (s1 + s2) / 2 \<Longrightarrow> x - s1 \<le> s2 / 2" |
|
6870 by auto |
|
6871 case 2 |
|
6872 show ?case |
|
6873 apply (rule *) |
|
6874 apply (rule setsum_nonneg) |
|
6875 apply rule |
|
6876 apply (unfold split_paired_all split_conv) |
|
6877 defer |
|
6878 unfolding setsum.union_disjoint[OF pA(2-),symmetric] pA(1)[symmetric] |
|
6879 unfolding setsum_right_distrib[symmetric] |
|
6880 apply (subst additive_tagged_division_1[OF _ as(1)]) |
|
6881 apply (rule assms) |
|
6882 proof - |
|
6883 fix x k |
|
6884 assume "(x, k) \<in> p \<inter> {t. fst t \<in> {a, b}}" |
|
6885 note xk=IntD1[OF this] |
|
6886 from p(4)[OF this] guess u v by (elim exE) note uv=this |
|
6887 with p(2)[OF xk] have "cbox u v \<noteq> {}" |
|
6888 by auto |
|
6889 then show "0 \<le> e * ((Sup k) - (Inf k))" |
|
6890 unfolding uv using e by (auto simp add: field_simps) |
|
6891 next |
|
6892 have *: "\<And>s f t e. setsum f s = setsum f t \<Longrightarrow> norm (setsum f t) \<le> e \<Longrightarrow> norm (setsum f s) \<le> e" |
|
6893 by auto |
|
6894 show "norm (\<Sum>(x, k)\<in>p \<inter> ?A. content k *\<^sub>R f' x - |
|
6895 (f ((Sup k)) - f ((Inf k)))) \<le> e * (b - a) / 2" |
|
6896 apply (rule *[where t1="p \<inter> {t. fst t \<in> {a, b} \<and> content(snd t) \<noteq> 0}"]) |
|
6897 apply (rule setsum.mono_neutral_right[OF pA(2)]) |
|
6898 defer |
|
6899 apply rule |
|
6900 unfolding split_paired_all split_conv o_def |
|
6901 proof goal_cases |
|
6902 fix x k |
|
6903 assume "(x, k) \<in> p \<inter> {t. fst t \<in> {a, b}} - p \<inter> {t. fst t \<in> {a, b} \<and> content (snd t) \<noteq> 0}" |
|
6904 then have xk: "(x, k) \<in> p" "content k = 0" |
|
6905 by auto |
|
6906 from p(4)[OF xk(1)] guess u v by (elim exE) note uv=this |
|
6907 have "k \<noteq> {}" |
|
6908 using p(2)[OF xk(1)] by auto |
|
6909 then have *: "u = v" |
|
6910 using xk |
|
6911 unfolding uv content_eq_0 box_eq_empty |
|
6912 by auto |
|
6913 then show "content k *\<^sub>R (f' (x)) - (f ((Sup k)) - f ((Inf k))) = 0" |
|
6914 using xk unfolding uv by auto |
|
6915 next |
|
6916 have *: "p \<inter> {t. fst t \<in> {a, b} \<and> content(snd t) \<noteq> 0} = |
|
6917 {t. t\<in>p \<and> fst t = a \<and> content(snd t) \<noteq> 0} \<union> {t. t\<in>p \<and> fst t = b \<and> content(snd t) \<noteq> 0}" |
|
6918 by blast |
|
6919 have **: "norm (setsum f s) \<le> e" |
|
6920 if "\<forall>x y. x \<in> s \<and> y \<in> s \<longrightarrow> x = y" |
|
6921 and "\<forall>x. x \<in> s \<longrightarrow> norm (f x) \<le> e" |
|
6922 and "e > 0" |
|
6923 for s f and e :: real |
|
6924 proof (cases "s = {}") |
|
6925 case True |
|
6926 with that show ?thesis by auto |
|
6927 next |
|
6928 case False |
|
6929 then obtain x where "x \<in> s" |
|
6930 by auto |
|
6931 then have *: "s = {x}" |
|
6932 using that(1) by auto |
|
6933 then show ?thesis |
|
6934 using \<open>x \<in> s\<close> that(2) by auto |
|
6935 qed |
|
6936 case 2 |
|
6937 show ?case |
|
6938 apply (subst *) |
|
6939 apply (subst setsum.union_disjoint) |
|
6940 prefer 4 |
|
6941 apply (rule order_trans[of _ "e * (b - a)/4 + e * (b - a)/4"]) |
|
6942 apply (rule norm_triangle_le,rule add_mono) |
|
6943 apply (rule_tac[1-2] **) |
|
6944 proof - |
|
6945 let ?B = "\<lambda>x. {t \<in> p. fst t = x \<and> content (snd t) \<noteq> 0}" |
|
6946 have pa: "\<exists>v. k = cbox a v \<and> a \<le> v" if "(a, k) \<in> p" for k |
|
6947 proof - |
|
6948 guess u v using p(4)[OF that] by (elim exE) note uv=this |
|
6949 have *: "u \<le> v" |
|
6950 using p(2)[OF that] unfolding uv by auto |
|
6951 have u: "u = a" |
|
6952 proof (rule ccontr) |
|
6953 have "u \<in> cbox u v" |
|
6954 using p(2-3)[OF that(1)] unfolding uv by auto |
|
6955 have "u \<ge> a" |
|
6956 using p(2-3)[OF that(1)] unfolding uv subset_eq by auto |
|
6957 moreover assume "\<not> ?thesis" |
|
6958 ultimately have "u > a" by auto |
|
6959 then show False |
|
6960 using p(2)[OF that(1)] unfolding uv by (auto simp add:) |
|
6961 qed |
|
6962 then show ?thesis |
|
6963 apply (rule_tac x=v in exI) |
|
6964 unfolding uv |
|
6965 using * |
|
6966 apply auto |
|
6967 done |
|
6968 qed |
|
6969 have pb: "\<exists>v. k = cbox v b \<and> b \<ge> v" if "(b, k) \<in> p" for k |
|
6970 proof - |
|
6971 guess u v using p(4)[OF that] by (elim exE) note uv=this |
|
6972 have *: "u \<le> v" |
|
6973 using p(2)[OF that] unfolding uv by auto |
|
6974 have u: "v = b" |
|
6975 proof (rule ccontr) |
|
6976 have "u \<in> cbox u v" |
|
6977 using p(2-3)[OF that(1)] unfolding uv by auto |
|
6978 have "v \<le> b" |
|
6979 using p(2-3)[OF that(1)] unfolding uv subset_eq by auto |
|
6980 moreover assume "\<not> ?thesis" |
|
6981 ultimately have "v < b" by auto |
|
6982 then show False |
|
6983 using p(2)[OF that(1)] unfolding uv by (auto simp add:) |
|
6984 qed |
|
6985 then show ?thesis |
|
6986 apply (rule_tac x=u in exI) |
|
6987 unfolding uv |
|
6988 using * |
|
6989 apply auto |
|
6990 done |
|
6991 qed |
|
6992 show "\<forall>x y. x \<in> ?B a \<and> y \<in> ?B a \<longrightarrow> x = y" |
|
6993 apply (rule,rule,rule,unfold split_paired_all) |
|
6994 unfolding mem_Collect_eq fst_conv snd_conv |
|
6995 apply safe |
|
6996 proof - |
|
6997 fix x k k' |
|
6998 assume k: "(a, k) \<in> p" "(a, k') \<in> p" "content k \<noteq> 0" "content k' \<noteq> 0" |
|
6999 guess v using pa[OF k(1)] .. note v = conjunctD2[OF this] |
|
7000 guess v' using pa[OF k(2)] .. note v' = conjunctD2[OF this] let ?v = "min v v'" |
|
7001 have "box a ?v \<subseteq> k \<inter> k'" |
|
7002 unfolding v v' by (auto simp add: mem_box) |
|
7003 note interior_mono[OF this,unfolded interior_Int] |
|
7004 moreover have "(a + ?v)/2 \<in> box a ?v" |
|
7005 using k(3-) |
|
7006 unfolding v v' content_eq_0 not_le |
|
7007 by (auto simp add: mem_box) |
|
7008 ultimately have "(a + ?v)/2 \<in> interior k \<inter> interior k'" |
|
7009 unfolding interior_open[OF open_box] by auto |
|
7010 then have *: "k = k'" |
|
7011 apply - |
|
7012 apply (rule ccontr) |
|
7013 using p(5)[OF k(1-2)] |
|
7014 apply auto |
|
7015 done |
|
7016 { assume "x \<in> k" then show "x \<in> k'" unfolding * . } |
|
7017 { assume "x \<in> k'" then show "x \<in> k" unfolding * . } |
|
7018 qed |
|
7019 show "\<forall>x y. x \<in> ?B b \<and> y \<in> ?B b \<longrightarrow> x = y" |
|
7020 apply rule |
|
7021 apply rule |
|
7022 apply rule |
|
7023 apply (unfold split_paired_all) |
|
7024 unfolding mem_Collect_eq fst_conv snd_conv |
|
7025 apply safe |
|
7026 proof - |
|
7027 fix x k k' |
|
7028 assume k: "(b, k) \<in> p" "(b, k') \<in> p" "content k \<noteq> 0" "content k' \<noteq> 0" |
|
7029 guess v using pb[OF k(1)] .. note v = conjunctD2[OF this] |
|
7030 guess v' using pb[OF k(2)] .. note v' = conjunctD2[OF this] |
|
7031 let ?v = "max v v'" |
|
7032 have "box ?v b \<subseteq> k \<inter> k'" |
|
7033 unfolding v v' by (auto simp: mem_box) |
|
7034 note interior_mono[OF this,unfolded interior_Int] |
|
7035 moreover have " ((b + ?v)/2) \<in> box ?v b" |
|
7036 using k(3-) unfolding v v' content_eq_0 not_le by (auto simp: mem_box) |
|
7037 ultimately have " ((b + ?v)/2) \<in> interior k \<inter> interior k'" |
|
7038 unfolding interior_open[OF open_box] by auto |
|
7039 then have *: "k = k'" |
|
7040 apply - |
|
7041 apply (rule ccontr) |
|
7042 using p(5)[OF k(1-2)] |
|
7043 apply auto |
|
7044 done |
|
7045 { assume "x \<in> k" then show "x \<in> k'" unfolding * . } |
|
7046 { assume "x \<in> k'" then show "x\<in>k" unfolding * . } |
|
7047 qed |
|
7048 |
|
7049 let ?a = a and ?b = b (* a is something else while proofing the next theorem. *) |
|
7050 show "\<forall>x. x \<in> ?B a \<longrightarrow> norm ((\<lambda>(x, k). content k *\<^sub>R f' x - (f (Sup k) - |
|
7051 f (Inf k))) x) \<le> e * (b - a) / 4" |
|
7052 apply rule |
|
7053 apply rule |
|
7054 unfolding mem_Collect_eq |
|
7055 unfolding split_paired_all fst_conv snd_conv |
|
7056 proof (safe, goal_cases) |
|
7057 case prems: 1 |
|
7058 guess v using pa[OF prems(1)] .. note v = conjunctD2[OF this] |
|
7059 have "?a \<in> {?a..v}" |
|
7060 using v(2) by auto |
|
7061 then have "v \<le> ?b" |
|
7062 using p(3)[OF prems(1)] unfolding subset_eq v by auto |
|
7063 moreover have "{?a..v} \<subseteq> ball ?a da" |
|
7064 using fineD[OF as(2) prems(1)] |
|
7065 apply - |
|
7066 apply (subst(asm) if_P) |
|
7067 apply (rule refl) |
|
7068 unfolding subset_eq |
|
7069 apply safe |
|
7070 apply (erule_tac x=" x" in ballE) |
|
7071 apply (auto simp add:subset_eq dist_real_def v) |
|
7072 done |
|
7073 ultimately show ?case |
|
7074 unfolding v interval_bounds_real[OF v(2)] box_real |
|
7075 apply - |
|
7076 apply(rule da(2)[of "v"]) |
|
7077 using prems fineD[OF as(2) prems(1)] |
|
7078 unfolding v content_eq_0 |
|
7079 apply auto |
|
7080 done |
|
7081 qed |
|
7082 show "\<forall>x. x \<in> ?B b \<longrightarrow> norm ((\<lambda>(x, k). content k *\<^sub>R f' x - |
|
7083 (f (Sup k) - f (Inf k))) x) \<le> e * (b - a) / 4" |
|
7084 apply rule |
|
7085 apply rule |
|
7086 unfolding mem_Collect_eq |
|
7087 unfolding split_paired_all fst_conv snd_conv |
|
7088 proof (safe, goal_cases) |
|
7089 case prems: 1 |
|
7090 guess v using pb[OF prems(1)] .. note v = conjunctD2[OF this] |
|
7091 have "?b \<in> {v.. ?b}" |
|
7092 using v(2) by auto |
|
7093 then have "v \<ge> ?a" using p(3)[OF prems(1)] |
|
7094 unfolding subset_eq v by auto |
|
7095 moreover have "{v..?b} \<subseteq> ball ?b db" |
|
7096 using fineD[OF as(2) prems(1)] |
|
7097 apply - |
|
7098 apply (subst(asm) if_P, rule refl) |
|
7099 unfolding subset_eq |
|
7100 apply safe |
|
7101 apply (erule_tac x=" x" in ballE) |
|
7102 using ab |
|
7103 apply (auto simp add:subset_eq v dist_real_def) |
|
7104 done |
|
7105 ultimately show ?case |
|
7106 unfolding v |
|
7107 unfolding interval_bounds_real[OF v(2)] box_real |
|
7108 apply - |
|
7109 apply(rule db(2)[of "v"]) |
|
7110 using prems fineD[OF as(2) prems(1)] |
|
7111 unfolding v content_eq_0 |
|
7112 apply auto |
|
7113 done |
|
7114 qed |
|
7115 qed (insert p(1) ab e, auto simp add: field_simps) |
|
7116 qed auto |
|
7117 qed |
|
7118 qed |
|
7119 qed |
|
7120 qed |
|
7121 |
|
7122 |
|
7123 subsection \<open>Stronger form with finite number of exceptional points.\<close> |
|
7124 |
|
7125 lemma fundamental_theorem_of_calculus_interior_strong: |
|
7126 fixes f :: "real \<Rightarrow> 'a::banach" |
|
7127 assumes "finite s" |
|
7128 and "a \<le> b" |
|
7129 and "continuous_on {a .. b} f" |
|
7130 and "\<forall>x\<in>{a <..< b} - s. (f has_vector_derivative f'(x)) (at x)" |
|
7131 shows "(f' has_integral (f b - f a)) {a .. b}" |
|
7132 using assms |
|
7133 proof (induct "card s" arbitrary: s a b) |
|
7134 case 0 |
|
7135 show ?case |
|
7136 apply (rule fundamental_theorem_of_calculus_interior) |
|
7137 using 0 |
|
7138 apply auto |
|
7139 done |
|
7140 next |
|
7141 case (Suc n) |
|
7142 from this(2) guess c s' |
|
7143 apply - |
|
7144 apply (subst(asm) eq_commute) |
|
7145 unfolding card_Suc_eq |
|
7146 apply (subst(asm)(2) eq_commute) |
|
7147 apply (elim exE conjE) |
|
7148 done |
|
7149 note cs = this[rule_format] |
|
7150 show ?case |
|
7151 proof (cases "c \<in> box a b") |
|
7152 case False |
|
7153 then show ?thesis |
|
7154 apply - |
|
7155 apply (rule Suc(1)[OF cs(3) _ Suc(4,5)]) |
|
7156 apply safe |
|
7157 defer |
|
7158 apply (rule Suc(6)[rule_format]) |
|
7159 using Suc(3) |
|
7160 unfolding cs |
|
7161 apply auto |
|
7162 done |
|
7163 next |
|
7164 have *: "f b - f a = (f c - f a) + (f b - f c)" |
|
7165 by auto |
|
7166 case True |
|
7167 then have "a \<le> c" "c \<le> b" |
|
7168 by (auto simp: mem_box) |
|
7169 then show ?thesis |
|
7170 apply (subst *) |
|
7171 apply (rule has_integral_combine) |
|
7172 apply assumption+ |
|
7173 apply (rule_tac[!] Suc(1)[OF cs(3)]) |
|
7174 using Suc(3) |
|
7175 unfolding cs |
|
7176 proof - |
|
7177 show "continuous_on {a .. c} f" "continuous_on {c .. b} f" |
|
7178 apply (rule_tac[!] continuous_on_subset[OF Suc(5)]) |
|
7179 using True |
|
7180 apply (auto simp: mem_box) |
|
7181 done |
|
7182 let ?P = "\<lambda>i j. \<forall>x\<in>{i <..< j} - s'. (f has_vector_derivative f' x) (at x)" |
|
7183 show "?P a c" "?P c b" |
|
7184 apply safe |
|
7185 apply (rule_tac[!] Suc(6)[rule_format]) |
|
7186 using True |
|
7187 unfolding cs |
|
7188 apply (auto simp: mem_box) |
|
7189 done |
|
7190 qed auto |
|
7191 qed |
|
7192 qed |
|
7193 |
|
7194 lemma fundamental_theorem_of_calculus_strong: |
|
7195 fixes f :: "real \<Rightarrow> 'a::banach" |
|
7196 assumes "finite s" |
|
7197 and "a \<le> b" |
|
7198 and "continuous_on {a .. b} f" |
|
7199 and "\<forall>x\<in>{a .. b} - s. (f has_vector_derivative f'(x)) (at x)" |
|
7200 shows "(f' has_integral (f b - f a)) {a .. b}" |
|
7201 apply (rule fundamental_theorem_of_calculus_interior_strong[OF assms(1-3), of f']) |
|
7202 using assms(4) |
|
7203 apply (auto simp: mem_box) |
|
7204 done |
|
7205 |
|
7206 lemma indefinite_integral_continuous_left: |
|
7207 fixes f:: "real \<Rightarrow> 'a::banach" |
|
7208 assumes "f integrable_on {a .. b}" |
|
7209 and "a < c" |
|
7210 and "c \<le> b" |
|
7211 and "e > 0" |
|
7212 obtains d where "d > 0" |
|
7213 and "\<forall>t. c - d < t \<and> t \<le> c \<longrightarrow> norm (integral {a .. c} f - integral {a .. t} f) < e" |
|
7214 proof - |
|
7215 have "\<exists>w>0. \<forall>t. c - w < t \<and> t < c \<longrightarrow> norm (f c) * norm(c - t) < e / 3" |
|
7216 proof (cases "f c = 0") |
|
7217 case False |
|
7218 hence "0 < e / 3 / norm (f c)" using \<open>e>0\<close> by simp |
|
7219 then show ?thesis |
|
7220 apply - |
|
7221 apply rule |
|
7222 apply rule |
|
7223 apply assumption |
|
7224 apply safe |
|
7225 proof - |
|
7226 fix t |
|
7227 assume as: "t < c" and "c - e / 3 / norm (f c) < t" |
|
7228 then have "c - t < e / 3 / norm (f c)" |
|
7229 by auto |
|
7230 then have "norm (c - t) < e / 3 / norm (f c)" |
|
7231 using as by auto |
|
7232 then show "norm (f c) * norm (c - t) < e / 3" |
|
7233 using False |
|
7234 apply - |
|
7235 apply (subst mult.commute) |
|
7236 apply (subst pos_less_divide_eq[symmetric]) |
|
7237 apply auto |
|
7238 done |
|
7239 qed |
|
7240 next |
|
7241 case True |
|
7242 show ?thesis |
|
7243 apply (rule_tac x=1 in exI) |
|
7244 unfolding True |
|
7245 using \<open>e > 0\<close> |
|
7246 apply auto |
|
7247 done |
|
7248 qed |
|
7249 then guess w .. note w = conjunctD2[OF this,rule_format] |
|
7250 |
|
7251 have *: "e / 3 > 0" |
|
7252 using assms by auto |
|
7253 have "f integrable_on {a .. c}" |
|
7254 apply (rule integrable_subinterval_real[OF assms(1)]) |
|
7255 using assms(2-3) |
|
7256 apply auto |
|
7257 done |
|
7258 from integrable_integral[OF this,unfolded has_integral_real,rule_format,OF *] guess d1 .. |
|
7259 note d1 = conjunctD2[OF this,rule_format] |
|
7260 define d where [abs_def]: "d x = ball x w \<inter> d1 x" for x |
|
7261 have "gauge d" |
|
7262 unfolding d_def using w(1) d1 by auto |
|
7263 note this[unfolded gauge_def,rule_format,of c] |
|
7264 note conjunctD2[OF this] |
|
7265 from this(2)[unfolded open_contains_ball,rule_format,OF this(1)] guess k .. |
|
7266 note k=conjunctD2[OF this] |
|
7267 |
|
7268 let ?d = "min k (c - a) / 2" |
|
7269 show ?thesis |
|
7270 apply (rule that[of ?d]) |
|
7271 apply safe |
|
7272 proof - |
|
7273 show "?d > 0" |
|
7274 using k(1) using assms(2) by auto |
|
7275 fix t |
|
7276 assume as: "c - ?d < t" "t \<le> c" |
|
7277 let ?thesis = "norm (integral ({a .. c}) f - integral ({a .. t}) f) < e" |
|
7278 { |
|
7279 presume *: "t < c \<Longrightarrow> ?thesis" |
|
7280 show ?thesis |
|
7281 apply (cases "t = c") |
|
7282 defer |
|
7283 apply (rule *) |
|
7284 apply (subst less_le) |
|
7285 using \<open>e > 0\<close> as(2) |
|
7286 apply auto |
|
7287 done |
|
7288 } |
|
7289 assume "t < c" |
|
7290 |
|
7291 have "f integrable_on {a .. t}" |
|
7292 apply (rule integrable_subinterval_real[OF assms(1)]) |
|
7293 using assms(2-3) as(2) |
|
7294 apply auto |
|
7295 done |
|
7296 from integrable_integral[OF this,unfolded has_integral_real,rule_format,OF *] guess d2 .. |
|
7297 note d2 = conjunctD2[OF this,rule_format] |
|
7298 define d3 where "d3 x = (if x \<le> t then d1 x \<inter> d2 x else d1 x)" for x |
|
7299 have "gauge d3" |
|
7300 using d2(1) d1(1) unfolding d3_def gauge_def by auto |
|
7301 from fine_division_exists_real[OF this, of a t] guess p . note p=this |
|
7302 note p'=tagged_division_ofD[OF this(1)] |
|
7303 have pt: "\<forall>(x,k)\<in>p. x \<le> t" |
|
7304 proof (safe, goal_cases) |
|
7305 case prems: 1 |
|
7306 from p'(2,3)[OF prems] show ?case |
|
7307 by auto |
|
7308 qed |
|
7309 with p(2) have "d2 fine p" |
|
7310 unfolding fine_def d3_def |
|
7311 apply safe |
|
7312 apply (erule_tac x="(a,b)" in ballE)+ |
|
7313 apply auto |
|
7314 done |
|
7315 note d2_fin = d2(2)[OF conjI[OF p(1) this]] |
|
7316 |
|
7317 have *: "{a .. c} \<inter> {x. x \<bullet> 1 \<le> t} = {a .. t}" "{a .. c} \<inter> {x. x \<bullet> 1 \<ge> t} = {t .. c}" |
|
7318 using assms(2-3) as by (auto simp add: field_simps) |
|
7319 have "p \<union> {(c, {t .. c})} tagged_division_of {a .. c} \<and> d1 fine p \<union> {(c, {t .. c})}" |
|
7320 apply rule |
|
7321 apply (rule tagged_division_union_interval_real[of _ _ _ 1 "t"]) |
|
7322 unfolding * |
|
7323 apply (rule p) |
|
7324 apply (rule tagged_division_of_self_real) |
|
7325 unfolding fine_def |
|
7326 apply safe |
|
7327 proof - |
|
7328 fix x k y |
|
7329 assume "(x,k) \<in> p" and "y \<in> k" |
|
7330 then show "y \<in> d1 x" |
|
7331 using p(2) pt |
|
7332 unfolding fine_def d3_def |
|
7333 apply - |
|
7334 apply (erule_tac x="(x,k)" in ballE)+ |
|
7335 apply auto |
|
7336 done |
|
7337 next |
|
7338 fix x assume "x \<in> {t..c}" |
|
7339 then have "dist c x < k" |
|
7340 unfolding dist_real_def |
|
7341 using as(1) |
|
7342 by (auto simp add: field_simps) |
|
7343 then show "x \<in> d1 c" |
|
7344 using k(2) |
|
7345 unfolding d_def |
|
7346 by auto |
|
7347 qed (insert as(2), auto) note d1_fin = d1(2)[OF this] |
|
7348 |
|
7349 have *: "integral {a .. c} f - integral {a .. t} f = -(((c - t) *\<^sub>R f c + (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)) - |
|
7350 integral {a .. c} f) + ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - integral {a .. t} f) + (c - t) *\<^sub>R f c" |
|
7351 "e = (e/3 + e/3) + e/3" |
|
7352 by auto |
|
7353 have **: "(\<Sum>(x, k)\<in>p \<union> {(c, {t .. c})}. content k *\<^sub>R f x) = |
|
7354 (c - t) *\<^sub>R f c + (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)" |
|
7355 proof - |
|
7356 have **: "\<And>x F. F \<union> {x} = insert x F" |
|
7357 by auto |
|
7358 have "(c, cbox t c) \<notin> p" |
|
7359 proof (safe, goal_cases) |
|
7360 case prems: 1 |
|
7361 from p'(2-3)[OF prems] have "c \<in> cbox a t" |
|
7362 by auto |
|
7363 then show False using \<open>t < c\<close> |
|
7364 by auto |
|
7365 qed |
|
7366 then show ?thesis |
|
7367 unfolding ** box_real |
|
7368 apply - |
|
7369 apply (subst setsum.insert) |
|
7370 apply (rule p') |
|
7371 unfolding split_conv |
|
7372 defer |
|
7373 apply (subst content_real) |
|
7374 using as(2) |
|
7375 apply auto |
|
7376 done |
|
7377 qed |
|
7378 have ***: "c - w < t \<and> t < c" |
|
7379 proof - |
|
7380 have "c - k < t" |
|
7381 using \<open>k>0\<close> as(1) by (auto simp add: field_simps) |
|
7382 moreover have "k \<le> w" |
|
7383 apply (rule ccontr) |
|
7384 using k(2) |
|
7385 unfolding subset_eq |
|
7386 apply (erule_tac x="c + ((k + w)/2)" in ballE) |
|
7387 unfolding d_def |
|
7388 using \<open>k > 0\<close> \<open>w > 0\<close> |
|
7389 apply (auto simp add: field_simps not_le not_less dist_real_def) |
|
7390 done |
|
7391 ultimately show ?thesis using \<open>t < c\<close> |
|
7392 by (auto simp add: field_simps) |
|
7393 qed |
|
7394 show ?thesis |
|
7395 unfolding *(1) |
|
7396 apply (subst *(2)) |
|
7397 apply (rule norm_triangle_lt add_strict_mono)+ |
|
7398 unfolding norm_minus_cancel |
|
7399 apply (rule d1_fin[unfolded **]) |
|
7400 apply (rule d2_fin) |
|
7401 using w(2)[OF ***] |
|
7402 unfolding norm_scaleR |
|
7403 apply (auto simp add: field_simps) |
|
7404 done |
|
7405 qed |
|
7406 qed |
|
7407 |
|
7408 lemma indefinite_integral_continuous_right: |
|
7409 fixes f :: "real \<Rightarrow> 'a::banach" |
|
7410 assumes "f integrable_on {a .. b}" |
|
7411 and "a \<le> c" |
|
7412 and "c < b" |
|
7413 and "e > 0" |
|
7414 obtains d where "0 < d" |
|
7415 and "\<forall>t. c \<le> t \<and> t < c + d \<longrightarrow> norm (integral {a .. c} f - integral {a .. t} f) < e" |
|
7416 proof - |
|
7417 have *: "(\<lambda>x. f (- x)) integrable_on {-b .. -a}" "- b < - c" "- c \<le> - a" |
|
7418 using assms by auto |
|
7419 from indefinite_integral_continuous_left[OF * \<open>e>0\<close>] guess d . note d = this |
|
7420 let ?d = "min d (b - c)" |
|
7421 show ?thesis |
|
7422 apply (rule that[of "?d"]) |
|
7423 apply safe |
|
7424 proof - |
|
7425 show "0 < ?d" |
|
7426 using d(1) assms(3) by auto |
|
7427 fix t :: real |
|
7428 assume as: "c \<le> t" "t < c + ?d" |
|
7429 have *: "integral {a .. c} f = integral {a .. b} f - integral {c .. b} f" |
|
7430 "integral {a .. t} f = integral {a .. b} f - integral {t .. b} f" |
|
7431 apply (simp_all only: algebra_simps) |
|
7432 apply (rule_tac[!] integral_combine) |
|
7433 using assms as |
|
7434 apply auto |
|
7435 done |
|
7436 have "(- c) - d < (- t) \<and> - t \<le> - c" |
|
7437 using as by auto note d(2)[rule_format,OF this] |
|
7438 then show "norm (integral {a .. c} f - integral {a .. t} f) < e" |
|
7439 unfolding * |
|
7440 unfolding integral_reflect |
|
7441 apply (subst norm_minus_commute) |
|
7442 apply (auto simp add: algebra_simps) |
|
7443 done |
|
7444 qed |
|
7445 qed |
|
7446 |
|
7447 lemma indefinite_integral_continuous: |
|
7448 fixes f :: "real \<Rightarrow> 'a::banach" |
|
7449 assumes "f integrable_on {a .. b}" |
|
7450 shows "continuous_on {a .. b} (\<lambda>x. integral {a .. x} f)" |
|
7451 proof (unfold continuous_on_iff, safe) |
|
7452 fix x e :: real |
|
7453 assume as: "x \<in> {a .. b}" "e > 0" |
|
7454 let ?thesis = "\<exists>d>0. \<forall>x'\<in>{a .. b}. dist x' x < d \<longrightarrow> dist (integral {a .. x'} f) (integral {a .. x} f) < e" |
|
7455 { |
|
7456 presume *: "a < b \<Longrightarrow> ?thesis" |
|
7457 show ?thesis |
|
7458 apply cases |
|
7459 apply (rule *) |
|
7460 apply assumption |
|
7461 proof goal_cases |
|
7462 case 1 |
|
7463 then have "cbox a b = {x}" |
|
7464 using as(1) |
|
7465 apply - |
|
7466 apply (rule set_eqI) |
|
7467 apply auto |
|
7468 done |
|
7469 then show ?case using \<open>e > 0\<close> by auto |
|
7470 qed |
|
7471 } |
|
7472 assume "a < b" |
|
7473 have "(x = a \<or> x = b) \<or> (a < x \<and> x < b)" |
|
7474 using as(1) by auto |
|
7475 then show ?thesis |
|
7476 apply (elim disjE) |
|
7477 proof - |
|
7478 assume "x = a" |
|
7479 have "a \<le> a" .. |
|
7480 from indefinite_integral_continuous_right[OF assms(1) this \<open>a<b\<close> \<open>e>0\<close>] guess d . note d=this |
|
7481 show ?thesis |
|
7482 apply rule |
|
7483 apply rule |
|
7484 apply (rule d) |
|
7485 apply safe |
|
7486 apply (subst dist_commute) |
|
7487 unfolding \<open>x = a\<close> dist_norm |
|
7488 apply (rule d(2)[rule_format]) |
|
7489 apply auto |
|
7490 done |
|
7491 next |
|
7492 assume "x = b" |
|
7493 have "b \<le> b" .. |
|
7494 from indefinite_integral_continuous_left[OF assms(1) \<open>a<b\<close> this \<open>e>0\<close>] guess d . note d=this |
|
7495 show ?thesis |
|
7496 apply rule |
|
7497 apply rule |
|
7498 apply (rule d) |
|
7499 apply safe |
|
7500 apply (subst dist_commute) |
|
7501 unfolding \<open>x = b\<close> dist_norm |
|
7502 apply (rule d(2)[rule_format]) |
|
7503 apply auto |
|
7504 done |
|
7505 next |
|
7506 assume "a < x \<and> x < b" |
|
7507 then have xl: "a < x" "x \<le> b" and xr: "a \<le> x" "x < b" |
|
7508 by auto |
|
7509 from indefinite_integral_continuous_left [OF assms(1) xl \<open>e>0\<close>] guess d1 . note d1=this |
|
7510 from indefinite_integral_continuous_right[OF assms(1) xr \<open>e>0\<close>] guess d2 . note d2=this |
|
7511 show ?thesis |
|
7512 apply (rule_tac x="min d1 d2" in exI) |
|
7513 proof safe |
|
7514 show "0 < min d1 d2" |
|
7515 using d1 d2 by auto |
|
7516 fix y |
|
7517 assume "y \<in> {a .. b}" and "dist y x < min d1 d2" |
|
7518 then show "dist (integral {a .. y} f) (integral {a .. x} f) < e" |
|
7519 apply (subst dist_commute) |
|
7520 apply (cases "y < x") |
|
7521 unfolding dist_norm |
|
7522 apply (rule d1(2)[rule_format]) |
|
7523 defer |
|
7524 apply (rule d2(2)[rule_format]) |
|
7525 unfolding not_less |
|
7526 apply (auto simp add: field_simps) |
|
7527 done |
|
7528 qed |
|
7529 qed |
|
7530 qed |
|
7531 |
|
7532 |
|
7533 subsection \<open>This doesn't directly involve integration, but that gives an easy proof.\<close> |
|
7534 |
|
7535 lemma has_derivative_zero_unique_strong_interval: |
|
7536 fixes f :: "real \<Rightarrow> 'a::banach" |
|
7537 assumes "finite k" |
|
7538 and "continuous_on {a .. b} f" |
|
7539 and "f a = y" |
|
7540 and "\<forall>x\<in>({a .. b} - k). (f has_derivative (\<lambda>h. 0)) (at x within {a .. b})" "x \<in> {a .. b}" |
|
7541 shows "f x = y" |
|
7542 proof - |
|
7543 have ab: "a \<le> b" |
|
7544 using assms by auto |
|
7545 have *: "a \<le> x" |
|
7546 using assms(5) by auto |
|
7547 have "((\<lambda>x. 0::'a) has_integral f x - f a) {a .. x}" |
|
7548 apply (rule fundamental_theorem_of_calculus_interior_strong[OF assms(1) *]) |
|
7549 apply (rule continuous_on_subset[OF assms(2)]) |
|
7550 defer |
|
7551 apply safe |
|
7552 unfolding has_vector_derivative_def |
|
7553 apply (subst has_derivative_within_open[symmetric]) |
|
7554 apply assumption |
|
7555 apply (rule open_greaterThanLessThan) |
|
7556 apply (rule has_derivative_within_subset[where s="{a .. b}"]) |
|
7557 using assms(4) assms(5) |
|
7558 apply (auto simp: mem_box) |
|
7559 done |
|
7560 note this[unfolded *] |
|
7561 note has_integral_unique[OF has_integral_0 this] |
|
7562 then show ?thesis |
|
7563 unfolding assms by auto |
|
7564 qed |
|
7565 |
|
7566 |
|
7567 subsection \<open>Generalize a bit to any convex set.\<close> |
|
7568 |
|
7569 lemma has_derivative_zero_unique_strong_convex: |
|
7570 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
|
7571 assumes "convex s" |
|
7572 and "finite k" |
|
7573 and "continuous_on s f" |
|
7574 and "c \<in> s" |
|
7575 and "f c = y" |
|
7576 and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)" |
|
7577 and "x \<in> s" |
|
7578 shows "f x = y" |
|
7579 proof - |
|
7580 { |
|
7581 presume *: "x \<noteq> c \<Longrightarrow> ?thesis" |
|
7582 show ?thesis |
|
7583 apply cases |
|
7584 apply (rule *) |
|
7585 apply assumption |
|
7586 unfolding assms(5)[symmetric] |
|
7587 apply auto |
|
7588 done |
|
7589 } |
|
7590 assume "x \<noteq> c" |
|
7591 note conv = assms(1)[unfolded convex_alt,rule_format] |
|
7592 have as1: "continuous_on {0 ..1} (f \<circ> (\<lambda>t. (1 - t) *\<^sub>R c + t *\<^sub>R x))" |
|
7593 apply (rule continuous_intros)+ |
|
7594 apply (rule continuous_on_subset[OF assms(3)]) |
|
7595 apply safe |
|
7596 apply (rule conv) |
|
7597 using assms(4,7) |
|
7598 apply auto |
|
7599 done |
|
7600 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 |
|
7601 proof - |
|
7602 from that have "(t - xa) *\<^sub>R x = (t - xa) *\<^sub>R c" |
|
7603 unfolding scaleR_simps by (auto simp add: algebra_simps) |
|
7604 then show ?thesis |
|
7605 using \<open>x \<noteq> c\<close> by auto |
|
7606 qed |
|
7607 have as2: "finite {t. ((1 - t) *\<^sub>R c + t *\<^sub>R x) \<in> k}" |
|
7608 using assms(2) |
|
7609 apply (rule finite_surj[where f="\<lambda>z. SOME t. (1-t) *\<^sub>R c + t *\<^sub>R x = z"]) |
|
7610 apply safe |
|
7611 unfolding image_iff |
|
7612 apply rule |
|
7613 defer |
|
7614 apply assumption |
|
7615 apply (rule sym) |
|
7616 apply (rule some_equality) |
|
7617 defer |
|
7618 apply (drule *) |
|
7619 apply auto |
|
7620 done |
|
7621 have "(f \<circ> (\<lambda>t. (1 - t) *\<^sub>R c + t *\<^sub>R x)) 1 = y" |
|
7622 apply (rule has_derivative_zero_unique_strong_interval[OF as2 as1, of ]) |
|
7623 unfolding o_def |
|
7624 using assms(5) |
|
7625 defer |
|
7626 apply - |
|
7627 apply rule |
|
7628 proof - |
|
7629 fix t |
|
7630 assume as: "t \<in> {0 .. 1} - {t. (1 - t) *\<^sub>R c + t *\<^sub>R x \<in> k}" |
|
7631 have *: "c - t *\<^sub>R c + t *\<^sub>R x \<in> s - k" |
|
7632 apply safe |
|
7633 apply (rule conv[unfolded scaleR_simps]) |
|
7634 using \<open>x \<in> s\<close> \<open>c \<in> s\<close> as |
|
7635 by (auto simp add: algebra_simps) |
|
7636 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)) |
|
7637 (at t within {0 .. 1})" |
|
7638 apply (intro derivative_eq_intros) |
|
7639 apply simp_all |
|
7640 apply (simp add: field_simps) |
|
7641 unfolding scaleR_simps |
|
7642 apply (rule has_derivative_within_subset,rule assms(6)[rule_format]) |
|
7643 apply (rule *) |
|
7644 apply safe |
|
7645 apply (rule conv[unfolded scaleR_simps]) |
|
7646 using \<open>x \<in> s\<close> \<open>c \<in> s\<close> |
|
7647 apply auto |
|
7648 done |
|
7649 then show "((\<lambda>xa. f ((1 - xa) *\<^sub>R c + xa *\<^sub>R x)) has_derivative (\<lambda>h. 0)) (at t within {0 .. 1})" |
|
7650 unfolding o_def . |
|
7651 qed auto |
|
7652 then show ?thesis |
|
7653 by auto |
|
7654 qed |
|
7655 |
|
7656 |
|
7657 text \<open>Also to any open connected set with finite set of exceptions. Could |
|
7658 generalize to locally convex set with limpt-free set of exceptions.\<close> |
|
7659 |
|
7660 lemma has_derivative_zero_unique_strong_connected: |
|
7661 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
|
7662 assumes "connected s" |
|
7663 and "open s" |
|
7664 and "finite k" |
|
7665 and "continuous_on s f" |
|
7666 and "c \<in> s" |
|
7667 and "f c = y" |
|
7668 and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)" |
|
7669 and "x\<in>s" |
|
7670 shows "f x = y" |
|
7671 proof - |
|
7672 have "{x \<in> s. f x \<in> {y}} = {} \<or> {x \<in> s. f x \<in> {y}} = s" |
|
7673 apply (rule assms(1)[unfolded connected_clopen,rule_format]) |
|
7674 apply rule |
|
7675 defer |
|
7676 apply (rule continuous_closedin_preimage[OF assms(4) closed_singleton]) |
|
7677 apply (rule open_openin_trans[OF assms(2)]) |
|
7678 unfolding open_contains_ball |
|
7679 proof safe |
|
7680 fix x |
|
7681 assume "x \<in> s" |
|
7682 from assms(2)[unfolded open_contains_ball,rule_format,OF this] guess e .. note e=conjunctD2[OF this] |
|
7683 show "\<exists>e>0. ball x e \<subseteq> {xa \<in> s. f xa \<in> {f x}}" |
|
7684 apply rule |
|
7685 apply rule |
|
7686 apply (rule e) |
|
7687 proof safe |
|
7688 fix y |
|
7689 assume y: "y \<in> ball x e" |
|
7690 then show "y \<in> s" |
|
7691 using e by auto |
|
7692 show "f y = f x" |
|
7693 apply (rule has_derivative_zero_unique_strong_convex[OF convex_ball]) |
|
7694 apply (rule assms) |
|
7695 apply (rule continuous_on_subset) |
|
7696 apply (rule assms) |
|
7697 apply (rule e)+ |
|
7698 apply (subst centre_in_ball) |
|
7699 apply (rule e) |
|
7700 apply rule |
|
7701 apply safe |
|
7702 apply (rule has_derivative_within_subset) |
|
7703 apply (rule assms(7)[rule_format]) |
|
7704 using y e |
|
7705 apply auto |
|
7706 done |
|
7707 qed |
|
7708 qed |
|
7709 then show ?thesis |
|
7710 using \<open>x \<in> s\<close> \<open>f c = y\<close> \<open>c \<in> s\<close> by auto |
|
7711 qed |
|
7712 |
|
7713 lemma has_derivative_zero_connected_constant: |
|
7714 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
|
7715 assumes "connected s" |
|
7716 and "open s" |
|
7717 and "finite k" |
|
7718 and "continuous_on s f" |
|
7719 and "\<forall>x\<in>(s - k). (f has_derivative (\<lambda>h. 0)) (at x within s)" |
|
7720 obtains c where "\<And>x. x \<in> s \<Longrightarrow> f(x) = c" |
|
7721 proof (cases "s = {}") |
|
7722 case True |
|
7723 then show ?thesis |
|
7724 by (metis empty_iff that) |
|
7725 next |
|
7726 case False |
|
7727 then obtain c where "c \<in> s" |
|
7728 by (metis equals0I) |
|
7729 then show ?thesis |
|
7730 by (metis has_derivative_zero_unique_strong_connected assms that) |
|
7731 qed |
|
7732 |
|
7733 |
|
7734 subsection \<open>Integrating characteristic function of an interval\<close> |
|
7735 |
|
7736 lemma has_integral_restrict_open_subinterval: |
|
7737 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
|
7738 assumes "(f has_integral i) (cbox c d)" |
|
7739 and "cbox c d \<subseteq> cbox a b" |
|
7740 shows "((\<lambda>x. if x \<in> box c d then f x else 0) has_integral i) (cbox a b)" |
|
7741 proof - |
|
7742 define g where [abs_def]: "g x = (if x \<in>box c d then f x else 0)" for x |
|
7743 { |
|
7744 presume *: "cbox c d \<noteq> {} \<Longrightarrow> ?thesis" |
|
7745 show ?thesis |
|
7746 apply cases |
|
7747 apply (rule *) |
|
7748 apply assumption |
|
7749 proof goal_cases |
|
7750 case prems: 1 |
|
7751 then have *: "box c d = {}" |
|
7752 by (metis bot.extremum_uniqueI box_subset_cbox) |
|
7753 show ?thesis |
|
7754 using assms(1) |
|
7755 unfolding * |
|
7756 using prems |
|
7757 by auto |
|
7758 qed |
|
7759 } |
|
7760 assume "cbox c d \<noteq> {}" |
|
7761 from partial_division_extend_1[OF assms(2) this] guess p . note p=this |
|
7762 note operat = comm_monoid_set.operative_division[OF add.comm_monoid_set_lift_option operative_integral p(1), symmetric] |
|
7763 let ?P = "(if g integrable_on cbox a b then Some (integral (cbox a b) g) else None) = Some i" |
|
7764 { |
|
7765 presume "?P" |
|
7766 then have "g integrable_on cbox a b \<and> integral (cbox a b) g = i" |
|
7767 apply - |
|
7768 apply cases |
|
7769 apply (subst(asm) if_P) |
|
7770 apply assumption |
|
7771 apply auto |
|
7772 done |
|
7773 then show ?thesis |
|
7774 using integrable_integral |
|
7775 unfolding g_def |
|
7776 by auto |
|
7777 } |
|
7778 let ?F = "comm_monoid_set.F (lift_option op +) (Some 0)" |
|
7779 have iterate:"?F (\<lambda>i. if g integrable_on i then Some (integral i g) else None) (p - {cbox c d}) = Some 0" |
|
7780 proof (intro comm_monoid_set.neutral[OF add.comm_monoid_set_lift_option] ballI) |
|
7781 fix x |
|
7782 assume x: "x \<in> p - {cbox c d}" |
|
7783 then have "x \<in> p" |
|
7784 by auto |
|
7785 note div = division_ofD(2-5)[OF p(1) this] |
|
7786 from div(3) guess u v by (elim exE) note uv=this |
|
7787 have "interior x \<inter> interior (cbox c d) = {}" |
|
7788 using div(4)[OF p(2)] x by auto |
|
7789 then have "(g has_integral 0) x" |
|
7790 unfolding uv |
|
7791 apply - |
|
7792 apply (rule has_integral_spike_interior[where f="\<lambda>x. 0"]) |
|
7793 unfolding g_def interior_cbox |
|
7794 apply auto |
|
7795 done |
|
7796 then show "(if g integrable_on x then Some (integral x g) else None) = Some 0" |
|
7797 by auto |
|
7798 qed |
|
7799 |
|
7800 have *: "p = insert (cbox c d) (p - {cbox c d})" |
|
7801 using p by auto |
|
7802 have **: "g integrable_on cbox c d" |
|
7803 apply (rule integrable_spike_interior[where f=f]) |
|
7804 unfolding g_def using assms(1) |
|
7805 apply auto |
|
7806 done |
|
7807 moreover |
|
7808 have "integral (cbox c d) g = i" |
|
7809 apply (rule has_integral_unique[OF _ assms(1)]) |
|
7810 apply (rule has_integral_spike_interior[where f=g]) |
|
7811 defer |
|
7812 apply (rule integrable_integral[OF **]) |
|
7813 unfolding g_def |
|
7814 apply auto |
|
7815 done |
|
7816 ultimately show ?P |
|
7817 unfolding operat |
|
7818 using p |
|
7819 apply (subst *) |
|
7820 apply (subst comm_monoid_set.insert[OF add.comm_monoid_set_lift_option]) |
|
7821 apply (simp_all add: division_of_finite iterate) |
|
7822 done |
|
7823 qed |
|
7824 |
|
7825 lemma has_integral_restrict_closed_subinterval: |
|
7826 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
|
7827 assumes "(f has_integral i) (cbox c d)" |
|
7828 and "cbox c d \<subseteq> cbox a b" |
|
7829 shows "((\<lambda>x. if x \<in> cbox c d then f x else 0) has_integral i) (cbox a b)" |
|
7830 proof - |
|
7831 note has_integral_restrict_open_subinterval[OF assms] |
|
7832 note * = has_integral_spike[OF negligible_frontier_interval _ this] |
|
7833 show ?thesis |
|
7834 apply (rule *[of c d]) |
|
7835 using box_subset_cbox[of c d] |
|
7836 apply auto |
|
7837 done |
|
7838 qed |
|
7839 |
|
7840 lemma has_integral_restrict_closed_subintervals_eq: |
|
7841 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
|
7842 assumes "cbox c d \<subseteq> cbox a b" |
|
7843 shows "((\<lambda>x. if x \<in> cbox c d then f x else 0) has_integral i) (cbox a b) \<longleftrightarrow> (f has_integral i) (cbox c d)" |
|
7844 (is "?l = ?r") |
|
7845 proof (cases "cbox c d = {}") |
|
7846 case False |
|
7847 let ?g = "\<lambda>x. if x \<in> cbox c d then f x else 0" |
|
7848 show ?thesis |
|
7849 apply rule |
|
7850 defer |
|
7851 apply (rule has_integral_restrict_closed_subinterval[OF _ assms]) |
|
7852 apply assumption |
|
7853 proof - |
|
7854 assume ?l |
|
7855 then have "?g integrable_on cbox c d" |
|
7856 using assms has_integral_integrable integrable_subinterval by blast |
|
7857 then have *: "f integrable_on cbox c d" |
|
7858 apply - |
|
7859 apply (rule integrable_eq) |
|
7860 apply auto |
|
7861 done |
|
7862 then have "i = integral (cbox c d) f" |
|
7863 apply - |
|
7864 apply (rule has_integral_unique) |
|
7865 apply (rule \<open>?l\<close>) |
|
7866 apply (rule has_integral_restrict_closed_subinterval[OF _ assms]) |
|
7867 apply auto |
|
7868 done |
|
7869 then show ?r |
|
7870 using * by auto |
|
7871 qed |
|
7872 qed auto |
|
7873 |
|
7874 |
|
7875 text \<open>Hence we can apply the limit process uniformly to all integrals.\<close> |
|
7876 |
|
7877 lemma has_integral': |
|
7878 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
7879 shows "(f has_integral i) s \<longleftrightarrow> |
|
7880 (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> |
|
7881 (\<exists>z. ((\<lambda>x. if x \<in> s then f(x) else 0) has_integral z) (cbox a b) \<and> norm(z - i) < e))" |
|
7882 (is "?l \<longleftrightarrow> (\<forall>e>0. ?r e)") |
|
7883 proof - |
|
7884 { |
|
7885 presume *: "\<exists>a b. s = cbox a b \<Longrightarrow> ?thesis" |
|
7886 show ?thesis |
|
7887 apply cases |
|
7888 apply (rule *) |
|
7889 apply assumption |
|
7890 apply (subst has_integral_alt) |
|
7891 apply auto |
|
7892 done |
|
7893 } |
|
7894 assume "\<exists>a b. s = cbox a b" |
|
7895 then guess a b by (elim exE) note s=this |
|
7896 from bounded_cbox[of a b, unfolded bounded_pos] guess B .. |
|
7897 note B = conjunctD2[OF this,rule_format] show ?thesis |
|
7898 apply safe |
|
7899 proof - |
|
7900 fix e :: real |
|
7901 assume ?l and "e > 0" |
|
7902 show "?r e" |
|
7903 apply (rule_tac x="B+1" in exI) |
|
7904 apply safe |
|
7905 defer |
|
7906 apply (rule_tac x=i in exI) |
|
7907 proof |
|
7908 fix c d :: 'n |
|
7909 assume as: "ball 0 (B+1) \<subseteq> cbox c d" |
|
7910 then show "((\<lambda>x. if x \<in> s then f x else 0) has_integral i) (cbox c d)" |
|
7911 unfolding s |
|
7912 apply - |
|
7913 apply (rule has_integral_restrict_closed_subinterval) |
|
7914 apply (rule \<open>?l\<close>[unfolded s]) |
|
7915 apply safe |
|
7916 apply (drule B(2)[rule_format]) |
|
7917 unfolding subset_eq |
|
7918 apply (erule_tac x=x in ballE) |
|
7919 apply (auto simp add: dist_norm) |
|
7920 done |
|
7921 qed (insert B \<open>e>0\<close>, auto) |
|
7922 next |
|
7923 assume as: "\<forall>e>0. ?r e" |
|
7924 from this[rule_format,OF zero_less_one] guess C .. note C=conjunctD2[OF this,rule_format] |
|
7925 define c :: 'n where "c = (\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)" |
|
7926 define d :: 'n where "d = (\<Sum>i\<in>Basis. max B C *\<^sub>R i)" |
|
7927 have c_d: "cbox a b \<subseteq> cbox c d" |
|
7928 apply safe |
|
7929 apply (drule B(2)) |
|
7930 unfolding mem_box |
|
7931 proof |
|
7932 fix x i |
|
7933 show "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i" if "norm x \<le> B" and "i \<in> Basis" |
|
7934 using that and Basis_le_norm[OF \<open>i\<in>Basis\<close>, of x] |
|
7935 unfolding c_def d_def |
|
7936 by (auto simp add: field_simps setsum_negf) |
|
7937 qed |
|
7938 have "ball 0 C \<subseteq> cbox c d" |
|
7939 apply (rule subsetI) |
|
7940 unfolding mem_box mem_ball dist_norm |
|
7941 proof |
|
7942 fix x i :: 'n |
|
7943 assume x: "norm (0 - x) < C" and i: "i \<in> Basis" |
|
7944 show "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i" |
|
7945 using Basis_le_norm[OF i, of x] and x i |
|
7946 unfolding c_def d_def |
|
7947 by (auto simp: setsum_negf) |
|
7948 qed |
|
7949 from C(2)[OF this] have "\<exists>y. (f has_integral y) (cbox a b)" |
|
7950 unfolding has_integral_restrict_closed_subintervals_eq[OF c_d,symmetric] |
|
7951 unfolding s |
|
7952 by auto |
|
7953 then guess y .. note y=this |
|
7954 |
|
7955 have "y = i" |
|
7956 proof (rule ccontr) |
|
7957 assume "\<not> ?thesis" |
|
7958 then have "0 < norm (y - i)" |
|
7959 by auto |
|
7960 from as[rule_format,OF this] guess C .. note C=conjunctD2[OF this,rule_format] |
|
7961 define c :: 'n where "c = (\<Sum>i\<in>Basis. (- max B C) *\<^sub>R i)" |
|
7962 define d :: 'n where "d = (\<Sum>i\<in>Basis. max B C *\<^sub>R i)" |
|
7963 have c_d: "cbox a b \<subseteq> cbox c d" |
|
7964 apply safe |
|
7965 apply (drule B(2)) |
|
7966 unfolding mem_box |
|
7967 proof |
|
7968 fix x i :: 'n |
|
7969 assume "norm x \<le> B" and "i \<in> Basis" |
|
7970 then show "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i" |
|
7971 using Basis_le_norm[of i x] |
|
7972 unfolding c_def d_def |
|
7973 by (auto simp add: field_simps setsum_negf) |
|
7974 qed |
|
7975 have "ball 0 C \<subseteq> cbox c d" |
|
7976 apply (rule subsetI) |
|
7977 unfolding mem_box mem_ball dist_norm |
|
7978 proof |
|
7979 fix x i :: 'n |
|
7980 assume "norm (0 - x) < C" and "i \<in> Basis" |
|
7981 then show "c \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> d \<bullet> i" |
|
7982 using Basis_le_norm[of i x] |
|
7983 unfolding c_def d_def |
|
7984 by (auto simp: setsum_negf) |
|
7985 qed |
|
7986 note C(2)[OF this] then guess z .. note z = conjunctD2[OF this, unfolded s] |
|
7987 note this[unfolded has_integral_restrict_closed_subintervals_eq[OF c_d]] |
|
7988 then have "z = y" and "norm (z - i) < norm (y - i)" |
|
7989 apply - |
|
7990 apply (rule has_integral_unique[OF _ y(1)]) |
|
7991 apply assumption |
|
7992 apply assumption |
|
7993 done |
|
7994 then show False |
|
7995 by auto |
|
7996 qed |
|
7997 then show ?l |
|
7998 using y |
|
7999 unfolding s |
|
8000 by auto |
|
8001 qed |
|
8002 qed |
|
8003 |
|
8004 lemma has_integral_le: |
|
8005 fixes f :: "'n::euclidean_space \<Rightarrow> real" |
|
8006 assumes "(f has_integral i) s" |
|
8007 and "(g has_integral j) s" |
|
8008 and "\<forall>x\<in>s. f x \<le> g x" |
|
8009 shows "i \<le> j" |
|
8010 using has_integral_component_le[OF _ assms(1-2), of 1] |
|
8011 using assms(3) |
|
8012 by auto |
|
8013 |
|
8014 lemma integral_le: |
|
8015 fixes f :: "'n::euclidean_space \<Rightarrow> real" |
|
8016 assumes "f integrable_on s" |
|
8017 and "g integrable_on s" |
|
8018 and "\<forall>x\<in>s. f x \<le> g x" |
|
8019 shows "integral s f \<le> integral s g" |
|
8020 by (rule has_integral_le[OF assms(1,2)[unfolded has_integral_integral] assms(3)]) |
|
8021 |
|
8022 lemma has_integral_nonneg: |
|
8023 fixes f :: "'n::euclidean_space \<Rightarrow> real" |
|
8024 assumes "(f has_integral i) s" |
|
8025 and "\<forall>x\<in>s. 0 \<le> f x" |
|
8026 shows "0 \<le> i" |
|
8027 using has_integral_component_nonneg[of 1 f i s] |
|
8028 unfolding o_def |
|
8029 using assms |
|
8030 by auto |
|
8031 |
|
8032 lemma integral_nonneg: |
|
8033 fixes f :: "'n::euclidean_space \<Rightarrow> real" |
|
8034 assumes "f integrable_on s" |
|
8035 and "\<forall>x\<in>s. 0 \<le> f x" |
|
8036 shows "0 \<le> integral s f" |
|
8037 by (rule has_integral_nonneg[OF assms(1)[unfolded has_integral_integral] assms(2)]) |
|
8038 |
|
8039 |
|
8040 text \<open>Hence a general restriction property.\<close> |
|
8041 |
|
8042 lemma has_integral_restrict[simp]: |
|
8043 assumes "s \<subseteq> t" |
|
8044 shows "((\<lambda>x. if x \<in> s then f x else (0::'a::banach)) has_integral i) t \<longleftrightarrow> (f has_integral i) s" |
|
8045 proof - |
|
8046 have *: "\<And>x. (if x \<in> t then if x \<in> s then f x else 0 else 0) = (if x\<in>s then f x else 0)" |
|
8047 using assms by auto |
|
8048 show ?thesis |
|
8049 apply (subst(2) has_integral') |
|
8050 apply (subst has_integral') |
|
8051 unfolding * |
|
8052 apply rule |
|
8053 done |
|
8054 qed |
|
8055 |
|
8056 lemma has_integral_restrict_univ: |
|
8057 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8058 shows "((\<lambda>x. if x \<in> s then f x else 0) has_integral i) UNIV \<longleftrightarrow> (f has_integral i) s" |
|
8059 by auto |
|
8060 |
|
8061 lemma has_integral_on_superset: |
|
8062 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8063 assumes "\<forall>x. x \<notin> s \<longrightarrow> f x = 0" |
|
8064 and "s \<subseteq> t" |
|
8065 and "(f has_integral i) s" |
|
8066 shows "(f has_integral i) t" |
|
8067 proof - |
|
8068 have "(\<lambda>x. if x \<in> s then f x else 0) = (\<lambda>x. if x \<in> t then f x else 0)" |
|
8069 apply rule |
|
8070 using assms(1-2) |
|
8071 apply auto |
|
8072 done |
|
8073 then show ?thesis |
|
8074 using assms(3) |
|
8075 apply (subst has_integral_restrict_univ[symmetric]) |
|
8076 apply (subst(asm) has_integral_restrict_univ[symmetric]) |
|
8077 apply auto |
|
8078 done |
|
8079 qed |
|
8080 |
|
8081 lemma integrable_on_superset: |
|
8082 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8083 assumes "\<forall>x. x \<notin> s \<longrightarrow> f x = 0" |
|
8084 and "s \<subseteq> t" |
|
8085 and "f integrable_on s" |
|
8086 shows "f integrable_on t" |
|
8087 using assms |
|
8088 unfolding integrable_on_def |
|
8089 by (auto intro:has_integral_on_superset) |
|
8090 |
|
8091 lemma integral_restrict_univ[intro]: |
|
8092 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8093 shows "f integrable_on s \<Longrightarrow> integral UNIV (\<lambda>x. if x \<in> s then f x else 0) = integral s f" |
|
8094 apply (rule integral_unique) |
|
8095 unfolding has_integral_restrict_univ |
|
8096 apply auto |
|
8097 done |
|
8098 |
|
8099 lemma integrable_restrict_univ: |
|
8100 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8101 shows "(\<lambda>x. if x \<in> s then f x else 0) integrable_on UNIV \<longleftrightarrow> f integrable_on s" |
|
8102 unfolding integrable_on_def |
|
8103 by auto |
|
8104 |
|
8105 lemma negligible_on_intervals: "negligible s \<longleftrightarrow> (\<forall>a b. negligible(s \<inter> cbox a b))" (is "?l \<longleftrightarrow> ?r") |
|
8106 proof |
|
8107 assume ?r |
|
8108 show ?l |
|
8109 unfolding negligible_def |
|
8110 proof safe |
|
8111 fix a b |
|
8112 show "(indicator s has_integral 0) (cbox a b)" |
|
8113 apply (rule has_integral_negligible[OF \<open>?r\<close>[rule_format,of a b]]) |
|
8114 unfolding indicator_def |
|
8115 apply auto |
|
8116 done |
|
8117 qed |
|
8118 qed auto |
|
8119 |
|
8120 lemma negligible_translation: |
|
8121 assumes "negligible S" |
|
8122 shows "negligible (op + c ` S)" |
|
8123 proof - |
|
8124 have inj: "inj (op + c)" |
|
8125 by simp |
|
8126 show ?thesis |
|
8127 using assms |
|
8128 proof (clarsimp simp: negligible_def) |
|
8129 fix a b |
|
8130 assume "\<forall>x y. (indicator S has_integral 0) (cbox x y)" |
|
8131 then have *: "(indicator S has_integral 0) (cbox (a-c) (b-c))" |
|
8132 by (meson Diff_iff assms has_integral_negligible indicator_simps(2)) |
|
8133 have eq: "indicator (op + c ` S) = (\<lambda>x. indicator S (x - c))" |
|
8134 by (force simp add: indicator_def) |
|
8135 show "(indicator (op + c ` S) has_integral 0) (cbox a b)" |
|
8136 using has_integral_affinity [OF *, of 1 "-c"] |
|
8137 cbox_translation [of "c" "-c+a" "-c+b"] |
|
8138 by (simp add: eq add.commute) |
|
8139 qed |
|
8140 qed |
|
8141 |
|
8142 lemma negligible_translation_rev: |
|
8143 assumes "negligible (op + c ` S)" |
|
8144 shows "negligible S" |
|
8145 by (metis negligible_translation [OF assms, of "-c"] translation_galois) |
|
8146 |
|
8147 lemma has_integral_spike_set_eq: |
|
8148 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8149 assumes "negligible ((s - t) \<union> (t - s))" |
|
8150 shows "(f has_integral y) s \<longleftrightarrow> (f has_integral y) t" |
|
8151 unfolding has_integral_restrict_univ[symmetric,of f] |
|
8152 apply (rule has_integral_spike_eq[OF assms]) |
|
8153 by (auto split: if_split_asm) |
|
8154 |
|
8155 lemma has_integral_spike_set[dest]: |
|
8156 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8157 assumes "negligible ((s - t) \<union> (t - s))" |
|
8158 and "(f has_integral y) s" |
|
8159 shows "(f has_integral y) t" |
|
8160 using assms has_integral_spike_set_eq |
|
8161 by auto |
|
8162 |
|
8163 lemma integrable_spike_set[dest]: |
|
8164 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8165 assumes "negligible ((s - t) \<union> (t - s))" |
|
8166 and "f integrable_on s" |
|
8167 shows "f integrable_on t" |
|
8168 using assms(2) |
|
8169 unfolding integrable_on_def |
|
8170 unfolding has_integral_spike_set_eq[OF assms(1)] . |
|
8171 |
|
8172 lemma integrable_spike_set_eq: |
|
8173 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8174 assumes "negligible ((s - t) \<union> (t - s))" |
|
8175 shows "f integrable_on s \<longleftrightarrow> f integrable_on t" |
|
8176 apply rule |
|
8177 apply (rule_tac[!] integrable_spike_set) |
|
8178 using assms |
|
8179 apply auto |
|
8180 done |
|
8181 |
|
8182 (*lemma integral_spike_set: |
|
8183 "\<forall>f:real^M->real^N g s t. |
|
8184 negligible(s DIFF t \<union> t DIFF s) |
|
8185 \<longrightarrow> integral s f = integral t f" |
|
8186 qed REPEAT STRIP_TAC THEN REWRITE_TAC[integral] THEN |
|
8187 AP_TERM_TAC THEN ABS_TAC THEN MATCH_MP_TAC HAS_INTEGRAL_SPIKE_SET_EQ THEN |
|
8188 ASM_MESON_TAC[]);; |
|
8189 |
|
8190 lemma has_integral_interior: |
|
8191 "\<forall>f:real^M->real^N y s. |
|
8192 negligible(frontier s) |
|
8193 \<longrightarrow> ((f has_integral y) (interior s) \<longleftrightarrow> (f has_integral y) s)" |
|
8194 qed REPEAT STRIP_TAC THEN MATCH_MP_TAC HAS_INTEGRAL_SPIKE_SET_EQ THEN |
|
8195 FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ] |
|
8196 NEGLIGIBLE_SUBSET)) THEN |
|
8197 REWRITE_TAC[frontier] THEN |
|
8198 MP_TAC(ISPEC `s:real^M->bool` INTERIOR_SUBSET) THEN |
|
8199 MP_TAC(ISPEC `s:real^M->bool` CLOSURE_SUBSET) THEN |
|
8200 SET_TAC[]);; |
|
8201 |
|
8202 lemma has_integral_closure: |
|
8203 "\<forall>f:real^M->real^N y s. |
|
8204 negligible(frontier s) |
|
8205 \<longrightarrow> ((f has_integral y) (closure s) \<longleftrightarrow> (f has_integral y) s)" |
|
8206 qed REPEAT STRIP_TAC THEN MATCH_MP_TAC HAS_INTEGRAL_SPIKE_SET_EQ THEN |
|
8207 FIRST_X_ASSUM(MATCH_MP_TAC o MATCH_MP (REWRITE_RULE[IMP_CONJ] |
|
8208 NEGLIGIBLE_SUBSET)) THEN |
|
8209 REWRITE_TAC[frontier] THEN |
|
8210 MP_TAC(ISPEC `s:real^M->bool` INTERIOR_SUBSET) THEN |
|
8211 MP_TAC(ISPEC `s:real^M->bool` CLOSURE_SUBSET) THEN |
|
8212 SET_TAC[]);;*) |
|
8213 |
|
8214 |
|
8215 subsection \<open>More lemmas that are useful later\<close> |
|
8216 |
|
8217 lemma has_integral_subset_component_le: |
|
8218 fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
8219 assumes k: "k \<in> Basis" |
|
8220 and as: "s \<subseteq> t" "(f has_integral i) s" "(f has_integral j) t" "\<forall>x\<in>t. 0 \<le> f(x)\<bullet>k" |
|
8221 shows "i\<bullet>k \<le> j\<bullet>k" |
|
8222 proof - |
|
8223 note has_integral_restrict_univ[symmetric, of f] |
|
8224 note as(2-3)[unfolded this] note * = has_integral_component_le[OF k this] |
|
8225 show ?thesis |
|
8226 apply (rule *) |
|
8227 using as(1,4) |
|
8228 apply auto |
|
8229 done |
|
8230 qed |
|
8231 |
|
8232 lemma has_integral_subset_le: |
|
8233 fixes f :: "'n::euclidean_space \<Rightarrow> real" |
|
8234 assumes "s \<subseteq> t" |
|
8235 and "(f has_integral i) s" |
|
8236 and "(f has_integral j) t" |
|
8237 and "\<forall>x\<in>t. 0 \<le> f x" |
|
8238 shows "i \<le> j" |
|
8239 using has_integral_subset_component_le[OF _ assms(1), of 1 f i j] |
|
8240 using assms |
|
8241 by auto |
|
8242 |
|
8243 lemma integral_subset_component_le: |
|
8244 fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
8245 assumes "k \<in> Basis" |
|
8246 and "s \<subseteq> t" |
|
8247 and "f integrable_on s" |
|
8248 and "f integrable_on t" |
|
8249 and "\<forall>x \<in> t. 0 \<le> f x \<bullet> k" |
|
8250 shows "(integral s f)\<bullet>k \<le> (integral t f)\<bullet>k" |
|
8251 apply (rule has_integral_subset_component_le) |
|
8252 using assms |
|
8253 apply auto |
|
8254 done |
|
8255 |
|
8256 lemma integral_subset_le: |
|
8257 fixes f :: "'n::euclidean_space \<Rightarrow> real" |
|
8258 assumes "s \<subseteq> t" |
|
8259 and "f integrable_on s" |
|
8260 and "f integrable_on t" |
|
8261 and "\<forall>x \<in> t. 0 \<le> f x" |
|
8262 shows "integral s f \<le> integral t f" |
|
8263 apply (rule has_integral_subset_le) |
|
8264 using assms |
|
8265 apply auto |
|
8266 done |
|
8267 |
|
8268 lemma has_integral_alt': |
|
8269 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8270 shows "(f has_integral i) s \<longleftrightarrow> (\<forall>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on cbox a b) \<and> |
|
8271 (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> |
|
8272 norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - i) < e)" |
|
8273 (is "?l = ?r") |
|
8274 proof |
|
8275 assume ?r |
|
8276 show ?l |
|
8277 apply (subst has_integral') |
|
8278 apply safe |
|
8279 proof goal_cases |
|
8280 case (1 e) |
|
8281 from \<open>?r\<close>[THEN conjunct2,rule_format,OF this] guess B .. note B=conjunctD2[OF this] |
|
8282 show ?case |
|
8283 apply rule |
|
8284 apply rule |
|
8285 apply (rule B) |
|
8286 apply safe |
|
8287 apply (rule_tac x="integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0)" in exI) |
|
8288 apply (drule B(2)[rule_format]) |
|
8289 using integrable_integral[OF \<open>?r\<close>[THEN conjunct1,rule_format]] |
|
8290 apply auto |
|
8291 done |
|
8292 qed |
|
8293 next |
|
8294 assume ?l note as = this[unfolded has_integral'[of f],rule_format] |
|
8295 let ?f = "\<lambda>x. if x \<in> s then f x else 0" |
|
8296 show ?r |
|
8297 proof safe |
|
8298 fix a b :: 'n |
|
8299 from as[OF zero_less_one] guess B .. note B=conjunctD2[OF this,rule_format] |
|
8300 let ?a = "\<Sum>i\<in>Basis. min (a\<bullet>i) (-B) *\<^sub>R i::'n" |
|
8301 let ?b = "\<Sum>i\<in>Basis. max (b\<bullet>i) B *\<^sub>R i::'n" |
|
8302 show "?f integrable_on cbox a b" |
|
8303 proof (rule integrable_subinterval[of _ ?a ?b]) |
|
8304 have "ball 0 B \<subseteq> cbox ?a ?b" |
|
8305 apply (rule subsetI) |
|
8306 unfolding mem_ball mem_box dist_norm |
|
8307 proof (rule, goal_cases) |
|
8308 case (1 x i) |
|
8309 then show ?case using Basis_le_norm[of i x] |
|
8310 by (auto simp add:field_simps) |
|
8311 qed |
|
8312 from B(2)[OF this] guess z .. note conjunct1[OF this] |
|
8313 then show "?f integrable_on cbox ?a ?b" |
|
8314 unfolding integrable_on_def by auto |
|
8315 show "cbox a b \<subseteq> cbox ?a ?b" |
|
8316 apply safe |
|
8317 unfolding mem_box |
|
8318 apply rule |
|
8319 apply (erule_tac x=i in ballE) |
|
8320 apply auto |
|
8321 done |
|
8322 qed |
|
8323 |
|
8324 fix e :: real |
|
8325 assume "e > 0" |
|
8326 from as[OF this] guess B .. note B=conjunctD2[OF this,rule_format] |
|
8327 show "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> |
|
8328 norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - i) < e" |
|
8329 apply rule |
|
8330 apply rule |
|
8331 apply (rule B) |
|
8332 apply safe |
|
8333 proof goal_cases |
|
8334 case 1 |
|
8335 from B(2)[OF this] guess z .. note z=conjunctD2[OF this] |
|
8336 from integral_unique[OF this(1)] show ?case |
|
8337 using z(2) by auto |
|
8338 qed |
|
8339 qed |
|
8340 qed |
|
8341 |
|
8342 |
|
8343 subsection \<open>Continuity of the integral (for a 1-dimensional interval).\<close> |
|
8344 |
|
8345 lemma integrable_alt: |
|
8346 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8347 shows "f integrable_on s \<longleftrightarrow> |
|
8348 (\<forall>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on cbox a b) \<and> |
|
8349 (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d \<longrightarrow> |
|
8350 norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - |
|
8351 integral (cbox c d) (\<lambda>x. if x \<in> s then f x else 0)) < e)" |
|
8352 (is "?l = ?r") |
|
8353 proof |
|
8354 assume ?l |
|
8355 then guess y unfolding integrable_on_def .. note this[unfolded has_integral_alt'[of f]] |
|
8356 note y=conjunctD2[OF this,rule_format] |
|
8357 show ?r |
|
8358 apply safe |
|
8359 apply (rule y) |
|
8360 proof goal_cases |
|
8361 case (1 e) |
|
8362 then have "e/2 > 0" |
|
8363 by auto |
|
8364 from y(2)[OF this] guess B .. note B=conjunctD2[OF this,rule_format] |
|
8365 show ?case |
|
8366 apply rule |
|
8367 apply rule |
|
8368 apply (rule B) |
|
8369 apply safe |
|
8370 proof goal_cases |
|
8371 case prems: (1 a b c d) |
|
8372 show ?case |
|
8373 apply (rule norm_triangle_half_l) |
|
8374 using B(2)[OF prems(1)] B(2)[OF prems(2)] |
|
8375 apply auto |
|
8376 done |
|
8377 qed |
|
8378 qed |
|
8379 next |
|
8380 assume ?r |
|
8381 note as = conjunctD2[OF this,rule_format] |
|
8382 let ?cube = "\<lambda>n. cbox (\<Sum>i\<in>Basis. - real n *\<^sub>R i::'n) (\<Sum>i\<in>Basis. real n *\<^sub>R i)" |
|
8383 have "Cauchy (\<lambda>n. integral (?cube n) (\<lambda>x. if x \<in> s then f x else 0))" |
|
8384 proof (unfold Cauchy_def, safe, goal_cases) |
|
8385 case (1 e) |
|
8386 from as(2)[OF this] guess B .. note B = conjunctD2[OF this,rule_format] |
|
8387 from real_arch_simple[of B] guess N .. note N = this |
|
8388 { |
|
8389 fix n |
|
8390 assume n: "n \<ge> N" |
|
8391 have "ball 0 B \<subseteq> ?cube n" |
|
8392 apply (rule subsetI) |
|
8393 unfolding mem_ball mem_box dist_norm |
|
8394 proof (rule, goal_cases) |
|
8395 case (1 x i) |
|
8396 then show ?case |
|
8397 using Basis_le_norm[of i x] \<open>i\<in>Basis\<close> |
|
8398 using n N |
|
8399 by (auto simp add: field_simps setsum_negf) |
|
8400 qed |
|
8401 } |
|
8402 then show ?case |
|
8403 apply - |
|
8404 apply (rule_tac x=N in exI) |
|
8405 apply safe |
|
8406 unfolding dist_norm |
|
8407 apply (rule B(2)) |
|
8408 apply auto |
|
8409 done |
|
8410 qed |
|
8411 from this[unfolded convergent_eq_cauchy[symmetric]] guess i .. |
|
8412 note i = this[THEN LIMSEQ_D] |
|
8413 |
|
8414 show ?l unfolding integrable_on_def has_integral_alt'[of f] |
|
8415 apply (rule_tac x=i in exI) |
|
8416 apply safe |
|
8417 apply (rule as(1)[unfolded integrable_on_def]) |
|
8418 proof goal_cases |
|
8419 case (1 e) |
|
8420 then have *: "e/2 > 0" by auto |
|
8421 from i[OF this] guess N .. note N =this[rule_format] |
|
8422 from as(2)[OF *] guess B .. note B=conjunctD2[OF this,rule_format] |
|
8423 let ?B = "max (real N) B" |
|
8424 show ?case |
|
8425 apply (rule_tac x="?B" in exI) |
|
8426 proof safe |
|
8427 show "0 < ?B" |
|
8428 using B(1) by auto |
|
8429 fix a b :: 'n |
|
8430 assume ab: "ball 0 ?B \<subseteq> cbox a b" |
|
8431 from real_arch_simple[of ?B] guess n .. note n=this |
|
8432 show "norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - i) < e" |
|
8433 apply (rule norm_triangle_half_l) |
|
8434 apply (rule B(2)) |
|
8435 defer |
|
8436 apply (subst norm_minus_commute) |
|
8437 apply (rule N[of n]) |
|
8438 proof safe |
|
8439 show "N \<le> n" |
|
8440 using n by auto |
|
8441 fix x :: 'n |
|
8442 assume x: "x \<in> ball 0 B" |
|
8443 then have "x \<in> ball 0 ?B" |
|
8444 by auto |
|
8445 then show "x \<in> cbox a b" |
|
8446 using ab by blast |
|
8447 show "x \<in> ?cube n" |
|
8448 using x |
|
8449 unfolding mem_box mem_ball dist_norm |
|
8450 apply - |
|
8451 proof (rule, goal_cases) |
|
8452 case (1 i) |
|
8453 then show ?case |
|
8454 using Basis_le_norm[of i x] \<open>i \<in> Basis\<close> |
|
8455 using n |
|
8456 by (auto simp add: field_simps setsum_negf) |
|
8457 qed |
|
8458 qed |
|
8459 qed |
|
8460 qed |
|
8461 qed |
|
8462 |
|
8463 lemma integrable_altD: |
|
8464 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8465 assumes "f integrable_on s" |
|
8466 shows "\<And>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on cbox a b" |
|
8467 and "\<And>e. e > 0 \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d \<longrightarrow> |
|
8468 norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - integral (cbox c d) (\<lambda>x. if x \<in> s then f x else 0)) < e" |
|
8469 using assms[unfolded integrable_alt[of f]] by auto |
|
8470 |
|
8471 lemma integrable_on_subcbox: |
|
8472 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8473 assumes "f integrable_on s" |
|
8474 and "cbox a b \<subseteq> s" |
|
8475 shows "f integrable_on cbox a b" |
|
8476 apply (rule integrable_eq) |
|
8477 defer |
|
8478 apply (rule integrable_altD(1)[OF assms(1)]) |
|
8479 using assms(2) |
|
8480 apply auto |
|
8481 done |
|
8482 |
|
8483 |
|
8484 subsection \<open>A straddling criterion for integrability\<close> |
|
8485 |
|
8486 lemma integrable_straddle_interval: |
|
8487 fixes f :: "'n::euclidean_space \<Rightarrow> real" |
|
8488 assumes "\<forall>e>0. \<exists>g h i j. (g has_integral i) (cbox a b) \<and> (h has_integral j) (cbox a b) \<and> |
|
8489 norm (i - j) < e \<and> (\<forall>x\<in>cbox a b. (g x) \<le> f x \<and> f x \<le> h x)" |
|
8490 shows "f integrable_on cbox a b" |
|
8491 proof (subst integrable_cauchy, safe, goal_cases) |
|
8492 case (1 e) |
|
8493 then have e: "e/3 > 0" |
|
8494 by auto |
|
8495 note assms[rule_format,OF this] |
|
8496 then guess g h i j by (elim exE conjE) note obt = this |
|
8497 from obt(1)[unfolded has_integral[of g], rule_format, OF e] guess d1 .. note d1=conjunctD2[OF this,rule_format] |
|
8498 from obt(2)[unfolded has_integral[of h], rule_format, OF e] guess d2 .. note d2=conjunctD2[OF this,rule_format] |
|
8499 show ?case |
|
8500 apply (rule_tac x="\<lambda>x. d1 x \<inter> d2 x" in exI) |
|
8501 apply (rule conjI gauge_inter d1 d2)+ |
|
8502 unfolding fine_inter |
|
8503 proof (safe, goal_cases) |
|
8504 have **: "\<And>i j g1 g2 h1 h2 f1 f2. g1 - h2 \<le> f1 - f2 \<Longrightarrow> f1 - f2 \<le> h1 - g2 \<Longrightarrow> |
|
8505 \<bar>i - j\<bar> < e / 3 \<Longrightarrow> \<bar>g2 - i\<bar> < e / 3 \<Longrightarrow> \<bar>g1 - i\<bar> < e / 3 \<Longrightarrow> |
|
8506 \<bar>h2 - j\<bar> < e / 3 \<Longrightarrow> \<bar>h1 - j\<bar> < e / 3 \<Longrightarrow> \<bar>f1 - f2\<bar> < e" |
|
8507 using \<open>e > 0\<close> by arith |
|
8508 case prems: (1 p1 p2) |
|
8509 note tagged_division_ofD(2-4) note * = this[OF prems(1)] this[OF prems(4)] |
|
8510 |
|
8511 have "(\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p1. content k *\<^sub>R g x) \<ge> 0" |
|
8512 and "0 \<le> (\<Sum>(x, k)\<in>p2. content k *\<^sub>R h x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x)" |
|
8513 and "(\<Sum>(x, k)\<in>p2. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p2. content k *\<^sub>R g x) \<ge> 0" |
|
8514 and "0 \<le> (\<Sum>(x, k)\<in>p1. content k *\<^sub>R h x) - (\<Sum>(x, k)\<in>p1. content k *\<^sub>R f x)" |
|
8515 unfolding setsum_subtractf[symmetric] |
|
8516 apply - |
|
8517 apply (rule_tac[!] setsum_nonneg) |
|
8518 apply safe |
|
8519 unfolding real_scaleR_def right_diff_distrib[symmetric] |
|
8520 apply (rule_tac[!] mult_nonneg_nonneg) |
|
8521 proof - |
|
8522 fix a b |
|
8523 assume ab: "(a, b) \<in> p1" |
|
8524 show "0 \<le> content b" |
|
8525 using *(3)[OF ab] |
|
8526 apply safe |
|
8527 apply (rule content_pos_le) |
|
8528 done |
|
8529 then show "0 \<le> content b" . |
|
8530 show "0 \<le> f a - g a" "0 \<le> h a - f a" |
|
8531 using *(1-2)[OF ab] |
|
8532 using obt(4)[rule_format,of a] |
|
8533 by auto |
|
8534 next |
|
8535 fix a b |
|
8536 assume ab: "(a, b) \<in> p2" |
|
8537 show "0 \<le> content b" |
|
8538 using *(6)[OF ab] |
|
8539 apply safe |
|
8540 apply (rule content_pos_le) |
|
8541 done |
|
8542 then show "0 \<le> content b" . |
|
8543 show "0 \<le> f a - g a" and "0 \<le> h a - f a" |
|
8544 using *(4-5)[OF ab] using obt(4)[rule_format,of a] by auto |
|
8545 qed |
|
8546 then show ?case |
|
8547 apply - |
|
8548 unfolding real_norm_def |
|
8549 apply (rule **) |
|
8550 defer |
|
8551 defer |
|
8552 unfolding real_norm_def[symmetric] |
|
8553 apply (rule obt(3)) |
|
8554 apply (rule d1(2)[OF conjI[OF prems(4,5)]]) |
|
8555 apply (rule d1(2)[OF conjI[OF prems(1,2)]]) |
|
8556 apply (rule d2(2)[OF conjI[OF prems(4,6)]]) |
|
8557 apply (rule d2(2)[OF conjI[OF prems(1,3)]]) |
|
8558 apply auto |
|
8559 done |
|
8560 qed |
|
8561 qed |
|
8562 |
|
8563 lemma integrable_straddle: |
|
8564 fixes f :: "'n::euclidean_space \<Rightarrow> real" |
|
8565 assumes "\<forall>e>0. \<exists>g h i j. (g has_integral i) s \<and> (h has_integral j) s \<and> |
|
8566 norm (i - j) < e \<and> (\<forall>x\<in>s. g x \<le> f x \<and> f x \<le> h x)" |
|
8567 shows "f integrable_on s" |
|
8568 proof - |
|
8569 have "\<And>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on cbox a b" |
|
8570 proof (rule integrable_straddle_interval, safe, goal_cases) |
|
8571 case (1 a b e) |
|
8572 then have *: "e/4 > 0" |
|
8573 by auto |
|
8574 from assms[rule_format,OF this] guess g h i j by (elim exE conjE) note obt=this |
|
8575 note obt(1)[unfolded has_integral_alt'[of g]] |
|
8576 note conjunctD2[OF this, rule_format] |
|
8577 note g = this(1) and this(2)[OF *] |
|
8578 from this(2) guess B1 .. note B1 = conjunctD2[OF this,rule_format] |
|
8579 note obt(2)[unfolded has_integral_alt'[of h]] |
|
8580 note conjunctD2[OF this, rule_format] |
|
8581 note h = this(1) and this(2)[OF *] |
|
8582 from this(2) guess B2 .. note B2 = conjunctD2[OF this,rule_format] |
|
8583 define c :: 'n where "c = (\<Sum>i\<in>Basis. min (a\<bullet>i) (- (max B1 B2)) *\<^sub>R i)" |
|
8584 define d :: 'n where "d = (\<Sum>i\<in>Basis. max (b\<bullet>i) (max B1 B2) *\<^sub>R i)" |
|
8585 have *: "ball 0 B1 \<subseteq> cbox c d" "ball 0 B2 \<subseteq> cbox c d" |
|
8586 apply safe |
|
8587 unfolding mem_ball mem_box dist_norm |
|
8588 apply (rule_tac[!] ballI) |
|
8589 proof goal_cases |
|
8590 case (1 x i) |
|
8591 then show ?case using Basis_le_norm[of i x] |
|
8592 unfolding c_def d_def by auto |
|
8593 next |
|
8594 case (2 x i) |
|
8595 then show ?case using Basis_le_norm[of i x] |
|
8596 unfolding c_def d_def by auto |
|
8597 qed |
|
8598 have **: "\<And>ch cg ag ah::real. norm (ah - ag) \<le> norm (ch - cg) \<Longrightarrow> norm (cg - i) < e / 4 \<Longrightarrow> |
|
8599 norm (ch - j) < e / 4 \<Longrightarrow> norm (ag - ah) < e" |
|
8600 using obt(3) |
|
8601 unfolding real_norm_def |
|
8602 by arith |
|
8603 show ?case |
|
8604 apply (rule_tac x="\<lambda>x. if x \<in> s then g x else 0" in exI) |
|
8605 apply (rule_tac x="\<lambda>x. if x \<in> s then h x else 0" in exI) |
|
8606 apply (rule_tac x="integral (cbox a b) (\<lambda>x. if x \<in> s then g x else 0)" in exI) |
|
8607 apply (rule_tac x="integral (cbox a b) (\<lambda>x. if x \<in> s then h x else 0)" in exI) |
|
8608 apply safe |
|
8609 apply (rule_tac[1-2] integrable_integral,rule g) |
|
8610 apply (rule h) |
|
8611 apply (rule **[OF _ B1(2)[OF *(1)] B2(2)[OF *(2)]]) |
|
8612 proof - |
|
8613 have *: "\<And>x f g. (if x \<in> s then f x else 0) - (if x \<in> s then g x else 0) = |
|
8614 (if x \<in> s then f x - g x else (0::real))" |
|
8615 by auto |
|
8616 note ** = abs_of_nonneg[OF integral_nonneg[OF integrable_diff, OF h g]] |
|
8617 show "norm (integral (cbox a b) (\<lambda>x. if x \<in> s then h x else 0) - |
|
8618 integral (cbox a b) (\<lambda>x. if x \<in> s then g x else 0)) \<le> |
|
8619 norm (integral (cbox c d) (\<lambda>x. if x \<in> s then h x else 0) - |
|
8620 integral (cbox c d) (\<lambda>x. if x \<in> s then g x else 0))" |
|
8621 unfolding integral_diff[OF h g,symmetric] real_norm_def |
|
8622 apply (subst **) |
|
8623 defer |
|
8624 apply (subst **) |
|
8625 defer |
|
8626 apply (rule has_integral_subset_le) |
|
8627 defer |
|
8628 apply (rule integrable_integral integrable_diff h g)+ |
|
8629 proof safe |
|
8630 fix x |
|
8631 assume "x \<in> cbox a b" |
|
8632 then show "x \<in> cbox c d" |
|
8633 unfolding mem_box c_def d_def |
|
8634 apply - |
|
8635 apply rule |
|
8636 apply (erule_tac x=i in ballE) |
|
8637 apply auto |
|
8638 done |
|
8639 qed (insert obt(4), auto) |
|
8640 qed (insert obt(4), auto) |
|
8641 qed |
|
8642 note interv = this |
|
8643 |
|
8644 show ?thesis |
|
8645 unfolding integrable_alt[of f] |
|
8646 apply safe |
|
8647 apply (rule interv) |
|
8648 proof goal_cases |
|
8649 case (1 e) |
|
8650 then have *: "e/3 > 0" |
|
8651 by auto |
|
8652 from assms[rule_format,OF this] guess g h i j by (elim exE conjE) note obt=this |
|
8653 note obt(1)[unfolded has_integral_alt'[of g]] |
|
8654 note conjunctD2[OF this, rule_format] |
|
8655 note g = this(1) and this(2)[OF *] |
|
8656 from this(2) guess B1 .. note B1 = conjunctD2[OF this,rule_format] |
|
8657 note obt(2)[unfolded has_integral_alt'[of h]] |
|
8658 note conjunctD2[OF this, rule_format] |
|
8659 note h = this(1) and this(2)[OF *] |
|
8660 from this(2) guess B2 .. note B2 = conjunctD2[OF this,rule_format] |
|
8661 show ?case |
|
8662 apply (rule_tac x="max B1 B2" in exI) |
|
8663 apply safe |
|
8664 apply (rule max.strict_coboundedI1) |
|
8665 apply (rule B1) |
|
8666 proof - |
|
8667 fix a b c d :: 'n |
|
8668 assume as: "ball 0 (max B1 B2) \<subseteq> cbox a b" "ball 0 (max B1 B2) \<subseteq> cbox c d" |
|
8669 have **: "ball 0 B1 \<subseteq> ball (0::'n) (max B1 B2)" "ball 0 B2 \<subseteq> ball (0::'n) (max B1 B2)" |
|
8670 by auto |
|
8671 have *: "\<And>ga gc ha hc fa fc::real. |
|
8672 \<bar>ga - i\<bar> < e / 3 \<and> \<bar>gc - i\<bar> < e / 3 \<and> \<bar>ha - j\<bar> < e / 3 \<and> |
|
8673 \<bar>hc - j\<bar> < e / 3 \<and> \<bar>i - j\<bar> < e / 3 \<and> ga \<le> fa \<and> fa \<le> ha \<and> gc \<le> fc \<and> fc \<le> hc \<Longrightarrow> |
|
8674 \<bar>fa - fc\<bar> < e" |
|
8675 by (simp add: abs_real_def split: if_split_asm) |
|
8676 show "norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - integral (cbox c d) |
|
8677 (\<lambda>x. if x \<in> s then f x else 0)) < e" |
|
8678 unfolding real_norm_def |
|
8679 apply (rule *) |
|
8680 apply safe |
|
8681 unfolding real_norm_def[symmetric] |
|
8682 apply (rule B1(2)) |
|
8683 apply (rule order_trans) |
|
8684 apply (rule **) |
|
8685 apply (rule as(1)) |
|
8686 apply (rule B1(2)) |
|
8687 apply (rule order_trans) |
|
8688 apply (rule **) |
|
8689 apply (rule as(2)) |
|
8690 apply (rule B2(2)) |
|
8691 apply (rule order_trans) |
|
8692 apply (rule **) |
|
8693 apply (rule as(1)) |
|
8694 apply (rule B2(2)) |
|
8695 apply (rule order_trans) |
|
8696 apply (rule **) |
|
8697 apply (rule as(2)) |
|
8698 apply (rule obt) |
|
8699 apply (rule_tac[!] integral_le) |
|
8700 using obt |
|
8701 apply (auto intro!: h g interv) |
|
8702 done |
|
8703 qed |
|
8704 qed |
|
8705 qed |
|
8706 |
|
8707 |
|
8708 subsection \<open>Adding integrals over several sets\<close> |
|
8709 |
|
8710 lemma has_integral_union: |
|
8711 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8712 assumes "(f has_integral i) s" |
|
8713 and "(f has_integral j) t" |
|
8714 and "negligible (s \<inter> t)" |
|
8715 shows "(f has_integral (i + j)) (s \<union> t)" |
|
8716 proof - |
|
8717 note * = has_integral_restrict_univ[symmetric, of f] |
|
8718 show ?thesis |
|
8719 unfolding * |
|
8720 apply (rule has_integral_spike[OF assms(3)]) |
|
8721 defer |
|
8722 apply (rule has_integral_add[OF assms(1-2)[unfolded *]]) |
|
8723 apply auto |
|
8724 done |
|
8725 qed |
|
8726 |
|
8727 lemma integrable_union: |
|
8728 fixes f :: "'a::euclidean_space \<Rightarrow> 'b :: banach" |
|
8729 assumes "negligible (A \<inter> B)" "f integrable_on A" "f integrable_on B" |
|
8730 shows "f integrable_on (A \<union> B)" |
|
8731 proof - |
|
8732 from assms obtain y z where "(f has_integral y) A" "(f has_integral z) B" |
|
8733 by (auto simp: integrable_on_def) |
|
8734 from has_integral_union[OF this assms(1)] show ?thesis by (auto simp: integrable_on_def) |
|
8735 qed |
|
8736 |
|
8737 lemma integrable_union': |
|
8738 fixes f :: "'a::euclidean_space \<Rightarrow> 'b :: banach" |
|
8739 assumes "f integrable_on A" "f integrable_on B" "negligible (A \<inter> B)" "C = A \<union> B" |
|
8740 shows "f integrable_on C" |
|
8741 using integrable_union[of A B f] assms by simp |
|
8742 |
|
8743 lemma has_integral_unions: |
|
8744 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8745 assumes "finite t" |
|
8746 and "\<forall>s\<in>t. (f has_integral (i s)) s" |
|
8747 and "\<forall>s\<in>t. \<forall>s'\<in>t. s \<noteq> s' \<longrightarrow> negligible (s \<inter> s')" |
|
8748 shows "(f has_integral (setsum i t)) (\<Union>t)" |
|
8749 proof - |
|
8750 note * = has_integral_restrict_univ[symmetric, of f] |
|
8751 have **: "negligible (\<Union>((\<lambda>(a,b). a \<inter> b) ` {(a,b). a \<in> t \<and> b \<in> {y. y \<in> t \<and> a \<noteq> y}}))" |
|
8752 apply (rule negligible_Union) |
|
8753 apply (rule finite_imageI) |
|
8754 apply (rule finite_subset[of _ "t \<times> t"]) |
|
8755 defer |
|
8756 apply (rule finite_cartesian_product[OF assms(1,1)]) |
|
8757 using assms(3) |
|
8758 apply auto |
|
8759 done |
|
8760 note assms(2)[unfolded *] |
|
8761 note has_integral_setsum[OF assms(1) this] |
|
8762 then show ?thesis |
|
8763 unfolding * |
|
8764 apply - |
|
8765 apply (rule has_integral_spike[OF **]) |
|
8766 defer |
|
8767 apply assumption |
|
8768 apply safe |
|
8769 proof goal_cases |
|
8770 case prems: (1 x) |
|
8771 then show ?case |
|
8772 proof (cases "x \<in> \<Union>t") |
|
8773 case True |
|
8774 then guess s unfolding Union_iff .. note s=this |
|
8775 then have *: "\<forall>b\<in>t. x \<in> b \<longleftrightarrow> b = s" |
|
8776 using prems(3) by blast |
|
8777 show ?thesis |
|
8778 unfolding if_P[OF True] |
|
8779 apply (rule trans) |
|
8780 defer |
|
8781 apply (rule setsum.cong) |
|
8782 apply (rule refl) |
|
8783 apply (subst *) |
|
8784 apply assumption |
|
8785 apply (rule refl) |
|
8786 unfolding setsum.delta[OF assms(1)] |
|
8787 using s |
|
8788 apply auto |
|
8789 done |
|
8790 qed auto |
|
8791 qed |
|
8792 qed |
|
8793 |
|
8794 |
|
8795 text \<open>In particular adding integrals over a division, maybe not of an interval.\<close> |
|
8796 |
|
8797 lemma has_integral_combine_division: |
|
8798 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8799 assumes "d division_of s" |
|
8800 and "\<forall>k\<in>d. (f has_integral (i k)) k" |
|
8801 shows "(f has_integral (setsum i d)) s" |
|
8802 proof - |
|
8803 note d = division_ofD[OF assms(1)] |
|
8804 show ?thesis |
|
8805 unfolding d(6)[symmetric] |
|
8806 apply (rule has_integral_unions) |
|
8807 apply (rule d assms)+ |
|
8808 apply rule |
|
8809 apply rule |
|
8810 apply rule |
|
8811 proof goal_cases |
|
8812 case prems: (1 s s') |
|
8813 from d(4)[OF this(1)] d(4)[OF this(2)] guess a c b d by (elim exE) note obt=this |
|
8814 from d(5)[OF prems] show ?case |
|
8815 unfolding obt interior_cbox |
|
8816 apply - |
|
8817 apply (rule negligible_subset[of "(cbox a b-box a b) \<union> (cbox c d-box c d)"]) |
|
8818 apply (rule negligible_Un negligible_frontier_interval)+ |
|
8819 apply auto |
|
8820 done |
|
8821 qed |
|
8822 qed |
|
8823 |
|
8824 lemma integral_combine_division_bottomup: |
|
8825 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8826 assumes "d division_of s" |
|
8827 and "\<forall>k\<in>d. f integrable_on k" |
|
8828 shows "integral s f = setsum (\<lambda>i. integral i f) d" |
|
8829 apply (rule integral_unique) |
|
8830 apply (rule has_integral_combine_division[OF assms(1)]) |
|
8831 using assms(2) |
|
8832 unfolding has_integral_integral |
|
8833 apply assumption |
|
8834 done |
|
8835 |
|
8836 lemma has_integral_combine_division_topdown: |
|
8837 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8838 assumes "f integrable_on s" |
|
8839 and "d division_of k" |
|
8840 and "k \<subseteq> s" |
|
8841 shows "(f has_integral (setsum (\<lambda>i. integral i f) d)) k" |
|
8842 apply (rule has_integral_combine_division[OF assms(2)]) |
|
8843 apply safe |
|
8844 unfolding has_integral_integral[symmetric] |
|
8845 proof goal_cases |
|
8846 case (1 k) |
|
8847 from division_ofD(2,4)[OF assms(2) this] |
|
8848 show ?case |
|
8849 apply safe |
|
8850 apply (rule integrable_on_subcbox) |
|
8851 apply (rule assms) |
|
8852 using assms(3) |
|
8853 apply auto |
|
8854 done |
|
8855 qed |
|
8856 |
|
8857 lemma integral_combine_division_topdown: |
|
8858 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8859 assumes "f integrable_on s" |
|
8860 and "d division_of s" |
|
8861 shows "integral s f = setsum (\<lambda>i. integral i f) d" |
|
8862 apply (rule integral_unique) |
|
8863 apply (rule has_integral_combine_division_topdown) |
|
8864 using assms |
|
8865 apply auto |
|
8866 done |
|
8867 |
|
8868 lemma integrable_combine_division: |
|
8869 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8870 assumes "d division_of s" |
|
8871 and "\<forall>i\<in>d. f integrable_on i" |
|
8872 shows "f integrable_on s" |
|
8873 using assms(2) |
|
8874 unfolding integrable_on_def |
|
8875 by (metis has_integral_combine_division[OF assms(1)]) |
|
8876 |
|
8877 lemma integrable_on_subdivision: |
|
8878 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8879 assumes "d division_of i" |
|
8880 and "f integrable_on s" |
|
8881 and "i \<subseteq> s" |
|
8882 shows "f integrable_on i" |
|
8883 apply (rule integrable_combine_division assms)+ |
|
8884 apply safe |
|
8885 proof goal_cases |
|
8886 case 1 |
|
8887 note division_ofD(2,4)[OF assms(1) this] |
|
8888 then show ?case |
|
8889 apply safe |
|
8890 apply (rule integrable_on_subcbox[OF assms(2)]) |
|
8891 using assms(3) |
|
8892 apply auto |
|
8893 done |
|
8894 qed |
|
8895 |
|
8896 |
|
8897 subsection \<open>Also tagged divisions\<close> |
|
8898 |
|
8899 lemma has_integral_combine_tagged_division: |
|
8900 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8901 assumes "p tagged_division_of s" |
|
8902 and "\<forall>(x,k) \<in> p. (f has_integral (i k)) k" |
|
8903 shows "(f has_integral (setsum (\<lambda>(x,k). i k) p)) s" |
|
8904 proof - |
|
8905 have *: "(f has_integral (setsum (\<lambda>k. integral k f) (snd ` p))) s" |
|
8906 apply (rule has_integral_combine_division) |
|
8907 apply (rule division_of_tagged_division[OF assms(1)]) |
|
8908 using assms(2) |
|
8909 unfolding has_integral_integral[symmetric] |
|
8910 apply safe |
|
8911 apply auto |
|
8912 done |
|
8913 then show ?thesis |
|
8914 apply - |
|
8915 apply (rule subst[where P="\<lambda>i. (f has_integral i) s"]) |
|
8916 defer |
|
8917 apply assumption |
|
8918 apply (rule trans[of _ "setsum (\<lambda>(x,k). integral k f) p"]) |
|
8919 apply (subst eq_commute) |
|
8920 apply (rule setsum.over_tagged_division_lemma[OF assms(1)]) |
|
8921 apply (rule integral_null) |
|
8922 apply assumption |
|
8923 apply (rule setsum.cong) |
|
8924 using assms(2) |
|
8925 apply auto |
|
8926 done |
|
8927 qed |
|
8928 |
|
8929 lemma integral_combine_tagged_division_bottomup: |
|
8930 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8931 assumes "p tagged_division_of (cbox a b)" |
|
8932 and "\<forall>(x,k)\<in>p. f integrable_on k" |
|
8933 shows "integral (cbox a b) f = setsum (\<lambda>(x,k). integral k f) p" |
|
8934 apply (rule integral_unique) |
|
8935 apply (rule has_integral_combine_tagged_division[OF assms(1)]) |
|
8936 using assms(2) |
|
8937 apply auto |
|
8938 done |
|
8939 |
|
8940 lemma has_integral_combine_tagged_division_topdown: |
|
8941 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8942 assumes "f integrable_on cbox a b" |
|
8943 and "p tagged_division_of (cbox a b)" |
|
8944 shows "(f has_integral (setsum (\<lambda>(x,k). integral k f) p)) (cbox a b)" |
|
8945 apply (rule has_integral_combine_tagged_division[OF assms(2)]) |
|
8946 apply safe |
|
8947 proof goal_cases |
|
8948 case 1 |
|
8949 note tagged_division_ofD(3-4)[OF assms(2) this] |
|
8950 then show ?case |
|
8951 using integrable_subinterval[OF assms(1)] by blast |
|
8952 qed |
|
8953 |
|
8954 lemma integral_combine_tagged_division_topdown: |
|
8955 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8956 assumes "f integrable_on cbox a b" |
|
8957 and "p tagged_division_of (cbox a b)" |
|
8958 shows "integral (cbox a b) f = setsum (\<lambda>(x,k). integral k f) p" |
|
8959 apply (rule integral_unique) |
|
8960 apply (rule has_integral_combine_tagged_division_topdown) |
|
8961 using assms |
|
8962 apply auto |
|
8963 done |
|
8964 |
|
8965 |
|
8966 subsection \<open>Henstock's lemma\<close> |
|
8967 |
|
8968 lemma henstock_lemma_part1: |
|
8969 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
8970 assumes "f integrable_on cbox a b" |
|
8971 and "e > 0" |
|
8972 and "gauge d" |
|
8973 and "(\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
|
8974 norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - integral(cbox a b) f) < e)" |
|
8975 and p: "p tagged_partial_division_of (cbox a b)" "d fine p" |
|
8976 shows "norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x - integral k f) p) \<le> e" |
|
8977 (is "?x \<le> e") |
|
8978 proof - |
|
8979 { presume "\<And>k. 0<k \<Longrightarrow> ?x \<le> e + k" then show ?thesis by (blast intro: field_le_epsilon) } |
|
8980 fix k :: real |
|
8981 assume k: "k > 0" |
|
8982 note p' = tagged_partial_division_ofD[OF p(1)] |
|
8983 have "\<Union>(snd ` p) \<subseteq> cbox a b" |
|
8984 using p'(3) by fastforce |
|
8985 note partial_division_of_tagged_division[OF p(1)] this |
|
8986 from partial_division_extend_interval[OF this] guess q . note q=this and q' = division_ofD[OF this(2)] |
|
8987 define r where "r = q - snd ` p" |
|
8988 have "snd ` p \<inter> r = {}" |
|
8989 unfolding r_def by auto |
|
8990 have r: "finite r" |
|
8991 using q' unfolding r_def by auto |
|
8992 |
|
8993 have "\<forall>i\<in>r. \<exists>p. p tagged_division_of i \<and> d fine p \<and> |
|
8994 norm (setsum (\<lambda>(x,j). content j *\<^sub>R f x) p - integral i f) < k / (real (card r) + 1)" |
|
8995 apply safe |
|
8996 proof goal_cases |
|
8997 case (1 i) |
|
8998 then have i: "i \<in> q" |
|
8999 unfolding r_def by auto |
|
9000 from q'(4)[OF this] guess u v by (elim exE) note uv=this |
|
9001 have *: "k / (real (card r) + 1) > 0" using k by simp |
|
9002 have "f integrable_on cbox u v" |
|
9003 apply (rule integrable_subinterval[OF assms(1)]) |
|
9004 using q'(2)[OF i] |
|
9005 unfolding uv |
|
9006 apply auto |
|
9007 done |
|
9008 note integrable_integral[OF this, unfolded has_integral[of f]] |
|
9009 from this[rule_format,OF *] guess dd .. note dd=conjunctD2[OF this,rule_format] |
|
9010 note gauge_inter[OF \<open>gauge d\<close> dd(1)] |
|
9011 from fine_division_exists[OF this,of u v] guess qq . |
|
9012 then show ?case |
|
9013 apply (rule_tac x=qq in exI) |
|
9014 using dd(2)[of qq] |
|
9015 unfolding fine_inter uv |
|
9016 apply auto |
|
9017 done |
|
9018 qed |
|
9019 from bchoice[OF this] guess qq .. note qq=this[rule_format] |
|
9020 |
|
9021 let ?p = "p \<union> \<Union>(qq ` r)" |
|
9022 have "norm ((\<Sum>(x, k)\<in>?p. content k *\<^sub>R f x) - integral (cbox a b) f) < e" |
|
9023 apply (rule assms(4)[rule_format]) |
|
9024 proof |
|
9025 show "d fine ?p" |
|
9026 apply (rule fine_union) |
|
9027 apply (rule p) |
|
9028 apply (rule fine_unions) |
|
9029 using qq |
|
9030 apply auto |
|
9031 done |
|
9032 note * = tagged_partial_division_of_union_self[OF p(1)] |
|
9033 have "p \<union> \<Union>(qq ` r) tagged_division_of \<Union>(snd ` p) \<union> \<Union>r" |
|
9034 using r |
|
9035 proof (rule tagged_division_union[OF * tagged_division_unions], goal_cases) |
|
9036 case 1 |
|
9037 then show ?case |
|
9038 using qq by auto |
|
9039 next |
|
9040 case 2 |
|
9041 then show ?case |
|
9042 apply rule |
|
9043 apply rule |
|
9044 apply rule |
|
9045 apply(rule q'(5)) |
|
9046 unfolding r_def |
|
9047 apply auto |
|
9048 done |
|
9049 next |
|
9050 case 3 |
|
9051 then show ?case |
|
9052 apply (rule inter_interior_unions_intervals) |
|
9053 apply fact |
|
9054 apply rule |
|
9055 apply rule |
|
9056 apply (rule q') |
|
9057 defer |
|
9058 apply rule |
|
9059 apply (subst Int_commute) |
|
9060 apply (rule inter_interior_unions_intervals) |
|
9061 apply (rule finite_imageI) |
|
9062 apply (rule p') |
|
9063 apply rule |
|
9064 defer |
|
9065 apply rule |
|
9066 apply (rule q') |
|
9067 using q(1) p' |
|
9068 unfolding r_def |
|
9069 apply auto |
|
9070 done |
|
9071 qed |
|
9072 moreover have "\<Union>(snd ` p) \<union> \<Union>r = cbox a b" and "{qq i |i. i \<in> r} = qq ` r" |
|
9073 unfolding Union_Un_distrib[symmetric] r_def |
|
9074 using q |
|
9075 by auto |
|
9076 ultimately show "?p tagged_division_of (cbox a b)" |
|
9077 by fastforce |
|
9078 qed |
|
9079 |
|
9080 then have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>\<Union>(qq ` r). content k *\<^sub>R f x) - |
|
9081 integral (cbox a b) f) < e" |
|
9082 apply (subst setsum.union_inter_neutral[symmetric]) |
|
9083 apply (rule p') |
|
9084 prefer 3 |
|
9085 apply assumption |
|
9086 apply rule |
|
9087 apply (rule r) |
|
9088 apply safe |
|
9089 apply (drule qq) |
|
9090 proof - |
|
9091 fix x l k |
|
9092 assume as: "(x, l) \<in> p" "(x, l) \<in> qq k" "k \<in> r" |
|
9093 note qq[OF this(3)] |
|
9094 note tagged_division_ofD(3,4)[OF conjunct1[OF this] as(2)] |
|
9095 from this(2) guess u v by (elim exE) note uv=this |
|
9096 have "l\<in>snd ` p" unfolding image_iff apply(rule_tac x="(x,l)" in bexI) using as by auto |
|
9097 then have "l \<in> q" "k \<in> q" "l \<noteq> k" |
|
9098 using as(1,3) q(1) unfolding r_def by auto |
|
9099 note q'(5)[OF this] |
|
9100 then have "interior l = {}" |
|
9101 using interior_mono[OF \<open>l \<subseteq> k\<close>] by blast |
|
9102 then show "content l *\<^sub>R f x = 0" |
|
9103 unfolding uv content_eq_0_interior[symmetric] by auto |
|
9104 qed auto |
|
9105 |
|
9106 then have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + setsum (setsum (\<lambda>(x, k). content k *\<^sub>R f x)) |
|
9107 (qq ` r) - integral (cbox a b) f) < e" |
|
9108 apply (subst (asm) setsum.Union_comp) |
|
9109 prefer 2 |
|
9110 unfolding split_paired_all split_conv image_iff |
|
9111 apply (erule bexE)+ |
|
9112 proof - |
|
9113 fix x m k l T1 T2 |
|
9114 assume "(x, m) \<in> T1" "(x, m) \<in> T2" "T1 \<noteq> T2" "k \<in> r" "l \<in> r" "T1 = qq k" "T2 = qq l" |
|
9115 note as = this(1-5)[unfolded this(6-)] |
|
9116 note kl = tagged_division_ofD(3,4)[OF qq[THEN conjunct1]] |
|
9117 from this(2)[OF as(4,1)] guess u v by (elim exE) note uv=this |
|
9118 have *: "interior (k \<inter> l) = {}" |
|
9119 by (metis DiffE \<open>T1 = qq k\<close> \<open>T1 \<noteq> T2\<close> \<open>T2 = qq l\<close> as(4) as(5) interior_Int q'(5) r_def) |
|
9120 have "interior m = {}" |
|
9121 unfolding subset_empty[symmetric] |
|
9122 unfolding *[symmetric] |
|
9123 apply (rule interior_mono) |
|
9124 using kl(1)[OF as(4,1)] kl(1)[OF as(5,2)] |
|
9125 apply auto |
|
9126 done |
|
9127 then show "content m *\<^sub>R f x = 0" |
|
9128 unfolding uv content_eq_0_interior[symmetric] |
|
9129 by auto |
|
9130 qed (insert qq, auto) |
|
9131 |
|
9132 then have **: "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + setsum (setsum (\<lambda>(x, k). content k *\<^sub>R f x) \<circ> qq) r - |
|
9133 integral (cbox a b) f) < e" |
|
9134 apply (subst (asm) setsum.reindex_nontrivial) |
|
9135 apply fact |
|
9136 apply (rule setsum.neutral) |
|
9137 apply rule |
|
9138 unfolding split_paired_all split_conv |
|
9139 defer |
|
9140 apply assumption |
|
9141 proof - |
|
9142 fix k l x m |
|
9143 assume as: "k \<in> r" "l \<in> r" "k \<noteq> l" "qq k = qq l" "(x, m) \<in> qq k" |
|
9144 note tagged_division_ofD(6)[OF qq[THEN conjunct1]] |
|
9145 from this[OF as(1)] this[OF as(2)] show "content m *\<^sub>R f x = 0" |
|
9146 using as(3) unfolding as by auto |
|
9147 qed |
|
9148 |
|
9149 have *: "norm (cp - ip) \<le> e + k" |
|
9150 if "norm ((cp + cr) - i) < e" |
|
9151 and "norm (cr - ir) < k" |
|
9152 and "ip + ir = i" |
|
9153 for ir ip i cr cp |
|
9154 proof - |
|
9155 from that show ?thesis |
|
9156 using norm_triangle_le[of "cp + cr - i" "- (cr - ir)"] |
|
9157 unfolding that(3)[symmetric] norm_minus_cancel |
|
9158 by (auto simp add: algebra_simps) |
|
9159 qed |
|
9160 |
|
9161 have "?x = norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f))" |
|
9162 unfolding split_def setsum_subtractf .. |
|
9163 also have "\<dots> \<le> e + k" |
|
9164 apply (rule *[OF **, where ir1="setsum (\<lambda>k. integral k f) r"]) |
|
9165 proof goal_cases |
|
9166 case 1 |
|
9167 have *: "k * real (card r) / (1 + real (card r)) < k" |
|
9168 using k by (auto simp add: field_simps) |
|
9169 show ?case |
|
9170 apply (rule le_less_trans[of _ "setsum (\<lambda>x. k / (real (card r) + 1)) r"]) |
|
9171 unfolding setsum_subtractf[symmetric] |
|
9172 apply (rule setsum_norm_le) |
|
9173 apply rule |
|
9174 apply (drule qq) |
|
9175 defer |
|
9176 unfolding divide_inverse setsum_left_distrib[symmetric] |
|
9177 unfolding divide_inverse[symmetric] |
|
9178 using * apply (auto simp add: field_simps) |
|
9179 done |
|
9180 next |
|
9181 case 2 |
|
9182 have *: "(\<Sum>(x, k)\<in>p. integral k f) = (\<Sum>k\<in>snd ` p. integral k f)" |
|
9183 apply (subst setsum.reindex_nontrivial) |
|
9184 apply fact |
|
9185 unfolding split_paired_all snd_conv split_def o_def |
|
9186 proof - |
|
9187 fix x l y m |
|
9188 assume as: "(x, l) \<in> p" "(y, m) \<in> p" "(x, l) \<noteq> (y, m)" "l = m" |
|
9189 from p'(4)[OF as(1)] guess u v by (elim exE) note uv=this |
|
9190 show "integral l f = 0" |
|
9191 unfolding uv |
|
9192 apply (rule integral_unique) |
|
9193 apply (rule has_integral_null) |
|
9194 unfolding content_eq_0_interior |
|
9195 using p'(5)[OF as(1-3)] |
|
9196 unfolding uv as(4)[symmetric] |
|
9197 apply auto |
|
9198 done |
|
9199 qed auto |
|
9200 from q(1) have **: "snd ` p \<union> q = q" by auto |
|
9201 show ?case |
|
9202 unfolding integral_combine_division_topdown[OF assms(1) q(2)] * r_def |
|
9203 using ** q'(1) p'(1) setsum.union_disjoint [of "snd ` p" "q - snd ` p" "\<lambda>k. integral k f", symmetric] |
|
9204 by simp |
|
9205 qed |
|
9206 finally show "?x \<le> e + k" . |
|
9207 qed |
|
9208 |
|
9209 lemma henstock_lemma_part2: |
|
9210 fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" |
|
9211 assumes "f integrable_on cbox a b" |
|
9212 and "e > 0" |
|
9213 and "gauge d" |
|
9214 and "\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
|
9215 norm (setsum (\<lambda>(x,k). content k *\<^sub>R f x) p - integral (cbox a b) f) < e" |
|
9216 and "p tagged_partial_division_of (cbox a b)" |
|
9217 and "d fine p" |
|
9218 shows "setsum (\<lambda>(x,k). norm (content k *\<^sub>R f x - integral k f)) p \<le> 2 * real (DIM('n)) * e" |
|
9219 unfolding split_def |
|
9220 apply (rule setsum_norm_allsubsets_bound) |
|
9221 defer |
|
9222 apply (rule henstock_lemma_part1[unfolded split_def,OF assms(1-3)]) |
|
9223 apply safe |
|
9224 apply (rule assms[rule_format,unfolded split_def]) |
|
9225 defer |
|
9226 apply (rule tagged_partial_division_subset) |
|
9227 apply (rule assms) |
|
9228 apply assumption |
|
9229 apply (rule fine_subset) |
|
9230 apply assumption |
|
9231 apply (rule assms) |
|
9232 using assms(5) |
|
9233 apply auto |
|
9234 done |
|
9235 |
|
9236 lemma henstock_lemma: |
|
9237 fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" |
|
9238 assumes "f integrable_on cbox a b" |
|
9239 and "e > 0" |
|
9240 obtains d where "gauge d" |
|
9241 and "\<forall>p. p tagged_partial_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
|
9242 setsum (\<lambda>(x,k). norm(content k *\<^sub>R f x - integral k f)) p < e" |
|
9243 proof - |
|
9244 have *: "e / (2 * (real DIM('n) + 1)) > 0" using assms(2) by simp |
|
9245 from integrable_integral[OF assms(1),unfolded has_integral[of f],rule_format,OF this] |
|
9246 guess d .. note d = conjunctD2[OF this] |
|
9247 show thesis |
|
9248 apply (rule that) |
|
9249 apply (rule d) |
|
9250 proof (safe, goal_cases) |
|
9251 case (1 p) |
|
9252 note * = henstock_lemma_part2[OF assms(1) * d this] |
|
9253 show ?case |
|
9254 apply (rule le_less_trans[OF *]) |
|
9255 using \<open>e > 0\<close> |
|
9256 apply (auto simp add: field_simps) |
|
9257 done |
|
9258 qed |
|
9259 qed |
|
9260 |
|
9261 |
|
9262 subsection \<open>Geometric progression\<close> |
|
9263 |
|
9264 text \<open>FIXME: Should one or more of these theorems be moved to @{file |
|
9265 "~~/src/HOL/Set_Interval.thy"}, alongside \<open>geometric_sum\<close>?\<close> |
|
9266 |
|
9267 lemma sum_gp_basic: |
|
9268 fixes x :: "'a::ring_1" |
|
9269 shows "(1 - x) * setsum (\<lambda>i. x^i) {0 .. n} = (1 - x^(Suc n))" |
|
9270 proof - |
|
9271 define y where "y = 1 - x" |
|
9272 have "y * (\<Sum>i=0..n. (1 - y) ^ i) = 1 - (1 - y) ^ Suc n" |
|
9273 by (induct n) (simp_all add: algebra_simps) |
|
9274 then show ?thesis |
|
9275 unfolding y_def by simp |
|
9276 qed |
|
9277 |
|
9278 lemma sum_gp_multiplied: |
|
9279 assumes mn: "m \<le> n" |
|
9280 shows "((1::'a::{field}) - x) * setsum (op ^ x) {m..n} = x^m - x^ Suc n" |
|
9281 (is "?lhs = ?rhs") |
|
9282 proof - |
|
9283 let ?S = "{0..(n - m)}" |
|
9284 from mn have mn': "n - m \<ge> 0" |
|
9285 by arith |
|
9286 let ?f = "op + m" |
|
9287 have i: "inj_on ?f ?S" |
|
9288 unfolding inj_on_def by auto |
|
9289 have f: "?f ` ?S = {m..n}" |
|
9290 using mn |
|
9291 apply (auto simp add: image_iff Bex_def) |
|
9292 apply presburger |
|
9293 done |
|
9294 have th: "op ^ x \<circ> op + m = (\<lambda>i. x^m * x^i)" |
|
9295 by (rule ext) (simp add: power_add power_mult) |
|
9296 from setsum.reindex[OF i, of "op ^ x", unfolded f th setsum_right_distrib[symmetric]] |
|
9297 have "?lhs = x^m * ((1 - x) * setsum (op ^ x) {0..n - m})" |
|
9298 by simp |
|
9299 then show ?thesis |
|
9300 unfolding sum_gp_basic |
|
9301 using mn |
|
9302 by (simp add: field_simps power_add[symmetric]) |
|
9303 qed |
|
9304 |
|
9305 lemma sum_gp: |
|
9306 "setsum (op ^ (x::'a::{field})) {m .. n} = |
|
9307 (if n < m then 0 |
|
9308 else if x = 1 then of_nat ((n + 1) - m) |
|
9309 else (x^ m - x^ (Suc n)) / (1 - x))" |
|
9310 proof - |
|
9311 { |
|
9312 assume nm: "n < m" |
|
9313 then have ?thesis by simp |
|
9314 } |
|
9315 moreover |
|
9316 { |
|
9317 assume "\<not> n < m" |
|
9318 then have nm: "m \<le> n" |
|
9319 by arith |
|
9320 { |
|
9321 assume x: "x = 1" |
|
9322 then have ?thesis |
|
9323 by simp |
|
9324 } |
|
9325 moreover |
|
9326 { |
|
9327 assume x: "x \<noteq> 1" |
|
9328 then have nz: "1 - x \<noteq> 0" |
|
9329 by simp |
|
9330 from sum_gp_multiplied[OF nm, of x] nz have ?thesis |
|
9331 by (simp add: field_simps) |
|
9332 } |
|
9333 ultimately have ?thesis by blast |
|
9334 } |
|
9335 ultimately show ?thesis by blast |
|
9336 qed |
|
9337 |
|
9338 lemma sum_gp_offset: |
|
9339 "setsum (op ^ (x::'a::{field})) {m .. m+n} = |
|
9340 (if x = 1 then of_nat n + 1 else x^m * (1 - x^Suc n) / (1 - x))" |
|
9341 unfolding sum_gp[of x m "m + n"] power_Suc |
|
9342 by (simp add: field_simps power_add) |
|
9343 |
|
9344 |
|
9345 subsection \<open>Monotone convergence (bounded interval first)\<close> |
|
9346 |
|
9347 lemma monotone_convergence_interval: |
|
9348 fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" |
|
9349 assumes "\<forall>k. (f k) integrable_on cbox a b" |
|
9350 and "\<forall>k. \<forall>x\<in>cbox a b.(f k x) \<le> f (Suc k) x" |
|
9351 and "\<forall>x\<in>cbox a b. ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially" |
|
9352 and "bounded {integral (cbox a b) (f k) | k . k \<in> UNIV}" |
|
9353 shows "g integrable_on cbox a b \<and> ((\<lambda>k. integral (cbox a b) (f k)) \<longlongrightarrow> integral (cbox a b) g) sequentially" |
|
9354 proof (cases "content (cbox a b) = 0") |
|
9355 case True |
|
9356 show ?thesis |
|
9357 using integrable_on_null[OF True] |
|
9358 unfolding integral_null[OF True] |
|
9359 using tendsto_const |
|
9360 by auto |
|
9361 next |
|
9362 case False |
|
9363 have fg: "\<forall>x\<in>cbox a b. \<forall>k. (f k x) \<bullet> 1 \<le> (g x) \<bullet> 1" |
|
9364 proof safe |
|
9365 fix x k |
|
9366 assume x: "x \<in> cbox a b" |
|
9367 note * = Lim_component_ge[OF assms(3)[rule_format, OF x] trivial_limit_sequentially] |
|
9368 show "f k x \<bullet> 1 \<le> g x \<bullet> 1" |
|
9369 apply (rule *) |
|
9370 unfolding eventually_sequentially |
|
9371 apply (rule_tac x=k in exI) |
|
9372 apply - |
|
9373 apply (rule transitive_stepwise_le) |
|
9374 using assms(2)[rule_format, OF x] |
|
9375 apply auto |
|
9376 done |
|
9377 qed |
|
9378 have "\<exists>i. ((\<lambda>k. integral (cbox a b) (f k)) \<longlongrightarrow> i) sequentially" |
|
9379 apply (rule bounded_increasing_convergent) |
|
9380 defer |
|
9381 apply rule |
|
9382 apply (rule integral_le) |
|
9383 apply safe |
|
9384 apply (rule assms(1-2)[rule_format])+ |
|
9385 using assms(4) |
|
9386 apply auto |
|
9387 done |
|
9388 then guess i .. note i=this |
|
9389 have i': "\<And>k. (integral(cbox a b) (f k)) \<le> i\<bullet>1" |
|
9390 apply (rule Lim_component_ge) |
|
9391 apply (rule i) |
|
9392 apply (rule trivial_limit_sequentially) |
|
9393 unfolding eventually_sequentially |
|
9394 apply (rule_tac x=k in exI) |
|
9395 apply (rule transitive_stepwise_le) |
|
9396 prefer 3 |
|
9397 unfolding inner_simps real_inner_1_right |
|
9398 apply (rule integral_le) |
|
9399 apply (rule assms(1-2)[rule_format])+ |
|
9400 using assms(2) |
|
9401 apply auto |
|
9402 done |
|
9403 |
|
9404 have "(g has_integral i) (cbox a b)" |
|
9405 unfolding has_integral |
|
9406 proof (safe, goal_cases) |
|
9407 case e: (1 e) |
|
9408 then have "\<forall>k. (\<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> |
|
9409 norm ((\<Sum>(x, ka)\<in>p. content ka *\<^sub>R f k x) - integral (cbox a b) (f k)) < e / 2 ^ (k + 2)))" |
|
9410 apply - |
|
9411 apply rule |
|
9412 apply (rule assms(1)[unfolded has_integral_integral has_integral,rule_format]) |
|
9413 apply auto |
|
9414 done |
|
9415 from choice[OF this] guess c .. note c=conjunctD2[OF this[rule_format],rule_format] |
|
9416 |
|
9417 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" |
|
9418 proof - |
|
9419 have "e/4 > 0" |
|
9420 using e by auto |
|
9421 from LIMSEQ_D [OF i this] guess r .. |
|
9422 then show ?thesis |
|
9423 apply (rule_tac x=r in exI) |
|
9424 apply rule |
|
9425 apply (erule_tac x=k in allE) |
|
9426 subgoal for k using i'[of k] by auto |
|
9427 done |
|
9428 qed |
|
9429 then guess r .. note r=conjunctD2[OF this[rule_format]] |
|
9430 |
|
9431 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> |
|
9432 (g x)\<bullet>1 - (f k x)\<bullet>1 < e / (4 * content(cbox a b))" |
|
9433 proof (rule, goal_cases) |
|
9434 case prems: (1 x) |
|
9435 have "e / (4 * content (cbox a b)) > 0" |
|
9436 using \<open>e>0\<close> False content_pos_le[of a b] by auto |
|
9437 from assms(3)[rule_format, OF prems, THEN LIMSEQ_D, OF this] |
|
9438 guess n .. note n=this |
|
9439 then show ?case |
|
9440 apply (rule_tac x="n + r" in exI) |
|
9441 apply safe |
|
9442 apply (erule_tac[2-3] x=k in allE) |
|
9443 unfolding dist_real_def |
|
9444 using fg[rule_format, OF prems] |
|
9445 apply (auto simp add: field_simps) |
|
9446 done |
|
9447 qed |
|
9448 from bchoice[OF this] guess m .. note m=conjunctD2[OF this[rule_format],rule_format] |
|
9449 define d where "d x = c (m x) x" for x |
|
9450 show ?case |
|
9451 apply (rule_tac x=d in exI) |
|
9452 proof safe |
|
9453 show "gauge d" |
|
9454 using c(1) unfolding gauge_def d_def by auto |
|
9455 next |
|
9456 fix p |
|
9457 assume p: "p tagged_division_of (cbox a b)" "d fine p" |
|
9458 note p'=tagged_division_ofD[OF p(1)] |
|
9459 have "\<exists>a. \<forall>x\<in>p. m (fst x) \<le> a" |
|
9460 by (metis finite_imageI finite_nat_set_iff_bounded_le p'(1) rev_image_eqI) |
|
9461 then guess s .. note s=this |
|
9462 have *: "\<forall>a b c d. norm(a - b) \<le> e / 4 \<and> norm(b - c) < e / 2 \<and> |
|
9463 norm (c - d) < e / 4 \<longrightarrow> norm (a - d) < e" |
|
9464 proof (safe, goal_cases) |
|
9465 case (1 a b c d) |
|
9466 then show ?case |
|
9467 using norm_triangle_lt[of "a - b" "b - c" "3* e/4"] |
|
9468 norm_triangle_lt[of "a - b + (b - c)" "c - d" e] |
|
9469 unfolding norm_minus_cancel |
|
9470 by (auto simp add: algebra_simps) |
|
9471 qed |
|
9472 show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R g x) - i) < e" |
|
9473 apply (rule *[rule_format,where |
|
9474 b="\<Sum>(x, k)\<in>p. content k *\<^sub>R f (m x) x" and c="\<Sum>(x, k)\<in>p. integral k (f (m x))"]) |
|
9475 proof (safe, goal_cases) |
|
9476 case 1 |
|
9477 show ?case |
|
9478 apply (rule order_trans[of _ "\<Sum>(x, k)\<in>p. content k * (e / (4 * content (cbox a b)))"]) |
|
9479 unfolding setsum_subtractf[symmetric] |
|
9480 apply (rule order_trans) |
|
9481 apply (rule norm_setsum) |
|
9482 apply (rule setsum_mono) |
|
9483 unfolding split_paired_all split_conv |
|
9484 unfolding split_def setsum_left_distrib[symmetric] scaleR_diff_right[symmetric] |
|
9485 unfolding additive_content_tagged_division[OF p(1), unfolded split_def] |
|
9486 proof - |
|
9487 fix x k |
|
9488 assume xk: "(x, k) \<in> p" |
|
9489 then have x: "x \<in> cbox a b" |
|
9490 using p'(2-3)[OF xk] by auto |
|
9491 from p'(4)[OF xk] guess u v by (elim exE) note uv=this |
|
9492 show "norm (content k *\<^sub>R (g x - f (m x) x)) \<le> content k * (e / (4 * content (cbox a b)))" |
|
9493 unfolding norm_scaleR uv |
|
9494 unfolding abs_of_nonneg[OF content_pos_le] |
|
9495 apply (rule mult_left_mono) |
|
9496 using m(2)[OF x,of "m x"] |
|
9497 apply auto |
|
9498 done |
|
9499 qed (insert False, auto) |
|
9500 |
|
9501 next |
|
9502 case 2 |
|
9503 show ?case |
|
9504 apply (rule le_less_trans[of _ "norm (\<Sum>j = 0..s. |
|
9505 \<Sum>(x, k)\<in>{xk\<in>p. m (fst xk) = j}. content k *\<^sub>R f (m x) x - integral k (f (m x)))"]) |
|
9506 apply (subst setsum_group) |
|
9507 apply fact |
|
9508 apply (rule finite_atLeastAtMost) |
|
9509 defer |
|
9510 apply (subst split_def)+ |
|
9511 unfolding setsum_subtractf |
|
9512 apply rule |
|
9513 proof - |
|
9514 show "norm (\<Sum>j = 0..s. \<Sum>(x, k)\<in>{xk \<in> p. |
|
9515 m (fst xk) = j}. content k *\<^sub>R f (m x) x - integral k (f (m x))) < e / 2" |
|
9516 apply (rule le_less_trans[of _ "setsum (\<lambda>i. e / 2^(i+2)) {0..s}"]) |
|
9517 apply (rule setsum_norm_le) |
|
9518 proof |
|
9519 show "(\<Sum>i = 0..s. e / 2 ^ (i + 2)) < e / 2" |
|
9520 unfolding power_add divide_inverse inverse_mult_distrib |
|
9521 unfolding setsum_right_distrib[symmetric] setsum_left_distrib[symmetric] |
|
9522 unfolding power_inverse [symmetric] sum_gp |
|
9523 apply(rule mult_strict_left_mono[OF _ e]) |
|
9524 unfolding power2_eq_square |
|
9525 apply auto |
|
9526 done |
|
9527 fix t |
|
9528 assume "t \<in> {0..s}" |
|
9529 show "norm (\<Sum>(x, k)\<in>{xk \<in> p. m (fst xk) = t}. content k *\<^sub>R f (m x) x - |
|
9530 integral k (f (m x))) \<le> e / 2 ^ (t + 2)" |
|
9531 apply (rule order_trans |
|
9532 [of _ "norm (setsum (\<lambda>(x,k). content k *\<^sub>R f t x - integral k (f t)) {xk \<in> p. m (fst xk) = t})"]) |
|
9533 apply (rule eq_refl) |
|
9534 apply (rule arg_cong[where f=norm]) |
|
9535 apply (rule setsum.cong) |
|
9536 apply (rule refl) |
|
9537 defer |
|
9538 apply (rule henstock_lemma_part1) |
|
9539 apply (rule assms(1)[rule_format]) |
|
9540 apply (simp add: e) |
|
9541 apply safe |
|
9542 apply (rule c)+ |
|
9543 apply rule |
|
9544 apply assumption+ |
|
9545 apply (rule tagged_partial_division_subset[of p]) |
|
9546 apply (rule p(1)[unfolded tagged_division_of_def,THEN conjunct1]) |
|
9547 defer |
|
9548 unfolding fine_def |
|
9549 apply safe |
|
9550 apply (drule p(2)[unfolded fine_def,rule_format]) |
|
9551 unfolding d_def |
|
9552 apply auto |
|
9553 done |
|
9554 qed |
|
9555 qed (insert s, auto) |
|
9556 next |
|
9557 case 3 |
|
9558 note comb = integral_combine_tagged_division_topdown[OF assms(1)[rule_format] p(1)] |
|
9559 have *: "\<And>sr sx ss ks kr::real. kr = sr \<longrightarrow> ks = ss \<longrightarrow> |
|
9560 ks \<le> i \<and> sr \<le> sx \<and> sx \<le> ss \<and> 0 \<le> i\<bullet>1 - kr\<bullet>1 \<and> i\<bullet>1 - kr\<bullet>1 < e/4 \<longrightarrow> \<bar>sx - i\<bar> < e/4" |
|
9561 by auto |
|
9562 show ?case |
|
9563 unfolding real_norm_def |
|
9564 apply (rule *[rule_format]) |
|
9565 apply safe |
|
9566 apply (rule comb[of r]) |
|
9567 apply (rule comb[of s]) |
|
9568 apply (rule i'[unfolded real_inner_1_right]) |
|
9569 apply (rule_tac[1-2] setsum_mono) |
|
9570 unfolding split_paired_all split_conv |
|
9571 apply (rule_tac[1-2] integral_le[OF ]) |
|
9572 proof safe |
|
9573 show "0 \<le> i\<bullet>1 - (integral (cbox a b) (f r))\<bullet>1" |
|
9574 using r(1) by auto |
|
9575 show "i\<bullet>1 - (integral (cbox a b) (f r))\<bullet>1 < e / 4" |
|
9576 using r(2) by auto |
|
9577 fix x k |
|
9578 assume xk: "(x, k) \<in> p" |
|
9579 from p'(4)[OF this] guess u v by (elim exE) note uv=this |
|
9580 show "f r integrable_on k" |
|
9581 and "f s integrable_on k" |
|
9582 and "f (m x) integrable_on k" |
|
9583 and "f (m x) integrable_on k" |
|
9584 unfolding uv |
|
9585 apply (rule_tac[!] integrable_on_subcbox[OF assms(1)[rule_format]]) |
|
9586 using p'(3)[OF xk] |
|
9587 unfolding uv |
|
9588 apply auto |
|
9589 done |
|
9590 fix y |
|
9591 assume "y \<in> k" |
|
9592 then have "y \<in> cbox a b" |
|
9593 using p'(3)[OF xk] by auto |
|
9594 then have *: "\<And>m. \<forall>n\<ge>m. f m y \<le> f n y" |
|
9595 apply - |
|
9596 apply (rule transitive_stepwise_le) |
|
9597 using assms(2) |
|
9598 apply auto |
|
9599 done |
|
9600 show "f r y \<le> f (m x) y" and "f (m x) y \<le> f s y" |
|
9601 apply (rule_tac[!] *[rule_format]) |
|
9602 using s[rule_format,OF xk] m(1)[of x] p'(2-3)[OF xk] |
|
9603 apply auto |
|
9604 done |
|
9605 qed |
|
9606 qed |
|
9607 qed |
|
9608 qed note * = this |
|
9609 |
|
9610 have "integral (cbox a b) g = i" |
|
9611 by (rule integral_unique) (rule *) |
|
9612 then show ?thesis |
|
9613 using i * by auto |
|
9614 qed |
|
9615 |
|
9616 lemma monotone_convergence_increasing: |
|
9617 fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" |
|
9618 assumes "\<forall>k. (f k) integrable_on s" |
|
9619 and "\<forall>k. \<forall>x\<in>s. (f k x) \<le> (f (Suc k) x)" |
|
9620 and "\<forall>x\<in>s. ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially" |
|
9621 and "bounded {integral s (f k)| k. True}" |
|
9622 shows "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) \<longlongrightarrow> integral s g) sequentially" |
|
9623 proof - |
|
9624 have lem: "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) \<longlongrightarrow> integral s g) sequentially" |
|
9625 if "\<forall>k. \<forall>x\<in>s. 0 \<le> f k x" |
|
9626 and "\<forall>k. (f k) integrable_on s" |
|
9627 and "\<forall>k. \<forall>x\<in>s. f k x \<le> f (Suc k) x" |
|
9628 and "\<forall>x\<in>s. ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially" |
|
9629 and "bounded {integral s (f k)| k. True}" |
|
9630 for f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" and g s |
|
9631 proof - |
|
9632 note assms=that[rule_format] |
|
9633 have "\<forall>x\<in>s. \<forall>k. (f k x)\<bullet>1 \<le> (g x)\<bullet>1" |
|
9634 apply safe |
|
9635 apply (rule Lim_component_ge) |
|
9636 apply (rule that(4)[rule_format]) |
|
9637 apply assumption |
|
9638 apply (rule trivial_limit_sequentially) |
|
9639 unfolding eventually_sequentially |
|
9640 apply (rule_tac x=k in exI) |
|
9641 apply (rule transitive_stepwise_le) |
|
9642 using that(3) |
|
9643 apply auto |
|
9644 done |
|
9645 note fg=this[rule_format] |
|
9646 |
|
9647 have "\<exists>i. ((\<lambda>k. integral s (f k)) \<longlongrightarrow> i) sequentially" |
|
9648 apply (rule bounded_increasing_convergent) |
|
9649 apply (rule that(5)) |
|
9650 apply rule |
|
9651 apply (rule integral_le) |
|
9652 apply (rule that(2)[rule_format])+ |
|
9653 using that(3) |
|
9654 apply auto |
|
9655 done |
|
9656 then guess i .. note i=this |
|
9657 have "\<And>k. \<forall>x\<in>s. \<forall>n\<ge>k. f k x \<le> f n x" |
|
9658 apply rule |
|
9659 apply (rule transitive_stepwise_le) |
|
9660 using that(3) |
|
9661 apply auto |
|
9662 done |
|
9663 then have i': "\<forall>k. (integral s (f k))\<bullet>1 \<le> i\<bullet>1" |
|
9664 apply - |
|
9665 apply rule |
|
9666 apply (rule Lim_component_ge) |
|
9667 apply (rule i) |
|
9668 apply (rule trivial_limit_sequentially) |
|
9669 unfolding eventually_sequentially |
|
9670 apply (rule_tac x=k in exI) |
|
9671 apply safe |
|
9672 apply (rule integral_component_le) |
|
9673 apply simp |
|
9674 apply (rule that(2)[rule_format])+ |
|
9675 apply auto |
|
9676 done |
|
9677 |
|
9678 note int = assms(2)[unfolded integrable_alt[of _ s],THEN conjunct1,rule_format] |
|
9679 have ifif: "\<And>k t. (\<lambda>x. if x \<in> t then if x \<in> s then f k x else 0 else 0) = |
|
9680 (\<lambda>x. if x \<in> t \<inter> s then f k x else 0)" |
|
9681 by (rule ext) auto |
|
9682 have int': "\<And>k a b. f k integrable_on cbox a b \<inter> s" |
|
9683 apply (subst integrable_restrict_univ[symmetric]) |
|
9684 apply (subst ifif[symmetric]) |
|
9685 apply (subst integrable_restrict_univ) |
|
9686 apply (rule int) |
|
9687 done |
|
9688 have "\<And>a b. (\<lambda>x. if x \<in> s then g x else 0) integrable_on cbox a b \<and> |
|
9689 ((\<lambda>k. integral (cbox a b) (\<lambda>x. if x \<in> s then f k x else 0)) \<longlongrightarrow> |
|
9690 integral (cbox a b) (\<lambda>x. if x \<in> s then g x else 0)) sequentially" |
|
9691 proof (rule monotone_convergence_interval, safe, goal_cases) |
|
9692 case 1 |
|
9693 show ?case by (rule int) |
|
9694 next |
|
9695 case (2 _ _ _ x) |
|
9696 then show ?case |
|
9697 apply (cases "x \<in> s") |
|
9698 using assms(3) |
|
9699 apply auto |
|
9700 done |
|
9701 next |
|
9702 case (3 _ _ x) |
|
9703 then show ?case |
|
9704 apply (cases "x \<in> s") |
|
9705 using assms(4) |
|
9706 apply auto |
|
9707 done |
|
9708 next |
|
9709 case (4 a b) |
|
9710 note * = integral_nonneg |
|
9711 have "\<And>k. norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f k x else 0)) \<le> norm (integral s (f k))" |
|
9712 unfolding real_norm_def |
|
9713 apply (subst abs_of_nonneg) |
|
9714 apply (rule *[OF int]) |
|
9715 apply safe |
|
9716 apply (case_tac "x \<in> s") |
|
9717 apply (drule assms(1)) |
|
9718 prefer 3 |
|
9719 apply (subst abs_of_nonneg) |
|
9720 apply (rule *[OF assms(2) that(1)[THEN spec]]) |
|
9721 apply (subst integral_restrict_univ[symmetric,OF int]) |
|
9722 unfolding ifif |
|
9723 unfolding integral_restrict_univ[OF int'] |
|
9724 apply (rule integral_subset_le[OF _ int' assms(2)]) |
|
9725 using assms(1) |
|
9726 apply auto |
|
9727 done |
|
9728 then show ?case |
|
9729 using assms(5) |
|
9730 unfolding bounded_iff |
|
9731 apply safe |
|
9732 apply (rule_tac x=aa in exI) |
|
9733 apply safe |
|
9734 apply (erule_tac x="integral s (f k)" in ballE) |
|
9735 apply (rule order_trans) |
|
9736 apply assumption |
|
9737 apply auto |
|
9738 done |
|
9739 qed |
|
9740 note g = conjunctD2[OF this] |
|
9741 |
|
9742 have "(g has_integral i) s" |
|
9743 unfolding has_integral_alt' |
|
9744 apply safe |
|
9745 apply (rule g(1)) |
|
9746 proof goal_cases |
|
9747 case (1 e) |
|
9748 then have "e/4>0" |
|
9749 by auto |
|
9750 from LIMSEQ_D [OF i this] guess N .. note N=this |
|
9751 note assms(2)[of N,unfolded has_integral_integral has_integral_alt'[of "f N"]] |
|
9752 from this[THEN conjunct2,rule_format,OF \<open>e/4>0\<close>] guess B .. note B=conjunctD2[OF this] |
|
9753 show ?case |
|
9754 apply rule |
|
9755 apply rule |
|
9756 apply (rule B) |
|
9757 apply safe |
|
9758 proof - |
|
9759 fix a b :: 'n |
|
9760 assume ab: "ball 0 B \<subseteq> cbox a b" |
|
9761 from \<open>e > 0\<close> have "e/2 > 0" |
|
9762 by auto |
|
9763 from LIMSEQ_D [OF g(2)[of a b] this] guess M .. note M=this |
|
9764 have **: "norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f N x else 0) - i) < e/2" |
|
9765 apply (rule norm_triangle_half_l) |
|
9766 using B(2)[rule_format,OF ab] N[rule_format,of N] |
|
9767 apply - |
|
9768 defer |
|
9769 apply (subst norm_minus_commute) |
|
9770 apply auto |
|
9771 done |
|
9772 have *: "\<And>f1 f2 g. \<bar>f1 - i\<bar> < e / 2 \<longrightarrow> \<bar>f2 - g\<bar> < e / 2 \<longrightarrow> |
|
9773 f1 \<le> f2 \<longrightarrow> f2 \<le> i \<longrightarrow> \<bar>g - i\<bar> < e" |
|
9774 unfolding real_inner_1_right by arith |
|
9775 show "norm (integral (cbox a b) (\<lambda>x. if x \<in> s then g x else 0) - i) < e" |
|
9776 unfolding real_norm_def |
|
9777 apply (rule *[rule_format]) |
|
9778 apply (rule **[unfolded real_norm_def]) |
|
9779 apply (rule M[rule_format,of "M + N",unfolded real_norm_def]) |
|
9780 apply (rule le_add1) |
|
9781 apply (rule integral_le[OF int int]) |
|
9782 defer |
|
9783 apply (rule order_trans[OF _ i'[rule_format,of "M + N",unfolded real_inner_1_right]]) |
|
9784 proof (safe, goal_cases) |
|
9785 case (2 x) |
|
9786 have "\<And>m. x \<in> s \<Longrightarrow> \<forall>n\<ge>m. (f m x)\<bullet>1 \<le> (f n x)\<bullet>1" |
|
9787 apply (rule transitive_stepwise_le) |
|
9788 using assms(3) |
|
9789 apply auto |
|
9790 done |
|
9791 then show ?case |
|
9792 by auto |
|
9793 next |
|
9794 case 1 |
|
9795 show ?case |
|
9796 apply (subst integral_restrict_univ[symmetric,OF int]) |
|
9797 unfolding ifif integral_restrict_univ[OF int'] |
|
9798 apply (rule integral_subset_le[OF _ int']) |
|
9799 using assms |
|
9800 apply auto |
|
9801 done |
|
9802 qed |
|
9803 qed |
|
9804 qed |
|
9805 then show ?thesis |
|
9806 apply safe |
|
9807 defer |
|
9808 apply (drule integral_unique) |
|
9809 using i |
|
9810 apply auto |
|
9811 done |
|
9812 qed |
|
9813 |
|
9814 have sub: "\<And>k. integral s (\<lambda>x. f k x - f 0 x) = integral s (f k) - integral s (f 0)" |
|
9815 apply (subst integral_diff) |
|
9816 apply (rule assms(1)[rule_format])+ |
|
9817 apply rule |
|
9818 done |
|
9819 have "\<And>x m. x \<in> s \<Longrightarrow> \<forall>n\<ge>m. f m x \<le> f n x" |
|
9820 apply (rule transitive_stepwise_le) |
|
9821 using assms(2) |
|
9822 apply auto |
|
9823 done |
|
9824 note * = this[rule_format] |
|
9825 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> |
|
9826 integral s (\<lambda>x. g x - f 0 x)) sequentially" |
|
9827 apply (rule lem) |
|
9828 apply safe |
|
9829 proof goal_cases |
|
9830 case (1 k x) |
|
9831 then show ?case |
|
9832 using *[of x 0 "Suc k"] by auto |
|
9833 next |
|
9834 case (2 k) |
|
9835 then show ?case |
|
9836 apply (rule integrable_diff) |
|
9837 using assms(1) |
|
9838 apply auto |
|
9839 done |
|
9840 next |
|
9841 case (3 k x) |
|
9842 then show ?case |
|
9843 using *[of x "Suc k" "Suc (Suc k)"] by auto |
|
9844 next |
|
9845 case (4 x) |
|
9846 then show ?case |
|
9847 apply - |
|
9848 apply (rule tendsto_diff) |
|
9849 using LIMSEQ_ignore_initial_segment[OF assms(3)[rule_format],of x 1] |
|
9850 apply auto |
|
9851 done |
|
9852 next |
|
9853 case 5 |
|
9854 then show ?case |
|
9855 using assms(4) |
|
9856 unfolding bounded_iff |
|
9857 apply safe |
|
9858 apply (rule_tac x="a + norm (integral s (\<lambda>x. f 0 x))" in exI) |
|
9859 apply safe |
|
9860 apply (erule_tac x="integral s (\<lambda>x. f (Suc k) x)" in ballE) |
|
9861 unfolding sub |
|
9862 apply (rule order_trans[OF norm_triangle_ineq4]) |
|
9863 apply auto |
|
9864 done |
|
9865 qed |
|
9866 note conjunctD2[OF this] |
|
9867 note tendsto_add[OF this(2) tendsto_const[of "integral s (f 0)"]] |
|
9868 integrable_add[OF this(1) assms(1)[rule_format,of 0]] |
|
9869 then show ?thesis |
|
9870 unfolding sub |
|
9871 apply - |
|
9872 apply rule |
|
9873 defer |
|
9874 apply (subst(asm) integral_diff) |
|
9875 using assms(1) |
|
9876 apply auto |
|
9877 apply (rule LIMSEQ_imp_Suc) |
|
9878 apply assumption |
|
9879 done |
|
9880 qed |
|
9881 |
|
9882 lemma has_integral_monotone_convergence_increasing: |
|
9883 fixes f :: "nat \<Rightarrow> 'a::euclidean_space \<Rightarrow> real" |
|
9884 assumes f: "\<And>k. (f k has_integral x k) s" |
|
9885 assumes "\<And>k x. x \<in> s \<Longrightarrow> f k x \<le> f (Suc k) x" |
|
9886 assumes "\<And>x. x \<in> s \<Longrightarrow> (\<lambda>k. f k x) \<longlonglongrightarrow> g x" |
|
9887 assumes "x \<longlonglongrightarrow> x'" |
|
9888 shows "(g has_integral x') s" |
|
9889 proof - |
|
9890 have x_eq: "x = (\<lambda>i. integral s (f i))" |
|
9891 by (simp add: integral_unique[OF f]) |
|
9892 then have x: "{integral s (f k) |k. True} = range x" |
|
9893 by auto |
|
9894 |
|
9895 have *: "g integrable_on s \<and> (\<lambda>k. integral s (f k)) \<longlonglongrightarrow> integral s g" |
|
9896 proof (intro monotone_convergence_increasing allI ballI assms) |
|
9897 show "bounded {integral s (f k) |k. True}" |
|
9898 unfolding x by (rule convergent_imp_bounded) fact |
|
9899 qed (auto intro: f) |
|
9900 then have "integral s g = x'" |
|
9901 by (intro LIMSEQ_unique[OF _ \<open>x \<longlonglongrightarrow> x'\<close>]) (simp add: x_eq) |
|
9902 with * show ?thesis |
|
9903 by (simp add: has_integral_integral) |
|
9904 qed |
|
9905 |
|
9906 lemma monotone_convergence_decreasing: |
|
9907 fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" |
|
9908 assumes "\<forall>k. (f k) integrable_on s" |
|
9909 and "\<forall>k. \<forall>x\<in>s. f (Suc k) x \<le> f k x" |
|
9910 and "\<forall>x\<in>s. ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially" |
|
9911 and "bounded {integral s (f k)| k. True}" |
|
9912 shows "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) \<longlongrightarrow> integral s g) sequentially" |
|
9913 proof - |
|
9914 note assm = assms[rule_format] |
|
9915 have *: "{integral s (\<lambda>x. - f k x) |k. True} = op *\<^sub>R (- 1) ` {integral s (f k)| k. True}" |
|
9916 apply safe |
|
9917 unfolding image_iff |
|
9918 apply (rule_tac x="integral s (f k)" in bexI) |
|
9919 prefer 3 |
|
9920 apply (rule_tac x=k in exI) |
|
9921 apply auto |
|
9922 done |
|
9923 have "(\<lambda>x. - g x) integrable_on s \<and> |
|
9924 ((\<lambda>k. integral s (\<lambda>x. - f k x)) \<longlongrightarrow> integral s (\<lambda>x. - g x)) sequentially" |
|
9925 apply (rule monotone_convergence_increasing) |
|
9926 apply safe |
|
9927 apply (rule integrable_neg) |
|
9928 apply (rule assm) |
|
9929 defer |
|
9930 apply (rule tendsto_minus) |
|
9931 apply (rule assm) |
|
9932 apply assumption |
|
9933 unfolding * |
|
9934 apply (rule bounded_scaling) |
|
9935 using assm |
|
9936 apply auto |
|
9937 done |
|
9938 note * = conjunctD2[OF this] |
|
9939 show ?thesis |
|
9940 using integrable_neg[OF *(1)] tendsto_minus[OF *(2)] |
|
9941 by auto |
|
9942 qed |
|
9943 |
|
9944 |
|
9945 subsection \<open>Absolute integrability (this is the same as Lebesgue integrability)\<close> |
|
9946 |
|
9947 definition absolutely_integrable_on (infixr "absolutely'_integrable'_on" 46) |
|
9948 where "f absolutely_integrable_on s \<longleftrightarrow> f integrable_on s \<and> (\<lambda>x. (norm(f x))) integrable_on s" |
|
9949 |
|
9950 lemma absolutely_integrable_onI[intro?]: |
|
9951 "f integrable_on s \<Longrightarrow> |
|
9952 (\<lambda>x. (norm(f x))) integrable_on s \<Longrightarrow> f absolutely_integrable_on s" |
|
9953 unfolding absolutely_integrable_on_def |
|
9954 by auto |
|
9955 |
|
9956 lemma absolutely_integrable_onD[dest]: |
|
9957 assumes "f absolutely_integrable_on s" |
|
9958 shows "f integrable_on s" |
|
9959 and "(\<lambda>x. norm (f x)) integrable_on s" |
|
9960 using assms |
|
9961 unfolding absolutely_integrable_on_def |
|
9962 by auto |
|
9963 |
|
9964 (*lemma absolutely_integrable_on_trans[simp]: |
|
9965 fixes f::"'n::euclidean_space \<Rightarrow> real" |
|
9966 shows "(vec1 \<circ> f) absolutely_integrable_on s \<longleftrightarrow> f absolutely_integrable_on s" |
|
9967 unfolding absolutely_integrable_on_def o_def by auto*) |
|
9968 |
|
9969 lemma integral_norm_bound_integral: |
|
9970 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
9971 assumes "f integrable_on s" |
|
9972 and "g integrable_on s" |
|
9973 and "\<forall>x\<in>s. norm (f x) \<le> g x" |
|
9974 shows "norm (integral s f) \<le> integral s g" |
|
9975 proof - |
|
9976 have *: "\<And>x y. (\<forall>e::real. 0 < e \<longrightarrow> x < y + e) \<Longrightarrow> x \<le> y" |
|
9977 apply (rule ccontr) |
|
9978 apply (erule_tac x="x - y" in allE) |
|
9979 apply auto |
|
9980 done |
|
9981 have norm: "norm ig < dia + e" |
|
9982 if "norm sg \<le> dsa" |
|
9983 and "\<bar>dsa - dia\<bar> < e / 2" |
|
9984 and "norm (sg - ig) < e / 2" |
|
9985 for e dsa dia and sg ig :: 'a |
|
9986 apply (rule le_less_trans[OF norm_triangle_sub[of ig sg]]) |
|
9987 apply (subst real_sum_of_halves[of e,symmetric]) |
|
9988 unfolding add.assoc[symmetric] |
|
9989 apply (rule add_le_less_mono) |
|
9990 defer |
|
9991 apply (subst norm_minus_commute) |
|
9992 apply (rule that(3)) |
|
9993 apply (rule order_trans[OF that(1)]) |
|
9994 using that(2) |
|
9995 apply arith |
|
9996 done |
|
9997 have lem: "norm (integral(cbox a b) f) \<le> integral (cbox a b) g" |
|
9998 if "f integrable_on cbox a b" |
|
9999 and "g integrable_on cbox a b" |
|
10000 and "\<forall>x\<in>cbox a b. norm (f x) \<le> g x" |
|
10001 for f :: "'n \<Rightarrow> 'a" and g a b |
|
10002 proof (rule *[rule_format]) |
|
10003 fix e :: real |
|
10004 assume "e > 0" |
|
10005 then have *: "e/2 > 0" |
|
10006 by auto |
|
10007 from integrable_integral[OF that(1),unfolded has_integral[of f],rule_format,OF *] |
|
10008 guess d1 .. note d1 = conjunctD2[OF this,rule_format] |
|
10009 from integrable_integral[OF that(2),unfolded has_integral[of g],rule_format,OF *] |
|
10010 guess d2 .. note d2 = conjunctD2[OF this,rule_format] |
|
10011 note gauge_inter[OF d1(1) d2(1)] |
|
10012 from fine_division_exists[OF this, of a b] guess p . note p=this |
|
10013 show "norm (integral (cbox a b) f) < integral (cbox a b) g + e" |
|
10014 apply (rule norm) |
|
10015 defer |
|
10016 apply (rule d2(2)[OF conjI[OF p(1)],unfolded real_norm_def]) |
|
10017 defer |
|
10018 apply (rule d1(2)[OF conjI[OF p(1)]]) |
|
10019 defer |
|
10020 apply (rule setsum_norm_le) |
|
10021 proof safe |
|
10022 fix x k |
|
10023 assume "(x, k) \<in> p" |
|
10024 note as = tagged_division_ofD(2-4)[OF p(1) this] |
|
10025 from this(3) guess u v by (elim exE) note uv=this |
|
10026 show "norm (content k *\<^sub>R f x) \<le> content k *\<^sub>R g x" |
|
10027 unfolding uv norm_scaleR |
|
10028 unfolding abs_of_nonneg[OF content_pos_le] real_scaleR_def |
|
10029 apply (rule mult_left_mono) |
|
10030 using that(3) as |
|
10031 apply auto |
|
10032 done |
|
10033 qed (insert p[unfolded fine_inter], auto) |
|
10034 qed |
|
10035 |
|
10036 { presume "\<And>e. 0 < e \<Longrightarrow> norm (integral s f) < integral s g + e" |
|
10037 then show ?thesis by (rule *[rule_format]) auto } |
|
10038 fix e :: real |
|
10039 assume "e > 0" |
|
10040 then have e: "e/2 > 0" |
|
10041 by auto |
|
10042 note assms(1)[unfolded integrable_alt[of f]] note f=this[THEN conjunct1,rule_format] |
|
10043 note assms(2)[unfolded integrable_alt[of g]] note g=this[THEN conjunct1,rule_format] |
|
10044 from integrable_integral[OF assms(1),unfolded has_integral'[of f],rule_format,OF e] |
|
10045 guess B1 .. note B1=conjunctD2[OF this[rule_format],rule_format] |
|
10046 from integrable_integral[OF assms(2),unfolded has_integral'[of g],rule_format,OF e] |
|
10047 guess B2 .. note B2=conjunctD2[OF this[rule_format],rule_format] |
|
10048 from bounded_subset_cbox[OF bounded_ball, of "0::'n" "max B1 B2"] |
|
10049 guess a b by (elim exE) note ab=this[unfolded ball_max_Un] |
|
10050 |
|
10051 have "ball 0 B1 \<subseteq> cbox a b" |
|
10052 using ab by auto |
|
10053 from B1(2)[OF this] guess z .. note z=conjunctD2[OF this] |
|
10054 have "ball 0 B2 \<subseteq> cbox a b" |
|
10055 using ab by auto |
|
10056 from B2(2)[OF this] guess w .. note w=conjunctD2[OF this] |
|
10057 |
|
10058 show "norm (integral s f) < integral s g + e" |
|
10059 apply (rule norm) |
|
10060 apply (rule lem[OF f g, of a b]) |
|
10061 unfolding integral_unique[OF z(1)] integral_unique[OF w(1)] |
|
10062 defer |
|
10063 apply (rule w(2)[unfolded real_norm_def]) |
|
10064 apply (rule z(2)) |
|
10065 apply safe |
|
10066 apply (case_tac "x \<in> s") |
|
10067 unfolding if_P |
|
10068 apply (rule assms(3)[rule_format]) |
|
10069 apply auto |
|
10070 done |
|
10071 qed |
|
10072 |
|
10073 lemma integral_norm_bound_integral_component: |
|
10074 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
10075 fixes g :: "'n \<Rightarrow> 'b::euclidean_space" |
|
10076 assumes "f integrable_on s" |
|
10077 and "g integrable_on s" |
|
10078 and "\<forall>x\<in>s. norm(f x) \<le> (g x)\<bullet>k" |
|
10079 shows "norm (integral s f) \<le> (integral s g)\<bullet>k" |
|
10080 proof - |
|
10081 have "norm (integral s f) \<le> integral s ((\<lambda>x. x \<bullet> k) \<circ> g)" |
|
10082 apply (rule integral_norm_bound_integral[OF assms(1)]) |
|
10083 apply (rule integrable_linear[OF assms(2)]) |
|
10084 apply rule |
|
10085 unfolding o_def |
|
10086 apply (rule assms) |
|
10087 done |
|
10088 then show ?thesis |
|
10089 unfolding o_def integral_component_eq[OF assms(2)] . |
|
10090 qed |
|
10091 |
|
10092 lemma has_integral_norm_bound_integral_component: |
|
10093 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
10094 fixes g :: "'n \<Rightarrow> 'b::euclidean_space" |
|
10095 assumes "(f has_integral i) s" |
|
10096 and "(g has_integral j) s" |
|
10097 and "\<forall>x\<in>s. norm (f x) \<le> (g x)\<bullet>k" |
|
10098 shows "norm i \<le> j\<bullet>k" |
|
10099 using integral_norm_bound_integral_component[of f s g k] |
|
10100 unfolding integral_unique[OF assms(1)] integral_unique[OF assms(2)] |
|
10101 using assms |
|
10102 by auto |
|
10103 |
|
10104 lemma absolutely_integrable_le: |
|
10105 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
10106 assumes "f absolutely_integrable_on s" |
|
10107 shows "norm (integral s f) \<le> integral s (\<lambda>x. norm (f x))" |
|
10108 apply (rule integral_norm_bound_integral) |
|
10109 using assms |
|
10110 apply auto |
|
10111 done |
|
10112 |
|
10113 lemma absolutely_integrable_0[intro]: |
|
10114 "(\<lambda>x. 0) absolutely_integrable_on s" |
|
10115 unfolding absolutely_integrable_on_def |
|
10116 by auto |
|
10117 |
|
10118 lemma absolutely_integrable_cmul[intro]: |
|
10119 "f absolutely_integrable_on s \<Longrightarrow> |
|
10120 (\<lambda>x. c *\<^sub>R f x) absolutely_integrable_on s" |
|
10121 unfolding absolutely_integrable_on_def |
|
10122 using integrable_cmul[of f s c] |
|
10123 using integrable_cmul[of "\<lambda>x. norm (f x)" s "\<bar>c\<bar>"] |
|
10124 by auto |
|
10125 |
|
10126 lemma absolutely_integrable_neg[intro]: |
|
10127 "f absolutely_integrable_on s \<Longrightarrow> |
|
10128 (\<lambda>x. -f(x)) absolutely_integrable_on s" |
|
10129 apply (drule absolutely_integrable_cmul[where c="-1"]) |
|
10130 apply auto |
|
10131 done |
|
10132 |
|
10133 lemma absolutely_integrable_norm[intro]: |
|
10134 "f absolutely_integrable_on s \<Longrightarrow> |
|
10135 (\<lambda>x. norm (f x)) absolutely_integrable_on s" |
|
10136 unfolding absolutely_integrable_on_def |
|
10137 by auto |
|
10138 |
|
10139 lemma absolutely_integrable_abs[intro]: |
|
10140 "f absolutely_integrable_on s \<Longrightarrow> |
|
10141 (\<lambda>x. \<bar>f x::real\<bar>) absolutely_integrable_on s" |
|
10142 apply (drule absolutely_integrable_norm) |
|
10143 unfolding real_norm_def |
|
10144 apply assumption |
|
10145 done |
|
10146 |
|
10147 lemma absolutely_integrable_on_subinterval: |
|
10148 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
10149 shows "f absolutely_integrable_on s \<Longrightarrow> |
|
10150 cbox a b \<subseteq> s \<Longrightarrow> f absolutely_integrable_on cbox a b" |
|
10151 unfolding absolutely_integrable_on_def |
|
10152 by (metis integrable_on_subcbox) |
|
10153 |
|
10154 lemma absolutely_integrable_bounded_variation: |
|
10155 fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach" |
|
10156 assumes "f absolutely_integrable_on UNIV" |
|
10157 obtains B where "\<forall>d. d division_of (\<Union>d) \<longrightarrow> setsum (\<lambda>k. norm(integral k f)) d \<le> B" |
|
10158 apply (rule that[of "integral UNIV (\<lambda>x. norm (f x))"]) |
|
10159 apply safe |
|
10160 proof goal_cases |
|
10161 case prems: (1 d) |
|
10162 note d = division_ofD[OF prems(2)] |
|
10163 have "(\<Sum>k\<in>d. norm (integral k f)) \<le> (\<Sum>i\<in>d. integral i (\<lambda>x. norm (f x)))" |
|
10164 apply (rule setsum_mono,rule absolutely_integrable_le) |
|
10165 apply (drule d(4)) |
|
10166 apply safe |
|
10167 apply (rule absolutely_integrable_on_subinterval[OF assms]) |
|
10168 apply auto |
|
10169 done |
|
10170 also have "\<dots> \<le> integral (\<Union>d) (\<lambda>x. norm (f x))" |
|
10171 apply (subst integral_combine_division_topdown[OF _ prems(2)]) |
|
10172 using integrable_on_subdivision[OF prems(2)] |
|
10173 using assms |
|
10174 apply auto |
|
10175 done |
|
10176 also have "\<dots> \<le> integral UNIV (\<lambda>x. norm (f x))" |
|
10177 apply (rule integral_subset_le) |
|
10178 using integrable_on_subdivision[OF prems(2)] |
|
10179 using assms |
|
10180 apply auto |
|
10181 done |
|
10182 finally show ?case . |
|
10183 qed |
|
10184 |
|
10185 lemma helplemma: |
|
10186 assumes "setsum (\<lambda>x. norm (f x - g x)) s < e" |
|
10187 and "finite s" |
|
10188 shows "\<bar>setsum (\<lambda>x. norm(f x)) s - setsum (\<lambda>x. norm(g x)) s\<bar> < e" |
|
10189 unfolding setsum_subtractf[symmetric] |
|
10190 apply (rule le_less_trans[OF setsum_abs]) |
|
10191 apply (rule le_less_trans[OF _ assms(1)]) |
|
10192 apply (rule setsum_mono) |
|
10193 apply (rule norm_triangle_ineq3) |
|
10194 done |
|
10195 |
|
10196 lemma bounded_variation_absolutely_integrable_interval: |
|
10197 fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
10198 assumes f: "f integrable_on cbox a b" |
|
10199 and *: "\<forall>d. d division_of (cbox a b) \<longrightarrow> setsum (\<lambda>k. norm(integral k f)) d \<le> B" |
|
10200 shows "f absolutely_integrable_on cbox a b" |
|
10201 proof - |
|
10202 let ?f = "\<lambda>d. \<Sum>k\<in>d. norm (integral k f)" and ?D = "{d. d division_of (cbox a b)}" |
|
10203 have D_1: "?D \<noteq> {}" |
|
10204 by (rule elementary_interval[of a b]) auto |
|
10205 have D_2: "bdd_above (?f`?D)" |
|
10206 by (metis * mem_Collect_eq bdd_aboveI2) |
|
10207 note D = D_1 D_2 |
|
10208 let ?S = "SUP x:?D. ?f x" |
|
10209 show ?thesis |
|
10210 apply (rule absolutely_integrable_onI [OF f has_integral_integrable]) |
|
10211 apply (subst has_integral[of _ ?S]) |
|
10212 apply safe |
|
10213 proof goal_cases |
|
10214 case e: (1 e) |
|
10215 then have "?S - e / 2 < ?S" by simp |
|
10216 then obtain d where d: "d division_of (cbox a b)" "?S - e / 2 < (\<Sum>k\<in>d. norm (integral k f))" |
|
10217 unfolding less_cSUP_iff[OF D] by auto |
|
10218 note d' = division_ofD[OF this(1)] |
|
10219 |
|
10220 have "\<forall>x. \<exists>e>0. \<forall>i\<in>d. x \<notin> i \<longrightarrow> ball x e \<inter> i = {}" |
|
10221 proof |
|
10222 fix x |
|
10223 have "\<exists>da>0. \<forall>xa\<in>\<Union>{i \<in> d. x \<notin> i}. da \<le> dist x xa" |
|
10224 apply (rule separate_point_closed) |
|
10225 apply (rule closed_Union) |
|
10226 apply (rule finite_subset[OF _ d'(1)]) |
|
10227 using d'(4) |
|
10228 apply auto |
|
10229 done |
|
10230 then show "\<exists>e>0. \<forall>i\<in>d. x \<notin> i \<longrightarrow> ball x e \<inter> i = {}" |
|
10231 by force |
|
10232 qed |
|
10233 from choice[OF this] guess k .. note k=conjunctD2[OF this[rule_format],rule_format] |
|
10234 |
|
10235 have "e/2 > 0" |
|
10236 using e by auto |
|
10237 from henstock_lemma[OF assms(1) this] guess g . note g=this[rule_format] |
|
10238 let ?g = "\<lambda>x. g x \<inter> ball x (k x)" |
|
10239 show ?case |
|
10240 apply (rule_tac x="?g" in exI) |
|
10241 apply safe |
|
10242 proof - |
|
10243 show "gauge ?g" |
|
10244 using g(1) k(1) |
|
10245 unfolding gauge_def |
|
10246 by auto |
|
10247 fix p |
|
10248 assume "p tagged_division_of (cbox a b)" and "?g fine p" |
|
10249 note p = this(1) conjunctD2[OF this(2)[unfolded fine_inter]] |
|
10250 note p' = tagged_division_ofD[OF p(1)] |
|
10251 define p' where "p' = {(x,k) | x k. \<exists>i l. x \<in> i \<and> i \<in> d \<and> (x,l) \<in> p \<and> k = i \<inter> l}" |
|
10252 have gp': "g fine p'" |
|
10253 using p(2) |
|
10254 unfolding p'_def fine_def |
|
10255 by auto |
|
10256 have p'': "p' tagged_division_of (cbox a b)" |
|
10257 apply (rule tagged_division_ofI) |
|
10258 proof - |
|
10259 show "finite p'" |
|
10260 apply (rule finite_subset[of _ "(\<lambda>(k,(x,l)). (x,k \<inter> l)) ` |
|
10261 {(k,xl) | k xl. k \<in> d \<and> xl \<in> p}"]) |
|
10262 unfolding p'_def |
|
10263 defer |
|
10264 apply (rule finite_imageI,rule finite_product_dependent[OF d'(1) p'(1)]) |
|
10265 apply safe |
|
10266 unfolding image_iff |
|
10267 apply (rule_tac x="(i,x,l)" in bexI) |
|
10268 apply auto |
|
10269 done |
|
10270 fix x k |
|
10271 assume "(x, k) \<in> p'" |
|
10272 then have "\<exists>i l. x \<in> i \<and> i \<in> d \<and> (x, l) \<in> p \<and> k = i \<inter> l" |
|
10273 unfolding p'_def by auto |
|
10274 then guess i l by (elim exE) note il=conjunctD4[OF this] |
|
10275 show "x \<in> k" and "k \<subseteq> cbox a b" |
|
10276 using p'(2-3)[OF il(3)] il by auto |
|
10277 show "\<exists>a b. k = cbox a b" |
|
10278 unfolding il using p'(4)[OF il(3)] d'(4)[OF il(2)] |
|
10279 apply safe |
|
10280 unfolding inter_interval |
|
10281 apply auto |
|
10282 done |
|
10283 next |
|
10284 fix x1 k1 |
|
10285 assume "(x1, k1) \<in> p'" |
|
10286 then have "\<exists>i l. x1 \<in> i \<and> i \<in> d \<and> (x1, l) \<in> p \<and> k1 = i \<inter> l" |
|
10287 unfolding p'_def by auto |
|
10288 then guess i1 l1 by (elim exE) note il1=conjunctD4[OF this] |
|
10289 fix x2 k2 |
|
10290 assume "(x2,k2)\<in>p'" |
|
10291 then have "\<exists>i l. x2 \<in> i \<and> i \<in> d \<and> (x2, l) \<in> p \<and> k2 = i \<inter> l" |
|
10292 unfolding p'_def by auto |
|
10293 then guess i2 l2 by (elim exE) note il2=conjunctD4[OF this] |
|
10294 assume "(x1, k1) \<noteq> (x2, k2)" |
|
10295 then have "interior i1 \<inter> interior i2 = {} \<or> interior l1 \<inter> interior l2 = {}" |
|
10296 using d'(5)[OF il1(2) il2(2)] p'(5)[OF il1(3) il2(3)] |
|
10297 unfolding il1 il2 |
|
10298 by auto |
|
10299 then show "interior k1 \<inter> interior k2 = {}" |
|
10300 unfolding il1 il2 by auto |
|
10301 next |
|
10302 have *: "\<forall>(x, X) \<in> p'. X \<subseteq> cbox a b" |
|
10303 unfolding p'_def using d' by auto |
|
10304 show "\<Union>{k. \<exists>x. (x, k) \<in> p'} = cbox a b" |
|
10305 apply rule |
|
10306 apply (rule Union_least) |
|
10307 unfolding mem_Collect_eq |
|
10308 apply (erule exE) |
|
10309 apply (drule *[rule_format]) |
|
10310 apply safe |
|
10311 proof - |
|
10312 fix y |
|
10313 assume y: "y \<in> cbox a b" |
|
10314 then have "\<exists>x l. (x, l) \<in> p \<and> y\<in>l" |
|
10315 unfolding p'(6)[symmetric] by auto |
|
10316 then guess x l by (elim exE) note xl=conjunctD2[OF this] |
|
10317 then have "\<exists>k. k \<in> d \<and> y \<in> k" |
|
10318 using y unfolding d'(6)[symmetric] by auto |
|
10319 then guess i .. note i = conjunctD2[OF this] |
|
10320 have "x \<in> i" |
|
10321 using fineD[OF p(3) xl(1)] |
|
10322 using k(2)[OF i(1), of x] |
|
10323 using i(2) xl(2) |
|
10324 by auto |
|
10325 then show "y \<in> \<Union>{k. \<exists>x. (x, k) \<in> p'}" |
|
10326 unfolding p'_def Union_iff |
|
10327 apply (rule_tac x="i \<inter> l" in bexI) |
|
10328 using i xl |
|
10329 apply auto |
|
10330 done |
|
10331 qed |
|
10332 qed |
|
10333 |
|
10334 then have "(\<Sum>(x, k)\<in>p'. norm (content k *\<^sub>R f x - integral k f)) < e / 2" |
|
10335 apply - |
|
10336 apply (rule g(2)[rule_format]) |
|
10337 unfolding tagged_division_of_def |
|
10338 apply safe |
|
10339 apply (rule gp') |
|
10340 done |
|
10341 then have **: "\<bar>(\<Sum>(x,k)\<in>p'. norm (content k *\<^sub>R f x)) - (\<Sum>(x,k)\<in>p'. norm (integral k f))\<bar> < e / 2" |
|
10342 unfolding split_def |
|
10343 using p'' |
|
10344 by (force intro!: helplemma) |
|
10345 |
|
10346 have p'alt: "p' = {(x,(i \<inter> l)) | x i l. (x,l) \<in> p \<and> i \<in> d \<and> i \<inter> l \<noteq> {}}" |
|
10347 proof (safe, goal_cases) |
|
10348 case prems: (2 _ _ x i l) |
|
10349 have "x \<in> i" |
|
10350 using fineD[OF p(3) prems(1)] k(2)[OF prems(2), of x] prems(4-) |
|
10351 by auto |
|
10352 then have "(x, i \<inter> l) \<in> p'" |
|
10353 unfolding p'_def |
|
10354 using prems |
|
10355 apply safe |
|
10356 apply (rule_tac x=x in exI) |
|
10357 apply (rule_tac x="i \<inter> l" in exI) |
|
10358 apply safe |
|
10359 using prems |
|
10360 apply auto |
|
10361 done |
|
10362 then show ?case |
|
10363 using prems(3) by auto |
|
10364 next |
|
10365 fix x k |
|
10366 assume "(x, k) \<in> p'" |
|
10367 then have "\<exists>i l. x \<in> i \<and> i \<in> d \<and> (x, l) \<in> p \<and> k = i \<inter> l" |
|
10368 unfolding p'_def by auto |
|
10369 then guess i l by (elim exE) note il=conjunctD4[OF this] |
|
10370 then show "\<exists>y i l. (x, k) = (y, i \<inter> l) \<and> (y, l) \<in> p \<and> i \<in> d \<and> i \<inter> l \<noteq> {}" |
|
10371 apply (rule_tac x=x in exI) |
|
10372 apply (rule_tac x=i in exI) |
|
10373 apply (rule_tac x=l in exI) |
|
10374 using p'(2)[OF il(3)] |
|
10375 apply auto |
|
10376 done |
|
10377 qed |
|
10378 have sum_p': "(\<Sum>(x, k)\<in>p'. norm (integral k f)) = (\<Sum>k\<in>snd ` p'. norm (integral k f))" |
|
10379 apply (subst setsum.over_tagged_division_lemma[OF p'',of "\<lambda>k. norm (integral k f)"]) |
|
10380 unfolding norm_eq_zero |
|
10381 apply (rule integral_null) |
|
10382 apply assumption |
|
10383 apply rule |
|
10384 done |
|
10385 note snd_p = division_ofD[OF division_of_tagged_division[OF p(1)]] |
|
10386 |
|
10387 have *: "\<And>sni sni' sf sf'. \<bar>sf' - sni'\<bar> < e / 2 \<longrightarrow> ?S - e / 2 < sni \<and> sni' \<le> ?S \<and> |
|
10388 sni \<le> sni' \<and> sf' = sf \<longrightarrow> \<bar>sf - ?S\<bar> < e" |
|
10389 by arith |
|
10390 show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - ?S) < e" |
|
10391 unfolding real_norm_def |
|
10392 apply (rule *[rule_format,OF **]) |
|
10393 apply safe |
|
10394 apply(rule d(2)) |
|
10395 proof goal_cases |
|
10396 case 1 |
|
10397 show ?case |
|
10398 by (auto simp: sum_p' division_of_tagged_division[OF p''] D intro!: cSUP_upper) |
|
10399 next |
|
10400 case 2 |
|
10401 have *: "{k \<inter> l | k l. k \<in> d \<and> l \<in> snd ` p} = |
|
10402 (\<lambda>(k,l). k \<inter> l) ` {(k,l)|k l. k \<in> d \<and> l \<in> snd ` p}" |
|
10403 by auto |
|
10404 have "(\<Sum>k\<in>d. norm (integral k f)) \<le> (\<Sum>i\<in>d. \<Sum>l\<in>snd ` p. norm (integral (i \<inter> l) f))" |
|
10405 proof (rule setsum_mono, goal_cases) |
|
10406 case k: (1 k) |
|
10407 from d'(4)[OF this] guess u v by (elim exE) note uv=this |
|
10408 define d' where "d' = {cbox u v \<inter> l |l. l \<in> snd ` p \<and> cbox u v \<inter> l \<noteq> {}}" |
|
10409 note uvab = d'(2)[OF k[unfolded uv]] |
|
10410 have "d' division_of cbox u v" |
|
10411 apply (subst d'_def) |
|
10412 apply (rule division_inter_1) |
|
10413 apply (rule division_of_tagged_division[OF p(1)]) |
|
10414 apply (rule uvab) |
|
10415 done |
|
10416 then have "norm (integral k f) \<le> setsum (\<lambda>k. norm (integral k f)) d'" |
|
10417 unfolding uv |
|
10418 apply (subst integral_combine_division_topdown[of _ _ d']) |
|
10419 apply (rule integrable_on_subcbox[OF assms(1) uvab]) |
|
10420 apply assumption |
|
10421 apply (rule setsum_norm_le) |
|
10422 apply auto |
|
10423 done |
|
10424 also have "\<dots> = (\<Sum>k\<in>{k \<inter> l |l. l \<in> snd ` p}. norm (integral k f))" |
|
10425 apply (rule setsum.mono_neutral_left) |
|
10426 apply (subst simple_image) |
|
10427 apply (rule finite_imageI)+ |
|
10428 apply fact |
|
10429 unfolding d'_def uv |
|
10430 apply blast |
|
10431 proof (rule, goal_cases) |
|
10432 case prems: (1 i) |
|
10433 then have "i \<in> {cbox u v \<inter> l |l. l \<in> snd ` p}" |
|
10434 by auto |
|
10435 from this[unfolded mem_Collect_eq] guess l .. note l=this |
|
10436 then have "cbox u v \<inter> l = {}" |
|
10437 using prems by auto |
|
10438 then show ?case |
|
10439 using l by auto |
|
10440 qed |
|
10441 also have "\<dots> = (\<Sum>l\<in>snd ` p. norm (integral (k \<inter> l) f))" |
|
10442 unfolding simple_image |
|
10443 apply (rule setsum.reindex_nontrivial [unfolded o_def]) |
|
10444 apply (rule finite_imageI) |
|
10445 apply (rule p') |
|
10446 proof goal_cases |
|
10447 case prems: (1 l y) |
|
10448 have "interior (k \<inter> l) \<subseteq> interior (l \<inter> y)" |
|
10449 apply (subst(2) interior_Int) |
|
10450 apply (rule Int_greatest) |
|
10451 defer |
|
10452 apply (subst prems(4)) |
|
10453 apply auto |
|
10454 done |
|
10455 then have *: "interior (k \<inter> l) = {}" |
|
10456 using snd_p(5)[OF prems(1-3)] by auto |
|
10457 from d'(4)[OF k] snd_p(4)[OF prems(1)] guess u1 v1 u2 v2 by (elim exE) note uv=this |
|
10458 show ?case |
|
10459 using * |
|
10460 unfolding uv inter_interval content_eq_0_interior[symmetric] |
|
10461 by auto |
|
10462 qed |
|
10463 finally show ?case . |
|
10464 qed |
|
10465 also have "\<dots> = (\<Sum>(i,l)\<in>{(i, l) |i l. i \<in> d \<and> l \<in> snd ` p}. norm (integral (i\<inter>l) f))" |
|
10466 apply (subst sum_sum_product[symmetric]) |
|
10467 apply fact |
|
10468 using p'(1) |
|
10469 apply auto |
|
10470 done |
|
10471 also have "\<dots> = (\<Sum>x\<in>{(i, l) |i l. i \<in> d \<and> l \<in> snd ` p}. norm (integral (case_prod op \<inter> x) f))" |
|
10472 unfolding split_def .. |
|
10473 also have "\<dots> = (\<Sum>k\<in>{i \<inter> l |i l. i \<in> d \<and> l \<in> snd ` p}. norm (integral k f))" |
|
10474 unfolding * |
|
10475 apply (rule setsum.reindex_nontrivial [symmetric, unfolded o_def]) |
|
10476 apply (rule finite_product_dependent) |
|
10477 apply fact |
|
10478 apply (rule finite_imageI) |
|
10479 apply (rule p') |
|
10480 unfolding split_paired_all mem_Collect_eq split_conv o_def |
|
10481 proof - |
|
10482 note * = division_ofD(4,5)[OF division_of_tagged_division,OF p(1)] |
|
10483 fix l1 l2 k1 k2 |
|
10484 assume as: |
|
10485 "(l1, k1) \<noteq> (l2, k2)" |
|
10486 "l1 \<inter> k1 = l2 \<inter> k2" |
|
10487 "\<exists>i l. (l1, k1) = (i, l) \<and> i \<in> d \<and> l \<in> snd ` p" |
|
10488 "\<exists>i l. (l2, k2) = (i, l) \<and> i \<in> d \<and> l \<in> snd ` p" |
|
10489 then have "l1 \<in> d" and "k1 \<in> snd ` p" |
|
10490 by auto from d'(4)[OF this(1)] *(1)[OF this(2)] |
|
10491 guess u1 v1 u2 v2 by (elim exE) note uv=this |
|
10492 have "l1 \<noteq> l2 \<or> k1 \<noteq> k2" |
|
10493 using as by auto |
|
10494 then have "interior k1 \<inter> interior k2 = {} \<or> interior l1 \<inter> interior l2 = {}" |
|
10495 apply - |
|
10496 apply (erule disjE) |
|
10497 apply (rule disjI2) |
|
10498 apply (rule d'(5)) |
|
10499 prefer 4 |
|
10500 apply (rule disjI1) |
|
10501 apply (rule *) |
|
10502 using as |
|
10503 apply auto |
|
10504 done |
|
10505 moreover have "interior (l1 \<inter> k1) = interior (l2 \<inter> k2)" |
|
10506 using as(2) by auto |
|
10507 ultimately have "interior(l1 \<inter> k1) = {}" |
|
10508 by auto |
|
10509 then show "norm (integral (l1 \<inter> k1) f) = 0" |
|
10510 unfolding uv inter_interval |
|
10511 unfolding content_eq_0_interior[symmetric] |
|
10512 by auto |
|
10513 qed |
|
10514 also have "\<dots> = (\<Sum>(x, k)\<in>p'. norm (integral k f))" |
|
10515 unfolding sum_p' |
|
10516 apply (rule setsum.mono_neutral_right) |
|
10517 apply (subst *) |
|
10518 apply (rule finite_imageI[OF finite_product_dependent]) |
|
10519 apply fact |
|
10520 apply (rule finite_imageI[OF p'(1)]) |
|
10521 apply safe |
|
10522 proof goal_cases |
|
10523 case (2 i ia l a b) |
|
10524 then have "ia \<inter> b = {}" |
|
10525 unfolding p'alt image_iff Bex_def not_ex |
|
10526 apply (erule_tac x="(a, ia \<inter> b)" in allE) |
|
10527 apply auto |
|
10528 done |
|
10529 then show ?case |
|
10530 by auto |
|
10531 next |
|
10532 case (1 x a b) |
|
10533 then show ?case |
|
10534 unfolding p'_def |
|
10535 apply safe |
|
10536 apply (rule_tac x=i in exI) |
|
10537 apply (rule_tac x=l in exI) |
|
10538 unfolding snd_conv image_iff |
|
10539 apply safe |
|
10540 apply (rule_tac x="(a,l)" in bexI) |
|
10541 apply auto |
|
10542 done |
|
10543 qed |
|
10544 finally show ?case . |
|
10545 next |
|
10546 case 3 |
|
10547 let ?S = "{(x, i \<inter> l) |x i l. (x, l) \<in> p \<and> i \<in> d}" |
|
10548 have Sigma_alt: "\<And>s t. s \<times> t = {(i, j) |i j. i \<in> s \<and> j \<in> t}" |
|
10549 by auto |
|
10550 have *: "?S = (\<lambda>(xl,i). (fst xl, snd xl \<inter> i)) ` (p \<times> d)" |
|
10551 apply safe |
|
10552 unfolding image_iff |
|
10553 apply (rule_tac x="((x,l),i)" in bexI) |
|
10554 apply auto |
|
10555 done |
|
10556 note pdfin = finite_cartesian_product[OF p'(1) d'(1)] |
|
10557 have "(\<Sum>(x, k)\<in>p'. norm (content k *\<^sub>R f x)) = (\<Sum>(x, k)\<in>?S. \<bar>content k\<bar> * norm (f x))" |
|
10558 unfolding norm_scaleR |
|
10559 apply (rule setsum.mono_neutral_left) |
|
10560 apply (subst *) |
|
10561 apply (rule finite_imageI) |
|
10562 apply fact |
|
10563 unfolding p'alt |
|
10564 apply blast |
|
10565 apply safe |
|
10566 apply (rule_tac x=x in exI) |
|
10567 apply (rule_tac x=i in exI) |
|
10568 apply (rule_tac x=l in exI) |
|
10569 apply auto |
|
10570 done |
|
10571 also have "\<dots> = (\<Sum>((x,l),i)\<in>p \<times> d. \<bar>content (l \<inter> i)\<bar> * norm (f x))" |
|
10572 unfolding * |
|
10573 apply (subst setsum.reindex_nontrivial) |
|
10574 apply fact |
|
10575 unfolding split_paired_all |
|
10576 unfolding o_def split_def snd_conv fst_conv mem_Sigma_iff prod.inject |
|
10577 apply (elim conjE) |
|
10578 proof - |
|
10579 fix x1 l1 k1 x2 l2 k2 |
|
10580 assume as: "(x1, l1) \<in> p" "(x2, l2) \<in> p" "k1 \<in> d" "k2 \<in> d" |
|
10581 "x1 = x2" "l1 \<inter> k1 = l2 \<inter> k2" "\<not> ((x1 = x2 \<and> l1 = l2) \<and> k1 = k2)" |
|
10582 from d'(4)[OF as(3)] p'(4)[OF as(1)] guess u1 v1 u2 v2 by (elim exE) note uv=this |
|
10583 from as have "l1 \<noteq> l2 \<or> k1 \<noteq> k2" |
|
10584 by auto |
|
10585 then have "interior k1 \<inter> interior k2 = {} \<or> interior l1 \<inter> interior l2 = {}" |
|
10586 apply - |
|
10587 apply (erule disjE) |
|
10588 apply (rule disjI2) |
|
10589 defer |
|
10590 apply (rule disjI1) |
|
10591 apply (rule d'(5)[OF as(3-4)]) |
|
10592 apply assumption |
|
10593 apply (rule p'(5)[OF as(1-2)]) |
|
10594 apply auto |
|
10595 done |
|
10596 moreover have "interior (l1 \<inter> k1) = interior (l2 \<inter> k2)" |
|
10597 unfolding as .. |
|
10598 ultimately have "interior (l1 \<inter> k1) = {}" |
|
10599 by auto |
|
10600 then show "\<bar>content (l1 \<inter> k1)\<bar> * norm (f x1) = 0" |
|
10601 unfolding uv inter_interval |
|
10602 unfolding content_eq_0_interior[symmetric] |
|
10603 by auto |
|
10604 qed safe |
|
10605 also have "\<dots> = (\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x))" |
|
10606 unfolding Sigma_alt |
|
10607 apply (subst sum_sum_product[symmetric]) |
|
10608 apply (rule p') |
|
10609 apply rule |
|
10610 apply (rule d') |
|
10611 apply (rule setsum.cong) |
|
10612 apply (rule refl) |
|
10613 unfolding split_paired_all split_conv |
|
10614 proof - |
|
10615 fix x l |
|
10616 assume as: "(x, l) \<in> p" |
|
10617 note xl = p'(2-4)[OF this] |
|
10618 from this(3) guess u v by (elim exE) note uv=this |
|
10619 have "(\<Sum>i\<in>d. \<bar>content (l \<inter> i)\<bar>) = (\<Sum>k\<in>d. content (k \<inter> cbox u v))" |
|
10620 apply (rule setsum.cong) |
|
10621 apply (rule refl) |
|
10622 apply (drule d'(4)) |
|
10623 apply safe |
|
10624 apply (subst Int_commute) |
|
10625 unfolding inter_interval uv |
|
10626 apply (subst abs_of_nonneg) |
|
10627 apply auto |
|
10628 done |
|
10629 also have "\<dots> = setsum content {k \<inter> cbox u v| k. k \<in> d}" |
|
10630 unfolding simple_image |
|
10631 apply (rule setsum.reindex_nontrivial [unfolded o_def, symmetric]) |
|
10632 apply (rule d') |
|
10633 proof goal_cases |
|
10634 case prems: (1 k y) |
|
10635 from d'(4)[OF this(1)] d'(4)[OF this(2)] |
|
10636 guess u1 v1 u2 v2 by (elim exE) note uv=this |
|
10637 have "{} = interior ((k \<inter> y) \<inter> cbox u v)" |
|
10638 apply (subst interior_Int) |
|
10639 using d'(5)[OF prems(1-3)] |
|
10640 apply auto |
|
10641 done |
|
10642 also have "\<dots> = interior (y \<inter> (k \<inter> cbox u v))" |
|
10643 by auto |
|
10644 also have "\<dots> = interior (k \<inter> cbox u v)" |
|
10645 unfolding prems(4) by auto |
|
10646 finally show ?case |
|
10647 unfolding uv inter_interval content_eq_0_interior .. |
|
10648 qed |
|
10649 also have "\<dots> = setsum content {cbox u v \<inter> k |k. k \<in> d \<and> cbox u v \<inter> k \<noteq> {}}" |
|
10650 apply (rule setsum.mono_neutral_right) |
|
10651 unfolding simple_image |
|
10652 apply (rule finite_imageI) |
|
10653 apply (rule d') |
|
10654 apply blast |
|
10655 apply safe |
|
10656 apply (rule_tac x=k in exI) |
|
10657 proof goal_cases |
|
10658 case prems: (1 i k) |
|
10659 from d'(4)[OF this(1)] guess a b by (elim exE) note ab=this |
|
10660 have "interior (k \<inter> cbox u v) \<noteq> {}" |
|
10661 using prems(2) |
|
10662 unfolding ab inter_interval content_eq_0_interior |
|
10663 by auto |
|
10664 then show ?case |
|
10665 using prems(1) |
|
10666 using interior_subset[of "k \<inter> cbox u v"] |
|
10667 by auto |
|
10668 qed |
|
10669 finally show "(\<Sum>i\<in>d. \<bar>content (l \<inter> i)\<bar> * norm (f x)) = content l *\<^sub>R norm (f x)" |
|
10670 unfolding setsum_left_distrib[symmetric] real_scaleR_def |
|
10671 apply (subst(asm) additive_content_division[OF division_inter_1[OF d(1)]]) |
|
10672 using xl(2)[unfolded uv] |
|
10673 unfolding uv |
|
10674 apply auto |
|
10675 done |
|
10676 qed |
|
10677 finally show ?case . |
|
10678 qed |
|
10679 qed |
|
10680 qed |
|
10681 qed |
|
10682 |
|
10683 lemma bounded_variation_absolutely_integrable: |
|
10684 fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
10685 assumes "f integrable_on UNIV" |
|
10686 and "\<forall>d. d division_of (\<Union>d) \<longrightarrow> setsum (\<lambda>k. norm (integral k f)) d \<le> B" |
|
10687 shows "f absolutely_integrable_on UNIV" |
|
10688 proof (rule absolutely_integrable_onI, fact, rule) |
|
10689 let ?f = "\<lambda>d. \<Sum>k\<in>d. norm (integral k f)" and ?D = "{d. d division_of (\<Union>d)}" |
|
10690 have D_1: "?D \<noteq> {}" |
|
10691 by (rule elementary_interval) auto |
|
10692 have D_2: "bdd_above (?f`?D)" |
|
10693 by (intro bdd_aboveI2[where M=B] assms(2)[rule_format]) simp |
|
10694 note D = D_1 D_2 |
|
10695 let ?S = "SUP d:?D. ?f d" |
|
10696 have f_int: "\<And>a b. f absolutely_integrable_on cbox a b" |
|
10697 apply (rule bounded_variation_absolutely_integrable_interval[where B=B]) |
|
10698 apply (rule integrable_on_subcbox[OF assms(1)]) |
|
10699 defer |
|
10700 apply safe |
|
10701 apply (rule assms(2)[rule_format]) |
|
10702 apply auto |
|
10703 done |
|
10704 show "((\<lambda>x. norm (f x)) has_integral ?S) UNIV" |
|
10705 apply (subst has_integral_alt') |
|
10706 apply safe |
|
10707 proof goal_cases |
|
10708 case (1 a b) |
|
10709 show ?case |
|
10710 using f_int[of a b] by auto |
|
10711 next |
|
10712 case prems: (2 e) |
|
10713 have "\<exists>y\<in>setsum (\<lambda>k. norm (integral k f)) ` {d. d division_of \<Union>d}. \<not> y \<le> ?S - e" |
|
10714 proof (rule ccontr) |
|
10715 assume "\<not> ?thesis" |
|
10716 then have "?S \<le> ?S - e" |
|
10717 by (intro cSUP_least[OF D(1)]) auto |
|
10718 then show False |
|
10719 using prems by auto |
|
10720 qed |
|
10721 then obtain K where *: "\<exists>x\<in>{d. d division_of \<Union>d}. K = (\<Sum>k\<in>x. norm (integral k f))" |
|
10722 "SUPREMUM {d. d division_of \<Union>d} (setsum (\<lambda>k. norm (integral k f))) - e < K" |
|
10723 by (auto simp add: image_iff not_le) |
|
10724 from this(1) obtain d where "d division_of \<Union>d" |
|
10725 and "K = (\<Sum>k\<in>d. norm (integral k f))" |
|
10726 by auto |
|
10727 note d = this(1) *(2)[unfolded this(2)] |
|
10728 note d'=division_ofD[OF this(1)] |
|
10729 have "bounded (\<Union>d)" |
|
10730 by (rule elementary_bounded,fact) |
|
10731 from this[unfolded bounded_pos] obtain K where |
|
10732 K: "0 < K" "\<forall>x\<in>\<Union>d. norm x \<le> K" by auto |
|
10733 show ?case |
|
10734 apply (rule_tac x="K + 1" in exI) |
|
10735 apply safe |
|
10736 proof - |
|
10737 fix a b :: 'n |
|
10738 assume ab: "ball 0 (K + 1) \<subseteq> cbox a b" |
|
10739 have *: "\<forall>s s1. ?S - e < s1 \<and> s1 \<le> s \<and> s < ?S + e \<longrightarrow> \<bar>s - ?S\<bar> < e" |
|
10740 by arith |
|
10741 show "norm (integral (cbox a b) (\<lambda>x. if x \<in> UNIV then norm (f x) else 0) - ?S) < e" |
|
10742 unfolding real_norm_def |
|
10743 apply (rule *[rule_format]) |
|
10744 apply safe |
|
10745 apply (rule d(2)) |
|
10746 proof goal_cases |
|
10747 case 1 |
|
10748 have "(\<Sum>k\<in>d. norm (integral k f)) \<le> setsum (\<lambda>k. integral k (\<lambda>x. norm (f x))) d" |
|
10749 apply (rule setsum_mono) |
|
10750 apply (rule absolutely_integrable_le) |
|
10751 apply (drule d'(4)) |
|
10752 apply safe |
|
10753 apply (rule f_int) |
|
10754 done |
|
10755 also have "\<dots> = integral (\<Union>d) (\<lambda>x. norm (f x))" |
|
10756 apply (rule integral_combine_division_bottomup[symmetric]) |
|
10757 apply (rule d) |
|
10758 unfolding forall_in_division[OF d(1)] |
|
10759 using f_int |
|
10760 apply auto |
|
10761 done |
|
10762 also have "\<dots> \<le> integral (cbox a b) (\<lambda>x. if x \<in> UNIV then norm (f x) else 0)" |
|
10763 proof - |
|
10764 have "\<Union>d \<subseteq> cbox a b" |
|
10765 apply rule |
|
10766 apply (drule K(2)[rule_format]) |
|
10767 apply (rule ab[unfolded subset_eq,rule_format]) |
|
10768 apply (auto simp add: dist_norm) |
|
10769 done |
|
10770 then show ?thesis |
|
10771 apply - |
|
10772 apply (subst if_P) |
|
10773 apply rule |
|
10774 apply (rule integral_subset_le) |
|
10775 defer |
|
10776 apply (rule integrable_on_subdivision[of _ _ _ "cbox a b"]) |
|
10777 apply (rule d) |
|
10778 using f_int[of a b] |
|
10779 apply auto |
|
10780 done |
|
10781 qed |
|
10782 finally show ?case . |
|
10783 next |
|
10784 note f = absolutely_integrable_onD[OF f_int[of a b]] |
|
10785 note * = this(2)[unfolded has_integral_integral has_integral[of "\<lambda>x. norm (f x)"],rule_format] |
|
10786 have "e/2>0" |
|
10787 using \<open>e > 0\<close> by auto |
|
10788 from * [OF this] obtain d1 where |
|
10789 d1: "gauge d1" "\<forall>p. p tagged_division_of (cbox a b) \<and> d1 fine p \<longrightarrow> |
|
10790 norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - integral (cbox a b) (\<lambda>x. norm (f x))) < e / 2" |
|
10791 by auto |
|
10792 from henstock_lemma [OF f(1) \<open>e/2>0\<close>] obtain d2 where |
|
10793 d2: "gauge d2" "\<forall>p. p tagged_partial_division_of (cbox a b) \<and> d2 fine p \<longrightarrow> |
|
10794 (\<Sum>(x, k)\<in>p. norm (content k *\<^sub>R f x - integral k f)) < e / 2" . |
|
10795 obtain p where |
|
10796 p: "p tagged_division_of (cbox a b)" "d1 fine p" "d2 fine p" |
|
10797 by (rule fine_division_exists [OF gauge_inter [OF d1(1) d2(1)], of a b]) |
|
10798 (auto simp add: fine_inter) |
|
10799 have *: "\<And>sf sf' si di. sf' = sf \<longrightarrow> si \<le> ?S \<longrightarrow> \<bar>sf - si\<bar> < e / 2 \<longrightarrow> |
|
10800 \<bar>sf' - di\<bar> < e / 2 \<longrightarrow> di < ?S + e" |
|
10801 by arith |
|
10802 show "integral (cbox a b) (\<lambda>x. if x \<in> UNIV then norm (f x) else 0) < ?S + e" |
|
10803 apply (subst if_P) |
|
10804 apply rule |
|
10805 proof (rule *[rule_format]) |
|
10806 show "\<bar>(\<Sum>(x,k)\<in>p. norm (content k *\<^sub>R f x)) - (\<Sum>(x,k)\<in>p. norm (integral k f))\<bar> < e / 2" |
|
10807 unfolding split_def |
|
10808 apply (rule helplemma) |
|
10809 using d2(2)[rule_format,of p] |
|
10810 using p(1,3) |
|
10811 unfolding tagged_division_of_def split_def |
|
10812 apply auto |
|
10813 done |
|
10814 show "\<bar>(\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - integral (cbox a b) (\<lambda>x. norm(f x))\<bar> < e / 2" |
|
10815 using d1(2)[rule_format,OF conjI[OF p(1,2)]] |
|
10816 by (simp only: real_norm_def) |
|
10817 show "(\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) = (\<Sum>(x, k)\<in>p. norm (content k *\<^sub>R f x))" |
|
10818 apply (rule setsum.cong) |
|
10819 apply (rule refl) |
|
10820 unfolding split_paired_all split_conv |
|
10821 apply (drule tagged_division_ofD(4)[OF p(1)]) |
|
10822 unfolding norm_scaleR |
|
10823 apply (subst abs_of_nonneg) |
|
10824 apply auto |
|
10825 done |
|
10826 show "(\<Sum>(x, k)\<in>p. norm (integral k f)) \<le> ?S" |
|
10827 using partial_division_of_tagged_division[of p "cbox a b"] p(1) |
|
10828 apply (subst setsum.over_tagged_division_lemma[OF p(1)]) |
|
10829 apply (simp add: integral_null) |
|
10830 apply (intro cSUP_upper2[OF D(2), of "snd ` p"]) |
|
10831 apply (auto simp: tagged_partial_division_of_def) |
|
10832 done |
|
10833 qed |
|
10834 qed |
|
10835 qed (insert K, auto) |
|
10836 qed |
|
10837 qed |
|
10838 |
|
10839 lemma absolutely_integrable_restrict_univ: |
|
10840 "(\<lambda>x. if x \<in> s then f x else (0::'a::banach)) absolutely_integrable_on UNIV \<longleftrightarrow> |
|
10841 f absolutely_integrable_on s" |
|
10842 unfolding absolutely_integrable_on_def if_distrib norm_zero integrable_restrict_univ .. |
|
10843 |
|
10844 lemma absolutely_integrable_add[intro]: |
|
10845 fixes f g :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
10846 assumes "f absolutely_integrable_on s" |
|
10847 and "g absolutely_integrable_on s" |
|
10848 shows "(\<lambda>x. f x + g x) absolutely_integrable_on s" |
|
10849 proof - |
|
10850 let ?P = "\<And>f g::'n \<Rightarrow> 'm. f absolutely_integrable_on UNIV \<Longrightarrow> |
|
10851 g absolutely_integrable_on UNIV \<Longrightarrow> (\<lambda>x. f x + g x) absolutely_integrable_on UNIV" |
|
10852 { |
|
10853 presume as: "PROP ?P" |
|
10854 note a = absolutely_integrable_restrict_univ[symmetric] |
|
10855 have *: "\<And>x. (if x \<in> s then f x else 0) + (if x \<in> s then g x else 0) = |
|
10856 (if x \<in> s then f x + g x else 0)" by auto |
|
10857 show ?thesis |
|
10858 apply (subst a) |
|
10859 using as[OF assms[unfolded a[of f] a[of g]]] |
|
10860 apply (simp only: *) |
|
10861 done |
|
10862 } |
|
10863 fix f g :: "'n \<Rightarrow> 'm" |
|
10864 assume assms: "f absolutely_integrable_on UNIV" "g absolutely_integrable_on UNIV" |
|
10865 note absolutely_integrable_bounded_variation |
|
10866 from this[OF assms(1)] this[OF assms(2)] guess B1 B2 . note B=this[rule_format] |
|
10867 show "(\<lambda>x. f x + g x) absolutely_integrable_on UNIV" |
|
10868 apply (rule bounded_variation_absolutely_integrable[of _ "B1+B2"]) |
|
10869 apply (rule integrable_add) |
|
10870 prefer 3 |
|
10871 apply safe |
|
10872 proof goal_cases |
|
10873 case prems: (1 d) |
|
10874 have "\<And>k. k \<in> d \<Longrightarrow> f integrable_on k \<and> g integrable_on k" |
|
10875 apply (drule division_ofD(4)[OF prems]) |
|
10876 apply safe |
|
10877 apply (rule_tac[!] integrable_on_subcbox[of _ UNIV]) |
|
10878 using assms |
|
10879 apply auto |
|
10880 done |
|
10881 then have "(\<Sum>k\<in>d. norm (integral k (\<lambda>x. f x + g x))) \<le> |
|
10882 (\<Sum>k\<in>d. norm (integral k f)) + (\<Sum>k\<in>d. norm (integral k g))" |
|
10883 apply - |
|
10884 unfolding setsum.distrib [symmetric] |
|
10885 apply (rule setsum_mono) |
|
10886 apply (subst integral_add) |
|
10887 prefer 3 |
|
10888 apply (rule norm_triangle_ineq) |
|
10889 apply auto |
|
10890 done |
|
10891 also have "\<dots> \<le> B1 + B2" |
|
10892 using B(1)[OF prems] B(2)[OF prems] by auto |
|
10893 finally show ?case . |
|
10894 qed (insert assms, auto) |
|
10895 qed |
|
10896 |
|
10897 lemma absolutely_integrable_sub[intro]: |
|
10898 fixes f g :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
10899 assumes "f absolutely_integrable_on s" |
|
10900 and "g absolutely_integrable_on s" |
|
10901 shows "(\<lambda>x. f x - g x) absolutely_integrable_on s" |
|
10902 using absolutely_integrable_add[OF assms(1) absolutely_integrable_neg[OF assms(2)]] |
|
10903 by (simp add: algebra_simps) |
|
10904 |
|
10905 lemma absolutely_integrable_linear: |
|
10906 fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" |
|
10907 and h :: "'n::euclidean_space \<Rightarrow> 'p::euclidean_space" |
|
10908 assumes "f absolutely_integrable_on s" |
|
10909 and "bounded_linear h" |
|
10910 shows "(h \<circ> f) absolutely_integrable_on s" |
|
10911 proof - |
|
10912 { |
|
10913 presume as: "\<And>f::'m \<Rightarrow> 'n. \<And>h::'n \<Rightarrow> 'p. f absolutely_integrable_on UNIV \<Longrightarrow> |
|
10914 bounded_linear h \<Longrightarrow> (h \<circ> f) absolutely_integrable_on UNIV" |
|
10915 note a = absolutely_integrable_restrict_univ[symmetric] |
|
10916 show ?thesis |
|
10917 apply (subst a) |
|
10918 using as[OF assms[unfolded a[of f] a[of g]]] |
|
10919 apply (simp only: o_def if_distrib linear_simps[OF assms(2)]) |
|
10920 done |
|
10921 } |
|
10922 fix f :: "'m \<Rightarrow> 'n" |
|
10923 fix h :: "'n \<Rightarrow> 'p" |
|
10924 assume assms: "f absolutely_integrable_on UNIV" "bounded_linear h" |
|
10925 from absolutely_integrable_bounded_variation[OF assms(1)] guess B . note B=this |
|
10926 from bounded_linear.pos_bounded[OF assms(2)] guess b .. note b=conjunctD2[OF this] |
|
10927 show "(h \<circ> f) absolutely_integrable_on UNIV" |
|
10928 apply (rule bounded_variation_absolutely_integrable[of _ "B * b"]) |
|
10929 apply (rule integrable_linear[OF _ assms(2)]) |
|
10930 apply safe |
|
10931 proof goal_cases |
|
10932 case prems: (2 d) |
|
10933 have "(\<Sum>k\<in>d. norm (integral k (h \<circ> f))) \<le> setsum (\<lambda>k. norm(integral k f)) d * b" |
|
10934 unfolding setsum_left_distrib |
|
10935 apply (rule setsum_mono) |
|
10936 proof goal_cases |
|
10937 case (1 k) |
|
10938 from division_ofD(4)[OF prems this] |
|
10939 guess u v by (elim exE) note uv=this |
|
10940 have *: "f integrable_on k" |
|
10941 unfolding uv |
|
10942 apply (rule integrable_on_subcbox[of _ UNIV]) |
|
10943 using assms |
|
10944 apply auto |
|
10945 done |
|
10946 note this[unfolded has_integral_integral] |
|
10947 note has_integral_linear[OF this assms(2)] integrable_linear[OF * assms(2)] |
|
10948 note * = has_integral_unique[OF this(2)[unfolded has_integral_integral] this(1)] |
|
10949 show ?case |
|
10950 unfolding * using b by auto |
|
10951 qed |
|
10952 also have "\<dots> \<le> B * b" |
|
10953 apply (rule mult_right_mono) |
|
10954 using B prems b |
|
10955 apply auto |
|
10956 done |
|
10957 finally show ?case . |
|
10958 qed (insert assms, auto) |
|
10959 qed |
|
10960 |
|
10961 lemma absolutely_integrable_setsum: |
|
10962 fixes f :: "'a \<Rightarrow> 'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
10963 assumes "finite t" |
|
10964 and "\<And>a. a \<in> t \<Longrightarrow> (f a) absolutely_integrable_on s" |
|
10965 shows "(\<lambda>x. setsum (\<lambda>a. f a x) t) absolutely_integrable_on s" |
|
10966 using assms(1,2) |
|
10967 by induct auto |
|
10968 |
|
10969 lemma absolutely_integrable_vector_abs: |
|
10970 fixes f :: "'a::euclidean_space => 'b::euclidean_space" |
|
10971 and T :: "'c::euclidean_space \<Rightarrow> 'b" |
|
10972 assumes f: "f absolutely_integrable_on s" |
|
10973 shows "(\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>T i\<bar> *\<^sub>R i)) absolutely_integrable_on s" |
|
10974 (is "?Tf absolutely_integrable_on s") |
|
10975 proof - |
|
10976 have if_distrib: "\<And>P A B x. (if P then A else B) *\<^sub>R x = (if P then A *\<^sub>R x else B *\<^sub>R x)" |
|
10977 by simp |
|
10978 have *: "\<And>x. ?Tf x = (\<Sum>i\<in>Basis. |
|
10979 ((\<lambda>y. (\<Sum>j\<in>Basis. (if j = i then y else 0) *\<^sub>R j)) o |
|
10980 (\<lambda>x. (norm (\<Sum>j\<in>Basis. (if j = i then f x\<bullet>T i else 0) *\<^sub>R j)))) x)" |
|
10981 by (simp add: comp_def if_distrib setsum.If_cases) |
|
10982 show ?thesis |
|
10983 unfolding * |
|
10984 apply (rule absolutely_integrable_setsum[OF finite_Basis]) |
|
10985 apply (rule absolutely_integrable_linear) |
|
10986 apply (rule absolutely_integrable_norm) |
|
10987 apply (rule absolutely_integrable_linear[OF f, unfolded o_def]) |
|
10988 apply (auto simp: linear_linear euclidean_eq_iff[where 'a='c] inner_simps intro!: linearI) |
|
10989 done |
|
10990 qed |
|
10991 |
|
10992 lemma absolutely_integrable_max: |
|
10993 fixes f g :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" |
|
10994 assumes "f absolutely_integrable_on s" |
|
10995 and "g absolutely_integrable_on s" |
|
10996 shows "(\<lambda>x. (\<Sum>i\<in>Basis. max (f(x)\<bullet>i) (g(x)\<bullet>i) *\<^sub>R i)::'n) absolutely_integrable_on s" |
|
10997 proof - |
|
10998 have *:"\<And>x. (1 / 2) *\<^sub>R (((\<Sum>i\<in>Basis. \<bar>(f x - g x) \<bullet> i\<bar> *\<^sub>R i)::'n) + (f x + g x)) = |
|
10999 (\<Sum>i\<in>Basis. max (f(x)\<bullet>i) (g(x)\<bullet>i) *\<^sub>R i)" |
|
11000 unfolding euclidean_eq_iff[where 'a='n] by (auto simp: inner_simps) |
|
11001 note absolutely_integrable_sub[OF assms] absolutely_integrable_add[OF assms] |
|
11002 note absolutely_integrable_vector_abs[OF this(1), where T="\<lambda>x. x"] this(2) |
|
11003 note absolutely_integrable_add[OF this] |
|
11004 note absolutely_integrable_cmul[OF this, of "1/2"] |
|
11005 then show ?thesis unfolding * . |
|
11006 qed |
|
11007 |
|
11008 lemma absolutely_integrable_min: |
|
11009 fixes f g::"'m::euclidean_space \<Rightarrow> 'n::euclidean_space" |
|
11010 assumes "f absolutely_integrable_on s" |
|
11011 and "g absolutely_integrable_on s" |
|
11012 shows "(\<lambda>x. (\<Sum>i\<in>Basis. min (f(x)\<bullet>i) (g(x)\<bullet>i) *\<^sub>R i)::'n) absolutely_integrable_on s" |
|
11013 proof - |
|
11014 have *:"\<And>x. (1 / 2) *\<^sub>R ((f x + g x) - (\<Sum>i\<in>Basis. \<bar>(f x - g x) \<bullet> i\<bar> *\<^sub>R i::'n)) = |
|
11015 (\<Sum>i\<in>Basis. min (f(x)\<bullet>i) (g(x)\<bullet>i) *\<^sub>R i)" |
|
11016 unfolding euclidean_eq_iff[where 'a='n] by (auto simp: inner_simps) |
|
11017 |
|
11018 note absolutely_integrable_add[OF assms] absolutely_integrable_sub[OF assms] |
|
11019 note this(1) absolutely_integrable_vector_abs[OF this(2), where T="\<lambda>x. x"] |
|
11020 note absolutely_integrable_sub[OF this] |
|
11021 note absolutely_integrable_cmul[OF this,of "1/2"] |
|
11022 then show ?thesis unfolding * . |
|
11023 qed |
|
11024 |
|
11025 lemma absolutely_integrable_abs_eq: |
|
11026 fixes f::"'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
11027 shows "f absolutely_integrable_on s \<longleftrightarrow> f integrable_on s \<and> |
|
11028 (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m) integrable_on s" |
|
11029 (is "?l = ?r") |
|
11030 proof |
|
11031 assume ?l |
|
11032 then show ?r |
|
11033 apply - |
|
11034 apply rule |
|
11035 defer |
|
11036 apply (drule absolutely_integrable_vector_abs) |
|
11037 apply auto |
|
11038 done |
|
11039 next |
|
11040 assume ?r |
|
11041 { |
|
11042 presume lem: "\<And>f::'n \<Rightarrow> 'm. f integrable_on UNIV \<Longrightarrow> |
|
11043 (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m) integrable_on UNIV \<Longrightarrow> |
|
11044 f absolutely_integrable_on UNIV" |
|
11045 have *: "\<And>x. (\<Sum>i\<in>Basis. \<bar>(if x \<in> s then f x else 0) \<bullet> i\<bar> *\<^sub>R i) = |
|
11046 (if x \<in> s then (\<Sum>i\<in>Basis. \<bar>f x \<bullet> i\<bar> *\<^sub>R i) else (0::'m))" |
|
11047 unfolding euclidean_eq_iff[where 'a='m] |
|
11048 by auto |
|
11049 show ?l |
|
11050 apply (subst absolutely_integrable_restrict_univ[symmetric]) |
|
11051 apply (rule lem) |
|
11052 unfolding integrable_restrict_univ * |
|
11053 using \<open>?r\<close> |
|
11054 apply auto |
|
11055 done |
|
11056 } |
|
11057 fix f :: "'n \<Rightarrow> 'm" |
|
11058 assume assms: "f integrable_on UNIV" "(\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m) integrable_on UNIV" |
|
11059 let ?B = "\<Sum>i\<in>Basis. integral UNIV (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m) \<bullet> i" |
|
11060 show "f absolutely_integrable_on UNIV" |
|
11061 apply (rule bounded_variation_absolutely_integrable[OF assms(1), where B="?B"]) |
|
11062 apply safe |
|
11063 proof goal_cases |
|
11064 case d: (1 d) |
|
11065 note d'=division_ofD[OF d] |
|
11066 have "(\<Sum>k\<in>d. norm (integral k f)) \<le> |
|
11067 (\<Sum>k\<in>d. setsum (op \<bullet> (integral k (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m))) Basis)" |
|
11068 apply (rule setsum_mono) |
|
11069 apply (rule order_trans[OF norm_le_l1]) |
|
11070 apply (rule setsum_mono) |
|
11071 unfolding lessThan_iff |
|
11072 proof - |
|
11073 fix k |
|
11074 fix i :: 'm |
|
11075 assume "k \<in> d" and i: "i \<in> Basis" |
|
11076 from d'(4)[OF this(1)] guess a b by (elim exE) note ab=this |
|
11077 show "\<bar>integral k f \<bullet> i\<bar> \<le> integral k (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m) \<bullet> i" |
|
11078 apply (rule abs_leI) |
|
11079 unfolding inner_minus_left[symmetric] |
|
11080 defer |
|
11081 apply (subst integral_neg[symmetric]) |
|
11082 apply (rule_tac[1-2] integral_component_le[OF i]) |
|
11083 using integrable_on_subcbox[OF assms(1),of a b] |
|
11084 integrable_on_subcbox[OF assms(2),of a b] i integrable_neg |
|
11085 unfolding ab |
|
11086 apply auto |
|
11087 done |
|
11088 qed |
|
11089 also have "\<dots> \<le> setsum (op \<bullet> (integral UNIV (\<lambda>x. (\<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i)::'m))) Basis" |
|
11090 apply (subst setsum.commute) |
|
11091 apply (rule setsum_mono) |
|
11092 proof goal_cases |
|
11093 case (1 j) |
|
11094 have *: "(\<lambda>x. \<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i::'m) integrable_on \<Union>d" |
|
11095 using integrable_on_subdivision[OF d assms(2)] by auto |
|
11096 have "(\<Sum>i\<in>d. integral i (\<lambda>x. \<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i::'m) \<bullet> j) = |
|
11097 integral (\<Union>d) (\<lambda>x. \<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i::'m) \<bullet> j" |
|
11098 unfolding inner_setsum_left[symmetric] integral_combine_division_topdown[OF * d] .. |
|
11099 also have "\<dots> \<le> integral UNIV (\<lambda>x. \<Sum>i\<in>Basis. \<bar>f x\<bullet>i\<bar> *\<^sub>R i::'m) \<bullet> j" |
|
11100 apply (rule integral_subset_component_le) |
|
11101 using assms * \<open>j \<in> Basis\<close> |
|
11102 apply auto |
|
11103 done |
|
11104 finally show ?case . |
|
11105 qed |
|
11106 finally show ?case . |
|
11107 qed |
|
11108 qed |
|
11109 |
|
11110 lemma nonnegative_absolutely_integrable: |
|
11111 fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
11112 assumes "\<forall>x\<in>s. \<forall>i\<in>Basis. 0 \<le> f x \<bullet> i" |
|
11113 and "f integrable_on s" |
|
11114 shows "f absolutely_integrable_on s" |
|
11115 unfolding absolutely_integrable_abs_eq |
|
11116 apply rule |
|
11117 apply (rule assms)thm integrable_eq |
|
11118 apply (rule integrable_eq[of _ f]) |
|
11119 using assms |
|
11120 apply (auto simp: euclidean_eq_iff[where 'a='m]) |
|
11121 done |
|
11122 |
|
11123 lemma absolutely_integrable_integrable_bound: |
|
11124 fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
11125 assumes "\<forall>x\<in>s. norm (f x) \<le> g x" |
|
11126 and "f integrable_on s" |
|
11127 and "g integrable_on s" |
|
11128 shows "f absolutely_integrable_on s" |
|
11129 proof - |
|
11130 { |
|
11131 presume *: "\<And>f::'n \<Rightarrow> 'm. \<And>g. \<forall>x. norm (f x) \<le> g x \<Longrightarrow> f integrable_on UNIV \<Longrightarrow> |
|
11132 g integrable_on UNIV \<Longrightarrow> f absolutely_integrable_on UNIV" |
|
11133 show ?thesis |
|
11134 apply (subst absolutely_integrable_restrict_univ[symmetric]) |
|
11135 apply (rule *[of _ "\<lambda>x. if x\<in>s then g x else 0"]) |
|
11136 using assms |
|
11137 unfolding integrable_restrict_univ |
|
11138 apply auto |
|
11139 done |
|
11140 } |
|
11141 fix g |
|
11142 fix f :: "'n \<Rightarrow> 'm" |
|
11143 assume assms: "\<forall>x. norm (f x) \<le> g x" "f integrable_on UNIV" "g integrable_on UNIV" |
|
11144 show "f absolutely_integrable_on UNIV" |
|
11145 apply (rule bounded_variation_absolutely_integrable[OF assms(2),where B="integral UNIV g"]) |
|
11146 apply safe |
|
11147 proof goal_cases |
|
11148 case d: (1 d) |
|
11149 note d'=division_ofD[OF d] |
|
11150 have "(\<Sum>k\<in>d. norm (integral k f)) \<le> (\<Sum>k\<in>d. integral k g)" |
|
11151 apply (rule setsum_mono) |
|
11152 apply (rule integral_norm_bound_integral) |
|
11153 apply (drule_tac[!] d'(4)) |
|
11154 apply safe |
|
11155 apply (rule_tac[1-2] integrable_on_subcbox) |
|
11156 using assms |
|
11157 apply auto |
|
11158 done |
|
11159 also have "\<dots> = integral (\<Union>d) g" |
|
11160 apply (rule integral_combine_division_bottomup[symmetric]) |
|
11161 apply (rule d) |
|
11162 apply safe |
|
11163 apply (drule d'(4)) |
|
11164 apply safe |
|
11165 apply (rule integrable_on_subcbox[OF assms(3)]) |
|
11166 apply auto |
|
11167 done |
|
11168 also have "\<dots> \<le> integral UNIV g" |
|
11169 apply (rule integral_subset_le) |
|
11170 defer |
|
11171 apply (rule integrable_on_subdivision[OF d,of _ UNIV]) |
|
11172 prefer 4 |
|
11173 apply rule |
|
11174 apply (rule_tac y="norm (f x)" in order_trans) |
|
11175 using assms |
|
11176 apply auto |
|
11177 done |
|
11178 finally show ?case . |
|
11179 qed |
|
11180 qed |
|
11181 |
|
11182 lemma absolutely_integrable_absolutely_integrable_bound: |
|
11183 fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
11184 and g :: "'n::euclidean_space \<Rightarrow> 'p::euclidean_space" |
|
11185 assumes "\<forall>x\<in>s. norm (f x) \<le> norm (g x)" |
|
11186 and "f integrable_on s" |
|
11187 and "g absolutely_integrable_on s" |
|
11188 shows "f absolutely_integrable_on s" |
|
11189 apply (rule absolutely_integrable_integrable_bound[of s f "\<lambda>x. norm (g x)"]) |
|
11190 using assms |
|
11191 apply auto |
|
11192 done |
|
11193 |
|
11194 lemma absolutely_integrable_inf_real: |
|
11195 assumes "finite k" |
|
11196 and "k \<noteq> {}" |
|
11197 and "\<forall>i\<in>k. (\<lambda>x. (fs x i)::real) absolutely_integrable_on s" |
|
11198 shows "(\<lambda>x. (Inf ((fs x) ` k))) absolutely_integrable_on s" |
|
11199 using assms |
|
11200 proof induct |
|
11201 case (insert a k) |
|
11202 let ?P = "(\<lambda>x. |
|
11203 if fs x ` k = {} then fs x a |
|
11204 else min (fs x a) (Inf (fs x ` k))) absolutely_integrable_on s" |
|
11205 show ?case |
|
11206 unfolding image_insert |
|
11207 apply (subst Inf_insert_finite) |
|
11208 apply (rule finite_imageI[OF insert(1)]) |
|
11209 proof (cases "k = {}") |
|
11210 case True |
|
11211 then show ?P |
|
11212 apply (subst if_P) |
|
11213 defer |
|
11214 apply (rule insert(5)[rule_format]) |
|
11215 apply auto |
|
11216 done |
|
11217 next |
|
11218 case False |
|
11219 then show ?P |
|
11220 apply (subst if_not_P) |
|
11221 defer |
|
11222 apply (rule absolutely_integrable_min[where 'n=real, unfolded Basis_real_def, simplified]) |
|
11223 defer |
|
11224 apply(rule insert(3)[OF False]) |
|
11225 using insert(5) |
|
11226 apply auto |
|
11227 done |
|
11228 qed |
|
11229 next |
|
11230 case empty |
|
11231 then show ?case by auto |
|
11232 qed |
|
11233 |
|
11234 lemma absolutely_integrable_sup_real: |
|
11235 assumes "finite k" |
|
11236 and "k \<noteq> {}" |
|
11237 and "\<forall>i\<in>k. (\<lambda>x. (fs x i)::real) absolutely_integrable_on s" |
|
11238 shows "(\<lambda>x. (Sup ((fs x) ` k))) absolutely_integrable_on s" |
|
11239 using assms |
|
11240 proof induct |
|
11241 case (insert a k) |
|
11242 let ?P = "(\<lambda>x. |
|
11243 if fs x ` k = {} then fs x a |
|
11244 else max (fs x a) (Sup (fs x ` k))) absolutely_integrable_on s" |
|
11245 show ?case |
|
11246 unfolding image_insert |
|
11247 apply (subst Sup_insert_finite) |
|
11248 apply (rule finite_imageI[OF insert(1)]) |
|
11249 proof (cases "k = {}") |
|
11250 case True |
|
11251 then show ?P |
|
11252 apply (subst if_P) |
|
11253 defer |
|
11254 apply (rule insert(5)[rule_format]) |
|
11255 apply auto |
|
11256 done |
|
11257 next |
|
11258 case False |
|
11259 then show ?P |
|
11260 apply (subst if_not_P) |
|
11261 defer |
|
11262 apply (rule absolutely_integrable_max[where 'n=real, unfolded Basis_real_def, simplified]) |
|
11263 defer |
|
11264 apply (rule insert(3)[OF False]) |
|
11265 using insert(5) |
|
11266 apply auto |
|
11267 done |
|
11268 qed |
|
11269 qed auto |
|
11270 |
|
11271 |
|
11272 subsection \<open>differentiation under the integral sign\<close> |
|
11273 |
|
11274 lemma tube_lemma: |
|
11275 assumes "compact K" |
|
11276 assumes "open W" |
|
11277 assumes "{x0} \<times> K \<subseteq> W" |
|
11278 shows "\<exists>X0. x0 \<in> X0 \<and> open X0 \<and> X0 \<times> K \<subseteq> W" |
|
11279 proof - |
|
11280 { |
|
11281 fix y assume "y \<in> K" |
|
11282 then have "(x0, y) \<in> W" using assms by auto |
|
11283 with \<open>open W\<close> |
|
11284 have "\<exists>X0 Y. open X0 \<and> open Y \<and> x0 \<in> X0 \<and> y \<in> Y \<and> X0 \<times> Y \<subseteq> W" |
|
11285 by (rule open_prod_elim) blast |
|
11286 } |
|
11287 then obtain X0 Y where |
|
11288 *: "\<forall>y \<in> K. open (X0 y) \<and> open (Y y) \<and> x0 \<in> X0 y \<and> y \<in> Y y \<and> X0 y \<times> Y y \<subseteq> W" |
|
11289 by metis |
|
11290 from * have "\<forall>t\<in>Y ` K. open t" "K \<subseteq> \<Union>(Y ` K)" by auto |
|
11291 with \<open>compact K\<close> obtain CC where CC: "CC \<subseteq> Y ` K" "finite CC" "K \<subseteq> \<Union>CC" |
|
11292 by (rule compactE) |
|
11293 then obtain c where c: "\<And>C. C \<in> CC \<Longrightarrow> c C \<in> K \<and> C = Y (c C)" |
|
11294 by (force intro!: choice) |
|
11295 with * CC show ?thesis |
|
11296 by (force intro!: exI[where x="\<Inter>C\<in>CC. X0 (c C)"]) (* SLOW *) |
|
11297 qed |
|
11298 |
|
11299 lemma continuous_on_prod_compactE: |
|
11300 fixes fx::"'a::topological_space \<times> 'b::topological_space \<Rightarrow> 'c::metric_space" |
|
11301 and e::real |
|
11302 assumes cont_fx: "continuous_on (U \<times> C) fx" |
|
11303 assumes "compact C" |
|
11304 assumes [intro]: "x0 \<in> U" |
|
11305 notes [continuous_intros] = continuous_on_compose2[OF cont_fx] |
|
11306 assumes "e > 0" |
|
11307 obtains X0 where "x0 \<in> X0" "open X0" |
|
11308 "\<forall>x\<in>X0 \<inter> U. \<forall>t \<in> C. dist (fx (x, t)) (fx (x0, t)) \<le> e" |
|
11309 proof - |
|
11310 define psi where "psi = (\<lambda>(x, t). dist (fx (x, t)) (fx (x0, t)))" |
|
11311 define W0 where "W0 = {(x, t) \<in> U \<times> C. psi (x, t) < e}" |
|
11312 have W0_eq: "W0 = psi -` {..<e} \<inter> U \<times> C" |
|
11313 by (auto simp: vimage_def W0_def) |
|
11314 have "open {..<e}" by simp |
|
11315 have "continuous_on (U \<times> C) psi" |
|
11316 by (auto intro!: continuous_intros simp: psi_def split_beta') |
|
11317 from this[unfolded continuous_on_open_invariant, rule_format, OF \<open>open {..<e}\<close>] |
|
11318 obtain W where W: "open W" "W \<inter> U \<times> C = W0 \<inter> U \<times> C" |
|
11319 unfolding W0_eq by blast |
|
11320 have "{x0} \<times> C \<subseteq> W \<inter> U \<times> C" |
|
11321 unfolding W |
|
11322 by (auto simp: W0_def psi_def \<open>0 < e\<close>) |
|
11323 then have "{x0} \<times> C \<subseteq> W" by blast |
|
11324 from tube_lemma[OF \<open>compact C\<close> \<open>open W\<close> this] |
|
11325 obtain X0 where X0: "x0 \<in> X0" "open X0" "X0 \<times> C \<subseteq> W" |
|
11326 by blast |
|
11327 |
|
11328 have "\<forall>x\<in>X0 \<inter> U. \<forall>t \<in> C. dist (fx (x, t)) (fx (x0, t)) \<le> e" |
|
11329 proof safe |
|
11330 fix x assume x: "x \<in> X0" "x \<in> U" |
|
11331 fix t assume t: "t \<in> C" |
|
11332 have "dist (fx (x, t)) (fx (x0, t)) = psi (x, t)" |
|
11333 by (auto simp: psi_def) |
|
11334 also |
|
11335 { |
|
11336 have "(x, t) \<in> X0 \<times> C" |
|
11337 using t x |
|
11338 by auto |
|
11339 also note \<open>\<dots> \<subseteq> W\<close> |
|
11340 finally have "(x, t) \<in> W" . |
|
11341 with t x have "(x, t) \<in> W \<inter> U \<times> C" |
|
11342 by blast |
|
11343 also note \<open>W \<inter> U \<times> C = W0 \<inter> U \<times> C\<close> |
|
11344 finally have "psi (x, t) < e" |
|
11345 by (auto simp: W0_def) |
|
11346 } |
|
11347 finally show "dist (fx (x, t)) (fx (x0, t)) \<le> e" by simp |
|
11348 qed |
|
11349 from X0(1,2) this show ?thesis .. |
|
11350 qed |
|
11351 |
|
11352 lemma integral_continuous_on_param: |
|
11353 fixes f::"'a::topological_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach" |
|
11354 assumes cont_fx: "continuous_on (U \<times> cbox a b) (\<lambda>(x, t). f x t)" |
|
11355 shows "continuous_on U (\<lambda>x. integral (cbox a b) (f x))" |
|
11356 proof cases |
|
11357 assume "content (cbox a b) \<noteq> 0" |
|
11358 then have ne: "cbox a b \<noteq> {}" by auto |
|
11359 |
|
11360 note [continuous_intros] = |
|
11361 continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x, |
|
11362 unfolded split_beta fst_conv snd_conv] |
|
11363 |
|
11364 show ?thesis |
|
11365 unfolding continuous_on_def |
|
11366 proof (safe intro!: tendstoI) |
|
11367 fix e'::real and x |
|
11368 assume "e' > 0" |
|
11369 define e where "e = e' / (content (cbox a b) + 1)" |
|
11370 have "e > 0" using \<open>e' > 0\<close> by (auto simp: e_def intro!: divide_pos_pos add_nonneg_pos) |
|
11371 assume "x \<in> U" |
|
11372 from continuous_on_prod_compactE[OF cont_fx compact_cbox \<open>x \<in> U\<close> \<open>0 < e\<close>] |
|
11373 obtain X0 where X0: "x \<in> X0" "open X0" |
|
11374 and fx_bound: "\<And>y t. y \<in> X0 \<inter> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> norm (f y t - f x t) \<le> e" |
|
11375 unfolding split_beta fst_conv snd_conv dist_norm |
|
11376 by metis |
|
11377 have "\<forall>\<^sub>F y in at x within U. y \<in> X0 \<inter> U" |
|
11378 using X0(1) X0(2) eventually_at_topological by auto |
|
11379 then show "\<forall>\<^sub>F y in at x within U. dist (integral (cbox a b) (f y)) (integral (cbox a b) (f x)) < e'" |
|
11380 proof eventually_elim |
|
11381 case (elim y) |
|
11382 have "dist (integral (cbox a b) (f y)) (integral (cbox a b) (f x)) = |
|
11383 norm (integral (cbox a b) (\<lambda>t. f y t - f x t))" |
|
11384 using elim \<open>x \<in> U\<close> |
|
11385 unfolding dist_norm |
|
11386 by (subst integral_diff) |
|
11387 (auto intro!: integrable_continuous continuous_intros) |
|
11388 also have "\<dots> \<le> e * content (cbox a b)" |
|
11389 using elim \<open>x \<in> U\<close> |
|
11390 by (intro integrable_bound) |
|
11391 (auto intro!: fx_bound \<open>x \<in> U \<close> less_imp_le[OF \<open>0 < e\<close>] |
|
11392 integrable_continuous continuous_intros) |
|
11393 also have "\<dots> < e'" |
|
11394 using \<open>0 < e'\<close> \<open>e > 0\<close> |
|
11395 by (auto simp: e_def divide_simps) |
|
11396 finally show "dist (integral (cbox a b) (f y)) (integral (cbox a b) (f x)) < e'" . |
|
11397 qed |
|
11398 qed |
|
11399 qed (auto intro!: continuous_on_const) |
|
11400 |
|
11401 lemma eventually_closed_segment: |
|
11402 fixes x0::"'a::real_normed_vector" |
|
11403 assumes "open X0" "x0 \<in> X0" |
|
11404 shows "\<forall>\<^sub>F x in at x0 within U. closed_segment x0 x \<subseteq> X0" |
|
11405 proof - |
|
11406 from openE[OF assms] |
|
11407 obtain e where e: "0 < e" "ball x0 e \<subseteq> X0" . |
|
11408 then have "\<forall>\<^sub>F x in at x0 within U. x \<in> ball x0 e" |
|
11409 by (auto simp: dist_commute eventually_at) |
|
11410 then show ?thesis |
|
11411 proof eventually_elim |
|
11412 case (elim x) |
|
11413 have "x0 \<in> ball x0 e" using \<open>e > 0\<close> by simp |
|
11414 from convex_ball[unfolded convex_contains_segment, rule_format, OF this elim] |
|
11415 have "closed_segment x0 x \<subseteq> ball x0 e" . |
|
11416 also note \<open>\<dots> \<subseteq> X0\<close> |
|
11417 finally show ?case . |
|
11418 qed |
|
11419 qed |
|
11420 |
|
11421 lemma leibniz_rule: |
|
11422 fixes f::"'a::banach \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach" |
|
11423 assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> |
|
11424 ((\<lambda>x. f x t) has_derivative blinfun_apply (fx x t)) (at x within U)" |
|
11425 assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> f x integrable_on cbox a b" |
|
11426 assumes cont_fx: "continuous_on (U \<times> (cbox a b)) (\<lambda>(x, t). fx x t)" |
|
11427 assumes [intro]: "x0 \<in> U" |
|
11428 assumes "convex U" |
|
11429 shows |
|
11430 "((\<lambda>x. integral (cbox a b) (f x)) has_derivative integral (cbox a b) (fx x0)) (at x0 within U)" |
|
11431 (is "(?F has_derivative ?dF) _") |
|
11432 proof cases |
|
11433 assume "content (cbox a b) \<noteq> 0" |
|
11434 then have ne: "cbox a b \<noteq> {}" by auto |
|
11435 note [continuous_intros] = |
|
11436 continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x, |
|
11437 unfolded split_beta fst_conv snd_conv] |
|
11438 show ?thesis |
|
11439 proof (intro has_derivativeI bounded_linear_scaleR_left tendstoI, fold norm_conv_dist) |
|
11440 have cont_f1: "\<And>t. t \<in> cbox a b \<Longrightarrow> continuous_on U (\<lambda>x. f x t)" |
|
11441 by (auto simp: continuous_on_eq_continuous_within intro!: has_derivative_continuous fx) |
|
11442 note [continuous_intros] = continuous_on_compose2[OF cont_f1] |
|
11443 fix e'::real |
|
11444 assume "e' > 0" |
|
11445 define e where "e = e' / (content (cbox a b) + 1)" |
|
11446 have "e > 0" using \<open>e' > 0\<close> by (auto simp: e_def intro!: divide_pos_pos add_nonneg_pos) |
|
11447 from continuous_on_prod_compactE[OF cont_fx compact_cbox \<open>x0 \<in> U\<close> \<open>e > 0\<close>] |
|
11448 obtain X0 where X0: "x0 \<in> X0" "open X0" |
|
11449 and fx_bound: "\<And>x t. x \<in> X0 \<inter> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> norm (fx x t - fx x0 t) \<le> e" |
|
11450 unfolding split_beta fst_conv snd_conv |
|
11451 by (metis dist_norm) |
|
11452 |
|
11453 note eventually_closed_segment[OF \<open>open X0\<close> \<open>x0 \<in> X0\<close>, of U] |
|
11454 moreover |
|
11455 have "\<forall>\<^sub>F x in at x0 within U. x \<in> X0" |
|
11456 using \<open>open X0\<close> \<open>x0 \<in> X0\<close> eventually_at_topological by blast |
|
11457 moreover have "\<forall>\<^sub>F x in at x0 within U. x \<noteq> x0" |
|
11458 by (auto simp: eventually_at_filter) |
|
11459 moreover have "\<forall>\<^sub>F x in at x0 within U. x \<in> U" |
|
11460 by (auto simp: eventually_at_filter) |
|
11461 ultimately |
|
11462 show "\<forall>\<^sub>F x in at x0 within U. norm ((?F x - ?F x0 - ?dF (x - x0)) /\<^sub>R norm (x - x0)) < e'" |
|
11463 proof eventually_elim |
|
11464 case (elim x) |
|
11465 from elim have "0 < norm (x - x0)" by simp |
|
11466 have "closed_segment x0 x \<subseteq> U" |
|
11467 by (rule \<open>convex U\<close>[unfolded convex_contains_segment, rule_format, OF \<open>x0 \<in> U\<close> \<open>x \<in> U\<close>]) |
|
11468 from elim have [intro]: "x \<in> U" by auto |
|
11469 |
|
11470 have "?F x - ?F x0 - ?dF (x - x0) = |
|
11471 integral (cbox a b) (\<lambda>y. f x y - f x0 y - fx x0 y (x - x0))" |
|
11472 (is "_ = ?id") |
|
11473 using \<open>x \<noteq> x0\<close> |
|
11474 by (subst blinfun_apply_integral integral_diff, |
|
11475 auto intro!: integrable_diff integrable_f2 continuous_intros |
|
11476 intro: integrable_continuous)+ |
|
11477 also |
|
11478 { |
|
11479 fix t assume t: "t \<in> (cbox a b)" |
|
11480 have seg: "\<And>t. t \<in> {0..1} \<Longrightarrow> x0 + t *\<^sub>R (x - x0) \<in> X0 \<inter> U" |
|
11481 using \<open>closed_segment x0 x \<subseteq> U\<close> |
|
11482 \<open>closed_segment x0 x \<subseteq> X0\<close> |
|
11483 by (force simp: closed_segment_def algebra_simps) |
|
11484 from t have deriv: |
|
11485 "((\<lambda>x. f x t) has_derivative (fx y t)) (at y within X0 \<inter> U)" |
|
11486 if "y \<in> X0 \<inter> U" for y |
|
11487 unfolding has_vector_derivative_def[symmetric] |
|
11488 using that \<open>x \<in> X0\<close> |
|
11489 by (intro has_derivative_within_subset[OF fx]) auto |
|
11490 have "\<forall>x \<in> X0 \<inter> U. onorm (blinfun_apply (fx x t) - (fx x0 t)) \<le> e" |
|
11491 using fx_bound t |
|
11492 by (auto simp add: norm_blinfun_def fun_diff_def blinfun.bilinear_simps[symmetric]) |
|
11493 from differentiable_bound_linearization[OF seg deriv this] X0 |
|
11494 have "norm (f x t - f x0 t - fx x0 t (x - x0)) \<le> e * norm (x - x0)" |
|
11495 by (auto simp add: ac_simps) |
|
11496 } |
|
11497 then have "norm ?id \<le> integral (cbox a b) (\<lambda>_. e * norm (x - x0))" |
|
11498 by (intro integral_norm_bound_integral) |
|
11499 (auto intro!: continuous_intros integrable_diff integrable_f2 |
|
11500 intro: integrable_continuous) |
|
11501 also have "\<dots> = content (cbox a b) * e * norm (x - x0)" |
|
11502 by simp |
|
11503 also have "\<dots> < e' * norm (x - x0)" |
|
11504 using \<open>e' > 0\<close> content_pos_le[of a b] |
|
11505 by (intro mult_strict_right_mono[OF _ \<open>0 < norm (x - x0)\<close>]) |
|
11506 (auto simp: divide_simps e_def) |
|
11507 finally have "norm (?F x - ?F x0 - ?dF (x - x0)) < e' * norm (x - x0)" . |
|
11508 then show ?case |
|
11509 by (auto simp: divide_simps) |
|
11510 qed |
|
11511 qed (rule blinfun.bounded_linear_right) |
|
11512 qed (auto intro!: derivative_eq_intros simp: blinfun.bilinear_simps) |
|
11513 |
|
11514 lemma |
|
11515 has_vector_derivative_eq_has_derivative_blinfun: |
|
11516 "(f has_vector_derivative f') (at x within U) \<longleftrightarrow> |
|
11517 (f has_derivative blinfun_scaleR_left f') (at x within U)" |
|
11518 by (simp add: has_vector_derivative_def) |
|
11519 |
|
11520 lemma leibniz_rule_vector_derivative: |
|
11521 fixes f::"real \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach" |
|
11522 assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> |
|
11523 ((\<lambda>x. f x t) has_vector_derivative (fx x t)) (at x within U)" |
|
11524 assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> (f x) integrable_on cbox a b" |
|
11525 assumes cont_fx: "continuous_on (U \<times> cbox a b) (\<lambda>(x, t). fx x t)" |
|
11526 assumes U: "x0 \<in> U" "convex U" |
|
11527 shows "((\<lambda>x. integral (cbox a b) (f x)) has_vector_derivative integral (cbox a b) (fx x0)) |
|
11528 (at x0 within U)" |
|
11529 proof - |
|
11530 note [continuous_intros] = |
|
11531 continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x, |
|
11532 unfolded split_beta fst_conv snd_conv] |
|
11533 have *: "blinfun_scaleR_left (integral (cbox a b) (fx x0)) = |
|
11534 integral (cbox a b) (\<lambda>t. blinfun_scaleR_left (fx x0 t))" |
|
11535 by (subst integral_linear[symmetric]) |
|
11536 (auto simp: has_vector_derivative_def o_def |
|
11537 intro!: integrable_continuous U continuous_intros bounded_linear_intros) |
|
11538 show ?thesis |
|
11539 unfolding has_vector_derivative_eq_has_derivative_blinfun |
|
11540 apply (rule has_derivative_eq_rhs) |
|
11541 apply (rule leibniz_rule[OF _ integrable_f2 _ U, where fx="\<lambda>x t. blinfun_scaleR_left (fx x t)"]) |
|
11542 using fx cont_fx |
|
11543 apply (auto simp: has_vector_derivative_def * split_beta intro!: continuous_intros) |
|
11544 done |
|
11545 qed |
|
11546 |
|
11547 lemma |
|
11548 has_field_derivative_eq_has_derivative_blinfun: |
|
11549 "(f has_field_derivative f') (at x within U) \<longleftrightarrow> (f has_derivative blinfun_mult_right f') (at x within U)" |
|
11550 by (simp add: has_field_derivative_def) |
|
11551 |
|
11552 lemma leibniz_rule_field_derivative: |
|
11553 fixes f::"'a::{real_normed_field, banach} \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'a" |
|
11554 assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> ((\<lambda>x. f x t) has_field_derivative fx x t) (at x within U)" |
|
11555 assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> (f x) integrable_on cbox a b" |
|
11556 assumes cont_fx: "continuous_on (U \<times> (cbox a b)) (\<lambda>(x, t). fx x t)" |
|
11557 assumes U: "x0 \<in> U" "convex U" |
|
11558 shows "((\<lambda>x. integral (cbox a b) (f x)) has_field_derivative integral (cbox a b) (fx x0)) (at x0 within U)" |
|
11559 proof - |
|
11560 note [continuous_intros] = |
|
11561 continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x, |
|
11562 unfolded split_beta fst_conv snd_conv] |
|
11563 have *: "blinfun_mult_right (integral (cbox a b) (fx x0)) = |
|
11564 integral (cbox a b) (\<lambda>t. blinfun_mult_right (fx x0 t))" |
|
11565 by (subst integral_linear[symmetric]) |
|
11566 (auto simp: has_vector_derivative_def o_def |
|
11567 intro!: integrable_continuous U continuous_intros bounded_linear_intros) |
|
11568 show ?thesis |
|
11569 unfolding has_field_derivative_eq_has_derivative_blinfun |
|
11570 apply (rule has_derivative_eq_rhs) |
|
11571 apply (rule leibniz_rule[OF _ integrable_f2 _ U, where fx="\<lambda>x t. blinfun_mult_right (fx x t)"]) |
|
11572 using fx cont_fx |
|
11573 apply (auto simp: has_field_derivative_def * split_beta intro!: continuous_intros) |
|
11574 done |
|
11575 qed |
|
11576 |
|
11577 |
|
11578 subsection \<open>Exchange uniform limit and integral\<close> |
|
11579 |
|
11580 lemma |
|
11581 uniform_limit_integral: |
|
11582 fixes f::"'a \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach" |
|
11583 assumes u: "uniform_limit (cbox a b) f g F" |
|
11584 assumes c: "\<And>n. continuous_on (cbox a b) (f n)" |
|
11585 assumes [simp]: "F \<noteq> bot" |
|
11586 obtains I J where |
|
11587 "\<And>n. (f n has_integral I n) (cbox a b)" |
|
11588 "(g has_integral J) (cbox a b)" |
|
11589 "(I \<longlongrightarrow> J) F" |
|
11590 proof - |
|
11591 have fi[simp]: "f n integrable_on (cbox a b)" for n |
|
11592 by (auto intro!: integrable_continuous assms) |
|
11593 then obtain I where I: "\<And>n. (f n has_integral I n) (cbox a b)" |
|
11594 by atomize_elim (auto simp: integrable_on_def intro!: choice) |
|
11595 |
|
11596 moreover |
|
11597 |
|
11598 have gi[simp]: "g integrable_on (cbox a b)" |
|
11599 by (auto intro!: integrable_continuous uniform_limit_theorem[OF _ u] eventuallyI c) |
|
11600 then obtain J where J: "(g has_integral J) (cbox a b)" |
|
11601 by blast |
|
11602 |
|
11603 moreover |
|
11604 |
|
11605 have "(I \<longlongrightarrow> J) F" |
|
11606 proof cases |
|
11607 assume "content (cbox a b) = 0" |
|
11608 hence "I = (\<lambda>_. 0)" "J = 0" |
|
11609 by (auto intro!: has_integral_unique I J) |
|
11610 thus ?thesis by simp |
|
11611 next |
|
11612 assume content_nonzero: "content (cbox a b) \<noteq> 0" |
|
11613 show ?thesis |
|
11614 proof (rule tendstoI) |
|
11615 fix e::real |
|
11616 assume "e > 0" |
|
11617 define e' where "e' = e / 2" |
|
11618 with \<open>e > 0\<close> have "e' > 0" by simp |
|
11619 then have "\<forall>\<^sub>F n in F. \<forall>x\<in>cbox a b. norm (f n x - g x) < e' / content (cbox a b)" |
|
11620 using u content_nonzero content_pos_le[of a b] |
|
11621 by (auto simp: uniform_limit_iff dist_norm) |
|
11622 then show "\<forall>\<^sub>F n in F. dist (I n) J < e" |
|
11623 proof eventually_elim |
|
11624 case (elim n) |
|
11625 have "I n = integral (cbox a b) (f n)" |
|
11626 "J = integral (cbox a b) g" |
|
11627 using I[of n] J by (simp_all add: integral_unique) |
|
11628 then have "dist (I n) J = norm (integral (cbox a b) (\<lambda>x. f n x - g x))" |
|
11629 by (simp add: integral_diff dist_norm) |
|
11630 also have "\<dots> \<le> integral (cbox a b) (\<lambda>x. (e' / content (cbox a b)))" |
|
11631 using elim |
|
11632 by (intro integral_norm_bound_integral) |
|
11633 (auto intro!: integrable_diff absolutely_integrable_onI) |
|
11634 also have "\<dots> < e" |
|
11635 using \<open>0 < e\<close> |
|
11636 by (simp add: e'_def) |
|
11637 finally show ?case . |
|
11638 qed |
|
11639 qed |
|
11640 qed |
|
11641 ultimately show ?thesis .. |
|
11642 qed |
|
11643 |
|
11644 |
|
11645 subsection \<open>Dominated convergence\<close> |
|
11646 |
|
11647 context |
|
11648 begin |
|
11649 |
|
11650 private lemma dominated_convergence_real: |
|
11651 fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> real" |
|
11652 assumes "\<And>k. (f k) integrable_on s" "h integrable_on s" |
|
11653 and "\<And>k. \<forall>x \<in> s. norm (f k x) \<le> h x" |
|
11654 and "\<forall>x \<in> s. ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially" |
|
11655 shows "g integrable_on s \<and> ((\<lambda>k. integral s (f k)) \<longlongrightarrow> integral s g) sequentially" |
|
11656 proof |
|
11657 have bdd_below[simp]: "\<And>x P. x \<in> s \<Longrightarrow> bdd_below {f n x |n. P n}" |
|
11658 proof (safe intro!: bdd_belowI) |
|
11659 fix n x show "x \<in> s \<Longrightarrow> - h x \<le> f n x" |
|
11660 using assms(3)[rule_format, of x n] by simp |
|
11661 qed |
|
11662 have bdd_above[simp]: "\<And>x P. x \<in> s \<Longrightarrow> bdd_above {f n x |n. P n}" |
|
11663 proof (safe intro!: bdd_aboveI) |
|
11664 fix n x show "x \<in> s \<Longrightarrow> f n x \<le> h x" |
|
11665 using assms(3)[rule_format, of x n] by simp |
|
11666 qed |
|
11667 |
|
11668 have "\<And>m. (\<lambda>x. Inf {f j x |j. m \<le> j}) integrable_on s \<and> |
|
11669 ((\<lambda>k. integral s (\<lambda>x. Inf {f j x |j. j \<in> {m..m + k}})) \<longlongrightarrow> |
|
11670 integral s (\<lambda>x. Inf {f j x |j. m \<le> j}))sequentially" |
|
11671 proof (rule monotone_convergence_decreasing, safe) |
|
11672 fix m :: nat |
|
11673 show "bounded {integral s (\<lambda>x. Inf {f j x |j. j \<in> {m..m + k}}) |k. True}" |
|
11674 unfolding bounded_iff |
|
11675 apply (rule_tac x="integral s h" in exI) |
|
11676 proof safe |
|
11677 fix k :: nat |
|
11678 show "norm (integral s (\<lambda>x. Inf {f j x |j. j \<in> {m..m + k}})) \<le> integral s h" |
|
11679 apply (rule integral_norm_bound_integral) |
|
11680 unfolding simple_image |
|
11681 apply (rule absolutely_integrable_onD) |
|
11682 apply (rule absolutely_integrable_inf_real) |
|
11683 prefer 5 |
|
11684 unfolding real_norm_def |
|
11685 apply rule |
|
11686 apply (rule cInf_abs_ge) |
|
11687 prefer 5 |
|
11688 apply rule |
|
11689 apply (rule_tac g = h in absolutely_integrable_integrable_bound) |
|
11690 using assms |
|
11691 unfolding real_norm_def |
|
11692 apply auto |
|
11693 done |
|
11694 qed |
|
11695 fix k :: nat |
|
11696 show "(\<lambda>x. Inf {f j x |j. j \<in> {m..m + k}}) integrable_on s" |
|
11697 unfolding simple_image |
|
11698 apply (rule absolutely_integrable_onD) |
|
11699 apply (rule absolutely_integrable_inf_real) |
|
11700 prefer 3 |
|
11701 using absolutely_integrable_integrable_bound[OF assms(3,1,2)] |
|
11702 apply auto |
|
11703 done |
|
11704 fix x |
|
11705 assume x: "x \<in> s" |
|
11706 show "Inf {f j x |j. j \<in> {m..m + Suc k}} \<le> Inf {f j x |j. j \<in> {m..m + k}}" |
|
11707 by (rule cInf_superset_mono) auto |
|
11708 let ?S = "{f j x| j. m \<le> j}" |
|
11709 show "((\<lambda>k. Inf {f j x |j. j \<in> {m..m + k}}) \<longlongrightarrow> Inf ?S) sequentially" |
|
11710 proof (rule LIMSEQ_I, goal_cases) |
|
11711 case r: (1 r) |
|
11712 |
|
11713 have "\<exists>y\<in>?S. y < Inf ?S + r" |
|
11714 by (subst cInf_less_iff[symmetric]) (auto simp: \<open>x\<in>s\<close> r) |
|
11715 then obtain N where N: "f N x < Inf ?S + r" "m \<le> N" |
|
11716 by blast |
|
11717 |
|
11718 show ?case |
|
11719 apply (rule_tac x=N in exI) |
|
11720 apply safe |
|
11721 proof goal_cases |
|
11722 case prems: (1 n) |
|
11723 have *: "\<And>y ix. y < Inf ?S + r \<longrightarrow> Inf ?S \<le> ix \<longrightarrow> ix \<le> y \<longrightarrow> \<bar>ix - Inf ?S\<bar> < r" |
|
11724 by arith |
|
11725 show ?case |
|
11726 unfolding real_norm_def |
|
11727 apply (rule *[rule_format, OF N(1)]) |
|
11728 apply (rule cInf_superset_mono, auto simp: \<open>x\<in>s\<close>) [] |
|
11729 apply (rule cInf_lower) |
|
11730 using N prems |
|
11731 apply auto [] |
|
11732 apply simp |
|
11733 done |
|
11734 qed |
|
11735 qed |
|
11736 qed |
|
11737 note dec1 = conjunctD2[OF this] |
|
11738 |
|
11739 have "\<And>m. (\<lambda>x. Sup {f j x |j. m \<le> j}) integrable_on s \<and> |
|
11740 ((\<lambda>k. integral s (\<lambda>x. Sup {f j x |j. j \<in> {m..m + k}})) \<longlongrightarrow> |
|
11741 integral s (\<lambda>x. Sup {f j x |j. m \<le> j})) sequentially" |
|
11742 proof (rule monotone_convergence_increasing,safe) |
|
11743 fix m :: nat |
|
11744 show "bounded {integral s (\<lambda>x. Sup {f j x |j. j \<in> {m..m + k}}) |k. True}" |
|
11745 unfolding bounded_iff |
|
11746 apply (rule_tac x="integral s h" in exI) |
|
11747 proof safe |
|
11748 fix k :: nat |
|
11749 show "norm (integral s (\<lambda>x. Sup {f j x |j. j \<in> {m..m + k}})) \<le> integral s h" |
|
11750 apply (rule integral_norm_bound_integral) unfolding simple_image |
|
11751 apply (rule absolutely_integrable_onD) |
|
11752 apply(rule absolutely_integrable_sup_real) |
|
11753 prefer 5 unfolding real_norm_def |
|
11754 apply rule |
|
11755 apply (rule cSup_abs_le) |
|
11756 using assms |
|
11757 apply (force simp add: ) |
|
11758 prefer 4 |
|
11759 apply rule |
|
11760 apply (rule_tac g=h in absolutely_integrable_integrable_bound) |
|
11761 using assms |
|
11762 unfolding real_norm_def |
|
11763 apply auto |
|
11764 done |
|
11765 qed |
|
11766 fix k :: nat |
|
11767 show "(\<lambda>x. Sup {f j x |j. j \<in> {m..m + k}}) integrable_on s" |
|
11768 unfolding simple_image |
|
11769 apply (rule absolutely_integrable_onD) |
|
11770 apply (rule absolutely_integrable_sup_real) |
|
11771 prefer 3 |
|
11772 using absolutely_integrable_integrable_bound[OF assms(3,1,2)] |
|
11773 apply auto |
|
11774 done |
|
11775 fix x |
|
11776 assume x: "x\<in>s" |
|
11777 show "Sup {f j x |j. j \<in> {m..m + Suc k}} \<ge> Sup {f j x |j. j \<in> {m..m + k}}" |
|
11778 by (rule cSup_subset_mono) auto |
|
11779 let ?S = "{f j x| j. m \<le> j}" |
|
11780 show "((\<lambda>k. Sup {f j x |j. j \<in> {m..m + k}}) \<longlongrightarrow> Sup ?S) sequentially" |
|
11781 proof (rule LIMSEQ_I, goal_cases) |
|
11782 case r: (1 r) |
|
11783 have "\<exists>y\<in>?S. Sup ?S - r < y" |
|
11784 by (subst less_cSup_iff[symmetric]) (auto simp: r \<open>x\<in>s\<close>) |
|
11785 then obtain N where N: "Sup ?S - r < f N x" "m \<le> N" |
|
11786 by blast |
|
11787 |
|
11788 show ?case |
|
11789 apply (rule_tac x=N in exI) |
|
11790 apply safe |
|
11791 proof goal_cases |
|
11792 case prems: (1 n) |
|
11793 have *: "\<And>y ix. Sup ?S - r < y \<longrightarrow> ix \<le> Sup ?S \<longrightarrow> y \<le> ix \<longrightarrow> \<bar>ix - Sup ?S\<bar> < r" |
|
11794 by arith |
|
11795 show ?case |
|
11796 apply simp |
|
11797 apply (rule *[rule_format, OF N(1)]) |
|
11798 apply (rule cSup_subset_mono, auto simp: \<open>x\<in>s\<close>) [] |
|
11799 apply (subst cSup_upper) |
|
11800 using N prems |
|
11801 apply auto |
|
11802 done |
|
11803 qed |
|
11804 qed |
|
11805 qed |
|
11806 note inc1 = conjunctD2[OF this] |
|
11807 |
|
11808 have "g integrable_on s \<and> |
|
11809 ((\<lambda>k. integral s (\<lambda>x. Inf {f j x |j. k \<le> j})) \<longlongrightarrow> integral s g) sequentially" |
|
11810 apply (rule monotone_convergence_increasing,safe) |
|
11811 apply fact |
|
11812 proof - |
|
11813 show "bounded {integral s (\<lambda>x. Inf {f j x |j. k \<le> j}) |k. True}" |
|
11814 unfolding bounded_iff apply(rule_tac x="integral s h" in exI) |
|
11815 proof safe |
|
11816 fix k :: nat |
|
11817 show "norm (integral s (\<lambda>x. Inf {f j x |j. k \<le> j})) \<le> integral s h" |
|
11818 apply (rule integral_norm_bound_integral) |
|
11819 apply fact+ |
|
11820 unfolding real_norm_def |
|
11821 apply rule |
|
11822 apply (rule cInf_abs_ge) |
|
11823 using assms(3) |
|
11824 apply auto |
|
11825 done |
|
11826 qed |
|
11827 fix k :: nat and x |
|
11828 assume x: "x \<in> s" |
|
11829 |
|
11830 have *: "\<And>x y::real. x \<ge> - y \<Longrightarrow> - x \<le> y" by auto |
|
11831 show "Inf {f j x |j. k \<le> j} \<le> Inf {f j x |j. Suc k \<le> j}" |
|
11832 by (intro cInf_superset_mono) (auto simp: \<open>x\<in>s\<close>) |
|
11833 |
|
11834 show "(\<lambda>k::nat. Inf {f j x |j. k \<le> j}) \<longlonglongrightarrow> g x" |
|
11835 proof (rule LIMSEQ_I, goal_cases) |
|
11836 case r: (1 r) |
|
11837 then have "0<r/2" |
|
11838 by auto |
|
11839 from assms(4)[THEN bspec, THEN LIMSEQ_D, OF x this] guess N .. note N = this |
|
11840 show ?case |
|
11841 apply (rule_tac x=N in exI) |
|
11842 apply safe |
|
11843 unfolding real_norm_def |
|
11844 apply (rule le_less_trans[of _ "r/2"]) |
|
11845 apply (rule cInf_asclose) |
|
11846 apply safe |
|
11847 defer |
|
11848 apply (rule less_imp_le) |
|
11849 using N r |
|
11850 apply auto |
|
11851 done |
|
11852 qed |
|
11853 qed |
|
11854 note inc2 = conjunctD2[OF this] |
|
11855 |
|
11856 have "g integrable_on s \<and> |
|
11857 ((\<lambda>k. integral s (\<lambda>x. Sup {f j x |j. k \<le> j})) \<longlongrightarrow> integral s g) sequentially" |
|
11858 apply (rule monotone_convergence_decreasing,safe) |
|
11859 apply fact |
|
11860 proof - |
|
11861 show "bounded {integral s (\<lambda>x. Sup {f j x |j. k \<le> j}) |k. True}" |
|
11862 unfolding bounded_iff |
|
11863 apply (rule_tac x="integral s h" in exI) |
|
11864 proof safe |
|
11865 fix k :: nat |
|
11866 show "norm (integral s (\<lambda>x. Sup {f j x |j. k \<le> j})) \<le> integral s h" |
|
11867 apply (rule integral_norm_bound_integral) |
|
11868 apply fact+ |
|
11869 unfolding real_norm_def |
|
11870 apply rule |
|
11871 apply (rule cSup_abs_le) |
|
11872 using assms(3) |
|
11873 apply auto |
|
11874 done |
|
11875 qed |
|
11876 fix k :: nat |
|
11877 fix x |
|
11878 assume x: "x \<in> s" |
|
11879 |
|
11880 show "Sup {f j x |j. k \<le> j} \<ge> Sup {f j x |j. Suc k \<le> j}" |
|
11881 by (rule cSup_subset_mono) (auto simp: \<open>x\<in>s\<close>) |
|
11882 show "((\<lambda>k. Sup {f j x |j. k \<le> j}) \<longlongrightarrow> g x) sequentially" |
|
11883 proof (rule LIMSEQ_I, goal_cases) |
|
11884 case r: (1 r) |
|
11885 then have "0<r/2" |
|
11886 by auto |
|
11887 from assms(4)[THEN bspec, THEN LIMSEQ_D, OF x this] guess N .. note N=this |
|
11888 show ?case |
|
11889 apply (rule_tac x=N in exI,safe) |
|
11890 unfolding real_norm_def |
|
11891 apply (rule le_less_trans[of _ "r/2"]) |
|
11892 apply (rule cSup_asclose) |
|
11893 apply safe |
|
11894 defer |
|
11895 apply (rule less_imp_le) |
|
11896 using N r |
|
11897 apply auto |
|
11898 done |
|
11899 qed |
|
11900 qed |
|
11901 note dec2 = conjunctD2[OF this] |
|
11902 |
|
11903 show "g integrable_on s" by fact |
|
11904 show "((\<lambda>k. integral s (f k)) \<longlongrightarrow> integral s g) sequentially" |
|
11905 proof (rule LIMSEQ_I, goal_cases) |
|
11906 case r: (1 r) |
|
11907 from LIMSEQ_D [OF inc2(2) r] guess N1 .. note N1=this[unfolded real_norm_def] |
|
11908 from LIMSEQ_D [OF dec2(2) r] guess N2 .. note N2=this[unfolded real_norm_def] |
|
11909 show ?case |
|
11910 proof (rule_tac x="N1+N2" in exI, safe) |
|
11911 fix n |
|
11912 assume n: "n \<ge> N1 + N2" |
|
11913 have *: "\<And>i0 i i1 g. \<bar>i0 - g\<bar> < r \<longrightarrow> \<bar>i1 - g\<bar> < r \<longrightarrow> i0 \<le> i \<longrightarrow> i \<le> i1 \<longrightarrow> \<bar>i - g\<bar> < r" |
|
11914 by arith |
|
11915 show "norm (integral s (f n) - integral s g) < r" |
|
11916 unfolding real_norm_def |
|
11917 proof (rule *[rule_format,OF N1[rule_format] N2[rule_format], of n n]) |
|
11918 show "integral s (\<lambda>x. Inf {f j x |j. n \<le> j}) \<le> integral s (f n)" |
|
11919 by (rule integral_le[OF dec1(1) assms(1)]) (auto intro!: cInf_lower) |
|
11920 show "integral s (f n) \<le> integral s (\<lambda>x. Sup {f j x |j. n \<le> j})" |
|
11921 by (rule integral_le[OF assms(1) inc1(1)]) (auto intro!: cSup_upper) |
|
11922 qed (insert n, auto) |
|
11923 qed |
|
11924 qed |
|
11925 qed |
|
11926 |
|
11927 lemma dominated_convergence: |
|
11928 fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
11929 assumes f: "\<And>k. (f k) integrable_on s" and h: "h integrable_on s" |
|
11930 and le: "\<And>k. \<forall>x \<in> s. norm (f k x) \<le> h x" |
|
11931 and conv: "\<forall>x \<in> s. ((\<lambda>k. f k x) \<longlongrightarrow> g x) sequentially" |
|
11932 shows "g integrable_on s" |
|
11933 and "((\<lambda>k. integral s (f k)) \<longlongrightarrow> integral s g) sequentially" |
|
11934 proof - |
|
11935 { |
|
11936 fix b :: 'm assume b: "b \<in> Basis" |
|
11937 have A: "(\<lambda>x. g x \<bullet> b) integrable_on s \<and> |
|
11938 (\<lambda>k. integral s (\<lambda>x. f k x \<bullet> b)) \<longlonglongrightarrow> integral s (\<lambda>x. g x \<bullet> b)" |
|
11939 proof (rule dominated_convergence_real) |
|
11940 fix k :: nat |
|
11941 from f show "(\<lambda>x. f k x \<bullet> b) integrable_on s" by (rule integrable_component) |
|
11942 next |
|
11943 from h show "h integrable_on s" . |
|
11944 next |
|
11945 fix k :: nat |
|
11946 show "\<forall>x\<in>s. norm (f k x \<bullet> b) \<le> h x" |
|
11947 proof |
|
11948 fix x assume x: "x \<in> s" |
|
11949 have "norm (f k x \<bullet> b) \<le> norm (f k x)" by (simp add: Basis_le_norm b) |
|
11950 also have "\<dots> \<le> h x" using le[of k] x by simp |
|
11951 finally show "norm (f k x \<bullet> b) \<le> h x" . |
|
11952 qed |
|
11953 next |
|
11954 from conv show "\<forall>x\<in>s. (\<lambda>k. f k x \<bullet> b) \<longlonglongrightarrow> g x \<bullet> b" |
|
11955 by (auto intro!: tendsto_inner) |
|
11956 qed |
|
11957 have B: "integral s ((\<lambda>x. x *\<^sub>R b) \<circ> (\<lambda>x. f k x \<bullet> b)) = integral s (\<lambda>x. f k x \<bullet> b) *\<^sub>R b" |
|
11958 for k by (rule integral_linear) |
|
11959 (simp_all add: f integrable_component bounded_linear_scaleR_left) |
|
11960 have C: "integral s ((\<lambda>x. x *\<^sub>R b) \<circ> (\<lambda>x. g x \<bullet> b)) = integral s (\<lambda>x. g x \<bullet> b) *\<^sub>R b" |
|
11961 using A by (intro integral_linear) |
|
11962 (simp_all add: integrable_component bounded_linear_scaleR_left) |
|
11963 note A B C |
|
11964 } note A = this |
|
11965 |
|
11966 show "g integrable_on s" by (rule integrable_componentwise) (insert A, blast) |
|
11967 with A f show "((\<lambda>k. integral s (f k)) \<longlongrightarrow> integral s g) sequentially" |
|
11968 by (subst (1 2) integral_componentwise) |
|
11969 (auto intro!: tendsto_setsum tendsto_scaleR simp: o_def) |
|
11970 qed |
|
11971 |
|
11972 lemma has_integral_dominated_convergence: |
|
11973 fixes f :: "nat \<Rightarrow> 'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
|
11974 assumes "\<And>k. (f k has_integral y k) s" "h integrable_on s" |
|
11975 "\<And>k. \<forall>x\<in>s. norm (f k x) \<le> h x" "\<forall>x\<in>s. (\<lambda>k. f k x) \<longlonglongrightarrow> g x" |
|
11976 and x: "y \<longlonglongrightarrow> x" |
|
11977 shows "(g has_integral x) s" |
|
11978 proof - |
|
11979 have int_f: "\<And>k. (f k) integrable_on s" |
|
11980 using assms by (auto simp: integrable_on_def) |
|
11981 have "(g has_integral (integral s g)) s" |
|
11982 by (intro integrable_integral dominated_convergence[OF int_f assms(2)]) fact+ |
|
11983 moreover have "integral s g = x" |
|
11984 proof (rule LIMSEQ_unique) |
|
11985 show "(\<lambda>i. integral s (f i)) \<longlonglongrightarrow> x" |
|
11986 using integral_unique[OF assms(1)] x by simp |
|
11987 show "(\<lambda>i. integral s (f i)) \<longlonglongrightarrow> integral s g" |
|
11988 by (intro dominated_convergence[OF int_f assms(2)]) fact+ |
|
11989 qed |
|
11990 ultimately show ?thesis |
|
11991 by simp |
|
11992 qed |
|
11993 |
|
11994 end |
|
11995 |
|
11996 |
|
11997 subsection \<open>Integration by parts\<close> |
|
11998 |
|
11999 lemma integration_by_parts_interior_strong: |
|
12000 assumes bilinear: "bounded_bilinear (prod :: _ \<Rightarrow> _ \<Rightarrow> 'b :: banach)" |
|
12001 assumes s: "finite s" and le: "a \<le> b" |
|
12002 assumes cont [continuous_intros]: "continuous_on {a..b} f" "continuous_on {a..b} g" |
|
12003 assumes deriv: "\<And>x. x\<in>{a<..<b} - s \<Longrightarrow> (f has_vector_derivative f' x) (at x)" |
|
12004 "\<And>x. x\<in>{a<..<b} - s \<Longrightarrow> (g has_vector_derivative g' x) (at x)" |
|
12005 assumes int: "((\<lambda>x. prod (f x) (g' x)) has_integral |
|
12006 (prod (f b) (g b) - prod (f a) (g a) - y)) {a..b}" |
|
12007 shows "((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}" |
|
12008 proof - |
|
12009 interpret bounded_bilinear prod by fact |
|
12010 have "((\<lambda>x. prod (f x) (g' x) + prod (f' x) (g x)) has_integral |
|
12011 (prod (f b) (g b) - prod (f a) (g a))) {a..b}" |
|
12012 using deriv by (intro fundamental_theorem_of_calculus_interior_strong[OF s le]) |
|
12013 (auto intro!: continuous_intros continuous_on has_vector_derivative) |
|
12014 from has_integral_sub[OF this int] show ?thesis by (simp add: algebra_simps) |
|
12015 qed |
|
12016 |
|
12017 lemma integration_by_parts_interior: |
|
12018 assumes "bounded_bilinear (prod :: _ \<Rightarrow> _ \<Rightarrow> 'b :: banach)" "a \<le> b" |
|
12019 "continuous_on {a..b} f" "continuous_on {a..b} g" |
|
12020 assumes "\<And>x. x\<in>{a<..<b} \<Longrightarrow> (f has_vector_derivative f' x) (at x)" |
|
12021 "\<And>x. x\<in>{a<..<b} \<Longrightarrow> (g has_vector_derivative g' x) (at x)" |
|
12022 assumes "((\<lambda>x. prod (f x) (g' x)) has_integral (prod (f b) (g b) - prod (f a) (g a) - y)) {a..b}" |
|
12023 shows "((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}" |
|
12024 by (rule integration_by_parts_interior_strong[of _ "{}" _ _ f g f' g']) (insert assms, simp_all) |
|
12025 |
|
12026 lemma integration_by_parts: |
|
12027 assumes "bounded_bilinear (prod :: _ \<Rightarrow> _ \<Rightarrow> 'b :: banach)" "a \<le> b" |
|
12028 "continuous_on {a..b} f" "continuous_on {a..b} g" |
|
12029 assumes "\<And>x. x\<in>{a..b} \<Longrightarrow> (f has_vector_derivative f' x) (at x)" |
|
12030 "\<And>x. x\<in>{a..b} \<Longrightarrow> (g has_vector_derivative g' x) (at x)" |
|
12031 assumes "((\<lambda>x. prod (f x) (g' x)) has_integral (prod (f b) (g b) - prod (f a) (g a) - y)) {a..b}" |
|
12032 shows "((\<lambda>x. prod (f' x) (g x)) has_integral y) {a..b}" |
|
12033 by (rule integration_by_parts_interior[of _ _ _ f g f' g']) (insert assms, simp_all) |
|
12034 |
|
12035 lemma integrable_by_parts_interior_strong: |
|
12036 assumes bilinear: "bounded_bilinear (prod :: _ \<Rightarrow> _ \<Rightarrow> 'b :: banach)" |
|
12037 assumes s: "finite s" and le: "a \<le> b" |
|
12038 assumes cont [continuous_intros]: "continuous_on {a..b} f" "continuous_on {a..b} g" |
|
12039 assumes deriv: "\<And>x. x\<in>{a<..<b} - s \<Longrightarrow> (f has_vector_derivative f' x) (at x)" |
|
12040 "\<And>x. x\<in>{a<..<b} - s \<Longrightarrow> (g has_vector_derivative g' x) (at x)" |
|
12041 assumes int: "(\<lambda>x. prod (f x) (g' x)) integrable_on {a..b}" |
|
12042 shows "(\<lambda>x. prod (f' x) (g x)) integrable_on {a..b}" |
|
12043 proof - |
|
12044 from int obtain I where "((\<lambda>x. prod (f x) (g' x)) has_integral I) {a..b}" |
|
12045 unfolding integrable_on_def by blast |
|
12046 hence "((\<lambda>x. prod (f x) (g' x)) has_integral (prod (f b) (g b) - prod (f a) (g a) - |
|
12047 (prod (f b) (g b) - prod (f a) (g a) - I))) {a..b}" by simp |
|
12048 from integration_by_parts_interior_strong[OF assms(1-7) this] |
|
12049 show ?thesis unfolding integrable_on_def by blast |
|
12050 qed |
|
12051 |
|
12052 lemma integrable_by_parts_interior: |
|
12053 assumes "bounded_bilinear (prod :: _ \<Rightarrow> _ \<Rightarrow> 'b :: banach)" "a \<le> b" |
|
12054 "continuous_on {a..b} f" "continuous_on {a..b} g" |
|
12055 assumes "\<And>x. x\<in>{a<..<b} \<Longrightarrow> (f has_vector_derivative f' x) (at x)" |
|
12056 "\<And>x. x\<in>{a<..<b} \<Longrightarrow> (g has_vector_derivative g' x) (at x)" |
|
12057 assumes "(\<lambda>x. prod (f x) (g' x)) integrable_on {a..b}" |
|
12058 shows "(\<lambda>x. prod (f' x) (g x)) integrable_on {a..b}" |
|
12059 by (rule integrable_by_parts_interior_strong[of _ "{}" _ _ f g f' g']) (insert assms, simp_all) |
|
12060 |
|
12061 lemma integrable_by_parts: |
|
12062 assumes "bounded_bilinear (prod :: _ \<Rightarrow> _ \<Rightarrow> 'b :: banach)" "a \<le> b" |
|
12063 "continuous_on {a..b} f" "continuous_on {a..b} g" |
|
12064 assumes "\<And>x. x\<in>{a..b} \<Longrightarrow> (f has_vector_derivative f' x) (at x)" |
|
12065 "\<And>x. x\<in>{a..b} \<Longrightarrow> (g has_vector_derivative g' x) (at x)" |
|
12066 assumes "(\<lambda>x. prod (f x) (g' x)) integrable_on {a..b}" |
|
12067 shows "(\<lambda>x. prod (f' x) (g x)) integrable_on {a..b}" |
|
12068 by (rule integrable_by_parts_interior_strong[of _ "{}" _ _ f g f' g']) (insert assms, simp_all) |
|
12069 |
|
12070 |
|
12071 subsection \<open>Integration by substitution\<close> |
|
12072 |
|
12073 |
|
12074 lemma has_integral_substitution_strong: |
|
12075 fixes f :: "real \<Rightarrow> 'a::euclidean_space" and g :: "real \<Rightarrow> real" |
|
12076 assumes s: "finite s" and le: "a \<le> b" "c \<le> d" "g a \<le> g b" |
|
12077 and subset: "g ` {a..b} \<subseteq> {c..d}" |
|
12078 and f [continuous_intros]: "continuous_on {c..d} f" |
|
12079 and g [continuous_intros]: "continuous_on {a..b} g" |
|
12080 and deriv [derivative_intros]: |
|
12081 "\<And>x. x \<in> {a..b} - s \<Longrightarrow> (g has_field_derivative g' x) (at x within {a..b})" |
|
12082 shows "((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral (integral {g a..g b} f)) {a..b}" |
|
12083 proof - |
|
12084 let ?F = "\<lambda>x. integral {c..g x} f" |
|
12085 have cont_int: "continuous_on {a..b} ?F" |
|
12086 by (rule continuous_on_compose2[OF _ g subset] indefinite_integral_continuous |
|
12087 f integrable_continuous_real)+ |
|
12088 have deriv: "(((\<lambda>x. integral {c..x} f) \<circ> g) has_vector_derivative g' x *\<^sub>R f (g x)) |
|
12089 (at x within {a..b})" if "x \<in> {a..b} - s" for x |
|
12090 apply (rule has_vector_derivative_eq_rhs) |
|
12091 apply (rule vector_diff_chain_within) |
|
12092 apply (subst has_field_derivative_iff_has_vector_derivative [symmetric]) |
|
12093 apply (rule deriv that)+ |
|
12094 apply (rule has_vector_derivative_within_subset) |
|
12095 apply (rule integral_has_vector_derivative f)+ |
|
12096 using that le subset |
|
12097 apply blast+ |
|
12098 done |
|
12099 have deriv: "(?F has_vector_derivative g' x *\<^sub>R f (g x)) |
|
12100 (at x)" if "x \<in> {a..b} - (s \<union> {a,b})" for x |
|
12101 using deriv[of x] that by (simp add: at_within_closed_interval o_def) |
|
12102 |
|
12103 |
|
12104 have "((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral (?F b - ?F a)) {a..b}" |
|
12105 using le cont_int s deriv cont_int |
|
12106 by (intro fundamental_theorem_of_calculus_interior_strong[of "s \<union> {a,b}"]) simp_all |
|
12107 also from subset have "g x \<in> {c..d}" if "x \<in> {a..b}" for x using that by blast |
|
12108 from this[of a] this[of b] le have "c \<le> g a" "g b \<le> d" by auto |
|
12109 hence "integral {c..g a} f + integral {g a..g b} f = integral {c..g b} f" |
|
12110 by (intro integral_combine integrable_continuous_real continuous_on_subset[OF f] le) simp_all |
|
12111 hence "integral {c..g b} f - integral {c..g a} f = integral {g a..g b} f" |
|
12112 by (simp add: algebra_simps) |
|
12113 finally show ?thesis . |
|
12114 qed |
|
12115 |
|
12116 lemma has_integral_substitution: |
|
12117 fixes f :: "real \<Rightarrow> 'a::euclidean_space" and g :: "real \<Rightarrow> real" |
|
12118 assumes "a \<le> b" "c \<le> d" "g a \<le> g b" "g ` {a..b} \<subseteq> {c..d}" |
|
12119 and "continuous_on {c..d} f" |
|
12120 and "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_field_derivative g' x) (at x within {a..b})" |
|
12121 shows "((\<lambda>x. g' x *\<^sub>R f (g x)) has_integral (integral {g a..g b} f)) {a..b}" |
|
12122 by (intro has_integral_substitution_strong[of "{}" a b c d] assms) |
|
12123 (auto intro: DERIV_continuous_on assms) |
|
12124 |
|
12125 |
|
12126 subsection \<open>Compute a double integral using iterated integrals and switching the order of integration\<close> |
|
12127 |
|
12128 lemma setcomp_dot1: "{z. P (z \<bullet> (i,0))} = {(x,y). P(x \<bullet> i)}" |
|
12129 by auto |
|
12130 |
|
12131 lemma setcomp_dot2: "{z. P (z \<bullet> (0,i))} = {(x,y). P(y \<bullet> i)}" |
|
12132 by auto |
|
12133 |
|
12134 lemma Sigma_Int_Paircomp1: "(Sigma A B) \<inter> {(x, y). P x} = Sigma (A \<inter> {x. P x}) B" |
|
12135 by blast |
|
12136 |
|
12137 lemma Sigma_Int_Paircomp2: "(Sigma A B) \<inter> {(x, y). P y} = Sigma A (\<lambda>z. B z \<inter> {y. P y})" |
|
12138 by blast |
|
12139 |
|
12140 lemma continuous_on_imp_integrable_on_Pair1: |
|
12141 fixes f :: "_ \<Rightarrow> 'b::banach" |
|
12142 assumes con: "continuous_on (cbox (a,c) (b,d)) f" and x: "x \<in> cbox a b" |
|
12143 shows "(\<lambda>y. f (x, y)) integrable_on (cbox c d)" |
|
12144 proof - |
|
12145 have "f \<circ> (\<lambda>y. (x, y)) integrable_on (cbox c d)" |
|
12146 apply (rule integrable_continuous) |
|
12147 apply (rule continuous_on_compose [OF _ continuous_on_subset [OF con]]) |
|
12148 using x |
|
12149 apply (auto intro: continuous_on_Pair continuous_on_const continuous_on_id continuous_on_subset con) |
|
12150 done |
|
12151 then show ?thesis |
|
12152 by (simp add: o_def) |
|
12153 qed |
|
12154 |
|
12155 lemma integral_integrable_2dim: |
|
12156 fixes f :: "('a::euclidean_space * 'b::euclidean_space) \<Rightarrow> 'c::banach" |
|
12157 assumes "continuous_on (cbox (a,c) (b,d)) f" |
|
12158 shows "(\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y))) integrable_on cbox a b" |
|
12159 proof (cases "content(cbox c d) = 0") |
|
12160 case True |
|
12161 then show ?thesis |
|
12162 by (simp add: True integrable_const) |
|
12163 next |
|
12164 case False |
|
12165 have uc: "uniformly_continuous_on (cbox (a,c) (b,d)) f" |
|
12166 by (simp add: assms compact_cbox compact_uniformly_continuous) |
|
12167 { fix x::'a and e::real |
|
12168 assume x: "x \<in> cbox a b" and e: "0 < e" |
|
12169 then have e2_gt: "0 < e / 2 / content (cbox c d)" and e2_less: "e / 2 / content (cbox c d) * content (cbox c d) < e" |
|
12170 by (auto simp: False content_lt_nz e) |
|
12171 then obtain dd |
|
12172 where dd: "\<And>x x'. \<lbrakk>x\<in>cbox (a, c) (b, d); x'\<in>cbox (a, c) (b, d); norm (x' - x) < dd\<rbrakk> |
|
12173 \<Longrightarrow> norm (f x' - f x) \<le> e / (2 * content (cbox c d))" "dd>0" |
|
12174 using uc [unfolded uniformly_continuous_on_def, THEN spec, of "e / (2 * content (cbox c d))"] |
|
12175 by (auto simp: dist_norm intro: less_imp_le) |
|
12176 have "\<exists>delta>0. \<forall>x'\<in>cbox a b. norm (x' - x) < delta \<longrightarrow> norm (integral (cbox c d) (\<lambda>u. f (x', u) - f (x, u))) < e" |
|
12177 apply (rule_tac x=dd in exI) |
|
12178 using dd e2_gt assms x |
|
12179 apply clarify |
|
12180 apply (rule le_less_trans [OF _ e2_less]) |
|
12181 apply (rule integrable_bound) |
|
12182 apply (auto intro: integrable_diff continuous_on_imp_integrable_on_Pair1) |
|
12183 done |
|
12184 } note * = this |
|
12185 show ?thesis |
|
12186 apply (rule integrable_continuous) |
|
12187 apply (simp add: * continuous_on_iff dist_norm integral_diff [symmetric] continuous_on_imp_integrable_on_Pair1 [OF assms]) |
|
12188 done |
|
12189 qed |
|
12190 |
|
12191 lemma norm_diff2: "\<lbrakk>y = y1 + y2; x = x1 + x2; e = e1 + e2; norm(y1 - x1) \<le> e1; norm(y2 - x2) \<le> e2\<rbrakk> |
|
12192 \<Longrightarrow> norm(y - x) \<le> e" |
|
12193 using norm_triangle_mono [of "y1 - x1" "e1" "y2 - x2" "e2"] |
|
12194 by (simp add: add_diff_add) |
|
12195 |
|
12196 lemma integral_split: |
|
12197 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::{real_normed_vector,complete_space}" |
|
12198 assumes f: "f integrable_on (cbox a b)" |
|
12199 and k: "k \<in> Basis" |
|
12200 shows "integral (cbox a b) f = |
|
12201 integral (cbox a b \<inter> {x. x\<bullet>k \<le> c}) f + |
|
12202 integral (cbox a b \<inter> {x. x\<bullet>k \<ge> c}) f" |
|
12203 apply (rule integral_unique [OF has_integral_split [where c=c]]) |
|
12204 using k f |
|
12205 apply (auto simp: has_integral_integral [symmetric]) |
|
12206 done |
|
12207 |
|
12208 lemma integral_swap_operative: |
|
12209 fixes f :: "('a::euclidean_space * 'b::euclidean_space) \<Rightarrow> 'c::banach" |
|
12210 assumes f: "continuous_on s f" and e: "0 < e" |
|
12211 shows "comm_monoid.operative (op \<and>) True |
|
12212 (\<lambda>k. \<forall>a b c d. |
|
12213 cbox (a,c) (b,d) \<subseteq> k \<and> cbox (a,c) (b,d) \<subseteq> s |
|
12214 \<longrightarrow> norm(integral (cbox (a,c) (b,d)) f - |
|
12215 integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f((x,y))))) |
|
12216 \<le> e * content (cbox (a,c) (b,d)))" |
|
12217 proof (auto simp: comm_monoid.operative_def[OF comm_monoid_and]) |
|
12218 fix a::'a and c::'b and b::'a and d::'b and u::'a and v::'a and w::'b and z::'b |
|
12219 assume c0: "content (cbox (a, c) (b, d)) = 0" |
|
12220 and cb1: "cbox (u, w) (v, z) \<subseteq> cbox (a, c) (b, d)" |
|
12221 and cb2: "cbox (u, w) (v, z) \<subseteq> s" |
|
12222 have c0': "content (cbox (u, w) (v, z)) = 0" |
|
12223 by (fact content_0_subset [OF c0 cb1]) |
|
12224 show "norm (integral (cbox (u,w) (v,z)) f - integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y)))) |
|
12225 \<le> e * content (cbox (u,w) (v,z))" |
|
12226 using content_cbox_pair_eq0_D [OF c0'] |
|
12227 by (force simp add: c0') |
|
12228 next |
|
12229 fix a::'a and c::'b and b::'a and d::'b |
|
12230 and M::real and i::'a and j::'b |
|
12231 and u::'a and v::'a and w::'b and z::'b |
|
12232 assume ij: "(i,j) \<in> Basis" |
|
12233 and n1: "\<forall>a' b' c' d'. |
|
12234 cbox (a',c') (b',d') \<subseteq> cbox (a,c) (b,d) \<and> |
|
12235 cbox (a',c') (b',d') \<subseteq> {x. x \<bullet> (i,j) \<le> M} \<and> cbox (a',c') (b',d') \<subseteq> s \<longrightarrow> |
|
12236 norm (integral (cbox (a',c') (b',d')) f - integral (cbox a' b') (\<lambda>x. integral (cbox c' d') (\<lambda>y. f (x,y)))) |
|
12237 \<le> e * content (cbox (a',c') (b',d'))" |
|
12238 and n2: "\<forall>a' b' c' d'. |
|
12239 cbox (a',c') (b',d') \<subseteq> cbox (a,c) (b,d) \<and> |
|
12240 cbox (a',c') (b',d') \<subseteq> {x. M \<le> x \<bullet> (i,j)} \<and> cbox (a',c') (b',d') \<subseteq> s \<longrightarrow> |
|
12241 norm (integral (cbox (a',c') (b',d')) f - integral (cbox a' b') (\<lambda>x. integral (cbox c' d') (\<lambda>y. f (x,y)))) |
|
12242 \<le> e * content (cbox (a',c') (b',d'))" |
|
12243 and subs: "cbox (u,w) (v,z) \<subseteq> cbox (a,c) (b,d)" "cbox (u,w) (v,z) \<subseteq> s" |
|
12244 have fcont: "continuous_on (cbox (u, w) (v, z)) f" |
|
12245 using assms(1) continuous_on_subset subs(2) by blast |
|
12246 then have fint: "f integrable_on cbox (u, w) (v, z)" |
|
12247 by (metis integrable_continuous) |
|
12248 consider "i \<in> Basis" "j=0" | "j \<in> Basis" "i=0" using ij |
|
12249 by (auto simp: Euclidean_Space.Basis_prod_def) |
|
12250 then show "norm (integral (cbox (u,w) (v,z)) f - integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x,y)))) |
|
12251 \<le> e * content (cbox (u,w) (v,z))" (is ?normle) |
|
12252 proof cases |
|
12253 case 1 |
|
12254 then have e: "e * content (cbox (u, w) (v, z)) = |
|
12255 e * (content (cbox u v \<inter> {x. x \<bullet> i \<le> M}) * content (cbox w z)) + |
|
12256 e * (content (cbox u v \<inter> {x. M \<le> x \<bullet> i}) * content (cbox w z))" |
|
12257 by (simp add: content_split [where c=M] content_Pair algebra_simps) |
|
12258 have *: "integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y))) = |
|
12259 integral (cbox u v \<inter> {x. x \<bullet> i \<le> M}) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y))) + |
|
12260 integral (cbox u v \<inter> {x. M \<le> x \<bullet> i}) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y)))" |
|
12261 using 1 f subs integral_integrable_2dim continuous_on_subset |
|
12262 by (blast intro: integral_split) |
|
12263 show ?normle |
|
12264 apply (rule norm_diff2 [OF integral_split [where c=M, OF fint ij] * e]) |
|
12265 using 1 subs |
|
12266 apply (simp_all add: cbox_Pair_eq setcomp_dot1 [of "\<lambda>u. M\<le>u"] setcomp_dot1 [of "\<lambda>u. u\<le>M"] Sigma_Int_Paircomp1) |
|
12267 apply (simp_all add: interval_split ij) |
|
12268 apply (simp_all add: cbox_Pair_eq [symmetric] content_Pair [symmetric]) |
|
12269 apply (force simp add: interval_split [symmetric] intro!: n1 [rule_format]) |
|
12270 apply (force simp add: interval_split [symmetric] intro!: n2 [rule_format]) |
|
12271 done |
|
12272 next |
|
12273 case 2 |
|
12274 then have e: "e * content (cbox (u, w) (v, z)) = |
|
12275 e * (content (cbox u v) * content (cbox w z \<inter> {x. x \<bullet> j \<le> M})) + |
|
12276 e * (content (cbox u v) * content (cbox w z \<inter> {x. M \<le> x \<bullet> j}))" |
|
12277 by (simp add: content_split [where c=M] content_Pair algebra_simps) |
|
12278 have "(\<lambda>x. integral (cbox w z \<inter> {x. x \<bullet> j \<le> M}) (\<lambda>y. f (x, y))) integrable_on cbox u v" |
|
12279 "(\<lambda>x. integral (cbox w z \<inter> {x. M \<le> x \<bullet> j}) (\<lambda>y. f (x, y))) integrable_on cbox u v" |
|
12280 using 2 subs |
|
12281 apply (simp_all add: interval_split) |
|
12282 apply (rule_tac [!] integral_integrable_2dim [OF continuous_on_subset [OF f]]) |
|
12283 apply (auto simp: cbox_Pair_eq interval_split [symmetric]) |
|
12284 done |
|
12285 with 2 have *: "integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y))) = |
|
12286 integral (cbox u v) (\<lambda>x. integral (cbox w z \<inter> {x. x \<bullet> j \<le> M}) (\<lambda>y. f (x, y))) + |
|
12287 integral (cbox u v) (\<lambda>x. integral (cbox w z \<inter> {x. M \<le> x \<bullet> j}) (\<lambda>y. f (x, y)))" |
|
12288 by (simp add: integral_add [symmetric] integral_split [symmetric] |
|
12289 continuous_on_imp_integrable_on_Pair1 [OF fcont] cong: integral_cong) |
|
12290 show ?normle |
|
12291 apply (rule norm_diff2 [OF integral_split [where c=M, OF fint ij] * e]) |
|
12292 using 2 subs |
|
12293 apply (simp_all add: cbox_Pair_eq setcomp_dot2 [of "\<lambda>u. M\<le>u"] setcomp_dot2 [of "\<lambda>u. u\<le>M"] Sigma_Int_Paircomp2) |
|
12294 apply (simp_all add: interval_split ij) |
|
12295 apply (simp_all add: cbox_Pair_eq [symmetric] content_Pair [symmetric]) |
|
12296 apply (force simp add: interval_split [symmetric] intro!: n1 [rule_format]) |
|
12297 apply (force simp add: interval_split [symmetric] intro!: n2 [rule_format]) |
|
12298 done |
|
12299 qed |
|
12300 qed |
|
12301 |
|
12302 lemma integral_Pair_const: |
|
12303 "integral (cbox (a,c) (b,d)) (\<lambda>x. k) = |
|
12304 integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. k))" |
|
12305 by (simp add: content_Pair) |
|
12306 |
|
12307 lemma norm_minus2: "norm (x1-x2, y1-y2) = norm (x2-x1, y2-y1)" |
|
12308 by (simp add: norm_minus_eqI) |
|
12309 |
|
12310 lemma integral_prod_continuous: |
|
12311 fixes f :: "('a::euclidean_space * 'b::euclidean_space) \<Rightarrow> 'c::banach" |
|
12312 assumes "continuous_on (cbox (a,c) (b,d)) f" (is "continuous_on ?CBOX f") |
|
12313 shows "integral (cbox (a,c) (b,d)) f = integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f(x,y)))" |
|
12314 proof (cases "content ?CBOX = 0") |
|
12315 case True |
|
12316 then show ?thesis |
|
12317 by (auto simp: content_Pair) |
|
12318 next |
|
12319 case False |
|
12320 then have cbp: "content ?CBOX > 0" |
|
12321 using content_lt_nz by blast |
|
12322 have "norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y)))) = 0" |
|
12323 proof (rule dense_eq0_I, simp) |
|
12324 fix e::real assume "0 < e" |
|
12325 with cbp have e': "0 < e / content ?CBOX" |
|
12326 by simp |
|
12327 have f_int_acbd: "f integrable_on cbox (a,c) (b,d)" |
|
12328 by (rule integrable_continuous [OF assms]) |
|
12329 { fix p |
|
12330 assume p: "p division_of cbox (a,c) (b,d)" |
|
12331 note opd1 = comm_monoid_set.operative_division [OF comm_monoid_set_and integral_swap_operative [OF assms e'], THEN iffD1, |
|
12332 THEN spec, THEN spec, THEN spec, THEN spec, of p "(a,c)" "(b,d)" a c b d] |
|
12333 have "(\<And>t u v w z. |
|
12334 \<lbrakk>t \<in> p; cbox (u,w) (v,z) \<subseteq> t; cbox (u,w) (v,z) \<subseteq> cbox (a,c) (b,d)\<rbrakk> \<Longrightarrow> |
|
12335 norm (integral (cbox (u,w) (v,z)) f - integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x,y)))) |
|
12336 \<le> e * content (cbox (u,w) (v,z)) / content?CBOX) |
|
12337 \<Longrightarrow> |
|
12338 norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y)))) \<le> e" |
|
12339 using opd1 [OF p] False by (simp add: comm_monoid_set_F_and) |
|
12340 } note op_acbd = this |
|
12341 { fix k::real and p and u::'a and v w and z::'b and t1 t2 l |
|
12342 assume k: "0 < k" |
|
12343 and nf: "\<And>x y u v. |
|
12344 \<lbrakk>x \<in> cbox a b; y \<in> cbox c d; u \<in> cbox a b; v\<in>cbox c d; norm (u-x, v-y) < k\<rbrakk> |
|
12345 \<Longrightarrow> norm (f(u,v) - f(x,y)) < e / (2 * (content ?CBOX))" |
|
12346 and p_acbd: "p tagged_division_of cbox (a,c) (b,d)" |
|
12347 and fine: "(\<lambda>x. ball x k) fine p" "((t1,t2), l) \<in> p" |
|
12348 and uwvz_sub: "cbox (u,w) (v,z) \<subseteq> l" "cbox (u,w) (v,z) \<subseteq> cbox (a,c) (b,d)" |
|
12349 have t: "t1 \<in> cbox a b" "t2 \<in> cbox c d" |
|
12350 by (meson fine p_acbd cbox_Pair_iff tag_in_interval)+ |
|
12351 have ls: "l \<subseteq> ball (t1,t2) k" |
|
12352 using fine by (simp add: fine_def Ball_def) |
|
12353 { fix x1 x2 |
|
12354 assume xuvwz: "x1 \<in> cbox u v" "x2 \<in> cbox w z" |
|
12355 then have x: "x1 \<in> cbox a b" "x2 \<in> cbox c d" |
|
12356 using uwvz_sub by auto |
|
12357 have "norm (x1 - t1, x2 - t2) < k" |
|
12358 using xuvwz ls uwvz_sub unfolding ball_def |
|
12359 by (force simp add: cbox_Pair_eq dist_norm norm_minus2) |
|
12360 then have "norm (f (x1,x2) - f (t1,t2)) \<le> e / content ?CBOX / 2" |
|
12361 using nf [OF t x] by simp |
|
12362 } note nf' = this |
|
12363 have f_int_uwvz: "f integrable_on cbox (u,w) (v,z)" |
|
12364 using f_int_acbd uwvz_sub integrable_on_subcbox by blast |
|
12365 have f_int_uv: "\<And>x. x \<in> cbox u v \<Longrightarrow> (\<lambda>y. f (x,y)) integrable_on cbox w z" |
|
12366 using assms continuous_on_subset uwvz_sub |
|
12367 by (blast intro: continuous_on_imp_integrable_on_Pair1) |
|
12368 have 1: "norm (integral (cbox (u,w) (v,z)) f - integral (cbox (u,w) (v,z)) (\<lambda>x. f (t1,t2))) |
|
12369 \<le> e * content (cbox (u,w) (v,z)) / content ?CBOX / 2" |
|
12370 apply (simp only: integral_diff [symmetric] f_int_uwvz integrable_const) |
|
12371 apply (rule order_trans [OF integrable_bound [of "e / content ?CBOX / 2"]]) |
|
12372 using cbp e' nf' |
|
12373 apply (auto simp: integrable_diff f_int_uwvz integrable_const) |
|
12374 done |
|
12375 have int_integrable: "(\<lambda>x. integral (cbox w z) (\<lambda>y. f (x, y))) integrable_on cbox u v" |
|
12376 using assms integral_integrable_2dim continuous_on_subset uwvz_sub(2) by blast |
|
12377 have normint_wz: |
|
12378 "\<And>x. x \<in> cbox u v \<Longrightarrow> |
|
12379 norm (integral (cbox w z) (\<lambda>y. f (x, y)) - integral (cbox w z) (\<lambda>y. f (t1, t2))) |
|
12380 \<le> e * content (cbox w z) / content (cbox (a, c) (b, d)) / 2" |
|
12381 apply (simp only: integral_diff [symmetric] f_int_uv integrable_const) |
|
12382 apply (rule order_trans [OF integrable_bound [of "e / content ?CBOX / 2"]]) |
|
12383 using cbp e' nf' |
|
12384 apply (auto simp: integrable_diff f_int_uv integrable_const) |
|
12385 done |
|
12386 have "norm (integral (cbox u v) |
|
12387 (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x,y)) - integral (cbox w z) (\<lambda>y. f (t1,t2)))) |
|
12388 \<le> e * content (cbox w z) / content ?CBOX / 2 * content (cbox u v)" |
|
12389 apply (rule integrable_bound [OF _ _ normint_wz]) |
|
12390 using cbp e' |
|
12391 apply (auto simp: divide_simps content_pos_le integrable_diff int_integrable integrable_const) |
|
12392 done |
|
12393 also have "... \<le> e * content (cbox (u,w) (v,z)) / content ?CBOX / 2" |
|
12394 by (simp add: content_Pair divide_simps) |
|
12395 finally have 2: "norm (integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x,y))) - |
|
12396 integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (t1,t2)))) |
|
12397 \<le> e * content (cbox (u,w) (v,z)) / content ?CBOX / 2" |
|
12398 by (simp only: integral_diff [symmetric] int_integrable integrable_const) |
|
12399 have norm_xx: "\<lbrakk>x' = y'; norm(x - x') \<le> e/2; norm(y - y') \<le> e/2\<rbrakk> \<Longrightarrow> norm(x - y) \<le> e" for x::'c and y x' y' e |
|
12400 using norm_triangle_mono [of "x-y'" "e/2" "y'-y" "e/2"] real_sum_of_halves |
|
12401 by (simp add: norm_minus_commute) |
|
12402 have "norm (integral (cbox (u,w) (v,z)) f - integral (cbox u v) (\<lambda>x. integral (cbox w z) (\<lambda>y. f (x,y)))) |
|
12403 \<le> e * content (cbox (u,w) (v,z)) / content ?CBOX" |
|
12404 by (rule norm_xx [OF integral_Pair_const 1 2]) |
|
12405 } note * = this |
|
12406 show "norm (integral ?CBOX f - integral (cbox a b) (\<lambda>x. integral (cbox c d) (\<lambda>y. f (x,y)))) \<le> e" |
|
12407 using compact_uniformly_continuous [OF assms compact_cbox] |
|
12408 apply (simp add: uniformly_continuous_on_def dist_norm) |
|
12409 apply (drule_tac x="e / 2 / content?CBOX" in spec) |
|
12410 using cbp \<open>0 < e\<close> |
|
12411 apply (auto simp: zero_less_mult_iff) |
|
12412 apply (rename_tac k) |
|
12413 apply (rule_tac e1=k in fine_division_exists [OF gauge_ball, where a = "(a,c)" and b = "(b,d)"]) |
|
12414 apply assumption |
|
12415 apply (rule op_acbd) |
|
12416 apply (erule division_of_tagged_division) |
|
12417 using * |
|
12418 apply auto |
|
12419 done |
|
12420 qed |
|
12421 then show ?thesis |
|
12422 by simp |
|
12423 qed |
|
12424 |
|
12425 lemma swap_continuous: |
|
12426 assumes "continuous_on (cbox (a,c) (b,d)) (\<lambda>(x,y). f x y)" |
|
12427 shows "continuous_on (cbox (c,a) (d,b)) (\<lambda>(x, y). f y x)" |
|
12428 proof - |
|
12429 have "(\<lambda>(x, y). f y x) = (\<lambda>(x, y). f x y) \<circ> prod.swap" |
|
12430 by auto |
|
12431 then show ?thesis |
|
12432 apply (rule ssubst) |
|
12433 apply (rule continuous_on_compose) |
|
12434 apply (simp add: split_def) |
|
12435 apply (rule continuous_intros | simp add: assms)+ |
|
12436 done |
|
12437 qed |
|
12438 |
|
12439 lemma integral_swap_2dim: |
|
12440 fixes f :: "['a::euclidean_space, 'b::euclidean_space] \<Rightarrow> 'c::banach" |
|
12441 assumes "continuous_on (cbox (a,c) (b,d)) (\<lambda>(x,y). f x y)" |
|
12442 shows "integral (cbox (a, c) (b, d)) (\<lambda>(x, y). f x y) = integral (cbox (c, a) (d, b)) (\<lambda>(x, y). f y x)" |
|
12443 proof - |
|
12444 have "((\<lambda>(x, y). f x y) has_integral integral (cbox (c, a) (d, b)) (\<lambda>(x, y). f y x)) (prod.swap ` (cbox (c, a) (d, b)))" |
|
12445 apply (rule has_integral_twiddle [of 1 prod.swap prod.swap "\<lambda>(x,y). f y x" "integral (cbox (c, a) (d, b)) (\<lambda>(x, y). f y x)", simplified]) |
|
12446 apply (auto simp: isCont_swap content_Pair has_integral_integral [symmetric] integrable_continuous swap_continuous assms) |
|
12447 done |
|
12448 then show ?thesis |
|
12449 by force |
|
12450 qed |
|
12451 |
|
12452 theorem integral_swap_continuous: |
|
12453 fixes f :: "['a::euclidean_space, 'b::euclidean_space] \<Rightarrow> 'c::banach" |
|
12454 assumes "continuous_on (cbox (a,c) (b,d)) (\<lambda>(x,y). f x y)" |
|
12455 shows "integral (cbox a b) (\<lambda>x. integral (cbox c d) (f x)) = |
|
12456 integral (cbox c d) (\<lambda>y. integral (cbox a b) (\<lambda>x. f x y))" |
|
12457 proof - |
|
12458 have "integral (cbox a b) (\<lambda>x. integral (cbox c d) (f x)) = integral (cbox (a, c) (b, d)) (\<lambda>(x, y). f x y)" |
|
12459 using integral_prod_continuous [OF assms] by auto |
|
12460 also have "... = integral (cbox (c, a) (d, b)) (\<lambda>(x, y). f y x)" |
|
12461 by (rule integral_swap_2dim [OF assms]) |
|
12462 also have "... = integral (cbox c d) (\<lambda>y. integral (cbox a b) (\<lambda>x. f x y))" |
|
12463 using integral_prod_continuous [OF swap_continuous] assms |
|
12464 by auto |
|
12465 finally show ?thesis . |
|
12466 qed |
|
12467 |
|
12468 |
|
12469 subsection \<open>Definite integrals for exponential and power function\<close> |
|
12470 |
|
12471 lemma has_integral_exp_minus_to_infinity: |
|
12472 assumes a: "a > 0" |
|
12473 shows "((\<lambda>x::real. exp (-a*x)) has_integral exp (-a*c)/a) {c..}" |
|
12474 proof - |
|
12475 define f where "f = (\<lambda>k x. if x \<in> {c..real k} then exp (-a*x) else 0)" |
|
12476 |
|
12477 { |
|
12478 fix k :: nat assume k: "of_nat k \<ge> c" |
|
12479 from k a |
|
12480 have "((\<lambda>x. exp (-a*x)) has_integral (-exp (-a*real k)/a - (-exp (-a*c)/a))) {c..real k}" |
|
12481 by (intro fundamental_theorem_of_calculus) |
|
12482 (auto intro!: derivative_eq_intros |
|
12483 simp: has_field_derivative_iff_has_vector_derivative [symmetric]) |
|
12484 hence "(f k has_integral (exp (-a*c)/a - exp (-a*real k)/a)) {c..}" unfolding f_def |
|
12485 by (subst has_integral_restrict) simp_all |
|
12486 } note has_integral_f = this |
|
12487 |
|
12488 have [simp]: "f k = (\<lambda>_. 0)" if "of_nat k < c" for k using that by (auto simp: fun_eq_iff f_def) |
|
12489 have integral_f: "integral {c..} (f k) = |
|
12490 (if real k \<ge> c then exp (-a*c)/a - exp (-a*real k)/a else 0)" |
|
12491 for k using integral_unique[OF has_integral_f[of k]] by simp |
|
12492 |
|
12493 have A: "(\<lambda>x. exp (-a*x)) integrable_on {c..} \<and> |
|
12494 (\<lambda>k. integral {c..} (f k)) \<longlonglongrightarrow> integral {c..} (\<lambda>x. exp (-a*x))" |
|
12495 proof (intro monotone_convergence_increasing allI ballI) |
|
12496 fix k ::nat |
|
12497 have "(\<lambda>x. exp (-a*x)) integrable_on {c..of_real k}" (is ?P) |
|
12498 unfolding f_def by (auto intro!: continuous_intros integrable_continuous_real) |
|
12499 hence int: "(f k) integrable_on {c..of_real k}" |
|
12500 by (rule integrable_eq[rotated]) (simp add: f_def) |
|
12501 show "f k integrable_on {c..}" |
|
12502 by (rule integrable_on_superset[OF _ _ int]) (auto simp: f_def) |
|
12503 next |
|
12504 fix x assume x: "x \<in> {c..}" |
|
12505 have "sequentially \<le> principal {nat \<lceil>x\<rceil>..}" unfolding at_top_def by (simp add: Inf_lower) |
|
12506 also have "{nat \<lceil>x\<rceil>..} \<subseteq> {k. x \<le> real k}" by auto |
|
12507 also have "inf (principal \<dots>) (principal {k. \<not>x \<le> real k}) = |
|
12508 principal ({k. x \<le> real k} \<inter> {k. \<not>x \<le> real k})" by simp |
|
12509 also have "{k. x \<le> real k} \<inter> {k. \<not>x \<le> real k} = {}" by blast |
|
12510 finally have "inf sequentially (principal {k. \<not>x \<le> real k}) = bot" |
|
12511 by (simp add: inf.coboundedI1 bot_unique) |
|
12512 with x show "(\<lambda>k. f k x) \<longlonglongrightarrow> exp (-a*x)" unfolding f_def |
|
12513 by (intro filterlim_If) auto |
|
12514 next |
|
12515 have "\<bar>integral {c..} (f k)\<bar> \<le> exp (-a*c)/a" for k |
|
12516 proof (cases "c > of_nat k") |
|
12517 case False |
|
12518 hence "abs (integral {c..} (f k)) = abs (exp (- (a * c)) / a - exp (- (a * real k)) / a)" |
|
12519 by (simp add: integral_f) |
|
12520 also have "abs (exp (- (a * c)) / a - exp (- (a * real k)) / a) = |
|
12521 exp (- (a * c)) / a - exp (- (a * real k)) / a" |
|
12522 using False a by (intro abs_of_nonneg) (simp_all add: field_simps) |
|
12523 also have "\<dots> \<le> exp (- a * c) / a" using a by simp |
|
12524 finally show ?thesis . |
|
12525 qed (insert a, simp_all add: integral_f) |
|
12526 thus "bounded {integral {c..} (f k) |k. True}" |
|
12527 by (intro bounded_realI[of _ "exp (-a*c)/a"]) auto |
|
12528 qed (auto simp: f_def) |
|
12529 |
|
12530 from eventually_gt_at_top[of "nat \<lceil>c\<rceil>"] have "eventually (\<lambda>k. of_nat k > c) sequentially" |
|
12531 by eventually_elim linarith |
|
12532 hence "eventually (\<lambda>k. exp (-a*c)/a - exp (-a * of_nat k)/a = integral {c..} (f k)) sequentially" |
|
12533 by eventually_elim (simp add: integral_f) |
|
12534 moreover have "(\<lambda>k. exp (-a*c)/a - exp (-a * of_nat k)/a) \<longlonglongrightarrow> exp (-a*c)/a - 0/a" |
|
12535 by (intro tendsto_intros filterlim_compose[OF exp_at_bot] |
|
12536 filterlim_tendsto_neg_mult_at_bot[OF tendsto_const] filterlim_real_sequentially)+ |
|
12537 (insert a, simp_all) |
|
12538 ultimately have "(\<lambda>k. integral {c..} (f k)) \<longlonglongrightarrow> exp (-a*c)/a - 0/a" |
|
12539 by (rule Lim_transform_eventually) |
|
12540 from LIMSEQ_unique[OF conjunct2[OF A] this] |
|
12541 have "integral {c..} (\<lambda>x. exp (-a*x)) = exp (-a*c)/a" by simp |
|
12542 with conjunct1[OF A] show ?thesis |
|
12543 by (simp add: has_integral_integral) |
|
12544 qed |
|
12545 |
|
12546 lemma integrable_on_exp_minus_to_infinity: "a > 0 \<Longrightarrow> (\<lambda>x. exp (-a*x) :: real) integrable_on {c..}" |
|
12547 using has_integral_exp_minus_to_infinity[of a c] unfolding integrable_on_def by blast |
|
12548 |
|
12549 lemma has_integral_powr_from_0: |
|
12550 assumes a: "a > (-1::real)" and c: "c \<ge> 0" |
|
12551 shows "((\<lambda>x. x powr a) has_integral (c powr (a+1) / (a+1))) {0..c}" |
|
12552 proof (cases "c = 0") |
|
12553 case False |
|
12554 define f where "f = (\<lambda>k x. if x \<in> {inverse (of_nat (Suc k))..c} then x powr a else 0)" |
|
12555 define F where "F = (\<lambda>k. if inverse (of_nat (Suc k)) \<le> c then |
|
12556 c powr (a+1)/(a+1) - inverse (real (Suc k)) powr (a+1)/(a+1) else 0)" |
|
12557 |
|
12558 { |
|
12559 fix k :: nat |
|
12560 have "(f k has_integral F k) {0..c}" |
|
12561 proof (cases "inverse (of_nat (Suc k)) \<le> c") |
|
12562 case True |
|
12563 { |
|
12564 fix x assume x: "x \<ge> inverse (1 + real k)" |
|
12565 have "0 < inverse (1 + real k)" by simp |
|
12566 also note x |
|
12567 finally have "x > 0" . |
|
12568 } note x = this |
|
12569 hence "((\<lambda>x. x powr a) has_integral c powr (a + 1) / (a + 1) - |
|
12570 inverse (real (Suc k)) powr (a + 1) / (a + 1)) {inverse (real (Suc k))..c}" |
|
12571 using True a by (intro fundamental_theorem_of_calculus) |
|
12572 (auto intro!: derivative_eq_intros continuous_on_powr' continuous_on_const |
|
12573 continuous_on_id simp: has_field_derivative_iff_has_vector_derivative [symmetric]) |
|
12574 with True show ?thesis unfolding f_def F_def by (subst has_integral_restrict) simp_all |
|
12575 next |
|
12576 case False |
|
12577 thus ?thesis unfolding f_def F_def by (subst has_integral_restrict) auto |
|
12578 qed |
|
12579 } note has_integral_f = this |
|
12580 have integral_f: "integral {0..c} (f k) = F k" for k |
|
12581 using has_integral_f[of k] by (rule integral_unique) |
|
12582 |
|
12583 have A: "(\<lambda>x. x powr a) integrable_on {0..c} \<and> |
|
12584 (\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> integral {0..c} (\<lambda>x. x powr a)" |
|
12585 proof (intro monotone_convergence_increasing ballI allI) |
|
12586 fix k from has_integral_f[of k] show "f k integrable_on {0..c}" |
|
12587 by (auto simp: integrable_on_def) |
|
12588 next |
|
12589 fix k :: nat and x :: real |
|
12590 { |
|
12591 assume x: "inverse (real (Suc k)) \<le> x" |
|
12592 have "inverse (real (Suc (Suc k))) \<le> inverse (real (Suc k))" by (simp add: field_simps) |
|
12593 also note x |
|
12594 finally have "inverse (real (Suc (Suc k))) \<le> x" . |
|
12595 } |
|
12596 thus "f k x \<le> f (Suc k) x" by (auto simp: f_def simp del: of_nat_Suc) |
|
12597 next |
|
12598 fix x assume x: "x \<in> {0..c}" |
|
12599 show "(\<lambda>k. f k x) \<longlonglongrightarrow> x powr a" |
|
12600 proof (cases "x = 0") |
|
12601 case False |
|
12602 with x have "x > 0" by simp |
|
12603 from order_tendstoD(2)[OF LIMSEQ_inverse_real_of_nat this] |
|
12604 have "eventually (\<lambda>k. x powr a = f k x) sequentially" |
|
12605 by eventually_elim (insert x, simp add: f_def) |
|
12606 moreover have "(\<lambda>_. x powr a) \<longlonglongrightarrow> x powr a" by simp |
|
12607 ultimately show ?thesis by (rule Lim_transform_eventually) |
|
12608 qed (simp_all add: f_def) |
|
12609 next |
|
12610 { |
|
12611 fix k |
|
12612 from a have "F k \<le> c powr (a + 1) / (a + 1)" |
|
12613 by (auto simp add: F_def divide_simps) |
|
12614 also from a have "F k \<ge> 0" |
|
12615 by (auto simp: F_def divide_simps simp del: of_nat_Suc intro!: powr_mono2) |
|
12616 hence "F k = abs (F k)" by simp |
|
12617 finally have "abs (F k) \<le> c powr (a + 1) / (a + 1)" . |
|
12618 } |
|
12619 thus "bounded {integral {0..c} (f k) |k. True}" |
|
12620 by (intro bounded_realI[of _ "c powr (a+1) / (a+1)"]) (auto simp: integral_f) |
|
12621 qed |
|
12622 |
|
12623 from False c have "c > 0" by simp |
|
12624 from order_tendstoD(2)[OF LIMSEQ_inverse_real_of_nat this] |
|
12625 have "eventually (\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a+1) / (a+1) = |
|
12626 integral {0..c} (f k)) sequentially" |
|
12627 by eventually_elim (simp add: integral_f F_def) |
|
12628 moreover have "(\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) |
|
12629 \<longlonglongrightarrow> c powr (a + 1) / (a + 1) - 0 powr (a + 1) / (a + 1)" |
|
12630 using a by (intro tendsto_intros LIMSEQ_inverse_real_of_nat) auto |
|
12631 hence "(\<lambda>k. c powr (a + 1) / (a + 1) - inverse (real (Suc k)) powr (a + 1) / (a + 1)) |
|
12632 \<longlonglongrightarrow> c powr (a + 1) / (a + 1)" by simp |
|
12633 ultimately have "(\<lambda>k. integral {0..c} (f k)) \<longlonglongrightarrow> c powr (a+1) / (a+1)" |
|
12634 by (rule Lim_transform_eventually) |
|
12635 with A have "integral {0..c} (\<lambda>x. x powr a) = c powr (a+1) / (a+1)" |
|
12636 by (blast intro: LIMSEQ_unique) |
|
12637 with A show ?thesis by (simp add: has_integral_integral) |
|
12638 qed (simp_all add: has_integral_refl) |
|
12639 |
|
12640 lemma integrable_on_powr_from_0: |
|
12641 assumes a: "a > (-1::real)" and c: "c \<ge> 0" |
|
12642 shows "(\<lambda>x. x powr a) integrable_on {0..c}" |
|
12643 using has_integral_powr_from_0[OF assms] unfolding integrable_on_def by blast |
|
12644 |
|
12645 end |