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