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