# HG changeset patch # User wenzelm # Date 1470675312 -7200 # Node ID 3b3ab467427451bfb7856b4c67d6b677d6584364 # Parent d02601840466b35519f3483e4f30ab949a42e1c0 tuned; diff -r d02601840466 -r 3b3ab4674274 src/HOL/Hilbert_Choice.thy --- a/src/HOL/Hilbert_Choice.thy Mon Aug 08 18:52:09 2016 +0200 +++ b/src/HOL/Hilbert_Choice.thy Mon Aug 08 18:55:12 2016 +0200 @@ -68,7 +68,7 @@ lemma some_equality [intro]: "P a \ (\x. P x \ x = a) \ (SOME x. P x) = a" by (blast intro: someI2) -lemma some1_equality: "EX!x. P x \ P a \ (SOME x. P x) = a" +lemma some1_equality: "\!x. P x \ P a \ (SOME x. P x) = a" by blast lemma some_eq_ex: "P (SOME x. P x) \ (\x. P x)" @@ -275,8 +275,8 @@ by (cases "card (UNIV :: 'b set)") (auto simp add: card_eq_0_iff) then obtain n where "card (UNIV :: 'b set) = Suc (Suc n)" "n = card (UNIV :: 'b set) - Suc (Suc 0)" by auto - then obtain b1 b2 where b1b2: "(b1 :: 'b) \ (b2 :: 'b)" - by (auto simp add: card_Suc_eq) + then obtain b1 b2 :: 'b where b1b2: "b1 \ b2" + by (auto simp: card_Suc_eq) from fin have "finite (range (\f :: 'a \ 'b. inv f b1))" by (rule finite_imageI) moreover have "UNIV = range (\f :: 'a \ 'b. inv f b1)" @@ -304,8 +304,8 @@ \ lemma infinite_countable_subset: - assumes inf: "\ finite (S::'a set)" - shows "\f. inj (f::nat \ 'a) \ range f \ S" + assumes inf: "\ finite S" + shows "\f::nat \ 'a. inj f \ range f \ S" \ \Courtesy of Stephan Merz\ proof - define Sseq where "Sseq = rec_nat S (\n T. T - {SOME e. e \ T})" @@ -326,7 +326,7 @@ ultimately show ?thesis by blast qed -lemma infinite_iff_countable_subset: "\ finite S \ (\f. inj (f::nat \ 'a) \ range f \ S)" +lemma infinite_iff_countable_subset: "\ finite S \ (\f::nat \ 'a. inj f \ range f \ S)" \ \Courtesy of Stephan Merz\ using finite_imageD finite_subset infinite_UNIV_char_0 infinite_countable_subset by auto @@ -365,7 +365,7 @@ lemma inj_on_iff_surj: assumes "A \ {}" - shows "(\f. inj_on f A \ f ` A \ A') \ (\g. g ` A' = A)" + shows "(\f. inj_on f A \ f ` A \ A') \ (\g. g ` A' = A)" proof safe fix f assume inj: "inj_on f A" and incl: "f ` A \ A'" @@ -429,7 +429,7 @@ qed lemma Ex_inj_on_UNION_Sigma: - "\f. (inj_on f (\i \ I. A i) \ f ` (\i \ I. A i) \ (SIGMA i : I. A i))" + "\f. (inj_on f (\i \ I. A i) \ f ` (\i \ I. A i) \ (SIGMA i : I. A i))" proof let ?phi = "\a i. i \ I \ a \ A i" let ?sm = "\a. SOME i. ?phi a i" @@ -439,9 +439,9 @@ moreover have "?sm a \ I \ a \ A(?sm a)" if "i \ I" and "a \ A i" for i a using that someI[of "?phi a" i] by auto - then have "?f ` (\i \ I. A i) \ (SIGMA i : I. A i)" + then have "?f ` (\i \ I. A i) \ (SIGMA i : I. A i)" by auto - ultimately show "inj_on ?f (\i \ I. A i) \ ?f ` (\i \ I. A i) \ (SIGMA i : I. A i)" + ultimately show "inj_on ?f (\i \ I. A i) \ ?f ` (\i \ I. A i) \ (SIGMA i : I. A i)" by auto qed @@ -625,8 +625,8 @@ apply blast done -lemma LeastM_equality: - "P k \ (\x. P x \ m k \ m x) \ m (LEAST x WRT m. P x) = (m k :: 'a::order)" +lemma LeastM_equality: "P k \ (\x. P x \ m k \ m x) \ m (LEAST x WRT m. P x) = m k" + for m :: "_ \ 'a::order" apply (rule LeastMI2) apply assumption apply blast @@ -640,14 +640,16 @@ apply force done -lemma ex_has_least_nat: "P k \ \x. P x \ (\y. P y \ m x \ (m y :: nat))" +lemma ex_has_least_nat: "P k \ \x. P x \ (\y. P y \ m x \ m y)" + for m :: "'a \ nat" apply (simp only: pred_nat_trancl_eq_le [symmetric]) apply (rule wf_pred_nat [THEN wf_linord_ex_has_least]) apply (simp add: less_eq linorder_not_le pred_nat_trancl_eq_le) apply assumption done -lemma LeastM_nat_lemma: "P k \ P (LeastM m P) \ (\y. P y \ m (LeastM m P) \ (m y :: nat))" +lemma LeastM_nat_lemma: "P k \ P (LeastM m P) \ (\y. P y \ m (LeastM m P) \ m y)" + for m :: "'a \ nat" apply (simp add: LeastM_def) apply (rule someI_ex) apply (erule ex_has_least_nat) @@ -655,7 +657,8 @@ lemmas LeastM_natI = LeastM_nat_lemma [THEN conjunct1] -lemma LeastM_nat_le: "P x \ m (LeastM m P) \ (m x :: nat)" +lemma LeastM_nat_le: "P x \ m (LeastM m P) \ m x" + for m :: "'a \ nat" by (rule LeastM_nat_lemma [THEN conjunct2, THEN spec, THEN mp]) @@ -683,10 +686,8 @@ apply blast done -lemma GreatestM_equality: - "P k \ - (\x. P x \ m x \ m k) \ - m (GREATEST x WRT m. P x) = (m k :: 'a::order)" +lemma GreatestM_equality: "P k \ (\x. P x \ m x \ m k) \ m (GREATEST x WRT m. P x) = m k" + for m :: "_ \ 'a::order" apply (rule GreatestMI2 [where m = m]) apply assumption apply blast @@ -701,11 +702,13 @@ done lemma ex_has_greatest_nat_lemma: - "P k \ \x. P x \ (\y. P y \ \ m y \ (m x :: nat)) \ \y. P y \ \ m y < m k + n" + "P k \ \x. P x \ (\y. P y \ \ m y \ m x) \ \y. P y \ \ m y < m k + n" + for m :: "'a \ nat" by (induct n) (force simp: le_Suc_eq)+ lemma ex_has_greatest_nat: - "P k \ \y. P y \ m y < b \ \x. P x \ (\y. P y \ m y \ (m x :: nat))" + "P k \ \y. P y \ m y < b \ \x. P x \ (\y. P y \ m y \ m x)" + for m :: "'a \ nat" apply (rule ccontr) apply (cut_tac P = P and n = "b - m k" in ex_has_greatest_nat_lemma) apply (subgoal_tac [3] "m k \ b") @@ -713,8 +716,8 @@ done lemma GreatestM_nat_lemma: - "P k \ \y. P y \ m y < b \ - P (GreatestM m P) \ (\y. P y \ (m y :: nat) \ m (GreatestM m P))" + "P k \ \y. P y \ m y < b \ P (GreatestM m P) \ (\y. P y \ m y \ m (GreatestM m P))" + for m :: "'a \ nat" apply (simp add: GreatestM_def) apply (rule someI_ex) apply (erule ex_has_greatest_nat) @@ -723,7 +726,8 @@ lemmas GreatestM_natI = GreatestM_nat_lemma [THEN conjunct1] -lemma GreatestM_nat_le: "P x \ \y. P y \ m y < b \ (m x :: nat) \ m (GreatestM m P)" +lemma GreatestM_nat_le: "P x \ \y. P y \ m y < b \ m x \ m (GreatestM m P)" + for m :: "'a \ nat" by (blast dest: GreatestM_nat_lemma [THEN conjunct2, THEN spec, of P])