author | wenzelm |
Fri, 04 Aug 2000 22:56:52 +0200 | |
changeset 9529 | d9434a9277a4 |
parent 8249 | 3fc32155372c |
child 9584 | af21f4364c05 |
permissions | -rw-r--r-- |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1 |
%% $Id$ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2 |
\chapter{Zermelo-Fraenkel Set Theory} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
3 |
\index{set theory|(} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
4 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
5 |
The theory~\thydx{ZF} implements Zermelo-Fraenkel set |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
6 |
theory~\cite{halmos60,suppes72} as an extension of~\texttt{FOL}, classical |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
7 |
first-order logic. The theory includes a collection of derived natural |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
8 |
deduction rules, for use with Isabelle's classical reasoner. Much |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
9 |
of it is based on the work of No\"el~\cite{noel}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
10 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
11 |
A tremendous amount of set theory has been formally developed, including the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
12 |
basic properties of relations, functions, ordinals and cardinals. Significant |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
13 |
results have been proved, such as the Schr\"oder-Bernstein Theorem, the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
14 |
Wellordering Theorem and a version of Ramsey's Theorem. \texttt{ZF} provides |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
15 |
both the integers and the natural numbers. General methods have been |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
16 |
developed for solving recursion equations over monotonic functors; these have |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
17 |
been applied to yield constructions of lists, trees, infinite lists, etc. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
18 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
19 |
\texttt{ZF} has a flexible package for handling inductive definitions, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
20 |
such as inference systems, and datatype definitions, such as lists and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
21 |
trees. Moreover it handles coinductive definitions, such as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
22 |
bisimulation relations, and codatatype definitions, such as streams. It |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
23 |
provides a streamlined syntax for defining primitive recursive functions over |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
24 |
datatypes. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
25 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
26 |
Because {\ZF} is an extension of {\FOL}, it provides the same |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
27 |
packages, namely \texttt{hyp_subst_tac}, the simplifier, and the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
28 |
classical reasoner. The default simpset and claset are usually |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
29 |
satisfactory. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
30 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
31 |
Published articles~\cite{paulson-set-I,paulson-set-II} describe \texttt{ZF} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
32 |
less formally than this chapter. Isabelle employs a novel treatment of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
33 |
non-well-founded data structures within the standard {\sc zf} axioms including |
6592 | 34 |
the Axiom of Foundation~\cite{paulson-mscs}. |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
35 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
36 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
37 |
\section{Which version of axiomatic set theory?} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
38 |
The two main axiom systems for set theory are Bernays-G\"odel~({\sc bg}) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
39 |
and Zermelo-Fraenkel~({\sc zf}). Resolution theorem provers can use {\sc |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
40 |
bg} because it is finite~\cite{boyer86,quaife92}. {\sc zf} does not |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
41 |
have a finite axiom system because of its Axiom Scheme of Replacement. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
42 |
This makes it awkward to use with many theorem provers, since instances |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
43 |
of the axiom scheme have to be invoked explicitly. Since Isabelle has no |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
44 |
difficulty with axiom schemes, we may adopt either axiom system. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
45 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
46 |
These two theories differ in their treatment of {\bf classes}, which are |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
47 |
collections that are `too big' to be sets. The class of all sets,~$V$, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
48 |
cannot be a set without admitting Russell's Paradox. In {\sc bg}, both |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
49 |
classes and sets are individuals; $x\in V$ expresses that $x$ is a set. In |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
50 |
{\sc zf}, all variables denote sets; classes are identified with unary |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
51 |
predicates. The two systems define essentially the same sets and classes, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
52 |
with similar properties. In particular, a class cannot belong to another |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
53 |
class (let alone a set). |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
54 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
55 |
Modern set theorists tend to prefer {\sc zf} because they are mainly concerned |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
56 |
with sets, rather than classes. {\sc bg} requires tiresome proofs that various |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
57 |
collections are sets; for instance, showing $x\in\{x\}$ requires showing that |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
58 |
$x$ is a set. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
59 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
60 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
61 |
\begin{figure} \small |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
62 |
\begin{center} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
63 |
\begin{tabular}{rrr} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
64 |
\it name &\it meta-type & \it description \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
65 |
\cdx{Let} & $[\alpha,\alpha\To\beta]\To\beta$ & let binder\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
66 |
\cdx{0} & $i$ & empty set\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
67 |
\cdx{cons} & $[i,i]\To i$ & finite set constructor\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
68 |
\cdx{Upair} & $[i,i]\To i$ & unordered pairing\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
69 |
\cdx{Pair} & $[i,i]\To i$ & ordered pairing\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
70 |
\cdx{Inf} & $i$ & infinite set\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
71 |
\cdx{Pow} & $i\To i$ & powerset\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
72 |
\cdx{Union} \cdx{Inter} & $i\To i$ & set union/intersection \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
73 |
\cdx{split} & $[[i,i]\To i, i] \To i$ & generalized projection\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
74 |
\cdx{fst} \cdx{snd} & $i\To i$ & projections\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
75 |
\cdx{converse}& $i\To i$ & converse of a relation\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
76 |
\cdx{succ} & $i\To i$ & successor\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
77 |
\cdx{Collect} & $[i,i\To o]\To i$ & separation\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
78 |
\cdx{Replace} & $[i, [i,i]\To o] \To i$ & replacement\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
79 |
\cdx{PrimReplace} & $[i, [i,i]\To o] \To i$ & primitive replacement\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
80 |
\cdx{RepFun} & $[i, i\To i] \To i$ & functional replacement\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
81 |
\cdx{Pi} \cdx{Sigma} & $[i,i\To i]\To i$ & general product/sum\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
82 |
\cdx{domain} & $i\To i$ & domain of a relation\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
83 |
\cdx{range} & $i\To i$ & range of a relation\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
84 |
\cdx{field} & $i\To i$ & field of a relation\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
85 |
\cdx{Lambda} & $[i, i\To i]\To i$ & $\lambda$-abstraction\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
86 |
\cdx{restrict}& $[i, i] \To i$ & restriction of a function\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
87 |
\cdx{The} & $[i\To o]\To i$ & definite description\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
88 |
\cdx{if} & $[o,i,i]\To i$ & conditional\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
89 |
\cdx{Ball} \cdx{Bex} & $[i, i\To o]\To o$ & bounded quantifiers |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
90 |
\end{tabular} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
91 |
\end{center} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
92 |
\subcaption{Constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
93 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
94 |
\begin{center} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
95 |
\index{*"`"` symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
96 |
\index{*"-"`"` symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
97 |
\index{*"` symbol}\index{function applications!in \ZF} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
98 |
\index{*"- symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
99 |
\index{*": symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
100 |
\index{*"<"= symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
101 |
\begin{tabular}{rrrr} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
102 |
\it symbol & \it meta-type & \it priority & \it description \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
103 |
\tt `` & $[i,i]\To i$ & Left 90 & image \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
104 |
\tt -`` & $[i,i]\To i$ & Left 90 & inverse image \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
105 |
\tt ` & $[i,i]\To i$ & Left 90 & application \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
106 |
\sdx{Int} & $[i,i]\To i$ & Left 70 & intersection ($\int$) \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
107 |
\sdx{Un} & $[i,i]\To i$ & Left 65 & union ($\un$) \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
108 |
\tt - & $[i,i]\To i$ & Left 65 & set difference ($-$) \\[1ex] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
109 |
\tt: & $[i,i]\To o$ & Left 50 & membership ($\in$) \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
110 |
\tt <= & $[i,i]\To o$ & Left 50 & subset ($\subseteq$) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
111 |
\end{tabular} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
112 |
\end{center} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
113 |
\subcaption{Infixes} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
114 |
\caption{Constants of {\ZF}} \label{zf-constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
115 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
116 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
117 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
118 |
\section{The syntax of set theory} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
119 |
The language of set theory, as studied by logicians, has no constants. The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
120 |
traditional axioms merely assert the existence of empty sets, unions, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
121 |
powersets, etc.; this would be intolerable for practical reasoning. The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
122 |
Isabelle theory declares constants for primitive sets. It also extends |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
123 |
\texttt{FOL} with additional syntax for finite sets, ordered pairs, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
124 |
comprehension, general union/intersection, general sums/products, and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
125 |
bounded quantifiers. In most other respects, Isabelle implements precisely |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
126 |
Zermelo-Fraenkel set theory. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
127 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
128 |
Figure~\ref{zf-constants} lists the constants and infixes of~\ZF, while |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
129 |
Figure~\ref{zf-trans} presents the syntax translations. Finally, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
130 |
Figure~\ref{zf-syntax} presents the full grammar for set theory, including |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
131 |
the constructs of \FOL. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
132 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
133 |
Local abbreviations can be introduced by a \texttt{let} construct whose |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
134 |
syntax appears in Fig.\ts\ref{zf-syntax}. Internally it is translated into |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
135 |
the constant~\cdx{Let}. It can be expanded by rewriting with its |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
136 |
definition, \tdx{Let_def}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
137 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
138 |
Apart from \texttt{let}, set theory does not use polymorphism. All terms in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
139 |
{\ZF} have type~\tydx{i}, which is the type of individuals and has class~{\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
140 |
term}. The type of first-order formulae, remember, is~\textit{o}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
141 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
142 |
Infix operators include binary union and intersection ($A\un B$ and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
143 |
$A\int B$), set difference ($A-B$), and the subset and membership |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
144 |
relations. Note that $a$\verb|~:|$b$ is translated to $\neg(a\in b)$. The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
145 |
union and intersection operators ($\bigcup A$ and $\bigcap A$) form the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
146 |
union or intersection of a set of sets; $\bigcup A$ means the same as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
147 |
$\bigcup@{x\in A}x$. Of these operators, only $\bigcup A$ is primitive. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
148 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
149 |
The constant \cdx{Upair} constructs unordered pairs; thus {\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
150 |
Upair($A$,$B$)} denotes the set~$\{A,B\}$ and \texttt{Upair($A$,$A$)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
151 |
denotes the singleton~$\{A\}$. General union is used to define binary |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
152 |
union. The Isabelle version goes on to define the constant |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
153 |
\cdx{cons}: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
154 |
\begin{eqnarray*} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
155 |
A\cup B & \equiv & \bigcup(\texttt{Upair}(A,B)) \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
156 |
\texttt{cons}(a,B) & \equiv & \texttt{Upair}(a,a) \un B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
157 |
\end{eqnarray*} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
158 |
The $\{a@1, \ldots\}$ notation abbreviates finite sets constructed in the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
159 |
obvious manner using~\texttt{cons} and~$\emptyset$ (the empty set): |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
160 |
\begin{eqnarray*} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
161 |
\{a,b,c\} & \equiv & \texttt{cons}(a,\texttt{cons}(b,\texttt{cons}(c,\emptyset))) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
162 |
\end{eqnarray*} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
163 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
164 |
The constant \cdx{Pair} constructs ordered pairs, as in {\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
165 |
Pair($a$,$b$)}. Ordered pairs may also be written within angle brackets, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
166 |
as {\tt<$a$,$b$>}. The $n$-tuple {\tt<$a@1$,\ldots,$a@{n-1}$,$a@n$>} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
167 |
abbreviates the nest of pairs\par\nobreak |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
168 |
\centerline{\texttt{Pair($a@1$,\ldots,Pair($a@{n-1}$,$a@n$)\ldots).}} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
169 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
170 |
In {\ZF}, a function is a set of pairs. A {\ZF} function~$f$ is simply an |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
171 |
individual as far as Isabelle is concerned: its Isabelle type is~$i$, not |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
172 |
say $i\To i$. The infix operator~{\tt`} denotes the application of a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
173 |
function set to its argument; we must write~$f{\tt`}x$, not~$f(x)$. The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
174 |
syntax for image is~$f{\tt``}A$ and that for inverse image is~$f{\tt-``}A$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
175 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
176 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
177 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
178 |
\index{lambda abs@$\lambda$-abstractions!in \ZF} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
179 |
\index{*"-"> symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
180 |
\index{*"* symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
181 |
\begin{center} \footnotesize\tt\frenchspacing |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
182 |
\begin{tabular}{rrr} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
183 |
\it external & \it internal & \it description \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
184 |
$a$ \ttilde: $b$ & \ttilde($a$ : $b$) & \rm negated membership\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
185 |
\ttlbrace$a@1$, $\ldots$, $a@n$\ttrbrace & cons($a@1$,$\ldots$,cons($a@n$,0)) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
186 |
\rm finite set \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
187 |
<$a@1$, $\ldots$, $a@{n-1}$, $a@n$> & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
188 |
Pair($a@1$,\ldots,Pair($a@{n-1}$,$a@n$)\ldots) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
189 |
\rm ordered $n$-tuple \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
190 |
\ttlbrace$x$:$A . P[x]$\ttrbrace & Collect($A$,$\lambda x. P[x]$) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
191 |
\rm separation \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
192 |
\ttlbrace$y . x$:$A$, $Q[x,y]$\ttrbrace & Replace($A$,$\lambda x\,y. Q[x,y]$) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
193 |
\rm replacement \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
194 |
\ttlbrace$b[x] . x$:$A$\ttrbrace & RepFun($A$,$\lambda x. b[x]$) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
195 |
\rm functional replacement \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
196 |
\sdx{INT} $x$:$A . B[x]$ & Inter(\ttlbrace$B[x] . x$:$A$\ttrbrace) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
197 |
\rm general intersection \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
198 |
\sdx{UN} $x$:$A . B[x]$ & Union(\ttlbrace$B[x] . x$:$A$\ttrbrace) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
199 |
\rm general union \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
200 |
\sdx{PROD} $x$:$A . B[x]$ & Pi($A$,$\lambda x. B[x]$) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
201 |
\rm general product \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
202 |
\sdx{SUM} $x$:$A . B[x]$ & Sigma($A$,$\lambda x. B[x]$) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
203 |
\rm general sum \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
204 |
$A$ -> $B$ & Pi($A$,$\lambda x. B$) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
205 |
\rm function space \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
206 |
$A$ * $B$ & Sigma($A$,$\lambda x. B$) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
207 |
\rm binary product \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
208 |
\sdx{THE} $x . P[x]$ & The($\lambda x. P[x]$) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
209 |
\rm definite description \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
210 |
\sdx{lam} $x$:$A . b[x]$ & Lambda($A$,$\lambda x. b[x]$) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
211 |
\rm $\lambda$-abstraction\\[1ex] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
212 |
\sdx{ALL} $x$:$A . P[x]$ & Ball($A$,$\lambda x. P[x]$) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
213 |
\rm bounded $\forall$ \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
214 |
\sdx{EX} $x$:$A . P[x]$ & Bex($A$,$\lambda x. P[x]$) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
215 |
\rm bounded $\exists$ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
216 |
\end{tabular} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
217 |
\end{center} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
218 |
\caption{Translations for {\ZF}} \label{zf-trans} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
219 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
220 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
221 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
222 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
223 |
\index{*let symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
224 |
\index{*in symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
225 |
\dquotes |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
226 |
\[\begin{array}{rcl} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
227 |
term & = & \hbox{expression of type~$i$} \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
228 |
& | & "let"~id~"="~term";"\dots";"~id~"="~term~"in"~term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
229 |
& | & "if"~term~"then"~term~"else"~term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
230 |
& | & "{\ttlbrace} " term\; ("," term)^* " {\ttrbrace}" \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
231 |
& | & "< " term\; ("," term)^* " >" \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
232 |
& | & "{\ttlbrace} " id ":" term " . " formula " {\ttrbrace}" \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
233 |
& | & "{\ttlbrace} " id " . " id ":" term ", " formula " {\ttrbrace}" \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
234 |
& | & "{\ttlbrace} " term " . " id ":" term " {\ttrbrace}" \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
235 |
& | & term " `` " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
236 |
& | & term " -`` " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
237 |
& | & term " ` " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
238 |
& | & term " * " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
239 |
& | & term " Int " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
240 |
& | & term " Un " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
241 |
& | & term " - " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
242 |
& | & term " -> " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
243 |
& | & "THE~~" id " . " formula\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
244 |
& | & "lam~~" id ":" term " . " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
245 |
& | & "INT~~" id ":" term " . " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
246 |
& | & "UN~~~" id ":" term " . " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
247 |
& | & "PROD~" id ":" term " . " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
248 |
& | & "SUM~~" id ":" term " . " term \\[2ex] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
249 |
formula & = & \hbox{expression of type~$o$} \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
250 |
& | & term " : " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
251 |
& | & term " \ttilde: " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
252 |
& | & term " <= " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
253 |
& | & term " = " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
254 |
& | & term " \ttilde= " term \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
255 |
& | & "\ttilde\ " formula \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
256 |
& | & formula " \& " formula \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
257 |
& | & formula " | " formula \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
258 |
& | & formula " --> " formula \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
259 |
& | & formula " <-> " formula \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
260 |
& | & "ALL " id ":" term " . " formula \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
261 |
& | & "EX~~" id ":" term " . " formula \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
262 |
& | & "ALL~" id~id^* " . " formula \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
263 |
& | & "EX~~" id~id^* " . " formula \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
264 |
& | & "EX!~" id~id^* " . " formula |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
265 |
\end{array} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
266 |
\] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
267 |
\caption{Full grammar for {\ZF}} \label{zf-syntax} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
268 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
269 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
270 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
271 |
\section{Binding operators} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
272 |
The constant \cdx{Collect} constructs sets by the principle of {\bf |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
273 |
separation}. The syntax for separation is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
274 |
\hbox{\tt\ttlbrace$x$:$A$.\ $P[x]$\ttrbrace}, where $P[x]$ is a formula |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
275 |
that may contain free occurrences of~$x$. It abbreviates the set {\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
276 |
Collect($A$,$\lambda x. P[x]$)}, which consists of all $x\in A$ that |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
277 |
satisfy~$P[x]$. Note that \texttt{Collect} is an unfortunate choice of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
278 |
name: some set theories adopt a set-formation principle, related to |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
279 |
replacement, called collection. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
280 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
281 |
The constant \cdx{Replace} constructs sets by the principle of {\bf |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
282 |
replacement}. The syntax |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
283 |
\hbox{\tt\ttlbrace$y$.\ $x$:$A$,$Q[x,y]$\ttrbrace} denotes the set {\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
284 |
Replace($A$,$\lambda x\,y. Q[x,y]$)}, which consists of all~$y$ such |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
285 |
that there exists $x\in A$ satisfying~$Q[x,y]$. The Replacement Axiom |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
286 |
has the condition that $Q$ must be single-valued over~$A$: for |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
287 |
all~$x\in A$ there exists at most one $y$ satisfying~$Q[x,y]$. A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
288 |
single-valued binary predicate is also called a {\bf class function}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
289 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
290 |
The constant \cdx{RepFun} expresses a special case of replacement, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
291 |
where $Q[x,y]$ has the form $y=b[x]$. Such a $Q$ is trivially |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
292 |
single-valued, since it is just the graph of the meta-level |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
293 |
function~$\lambda x. b[x]$. The resulting set consists of all $b[x]$ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
294 |
for~$x\in A$. This is analogous to the \ML{} functional \texttt{map}, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
295 |
since it applies a function to every element of a set. The syntax is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
296 |
\hbox{\tt\ttlbrace$b[x]$.\ $x$:$A$\ttrbrace}, which expands to {\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
297 |
RepFun($A$,$\lambda x. b[x]$)}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
298 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
299 |
\index{*INT symbol}\index{*UN symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
300 |
General unions and intersections of indexed |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
301 |
families of sets, namely $\bigcup@{x\in A}B[x]$ and $\bigcap@{x\in A}B[x]$, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
302 |
are written \hbox{\tt UN $x$:$A$.\ $B[x]$} and \hbox{\tt INT $x$:$A$.\ $B[x]$}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
303 |
Their meaning is expressed using \texttt{RepFun} as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
304 |
\[ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
305 |
\bigcup(\{B[x]. x\in A\}) \qquad\hbox{and}\qquad |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
306 |
\bigcap(\{B[x]. x\in A\}). |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
307 |
\] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
308 |
General sums $\sum@{x\in A}B[x]$ and products $\prod@{x\in A}B[x]$ can be |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
309 |
constructed in set theory, where $B[x]$ is a family of sets over~$A$. They |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
310 |
have as special cases $A\times B$ and $A\to B$, where $B$ is simply a set. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
311 |
This is similar to the situation in Constructive Type Theory (set theory |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
312 |
has `dependent sets') and calls for similar syntactic conventions. The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
313 |
constants~\cdx{Sigma} and~\cdx{Pi} construct general sums and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
314 |
products. Instead of \texttt{Sigma($A$,$B$)} and \texttt{Pi($A$,$B$)} we may |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
315 |
write |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
316 |
\hbox{\tt SUM $x$:$A$.\ $B[x]$} and \hbox{\tt PROD $x$:$A$.\ $B[x]$}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
317 |
\index{*SUM symbol}\index{*PROD symbol}% |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
318 |
The special cases as \hbox{\tt$A$*$B$} and \hbox{\tt$A$->$B$} abbreviate |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
319 |
general sums and products over a constant family.\footnote{Unlike normal |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
320 |
infix operators, {\tt*} and {\tt->} merely define abbreviations; there are |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
321 |
no constants~\texttt{op~*} and~\hbox{\tt op~->}.} Isabelle accepts these |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
322 |
abbreviations in parsing and uses them whenever possible for printing. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
323 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
324 |
\index{*THE symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
325 |
As mentioned above, whenever the axioms assert the existence and uniqueness |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
326 |
of a set, Isabelle's set theory declares a constant for that set. These |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
327 |
constants can express the {\bf definite description} operator~$\iota |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
328 |
x. P[x]$, which stands for the unique~$a$ satisfying~$P[a]$, if such exists. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
329 |
Since all terms in {\ZF} denote something, a description is always |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
330 |
meaningful, but we do not know its value unless $P[x]$ defines it uniquely. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
331 |
Using the constant~\cdx{The}, we may write descriptions as {\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
332 |
The($\lambda x. P[x]$)} or use the syntax \hbox{\tt THE $x$.\ $P[x]$}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
333 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
334 |
\index{*lam symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
335 |
Function sets may be written in $\lambda$-notation; $\lambda x\in A. b[x]$ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
336 |
stands for the set of all pairs $\pair{x,b[x]}$ for $x\in A$. In order for |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
337 |
this to be a set, the function's domain~$A$ must be given. Using the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
338 |
constant~\cdx{Lambda}, we may express function sets as {\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
339 |
Lambda($A$,$\lambda x. b[x]$)} or use the syntax \hbox{\tt lam $x$:$A$.\ $b[x]$}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
340 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
341 |
Isabelle's set theory defines two {\bf bounded quantifiers}: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
342 |
\begin{eqnarray*} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
343 |
\forall x\in A. P[x] &\hbox{abbreviates}& \forall x. x\in A\imp P[x] \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
344 |
\exists x\in A. P[x] &\hbox{abbreviates}& \exists x. x\in A\conj P[x] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
345 |
\end{eqnarray*} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
346 |
The constants~\cdx{Ball} and~\cdx{Bex} are defined |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
347 |
accordingly. Instead of \texttt{Ball($A$,$P$)} and \texttt{Bex($A$,$P$)} we may |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
348 |
write |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
349 |
\hbox{\tt ALL $x$:$A$.\ $P[x]$} and \hbox{\tt EX $x$:$A$.\ $P[x]$}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
350 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
351 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
352 |
%%%% ZF.thy |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
353 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
354 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
355 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
356 |
\tdx{Let_def} Let(s, f) == f(s) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
357 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
358 |
\tdx{Ball_def} Ball(A,P) == ALL x. x:A --> P(x) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
359 |
\tdx{Bex_def} Bex(A,P) == EX x. x:A & P(x) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
360 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
361 |
\tdx{subset_def} A <= B == ALL x:A. x:B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
362 |
\tdx{extension} A = B <-> A <= B & B <= A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
363 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
364 |
\tdx{Union_iff} A : Union(C) <-> (EX B:C. A:B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
365 |
\tdx{Pow_iff} A : Pow(B) <-> A <= B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
366 |
\tdx{foundation} A=0 | (EX x:A. ALL y:x. ~ y:A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
367 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
368 |
\tdx{replacement} (ALL x:A. ALL y z. P(x,y) & P(x,z) --> y=z) ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
369 |
b : PrimReplace(A,P) <-> (EX x:A. P(x,b)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
370 |
\subcaption{The Zermelo-Fraenkel Axioms} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
371 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
372 |
\tdx{Replace_def} Replace(A,P) == |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
373 |
PrimReplace(A, \%x y. (EX!z. P(x,z)) & P(x,y)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
374 |
\tdx{RepFun_def} RepFun(A,f) == {\ttlbrace}y . x:A, y=f(x)\ttrbrace |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
375 |
\tdx{the_def} The(P) == Union({\ttlbrace}y . x:{\ttlbrace}0{\ttrbrace}, P(y){\ttrbrace}) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
376 |
\tdx{if_def} if(P,a,b) == THE z. P & z=a | ~P & z=b |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
377 |
\tdx{Collect_def} Collect(A,P) == {\ttlbrace}y . x:A, x=y & P(x){\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
378 |
\tdx{Upair_def} Upair(a,b) == |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
379 |
{\ttlbrace}y. x:Pow(Pow(0)), (x=0 & y=a) | (x=Pow(0) & y=b){\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
380 |
\subcaption{Consequences of replacement} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
381 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
382 |
\tdx{Inter_def} Inter(A) == {\ttlbrace}x:Union(A) . ALL y:A. x:y{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
383 |
\tdx{Un_def} A Un B == Union(Upair(A,B)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
384 |
\tdx{Int_def} A Int B == Inter(Upair(A,B)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
385 |
\tdx{Diff_def} A - B == {\ttlbrace}x:A . x~:B{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
386 |
\subcaption{Union, intersection, difference} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
387 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
388 |
\caption{Rules and axioms of {\ZF}} \label{zf-rules} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
389 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
390 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
391 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
392 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
393 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
394 |
\tdx{cons_def} cons(a,A) == Upair(a,a) Un A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
395 |
\tdx{succ_def} succ(i) == cons(i,i) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
396 |
\tdx{infinity} 0:Inf & (ALL y:Inf. succ(y): Inf) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
397 |
\subcaption{Finite and infinite sets} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
398 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
399 |
\tdx{Pair_def} <a,b> == {\ttlbrace}{\ttlbrace}a,a{\ttrbrace}, {\ttlbrace}a,b{\ttrbrace}{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
400 |
\tdx{split_def} split(c,p) == THE y. EX a b. p=<a,b> & y=c(a,b) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
401 |
\tdx{fst_def} fst(A) == split(\%x y. x, p) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
402 |
\tdx{snd_def} snd(A) == split(\%x y. y, p) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
403 |
\tdx{Sigma_def} Sigma(A,B) == UN x:A. UN y:B(x). {\ttlbrace}<x,y>{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
404 |
\subcaption{Ordered pairs and Cartesian products} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
405 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
406 |
\tdx{converse_def} converse(r) == {\ttlbrace}z. w:r, EX x y. w=<x,y> & z=<y,x>{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
407 |
\tdx{domain_def} domain(r) == {\ttlbrace}x. w:r, EX y. w=<x,y>{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
408 |
\tdx{range_def} range(r) == domain(converse(r)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
409 |
\tdx{field_def} field(r) == domain(r) Un range(r) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
410 |
\tdx{image_def} r `` A == {\ttlbrace}y : range(r) . EX x:A. <x,y> : r{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
411 |
\tdx{vimage_def} r -`` A == converse(r)``A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
412 |
\subcaption{Operations on relations} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
413 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
414 |
\tdx{lam_def} Lambda(A,b) == {\ttlbrace}<x,b(x)> . x:A{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
415 |
\tdx{apply_def} f`a == THE y. <a,y> : f |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
416 |
\tdx{Pi_def} Pi(A,B) == {\ttlbrace}f: Pow(Sigma(A,B)). ALL x:A. EX! y. <x,y>: f{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
417 |
\tdx{restrict_def} restrict(f,A) == lam x:A. f`x |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
418 |
\subcaption{Functions and general product} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
419 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
420 |
\caption{Further definitions of {\ZF}} \label{zf-defs} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
421 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
422 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
423 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
424 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
425 |
\section{The Zermelo-Fraenkel axioms} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
426 |
The axioms appear in Fig.\ts \ref{zf-rules}. They resemble those |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
427 |
presented by Suppes~\cite{suppes72}. Most of the theory consists of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
428 |
definitions. In particular, bounded quantifiers and the subset relation |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
429 |
appear in other axioms. Object-level quantifiers and implications have |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
430 |
been replaced by meta-level ones wherever possible, to simplify use of the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
431 |
axioms. See the file \texttt{ZF/ZF.thy} for details. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
432 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
433 |
The traditional replacement axiom asserts |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
434 |
\[ y \in \texttt{PrimReplace}(A,P) \bimp (\exists x\in A. P(x,y)) \] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
435 |
subject to the condition that $P(x,y)$ is single-valued for all~$x\in A$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
436 |
The Isabelle theory defines \cdx{Replace} to apply |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
437 |
\cdx{PrimReplace} to the single-valued part of~$P$, namely |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
438 |
\[ (\exists!z. P(x,z)) \conj P(x,y). \] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
439 |
Thus $y\in \texttt{Replace}(A,P)$ if and only if there is some~$x$ such that |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
440 |
$P(x,-)$ holds uniquely for~$y$. Because the equivalence is unconditional, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
441 |
\texttt{Replace} is much easier to use than \texttt{PrimReplace}; it defines the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
442 |
same set, if $P(x,y)$ is single-valued. The nice syntax for replacement |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
443 |
expands to \texttt{Replace}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
444 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
445 |
Other consequences of replacement include functional replacement |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
446 |
(\cdx{RepFun}) and definite descriptions (\cdx{The}). |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
447 |
Axioms for separation (\cdx{Collect}) and unordered pairs |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
448 |
(\cdx{Upair}) are traditionally assumed, but they actually follow |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
449 |
from replacement~\cite[pages 237--8]{suppes72}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
450 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
451 |
The definitions of general intersection, etc., are straightforward. Note |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
452 |
the definition of \texttt{cons}, which underlies the finite set notation. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
453 |
The axiom of infinity gives us a set that contains~0 and is closed under |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
454 |
successor (\cdx{succ}). Although this set is not uniquely defined, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
455 |
the theory names it (\cdx{Inf}) in order to simplify the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
456 |
construction of the natural numbers. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
457 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
458 |
Further definitions appear in Fig.\ts\ref{zf-defs}. Ordered pairs are |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
459 |
defined in the standard way, $\pair{a,b}\equiv\{\{a\},\{a,b\}\}$. Recall |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
460 |
that \cdx{Sigma}$(A,B)$ generalizes the Cartesian product of two |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
461 |
sets. It is defined to be the union of all singleton sets |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
462 |
$\{\pair{x,y}\}$, for $x\in A$ and $y\in B(x)$. This is a typical usage of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
463 |
general union. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
464 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
465 |
The projections \cdx{fst} and~\cdx{snd} are defined in terms of the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
466 |
generalized projection \cdx{split}. The latter has been borrowed from |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
467 |
Martin-L\"of's Type Theory, and is often easier to use than \cdx{fst} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
468 |
and~\cdx{snd}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
469 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
470 |
Operations on relations include converse, domain, range, and image. The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
471 |
set ${\tt Pi}(A,B)$ generalizes the space of functions between two sets. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
472 |
Note the simple definitions of $\lambda$-abstraction (using |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
473 |
\cdx{RepFun}) and application (using a definite description). The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
474 |
function \cdx{restrict}$(f,A)$ has the same values as~$f$, but only |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
475 |
over the domain~$A$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
476 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
477 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
478 |
%%%% zf.ML |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
479 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
480 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
481 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
482 |
\tdx{ballI} [| !!x. x:A ==> P(x) |] ==> ALL x:A. P(x) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
483 |
\tdx{bspec} [| ALL x:A. P(x); x: A |] ==> P(x) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
484 |
\tdx{ballE} [| ALL x:A. P(x); P(x) ==> Q; ~ x:A ==> Q |] ==> Q |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
485 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
486 |
\tdx{ball_cong} [| A=A'; !!x. x:A' ==> P(x) <-> P'(x) |] ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
487 |
(ALL x:A. P(x)) <-> (ALL x:A'. P'(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
488 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
489 |
\tdx{bexI} [| P(x); x: A |] ==> EX x:A. P(x) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
490 |
\tdx{bexCI} [| ALL x:A. ~P(x) ==> P(a); a: A |] ==> EX x:A. P(x) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
491 |
\tdx{bexE} [| EX x:A. P(x); !!x. [| x:A; P(x) |] ==> Q |] ==> Q |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
492 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
493 |
\tdx{bex_cong} [| A=A'; !!x. x:A' ==> P(x) <-> P'(x) |] ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
494 |
(EX x:A. P(x)) <-> (EX x:A'. P'(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
495 |
\subcaption{Bounded quantifiers} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
496 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
497 |
\tdx{subsetI} (!!x. x:A ==> x:B) ==> A <= B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
498 |
\tdx{subsetD} [| A <= B; c:A |] ==> c:B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
499 |
\tdx{subsetCE} [| A <= B; ~(c:A) ==> P; c:B ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
500 |
\tdx{subset_refl} A <= A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
501 |
\tdx{subset_trans} [| A<=B; B<=C |] ==> A<=C |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
502 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
503 |
\tdx{equalityI} [| A <= B; B <= A |] ==> A = B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
504 |
\tdx{equalityD1} A = B ==> A<=B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
505 |
\tdx{equalityD2} A = B ==> B<=A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
506 |
\tdx{equalityE} [| A = B; [| A<=B; B<=A |] ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
507 |
\subcaption{Subsets and extensionality} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
508 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
509 |
\tdx{emptyE} a:0 ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
510 |
\tdx{empty_subsetI} 0 <= A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
511 |
\tdx{equals0I} [| !!y. y:A ==> False |] ==> A=0 |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
512 |
\tdx{equals0D} [| A=0; a:A |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
513 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
514 |
\tdx{PowI} A <= B ==> A : Pow(B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
515 |
\tdx{PowD} A : Pow(B) ==> A<=B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
516 |
\subcaption{The empty set; power sets} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
517 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
518 |
\caption{Basic derived rules for {\ZF}} \label{zf-lemmas1} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
519 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
520 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
521 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
522 |
\section{From basic lemmas to function spaces} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
523 |
Faced with so many definitions, it is essential to prove lemmas. Even |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
524 |
trivial theorems like $A \int B = B \int A$ would be difficult to |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
525 |
prove from the definitions alone. Isabelle's set theory derives many |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
526 |
rules using a natural deduction style. Ideally, a natural deduction |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
527 |
rule should introduce or eliminate just one operator, but this is not |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
528 |
always practical. For most operators, we may forget its definition |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
529 |
and use its derived rules instead. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
530 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
531 |
\subsection{Fundamental lemmas} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
532 |
Figure~\ref{zf-lemmas1} presents the derived rules for the most basic |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
533 |
operators. The rules for the bounded quantifiers resemble those for the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
534 |
ordinary quantifiers, but note that \tdx{ballE} uses a negated assumption |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
535 |
in the style of Isabelle's classical reasoner. The \rmindex{congruence |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
536 |
rules} \tdx{ball_cong} and \tdx{bex_cong} are required by Isabelle's |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
537 |
simplifier, but have few other uses. Congruence rules must be specially |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
538 |
derived for all binding operators, and henceforth will not be shown. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
539 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
540 |
Figure~\ref{zf-lemmas1} also shows rules for the subset and equality |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
541 |
relations (proof by extensionality), and rules about the empty set and the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
542 |
power set operator. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
543 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
544 |
Figure~\ref{zf-lemmas2} presents rules for replacement and separation. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
545 |
The rules for \cdx{Replace} and \cdx{RepFun} are much simpler than |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
546 |
comparable rules for \texttt{PrimReplace} would be. The principle of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
547 |
separation is proved explicitly, although most proofs should use the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
548 |
natural deduction rules for \texttt{Collect}. The elimination rule |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
549 |
\tdx{CollectE} is equivalent to the two destruction rules |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
550 |
\tdx{CollectD1} and \tdx{CollectD2}, but each rule is suited to |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
551 |
particular circumstances. Although too many rules can be confusing, there |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
552 |
is no reason to aim for a minimal set of rules. See the file |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
553 |
\texttt{ZF/ZF.ML} for a complete listing. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
554 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
555 |
Figure~\ref{zf-lemmas3} presents rules for general union and intersection. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
556 |
The empty intersection should be undefined. We cannot have |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
557 |
$\bigcap(\emptyset)=V$ because $V$, the universal class, is not a set. All |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
558 |
expressions denote something in {\ZF} set theory; the definition of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
559 |
intersection implies $\bigcap(\emptyset)=\emptyset$, but this value is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
560 |
arbitrary. The rule \tdx{InterI} must have a premise to exclude |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
561 |
the empty intersection. Some of the laws governing intersections require |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
562 |
similar premises. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
563 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
564 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
565 |
%the [p] gives better page breaking for the book |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
566 |
\begin{figure}[p] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
567 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
568 |
\tdx{ReplaceI} [| x: A; P(x,b); !!y. P(x,y) ==> y=b |] ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
569 |
b : {\ttlbrace}y. x:A, P(x,y){\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
570 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
571 |
\tdx{ReplaceE} [| b : {\ttlbrace}y. x:A, P(x,y){\ttrbrace}; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
572 |
!!x. [| x: A; P(x,b); ALL y. P(x,y)-->y=b |] ==> R |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
573 |
|] ==> R |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
574 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
575 |
\tdx{RepFunI} [| a : A |] ==> f(a) : {\ttlbrace}f(x). x:A{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
576 |
\tdx{RepFunE} [| b : {\ttlbrace}f(x). x:A{\ttrbrace}; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
577 |
!!x.[| x:A; b=f(x) |] ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
578 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
579 |
\tdx{separation} a : {\ttlbrace}x:A. P(x){\ttrbrace} <-> a:A & P(a) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
580 |
\tdx{CollectI} [| a:A; P(a) |] ==> a : {\ttlbrace}x:A. P(x){\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
581 |
\tdx{CollectE} [| a : {\ttlbrace}x:A. P(x){\ttrbrace}; [| a:A; P(a) |] ==> R |] ==> R |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
582 |
\tdx{CollectD1} a : {\ttlbrace}x:A. P(x){\ttrbrace} ==> a:A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
583 |
\tdx{CollectD2} a : {\ttlbrace}x:A. P(x){\ttrbrace} ==> P(a) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
584 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
585 |
\caption{Replacement and separation} \label{zf-lemmas2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
586 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
587 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
588 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
589 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
590 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
591 |
\tdx{UnionI} [| B: C; A: B |] ==> A: Union(C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
592 |
\tdx{UnionE} [| A : Union(C); !!B.[| A: B; B: C |] ==> R |] ==> R |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
593 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
594 |
\tdx{InterI} [| !!x. x: C ==> A: x; c:C |] ==> A : Inter(C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
595 |
\tdx{InterD} [| A : Inter(C); B : C |] ==> A : B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
596 |
\tdx{InterE} [| A : Inter(C); A:B ==> R; ~ B:C ==> R |] ==> R |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
597 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
598 |
\tdx{UN_I} [| a: A; b: B(a) |] ==> b: (UN x:A. B(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
599 |
\tdx{UN_E} [| b : (UN x:A. B(x)); !!x.[| x: A; b: B(x) |] ==> R |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
600 |
|] ==> R |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
601 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
602 |
\tdx{INT_I} [| !!x. x: A ==> b: B(x); a: A |] ==> b: (INT x:A. B(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
603 |
\tdx{INT_E} [| b : (INT x:A. B(x)); a: A |] ==> b : B(a) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
604 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
605 |
\caption{General union and intersection} \label{zf-lemmas3} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
606 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
607 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
608 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
609 |
%%% upair.ML |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
610 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
611 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
612 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
613 |
\tdx{pairing} a:Upair(b,c) <-> (a=b | a=c) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
614 |
\tdx{UpairI1} a : Upair(a,b) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
615 |
\tdx{UpairI2} b : Upair(a,b) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
616 |
\tdx{UpairE} [| a : Upair(b,c); a = b ==> P; a = c ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
617 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
618 |
\caption{Unordered pairs} \label{zf-upair1} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
619 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
620 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
621 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
622 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
623 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
624 |
\tdx{UnI1} c : A ==> c : A Un B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
625 |
\tdx{UnI2} c : B ==> c : A Un B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
626 |
\tdx{UnCI} (~c : B ==> c : A) ==> c : A Un B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
627 |
\tdx{UnE} [| c : A Un B; c:A ==> P; c:B ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
628 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
629 |
\tdx{IntI} [| c : A; c : B |] ==> c : A Int B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
630 |
\tdx{IntD1} c : A Int B ==> c : A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
631 |
\tdx{IntD2} c : A Int B ==> c : B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
632 |
\tdx{IntE} [| c : A Int B; [| c:A; c:B |] ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
633 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
634 |
\tdx{DiffI} [| c : A; ~ c : B |] ==> c : A - B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
635 |
\tdx{DiffD1} c : A - B ==> c : A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
636 |
\tdx{DiffD2} c : A - B ==> c ~: B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
637 |
\tdx{DiffE} [| c : A - B; [| c:A; ~ c:B |] ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
638 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
639 |
\caption{Union, intersection, difference} \label{zf-Un} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
640 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
641 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
642 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
643 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
644 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
645 |
\tdx{consI1} a : cons(a,B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
646 |
\tdx{consI2} a : B ==> a : cons(b,B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
647 |
\tdx{consCI} (~ a:B ==> a=b) ==> a: cons(b,B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
648 |
\tdx{consE} [| a : cons(b,A); a=b ==> P; a:A ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
649 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
650 |
\tdx{singletonI} a : {\ttlbrace}a{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
651 |
\tdx{singletonE} [| a : {\ttlbrace}b{\ttrbrace}; a=b ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
652 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
653 |
\caption{Finite and singleton sets} \label{zf-upair2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
654 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
655 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
656 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
657 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
658 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
659 |
\tdx{succI1} i : succ(i) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
660 |
\tdx{succI2} i : j ==> i : succ(j) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
661 |
\tdx{succCI} (~ i:j ==> i=j) ==> i: succ(j) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
662 |
\tdx{succE} [| i : succ(j); i=j ==> P; i:j ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
663 |
\tdx{succ_neq_0} [| succ(n)=0 |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
664 |
\tdx{succ_inject} succ(m) = succ(n) ==> m=n |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
665 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
666 |
\caption{The successor function} \label{zf-succ} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
667 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
668 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
669 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
670 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
671 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
672 |
\tdx{the_equality} [| P(a); !!x. P(x) ==> x=a |] ==> (THE x. P(x)) = a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
673 |
\tdx{theI} EX! x. P(x) ==> P(THE x. P(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
674 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
675 |
\tdx{if_P} P ==> (if P then a else b) = a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
676 |
\tdx{if_not_P} ~P ==> (if P then a else b) = b |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
677 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
678 |
\tdx{mem_asym} [| a:b; b:a |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
679 |
\tdx{mem_irrefl} a:a ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
680 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
681 |
\caption{Descriptions; non-circularity} \label{zf-the} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
682 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
683 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
684 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
685 |
\subsection{Unordered pairs and finite sets} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
686 |
Figure~\ref{zf-upair1} presents the principle of unordered pairing, along |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
687 |
with its derived rules. Binary union and intersection are defined in terms |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
688 |
of ordered pairs (Fig.\ts\ref{zf-Un}). Set difference is also included. The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
689 |
rule \tdx{UnCI} is useful for classical reasoning about unions, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
690 |
like \texttt{disjCI}\@; it supersedes \tdx{UnI1} and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
691 |
\tdx{UnI2}, but these rules are often easier to work with. For |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
692 |
intersection and difference we have both elimination and destruction rules. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
693 |
Again, there is no reason to provide a minimal rule set. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
694 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
695 |
Figure~\ref{zf-upair2} is concerned with finite sets: it presents rules |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
696 |
for~\texttt{cons}, the finite set constructor, and rules for singleton |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
697 |
sets. Figure~\ref{zf-succ} presents derived rules for the successor |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
698 |
function, which is defined in terms of~\texttt{cons}. The proof that {\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
699 |
succ} is injective appears to require the Axiom of Foundation. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
700 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
701 |
Definite descriptions (\sdx{THE}) are defined in terms of the singleton |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
702 |
set~$\{0\}$, but their derived rules fortunately hide this |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
703 |
(Fig.\ts\ref{zf-the}). The rule~\tdx{theI} is difficult to apply |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
704 |
because of the two occurrences of~$\Var{P}$. However, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
705 |
\tdx{the_equality} does not have this problem and the files contain |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
706 |
many examples of its use. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
707 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
708 |
Finally, the impossibility of having both $a\in b$ and $b\in a$ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
709 |
(\tdx{mem_asym}) is proved by applying the Axiom of Foundation to |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
710 |
the set $\{a,b\}$. The impossibility of $a\in a$ is a trivial consequence. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
711 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
712 |
See the file \texttt{ZF/upair.ML} for full proofs of the rules discussed in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
713 |
this section. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
714 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
715 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
716 |
%%% subset.ML |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
717 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
718 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
719 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
720 |
\tdx{Union_upper} B:A ==> B <= Union(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
721 |
\tdx{Union_least} [| !!x. x:A ==> x<=C |] ==> Union(A) <= C |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
722 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
723 |
\tdx{Inter_lower} B:A ==> Inter(A) <= B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
724 |
\tdx{Inter_greatest} [| a:A; !!x. x:A ==> C<=x |] ==> C <= Inter(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
725 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
726 |
\tdx{Un_upper1} A <= A Un B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
727 |
\tdx{Un_upper2} B <= A Un B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
728 |
\tdx{Un_least} [| A<=C; B<=C |] ==> A Un B <= C |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
729 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
730 |
\tdx{Int_lower1} A Int B <= A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
731 |
\tdx{Int_lower2} A Int B <= B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
732 |
\tdx{Int_greatest} [| C<=A; C<=B |] ==> C <= A Int B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
733 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
734 |
\tdx{Diff_subset} A-B <= A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
735 |
\tdx{Diff_contains} [| C<=A; C Int B = 0 |] ==> C <= A-B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
736 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
737 |
\tdx{Collect_subset} Collect(A,P) <= A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
738 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
739 |
\caption{Subset and lattice properties} \label{zf-subset} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
740 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
741 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
742 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
743 |
\subsection{Subset and lattice properties} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
744 |
The subset relation is a complete lattice. Unions form least upper bounds; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
745 |
non-empty intersections form greatest lower bounds. Figure~\ref{zf-subset} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
746 |
shows the corresponding rules. A few other laws involving subsets are |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
747 |
included. Proofs are in the file \texttt{ZF/subset.ML}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
748 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
749 |
Reasoning directly about subsets often yields clearer proofs than |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
750 |
reasoning about the membership relation. Section~\ref{sec:ZF-pow-example} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
751 |
below presents an example of this, proving the equation ${{\tt Pow}(A)\cap |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
752 |
{\tt Pow}(B)}= {\tt Pow}(A\cap B)$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
753 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
754 |
%%% pair.ML |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
755 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
756 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
757 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
758 |
\tdx{Pair_inject1} <a,b> = <c,d> ==> a=c |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
759 |
\tdx{Pair_inject2} <a,b> = <c,d> ==> b=d |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
760 |
\tdx{Pair_inject} [| <a,b> = <c,d>; [| a=c; b=d |] ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
761 |
\tdx{Pair_neq_0} <a,b>=0 ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
762 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
763 |
\tdx{fst_conv} fst(<a,b>) = a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
764 |
\tdx{snd_conv} snd(<a,b>) = b |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
765 |
\tdx{split} split(\%x y. c(x,y), <a,b>) = c(a,b) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
766 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
767 |
\tdx{SigmaI} [| a:A; b:B(a) |] ==> <a,b> : Sigma(A,B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
768 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
769 |
\tdx{SigmaE} [| c: Sigma(A,B); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
770 |
!!x y.[| x:A; y:B(x); c=<x,y> |] ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
771 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
772 |
\tdx{SigmaE2} [| <a,b> : Sigma(A,B); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
773 |
[| a:A; b:B(a) |] ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
774 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
775 |
\caption{Ordered pairs; projections; general sums} \label{zf-pair} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
776 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
777 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
778 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
779 |
\subsection{Ordered pairs} \label{sec:pairs} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
780 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
781 |
Figure~\ref{zf-pair} presents the rules governing ordered pairs, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
782 |
projections and general sums. File \texttt{ZF/pair.ML} contains the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
783 |
full (and tedious) proof that $\{\{a\},\{a,b\}\}$ functions as an ordered |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
784 |
pair. This property is expressed as two destruction rules, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
785 |
\tdx{Pair_inject1} and \tdx{Pair_inject2}, and equivalently |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
786 |
as the elimination rule \tdx{Pair_inject}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
787 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
788 |
The rule \tdx{Pair_neq_0} asserts $\pair{a,b}\neq\emptyset$. This |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
789 |
is a property of $\{\{a\},\{a,b\}\}$, and need not hold for other |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
790 |
encodings of ordered pairs. The non-standard ordered pairs mentioned below |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
791 |
satisfy $\pair{\emptyset;\emptyset}=\emptyset$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
792 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
793 |
The natural deduction rules \tdx{SigmaI} and \tdx{SigmaE} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
794 |
assert that \cdx{Sigma}$(A,B)$ consists of all pairs of the form |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
795 |
$\pair{x,y}$, for $x\in A$ and $y\in B(x)$. The rule \tdx{SigmaE2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
796 |
merely states that $\pair{a,b}\in \texttt{Sigma}(A,B)$ implies $a\in A$ and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
797 |
$b\in B(a)$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
798 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
799 |
In addition, it is possible to use tuples as patterns in abstractions: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
800 |
\begin{center} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
801 |
{\tt\%<$x$,$y$>. $t$} \quad stands for\quad \texttt{split(\%$x$ $y$.\ $t$)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
802 |
\end{center} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
803 |
Nested patterns are translated recursively: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
804 |
{\tt\%<$x$,$y$,$z$>. $t$} $\leadsto$ {\tt\%<$x$,<$y$,$z$>>. $t$} $\leadsto$ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
805 |
\texttt{split(\%$x$.\%<$y$,$z$>. $t$)} $\leadsto$ \texttt{split(\%$x$. split(\%$y$ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
806 |
$z$.\ $t$))}. The reverse translation is performed upon printing. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
807 |
\begin{warn} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
808 |
The translation between patterns and \texttt{split} is performed automatically |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
809 |
by the parser and printer. Thus the internal and external form of a term |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
810 |
may differ, which affects proofs. For example the term {\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
811 |
(\%<x,y>.<y,x>)<a,b>} requires the theorem \texttt{split} to rewrite to |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
812 |
{\tt<b,a>}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
813 |
\end{warn} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
814 |
In addition to explicit $\lambda$-abstractions, patterns can be used in any |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
815 |
variable binding construct which is internally described by a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
816 |
$\lambda$-abstraction. Here are some important examples: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
817 |
\begin{description} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
818 |
\item[Let:] \texttt{let {\it pattern} = $t$ in $u$} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
819 |
\item[Choice:] \texttt{THE~{\it pattern}~.~$P$} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
820 |
\item[Set operations:] \texttt{UN~{\it pattern}:$A$.~$B$} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
821 |
\item[Comprehension:] \texttt{{\ttlbrace}~{\it pattern}:$A$~.~$P$~{\ttrbrace}} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
822 |
\end{description} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
823 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
824 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
825 |
%%% domrange.ML |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
826 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
827 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
828 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
829 |
\tdx{domainI} <a,b>: r ==> a : domain(r) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
830 |
\tdx{domainE} [| a : domain(r); !!y. <a,y>: r ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
831 |
\tdx{domain_subset} domain(Sigma(A,B)) <= A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
832 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
833 |
\tdx{rangeI} <a,b>: r ==> b : range(r) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
834 |
\tdx{rangeE} [| b : range(r); !!x. <x,b>: r ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
835 |
\tdx{range_subset} range(A*B) <= B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
836 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
837 |
\tdx{fieldI1} <a,b>: r ==> a : field(r) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
838 |
\tdx{fieldI2} <a,b>: r ==> b : field(r) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
839 |
\tdx{fieldCI} (~ <c,a>:r ==> <a,b>: r) ==> a : field(r) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
840 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
841 |
\tdx{fieldE} [| a : field(r); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
842 |
!!x. <a,x>: r ==> P; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
843 |
!!x. <x,a>: r ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
844 |
|] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
845 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
846 |
\tdx{field_subset} field(A*A) <= A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
847 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
848 |
\caption{Domain, range and field of a relation} \label{zf-domrange} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
849 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
850 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
851 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
852 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
853 |
\tdx{imageI} [| <a,b>: r; a:A |] ==> b : r``A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
854 |
\tdx{imageE} [| b: r``A; !!x.[| <x,b>: r; x:A |] ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
855 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
856 |
\tdx{vimageI} [| <a,b>: r; b:B |] ==> a : r-``B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
857 |
\tdx{vimageE} [| a: r-``B; !!x.[| <a,x>: r; x:B |] ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
858 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
859 |
\caption{Image and inverse image} \label{zf-domrange2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
860 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
861 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
862 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
863 |
\subsection{Relations} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
864 |
Figure~\ref{zf-domrange} presents rules involving relations, which are sets |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
865 |
of ordered pairs. The converse of a relation~$r$ is the set of all pairs |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
866 |
$\pair{y,x}$ such that $\pair{x,y}\in r$; if $r$ is a function, then |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
867 |
{\cdx{converse}$(r)$} is its inverse. The rules for the domain |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
868 |
operation, namely \tdx{domainI} and~\tdx{domainE}, assert that |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
869 |
\cdx{domain}$(r)$ consists of all~$x$ such that $r$ contains |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
870 |
some pair of the form~$\pair{x,y}$. The range operation is similar, and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
871 |
the field of a relation is merely the union of its domain and range. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
872 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
873 |
Figure~\ref{zf-domrange2} presents rules for images and inverse images. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
874 |
Note that these operations are generalisations of range and domain, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
875 |
respectively. See the file \texttt{ZF/domrange.ML} for derivations of the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
876 |
rules. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
877 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
878 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
879 |
%%% func.ML |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
880 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
881 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
882 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
883 |
\tdx{fun_is_rel} f: Pi(A,B) ==> f <= Sigma(A,B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
884 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
885 |
\tdx{apply_equality} [| <a,b>: f; f: Pi(A,B) |] ==> f`a = b |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
886 |
\tdx{apply_equality2} [| <a,b>: f; <a,c>: f; f: Pi(A,B) |] ==> b=c |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
887 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
888 |
\tdx{apply_type} [| f: Pi(A,B); a:A |] ==> f`a : B(a) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
889 |
\tdx{apply_Pair} [| f: Pi(A,B); a:A |] ==> <a,f`a>: f |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
890 |
\tdx{apply_iff} f: Pi(A,B) ==> <a,b>: f <-> a:A & f`a = b |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
891 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
892 |
\tdx{fun_extension} [| f : Pi(A,B); g: Pi(A,D); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
893 |
!!x. x:A ==> f`x = g`x |] ==> f=g |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
894 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
895 |
\tdx{domain_type} [| <a,b> : f; f: Pi(A,B) |] ==> a : A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
896 |
\tdx{range_type} [| <a,b> : f; f: Pi(A,B) |] ==> b : B(a) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
897 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
898 |
\tdx{Pi_type} [| f: A->C; !!x. x:A ==> f`x: B(x) |] ==> f: Pi(A,B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
899 |
\tdx{domain_of_fun} f: Pi(A,B) ==> domain(f)=A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
900 |
\tdx{range_of_fun} f: Pi(A,B) ==> f: A->range(f) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
901 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
902 |
\tdx{restrict} a : A ==> restrict(f,A) ` a = f`a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
903 |
\tdx{restrict_type} [| !!x. x:A ==> f`x: B(x) |] ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
904 |
restrict(f,A) : Pi(A,B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
905 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
906 |
\caption{Functions} \label{zf-func1} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
907 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
908 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
909 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
910 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
911 |
\begin{ttbox} |
8249 | 912 |
\tdx{lamI} a:A ==> <a,b(a)> : (lam x:A. b(x)) |
913 |
\tdx{lamE} [| p: (lam x:A. b(x)); !!x.[| x:A; p=<x,b(x)> |] ==> P |
|
914 |
|] ==> P |
|
915 |
||
916 |
\tdx{lam_type} [| !!x. x:A ==> b(x): B(x) |] ==> (lam x:A. b(x)) : Pi(A,B) |
|
917 |
||
918 |
\tdx{beta} a : A ==> (lam x:A. b(x)) ` a = b(a) |
|
919 |
\tdx{eta} f : Pi(A,B) ==> (lam x:A. f`x) = f |
|
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
920 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
921 |
\caption{$\lambda$-abstraction} \label{zf-lam} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
922 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
923 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
924 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
925 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
926 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
927 |
\tdx{fun_empty} 0: 0->0 |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
928 |
\tdx{fun_single} {\ttlbrace}<a,b>{\ttrbrace} : {\ttlbrace}a{\ttrbrace} -> {\ttlbrace}b{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
929 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
930 |
\tdx{fun_disjoint_Un} [| f: A->B; g: C->D; A Int C = 0 |] ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
931 |
(f Un g) : (A Un C) -> (B Un D) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
932 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
933 |
\tdx{fun_disjoint_apply1} [| a:A; f: A->B; g: C->D; A Int C = 0 |] ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
934 |
(f Un g)`a = f`a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
935 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
936 |
\tdx{fun_disjoint_apply2} [| c:C; f: A->B; g: C->D; A Int C = 0 |] ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
937 |
(f Un g)`c = g`c |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
938 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
939 |
\caption{Constructing functions from smaller sets} \label{zf-func2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
940 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
941 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
942 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
943 |
\subsection{Functions} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
944 |
Functions, represented by graphs, are notoriously difficult to reason |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
945 |
about. The file \texttt{ZF/func.ML} derives many rules, which overlap more |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
946 |
than they ought. This section presents the more important rules. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
947 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
948 |
Figure~\ref{zf-func1} presents the basic properties of \cdx{Pi}$(A,B)$, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
949 |
the generalized function space. For example, if $f$ is a function and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
950 |
$\pair{a,b}\in f$, then $f`a=b$ (\tdx{apply_equality}). Two functions |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
951 |
are equal provided they have equal domains and deliver equals results |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
952 |
(\tdx{fun_extension}). |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
953 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
954 |
By \tdx{Pi_type}, a function typing of the form $f\in A\to C$ can be |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
955 |
refined to the dependent typing $f\in\prod@{x\in A}B(x)$, given a suitable |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
956 |
family of sets $\{B(x)\}@{x\in A}$. Conversely, by \tdx{range_of_fun}, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
957 |
any dependent typing can be flattened to yield a function type of the form |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
958 |
$A\to C$; here, $C={\tt range}(f)$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
959 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
960 |
Among the laws for $\lambda$-abstraction, \tdx{lamI} and \tdx{lamE} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
961 |
describe the graph of the generated function, while \tdx{beta} and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
962 |
\tdx{eta} are the standard conversions. We essentially have a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
963 |
dependently-typed $\lambda$-calculus (Fig.\ts\ref{zf-lam}). |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
964 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
965 |
Figure~\ref{zf-func2} presents some rules that can be used to construct |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
966 |
functions explicitly. We start with functions consisting of at most one |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
967 |
pair, and may form the union of two functions provided their domains are |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
968 |
disjoint. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
969 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
970 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
971 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
972 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
973 |
\tdx{Int_absorb} A Int A = A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
974 |
\tdx{Int_commute} A Int B = B Int A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
975 |
\tdx{Int_assoc} (A Int B) Int C = A Int (B Int C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
976 |
\tdx{Int_Un_distrib} (A Un B) Int C = (A Int C) Un (B Int C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
977 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
978 |
\tdx{Un_absorb} A Un A = A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
979 |
\tdx{Un_commute} A Un B = B Un A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
980 |
\tdx{Un_assoc} (A Un B) Un C = A Un (B Un C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
981 |
\tdx{Un_Int_distrib} (A Int B) Un C = (A Un C) Int (B Un C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
982 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
983 |
\tdx{Diff_cancel} A-A = 0 |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
984 |
\tdx{Diff_disjoint} A Int (B-A) = 0 |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
985 |
\tdx{Diff_partition} A<=B ==> A Un (B-A) = B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
986 |
\tdx{double_complement} [| A<=B; B<= C |] ==> (B - (C-A)) = A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
987 |
\tdx{Diff_Un} A - (B Un C) = (A-B) Int (A-C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
988 |
\tdx{Diff_Int} A - (B Int C) = (A-B) Un (A-C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
989 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
990 |
\tdx{Union_Un_distrib} Union(A Un B) = Union(A) Un Union(B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
991 |
\tdx{Inter_Un_distrib} [| a:A; b:B |] ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
992 |
Inter(A Un B) = Inter(A) Int Inter(B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
993 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
994 |
\tdx{Int_Union_RepFun} A Int Union(B) = (UN C:B. A Int C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
995 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
996 |
\tdx{Un_Inter_RepFun} b:B ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
997 |
A Un Inter(B) = (INT C:B. A Un C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
998 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
999 |
\tdx{SUM_Un_distrib1} (SUM x:A Un B. C(x)) = |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1000 |
(SUM x:A. C(x)) Un (SUM x:B. C(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1001 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1002 |
\tdx{SUM_Un_distrib2} (SUM x:C. A(x) Un B(x)) = |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1003 |
(SUM x:C. A(x)) Un (SUM x:C. B(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1004 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1005 |
\tdx{SUM_Int_distrib1} (SUM x:A Int B. C(x)) = |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1006 |
(SUM x:A. C(x)) Int (SUM x:B. C(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1007 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1008 |
\tdx{SUM_Int_distrib2} (SUM x:C. A(x) Int B(x)) = |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1009 |
(SUM x:C. A(x)) Int (SUM x:C. B(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1010 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1011 |
\caption{Equalities} \label{zf-equalities} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1012 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1013 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1014 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1015 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1016 |
%\begin{constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1017 |
% \cdx{1} & $i$ & & $\{\emptyset\}$ \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1018 |
% \cdx{bool} & $i$ & & the set $\{\emptyset,1\}$ \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1019 |
% \cdx{cond} & $[i,i,i]\To i$ & & conditional for \texttt{bool} \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1020 |
% \cdx{not} & $i\To i$ & & negation for \texttt{bool} \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1021 |
% \sdx{and} & $[i,i]\To i$ & Left 70 & conjunction for \texttt{bool} \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1022 |
% \sdx{or} & $[i,i]\To i$ & Left 65 & disjunction for \texttt{bool} \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1023 |
% \sdx{xor} & $[i,i]\To i$ & Left 65 & exclusive-or for \texttt{bool} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1024 |
%\end{constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1025 |
% |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1026 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1027 |
\tdx{bool_def} bool == {\ttlbrace}0,1{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1028 |
\tdx{cond_def} cond(b,c,d) == if b=1 then c else d |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1029 |
\tdx{not_def} not(b) == cond(b,0,1) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1030 |
\tdx{and_def} a and b == cond(a,b,0) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1031 |
\tdx{or_def} a or b == cond(a,1,b) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1032 |
\tdx{xor_def} a xor b == cond(a,not(b),b) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1033 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1034 |
\tdx{bool_1I} 1 : bool |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1035 |
\tdx{bool_0I} 0 : bool |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1036 |
\tdx{boolE} [| c: bool; c=1 ==> P; c=0 ==> P |] ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1037 |
\tdx{cond_1} cond(1,c,d) = c |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1038 |
\tdx{cond_0} cond(0,c,d) = d |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1039 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1040 |
\caption{The booleans} \label{zf-bool} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1041 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1042 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1043 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1044 |
\section{Further developments} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1045 |
The next group of developments is complex and extensive, and only |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1046 |
highlights can be covered here. It involves many theories and ML files of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1047 |
proofs. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1048 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1049 |
Figure~\ref{zf-equalities} presents commutative, associative, distributive, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1050 |
and idempotency laws of union and intersection, along with other equations. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1051 |
See file \texttt{ZF/equalities.ML}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1052 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1053 |
Theory \thydx{Bool} defines $\{0,1\}$ as a set of booleans, with the usual |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1054 |
operators including a conditional (Fig.\ts\ref{zf-bool}). Although {\ZF} is a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1055 |
first-order theory, you can obtain the effect of higher-order logic using |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1056 |
\texttt{bool}-valued functions, for example. The constant~\texttt{1} is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1057 |
translated to \texttt{succ(0)}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1058 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1059 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1060 |
\index{*"+ symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1061 |
\begin{constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1062 |
\it symbol & \it meta-type & \it priority & \it description \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1063 |
\tt + & $[i,i]\To i$ & Right 65 & disjoint union operator\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1064 |
\cdx{Inl}~~\cdx{Inr} & $i\To i$ & & injections\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1065 |
\cdx{case} & $[i\To i,i\To i, i]\To i$ & & conditional for $A+B$ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1066 |
\end{constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1067 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1068 |
\tdx{sum_def} A+B == {\ttlbrace}0{\ttrbrace}*A Un {\ttlbrace}1{\ttrbrace}*B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1069 |
\tdx{Inl_def} Inl(a) == <0,a> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1070 |
\tdx{Inr_def} Inr(b) == <1,b> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1071 |
\tdx{case_def} case(c,d,u) == split(\%y z. cond(y, d(z), c(z)), u) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1072 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1073 |
\tdx{sum_InlI} a : A ==> Inl(a) : A+B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1074 |
\tdx{sum_InrI} b : B ==> Inr(b) : A+B |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1075 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1076 |
\tdx{Inl_inject} Inl(a)=Inl(b) ==> a=b |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1077 |
\tdx{Inr_inject} Inr(a)=Inr(b) ==> a=b |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1078 |
\tdx{Inl_neq_Inr} Inl(a)=Inr(b) ==> P |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1079 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1080 |
\tdx{sumE2} u: A+B ==> (EX x. x:A & u=Inl(x)) | (EX y. y:B & u=Inr(y)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1081 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1082 |
\tdx{case_Inl} case(c,d,Inl(a)) = c(a) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1083 |
\tdx{case_Inr} case(c,d,Inr(b)) = d(b) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1084 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1085 |
\caption{Disjoint unions} \label{zf-sum} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1086 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1087 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1088 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1089 |
Theory \thydx{Sum} defines the disjoint union of two sets, with |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1090 |
injections and a case analysis operator (Fig.\ts\ref{zf-sum}). Disjoint |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1091 |
unions play a role in datatype definitions, particularly when there is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1092 |
mutual recursion~\cite{paulson-set-II}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1093 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1094 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1095 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1096 |
\tdx{QPair_def} <a;b> == a+b |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1097 |
\tdx{qsplit_def} qsplit(c,p) == THE y. EX a b. p=<a;b> & y=c(a,b) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1098 |
\tdx{qfsplit_def} qfsplit(R,z) == EX x y. z=<x;y> & R(x,y) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1099 |
\tdx{qconverse_def} qconverse(r) == {\ttlbrace}z. w:r, EX x y. w=<x;y> & z=<y;x>{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1100 |
\tdx{QSigma_def} QSigma(A,B) == UN x:A. UN y:B(x). {\ttlbrace}<x;y>{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1101 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1102 |
\tdx{qsum_def} A <+> B == ({\ttlbrace}0{\ttrbrace} <*> A) Un ({\ttlbrace}1{\ttrbrace} <*> B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1103 |
\tdx{QInl_def} QInl(a) == <0;a> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1104 |
\tdx{QInr_def} QInr(b) == <1;b> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1105 |
\tdx{qcase_def} qcase(c,d) == qsplit(\%y z. cond(y, d(z), c(z))) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1106 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1107 |
\caption{Non-standard pairs, products and sums} \label{zf-qpair} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1108 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1109 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1110 |
Theory \thydx{QPair} defines a notion of ordered pair that admits |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1111 |
non-well-founded tupling (Fig.\ts\ref{zf-qpair}). Such pairs are written |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1112 |
{\tt<$a$;$b$>}. It also defines the eliminator \cdx{qsplit}, the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1113 |
converse operator \cdx{qconverse}, and the summation operator |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1114 |
\cdx{QSigma}. These are completely analogous to the corresponding |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1115 |
versions for standard ordered pairs. The theory goes on to define a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1116 |
non-standard notion of disjoint sum using non-standard pairs. All of these |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1117 |
concepts satisfy the same properties as their standard counterparts; in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1118 |
addition, {\tt<$a$;$b$>} is continuous. The theory supports coinductive |
6592 | 1119 |
definitions, for example of infinite lists~\cite{paulson-mscs}. |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1120 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1121 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1122 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1123 |
\tdx{bnd_mono_def} bnd_mono(D,h) == |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1124 |
h(D)<=D & (ALL W X. W<=X --> X<=D --> h(W) <= h(X)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1125 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1126 |
\tdx{lfp_def} lfp(D,h) == Inter({\ttlbrace}X: Pow(D). h(X) <= X{\ttrbrace}) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1127 |
\tdx{gfp_def} gfp(D,h) == Union({\ttlbrace}X: Pow(D). X <= h(X){\ttrbrace}) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1128 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1129 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1130 |
\tdx{lfp_lowerbound} [| h(A) <= A; A<=D |] ==> lfp(D,h) <= A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1131 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1132 |
\tdx{lfp_subset} lfp(D,h) <= D |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1133 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1134 |
\tdx{lfp_greatest} [| bnd_mono(D,h); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1135 |
!!X. [| h(X) <= X; X<=D |] ==> A<=X |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1136 |
|] ==> A <= lfp(D,h) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1137 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1138 |
\tdx{lfp_Tarski} bnd_mono(D,h) ==> lfp(D,h) = h(lfp(D,h)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1139 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1140 |
\tdx{induct} [| a : lfp(D,h); bnd_mono(D,h); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1141 |
!!x. x : h(Collect(lfp(D,h),P)) ==> P(x) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1142 |
|] ==> P(a) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1143 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1144 |
\tdx{lfp_mono} [| bnd_mono(D,h); bnd_mono(E,i); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1145 |
!!X. X<=D ==> h(X) <= i(X) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1146 |
|] ==> lfp(D,h) <= lfp(E,i) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1147 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1148 |
\tdx{gfp_upperbound} [| A <= h(A); A<=D |] ==> A <= gfp(D,h) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1149 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1150 |
\tdx{gfp_subset} gfp(D,h) <= D |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1151 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1152 |
\tdx{gfp_least} [| bnd_mono(D,h); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1153 |
!!X. [| X <= h(X); X<=D |] ==> X<=A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1154 |
|] ==> gfp(D,h) <= A |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1155 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1156 |
\tdx{gfp_Tarski} bnd_mono(D,h) ==> gfp(D,h) = h(gfp(D,h)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1157 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1158 |
\tdx{coinduct} [| bnd_mono(D,h); a: X; X <= h(X Un gfp(D,h)); X <= D |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1159 |
|] ==> a : gfp(D,h) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1160 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1161 |
\tdx{gfp_mono} [| bnd_mono(D,h); D <= E; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1162 |
!!X. X<=D ==> h(X) <= i(X) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1163 |
|] ==> gfp(D,h) <= gfp(E,i) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1164 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1165 |
\caption{Least and greatest fixedpoints} \label{zf-fixedpt} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1166 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1167 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1168 |
The Knaster-Tarski Theorem states that every monotone function over a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1169 |
complete lattice has a fixedpoint. Theory \thydx{Fixedpt} proves the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1170 |
Theorem only for a particular lattice, namely the lattice of subsets of a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1171 |
set (Fig.\ts\ref{zf-fixedpt}). The theory defines least and greatest |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1172 |
fixedpoint operators with corresponding induction and coinduction rules. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1173 |
These are essential to many definitions that follow, including the natural |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1174 |
numbers and the transitive closure operator. The (co)inductive definition |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1175 |
package also uses the fixedpoint operators~\cite{paulson-CADE}. See |
6745 | 1176 |
Davey and Priestley~\cite{davey-priestley} for more on the Knaster-Tarski |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1177 |
Theorem and my paper~\cite{paulson-set-II} for discussion of the Isabelle |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1178 |
proofs. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1179 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1180 |
Monotonicity properties are proved for most of the set-forming operations: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1181 |
union, intersection, Cartesian product, image, domain, range, etc. These |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1182 |
are useful for applying the Knaster-Tarski Fixedpoint Theorem. The proofs |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1183 |
themselves are trivial applications of Isabelle's classical reasoner. See |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1184 |
file \texttt{ZF/mono.ML}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1185 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1186 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1187 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1188 |
\begin{constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1189 |
\it symbol & \it meta-type & \it priority & \it description \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1190 |
\sdx{O} & $[i,i]\To i$ & Right 60 & composition ($\circ$) \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1191 |
\cdx{id} & $i\To i$ & & identity function \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1192 |
\cdx{inj} & $[i,i]\To i$ & & injective function space\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1193 |
\cdx{surj} & $[i,i]\To i$ & & surjective function space\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1194 |
\cdx{bij} & $[i,i]\To i$ & & bijective function space |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1195 |
\end{constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1196 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1197 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1198 |
\tdx{comp_def} r O s == {\ttlbrace}xz : domain(s)*range(r) . |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1199 |
EX x y z. xz=<x,z> & <x,y>:s & <y,z>:r{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1200 |
\tdx{id_def} id(A) == (lam x:A. x) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1201 |
\tdx{inj_def} inj(A,B) == {\ttlbrace} f: A->B. ALL w:A. ALL x:A. f`w=f`x --> w=x {\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1202 |
\tdx{surj_def} surj(A,B) == {\ttlbrace} f: A->B . ALL y:B. EX x:A. f`x=y {\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1203 |
\tdx{bij_def} bij(A,B) == inj(A,B) Int surj(A,B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1204 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1205 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1206 |
\tdx{left_inverse} [| f: inj(A,B); a: A |] ==> converse(f)`(f`a) = a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1207 |
\tdx{right_inverse} [| f: inj(A,B); b: range(f) |] ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1208 |
f`(converse(f)`b) = b |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1209 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1210 |
\tdx{inj_converse_inj} f: inj(A,B) ==> converse(f): inj(range(f), A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1211 |
\tdx{bij_converse_bij} f: bij(A,B) ==> converse(f): bij(B,A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1212 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1213 |
\tdx{comp_type} [| s<=A*B; r<=B*C |] ==> (r O s) <= A*C |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1214 |
\tdx{comp_assoc} (r O s) O t = r O (s O t) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1215 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1216 |
\tdx{left_comp_id} r<=A*B ==> id(B) O r = r |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1217 |
\tdx{right_comp_id} r<=A*B ==> r O id(A) = r |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1218 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1219 |
\tdx{comp_func} [| g:A->B; f:B->C |] ==> (f O g):A->C |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1220 |
\tdx{comp_func_apply} [| g:A->B; f:B->C; a:A |] ==> (f O g)`a = f`(g`a) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1221 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1222 |
\tdx{comp_inj} [| g:inj(A,B); f:inj(B,C) |] ==> (f O g):inj(A,C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1223 |
\tdx{comp_surj} [| g:surj(A,B); f:surj(B,C) |] ==> (f O g):surj(A,C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1224 |
\tdx{comp_bij} [| g:bij(A,B); f:bij(B,C) |] ==> (f O g):bij(A,C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1225 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1226 |
\tdx{left_comp_inverse} f: inj(A,B) ==> converse(f) O f = id(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1227 |
\tdx{right_comp_inverse} f: surj(A,B) ==> f O converse(f) = id(B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1228 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1229 |
\tdx{bij_disjoint_Un} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1230 |
[| f: bij(A,B); g: bij(C,D); A Int C = 0; B Int D = 0 |] ==> |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1231 |
(f Un g) : bij(A Un C, B Un D) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1232 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1233 |
\tdx{restrict_bij} [| f:inj(A,B); C<=A |] ==> restrict(f,C): bij(C, f``C) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1234 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1235 |
\caption{Permutations} \label{zf-perm} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1236 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1237 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1238 |
The theory \thydx{Perm} is concerned with permutations (bijections) and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1239 |
related concepts. These include composition of relations, the identity |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1240 |
relation, and three specialized function spaces: injective, surjective and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1241 |
bijective. Figure~\ref{zf-perm} displays many of their properties that |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1242 |
have been proved. These results are fundamental to a treatment of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1243 |
equipollence and cardinality. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1244 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1245 |
\begin{figure}\small |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1246 |
\index{#*@{\tt\#*} symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1247 |
\index{*div symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1248 |
\index{*mod symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1249 |
\index{#+@{\tt\#+} symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1250 |
\index{#-@{\tt\#-} symbol} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1251 |
\begin{constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1252 |
\it symbol & \it meta-type & \it priority & \it description \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1253 |
\cdx{nat} & $i$ & & set of natural numbers \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1254 |
\cdx{nat_case}& $[i,i\To i,i]\To i$ & & conditional for $nat$\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1255 |
\tt \#* & $[i,i]\To i$ & Left 70 & multiplication \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1256 |
\tt div & $[i,i]\To i$ & Left 70 & division\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1257 |
\tt mod & $[i,i]\To i$ & Left 70 & modulus\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1258 |
\tt \#+ & $[i,i]\To i$ & Left 65 & addition\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1259 |
\tt \#- & $[i,i]\To i$ & Left 65 & subtraction |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1260 |
\end{constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1261 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1262 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1263 |
\tdx{nat_def} nat == lfp(lam r: Pow(Inf). {\ttlbrace}0{\ttrbrace} Un {\ttlbrace}succ(x). x:r{\ttrbrace} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1264 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1265 |
\tdx{mod_def} m mod n == transrec(m, \%j f. if j:n then j else f`(j#-n)) |
8249 | 1266 |
\tdx{div_def} m div n == transrec(m, \%j f. if j:n then 0 |
1267 |
else succ(f`(j#-n))) |
|
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1268 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1269 |
\tdx{nat_case_def} nat_case(a,b,k) == |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1270 |
THE y. k=0 & y=a | (EX x. k=succ(x) & y=b(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1271 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1272 |
\tdx{nat_0I} 0 : nat |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1273 |
\tdx{nat_succI} n : nat ==> succ(n) : nat |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1274 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1275 |
\tdx{nat_induct} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1276 |
[| n: nat; P(0); !!x. [| x: nat; P(x) |] ==> P(succ(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1277 |
|] ==> P(n) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1278 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1279 |
\tdx{nat_case_0} nat_case(a,b,0) = a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1280 |
\tdx{nat_case_succ} nat_case(a,b,succ(m)) = b(m) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1281 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1282 |
\tdx{add_0} 0 #+ n = n |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1283 |
\tdx{add_succ} succ(m) #+ n = succ(m #+ n) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1284 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1285 |
\tdx{mult_type} [| m:nat; n:nat |] ==> m #* n : nat |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1286 |
\tdx{mult_0} 0 #* n = 0 |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1287 |
\tdx{mult_succ} succ(m) #* n = n #+ (m #* n) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1288 |
\tdx{mult_commute} [| m:nat; n:nat |] ==> m #* n = n #* m |
8249 | 1289 |
\tdx{add_mult_dist} [| m:nat; k:nat |] ==> |
1290 |
(m #+ n) #* k = (m #* k) #+ (n #* k) |
|
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1291 |
\tdx{mult_assoc} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1292 |
[| m:nat; n:nat; k:nat |] ==> (m #* n) #* k = m #* (n #* k) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1293 |
\tdx{mod_quo_equality} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1294 |
[| 0:n; m:nat; n:nat |] ==> (m div n)#*n #+ m mod n = m |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1295 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1296 |
\caption{The natural numbers} \label{zf-nat} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1297 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1298 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1299 |
Theory \thydx{Nat} defines the natural numbers and mathematical |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1300 |
induction, along with a case analysis operator. The set of natural |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1301 |
numbers, here called \texttt{nat}, is known in set theory as the ordinal~$\omega$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1302 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1303 |
Theory \thydx{Arith} develops arithmetic on the natural numbers |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1304 |
(Fig.\ts\ref{zf-nat}). Addition, multiplication and subtraction are defined |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1305 |
by primitive recursion. Division and remainder are defined by repeated |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1306 |
subtraction, which requires well-founded recursion; the termination argument |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1307 |
relies on the divisor's being non-zero. Many properties are proved: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1308 |
commutative, associative and distributive laws, identity and cancellation |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1309 |
laws, etc. The most interesting result is perhaps the theorem $a \bmod b + |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1310 |
(a/b)\times b = a$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1311 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1312 |
Theory \thydx{Univ} defines a `universe' $\texttt{univ}(A)$, which is used by |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1313 |
the datatype package. This set contains $A$ and the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1314 |
natural numbers. Vitally, it is closed under finite products: ${\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1315 |
univ}(A)\times{\tt univ}(A)\subseteq{\tt univ}(A)$. This theory also |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1316 |
defines the cumulative hierarchy of axiomatic set theory, which |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1317 |
traditionally is written $V@\alpha$ for an ordinal~$\alpha$. The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1318 |
`universe' is a simple generalization of~$V@\omega$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1319 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1320 |
Theory \thydx{QUniv} defines a `universe' ${\tt quniv}(A)$, which is used by |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1321 |
the datatype package to construct codatatypes such as streams. It is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1322 |
analogous to ${\tt univ}(A)$ (and is defined in terms of it) but is closed |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1323 |
under the non-standard product and sum. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1324 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1325 |
Theory \texttt{Finite} (Figure~\ref{zf-fin}) defines the finite set operator; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1326 |
${\tt Fin}(A)$ is the set of all finite sets over~$A$. The theory employs |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1327 |
Isabelle's inductive definition package, which proves various rules |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1328 |
automatically. The induction rule shown is stronger than the one proved by |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1329 |
the package. The theory also defines the set of all finite functions |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1330 |
between two given sets. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1331 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1332 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1333 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1334 |
\tdx{Fin.emptyI} 0 : Fin(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1335 |
\tdx{Fin.consI} [| a: A; b: Fin(A) |] ==> cons(a,b) : Fin(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1336 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1337 |
\tdx{Fin_induct} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1338 |
[| b: Fin(A); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1339 |
P(0); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1340 |
!!x y. [| x: A; y: Fin(A); x~:y; P(y) |] ==> P(cons(x,y)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1341 |
|] ==> P(b) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1342 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1343 |
\tdx{Fin_mono} A<=B ==> Fin(A) <= Fin(B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1344 |
\tdx{Fin_UnI} [| b: Fin(A); c: Fin(A) |] ==> b Un c : Fin(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1345 |
\tdx{Fin_UnionI} C : Fin(Fin(A)) ==> Union(C) : Fin(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1346 |
\tdx{Fin_subset} [| c<=b; b: Fin(A) |] ==> c: Fin(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1347 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1348 |
\caption{The finite set operator} \label{zf-fin} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1349 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1350 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1351 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1352 |
\begin{constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1353 |
\it symbol & \it meta-type & \it priority & \it description \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1354 |
\cdx{list} & $i\To i$ && lists over some set\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1355 |
\cdx{list_case} & $[i, [i,i]\To i, i] \To i$ && conditional for $list(A)$ \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1356 |
\cdx{map} & $[i\To i, i] \To i$ & & mapping functional\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1357 |
\cdx{length} & $i\To i$ & & length of a list\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1358 |
\cdx{rev} & $i\To i$ & & reverse of a list\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1359 |
\tt \at & $[i,i]\To i$ & Right 60 & append for lists\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1360 |
\cdx{flat} & $i\To i$ & & append of list of lists |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1361 |
\end{constants} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1362 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1363 |
\underscoreon %%because @ is used here |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1364 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1365 |
\tdx{NilI} Nil : list(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1366 |
\tdx{ConsI} [| a: A; l: list(A) |] ==> Cons(a,l) : list(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1367 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1368 |
\tdx{List.induct} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1369 |
[| l: list(A); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1370 |
P(Nil); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1371 |
!!x y. [| x: A; y: list(A); P(y) |] ==> P(Cons(x,y)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1372 |
|] ==> P(l) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1373 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1374 |
\tdx{Cons_iff} Cons(a,l)=Cons(a',l') <-> a=a' & l=l' |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1375 |
\tdx{Nil_Cons_iff} ~ Nil=Cons(a,l) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1376 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1377 |
\tdx{list_mono} A<=B ==> list(A) <= list(B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1378 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1379 |
\tdx{map_ident} l: list(A) ==> map(\%u. u, l) = l |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1380 |
\tdx{map_compose} l: list(A) ==> map(h, map(j,l)) = map(\%u. h(j(u)), l) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1381 |
\tdx{map_app_distrib} xs: list(A) ==> map(h, xs@ys) = map(h,xs) @ map(h,ys) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1382 |
\tdx{map_type} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1383 |
[| l: list(A); !!x. x: A ==> h(x): B |] ==> map(h,l) : list(B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1384 |
\tdx{map_flat} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1385 |
ls: list(list(A)) ==> map(h, flat(ls)) = flat(map(map(h),ls)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1386 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1387 |
\caption{Lists} \label{zf-list} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1388 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1389 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1390 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1391 |
Figure~\ref{zf-list} presents the set of lists over~$A$, ${\tt list}(A)$. The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1392 |
definition employs Isabelle's datatype package, which defines the introduction |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1393 |
and induction rules automatically, as well as the constructors, case operator |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1394 |
(\verb|list_case|) and recursion operator. The theory then defines the usual |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1395 |
list functions by primitive recursion. See theory \texttt{List}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1396 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1397 |
|
6173 | 1398 |
\section{Automatic Tools} |
1399 |
||
1400 |
{\ZF} provides the simplifier and the classical reasoner. Moreover it |
|
1401 |
supplies a specialized tool to infer `types' of terms. |
|
1402 |
||
1403 |
\subsection{Simplification} |
|
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1404 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1405 |
{\ZF} inherits simplification from {\FOL} but adopts it for set theory. The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1406 |
extraction of rewrite rules takes the {\ZF} primitives into account. It can |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1407 |
strip bounded universal quantifiers from a formula; for example, ${\forall |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1408 |
x\in A. f(x)=g(x)}$ yields the conditional rewrite rule $x\in A \Imp |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1409 |
f(x)=g(x)$. Given $a\in\{x\in A. P(x)\}$ it extracts rewrite rules from $a\in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1410 |
A$ and~$P(a)$. It can also break down $a\in A\int B$ and $a\in A-B$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1411 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1412 |
Simplification tactics tactics such as \texttt{Asm_simp_tac} and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1413 |
\texttt{Full_simp_tac} use the default simpset (\texttt{simpset()}), which |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1414 |
works for most purposes. A small simplification set for set theory is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1415 |
called~\ttindexbold{ZF_ss}, and you can even use \ttindex{FOL_ss} as a minimal |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1416 |
starting point. \texttt{ZF_ss} contains congruence rules for all the binding |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1417 |
operators of {\ZF}\@. It contains all the conversion rules, such as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1418 |
\texttt{fst} and \texttt{snd}, as well as the rewrites shown in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1419 |
Fig.\ts\ref{zf-simpdata}. See the file \texttt{ZF/simpdata.ML} for a fuller |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1420 |
list. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1421 |
|
6173 | 1422 |
|
1423 |
\subsection{Classical Reasoning} |
|
1424 |
||
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1425 |
As for the classical reasoner, tactics such as \texttt{Blast_tac} and {\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1426 |
Best_tac} refer to the default claset (\texttt{claset()}). This works for |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1427 |
most purposes. Named clasets include \ttindexbold{ZF_cs} (basic set theory) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1428 |
and \ttindexbold{le_cs} (useful for reasoning about the relations $<$ and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1429 |
$\le$). You can use \ttindex{FOL_cs} as a minimal basis for building your own |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1430 |
clasets. See \iflabelundefined{chap:classical}{the {\em Reference Manual\/}}% |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1431 |
{Chap.\ts\ref{chap:classical}} for more discussion of classical proof methods. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1432 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1433 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1434 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1435 |
\begin{eqnarray*} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1436 |
a\in \emptyset & \bimp & \bot\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1437 |
a \in A \un B & \bimp & a\in A \disj a\in B\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1438 |
a \in A \int B & \bimp & a\in A \conj a\in B\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1439 |
a \in A-B & \bimp & a\in A \conj \neg (a\in B)\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1440 |
\pair{a,b}\in {\tt Sigma}(A,B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1441 |
& \bimp & a\in A \conj b\in B(a)\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1442 |
a \in {\tt Collect}(A,P) & \bimp & a\in A \conj P(a)\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1443 |
(\forall x \in \emptyset. P(x)) & \bimp & \top\\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1444 |
(\forall x \in A. \top) & \bimp & \top |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1445 |
\end{eqnarray*} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1446 |
\caption{Some rewrite rules for set theory} \label{zf-simpdata} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1447 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1448 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1449 |
|
6173 | 1450 |
\subsection{Type-Checking Tactics} |
1451 |
\index{type-checking tactics} |
|
1452 |
||
1453 |
Isabelle/{\ZF} provides simple tactics to help automate those proofs that are |
|
1454 |
essentially type-checking. Such proofs are built by applying rules such as |
|
1455 |
these: |
|
1456 |
\begin{ttbox} |
|
8249 | 1457 |
[| ?P ==> ?a: ?A; ~?P ==> ?b: ?A |] ==> (if ?P then ?a else ?b): ?A |
6173 | 1458 |
|
1459 |
[| ?m : nat; ?n : nat |] ==> ?m #+ ?n : nat |
|
1460 |
||
1461 |
?a : ?A ==> Inl(?a) : ?A + ?B |
|
1462 |
\end{ttbox} |
|
1463 |
In typical applications, the goal has the form $t\in\Var{A}$: in other words, |
|
1464 |
we have a specific term~$t$ and need to infer its `type' by instantiating the |
|
1465 |
set variable~$\Var{A}$. Neither the simplifier nor the classical reasoner |
|
1466 |
does this job well. The if-then-else rule, and many similar ones, can make |
|
1467 |
the classical reasoner loop. The simplifier refuses (on principle) to |
|
1468 |
instantiate variables during rewriting, so goals such as \texttt{i\#+j :\ ?A} |
|
1469 |
are left unsolved. |
|
1470 |
||
1471 |
The simplifier calls the type-checker to solve rewritten subgoals: this stage |
|
1472 |
can indeed instantiate variables. If you have defined new constants and |
|
1473 |
proved type-checking rules for them, then insert the rules using |
|
1474 |
\texttt{AddTCs} and the rest should be automatic. In particular, the |
|
1475 |
simplifier will use type-checking to help satisfy conditional rewrite rules. |
|
1476 |
Call the tactic \ttindex{Typecheck_tac} to break down all subgoals using |
|
1477 |
type-checking rules. |
|
1478 |
||
1479 |
Though the easiest way to invoke the type-checker is via the simplifier, |
|
1480 |
specialized applications may require more detailed knowledge of |
|
1481 |
the type-checking primitives. They are modelled on the simplifier's: |
|
1482 |
\begin{ttdescription} |
|
1483 |
\item[\ttindexbold{tcset}] is the type of tcsets: sets of type-checking rules. |
|
1484 |
||
1485 |
\item[\ttindexbold{addTCs}] is an infix operator to add type-checking rules to |
|
1486 |
a tcset. |
|
1487 |
||
1488 |
\item[\ttindexbold{delTCs}] is an infix operator to remove type-checking rules |
|
1489 |
from a tcset. |
|
1490 |
||
1491 |
\item[\ttindexbold{typecheck_tac}] is a tactic for attempting to prove all |
|
1492 |
subgoals using the rules given in its argument, a tcset. |
|
1493 |
\end{ttdescription} |
|
1494 |
||
1495 |
Tcsets, like simpsets, are associated with theories and are merged when |
|
1496 |
theories are merged. There are further primitives that use the default tcset. |
|
1497 |
\begin{ttdescription} |
|
1498 |
\item[\ttindexbold{tcset}] is a function to return the default tcset; use the |
|
1499 |
expression \texttt{tcset()}. |
|
1500 |
||
1501 |
\item[\ttindexbold{AddTCs}] adds type-checking rules to the default tcset. |
|
1502 |
||
1503 |
\item[\ttindexbold{DelTCs}] removes type-checking rules from the default |
|
1504 |
tcset. |
|
1505 |
||
1506 |
\item[\ttindexbold{Typecheck_tac}] calls \texttt{typecheck_tac} using the |
|
1507 |
default tcset. |
|
1508 |
\end{ttdescription} |
|
1509 |
||
1510 |
To supply some type-checking rules temporarily, using \texttt{Addrules} and |
|
1511 |
later \texttt{Delrules} is the simplest way. There is also a high-tech |
|
1512 |
approach. Call the simplifier with a new solver expressed using |
|
1513 |
\ttindexbold{type_solver_tac} and your temporary type-checking rules. |
|
1514 |
\begin{ttbox} |
|
1515 |
by (asm_simp_tac |
|
1516 |
(simpset() setSolver type_solver_tac (tcset() addTCs prems)) 2); |
|
1517 |
\end{ttbox} |
|
1518 |
||
1519 |
||
1520 |
||
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1521 |
\section{Datatype definitions} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1522 |
\label{sec:ZF:datatype} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1523 |
\index{*datatype|(} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1524 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1525 |
The \ttindex{datatype} definition package of \ZF\ constructs inductive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1526 |
datatypes similar to those of \ML. It can also construct coinductive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1527 |
datatypes (codatatypes), which are non-well-founded structures such as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1528 |
streams. It defines the set using a fixed-point construction and proves |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1529 |
induction rules, as well as theorems for recursion and case combinators. It |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1530 |
supplies mechanisms for reasoning about freeness. The datatype package can |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1531 |
handle both mutual and indirect recursion. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1532 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1533 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1534 |
\subsection{Basics} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1535 |
\label{subsec:datatype:basics} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1536 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1537 |
A \texttt{datatype} definition has the following form: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1538 |
\[ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1539 |
\begin{array}{llcl} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1540 |
\mathtt{datatype} & t@1(A@1,\ldots,A@h) & = & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1541 |
constructor^1@1 ~\mid~ \ldots ~\mid~ constructor^1@{k@1} \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1542 |
& & \vdots \\ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1543 |
\mathtt{and} & t@n(A@1,\ldots,A@h) & = & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1544 |
constructor^n@1~ ~\mid~ \ldots ~\mid~ constructor^n@{k@n} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1545 |
\end{array} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1546 |
\] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1547 |
Here $t@1$, \ldots,~$t@n$ are identifiers and $A@1$, \ldots,~$A@h$ are |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1548 |
variables: the datatype's parameters. Each constructor specification has the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1549 |
form \dquotesoff |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1550 |
\[ C \hbox{\tt~( } \hbox{\tt"} x@1 \hbox{\tt:} T@1 \hbox{\tt"},\; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1551 |
\ldots,\; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1552 |
\hbox{\tt"} x@m \hbox{\tt:} T@m \hbox{\tt"} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1553 |
\hbox{\tt~)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1554 |
\] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1555 |
Here $C$ is the constructor name, and variables $x@1$, \ldots,~$x@m$ are the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1556 |
constructor arguments, belonging to the sets $T@1$, \ldots, $T@m$, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1557 |
respectively. Typically each $T@j$ is either a constant set, a datatype |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1558 |
parameter (one of $A@1$, \ldots, $A@h$) or a recursive occurrence of one of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1559 |
the datatypes, say $t@i(A@1,\ldots,A@h)$. More complex possibilities exist, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1560 |
but they are much harder to realize. Often, additional information must be |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1561 |
supplied in the form of theorems. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1562 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1563 |
A datatype can occur recursively as the argument of some function~$F$. This |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1564 |
is called a {\em nested} (or \emph{indirect}) occurrence. It is only allowed |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1565 |
if the datatype package is given a theorem asserting that $F$ is monotonic. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1566 |
If the datatype has indirect occurrences, then Isabelle/ZF does not support |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1567 |
recursive function definitions. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1568 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1569 |
A simple example of a datatype is \texttt{list}, which is built-in, and is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1570 |
defined by |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1571 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1572 |
consts list :: i=>i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1573 |
datatype "list(A)" = Nil | Cons ("a:A", "l: list(A)") |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1574 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1575 |
Note that the datatype operator must be declared as a constant first. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1576 |
However, the package declares the constructors. Here, \texttt{Nil} gets type |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1577 |
$i$ and \texttt{Cons} gets type $[i,i]\To i$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1578 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1579 |
Trees and forests can be modelled by the mutually recursive datatype |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1580 |
definition |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1581 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1582 |
consts tree, forest, tree_forest :: i=>i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1583 |
datatype "tree(A)" = Tcons ("a: A", "f: forest(A)") |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1584 |
and "forest(A)" = Fnil | Fcons ("t: tree(A)", "f: forest(A)") |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1585 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1586 |
Here $\texttt{tree}(A)$ is the set of trees over $A$, $\texttt{forest}(A)$ is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1587 |
the set of forests over $A$, and $\texttt{tree_forest}(A)$ is the union of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1588 |
the previous two sets. All three operators must be declared first. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1589 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1590 |
The datatype \texttt{term}, which is defined by |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1591 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1592 |
consts term :: i=>i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1593 |
datatype "term(A)" = Apply ("a: A", "l: list(term(A))") |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1594 |
monos "[list_mono]" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1595 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1596 |
is an example of nested recursion. (The theorem \texttt{list_mono} is proved |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1597 |
in file \texttt{List.ML}, and the \texttt{term} example is devaloped in theory |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1598 |
\thydx{ex/Term}.) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1599 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1600 |
\subsubsection{Freeness of the constructors} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1601 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1602 |
Constructors satisfy {\em freeness} properties. Constructions are distinct, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1603 |
for example $\texttt{Nil}\not=\texttt{Cons}(a,l)$, and they are injective, for |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1604 |
example $\texttt{Cons}(a,l)=\texttt{Cons}(a',l') \bimp a=a' \conj l=l'$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1605 |
Because the number of freeness is quadratic in the number of constructors, the |
6143 | 1606 |
datatype package does not prove them. Instead, it ensures that simplification |
1607 |
will prove them dynamically: when the simplifier encounters a formula |
|
1608 |
asserting the equality of two datatype constructors, it performs freeness |
|
1609 |
reasoning. |
|
1610 |
||
1611 |
Freeness reasoning can also be done using the classical reasoner, but it is |
|
1612 |
more complicated. You have to add some safe elimination rules rules to the |
|
1613 |
claset. For the \texttt{list} datatype, they are called |
|
1614 |
\texttt{list.free_SEs}. Occasionally this exposes the underlying |
|
1615 |
representation of some constructor, which can be rectified using the command |
|
1616 |
\hbox{\tt fold_tac list.con_defs}. |
|
1617 |
||
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1618 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1619 |
\subsubsection{Structural induction} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1620 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1621 |
The datatype package also provides structural induction rules. For datatypes |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1622 |
without mutual or nested recursion, the rule has the form exemplified by |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1623 |
\texttt{list.induct} in Fig.\ts\ref{zf-list}. For mutually recursive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1624 |
datatypes, the induction rule is supplied in two forms. Consider datatype |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1625 |
\texttt{TF}. The rule \texttt{tree_forest.induct} performs induction over a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1626 |
single predicate~\texttt{P}, which is presumed to be defined for both trees |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1627 |
and forests: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1628 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1629 |
[| x : tree_forest(A); |
8249 | 1630 |
!!a f. [| a : A; f : forest(A); P(f) |] ==> P(Tcons(a, f)); |
1631 |
P(Fnil); |
|
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1632 |
!!f t. [| t : tree(A); P(t); f : forest(A); P(f) |] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1633 |
==> P(Fcons(t, f)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1634 |
|] ==> P(x) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1635 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1636 |
The rule \texttt{tree_forest.mutual_induct} performs induction over two |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1637 |
distinct predicates, \texttt{P_tree} and \texttt{P_forest}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1638 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1639 |
[| !!a f. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1640 |
[| a : A; f : forest(A); P_forest(f) |] ==> P_tree(Tcons(a, f)); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1641 |
P_forest(Fnil); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1642 |
!!f t. [| t : tree(A); P_tree(t); f : forest(A); P_forest(f) |] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1643 |
==> P_forest(Fcons(t, f)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1644 |
|] ==> (ALL za. za : tree(A) --> P_tree(za)) & |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1645 |
(ALL za. za : forest(A) --> P_forest(za)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1646 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1647 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1648 |
For datatypes with nested recursion, such as the \texttt{term} example from |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1649 |
above, things are a bit more complicated. The rule \texttt{term.induct} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1650 |
refers to the monotonic operator, \texttt{list}: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1651 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1652 |
[| x : term(A); |
8249 | 1653 |
!!a l. [| a: A; l: list(Collect(term(A), P)) |] ==> P(Apply(a, l)) |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1654 |
|] ==> P(x) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1655 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1656 |
The file \texttt{ex/Term.ML} derives two higher-level induction rules, one of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1657 |
which is particularly useful for proving equations: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1658 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1659 |
[| t : term(A); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1660 |
!!x zs. [| x : A; zs : list(term(A)); map(f, zs) = map(g, zs) |] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1661 |
==> f(Apply(x, zs)) = g(Apply(x, zs)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1662 |
|] ==> f(t) = g(t) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1663 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1664 |
How this can be generalized to other nested datatypes is a matter for future |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1665 |
research. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1666 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1667 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1668 |
\subsubsection{The \texttt{case} operator} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1669 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1670 |
The package defines an operator for performing case analysis over the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1671 |
datatype. For \texttt{list}, it is called \texttt{list_case} and satisfies |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1672 |
the equations |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1673 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1674 |
list_case(f_Nil, f_Cons, []) = f_Nil |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1675 |
list_case(f_Nil, f_Cons, Cons(a, l)) = f_Cons(a, l) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1676 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1677 |
Here \texttt{f_Nil} is the value to return if the argument is \texttt{Nil} and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1678 |
\texttt{f_Cons} is a function that computes the value to return if the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1679 |
argument has the form $\texttt{Cons}(a,l)$. The function can be expressed as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1680 |
an abstraction, over patterns if desired (\S\ref{sec:pairs}). |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1681 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1682 |
For mutually recursive datatypes, there is a single \texttt{case} operator. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1683 |
In the tree/forest example, the constant \texttt{tree_forest_case} handles all |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1684 |
of the constructors of the two datatypes. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1685 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1686 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1687 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1688 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1689 |
\subsection{Defining datatypes} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1690 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1691 |
The theory syntax for datatype definitions is shown in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1692 |
Fig.~\ref{datatype-grammar}. In order to be well-formed, a datatype |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1693 |
definition has to obey the rules stated in the previous section. As a result |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1694 |
the theory is extended with the new types, the constructors, and the theorems |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1695 |
listed in the previous section. The quotation marks are necessary because |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1696 |
they enclose general Isabelle formul\ae. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1697 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1698 |
\begin{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1699 |
\begin{rail} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1700 |
datatype : ( 'datatype' | 'codatatype' ) datadecls; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1701 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1702 |
datadecls: ( '"' id arglist '"' '=' (constructor + '|') ) + 'and' |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1703 |
; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1704 |
constructor : name ( () | consargs ) ( () | ( '(' mixfix ')' ) ) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1705 |
; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1706 |
consargs : '(' ('"' var ':' term '"' + ',') ')' |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1707 |
; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1708 |
\end{rail} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1709 |
\caption{Syntax of datatype declarations} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1710 |
\label{datatype-grammar} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1711 |
\end{figure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1712 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1713 |
Codatatypes are declared like datatypes and are identical to them in every |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1714 |
respect except that they have a coinduction rule instead of an induction rule. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1715 |
Note that while an induction rule has the effect of limiting the values |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1716 |
contained in the set, a coinduction rule gives a way of constructing new |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1717 |
values of the set. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1718 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1719 |
Most of the theorems about datatypes become part of the default simpset. You |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1720 |
never need to see them again because the simplifier applies them |
6143 | 1721 |
automatically. Induction or exhaustion are usually invoked by hand, |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1722 |
usually via these special-purpose tactics: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1723 |
\begin{ttdescription} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1724 |
\item[\ttindexbold{induct_tac} {\tt"}$x${\tt"} $i$] applies structural |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1725 |
induction on variable $x$ to subgoal $i$, provided the type of $x$ is a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1726 |
datatype. The induction variable should not occur among other assumptions |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1727 |
of the subgoal. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1728 |
\end{ttdescription} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1729 |
In some cases, induction is overkill and a case distinction over all |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1730 |
constructors of the datatype suffices. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1731 |
\begin{ttdescription} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1732 |
\item[\ttindexbold{exhaust_tac} {\tt"}$x${\tt"} $i$] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1733 |
performs an exhaustive case analysis for the variable~$x$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1734 |
\end{ttdescription} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1735 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1736 |
Both tactics can only be applied to a variable, whose typing must be given in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1737 |
some assumption, for example the assumption \texttt{x:\ list(A)}. The tactics |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1738 |
also work for the natural numbers (\texttt{nat}) and disjoint sums, although |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1739 |
these sets were not defined using the datatype package. (Disjoint sums are |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1740 |
not recursive, so only \texttt{exhaust_tac} is available.) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1741 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1742 |
\bigskip |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1743 |
Here are some more details for the technically minded. Processing the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1744 |
theory file produces an \ML\ structure which, in addition to the usual |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1745 |
components, contains a structure named $t$ for each datatype $t$ defined in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1746 |
the file. Each structure $t$ contains the following elements: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1747 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1748 |
val intrs : thm list \textrm{the introduction rules} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1749 |
val elim : thm \textrm{the elimination (case analysis) rule} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1750 |
val induct : thm \textrm{the standard induction rule} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1751 |
val mutual_induct : thm \textrm{the mutual induction rule, or \texttt{True}} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1752 |
val case_eqns : thm list \textrm{equations for the case operator} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1753 |
val recursor_eqns : thm list \textrm{equations for the recursor} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1754 |
val con_defs : thm list \textrm{definitions of the case operator and constructors} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1755 |
val free_iffs : thm list \textrm{logical equivalences for proving freeness} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1756 |
val free_SEs : thm list \textrm{elimination rules for proving freeness} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1757 |
val mk_free : string -> thm \textrm{A function for proving freeness theorems} |
6141 | 1758 |
val mk_cases : string -> thm \textrm{case analysis, see below} |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1759 |
val defs : thm list \textrm{definitions of operators} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1760 |
val bnd_mono : thm list \textrm{monotonicity property} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1761 |
val dom_subset : thm list \textrm{inclusion in `bounding set'} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1762 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1763 |
Furthermore there is the theorem $C$\texttt{_I} for every constructor~$C$; for |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1764 |
example, the \texttt{list} datatype's introduction rules are bound to the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1765 |
identifiers \texttt{Nil_I} and \texttt{Cons_I}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1766 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1767 |
For a codatatype, the component \texttt{coinduct} is the coinduction rule, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1768 |
replacing the \texttt{induct} component. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1769 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1770 |
See the theories \texttt{ex/Ntree} and \texttt{ex/Brouwer} for examples of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1771 |
infinitely branching datatypes. See theory \texttt{ex/LList} for an example |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1772 |
of a codatatype. Some of these theories illustrate the use of additional, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1773 |
undocumented features of the datatype package. Datatype definitions are |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1774 |
reduced to inductive definitions, and the advanced features should be |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1775 |
understood in that light. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1776 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1777 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1778 |
\subsection{Examples} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1779 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1780 |
\subsubsection{The datatype of binary trees} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1781 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1782 |
Let us define the set $\texttt{bt}(A)$ of binary trees over~$A$. The theory |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1783 |
must contain these lines: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1784 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1785 |
consts bt :: i=>i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1786 |
datatype "bt(A)" = Lf | Br ("a: A", "t1: bt(A)", "t2: bt(A)") |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1787 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1788 |
After loading the theory, we can prove, for example, that no tree equals its |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1789 |
left branch. To ease the induction, we state the goal using quantifiers. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1790 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1791 |
Goal "l : bt(A) ==> ALL x r. Br(x,l,r) ~= l"; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1792 |
{\out Level 0} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1793 |
{\out l : bt(A) ==> ALL x r. Br(x, l, r) ~= l} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1794 |
{\out 1. l : bt(A) ==> ALL x r. Br(x, l, r) ~= l} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1795 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1796 |
This can be proved by the structural induction tactic: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1797 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1798 |
by (induct_tac "l" 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1799 |
{\out Level 1} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1800 |
{\out l : bt(A) ==> ALL x r. Br(x, l, r) ~= l} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1801 |
{\out 1. ALL x r. Br(x, Lf, r) ~= Lf} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1802 |
{\out 2. !!a t1 t2.} |
8249 | 1803 |
{\out [| a : A; t1 : bt(A);} |
1804 |
{\out ALL x r. Br(x, t1, r) ~= t1; t2 : bt(A);} |
|
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1805 |
{\out ALL x r. Br(x, t2, r) ~= t2 |]} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1806 |
{\out ==> ALL x r. Br(x, Br(a, t1, t2), r) ~= Br(a, t1, t2)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1807 |
\end{ttbox} |
6143 | 1808 |
Both subgoals are proved using \texttt{Auto_tac}, which performs the necessary |
1809 |
freeness reasoning. |
|
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1810 |
\begin{ttbox} |
6143 | 1811 |
by Auto_tac; |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1812 |
{\out Level 2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1813 |
{\out l : bt(A) ==> ALL x r. Br(x, l, r) ~= l} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1814 |
{\out No subgoals!} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1815 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1816 |
To remove the quantifiers from the induction formula, we save the theorem using |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1817 |
\ttindex{qed_spec_mp}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1818 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1819 |
qed_spec_mp "Br_neq_left"; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1820 |
{\out val Br_neq_left = "?l : bt(?A) ==> Br(?x, ?l, ?r) ~= ?l" : thm} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1821 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1822 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1823 |
When there are only a few constructors, we might prefer to prove the freenness |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1824 |
theorems for each constructor. This is trivial, using the function given us |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1825 |
for that purpose: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1826 |
\begin{ttbox} |
8249 | 1827 |
val Br_iff = |
1828 |
bt.mk_free "Br(a,l,r)=Br(a',l',r') <-> a=a' & l=l' & r=r'"; |
|
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1829 |
{\out val Br_iff =} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1830 |
{\out "Br(?a, ?l, ?r) = Br(?a', ?l', ?r') <->} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1831 |
{\out ?a = ?a' & ?l = ?l' & ?r = ?r'" : thm} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1832 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1833 |
|
6141 | 1834 |
The purpose of \ttindex{mk_cases} is to generate instances of the elimination |
1835 |
(case analysis) rule that have been simplified using freeness reasoning. For |
|
1836 |
example, this instance of the elimination rule propagates type-checking |
|
1837 |
information from the premise $\texttt{Br}(a,l,r)\in\texttt{bt}(A)$: |
|
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1838 |
\begin{ttbox} |
6141 | 1839 |
val BrE = bt.mk_cases "Br(a,l,r) : bt(A)"; |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1840 |
{\out val BrE =} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1841 |
{\out "[| Br(?a, ?l, ?r) : bt(?A);} |
8249 | 1842 |
{\out [| ?a : ?A; ?l : bt(?A); ?r : bt(?A) |] ==> ?Q |]} |
1843 |
{\out ==> ?Q" : thm} |
|
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1844 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1845 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1846 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1847 |
\subsubsection{Mixfix syntax in datatypes} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1848 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1849 |
Mixfix syntax is sometimes convenient. The theory \texttt{ex/PropLog} makes a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1850 |
deep embedding of propositional logic: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1851 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1852 |
consts prop :: i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1853 |
datatype "prop" = Fls |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1854 |
| Var ("n: nat") ("#_" [100] 100) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1855 |
| "=>" ("p: prop", "q: prop") (infixr 90) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1856 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1857 |
The second constructor has a special $\#n$ syntax, while the third constructor |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1858 |
is an infixed arrow. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1859 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1860 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1861 |
\subsubsection{A giant enumeration type} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1862 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1863 |
This example shows a datatype that consists of 60 constructors: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1864 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1865 |
consts enum :: i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1866 |
datatype |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1867 |
"enum" = C00 | C01 | C02 | C03 | C04 | C05 | C06 | C07 | C08 | C09 |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1868 |
| C10 | C11 | C12 | C13 | C14 | C15 | C16 | C17 | C18 | C19 |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1869 |
| C20 | C21 | C22 | C23 | C24 | C25 | C26 | C27 | C28 | C29 |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1870 |
| C30 | C31 | C32 | C33 | C34 | C35 | C36 | C37 | C38 | C39 |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1871 |
| C40 | C41 | C42 | C43 | C44 | C45 | C46 | C47 | C48 | C49 |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1872 |
| C50 | C51 | C52 | C53 | C54 | C55 | C56 | C57 | C58 | C59 |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1873 |
end |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1874 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1875 |
The datatype package scales well. Even though all properties are proved |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1876 |
rather than assumed, full processing of this definition takes under 15 seconds |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1877 |
(on a 300 MHz Pentium). The constructors have a balanced representation, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1878 |
essentially binary notation, so freeness properties can be proved fast. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1879 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1880 |
Goal "C00 ~= C01"; |
6143 | 1881 |
by (Simp_tac 1); |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1882 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1883 |
You need not derive such inequalities explicitly. The simplifier will dispose |
6143 | 1884 |
of them automatically. |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1885 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1886 |
\index{*datatype|)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1887 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1888 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1889 |
\subsection{Recursive function definitions}\label{sec:ZF:recursive} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1890 |
\index{recursive functions|see{recursion}} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1891 |
\index{*primrec|(} |
6173 | 1892 |
\index{recursion!primitive|(} |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1893 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1894 |
Datatypes come with a uniform way of defining functions, {\bf primitive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1895 |
recursion}. Such definitions rely on the recursion operator defined by the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1896 |
datatype package. Isabelle proves the desired recursion equations as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1897 |
theorems. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1898 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1899 |
In principle, one could introduce primitive recursive functions by asserting |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1900 |
their reduction rules as new axioms. Here is a dangerous way of defining the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1901 |
append function for lists: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1902 |
\begin{ttbox}\slshape |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1903 |
consts "\at" :: [i,i]=>i (infixr 60) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1904 |
rules |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1905 |
app_Nil "[] \at ys = ys" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1906 |
app_Cons "(Cons(a,l)) \at ys = Cons(a, l \at ys)" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1907 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1908 |
Asserting axioms brings the danger of accidentally asserting nonsense. It |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1909 |
should be avoided at all costs! |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1910 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1911 |
The \ttindex{primrec} declaration is a safe means of defining primitive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1912 |
recursive functions on datatypes: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1913 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1914 |
consts "\at" :: [i,i]=>i (infixr 60) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1915 |
primrec |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1916 |
"[] \at ys = ys" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1917 |
"(Cons(a,l)) \at ys = Cons(a, l \at ys)" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1918 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1919 |
Isabelle will now check that the two rules do indeed form a primitive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1920 |
recursive definition. For example, the declaration |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1921 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1922 |
primrec |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1923 |
"[] \at ys = us" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1924 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1925 |
is rejected with an error message ``\texttt{Extra variables on rhs}''. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1926 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1927 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1928 |
\subsubsection{Syntax of recursive definitions} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1929 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1930 |
The general form of a primitive recursive definition is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1931 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1932 |
primrec |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1933 |
{\it reduction rules} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1934 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1935 |
where \textit{reduction rules} specify one or more equations of the form |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1936 |
\[ f \, x@1 \, \dots \, x@m \, (C \, y@1 \, \dots \, y@k) \, z@1 \, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1937 |
\dots \, z@n = r \] such that $C$ is a constructor of the datatype, $r$ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1938 |
contains only the free variables on the left-hand side, and all recursive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1939 |
calls in $r$ are of the form $f \, \dots \, y@i \, \dots$ for some $i$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1940 |
There must be at most one reduction rule for each constructor. The order is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1941 |
immaterial. For missing constructors, the function is defined to return zero. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1942 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1943 |
All reduction rules are added to the default simpset. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1944 |
If you would like to refer to some rule by name, then you must prefix |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1945 |
the rule with an identifier. These identifiers, like those in the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1946 |
\texttt{rules} section of a theory, will be visible at the \ML\ level. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1947 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1948 |
The reduction rules for {\tt\at} become part of the default simpset, which |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1949 |
leads to short proof scripts: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1950 |
\begin{ttbox}\underscoreon |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1951 |
Goal "xs: list(A) ==> (xs @ ys) @ zs = xs @ (ys @ zs)"; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1952 |
by (induct\_tac "xs" 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1953 |
by (ALLGOALS Asm\_simp\_tac); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1954 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1955 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1956 |
You can even use the \texttt{primrec} form with non-recursive datatypes and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1957 |
with codatatypes. Recursion is not allowed, but it provides a convenient |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1958 |
syntax for defining functions by cases. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1959 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1960 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1961 |
\subsubsection{Example: varying arguments} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1962 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1963 |
All arguments, other than the recursive one, must be the same in each equation |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1964 |
and in each recursive call. To get around this restriction, use explict |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1965 |
$\lambda$-abstraction and function application. Here is an example, drawn |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1966 |
from the theory \texttt{Resid/Substitution}. The type of redexes is declared |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1967 |
as follows: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1968 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1969 |
consts redexes :: i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1970 |
datatype |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1971 |
"redexes" = Var ("n: nat") |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1972 |
| Fun ("t: redexes") |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1973 |
| App ("b:bool" ,"f:redexes" , "a:redexes") |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1974 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1975 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1976 |
The function \texttt{lift} takes a second argument, $k$, which varies in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1977 |
recursive calls. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1978 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1979 |
primrec |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1980 |
"lift(Var(i)) = (lam k:nat. if i<k then Var(i) else Var(succ(i)))" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1981 |
"lift(Fun(t)) = (lam k:nat. Fun(lift(t) ` succ(k)))" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1982 |
"lift(App(b,f,a)) = (lam k:nat. App(b, lift(f)`k, lift(a)`k))" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1983 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1984 |
Now \texttt{lift(r)`k} satisfies the required recursion equations. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1985 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1986 |
\index{recursion!primitive|)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1987 |
\index{*primrec|)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1988 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1989 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1990 |
\section{Inductive and coinductive definitions} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1991 |
\index{*inductive|(} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1992 |
\index{*coinductive|(} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1993 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1994 |
An {\bf inductive definition} specifies the least set~$R$ closed under given |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1995 |
rules. (Applying a rule to elements of~$R$ yields a result within~$R$.) For |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1996 |
example, a structural operational semantics is an inductive definition of an |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1997 |
evaluation relation. Dually, a {\bf coinductive definition} specifies the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1998 |
greatest set~$R$ consistent with given rules. (Every element of~$R$ can be |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
1999 |
seen as arising by applying a rule to elements of~$R$.) An important example |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2000 |
is using bisimulation relations to formalise equivalence of processes and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2001 |
infinite data structures. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2002 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2003 |
A theory file may contain any number of inductive and coinductive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2004 |
definitions. They may be intermixed with other declarations; in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2005 |
particular, the (co)inductive sets {\bf must} be declared separately as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2006 |
constants, and may have mixfix syntax or be subject to syntax translations. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2007 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2008 |
Each (co)inductive definition adds definitions to the theory and also |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2009 |
proves some theorems. Each definition creates an \ML\ structure, which is a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2010 |
substructure of the main theory structure. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2011 |
This package is described in detail in a separate paper,% |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2012 |
\footnote{It appeared in CADE~\cite{paulson-CADE}; a longer version is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2013 |
distributed with Isabelle as \emph{A Fixedpoint Approach to |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2014 |
(Co)Inductive and (Co)Datatype Definitions}.} % |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2015 |
which you might refer to for background information. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2016 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2017 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2018 |
\subsection{The syntax of a (co)inductive definition} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2019 |
An inductive definition has the form |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2020 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2021 |
inductive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2022 |
domains {\it domain declarations} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2023 |
intrs {\it introduction rules} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2024 |
monos {\it monotonicity theorems} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2025 |
con_defs {\it constructor definitions} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2026 |
type_intrs {\it introduction rules for type-checking} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2027 |
type_elims {\it elimination rules for type-checking} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2028 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2029 |
A coinductive definition is identical, but starts with the keyword |
8249 | 2030 |
{\tt co\-inductive}. |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2031 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2032 |
The {\tt monos}, {\tt con\_defs}, {\tt type\_intrs} and {\tt type\_elims} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2033 |
sections are optional. If present, each is specified either as a list of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2034 |
identifiers or as a string. If the latter, then the string must be a valid |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2035 |
\textsc{ml} expression of type {\tt thm list}. The string is simply inserted |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2036 |
into the {\tt _thy.ML} file; if it is ill-formed, it will trigger \textsc{ml} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2037 |
error messages. You can then inspect the file on the temporary directory. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2038 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2039 |
\begin{description} |
8249 | 2040 |
\item[\it domain declarations] are items of the form |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2041 |
{\it string\/}~{\tt <=}~{\it string}, associating each recursive set with |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2042 |
its domain. (The domain is some existing set that is large enough to |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2043 |
hold the new set being defined.) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2044 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2045 |
\item[\it introduction rules] specify one or more introduction rules in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2046 |
the form {\it ident\/}~{\it string}, where the identifier gives the name of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2047 |
the rule in the result structure. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2048 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2049 |
\item[\it monotonicity theorems] are required for each operator applied to |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2050 |
a recursive set in the introduction rules. There \textbf{must} be a theorem |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2051 |
of the form $A\subseteq B\Imp M(A)\subseteq M(B)$, for each premise $t\in M(R_i)$ |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2052 |
in an introduction rule! |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2053 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2054 |
\item[\it constructor definitions] contain definitions of constants |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2055 |
appearing in the introduction rules. The (co)datatype package supplies |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2056 |
the constructors' definitions here. Most (co)inductive definitions omit |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2057 |
this section; one exception is the primitive recursive functions example; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2058 |
see theory \texttt{ex/Primrec}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2059 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2060 |
\item[\it type\_intrs] consists of introduction rules for type-checking the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2061 |
definition: for demonstrating that the new set is included in its domain. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2062 |
(The proof uses depth-first search.) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2063 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2064 |
\item[\it type\_elims] consists of elimination rules for type-checking the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2065 |
definition. They are presumed to be safe and are applied as often as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2066 |
possible prior to the {\tt type\_intrs} search. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2067 |
\end{description} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2068 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2069 |
The package has a few restrictions: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2070 |
\begin{itemize} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2071 |
\item The theory must separately declare the recursive sets as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2072 |
constants. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2073 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2074 |
\item The names of the recursive sets must be identifiers, not infix |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2075 |
operators. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2076 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2077 |
\item Side-conditions must not be conjunctions. However, an introduction rule |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2078 |
may contain any number of side-conditions. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2079 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2080 |
\item Side-conditions of the form $x=t$, where the variable~$x$ does not |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2081 |
occur in~$t$, will be substituted through the rule \verb|mutual_induct|. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2082 |
\end{itemize} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2083 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2084 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2085 |
\subsection{Example of an inductive definition} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2086 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2087 |
Two declarations, included in a theory file, define the finite powerset |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2088 |
operator. First we declare the constant~\texttt{Fin}. Then we declare it |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2089 |
inductively, with two introduction rules: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2090 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2091 |
consts Fin :: i=>i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2092 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2093 |
inductive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2094 |
domains "Fin(A)" <= "Pow(A)" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2095 |
intrs |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2096 |
emptyI "0 : Fin(A)" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2097 |
consI "[| a: A; b: Fin(A) |] ==> cons(a,b) : Fin(A)" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2098 |
type_intrs empty_subsetI, cons_subsetI, PowI |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2099 |
type_elims "[make_elim PowD]" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2100 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2101 |
The resulting theory structure contains a substructure, called~\texttt{Fin}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2102 |
It contains the \texttt{Fin}$~A$ introduction rules as the list |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2103 |
\texttt{Fin.intrs}, and also individually as \texttt{Fin.emptyI} and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2104 |
\texttt{Fin.consI}. The induction rule is \texttt{Fin.induct}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2105 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2106 |
The chief problem with making (co)inductive definitions involves type-checking |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2107 |
the rules. Sometimes, additional theorems need to be supplied under |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2108 |
\texttt{type_intrs} or \texttt{type_elims}. If the package fails when trying |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2109 |
to prove your introduction rules, then set the flag \ttindexbold{trace_induct} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2110 |
to \texttt{true} and try again. (See the manual \emph{A Fixedpoint Approach |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2111 |
\ldots} for more discussion of type-checking.) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2112 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2113 |
In the example above, $\texttt{Pow}(A)$ is given as the domain of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2114 |
$\texttt{Fin}(A)$, for obviously every finite subset of~$A$ is a subset |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2115 |
of~$A$. However, the inductive definition package can only prove that given a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2116 |
few hints. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2117 |
Here is the output that results (with the flag set) when the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2118 |
\texttt{type_intrs} and \texttt{type_elims} are omitted from the inductive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2119 |
definition above: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2120 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2121 |
Inductive definition Finite.Fin |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2122 |
Fin(A) == |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2123 |
lfp(Pow(A), |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2124 |
\%X. {z: Pow(A) . z = 0 | (EX a b. z = cons(a, b) & a : A & b : X)}) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2125 |
Proving monotonicity... |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2126 |
\ttbreak |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2127 |
Proving the introduction rules... |
6173 | 2128 |
The type-checking subgoal: |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2129 |
0 : Fin(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2130 |
1. 0 : Pow(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2131 |
\ttbreak |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2132 |
The subgoal after monos, type_elims: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2133 |
0 : Fin(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2134 |
1. 0 : Pow(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2135 |
*** prove_goal: tactic failed |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2136 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2137 |
We see the need to supply theorems to let the package prove |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2138 |
$\emptyset\in\texttt{Pow}(A)$. Restoring the \texttt{type_intrs} but not the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2139 |
\texttt{type_elims}, we again get an error message: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2140 |
\begin{ttbox} |
6173 | 2141 |
The type-checking subgoal: |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2142 |
0 : Fin(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2143 |
1. 0 : Pow(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2144 |
\ttbreak |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2145 |
The subgoal after monos, type_elims: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2146 |
0 : Fin(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2147 |
1. 0 : Pow(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2148 |
\ttbreak |
6173 | 2149 |
The type-checking subgoal: |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2150 |
cons(a, b) : Fin(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2151 |
1. [| a : A; b : Fin(A) |] ==> cons(a, b) : Pow(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2152 |
\ttbreak |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2153 |
The subgoal after monos, type_elims: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2154 |
cons(a, b) : Fin(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2155 |
1. [| a : A; b : Pow(A) |] ==> cons(a, b) : Pow(A) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2156 |
*** prove_goal: tactic failed |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2157 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2158 |
The first rule has been type-checked, but the second one has failed. The |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2159 |
simplest solution to such problems is to prove the failed subgoal separately |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2160 |
and to supply it under \texttt{type_intrs}. The solution actually used is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2161 |
to supply, under \texttt{type_elims}, a rule that changes |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2162 |
$b\in\texttt{Pow}(A)$ to $b\subseteq A$; together with \texttt{cons_subsetI} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2163 |
and \texttt{PowI}, it is enough to complete the type-checking. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2164 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2165 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2166 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2167 |
\subsection{Further examples} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2168 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2169 |
An inductive definition may involve arbitrary monotonic operators. Here is a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2170 |
standard example: the accessible part of a relation. Note the use |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2171 |
of~\texttt{Pow} in the introduction rule and the corresponding mention of the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2172 |
rule \verb|Pow_mono| in the \texttt{monos} list. If the desired rule has a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2173 |
universally quantified premise, usually the effect can be obtained using |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2174 |
\texttt{Pow}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2175 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2176 |
consts acc :: i=>i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2177 |
inductive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2178 |
domains "acc(r)" <= "field(r)" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2179 |
intrs |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2180 |
vimage "[| r-``{a}: Pow(acc(r)); a: field(r) |] ==> a: acc(r)" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2181 |
monos Pow_mono |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2182 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2183 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2184 |
Finally, here is a coinductive definition. It captures (as a bisimulation) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2185 |
the notion of equality on lazy lists, which are first defined as a codatatype: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2186 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2187 |
consts llist :: i=>i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2188 |
codatatype "llist(A)" = LNil | LCons ("a: A", "l: llist(A)") |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2189 |
\ttbreak |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2190 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2191 |
consts lleq :: i=>i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2192 |
coinductive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2193 |
domains "lleq(A)" <= "llist(A) * llist(A)" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2194 |
intrs |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2195 |
LNil "<LNil, LNil> : lleq(A)" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2196 |
LCons "[| a:A; <l,l'>: lleq(A) |] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2197 |
==> <LCons(a,l), LCons(a,l')>: lleq(A)" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2198 |
type_intrs "llist.intrs" |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2199 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2200 |
This use of \texttt{type_intrs} is typical: the relation concerns the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2201 |
codatatype \texttt{llist}, so naturally the introduction rules for that |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2202 |
codatatype will be required for type-checking the rules. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2203 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2204 |
The Isabelle distribution contains many other inductive definitions. Simple |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2205 |
examples are collected on subdirectory \texttt{ZF/ex}. The directory |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2206 |
\texttt{Coind} and the theory \texttt{ZF/ex/LList} contain coinductive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2207 |
definitions. Larger examples may be found on other subdirectories of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2208 |
\texttt{ZF}, such as \texttt{IMP}, and \texttt{Resid}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2209 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2210 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2211 |
\subsection{The result structure} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2212 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2213 |
Each (co)inductive set defined in a theory file generates an \ML\ substructure |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2214 |
having the same name. The the substructure contains the following elements: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2215 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2216 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2217 |
val intrs : thm list \textrm{the introduction rules} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2218 |
val elim : thm \textrm{the elimination (case analysis) rule} |
6141 | 2219 |
val mk_cases : string -> thm \textrm{case analysis, see below} |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2220 |
val induct : thm \textrm{the standard induction rule} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2221 |
val mutual_induct : thm \textrm{the mutual induction rule, or \texttt{True}} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2222 |
val defs : thm list \textrm{definitions of operators} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2223 |
val bnd_mono : thm list \textrm{monotonicity property} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2224 |
val dom_subset : thm list \textrm{inclusion in `bounding set'} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2225 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2226 |
Furthermore there is the theorem $C$\texttt{_I} for every constructor~$C$; for |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2227 |
example, the \texttt{list} datatype's introduction rules are bound to the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2228 |
identifiers \texttt{Nil_I} and \texttt{Cons_I}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2229 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2230 |
For a codatatype, the component \texttt{coinduct} is the coinduction rule, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2231 |
replacing the \texttt{induct} component. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2232 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2233 |
Recall that \ttindex{mk_cases} generates simplified instances of the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2234 |
elimination (case analysis) rule. It is as useful for inductive definitions |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2235 |
as it is for datatypes. There are many examples in the theory |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2236 |
\texttt{ex/Comb}, which is discussed at length |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2237 |
elsewhere~\cite{paulson-generic}. The theory first defines the datatype |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2238 |
\texttt{comb} of combinators: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2239 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2240 |
consts comb :: i |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2241 |
datatype "comb" = K |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2242 |
| S |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2243 |
| "#" ("p: comb", "q: comb") (infixl 90) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2244 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2245 |
The theory goes on to define contraction and parallel contraction |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2246 |
inductively. Then the file \texttt{ex/Comb.ML} defines special cases of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2247 |
contraction using \texttt{mk_cases}: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2248 |
\begin{ttbox} |
6141 | 2249 |
val K_contractE = contract.mk_cases "K -1-> r"; |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2250 |
{\out val K_contractE = "K -1-> ?r ==> ?Q" : thm} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2251 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2252 |
We can read this as saying that the combinator \texttt{K} cannot reduce to |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2253 |
anything. Similar elimination rules for \texttt{S} and application are also |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2254 |
generated and are supplied to the classical reasoner. Note that |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2255 |
\texttt{comb.con_defs} is given to \texttt{mk_cases} to allow freeness |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2256 |
reasoning on datatype \texttt{comb}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2257 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2258 |
\index{*coinductive|)} \index{*inductive|)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2259 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2260 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2261 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2262 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2263 |
\section{The outer reaches of set theory} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2264 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2265 |
The constructions of the natural numbers and lists use a suite of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2266 |
operators for handling recursive function definitions. I have described |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2267 |
the developments in detail elsewhere~\cite{paulson-set-II}. Here is a brief |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2268 |
summary: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2269 |
\begin{itemize} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2270 |
\item Theory \texttt{Trancl} defines the transitive closure of a relation |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2271 |
(as a least fixedpoint). |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2272 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2273 |
\item Theory \texttt{WF} proves the Well-Founded Recursion Theorem, using an |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2274 |
elegant approach of Tobias Nipkow. This theorem permits general |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2275 |
recursive definitions within set theory. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2276 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2277 |
\item Theory \texttt{Ord} defines the notions of transitive set and ordinal |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2278 |
number. It derives transfinite induction. A key definition is {\bf |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2279 |
less than}: $i<j$ if and only if $i$ and $j$ are both ordinals and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2280 |
$i\in j$. As a special case, it includes less than on the natural |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2281 |
numbers. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2282 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2283 |
\item Theory \texttt{Epsilon} derives $\varepsilon$-induction and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2284 |
$\varepsilon$-recursion, which are generalisations of transfinite |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2285 |
induction and recursion. It also defines \cdx{rank}$(x)$, which |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2286 |
is the least ordinal $\alpha$ such that $x$ is constructed at |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2287 |
stage $\alpha$ of the cumulative hierarchy (thus $x\in |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2288 |
V@{\alpha+1}$). |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2289 |
\end{itemize} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2290 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2291 |
Other important theories lead to a theory of cardinal numbers. They have |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2292 |
not yet been written up anywhere. Here is a summary: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2293 |
\begin{itemize} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2294 |
\item Theory \texttt{Rel} defines the basic properties of relations, such as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2295 |
(ir)reflexivity, (a)symmetry, and transitivity. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2296 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2297 |
\item Theory \texttt{EquivClass} develops a theory of equivalence |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2298 |
classes, not using the Axiom of Choice. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2299 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2300 |
\item Theory \texttt{Order} defines partial orderings, total orderings and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2301 |
wellorderings. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2302 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2303 |
\item Theory \texttt{OrderArith} defines orderings on sum and product sets. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2304 |
These can be used to define ordinal arithmetic and have applications to |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2305 |
cardinal arithmetic. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2306 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2307 |
\item Theory \texttt{OrderType} defines order types. Every wellordering is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2308 |
equivalent to a unique ordinal, which is its order type. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2309 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2310 |
\item Theory \texttt{Cardinal} defines equipollence and cardinal numbers. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2311 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2312 |
\item Theory \texttt{CardinalArith} defines cardinal addition and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2313 |
multiplication, and proves their elementary laws. It proves that there |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2314 |
is no greatest cardinal. It also proves a deep result, namely |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2315 |
$\kappa\otimes\kappa=\kappa$ for every infinite cardinal~$\kappa$; see |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2316 |
Kunen~\cite[page 29]{kunen80}. None of these results assume the Axiom of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2317 |
Choice, which complicates their proofs considerably. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2318 |
\end{itemize} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2319 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2320 |
The following developments involve the Axiom of Choice (AC): |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2321 |
\begin{itemize} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2322 |
\item Theory \texttt{AC} asserts the Axiom of Choice and proves some simple |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2323 |
equivalent forms. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2324 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2325 |
\item Theory \texttt{Zorn} proves Hausdorff's Maximal Principle, Zorn's Lemma |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2326 |
and the Wellordering Theorem, following Abrial and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2327 |
Laffitte~\cite{abrial93}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2328 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2329 |
\item Theory \verb|Cardinal_AC| uses AC to prove simplified theorems about |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2330 |
the cardinals. It also proves a theorem needed to justify |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2331 |
infinitely branching datatype declarations: if $\kappa$ is an infinite |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2332 |
cardinal and $|X(\alpha)| \le \kappa$ for all $\alpha<\kappa$ then |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2333 |
$|\union\sb{\alpha<\kappa} X(\alpha)| \le \kappa$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2334 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2335 |
\item Theory \texttt{InfDatatype} proves theorems to justify infinitely |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2336 |
branching datatypes. Arbitrary index sets are allowed, provided their |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2337 |
cardinalities have an upper bound. The theory also justifies some |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2338 |
unusual cases of finite branching, involving the finite powerset operator |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2339 |
and the finite function space operator. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2340 |
\end{itemize} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2341 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2342 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2343 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2344 |
\section{The examples directories} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2345 |
Directory \texttt{HOL/IMP} contains a mechanised version of a semantic |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2346 |
equivalence proof taken from Winskel~\cite{winskel93}. It formalises the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2347 |
denotational and operational semantics of a simple while-language, then |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2348 |
proves the two equivalent. It contains several datatype and inductive |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2349 |
definitions, and demonstrates their use. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2350 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2351 |
The directory \texttt{ZF/ex} contains further developments in {\ZF} set |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2352 |
theory. Here is an overview; see the files themselves for more details. I |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2353 |
describe much of this material in other |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2354 |
publications~\cite{paulson-set-I,paulson-set-II,paulson-CADE}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2355 |
\begin{itemize} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2356 |
\item File \texttt{misc.ML} contains miscellaneous examples such as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2357 |
Cantor's Theorem, the Schr\"oder-Bernstein Theorem and the `Composition |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2358 |
of homomorphisms' challenge~\cite{boyer86}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2359 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2360 |
\item Theory \texttt{Ramsey} proves the finite exponent 2 version of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2361 |
Ramsey's Theorem, following Basin and Kaufmann's |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2362 |
presentation~\cite{basin91}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2363 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2364 |
\item Theory \texttt{Integ} develops a theory of the integers as |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2365 |
equivalence classes of pairs of natural numbers. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2366 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2367 |
\item Theory \texttt{Primrec} develops some computation theory. It |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2368 |
inductively defines the set of primitive recursive functions and presents a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2369 |
proof that Ackermann's function is not primitive recursive. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2370 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2371 |
\item Theory \texttt{Primes} defines the Greatest Common Divisor of two |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2372 |
natural numbers and and the ``divides'' relation. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2373 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2374 |
\item Theory \texttt{Bin} defines a datatype for two's complement binary |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2375 |
integers, then proves rewrite rules to perform binary arithmetic. For |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2376 |
instance, $1359\times {-}2468 = {-}3354012$ takes under 14 seconds. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2377 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2378 |
\item Theory \texttt{BT} defines the recursive data structure ${\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2379 |
bt}(A)$, labelled binary trees. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2380 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2381 |
\item Theory \texttt{Term} defines a recursive data structure for terms |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2382 |
and term lists. These are simply finite branching trees. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2383 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2384 |
\item Theory \texttt{TF} defines primitives for solving mutually |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2385 |
recursive equations over sets. It constructs sets of trees and forests |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2386 |
as an example, including induction and recursion rules that handle the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2387 |
mutual recursion. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2388 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2389 |
\item Theory \texttt{Prop} proves soundness and completeness of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2390 |
propositional logic~\cite{paulson-set-II}. This illustrates datatype |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2391 |
definitions, inductive definitions, structural induction and rule |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2392 |
induction. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2393 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2394 |
\item Theory \texttt{ListN} inductively defines the lists of $n$ |
6592 | 2395 |
elements~\cite{paulin-tlca}. |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2396 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2397 |
\item Theory \texttt{Acc} inductively defines the accessible part of a |
6592 | 2398 |
relation~\cite{paulin-tlca}. |
6121
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2399 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2400 |
\item Theory \texttt{Comb} defines the datatype of combinators and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2401 |
inductively defines contraction and parallel contraction. It goes on to |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2402 |
prove the Church-Rosser Theorem. This case study follows Camilleri and |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2403 |
Melham~\cite{camilleri92}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2404 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2405 |
\item Theory \texttt{LList} defines lazy lists and a coinduction |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2406 |
principle for proving equations between them. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2407 |
\end{itemize} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2408 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2409 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2410 |
\section{A proof about powersets}\label{sec:ZF-pow-example} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2411 |
To demonstrate high-level reasoning about subsets, let us prove the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2412 |
equation ${{\tt Pow}(A)\cap {\tt Pow}(B)}= {\tt Pow}(A\cap B)$. Compared |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2413 |
with first-order logic, set theory involves a maze of rules, and theorems |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2414 |
have many different proofs. Attempting other proofs of the theorem might |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2415 |
be instructive. This proof exploits the lattice properties of |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2416 |
intersection. It also uses the monotonicity of the powerset operation, |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2417 |
from \texttt{ZF/mono.ML}: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2418 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2419 |
\tdx{Pow_mono} A<=B ==> Pow(A) <= Pow(B) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2420 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2421 |
We enter the goal and make the first step, which breaks the equation into |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2422 |
two inclusions by extensionality:\index{*equalityI theorem} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2423 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2424 |
Goal "Pow(A Int B) = Pow(A) Int Pow(B)"; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2425 |
{\out Level 0} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2426 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2427 |
{\out 1. Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2428 |
\ttbreak |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2429 |
by (resolve_tac [equalityI] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2430 |
{\out Level 1} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2431 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2432 |
{\out 1. Pow(A Int B) <= Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2433 |
{\out 2. Pow(A) Int Pow(B) <= Pow(A Int B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2434 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2435 |
Both inclusions could be tackled straightforwardly using \texttt{subsetI}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2436 |
A shorter proof results from noting that intersection forms the greatest |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2437 |
lower bound:\index{*Int_greatest theorem} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2438 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2439 |
by (resolve_tac [Int_greatest] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2440 |
{\out Level 2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2441 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2442 |
{\out 1. Pow(A Int B) <= Pow(A)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2443 |
{\out 2. Pow(A Int B) <= Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2444 |
{\out 3. Pow(A) Int Pow(B) <= Pow(A Int B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2445 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2446 |
Subgoal~1 follows by applying the monotonicity of \texttt{Pow} to $A\int |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2447 |
B\subseteq A$; subgoal~2 follows similarly: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2448 |
\index{*Int_lower1 theorem}\index{*Int_lower2 theorem} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2449 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2450 |
by (resolve_tac [Int_lower1 RS Pow_mono] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2451 |
{\out Level 3} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2452 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2453 |
{\out 1. Pow(A Int B) <= Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2454 |
{\out 2. Pow(A) Int Pow(B) <= Pow(A Int B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2455 |
\ttbreak |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2456 |
by (resolve_tac [Int_lower2 RS Pow_mono] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2457 |
{\out Level 4} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2458 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2459 |
{\out 1. Pow(A) Int Pow(B) <= Pow(A Int B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2460 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2461 |
We are left with the opposite inclusion, which we tackle in the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2462 |
straightforward way:\index{*subsetI theorem} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2463 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2464 |
by (resolve_tac [subsetI] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2465 |
{\out Level 5} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2466 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2467 |
{\out 1. !!x. x : Pow(A) Int Pow(B) ==> x : Pow(A Int B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2468 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2469 |
The subgoal is to show $x\in {\tt Pow}(A\cap B)$ assuming $x\in{\tt |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2470 |
Pow}(A)\cap {\tt Pow}(B)$; eliminating this assumption produces two |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2471 |
subgoals. The rule \tdx{IntE} treats the intersection like a conjunction |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2472 |
instead of unfolding its definition. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2473 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2474 |
by (eresolve_tac [IntE] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2475 |
{\out Level 6} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2476 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2477 |
{\out 1. !!x. [| x : Pow(A); x : Pow(B) |] ==> x : Pow(A Int B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2478 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2479 |
The next step replaces the \texttt{Pow} by the subset |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2480 |
relation~($\subseteq$).\index{*PowI theorem} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2481 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2482 |
by (resolve_tac [PowI] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2483 |
{\out Level 7} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2484 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2485 |
{\out 1. !!x. [| x : Pow(A); x : Pow(B) |] ==> x <= A Int B} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2486 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2487 |
We perform the same replacement in the assumptions. This is a good |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2488 |
demonstration of the tactic \ttindex{dresolve_tac}:\index{*PowD theorem} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2489 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2490 |
by (REPEAT (dresolve_tac [PowD] 1)); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2491 |
{\out Level 8} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2492 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2493 |
{\out 1. !!x. [| x <= A; x <= B |] ==> x <= A Int B} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2494 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2495 |
The assumptions are that $x$ is a lower bound of both $A$ and~$B$, but |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2496 |
$A\int B$ is the greatest lower bound:\index{*Int_greatest theorem} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2497 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2498 |
by (resolve_tac [Int_greatest] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2499 |
{\out Level 9} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2500 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2501 |
{\out 1. !!x. [| x <= A; x <= B |] ==> x <= A} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2502 |
{\out 2. !!x. [| x <= A; x <= B |] ==> x <= B} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2503 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2504 |
To conclude the proof, we clear up the trivial subgoals: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2505 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2506 |
by (REPEAT (assume_tac 1)); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2507 |
{\out Level 10} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2508 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2509 |
{\out No subgoals!} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2510 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2511 |
\medskip |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2512 |
We could have performed this proof in one step by applying |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2513 |
\ttindex{Blast_tac}. Let us |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2514 |
go back to the start: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2515 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2516 |
choplev 0; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2517 |
{\out Level 0} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2518 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2519 |
{\out 1. Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2520 |
by (Blast_tac 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2521 |
{\out Depth = 0} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2522 |
{\out Depth = 1} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2523 |
{\out Depth = 2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2524 |
{\out Depth = 3} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2525 |
{\out Level 1} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2526 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2527 |
{\out No subgoals!} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2528 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2529 |
Past researchers regarded this as a difficult proof, as indeed it is if all |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2530 |
the symbols are replaced by their definitions. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2531 |
\goodbreak |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2532 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2533 |
\section{Monotonicity of the union operator} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2534 |
For another example, we prove that general union is monotonic: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2535 |
${C\subseteq D}$ implies $\bigcup(C)\subseteq \bigcup(D)$. To begin, we |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2536 |
tackle the inclusion using \tdx{subsetI}: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2537 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2538 |
Goal "C<=D ==> Union(C) <= Union(D)"; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2539 |
{\out Level 0} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2540 |
{\out C <= D ==> Union(C) <= Union(D)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2541 |
{\out 1. C <= D ==> Union(C) <= Union(D)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2542 |
\ttbreak |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2543 |
by (resolve_tac [subsetI] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2544 |
{\out Level 1} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2545 |
{\out C <= D ==> Union(C) <= Union(D)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2546 |
{\out 1. !!x. [| C <= D; x : Union(C) |] ==> x : Union(D)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2547 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2548 |
Big union is like an existential quantifier --- the occurrence in the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2549 |
assumptions must be eliminated early, since it creates parameters. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2550 |
\index{*UnionE theorem} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2551 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2552 |
by (eresolve_tac [UnionE] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2553 |
{\out Level 2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2554 |
{\out C <= D ==> Union(C) <= Union(D)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2555 |
{\out 1. !!x B. [| C <= D; x : B; B : C |] ==> x : Union(D)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2556 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2557 |
Now we may apply \tdx{UnionI}, which creates an unknown involving the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2558 |
parameters. To show $x\in \bigcup(D)$ it suffices to show that $x$ belongs |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2559 |
to some element, say~$\Var{B2}(x,B)$, of~$D$. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2560 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2561 |
by (resolve_tac [UnionI] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2562 |
{\out Level 3} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2563 |
{\out C <= D ==> Union(C) <= Union(D)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2564 |
{\out 1. !!x B. [| C <= D; x : B; B : C |] ==> ?B2(x,B) : D} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2565 |
{\out 2. !!x B. [| C <= D; x : B; B : C |] ==> x : ?B2(x,B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2566 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2567 |
Combining \tdx{subsetD} with the assumption $C\subseteq D$ yields |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2568 |
$\Var{a}\in C \Imp \Var{a}\in D$, which reduces subgoal~1. Note that |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2569 |
\texttt{eresolve_tac} has removed that assumption. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2570 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2571 |
by (eresolve_tac [subsetD] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2572 |
{\out Level 4} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2573 |
{\out C <= D ==> Union(C) <= Union(D)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2574 |
{\out 1. !!x B. [| x : B; B : C |] ==> ?B2(x,B) : C} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2575 |
{\out 2. !!x B. [| C <= D; x : B; B : C |] ==> x : ?B2(x,B)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2576 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2577 |
The rest is routine. Observe how~$\Var{B2}(x,B)$ is instantiated. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2578 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2579 |
by (assume_tac 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2580 |
{\out Level 5} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2581 |
{\out C <= D ==> Union(C) <= Union(D)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2582 |
{\out 1. !!x B. [| C <= D; x : B; B : C |] ==> x : B} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2583 |
by (assume_tac 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2584 |
{\out Level 6} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2585 |
{\out C <= D ==> Union(C) <= Union(D)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2586 |
{\out No subgoals!} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2587 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2588 |
Again, \ttindex{Blast_tac} can prove the theorem in one step. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2589 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2590 |
by (Blast_tac 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2591 |
{\out Depth = 0} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2592 |
{\out Depth = 1} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2593 |
{\out Depth = 2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2594 |
{\out Level 1} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2595 |
{\out C <= D ==> Union(C) <= Union(D)} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2596 |
{\out No subgoals!} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2597 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2598 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2599 |
The file \texttt{ZF/equalities.ML} has many similar proofs. Reasoning about |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2600 |
general intersection can be difficult because of its anomalous behaviour on |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2601 |
the empty set. However, \ttindex{Blast_tac} copes well with these. Here is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2602 |
a typical example, borrowed from Devlin~\cite[page 12]{devlin79}: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2603 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2604 |
a:C ==> (INT x:C. A(x) Int B(x)) = (INT x:C. A(x)) Int (INT x:C. B(x)) |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2605 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2606 |
In traditional notation this is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2607 |
\[ a\in C \,\Imp\, \inter@{x\in C} \Bigl(A(x) \int B(x)\Bigr) = |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2608 |
\Bigl(\inter@{x\in C} A(x)\Bigr) \int |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2609 |
\Bigl(\inter@{x\in C} B(x)\Bigr) \] |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2610 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2611 |
\section{Low-level reasoning about functions} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2612 |
The derived rules \texttt{lamI}, \texttt{lamE}, \texttt{lam_type}, \texttt{beta} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2613 |
and \texttt{eta} support reasoning about functions in a |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2614 |
$\lambda$-calculus style. This is generally easier than regarding |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2615 |
functions as sets of ordered pairs. But sometimes we must look at the |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2616 |
underlying representation, as in the following proof |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2617 |
of~\tdx{fun_disjoint_apply1}. This states that if $f$ and~$g$ are |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2618 |
functions with disjoint domains~$A$ and~$C$, and if $a\in A$, then |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2619 |
$(f\un g)`a = f`a$: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2620 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2621 |
Goal "[| a:A; f: A->B; g: C->D; A Int C = 0 |] ==> \ttback |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2622 |
\ttback (f Un g)`a = f`a"; |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2623 |
{\out Level 0} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2624 |
{\out [| a : A; f : A -> B; g : C -> D; A Int C = 0 |]} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2625 |
{\out ==> (f Un g) ` a = f ` a} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2626 |
{\out 1. [| a : A; f : A -> B; g : C -> D; A Int C = 0 |]} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2627 |
{\out ==> (f Un g) ` a = f ` a} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2628 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2629 |
Using \tdx{apply_equality}, we reduce the equality to reasoning about |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2630 |
ordered pairs. The second subgoal is to verify that $f\un g$ is a function. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2631 |
To save space, the assumptions will be abbreviated below. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2632 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2633 |
by (resolve_tac [apply_equality] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2634 |
{\out Level 1} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2635 |
{\out [| \ldots |] ==> (f Un g) ` a = f ` a} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2636 |
{\out 1. [| \ldots |] ==> <a,f ` a> : f Un g} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2637 |
{\out 2. [| \ldots |] ==> f Un g : (PROD x:?A. ?B(x))} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2638 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2639 |
We must show that the pair belongs to~$f$ or~$g$; by~\tdx{UnI1} we |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2640 |
choose~$f$: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2641 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2642 |
by (resolve_tac [UnI1] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2643 |
{\out Level 2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2644 |
{\out [| \ldots |] ==> (f Un g) ` a = f ` a} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2645 |
{\out 1. [| \ldots |] ==> <a,f ` a> : f} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2646 |
{\out 2. [| \ldots |] ==> f Un g : (PROD x:?A. ?B(x))} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2647 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2648 |
To show $\pair{a,f`a}\in f$ we use \tdx{apply_Pair}, which is |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2649 |
essentially the converse of \tdx{apply_equality}: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2650 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2651 |
by (resolve_tac [apply_Pair] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2652 |
{\out Level 3} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2653 |
{\out [| \ldots |] ==> (f Un g) ` a = f ` a} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2654 |
{\out 1. [| \ldots |] ==> f : (PROD x:?A2. ?B2(x))} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2655 |
{\out 2. [| \ldots |] ==> a : ?A2} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2656 |
{\out 3. [| \ldots |] ==> f Un g : (PROD x:?A. ?B(x))} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2657 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2658 |
Using the assumptions $f\in A\to B$ and $a\in A$, we solve the two subgoals |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2659 |
from \tdx{apply_Pair}. Recall that a $\Pi$-set is merely a generalized |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2660 |
function space, and observe that~{\tt?A2} is instantiated to~\texttt{A}. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2661 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2662 |
by (assume_tac 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2663 |
{\out Level 4} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2664 |
{\out [| \ldots |] ==> (f Un g) ` a = f ` a} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2665 |
{\out 1. [| \ldots |] ==> a : A} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2666 |
{\out 2. [| \ldots |] ==> f Un g : (PROD x:?A. ?B(x))} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2667 |
by (assume_tac 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2668 |
{\out Level 5} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2669 |
{\out [| \ldots |] ==> (f Un g) ` a = f ` a} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2670 |
{\out 1. [| \ldots |] ==> f Un g : (PROD x:?A. ?B(x))} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2671 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2672 |
To construct functions of the form $f\un g$, we apply |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2673 |
\tdx{fun_disjoint_Un}: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2674 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2675 |
by (resolve_tac [fun_disjoint_Un] 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2676 |
{\out Level 6} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2677 |
{\out [| \ldots |] ==> (f Un g) ` a = f ` a} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2678 |
{\out 1. [| \ldots |] ==> f : ?A3 -> ?B3} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2679 |
{\out 2. [| \ldots |] ==> g : ?C3 -> ?D3} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2680 |
{\out 3. [| \ldots |] ==> ?A3 Int ?C3 = 0} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2681 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2682 |
The remaining subgoals are instances of the assumptions. Again, observe how |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2683 |
unknowns are instantiated: |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2684 |
\begin{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2685 |
by (assume_tac 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2686 |
{\out Level 7} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2687 |
{\out [| \ldots |] ==> (f Un g) ` a = f ` a} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2688 |
{\out 1. [| \ldots |] ==> g : ?C3 -> ?D3} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2689 |
{\out 2. [| \ldots |] ==> A Int ?C3 = 0} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2690 |
by (assume_tac 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2691 |
{\out Level 8} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2692 |
{\out [| \ldots |] ==> (f Un g) ` a = f ` a} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2693 |
{\out 1. [| \ldots |] ==> A Int C = 0} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2694 |
by (assume_tac 1); |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2695 |
{\out Level 9} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2696 |
{\out [| \ldots |] ==> (f Un g) ` a = f ` a} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2697 |
{\out No subgoals!} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2698 |
\end{ttbox} |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2699 |
See the files \texttt{ZF/func.ML} and \texttt{ZF/WF.ML} for more |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2700 |
examples of reasoning about functions. |
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2701 |
|
5fe77b9b5185
the separate FOL and ZF logics manual, with new material on datatypes and
paulson
parents:
diff
changeset
|
2702 |
\index{set theory|)} |