author | lcp |
Thu, 06 Apr 1995 12:08:43 +0200 | |
changeset 1014 | 8bec0698d58c |
parent 690 | b2bd1d5a3d16 |
child 1106 | 62bdb9e5722b |
permissions | -rw-r--r-- |
615 | 1 |
(* Title: ZF/ZF.thy |
0 | 2 |
ID: $Id$ |
3 |
Author: Lawrence C Paulson and Martin D Coen, CU Computer Laboratory |
|
4 |
Copyright 1993 University of Cambridge |
|
5 |
||
6 |
Zermelo-Fraenkel Set Theory |
|
7 |
*) |
|
8 |
||
9 |
ZF = FOL + |
|
10 |
||
11 |
types |
|
615 | 12 |
i |
0 | 13 |
|
14 |
arities |
|
15 |
i :: term |
|
16 |
||
17 |
consts |
|
18 |
||
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
19 |
"0" :: "i" ("0") (*the empty set*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
20 |
Pow :: "i => i" (*power sets*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
21 |
Inf :: "i" (*infinite set*) |
0 | 22 |
|
23 |
(* Bounded Quantifiers *) |
|
24 |
||
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
25 |
Ball, Bex :: "[i, i => o] => o" |
0 | 26 |
|
27 |
(* General Union and Intersection *) |
|
28 |
||
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
29 |
Union,Inter :: "i => i" |
0 | 30 |
|
31 |
(* Variations on Replacement *) |
|
32 |
||
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
33 |
PrimReplace :: "[i, [i, i] => o] => i" |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
34 |
Replace :: "[i, [i, i] => o] => i" |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
35 |
RepFun :: "[i, i => i] => i" |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
36 |
Collect :: "[i, i => o] => i" |
0 | 37 |
|
38 |
(* Descriptions *) |
|
39 |
||
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
40 |
The :: "(i => o) => i" (binder "THE " 10) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
41 |
if :: "[o, i, i] => i" |
0 | 42 |
|
43 |
(* Finite Sets *) |
|
44 |
||
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
45 |
Upair, cons :: "[i, i] => i" |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
46 |
succ :: "i => i" |
0 | 47 |
|
615 | 48 |
(* Ordered Pairing *) |
0 | 49 |
|
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
50 |
Pair :: "[i, i] => i" |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
51 |
fst, snd :: "i => i" |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
52 |
split :: "[[i, i] => i, i] => i" |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
53 |
fsplit :: "[[i, i] => o, i] => o" |
0 | 54 |
|
55 |
(* Sigma and Pi Operators *) |
|
56 |
||
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
57 |
Sigma, Pi :: "[i, i => i] => i" |
0 | 58 |
|
59 |
(* Relations and Functions *) |
|
60 |
||
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
61 |
domain :: "i => i" |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
62 |
range :: "i => i" |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
63 |
field :: "i => i" |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
64 |
converse :: "i => i" |
690 | 65 |
function :: "i => o" (*is a relation a function?*) |
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
66 |
Lambda :: "[i, i => i] => i" |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
67 |
restrict :: "[i, i] => i" |
0 | 68 |
|
69 |
(* Infixes in order of decreasing precedence *) |
|
70 |
||
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
71 |
"``" :: "[i, i] => i" (infixl 90) (*image*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
72 |
"-``" :: "[i, i] => i" (infixl 90) (*inverse image*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
73 |
"`" :: "[i, i] => i" (infixl 90) (*function application*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
74 |
(*"*" :: "[i, i] => i" (infixr 80) (*Cartesian product*)*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
75 |
"Int" :: "[i, i] => i" (infixl 70) (*binary intersection*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
76 |
"Un" :: "[i, i] => i" (infixl 65) (*binary union*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
77 |
"-" :: "[i, i] => i" (infixl 65) (*set difference*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
78 |
(*"->" :: "[i, i] => i" (infixr 60) (*function space*)*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
79 |
"<=" :: "[i, i] => o" (infixl 50) (*subset relation*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
80 |
":" :: "[i, i] => o" (infixl 50) (*membership relation*) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
81 |
(*"~:" :: "[i, i] => o" (infixl 50) (*negated membership relation*)*) |
0 | 82 |
|
83 |
||
615 | 84 |
types |
85 |
is |
|
86 |
||
87 |
syntax |
|
675
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
88 |
"" :: "i => is" ("_") |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
89 |
"@Enum" :: "[i, is] => is" ("_,/ _") |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
90 |
"~:" :: "[i, i] => o" (infixl 50) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
91 |
"@Finset" :: "is => i" ("{(_)}") |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
92 |
"@Tuple" :: "[i, is] => i" ("<(_,/ _)>") |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
93 |
"@Collect" :: "[idt, i, o] => i" ("(1{_: _ ./ _})") |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
94 |
"@Replace" :: "[idt, idt, i, o] => i" ("(1{_ ./ _: _, _})") |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
95 |
"@RepFun" :: "[i, idt, i] => i" ("(1{_ ./ _: _})" [51,0,51]) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
96 |
"@INTER" :: "[idt, i, i] => i" ("(3INT _:_./ _)" 10) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
97 |
"@UNION" :: "[idt, i, i] => i" ("(3UN _:_./ _)" 10) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
98 |
"@PROD" :: "[idt, i, i] => i" ("(3PROD _:_./ _)" 10) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
99 |
"@SUM" :: "[idt, i, i] => i" ("(3SUM _:_./ _)" 10) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
100 |
"->" :: "[i, i] => i" (infixr 60) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
101 |
"*" :: "[i, i] => i" (infixr 80) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
102 |
"@lam" :: "[idt, i, i] => i" ("(3lam _:_./ _)" 10) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
103 |
"@Ball" :: "[idt, i, o] => o" ("(3ALL _:_./ _)" 10) |
59a4fa76b590
ZF/ZF.thy: added precedences to @RepFun to disambiguate phrases like {x:A.x:B}
lcp
parents:
632
diff
changeset
|
104 |
"@Bex" :: "[idt, i, o] => o" ("(3EX _:_./ _)" 10) |
615 | 105 |
|
0 | 106 |
translations |
615 | 107 |
"x ~: y" == "~ (x : y)" |
0 | 108 |
"{x, xs}" == "cons(x, {xs})" |
109 |
"{x}" == "cons(x, 0)" |
|
49 | 110 |
"<x, y, z>" == "<x, <y, z>>" |
111 |
"<x, y>" == "Pair(x, y)" |
|
0 | 112 |
"{x:A. P}" == "Collect(A, %x. P)" |
113 |
"{y. x:A, Q}" == "Replace(A, %x y. Q)" |
|
615 | 114 |
"{b. x:A}" == "RepFun(A, %x. b)" |
0 | 115 |
"INT x:A. B" == "Inter({B. x:A})" |
116 |
"UN x:A. B" == "Union({B. x:A})" |
|
117 |
"PROD x:A. B" => "Pi(A, %x. B)" |
|
118 |
"SUM x:A. B" => "Sigma(A, %x. B)" |
|
49 | 119 |
"A -> B" => "Pi(A, _K(B))" |
120 |
"A * B" => "Sigma(A, _K(B))" |
|
0 | 121 |
"lam x:A. f" == "Lambda(A, %x. f)" |
122 |
"ALL x:A. P" == "Ball(A, %x. P)" |
|
123 |
"EX x:A. P" == "Bex(A, %x. P)" |
|
37 | 124 |
|
0 | 125 |
|
690 | 126 |
defs |
0 | 127 |
|
615 | 128 |
(* Bounded Quantifiers *) |
129 |
Ball_def "Ball(A, P) == ALL x. x:A --> P(x)" |
|
130 |
Bex_def "Bex(A, P) == EX x. x:A & P(x)" |
|
690 | 131 |
|
615 | 132 |
subset_def "A <= B == ALL x:A. x:B" |
690 | 133 |
succ_def "succ(i) == cons(i, i)" |
134 |
||
135 |
rules |
|
0 | 136 |
|
615 | 137 |
(* ZF axioms -- see Suppes p.238 |
138 |
Axioms for Union, Pow and Replace state existence only, |
|
139 |
uniqueness is derivable using extensionality. *) |
|
0 | 140 |
|
615 | 141 |
extension "A = B <-> A <= B & B <= A" |
142 |
Union_iff "A : Union(C) <-> (EX B:C. A:B)" |
|
143 |
Pow_iff "A : Pow(B) <-> A <= B" |
|
0 | 144 |
|
615 | 145 |
(*We may name this set, though it is not uniquely defined.*) |
146 |
infinity "0:Inf & (ALL y:Inf. succ(y): Inf)" |
|
0 | 147 |
|
615 | 148 |
(*This formulation facilitates case analysis on A.*) |
149 |
foundation "A=0 | (EX x:A. ALL y:x. y~:A)" |
|
0 | 150 |
|
615 | 151 |
(*Schema axiom since predicate P is a higher-order variable*) |
152 |
replacement "(ALL x:A. ALL y z. P(x,y) & P(x,z) --> y=z) ==> \ |
|
153 |
\ b : PrimReplace(A,P) <-> (EX x:A. P(x,b))" |
|
154 |
||
690 | 155 |
defs |
156 |
||
615 | 157 |
(* Derived form of replacement, restricting P to its functional part. |
158 |
The resulting set (for functional P) is the same as with |
|
159 |
PrimReplace, but the rules are simpler. *) |
|
0 | 160 |
|
615 | 161 |
Replace_def "Replace(A,P) == PrimReplace(A, %x y. (EX!z.P(x,z)) & P(x,y))" |
162 |
||
163 |
(* Functional form of replacement -- analgous to ML's map functional *) |
|
0 | 164 |
|
615 | 165 |
RepFun_def "RepFun(A,f) == {y . x:A, y=f(x)}" |
0 | 166 |
|
615 | 167 |
(* Separation and Pairing can be derived from the Replacement |
168 |
and Powerset Axioms using the following definitions. *) |
|
0 | 169 |
|
615 | 170 |
Collect_def "Collect(A,P) == {y . x:A, x=y & P(x)}" |
0 | 171 |
|
615 | 172 |
(*Unordered pairs (Upair) express binary union/intersection and cons; |
173 |
set enumerations translate as {a,...,z} = cons(a,...,cons(z,0)...)*) |
|
0 | 174 |
|
615 | 175 |
Upair_def "Upair(a,b) == {y. x:Pow(Pow(0)), (x=0 & y=a) | (x=Pow(0) & y=b)}" |
176 |
cons_def "cons(a,A) == Upair(a,a) Un A" |
|
177 |
||
178 |
(* Difference, general intersection, binary union and small intersection *) |
|
0 | 179 |
|
615 | 180 |
Diff_def "A - B == { x:A . ~(x:B) }" |
181 |
Inter_def "Inter(A) == { x:Union(A) . ALL y:A. x:y}" |
|
182 |
Un_def "A Un B == Union(Upair(A,B))" |
|
183 |
Int_def "A Int B == Inter(Upair(A,B))" |
|
0 | 184 |
|
615 | 185 |
(* Definite descriptions -- via Replace over the set "1" *) |
0 | 186 |
|
615 | 187 |
the_def "The(P) == Union({y . x:{0}, P(y)})" |
188 |
if_def "if(P,a,b) == THE z. P & z=a | ~P & z=b" |
|
0 | 189 |
|
615 | 190 |
(* Ordered pairs and disjoint union of a family of sets *) |
0 | 191 |
|
615 | 192 |
(* this "symmetric" definition works better than {{a}, {a,b}} *) |
193 |
Pair_def "<a,b> == {{a,a}, {a,b}}" |
|
194 |
fst_def "fst == split(%x y.x)" |
|
195 |
snd_def "snd == split(%x y.y)" |
|
196 |
split_def "split(c,p) == THE y. EX a b. p=<a,b> & y=c(a,b)" |
|
197 |
fsplit_def "fsplit(R,z) == EX x y. z=<x,y> & R(x,y)" |
|
198 |
Sigma_def "Sigma(A,B) == UN x:A. UN y:B(x). {<x,y>}" |
|
0 | 199 |
|
615 | 200 |
(* Operations on relations *) |
0 | 201 |
|
615 | 202 |
(*converse of relation r, inverse of function*) |
203 |
converse_def "converse(r) == {z. w:r, EX x y. w=<x,y> & z=<y,x>}" |
|
0 | 204 |
|
615 | 205 |
domain_def "domain(r) == {x. w:r, EX y. w=<x,y>}" |
206 |
range_def "range(r) == domain(converse(r))" |
|
207 |
field_def "field(r) == domain(r) Un range(r)" |
|
690 | 208 |
function_def "function(r) == ALL x y. <x,y>:r --> \ |
209 |
\ (ALL y'. <x,y'>:r --> y=y')" |
|
615 | 210 |
image_def "r `` A == {y : range(r) . EX x:A. <x,y> : r}" |
211 |
vimage_def "r -`` A == converse(r)``A" |
|
0 | 212 |
|
615 | 213 |
(* Abstraction, application and Cartesian product of a family of sets *) |
0 | 214 |
|
615 | 215 |
lam_def "Lambda(A,b) == {<x,b(x)> . x:A}" |
216 |
apply_def "f`a == THE y. <a,y> : f" |
|
690 | 217 |
Pi_def "Pi(A,B) == {f: Pow(Sigma(A,B)). A<=domain(f) & function(f)}" |
0 | 218 |
|
219 |
(* Restrict the function f to the domain A *) |
|
615 | 220 |
restrict_def "restrict(f,A) == lam x:A.f`x" |
0 | 221 |
|
222 |
end |
|
223 |
||
224 |
||
225 |
ML |
|
226 |
||
227 |
(* 'Dependent' type operators *) |
|
228 |
||
229 |
val print_translation = |
|
632 | 230 |
[("Pi", dependent_tr' ("@PROD", "op ->")), |
231 |
("Sigma", dependent_tr' ("@SUM", "op *"))]; |