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