160 \end{eqnarray*} |
160 \end{eqnarray*} |
161 |
161 |
162 The constant \ttindexbold{Pair} constructs ordered pairs, as in {\tt |
162 The constant \ttindexbold{Pair} constructs ordered pairs, as in {\tt |
163 Pair($a$,$b$)}. Ordered pairs may also be written within angle brackets, |
163 Pair($a$,$b$)}. Ordered pairs may also be written within angle brackets, |
164 as {\tt<$a$,$b$>}. The $n$-tuple {\tt<$a@1$,\ldots,$a@{n-1}$,$a@n$>} |
164 as {\tt<$a$,$b$>}. The $n$-tuple {\tt<$a@1$,\ldots,$a@{n-1}$,$a@n$>} |
165 abbreviates the nest of pairs {\tt |
165 abbreviates the nest of pairs |
166 Pair($a@1$,\ldots,Pair($a@{n-1}$,$a@n$)\ldots)}. |
166 \begin{quote} |
|
167 \tt Pair($a@1$,\ldots,Pair($a@{n-1}$,$a@n$)\ldots). |
|
168 \end{quote} |
167 |
169 |
168 In {\ZF}, a function is a set of pairs. A {\ZF} function~$f$ is simply an |
170 In {\ZF}, a function is a set of pairs. A {\ZF} function~$f$ is simply an |
169 individual as far as Isabelle is concerned: its Isabelle type is~$i$, not |
171 individual as far as Isabelle is concerned: its Isabelle type is~$i$, not |
170 say $i\To i$. The infix operator~{\tt`} denotes the application of a |
172 say $i\To i$. The infix operator~{\tt`} denotes the application of a |
171 function set to its argument; we must write~$f{\tt`}x$, not~$f(x)$. The |
173 function set to its argument; we must write~$f{\tt`}x$, not~$f(x)$. The |
278 predicate is also called a {\bf class function}. |
280 predicate is also called a {\bf class function}. |
279 |
281 |
280 The constant \ttindexbold{RepFun} expresses a special case of replacement, |
282 The constant \ttindexbold{RepFun} expresses a special case of replacement, |
281 where $Q[x,y]$ has the form $y=b[x]$. Such a $Q$ is trivially |
283 where $Q[x,y]$ has the form $y=b[x]$. Such a $Q$ is trivially |
282 single-valued, since it is just the graph of the meta-level |
284 single-valued, since it is just the graph of the meta-level |
283 function~$\lambda x.b[x]$. The syntax is \hbox{\tt\{$b[x]$.$x$:$A$\}}, |
285 function~$\lambda x.b[x]$. The resulting set consists of all $b[x]$ |
284 denoting set {\tt RepFun($A$,$\lambda x.b[x]$)} of all $b[x]$ for~$x\in A$. |
286 for~$x\in A$. This is analogous to the \ML{} functional {\tt map}, since |
285 This is analogous to the \ML{} functional {\tt map}, since it applies a |
287 it applies a function to every element of a set. The syntax is |
286 function to every element of a set. |
288 \hbox{\tt\{$b[x]$.$x$:$A$\}}, which expands to {\tt RepFun($A$,$\lambda |
287 |
289 x.b[x]$)}. |
288 \indexbold{*INT}\indexbold{*UN} |
290 |
289 General unions and intersections of families, namely $\bigcup@{x\in A}B[x]$ and |
291 |
290 $\bigcap@{x\in A}B[x]$, are written \hbox{\tt UN $x$:$A$.$B[x]$} and |
292 \indexbold{*INT}\indexbold{*UN} |
291 \hbox{\tt INT $x$:$A$.$B[x]$}. Their meaning is expressed using {\tt |
293 General unions and intersections of indexed |
292 RepFun} as |
294 families of sets, namely $\bigcup@{x\in A}B[x]$ and $\bigcap@{x\in A}B[x]$, |
|
295 are written \hbox{\tt UN $x$:$A$.$B[x]$} and \hbox{\tt INT $x$:$A$.$B[x]$}. |
|
296 Their meaning is expressed using {\tt RepFun} as |
293 \[ \bigcup(\{B[x]. x\in A\}) \qquad\hbox{and}\qquad |
297 \[ \bigcup(\{B[x]. x\in A\}) \qquad\hbox{and}\qquad |
294 \bigcap(\{B[x]. x\in A\}). |
298 \bigcap(\{B[x]. x\in A\}). |
295 \] |
299 \] |
296 General sums $\sum@{x\in A}B[x]$ and products $\prod@{x\in A}B[x]$ can be |
300 General sums $\sum@{x\in A}B[x]$ and products $\prod@{x\in A}B[x]$ can be |
297 constructed in set theory, where $B[x]$ is a family of sets over~$A$. They |
301 constructed in set theory, where $B[x]$ is a family of sets over~$A$. They |
353 \idx{replacement} (ALL x:A. ALL y z. P(x,y) & P(x,z) --> y=z) ==> |
357 \idx{replacement} (ALL x:A. ALL y z. P(x,y) & P(x,z) --> y=z) ==> |
354 b : PrimReplace(A,P) <-> (EX x:A. P(x,b)) |
358 b : PrimReplace(A,P) <-> (EX x:A. P(x,b)) |
355 \subcaption{The Zermelo-Fraenkel Axioms} |
359 \subcaption{The Zermelo-Fraenkel Axioms} |
356 |
360 |
357 \idx{Replace_def} Replace(A,P) == |
361 \idx{Replace_def} Replace(A,P) == |
358 PrimReplace(A, %x y. (EX!z.P(x,z)) & P(x,y)) |
362 PrimReplace(A, \%x y. (EX!z.P(x,z)) & P(x,y)) |
359 \idx{RepFun_def} RepFun(A,f) == \{y . x:A, y=f(x)\} |
363 \idx{RepFun_def} RepFun(A,f) == \{y . x:A, y=f(x)\} |
360 \idx{the_def} The(P) == Union(\{y . x:\{0\}, P(y)\}) |
364 \idx{the_def} The(P) == Union(\{y . x:\{0\}, P(y)\}) |
361 \idx{if_def} if(P,a,b) == THE z. P & z=a | ~P & z=b |
365 \idx{if_def} if(P,a,b) == THE z. P & z=a | ~P & z=b |
362 \idx{Collect_def} Collect(A,P) == \{y . x:A, x=y & P(x)\} |
366 \idx{Collect_def} Collect(A,P) == \{y . x:A, x=y & P(x)\} |
363 \idx{Upair_def} Upair(a,b) == |
367 \idx{Upair_def} Upair(a,b) == |
381 \idx{infinity} 0:Inf & (ALL y:Inf. succ(y): Inf) |
385 \idx{infinity} 0:Inf & (ALL y:Inf. succ(y): Inf) |
382 \subcaption{Finite and infinite sets} |
386 \subcaption{Finite and infinite sets} |
383 |
387 |
384 \idx{Pair_def} <a,b> == \{\{a,a\}, \{a,b\}\} |
388 \idx{Pair_def} <a,b> == \{\{a,a\}, \{a,b\}\} |
385 \idx{split_def} split(c,p) == THE y. EX a b. p=<a,b> & y=c(a,b) |
389 \idx{split_def} split(c,p) == THE y. EX a b. p=<a,b> & y=c(a,b) |
386 \idx{fst_def} fst(A) == split(%x y.x, p) |
390 \idx{fst_def} fst(A) == split(\%x y.x, p) |
387 \idx{snd_def} snd(A) == split(%x y.y, p) |
391 \idx{snd_def} snd(A) == split(\%x y.y, p) |
388 \idx{Sigma_def} Sigma(A,B) == UN x:A. UN y:B(x). \{<x,y>\} |
392 \idx{Sigma_def} Sigma(A,B) == UN x:A. UN y:B(x). \{<x,y>\} |
389 \subcaption{Ordered pairs and Cartesian products} |
393 \subcaption{Ordered pairs and Cartesian products} |
390 |
394 |
391 \idx{converse_def} converse(r) == \{z. w:r, EX x y. w=<x,y> & z=<y,x>\} |
395 \idx{converse_def} converse(r) == \{z. w:r, EX x y. w=<x,y> & z=<y,x>\} |
392 \idx{domain_def} domain(r) == \{x. w:r, EX y. w=<x,y>\} |
396 \idx{domain_def} domain(r) == \{x. w:r, EX y. w=<x,y>\} |
493 \caption{General Union and Intersection} \label{ZF-lemmas3} |
497 \caption{General Union and Intersection} \label{ZF-lemmas3} |
494 \end{figure} |
498 \end{figure} |
495 |
499 |
496 |
500 |
497 \section{The Zermelo-Fraenkel axioms} |
501 \section{The Zermelo-Fraenkel axioms} |
498 The axioms appear in Figure~\ref{ZF-rules}. They resemble those |
502 The axioms appear in Fig.\ts \ref{ZF-rules}. They resemble those |
499 presented by Suppes~\cite{suppes72}. Most of the theory consists of |
503 presented by Suppes~\cite{suppes72}. Most of the theory consists of |
500 definitions. In particular, bounded quantifiers and the subset relation |
504 definitions. In particular, bounded quantifiers and the subset relation |
501 appear in other axioms. Object-level quantifiers and implications have |
505 appear in other axioms. Object-level quantifiers and implications have |
502 been replaced by meta-level ones wherever possible, to simplify use of the |
506 been replaced by meta-level ones wherever possible, to simplify use of the |
503 axioms. See the file \ttindexbold{ZF/zf.thy} for details. |
507 axioms. See the file {\tt ZF/zf.thy} for details. |
504 |
508 |
505 The traditional replacement axiom asserts |
509 The traditional replacement axiom asserts |
506 \[ y \in {\tt PrimReplace}(A,P) \bimp (\exists x\in A. P(x,y)) \] |
510 \[ y \in {\tt PrimReplace}(A,P) \bimp (\exists x\in A. P(x,y)) \] |
507 subject to the condition that $P(x,y)$ is single-valued for all~$x\in A$. |
511 subject to the condition that $P(x,y)$ is single-valued for all~$x\in A$. |
508 The Isabelle theory defines \ttindex{Replace} to apply |
512 The Isabelle theory defines \ttindex{Replace} to apply |
1152 |
1156 |
1153 \idx{nat_case_def} nat_case(a,b,k) == |
1157 \idx{nat_case_def} nat_case(a,b,k) == |
1154 THE y. k=0 & y=a | (EX x. k=succ(x) & y=b(x)) |
1158 THE y. k=0 & y=a | (EX x. k=succ(x) & y=b(x)) |
1155 |
1159 |
1156 \idx{rec_def} rec(k,a,b) == |
1160 \idx{rec_def} rec(k,a,b) == |
1157 transrec(k, %n f. nat_case(a, %m. b(m, f`m), n)) |
1161 transrec(k, \%n f. nat_case(a, \%m. b(m, f`m), n)) |
1158 |
1162 |
1159 \idx{add_def} m#+n == rec(m, n, %u v.succ(v)) |
1163 \idx{add_def} m#+n == rec(m, n, \%u v.succ(v)) |
1160 \idx{diff_def} m#-n == rec(n, m, %u v. rec(v, 0, %x y.x)) |
1164 \idx{diff_def} m#-n == rec(n, m, \%u v. rec(v, 0, \%x y.x)) |
1161 \idx{mult_def} m#*n == rec(m, 0, %u v. n #+ v) |
1165 \idx{mult_def} m#*n == rec(m, 0, \%u v. n #+ v) |
1162 \idx{mod_def} m mod n == transrec(m, %j f. if(j:n, j, f`(j#-n))) |
1166 \idx{mod_def} m mod n == transrec(m, \%j f. if(j:n, j, f`(j#-n))) |
1163 \idx{div_def} m div n == transrec(m, %j f. if(j:n, 0, succ(f`(j#-n)))) |
1167 \idx{div_def} m div n == transrec(m, \%j f. if(j:n, 0, succ(f`(j#-n)))) |
1164 \subcaption{Definitions} |
1168 \subcaption{Definitions} |
1165 |
1169 |
1166 \idx{nat_0I} 0 : nat |
1170 \idx{nat_0I} 0 : nat |
1167 \idx{nat_succI} n : nat ==> succ(n) : nat |
1171 \idx{nat_succI} n : nat ==> succ(n) : nat |
1168 |
1172 |
1211 \end{figure} |
1215 \end{figure} |
1212 |
1216 |
1213 \begin{figure}\underscoreon %%because @ is used here |
1217 \begin{figure}\underscoreon %%because @ is used here |
1214 \begin{ttbox} |
1218 \begin{ttbox} |
1215 \idx{list_rec_def} list_rec(l,c,h) == |
1219 \idx{list_rec_def} list_rec(l,c,h) == |
1216 Vrec(l, %l g.list_case(c, %x xs. h(x, xs, g`xs), l)) |
1220 Vrec(l, \%l g.list_case(c, \%x xs. h(x, xs, g`xs), l)) |
1217 |
1221 |
1218 \idx{map_def} map(f,l) == list_rec(l, 0, %x xs r. <f(x), r>) |
1222 \idx{map_def} map(f,l) == list_rec(l, 0, \%x xs r. <f(x), r>) |
1219 \idx{length_def} length(l) == list_rec(l, 0, %x xs r. succ(r)) |
1223 \idx{length_def} length(l) == list_rec(l, 0, \%x xs r. succ(r)) |
1220 \idx{app_def} xs@ys == list_rec(xs, ys, %x xs r. <x,r>) |
1224 \idx{app_def} xs@ys == list_rec(xs, ys, \%x xs r. <x,r>) |
1221 \idx{rev_def} rev(l) == list_rec(l, 0, %x xs r. r @ <x,0>) |
1225 \idx{rev_def} rev(l) == list_rec(l, 0, \%x xs r. r @ <x,0>) |
1222 \idx{flat_def} flat(ls) == list_rec(ls, 0, %l ls r. l @ r) |
1226 \idx{flat_def} flat(ls) == list_rec(ls, 0, \%l ls r. l @ r) |
1223 \subcaption{Definitions} |
1227 \subcaption{Definitions} |
1224 |
1228 |
1225 \idx{NilI} Nil : list(A) |
1229 \idx{NilI} Nil : list(A) |
1226 \idx{ConsI} [| a: A; l: list(A) |] ==> Cons(a,l) : list(A) |
1230 \idx{ConsI} [| a: A; l: list(A) |] ==> Cons(a,l) : list(A) |
1227 |
1231 |
1237 \idx{list_mono} A<=B ==> list(A) <= list(B) |
1241 \idx{list_mono} A<=B ==> list(A) <= list(B) |
1238 |
1242 |
1239 \idx{list_rec_Nil} list_rec(Nil,c,h) = c |
1243 \idx{list_rec_Nil} list_rec(Nil,c,h) = c |
1240 \idx{list_rec_Cons} list_rec(Cons(a,l), c, h) = h(a, l, list_rec(l,c,h)) |
1244 \idx{list_rec_Cons} list_rec(Cons(a,l), c, h) = h(a, l, list_rec(l,c,h)) |
1241 |
1245 |
1242 \idx{map_ident} l: list(A) ==> map(%u.u, l) = l |
1246 \idx{map_ident} l: list(A) ==> map(\%u.u, l) = l |
1243 \idx{map_compose} l: list(A) ==> map(h, map(j,l)) = map(%u.h(j(u)), l) |
1247 \idx{map_compose} l: list(A) ==> map(h, map(j,l)) = map(\%u.h(j(u)), l) |
1244 \idx{map_app_distrib} xs: list(A) ==> map(h, xs@ys) = map(h,xs) @ map(h,ys) |
1248 \idx{map_app_distrib} xs: list(A) ==> map(h, xs@ys) = map(h,xs) @ map(h,ys) |
1245 \idx{map_type} |
1249 \idx{map_type} |
1246 [| l: list(A); !!x. x: A ==> h(x): B |] ==> map(h,l) : list(B) |
1250 [| l: list(A); !!x. x: A ==> h(x): B |] ==> map(h,l) : list(B) |
1247 \idx{map_flat} |
1251 \idx{map_flat} |
1248 ls: list(list(A)) ==> map(h, flat(ls)) = flat(map(map(h),ls)) |
1252 ls: list(list(A)) ==> map(h, flat(ls)) = flat(map(map(h),ls)) |
1256 some of the further constants and infixes that are declared in the various |
1260 some of the further constants and infixes that are declared in the various |
1257 theory extensions. |
1261 theory extensions. |
1258 |
1262 |
1259 Figure~\ref{zf-equalities} presents commutative, associative, distributive, |
1263 Figure~\ref{zf-equalities} presents commutative, associative, distributive, |
1260 and idempotency laws of union and intersection, along with other equations. |
1264 and idempotency laws of union and intersection, along with other equations. |
1261 See file \ttindexbold{ZF/equalities.ML}. |
1265 See file {\tt ZF/equalities.ML}. |
1262 |
1266 |
1263 Figure~\ref{zf-sum} defines $\{0,1\}$ as a set of booleans, with the usual |
1267 Figure~\ref{zf-sum} defines $\{0,1\}$ as a set of booleans, with the usual |
1264 operators including a conditional. It also defines the disjoint union of |
1268 operators including a conditional. It also defines the disjoint union of |
1265 two sets, with injections and a case analysis operator. See files |
1269 two sets, with injections and a case analysis operator. See files |
1266 \ttindexbold{ZF/bool.ML} and \ttindexbold{ZF/sum.ML}. |
1270 {\tt ZF/bool.ML} and {\tt ZF/sum.ML}. |
1267 |
1271 |
1268 Figure~\ref{zf-qpair} defines a notion of ordered pair that admits |
1272 Figure~\ref{zf-qpair} defines a notion of ordered pair that admits |
1269 non-well-founded tupling. Such pairs are written {\tt<$a$;$b$>}. It also |
1273 non-well-founded tupling. Such pairs are written {\tt<$a$;$b$>}. It also |
1270 defines the eliminator \ttindexbold{qsplit}, the converse operator |
1274 defines the eliminator \ttindexbold{qsplit}, the converse operator |
1271 \ttindexbold{qconverse}, and the summation operator \ttindexbold{QSigma}. |
1275 \ttindexbold{qconverse}, and the summation operator \ttindexbold{QSigma}. |
1274 disjoint sum using non-standard pairs. This will support co-inductive |
1278 disjoint sum using non-standard pairs. This will support co-inductive |
1275 definitions, for example of infinite lists. See file \ttindexbold{qpair.thy}. |
1279 definitions, for example of infinite lists. See file \ttindexbold{qpair.thy}. |
1276 |
1280 |
1277 Monotonicity properties of most of the set-forming operations are proved. |
1281 Monotonicity properties of most of the set-forming operations are proved. |
1278 These are useful for applying the Knaster-Tarski Fixedpoint Theorem. |
1282 These are useful for applying the Knaster-Tarski Fixedpoint Theorem. |
1279 See file \ttindexbold{ZF/mono.ML}. |
1283 See file {\tt ZF/mono.ML}. |
1280 |
1284 |
1281 Figure~\ref{zf-fixedpt} presents the Knaster-Tarski Fixedpoint Theorem, proved |
1285 Figure~\ref{zf-fixedpt} presents the Knaster-Tarski Fixedpoint Theorem, proved |
1282 for the lattice of subsets of a set. The theory defines least and greatest |
1286 for the lattice of subsets of a set. The theory defines least and greatest |
1283 fixedpoint operators with corresponding induction and co-induction rules. |
1287 fixedpoint operators with corresponding induction and co-induction rules. |
1284 Later definitions use these, such as the natural numbers and |
1288 Later definitions use these, such as the natural numbers and |
1285 the transitive closure operator. The (co-)inductive definition |
1289 the transitive closure operator. The (co-)inductive definition |
1286 package also uses them. See file \ttindexbold{ZF/fixedpt.ML}. |
1290 package also uses them. See file {\tt ZF/fixedpt.ML}. |
1287 |
1291 |
1288 Figure~\ref{zf-perm} defines composition and injective, surjective and |
1292 Figure~\ref{zf-perm} defines composition and injective, surjective and |
1289 bijective function spaces, with proofs of many of their properties. |
1293 bijective function spaces, with proofs of many of their properties. |
1290 See file \ttindexbold{ZF/perm.ML}. |
1294 See file {\tt ZF/perm.ML}. |
1291 |
1295 |
1292 Figure~\ref{zf-nat} presents the natural numbers, with induction and a |
1296 Figure~\ref{zf-nat} presents the natural numbers, with induction and a |
1293 primitive recursion operator. See file \ttindexbold{ZF/nat.ML}. File |
1297 primitive recursion operator. See file {\tt ZF/nat.ML}. File |
1294 \ttindexbold{ZF/arith.ML} develops arithmetic on the natural numbers. It |
1298 {\tt ZF/arith.ML} develops arithmetic on the natural numbers. It |
1295 defines addition, multiplication, subtraction, division, and remainder, |
1299 defines addition, multiplication, subtraction, division, and remainder, |
1296 proving the theorem $a \bmod b + (a/b)\times b = a$. Division and |
1300 proving the theorem $a \bmod b + (a/b)\times b = a$. Division and |
1297 remainder are defined by repeated subtraction, which requires well-founded |
1301 remainder are defined by repeated subtraction, which requires well-founded |
1298 rather than primitive recursion. |
1302 rather than primitive recursion. |
1299 |
1303 |
1300 The file \ttindexbold{ZF/univ.ML} defines a ``universe'' ${\tt univ}(A)$, |
1304 The file {\tt ZF/univ.ML} defines a ``universe'' ${\tt univ}(A)$, |
1301 for constructing datatypes such as trees. This set contains $A$ and the |
1305 for constructing datatypes such as trees. This set contains $A$ and the |
1302 natural numbers. Vitally, it is closed under finite products: ${\tt |
1306 natural numbers. Vitally, it is closed under finite products: ${\tt |
1303 univ}(A)\times{\tt univ}(A)\subseteq{\tt univ}(A)$. This file also |
1307 univ}(A)\times{\tt univ}(A)\subseteq{\tt univ}(A)$. This file also |
1304 defines set theory's cumulative hierarchy, traditionally written $V@\alpha$ |
1308 defines set theory's cumulative hierarchy, traditionally written $V@\alpha$ |
1305 where $\alpha$ is any ordinal. |
1309 where $\alpha$ is any ordinal. |
1306 |
1310 |
1307 The file \ttindexbold{ZF/quniv.ML} defines a ``universe'' ${\tt quniv}(A)$, |
1311 The file {\tt ZF/quniv.ML} defines a ``universe'' ${\tt quniv}(A)$, |
1308 for constructing co-datatypes such as streams. It is analogous to ${\tt |
1312 for constructing co-datatypes such as streams. It is analogous to ${\tt |
1309 univ}(A)$ but is closed under the non-standard product and sum. |
1313 univ}(A)$ but is closed under the non-standard product and sum. |
1310 |
1314 |
1311 Figure~\ref{zf-fin} presents the finite set operator; ${\tt Fin}(A)$ is the |
1315 Figure~\ref{zf-fin} presents the finite set operator; ${\tt Fin}(A)$ is the |
1312 set of all finite sets over~$A$. The definition employs Isabelle's |
1316 set of all finite sets over~$A$. The definition employs Isabelle's |
1313 inductive definition package, which proves the introduction rules |
1317 inductive definition package, which proves the introduction rules |
1314 automatically. The induction rule shown is stronger than the one proved by |
1318 automatically. The induction rule shown is stronger than the one proved by |
1315 the package. See file \ttindexbold{ZF/fin.ML}. |
1319 the package. See file {\tt ZF/fin.ML}. |
1316 |
1320 |
1317 Figure~\ref{zf-list} presents the set of lists over~$A$, ${\tt list}(A)$. |
1321 Figure~\ref{zf-list} presents the set of lists over~$A$, ${\tt list}(A)$. |
1318 The definition employs Isabelle's datatype package, which defines the |
1322 The definition employs Isabelle's datatype package, which defines the |
1319 introduction and induction rules automatically, as well as the constructors |
1323 introduction and induction rules automatically, as well as the constructors |
1320 and case operator (\verb|list_case|). See file \ttindexbold{ZF/list.ML}. |
1324 and case operator (\verb|list_case|). See file {\tt ZF/list.ML}. |
1321 The file \ttindexbold{ZF/listfn.thy} proceeds to define structural |
1325 The file {\tt ZF/listfn.thy} proceeds to define structural |
1322 recursion and the usual list functions. |
1326 recursion and the usual list functions. |
1323 |
1327 |
1324 The constructions of the natural numbers and lists make use of a suite of |
1328 The constructions of the natural numbers and lists make use of a suite of |
1325 operators for handling recursive function definitions. The developments are |
1329 operators for handling recursive function definitions. The developments are |
1326 summarized below: |
1330 summarized below: |
1327 \begin{description} |
1331 \begin{description} |
1328 \item[\ttindexbold{ZF/trancl.ML}] |
1332 \item[{\tt ZF/trancl.ML}] |
1329 defines the transitive closure of a relation (as a least fixedpoint). |
1333 defines the transitive closure of a relation (as a least fixedpoint). |
1330 |
1334 |
1331 \item[\ttindexbold{ZF/wf.ML}] |
1335 \item[{\tt ZF/wf.ML}] |
1332 proves the Well-Founded Recursion Theorem, using an elegant |
1336 proves the Well-Founded Recursion Theorem, using an elegant |
1333 approach of Tobias Nipkow. This theorem permits general recursive |
1337 approach of Tobias Nipkow. This theorem permits general recursive |
1334 definitions within set theory. |
1338 definitions within set theory. |
1335 |
1339 |
1336 \item[\ttindexbold{ZF/ord.ML}] defines the notions of transitive set and |
1340 \item[{\tt ZF/ord.ML}] defines the notions of transitive set and |
1337 ordinal number. It derives transfinite induction. A key definition is |
1341 ordinal number. It derives transfinite induction. A key definition is |
1338 {\bf less than}: $i<j$ if and only if $i$ and $j$ are both ordinals and |
1342 {\bf less than}: $i<j$ if and only if $i$ and $j$ are both ordinals and |
1339 $i\in j$. As a special case, it includes less than on the natural |
1343 $i\in j$. As a special case, it includes less than on the natural |
1340 numbers. |
1344 numbers. |
1341 |
1345 |
1342 \item[\ttindexbold{ZF/epsilon.ML}] |
1346 \item[{\tt ZF/epsilon.ML}] |
1343 derives $\epsilon$-induction and $\epsilon$-recursion, which are |
1347 derives $\epsilon$-induction and $\epsilon$-recursion, which are |
1344 generalizations of transfinite induction. It also defines |
1348 generalizations of transfinite induction. It also defines |
1345 \ttindexbold{rank}$(x)$, which is the least ordinal $\alpha$ such that $x$ |
1349 \ttindexbold{rank}$(x)$, which is the least ordinal $\alpha$ such that $x$ |
1346 is constructed at stage $\alpha$ of the cumulative hierarchy (thus $x\in |
1350 is constructed at stage $\alpha$ of the cumulative hierarchy (thus $x\in |
1347 V@{\alpha+1}$). |
1351 V@{\alpha+1}$). |
1377 f(x)=g(x)$. |
1381 f(x)=g(x)$. |
1378 \item |
1382 \item |
1379 \ttindexbold{ZF_ss} contains congruence rules for all the operators of |
1383 \ttindexbold{ZF_ss} contains congruence rules for all the operators of |
1380 {\ZF}, including the binding operators. It contains all the conversion |
1384 {\ZF}, including the binding operators. It contains all the conversion |
1381 rules, such as \ttindex{fst} and \ttindex{snd}, as well as the |
1385 rules, such as \ttindex{fst} and \ttindex{snd}, as well as the |
1382 rewrites shown in Figure~\ref{ZF-simpdata}. |
1386 rewrites shown in Fig.\ts\ref{ZF-simpdata}. |
1383 \item |
1387 \item |
1384 \ttindexbold{FOL_ss} is redeclared with the same {\FOL} rules as the |
1388 \ttindexbold{FOL_ss} is redeclared with the same {\FOL} rules as the |
1385 previous version, so that it may still be used. |
1389 previous version, so that it may still be used. |
1386 \end{itemize} |
1390 \end{itemize} |
1387 |
1391 |
1388 |
1392 |
1389 \section{The examples directory} |
1393 \section{The examples directory} |
1390 This directory contains further developments in {\ZF} set theory. Here is |
1394 This directory contains further developments in {\ZF} set theory. Here is |
1391 an overview; see the files themselves for more details. |
1395 an overview; see the files themselves for more details. |
1392 \begin{description} |
1396 \begin{description} |
1393 \item[\ttindexbold{ZF/ex/misc.ML}] contains miscellaneous examples such as |
1397 \item[{\tt ZF/ex/misc.ML}] contains miscellaneous examples such as |
1394 Cantor's Theorem, the Schr\"oder-Bernstein Theorem. and the |
1398 Cantor's Theorem, the Schr\"oder-Bernstein Theorem. and the |
1395 ``Composition of homomorphisms'' challenge~\cite{boyer86}. |
1399 ``Composition of homomorphisms'' challenge~\cite{boyer86}. |
1396 |
1400 |
1397 \item[\ttindexbold{ZF/ex/ramsey.ML}] |
1401 \item[{\tt ZF/ex/ramsey.ML}] |
1398 proves the finite exponent 2 version of Ramsey's Theorem, following Basin |
1402 proves the finite exponent 2 version of Ramsey's Theorem, following Basin |
1399 and Kaufmann's presentation~\cite{basin91}. |
1403 and Kaufmann's presentation~\cite{basin91}. |
1400 |
1404 |
1401 \item[\ttindexbold{ZF/ex/equiv.ML}] |
1405 \item[{\tt ZF/ex/equiv.ML}] |
1402 develops a ZF theory of equivalence classes, not using the Axiom of Choice. |
1406 develops a ZF theory of equivalence classes, not using the Axiom of Choice. |
1403 |
1407 |
1404 \item[\ttindexbold{ZF/ex/integ.ML}] |
1408 \item[{\tt ZF/ex/integ.ML}] |
1405 develops a theory of the integers as equivalence classes of pairs of |
1409 develops a theory of the integers as equivalence classes of pairs of |
1406 natural numbers. |
1410 natural numbers. |
1407 |
1411 |
1408 \item[\ttindexbold{ZF/ex/bin.ML}] |
1412 \item[{\tt ZF/ex/bin.ML}] |
1409 defines a datatype for two's complement binary integers. File |
1413 defines a datatype for two's complement binary integers. File |
1410 \ttindexbold{ZF/ex/binfn.ML} then develops rewrite rules for binary |
1414 {\tt binfn.ML} then develops rewrite rules for binary |
1411 arithmetic. For instance, $1359\times {-}2468 = {-}3354012$ takes under |
1415 arithmetic. For instance, $1359\times {-}2468 = {-}3354012$ takes under |
1412 14 seconds. |
1416 14 seconds. |
1413 |
1417 |
1414 \item[\ttindexbold{ZF/ex/bt.ML}] |
1418 \item[{\tt ZF/ex/bt.ML}] |
1415 defines the recursive data structure ${\tt bt}(A)$, labelled binary trees. |
1419 defines the recursive data structure ${\tt bt}(A)$, labelled binary trees. |
1416 |
1420 |
1417 \item[\ttindexbold{ZF/ex/term.ML}] |
1421 \item[{\tt ZF/ex/term.ML}] |
1418 and \ttindexbold{ZF/ex/termfn.ML} define a recursive data structure for |
1422 and {\tt termfn.ML} define a recursive data structure for |
1419 terms and term lists. These are simply finite branching trees. |
1423 terms and term lists. These are simply finite branching trees. |
1420 |
1424 |
1421 \item[\ttindexbold{ZF/ex/tf.ML}] |
1425 \item[{\tt ZF/ex/tf.ML}] |
1422 and \ttindexbold{ZF/ex/tf_fn.ML} define primitives for solving mutually |
1426 and {\tt tf_fn.ML} define primitives for solving mutually |
1423 recursive equations over sets. It constructs sets of trees and forests |
1427 recursive equations over sets. It constructs sets of trees and forests |
1424 as an example, including induction and recursion rules that handle the |
1428 as an example, including induction and recursion rules that handle the |
1425 mutual recursion. |
1429 mutual recursion. |
1426 |
1430 |
1427 \item[\ttindexbold{ZF/ex/prop.ML}] |
1431 \item[{\tt ZF/ex/prop.ML}] |
1428 and \ttindexbold{ZF/ex/proplog.ML} proves soundness and completeness of |
1432 and {\tt proplog.ML} proves soundness and completeness of |
1429 propositional logic. This illustrates datatype definitions, inductive |
1433 propositional logic. This illustrates datatype definitions, inductive |
1430 definitions, structural induction and rule induction. |
1434 definitions, structural induction and rule induction. |
1431 |
1435 |
1432 \item[\ttindexbold{ZF/ex/listn.ML}] |
1436 \item[{\tt ZF/ex/listn.ML}] |
1433 presents the inductive definition of the lists of $n$ elements~\cite{paulin92}. |
1437 presents the inductive definition of the lists of $n$ elements~\cite{paulin92}. |
1434 |
1438 |
1435 \item[\ttindexbold{ZF/ex/acc.ML}] |
1439 \item[{\tt ZF/ex/acc.ML}] |
1436 presents the inductive definition of the accessible part of a |
1440 presents the inductive definition of the accessible part of a |
1437 relation~\cite{paulin92}. |
1441 relation~\cite{paulin92}. |
1438 |
1442 |
1439 \item[\ttindexbold{ZF/ex/comb.ML}] |
1443 \item[{\tt ZF/ex/comb.ML}] |
1440 presents the datatype definition of combinators. File |
1444 presents the datatype definition of combinators. The file |
1441 \ttindexbold{ZF/ex/contract0.ML} defines contraction, while file |
1445 {\tt contract0.ML} defines contraction, while file |
1442 \ttindexbold{ZF/ex/parcontract.ML} defines parallel contraction and |
1446 {\tt parcontract.ML} defines parallel contraction and |
1443 proves the Church-Rosser Theorem. This case study follows Camilleri and |
1447 proves the Church-Rosser Theorem. This case study follows Camilleri and |
1444 Melham~\cite{camilleri92}. |
1448 Melham~\cite{camilleri92}. |
1445 |
1449 |
1446 \item[\ttindexbold{ZF/ex/llist.ML}] |
1450 \item[{\tt ZF/ex/llist.ML}] |
1447 and \ttindexbold{ZF/ex/llist_eq.ML} develop lazy lists in ZF and a notion |
1451 and {\tt llist_eq.ML} develop lazy lists in ZF and a notion |
1448 of co-induction for proving equations between them. |
1452 of co-induction for proving equations between them. |
1449 \end{description} |
1453 \end{description} |
1450 |
1454 |
1451 |
1455 |
1452 \section{A proof about powersets} |
1456 \section{A proof about powersets} |
1521 by (resolve_tac [PowI] 1); |
1528 by (resolve_tac [PowI] 1); |
1522 {\out Level 7} |
1529 {\out Level 7} |
1523 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1530 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1524 {\out 1. !!x. [| x : Pow(A); x : Pow(B) |] ==> x <= A Int B} |
1531 {\out 1. !!x. [| x : Pow(A); x : Pow(B) |] ==> x <= A Int B} |
1525 \end{ttbox} |
1532 \end{ttbox} |
1526 We perform the same replacement in the assumptions:\index{*PowD} |
1533 We perform the same replacement in the assumptions. This is a good |
|
1534 demonstration of the tactic \ttindex{dresolve_tac}:\index{*PowD} |
1527 \begin{ttbox} |
1535 \begin{ttbox} |
1528 by (REPEAT (dresolve_tac [PowD] 1)); |
1536 by (REPEAT (dresolve_tac [PowD] 1)); |
1529 {\out Level 8} |
1537 {\out Level 8} |
1530 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1538 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1531 {\out 1. !!x. [| x <= A; x <= B |] ==> x <= A Int B} |
1539 {\out 1. !!x. [| x <= A; x <= B |] ==> x <= A Int B} |
1532 \end{ttbox} |
1540 \end{ttbox} |
1533 Here, $x$ is a lower bound of $A$ and~$B$, but $A\inter B$ is the greatest |
1541 The assumptions are that $x$ is a lower bound of both $A$ and~$B$, but |
1534 lower bound:\index{*Int_greatest} |
1542 $A\inter B$ is the greatest lower bound:\index{*Int_greatest} |
1535 \begin{ttbox} |
1543 \begin{ttbox} |
1536 by (resolve_tac [Int_greatest] 1); |
1544 by (resolve_tac [Int_greatest] 1); |
1537 {\out Level 9} |
1545 {\out Level 9} |
1538 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1546 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1539 {\out 1. !!x. [| x <= A; x <= B |] ==> x <= A} |
1547 {\out 1. !!x. [| x <= A; x <= B |] ==> x <= A} |
1540 {\out 2. !!x. [| x <= A; x <= B |] ==> x <= B} |
1548 {\out 2. !!x. [| x <= A; x <= B |] ==> x <= B} |
|
1549 \end{ttbox} |
|
1550 To conclude the proof, we clear up the trivial subgoals: |
|
1551 \begin{ttbox} |
1541 by (REPEAT (assume_tac 1)); |
1552 by (REPEAT (assume_tac 1)); |
1542 {\out Level 10} |
1553 {\out Level 10} |
1543 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1554 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1544 {\out No subgoals!} |
1555 {\out No subgoals!} |
1545 \end{ttbox} |
1556 \end{ttbox} |
|
1557 \medskip |
1546 We could have performed this proof in one step by applying |
1558 We could have performed this proof in one step by applying |
1547 \ttindex{fast_tac} with the classical rule set \ttindex{ZF_cs}. But we |
1559 \ttindex{fast_tac} with the classical rule set \ttindex{ZF_cs}. Let us |
1548 must add \ttindex{equalityI} as an introduction rule, since extensionality |
1560 go back to the start: |
1549 is not used by default: |
|
1550 \begin{ttbox} |
1561 \begin{ttbox} |
1551 choplev 0; |
1562 choplev 0; |
1552 {\out Level 0} |
1563 {\out Level 0} |
1553 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1564 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1554 {\out 1. Pow(A Int B) = Pow(A) Int Pow(B)} |
1565 {\out 1. Pow(A Int B) = Pow(A) Int Pow(B)} |
|
1566 \end{ttbox} |
|
1567 We must add \ttindex{equalityI} to {\tt ZF_cs} as an introduction rule. |
|
1568 Extensionality is not used by default because many equalities can be proved |
|
1569 by rewriting. |
|
1570 \begin{ttbox} |
1555 by (fast_tac (ZF_cs addIs [equalityI]) 1); |
1571 by (fast_tac (ZF_cs addIs [equalityI]) 1); |
1556 {\out Level 1} |
1572 {\out Level 1} |
1557 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1573 {\out Pow(A Int B) = Pow(A) Int Pow(B)} |
1558 {\out No subgoals!} |
1574 {\out No subgoals!} |
1559 \end{ttbox} |
1575 \end{ttbox} |
1560 |
1576 In the past this was regarded as a difficult proof, as indeed it is if all |
|
1577 the symbols are replaced by their definitions. |
|
1578 \goodbreak |
1561 |
1579 |
1562 \section{Monotonicity of the union operator} |
1580 \section{Monotonicity of the union operator} |
1563 For another example, we prove that general union is monotonic: |
1581 For another example, we prove that general union is monotonic: |
1564 ${C\subseteq D}$ implies $\bigcup(C)\subseteq \bigcup(D)$. To begin, we |
1582 ${C\subseteq D}$ implies $\bigcup(C)\subseteq \bigcup(D)$. To begin, we |
1565 tackle the inclusion using \ttindex{subsetI}: |
1583 tackle the inclusion using \ttindex{subsetI}: |
1617 Again, \ttindex{fast_tac} with \ttindex{ZF_cs} can do this proof in one |
1635 Again, \ttindex{fast_tac} with \ttindex{ZF_cs} can do this proof in one |
1618 step, provided we somehow supply it with~{\tt prem}. We can either add |
1636 step, provided we somehow supply it with~{\tt prem}. We can either add |
1619 this premise to the assumptions using \ttindex{cut_facts_tac}, or add |
1637 this premise to the assumptions using \ttindex{cut_facts_tac}, or add |
1620 \hbox{\tt prem RS subsetD} to \ttindex{ZF_cs} as an introduction rule. |
1638 \hbox{\tt prem RS subsetD} to \ttindex{ZF_cs} as an introduction rule. |
1621 |
1639 |
1622 The file \ttindex{ZF/equalities.ML} has many similar proofs. |
1640 The file {\tt ZF/equalities.ML} has many similar proofs. |
1623 Reasoning about general intersection can be difficult because of its anomalous |
1641 Reasoning about general intersection can be difficult because of its anomalous |
1624 behavior on the empty set. However, \ttindex{fast_tac} copes well with |
1642 behavior on the empty set. However, \ttindex{fast_tac} copes well with |
1625 these. Here is a typical example: |
1643 these. Here is a typical example, borrowed from Devlin[page 12]{devlin79}: |
1626 \begin{ttbox} |
1644 \begin{ttbox} |
1627 a:C ==> (INT x:C. A(x) Int B(x)) = (INT x:C.A(x)) Int (INT x:C.B(x)) |
1645 a:C ==> (INT x:C. A(x) Int B(x)) = (INT x:C.A(x)) Int (INT x:C.B(x)) |
1628 \end{ttbox} |
1646 \end{ttbox} |
1629 In traditional notation this is |
1647 In traditional notation this is |
1630 \[ a\in C \,\Imp\, \bigcap@{x\in C} \Bigl(A(x) \inter B(x)\Bigr) = |
1648 \[ a\in C \,\Imp\, \bigcap@{x\in C} \Bigl(A(x) \inter B(x)\Bigr) = |
1637 $\lambda$-calculus style. This is generally easier than regarding |
1655 $\lambda$-calculus style. This is generally easier than regarding |
1638 functions as sets of ordered pairs. But sometimes we must look at the |
1656 functions as sets of ordered pairs. But sometimes we must look at the |
1639 underlying representation, as in the following proof |
1657 underlying representation, as in the following proof |
1640 of~\ttindex{fun_disjoint_apply1}. This states that if $f$ and~$g$ are |
1658 of~\ttindex{fun_disjoint_apply1}. This states that if $f$ and~$g$ are |
1641 functions with disjoint domains~$A$ and~$C$, and if $a\in A$, then |
1659 functions with disjoint domains~$A$ and~$C$, and if $a\in A$, then |
1642 $(f\union g)`a = f`a$: |
1660 $(f\un g)`a = f`a$: |
1643 \begin{ttbox} |
1661 \begin{ttbox} |
1644 val prems = goal ZF.thy |
1662 val prems = goal ZF.thy |
1645 "[| a:A; f: A->B; g: C->D; A Int C = 0 |] ==> \ttback |
1663 "[| a:A; f: A->B; g: C->D; A Int C = 0 |] ==> \ttback |
1646 \ttback (f Un g)`a = f`a"; |
1664 \ttback (f Un g)`a = f`a"; |
1647 {\out Level 0} |
1665 {\out Level 0} |
1648 {\out (f Un g) ` a = f ` a} |
1666 {\out (f Un g) ` a = f ` a} |
1649 {\out 1. (f Un g) ` a = f ` a} |
1667 {\out 1. (f Un g) ` a = f ` a} |
1650 \ttbreak |
1668 \end{ttbox} |
|
1669 Isabelle has produced the output above; the \ML{} top-level now echoes the |
|
1670 binding of {\tt prems}. |
|
1671 \begin{ttbox} |
1651 {\out val prems = ["a : A [a : A]",} |
1672 {\out val prems = ["a : A [a : A]",} |
1652 {\out "f : A -> B [f : A -> B]",} |
1673 {\out "f : A -> B [f : A -> B]",} |
1653 {\out "g : C -> D [g : C -> D]",} |
1674 {\out "g : C -> D [g : C -> D]",} |
1654 {\out "A Int C = 0 [A Int C = 0]"] : thm list} |
1675 {\out "A Int C = 0 [A Int C = 0]"] : thm list} |
1655 \end{ttbox} |
1676 \end{ttbox} |
1656 Using \ttindex{apply_equality}, we reduce the equality to reasoning about |
1677 Using \ttindex{apply_equality}, we reduce the equality to reasoning about |
1657 ordered pairs. |
1678 ordered pairs. The second subgoal is to verify that $f\un g$ is a function. |
1658 \begin{ttbox} |
1679 \begin{ttbox} |
1659 by (resolve_tac [apply_equality] 1); |
1680 by (resolve_tac [apply_equality] 1); |
1660 {\out Level 1} |
1681 {\out Level 1} |
1661 {\out (f Un g) ` a = f ` a} |
1682 {\out (f Un g) ` a = f ` a} |
1662 {\out 1. <a,f ` a> : f Un g} |
1683 {\out 1. <a,f ` a> : f Un g} |