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