# HG changeset patch # User wenzelm # Date 1632138729 -7200 # Node ID 8d0c2d74ad63586edeea90317da85c6e188f81c5 # Parent 308e74afab83276f8ede46db31377318384e2e48 tuned proofs --- eliminated 'guess'; diff -r 308e74afab83 -r 8d0c2d74ad63 src/HOL/Filter.thy --- a/src/HOL/Filter.thy Mon Sep 20 13:51:32 2021 +0200 +++ b/src/HOL/Filter.thy Mon Sep 20 13:52:09 2021 +0200 @@ -438,26 +438,27 @@ proof - let ?F = "\P. \X\B. finite X \ eventually P (Inf X)" - { fix P have "eventually P (Abs_filter ?F) \ ?F P" - proof (rule eventually_Abs_filter is_filter.intro)+ - show "?F (\x. True)" - by (rule exI[of _ "{}"]) (simp add: le_fun_def) - next - fix P Q - assume "?F P" then guess X .. - moreover - assume "?F Q" then guess Y .. - ultimately show "?F (\x. P x \ Q x)" - by (intro exI[of _ "X \ Y"]) - (auto simp: Inf_union_distrib eventually_inf) - next - fix P Q - assume "?F P" then guess X .. - moreover assume "\x. P x \ Q x" - ultimately show "?F Q" - by (intro exI[of _ X]) (auto elim: eventually_mono) - qed } - note eventually_F = this + have eventually_F: "eventually P (Abs_filter ?F) \ ?F P" for P + proof (rule eventually_Abs_filter is_filter.intro)+ + show "?F (\x. True)" + by (rule exI[of _ "{}"]) (simp add: le_fun_def) + next + fix P Q + assume "?F P" "?F Q" + then obtain X Y where + "X \ B" "finite X" "eventually P (\ X)" + "Y \ B" "finite Y" "eventually Q (\ Y)" by blast + then show "?F (\x. P x \ Q x)" + by (intro exI[of _ "X \ Y"]) (auto simp: Inf_union_distrib eventually_inf) + next + fix P Q + assume "?F P" + then obtain X where "X \ B" "finite X" "eventually P (\ X)" + by blast + moreover assume "\x. P x \ Q x" + ultimately show "?F Q" + by (intro exI[of _ X]) (auto elim: eventually_mono) + qed have "Inf B = Abs_filter ?F" proof (intro antisym Inf_greatest) @@ -598,11 +599,12 @@ show ?case by (auto intro!: exI[of _ "\_. True"]) next case (2 P Q) - from 2(1) guess P' by (elim exE conjE) note P' = this - from 2(2) guess Q' by (elim exE conjE) note Q' = this + then obtain P' Q' where P'Q': + "eventually P' F" "\x. P' (f x) \ P x" + "eventually Q' F" "\x. Q' (f x) \ Q x" + by (elim exE conjE) show ?case - by (rule exI[of _ "\x. P' x \ Q' x"]) - (insert P' Q', auto intro!: eventually_conj) + by (rule exI[of _ "\x. P' x \ Q' x"]) (use P'Q' in \auto intro!: eventually_conj\) next case (3 P Q) thus ?case by blast diff -r 308e74afab83 -r 8d0c2d74ad63 src/HOL/Library/Countable_Set.thy --- a/src/HOL/Library/Countable_Set.thy Mon Sep 20 13:51:32 2021 +0200 +++ b/src/HOL/Library/Countable_Set.thy Mon Sep 20 13:52:09 2021 +0200 @@ -377,7 +377,8 @@ lemma infinite_countable_subset': assumes X: "infinite X" shows "\C\X. countable C \ infinite C" proof - - from infinite_countable_subset[OF X] guess f .. + obtain f :: "nat \ 'a" where "inj f" "range f \ X" + using infinite_countable_subset [OF X] by blast then show ?thesis by (intro exI[of _ "range f"]) (auto simp: range_inj_infinite) qed diff -r 308e74afab83 -r 8d0c2d74ad63 src/HOL/Library/Extended_Nonnegative_Real.thy --- a/src/HOL/Library/Extended_Nonnegative_Real.thy Mon Sep 20 13:51:32 2021 +0200 +++ b/src/HOL/Library/Extended_Nonnegative_Real.thy Mon Sep 20 13:52:09 2021 +0200 @@ -1150,7 +1150,8 @@ assume "infinite X" "X \ {}" have "\y\X. r < ennreal_of_enat y" if r: "r < top" for r proof - - from ennreal_Ex_less_of_nat[OF r] guess n .. note n = this + obtain n where n: "r < of_nat n" + using ennreal_Ex_less_of_nat[OF r] .. have "\ (X \ enat ` {.. n})" using \infinite X\ by (auto dest: finite_subset) then obtain x where x: "x \ X" "x \ enat ` {..n}" @@ -1198,9 +1199,11 @@ using zero_neq_one by (intro exI) show "\x y::ennreal. x < y \ \z>x. z < y" proof transfer - fix x y :: ereal assume "0 \ x" and *: "x < y" - moreover from dense[OF *] guess z .. - ultimately show "\z\Collect ((\) 0). x < z \ z < y" + fix x y :: ereal + assume *: "0 \ x" + assume "x < y" + from dense[OF this] obtain z where "x < z \ z < y" .. + with * show "\z\Collect ((\) 0). x < z \ z < y" by (intro bexI[of _ z]) auto qed qed (rule open_ennreal_def) @@ -1693,8 +1696,9 @@ show "x \ (SUP i\A. f i)" proof (rule ennreal_le_epsilon) fix e :: real assume "0 < e" - from approx[OF this] guess i .. - then have "x \ f i + e" + from approx[OF this] obtain i where "i \ A" and *: "x \ f i + ennreal e" + by blast + from * have "x \ f i + e" by simp also have "\ \ (SUP i\A. f i) + e" by (intro add_mono \i \ A\ SUP_upper order_refl) @@ -1711,7 +1715,8 @@ show "(INF i\A. f i) \ x" proof (rule ennreal_le_epsilon) fix e :: real assume "0 < e" - from approx[OF this] guess i .. note i = this + from approx[OF this] obtain i where "i\A" "f i \ x + ennreal e" + by blast then have "(INF i\A. f i) \ f i" by (intro INF_lower) also have "\ \ x + e" diff -r 308e74afab83 -r 8d0c2d74ad63 src/HOL/Library/Extended_Real.thy --- a/src/HOL/Library/Extended_Real.thy Mon Sep 20 13:51:32 2021 +0200 +++ b/src/HOL/Library/Extended_Real.thy Mon Sep 20 13:52:09 2021 +0200 @@ -2445,7 +2445,7 @@ then obtain l where "incseq l" and l: "l i < Sup A" and l_Sup: "l \ Sup A" for i :: nat by (auto dest: countable_approach) - have "\f. \n. (f n \ A \ l n \ f n) \ (f n \ f (Suc n))" + have "\f. \n. (f n \ A \ l n \ f n) \ (f n \ f (Suc n))" (is "\f. ?P f") proof (rule dependent_nat_choice) show "\x. x \ A \ l 0 \ x" using l[of 0] by (auto simp: less_Sup_iff) @@ -2456,7 +2456,7 @@ ultimately show "\y. (y \ A \ l (Suc n) \ y) \ x \ y" by (auto intro!: exI[of _ "max x y"] split: split_max) qed - then guess f .. note f = this + then obtain f where f: "?P f" .. then have "range f \ A" "incseq f" by (auto simp: incseq_Suc_iff) moreover @@ -3632,17 +3632,17 @@ have "N \ A \ (SUP i\I. \n\N. f n i) = (\n\N. SUP i\I. f n i)" for N proof (induction N rule: infinite_finite_induct) case (insert n N) - moreover have "(SUP i\I. f n i + (\l\N. f l i)) = (SUP i\I. f n i) + (SUP i\I. \l\N. f l i)" + have "(SUP i\I. f n i + (\l\N. f l i)) = (SUP i\I. f n i) + (SUP i\I. \l\N. f l i)" proof (rule SUP_ereal_add_directed) fix i assume "i \ I" then show "0 \ f n i" "0 \ (\l\N. f l i)" using insert by (auto intro!: sum_nonneg nonneg) next fix i j assume "i \ I" "j \ I" - from directed[OF \insert n N \ A\ this] guess k .. - then show "\k\I. f n i + (\l\N. f l j) \ f n k + (\l\N. f l k)" - by (intro bexI[of _ k]) (auto intro!: add_mono sum_mono) + from directed[OF insert(4) this] + show "\k\I. f n i + (\l\N. f l j) \ f n k + (\l\N. f l k)" + by (auto intro!: add_mono sum_mono) qed - ultimately show ?case + with insert show ?case by simp qed (simp_all add: SUP_constant \I \ {}\) from this[of A] show ?thesis by simp