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