# HG changeset patch # User paulson # Date 1501762506 -7200 # Node ID f2e1047d6cc1e90c4de0d17501aba91668837dc2 # Parent a9bb833ee9715fe9834a879bcfefd9df5ad69f62 more tidying diff -r a9bb833ee971 -r f2e1047d6cc1 src/HOL/Analysis/Tagged_Division.thy --- a/src/HOL/Analysis/Tagged_Division.thy Thu Aug 03 11:29:08 2017 +0200 +++ b/src/HOL/Analysis/Tagged_Division.thy Thu Aug 03 14:15:06 2017 +0200 @@ -525,13 +525,9 @@ show "cbox c d \ p" unfolding p_def by (auto simp add: box_eq_empty cbox_def intro!: image_eqI[where x="\(i::'a)\Basis. (c, d)"]) - { - fix i :: 'a - assume "i \ Basis" - with incl nonempty have "a \ i \ c \ i" "c \ i \ d \ i" "d \ i \ b \ i" - unfolding box_eq_empty subset_box by (auto simp: not_le) - } - note ord = this + have ord: "a \ i \ c \ i" "c \ i \ d \ i" "d \ i \ b \ i" if "i \ Basis" for i + using incl nonempty that + unfolding box_eq_empty subset_box by (auto simp: not_le) show "p division_of (cbox a b)" proof (rule division_ofI) @@ -696,12 +692,7 @@ obtains p where "(insert (cbox a b) p) division_of (cbox a b \ cbox c d)" proof (cases "cbox c d = {}") case True - show ?thesis - apply (rule that[of "{}"]) - unfolding True - using assms - apply auto - done + with assms that show ?thesis by force next case False show ?thesis @@ -789,14 +780,13 @@ by auto show "finite ?D" using "*" pdiv(1) q(1) by auto - have lem1: "\f s. \\(f ` s) = \((\x. \(f x)) ` s)" - by auto - have lem2: "\f s. f \ {} \ \{s \ t |t. t \ f} = s \ \f" + have "\?D = (\x\p. \insert (cbox a b) (q x))" by auto - show "\?D = cbox a b \ \p" - unfolding * lem1 - unfolding lem2[OF \p \ {}\, of "cbox a b", symmetric] - using q(6) by auto + also have "... = \{cbox a b \ t |t. t \ p}" + using q(6) by auto + also have "... = cbox a b \ \p" + using \p \ {}\ by auto + finally show "\?D = cbox a b \ \p" . show "K \ cbox a b \ \p" "K \ {}" if "K \ ?D" for K using q that by blast+ show "\a b. K = cbox a b" if "K \ ?D" for K @@ -1107,9 +1097,8 @@ assumes "s tagged_partial_division_of i" and "t \ s" shows "t tagged_partial_division_of i" - using assms + using assms finite_subset[OF assms(2)] unfolding tagged_partial_division_of_def - using finite_subset[OF assms(2)] by blast lemma tag_in_interval: "p tagged_division_of i \ (x, k) \ p \ x \ i" @@ -1160,28 +1149,28 @@ qed lemma tagged_division_unions: - assumes "finite iset" - and "\i\iset. pfn i tagged_division_of i" - and "\i1\iset. \i2\iset. i1 \ i2 \ interior(i1) \ interior(i2) = {}" - shows "\(pfn ` iset) tagged_division_of (\iset)" + assumes "finite I" + and "\i\I. pfn i tagged_division_of i" + and "\i1\I. \i2\I. i1 \ i2 \ interior(i1) \ interior(i2) = {}" + shows "\(pfn ` I) tagged_division_of (\I)" proof (rule tagged_division_ofI) note assm = tagged_division_ofD[OF assms(2)[rule_format]] - show "finite (\(pfn ` iset))" + show "finite (\(pfn ` I))" using assms by auto - have "\{k. \x. (x, k) \ \(pfn ` iset)} = \((\i. \{k. \x. (x, k) \ pfn i}) ` iset)" + have "\{k. \x. (x, k) \ \(pfn ` I)} = \((\i. \{k. \x. (x, k) \ pfn i}) ` I)" by blast - also have "\ = \iset" + also have "\ = \I" using assm(6) by auto - finally show "\{k. \x. (x, k) \ \(pfn ` iset)} = \iset" . + finally show "\{k. \x. (x, k) \ \(pfn ` I)} = \I" . fix x k - assume xk: "(x, k) \ \(pfn ` iset)" - then obtain i where i: "i \ iset" "(x, k) \ pfn i" + assume xk: "(x, k) \ \(pfn ` I)" + then obtain i where i: "i \ I" "(x, k) \ pfn i" by auto - show "x \ k" "\a b. k = cbox a b" "k \ \iset" + show "x \ k" "\a b. k = cbox a b" "k \ \I" using assm(2-4)[OF i] using i(1) by auto fix x' k' - assume xk': "(x', k') \ \(pfn ` iset)" "(x, k) \ (x', k')" - then obtain i' where i': "i' \ iset" "(x', k') \ pfn i'" + assume xk': "(x', k') \ \(pfn ` I)" "(x, k) \ (x', k')" + then obtain i' where i': "i' \ I" "(x', k') \ pfn i'" by auto have *: "\a b. i \ i' \ a \ i \ b \ i' \ interior a \ interior b = {}" using i(1) i'(1) @@ -1381,11 +1370,7 @@ have "\x. x \ ?D - ?D1" using assms(3-) unfolding division_points_def interval_bounds[OF ab] - apply - - apply (erule disjE) - apply (rule_tac x="(k,(interval_lowerbound l)\k)" in exI, force simp add: *) - apply (rule_tac x="(k,(interval_upperbound l)\k)" in exI, force simp add: *) - done + by (force simp add: *) moreover have "?D1 \ ?D" by (auto simp add: assms division_points_subset) ultimately show "?D1 \ ?D" @@ -1398,11 +1383,7 @@ have "\x. x \ ?D - ?D2" using assms(3-) unfolding division_points_def interval_bounds[OF ab] - apply - - apply (erule disjE) - apply (rule_tac x="(k,(interval_lowerbound l)\k)" in exI, force simp add: *) - apply (rule_tac x="(k,(interval_upperbound l)\k)" in exI, force simp add: *) - done + by (force simp add: *) moreover have "?D2 \ ?D" by (auto simp add: assms division_points_subset) ultimately show "?D2 \ ?D" @@ -1744,39 +1725,28 @@ done next fix a b c :: real - assume "\a b. b \ a \ g {a .. b} = \<^bold>1" - and "\a b c. a < c \ c < b \ g {a..c} \<^bold>* g {c..b} = g {a..b}" + assume eq1: "\a b. b \ a \ g {a .. b} = \<^bold>1" + and eqg: "\a b c. a < c \ c < b \ g {a..c} \<^bold>* g {c..b} = g {a..b}" and "a \ c" and "c \ b" - note as = this[rule_format] show "g {a..c} \<^bold>* g {c..b} = g {a..b}" proof (cases "c = a \ c = b") case False then show ?thesis - apply - - apply (subst as(2)) - using as(3-) - apply auto - done + using eqg \a \ c\ \c \ b\ by auto next case True then show ?thesis proof assume *: "c = a" then have "g {a .. c} = \<^bold>1" - apply - - apply (rule as(1)[rule_format]) - apply auto - done + using eq1 by blast then show ?thesis unfolding * by auto next assume *: "c = b" then have "g {c .. b} = \<^bold>1" - apply - - apply (rule as(1)[rule_format]) - apply auto - done + using eq1 by blast then show ?thesis unfolding * by auto qed @@ -1909,18 +1879,18 @@ subsection \Some basic combining lemmas.\ lemma tagged_division_Union_exists: - assumes "finite iset" - and "\i\iset. \p. p tagged_division_of i \ d fine p" - and "\i1\iset. \i2\iset. i1 \ i2 \ interior i1 \ interior i2 = {}" - and "\iset = i" + assumes "finite I" + and "\i\I. \p. p tagged_division_of i \ d fine p" + and "\i1\I. \i2\I. i1 \ i2 \ interior i1 \ interior i2 = {}" + and "\I = i" obtains p where "p tagged_division_of i" and "d fine p" proof - obtain pfn where pfn: - "\x. x \ iset \ pfn x tagged_division_of x" - "\x. x \ iset \ d fine pfn x" + "\x. x \ I \ pfn x tagged_division_of x" + "\x. x \ I \ d fine pfn x" using bchoice[OF assms(2)] by auto show thesis - apply (rule_tac p="\(pfn ` iset)" in that) + apply (rule_tac p="\(pfn ` I)" in that) using assms(1) assms(3) assms(4) pfn(1) tagged_division_unions apply force by (metis (mono_tags, lifting) fine_Union imageE pfn(2)) qed @@ -1947,25 +1917,22 @@ using assms(1,3) by metis then have ab: "\i. i\Basis \ a \ i \ b \ i" by (force simp: mem_box) - { fix f - have "\finite f; + have UN_cases: "\finite f; \s. s\f \ P s; \s. s\f \ \a b. s = cbox a b; - \s t. s\f \ t\f \ s \ t \ interior s \ interior t = {}\ \ P (\f)" - proof (induct f rule: finite_induct) - case empty - show ?case - using assms(1) by auto - next - case (insert x f) - show ?case - unfolding Union_insert - apply (rule assms(2)[rule_format]) - using Int_interior_Union_intervals [of f "interior x"] - apply (auto simp: insert) - by (metis IntI empty_iff insert.hyps(2) insert.prems(3) insert_iff) - qed - } note UN_cases = this + \s t. s\f \ t\f \ s \ t \ interior s \ interior t = {}\ \ P (\f)" for f + proof (induct f rule: finite_induct) + case empty + show ?case + using assms(1) by auto + next + case (insert x f) + show ?case + unfolding Union_insert + apply (rule assms(2)[rule_format]) + using Int_interior_Union_intervals [of f "interior x"] + by (metis (no_types, lifting) insert insert_iff open_interior) + qed let ?A = "{cbox c d | c d::'a. \i\Basis. (c\i = a\i) \ (d\i = (a\i + b\i) / 2) \ (c\i = (a\i + b\i) / 2) \ (d\i = b\i)}" let ?PP = "\c d. \i\Basis. a\i \ c\i \ c\i \ d\i \ d\i \ b\i \ 2 * (d\i - c\i) \ b\i - a\i" @@ -2085,13 +2052,12 @@ then show "\c d. ?P i c d" by blast qed + then obtain \ \ where + "\i\Basis. (\ \ i = a \ i \ \ \ i = (a \ i + b \ i) / 2 \ + \ \ i = (a \ i + b \ i) / 2 \ \ \ i = b \ i) \ \ \ i \ x \ i \ x \ i \ \ \ i" + by (auto simp: choice_Basis_iff) then show "x\\?A" - unfolding Union_iff Bex_def mem_Collect_eq choice_Basis_iff - apply auto - apply (rule_tac x="cbox xa xaa" in exI) - unfolding mem_box - apply auto - done + by (force simp add: mem_box) qed finally show False using assms by auto @@ -2123,10 +2089,7 @@ 2 * (d \ i - c \ i) \ snd x \ i - fst x \ i" by (rule interval_bisection_step[of P, OF assms(1-2) as]) then show ?thesis - apply - - apply (rule_tac x="(c,d)" in exI) - apply auto - done + by (rule_tac x="(c,d)" in exI) auto qed qed then obtain f where f: @@ -2137,11 +2100,7 @@ fst x \ i \ fst (f x) \ i \ fst (f x) \ i \ snd (f x) \ i \ snd (f x) \ i \ snd x \ i \ - 2 * (snd (f x) \ i - fst (f x) \ i) \ snd x \ i - fst x \ i)" - apply - - apply (drule choice) - apply blast - done + 2 * (snd (f x) \ i - fst (f x) \ i) \ snd x \ i - fst x \ i)" by metis 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 have [simp]: "A 0 = a" "B 0 = b" and ABRAW: "\n. \ P (cbox (A(Suc n)) (B(Suc n))) \ (\i\Basis. A(n)\i \ A(Suc n)\i \ A(Suc n)\i \ B(Suc n)\i \ B(Suc n)\i \ B(n)\i \ @@ -2154,10 +2113,7 @@ proof (induct n) case 0 then show ?case - unfolding S - apply (rule f[rule_format]) using assms(3) - apply auto - done + unfolding S using \\ P (cbox a b)\ f by auto next case (Suc n) show ?case @@ -2205,8 +2161,7 @@ next case (Suc n) have "B (Suc n) \ i - A (Suc n) \ i \ (B n \ i - A n \ i) / 2" - using AB(3) that - using AB(4)[of i n] using i by auto + using AB(3) that AB(4)[of i n] using i by auto also have "\ \ (b \ i - a \ i) / 2 ^ Suc n" using Suc by (auto simp add: field_simps) finally show ?case . @@ -2270,13 +2225,13 @@ fixes a b :: "'a::euclidean_space" assumes "gauge g" obtains p where "p tagged_division_of (cbox a b)" "g fine p" -proof - - presume "\ (\p. p tagged_division_of (cbox a b) \ g fine p) \ False" - then obtain p where "p tagged_division_of (cbox a b)" "g fine p" - by blast - then show thesis .. +proof (cases "\p. p tagged_division_of (cbox a b) \ g fine p") + case True + then show ?thesis + using that by auto next - assume as: "\ (\p. p tagged_division_of (cbox a b) \ g fine p)" + case False + assume "\ (\p. p tagged_division_of (cbox a b) \ g fine p)" obtain x where x: "x \ (cbox a b)" "\e. 0 < e \ @@ -2285,10 +2240,10 @@ cbox c d \ ball x e \ cbox c d \ (cbox a b) \ \ (\p. p tagged_division_of cbox c d \ g fine p)" - apply (rule interval_bisection[of "\s. \p. p tagged_division_of s \ g fine p", OF _ _ as]) + apply (rule interval_bisection[of "\s. \p. p tagged_division_of s \ g fine p", OF _ _ False]) apply (simp add: fine_def) apply (metis tagged_division_union fine_Un) - apply (auto simp: ) + apply auto done obtain e where e: "e > 0" "ball x e \ g x" using gaugeD[OF assms, of x] unfolding open_contains_ball by auto @@ -2300,7 +2255,7 @@ by blast have "g fine {(x, cbox c d)}" unfolding fine_def using e using c_d(2) by auto - then show False + then show ?thesis using tagged_division_of_self[OF c_d(1)] using c_d by auto qed @@ -2344,10 +2299,7 @@ proof (induct p) case empty show ?case - apply (rule_tac x="{}" in exI) - unfolding fine_def - apply auto - done + by (force simp add: fine_def) next case (insert xk p) obtain x k where xk: "xk = (x, k)"