2 \chapter{Syntax primitives}
4 The rather generic framework of Isabelle/Isar syntax emerges from three main
5 syntactic categories: \emph{commands} of the top-level Isar engine (covering
6 theory and proof elements), \emph{methods} for general goal refinements
7 (analogous to traditional ``tactics''), and \emph{attributes} for operations
8 on facts (within a certain context). Here we give a reference of basic
9 syntactic entities underlying Isabelle/Isar syntax in a bottom-up manner.
10 Concrete theory and proof language elements will be introduced later on.
14 In order to get started with writing well-formed Isabelle/Isar documents, the
15 most important aspect to be noted is the difference of \emph{inner} versus
16 \emph{outer} syntax. Inner syntax is that of Isabelle types and terms of the
17 logic, while outer syntax is that of Isabelle/Isar theory sources (including
18 proofs). As a general rule, inner syntax entities may occur only as
19 \emph{atomic entities} within outer syntax. For example, the string
20 \texttt{"x + y"} and identifier \texttt{z} are legal term specifications
21 within a theory, while \texttt{x + y} is not.
24 Old-style Isabelle theories used to fake parts of the inner syntax of types,
25 with rather complicated rules when quotes may be omitted. Despite the minor
26 drawback of requiring quotes more often, the syntax of Isabelle/Isar is
27 somewhat simpler and more robust in that respect.
30 Printed theory documents usually omit quotes to gain readability (this is a
31 matter of {\LaTeX} macro setup, say via \verb,\isabellestyle,, see also
32 \cite{isabelle-sys}). Experienced users of Isabelle/Isar may easily
33 reconstruct the lost technical information, while mere readers need not care
38 Isabelle/Isar input may contain any number of input termination characters
39 ``\texttt{;}'' (semicolon) to separate commands explicitly. This is
40 particularly useful in interactive shell sessions to make clear where the
41 current command is intended to end. Otherwise, the interpreter loop will
42 continue to issue a secondary prompt ``\verb,#,'' until an end-of-command is
43 clearly recognized from the input syntax, e.g.\ encounter of the next command
46 Advanced interfaces such as Proof~General \cite{proofgeneral} do not require
47 explicit semicolons, the amount of input text is determined automatically by
48 inspecting the present content of the Emacs text buffer. In the printed
49 presentation of Isabelle/Isar documents semicolons are omitted altogether for
53 Proof~General requires certain syntax classification tables in order to
54 achieve properly synchronized interaction with the Isabelle/Isar process.
55 These tables need to be consistent with the Isabelle version and particular
56 logic image to be used in a running session (common object-logics may well
57 change the outer syntax). The standard setup should work correctly with any
58 of the ``official'' logic images derived from Isabelle/HOL (including HOLCF
59 etc.). Users of alternative logics may need to tell Proof~General
60 explicitly, e.g.\ by giving an option \verb,-k ZF, (in conjunction with
61 \verb,-l ZF, to specify the default logic image).
64 \section{Lexical matters}\label{sec:lex-syntax}
66 The Isabelle/Isar outer syntax provides token classes as presented below; most
67 of these coincide with the inner lexical syntax as presented in
70 \indexoutertoken{ident}\indexoutertoken{longident}\indexoutertoken{symident}
71 \indexoutertoken{nat}\indexoutertoken{var}\indexoutertoken{typefree}
72 \indexoutertoken{typevar}\indexoutertoken{string}\indexoutertoken{altstring}
73 \indexoutertoken{verbatim}
74 \begin{matharray}{rcl}
75 ident & = & letter\,quasiletter^* \\
76 longident & = & ident (\verb,.,ident)^+ \\
77 symident & = & sym^+ ~|~ \verb,\<,ident\verb,>, \\
79 var & = & ident ~|~ \verb,?,ident ~|~ \verb,?,ident\verb,.,nat \\
80 typefree & = & \verb,',ident \\
81 typevar & = & typefree ~|~ \verb,?,typefree ~|~ \verb,?,typefree\verb,.,nat \\
82 string & = & \verb,", ~\dots~ \verb,", \\
83 altstring & = & \backquote ~\dots~ \backquote \\
84 verbatim & = & \verb,{*, ~\dots~ \verb,*}, \\[1ex]
86 letter & = & latin ~|~ \verb,\<,latin\verb,>, ~|~ \verb,\<,latin\,latin\verb,>, ~|~ greek ~|~ \\
87 & & \verb,\<^isub>, ~|~ \verb,\<^isup>, \\
88 quasiletter & = & letter ~|~ digit ~|~ \verb,_, ~|~ \verb,', \\
89 latin & = & \verb,a, ~|~ \dots ~|~ \verb,z, ~|~ \verb,A, ~|~ \dots ~|~ \verb,Z, \\
90 digit & = & \verb,0, ~|~ \dots ~|~ \verb,9, \\
91 sym & = & \verb,!, ~|~ \verb,#, ~|~ \verb,$, ~|~ \verb,%, ~|~ \verb,&, ~|~ %$
92 \verb,*, ~|~ \verb,+, ~|~ \verb,-, ~|~ \verb,/, ~|~ \verb,:, ~|~ \\
93 & & \verb,<, ~|~ \verb,=, ~|~ \verb,>, ~|~ \verb,?, ~|~ \texttt{\at} ~|~
94 \verb,^, ~|~ \verb,_, ~|~ \verb,|, ~|~ \verb,~, \\
95 greek & = & \verb,\<alpha>, ~|~ \verb,\<beta>, ~|~ \verb,\<gamma>, ~|~ \verb,\<delta>, ~| \\
96 & & \verb,\<epsilon>, ~|~ \verb,\<zeta>, ~|~ \verb,\<eta>, ~|~ \verb,\<theta>, ~| \\
97 & & \verb,\<iota>, ~|~ \verb,\<kappa>, ~|~ \verb,\<mu>, ~|~ \verb,\<nu>, ~| \\
98 & & \verb,\<xi>, ~|~ \verb,\<pi>, ~|~ \verb,\<rho>, ~|~ \verb,\<sigma>, ~| \\
99 & & \verb,\<tau>, ~|~ \verb,\<upsilon>, ~|~ \verb,\<phi>, ~|~ \verb,\<psi>, ~| \\
100 & & \verb,\<omega>, ~|~ \verb,\<Gamma>, ~|~ \verb,\<Delta>, ~|~ \verb,\<Theta>, ~| \\
101 & & \verb,\<Lambda>, ~|~ \verb,\<Xi>, ~|~ \verb,\<Pi>, ~|~ \verb,\<Sigma>, ~| \\
102 & & \verb,\<Upsilon>, ~|~ \verb,\<Phi>, ~|~ \verb,\<Psi>, ~|~ \verb,\<Omega>, \\
105 The syntax of $string$ admits any characters, including newlines; ``\verb|"|''
106 (double-quote) and ``\verb|\|'' (backslash) need to be escaped by a backslash.
107 Alternative strings according to $altstring$ are analogous, using single
108 back-quotes instead. The body of $verbatim$ may consist of any text not
109 containing ``\verb|*}|''; this allows convenient inclusion of quotes without
110 further escapes. The greek letters do \emph{not} include \verb,\<lambda>,,
111 which is already used differently in the meta-logic.
113 Common mathematical symbols such as $\forall$ are represented in Isabelle as
114 \verb,\<forall>,. There are infinitely many legal symbols like this, although
115 proper presentation is left to front-end tools such as {\LaTeX} or
116 Proof~General with the X-Symbol package. A list of standard Isabelle symbols
117 that work well with these tools is given in \cite[appendix~A]{isabelle-sys}.
119 Comments take the form \texttt{(*~\dots~*)} and may be nested, although
120 user-interface tools may prevent this. Note that \texttt{(*~\dots~*)}
121 indicate source comments only, which are stripped after lexical analysis of
122 the input. The Isar document syntax also provides formal comments that are
123 considered as part of the text (see \S\ref{sec:comments}).
126 Proof~General does not handle nested comments properly; it is also unable to
127 keep \verb,(*,\,/\,\verb,{*, and \verb,*),\,/\,\verb,*}, apart, despite
128 their rather different meaning. These are inherent problems of Emacs
129 legacy. Users should not be overly aggressive about nesting or alternating
134 \section{Common syntax entities}
136 Subsequently, we introduce several basic syntactic entities, such as names,
137 terms, and theorem specifications, which have been factored out of the actual
138 Isar language elements to be described later.
140 Note that some of the basic syntactic entities introduced below (e.g.\
141 \railqtok{name}) act much like tokens rather than plain nonterminals (e.g.\
142 \railnonterm{sort}), especially for the sake of error messages. E.g.\ syntax
143 elements like $\CONSTS$ referring to \railqtok{name} or \railqtok{type} would
144 really report a missing name or type rather than any of the constituent
145 primitive tokens such as \railtok{ident} or \railtok{string}.
150 Entity \railqtok{name} usually refers to any name of types, constants,
151 theorems etc.\ that are to be \emph{declared} or \emph{defined} (so qualified
152 identifiers are excluded here). Quoted strings provide an escape for
153 non-identifier names or those ruled out by outer syntax keywords (e.g.\
154 \verb|"let"|). Already existing objects are usually referenced by
157 \indexoutertoken{name}\indexoutertoken{parname}\indexoutertoken{nameref}
158 \indexoutertoken{int}
160 name: ident | symident | string | nat
162 parname: '(' name ')'
164 nameref: name | longident
171 \subsection{Comments}\label{sec:comments}
173 Large chunks of plain \railqtok{text} are usually given \railtok{verbatim},
174 i.e.\ enclosed in \verb|{*|~\dots~\verb|*}|. For convenience, any of the
175 smaller text units conforming to \railqtok{nameref} are admitted as well. A
176 marginal \railnonterm{comment} is of the form \texttt{--} \railqtok{text}.
177 Any number of these may occur within Isabelle/Isar commands.
179 \indexoutertoken{text}\indexouternonterm{comment}
181 text: verbatim | nameref
188 \subsection{Type classes, sorts and arities}
190 Classes are specified by plain names. Sorts have a very simple inner syntax,
191 which is either a single class name $c$ or a list $\{c@1, \dots, c@n\}$
192 referring to the intersection of these classes. The syntax of type arities is
193 given directly at the outer level.
195 \railalias{subseteq}{\isasymsubseteq}
198 \indexouternonterm{sort}\indexouternonterm{arity}
199 \indexouternonterm{classdecl}
201 classdecl: name (('<' | subseteq) (nameref + ','))?
205 arity: ('(' (sort + ',') ')')? sort
210 \subsection{Types and terms}\label{sec:types-terms}
212 The actual inner Isabelle syntax, that of types and terms of the logic, is far
213 too sophisticated in order to be modelled explicitly at the outer theory
214 level. Basically, any such entity has to be quoted to turn it into a single
215 token (the parsing and type-checking is performed internally later). For
216 convenience, a slightly more liberal convention is adopted: quotes may be
217 omitted for any type or term that is already atomic at the outer level. For
218 example, one may just write \texttt{x} instead of \texttt{"x"}. Note that
219 symbolic identifiers (e.g.\ \texttt{++} or $\forall$) are available as well,
220 provided these have not been superseded by commands or other keywords already
221 (e.g.\ \texttt{=} or \texttt{+}).
223 \indexoutertoken{type}\indexoutertoken{term}\indexoutertoken{prop}
225 type: nameref | typefree | typevar
233 Positional instantiations are indicated by giving a sequence of terms, or the
234 placeholder ``$\_$'' (underscore), which means to skip a position.
236 \indexoutertoken{inst}\indexoutertoken{insts}
238 inst: underscore | term
244 Type declarations and definitions usually refer to \railnonterm{typespec} on
245 the left-hand side. This models basic type constructor application at the
246 outer syntax level. Note that only plain postfix notation is available here,
249 \indexouternonterm{typespec}
251 typespec: (() | typefree | '(' ( typefree + ',' ) ')') name
256 \subsection{Mixfix annotations}
258 Mixfix annotations specify concrete \emph{inner} syntax of Isabelle types and
259 terms. Some commands such as $\TYPES$ (see \S\ref{sec:types-pure}) admit
260 infixes only, while $\CONSTS$ (see \S\ref{sec:consts}) and
261 $\isarkeyword{syntax}$ (see \S\ref{sec:syn-trans}) support the full range of
262 general mixfixes and binders.
264 \indexouternonterm{infix}\indexouternonterm{mixfix}\indexouternonterm{structmixfix}
266 infix: '(' ('infix' | 'infixl' | 'infixr') string? nat ')'
268 mixfix: infix | '(' string prios? nat? ')' | '(' 'binder' string prios? nat ')'
270 structmixfix: mixfix | '(' 'structure' ')'
273 prios: '[' (nat + ',') ']'
277 Here the \railtok{string} specifications refer to the actual mixfix template
278 (see also \cite{isabelle-ref}), which may include literal text, spacing,
279 blocks, and arguments (denoted by ``$_$''); the special symbol \verb,\<index>,
280 (printed as ``\i'') represents an index argument that specifies an implicit
281 structure reference (see also \S\ref{sec:locale}). Infix and binder
282 declarations provide common abbreviations for particular mixfix declarations.
283 So in practice, mixfix templates mostly degenerate to literal text for
284 concrete syntax, such as ``\verb,++,'' for an infix symbol, or ``\verb,++,\i''
285 for an infix of an implicit structure.
289 \subsection{Proof methods}\label{sec:syn-meth}
291 Proof methods are either basic ones, or expressions composed of methods via
292 ``\texttt{,}'' (sequential composition), ``\texttt{|}'' (alternative choices),
293 ``\texttt{?}'' (try), ``\texttt{+}'' (repeat at least once). In practice,
294 proof methods are usually just a comma separated list of
295 \railqtok{nameref}~\railnonterm{args} specifications. Note that parentheses
296 may be dropped for single method specifications (with no arguments).
298 \indexouternonterm{method}
300 method: (nameref | '(' methods ')') (() | '?' | '+')
302 methods: (nameref args | method) + (',' | '|')
306 Proper use of Isar proof methods does \emph{not} involve goal addressing.
307 Nevertheless, specifying goal ranges may occasionally come in handy in
308 emulating tactic scripts. Note that $[n-]$ refers to all goals, starting from
309 $n$. All goals may be specified by $[!]$, which is the same as $[1-]$.
311 \indexouternonterm{goalspec}
313 goalspec: '[' (nat '-' nat | nat '-' | nat | '!' ) ']'
318 \subsection{Attributes and theorems}\label{sec:syn-att}
320 Attributes (and proof methods, see \S\ref{sec:syn-meth}) have their own
321 ``semi-inner'' syntax, in the sense that input conforming to
322 \railnonterm{args} below is parsed by the attribute a second time. The
323 attribute argument specifications may be any sequence of atomic entities
324 (identifiers, strings etc.), or properly bracketed argument lists. Below
325 \railqtok{atom} refers to any atomic entity, including any \railtok{keyword}
326 conforming to \railtok{symident}.
328 \indexoutertoken{atom}\indexouternonterm{args}\indexouternonterm{attributes}
330 atom: nameref | typefree | typevar | var | nat | keyword
332 arg: atom | '(' args ')' | '[' args ']'
336 attributes: '[' (nameref args * ',') ']'
340 Theorem specifications come in several flavors: \railnonterm{axmdecl} and
341 \railnonterm{thmdecl} usually refer to axioms, assumptions or results of goal
342 statements, while \railnonterm{thmdef} collects lists of existing theorems.
343 Existing theorems are given by \railnonterm{thmref} and \railnonterm{thmrefs},
344 the former requires an actual singleton result. There are three forms of
345 theorem references: (1) named facts $a$, (2) selections from named facts $a(i,
346 j - k)$, or (3) literal fact propositions using $altstring$ syntax
347 $\backquote\phi\backquote$, (see also method $fact$ in
348 \S\ref{sec:pure-meth-att}).
350 Any kind of theorem specification may include lists of attributes both on the
351 left and right hand sides; attributes are applied to any immediately preceding
352 fact. If names are omitted, the theorems are not stored within the theorem
353 database of the theory or proof context, but any given attributes are applied
356 \indexouternonterm{axmdecl}\indexouternonterm{thmdecl}
357 \indexouternonterm{thmdef}\indexouternonterm{thmref}
358 \indexouternonterm{thmrefs}\indexouternonterm{selection}
360 axmdecl: name attributes? ':'
366 thmref: (nameref selection? | altstring) attributes?
371 thmbind: name attributes | name | attributes
373 selection: '(' ((nat | nat '-' nat?) + ',') ')'
378 \subsection{Term patterns and declarations}\label{sec:term-decls}
380 Wherever explicit propositions (or term fragments) occur in a proof text,
381 casual binding of schematic term variables may be given specified via patterns
382 of the form ``$\ISS{p@1\;\dots}{p@n}$''. There are separate versions
383 available for \railqtok{term}s and \railqtok{prop}s. The latter provides a
384 $\CONCLNAME$ part with patterns referring the (atomic) conclusion of a rule.
386 \indexouternonterm{termpat}\indexouternonterm{proppat}
388 termpat: '(' ('is' term +) ')'
390 proppat: '(' (('is' prop +) | 'concl' ('is' prop +) | ('is' prop +) 'concl' ('is' prop +)) ')'
394 Declarations of local variables $x :: \tau$ and logical propositions $a :
395 \phi$ represent different views on the same principle of introducing a local
396 scope. In practice, one may usually omit the typing of $vars$ (due to
397 type-inference), and the naming of propositions (due to implicit references of
398 current facts). In any case, Isar proof elements usually admit to introduce
399 multiple such items simultaneously.
401 \indexouternonterm{vars}\indexouternonterm{props}
403 vars: (name+) ('::' type)?
405 props: thmdecl? (prop proppat? +)
409 The treatment of multiple declarations corresponds to the complementary focus
410 of $vars$ versus $props$: in ``$x@1~\dots~x@n :: \tau$'' the typing refers to
411 all variables, while in $a\colon \phi@1~\dots~\phi@n$ the naming refers to all
412 propositions collectively. Isar language elements that refer to $vars$ or
413 $props$ typically admit separate typings or namings via another level of
414 iteration, with explicit $\AND$ separators; e.g.\ see $\FIXNAME$ and
415 $\ASSUMENAME$ in \S\ref{sec:proof-context}.
418 \subsection{Antiquotations}\label{sec:antiq}
420 \begin{matharray}{rcl}
421 thm & : & \isarantiq \\
422 prop & : & \isarantiq \\
423 term & : & \isarantiq \\
424 const & : & \isarantiq \\
425 typeof & : & \isarantiq \\
426 typ & : & \isarantiq \\
427 thm_style & : & \isarantiq \\
428 term_style & : & \isarantiq \\
429 text & : & \isarantiq \\
430 goals & : & \isarantiq \\
431 subgoals & : & \isarantiq \\
432 prf & : & \isarantiq \\
433 full_prf & : & \isarantiq \\
434 ML & : & \isarantiq \\
435 ML_type & : & \isarantiq \\
436 ML_struct & : & \isarantiq \\
439 The text body of formal comments (see also \S\ref{sec:comments}) may contain
440 antiquotations of logical entities, such as theorems, terms and types, which
441 are to be presented in the final output produced by the Isabelle document
442 preparation system (see also \S\ref{sec:document-prep}).
445 ``\texttt{{\at}{\ttlbrace}term~[show_types]~"f(x)~=~a~+~x"{\ttrbrace}}''
446 within a text block would cause
447 \isa{(f{\isasymColon}'a~{\isasymRightarrow}~'a)~(x{\isasymColon}'a)~=~(a{\isasymColon}'a)~+~x}
448 to appear in the final {\LaTeX} document. Also note that theorem
449 antiquotations may involve attributes as well. For example,
450 \texttt{{\at}{\ttlbrace}thm~sym~[no_vars]{\ttrbrace}} would print the
451 statement where all schematic variables have been replaced by fixed ones,
452 which are easier to read.
454 \indexisarant{thm}\indexisarant{prop}\indexisarant{term}\indexisarant{const}
455 \indexisarant{typeof}\indexisarant{typ}\indexisarant{thm-style}
456 \indexisarant{term-style}\indexisarant{text}\indexisarant{goals}
457 \indexisarant{subgoals}\indexisarant{prf}\indexisarant{full-prf}\indexisarant{ML}
458 \indexisarant{ML-type}\indexisarant{ML-struct}
461 atsign lbrace antiquotation rbrace
465 'thm' options thmrefs |
466 'prop' options prop |
467 'term' options term |
468 'const' options term |
469 'typeof' options term |
471 'thm\_style' options name thmref |
472 'term\_style' options name term |
473 'text' options name |
476 'prf' options thmrefs |
477 'full\_prf' options thmrefs |
479 'ML\_type' options name |
480 'ML\_struct' options name
482 options: '[' (option * ',') ']'
484 option: name | name '=' name
488 Note that the syntax of antiquotations may \emph{not} include source comments
489 \texttt{(*~\dots~*)} or verbatim text \verb|{*|~\dots~\verb|*}|.
493 \item [$\at\{thm~\vec a\}$] prints theorems $\vec a$. Note that attribute
494 specifications may be included as well (see also \S\ref{sec:syn-att}); the
495 $no_vars$ operation (see \S\ref{sec:misc-meth-att}) would be particularly
496 useful to suppress printing of schematic variables.
498 \item [$\at\{prop~\phi\}$] prints a well-typed proposition $\phi$.
500 \item [$\at\{term~t\}$] prints a well-typed term $t$.
502 \item [$\at\{const~c\}$] prints a well-defined constant $c$.
504 \item [$\at\{typeof~t\}$] prints the type of a well-typed term $t$.
506 \item [$\at\{typ~\tau\}$] prints a well-formed type $\tau$.
508 \item [$\at\{thm_style~s~a\}$] prints theorem $a$, previously applying a style
509 $s$ to it (see below).
511 \item [$\at\{term_style~s~t\}$] prints a well-typed term $t$ after applying a
512 style $s$ to it (see below).
514 \item [$\at\{text~s\}$] prints uninterpreted source text $s$. This is
515 particularly useful to print portions of text according to the Isabelle
516 {\LaTeX} output style, without demanding well-formedness (e.g.\ small pieces
517 of terms that should not be parsed or type-checked yet).
519 \item [$\at\{goals\}$] prints the current \emph{dynamic} goal state. This is
520 mainly for support of tactic-emulation scripts within Isar --- presentation
521 of goal states does not conform to actual human-readable proof documents.
522 Please do not include goal states into document output unless you really
523 know what you are doing!
525 \item [$\at\{subgoals\}$] is similar to $goals$, but does not print the main
528 \item [$\at\{prf~\vec a\}$] prints the (compact) proof terms corresponding to
529 the theorems $\vec a$. Note that this requires proof terms to be switched on
530 for the current object logic (see the ``Proof terms'' section of the
531 Isabelle reference manual for information on how to do this).
533 \item [$\at\{full_prf~\vec a\}$] is like $\at\{prf~\vec a\}$, but displays the
534 full proof terms, i.e.\ also displays information omitted in the compact
535 proof term, which is denoted by ``$_$'' placeholders there.
537 \item [$\at\{ML~s\}$, $\at\{ML_type~s\}$, and $\at\{ML_struct~s\}$] check text
538 $s$ as ML value, type, and structure, respectively. If successful, the
539 source is displayed verbatim.
545 The following standard styles for use with $thm_style$ and $term_style$ are
550 \item [$lhs$] extracts the first argument of any application form with at
551 least two arguments -- typically meta-level or object-level equality, or any
552 other binary relation.
554 \item [$rhs$] is like $lhs$, but extracts the second argument.
556 \item [$concl$] extracts the conclusion $C$ from a nested meta-level
557 implication $A@1 \Imp \cdots A@n \Imp C$.
559 \item [$prem1$, \dots, $prem9$] extract premise number $1$, \dots, $9$,
560 respectively, from a nested meta-level implication $A@1 \Imp \cdots A@n \Imp
567 The following options are available to tune the output. Note that most of
568 these coincide with ML flags of the same names (see also \cite{isabelle-ref}).
570 \item[$show_types = bool$ and $show_sorts = bool$] control printing of
571 explicit type and sort constraints.
572 \item[$show_structs = bool$] controls printing of implicit structures.
573 \item[$long_names = bool$] forces names of types and constants etc.\ to be
574 printed in their fully qualified internal form.
575 \item[$short_names = bool$] forces names of types and constants etc.\ to be
576 printed unqualified. Note that internalizing the output again in the
577 current context may well yield a different result.
578 \item[$unique_names = bool$] determines whether the printed version of
579 qualified names should be made sufficiently long to avoid overlap with names
580 declared further back. Set to $false$ for more concise output.
581 \item[$eta_contract = bool$] prints terms in $\eta$-contracted form.
582 \item[$display = bool$] indicates if the text is to be output as multi-line
583 ``display material'', rather than a small piece of text without line breaks
584 (which is the default).
585 \item[$breaks = bool$] controls line breaks in non-display material.
586 \item[$quotes = bool$] indicates if the output should be enclosed in double
588 \item[$mode = name$] adds $name$ to the print mode to be used for presentation
589 (see also \cite{isabelle-ref}). Note that the standard setup for {\LaTeX}
590 output is already present by default, including the modes ``$latex$'',
591 ``$xsymbols$'', ``$symbols$''.
592 \item[$margin = nat$ and $indent = nat$] change the margin or indentation for
593 pretty printing of display material.
594 \item[$source = bool$] prints the source text of the antiquotation arguments,
595 rather than the actual value. Note that this does not affect
596 well-formedness checks of $thm$, $term$, etc. (only the $text$ antiquotation
597 admits arbitrary output).
598 \item[$goals_limit = nat$] determines the maximum number of goals to be
600 \item[$locale = name$] specifies an alternative context used for evaluating
601 and printing the subsequent argument.
604 For boolean flags, ``$name = true$'' may be abbreviated as ``$name$''. All of
605 the above flags are disabled by default, unless changed from ML.
607 \medskip Note that antiquotations do not only spare the author from tedious
608 typing of logical entities, but also achieve some degree of
609 consistency-checking of informal explanations with formal developments:
610 well-formedness of terms and types with respect to the current theory or proof
611 context is ensured here.
614 \subsection{Tagged commands}\label{sec:tags}
616 Each Isabelle/Isar command may be decorated by presentation tags:
618 \indexouternonterm{tags}
622 tag: '\%' (ident | string)
625 The tags $theory$, $proof$, $ML$ are already pre-declared for certain classes
631 $theory$ & theory begin and end \\
632 $proof$ & all proof commands \\
633 $ML$ & all commands involving ML code \\
636 \medskip The Isabelle document preparation system (see also
637 \cite{isabelle-sys}) allows tagged command regions to be presented
638 specifically, e.g.\ to fold proof texts, or drop parts of the text completely.
640 For example ``$\BYNAME~\%invisible~(auto)$'' would cause that piece of proof
641 to be treated as $invisible$ instead of $proof$ (the default), which may be
642 either show or hidden depending on the document setup. In contrast,
643 ``$\BYNAME~\%visible~(auto)$'' would force this text to be shown invariably.
645 Explicit tag specifications within a proof apply to all subsequent commands of
646 the same level of nesting. For example,
647 ``$\PROOFNAME~\%visible~\dots\QEDNAME$'' would force the whole sub-proof to be
648 typeset as $visible$ (unless some of its parts are tagged differently).
652 %%% TeX-master: "isar-ref"