doc-src/IsarRef/generic.tex
changeset 7987 d9aef93c0e32
parent 7981 5120a2a15d06
child 7990 0a604b2fc2b1
equal deleted inserted replaced
7986:9d319a76dbeb 7987:d9aef93c0e32
    35   facts are used to reduce the rule before applying it to the goal.  Thus
    35   facts are used to reduce the rule before applying it to the goal.  Thus
    36   $rule$ without facts is plain \emph{introduction}, while with facts it
    36   $rule$ without facts is plain \emph{introduction}, while with facts it
    37   becomes a (generalized) \emph{elimination}.
    37   becomes a (generalized) \emph{elimination}.
    38   
    38   
    39   Note that the classical reasoner introduces another version of $rule$ that
    39   Note that the classical reasoner introduces another version of $rule$ that
    40   is able to pick appropriate rules automatically, whenever explicit $thms$
    40   is able to pick appropriate rules automatically, whenever $thms$ are omitted
    41   are omitted (see \S\ref{sec:classical-basic}); that method is the default
    41   (see \S\ref{sec:classical-basic}); that method is the default for
    42   for $\PROOFNAME$ steps.  Note that ``$\DDOT$'' (double-dot) abbreviates
    42   $\PROOFNAME$ steps.  Note that ``$\DDOT$'' (double-dot) abbreviates
    43   $\BY{default}$.
    43   $\BY{default}$.
    44 \item [$erule~thms$] is similar to $rule$, but applies rules by
    44 \item [$erule~thms$] is similar to $rule$, but applies rules by
    45   elim-resolution.  This is an improper method, mainly for experimentation and
    45   elim-resolution.  This is an improper method, mainly for experimentation and
    46   porting of old scripts.  Actual elimination proofs are usually done with
    46   porting of old scripts.  Actual elimination proofs are usually done with
    47   $rule$ (single step, involving facts) or $elim$ (repeated steps, see
    47   $rule$ (single step, involving facts) or $elim$ (repeated steps, see
    48   \S\ref{sec:classical-basic}).
    48   \S\ref{sec:classical-basic}).
    49 \item [$unfold~thms$ and $fold~thms$] expand and fold back again the given
    49 \item [$unfold~thms$ and $fold~thms$] expand and fold back again the given
    50   meta-level definitions throughout all goals; any facts provided are
    50   meta-level definitions throughout all goals; any facts provided are inserted
    51   \emph{ignored}.
    51   into the goal and subject to rewriting as well.
    52 \item [$succeed$] yields a single (unchanged) result; it is the identify of
    52 \item [$succeed$] yields a single (unchanged) result; it is the identity of
    53   the ``\texttt{,}'' method combinator (cf.\ \S\ref{sec:syn-meth}).
    53   the ``\texttt{,}'' method combinator (cf.\ \S\ref{sec:syn-meth}).
    54 \item [$fail$] yields an empty result sequence; it is the identify of the
    54 \item [$fail$] yields an empty result sequence; it is the identity of the
    55   ``\texttt{|}'' method combinator (cf.\ \S\ref{sec:syn-meth}).
    55   ``\texttt{|}'' method combinator (cf.\ \S\ref{sec:syn-meth}).
    56 \end{descr}
    56 \end{descr}
    57 
    57 
    58 
    58 
    59 \section{Miscellaneous attributes}
    59 \section{Miscellaneous attributes}
    96   respectively.  Tags may be any list of strings that serve as comment for
    96   respectively.  Tags may be any list of strings that serve as comment for
    97   some tools (e.g.\ $\LEMMANAME$ causes the tag ``$lemma$'' to be added to the
    97   some tools (e.g.\ $\LEMMANAME$ causes the tag ``$lemma$'' to be added to the
    98   result).
    98   result).
    99 \item [$OF~thms$, $RS~n~thm$, and $COMP~n~thm$] compose rules.  $OF$ applies
    99 \item [$OF~thms$, $RS~n~thm$, and $COMP~n~thm$] compose rules.  $OF$ applies
   100   $thms$ in parallel (cf.\ \texttt{MRS} in \cite[\S5]{isabelle-ref}, but note
   100   $thms$ in parallel (cf.\ \texttt{MRS} in \cite[\S5]{isabelle-ref}, but note
   101   the reversed order).  Note that premises may be skipped by including $\_$
   101   the reversed order).  Note that premises may be skipped by including
   102   (underscore) as argument.
   102   ``$\_$'' (underscore) as argument.
   103   
   103   
   104   $RS$ resolves with the $n$-th premise of $thm$; $COMP$ is a version of $RS$
   104   $RS$ resolves with the $n$-th premise of $thm$; $COMP$ is a version of $RS$
   105   that does not include the automatic lifting process that is normally
   105   that skips the automatic lifting process that is normally intended (cf.\ 
   106   intended (cf.\ \texttt{RS} and \texttt{COMP} in \cite[\S5]{isabelle-ref}).
   106   \texttt{RS} and \texttt{COMP} in \cite[\S5]{isabelle-ref}).
   107   
   107   
   108 \item [$of~\vec t$ and $where~\vec x = \vec t$] perform positional and named
   108 \item [$of~\vec t$ and $where~\vec x = \vec t$] perform positional and named
   109   instantiation, respectively.  The terms given in $of$ are substituted for
   109   instantiation, respectively.  The terms given in $of$ are substituted for
   110   any schematic variables occurring in a theorem from left to right;
   110   any schematic variables occurring in a theorem from left to right;
   111   ``\texttt{_}'' (underscore) indicates to skip a position.
   111   ``\texttt{_}'' (underscore) indicates to skip a position.
   178   precedence).
   178   precedence).
   179   
   179   
   180 \item [$\FINALLY~(thms)$] maintaining $calculation$ in the same way as
   180 \item [$\FINALLY~(thms)$] maintaining $calculation$ in the same way as
   181   $\ALSO$, and concludes the current calculational thread.  The final result
   181   $\ALSO$, and concludes the current calculational thread.  The final result
   182   is exhibited as fact for forward chaining towards the next goal. Basically,
   182   is exhibited as fact for forward chaining towards the next goal. Basically,
   183   $\FINALLY$ just abbreviates $\ALSO~\FROM{calculation}$.  Typical proof
   183   $\FINALLY$ just abbreviates $\ALSO~\FROM{calculation}$.  Note that
   184   idioms are``$\FINALLY~\SHOW{}{\Var{thesis}}~\DOT$'' and
   184   ``$\FINALLY~\SHOW{}{\Var{thesis}}~\DOT$'' and
   185   ``$\FINALLY~\HAVE{}{\phi}~\DOT$''.
   185   ``$\FINALLY~\HAVE{}{\phi}~\DOT$'' are typical idioms for concluding
       
   186   calculational proofs.
   186   
   187   
   187 \item [$trans$] maintains the set of transitivity rules of the theory or proof
   188 \item [$trans$] maintains the set of transitivity rules of the theory or proof
   188   context, by adding or deleting theorems (the default is to add).
   189   context, by adding or deleting theorems (the default is to add).
   189 \end{descr}
   190 \end{descr}
   190 
   191 
   202   \isarcmd{axclass} & : & \isartrans{theory}{theory} \\
   203   \isarcmd{axclass} & : & \isartrans{theory}{theory} \\
   203   \isarcmd{instance} & : & \isartrans{theory}{proof(prove)} \\
   204   \isarcmd{instance} & : & \isartrans{theory}{proof(prove)} \\
   204   intro_classes & : & \isarmeth \\
   205   intro_classes & : & \isarmeth \\
   205 \end{matharray}
   206 \end{matharray}
   206 
   207 
   207 Axiomatic type classes are provided by Isabelle/Pure as a purely
   208 Axiomatic type classes are provided by Isabelle/Pure as a \emph{definitional}
   208 \emph{definitional} interface to type classes (cf.~\S\ref{sec:classes}).  Thus
   209 interface to type classes (cf.~\S\ref{sec:classes}).  Thus any object logic
   209 any object logic may make use of this light-weight mechanism for abstract
   210 may make use of this light-weight mechanism of abstract theories.  See
   210 theories.  See \cite{Wenzel:1997:TPHOL} for more information.  There is also a
   211 \cite{Wenzel:1997:TPHOL} for more information.  There is also a tutorial on
   211 tutorial on \emph{Using Axiomatic Type Classes in Isabelle} that is part of
   212 \emph{Using Axiomatic Type Classes in Isabelle} that is part of the standard
   212 the standard Isabelle documentation.
   213 Isabelle documentation.
   213 %FIXME cite
   214 %FIXME cite
   214 
   215 
   215 \begin{rail}
   216 \begin{rail}
   216   'axclass' classdecl (axmdecl prop comment? +)
   217   'axclass' classdecl (axmdecl prop comment? +)
   217   ;
   218   ;
   223 \item [$\isarkeyword{axclass}~c < \vec c~axms$] defines an axiomatic type
   224 \item [$\isarkeyword{axclass}~c < \vec c~axms$] defines an axiomatic type
   224   class as the intersection of existing classes, with additional axioms
   225   class as the intersection of existing classes, with additional axioms
   225   holding.  Class axioms may not contain more than one type variable.  The
   226   holding.  Class axioms may not contain more than one type variable.  The
   226   class axioms (with implicit sort constraints added) are bound to the given
   227   class axioms (with implicit sort constraints added) are bound to the given
   227   names.  Furthermore a class introduction rule is generated, which is
   228   names.  Furthermore a class introduction rule is generated, which is
   228   employed by method $intro_classes$ in support instantiation proofs of this
   229   employed by method $intro_classes$ to support instantiation proofs of this
   229   class.
   230   class.
   230   
   231   
   231 \item [$\isarkeyword{instance}~c@1 < c@2$ and $\isarkeyword{instance}~t ::
   232 \item [$\isarkeyword{instance}~c@1 < c@2$ and $\isarkeyword{instance}~t ::
   232   (\vec s)c$] setup up a goal stating the class relation or type arity.  The
   233   (\vec s)c$] setup up a goal stating the class relation or type arity.  The
   233   proof would usually proceed by the $intro_classes$ method, and then
   234   proof would usually proceed by $intro_classes$, and then establish the
   234   establish the characteristic theorems of the type classes involved.  After
   235   characteristic theorems of the type classes involved.  After finishing the
   235   finishing the proof the theory will be augmented by a type signature
   236   proof, the theory will be augmented by a type signature declaration
   236   declaration corresponding to the resulting theorem.
   237   corresponding to the resulting theorem.
   237 \item [$intro_classes$] repeatedly expands the class introduction rules of
   238 \item [$intro_classes$] repeatedly expands all class introduction rules of
   238   this theory.
   239   this theory.
   239 \end{descr}
   240 \end{descr}
   240 
   241 
   241 See theory \texttt{HOL/Isar_examples/Group} for a simple example of using
   242 %FIXME
   242 axiomatic type classes, including instantiation proofs.
   243 %See theory \texttt{HOL/Isar_examples/Group} for a simple example of using
       
   244 %axiomatic type classes, including instantiation proofs.
   243 
   245 
   244 
   246 
   245 \section{The Simplifier}
   247 \section{The Simplifier}
   246 
   248 
   247 \subsection{Simplification methods}\label{sec:simp}
   249 \subsection{Simplification methods}\label{sec:simp}
   343   elim-resolution, after having inserted any facts.  Omitting the arguments
   345   elim-resolution, after having inserted any facts.  Omitting the arguments
   344   refers to any suitable rules from the context, otherwise only the explicitly
   346   refers to any suitable rules from the context, otherwise only the explicitly
   345   given ones may be applied.  The latter form admits better control of what
   347   given ones may be applied.  The latter form admits better control of what
   346   actually happens, thus it is very appropriate as an initial method for
   348   actually happens, thus it is very appropriate as an initial method for
   347   $\PROOFNAME$ that splits up certain connectives of the goal, before entering
   349   $\PROOFNAME$ that splits up certain connectives of the goal, before entering
   348   the actual proof.
   350   the actual sub-proof.
   349   
   351   
   350 \item [$contradiction$] solves some goal by contradiction, deriving any result
   352 \item [$contradiction$] solves some goal by contradiction, deriving any result
   351   from both $\neg A$ and $A$.  Facts, which are guaranteed to participate, may
   353   from both $\neg A$ and $A$.  Facts, which are guaranteed to participate, may
   352   appear in either order.
   354   appear in either order.
   353 \end{descr}
   355 \end{descr}
   386   reasoner (see \cite[\S11]{isabelle-ref}, tactic \texttt{fast_tac} etc).
   388   reasoner (see \cite[\S11]{isabelle-ref}, tactic \texttt{fast_tac} etc).
   387 \end{descr}
   389 \end{descr}
   388 
   390 
   389 Any of above methods support additional modifiers of the context of classical
   391 Any of above methods support additional modifiers of the context of classical
   390 rules.  There semantics is analogous to the attributes given in
   392 rules.  There semantics is analogous to the attributes given in
   391 \S\ref{sec:classical-mod}.
   393 \S\ref{sec:classical-mod}.  Facts provided by forward chaining are inserted
       
   394 into the goal before doing the search.  The ``!''~argument causes the full
       
   395 context of assumptions to be included as well.\footnote{This is slightly less
       
   396   hazardous than for the Simplifier (see \S\ref{sec:simp}).}
   392 
   397 
   393 
   398 
   394 \subsection{Combined automated methods}
   399 \subsection{Combined automated methods}
   395 
   400 
   396 \indexisarmeth{auto}\indexisarmeth{force}
   401 \indexisarmeth{auto}\indexisarmeth{force}
   401 
   406 
   402 \begin{rail}
   407 \begin{rail}
   403   ('force' | 'auto') ('!' ?) (clasimpmod * )
   408   ('force' | 'auto') ('!' ?) (clasimpmod * )
   404   ;
   409   ;
   405 
   410 
   406   clasimpmod: ('simp' ('add' | 'del' | 'only') | other |
   411   clasimpmod: ('simp' ('add' | 'del' | 'only') | 'other' |
   407     (('intro' | 'elim' | 'dest') (() | '!' | '!!') | 'del')) ':' thmrefs
   412     (('intro' | 'elim' | 'dest') (() | '!' | '!!') | 'del')) ':' thmrefs
   408 \end{rail}
   413 \end{rail}
   409 
   414 
   410 \begin{descr}
   415 \begin{descr}
   411 \item [$force$ and $auto$] provide access to Isabelle's combined
   416 \item [$force$ and $auto$] provide access to Isabelle's combined
   412   simplification and classical reasoning tactics.  See \texttt{force_tac} and
   417   simplification and classical reasoning tactics.  See \texttt{force_tac} and
   413   \texttt{auto_tac} in \cite[\S11]{isabelle-ref} for more information.  The
   418   \texttt{auto_tac} in \cite[\S11]{isabelle-ref} for more information.  The
   414   modifier arguments correspond to those given in \S\ref{sec:simp} and
   419   modifier arguments correspond to those given in \S\ref{sec:simp} and
   415   \S\ref{sec:classical-auto}.  Just note that the ones related to the
   420   \S\ref{sec:classical-auto}.  Just note that the ones related to the
   416   Simplifier are prefixed by \railtoken{simp} here.
   421   Simplifier are prefixed by \railtoken{simp} here.
   417 \end{descr}
   422   
       
   423   Facts provided by forward chaining are inserted into the goal before doing
       
   424   the search.  The ``!''~argument causes the full context of assumptions to be
       
   425   included as well.
       
   426 \end{descr}
       
   427 
   418 
   428 
   419 \subsection{Modifying the context}\label{sec:classical-mod}
   429 \subsection{Modifying the context}\label{sec:classical-mod}
   420 
   430 
   421 \indexisaratt{intro}\indexisaratt{elim}\indexisaratt{dest}
   431 \indexisaratt{intro}\indexisaratt{elim}\indexisaratt{dest}
   422 \indexisaratt{iff}\indexisaratt{delrule}
   432 \indexisaratt{iff}\indexisaratt{delrule}