author | wenzelm |
Fri, 24 Feb 2023 11:07:31 +0100 | |
changeset 77363 | cbd053fff24c |
parent 76215 | a642599ffdea |
child 80777 | 623d46973cbe |
permissions | -rw-r--r-- |
35762 | 1 |
(* Title: ZF/ex/misc.thy |
11399 | 2 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
3 |
Copyright 1993 University of Cambridge |
|
4 |
||
5 |
Composition of homomorphisms, Pastre's examples, ... |
|
6 |
*) |
|
7 |
||
60770 | 8 |
section\<open>Miscellaneous ZF Examples\<close> |
14120 | 9 |
|
65449
c82e63b11b8b
clarified main ZF.thy / ZFC.thy, and avoid name clash with global HOL/Main.thy;
wenzelm
parents:
61798
diff
changeset
|
10 |
theory misc imports ZF begin |
11399 | 11 |
|
17093 | 12 |
|
60770 | 13 |
subsection\<open>Various Small Problems\<close> |
11399 | 14 |
|
60770 | 15 |
text\<open>The singleton problems are much harder in HOL.\<close> |
17093 | 16 |
lemma singleton_example_1: |
17 |
"\<forall>x \<in> S. \<forall>y \<in> S. x \<subseteq> y \<Longrightarrow> \<exists>z. S \<subseteq> {z}" |
|
18 |
by blast |
|
19 |
||
20 |
lemma singleton_example_2: |
|
21 |
"\<forall>x \<in> S. \<Union>S \<subseteq> x \<Longrightarrow> \<exists>z. S \<subseteq> {z}" |
|
61798 | 22 |
\<comment> \<open>Variant of the problem above.\<close> |
17093 | 23 |
by blast |
24 |
||
25 |
lemma "\<exists>!x. f (g(x)) = x \<Longrightarrow> \<exists>!y. g (f(y)) = y" |
|
61798 | 26 |
\<comment> \<open>A unique fixpoint theorem --- \<open>fast\<close>/\<open>best\<close>/\<open>auto\<close> all fail.\<close> |
17093 | 27 |
apply (erule ex1E, rule ex1I, erule subst_context) |
28 |
apply (rule subst, assumption, erule allE, rule subst_context, erule mp) |
|
29 |
apply (erule subst_context) |
|
30 |
done |
|
31 |
||
32 |
||
60770 | 33 |
text\<open>A weird property of ordered pairs.\<close> |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
34 |
lemma "b\<noteq>c \<Longrightarrow> \<langle>a,b\<rangle> \<inter> \<langle>a,c\<rangle> = \<langle>a,a\<rangle>" |
14120 | 35 |
by (simp add: Pair_def Int_cons_left Int_cons_right doubleton_eq_iff, blast) |
36 |
||
60770 | 37 |
text\<open>These two are cited in Benzmueller and Kohlhase's system description of |
38 |
LEO, CADE-15, 1998 (page 139-143) as theorems LEO could not prove.\<close> |
|
76214 | 39 |
lemma "(X = Y \<union> Z) \<longleftrightarrow> (Y \<subseteq> X \<and> Z \<subseteq> X \<and> (\<forall>V. Y \<subseteq> V \<and> Z \<subseteq> V \<longrightarrow> X \<subseteq> V))" |
11399 | 40 |
by (blast intro!: equalityI) |
41 |
||
60770 | 42 |
text\<open>the dual of the previous one\<close> |
76214 | 43 |
lemma "(X = Y \<inter> Z) \<longleftrightarrow> (X \<subseteq> Y \<and> X \<subseteq> Z \<and> (\<forall>V. V \<subseteq> Y \<and> V \<subseteq> Z \<longrightarrow> V \<subseteq> X))" |
11399 | 44 |
by (blast intro!: equalityI) |
45 |
||
60770 | 46 |
text\<open>trivial example of term synthesis: apparently hard for some provers!\<close> |
76214 | 47 |
schematic_goal "a \<noteq> b \<Longrightarrow> a:?X \<and> b \<notin> ?X" |
11399 | 48 |
by blast |
49 |
||
60770 | 50 |
text\<open>Nice blast benchmark. Proved in 0.3s; old tactics can't manage it!\<close> |
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
51 |
lemma "\<forall>x \<in> S. \<forall>y \<in> S. x \<subseteq> y \<Longrightarrow> \<exists>z. S \<subseteq> {z}" |
11399 | 52 |
by blast |
53 |
||
60770 | 54 |
text\<open>variant of the benchmark above\<close> |
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
55 |
lemma "\<forall>x \<in> S. \<Union>(S) \<subseteq> x \<Longrightarrow> \<exists>z. S \<subseteq> {z}" |
11399 | 56 |
by blast |
57 |
||
58 |
(*Example 12 (credited to Peter Andrews) from |
|
59 |
W. Bledsoe. A Maximal Method for Set Variables in Automatic Theorem-proving. |
|
60 |
In: J. Hayes and D. Michie and L. Mikulich, eds. Machine Intelligence 9. |
|
61 |
Ellis Horwood, 53-100 (1979). *) |
|
46822
95f1e700b712
mathematical symbols for Isabelle/ZF example theories
paulson
parents:
39991
diff
changeset
|
62 |
lemma "(\<forall>F. {x} \<in> F \<longrightarrow> {y} \<in> F) \<longrightarrow> (\<forall>A. x \<in> A \<longrightarrow> y \<in> A)" |
11399 | 63 |
by best |
64 |
||
60770 | 65 |
text\<open>A characterization of functions suggested by Tobias Nipkow\<close> |
76214 | 66 |
lemma "r \<in> domain(r)->B \<longleftrightarrow> r \<subseteq> domain(r)*B \<and> (\<forall>X. r `` (r -`` X) \<subseteq> X)" |
14120 | 67 |
by (unfold Pi_def function_def, best) |
11399 | 68 |
|
69 |
||
60770 | 70 |
subsection\<open>Composition of homomorphisms is a Homomorphism\<close> |
14120 | 71 |
|
60770 | 72 |
text\<open>Given as a challenge problem in |
11399 | 73 |
R. Boyer et al., |
76063 | 74 |
Set Theory in First-Order Logic: Clauses for Gödel's Axioms, |
60770 | 75 |
JAR 2 (1986), 287-327\<close> |
11399 | 76 |
|
60770 | 77 |
text\<open>collecting the relevant lemmas\<close> |
11399 | 78 |
declare comp_fun [simp] SigmaI [simp] apply_funtype [simp] |
79 |
||
80 |
(*Force helps prove conditions of rewrites such as comp_fun_apply, since |
|
81 |
rewriting does not instantiate Vars.*) |
|
82 |
lemma "(\<forall>A f B g. hom(A,f,B,g) = |
|
76214 | 83 |
{H \<in> A->B. f \<in> A*A->A \<and> g \<in> B*B->B \<and> |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
84 |
(\<forall>x \<in> A. \<forall>y \<in> A. H`(f`\<langle>x,y\<rangle>) = g`<H`x,H`y>)}) \<longrightarrow> |
76214 | 85 |
J \<in> hom(A,f,B,g) \<and> K \<in> hom(B,g,C,h) \<longrightarrow> |
11399 | 86 |
(K O J) \<in> hom(A,f,C,h)" |
87 |
by force |
|
88 |
||
60770 | 89 |
text\<open>Another version, with meta-level rewriting\<close> |
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
90 |
lemma "(\<And>A f B g. hom(A,f,B,g) \<equiv> |
76214 | 91 |
{H \<in> A->B. f \<in> A*A->A \<and> g \<in> B*B->B \<and> |
76215
a642599ffdea
More syntactic cleanup. LaTeX markup working
paulson <lp15@cam.ac.uk>
parents:
76214
diff
changeset
|
92 |
(\<forall>x \<in> A. \<forall>y \<in> A. H`(f`\<langle>x,y\<rangle>) = g`<H`x,H`y>)}) |
76214 | 93 |
\<Longrightarrow> J \<in> hom(A,f,B,g) \<and> K \<in> hom(B,g,C,h) \<longrightarrow> (K O J) \<in> hom(A,f,C,h)" |
11399 | 94 |
by force |
95 |
||
96 |
||
60770 | 97 |
subsection\<open>Pastre's Examples\<close> |
11399 | 98 |
|
60770 | 99 |
text\<open>D Pastre. Automatic theorem proving in set theory. |
14120 | 100 |
Artificial Intelligence, 10:1--27, 1978. |
60770 | 101 |
Previously, these were done using ML code, but blast manages fine.\<close> |
11399 | 102 |
|
103 |
lemmas compIs [intro] = comp_surj comp_inj comp_fun [intro] |
|
104 |
lemmas compDs [dest] = comp_mem_injD1 comp_mem_surjD1 |
|
105 |
comp_mem_injD2 comp_mem_surjD2 |
|
106 |
||
107 |
lemma pastre1: |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
108 |
"\<lbrakk>(h O g O f) \<in> inj(A,A); |
11399 | 109 |
(f O h O g) \<in> surj(B,B); |
110 |
(g O f O h) \<in> surj(C,C); |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
111 |
f \<in> A->B; g \<in> B->C; h \<in> C->A\<rbrakk> \<Longrightarrow> h \<in> bij(C,A)" |
11399 | 112 |
by (unfold bij_def, blast) |
113 |
||
114 |
lemma pastre3: |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
115 |
"\<lbrakk>(h O g O f) \<in> surj(A,A); |
11399 | 116 |
(f O h O g) \<in> surj(B,B); |
117 |
(g O f O h) \<in> inj(C,C); |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
118 |
f \<in> A->B; g \<in> B->C; h \<in> C->A\<rbrakk> \<Longrightarrow> h \<in> bij(C,A)" |
11399 | 119 |
by (unfold bij_def, blast) |
120 |
||
121 |
lemma pastre4: |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
122 |
"\<lbrakk>(h O g O f) \<in> surj(A,A); |
11399 | 123 |
(f O h O g) \<in> inj(B,B); |
124 |
(g O f O h) \<in> inj(C,C); |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
125 |
f \<in> A->B; g \<in> B->C; h \<in> C->A\<rbrakk> \<Longrightarrow> h \<in> bij(C,A)" |
11399 | 126 |
by (unfold bij_def, blast) |
127 |
||
128 |
lemma pastre5: |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
129 |
"\<lbrakk>(h O g O f) \<in> inj(A,A); |
11399 | 130 |
(f O h O g) \<in> surj(B,B); |
131 |
(g O f O h) \<in> inj(C,C); |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
132 |
f \<in> A->B; g \<in> B->C; h \<in> C->A\<rbrakk> \<Longrightarrow> h \<in> bij(C,A)" |
11399 | 133 |
by (unfold bij_def, blast) |
134 |
||
135 |
lemma pastre6: |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
136 |
"\<lbrakk>(h O g O f) \<in> inj(A,A); |
11399 | 137 |
(f O h O g) \<in> inj(B,B); |
138 |
(g O f O h) \<in> surj(C,C); |
|
76213
e44d86131648
Removal of obsolete ASCII syntax
paulson <lp15@cam.ac.uk>
parents:
76063
diff
changeset
|
139 |
f \<in> A->B; g \<in> B->C; h \<in> C->A\<rbrakk> \<Longrightarrow> h \<in> bij(C,A)" |
11399 | 140 |
by (unfold bij_def, blast) |
141 |
||
142 |
||
143 |
end |
|
144 |