author | wenzelm |
Sat, 04 Jun 2011 22:09:42 +0200 | |
changeset 42927 | c40adab7568e |
parent 42840 | e87888b4152f |
child 42928 | 9d946de41120 |
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} |
8 |
Each automatic tactic takes a {\bf classical set} --- a collection of |
|
104 | 9 |
rules, classified as introduction or elimination and as {\bf safe} or {\bf |
10 |
unsafe}. In general, safe rules can be attempted blindly, while unsafe |
|
11 |
rules must be used with care. A safe rule must never reduce a provable |
|
308 | 12 |
goal to an unprovable set of subgoals. |
104 | 13 |
|
308 | 14 |
The rule~$({\disj}I1)$ is unsafe because it reduces $P\disj Q$ to~$P$. Any |
15 |
rule is unsafe whose premises contain new unknowns. The elimination |
|
16 |
rule~$(\forall E@2)$ is unsafe, since it is applied via elim-resolution, |
|
17 |
which discards the assumption $\forall x{.}P(x)$ and replaces it by the |
|
18 |
weaker assumption~$P(\Var{t})$. The rule $({\exists}I)$ is unsafe for |
|
19 |
similar reasons. The rule~$(\forall E@3)$ is unsafe in a different sense: |
|
20 |
since it keeps the assumption $\forall x{.}P(x)$, it is prone to looping. |
|
21 |
In classical first-order logic, all rules are safe except those mentioned |
|
22 |
above. |
|
104 | 23 |
|
24 |
The safe/unsafe distinction is vague, and may be regarded merely as a way |
|
25 |
of giving some rules priority over others. One could argue that |
|
26 |
$({\disj}E)$ is unsafe, because repeated application of it could generate |
|
27 |
exponentially many subgoals. Induction rules are unsafe because inductive |
|
28 |
proofs are difficult to set up automatically. Any inference is unsafe that |
|
29 |
instantiates an unknown in the proof state --- thus \ttindex{match_tac} |
|
30 |
must be used, rather than \ttindex{resolve_tac}. Even proof by assumption |
|
31 |
is unsafe if it instantiates unknowns shared with other subgoals --- thus |
|
32 |
\ttindex{eq_assume_tac} must be used, rather than \ttindex{assume_tac}. |
|
33 |
||
1099 | 34 |
\subsection{Adding rules to classical sets} |
319 | 35 |
Classical rule sets belong to the abstract type \mltydx{claset}, which |
286 | 36 |
supports the following operations (provided the classical reasoner is |
104 | 37 |
installed!): |
38 |
\begin{ttbox} |
|
8136 | 39 |
empty_cs : claset |
40 |
print_cs : claset -> unit |
|
41 |
rep_cs : claset -> \{safeEs: thm list, safeIs: thm list, |
|
42 |
hazEs: thm list, hazIs: thm list, |
|
43 |
swrappers: (string * wrapper) list, |
|
44 |
uwrappers: (string * wrapper) list, |
|
45 |
safe0_netpair: netpair, safep_netpair: netpair, |
|
46 |
haz_netpair: netpair, dup_netpair: netpair\} |
|
47 |
addSIs : claset * thm list -> claset \hfill{\bf infix 4} |
|
48 |
addSEs : claset * thm list -> claset \hfill{\bf infix 4} |
|
49 |
addSDs : claset * thm list -> claset \hfill{\bf infix 4} |
|
50 |
addIs : claset * thm list -> claset \hfill{\bf infix 4} |
|
51 |
addEs : claset * thm list -> claset \hfill{\bf infix 4} |
|
52 |
addDs : claset * thm list -> claset \hfill{\bf infix 4} |
|
53 |
delrules : claset * thm list -> claset \hfill{\bf infix 4} |
|
104 | 54 |
\end{ttbox} |
3089 | 55 |
The add operations ignore any rule already present in the claset with the same |
8926 | 56 |
classification (such as safe introduction). They print a warning if the rule |
3089 | 57 |
has already been added with some other classification, but add the rule |
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
58 |
anyway. Calling \texttt{delrules} deletes all occurrences of a rule from the |
3089 | 59 |
claset, but see the warning below concerning destruction rules. |
308 | 60 |
\begin{ttdescription} |
104 | 61 |
\item[\ttindexbold{empty_cs}] is the empty classical set. |
62 |
||
4665 | 63 |
\item[\ttindexbold{print_cs} $cs$] displays the printable contents of~$cs$, |
64 |
which is the rules. All other parts are non-printable. |
|
65 |
||
66 |
\item[\ttindexbold{rep_cs} $cs$] decomposes $cs$ as a record of its internal |
|
4666 | 67 |
components, namely the safe introduction and elimination rules, the unsafe |
68 |
introduction and elimination rules, the lists of safe and unsafe wrappers |
|
69 |
(see \ref{sec:modifying-search}), and the internalized forms of the rules. |
|
1099 | 70 |
|
308 | 71 |
\item[$cs$ addSIs $rules$] \indexbold{*addSIs} |
72 |
adds safe introduction~$rules$ to~$cs$. |
|
104 | 73 |
|
308 | 74 |
\item[$cs$ addSEs $rules$] \indexbold{*addSEs} |
75 |
adds safe elimination~$rules$ to~$cs$. |
|
104 | 76 |
|
308 | 77 |
\item[$cs$ addSDs $rules$] \indexbold{*addSDs} |
78 |
adds safe destruction~$rules$ to~$cs$. |
|
104 | 79 |
|
308 | 80 |
\item[$cs$ addIs $rules$] \indexbold{*addIs} |
81 |
adds unsafe introduction~$rules$ to~$cs$. |
|
104 | 82 |
|
308 | 83 |
\item[$cs$ addEs $rules$] \indexbold{*addEs} |
84 |
adds unsafe elimination~$rules$ to~$cs$. |
|
104 | 85 |
|
308 | 86 |
\item[$cs$ addDs $rules$] \indexbold{*addDs} |
87 |
adds unsafe destruction~$rules$ to~$cs$. |
|
1869 | 88 |
|
89 |
\item[$cs$ delrules $rules$] \indexbold{*delrules} |
|
3089 | 90 |
deletes~$rules$ from~$cs$. It prints a warning for those rules that are not |
91 |
in~$cs$. |
|
308 | 92 |
\end{ttdescription} |
93 |
||
3089 | 94 |
\begin{warn} |
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
95 |
If you added $rule$ using \texttt{addSDs} or \texttt{addDs}, then you must delete |
3089 | 96 |
it as follows: |
97 |
\begin{ttbox} |
|
98 |
\(cs\) delrules [make_elim \(rule\)] |
|
99 |
\end{ttbox} |
|
100 |
\par\noindent |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
101 |
This is necessary because the operators \texttt{addSDs} and \texttt{addDs} convert |
3089 | 102 |
the destruction rules to elimination rules by applying \ttindex{make_elim}, |
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
103 |
and then insert them using \texttt{addSEs} and \texttt{addEs}, respectively. |
3089 | 104 |
\end{warn} |
105 |
||
104 | 106 |
Introduction rules are those that can be applied using ordinary resolution. |
107 |
The classical set automatically generates their swapped forms, which will |
|
108 |
be applied using elim-resolution. Elimination rules are applied using |
|
286 | 109 |
elim-resolution. In a classical set, rules are sorted by the number of new |
110 |
subgoals they will yield; rules that generate the fewest subgoals will be |
|
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
111 |
tried first (see {\S}\ref{biresolve_tac}). |
104 | 112 |
|
5550 | 113 |
For elimination and destruction rules there are variants of the add operations |
114 |
adding a rule in a way such that it is applied only if also its second premise |
|
115 |
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
|
116 |
\indexbold{*addSE2}\indexbold{*addSD2}\indexbold{*addE2}\indexbold{*addD2} |
5550 | 117 |
\begin{ttbox} |
118 |
addSE2 : claset * (string * thm) -> claset \hfill{\bf infix 4} |
|
119 |
addSD2 : claset * (string * thm) -> claset \hfill{\bf infix 4} |
|
120 |
addE2 : claset * (string * thm) -> claset \hfill{\bf infix 4} |
|
121 |
addD2 : claset * (string * thm) -> claset \hfill{\bf infix 4} |
|
122 |
\end{ttbox} |
|
123 |
\begin{warn} |
|
124 |
A rule to be added in this special way must be given a name, which is used |
|
125 |
to delete it again -- when desired -- using \texttt{delSWrappers} or |
|
126 |
\texttt{delWrappers}, respectively. This is because these add operations |
|
127 |
are implemented as wrappers (see \ref{sec:modifying-search} below). |
|
128 |
\end{warn} |
|
129 |
||
1099 | 130 |
|
131 |
\subsection{Modifying the search step} |
|
4665 | 132 |
\label{sec:modifying-search} |
3716 | 133 |
For a given classical set, the proof strategy is simple. Perform as many safe |
134 |
inferences as possible; or else, apply certain safe rules, allowing |
|
135 |
instantiation of unknowns; or else, apply an unsafe rule. The tactics also |
|
136 |
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
|
137 |
up to do so (see \texttt{hyp_subst_tacs} in~{\S}\ref{sec:classical-setup} below). |
3716 | 138 |
They may perform a form of Modus Ponens: if there are assumptions $P\imp Q$ |
139 |
and~$P$, then replace $P\imp Q$ by~$Q$. |
|
104 | 140 |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
141 |
The classical reasoning tactics --- except \texttt{blast_tac}! --- allow |
4649 | 142 |
you to modify this basic proof strategy by applying two lists of arbitrary |
143 |
{\bf wrapper tacticals} to it. |
|
144 |
The first wrapper list, which is considered to contain safe wrappers only, |
|
145 |
affects \ttindex{safe_step_tac} and all the tactics that call it. |
|
5550 | 146 |
The second one, which may contain unsafe wrappers, affects the unsafe parts |
147 |
of \ttindex{step_tac}, \ttindex{slow_step_tac}, and the tactics that call them. |
|
4649 | 148 |
A wrapper transforms each step of the search, for example |
5550 | 149 |
by attempting other tactics before or after the original step tactic. |
4649 | 150 |
All members of a wrapper list are applied in turn to the respective step tactic. |
151 |
||
152 |
Initially the two wrapper lists are empty, which means no modification of the |
|
153 |
step tactics. Safe and unsafe wrappers are added to a claset |
|
154 |
with the functions given below, supplying them with wrapper names. |
|
155 |
These names may be used to selectively delete wrappers. |
|
1099 | 156 |
|
157 |
\begin{ttbox} |
|
4649 | 158 |
type wrapper = (int -> tactic) -> (int -> tactic); |
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
159 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
160 |
addSWrapper : claset * (string * wrapper ) -> claset \hfill{\bf infix 4} |
4649 | 161 |
addSbefore : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4} |
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
162 |
addSafter : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4} |
4649 | 163 |
delSWrapper : claset * string -> claset \hfill{\bf infix 4} |
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
164 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
165 |
addWrapper : claset * (string * wrapper ) -> claset \hfill{\bf infix 4} |
4649 | 166 |
addbefore : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4} |
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
167 |
addafter : claset * (string * (int -> tactic)) -> claset \hfill{\bf infix 4} |
4649 | 168 |
delWrapper : claset * string -> claset \hfill{\bf infix 4} |
169 |
||
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
170 |
addSss : claset * simpset -> claset \hfill{\bf infix 4} |
2632 | 171 |
addss : claset * simpset -> claset \hfill{\bf infix 4} |
1099 | 172 |
\end{ttbox} |
173 |
% |
|
174 |
||
175 |
\begin{ttdescription} |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
176 |
\item[$cs$ addSWrapper $(name,wrapper)$] \indexbold{*addSWrapper} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
177 |
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
|
178 |
to modify the existing safe step tactic. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
179 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
180 |
\item[$cs$ addSbefore $(name,tac)$] \indexbold{*addSbefore} |
5550 | 181 |
adds the given tactic as a safe wrapper, such that it is tried |
182 |
{\em before} each safe step of the search. |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
183 |
|
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
184 |
\item[$cs$ addSafter $(name,tac)$] \indexbold{*addSafter} |
5550 | 185 |
adds the given tactic as a safe wrapper, such that it is tried |
186 |
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
|
187 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
188 |
\item[$cs$ delSWrapper $name$] \indexbold{*delSWrapper} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
189 |
deletes the safe wrapper with the given name. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
190 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
191 |
\item[$cs$ addWrapper $(name,wrapper)$] \indexbold{*addWrapper} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
192 |
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
|
193 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
194 |
\item[$cs$ addbefore $(name,tac)$] \indexbold{*addbefore} |
5550 | 195 |
adds the given tactic as an unsafe wrapper, such that it its result is |
196 |
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
|
197 |
|
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
198 |
\item[$cs$ addafter $(name,tac)$] \indexbold{*addafter} |
5550 | 199 |
adds the given tactic as an unsafe wrapper, such that it its result is |
200 |
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
|
201 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
202 |
\item[$cs$ delWrapper $name$] \indexbold{*delWrapper} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
203 |
deletes the unsafe wrapper with the given name. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
204 |
|
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
205 |
\item[$cs$ addSss $ss$] \indexbold{*addss} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
206 |
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
|
207 |
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
|
208 |
|
1099 | 209 |
\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
|
210 |
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
|
211 |
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
|
212 |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
213 |
\end{ttdescription} |
2631
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
214 |
|
5550 | 215 |
\index{simplification!from classical reasoner} |
216 |
Strictly speaking, the operators \texttt{addss} and \texttt{addSss} |
|
217 |
are not part of the classical reasoner. |
|
218 |
, which are used as primitives |
|
11181
d04f57b91166
renamed addaltern to addafter, addSaltern to addSafter
oheimb
parents:
9695
diff
changeset
|
219 |
for the automatic tactics described in {\S}\ref{sec:automatic-tactics}, are |
5550 | 220 |
implemented as wrapper tacticals. |
221 |
they |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
222 |
\begin{warn} |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
223 |
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
|
224 |
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
|
225 |
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
|
226 |
{\em before} combining it with the claset. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
227 |
\end{warn} |
1099 | 228 |
|
104 | 229 |
|
230 |
\section{The classical tactics} |
|
3716 | 231 |
\index{classical reasoner!tactics} If installed, the classical module provides |
42840 | 232 |
powerful theorem-proving tactics. |
3716 | 233 |
|
104 | 234 |
|
3224 | 235 |
\subsection{The tableau prover} |
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
236 |
The tactic \texttt{blast_tac} searches for a proof using a fast tableau prover, |
3224 | 237 |
coded directly in \ML. It then reconstructs the proof using Isabelle |
238 |
tactics. It is faster and more powerful than the other classical |
|
239 |
reasoning tactics, but has major limitations too. |
|
3089 | 240 |
\begin{itemize} |
241 |
\item It does not use the wrapper tacticals described above, such as |
|
242 |
\ttindex{addss}. |
|
243 |
\item It does not perform higher-order unification, as needed by the rule {\tt |
|
9695 | 244 |
rangeI} in HOL and \texttt{RepFunI} in ZF. There are often alternatives |
245 |
to such rules, for example {\tt range_eqI} and \texttt{RepFun_eqI}. |
|
8136 | 246 |
\item Function variables may only be applied to parameters of the subgoal. |
247 |
(This restriction arises because the prover does not use higher-order |
|
248 |
unification.) If other function variables are present then the prover will |
|
249 |
fail with the message {\small\tt Function Var's argument not a bound variable}. |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
250 |
\item Its proof strategy is more general than \texttt{fast_tac}'s but can be |
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
251 |
slower. If \texttt{blast_tac} fails or seems to be running forever, try {\tt |
3089 | 252 |
fast_tac} and the other tactics described below. |
253 |
\end{itemize} |
|
254 |
% |
|
255 |
\begin{ttbox} |
|
256 |
blast_tac : claset -> int -> tactic |
|
257 |
Blast.depth_tac : claset -> int -> int -> tactic |
|
258 |
Blast.trace : bool ref \hfill{\bf initially false} |
|
259 |
\end{ttbox} |
|
260 |
The two tactics differ on how they bound the number of unsafe steps used in a |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
261 |
proof. While \texttt{blast_tac} starts with a bound of zero and increases it |
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
262 |
successively to~20, \texttt{Blast.depth_tac} applies a user-supplied search bound. |
3089 | 263 |
\begin{ttdescription} |
264 |
\item[\ttindexbold{blast_tac} $cs$ $i$] tries to prove |
|
8284 | 265 |
subgoal~$i$, increasing the search bound using iterative |
266 |
deepening~\cite{korf85}. |
|
3089 | 267 |
|
268 |
\item[\ttindexbold{Blast.depth_tac} $cs$ $lim$ $i$] tries |
|
8284 | 269 |
to prove subgoal~$i$ using a search bound of $lim$. Sometimes a slow |
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
270 |
proof using \texttt{blast_tac} can be made much faster by supplying the |
3089 | 271 |
successful search bound to this tactic instead. |
272 |
||
4317 | 273 |
\item[set \ttindexbold{Blast.trace};] \index{tracing!of classical prover} |
3089 | 274 |
causes the tableau prover to print a trace of its search. At each step it |
275 |
displays the formula currently being examined and reports whether the branch |
|
276 |
has been closed, extended or split. |
|
277 |
\end{ttdescription} |
|
278 |
||
3224 | 279 |
|
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
280 |
\subsection{Automatic tactics}\label{sec:automatic-tactics} |
3224 | 281 |
\begin{ttbox} |
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
282 |
type clasimpset = claset * simpset; |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
283 |
auto_tac : clasimpset -> tactic |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
284 |
force_tac : clasimpset -> int -> tactic |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
285 |
auto : unit -> unit |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
286 |
force : int -> unit |
3224 | 287 |
\end{ttbox} |
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
288 |
The automatic tactics attempt to prove goals using a combination of |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
289 |
simplification and classical reasoning. |
4885 | 290 |
\begin{ttdescription} |
4881
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
291 |
\item[\ttindexbold{auto_tac $(cs,ss)$}] is intended for situations where |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
292 |
there are a lot of mostly trivial subgoals; it proves all the easy ones, |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
293 |
leaving the ones it cannot prove. |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
294 |
(Unfortunately, attempting to prove the hard ones may take a long time.) |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
295 |
\item[\ttindexbold{force_tac} $(cs,ss)$ $i$] is intended to prove subgoal~$i$ |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
296 |
completely. It tries to apply all fancy tactics it knows about, |
d80faf83c82f
corrected and updated description of wrapper mechanism (including addss)
oheimb
parents:
4666
diff
changeset
|
297 |
performing a rather exhaustive search. |
4885 | 298 |
\end{ttdescription} |
3224 | 299 |
|
5576
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
300 |
|
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
301 |
\subsection{Semi-automatic tactics} |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
302 |
\begin{ttbox} |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
303 |
clarify_tac : claset -> int -> tactic |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
304 |
clarify_step_tac : claset -> int -> tactic |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
305 |
clarsimp_tac : clasimpset -> int -> tactic |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
306 |
\end{ttbox} |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
307 |
Use these when the automatic tactics fail. They perform all the obvious |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
308 |
logical inferences that do not split the subgoal. The result is a |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
309 |
simpler subgoal that can be tackled by other means, such as by |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
310 |
instantiating quantifiers yourself. |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
311 |
\begin{ttdescription} |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
312 |
\item[\ttindexbold{clarify_tac} $cs$ $i$] performs a series of safe steps on |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
313 |
subgoal~$i$ by repeatedly calling \texttt{clarify_step_tac}. |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
314 |
\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
|
315 |
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
|
316 |
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
|
317 |
performed provided they do not instantiate unknowns. Assumptions of the |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
318 |
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
|
319 |
applied. |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
320 |
\item[\ttindexbold{clarsimp_tac} $cs$ $i$] acts like \texttt{clarify_tac}, but |
9439 | 321 |
also does simplification with the given simpset. Note that if the simpset |
5577 | 322 |
includes a splitter for the premises, the subgoal may still be split. |
5576
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
323 |
\end{ttdescription} |
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
324 |
|
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
325 |
|
3224 | 326 |
\subsection{Other classical tactics} |
332 | 327 |
\begin{ttbox} |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
328 |
fast_tac : claset -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
329 |
best_tac : claset -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
330 |
slow_tac : claset -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
331 |
slow_best_tac : claset -> int -> tactic |
332 | 332 |
\end{ttbox} |
3224 | 333 |
These tactics attempt to prove a subgoal using sequent-style reasoning. |
334 |
Unlike \texttt{blast_tac}, they construct proofs directly in Isabelle. Their |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
335 |
effect is restricted (by \texttt{SELECT_GOAL}) to one subgoal; they either prove |
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
336 |
this subgoal or fail. The \texttt{slow_} versions conduct a broader |
3224 | 337 |
search.% |
338 |
\footnote{They may, when backtracking from a failed proof attempt, undo even |
|
339 |
the step of proving a subgoal by assumption.} |
|
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
340 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
341 |
The best-first tactics are guided by a heuristic function: typically, the |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
342 |
total size of the proof state. This function is supplied in the functor call |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
343 |
that sets up the classical reasoner. |
332 | 344 |
\begin{ttdescription} |
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
345 |
\item[\ttindexbold{fast_tac} $cs$ $i$] applies \texttt{step_tac} using |
8136 | 346 |
depth-first search to prove subgoal~$i$. |
332 | 347 |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
348 |
\item[\ttindexbold{best_tac} $cs$ $i$] applies \texttt{step_tac} using |
8136 | 349 |
best-first search to prove subgoal~$i$. |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
350 |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
351 |
\item[\ttindexbold{slow_tac} $cs$ $i$] applies \texttt{slow_step_tac} using |
8136 | 352 |
depth-first search to prove subgoal~$i$. |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
353 |
|
8136 | 354 |
\item[\ttindexbold{slow_best_tac} $cs$ $i$] applies \texttt{slow_step_tac} with |
355 |
best-first search to prove subgoal~$i$. |
|
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
356 |
\end{ttdescription} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
357 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
358 |
|
3716 | 359 |
\subsection{Depth-limited automatic tactics} |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
360 |
\begin{ttbox} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
361 |
depth_tac : claset -> int -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
362 |
deepen_tac : claset -> int -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
363 |
\end{ttbox} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
364 |
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
|
365 |
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
|
366 |
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
|
367 |
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
|
368 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
369 |
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
|
370 |
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
|
371 |
\begin{ttdescription} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
372 |
\item[\ttindexbold{depth_tac} $cs$ $m$ $i$] |
3089 | 373 |
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
|
374 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
375 |
\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
|
376 |
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
|
377 |
repeatedly with increasing depths, starting with~$m$. |
332 | 378 |
\end{ttdescription} |
379 |
||
380 |
||
104 | 381 |
\subsection{Single-step tactics} |
382 |
\begin{ttbox} |
|
383 |
safe_step_tac : claset -> int -> tactic |
|
384 |
safe_tac : claset -> tactic |
|
385 |
inst_step_tac : claset -> int -> tactic |
|
386 |
step_tac : claset -> int -> tactic |
|
387 |
slow_step_tac : claset -> int -> tactic |
|
388 |
\end{ttbox} |
|
389 |
The automatic proof procedures call these tactics. By calling them |
|
390 |
yourself, you can execute these procedures one step at a time. |
|
308 | 391 |
\begin{ttdescription} |
104 | 392 |
\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
|
393 |
subgoal~$i$. The safe wrapper tacticals are applied to a tactic that may |
3716 | 394 |
include proof by assumption or Modus Ponens (taking care not to instantiate |
395 |
unknowns), or substitution. |
|
104 | 396 |
|
397 |
\item[\ttindexbold{safe_tac} $cs$] repeatedly performs safe steps on all |
|
3716 | 398 |
subgoals. It is deterministic, with at most one outcome. |
104 | 399 |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
400 |
\item[\ttindexbold{inst_step_tac} $cs$ $i$] is like \texttt{safe_step_tac}, |
104 | 401 |
but allows unknowns to be instantiated. |
402 |
||
1099 | 403 |
\item[\ttindexbold{step_tac} $cs$ $i$] is the basic step of the proof |
8136 | 404 |
procedure. The unsafe wrapper tacticals are applied to a tactic that tries |
405 |
\texttt{safe_tac}, \texttt{inst_step_tac}, or applies an unsafe rule |
|
406 |
from~$cs$. |
|
104 | 407 |
|
408 |
\item[\ttindexbold{slow_step_tac}] |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
409 |
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
|
410 |
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
|
411 |
The resulting search space is larger. |
308 | 412 |
\end{ttdescription} |
104 | 413 |
|
5576
dc6ee60d2be8
exchanged automatic-tactics and semi-automatic-tactics
oheimb
parents:
5550
diff
changeset
|
414 |
|
104 | 415 |
\subsection{Other useful tactics} |
319 | 416 |
\index{tactics!for contradiction} |
417 |
\index{tactics!for Modus Ponens} |
|
104 | 418 |
\begin{ttbox} |
419 |
contr_tac : int -> tactic |
|
420 |
mp_tac : int -> tactic |
|
421 |
eq_mp_tac : int -> tactic |
|
422 |
swap_res_tac : thm list -> int -> tactic |
|
423 |
\end{ttbox} |
|
424 |
These can be used in the body of a specialized search. |
|
308 | 425 |
\begin{ttdescription} |
319 | 426 |
\item[\ttindexbold{contr_tac} {\it i}]\index{assumptions!contradictory} |
427 |
solves subgoal~$i$ by detecting a contradiction among two assumptions of |
|
428 |
the form $P$ and~$\neg P$, or fail. It may instantiate unknowns. The |
|
429 |
tactic can produce multiple outcomes, enumerating all possible |
|
430 |
contradictions. |
|
104 | 431 |
|
432 |
\item[\ttindexbold{mp_tac} {\it i}] |
|
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
433 |
is like \texttt{contr_tac}, but also attempts to perform Modus Ponens in |
104 | 434 |
subgoal~$i$. If there are assumptions $P\imp Q$ and~$P$, then it replaces |
435 |
$P\imp Q$ by~$Q$. It may instantiate unknowns. It fails if it can do |
|
436 |
nothing. |
|
437 |
||
438 |
\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
|
439 |
is like \texttt{mp_tac} {\it i}, but may not instantiate unknowns --- thus, it |
104 | 440 |
is safe. |
441 |
||
442 |
\item[\ttindexbold{swap_res_tac} {\it thms} {\it i}] refines subgoal~$i$ of |
|
443 |
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
|
444 |
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
|
445 |
\texttt{contr_tac}. It then attempts to apply each rule in turn, attempting |
104 | 446 |
resolution and also elim-resolution with the swapped form. |
308 | 447 |
\end{ttdescription} |
104 | 448 |
|
449 |
\subsection{Creating swapped rules} |
|
450 |
\begin{ttbox} |
|
451 |
swapify : thm list -> thm list |
|
452 |
joinrules : thm list * thm list -> (bool * thm) list |
|
453 |
\end{ttbox} |
|
308 | 454 |
\begin{ttdescription} |
104 | 455 |
\item[\ttindexbold{swapify} {\it thms}] returns a list consisting of the |
456 |
swapped versions of~{\it thms}, regarded as introduction rules. |
|
457 |
||
308 | 458 |
\item[\ttindexbold{joinrules} ({\it intrs}, {\it elims})] |
104 | 459 |
joins introduction rules, their swapped versions, and elimination rules for |
3720
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
460 |
use with \ttindex{biresolve_tac}. Each rule is paired with~\texttt{false} |
a5b9e0ade194
Safe_tac, Safe_step_tac, and minor corrections including \tt -> \texttt
paulson
parents:
3716
diff
changeset
|
461 |
(indicating ordinary resolution) or~\texttt{true} (indicating |
104 | 462 |
elim-resolution). |
308 | 463 |
\end{ttdescription} |
104 | 464 |
|
465 |
||
3716 | 466 |
\section{Setting up the classical reasoner}\label{sec:classical-setup} |
319 | 467 |
\index{classical reasoner!setting up} |
5550 | 468 |
Isabelle's classical object-logics, including \texttt{FOL} and \texttt{HOL}, |
469 |
have the classical reasoner already set up. |
|
470 |
When defining a new classical logic, you should set up the reasoner yourself. |
|
471 |
It consists of the \ML{} functor \ttindex{ClassicalFun}, which takes the |
|
472 |
argument signature \texttt{CLASSICAL_DATA}: |
|
104 | 473 |
\begin{ttbox} |
474 |
signature CLASSICAL_DATA = |
|
475 |
sig |
|
476 |
val mp : thm |
|
477 |
val not_elim : thm |
|
478 |
val swap : thm |
|
479 |
val sizef : thm -> int |
|
480 |
val hyp_subst_tacs : (int -> tactic) list |
|
481 |
end; |
|
482 |
\end{ttbox} |
|
483 |
Thus, the functor requires the following items: |
|
308 | 484 |
\begin{ttdescription} |
319 | 485 |
\item[\tdxbold{mp}] should be the Modus Ponens rule |
104 | 486 |
$\List{\Var{P}\imp\Var{Q};\; \Var{P}} \Imp \Var{Q}$. |
487 |
||
319 | 488 |
\item[\tdxbold{not_elim}] should be the contradiction rule |
104 | 489 |
$\List{\neg\Var{P};\; \Var{P}} \Imp \Var{R}$. |
490 |
||
319 | 491 |
\item[\tdxbold{swap}] should be the swap rule |
104 | 492 |
$\List{\neg \Var{P}; \; \neg \Var{R}\Imp \Var{P}} \Imp \Var{R}$. |
493 |
||
494 |
\item[\ttindexbold{sizef}] is the heuristic function used for best-first |
|
495 |
search. It should estimate the size of the remaining subgoals. A good |
|
496 |
heuristic function is \ttindex{size_of_thm}, which measures the size of the |
|
497 |
proof state. Another size function might ignore certain subgoals (say, |
|
6170 | 498 |
those concerned with type-checking). A heuristic function might simply |
104 | 499 |
count the subgoals. |
500 |
||
319 | 501 |
\item[\ttindexbold{hyp_subst_tacs}] is a list of tactics for substitution in |
104 | 502 |
the hypotheses, typically created by \ttindex{HypsubstFun} (see |
503 |
Chapter~\ref{substitution}). This list can, of course, be empty. The |
|
504 |
tactics are assumed to be safe! |
|
308 | 505 |
\end{ttdescription} |
104 | 506 |
The functor is not at all sensitive to the formalization of the |
3108 | 507 |
object-logic. It does not even examine the rules, but merely applies |
508 |
them according to its fixed strategy. The functor resides in {\tt |
|
509 |
Provers/classical.ML} in the Isabelle sources. |
|
104 | 510 |
|
319 | 511 |
\index{classical reasoner|)} |
5371 | 512 |
|
513 |
%%% Local Variables: |
|
514 |
%%% mode: latex |
|
515 |
%%% TeX-master: "ref" |
|
516 |
%%% End: |