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