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