# HG changeset patch # User paulson # Date 1498061635 -3600 # Node ID bc5e6461f759f622cd29b7c3882de2d96604a214 # Parent 236339f97a88f1d59c1c9baf0a8a2339c7576ca7 Tidying up integration theory and some new theorems diff -r 236339f97a88 -r bc5e6461f759 src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy --- a/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Wed Jun 21 15:04:26 2017 +0200 +++ b/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Wed Jun 21 17:13:55 2017 +0100 @@ -122,7 +122,7 @@ by (auto intro: less_le_trans) define d' where "d' x = d x \ ball x (1 / (3 * Suc m))" for x have "gauge d'" - unfolding d'_def by (intro gauge_inter \gauge d\ gauge_ball) auto + unfolding d'_def by (intro gauge_Int \gauge d\ gauge_ball) auto then obtain p where p: "p tagged_division_of cbox x y" "d' fine p" by (rule fine_division_exists) then have "d fine p" @@ -2184,7 +2184,7 @@ (\(x, k)\p. norm (content k *\<^sub>R f x - integral k f)) < e / 2" . obtain p where p: "p tagged_division_of (cbox a b)" "d1 fine p" "d2 fine p" - by (rule fine_division_exists [OF gauge_inter [OF d1(1) d2(1)], of a b]) + by (rule fine_division_exists [OF gauge_Int [OF d1(1) d2(1)], of a b]) (auto simp add: fine_inter) have *: "\sf sf' si di. sf' = sf \ si \ ?S \ \sf - si\ < e / 2 \ \sf' - di\ < e / 2 \ di < ?S + e" diff -r 236339f97a88 -r bc5e6461f759 src/HOL/Analysis/Euclidean_Space.thy --- a/src/HOL/Analysis/Euclidean_Space.thy Wed Jun 21 15:04:26 2017 +0200 +++ b/src/HOL/Analysis/Euclidean_Space.thy Wed Jun 21 17:13:55 2017 +0100 @@ -129,6 +129,25 @@ by (simp add: comm_monoid_add_class.sum.remove [OF finite_Basis assms] assms inner_not_same_Basis comm_monoid_add_class.sum.neutral) +lemma sum_if_inner [simp]: + assumes "i \ Basis" "j \ Basis" + shows "inner (\k\Basis. if k = i then f i *\<^sub>R i else g k *\<^sub>R k) j = (if j=i then f j else g j)" +proof (cases "i=j") + case True + with assms show ?thesis + by (auto simp: inner_sum_left if_distrib [of "\x. inner x j"] inner_Basis cong: if_cong) +next + case False + have "(\k\Basis. inner (if k = i then f i *\<^sub>R i else g k *\<^sub>R k) j) = + (\k\Basis. if k = j then g k else 0)" + apply (rule sum.cong) + using False assms by (auto simp: inner_Basis) + also have "... = g j" + using assms by auto + finally show ?thesis + using False by (auto simp: inner_sum_left) +qed + subsection \Subclass relationships\ instance euclidean_space \ perfect_space diff -r 236339f97a88 -r bc5e6461f759 src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Wed Jun 21 15:04:26 2017 +0200 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Wed Jun 21 17:13:55 2017 +0100 @@ -182,6 +182,21 @@ "d tagged_division_of (cbox a b) \ sum (\(x,l). content l) d = content (cbox a b)" unfolding sum.operative_tagged_division[OF operative_content, symmetric] by blast +lemma subadditive_content_division: + assumes "\ division_of S" "S \ cbox a b" + shows "sum content \ \ content(cbox a b)" +proof - + have "\ division_of \\" "\\ \ cbox a b" + using assms by auto + then obtain \' where "\ \ \'" "\' division_of cbox a b" + using partial_division_extend_interval by metis + then have "sum content \ \ sum content \'" + using sum_mono2 by blast + also have "... \ content(cbox a b)" + by (simp add: \\' division_of cbox a b\ additive_content_division less_eq_real_def) + finally show ?thesis . +qed + lemma content_real_eq_0: "content {a .. b::real} = 0 \ a \ b" by (metis atLeastatMost_empty_iff2 content_empty content_real diff_self eq_iff le_cases le_iff_diff_le_0) @@ -451,8 +466,8 @@ using has_integral_linear[OF _ bounded_linear_scaleR_left] by (simp add: comp_def) lemma integrable_on_scaleR_left: - assumes "f integrable_on A" - shows "(\x. f x *\<^sub>R y) integrable_on A" + assumes "f integrable_on A" + shows "(\x. f x *\<^sub>R y) integrable_on A" using assms has_integral_scaleR_left unfolding integrable_on_def by blast lemma has_integral_mult_left: @@ -1294,59 +1309,81 @@ by (auto intro: that[of d] d elim: ) qed -lemma integrable_split[intro]: +lemma integrable_split [intro]: fixes f :: "'a::euclidean_space \ 'b::{real_normed_vector,complete_space}" - assumes "f integrable_on cbox a b" - and k: "k \ Basis" - shows "f integrable_on (cbox a b \ {x. x\k \ c})" (is ?t1) - and "f integrable_on (cbox a b \ {x. x\k \ c})" (is ?t2) + assumes f: "f integrable_on cbox a b" + and k: "k \ Basis" + shows "f integrable_on (cbox a b \ {x. x\k \ c})" (is ?thesis1) + and "f integrable_on (cbox a b \ {x. x\k \ c})" (is ?thesis2) proof - - guess y using assms(1) unfolding integrable_on_def .. note y=this - define b' where "b' = (\i\Basis. (if i = k then min (b\k) c else b\i)*\<^sub>R i)" + obtain y where y: "(f has_integral y) (cbox a b)" + using f by blast define a' where "a' = (\i\Basis. (if i = k then max (a\k) c else a\i)*\<^sub>R i)" - show ?t1 ?t2 - unfolding interval_split[OF k] integrable_cauchy - unfolding interval_split[symmetric,OF k] - proof (rule_tac[!] allI impI)+ - fix e :: real - assume "e > 0" - then have "e/2>0" - by auto - from has_integral_separate_sides[OF y this k,of c] guess d . note d=this[rule_format] - let ?P = "\A. \d. gauge d \ (\p1 p2. p1 tagged_division_of (cbox a b) \ A \ d fine p1 \ - p2 tagged_division_of (cbox a b) \ A \ d fine p2 \ - norm ((\(x, k)\p1. content k *\<^sub>R f x) - (\(x, k)\p2. content k *\<^sub>R f x)) < e)" - show "?P {x. x \ k \ c}" - proof (rule_tac x=d in exI, clarsimp simp add: d) + define b' where "b' = (\i\Basis. (if i = k then min (b\k) c else b\i)*\<^sub>R i)" + have "\d. gauge d \ + (\p1 p2. p1 tagged_division_of cbox a b \ {x. x \ k \ c} \ d fine p1 \ + p2 tagged_division_of cbox a b \ {x. x \ k \ c} \ d fine p2 \ + norm ((\(x,K) \ p1. content K *\<^sub>R f x) - (\(x,K) \ p2. content K *\<^sub>R f x)) < e)" + if "e > 0" for e + proof - + have "e/2 > 0" using that by auto + with has_integral_separate_sides[OF y this k, of c] + obtain d + where "gauge d" + and d: "\p1 p2. \p1 tagged_division_of cbox a b \ {x. x \ k \ c}; d fine p1; + p2 tagged_division_of cbox a b \ {x. c \ x \ k}; d fine p2\ + \ norm ((\(x,K)\p1. content K *\<^sub>R f x) + (\(x,K)\p2. content K *\<^sub>R f x) - y) < e/2" + by metis + show ?thesis + proof (rule_tac x=d in exI, clarsimp simp add: \gauge d\) fix p1 p2 assume as: "p1 tagged_division_of (cbox a b) \ {x. x \ k \ c}" "d fine p1" "p2 tagged_division_of (cbox a b) \ {x. x \ k \ c}" "d fine p2" show "norm ((\(x, k)\p1. content k *\<^sub>R f x) - (\(x, k)\p2. content k *\<^sub>R f x)) < e" - proof (rule fine_division_exists[OF d(1), of a' b] ) + proof (rule fine_division_exists[OF \gauge d\, of a' b]) fix p assume "p tagged_division_of cbox a' b" "d fine p" then show ?thesis - using as norm_triangle_half_l[OF d(2)[of p1 p] d(2)[of p2 p]] + using as norm_triangle_half_l[OF d[of p1 p] d[of p2 p]] unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric] by (auto simp add: algebra_simps) qed qed - show "?P {x. x \ k \ c}" - proof (rule_tac x=d in exI, clarsimp simp add: d) + qed + with f show ?thesis1 + by (simp add: interval_split[OF k] integrable_cauchy) + have "\d. gauge d \ + (\p1 p2. p1 tagged_division_of cbox a b \ {x. x \ k \ c} \ d fine p1 \ + p2 tagged_division_of cbox a b \ {x. x \ k \ c} \ d fine p2 \ + norm ((\(x,K) \ p1. content K *\<^sub>R f x) - (\(x,K) \ p2. content K *\<^sub>R f x)) < e)" + if "e > 0" for e + proof - + have "e/2 > 0" using that by auto + with has_integral_separate_sides[OF y this k, of c] + obtain d + where "gauge d" + and d: "\p1 p2. \p1 tagged_division_of cbox a b \ {x. x \ k \ c}; d fine p1; + p2 tagged_division_of cbox a b \ {x. c \ x \ k}; d fine p2\ + \ norm ((\(x,K)\p1. content K *\<^sub>R f x) + (\(x,K)\p2. content K *\<^sub>R f x) - y) < e/2" + by metis + show ?thesis + proof (rule_tac x=d in exI, clarsimp simp add: \gauge d\) fix p1 p2 assume as: "p1 tagged_division_of (cbox a b) \ {x. x \ k \ c}" "d fine p1" "p2 tagged_division_of (cbox a b) \ {x. x \ k \ c}" "d fine p2" show "norm ((\(x, k)\p1. content k *\<^sub>R f x) - (\(x, k)\p2. content k *\<^sub>R f x)) < e" - proof (rule fine_division_exists[OF d(1), of a b'] ) + proof (rule fine_division_exists[OF \gauge d\, of a b']) fix p assume "p tagged_division_of cbox a b'" "d fine p" then show ?thesis - using as norm_triangle_half_l[OF d(2)[of p p1] d(2)[of p p2]] + using as norm_triangle_half_l[OF d[of p p1] d[of p p2]] unfolding interval_split[OF k] b'_def[symmetric] a'_def[symmetric] by (auto simp add: algebra_simps) qed qed - qed + qed + with f show ?thesis2 + by (simp add: interval_split[OF k] integrable_cauchy) qed lemma operative_integral: @@ -1544,7 +1581,7 @@ guess d1 using f_i[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d1=this[rule_format] guess d2 using g_j[unfolded has_integral,rule_format,OF *] by (elim exE conjE) note d2=this[rule_format] obtain p where p: "p tagged_division_of cbox a b" "d1 fine p" "d2 fine p" - using fine_division_exists[OF gauge_inter[OF d1(1) d2(1)], of a b] unfolding fine_inter + using fine_division_exists[OF gauge_Int[OF d1(1) d2(1)], of a b] unfolding fine_inter by metis note le_less_trans[OF Basis_le_norm[OF k]] then have "\((\(x, k)\p. content k *\<^sub>R f x) - i) \ k\ < (i \ k - j \ k) / 3" @@ -1733,7 +1770,7 @@ note * = i[unfolded has_integral,rule_format,OF this] from *[of m] guess gm by (elim conjE exE) note gm=this[rule_format] from *[of n] guess gn by (elim conjE exE) note gn=this[rule_format] - from fine_division_exists[OF gauge_inter[OF gm(1) gn(1)], of a b] + from fine_division_exists[OF gauge_Int[OF gm(1) gn(1)], of a b] obtain p where p: "p tagged_division_of cbox a b" "(\x. gm x \ gn x) fine p" by auto { fix s1 s2 i1 and i2::'b @@ -5454,67 +5491,74 @@ lemma integrable_straddle_interval: fixes f :: "'n::euclidean_space \ real" - assumes "\e>0. \g h i j. (g has_integral i) (cbox a b) \ (h has_integral j) (cbox a b) \ - norm (i - j) < e \ (\x\cbox a b. (g x) \ f x \ f x \ h x)" + assumes "\e. e>0 \ \g h i j. (g has_integral i) (cbox a b) \ (h has_integral j) (cbox a b) \ + \i - j\ < e \ (\x\cbox a b. (g x) \ f x \ f x \ h x)" shows "f integrable_on cbox a b" -proof (subst integrable_cauchy, safe, goal_cases) - case (1 e) - then have e: "e/3 > 0" - by auto - note assms[rule_format,OF this] - then guess g h i j by (elim exE conjE) note obt = this - from obt(1)[unfolded has_integral[of g], rule_format, OF e] guess d1 .. note d1=conjunctD2[OF this,rule_format] - from obt(2)[unfolded has_integral[of h], rule_format, OF e] guess d2 .. note d2=conjunctD2[OF this,rule_format] - show ?case - apply (rule_tac x="\x. d1 x \ d2 x" in exI) - apply (rule conjI gauge_inter d1 d2)+ - unfolding fine_inter - proof (safe, goal_cases) - have **: "\i j g1 g2 h1 h2 f1 f2. g1 - h2 \ f1 - f2 \ f1 - f2 \ h1 - g2 \ - \i - j\ < e / 3 \ \g2 - i\ < e / 3 \ \g1 - i\ < e / 3 \ - \h2 - j\ < e / 3 \ \h1 - j\ < e / 3 \ \f1 - f2\ < e" - using \e > 0\ by arith - case prems: (1 p1 p2) - note tagged_division_ofD(2-4) note * = this[OF prems(1)] this[OF prems(4)] - - have "(\(x, k)\p1. content k *\<^sub>R f x) - (\(x, k)\p1. content k *\<^sub>R g x) \ 0" - and "0 \ (\(x, k)\p2. content k *\<^sub>R h x) - (\(x, k)\p2. content k *\<^sub>R f x)" - and "(\(x, k)\p2. content k *\<^sub>R f x) - (\(x, k)\p2. content k *\<^sub>R g x) \ 0" - and "0 \ (\(x, k)\p1. content k *\<^sub>R h x) - (\(x, k)\p1. content k *\<^sub>R f x)" - unfolding sum_subtractf[symmetric] - apply - - apply (rule_tac[!] sum_nonneg) - apply safe - unfolding real_scaleR_def right_diff_distrib[symmetric] - apply (rule_tac[!] mult_nonneg_nonneg) - apply simp_all - using obt(4) prems(1) prems(4) apply (blast intro: elim: dest!: bspec)+ +proof - + have "\d. gauge d \ + (\p1 p2. p1 tagged_division_of cbox a b \ d fine p1 \ + p2 tagged_division_of cbox a b \ d fine p2 \ + \(\(x,K)\p1. content K *\<^sub>R f x) - (\(x,K)\p2. content K *\<^sub>R f x)\ < e)" + if "e > 0" for e + proof - + have e: "e/3 > 0" + using that by auto + then obtain g h i j where ij: "\i - j\ < e/3" + and "(g has_integral i) (cbox a b)" + and "(h has_integral j) (cbox a b)" + and fgh: "\x. x \ cbox a b \ g x \ f x \ f x \ h x" + using assms real_norm_def by metis + then obtain d1 d2 where "gauge d1" "gauge d2" + and d1: "\p. \p tagged_division_of cbox a b; d1 fine p\ \ + \(\(x,K)\p. content K *\<^sub>R g x) - i\ < e/3" + and d2: "\p. \p tagged_division_of cbox a b; d2 fine p\ \ + \(\(x,K) \ p. content K *\<^sub>R h x) - j\ < e/3" + by (metis e has_integral real_norm_def) + have "\(\(x,K) \ p1. content K *\<^sub>R f x) - (\(x,K) \ p2. content K *\<^sub>R f x)\ < e" + if p1: "p1 tagged_division_of cbox a b" and 11: "d1 fine p1" and 21: "d2 fine p1" + and p2: "p2 tagged_division_of cbox a b" and 12: "d1 fine p2" and 22: "d2 fine p2" for p1 p2 + proof - + have *: "\g1 g2 h1 h2 f1 f2. + \\g2 - i\ < e/3; \g1 - i\ < e/3; \h2 - j\ < e/3; \h1 - j\ < e/3; + g1 - h2 \ f1 - f2; f1 - f2 \ h1 - g2\ + \ \f1 - f2\ < e" + using \e > 0\ ij by arith + have 0: "(\(x, k)\p1. content k *\<^sub>R f x) - (\(x, k)\p1. content k *\<^sub>R g x) \ 0" + "0 \ (\(x, k)\p2. content k *\<^sub>R h x) - (\(x, k)\p2. content k *\<^sub>R f x)" + "(\(x, k)\p2. content k *\<^sub>R f x) - (\(x, k)\p2. content k *\<^sub>R g x) \ 0" + "0 \ (\(x, k)\p1. content k *\<^sub>R h x) - (\(x, k)\p1. content k *\<^sub>R f x)" + unfolding sum_subtractf[symmetric] + apply (auto intro!: sum_nonneg) + apply (meson fgh measure_nonneg mult_left_mono tag_in_interval that sum_nonneg)+ done - then show ?case - apply - - unfolding real_norm_def - apply (rule **) - defer - defer - unfolding real_norm_def[symmetric] - apply (rule obt(3)) - apply (rule d1(2)[OF conjI[OF prems(4,5)]]) - apply (rule d1(2)[OF conjI[OF prems(1,2)]]) - apply (rule d2(2)[OF conjI[OF prems(4,6)]]) - apply (rule d2(2)[OF conjI[OF prems(1,3)]]) - apply auto - done + show ?thesis + proof (rule *) + show "\(\(x,K) \ p2. content K *\<^sub>R g x) - i\ < e/3" + by (rule d1[OF p2 12]) + show "\(\(x,K) \ p1. content K *\<^sub>R g x) - i\ < e/3" + by (rule d1[OF p1 11]) + show "\(\(x,K) \ p2. content K *\<^sub>R h x) - j\ < e/3" + by (rule d2[OF p2 22]) + show "\(\(x,K) \ p1. content K *\<^sub>R h x) - j\ < e/3" + by (rule d2[OF p1 21]) + qed (use 0 in auto) + qed + then show ?thesis + by (rule_tac x="\x. d1 x \ d2 x" in exI) + (auto simp: fine_inter intro: \gauge d1\ \gauge d2\ d1 d2) qed + then show ?thesis + by (simp add: integrable_cauchy) qed lemma integrable_straddle: fixes f :: "'n::euclidean_space \ real" - assumes "\e>0. \g h i j. (g has_integral i) s \ (h has_integral j) s \ - norm (i - j) < e \ (\x\s. g x \ f x \ f x \ h x)" + assumes "\e. e>0 \ \g h i j. (g has_integral i) s \ (h has_integral j) s \ + \i - j\ < e \ (\x\s. g x \ f x \ f x \ h x)" shows "f integrable_on s" proof - have "\a b. (\x. if x \ s then f x else 0) integrable_on cbox a b" - proof (rule integrable_straddle_interval, safe, goal_cases) + proof (rule integrable_straddle_interval, goal_cases) case (1 a b e) then have *: "e/4 > 0" by auto @@ -5543,7 +5587,7 @@ unfolding c_def d_def by auto qed have **: "\ch cg ag ah::real. norm (ah - ag) \ norm (ch - cg) \ norm (cg - i) < e / 4 \ - norm (ch - j) < e / 4 \ norm (ag - ah) < e" + norm (ch - j) < e / 4 \ abs (ag - ah) < e" using obt(3) unfolding real_norm_def by arith @@ -5554,7 +5598,7 @@ apply (rule_tac x="integral (cbox a b) (\x. if x \ s then h x else 0)" in exI) apply safe apply (rule_tac[1-2] integrable_integral,rule g) - apply (rule h) + apply (rule h) apply (rule **[OF _ B1(2)[OF *(1)] B2(2)[OF *(2)]]) proof - have *: "\x f g. (if x \ s then f x else 0) - (if x \ s then g x else 0) = @@ -5642,7 +5686,7 @@ apply (rule order_trans) apply (rule **) apply (rule as(2)) - apply (rule obt) + using obt(3) apply auto[1] apply (rule_tac[!] integral_le) using obt apply (auto intro!: h g interv) @@ -5946,7 +5990,7 @@ done note integrable_integral[OF this, unfolded has_integral[of f]] from this[rule_format,OF *] guess dd .. note dd=conjunctD2[OF this,rule_format] - note gauge_inter[OF \gauge d\ dd(1)] + note gauge_Int[OF \gauge d\ dd(1)] from fine_division_exists[OF this,of u v] guess qq . then show ?case apply (rule_tac x=qq in exI) @@ -6838,7 +6882,7 @@ guess d1 .. note d1 = conjunctD2[OF this,rule_format] from integrable_integral[OF that(2),unfolded has_integral[of g],rule_format,OF *] guess d2 .. note d2 = conjunctD2[OF this,rule_format] - note gauge_inter[OF d1(1) d2(1)] + note gauge_Int[OF d1(1) d2(1)] from fine_division_exists[OF this, of a b] guess p . note p=this show "norm (integral (cbox a b) f) < integral (cbox a b) g + e" apply (rule norm) @@ -7066,7 +7110,7 @@ by simp also have "\ < e' * norm (x - x0)" using \e' > 0\ - apply (intro mult_strict_right_mono[OF _ \0 < norm (x - x0)\]) + apply (intro mult_strict_right_mono[OF _ \0 < norm (x - x0)\]) apply (auto simp: divide_simps e_def) by (metis \0 < e\ e_def order.asym zero_less_divide_iff) finally have "norm (?F x - ?F x0 - ?dF (x - x0)) < e' * norm (x - x0)" . diff -r 236339f97a88 -r bc5e6461f759 src/HOL/Analysis/Tagged_Division.thy --- a/src/HOL/Analysis/Tagged_Division.thy Wed Jun 21 15:04:26 2017 +0200 +++ b/src/HOL/Analysis/Tagged_Division.thy Wed Jun 21 17:13:55 2017 +0100 @@ -272,7 +272,7 @@ lemma gauge_trivial[intro!]: "gauge (\x. ball x 1)" by (rule gauge_ball) auto -lemma gauge_inter[intro]: "gauge d1 \ gauge d2 \ gauge (\x. d1 x \ d2 x)" +lemma gauge_Int[intro]: "gauge d1 \ gauge d2 \ gauge (\x. d1 x \ d2 x)" unfolding gauge_def by auto lemma gauge_inters: @@ -667,7 +667,7 @@ qed qed -lemma partial_division_extend_interval: +proposition partial_division_extend_interval: assumes "p division_of (\p)" "(\p) \ cbox a b" obtains q where "p \ q" "q division_of cbox a (b::'a::euclidean_space)" proof (cases "p = {}") diff -r 236339f97a88 -r bc5e6461f759 src/HOL/Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Analysis/Topology_Euclidean_Space.thy Wed Jun 21 15:04:26 2017 +0200 +++ b/src/HOL/Analysis/Topology_Euclidean_Space.thy Wed Jun 21 17:13:55 2017 +0100 @@ -1374,6 +1374,128 @@ then show ?thesis by (auto simp: I_def) qed +corollary open_countable_Union_open_box: + fixes S :: "'a :: euclidean_space set" + assumes "open S" + obtains \ where "countable \" "\ \ Pow S" "\X. X \ \ \ \a b. X = box a b" "\\ = S" +proof - + let ?a = "\f. (\(i::'a)\Basis. fst (f i) *\<^sub>R i)" + let ?b = "\f. (\(i::'a)\Basis. snd (f i) *\<^sub>R i)" + let ?I = "{f\Basis \\<^sub>E \ \ \. box (?a f) (?b f) \ S}" + let ?\ = "(\f. box (?a f) (?b f)) ` ?I" + show ?thesis + proof + have "countable ?I" + by (simp add: countable_PiE countable_rat) + then show "countable ?\" + by blast + show "\?\ = S" + using open_UNION_box [OF assms] by metis + qed auto +qed + +lemma rational_cboxes: + fixes x :: "'a::euclidean_space" + assumes "e > 0" + shows "\a b. (\i\Basis. a \ i \ \ \ b \ i \ \) \ x \ cbox a b \ cbox a b \ ball x e" +proof - + define e' where "e' = e / (2 * sqrt (real (DIM ('a))))" + then have e: "e' > 0" + using assms by auto + have "\i. \y. y \ \ \ y < x \ i \ x \ i - y < e'" (is "\i. ?th i") + proof + fix i + from Rats_dense_in_real[of "x \ i - e'" "x \ i"] e + show "?th i" by auto + qed + from choice[OF this] obtain a where + a: "\u. a u \ \ \ a u < x \ u \ x \ u - a u < e'" .. + have "\i. \y. y \ \ \ x \ i < y \ y - x \ i < e'" (is "\i. ?th i") + proof + fix i + from Rats_dense_in_real[of "x \ i" "x \ i + e'"] e + show "?th i" by auto + qed + from choice[OF this] obtain b where + b: "\u. b u \ \ \ x \ u < b u \ b u - x \ u < e'" .. + let ?a = "\i\Basis. a i *\<^sub>R i" and ?b = "\i\Basis. b i *\<^sub>R i" + show ?thesis + proof (rule exI[of _ ?a], rule exI[of _ ?b], safe) + fix y :: 'a + assume *: "y \ cbox ?a ?b" + have "dist x y = sqrt (\i\Basis. (dist (x \ i) (y \ i))\<^sup>2)" + unfolding setL2_def[symmetric] by (rule euclidean_dist_l2) + also have "\ < sqrt (\(i::'a)\Basis. e^2 / real (DIM('a)))" + proof (rule real_sqrt_less_mono, rule sum_strict_mono) + fix i :: "'a" + assume i: "i \ Basis" + have "a i \ y\i \ y\i \ b i" + using * i by (auto simp: cbox_def) + moreover have "a i < x\i" "x\i - a i < e'" + using a by auto + moreover have "x\i < b i" "b i - x\i < e'" + using b by auto + ultimately have "\x\i - y\i\ < 2 * e'" + by auto + then have "dist (x \ i) (y \ i) < e/sqrt (real (DIM('a)))" + unfolding e'_def by (auto simp: dist_real_def) + then have "(dist (x \ i) (y \ i))\<^sup>2 < (e/sqrt (real (DIM('a))))\<^sup>2" + by (rule power_strict_mono) auto + then show "(dist (x \ i) (y \ i))\<^sup>2 < e\<^sup>2 / real DIM('a)" + by (simp add: power_divide) + qed auto + also have "\ = e" + using \0 < e\ by simp + finally show "y \ ball x e" + by (auto simp: ball_def) + next + show "x \ cbox (\i\Basis. a i *\<^sub>R i) (\i\Basis. b i *\<^sub>R i)" + using a b less_imp_le by (auto simp: cbox_def) + qed (use a b cbox_def in auto) +qed + +lemma open_UNION_cbox: + fixes M :: "'a::euclidean_space set" + assumes "open M" + defines "a' \ \f. (\(i::'a)\Basis. fst (f i) *\<^sub>R i)" + defines "b' \ \f. (\(i::'a)\Basis. snd (f i) *\<^sub>R i)" + defines "I \ {f\Basis \\<^sub>E \ \ \. cbox (a' f) (b' f) \ M}" + shows "M = (\f\I. cbox (a' f) (b' f))" +proof - + have "x \ (\f\I. cbox (a' f) (b' f))" if "x \ M" for x + proof - + obtain e where e: "e > 0" "ball x e \ M" + using openE[OF \open M\ \x \ M\] by auto + moreover obtain a b where ab: "x \ cbox a b" "\i \ Basis. a \ i \ \" + "\i \ Basis. b \ i \ \" "cbox a b \ ball x e" + using rational_cboxes[OF e(1)] by metis + ultimately show ?thesis + by (intro UN_I[of "\i\Basis. (a \ i, b \ i)"]) + (auto simp: euclidean_representation I_def a'_def b'_def) + qed + then show ?thesis by (auto simp: I_def) +qed + +corollary open_countable_Union_open_cbox: + fixes S :: "'a :: euclidean_space set" + assumes "open S" + obtains \ where "countable \" "\ \ Pow S" "\X. X \ \ \ \a b. X = cbox a b" "\\ = S" +proof - + let ?a = "\f. (\(i::'a)\Basis. fst (f i) *\<^sub>R i)" + let ?b = "\f. (\(i::'a)\Basis. snd (f i) *\<^sub>R i)" + let ?I = "{f\Basis \\<^sub>E \ \ \. cbox (?a f) (?b f) \ S}" + let ?\ = "(\f. cbox (?a f) (?b f)) ` ?I" + show ?thesis + proof + have "countable ?I" + by (simp add: countable_PiE countable_rat) + then show "countable ?\" + by blast + show "\?\ = S" + using open_UNION_cbox [OF assms] by metis + qed auto +qed + lemma box_eq_empty: fixes a :: "'a::euclidean_space" shows "(box a b = {} \ (\i\Basis. b\i \ a\i))" (is ?th1) @@ -7398,6 +7520,24 @@ by (simp add: assms bij_is_surj open_surjective_linear_image) qed +corollary interior_bijective_linear_image: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes "linear f" "bij f" + shows "interior (f ` S) = f ` interior S" (is "?lhs = ?rhs") +proof safe + fix x + assume x: "x \ ?lhs" + then obtain T where "open T" and "x \ T" and "T \ f ` S" + by (metis interiorE) + then show "x \ ?rhs" + by (metis (no_types, hide_lams) assms subsetD interior_maximal open_bijective_linear_image_eq subset_image_iff) +next + fix x + assume x: "x \ interior S" + then show "f x \ interior (f ` S)" + by (meson assms imageI image_mono interiorI interior_subset open_bijective_linear_image_eq open_interior) +qed + text \Also bilinear functions, in composition form.\ lemma bilinear_continuous_at_compose: diff -r 236339f97a88 -r bc5e6461f759 src/HOL/Archimedean_Field.thy --- a/src/HOL/Archimedean_Field.thy Wed Jun 21 15:04:26 2017 +0200 +++ b/src/HOL/Archimedean_Field.thy Wed Jun 21 17:13:55 2017 +0100 @@ -339,6 +339,11 @@ lemma floor_less_neg_numeral [simp]: "\x\ < - numeral v \ x < - numeral v" by (simp add: floor_less_iff) +lemma le_mult_floor_Ints: + assumes "0 \ a" "a \ Ints" + shows "of_int (\a\ * \b\) \ (of_int\a * b\ :: 'a :: linordered_idom)" + by (metis Ints_cases assms floor_less_iff floor_of_int linorder_not_less mult_left_mono of_int_floor_le of_int_less_iff of_int_mult) + text \Addition and subtraction of integers.\ @@ -492,6 +497,16 @@ lemma ceiling_add_le: "\x + y\ \ \x\ + \y\" by (simp only: ceiling_le_iff of_int_add add_mono le_of_int_ceiling) +lemma mult_ceiling_le: + assumes "0 \ a" and "0 \ b" + shows "\a * b\ \ \a\ * \b\" + by (metis assms ceiling_le_iff ceiling_mono le_of_int_ceiling mult_mono of_int_mult) + +lemma mult_ceiling_le_Ints: + assumes "0 \ a" "a \ Ints" + shows "(of_int \a * b\ :: 'a :: linordered_idom) \ of_int(\a\ * \b\)" + by (metis Ints_cases assms ceiling_le_iff ceiling_of_int le_of_int_ceiling mult_left_mono of_int_le_iff of_int_mult) + lemma finite_int_segment: fixes a :: "'a::floor_ceiling" shows "finite {x \ \. a \ x \ x \ b}" @@ -504,6 +519,10 @@ by simp qed +corollary finite_abs_int_segment: + fixes a :: "'a::floor_ceiling" + shows "finite {k \ \. \k\ \ a}" + using finite_int_segment [of "-a" a] by (auto simp add: abs_le_iff conj_commute minus_le_iff) text \Ceiling with numerals.\