220 \subsection{Inspecting simpsets} |
220 \subsection{Inspecting simpsets} |
221 \begin{ttbox} |
221 \begin{ttbox} |
222 print_ss : simpset -> unit |
222 print_ss : simpset -> unit |
223 rep_ss : simpset -> \{mss : meta_simpset, |
223 rep_ss : simpset -> \{mss : meta_simpset, |
224 subgoal_tac: simpset -> int -> tactic, |
224 subgoal_tac: simpset -> int -> tactic, |
225 loop_tac : int -> tactic, |
225 loop_tacs : (string * (int -> tactic))list, |
226 finish_tac : thm list -> int -> tactic, |
226 finish_tac : solver list, |
227 unsafe_finish_tac : thm list -> int -> tactic\} |
227 unsafe_finish_tac : solver list\} |
228 \end{ttbox} |
228 \end{ttbox} |
229 \begin{ttdescription} |
229 \begin{ttdescription} |
230 |
230 |
231 \item[\ttindexbold{print_ss} $ss$;] displays the printable contents of |
231 \item[\ttindexbold{print_ss} $ss$;] displays the printable contents of |
232 simpset $ss$. This includes the rewrite rules and congruences in |
232 simpset $ss$. This includes the rewrite rules and congruences in |
534 if that fails. |
534 if that fails. |
535 |
535 |
536 |
536 |
537 \subsection{*The solver}\label{sec:simp-solver} |
537 \subsection{*The solver}\label{sec:simp-solver} |
538 \begin{ttbox} |
538 \begin{ttbox} |
539 setSolver : simpset * (thm list -> int -> tactic) -> simpset \hfill{\bf infix 4} |
539 mk_solver : string -> (thm list -> int -> tactic) -> solver |
540 addSolver : simpset * (thm list -> int -> tactic) -> simpset \hfill{\bf infix 4} |
540 setSolver : simpset * solver -> simpset \hfill{\bf infix 4} |
541 setSSolver : simpset * (thm list -> int -> tactic) -> simpset \hfill{\bf infix 4} |
541 addSolver : simpset * solver -> simpset \hfill{\bf infix 4} |
542 addSSolver : simpset * (thm list -> int -> tactic) -> simpset \hfill{\bf infix 4} |
542 setSSolver : simpset * solver -> simpset \hfill{\bf infix 4} |
543 \end{ttbox} |
543 addSSolver : simpset * solver -> simpset \hfill{\bf infix 4} |
544 |
544 \end{ttbox} |
545 The solver is a pair of tactics that attempt to solve a subgoal after |
545 |
|
546 A solver is a tactic that attempts to solve a subgoal after |
546 simplification. Typically it just proves trivial subgoals such as |
547 simplification. Typically it just proves trivial subgoals such as |
547 \texttt{True} and $t=t$. It could use sophisticated means such as {\tt |
548 \texttt{True} and $t=t$. It could use sophisticated means such as {\tt |
548 blast_tac}, though that could make simplification expensive. |
549 blast_tac}, though that could make simplification expensive. |
|
550 To keep things more abstract, solvers are packaged up in type |
|
551 \texttt{solver}. The only way to create a solver is via \texttt{mk_solver}. |
549 |
552 |
550 Rewriting does not instantiate unknowns. For example, rewriting |
553 Rewriting does not instantiate unknowns. For example, rewriting |
551 cannot prove $a\in \Var{A}$ since this requires |
554 cannot prove $a\in \Var{A}$ since this requires |
552 instantiating~$\Var{A}$. The solver, however, is an arbitrary tactic |
555 instantiating~$\Var{A}$. The solver, however, is an arbitrary tactic |
553 and may instantiate unknowns as it pleases. This is the only way the |
556 and may instantiate unknowns as it pleases. This is the only way the |
554 simplifier can handle a conditional rewrite rule whose condition |
557 simplifier can handle a conditional rewrite rule whose condition |
555 contains extra variables. When a simplification tactic is to be |
558 contains extra variables. When a simplification tactic is to be |
556 combined with other provers, especially with the classical reasoner, |
559 combined with other provers, especially with the classical reasoner, |
557 it is important whether it can be considered safe or not. For this |
560 it is important whether it can be considered safe or not. For this |
558 reason the solver is split into a safe and an unsafe part. |
561 reason a simpset contains two solvers, a safe and an unsafe one. |
559 |
562 |
560 The standard simplification strategy solely uses the unsafe solver, |
563 The standard simplification strategy solely uses the unsafe solver, |
561 which is appropriate in most cases. For special applications where |
564 which is appropriate in most cases. For special applications where |
562 the simplification process is not allowed to instantiate unknowns |
565 the simplification process is not allowed to instantiate unknowns |
563 within the goal, simplification starts with the safe solver, but may |
566 within the goal, simplification starts with the safe solver, but may |
564 still apply the ordinary unsafe one in nested simplifications for |
567 still apply the ordinary unsafe one in nested simplifications for |
565 conditional rules or congruences. |
568 conditional rules or congruences. |
566 |
569 |
567 \begin{ttdescription} |
570 \begin{ttdescription} |
568 |
571 \item[\ttindexbold{mk_solver} $s$ $tacf$] converts $tacf$ into a new solver; |
|
572 the string $s$ is only attached as a comment and has no other significance. |
|
573 |
569 \item[$ss$ \ttindexbold{setSSolver} $tacf$] installs $tacf$ as the |
574 \item[$ss$ \ttindexbold{setSSolver} $tacf$] installs $tacf$ as the |
570 \emph{safe} solver of $ss$. |
575 \emph{safe} solver of $ss$. |
571 |
576 |
572 \item[$ss$ \ttindexbold{addSSolver} $tacf$] adds $tacf$ as an |
577 \item[$ss$ \ttindexbold{addSSolver} $tacf$] adds $tacf$ as an |
573 additional \emph{safe} solver; it will be tried after the solvers |
578 additional \emph{safe} solver; it will be tried after the solvers |