104
|
1 |
%% $Id$
|
287
|
2 |
\chapter{Zermelo-Fraenkel Set Theory}
|
317
|
3 |
\index{set theory|(}
|
|
4 |
|
|
5 |
The theory~\thydx{ZF} implements Zermelo-Fraenkel set
|
|
6 |
theory~\cite{halmos60,suppes72} as an extension of~{\tt FOL}, classical
|
104
|
7 |
first-order logic. The theory includes a collection of derived natural
|
317
|
8 |
deduction rules, for use with Isabelle's classical reasoner. Much
|
|
9 |
of it is based on the work of No\"el~\cite{noel}.
|
104
|
10 |
|
|
11 |
A tremendous amount of set theory has been formally developed, including
|
|
12 |
the basic properties of relations, functions and ordinals. Significant
|
317
|
13 |
results have been proved, such as the Schr\"oder-Bernstein Theorem and a
|
|
14 |
version of Ramsey's Theorem. General methods have been developed for
|
|
15 |
solving recursion equations over monotonic functors; these have been
|
|
16 |
applied to yield constructions of lists, trees, infinite lists, etc. The
|
|
17 |
Recursion Theorem has been proved, admitting recursive definitions of
|
|
18 |
functions over well-founded relations. Thus, we may even regard set theory
|
|
19 |
as a computational logic, loosely inspired by Martin-L\"of's Type Theory.
|
104
|
20 |
|
|
21 |
Because {\ZF} is an extension of {\FOL}, it provides the same packages,
|
317
|
22 |
namely {\tt hyp_subst_tac}, the simplifier, and the classical reasoner.
|
|
23 |
The main simplification set is called {\tt ZF_ss}. Several
|
|
24 |
classical rule sets are defined, including {\tt lemmas_cs},
|
|
25 |
{\tt upair_cs} and~{\tt ZF_cs}.
|
104
|
26 |
|
317
|
27 |
{\tt ZF} now has a flexible package for handling inductive definitions,
|
111
|
28 |
such as inference systems, and datatype definitions, such as lists and
|
317
|
29 |
trees. Moreover it also handles coinductive definitions, such as
|
|
30 |
bisimulation relations, and codatatype definitions, such as streams. A
|
111
|
31 |
recent paper describes the package~\cite{paulson-fixedpt}.
|
|
32 |
|
317
|
33 |
Recent reports~\cite{paulson-set-I,paulson-set-II} describe {\tt ZF} less
|
|
34 |
formally than this chapter. Isabelle employs a novel treatment of
|
343
|
35 |
non-well-founded data structures within the standard {\sc zf} axioms including
|
317
|
36 |
the Axiom of Foundation~\cite{paulson-final}.
|
111
|
37 |
|
104
|
38 |
|
|
39 |
\section{Which version of axiomatic set theory?}
|
317
|
40 |
The two main axiom systems for set theory are Bernays-G\"odel~({\sc bg})
|
|
41 |
and Zermelo-Fraenkel~({\sc zf}). Resolution theorem provers can use {\sc
|
|
42 |
bg} because it is finite~\cite{boyer86,quaife92}. {\sc zf} does not
|
|
43 |
have a finite axiom system because of its Axiom Scheme of Replacement.
|
|
44 |
This makes it awkward to use with many theorem provers, since instances
|
|
45 |
of the axiom scheme have to be invoked explicitly. Since Isabelle has no
|
|
46 |
difficulty with axiom schemes, we may adopt either axiom system.
|
104
|
47 |
|
|
48 |
These two theories differ in their treatment of {\bf classes}, which are
|
317
|
49 |
collections that are `too big' to be sets. The class of all sets,~$V$,
|
|
50 |
cannot be a set without admitting Russell's Paradox. In {\sc bg}, both
|
|
51 |
classes and sets are individuals; $x\in V$ expresses that $x$ is a set. In
|
|
52 |
{\sc zf}, all variables denote sets; classes are identified with unary
|
|
53 |
predicates. The two systems define essentially the same sets and classes,
|
|
54 |
with similar properties. In particular, a class cannot belong to another
|
|
55 |
class (let alone a set).
|
104
|
56 |
|
317
|
57 |
Modern set theorists tend to prefer {\sc zf} because they are mainly concerned
|
|
58 |
with sets, rather than classes. {\sc bg} requires tiresome proofs that various
|
104
|
59 |
collections are sets; for instance, showing $x\in\{x\}$ requires showing that
|
317
|
60 |
$x$ is a set.
|
104
|
61 |
|
|
62 |
|
|
63 |
\begin{figure}
|
|
64 |
\begin{center}
|
|
65 |
\begin{tabular}{rrr}
|
111
|
66 |
\it name &\it meta-type & \it description \\
|
317
|
67 |
\cdx{0} & $i$ & empty set\\
|
|
68 |
\cdx{cons} & $[i,i]\To i$ & finite set constructor\\
|
|
69 |
\cdx{Upair} & $[i,i]\To i$ & unordered pairing\\
|
|
70 |
\cdx{Pair} & $[i,i]\To i$ & ordered pairing\\
|
|
71 |
\cdx{Inf} & $i$ & infinite set\\
|
|
72 |
\cdx{Pow} & $i\To i$ & powerset\\
|
|
73 |
\cdx{Union} \cdx{Inter} & $i\To i$ & set union/intersection \\
|
|
74 |
\cdx{split} & $[[i,i]\To i, i] \To i$ & generalized projection\\
|
|
75 |
\cdx{fst} \cdx{snd} & $i\To i$ & projections\\
|
|
76 |
\cdx{converse}& $i\To i$ & converse of a relation\\
|
|
77 |
\cdx{succ} & $i\To i$ & successor\\
|
|
78 |
\cdx{Collect} & $[i,i\To o]\To i$ & separation\\
|
|
79 |
\cdx{Replace} & $[i, [i,i]\To o] \To i$ & replacement\\
|
|
80 |
\cdx{PrimReplace} & $[i, [i,i]\To o] \To i$ & primitive replacement\\
|
|
81 |
\cdx{RepFun} & $[i, i\To i] \To i$ & functional replacement\\
|
|
82 |
\cdx{Pi} \cdx{Sigma} & $[i,i\To i]\To i$ & general product/sum\\
|
|
83 |
\cdx{domain} & $i\To i$ & domain of a relation\\
|
|
84 |
\cdx{range} & $i\To i$ & range of a relation\\
|
|
85 |
\cdx{field} & $i\To i$ & field of a relation\\
|
|
86 |
\cdx{Lambda} & $[i, i\To i]\To i$ & $\lambda$-abstraction\\
|
|
87 |
\cdx{restrict}& $[i, i] \To i$ & restriction of a function\\
|
|
88 |
\cdx{The} & $[i\To o]\To i$ & definite description\\
|
|
89 |
\cdx{if} & $[o,i,i]\To i$ & conditional\\
|
|
90 |
\cdx{Ball} \cdx{Bex} & $[i, i\To o]\To o$ & bounded quantifiers
|
104
|
91 |
\end{tabular}
|
|
92 |
\end{center}
|
|
93 |
\subcaption{Constants}
|
|
94 |
|
|
95 |
\begin{center}
|
317
|
96 |
\index{*"`"` symbol}
|
|
97 |
\index{*"-"`"` symbol}
|
|
98 |
\index{*"` symbol}\index{function applications!in \ZF}
|
|
99 |
\index{*"- symbol}
|
|
100 |
\index{*": symbol}
|
|
101 |
\index{*"<"= symbol}
|
104
|
102 |
\begin{tabular}{rrrr}
|
317
|
103 |
\it symbol & \it meta-type & \it priority & \it description \\
|
111
|
104 |
\tt `` & $[i,i]\To i$ & Left 90 & image \\
|
|
105 |
\tt -`` & $[i,i]\To i$ & Left 90 & inverse image \\
|
|
106 |
\tt ` & $[i,i]\To i$ & Left 90 & application \\
|
317
|
107 |
\sdx{Int} & $[i,i]\To i$ & Left 70 & intersection ($\inter$) \\
|
|
108 |
\sdx{Un} & $[i,i]\To i$ & Left 65 & union ($\union$) \\
|
111
|
109 |
\tt - & $[i,i]\To i$ & Left 65 & set difference ($-$) \\[1ex]
|
|
110 |
\tt: & $[i,i]\To o$ & Left 50 & membership ($\in$) \\
|
|
111 |
\tt <= & $[i,i]\To o$ & Left 50 & subset ($\subseteq$)
|
104
|
112 |
\end{tabular}
|
|
113 |
\end{center}
|
|
114 |
\subcaption{Infixes}
|
317
|
115 |
\caption{Constants of {\ZF}} \label{zf-constants}
|
104
|
116 |
\end{figure}
|
|
117 |
|
|
118 |
|
|
119 |
\section{The syntax of set theory}
|
|
120 |
The language of set theory, as studied by logicians, has no constants. The
|
|
121 |
traditional axioms merely assert the existence of empty sets, unions,
|
|
122 |
powersets, etc.; this would be intolerable for practical reasoning. The
|
|
123 |
Isabelle theory declares constants for primitive sets. It also extends
|
|
124 |
{\tt FOL} with additional syntax for finite sets, ordered pairs,
|
|
125 |
comprehension, general union/intersection, general sums/products, and
|
|
126 |
bounded quantifiers. In most other respects, Isabelle implements precisely
|
|
127 |
Zermelo-Fraenkel set theory.
|
|
128 |
|
317
|
129 |
Figure~\ref{zf-constanus} lists the constants and infixes of~\ZF, while
|
|
130 |
Figure~\ref{zf-trans} presents the syntax translations. Finally,
|
|
131 |
Figure~\ref{zf-syntax} presents the full grammar for set theory, including
|
104
|
132 |
the constructs of \FOL.
|
|
133 |
|
317
|
134 |
Set theory does not use polymorphism. All terms in {\ZF} have
|
|
135 |
type~\tydx{i}, which is the type of individuals and lies in class~{\tt
|
|
136 |
logic}. The type of first-order formulae, remember, is~{\tt o}.
|
104
|
137 |
|
317
|
138 |
Infix operators include binary union and intersection ($A\union B$ and
|
|
139 |
$A\inter B$), set difference ($A-B$), and the subset and membership
|
|
140 |
relations. Note that $a$\verb|~:|$b$ is translated to $\neg(a\in b)$. The
|
|
141 |
union and intersection operators ($\bigcup A$ and $\bigcap A$) form the
|
|
142 |
union or intersection of a set of sets; $\bigcup A$ means the same as
|
|
143 |
$\bigcup@{x\in A}x$. Of these operators, only $\bigcup A$ is primitive.
|
104
|
144 |
|
317
|
145 |
The constant \cdx{Upair} constructs unordered pairs; thus {\tt
|
|
146 |
Upair($A$,$B$)} denotes the set~$\{A,B\}$ and {\tt Upair($A$,$A$)}
|
|
147 |
denotes the singleton~$\{A\}$. General union is used to define binary
|
|
148 |
union. The Isabelle version goes on to define the constant
|
|
149 |
\cdx{cons}:
|
104
|
150 |
\begin{eqnarray*}
|
111
|
151 |
A\cup B & \equiv & \bigcup({\tt Upair}(A,B)) \\
|
|
152 |
{\tt cons}(a,B) & \equiv & {\tt Upair}(a,a) \union B
|
104
|
153 |
\end{eqnarray*}
|
|
154 |
The {\tt\{\ldots\}} notation abbreviates finite sets constructed in the
|
|
155 |
obvious manner using~{\tt cons} and~$\emptyset$ (the empty set):
|
|
156 |
\begin{eqnarray*}
|
|
157 |
\{a,b,c\} & \equiv & {\tt cons}(a,{\tt cons}(b,{\tt cons}(c,\emptyset)))
|
|
158 |
\end{eqnarray*}
|
|
159 |
|
317
|
160 |
The constant \cdx{Pair} constructs ordered pairs, as in {\tt
|
104
|
161 |
Pair($a$,$b$)}. Ordered pairs may also be written within angle brackets,
|
111
|
162 |
as {\tt<$a$,$b$>}. The $n$-tuple {\tt<$a@1$,\ldots,$a@{n-1}$,$a@n$>}
|
317
|
163 |
abbreviates the nest of pairs\par\nobreak
|
|
164 |
\centerline{\tt Pair($a@1$,\ldots,Pair($a@{n-1}$,$a@n$)\ldots).}
|
104
|
165 |
|
|
166 |
In {\ZF}, a function is a set of pairs. A {\ZF} function~$f$ is simply an
|
|
167 |
individual as far as Isabelle is concerned: its Isabelle type is~$i$, not
|
|
168 |
say $i\To i$. The infix operator~{\tt`} denotes the application of a
|
|
169 |
function set to its argument; we must write~$f{\tt`}x$, not~$f(x)$. The
|
|
170 |
syntax for image is~$f{\tt``}A$ and that for inverse image is~$f{\tt-``}A$.
|
|
171 |
|
|
172 |
|
|
173 |
\begin{figure}
|
317
|
174 |
\index{lambda abs@$\lambda$-abstractions!in \ZF}
|
|
175 |
\index{*"-"> symbol}
|
|
176 |
\index{*"* symbol}
|
287
|
177 |
\begin{center} \footnotesize\tt\frenchspacing
|
104
|
178 |
\begin{tabular}{rrr}
|
111
|
179 |
\it external & \it internal & \it description \\
|
104
|
180 |
$a$ \ttilde: $b$ & \ttilde($a$ : $b$) & \rm negated membership\\
|
|
181 |
\{$a@1$, $\ldots$, $a@n$\} & cons($a@1$,$\cdots$,cons($a@n$,0)) &
|
|
182 |
\rm finite set \\
|
111
|
183 |
<$a@1$, $\ldots$, $a@{n-1}$, $a@n$> &
|
|
184 |
Pair($a@1$,\ldots,Pair($a@{n-1}$,$a@n$)\ldots) &
|
|
185 |
\rm ordered $n$-tuple \\
|
|
186 |
\{$x$:$A . P[x]$\} & Collect($A$,$\lambda x.P[x]$) &
|
104
|
187 |
\rm separation \\
|
|
188 |
\{$y . x$:$A$, $Q[x,y]$\} & Replace($A$,$\lambda x\,y.Q[x,y]$) &
|
|
189 |
\rm replacement \\
|
|
190 |
\{$b[x] . x$:$A$\} & RepFun($A$,$\lambda x.b[x]$) &
|
|
191 |
\rm functional replacement \\
|
317
|
192 |
\sdx{INT} $x$:$A . B[x]$ & Inter(\{$B[x] . x$:$A$\}) &
|
111
|
193 |
\rm general intersection \\
|
317
|
194 |
\sdx{UN} $x$:$A . B[x]$ & Union(\{$B[x] . x$:$A$\}) &
|
111
|
195 |
\rm general union \\
|
317
|
196 |
\sdx{PROD} $x$:$A . B[x]$ & Pi($A$,$\lambda x.B[x]$) &
|
111
|
197 |
\rm general product \\
|
317
|
198 |
\sdx{SUM} $x$:$A . B[x]$ & Sigma($A$,$\lambda x.B[x]$) &
|
111
|
199 |
\rm general sum \\
|
|
200 |
$A$ -> $B$ & Pi($A$,$\lambda x.B$) &
|
|
201 |
\rm function space \\
|
|
202 |
$A$ * $B$ & Sigma($A$,$\lambda x.B$) &
|
|
203 |
\rm binary product \\
|
317
|
204 |
\sdx{THE} $x . P[x]$ & The($\lambda x.P[x]$) &
|
111
|
205 |
\rm definite description \\
|
317
|
206 |
\sdx{lam} $x$:$A . b[x]$ & Lambda($A$,$\lambda x.b[x]$) &
|
111
|
207 |
\rm $\lambda$-abstraction\\[1ex]
|
317
|
208 |
\sdx{ALL} $x$:$A . P[x]$ & Ball($A$,$\lambda x.P[x]$) &
|
111
|
209 |
\rm bounded $\forall$ \\
|
317
|
210 |
\sdx{EX} $x$:$A . P[x]$ & Bex($A$,$\lambda x.P[x]$) &
|
111
|
211 |
\rm bounded $\exists$
|
104
|
212 |
\end{tabular}
|
|
213 |
\end{center}
|
317
|
214 |
\caption{Translations for {\ZF}} \label{zf-trans}
|
104
|
215 |
\end{figure}
|
|
216 |
|
|
217 |
|
|
218 |
\begin{figure}
|
|
219 |
\dquotes
|
|
220 |
\[\begin{array}{rcl}
|
|
221 |
term & = & \hbox{expression of type~$i$} \\
|
111
|
222 |
& | & "\{ " term\; ("," term)^* " \}" \\
|
317
|
223 |
& | & "< " term\; ("," term)^* " >" \\
|
111
|
224 |
& | & "\{ " id ":" term " . " formula " \}" \\
|
317
|
225 |
& | & "\{ " id " . " id ":" term ", " formula " \}" \\
|
111
|
226 |
& | & "\{ " term " . " id ":" term " \}" \\
|
|
227 |
& | & term " `` " term \\
|
|
228 |
& | & term " -`` " term \\
|
|
229 |
& | & term " ` " term \\
|
|
230 |
& | & term " * " term \\
|
|
231 |
& | & term " Int " term \\
|
|
232 |
& | & term " Un " term \\
|
|
233 |
& | & term " - " term \\
|
|
234 |
& | & term " -> " term \\
|
|
235 |
& | & "THE~~" id " . " formula\\
|
|
236 |
& | & "lam~~" id ":" term " . " term \\
|
|
237 |
& | & "INT~~" id ":" term " . " term \\
|
|
238 |
& | & "UN~~~" id ":" term " . " term \\
|
|
239 |
& | & "PROD~" id ":" term " . " term \\
|
|
240 |
& | & "SUM~~" id ":" term " . " term \\[2ex]
|
104
|
241 |
formula & = & \hbox{expression of type~$o$} \\
|
111
|
242 |
& | & term " : " term \\
|
317
|
243 |
& | & term " \ttilde: " term \\
|
111
|
244 |
& | & term " <= " term \\
|
|
245 |
& | & term " = " term \\
|
317
|
246 |
& | & term " \ttilde= " term \\
|
111
|
247 |
& | & "\ttilde\ " formula \\
|
|
248 |
& | & formula " \& " formula \\
|
|
249 |
& | & formula " | " formula \\
|
|
250 |
& | & formula " --> " formula \\
|
|
251 |
& | & formula " <-> " formula \\
|
|
252 |
& | & "ALL " id ":" term " . " formula \\
|
|
253 |
& | & "EX~~" id ":" term " . " formula \\
|
|
254 |
& | & "ALL~" id~id^* " . " formula \\
|
|
255 |
& | & "EX~~" id~id^* " . " formula \\
|
|
256 |
& | & "EX!~" id~id^* " . " formula
|
104
|
257 |
\end{array}
|
|
258 |
\]
|
317
|
259 |
\caption{Full grammar for {\ZF}} \label{zf-syntax}
|
104
|
260 |
\end{figure}
|
|
261 |
|
|
262 |
|
|
263 |
\section{Binding operators}
|
317
|
264 |
The constant \cdx{Collect} constructs sets by the principle of {\bf
|
104
|
265 |
separation}. The syntax for separation is \hbox{\tt\{$x$:$A$.$P[x]$\}},
|
|
266 |
where $P[x]$ is a formula that may contain free occurrences of~$x$. It
|
317
|
267 |
abbreviates the set {\tt Collect($A$,$\lambda x.P[x]$)}, which consists of
|
104
|
268 |
all $x\in A$ that satisfy~$P[x]$. Note that {\tt Collect} is an
|
|
269 |
unfortunate choice of name: some set theories adopt a set-formation
|
|
270 |
principle, related to replacement, called collection.
|
|
271 |
|
317
|
272 |
The constant \cdx{Replace} constructs sets by the principle of {\bf
|
|
273 |
replacement}. The syntax \hbox{\tt\{$y$.$x$:$A$,$Q[x,y]$\}} denotes the
|
|
274 |
set {\tt Replace($A$,$\lambda x\,y.Q[x,y]$)}, which consists of all~$y$ such
|
|
275 |
that there exists $x\in A$ satisfying~$Q[x,y]$. The Replacement Axiom has
|
|
276 |
the condition that $Q$ must be single-valued over~$A$: for all~$x\in A$
|
|
277 |
there exists at most one $y$ satisfying~$Q[x,y]$. A single-valued binary
|
104
|
278 |
predicate is also called a {\bf class function}.
|
|
279 |
|
317
|
280 |
The constant \cdx{RepFun} expresses a special case of replacement,
|
104
|
281 |
where $Q[x,y]$ has the form $y=b[x]$. Such a $Q$ is trivially
|
|
282 |
single-valued, since it is just the graph of the meta-level
|
287
|
283 |
function~$\lambda x.b[x]$. The resulting set consists of all $b[x]$
|
|
284 |
for~$x\in A$. This is analogous to the \ML{} functional {\tt map}, since
|
|
285 |
it applies a function to every element of a set. The syntax is
|
|
286 |
\hbox{\tt\{$b[x]$.$x$:$A$\}}, which expands to {\tt RepFun($A$,$\lambda
|
|
287 |
x.b[x]$)}.
|
104
|
288 |
|
317
|
289 |
\index{*INT symbol}\index{*UN symbol}
|
287
|
290 |
General unions and intersections of indexed
|
|
291 |
families of sets, namely $\bigcup@{x\in A}B[x]$ and $\bigcap@{x\in A}B[x]$,
|
|
292 |
are written \hbox{\tt UN $x$:$A$.$B[x]$} and \hbox{\tt INT $x$:$A$.$B[x]$}.
|
|
293 |
Their meaning is expressed using {\tt RepFun} as
|
104
|
294 |
\[ \bigcup(\{B[x]. x\in A\}) \qquad\hbox{and}\qquad
|
|
295 |
\bigcap(\{B[x]. x\in A\}).
|
|
296 |
\]
|
|
297 |
General sums $\sum@{x\in A}B[x]$ and products $\prod@{x\in A}B[x]$ can be
|
|
298 |
constructed in set theory, where $B[x]$ is a family of sets over~$A$. They
|
|
299 |
have as special cases $A\times B$ and $A\to B$, where $B$ is simply a set.
|
|
300 |
This is similar to the situation in Constructive Type Theory (set theory
|
317
|
301 |
has `dependent sets') and calls for similar syntactic conventions. The
|
|
302 |
constants~\cdx{Sigma} and~\cdx{Pi} construct general sums and
|
104
|
303 |
products. Instead of {\tt Sigma($A$,$B$)} and {\tt Pi($A$,$B$)} we may write
|
|
304 |
\hbox{\tt SUM $x$:$A$.$B[x]$} and \hbox{\tt PROD $x$:$A$.$B[x]$}.
|
317
|
305 |
\index{*SUM symbol}\index{*PROD symbol}%
|
104
|
306 |
The special cases as \hbox{\tt$A$*$B$} and \hbox{\tt$A$->$B$} abbreviate
|
|
307 |
general sums and products over a constant family.\footnote{Unlike normal
|
|
308 |
infix operators, {\tt*} and {\tt->} merely define abbreviations; there are
|
|
309 |
no constants~{\tt op~*} and~\hbox{\tt op~->}.} Isabelle accepts these
|
|
310 |
abbreviations in parsing and uses them whenever possible for printing.
|
|
311 |
|
317
|
312 |
\index{*THE symbol}
|
104
|
313 |
As mentioned above, whenever the axioms assert the existence and uniqueness
|
|
314 |
of a set, Isabelle's set theory declares a constant for that set. These
|
|
315 |
constants can express the {\bf definite description} operator~$\iota
|
|
316 |
x.P[x]$, which stands for the unique~$a$ satisfying~$P[a]$, if such exists.
|
|
317 |
Since all terms in {\ZF} denote something, a description is always
|
|
318 |
meaningful, but we do not know its value unless $P[x]$ defines it uniquely.
|
317
|
319 |
Using the constant~\cdx{The}, we may write descriptions as {\tt
|
104
|
320 |
The($\lambda x.P[x]$)} or use the syntax \hbox{\tt THE $x$.$P[x]$}.
|
|
321 |
|
317
|
322 |
\index{*lam symbol}
|
104
|
323 |
Function sets may be written in $\lambda$-notation; $\lambda x\in A.b[x]$
|
|
324 |
stands for the set of all pairs $\pair{x,b[x]}$ for $x\in A$. In order for
|
|
325 |
this to be a set, the function's domain~$A$ must be given. Using the
|
317
|
326 |
constant~\cdx{Lambda}, we may express function sets as {\tt
|
104
|
327 |
Lambda($A$,$\lambda x.b[x]$)} or use the syntax \hbox{\tt lam $x$:$A$.$b[x]$}.
|
|
328 |
|
|
329 |
Isabelle's set theory defines two {\bf bounded quantifiers}:
|
|
330 |
\begin{eqnarray*}
|
317
|
331 |
\forall x\in A.P[x] &\hbox{abbreviates}& \forall x. x\in A\imp P[x] \\
|
|
332 |
\exists x\in A.P[x] &\hbox{abbreviates}& \exists x. x\in A\conj P[x]
|
104
|
333 |
\end{eqnarray*}
|
317
|
334 |
The constants~\cdx{Ball} and~\cdx{Bex} are defined
|
104
|
335 |
accordingly. Instead of {\tt Ball($A$,$P$)} and {\tt Bex($A$,$P$)} we may
|
|
336 |
write
|
|
337 |
\hbox{\tt ALL $x$:$A$.$P[x]$} and \hbox{\tt EX $x$:$A$.$P[x]$}.
|
|
338 |
|
|
339 |
|
343
|
340 |
%%%% ZF.thy
|
104
|
341 |
|
|
342 |
\begin{figure}
|
|
343 |
\begin{ttbox}
|
317
|
344 |
\tdx{Ball_def} Ball(A,P) == ALL x. x:A --> P(x)
|
|
345 |
\tdx{Bex_def} Bex(A,P) == EX x. x:A & P(x)
|
104
|
346 |
|
317
|
347 |
\tdx{subset_def} A <= B == ALL x:A. x:B
|
|
348 |
\tdx{extension} A = B <-> A <= B & B <= A
|
104
|
349 |
|
317
|
350 |
\tdx{union_iff} A : Union(C) <-> (EX B:C. A:B)
|
|
351 |
\tdx{power_set} A : Pow(B) <-> A <= B
|
|
352 |
\tdx{foundation} A=0 | (EX x:A. ALL y:x. ~ y:A)
|
104
|
353 |
|
317
|
354 |
\tdx{replacement} (ALL x:A. ALL y z. P(x,y) & P(x,z) --> y=z) ==>
|
104
|
355 |
b : PrimReplace(A,P) <-> (EX x:A. P(x,b))
|
|
356 |
\subcaption{The Zermelo-Fraenkel Axioms}
|
|
357 |
|
317
|
358 |
\tdx{Replace_def} Replace(A,P) ==
|
287
|
359 |
PrimReplace(A, \%x y. (EX!z.P(x,z)) & P(x,y))
|
317
|
360 |
\tdx{RepFun_def} RepFun(A,f) == \{y . x:A, y=f(x)\}
|
|
361 |
\tdx{the_def} The(P) == Union(\{y . x:\{0\}, P(y)\})
|
|
362 |
\tdx{if_def} if(P,a,b) == THE z. P & z=a | ~P & z=b
|
|
363 |
\tdx{Collect_def} Collect(A,P) == \{y . x:A, x=y & P(x)\}
|
|
364 |
\tdx{Upair_def} Upair(a,b) ==
|
104
|
365 |
\{y. x:Pow(Pow(0)), (x=0 & y=a) | (x=Pow(0) & y=b)\}
|
|
366 |
\subcaption{Consequences of replacement}
|
|
367 |
|
317
|
368 |
\tdx{Inter_def} Inter(A) == \{ x:Union(A) . ALL y:A. x:y\}
|
|
369 |
\tdx{Un_def} A Un B == Union(Upair(A,B))
|
|
370 |
\tdx{Int_def} A Int B == Inter(Upair(A,B))
|
|
371 |
\tdx{Diff_def} A - B == \{ x:A . ~(x:B) \}
|
104
|
372 |
\subcaption{Union, intersection, difference}
|
|
373 |
\end{ttbox}
|
317
|
374 |
\caption{Rules and axioms of {\ZF}} \label{zf-rules}
|
104
|
375 |
\end{figure}
|
|
376 |
|
|
377 |
|
|
378 |
\begin{figure}
|
|
379 |
\begin{ttbox}
|
317
|
380 |
\tdx{cons_def} cons(a,A) == Upair(a,a) Un A
|
|
381 |
\tdx{succ_def} succ(i) == cons(i,i)
|
|
382 |
\tdx{infinity} 0:Inf & (ALL y:Inf. succ(y): Inf)
|
111
|
383 |
\subcaption{Finite and infinite sets}
|
|
384 |
|
317
|
385 |
\tdx{Pair_def} <a,b> == \{\{a,a\}, \{a,b\}\}
|
|
386 |
\tdx{split_def} split(c,p) == THE y. EX a b. p=<a,b> & y=c(a,b)
|
|
387 |
\tdx{fst_def} fst(A) == split(\%x y.x, p)
|
|
388 |
\tdx{snd_def} snd(A) == split(\%x y.y, p)
|
|
389 |
\tdx{Sigma_def} Sigma(A,B) == UN x:A. UN y:B(x). \{<x,y>\}
|
104
|
390 |
\subcaption{Ordered pairs and Cartesian products}
|
|
391 |
|
317
|
392 |
\tdx{converse_def} converse(r) == \{z. w:r, EX x y. w=<x,y> & z=<y,x>\}
|
|
393 |
\tdx{domain_def} domain(r) == \{x. w:r, EX y. w=<x,y>\}
|
|
394 |
\tdx{range_def} range(r) == domain(converse(r))
|
|
395 |
\tdx{field_def} field(r) == domain(r) Un range(r)
|
|
396 |
\tdx{image_def} r `` A == \{y : range(r) . EX x:A. <x,y> : r\}
|
|
397 |
\tdx{vimage_def} r -`` A == converse(r)``A
|
104
|
398 |
\subcaption{Operations on relations}
|
|
399 |
|
317
|
400 |
\tdx{lam_def} Lambda(A,b) == \{<x,b(x)> . x:A\}
|
|
401 |
\tdx{apply_def} f`a == THE y. <a,y> : f
|
|
402 |
\tdx{Pi_def} Pi(A,B) == \{f: Pow(Sigma(A,B)). ALL x:A. EX! y. <x,y>: f\}
|
|
403 |
\tdx{restrict_def} restrict(f,A) == lam x:A.f`x
|
104
|
404 |
\subcaption{Functions and general product}
|
|
405 |
\end{ttbox}
|
317
|
406 |
\caption{Further definitions of {\ZF}} \label{zf-defs}
|
104
|
407 |
\end{figure}
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
\section{The Zermelo-Fraenkel axioms}
|
317
|
412 |
The axioms appear in Fig.\ts \ref{zf-rules}. They resemble those
|
104
|
413 |
presented by Suppes~\cite{suppes72}. Most of the theory consists of
|
|
414 |
definitions. In particular, bounded quantifiers and the subset relation
|
|
415 |
appear in other axioms. Object-level quantifiers and implications have
|
|
416 |
been replaced by meta-level ones wherever possible, to simplify use of the
|
343
|
417 |
axioms. See the file {\tt ZF/ZF.thy} for details.
|
104
|
418 |
|
|
419 |
The traditional replacement axiom asserts
|
|
420 |
\[ y \in {\tt PrimReplace}(A,P) \bimp (\exists x\in A. P(x,y)) \]
|
|
421 |
subject to the condition that $P(x,y)$ is single-valued for all~$x\in A$.
|
317
|
422 |
The Isabelle theory defines \cdx{Replace} to apply
|
|
423 |
\cdx{PrimReplace} to the single-valued part of~$P$, namely
|
104
|
424 |
\[ (\exists!z.P(x,z)) \conj P(x,y). \]
|
|
425 |
Thus $y\in {\tt Replace}(A,P)$ if and only if there is some~$x$ such that
|
|
426 |
$P(x,-)$ holds uniquely for~$y$. Because the equivalence is unconditional,
|
|
427 |
{\tt Replace} is much easier to use than {\tt PrimReplace}; it defines the
|
|
428 |
same set, if $P(x,y)$ is single-valued. The nice syntax for replacement
|
|
429 |
expands to {\tt Replace}.
|
|
430 |
|
|
431 |
Other consequences of replacement include functional replacement
|
317
|
432 |
(\cdx{RepFun}) and definite descriptions (\cdx{The}).
|
|
433 |
Axioms for separation (\cdx{Collect}) and unordered pairs
|
|
434 |
(\cdx{Upair}) are traditionally assumed, but they actually follow
|
104
|
435 |
from replacement~\cite[pages 237--8]{suppes72}.
|
|
436 |
|
|
437 |
The definitions of general intersection, etc., are straightforward. Note
|
317
|
438 |
the definition of {\tt cons}, which underlies the finite set notation.
|
104
|
439 |
The axiom of infinity gives us a set that contains~0 and is closed under
|
317
|
440 |
successor (\cdx{succ}). Although this set is not uniquely defined,
|
|
441 |
the theory names it (\cdx{Inf}) in order to simplify the
|
104
|
442 |
construction of the natural numbers.
|
111
|
443 |
|
317
|
444 |
Further definitions appear in Fig.\ts\ref{zf-defs}. Ordered pairs are
|
104
|
445 |
defined in the standard way, $\pair{a,b}\equiv\{\{a\},\{a,b\}\}$. Recall
|
317
|
446 |
that \cdx{Sigma}$(A,B)$ generalizes the Cartesian product of two
|
104
|
447 |
sets. It is defined to be the union of all singleton sets
|
|
448 |
$\{\pair{x,y}\}$, for $x\in A$ and $y\in B(x)$. This is a typical usage of
|
|
449 |
general union.
|
|
450 |
|
317
|
451 |
The projections \cdx{fst} and~\cdx{snd} are defined in terms of the
|
|
452 |
generalized projection \cdx{split}. The latter has been borrowed from
|
|
453 |
Martin-L\"of's Type Theory, and is often easier to use than \cdx{fst}
|
|
454 |
and~\cdx{snd}.
|
|
455 |
|
104
|
456 |
Operations on relations include converse, domain, range, and image. The
|
|
457 |
set ${\tt Pi}(A,B)$ generalizes the space of functions between two sets.
|
|
458 |
Note the simple definitions of $\lambda$-abstraction (using
|
317
|
459 |
\cdx{RepFun}) and application (using a definite description). The
|
|
460 |
function \cdx{restrict}$(f,A)$ has the same values as~$f$, but only
|
104
|
461 |
over the domain~$A$.
|
|
462 |
|
317
|
463 |
|
|
464 |
%%%% zf.ML
|
|
465 |
|
|
466 |
\begin{figure}
|
|
467 |
\begin{ttbox}
|
|
468 |
\tdx{ballI} [| !!x. x:A ==> P(x) |] ==> ALL x:A. P(x)
|
|
469 |
\tdx{bspec} [| ALL x:A. P(x); x: A |] ==> P(x)
|
|
470 |
\tdx{ballE} [| ALL x:A. P(x); P(x) ==> Q; ~ x:A ==> Q |] ==> Q
|
|
471 |
|
|
472 |
\tdx{ball_cong} [| A=A'; !!x. x:A' ==> P(x) <-> P'(x) |] ==>
|
|
473 |
(ALL x:A. P(x)) <-> (ALL x:A'. P'(x))
|
|
474 |
|
|
475 |
\tdx{bexI} [| P(x); x: A |] ==> EX x:A. P(x)
|
|
476 |
\tdx{bexCI} [| ALL x:A. ~P(x) ==> P(a); a: A |] ==> EX x:A.P(x)
|
|
477 |
\tdx{bexE} [| EX x:A. P(x); !!x. [| x:A; P(x) |] ==> Q |] ==> Q
|
|
478 |
|
|
479 |
\tdx{bex_cong} [| A=A'; !!x. x:A' ==> P(x) <-> P'(x) |] ==>
|
|
480 |
(EX x:A. P(x)) <-> (EX x:A'. P'(x))
|
|
481 |
\subcaption{Bounded quantifiers}
|
|
482 |
|
|
483 |
\tdx{subsetI} (!!x.x:A ==> x:B) ==> A <= B
|
|
484 |
\tdx{subsetD} [| A <= B; c:A |] ==> c:B
|
|
485 |
\tdx{subsetCE} [| A <= B; ~(c:A) ==> P; c:B ==> P |] ==> P
|
|
486 |
\tdx{subset_refl} A <= A
|
|
487 |
\tdx{subset_trans} [| A<=B; B<=C |] ==> A<=C
|
|
488 |
|
|
489 |
\tdx{equalityI} [| A <= B; B <= A |] ==> A = B
|
|
490 |
\tdx{equalityD1} A = B ==> A<=B
|
|
491 |
\tdx{equalityD2} A = B ==> B<=A
|
|
492 |
\tdx{equalityE} [| A = B; [| A<=B; B<=A |] ==> P |] ==> P
|
|
493 |
\subcaption{Subsets and extensionality}
|
|
494 |
|
|
495 |
\tdx{emptyE} a:0 ==> P
|
|
496 |
\tdx{empty_subsetI} 0 <= A
|
|
497 |
\tdx{equals0I} [| !!y. y:A ==> False |] ==> A=0
|
|
498 |
\tdx{equals0D} [| A=0; a:A |] ==> P
|
|
499 |
|
|
500 |
\tdx{PowI} A <= B ==> A : Pow(B)
|
|
501 |
\tdx{PowD} A : Pow(B) ==> A<=B
|
|
502 |
\subcaption{The empty set; power sets}
|
|
503 |
\end{ttbox}
|
|
504 |
\caption{Basic derived rules for {\ZF}} \label{zf-lemmas1}
|
|
505 |
\end{figure}
|
104
|
506 |
|
|
507 |
|
|
508 |
\section{From basic lemmas to function spaces}
|
|
509 |
Faced with so many definitions, it is essential to prove lemmas. Even
|
|
510 |
trivial theorems like $A\inter B=B\inter A$ would be difficult to prove
|
|
511 |
from the definitions alone. Isabelle's set theory derives many rules using
|
|
512 |
a natural deduction style. Ideally, a natural deduction rule should
|
|
513 |
introduce or eliminate just one operator, but this is not always practical.
|
|
514 |
For most operators, we may forget its definition and use its derived rules
|
|
515 |
instead.
|
|
516 |
|
|
517 |
\subsection{Fundamental lemmas}
|
317
|
518 |
Figure~\ref{zf-lemmas1} presents the derived rules for the most basic
|
104
|
519 |
operators. The rules for the bounded quantifiers resemble those for the
|
343
|
520 |
ordinary quantifiers, but note that \tdx{ballE} uses a negated assumption
|
|
521 |
in the style of Isabelle's classical reasoner. The \rmindex{congruence
|
|
522 |
rules} \tdx{ball_cong} and \tdx{bex_cong} are required by Isabelle's
|
104
|
523 |
simplifier, but have few other uses. Congruence rules must be specially
|
|
524 |
derived for all binding operators, and henceforth will not be shown.
|
|
525 |
|
317
|
526 |
Figure~\ref{zf-lemmas1} also shows rules for the subset and equality
|
104
|
527 |
relations (proof by extensionality), and rules about the empty set and the
|
|
528 |
power set operator.
|
|
529 |
|
317
|
530 |
Figure~\ref{zf-lemmas2} presents rules for replacement and separation.
|
|
531 |
The rules for \cdx{Replace} and \cdx{RepFun} are much simpler than
|
104
|
532 |
comparable rules for {\tt PrimReplace} would be. The principle of
|
|
533 |
separation is proved explicitly, although most proofs should use the
|
317
|
534 |
natural deduction rules for {\tt Collect}. The elimination rule
|
|
535 |
\tdx{CollectE} is equivalent to the two destruction rules
|
|
536 |
\tdx{CollectD1} and \tdx{CollectD2}, but each rule is suited to
|
104
|
537 |
particular circumstances. Although too many rules can be confusing, there
|
|
538 |
is no reason to aim for a minimal set of rules. See the file
|
343
|
539 |
{\tt ZF/ZF.ML} for a complete listing.
|
104
|
540 |
|
317
|
541 |
Figure~\ref{zf-lemmas3} presents rules for general union and intersection.
|
104
|
542 |
The empty intersection should be undefined. We cannot have
|
|
543 |
$\bigcap(\emptyset)=V$ because $V$, the universal class, is not a set. All
|
|
544 |
expressions denote something in {\ZF} set theory; the definition of
|
|
545 |
intersection implies $\bigcap(\emptyset)=\emptyset$, but this value is
|
317
|
546 |
arbitrary. The rule \tdx{InterI} must have a premise to exclude
|
104
|
547 |
the empty intersection. Some of the laws governing intersections require
|
|
548 |
similar premises.
|
|
549 |
|
|
550 |
|
317
|
551 |
%the [p] gives better page breaking for the book
|
|
552 |
\begin{figure}[p]
|
|
553 |
\begin{ttbox}
|
|
554 |
\tdx{ReplaceI} [| x: A; P(x,b); !!y. P(x,y) ==> y=b |] ==>
|
|
555 |
b : \{y. x:A, P(x,y)\}
|
|
556 |
|
|
557 |
\tdx{ReplaceE} [| b : \{y. x:A, P(x,y)\};
|
|
558 |
!!x. [| x: A; P(x,b); ALL y. P(x,y)-->y=b |] ==> R
|
|
559 |
|] ==> R
|
|
560 |
|
|
561 |
\tdx{RepFunI} [| a : A |] ==> f(a) : \{f(x). x:A\}
|
|
562 |
\tdx{RepFunE} [| b : \{f(x). x:A\};
|
|
563 |
!!x.[| x:A; b=f(x) |] ==> P |] ==> P
|
|
564 |
|
|
565 |
\tdx{separation} a : \{x:A. P(x)\} <-> a:A & P(a)
|
|
566 |
\tdx{CollectI} [| a:A; P(a) |] ==> a : \{x:A. P(x)\}
|
|
567 |
\tdx{CollectE} [| a : \{x:A. P(x)\}; [| a:A; P(a) |] ==> R |] ==> R
|
|
568 |
\tdx{CollectD1} a : \{x:A. P(x)\} ==> a:A
|
|
569 |
\tdx{CollectD2} a : \{x:A. P(x)\} ==> P(a)
|
|
570 |
\end{ttbox}
|
|
571 |
\caption{Replacement and separation} \label{zf-lemmas2}
|
|
572 |
\end{figure}
|
|
573 |
|
|
574 |
|
|
575 |
\begin{figure}
|
|
576 |
\begin{ttbox}
|
|
577 |
\tdx{UnionI} [| B: C; A: B |] ==> A: Union(C)
|
|
578 |
\tdx{UnionE} [| A : Union(C); !!B.[| A: B; B: C |] ==> R |] ==> R
|
|
579 |
|
|
580 |
\tdx{InterI} [| !!x. x: C ==> A: x; c:C |] ==> A : Inter(C)
|
|
581 |
\tdx{InterD} [| A : Inter(C); B : C |] ==> A : B
|
|
582 |
\tdx{InterE} [| A : Inter(C); A:B ==> R; ~ B:C ==> R |] ==> R
|
|
583 |
|
|
584 |
\tdx{UN_I} [| a: A; b: B(a) |] ==> b: (UN x:A. B(x))
|
|
585 |
\tdx{UN_E} [| b : (UN x:A. B(x)); !!x.[| x: A; b: B(x) |] ==> R
|
|
586 |
|] ==> R
|
|
587 |
|
|
588 |
\tdx{INT_I} [| !!x. x: A ==> b: B(x); a: A |] ==> b: (INT x:A. B(x))
|
|
589 |
\tdx{INT_E} [| b : (INT x:A. B(x)); a: A |] ==> b : B(a)
|
|
590 |
\end{ttbox}
|
|
591 |
\caption{General union and intersection} \label{zf-lemmas3}
|
|
592 |
\end{figure}
|
|
593 |
|
|
594 |
|
104
|
595 |
%%% upair.ML
|
|
596 |
|
|
597 |
\begin{figure}
|
|
598 |
\begin{ttbox}
|
317
|
599 |
\tdx{pairing} a:Upair(b,c) <-> (a=b | a=c)
|
|
600 |
\tdx{UpairI1} a : Upair(a,b)
|
|
601 |
\tdx{UpairI2} b : Upair(a,b)
|
|
602 |
\tdx{UpairE} [| a : Upair(b,c); a = b ==> P; a = c ==> P |] ==> P
|
|
603 |
\end{ttbox}
|
|
604 |
\caption{Unordered pairs} \label{zf-upair1}
|
|
605 |
\end{figure}
|
|
606 |
|
104
|
607 |
|
317
|
608 |
\begin{figure}
|
|
609 |
\begin{ttbox}
|
|
610 |
\tdx{UnI1} c : A ==> c : A Un B
|
|
611 |
\tdx{UnI2} c : B ==> c : A Un B
|
|
612 |
\tdx{UnCI} (~c : B ==> c : A) ==> c : A Un B
|
|
613 |
\tdx{UnE} [| c : A Un B; c:A ==> P; c:B ==> P |] ==> P
|
|
614 |
|
|
615 |
\tdx{IntI} [| c : A; c : B |] ==> c : A Int B
|
|
616 |
\tdx{IntD1} c : A Int B ==> c : A
|
|
617 |
\tdx{IntD2} c : A Int B ==> c : B
|
|
618 |
\tdx{IntE} [| c : A Int B; [| c:A; c:B |] ==> P |] ==> P
|
104
|
619 |
|
317
|
620 |
\tdx{DiffI} [| c : A; ~ c : B |] ==> c : A - B
|
|
621 |
\tdx{DiffD1} c : A - B ==> c : A
|
|
622 |
\tdx{DiffD2} [| c : A - B; c : B |] ==> P
|
|
623 |
\tdx{DiffE} [| c : A - B; [| c:A; ~ c:B |] ==> P |] ==> P
|
|
624 |
\end{ttbox}
|
|
625 |
\caption{Union, intersection, difference} \label{zf-Un}
|
|
626 |
\end{figure}
|
|
627 |
|
104
|
628 |
|
317
|
629 |
\begin{figure}
|
|
630 |
\begin{ttbox}
|
|
631 |
\tdx{consI1} a : cons(a,B)
|
|
632 |
\tdx{consI2} a : B ==> a : cons(b,B)
|
|
633 |
\tdx{consCI} (~ a:B ==> a=b) ==> a: cons(b,B)
|
|
634 |
\tdx{consE} [| a : cons(b,A); a=b ==> P; a:A ==> P |] ==> P
|
|
635 |
|
|
636 |
\tdx{singletonI} a : \{a\}
|
|
637 |
\tdx{singletonE} [| a : \{b\}; a=b ==> P |] ==> P
|
104
|
638 |
\end{ttbox}
|
317
|
639 |
\caption{Finite and singleton sets} \label{zf-upair2}
|
104
|
640 |
\end{figure}
|
|
641 |
|
|
642 |
|
|
643 |
\begin{figure}
|
|
644 |
\begin{ttbox}
|
317
|
645 |
\tdx{succI1} i : succ(i)
|
|
646 |
\tdx{succI2} i : j ==> i : succ(j)
|
|
647 |
\tdx{succCI} (~ i:j ==> i=j) ==> i: succ(j)
|
|
648 |
\tdx{succE} [| i : succ(j); i=j ==> P; i:j ==> P |] ==> P
|
|
649 |
\tdx{succ_neq_0} [| succ(n)=0 |] ==> P
|
|
650 |
\tdx{succ_inject} succ(m) = succ(n) ==> m=n
|
|
651 |
\end{ttbox}
|
|
652 |
\caption{The successor function} \label{zf-succ}
|
|
653 |
\end{figure}
|
104
|
654 |
|
|
655 |
|
317
|
656 |
\begin{figure}
|
|
657 |
\begin{ttbox}
|
|
658 |
\tdx{the_equality} [| P(a); !!x. P(x) ==> x=a |] ==> (THE x. P(x)) = a
|
|
659 |
\tdx{theI} EX! x. P(x) ==> P(THE x. P(x))
|
104
|
660 |
|
317
|
661 |
\tdx{if_P} P ==> if(P,a,b) = a
|
|
662 |
\tdx{if_not_P} ~P ==> if(P,a,b) = b
|
104
|
663 |
|
317
|
664 |
\tdx{mem_anti_sym} [| a:b; b:a |] ==> P
|
|
665 |
\tdx{mem_anti_refl} a:a ==> P
|
104
|
666 |
\end{ttbox}
|
317
|
667 |
\caption{Descriptions; non-circularity} \label{zf-the}
|
104
|
668 |
\end{figure}
|
|
669 |
|
|
670 |
|
|
671 |
\subsection{Unordered pairs and finite sets}
|
317
|
672 |
Figure~\ref{zf-upair1} presents the principle of unordered pairing, along
|
104
|
673 |
with its derived rules. Binary union and intersection are defined in terms
|
317
|
674 |
of ordered pairs (Fig.\ts\ref{zf-Un}). Set difference is also included. The
|
|
675 |
rule \tdx{UnCI} is useful for classical reasoning about unions,
|
|
676 |
like {\tt disjCI}\@; it supersedes \tdx{UnI1} and
|
|
677 |
\tdx{UnI2}, but these rules are often easier to work with. For
|
104
|
678 |
intersection and difference we have both elimination and destruction rules.
|
|
679 |
Again, there is no reason to provide a minimal rule set.
|
|
680 |
|
317
|
681 |
Figure~\ref{zf-upair2} is concerned with finite sets: it presents rules
|
|
682 |
for~{\tt cons}, the finite set constructor, and rules for singleton
|
|
683 |
sets. Figure~\ref{zf-succ} presents derived rules for the successor
|
|
684 |
function, which is defined in terms of~{\tt cons}. The proof that {\tt
|
|
685 |
succ} is injective appears to require the Axiom of Foundation.
|
104
|
686 |
|
317
|
687 |
Definite descriptions (\sdx{THE}) are defined in terms of the singleton
|
|
688 |
set~$\{0\}$, but their derived rules fortunately hide this
|
|
689 |
(Fig.\ts\ref{zf-the}). The rule~\tdx{theI} is difficult to apply
|
|
690 |
because of the two occurrences of~$\Var{P}$. However,
|
|
691 |
\tdx{the_equality} does not have this problem and the files contain
|
|
692 |
many examples of its use.
|
104
|
693 |
|
|
694 |
Finally, the impossibility of having both $a\in b$ and $b\in a$
|
317
|
695 |
(\tdx{mem_anti_sym}) is proved by applying the Axiom of Foundation to
|
104
|
696 |
the set $\{a,b\}$. The impossibility of $a\in a$ is a trivial consequence.
|
|
697 |
|
317
|
698 |
See the file {\tt ZF/upair.ML} for full proofs of the rules discussed in
|
|
699 |
this section.
|
104
|
700 |
|
|
701 |
|
|
702 |
%%% subset.ML
|
|
703 |
|
|
704 |
\begin{figure}
|
|
705 |
\begin{ttbox}
|
317
|
706 |
\tdx{Union_upper} B:A ==> B <= Union(A)
|
|
707 |
\tdx{Union_least} [| !!x. x:A ==> x<=C |] ==> Union(A) <= C
|
104
|
708 |
|
317
|
709 |
\tdx{Inter_lower} B:A ==> Inter(A) <= B
|
|
710 |
\tdx{Inter_greatest} [| a:A; !!x. x:A ==> C<=x |] ==> C <= Inter(A)
|
104
|
711 |
|
317
|
712 |
\tdx{Un_upper1} A <= A Un B
|
|
713 |
\tdx{Un_upper2} B <= A Un B
|
|
714 |
\tdx{Un_least} [| A<=C; B<=C |] ==> A Un B <= C
|
104
|
715 |
|
317
|
716 |
\tdx{Int_lower1} A Int B <= A
|
|
717 |
\tdx{Int_lower2} A Int B <= B
|
|
718 |
\tdx{Int_greatest} [| C<=A; C<=B |] ==> C <= A Int B
|
104
|
719 |
|
317
|
720 |
\tdx{Diff_subset} A-B <= A
|
|
721 |
\tdx{Diff_contains} [| C<=A; C Int B = 0 |] ==> C <= A-B
|
104
|
722 |
|
317
|
723 |
\tdx{Collect_subset} Collect(A,P) <= A
|
104
|
724 |
\end{ttbox}
|
317
|
725 |
\caption{Subset and lattice properties} \label{zf-subset}
|
104
|
726 |
\end{figure}
|
|
727 |
|
|
728 |
|
|
729 |
\subsection{Subset and lattice properties}
|
317
|
730 |
The subset relation is a complete lattice. Unions form least upper bounds;
|
|
731 |
non-empty intersections form greatest lower bounds. Figure~\ref{zf-subset}
|
|
732 |
shows the corresponding rules. A few other laws involving subsets are
|
|
733 |
included. Proofs are in the file {\tt ZF/subset.ML}.
|
|
734 |
|
|
735 |
Reasoning directly about subsets often yields clearer proofs than
|
|
736 |
reasoning about the membership relation. Section~\ref{sec:ZF-pow-example}
|
|
737 |
below presents an example of this, proving the equation ${{\tt Pow}(A)\cap
|
|
738 |
{\tt Pow}(B)}= {\tt Pow}(A\cap B)$.
|
104
|
739 |
|
|
740 |
%%% pair.ML
|
|
741 |
|
|
742 |
\begin{figure}
|
|
743 |
\begin{ttbox}
|
317
|
744 |
\tdx{Pair_inject1} <a,b> = <c,d> ==> a=c
|
|
745 |
\tdx{Pair_inject2} <a,b> = <c,d> ==> b=d
|
|
746 |
\tdx{Pair_inject} [| <a,b> = <c,d>; [| a=c; b=d |] ==> P |] ==> P
|
|
747 |
\tdx{Pair_neq_0} <a,b>=0 ==> P
|
104
|
748 |
|
349
|
749 |
\tdx{fst_conv} fst(<a,b>) = a
|
|
750 |
\tdx{snd_conv} snd(<a,b>) = b
|
317
|
751 |
\tdx{split} split(\%x y.c(x,y), <a,b>) = c(a,b)
|
104
|
752 |
|
317
|
753 |
\tdx{SigmaI} [| a:A; b:B(a) |] ==> <a,b> : Sigma(A,B)
|
104
|
754 |
|
317
|
755 |
\tdx{SigmaE} [| c: Sigma(A,B);
|
|
756 |
!!x y.[| x:A; y:B(x); c=<x,y> |] ==> P |] ==> P
|
104
|
757 |
|
317
|
758 |
\tdx{SigmaE2} [| <a,b> : Sigma(A,B);
|
|
759 |
[| a:A; b:B(a) |] ==> P |] ==> P
|
104
|
760 |
\end{ttbox}
|
317
|
761 |
\caption{Ordered pairs; projections; general sums} \label{zf-pair}
|
104
|
762 |
\end{figure}
|
|
763 |
|
|
764 |
|
|
765 |
\subsection{Ordered pairs}
|
317
|
766 |
Figure~\ref{zf-pair} presents the rules governing ordered pairs,
|
287
|
767 |
projections and general sums. File {\tt ZF/pair.ML} contains the
|
104
|
768 |
full (and tedious) proof that $\{\{a\},\{a,b\}\}$ functions as an ordered
|
|
769 |
pair. This property is expressed as two destruction rules,
|
317
|
770 |
\tdx{Pair_inject1} and \tdx{Pair_inject2}, and equivalently
|
|
771 |
as the elimination rule \tdx{Pair_inject}.
|
104
|
772 |
|
317
|
773 |
The rule \tdx{Pair_neq_0} asserts $\pair{a,b}\neq\emptyset$. This
|
114
|
774 |
is a property of $\{\{a\},\{a,b\}\}$, and need not hold for other
|
343
|
775 |
encodings of ordered pairs. The non-standard ordered pairs mentioned below
|
114
|
776 |
satisfy $\pair{\emptyset;\emptyset}=\emptyset$.
|
104
|
777 |
|
317
|
778 |
The natural deduction rules \tdx{SigmaI} and \tdx{SigmaE}
|
|
779 |
assert that \cdx{Sigma}$(A,B)$ consists of all pairs of the form
|
|
780 |
$\pair{x,y}$, for $x\in A$ and $y\in B(x)$. The rule \tdx{SigmaE2}
|
104
|
781 |
merely states that $\pair{a,b}\in {\tt Sigma}(A,B)$ implies $a\in A$ and
|
|
782 |
$b\in B(a)$.
|
|
783 |
|
|
784 |
|
|
785 |
%%% domrange.ML
|
|
786 |
|
|
787 |
\begin{figure}
|
|
788 |
\begin{ttbox}
|
317
|
789 |
\tdx{domainI} <a,b>: r ==> a : domain(r)
|
|
790 |
\tdx{domainE} [| a : domain(r); !!y. <a,y>: r ==> P |] ==> P
|
|
791 |
\tdx{domain_subset} domain(Sigma(A,B)) <= A
|
104
|
792 |
|
317
|
793 |
\tdx{rangeI} <a,b>: r ==> b : range(r)
|
|
794 |
\tdx{rangeE} [| b : range(r); !!x. <x,b>: r ==> P |] ==> P
|
|
795 |
\tdx{range_subset} range(A*B) <= B
|
104
|
796 |
|
317
|
797 |
\tdx{fieldI1} <a,b>: r ==> a : field(r)
|
|
798 |
\tdx{fieldI2} <a,b>: r ==> b : field(r)
|
|
799 |
\tdx{fieldCI} (~ <c,a>:r ==> <a,b>: r) ==> a : field(r)
|
104
|
800 |
|
317
|
801 |
\tdx{fieldE} [| a : field(r);
|
104
|
802 |
!!x. <a,x>: r ==> P;
|
|
803 |
!!x. <x,a>: r ==> P
|
|
804 |
|] ==> P
|
|
805 |
|
317
|
806 |
\tdx{field_subset} field(A*A) <= A
|
|
807 |
\end{ttbox}
|
|
808 |
\caption{Domain, range and field of a relation} \label{zf-domrange}
|
|
809 |
\end{figure}
|
104
|
810 |
|
317
|
811 |
\begin{figure}
|
|
812 |
\begin{ttbox}
|
|
813 |
\tdx{imageI} [| <a,b>: r; a:A |] ==> b : r``A
|
|
814 |
\tdx{imageE} [| b: r``A; !!x.[| <x,b>: r; x:A |] ==> P |] ==> P
|
|
815 |
|
|
816 |
\tdx{vimageI} [| <a,b>: r; b:B |] ==> a : r-``B
|
|
817 |
\tdx{vimageE} [| a: r-``B; !!x.[| <a,x>: r; x:B |] ==> P |] ==> P
|
104
|
818 |
\end{ttbox}
|
317
|
819 |
\caption{Image and inverse image} \label{zf-domrange2}
|
104
|
820 |
\end{figure}
|
|
821 |
|
|
822 |
|
|
823 |
\subsection{Relations}
|
317
|
824 |
Figure~\ref{zf-domrange} presents rules involving relations, which are sets
|
104
|
825 |
of ordered pairs. The converse of a relation~$r$ is the set of all pairs
|
|
826 |
$\pair{y,x}$ such that $\pair{x,y}\in r$; if $r$ is a function, then
|
317
|
827 |
{\cdx{converse}$(r)$} is its inverse. The rules for the domain
|
343
|
828 |
operation, namely \tdx{domainI} and~\tdx{domainE}, assert that
|
|
829 |
\cdx{domain}$(r)$ consists of all~$x$ such that $r$ contains
|
104
|
830 |
some pair of the form~$\pair{x,y}$. The range operation is similar, and
|
317
|
831 |
the field of a relation is merely the union of its domain and range.
|
|
832 |
|
|
833 |
Figure~\ref{zf-domrange2} presents rules for images and inverse images.
|
343
|
834 |
Note that these operations are generalisations of range and domain,
|
317
|
835 |
respectively. See the file {\tt ZF/domrange.ML} for derivations of the
|
|
836 |
rules.
|
104
|
837 |
|
|
838 |
|
|
839 |
%%% func.ML
|
|
840 |
|
|
841 |
\begin{figure}
|
|
842 |
\begin{ttbox}
|
317
|
843 |
\tdx{fun_is_rel} f: Pi(A,B) ==> f <= Sigma(A,B)
|
104
|
844 |
|
317
|
845 |
\tdx{apply_equality} [| <a,b>: f; f: Pi(A,B) |] ==> f`a = b
|
|
846 |
\tdx{apply_equality2} [| <a,b>: f; <a,c>: f; f: Pi(A,B) |] ==> b=c
|
104
|
847 |
|
317
|
848 |
\tdx{apply_type} [| f: Pi(A,B); a:A |] ==> f`a : B(a)
|
|
849 |
\tdx{apply_Pair} [| f: Pi(A,B); a:A |] ==> <a,f`a>: f
|
|
850 |
\tdx{apply_iff} f: Pi(A,B) ==> <a,b>: f <-> a:A & f`a = b
|
104
|
851 |
|
317
|
852 |
\tdx{fun_extension} [| f : Pi(A,B); g: Pi(A,D);
|
104
|
853 |
!!x. x:A ==> f`x = g`x |] ==> f=g
|
|
854 |
|
317
|
855 |
\tdx{domain_type} [| <a,b> : f; f: Pi(A,B) |] ==> a : A
|
|
856 |
\tdx{range_type} [| <a,b> : f; f: Pi(A,B) |] ==> b : B(a)
|
104
|
857 |
|
317
|
858 |
\tdx{Pi_type} [| f: A->C; !!x. x:A ==> f`x: B(x) |] ==> f: Pi(A,B)
|
|
859 |
\tdx{domain_of_fun} f: Pi(A,B) ==> domain(f)=A
|
|
860 |
\tdx{range_of_fun} f: Pi(A,B) ==> f: A->range(f)
|
104
|
861 |
|
317
|
862 |
\tdx{restrict} a : A ==> restrict(f,A) ` a = f`a
|
|
863 |
\tdx{restrict_type} [| !!x. x:A ==> f`x: B(x) |] ==>
|
|
864 |
restrict(f,A) : Pi(A,B)
|
104
|
865 |
\end{ttbox}
|
317
|
866 |
\caption{Functions} \label{zf-func1}
|
104
|
867 |
\end{figure}
|
|
868 |
|
|
869 |
|
|
870 |
\begin{figure}
|
|
871 |
\begin{ttbox}
|
317
|
872 |
\tdx{lamI} a:A ==> <a,b(a)> : (lam x:A. b(x))
|
|
873 |
\tdx{lamE} [| p: (lam x:A. b(x)); !!x.[| x:A; p=<x,b(x)> |] ==> P
|
|
874 |
|] ==> P
|
|
875 |
|
|
876 |
\tdx{lam_type} [| !!x. x:A ==> b(x): B(x) |] ==> (lam x:A.b(x)) : Pi(A,B)
|
104
|
877 |
|
317
|
878 |
\tdx{beta} a : A ==> (lam x:A.b(x)) ` a = b(a)
|
|
879 |
\tdx{eta} f : Pi(A,B) ==> (lam x:A. f`x) = f
|
|
880 |
\end{ttbox}
|
|
881 |
\caption{$\lambda$-abstraction} \label{zf-lam}
|
|
882 |
\end{figure}
|
|
883 |
|
|
884 |
|
|
885 |
\begin{figure}
|
|
886 |
\begin{ttbox}
|
|
887 |
\tdx{fun_empty} 0: 0->0
|
|
888 |
\tdx{fun_single} \{<a,b>\} : \{a\} -> \{b\}
|
|
889 |
|
|
890 |
\tdx{fun_disjoint_Un} [| f: A->B; g: C->D; A Int C = 0 |] ==>
|
104
|
891 |
(f Un g) : (A Un C) -> (B Un D)
|
|
892 |
|
317
|
893 |
\tdx{fun_disjoint_apply1} [| a:A; f: A->B; g: C->D; A Int C = 0 |] ==>
|
104
|
894 |
(f Un g)`a = f`a
|
|
895 |
|
317
|
896 |
\tdx{fun_disjoint_apply2} [| c:C; f: A->B; g: C->D; A Int C = 0 |] ==>
|
104
|
897 |
(f Un g)`c = g`c
|
|
898 |
\end{ttbox}
|
317
|
899 |
\caption{Constructing functions from smaller sets} \label{zf-func2}
|
104
|
900 |
\end{figure}
|
|
901 |
|
|
902 |
|
|
903 |
\subsection{Functions}
|
|
904 |
Functions, represented by graphs, are notoriously difficult to reason
|
317
|
905 |
about. The file {\tt ZF/func.ML} derives many rules, which overlap more
|
|
906 |
than they ought. This section presents the more important rules.
|
104
|
907 |
|
317
|
908 |
Figure~\ref{zf-func1} presents the basic properties of \cdx{Pi}$(A,B)$,
|
104
|
909 |
the generalized function space. For example, if $f$ is a function and
|
317
|
910 |
$\pair{a,b}\in f$, then $f`a=b$ (\tdx{apply_equality}). Two functions
|
104
|
911 |
are equal provided they have equal domains and deliver equals results
|
317
|
912 |
(\tdx{fun_extension}).
|
104
|
913 |
|
317
|
914 |
By \tdx{Pi_type}, a function typing of the form $f\in A\to C$ can be
|
104
|
915 |
refined to the dependent typing $f\in\prod@{x\in A}B(x)$, given a suitable
|
317
|
916 |
family of sets $\{B(x)\}@{x\in A}$. Conversely, by \tdx{range_of_fun},
|
104
|
917 |
any dependent typing can be flattened to yield a function type of the form
|
|
918 |
$A\to C$; here, $C={\tt range}(f)$.
|
|
919 |
|
317
|
920 |
Among the laws for $\lambda$-abstraction, \tdx{lamI} and \tdx{lamE}
|
|
921 |
describe the graph of the generated function, while \tdx{beta} and
|
|
922 |
\tdx{eta} are the standard conversions. We essentially have a
|
|
923 |
dependently-typed $\lambda$-calculus (Fig.\ts\ref{zf-lam}).
|
104
|
924 |
|
317
|
925 |
Figure~\ref{zf-func2} presents some rules that can be used to construct
|
104
|
926 |
functions explicitly. We start with functions consisting of at most one
|
|
927 |
pair, and may form the union of two functions provided their domains are
|
|
928 |
disjoint.
|
|
929 |
|
|
930 |
|
|
931 |
\begin{figure}
|
|
932 |
\begin{ttbox}
|
317
|
933 |
\tdx{Int_absorb} A Int A = A
|
|
934 |
\tdx{Int_commute} A Int B = B Int A
|
|
935 |
\tdx{Int_assoc} (A Int B) Int C = A Int (B Int C)
|
|
936 |
\tdx{Int_Un_distrib} (A Un B) Int C = (A Int C) Un (B Int C)
|
104
|
937 |
|
317
|
938 |
\tdx{Un_absorb} A Un A = A
|
|
939 |
\tdx{Un_commute} A Un B = B Un A
|
|
940 |
\tdx{Un_assoc} (A Un B) Un C = A Un (B Un C)
|
|
941 |
\tdx{Un_Int_distrib} (A Int B) Un C = (A Un C) Int (B Un C)
|
104
|
942 |
|
317
|
943 |
\tdx{Diff_cancel} A-A = 0
|
|
944 |
\tdx{Diff_disjoint} A Int (B-A) = 0
|
|
945 |
\tdx{Diff_partition} A<=B ==> A Un (B-A) = B
|
|
946 |
\tdx{double_complement} [| A<=B; B<= C |] ==> (B - (C-A)) = A
|
|
947 |
\tdx{Diff_Un} A - (B Un C) = (A-B) Int (A-C)
|
|
948 |
\tdx{Diff_Int} A - (B Int C) = (A-B) Un (A-C)
|
104
|
949 |
|
317
|
950 |
\tdx{Union_Un_distrib} Union(A Un B) = Union(A) Un Union(B)
|
|
951 |
\tdx{Inter_Un_distrib} [| a:A; b:B |] ==>
|
104
|
952 |
Inter(A Un B) = Inter(A) Int Inter(B)
|
|
953 |
|
317
|
954 |
\tdx{Int_Union_RepFun} A Int Union(B) = (UN C:B. A Int C)
|
104
|
955 |
|
317
|
956 |
\tdx{Un_Inter_RepFun} b:B ==>
|
104
|
957 |
A Un Inter(B) = (INT C:B. A Un C)
|
|
958 |
|
317
|
959 |
\tdx{SUM_Un_distrib1} (SUM x:A Un B. C(x)) =
|
104
|
960 |
(SUM x:A. C(x)) Un (SUM x:B. C(x))
|
|
961 |
|
317
|
962 |
\tdx{SUM_Un_distrib2} (SUM x:C. A(x) Un B(x)) =
|
104
|
963 |
(SUM x:C. A(x)) Un (SUM x:C. B(x))
|
|
964 |
|
317
|
965 |
\tdx{SUM_Int_distrib1} (SUM x:A Int B. C(x)) =
|
104
|
966 |
(SUM x:A. C(x)) Int (SUM x:B. C(x))
|
|
967 |
|
317
|
968 |
\tdx{SUM_Int_distrib2} (SUM x:C. A(x) Int B(x)) =
|
104
|
969 |
(SUM x:C. A(x)) Int (SUM x:C. B(x))
|
|
970 |
\end{ttbox}
|
|
971 |
\caption{Equalities} \label{zf-equalities}
|
|
972 |
\end{figure}
|
|
973 |
|
111
|
974 |
|
|
975 |
\begin{figure}
|
317
|
976 |
%\begin{constants}
|
|
977 |
% \cdx{1} & $i$ & & $\{\emptyset\}$ \\
|
|
978 |
% \cdx{bool} & $i$ & & the set $\{\emptyset,1\}$ \\
|
|
979 |
% \cdx{cond} & $[i,i,i]\To i$ & & conditional for {\tt bool} \\
|
|
980 |
% \cdx{not} & $i\To i$ & & negation for {\tt bool} \\
|
|
981 |
% \sdx{and} & $[i,i]\To i$ & Left 70 & conjunction for {\tt bool} \\
|
|
982 |
% \sdx{or} & $[i,i]\To i$ & Left 65 & disjunction for {\tt bool} \\
|
|
983 |
% \sdx{xor} & $[i,i]\To i$ & Left 65 & exclusive-or for {\tt bool}
|
|
984 |
%\end{constants}
|
|
985 |
%
|
111
|
986 |
\begin{ttbox}
|
317
|
987 |
\tdx{bool_def} bool == \{0,1\}
|
|
988 |
\tdx{cond_def} cond(b,c,d) == if(b=1,c,d)
|
|
989 |
\tdx{not_def} not(b) == cond(b,0,1)
|
|
990 |
\tdx{and_def} a and b == cond(a,b,0)
|
|
991 |
\tdx{or_def} a or b == cond(a,1,b)
|
|
992 |
\tdx{xor_def} a xor b == cond(a,not(b),b)
|
|
993 |
|
|
994 |
\tdx{bool_1I} 1 : bool
|
|
995 |
\tdx{bool_0I} 0 : bool
|
|
996 |
\tdx{boolE} [| c: bool; c=1 ==> P; c=0 ==> P |] ==> P
|
|
997 |
\tdx{cond_1} cond(1,c,d) = c
|
|
998 |
\tdx{cond_0} cond(0,c,d) = d
|
|
999 |
\end{ttbox}
|
|
1000 |
\caption{The booleans} \label{zf-bool}
|
|
1001 |
\end{figure}
|
|
1002 |
|
|
1003 |
|
|
1004 |
\section{Further developments}
|
|
1005 |
The next group of developments is complex and extensive, and only
|
|
1006 |
highlights can be covered here. It involves many theories and ML files of
|
|
1007 |
proofs.
|
|
1008 |
|
|
1009 |
Figure~\ref{zf-equalities} presents commutative, associative, distributive,
|
|
1010 |
and idempotency laws of union and intersection, along with other equations.
|
|
1011 |
See file {\tt ZF/equalities.ML}.
|
|
1012 |
|
|
1013 |
Theory \thydx{Bool} defines $\{0,1\}$ as a set of booleans, with the
|
|
1014 |
usual operators including a conditional (Fig.\ts\ref{zf-bool}). Although
|
|
1015 |
{\ZF} is a first-order theory, you can obtain the effect of higher-order
|
|
1016 |
logic using {\tt bool}-valued functions, for example. The constant~{\tt1}
|
|
1017 |
is translated to {\tt succ(0)}.
|
|
1018 |
|
|
1019 |
\begin{figure}
|
|
1020 |
\index{*"+ symbol}
|
|
1021 |
\begin{constants}
|
343
|
1022 |
\it symbol & \it meta-type & \it priority & \it description \\
|
317
|
1023 |
\tt + & $[i,i]\To i$ & Right 65 & disjoint union operator\\
|
|
1024 |
\cdx{Inl}~~\cdx{Inr} & $i\To i$ & & injections\\
|
|
1025 |
\cdx{case} & $[i\To i,i\To i, i]\To i$ & & conditional for $A+B$
|
|
1026 |
\end{constants}
|
|
1027 |
\begin{ttbox}
|
|
1028 |
\tdx{sum_def} A+B == \{0\}*A Un \{1\}*B
|
|
1029 |
\tdx{Inl_def} Inl(a) == <0,a>
|
|
1030 |
\tdx{Inr_def} Inr(b) == <1,b>
|
|
1031 |
\tdx{case_def} case(c,d,u) == split(\%y z. cond(y, d(z), c(z)), u)
|
|
1032 |
|
|
1033 |
\tdx{sum_InlI} a : A ==> Inl(a) : A+B
|
|
1034 |
\tdx{sum_InrI} b : B ==> Inr(b) : A+B
|
|
1035 |
|
|
1036 |
\tdx{Inl_inject} Inl(a)=Inl(b) ==> a=b
|
|
1037 |
\tdx{Inr_inject} Inr(a)=Inr(b) ==> a=b
|
|
1038 |
\tdx{Inl_neq_Inr} Inl(a)=Inr(b) ==> P
|
|
1039 |
|
|
1040 |
\tdx{sumE2} u: A+B ==> (EX x. x:A & u=Inl(x)) | (EX y. y:B & u=Inr(y))
|
|
1041 |
|
|
1042 |
\tdx{case_Inl} case(c,d,Inl(a)) = c(a)
|
|
1043 |
\tdx{case_Inr} case(c,d,Inr(b)) = d(b)
|
|
1044 |
\end{ttbox}
|
|
1045 |
\caption{Disjoint unions} \label{zf-sum}
|
|
1046 |
\end{figure}
|
|
1047 |
|
|
1048 |
|
|
1049 |
Theory \thydx{Sum} defines the disjoint union of two sets, with
|
|
1050 |
injections and a case analysis operator (Fig.\ts\ref{zf-sum}). Disjoint
|
|
1051 |
unions play a role in datatype definitions, particularly when there is
|
|
1052 |
mutual recursion~\cite{paulson-set-II}.
|
|
1053 |
|
|
1054 |
\begin{figure}
|
|
1055 |
\begin{ttbox}
|
|
1056 |
\tdx{QPair_def} <a;b> == a+b
|
|
1057 |
\tdx{qsplit_def} qsplit(c,p) == THE y. EX a b. p=<a;b> & y=c(a,b)
|
|
1058 |
\tdx{qfsplit_def} qfsplit(R,z) == EX x y. z=<x;y> & R(x,y)
|
|
1059 |
\tdx{qconverse_def} qconverse(r) == {z. w:r, EX x y. w=<x;y> & z=<y;x>}
|
|
1060 |
\tdx{QSigma_def} QSigma(A,B) == UN x:A. UN y:B(x). {<x;y>}
|
|
1061 |
|
|
1062 |
\tdx{qsum_def} A <+> B == (\{0\} <*> A) Un (\{1\} <*> B)
|
|
1063 |
\tdx{QInl_def} QInl(a) == <0;a>
|
|
1064 |
\tdx{QInr_def} QInr(b) == <1;b>
|
|
1065 |
\tdx{qcase_def} qcase(c,d) == qsplit(\%y z. cond(y, d(z), c(z)))
|
|
1066 |
\end{ttbox}
|
|
1067 |
\caption{Non-standard pairs, products and sums} \label{zf-qpair}
|
|
1068 |
\end{figure}
|
|
1069 |
|
|
1070 |
Theory \thydx{QPair} defines a notion of ordered pair that admits
|
|
1071 |
non-well-founded tupling (Fig.\ts\ref{zf-qpair}). Such pairs are written
|
|
1072 |
{\tt<$a$;$b$>}. It also defines the eliminator \cdx{qsplit}, the
|
|
1073 |
converse operator \cdx{qconverse}, and the summation operator
|
|
1074 |
\cdx{QSigma}. These are completely analogous to the corresponding
|
|
1075 |
versions for standard ordered pairs. The theory goes on to define a
|
|
1076 |
non-standard notion of disjoint sum using non-standard pairs. All of these
|
|
1077 |
concepts satisfy the same properties as their standard counterparts; in
|
|
1078 |
addition, {\tt<$a$;$b$>} is continuous. The theory supports coinductive
|
|
1079 |
definitions, for example of infinite lists~\cite{paulson-final}.
|
|
1080 |
|
|
1081 |
\begin{figure}
|
|
1082 |
\begin{ttbox}
|
|
1083 |
\tdx{bnd_mono_def} bnd_mono(D,h) ==
|
111
|
1084 |
h(D)<=D & (ALL W X. W<=X --> X<=D --> h(W) <= h(X))
|
|
1085 |
|
317
|
1086 |
\tdx{lfp_def} lfp(D,h) == Inter({X: Pow(D). h(X) <= X})
|
|
1087 |
\tdx{gfp_def} gfp(D,h) == Union({X: Pow(D). X <= h(X)})
|
|
1088 |
|
111
|
1089 |
|
317
|
1090 |
\tdx{lfp_lowerbound} [| h(A) <= A; A<=D |] ==> lfp(D,h) <= A
|
111
|
1091 |
|
317
|
1092 |
\tdx{lfp_subset} lfp(D,h) <= D
|
111
|
1093 |
|
317
|
1094 |
\tdx{lfp_greatest} [| bnd_mono(D,h);
|
111
|
1095 |
!!X. [| h(X) <= X; X<=D |] ==> A<=X
|
|
1096 |
|] ==> A <= lfp(D,h)
|
|
1097 |
|
317
|
1098 |
\tdx{lfp_Tarski} bnd_mono(D,h) ==> lfp(D,h) = h(lfp(D,h))
|
111
|
1099 |
|
317
|
1100 |
\tdx{induct} [| a : lfp(D,h); bnd_mono(D,h);
|
111
|
1101 |
!!x. x : h(Collect(lfp(D,h),P)) ==> P(x)
|
|
1102 |
|] ==> P(a)
|
|
1103 |
|
317
|
1104 |
\tdx{lfp_mono} [| bnd_mono(D,h); bnd_mono(E,i);
|
111
|
1105 |
!!X. X<=D ==> h(X) <= i(X)
|
|
1106 |
|] ==> lfp(D,h) <= lfp(E,i)
|
|
1107 |
|
317
|
1108 |
\tdx{gfp_upperbound} [| A <= h(A); A<=D |] ==> A <= gfp(D,h)
|
111
|
1109 |
|
317
|
1110 |
\tdx{gfp_subset} gfp(D,h) <= D
|
111
|
1111 |
|
317
|
1112 |
\tdx{gfp_least} [| bnd_mono(D,h);
|
111
|
1113 |
!!X. [| X <= h(X); X<=D |] ==> X<=A
|
|
1114 |
|] ==> gfp(D,h) <= A
|
|
1115 |
|
317
|
1116 |
\tdx{gfp_Tarski} bnd_mono(D,h) ==> gfp(D,h) = h(gfp(D,h))
|
111
|
1117 |
|
317
|
1118 |
\tdx{coinduct} [| bnd_mono(D,h); a: X; X <= h(X Un gfp(D,h)); X <= D
|
111
|
1119 |
|] ==> a : gfp(D,h)
|
|
1120 |
|
317
|
1121 |
\tdx{gfp_mono} [| bnd_mono(D,h); D <= E;
|
111
|
1122 |
!!X. X<=D ==> h(X) <= i(X)
|
|
1123 |
|] ==> gfp(D,h) <= gfp(E,i)
|
|
1124 |
\end{ttbox}
|
|
1125 |
\caption{Least and greatest fixedpoints} \label{zf-fixedpt}
|
|
1126 |
\end{figure}
|
|
1127 |
|
317
|
1128 |
The Knaster-Tarski Theorem states that every monotone function over a
|
|
1129 |
complete lattice has a fixedpoint. Theory \thydx{Fixedpt} proves the
|
|
1130 |
Theorem only for a particular lattice, namely the lattice of subsets of a
|
|
1131 |
set (Fig.\ts\ref{zf-fixedpt}). The theory defines least and greatest
|
|
1132 |
fixedpoint operators with corresponding induction and coinduction rules.
|
|
1133 |
These are essential to many definitions that follow, including the natural
|
|
1134 |
numbers and the transitive closure operator. The (co)inductive definition
|
|
1135 |
package also uses the fixedpoint operators~\cite{paulson-fixedpt}. See
|
|
1136 |
Davey and Priestley~\cite{davey&priestley} for more on the Knaster-Tarski
|
|
1137 |
Theorem and my paper~\cite{paulson-set-II} for discussion of the Isabelle
|
|
1138 |
proofs.
|
|
1139 |
|
|
1140 |
Monotonicity properties are proved for most of the set-forming operations:
|
|
1141 |
union, intersection, Cartesian product, image, domain, range, etc. These
|
|
1142 |
are useful for applying the Knaster-Tarski Fixedpoint Theorem. The proofs
|
|
1143 |
themselves are trivial applications of Isabelle's classical reasoner. See
|
|
1144 |
file {\tt ZF/mono.ML}.
|
|
1145 |
|
111
|
1146 |
|
104
|
1147 |
\begin{figure}
|
317
|
1148 |
\begin{constants}
|
|
1149 |
\it symbol & \it meta-type & \it priority & \it description \\
|
|
1150 |
\sdx{O} & $[i,i]\To i$ & Right 60 & composition ($\circ$) \\
|
349
|
1151 |
\cdx{id} & $i\To i$ & & identity function \\
|
317
|
1152 |
\cdx{inj} & $[i,i]\To i$ & & injective function space\\
|
|
1153 |
\cdx{surj} & $[i,i]\To i$ & & surjective function space\\
|
|
1154 |
\cdx{bij} & $[i,i]\To i$ & & bijective function space
|
|
1155 |
\end{constants}
|
|
1156 |
|
104
|
1157 |
\begin{ttbox}
|
317
|
1158 |
\tdx{comp_def} r O s == \{xz : domain(s)*range(r) .
|
104
|
1159 |
EX x y z. xz=<x,z> & <x,y>:s & <y,z>:r\}
|
317
|
1160 |
\tdx{id_def} id(A) == (lam x:A. x)
|
|
1161 |
\tdx{inj_def} inj(A,B) == \{ f: A->B. ALL w:A. ALL x:A. f`w=f`x --> w=x\}
|
|
1162 |
\tdx{surj_def} surj(A,B) == \{ f: A->B . ALL y:B. EX x:A. f`x=y\}
|
|
1163 |
\tdx{bij_def} bij(A,B) == inj(A,B) Int surj(A,B)
|
104
|
1164 |
|
317
|
1165 |
|
|
1166 |
\tdx{left_inverse} [| f: inj(A,B); a: A |] ==> converse(f)`(f`a) = a
|
|
1167 |
\tdx{right_inverse} [| f: inj(A,B); b: range(f) |] ==>
|
104
|
1168 |
f`(converse(f)`b) = b
|
|
1169 |
|
317
|
1170 |
\tdx{inj_converse_inj} f: inj(A,B) ==> converse(f): inj(range(f), A)
|
|
1171 |
\tdx{bij_converse_bij} f: bij(A,B) ==> converse(f): bij(B,A)
|
104
|
1172 |
|
317
|
1173 |
\tdx{comp_type} [| s<=A*B; r<=B*C |] ==> (r O s) <= A*C
|
|
1174 |
\tdx{comp_assoc} (r O s) O t = r O (s O t)
|
104
|
1175 |
|
317
|
1176 |
\tdx{left_comp_id} r<=A*B ==> id(B) O r = r
|
|
1177 |
\tdx{right_comp_id} r<=A*B ==> r O id(A) = r
|
104
|
1178 |
|
317
|
1179 |
\tdx{comp_func} [| g:A->B; f:B->C |] ==> (f O g):A->C
|
|
1180 |
\tdx{comp_func_apply} [| g:A->B; f:B->C; a:A |] ==> (f O g)`a = f`(g`a)
|
104
|
1181 |
|
317
|
1182 |
\tdx{comp_inj} [| g:inj(A,B); f:inj(B,C) |] ==> (f O g):inj(A,C)
|
|
1183 |
\tdx{comp_surj} [| g:surj(A,B); f:surj(B,C) |] ==> (f O g):surj(A,C)
|
|
1184 |
\tdx{comp_bij} [| g:bij(A,B); f:bij(B,C) |] ==> (f O g):bij(A,C)
|
104
|
1185 |
|
317
|
1186 |
\tdx{left_comp_inverse} f: inj(A,B) ==> converse(f) O f = id(A)
|
|
1187 |
\tdx{right_comp_inverse} f: surj(A,B) ==> f O converse(f) = id(B)
|
104
|
1188 |
|
317
|
1189 |
\tdx{bij_disjoint_Un}
|
104
|
1190 |
[| f: bij(A,B); g: bij(C,D); A Int C = 0; B Int D = 0 |] ==>
|
|
1191 |
(f Un g) : bij(A Un C, B Un D)
|
|
1192 |
|
317
|
1193 |
\tdx{restrict_bij} [| f:inj(A,B); C<=A |] ==> restrict(f,C): bij(C, f``C)
|
104
|
1194 |
\end{ttbox}
|
|
1195 |
\caption{Permutations} \label{zf-perm}
|
|
1196 |
\end{figure}
|
|
1197 |
|
317
|
1198 |
The theory \thydx{Perm} is concerned with permutations (bijections) and
|
|
1199 |
related concepts. These include composition of relations, the identity
|
|
1200 |
relation, and three specialized function spaces: injective, surjective and
|
|
1201 |
bijective. Figure~\ref{zf-perm} displays many of their properties that
|
|
1202 |
have been proved. These results are fundamental to a treatment of
|
|
1203 |
equipollence and cardinality.
|
104
|
1204 |
|
|
1205 |
\begin{figure}
|
317
|
1206 |
\index{#*@{\tt\#*} symbol}
|
|
1207 |
\index{*div symbol}
|
|
1208 |
\index{*mod symbol}
|
|
1209 |
\index{#+@{\tt\#+} symbol}
|
|
1210 |
\index{#-@{\tt\#-} symbol}
|
|
1211 |
\begin{constants}
|
|
1212 |
\it symbol & \it meta-type & \it priority & \it description \\
|
|
1213 |
\cdx{nat} & $i$ & & set of natural numbers \\
|
|
1214 |
\cdx{nat_case}& $[i,i\To i,i]\To i$ & & conditional for $nat$\\
|
|
1215 |
\cdx{rec} & $[i,i,[i,i]\To i]\To i$ & & recursor for $nat$\\
|
|
1216 |
\tt \#* & $[i,i]\To i$ & Left 70 & multiplication \\
|
|
1217 |
\tt div & $[i,i]\To i$ & Left 70 & division\\
|
|
1218 |
\tt mod & $[i,i]\To i$ & Left 70 & modulus\\
|
|
1219 |
\tt \#+ & $[i,i]\To i$ & Left 65 & addition\\
|
|
1220 |
\tt \#- & $[i,i]\To i$ & Left 65 & subtraction
|
|
1221 |
\end{constants}
|
111
|
1222 |
|
317
|
1223 |
\begin{ttbox}
|
|
1224 |
\tdx{nat_def} nat == lfp(lam r: Pow(Inf). \{0\} Un \{succ(x). x:r\}
|
|
1225 |
|
|
1226 |
\tdx{nat_case_def} nat_case(a,b,k) ==
|
|
1227 |
THE y. k=0 & y=a | (EX x. k=succ(x) & y=b(x))
|
|
1228 |
|
|
1229 |
\tdx{rec_def} rec(k,a,b) ==
|
|
1230 |
transrec(k, \%n f. nat_case(a, \%m. b(m, f`m), n))
|
|
1231 |
|
|
1232 |
\tdx{add_def} m#+n == rec(m, n, \%u v.succ(v))
|
|
1233 |
\tdx{diff_def} m#-n == rec(n, m, \%u v. rec(v, 0, \%x y.x))
|
|
1234 |
\tdx{mult_def} m#*n == rec(m, 0, \%u v. n #+ v)
|
|
1235 |
\tdx{mod_def} m mod n == transrec(m, \%j f. if(j:n, j, f`(j#-n)))
|
|
1236 |
\tdx{div_def} m div n == transrec(m, \%j f. if(j:n, 0, succ(f`(j#-n))))
|
111
|
1237 |
|
|
1238 |
|
317
|
1239 |
\tdx{nat_0I} 0 : nat
|
|
1240 |
\tdx{nat_succI} n : nat ==> succ(n) : nat
|
104
|
1241 |
|
317
|
1242 |
\tdx{nat_induct}
|
104
|
1243 |
[| n: nat; P(0); !!x. [| x: nat; P(x) |] ==> P(succ(x))
|
|
1244 |
|] ==> P(n)
|
|
1245 |
|
317
|
1246 |
\tdx{nat_case_0} nat_case(a,b,0) = a
|
|
1247 |
\tdx{nat_case_succ} nat_case(a,b,succ(m)) = b(m)
|
104
|
1248 |
|
317
|
1249 |
\tdx{rec_0} rec(0,a,b) = a
|
|
1250 |
\tdx{rec_succ} rec(succ(m),a,b) = b(m, rec(m,a,b))
|
104
|
1251 |
|
317
|
1252 |
\tdx{mult_type} [| m:nat; n:nat |] ==> m #* n : nat
|
|
1253 |
\tdx{mult_0} 0 #* n = 0
|
|
1254 |
\tdx{mult_succ} succ(m) #* n = n #+ (m #* n)
|
|
1255 |
\tdx{mult_commute} [| m:nat; n:nat |] ==> m #* n = n #* m
|
|
1256 |
\tdx{add_mult_dist}
|
104
|
1257 |
[| m:nat; k:nat |] ==> (m #+ n) #* k = (m #* k) #+ (n #* k)
|
317
|
1258 |
\tdx{mult_assoc}
|
104
|
1259 |
[| m:nat; n:nat; k:nat |] ==> (m #* n) #* k = m #* (n #* k)
|
317
|
1260 |
\tdx{mod_quo_equality}
|
104
|
1261 |
[| 0:n; m:nat; n:nat |] ==> (m div n)#*n #+ m mod n = m
|
|
1262 |
\end{ttbox}
|
|
1263 |
\caption{The natural numbers} \label{zf-nat}
|
|
1264 |
\end{figure}
|
|
1265 |
|
317
|
1266 |
Theory \thydx{Nat} defines the natural numbers and mathematical
|
|
1267 |
induction, along with a case analysis operator. The set of natural
|
|
1268 |
numbers, here called {\tt nat}, is known in set theory as the ordinal~$\omega$.
|
|
1269 |
|
|
1270 |
Theory \thydx{Arith} defines primitive recursion and goes on to develop
|
|
1271 |
arithmetic on the natural numbers (Fig.\ts\ref{zf-nat}). It defines
|
|
1272 |
addition, multiplication, subtraction, division, and remainder. Many of
|
|
1273 |
their properties are proved: commutative, associative and distributive
|
|
1274 |
laws, identity and cancellation laws, etc. The most interesting result is
|
|
1275 |
perhaps the theorem $a \bmod b + (a/b)\times b = a$. Division and
|
|
1276 |
remainder are defined by repeated subtraction, which requires well-founded
|
|
1277 |
rather than primitive recursion; the termination argument relies on the
|
|
1278 |
divisor's being non-zero.
|
|
1279 |
|
|
1280 |
Theory \thydx{Univ} defines a `universe' ${\tt univ}(A)$, for
|
|
1281 |
constructing datatypes such as trees. This set contains $A$ and the
|
|
1282 |
natural numbers. Vitally, it is closed under finite products: ${\tt
|
|
1283 |
univ}(A)\times{\tt univ}(A)\subseteq{\tt univ}(A)$. This theory also
|
|
1284 |
defines the cumulative hierarchy of axiomatic set theory, which
|
|
1285 |
traditionally is written $V@\alpha$ for an ordinal~$\alpha$. The
|
|
1286 |
`universe' is a simple generalization of~$V@\omega$.
|
|
1287 |
|
|
1288 |
Theory \thydx{QUniv} defines a `universe' ${\tt quniv}(A)$, for
|
|
1289 |
constructing codatatypes such as streams. It is analogous to ${\tt
|
|
1290 |
univ}(A)$ (and is defined in terms of it) but is closed under the
|
|
1291 |
non-standard product and sum.
|
|
1292 |
|
|
1293 |
Figure~\ref{zf-fin} presents the finite set operator; ${\tt Fin}(A)$ is the
|
|
1294 |
set of all finite sets over~$A$. The definition employs Isabelle's
|
|
1295 |
inductive definition package~\cite{paulson-fixedpt}, which proves various
|
|
1296 |
rules automatically. The induction rule shown is stronger than the one
|
343
|
1297 |
proved by the package. See file {\tt ZF/Fin.ML}.
|
317
|
1298 |
|
111
|
1299 |
\begin{figure}
|
|
1300 |
\begin{ttbox}
|
317
|
1301 |
\tdx{Fin_0I} 0 : Fin(A)
|
|
1302 |
\tdx{Fin_consI} [| a: A; b: Fin(A) |] ==> cons(a,b) : Fin(A)
|
111
|
1303 |
|
317
|
1304 |
\tdx{Fin_induct}
|
111
|
1305 |
[| b: Fin(A);
|
|
1306 |
P(0);
|
|
1307 |
!!x y. [| x: A; y: Fin(A); x~:y; P(y) |] ==> P(cons(x,y))
|
|
1308 |
|] ==> P(b)
|
|
1309 |
|
317
|
1310 |
\tdx{Fin_mono} A<=B ==> Fin(A) <= Fin(B)
|
|
1311 |
\tdx{Fin_UnI} [| b: Fin(A); c: Fin(A) |] ==> b Un c : Fin(A)
|
|
1312 |
\tdx{Fin_UnionI} C : Fin(Fin(A)) ==> Union(C) : Fin(A)
|
|
1313 |
\tdx{Fin_subset} [| c<=b; b: Fin(A) |] ==> c: Fin(A)
|
111
|
1314 |
\end{ttbox}
|
|
1315 |
\caption{The finite set operator} \label{zf-fin}
|
|
1316 |
\end{figure}
|
|
1317 |
|
317
|
1318 |
\begin{figure}
|
|
1319 |
\begin{constants}
|
|
1320 |
\cdx{list} & $i\To i$ && lists over some set\\
|
|
1321 |
\cdx{list_case} & $[i, [i,i]\To i, i] \To i$ && conditional for $list(A)$ \\
|
|
1322 |
\cdx{list_rec} & $[i, i, [i,i,i]\To i] \To i$ && recursor for $list(A)$ \\
|
|
1323 |
\cdx{map} & $[i\To i, i] \To i$ & & mapping functional\\
|
|
1324 |
\cdx{length} & $i\To i$ & & length of a list\\
|
|
1325 |
\cdx{rev} & $i\To i$ & & reverse of a list\\
|
|
1326 |
\tt \at & $[i,i]\To i$ & Right 60 & append for lists\\
|
|
1327 |
\cdx{flat} & $i\To i$ & & append of list of lists
|
|
1328 |
\end{constants}
|
|
1329 |
|
|
1330 |
\underscoreon %%because @ is used here
|
104
|
1331 |
\begin{ttbox}
|
317
|
1332 |
\tdx{list_rec_def} list_rec(l,c,h) ==
|
287
|
1333 |
Vrec(l, \%l g.list_case(c, \%x xs. h(x, xs, g`xs), l))
|
104
|
1334 |
|
317
|
1335 |
\tdx{map_def} map(f,l) == list_rec(l, 0, \%x xs r. <f(x), r>)
|
|
1336 |
\tdx{length_def} length(l) == list_rec(l, 0, \%x xs r. succ(r))
|
|
1337 |
\tdx{app_def} xs@ys == list_rec(xs, ys, \%x xs r. <x,r>)
|
|
1338 |
\tdx{rev_def} rev(l) == list_rec(l, 0, \%x xs r. r @ <x,0>)
|
|
1339 |
\tdx{flat_def} flat(ls) == list_rec(ls, 0, \%l ls r. l @ r)
|
104
|
1340 |
|
|
1341 |
|
317
|
1342 |
\tdx{NilI} Nil : list(A)
|
|
1343 |
\tdx{ConsI} [| a: A; l: list(A) |] ==> Cons(a,l) : list(A)
|
|
1344 |
|
|
1345 |
\tdx{List.induct}
|
104
|
1346 |
[| l: list(A);
|
111
|
1347 |
P(Nil);
|
|
1348 |
!!x y. [| x: A; y: list(A); P(y) |] ==> P(Cons(x,y))
|
104
|
1349 |
|] ==> P(l)
|
|
1350 |
|
317
|
1351 |
\tdx{Cons_iff} Cons(a,l)=Cons(a',l') <-> a=a' & l=l'
|
|
1352 |
\tdx{Nil_Cons_iff} ~ Nil=Cons(a,l)
|
104
|
1353 |
|
317
|
1354 |
\tdx{list_mono} A<=B ==> list(A) <= list(B)
|
111
|
1355 |
|
317
|
1356 |
\tdx{list_rec_Nil} list_rec(Nil,c,h) = c
|
|
1357 |
\tdx{list_rec_Cons} list_rec(Cons(a,l), c, h) = h(a, l, list_rec(l,c,h))
|
104
|
1358 |
|
317
|
1359 |
\tdx{map_ident} l: list(A) ==> map(\%u.u, l) = l
|
|
1360 |
\tdx{map_compose} l: list(A) ==> map(h, map(j,l)) = map(\%u.h(j(u)), l)
|
|
1361 |
\tdx{map_app_distrib} xs: list(A) ==> map(h, xs@ys) = map(h,xs) @ map(h,ys)
|
|
1362 |
\tdx{map_type}
|
104
|
1363 |
[| l: list(A); !!x. x: A ==> h(x): B |] ==> map(h,l) : list(B)
|
317
|
1364 |
\tdx{map_flat}
|
104
|
1365 |
ls: list(list(A)) ==> map(h, flat(ls)) = flat(map(map(h),ls))
|
|
1366 |
\end{ttbox}
|
|
1367 |
\caption{Lists} \label{zf-list}
|
|
1368 |
\end{figure}
|
|
1369 |
|
111
|
1370 |
|
|
1371 |
Figure~\ref{zf-list} presents the set of lists over~$A$, ${\tt list}(A)$.
|
|
1372 |
The definition employs Isabelle's datatype package, which defines the
|
|
1373 |
introduction and induction rules automatically, as well as the constructors
|
343
|
1374 |
and case operator (\verb|list_case|). See file {\tt ZF/List.ML}.
|
|
1375 |
The file {\tt ZF/ListFn.thy} proceeds to define structural
|
111
|
1376 |
recursion and the usual list functions.
|
104
|
1377 |
|
|
1378 |
The constructions of the natural numbers and lists make use of a suite of
|
317
|
1379 |
operators for handling recursive function definitions. I have described
|
|
1380 |
the developments in detail elsewhere~\cite{paulson-set-II}. Here is a brief
|
|
1381 |
summary:
|
|
1382 |
\begin{itemize}
|
|
1383 |
\item Theory {\tt Trancl} defines the transitive closure of a relation
|
|
1384 |
(as a least fixedpoint).
|
104
|
1385 |
|
317
|
1386 |
\item Theory {\tt WF} proves the Well-Founded Recursion Theorem, using an
|
|
1387 |
elegant approach of Tobias Nipkow. This theorem permits general
|
|
1388 |
recursive definitions within set theory.
|
|
1389 |
|
|
1390 |
\item Theory {\tt Ord} defines the notions of transitive set and ordinal
|
|
1391 |
number. It derives transfinite induction. A key definition is {\bf
|
|
1392 |
less than}: $i<j$ if and only if $i$ and $j$ are both ordinals and
|
|
1393 |
$i\in j$. As a special case, it includes less than on the natural
|
|
1394 |
numbers.
|
104
|
1395 |
|
317
|
1396 |
\item Theory {\tt Epsilon} derives $\epsilon$-induction and
|
343
|
1397 |
$\epsilon$-recursion, which are generalisations of transfinite
|
|
1398 |
induction and recursion. It also defines \cdx{rank}$(x)$, which is the
|
|
1399 |
least ordinal $\alpha$ such that $x$ is constructed at stage $\alpha$
|
|
1400 |
of the cumulative hierarchy (thus $x\in V@{\alpha+1}$).
|
317
|
1401 |
\end{itemize}
|
|
1402 |
|
104
|
1403 |
|
317
|
1404 |
\section{Simplification rules}
|
|
1405 |
{\ZF} does not merely inherit simplification from \FOL, but modifies it
|
|
1406 |
extensively. File {\tt ZF/simpdata.ML} contains the details.
|
|
1407 |
|
|
1408 |
The extraction of rewrite rules takes set theory primitives into account.
|
|
1409 |
It can strip bounded universal quantifiers from a formula; for example,
|
|
1410 |
${\forall x\in A.f(x)=g(x)}$ yields the conditional rewrite rule $x\in A \Imp
|
|
1411 |
f(x)=g(x)$. Given $a\in\{x\in A.P(x)\}$ it extracts rewrite rules from
|
|
1412 |
$a\in A$ and~$P(a)$. It can also break down $a\in A\int B$ and $a\in A-B$.
|
|
1413 |
|
|
1414 |
The simplification set \ttindexbold{ZF_ss} contains congruence rules for
|
|
1415 |
all the binding operators of {\ZF}\@. It contains all the conversion
|
|
1416 |
rules, such as {\tt fst} and {\tt snd}, as well as the rewrites
|
|
1417 |
shown in Fig.\ts\ref{zf-simpdata}.
|
104
|
1418 |
|
|
1419 |
|
|
1420 |
\begin{figure}
|
|
1421 |
\begin{eqnarray*}
|
111
|
1422 |
a\in \emptyset & \bimp & \bot\\
|
|
1423 |
a \in A \union B & \bimp & a\in A \disj a\in B\\
|
|
1424 |
a \in A \inter B & \bimp & a\in A \conj a\in B\\
|
|
1425 |
a \in A-B & \bimp & a\in A \conj \neg (a\in B)\\
|
104
|
1426 |
\pair{a,b}\in {\tt Sigma}(A,B)
|
111
|
1427 |
& \bimp & a\in A \conj b\in B(a)\\
|
|
1428 |
a \in {\tt Collect}(A,P) & \bimp & a\in A \conj P(a)\\
|
343
|
1429 |
(\forall x \in \emptyset. P(x)) & \bimp & \top\\
|
111
|
1430 |
(\forall x \in A. \top) & \bimp & \top
|
104
|
1431 |
\end{eqnarray*}
|
317
|
1432 |
\caption{Rewrite rules for set theory} \label{zf-simpdata}
|
104
|
1433 |
\end{figure}
|
|
1434 |
|
|
1435 |
|
317
|
1436 |
\section{The examples directory}
|
|
1437 |
The directory {\tt ZF/ex} contains further developments in {\ZF} set
|
|
1438 |
theory. Here is an overview; see the files themselves for more details. I
|
|
1439 |
describe much of this material in other
|
|
1440 |
publications~\cite{paulson-fixedpt,paulson-set-I,paulson-set-II}.
|
|
1441 |
\begin{ttdescription}
|
|
1442 |
\item[ZF/ex/misc.ML] contains miscellaneous examples such as
|
|
1443 |
Cantor's Theorem, the Schr\"oder-Bernstein Theorem and the
|
|
1444 |
`Composition of homomorphisms' challenge~\cite{boyer86}.
|
104
|
1445 |
|
343
|
1446 |
\item[ZF/ex/Ramsey.ML]
|
114
|
1447 |
proves the finite exponent 2 version of Ramsey's Theorem, following Basin
|
|
1448 |
and Kaufmann's presentation~\cite{basin91}.
|
|
1449 |
|
343
|
1450 |
\item[ZF/ex/Equiv.ML]
|
|
1451 |
develops a theory of equivalence classes, not using the Axiom of Choice.
|
114
|
1452 |
|
343
|
1453 |
\item[ZF/ex/Integ.ML]
|
114
|
1454 |
develops a theory of the integers as equivalence classes of pairs of
|
|
1455 |
natural numbers.
|
|
1456 |
|
343
|
1457 |
\item[ZF/ex/Bin.ML]
|
114
|
1458 |
defines a datatype for two's complement binary integers. File
|
343
|
1459 |
{\tt BinFn.ML} then develops rewrite rules for binary
|
114
|
1460 |
arithmetic. For instance, $1359\times {-}2468 = {-}3354012$ takes under
|
|
1461 |
14 seconds.
|
104
|
1462 |
|
343
|
1463 |
\item[ZF/ex/BT.ML]
|
104
|
1464 |
defines the recursive data structure ${\tt bt}(A)$, labelled binary trees.
|
|
1465 |
|
343
|
1466 |
\item[ZF/ex/Term.ML]
|
|
1467 |
and {\tt TermFn.ML} define a recursive data structure for
|
114
|
1468 |
terms and term lists. These are simply finite branching trees.
|
104
|
1469 |
|
343
|
1470 |
\item[ZF/ex/TF.ML]
|
|
1471 |
and {\tt TF_Fn.ML} define primitives for solving mutually
|
114
|
1472 |
recursive equations over sets. It constructs sets of trees and forests
|
|
1473 |
as an example, including induction and recursion rules that handle the
|
|
1474 |
mutual recursion.
|
|
1475 |
|
343
|
1476 |
\item[ZF/ex/Prop.ML]
|
|
1477 |
and {\tt PropLog.ML} proves soundness and completeness of
|
|
1478 |
propositional logic~\cite{paulson-set-II}. This illustrates datatype
|
|
1479 |
definitions, inductive definitions, structural induction and rule induction.
|
114
|
1480 |
|
343
|
1481 |
\item[ZF/ex/ListN.ML]
|
114
|
1482 |
presents the inductive definition of the lists of $n$ elements~\cite{paulin92}.
|
104
|
1483 |
|
343
|
1484 |
\item[ZF/ex/Acc.ML]
|
114
|
1485 |
presents the inductive definition of the accessible part of a
|
|
1486 |
relation~\cite{paulin92}.
|
104
|
1487 |
|
343
|
1488 |
\item[ZF/ex/Comb.ML]
|
287
|
1489 |
presents the datatype definition of combinators. The file
|
343
|
1490 |
{\tt Contract0.ML} defines contraction, while file
|
|
1491 |
{\tt ParContract.ML} defines parallel contraction and
|
114
|
1492 |
proves the Church-Rosser Theorem. This case study follows Camilleri and
|
|
1493 |
Melham~\cite{camilleri92}.
|
|
1494 |
|
343
|
1495 |
\item[ZF/ex/LList.ML]
|
|
1496 |
and {\tt LList_Eq.ML} develop lazy lists and a notion
|
317
|
1497 |
of coinduction for proving equations between them.
|
|
1498 |
\end{ttdescription}
|
104
|
1499 |
|
|
1500 |
|
317
|
1501 |
\section{A proof about powersets}\label{sec:ZF-pow-example}
|
114
|
1502 |
To demonstrate high-level reasoning about subsets, let us prove the
|
|
1503 |
equation ${{\tt Pow}(A)\cap {\tt Pow}(B)}= {\tt Pow}(A\cap B)$. Compared
|
|
1504 |
with first-order logic, set theory involves a maze of rules, and theorems
|
|
1505 |
have many different proofs. Attempting other proofs of the theorem might
|
|
1506 |
be instructive. This proof exploits the lattice properties of
|
|
1507 |
intersection. It also uses the monotonicity of the powerset operation,
|
|
1508 |
from {\tt ZF/mono.ML}:
|
104
|
1509 |
\begin{ttbox}
|
317
|
1510 |
\tdx{Pow_mono} A<=B ==> Pow(A) <= Pow(B)
|
104
|
1511 |
\end{ttbox}
|
|
1512 |
We enter the goal and make the first step, which breaks the equation into
|
317
|
1513 |
two inclusions by extensionality:\index{*equalityI theorem}
|
104
|
1514 |
\begin{ttbox}
|
|
1515 |
goal ZF.thy "Pow(A Int B) = Pow(A) Int Pow(B)";
|
|
1516 |
{\out Level 0}
|
|
1517 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1518 |
{\out 1. Pow(A Int B) = Pow(A) Int Pow(B)}
|
287
|
1519 |
\ttbreak
|
104
|
1520 |
by (resolve_tac [equalityI] 1);
|
|
1521 |
{\out Level 1}
|
|
1522 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1523 |
{\out 1. Pow(A Int B) <= Pow(A) Int Pow(B)}
|
|
1524 |
{\out 2. Pow(A) Int Pow(B) <= Pow(A Int B)}
|
|
1525 |
\end{ttbox}
|
|
1526 |
Both inclusions could be tackled straightforwardly using {\tt subsetI}.
|
|
1527 |
A shorter proof results from noting that intersection forms the greatest
|
317
|
1528 |
lower bound:\index{*Int_greatest theorem}
|
104
|
1529 |
\begin{ttbox}
|
|
1530 |
by (resolve_tac [Int_greatest] 1);
|
|
1531 |
{\out Level 2}
|
|
1532 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1533 |
{\out 1. Pow(A Int B) <= Pow(A)}
|
|
1534 |
{\out 2. Pow(A Int B) <= Pow(B)}
|
|
1535 |
{\out 3. Pow(A) Int Pow(B) <= Pow(A Int B)}
|
|
1536 |
\end{ttbox}
|
|
1537 |
Subgoal~1 follows by applying the monotonicity of {\tt Pow} to $A\inter
|
|
1538 |
B\subseteq A$; subgoal~2 follows similarly:
|
317
|
1539 |
\index{*Int_lower1 theorem}\index{*Int_lower2 theorem}
|
104
|
1540 |
\begin{ttbox}
|
|
1541 |
by (resolve_tac [Int_lower1 RS Pow_mono] 1);
|
|
1542 |
{\out Level 3}
|
|
1543 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1544 |
{\out 1. Pow(A Int B) <= Pow(B)}
|
|
1545 |
{\out 2. Pow(A) Int Pow(B) <= Pow(A Int B)}
|
287
|
1546 |
\ttbreak
|
104
|
1547 |
by (resolve_tac [Int_lower2 RS Pow_mono] 1);
|
|
1548 |
{\out Level 4}
|
|
1549 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1550 |
{\out 1. Pow(A) Int Pow(B) <= Pow(A Int B)}
|
|
1551 |
\end{ttbox}
|
|
1552 |
We are left with the opposite inclusion, which we tackle in the
|
317
|
1553 |
straightforward way:\index{*subsetI theorem}
|
104
|
1554 |
\begin{ttbox}
|
|
1555 |
by (resolve_tac [subsetI] 1);
|
|
1556 |
{\out Level 5}
|
|
1557 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1558 |
{\out 1. !!x. x : Pow(A) Int Pow(B) ==> x : Pow(A Int B)}
|
|
1559 |
\end{ttbox}
|
|
1560 |
The subgoal is to show $x\in {\tt Pow}(A\cap B)$ assuming $x\in{\tt
|
287
|
1561 |
Pow}(A)\cap {\tt Pow}(B)$; eliminating this assumption produces two
|
317
|
1562 |
subgoals. The rule \tdx{IntE} treats the intersection like a conjunction
|
287
|
1563 |
instead of unfolding its definition.
|
104
|
1564 |
\begin{ttbox}
|
|
1565 |
by (eresolve_tac [IntE] 1);
|
|
1566 |
{\out Level 6}
|
|
1567 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1568 |
{\out 1. !!x. [| x : Pow(A); x : Pow(B) |] ==> x : Pow(A Int B)}
|
|
1569 |
\end{ttbox}
|
|
1570 |
The next step replaces the {\tt Pow} by the subset
|
317
|
1571 |
relation~($\subseteq$).\index{*PowI theorem}
|
104
|
1572 |
\begin{ttbox}
|
|
1573 |
by (resolve_tac [PowI] 1);
|
|
1574 |
{\out Level 7}
|
|
1575 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1576 |
{\out 1. !!x. [| x : Pow(A); x : Pow(B) |] ==> x <= A Int B}
|
|
1577 |
\end{ttbox}
|
287
|
1578 |
We perform the same replacement in the assumptions. This is a good
|
317
|
1579 |
demonstration of the tactic \ttindex{dresolve_tac}:\index{*PowD theorem}
|
104
|
1580 |
\begin{ttbox}
|
|
1581 |
by (REPEAT (dresolve_tac [PowD] 1));
|
|
1582 |
{\out Level 8}
|
|
1583 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1584 |
{\out 1. !!x. [| x <= A; x <= B |] ==> x <= A Int B}
|
|
1585 |
\end{ttbox}
|
287
|
1586 |
The assumptions are that $x$ is a lower bound of both $A$ and~$B$, but
|
317
|
1587 |
$A\inter B$ is the greatest lower bound:\index{*Int_greatest theorem}
|
104
|
1588 |
\begin{ttbox}
|
|
1589 |
by (resolve_tac [Int_greatest] 1);
|
|
1590 |
{\out Level 9}
|
|
1591 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1592 |
{\out 1. !!x. [| x <= A; x <= B |] ==> x <= A}
|
|
1593 |
{\out 2. !!x. [| x <= A; x <= B |] ==> x <= B}
|
287
|
1594 |
\end{ttbox}
|
|
1595 |
To conclude the proof, we clear up the trivial subgoals:
|
|
1596 |
\begin{ttbox}
|
104
|
1597 |
by (REPEAT (assume_tac 1));
|
|
1598 |
{\out Level 10}
|
|
1599 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1600 |
{\out No subgoals!}
|
|
1601 |
\end{ttbox}
|
287
|
1602 |
\medskip
|
104
|
1603 |
We could have performed this proof in one step by applying
|
287
|
1604 |
\ttindex{fast_tac} with the classical rule set \ttindex{ZF_cs}. Let us
|
|
1605 |
go back to the start:
|
104
|
1606 |
\begin{ttbox}
|
|
1607 |
choplev 0;
|
|
1608 |
{\out Level 0}
|
|
1609 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1610 |
{\out 1. Pow(A Int B) = Pow(A) Int Pow(B)}
|
287
|
1611 |
\end{ttbox}
|
317
|
1612 |
We must add \tdx{equalityI} to {\tt ZF_cs} as an introduction rule.
|
287
|
1613 |
Extensionality is not used by default because many equalities can be proved
|
|
1614 |
by rewriting.
|
|
1615 |
\begin{ttbox}
|
104
|
1616 |
by (fast_tac (ZF_cs addIs [equalityI]) 1);
|
|
1617 |
{\out Level 1}
|
|
1618 |
{\out Pow(A Int B) = Pow(A) Int Pow(B)}
|
|
1619 |
{\out No subgoals!}
|
|
1620 |
\end{ttbox}
|
287
|
1621 |
In the past this was regarded as a difficult proof, as indeed it is if all
|
|
1622 |
the symbols are replaced by their definitions.
|
|
1623 |
\goodbreak
|
104
|
1624 |
|
|
1625 |
\section{Monotonicity of the union operator}
|
|
1626 |
For another example, we prove that general union is monotonic:
|
|
1627 |
${C\subseteq D}$ implies $\bigcup(C)\subseteq \bigcup(D)$. To begin, we
|
317
|
1628 |
tackle the inclusion using \tdx{subsetI}:
|
104
|
1629 |
\begin{ttbox}
|
|
1630 |
val [prem] = goal ZF.thy "C<=D ==> Union(C) <= Union(D)";
|
|
1631 |
{\out Level 0}
|
|
1632 |
{\out Union(C) <= Union(D)}
|
|
1633 |
{\out 1. Union(C) <= Union(D)}
|
114
|
1634 |
{\out val prem = "C <= D [C <= D]" : thm}
|
|
1635 |
\ttbreak
|
104
|
1636 |
by (resolve_tac [subsetI] 1);
|
|
1637 |
{\out Level 1}
|
|
1638 |
{\out Union(C) <= Union(D)}
|
|
1639 |
{\out 1. !!x. x : Union(C) ==> x : Union(D)}
|
|
1640 |
\end{ttbox}
|
|
1641 |
Big union is like an existential quantifier --- the occurrence in the
|
|
1642 |
assumptions must be eliminated early, since it creates parameters.
|
317
|
1643 |
\index{*UnionE theorem}
|
104
|
1644 |
\begin{ttbox}
|
|
1645 |
by (eresolve_tac [UnionE] 1);
|
|
1646 |
{\out Level 2}
|
|
1647 |
{\out Union(C) <= Union(D)}
|
|
1648 |
{\out 1. !!x B. [| x : B; B : C |] ==> x : Union(D)}
|
|
1649 |
\end{ttbox}
|
317
|
1650 |
Now we may apply \tdx{UnionI}, which creates an unknown involving the
|
104
|
1651 |
parameters. To show $x\in \bigcup(D)$ it suffices to show that $x$ belongs
|
|
1652 |
to some element, say~$\Var{B2}(x,B)$, of~$D$.
|
|
1653 |
\begin{ttbox}
|
|
1654 |
by (resolve_tac [UnionI] 1);
|
|
1655 |
{\out Level 3}
|
|
1656 |
{\out Union(C) <= Union(D)}
|
|
1657 |
{\out 1. !!x B. [| x : B; B : C |] ==> ?B2(x,B) : D}
|
|
1658 |
{\out 2. !!x B. [| x : B; B : C |] ==> x : ?B2(x,B)}
|
|
1659 |
\end{ttbox}
|
317
|
1660 |
Combining \tdx{subsetD} with the premise $C\subseteq D$ yields
|
104
|
1661 |
$\Var{a}\in C \Imp \Var{a}\in D$, which reduces subgoal~1:
|
|
1662 |
\begin{ttbox}
|
|
1663 |
by (resolve_tac [prem RS subsetD] 1);
|
|
1664 |
{\out Level 4}
|
|
1665 |
{\out Union(C) <= Union(D)}
|
|
1666 |
{\out 1. !!x B. [| x : B; B : C |] ==> ?B2(x,B) : C}
|
|
1667 |
{\out 2. !!x B. [| x : B; B : C |] ==> x : ?B2(x,B)}
|
|
1668 |
\end{ttbox}
|
|
1669 |
The rest is routine. Note how~$\Var{B2}(x,B)$ is instantiated.
|
|
1670 |
\begin{ttbox}
|
|
1671 |
by (assume_tac 1);
|
|
1672 |
{\out Level 5}
|
|
1673 |
{\out Union(C) <= Union(D)}
|
|
1674 |
{\out 1. !!x B. [| x : B; B : C |] ==> x : B}
|
|
1675 |
by (assume_tac 1);
|
|
1676 |
{\out Level 6}
|
|
1677 |
{\out Union(C) <= Union(D)}
|
|
1678 |
{\out No subgoals!}
|
|
1679 |
\end{ttbox}
|
|
1680 |
Again, \ttindex{fast_tac} with \ttindex{ZF_cs} can do this proof in one
|
|
1681 |
step, provided we somehow supply it with~{\tt prem}. We can either add
|
|
1682 |
this premise to the assumptions using \ttindex{cut_facts_tac}, or add
|
|
1683 |
\hbox{\tt prem RS subsetD} to \ttindex{ZF_cs} as an introduction rule.
|
|
1684 |
|
317
|
1685 |
The file {\tt ZF/equalities.ML} has many similar proofs. Reasoning about
|
343
|
1686 |
general intersection can be difficult because of its anomalous behaviour on
|
317
|
1687 |
the empty set. However, \ttindex{fast_tac} copes well with these. Here is
|
|
1688 |
a typical example, borrowed from Devlin~\cite[page 12]{devlin79}:
|
104
|
1689 |
\begin{ttbox}
|
|
1690 |
a:C ==> (INT x:C. A(x) Int B(x)) = (INT x:C.A(x)) Int (INT x:C.B(x))
|
|
1691 |
\end{ttbox}
|
|
1692 |
In traditional notation this is
|
317
|
1693 |
\[ a\in C \,\Imp\, \inter@{x\in C} \Bigl(A(x) \int B(x)\Bigr) =
|
|
1694 |
\Bigl(\inter@{x\in C} A(x)\Bigr) \int
|
|
1695 |
\Bigl(\inter@{x\in C} B(x)\Bigr) \]
|
104
|
1696 |
|
|
1697 |
\section{Low-level reasoning about functions}
|
|
1698 |
The derived rules {\tt lamI}, {\tt lamE}, {\tt lam_type}, {\tt beta}
|
|
1699 |
and {\tt eta} support reasoning about functions in a
|
|
1700 |
$\lambda$-calculus style. This is generally easier than regarding
|
|
1701 |
functions as sets of ordered pairs. But sometimes we must look at the
|
|
1702 |
underlying representation, as in the following proof
|
317
|
1703 |
of~\tdx{fun_disjoint_apply1}. This states that if $f$ and~$g$ are
|
104
|
1704 |
functions with disjoint domains~$A$ and~$C$, and if $a\in A$, then
|
287
|
1705 |
$(f\un g)`a = f`a$:
|
104
|
1706 |
\begin{ttbox}
|
|
1707 |
val prems = goal ZF.thy
|
|
1708 |
"[| a:A; f: A->B; g: C->D; A Int C = 0 |] ==> \ttback
|
|
1709 |
\ttback (f Un g)`a = f`a";
|
|
1710 |
{\out Level 0}
|
|
1711 |
{\out (f Un g) ` a = f ` a}
|
|
1712 |
{\out 1. (f Un g) ` a = f ` a}
|
287
|
1713 |
\end{ttbox}
|
|
1714 |
Isabelle has produced the output above; the \ML{} top-level now echoes the
|
|
1715 |
binding of {\tt prems}.
|
|
1716 |
\begin{ttbox}
|
114
|
1717 |
{\out val prems = ["a : A [a : A]",}
|
|
1718 |
{\out "f : A -> B [f : A -> B]",}
|
|
1719 |
{\out "g : C -> D [g : C -> D]",}
|
|
1720 |
{\out "A Int C = 0 [A Int C = 0]"] : thm list}
|
104
|
1721 |
\end{ttbox}
|
317
|
1722 |
Using \tdx{apply_equality}, we reduce the equality to reasoning about
|
287
|
1723 |
ordered pairs. The second subgoal is to verify that $f\un g$ is a function.
|
104
|
1724 |
\begin{ttbox}
|
|
1725 |
by (resolve_tac [apply_equality] 1);
|
|
1726 |
{\out Level 1}
|
|
1727 |
{\out (f Un g) ` a = f ` a}
|
|
1728 |
{\out 1. <a,f ` a> : f Un g}
|
|
1729 |
{\out 2. f Un g : (PROD x:?A. ?B(x))}
|
|
1730 |
\end{ttbox}
|
317
|
1731 |
We must show that the pair belongs to~$f$ or~$g$; by~\tdx{UnI1} we
|
104
|
1732 |
choose~$f$:
|
|
1733 |
\begin{ttbox}
|
|
1734 |
by (resolve_tac [UnI1] 1);
|
|
1735 |
{\out Level 2}
|
|
1736 |
{\out (f Un g) ` a = f ` a}
|
|
1737 |
{\out 1. <a,f ` a> : f}
|
|
1738 |
{\out 2. f Un g : (PROD x:?A. ?B(x))}
|
|
1739 |
\end{ttbox}
|
317
|
1740 |
To show $\pair{a,f`a}\in f$ we use \tdx{apply_Pair}, which is
|
|
1741 |
essentially the converse of \tdx{apply_equality}:
|
104
|
1742 |
\begin{ttbox}
|
|
1743 |
by (resolve_tac [apply_Pair] 1);
|
|
1744 |
{\out Level 3}
|
|
1745 |
{\out (f Un g) ` a = f ` a}
|
|
1746 |
{\out 1. f : (PROD x:?A2. ?B2(x))}
|
|
1747 |
{\out 2. a : ?A2}
|
|
1748 |
{\out 3. f Un g : (PROD x:?A. ?B(x))}
|
|
1749 |
\end{ttbox}
|
|
1750 |
Using the premises $f\in A\to B$ and $a\in A$, we solve the two subgoals
|
317
|
1751 |
from \tdx{apply_Pair}. Recall that a $\Pi$-set is merely a generalized
|
104
|
1752 |
function space, and observe that~{\tt?A2} is instantiated to~{\tt A}.
|
|
1753 |
\begin{ttbox}
|
|
1754 |
by (resolve_tac prems 1);
|
|
1755 |
{\out Level 4}
|
|
1756 |
{\out (f Un g) ` a = f ` a}
|
|
1757 |
{\out 1. a : A}
|
|
1758 |
{\out 2. f Un g : (PROD x:?A. ?B(x))}
|
|
1759 |
by (resolve_tac prems 1);
|
|
1760 |
{\out Level 5}
|
|
1761 |
{\out (f Un g) ` a = f ` a}
|
|
1762 |
{\out 1. f Un g : (PROD x:?A. ?B(x))}
|
|
1763 |
\end{ttbox}
|
|
1764 |
To construct functions of the form $f\union g$, we apply
|
317
|
1765 |
\tdx{fun_disjoint_Un}:
|
104
|
1766 |
\begin{ttbox}
|
|
1767 |
by (resolve_tac [fun_disjoint_Un] 1);
|
|
1768 |
{\out Level 6}
|
|
1769 |
{\out (f Un g) ` a = f ` a}
|
|
1770 |
{\out 1. f : ?A3 -> ?B3}
|
|
1771 |
{\out 2. g : ?C3 -> ?D3}
|
|
1772 |
{\out 3. ?A3 Int ?C3 = 0}
|
|
1773 |
\end{ttbox}
|
|
1774 |
The remaining subgoals are instances of the premises. Again, observe how
|
|
1775 |
unknowns are instantiated:
|
|
1776 |
\begin{ttbox}
|
|
1777 |
by (resolve_tac prems 1);
|
|
1778 |
{\out Level 7}
|
|
1779 |
{\out (f Un g) ` a = f ` a}
|
|
1780 |
{\out 1. g : ?C3 -> ?D3}
|
|
1781 |
{\out 2. A Int ?C3 = 0}
|
|
1782 |
by (resolve_tac prems 1);
|
|
1783 |
{\out Level 8}
|
|
1784 |
{\out (f Un g) ` a = f ` a}
|
|
1785 |
{\out 1. A Int C = 0}
|
|
1786 |
by (resolve_tac prems 1);
|
|
1787 |
{\out Level 9}
|
|
1788 |
{\out (f Un g) ` a = f ` a}
|
|
1789 |
{\out No subgoals!}
|
|
1790 |
\end{ttbox}
|
343
|
1791 |
See the files {\tt ZF/func.ML} and {\tt ZF/WF.ML} for more
|
104
|
1792 |
examples of reasoning about functions.
|
317
|
1793 |
|
|
1794 |
\index{set theory|)}
|