| author | wenzelm | 
| Tue, 12 Sep 2006 12:12:25 +0200 | |
| changeset 20506 | 3ab3689c4a6e | 
| parent 20009 | dd9decc0bb6d | 
| child 20581 | f8cbdf0960ee | 
| permissions | -rw-r--r-- | 
| 7046 | 1 | |
| 13048 | 2 | \chapter{Basic language elements}\label{ch:pure-syntax}
 | 
| 7167 | 3 | |
| 13039 | 4 | Subsequently, we introduce the main part of Pure theory and proof commands, | 
| 5 | together with fundamental proof methods and attributes. | |
| 8515 | 6 | Chapter~\ref{ch:gen-tools} describes further Isar elements provided by generic
 | 
| 7 | tools and packages (such as the Simplifier) that are either part of Pure | |
| 12879 | 8 | Isabelle or pre-installed in most object logics.  Chapter~\ref{ch:logics}
 | 
| 12621 | 9 | refers to object-logic specific elements (mainly for HOL and ZF). | 
| 7046 | 10 | |
| 7167 | 11 | \medskip | 
| 12 | ||
| 13 | Isar commands may be either \emph{proper} document constructors, or
 | |
| 7466 | 14 | \emph{improper commands}.  Some proof methods and attributes introduced later
 | 
| 15 | are classified as improper as well. Improper Isar language elements, which | |
| 12618 | 16 | are subsequently marked by ``$^*$'', are often helpful when developing proof | 
| 13039 | 17 | documents, while their use is discouraged for the final human-readable | 
| 18 | outcome. Typical examples are diagnostic commands that print terms or | |
| 19 | theorems according to the current context; other commands emulate old-style | |
| 20 | tactical theorem proving. | |
| 7167 | 21 | |
| 7134 | 22 | |
| 12621 | 23 | \section{Theory commands}
 | 
| 7134 | 24 | |
| 7167 | 25 | \subsection{Defining theories}\label{sec:begin-thy}
 | 
| 7134 | 26 | |
| 12621 | 27 | \indexisarcmd{header}\indexisarcmd{theory}\indexisarcmd{context}\indexisarcmd{end}
 | 
| 7134 | 28 | \begin{matharray}{rcl}
 | 
| 7895 | 29 |   \isarcmd{header} & : & \isarkeep{toplevel} \\
 | 
| 8510 | 30 |   \isarcmd{theory} & : & \isartrans{toplevel}{theory} \\
 | 
| 31 |   \isarcmd{context}^* & : & \isartrans{toplevel}{theory} \\
 | |
| 32 |   \isarcmd{end} & : & \isartrans{theory}{toplevel} \\
 | |
| 7134 | 33 | \end{matharray}
 | 
| 34 | ||
| 35 | Isabelle/Isar ``new-style'' theories are either defined via theory files or | |
| 7981 | 36 | interactively. Both theory-level specifications and proofs are handled | 
| 7335 | 37 | uniformly --- occasionally definitional mechanisms even require some explicit | 
| 38 | proof as well. In contrast, ``old-style'' Isabelle theories support batch | |
| 39 | processing only, with the proof scripts collected in separate ML files. | |
| 7134 | 40 | |
| 12621 | 41 | The first ``real'' command of any theory has to be $\THEORY$, which starts a | 
| 42 | new theory based on the merge of existing ones. Just preceding $\THEORY$, | |
| 43 | there may be an optional $\isarkeyword{header}$ declaration, which is relevant
 | |
| 44 | to document preparation only; it acts very much like a special pre-theory | |
| 45 | markup command (cf.\ \S\ref{sec:markup-thy} and \S\ref{sec:markup-thy}).  The
 | |
| 13039 | 46 | $\END$ command concludes a theory development; it has to be the very last | 
| 47 | command of any theory file loaded in batch-mode. The theory context may be | |
| 12621 | 48 | also changed interactively by $\CONTEXT$ without creating a new theory. | 
| 7134 | 49 | |
| 50 | \begin{rail}
 | |
| 7895 | 51 | 'header' text | 
| 52 | ; | |
| 16255 | 53 | 'theory' name 'imports' (name +) uses? 'begin' | 
| 7134 | 54 | ; | 
| 55 | 'context' name | |
| 56 | ; | |
| 57 | ||
| 16255 | 58 | uses: 'uses' ((name | parname) +); | 
| 7134 | 59 | \end{rail}
 | 
| 60 | ||
| 7167 | 61 | \begin{descr}
 | 
| 7895 | 62 | \item [$\isarkeyword{header}~text$] provides plain text markup just preceding
 | 
| 8547 | 63 | the formal beginning of a theory. In actual document preparation the | 
| 7895 | 64 |   corresponding {\LaTeX} macro \verb,\isamarkupheader, may be redefined to
 | 
| 65 |   produce chapter or section headings.  See also \S\ref{sec:markup-thy} and
 | |
| 66 |   \S\ref{sec:markup-prf} for further markup commands.
 | |
| 67 | ||
| 16255 | 68 | \item [$\THEORY~A~\isarkeyword{imports}~B@1~\ldots~B@n~\isarkeyword{begin}$]
 | 
| 69 | starts a new theory $A$ based on the merge of existing theories $B@1, \dots, | |
| 70 | B@n$. | |
| 12621 | 71 | |
| 72 | Due to inclusion of several ancestors, the overall theory structure emerging | |
| 73 | in an Isabelle session forms a directed acyclic graph (DAG). Isabelle's | |
| 74 | theory loader ensures that the sources contributing to the development graph | |
| 75 | are always up-to-date. Changed files are automatically reloaded when | |
| 76 | processing theory headers interactively; batch-mode explicitly distinguishes | |
| 77 |   \verb,update_thy, from \verb,use_thy,, see also \cite{isabelle-ref}.
 | |
| 78 | ||
| 16255 | 79 |   The optional $\isarkeyword{uses}$ specification declares additional
 | 
| 12621 | 80 | dependencies on ML files. Files will be loaded immediately, unless the name | 
| 81 | is put in parentheses, which merely documents the dependency to be resolved | |
| 82 |   later in the text (typically via explicit $\isarcmd{use}$ in the body text,
 | |
| 83 |   see \S\ref{sec:ML}).  In reminiscence of the old-style theory system of
 | |
| 84 |   Isabelle, \texttt{$A$.thy} may be also accompanied by an additional file
 | |
| 85 |   \texttt{$A$.ML} consisting of ML code that is executed in the context of the
 | |
| 86 |   \emph{finished} theory $A$.  That file should not be included in the
 | |
| 87 |   $\isarkeyword{files}$ dependency declaration, though.
 | |
| 7134 | 88 | |
| 7895 | 89 | \item [$\CONTEXT~B$] enters an existing theory context, basically in read-only | 
| 7981 | 90 | mode, so only a limited set of commands may be performed without destroying | 
| 91 | the theory. Just as for $\THEORY$, the theory loader ensures that $B$ is | |
| 92 | loaded and up-to-date. | |
| 7175 | 93 | |
| 12621 | 94 | This command is occasionally useful for quick interactive experiments; | 
| 95 | normally one should always commence a new context via $\THEORY$. | |
| 96 | ||
| 7167 | 97 | \item [$\END$] concludes the current theory definition or context switch. | 
| 12621 | 98 | Note that this command cannot be undone, but the whole theory definition has | 
| 99 | to be retracted. | |
| 100 | ||
| 7167 | 101 | \end{descr}
 | 
| 7134 | 102 | |
| 103 | ||
| 12621 | 104 | \subsection{Markup commands}\label{sec:markup-thy}
 | 
| 7134 | 105 | |
| 7895 | 106 | \indexisarcmd{chapter}\indexisarcmd{section}\indexisarcmd{subsection}
 | 
| 107 | \indexisarcmd{subsubsection}\indexisarcmd{text}\indexisarcmd{text-raw}
 | |
| 7134 | 108 | \begin{matharray}{rcl}
 | 
| 19072 | 109 |   \isarcmd{chapter} & : & \isarkeep{local{\dsh}theory} \\
 | 
| 110 |   \isarcmd{section} & : & \isarkeep{local{\dsh}theory} \\
 | |
| 111 |   \isarcmd{subsection} & : & \isarkeep{local{\dsh}theory} \\
 | |
| 112 |   \isarcmd{subsubsection} & : & \isarkeep{local{\dsh}theory} \\
 | |
| 113 |   \isarcmd{text} & : & \isarkeep{local{\dsh}theory} \\
 | |
| 114 |   \isarcmd{text_raw} & : & \isarkeep{local{\dsh}theory} \\
 | |
| 7134 | 115 | \end{matharray}
 | 
| 116 | ||
| 7895 | 117 | Apart from formal comments (see \S\ref{sec:comments}), markup commands provide
 | 
| 7981 | 118 | a structured way to insert text into the document generated from a theory (see | 
| 7895 | 119 | \cite{isabelle-sys} for more information on Isabelle's document preparation
 | 
| 120 | tools). | |
| 7134 | 121 | |
| 122 | \begin{rail}
 | |
| 17259 
dda237f1d299
Markup commands 'chapter' .. 'text' support optional locale specification;
 wenzelm parents: 
16829diff
changeset | 123 |   ('chapter' | 'section' | 'subsection' | 'subsubsection' | 'text') locale? text
 | 
| 
dda237f1d299
Markup commands 'chapter' .. 'text' support optional locale specification;
 wenzelm parents: 
16829diff
changeset | 124 | ; | 
| 
dda237f1d299
Markup commands 'chapter' .. 'text' support optional locale specification;
 wenzelm parents: 
16829diff
changeset | 125 | 'text\_raw' text | 
| 7134 | 126 | ; | 
| 127 | \end{rail}
 | |
| 128 | ||
| 7167 | 129 | \begin{descr}
 | 
| 7335 | 130 | \item [$\isarkeyword{chapter}$, $\isarkeyword{section}$,
 | 
| 131 |   $\isarkeyword{subsection}$, and $\isarkeyword{subsubsection}$] mark chapter
 | |
| 132 | and section headings. | |
| 17259 
dda237f1d299
Markup commands 'chapter' .. 'text' support optional locale specification;
 wenzelm parents: 
16829diff
changeset | 133 | \item [$\TEXT$] specifies paragraphs of plain text. | 
| 7895 | 134 | \item [$\isarkeyword{text_raw}$] inserts {\LaTeX} source into the output,
 | 
| 135 | without additional markup. Thus the full range of document manipulations | |
| 12618 | 136 | becomes available. | 
| 7167 | 137 | \end{descr}
 | 
| 7134 | 138 | |
| 17259 
dda237f1d299
Markup commands 'chapter' .. 'text' support optional locale specification;
 wenzelm parents: 
16829diff
changeset | 139 | The $text$ argument of these markup commands (except for | 
| 
dda237f1d299
Markup commands 'chapter' .. 'text' support optional locale specification;
 wenzelm parents: 
16829diff
changeset | 140 | $\isarkeyword{text_raw}$) may contain references to formal entities
 | 
| 
dda237f1d299
Markup commands 'chapter' .. 'text' support optional locale specification;
 wenzelm parents: 
16829diff
changeset | 141 | (``antiquotations'', see also \S\ref{sec:antiq}).  These are interpreted in
 | 
| 
dda237f1d299
Markup commands 'chapter' .. 'text' support optional locale specification;
 wenzelm parents: 
16829diff
changeset | 142 | the present theory context, or the specified $locale$. | 
| 
dda237f1d299
Markup commands 'chapter' .. 'text' support optional locale specification;
 wenzelm parents: 
16829diff
changeset | 143 | |
| 8684 | 144 | Any of these markup elements corresponds to a {\LaTeX} command with the name
 | 
| 145 | prefixed by \verb,\isamarkup,. For the sectioning commands this is a plain | |
| 146 | macro with a single argument, e.g.\ \verb,\isamarkupchapter{,\dots\verb,}, for
 | |
| 147 | $\isarkeyword{chapter}$.  The $\isarkeyword{text}$ markup results in a
 | |
| 148 | {\LaTeX} environment \verb,\begin{isamarkuptext}, {\dots}
 | |
| 149 |   \verb,\end{isamarkuptext},, while $\isarkeyword{text_raw}$ causes the text
 | |
| 150 | to be inserted directly into the {\LaTeX} source.
 | |
| 7895 | 151 | |
| 8485 | 152 | \medskip | 
| 153 | ||
| 154 | Additional markup commands are available for proofs (see | |
| 7895 | 155 | \S\ref{sec:markup-prf}).  Also note that the $\isarkeyword{header}$
 | 
| 8684 | 156 | declaration (see \S\ref{sec:begin-thy}) admits to insert section markup just
 | 
| 157 | preceding the actual theory definition. | |
| 7895 | 158 | |
| 7134 | 159 | |
| 7135 | 160 | \subsection{Type classes and sorts}\label{sec:classes}
 | 
| 7134 | 161 | |
| 162 | \indexisarcmd{classes}\indexisarcmd{classrel}\indexisarcmd{defaultsort}
 | |
| 12621 | 163 | \begin{matharray}{rcll}
 | 
| 7134 | 164 |   \isarcmd{classes} & : & \isartrans{theory}{theory} \\
 | 
| 12621 | 165 |   \isarcmd{classrel} & : & \isartrans{theory}{theory} & (axiomatic!) \\
 | 
| 7134 | 166 |   \isarcmd{defaultsort} & : & \isartrans{theory}{theory} \\
 | 
| 167 | \end{matharray}
 | |
| 168 | ||
| 169 | \begin{rail}
 | |
| 12879 | 170 | 'classes' (classdecl +) | 
| 7134 | 171 | ; | 
| 14817 | 172 |   'classrel' (nameref ('<' | subseteq) nameref + 'and')
 | 
| 7134 | 173 | ; | 
| 12879 | 174 | 'defaultsort' sort | 
| 7134 | 175 | ; | 
| 176 | \end{rail}
 | |
| 177 | ||
| 7167 | 178 | \begin{descr}
 | 
| 11100 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11017diff
changeset | 179 | \item [$\isarkeyword{classes}~c \subseteq \vec c$] declares class $c$ to be a
 | 
| 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11017diff
changeset | 180 | subclass of existing classes $\vec c$. Cyclic class structures are ruled | 
| 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11017diff
changeset | 181 | out. | 
| 14817 | 182 | \item [$\isarkeyword{classrel}~c@1 \subseteq c@2$] states subclass relations
 | 
| 11100 
34d58b1818f4
\<subseteq> syntax for classes/classrel/axclass/instance;
 wenzelm parents: 
11017diff
changeset | 183 | between existing classes $c@1$ and $c@2$. This is done axiomatically! The | 
| 10223 | 184 |   $\INSTANCE$ command (see \S\ref{sec:axclass}) provides a way to introduce
 | 
| 185 | proven class relations. | |
| 7134 | 186 | \item [$\isarkeyword{defaultsort}~s$] makes sort $s$ the new default sort for
 | 
| 7895 | 187 | any type variables given without sort constraints. Usually, the default | 
| 12621 | 188 | sort would be only changed when defining a new object-logic. | 
| 7167 | 189 | \end{descr}
 | 
| 7134 | 190 | |
| 191 | ||
| 7315 | 192 | \subsection{Primitive types and type abbreviations}\label{sec:types-pure}
 | 
| 7134 | 193 | |
| 194 | \indexisarcmd{typedecl}\indexisarcmd{types}\indexisarcmd{nonterminals}\indexisarcmd{arities}
 | |
| 12621 | 195 | \begin{matharray}{rcll}
 | 
| 7134 | 196 |   \isarcmd{types} & : & \isartrans{theory}{theory} \\
 | 
| 197 |   \isarcmd{typedecl} & : & \isartrans{theory}{theory} \\
 | |
| 198 |   \isarcmd{nonterminals} & : & \isartrans{theory}{theory} \\
 | |
| 12621 | 199 |   \isarcmd{arities} & : & \isartrans{theory}{theory} & (axiomatic!) \\
 | 
| 7134 | 200 | \end{matharray}
 | 
| 201 | ||
| 202 | \begin{rail}
 | |
| 12879 | 203 | 'types' (typespec '=' type infix? +) | 
| 7134 | 204 | ; | 
| 12879 | 205 | 'typedecl' typespec infix? | 
| 7134 | 206 | ; | 
| 12879 | 207 | 'nonterminals' (name +) | 
| 7134 | 208 | ; | 
| 12879 | 209 | 'arities' (nameref '::' arity +) | 
| 7134 | 210 | ; | 
| 211 | \end{rail}
 | |
| 212 | ||
| 7167 | 213 | \begin{descr}
 | 
| 13039 | 214 | |
| 7335 | 215 | \item [$\TYPES~(\vec\alpha)t = \tau$] introduces \emph{type synonym}
 | 
| 7134 | 216 | $(\vec\alpha)t$ for existing type $\tau$. Unlike actual type definitions, | 
| 217 | as are available in Isabelle/HOL for example, type synonyms are just purely | |
| 7895 | 218 | syntactic abbreviations without any logical significance. Internally, type | 
| 7981 | 219 | synonyms are fully expanded. | 
| 13039 | 220 | |
| 7134 | 221 | \item [$\isarkeyword{typedecl}~(\vec\alpha)t$] declares a new type constructor
 | 
| 13039 | 222 | $t$, intended as an actual logical type. Note that the Isabelle/HOL | 
| 223 |   object-logic overrides $\isarkeyword{typedecl}$ by its own version
 | |
| 224 |   (\S\ref{sec:hol-typedef}).
 | |
| 225 | ||
| 7175 | 226 | \item [$\isarkeyword{nonterminals}~\vec c$] declares $0$-ary type constructors
 | 
| 227 | $\vec c$ to act as purely syntactic types, i.e.\ nonterminal symbols of | |
| 228 | Isabelle's inner syntax of terms or types. | |
| 13039 | 229 | |
| 7335 | 230 | \item [$\isarkeyword{arities}~t::(\vec s)s$] augments Isabelle's order-sorted
 | 
| 231 | signature of types by new type constructor arities. This is done | |
| 10223 | 232 |   axiomatically!  The $\INSTANCE$ command (see \S\ref{sec:axclass}) provides a
 | 
| 233 | way to introduce proven type arities. | |
| 13039 | 234 | |
| 7167 | 235 | \end{descr}
 | 
| 7134 | 236 | |
| 237 | ||
| 19072 | 238 | \subsection{Primitive constants and definitions}\label{sec:consts}
 | 
| 7134 | 239 | |
| 19626 | 240 | Definitions essentially express abbreviations within the logic. The | 
| 241 | simplest form of a definition is $f :: \sigma \equiv t$, where $f$ is | |
| 242 | a newly declared constant. Isabelle also allows derived forms where | |
| 243 | the arguments of~$f$ appear on the left, abbreviating a string of | |
| 244 | $\lambda$-abstractions, e.g.\ $f \equiv \lambda x\, y. t$ may be | |
| 245 | written more conveniently as $f \, x \, y \equiv t$. Moreover, | |
| 246 | definitions may be weakened by adding arbitrary pre-conditions: $A | |
| 247 | \Imp f \, x\, y \equiv t$. | |
| 248 | ||
| 249 | \medskip The built-in well-formedness conditions for definitional | |
| 250 | specifications are: | |
| 251 | \begin{itemize}
 | |
| 252 | \item Arguments (on the left-hand side) must be distinct variables. | |
| 253 | \item All variables on the right-hand side must also appear on the | |
| 254 | left-hand side. | |
| 255 | \item All type variables on the right-hand side must also appear on | |
| 256 | the left-hand side; this prohibits $0::nat \equiv length | |
| 257 | ([]::\alpha\, list)$ for example. | |
| 258 | \item The definition must not be recursive. Most object-logics | |
| 259 | provide definitional principles that can be used to express | |
| 260 | recursion safely. | |
| 261 | \end{itemize}
 | |
| 262 | ||
| 263 | Overloading means that a constant being declared as $c :: \alpha\, | |
| 264 | decl$ may be defined separately on type instances $c :: | |
| 265 | (\vec\beta)\,t\,decl$ for each type constructor $t$. The RHS may | |
| 266 | mention overloaded constants recursively at type instances | |
| 19711 | 267 | corresponding to the immediate argument types $\vec\beta$. Incomplete | 
| 268 | specification patterns impose global constraints on all occurrences, | |
| 269 | e.g. $d :: \alpha \times \alpha$ on the LHS means that all | |
| 270 | corresponding occurrences on some RHS need to be an instance of this, | |
| 271 | general $d :: \alpha \times \beta$ will be disallowed. | |
| 19626 | 272 | |
| 7175 | 273 | \indexisarcmd{consts}\indexisarcmd{defs}\indexisarcmd{constdefs}\indexoutertoken{constdecl}
 | 
| 7134 | 274 | \begin{matharray}{rcl}
 | 
| 275 |   \isarcmd{consts} & : & \isartrans{theory}{theory} \\
 | |
| 276 |   \isarcmd{defs} & : & \isartrans{theory}{theory} \\
 | |
| 277 |   \isarcmd{constdefs} & : & \isartrans{theory}{theory} \\
 | |
| 278 | \end{matharray}
 | |
| 279 | ||
| 280 | \begin{rail}
 | |
| 14642 | 281 | 'consts' ((name '::' type mixfix?) +) | 
| 282 | ; | |
| 19626 | 283 |   'defs' ('(' 'unchecked'? 'overloaded'? ')')? \\ (axmdecl prop +)
 | 
| 7134 | 284 | ; | 
| 14642 | 285 | \end{rail}
 | 
| 286 | ||
| 287 | \begin{rail}
 | |
| 288 | 'constdefs' structs? (constdecl? constdef +) | |
| 7134 | 289 | ; | 
| 290 | ||
| 14642 | 291 |   structs: '(' 'structure' (vars + 'and') ')'
 | 
| 292 | ; | |
| 19256 | 293 | constdecl: ((name '::' type mixfix | name '::' type | name mixfix) 'where'?) | name 'where' | 
| 14642 | 294 | ; | 
| 295 | constdef: thmdecl? prop | |
| 7134 | 296 | ; | 
| 297 | \end{rail}
 | |
| 298 | ||
| 7167 | 299 | \begin{descr}
 | 
| 7335 | 300 | \item [$\CONSTS~c::\sigma$] declares constant $c$ to have any instance of type | 
| 301 | scheme $\sigma$. The optional mixfix annotations may attach concrete syntax | |
| 7895 | 302 | to the constants declared. | 
| 19626 | 303 | |
| 304 | \item [$\DEFS~name: eqn$] introduces $eqn$ as a definitional axiom for | |
| 305 | some existing constant. | |
| 9308 | 306 | |
| 19626 | 307 | The $(unchecked)$ option disables global dependency checks for this | 
| 308 | definition, which is occasionally useful for exotic overloading. It | |
| 309 | is at the discretion of the user to avoid malformed theory | |
| 310 | specifications! | |
| 311 | ||
| 312 | The $(overloaded)$ option declares definitions to be potentially | |
| 313 | overloaded. Unless this option is given, a warning message would be | |
| 314 | issued for any definitional equation with a more special type than | |
| 315 | that of the corresponding constant declaration. | |
| 12621 | 316 | |
| 14642 | 317 | \item [$\CONSTDEFS$] provides a streamlined combination of constants | 
| 318 | declarations and definitions: type-inference takes care of the most general | |
| 319 | typing of the given specification (the optional type constraint may refer to | |
| 320 | type-inference dummies ``$_$'' as usual). The resulting type declaration | |
| 321 |   needs to agree with that of the specification; overloading is \emph{not}
 | |
| 322 | supported here! | |
| 323 | ||
| 324 | The constant name may be omitted altogether, if neither type nor syntax | |
| 325 | declarations are given. The canonical name of the definitional axiom for | |
| 326 | constant $c$ will be $c_def$, unless specified otherwise. Also note that | |
| 327 | the given list of specifications is processed in a strictly sequential | |
| 328 | manner, with type-checking being performed independently. | |
| 329 | ||
| 330 | An optional initial context of $(structure)$ declarations admits use of | |
| 331 | indexed syntax, using the special symbol \verb,\<index>, (printed as | |
| 332 | ``\i''). The latter concept is particularly useful with locales (see also | |
| 333 |   \S\ref{sec:locale}).
 | |
| 7167 | 334 | \end{descr}
 | 
| 7134 | 335 | |
| 336 | ||
| 7981 | 337 | \subsection{Syntax and translations}\label{sec:syn-trans}
 | 
| 7134 | 338 | |
| 19256 | 339 | \indexisarcmd{syntax}\indexisarcmd{no-syntax}
 | 
| 340 | \indexisarcmd{translations}\indexisarcmd{no-translations}
 | |
| 7134 | 341 | \begin{matharray}{rcl}
 | 
| 342 |   \isarcmd{syntax} & : & \isartrans{theory}{theory} \\
 | |
| 15744 
daa84ebbdf94
Pure: command 'no_syntax' removes grammar declarations;
 wenzelm parents: 
15686diff
changeset | 343 |   \isarcmd{no_syntax} & : & \isartrans{theory}{theory} \\
 | 
| 7134 | 344 |   \isarcmd{translations} & : & \isartrans{theory}{theory} \\
 | 
| 19256 | 345 |   \isarcmd{no_translations} & : & \isartrans{theory}{theory} \\
 | 
| 7134 | 346 | \end{matharray}
 | 
| 347 | ||
| 10640 | 348 | \railalias{rightleftharpoons}{\isasymrightleftharpoons}
 | 
| 349 | \railterm{rightleftharpoons}
 | |
| 350 | ||
| 351 | \railalias{rightharpoonup}{\isasymrightharpoonup}
 | |
| 352 | \railterm{rightharpoonup}
 | |
| 353 | ||
| 354 | \railalias{leftharpoondown}{\isasymleftharpoondown}
 | |
| 355 | \railterm{leftharpoondown}
 | |
| 356 | ||
| 7134 | 357 | \begin{rail}
 | 
| 19256 | 358 |   ('syntax' | 'no\_syntax') mode? (constdecl +)
 | 
| 7134 | 359 | ; | 
| 19256 | 360 |   ('translations' | 'no\_translations') (transpat ('==' | '=>' | '<=' | rightleftharpoons | rightharpoonup | leftharpoondown) transpat +)
 | 
| 7134 | 361 | ; | 
| 15744 
daa84ebbdf94
Pure: command 'no_syntax' removes grammar declarations;
 wenzelm parents: 
15686diff
changeset | 362 | |
| 
daa84ebbdf94
Pure: command 'no_syntax' removes grammar declarations;
 wenzelm parents: 
15686diff
changeset | 363 |   mode: ('(' ( name | 'output' | name 'output' ) ')')
 | 
| 
daa84ebbdf94
Pure: command 'no_syntax' removes grammar declarations;
 wenzelm parents: 
15686diff
changeset | 364 | ; | 
| 7134 | 365 |   transpat: ('(' nameref ')')? string
 | 
| 366 | ; | |
| 367 | \end{rail}
 | |
| 368 | ||
| 7167 | 369 | \begin{descr}
 | 
| 13024 | 370 | |
| 7175 | 371 | \item [$\isarkeyword{syntax}~(mode)~decls$] is similar to $\CONSTS~decls$,
 | 
| 372 | except that the actual logical signature extension is omitted. Thus the | |
| 373 | context free grammar of Isabelle's inner syntax may be augmented in | |
| 7335 | 374 | arbitrary ways, independently of the logic. The $mode$ argument refers to | 
| 13024 | 375 | the print mode that the grammar rules belong; unless the | 
| 376 |   $\isarkeyword{output}$ indicator is given, all productions are added both to
 | |
| 377 | the input and output grammar. | |
| 378 | ||
| 15744 
daa84ebbdf94
Pure: command 'no_syntax' removes grammar declarations;
 wenzelm parents: 
15686diff
changeset | 379 | \item [$\isarkeyword{no_syntax}~(mode)~decls$] removes grammar declarations
 | 
| 
daa84ebbdf94
Pure: command 'no_syntax' removes grammar declarations;
 wenzelm parents: 
15686diff
changeset | 380 | (and translations) resulting from $decls$, which are interpreted in the same | 
| 
daa84ebbdf94
Pure: command 'no_syntax' removes grammar declarations;
 wenzelm parents: 
15686diff
changeset | 381 |   manner as for $\isarkeyword{syntax}$ above.
 | 
| 
daa84ebbdf94
Pure: command 'no_syntax' removes grammar declarations;
 wenzelm parents: 
15686diff
changeset | 382 | |
| 7175 | 383 | \item [$\isarkeyword{translations}~rules$] specifies syntactic translation
 | 
| 13024 | 384 | rules (i.e.\ macros): parse~/ print rules (\isasymrightleftharpoons), parse | 
| 385 | rules (\isasymrightharpoonup), or print rules (\isasymleftharpoondown). | |
| 386 | Translation patterns may be prefixed by the syntactic category to be used | |
| 387 | for parsing; the default is $logic$. | |
| 19256 | 388 | |
| 389 | \item [$\isarkeyword{no_translations}~rules$] removes syntactic
 | |
| 390 | translation rules, which are interpreted in the same manner as for | |
| 391 |   $\isarkeyword{translations}$ above.
 | |
| 392 | ||
| 7167 | 393 | \end{descr}
 | 
| 7134 | 394 | |
| 395 | ||
| 9605 | 396 | \subsection{Axioms and theorems}\label{sec:axms-thms}
 | 
| 7134 | 397 | |
| 12618 | 398 | \indexisarcmd{axioms}\indexisarcmd{lemmas}\indexisarcmd{theorems}
 | 
| 12621 | 399 | \begin{matharray}{rcll}
 | 
| 400 |   \isarcmd{axioms} & : & \isartrans{theory}{theory} & (axiomatic!) \\
 | |
| 12618 | 401 |   \isarcmd{lemmas} & : & \isartrans{theory}{theory} \\
 | 
| 7134 | 402 |   \isarcmd{theorems} & : & \isartrans{theory}{theory} \\
 | 
| 403 | \end{matharray}
 | |
| 404 | ||
| 405 | \begin{rail}
 | |
| 12879 | 406 | 'axioms' (axmdecl prop +) | 
| 7134 | 407 | ; | 
| 12976 | 408 |   ('lemmas' | 'theorems') locale? (thmdef? thmrefs + 'and')
 | 
| 7134 | 409 | ; | 
| 410 | \end{rail}
 | |
| 411 | ||
| 7167 | 412 | \begin{descr}
 | 
| 12976 | 413 | |
| 7335 | 414 | \item [$\isarkeyword{axioms}~a: \phi$] introduces arbitrary statements as
 | 
| 7895 | 415 | axioms of the meta-logic. In fact, axioms are ``axiomatic theorems'', and | 
| 416 | may be referred later just as any other theorem. | |
| 7134 | 417 | |
| 418 | Axioms are usually only introduced when declaring new logical systems. | |
| 7175 | 419 | Everyday work is typically done the hard way, with proper definitions and | 
| 13039 | 420 | proven theorems. | 
| 12976 | 421 | |
| 13024 | 422 | \item [$\isarkeyword{lemmas}~a = \vec b$] retrieves and stores existing facts
 | 
| 12976 | 423 | in the theory context, or the specified locale (see also | 
| 424 |   \S\ref{sec:locale}).  Typical applications would also involve attributes, to
 | |
| 425 | declare Simplifier rules, for example. | |
| 426 | ||
| 12618 | 427 | \item [$\isarkeyword{theorems}$] is essentially the same as
 | 
| 428 |   $\isarkeyword{lemmas}$, but marks the result as a different kind of facts.
 | |
| 12976 | 429 | |
| 7167 | 430 | \end{descr}
 | 
| 7134 | 431 | |
| 432 | ||
| 7167 | 433 | \subsection{Name spaces}
 | 
| 7134 | 434 | |
| 8726 | 435 | \indexisarcmd{global}\indexisarcmd{local}\indexisarcmd{hide}
 | 
| 7134 | 436 | \begin{matharray}{rcl}
 | 
| 437 |   \isarcmd{global} & : & \isartrans{theory}{theory} \\
 | |
| 438 |   \isarcmd{local} & : & \isartrans{theory}{theory} \\
 | |
| 8726 | 439 |   \isarcmd{hide} & : & \isartrans{theory}{theory} \\
 | 
| 7134 | 440 | \end{matharray}
 | 
| 441 | ||
| 8726 | 442 | \begin{rail}
 | 
| 18855 | 443 |   'hide' ('(open)')? name (nameref + )
 | 
| 8726 | 444 | ; | 
| 445 | \end{rail}
 | |
| 446 | ||
| 7895 | 447 | Isabelle organizes any kind of name declarations (of types, constants, | 
| 8547 | 448 | theorems etc.) by separate hierarchically structured name spaces. Normally | 
| 8726 | 449 | the user does not have to control the behavior of name spaces by hand, yet the | 
| 450 | following commands provide some way to do so. | |
| 7175 | 451 | |
| 7167 | 452 | \begin{descr}
 | 
| 453 | \item [$\isarkeyword{global}$ and $\isarkeyword{local}$] change the current
 | |
| 454 |   name declaration mode.  Initially, theories start in $\isarkeyword{local}$
 | |
| 455 | mode, causing all names to be automatically qualified by the theory name. | |
| 7895 | 456 |   Changing this to $\isarkeyword{global}$ causes all names to be declared
 | 
| 457 |   without the theory prefix, until $\isarkeyword{local}$ is declared again.
 | |
| 8726 | 458 | |
| 459 | Note that global names are prone to get hidden accidently later, when | |
| 460 | qualified names of the same base name are introduced. | |
| 461 | ||
| 17397 | 462 | \item [$\isarkeyword{hide}~space~names$] fully removes declarations from a
 | 
| 463 | given name space (which may be $class$, $type$, or $const$); with the | |
| 464 | $(open)$ option, only the base name is hidden. Global (unqualified) names | |
| 465 | may never be hidden. | |
| 466 | ||
| 467 | Note that hiding name space accesses has no impact on logical declarations | |
| 468 | -- they remain valid internally. Entities that are no longer accessible to | |
| 469 | the user are printed with the special qualifier ``$\mathord?\mathord?$'' | |
| 470 | prefixed to the full internal name. | |
| 7167 | 471 | \end{descr}
 | 
| 7134 | 472 | |
| 473 | ||
| 7167 | 474 | \subsection{Incorporating ML code}\label{sec:ML}
 | 
| 7134 | 475 | |
| 8682 | 476 | \indexisarcmd{use}\indexisarcmd{ML}\indexisarcmd{ML-command}
 | 
| 477 | \indexisarcmd{ML-setup}\indexisarcmd{setup}
 | |
| 9199 | 478 | \indexisarcmd{method-setup}
 | 
| 7134 | 479 | \begin{matharray}{rcl}
 | 
| 480 |   \isarcmd{use} & : & \isartrans{\cdot}{\cdot} \\
 | |
| 481 |   \isarcmd{ML} & : & \isartrans{\cdot}{\cdot} \\
 | |
| 8682 | 482 |   \isarcmd{ML_command} & : & \isartrans{\cdot}{\cdot} \\
 | 
| 7895 | 483 |   \isarcmd{ML_setup} & : & \isartrans{theory}{theory} \\
 | 
| 7175 | 484 |   \isarcmd{setup} & : & \isartrans{theory}{theory} \\
 | 
| 9199 | 485 |   \isarcmd{method_setup} & : & \isartrans{theory}{theory} \\
 | 
| 7134 | 486 | \end{matharray}
 | 
| 487 | ||
| 7895 | 488 | \railalias{MLsetup}{ML\_setup}
 | 
| 489 | \railterm{MLsetup}
 | |
| 490 | ||
| 9199 | 491 | \railalias{methodsetup}{method\_setup}
 | 
| 492 | \railterm{methodsetup}
 | |
| 493 | ||
| 8682 | 494 | \railalias{MLcommand}{ML\_command}
 | 
| 495 | \railterm{MLcommand}
 | |
| 496 | ||
| 7134 | 497 | \begin{rail}
 | 
| 12879 | 498 | 'use' name | 
| 7134 | 499 | ; | 
| 18855 | 500 |   ('ML' | MLcommand | MLsetup) text
 | 
| 501 | ; | |
| 502 | 'setup' text? | |
| 7134 | 503 | ; | 
| 12879 | 504 | methodsetup name '=' text text | 
| 9199 | 505 | ; | 
| 7134 | 506 | \end{rail}
 | 
| 507 | ||
| 7167 | 508 | \begin{descr}
 | 
| 7175 | 509 | \item [$\isarkeyword{use}~file$] reads and executes ML commands from $file$.
 | 
| 7466 | 510 | The current theory context (if present) is passed down to the ML session, | 
| 7981 | 511 | but may not be modified. Furthermore, the file name is checked with the | 
| 7466 | 512 |   $\isarkeyword{files}$ dependency declaration given in the theory header (see
 | 
| 513 |   also \S\ref{sec:begin-thy}).
 | |
| 514 | ||
| 8682 | 515 | \item [$\isarkeyword{ML}~text$ and $\isarkeyword{ML_command}~text$] execute ML
 | 
| 516 | commands from $text$. The theory context is passed in the same way as for | |
| 10858 | 517 |   $\isarkeyword{use}$, but may not be changed.  Note that the output of
 | 
| 8682 | 518 |   $\isarkeyword{ML_command}$ is less verbose than plain $\isarkeyword{ML}$.
 | 
| 7895 | 519 | |
| 520 | \item [$\isarkeyword{ML_setup}~text$] executes ML commands from $text$.  The
 | |
| 521 | theory context is passed down to the ML session, and fetched back | |
| 522 | afterwards. Thus $text$ may actually change the theory as a side effect. | |
| 523 | ||
| 7167 | 524 | \item [$\isarkeyword{setup}~text$] changes the current theory context by
 | 
| 8379 | 525 | applying $text$, which refers to an ML expression of type | 
| 18855 | 526 |   \texttt{theory~->~theory)}.  The $\isarkeyword{setup}$ command is the
 | 
| 8547 | 527 | canonical way to initialize any object-logic specific tools and packages | 
| 18855 | 528 | written in ML. If the $text$ is omitted, the setup value is taken from the | 
| 529 | implicit context maintained via \verb,Context.add_setup,. | |
| 9199 | 530 | |
| 531 | \item [$\isarkeyword{method_setup}~name = text~description$] defines a proof
 | |
| 532 | method in the current theory. The given $text$ has to be an ML expression | |
| 533 |   of type \texttt{Args.src -> Proof.context -> Proof.method}.  Parsing
 | |
| 534 |   concrete method syntax from \texttt{Args.src} input can be quite tedious in
 | |
| 535 | general. The following simple examples are for methods without any explicit | |
| 536 | arguments, or a list of theorems, respectively. | |
| 537 | ||
| 538 | {\footnotesize
 | |
| 539 | \begin{verbatim}
 | |
| 9605 | 540 | Method.no_args (Method.METHOD (fn facts => foobar_tac)) | 
| 541 | Method.thms_args (fn thms => Method.METHOD (fn facts => foobar_tac)) | |
| 10899 | 542 | Method.ctxt_args (fn ctxt => Method.METHOD (fn facts => foobar_tac)) | 
| 12618 | 543 | Method.thms_ctxt_args (fn thms => fn ctxt => | 
| 544 | Method.METHOD (fn facts => foobar_tac)) | |
| 9199 | 545 | \end{verbatim}
 | 
| 546 | } | |
| 547 | ||
| 548 | Note that mere tactic emulations may ignore the \texttt{facts} parameter
 | |
| 13039 | 549 | above. Proper proof methods would do something appropriate with the list of | 
| 550 | current facts, though. Single-rule methods usually do strict forward-chaining | |
| 551 | (e.g.\ by using \texttt{Method.multi_resolves}), while automatic ones just
 | |
| 552 | insert the facts using \texttt{Method.insert_tac} before applying the main
 | |
| 553 | tactic. | |
| 7167 | 554 | \end{descr}
 | 
| 7134 | 555 | |
| 556 | ||
| 8250 | 557 | \subsection{Syntax translation functions}
 | 
| 7134 | 558 | |
| 8250 | 559 | \indexisarcmd{parse-ast-translation}\indexisarcmd{parse-translation}
 | 
| 560 | \indexisarcmd{print-translation}\indexisarcmd{typed-print-translation}
 | |
| 561 | \indexisarcmd{print-ast-translation}\indexisarcmd{token-translation}
 | |
| 562 | \begin{matharray}{rcl}
 | |
| 563 |   \isarcmd{parse_ast_translation} & : & \isartrans{theory}{theory} \\
 | |
| 564 |   \isarcmd{parse_translation} & : & \isartrans{theory}{theory} \\
 | |
| 565 |   \isarcmd{print_translation} & : & \isartrans{theory}{theory} \\
 | |
| 566 |   \isarcmd{typed_print_translation} & : & \isartrans{theory}{theory} \\
 | |
| 567 |   \isarcmd{print_ast_translation} & : & \isartrans{theory}{theory} \\
 | |
| 568 |   \isarcmd{token_translation} & : & \isartrans{theory}{theory} \\
 | |
| 569 | \end{matharray}
 | |
| 7134 | 570 | |
| 9273 | 571 | \railalias{parseasttranslation}{parse\_ast\_translation}
 | 
| 572 | \railterm{parseasttranslation}
 | |
| 573 | ||
| 574 | \railalias{parsetranslation}{parse\_translation}
 | |
| 575 | \railterm{parsetranslation}
 | |
| 576 | ||
| 577 | \railalias{printtranslation}{print\_translation}
 | |
| 578 | \railterm{printtranslation}
 | |
| 579 | ||
| 580 | \railalias{typedprinttranslation}{typed\_print\_translation}
 | |
| 581 | \railterm{typedprinttranslation}
 | |
| 582 | ||
| 583 | \railalias{printasttranslation}{print\_ast\_translation}
 | |
| 584 | \railterm{printasttranslation}
 | |
| 585 | ||
| 586 | \railalias{tokentranslation}{token\_translation}
 | |
| 587 | \railterm{tokentranslation}
 | |
| 588 | ||
| 589 | \begin{rail}
 | |
| 590 | ( parseasttranslation | parsetranslation | printtranslation | typedprinttranslation | | |
| 18855 | 591 |   printasttranslation ) ('(advanced)')? text;
 | 
| 14642 | 592 | |
| 593 | tokentranslation text | |
| 9273 | 594 | \end{rail}
 | 
| 595 | ||
| 8250 | 596 | Syntax translation functions written in ML admit almost arbitrary | 
| 597 | manipulations of Isabelle's inner syntax. Any of the above commands have a | |
| 13048 | 598 | single \railqtok{text} argument that refers to an ML expression of appropriate
 | 
| 14642 | 599 | type, which are as follows by default: | 
| 8379 | 600 | |
| 601 | \begin{ttbox}
 | |
| 602 | val parse_ast_translation : (string * (ast list -> ast)) list | |
| 603 | val parse_translation : (string * (term list -> term)) list | |
| 604 | val print_translation : (string * (term list -> term)) list | |
| 605 | val typed_print_translation : | |
| 606 | (string * (bool -> typ -> term list -> term)) list | |
| 607 | val print_ast_translation : (string * (ast list -> ast)) list | |
| 608 | val token_translation : | |
| 609 | (string * string * (string -> string * real)) list | |
| 610 | \end{ttbox}
 | |
| 14642 | 611 | |
| 18857 | 612 | In case that the $(advanced)$ option is given, the corresponding | 
| 613 | translation functions may depend on the current theory or proof | |
| 614 | context. This allows to implement advanced syntax mechanisms, as | |
| 615 | translations functions may refer to specific theory declarations or | |
| 616 | auxiliary proof data. | |
| 14642 | 617 | |
| 618 | See also \cite[\S8]{isabelle-ref} for more information on the general concept
 | |
| 619 | of syntax transformations in Isabelle. | |
| 620 | ||
| 621 | \begin{ttbox}
 | |
| 622 | val parse_ast_translation: | |
| 18857 | 623 | (string * (Context.generic -> ast list -> ast)) list | 
| 14642 | 624 | val parse_translation: | 
| 18857 | 625 | (string * (Context.generic -> term list -> term)) list | 
| 14642 | 626 | val print_translation: | 
| 18857 | 627 | (string * (Context.generic -> term list -> term)) list | 
| 14642 | 628 | val typed_print_translation: | 
| 18857 | 629 | (string * (Context.generic -> bool -> typ -> term list -> term)) list | 
| 14642 | 630 | val print_ast_translation: | 
| 18857 | 631 | (string * (Context.generic -> ast list -> ast)) list | 
| 14642 | 632 | \end{ttbox}
 | 
| 7134 | 633 | |
| 634 | ||
| 635 | \subsection{Oracles}
 | |
| 636 | ||
| 637 | \indexisarcmd{oracle}
 | |
| 638 | \begin{matharray}{rcl}
 | |
| 639 |   \isarcmd{oracle} & : & \isartrans{theory}{theory} \\
 | |
| 640 | \end{matharray}
 | |
| 641 | ||
| 16829 | 642 | The oracle interface promotes a given ML function \texttt{theory -> T -> term}
 | 
| 643 | to \texttt{theory -> T -> thm}, for some type \texttt{T} given by the user.
 | |
| 644 | This acts like an infinitary specification of axioms -- there is no internal | |
| 645 | check of the correctness of the results! The inference kernel records oracle | |
| 646 | invocations within the internal derivation object of theorems, and the pretty | |
| 647 | printer attaches ``\texttt{[!]}'' to indicate results that are not fully
 | |
| 648 | checked by Isabelle inferences. | |
| 7175 | 649 | |
| 7134 | 650 | \begin{rail}
 | 
| 16829 | 651 |   'oracle' name '(' type ')' '=' text
 | 
| 7134 | 652 | ; | 
| 653 | \end{rail}
 | |
| 654 | ||
| 7167 | 655 | \begin{descr}
 | 
| 16829 | 656 | \item [$\isarkeyword{oracle}~name~(type)=~text$] turns the given ML expression
 | 
| 657 |   $text$ of type \texttt{theory~->~$type$~->~term} into an ML function $name$
 | |
| 658 |   of type \texttt{theory~->~$type$~->~thm}.
 | |
| 7167 | 659 | \end{descr}
 | 
| 7134 | 660 | |
| 661 | ||
| 662 | \section{Proof commands}
 | |
| 663 | ||
| 7987 | 664 | Proof commands perform transitions of Isar/VM machine configurations, which | 
| 7315 | 665 | are block-structured, consisting of a stack of nodes with three main | 
| 7335 | 666 | components: logical proof context, current facts, and open goals. Isar/VM | 
| 8547 | 667 | transitions are \emph{typed} according to the following three different modes
 | 
| 668 | of operation: | |
| 7167 | 669 | \begin{descr}
 | 
| 670 | \item [$proof(prove)$] means that a new goal has just been stated that is now | |
| 8547 | 671 |   to be \emph{proven}; the next command may refine it by some proof method,
 | 
| 672 | and enter a sub-proof to establish the actual result. | |
| 10858 | 673 | \item [$proof(state)$] is like a nested theory mode: the context may be | 
| 7987 | 674 |   augmented by \emph{stating} additional assumptions, intermediate results
 | 
| 675 | etc. | |
| 7895 | 676 | \item [$proof(chain)$] is intermediate between $proof(state)$ and | 
| 7987 | 677 | $proof(prove)$: existing facts (i.e.\ the contents of the special ``$this$'' | 
| 678 | register) have been just picked up in order to be used when refining the | |
| 679 | goal claimed next. | |
| 7167 | 680 | \end{descr}
 | 
| 7134 | 681 | |
| 12621 | 682 | The proof mode indicator may be read as a verb telling the writer what kind of | 
| 683 | operation may be performed next. The corresponding typings of proof commands | |
| 684 | restricts the shape of well-formed proof texts to particular command | |
| 685 | sequences. So dynamic arrangements of commands eventually turn out as static | |
| 13039 | 686 | texts of a certain structure.  Appendix~\ref{ap:refcard} gives a simplified
 | 
| 687 | grammar of the overall (extensible) language emerging that way. | |
| 7167 | 688 | |
| 12621 | 689 | |
| 690 | \subsection{Markup commands}\label{sec:markup-prf}
 | |
| 7167 | 691 | |
| 7987 | 692 | \indexisarcmd{sect}\indexisarcmd{subsect}\indexisarcmd{subsubsect}
 | 
| 7895 | 693 | \indexisarcmd{txt}\indexisarcmd{txt-raw}
 | 
| 7134 | 694 | \begin{matharray}{rcl}
 | 
| 8101 | 695 |   \isarcmd{sect} & : & \isartrans{proof}{proof} \\
 | 
| 696 |   \isarcmd{subsect} & : & \isartrans{proof}{proof} \\
 | |
| 697 |   \isarcmd{subsubsect} & : & \isartrans{proof}{proof} \\
 | |
| 698 |   \isarcmd{txt} & : & \isartrans{proof}{proof} \\
 | |
| 699 |   \isarcmd{txt_raw} & : & \isartrans{proof}{proof} \\
 | |
| 7134 | 700 | \end{matharray}
 | 
| 701 | ||
| 7895 | 702 | These markup commands for proof mode closely correspond to the ones of theory | 
| 8684 | 703 | mode (see \S\ref{sec:markup-thy}).
 | 
| 7895 | 704 | |
| 705 | \railalias{txtraw}{txt\_raw}
 | |
| 706 | \railterm{txtraw}
 | |
| 7175 | 707 | |
| 7134 | 708 | \begin{rail}
 | 
| 7895 | 709 |   ('sect' | 'subsect' | 'subsubsect' | 'txt' | txtraw) text
 | 
| 7134 | 710 | ; | 
| 711 | \end{rail}
 | |
| 712 | ||
| 713 | ||
| 12621 | 714 | \subsection{Context elements}\label{sec:proof-context}
 | 
| 7134 | 715 | |
| 7315 | 716 | \indexisarcmd{fix}\indexisarcmd{assume}\indexisarcmd{presume}\indexisarcmd{def}
 | 
| 7134 | 717 | \begin{matharray}{rcl}
 | 
| 718 |   \isarcmd{fix} & : & \isartrans{proof(state)}{proof(state)} \\
 | |
| 719 |   \isarcmd{assume} & : & \isartrans{proof(state)}{proof(state)} \\
 | |
| 720 |   \isarcmd{presume} & : & \isartrans{proof(state)}{proof(state)} \\
 | |
| 721 |   \isarcmd{def} & : & \isartrans{proof(state)}{proof(state)} \\
 | |
| 722 | \end{matharray}
 | |
| 723 | ||
| 7315 | 724 | The logical proof context consists of fixed variables and assumptions. The | 
| 725 | former closely correspond to Skolem constants, or meta-level universal | |
| 726 | quantification as provided by the Isabelle/Pure logical framework. | |
| 13039 | 727 | Introducing some \emph{arbitrary, but fixed} variable via ``$\FIX x$'' results
 | 
| 728 | in a local value that may be used in the subsequent proof as any other | |
| 729 | variable or constant. Furthermore, any result $\edrv \phi[x]$ exported from | |
| 730 | the context will be universally closed wrt.\ $x$ at the outermost level: | |
| 731 | $\edrv \All x \phi$ (this is expressed using Isabelle's meta-variables). | |
| 7315 | 732 | |
| 733 | Similarly, introducing some assumption $\chi$ has two effects. On the one | |
| 734 | hand, a local theorem is created that may be used as a fact in subsequent | |
| 7895 | 735 | proof steps. On the other hand, any result $\chi \drv \phi$ exported from the | 
| 736 | context becomes conditional wrt.\ the assumption: $\edrv \chi \Imp \phi$. | |
| 737 | Thus, solving an enclosing goal using such a result would basically introduce | |
| 738 | a new subgoal stemming from the assumption. How this situation is handled | |
| 739 | depends on the actual version of assumption command used: while $\ASSUMENAME$ | |
| 740 | insists on solving the subgoal by unification with some premise of the goal, | |
| 741 | $\PRESUMENAME$ leaves the subgoal unchanged in order to be proved later by the | |
| 742 | user. | |
| 7315 | 743 | |
| 13039 | 744 | Local definitions, introduced by ``$\DEF{}{x \equiv t}$'', are achieved by
 | 
| 745 | combining ``$\FIX x$'' with another version of assumption that causes any | |
| 7987 | 746 | hypothetical equation $x \equiv t$ to be eliminated by the reflexivity rule. | 
| 747 | Thus, exporting some result $x \equiv t \drv \phi[x]$ yields $\edrv \phi[t]$. | |
| 7175 | 748 | |
| 10686 | 749 | \railalias{equiv}{\isasymequiv}
 | 
| 750 | \railterm{equiv}
 | |
| 751 | ||
| 7134 | 752 | \begin{rail}
 | 
| 12879 | 753 | 'fix' (vars + 'and') | 
| 7134 | 754 | ; | 
| 12879 | 755 |   ('assume' | 'presume') (props + 'and')
 | 
| 7134 | 756 | ; | 
| 18308 | 757 | 'def' (def + 'and') | 
| 758 | ; | |
| 759 |   def: thmdecl? \\ name ('==' | equiv) term termpat?
 | |
| 7134 | 760 | ; | 
| 761 | \end{rail}
 | |
| 762 | ||
| 7167 | 763 | \begin{descr}
 | 
| 13039 | 764 | |
| 8547 | 765 | \item [$\FIX{\vec x}$] introduces local \emph{arbitrary, but fixed} variables
 | 
| 766 | $\vec x$. | |
| 13039 | 767 | |
| 8515 | 768 | \item [$\ASSUME{a}{\vec\phi}$ and $\PRESUME{a}{\vec\phi}$] introduce local
 | 
| 769 | theorems $\vec\phi$ by assumption. Subsequent results applied to an | |
| 770 | enclosing goal (e.g.\ by $\SHOWNAME$) are handled as follows: $\ASSUMENAME$ | |
| 771 | expects to be able to unify with existing premises in the goal, while | |
| 772 | $\PRESUMENAME$ leaves $\vec\phi$ as new subgoals. | |
| 7335 | 773 | |
| 774 | Several lists of assumptions may be given (separated by | |
| 7895 | 775 |   $\isarkeyword{and}$); the resulting list of current facts consists of all of
 | 
| 776 | these concatenated. | |
| 13039 | 777 | |
| 7315 | 778 | \item [$\DEF{a}{x \equiv t}$] introduces a local (non-polymorphic) definition.
 | 
| 779 | In results exported from the context, $x$ is replaced by $t$. Basically, | |
| 13039 | 780 |   ``$\DEF{}{x \equiv t}$'' abbreviates ``$\FIX{x}~\ASSUME{}{x \equiv t}$'',
 | 
| 781 | with the resulting hypothetical equation solved by reflexivity. | |
| 7431 | 782 | |
| 18308 | 783 | The default name for the definitional equation is $x_def$. Several | 
| 784 | simultaneous definitions may be given at the same time. | |
| 13039 | 785 | |
| 7167 | 786 | \end{descr}
 | 
| 787 | ||
| 7895 | 788 | The special name $prems$\indexisarthm{prems} refers to all assumptions of the
 | 
| 789 | current context as a list of theorems. | |
| 7315 | 790 | |
| 7167 | 791 | |
| 792 | \subsection{Facts and forward chaining}
 | |
| 793 | ||
| 794 | \indexisarcmd{note}\indexisarcmd{then}\indexisarcmd{from}\indexisarcmd{with}
 | |
| 18544 | 795 | \indexisarcmd{using}\indexisarcmd{unfolding}
 | 
| 7167 | 796 | \begin{matharray}{rcl}
 | 
| 797 |   \isarcmd{note} & : & \isartrans{proof(state)}{proof(state)} \\
 | |
| 798 |   \isarcmd{then} & : & \isartrans{proof(state)}{proof(chain)} \\
 | |
| 799 |   \isarcmd{from} & : & \isartrans{proof(state)}{proof(chain)} \\
 | |
| 800 |   \isarcmd{with} & : & \isartrans{proof(state)}{proof(chain)} \\
 | |
| 12966 | 801 |   \isarcmd{using} & : & \isartrans{proof(prove)}{proof(prove)} \\
 | 
| 18544 | 802 |   \isarcmd{unfolding} & : & \isartrans{proof(prove)}{proof(prove)} \\
 | 
| 7167 | 803 | \end{matharray}
 | 
| 804 | ||
| 7319 | 805 | New facts are established either by assumption or proof of local statements. | 
| 7335 | 806 | Any fact will usually be involved in further proofs, either as explicit | 
| 8547 | 807 | arguments of proof methods, or when forward chaining towards the next goal via | 
| 12966 | 808 | $\THEN$ (and variants); $\FROMNAME$ and $\WITHNAME$ are composite forms | 
| 13039 | 809 | involving $\NOTENAME$. The $\USINGNAME$ elements augments the collection of | 
| 810 | used facts \emph{after} a goal has been stated.  Note that the special theorem
 | |
| 811 | name $this$\indexisarthm{this} refers to the most recently established facts,
 | |
| 812 | but only \emph{before} issuing a follow-up claim.
 | |
| 12966 | 813 | |
| 7167 | 814 | \begin{rail}
 | 
| 12879 | 815 | 'note' (thmdef? thmrefs + 'and') | 
| 7167 | 816 | ; | 
| 18544 | 817 |   ('from' | 'with' | 'using' | 'unfolding') (thmrefs + 'and')
 | 
| 7167 | 818 | ; | 
| 819 | \end{rail}
 | |
| 820 | ||
| 821 | \begin{descr}
 | |
| 13039 | 822 | |
| 7175 | 823 | \item [$\NOTE{a}{\vec b}$] recalls existing facts $\vec b$, binding the result
 | 
| 824 | as $a$. Note that attributes may be involved as well, both on the left and | |
| 825 | right hand sides. | |
| 13039 | 826 | |
| 7167 | 827 | \item [$\THEN$] indicates forward chaining by the current facts in order to | 
| 7895 | 828 | establish the goal to be claimed next. The initial proof method invoked to | 
| 13039 | 829 | refine that will be offered the facts to do ``anything appropriate'' (see | 
| 7895 | 830 |   also \S\ref{sec:proof-steps}).  For example, method $rule$ (see
 | 
| 8515 | 831 |   \S\ref{sec:pure-meth-att}) would typically do an elimination rather than an
 | 
| 7895 | 832 | introduction. Automatic methods usually insert the facts into the goal | 
| 8547 | 833 | state before operation. This provides a simple scheme to control relevance | 
| 834 | of facts in automated proof search. | |
| 13039 | 835 | |
| 836 | \item [$\FROM{\vec b}$] abbreviates ``$\NOTE{}{\vec b}~\THEN$''; thus $\THEN$
 | |
| 837 |   is equivalent to ``$\FROM{this}$''.
 | |
| 838 | ||
| 839 | \item [$\WITH{\vec b}$] abbreviates ``$\FROM{\vec b~\AND~this}$''; thus the
 | |
| 840 | forward chaining is from earlier facts together with the current ones. | |
| 841 | ||
| 19989 | 842 | \item [$\USING{\vec b}$] augments the facts being currently indicated
 | 
| 843 | for use by a subsequent refinement step (such as $\APPLYNAME$ or | |
| 844 | $\PROOFNAME$). | |
| 18544 | 845 | |
| 19989 | 846 | \item [$\UNFOLDING{\vec b}$] is structurally similar to $\USINGNAME$,
 | 
| 847 | but unfolds definitional equations $\vec b$ throughout the goal | |
| 848 | state and facts. | |
| 13039 | 849 | |
| 7167 | 850 | \end{descr}
 | 
| 851 | ||
| 13039 | 852 | Forward chaining with an empty list of theorems is the same as not chaining at | 
| 853 | all.  Thus ``$\FROM{nothing}$'' has no effect apart from entering
 | |
| 854 | $prove(chain)$ mode, since $nothing$\indexisarthm{nothing} is bound to the
 | |
| 855 | empty list of theorems. | |
| 9238 | 856 | |
| 12966 | 857 | Basic proof methods (such as $rule$) expect multiple facts to be given in | 
| 858 | their proper order, corresponding to a prefix of the premises of the rule | |
| 859 | involved. Note that positions may be easily skipped using something like | |
| 860 | $\FROM{\Text{\texttt{_}}~a~b}$, for example.  This involves the trivial rule
 | |
| 861 | $\PROP\psi \Imp \PROP\psi$, which happens to be bound in Isabelle/Pure as | |
| 862 | ``\texttt{_}'' (underscore).\indexisarthm{_@\texttt{_}}
 | |
| 863 | ||
| 864 | Automated methods (such as $simp$ or $auto$) just insert any given facts | |
| 865 | before their usual operation. Depending on the kind of procedure involved, | |
| 866 | the order of facts is less significant here. | |
| 867 | ||
| 7167 | 868 | |
| 12976 | 869 | \subsection{Goal statements}\label{sec:goals}
 | 
| 7167 | 870 | |
| 12618 | 871 | \indexisarcmd{lemma}\indexisarcmd{theorem}\indexisarcmd{corollary}
 | 
| 7167 | 872 | \indexisarcmd{have}\indexisarcmd{show}\indexisarcmd{hence}\indexisarcmd{thus}
 | 
| 19667 | 873 | \indexisarcmd{print-statement}
 | 
| 7167 | 874 | \begin{matharray}{rcl}
 | 
| 12618 | 875 |   \isarcmd{lemma} & : & \isartrans{theory}{proof(prove)} \\
 | 
| 7167 | 876 |   \isarcmd{theorem} & : & \isartrans{theory}{proof(prove)} \\
 | 
| 12618 | 877 |   \isarcmd{corollary} & : & \isartrans{theory}{proof(prove)} \\
 | 
| 7987 | 878 |   \isarcmd{have} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
 | 
| 879 |   \isarcmd{show} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
 | |
| 7167 | 880 |   \isarcmd{hence} & : & \isartrans{proof(state)}{proof(prove)} \\
 | 
| 881 |   \isarcmd{thus} & : & \isartrans{proof(state)}{proof(prove)} \\
 | |
| 19263 | 882 |   \isarcmd{print_statement}^* & : & \isarkeep{theory~|~proof} \\
 | 
| 7167 | 883 | \end{matharray}
 | 
| 884 | ||
| 12621 | 885 | From a theory context, proof mode is entered by an initial goal command such | 
| 13039 | 886 | as $\LEMMANAME$, $\THEOREMNAME$, or $\COROLLARYNAME$. Within a proof, new | 
| 887 | claims may be introduced locally as well; four variants are available here to | |
| 12621 | 888 | indicate whether forward chaining of facts should be performed initially (via | 
| 13039 | 889 | $\THEN$), and whether the final result is meant to solve some pending goal. | 
| 12618 | 890 | |
| 891 | Goals may consist of multiple statements, resulting in a list of facts | |
| 892 | eventually. A pending multi-goal is internally represented as a meta-level | |
| 13039 | 893 | conjunction (printed as \verb,&&,), which is usually split into the | 
| 894 | corresponding number of sub-goals prior to an initial method application, via | |
| 12618 | 895 | $\PROOFNAME$ (\S\ref{sec:proof-steps}) or $\APPLYNAME$
 | 
| 13039 | 896 | (\S\ref{sec:tactic-commands}).  The $induct$ method covered in
 | 
| 18233 | 897 | \S\ref{sec:cases-induct} acts on multiple claims simultaneously.
 | 
| 12966 | 898 | |
| 18904 | 899 | Claims at the theory level may be either in short or long form. A | 
| 900 | short goal merely consists of several simultaneous propositions (often | |
| 901 | just one). A long goal includes an explicit context specification for | |
| 902 | the subsequent conclusion, involving local parameters. Here the role | |
| 903 | of each part of the statement is explicitly marked by separate | |
| 904 | keywords (see also \S\ref{sec:locale}).
 | |
| 905 | \indexisarelem{shows}\indexisarelem{obtains}Moreover, there are two
 | |
| 906 | kinds of conclusions: $\isarkeyword{shows}$ states several
 | |
| 907 | simultaneous propositions (essentially a big conjunction), while | |
| 908 | $\isarkeyword{obtains}$ claims several simultaneous simultaneous
 | |
| 909 | contexts of (essentially a big disjunction of eliminated parameters | |
| 910 | and assumptions, cf.\ \S\ref{sec:obtain}).
 | |
| 12618 | 911 | |
| 7167 | 912 | \begin{rail}
 | 
| 13016 | 913 |   ('lemma' | 'theorem' | 'corollary') locale? (goal | longgoal)
 | 
| 7167 | 914 | ; | 
| 13016 | 915 |   ('have' | 'show' | 'hence' | 'thus') goal
 | 
| 7167 | 916 | ; | 
| 19263 | 917 | 'print\_statement' modes? thmrefs | 
| 918 | ; | |
| 12966 | 919 | |
| 13016 | 920 | goal: (props + 'and') | 
| 12621 | 921 | ; | 
| 18904 | 922 | longgoal: thmdecl? (contextelem *) conclusion | 
| 923 | ; | |
| 924 | conclusion: 'shows' goal | 'obtains' (parname? case + '|') | |
| 925 | ; | |
| 926 | case: (vars + 'and') 'where' (props + 'and') | |
| 12621 | 927 | ; | 
| 7167 | 928 | \end{rail}
 | 
| 929 | ||
| 930 | \begin{descr}
 | |
| 13039 | 931 | |
| 12618 | 932 | \item [$\LEMMA{a}{\vec\phi}$] enters proof mode with $\vec\phi$ as main goal,
 | 
| 933 | eventually resulting in some fact $\turn \vec\phi$ to be put back into the | |
| 13039 | 934 |   theory context, or into the specified locale (cf.\ \S\ref{sec:locale}).  An
 | 
| 935 |   additional \railnonterm{context} specification may build up an initial proof
 | |
| 936 | context for the subsequent claim; this includes local definitions and syntax | |
| 937 |   as well, see the definition of $contextelem$ in \S\ref{sec:locale}.
 | |
| 12618 | 938 | |
| 939 | \item [$\THEOREM{a}{\vec\phi}$ and $\COROLLARY{a}{\vec\phi}$] are essentially
 | |
| 940 |   the same as $\LEMMA{a}{\vec\phi}$, but the facts are internally marked as
 | |
| 941 | being of a different kind. This discrimination acts like a formal comment. | |
| 942 | ||
| 943 | \item [$\HAVE{a}{\vec\phi}$] claims a local goal, eventually resulting in a
 | |
| 944 | fact within the current logical context. This operation is completely | |
| 945 | independent of any pending sub-goals of an enclosing goal statements, so | |
| 946 | $\HAVENAME$ may be freely used for experimental exploration of potential | |
| 947 | results within a proof body. | |
| 948 | ||
| 949 | \item [$\SHOW{a}{\vec\phi}$] is like $\HAVE{a}{\vec\phi}$ plus a second stage
 | |
| 950 | to refine some pending sub-goal for each one of the finished result, after | |
| 951 | having been exported into the corresponding context (at the head of the | |
| 13039 | 952 | sub-proof of this $\SHOWNAME$ command). | 
| 12618 | 953 | |
| 954 | To accommodate interactive debugging, resulting rules are printed before | |
| 955 | being applied internally. Even more, interactive execution of $\SHOWNAME$ | |
| 13039 | 956 | predicts potential failure and displays the resulting error as a warning | 
| 957 | beforehand. Watch out for the following message: | |
| 12618 | 958 | |
| 959 |   \begin{ttbox}
 | |
| 960 | Problem! Local statement will fail to solve any pending goal | |
| 961 |   \end{ttbox}
 | |
| 13039 | 962 | |
| 963 | \item [$\HENCENAME$] abbreviates ``$\THEN~\HAVENAME$'', i.e.\ claims a local | |
| 964 | goal to be proven by forward chaining the current facts. Note that | |
| 965 |   $\HENCENAME$ is also equivalent to ``$\FROM{this}~\HAVENAME$''.
 | |
| 966 | ||
| 967 | \item [$\THUSNAME$] abbreviates ``$\THEN~\SHOWNAME$''. Note that $\THUSNAME$ | |
| 968 |   is also equivalent to ``$\FROM{this}~\SHOWNAME$''.
 | |
| 19263 | 969 | |
| 970 | \item [$\isarkeyword{print_statement}~\vec a$] prints theorems from
 | |
| 971 | the current theory or proof context in long statement form, | |
| 972 |   according to the syntax for $\isarkeyword{lemma}$ given above.
 | |
| 12618 | 973 | |
| 7167 | 974 | \end{descr}
 | 
| 975 | ||
| 13039 | 976 | Any goal statement causes some term abbreviations (such as $\Var{thesis}$) to
 | 
| 977 | be bound automatically, see also \S\ref{sec:term-abbrev}.  Furthermore, the
 | |
| 978 | local context of a (non-atomic) goal is provided via the | |
| 13048 | 979 | $rule_context$\indexisarcase{rule-context} case.
 | 
| 10550 | 980 | |
| 18904 | 981 | The optional case names of $\isarkeyword{obtains}$ have a twofold
 | 
| 982 | meaning: (1) during the of this claim they refer to the the local | |
| 983 | context introductions, (2) the resulting rule is annotated accordingly | |
| 984 | to support symbolic case splits when used with the $cases$ method (cf. | |
| 985 | \S\ref{sec:cases-induct}).
 | |
| 986 | ||
| 10550 | 987 | \medskip | 
| 988 | ||
| 989 | \begin{warn}
 | |
| 990 |   Isabelle/Isar suffers theory-level goal statements to contain \emph{unbound
 | |
| 991 | schematic variables}, although this does not conform to the aim of | |
| 992 | human-readable proof documents! The main problem with schematic goals is | |
| 993 | that the actual outcome is usually hard to predict, depending on the | |
| 13039 | 994 | behavior of the proof methods applied during the course of reasoning. Note | 
| 10550 | 995 | that most semi-automated methods heavily depend on several kinds of implicit | 
| 996 | rule declarations within the current theory context. As this would also | |
| 997 |   result in non-compositional checking of sub-proofs, \emph{local goals} are
 | |
| 12618 | 998 | not allowed to be schematic at all. Nevertheless, schematic goals do have | 
| 999 | their use in Prolog-style interactive synthesis of proven results, usually | |
| 1000 | by stepwise refinement via emulation of traditional Isabelle tactic scripts | |
| 1001 |   (see also \S\ref{sec:tactic-commands}).  In any case, users should know what
 | |
| 1002 | they are doing. | |
| 10550 | 1003 | \end{warn}
 | 
| 8991 | 1004 | |
| 7167 | 1005 | |
| 1006 | \subsection{Initial and terminal proof steps}\label{sec:proof-steps}
 | |
| 1007 | ||
| 7175 | 1008 | \indexisarcmd{proof}\indexisarcmd{qed}\indexisarcmd{by}
 | 
| 1009 | \indexisarcmd{.}\indexisarcmd{..}\indexisarcmd{sorry}
 | |
| 1010 | \begin{matharray}{rcl}
 | |
| 1011 |   \isarcmd{proof} & : & \isartrans{proof(prove)}{proof(state)} \\
 | |
| 1012 |   \isarcmd{qed} & : & \isartrans{proof(state)}{proof(state) ~|~ theory} \\
 | |
| 1013 |   \isarcmd{by} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
 | |
| 1014 |   \isarcmd{.\,.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
 | |
| 1015 |   \isarcmd{.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
 | |
| 1016 |   \isarcmd{sorry} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
 | |
| 1017 | \end{matharray}
 | |
| 1018 | ||
| 8547 | 1019 | Arbitrary goal refinement via tactics is considered harmful. Properly, the | 
| 7335 | 1020 | Isar framework admits proof methods to be invoked in two places only. | 
| 7167 | 1021 | \begin{enumerate}
 | 
| 7175 | 1022 | \item An \emph{initial} refinement step $\PROOF{m@1}$ reduces a newly stated
 | 
| 7335 | 1023 | goal to a number of sub-goals that are to be solved later. Facts are passed | 
| 7895 | 1024 | to $m@1$ for forward chaining, if so indicated by $proof(chain)$ mode. | 
| 7167 | 1025 | |
| 7987 | 1026 | \item A \emph{terminal} conclusion step $\QED{m@2}$ is intended to solve
 | 
| 1027 | remaining goals. No facts are passed to $m@2$. | |
| 7167 | 1028 | \end{enumerate}
 | 
| 1029 | ||
| 13039 | 1030 | The only other (proper) way to affect pending goals in a proof body is by | 
| 12621 | 1031 | $\SHOWNAME$, which involves an explicit statement of what is to be solved | 
| 1032 | eventually. Thus we avoid the fundamental problem of unstructured tactic | |
| 1033 | scripts that consist of numerous consecutive goal transformations, with | |
| 1034 | invisible effects. | |
| 7167 | 1035 | |
| 7175 | 1036 | \medskip | 
| 1037 | ||
| 12621 | 1038 | As a general rule of thumb for good proof style, initial proof methods should | 
| 1039 | either solve the goal completely, or constitute some well-understood reduction | |
| 1040 | to new sub-goals. Arbitrary automatic proof tools that are prone leave a | |
| 1041 | large number of badly structured sub-goals are no help in continuing the proof | |
| 13039 | 1042 | document in an intelligible manner. | 
| 7175 | 1043 | |
| 8547 | 1044 | Unless given explicitly by the user, the default initial method is ``$rule$'', | 
| 1045 | which applies a single standard elimination or introduction rule according to | |
| 1046 | the topmost symbol involved. There is no separate default terminal method. | |
| 1047 | Any remaining goals are always solved by assumption in the very last step. | |
| 7167 | 1048 | |
| 1049 | \begin{rail}
 | |
| 12879 | 1050 | 'proof' method? | 
| 7167 | 1051 | ; | 
| 12879 | 1052 | 'qed' method? | 
| 7167 | 1053 | ; | 
| 12879 | 1054 | 'by' method method? | 
| 7167 | 1055 | ; | 
| 12879 | 1056 |   ('.' | '..' | 'sorry')
 | 
| 7167 | 1057 | ; | 
| 1058 | \end{rail}
 | |
| 1059 | ||
| 1060 | \begin{descr}
 | |
| 13039 | 1061 | |
| 7335 | 1062 | \item [$\PROOF{m@1}$] refines the goal by proof method $m@1$; facts for
 | 
| 1063 | forward chaining are passed if so indicated by $proof(chain)$ mode. | |
| 13039 | 1064 | |
| 7335 | 1065 | \item [$\QED{m@2}$] refines any remaining goals by proof method $m@2$ and
 | 
| 7895 | 1066 | concludes the sub-proof by assumption. If the goal had been $\SHOWNAME$ (or | 
| 1067 | $\THUSNAME$), some pending sub-goal is solved as well by the rule resulting | |
| 1068 |   from the result \emph{exported} into the enclosing goal context.  Thus
 | |
| 1069 | $\QEDNAME$ may fail for two reasons: either $m@2$ fails, or the resulting | |
| 1070 |   rule does not fit to any pending goal\footnote{This includes any additional
 | |
| 1071 | ``strong'' assumptions as introduced by $\ASSUMENAME$.} of the enclosing | |
| 1072 | context. Debugging such a situation might involve temporarily changing | |
| 1073 | $\SHOWNAME$ into $\HAVENAME$, or weakening the local context by replacing | |
| 13039 | 1074 | occurrences of $\ASSUMENAME$ by $\PRESUMENAME$. | 
| 1075 | ||
| 7895 | 1076 | \item [$\BYY{m@1}{m@2}$] is a \emph{terminal proof}\index{proof!terminal}; it
 | 
| 13039 | 1077 |   abbreviates $\PROOF{m@1}~\QED{m@2}$, but with backtracking across both
 | 
| 1078 |   methods.  Debugging an unsuccessful $\BYY{m@1}{m@2}$ commands might be done
 | |
| 1079 |   by expanding its definition; in many cases $\PROOF{m@1}$ (or even
 | |
| 1080 |   $\APPLY{m@1}$) is already sufficient to see the problem.
 | |
| 1081 | ||
| 7895 | 1082 | \item [``$\DDOT$''] is a \emph{default proof}\index{proof!default}; it
 | 
| 8515 | 1083 |   abbreviates $\BY{rule}$.
 | 
| 13039 | 1084 | |
| 7895 | 1085 | \item [``$\DOT$''] is a \emph{trivial proof}\index{proof!trivial}; it
 | 
| 8195 | 1086 |   abbreviates $\BY{this}$.
 | 
| 13039 | 1087 | |
| 12618 | 1088 | \item [$\SORRY$] is a \emph{fake proof}\index{proof!fake} pretending to solve
 | 
| 1089 | the pending claim without further ado. This only works in interactive | |
| 13039 | 1090 |   development, or if the \texttt{quick_and_dirty} flag is enabled.  Facts
 | 
| 1091 | emerging from fake proofs are not the real thing. Internally, each theorem | |
| 1092 | container is tainted by an oracle invocation, which is indicated as | |
| 1093 | ``$[!]$'' in the printed result. | |
| 12618 | 1094 | |
| 1095 | The most important application of $\SORRY$ is to support experimentation and | |
| 13039 | 1096 | top-down proof development. | 
| 8515 | 1097 | \end{descr}
 | 
| 1098 | ||
| 1099 | ||
| 1100 | \subsection{Fundamental methods and attributes}\label{sec:pure-meth-att}
 | |
| 1101 | ||
| 8547 | 1102 | The following proof methods and attributes refer to basic logical operations | 
| 1103 | of Isar. Further methods and attributes are provided by several generic and | |
| 1104 | object-logic specific tools and packages (see chapters \ref{ch:gen-tools} and
 | |
| 12621 | 1105 | \ref{ch:logics}).
 | 
| 8515 | 1106 | |
| 18021 | 1107 | \indexisarmeth{$-$}\indexisarmeth{fact}\indexisarmeth{assumption}
 | 
| 17599 
4da04f70221f
method 'rules' renamed to 'iprover', which does *not* retrieve theorems from the Internet;
 wenzelm parents: 
17397diff
changeset | 1108 | \indexisarmeth{this}\indexisarmeth{rule}\indexisarmeth{iprover}
 | 
| 12621 | 1109 | \indexisarattof{Pure}{intro}\indexisarattof{Pure}{elim}
 | 
| 1110 | \indexisarattof{Pure}{dest}\indexisarattof{Pure}{rule}
 | |
| 14175 
dbd16ebaf907
Method rule_tac understands Isar contexts: documentation.
 ballarin parents: 
13827diff
changeset | 1111 | \indexisaratt{OF}\indexisaratt{of}\indexisaratt{where}
 | 
| 8515 | 1112 | \begin{matharray}{rcl}
 | 
| 13024 | 1113 | - & : & \isarmeth \\ | 
| 18021 | 1114 | fact & : & \isarmeth \\ | 
| 8515 | 1115 | assumption & : & \isarmeth \\ | 
| 1116 | this & : & \isarmeth \\ | |
| 1117 | rule & : & \isarmeth \\ | |
| 17599 
4da04f70221f
method 'rules' renamed to 'iprover', which does *not* retrieve theorems from the Internet;
 wenzelm parents: 
17397diff
changeset | 1118 | iprover & : & \isarmeth \\[0.5ex] | 
| 8515 | 1119 | intro & : & \isaratt \\ | 
| 1120 | elim & : & \isaratt \\ | |
| 1121 | dest & : & \isaratt \\ | |
| 13024 | 1122 | rule & : & \isaratt \\[0.5ex] | 
| 1123 | OF & : & \isaratt \\ | |
| 1124 | of & : & \isaratt \\ | |
| 14175 
dbd16ebaf907
Method rule_tac understands Isar contexts: documentation.
 ballarin parents: 
13827diff
changeset | 1125 | where & : & \isaratt \\ | 
| 8515 | 1126 | \end{matharray}
 | 
| 1127 | ||
| 1128 | \begin{rail}
 | |
| 18021 | 1129 | 'fact' thmrefs? | 
| 1130 | ; | |
| 8547 | 1131 | 'rule' thmrefs? | 
| 8515 | 1132 | ; | 
| 17599 
4da04f70221f
method 'rules' renamed to 'iprover', which does *not* retrieve theorems from the Internet;
 wenzelm parents: 
17397diff
changeset | 1133 |   'iprover' ('!' ?) (rulemod *)
 | 
| 13024 | 1134 | ; | 
| 1135 |   rulemod: ('intro' | 'elim' | 'dest') ((('!' | () | '?') nat?) | 'del') ':' thmrefs
 | |
| 1136 | ; | |
| 1137 |   ('intro' | 'elim' | 'dest') ('!' | () | '?') nat?
 | |
| 1138 | ; | |
| 1139 | 'rule' 'del' | |
| 1140 | ; | |
| 8515 | 1141 | 'OF' thmrefs | 
| 1142 | ; | |
| 8693 | 1143 |   'of' insts ('concl' ':' insts)?
 | 
| 8515 | 1144 | ; | 
| 15686 | 1145 | 'where' ((name | var | typefree | typevar) '=' (type | term) * 'and') | 
| 14175 
dbd16ebaf907
Method rule_tac understands Isar contexts: documentation.
 ballarin parents: 
13827diff
changeset | 1146 | ; | 
| 8515 | 1147 | \end{rail}
 | 
| 1148 | ||
| 1149 | \begin{descr}
 | |
| 13024 | 1150 | |
| 1151 | \item [``$-$''] does nothing but insert the forward chaining facts as premises | |
| 1152 | into the goal. Note that command $\PROOFNAME$ without any method actually | |
| 1153 | performs a single reduction step using the $rule$ method; thus a plain | |
| 13039 | 1154 |   \emph{do-nothing} proof step would be ``$\PROOF{-}$'' rather than
 | 
| 1155 | $\PROOFNAME$ alone. | |
| 13024 | 1156 | |
| 18021 | 1157 | \item [$fact~\vec a$] composes any previous fact from $\vec a$ (or implicitly | 
| 1158 | from the current proof context) modulo matching of schematic type and term | |
| 1159 | variables. The rule structure is not taken into account, i.e.\ meta-level | |
| 1160 | implication is considered atomic. This is the same principle underlying | |
| 1161 |   literal facts (cf.\ \S\ref{sec:syn-att}): ``$\HAVE{}{\phi}~\BY{fact}$'' is
 | |
| 1162 |   equivalent to ``$\NOTE{}{\backquote\phi\backquote}$'' provided that $\edrv
 | |
| 1163 | \phi$ is an instance of some known $\edrv \phi$ in the proof context. | |
| 1164 | ||
| 13039 | 1165 | \item [$assumption$] solves some goal by a single assumption step. All given | 
| 1166 | facts are guaranteed to participate in the refinement; this means there may | |
| 1167 | be only $0$ or $1$ in the first place. Recall that $\QEDNAME$ (see | |
| 1168 |   \S\ref{sec:proof-steps}) already concludes any remaining sub-goals by
 | |
| 1169 | assumption, so structured proofs usually need not quote the $assumption$ | |
| 1170 | method at all. | |
| 13024 | 1171 | |
| 8515 | 1172 | \item [$this$] applies all of the current facts directly as rules. Recall | 
| 13039 | 1173 |   that ``$\DOT$'' (dot) abbreviates ``$\BY{this}$''.
 | 
| 13024 | 1174 | |
| 8547 | 1175 | \item [$rule~\vec a$] applies some rule given as argument in backward manner; | 
| 8515 | 1176 | facts are used to reduce the rule before applying it to the goal. Thus | 
| 13039 | 1177 | $rule$ without facts is plain introduction, while with facts it becomes | 
| 1178 | elimination. | |
| 8515 | 1179 | |
| 8547 | 1180 | When no arguments are given, the $rule$ method tries to pick appropriate | 
| 1181 | rules automatically, as declared in the current context using the $intro$, | |
| 1182 | $elim$, $dest$ attributes (see below). This is the default behavior of | |
| 1183 | $\PROOFNAME$ and ``$\DDOT$'' (double-dot) steps (see | |
| 8515 | 1184 |   \S\ref{sec:proof-steps}).
 | 
| 13024 | 1185 | |
| 17599 
4da04f70221f
method 'rules' renamed to 'iprover', which does *not* retrieve theorems from the Internet;
 wenzelm parents: 
17397diff
changeset | 1186 | \item [$iprover$] performs intuitionistic proof search, depending on | 
| 13024 | 1187 | specifically declared rules from the context, or given as explicit | 
| 1188 | arguments. Chained facts are inserted into the goal before commencing proof | |
| 17599 
4da04f70221f
method 'rules' renamed to 'iprover', which does *not* retrieve theorems from the Internet;
 wenzelm parents: 
17397diff
changeset | 1189 | search; ``$iprover!$'' means to include the current $prems$ as well. | 
| 13024 | 1190 | |
| 1191 | Rules need to be classified as $intro$, $elim$, or $dest$; here the ``$!$'' | |
| 1192 | indicator refers to ``safe'' rules, which may be applied aggressively | |
| 1193 | (without considering back-tracking later). Rules declared with ``$?$'' are | |
| 1194 | ignored in proof search (the single-step $rule$ method still observes | |
| 1195 | these). An explicit weight annotation may be given as well; otherwise the | |
| 13039 | 1196 | number of rule premises will be taken into account here. | 
| 1197 | ||
| 13024 | 1198 | \item [$intro$, $elim$, and $dest$] declare introduction, elimination, and | 
| 17599 
4da04f70221f
method 'rules' renamed to 'iprover', which does *not* retrieve theorems from the Internet;
 wenzelm parents: 
17397diff
changeset | 1199 | destruct rules, to be used with the $rule$ and $iprover$ methods. Note that | 
| 13039 | 1200 | the latter will ignore rules declared with ``$?$'', while ``$!$'' are used | 
| 13024 | 1201 | most aggressively. | 
| 1202 | ||
| 13048 | 1203 |   The classical reasoner (see \S\ref{sec:classical}) introduces its own
 | 
| 13024 | 1204 | variants of these attributes; use qualified names to access the present | 
| 1205 |   versions of Isabelle/Pure, i.e.\ $Pure{\dtt}intro$ or $CPure{\dtt}intro$.
 | |
| 1206 | ||
| 1207 | \item [$rule~del$] undeclares introduction, elimination, or destruct rules. | |
| 1208 | ||
| 8547 | 1209 | \item [$OF~\vec a$] applies some theorem to given rules $\vec a$ (in | 
| 1210 |   parallel).  This corresponds to the \texttt{MRS} operator in ML
 | |
| 1211 |   \cite[\S5]{isabelle-ref}, but note the reversed order.  Positions may be
 | |
| 13039 | 1212 | effectively skipped by including ``$\_$'' (underscore) as argument. | 
| 13024 | 1213 | |
| 15686 | 1214 | \item [$of~\vec t$] performs positional instantiation of term variables. The | 
| 1215 | terms $\vec t$ are substituted for any schematic variables occurring in a | |
| 1216 |   theorem from left to right; ``\texttt{_}'' (underscore) indicates to skip a
 | |
| 1217 | position. Arguments following a ``$concl\colon$'' specification refer to | |
| 1218 | positions of the conclusion of a rule. | |
| 13024 | 1219 | |
| 15686 | 1220 | \item [$where~\vec x = \vec t$] performs named instantiation of schematic type | 
| 1221 | and term variables occurring in a theorem. Schematic variables have to be | |
| 1222 | specified on the left-hand side (e.g.\ $?x1\!.\!3$). The question mark may | |
| 1223 | be omitted if the variable name is a plain identifier without index. As | |
| 1224 | type instantiations are inferred from term instantiations, explicit type | |
| 1225 | instantiations are seldom necessary. | |
| 14175 
dbd16ebaf907
Method rule_tac understands Isar contexts: documentation.
 ballarin parents: 
13827diff
changeset | 1226 | |
| 7315 | 1227 | \end{descr}
 | 
| 1228 | ||
| 1229 | ||
| 1230 | \subsection{Term abbreviations}\label{sec:term-abbrev}
 | |
| 1231 | ||
| 1232 | \indexisarcmd{let}
 | |
| 1233 | \begin{matharray}{rcl}
 | |
| 1234 |   \isarcmd{let} & : & \isartrans{proof(state)}{proof(state)} \\
 | |
| 1235 |   \isarkeyword{is} & : & syntax \\
 | |
| 1236 | \end{matharray}
 | |
| 1237 | ||
| 1238 | Abbreviations may be either bound by explicit $\LET{p \equiv t}$ statements,
 | |
| 7987 | 1239 | or by annotating assumptions or goal statements with a list of patterns | 
| 13039 | 1240 | ``$\ISS{p@1\;\dots}{p@n}$''.  In both cases, higher-order matching is invoked
 | 
| 1241 | to bind extra-logical term variables, which may be either named schematic | |
| 7987 | 1242 | variables of the form $\Var{x}$, or nameless dummies ``\texttt{_}''
 | 
| 1243 | (underscore).\indexisarvar{_@\texttt{_}} Note that in the $\LETNAME$ form the
 | |
| 1244 | patterns occur on the left-hand side, while the $\ISNAME$ patterns are in | |
| 1245 | postfix position. | |
| 7315 | 1246 | |
| 12621 | 1247 | Polymorphism of term bindings is handled in Hindley-Milner style, similar to | 
| 1248 | ML. Type variables referring to local assumptions or open goal statements are | |
| 8620 
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
 wenzelm parents: 
8547diff
changeset | 1249 | \emph{fixed}, while those of finished results or bound by $\LETNAME$ may occur
 | 
| 
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
 wenzelm parents: 
8547diff
changeset | 1250 | in \emph{arbitrary} instances later.  Even though actual polymorphism should
 | 
| 
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
 wenzelm parents: 
8547diff
changeset | 1251 | be rarely used in practice, this mechanism is essential to achieve proper | 
| 
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
 wenzelm parents: 
8547diff
changeset | 1252 | incremental type-inference, as the user proceeds to build up the Isar proof | 
| 13039 | 1253 | text from left to right. | 
| 8620 
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
 wenzelm parents: 
8547diff
changeset | 1254 | |
| 
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
 wenzelm parents: 
8547diff
changeset | 1255 | \medskip | 
| 
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
 wenzelm parents: 
8547diff
changeset | 1256 | |
| 13039 | 1257 | Term abbreviations are quite different from local definitions as introduced | 
| 1258 | via $\DEFNAME$ (see \S\ref{sec:proof-context}).  The latter are visible within
 | |
| 1259 | the logic as actual equations, while abbreviations disappear during the input | |
| 1260 | process just after type checking. Also note that $\DEFNAME$ does not support | |
| 1261 | polymorphism. | |
| 7315 | 1262 | |
| 1263 | \begin{rail}
 | |
| 12879 | 1264 | 'let' ((term + 'and') '=' term + 'and') | 
| 7315 | 1265 | ; | 
| 1266 | \end{rail}
 | |
| 1267 | ||
| 1268 | The syntax of $\ISNAME$ patterns follows \railnonterm{termpat} or
 | |
| 12618 | 1269 | \railnonterm{proppat} (see \S\ref{sec:term-decls}).
 | 
| 7315 | 1270 | |
| 1271 | \begin{descr}
 | |
| 1272 | \item [$\LET{\vec p = \vec t}$] binds any text variables in patters $\vec p$
 | |
| 1273 | by simultaneous higher-order matching against terms $\vec t$. | |
| 1274 | \item [$\IS{\vec p}$] resembles $\LETNAME$, but matches $\vec p$ against the
 | |
| 1275 | preceding statement. Also note that $\ISNAME$ is not a separate command, | |
| 1276 | but part of others (such as $\ASSUMENAME$, $\HAVENAME$ etc.). | |
| 1277 | \end{descr}
 | |
| 1278 | ||
| 10160 | 1279 | Some \emph{automatic} term abbreviations\index{term abbreviations} for goals
 | 
| 7988 | 1280 | and facts are available as well. For any open goal, | 
| 10160 | 1281 | $\Var{thesis}$\indexisarvar{thesis} refers to its object-level statement,
 | 
| 1282 | abstracted over any meta-level parameters (if present). Likewise, | |
| 1283 | $\Var{this}$\indexisarvar{this} is bound for fact statements resulting from
 | |
| 1284 | assumptions or finished goals.  In case $\Var{this}$ refers to an object-logic
 | |
| 1285 | statement that is an application $f(t)$, then $t$ is bound to the special text | |
| 1286 | variable ``$\dots$''\indexisarvar{\dots} (three dots).  The canonical
 | |
| 1287 | application of the latter are calculational proofs (see | |
| 1288 | \S\ref{sec:calculation}).
 | |
| 1289 | ||
| 7315 | 1290 | |
| 7134 | 1291 | \subsection{Block structure}
 | 
| 1292 | ||
| 8896 | 1293 | \indexisarcmd{next}\indexisarcmd{\{}\indexisarcmd{\}}
 | 
| 7397 | 1294 | \begin{matharray}{rcl}
 | 
| 8448 | 1295 |   \NEXT & : & \isartrans{proof(state)}{proof(state)} \\
 | 
| 7974 | 1296 |   \BG & : & \isartrans{proof(state)}{proof(state)} \\
 | 
| 1297 |   \EN & : & \isartrans{proof(state)}{proof(state)} \\
 | |
| 7397 | 1298 | \end{matharray}
 | 
| 1299 | ||
| 7167 | 1300 | While Isar is inherently block-structured, opening and closing blocks is | 
| 1301 | mostly handled rather casually, with little explicit user-intervention. Any | |
| 1302 | local goal statement automatically opens \emph{two} blocks, which are closed
 | |
| 1303 | again when concluding the sub-proof (by $\QEDNAME$ etc.). Sections of | |
| 8448 | 1304 | different context within a sub-proof may be switched via $\NEXT$, which is | 
| 13039 | 1305 | just a single block-close followed by block-open again. The effect of $\NEXT$ | 
| 1306 | is to reset the local proof context; there is no goal focus involved here! | |
| 7167 | 1307 | |
| 7175 | 1308 | For slightly more advanced applications, there are explicit block parentheses | 
| 7895 | 1309 | as well. These typically achieve a stronger forward style of reasoning. | 
| 7167 | 1310 | |
| 1311 | \begin{descr}
 | |
| 8448 | 1312 | \item [$\NEXT$] switches to a fresh block within a sub-proof, resetting the | 
| 1313 | local context to the initial one. | |
| 8896 | 1314 | \item [$\BG$ and $\EN$] explicitly open and close blocks. Any current facts | 
| 1315 | pass through ``$\BG$'' unchanged, while ``$\EN$'' causes any result to be | |
| 7895 | 1316 |   \emph{exported} into the enclosing context.  Thus fixed variables are
 | 
| 1317 | generalized, assumptions discharged, and local definitions unfolded (cf.\ | |
| 1318 |   \S\ref{sec:proof-context}).  There is no difference of $\ASSUMENAME$ and
 | |
| 1319 | $\PRESUMENAME$ in this mode of forward reasoning --- in contrast to plain | |
| 1320 | backward reasoning with the result exported at $\SHOWNAME$ time. | |
| 7167 | 1321 | \end{descr}
 | 
| 7134 | 1322 | |
| 1323 | ||
| 9605 | 1324 | \subsection{Emulating tactic scripts}\label{sec:tactic-commands}
 | 
| 8515 | 1325 | |
| 9605 | 1326 | The Isar provides separate commands to accommodate tactic-style proof scripts | 
| 1327 | within the same system. While being outside the orthodox Isar proof language, | |
| 1328 | these might come in handy for interactive exploration and debugging, or even | |
| 1329 | actual tactical proof within new-style theories (to benefit from document | |
| 1330 | preparation, for example).  See also \S\ref{sec:tactics} for actual tactics,
 | |
| 1331 | that have been encapsulated as proof methods. Proper proof methods may be | |
| 1332 | used in scripts, too. | |
| 8515 | 1333 | |
| 9605 | 1334 | \indexisarcmd{apply}\indexisarcmd{apply-end}\indexisarcmd{done}
 | 
| 8515 | 1335 | \indexisarcmd{defer}\indexisarcmd{prefer}\indexisarcmd{back}
 | 
| 9605 | 1336 | \indexisarcmd{declare}
 | 
| 8515 | 1337 | \begin{matharray}{rcl}
 | 
| 8533 | 1338 |   \isarcmd{apply}^* & : & \isartrans{proof(prove)}{proof(prove)} \\
 | 
| 9605 | 1339 |   \isarcmd{apply_end}^* & : & \isartrans{proof(state)}{proof(state)} \\
 | 
| 8946 | 1340 |   \isarcmd{done}^* & : & \isartrans{proof(prove)}{proof(state)} \\
 | 
| 8533 | 1341 |   \isarcmd{defer}^* & : & \isartrans{proof}{proof} \\
 | 
| 1342 |   \isarcmd{prefer}^* & : & \isartrans{proof}{proof} \\
 | |
| 1343 |   \isarcmd{back}^* & : & \isartrans{proof}{proof} \\
 | |
| 9605 | 1344 |   \isarcmd{declare}^* & : & \isartrans{theory}{theory} \\
 | 
| 8515 | 1345 | \end{matharray}
 | 
| 1346 | ||
| 1347 | \railalias{applyend}{apply\_end}
 | |
| 1348 | \railterm{applyend}
 | |
| 1349 | ||
| 1350 | \begin{rail}
 | |
| 12879 | 1351 | ( 'apply' | applyend ) method | 
| 8515 | 1352 | ; | 
| 12879 | 1353 | 'defer' nat? | 
| 8515 | 1354 | ; | 
| 12879 | 1355 | 'prefer' nat | 
| 8515 | 1356 | ; | 
| 12976 | 1357 | 'declare' locale? (thmrefs + 'and') | 
| 9605 | 1358 | ; | 
| 8515 | 1359 | \end{rail}
 | 
| 1360 | ||
| 1361 | \begin{descr}
 | |
| 13042 | 1362 | |
| 10223 | 1363 | \item [$\APPLY{m}$] applies proof method $m$ in initial position, but unlike
 | 
| 1364 | $\PROOFNAME$ it retains ``$proof(prove)$'' mode. Thus consecutive method | |
| 1365 | applications may be given just as in tactic scripts. | |
| 8515 | 1366 | |
| 8881 | 1367 | Facts are passed to $m$ as indicated by the goal's forward-chain mode, and | 
| 10223 | 1368 |   are \emph{consumed} afterwards.  Thus any further $\APPLYNAME$ command would
 | 
| 1369 | always work in a purely backward manner. | |
| 8946 | 1370 | |
| 8515 | 1371 | \item [$\isarkeyword{apply_end}~(m)$] applies proof method $m$ as if in
 | 
| 1372 | terminal position. Basically, this simulates a multi-step tactic script for | |
| 1373 | $\QEDNAME$, but may be given anywhere within the proof body. | |
| 1374 | ||
| 1375 | No facts are passed to $m$. Furthermore, the static context is that of the | |
| 1376 | enclosing goal (as for actual $\QEDNAME$). Thus the proof method may not | |
| 1377 | refer to any assumptions introduced in the current body, for example. | |
| 13039 | 1378 | |
| 9605 | 1379 | \item [$\isarkeyword{done}$] completes a proof script, provided that the
 | 
| 13039 | 1380 | current goal state is solved completely. Note that actual structured proof | 
| 1381 | commands (e.g.\ ``$\DOT$'' or $\SORRY$) may be used to conclude proof | |
| 1382 | scripts as well. | |
| 9605 | 1383 | |
| 8515 | 1384 | \item [$\isarkeyword{defer}~n$ and $\isarkeyword{prefer}~n$] shuffle the list
 | 
| 1385 | of pending goals: $defer$ puts off goal $n$ to the end of the list ($n = 1$ | |
| 1386 | by default), while $prefer$ brings goal $n$ to the top. | |
| 13039 | 1387 | |
| 8515 | 1388 | \item [$\isarkeyword{back}$] does back-tracking over the result sequence of
 | 
| 13039 | 1389 | the latest proof command. Basically, any proof command may return multiple | 
| 1390 | results. | |
| 9605 | 1391 | |
| 1392 | \item [$\isarkeyword{declare}~thms$] declares theorems to the current theory
 | |
| 12976 | 1393 |   context (or the specified locale, see also \S\ref{sec:locale}).  No theorem
 | 
| 1394 |   binding is involved here, unlike $\isarkeyword{theorems}$ or
 | |
| 1395 |   $\isarkeyword{lemmas}$ (cf.\ \S\ref{sec:axms-thms}), so
 | |
| 1396 |   $\isarkeyword{declare}$ only has the effect of applying attributes as
 | |
| 1397 | included in the theorem specification. | |
| 13042 | 1398 | |
| 9006 | 1399 | \end{descr}
 | 
| 1400 | ||
| 1401 | Any proper Isar proof method may be used with tactic script commands such as | |
| 10223 | 1402 | $\APPLYNAME$. A few additional emulations of actual tactics are provided as | 
| 1403 | well; these would be never used in actual structured proofs, of course. | |
| 9006 | 1404 | |
| 8515 | 1405 | |
| 1406 | \subsection{Meta-linguistic features}
 | |
| 1407 | ||
| 1408 | \indexisarcmd{oops}
 | |
| 1409 | \begin{matharray}{rcl}
 | |
| 1410 |   \isarcmd{oops} & : & \isartrans{proof}{theory} \\
 | |
| 1411 | \end{matharray}
 | |
| 1412 | ||
| 1413 | The $\OOPS$ command discontinues the current proof attempt, while considering | |
| 1414 | the partial proof text as properly processed. This is conceptually quite | |
| 1415 | different from ``faking'' actual proofs via $\SORRY$ (see | |
| 1416 | \S\ref{sec:proof-steps}): $\OOPS$ does not observe the proof structure at all,
 | |
| 1417 | but goes back right to the theory level. Furthermore, $\OOPS$ does not | |
| 13039 | 1418 | produce any result theorem --- there is no intended claim to be able to | 
| 1419 | complete the proof anyhow. | |
| 8515 | 1420 | |
| 1421 | A typical application of $\OOPS$ is to explain Isar proofs \emph{within} the
 | |
| 1422 | system itself, in conjunction with the document preparation tools of Isabelle | |
| 1423 | described in \cite{isabelle-sys}.  Thus partial or even wrong proof attempts
 | |
| 1424 | can be discussed in a logically sound manner.  Note that the Isabelle {\LaTeX}
 | |
| 1425 | macros can be easily adapted to print something like ``$\dots$'' instead of an | |
| 1426 | ``$\OOPS$'' keyword. | |
| 1427 | ||
| 12618 | 1428 | \medskip The $\OOPS$ command is undo-able, unlike $\isarkeyword{kill}$ (see
 | 
| 13039 | 1429 | \S\ref{sec:history}).  The effect is to get back to the theory just before the
 | 
| 1430 | opening of the proof. | |
| 8515 | 1431 | |
| 1432 | ||
| 7134 | 1433 | \section{Other commands}
 | 
| 1434 | ||
| 9605 | 1435 | \subsection{Diagnostics}
 | 
| 7134 | 1436 | |
| 10858 | 1437 | \indexisarcmd{pr}\indexisarcmd{thm}\indexisarcmd{term}
 | 
| 1438 | \indexisarcmd{prop}\indexisarcmd{typ}
 | |
| 7134 | 1439 | \begin{matharray}{rcl}
 | 
| 8515 | 1440 |   \isarcmd{pr}^* & : & \isarkeep{\cdot} \\
 | 
| 1441 |   \isarcmd{thm}^* & : & \isarkeep{theory~|~proof} \\
 | |
| 1442 |   \isarcmd{term}^* & : & \isarkeep{theory~|~proof} \\
 | |
| 1443 |   \isarcmd{prop}^* & : & \isarkeep{theory~|~proof} \\
 | |
| 1444 |   \isarcmd{typ}^* & : & \isarkeep{theory~|~proof} \\
 | |
| 13827 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1445 |   \isarcmd{prf}^* & : & \isarkeep{theory~|~proof} \\
 | 
| 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1446 |   \isarcmd{full_prf}^* & : & \isarkeep{theory~|~proof} \\
 | 
| 7134 | 1447 | \end{matharray}
 | 
| 1448 | ||
| 9605 | 1449 | These diagnostic commands assist interactive development. Note that $undo$ | 
| 1450 | does not apply here, the theory or proof configuration is not changed. | |
| 7335 | 1451 | |
| 7134 | 1452 | \begin{rail}
 | 
| 9727 | 1453 |   'pr' modes? nat? (',' nat)?
 | 
| 7134 | 1454 | ; | 
| 12879 | 1455 | 'thm' modes? thmrefs | 
| 8485 | 1456 | ; | 
| 12879 | 1457 | 'term' modes? term | 
| 7134 | 1458 | ; | 
| 12879 | 1459 | 'prop' modes? prop | 
| 7134 | 1460 | ; | 
| 12879 | 1461 | 'typ' modes? type | 
| 8485 | 1462 | ; | 
| 13827 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1463 | 'prf' modes? thmrefs? | 
| 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1464 | ; | 
| 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1465 | 'full\_prf' modes? thmrefs? | 
| 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1466 | ; | 
| 8485 | 1467 | |
| 1468 |   modes: '(' (name + ) ')'
 | |
| 7134 | 1469 | ; | 
| 1470 | \end{rail}
 | |
| 1471 | ||
| 7167 | 1472 | \begin{descr}
 | 
| 9727 | 1473 | \item [$\isarkeyword{pr}~goals, prems$] prints the current proof state (if
 | 
| 1474 | present), including the proof context, current facts and goals. The | |
| 1475 | optional limit arguments affect the number of goals and premises to be | |
| 1476 | displayed, which is initially 10 for both. Omitting limit values leaves the | |
| 1477 | current setting unchanged. | |
| 8547 | 1478 | \item [$\isarkeyword{thm}~\vec a$] retrieves theorems from the current theory
 | 
| 1479 | or proof context. Note that any attributes included in the theorem | |
| 7974 | 1480 | specifications are applied to a temporary context derived from the current | 
| 8547 | 1481 | theory or proof; the result is discarded, i.e.\ attributes involved in $\vec | 
| 1482 | a$ do not have any permanent effect. | |
| 9727 | 1483 | \item [$\isarkeyword{term}~t$ and $\isarkeyword{prop}~\phi$] read, type-check
 | 
| 1484 | and print terms or propositions according to the current theory or proof | |
| 7895 | 1485 | context; the inferred type of $t$ is output as well. Note that these | 
| 1486 | commands are also useful in inspecting the current environment of term | |
| 1487 | abbreviations. | |
| 7974 | 1488 | \item [$\isarkeyword{typ}~\tau$] reads and prints types of the meta-logic
 | 
| 1489 | according to the current theory or proof context. | |
| 13827 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1490 | \item [$\isarkeyword{prf}$] displays the (compact) proof term of the current
 | 
| 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1491 | proof state (if present), or of the given theorems. Note that this | 
| 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1492 | requires proof terms to be switched on for the current object logic | 
| 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1493 | (see the ``Proof terms'' section of the Isabelle reference manual | 
| 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1494 | for information on how to do this). | 
| 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1495 | \item [$\isarkeyword{full_prf}$] is like $\isarkeyword{prf}$, but displays
 | 
| 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1496 | the full proof term, i.e.\ also displays information omitted in | 
| 
c690cb885db4
Documented prf / full_prf commands and antiquotations.
 berghofe parents: 
13542diff
changeset | 1497 | the compact proof term, which is denoted by ``$_$'' placeholders there. | 
| 9605 | 1498 | \end{descr}
 | 
| 1499 | ||
| 1500 | All of the diagnostic commands above admit a list of $modes$ to be specified, | |
| 1501 | which is appended to the current print mode (see also \cite{isabelle-ref}).
 | |
| 1502 | Thus the output behavior may be modified according particular print mode | |
| 1503 | features.  For example, $\isarkeyword{pr}~(latex~xsymbols~symbols)$ would
 | |
| 1504 | print the current proof state with mathematical symbols and special characters | |
| 1505 | represented in {\LaTeX} source, according to the Isabelle style
 | |
| 1506 | \cite{isabelle-sys}.
 | |
| 1507 | ||
| 1508 | Note that antiquotations (cf.\ \S\ref{sec:antiq}) provide a more systematic
 | |
| 1509 | way to include formal items into the printed text document. | |
| 1510 | ||
| 1511 | ||
| 1512 | \subsection{Inspecting the context}
 | |
| 1513 | ||
| 1514 | \indexisarcmd{print-facts}\indexisarcmd{print-binds}
 | |
| 1515 | \indexisarcmd{print-commands}\indexisarcmd{print-syntax}
 | |
| 1516 | \indexisarcmd{print-methods}\indexisarcmd{print-attributes}
 | |
| 17755 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1517 | \indexisarcmd{find-theorems}\indexisarcmd{thm-deps}
 | 
| 10858 | 1518 | \indexisarcmd{print-theorems}
 | 
| 9605 | 1519 | \begin{matharray}{rcl}
 | 
| 1520 |   \isarcmd{print_commands}^* & : & \isarkeep{\cdot} \\
 | |
| 1521 |   \isarcmd{print_syntax}^* & : & \isarkeep{theory~|~proof} \\
 | |
| 1522 |   \isarcmd{print_methods}^* & : & \isarkeep{theory~|~proof} \\
 | |
| 1523 |   \isarcmd{print_attributes}^* & : & \isarkeep{theory~|~proof} \\
 | |
| 10858 | 1524 |   \isarcmd{print_theorems}^* & : & \isarkeep{theory~|~proof} \\
 | 
| 17755 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1525 |   \isarcmd{find_theorems}^* & : & \isarkeep{theory~|~proof} \\
 | 
| 10858 | 1526 |   \isarcmd{thms_deps}^* & : & \isarkeep{theory~|~proof} \\
 | 
| 9605 | 1527 |   \isarcmd{print_facts}^* & : & \isarkeep{proof} \\
 | 
| 1528 |   \isarcmd{print_binds}^* & : & \isarkeep{proof} \\
 | |
| 1529 | \end{matharray}
 | |
| 1530 | ||
| 10858 | 1531 | \begin{rail}
 | 
| 17755 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1532 |   'find\_theorems' (('(' nat ')')?) (criterion *)
 | 
| 15996 
3699351b8939
documented new thms_containing ('rewrites' still missing)
 kleing parents: 
15744diff
changeset | 1533 | ; | 
| 16017 | 1534 |   criterion: ('-'?) ('name' ':' nameref | 'intro' | 'elim' | 'dest' |
 | 
| 16074 | 1535 | 'simp' ':' term | term) | 
| 10858 | 1536 | ; | 
| 17755 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1537 | 'thm\_deps' thmrefs | 
| 10858 | 1538 | ; | 
| 1539 | \end{rail}
 | |
| 1540 | ||
| 1541 | These commands print certain parts of the theory and proof context. Note that | |
| 1542 | there are some further ones available, such as for the set of rules declared | |
| 1543 | for simplifications. | |
| 9605 | 1544 | |
| 1545 | \begin{descr}
 | |
| 13039 | 1546 | |
| 9605 | 1547 | \item [$\isarkeyword{print_commands}$] prints Isabelle's outer theory syntax,
 | 
| 1548 | including keywords and command. | |
| 13039 | 1549 | |
| 9605 | 1550 | \item [$\isarkeyword{print_syntax}$] prints the inner syntax of types and
 | 
| 1551 | terms, depending on the current context. The output can be very verbose, | |
| 1552 | including grammar tables and syntax translation rules. See \cite[\S7, | |
| 1553 |   \S8]{isabelle-ref} for further information on Isabelle's inner syntax.
 | |
| 13039 | 1554 | |
| 10858 | 1555 | \item [$\isarkeyword{print_methods}$] prints all proof methods available in
 | 
| 1556 | the current theory context. | |
| 13039 | 1557 | |
| 10858 | 1558 | \item [$\isarkeyword{print_attributes}$] prints all attributes available in
 | 
| 1559 | the current theory context. | |
| 13039 | 1560 | |
| 10858 | 1561 | \item [$\isarkeyword{print_theorems}$] prints theorems available in the
 | 
| 13039 | 1562 | current theory context. | 
| 1563 | ||
| 1564 | In interactive mode this actually refers to the theorems left by the last | |
| 1565 | transaction; this allows to inspect the result of advanced definitional | |
| 1566 |   packages, such as $\isarkeyword{datatype}$.
 | |
| 1567 | ||
| 17755 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1568 | \item [$\isarkeyword{find_theorems}~\vec c$] retrieves facts from the theory
 | 
| 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1569 | or proof context matching all of the search criteria $\vec c$. The | 
| 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1570 | criterion $name: p$ selects all theorems whose fully qualified name matches | 
| 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1571 | pattern $p$, which may contain ``$*$'' wildcards. The criteria $intro$, | 
| 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1572 | $elim$, and $dest$ select theorems that match the current goal as | 
| 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1573 | introduction, elimination or destruction rules, respectively. The criterion | 
| 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1574 | $simp: t$ selects all rewrite rules whose left-hand side matches the given | 
| 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1575 | term. The criterion term $t$ selects all theorems that contain the pattern | 
| 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1576 | $t$ -- as usual, patterns may contain occurrences of the dummy ``$\_$'', | 
| 
b0cd55afead1
find_theorems: support * wildcard in name: criterion;
 wenzelm parents: 
17599diff
changeset | 1577 | schematic variables, and type constraints. | 
| 16017 | 1578 | |
| 1579 |   Criteria can be preceded by ``$-$'' to select theorems that do \emph{not}
 | |
| 1580 |   match. Note that giving the empty list of criteria yields \emph{all}
 | |
| 1581 | currently known facts. An optional limit for the number of printed facts | |
| 1582 | may be given; the default is 40. | |
| 13039 | 1583 | |
| 12618 | 1584 | \item [$\isarkeyword{thm_deps}~\vec a$] visualizes dependencies of facts,
 | 
| 1585 |   using Isabelle's graph browser tool (see also \cite{isabelle-sys}).
 | |
| 13039 | 1586 | |
| 20009 | 1587 | \item [$\isarkeyword{print_facts}$] prints all local facts of the
 | 
| 1588 | current context, both named and unnamed ones. | |
| 13039 | 1589 | |
| 8379 | 1590 | \item [$\isarkeyword{print_binds}$] prints all term abbreviations present in
 | 
| 1591 | the context. | |
| 13039 | 1592 | |
| 8485 | 1593 | \end{descr}
 | 
| 1594 | ||
| 1595 | ||
| 1596 | \subsection{History commands}\label{sec:history}
 | |
| 1597 | ||
| 1598 | \indexisarcmd{undo}\indexisarcmd{redo}\indexisarcmd{kill}
 | |
| 1599 | \begin{matharray}{rcl}
 | |
| 1600 |   \isarcmd{undo}^{{*}{*}} & : & \isarkeep{\cdot} \\
 | |
| 1601 |   \isarcmd{redo}^{{*}{*}} & : & \isarkeep{\cdot} \\
 | |
| 1602 |   \isarcmd{kill}^{{*}{*}} & : & \isarkeep{\cdot} \\
 | |
| 1603 | \end{matharray}
 | |
| 1604 | ||
| 1605 | The Isabelle/Isar top-level maintains a two-stage history, for theory and | |
| 1606 | proof state transformation. Basically, any command can be undone using | |
| 1607 | $\isarkeyword{undo}$, excluding mere diagnostic elements.  Its effect may be
 | |
| 10858 | 1608 | revoked via $\isarkeyword{redo}$, unless the corresponding
 | 
| 8485 | 1609 | $\isarkeyword{undo}$ step has crossed the beginning of a proof or theory.  The
 | 
| 1610 | $\isarkeyword{kill}$ command aborts the current history node altogether,
 | |
| 1611 | discontinuing a proof or even the whole theory.  This operation is \emph{not}
 | |
| 12618 | 1612 | undo-able. | 
| 8485 | 1613 | |
| 1614 | \begin{warn}
 | |
| 8547 | 1615 | History commands should never be used with user interfaces such as | 
| 1616 |   Proof~General \cite{proofgeneral,Aspinall:TACAS:2000}, which takes care of
 | |
| 1617 |   stepping forth and back itself.  Interfering by manual $\isarkeyword{undo}$,
 | |
| 8510 | 1618 |   $\isarkeyword{redo}$, or even $\isarkeyword{kill}$ commands would quickly
 | 
| 1619 | result in utter confusion. | |
| 8485 | 1620 | \end{warn}
 | 
| 1621 | ||
| 8379 | 1622 | |
| 7134 | 1623 | \subsection{System operations}
 | 
| 1624 | ||
| 7167 | 1625 | \indexisarcmd{cd}\indexisarcmd{pwd}\indexisarcmd{use-thy}\indexisarcmd{use-thy-only}
 | 
| 14934 | 1626 | \indexisarcmd{update-thy}\indexisarcmd{update-thy-only}\indexisarcmd{display-drafts}
 | 
| 1627 | \indexisarcmd{print-drafts}
 | |
| 7134 | 1628 | \begin{matharray}{rcl}
 | 
| 8515 | 1629 |   \isarcmd{cd}^* & : & \isarkeep{\cdot} \\
 | 
| 1630 |   \isarcmd{pwd}^* & : & \isarkeep{\cdot} \\
 | |
| 1631 |   \isarcmd{use_thy}^* & : & \isarkeep{\cdot} \\
 | |
| 1632 |   \isarcmd{use_thy_only}^* & : & \isarkeep{\cdot} \\
 | |
| 1633 |   \isarcmd{update_thy}^* & : & \isarkeep{\cdot} \\
 | |
| 1634 |   \isarcmd{update_thy_only}^* & : & \isarkeep{\cdot} \\
 | |
| 14934 | 1635 |   \isarcmd{display_drafts}^* & : & \isarkeep{\cdot} \\
 | 
| 1636 |   \isarcmd{print_drafts}^* & : & \isarkeep{\cdot} \\
 | |
| 7134 | 1637 | \end{matharray}
 | 
| 1638 | ||
| 14955 | 1639 | \railalias{usethy}{use\_thy}
 | 
| 1640 | \railterm{usethy}
 | |
| 1641 | \railalias{usethyonly}{use\_thy\_only}
 | |
| 1642 | \railterm{usethyonly}
 | |
| 1643 | \railalias{updatethy}{update\_thy}
 | |
| 1644 | \railterm{updatethy}
 | |
| 1645 | \railalias{updatethyonly}{update\_thy\_only}
 | |
| 1646 | \railterm{updatethyonly}
 | |
| 1647 | \railalias{displaydrafts}{display\_drafts}
 | |
| 1648 | \railterm{displaydrafts}
 | |
| 1649 | \railalias{printdrafts}{print\_drafts}
 | |
| 1650 | \railterm{printdrafts}
 | |
| 1651 | ||
| 1652 | \begin{rail}
 | |
| 1653 |   ('cd' | usethy | usethyonly | updatethy | updatethyonly) name
 | |
| 1654 | ; | |
| 1655 | (displaydrafts | printdrafts) (name +) | |
| 1656 | ; | |
| 1657 | \end{rail}
 | |
| 1658 | ||
| 7167 | 1659 | \begin{descr}
 | 
| 14955 | 1660 | \item [$\isarkeyword{cd}~path$] changes the current directory of the Isabelle
 | 
| 7134 | 1661 | process. | 
| 1662 | \item [$\isarkeyword{pwd}~$] prints the current working directory.
 | |
| 7175 | 1663 | \item [$\isarkeyword{use_thy}$, $\isarkeyword{use_thy_only}$,
 | 
| 7987 | 1664 |   $\isarkeyword{update_thy}$, $\isarkeyword{update_thy_only}$] load some
 | 
| 7895 | 1665 | theory given as $name$ argument. These commands are basically the same as | 
| 7987 | 1666 |   the corresponding ML functions\footnote{The ML versions also change the
 | 
| 1667 | implicit theory context to that of the theory loaded.} (see also | |
| 1668 |   \cite[\S1,\S6]{isabelle-ref}).  Note that both the ML and Isar versions may
 | |
| 1669 | load new- and old-style theories alike. | |
| 14955 | 1670 | \item [$\isarkeyword{display_drafts}~paths$ and
 | 
| 1671 |   $\isarkeyword{print_drafts}~paths$] perform simple output of a given list of
 | |
| 1672 | raw source files. Only those symbols that do not require additional | |
| 1673 |   {\LaTeX} packages are displayed properly, everything else is left verbatim.
 | |
| 7167 | 1674 | \end{descr}
 | 
| 7134 | 1675 | |
| 7987 | 1676 | These system commands are scarcely used when working with the Proof~General | 
| 13039 | 1677 | interface, since loading of theories is done transparently. | 
| 8379 | 1678 | |
| 7046 | 1679 | %%% Local Variables: | 
| 1680 | %%% mode: latex | |
| 1681 | %%% TeX-master: "isar-ref" | |
| 1682 | %%% End: |