author | wenzelm |
Fri, 09 May 1997 19:41:46 +0200 | |
changeset 3149 | 434b33c5f827 |
parent 3108 | 335efc3f5632 |
child 3224 | 4ea2aa9f93a5 |
permissions | -rw-r--r-- |
104 | 1 |
%% $Id$ |
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 |
||
3108 | 6 |
Although Isabelle is generic, many users will be working in some |
7 |
extension of classical first-order logic. Isabelle's set theory~{\tt |
|
8 |
ZF} is built upon theory~{\tt FOL}, while higher-order logic |
|
9 |
conceptually contains first-order logic as a fragment. |
|
10 |
Theorem-proving in predicate logic is undecidable, but many |
|
308 | 11 |
researchers have developed strategies to assist in this task. |
104 | 12 |
|
286 | 13 |
Isabelle's classical reasoner is an \ML{} functor that accepts certain |
104 | 14 |
information about a logic and delivers a suite of automatic tactics. Each |
15 |
tactic takes a collection of rules and executes a simple, non-clausal proof |
|
16 |
procedure. They are slow and simplistic compared with resolution theorem |
|
17 |
provers, but they can save considerable time and effort. They can prove |
|
18 |
theorems such as Pelletier's~\cite{pelletier86} problems~40 and~41 in |
|
19 |
seconds: |
|
20 |
\[ (\exists y. \forall x. J(y,x) \bimp \neg J(x,x)) |
|
21 |
\imp \neg (\forall x. \exists y. \forall z. J(z,y) \bimp \neg J(z,x)) \] |
|
22 |
\[ (\forall z. \exists y. \forall x. F(x,y) \bimp F(x,z) \conj \neg F(x,x)) |
|
23 |
\imp \neg (\exists z. \forall x. F(x,z)) |
|
24 |
\] |
|
308 | 25 |
% |
26 |
The tactics are generic. They are not restricted to first-order logic, and |
|
27 |
have been heavily used in the development of Isabelle's set theory. Few |
|
28 |
interactive proof assistants provide this much automation. The tactics can |
|
29 |
be traced, and their components can be called directly; in this manner, |
|
30 |
any proof can be viewed interactively. |
|
104 | 31 |
|
2479 | 32 |
The simplest way to apply the classical reasoner (to subgoal~$i$) is as |
33 |
follows: |
|
34 |
\begin{ttbox} |
|
3089 | 35 |
by (Blast_tac \(i\)); |
2479 | 36 |
\end{ttbox} |
37 |
If the subgoal is a simple formula of the predicate calculus or set theory, |
|
38 |
then it should be proved quickly. However, to use the classical reasoner |
|
3089 | 39 |
effectively, you need to know how it works and how to choose among the many |
40 |
tactics available, including {\tt Fast_tac} and {\tt Best_tac}. |
|
2479 | 41 |
|
3108 | 42 |
We shall first discuss the underlying principles, then present the |
43 |
classical reasoner. Finally, we shall see how to instantiate it for |
|
44 |
new logics. The logics \FOL, \ZF, {\HOL} and {\HOLCF} have it already |
|
45 |
installed. |
|
104 | 46 |
|
47 |
||
48 |
\section{The sequent calculus} |
|
49 |
\index{sequent calculus} |
|
50 |
Isabelle supports natural deduction, which is easy to use for interactive |
|
51 |
proof. But natural deduction does not easily lend itself to automation, |
|
52 |
and has a bias towards intuitionism. For certain proofs in classical |
|
53 |
logic, it can not be called natural. The {\bf sequent calculus}, a |
|
54 |
generalization of natural deduction, is easier to automate. |
|
55 |
||
56 |
A {\bf sequent} has the form $\Gamma\turn\Delta$, where $\Gamma$ |
|
308 | 57 |
and~$\Delta$ are sets of formulae.% |
58 |
\footnote{For first-order logic, sequents can equivalently be made from |
|
59 |
lists or multisets of formulae.} The sequent |
|
104 | 60 |
\[ P@1,\ldots,P@m\turn Q@1,\ldots,Q@n \] |
61 |
is {\bf valid} if $P@1\conj\ldots\conj P@m$ implies $Q@1\disj\ldots\disj |
|
62 |
Q@n$. Thus $P@1,\ldots,P@m$ represent assumptions, each of which is true, |
|
63 |
while $Q@1,\ldots,Q@n$ represent alternative goals. A sequent is {\bf |
|
64 |
basic} if its left and right sides have a common formula, as in $P,Q\turn |
|
65 |
Q,R$; basic sequents are trivially valid. |
|
66 |
||
67 |
Sequent rules are classified as {\bf right} or {\bf left}, indicating which |
|
68 |
side of the $\turn$~symbol they operate on. Rules that operate on the |
|
69 |
right side are analogous to natural deduction's introduction rules, and |
|
308 | 70 |
left rules are analogous to elimination rules. |
71 |
Recall the natural deduction rules for |
|
72 |
first-order logic, |
|
73 |
\iflabelundefined{fol-fig}{from {\it Introduction to Isabelle}}% |
|
74 |
{Fig.\ts\ref{fol-fig}}. |
|
75 |
The sequent calculus analogue of~$({\imp}I)$ is the rule |
|
3108 | 76 |
$$ |
77 |
\ainfer{\Gamma &\turn \Delta, P\imp Q}{P,\Gamma &\turn \Delta,Q} |
|
78 |
\eqno({\imp}R) |
|
79 |
$$ |
|
104 | 80 |
This breaks down some implication on the right side of a sequent; $\Gamma$ |
81 |
and $\Delta$ stand for the sets of formulae that are unaffected by the |
|
82 |
inference. The analogue of the pair~$({\disj}I1)$ and~$({\disj}I2)$ is the |
|
83 |
single rule |
|
3108 | 84 |
$$ |
85 |
\ainfer{\Gamma &\turn \Delta, P\disj Q}{\Gamma &\turn \Delta,P,Q} |
|
86 |
\eqno({\disj}R) |
|
87 |
$$ |
|
104 | 88 |
This breaks down some disjunction on the right side, replacing it by both |
89 |
disjuncts. Thus, the sequent calculus is a kind of multiple-conclusion logic. |
|
90 |
||
91 |
To illustrate the use of multiple formulae on the right, let us prove |
|
92 |
the classical theorem $(P\imp Q)\disj(Q\imp P)$. Working backwards, we |
|
93 |
reduce this formula to a basic sequent: |
|
94 |
\[ \infer[(\disj)R]{\turn(P\imp Q)\disj(Q\imp P)} |
|
95 |
{\infer[(\imp)R]{\turn(P\imp Q), (Q\imp P)\;} |
|
96 |
{\infer[(\imp)R]{P \turn Q, (Q\imp P)\qquad} |
|
97 |
{P, Q \turn Q, P\qquad\qquad}}} |
|
98 |
\] |
|
99 |
This example is typical of the sequent calculus: start with the desired |
|
100 |
theorem and apply rules backwards in a fairly arbitrary manner. This yields a |
|
101 |
surprisingly effective proof procedure. Quantifiers add few complications, |
|
102 |
since Isabelle handles parameters and schematic variables. See Chapter~10 |
|
103 |
of {\em ML for the Working Programmer}~\cite{paulson91} for further |
|
104 |
discussion. |
|
105 |
||
106 |
||
107 |
\section{Simulating sequents by natural deduction} |
|
308 | 108 |
Isabelle can represent sequents directly, as in the object-logic~{\tt LK}\@. |
104 | 109 |
But natural deduction is easier to work with, and most object-logics employ |
110 |
it. Fortunately, we can simulate the sequent $P@1,\ldots,P@m\turn |
|
111 |
Q@1,\ldots,Q@n$ by the Isabelle formula |
|
112 |
\[ \List{P@1;\ldots;P@m; \neg Q@2;\ldots; \neg Q@n}\Imp Q@1, \] |
|
113 |
where the order of the assumptions and the choice of~$Q@1$ are arbitrary. |
|
114 |
Elim-resolution plays a key role in simulating sequent proofs. |
|
115 |
||
116 |
We can easily handle reasoning on the left. |
|
308 | 117 |
As discussed in |
118 |
\iflabelundefined{destruct}{{\it Introduction to Isabelle}}{\S\ref{destruct}}, |
|
104 | 119 |
elim-resolution with the rules $(\disj E)$, $(\bot E)$ and $(\exists E)$ |
120 |
achieves a similar effect as the corresponding sequent rules. For the |
|
121 |
other connectives, we use sequent-style elimination rules instead of |
|
308 | 122 |
destruction rules such as $({\conj}E1,2)$ and $(\forall E)$. But note that |
123 |
the rule $(\neg L)$ has no effect under our representation of sequents! |
|
3108 | 124 |
$$ |
125 |
\ainfer{\neg P,\Gamma &\turn \Delta}{\Gamma &\turn \Delta,P}\eqno({\neg}L) |
|
126 |
$$ |
|
104 | 127 |
What about reasoning on the right? Introduction rules can only affect the |
308 | 128 |
formula in the conclusion, namely~$Q@1$. The other right-side formulae are |
319 | 129 |
represented as negated assumptions, $\neg Q@2$, \ldots,~$\neg Q@n$. |
130 |
\index{assumptions!negated} |
|
131 |
In order to operate on one of these, it must first be exchanged with~$Q@1$. |
|
104 | 132 |
Elim-resolution with the {\bf swap} rule has this effect: |
3108 | 133 |
$$ \List{\neg P; \; \neg R\Imp P} \Imp R \eqno(swap) $$ |
104 | 134 |
To ensure that swaps occur only when necessary, each introduction rule is |
135 |
converted into a swapped form: it is resolved with the second premise |
|
136 |
of~$(swap)$. The swapped form of~$({\conj}I)$, which might be |
|
137 |
called~$({\neg\conj}E)$, is |
|
138 |
\[ \List{\neg(P\conj Q); \; \neg R\Imp P; \; \neg R\Imp Q} \Imp R. \] |
|
139 |
Similarly, the swapped form of~$({\imp}I)$ is |
|
140 |
\[ \List{\neg(P\imp Q); \; \List{\neg R;P}\Imp Q} \Imp R \] |
|
141 |
Swapped introduction rules are applied using elim-resolution, which deletes |
|
142 |
the negated formula. Our representation of sequents also requires the use |
|
143 |
of ordinary introduction rules. If we had no regard for readability, we |
|
144 |
could treat the right side more uniformly by representing sequents as |
|
145 |
\[ \List{P@1;\ldots;P@m; \neg Q@1;\ldots; \neg Q@n}\Imp \bot. \] |
|
146 |
||
147 |
||
148 |
\section{Extra rules for the sequent calculus} |
|
149 |
As mentioned, destruction rules such as $({\conj}E1,2)$ and $(\forall E)$ |
|
150 |
must be replaced by sequent-style elimination rules. In addition, we need |
|
151 |
rules to embody the classical equivalence between $P\imp Q$ and $\neg P\disj |
|
152 |
Q$. The introduction rules~$({\disj}I1,2)$ are replaced by a rule that |
|
153 |
simulates $({\disj}R)$: |
|
154 |
\[ (\neg Q\Imp P) \Imp P\disj Q \] |
|
155 |
The destruction rule $({\imp}E)$ is replaced by |
|
332 | 156 |
\[ \List{P\imp Q;\; \neg P\Imp R;\; Q\Imp R} \Imp R. \] |
104 | 157 |
Quantifier replication also requires special rules. In classical logic, |
308 | 158 |
$\exists x{.}P$ is equivalent to $\neg\forall x{.}\neg P$; the rules |
159 |
$(\exists R)$ and $(\forall L)$ are dual: |
|
104 | 160 |
\[ \ainfer{\Gamma &\turn \Delta, \exists x{.}P} |
161 |
{\Gamma &\turn \Delta, \exists x{.}P, P[t/x]} \; (\exists R) |
|
162 |
\qquad |
|
163 |
\ainfer{\forall x{.}P, \Gamma &\turn \Delta} |
|
164 |
{P[t/x], \forall x{.}P, \Gamma &\turn \Delta} \; (\forall L) |
|
165 |
\] |
|
166 |
Thus both kinds of quantifier may be replicated. Theorems requiring |
|
167 |
multiple uses of a universal formula are easy to invent; consider |
|
308 | 168 |
\[ (\forall x.P(x)\imp P(f(x))) \conj P(a) \imp P(f^n(a)), \] |
169 |
for any~$n>1$. Natural examples of the multiple use of an existential |
|
170 |
formula are rare; a standard one is $\exists x.\forall y. P(x)\imp P(y)$. |
|
104 | 171 |
|
172 |
Forgoing quantifier replication loses completeness, but gains decidability, |
|
173 |
since the search space becomes finite. Many useful theorems can be proved |
|
174 |
without replication, and the search generally delivers its verdict in a |
|
175 |
reasonable time. To adopt this approach, represent the sequent rules |
|
176 |
$(\exists R)$, $(\exists L)$ and $(\forall R)$ by $(\exists I)$, $(\exists |
|
177 |
E)$ and $(\forall I)$, respectively, and put $(\forall E)$ into elimination |
|
178 |
form: |
|
179 |
$$ \List{\forall x{.}P(x); P(t)\Imp Q} \Imp Q \eqno(\forall E@2) $$ |
|
180 |
Elim-resolution with this rule will delete the universal formula after a |
|
181 |
single use. To replicate universal quantifiers, replace the rule by |
|
3108 | 182 |
$$ |
183 |
\List{\forall x{.}P(x);\; \List{P(t); \forall x{.}P(x)}\Imp Q} \Imp Q. |
|
184 |
\eqno(\forall E@3) |
|
185 |
$$ |
|
104 | 186 |
To replicate existential quantifiers, replace $(\exists I)$ by |
332 | 187 |
\[ \List{\neg(\exists x{.}P(x)) \Imp P(t)} \Imp \exists x{.}P(x). \] |
104 | 188 |
All introduction rules mentioned above are also useful in swapped form. |
189 |
||
190 |
Replication makes the search space infinite; we must apply the rules with |
|
286 | 191 |
care. The classical reasoner distinguishes between safe and unsafe |
104 | 192 |
rules, applying the latter only when there is no alternative. Depth-first |
193 |
search may well go down a blind alley; best-first search is better behaved |
|
194 |
in an infinite search space. However, quantifier replication is too |
|
195 |
expensive to prove any but the simplest theorems. |
|
196 |
||
197 |
||
198 |
\section{Classical rule sets} |
|
319 | 199 |
\index{classical sets} |
200 |
Each automatic tactic takes a {\bf classical set} --- a collection of |
|
104 | 201 |
rules, classified as introduction or elimination and as {\bf safe} or {\bf |
202 |
unsafe}. In general, safe rules can be attempted blindly, while unsafe |
|
203 |
rules must be used with care. A safe rule must never reduce a provable |
|
308 | 204 |
goal to an unprovable set of subgoals. |
104 | 205 |
|
308 | 206 |
The rule~$({\disj}I1)$ is unsafe because it reduces $P\disj Q$ to~$P$. Any |
207 |
rule is unsafe whose premises contain new unknowns. The elimination |
|
208 |
rule~$(\forall E@2)$ is unsafe, since it is applied via elim-resolution, |
|
209 |
which discards the assumption $\forall x{.}P(x)$ and replaces it by the |
|
210 |
weaker assumption~$P(\Var{t})$. The rule $({\exists}I)$ is unsafe for |
|
211 |
similar reasons. The rule~$(\forall E@3)$ is unsafe in a different sense: |
|
212 |
since it keeps the assumption $\forall x{.}P(x)$, it is prone to looping. |
|
213 |
In classical first-order logic, all rules are safe except those mentioned |
|
214 |
above. |
|
104 | 215 |
|
216 |
The safe/unsafe distinction is vague, and may be regarded merely as a way |
|
217 |
of giving some rules priority over others. One could argue that |
|
218 |
$({\disj}E)$ is unsafe, because repeated application of it could generate |
|
219 |
exponentially many subgoals. Induction rules are unsafe because inductive |
|
220 |
proofs are difficult to set up automatically. Any inference is unsafe that |
|
221 |
instantiates an unknown in the proof state --- thus \ttindex{match_tac} |
|
222 |
must be used, rather than \ttindex{resolve_tac}. Even proof by assumption |
|
223 |
is unsafe if it instantiates unknowns shared with other subgoals --- thus |
|
224 |
\ttindex{eq_assume_tac} must be used, rather than \ttindex{assume_tac}. |
|
225 |
||
1099 | 226 |
\subsection{Adding rules to classical sets} |
319 | 227 |
Classical rule sets belong to the abstract type \mltydx{claset}, which |
286 | 228 |
supports the following operations (provided the classical reasoner is |
104 | 229 |
installed!): |
230 |
\begin{ttbox} |
|
1099 | 231 |
empty_cs : claset |
232 |
print_cs : claset -> unit |
|
233 |
addSIs : claset * thm list -> claset \hfill{\bf infix 4} |
|
234 |
addSEs : claset * thm list -> claset \hfill{\bf infix 4} |
|
235 |
addSDs : claset * thm list -> claset \hfill{\bf infix 4} |
|
236 |
addIs : claset * thm list -> claset \hfill{\bf infix 4} |
|
237 |
addEs : claset * thm list -> claset \hfill{\bf infix 4} |
|
238 |
addDs : claset * thm list -> claset \hfill{\bf infix 4} |
|
1869 | 239 |
delrules : claset * thm list -> claset \hfill{\bf infix 4} |
104 | 240 |
\end{ttbox} |
3089 | 241 |
The add operations ignore any rule already present in the claset with the same |
242 |
classification (such as Safe Introduction). They print a warning if the rule |
|
243 |
has already been added with some other classification, but add the rule |
|
244 |
anyway. Calling {\tt delrules} deletes all occurrences of a rule from the |
|
245 |
claset, but see the warning below concerning destruction rules. |
|
308 | 246 |
\begin{ttdescription} |
104 | 247 |
\item[\ttindexbold{empty_cs}] is the empty classical set. |
248 |
||
1099 | 249 |
\item[\ttindexbold{print_cs} $cs$] prints the rules of~$cs$. |
250 |
||
308 | 251 |
\item[$cs$ addSIs $rules$] \indexbold{*addSIs} |
252 |
adds safe introduction~$rules$ to~$cs$. |
|
104 | 253 |
|
308 | 254 |
\item[$cs$ addSEs $rules$] \indexbold{*addSEs} |
255 |
adds safe elimination~$rules$ to~$cs$. |
|
104 | 256 |
|
308 | 257 |
\item[$cs$ addSDs $rules$] \indexbold{*addSDs} |
258 |
adds safe destruction~$rules$ to~$cs$. |
|
104 | 259 |
|
308 | 260 |
\item[$cs$ addIs $rules$] \indexbold{*addIs} |
261 |
adds unsafe introduction~$rules$ to~$cs$. |
|
104 | 262 |
|
308 | 263 |
\item[$cs$ addEs $rules$] \indexbold{*addEs} |
264 |
adds unsafe elimination~$rules$ to~$cs$. |
|
104 | 265 |
|
308 | 266 |
\item[$cs$ addDs $rules$] \indexbold{*addDs} |
267 |
adds unsafe destruction~$rules$ to~$cs$. |
|
1869 | 268 |
|
269 |
\item[$cs$ delrules $rules$] \indexbold{*delrules} |
|
3089 | 270 |
deletes~$rules$ from~$cs$. It prints a warning for those rules that are not |
271 |
in~$cs$. |
|
308 | 272 |
\end{ttdescription} |
273 |
||
3089 | 274 |
\begin{warn} |
275 |
If you added $rule$ using {\tt addSDs} or {\tt addDs}, then you must delete |
|
276 |
it as follows: |
|
277 |
\begin{ttbox} |
|
278 |
\(cs\) delrules [make_elim \(rule\)] |
|
279 |
\end{ttbox} |
|
280 |
\par\noindent |
|
281 |
This is necessary because the operators {\tt addSDs} and {\tt addDs} convert |
|
282 |
the destruction rules to elimination rules by applying \ttindex{make_elim}, |
|
283 |
and then insert them using {\tt addSEs} and {\tt addEs}, respectively. |
|
284 |
\end{warn} |
|
285 |
||
104 | 286 |
Introduction rules are those that can be applied using ordinary resolution. |
287 |
The classical set automatically generates their swapped forms, which will |
|
288 |
be applied using elim-resolution. Elimination rules are applied using |
|
286 | 289 |
elim-resolution. In a classical set, rules are sorted by the number of new |
290 |
subgoals they will yield; rules that generate the fewest subgoals will be |
|
291 |
tried first (see \S\ref{biresolve_tac}). |
|
104 | 292 |
|
1099 | 293 |
|
294 |
\subsection{Modifying the search step} |
|
104 | 295 |
For a given classical set, the proof strategy is simple. Perform as many |
296 |
safe inferences as possible; or else, apply certain safe rules, allowing |
|
297 |
instantiation of unknowns; or else, apply an unsafe rule. The tactics may |
|
319 | 298 |
also apply {\tt hyp_subst_tac}, if they have been set up to do so (see |
104 | 299 |
below). They may perform a form of Modus Ponens: if there are assumptions |
300 |
$P\imp Q$ and~$P$, then replace $P\imp Q$ by~$Q$. |
|
301 |
||
3108 | 302 |
The classical reasoning tactics --- except {\tt blast_tac}! --- allow |
303 |
you to modify this basic proof strategy by applying two arbitrary {\bf |
|
304 |
wrapper tacticals} to it. This affects each step of the search. |
|
305 |
Usually they are the identity tacticals, but they could apply another |
|
306 |
tactic before or after the step tactic. The first one, which is |
|
307 |
considered to be safe, affects \ttindex{safe_step_tac} and all the |
|
308 |
tactics that call it. The the second one, which may be unsafe, affects |
|
309 |
\ttindex{step_tac}, \ttindex{slow_step_tac} and the tactics that call |
|
310 |
them. |
|
1099 | 311 |
|
312 |
\begin{ttbox} |
|
2632 | 313 |
addss : claset * simpset -> claset \hfill{\bf infix 4} |
314 |
addSbefore : claset * (int -> tactic) -> claset \hfill{\bf infix 4} |
|
315 |
addSaltern : claset * (int -> tactic) -> claset \hfill{\bf infix 4} |
|
316 |
setSWrapper : claset * ((int -> tactic) -> |
|
317 |
(int -> tactic)) -> claset \hfill{\bf infix 4} |
|
318 |
compSWrapper : claset * ((int -> tactic) -> |
|
319 |
(int -> tactic)) -> claset \hfill{\bf infix 4} |
|
320 |
addbefore : claset * (int -> tactic) -> claset \hfill{\bf infix 4} |
|
321 |
addaltern : claset * (int -> tactic) -> claset \hfill{\bf infix 4} |
|
322 |
setWrapper : claset * ((int -> tactic) -> |
|
323 |
(int -> tactic)) -> claset \hfill{\bf infix 4} |
|
324 |
compWrapper : claset * ((int -> tactic) -> |
|
325 |
(int -> tactic)) -> claset \hfill{\bf infix 4} |
|
1099 | 326 |
\end{ttbox} |
327 |
% |
|
3108 | 328 |
\index{simplification!from classical reasoner} The wrapper tacticals |
329 |
underly the operator addss, which combines each search step by |
|
330 |
simplification. Strictly speaking, {\tt addss} is not part of the |
|
331 |
classical reasoner. It should be defined (using {\tt addSaltern |
|
332 |
(CHANGED o (safe_asm_more_full_simp_tac ss)}) when the simplifier is |
|
333 |
installed. |
|
1099 | 334 |
|
335 |
\begin{ttdescription} |
|
336 |
\item[$cs$ addss $ss$] \indexbold{*addss} |
|
2631
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
337 |
adds the simpset~$ss$ to the classical set. The assumptions and goal will be |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
338 |
simplified, in a safe way, after the safe steps of the search. |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
339 |
|
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
340 |
\item[$cs$ addSbefore $tac$] \indexbold{*addSbefore} |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
341 |
changes the safe wrapper tactical to apply the given tactic {\em before} |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
342 |
each safe step of the search. |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
343 |
|
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
344 |
\item[$cs$ addSaltern $tac$] \indexbold{*addSaltern} |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
345 |
changes the safe wrapper tactical to apply the given tactic when a safe step |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
346 |
of the search would fail. |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
347 |
|
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
348 |
\item[$cs$ setSWrapper $tactical$] \indexbold{*setSWrapper} |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
349 |
specifies a new safe wrapper tactical. |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
350 |
|
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
351 |
\item[$cs$ compSWrapper $tactical$] \indexbold{*compSWrapper} |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
352 |
composes the $tactical$ with the existing safe wrapper tactical, |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
353 |
to combine their effects. |
1099 | 354 |
|
355 |
\item[$cs$ addbefore $tac$] \indexbold{*addbefore} |
|
2631
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
356 |
changes the (unsafe) wrapper tactical to apply the given tactic, which should |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
357 |
be safe, {\em before} each step of the search. |
1099 | 358 |
|
2631
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
359 |
\item[$cs$ addaltern $tac$] \indexbold{*addaltern} |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
360 |
changes the (unsafe) wrapper tactical to apply the given tactic |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
361 |
{\em alternatively} after each step of the search. |
1099 | 362 |
|
2631
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
363 |
\item[$cs$ setWrapper $tactical$] \indexbold{*setWrapper} |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
364 |
specifies a new (unsafe) wrapper tactical. |
1099 | 365 |
|
2631
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
366 |
\item[$cs$ compWrapper $tactical$] \indexbold{*compWrapper} |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
367 |
composes the $tactical$ with the existing (unsafe) wrapper tactical, |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
368 |
to combine their effects. |
1099 | 369 |
\end{ttdescription} |
370 |
||
104 | 371 |
|
372 |
\section{The classical tactics} |
|
319 | 373 |
\index{classical reasoner!tactics} |
104 | 374 |
If installed, the classical module provides several tactics (and other |
375 |
operations) for simulating the classical sequent calculus. |
|
376 |
||
3089 | 377 |
\subsection{The automatic tableau prover} |
378 |
The tactic {\tt blast_tac} finds a proof rapidly using a separate tableau |
|
379 |
prover and then reconstructs the proof using Isabelle tactics. It is much |
|
380 |
faster and more powerful than the other classical reasoning tactics, but has |
|
381 |
major limitations too. |
|
382 |
\begin{itemize} |
|
383 |
\item It does not use the wrapper tacticals described above, such as |
|
384 |
\ttindex{addss}. |
|
385 |
\item It ignores types, which can cause problems in \HOL. If it applies a rule |
|
386 |
whose types are inappropriate, then proof reconstruction will fail. |
|
387 |
\item It does not perform higher-order unification, as needed by the rule {\tt |
|
388 |
rangeI} in {\HOL} and {\tt RepFunI} in {\ZF}. There are often |
|
389 |
alternatives to such rules, for example {\tt |
|
390 |
range_eqI} and {\tt RepFun_eqI}. |
|
391 |
\item The message {\small\tt Function Var's argument not a bound variable\ } |
|
392 |
relates to the lack of higher-order unification. Function variables |
|
393 |
may only be applied to parameters of the subgoal. |
|
394 |
\item Its proof strategy is more general than {\tt fast_tac}'s but can be |
|
395 |
slower. If {\tt blast_tac} fails or seems to be running forever, try {\tt |
|
396 |
fast_tac} and the other tactics described below. |
|
397 |
\end{itemize} |
|
398 |
% |
|
399 |
\begin{ttbox} |
|
400 |
blast_tac : claset -> int -> tactic |
|
401 |
Blast.depth_tac : claset -> int -> int -> tactic |
|
402 |
Blast.trace : bool ref \hfill{\bf initially false} |
|
403 |
\end{ttbox} |
|
404 |
The two tactics differ on how they bound the number of unsafe steps used in a |
|
405 |
proof. While {\tt blast_tac} starts with a bound of zero and increases it |
|
406 |
successively to~20, {\tt Blast.depth_tac} applies a user-supplied search bound. |
|
407 |
\begin{ttdescription} |
|
408 |
\item[\ttindexbold{blast_tac} $cs$ $i$] tries to prove |
|
409 |
subgoal~$i$ using iterative deepening to increase the search bound. |
|
410 |
||
411 |
\item[\ttindexbold{Blast.depth_tac} $cs$ $lim$ $i$] tries |
|
412 |
to prove subgoal~$i$ using a search bound of $lim$. Often a slow |
|
413 |
proof using {\tt blast_tac} can be made much faster by supplying the |
|
414 |
successful search bound to this tactic instead. |
|
415 |
||
416 |
\item[\ttindexbold{Blast.trace} := true;] \index{tracing!of classical prover} |
|
417 |
causes the tableau prover to print a trace of its search. At each step it |
|
418 |
displays the formula currently being examined and reports whether the branch |
|
419 |
has been closed, extended or split. |
|
420 |
\end{ttdescription} |
|
421 |
||
332 | 422 |
\subsection{The automatic tactics} |
423 |
\begin{ttbox} |
|
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
424 |
fast_tac : claset -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
425 |
best_tac : claset -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
426 |
slow_tac : claset -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
427 |
slow_best_tac : claset -> int -> tactic |
332 | 428 |
\end{ttbox} |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
429 |
These tactics work by applying {\tt step_tac} or {\tt slow_step_tac} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
430 |
repeatedly. Their effect is restricted (by {\tt SELECT_GOAL}) to one subgoal; |
3089 | 431 |
they either prove this subgoal or fail. The {\tt slow_} versions are more |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
432 |
powerful but can be much slower. |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
433 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
434 |
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
|
435 |
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
|
436 |
that sets up the classical reasoner. |
332 | 437 |
\begin{ttdescription} |
438 |
\item[\ttindexbold{fast_tac} $cs$ $i$] applies {\tt step_tac} using |
|
3089 | 439 |
depth-first search, to prove subgoal~$i$. |
332 | 440 |
|
441 |
\item[\ttindexbold{best_tac} $cs$ $i$] applies {\tt step_tac} using |
|
3089 | 442 |
best-first search, to prove subgoal~$i$. |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
443 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
444 |
\item[\ttindexbold{slow_tac} $cs$ $i$] applies {\tt slow_step_tac} using |
3089 | 445 |
depth-first search, to prove subgoal~$i$. |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
446 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
447 |
\item[\ttindexbold{slow_best_tac} $cs$ $i$] applies {\tt slow_step_tac} using |
3089 | 448 |
best-first search, to prove subgoal~$i$. |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
449 |
\end{ttdescription} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
450 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
451 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
452 |
\subsection{Depth-limited tactics} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
453 |
\begin{ttbox} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
454 |
depth_tac : claset -> int -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
455 |
deepen_tac : claset -> int -> int -> tactic |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
456 |
\end{ttbox} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
457 |
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
|
458 |
modified to preserve the formula they act on, so that it be used repeatedly. |
1099 | 459 |
They can prove more goals than {\tt fast_tac} can but are much |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
460 |
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
|
461 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
462 |
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
|
463 |
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
|
464 |
\begin{ttdescription} |
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
465 |
\item[\ttindexbold{depth_tac} $cs$ $m$ $i$] |
3089 | 466 |
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
|
467 |
|
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
468 |
\item[\ttindexbold{deepen_tac} $cs$ $m$ $i$] |
3089 | 469 |
tries to prove subgoal~$i$ by iterative deepening. It calls {\tt depth_tac} |
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
470 |
repeatedly with increasing depths, starting with~$m$. |
332 | 471 |
\end{ttdescription} |
472 |
||
473 |
||
104 | 474 |
\subsection{Single-step tactics} |
475 |
\begin{ttbox} |
|
476 |
safe_step_tac : claset -> int -> tactic |
|
477 |
safe_tac : claset -> tactic |
|
478 |
inst_step_tac : claset -> int -> tactic |
|
479 |
step_tac : claset -> int -> tactic |
|
480 |
slow_step_tac : claset -> int -> tactic |
|
481 |
\end{ttbox} |
|
482 |
The automatic proof procedures call these tactics. By calling them |
|
483 |
yourself, you can execute these procedures one step at a time. |
|
308 | 484 |
\begin{ttdescription} |
104 | 485 |
\item[\ttindexbold{safe_step_tac} $cs$ $i$] performs a safe step on |
2631
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
486 |
subgoal~$i$. The safe wrapper tactical is applied to a tactic that may include |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
487 |
proof by assumption or Modus Ponens (taking care not to instantiate unknowns), |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
488 |
or {\tt hyp_subst_tac}. |
104 | 489 |
|
490 |
\item[\ttindexbold{safe_tac} $cs$] repeatedly performs safe steps on all |
|
491 |
subgoals. It is deterministic, with at most one outcome. If the automatic |
|
492 |
tactics fail, try using {\tt safe_tac} to open up your formula; then you |
|
493 |
can replicate certain quantifiers explicitly by applying appropriate rules. |
|
494 |
||
495 |
\item[\ttindexbold{inst_step_tac} $cs$ $i$] is like {\tt safe_step_tac}, |
|
496 |
but allows unknowns to be instantiated. |
|
497 |
||
1099 | 498 |
\item[\ttindexbold{step_tac} $cs$ $i$] is the basic step of the proof |
2631
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
499 |
procedure. The (unsafe) wrapper tactical is applied to a tactic that tries |
5e5c78ba955e
description of safe vs. unsafe wrapper and the functions involved
oheimb
parents:
2479
diff
changeset
|
500 |
{\tt safe_tac}, {\tt inst_step_tac}, or applies an unsafe rule from~$cs$. |
104 | 501 |
|
502 |
\item[\ttindexbold{slow_step_tac}] |
|
503 |
resembles {\tt step_tac}, but allows backtracking between using safe |
|
504 |
rules with instantiation ({\tt inst_step_tac}) and using unsafe rules. |
|
875
a0b71a4bbe5e
documented slow_tac, slow_best_tac, depth_tac, deepen_tac
lcp
parents:
332
diff
changeset
|
505 |
The resulting search space is larger. |
308 | 506 |
\end{ttdescription} |
104 | 507 |
|
1869 | 508 |
\subsection{The current claset} |
2479 | 509 |
Some logics (\FOL, {\HOL} and \ZF) support the concept of a current |
510 |
claset\index{claset!current}. This is a default set of classical rules. The |
|
511 |
underlying idea is quite similar to that of a current simpset described in |
|
512 |
\S\ref{sec:simp-for-dummies}; please read that section, including its |
|
513 |
warnings. Just like simpsets, clasets can be associated with theories. The |
|
514 |
tactics |
|
1869 | 515 |
\begin{ttbox} |
3108 | 516 |
Blast_tac : int -> tactic |
1869 | 517 |
Fast_tac : int -> tactic |
518 |
Best_tac : int -> tactic |
|
519 |
Deepen_tac : int -> int -> tactic |
|
3089 | 520 |
Step_tac : int -> tactic |
1869 | 521 |
\end{ttbox} |
3089 | 522 |
\indexbold{*Blast_tac}\indexbold{*Best_tac}\indexbold{*Fast_tac}% |
523 |
\indexbold{*Deepen_tac}\indexbold{*Step_tac} |
|
524 |
make use of the current claset. E.g. {\tt Blast_tac} is defined as follows: |
|
1869 | 525 |
\begin{ttbox} |
3089 | 526 |
fun Blast_tac i = fast_tac (!claset) i; |
1869 | 527 |
\end{ttbox} |
528 |
where \ttindex{!claset} is the current claset. |
|
529 |
The functions |
|
530 |
\begin{ttbox} |
|
531 |
AddSIs, AddSEs, AddSDs, AddIs, AddEs, AddDs: thm list -> unit |
|
532 |
\end{ttbox} |
|
533 |
\indexbold{*AddSIs} \indexbold{*AddSEs} \indexbold{*AddSDs} |
|
534 |
\indexbold{*AddIs} \indexbold{*AddEs} \indexbold{*AddDs} |
|
535 |
are used to add rules to the current claset. They work exactly like their |
|
536 |
lower case counterparts {\tt addSIs} etc. |
|
537 |
\begin{ttbox} |
|
538 |
Delrules : thm list -> unit |
|
539 |
\end{ttbox} |
|
540 |
deletes rules from the current claset. You do not need to worry via which of |
|
541 |
the above {\tt Add} functions the rule was initially added. |
|
104 | 542 |
|
543 |
\subsection{Other useful tactics} |
|
319 | 544 |
\index{tactics!for contradiction} |
545 |
\index{tactics!for Modus Ponens} |
|
104 | 546 |
\begin{ttbox} |
547 |
contr_tac : int -> tactic |
|
548 |
mp_tac : int -> tactic |
|
549 |
eq_mp_tac : int -> tactic |
|
550 |
swap_res_tac : thm list -> int -> tactic |
|
551 |
\end{ttbox} |
|
552 |
These can be used in the body of a specialized search. |
|
308 | 553 |
\begin{ttdescription} |
319 | 554 |
\item[\ttindexbold{contr_tac} {\it i}]\index{assumptions!contradictory} |
555 |
solves subgoal~$i$ by detecting a contradiction among two assumptions of |
|
556 |
the form $P$ and~$\neg P$, or fail. It may instantiate unknowns. The |
|
557 |
tactic can produce multiple outcomes, enumerating all possible |
|
558 |
contradictions. |
|
104 | 559 |
|
560 |
\item[\ttindexbold{mp_tac} {\it i}] |
|
561 |
is like {\tt contr_tac}, but also attempts to perform Modus Ponens in |
|
562 |
subgoal~$i$. If there are assumptions $P\imp Q$ and~$P$, then it replaces |
|
563 |
$P\imp Q$ by~$Q$. It may instantiate unknowns. It fails if it can do |
|
564 |
nothing. |
|
565 |
||
566 |
\item[\ttindexbold{eq_mp_tac} {\it i}] |
|
567 |
is like {\tt mp_tac} {\it i}, but may not instantiate unknowns --- thus, it |
|
568 |
is safe. |
|
569 |
||
570 |
\item[\ttindexbold{swap_res_tac} {\it thms} {\it i}] refines subgoal~$i$ of |
|
571 |
the proof state using {\it thms}, which should be a list of introduction |
|
3089 | 572 |
rules. First, it attempts to prove the goal using {\tt assume_tac} or |
104 | 573 |
{\tt contr_tac}. It then attempts to apply each rule in turn, attempting |
574 |
resolution and also elim-resolution with the swapped form. |
|
308 | 575 |
\end{ttdescription} |
104 | 576 |
|
577 |
\subsection{Creating swapped rules} |
|
578 |
\begin{ttbox} |
|
579 |
swapify : thm list -> thm list |
|
580 |
joinrules : thm list * thm list -> (bool * thm) list |
|
581 |
\end{ttbox} |
|
308 | 582 |
\begin{ttdescription} |
104 | 583 |
\item[\ttindexbold{swapify} {\it thms}] returns a list consisting of the |
584 |
swapped versions of~{\it thms}, regarded as introduction rules. |
|
585 |
||
308 | 586 |
\item[\ttindexbold{joinrules} ({\it intrs}, {\it elims})] |
104 | 587 |
joins introduction rules, their swapped versions, and elimination rules for |
588 |
use with \ttindex{biresolve_tac}. Each rule is paired with~{\tt false} |
|
589 |
(indicating ordinary resolution) or~{\tt true} (indicating |
|
590 |
elim-resolution). |
|
308 | 591 |
\end{ttdescription} |
104 | 592 |
|
593 |
||
286 | 594 |
\section{Setting up the classical reasoner} |
319 | 595 |
\index{classical reasoner!setting up} |
104 | 596 |
Isabelle's classical object-logics, including {\tt FOL} and {\tt HOL}, have |
286 | 597 |
the classical reasoner already set up. When defining a new classical logic, |
598 |
you should set up the reasoner yourself. It consists of the \ML{} functor |
|
104 | 599 |
\ttindex{ClassicalFun}, which takes the argument |
319 | 600 |
signature {\tt CLASSICAL_DATA}: |
104 | 601 |
\begin{ttbox} |
602 |
signature CLASSICAL_DATA = |
|
603 |
sig |
|
604 |
val mp : thm |
|
605 |
val not_elim : thm |
|
606 |
val swap : thm |
|
607 |
val sizef : thm -> int |
|
608 |
val hyp_subst_tacs : (int -> tactic) list |
|
609 |
end; |
|
610 |
\end{ttbox} |
|
611 |
Thus, the functor requires the following items: |
|
308 | 612 |
\begin{ttdescription} |
319 | 613 |
\item[\tdxbold{mp}] should be the Modus Ponens rule |
104 | 614 |
$\List{\Var{P}\imp\Var{Q};\; \Var{P}} \Imp \Var{Q}$. |
615 |
||
319 | 616 |
\item[\tdxbold{not_elim}] should be the contradiction rule |
104 | 617 |
$\List{\neg\Var{P};\; \Var{P}} \Imp \Var{R}$. |
618 |
||
319 | 619 |
\item[\tdxbold{swap}] should be the swap rule |
104 | 620 |
$\List{\neg \Var{P}; \; \neg \Var{R}\Imp \Var{P}} \Imp \Var{R}$. |
621 |
||
622 |
\item[\ttindexbold{sizef}] is the heuristic function used for best-first |
|
623 |
search. It should estimate the size of the remaining subgoals. A good |
|
624 |
heuristic function is \ttindex{size_of_thm}, which measures the size of the |
|
625 |
proof state. Another size function might ignore certain subgoals (say, |
|
626 |
those concerned with type checking). A heuristic function might simply |
|
627 |
count the subgoals. |
|
628 |
||
319 | 629 |
\item[\ttindexbold{hyp_subst_tacs}] is a list of tactics for substitution in |
104 | 630 |
the hypotheses, typically created by \ttindex{HypsubstFun} (see |
631 |
Chapter~\ref{substitution}). This list can, of course, be empty. The |
|
632 |
tactics are assumed to be safe! |
|
308 | 633 |
\end{ttdescription} |
104 | 634 |
The functor is not at all sensitive to the formalization of the |
3108 | 635 |
object-logic. It does not even examine the rules, but merely applies |
636 |
them according to its fixed strategy. The functor resides in {\tt |
|
637 |
Provers/classical.ML} in the Isabelle sources. |
|
104 | 638 |
|
319 | 639 |
\index{classical reasoner|)} |