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