# HG changeset patch # User hoelzl # Date 1475072151 -7200 # Node ID b235e845c8e8de31d9bd93544f9f7d9fbaf6f8a3 # Parent 51a3d38d2281af1d54adcc0eabeebeac2eb208f3 HOL-Analysis: add cover lemma ported by L. C. Paulson diff -r 51a3d38d2281 -r b235e845c8e8 src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Thu Sep 29 12:58:55 2016 +0100 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Wed Sep 28 16:15:51 2016 +0200 @@ -16,6 +16,28 @@ subsection \Sundries\ + +text\A transitive relation is well-founded if all initial segments are finite.\ +lemma wf_finite_segments: + assumes "irrefl r" and "trans r" and "\x. finite {y. (y, x) \ r}" + shows "wf (r)" + apply (simp add: trans_wf_iff wf_iff_acyclic_if_finite converse_def assms) + using acyclic_def assms irrefl_def trans_Restr by fastforce + +text\For creating values between @{term u} and @{term v}.\ +lemma scaling_mono: + fixes u::"'a::linordered_field" + assumes "u \ v" "0 \ r" "r \ s" + shows "u + r * (v - u) / s \ v" +proof - + have "r/s \ 1" using assms + using divide_le_eq_1 by fastforce + then have "(r/s) * (v - u) \ 1 * (v - u)" + by (meson diff_ge_0_iff_ge mult_right_mono \u \ v\) + then show ?thesis + by (simp add: field_simps) +qed + lemma conjunctD2: assumes "a \ b" shows a b using assms by auto lemma conjunctD3: assumes "a \ b \ c" shows a b c using assms by auto lemma conjunctD4: assumes "a \ b \ c \ d" shows a b c d using assms by auto @@ -4767,7 +4789,7 @@ qed lemma negligible_Un_eq[simp]: "negligible (s \ t) \ negligible s \ negligible t" - using negligible_Un negligible_subset by blast + using negligible_Un negligible_subset by blast lemma negligible_sing[intro]: "negligible {a::'a::euclidean_space}" using negligible_standard_hyperplane[OF SOME_Basis, of "a \ (SOME i. i \ Basis)"] negligible_subset by blast @@ -10709,6 +10731,277 @@ (insert assms, simp_all add: powr_minus powr_realpow divide_simps) qed +subsubsection \Covering lemma\ + + +text\ Some technical lemmas used in the approximation results that follow. Proof of the covering + lemma is an obvious multidimensional generalization of Lemma 3, p65 of Swartz's + "Introduction to Gauge Integrals". \ + +proposition covering_lemma: + assumes "S \ cbox a b" "box a b \ {}" "gauge g" + obtains \ where + "countable \" "\\ \ cbox a b" + "\K. K \ \ \ interior K \ {} \ (\c d. K = cbox c d)" + "pairwise (\A B. interior A \ interior B = {}) \" + "\K. K \ \ \ \x \ S \ K. K \ g x" + "\u v. cbox u v \ \ \ \n. \i \ Basis. v \ i - u \ i = (b \ i - a \ i) / 2^n" + "S \ \\" +proof - + have aibi: "\i. i \ Basis \ a \ i \ b \ i" and normab: "0 < norm(b - a)" + using \box a b \ {}\ box_eq_empty box_sing by fastforce+ + let ?K0 = "\(n, f::'a\nat). + cbox (\i \ Basis. (a \ i + (f i / 2^n) * (b \ i - a \ i)) *\<^sub>R i) + (\i \ Basis. (a \ i + ((f i + 1) / 2^n) * (b \ i - a \ i)) *\<^sub>R i)" + let ?D0 = "?K0 ` (SIGMA n:UNIV. PiE Basis (\i::'a. lessThan (2^n)))" + obtain \0 where count: "countable \0" + and sub: "\\0 \ cbox a b" + and int: "\K. K \ \0 \ (interior K \ {}) \ (\c d. K = cbox c d)" + and intdj: "\A B. \A \ \0; B \ \0\ \ A \ B \ B \ A \ interior A \ interior B = {}" + and SK: "\x. x \ S \ \K \ \0. x \ K \ K \ g x" + and cbox: "\u v. cbox u v \ \0 \ \n. \i \ Basis. v \ i - u \ i = (b \ i - a \ i) / 2^n" + and fin: "\K. K \ \0 \ finite {L \ \0. K \ L}" + proof + show "countable ?D0" + by (simp add: countable_PiE) + next + show "\?D0 \ cbox a b" + apply (simp add: UN_subset_iff) + apply (intro conjI allI ballI subset_box_imp) + apply (simp add: divide_simps zero_le_mult_iff aibi) + apply (force simp: aibi scaling_mono nat_less_real_le dest: PiE_mem) + done + next + show "\K. K \ ?D0 \ interior K \ {} \ (\c d. K = cbox c d)" + using \box a b \ {}\ + by (clarsimp simp: box_eq_empty) (fastforce simp add: divide_simps dest: PiE_mem) + next + have realff: "(real w) * 2^m < (real v) * 2^n \ w * 2^m < v * 2^n" for m n v w + using of_nat_less_iff less_imp_of_nat_less by fastforce + have *: "\v w. ?K0(m,v) \ ?K0(n,w) \ ?K0(n,w) \ ?K0(m,v) \ interior(?K0(m,v)) \ interior(?K0(n,w)) = {}" + for m n --\The symmetry argument requires a single HOL formula\ + proof (rule linorder_wlog [where a=m and b=n], intro allI impI) + fix v w m and n::nat + assume "m \ n" --\WLOG we can assume @{term"m \ n"}, when the first disjunct becomes impossible\ + have "?K0(n,w) \ ?K0(m,v) \ interior(?K0(m,v)) \ interior(?K0(n,w)) = {}" + apply (simp add: subset_box disjoint_interval) + apply (rule ccontr) + apply (clarsimp simp add: aibi mult_le_cancel_right divide_le_cancel not_less not_le) + apply (drule_tac x=i in bspec, assumption) + using \m\n\ realff [of _ _ "1+_"] realff [of "1+_"_ "1+_"] + apply (auto simp: divide_simps add.commute not_le nat_le_iff_add realff) + apply (simp add: power_add, metis (no_types, hide_lams) mult_Suc mult_less_cancel2 not_less_eq mult.assoc)+ + done + then show "?K0(m,v) \ ?K0(n,w) \ ?K0(n,w) \ ?K0(m,v) \ interior(?K0(m,v)) \ interior(?K0(n,w)) = {}" + by meson + qed auto + show "\A B. \A \ ?D0; B \ ?D0\ \ A \ B \ B \ A \ interior A \ interior B = {}" + apply (erule imageE SigmaE)+ + using * by simp + next + show "\K \ ?D0. x \ K \ K \ g x" if "x \ S" for x + proof (simp only: bex_simps split_paired_Bex_Sigma) + show "\n. \f \ Basis \\<^sub>E {..<2 ^ n}. x \ ?K0(n,f) \ ?K0(n,f) \ g x" + proof - + obtain e where "0 < e" + and e: "\y. (\i. i \ Basis \ \x \ i - y \ i\ \ e) \ y \ g x" + proof - + have "x \ g x" "open (g x)" + using \gauge g\ by (auto simp: gauge_def) + then obtain \ where "0 < \" and \: "ball x \ \ g x" + using openE by blast + have "norm (x - y) < \" + if "(\i. i \ Basis \ \x \ i - y \ i\ \ \ / (2 * real DIM('a)))" for y + proof - + have "norm (x - y) \ (\i\Basis. \x \ i - y \ i\)" + by (metis (no_types, lifting) inner_diff_left norm_le_l1 setsum.cong) + also have "... \ DIM('a) * (\ / (2 * real DIM('a)))" + by (meson setsum_bounded_above that) + also have "... = \ / 2" + by (simp add: divide_simps) + also have "... < \" + by (simp add: \0 < \\) + finally show ?thesis . + qed + then show ?thesis + by (rule_tac e = "\ / 2 / DIM('a)" in that) (simp_all add: \0 < \\ dist_norm subsetD [OF \]) + qed + have xab: "x \ cbox a b" + using \x \ S\ \S \ cbox a b\ by blast + obtain n where n: "norm (b - a) / 2^n < e" + using real_arch_pow_inv [of "e / norm(b - a)" "1/2"] normab \0 < e\ + by (auto simp: divide_simps) + then have "norm (b - a) < e * 2^n" + by (auto simp: divide_simps) + then have bai: "b \ i - a \ i < e * 2 ^ n" if "i \ Basis" for i + proof - + have "b \ i - a \ i \ norm (b - a)" + by (metis abs_of_nonneg dual_order.trans inner_diff_left linear norm_ge_zero Basis_le_norm that) + also have "... < e * 2 ^ n" + using \norm (b - a) < e * 2 ^ n\ by blast + finally show ?thesis . + qed + have D: "(a + n \ x \ x \ a + m) \ (a + n \ y \ y \ a + m) \ abs(x - y) \ m - n" + for a m n x and y::real + by auto + have "\i\Basis. \k<2 ^ n. (a \ i + real k * (b \ i - a \ i) / 2 ^ n \ x \ i \ + x \ i \ a \ i + (real k + 1) * (b \ i - a \ i) / 2 ^ n)" + proof + fix i::'a assume "i \ Basis" + consider "x \ i = b \ i" | "x \ i < b \ i" + using \i \ Basis\ mem_box(2) xab by force + then show "\k<2 ^ n. (a \ i + real k * (b \ i - a \ i) / 2 ^ n \ x \ i \ + x \ i \ a \ i + (real k + 1) * (b \ i - a \ i) / 2 ^ n)" + proof cases + case 1 then show ?thesis + by (rule_tac x = "2^n - 1" in exI) (auto simp: algebra_simps divide_simps of_nat_diff \i \ Basis\ aibi) + next + case 2 + then have abi_less: "a \ i < b \ i" + using \i \ Basis\ xab by (auto simp: mem_box) + let ?k = "nat \2 ^ n * (x \ i - a \ i) / (b \ i - a \ i)\" + show ?thesis + proof (intro exI conjI) + show "?k < 2 ^ n" + using aibi xab \i \ Basis\ + by (force simp: nat_less_iff floor_less_iff divide_simps 2 mem_box) + next + have "a \ i + real ?k * (b \ i - a \ i) / 2 ^ n \ + a \ i + (2 ^ n * (x \ i - a \ i) / (b \ i - a \ i)) * (b \ i - a \ i) / 2 ^ n" + apply (intro add_left_mono mult_right_mono divide_right_mono of_nat_floor) + using aibi [OF \i \ Basis\] xab 2 + apply (simp_all add: \i \ Basis\ mem_box divide_simps) + done + also have "... = x \ i" + using abi_less by (simp add: divide_simps) + finally show "a \ i + real ?k * (b \ i - a \ i) / 2 ^ n \ x \ i" . + next + have "x \ i \ a \ i + (2 ^ n * (x \ i - a \ i) / (b \ i - a \ i)) * (b \ i - a \ i) / 2 ^ n" + using abi_less by (simp add: divide_simps algebra_simps) + also have "... \ a \ i + (real ?k + 1) * (b \ i - a \ i) / 2 ^ n" + apply (intro add_left_mono mult_right_mono divide_right_mono of_nat_floor) + using aibi [OF \i \ Basis\] xab + apply (auto simp: \i \ Basis\ mem_box divide_simps) + done + finally show "x \ i \ a \ i + (real ?k + 1) * (b \ i - a \ i) / 2 ^ n" . + qed + qed + qed + then have "\f\Basis \\<^sub>E {..<2 ^ n}. x \ ?K0(n,f)" + apply (simp add: mem_box Bex_def) + apply (clarify dest!: bchoice) + apply (rule_tac x="restrict f Basis" in exI, simp) + done + moreover have "\f. x \ ?K0(n,f) \ ?K0(n,f) \ g x" + apply (clarsimp simp add: mem_box) + apply (rule e) + apply (drule bspec D, assumption)+ + apply (erule order_trans) + apply (simp add: divide_simps) + using bai by (force simp: algebra_simps) + ultimately show ?thesis by auto + qed + qed + next + show "\u v. cbox u v \ ?D0 \ \n. \i \ Basis. v \ i - u \ i = (b \ i - a \ i) / 2^n" + by (force simp: eq_cbox box_eq_empty field_simps dest!: aibi) + next + obtain j::'a where "j \ Basis" + using nonempty_Basis by blast + have "finite {L \ ?D0. ?K0(n,f) \ L}" if "f \ Basis \\<^sub>E {..<2 ^ n}" for n f + proof (rule finite_subset) + let ?B = "(\(n, f::'a\nat). cbox (\i\Basis. (a \ i + (f i) / 2^n * (b \ i - a \ i)) *\<^sub>R i) + (\i\Basis. (a \ i + ((f i) + 1) / 2^n * (b \ i - a \ i)) *\<^sub>R i)) + ` (SIGMA m:atMost n. PiE Basis (\i::'a. lessThan (2^m)))" + have "?K0(m,g) \ ?B" if "g \ Basis \\<^sub>E {..<2 ^ m}" "?K0(n,f) \ ?K0(m,g)" for m g + proof - + have dd: "w / m \ v / n \ (v+1) / n \ (w+1) / m + \ inverse n \ inverse m" for w m v n::real + by (auto simp: divide_simps algebra_simps) + have bjaj: "b \ j - a \ j > 0" + using \j \ Basis\ \box a b \ {}\ box_eq_empty(1) by fastforce + have "((g j) / 2 ^ m) * (b \ j - a \ j) \ ((f j) / 2 ^ n) * (b \ j - a \ j) \ + (((f j) + 1) / 2 ^ n) * (b \ j - a \ j) \ (((g j) + 1) / 2 ^ m) * (b \ j - a \ j)" + using that \j \ Basis\ by (simp add: subset_box algebra_simps divide_simps aibi) + then have "((g j) / 2 ^ m) \ ((f j) / 2 ^ n) \ + ((real(f j) + 1) / 2 ^ n) \ ((real(g j) + 1) / 2 ^ m)" + by (metis bjaj mult.commute of_nat_1 of_nat_add real_mult_le_cancel_iff2) + then have "inverse (2^n) \ (inverse (2^m) :: real)" + by (rule dd) + then have "m \ n" + by auto + show ?thesis + by (rule imageI) (simp add: \m \ n\ that) + qed + then show "{L \ ?D0. ?K0(n,f) \ L} \ ?B" + by auto + show "finite ?B" + by (intro finite_imageI finite_SigmaI finite_atMost finite_lessThan finite_PiE finite_Basis) + qed + then show "finite {L \ ?D0. K \ L}" if "K \ ?D0" for K + using that by auto + qed + let ?D1 = "{K \ \0. \x \ S \ K. K \ g x}" + obtain \ where count: "countable \" + and sub: "\\ \ cbox a b" "S \ \\" + and int: "\K. K \ \ \ (interior K \ {}) \ (\c d. K = cbox c d)" + and intdj: "\A B. \A \ \; B \ \\ \ A \ B \ B \ A \ interior A \ interior B = {}" + and SK: "\K. K \ \ \ \x. x \ S \ K \ K \ g x" + and cbox: "\u v. cbox u v \ \ \ \n. \i \ Basis. v \ i - u \ i = (b \ i - a \ i) / 2^n" + and fin: "\K. K \ \ \ finite {L. L \ \ \ K \ L}" + proof + show "countable ?D1" using count countable_subset + by (simp add: count countable_subset) + show "\?D1 \ cbox a b" + using sub by blast + show "S \ \?D1" + using SK by (force simp:) + show "\K. K \ ?D1 \ (interior K \ {}) \ (\c d. K = cbox c d)" + using int by blast + show "\A B. \A \ ?D1; B \ ?D1\ \ A \ B \ B \ A \ interior A \ interior B = {}" + using intdj by blast + show "\K. K \ ?D1 \ \x. x \ S \ K \ K \ g x" + by auto + show "\u v. cbox u v \ ?D1 \ \n. \i \ Basis. v \ i - u \ i = (b \ i - a \ i) / 2^n" + using cbox by blast + show "\K. K \ ?D1 \ finite {L. L \ ?D1 \ K \ L}" + using fin by simp (metis (mono_tags, lifting) Collect_mono rev_finite_subset) + qed + let ?\ = "{K \ \. \K'. K' \ \ \ K \ K' \ ~(K \ K')}" + show ?thesis + proof (rule that) + show "countable ?\" + by (blast intro: countable_subset [OF _ count]) + show "\?\ \ cbox a b" + using sub by blast + show "S \ \?\" + proof clarsimp + fix x + assume "x \ S" + then obtain X where "x \ X" "X \ \" using \S \ \\\ by blast + let ?R = "{(K,L). K \ \ \ L \ \ \ L \ K}" + have irrR: "irrefl ?R" by (force simp: irrefl_def) + have traR: "trans ?R" by (force simp: trans_def) + have finR: "\x. finite {y. (y, x) \ ?R}" + by simp (metis (mono_tags, lifting) fin \X \ \\ finite_subset mem_Collect_eq psubset_imp_subset subsetI) + have "{X \ \. x \ X} \ {}" + using \X \ \\ \x \ X\ by blast + then obtain Y where "Y \ {X \ \. x \ X}" "\Y'. (Y', Y) \ ?R \ Y' \ {X \ \. x \ X}" + by (rule wfE_min' [OF wf_finite_segments [OF irrR traR finR]]) blast + then show "\Y. Y \ \ \ (\K'. K' \ \ \ Y \ K' \ \ Y \ K') \ x \ Y" + by blast + qed + show "\K. K \ ?\ \ interior K \ {} \ (\c d. K = cbox c d)" + by (blast intro: dest: int) + show "pairwise (\A B. interior A \ interior B = {}) ?\" + using intdj by (simp add: pairwise_def) metis + show "\K. K \ ?\ \ \x \ S \ K. K \ g x" + using SK by force + show "\u v. cbox u v \ ?\ \ \n. \i\Basis. v \ i - u \ i = (b \ i - a \ i) / 2^n" + using cbox by force + qed +qed + subsubsection \Adaption to ordered Euclidean spaces and the Cartesian Euclidean space\ lemma integral_component_eq_cart[simp]: