| author | wenzelm |
| Sun, 25 Jun 2000 23:52:15 +0200 | |
| changeset 9130 | ff8789b49d2e |
| parent 9030 | bb7622789bf2 |
| child 9199 | 7a1a856f0571 |
| permissions | -rw-r--r-- |
| 7046 | 1 |
|
| 7895 | 2 |
\chapter{Basic Isar Language Elements}\label{ch:pure-syntax}
|
| 7167 | 3 |
|
| 8515 | 4 |
Subsequently, we introduce the main part of Pure Isar theory and proof |
| 8547 | 5 |
commands, 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 |
|
8 |
Isabelle or pre-installed by most object logics. Chapter~\ref{ch:hol-tools}
|
|
9 |
refers to actual object-logic specific elements of Isabelle/HOL. |
|
| 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 |
|
16 |
are subsequently marked by $^*$, are often helpful when developing proof |
|
| 7981 | 17 |
documents, while their use is discouraged for the final outcome. Typical |
18 |
examples are diagnostic commands that print terms or theorems according to the |
|
19 |
current context; other commands even emulate old-style tactical theorem |
|
| 8547 | 20 |
proving. |
| 7167 | 21 |
|
| 7134 | 22 |
|
23 |
\section{Theory commands}
|
|
24 |
||
| 7167 | 25 |
\subsection{Defining theories}\label{sec:begin-thy}
|
| 7134 | 26 |
|
| 7895 | 27 |
\indexisarcmd{header}\indexisarcmd{theory}\indexisarcmd{end}\indexisarcmd{context}
|
| 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 |
|
| 7895 | 41 |
The first actual command of any theory has to be $\THEORY$, starting a new |
42 |
theory based on the merge of existing ones. Just preceding $\THEORY$, there |
|
43 |
may be an optional $\isarkeyword{header}$ declaration, which is relevant to
|
|
44 |
document preparation only; it acts very much like a special pre-theory markup |
|
45 |
command (cf.\ \S\ref{sec:markup-thy} and \S\ref{sec:markup-thy}). The theory
|
|
46 |
context may be also changed by $\CONTEXT$ without creating a new theory. In |
|
47 |
both cases, $\END$ concludes the theory development; it has to be the very |
|
| 8547 | 48 |
last command of any theory file. |
| 7134 | 49 |
|
50 |
\begin{rail}
|
|
| 7895 | 51 |
'header' text |
52 |
; |
|
| 7134 | 53 |
'theory' name '=' (name + '+') filespecs? ':' |
54 |
; |
|
55 |
'context' name |
|
56 |
; |
|
57 |
'end' |
|
58 |
;; |
|
59 |
||
| 7167 | 60 |
filespecs: 'files' ((name | parname) +); |
| 7134 | 61 |
\end{rail}
|
62 |
||
| 7167 | 63 |
\begin{descr}
|
| 7895 | 64 |
\item [$\isarkeyword{header}~text$] provides plain text markup just preceding
|
| 8547 | 65 |
the formal beginning of a theory. In actual document preparation the |
| 7895 | 66 |
corresponding {\LaTeX} macro \verb,\isamarkupheader, may be redefined to
|
67 |
produce chapter or section headings. See also \S\ref{sec:markup-thy} and
|
|
68 |
\S\ref{sec:markup-prf} for further markup commands.
|
|
69 |
||
| 7981 | 70 |
\item [$\THEORY~A = B@1 + \cdots + B@n\colon$] commences a new theory $A$ |
71 |
based on existing ones $B@1 + \cdots + B@n$. Isabelle's theory loader |
|
72 |
system ensures that any of the base theories are properly loaded (and fully |
|
73 |
up-to-date when $\THEORY$ is executed interactively). The optional |
|
74 |
$\isarkeyword{files}$ specification declares additional dependencies on ML
|
|
75 |
files. Unless put in parentheses, any file will be loaded immediately via |
|
76 |
$\isarcmd{use}$ (see also \S\ref{sec:ML}). The optional ML file
|
|
77 |
\texttt{$A$.ML} that may be associated with any theory should \emph{not} be
|
|
78 |
included in $\isarkeyword{files}$, though.
|
|
| 7134 | 79 |
|
| 7895 | 80 |
\item [$\CONTEXT~B$] enters an existing theory context, basically in read-only |
| 7981 | 81 |
mode, so only a limited set of commands may be performed without destroying |
82 |
the theory. Just as for $\THEORY$, the theory loader ensures that $B$ is |
|
83 |
loaded and up-to-date. |
|
| 7175 | 84 |
|
| 7167 | 85 |
\item [$\END$] concludes the current theory definition or context switch. |
| 7981 | 86 |
Note that this command cannot be undone, but the whole theory definition has |
87 |
to be retracted. |
|
| 7167 | 88 |
\end{descr}
|
| 7134 | 89 |
|
90 |
||
| 7895 | 91 |
\subsection{Theory markup commands}\label{sec:markup-thy}
|
| 7134 | 92 |
|
| 7895 | 93 |
\indexisarcmd{chapter}\indexisarcmd{section}\indexisarcmd{subsection}
|
94 |
\indexisarcmd{subsubsection}\indexisarcmd{text}\indexisarcmd{text-raw}
|
|
| 7134 | 95 |
\begin{matharray}{rcl}
|
96 |
\isarcmd{chapter} & : & \isartrans{theory}{theory} \\
|
|
| 7167 | 97 |
\isarcmd{section} & : & \isartrans{theory}{theory} \\
|
| 7134 | 98 |
\isarcmd{subsection} & : & \isartrans{theory}{theory} \\
|
99 |
\isarcmd{subsubsection} & : & \isartrans{theory}{theory} \\
|
|
100 |
\isarcmd{text} & : & \isartrans{theory}{theory} \\
|
|
| 7895 | 101 |
\isarcmd{text_raw} & : & \isartrans{theory}{theory} \\
|
| 7134 | 102 |
\end{matharray}
|
103 |
||
| 7895 | 104 |
Apart from formal comments (see \S\ref{sec:comments}), markup commands provide
|
| 7981 | 105 |
a structured way to insert text into the document generated from a theory (see |
| 7895 | 106 |
\cite{isabelle-sys} for more information on Isabelle's document preparation
|
107 |
tools). |
|
| 7134 | 108 |
|
| 7895 | 109 |
\railalias{textraw}{text\_raw}
|
110 |
\railterm{textraw}
|
|
| 7134 | 111 |
|
112 |
\begin{rail}
|
|
| 7895 | 113 |
('chapter' | 'section' | 'subsection' | 'subsubsection' | 'text' | textraw) text
|
| 7134 | 114 |
; |
115 |
\end{rail}
|
|
116 |
||
| 7167 | 117 |
\begin{descr}
|
| 7335 | 118 |
\item [$\isarkeyword{chapter}$, $\isarkeyword{section}$,
|
119 |
$\isarkeyword{subsection}$, and $\isarkeyword{subsubsection}$] mark chapter
|
|
120 |
and section headings. |
|
| 7895 | 121 |
\item [$\TEXT$] specifies paragraphs of plain text, including references to |
122 |
formal entities.\footnote{The latter feature is not yet supported.
|
|
123 |
Nevertheless, any source text of the form |
|
124 |
``\texttt{\at\ttlbrace$\dots$\ttrbrace}'' should be considered as reserved
|
|
125 |
for future use.} |
|
126 |
\item [$\isarkeyword{text_raw}$] inserts {\LaTeX} source into the output,
|
|
127 |
without additional markup. Thus the full range of document manipulations |
|
128 |
becomes available. A typical application would be to emit |
|
129 |
\verb,\begin{comment}, and \verb,\end{comment}, commands to exclude certain
|
|
130 |
parts from the final document.\footnote{This requires the \texttt{comment}
|
|
| 8547 | 131 |
package to be included in {\LaTeX}, of course.}
|
| 7167 | 132 |
\end{descr}
|
| 7134 | 133 |
|
| 8684 | 134 |
Any of these markup elements corresponds to a {\LaTeX} command with the name
|
135 |
prefixed by \verb,\isamarkup,. For the sectioning commands this is a plain |
|
136 |
macro with a single argument, e.g.\ \verb,\isamarkupchapter{,\dots\verb,}, for
|
|
137 |
$\isarkeyword{chapter}$. The $\isarkeyword{text}$ markup results in a
|
|
138 |
{\LaTeX} environment \verb,\begin{isamarkuptext}, {\dots}
|
|
139 |
\verb,\end{isamarkuptext},, while $\isarkeyword{text_raw}$ causes the text
|
|
140 |
to be inserted directly into the {\LaTeX} source.
|
|
| 7895 | 141 |
|
| 8485 | 142 |
\medskip |
143 |
||
144 |
Additional markup commands are available for proofs (see |
|
| 7895 | 145 |
\S\ref{sec:markup-prf}). Also note that the $\isarkeyword{header}$
|
| 8684 | 146 |
declaration (see \S\ref{sec:begin-thy}) admits to insert section markup just
|
147 |
preceding the actual theory definition. |
|
| 7895 | 148 |
|
| 7134 | 149 |
|
| 7135 | 150 |
\subsection{Type classes and sorts}\label{sec:classes}
|
| 7134 | 151 |
|
152 |
\indexisarcmd{classes}\indexisarcmd{classrel}\indexisarcmd{defaultsort}
|
|
153 |
\begin{matharray}{rcl}
|
|
154 |
\isarcmd{classes} & : & \isartrans{theory}{theory} \\
|
|
155 |
\isarcmd{classrel} & : & \isartrans{theory}{theory} \\
|
|
156 |
\isarcmd{defaultsort} & : & \isartrans{theory}{theory} \\
|
|
157 |
\end{matharray}
|
|
158 |
||
159 |
\begin{rail}
|
|
| 7167 | 160 |
'classes' (classdecl comment? +) |
| 7134 | 161 |
; |
162 |
'classrel' nameref '<' nameref comment? |
|
163 |
; |
|
164 |
'defaultsort' sort comment? |
|
165 |
; |
|
166 |
\end{rail}
|
|
167 |
||
| 7167 | 168 |
\begin{descr}
|
| 7335 | 169 |
\item [$\isarkeyword{classes}~c<\vec c$] declares class $c$ to be a subclass
|
170 |
of existing classes $\vec c$. Cyclic class structures are ruled out. |
|
| 7134 | 171 |
\item [$\isarkeyword{classrel}~c@1<c@2$] states a subclass relation between
|
172 |
existing classes $c@1$ and $c@2$. This is done axiomatically! The |
|
| 7895 | 173 |
$\isarkeyword{instance}$ command (see \S\ref{sec:axclass}) provides a way to
|
| 7175 | 174 |
introduce proven class relations. |
| 7134 | 175 |
\item [$\isarkeyword{defaultsort}~s$] makes sort $s$ the new default sort for
|
| 7895 | 176 |
any type variables given without sort constraints. Usually, the default |
| 8547 | 177 |
sort would be only changed when defining new object-logics. |
| 7167 | 178 |
\end{descr}
|
| 7134 | 179 |
|
180 |
||
| 7315 | 181 |
\subsection{Primitive types and type abbreviations}\label{sec:types-pure}
|
| 7134 | 182 |
|
183 |
\indexisarcmd{typedecl}\indexisarcmd{types}\indexisarcmd{nonterminals}\indexisarcmd{arities}
|
|
184 |
\begin{matharray}{rcl}
|
|
185 |
\isarcmd{types} & : & \isartrans{theory}{theory} \\
|
|
186 |
\isarcmd{typedecl} & : & \isartrans{theory}{theory} \\
|
|
187 |
\isarcmd{nonterminals} & : & \isartrans{theory}{theory} \\
|
|
188 |
\isarcmd{arities} & : & \isartrans{theory}{theory} \\
|
|
189 |
\end{matharray}
|
|
190 |
||
191 |
\begin{rail}
|
|
192 |
'types' (typespec '=' type infix? comment? +) |
|
193 |
; |
|
194 |
'typedecl' typespec infix? comment? |
|
195 |
; |
|
196 |
'nonterminals' (name +) comment? |
|
197 |
; |
|
198 |
'arities' (nameref '::' arity comment? +) |
|
199 |
; |
|
200 |
\end{rail}
|
|
201 |
||
| 7167 | 202 |
\begin{descr}
|
| 7335 | 203 |
\item [$\TYPES~(\vec\alpha)t = \tau$] introduces \emph{type synonym}
|
| 7134 | 204 |
$(\vec\alpha)t$ for existing type $\tau$. Unlike actual type definitions, |
205 |
as are available in Isabelle/HOL for example, type synonyms are just purely |
|
| 7895 | 206 |
syntactic abbreviations without any logical significance. Internally, type |
| 7981 | 207 |
synonyms are fully expanded. |
| 7134 | 208 |
\item [$\isarkeyword{typedecl}~(\vec\alpha)t$] declares a new type constructor
|
| 7895 | 209 |
$t$, intended as an actual logical type. Note that object-logics such as |
210 |
Isabelle/HOL override $\isarkeyword{typedecl}$ by their own version.
|
|
| 7175 | 211 |
\item [$\isarkeyword{nonterminals}~\vec c$] declares $0$-ary type constructors
|
212 |
$\vec c$ to act as purely syntactic types, i.e.\ nonterminal symbols of |
|
213 |
Isabelle's inner syntax of terms or types. |
|
| 7335 | 214 |
\item [$\isarkeyword{arities}~t::(\vec s)s$] augments Isabelle's order-sorted
|
215 |
signature of types by new type constructor arities. This is done |
|
216 |
axiomatically! The $\isarkeyword{instance}$ command (see
|
|
| 7895 | 217 |
\S\ref{sec:axclass}) provides a way to introduce proven type arities.
|
| 7167 | 218 |
\end{descr}
|
| 7134 | 219 |
|
220 |
||
| 7981 | 221 |
\subsection{Constants and simple definitions}\label{sec:consts}
|
| 7134 | 222 |
|
| 7175 | 223 |
\indexisarcmd{consts}\indexisarcmd{defs}\indexisarcmd{constdefs}\indexoutertoken{constdecl}
|
| 7134 | 224 |
\begin{matharray}{rcl}
|
225 |
\isarcmd{consts} & : & \isartrans{theory}{theory} \\
|
|
226 |
\isarcmd{defs} & : & \isartrans{theory}{theory} \\
|
|
227 |
\isarcmd{constdefs} & : & \isartrans{theory}{theory} \\
|
|
228 |
\end{matharray}
|
|
229 |
||
230 |
\begin{rail}
|
|
231 |
'consts' (constdecl +) |
|
232 |
; |
|
| 7608 | 233 |
'defs' (axmdecl prop comment? +) |
| 7134 | 234 |
; |
235 |
'constdefs' (constdecl prop comment? +) |
|
236 |
; |
|
237 |
||
238 |
constdecl: name '::' type mixfix? comment? |
|
239 |
; |
|
240 |
\end{rail}
|
|
241 |
||
| 7167 | 242 |
\begin{descr}
|
| 7335 | 243 |
\item [$\CONSTS~c::\sigma$] declares constant $c$ to have any instance of type |
244 |
scheme $\sigma$. The optional mixfix annotations may attach concrete syntax |
|
| 7895 | 245 |
to the constants declared. |
| 7335 | 246 |
\item [$\DEFS~name: eqn$] introduces $eqn$ as a definitional axiom for some |
247 |
existing constant. See \cite[\S6]{isabelle-ref} for more details on the
|
|
248 |
form of equations admitted as constant definitions. |
|
249 |
\item [$\isarkeyword{constdefs}~c::\sigma~eqn$] combines declarations and
|
|
| 8547 | 250 |
definitions of constants, using the canonical name $c_def$ for the |
251 |
definitional axiom. |
|
| 7167 | 252 |
\end{descr}
|
| 7134 | 253 |
|
254 |
||
| 7981 | 255 |
\subsection{Syntax and translations}\label{sec:syn-trans}
|
| 7134 | 256 |
|
257 |
\indexisarcmd{syntax}\indexisarcmd{translations}
|
|
258 |
\begin{matharray}{rcl}
|
|
259 |
\isarcmd{syntax} & : & \isartrans{theory}{theory} \\
|
|
260 |
\isarcmd{translations} & : & \isartrans{theory}{theory} \\
|
|
261 |
\end{matharray}
|
|
262 |
||
263 |
\begin{rail}
|
|
264 |
'syntax' ('(' name 'output'? ')')? (constdecl +)
|
|
265 |
; |
|
266 |
'translations' (transpat ('==' | '=>' | '<=') transpat comment? +)
|
|
267 |
; |
|
268 |
transpat: ('(' nameref ')')? string
|
|
269 |
; |
|
270 |
\end{rail}
|
|
271 |
||
| 7167 | 272 |
\begin{descr}
|
| 7175 | 273 |
\item [$\isarkeyword{syntax}~(mode)~decls$] is similar to $\CONSTS~decls$,
|
274 |
except that the actual logical signature extension is omitted. Thus the |
|
275 |
context free grammar of Isabelle's inner syntax may be augmented in |
|
| 7335 | 276 |
arbitrary ways, independently of the logic. The $mode$ argument refers to |
| 8547 | 277 |
the print mode that the grammar rules belong; unless the \texttt{output}
|
278 |
flag is given, all productions are added both to the input and output |
|
279 |
grammar. |
|
| 7175 | 280 |
\item [$\isarkeyword{translations}~rules$] specifies syntactic translation
|
| 7981 | 281 |
rules (i.e.\ \emph{macros}): parse~/ print rules (\texttt{==}), parse rules
|
| 7895 | 282 |
(\texttt{=>}), or print rules (\texttt{<=}). Translation patterns may be
|
283 |
prefixed by the syntactic category to be used for parsing; the default is |
|
| 7134 | 284 |
\texttt{logic}.
|
| 7167 | 285 |
\end{descr}
|
| 7134 | 286 |
|
287 |
||
288 |
\subsection{Axioms and theorems}
|
|
289 |
||
290 |
\indexisarcmd{axioms}\indexisarcmd{theorems}\indexisarcmd{lemmas}
|
|
291 |
\begin{matharray}{rcl}
|
|
292 |
\isarcmd{axioms} & : & \isartrans{theory}{theory} \\
|
|
293 |
\isarcmd{theorems} & : & \isartrans{theory}{theory} \\
|
|
294 |
\isarcmd{lemmas} & : & \isartrans{theory}{theory} \\
|
|
295 |
\end{matharray}
|
|
296 |
||
297 |
\begin{rail}
|
|
| 7135 | 298 |
'axioms' (axmdecl prop comment? +) |
| 7134 | 299 |
; |
300 |
('theorems' | 'lemmas') thmdef? thmrefs
|
|
301 |
; |
|
302 |
\end{rail}
|
|
303 |
||
| 7167 | 304 |
\begin{descr}
|
| 7335 | 305 |
\item [$\isarkeyword{axioms}~a: \phi$] introduces arbitrary statements as
|
| 7895 | 306 |
axioms of the meta-logic. In fact, axioms are ``axiomatic theorems'', and |
307 |
may be referred later just as any other theorem. |
|
| 7134 | 308 |
|
309 |
Axioms are usually only introduced when declaring new logical systems. |
|
| 7175 | 310 |
Everyday work is typically done the hard way, with proper definitions and |
| 8547 | 311 |
actual proven theorems. |
| 7335 | 312 |
\item [$\isarkeyword{theorems}~a = \vec b$] stores lists of existing theorems.
|
| 8547 | 313 |
Typical applications would also involve attributes, to declare Simplifier |
314 |
rules, for example. |
|
| 7134 | 315 |
\item [$\isarkeyword{lemmas}$] is similar to $\isarkeyword{theorems}$, but
|
316 |
tags the results as ``lemma''. |
|
| 7167 | 317 |
\end{descr}
|
| 7134 | 318 |
|
319 |
||
| 7167 | 320 |
\subsection{Name spaces}
|
| 7134 | 321 |
|
| 8726 | 322 |
\indexisarcmd{global}\indexisarcmd{local}\indexisarcmd{hide}
|
| 7134 | 323 |
\begin{matharray}{rcl}
|
324 |
\isarcmd{global} & : & \isartrans{theory}{theory} \\
|
|
325 |
\isarcmd{local} & : & \isartrans{theory}{theory} \\
|
|
| 8726 | 326 |
\isarcmd{hide} & : & \isartrans{theory}{theory} \\
|
| 7134 | 327 |
\end{matharray}
|
328 |
||
| 8726 | 329 |
\begin{rail}
|
330 |
'global' comment? |
|
331 |
; |
|
332 |
'local' comment? |
|
333 |
; |
|
334 |
'hide' name (nameref + ) comment? |
|
335 |
; |
|
336 |
\end{rail}
|
|
337 |
||
| 7895 | 338 |
Isabelle organizes any kind of name declarations (of types, constants, |
| 8547 | 339 |
theorems etc.) by separate hierarchically structured name spaces. Normally |
| 8726 | 340 |
the user does not have to control the behavior of name spaces by hand, yet the |
341 |
following commands provide some way to do so. |
|
| 7175 | 342 |
|
| 7167 | 343 |
\begin{descr}
|
344 |
\item [$\isarkeyword{global}$ and $\isarkeyword{local}$] change the current
|
|
345 |
name declaration mode. Initially, theories start in $\isarkeyword{local}$
|
|
346 |
mode, causing all names to be automatically qualified by the theory name. |
|
| 7895 | 347 |
Changing this to $\isarkeyword{global}$ causes all names to be declared
|
348 |
without the theory prefix, until $\isarkeyword{local}$ is declared again.
|
|
| 8726 | 349 |
|
350 |
Note that global names are prone to get hidden accidently later, when |
|
351 |
qualified names of the same base name are introduced. |
|
352 |
||
353 |
\item [$\isarkeyword{hide}~space~names$] removes declarations from a given
|
|
354 |
name space (which may be $class$, $type$, or $const$). Hidden objects |
|
355 |
remain valid within the logic, but are inaccessible from user input. In |
|
356 |
output, the special qualifier ``$\mathord?\mathord?$'' is prefixed to the |
|
357 |
full internal name. |
|
358 |
||
359 |
Unqualified (global) names may not be hidden deliberately. |
|
| 7167 | 360 |
\end{descr}
|
| 7134 | 361 |
|
362 |
||
| 7167 | 363 |
\subsection{Incorporating ML code}\label{sec:ML}
|
| 7134 | 364 |
|
| 8682 | 365 |
\indexisarcmd{use}\indexisarcmd{ML}\indexisarcmd{ML-command}
|
366 |
\indexisarcmd{ML-setup}\indexisarcmd{setup}
|
|
| 7134 | 367 |
\begin{matharray}{rcl}
|
368 |
\isarcmd{use} & : & \isartrans{\cdot}{\cdot} \\
|
|
369 |
\isarcmd{ML} & : & \isartrans{\cdot}{\cdot} \\
|
|
| 8682 | 370 |
\isarcmd{ML_command} & : & \isartrans{\cdot}{\cdot} \\
|
| 7895 | 371 |
\isarcmd{ML_setup} & : & \isartrans{theory}{theory} \\
|
| 7175 | 372 |
\isarcmd{setup} & : & \isartrans{theory}{theory} \\
|
| 7134 | 373 |
\end{matharray}
|
374 |
||
| 7895 | 375 |
\railalias{MLsetup}{ML\_setup}
|
376 |
\railterm{MLsetup}
|
|
377 |
||
| 8682 | 378 |
\railalias{MLcommand}{ML\_command}
|
379 |
\railterm{MLcommand}
|
|
380 |
||
| 7134 | 381 |
\begin{rail}
|
382 |
'use' name |
|
383 |
; |
|
| 8682 | 384 |
('ML' | MLcommand | MLsetup | 'setup') text
|
| 7134 | 385 |
; |
386 |
\end{rail}
|
|
387 |
||
| 7167 | 388 |
\begin{descr}
|
| 7175 | 389 |
\item [$\isarkeyword{use}~file$] reads and executes ML commands from $file$.
|
| 7466 | 390 |
The current theory context (if present) is passed down to the ML session, |
| 7981 | 391 |
but may not be modified. Furthermore, the file name is checked with the |
| 7466 | 392 |
$\isarkeyword{files}$ dependency declaration given in the theory header (see
|
393 |
also \S\ref{sec:begin-thy}).
|
|
394 |
||
| 8682 | 395 |
\item [$\isarkeyword{ML}~text$ and $\isarkeyword{ML_command}~text$] execute ML
|
396 |
commands from $text$. The theory context is passed in the same way as for |
|
397 |
$\isarkeyword{use}$, but may not be changed. Note that
|
|
398 |
$\isarkeyword{ML_command}$ is less verbose than plain $\isarkeyword{ML}$.
|
|
| 7895 | 399 |
|
400 |
\item [$\isarkeyword{ML_setup}~text$] executes ML commands from $text$. The
|
|
401 |
theory context is passed down to the ML session, and fetched back |
|
402 |
afterwards. Thus $text$ may actually change the theory as a side effect. |
|
403 |
||
| 7167 | 404 |
\item [$\isarkeyword{setup}~text$] changes the current theory context by
|
| 8379 | 405 |
applying $text$, which refers to an ML expression of type |
406 |
\texttt{(theory~->~theory)~list}. The $\isarkeyword{setup}$ command is the
|
|
| 8547 | 407 |
canonical way to initialize any object-logic specific tools and packages |
408 |
written in ML. |
|
| 7167 | 409 |
\end{descr}
|
| 7134 | 410 |
|
411 |
||
| 8250 | 412 |
\subsection{Syntax translation functions}
|
| 7134 | 413 |
|
| 8250 | 414 |
\indexisarcmd{parse-ast-translation}\indexisarcmd{parse-translation}
|
415 |
\indexisarcmd{print-translation}\indexisarcmd{typed-print-translation}
|
|
416 |
\indexisarcmd{print-ast-translation}\indexisarcmd{token-translation}
|
|
417 |
\begin{matharray}{rcl}
|
|
418 |
\isarcmd{parse_ast_translation} & : & \isartrans{theory}{theory} \\
|
|
419 |
\isarcmd{parse_translation} & : & \isartrans{theory}{theory} \\
|
|
420 |
\isarcmd{print_translation} & : & \isartrans{theory}{theory} \\
|
|
421 |
\isarcmd{typed_print_translation} & : & \isartrans{theory}{theory} \\
|
|
422 |
\isarcmd{print_ast_translation} & : & \isartrans{theory}{theory} \\
|
|
423 |
\isarcmd{token_translation} & : & \isartrans{theory}{theory} \\
|
|
424 |
\end{matharray}
|
|
| 7134 | 425 |
|
| 8250 | 426 |
Syntax translation functions written in ML admit almost arbitrary |
427 |
manipulations of Isabelle's inner syntax. Any of the above commands have a |
|
428 |
single \railqtoken{text} argument that refers to an ML expression of
|
|
| 8379 | 429 |
appropriate type. |
430 |
||
431 |
\begin{ttbox}
|
|
432 |
val parse_ast_translation : (string * (ast list -> ast)) list |
|
433 |
val parse_translation : (string * (term list -> term)) list |
|
434 |
val print_translation : (string * (term list -> term)) list |
|
435 |
val typed_print_translation : |
|
436 |
(string * (bool -> typ -> term list -> term)) list |
|
437 |
val print_ast_translation : (string * (ast list -> ast)) list |
|
438 |
val token_translation : |
|
439 |
(string * string * (string -> string * real)) list |
|
440 |
\end{ttbox}
|
|
441 |
See \cite[\S8]{isabelle-ref} for more information on syntax transformations.
|
|
| 7134 | 442 |
|
443 |
||
444 |
\subsection{Oracles}
|
|
445 |
||
446 |
\indexisarcmd{oracle}
|
|
447 |
\begin{matharray}{rcl}
|
|
448 |
\isarcmd{oracle} & : & \isartrans{theory}{theory} \\
|
|
449 |
\end{matharray}
|
|
450 |
||
| 7175 | 451 |
Oracles provide an interface to external reasoning systems, without giving up |
452 |
control completely --- each theorem carries a derivation object recording any |
|
453 |
oracle invocation. See \cite[\S6]{isabelle-ref} for more information.
|
|
454 |
||
| 7134 | 455 |
\begin{rail}
|
456 |
'oracle' name '=' text comment? |
|
457 |
; |
|
458 |
\end{rail}
|
|
459 |
||
| 7167 | 460 |
\begin{descr}
|
| 7175 | 461 |
\item [$\isarkeyword{oracle}~name=text$] declares oracle $name$ to be ML
|
| 8379 | 462 |
function $text$, which has to be of type |
463 |
\texttt{Sign.sg~*~Object.T~->~term}.
|
|
| 7167 | 464 |
\end{descr}
|
| 7134 | 465 |
|
466 |
||
467 |
\section{Proof commands}
|
|
468 |
||
| 7987 | 469 |
Proof commands perform transitions of Isar/VM machine configurations, which |
| 7315 | 470 |
are block-structured, consisting of a stack of nodes with three main |
| 7335 | 471 |
components: logical proof context, current facts, and open goals. Isar/VM |
| 8547 | 472 |
transitions are \emph{typed} according to the following three different modes
|
473 |
of operation: |
|
| 7167 | 474 |
\begin{descr}
|
475 |
\item [$proof(prove)$] means that a new goal has just been stated that is now |
|
| 8547 | 476 |
to be \emph{proven}; the next command may refine it by some proof method,
|
477 |
and enter a sub-proof to establish the actual result. |
|
| 7167 | 478 |
\item [$proof(state)$] is like an internal theory mode: the context may be |
| 7987 | 479 |
augmented by \emph{stating} additional assumptions, intermediate results
|
480 |
etc. |
|
| 7895 | 481 |
\item [$proof(chain)$] is intermediate between $proof(state)$ and |
| 7987 | 482 |
$proof(prove)$: existing facts (i.e.\ the contents of the special ``$this$'' |
483 |
register) have been just picked up in order to be used when refining the |
|
484 |
goal claimed next. |
|
| 7167 | 485 |
\end{descr}
|
| 7134 | 486 |
|
| 7167 | 487 |
|
| 7895 | 488 |
\subsection{Proof markup commands}\label{sec:markup-prf}
|
| 7167 | 489 |
|
| 7987 | 490 |
\indexisarcmd{sect}\indexisarcmd{subsect}\indexisarcmd{subsubsect}
|
| 7895 | 491 |
\indexisarcmd{txt}\indexisarcmd{txt-raw}
|
| 7134 | 492 |
\begin{matharray}{rcl}
|
| 8101 | 493 |
\isarcmd{sect} & : & \isartrans{proof}{proof} \\
|
494 |
\isarcmd{subsect} & : & \isartrans{proof}{proof} \\
|
|
495 |
\isarcmd{subsubsect} & : & \isartrans{proof}{proof} \\
|
|
496 |
\isarcmd{txt} & : & \isartrans{proof}{proof} \\
|
|
497 |
\isarcmd{txt_raw} & : & \isartrans{proof}{proof} \\
|
|
| 7134 | 498 |
\end{matharray}
|
499 |
||
| 7895 | 500 |
These markup commands for proof mode closely correspond to the ones of theory |
| 8684 | 501 |
mode (see \S\ref{sec:markup-thy}).
|
| 7895 | 502 |
|
503 |
\railalias{txtraw}{txt\_raw}
|
|
504 |
\railterm{txtraw}
|
|
| 7175 | 505 |
|
| 7134 | 506 |
\begin{rail}
|
| 7895 | 507 |
('sect' | 'subsect' | 'subsubsect' | 'txt' | txtraw) text
|
| 7134 | 508 |
; |
509 |
\end{rail}
|
|
510 |
||
511 |
||
| 7315 | 512 |
\subsection{Proof context}\label{sec:proof-context}
|
| 7134 | 513 |
|
| 7315 | 514 |
\indexisarcmd{fix}\indexisarcmd{assume}\indexisarcmd{presume}\indexisarcmd{def}
|
| 7134 | 515 |
\begin{matharray}{rcl}
|
516 |
\isarcmd{fix} & : & \isartrans{proof(state)}{proof(state)} \\
|
|
517 |
\isarcmd{assume} & : & \isartrans{proof(state)}{proof(state)} \\
|
|
518 |
\isarcmd{presume} & : & \isartrans{proof(state)}{proof(state)} \\
|
|
519 |
\isarcmd{def} & : & \isartrans{proof(state)}{proof(state)} \\
|
|
520 |
\end{matharray}
|
|
521 |
||
| 7315 | 522 |
The logical proof context consists of fixed variables and assumptions. The |
523 |
former closely correspond to Skolem constants, or meta-level universal |
|
524 |
quantification as provided by the Isabelle/Pure logical framework. |
|
525 |
Introducing some \emph{arbitrary, but fixed} variable via $\FIX x$ results in
|
|
| 7987 | 526 |
a local value that may be used in the subsequent proof as any other variable |
| 7895 | 527 |
or constant. Furthermore, any result $\edrv \phi[x]$ exported from the |
| 7987 | 528 |
context will be universally closed wrt.\ $x$ at the outermost level: $\edrv |
529 |
\All x \phi$ (this is expressed using Isabelle's meta-variables). |
|
| 7315 | 530 |
|
531 |
Similarly, introducing some assumption $\chi$ has two effects. On the one |
|
532 |
hand, a local theorem is created that may be used as a fact in subsequent |
|
| 7895 | 533 |
proof steps. On the other hand, any result $\chi \drv \phi$ exported from the |
534 |
context becomes conditional wrt.\ the assumption: $\edrv \chi \Imp \phi$. |
|
535 |
Thus, solving an enclosing goal using such a result would basically introduce |
|
536 |
a new subgoal stemming from the assumption. How this situation is handled |
|
537 |
depends on the actual version of assumption command used: while $\ASSUMENAME$ |
|
538 |
insists on solving the subgoal by unification with some premise of the goal, |
|
539 |
$\PRESUMENAME$ leaves the subgoal unchanged in order to be proved later by the |
|
540 |
user. |
|
| 7315 | 541 |
|
| 7319 | 542 |
Local definitions, introduced by $\DEF{}{x \equiv t}$, are achieved by
|
| 7987 | 543 |
combining $\FIX x$ with another version of assumption that causes any |
544 |
hypothetical equation $x \equiv t$ to be eliminated by the reflexivity rule. |
|
545 |
Thus, exporting some result $x \equiv t \drv \phi[x]$ yields $\edrv \phi[t]$. |
|
| 7175 | 546 |
|
| 7134 | 547 |
\begin{rail}
|
| 7431 | 548 |
'fix' (vars + 'and') comment? |
| 7134 | 549 |
; |
| 7315 | 550 |
('assume' | 'presume') (assm comment? + 'and')
|
| 7134 | 551 |
; |
| 7175 | 552 |
'def' thmdecl? \\ var '==' term termpat? comment? |
| 7134 | 553 |
; |
554 |
||
555 |
var: name ('::' type)?
|
|
556 |
; |
|
| 7458 | 557 |
vars: (name+) ('::' type)?
|
| 7431 | 558 |
; |
| 7315 | 559 |
assm: thmdecl? (prop proppat? +) |
560 |
; |
|
| 7134 | 561 |
\end{rail}
|
562 |
||
| 7167 | 563 |
\begin{descr}
|
| 8547 | 564 |
\item [$\FIX{\vec x}$] introduces local \emph{arbitrary, but fixed} variables
|
565 |
$\vec x$. |
|
| 8515 | 566 |
\item [$\ASSUME{a}{\vec\phi}$ and $\PRESUME{a}{\vec\phi}$] introduce local
|
567 |
theorems $\vec\phi$ by assumption. Subsequent results applied to an |
|
568 |
enclosing goal (e.g.\ by $\SHOWNAME$) are handled as follows: $\ASSUMENAME$ |
|
569 |
expects to be able to unify with existing premises in the goal, while |
|
570 |
$\PRESUMENAME$ leaves $\vec\phi$ as new subgoals. |
|
| 7335 | 571 |
|
572 |
Several lists of assumptions may be given (separated by |
|
| 7895 | 573 |
$\isarkeyword{and}$); the resulting list of current facts consists of all of
|
574 |
these concatenated. |
|
| 7315 | 575 |
\item [$\DEF{a}{x \equiv t}$] introduces a local (non-polymorphic) definition.
|
576 |
In results exported from the context, $x$ is replaced by $t$. Basically, |
|
| 7987 | 577 |
$\DEF{}{x \equiv t}$ abbreviates $\FIX{x}~\ASSUME{}{x \equiv t}$, with the
|
| 7335 | 578 |
resulting hypothetical equation solved by reflexivity. |
| 7431 | 579 |
|
580 |
The default name for the definitional equation is $x_def$. |
|
| 7167 | 581 |
\end{descr}
|
582 |
||
| 7895 | 583 |
The special name $prems$\indexisarthm{prems} refers to all assumptions of the
|
584 |
current context as a list of theorems. |
|
| 7315 | 585 |
|
| 7167 | 586 |
|
587 |
\subsection{Facts and forward chaining}
|
|
588 |
||
589 |
\indexisarcmd{note}\indexisarcmd{then}\indexisarcmd{from}\indexisarcmd{with}
|
|
590 |
\begin{matharray}{rcl}
|
|
591 |
\isarcmd{note} & : & \isartrans{proof(state)}{proof(state)} \\
|
|
592 |
\isarcmd{then} & : & \isartrans{proof(state)}{proof(chain)} \\
|
|
593 |
\isarcmd{from} & : & \isartrans{proof(state)}{proof(chain)} \\
|
|
594 |
\isarcmd{with} & : & \isartrans{proof(state)}{proof(chain)} \\
|
|
595 |
\end{matharray}
|
|
596 |
||
| 7319 | 597 |
New facts are established either by assumption or proof of local statements. |
| 7335 | 598 |
Any fact will usually be involved in further proofs, either as explicit |
| 8547 | 599 |
arguments of proof methods, or when forward chaining towards the next goal via |
| 7335 | 600 |
$\THEN$ (and variants). Note that the special theorem name |
| 7987 | 601 |
$this$\indexisarthm{this} refers to the most recently established facts.
|
| 7167 | 602 |
\begin{rail}
|
603 |
'note' thmdef? thmrefs comment? |
|
604 |
; |
|
605 |
'then' comment? |
|
606 |
; |
|
607 |
('from' | 'with') thmrefs comment?
|
|
608 |
; |
|
609 |
\end{rail}
|
|
610 |
||
611 |
\begin{descr}
|
|
| 7175 | 612 |
\item [$\NOTE{a}{\vec b}$] recalls existing facts $\vec b$, binding the result
|
613 |
as $a$. Note that attributes may be involved as well, both on the left and |
|
614 |
right hand sides. |
|
| 7167 | 615 |
\item [$\THEN$] indicates forward chaining by the current facts in order to |
| 7895 | 616 |
establish the goal to be claimed next. The initial proof method invoked to |
617 |
refine that will be offered the facts to do ``anything appropriate'' (cf.\ |
|
618 |
also \S\ref{sec:proof-steps}). For example, method $rule$ (see
|
|
| 8515 | 619 |
\S\ref{sec:pure-meth-att}) would typically do an elimination rather than an
|
| 7895 | 620 |
introduction. Automatic methods usually insert the facts into the goal |
| 8547 | 621 |
state before operation. This provides a simple scheme to control relevance |
622 |
of facts in automated proof search. |
|
| 7335 | 623 |
\item [$\FROM{\vec b}$] abbreviates $\NOTE{}{\vec b}~\THEN$; thus $\THEN$ is
|
| 7458 | 624 |
equivalent to $\FROM{this}$.
|
| 7175 | 625 |
\item [$\WITH{\vec b}$] abbreviates $\FROM{\vec b~facts}$; thus the forward
|
626 |
chaining is from earlier facts together with the current ones. |
|
| 7167 | 627 |
\end{descr}
|
628 |
||
| 8515 | 629 |
Basic proof methods (such as $rule$, see \S\ref{sec:pure-meth-att}) expect
|
| 7895 | 630 |
multiple facts to be given in their proper order, corresponding to a prefix of |
631 |
the premises of the rule involved. Note that positions may be easily skipped |
|
| 8547 | 632 |
using something like $\FROM{\text{\texttt{_}}~a~b}$, for example. This
|
633 |
involves the trivial rule $\PROP\psi \Imp \PROP\psi$, which happens to be |
|
634 |
bound in Isabelle/Pure as ``\texttt{_}''
|
|
635 |
(underscore).\indexisarthm{_@\texttt{_}}
|
|
| 7389 | 636 |
|
| 7167 | 637 |
|
638 |
\subsection{Goal statements}
|
|
639 |
||
640 |
\indexisarcmd{theorem}\indexisarcmd{lemma}
|
|
641 |
\indexisarcmd{have}\indexisarcmd{show}\indexisarcmd{hence}\indexisarcmd{thus}
|
|
642 |
\begin{matharray}{rcl}
|
|
643 |
\isarcmd{theorem} & : & \isartrans{theory}{proof(prove)} \\
|
|
644 |
\isarcmd{lemma} & : & \isartrans{theory}{proof(prove)} \\
|
|
| 7987 | 645 |
\isarcmd{have} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
|
646 |
\isarcmd{show} & : & \isartrans{proof(state) ~|~ proof(chain)}{proof(prove)} \\
|
|
| 7167 | 647 |
\isarcmd{hence} & : & \isartrans{proof(state)}{proof(prove)} \\
|
648 |
\isarcmd{thus} & : & \isartrans{proof(state)}{proof(prove)} \\
|
|
649 |
\end{matharray}
|
|
650 |
||
| 7175 | 651 |
Proof mode is entered from theory mode by initial goal commands $\THEOREMNAME$ |
| 7895 | 652 |
and $\LEMMANAME$. New local goals may be claimed within proof mode as well. |
653 |
Four variants are available, indicating whether the result is meant to solve |
|
| 8547 | 654 |
some pending goal or whether forward chaining is indicated. |
| 7175 | 655 |
|
| 7167 | 656 |
\begin{rail}
|
657 |
('theorem' | 'lemma') goal
|
|
658 |
; |
|
659 |
('have' | 'show' | 'hence' | 'thus') goal
|
|
660 |
; |
|
661 |
||
| 8632 | 662 |
goal: thmdecl? prop proppat? comment? |
| 7167 | 663 |
; |
664 |
\end{rail}
|
|
665 |
||
666 |
\begin{descr}
|
|
| 7335 | 667 |
\item [$\THEOREM{a}{\phi}$] enters proof mode with $\phi$ as main goal,
|
| 8547 | 668 |
eventually resulting in some theorem $\turn \phi$ to be put back into the |
669 |
theory. |
|
| 7987 | 670 |
\item [$\LEMMA{a}{\phi}$] is similar to $\THEOREMNAME$, but tags the result as
|
| 7167 | 671 |
``lemma''. |
| 7335 | 672 |
\item [$\HAVE{a}{\phi}$] claims a local goal, eventually resulting in a
|
| 7167 | 673 |
theorem with the current assumption context as hypotheses. |
| 7335 | 674 |
\item [$\SHOW{a}{\phi}$] is similar to $\HAVE{a}{\phi}$, but solves some
|
| 7895 | 675 |
pending goal with the result \emph{exported} into the corresponding context
|
676 |
(cf.\ \S\ref{sec:proof-context}).
|
|
677 |
\item [$\HENCENAME$] abbreviates $\THEN~\HAVENAME$, i.e.\ claims a local goal |
|
678 |
to be proven by forward chaining the current facts. Note that $\HENCENAME$ |
|
679 |
is also equivalent to $\FROM{this}~\HAVENAME$.
|
|
680 |
\item [$\THUSNAME$] abbreviates $\THEN~\SHOWNAME$. Note that $\THUSNAME$ is |
|
681 |
also equivalent to $\FROM{this}~\SHOWNAME$.
|
|
| 7167 | 682 |
\end{descr}
|
683 |
||
| 8991 | 684 |
Note that any goal statement causes some term abbreviations (such as |
685 |
$\Var{thesis}$, $\dots$) to be bound automatically, see also
|
|
686 |
\S\ref{sec:term-abbrev}. Furthermore, the local context of a (non-atomic)
|
|
687 |
goal is provided via the case name $antecedent$\indexisarcase{antecedent}, see
|
|
688 |
also \S\ref{sec:cases}.
|
|
689 |
||
| 7167 | 690 |
|
691 |
\subsection{Initial and terminal proof steps}\label{sec:proof-steps}
|
|
692 |
||
| 7175 | 693 |
\indexisarcmd{proof}\indexisarcmd{qed}\indexisarcmd{by}
|
694 |
\indexisarcmd{.}\indexisarcmd{..}\indexisarcmd{sorry}
|
|
695 |
\begin{matharray}{rcl}
|
|
696 |
\isarcmd{proof} & : & \isartrans{proof(prove)}{proof(state)} \\
|
|
697 |
\isarcmd{qed} & : & \isartrans{proof(state)}{proof(state) ~|~ theory} \\
|
|
698 |
\isarcmd{by} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
|
|
699 |
\isarcmd{.\,.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
|
|
700 |
\isarcmd{.} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
|
|
701 |
\isarcmd{sorry} & : & \isartrans{proof(prove)}{proof(state) ~|~ theory} \\
|
|
702 |
\end{matharray}
|
|
703 |
||
| 8547 | 704 |
Arbitrary goal refinement via tactics is considered harmful. Properly, the |
| 7335 | 705 |
Isar framework admits proof methods to be invoked in two places only. |
| 7167 | 706 |
\begin{enumerate}
|
| 7175 | 707 |
\item An \emph{initial} refinement step $\PROOF{m@1}$ reduces a newly stated
|
| 7335 | 708 |
goal to a number of sub-goals that are to be solved later. Facts are passed |
| 7895 | 709 |
to $m@1$ for forward chaining, if so indicated by $proof(chain)$ mode. |
| 7167 | 710 |
|
| 7987 | 711 |
\item A \emph{terminal} conclusion step $\QED{m@2}$ is intended to solve
|
712 |
remaining goals. No facts are passed to $m@2$. |
|
| 7167 | 713 |
\end{enumerate}
|
714 |
||
| 8547 | 715 |
The only other proper way to affect pending goals is by $\SHOWNAME$, which |
716 |
involves an explicit statement of what is to be solved. |
|
| 7167 | 717 |
|
| 7175 | 718 |
\medskip |
719 |
||
| 7167 | 720 |
Also note that initial proof methods should either solve the goal completely, |
| 7895 | 721 |
or constitute some well-understood reduction to new sub-goals. Arbitrary |
722 |
automatic proof tools that are prone leave a large number of badly structured |
|
723 |
sub-goals are no help in continuing the proof document in any intelligible |
|
| 7987 | 724 |
way. |
| 7167 | 725 |
|
| 7175 | 726 |
\medskip |
727 |
||
| 8547 | 728 |
Unless given explicitly by the user, the default initial method is ``$rule$'', |
729 |
which applies a single standard elimination or introduction rule according to |
|
730 |
the topmost symbol involved. There is no separate default terminal method. |
|
731 |
Any remaining goals are always solved by assumption in the very last step. |
|
| 7167 | 732 |
|
733 |
\begin{rail}
|
|
734 |
'proof' interest? meth? comment? |
|
735 |
; |
|
736 |
'qed' meth? comment? |
|
737 |
; |
|
738 |
'by' meth meth? comment? |
|
739 |
; |
|
740 |
('.' | '..' | 'sorry') comment?
|
|
741 |
; |
|
742 |
||
743 |
meth: method interest? |
|
744 |
; |
|
745 |
\end{rail}
|
|
746 |
||
747 |
\begin{descr}
|
|
| 7335 | 748 |
\item [$\PROOF{m@1}$] refines the goal by proof method $m@1$; facts for
|
749 |
forward chaining are passed if so indicated by $proof(chain)$ mode. |
|
750 |
\item [$\QED{m@2}$] refines any remaining goals by proof method $m@2$ and
|
|
| 7895 | 751 |
concludes the sub-proof by assumption. If the goal had been $\SHOWNAME$ (or |
752 |
$\THUSNAME$), some pending sub-goal is solved as well by the rule resulting |
|
753 |
from the result \emph{exported} into the enclosing goal context. Thus
|
|
754 |
$\QEDNAME$ may fail for two reasons: either $m@2$ fails, or the resulting |
|
755 |
rule does not fit to any pending goal\footnote{This includes any additional
|
|
756 |
``strong'' assumptions as introduced by $\ASSUMENAME$.} of the enclosing |
|
757 |
context. Debugging such a situation might involve temporarily changing |
|
758 |
$\SHOWNAME$ into $\HAVENAME$, or weakening the local context by replacing |
|
759 |
some occurrences of $\ASSUMENAME$ by $\PRESUMENAME$. |
|
760 |
\item [$\BYY{m@1}{m@2}$] is a \emph{terminal proof}\index{proof!terminal}; it
|
|
| 7987 | 761 |
abbreviates $\PROOF{m@1}~\QED{m@2}$, with backtracking across both methods,
|
762 |
though. Debugging an unsuccessful $\BYY{m@1}{m@2}$ commands might be done
|
|
| 7895 | 763 |
by expanding its definition; in many cases $\PROOF{m@1}$ is already
|
| 7175 | 764 |
sufficient to see what is going wrong. |
| 7895 | 765 |
\item [``$\DDOT$''] is a \emph{default proof}\index{proof!default}; it
|
| 8515 | 766 |
abbreviates $\BY{rule}$.
|
| 7895 | 767 |
\item [``$\DOT$''] is a \emph{trivial proof}\index{proof!trivial}; it
|
| 8195 | 768 |
abbreviates $\BY{this}$.
|
| 8379 | 769 |
\item [$\SORRY$] is a \emph{fake proof}\index{proof!fake}; provided that the
|
770 |
\texttt{quick_and_dirty} flag is enabled, $\SORRY$ pretends to solve the
|
|
| 8515 | 771 |
goal without further ado. Of course, the result would be a fake theorem |
772 |
only, involving some oracle in its internal derivation object (this is |
|
773 |
indicated as ``$[!]$'' in the printed result). The main application of |
|
774 |
$\SORRY$ is to support experimentation and top-down proof development. |
|
775 |
\end{descr}
|
|
776 |
||
777 |
||
778 |
\subsection{Fundamental methods and attributes}\label{sec:pure-meth-att}
|
|
779 |
||
| 8547 | 780 |
The following proof methods and attributes refer to basic logical operations |
781 |
of Isar. Further methods and attributes are provided by several generic and |
|
782 |
object-logic specific tools and packages (see chapters \ref{ch:gen-tools} and
|
|
783 |
\ref{ch:hol-tools}).
|
|
| 8515 | 784 |
|
785 |
\indexisarmeth{assumption}\indexisarmeth{this}\indexisarmeth{rule}\indexisarmeth{$-$}
|
|
786 |
\indexisaratt{intro}\indexisaratt{elim}\indexisaratt{dest}
|
|
787 |
\indexisaratt{OF}\indexisaratt{of}
|
|
788 |
\begin{matharray}{rcl}
|
|
789 |
assumption & : & \isarmeth \\ |
|
790 |
this & : & \isarmeth \\ |
|
791 |
rule & : & \isarmeth \\ |
|
792 |
- & : & \isarmeth \\ |
|
793 |
OF & : & \isaratt \\ |
|
794 |
of & : & \isaratt \\ |
|
795 |
intro & : & \isaratt \\ |
|
796 |
elim & : & \isaratt \\ |
|
797 |
dest & : & \isaratt \\ |
|
798 |
delrule & : & \isaratt \\ |
|
799 |
\end{matharray}
|
|
800 |
||
801 |
\begin{rail}
|
|
| 8547 | 802 |
'rule' thmrefs? |
| 8515 | 803 |
; |
804 |
'OF' thmrefs |
|
805 |
; |
|
| 8693 | 806 |
'of' insts ('concl' ':' insts)?
|
| 8515 | 807 |
; |
808 |
\end{rail}
|
|
809 |
||
810 |
\begin{descr}
|
|
811 |
\item [$assumption$] solves some goal by a single assumption step. Any facts |
|
812 |
given (${} \le 1$) are guaranteed to participate in the refinement. Recall
|
|
813 |
that $\QEDNAME$ (see \S\ref{sec:proof-steps}) already concludes any
|
|
814 |
remaining sub-goals by assumption. |
|
815 |
\item [$this$] applies all of the current facts directly as rules. Recall |
|
816 |
that ``$\DOT$'' (dot) abbreviates $\BY{this}$.
|
|
| 8547 | 817 |
\item [$rule~\vec a$] applies some rule given as argument in backward manner; |
| 8515 | 818 |
facts are used to reduce the rule before applying it to the goal. Thus |
819 |
$rule$ without facts is plain \emph{introduction}, while with facts it
|
|
820 |
becomes \emph{elimination}.
|
|
821 |
||
| 8547 | 822 |
When no arguments are given, the $rule$ method tries to pick appropriate |
823 |
rules automatically, as declared in the current context using the $intro$, |
|
824 |
$elim$, $dest$ attributes (see below). This is the default behavior of |
|
825 |
$\PROOFNAME$ and ``$\DDOT$'' (double-dot) steps (see |
|
| 8515 | 826 |
\S\ref{sec:proof-steps}).
|
827 |
\item [``$-$''] does nothing but insert the forward chaining facts as premises |
|
828 |
into the goal. Note that command $\PROOFNAME$ without any method actually |
|
829 |
performs a single reduction step using the $rule$ method; thus a plain |
|
830 |
\emph{do-nothing} proof step would be $\PROOF{-}$ rather than $\PROOFNAME$
|
|
831 |
alone. |
|
| 8547 | 832 |
\item [$OF~\vec a$] applies some theorem to given rules $\vec a$ (in |
833 |
parallel). This corresponds to the \texttt{MRS} operator in ML
|
|
834 |
\cite[\S5]{isabelle-ref}, but note the reversed order. Positions may be
|
|
835 |
skipped by including ``$\_$'' (underscore) as argument. |
|
836 |
\item [$of~\vec t$] performs positional instantiation. The terms $\vec t$ are |
|
| 8515 | 837 |
substituted for any schematic variables occurring in a theorem from left to |
838 |
right; ``\texttt{_}'' (underscore) indicates to skip a position. Arguments
|
|
839 |
following a ``$concl\colon$'' specification refer to positions of the |
|
840 |
conclusion of a rule. |
|
841 |
\item [$intro$, $elim$, and $dest$] declare introduction, elimination, and |
|
842 |
destruct rules, respectively. Note that the classical reasoner (see |
|
843 |
\S\ref{sec:classical-basic}) introduces different versions of these
|
|
844 |
attributes, and the $rule$ method, too. In object-logics with classical |
|
845 |
reasoning enabled, the latter version should be used all the time to avoid |
|
846 |
confusion! |
|
847 |
\item [$delrule$] undeclares introduction or elimination rules. |
|
| 7315 | 848 |
\end{descr}
|
849 |
||
850 |
||
851 |
\subsection{Term abbreviations}\label{sec:term-abbrev}
|
|
852 |
||
853 |
\indexisarcmd{let}
|
|
854 |
\begin{matharray}{rcl}
|
|
855 |
\isarcmd{let} & : & \isartrans{proof(state)}{proof(state)} \\
|
|
856 |
\isarkeyword{is} & : & syntax \\
|
|
857 |
\end{matharray}
|
|
858 |
||
859 |
Abbreviations may be either bound by explicit $\LET{p \equiv t}$ statements,
|
|
| 7987 | 860 |
or by annotating assumptions or goal statements with a list of patterns |
861 |
$\ISS{p@1\;\dots}{p@n}$. In both cases, higher-order matching is invoked to
|
|
862 |
bind extra-logical term variables, which may be either named schematic |
|
863 |
variables of the form $\Var{x}$, or nameless dummies ``\texttt{_}''
|
|
864 |
(underscore).\indexisarvar{_@\texttt{_}} Note that in the $\LETNAME$ form the
|
|
865 |
patterns occur on the left-hand side, while the $\ISNAME$ patterns are in |
|
866 |
postfix position. |
|
| 7315 | 867 |
|
|
8620
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
868 |
Polymorphism of term bindings is handled in Hindley-Milner style, as in ML. |
|
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
869 |
Type variables referring to local assumptions or open goal statements are |
|
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
870 |
\emph{fixed}, while those of finished results or bound by $\LETNAME$ may occur
|
|
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
871 |
in \emph{arbitrary} instances later. Even though actual polymorphism should
|
|
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
872 |
be rarely used in practice, this mechanism is essential to achieve proper |
|
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
873 |
incremental type-inference, as the user proceeds to build up the Isar proof |
|
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
874 |
text. |
|
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
875 |
|
|
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
876 |
\medskip |
|
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
877 |
|
| 7319 | 878 |
Term abbreviations are quite different from actual local definitions as |
879 |
introduced via $\DEFNAME$ (see \S\ref{sec:proof-context}). The latter are
|
|
| 7315 | 880 |
visible within the logic as actual equations, while abbreviations disappear |
|
8620
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
881 |
during the input process just after type checking. Also note that $\DEFNAME$ |
|
3786d47f5570
support Hindley-Milner polymorphisms in results and bindings;
wenzelm
parents:
8547
diff
changeset
|
882 |
does not support polymorphism. |
| 7315 | 883 |
|
884 |
\begin{rail}
|
|
| 8664 | 885 |
'let' ((term + 'and') '=' term comment? + 'and') |
| 7315 | 886 |
; |
887 |
\end{rail}
|
|
888 |
||
889 |
The syntax of $\ISNAME$ patterns follows \railnonterm{termpat} or
|
|
890 |
\railnonterm{proppat} (see \S\ref{sec:term-pats}).
|
|
891 |
||
892 |
\begin{descr}
|
|
893 |
\item [$\LET{\vec p = \vec t}$] binds any text variables in patters $\vec p$
|
|
894 |
by simultaneous higher-order matching against terms $\vec t$. |
|
895 |
\item [$\IS{\vec p}$] resembles $\LETNAME$, but matches $\vec p$ against the
|
|
896 |
preceding statement. Also note that $\ISNAME$ is not a separate command, |
|
897 |
but part of others (such as $\ASSUMENAME$, $\HAVENAME$ etc.). |
|
898 |
\end{descr}
|
|
899 |
||
| 7988 | 900 |
A few \emph{automatic} term abbreviations\index{term abbreviations} for goals
|
901 |
and facts are available as well. For any open goal, |
|
| 7466 | 902 |
$\Var{thesis_prop}$\indexisarvar{thesis-prop} refers to the full proposition
|
903 |
(which may be a rule), $\Var{thesis_concl}$\indexisarvar{thesis-concl} to its
|
|
904 |
(atomic) conclusion, and $\Var{thesis}$\indexisarvar{thesis} to its
|
|
| 8547 | 905 |
object-level statement. The latter two abstract over any meta-level |
| 7987 | 906 |
parameters. |
| 7315 | 907 |
|
| 7466 | 908 |
Fact statements resulting from assumptions or finished goals are bound as |
909 |
$\Var{this_prop}$\indexisarvar{this-prop},
|
|
910 |
$\Var{this_concl}$\indexisarvar{this-concl}, and
|
|
911 |
$\Var{this}$\indexisarvar{this}, similar to $\Var{thesis}$ above. In case
|
|
912 |
$\Var{this}$ refers to an object-logic statement that is an application
|
|
| 7895 | 913 |
$f(t)$, then $t$ is bound to the special text variable |
| 7466 | 914 |
``$\dots$''\indexisarvar{\dots} (three dots). The canonical application of
|
| 7987 | 915 |
the latter are calculational proofs (see \S\ref{sec:calculation}).
|
| 7315 | 916 |
|
917 |
||
| 7134 | 918 |
\subsection{Block structure}
|
919 |
||
| 8896 | 920 |
\indexisarcmd{next}\indexisarcmd{\{}\indexisarcmd{\}}
|
| 7397 | 921 |
\begin{matharray}{rcl}
|
| 8448 | 922 |
\NEXT & : & \isartrans{proof(state)}{proof(state)} \\
|
| 7974 | 923 |
\BG & : & \isartrans{proof(state)}{proof(state)} \\
|
924 |
\EN & : & \isartrans{proof(state)}{proof(state)} \\
|
|
| 7397 | 925 |
\end{matharray}
|
926 |
||
| 9030 | 927 |
\railalias{lbrace}{\ttlbrace}
|
928 |
\railterm{lbrace}
|
|
929 |
||
930 |
\railalias{rbrace}{\ttrbrace}
|
|
931 |
\railterm{rbrace}
|
|
932 |
||
933 |
\begin{rail}
|
|
934 |
'next' comment? |
|
935 |
; |
|
936 |
lbrace comment? |
|
937 |
; |
|
938 |
rbrace comment? |
|
939 |
; |
|
940 |
\end{rail}
|
|
941 |
||
| 7167 | 942 |
While Isar is inherently block-structured, opening and closing blocks is |
943 |
mostly handled rather casually, with little explicit user-intervention. Any |
|
944 |
local goal statement automatically opens \emph{two} blocks, which are closed
|
|
945 |
again when concluding the sub-proof (by $\QEDNAME$ etc.). Sections of |
|
| 8448 | 946 |
different context within a sub-proof may be switched via $\NEXT$, which is |
947 |
just a single block-close followed by block-open again. Thus the effect of |
|
948 |
$\NEXT$ to reset the local proof context. There is no goal focus involved |
|
949 |
here! |
|
| 7167 | 950 |
|
| 7175 | 951 |
For slightly more advanced applications, there are explicit block parentheses |
| 7895 | 952 |
as well. These typically achieve a stronger forward style of reasoning. |
| 7167 | 953 |
|
954 |
\begin{descr}
|
|
| 8448 | 955 |
\item [$\NEXT$] switches to a fresh block within a sub-proof, resetting the |
956 |
local context to the initial one. |
|
| 8896 | 957 |
\item [$\BG$ and $\EN$] explicitly open and close blocks. Any current facts |
958 |
pass through ``$\BG$'' unchanged, while ``$\EN$'' causes any result to be |
|
| 7895 | 959 |
\emph{exported} into the enclosing context. Thus fixed variables are
|
960 |
generalized, assumptions discharged, and local definitions unfolded (cf.\ |
|
961 |
\S\ref{sec:proof-context}). There is no difference of $\ASSUMENAME$ and
|
|
962 |
$\PRESUMENAME$ in this mode of forward reasoning --- in contrast to plain |
|
963 |
backward reasoning with the result exported at $\SHOWNAME$ time. |
|
| 7167 | 964 |
\end{descr}
|
| 7134 | 965 |
|
966 |
||
| 8533 | 967 |
\subsection{Emulating tactic scripts}\label{sec:tactical-proof}
|
| 8515 | 968 |
|
969 |
The following elements emulate unstructured tactic scripts to some extent. |
|
970 |
While these are anathema for writing proper Isar proof documents, they might |
|
971 |
come in handy for interactive exploration and debugging, or even actual |
|
972 |
tactical proof within new-style theories (to benefit from document |
|
973 |
preparation, for example). |
|
974 |
||
| 8946 | 975 |
\indexisarcmd{apply}\indexisarcmd{done}\indexisarcmd{apply-end}
|
| 8515 | 976 |
\indexisarcmd{defer}\indexisarcmd{prefer}\indexisarcmd{back}
|
977 |
\begin{matharray}{rcl}
|
|
| 8533 | 978 |
\isarcmd{apply}^* & : & \isartrans{proof(prove)}{proof(prove)} \\
|
| 8946 | 979 |
\isarcmd{done}^* & : & \isartrans{proof(prove)}{proof(state)} \\
|
| 8533 | 980 |
\isarcmd{apply_end}^* & : & \isartrans{proof(state)}{proof(state)} \\
|
981 |
\isarcmd{defer}^* & : & \isartrans{proof}{proof} \\
|
|
982 |
\isarcmd{prefer}^* & : & \isartrans{proof}{proof} \\
|
|
983 |
\isarcmd{back}^* & : & \isartrans{proof}{proof} \\
|
|
| 8515 | 984 |
\end{matharray}
|
985 |
||
986 |
\railalias{applyend}{apply\_end}
|
|
987 |
\railterm{applyend}
|
|
988 |
||
989 |
\begin{rail}
|
|
| 8682 | 990 |
'apply' method comment? |
| 8515 | 991 |
; |
| 8946 | 992 |
'done' comment? |
993 |
; |
|
| 8682 | 994 |
applyend method comment? |
| 8515 | 995 |
; |
| 8682 | 996 |
'defer' nat? comment? |
| 8515 | 997 |
; |
| 8682 | 998 |
'prefer' nat comment? |
| 8515 | 999 |
; |
1000 |
\end{rail}
|
|
1001 |
||
1002 |
\begin{descr}
|
|
| 8547 | 1003 |
\item [$\isarkeyword{apply}~(m)$] applies proof method $m$ in initial
|
1004 |
position, but unlike $\PROOFNAME$ it retains ``$proof(prove)$'' mode. Thus |
|
| 8946 | 1005 |
consecutive method applications may be given just as in tactic scripts. |
| 8515 | 1006 |
|
| 8881 | 1007 |
Facts are passed to $m$ as indicated by the goal's forward-chain mode, and |
1008 |
are \emph{consumed} afterwards. Thus any further $\isarkeyword{apply}$
|
|
1009 |
command would always work in a purely backward manner. |
|
| 8946 | 1010 |
|
1011 |
\item [$\isarkeyword{done}$] completes a proof script, provided that the
|
|
| 8947 | 1012 |
current goal state is already solved completely. Note that actual |
1013 |
structured proof commands (e.g.\ ``$\DOT$'' or $\SORRY$) may be used to |
|
1014 |
conclude proof scripts as well. |
|
| 8881 | 1015 |
|
| 8515 | 1016 |
\item [$\isarkeyword{apply_end}~(m)$] applies proof method $m$ as if in
|
1017 |
terminal position. Basically, this simulates a multi-step tactic script for |
|
1018 |
$\QEDNAME$, but may be given anywhere within the proof body. |
|
1019 |
||
1020 |
No facts are passed to $m$. Furthermore, the static context is that of the |
|
1021 |
enclosing goal (as for actual $\QEDNAME$). Thus the proof method may not |
|
1022 |
refer to any assumptions introduced in the current body, for example. |
|
1023 |
\item [$\isarkeyword{defer}~n$ and $\isarkeyword{prefer}~n$] shuffle the list
|
|
1024 |
of pending goals: $defer$ puts off goal $n$ to the end of the list ($n = 1$ |
|
1025 |
by default), while $prefer$ brings goal $n$ to the top. |
|
1026 |
\item [$\isarkeyword{back}$] does back-tracking over the result sequence of
|
|
1027 |
the latest proof command.\footnote{Unlike the ML function \texttt{back}
|
|
1028 |
\cite{isabelle-ref}, the Isar command does not search upwards for further
|
|
1029 |
branch points.} Basically, any proof command may return multiple results. |
|
| 9006 | 1030 |
\end{descr}
|
1031 |
||
1032 |
Any proper Isar proof method may be used with tactic script commands such as |
|
1033 |
$\isarkeyword{apply}$. A few additional emulations of actual tactics are
|
|
1034 |
provided as well; these would be never used in actual structured proofs, of |
|
1035 |
course. |
|
1036 |
||
1037 |
\indexisarmeth{tactic}\indexisarmeth{insert}
|
|
1038 |
\indexisarmeth{res-inst-tac}\indexisarmeth{eres-inst-tac}
|
|
1039 |
\indexisarmeth{dres-inst-tac}\indexisarmeth{forw-inst-tac}
|
|
1040 |
\indexisarmeth{subgoal-tac}
|
|
1041 |
\begin{matharray}{rcl}
|
|
1042 |
tactic^* & : & \isarmeth \\ |
|
1043 |
insert^* & : & \isarmeth \\ |
|
1044 |
res_inst_tac^* & : & \isarmeth \\ |
|
1045 |
eres_inst_tac^* & : & \isarmeth \\ |
|
1046 |
dres_inst_tac^* & : & \isarmeth \\ |
|
1047 |
forw_inst_tac^* & : & \isarmeth \\ |
|
1048 |
subgoal_tac^* & : & \isarmeth \\ |
|
1049 |
\end{matharray}
|
|
1050 |
||
1051 |
\railalias{resinsttac}{res\_inst\_tac}
|
|
1052 |
\railterm{resinsttac}
|
|
1053 |
||
1054 |
\railalias{eresinsttac}{eres\_inst\_tac}
|
|
1055 |
\railterm{eresinsttac}
|
|
1056 |
||
1057 |
\railalias{dresinsttac}{dres\_inst\_tac}
|
|
1058 |
\railterm{dresinsttac}
|
|
1059 |
||
1060 |
\railalias{forwinsttac}{forw\_inst\_tac}
|
|
1061 |
\railterm{forwinsttac}
|
|
1062 |
||
1063 |
\railalias{subgoaltac}{subgoal\_tac}
|
|
1064 |
\railterm{subgoaltac}
|
|
1065 |
||
1066 |
\begin{rail}
|
|
1067 |
'tactic' text |
|
1068 |
; |
|
1069 |
'insert' thmrefs |
|
1070 |
; |
|
1071 |
( resinsttac | eresinsttac | dresinsttac | forwinsttac ) goalspec? \\ |
|
1072 |
((name '=' term) + 'and') 'in' thmref |
|
1073 |
; |
|
1074 |
subgoaltac goalspec? prop |
|
1075 |
; |
|
1076 |
\end{rail}
|
|
1077 |
||
1078 |
\begin{descr}
|
|
| 8515 | 1079 |
\item [$tactic~text$] produces a proof method from any ML text of type |
| 8547 | 1080 |
\texttt{tactic}. Apart from the usual ML environment and the current
|
| 8515 | 1081 |
implicit theory context, the ML code may refer to the following locally |
1082 |
bound values: |
|
| 9006 | 1083 |
|
| 8515 | 1084 |
%%FIXME ttbox produces too much trailing space (why?) |
1085 |
{\footnotesize\begin{verbatim}
|
|
1086 |
val ctxt : Proof.context |
|
1087 |
val facts : thm list |
|
1088 |
val thm : string -> thm |
|
1089 |
val thms : string -> thm list |
|
1090 |
\end{verbatim}}
|
|
1091 |
Here \texttt{ctxt} refers to the current proof context, \texttt{facts}
|
|
1092 |
indicates any current facts for forward-chaining, and |
|
1093 |
\texttt{thm}~/~\texttt{thms} retrieve named facts (including global
|
|
1094 |
theorems) from the context. |
|
| 8696 | 1095 |
\item [$insert~\vec a$] inserts theorems as facts into all goals of the proof |
1096 |
state; the current facts indicated for forward chaining are ignored! |
|
| 8533 | 1097 |
\item [$res_inst_tac$ etc.] do resolution of rules with explicit |
1098 |
instantiation. This works the same way as the corresponding ML tactics, see |
|
1099 |
\cite[\S3]{isabelle-ref}.
|
|
1100 |
||
1101 |
It is very important to note that the instantiations are read and |
|
1102 |
type-checked according to the dynamic goal state, rather than the static |
|
1103 |
proof context! In particular, locally fixed variables and term |
|
1104 |
abbreviations may not be included in the term specifications. |
|
| 8547 | 1105 |
\item [$subgoal_tac~\phi$] emulates the ML tactic of the same name, see |
| 8533 | 1106 |
\cite[\S3]{isabelle-ref}. Syntactically, the given proposition is handled
|
1107 |
as the instantiations in $res_inst_tac$ etc. |
|
1108 |
||
1109 |
Note that the proper Isar command $\PRESUMENAME$ achieves a similar effect |
|
1110 |
as $subgoal_tac$. |
|
| 8515 | 1111 |
\end{descr}
|
1112 |
||
1113 |
||
1114 |
\subsection{Meta-linguistic features}
|
|
1115 |
||
1116 |
\indexisarcmd{oops}
|
|
1117 |
\begin{matharray}{rcl}
|
|
1118 |
\isarcmd{oops} & : & \isartrans{proof}{theory} \\
|
|
1119 |
\end{matharray}
|
|
1120 |
||
1121 |
The $\OOPS$ command discontinues the current proof attempt, while considering |
|
1122 |
the partial proof text as properly processed. This is conceptually quite |
|
1123 |
different from ``faking'' actual proofs via $\SORRY$ (see |
|
1124 |
\S\ref{sec:proof-steps}): $\OOPS$ does not observe the proof structure at all,
|
|
1125 |
but goes back right to the theory level. Furthermore, $\OOPS$ does not |
|
1126 |
produce any result theorem --- there is no claim to be able to complete the |
|
1127 |
proof anyhow. |
|
1128 |
||
1129 |
A typical application of $\OOPS$ is to explain Isar proofs \emph{within} the
|
|
1130 |
system itself, in conjunction with the document preparation tools of Isabelle |
|
1131 |
described in \cite{isabelle-sys}. Thus partial or even wrong proof attempts
|
|
1132 |
can be discussed in a logically sound manner. Note that the Isabelle {\LaTeX}
|
|
1133 |
macros can be easily adapted to print something like ``$\dots$'' instead of an |
|
1134 |
``$\OOPS$'' keyword. |
|
1135 |
||
| 8547 | 1136 |
\medskip The $\OOPS$ command is undoable, unlike $\isarkeyword{kill}$ (see
|
1137 |
\S\ref{sec:history}). The effect is to get back to the theory \emph{before}
|
|
1138 |
the opening of the proof. |
|
| 8515 | 1139 |
|
1140 |
||
| 7134 | 1141 |
\section{Other commands}
|
1142 |
||
| 8448 | 1143 |
\subsection{Diagnostics}\label{sec:diag}
|
| 7134 | 1144 |
|
| 8485 | 1145 |
\indexisarcmd{pr}\indexisarcmd{thm}\indexisarcmd{term}\indexisarcmd{prop}\indexisarcmd{typ}
|
1146 |
\indexisarcmd{print-facts}\indexisarcmd{print-binds}
|
|
| 7134 | 1147 |
\begin{matharray}{rcl}
|
| 8515 | 1148 |
\isarcmd{help}^* & : & \isarkeep{\cdot} \\
|
1149 |
\isarcmd{pr}^* & : & \isarkeep{\cdot} \\
|
|
1150 |
\isarcmd{thm}^* & : & \isarkeep{theory~|~proof} \\
|
|
1151 |
\isarcmd{term}^* & : & \isarkeep{theory~|~proof} \\
|
|
1152 |
\isarcmd{prop}^* & : & \isarkeep{theory~|~proof} \\
|
|
1153 |
\isarcmd{typ}^* & : & \isarkeep{theory~|~proof} \\
|
|
1154 |
\isarcmd{print_facts}^* & : & \isarkeep{proof} \\
|
|
1155 |
\isarcmd{print_binds}^* & : & \isarkeep{proof} \\
|
|
| 7134 | 1156 |
\end{matharray}
|
1157 |
||
| 7335 | 1158 |
These commands are not part of the actual Isabelle/Isar syntax, but assist |
1159 |
interactive development. Also note that $undo$ does not apply here, since the |
|
1160 |
theory or proof configuration is not changed. |
|
1161 |
||
| 7134 | 1162 |
\begin{rail}
|
| 8485 | 1163 |
'pr' modes? nat? |
| 7134 | 1164 |
; |
| 8485 | 1165 |
'thm' modes? thmrefs |
1166 |
; |
|
1167 |
'term' modes? term |
|
| 7134 | 1168 |
; |
| 8485 | 1169 |
'prop' modes? prop |
| 7134 | 1170 |
; |
| 8485 | 1171 |
'typ' modes? type |
1172 |
; |
|
1173 |
||
1174 |
modes: '(' (name + ) ')'
|
|
| 7134 | 1175 |
; |
1176 |
\end{rail}
|
|
1177 |
||
| 7167 | 1178 |
\begin{descr}
|
| 8515 | 1179 |
\item [$\isarkeyword{help}$] prints a list of available language elements.
|
1180 |
Note that methods and attributes depend on the current theory context. |
|
| 8883 | 1181 |
\item [$\isarkeyword{pr}~n$] prints the current proof state (if present),
|
1182 |
including the proof context, current facts and goals. The optional argument |
|
1183 |
$n$ affects the implicit limit of goals to be displayed, which is initially |
|
1184 |
10. Omitting the limit leaves the current value unchanged. |
|
| 8547 | 1185 |
\item [$\isarkeyword{thm}~\vec a$] retrieves theorems from the current theory
|
1186 |
or proof context. Note that any attributes included in the theorem |
|
| 7974 | 1187 |
specifications are applied to a temporary context derived from the current |
| 8547 | 1188 |
theory or proof; the result is discarded, i.e.\ attributes involved in $\vec |
1189 |
a$ do not have any permanent effect. |
|
| 7987 | 1190 |
\item [$\isarkeyword{term}~t$, $\isarkeyword{prop}~\phi$] read, type-check and
|
1191 |
print terms or propositions according to the current theory or proof |
|
| 7895 | 1192 |
context; the inferred type of $t$ is output as well. Note that these |
1193 |
commands are also useful in inspecting the current environment of term |
|
1194 |
abbreviations. |
|
| 7974 | 1195 |
\item [$\isarkeyword{typ}~\tau$] reads and prints types of the meta-logic
|
1196 |
according to the current theory or proof context. |
|
| 8379 | 1197 |
\item [$\isarkeyword{print_facts}$] prints any named facts of the current
|
1198 |
context, including assumptions and local results. |
|
1199 |
\item [$\isarkeyword{print_binds}$] prints all term abbreviations present in
|
|
1200 |
the context. |
|
| 8485 | 1201 |
\end{descr}
|
1202 |
||
1203 |
The basic diagnostic commands above admit a list of $modes$ to be specified, |
|
1204 |
which is appended to the current print mode (see also \cite{isabelle-ref}).
|
|
1205 |
Thus the output behavior may be modified according particular print mode |
|
1206 |
features. |
|
1207 |
||
1208 |
For example, $\isarkeyword{pr}~(latex~xsymbols~symbols)$ would print the
|
|
1209 |
current proof state with mathematical symbols and special characters |
|
1210 |
represented in {\LaTeX} source, according to the Isabelle style
|
|
| 8547 | 1211 |
\cite{isabelle-sys}. The resulting text can be directly pasted into a
|
1212 |
\verb,\begin{isabelle},\dots\verb,\end{isabelle}, environment. Note that
|
|
1213 |
$\isarkeyword{pr}~(latex)$ is sufficient to achieve the same output, if the
|
|
1214 |
current Isabelle session has the other modes already activated, say due to |
|
1215 |
some particular user interface configuration such as Proof~General |
|
| 8510 | 1216 |
\cite{proofgeneral,Aspinall:TACAS:2000} with X-Symbol mode \cite{x-symbol}.
|
| 8485 | 1217 |
|
1218 |
||
1219 |
\subsection{History commands}\label{sec:history}
|
|
1220 |
||
1221 |
\indexisarcmd{undo}\indexisarcmd{redo}\indexisarcmd{kill}
|
|
1222 |
\begin{matharray}{rcl}
|
|
1223 |
\isarcmd{undo}^{{*}{*}} & : & \isarkeep{\cdot} \\
|
|
1224 |
\isarcmd{redo}^{{*}{*}} & : & \isarkeep{\cdot} \\
|
|
1225 |
\isarcmd{kill}^{{*}{*}} & : & \isarkeep{\cdot} \\
|
|
1226 |
\end{matharray}
|
|
1227 |
||
1228 |
The Isabelle/Isar top-level maintains a two-stage history, for theory and |
|
1229 |
proof state transformation. Basically, any command can be undone using |
|
1230 |
$\isarkeyword{undo}$, excluding mere diagnostic elements. Its effect may be
|
|
1231 |
revoked via $\isarkeyword{redo}$, unless the corresponding the
|
|
1232 |
$\isarkeyword{undo}$ step has crossed the beginning of a proof or theory. The
|
|
1233 |
$\isarkeyword{kill}$ command aborts the current history node altogether,
|
|
1234 |
discontinuing a proof or even the whole theory. This operation is \emph{not}
|
|
1235 |
undoable. |
|
1236 |
||
1237 |
\begin{warn}
|
|
| 8547 | 1238 |
History commands should never be used with user interfaces such as |
1239 |
Proof~General \cite{proofgeneral,Aspinall:TACAS:2000}, which takes care of
|
|
1240 |
stepping forth and back itself. Interfering by manual $\isarkeyword{undo}$,
|
|
| 8510 | 1241 |
$\isarkeyword{redo}$, or even $\isarkeyword{kill}$ commands would quickly
|
1242 |
result in utter confusion. |
|
| 8485 | 1243 |
\end{warn}
|
1244 |
||
| 8515 | 1245 |
%FIXME remove |
1246 |
% \begin{descr}
|
|
1247 |
% \item [$\isarkeyword{undo}$] revokes the latest state-transforming command.
|
|
1248 |
% \item [$\isarkeyword{redo}$] undos the latest $\isarkeyword{undo}$.
|
|
1249 |
% \item [$\isarkeyword{kill}$] aborts the current history level.
|
|
1250 |
% \end{descr}
|
|
| 8485 | 1251 |
|
| 8379 | 1252 |
|
| 7134 | 1253 |
\subsection{System operations}
|
1254 |
||
| 7167 | 1255 |
\indexisarcmd{cd}\indexisarcmd{pwd}\indexisarcmd{use-thy}\indexisarcmd{use-thy-only}
|
1256 |
\indexisarcmd{update-thy}\indexisarcmd{update-thy-only}
|
|
| 7134 | 1257 |
\begin{matharray}{rcl}
|
| 8515 | 1258 |
\isarcmd{cd}^* & : & \isarkeep{\cdot} \\
|
1259 |
\isarcmd{pwd}^* & : & \isarkeep{\cdot} \\
|
|
1260 |
\isarcmd{use_thy}^* & : & \isarkeep{\cdot} \\
|
|
1261 |
\isarcmd{use_thy_only}^* & : & \isarkeep{\cdot} \\
|
|
1262 |
\isarcmd{update_thy}^* & : & \isarkeep{\cdot} \\
|
|
1263 |
\isarcmd{update_thy_only}^* & : & \isarkeep{\cdot} \\
|
|
| 7134 | 1264 |
\end{matharray}
|
1265 |
||
| 7167 | 1266 |
\begin{descr}
|
| 7134 | 1267 |
\item [$\isarkeyword{cd}~name$] changes the current directory of the Isabelle
|
1268 |
process. |
|
1269 |
\item [$\isarkeyword{pwd}~$] prints the current working directory.
|
|
| 7175 | 1270 |
\item [$\isarkeyword{use_thy}$, $\isarkeyword{use_thy_only}$,
|
| 7987 | 1271 |
$\isarkeyword{update_thy}$, $\isarkeyword{update_thy_only}$] load some
|
| 7895 | 1272 |
theory given as $name$ argument. These commands are basically the same as |
| 7987 | 1273 |
the corresponding ML functions\footnote{The ML versions also change the
|
1274 |
implicit theory context to that of the theory loaded.} (see also |
|
1275 |
\cite[\S1,\S6]{isabelle-ref}). Note that both the ML and Isar versions may
|
|
1276 |
load new- and old-style theories alike. |
|
| 7167 | 1277 |
\end{descr}
|
| 7134 | 1278 |
|
| 7987 | 1279 |
These system commands are scarcely used when working with the Proof~General |
1280 |
interface, since loading of theories is done fully transparently. |
|
| 7134 | 1281 |
|
| 8379 | 1282 |
|
| 7046 | 1283 |
%%% Local Variables: |
1284 |
%%% mode: latex |
|
1285 |
%%% TeX-master: "isar-ref" |
|
1286 |
%%% End: |