author | bulwahn |
Thu, 09 Jun 2011 08:32:18 +0200 | |
changeset 43313 | d3c34987863b |
parent 42931 | ac4094f30a44 |
child 43366 | 9cbcab5c780a |
permissions | -rw-r--r-- |
30184
37969710e61f
removed parts of the manual that are clearly obsolete, or covered by
wenzelm
parents:
12366
diff
changeset
|
1 |
|
319 | 2 |
\chapter{The Classical Reasoner}\label{chap:classical} |
286 | 3 |
\index{classical reasoner|(} |
308 | 4 |
\newcommand\ainfer[2]{\begin{array}{r@{\,}l}#2\\ \hline#1\end{array}} |
5 |
||
104 | 6 |
\section{Classical rule sets} |
319 | 7 |
\index{classical sets} |
104 | 8 |
|
5550 | 9 |
For elimination and destruction rules there are variants of the add operations |
10 |
adding a rule in a way such that it is applied only if also its second premise |
|
11 |
can be unified with an assumption of the current proof state: |
|
5576
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
12 |
\indexbold{*addSE2}\indexbold{*addSD2}\indexbold{*addE2}\indexbold{*addD2} |
5550 | 13 |
\begin{ttbox} |
14 |
addSE2 : claset * (string * thm) -> claset \hfill{\bf infix 4} |
|
15 |
addSD2 : claset * (string * thm) -> claset \hfill{\bf infix 4} |
|
16 |
addE2 : claset * (string * thm) -> claset \hfill{\bf infix 4} |
|
17 |
addD2 : claset * (string * thm) -> claset \hfill{\bf infix 4} |
|
18 |
\end{ttbox} |
|
19 |
\begin{warn} |
|
20 |
A rule to be added in this special way must be given a name, which is used |
|
21 |
to delete it again -- when desired -- using \texttt{delSWrappers} or |
|
22 |
\texttt{delWrappers}, respectively. This is because these add operations |
|
23 |
are implemented as wrappers (see \ref{sec:modifying-search} below). |
|
24 |
\end{warn} |
|
25 |
||
1099 | 26 |
|
27 |
\subsection{Modifying the search step} |
|
4665 | 28 |
\label{sec:modifying-search} |
3716 | 29 |
For a given classical set, the proof strategy is simple. Perform as many safe |
30 |
inferences as possible; or else, apply certain safe rules, allowing |
|
31 |
instantiation of unknowns; or else, apply an unsafe rule. The tactics also |
|
32 |
eliminate assumptions of the form $x=t$ by substitution if they have been set |
|
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
33 |
up to do so (see \texttt{hyp_subst_tacs} in~{\S}\ref{sec:classical-setup} below). |
3716 | 34 |
They may perform a form of Modus Ponens: if there are assumptions $P\imp Q$ |
35 |
and~$P$, then replace $P\imp Q$ by~$Q$. |
|
104 | 36 |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
37 |
The classical reasoning tactics --- except \texttt{blast_tac}! --- allow |
4649 | 38 |
you to modify this basic proof strategy by applying two lists of arbitrary |
39 |
{\bf wrapper tacticals} to it. |
|
40 |
The first wrapper list, which is considered to contain safe wrappers only, |
|
41 |
affects \ttindex{safe_step_tac} and all the tactics that call it. |
|
5550 | 42 |
The second one, which may contain unsafe wrappers, affects the unsafe parts |
43 |
of \ttindex{step_tac}, \ttindex{slow_step_tac}, and the tactics that call them. |
|
4649 | 44 |
A wrapper transforms each step of the search, for example |
5550 | 45 |
by attempting other tactics before or after the original step tactic. |
4649 | 46 |
All members of a wrapper list are applied in turn to the respective step tactic. |
47 |
||
48 |
Initially the two wrapper lists are empty, which means no modification of the |
|
49 |
step tactics. Safe and unsafe wrappers are added to a claset |
|
50 |
with the functions given below, supplying them with wrapper names. |
|
51 |
These names may be used to selectively delete wrappers. |
|
1099 | 52 |
|
53 |
\begin{ttbox} |
|
4649 | 54 |
type wrapper = (int -> tactic) -> (int -> tactic); |
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
55 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
56 |
addSWrapper : claset * (string * wrapper ) -> claset \hfill{\bf infix 4} |
4649 | 57 |
addSbefore : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4} |
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
58 |
addSafter : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4} |
4649 | 59 |
delSWrapper : claset * string -> claset \hfill{\bf infix 4} |
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
60 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
61 |
addWrapper : claset * (string * wrapper ) -> claset \hfill{\bf infix 4} |
4649 | 62 |
addbefore : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4} |
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
63 |
addafter : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4} |
4649 | 64 |
delWrapper : claset * string -> claset \hfill{\bf infix 4} |
65 |
||
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
66 |
addSss : claset * simpset -> claset \hfill{\bf infix 4} |
2632 | 67 |
addss : claset * simpset -> claset \hfill{\bf infix 4} |
1099 | 68 |
\end{ttbox} |
69 |
% |
|
70 |
||
71 |
\begin{ttdescription} |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
72 |
\item[$cs$ addSWrapper $(name,wrapper)$] \indexbold{*addSWrapper} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
73 |
adds a new wrapper, which should yield a safe tactic, |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
74 |
to modify the existing safe step tactic. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
75 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
76 |
\item[$cs$ addSbefore $(name,tac)$] \indexbold{*addSbefore} |
5550 | 77 |
adds the given tactic as a safe wrapper, such that it is tried |
78 |
{\em before} each safe step of the search. |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
79 |
|
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
80 |
\item[$cs$ addSafter $(name,tac)$] \indexbold{*addSafter} |
5550 | 81 |
adds the given tactic as a safe wrapper, such that it is tried |
82 |
when a safe step of the search would fail. |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
83 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
84 |
\item[$cs$ delSWrapper $name$] \indexbold{*delSWrapper} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
85 |
deletes the safe wrapper with the given name. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
86 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
87 |
\item[$cs$ addWrapper $(name,wrapper)$] \indexbold{*addWrapper} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
88 |
adds a new wrapper to modify the existing (unsafe) step tactic. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
89 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
90 |
\item[$cs$ addbefore $(name,tac)$] \indexbold{*addbefore} |
5550 | 91 |
adds the given tactic as an unsafe wrapper, such that it its result is |
92 |
concatenated {\em before} the result of each unsafe step. |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
93 |
|
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
94 |
\item[$cs$ addafter $(name,tac)$] \indexbold{*addafter} |
5550 | 95 |
adds the given tactic as an unsafe wrapper, such that it its result is |
96 |
concatenated {\em after} the result of each unsafe step. |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
97 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
98 |
\item[$cs$ delWrapper $name$] \indexbold{*delWrapper} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
99 |
deletes the unsafe wrapper with the given name. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
100 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
101 |
\item[$cs$ addSss $ss$] \indexbold{*addss} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
102 |
adds the simpset~$ss$ to the classical set. The assumptions and goal will be |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
103 |
simplified, in a rather safe way, after each safe step of the search. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
104 |
|
1099 | 105 |
\item[$cs$ addss $ss$] \indexbold{*addss} |
3485
f27a30a18a17
Now there are TWO spaces after each full stop, so that the Emacs sentence
paulson
parents:
3224
diff
changeset
|
106 |
adds the simpset~$ss$ to the classical set. The assumptions and goal will be |
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
107 |
simplified, before the each unsafe step of the search. |
2631
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
108 |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
109 |
\end{ttdescription} |
2631
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
110 |
|
5550 | 111 |
\index{simplification!from classical reasoner} |
112 |
Strictly speaking, the operators \texttt{addss} and \texttt{addSss} |
|
113 |
are not part of the classical reasoner. |
|
114 |
, which are used as primitives |
|
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
115 |
for the automatic tactics described in {\S}\ref{sec:automatic-tactics}, are |
5550 | 116 |
implemented as wrapper tacticals. |
117 |
they |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
118 |
\begin{warn} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
119 |
Being defined as wrappers, these operators are inappropriate for adding more |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
120 |
than one simpset at a time: the simpset added last overwrites any earlier ones. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
121 |
When a simpset combined with a claset is to be augmented, this should done |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
122 |
{\em before} combining it with the claset. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
123 |
\end{warn} |
1099 | 124 |
|
104 | 125 |
|
126 |
\section{The classical tactics} |
|
5576
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
127 |
|
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
128 |
\subsection{Semi-automatic tactics} |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
129 |
\begin{ttbox} |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
130 |
clarify_step_tac : claset -> int -> tactic |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
131 |
\end{ttbox} |
42930 | 132 |
|
5576
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
133 |
\begin{ttdescription} |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
134 |
\item[\ttindexbold{clarify_step_tac} $cs$ $i$] performs a safe step on |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
135 |
subgoal~$i$. No splitting step is applied; for example, the subgoal $A\conj |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
136 |
B$ is left as a conjunction. Proof by assumption, Modus Ponens, etc., may be |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
137 |
performed provided they do not instantiate unknowns. Assumptions of the |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
138 |
form $x=t$ may be eliminated. The user-supplied safe wrapper tactical is |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
139 |
applied. |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
140 |
\end{ttdescription} |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
141 |
|
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
142 |
|
3224 | 143 |
\subsection{Other classical tactics} |
332 | 144 |
\begin{ttbox} |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
145 |
slow_best_tac : claset -> int -> tactic |
332 | 146 |
\end{ttbox} |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
147 |
|
332 | 148 |
\begin{ttdescription} |
8136 | 149 |
\item[\ttindexbold{slow_best_tac} $cs$ $i$] applies \texttt{slow_step_tac} with |
150 |
best-first search to prove subgoal~$i$. |
|
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
151 |
\end{ttdescription} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
152 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
153 |
|
3716 | 154 |
\subsection{Depth-limited automatic tactics} |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
155 |
\begin{ttbox} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
156 |
depth_tac : claset -> int -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
157 |
deepen_tac : claset -> int -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
158 |
\end{ttbox} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
159 |
These work by exhaustive search up to a specified depth. Unsafe rules are |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
160 |
modified to preserve the formula they act on, so that it be used repeatedly. |
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
161 |
They can prove more goals than \texttt{fast_tac} can but are much |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
162 |
slower, for example if the assumptions have many universal quantifiers. |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
163 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
164 |
The depth limits the number of unsafe steps. If you can estimate the minimum |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
165 |
number of unsafe steps needed, supply this value as~$m$ to save time. |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
166 |
\begin{ttdescription} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
167 |
\item[\ttindexbold{depth_tac} $cs$ $m$ $i$] |
3089 | 168 |
tries to prove subgoal~$i$ by exhaustive search up to depth~$m$. |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
169 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
170 |
\item[\ttindexbold{deepen_tac} $cs$ $m$ $i$] |
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
171 |
tries to prove subgoal~$i$ by iterative deepening. It calls \texttt{depth_tac} |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
172 |
repeatedly with increasing depths, starting with~$m$. |
332 | 173 |
\end{ttdescription} |
174 |
||
175 |
||
104 | 176 |
\subsection{Single-step tactics} |
177 |
\begin{ttbox} |
|
178 |
safe_step_tac : claset -> int -> tactic |
|
179 |
inst_step_tac : claset -> int -> tactic |
|
180 |
step_tac : claset -> int -> tactic |
|
181 |
slow_step_tac : claset -> int -> tactic |
|
182 |
\end{ttbox} |
|
183 |
The automatic proof procedures call these tactics. By calling them |
|
184 |
yourself, you can execute these procedures one step at a time. |
|
308 | 185 |
\begin{ttdescription} |
104 | 186 |
\item[\ttindexbold{safe_step_tac} $cs$ $i$] performs a safe step on |
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
187 |
subgoal~$i$. The safe wrapper tacticals are applied to a tactic that may |
3716 | 188 |
include proof by assumption or Modus Ponens (taking care not to instantiate |
189 |
unknowns), or substitution. |
|
104 | 190 |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
191 |
\item[\ttindexbold{inst_step_tac} $cs$ $i$] is like \texttt{safe_step_tac}, |
104 | 192 |
but allows unknowns to be instantiated. |
193 |
||
1099 | 194 |
\item[\ttindexbold{step_tac} $cs$ $i$] is the basic step of the proof |
8136 | 195 |
procedure. The unsafe wrapper tacticals are applied to a tactic that tries |
196 |
\texttt{safe_tac}, \texttt{inst_step_tac}, or applies an unsafe rule |
|
197 |
from~$cs$. |
|
104 | 198 |
|
199 |
\item[\ttindexbold{slow_step_tac}] |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
200 |
resembles \texttt{step_tac}, but allows backtracking between using safe |
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
201 |
rules with instantiation (\texttt{inst_step_tac}) and using unsafe rules. |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
202 |
The resulting search space is larger. |
308 | 203 |
\end{ttdescription} |
104 | 204 |
|
5576
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
205 |
|
104 | 206 |
\subsection{Other useful tactics} |
319 | 207 |
\index{tactics!for contradiction} |
208 |
\index{tactics!for Modus Ponens} |
|
104 | 209 |
\begin{ttbox} |
210 |
contr_tac : int -> tactic |
|
211 |
mp_tac : int -> tactic |
|
212 |
eq_mp_tac : int -> tactic |
|
213 |
swap_res_tac : thm list -> int -> tactic |
|
214 |
\end{ttbox} |
|
215 |
These can be used in the body of a specialized search. |
|
308 | 216 |
\begin{ttdescription} |
319 | 217 |
\item[\ttindexbold{contr_tac} {\it i}]\index{assumptions!contradictory} |
218 |
solves subgoal~$i$ by detecting a contradiction among two assumptions of |
|
219 |
the form $P$ and~$\neg P$, or fail. It may instantiate unknowns. The |
|
220 |
tactic can produce multiple outcomes, enumerating all possible |
|
221 |
contradictions. |
|
104 | 222 |
|
223 |
\item[\ttindexbold{mp_tac} {\it i}] |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
224 |
is like \texttt{contr_tac}, but also attempts to perform Modus Ponens in |
104 | 225 |
subgoal~$i$. If there are assumptions $P\imp Q$ and~$P$, then it replaces |
226 |
$P\imp Q$ by~$Q$. It may instantiate unknowns. It fails if it can do |
|
227 |
nothing. |
|
228 |
||
229 |
\item[\ttindexbold{eq_mp_tac} {\it i}] |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
230 |
is like \texttt{mp_tac} {\it i}, but may not instantiate unknowns --- thus, it |
104 | 231 |
is safe. |
232 |
||
233 |
\item[\ttindexbold{swap_res_tac} {\it thms} {\it i}] refines subgoal~$i$ of |
|
234 |
the proof state using {\it thms}, which should be a list of introduction |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
235 |
rules. First, it attempts to prove the goal using \texttt{assume_tac} or |
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
236 |
\texttt{contr_tac}. It then attempts to apply each rule in turn, attempting |
104 | 237 |
resolution and also elim-resolution with the swapped form. |
308 | 238 |
\end{ttdescription} |
104 | 239 |
|
240 |
||
3716 | 241 |
\section{Setting up the classical reasoner}\label{sec:classical-setup} |
319 | 242 |
\index{classical reasoner!setting up} |
5550 | 243 |
Isabelle's classical object-logics, including \texttt{FOL} and \texttt{HOL}, |
244 |
have the classical reasoner already set up. |
|
245 |
When defining a new classical logic, you should set up the reasoner yourself. |
|
246 |
It consists of the \ML{} functor \ttindex{ClassicalFun}, which takes the |
|
247 |
argument signature \texttt{CLASSICAL_DATA}: |
|
104 | 248 |
\begin{ttbox} |
249 |
signature CLASSICAL_DATA = |
|
250 |
sig |
|
251 |
val mp : thm |
|
252 |
val not_elim : thm |
|
253 |
val swap : thm |
|
254 |
val sizef : thm -> int |
|
255 |
val hyp_subst_tacs : (int -> tactic) list |
|
256 |
end; |
|
257 |
\end{ttbox} |
|
258 |
Thus, the functor requires the following items: |
|
308 | 259 |
\begin{ttdescription} |
319 | 260 |
\item[\tdxbold{mp}] should be the Modus Ponens rule |
104 | 261 |
$\List{\Var{P}\imp\Var{Q};\; \Var{P}} \Imp \Var{Q}$. |
262 |
||
319 | 263 |
\item[\tdxbold{not_elim}] should be the contradiction rule |
104 | 264 |
$\List{\neg\Var{P};\; \Var{P}} \Imp \Var{R}$. |
265 |
||
319 | 266 |
\item[\tdxbold{swap}] should be the swap rule |
104 | 267 |
$\List{\neg \Var{P}; \; \neg \Var{R}\Imp \Var{P}} \Imp \Var{R}$. |
268 |
||
269 |
\item[\ttindexbold{sizef}] is the heuristic function used for best-first |
|
270 |
search. It should estimate the size of the remaining subgoals. A good |
|
271 |
heuristic function is \ttindex{size_of_thm}, which measures the size of the |
|
272 |
proof state. Another size function might ignore certain subgoals (say, |
|
6170 | 273 |
those concerned with type-checking). A heuristic function might simply |
104 | 274 |
count the subgoals. |
275 |
||
319 | 276 |
\item[\ttindexbold{hyp_subst_tacs}] is a list of tactics for substitution in |
104 | 277 |
the hypotheses, typically created by \ttindex{HypsubstFun} (see |
278 |
Chapter~\ref{substitution}). This list can, of course, be empty. The |
|
279 |
tactics are assumed to be safe! |
|
308 | 280 |
\end{ttdescription} |
104 | 281 |
The functor is not at all sensitive to the formalization of the |
3108 | 282 |
object-logic. It does not even examine the rules, but merely applies |
283 |
them according to its fixed strategy. The functor resides in {\tt |
|
284 |
Provers/classical.ML} in the Isabelle sources. |
|
104 | 285 |
|
319 | 286 |
\index{classical reasoner|)} |
5371 | 287 |
|
288 |
%%% Local Variables: |
|
289 |
%%% mode: latex |
|
290 |
%%% TeX-master: "ref" |
|
291 |
%%% End: |