author | wenzelm |
Mon, 31 Jul 2000 14:33:40 +0200 | |
changeset 9480 | 7afb808b6b3e |
parent 9438 | 6131037f8a11 |
child 9606 | 1bf495402ae9 |
permissions | -rw-r--r-- |
7135 | 1 |
|
7167 | 2 |
\chapter{Generic Tools and Packages}\label{ch:gen-tools} |
3 |
||
8517 | 4 |
\section{Axiomatic Type Classes}\label{sec:axclass} |
7167 | 5 |
|
8904 | 6 |
%FIXME |
7 |
% - qualified names |
|
8 |
% - class intro rules; |
|
9 |
% - class axioms; |
|
10 |
||
8517 | 11 |
\indexisarcmd{axclass}\indexisarcmd{instance}\indexisarmeth{intro-classes} |
7167 | 12 |
\begin{matharray}{rcl} |
8517 | 13 |
\isarcmd{axclass} & : & \isartrans{theory}{theory} \\ |
14 |
\isarcmd{instance} & : & \isartrans{theory}{proof(prove)} \\ |
|
15 |
intro_classes & : & \isarmeth \\ |
|
7167 | 16 |
\end{matharray} |
17 |
||
8517 | 18 |
Axiomatic type classes are provided by Isabelle/Pure as a \emph{definitional} |
19 |
interface to type classes (cf.~\S\ref{sec:classes}). Thus any object logic |
|
8547 | 20 |
may make use of this light-weight mechanism of abstract theories |
8901 | 21 |
\cite{Wenzel:1997:TPHOL}. There is also a tutorial on using axiomatic type |
22 |
classes in isabelle \cite{isabelle-axclass} that is part of the standard |
|
23 |
Isabelle documentation. |
|
8517 | 24 |
|
7167 | 25 |
\begin{rail} |
8517 | 26 |
'axclass' classdecl (axmdecl prop comment? +) |
27 |
; |
|
28 |
'instance' (nameref '<' nameref | nameref '::' simplearity) comment? |
|
7167 | 29 |
; |
30 |
\end{rail} |
|
31 |
||
32 |
\begin{descr} |
|
8517 | 33 |
\item [$\isarkeyword{axclass}~c < \vec c~axms$] defines an axiomatic type |
34 |
class as the intersection of existing classes, with additional axioms |
|
35 |
holding. Class axioms may not contain more than one type variable. The |
|
36 |
class axioms (with implicit sort constraints added) are bound to the given |
|
37 |
names. Furthermore a class introduction rule is generated, which is |
|
38 |
employed by method $intro_classes$ to support instantiation proofs of this |
|
39 |
class. |
|
7321 | 40 |
|
8517 | 41 |
\item [$\isarkeyword{instance}~c@1 < c@2$ and $\isarkeyword{instance}~t :: |
8547 | 42 |
(\vec s)c$] setup a goal stating a class relation or type arity. The proof |
43 |
would usually proceed by $intro_classes$, and then establish the |
|
8517 | 44 |
characteristic theorems of the type classes involved. After finishing the |
45 |
proof, the theory will be augmented by a type signature declaration |
|
46 |
corresponding to the resulting theorem. |
|
47 |
\item [$intro_classes$] repeatedly expands all class introduction rules of |
|
48 |
this theory. |
|
7167 | 49 |
\end{descr} |
50 |
||
7315 | 51 |
|
52 |
\section{Calculational proof}\label{sec:calculation} |
|
53 |
||
8619 | 54 |
\indexisarcmd{also}\indexisarcmd{finally} |
55 |
\indexisarcmd{moreover}\indexisarcmd{ultimately} |
|
56 |
\indexisaratt{trans} |
|
7315 | 57 |
\begin{matharray}{rcl} |
58 |
\isarcmd{also} & : & \isartrans{proof(state)}{proof(state)} \\ |
|
59 |
\isarcmd{finally} & : & \isartrans{proof(state)}{proof(chain)} \\ |
|
8619 | 60 |
\isarcmd{moreover} & : & \isartrans{proof(state)}{proof(state)} \\ |
61 |
\isarcmd{ultimately} & : & \isartrans{proof(state)}{proof(chain)} \\ |
|
7315 | 62 |
trans & : & \isaratt \\ |
63 |
\end{matharray} |
|
64 |
||
65 |
Calculational proof is forward reasoning with implicit application of |
|
66 |
transitivity rules (such those of $=$, $\le$, $<$). Isabelle/Isar maintains |
|
7391 | 67 |
an auxiliary register $calculation$\indexisarthm{calculation} for accumulating |
7897 | 68 |
results obtained by transitivity composed with the current result. Command |
69 |
$\ALSO$ updates $calculation$ involving $this$, while $\FINALLY$ exhibits the |
|
70 |
final $calculation$ by forward chaining towards the next goal statement. Both |
|
71 |
commands require valid current facts, i.e.\ may occur only after commands that |
|
72 |
produce theorems such as $\ASSUMENAME$, $\NOTENAME$, or some finished proof of |
|
8619 | 73 |
$\HAVENAME$, $\SHOWNAME$ etc. The $\MOREOVER$ and $\ULTIMATELY$ commands are |
74 |
similar to $\ALSO$ and $\FINALLY$, but only collect further results in |
|
75 |
$calculation$ without applying any rules yet. |
|
7315 | 76 |
|
77 |
Also note that the automatic term abbreviation ``$\dots$'' has its canonical |
|
8619 | 78 |
application with calculational proofs. It refers to the argument\footnote{The |
79 |
argument of a curried infix expression is its right-hand side.} of the |
|
80 |
preceding statement. |
|
7315 | 81 |
|
82 |
Isabelle/Isar calculations are implicitly subject to block structure in the |
|
83 |
sense that new threads of calculational reasoning are commenced for any new |
|
84 |
block (as opened by a local goal, for example). This means that, apart from |
|
85 |
being able to nest calculations, there is no separate \emph{begin-calculation} |
|
86 |
command required. |
|
87 |
||
8619 | 88 |
\medskip |
89 |
||
90 |
The Isar calculation proof commands may be defined as |
|
91 |
follows:\footnote{Internal bookkeeping such as proper handling of |
|
92 |
block-structure has been suppressed.} |
|
93 |
\begin{matharray}{rcl} |
|
94 |
\ALSO@0 & \equiv & \NOTE{calculation}{this} \\ |
|
95 |
\ALSO@{n+1} & \equiv & \NOTE{calculation}{trans~[OF~calculation~this]} \\ |
|
96 |
\FINALLY & \equiv & \ALSO~\FROM{calculation} \\ |
|
97 |
\MOREOVER & \equiv & \NOTE{calculation}{calculation~this} \\ |
|
98 |
\ULTIMATELY & \equiv & \MOREOVER~\FROM{calculation} \\ |
|
99 |
\end{matharray} |
|
100 |
||
7315 | 101 |
\begin{rail} |
102 |
('also' | 'finally') transrules? comment? |
|
103 |
; |
|
8619 | 104 |
('moreover' | 'ultimately') comment? |
105 |
; |
|
8507 | 106 |
'trans' (() | 'add' | 'del') |
7315 | 107 |
; |
108 |
||
109 |
transrules: '(' thmrefs ')' interest? |
|
110 |
; |
|
111 |
\end{rail} |
|
112 |
||
113 |
\begin{descr} |
|
8547 | 114 |
\item [$\ALSO~(\vec a)$] maintains the auxiliary $calculation$ register as |
7315 | 115 |
follows. The first occurrence of $\ALSO$ in some calculational thread |
7905 | 116 |
initializes $calculation$ by $this$. Any subsequent $\ALSO$ on the same |
7335 | 117 |
level of block-structure updates $calculation$ by some transitivity rule |
7458 | 118 |
applied to $calculation$ and $this$ (in that order). Transitivity rules are |
8547 | 119 |
picked from the current context plus those given as explicit arguments (the |
120 |
latter have precedence). |
|
7315 | 121 |
|
8547 | 122 |
\item [$\FINALLY~(\vec a)$] maintaining $calculation$ in the same way as |
7315 | 123 |
$\ALSO$, and concludes the current calculational thread. The final result |
124 |
is exhibited as fact for forward chaining towards the next goal. Basically, |
|
7987 | 125 |
$\FINALLY$ just abbreviates $\ALSO~\FROM{calculation}$. Note that |
126 |
``$\FINALLY~\SHOW{}{\Var{thesis}}~\DOT$'' and |
|
127 |
``$\FINALLY~\HAVE{}{\phi}~\DOT$'' are typical idioms for concluding |
|
128 |
calculational proofs. |
|
7315 | 129 |
|
8619 | 130 |
\item [$\MOREOVER$ and $\ULTIMATELY$] are analogous to $\ALSO$ and $\FINALLY$, |
131 |
but collect results only, without applying rules. |
|
132 |
||
8547 | 133 |
\item [$trans$] declares theorems as transitivity rules. |
7315 | 134 |
\end{descr} |
135 |
||
136 |
||
8483 | 137 |
\section{Named local contexts (cases)}\label{sec:cases} |
138 |
||
139 |
\indexisarcmd{case}\indexisarcmd{print-cases} |
|
140 |
\indexisaratt{case-names}\indexisaratt{params} |
|
141 |
\begin{matharray}{rcl} |
|
142 |
\isarcmd{case} & : & \isartrans{proof(state)}{proof(state)} \\ |
|
8517 | 143 |
\isarcmd{print_cases}^* & : & \isarkeep{proof} \\ |
8483 | 144 |
case_names & : & \isaratt \\ |
145 |
params & : & \isaratt \\ |
|
146 |
\end{matharray} |
|
147 |
||
148 |
Basically, Isar proof contexts are built up explicitly using commands like |
|
149 |
$\FIXNAME$, $\ASSUMENAME$ etc.\ (see \S\ref{sec:proof-context}). In typical |
|
150 |
verification tasks this can become hard to manage, though. In particular, a |
|
151 |
large number of local contexts may emerge from case analysis or induction over |
|
152 |
inductive sets and types. |
|
153 |
||
154 |
\medskip |
|
155 |
||
156 |
The $\CASENAME$ command provides a shorthand to refer to certain parts of |
|
157 |
logical context symbolically. Proof methods may provide an environment of |
|
8507 | 158 |
named ``cases'' of the form $c\colon \vec x, \vec \phi$. Then the effect of |
159 |
$\CASE{c}$ is exactly the same as $\FIX{\vec x}~\ASSUME{c}{\vec\phi}$. |
|
8483 | 160 |
|
161 |
It is important to note that $\CASENAME$ does \emph{not} provide any means to |
|
162 |
peek at the current goal state, which is treated as strictly non-observable in |
|
163 |
Isar! Instead, the cases considered here usually emerge in a canonical way |
|
164 |
from certain pieces of specification that appear in the theory somewhere else |
|
165 |
(e.g.\ in an inductive definition, or recursive function). See also |
|
166 |
\S\ref{sec:induct-method} for more details of how this works in HOL. |
|
167 |
||
168 |
\medskip |
|
169 |
||
170 |
Named cases may be exhibited in the current proof context only if both the |
|
8547 | 171 |
proof method and the rules involved support this. Case names and parameters |
172 |
of basic rules may be declared by hand as well, by using appropriate |
|
173 |
attributes. Thus variant versions of rules that have been derived manually |
|
174 |
may be used in advanced case analysis later. |
|
8483 | 175 |
|
176 |
\railalias{casenames}{case\_names} |
|
177 |
\railterm{casenames} |
|
178 |
||
179 |
\begin{rail} |
|
180 |
'case' nameref attributes? |
|
181 |
; |
|
182 |
casenames (name + ) |
|
183 |
; |
|
184 |
'params' ((name * ) + 'and') |
|
185 |
; |
|
186 |
\end{rail} |
|
8547 | 187 |
%FIXME bug in rail |
8483 | 188 |
|
189 |
\begin{descr} |
|
8507 | 190 |
\item [$\CASE{c}$] invokes a named local context $c\colon \vec x, \vec \phi$, |
8547 | 191 |
as provided by an appropriate proof method (such as $cases$ and $induct$ in |
192 |
Isabelle/HOL, see \S\ref{sec:induct-method}). The command $\CASE{c}$ |
|
193 |
abbreviates $\FIX{\vec x}~\ASSUME{c}{\vec\phi}$. |
|
8483 | 194 |
\item [$\isarkeyword{print_cases}$] prints all local contexts of the current |
8547 | 195 |
state, using Isar proof language notation. This is a diagnostic command; |
196 |
$undo$ does not apply. |
|
8483 | 197 |
\item [$case_names~\vec c$] declares names for the local contexts of premises |
8547 | 198 |
of some theorem; $\vec c$ refers to the \emph{suffix} of the list premises. |
8483 | 199 |
\item [$params~\vec p@1 \dots \vec p@n$] renames the innermost parameters of |
8547 | 200 |
premises $1, \dots, n$ of some theorem. An empty list of names may be given |
201 |
to skip positions, leaving the present parameters unchanged. |
|
8483 | 202 |
\end{descr} |
203 |
||
204 |
||
8517 | 205 |
\section{Generalized existence} |
7135 | 206 |
|
8517 | 207 |
\indexisarcmd{obtain} |
7135 | 208 |
\begin{matharray}{rcl} |
9480 | 209 |
\isarcmd{obtain} & : & \isartrans{proof(state)}{proof(prove)} \\ |
8517 | 210 |
\end{matharray} |
211 |
||
9480 | 212 |
Generalized existence means that additional elements with certain properties |
213 |
may introduced in the current context. Technically, the $\OBTAINNAME$ |
|
214 |
language element is like a declaration of $\FIXNAME$ and $\ASSUMENAME$ (see |
|
215 |
also see \S\ref{sec:proof-context}), together with a soundness proof of its |
|
216 |
additional claim. According to the nature of existential reasoning, |
|
217 |
assumptions get eliminated from any result exported from the context later, |
|
218 |
provided that the corresponding parameters do \emph{not} occur in the |
|
219 |
conclusion. |
|
8517 | 220 |
|
221 |
\begin{rail} |
|
222 |
'obtain' (vars + 'and') comment? \\ 'where' (assm comment? + 'and') |
|
223 |
; |
|
224 |
\end{rail} |
|
225 |
||
9480 | 226 |
$\OBTAINNAME$ is defined as a derived Isar command as follows, where $\vec b$ |
227 |
shall refer to (optional) facts indicated for forward chaining. |
|
8517 | 228 |
\begin{matharray}{l} |
9480 | 229 |
\langle facts~\vec b\rangle \\ |
230 |
\OBTAIN{\vec x}{a}{\vec \phi}~~\langle proof\rangle \equiv {} \\[1ex] |
|
231 |
\quad \BG \\ |
|
232 |
\qquad \FIX{thesis} \\ |
|
233 |
\qquad \ASSUME{that [simp, intro]}{\All{\vec x} \vec\phi \Imp thesis} \\ |
|
234 |
\qquad \FROM{\vec b}~\HAVE{}{thesis}~~\langle proof\rangle \\ |
|
235 |
\quad \EN \\ |
|
236 |
\quad \FIX{\vec x}~\ASSUMENAME^{obtained}~{a}~{\vec\phi} \\ |
|
7135 | 237 |
\end{matharray} |
238 |
||
8517 | 239 |
Typically, the soundness proof is relatively straight-forward, often just by |
240 |
canonical automated tools such as $\BY{simp}$ (see \S\ref{sec:simp}) or |
|
9480 | 241 |
$\BY{blast}$ (see \S\ref{sec:classical-auto}). Accordingly, the ``$that$'' |
242 |
reduction above is declared as simplification and introduction rule. |
|
8517 | 243 |
|
244 |
\medskip |
|
245 |
||
246 |
In a sense, $\OBTAINNAME$ represents at the level of Isar proofs what would be |
|
247 |
meta-logical existential quantifiers and conjunctions. This concept has a |
|
248 |
broad range of useful applications, ranging from plain elimination (or even |
|
249 |
introduction) of object-level existentials and conjunctions, to elimination |
|
250 |
over results of symbolic evaluation of recursive definitions, for example. |
|
9480 | 251 |
Also note that $\OBTAINNAME$ without parameters acts much like $\HAVENAME$, |
252 |
where the result is treated as an assumption. |
|
8517 | 253 |
|
254 |
||
255 |
\section{Miscellaneous methods and attributes} |
|
256 |
||
257 |
\indexisarmeth{unfold}\indexisarmeth{fold} |
|
258 |
\indexisarmeth{erule}\indexisarmeth{drule}\indexisarmeth{frule} |
|
259 |
\indexisarmeth{fail}\indexisarmeth{succeed} |
|
260 |
\begin{matharray}{rcl} |
|
261 |
unfold & : & \isarmeth \\ |
|
262 |
fold & : & \isarmeth \\[0.5ex] |
|
263 |
erule^* & : & \isarmeth \\ |
|
264 |
drule^* & : & \isarmeth \\ |
|
265 |
frule^* & : & \isarmeth \\[0.5ex] |
|
266 |
succeed & : & \isarmeth \\ |
|
267 |
fail & : & \isarmeth \\ |
|
268 |
\end{matharray} |
|
7135 | 269 |
|
270 |
\begin{rail} |
|
8517 | 271 |
('fold' | 'unfold' | 'erule' | 'drule' | 'frule') thmrefs |
7135 | 272 |
; |
273 |
\end{rail} |
|
274 |
||
7167 | 275 |
\begin{descr} |
8547 | 276 |
\item [$unfold~\vec a$ and $fold~\vec a$] expand and fold back again the given |
8517 | 277 |
meta-level definitions throughout all goals; any facts provided are inserted |
278 |
into the goal and subject to rewriting as well. |
|
8547 | 279 |
\item [$erule~\vec a$, $drule~\vec a$, and $frule~\vec a$] are similar to the |
280 |
basic $rule$ method (see \S\ref{sec:pure-meth-att}), but apply rules by |
|
8517 | 281 |
elim-resolution, destruct-resolution, and forward-resolution, respectively |
282 |
\cite{isabelle-ref}. These are improper method, mainly for experimentation |
|
283 |
and emulating tactic scripts. |
|
7335 | 284 |
|
8517 | 285 |
Different modes of basic rule application are usually expressed in Isar at |
286 |
the proof language level, rather than via implicit proof state |
|
8547 | 287 |
manipulations. For example, a proper single-step elimination would be done |
8517 | 288 |
using the basic $rule$ method, with forward chaining of current facts. |
289 |
\item [$succeed$] yields a single (unchanged) result; it is the identity of |
|
290 |
the ``\texttt{,}'' method combinator (cf.\ \S\ref{sec:syn-meth}). |
|
291 |
\item [$fail$] yields an empty result sequence; it is the identity of the |
|
292 |
``\texttt{|}'' method combinator (cf.\ \S\ref{sec:syn-meth}). |
|
7167 | 293 |
\end{descr} |
7135 | 294 |
|
8517 | 295 |
|
296 |
\indexisaratt{standard} |
|
297 |
\indexisaratt{elimify} |
|
9232 | 298 |
\indexisaratt{no-vars} |
8517 | 299 |
|
300 |
\indexisaratt{RS}\indexisaratt{COMP} |
|
301 |
\indexisaratt{where} |
|
302 |
\indexisaratt{tag}\indexisaratt{untag} |
|
303 |
\indexisaratt{export} |
|
304 |
\indexisaratt{unfold}\indexisaratt{fold} |
|
305 |
\begin{matharray}{rcl} |
|
306 |
tag & : & \isaratt \\ |
|
307 |
untag & : & \isaratt \\[0.5ex] |
|
308 |
RS & : & \isaratt \\ |
|
309 |
COMP & : & \isaratt \\[0.5ex] |
|
310 |
where & : & \isaratt \\[0.5ex] |
|
311 |
unfold & : & \isaratt \\ |
|
312 |
fold & : & \isaratt \\[0.5ex] |
|
313 |
standard & : & \isaratt \\ |
|
314 |
elimify & : & \isaratt \\ |
|
9232 | 315 |
no_vars & : & \isaratt \\ |
8517 | 316 |
export^* & : & \isaratt \\ |
317 |
\end{matharray} |
|
318 |
||
319 |
\begin{rail} |
|
320 |
'tag' (nameref+) |
|
321 |
; |
|
322 |
'untag' name |
|
323 |
; |
|
324 |
('RS' | 'COMP') nat? thmref |
|
325 |
; |
|
326 |
'where' (name '=' term * 'and') |
|
327 |
; |
|
328 |
('unfold' | 'fold') thmrefs |
|
329 |
; |
|
330 |
\end{rail} |
|
331 |
||
332 |
\begin{descr} |
|
333 |
\item [$tag~name~args$ and $untag~name$] add and remove $tags$ of some |
|
334 |
theorem. Tags may be any list of strings that serve as comment for some |
|
335 |
tools (e.g.\ $\LEMMANAME$ causes the tag ``$lemma$'' to be added to the |
|
336 |
result). The first string is considered the tag name, the rest its |
|
337 |
arguments. Note that untag removes any tags of the same name. |
|
8547 | 338 |
\item [$RS~n~a$ and $COMP~n~a$] compose rules. $RS$ resolves with the $n$-th |
339 |
premise of $a$; $COMP$ is a version of $RS$ that skips the automatic lifting |
|
340 |
process that is normally intended (cf.\ \texttt{RS} and \texttt{COMP} in |
|
341 |
\cite[\S5]{isabelle-ref}). |
|
8517 | 342 |
\item [$where~\vec x = \vec t$] perform named instantiation of schematic |
343 |
variables occurring in a theorem. Unlike instantiation tactics (such as |
|
344 |
\texttt{res_inst_tac}, see \cite{isabelle-ref}), actual schematic variables |
|
345 |
have to be specified (e.g.\ $\Var{x@3}$). |
|
346 |
||
8547 | 347 |
\item [$unfold~\vec a$ and $fold~\vec a$] expand and fold back again the given |
8517 | 348 |
meta-level definitions throughout a rule. |
349 |
||
350 |
\item [$standard$] puts a theorem into the standard form of object-rules, just |
|
351 |
as the ML function \texttt{standard} (see \cite[\S5]{isabelle-ref}). |
|
352 |
||
353 |
\item [$elimify$] turns an destruction rule into an elimination, just as the |
|
354 |
ML function \texttt{make\_elim} (see \cite{isabelle-ref}). |
|
355 |
||
9232 | 356 |
\item [$no_vars$] replaces schematic variables by free ones; this is mainly |
357 |
for tuning output of pretty printed theorems. |
|
358 |
||
8517 | 359 |
\item [$export$] lifts a local result out of the current proof context, |
360 |
generalizing all fixed variables and discharging all assumptions. Note that |
|
8547 | 361 |
proper incremental export is already done as part of the basic Isar |
362 |
machinery. This attribute is mainly for experimentation. |
|
8517 | 363 |
|
364 |
\end{descr} |
|
7135 | 365 |
|
366 |
||
367 |
\section{The Simplifier} |
|
368 |
||
7321 | 369 |
\subsection{Simplification methods}\label{sec:simp} |
7315 | 370 |
|
8483 | 371 |
\indexisarmeth{simp}\indexisarmeth{simp-all} |
7315 | 372 |
\begin{matharray}{rcl} |
373 |
simp & : & \isarmeth \\ |
|
8483 | 374 |
simp_all & : & \isarmeth \\ |
7315 | 375 |
\end{matharray} |
376 |
||
8483 | 377 |
\railalias{simpall}{simp\_all} |
378 |
\railterm{simpall} |
|
379 |
||
8704 | 380 |
\railalias{noasm}{no\_asm} |
381 |
\railterm{noasm} |
|
382 |
||
383 |
\railalias{noasmsimp}{no\_asm\_simp} |
|
384 |
\railterm{noasmsimp} |
|
385 |
||
386 |
\railalias{noasmuse}{no\_asm\_use} |
|
387 |
\railterm{noasmuse} |
|
388 |
||
7315 | 389 |
\begin{rail} |
8706 | 390 |
('simp' | simpall) ('!' ?) opt? (simpmod * ) |
7315 | 391 |
; |
392 |
||
8811 | 393 |
opt: '(' (noasm | noasmsimp | noasmuse) ')' |
8704 | 394 |
; |
8483 | 395 |
simpmod: ('add' | 'del' | 'only' | 'split' (() | 'add' | 'del') | 'other') ':' thmrefs |
7315 | 396 |
; |
397 |
\end{rail} |
|
398 |
||
7321 | 399 |
\begin{descr} |
8547 | 400 |
\item [$simp$] invokes Isabelle's simplifier, after declaring additional rules |
8594 | 401 |
according to the arguments given. Note that the \railtterm{only} modifier |
8547 | 402 |
first removes all other rewrite rules, congruences, and looper tactics |
8594 | 403 |
(including splits), and then behaves like \railtterm{add}. |
7321 | 404 |
|
8594 | 405 |
The \railtterm{split} modifiers add or delete rules for the Splitter (see |
8483 | 406 |
also \cite{isabelle-ref}), the default is to add. This works only if the |
407 |
Simplifier method has been properly setup to include the Splitter (all major |
|
408 |
object logics such HOL, HOLCF, FOL, ZF do this already). |
|
409 |
||
8594 | 410 |
The \railtterm{other} modifier ignores its arguments. Nevertheless, |
8547 | 411 |
additional kinds of rules may be declared by including appropriate |
412 |
attributes in the specification. |
|
8483 | 413 |
\item [$simp_all$] is similar to $simp$, but acts on all goals. |
7321 | 414 |
\end{descr} |
415 |
||
8704 | 416 |
By default, the Simplifier methods are based on \texttt{asm_full_simp_tac} |
8706 | 417 |
internally \cite[\S10]{isabelle-ref}, which means that assumptions are both |
418 |
simplified as well as used in simplifying the conclusion. In structured |
|
419 |
proofs this is usually quite well behaved in practice: just the local premises |
|
420 |
of the actual goal are involved, additional facts may inserted via explicit |
|
421 |
forward-chaining (using $\THEN$, $\FROMNAME$ etc.). The full context of |
|
422 |
assumptions is only included if the ``$!$'' (bang) argument is given, which |
|
423 |
should be used with some care, though. |
|
7321 | 424 |
|
8704 | 425 |
Additional Simplifier options may be specified to tune the behavior even |
8811 | 426 |
further: $(no_asm)$ means assumptions are ignored completely (cf.\ |
427 |
\texttt{simp_tac}), $(no_asm_simp)$ means assumptions are used in the |
|
8704 | 428 |
simplification of the conclusion but are not themselves simplified (cf.\ |
8811 | 429 |
\texttt{asm_simp_tac}), and $(no_asm_use)$ means assumptions are simplified |
430 |
but are not used in the simplification of each other or the conclusion (cf. |
|
8704 | 431 |
\texttt{full_simp_tac}). |
432 |
||
433 |
\medskip |
|
434 |
||
435 |
The Splitter package is usually configured to work as part of the Simplifier. |
|
436 |
There is no separate $split$ method available. The effect of repeatedly |
|
437 |
applying \texttt{split_tac} can be simulated by |
|
438 |
$(simp~only\colon~split\colon~\vec a)$. |
|
8483 | 439 |
|
440 |
||
441 |
\subsection{Declaring rules} |
|
442 |
||
8667 | 443 |
\indexisarcmd{print-simpset} |
8638 | 444 |
\indexisaratt{simp}\indexisaratt{split}\indexisaratt{cong} |
7321 | 445 |
\begin{matharray}{rcl} |
8667 | 446 |
print_simpset & : & \isarkeep{theory~|~proof} \\ |
7321 | 447 |
simp & : & \isaratt \\ |
8483 | 448 |
split & : & \isaratt \\ |
8638 | 449 |
cong & : & \isaratt \\ |
7321 | 450 |
\end{matharray} |
451 |
||
452 |
\begin{rail} |
|
8638 | 453 |
('simp' | 'split' | 'cong') (() | 'add' | 'del') |
7321 | 454 |
; |
455 |
\end{rail} |
|
456 |
||
457 |
\begin{descr} |
|
8667 | 458 |
\item [$print_simpset$] prints the collection of rules declared to the |
459 |
Simplifier, which is also known as ``simpset'' internally |
|
460 |
\cite{isabelle-ref}. This is a diagnostic command; $undo$ does not apply. |
|
8547 | 461 |
\item [$simp$] declares simplification rules. |
462 |
\item [$split$] declares split rules. |
|
8638 | 463 |
\item [$cong$] declares congruence rules. |
7321 | 464 |
\end{descr} |
7319 | 465 |
|
7315 | 466 |
|
467 |
\subsection{Forward simplification} |
|
468 |
||
7391 | 469 |
\indexisaratt{simplify}\indexisaratt{asm-simplify} |
470 |
\indexisaratt{full-simplify}\indexisaratt{asm-full-simplify} |
|
7315 | 471 |
\begin{matharray}{rcl} |
472 |
simplify & : & \isaratt \\ |
|
473 |
asm_simplify & : & \isaratt \\ |
|
474 |
full_simplify & : & \isaratt \\ |
|
475 |
asm_full_simplify & : & \isaratt \\ |
|
476 |
\end{matharray} |
|
477 |
||
7321 | 478 |
These attributes provide forward rules for simplification, which should be |
8547 | 479 |
used only very rarely. There are no separate options for declaring |
7905 | 480 |
simplification rules locally. |
481 |
||
482 |
See the ML functions of the same name in \cite[\S10]{isabelle-ref} for more |
|
483 |
information. |
|
7315 | 484 |
|
485 |
||
7135 | 486 |
\section{The Classical Reasoner} |
487 |
||
7335 | 488 |
\subsection{Basic methods}\label{sec:classical-basic} |
7321 | 489 |
|
7974 | 490 |
\indexisarmeth{rule}\indexisarmeth{intro} |
491 |
\indexisarmeth{elim}\indexisarmeth{default}\indexisarmeth{contradiction} |
|
7321 | 492 |
\begin{matharray}{rcl} |
493 |
rule & : & \isarmeth \\ |
|
494 |
intro & : & \isarmeth \\ |
|
495 |
elim & : & \isarmeth \\ |
|
496 |
contradiction & : & \isarmeth \\ |
|
497 |
\end{matharray} |
|
498 |
||
499 |
\begin{rail} |
|
8547 | 500 |
('rule' | 'intro' | 'elim') thmrefs? |
7321 | 501 |
; |
502 |
\end{rail} |
|
503 |
||
504 |
\begin{descr} |
|
7466 | 505 |
\item [$rule$] as offered by the classical reasoner is a refinement over the |
8517 | 506 |
primitive one (see \S\ref{sec:pure-meth-att}). In case that no rules are |
7466 | 507 |
provided as arguments, it automatically determines elimination and |
7321 | 508 |
introduction rules from the context (see also \S\ref{sec:classical-mod}). |
8517 | 509 |
This is made the default method for basic proof steps, such as $\PROOFNAME$ |
510 |
and ``$\DDOT$'' (two dots), see also \S\ref{sec:proof-steps} and |
|
511 |
\S\ref{sec:pure-meth-att}. |
|
7321 | 512 |
|
7466 | 513 |
\item [$intro$ and $elim$] repeatedly refine some goal by intro- or |
7905 | 514 |
elim-resolution, after having inserted any facts. Omitting the arguments |
8547 | 515 |
refers to any suitable rules declared in the context, otherwise only the |
516 |
explicitly given ones may be applied. The latter form admits better control |
|
517 |
of what actually happens, thus it is very appropriate as an initial method |
|
518 |
for $\PROOFNAME$ that splits up certain connectives of the goal, before |
|
519 |
entering the actual sub-proof. |
|
7458 | 520 |
|
7466 | 521 |
\item [$contradiction$] solves some goal by contradiction, deriving any result |
522 |
from both $\neg A$ and $A$. Facts, which are guaranteed to participate, may |
|
523 |
appear in either order. |
|
7321 | 524 |
\end{descr} |
525 |
||
526 |
||
7981 | 527 |
\subsection{Automated methods}\label{sec:classical-auto} |
7315 | 528 |
|
9438 | 529 |
\indexisarmeth{blast}\indexisarmeth{fast}\indexisarmeth{best}\indexisarmeth{clarify} |
7321 | 530 |
\begin{matharray}{rcl} |
531 |
blast & : & \isarmeth \\ |
|
532 |
fast & : & \isarmeth \\ |
|
533 |
best & : & \isarmeth \\ |
|
9438 | 534 |
clarify & : & \isarmeth \\ |
7321 | 535 |
\end{matharray} |
536 |
||
537 |
\begin{rail} |
|
7905 | 538 |
'blast' ('!' ?) nat? (clamod * ) |
7321 | 539 |
; |
9438 | 540 |
('fast' | 'best' | 'clarify') ('!' ?) (clamod * ) |
7321 | 541 |
; |
542 |
||
9408 | 543 |
clamod: (('intro' | 'elim' | 'dest') ('!' | () | '?') | 'del') ':' thmrefs |
7321 | 544 |
; |
545 |
\end{rail} |
|
546 |
||
547 |
\begin{descr} |
|
548 |
\item [$blast$] refers to the classical tableau prover (see \texttt{blast_tac} |
|
7335 | 549 |
in \cite[\S11]{isabelle-ref}). The optional argument specifies a |
7321 | 550 |
user-supplied search bound (default 20). |
9438 | 551 |
\item [$fast$, $best$, and $clarify$] refer to the generic classical reasoner. |
552 |
See \texttt{fast_tac}, \texttt{best_tac}, and \texttt{clarify_tac} in |
|
553 |
\cite[\S11]{isabelle-ref} for more information. |
|
7321 | 554 |
\end{descr} |
555 |
||
556 |
Any of above methods support additional modifiers of the context of classical |
|
8517 | 557 |
rules. Their semantics is analogous to the attributes given in |
8547 | 558 |
\S\ref{sec:classical-mod}. Facts provided by forward chaining are |
559 |
inserted\footnote{These methods usually cannot make proper use of actual rules |
|
560 |
inserted that way, though.} into the goal before doing the search. The |
|
561 |
``!''~argument causes the full context of assumptions to be included as well. |
|
562 |
This is slightly less hazardous than for the Simplifier (see |
|
563 |
\S\ref{sec:simp}). |
|
7321 | 564 |
|
7315 | 565 |
|
7981 | 566 |
\subsection{Combined automated methods} |
7315 | 567 |
|
9438 | 568 |
\indexisarmeth{force}\indexisarmeth{auto}\indexisarmeth{clarsimp} |
7321 | 569 |
\begin{matharray}{rcl} |
570 |
force & : & \isarmeth \\ |
|
571 |
auto & : & \isarmeth \\ |
|
9438 | 572 |
clarsimp & : & \isarmeth \\ |
7321 | 573 |
\end{matharray} |
574 |
||
575 |
\begin{rail} |
|
9438 | 576 |
('force' | 'auto' | 'clarsimp') ('!' ?) (clasimpmod * ) |
7321 | 577 |
; |
7315 | 578 |
|
8483 | 579 |
clasimpmod: ('simp' (() | 'add' | 'del' | 'only') | 'other' | |
580 |
('split' (() | 'add' | 'del')) | |
|
9408 | 581 |
(('intro' | 'elim' | 'dest') ('!' | () | '?') | 'del')) ':' thmrefs |
7321 | 582 |
\end{rail} |
7315 | 583 |
|
7321 | 584 |
\begin{descr} |
9438 | 585 |
\item [$force$, $auto$, and $clarsimp$] provide access to Isabelle's combined |
586 |
simplification and classical reasoning tactics. See \texttt{force_tac}, |
|
587 |
\texttt{auto_tac}, and \texttt{clarsimp_tac} in \cite[\S11]{isabelle-ref} |
|
588 |
for more information. The modifier arguments correspond to those given in |
|
589 |
\S\ref{sec:simp} and \S\ref{sec:classical-auto}. Just note that the ones |
|
590 |
related to the Simplifier are prefixed by \railtterm{simp} here. |
|
7987 | 591 |
|
592 |
Facts provided by forward chaining are inserted into the goal before doing |
|
593 |
the search. The ``!''~argument causes the full context of assumptions to be |
|
594 |
included as well. |
|
7321 | 595 |
\end{descr} |
596 |
||
7987 | 597 |
|
8483 | 598 |
\subsection{Declaring rules}\label{sec:classical-mod} |
7135 | 599 |
|
8667 | 600 |
\indexisarcmd{print-claset} |
7391 | 601 |
\indexisaratt{intro}\indexisaratt{elim}\indexisaratt{dest} |
602 |
\indexisaratt{iff}\indexisaratt{delrule} |
|
7321 | 603 |
\begin{matharray}{rcl} |
8667 | 604 |
print_claset & : & \isarkeep{theory~|~proof} \\ |
7321 | 605 |
intro & : & \isaratt \\ |
606 |
elim & : & \isaratt \\ |
|
607 |
dest & : & \isaratt \\ |
|
7391 | 608 |
iff & : & \isaratt \\ |
7321 | 609 |
delrule & : & \isaratt \\ |
610 |
\end{matharray} |
|
7135 | 611 |
|
7321 | 612 |
\begin{rail} |
9408 | 613 |
('intro' | 'elim' | 'dest') ('!' | () | '?') |
7321 | 614 |
; |
8638 | 615 |
'iff' (() | 'add' | 'del') |
7321 | 616 |
\end{rail} |
7135 | 617 |
|
7321 | 618 |
\begin{descr} |
8667 | 619 |
\item [$print_claset$] prints the collection of rules declared to the |
620 |
Classical Reasoner, which is also known as ``simpset'' internally |
|
621 |
\cite{isabelle-ref}. This is a diagnostic command; $undo$ does not apply. |
|
8517 | 622 |
\item [$intro$, $elim$, and $dest$] declare introduction, elimination, and |
623 |
destruct rules, respectively. By default, rules are considered as |
|
9408 | 624 |
\emph{unsafe} (i.e.\ not applied blindly without backtracking), while a |
625 |
single ``!'' classifies as \emph{safe}, and ``?'' as \emph{extra} (i.e.\ not |
|
626 |
applied in the search-oriented automated methods, but only in single-step |
|
627 |
methods such as $rule$). |
|
7335 | 628 |
|
8547 | 629 |
\item [$iff$] declares equations both as rules for the Simplifier and |
630 |
Classical Reasoner. |
|
7391 | 631 |
|
7335 | 632 |
\item [$delrule$] deletes introduction or elimination rules from the context. |
633 |
Note that destruction rules would have to be turned into elimination rules |
|
7321 | 634 |
first, e.g.\ by using the $elimify$ attribute. |
635 |
\end{descr} |
|
7135 | 636 |
|
8203
2fcc6017cb72
intro/elim/dest attributes: changed ! / !! flags to ? / ??;
wenzelm
parents:
8195
diff
changeset
|
637 |
|
7135 | 638 |
%%% Local Variables: |
639 |
%%% mode: latex |
|
640 |
%%% TeX-master: "isar-ref" |
|
641 |
%%% End: |