doc-src/Logics/ZF.tex
changeset 5151 1e944fe5ce96
parent 4877 7a046198610e
equal deleted inserted replaced
5150:6e2e9b92c301 5151:1e944fe5ce96
   193   \ttlbrace$a@1$, $\ldots$, $a@n$\ttrbrace  &  cons($a@1$,$\ldots$,cons($a@n$,0)) &
   193   \ttlbrace$a@1$, $\ldots$, $a@n$\ttrbrace  &  cons($a@1$,$\ldots$,cons($a@n$,0)) &
   194         \rm finite set \\
   194         \rm finite set \\
   195   <$a@1$, $\ldots$, $a@{n-1}$, $a@n$> & 
   195   <$a@1$, $\ldots$, $a@{n-1}$, $a@n$> & 
   196         Pair($a@1$,\ldots,Pair($a@{n-1}$,$a@n$)\ldots) &
   196         Pair($a@1$,\ldots,Pair($a@{n-1}$,$a@n$)\ldots) &
   197         \rm ordered $n$-tuple \\
   197         \rm ordered $n$-tuple \\
   198   \ttlbrace$x$:$A . P[x]$\ttrbrace    &  Collect($A$,$\lambda x.P[x]$) &
   198   \ttlbrace$x$:$A . P[x]$\ttrbrace    &  Collect($A$,$\lambda x. P[x]$) &
   199         \rm separation \\
   199         \rm separation \\
   200   \ttlbrace$y . x$:$A$, $Q[x,y]$\ttrbrace  &  Replace($A$,$\lambda x\,y.Q[x,y]$) &
   200   \ttlbrace$y . x$:$A$, $Q[x,y]$\ttrbrace  &  Replace($A$,$\lambda x\,y. Q[x,y]$) &
   201         \rm replacement \\
   201         \rm replacement \\
   202   \ttlbrace$b[x] . x$:$A$\ttrbrace  &  RepFun($A$,$\lambda x.b[x]$) &
   202   \ttlbrace$b[x] . x$:$A$\ttrbrace  &  RepFun($A$,$\lambda x. b[x]$) &
   203         \rm functional replacement \\
   203         \rm functional replacement \\
   204   \sdx{INT} $x$:$A . B[x]$      & Inter(\ttlbrace$B[x] . x$:$A$\ttrbrace) &
   204   \sdx{INT} $x$:$A . B[x]$      & Inter(\ttlbrace$B[x] . x$:$A$\ttrbrace) &
   205         \rm general intersection \\
   205         \rm general intersection \\
   206   \sdx{UN}  $x$:$A . B[x]$      & Union(\ttlbrace$B[x] . x$:$A$\ttrbrace) &
   206   \sdx{UN}  $x$:$A . B[x]$      & Union(\ttlbrace$B[x] . x$:$A$\ttrbrace) &
   207         \rm general union \\
   207         \rm general union \\
   208   \sdx{PROD} $x$:$A . B[x]$     & Pi($A$,$\lambda x.B[x]$) & 
   208   \sdx{PROD} $x$:$A . B[x]$     & Pi($A$,$\lambda x. B[x]$) & 
   209         \rm general product \\
   209         \rm general product \\
   210   \sdx{SUM}  $x$:$A . B[x]$     & Sigma($A$,$\lambda x.B[x]$) & 
   210   \sdx{SUM}  $x$:$A . B[x]$     & Sigma($A$,$\lambda x. B[x]$) & 
   211         \rm general sum \\
   211         \rm general sum \\
   212   $A$ -> $B$            & Pi($A$,$\lambda x.B$) & 
   212   $A$ -> $B$            & Pi($A$,$\lambda x. B$) & 
   213         \rm function space \\
   213         \rm function space \\
   214   $A$ * $B$             & Sigma($A$,$\lambda x.B$) & 
   214   $A$ * $B$             & Sigma($A$,$\lambda x. B$) & 
   215         \rm binary product \\
   215         \rm binary product \\
   216   \sdx{THE}  $x . P[x]$ & The($\lambda x.P[x]$) & 
   216   \sdx{THE}  $x . P[x]$ & The($\lambda x. P[x]$) & 
   217         \rm definite description \\
   217         \rm definite description \\
   218   \sdx{lam}  $x$:$A . b[x]$     & Lambda($A$,$\lambda x.b[x]$) & 
   218   \sdx{lam}  $x$:$A . b[x]$     & Lambda($A$,$\lambda x. b[x]$) & 
   219         \rm $\lambda$-abstraction\\[1ex]
   219         \rm $\lambda$-abstraction\\[1ex]
   220   \sdx{ALL} $x$:$A . P[x]$      & Ball($A$,$\lambda x.P[x]$) & 
   220   \sdx{ALL} $x$:$A . P[x]$      & Ball($A$,$\lambda x. P[x]$) & 
   221         \rm bounded $\forall$ \\
   221         \rm bounded $\forall$ \\
   222   \sdx{EX}  $x$:$A . P[x]$      & Bex($A$,$\lambda x.P[x]$) & 
   222   \sdx{EX}  $x$:$A . P[x]$      & Bex($A$,$\lambda x. P[x]$) & 
   223         \rm bounded $\exists$
   223         \rm bounded $\exists$
   224 \end{tabular}
   224 \end{tabular}
   225 \end{center}
   225 \end{center}
   226 \caption{Translations for {\ZF}} \label{zf-trans}
   226 \caption{Translations for {\ZF}} \label{zf-trans}
   227 \end{figure} 
   227 \end{figure} 
   276 
   276 
   277 
   277 
   278 \section{Binding operators}
   278 \section{Binding operators}
   279 The constant \cdx{Collect} constructs sets by the principle of {\bf
   279 The constant \cdx{Collect} constructs sets by the principle of {\bf
   280   separation}.  The syntax for separation is
   280   separation}.  The syntax for separation is
   281 \hbox{\tt\ttlbrace$x$:$A$.$P[x]$\ttrbrace}, where $P[x]$ is a formula
   281 \hbox{\tt\ttlbrace$x$:$A$. $P[x]$\ttrbrace}, where $P[x]$ is a formula
   282 that may contain free occurrences of~$x$.  It abbreviates the set {\tt
   282 that may contain free occurrences of~$x$.  It abbreviates the set {\tt
   283   Collect($A$,$\lambda x.P[x]$)}, which consists of all $x\in A$ that
   283   Collect($A$,$\lambda x. P[x]$)}, which consists of all $x\in A$ that
   284 satisfy~$P[x]$.  Note that \texttt{Collect} is an unfortunate choice of
   284 satisfy~$P[x]$.  Note that \texttt{Collect} is an unfortunate choice of
   285 name: some set theories adopt a set-formation principle, related to
   285 name: some set theories adopt a set-formation principle, related to
   286 replacement, called collection.
   286 replacement, called collection.
   287 
   287 
   288 The constant \cdx{Replace} constructs sets by the principle of {\bf
   288 The constant \cdx{Replace} constructs sets by the principle of {\bf
   289   replacement}.  The syntax
   289   replacement}.  The syntax
   290 \hbox{\tt\ttlbrace$y$.$x$:$A$,$Q[x,y]$\ttrbrace} denotes the set {\tt
   290 \hbox{\tt\ttlbrace$y$. $x$:$A$,$Q[x,y]$\ttrbrace} denotes the set {\tt
   291   Replace($A$,$\lambda x\,y.Q[x,y]$)}, which consists of all~$y$ such
   291   Replace($A$,$\lambda x\,y. Q[x,y]$)}, which consists of all~$y$ such
   292 that there exists $x\in A$ satisfying~$Q[x,y]$.  The Replacement Axiom
   292 that there exists $x\in A$ satisfying~$Q[x,y]$.  The Replacement Axiom
   293 has the condition that $Q$ must be single-valued over~$A$: for
   293 has the condition that $Q$ must be single-valued over~$A$: for
   294 all~$x\in A$ there exists at most one $y$ satisfying~$Q[x,y]$.  A
   294 all~$x\in A$ there exists at most one $y$ satisfying~$Q[x,y]$.  A
   295 single-valued binary predicate is also called a {\bf class function}.
   295 single-valued binary predicate is also called a {\bf class function}.
   296 
   296 
   297 The constant \cdx{RepFun} expresses a special case of replacement,
   297 The constant \cdx{RepFun} expresses a special case of replacement,
   298 where $Q[x,y]$ has the form $y=b[x]$.  Such a $Q$ is trivially
   298 where $Q[x,y]$ has the form $y=b[x]$.  Such a $Q$ is trivially
   299 single-valued, since it is just the graph of the meta-level
   299 single-valued, since it is just the graph of the meta-level
   300 function~$\lambda x.b[x]$.  The resulting set consists of all $b[x]$
   300 function~$\lambda x. b[x]$.  The resulting set consists of all $b[x]$
   301 for~$x\in A$.  This is analogous to the \ML{} functional \texttt{map},
   301 for~$x\in A$.  This is analogous to the \ML{} functional \texttt{map},
   302 since it applies a function to every element of a set.  The syntax is
   302 since it applies a function to every element of a set.  The syntax is
   303 \hbox{\tt\ttlbrace$b[x]$.$x$:$A$\ttrbrace}, which expands to {\tt
   303 \hbox{\tt\ttlbrace$b[x]$. $x$:$A$\ttrbrace}, which expands to {\tt
   304   RepFun($A$,$\lambda x.b[x]$)}.
   304   RepFun($A$,$\lambda x. b[x]$)}.
   305 
   305 
   306 \index{*INT symbol}\index{*UN symbol} 
   306 \index{*INT symbol}\index{*UN symbol} 
   307 General unions and intersections of indexed
   307 General unions and intersections of indexed
   308 families of sets, namely $\bigcup@{x\in A}B[x]$ and $\bigcap@{x\in A}B[x]$,
   308 families of sets, namely $\bigcup@{x\in A}B[x]$ and $\bigcap@{x\in A}B[x]$,
   309 are written \hbox{\tt UN $x$:$A$.$B[x]$} and \hbox{\tt INT $x$:$A$.$B[x]$}.
   309 are written \hbox{\tt UN $x$:$A$. $B[x]$} and \hbox{\tt INT $x$:$A$. $B[x]$}.
   310 Their meaning is expressed using \texttt{RepFun} as
   310 Their meaning is expressed using \texttt{RepFun} as
   311 \[
   311 \[
   312 \bigcup(\{B[x]. x\in A\}) \qquad\hbox{and}\qquad 
   312 \bigcup(\{B[x]. x\in A\}) \qquad\hbox{and}\qquad 
   313 \bigcap(\{B[x]. x\in A\}). 
   313 \bigcap(\{B[x]. x\in A\}). 
   314 \]
   314 \]
   317 have as special cases $A\times B$ and $A\to B$, where $B$ is simply a set.
   317 have as special cases $A\times B$ and $A\to B$, where $B$ is simply a set.
   318 This is similar to the situation in Constructive Type Theory (set theory
   318 This is similar to the situation in Constructive Type Theory (set theory
   319 has `dependent sets') and calls for similar syntactic conventions.  The
   319 has `dependent sets') and calls for similar syntactic conventions.  The
   320 constants~\cdx{Sigma} and~\cdx{Pi} construct general sums and
   320 constants~\cdx{Sigma} and~\cdx{Pi} construct general sums and
   321 products.  Instead of \texttt{Sigma($A$,$B$)} and \texttt{Pi($A$,$B$)} we may write
   321 products.  Instead of \texttt{Sigma($A$,$B$)} and \texttt{Pi($A$,$B$)} we may write
   322 \hbox{\tt SUM $x$:$A$.$B[x]$} and \hbox{\tt PROD $x$:$A$.$B[x]$}.  
   322 \hbox{\tt SUM $x$:$A$. $B[x]$} and \hbox{\tt PROD $x$:$A$. $B[x]$}.  
   323 \index{*SUM symbol}\index{*PROD symbol}%
   323 \index{*SUM symbol}\index{*PROD symbol}%
   324 The special cases as \hbox{\tt$A$*$B$} and \hbox{\tt$A$->$B$} abbreviate
   324 The special cases as \hbox{\tt$A$*$B$} and \hbox{\tt$A$->$B$} abbreviate
   325 general sums and products over a constant family.\footnote{Unlike normal
   325 general sums and products over a constant family.\footnote{Unlike normal
   326 infix operators, {\tt*} and {\tt->} merely define abbreviations; there are
   326 infix operators, {\tt*} and {\tt->} merely define abbreviations; there are
   327 no constants~{\tt op~*} and~\hbox{\tt op~->}.} Isabelle accepts these
   327 no constants~{\tt op~*} and~\hbox{\tt op~->}.} Isabelle accepts these
   329 
   329 
   330 \index{*THE symbol} 
   330 \index{*THE symbol} 
   331 As mentioned above, whenever the axioms assert the existence and uniqueness
   331 As mentioned above, whenever the axioms assert the existence and uniqueness
   332 of a set, Isabelle's set theory declares a constant for that set.  These
   332 of a set, Isabelle's set theory declares a constant for that set.  These
   333 constants can express the {\bf definite description} operator~$\iota
   333 constants can express the {\bf definite description} operator~$\iota
   334 x.P[x]$, which stands for the unique~$a$ satisfying~$P[a]$, if such exists.
   334 x. P[x]$, which stands for the unique~$a$ satisfying~$P[a]$, if such exists.
   335 Since all terms in {\ZF} denote something, a description is always
   335 Since all terms in {\ZF} denote something, a description is always
   336 meaningful, but we do not know its value unless $P[x]$ defines it uniquely.
   336 meaningful, but we do not know its value unless $P[x]$ defines it uniquely.
   337 Using the constant~\cdx{The}, we may write descriptions as {\tt
   337 Using the constant~\cdx{The}, we may write descriptions as {\tt
   338   The($\lambda x.P[x]$)} or use the syntax \hbox{\tt THE $x$.$P[x]$}.
   338   The($\lambda x. P[x]$)} or use the syntax \hbox{\tt THE $x$. $P[x]$}.
   339 
   339 
   340 \index{*lam symbol}
   340 \index{*lam symbol}
   341 Function sets may be written in $\lambda$-notation; $\lambda x\in A.b[x]$
   341 Function sets may be written in $\lambda$-notation; $\lambda x\in A. b[x]$
   342 stands for the set of all pairs $\pair{x,b[x]}$ for $x\in A$.  In order for
   342 stands for the set of all pairs $\pair{x,b[x]}$ for $x\in A$.  In order for
   343 this to be a set, the function's domain~$A$ must be given.  Using the
   343 this to be a set, the function's domain~$A$ must be given.  Using the
   344 constant~\cdx{Lambda}, we may express function sets as {\tt
   344 constant~\cdx{Lambda}, we may express function sets as {\tt
   345 Lambda($A$,$\lambda x.b[x]$)} or use the syntax \hbox{\tt lam $x$:$A$.$b[x]$}.
   345 Lambda($A$,$\lambda x. b[x]$)} or use the syntax \hbox{\tt lam $x$:$A$. $b[x]$}.
   346 
   346 
   347 Isabelle's set theory defines two {\bf bounded quantifiers}:
   347 Isabelle's set theory defines two {\bf bounded quantifiers}:
   348 \begin{eqnarray*}
   348 \begin{eqnarray*}
   349    \forall x\in A.P[x] &\hbox{abbreviates}& \forall x. x\in A\imp P[x] \\
   349    \forall x\in A. P[x] &\hbox{abbreviates}& \forall x. x\in A\imp P[x] \\
   350    \exists x\in A.P[x] &\hbox{abbreviates}& \exists x. x\in A\conj P[x]
   350    \exists x\in A. P[x] &\hbox{abbreviates}& \exists x. x\in A\conj P[x]
   351 \end{eqnarray*}
   351 \end{eqnarray*}
   352 The constants~\cdx{Ball} and~\cdx{Bex} are defined
   352 The constants~\cdx{Ball} and~\cdx{Bex} are defined
   353 accordingly.  Instead of \texttt{Ball($A$,$P$)} and \texttt{Bex($A$,$P$)} we may
   353 accordingly.  Instead of \texttt{Ball($A$,$P$)} and \texttt{Bex($A$,$P$)} we may
   354 write
   354 write
   355 \hbox{\tt ALL $x$:$A$.$P[x]$} and \hbox{\tt EX $x$:$A$.$P[x]$}.
   355 \hbox{\tt ALL $x$:$A$. $P[x]$} and \hbox{\tt EX $x$:$A$. $P[x]$}.
   356 
   356 
   357 
   357 
   358 %%%% ZF.thy
   358 %%%% ZF.thy
   359 
   359 
   360 \begin{figure}
   360 \begin{figure}
   374 \tdx{replacement}        (ALL x:A. ALL y z. P(x,y) & P(x,z) --> y=z) ==>
   374 \tdx{replacement}        (ALL x:A. ALL y z. P(x,y) & P(x,z) --> y=z) ==>
   375                    b : PrimReplace(A,P) <-> (EX x:A. P(x,b))
   375                    b : PrimReplace(A,P) <-> (EX x:A. P(x,b))
   376 \subcaption{The Zermelo-Fraenkel Axioms}
   376 \subcaption{The Zermelo-Fraenkel Axioms}
   377 
   377 
   378 \tdx{Replace_def}  Replace(A,P) == 
   378 \tdx{Replace_def}  Replace(A,P) == 
   379                    PrimReplace(A, \%x y. (EX!z.P(x,z)) & P(x,y))
   379                    PrimReplace(A, \%x y. (EX!z. P(x,z)) & P(x,y))
   380 \tdx{RepFun_def}   RepFun(A,f)  == {\ttlbrace}y . x:A, y=f(x)\ttrbrace
   380 \tdx{RepFun_def}   RepFun(A,f)  == {\ttlbrace}y . x:A, y=f(x)\ttrbrace
   381 \tdx{the_def}      The(P)       == Union({\ttlbrace}y . x:{\ttlbrace}0{\ttrbrace}, P(y){\ttrbrace})
   381 \tdx{the_def}      The(P)       == Union({\ttlbrace}y . x:{\ttlbrace}0{\ttrbrace}, P(y){\ttrbrace})
   382 \tdx{if_def}       if(P,a,b)    == THE z. P & z=a | ~P & z=b
   382 \tdx{if_def}       if(P,a,b)    == THE z. P & z=a | ~P & z=b
   383 \tdx{Collect_def}  Collect(A,P) == {\ttlbrace}y . x:A, x=y & P(x){\ttrbrace}
   383 \tdx{Collect_def}  Collect(A,P) == {\ttlbrace}y . x:A, x=y & P(x){\ttrbrace}
   384 \tdx{Upair_def}    Upair(a,b)   == 
   384 \tdx{Upair_def}    Upair(a,b)   == 
   402 \tdx{infinity}     0:Inf & (ALL y:Inf. succ(y): Inf)
   402 \tdx{infinity}     0:Inf & (ALL y:Inf. succ(y): Inf)
   403 \subcaption{Finite and infinite sets}
   403 \subcaption{Finite and infinite sets}
   404 
   404 
   405 \tdx{Pair_def}       <a,b>      == {\ttlbrace}{\ttlbrace}a,a{\ttrbrace}, {\ttlbrace}a,b{\ttrbrace}{\ttrbrace}
   405 \tdx{Pair_def}       <a,b>      == {\ttlbrace}{\ttlbrace}a,a{\ttrbrace}, {\ttlbrace}a,b{\ttrbrace}{\ttrbrace}
   406 \tdx{split_def}      split(c,p) == THE y. EX a b. p=<a,b> & y=c(a,b)
   406 \tdx{split_def}      split(c,p) == THE y. EX a b. p=<a,b> & y=c(a,b)
   407 \tdx{fst_def}        fst(A)     == split(\%x y.x, p)
   407 \tdx{fst_def}        fst(A)     == split(\%x y. x, p)
   408 \tdx{snd_def}        snd(A)     == split(\%x y.y, p)
   408 \tdx{snd_def}        snd(A)     == split(\%x y. y, p)
   409 \tdx{Sigma_def}      Sigma(A,B) == UN x:A. UN y:B(x). {\ttlbrace}<x,y>{\ttrbrace}
   409 \tdx{Sigma_def}      Sigma(A,B) == UN x:A. UN y:B(x). {\ttlbrace}<x,y>{\ttrbrace}
   410 \subcaption{Ordered pairs and Cartesian products}
   410 \subcaption{Ordered pairs and Cartesian products}
   411 
   411 
   412 \tdx{converse_def}   converse(r) == {\ttlbrace}z. w:r, EX x y. w=<x,y> & z=<y,x>{\ttrbrace}
   412 \tdx{converse_def}   converse(r) == {\ttlbrace}z. w:r, EX x y. w=<x,y> & z=<y,x>{\ttrbrace}
   413 \tdx{domain_def}     domain(r)   == {\ttlbrace}x. w:r, EX y. w=<x,y>{\ttrbrace}
   413 \tdx{domain_def}     domain(r)   == {\ttlbrace}x. w:r, EX y. w=<x,y>{\ttrbrace}
   418 \subcaption{Operations on relations}
   418 \subcaption{Operations on relations}
   419 
   419 
   420 \tdx{lam_def}    Lambda(A,b) == {\ttlbrace}<x,b(x)> . x:A{\ttrbrace}
   420 \tdx{lam_def}    Lambda(A,b) == {\ttlbrace}<x,b(x)> . x:A{\ttrbrace}
   421 \tdx{apply_def}  f`a         == THE y. <a,y> : f
   421 \tdx{apply_def}  f`a         == THE y. <a,y> : f
   422 \tdx{Pi_def}     Pi(A,B) == {\ttlbrace}f: Pow(Sigma(A,B)). ALL x:A. EX! y. <x,y>: f{\ttrbrace}
   422 \tdx{Pi_def}     Pi(A,B) == {\ttlbrace}f: Pow(Sigma(A,B)). ALL x:A. EX! y. <x,y>: f{\ttrbrace}
   423 \tdx{restrict_def}   restrict(f,A) == lam x:A.f`x
   423 \tdx{restrict_def}   restrict(f,A) == lam x:A. f`x
   424 \subcaption{Functions and general product}
   424 \subcaption{Functions and general product}
   425 \end{ttbox}
   425 \end{ttbox}
   426 \caption{Further definitions of {\ZF}} \label{zf-defs}
   426 \caption{Further definitions of {\ZF}} \label{zf-defs}
   427 \end{figure}
   427 \end{figure}
   428 
   428 
   439 The traditional replacement axiom asserts
   439 The traditional replacement axiom asserts
   440 \[ y \in \texttt{PrimReplace}(A,P) \bimp (\exists x\in A. P(x,y)) \]
   440 \[ y \in \texttt{PrimReplace}(A,P) \bimp (\exists x\in A. P(x,y)) \]
   441 subject to the condition that $P(x,y)$ is single-valued for all~$x\in A$.
   441 subject to the condition that $P(x,y)$ is single-valued for all~$x\in A$.
   442 The Isabelle theory defines \cdx{Replace} to apply
   442 The Isabelle theory defines \cdx{Replace} to apply
   443 \cdx{PrimReplace} to the single-valued part of~$P$, namely
   443 \cdx{PrimReplace} to the single-valued part of~$P$, namely
   444 \[ (\exists!z.P(x,z)) \conj P(x,y). \]
   444 \[ (\exists!z. P(x,z)) \conj P(x,y). \]
   445 Thus $y\in \texttt{Replace}(A,P)$ if and only if there is some~$x$ such that
   445 Thus $y\in \texttt{Replace}(A,P)$ if and only if there is some~$x$ such that
   446 $P(x,-)$ holds uniquely for~$y$.  Because the equivalence is unconditional,
   446 $P(x,-)$ holds uniquely for~$y$.  Because the equivalence is unconditional,
   447 \texttt{Replace} is much easier to use than \texttt{PrimReplace}; it defines the
   447 \texttt{Replace} is much easier to use than \texttt{PrimReplace}; it defines the
   448 same set, if $P(x,y)$ is single-valued.  The nice syntax for replacement
   448 same set, if $P(x,y)$ is single-valued.  The nice syntax for replacement
   449 expands to \texttt{Replace}.
   449 expands to \texttt{Replace}.
   491 
   491 
   492 \tdx{ball_cong}   [| A=A';  !!x. x:A' ==> P(x) <-> P'(x) |] ==> 
   492 \tdx{ball_cong}   [| A=A';  !!x. x:A' ==> P(x) <-> P'(x) |] ==> 
   493             (ALL x:A. P(x)) <-> (ALL x:A'. P'(x))
   493             (ALL x:A. P(x)) <-> (ALL x:A'. P'(x))
   494 
   494 
   495 \tdx{bexI}        [| P(x);  x: A |] ==> EX x:A. P(x)
   495 \tdx{bexI}        [| P(x);  x: A |] ==> EX x:A. P(x)
   496 \tdx{bexCI}       [| ALL x:A. ~P(x) ==> P(a);  a: A |] ==> EX x:A.P(x)
   496 \tdx{bexCI}       [| ALL x:A. ~P(x) ==> P(a);  a: A |] ==> EX x:A. P(x)
   497 \tdx{bexE}        [| EX x:A. P(x);  !!x. [| x:A; P(x) |] ==> Q |] ==> Q
   497 \tdx{bexE}        [| EX x:A. P(x);  !!x. [| x:A; P(x) |] ==> Q |] ==> Q
   498 
   498 
   499 \tdx{bex_cong}    [| A=A';  !!x. x:A' ==> P(x) <-> P'(x) |] ==> 
   499 \tdx{bex_cong}    [| A=A';  !!x. x:A' ==> P(x) <-> P'(x) |] ==> 
   500             (EX x:A. P(x)) <-> (EX x:A'. P'(x))
   500             (EX x:A. P(x)) <-> (EX x:A'. P'(x))
   501 \subcaption{Bounded quantifiers}
   501 \subcaption{Bounded quantifiers}
   502 
   502 
   503 \tdx{subsetI}       (!!x.x:A ==> x:B) ==> A <= B
   503 \tdx{subsetI}       (!!x. x:A ==> x:B) ==> A <= B
   504 \tdx{subsetD}       [| A <= B;  c:A |] ==> c:B
   504 \tdx{subsetD}       [| A <= B;  c:A |] ==> c:B
   505 \tdx{subsetCE}      [| A <= B;  ~(c:A) ==> P;  c:B ==> P |] ==> P
   505 \tdx{subsetCE}      [| A <= B;  ~(c:A) ==> P;  c:B ==> P |] ==> P
   506 \tdx{subset_refl}   A <= A
   506 \tdx{subset_refl}   A <= A
   507 \tdx{subset_trans}  [| A<=B;  B<=C |] ==> A<=C
   507 \tdx{subset_trans}  [| A<=B;  B<=C |] ==> A<=C
   508 
   508 
   766 \tdx{Pair_inject}     [| <a,b> = <c,d>;  [| a=c; b=d |] ==> P |] ==> P
   766 \tdx{Pair_inject}     [| <a,b> = <c,d>;  [| a=c; b=d |] ==> P |] ==> P
   767 \tdx{Pair_neq_0}      <a,b>=0 ==> P
   767 \tdx{Pair_neq_0}      <a,b>=0 ==> P
   768 
   768 
   769 \tdx{fst_conv}        fst(<a,b>) = a
   769 \tdx{fst_conv}        fst(<a,b>) = a
   770 \tdx{snd_conv}        snd(<a,b>) = b
   770 \tdx{snd_conv}        snd(<a,b>) = b
   771 \tdx{split}           split(\%x y.c(x,y), <a,b>) = c(a,b)
   771 \tdx{split}           split(\%x y. c(x,y), <a,b>) = c(a,b)
   772 
   772 
   773 \tdx{SigmaI}          [| a:A;  b:B(a) |] ==> <a,b> : Sigma(A,B)
   773 \tdx{SigmaI}          [| a:A;  b:B(a) |] ==> <a,b> : Sigma(A,B)
   774 
   774 
   775 \tdx{SigmaE}          [| c: Sigma(A,B);  
   775 \tdx{SigmaE}          [| c: Sigma(A,B);  
   776                    !!x y.[| x:A; y:B(x); c=<x,y> |] ==> P |] ==> P
   776                    !!x y.[| x:A; y:B(x); c=<x,y> |] ==> P |] ==> P
   801 merely states that $\pair{a,b}\in \texttt{Sigma}(A,B)$ implies $a\in A$ and
   801 merely states that $\pair{a,b}\in \texttt{Sigma}(A,B)$ implies $a\in A$ and
   802 $b\in B(a)$.
   802 $b\in B(a)$.
   803 
   803 
   804 In addition, it is possible to use tuples as patterns in abstractions:
   804 In addition, it is possible to use tuples as patterns in abstractions:
   805 \begin{center}
   805 \begin{center}
   806 {\tt\%<$x$,$y$>.$t$} \quad stands for\quad \texttt{split(\%$x$ $y$.$t$)}
   806 {\tt\%<$x$,$y$>. $t$} \quad stands for\quad \texttt{split(\%$x$ $y$. $t$)}
   807 \end{center}
   807 \end{center}
   808 Nested patterns are translated recursively:
   808 Nested patterns are translated recursively:
   809 {\tt\%<$x$,$y$,$z$>.$t$} $\leadsto$ {\tt\%<$x$,<$y$,$z$>>.$t$} $\leadsto$
   809 {\tt\%<$x$,$y$,$z$>. $t$} $\leadsto$ {\tt\%<$x$,<$y$,$z$>>. $t$} $\leadsto$
   810 \texttt{split(\%$x$.\%<$y$,$z$>.$t$)} $\leadsto$ \texttt{split(\%$x$.split(\%$y$
   810 \texttt{split(\%$x$.\%<$y$,$z$>. $t$)} $\leadsto$ \texttt{split(\%$x$. split(\%$y$
   811   $z$.$t$))}.  The reverse translation is performed upon printing.
   811   $z$. $t$))}.  The reverse translation is performed upon printing.
   812 \begin{warn}
   812 \begin{warn}
   813   The translation between patterns and \texttt{split} is performed automatically
   813   The translation between patterns and \texttt{split} is performed automatically
   814   by the parser and printer.  Thus the internal and external form of a term
   814   by the parser and printer.  Thus the internal and external form of a term
   815   may differ, which affects proofs.  For example the term {\tt
   815   may differ, which affects proofs.  For example the term {\tt
   816     (\%<x,y>.<y,x>)<a,b>} requires the theorem \texttt{split} to rewrite to
   816     (\%<x,y>.<y,x>)<a,b>} requires the theorem \texttt{split} to rewrite to
   916 \begin{ttbox}
   916 \begin{ttbox}
   917 \tdx{lamI}         a:A ==> <a,b(a)> : (lam x:A. b(x))
   917 \tdx{lamI}         a:A ==> <a,b(a)> : (lam x:A. b(x))
   918 \tdx{lamE}         [| p: (lam x:A. b(x));  !!x.[| x:A; p=<x,b(x)> |] ==> P 
   918 \tdx{lamE}         [| p: (lam x:A. b(x));  !!x.[| x:A; p=<x,b(x)> |] ==> P 
   919              |] ==>  P
   919              |] ==>  P
   920 
   920 
   921 \tdx{lam_type}     [| !!x. x:A ==> b(x): B(x) |] ==> (lam x:A.b(x)) : Pi(A,B)
   921 \tdx{lam_type}     [| !!x. x:A ==> b(x): B(x) |] ==> (lam x:A. b(x)) : Pi(A,B)
   922 
   922 
   923 \tdx{beta}         a : A ==> (lam x:A.b(x)) ` a = b(a)
   923 \tdx{beta}         a : A ==> (lam x:A. b(x)) ` a = b(a)
   924 \tdx{eta}          f : Pi(A,B) ==> (lam x:A. f`x) = f
   924 \tdx{eta}          f : Pi(A,B) ==> (lam x:A. f`x) = f
   925 \end{ttbox}
   925 \end{ttbox}
   926 \caption{$\lambda$-abstraction} \label{zf-lam}
   926 \caption{$\lambda$-abstraction} \label{zf-lam}
   927 \end{figure}
   927 \end{figure}
   928 
   928 
  1272               THE y. k=0 & y=a | (EX x. k=succ(x) & y=b(x))
  1272               THE y. k=0 & y=a | (EX x. k=succ(x) & y=b(x))
  1273 
  1273 
  1274 \tdx{rec_def}       rec(k,a,b) ==  
  1274 \tdx{rec_def}       rec(k,a,b) ==  
  1275               transrec(k, \%n f. nat_case(a, \%m. b(m, f`m), n))
  1275               transrec(k, \%n f. nat_case(a, \%m. b(m, f`m), n))
  1276 
  1276 
  1277 \tdx{add_def}       m#+n    == rec(m, n, \%u v.succ(v))
  1277 \tdx{add_def}       m#+n    == rec(m, n, \%u v. succ(v))
  1278 \tdx{diff_def}      m#-n    == rec(n, m, \%u v. rec(v, 0, \%x y.x))
  1278 \tdx{diff_def}      m#-n    == rec(n, m, \%u v. rec(v, 0, \%x y. x))
  1279 \tdx{mult_def}      m#*n    == rec(m, 0, \%u v. n #+ v)
  1279 \tdx{mult_def}      m#*n    == rec(m, 0, \%u v. n #+ v)
  1280 \tdx{mod_def}       m mod n == transrec(m, \%j f. if(j:n, j, f`(j#-n)))
  1280 \tdx{mod_def}       m mod n == transrec(m, \%j f. if(j:n, j, f`(j#-n)))
  1281 \tdx{div_def}       m div n == transrec(m, \%j f. if(j:n, 0, succ(f`(j#-n))))
  1281 \tdx{div_def}       m div n == transrec(m, \%j f. if(j:n, 0, succ(f`(j#-n))))
  1282 
  1282 
  1283 
  1283 
  1373 \end{constants}
  1373 \end{constants}
  1374 
  1374 
  1375 \underscoreon %%because @ is used here
  1375 \underscoreon %%because @ is used here
  1376 \begin{ttbox}
  1376 \begin{ttbox}
  1377 \tdx{list_rec_def}    list_rec(l,c,h) == 
  1377 \tdx{list_rec_def}    list_rec(l,c,h) == 
  1378                 Vrec(l, \%l g.list_case(c, \%x xs. h(x, xs, g`xs), l))
  1378                 Vrec(l, \%l g. list_case(c, \%x xs. h(x, xs, g`xs), l))
  1379 
  1379 
  1380 \tdx{map_def}         map(f,l)  == list_rec(l,  0,  \%x xs r. <f(x), r>)
  1380 \tdx{map_def}         map(f,l)  == list_rec(l,  0,  \%x xs r. <f(x), r>)
  1381 \tdx{length_def}      length(l) == list_rec(l,  0,  \%x xs r. succ(r))
  1381 \tdx{length_def}      length(l) == list_rec(l,  0,  \%x xs r. succ(r))
  1382 \tdx{app_def}         xs@ys     == list_rec(xs, ys, \%x xs r. <x,r>)
  1382 \tdx{app_def}         xs@ys     == list_rec(xs, ys, \%x xs r. <x,r>)
  1383 \tdx{rev_def}         rev(l)    == list_rec(l,  0,  \%x xs r. r @ <x,0>)
  1383 \tdx{rev_def}         rev(l)    == list_rec(l,  0,  \%x xs r. r @ <x,0>)
  1399 \tdx{list_mono}       A<=B ==> list(A) <= list(B)
  1399 \tdx{list_mono}       A<=B ==> list(A) <= list(B)
  1400 
  1400 
  1401 \tdx{list_rec_Nil}    list_rec(Nil,c,h) = c
  1401 \tdx{list_rec_Nil}    list_rec(Nil,c,h) = c
  1402 \tdx{list_rec_Cons}   list_rec(Cons(a,l), c, h) = h(a, l, list_rec(l,c,h))
  1402 \tdx{list_rec_Cons}   list_rec(Cons(a,l), c, h) = h(a, l, list_rec(l,c,h))
  1403 
  1403 
  1404 \tdx{map_ident}       l: list(A) ==> map(\%u.u, l) = l
  1404 \tdx{map_ident}       l: list(A) ==> map(\%u. u, l) = l
  1405 \tdx{map_compose}     l: list(A) ==> map(h, map(j,l)) = map(\%u.h(j(u)), l)
  1405 \tdx{map_compose}     l: list(A) ==> map(h, map(j,l)) = map(\%u. h(j(u)), l)
  1406 \tdx{map_app_distrib} xs: list(A) ==> map(h, xs@ys) = map(h,xs) @ map(h,ys)
  1406 \tdx{map_app_distrib} xs: list(A) ==> map(h, xs@ys) = map(h,xs) @ map(h,ys)
  1407 \tdx{map_type}
  1407 \tdx{map_type}
  1408     [| l: list(A);  !!x. x: A ==> h(x): B |] ==> map(h,l) : list(B)
  1408     [| l: list(A);  !!x. x: A ==> h(x): B |] ==> map(h,l) : list(B)
  1409 \tdx{map_flat}
  1409 \tdx{map_flat}
  1410     ls: list(list(A)) ==> map(h, flat(ls)) = flat(map(map(h),ls))
  1410     ls: list(list(A)) ==> map(h, flat(ls)) = flat(map(map(h),ls))
  1503 {\ZF} does not merely inherit simplification from \FOL, but modifies it
  1503 {\ZF} does not merely inherit simplification from \FOL, but modifies it
  1504 extensively.  File \texttt{ZF/simpdata.ML} contains the details.
  1504 extensively.  File \texttt{ZF/simpdata.ML} contains the details.
  1505 
  1505 
  1506 The extraction of rewrite rules takes set theory primitives into account.
  1506 The extraction of rewrite rules takes set theory primitives into account.
  1507 It can strip bounded universal quantifiers from a formula; for example,
  1507 It can strip bounded universal quantifiers from a formula; for example,
  1508 ${\forall x\in A.f(x)=g(x)}$ yields the conditional rewrite rule $x\in A \Imp
  1508 ${\forall x\in A. f(x)=g(x)}$ yields the conditional rewrite rule $x\in A \Imp
  1509 f(x)=g(x)$.  Given $a\in\{x\in A.P(x)\}$ it extracts rewrite rules from
  1509 f(x)=g(x)$.  Given $a\in\{x\in A. P(x)\}$ it extracts rewrite rules from
  1510 $a\in A$ and~$P(a)$.  It can also break down $a\in A\int B$ and $a\in A-B$.
  1510 $a\in A$ and~$P(a)$.  It can also break down $a\in A\int B$ and $a\in A-B$.
  1511 
  1511 
  1512 The default simplification set contains congruence rules for
  1512 The default simplification set contains congruence rules for
  1513 all the binding operators of {\ZF}\@.  It contains all the conversion
  1513 all the binding operators of {\ZF}\@.  It contains all the conversion
  1514 rules, such as \texttt{fst} and \texttt{snd}, as well as the rewrites
  1514 rules, such as \texttt{fst} and \texttt{snd}, as well as the rewrites
  1609 \tdx{Pow_mono}      A<=B ==> Pow(A) <= Pow(B)
  1609 \tdx{Pow_mono}      A<=B ==> Pow(A) <= Pow(B)
  1610 \end{ttbox}
  1610 \end{ttbox}
  1611 We enter the goal and make the first step, which breaks the equation into
  1611 We enter the goal and make the first step, which breaks the equation into
  1612 two inclusions by extensionality:\index{*equalityI theorem}
  1612 two inclusions by extensionality:\index{*equalityI theorem}
  1613 \begin{ttbox}
  1613 \begin{ttbox}
  1614 goal thy "Pow(A Int B) = Pow(A) Int Pow(B)";
  1614 Goal "Pow(A Int B) = Pow(A) Int Pow(B)";
  1615 {\out Level 0}
  1615 {\out Level 0}
  1616 {\out Pow(A Int B) = Pow(A) Int Pow(B)}
  1616 {\out Pow(A Int B) = Pow(A) Int Pow(B)}
  1617 {\out  1. Pow(A Int B) = Pow(A) Int Pow(B)}
  1617 {\out  1. Pow(A Int B) = Pow(A) Int Pow(B)}
  1618 \ttbreak
  1618 \ttbreak
  1619 by (resolve_tac [equalityI] 1);
  1619 by (resolve_tac [equalityI] 1);
  1723 \section{Monotonicity of the union operator}
  1723 \section{Monotonicity of the union operator}
  1724 For another example, we prove that general union is monotonic:
  1724 For another example, we prove that general union is monotonic:
  1725 ${C\subseteq D}$ implies $\bigcup(C)\subseteq \bigcup(D)$.  To begin, we
  1725 ${C\subseteq D}$ implies $\bigcup(C)\subseteq \bigcup(D)$.  To begin, we
  1726 tackle the inclusion using \tdx{subsetI}:
  1726 tackle the inclusion using \tdx{subsetI}:
  1727 \begin{ttbox}
  1727 \begin{ttbox}
  1728 val [prem] = goal thy "C<=D ==> Union(C) <= Union(D)";
  1728 Goal "C<=D ==> Union(C) <= Union(D)";
  1729 {\out Level 0}
  1729 {\out Level 0}
  1730 {\out Union(C) <= Union(D)}
  1730 {\out C <= D ==> Union(C) <= Union(D)}
  1731 {\out  1. Union(C) <= Union(D)}
  1731 {\out  1. C <= D ==> Union(C) <= Union(D)}
  1732 {\out val prem = "C <= D  [C <= D]" : thm}
       
  1733 \ttbreak
  1732 \ttbreak
  1734 by (resolve_tac [subsetI] 1);
  1733 by (resolve_tac [subsetI] 1);
  1735 {\out Level 1}
  1734 {\out Level 1}
  1736 {\out Union(C) <= Union(D)}
  1735 {\out C <= D ==> Union(C) <= Union(D)}
  1737 {\out  1. !!x. x : Union(C) ==> x : Union(D)}
  1736 {\out  1. !!x. [| C <= D; x : Union(C) |] ==> x : Union(D)}
  1738 \end{ttbox}
  1737 \end{ttbox}
  1739 Big union is like an existential quantifier --- the occurrence in the
  1738 Big union is like an existential quantifier --- the occurrence in the
  1740 assumptions must be eliminated early, since it creates parameters.
  1739 assumptions must be eliminated early, since it creates parameters.
  1741 \index{*UnionE theorem}
  1740 \index{*UnionE theorem}
  1742 \begin{ttbox}
  1741 \begin{ttbox}
  1743 by (eresolve_tac [UnionE] 1);
  1742 by (eresolve_tac [UnionE] 1);
  1744 {\out Level 2}
  1743 {\out Level 2}
  1745 {\out Union(C) <= Union(D)}
  1744 {\out C <= D ==> Union(C) <= Union(D)}
  1746 {\out  1. !!x B. [| x : B; B : C |] ==> x : Union(D)}
  1745 {\out  1. !!x B. [| C <= D; x : B; B : C |] ==> x : Union(D)}
  1747 \end{ttbox}
  1746 \end{ttbox}
  1748 Now we may apply \tdx{UnionI}, which creates an unknown involving the
  1747 Now we may apply \tdx{UnionI}, which creates an unknown involving the
  1749 parameters.  To show $x\in \bigcup(D)$ it suffices to show that $x$ belongs
  1748 parameters.  To show $x\in \bigcup(D)$ it suffices to show that $x$ belongs
  1750 to some element, say~$\Var{B2}(x,B)$, of~$D$.
  1749 to some element, say~$\Var{B2}(x,B)$, of~$D$.
  1751 \begin{ttbox}
  1750 \begin{ttbox}
  1752 by (resolve_tac [UnionI] 1);
  1751 by (resolve_tac [UnionI] 1);
  1753 {\out Level 3}
  1752 {\out Level 3}
  1754 {\out Union(C) <= Union(D)}
  1753 {\out C <= D ==> Union(C) <= Union(D)}
  1755 {\out  1. !!x B. [| x : B; B : C |] ==> ?B2(x,B) : D}
  1754 {\out  1. !!x B. [| C <= D; x : B; B : C |] ==> ?B2(x,B) : D}
  1756 {\out  2. !!x B. [| x : B; B : C |] ==> x : ?B2(x,B)}
  1755 {\out  2. !!x B. [| C <= D; x : B; B : C |] ==> x : ?B2(x,B)}
  1757 \end{ttbox}
  1756 \end{ttbox}
  1758 Combining \tdx{subsetD} with the premise $C\subseteq D$ yields 
  1757 Combining \tdx{subsetD} with the assumption $C\subseteq D$ yields 
  1759 $\Var{a}\in C \Imp \Var{a}\in D$, which reduces subgoal~1:
  1758 $\Var{a}\in C \Imp \Var{a}\in D$, which reduces subgoal~1.  Note that
  1760 \begin{ttbox}
  1759 \texttt{eresolve_tac} has removed that assumption.
  1761 by (resolve_tac [prem RS subsetD] 1);
  1760 \begin{ttbox}
       
  1761 by (eresolve_tac [subsetD] 1);
  1762 {\out Level 4}
  1762 {\out Level 4}
  1763 {\out Union(C) <= Union(D)}
  1763 {\out C <= D ==> Union(C) <= Union(D)}
  1764 {\out  1. !!x B. [| x : B; B : C |] ==> ?B2(x,B) : C}
  1764 {\out  1. !!x B. [| x : B; B : C |] ==> ?B2(x,B) : C}
  1765 {\out  2. !!x B. [| x : B; B : C |] ==> x : ?B2(x,B)}
  1765 {\out  2. !!x B. [| C <= D; x : B; B : C |] ==> x : ?B2(x,B)}
  1766 \end{ttbox}
  1766 \end{ttbox}
  1767 The rest is routine.  Note how~$\Var{B2}(x,B)$ is instantiated.
  1767 The rest is routine.  Observe how~$\Var{B2}(x,B)$ is instantiated.
  1768 \begin{ttbox}
  1768 \begin{ttbox}
  1769 by (assume_tac 1);
  1769 by (assume_tac 1);
  1770 {\out Level 5}
  1770 {\out Level 5}
  1771 {\out Union(C) <= Union(D)}
  1771 {\out C <= D ==> Union(C) <= Union(D)}
  1772 {\out  1. !!x B. [| x : B; B : C |] ==> x : B}
  1772 {\out  1. !!x B. [| C <= D; x : B; B : C |] ==> x : B}
  1773 by (assume_tac 1);
  1773 by (assume_tac 1);
  1774 {\out Level 6}
  1774 {\out Level 6}
  1775 {\out Union(C) <= Union(D)}
  1775 {\out C <= D ==> Union(C) <= Union(D)}
  1776 {\out No subgoals!}
  1776 {\out No subgoals!}
  1777 \end{ttbox}
  1777 \end{ttbox}
  1778 Again, \ttindex{Blast_tac} can prove the theorem in one
  1778 Again, \ttindex{Blast_tac} can prove the theorem in one step.
  1779 step, provided we somehow supply it with~\texttt{prem}.  We can add
  1779 \begin{ttbox}
  1780 \hbox{\tt prem RS subsetD} to the claset as an introduction rule:
  1780 by (Blast_tac 1);
  1781 \begin{ttbox}
       
  1782 by (blast_tac (claset() addIs [prem RS subsetD]) 1);
       
  1783 {\out Depth = 0}
  1781 {\out Depth = 0}
  1784 {\out Depth = 1}
  1782 {\out Depth = 1}
  1785 {\out Depth = 2}
  1783 {\out Depth = 2}
  1786 {\out Level 1}
  1784 {\out Level 1}
  1787 {\out Union(C) <= Union(D)}
  1785 {\out C <= D ==> Union(C) <= Union(D)}
  1788 {\out No subgoals!}
  1786 {\out No subgoals!}
  1789 \end{ttbox}
       
  1790 As an alternative, we could add premise to the assumptions, either using
       
  1791 \ttindex{cut_facts_tac} or by stating the original goal using~\texttt{!!}:
       
  1792 \begin{ttbox}
       
  1793 goal thy "!!C D. C<=D ==> Union(C) <= Union(D)";
       
  1794 {\out Level 0}
       
  1795 {\out Union(C) <= Union(D)}
       
  1796 {\out  1. !!C D. C <= D ==> Union(C) <= Union(D)}
       
  1797 by (Blast_tac 1);
       
  1798 \end{ttbox}
  1787 \end{ttbox}
  1799 
  1788 
  1800 The file \texttt{ZF/equalities.ML} has many similar proofs.  Reasoning about
  1789 The file \texttt{ZF/equalities.ML} has many similar proofs.  Reasoning about
  1801 general intersection can be difficult because of its anomalous behaviour on
  1790 general intersection can be difficult because of its anomalous behaviour on
  1802 the empty set.  However, \ttindex{Blast_tac} copes well with these.  Here is
  1791 the empty set.  However, \ttindex{Blast_tac} copes well with these.  Here is
  1803 a typical example, borrowed from Devlin~\cite[page 12]{devlin79}:
  1792 a typical example, borrowed from Devlin~\cite[page 12]{devlin79}:
  1804 \begin{ttbox}
  1793 \begin{ttbox}
  1805 a:C ==> (INT x:C. A(x) Int B(x)) = (INT x:C.A(x)) Int (INT x:C.B(x))
  1794 a:C ==> (INT x:C. A(x) Int B(x)) = (INT x:C. A(x)) Int (INT x:C. B(x))
  1806 \end{ttbox}
  1795 \end{ttbox}
  1807 In traditional notation this is
  1796 In traditional notation this is
  1808 \[ a\in C \,\Imp\, \inter@{x\in C} \Bigl(A(x) \int B(x)\Bigr) =        
  1797 \[ a\in C \,\Imp\, \inter@{x\in C} \Bigl(A(x) \int B(x)\Bigr) =        
  1809        \Bigl(\inter@{x\in C} A(x)\Bigr)  \int  
  1798        \Bigl(\inter@{x\in C} A(x)\Bigr)  \int  
  1810        \Bigl(\inter@{x\in C} B(x)\Bigr)  \]
  1799        \Bigl(\inter@{x\in C} B(x)\Bigr)  \]
  1817 underlying representation, as in the following proof
  1806 underlying representation, as in the following proof
  1818 of~\tdx{fun_disjoint_apply1}.  This states that if $f$ and~$g$ are
  1807 of~\tdx{fun_disjoint_apply1}.  This states that if $f$ and~$g$ are
  1819 functions with disjoint domains~$A$ and~$C$, and if $a\in A$, then
  1808 functions with disjoint domains~$A$ and~$C$, and if $a\in A$, then
  1820 $(f\un g)`a = f`a$:
  1809 $(f\un g)`a = f`a$:
  1821 \begin{ttbox}
  1810 \begin{ttbox}
  1822 val prems = goal thy
  1811 Goal "[| a:A;  f: A->B;  g: C->D;  A Int C = 0 |] ==>  \ttback
  1823     "[| a:A;  f: A->B;  g: C->D;  A Int C = 0 |] ==>  \ttback
       
  1824 \ttback    (f Un g)`a = f`a";
  1812 \ttback    (f Un g)`a = f`a";
  1825 {\out Level 0}
  1813 {\out Level 0}
  1826 {\out (f Un g) ` a = f ` a}
  1814 {\out [| a : A; f : A -> B; g : C -> D; A Int C = 0 |]}
  1827 {\out  1. (f Un g) ` a = f ` a}
  1815 {\out ==> (f Un g) ` a = f ` a}
  1828 \end{ttbox}
  1816 {\out  1. [| a : A; f : A -> B; g : C -> D; A Int C = 0 |]}
  1829 Isabelle has produced the output above; the \ML{} top-level now echoes the
  1817 {\out     ==> (f Un g) ` a = f ` a}
  1830 binding of \texttt{prems}.
       
  1831 \begin{ttbox}
       
  1832 {\out val prems = ["a : A  [a : A]",}
       
  1833 {\out              "f : A -> B  [f : A -> B]",}
       
  1834 {\out              "g : C -> D  [g : C -> D]",}
       
  1835 {\out              "A Int C = 0  [A Int C = 0]"] : thm list}
       
  1836 \end{ttbox}
  1818 \end{ttbox}
  1837 Using \tdx{apply_equality}, we reduce the equality to reasoning about
  1819 Using \tdx{apply_equality}, we reduce the equality to reasoning about
  1838 ordered pairs.  The second subgoal is to verify that $f\un g$ is a function.
  1820 ordered pairs.  The second subgoal is to verify that $f\un g$ is a function.
       
  1821 To save space, the assumptions will be abbreviated below.
  1839 \begin{ttbox}
  1822 \begin{ttbox}
  1840 by (resolve_tac [apply_equality] 1);
  1823 by (resolve_tac [apply_equality] 1);
  1841 {\out Level 1}
  1824 {\out Level 1}
  1842 {\out (f Un g) ` a = f ` a}
  1825 {\out [| \ldots |] ==> (f Un g) ` a = f ` a}
  1843 {\out  1. <a,f ` a> : f Un g}
  1826 {\out  1. [| \ldots |] ==> <a,f ` a> : f Un g}
  1844 {\out  2. f Un g : (PROD x:?A. ?B(x))}
  1827 {\out  2. [| \ldots |] ==> f Un g : (PROD x:?A. ?B(x))}
  1845 \end{ttbox}
  1828 \end{ttbox}
  1846 We must show that the pair belongs to~$f$ or~$g$; by~\tdx{UnI1} we
  1829 We must show that the pair belongs to~$f$ or~$g$; by~\tdx{UnI1} we
  1847 choose~$f$:
  1830 choose~$f$:
  1848 \begin{ttbox}
  1831 \begin{ttbox}
  1849 by (resolve_tac [UnI1] 1);
  1832 by (resolve_tac [UnI1] 1);
  1850 {\out Level 2}
  1833 {\out Level 2}
  1851 {\out (f Un g) ` a = f ` a}
  1834 {\out [| \ldots |] ==> (f Un g) ` a = f ` a}
  1852 {\out  1. <a,f ` a> : f}
  1835 {\out  1. [| \ldots |] ==> <a,f ` a> : f}
  1853 {\out  2. f Un g : (PROD x:?A. ?B(x))}
  1836 {\out  2. [| \ldots |] ==> f Un g : (PROD x:?A. ?B(x))}
  1854 \end{ttbox}
  1837 \end{ttbox}
  1855 To show $\pair{a,f`a}\in f$ we use \tdx{apply_Pair}, which is
  1838 To show $\pair{a,f`a}\in f$ we use \tdx{apply_Pair}, which is
  1856 essentially the converse of \tdx{apply_equality}:
  1839 essentially the converse of \tdx{apply_equality}:
  1857 \begin{ttbox}
  1840 \begin{ttbox}
  1858 by (resolve_tac [apply_Pair] 1);
  1841 by (resolve_tac [apply_Pair] 1);
  1859 {\out Level 3}
  1842 {\out Level 3}
  1860 {\out (f Un g) ` a = f ` a}
  1843 {\out [| \ldots |] ==> (f Un g) ` a = f ` a}
  1861 {\out  1. f : (PROD x:?A2. ?B2(x))}
  1844 {\out  1. [| \ldots |] ==> f : (PROD x:?A2. ?B2(x))}
  1862 {\out  2. a : ?A2}
  1845 {\out  2. [| \ldots |] ==> a : ?A2}
  1863 {\out  3. f Un g : (PROD x:?A. ?B(x))}
  1846 {\out  3. [| \ldots |] ==> f Un g : (PROD x:?A. ?B(x))}
  1864 \end{ttbox}
  1847 \end{ttbox}
  1865 Using the premises $f\in A\to B$ and $a\in A$, we solve the two subgoals
  1848 Using the assumptions $f\in A\to B$ and $a\in A$, we solve the two subgoals
  1866 from \tdx{apply_Pair}.  Recall that a $\Pi$-set is merely a generalized
  1849 from \tdx{apply_Pair}.  Recall that a $\Pi$-set is merely a generalized
  1867 function space, and observe that~{\tt?A2} is instantiated to~\texttt{A}.
  1850 function space, and observe that~{\tt?A2} is instantiated to~\texttt{A}.
  1868 \begin{ttbox}
  1851 \begin{ttbox}
  1869 by (resolve_tac prems 1);
  1852 by (assume_tac 1);
  1870 {\out Level 4}
  1853 {\out Level 4}
  1871 {\out (f Un g) ` a = f ` a}
  1854 {\out [| \ldots |] ==> (f Un g) ` a = f ` a}
  1872 {\out  1. a : A}
  1855 {\out  1. [| \ldots |] ==> a : A}
  1873 {\out  2. f Un g : (PROD x:?A. ?B(x))}
  1856 {\out  2. [| \ldots |] ==> f Un g : (PROD x:?A. ?B(x))}
  1874 by (resolve_tac prems 1);
  1857 by (assume_tac 1);
  1875 {\out Level 5}
  1858 {\out Level 5}
  1876 {\out (f Un g) ` a = f ` a}
  1859 {\out [| \ldots |] ==> (f Un g) ` a = f ` a}
  1877 {\out  1. f Un g : (PROD x:?A. ?B(x))}
  1860 {\out  1. [| \ldots |] ==> f Un g : (PROD x:?A. ?B(x))}
  1878 \end{ttbox}
  1861 \end{ttbox}
  1879 To construct functions of the form $f\un g$, we apply
  1862 To construct functions of the form $f\un g$, we apply
  1880 \tdx{fun_disjoint_Un}:
  1863 \tdx{fun_disjoint_Un}:
  1881 \begin{ttbox}
  1864 \begin{ttbox}
  1882 by (resolve_tac [fun_disjoint_Un] 1);
  1865 by (resolve_tac [fun_disjoint_Un] 1);
  1883 {\out Level 6}
  1866 {\out Level 6}
  1884 {\out (f Un g) ` a = f ` a}
  1867 {\out [| \ldots |] ==> (f Un g) ` a = f ` a}
  1885 {\out  1. f : ?A3 -> ?B3}
  1868 {\out  1. [| \ldots |] ==> f : ?A3 -> ?B3}
  1886 {\out  2. g : ?C3 -> ?D3}
  1869 {\out  2. [| \ldots |] ==> g : ?C3 -> ?D3}
  1887 {\out  3. ?A3 Int ?C3 = 0}
  1870 {\out  3. [| \ldots |] ==> ?A3 Int ?C3 = 0}
  1888 \end{ttbox}
  1871 \end{ttbox}
  1889 The remaining subgoals are instances of the premises.  Again, observe how
  1872 The remaining subgoals are instances of the assumptions.  Again, observe how
  1890 unknowns are instantiated:
  1873 unknowns are instantiated:
  1891 \begin{ttbox}
  1874 \begin{ttbox}
  1892 by (resolve_tac prems 1);
  1875 by (assume_tac 1);
  1893 {\out Level 7}
  1876 {\out Level 7}
  1894 {\out (f Un g) ` a = f ` a}
  1877 {\out [| \ldots |] ==> (f Un g) ` a = f ` a}
  1895 {\out  1. g : ?C3 -> ?D3}
  1878 {\out  1. [| \ldots |] ==> g : ?C3 -> ?D3}
  1896 {\out  2. A Int ?C3 = 0}
  1879 {\out  2. [| \ldots |] ==> A Int ?C3 = 0}
  1897 by (resolve_tac prems 1);
  1880 by (assume_tac 1);
  1898 {\out Level 8}
  1881 {\out Level 8}
  1899 {\out (f Un g) ` a = f ` a}
  1882 {\out [| \ldots |] ==> (f Un g) ` a = f ` a}
  1900 {\out  1. A Int C = 0}
  1883 {\out  1. [| \ldots |] ==> A Int C = 0}
  1901 by (resolve_tac prems 1);
  1884 by (assume_tac 1);
  1902 {\out Level 9}
  1885 {\out Level 9}
  1903 {\out (f Un g) ` a = f ` a}
  1886 {\out [| \ldots |] ==> (f Un g) ` a = f ` a}
  1904 {\out No subgoals!}
  1887 {\out No subgoals!}
  1905 \end{ttbox}
  1888 \end{ttbox}
  1906 See the files \texttt{ZF/func.ML} and \texttt{ZF/WF.ML} for more
  1889 See the files \texttt{ZF/func.ML} and \texttt{ZF/WF.ML} for more
  1907 examples of reasoning about functions.
  1890 examples of reasoning about functions.
  1908 
  1891