equal
deleted
inserted
replaced
47 done |
47 done |
48 |
48 |
49 text\<open>Easier to apply than @{text someI} because the conclusion has only one |
49 text\<open>Easier to apply than @{text someI} because the conclusion has only one |
50 occurrence of @{term P}.\<close> |
50 occurrence of @{term P}.\<close> |
51 lemma someI2: "[| P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)" |
51 lemma someI2: "[| P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)" |
52 by (blast intro: someI) |
52 by (blast intro: someI) |
53 |
53 |
54 text\<open>Easier to apply than @{text someI2} if the witness comes from an |
54 text\<open>Easier to apply than @{text someI2} if the witness comes from an |
55 existential formula\<close> |
55 existential formula\<close> |
|
56 |
56 lemma someI2_ex: "[| \<exists>a. P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)" |
57 lemma someI2_ex: "[| \<exists>a. P a; !!x. P x ==> Q x |] ==> Q (SOME x. P x)" |
57 by (blast intro: someI2) |
58 by (blast intro: someI2) |
|
59 |
|
60 lemma someI2_bex: "[| \<exists>a\<in>A. P a; !!x. x \<in> A \<and> P x ==> Q x |] ==> Q (SOME x. x \<in> A \<and> P x)" |
|
61 by (blast intro: someI2) |
58 |
62 |
59 lemma some_equality [intro]: |
63 lemma some_equality [intro]: |
60 "[| P a; !!x. P x ==> x=a |] ==> (SOME x. P x) = a" |
64 "[| P a; !!x. P x ==> x=a |] ==> (SOME x. P x) = a" |
61 by (blast intro: someI2) |
65 by (blast intro: someI2) |
62 |
66 |
100 |
104 |
101 lemma bchoice_iff': "(\<forall>x\<in>S. P x \<longrightarrow> (\<exists>y. Q x y)) \<longleftrightarrow> (\<exists>f. \<forall>x\<in>S. P x \<longrightarrow> Q x (f x))" |
105 lemma bchoice_iff': "(\<forall>x\<in>S. P x \<longrightarrow> (\<exists>y. Q x y)) \<longleftrightarrow> (\<exists>f. \<forall>x\<in>S. P x \<longrightarrow> Q x (f x))" |
102 by (fast elim: someI) |
106 by (fast elim: someI) |
103 |
107 |
104 lemma dependent_nat_choice: |
108 lemma dependent_nat_choice: |
105 assumes 1: "\<exists>x. P 0 x" and |
109 assumes 1: "\<exists>x. P 0 x" and |
106 2: "\<And>x n. P n x \<Longrightarrow> \<exists>y. P (Suc n) y \<and> Q n x y" |
110 2: "\<And>x n. P n x \<Longrightarrow> \<exists>y. P (Suc n) y \<and> Q n x y" |
107 shows "\<exists>f. \<forall>n. P n (f n) \<and> Q n (f n) (f (Suc n))" |
111 shows "\<exists>f. \<forall>n. P n (f n) \<and> Q n (f n) (f (Suc n))" |
108 proof (intro exI allI conjI) |
112 proof (intro exI allI conjI) |
109 fix n def f \<equiv> "rec_nat (SOME x. P 0 x) (\<lambda>n x. SOME y. P (Suc n) y \<and> Q n x y)" |
113 fix n def f \<equiv> "rec_nat (SOME x. P 0 x) (\<lambda>n x. SOME y. P (Suc n) y \<and> Q n x y)" |
110 have "P 0 (f 0)" "\<And>n. P n (f n) \<Longrightarrow> P (Suc n) (f (Suc n)) \<and> Q n (f n) (f (Suc n))" |
114 have "P 0 (f 0)" "\<And>n. P n (f n) \<Longrightarrow> P (Suc n) (f (Suc n)) \<and> Q n (f n) (f (Suc n))" |
261 apply auto |
265 apply auto |
262 apply (force simp add: bij_is_inj) |
266 apply (force simp add: bij_is_inj) |
263 apply (blast intro: bij_is_surj [THEN surj_f_inv_f, symmetric]) |
267 apply (blast intro: bij_is_surj [THEN surj_f_inv_f, symmetric]) |
264 done |
268 done |
265 |
269 |
266 lemma bij_vimage_eq_inv_image: "bij f ==> f -` A = inv f ` A" |
270 lemma bij_vimage_eq_inv_image: "bij f ==> f -` A = inv f ` A" |
267 apply (auto simp add: bij_is_surj [THEN surj_f_inv_f]) |
271 apply (auto simp add: bij_is_surj [THEN surj_f_inv_f]) |
268 apply (blast intro: bij_is_inj [THEN inv_into_f_f, symmetric]) |
272 apply (blast intro: bij_is_inj [THEN inv_into_f_f, symmetric]) |
269 done |
273 done |
270 |
274 |
271 lemma finite_fun_UNIVD1: |
275 lemma finite_fun_UNIVD1: |
310 { fix n have "Sseq n \<subseteq> S" "\<not> finite (Sseq n)" by (induct n) (auto simp add: Sseq_def inf) } |
314 { fix n have "Sseq n \<subseteq> S" "\<not> finite (Sseq n)" by (induct n) (auto simp add: Sseq_def inf) } |
311 moreover then have *: "\<And>n. pick n \<in> Sseq n" |
315 moreover then have *: "\<And>n. pick n \<in> Sseq n" |
312 unfolding pick_def by (subst (asm) finite.simps) (auto simp add: ex_in_conv intro: someI_ex) |
316 unfolding pick_def by (subst (asm) finite.simps) (auto simp add: ex_in_conv intro: someI_ex) |
313 ultimately have "range pick \<subseteq> S" by auto |
317 ultimately have "range pick \<subseteq> S" by auto |
314 moreover |
318 moreover |
315 { fix n m |
319 { fix n m |
316 have "pick n \<notin> Sseq (n + Suc m)" by (induct m) (auto simp add: Sseq_def pick_def) |
320 have "pick n \<notin> Sseq (n + Suc m)" by (induct m) (auto simp add: Sseq_def pick_def) |
317 with * have "pick n \<noteq> pick (n + Suc m)" by auto |
321 with * have "pick n \<noteq> pick (n + Suc m)" by auto |
318 } |
322 } |
319 then have "inj pick" by (intro linorder_injI) (auto simp add: less_iff_Suc_add) |
323 then have "inj pick" by (intro linorder_injI) (auto simp add: less_iff_Suc_add) |
320 ultimately show ?thesis by blast |
324 ultimately show ?thesis by blast |