27037
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
|
3 |
\def\isabellecontext{Outer{\isacharunderscore}Syntax}%
|
|
4 |
%
|
|
5 |
\isadelimtheory
|
|
6 |
\isanewline
|
|
7 |
\isanewline
|
|
8 |
%
|
|
9 |
\endisadelimtheory
|
|
10 |
%
|
|
11 |
\isatagtheory
|
|
12 |
\isacommand{theory}\isamarkupfalse%
|
|
13 |
\ Outer{\isacharunderscore}Syntax\isanewline
|
|
14 |
\isakeyword{imports}\ Pure\isanewline
|
|
15 |
\isakeyword{begin}%
|
|
16 |
\endisatagtheory
|
|
17 |
{\isafoldtheory}%
|
|
18 |
%
|
|
19 |
\isadelimtheory
|
|
20 |
%
|
|
21 |
\endisadelimtheory
|
|
22 |
%
|
|
23 |
\isamarkupchapter{Syntax primitives%
|
|
24 |
}
|
|
25 |
\isamarkuptrue%
|
|
26 |
%
|
|
27 |
\begin{isamarkuptext}%
|
|
28 |
The rather generic framework of Isabelle/Isar syntax emerges from
|
|
29 |
three main syntactic categories: \emph{commands} of the top-level
|
|
30 |
Isar engine (covering theory and proof elements), \emph{methods} for
|
|
31 |
general goal refinements (analogous to traditional ``tactics''), and
|
|
32 |
\emph{attributes} for operations on facts (within a certain
|
|
33 |
context). Subsequently we give a reference of basic syntactic
|
|
34 |
entities underlying Isabelle/Isar syntax in a bottom-up manner.
|
|
35 |
Concrete theory and proof language elements will be introduced later
|
|
36 |
on.
|
|
37 |
|
|
38 |
\medskip In order to get started with writing well-formed
|
|
39 |
Isabelle/Isar documents, the most important aspect to be noted is
|
|
40 |
the difference of \emph{inner} versus \emph{outer} syntax. Inner
|
|
41 |
syntax is that of Isabelle types and terms of the logic, while outer
|
|
42 |
syntax is that of Isabelle/Isar theory sources (specifications and
|
|
43 |
proofs). As a general rule, inner syntax entities may occur only as
|
|
44 |
\emph{atomic entities} within outer syntax. For example, the string
|
|
45 |
\verb|"x + y"| and identifier \verb|z| are legal term
|
|
46 |
specifications within a theory, while \verb|x + y| without
|
|
47 |
quotes is not.
|
|
48 |
|
|
49 |
Printed theory documents usually omit quotes to gain readability
|
|
50 |
(this is a matter of {\LaTeX} macro setup, say via \verb|\isabellestyle|, see also \cite{isabelle-sys}). Experienced
|
|
51 |
users of Isabelle/Isar may easily reconstruct the lost technical
|
|
52 |
information, while mere readers need not care about quotes at all.
|
|
53 |
|
|
54 |
\medskip Isabelle/Isar input may contain any number of input
|
|
55 |
termination characters ``\verb|;|'' (semicolon) to separate
|
|
56 |
commands explicitly. This is particularly useful in interactive
|
|
57 |
shell sessions to make clear where the current command is intended
|
|
58 |
to end. Otherwise, the interpreter loop will continue to issue a
|
|
59 |
secondary prompt ``\verb|#|'' until an end-of-command is
|
|
60 |
clearly recognized from the input syntax, e.g.\ encounter of the
|
|
61 |
next command keyword.
|
|
62 |
|
|
63 |
More advanced interfaces such as Proof~General \cite{proofgeneral}
|
|
64 |
do not require explicit semicolons, the amount of input text is
|
|
65 |
determined automatically by inspecting the present content of the
|
|
66 |
Emacs text buffer. In the printed presentation of Isabelle/Isar
|
|
67 |
documents semicolons are omitted altogether for readability.
|
|
68 |
|
|
69 |
\begin{warn}
|
|
70 |
Proof~General requires certain syntax classification tables in
|
|
71 |
order to achieve properly synchronized interaction with the
|
|
72 |
Isabelle/Isar process. These tables need to be consistent with
|
|
73 |
the Isabelle version and particular logic image to be used in a
|
|
74 |
running session (common object-logics may well change the outer
|
|
75 |
syntax). The standard setup should work correctly with any of the
|
|
76 |
``official'' logic images derived from Isabelle/HOL (including
|
|
77 |
HOLCF etc.). Users of alternative logics may need to tell
|
|
78 |
Proof~General explicitly, e.g.\ by giving an option \verb|-k ZF|
|
|
79 |
(in conjunction with \verb|-l ZF|, to specify the default
|
|
80 |
logic image). Note that option \verb|-L| does both
|
|
81 |
of this at the same time.
|
|
82 |
\end{warn}%
|
|
83 |
\end{isamarkuptext}%
|
|
84 |
\isamarkuptrue%
|
|
85 |
%
|
|
86 |
\isamarkupsection{Lexical matters \label{sec:lex-syntax}%
|
|
87 |
}
|
|
88 |
\isamarkuptrue%
|
|
89 |
%
|
|
90 |
\begin{isamarkuptext}%
|
|
91 |
The Isabelle/Isar outer syntax provides token classes as presented
|
|
92 |
below; most of these coincide with the inner lexical syntax as
|
|
93 |
presented in \cite{isabelle-ref}.
|
|
94 |
|
|
95 |
\begin{matharray}{rcl}
|
|
96 |
\indexdef{}{syntax}{ident}\hypertarget{syntax.ident}{\hyperlink{syntax.ident}{\mbox{\isa{ident}}}} & = & letter\,quasiletter^* \\
|
|
97 |
\indexdef{}{syntax}{longident}\hypertarget{syntax.longident}{\hyperlink{syntax.longident}{\mbox{\isa{longident}}}} & = & ident (\verb,.,ident)^+ \\
|
|
98 |
\indexdef{}{syntax}{symident}\hypertarget{syntax.symident}{\hyperlink{syntax.symident}{\mbox{\isa{symident}}}} & = & sym^+ ~|~ \verb,\,\verb,<,ident\verb,>, \\
|
|
99 |
\indexdef{}{syntax}{nat}\hypertarget{syntax.nat}{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}} & = & digit^+ \\
|
|
100 |
\indexdef{}{syntax}{var}\hypertarget{syntax.var}{\hyperlink{syntax.var}{\mbox{\isa{var}}}} & = & ident ~|~ \verb,?,ident ~|~ \verb,?,ident\verb,.,nat \\
|
|
101 |
\indexdef{}{syntax}{typefree}\hypertarget{syntax.typefree}{\hyperlink{syntax.typefree}{\mbox{\isa{typefree}}}} & = & \verb,',ident \\
|
|
102 |
\indexdef{}{syntax}{typevar}\hypertarget{syntax.typevar}{\hyperlink{syntax.typevar}{\mbox{\isa{typevar}}}} & = & typefree ~|~ \verb,?,typefree ~|~ \verb,?,typefree\verb,.,nat \\
|
|
103 |
\indexdef{}{syntax}{string}\hypertarget{syntax.string}{\hyperlink{syntax.string}{\mbox{\isa{string}}}} & = & \verb,", ~\dots~ \verb,", \\
|
|
104 |
\indexdef{}{syntax}{altstring}\hypertarget{syntax.altstring}{\hyperlink{syntax.altstring}{\mbox{\isa{altstring}}}} & = & \backquote ~\dots~ \backquote \\
|
|
105 |
\indexdef{}{syntax}{verbatim}\hypertarget{syntax.verbatim}{\hyperlink{syntax.verbatim}{\mbox{\isa{verbatim}}}} & = & \verb,{*, ~\dots~ \verb,*,\verb,}, \\[1ex]
|
|
106 |
|
|
107 |
letter & = & latin ~|~ \verb,\,\verb,<,latin\verb,>, ~|~ \verb,\,\verb,<,latin\,latin\verb,>, ~|~ greek ~|~ \\
|
|
108 |
& & \verb,\<^isub>, ~|~ \verb,\<^isup>, \\
|
|
109 |
quasiletter & = & letter ~|~ digit ~|~ \verb,_, ~|~ \verb,', \\
|
|
110 |
latin & = & \verb,a, ~|~ \dots ~|~ \verb,z, ~|~ \verb,A, ~|~ \dots ~|~ \verb,Z, \\
|
|
111 |
digit & = & \verb,0, ~|~ \dots ~|~ \verb,9, \\
|
|
112 |
sym & = & \verb,!, ~|~ \verb,#, ~|~ \verb,$, ~|~ \verb,%, ~|~ \verb,&, ~|~
|
|
113 |
\verb,*, ~|~ \verb,+, ~|~ \verb,-, ~|~ \verb,/, ~|~ \\
|
|
114 |
& & \verb,<, ~|~ \verb,=, ~|~ \verb,>, ~|~ \verb,?, ~|~ \texttt{\at} ~|~
|
|
115 |
\verb,^, ~|~ \verb,_, ~|~ \verb,|, ~|~ \verb,~, \\
|
|
116 |
greek & = & \verb,\<alpha>, ~|~ \verb,\<beta>, ~|~ \verb,\<gamma>, ~|~ \verb,\<delta>, ~| \\
|
|
117 |
& & \verb,\<epsilon>, ~|~ \verb,\<zeta>, ~|~ \verb,\<eta>, ~|~ \verb,\<theta>, ~| \\
|
|
118 |
& & \verb,\<iota>, ~|~ \verb,\<kappa>, ~|~ \verb,\<mu>, ~|~ \verb,\<nu>, ~| \\
|
|
119 |
& & \verb,\<xi>, ~|~ \verb,\<pi>, ~|~ \verb,\<rho>, ~|~ \verb,\<sigma>, ~|~ \verb,\<tau>, ~| \\
|
|
120 |
& & \verb,\<upsilon>, ~|~ \verb,\<phi>, ~|~ \verb,\<chi>, ~|~ \verb,\<psi>, ~| \\
|
|
121 |
& & \verb,\<omega>, ~|~ \verb,\<Gamma>, ~|~ \verb,\<Delta>, ~|~ \verb,\<Theta>, ~| \\
|
|
122 |
& & \verb,\<Lambda>, ~|~ \verb,\<Xi>, ~|~ \verb,\<Pi>, ~|~ \verb,\<Sigma>, ~| \\
|
|
123 |
& & \verb,\<Upsilon>, ~|~ \verb,\<Phi>, ~|~ \verb,\<Psi>, ~|~ \verb,\<Omega>, \\
|
|
124 |
\end{matharray}
|
|
125 |
|
|
126 |
The syntax of \hyperlink{syntax.string}{\mbox{\isa{string}}} admits any characters, including
|
|
127 |
newlines; ``\verb|"|'' (double-quote) and ``\verb|\|'' (backslash) need to be escaped by a backslash; arbitrary
|
|
128 |
character codes may be specified as ``\verb|\|\isa{ddd}'',
|
|
129 |
with three decimal digits. Alternative strings according to
|
|
130 |
\hyperlink{syntax.altstring}{\mbox{\isa{altstring}}} are analogous, using single back-quotes instead.
|
|
131 |
The body of \hyperlink{syntax.verbatim}{\mbox{\isa{verbatim}}} may consist of any text not
|
|
132 |
containing ``\verb|*|\verb|}|''; this allows
|
|
133 |
convenient inclusion of quotes without further escapes. The greek
|
|
134 |
letters do \emph{not} include \verb|\<lambda>|, which is already used
|
|
135 |
differently in the meta-logic.
|
|
136 |
|
|
137 |
Common mathematical symbols such as \isa{{\isasymforall}} are represented in
|
|
138 |
Isabelle as \verb|\<forall>|. There are infinitely many Isabelle
|
|
139 |
symbols like this, although proper presentation is left to front-end
|
|
140 |
tools such as {\LaTeX} or Proof~General with the X-Symbol package.
|
|
141 |
A list of standard Isabelle symbols that work well with these tools
|
|
142 |
is given in \cite[appendix~A]{isabelle-sys}.
|
|
143 |
|
|
144 |
Source comments take the form \verb|(*|~\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}~\verb|*)| and may be nested, although user-interface
|
|
145 |
tools might prevent this. Note that this form indicates source
|
|
146 |
comments only, which are stripped after lexical analysis of the
|
|
147 |
input. The Isar document syntax also provides formal comments that
|
|
148 |
are considered as part of the text (see \secref{sec:comments}).%
|
|
149 |
\end{isamarkuptext}%
|
|
150 |
\isamarkuptrue%
|
|
151 |
%
|
|
152 |
\isamarkupsection{Common syntax entities%
|
|
153 |
}
|
|
154 |
\isamarkuptrue%
|
|
155 |
%
|
|
156 |
\begin{isamarkuptext}%
|
|
157 |
We now introduce several basic syntactic entities, such as names,
|
|
158 |
terms, and theorem specifications, which are factored out of the
|
|
159 |
actual Isar language elements to be described later.%
|
|
160 |
\end{isamarkuptext}%
|
|
161 |
\isamarkuptrue%
|
|
162 |
%
|
|
163 |
\isamarkupsubsection{Names%
|
|
164 |
}
|
|
165 |
\isamarkuptrue%
|
|
166 |
%
|
|
167 |
\begin{isamarkuptext}%
|
|
168 |
Entity \railqtok{name} usually refers to any name of types,
|
|
169 |
constants, theorems etc.\ that are to be \emph{declared} or
|
|
170 |
\emph{defined} (so qualified identifiers are excluded here). Quoted
|
|
171 |
strings provide an escape for non-identifier names or those ruled
|
|
172 |
out by outer syntax keywords (e.g.\ quoted \verb|"let"|).
|
|
173 |
Already existing objects are usually referenced by
|
|
174 |
\railqtok{nameref}.
|
|
175 |
|
|
176 |
\indexoutertoken{name}\indexoutertoken{parname}\indexoutertoken{nameref}
|
|
177 |
\indexoutertoken{int}
|
|
178 |
\begin{rail}
|
|
179 |
name: ident | symident | string | nat
|
|
180 |
;
|
|
181 |
parname: '(' name ')'
|
|
182 |
;
|
|
183 |
nameref: name | longident
|
|
184 |
;
|
|
185 |
int: nat | '-' nat
|
|
186 |
;
|
|
187 |
\end{rail}%
|
|
188 |
\end{isamarkuptext}%
|
|
189 |
\isamarkuptrue%
|
|
190 |
%
|
|
191 |
\isamarkupsubsection{Comments \label{sec:comments}%
|
|
192 |
}
|
|
193 |
\isamarkuptrue%
|
|
194 |
%
|
|
195 |
\begin{isamarkuptext}%
|
|
196 |
Large chunks of plain \railqtok{text} are usually given
|
|
197 |
\railtok{verbatim}, i.e.\ enclosed in \verb|{|\verb|*|~\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}~\verb|*|\verb|}|. For convenience,
|
|
198 |
any of the smaller text units conforming to \railqtok{nameref} are
|
|
199 |
admitted as well. A marginal \railnonterm{comment} is of the form
|
|
200 |
\verb|--| \railqtok{text}. Any number of these may occur
|
|
201 |
within Isabelle/Isar commands.
|
|
202 |
|
|
203 |
\indexoutertoken{text}\indexouternonterm{comment}
|
|
204 |
\begin{rail}
|
|
205 |
text: verbatim | nameref
|
|
206 |
;
|
|
207 |
comment: '--' text
|
|
208 |
;
|
|
209 |
\end{rail}%
|
|
210 |
\end{isamarkuptext}%
|
|
211 |
\isamarkuptrue%
|
|
212 |
%
|
|
213 |
\isamarkupsubsection{Type classes, sorts and arities%
|
|
214 |
}
|
|
215 |
\isamarkuptrue%
|
|
216 |
%
|
|
217 |
\begin{isamarkuptext}%
|
|
218 |
Classes are specified by plain names. Sorts have a very simple
|
|
219 |
inner syntax, which is either a single class name \isa{c} or a
|
|
220 |
list \isa{{\isachardoublequote}{\isacharbraceleft}c\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ c\isactrlsub n{\isacharbraceright}{\isachardoublequote}} referring to the
|
|
221 |
intersection of these classes. The syntax of type arities is given
|
|
222 |
directly at the outer level.
|
|
223 |
|
|
224 |
\indexouternonterm{sort}\indexouternonterm{arity}
|
|
225 |
\indexouternonterm{classdecl}
|
|
226 |
\begin{rail}
|
|
227 |
classdecl: name (('<' | subseteq) (nameref + ','))?
|
|
228 |
;
|
|
229 |
sort: nameref
|
|
230 |
;
|
|
231 |
arity: ('(' (sort + ',') ')')? sort
|
|
232 |
;
|
|
233 |
\end{rail}%
|
|
234 |
\end{isamarkuptext}%
|
|
235 |
\isamarkuptrue%
|
|
236 |
%
|
|
237 |
\isamarkupsubsection{Types and terms \label{sec:types-terms}%
|
|
238 |
}
|
|
239 |
\isamarkuptrue%
|
|
240 |
%
|
|
241 |
\begin{isamarkuptext}%
|
|
242 |
The actual inner Isabelle syntax, that of types and terms of the
|
|
243 |
logic, is far too sophisticated in order to be modelled explicitly
|
|
244 |
at the outer theory level. Basically, any such entity has to be
|
|
245 |
quoted to turn it into a single token (the parsing and type-checking
|
|
246 |
is performed internally later). For convenience, a slightly more
|
|
247 |
liberal convention is adopted: quotes may be omitted for any type or
|
|
248 |
term that is already atomic at the outer level. For example, one
|
|
249 |
may just write \verb|x| instead of quoted \verb|"x"|.
|
|
250 |
Note that symbolic identifiers (e.g.\ \verb|++| or \isa{{\isachardoublequote}{\isasymforall}{\isachardoublequote}} are available as well, provided these have not been superseded
|
|
251 |
by commands or other keywords already (such as \verb|=| or
|
|
252 |
\verb|+|).
|
|
253 |
|
|
254 |
\indexoutertoken{type}\indexoutertoken{term}\indexoutertoken{prop}
|
|
255 |
\begin{rail}
|
|
256 |
type: nameref | typefree | typevar
|
|
257 |
;
|
|
258 |
term: nameref | var
|
|
259 |
;
|
|
260 |
prop: term
|
|
261 |
;
|
|
262 |
\end{rail}
|
|
263 |
|
|
264 |
Positional instantiations are indicated by giving a sequence of
|
|
265 |
terms, or the placeholder ``\isa{{\isacharunderscore}}'' (underscore), which means to
|
|
266 |
skip a position.
|
|
267 |
|
|
268 |
\indexoutertoken{inst}\indexoutertoken{insts}
|
|
269 |
\begin{rail}
|
|
270 |
inst: underscore | term
|
|
271 |
;
|
|
272 |
insts: (inst *)
|
|
273 |
;
|
|
274 |
\end{rail}
|
|
275 |
|
|
276 |
Type declarations and definitions usually refer to
|
|
277 |
\railnonterm{typespec} on the left-hand side. This models basic
|
|
278 |
type constructor application at the outer syntax level. Note that
|
|
279 |
only plain postfix notation is available here, but no infixes.
|
|
280 |
|
|
281 |
\indexouternonterm{typespec}
|
|
282 |
\begin{rail}
|
|
283 |
typespec: (() | typefree | '(' ( typefree + ',' ) ')') name
|
|
284 |
;
|
|
285 |
\end{rail}%
|
|
286 |
\end{isamarkuptext}%
|
|
287 |
\isamarkuptrue%
|
|
288 |
%
|
|
289 |
\isamarkupsubsection{Mixfix annotations%
|
|
290 |
}
|
|
291 |
\isamarkuptrue%
|
|
292 |
%
|
|
293 |
\begin{isamarkuptext}%
|
|
294 |
Mixfix annotations specify concrete \emph{inner} syntax of Isabelle
|
|
295 |
types and terms. Some commands such as \hyperlink{command.types}{\mbox{\isa{\isacommand{types}}}} (see
|
|
296 |
\secref{sec:types-pure}) admit infixes only, while \hyperlink{command.consts}{\mbox{\isa{\isacommand{consts}}}} (see \secref{sec:consts}) and \hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}} (see
|
|
297 |
\secref{sec:syn-trans}) support the full range of general mixfixes
|
|
298 |
and binders.
|
|
299 |
|
|
300 |
\indexouternonterm{infix}\indexouternonterm{mixfix}\indexouternonterm{structmixfix}
|
|
301 |
\begin{rail}
|
|
302 |
infix: '(' ('infix' | 'infixl' | 'infixr') string? nat ')'
|
|
303 |
;
|
|
304 |
mixfix: infix | '(' string prios? nat? ')' | '(' 'binder' string prios? nat ')'
|
|
305 |
;
|
|
306 |
structmixfix: mixfix | '(' 'structure' ')'
|
|
307 |
;
|
|
308 |
|
|
309 |
prios: '[' (nat + ',') ']'
|
|
310 |
;
|
|
311 |
\end{rail}
|
|
312 |
|
|
313 |
Here the \railtok{string} specifications refer to the actual mixfix
|
|
314 |
template (see also \cite{isabelle-ref}), which may include literal
|
|
315 |
text, spacing, blocks, and arguments (denoted by ``\isa{{\isacharunderscore}}''); the
|
|
316 |
special symbol ``\verb|\<index>|'' (printed as ``\isa{{\isachardoublequote}{\isasymindex}{\isachardoublequote}}'')
|
|
317 |
represents an index argument that specifies an implicit structure
|
|
318 |
reference (see also \secref{sec:locale}). Infix and binder
|
|
319 |
declarations provide common abbreviations for particular mixfix
|
|
320 |
declarations. So in practice, mixfix templates mostly degenerate to
|
|
321 |
literal text for concrete syntax, such as ``\verb|++|'' for
|
|
322 |
an infix symbol, or ``\verb|++|\isa{{\isachardoublequote}{\isasymindex}{\isachardoublequote}}'' for an infix of
|
|
323 |
an implicit structure.%
|
|
324 |
\end{isamarkuptext}%
|
|
325 |
\isamarkuptrue%
|
|
326 |
%
|
|
327 |
\isamarkupsubsection{Proof methods \label{sec:syn-meth}%
|
|
328 |
}
|
|
329 |
\isamarkuptrue%
|
|
330 |
%
|
|
331 |
\begin{isamarkuptext}%
|
|
332 |
Proof methods are either basic ones, or expressions composed of
|
|
333 |
methods via ``\verb|,|'' (sequential composition),
|
|
334 |
``\verb||\verb,|,\verb||'' (alternative choices), ``\verb|?|''
|
|
335 |
(try), ``\verb|+|'' (repeat at least once), ``\verb|[|\isa{n}\verb|]|'' (restriction to first \isa{n}
|
|
336 |
sub-goals, with default \isa{{\isachardoublequote}n\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequote}}). In practice, proof
|
|
337 |
methods are usually just a comma separated list of
|
|
338 |
\railqtok{nameref}~\railnonterm{args} specifications. Note that
|
|
339 |
parentheses may be dropped for single method specifications (with no
|
|
340 |
arguments).
|
|
341 |
|
|
342 |
\indexouternonterm{method}
|
|
343 |
\begin{rail}
|
|
344 |
method: (nameref | '(' methods ')') (() | '?' | '+' | '[' nat? ']')
|
|
345 |
;
|
|
346 |
methods: (nameref args | method) + (',' | '|')
|
|
347 |
;
|
|
348 |
\end{rail}
|
|
349 |
|
|
350 |
Proper Isar proof methods do \emph{not} admit arbitrary goal
|
|
351 |
addressing, but refer either to the first sub-goal or all sub-goals
|
|
352 |
uniformly. The goal restriction operator ``\isa{{\isachardoublequote}{\isacharbrackleft}n{\isacharbrackright}{\isachardoublequote}}''
|
|
353 |
evaluates a method expression within a sandbox consisting of the
|
|
354 |
first \isa{n} sub-goals (which need to exist). For example, the
|
|
355 |
method ``\isa{{\isachardoublequote}simp{\isacharunderscore}all{\isacharbrackleft}{\isadigit{3}}{\isacharbrackright}{\isachardoublequote}}'' simplifies the first three
|
|
356 |
sub-goals, while ``\isa{{\isachardoublequote}{\isacharparenleft}rule\ foo{\isacharcomma}\ simp{\isacharunderscore}all{\isacharparenright}{\isacharbrackleft}{\isacharbrackright}{\isachardoublequote}}'' simplifies all
|
|
357 |
new goals that emerge from applying rule \isa{{\isachardoublequote}foo{\isachardoublequote}} to the
|
|
358 |
originally first one.
|
|
359 |
|
|
360 |
Improper methods, notably tactic emulations, offer a separate
|
|
361 |
low-level goal addressing scheme as explicit argument to the
|
|
362 |
individual tactic being involved. Here ``\isa{{\isachardoublequote}{\isacharbrackleft}{\isacharbang}{\isacharbrackright}{\isachardoublequote}}'' refers to
|
|
363 |
all goals, and ``\isa{{\isachardoublequote}{\isacharbrackleft}n{\isacharminus}{\isacharbrackright}{\isachardoublequote}}'' to all goals starting from \isa{{\isachardoublequote}n{\isachardoublequote}}.
|
|
364 |
|
|
365 |
\indexouternonterm{goalspec}
|
|
366 |
\begin{rail}
|
|
367 |
goalspec: '[' (nat '-' nat | nat '-' | nat | '!' ) ']'
|
|
368 |
;
|
|
369 |
\end{rail}%
|
|
370 |
\end{isamarkuptext}%
|
|
371 |
\isamarkuptrue%
|
|
372 |
%
|
|
373 |
\isamarkupsubsection{Attributes and theorems \label{sec:syn-att}%
|
|
374 |
}
|
|
375 |
\isamarkuptrue%
|
|
376 |
%
|
|
377 |
\begin{isamarkuptext}%
|
|
378 |
Attributes (and proof methods, see \secref{sec:syn-meth}) have their
|
|
379 |
own ``semi-inner'' syntax, in the sense that input conforming to
|
|
380 |
\railnonterm{args} below is parsed by the attribute a second time.
|
|
381 |
The attribute argument specifications may be any sequence of atomic
|
|
382 |
entities (identifiers, strings etc.), or properly bracketed argument
|
|
383 |
lists. Below \railqtok{atom} refers to any atomic entity, including
|
|
384 |
any \railtok{keyword} conforming to \railtok{symident}.
|
|
385 |
|
|
386 |
\indexoutertoken{atom}\indexouternonterm{args}\indexouternonterm{attributes}
|
|
387 |
\begin{rail}
|
|
388 |
atom: nameref | typefree | typevar | var | nat | keyword
|
|
389 |
;
|
|
390 |
arg: atom | '(' args ')' | '[' args ']'
|
|
391 |
;
|
|
392 |
args: arg *
|
|
393 |
;
|
|
394 |
attributes: '[' (nameref args * ',') ']'
|
|
395 |
;
|
|
396 |
\end{rail}
|
|
397 |
|
|
398 |
Theorem specifications come in several flavors:
|
|
399 |
\railnonterm{axmdecl} and \railnonterm{thmdecl} usually refer to
|
|
400 |
axioms, assumptions or results of goal statements, while
|
|
401 |
\railnonterm{thmdef} collects lists of existing theorems. Existing
|
|
402 |
theorems are given by \railnonterm{thmref} and
|
|
403 |
\railnonterm{thmrefs}, the former requires an actual singleton
|
|
404 |
result.
|
|
405 |
|
|
406 |
There are three forms of theorem references:
|
|
407 |
\begin{enumerate}
|
|
408 |
|
|
409 |
\item named facts \isa{{\isachardoublequote}a{\isachardoublequote}},
|
|
410 |
|
|
411 |
\item selections from named facts \isa{{\isachardoublequote}a{\isacharparenleft}i{\isacharparenright}{\isachardoublequote}} or \isa{{\isachardoublequote}a{\isacharparenleft}j\ {\isacharminus}\ k{\isacharparenright}{\isachardoublequote}},
|
|
412 |
|
|
413 |
\item literal fact propositions using \indexref{}{syntax}{altstring}\hyperlink{syntax.altstring}{\mbox{\isa{altstring}}} syntax
|
|
414 |
\verb|`|\isa{{\isachardoublequote}{\isasymphi}{\isachardoublequote}}\verb|`| (see also method
|
|
415 |
\indexref{}{method}{fact}\hyperlink{method.fact}{\mbox{\isa{fact}}} in \secref{sec:pure-meth-att}).
|
|
416 |
|
|
417 |
\end{enumerate}
|
|
418 |
|
|
419 |
Any kind of theorem specification may include lists of attributes
|
|
420 |
both on the left and right hand sides; attributes are applied to any
|
|
421 |
immediately preceding fact. If names are omitted, the theorems are
|
|
422 |
not stored within the theorem database of the theory or proof
|
|
423 |
context, but any given attributes are applied nonetheless.
|
|
424 |
|
|
425 |
An extra pair of brackets around attributes (like ``\isa{{\isachardoublequote}{\isacharbrackleft}{\isacharbrackleft}simproc\ a{\isacharbrackright}{\isacharbrackright}{\isachardoublequote}}'') abbreviates a theorem reference involving an
|
|
426 |
internal dummy fact, which will be ignored later on. So only the
|
|
427 |
effect of the attribute on the background context will persist.
|
|
428 |
This form of in-place declarations is particularly useful with
|
|
429 |
commands like \hyperlink{command.declare}{\mbox{\isa{\isacommand{declare}}}} and \hyperlink{command.using}{\mbox{\isa{\isacommand{using}}}}.
|
|
430 |
|
|
431 |
\indexouternonterm{axmdecl}\indexouternonterm{thmdecl}
|
|
432 |
\indexouternonterm{thmdef}\indexouternonterm{thmref}
|
|
433 |
\indexouternonterm{thmrefs}\indexouternonterm{selection}
|
|
434 |
\begin{rail}
|
|
435 |
axmdecl: name attributes? ':'
|
|
436 |
;
|
|
437 |
thmdecl: thmbind ':'
|
|
438 |
;
|
|
439 |
thmdef: thmbind '='
|
|
440 |
;
|
|
441 |
thmref: (nameref selection? | altstring) attributes? | '[' attributes ']'
|
|
442 |
;
|
|
443 |
thmrefs: thmref +
|
|
444 |
;
|
|
445 |
|
|
446 |
thmbind: name attributes | name | attributes
|
|
447 |
;
|
|
448 |
selection: '(' ((nat | nat '-' nat?) + ',') ')'
|
|
449 |
;
|
|
450 |
\end{rail}%
|
|
451 |
\end{isamarkuptext}%
|
|
452 |
\isamarkuptrue%
|
|
453 |
%
|
|
454 |
\isamarkupsubsection{Term patterns and declarations \label{sec:term-decls}%
|
|
455 |
}
|
|
456 |
\isamarkuptrue%
|
|
457 |
%
|
|
458 |
\begin{isamarkuptext}%
|
|
459 |
Wherever explicit propositions (or term fragments) occur in a proof
|
|
460 |
text, casual binding of schematic term variables may be given
|
|
461 |
specified via patterns of the form ``\isa{{\isachardoublequote}{\isacharparenleft}{\isasymIS}\ p\isactrlsub {\isadigit{1}}\ {\isasymdots}\ p\isactrlsub n{\isacharparenright}{\isachardoublequote}}''. This works both for \railqtok{term} and \railqtok{prop}.
|
|
462 |
|
|
463 |
\indexouternonterm{termpat}\indexouternonterm{proppat}
|
|
464 |
\begin{rail}
|
|
465 |
termpat: '(' ('is' term +) ')'
|
|
466 |
;
|
|
467 |
proppat: '(' ('is' prop +) ')'
|
|
468 |
;
|
|
469 |
\end{rail}
|
|
470 |
|
|
471 |
\medskip Declarations of local variables \isa{{\isachardoublequote}x\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}{\isachardoublequote}} and
|
|
472 |
logical propositions \isa{{\isachardoublequote}a\ {\isacharcolon}\ {\isasymphi}{\isachardoublequote}} represent different views on
|
|
473 |
the same principle of introducing a local scope. In practice, one
|
|
474 |
may usually omit the typing of \railnonterm{vars} (due to
|
|
475 |
type-inference), and the naming of propositions (due to implicit
|
|
476 |
references of current facts). In any case, Isar proof elements
|
|
477 |
usually admit to introduce multiple such items simultaneously.
|
|
478 |
|
|
479 |
\indexouternonterm{vars}\indexouternonterm{props}
|
|
480 |
\begin{rail}
|
|
481 |
vars: (name+) ('::' type)?
|
|
482 |
;
|
|
483 |
props: thmdecl? (prop proppat? +)
|
|
484 |
;
|
|
485 |
\end{rail}
|
|
486 |
|
|
487 |
The treatment of multiple declarations corresponds to the
|
|
488 |
complementary focus of \railnonterm{vars} versus
|
|
489 |
\railnonterm{props}. In ``\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub n\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}{\isachardoublequote}}''
|
|
490 |
the typing refers to all variables, while in \isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymdots}\ {\isasymphi}\isactrlsub n{\isachardoublequote}} the naming refers to all propositions collectively.
|
|
491 |
Isar language elements that refer to \railnonterm{vars} or
|
|
492 |
\railnonterm{props} typically admit separate typings or namings via
|
|
493 |
another level of iteration, with explicit \indexref{}{keyword}{and}\hyperlink{keyword.and}{\mbox{\isa{\isakeyword{and}}}}
|
|
494 |
separators; e.g.\ see \hyperlink{command.fix}{\mbox{\isa{\isacommand{fix}}}} and \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} in
|
|
495 |
\secref{sec:proof-context}.%
|
|
496 |
\end{isamarkuptext}%
|
|
497 |
\isamarkuptrue%
|
|
498 |
%
|
|
499 |
\isamarkupsubsection{Antiquotations \label{sec:antiq}%
|
|
500 |
}
|
|
501 |
\isamarkuptrue%
|
|
502 |
%
|
|
503 |
\begin{isamarkuptext}%
|
|
504 |
\begin{matharray}{rcl}
|
|
505 |
\indexdef{}{antiquotation}{theory}\hypertarget{antiquotation.theory}{\hyperlink{antiquotation.theory}{\mbox{\isa{theory}}}} & : & \isarantiq \\
|
|
506 |
\indexdef{}{antiquotation}{thm}\hypertarget{antiquotation.thm}{\hyperlink{antiquotation.thm}{\mbox{\isa{thm}}}} & : & \isarantiq \\
|
|
507 |
\indexdef{}{antiquotation}{prop}\hypertarget{antiquotation.prop}{\hyperlink{antiquotation.prop}{\mbox{\isa{prop}}}} & : & \isarantiq \\
|
|
508 |
\indexdef{}{antiquotation}{term}\hypertarget{antiquotation.term}{\hyperlink{antiquotation.term}{\mbox{\isa{term}}}} & : & \isarantiq \\
|
|
509 |
\indexdef{}{antiquotation}{const}\hypertarget{antiquotation.const}{\hyperlink{antiquotation.const}{\mbox{\isa{const}}}} & : & \isarantiq \\
|
|
510 |
\indexdef{}{antiquotation}{abbrev}\hypertarget{antiquotation.abbrev}{\hyperlink{antiquotation.abbrev}{\mbox{\isa{abbrev}}}} & : & \isarantiq \\
|
|
511 |
\indexdef{}{antiquotation}{typeof}\hypertarget{antiquotation.typeof}{\hyperlink{antiquotation.typeof}{\mbox{\isa{typeof}}}} & : & \isarantiq \\
|
|
512 |
\indexdef{}{antiquotation}{typ}\hypertarget{antiquotation.typ}{\hyperlink{antiquotation.typ}{\mbox{\isa{typ}}}} & : & \isarantiq \\
|
|
513 |
\indexdef{}{antiquotation}{thm\_style}\hypertarget{antiquotation.thm-style}{\hyperlink{antiquotation.thm-style}{\mbox{\isa{thm{\isacharunderscore}style}}}} & : & \isarantiq \\
|
|
514 |
\indexdef{}{antiquotation}{term\_style}\hypertarget{antiquotation.term-style}{\hyperlink{antiquotation.term-style}{\mbox{\isa{term{\isacharunderscore}style}}}} & : & \isarantiq \\
|
|
515 |
\indexdef{}{antiquotation}{text}\hypertarget{antiquotation.text}{\hyperlink{antiquotation.text}{\mbox{\isa{text}}}} & : & \isarantiq \\
|
|
516 |
\indexdef{}{antiquotation}{goals}\hypertarget{antiquotation.goals}{\hyperlink{antiquotation.goals}{\mbox{\isa{goals}}}} & : & \isarantiq \\
|
|
517 |
\indexdef{}{antiquotation}{subgoals}\hypertarget{antiquotation.subgoals}{\hyperlink{antiquotation.subgoals}{\mbox{\isa{subgoals}}}} & : & \isarantiq \\
|
|
518 |
\indexdef{}{antiquotation}{prf}\hypertarget{antiquotation.prf}{\hyperlink{antiquotation.prf}{\mbox{\isa{prf}}}} & : & \isarantiq \\
|
|
519 |
\indexdef{}{antiquotation}{full\_prf}\hypertarget{antiquotation.full-prf}{\hyperlink{antiquotation.full-prf}{\mbox{\isa{full{\isacharunderscore}prf}}}} & : & \isarantiq \\
|
|
520 |
\indexdef{}{antiquotation}{ML}\hypertarget{antiquotation.ML}{\hyperlink{antiquotation.ML}{\mbox{\isa{ML}}}} & : & \isarantiq \\
|
|
521 |
\indexdef{}{antiquotation}{ML\_type}\hypertarget{antiquotation.ML-type}{\hyperlink{antiquotation.ML-type}{\mbox{\isa{ML{\isacharunderscore}type}}}} & : & \isarantiq \\
|
|
522 |
\indexdef{}{antiquotation}{ML\_struct}\hypertarget{antiquotation.ML-struct}{\hyperlink{antiquotation.ML-struct}{\mbox{\isa{ML{\isacharunderscore}struct}}}} & : & \isarantiq \\
|
|
523 |
\end{matharray}
|
|
524 |
|
|
525 |
The text body of formal comments (see also \secref{sec:comments})
|
|
526 |
may contain antiquotations of logical entities, such as theorems,
|
|
527 |
terms and types, which are to be presented in the final output
|
|
528 |
produced by the Isabelle document preparation system (see also
|
|
529 |
\secref{sec:document-prep}).
|
|
530 |
|
|
531 |
Thus embedding of ``\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}term\ {\isacharbrackleft}show{\isacharunderscore}types{\isacharbrackright}\ {\isachardoublequote}f\ x\ {\isacharequal}\ a\ {\isacharplus}\ x{\isachardoublequote}{\isacharbraceright}{\isachardoublequote}}''
|
|
532 |
within a text block would cause
|
|
533 |
\isa{{\isacharparenleft}f{\isasymColon}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isacharparenright}\ {\isacharparenleft}x{\isasymColon}{\isacharprime}a{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}a{\isasymColon}{\isacharprime}a{\isacharparenright}\ {\isacharplus}\ x} to appear in the final {\LaTeX} document. Also note that theorem
|
|
534 |
antiquotations may involve attributes as well. For example,
|
|
535 |
\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}thm\ sym\ {\isacharbrackleft}no{\isacharunderscore}vars{\isacharbrackright}{\isacharbraceright}{\isachardoublequote}} would print the theorem's
|
|
536 |
statement where all schematic variables have been replaced by fixed
|
|
537 |
ones, which are easier to read.
|
|
538 |
|
|
539 |
\begin{rail}
|
|
540 |
atsign lbrace antiquotation rbrace
|
|
541 |
;
|
|
542 |
|
|
543 |
antiquotation:
|
|
544 |
'theory' options name |
|
|
545 |
'thm' options thmrefs |
|
|
546 |
'prop' options prop |
|
|
547 |
'term' options term |
|
|
548 |
'const' options term |
|
|
549 |
'abbrev' options term |
|
|
550 |
'typeof' options term |
|
|
551 |
'typ' options type |
|
|
552 |
'thm\_style' options name thmref |
|
|
553 |
'term\_style' options name term |
|
|
554 |
'text' options name |
|
|
555 |
'goals' options |
|
|
556 |
'subgoals' options |
|
|
557 |
'prf' options thmrefs |
|
|
558 |
'full\_prf' options thmrefs |
|
|
559 |
'ML' options name |
|
|
560 |
'ML\_type' options name |
|
|
561 |
'ML\_struct' options name
|
|
562 |
;
|
|
563 |
options: '[' (option * ',') ']'
|
|
564 |
;
|
|
565 |
option: name | name '=' name
|
|
566 |
;
|
|
567 |
\end{rail}
|
|
568 |
|
|
569 |
Note that the syntax of antiquotations may \emph{not} include source
|
|
570 |
comments \verb|(*|~\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}~\verb|*)| or verbatim
|
|
571 |
text \verb|{|\verb|*|~\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}~\verb|*|\verb|}|.
|
|
572 |
|
|
573 |
\begin{descr}
|
|
574 |
|
|
575 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}theory\ A{\isacharbraceright}{\isachardoublequote}}] prints the name \isa{{\isachardoublequote}A{\isachardoublequote}}, which is
|
|
576 |
guaranteed to refer to a valid ancestor theory in the current
|
|
577 |
context.
|
|
578 |
|
|
579 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}thm\ a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharbraceright}{\isachardoublequote}}] prints theorems
|
|
580 |
\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}. Note that attribute specifications
|
|
581 |
may be included as well (see also \secref{sec:syn-att}); the
|
|
582 |
\indexref{}{attribute}{no\_vars}\hyperlink{attribute.no-vars}{\mbox{\isa{no{\isacharunderscore}vars}}} rule (see \secref{sec:misc-meth-att}) would
|
|
583 |
be particularly useful to suppress printing of schematic variables.
|
|
584 |
|
|
585 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}prop\ {\isasymphi}{\isacharbraceright}{\isachardoublequote}}] prints a well-typed proposition \isa{{\isachardoublequote}{\isasymphi}{\isachardoublequote}}.
|
|
586 |
|
|
587 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}term\ t{\isacharbraceright}{\isachardoublequote}}] prints a well-typed term \isa{{\isachardoublequote}t{\isachardoublequote}}.
|
|
588 |
|
|
589 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}const\ c{\isacharbraceright}{\isachardoublequote}}] prints a logical or syntactic constant
|
|
590 |
\isa{{\isachardoublequote}c{\isachardoublequote}}.
|
|
591 |
|
|
592 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}abbrev\ c\ x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub n{\isacharbraceright}{\isachardoublequote}}] prints a constant
|
|
593 |
abbreviation \isa{{\isachardoublequote}c\ x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub n\ {\isasymequiv}\ rhs{\isachardoublequote}} as defined in
|
|
594 |
the current context.
|
|
595 |
|
|
596 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}typeof\ t{\isacharbraceright}{\isachardoublequote}}] prints the type of a well-typed term
|
|
597 |
\isa{{\isachardoublequote}t{\isachardoublequote}}.
|
|
598 |
|
|
599 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}typ\ {\isasymtau}{\isacharbraceright}{\isachardoublequote}}] prints a well-formed type \isa{{\isachardoublequote}{\isasymtau}{\isachardoublequote}}.
|
|
600 |
|
|
601 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}thm{\isacharunderscore}style\ s\ a{\isacharbraceright}{\isachardoublequote}}] prints theorem \isa{a},
|
|
602 |
previously applying a style \isa{s} to it (see below).
|
|
603 |
|
|
604 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}term{\isacharunderscore}style\ s\ t{\isacharbraceright}{\isachardoublequote}}] prints a well-typed term \isa{t} after applying a style \isa{s} to it (see below).
|
|
605 |
|
|
606 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}text\ s{\isacharbraceright}{\isachardoublequote}}] prints uninterpreted source text \isa{s}. This is particularly useful to print portions of text according
|
|
607 |
to the Isabelle {\LaTeX} output style, without demanding
|
|
608 |
well-formedness (e.g.\ small pieces of terms that should not be
|
|
609 |
parsed or type-checked yet).
|
|
610 |
|
|
611 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}goals{\isacharbraceright}{\isachardoublequote}}] prints the current \emph{dynamic} goal
|
|
612 |
state. This is mainly for support of tactic-emulation scripts
|
|
613 |
within Isar --- presentation of goal states does not conform to
|
|
614 |
actual human-readable proof documents.
|
|
615 |
|
|
616 |
Please do not include goal states into document output unless you
|
|
617 |
really know what you are doing!
|
|
618 |
|
|
619 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}subgoals{\isacharbraceright}{\isachardoublequote}}] is similar to \isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}goals{\isacharbraceright}{\isachardoublequote}}, but
|
|
620 |
does not print the main goal.
|
|
621 |
|
|
622 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}prf\ a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharbraceright}{\isachardoublequote}}] prints the (compact)
|
|
623 |
proof terms corresponding to the theorems \isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}. Note that this requires proof terms to be switched on
|
|
624 |
for the current object logic (see the ``Proof terms'' section of the
|
|
625 |
Isabelle reference manual for information on how to do this).
|
|
626 |
|
|
627 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}full{\isacharunderscore}prf\ a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharbraceright}{\isachardoublequote}}] is like \isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}prf\ a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharbraceright}{\isachardoublequote}}, but displays the full proof terms,
|
|
628 |
i.e.\ also displays information omitted in the compact proof term,
|
|
629 |
which is denoted by ``\isa{{\isacharunderscore}}'' placeholders there.
|
|
630 |
|
|
631 |
\item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}ML\ s{\isacharbraceright}{\isachardoublequote}}, \isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}ML{\isacharunderscore}type\ s{\isacharbraceright}{\isachardoublequote}}, and \isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}ML{\isacharunderscore}struct\ s{\isacharbraceright}{\isachardoublequote}}] check text \isa{s} as ML value, type, and
|
|
632 |
structure, respectively. The source is displayed verbatim.
|
|
633 |
|
|
634 |
\end{descr}
|
|
635 |
|
|
636 |
\medskip The following standard styles for use with \isa{thm{\isacharunderscore}style} and \isa{term{\isacharunderscore}style} are available:
|
|
637 |
|
|
638 |
\begin{descr}
|
|
639 |
|
|
640 |
\item [\isa{lhs}] extracts the first argument of any application
|
|
641 |
form with at least two arguments -- typically meta-level or
|
|
642 |
object-level equality, or any other binary relation.
|
|
643 |
|
|
644 |
\item [\isa{rhs}] is like \isa{lhs}, but extracts the second
|
|
645 |
argument.
|
|
646 |
|
|
647 |
\item [\isa{{\isachardoublequote}concl{\isachardoublequote}}] extracts the conclusion \isa{C} from a rule
|
|
648 |
in Horn-clause normal form \isa{{\isachardoublequote}A\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ A\isactrlsub n\ {\isasymLongrightarrow}\ C{\isachardoublequote}}.
|
|
649 |
|
|
650 |
\item [\isa{{\isachardoublequote}prem{\isadigit{1}}{\isachardoublequote}}, \dots, \isa{{\isachardoublequote}prem{\isadigit{9}}{\isachardoublequote}}] extract premise
|
|
651 |
number \isa{{\isachardoublequote}{\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isadigit{9}}{\isachardoublequote}}, respectively, from from a rule in
|
|
652 |
Horn-clause normal form \isa{{\isachardoublequote}A\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ A\isactrlsub n\ {\isasymLongrightarrow}\ C{\isachardoublequote}}
|
|
653 |
|
|
654 |
\end{descr}
|
|
655 |
|
|
656 |
\medskip
|
|
657 |
The following options are available to tune the output. Note that most of
|
|
658 |
these coincide with ML flags of the same names (see also \cite{isabelle-ref}).
|
|
659 |
|
|
660 |
\begin{descr}
|
|
661 |
|
|
662 |
\item[\isa{{\isachardoublequote}show{\isacharunderscore}types\ {\isacharequal}\ bool{\isachardoublequote}} and \isa{{\isachardoublequote}show{\isacharunderscore}sorts\ {\isacharequal}\ bool{\isachardoublequote}}]
|
|
663 |
control printing of explicit type and sort constraints.
|
|
664 |
|
|
665 |
\item[\isa{{\isachardoublequote}show{\isacharunderscore}structs\ {\isacharequal}\ bool{\isachardoublequote}}] controls printing of implicit
|
|
666 |
structures.
|
|
667 |
|
|
668 |
\item[\isa{{\isachardoublequote}long{\isacharunderscore}names\ {\isacharequal}\ bool{\isachardoublequote}}] forces names of types and
|
|
669 |
constants etc.\ to be printed in their fully qualified internal
|
|
670 |
form.
|
|
671 |
|
|
672 |
\item[\isa{{\isachardoublequote}short{\isacharunderscore}names\ {\isacharequal}\ bool{\isachardoublequote}}] forces names of types and
|
|
673 |
constants etc.\ to be printed unqualified. Note that internalizing
|
|
674 |
the output again in the current context may well yield a different
|
|
675 |
result.
|
|
676 |
|
|
677 |
\item[\isa{{\isachardoublequote}unique{\isacharunderscore}names\ {\isacharequal}\ bool{\isachardoublequote}}] determines whether the printed
|
|
678 |
version of qualified names should be made sufficiently long to avoid
|
|
679 |
overlap with names declared further back. Set to \isa{false} for
|
|
680 |
more concise output.
|
|
681 |
|
|
682 |
\item[\isa{{\isachardoublequote}eta{\isacharunderscore}contract\ {\isacharequal}\ bool{\isachardoublequote}}] prints terms in \isa{{\isasymeta}}-contracted form.
|
|
683 |
|
|
684 |
\item[\isa{{\isachardoublequote}display\ {\isacharequal}\ bool{\isachardoublequote}}] indicates if the text is to be
|
|
685 |
output as multi-line ``display material'', rather than a small piece
|
|
686 |
of text without line breaks (which is the default).
|
|
687 |
|
|
688 |
\item[\isa{{\isachardoublequote}break\ {\isacharequal}\ bool{\isachardoublequote}}] controls line breaks in non-display
|
|
689 |
material.
|
|
690 |
|
|
691 |
\item[\isa{{\isachardoublequote}quotes\ {\isacharequal}\ bool{\isachardoublequote}}] indicates if the output should be
|
|
692 |
enclosed in double quotes.
|
|
693 |
|
|
694 |
\item[\isa{{\isachardoublequote}mode\ {\isacharequal}\ name{\isachardoublequote}}] adds \isa{name} to the print mode to
|
|
695 |
be used for presentation (see also \cite{isabelle-ref}). Note that
|
|
696 |
the standard setup for {\LaTeX} output is already present by
|
|
697 |
default, including the modes \isa{latex} and \isa{xsymbols}.
|
|
698 |
|
|
699 |
\item[\isa{{\isachardoublequote}margin\ {\isacharequal}\ nat{\isachardoublequote}} and \isa{{\isachardoublequote}indent\ {\isacharequal}\ nat{\isachardoublequote}}] change the
|
|
700 |
margin or indentation for pretty printing of display material.
|
|
701 |
|
|
702 |
\item[\isa{{\isachardoublequote}source\ {\isacharequal}\ bool{\isachardoublequote}}] prints the source text of the
|
|
703 |
antiquotation arguments, rather than the actual value. Note that
|
|
704 |
this does not affect well-formedness checks of \hyperlink{antiquotation.thm}{\mbox{\isa{thm}}}, \hyperlink{antiquotation.term}{\mbox{\isa{term}}}, etc. (only the \hyperlink{antiquotation.text}{\mbox{\isa{text}}} antiquotation admits arbitrary output).
|
|
705 |
|
|
706 |
\item[\isa{{\isachardoublequote}goals{\isacharunderscore}limit\ {\isacharequal}\ nat{\isachardoublequote}}] determines the maximum number of
|
|
707 |
goals to be printed.
|
|
708 |
|
|
709 |
\item[\isa{{\isachardoublequote}locale\ {\isacharequal}\ name{\isachardoublequote}}] specifies an alternative locale
|
|
710 |
context used for evaluating and printing the subsequent argument.
|
|
711 |
|
|
712 |
\end{descr}
|
|
713 |
|
|
714 |
For boolean flags, ``\isa{{\isachardoublequote}name\ {\isacharequal}\ true{\isachardoublequote}}'' may be abbreviated as
|
|
715 |
``\isa{name}''. All of the above flags are disabled by default,
|
|
716 |
unless changed from ML.
|
|
717 |
|
|
718 |
\medskip Note that antiquotations do not only spare the author from
|
|
719 |
tedious typing of logical entities, but also achieve some degree of
|
|
720 |
consistency-checking of informal explanations with formal
|
|
721 |
developments: well-formedness of terms and types with respect to the
|
|
722 |
current theory or proof context is ensured here.%
|
|
723 |
\end{isamarkuptext}%
|
|
724 |
\isamarkuptrue%
|
|
725 |
%
|
|
726 |
\isamarkupsubsection{Tagged commands \label{sec:tags}%
|
|
727 |
}
|
|
728 |
\isamarkuptrue%
|
|
729 |
%
|
|
730 |
\begin{isamarkuptext}%
|
|
731 |
Each Isabelle/Isar command may be decorated by presentation tags:
|
|
732 |
|
|
733 |
\indexouternonterm{tags}
|
|
734 |
\begin{rail}
|
|
735 |
tags: ( tag * )
|
|
736 |
;
|
|
737 |
tag: '\%' (ident | string)
|
|
738 |
\end{rail}
|
|
739 |
|
|
740 |
The tags \isa{{\isachardoublequote}theory{\isachardoublequote}}, \isa{{\isachardoublequote}proof{\isachardoublequote}}, \isa{{\isachardoublequote}ML{\isachardoublequote}} are already
|
|
741 |
pre-declared for certain classes of commands:
|
|
742 |
|
|
743 |
\medskip
|
|
744 |
|
|
745 |
\begin{tabular}{ll}
|
|
746 |
\isa{{\isachardoublequote}theory{\isachardoublequote}} & theory begin/end \\
|
|
747 |
\isa{{\isachardoublequote}proof{\isachardoublequote}} & all proof commands \\
|
|
748 |
\isa{{\isachardoublequote}ML{\isachardoublequote}} & all commands involving ML code \\
|
|
749 |
\end{tabular}
|
|
750 |
|
|
751 |
\medskip The Isabelle document preparation system (see also
|
|
752 |
\cite{isabelle-sys}) allows tagged command regions to be presented
|
|
753 |
specifically, e.g.\ to fold proof texts, or drop parts of the text
|
|
754 |
completely.
|
|
755 |
|
|
756 |
For example ``\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{{\isachardoublequote}{\isacharpercent}invisible\ auto{\isachardoublequote}}'' would
|
|
757 |
cause that piece of proof to be treated as \isa{invisible} instead
|
|
758 |
of \isa{{\isachardoublequote}proof{\isachardoublequote}} (the default), which may be either show or hidden
|
|
759 |
depending on the document setup. In contrast, ``\hyperlink{command.by}{\mbox{\isa{\isacommand{by}}}}~\isa{{\isachardoublequote}{\isacharpercent}visible\ auto{\isachardoublequote}}'' would force this text to be shown
|
|
760 |
invariably.
|
|
761 |
|
|
762 |
Explicit tag specifications within a proof apply to all subsequent
|
|
763 |
commands of the same level of nesting. For example, ``\hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}~\isa{{\isachardoublequote}{\isacharpercent}visible\ {\isasymdots}{\isachardoublequote}}~\hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}'' would force the
|
|
764 |
whole sub-proof to be typeset as \isa{visible} (unless some of its
|
|
765 |
parts are tagged differently).%
|
|
766 |
\end{isamarkuptext}%
|
|
767 |
\isamarkuptrue%
|
|
768 |
%
|
|
769 |
\isadelimtheory
|
|
770 |
%
|
|
771 |
\endisadelimtheory
|
|
772 |
%
|
|
773 |
\isatagtheory
|
|
774 |
\isacommand{end}\isamarkupfalse%
|
|
775 |
%
|
|
776 |
\endisatagtheory
|
|
777 |
{\isafoldtheory}%
|
|
778 |
%
|
|
779 |
\isadelimtheory
|
|
780 |
%
|
|
781 |
\endisadelimtheory
|
|
782 |
\isanewline
|
|
783 |
\end{isabellebody}%
|
|
784 |
%%% Local Variables:
|
|
785 |
%%% mode: latex
|
|
786 |
%%% TeX-master: "root"
|
|
787 |
%%% End:
|