# HG changeset patch # User paulson # Date 1525771927 -3600 # Node ID 2f161c6910f7ba43a7f2dcc9477522ba3469888e # Parent 5f3cffe163119a3342f065493567a6446ef23e5f tidying more messy proofs diff -r 5f3cffe16311 -r 2f161c6910f7 src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy --- a/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Sun May 06 23:59:14 2018 +0100 +++ b/src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy Tue May 08 10:32:07 2018 +0100 @@ -1978,7 +1978,7 @@ and measure_countable_negligible_Union_bounded: "(\n. (measure lebesgue (S n))) sums measure lebesgue (\n. S n)" (is ?Sums) proof - obtain a b where ab: "(\n. S n) \ cbox a b" - using bo bounded_subset_cbox by blast + using bo bounded_subset_cbox_symmetric by metis then have B: "(\k\n. measure lebesgue (S k)) \ measure lebesgue (cbox a b)" for n proof - have "(\k\n. measure lebesgue (S k)) = measure lebesgue (UNION {..n} S)" @@ -2837,7 +2837,7 @@ if "bounded S" "S \ lmeasurable" for S proof - obtain a b where "S \ cbox a b" - using \bounded S\ bounded_subset_cbox by blast + using \bounded S\ bounded_subset_cbox_symmetric by metis have fUD: "(f ` \\) \ lmeasurable \ ?\ (f ` \\) = (m * ?\ (\\))" if "countable \" and cbox: "\K. K \ \ \ K \ cbox a b \ K \ {} \ (\c d. K = cbox c d)" @@ -3005,7 +3005,7 @@ "\a b. ball 0 B \ cbox a b \ \?\ (S \ cbox a b) - ?\ S\ < e / (1 + \m\)" using has_measure_limit [OF S] \e > 0\ by (metis abs_add_one_gt_zero zero_less_divide_iff) obtain c d::'n where cd: "ball 0 B \ cbox c d" - using bounded_subset_cbox by blast + by (metis bounded_subset_cbox_symmetric bounded_ball) with B have less: "\?\ (S \ cbox c d) - ?\ S\ < e / (1 + \m\)" . obtain D where "D > 0" and D: "cbox c d \ ball 0 D" by (metis bounded_cbox bounded_subset_ballD) diff -r 5f3cffe16311 -r 2f161c6910f7 src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Sun May 06 23:59:14 2018 +0100 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Tue May 08 10:32:07 2018 +0100 @@ -334,7 +334,7 @@ \z. (?F has_integral z) (cbox a b) \ norm (z - k2) < norm (k1 - k2)/2" by (rule has_integral_altD[OF assms(2) nonbox,OF e]) blast obtain a b :: 'n where ab: "ball 0 B1 \ cbox a b" "ball 0 B2 \ cbox a b" - by (metis Un_subset_iff bounded_Un bounded_ball bounded_subset_cbox) + by (metis Un_subset_iff bounded_Un bounded_ball bounded_subset_cbox_symmetric) obtain w where w: "(?F has_integral w) (cbox a b)" "norm (w - k1) < norm (k1 - k2)/2" using B1(2)[OF ab(1)] by blast obtain z where z: "(?F has_integral z) (cbox a b)" "norm (z - k2) < norm (k1 - k2)/2" @@ -1635,9 +1635,9 @@ using has_integral_altD[OF _ False ij] assms by blast have "bounded (ball 0 B1 \ ball (0::'a) B2)" unfolding bounded_Un by(rule conjI bounded_ball)+ - from bounded_subset_cbox[OF this] + from bounded_subset_cbox_symmetric[OF this] obtain a b::'a where ab: "ball 0 B1 \ cbox a b" "ball 0 B2 \ cbox a b" - by blast+ + by (meson Un_subset_iff) then obtain w1 w2 where int_w1: "((\x. if x \ S then f x else 0) has_integral w1) (cbox a b)" and norm_w1: "norm (w1 - i) < (i \ k - j \ k) / 3" and int_w2: "((\x. if x \ S then g x else 0) has_integral w2) (cbox a b)" @@ -6227,7 +6227,7 @@ \z. (?g has_integral z) (cbox a b) \ norm (z - integral S g) < e/2" using integrable_integral [OF int_g,unfolded has_integral'[of g]] e that by blast obtain a b::'n where ab: "ball 0 Bf \ ball 0 Bg \ cbox a b" - using ball_max_Un bounded_subset_cbox[OF bounded_ball, of _ "max Bf Bg"] by blast + using ball_max_Un by (metis bounded_ball bounded_subset_cbox_symmetric) have "ball 0 Bf \ cbox a b" using ab by auto with Bf obtain z where int_fz: "(?f has_integral z) (cbox a b)" and z: "norm (z - integral S f) < e/2" diff -r 5f3cffe16311 -r 2f161c6910f7 src/HOL/Analysis/Lebesgue_Measure.thy --- a/src/HOL/Analysis/Lebesgue_Measure.thy Sun May 06 23:59:14 2018 +0100 +++ b/src/HOL/Analysis/Lebesgue_Measure.thy Tue May 08 10:32:07 2018 +0100 @@ -908,14 +908,17 @@ qed (simp add: borel_prod[symmetric]) (* FIXME: conversion in measurable prover *) -lemma lborelD_Collect[measurable (raw)]: "{x\space borel. P x} \ sets borel \ {x\space lborel. P x} \ sets lborel" by simp -lemma lborelD[measurable (raw)]: "A \ sets borel \ A \ sets lborel" by simp +lemma lborelD_Collect[measurable (raw)]: "{x\space borel. P x} \ sets borel \ {x\space lborel. P x} \ sets lborel" + by simp + +lemma lborelD[measurable (raw)]: "A \ sets borel \ A \ sets lborel" + by simp lemma emeasure_bounded_finite: assumes "bounded A" shows "emeasure lborel A < \" proof - - from bounded_subset_cbox[OF \bounded A\] obtain a b where "A \ cbox a b" - by auto + obtain a b where "A \ cbox a b" + by (meson bounded_subset_cbox_symmetric \bounded A\) then have "emeasure lborel A \ emeasure lborel (cbox a b)" by (intro emeasure_mono) auto then show ?thesis diff -r 5f3cffe16311 -r 2f161c6910f7 src/HOL/Analysis/Ordered_Euclidean_Space.thy --- a/src/HOL/Analysis/Ordered_Euclidean_Space.thy Sun May 06 23:59:14 2018 +0100 +++ b/src/HOL/Analysis/Ordered_Euclidean_Space.thy Tue May 08 10:32:07 2018 +0100 @@ -267,7 +267,7 @@ and bdd_below_box[intro, simp]: "bdd_below (box a b)" unfolding atomize_conj by (metis bdd_above_Icc bdd_above_mono bdd_below_Icc bdd_below_mono bounded_box - bounded_subset_cbox interval_cbox) + bounded_subset_cbox_symmetric interval_cbox) instantiation vec :: (ordered_euclidean_space, finite) ordered_euclidean_space begin diff -r 5f3cffe16311 -r 2f161c6910f7 src/HOL/Analysis/Path_Connected.thy --- a/src/HOL/Analysis/Path_Connected.thy Sun May 06 23:59:14 2018 +0100 +++ b/src/HOL/Analysis/Path_Connected.thy Tue May 08 10:32:07 2018 +0100 @@ -6981,7 +6981,7 @@ shows "S = {}" proof - obtain a b where "S \ box a b" - by (meson assms bounded_subset_open_interval) + by (meson assms bounded_subset_box_symmetric) then have "a \ S" "b \ S" by auto then have "\x. a \ x \ x \ b \ x \ - S" diff -r 5f3cffe16311 -r 2f161c6910f7 src/HOL/Analysis/Tagged_Division.thy --- a/src/HOL/Analysis/Tagged_Division.thy Sun May 06 23:59:14 2018 +0100 +++ b/src/HOL/Analysis/Tagged_Division.thy Tue May 08 10:32:07 2018 +0100 @@ -685,7 +685,7 @@ lemma elementary_subset_cbox: "p division_of S \ \a b. S \ cbox a (b::'a::euclidean_space)" - by (meson elementary_bounded bounded_subset_cbox) + by (meson bounded_subset_cbox_symmetric elementary_bounded) lemma division_union_intervals_exists: fixes a b :: "'a::euclidean_space" diff -r 5f3cffe16311 -r 2f161c6910f7 src/HOL/Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Analysis/Topology_Euclidean_Space.thy Sun May 06 23:59:14 2018 +0100 +++ b/src/HOL/Analysis/Topology_Euclidean_Space.thy Tue May 08 10:32:07 2018 +0100 @@ -47,19 +47,19 @@ lemma support_on_if_subset: "support_on A (\x. if P x then a else 0) \ {x \ A. P x}" by (auto simp: support_on_def) -lemma finite_support[intro]: "finite s \ finite (support_on s f)" +lemma finite_support[intro]: "finite S \ finite (support_on S f)" unfolding support_on_def by auto (* TODO: is supp_sum really needed? TODO: Generalize to Finite_Set.fold *) definition (in comm_monoid_add) supp_sum :: "('b \ 'a) \ 'b set \ 'a" - where "supp_sum f s = (\x\support_on s f. f x)" + where "supp_sum f S = (\x\support_on S f. f x)" lemma supp_sum_empty[simp]: "supp_sum f {} = 0" unfolding supp_sum_def by auto lemma supp_sum_insert[simp]: - "finite (support_on s f) \ - supp_sum f (insert x s) = (if x \ s then supp_sum f s else f x + supp_sum f s)" + "finite (support_on S f) \ + supp_sum f (insert x S) = (if x \ S then supp_sum f S else f x + supp_sum f S)" by (simp add: supp_sum_def in_support_on insert_absorb) lemma supp_sum_divide_distrib: "supp_sum f A / (r::'a::field) = supp_sum (\n. f n / r) A" @@ -70,17 +70,36 @@ lemma image_affinity_interval: fixes c :: "'a::ordered_real_vector" - shows "((\x. m *\<^sub>R x + c) ` {a..b}) = (if {a..b}={} then {} - else if 0 <= m then {m *\<^sub>R a + c .. m *\<^sub>R b + c} + shows "((\x. m *\<^sub>R x + c) ` {a..b}) = + (if {a..b}={} then {} + else if 0 \ m then {m *\<^sub>R a + c .. m *\<^sub>R b + c} else {m *\<^sub>R b + c .. m *\<^sub>R a + c})" - apply (case_tac "m=0", force) - apply (auto simp: scaleR_left_mono) - apply (rule_tac x="inverse m *\<^sub>R (x-c)" in rev_image_eqI, auto simp: pos_le_divideR_eq le_diff_eq scaleR_left_mono_neg) - apply (metis diff_le_eq inverse_inverse_eq order.not_eq_order_implies_strict pos_le_divideR_eq positive_imp_inverse_positive) - apply (rule_tac x="inverse m *\<^sub>R (x-c)" in rev_image_eqI, auto simp: not_le neg_le_divideR_eq diff_le_eq) - using le_diff_eq scaleR_le_cancel_left_neg - apply fastforce - done + (is "?lhs = ?rhs") +proof (cases "m=0") + case True + then show ?thesis + by force +next + case False + show ?thesis + proof + show "?lhs \ ?rhs" + by (auto simp: scaleR_left_mono scaleR_left_mono_neg) + show "?rhs \ ?lhs" + proof (clarsimp, intro conjI impI subsetI) + show "\0 \ m; a \ b; x \ {m *\<^sub>R a + c..m *\<^sub>R b + c}\ + \ x \ (\x. m *\<^sub>R x + c) ` {a..b}" for x + apply (rule_tac x="inverse m *\<^sub>R (x-c)" in rev_image_eqI) + using False apply (auto simp: le_diff_eq pos_le_divideRI) + using diff_le_eq pos_le_divideR_eq by force + show "\\ 0 \ m; a \ b; x \ {m *\<^sub>R b + c..m *\<^sub>R a + c}\ + \ x \ (\x. m *\<^sub>R x + c) ` {a..b}" for x + apply (rule_tac x="inverse m *\<^sub>R (x-c)" in rev_image_eqI) + apply (auto simp: diff_le_eq neg_le_divideR_eq) + using diff_eq_diff_less_eq linordered_field_class.sign_simps(11) minus_diff_eq not_less scaleR_le_cancel_left_neg by fastforce + qed + qed +qed lemma countable_PiE: "finite I \ (\i. i \ I \ countable (F i)) \ countable (Pi\<^sub>E I F)" @@ -286,78 +305,83 @@ end lemma (in first_countable_topology) first_countable_basisE: - obtains A where "countable A" "\a. a \ A \ x \ a" "\a. a \ A \ open a" - "\S. open S \ x \ S \ (\a\A. a \ S)" - using first_countable_basis[of x] - apply atomize_elim - apply (elim exE) - apply (rule_tac x="range A" in exI, auto) - done + fixes x :: 'a + obtains \ where "countable \" "\A. A \ \ \ x \ A" "\A. A \ \ \ open A" + "\S. open S \ x \ S \ (\A\\. A \ S)" +proof - + obtain \ where \: "(\i::nat. x \ \ i \ open (\ i))" "(\S. open S \ x \ S \ (\i. \ i \ S))" + using first_countable_basis[of x] by metis + show thesis + proof + show "countable (range \)" + by simp + qed (use \ in auto) +qed lemma (in first_countable_topology) first_countable_basis_Int_stableE: - obtains A where "countable A" "\a. a \ A \ x \ a" "\a. a \ A \ open a" - "\S. open S \ x \ S \ (\a\A. a \ S)" - "\a b. a \ A \ b \ A \ a \ b \ A" + obtains \ where "countable \" "\A. A \ \ \ x \ A" "\A. A \ \ \ open A" + "\S. open S \ x \ S \ (\A\\. A \ S)" + "\A B. A \ \ \ B \ \ \ A \ B \ \" proof atomize_elim - obtain A' where A': - "countable A'" - "\a. a \ A' \ x \ a" - "\a. a \ A' \ open a" - "\S. open S \ x \ S \ \a\A'. a \ S" + obtain \ where \: + "countable \" + "\B. B \ \ \ x \ B" + "\B. B \ \ \ open B" + "\S. open S \ x \ S \ \B\\. B \ S" by (rule first_countable_basisE) blast - define A where [abs_def]: - "A = (\N. \((\n. from_nat_into A' n) ` N)) ` (Collect finite::nat set set)" - then show "\A. countable A \ (\a. a \ A \ x \ a) \ (\a. a \ A \ open a) \ - (\S. open S \ x \ S \ (\a\A. a \ S)) \ (\a b. a \ A \ b \ A \ a \ b \ A)" - proof (safe intro!: exI[where x=A]) - show "countable A" - unfolding A_def by (intro countable_image countable_Collect_finite) - fix a - assume "a \ A" - then show "x \ a" "open a" - using A'(4)[OF open_UNIV] by (auto simp: A_def intro: A' from_nat_into) + define \ where [abs_def]: + "\ = (\N. \((\n. from_nat_into \ n) ` N)) ` (Collect finite::nat set set)" + then show "\\. countable \ \ (\A. A \ \ \ x \ A) \ (\A. A \ \ \ open A) \ + (\S. open S \ x \ S \ (\A\\. A \ S)) \ (\A B. A \ \ \ B \ \ \ A \ B \ \)" + proof (safe intro!: exI[where x=\]) + show "countable \" + unfolding \_def by (intro countable_image countable_Collect_finite) + fix A + assume "A \ \" + then show "x \ A" "open A" + using \(4)[OF open_UNIV] by (auto simp: \_def intro: \ from_nat_into) next - let ?int = "\N. \(from_nat_into A' ` N)" - fix a b - assume "a \ A" "b \ A" - then obtain N M where "a = ?int N" "b = ?int M" "finite (N \ M)" - by (auto simp: A_def) - then show "a \ b \ A" - by (auto simp: A_def intro!: image_eqI[where x="N \ M"]) + let ?int = "\N. \(from_nat_into \ ` N)" + fix A B + assume "A \ \" "B \ \" + then obtain N M where "A = ?int N" "B = ?int M" "finite (N \ M)" + by (auto simp: \_def) + then show "A \ B \ \" + by (auto simp: \_def intro!: image_eqI[where x="N \ M"]) next fix S assume "open S" "x \ S" - then obtain a where a: "a\A'" "a \ S" using A' by blast - then show "\a\A. a \ S" using a A' - by (intro bexI[where x=a]) (auto simp: A_def intro: image_eqI[where x="{to_nat_on A' a}"]) + then obtain a where a: "a\\" "a \ S" using \ by blast + then show "\a\\. a \ S" using a \ + by (intro bexI[where x=a]) (auto simp: \_def intro: image_eqI[where x="{to_nat_on \ a}"]) qed qed lemma (in topological_space) first_countableI: - assumes "countable A" - and 1: "\a. a \ A \ x \ a" "\a. a \ A \ open a" - and 2: "\S. open S \ x \ S \ \a\A. a \ S" - shows "\A::nat \ 'a set. (\i. x \ A i \ open (A i)) \ (\S. open S \ x \ S \ (\i. A i \ S))" -proof (safe intro!: exI[of _ "from_nat_into A"]) + assumes "countable \" + and 1: "\A. A \ \ \ x \ A" "\A. A \ \ \ open A" + and 2: "\S. open S \ x \ S \ \A\\. A \ S" + shows "\\::nat \ 'a set. (\i. x \ \ i \ open (\ i)) \ (\S. open S \ x \ S \ (\i. \ i \ S))" +proof (safe intro!: exI[of _ "from_nat_into \"]) fix i - have "A \ {}" using 2[of UNIV] by auto - show "x \ from_nat_into A i" "open (from_nat_into A i)" - using range_from_nat_into_subset[OF \A \ {}\] 1 by auto + have "\ \ {}" using 2[of UNIV] by auto + show "x \ from_nat_into \ i" "open (from_nat_into \ i)" + using range_from_nat_into_subset[OF \\ \ {}\] 1 by auto next fix S assume "open S" "x\S" from 2[OF this] - show "\i. from_nat_into A i \ S" - using subset_range_from_nat_into[OF \countable A\] by auto + show "\i. from_nat_into \ i \ S" + using subset_range_from_nat_into[OF \countable \\] by auto qed instance prod :: (first_countable_topology, first_countable_topology) first_countable_topology proof fix x :: "'a \ 'b" - obtain A where A: - "countable A" - "\a. a \ A \ fst x \ a" - "\a. a \ A \ open a" - "\S. open S \ fst x \ S \ \a\A. a \ S" + obtain \ where \: + "countable \" + "\a. a \ \ \ fst x \ a" + "\a. a \ \ \ open a" + "\S. open S \ fst x \ S \ \a\\. a \ S" by (rule first_countable_basisE[of "fst x"]) blast obtain B where B: "countable B" @@ -365,27 +389,28 @@ "\a. a \ B \ open a" "\S. open S \ snd x \ S \ \a\B. a \ S" by (rule first_countable_basisE[of "snd x"]) blast - show "\A::nat \ ('a \ 'b) set. - (\i. x \ A i \ open (A i)) \ (\S. open S \ x \ S \ (\i. A i \ S))" - proof (rule first_countableI[of "(\(a, b). a \ b) ` (A \ B)"], safe) + show "\\::nat \ ('a \ 'b) set. + (\i. x \ \ i \ open (\ i)) \ (\S. open S \ x \ S \ (\i. \ i \ S))" + proof (rule first_countableI[of "(\(a, b). a \ b) ` (\ \ B)"], safe) fix a b - assume x: "a \ A" "b \ B" - with A(2, 3)[of a] B(2, 3)[of b] show "x \ a \ b" and "open (a \ b)" - unfolding mem_Times_iff - by (auto intro: open_Times) + assume x: "a \ \" "b \ B" + show "x \ a \ b" + by (simp add: \(2) B(2) mem_Times_iff x) + show "open (a \ b)" + by (simp add: \(3) B(3) open_Times x) next fix S assume "open S" "x \ S" then obtain a' b' where a'b': "open a'" "open b'" "x \ a' \ b'" "a' \ b' \ S" by (rule open_prod_elim) moreover - from a'b' A(4)[of a'] B(4)[of b'] - obtain a b where "a \ A" "a \ a'" "b \ B" "b \ b'" + from a'b' \(4)[of a'] B(4)[of b'] + obtain a b where "a \ \" "a \ a'" "b \ B" "b \ b'" by auto ultimately - show "\a\(\(a, b). a \ b) ` (A \ B). a \ S" + show "\a\(\(a, b). a \ b) ` (\ \ B). a \ S" by (auto intro!: bexI[of _ "a \ b"] bexI[of _ a] bexI[of _ b]) - qed (simp add: A B) + qed (simp add: \ B) qed class second_countable_topology = topological_space + @@ -962,61 +987,60 @@ qed lemma connected_openin: - "connected s \ - ~(\e1 e2. openin (subtopology euclidean s) e1 \ - openin (subtopology euclidean s) e2 \ - s \ e1 \ e2 \ e1 \ e2 = {} \ e1 \ {} \ e2 \ {})" + "connected S \ + ~(\E1 E2. openin (subtopology euclidean S) E1 \ + openin (subtopology euclidean S) E2 \ + S \ E1 \ E2 \ E1 \ E2 = {} \ E1 \ {} \ E2 \ {})" apply (simp add: connected_def openin_open disjoint_iff_not_equal, safe) apply (simp_all, blast+) (* SLOW *) done lemma connected_openin_eq: - "connected s \ - ~(\e1 e2. openin (subtopology euclidean s) e1 \ - openin (subtopology euclidean s) e2 \ - e1 \ e2 = s \ e1 \ e2 = {} \ - e1 \ {} \ e2 \ {})" + "connected S \ + ~(\E1 E2. openin (subtopology euclidean S) E1 \ + openin (subtopology euclidean S) E2 \ + E1 \ E2 = S \ E1 \ E2 = {} \ + E1 \ {} \ E2 \ {})" apply (simp add: connected_openin, safe, blast) by (metis Int_lower1 Un_subset_iff openin_open subset_antisym) lemma connected_closedin: - "connected s \ - ~(\e1 e2. - closedin (subtopology euclidean s) e1 \ - closedin (subtopology euclidean s) e2 \ - s \ e1 \ e2 \ e1 \ e2 = {} \ - e1 \ {} \ e2 \ {})" -proof - - { fix A B x x' - assume s_sub: "s \ A \ B" - and disj: "A \ B \ s = {}" - and x: "x \ s" "x \ B" and x': "x' \ s" "x' \ A" - and cl: "closed A" "closed B" - assume "\e1. (\T. closed T \ e1 \ s \ T) \ (\e2. e1 \ e2 = {} \ s \ e1 \ e2 \ (\T. closed T \ e2 \ s \ T) \ e1 = {} \ e2 = {})" - then have "\C D. s \ C = {} \ s \ D = {} \ s \ (C \ (s \ D)) \ {} \ \ s \ s \ (C \ D) \ \ closed C \ \ closed D" - by (metis (no_types) Int_Un_distrib Int_assoc) - moreover have "s \ (A \ B) = {}" "s \ (A \ B) = s" "s \ B \ {}" - using disj s_sub x by blast+ - ultimately have "s \ A = {}" - using cl by (metis inf.left_commute inf_bot_right order_refl) - then have False - using x' by blast - } note * = this - show ?thesis - apply (simp add: connected_closed closedin_closed) - apply (safe; simp) - apply blast - apply (blast intro: *) - done + "connected S \ + (\E1 E2. + closedin (subtopology euclidean S) E1 \ + closedin (subtopology euclidean S) E2 \ + S \ E1 \ E2 \ E1 \ E2 = {} \ E1 \ {} \ E2 \ {})" + (is "?lhs = ?rhs") +proof + assume ?lhs + then show ?rhs + by (auto simp add: connected_closed closedin_closed) +next + assume R: ?rhs + then show ?lhs + proof (clarsimp simp add: connected_closed closedin_closed) + fix A B + assume s_sub: "S \ A \ B" "B \ S \ {}" + and disj: "A \ B \ S = {}" + and cl: "closed A" "closed B" + have "S \ (A \ B) = S" + using s_sub(1) by auto + have "S - A = B \ S" + using Diff_subset_conv Un_Diff_Int disj s_sub(1) by auto + then have "S \ A = {}" + by (metis Diff_Diff_Int Diff_disjoint Un_Diff_Int R cl closedin_closed_Int inf_commute order_refl s_sub(2)) + then show "A \ S = {}" + by blast + qed qed lemma connected_closedin_eq: - "connected s \ - ~(\e1 e2. - closedin (subtopology euclidean s) e1 \ - closedin (subtopology euclidean s) e2 \ - e1 \ e2 = s \ e1 \ e2 = {} \ - e1 \ {} \ e2 \ {})" + "connected S \ + ~(\E1 E2. + closedin (subtopology euclidean S) E1 \ + closedin (subtopology euclidean S) E2 \ + E1 \ E2 = S \ E1 \ E2 = {} \ + E1 \ {} \ E2 \ {})" apply (simp add: connected_closedin, safe, blast) by (metis Int_lower1 Un_subset_iff closedin_closed subset_antisym) @@ -1662,100 +1686,48 @@ and "box c d \ cbox a b \ (\i\Basis. c\i < d\i) \ (\i\Basis. a\i \ c\i \ d\i \ b\i)" (is ?th3) and "box c d \ box a b \ (\i\Basis. c\i < d\i) \ (\i\Basis. a\i \ c\i \ d\i \ b\i)" (is ?th4) proof - - show ?th1 - unfolding subset_eq and Ball_def and mem_box - by (auto intro: order_trans) - show ?th2 - unfolding subset_eq and Ball_def and mem_box - by (auto intro: le_less_trans less_le_trans order_trans less_imp_le) - { - assume as: "box c d \ cbox a b" "\i\Basis. c\i < d\i" - then have "box c d \ {}" - unfolding box_eq_empty by auto - fix i :: 'a - assume i: "i \ Basis" - (** TODO combine the following two parts as done in the HOL_light version. **) - { - let ?x = "(\j\Basis. (if j=i then ((min (a\j) (d\j))+c\j)/2 else (c\j+d\j)/2) *\<^sub>R j)::'a" - assume as2: "a\i > c\i" - { - fix j :: 'a - assume j: "j \ Basis" - then have "c \ j < ?x \ j \ ?x \ j < d \ j" - apply (cases "j = i") - using as(2)[THEN bspec[where x=j]] i - apply (auto simp: as2) - done - } - then have "?x\box c d" - using i unfolding mem_box by auto - moreover - have "?x \ cbox a b" - unfolding mem_box - apply auto - apply (rule_tac x=i in bexI) - using as(2)[THEN bspec[where x=i]] and as2 i - apply auto - done - ultimately have False using as by auto + let ?lesscd = "\i\Basis. c\i < d\i" + let ?lerhs = "\i\Basis. a\i \ c\i \ d\i \ b\i" + show ?th1 ?th2 + by (fastforce simp: mem_box)+ + have acdb: "a\i \ c\i \ d\i \ b\i" + if i: "i \ Basis" and box: "box c d \ cbox a b" and cd: "\i. i \ Basis \ c\i < d\i" for i + proof - + have "box c d \ {}" + using that + unfolding box_eq_empty by force + { let ?x = "(\j\Basis. (if j=i then ((min (a\j) (d\j))+c\j)/2 else (c\j+d\j)/2) *\<^sub>R j)::'a" + assume *: "a\i > c\i" + then have "c \ j < ?x \ j \ ?x \ j < d \ j" if "j \ Basis" for j + using cd that by (fastforce simp add: i *) + then have "?x \ box c d" + unfolding mem_box by auto + moreover have "?x \ cbox a b" + using i cd * by (force simp: mem_box) + ultimately have False using box by auto } - then have "a\i \ c\i" by (rule ccontr) auto + then have "a\i \ c\i" by force moreover - { - let ?x = "(\j\Basis. (if j=i then ((max (b\j) (c\j))+d\j)/2 else (c\j+d\j)/2) *\<^sub>R j)::'a" - assume as2: "b\i < d\i" - { - fix j :: 'a - assume "j\Basis" - then have "d \ j > ?x \ j \ ?x \ j > c \ j" - apply (cases "j = i") - using as(2)[THEN bspec[where x=j]] - apply (auto simp: as2) - done - } - then have "?x\box c d" + { let ?x = "(\j\Basis. (if j=i then ((max (b\j) (c\j))+d\j)/2 else (c\j+d\j)/2) *\<^sub>R j)::'a" + assume *: "b\i < d\i" + then have "d \ j > ?x \ j \ ?x \ j > c \ j" if "j \ Basis" for j + using cd that by (fastforce simp add: i *) + then have "?x \ box c d" unfolding mem_box by auto - moreover - have "?x\cbox a b" - unfolding mem_box - apply auto - apply (rule_tac x=i in bexI) - using as(2)[THEN bspec[where x=i]] and as2 using i - apply auto - done - ultimately have False using as by auto + moreover have "?x \ cbox a b" + using i cd * by (force simp: mem_box) + ultimately have False using box by auto } then have "b\i \ d\i" by (rule ccontr) auto - ultimately - have "a\i \ c\i \ d\i \ b\i" by auto - } note part1 = this + ultimately show ?thesis by auto + qed show ?th3 - unfolding subset_eq and Ball_def and mem_box - apply (rule, rule, rule, rule) - apply (rule part1) - unfolding subset_eq and Ball_def and mem_box - prefer 4 - apply auto - apply (erule_tac x=xa in allE, erule_tac x=xa in allE, fastforce)+ - done - { - assume as: "box c d \ box a b" "\i\Basis. c\i < d\i" - fix i :: 'a - assume i:"i\Basis" - from as(1) have "box c d \ cbox a b" - using box_subset_cbox[of a b] by auto - then have "a\i \ c\i \ d\i \ b\i" - using part1 and as(2) using i by auto - } note * = this + using acdb by (fastforce simp add: mem_box) + have acdb': "a\i \ c\i \ d\i \ b\i" + if "i \ Basis" "box c d \ box a b" "\i. i \ Basis \ c\i < d\i" for i + using box_subset_cbox[of a b] that acdb by auto show ?th4 - unfolding subset_eq and Ball_def and mem_box - apply (rule, rule, rule, rule) - apply (rule *) - unfolding subset_eq and Ball_def and mem_box - prefer 4 - apply auto - apply (erule_tac x=xa in allE, simp)+ - done + using acdb' by (fastforce simp add: mem_box) qed lemma eq_cbox: "cbox a b = cbox c d \ cbox a b = {} \ cbox c d = {} \ a = c \ b = d" @@ -1775,19 +1747,14 @@ lemma eq_cbox_box [simp]: "cbox a b = box c d \ cbox a b = {} \ box c d = {}" (is "?lhs \ ?rhs") proof - assume ?lhs - then have "cbox a b \ box c d" "box c d \cbox a b" + assume L: ?lhs + then have "cbox a b \ box c d" "box c d \ cbox a b" by auto then show ?rhs apply (simp add: subset_box) - using \cbox a b = box c d\ box_ne_empty box_sing - apply (fastforce simp add:) + using L box_ne_empty box_sing apply (fastforce simp add:) done -next - assume ?rhs - then show ?lhs - by force -qed +qed force lemma eq_box_cbox [simp]: "box a b = cbox c d \ box a b = {} \ cbox c d = {}" by (metis eq_cbox_box) @@ -1795,20 +1762,16 @@ lemma eq_box: "box a b = box c d \ box a b = {} \ box c d = {} \ a = c \ b = d" (is "?lhs \ ?rhs") proof - assume ?lhs + assume L: ?lhs then have "box a b \ box c d" "box c d \ box a b" by auto then show ?rhs apply (simp add: subset_box) - using box_ne_empty(2) \box a b = box c d\ + using box_ne_empty(2) L apply auto apply (meson euclidean_eqI less_eq_real_def not_less)+ done -next - assume ?rhs - then show ?lhs - by force -qed +qed force lemma subset_box_complex: "cbox a b \ cbox c d \ @@ -2140,7 +2103,7 @@ and d: "\x \ S. \y \ S. dist y x < e \ y = x" shows "closed S" proof - - have False if C: "\e>0. \x'\S. x' \ x \ dist x' x < e" for x + have False if C: "\e. e>0 \ \x'\S. x' \ x \ dist x' x < e" for x proof - from e have e2: "e/2 > 0" by arith from C[rule_format, OF e2] obtain y where y: "y \ S" "y \ x" "dist y x < e/2" @@ -2148,7 +2111,7 @@ let ?m = "min (e/2) (dist x y) " from e2 y(2) have mp: "?m > 0" by simp - from C[rule_format, OF mp] obtain z where z: "z \ S" "z \ x" "dist z x < ?m" + from C[OF mp] obtain z where z: "z \ S" "z \ x" "dist z x < ?m" by blast from z y have "dist z y < e" by (intro dist_triangle_lt [where z=x]) simp @@ -2991,9 +2954,9 @@ assume "m < n" have "dist (f(Suc n)) x = dist (y (min (inverse(2 ^ (Suc n))) (dist (f n) x))) x" by simp - also have "... < dist (f n) x" + also have "\ < dist (f n) x" by (metis dist_pos_lt f min.strict_order_iff min_less_iff_conj y) - also have "... < dist (f m) x" + also have "\ < dist (f m) x" using Suc.IH \m < n\ by blast finally show ?thesis . next @@ -3127,9 +3090,9 @@ proof - have "\f x\ * norm (g x) \ \f x\ * B" by (simp add: mult_left_mono g) - also have "... \ \f x\ * (\B\ + 1)" + also have "\ \ \f x\ * (\B\ + 1)" by (simp add: mult_left_mono) - also have "... < \" + also have "\ < \" by (rule f) finally show ?thesis . qed @@ -3290,7 +3253,7 @@ lemma closure_approachableD: assumes "x \ closure S" "e>0" shows "\y\S. dist x y < e" - using assms unfolding closure_approachable by (auto simp add: dist_commute) + using assms unfolding closure_approachable by (auto simp: dist_commute) lemma closed_approachable: fixes S :: "'a::metric_space set" @@ -5262,9 +5225,9 @@ shows "((\n. f (x n)) \ f a) F" proof - have *: "filterlim x (inf (nhds a) (principal s)) F" - using assms(2) assms(3) unfolding at_within_def filterlim_inf by (auto simp add: filterlim_principal eventually_mono) + using assms(2) assms(3) unfolding at_within_def filterlim_inf by (auto simp: filterlim_principal eventually_mono) show ?thesis - by (auto simp add: assms(1) continuous_within[symmetric] tendsto_at_within_iff_tendsto_nhds[symmetric] intro!: filterlim_compose[OF _ *]) + by (auto simp: assms(1) continuous_within[symmetric] tendsto_at_within_iff_tendsto_nhds[symmetric] intro!: filterlim_compose[OF _ *]) qed lemma continuous_within_tendsto_compose': @@ -5402,7 +5365,7 @@ lemma continuous_closed_imp_Cauchy_continuous: fixes S :: "('a::complete_space) set" - shows "\continuous_on S f; closed S; Cauchy \; \n. (\ n) \ S\ \ Cauchy(f o \)" + shows "\continuous_on S f; closed S; Cauchy \; \n. (\ n) \ S\ \ Cauchy(f \ \)" apply (simp add: complete_eq_closed [symmetric] continuous_on_sequentially) by (meson LIMSEQ_imp_Cauchy complete_def) @@ -5876,30 +5839,20 @@ let ?b = "\i\Basis. \a\i\ + \b\i\" { fix x :: "'a" - assume x: "\i\Basis. a \ i \ x \ i \ x \ i \ b \ i" - { - fix i :: 'a - assume "i \ Basis" - then have "\x\i\ \ \a\i\ + \b\i\" - using x[THEN bspec[where x=i]] by auto - } + assume "\i. i\Basis \ a \ i \ x \ i \ x \ i \ b \ i" then have "(\i\Basis. \x \ i\) \ ?b" - apply - - apply (rule sum_mono, auto) - done + by (force simp: intro!: sum_mono) then have "norm x \ ?b" using norm_le_l1[of x] by auto } then show ?thesis - unfolding cbox_def bounded_iff by auto + unfolding cbox_def bounded_iff by force qed lemma bounded_box [simp]: fixes a :: "'a::euclidean_space" shows "bounded (box a b)" - using bounded_cbox[of a b] - using box_subset_cbox[of a b] - using bounded_subset[of "cbox a b" "box a b"] + using bounded_cbox[of a b] box_subset_cbox[of a b] bounded_subset[of "cbox a b" "box a b"] by simp lemma not_interval_UNIV [simp]: @@ -5923,12 +5876,8 @@ assumes "box a b \ {}" shows "((1/2) *\<^sub>R (a + b)) \ box a b" proof - - { - fix i :: 'a - assume "i \ Basis" - then have "a \ i < ((1 / 2) *\<^sub>R (a + b)) \ i \ ((1 / 2) *\<^sub>R (a + b)) \ i < b \ i" - using assms[unfolded box_ne_empty, THEN bspec[where x=i]] by (auto simp: inner_add_left) - } + have "a \ i < ((1 / 2) *\<^sub>R (a + b)) \ i \ ((1 / 2) *\<^sub>R (a + b)) \ i < b \ i" if "i \ Basis" for i + using assms that by (auto simp: inner_add_left box_ne_empty) then show ?thesis unfolding mem_box by auto qed @@ -5945,14 +5894,12 @@ have "a \ i = e * (a \ i) + (1 - e) * (a \ i)" unfolding left_diff_distrib by simp also have "\ < e * (x \ i) + (1 - e) * (y \ i)" - apply (rule add_less_le_mono) - using e unfolding mult_less_cancel_left and mult_le_cancel_left - apply simp_all - using x unfolding mem_box using i - apply simp - using y unfolding mem_box using i - apply simp - done + proof (rule add_less_le_mono) + show "e * (a \ i) < e * (x \ i)" + using \0 < e\ i mem_box(1) x by auto + show "(1 - e) * (a \ i) \ (1 - e) * (y \ i)" + by (meson diff_ge_0_iff_ge \e \ 1\ i mem_box(2) mult_left_mono y) + qed finally have "a \ i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \ i" unfolding inner_simps by auto moreover @@ -5962,9 +5909,9 @@ also have "\ > e * (x \ i) + (1 - e) * (y \ i)" proof (rule add_less_le_mono) show "e * (x \ i) < e * (b \ i)" - using e(1) i mem_box(1) x by auto + using \0 < e\ i mem_box(1) x by auto show "(1 - e) * (y \ i) \ (1 - e) * (b \ i)" - by (meson diff_ge_0_iff_ge e(2) i mem_box(2) ordered_comm_semiring_class.comm_mult_left_mono y) + by (meson diff_ge_0_iff_ge \e \ 1\ i mem_box(2) mult_left_mono y) qed finally have "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \ i < b \ i" unfolding inner_simps by auto @@ -6011,13 +5958,8 @@ { fix e :: real assume "e > 0" - then have "\N::nat. inverse (real (N + 1)) < e" - using real_arch_inverse[of e] - apply (auto simp: Suc_pred') - apply (metis Suc_pred' of_nat_Suc) - done then obtain N :: nat where N: "inverse (real (N + 1)) < e" - by auto + using reals_Archimedean by auto have "inverse (real n + 1) < e" if "N \ n" for n by (auto intro!: that le_less_trans [OF _ N]) then have "\N::nat. \n\N. inverse (real n + 1) < e" by auto @@ -6031,9 +5973,8 @@ by auto } ultimately have "x \ closure (box a b)" - using as and box_midpoint[OF assms] - unfolding closure_def - unfolding islimpt_sequential + using as box_midpoint[OF assms] + unfolding closure_def islimpt_sequential by (cases "x=?c") (auto simp: in_box_eucl_less) } then show ?thesis @@ -6041,49 +5982,31 @@ qed lemma bounded_subset_box_symmetric: - fixes s::"('a::euclidean_space) set" - assumes "bounded s" - shows "\a. s \ box (-a) a" + fixes S :: "('a::euclidean_space) set" + assumes "bounded S" + obtains a where "S \ box (-a) a" proof - - obtain b where "b>0" and b: "\x\s. norm x \ b" + obtain b where "b>0" and b: "\x\S. norm x \ b" using assms[unfolded bounded_pos] by auto define a :: 'a where "a = (\i\Basis. (b + 1) *\<^sub>R i)" - { - fix x - assume "x \ s" - fix i :: 'a - assume i: "i \ Basis" - then have "(-a)\i < x\i" and "x\i < a\i" - using b[THEN bspec[where x=x], OF \x\s\] - using Basis_le_norm[OF i, of x] - unfolding inner_simps and a_def - by auto - } - then show ?thesis - by (auto intro: exI[where x=a] simp add: box_def) + have "(-a)\i < x\i" and "x\i < a\i" if "x \ S" and i: "i \ Basis" for x i + using b Basis_le_norm[OF i, of x] that by (auto simp: a_def) + then have "S \ box (-a) a" + by (auto simp: simp add: box_def) + then show ?thesis .. qed -lemma bounded_subset_open_interval: - fixes s :: "('a::euclidean_space) set" - shows "bounded s \ (\a b. s \ box a b)" - by (auto dest!: bounded_subset_box_symmetric) - lemma bounded_subset_cbox_symmetric: - fixes s :: "('a::euclidean_space) set" - assumes "bounded s" - shows "\a. s \ cbox (-a) a" + fixes S :: "('a::euclidean_space) set" + assumes "bounded S" + obtains a where "S \ cbox (-a) a" proof - - obtain a where "s \ box (-a) a" + obtain a where "S \ box (-a) a" using bounded_subset_box_symmetric[OF assms] by auto then show ?thesis - using box_subset_cbox[of "-a" a] by auto + by (meson box_subset_cbox dual_order.trans that) qed -lemma bounded_subset_cbox: - fixes s :: "('a::euclidean_space) set" - shows "bounded s \ \a b. s \ cbox a b" - using bounded_subset_cbox_symmetric[of s] by auto - lemma frontier_cbox: fixes a b :: "'a::euclidean_space" shows "frontier (cbox a b) = cbox a b - box a b" @@ -6113,13 +6036,12 @@ lemma eucl_less_eq_halfspaces: fixes a :: "'a::euclidean_space" shows "{x. x i\Basis. {x. x \ i < a \ i})" - "{x. a i\Basis. {x. a \ i < x \ i})" + "{x. a i\Basis. {x. a \ i < x \ i})" by (auto simp: eucl_less_def) lemma open_Collect_eucl_less[simp, intro]: fixes a :: "'a::euclidean_space" - shows "open {x. x