| author | wenzelm | 
| Tue, 13 Feb 2001 16:48:36 +0100 | |
| changeset 11110 | 306beb99e192 | 
| parent 11100 | 34d58b1818f4 | 
| child 11128 | 48c63b87566e | 
| 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 | ; | |
| 11100 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11095diff
changeset | 28 |   'instance' (nameref ('<' | subseteq) nameref | nameref '::' simplearity) comment?
 | 
| 7167 | 29 | ; | 
| 30 | \end{rail}
 | |
| 31 | ||
| 32 | \begin{descr}
 | |
| 11100 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11095diff
changeset | 33 | \item [$\AXCLASS~c \subseteq \vec c~axms$] defines an axiomatic type class as | 
| 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11095diff
changeset | 34 | the intersection of existing classes, with additional axioms holding. Class | 
| 10223 | 35 | axioms may not contain more than one type variable. The class axioms (with | 
| 36 | implicit sort constraints added) are bound to the given names. Furthermore | |
| 37 | a class introduction rule is generated, which is employed by method | |
| 38 | $intro_classes$ to support instantiation proofs of this class. | |
| 39 | ||
| 11100 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11095diff
changeset | 40 | \item [$\INSTANCE~c@1 \subseteq c@2$ and $\INSTANCE~t :: (\vec s)c$] setup a | 
| 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11095diff
changeset | 41 | goal stating a class relation or type arity. The proof would usually | 
| 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11095diff
changeset | 42 | proceed by $intro_classes$, and then establish the characteristic theorems | 
| 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11095diff
changeset | 43 | of the type classes involved. After finishing the proof, the theory will be | 
| 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11095diff
changeset | 44 | augmented by a type signature declaration corresponding to the resulting | 
| 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11095diff
changeset | 45 | theorem. | 
| 8517 | 46 | \item [$intro_classes$] repeatedly expands all class introduction rules of | 
| 10858 | 47 | this theory. Note that this method usually needs not be named explicitly, | 
| 48 | as it is already included in the default proof step (of $\PROOFNAME$, | |
| 49 | $\BYNAME$, etc.). In particular, instantiation of trivial (syntactic) | |
| 50 | classes may be performed by a single ``$\DDOT$'' proof step. | |
| 7167 | 51 | \end{descr}
 | 
| 52 | ||
| 7315 | 53 | |
| 54 | \section{Calculational proof}\label{sec:calculation}
 | |
| 55 | ||
| 8619 | 56 | \indexisarcmd{also}\indexisarcmd{finally}
 | 
| 57 | \indexisarcmd{moreover}\indexisarcmd{ultimately}
 | |
| 9606 | 58 | \indexisarcmd{print-trans-rules}\indexisaratt{trans}
 | 
| 7315 | 59 | \begin{matharray}{rcl}
 | 
| 60 |   \isarcmd{also} & : & \isartrans{proof(state)}{proof(state)} \\
 | |
| 61 |   \isarcmd{finally} & : & \isartrans{proof(state)}{proof(chain)} \\
 | |
| 8619 | 62 |   \isarcmd{moreover} & : & \isartrans{proof(state)}{proof(state)} \\
 | 
| 63 |   \isarcmd{ultimately} & : & \isartrans{proof(state)}{proof(chain)} \\
 | |
| 10154 | 64 |   \isarcmd{print_trans_rules}^* & : & \isarkeep{theory~|~proof} \\
 | 
| 7315 | 65 | trans & : & \isaratt \\ | 
| 66 | \end{matharray}
 | |
| 67 | ||
| 68 | Calculational proof is forward reasoning with implicit application of | |
| 69 | transitivity rules (such those of $=$, $\le$, $<$). Isabelle/Isar maintains | |
| 7391 | 70 | an auxiliary register $calculation$\indexisarthm{calculation} for accumulating
 | 
| 7897 | 71 | results obtained by transitivity composed with the current result. Command | 
| 72 | $\ALSO$ updates $calculation$ involving $this$, while $\FINALLY$ exhibits the | |
| 73 | final $calculation$ by forward chaining towards the next goal statement. Both | |
| 74 | commands require valid current facts, i.e.\ may occur only after commands that | |
| 75 | produce theorems such as $\ASSUMENAME$, $\NOTENAME$, or some finished proof of | |
| 8619 | 76 | $\HAVENAME$, $\SHOWNAME$ etc. The $\MOREOVER$ and $\ULTIMATELY$ commands are | 
| 77 | similar to $\ALSO$ and $\FINALLY$, but only collect further results in | |
| 78 | $calculation$ without applying any rules yet. | |
| 7315 | 79 | |
| 80 | Also note that the automatic term abbreviation ``$\dots$'' has its canonical | |
| 8619 | 81 | application with calculational proofs.  It refers to the argument\footnote{The
 | 
| 82 | argument of a curried infix expression is its right-hand side.} of the | |
| 83 | preceding statement. | |
| 7315 | 84 | |
| 85 | Isabelle/Isar calculations are implicitly subject to block structure in the | |
| 86 | sense that new threads of calculational reasoning are commenced for any new | |
| 87 | block (as opened by a local goal, for example). This means that, apart from | |
| 88 | being able to nest calculations, there is no separate \emph{begin-calculation}
 | |
| 89 | command required. | |
| 90 | ||
| 8619 | 91 | \medskip | 
| 92 | ||
| 93 | The Isar calculation proof commands may be defined as | |
| 94 | follows:\footnote{Internal bookkeeping such as proper handling of
 | |
| 95 | block-structure has been suppressed.} | |
| 96 | \begin{matharray}{rcl}
 | |
| 97 |   \ALSO@0 & \equiv & \NOTE{calculation}{this} \\
 | |
| 9606 | 98 |   \ALSO@{n+1} & \equiv & \NOTE{calculation}{trans~[OF~calculation~this]} \\[0.5ex]
 | 
| 8619 | 99 |   \FINALLY & \equiv & \ALSO~\FROM{calculation} \\
 | 
| 100 |   \MOREOVER & \equiv & \NOTE{calculation}{calculation~this} \\
 | |
| 101 |   \ULTIMATELY & \equiv & \MOREOVER~\FROM{calculation} \\
 | |
| 102 | \end{matharray}
 | |
| 103 | ||
| 7315 | 104 | \begin{rail}
 | 
| 105 |   ('also' | 'finally') transrules? comment?
 | |
| 106 | ; | |
| 8619 | 107 |   ('moreover' | 'ultimately') comment?
 | 
| 108 | ; | |
| 8507 | 109 | 'trans' (() | 'add' | 'del') | 
| 7315 | 110 | ; | 
| 111 | ||
| 112 |   transrules: '(' thmrefs ')' interest?
 | |
| 113 | ; | |
| 114 | \end{rail}
 | |
| 115 | ||
| 116 | \begin{descr}
 | |
| 8547 | 117 | \item [$\ALSO~(\vec a)$] maintains the auxiliary $calculation$ register as | 
| 7315 | 118 | follows. The first occurrence of $\ALSO$ in some calculational thread | 
| 7905 | 119 | initializes $calculation$ by $this$. Any subsequent $\ALSO$ on the same | 
| 7335 | 120 | level of block-structure updates $calculation$ by some transitivity rule | 
| 7458 | 121 | applied to $calculation$ and $this$ (in that order). Transitivity rules are | 
| 11095 | 122 | picked from the current context, unless alternative rules are given as | 
| 123 | explicit arguments. | |
| 9614 | 124 | |
| 8547 | 125 | \item [$\FINALLY~(\vec a)$] maintaining $calculation$ in the same way as | 
| 7315 | 126 | $\ALSO$, and concludes the current calculational thread. The final result | 
| 127 | is exhibited as fact for forward chaining towards the next goal. Basically, | |
| 7987 | 128 |   $\FINALLY$ just abbreviates $\ALSO~\FROM{calculation}$.  Note that
 | 
| 129 |   ``$\FINALLY~\SHOW{}{\Var{thesis}}~\DOT$'' and
 | |
| 130 |   ``$\FINALLY~\HAVE{}{\phi}~\DOT$'' are typical idioms for concluding
 | |
| 131 | calculational proofs. | |
| 9614 | 132 | |
| 8619 | 133 | \item [$\MOREOVER$ and $\ULTIMATELY$] are analogous to $\ALSO$ and $\FINALLY$, | 
| 134 | but collect results only, without applying rules. | |
| 9614 | 135 | |
| 9606 | 136 | \item [$\isarkeyword{print_trans_rules}$] prints the list of transitivity
 | 
| 137 | rules declared in the current context. | |
| 9614 | 138 | |
| 8547 | 139 | \item [$trans$] declares theorems as transitivity rules. | 
| 9614 | 140 | |
| 7315 | 141 | \end{descr}
 | 
| 142 | ||
| 143 | ||
| 8483 | 144 | \section{Named local contexts (cases)}\label{sec:cases}
 | 
| 145 | ||
| 146 | \indexisarcmd{case}\indexisarcmd{print-cases}
 | |
| 10548 | 147 | \indexisaratt{case-names}\indexisaratt{params}\indexisaratt{consumes}
 | 
| 8483 | 148 | \begin{matharray}{rcl}
 | 
| 149 |   \isarcmd{case} & : & \isartrans{proof(state)}{proof(state)} \\
 | |
| 8517 | 150 |   \isarcmd{print_cases}^* & : & \isarkeep{proof} \\
 | 
| 8483 | 151 | case_names & : & \isaratt \\ | 
| 152 | params & : & \isaratt \\ | |
| 10548 | 153 | consumes & : & \isaratt \\ | 
| 8483 | 154 | \end{matharray}
 | 
| 155 | ||
| 156 | Basically, Isar proof contexts are built up explicitly using commands like | |
| 157 | $\FIXNAME$, $\ASSUMENAME$ etc.\ (see \S\ref{sec:proof-context}).  In typical
 | |
| 158 | verification tasks this can become hard to manage, though. In particular, a | |
| 159 | large number of local contexts may emerge from case analysis or induction over | |
| 160 | inductive sets and types. | |
| 161 | ||
| 162 | \medskip | |
| 163 | ||
| 164 | The $\CASENAME$ command provides a shorthand to refer to certain parts of | |
| 165 | logical context symbolically. Proof methods may provide an environment of | |
| 8507 | 166 | named ``cases'' of the form $c\colon \vec x, \vec \phi$. Then the effect of | 
| 167 | $\CASE{c}$ is exactly the same as $\FIX{\vec x}~\ASSUME{c}{\vec\phi}$.
 | |
| 8483 | 168 | |
| 169 | It is important to note that $\CASENAME$ does \emph{not} provide any means to
 | |
| 170 | peek at the current goal state, which is treated as strictly non-observable in | |
| 171 | Isar! Instead, the cases considered here usually emerge in a canonical way | |
| 172 | from certain pieces of specification that appear in the theory somewhere else | |
| 173 | (e.g.\ in an inductive definition, or recursive function). See also | |
| 174 | \S\ref{sec:induct-method} for more details of how this works in HOL.
 | |
| 175 | ||
| 176 | \medskip | |
| 177 | ||
| 178 | Named cases may be exhibited in the current proof context only if both the | |
| 8547 | 179 | proof method and the rules involved support this. Case names and parameters | 
| 180 | of basic rules may be declared by hand as well, by using appropriate | |
| 181 | attributes. Thus variant versions of rules that have been derived manually | |
| 182 | may be used in advanced case analysis later. | |
| 8483 | 183 | |
| 184 | \railalias{casenames}{case\_names}
 | |
| 185 | \railterm{casenames}
 | |
| 186 | ||
| 187 | \begin{rail}
 | |
| 188 | 'case' nameref attributes? | |
| 189 | ; | |
| 190 | casenames (name + ) | |
| 191 | ; | |
| 192 | 'params' ((name * ) + 'and') | |
| 193 | ; | |
| 10548 | 194 | 'consumes' nat? | 
| 195 | ; | |
| 8483 | 196 | \end{rail}
 | 
| 8547 | 197 | %FIXME bug in rail | 
| 8483 | 198 | |
| 199 | \begin{descr}
 | |
| 8507 | 200 | \item [$\CASE{c}$] invokes a named local context $c\colon \vec x, \vec \phi$,
 | 
| 8547 | 201 | as provided by an appropriate proof method (such as $cases$ and $induct$ in | 
| 202 |   Isabelle/HOL, see \S\ref{sec:induct-method}).  The command $\CASE{c}$
 | |
| 203 |   abbreviates $\FIX{\vec x}~\ASSUME{c}{\vec\phi}$.
 | |
| 8483 | 204 | \item [$\isarkeyword{print_cases}$] prints all local contexts of the current
 | 
| 8547 | 205 | state, using Isar proof language notation. This is a diagnostic command; | 
| 206 | $undo$ does not apply. | |
| 8483 | 207 | \item [$case_names~\vec c$] declares names for the local contexts of premises | 
| 10627 | 208 |   of some theorem; $\vec c$ refers to the \emph{suffix} of the list of
 | 
| 209 | premises. | |
| 8483 | 210 | \item [$params~\vec p@1 \dots \vec p@n$] renames the innermost parameters of | 
| 8547 | 211 | premises $1, \dots, n$ of some theorem. An empty list of names may be given | 
| 212 | to skip positions, leaving the present parameters unchanged. | |
| 9614 | 213 | |
| 214 |   Note that the default usage of case rules does \emph{not} directly expose
 | |
| 215 |   parameters to the proof context (see also \S\ref{sec:induct-method-proper}).
 | |
| 10548 | 216 | \item [$consumes~n$] declares the number of ``major premises'' of a rule, | 
| 217 | i.e.\ the number of facts to be consumed when it is applied by an | |
| 218 |   appropriate proof method (cf.\ \S\ref{sec:induct-method}).  The default
 | |
| 219 | value of $consumes$ is $n = 1$, which is appropriate for the usual kind of | |
| 220 |   cases and induction rules for inductive sets (cf.\ \S\ref{sec:inductive}).
 | |
| 221 | Rules without any $consumes$ declaration given are treated as if | |
| 222 | $consumes~0$ had been specified. | |
| 223 | ||
| 224 | Note that explicit $consumes$ declarations are only rarely needed; this is | |
| 225 | already taken care of automatically by the higher-level $cases$ and $induct$ | |
| 226 |   declarations, see also \S\ref{sec:induct-att}.
 | |
| 8483 | 227 | \end{descr}
 | 
| 228 | ||
| 229 | ||
| 9614 | 230 | \section{Generalized existence}\label{sec:obtain}
 | 
| 7135 | 231 | |
| 8517 | 232 | \indexisarcmd{obtain}
 | 
| 7135 | 233 | \begin{matharray}{rcl}
 | 
| 9480 | 234 |   \isarcmd{obtain} & : & \isartrans{proof(state)}{proof(prove)} \\
 | 
| 8517 | 235 | \end{matharray}
 | 
| 236 | ||
| 9480 | 237 | Generalized existence means that additional elements with certain properties | 
| 238 | may introduced in the current context. Technically, the $\OBTAINNAME$ | |
| 239 | language element is like a declaration of $\FIXNAME$ and $\ASSUMENAME$ (see | |
| 240 | also see \S\ref{sec:proof-context}), together with a soundness proof of its
 | |
| 241 | additional claim. According to the nature of existential reasoning, | |
| 242 | assumptions get eliminated from any result exported from the context later, | |
| 243 | provided that the corresponding parameters do \emph{not} occur in the
 | |
| 244 | conclusion. | |
| 8517 | 245 | |
| 246 | \begin{rail}
 | |
| 247 | 'obtain' (vars + 'and') comment? \\ 'where' (assm comment? + 'and') | |
| 248 | ; | |
| 249 | \end{rail}
 | |
| 250 | ||
| 9480 | 251 | $\OBTAINNAME$ is defined as a derived Isar command as follows, where $\vec b$ | 
| 252 | shall refer to (optional) facts indicated for forward chaining. | |
| 8517 | 253 | \begin{matharray}{l}
 | 
| 9480 | 254 | \langle facts~\vec b\rangle \\ | 
| 255 |   \OBTAIN{\vec x}{a}{\vec \phi}~~\langle proof\rangle \equiv {} \\[1ex]
 | |
| 256 | \quad \BG \\ | |
| 257 |   \qquad \FIX{thesis} \\
 | |
| 10160 | 258 |   \qquad \ASSUME{that~[simp, intro]}{\All{\vec x} \vec\phi \Imp thesis} \\
 | 
| 9480 | 259 |   \qquad \FROM{\vec b}~\HAVE{}{thesis}~~\langle proof\rangle \\
 | 
| 260 | \quad \EN \\ | |
| 10154 | 261 |   \quad \FIX{\vec x}~\ASSUMENAME^\ast~a\colon~\vec\phi \\
 | 
| 7135 | 262 | \end{matharray}
 | 
| 263 | ||
| 8517 | 264 | Typically, the soundness proof is relatively straight-forward, often just by | 
| 265 | canonical automated tools such as $\BY{simp}$ (see \S\ref{sec:simp}) or
 | |
| 9480 | 266 | $\BY{blast}$ (see \S\ref{sec:classical-auto}).  Accordingly, the ``$that$''
 | 
| 267 | reduction above is declared as simplification and introduction rule. | |
| 8517 | 268 | |
| 269 | \medskip | |
| 270 | ||
| 271 | In a sense, $\OBTAINNAME$ represents at the level of Isar proofs what would be | |
| 272 | meta-logical existential quantifiers and conjunctions. This concept has a | |
| 273 | broad range of useful applications, ranging from plain elimination (or even | |
| 274 | introduction) of object-level existentials and conjunctions, to elimination | |
| 275 | over results of symbolic evaluation of recursive definitions, for example. | |
| 9480 | 276 | Also note that $\OBTAINNAME$ without parameters acts much like $\HAVENAME$, | 
| 277 | where the result is treated as an assumption. | |
| 8517 | 278 | |
| 279 | ||
| 10031 | 280 | \section{Miscellaneous methods and attributes}\label{sec:misc-methods}
 | 
| 8517 | 281 | |
| 9606 | 282 | \indexisarmeth{unfold}\indexisarmeth{fold}\indexisarmeth{insert}
 | 
| 8517 | 283 | \indexisarmeth{erule}\indexisarmeth{drule}\indexisarmeth{frule}
 | 
| 284 | \indexisarmeth{fail}\indexisarmeth{succeed}
 | |
| 285 | \begin{matharray}{rcl}
 | |
| 286 | unfold & : & \isarmeth \\ | |
| 10741 | 287 | fold & : & \isarmeth \\ | 
| 288 | insert & : & \isarmeth \\[0.5ex] | |
| 8517 | 289 | erule^* & : & \isarmeth \\ | 
| 290 | drule^* & : & \isarmeth \\ | |
| 291 | frule^* & : & \isarmeth \\[0.5ex] | |
| 292 | succeed & : & \isarmeth \\ | |
| 293 | fail & : & \isarmeth \\ | |
| 294 | \end{matharray}
 | |
| 7135 | 295 | |
| 296 | \begin{rail}
 | |
| 10741 | 297 |   ('fold' | 'unfold' | 'insert') thmrefs
 | 
| 298 | ; | |
| 299 |   ('erule' | 'drule' | 'frule') ('('nat')')? thmrefs
 | |
| 7135 | 300 | ; | 
| 301 | \end{rail}
 | |
| 302 | ||
| 7167 | 303 | \begin{descr}
 | 
| 8547 | 304 | \item [$unfold~\vec a$ and $fold~\vec a$] expand and fold back again the given | 
| 8517 | 305 | meta-level definitions throughout all goals; any facts provided are inserted | 
| 306 | into the goal and subject to rewriting as well. | |
| 10741 | 307 | \item [$insert~\vec a$] inserts theorems as facts into all goals of the proof | 
| 308 | state. Note that current facts indicated for forward chaining are ignored. | |
| 8547 | 309 | \item [$erule~\vec a$, $drule~\vec a$, and $frule~\vec a$] are similar to the | 
| 310 |   basic $rule$ method (see \S\ref{sec:pure-meth-att}), but apply rules by
 | |
| 8517 | 311 | elim-resolution, destruct-resolution, and forward-resolution, respectively | 
| 10741 | 312 |   \cite{isabelle-ref}.  The optional natural number argument (default $0$)
 | 
| 313 | specifies additional assumption steps to be performed. | |
| 314 | ||
| 315 | Note that these methods are improper ones, mainly serving for | |
| 316 | experimentation and tactic script emulation. Different modes of basic rule | |
| 317 | application are usually expressed in Isar at the proof language level, | |
| 318 | rather than via implicit proof state manipulations. For example, a proper | |
| 319 | single-step elimination would be done using the basic $rule$ method, with | |
| 320 | forward chaining of current facts. | |
| 8517 | 321 | \item [$succeed$] yields a single (unchanged) result; it is the identity of | 
| 322 |   the ``\texttt{,}'' method combinator (cf.\ \S\ref{sec:syn-meth}).
 | |
| 323 | \item [$fail$] yields an empty result sequence; it is the identity of the | |
| 324 |   ``\texttt{|}'' method combinator (cf.\ \S\ref{sec:syn-meth}).
 | |
| 7167 | 325 | \end{descr}
 | 
| 7135 | 326 | |
| 10318 | 327 | \indexisaratt{tagged}\indexisaratt{untagged}
 | 
| 9614 | 328 | \indexisaratt{THEN}\indexisaratt{COMP}
 | 
| 10318 | 329 | \indexisaratt{where}\indexisaratt{unfolded}\indexisaratt{folded}
 | 
| 330 | \indexisaratt{standard}\indexisaratt{elim-format}
 | |
| 331 | \indexisaratt{no-vars}\indexisaratt{exported}
 | |
| 8517 | 332 | \begin{matharray}{rcl}
 | 
| 9905 | 333 | tagged & : & \isaratt \\ | 
| 334 | untagged & : & \isaratt \\[0.5ex] | |
| 9614 | 335 | THEN & : & \isaratt \\ | 
| 8517 | 336 | COMP & : & \isaratt \\[0.5ex] | 
| 337 | where & : & \isaratt \\[0.5ex] | |
| 9905 | 338 | unfolded & : & \isaratt \\ | 
| 339 | folded & : & \isaratt \\[0.5ex] | |
| 8517 | 340 | standard & : & \isaratt \\ | 
| 9941 
fe05af7ec816
renamed atts: rulify to rule_format, elimify to elim_format;
 wenzelm parents: 
9936diff
changeset | 341 | elim_format & : & \isaratt \\ | 
| 9936 | 342 | no_vars^* & : & \isaratt \\ | 
| 9905 | 343 | exported^* & : & \isaratt \\ | 
| 8517 | 344 | \end{matharray}
 | 
| 345 | ||
| 346 | \begin{rail}
 | |
| 9905 | 347 | 'tagged' (nameref+) | 
| 8517 | 348 | ; | 
| 9905 | 349 | 'untagged' name | 
| 8517 | 350 | ; | 
| 10154 | 351 |   ('THEN' | 'COMP') ('[' nat ']')? thmref
 | 
| 8517 | 352 | ; | 
| 353 | 'where' (name '=' term * 'and') | |
| 354 | ; | |
| 9905 | 355 |   ('unfolded' | 'folded') thmrefs
 | 
| 8517 | 356 | ; | 
| 357 | \end{rail}
 | |
| 358 | ||
| 359 | \begin{descr}
 | |
| 9905 | 360 | \item [$tagged~name~args$ and $untagged~name$] add and remove $tags$ of some | 
| 8517 | 361 | theorem. Tags may be any list of strings that serve as comment for some | 
| 362 | tools (e.g.\ $\LEMMANAME$ causes the tag ``$lemma$'' to be added to the | |
| 363 | result). The first string is considered the tag name, the rest its | |
| 364 | arguments. Note that untag removes any tags of the same name. | |
| 9614 | 365 | \item [$THEN~n~a$ and $COMP~n~a$] compose rules. $THEN$ resolves with the | 
| 366 | $n$-th premise of $a$; the $COMP$ version skips the automatic lifting | |
| 8547 | 367 |   process that is normally intended (cf.\ \texttt{RS} and \texttt{COMP} in
 | 
| 368 |   \cite[\S5]{isabelle-ref}).
 | |
| 8517 | 369 | \item [$where~\vec x = \vec t$] perform named instantiation of schematic | 
| 9606 | 370 | variables occurring in a theorem. Unlike instantiation tactics such as | 
| 371 |   $rule_tac$ (see \S\ref{sec:tactic-commands}), actual schematic variables
 | |
| 8517 | 372 |   have to be specified (e.g.\ $\Var{x@3}$).
 | 
| 9905 | 373 | \item [$unfolded~\vec a$ and $folded~\vec a$] expand and fold back again the | 
| 374 | given meta-level definitions throughout a rule. | |
| 8517 | 375 | \item [$standard$] puts a theorem into the standard form of object-rules, just | 
| 376 |   as the ML function \texttt{standard} (see \cite[\S5]{isabelle-ref}).
 | |
| 9941 
fe05af7ec816
renamed atts: rulify to rule_format, elimify to elim_format;
 wenzelm parents: 
9936diff
changeset | 377 | \item [$elim_format$] turns a destruction rule into elimination rule format; | 
| 
fe05af7ec816
renamed atts: rulify to rule_format, elimify to elim_format;
 wenzelm parents: 
9936diff
changeset | 378 |   see also the ML function \texttt{make\_elim} (see \cite{isabelle-ref}).
 | 
| 9232 | 379 | \item [$no_vars$] replaces schematic variables by free ones; this is mainly | 
| 380 | for tuning output of pretty printed theorems. | |
| 9905 | 381 | \item [$exported$] lifts a local result out of the current proof context, | 
| 8517 | 382 | generalizing all fixed variables and discharging all assumptions. Note that | 
| 8547 | 383 | proper incremental export is already done as part of the basic Isar | 
| 384 | machinery. This attribute is mainly for experimentation. | |
| 8517 | 385 | \end{descr}
 | 
| 7135 | 386 | |
| 387 | ||
| 9606 | 388 | \section{Tactic emulations}\label{sec:tactics}
 | 
| 389 | ||
| 390 | The following improper proof methods emulate traditional tactics. These admit | |
| 391 | direct access to the goal state, which is normally considered harmful! In | |
| 392 | particular, this may involve both numbered goal addressing (default 1), and | |
| 393 | dynamic instantiation within the scope of some subgoal. | |
| 394 | ||
| 395 | \begin{warn}
 | |
| 396 | Dynamic instantiations are read and type-checked according to a subgoal of | |
| 397 | the current dynamic goal state, rather than the static proof context! In | |
| 398 | particular, locally fixed variables and term abbreviations may not be | |
| 399 | included in the term specifications. Thus schematic variables are left to | |
| 400 | be solved by unification with certain parts of the subgoal involved. | |
| 401 | \end{warn}
 | |
| 402 | ||
| 403 | Note that the tactic emulation proof methods in Isabelle/Isar are consistently | |
| 404 | named $foo_tac$. | |
| 405 | ||
| 406 | \indexisarmeth{rule-tac}\indexisarmeth{erule-tac}
 | |
| 407 | \indexisarmeth{drule-tac}\indexisarmeth{frule-tac}
 | |
| 408 | \indexisarmeth{cut-tac}\indexisarmeth{thin-tac}
 | |
| 9642 | 409 | \indexisarmeth{subgoal-tac}\indexisarmeth{rename-tac}
 | 
| 9614 | 410 | \indexisarmeth{rotate-tac}\indexisarmeth{tactic}
 | 
| 9606 | 411 | \begin{matharray}{rcl}
 | 
| 412 | rule_tac^* & : & \isarmeth \\ | |
| 413 | erule_tac^* & : & \isarmeth \\ | |
| 414 | drule_tac^* & : & \isarmeth \\ | |
| 415 | frule_tac^* & : & \isarmeth \\ | |
| 416 | cut_tac^* & : & \isarmeth \\ | |
| 417 | thin_tac^* & : & \isarmeth \\ | |
| 418 | subgoal_tac^* & : & \isarmeth \\ | |
| 9614 | 419 | rename_tac^* & : & \isarmeth \\ | 
| 420 | rotate_tac^* & : & \isarmeth \\ | |
| 9606 | 421 | tactic^* & : & \isarmeth \\ | 
| 422 | \end{matharray}
 | |
| 423 | ||
| 424 | \railalias{ruletac}{rule\_tac}
 | |
| 425 | \railterm{ruletac}
 | |
| 426 | ||
| 427 | \railalias{eruletac}{erule\_tac}
 | |
| 428 | \railterm{eruletac}
 | |
| 429 | ||
| 430 | \railalias{druletac}{drule\_tac}
 | |
| 431 | \railterm{druletac}
 | |
| 432 | ||
| 433 | \railalias{fruletac}{frule\_tac}
 | |
| 434 | \railterm{fruletac}
 | |
| 435 | ||
| 436 | \railalias{cuttac}{cut\_tac}
 | |
| 437 | \railterm{cuttac}
 | |
| 438 | ||
| 439 | \railalias{thintac}{thin\_tac}
 | |
| 440 | \railterm{thintac}
 | |
| 441 | ||
| 442 | \railalias{subgoaltac}{subgoal\_tac}
 | |
| 443 | \railterm{subgoaltac}
 | |
| 444 | ||
| 9614 | 445 | \railalias{renametac}{rename\_tac}
 | 
| 446 | \railterm{renametac}
 | |
| 447 | ||
| 448 | \railalias{rotatetac}{rotate\_tac}
 | |
| 449 | \railterm{rotatetac}
 | |
| 450 | ||
| 9606 | 451 | \begin{rail}
 | 
| 452 | ( ruletac | eruletac | druletac | fruletac | cuttac | thintac ) goalspec? | |
| 453 | ( insts thmref | thmrefs ) | |
| 454 | ; | |
| 455 | subgoaltac goalspec? (prop +) | |
| 456 | ; | |
| 9614 | 457 | renametac goalspec? (name +) | 
| 458 | ; | |
| 459 | rotatetac goalspec? int? | |
| 460 | ; | |
| 9606 | 461 | 'tactic' text | 
| 462 | ; | |
| 463 | ||
| 464 | insts: ((name '=' term) + 'and') 'in' | |
| 465 | ; | |
| 466 | \end{rail}
 | |
| 467 | ||
| 468 | \begin{descr}
 | |
| 469 | \item [$rule_tac$ etc.] do resolution of rules with explicit instantiation. | |
| 470 |   This works the same way as the ML tactics \texttt{res_inst_tac} etc. (see
 | |
| 471 |   \cite[\S3]{isabelle-ref}).
 | |
| 9614 | 472 | |
| 9606 | 473 | Note that multiple rules may be only given there is no instantiation. Then | 
| 474 |   $rule_tac$ is the same as \texttt{resolve_tac} in ML (see
 | |
| 475 |   \cite[\S3]{isabelle-ref}).
 | |
| 476 | \item [$cut_tac$] inserts facts into the proof state as assumption of a | |
| 477 |   subgoal, see also \texttt{cut_facts_tac} in \cite[\S3]{isabelle-ref}.  Note
 | |
| 478 | that the scope of schmatic variables is spread over the main goal statement. | |
| 479 | Instantiations may be given as well, see also ML tactic | |
| 480 |   \texttt{cut_inst_tac} in \cite[\S3]{isabelle-ref}.
 | |
| 481 | \item [$thin_tac~\phi$] deletes the specified assumption from a subgoal; note | |
| 482 |   that $\phi$ may contain schematic variables.  See also \texttt{thin_tac} in
 | |
| 483 |   \cite[\S3]{isabelle-ref}.
 | |
| 484 | \item [$subgoal_tac~\phi$] adds $\phi$ as an assumption to a subgoal. See | |
| 485 |   also \texttt{subgoal_tac} and \texttt{subgoals_tac} in
 | |
| 486 |   \cite[\S3]{isabelle-ref}.
 | |
| 9614 | 487 | \item [$rename_tac~\vec x$] renames parameters of a goal according to the list | 
| 488 |   $\vec x$, which refers to the \emph{suffix} of variables.
 | |
| 489 | \item [$rotate_tac~n$] rotates the assumptions of a goal by $n$ positions: | |
| 490 | from right to left if $n$ is positive, and from left to right if $n$ is | |
| 491 |   negative; the default value is $1$.  See also \texttt{rotate_tac} in
 | |
| 492 |   \cite[\S3]{isabelle-ref}.
 | |
| 9606 | 493 | \item [$tactic~text$] produces a proof method from any ML text of type | 
| 494 |   \texttt{tactic}.  Apart from the usual ML environment and the current
 | |
| 495 | implicit theory context, the ML code may refer to the following locally | |
| 496 | bound values: | |
| 497 | ||
| 498 | %%FIXME ttbox produces too much trailing space (why?) | |
| 499 | {\footnotesize\begin{verbatim}
 | |
| 500 | val ctxt : Proof.context | |
| 501 | val facts : thm list | |
| 502 | val thm : string -> thm | |
| 503 | val thms : string -> thm list | |
| 504 | \end{verbatim}}
 | |
| 505 |   Here \texttt{ctxt} refers to the current proof context, \texttt{facts}
 | |
| 506 | indicates any current facts for forward-chaining, and | |
| 507 |   \texttt{thm}~/~\texttt{thms} retrieve named facts (including global
 | |
| 508 | theorems) from the context. | |
| 509 | \end{descr}
 | |
| 510 | ||
| 511 | ||
| 9614 | 512 | \section{The Simplifier}\label{sec:simplifier}
 | 
| 7135 | 513 | |
| 7321 | 514 | \subsection{Simplification methods}\label{sec:simp}
 | 
| 7315 | 515 | |
| 8483 | 516 | \indexisarmeth{simp}\indexisarmeth{simp-all}
 | 
| 7315 | 517 | \begin{matharray}{rcl}
 | 
| 518 | simp & : & \isarmeth \\ | |
| 8483 | 519 | simp_all & : & \isarmeth \\ | 
| 7315 | 520 | \end{matharray}
 | 
| 521 | ||
| 8483 | 522 | \railalias{simpall}{simp\_all}
 | 
| 523 | \railterm{simpall}
 | |
| 524 | ||
| 8704 | 525 | \railalias{noasm}{no\_asm}
 | 
| 526 | \railterm{noasm}
 | |
| 527 | ||
| 528 | \railalias{noasmsimp}{no\_asm\_simp}
 | |
| 529 | \railterm{noasmsimp}
 | |
| 530 | ||
| 531 | \railalias{noasmuse}{no\_asm\_use}
 | |
| 532 | \railterm{noasmuse}
 | |
| 533 | ||
| 7315 | 534 | \begin{rail}
 | 
| 8706 | 535 |   ('simp' | simpall) ('!' ?) opt? (simpmod * )
 | 
| 7315 | 536 | ; | 
| 537 | ||
| 8811 | 538 |   opt: '(' (noasm | noasmsimp | noasmuse) ')'
 | 
| 8704 | 539 | ; | 
| 9711 | 540 |   simpmod: ('add' | 'del' | 'only' | 'cong' (() | 'add' | 'del') |
 | 
| 9847 | 541 | 'split' (() | 'add' | 'del')) ':' thmrefs | 
| 7315 | 542 | ; | 
| 543 | \end{rail}
 | |
| 544 | ||
| 7321 | 545 | \begin{descr}
 | 
| 8547 | 546 | \item [$simp$] invokes Isabelle's simplifier, after declaring additional rules | 
| 8594 | 547 |   according to the arguments given.  Note that the \railtterm{only} modifier
 | 
| 8547 | 548 | first removes all other rewrite rules, congruences, and looper tactics | 
| 8594 | 549 |   (including splits), and then behaves like \railtterm{add}.
 | 
| 9711 | 550 | |
| 551 |   \medskip The \railtterm{cong} modifiers add or delete Simplifier congruence
 | |
| 552 |   rules (see also \cite{isabelle-ref}), the default is to add.
 | |
| 553 | ||
| 554 |   \medskip The \railtterm{split} modifiers add or delete rules for the
 | |
| 555 |   Splitter (see also \cite{isabelle-ref}), the default is to add.  This works
 | |
| 556 | only if the Simplifier method has been properly setup to include the | |
| 557 | Splitter (all major object logics such HOL, HOLCF, FOL, ZF do this already). | |
| 8483 | 558 | \item [$simp_all$] is similar to $simp$, but acts on all goals. | 
| 7321 | 559 | \end{descr}
 | 
| 560 | ||
| 8704 | 561 | By default, the Simplifier methods are based on \texttt{asm_full_simp_tac}
 | 
| 8706 | 562 | internally \cite[\S10]{isabelle-ref}, which means that assumptions are both
 | 
| 563 | simplified as well as used in simplifying the conclusion. In structured | |
| 564 | proofs this is usually quite well behaved in practice: just the local premises | |
| 565 | of the actual goal are involved, additional facts may inserted via explicit | |
| 566 | forward-chaining (using $\THEN$, $\FROMNAME$ etc.). The full context of | |
| 567 | assumptions is only included if the ``$!$'' (bang) argument is given, which | |
| 568 | should be used with some care, though. | |
| 7321 | 569 | |
| 8704 | 570 | Additional Simplifier options may be specified to tune the behavior even | 
| 9614 | 571 | further: $(no_asm)$ means assumptions are ignored completely (cf.\ | 
| 8811 | 572 | \texttt{simp_tac}), $(no_asm_simp)$ means assumptions are used in the
 | 
| 9614 | 573 | simplification of the conclusion but are not themselves simplified (cf.\ | 
| 8811 | 574 | \texttt{asm_simp_tac}), and $(no_asm_use)$ means assumptions are simplified
 | 
| 575 | but are not used in the simplification of each other or the conclusion (cf. | |
| 8704 | 576 | \texttt{full_simp_tac}).
 | 
| 577 | ||
| 578 | \medskip | |
| 579 | ||
| 580 | The Splitter package is usually configured to work as part of the Simplifier. | |
| 9711 | 581 | The effect of repeatedly applying \texttt{split_tac} can be simulated by
 | 
| 582 | $(simp~only\colon~split\colon~\vec a)$. There is also a separate $split$ | |
| 583 | method available for single-step case splitting, see \S\ref{sec:basic-eq}.
 | |
| 8483 | 584 | |
| 585 | ||
| 586 | \subsection{Declaring rules}
 | |
| 587 | ||
| 8667 | 588 | \indexisarcmd{print-simpset}
 | 
| 8638 | 589 | \indexisaratt{simp}\indexisaratt{split}\indexisaratt{cong}
 | 
| 7321 | 590 | \begin{matharray}{rcl}
 | 
| 10154 | 591 |   print_simpset^* & : & \isarkeep{theory~|~proof} \\
 | 
| 7321 | 592 | simp & : & \isaratt \\ | 
| 9711 | 593 | cong & : & \isaratt \\ | 
| 8483 | 594 | split & : & \isaratt \\ | 
| 7321 | 595 | \end{matharray}
 | 
| 596 | ||
| 597 | \begin{rail}
 | |
| 9711 | 598 |   ('simp' | 'cong' | 'split') (() | 'add' | 'del')
 | 
| 7321 | 599 | ; | 
| 600 | \end{rail}
 | |
| 601 | ||
| 602 | \begin{descr}
 | |
| 8667 | 603 | \item [$print_simpset$] prints the collection of rules declared to the | 
| 604 | Simplifier, which is also known as ``simpset'' internally | |
| 605 |   \cite{isabelle-ref}.  This is a diagnostic command; $undo$ does not apply.
 | |
| 8547 | 606 | \item [$simp$] declares simplification rules. | 
| 8638 | 607 | \item [$cong$] declares congruence rules. | 
| 9711 | 608 | \item [$split$] declares case split rules. | 
| 7321 | 609 | \end{descr}
 | 
| 7319 | 610 | |
| 7315 | 611 | |
| 612 | \subsection{Forward simplification}
 | |
| 613 | ||
| 9905 | 614 | \indexisaratt{simplified}
 | 
| 7315 | 615 | \begin{matharray}{rcl}
 | 
| 9905 | 616 | simplified & : & \isaratt \\ | 
| 7315 | 617 | \end{matharray}
 | 
| 618 | ||
| 9905 | 619 | \begin{rail}
 | 
| 620 | 'simplified' opt? | |
| 621 | ; | |
| 622 | ||
| 623 |   opt: '(' (noasm | noasmsimp | noasmuse) ')'
 | |
| 624 | ; | |
| 625 | \end{rail}
 | |
| 7905 | 626 | |
| 9905 | 627 | \begin{descr}
 | 
| 628 | \item [$simplified$] causes a theorem to be simplified according to the | |
| 629 | current Simplifier context (there are no separate arguments for declaring | |
| 630 | additional rules). By default the result is fully simplified, including | |
| 631 | assumptions and conclusion. The options $no_asm$ etc.\ restrict the | |
| 632 | Simplifier in the same way as the for the $simp$ method (see | |
| 633 |   \S\ref{sec:simp}).
 | |
| 634 | ||
| 635 | The $simplified$ operation should be used only very rarely, usually for | |
| 636 | experimentation only. | |
| 637 | \end{descr}
 | |
| 7315 | 638 | |
| 639 | ||
| 9711 | 640 | \section{Basic equational reasoning}\label{sec:basic-eq}
 | 
| 9614 | 641 | |
| 9703 | 642 | \indexisarmeth{subst}\indexisarmeth{hypsubst}\indexisarmeth{split}\indexisaratt{symmetric}
 | 
| 9614 | 643 | \begin{matharray}{rcl}
 | 
| 644 | subst & : & \isarmeth \\ | |
| 645 | hypsubst^* & : & \isarmeth \\ | |
| 9703 | 646 | split & : & \isarmeth \\ | 
| 9614 | 647 | symmetric & : & \isaratt \\ | 
| 648 | \end{matharray}
 | |
| 649 | ||
| 650 | \begin{rail}
 | |
| 651 | 'subst' thmref | |
| 652 | ; | |
| 9799 | 653 |   'split' ('(' 'asm' ')')? thmrefs
 | 
| 9703 | 654 | ; | 
| 9614 | 655 | \end{rail}
 | 
| 656 | ||
| 657 | These methods and attributes provide basic facilities for equational reasoning | |
| 658 | that are intended for specialized applications only. Normally, single step | |
| 659 | reasoning would be performed by calculation (see \S\ref{sec:calculation}),
 | |
| 660 | while the Simplifier is the canonical tool for automated normalization (see | |
| 661 | \S\ref{sec:simplifier}).
 | |
| 662 | ||
| 663 | \begin{descr}
 | |
| 664 | \item [$subst~thm$] performs a single substitution step using rule $thm$, | |
| 665 | which may be either a meta or object equality. | |
| 666 | \item [$hypsubst$] performs substitution using some assumption. | |
| 9703 | 667 | \item [$split~thms$] performs single-step case splitting using rules $thms$. | 
| 9799 | 668 | By default, splitting is performed in the conclusion of a goal; the $asm$ | 
| 669 | option indicates to operate on assumptions instead. | |
| 670 | ||
| 9703 | 671 | Note that the $simp$ method already involves repeated application of split | 
| 672 |   rules as declared in the current context (see \S\ref{sec:simp}).
 | |
| 9614 | 673 | \item [$symmetric$] applies the symmetry rule of meta or object equality. | 
| 674 | \end{descr}
 | |
| 675 | ||
| 676 | ||
| 9847 | 677 | \section{The Classical Reasoner}\label{sec:classical}
 | 
| 7135 | 678 | |
| 7335 | 679 | \subsection{Basic methods}\label{sec:classical-basic}
 | 
| 7321 | 680 | |
| 7974 | 681 | \indexisarmeth{rule}\indexisarmeth{intro}
 | 
| 682 | \indexisarmeth{elim}\indexisarmeth{default}\indexisarmeth{contradiction}
 | |
| 7321 | 683 | \begin{matharray}{rcl}
 | 
| 684 | rule & : & \isarmeth \\ | |
| 685 | intro & : & \isarmeth \\ | |
| 686 | elim & : & \isarmeth \\ | |
| 687 | contradiction & : & \isarmeth \\ | |
| 688 | \end{matharray}
 | |
| 689 | ||
| 690 | \begin{rail}
 | |
| 8547 | 691 |   ('rule' | 'intro' | 'elim') thmrefs?
 | 
| 7321 | 692 | ; | 
| 693 | \end{rail}
 | |
| 694 | ||
| 695 | \begin{descr}
 | |
| 7466 | 696 | \item [$rule$] as offered by the classical reasoner is a refinement over the | 
| 8517 | 697 |   primitive one (see \S\ref{sec:pure-meth-att}).  In case that no rules are
 | 
| 7466 | 698 | provided as arguments, it automatically determines elimination and | 
| 7321 | 699 |   introduction rules from the context (see also \S\ref{sec:classical-mod}).
 | 
| 8517 | 700 | This is made the default method for basic proof steps, such as $\PROOFNAME$ | 
| 701 |   and ``$\DDOT$'' (two dots), see also \S\ref{sec:proof-steps} and
 | |
| 702 |   \S\ref{sec:pure-meth-att}.
 | |
| 9614 | 703 | |
| 7466 | 704 | \item [$intro$ and $elim$] repeatedly refine some goal by intro- or | 
| 7905 | 705 | elim-resolution, after having inserted any facts. Omitting the arguments | 
| 8547 | 706 | refers to any suitable rules declared in the context, otherwise only the | 
| 707 | explicitly given ones may be applied. The latter form admits better control | |
| 708 | of what actually happens, thus it is very appropriate as an initial method | |
| 709 | for $\PROOFNAME$ that splits up certain connectives of the goal, before | |
| 710 | entering the actual sub-proof. | |
| 9614 | 711 | |
| 7466 | 712 | \item [$contradiction$] solves some goal by contradiction, deriving any result | 
| 713 | from both $\neg A$ and $A$. Facts, which are guaranteed to participate, may | |
| 714 | appear in either order. | |
| 7321 | 715 | \end{descr}
 | 
| 716 | ||
| 717 | ||
| 7981 | 718 | \subsection{Automated methods}\label{sec:classical-auto}
 | 
| 7315 | 719 | |
| 9799 | 720 | \indexisarmeth{blast}\indexisarmeth{fast}\indexisarmeth{slow}
 | 
| 721 | \indexisarmeth{best}\indexisarmeth{safe}\indexisarmeth{clarify}
 | |
| 7321 | 722 | \begin{matharray}{rcl}
 | 
| 9780 | 723 | blast & : & \isarmeth \\ | 
| 724 | fast & : & \isarmeth \\ | |
| 9799 | 725 | slow & : & \isarmeth \\ | 
| 9780 | 726 | best & : & \isarmeth \\ | 
| 727 | safe & : & \isarmeth \\ | |
| 728 | clarify & : & \isarmeth \\ | |
| 7321 | 729 | \end{matharray}
 | 
| 730 | ||
| 731 | \begin{rail}
 | |
| 7905 | 732 |   'blast' ('!' ?) nat? (clamod * )
 | 
| 7321 | 733 | ; | 
| 9799 | 734 |   ('fast' | 'slow' | 'best' | 'safe' | 'clarify') ('!' ?) (clamod * )
 | 
| 7321 | 735 | ; | 
| 736 | ||
| 9408 | 737 |   clamod: (('intro' | 'elim' | 'dest') ('!' | () | '?') | 'del') ':' thmrefs
 | 
| 7321 | 738 | ; | 
| 739 | \end{rail}
 | |
| 740 | ||
| 741 | \begin{descr}
 | |
| 742 | \item [$blast$] refers to the classical tableau prover (see \texttt{blast_tac}
 | |
| 7335 | 743 |   in \cite[\S11]{isabelle-ref}).  The optional argument specifies a
 | 
| 10858 | 744 | user-supplied search bound (default 20). | 
| 9799 | 745 | \item [$fast$, $slow$, $best$, $safe$, and $clarify$] refer to the generic | 
| 746 |   classical reasoner.  See \texttt{fast_tac}, \texttt{slow_tac},
 | |
| 747 |   \texttt{best_tac}, \texttt{safe_tac}, and \texttt{clarify_tac} in
 | |
| 748 |   \cite[\S11]{isabelle-ref} for more information.
 | |
| 7321 | 749 | \end{descr}
 | 
| 750 | ||
| 751 | Any of above methods support additional modifiers of the context of classical | |
| 8517 | 752 | rules. Their semantics is analogous to the attributes given in | 
| 8547 | 753 | \S\ref{sec:classical-mod}.  Facts provided by forward chaining are
 | 
| 754 | inserted\footnote{These methods usually cannot make proper use of actual rules
 | |
| 755 | inserted that way, though.} into the goal before doing the search. The | |
| 756 | ``!''~argument causes the full context of assumptions to be included as well. | |
| 757 | This is slightly less hazardous than for the Simplifier (see | |
| 758 | \S\ref{sec:simp}).
 | |
| 7321 | 759 | |
| 7315 | 760 | |
| 9847 | 761 | \subsection{Combined automated methods}\label{sec:clasimp}
 | 
| 7315 | 762 | |
| 9799 | 763 | \indexisarmeth{auto}\indexisarmeth{force}\indexisarmeth{clarsimp}
 | 
| 764 | \indexisarmeth{fastsimp}\indexisarmeth{slowsimp}\indexisarmeth{bestsimp}
 | |
| 7321 | 765 | \begin{matharray}{rcl}
 | 
| 9606 | 766 | auto & : & \isarmeth \\ | 
| 7321 | 767 | force & : & \isarmeth \\ | 
| 9438 | 768 | clarsimp & : & \isarmeth \\ | 
| 9606 | 769 | fastsimp & : & \isarmeth \\ | 
| 9799 | 770 | slowsimp & : & \isarmeth \\ | 
| 771 | bestsimp & : & \isarmeth \\ | |
| 7321 | 772 | \end{matharray}
 | 
| 773 | ||
| 774 | \begin{rail}
 | |
| 9780 | 775 | 'auto' '!'? (nat nat)? (clasimpmod * ) | 
| 776 | ; | |
| 9799 | 777 |   ('force' | 'clarsimp' | 'fastsimp' | 'slowsimp' | 'bestsimp') '!'? (clasimpmod * )
 | 
| 7321 | 778 | ; | 
| 7315 | 779 | |
| 9711 | 780 |   clasimpmod: ('simp' (() | 'add' | 'del' | 'only') |
 | 
| 10031 | 781 |     ('cong' | 'split') (() | 'add' | 'del') |
 | 
| 782 | 'iff' (((() | 'add') '?'?) | 'del') | | |
| 9408 | 783 |     (('intro' | 'elim' | 'dest') ('!' | () | '?') | 'del')) ':' thmrefs
 | 
| 7321 | 784 | \end{rail}
 | 
| 7315 | 785 | |
| 7321 | 786 | \begin{descr}
 | 
| 9799 | 787 | \item [$auto$, $force$, $clarsimp$, $fastsimp$, $slowsimp$, and $bestsimp$] | 
| 788 | provide access to Isabelle's combined simplification and classical reasoning | |
| 789 |   tactics.  These correspond to \texttt{auto_tac}, \texttt{force_tac},
 | |
| 790 |   \texttt{clarsimp_tac}, and Classical Reasoner tactics with the Simplifier
 | |
| 791 |   added as wrapper, see \cite[\S11]{isabelle-ref} for more information.  The
 | |
| 792 |   modifier arguments correspond to those given in \S\ref{sec:simp} and
 | |
| 9606 | 793 |   \S\ref{sec:classical-auto}.  Just note that the ones related to the
 | 
| 794 |   Simplifier are prefixed by \railtterm{simp} here.
 | |
| 9614 | 795 | |
| 7987 | 796 | Facts provided by forward chaining are inserted into the goal before doing | 
| 797 | the search. The ``!''~argument causes the full context of assumptions to be | |
| 798 | included as well. | |
| 7321 | 799 | \end{descr}
 | 
| 800 | ||
| 7987 | 801 | |
| 8483 | 802 | \subsection{Declaring rules}\label{sec:classical-mod}
 | 
| 7135 | 803 | |
| 8667 | 804 | \indexisarcmd{print-claset}
 | 
| 7391 | 805 | \indexisaratt{intro}\indexisaratt{elim}\indexisaratt{dest}
 | 
| 9936 | 806 | \indexisaratt{iff}\indexisaratt{rule}
 | 
| 7321 | 807 | \begin{matharray}{rcl}
 | 
| 10154 | 808 |   print_claset^* & : & \isarkeep{theory~|~proof} \\
 | 
| 7321 | 809 | intro & : & \isaratt \\ | 
| 810 | elim & : & \isaratt \\ | |
| 811 | dest & : & \isaratt \\ | |
| 9936 | 812 | rule & : & \isaratt \\ | 
| 7391 | 813 | iff & : & \isaratt \\ | 
| 7321 | 814 | \end{matharray}
 | 
| 7135 | 815 | |
| 7321 | 816 | \begin{rail}
 | 
| 9408 | 817 |   ('intro' | 'elim' | 'dest') ('!' | () | '?')
 | 
| 7321 | 818 | ; | 
| 9936 | 819 | 'rule' 'del' | 
| 820 | ; | |
| 10031 | 821 | 'iff' (((() | 'add') '?'?) | 'del') | 
| 9936 | 822 | ; | 
| 7321 | 823 | \end{rail}
 | 
| 7135 | 824 | |
| 7321 | 825 | \begin{descr}
 | 
| 8667 | 826 | \item [$print_claset$] prints the collection of rules declared to the | 
| 827 | Classical Reasoner, which is also known as ``simpset'' internally | |
| 828 |   \cite{isabelle-ref}.  This is a diagnostic command; $undo$ does not apply.
 | |
| 8517 | 829 | \item [$intro$, $elim$, and $dest$] declare introduction, elimination, and | 
| 830 | destruct rules, respectively. By default, rules are considered as | |
| 9408 | 831 |   \emph{unsafe} (i.e.\ not applied blindly without backtracking), while a
 | 
| 832 |   single ``!'' classifies as \emph{safe}, and ``?'' as \emph{extra} (i.e.\ not
 | |
| 833 | applied in the search-oriented automated methods, but only in single-step | |
| 834 | methods such as $rule$). | |
| 9936 | 835 | \item [$rule~del$] deletes introduction, elimination, or destruct rules from | 
| 836 | the context. | |
| 10031 | 837 | \item [$iff$] declares equivalence rules to the context. The default behavior | 
| 838 | is to declare a rewrite rule to the Simplifier, and the two corresponding | |
| 839 | implications to the Classical Reasoner (as ``safe'' rules that are used | |
| 840 | aggressively, which would normally be indicated by ``!''). | |
| 841 | ||
| 842 | The ``?'' version of $iff$ declares ``extra'' Classical Reasoner rules only, | |
| 843 | and omits the Simplifier declaration. Thus the declaration does not have | |
| 844 | any effect on automated proof tools, but only on simple methods such as | |
| 845 |   $rule$ (see \S\ref{sec:misc-methods}).
 | |
| 7321 | 846 | \end{descr}
 | 
| 7135 | 847 | |
| 8203 
2fcc6017cb72
intro/elim/dest attributes: changed ! / !! flags to ? / ??;
 wenzelm parents: 
8195diff
changeset | 848 | |
| 9614 | 849 | %%% Local Variables: | 
| 7135 | 850 | %%% mode: latex | 
| 851 | %%% TeX-master: "isar-ref" | |
| 9614 | 852 | %%% End: |