# HG changeset patch # User wenzelm # Date 1461703471 -7200 # Node ID 293ede07b7752feb39420d0948015eb3fcc7d51c # Parent 3f577308551e4210ae54090d8094fe17084d1f65 some uses of 'obtain' with structure statement; diff -r 3f577308551e -r 293ede07b775 src/HOL/Library/ContNotDenum.thy --- a/src/HOL/Library/ContNotDenum.thy Tue Apr 26 22:39:17 2016 +0200 +++ b/src/HOL/Library/ContNotDenum.thy Tue Apr 26 22:44:31 2016 +0200 @@ -41,9 +41,10 @@ by (auto simp add: not_le cong: conj_cong) (metis dense le_less_linear less_linear less_trans order_refl) then obtain i j where ij: - "\a b c::real. a < b \ i a b c < j a b c" - "\a b c. a < b \ {i a b c .. j a b c} \ {a .. b}" - "\a b c. a < b \ c \ {i a b c .. j a b c}" + "a < b \ i a b c < j a b c" + "a < b \ {i a b c .. j a b c} \ {a .. b}" + "a < b \ c \ {i a b c .. j a b c}" + for a b c :: real by metis define ivl where "ivl = @@ -78,7 +79,7 @@ finally show "I 0 \ (\i\S. I i) \ {}" by auto qed (auto simp: I_def) - then obtain x where "\n. x \ I n" + then obtain x where "x \ I n" for n by blast moreover from \surj f\ obtain j where "x = f j" by blast diff -r 3f577308551e -r 293ede07b775 src/HOL/Library/Extended_Nonnegative_Real.thy --- a/src/HOL/Library/Extended_Nonnegative_Real.thy Tue Apr 26 22:39:17 2016 +0200 +++ b/src/HOL/Library/Extended_Nonnegative_Real.thy Tue Apr 26 22:44:31 2016 +0200 @@ -1483,7 +1483,7 @@ case (real r) then have "\x. \q\0. g x \ c \ (g x = ennreal q \ q \ r)" by (auto simp: le_ennreal_iff) - then obtain f where *: "\x. g x \ c \ 0 \ f x" "\x. g x \ c \ g x = ennreal (f x)" "\x. g x \ c \ f x \ r" + then obtain f where *: "0 \ f x" "g x = ennreal (f x)" "f x \ r" if "g x \ c" for x by metis from ae have ae2: "\\<^sub>F x in F. c - g x = ennreal (r - f x) \ f x \ r \ g x = ennreal (f x) \ 0 \ f x" proof eventually_elim diff -r 3f577308551e -r 293ede07b775 src/HOL/Library/Extended_Real.thy --- a/src/HOL/Library/Extended_Real.thy Tue Apr 26 22:39:17 2016 +0200 +++ b/src/HOL/Library/Extended_Real.thy Tue Apr 26 22:44:31 2016 +0200 @@ -1696,7 +1696,7 @@ shows "\x. (\y\S. y \ x) \ (\z. (\y\S. y \ z) \ x \ z)" proof (cases "\x. \a\S. a \ ereal x") case True - then obtain y where y: "\a. a\S \ a \ ereal y" + then obtain y where y: "a \ ereal y" if "a\S" for a by auto then have "\ \ S" by force @@ -1705,7 +1705,7 @@ case True with \\ \ S\ obtain x where x: "x \ S" "\x\ \ \" by auto - obtain s where s: "\x\ereal -` S. x \ s" "\z. (\x\ereal -` S. x \ z) \ s \ z" + obtain s where s: "\x\ereal -` S. x \ s" "(\x\ereal -` S. x \ z) \ s \ z" for z proof (atomize_elim, rule complete_real) show "\x. x \ ereal -` S" using x by auto @@ -1919,7 +1919,7 @@ assumes *: "bdd_below A" "A \ {}" shows "ereal (Inf A) = (INF a:A. ereal a)" proof (rule ereal_Inf) - from * obtain l u where "\x. x \ A \ l \ x" "u \ A" + from * obtain l u where "x \ A \ l \ x" "u \ A" for x by (auto simp: bdd_below_def) then have "l \ (INF x:A. ereal x)" "(INF x:A. ereal x) \ u" by (auto intro!: INF_greatest INF_lower) @@ -2193,7 +2193,7 @@ by (auto intro!: exI[of _ "\_. -\"] simp: bot_ereal_def) next assume "Sup A \ -\" - then obtain l where "incseq l" and l: "\i::nat. l i < Sup A" and l_Sup: "l \ Sup A" + 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))" @@ -2456,7 +2456,7 @@ from \open S\ have "open (ereal -` S)" by (rule ereal_openE) - then obtain e where "e > 0" and e: "\y. dist y (real_of_ereal x) < e \ ereal y \ S" + then obtain e where "e > 0" and e: "dist y (real_of_ereal x) < e \ ereal y \ S" for y using assms unfolding open_dist by force show thesis proof (intro that subsetI) @@ -2830,11 +2830,12 @@ assume "open S" and "x \ S" then have "open (ereal -` S)" unfolding open_ereal_def by auto - with \x \ S\ obtain r where "0 < r" and dist: "\y. dist y rx < r \ ereal y \ S" + with \x \ S\ obtain r where "0 < r" and dist: "dist y rx < r \ ereal y \ S" for y unfolding open_dist rx by auto - then obtain n where - upper: "\N. n \ N \ u N < x + ereal r" and - lower: "\N. n \ N \ x < u N + ereal r" + then obtain n + where upper: "u N < x + ereal r" + and lower: "x < u N + ereal r" + if "n \ N" for N using assms(2)[of "ereal r"] by auto show "\N. \n\N. u n \ S" proof (safe intro!: exI[of _ n]) diff -r 3f577308551e -r 293ede07b775 src/HOL/Library/Fun_Lexorder.thy --- a/src/HOL/Library/Fun_Lexorder.thy Tue Apr 26 22:39:17 2016 +0200 +++ b/src/HOL/Library/Fun_Lexorder.thy Tue Apr 26 22:44:31 2016 +0200 @@ -24,9 +24,9 @@ assumes "less_fun f g" shows "\ less_fun g f" proof - from assms obtain k1 where k1: "f k1 < g k1" "\k'. k' < k1 \ f k' = g k'" + from assms obtain k1 where k1: "f k1 < g k1" "k' < k1 \ f k' = g k'" for k' by (blast elim!: less_funE) - assume "less_fun g f" then obtain k2 where k2: "g k2 < f k2" "\k'. k' < k2 \ g k' = f k'" + assume "less_fun g f" then obtain k2 where k2: "g k2 < f k2" "k' < k2 \ g k' = f k'" for k' by (blast elim!: less_funE) show False proof (cases k1 k2 rule: linorder_cases) case equal with k1 k2 show False by simp @@ -52,9 +52,9 @@ assumes "less_fun f g" and "less_fun g h" shows "less_fun f h" proof (rule less_funI) - from \less_fun f g\ obtain k1 where k1: "f k1 < g k1" "\k'. k' < k1 \ f k' = g k'" - by (blast elim!: less_funE) - from \less_fun g h\ obtain k2 where k2: "g k2 < h k2" "\k'. k' < k2 \ g k' = h k'" + from \less_fun f g\ obtain k1 where k1: "f k1 < g k1" "k' < k1 \ f k' = g k'" for k' + by (blast elim!: less_funE) + from \less_fun g h\ obtain k2 where k2: "g k2 < h k2" "k' < k2 \ g k' = h k'" for k' by (blast elim!: less_funE) show "\k. f k < h k \ (\k' (\ i\I. \n. A n i)" then have "\i\I. \n. f i \ A n i" by auto - from bchoice[OF this] obtain n where n: "\i. i \ I \ f i \ (A (n i) i)" + from bchoice[OF this] obtain n where n: "f i \ A (n i) i" if "i \ I" for i by auto - obtain k where k: "\i. i \ I \ n i \ k" + obtain k where k: "n i \ k" if "i \ I" for i using \finite I\ finite_nat_set_iff_bounded_le[of "n`I"] by auto have "f \ Pi I (A k)" proof (intro Pi_I) diff -r 3f577308551e -r 293ede07b775 src/HOL/Library/Function_Growth.thy --- a/src/HOL/Library/Function_Growth.thy Tue Apr 26 22:39:17 2016 +0200 +++ b/src/HOL/Library/Function_Growth.thy Tue Apr 26 22:44:31 2016 +0200 @@ -163,7 +163,7 @@ and "\c n. c > 0 \ \m>n. c * f m < g m" proof - from assms have "f \ g" and "\ g \ f" by (simp_all add: less_fun_def) - from \f \ g\ obtain n c where *:"c > 0" "\m. m > n \ f m \ c * g m" + from \f \ g\ obtain n c where *:"c > 0" "m > n \ f m \ c * g m" for m by (rule less_eq_funE) blast { fix c n :: nat assume "c > 0" @@ -202,8 +202,8 @@ shows "f \ g" proof (rule less_funI) have "1 > (0::nat)" by simp - from assms \1 > 0\ have "\n. \m>n. 1 * f m < g m" . - then obtain n where *: "\m. m > n \ 1 * f m < g m" by blast + with assms [OF this] obtain n where *: "m > n \ 1 * f m < g m" for m + by blast have "\m>n. f m \ 1 * g m" proof (rule allI, rule impI) fix m @@ -214,7 +214,7 @@ with \1 > 0\ show "\c>0. \n. \m>n. f m \ c * g m" by blast fix c n :: nat assume "c > 0" - with assms obtain q where "\m. m > q \ c * f m < g m" by blast + with assms obtain q where "m > q \ c * f m < g m" for m by blast then have "c * f (Suc (q + n)) < g (Suc (q + n))" by simp moreover have "Suc (q + n) > n" by simp ultimately show "\m>n. c * f m < g m" by blast diff -r 3f577308551e -r 293ede07b775 src/HOL/Library/Fundamental_Theorem_Algebra.thy --- a/src/HOL/Library/Fundamental_Theorem_Algebra.thy Tue Apr 26 22:39:17 2016 +0200 +++ b/src/HOL/Library/Fundamental_Theorem_Algebra.thy Tue Apr 26 22:44:31 2016 +0200 @@ -312,7 +312,7 @@ assumes ep: "e > 0" shows "\d >0. \w. 0 < norm (w - z) \ norm (w - z) < d \ norm (poly p w - poly p z) < e" proof - - obtain q where q: "degree q = degree p" "\x. poly q x = poly p (z + x)" + obtain q where q: "degree q = degree p" "poly q x = poly p (z + x)" for x proof show "degree (offset_poly p z) = degree p" by (rule degree_offset_poly) @@ -329,7 +329,7 @@ next case (pCons c cs) from poly_bound_exists[of 1 "cs"] - obtain m where m: "m > 0" "\z. norm z \ 1 \ norm (poly cs z) \ m" + obtain m where m: "m > 0" "norm z \ 1 \ norm (poly cs z) \ m" for z by blast from ep m(1) have em0: "e/m > 0" by (simp add: field_simps) @@ -535,12 +535,14 @@ proof (cases "cs = 0") case False from poly_infinity[OF False, of "cmod (poly (pCons c cs) 0)" c] - obtain r where r: "\z. r \ cmod z \ cmod (poly (pCons c cs) 0) \ cmod (poly (pCons c cs) z)" + obtain r where r: "cmod (poly (pCons c cs) 0) \ cmod (poly (pCons c cs) z)" + if "r \ cmod z" for z by blast have ath: "\z r. r \ cmod z \ cmod z \ \r\" by arith from poly_minimum_modulus_disc[of "\r\" "pCons c cs"] - obtain v where v: "\w. cmod w \ \r\ \ cmod (poly (pCons c cs) v) \ cmod (poly (pCons c cs) w)" + obtain v where v: "cmod (poly (pCons c cs) v) \ cmod (poly (pCons c cs) w)" + if "cmod w \ \r\" for w by blast have "cmod (poly (pCons c cs) v) \ cmod (poly (pCons c cs) z)" if z: "r \ cmod z" for z using v[of 0] r[OF z] by simp diff -r 3f577308551e -r 293ede07b775 src/HOL/Library/Multiset.thy --- a/src/HOL/Library/Multiset.thy Tue Apr 26 22:39:17 2016 +0200 +++ b/src/HOL/Library/Multiset.thy Tue Apr 26 22:44:31 2016 +0200 @@ -2075,7 +2075,7 @@ "a \# K" "\b. b \# K \ b < a" proof - from assms obtain a M0 K where "M = M0 + {#a#}" "N = M0 + K" - "\b. b \# K \ b < a" by (blast elim: mult1E) + "b \# K \ b < a" for b by (blast elim: mult1E) moreover from this(3) [of a] have "a \# K" by auto ultimately show thesis by (auto intro: that) qed diff -r 3f577308551e -r 293ede07b775 src/HOL/Library/Polynomial.thy --- a/src/HOL/Library/Polynomial.thy Tue Apr 26 22:39:17 2016 +0200 +++ b/src/HOL/Library/Polynomial.thy Tue Apr 26 22:44:31 2016 +0200 @@ -3353,7 +3353,7 @@ fix p assume rat: "\i. coeff p i \ \" and root: "poly p x = 0" and nz: "p \ 0" define cs where "cs = coeffs p" from rat have "\c\range (coeff p). \c'. c = of_rat c'" unfolding Rats_def by blast - then obtain f where f: "\i. coeff p i = of_rat (f (coeff p i))" + then obtain f where f: "coeff p i = of_rat (f (coeff p i))" for i by (subst (asm) bchoice_iff) blast define cs' where "cs' = map (quotient_of \ f) (coeffs p)" define d where "d = Lcm (set (map snd cs'))" @@ -3392,9 +3392,8 @@ moreover from root have "poly p' x = 0" by (simp add: p'_def) ultimately show "algebraic x" unfolding algebraic_def by blast next - assume "algebraic x" - then obtain p where p: "\i. coeff p i \ \" "poly p x = 0" "p \ 0" + then obtain p where p: "coeff p i \ \" "poly p x = 0" "p \ 0" for i by (force simp: algebraic_def) moreover have "coeff p i \ \ \ coeff p i \ \" for i by (elim Ints_cases) simp ultimately show "(\p. (\i. coeff p i \ \) \ p \ 0 \ poly p x = 0)" by auto diff -r 3f577308551e -r 293ede07b775 src/HOL/Library/Ramsey.thy --- a/src/HOL/Library/Ramsey.thy Tue Apr 26 22:39:17 2016 +0200 +++ b/src/HOL/Library/Ramsey.thy Tue Apr 26 22:44:31 2016 +0200 @@ -231,8 +231,8 @@ qed qed from dependent_choice [OF transr propr0 proprstep] - obtain g where pg: "!!n::nat. ?propr (g n)" - and rg: "!!n m. n (g n, g m) \ ?ramr" by blast + obtain g where pg: "?propr (g n)" and rg: "n (g n, g m) \ ?ramr" for n m :: nat + by blast let ?gy = "fst o g" let ?gt = "snd o snd o g" have rangeg: "\k. range ?gt \ {.. 0" and "b \ 0" and "c \ 0" by simp_all - then obtain A B C where fact: - "factorization a = Some A" "factorization b = Some B" "factorization c = Some C" + then obtain A B C + where fact: "factorization a = Some A" "factorization b = Some B" "factorization c = Some C" and norm: "normalize a = msetprod A" "normalize b = msetprod B" "normalize c = msetprod C" - and A: "0 \# A" "\p. p \# A \ normalize p = p" "\p. p \# A \ is_prime p" - and B: "0 \# B" "\p. p \# B \ normalize p = p" "\p. p \# B \ is_prime p" - and C: "0 \# C" "\p. p \# C \ normalize p = p" "\p. p \# C \ is_prime p" + and A: "0 \# A" "p \# A \ normalize p = p" "p \# A \ is_prime p" + and B: "0 \# B" "p \# B \ normalize p = p" "p \# B \ is_prime p" + and C: "0 \# C" "p \# C \ normalize p = p" "p \# C \ is_prime p" + for p by (blast elim!: factorizationE) moreover from that have "normalize c dvd normalize a" and "normalize c dvd normalize b" by simp_all diff -r 3f577308551e -r 293ede07b775 src/HOL/Proofs/Lambda/WeakNorm.thy --- a/src/HOL/Proofs/Lambda/WeakNorm.thy Tue Apr 26 22:39:17 2016 +0200 +++ b/src/HOL/Proofs/Lambda/WeakNorm.thy Tue Apr 26 22:44:31 2016 +0200 @@ -40,9 +40,9 @@ by (rule types_snocE) from snoc have "listall ?R bs" by simp with bs have "\bs'. ?ex Vs bs bs'" by (rule snoc) - then obtain bs' where - bsred: "\j. Var j \\ map (\t. f (t[u/i])) bs \\<^sub>\\<^sup>* Var j \\ map f bs'" - and bsNF: "\j. NF (Var j \\ map f bs')" by iprover + then obtain bs' where bsred: "Var j \\ map (\t. f (t[u/i])) bs \\<^sub>\\<^sup>* Var j \\ map f bs'" + and bsNF: "NF (Var j \\ map f bs')" for j + by iprover from snoc have "?R b" by simp with bT and uNF and uT have "\b'. b[u/i] \\<^sub>\\<^sup>* b' \ NF b'" by iprover diff -r 3f577308551e -r 293ede07b775 src/HOL/ex/Gauge_Integration.thy --- a/src/HOL/ex/Gauge_Integration.thy Tue Apr 26 22:39:17 2016 +0200 +++ b/src/HOL/ex/Gauge_Integration.thy Tue Apr 26 22:44:31 2016 +0200 @@ -133,7 +133,7 @@ proof (cases "b < x") case True with 2 obtain N where *: "N < length D" - and **: "\ d t e. D ! N = (d,t,e) \ d < x \ x \ e" by auto + and **: "D ! N = (d,t,e) \ d < x \ x \ e" for d t e by auto hence "Suc N < length ((a,t,b)#D) \ (\ d t' e. ((a,t,b)#D) ! Suc N = (d,t',e) \ d < x \ x \ e)" by auto thus ?thesis by auto @@ -372,11 +372,11 @@ hence "a < b" and "b < c" by auto obtain \1 where \1_gauge: "gauge {a..b} \1" - and I1: "\ D. fine \1 (a,b) D \ \ rsum D f - x1 \ < (\ / 2)" + and I1: "fine \1 (a,b) D \ \ rsum D f - x1 \ < (\ / 2)" for D using IntegralE [OF \Integral (a, b) f x1\ \0 < \/2\] by auto obtain \2 where \2_gauge: "gauge {b..c} \2" - and I2: "\ D. fine \2 (b,c) D \ \ rsum D f - x2 \ < (\ / 2)" + and I2: "fine \2 (b,c) D \ \ rsum D f - x2 \ < (\ / 2)" for D using IntegralE [OF \Integral (b, c) f x2\ \0 < \/2\] by auto define \ where "\ x = @@ -541,7 +541,7 @@ then have "\r>0. \s>0. \z. z \ x \ \z - x\ < s \ \(f z - f x) / (z - x) - f' x\ < r" by (simp add: DERIV_iff2 LIM_eq) with \0 < e\ obtain s - where "\z. z \ x \ \z - x\ < s \ \(f z - f x) / (z - x) - f' x\ < e/2" and "0 < s" + where "z \ x \ \z - x\ < s \ \(f z - f x) / (z - x) - f' x\ < e/2" and "0 < s" for z by (drule_tac x="e/2" in spec, auto) with strad1 [of x s f f' e] have strad: "\z. \z - x\ < s \ \f z - f x - f' x * (z - x)\ \ e/2 * \z - x\" @@ -586,8 +586,8 @@ from lemma_straddle [OF f' this] obtain \ where "gauge {a..b} \" - and \: "\x u v. \a \ u; u \ x; x \ v; v \ b; v - u < \ x\ \ - \f v - f u - f' x * (v - u)\ \ e * (v - u) / (b - a)" by auto + and \: "\a \ u; u \ x; x \ v; v \ b; v - u < \ x\ \ + \f v - f u - f' x * (v - u)\ \ e * (v - u) / (b - a)" for x u v by auto have "\D. fine \ (a, b) D \ \rsum D f' - (f b - f a)\ \ e" proof (clarify)