doc-src/Ref/classical.tex
changeset 5576 dc6ee60d2be8
parent 5550 8375188ae9b0
child 5577 ddaa1c133c5a
equal deleted inserted replaced
5575:9ea449586464 5576:dc6ee60d2be8
    42 \end{ttbox}
    42 \end{ttbox}
    43 To do all obvious logical steps, even if they do not prove the
    43 To do all obvious logical steps, even if they do not prove the
    44 subgoal, type one of the following:
    44 subgoal, type one of the following:
    45 \begin{ttbox}
    45 \begin{ttbox}
    46 by Safe_tac;                   \emph{\textrm{applies to all subgoals}}
    46 by Safe_tac;                   \emph{\textrm{applies to all subgoals}}
    47 by (Clarify_tac \(i\));        \emph{\textrm{applies to one subgoal}}
    47 by (Clarify_tac \(i\));            \emph{\textrm{applies to one subgoal}}
    48 \end{ttbox}
    48 \end{ttbox}
    49 
    49 
    50 
    50 
    51 You need to know how the classical reasoner works in order to use it
    51 You need to know how the classical reasoner works in order to use it
    52 effectively.  There are many tactics to choose from, including 
    52 effectively.  There are many tactics to choose from, including 
   315 tried first (see \S\ref{biresolve_tac}).
   315 tried first (see \S\ref{biresolve_tac}).
   316 
   316 
   317 For elimination and destruction rules there are variants of the add operations
   317 For elimination and destruction rules there are variants of the add operations
   318 adding a rule in a way such that it is applied only if also its second premise
   318 adding a rule in a way such that it is applied only if also its second premise
   319 can be unified with an assumption of the current proof state:
   319 can be unified with an assumption of the current proof state:
       
   320 \indexbold{*addSE2}\indexbold{*addSD2}\indexbold{*addE2}\indexbold{*addD2}
   320 \begin{ttbox}
   321 \begin{ttbox}
   321 addSE2      : claset * (string * thm) -> claset           \hfill{\bf infix 4}
   322 addSE2      : claset * (string * thm) -> claset           \hfill{\bf infix 4}
   322 addSD2      : claset * (string * thm) -> claset           \hfill{\bf infix 4}
   323 addSD2      : claset * (string * thm) -> claset           \hfill{\bf infix 4}
   323 addE2       : claset * (string * thm) -> claset           \hfill{\bf infix 4}
   324 addE2       : claset * (string * thm) -> claset           \hfill{\bf infix 4}
   324 addD2       : claset * (string * thm) -> claset           \hfill{\bf infix 4}
   325 addD2       : claset * (string * thm) -> claset           \hfill{\bf infix 4}
   432 
   433 
   433 \section{The classical tactics}
   434 \section{The classical tactics}
   434 \index{classical reasoner!tactics} If installed, the classical module provides
   435 \index{classical reasoner!tactics} If installed, the classical module provides
   435 powerful theorem-proving tactics.  Most of them have capitalized analogues
   436 powerful theorem-proving tactics.  Most of them have capitalized analogues
   436 that use the default claset; see \S\ref{sec:current-claset}.
   437 that use the default claset; see \S\ref{sec:current-claset}.
   437 
       
   438 \subsection{Semi-automatic tactics}
       
   439 \begin{ttbox} 
       
   440 clarify_tac      : claset -> int -> tactic
       
   441 clarify_step_tac : claset -> int -> tactic
       
   442 clarsimp_tac     : clasimpset -> int -> tactic
       
   443 \end{ttbox}
       
   444 Use these when the automatic tactics fail.  They perform all the obvious
       
   445 logical inferences that do not split the subgoal.  The result is a
       
   446 simpler subgoal that can be tackled by other means, such as by
       
   447 instantiating quantifiers yourself.
       
   448 \begin{ttdescription}
       
   449 \item[\ttindexbold{clarify_tac} $cs$ $i$] performs a series of safe steps on
       
   450 subgoal~$i$ by repeatedly calling \texttt{clarify_step_tac}.
       
   451 \item[\ttindexbold{clarify_step_tac} $cs$ $i$] performs a safe step on
       
   452   subgoal~$i$.  No splitting step is applied; for example, the subgoal $A\conj
       
   453   B$ is left as a conjunction.  Proof by assumption, Modus Ponens, etc., may be
       
   454   performed provided they do not instantiate unknowns.  Assumptions of the
       
   455   form $x=t$ may be eliminated.  The user-supplied safe wrapper tactical is
       
   456   applied.
       
   457 \item[\ttindexbold{clarsimp_tac} $cs$ $i$] acts like \texttt{clarify_tac}, but
       
   458 also does simplification with the given simpset. Still note that if the simpset 
       
   459 includes a splitter for the premises, the subgoal may be split.
       
   460 \end{ttdescription}
       
   461 
   438 
   462 
   439 
   463 \subsection{The tableau prover}
   440 \subsection{The tableau prover}
   464 The tactic \texttt{blast_tac} searches for a proof using a fast tableau prover,
   441 The tactic \texttt{blast_tac} searches for a proof using a fast tableau prover,
   465 coded directly in \ML.  It then reconstructs the proof using Isabelle
   442 coded directly in \ML.  It then reconstructs the proof using Isabelle
   530 use the default claset and simpset (see \S\ref{sec:current-claset} below). 
   507 use the default claset and simpset (see \S\ref{sec:current-claset} below). 
   531 For interactive use, 
   508 For interactive use, 
   532 the shorthand \texttt{auto();} abbreviates \texttt{by Auto_tac;} 
   509 the shorthand \texttt{auto();} abbreviates \texttt{by Auto_tac;} 
   533 while \texttt{force 1;} abbreviates \texttt{by (Force_tac 1);}
   510 while \texttt{force 1;} abbreviates \texttt{by (Force_tac 1);}
   534 
   511 
       
   512 
       
   513 \subsection{Semi-automatic tactics}
       
   514 \begin{ttbox} 
       
   515 clarify_tac      : claset -> int -> tactic
       
   516 clarify_step_tac : claset -> int -> tactic
       
   517 clarsimp_tac     : clasimpset -> int -> tactic
       
   518 \end{ttbox}
       
   519 Use these when the automatic tactics fail.  They perform all the obvious
       
   520 logical inferences that do not split the subgoal.  The result is a
       
   521 simpler subgoal that can be tackled by other means, such as by
       
   522 instantiating quantifiers yourself.
       
   523 \begin{ttdescription}
       
   524 \item[\ttindexbold{clarify_tac} $cs$ $i$] performs a series of safe steps on
       
   525 subgoal~$i$ by repeatedly calling \texttt{clarify_step_tac}.
       
   526 \item[\ttindexbold{clarify_step_tac} $cs$ $i$] performs a safe step on
       
   527   subgoal~$i$.  No splitting step is applied; for example, the subgoal $A\conj
       
   528   B$ is left as a conjunction.  Proof by assumption, Modus Ponens, etc., may be
       
   529   performed provided they do not instantiate unknowns.  Assumptions of the
       
   530   form $x=t$ may be eliminated.  The user-supplied safe wrapper tactical is
       
   531   applied.
       
   532 \item[\ttindexbold{clarsimp_tac} $cs$ $i$] acts like \texttt{clarify_tac}, but
       
   533 also does simplification with the given simpset. Still note that if the simpset 
       
   534 includes a splitter for the premises, the subgoal may be split.
       
   535 \end{ttdescription}
       
   536 
       
   537 
   535 \subsection{Other classical tactics}
   538 \subsection{Other classical tactics}
   536 \begin{ttbox} 
   539 \begin{ttbox} 
   537 fast_tac      : claset -> int -> tactic
   540 fast_tac      : claset -> int -> tactic
   538 best_tac      : claset -> int -> tactic
   541 best_tac      : claset -> int -> tactic
   539 slow_tac      : claset -> int -> tactic
   542 slow_tac      : claset -> int -> tactic
   617   resembles \texttt{step_tac}, but allows backtracking between using safe
   620   resembles \texttt{step_tac}, but allows backtracking between using safe
   618   rules with instantiation (\texttt{inst_step_tac}) and using unsafe rules.
   621   rules with instantiation (\texttt{inst_step_tac}) and using unsafe rules.
   619   The resulting search space is larger.
   622   The resulting search space is larger.
   620 \end{ttdescription}
   623 \end{ttdescription}
   621 
   624 
       
   625 
   622 \subsection{The current claset}\label{sec:current-claset}
   626 \subsection{The current claset}\label{sec:current-claset}
   623 
   627 
   624 Each theory is equipped with an implicit \emph{current
   628 Each theory is equipped with an implicit \emph{current claset}
   625   claset}\index{claset!current}.  This is a default set of classical
   629 \index{claset!current}.  This is a default set of classical
   626 rules.  The underlying idea is quite similar to that of a current
   630 rules.  The underlying idea is quite similar to that of a current
   627 simpset described in \S\ref{sec:simp-for-dummies}; please read that
   631 simpset described in \S\ref{sec:simp-for-dummies}; please read that
   628 section, including its warnings.  The implicit claset can be accessed
   632 section, including its warnings.  
   629 as follows:
       
   630 \begin{ttbox}
       
   631 claset        : unit -> claset
       
   632 claset_ref    : unit -> claset ref
       
   633 claset_of     : theory -> claset
       
   634 claset_ref_of : theory -> claset ref
       
   635 print_claset  : theory -> unit
       
   636 \end{ttbox}
       
   637 
   633 
   638 The tactics
   634 The tactics
   639 \begin{ttbox}
   635 \begin{ttbox}
   640 Blast_tac        : int -> tactic
   636 Blast_tac        : int -> tactic
   641 Auto_tac         :        tactic
   637 Auto_tac         :        tactic
   651 Step_tac         : int -> tactic
   647 Step_tac         : int -> tactic
   652 \end{ttbox}
   648 \end{ttbox}
   653 \indexbold{*Blast_tac}\indexbold{*Auto_tac}\indexbold{*Force_tac}
   649 \indexbold{*Blast_tac}\indexbold{*Auto_tac}\indexbold{*Force_tac}
   654 \indexbold{*Best_tac}\indexbold{*Fast_tac}%
   650 \indexbold{*Best_tac}\indexbold{*Fast_tac}%
   655 \indexbold{*Deepen_tac}
   651 \indexbold{*Deepen_tac}
   656 \indexbold{*Clarify_tac}\indexbold{*Clarify_step_tac}
   652 \indexbold{*Clarify_tac}\indexbold{*Clarify_step_tac}\indexbold{*Clarsimp_tac}
   657 \indexbold{*Safe_tac}\indexbold{*Safe_step_tac}
   653 \indexbold{*Safe_tac}\indexbold{*Safe_step_tac}
   658 \indexbold{*Step_tac}
   654 \indexbold{*Step_tac}
   659 make use of the current claset.  For example, \texttt{Blast_tac} is defined as 
   655 make use of the current claset.  For example, \texttt{Blast_tac} is defined as 
   660 \begin{ttbox}
   656 \begin{ttbox}
   661 fun Blast_tac i st = blast_tac (claset()) i st;
   657 fun Blast_tac i st = blast_tac (claset()) i st;
   662 \end{ttbox}
   658 \end{ttbox}
   663 and gets the current claset, only after it is applied to a proof
   659 and gets the current claset, only after it is applied to a proof state.  
   664 state.  The functions
   660 The functions
   665 \begin{ttbox}
   661 \begin{ttbox}
   666 AddSIs, AddSEs, AddSDs, AddIs, AddEs, AddDs: thm list -> unit
   662 AddSIs, AddSEs, AddSDs, AddIs, AddEs, AddDs: thm list -> unit
   667 \end{ttbox}
   663 \end{ttbox}
   668 \indexbold{*AddSIs} \indexbold{*AddSEs} \indexbold{*AddSDs}
   664 \indexbold{*AddSIs} \indexbold{*AddSEs} \indexbold{*AddSDs}
   669 \indexbold{*AddIs} \indexbold{*AddEs} \indexbold{*AddDs}
   665 \indexbold{*AddIs} \indexbold{*AddEs} \indexbold{*AddDs}
   671 lower case counterparts, such as \texttt{addSIs}.  Calling
   667 lower case counterparts, such as \texttt{addSIs}.  Calling
   672 \begin{ttbox}
   668 \begin{ttbox}
   673 Delrules : thm list -> unit
   669 Delrules : thm list -> unit
   674 \end{ttbox}
   670 \end{ttbox}
   675 deletes rules from the current claset. 
   671 deletes rules from the current claset. 
       
   672 
       
   673 
       
   674 \subsection{Accessing the current claset}
       
   675 \label{sec:access-current-claset}
       
   676 
       
   677 the functions to access the current claset are analogous to the functions 
       
   678 for the current simpset, so please see \label{sec:access-current-simpset}
       
   679 for a description.
       
   680 \begin{ttbox}
       
   681 claset        : unit   -> claset
       
   682 claset_ref    : unit   -> claset ref
       
   683 claset_of     : theory -> claset
       
   684 claset_ref_of : theory -> claset ref
       
   685 print_claset  : theory -> unit
       
   686 CLASET        :(claset     ->       tactic) ->       tactic
       
   687 CLASET'       :(claset     -> 'a -> tactic) -> 'a -> tactic
       
   688 
       
   689 CLASIMPSET    :(clasimpset ->       tactic) ->       tactic
       
   690 CLASIMPSET'   :(clasimpset -> 'a -> tactic) -> 'a -> tactic
       
   691 \end{ttbox}
       
   692 
   676 
   693 
   677 \subsection{Other useful tactics}
   694 \subsection{Other useful tactics}
   678 \index{tactics!for contradiction}
   695 \index{tactics!for contradiction}
   679 \index{tactics!for Modus Ponens}
   696 \index{tactics!for Modus Ponens}
   680 \begin{ttbox} 
   697 \begin{ttbox}