# HG changeset patch # User wenzelm # Date 1378238663 -7200 # Node ID 355a4cac5440109da1c60ba081f7a94027c3efc4 # Parent 08f3491c50bf3b5987d5329a425cc7632098d674 tuned proofs -- less guessing; diff -r 08f3491c50bf -r 355a4cac5440 src/HOL/Deriv.thy --- a/src/HOL/Deriv.thy Tue Sep 03 19:58:00 2013 +0200 +++ b/src/HOL/Deriv.thy Tue Sep 03 22:04:23 2013 +0200 @@ -1319,7 +1319,8 @@ and fd: "\x. a < x \ x < b \ f differentiable x" and gc: "\x. a \ x \ x \ b \ isCont g x" and gd: "\x. a < x \ x < b \ g differentiable x" - shows "\g'c f'c c. DERIV g c :> g'c \ DERIV f c :> f'c \ a < c \ c < b \ ((f b - f a) * g'c) = ((g b - g a) * f'c)" + shows "\g'c f'c c. + DERIV g c :> g'c \ DERIV f c :> f'c \ a < c \ c < b \ ((f b - f a) * g'c) = ((g b - g a) * f'c)" proof - let ?h = "\x. (f b - f a)*(g x) - (g b - g a)*(f x)" from assms have "a < b" by simp @@ -1466,7 +1467,7 @@ ultimately show "\y. 0 < y \ y < x \ f x / g x = f' y / g' y" using `f 0 = 0` `g 0 = 0` by (auto intro!: exI[of _ c]) qed - then guess \ .. + then obtain \ where "\x\{0 <..< a}. 0 < \ x \ \ x < x \ f x / g x = f' (\ x) / g' (\ x)" .. then have \: "eventually (\x. 0 < \ x \ \ x < x \ f x / g x = f' (\ x) / g' (\ x)) (at_right 0)" unfolding eventually_at by (intro exI[of _ a]) (auto simp: dist_real_def) moreover @@ -1582,9 +1583,10 @@ have "\y. t < y \ y < a \ (g a - g t) * f' y = (f a - f t) * g' y" using f0 g0 t(1,2) by (intro GMVT') (force intro!: DERIV_isCont)+ - then guess y .. - from this - have [arith]: "t < y" "y < a" and D_eq: "(f t - f a) / (g t - g a) = f' y / g' y" + then obtain y where [arith]: "t < y" "y < a" + and D_eq0: "(g a - g t) * f' y = (f a - f t) * g' y" + by blast + from D_eq0 have D_eq: "(f t - f a) / (g t - g a) = f' y / g' y" using `g a < g t` g'_neq_0[of y] by (auto simp add: field_simps) have *: "f t / g t - x = ((f t - f a) / (g t - g a) - x) * (1 - g a / g t) + (f a - x * g a) / g t" diff -r 08f3491c50bf -r 355a4cac5440 src/HOL/Library/Countable_Set.thy --- a/src/HOL/Library/Countable_Set.thy Tue Sep 03 19:58:00 2013 +0200 +++ b/src/HOL/Library/Countable_Set.thy Tue Sep 03 22:04:23 2013 +0200 @@ -55,7 +55,8 @@ assumes "countable S" "infinite S" obtains e :: "'a \ nat" where "bij_betw e S UNIV" proof - - from `countable S`[THEN countableE] guess f . + obtain f :: "'a \ nat" where "inj_on f S" + using `countable S` by (rule countableE) then have "bij_betw f S (f`S)" unfolding bij_betw_def by simp moreover @@ -169,9 +170,12 @@ "countable I \ (\i. i \ I \ countable (A i)) \ countable (SIGMA i : I. A i)" by (intro countableI'[of "\(i, a). (to_nat_on I i, to_nat_on (A i) a)"]) (auto simp: inj_on_def) -lemma countable_image[intro, simp]: assumes A: "countable A" shows "countable (f`A)" +lemma countable_image[intro, simp]: + assumes "countable A" + shows "countable (f`A)" proof - - from A guess g by (rule countableE) + obtain g :: "'a \ nat" where "inj_on g A" + using assms by (rule countableE) moreover have "inj_on (inv_into A f) (f`A)" "inv_into A f ` f ` A \ A" by (auto intro: inj_on_inv_into inv_into_into) ultimately show ?thesis diff -r 08f3491c50bf -r 355a4cac5440 src/HOL/Library/Extended_Real.thy --- a/src/HOL/Library/Extended_Real.thy Tue Sep 03 19:58:00 2013 +0200 +++ b/src/HOL/Library/Extended_Real.thy Tue Sep 03 22:04:23 2013 +0200 @@ -1368,7 +1368,8 @@ next case (real r) with less_PInf_Ex_of_nat[of x] obtain n :: nat where "x < ereal (real n)" by auto - moreover from assms[of n] guess i .. + moreover obtain i where "i \ A" "ereal (real n) \ f i" + using assms .. ultimately show ?thesis by (auto intro!: bexI[of _ i]) qed @@ -1383,11 +1384,12 @@ proof fix n ::nat have "\x\A. Sup A - 1 / ereal (real n) < x" using assms real by (intro Sup_ereal_close) (auto simp: one_ereal_def) - then guess x .. + then obtain x where "x \ A" "Sup A - 1 / ereal (real n) < x" .. then show "\x. x \ A \ Sup A < x + 1 / ereal (real n)" by (auto intro!: exI[of _ x] simp: ereal_minus_less_iff) qed - from choice[OF this] guess f .. note f = this + from choice[OF this] obtain f :: "nat \ ereal" + where f: "\x. f x \ A \ Sup A < f x + 1 / ereal (real x)" .. have "SUPR UNIV f = Sup A" proof (rule SUP_eqI) fix i show "f i \ Sup A" using f @@ -1433,10 +1435,12 @@ then show False using `x \ A` `\ \ A` PInf by(cases x) auto qed - from choice[OF this] guess f .. note f = this + from choice[OF this] obtain f :: "nat \ ereal" + where f: "\z. f z \ A \ x + ereal (real z) \ f z" .. have "SUPR UNIV f = \" proof (rule SUP_PInfty) - fix n :: nat show "\i\UNIV. ereal (real n) \ f i" + fix n :: nat + show "\i\UNIV. ereal (real n) \ f i" using f[THEN spec, of n] `0 \ x` by (cases rule: ereal2_cases[of "f n" x]) (auto intro!: exI[of _ n]) qed @@ -1714,8 +1718,9 @@ fixes S :: "ereal set" assumes "open S" "x \ S" and x: "\x\ \ \" obtains a b where "a < x" "x < b" "{a <..< b} \ S" -proof- - guess e using ereal_open_cont_interval[OF assms] . +proof - + obtain e where "0 < e" "{x - e<.. S" + using assms by (rule ereal_open_cont_interval) with that[of "x-e" "x+e"] ereal_between[OF x, of e] show thesis by auto qed @@ -1762,8 +1767,9 @@ lemma tendsto_MInfty: "(f ---> -\) F \ (\r. eventually (\x. f x < ereal r) F)" unfolding tendsto_def proof safe - fix S :: "ereal set" assume "open S" "-\ \ S" - from open_MInfty[OF this] guess B .. note B = this + fix S :: "ereal set" + assume "open S" "-\ \ S" + from open_MInfty[OF this] obtain B where "{.. S" .. moreover assume "\r::real. eventually (\z. f z < r) F" then have "eventually (\z. f z \ {..< B}) F" by auto @@ -1778,7 +1784,7 @@ unfolding tendsto_PInfty eventually_sequentially proof safe fix r assume "\r. \N. \n\N. ereal r \ f n" - from this[rule_format, of "r+1"] guess N .. + then obtain N where "\n\N. ereal (r + 1) \ f n" by blast moreover have "ereal r < ereal (r + 1)" by auto ultimately show "\N. \n\N. ereal r < f n" by (blast intro: less_le_trans) @@ -1788,7 +1794,7 @@ unfolding tendsto_MInfty eventually_sequentially proof safe fix r assume "\r. \N. \n\N. f n \ ereal r" - from this[rule_format, of "r - 1"] guess N .. + then obtain N where "\n\N. f n \ ereal (r - 1)" by blast moreover have "ereal (r - 1) < ereal r" by auto ultimately show "\N. \n\N. f n < ereal r" by (blast intro: le_less_trans) diff -r 08f3491c50bf -r 355a4cac5440 src/HOL/Library/Float.thy --- a/src/HOL/Library/Float.thy Tue Sep 03 19:58:00 2013 +0200 +++ b/src/HOL/Library/Float.thy Tue Sep 03 22:04:23 2013 +0200 @@ -44,7 +44,7 @@ lemma zero_float[simp]: "0 \ float" by (auto simp: float_def) lemma one_float[simp]: "1 \ float" by (intro floatI[of 1 0]) simp -lemma numeral_float[simp]: "numeral i \ float" by (intro floatI[of "numeral i" 0]) simp +lemma numeral_float[simp]: "numeral i \ float" by (intro floatI[of "numeral i" 0]) simp lemma neg_numeral_float[simp]: "neg_numeral i \ float" by (intro floatI[of "neg_numeral i" 0]) simp lemma real_of_int_float[simp]: "real (x :: int) \ float" by (intro floatI[of x 0]) simp lemma real_of_nat_float[simp]: "real (x :: nat) \ float" by (intro floatI[of x 0]) simp @@ -175,7 +175,7 @@ lemma real_of_float_power[simp]: fixes f::float shows "real (f^n) = real f^n" by (induct n) simp_all -lemma fixes x y::float +lemma fixes x y::float shows real_of_float_min: "real (min x y) = min (real x) (real y)" and real_of_float_max: "real (max x y) = max (real x) (real y)" by (simp_all add: min_def max_def) @@ -197,7 +197,7 @@ then show "\c. a < c \ c < b" apply (intro exI[of _ "(a + b) * Float 1 -1"]) apply transfer - apply (simp add: powr_neg_numeral) + apply (simp add: powr_neg_numeral) done qed @@ -222,14 +222,14 @@ plus_float.rep_eq one_float.rep_eq plus_float numeral_float one_float) done -lemma transfer_numeral [transfer_rule]: +lemma transfer_numeral [transfer_rule]: "fun_rel (op =) pcr_float (numeral :: _ \ real) (numeral :: _ \ float)" unfolding fun_rel_def float.pcr_cr_eq cr_float_def by simp lemma float_neg_numeral[simp]: "real (neg_numeral x :: float) = neg_numeral x" by (simp add: minus_numeral[symmetric] del: minus_numeral) -lemma transfer_neg_numeral [transfer_rule]: +lemma transfer_neg_numeral [transfer_rule]: "fun_rel (op =) pcr_float (neg_numeral :: _ \ real) (neg_numeral :: _ \ float)" unfolding fun_rel_def float.pcr_cr_eq cr_float_def by simp @@ -321,7 +321,7 @@ "exponent f = snd (SOME p::int \ int. (f = 0 \ fst p = 0 \ snd p = 0) \ (f \ 0 \ real f = real (fst p) * 2 powr real (snd p) \ \ 2 dvd fst p))" -lemma +lemma shows exponent_0[simp]: "exponent (float_of 0) = 0" (is ?E) and mantissa_0[simp]: "mantissa (float_of 0) = 0" (is ?M) proof - @@ -351,7 +351,7 @@ lemma mantissa_noteq_0: "f \ float_of 0 \ mantissa f \ 0" using mantissa_not_dvd[of f] by auto -lemma +lemma fixes m e :: int defines "f \ float_of (m * 2 powr e)" assumes dvd: "\ 2 dvd m" @@ -740,19 +740,23 @@ qed lemma bitlen_Float: -fixes m e -defines "f \ Float m e" -shows "bitlen (\mantissa f\) + exponent f = (if m = 0 then 0 else bitlen \m\ + e)" -proof cases - assume "m \ 0" + fixes m e + defines "f \ Float m e" + shows "bitlen (\mantissa f\) + exponent f = (if m = 0 then 0 else bitlen \m\ + e)" +proof (cases "m = 0") + case True + then show ?thesis by (simp add: f_def bitlen_def Float_def) +next + case False hence "f \ float_of 0" unfolding real_of_float_eq by (simp add: f_def) hence "mantissa f \ 0" by (simp add: mantissa_noteq_0) moreover - from f_def[THEN denormalize_shift, OF `f \ float_of 0`] guess i . + obtain i where "m = mantissa f * 2 ^ i" "e = exponent f - int i" + by (rule f_def[THEN denormalize_shift, OF `f \ float_of 0`]) ultimately show ?thesis by (simp add: abs_mult) -qed (simp add: f_def bitlen_def Float_def) +qed lemma compute_bitlen[code]: shows "bitlen x = (if x > 0 then bitlen (x div 2) + 1 else 0)" @@ -865,9 +869,9 @@ is "\prec (x::nat) (y::nat). round_down (rat_precision prec x y) (x / y)" by simp lemma compute_lapprox_posrat[code]: - fixes prec x y - shows "lapprox_posrat prec x y = - (let + fixes prec x y + shows "lapprox_posrat prec x y = + (let l = rat_precision prec x y; d = if 0 \ l then x * 2^nat l div y else x div 2^nat (- l) div y in normfloat (Float d (- l)))" @@ -948,7 +952,7 @@ assumes "0 \ x" and "0 < y" and "2 * x < y" and "0 < n" shows "real (rapprox_posrat n x y) < 1" proof - - have powr1: "2 powr real (rat_precision n (int x) (int y)) = + have powr1: "2 powr real (rat_precision n (int x) (int y)) = 2 ^ nat (rat_precision n (int x) (int y))" using rat_precision_pos[of x y n] assms by (simp add: powr_realpow[symmetric]) have "x * 2 powr real (rat_precision n (int x) (int y)) / y = (x / y) * @@ -978,7 +982,7 @@ (if y = 0 then 0 else if 0 \ x then (if 0 < y then lapprox_posrat prec (nat x) (nat y) - else - (rapprox_posrat prec (nat x) (nat (-y)))) + else - (rapprox_posrat prec (nat x) (nat (-y)))) else (if 0 < y then - (rapprox_posrat prec (nat (-x)) (nat y)) else lapprox_posrat prec (nat (-x)) (nat (-y))))" @@ -993,7 +997,7 @@ (if y = 0 then 0 else if 0 \ x then (if 0 < y then rapprox_posrat prec (nat x) (nat y) - else - (lapprox_posrat prec (nat x) (nat (-y)))) + else - (lapprox_posrat prec (nat x) (nat (-y)))) else (if 0 < y then - (lapprox_posrat prec (nat (-x)) (nat y)) else rapprox_posrat prec (nat (-x)) (nat (-y))))" @@ -1017,7 +1021,7 @@ by (simp add: field_simps powr_divide2[symmetric]) show ?thesis - using not_0 + using not_0 by (transfer fixing: m1 s1 m2 s2 prec) (unfold eq1 eq2 round_down_shift, simp add: field_simps) qed (transfer, auto) hide_fact (open) compute_float_divl @@ -1037,7 +1041,7 @@ by (simp add: field_simps powr_divide2[symmetric]) show ?thesis - using not_0 + using not_0 by (transfer fixing: m1 s1 m2 s2 prec) (unfold eq1 eq2 round_up_shift, simp add: field_simps) qed (transfer, auto) hide_fact (open) compute_float_divr @@ -1104,7 +1108,7 @@ (simp add: powr_minus inverse_eq_divide) qed -lemma rapprox_rat_nonneg_neg: +lemma rapprox_rat_nonneg_neg: "0 \ x \ y < 0 \ real (rapprox_rat n x y) \ 0" unfolding rapprox_rat_def round_up_def by (auto simp: field_simps mult_le_0_iff zero_le_mult_iff) @@ -1157,7 +1161,7 @@ "0 < real x \ real x < 1 \ prec \ 1 \ 1 \ real (float_divl prec 1 x)" proof transfer fix prec :: nat and x :: real assume x: "0 < x" "x < 1" "x \ float" and prec: "1 \ prec" - def p \ "int prec + \log 2 \x\\" + def p \ "int prec + \log 2 \x\\" show "1 \ round_down (int prec + \log 2 \x\\ - \log 2 \1\\) (1 / x) " proof cases assume nonneg: "0 \ p" @@ -1279,12 +1283,16 @@ lemma int_floor_fl: "real (int_floor_fl x) \ real x" by transfer simp lemma floor_pos_exp: "exponent (floor_fl x) \ 0" -proof cases - assume nzero: "floor_fl x \ float_of 0" - have "floor_fl x = Float \real x\ 0" by transfer simp - from denormalize_shift[OF this[THEN eq_reflection] nzero] guess i . note i = this - thus ?thesis by simp -qed (simp add: floor_fl_def) +proof (cases "floor_fl x = float_of 0") + case True + then show ?thesis by (simp add: floor_fl_def) +next + case False + have eq: "floor_fl x = Float \real x\ 0" by transfer simp + obtain i where "\real x\ = mantissa (floor_fl x) * 2 ^ i" "0 = exponent (floor_fl x) - int i" + by (rule denormalize_shift[OF eq[THEN eq_reflection] False]) + then show ?thesis by simp +qed end diff -r 08f3491c50bf -r 355a4cac5440 src/HOL/Library/FuncSet.thy --- a/src/HOL/Library/FuncSet.thy Tue Sep 03 19:58:00 2013 +0200 +++ b/src/HOL/Library/FuncSet.thy Tue Sep 03 22:04:23 2013 +0200 @@ -375,7 +375,8 @@ proof (rule ccontr) assume "\ ?thesis" then have "\i. \y. (i \ I \ y \ F i) \ (i \ I \ y = undefined)" by auto - from choice[OF this] guess f .. + from choice[OF this] + obtain f where " \x. (x \ I \ f x \ F x) \ (x \ I \ f x = undefined)" .. then have "f \ Pi\<^sub>E I F" by (auto simp: extensional_def PiE_def) with `Pi\<^sub>E I F = {}` show False by auto qed @@ -437,8 +438,10 @@ shows "F i \ F' i" proof fix x assume "x \ F i" - with ne have "\j. \y. ((j \ I \ y \ F j \ (i = j \ x = y)) \ (j \ I \ y = undefined))" by auto - from choice[OF this] guess f .. note f = this + with ne have "\j. \y. ((j \ I \ y \ F j \ (i = j \ x = y)) \ (j \ I \ y = undefined))" + by auto + from choice[OF this] obtain f + where f: " \j. (j \ I \ f j \ F j \ (i = j \ x = f j)) \ (j \ I \ f j = undefined)" .. then have "f \ Pi\<^sub>E I F" by (auto simp: extensional_def PiE_def) then have "f \ Pi\<^sub>E I F'" using assms by simp then show "x \ F' i" using f `i \ I` by (auto simp: PiE_def) diff -r 08f3491c50bf -r 355a4cac5440 src/HOL/Library/Liminf_Limsup.thy --- a/src/HOL/Library/Liminf_Limsup.thy Tue Sep 03 19:58:00 2013 +0200 +++ b/src/HOL/Library/Liminf_Limsup.thy Tue Sep 03 22:04:23 2013 +0200 @@ -169,15 +169,15 @@ moreover { fix y P assume "y < C" and y: "\yx. y < X x) F" have "\P. eventually P F \ y < INFI (Collect P) X" - proof cases - assume "\z. y < z \ z < C" - then guess z .. note z = this + proof (cases "\z. y < z \ z < C") + case True + then obtain z where z: "y < z \ z < C" .. moreover from z have "z \ INFI {x. z < X x} X" by (auto intro!: INF_greatest) ultimately show ?thesis using y by (intro exI[of _ "\x. z < X x"]) auto next - assume "\ (\z. y < z \ z < C)" + case False then have "C \ INFI {x. y < X x} X" by (intro INF_greatest) auto with `y < C` show ?thesis @@ -240,22 +240,22 @@ next fix y assume lower: "\P. eventually P F \ y \ SUPR (Collect P) f" show "y \ f0" - proof cases - assume "\z. f0 < z \ z < y" - then guess z .. + proof (cases "\z. f0 < z \ z < y") + case True + then obtain z where "f0 < z \ z < y" .. moreover have "SUPR {x. f x < z} f \ z" by (rule SUP_least) simp ultimately show ?thesis using lim[THEN topological_tendstoD, THEN lower, of "{..< z}"] by auto next - assume discrete: "\ (\z. f0 < z \ z < y)" + case False show ?thesis proof (rule classical) assume "\ y \ f0" then have "eventually (\x. f x < y) F" using lim[THEN topological_tendstoD, of "{..< y}"] by auto then have "eventually (\x. f x \ f0) F" - using discrete by (auto elim!: eventually_elim1 simp: not_less) + using False by (auto elim!: eventually_elim1 simp: not_less) then have "y \ SUPR {x. f x \ f0} f" by (rule lower) moreover have "SUPR {x. f x \ f0} f \ f0" diff -r 08f3491c50bf -r 355a4cac5440 src/HOL/Library/While_Combinator.thy --- a/src/HOL/Library/While_Combinator.thy Tue Sep 03 19:58:00 2013 +0200 +++ b/src/HOL/Library/While_Combinator.thy Tue Sep 03 22:04:23 2013 +0200 @@ -93,8 +93,9 @@ next case (Suc k) hence "\ b ((c^^k) (c s))" by (auto simp: funpow_swap1) - then guess k by (rule exE[OF Suc.IH[of "c s"]]) - with assms show ?case by (cases "b s") (auto simp: funpow_swap1 intro: exI[of _ "Suc k"] exI[of _ "0"]) + from Suc.IH[OF this] obtain k where "\ b' ((c' ^^ k) (f (c s)))" .. + with assms show ?case + by (cases "b s") (auto simp: funpow_swap1 intro: exI[of _ "Suc k"] exI[of _ "0"]) qed next fix k assume "\ b' ((c' ^^ k) (f s))" @@ -107,8 +108,8 @@ show ?case proof (cases "b s") case True - with assms(2) * have "\ b' ((c'^^k) (f (c s)))" by simp - then guess k by (rule exE[OF Suc.IH[of "c s"]]) + with assms(2) * have "\ b' ((c'^^k) (f (c s)))" by simp + from Suc.IH[OF this] obtain k where "\ b ((c ^^ k) (c s))" .. thus ?thesis by (auto simp: funpow_swap1 intro: exI[of _ "Suc k"]) qed (auto intro: exI[of _ "0"]) qed diff -r 08f3491c50bf -r 355a4cac5440 src/HOL/Limits.thy --- a/src/HOL/Limits.thy Tue Sep 03 19:58:00 2013 +0200 +++ b/src/HOL/Limits.thy Tue Sep 03 22:04:23 2013 +0200 @@ -33,16 +33,17 @@ "(at_infinity \ real filter) = sup at_top at_bot" unfolding sup_filter_def at_infinity_def eventually_at_top_linorder eventually_at_bot_linorder proof (intro arg_cong[where f=Abs_filter] ext iffI) - fix P :: "real \ bool" assume "\r. \x. r \ norm x \ P x" - then guess r .. + fix P :: "real \ bool" + assume "\r. \x. r \ norm x \ P x" + then obtain r where "\x. r \ norm x \ P x" .. then have "(\x\r. P x) \ (\x\-r. P x)" by auto then show "(\r. \x\r. P x) \ (\r. \x\r. P x)" by auto next - fix P :: "real \ bool" assume "(\r. \x\r. P x) \ (\r. \x\r. P x)" + fix P :: "real \ bool" + assume "(\r. \x\r. P x) \ (\r. \x\r. P x)" then obtain p q where "\x\p. P x" "\x\q. P x" by auto then show "\r. \x. r \ norm x \ P x" - by (intro exI[of _ "max p (-q)"]) - (auto simp: abs_real_def) + by (intro exI[of _ "max p (-q)"]) (auto simp: abs_real_def) qed lemma at_top_le_at_infinity: diff -r 08f3491c50bf -r 355a4cac5440 src/HOL/Real_Vector_Spaces.thy --- a/src/HOL/Real_Vector_Spaces.thy Tue Sep 03 19:58:00 2013 +0200 +++ b/src/HOL/Real_Vector_Spaces.thy Tue Sep 03 22:04:23 2013 +0200 @@ -833,7 +833,8 @@ show "(open :: real set \ bool) = generate_topology (range lessThan \ range greaterThan)" proof (rule ext, safe) fix S :: "real set" assume "open S" - then guess f unfolding open_real_def bchoice_iff .. + then obtain f where "\x\S. 0 < f x \ (\y. dist y x < f x \ y \ S)" + unfolding open_real_def bchoice_iff .. then have *: "S = (\x\S. {x - f x <..} \ {..< x + f x})" by (fastforce simp: dist_real_def) show "generate_topology (range lessThan \ range greaterThan) S" @@ -1525,7 +1526,8 @@ with limseq obtain N :: nat where N: "\n. N \ n \ \f (real n) - y\ < e" by (auto simp: LIMSEQ_def dist_real_def) { fix x :: real - from ex_le_of_nat[of x] guess n .. + obtain n where "x \ real_of_nat n" + using ex_le_of_nat[of x] .. note monoD[OF mono this] also have "f (real_of_nat n) \ y" by (rule LIMSEQ_le_const[OF limseq]) diff -r 08f3491c50bf -r 355a4cac5440 src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Tue Sep 03 19:58:00 2013 +0200 +++ b/src/HOL/Topological_Spaces.thy Tue Sep 03 22:04:23 2013 +0200 @@ -215,14 +215,14 @@ lemma (in linorder) less_separate: assumes "x < y" shows "\a b. x \ {..< a} \ y \ {b <..} \ {..< a} \ {b <..} = {}" -proof cases - assume "\z. x < z \ z < y" - then guess z .. +proof (cases "\z. x < z \ z < y") + case True + then obtain z where "x < z \ z < y" .. then have "x \ {..< z} \ y \ {z <..} \ {z <..} \ {..< z} = {}" by auto then show ?thesis by blast next - assume "\ (\z. x < z \ z < y)" + case False with `x < y` have "x \ {..< y} \ y \ {x <..} \ {x <..} \ {..< y} = {}" by auto then show ?thesis by blast @@ -570,10 +570,11 @@ lemma eventually_at_top_dense: "eventually P at_top \ (\N::'a::unbounded_dense_linorder. \n>N. P n)" unfolding eventually_at_top_linorder proof safe - fix N assume "\n\N. P n" then show "\N. \n>N. P n" by (auto intro!: exI[of _ N]) + fix N assume "\n\N. P n" + then show "\N. \n>N. P n" by (auto intro!: exI[of _ N]) next fix N assume "\n>N. P n" - moreover from gt_ex[of N] guess y .. + moreover obtain y where "N < y" using gt_ex[of N] .. ultimately show "\N. \n\N. P n" by (auto intro!: exI[of _ y]) qed @@ -606,7 +607,7 @@ fix N assume "\n\N. P n" then show "\N. \nnN. \n\N. P n" by (auto intro!: exI[of _ y]) qed @@ -765,7 +766,7 @@ shows "eventually P (at_right x) \ (\b. x < b \ (\z. x < z \ z < b \ P z))" unfolding eventually_at_topological proof safe - from gt_ex[of x] guess y .. + obtain y where "x < y" using gt_ex[of x] .. moreover fix S assume "open S" "x \ S" note open_right[OF this, of y] moreover note gt_ex[of x] moreover assume "\s\S. s \ x \ s \ {x<..} \ P s" @@ -782,7 +783,7 @@ shows "eventually P (at_left x) \ (\b. x > b \ (\z. b < z \ z < x \ P z))" unfolding eventually_at_topological proof safe - from lt_ex[of x] guess y .. + obtain y where "y < x" using lt_ex[of x] .. moreover fix S assume "open S" "x \ S" note open_left[OF this, of y] moreover assume "\s\S. s \ x \ s \ {.. P s" ultimately show "\bz. b < z \ z < x \ P z" @@ -1513,10 +1514,16 @@ "\i. open (A i)" "\i. x \ A i" "\F. (\n. F n \ A n) \ F ----> x" proof atomize_elim - from countable_basis_at_decseq[of x] guess A . note A = this - { fix F S assume "\n. F n \ A n" "open S" "x \ S" + obtain A :: "nat \ 'a set" where A: + "\i. open (A i)" + "\i. x \ A i" + "\S. open S \ x \ S \ eventually (\i. A i \ S) sequentially" + by (rule countable_basis_at_decseq) blast + { + fix F S assume "\n. F n \ A n" "open S" "x \ S" with A(3)[of S] have "eventually (\n. F n \ S) sequentially" - by (auto elim: eventually_elim1 simp: subset_eq) } + by (auto elim: eventually_elim1 simp: subset_eq) + } with A show "\A. (\i. open (A i)) \ (\i. x \ A i) \ (\F. (\n. F n \ A n) \ F ----> x)" by (intro exI[of _ A]) (auto simp: tendsto_def) qed @@ -1525,13 +1532,16 @@ assumes "\f. (\n. f n \ s) \ f ----> a \ eventually (\n. P (f n)) sequentially" shows "eventually P (inf (nhds a) (principal s))" proof (rule ccontr) - from countable_basis[of a] guess A . note A = this - assume "\ eventually P (inf (nhds a) (principal s))" + obtain A :: "nat \ 'a set" where A: + "\i. open (A i)" + "\i. a \ A i" + "\F. \n. F n \ A n \ F ----> a" + by (rule countable_basis) blast + assume "\ ?thesis" with A have P: "\F. \n. F n \ s \ F n \ A n \ \ P (F n)" unfolding eventually_inf_principal eventually_nhds by (intro choice) fastforce - then guess F .. - hence F0: "\n. F n \ s" and F2: "\n. F n \ A n" and F3: "\n. \ P (F n)" - by fast+ + then obtain F where F0: "\n. F n \ s" and F2: "\n. F n \ A n" and F3: "\n. \ P (F n)" + by blast with A have "F ----> a" by auto hence "eventually (\n. P (F n)) sequentially" using assms F0 by simp @@ -1668,7 +1678,8 @@ fix B :: "'b set" assume "continuous_on s f" "open B" then have "\x\f -` B \ s. (\A. open A \ x \ A \ s \ A \ f -` B)" by (auto simp: continuous_on_topological subset_eq Ball_def imp_conjL) - then guess A unfolding bchoice_iff .. + then obtain A where "\x\f -` B \ s. open (A x) \ x \ A x \ s \ A x \ f -` B" + unfolding bchoice_iff .. then show "\A. open A \ A \ s = f -` B \ s" by (intro exI[of _ "\x\f -` B \ s. A x"]) auto next @@ -1883,7 +1894,7 @@ moreover from cover have "s \ \(C \ {-t})" by auto ultimately have "\D\C \ {-t}. finite D \ s \ \D" using `compact s` unfolding compact_eq_heine_borel by auto - then guess D .. + then obtain D where "D \ C \ {- t} \ finite D \ s \ \D" .. then show "\D\C. finite D \ s \ t \ \D" by (intro exI[of _ "D - {-t}"]) auto qed @@ -1925,7 +1936,8 @@ fix C assume "\c\C. open c" and cover: "f`s \ \C" with f have "\c\C. \A. open A \ A \ s = f -` c \ s" unfolding continuous_on_open_invariant by blast - then guess A unfolding bchoice_iff .. note A = this + then obtain A where A: "\c\C. open (A c) \ A c \ s = f -` c \ s" + unfolding bchoice_iff .. with cover have "\c\C. open (A c)" "s \ (\c\C. A c)" by (fastforce simp add: subset_eq set_eq_iff)+ from compactE_image[OF s this] obtain D where "D \ C" "finite D" "s \ (\c\D. A c)" . @@ -2114,7 +2126,8 @@ instance linear_continuum_topology \ perfect_space proof fix x :: 'a - from ex_gt_or_lt [of x] guess y .. + obtain y where "x < y \ y < x" + using ex_gt_or_lt [of x] .. with Inf_notin_open[of "{x}" y] Sup_notin_open[of "{x}" y] show "\ open {x}" by auto