271 \begin{ttbox} |
271 \begin{ttbox} |
272 simpset : unit -> simpset |
272 simpset : unit -> simpset |
273 simpset_ref : unit -> simpset ref |
273 simpset_ref : unit -> simpset ref |
274 simpset_of : theory -> simpset |
274 simpset_of : theory -> simpset |
275 simpset_ref_of : theory -> simpset ref |
275 simpset_ref_of : theory -> simpset ref |
|
276 SIMPSET : (simpset -> tactic) -> tactic |
|
277 SIMPSET' : (simpset -> 'a -> tactic) -> 'a -> tactic |
276 print_simpset : theory -> unit |
278 print_simpset : theory -> unit |
277 \end{ttbox} |
279 \end{ttbox} |
278 |
280 |
279 Each theory contains a current simpset\index{simpset!current} stored |
281 Each theory contains a current simpset\index{simpset!current} stored |
280 within a private ML reference variable. This can be retrieved and |
282 within a private ML reference variable. This can be retrieved and |
293 from theory $thy$. |
295 from theory $thy$. |
294 |
296 |
295 \item[\ttindexbold{simpset_ref_of} $thy$;] retrieves the simpset |
297 \item[\ttindexbold{simpset_ref_of} $thy$;] retrieves the simpset |
296 reference variable from theory $thy$. |
298 reference variable from theory $thy$. |
297 |
299 |
|
300 \item[\ttindexbold{SIMPSET} $tacf$, \ttindexbold{SIMPSET'} $tacf'$] |
|
301 are tacticals that make a tactic depend on the implicit current |
|
302 simpset of the theory associated with the proof state they are |
|
303 applied on. |
|
304 |
298 \item[\ttindexbold{print_simpset} $thy$;] prints the current simpset |
305 \item[\ttindexbold{print_simpset} $thy$;] prints the current simpset |
299 of theory $thy$ in the same way as \texttt{print_ss}. |
306 of theory $thy$ in the same way as \texttt{print_ss}. |
300 |
307 |
301 \end{ttdescription} |
308 \end{ttdescription} |
|
309 |
|
310 \begin{warn} |
|
311 There is a subtle difference between \texttt{(SIMPSET'~$tacf$)} and |
|
312 \texttt{($tacf$~(simpset()))}. For example \texttt{(SIMPSET' |
|
313 simp_tac)} would depend on the theory of the proof state it is |
|
314 applied to, while \texttt{(simp_tac (simpset()))} implicitly refers |
|
315 to the current theory context. Both are usually the same in proof |
|
316 scripts, provided that goals are only stated within the current |
|
317 theory. Robust programs would not count on that, of course. |
|
318 \end{warn} |
302 |
319 |
303 |
320 |
304 \subsection{Rewrite rules} |
321 \subsection{Rewrite rules} |
305 \begin{ttbox} |
322 \begin{ttbox} |
306 addsimps : simpset * thm list -> simpset \hfill{\bf infix 4} |
323 addsimps : simpset * thm list -> simpset \hfill{\bf infix 4} |
685 simp_tac : simpset -> int -> tactic |
702 simp_tac : simpset -> int -> tactic |
686 asm_simp_tac : simpset -> int -> tactic |
703 asm_simp_tac : simpset -> int -> tactic |
687 full_simp_tac : simpset -> int -> tactic |
704 full_simp_tac : simpset -> int -> tactic |
688 asm_full_simp_tac : simpset -> int -> tactic |
705 asm_full_simp_tac : simpset -> int -> tactic |
689 safe_asm_full_simp_tac : simpset -> int -> tactic |
706 safe_asm_full_simp_tac : simpset -> int -> tactic |
690 SIMPSET : (simpset -> tactic) -> tactic |
|
691 SIMPSET' : (simpset -> 'a -> tactic) -> 'a -> tactic |
|
692 \end{ttbox} |
707 \end{ttbox} |
693 |
708 |
694 These are the basic tactics that are underlying any actual |
709 These are the basic tactics that are underlying any actual |
695 simplification work. The rewriting strategy is always strictly bottom |
710 simplification work. The rewriting strategy is always strictly bottom |
696 up, except for congruence rules, which are applied while descending |
711 up, except for congruence rules, which are applied while descending |
709 \texttt{asm_full_simp_tac}, but uses the safe solver as explained in |
724 \texttt{asm_full_simp_tac}, but uses the safe solver as explained in |
710 \S\ref{sec:simp-solver}. This tactic is mainly intended for |
725 \S\ref{sec:simp-solver}. This tactic is mainly intended for |
711 building special tools, e.g.\ for combining the simplifier with the |
726 building special tools, e.g.\ for combining the simplifier with the |
712 classical reasoner. It is rarely used directly. |
727 classical reasoner. It is rarely used directly. |
713 |
728 |
714 \item[\ttindexbold{SIMPSET} $tacf$, \ttindexbold{SIMPSET'} $tacf'$] |
|
715 are tacticals that make a tactic depend on the implicit current |
|
716 simpset of the theory associated with the proof state they are |
|
717 applied on. |
|
718 |
|
719 \end{ttdescription} |
729 \end{ttdescription} |
720 |
730 |
721 \medskip |
731 \medskip |
722 |
732 |
723 Local modifications of simpsets within a proof are often much cleaner |
733 Local modifications of simpsets within a proof are often much cleaner |
740 \S\ref{sec:simp-for-dummies}) should be considered harmful outside of |
750 \S\ref{sec:simp-for-dummies}) should be considered harmful outside of |
741 actual proof scripts. In particular, ML programs like theory |
751 actual proof scripts. In particular, ML programs like theory |
742 definition packages or special tactics should refer to simpsets only |
752 definition packages or special tactics should refer to simpsets only |
743 explicitly, via the above tactics used in conjunction with |
753 explicitly, via the above tactics used in conjunction with |
744 \texttt{simpset_of} or the \texttt{SIMPSET} tacticals. |
754 \texttt{simpset_of} or the \texttt{SIMPSET} tacticals. |
745 |
|
746 \begin{warn} |
|
747 There is a subtle difference between \texttt{(SIMPSET'~$tacf$)} and |
|
748 \texttt{($tacf$~(simpset()))}. For example \texttt{(SIMPSET' |
|
749 simp_tac)} would depend on the theory of the proof state it is |
|
750 applied to, while \texttt{(simp_tac (simpset()))} implicitly refers |
|
751 to the current theory context. Both are usually the same in proof |
|
752 scripts, provided that goals are only stated within the current |
|
753 theory. Robust programs would not count on that, of course. |
|
754 \end{warn} |
|
755 |
755 |
756 |
756 |
757 \section{Forward rules and conversions} |
757 \section{Forward rules and conversions} |
758 \index{simplification!forward rules}\index{simplification!conversions} |
758 \index{simplification!forward rules}\index{simplification!conversions} |
759 \begin{ttbox}\index{*simplify}\index{*asm_simplify}\index{*full_simplify}\index{*asm_full_simplify}\index{*Simplifier.rewrite}\index{*Simplifier.asm_rewrite}\index{*Simplifier.full_rewrite}\index{*Simplifier.asm_full_rewrite} |
759 \begin{ttbox}\index{*simplify}\index{*asm_simplify}\index{*full_simplify}\index{*asm_full_simplify}\index{*Simplifier.rewrite}\index{*Simplifier.asm_rewrite}\index{*Simplifier.full_rewrite}\index{*Simplifier.asm_full_rewrite} |