| author | wenzelm | 
| Wed, 01 Aug 2007 16:55:40 +0200 | |
| changeset 24112 | 6c4e7d17f9b0 | 
| parent 23168 | fcdd4346fa6b | 
| child 24826 | 78e6a3cea367 | 
| 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 | |
| 14076 | 5 | *) | 
| 0 | 6 | |
| 14076 | 7 | header{*Zermelo-Fraenkel Set Theory*}
 | 
| 0 | 8 | |
| 16417 | 9 | theory ZF imports FOL begin | 
| 0 | 10 | |
| 23168 | 11 | ML {* reset eta_contract *}
 | 
| 12 | ||
| 3906 | 13 | global | 
| 14 | ||
| 14076 | 15 | typedecl i | 
| 16 | arities i :: "term" | |
| 0 | 17 | |
| 18 | consts | |
| 19 | ||
| 14076 | 20 |   "0"         :: "i"                  ("0")   --{*the empty set*}
 | 
| 21 |   Pow         :: "i => i"                     --{*power sets*}
 | |
| 22 |   Inf         :: "i"                          --{*infinite set*}
 | |
| 0 | 23 | |
| 14076 | 24 | text {*Bounded Quantifiers *}
 | 
| 25 | consts | |
| 13780 | 26 | Ball :: "[i, i => o] => o" | 
| 27 | Bex :: "[i, i => o] => o" | |
| 0 | 28 | |
| 14076 | 29 | text {*General Union and Intersection *}
 | 
| 30 | consts | |
| 13780 | 31 | Union :: "i => i" | 
| 32 | Inter :: "i => i" | |
| 0 | 33 | |
| 14076 | 34 | text {*Variations on Replacement *}
 | 
| 35 | consts | |
| 13144 | 36 | PrimReplace :: "[i, [i, i] => o] => i" | 
| 37 | Replace :: "[i, [i, i] => o] => i" | |
| 38 | RepFun :: "[i, i => i] => i" | |
| 39 | Collect :: "[i, i => o] => i" | |
| 0 | 40 | |
| 14883 | 41 | text{*Definite descriptions -- via Replace over the set "1"*}
 | 
| 14076 | 42 | consts | 
| 13780 | 43 | The :: "(i => o) => i" (binder "THE " 10) | 
| 13144 | 44 |   If          :: "[o, i, i] => i"     ("(if (_)/ then (_)/ else (_))" [10] 10)
 | 
| 6068 | 45 | |
| 46 | syntax | |
| 13144 | 47 |   old_if      :: "[o, i, i] => i"   ("if '(_,_,_')")
 | 
| 0 | 48 | |
| 6068 | 49 | translations | 
| 50 | "if(P,a,b)" => "If(P,a,b)" | |
| 51 | ||
| 52 | ||
| 14076 | 53 | text {*Finite Sets *}
 | 
| 6068 | 54 | consts | 
| 13780 | 55 | Upair :: "[i, i] => i" | 
| 56 | cons :: "[i, i] => i" | |
| 57 | succ :: "i => i" | |
| 0 | 58 | |
| 14076 | 59 | text {*Ordered Pairing *}
 | 
| 60 | consts | |
| 13780 | 61 | Pair :: "[i, i] => i" | 
| 62 | fst :: "i => i" | |
| 63 | snd :: "i => i" | |
| 14854 | 64 |   split :: "[[i, i] => 'a, i] => 'a::{}"  --{*for pattern-matching*}
 | 
| 0 | 65 | |
| 14076 | 66 | text {*Sigma and Pi Operators *}
 | 
| 67 | consts | |
| 13780 | 68 | Sigma :: "[i, i => i] => i" | 
| 69 | Pi :: "[i, i => i] => i" | |
| 0 | 70 | |
| 14076 | 71 | text {*Relations and Functions *}
 | 
| 72 | consts | |
| 73 | "domain" :: "i => i" | |
| 13144 | 74 | range :: "i => i" | 
| 75 | field :: "i => i" | |
| 76 | converse :: "i => i" | |
| 14076 | 77 |   relation    :: "i => o"        --{*recognizes sets of pairs*}
 | 
| 78 |   function    :: "i => o"        --{*recognizes functions; can have non-pairs*}
 | |
| 13144 | 79 | Lambda :: "[i, i => i] => i" | 
| 80 | restrict :: "[i, i] => i" | |
| 0 | 81 | |
| 14076 | 82 | text {*Infixes in order of decreasing precedence *}
 | 
| 83 | consts | |
| 0 | 84 | |
| 14076 | 85 |   "``"        :: "[i, i] => i"    (infixl 90) --{*image*}
 | 
| 86 |   "-``"       :: "[i, i] => i"    (infixl 90) --{*inverse image*}
 | |
| 87 |   "`"         :: "[i, i] => i"    (infixl 90) --{*function application*}
 | |
| 13780 | 88 | (*"*" :: "[i, i] => i" (infixr 80) [virtual] Cartesian product*) | 
| 14076 | 89 |   "Int"       :: "[i, i] => i"    (infixl 70) --{*binary intersection*}
 | 
| 90 |   "Un"        :: "[i, i] => i"    (infixl 65) --{*binary union*}
 | |
| 91 |   "-"         :: "[i, i] => i"    (infixl 65) --{*set difference*}
 | |
| 13780 | 92 | (*"->" :: "[i, i] => i" (infixr 60) [virtual] function spac\<epsilon>*) | 
| 14076 | 93 |   "<="        :: "[i, i] => o"    (infixl 50) --{*subset relation*}
 | 
| 94 |   ":"         :: "[i, i] => o"    (infixl 50) --{*membership relation*}
 | |
| 13144 | 95 | (*"~:" :: "[i, i] => o" (infixl 50) (*negated membership relation*)*) | 
| 0 | 96 | |
| 97 | ||
| 13780 | 98 | nonterminals "is" patterns | 
| 615 | 99 | |
| 100 | syntax | |
| 13144 | 101 |   ""          :: "i => is"                   ("_")
 | 
| 102 |   "@Enum"     :: "[i, is] => is"             ("_,/ _")
 | |
| 103 | "~:" :: "[i, i] => o" (infixl 50) | |
| 104 |   "@Finset"   :: "is => i"                   ("{(_)}")
 | |
| 105 |   "@Tuple"    :: "[i, is] => i"              ("<(_,/ _)>")
 | |
| 106 |   "@Collect"  :: "[pttrn, i, o] => i"        ("(1{_: _ ./ _})")
 | |
| 107 |   "@Replace"  :: "[pttrn, pttrn, i, o] => i" ("(1{_ ./ _: _, _})")
 | |
| 108 |   "@RepFun"   :: "[i, pttrn, i] => i"        ("(1{_ ./ _: _})" [51,0,51])
 | |
| 109 |   "@INTER"    :: "[pttrn, i, i] => i"        ("(3INT _:_./ _)" 10)
 | |
| 110 |   "@UNION"    :: "[pttrn, i, i] => i"        ("(3UN _:_./ _)" 10)
 | |
| 111 |   "@PROD"     :: "[pttrn, i, i] => i"        ("(3PROD _:_./ _)" 10)
 | |
| 112 |   "@SUM"      :: "[pttrn, i, i] => i"        ("(3SUM _:_./ _)" 10)
 | |
| 113 | "->" :: "[i, i] => i" (infixr 60) | |
| 114 | "*" :: "[i, i] => i" (infixr 80) | |
| 115 |   "@lam"      :: "[pttrn, i, i] => i"        ("(3lam _:_./ _)" 10)
 | |
| 116 |   "@Ball"     :: "[pttrn, i, o] => o"        ("(3ALL _:_./ _)" 10)
 | |
| 117 |   "@Bex"      :: "[pttrn, i, o] => o"        ("(3EX _:_./ _)" 10)
 | |
| 1106 
62bdb9e5722b
Added pattern-matching code from CHOL/Prod.thy.  Changed
 lcp parents: 
690diff
changeset | 118 | |
| 
62bdb9e5722b
Added pattern-matching code from CHOL/Prod.thy.  Changed
 lcp parents: 
690diff
changeset | 119 | (** Patterns -- extends pre-defined type "pttrn" used in abstractions **) | 
| 
62bdb9e5722b
Added pattern-matching code from CHOL/Prod.thy.  Changed
 lcp parents: 
690diff
changeset | 120 | |
| 13144 | 121 |   "@pattern"  :: "patterns => pttrn"         ("<_>")
 | 
| 122 |   ""          :: "pttrn => patterns"         ("_")
 | |
| 123 |   "@patterns" :: "[pttrn, patterns] => patterns"  ("_,/_")
 | |
| 615 | 124 | |
| 0 | 125 | translations | 
| 615 | 126 | "x ~: y" == "~ (x : y)" | 
| 0 | 127 |   "{x, xs}"     == "cons(x, {xs})"
 | 
| 128 |   "{x}"         == "cons(x, 0)"
 | |
| 129 |   "{x:A. P}"    == "Collect(A, %x. P)"
 | |
| 130 |   "{y. x:A, Q}" == "Replace(A, %x y. Q)"
 | |
| 615 | 131 |   "{b. x:A}"    == "RepFun(A, %x. b)"
 | 
| 0 | 132 |   "INT x:A. B"  == "Inter({B. x:A})"
 | 
| 133 |   "UN x:A. B"   == "Union({B. x:A})"
 | |
| 134 | "PROD x:A. B" => "Pi(A, %x. B)" | |
| 135 | "SUM x:A. B" => "Sigma(A, %x. B)" | |
| 17782 | 136 | "A -> B" => "Pi(A, %_. B)" | 
| 137 | "A * B" => "Sigma(A, %_. B)" | |
| 0 | 138 | "lam x:A. f" == "Lambda(A, %x. f)" | 
| 139 | "ALL x:A. P" == "Ball(A, %x. P)" | |
| 140 | "EX x:A. P" == "Bex(A, %x. P)" | |
| 37 | 141 | |
| 1106 
62bdb9e5722b
Added pattern-matching code from CHOL/Prod.thy.  Changed
 lcp parents: 
690diff
changeset | 142 | "<x, y, z>" == "<x, <y, z>>" | 
| 
62bdb9e5722b
Added pattern-matching code from CHOL/Prod.thy.  Changed
 lcp parents: 
690diff
changeset | 143 | "<x, y>" == "Pair(x, y)" | 
| 2286 | 144 | "%<x,y,zs>.b" == "split(%x <y,zs>.b)" | 
| 3840 | 145 | "%<x,y>.b" == "split(%x y. b)" | 
| 2286 | 146 | |
| 0 | 147 | |
| 12114 
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
 wenzelm parents: 
11322diff
changeset | 148 | syntax (xsymbols) | 
| 13780 | 149 | "op *" :: "[i, i] => i" (infixr "\<times>" 80) | 
| 150 | "op Int" :: "[i, i] => i" (infixl "\<inter>" 70) | |
| 151 | "op Un" :: "[i, i] => i" (infixl "\<union>" 65) | |
| 152 | "op ->" :: "[i, i] => i" (infixr "\<rightarrow>" 60) | |
| 153 | "op <=" :: "[i, i] => o" (infixl "\<subseteq>" 50) | |
| 154 | "op :" :: "[i, i] => o" (infixl "\<in>" 50) | |
| 155 | "op ~:" :: "[i, i] => o" (infixl "\<notin>" 50) | |
| 156 |   "@Collect"  :: "[pttrn, i, o] => i"        ("(1{_ \<in> _ ./ _})")
 | |
| 157 |   "@Replace"  :: "[pttrn, pttrn, i, o] => i" ("(1{_ ./ _ \<in> _, _})")
 | |
| 158 |   "@RepFun"   :: "[i, pttrn, i] => i"        ("(1{_ ./ _ \<in> _})" [51,0,51])
 | |
| 159 |   "@UNION"    :: "[pttrn, i, i] => i"        ("(3\<Union>_\<in>_./ _)" 10)
 | |
| 160 |   "@INTER"    :: "[pttrn, i, i] => i"        ("(3\<Inter>_\<in>_./ _)" 10)
 | |
| 161 |   Union       :: "i =>i"                     ("\<Union>_" [90] 90)
 | |
| 162 |   Inter       :: "i =>i"                     ("\<Inter>_" [90] 90)
 | |
| 163 |   "@PROD"     :: "[pttrn, i, i] => i"        ("(3\<Pi>_\<in>_./ _)" 10)
 | |
| 164 |   "@SUM"      :: "[pttrn, i, i] => i"        ("(3\<Sigma>_\<in>_./ _)" 10)
 | |
| 165 |   "@lam"      :: "[pttrn, i, i] => i"        ("(3\<lambda>_\<in>_./ _)" 10)
 | |
| 166 |   "@Ball"     :: "[pttrn, i, o] => o"        ("(3\<forall>_\<in>_./ _)" 10)
 | |
| 167 |   "@Bex"      :: "[pttrn, i, o] => o"        ("(3\<exists>_\<in>_./ _)" 10)
 | |
| 168 |   "@Tuple"    :: "[i, is] => i"              ("\<langle>(_,/ _)\<rangle>")
 | |
| 169 |   "@pattern"  :: "patterns => pttrn"         ("\<langle>_\<rangle>")
 | |
| 2540 | 170 | |
| 6340 | 171 | syntax (HTML output) | 
| 13780 | 172 | "op *" :: "[i, i] => i" (infixr "\<times>" 80) | 
| 14565 | 173 | "op Int" :: "[i, i] => i" (infixl "\<inter>" 70) | 
| 174 | "op Un" :: "[i, i] => i" (infixl "\<union>" 65) | |
| 175 | "op <=" :: "[i, i] => o" (infixl "\<subseteq>" 50) | |
| 176 | "op :" :: "[i, i] => o" (infixl "\<in>" 50) | |
| 177 | "op ~:" :: "[i, i] => o" (infixl "\<notin>" 50) | |
| 178 |   "@Collect"  :: "[pttrn, i, o] => i"        ("(1{_ \<in> _ ./ _})")
 | |
| 179 |   "@Replace"  :: "[pttrn, pttrn, i, o] => i" ("(1{_ ./ _ \<in> _, _})")
 | |
| 180 |   "@RepFun"   :: "[i, pttrn, i] => i"        ("(1{_ ./ _ \<in> _})" [51,0,51])
 | |
| 181 |   "@UNION"    :: "[pttrn, i, i] => i"        ("(3\<Union>_\<in>_./ _)" 10)
 | |
| 182 |   "@INTER"    :: "[pttrn, i, i] => i"        ("(3\<Inter>_\<in>_./ _)" 10)
 | |
| 183 |   Union       :: "i =>i"                     ("\<Union>_" [90] 90)
 | |
| 184 |   Inter       :: "i =>i"                     ("\<Inter>_" [90] 90)
 | |
| 185 |   "@PROD"     :: "[pttrn, i, i] => i"        ("(3\<Pi>_\<in>_./ _)" 10)
 | |
| 186 |   "@SUM"      :: "[pttrn, i, i] => i"        ("(3\<Sigma>_\<in>_./ _)" 10)
 | |
| 187 |   "@lam"      :: "[pttrn, i, i] => i"        ("(3\<lambda>_\<in>_./ _)" 10)
 | |
| 188 |   "@Ball"     :: "[pttrn, i, o] => o"        ("(3\<forall>_\<in>_./ _)" 10)
 | |
| 189 |   "@Bex"      :: "[pttrn, i, o] => o"        ("(3\<exists>_\<in>_./ _)" 10)
 | |
| 190 |   "@Tuple"    :: "[i, is] => i"              ("\<langle>(_,/ _)\<rangle>")
 | |
| 191 |   "@pattern"  :: "patterns => pttrn"         ("\<langle>_\<rangle>")
 | |
| 6340 | 192 | |
| 2540 | 193 | |
| 14227 | 194 | finalconsts | 
| 195 | 0 Pow Inf Union PrimReplace | |
| 196 | "op :" | |
| 197 | ||
| 13780 | 198 | defs | 
| 199 | (*don't try to use constdefs: the declaration order is tightly constrained*) | |
| 0 | 200 | |
| 615 | 201 | (* Bounded Quantifiers *) | 
| 14227 | 202 | Ball_def: "Ball(A, P) == \<forall>x. x\<in>A --> P(x)" | 
| 203 | Bex_def: "Bex(A, P) == \<exists>x. x\<in>A & P(x)" | |
| 690 | 204 | |
| 14227 | 205 | subset_def: "A <= B == \<forall>x\<in>A. x\<in>B" | 
| 690 | 206 | |
| 3906 | 207 | |
| 3940 | 208 | local | 
| 3906 | 209 | |
| 13780 | 210 | axioms | 
| 0 | 211 | |
| 615 | 212 | (* ZF axioms -- see Suppes p.238 | 
| 213 | Axioms for Union, Pow and Replace state existence only, | |
| 214 | uniqueness is derivable using extensionality. *) | |
| 0 | 215 | |
| 13780 | 216 | extension: "A = B <-> A <= B & B <= A" | 
| 14227 | 217 | Union_iff: "A \<in> Union(C) <-> (\<exists>B\<in>C. A\<in>B)" | 
| 218 | Pow_iff: "A \<in> Pow(B) <-> A <= B" | |
| 0 | 219 | |
| 615 | 220 | (*We may name this set, though it is not uniquely defined.*) | 
| 14227 | 221 | infinity: "0\<in>Inf & (\<forall>y\<in>Inf. succ(y): Inf)" | 
| 0 | 222 | |
| 615 | 223 | (*This formulation facilitates case analysis on A.*) | 
| 14227 | 224 | foundation: "A=0 | (\<exists>x\<in>A. \<forall>y\<in>x. y~:A)" | 
| 0 | 225 | |
| 615 | 226 | (*Schema axiom since predicate P is a higher-order variable*) | 
| 14227 | 227 | replacement: "(\<forall>x\<in>A. \<forall>y z. P(x,y) & P(x,z) --> y=z) ==> | 
| 228 | b \<in> PrimReplace(A,P) <-> (\<exists>x\<in>A. P(x,b))" | |
| 615 | 229 | |
| 14883 | 230 | |
| 690 | 231 | defs | 
| 232 | ||
| 615 | 233 | (* Derived form of replacement, restricting P to its functional part. | 
| 234 | The resulting set (for functional P) is the same as with | |
| 235 | PrimReplace, but the rules are simpler. *) | |
| 0 | 236 | |
| 13780 | 237 | Replace_def: "Replace(A,P) == PrimReplace(A, %x y. (EX!z. P(x,z)) & P(x,y))" | 
| 615 | 238 | |
| 239 | (* Functional form of replacement -- analgous to ML's map functional *) | |
| 0 | 240 | |
| 14227 | 241 |   RepFun_def:   "RepFun(A,f) == {y . x\<in>A, y=f(x)}"
 | 
| 0 | 242 | |
| 615 | 243 | (* Separation and Pairing can be derived from the Replacement | 
| 244 | and Powerset Axioms using the following definitions. *) | |
| 0 | 245 | |
| 14227 | 246 |   Collect_def:  "Collect(A,P) == {y . x\<in>A, x=y & P(x)}"
 | 
| 0 | 247 | |
| 615 | 248 | (*Unordered pairs (Upair) express binary union/intersection and cons; | 
| 249 |     set enumerations translate as {a,...,z} = cons(a,...,cons(z,0)...)*)
 | |
| 0 | 250 | |
| 14227 | 251 |   Upair_def: "Upair(a,b) == {y. x\<in>Pow(Pow(0)), (x=0 & y=a) | (x=Pow(0) & y=b)}"
 | 
| 13780 | 252 | cons_def: "cons(a,A) == Upair(a,a) Un A" | 
| 253 | succ_def: "succ(i) == cons(i, i)" | |
| 615 | 254 | |
| 2872 
ac81a17f86f8
Moved definitions (binary intersection, etc.) from upair.thy back to ZF.thy
 paulson parents: 
2540diff
changeset | 255 | (* Difference, general intersection, binary union and small intersection *) | 
| 
ac81a17f86f8
Moved definitions (binary intersection, etc.) from upair.thy back to ZF.thy
 paulson parents: 
2540diff
changeset | 256 | |
| 14227 | 257 |   Diff_def:      "A - B    == { x\<in>A . ~(x\<in>B) }"
 | 
| 258 |   Inter_def:     "Inter(A) == { x\<in>Union(A) . \<forall>y\<in>A. x\<in>y}"
 | |
| 13780 | 259 | Un_def: "A Un B == Union(Upair(A,B))" | 
| 260 | Int_def: "A Int B == Inter(Upair(A,B))" | |
| 2872 
ac81a17f86f8
Moved definitions (binary intersection, etc.) from upair.thy back to ZF.thy
 paulson parents: 
2540diff
changeset | 261 | |
| 14883 | 262 | (* definite descriptions *) | 
| 14227 | 263 |   the_def:      "The(P)    == Union({y . x \<in> {0}, P(y)})"
 | 
| 13780 | 264 | if_def: "if(P,a,b) == THE z. P & z=a | ~P & z=b" | 
| 0 | 265 | |
| 615 | 266 |   (* this "symmetric" definition works better than {{a}, {a,b}} *)
 | 
| 13780 | 267 |   Pair_def:     "<a,b>  == {{a,a}, {a,b}}"
 | 
| 14227 | 268 | fst_def: "fst(p) == THE a. \<exists>b. p=<a,b>" | 
| 269 | snd_def: "snd(p) == THE b. \<exists>a. p=<a,b>" | |
| 13780 | 270 | split_def: "split(c) == %p. c(fst(p), snd(p))" | 
| 14227 | 271 |   Sigma_def:    "Sigma(A,B) == \<Union>x\<in>A. \<Union>y\<in>B(x). {<x,y>}"
 | 
| 0 | 272 | |
| 615 | 273 | (* Operations on relations *) | 
| 0 | 274 | |
| 615 | 275 | (*converse of relation r, inverse of function*) | 
| 14227 | 276 |   converse_def: "converse(r) == {z. w\<in>r, \<exists>x y. w=<x,y> & z=<y,x>}"
 | 
| 0 | 277 | |
| 14227 | 278 |   domain_def:   "domain(r) == {x. w\<in>r, \<exists>y. w=<x,y>}"
 | 
| 13780 | 279 | range_def: "range(r) == domain(converse(r))" | 
| 280 | field_def: "field(r) == domain(r) Un range(r)" | |
| 14227 | 281 | relation_def: "relation(r) == \<forall>z\<in>r. \<exists>x y. z = <x,y>" | 
| 13780 | 282 | function_def: "function(r) == | 
| 14227 | 283 | \<forall>x y. <x,y>:r --> (\<forall>y'. <x,y'>:r --> y=y')" | 
| 284 |   image_def:    "r `` A  == {y : range(r) . \<exists>x\<in>A. <x,y> : r}"
 | |
| 13780 | 285 | vimage_def: "r -`` A == converse(r)``A" | 
| 0 | 286 | |
| 615 | 287 | (* Abstraction, application and Cartesian product of a family of sets *) | 
| 0 | 288 | |
| 14227 | 289 |   lam_def:      "Lambda(A,b) == {<x,b(x)> . x\<in>A}"
 | 
| 13780 | 290 |   apply_def:    "f`a == Union(f``{a})"
 | 
| 14227 | 291 |   Pi_def:       "Pi(A,B)  == {f\<in>Pow(Sigma(A,B)). A<=domain(f) & function(f)}"
 | 
| 0 | 292 | |
| 12891 | 293 | (* Restrict the relation r to the domain A *) | 
| 14227 | 294 |   restrict_def: "restrict(r,A) == {z : r. \<exists>x\<in>A. \<exists>y. z = <x,y>}"
 | 
| 13780 | 295 | |
| 296 | (* Pattern-matching and 'Dependent' type operators *) | |
| 297 | ||
| 298 | print_translation {*
 | |
| 299 |   [("Pi",    dependent_tr' ("@PROD", "op ->")),
 | |
| 300 |    ("Sigma", dependent_tr' ("@SUM", "op *"))];
 | |
| 301 | *} | |
| 302 | ||
| 303 | subsection {* Substitution*}
 | |
| 304 | ||
| 305 | (*Useful examples: singletonI RS subst_elem, subst_elem RSN (2,IntI) *) | |
| 14227 | 306 | lemma subst_elem: "[| b\<in>A; a=b |] ==> a\<in>A" | 
| 13780 | 307 | by (erule ssubst, assumption) | 
| 308 | ||
| 309 | ||
| 310 | subsection{*Bounded universal quantifier*}
 | |
| 311 | ||
| 14227 | 312 | lemma ballI [intro!]: "[| !!x. x\<in>A ==> P(x) |] ==> \<forall>x\<in>A. P(x)" | 
| 13780 | 313 | by (simp add: Ball_def) | 
| 314 | ||
| 15481 | 315 | lemmas strip = impI allI ballI | 
| 316 | ||
| 14227 | 317 | lemma bspec [dest?]: "[| \<forall>x\<in>A. P(x); x: A |] ==> P(x)" | 
| 13780 | 318 | by (simp add: Ball_def) | 
| 319 | ||
| 320 | (*Instantiates x first: better for automatic theorem proving?*) | |
| 321 | lemma rev_ballE [elim]: | |
| 14227 | 322 | "[| \<forall>x\<in>A. P(x); x~:A ==> Q; P(x) ==> Q |] ==> Q" | 
| 13780 | 323 | by (simp add: Ball_def, blast) | 
| 324 | ||
| 14227 | 325 | lemma ballE: "[| \<forall>x\<in>A. P(x); P(x) ==> Q; x~:A ==> Q |] ==> Q" | 
| 13780 | 326 | by blast | 
| 327 | ||
| 328 | (*Used in the datatype package*) | |
| 14227 | 329 | lemma rev_bspec: "[| x: A; \<forall>x\<in>A. P(x) |] ==> P(x)" | 
| 13780 | 330 | by (simp add: Ball_def) | 
| 331 | ||
| 14227 | 332 | (*Trival rewrite rule; (\<forall>x\<in>A.P)<->P holds only if A is nonempty!*) | 
| 333 | lemma ball_triv [simp]: "(\<forall>x\<in>A. P) <-> ((\<exists>x. x\<in>A) --> P)" | |
| 13780 | 334 | by (simp add: Ball_def) | 
| 335 | ||
| 336 | (*Congruence rule for rewriting*) | |
| 337 | lemma ball_cong [cong]: | |
| 14227 | 338 | "[| A=A'; !!x. x\<in>A' ==> P(x) <-> P'(x) |] ==> (\<forall>x\<in>A. P(x)) <-> (\<forall>x\<in>A'. P'(x))" | 
| 13780 | 339 | by (simp add: Ball_def) | 
| 340 | ||
| 18845 | 341 | lemma atomize_ball: | 
| 342 | "(!!x. x \<in> A ==> P(x)) == Trueprop (\<forall>x\<in>A. P(x))" | |
| 343 | by (simp only: Ball_def atomize_all atomize_imp) | |
| 344 | ||
| 345 | lemmas [symmetric, rulify] = atomize_ball | |
| 346 | and [symmetric, defn] = atomize_ball | |
| 347 | ||
| 13780 | 348 | |
| 349 | subsection{*Bounded existential quantifier*}
 | |
| 350 | ||
| 14227 | 351 | lemma bexI [intro]: "[| P(x); x: A |] ==> \<exists>x\<in>A. P(x)" | 
| 13780 | 352 | by (simp add: Bex_def, blast) | 
| 353 | ||
| 14227 | 354 | (*The best argument order when there is only one x\<in>A*) | 
| 355 | lemma rev_bexI: "[| x\<in>A; P(x) |] ==> \<exists>x\<in>A. P(x)" | |
| 13780 | 356 | by blast | 
| 357 | ||
| 14227 | 358 | (*Not of the general form for such rules; ~\<exists>has become ALL~ *) | 
| 359 | lemma bexCI: "[| \<forall>x\<in>A. ~P(x) ==> P(a); a: A |] ==> \<exists>x\<in>A. P(x)" | |
| 13780 | 360 | by blast | 
| 361 | ||
| 14227 | 362 | lemma bexE [elim!]: "[| \<exists>x\<in>A. P(x); !!x. [| x\<in>A; P(x) |] ==> Q |] ==> Q" | 
| 13780 | 363 | by (simp add: Bex_def, blast) | 
| 364 | ||
| 14227 | 365 | (*We do not even have (\<exists>x\<in>A. True) <-> True unless A is nonempty!!*) | 
| 366 | lemma bex_triv [simp]: "(\<exists>x\<in>A. P) <-> ((\<exists>x. x\<in>A) & P)" | |
| 13780 | 367 | by (simp add: Bex_def) | 
| 368 | ||
| 369 | lemma bex_cong [cong]: | |
| 14227 | 370 | "[| A=A'; !!x. x\<in>A' ==> P(x) <-> P'(x) |] | 
| 371 | ==> (\<exists>x\<in>A. P(x)) <-> (\<exists>x\<in>A'. P'(x))" | |
| 13780 | 372 | by (simp add: Bex_def cong: conj_cong) | 
| 373 | ||
| 374 | ||
| 375 | ||
| 376 | subsection{*Rules for subsets*}
 | |
| 377 | ||
| 378 | lemma subsetI [intro!]: | |
| 14227 | 379 | "(!!x. x\<in>A ==> x\<in>B) ==> A <= B" | 
| 13780 | 380 | by (simp add: subset_def) | 
| 381 | ||
| 382 | (*Rule in Modus Ponens style [was called subsetE] *) | |
| 14227 | 383 | lemma subsetD [elim]: "[| A <= B; c\<in>A |] ==> c\<in>B" | 
| 13780 | 384 | apply (unfold subset_def) | 
| 385 | apply (erule bspec, assumption) | |
| 386 | done | |
| 387 | ||
| 388 | (*Classical elimination rule*) | |
| 389 | lemma subsetCE [elim]: | |
| 14227 | 390 | "[| A <= B; c~:A ==> P; c\<in>B ==> P |] ==> P" | 
| 13780 | 391 | by (simp add: subset_def, blast) | 
| 392 | ||
| 393 | (*Sometimes useful with premises in this order*) | |
| 14227 | 394 | lemma rev_subsetD: "[| c\<in>A; A<=B |] ==> c\<in>B" | 
| 13780 | 395 | by blast | 
| 396 | ||
| 397 | lemma contra_subsetD: "[| A <= B; c ~: B |] ==> c ~: A" | |
| 398 | by blast | |
| 399 | ||
| 400 | lemma rev_contra_subsetD: "[| c ~: B; A <= B |] ==> c ~: A" | |
| 401 | by blast | |
| 402 | ||
| 403 | lemma subset_refl [simp]: "A <= A" | |
| 404 | by blast | |
| 405 | ||
| 406 | lemma subset_trans: "[| A<=B; B<=C |] ==> A<=C" | |
| 407 | by blast | |
| 408 | ||
| 409 | (*Useful for proving A<=B by rewriting in some cases*) | |
| 410 | lemma subset_iff: | |
| 14227 | 411 | "A<=B <-> (\<forall>x. x\<in>A --> x\<in>B)" | 
| 13780 | 412 | apply (unfold subset_def Ball_def) | 
| 413 | apply (rule iff_refl) | |
| 414 | done | |
| 415 | ||
| 416 | ||
| 417 | subsection{*Rules for equality*}
 | |
| 418 | ||
| 419 | (*Anti-symmetry of the subset relation*) | |
| 420 | lemma equalityI [intro]: "[| A <= B; B <= A |] ==> A = B" | |
| 421 | by (rule extension [THEN iffD2], rule conjI) | |
| 422 | ||
| 423 | ||
| 14227 | 424 | lemma equality_iffI: "(!!x. x\<in>A <-> x\<in>B) ==> A = B" | 
| 13780 | 425 | by (rule equalityI, blast+) | 
| 426 | ||
| 427 | lemmas equalityD1 = extension [THEN iffD1, THEN conjunct1, standard] | |
| 428 | lemmas equalityD2 = extension [THEN iffD1, THEN conjunct2, standard] | |
| 429 | ||
| 430 | lemma equalityE: "[| A = B; [| A<=B; B<=A |] ==> P |] ==> P" | |
| 431 | by (blast dest: equalityD1 equalityD2) | |
| 432 | ||
| 433 | lemma equalityCE: | |
| 14227 | 434 | "[| A = B; [| c\<in>A; c\<in>B |] ==> P; [| c~:A; c~:B |] ==> P |] ==> P" | 
| 13780 | 435 | by (erule equalityE, blast) | 
| 436 | ||
| 437 | ||
| 438 | subsection{*Rules for Replace -- the derived form of replacement*}
 | |
| 439 | ||
| 440 | lemma Replace_iff: | |
| 14227 | 441 |     "b : {y. x\<in>A, P(x,y)}  <->  (\<exists>x\<in>A. P(x,b) & (\<forall>y. P(x,y) --> y=b))"
 | 
| 13780 | 442 | apply (unfold Replace_def) | 
| 443 | apply (rule replacement [THEN iff_trans], blast+) | |
| 444 | done | |
| 445 | ||
| 446 | (*Introduction; there must be a unique y such that P(x,y), namely y=b. *) | |
| 447 | lemma ReplaceI [intro]: | |
| 448 | "[| P(x,b); x: A; !!y. P(x,y) ==> y=b |] ==> | |
| 14227 | 449 |      b : {y. x\<in>A, P(x,y)}"
 | 
| 13780 | 450 | by (rule Replace_iff [THEN iffD2], blast) | 
| 451 | ||
| 452 | (*Elimination; may asssume there is a unique y such that P(x,y), namely y=b. *) | |
| 453 | lemma ReplaceE: | |
| 14227 | 454 |     "[| b : {y. x\<in>A, P(x,y)};   
 | 
| 455 | !!x. [| x: A; P(x,b); \<forall>y. P(x,y)-->y=b |] ==> R | |
| 13780 | 456 | |] ==> R" | 
| 457 | by (rule Replace_iff [THEN iffD1, THEN bexE], simp+) | |
| 458 | ||
| 459 | (*As above but without the (generally useless) 3rd assumption*) | |
| 460 | lemma ReplaceE2 [elim!]: | |
| 14227 | 461 |     "[| b : {y. x\<in>A, P(x,y)};   
 | 
| 13780 | 462 | !!x. [| x: A; P(x,b) |] ==> R | 
| 463 | |] ==> R" | |
| 464 | by (erule ReplaceE, blast) | |
| 465 | ||
| 466 | lemma Replace_cong [cong]: | |
| 14227 | 467 | "[| A=B; !!x y. x\<in>B ==> P(x,y) <-> Q(x,y) |] ==> | 
| 13780 | 468 | Replace(A,P) = Replace(B,Q)" | 
| 469 | apply (rule equality_iffI) | |
| 470 | apply (simp add: Replace_iff) | |
| 471 | done | |
| 472 | ||
| 473 | ||
| 474 | subsection{*Rules for RepFun*}
 | |
| 475 | ||
| 14227 | 476 | lemma RepFunI: "a \<in> A ==> f(a) : {f(x). x\<in>A}"
 | 
| 13780 | 477 | by (simp add: RepFun_def Replace_iff, blast) | 
| 478 | ||
| 479 | (*Useful for coinduction proofs*) | |
| 14227 | 480 | lemma RepFun_eqI [intro]: "[| b=f(a);  a \<in> A |] ==> b : {f(x). x\<in>A}"
 | 
| 13780 | 481 | apply (erule ssubst) | 
| 482 | apply (erule RepFunI) | |
| 483 | done | |
| 484 | ||
| 485 | lemma RepFunE [elim!]: | |
| 14227 | 486 |     "[| b : {f(x). x\<in>A};   
 | 
| 487 | !!x.[| x\<in>A; b=f(x) |] ==> P |] ==> | |
| 13780 | 488 | P" | 
| 489 | by (simp add: RepFun_def Replace_iff, blast) | |
| 490 | ||
| 491 | lemma RepFun_cong [cong]: | |
| 14227 | 492 | "[| A=B; !!x. x\<in>B ==> f(x)=g(x) |] ==> RepFun(A,f) = RepFun(B,g)" | 
| 13780 | 493 | by (simp add: RepFun_def) | 
| 494 | ||
| 14227 | 495 | lemma RepFun_iff [simp]: "b : {f(x). x\<in>A} <-> (\<exists>x\<in>A. b=f(x))"
 | 
| 13780 | 496 | by (unfold Bex_def, blast) | 
| 497 | ||
| 14227 | 498 | lemma triv_RepFun [simp]: "{x. x\<in>A} = A"
 | 
| 13780 | 499 | by blast | 
| 500 | ||
| 501 | ||
| 502 | subsection{*Rules for Collect -- forming a subset by separation*}
 | |
| 503 | ||
| 504 | (*Separation is derivable from Replacement*) | |
| 14227 | 505 | lemma separation [simp]: "a : {x\<in>A. P(x)} <-> a\<in>A & P(a)"
 | 
| 13780 | 506 | by (unfold Collect_def, blast) | 
| 507 | ||
| 14227 | 508 | lemma CollectI [intro!]: "[| a\<in>A;  P(a) |] ==> a : {x\<in>A. P(x)}"
 | 
| 13780 | 509 | by simp | 
| 510 | ||
| 14227 | 511 | lemma CollectE [elim!]: "[| a : {x\<in>A. P(x)};  [| a\<in>A; P(a) |] ==> R |] ==> R"
 | 
| 13780 | 512 | by simp | 
| 513 | ||
| 14227 | 514 | lemma CollectD1: "a : {x\<in>A. P(x)} ==> a\<in>A"
 | 
| 13780 | 515 | by (erule CollectE, assumption) | 
| 516 | ||
| 14227 | 517 | lemma CollectD2: "a : {x\<in>A. P(x)} ==> P(a)"
 | 
| 13780 | 518 | by (erule CollectE, assumption) | 
| 519 | ||
| 520 | lemma Collect_cong [cong]: | |
| 14227 | 521 | "[| A=B; !!x. x\<in>B ==> P(x) <-> Q(x) |] | 
| 13780 | 522 | ==> Collect(A, %x. P(x)) = Collect(B, %x. Q(x))" | 
| 523 | by (simp add: Collect_def) | |
| 524 | ||
| 525 | ||
| 526 | subsection{*Rules for Unions*}
 | |
| 527 | ||
| 528 | declare Union_iff [simp] | |
| 529 | ||
| 530 | (*The order of the premises presupposes that C is rigid; A may be flexible*) | |
| 531 | lemma UnionI [intro]: "[| B: C; A: B |] ==> A: Union(C)" | |
| 532 | by (simp, blast) | |
| 533 | ||
| 14227 | 534 | lemma UnionE [elim!]: "[| A \<in> Union(C); !!B.[| A: B; B: C |] ==> R |] ==> R" | 
| 13780 | 535 | by (simp, blast) | 
| 536 | ||
| 537 | ||
| 538 | subsection{*Rules for Unions of families*}
 | |
| 14227 | 539 | (* \<Union>x\<in>A. B(x) abbreviates Union({B(x). x\<in>A}) *)
 | 
| 13780 | 540 | |
| 14227 | 541 | lemma UN_iff [simp]: "b : (\<Union>x\<in>A. B(x)) <-> (\<exists>x\<in>A. b \<in> B(x))" | 
| 13780 | 542 | by (simp add: Bex_def, blast) | 
| 543 | ||
| 544 | (*The order of the premises presupposes that A is rigid; b may be flexible*) | |
| 14227 | 545 | lemma UN_I: "[| a: A; b: B(a) |] ==> b: (\<Union>x\<in>A. B(x))" | 
| 13780 | 546 | by (simp, blast) | 
| 547 | ||
| 548 | ||
| 549 | lemma UN_E [elim!]: | |
| 14227 | 550 | "[| b : (\<Union>x\<in>A. B(x)); !!x.[| x: A; b: B(x) |] ==> R |] ==> R" | 
| 13780 | 551 | by blast | 
| 552 | ||
| 553 | lemma UN_cong: | |
| 14227 | 554 | "[| A=B; !!x. x\<in>B ==> C(x)=D(x) |] ==> (\<Union>x\<in>A. C(x)) = (\<Union>x\<in>B. D(x))" | 
| 13780 | 555 | by simp | 
| 556 | ||
| 557 | ||
| 14227 | 558 | (*No "Addcongs [UN_cong]" because \<Union>is a combination of constants*) | 
| 13780 | 559 | |
| 560 | (* UN_E appears before UnionE so that it is tried first, to avoid expensive | |
| 561 | calls to hyp_subst_tac. Cannot include UN_I as it is unsafe: would enlarge | |
| 562 | the search space.*) | |
| 563 | ||
| 564 | ||
| 565 | subsection{*Rules for the empty set*}
 | |
| 566 | ||
| 14227 | 567 | (*The set {x\<in>0. False} is empty; by foundation it equals 0 
 | 
| 13780 | 568 | See Suppes, page 21.*) | 
| 569 | lemma not_mem_empty [simp]: "a ~: 0" | |
| 570 | apply (cut_tac foundation) | |
| 571 | apply (best dest: equalityD2) | |
| 572 | done | |
| 573 | ||
| 574 | lemmas emptyE [elim!] = not_mem_empty [THEN notE, standard] | |
| 575 | ||
| 576 | ||
| 577 | lemma empty_subsetI [simp]: "0 <= A" | |
| 578 | by blast | |
| 579 | ||
| 14227 | 580 | lemma equals0I: "[| !!y. y\<in>A ==> False |] ==> A=0" | 
| 13780 | 581 | by blast | 
| 582 | ||
| 583 | lemma equals0D [dest]: "A=0 ==> a ~: A" | |
| 584 | by blast | |
| 585 | ||
| 586 | declare sym [THEN equals0D, dest] | |
| 587 | ||
| 14227 | 588 | lemma not_emptyI: "a\<in>A ==> A ~= 0" | 
| 13780 | 589 | by blast | 
| 590 | ||
| 14227 | 591 | lemma not_emptyE: "[| A ~= 0; !!x. x\<in>A ==> R |] ==> R" | 
| 13780 | 592 | by blast | 
| 593 | ||
| 594 | ||
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 595 | subsection{*Rules for Inter*}
 | 
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 596 | |
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 597 | (*Not obviously useful for proving InterI, InterD, InterE*) | 
| 14227 | 598 | lemma Inter_iff: "A \<in> Inter(C) <-> (\<forall>x\<in>C. A: x) & C\<noteq>0" | 
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 599 | by (simp add: Inter_def Ball_def, blast) | 
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 600 | |
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 601 | (* Intersection is well-behaved only if the family is non-empty! *) | 
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 602 | lemma InterI [intro!]: | 
| 14227 | 603 | "[| !!x. x: C ==> A: x; C\<noteq>0 |] ==> A \<in> Inter(C)" | 
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 604 | by (simp add: Inter_iff) | 
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 605 | |
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 606 | (*A "destruct" rule -- every B in C contains A as an element, but | 
| 14227 | 607 | A\<in>B can hold when B\<in>C does not! This rule is analogous to "spec". *) | 
| 608 | lemma InterD [elim]: "[| A \<in> Inter(C); B \<in> C |] ==> A \<in> B" | |
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 609 | by (unfold Inter_def, blast) | 
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 610 | |
| 14227 | 611 | (*"Classical" elimination rule -- does not require exhibiting B\<in>C *) | 
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 612 | lemma InterE [elim]: | 
| 14227 | 613 | "[| A \<in> Inter(C); B~:C ==> R; A\<in>B ==> R |] ==> R" | 
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 614 | by (simp add: Inter_def, blast) | 
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 615 | |
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 616 | |
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 617 | subsection{*Rules for Intersections of families*}
 | 
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 618 | |
| 14227 | 619 | (* \<Inter>x\<in>A. B(x) abbreviates Inter({B(x). x\<in>A}) *)
 | 
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 620 | |
| 14227 | 621 | lemma INT_iff: "b : (\<Inter>x\<in>A. B(x)) <-> (\<forall>x\<in>A. b \<in> B(x)) & A\<noteq>0" | 
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 622 | by (force simp add: Inter_def) | 
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 623 | |
| 14227 | 624 | lemma INT_I: "[| !!x. x: A ==> b: B(x); A\<noteq>0 |] ==> b: (\<Inter>x\<in>A. B(x))" | 
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 625 | by blast | 
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 626 | |
| 14227 | 627 | lemma INT_E: "[| b : (\<Inter>x\<in>A. B(x)); a: A |] ==> b \<in> B(a)" | 
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 628 | by blast | 
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 629 | |
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 630 | lemma INT_cong: | 
| 14227 | 631 | "[| A=B; !!x. x\<in>B ==> C(x)=D(x) |] ==> (\<Inter>x\<in>A. C(x)) = (\<Inter>x\<in>B. D(x))" | 
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 632 | by simp | 
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 633 | |
| 14227 | 634 | (*No "Addcongs [INT_cong]" because \<Inter>is a combination of constants*) | 
| 14095 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 635 | |
| 
a1ba833d6b61
Changed many Intersection rules from i:I to I~=0 to avoid introducing a new
 paulson parents: 
14076diff
changeset | 636 | |
| 13780 | 637 | subsection{*Rules for Powersets*}
 | 
| 638 | ||
| 14227 | 639 | lemma PowI: "A <= B ==> A \<in> Pow(B)" | 
| 13780 | 640 | by (erule Pow_iff [THEN iffD2]) | 
| 641 | ||
| 14227 | 642 | lemma PowD: "A \<in> Pow(B) ==> A<=B" | 
| 13780 | 643 | by (erule Pow_iff [THEN iffD1]) | 
| 644 | ||
| 645 | declare Pow_iff [iff] | |
| 646 | ||
| 14227 | 647 | lemmas Pow_bottom = empty_subsetI [THEN PowI] (* 0 \<in> Pow(B) *) | 
| 648 | lemmas Pow_top = subset_refl [THEN PowI] (* A \<in> Pow(A) *) | |
| 13780 | 649 | |
| 650 | ||
| 651 | subsection{*Cantor's Theorem: There is no surjection from a set to its powerset.*}
 | |
| 652 | ||
| 653 | (*The search is undirected. Allowing redundant introduction rules may | |
| 654 | make it diverge. Variable b represents ANY map, such as | |
| 14227 | 655 | (lam x\<in>A.b(x)): A->Pow(A). *) | 
| 656 | lemma cantor: "\<exists>S \<in> Pow(A). \<forall>x\<in>A. b(x) ~= S" | |
| 13780 | 657 | by (best elim!: equalityCE del: ReplaceI RepFun_eqI) | 
| 658 | ||
| 659 | ML | |
| 660 | {*
 | |
| 661 | val lam_def = thm "lam_def"; | |
| 662 | val domain_def = thm "domain_def"; | |
| 663 | val range_def = thm "range_def"; | |
| 664 | val image_def = thm "image_def"; | |
| 665 | val vimage_def = thm "vimage_def"; | |
| 666 | val field_def = thm "field_def"; | |
| 667 | val Inter_def = thm "Inter_def"; | |
| 668 | val Ball_def = thm "Ball_def"; | |
| 669 | val Bex_def = thm "Bex_def"; | |
| 670 | ||
| 671 | val ballI = thm "ballI"; | |
| 672 | val bspec = thm "bspec"; | |
| 673 | val rev_ballE = thm "rev_ballE"; | |
| 674 | val ballE = thm "ballE"; | |
| 675 | val rev_bspec = thm "rev_bspec"; | |
| 676 | val ball_triv = thm "ball_triv"; | |
| 677 | val ball_cong = thm "ball_cong"; | |
| 678 | val bexI = thm "bexI"; | |
| 679 | val rev_bexI = thm "rev_bexI"; | |
| 680 | val bexCI = thm "bexCI"; | |
| 681 | val bexE = thm "bexE"; | |
| 682 | val bex_triv = thm "bex_triv"; | |
| 683 | val bex_cong = thm "bex_cong"; | |
| 684 | val subst_elem = thm "subst_elem"; | |
| 685 | val subsetI = thm "subsetI"; | |
| 686 | val subsetD = thm "subsetD"; | |
| 687 | val subsetCE = thm "subsetCE"; | |
| 688 | val rev_subsetD = thm "rev_subsetD"; | |
| 689 | val contra_subsetD = thm "contra_subsetD"; | |
| 690 | val rev_contra_subsetD = thm "rev_contra_subsetD"; | |
| 691 | val subset_refl = thm "subset_refl"; | |
| 692 | val subset_trans = thm "subset_trans"; | |
| 693 | val subset_iff = thm "subset_iff"; | |
| 694 | val equalityI = thm "equalityI"; | |
| 695 | val equality_iffI = thm "equality_iffI"; | |
| 696 | val equalityD1 = thm "equalityD1"; | |
| 697 | val equalityD2 = thm "equalityD2"; | |
| 698 | val equalityE = thm "equalityE"; | |
| 699 | val equalityCE = thm "equalityCE"; | |
| 700 | val Replace_iff = thm "Replace_iff"; | |
| 701 | val ReplaceI = thm "ReplaceI"; | |
| 702 | val ReplaceE = thm "ReplaceE"; | |
| 703 | val ReplaceE2 = thm "ReplaceE2"; | |
| 704 | val Replace_cong = thm "Replace_cong"; | |
| 705 | val RepFunI = thm "RepFunI"; | |
| 706 | val RepFun_eqI = thm "RepFun_eqI"; | |
| 707 | val RepFunE = thm "RepFunE"; | |
| 708 | val RepFun_cong = thm "RepFun_cong"; | |
| 709 | val RepFun_iff = thm "RepFun_iff"; | |
| 710 | val triv_RepFun = thm "triv_RepFun"; | |
| 711 | val separation = thm "separation"; | |
| 712 | val CollectI = thm "CollectI"; | |
| 713 | val CollectE = thm "CollectE"; | |
| 714 | val CollectD1 = thm "CollectD1"; | |
| 715 | val CollectD2 = thm "CollectD2"; | |
| 716 | val Collect_cong = thm "Collect_cong"; | |
| 717 | val UnionI = thm "UnionI"; | |
| 718 | val UnionE = thm "UnionE"; | |
| 719 | val UN_iff = thm "UN_iff"; | |
| 720 | val UN_I = thm "UN_I"; | |
| 721 | val UN_E = thm "UN_E"; | |
| 722 | val UN_cong = thm "UN_cong"; | |
| 723 | val Inter_iff = thm "Inter_iff"; | |
| 724 | val InterI = thm "InterI"; | |
| 725 | val InterD = thm "InterD"; | |
| 726 | val InterE = thm "InterE"; | |
| 727 | val INT_iff = thm "INT_iff"; | |
| 728 | val INT_I = thm "INT_I"; | |
| 729 | val INT_E = thm "INT_E"; | |
| 730 | val INT_cong = thm "INT_cong"; | |
| 731 | val PowI = thm "PowI"; | |
| 732 | val PowD = thm "PowD"; | |
| 733 | val Pow_bottom = thm "Pow_bottom"; | |
| 734 | val Pow_top = thm "Pow_top"; | |
| 735 | val not_mem_empty = thm "not_mem_empty"; | |
| 736 | val emptyE = thm "emptyE"; | |
| 737 | val empty_subsetI = thm "empty_subsetI"; | |
| 738 | val equals0I = thm "equals0I"; | |
| 739 | val equals0D = thm "equals0D"; | |
| 740 | val not_emptyI = thm "not_emptyI"; | |
| 741 | val not_emptyE = thm "not_emptyE"; | |
| 742 | val cantor = thm "cantor"; | |
| 743 | *} | |
| 744 | ||
| 745 | (*Functions for ML scripts*) | |
| 746 | ML | |
| 747 | {*
 | |
| 14227 | 748 | (*Converts A<=B to x\<in>A ==> x\<in>B*) | 
| 13780 | 749 | fun impOfSubs th = th RSN (2, rev_subsetD); | 
| 750 | ||
| 14227 | 751 | (*Takes assumptions \<forall>x\<in>A.P(x) and a\<in>A; creates assumption P(a)*) | 
| 13780 | 752 | val ball_tac = dtac bspec THEN' assume_tac | 
| 753 | *} | |
| 0 | 754 | |
| 755 | end | |
| 756 |