author | wenzelm |
Sat, 28 Apr 2012 16:06:30 +0200 | |
changeset 47822 | 34b44d28fc4b |
parent 45106 | 3498077f2012 |
permissions | -rw-r--r-- |
11648 | 1 |
% |
2 |
\begin{isabellebody}% |
|
3 |
\def\isabellecontext{Documents}% |
|
17056 | 4 |
% |
5 |
\isadelimtheory |
|
6 |
% |
|
7 |
\endisadelimtheory |
|
8 |
% |
|
9 |
\isatagtheory |
|
10 |
% |
|
11 |
\endisatagtheory |
|
12 |
{\isafoldtheory}% |
|
13 |
% |
|
14 |
\isadelimtheory |
|
15 |
% |
|
16 |
\endisadelimtheory |
|
12627 | 17 |
% |
12647 | 18 |
\isamarkupsection{Concrete Syntax \label{sec:concrete-syntax}% |
12627 | 19 |
} |
20 |
\isamarkuptrue% |
|
21 |
% |
|
22 |
\begin{isamarkuptext}% |
|
12767 | 23 |
The core concept of Isabelle's framework for concrete syntax is that |
24 |
of \bfindex{mixfix annotations}. Associated with any kind of |
|
25 |
constant declaration, mixfixes affect both the grammar productions |
|
26 |
for the parser and output templates for the pretty printer. |
|
12627 | 27 |
|
12743 | 28 |
In full generality, parser and pretty printer configuration is a |
25338 | 29 |
subtle affair~\cite{isabelle-ref}. Your syntax specifications need |
12767 | 30 |
to interact properly with the existing setup of Isabelle/Pure and |
31 |
Isabelle/HOL\@. To avoid creating ambiguities with existing |
|
32 |
elements, it is particularly important to give new syntactic |
|
12764 | 33 |
constructs the right precedence. |
12627 | 34 |
|
25338 | 35 |
Below we introduce a few simple syntax declaration |
12743 | 36 |
forms that already cover many common situations fairly well.% |
12627 | 37 |
\end{isamarkuptext}% |
38 |
\isamarkuptrue% |
|
39 |
% |
|
12647 | 40 |
\isamarkupsubsection{Infix Annotations% |
12627 | 41 |
} |
42 |
\isamarkuptrue% |
|
43 |
% |
|
44 |
\begin{isamarkuptext}% |
|
12764 | 45 |
Syntax annotations may be included wherever constants are declared, |
27015 | 46 |
such as \isacommand{definition} and \isacommand{primrec} --- and also |
12767 | 47 |
\isacommand{datatype}, which declares constructor operations. |
48 |
Type-constructors may be annotated as well, although this is less |
|
40406 | 49 |
frequently encountered in practice (the infix type \isa{{\isaliteral{5C3C74696D65733E}{\isasymtimes}}} comes |
12767 | 50 |
to mind). |
12627 | 51 |
|
12644 | 52 |
Infix declarations\index{infix annotations} provide a useful special |
12767 | 53 |
case of mixfixes. The following example of the exclusive-or |
54 |
operation on boolean values illustrates typical infix declarations.% |
|
12627 | 55 |
\end{isamarkuptext}% |
17175 | 56 |
\isamarkuptrue% |
27015 | 57 |
\isacommand{definition}\isamarkupfalse% |
40406 | 58 |
\ xor\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \ \ \ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infixl}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{6}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\isanewline |
59 |
\isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ {\isaliteral{5C3C6E6F743E}{\isasymnot}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C6F723E}{\isasymor}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}% |
|
12627 | 60 |
\begin{isamarkuptext}% |
40406 | 61 |
\noindent Now \isa{xor\ A\ B} and \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B} refer to the |
12652 | 62 |
same expression internally. Any curried function with at least two |
12767 | 63 |
arguments may be given infix syntax. For partial applications with |
64 |
fewer than two operands, there is a notation using the prefix~\isa{op}. For instance, \isa{xor} without arguments is represented as |
|
40406 | 65 |
\isa{op\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}}; together with ordinary function application, this |
66 |
turns \isa{xor\ A} into \isa{op\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ A}. |
|
12627 | 67 |
|
25338 | 68 |
The keyword \isakeyword{infixl} seen above specifies an |
12747 | 69 |
infix operator that is nested to the \emph{left}: in iterated |
70 |
applications the more complex expression appears on the left-hand |
|
40406 | 71 |
side, and \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ C} stands for \isa{{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ C}. Similarly, \isakeyword{infixr} means nesting to the |
72 |
\emph{right}, reading \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ C} as \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ {\isaliteral{28}{\isacharparenleft}}B\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ C{\isaliteral{29}{\isacharparenright}}}. A \emph{non-oriented} declaration via \isakeyword{infix} |
|
73 |
would render \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ C} illegal, but demand explicit |
|
12767 | 74 |
parentheses to indicate the intended grouping. |
12743 | 75 |
|
40406 | 76 |
The string \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} in our annotation refers to the |
12747 | 77 |
concrete syntax to represent the operator (a literal token), while |
12764 | 78 |
the number \isa{{\isadigit{6}}{\isadigit{0}}} determines the precedence of the construct: |
12767 | 79 |
the syntactic priorities of the arguments and result. Isabelle/HOL |
80 |
already uses up many popular combinations of ASCII symbols for its |
|
40406 | 81 |
own use, including both \isa{{\isaliteral{2B}{\isacharplus}}} and \isa{{\isaliteral{2B}{\isacharplus}}{\isaliteral{2B}{\isacharplus}}}. Longer |
12767 | 82 |
character combinations are more likely to be still available for |
40406 | 83 |
user extensions, such as our~\isa{{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}}. |
12627 | 84 |
|
12767 | 85 |
Operator precedences have a range of 0--1000. Very low or high |
86 |
priorities are reserved for the meta-logic. HOL syntax mainly uses |
|
40406 | 87 |
the range of 10--100: the equality infix \isa{{\isaliteral{3D}{\isacharequal}}} is centered at |
88 |
50; logical connectives (like \isa{{\isaliteral{5C3C6F723E}{\isasymor}}} and \isa{{\isaliteral{5C3C616E643E}{\isasymand}}}) are |
|
89 |
below 50; algebraic ones (like \isa{{\isaliteral{2B}{\isacharplus}}} and \isa{{\isaliteral{2A}{\isacharasterisk}}}) are |
|
12767 | 90 |
above 50. User syntax should strive to coexist with common HOL |
91 |
forms, or use the mostly unused range 100--900.% |
|
12627 | 92 |
\end{isamarkuptext}% |
93 |
\isamarkuptrue% |
|
12635 | 94 |
% |
12658 | 95 |
\isamarkupsubsection{Mathematical Symbols \label{sec:syntax-symbols}% |
12635 | 96 |
} |
12627 | 97 |
\isamarkuptrue% |
12635 | 98 |
% |
99 |
\begin{isamarkuptext}% |
|
12767 | 100 |
Concrete syntax based on ASCII characters has inherent limitations. |
101 |
Mathematical notation demands a larger repertoire of glyphs. |
|
102 |
Several standards of extended character sets have been proposed over |
|
103 |
decades, but none has become universally available so far. Isabelle |
|
104 |
has its own notion of \bfindex{symbols} as the smallest entities of |
|
105 |
source text, without referring to internal encodings. There are |
|
106 |
three kinds of such ``generalized characters'': |
|
12635 | 107 |
|
108 |
\begin{enumerate} |
|
109 |
||
12652 | 110 |
\item 7-bit ASCII characters |
12635 | 111 |
|
12652 | 112 |
\item named symbols: \verb,\,\verb,<,$ident$\verb,>, |
12635 | 113 |
|
12652 | 114 |
\item named control symbols: \verb,\,\verb,<^,$ident$\verb,>, |
12635 | 115 |
|
116 |
\end{enumerate} |
|
117 |
||
14486 | 118 |
Here $ident$ is any sequence of letters. |
119 |
This results in an infinite store of symbols, whose |
|
12767 | 120 |
interpretation is left to further front-end tools. For example, the |
121 |
user-interface of Proof~General + X-Symbol and the Isabelle document |
|
122 |
processor (see \S\ref{sec:document-preparation}) display the |
|
40406 | 123 |
\verb,\,\verb,<forall>, symbol as~\isa{{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}}. |
12635 | 124 |
|
125 |
A list of standard Isabelle symbols is given in |
|
28838
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
27027
diff
changeset
|
126 |
\cite{isabelle-isar-ref}. You may introduce your own |
12635 | 127 |
interpretation of further symbols by configuring the appropriate |
12652 | 128 |
front-end tool accordingly, e.g.\ by defining certain {\LaTeX} |
129 |
macros (see also \S\ref{sec:doc-prep-symbols}). There are also a |
|
130 |
few predefined control symbols, such as \verb,\,\verb,<^sub>, and |
|
12635 | 131 |
\verb,\,\verb,<^sup>, for sub- and superscript of the subsequent |
12764 | 132 |
printable symbol, respectively. For example, \verb,A\<^sup>\<star>, is |
40406 | 133 |
output as \isa{A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{5C3C737461723E}{\isasymstar}}}. |
12635 | 134 |
|
17187 | 135 |
A number of symbols are considered letters by the Isabelle lexer and |
136 |
can be used as part of identifiers. These are the greek letters |
|
40406 | 137 |
\isa{{\isaliteral{5C3C616C7068613E}{\isasymalpha}}} (\verb+\+\verb+<alpha>+), \isa{{\isaliteral{5C3C626574613E}{\isasymbeta}}} |
138 |
(\verb+\+\verb+<beta>+), etc. (excluding \isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}}), |
|
139 |
special letters like \isa{{\isaliteral{5C3C413E}{\isasymA}}} (\verb+\+\verb+<A>+) and \isa{{\isaliteral{5C3C41413E}{\isasymAA}}} (\verb+\+\verb+<AA>+), and the control symbols |
|
17187 | 140 |
\verb+\+\verb+<^isub>+ and \verb+\+\verb+<^isup>+ for single letter |
141 |
sub and super scripts. This means that the input |
|
14486 | 142 |
|
143 |
\medskip |
|
17187 | 144 |
{\small\noindent \verb,\,\verb,<forall>\,\verb,<alpha>\<^isub>1.,~\verb,\,\verb,<alpha>\<^isub>1 = \,\verb,<Pi>\<^isup>\<A>,} |
14486 | 145 |
|
146 |
\medskip |
|
40406 | 147 |
\noindent is recognized as the term \isa{{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{2E}{\isachardot}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C50693E}{\isasymPi}}\isaliteral{5C3C5E697375703E}{}\isactrlisup {\isaliteral{5C3C413E}{\isasymA}}} |
148 |
by Isabelle. Note that \isa{{\isaliteral{5C3C50693E}{\isasymPi}}\isaliteral{5C3C5E697375703E}{}\isactrlisup {\isaliteral{5C3C413E}{\isasymA}}} is a single |
|
17187 | 149 |
syntactic entity, not an exponentiation. |
14486 | 150 |
|
25338 | 151 |
Replacing our previous definition of \isa{xor} by the |
17187 | 152 |
following specifies an Isabelle symbol for the new operator:% |
12635 | 153 |
\end{isamarkuptext}% |
17175 | 154 |
\isamarkuptrue% |
17056 | 155 |
% |
156 |
\isadelimML |
|
157 |
% |
|
158 |
\endisadelimML |
|
159 |
% |
|
160 |
\isatagML |
|
161 |
% |
|
162 |
\endisatagML |
|
163 |
{\isafoldML}% |
|
164 |
% |
|
165 |
\isadelimML |
|
166 |
% |
|
167 |
\endisadelimML |
|
27015 | 168 |
\isacommand{definition}\isamarkupfalse% |
40406 | 169 |
\ xor\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \ \ \ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infixl}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6F706C75733E}{\isasymoplus}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{6}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\isanewline |
170 |
\isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5C3C6F706C75733E}{\isasymoplus}}\ B\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ {\isaliteral{5C3C6E6F743E}{\isasymnot}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C6F723E}{\isasymor}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}% |
|
38765 | 171 |
\isadelimML |
172 |
% |
|
173 |
\endisadelimML |
|
174 |
% |
|
175 |
\isatagML |
|
176 |
% |
|
177 |
\endisatagML |
|
178 |
{\isafoldML}% |
|
179 |
% |
|
180 |
\isadelimML |
|
181 |
% |
|
182 |
\endisadelimML |
|
183 |
% |
|
12635 | 184 |
\begin{isamarkuptext}% |
47822
34b44d28fc4b
some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x;
wenzelm
parents:
45106
diff
changeset
|
185 |
\noindent Proof~General provides several input methods to enter |
34b44d28fc4b
some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x;
wenzelm
parents:
45106
diff
changeset
|
186 |
\isa{{\isaliteral{5C3C6F706C75733E}{\isasymoplus}}} in the text. If all fails one may just type a named |
34b44d28fc4b
some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x;
wenzelm
parents:
45106
diff
changeset
|
187 |
entity \verb,\,\verb,<oplus>, by hand; the corresponding symbol will |
34b44d28fc4b
some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x;
wenzelm
parents:
45106
diff
changeset
|
188 |
be displayed after further input. |
12635 | 189 |
|
25338 | 190 |
More flexible is to provide alternative syntax forms |
12767 | 191 |
through the \bfindex{print mode} concept~\cite{isabelle-ref}. By |
192 |
convention, the mode of ``$xsymbols$'' is enabled whenever |
|
193 |
Proof~General's X-Symbol mode or {\LaTeX} output is active. Now |
|
194 |
consider the following hybrid declaration of \isa{xor}:% |
|
12635 | 195 |
\end{isamarkuptext}% |
17175 | 196 |
\isamarkuptrue% |
17056 | 197 |
% |
198 |
\isadelimML |
|
199 |
% |
|
200 |
\endisadelimML |
|
201 |
% |
|
202 |
\isatagML |
|
203 |
% |
|
204 |
\endisatagML |
|
205 |
{\isafoldML}% |
|
206 |
% |
|
207 |
\isadelimML |
|
208 |
% |
|
209 |
\endisadelimML |
|
27015 | 210 |
\isacommand{definition}\isamarkupfalse% |
40406 | 211 |
\ xor\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \ \ \ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infixl}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{6}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\isanewline |
212 |
\isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}\ B\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ {\isaliteral{5C3C6E6F743E}{\isasymnot}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C6F723E}{\isasymor}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
17175 | 213 |
\isanewline |
25338 | 214 |
\isacommand{notation}\isamarkupfalse% |
40406 | 215 |
\ {\isaliteral{28}{\isacharparenleft}}xsymbols{\isaliteral{29}{\isacharparenright}}\ xor\ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infixl}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6F706C75733E}{\isasymoplus}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{6}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}% |
38765 | 216 |
\isadelimML |
217 |
% |
|
218 |
\endisadelimML |
|
219 |
% |
|
220 |
\isatagML |
|
221 |
% |
|
222 |
\endisatagML |
|
223 |
{\isafoldML}% |
|
224 |
% |
|
225 |
\isadelimML |
|
226 |
% |
|
227 |
\endisadelimML |
|
228 |
% |
|
12635 | 229 |
\begin{isamarkuptext}% |
27015 | 230 |
\noindent |
25338 | 231 |
The \commdx{notation} command associates a mixfix |
27015 | 232 |
annotation with a known constant. The print mode specification, |
40406 | 233 |
here \isa{{\isaliteral{28}{\isacharparenleft}}xsymbols{\isaliteral{29}{\isacharparenright}}}, is optional. |
12635 | 234 |
|
40406 | 235 |
We may now write \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B} or \isa{A\ {\isaliteral{5C3C6F706C75733E}{\isasymoplus}}\ B} in input, while |
25338 | 236 |
output uses the nicer syntax of $xsymbols$ whenever that print mode is |
237 |
active. Such an arrangement is particularly useful for interactive |
|
238 |
development, where users may type ASCII text and see mathematical |
|
239 |
symbols displayed during proofs.% |
|
12635 | 240 |
\end{isamarkuptext}% |
12627 | 241 |
\isamarkuptrue% |
12635 | 242 |
% |
12647 | 243 |
\isamarkupsubsection{Prefix Annotations% |
12635 | 244 |
} |
12627 | 245 |
\isamarkuptrue% |
12635 | 246 |
% |
247 |
\begin{isamarkuptext}% |
|
12767 | 248 |
Prefix syntax annotations\index{prefix annotation} are another form |
249 |
of mixfixes \cite{isabelle-ref}, without any template arguments or |
|
250 |
priorities --- just some literal syntax. The following example |
|
251 |
associates common symbols with the constructors of a datatype.% |
|
12635 | 252 |
\end{isamarkuptext}% |
17175 | 253 |
\isamarkuptrue% |
254 |
\isacommand{datatype}\isamarkupfalse% |
|
40406 | 255 |
\ currency\ {\isaliteral{3D}{\isacharequal}}\isanewline |
256 |
\ \ \ \ Euro\ nat\ \ \ \ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6575726F3E}{\isasymeuro}}{\isaliteral{22}{\isachardoublequoteclose}}{\isaliteral{29}{\isacharparenright}}\isanewline |
|
257 |
\ \ {\isaliteral{7C}{\isacharbar}}\ Pounds\ nat\ \ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C706F756E64733E}{\isasympounds}}{\isaliteral{22}{\isachardoublequoteclose}}{\isaliteral{29}{\isacharparenright}}\isanewline |
|
258 |
\ \ {\isaliteral{7C}{\isacharbar}}\ Yen\ nat\ \ \ \ \ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C79656E3E}{\isasymyen}}{\isaliteral{22}{\isachardoublequoteclose}}{\isaliteral{29}{\isacharparenright}}\isanewline |
|
259 |
\ \ {\isaliteral{7C}{\isacharbar}}\ Dollar\ nat\ \ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{24}{\isachardollar}}{\isaliteral{22}{\isachardoublequoteclose}}{\isaliteral{29}{\isacharparenright}}% |
|
12635 | 260 |
\begin{isamarkuptext}% |
12652 | 261 |
\noindent Here the mixfix annotations on the rightmost column happen |
262 |
to consist of a single Isabelle symbol each: \verb,\,\verb,<euro>,, |
|
263 |
\verb,\,\verb,<pounds>,, \verb,\,\verb,<yen>,, and \verb,$,. Recall |
|
40406 | 264 |
that a constructor like \isa{Euro} actually is a function \isa{nat\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ currency}. The expression \isa{Euro\ {\isadigit{1}}{\isadigit{0}}} will be |
265 |
printed as \isa{{\isaliteral{5C3C6575726F3E}{\isasymeuro}}\ {\isadigit{1}}{\isadigit{0}}}; only the head of the application is |
|
12743 | 266 |
subject to our concrete syntax. This rather simple form already |
267 |
achieves conformance with notational standards of the European |
|
268 |
Commission. |
|
12635 | 269 |
|
27015 | 270 |
Prefix syntax works the same way for other commands that introduce new constants, e.g. \isakeyword{primrec}.% |
12649 | 271 |
\end{isamarkuptext}% |
272 |
\isamarkuptrue% |
|
273 |
% |
|
25338 | 274 |
\isamarkupsubsection{Abbreviations \label{sec:abbreviations}% |
12635 | 275 |
} |
12627 | 276 |
\isamarkuptrue% |
12635 | 277 |
% |
278 |
\begin{isamarkuptext}% |
|
12767 | 279 |
Mixfix syntax annotations merely decorate particular constant |
25338 | 280 |
application forms with concrete syntax, for instance replacing |
40406 | 281 |
\isa{xor\ A\ B} by \isa{A\ {\isaliteral{5C3C6F706C75733E}{\isasymoplus}}\ B}. Occasionally, the relationship |
25338 | 282 |
between some piece of notation and its internal form is more |
283 |
complicated. Here we need \emph{abbreviations}. |
|
12635 | 284 |
|
25338 | 285 |
Command \commdx{abbreviation} introduces an uninterpreted notational |
286 |
constant as an abbreviation for a complex term. Abbreviations are |
|
287 |
unfolded upon parsing and re-introduced upon printing. This provides a |
|
288 |
simple mechanism for syntactic macros. |
|
12649 | 289 |
|
25338 | 290 |
A typical use of abbreviations is to introduce relational notation for |
40406 | 291 |
membership in a set of pairs, replacing \isa{{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{2C}{\isacharcomma}}\ y{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C696E3E}{\isasymin}}\ sim} by |
292 |
\isa{x\ {\isaliteral{5C3C617070726F783E}{\isasymapprox}}\ y}. We assume that a constant \isa{sim} of type |
|
293 |
\isa{{\isaliteral{28}{\isacharparenleft}}{\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C74696D65733E}{\isasymtimes}}\ {\isaliteral{27}{\isacharprime}}a{\isaliteral{29}{\isacharparenright}}\ set} has been introduced at this point.% |
|
12635 | 294 |
\end{isamarkuptext}% |
17175 | 295 |
\isamarkuptrue% |
25338 | 296 |
\isacommand{abbreviation}\isamarkupfalse% |
40406 | 297 |
\ sim{\isadigit{2}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \ \ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infix}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C617070726F783E}{\isasymapprox}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{5}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\isanewline |
298 |
\isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C617070726F783E}{\isasymapprox}}\ y\ \ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ \ {\isaliteral{28}{\isacharparenleft}}x{\isaliteral{2C}{\isacharcomma}}\ y{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C696E3E}{\isasymin}}\ sim{\isaliteral{22}{\isachardoublequoteclose}}% |
|
12635 | 299 |
\begin{isamarkuptext}% |
25338 | 300 |
\noindent The given meta-equality is used as a rewrite rule |
40406 | 301 |
after parsing (replacing \mbox{\isa{x\ {\isaliteral{5C3C617070726F783E}{\isasymapprox}}\ y}} by \isa{{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{2C}{\isacharcomma}}y{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C696E3E}{\isasymin}}\ sim}) and before printing (turning \isa{{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{2C}{\isacharcomma}}y{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C696E3E}{\isasymin}}\ sim} back into |
302 |
\mbox{\isa{x\ {\isaliteral{5C3C617070726F783E}{\isasymapprox}}\ y}}). The name of the dummy constant \isa{sim{\isadigit{2}}} |
|
25338 | 303 |
does not matter, as long as it is unique. |
12635 | 304 |
|
25338 | 305 |
Another common application of abbreviations is to |
306 |
provide variant versions of fundamental relational expressions, such |
|
40406 | 307 |
as \isa{{\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}} for negated equalities. The following declaration |
25338 | 308 |
stems from Isabelle/HOL itself:% |
12649 | 309 |
\end{isamarkuptext}% |
17175 | 310 |
\isamarkuptrue% |
25338 | 311 |
\isacommand{abbreviation}\isamarkupfalse% |
40406 | 312 |
\ not{\isaliteral{5F}{\isacharunderscore}}equal\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \ \ \ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infixl}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{7E}{\isachartilde}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{5}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\isanewline |
313 |
\isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{7E}{\isachartilde}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}\ y\ \ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ \ {\isaliteral{5C3C6E6F743E}{\isasymnot}}\ {\isaliteral{28}{\isacharparenleft}}x\ {\isaliteral{3D}{\isacharequal}}\ y{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
25338 | 314 |
\isanewline |
315 |
\isacommand{notation}\isamarkupfalse% |
|
40406 | 316 |
\ {\isaliteral{28}{\isacharparenleft}}xsymbols{\isaliteral{29}{\isacharparenright}}\ not{\isaliteral{5F}{\isacharunderscore}}equal\ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infix}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{5}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}% |
12649 | 317 |
\begin{isamarkuptext}% |
40406 | 318 |
\noindent The notation \isa{{\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}} is introduced separately to restrict it |
25338 | 319 |
to the \emph{xsymbols} mode. |
12649 | 320 |
|
27015 | 321 |
Abbreviations are appropriate when the defined concept is a |
25338 | 322 |
simple variation on an existing one. But because of the automatic |
323 |
folding and unfolding of abbreviations, they do not scale up well to |
|
324 |
large hierarchies of concepts. Abbreviations do not replace |
|
325 |
definitions. |
|
326 |
||
327 |
Abbreviations are a simplified form of the general concept of |
|
328 |
\emph{syntax translations}; even heavier transformations may be |
|
329 |
written in ML \cite{isabelle-ref}.% |
|
12635 | 330 |
\end{isamarkuptext}% |
12627 | 331 |
\isamarkuptrue% |
12635 | 332 |
% |
12652 | 333 |
\isamarkupsection{Document Preparation \label{sec:document-preparation}% |
12635 | 334 |
} |
335 |
\isamarkuptrue% |
|
336 |
% |
|
12644 | 337 |
\begin{isamarkuptext}% |
12652 | 338 |
Isabelle/Isar is centered around the concept of \bfindex{formal |
12767 | 339 |
proof documents}\index{documents|bold}. The outcome of a formal |
340 |
development effort is meant to be a human-readable record, presented |
|
341 |
as browsable PDF file or printed on paper. The overall document |
|
342 |
structure follows traditional mathematical articles, with sections, |
|
343 |
intermediate explanations, definitions, theorems and proofs. |
|
12644 | 344 |
|
345 |
\medskip The Isabelle document preparation system essentially acts |
|
12671 | 346 |
as a front-end to {\LaTeX}. After checking specifications and |
347 |
proofs formally, the theory sources are turned into typesetting |
|
12767 | 348 |
instructions in a schematic manner. This lets you write authentic |
349 |
reports on theory developments with little effort: many technical |
|
350 |
consistency checks are handled by the system. |
|
12745 | 351 |
|
352 |
Here is an example to illustrate the idea of Isabelle document |
|
12747 | 353 |
preparation.% |
354 |
\end{isamarkuptext}% |
|
17175 | 355 |
\isamarkuptrue% |
12747 | 356 |
% |
357 |
\begin{quotation} |
|
358 |
% |
|
359 |
\begin{isamarkuptext}% |
|
40406 | 360 |
The following datatype definition of \isa{{\isaliteral{27}{\isacharprime}}a\ bintree} models |
361 |
binary trees with nodes being decorated by elements of type \isa{{\isaliteral{27}{\isacharprime}}a}.% |
|
12745 | 362 |
\end{isamarkuptext}% |
17175 | 363 |
\isamarkuptrue% |
364 |
\isacommand{datatype}\isamarkupfalse% |
|
40406 | 365 |
\ {\isaliteral{27}{\isacharprime}}a\ bintree\ {\isaliteral{3D}{\isacharequal}}\isanewline |
366 |
\ \ \ \ \ Leaf\ {\isaliteral{7C}{\isacharbar}}\ Branch\ {\isaliteral{27}{\isacharprime}}a\ \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{27}{\isacharprime}}a\ bintree{\isaliteral{22}{\isachardoublequoteclose}}\ \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{27}{\isacharprime}}a\ bintree{\isaliteral{22}{\isachardoublequoteclose}}% |
|
12745 | 367 |
\begin{isamarkuptext}% |
368 |
\noindent The datatype induction rule generated here is of the form |
|
369 |
\begin{isabelle}% |
|
40406 | 370 |
\ {\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}P\ Leaf{\isaliteral{3B}{\isacharsemicolon}}\isanewline |
371 |
\isaindent{\ \ }{\isaliteral{5C3C416E643E}{\isasymAnd}}a\ bintree{\isadigit{1}}\ bintree{\isadigit{2}}{\isaliteral{2E}{\isachardot}}\isanewline |
|
372 |
\isaindent{\ \ \ \ \ }{\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}P\ bintree{\isadigit{1}}{\isaliteral{3B}{\isacharsemicolon}}\ P\ bintree{\isadigit{2}}{\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ P\ {\isaliteral{28}{\isacharparenleft}}Branch\ a\ bintree{\isadigit{1}}\ bintree{\isadigit{2}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}\isanewline |
|
373 |
\isaindent{\ }{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ P\ bintree% |
|
12747 | 374 |
\end{isabelle}% |
375 |
\end{isamarkuptext}% |
|
17175 | 376 |
\isamarkuptrue% |
12747 | 377 |
% |
378 |
\end{quotation} |
|
379 |
% |
|
380 |
\begin{isamarkuptext}% |
|
12767 | 381 |
\noindent The above document output has been produced as follows: |
12745 | 382 |
|
383 |
\begin{ttbox} |
|
384 |
text {\ttlbrace}* |
|
385 |
The following datatype definition of {\at}{\ttlbrace}text "'a bintree"{\ttrbrace} |
|
386 |
models binary trees with nodes being decorated by elements |
|
387 |
of type {\at}{\ttlbrace}typ 'a{\ttrbrace}. |
|
388 |
*{\ttrbrace} |
|
389 |
||
390 |
datatype 'a bintree = |
|
391 |
Leaf | Branch 'a "'a bintree" "'a bintree" |
|
12767 | 392 |
\end{ttbox} |
393 |
\begin{ttbox} |
|
12745 | 394 |
text {\ttlbrace}* |
395 |
{\ttback}noindent The datatype induction rule generated here is |
|
396 |
of the form {\at}{\ttlbrace}thm [display] bintree.induct [no_vars]{\ttrbrace} |
|
397 |
*{\ttrbrace} |
|
12767 | 398 |
\end{ttbox}\vspace{-\medskipamount} |
12745 | 399 |
|
12747 | 400 |
\noindent Here we have augmented the theory by formal comments |
12767 | 401 |
(using \isakeyword{text} blocks), the informal parts may again refer |
402 |
to formal entities by means of ``antiquotations'' (such as |
|
12745 | 403 |
\texttt{\at}\verb,{text "'a bintree"}, or |
12747 | 404 |
\texttt{\at}\verb,{typ 'a},), see also \S\ref{sec:doc-prep-text}.% |
12644 | 405 |
\end{isamarkuptext}% |
12635 | 406 |
\isamarkuptrue% |
407 |
% |
|
12647 | 408 |
\isamarkupsubsection{Isabelle Sessions% |
12635 | 409 |
} |
410 |
\isamarkuptrue% |
|
411 |
% |
|
412 |
\begin{isamarkuptext}% |
|
12652 | 413 |
In contrast to the highly interactive mode of Isabelle/Isar theory |
414 |
development, the document preparation stage essentially works in |
|
12671 | 415 |
batch-mode. An Isabelle \bfindex{session} consists of a collection |
12767 | 416 |
of source files that may contribute to an output document. Each |
417 |
session is derived from a single parent, usually an object-logic |
|
418 |
image like \texttt{HOL}. This results in an overall tree structure, |
|
419 |
which is reflected by the output location in the file system |
|
45106 | 420 |
(usually rooted at \verb,~/.isabelle/IsabelleXXXX/browser_info,). |
12644 | 421 |
|
12684 | 422 |
\medskip The easiest way to manage Isabelle sessions is via |
28838
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
27027
diff
changeset
|
423 |
\texttt{isabelle mkdir} (generates an initial session source setup) |
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
27027
diff
changeset
|
424 |
and \texttt{isabelle make} (run sessions controlled by |
12684 | 425 |
\texttt{IsaMakefile}). For example, a new session |
426 |
\texttt{MySession} derived from \texttt{HOL} may be produced as |
|
427 |
follows: |
|
428 |
||
429 |
\begin{verbatim} |
|
28838
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
27027
diff
changeset
|
430 |
isabelle mkdir HOL MySession |
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
27027
diff
changeset
|
431 |
isabelle make |
12684 | 432 |
\end{verbatim} |
433 |
||
28838
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
27027
diff
changeset
|
434 |
The \texttt{isabelle make} job also informs about the file-system |
12686 | 435 |
location of the ultimate results. The above dry run should be able |
436 |
to produce some \texttt{document.pdf} (with dummy title, empty table |
|
12743 | 437 |
of contents etc.). Any failure at this stage usually indicates |
17187 | 438 |
technical problems of the {\LaTeX} installation. |
12684 | 439 |
|
440 |
\medskip The detailed arrangement of the session sources is as |
|
12747 | 441 |
follows. |
12644 | 442 |
|
443 |
\begin{itemize} |
|
444 |
||
12671 | 445 |
\item Directory \texttt{MySession} holds the required theory files |
446 |
$T@1$\texttt{.thy}, \dots, $T@n$\texttt{.thy}. |
|
12644 | 447 |
|
448 |
\item File \texttt{MySession/ROOT.ML} holds appropriate ML commands |
|
449 |
for loading all wanted theories, usually just |
|
12666 | 450 |
``\texttt{use_thy"$T@i$";}'' for any $T@i$ in leaf position of the |
12671 | 451 |
dependency graph. |
12644 | 452 |
|
453 |
\item Directory \texttt{MySession/document} contains everything |
|
12652 | 454 |
required for the {\LaTeX} stage; only \texttt{root.tex} needs to be |
455 |
provided initially. |
|
12644 | 456 |
|
12652 | 457 |
The latter file holds appropriate {\LaTeX} code to commence a |
458 |
document (\verb,\documentclass, etc.), and to include the generated |
|
12743 | 459 |
files $T@i$\texttt{.tex} for each theory. Isabelle will generate a |
460 |
file \texttt{session.tex} holding {\LaTeX} commands to include all |
|
12747 | 461 |
generated theory output files in topologically sorted order, so |
462 |
\verb,\input{session}, in the body of \texttt{root.tex} does the job |
|
463 |
in most situations. |
|
12652 | 464 |
|
12682 | 465 |
\item \texttt{IsaMakefile} holds appropriate dependencies and |
466 |
invocations of Isabelle tools to control the batch job. In fact, |
|
12747 | 467 |
several sessions may be managed by the same \texttt{IsaMakefile}. |
12764 | 468 |
See the \emph{Isabelle System Manual} \cite{isabelle-sys} |
469 |
for further details, especially on |
|
28838
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
27027
diff
changeset
|
470 |
\texttt{isabelle usedir} and \texttt{isabelle make}. |
12644 | 471 |
|
472 |
\end{itemize} |
|
473 |
||
12686 | 474 |
One may now start to populate the directory \texttt{MySession}, and |
12767 | 475 |
the file \texttt{MySession/ROOT.ML} accordingly. The file |
476 |
\texttt{MySession/document/root.tex} should also be adapted at some |
|
12686 | 477 |
point; the default version is mostly self-explanatory. Note that |
478 |
\verb,\isabellestyle, enables fine-tuning of the general appearance |
|
479 |
of characters and mathematical symbols (see also |
|
480 |
\S\ref{sec:doc-prep-symbols}). |
|
12652 | 481 |
|
12686 | 482 |
Especially observe the included {\LaTeX} packages \texttt{isabelle} |
483 |
(mandatory), \texttt{isabellesym} (required for mathematical |
|
12743 | 484 |
symbols), and the final \texttt{pdfsetup} (provides sane defaults |
12764 | 485 |
for \texttt{hyperref}, including URL markup). All three are |
12743 | 486 |
distributed with Isabelle. Further packages may be required in |
12764 | 487 |
particular applications, say for unusual mathematical symbols. |
12644 | 488 |
|
12747 | 489 |
\medskip Any additional files for the {\LaTeX} stage go into the |
490 |
\texttt{MySession/document} directory as well. In particular, |
|
12767 | 491 |
adding a file named \texttt{root.bib} causes an automatic run of |
492 |
\texttt{bibtex} to process a bibliographic database; see also |
|
28838
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
27027
diff
changeset
|
493 |
\texttt{isabelle document} \cite{isabelle-sys}. |
12644 | 494 |
|
12652 | 495 |
\medskip Any failure of the document preparation phase in an |
12671 | 496 |
Isabelle batch session leaves the generated sources in their target |
12767 | 497 |
location, identified by the accompanying error message. This lets |
498 |
you trace {\LaTeX} problems with the generated files at hand.% |
|
12644 | 499 |
\end{isamarkuptext}% |
500 |
\isamarkuptrue% |
|
501 |
% |
|
12647 | 502 |
\isamarkupsubsection{Structure Markup% |
12644 | 503 |
} |
504 |
\isamarkuptrue% |
|
505 |
% |
|
506 |
\begin{isamarkuptext}% |
|
12652 | 507 |
The large-scale structure of Isabelle documents follows existing |
508 |
{\LaTeX} conventions, with chapters, sections, subsubsections etc. |
|
509 |
The Isar language includes separate \bfindex{markup commands}, which |
|
12682 | 510 |
do not affect the formal meaning of a theory (or proof), but result |
12666 | 511 |
in corresponding {\LaTeX} elements. |
12644 | 512 |
|
12666 | 513 |
There are separate markup commands depending on the textual context: |
514 |
in header position (just before \isakeyword{theory}), within the |
|
515 |
theory body, or within a proof. The header needs to be treated |
|
516 |
specially here, since ordinary theory and proof commands may only |
|
517 |
occur \emph{after} the initial \isakeyword{theory} specification. |
|
12644 | 518 |
|
12666 | 519 |
\medskip |
12644 | 520 |
|
521 |
\begin{tabular}{llll} |
|
522 |
header & theory & proof & default meaning \\\hline |
|
523 |
& \commdx{chapter} & & \verb,\chapter, \\ |
|
524 |
\commdx{header} & \commdx{section} & \commdx{sect} & \verb,\section, \\ |
|
525 |
& \commdx{subsection} & \commdx{subsect} & \verb,\subsection, \\ |
|
526 |
& \commdx{subsubsection} & \commdx{subsubsect} & \verb,\subsubsection, \\ |
|
527 |
\end{tabular} |
|
528 |
||
529 |
\medskip |
|
530 |
||
531 |
From the Isabelle perspective, each markup command takes a single |
|
40406 | 532 |
$text$ argument (delimited by \verb,",~\isa{{\isaliteral{5C3C646F74733E}{\isasymdots}}}~\verb,", or |
533 |
\verb,{,\verb,*,~\isa{{\isaliteral{5C3C646F74733E}{\isasymdots}}}~\verb,*,\verb,},). After stripping any |
|
12644 | 534 |
surrounding white space, the argument is passed to a {\LaTeX} macro |
12767 | 535 |
\verb,\isamarkupXYZ, for command \isakeyword{XYZ}. These macros are |
536 |
defined in \verb,isabelle.sty, according to the meaning given in the |
|
537 |
rightmost column above. |
|
12644 | 538 |
|
539 |
\medskip The following source fragment illustrates structure markup |
|
12652 | 540 |
of a theory. Note that {\LaTeX} labels may be included inside of |
541 |
section headings as well. |
|
12644 | 542 |
|
543 |
\begin{ttbox} |
|
544 |
header {\ttlbrace}* Some properties of Foo Bar elements *{\ttrbrace} |
|
545 |
||
15136 | 546 |
theory Foo_Bar |
15141 | 547 |
imports Main |
15136 | 548 |
begin |
12644 | 549 |
|
550 |
subsection {\ttlbrace}* Basic definitions *{\ttrbrace} |
|
551 |
||
27027 | 552 |
definition foo :: \dots |
12647 | 553 |
|
27027 | 554 |
definition bar :: \dots |
12647 | 555 |
|
12644 | 556 |
subsection {\ttlbrace}* Derived rules *{\ttrbrace} |
557 |
||
558 |
lemma fooI: \dots |
|
559 |
lemma fooE: \dots |
|
560 |
||
12647 | 561 |
subsection {\ttlbrace}* Main theorem {\ttback}label{\ttlbrace}sec:main-theorem{\ttrbrace} *{\ttrbrace} |
12644 | 562 |
|
563 |
theorem main: \dots |
|
564 |
||
565 |
end |
|
12767 | 566 |
\end{ttbox}\vspace{-\medskipamount} |
12644 | 567 |
|
12767 | 568 |
You may occasionally want to change the meaning of markup commands, |
569 |
say via \verb,\renewcommand, in \texttt{root.tex}. For example, |
|
570 |
\verb,\isamarkupheader, is a good candidate for some tuning. We |
|
571 |
could move it up in the hierarchy to become \verb,\chapter,. |
|
12644 | 572 |
|
573 |
\begin{verbatim} |
|
574 |
\renewcommand{\isamarkupheader}[1]{\chapter{#1}} |
|
575 |
\end{verbatim} |
|
576 |
||
12767 | 577 |
\noindent Now we must change the document class given in |
578 |
\texttt{root.tex} to something that supports chapters. A suitable |
|
579 |
command is \verb,\documentclass{report},. |
|
12644 | 580 |
|
12647 | 581 |
\medskip The {\LaTeX} macro \verb,\isabellecontext, is maintained to |
582 |
hold the name of the current theory context. This is particularly |
|
12652 | 583 |
useful for document headings: |
12644 | 584 |
|
585 |
\begin{verbatim} |
|
12652 | 586 |
\renewcommand{\isamarkupheader}[1] |
12644 | 587 |
{\chapter{#1}\markright{THEORY~\isabellecontext}} |
588 |
\end{verbatim} |
|
589 |
||
590 |
\noindent Make sure to include something like |
|
12647 | 591 |
\verb,\pagestyle{headings}, in \texttt{root.tex}; the document |
12764 | 592 |
should have more than two pages to show the effect.% |
12644 | 593 |
\end{isamarkuptext}% |
594 |
\isamarkuptrue% |
|
595 |
% |
|
12745 | 596 |
\isamarkupsubsection{Formal Comments and Antiquotations \label{sec:doc-prep-text}% |
12644 | 597 |
} |
598 |
\isamarkuptrue% |
|
599 |
% |
|
600 |
\begin{isamarkuptext}% |
|
12745 | 601 |
Isabelle \bfindex{source comments}, which are of the form |
40406 | 602 |
\verb,(,\verb,*,~\isa{{\isaliteral{5C3C646F74733E}{\isasymdots}}}~\verb,*,\verb,),, essentially act like |
12747 | 603 |
white space and do not really contribute to the content. They |
604 |
mainly serve technical purposes to mark certain oddities in the raw |
|
605 |
input text. In contrast, \bfindex{formal comments} are portions of |
|
606 |
text that are associated with formal Isabelle/Isar commands |
|
12682 | 607 |
(\bfindex{marginal comments}), or as standalone paragraphs within a |
12666 | 608 |
theory or proof context (\bfindex{text blocks}). |
12658 | 609 |
|
610 |
\medskip Marginal comments are part of each command's concrete |
|
12671 | 611 |
syntax \cite{isabelle-ref}; the common form is ``\verb,--,~$text$'' |
40406 | 612 |
where $text$ is delimited by \verb,",\isa{{\isaliteral{5C3C646F74733E}{\isasymdots}}}\verb,", or |
613 |
\verb,{,\verb,*,~\isa{{\isaliteral{5C3C646F74733E}{\isasymdots}}}~\verb,*,\verb,}, as before. Multiple |
|
12671 | 614 |
marginal comments may be given at the same time. Here is a simple |
615 |
example:% |
|
12666 | 616 |
\end{isamarkuptext}% |
17175 | 617 |
\isamarkuptrue% |
618 |
\isacommand{lemma}\isamarkupfalse% |
|
40406 | 619 |
\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{2D}{\isacharminus}}{\isaliteral{2D}{\isacharminus}}{\isaliteral{3E}{\isachargreater}}\ A{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
12666 | 620 |
\ \ % |
621 |
\isamarkupcmt{a triviality of propositional logic% |
|
622 |
} |
|
623 |
\isanewline |
|
624 |
\ \ % |
|
625 |
\isamarkupcmt{(should not really bother)% |
|
626 |
} |
|
627 |
\isanewline |
|
17056 | 628 |
% |
629 |
\isadelimproof |
|
630 |
\ \ % |
|
631 |
\endisadelimproof |
|
632 |
% |
|
633 |
\isatagproof |
|
17175 | 634 |
\isacommand{by}\isamarkupfalse% |
40406 | 635 |
\ {\isaliteral{28}{\isacharparenleft}}rule\ impI{\isaliteral{29}{\isacharparenright}}\ % |
16069 | 636 |
\isamarkupcmt{implicit assumption step involved here% |
637 |
} |
|
17056 | 638 |
% |
639 |
\endisatagproof |
|
640 |
{\isafoldproof}% |
|
641 |
% |
|
642 |
\isadelimproof |
|
643 |
% |
|
644 |
\endisadelimproof |
|
12666 | 645 |
% |
646 |
\begin{isamarkuptext}% |
|
647 |
\noindent The above output has been produced as follows: |
|
12658 | 648 |
|
649 |
\begin{verbatim} |
|
650 |
lemma "A --> A" |
|
651 |
-- "a triviality of propositional logic" |
|
652 |
-- "(should not really bother)" |
|
653 |
by (rule impI) -- "implicit assumption step involved here" |
|
654 |
\end{verbatim} |
|
655 |
||
12671 | 656 |
From the {\LaTeX} viewpoint, ``\verb,--,'' acts like a markup |
657 |
command, associated with the macro \verb,\isamarkupcmt, (taking a |
|
658 |
single argument). |
|
12658 | 659 |
|
12666 | 660 |
\medskip Text blocks are introduced by the commands \bfindex{text} |
661 |
and \bfindex{txt}, for theory and proof contexts, respectively. |
|
662 |
Each takes again a single $text$ argument, which is interpreted as a |
|
663 |
free-form paragraph in {\LaTeX} (surrounded by some additional |
|
12671 | 664 |
vertical space). This behavior may be changed by redefining the |
665 |
{\LaTeX} environments of \verb,isamarkuptext, or |
|
666 |
\verb,isamarkuptxt,, respectively (via \verb,\renewenvironment,) The |
|
667 |
text style of the body is determined by \verb,\isastyletext, and |
|
668 |
\verb,\isastyletxt,; the default setup uses a smaller font within |
|
12747 | 669 |
proofs. This may be changed as follows: |
670 |
||
671 |
\begin{verbatim} |
|
672 |
\renewcommand{\isastyletxt}{\isastyletext} |
|
673 |
\end{verbatim} |
|
12658 | 674 |
|
12767 | 675 |
\medskip The $text$ part of Isabelle markup commands essentially |
676 |
inserts \emph{quoted material} into a formal text, mainly for |
|
677 |
instruction of the reader. An \bfindex{antiquotation} is again a |
|
678 |
formal object embedded into such an informal portion. The |
|
679 |
interpretation of antiquotations is limited to some well-formedness |
|
680 |
checks, with the result being pretty printed to the resulting |
|
681 |
document. Quoted text blocks together with antiquotations provide |
|
682 |
an attractive means of referring to formal entities, with good |
|
683 |
confidence in getting the technical details right (especially syntax |
|
684 |
and types). |
|
12658 | 685 |
|
12666 | 686 |
The general syntax of antiquotations is as follows: |
12658 | 687 |
\texttt{{\at}{\ttlbrace}$name$ $arguments${\ttrbrace}}, or |
688 |
\texttt{{\at}{\ttlbrace}$name$ [$options$] $arguments${\ttrbrace}} |
|
12666 | 689 |
for a comma-separated list of options consisting of a $name$ or |
12767 | 690 |
\texttt{$name$=$value$} each. The syntax of $arguments$ depends on |
691 |
the kind of antiquotation, it generally follows the same conventions |
|
692 |
for types, terms, or theorems as in the formal part of a theory. |
|
12649 | 693 |
|
12767 | 694 |
\medskip This sentence demonstrates quotations and antiquotations: |
40406 | 695 |
\isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\ y{\isaliteral{2E}{\isachardot}}\ x} is a well-typed term. |
12658 | 696 |
|
12764 | 697 |
\medskip\noindent The output above was produced as follows: |
12658 | 698 |
\begin{ttbox} |
699 |
text {\ttlbrace}* |
|
12764 | 700 |
This sentence demonstrates quotations and antiquotations: |
12658 | 701 |
{\at}{\ttlbrace}term "%x y. x"{\ttrbrace} is a well-typed term. |
702 |
*{\ttrbrace} |
|
12767 | 703 |
\end{ttbox}\vspace{-\medskipamount} |
12658 | 704 |
|
12764 | 705 |
The notational change from the ASCII character~\verb,%, to the |
40406 | 706 |
symbol~\isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}} reveals that Isabelle printed this term, after |
12767 | 707 |
parsing and type-checking. Document preparation enables symbolic |
708 |
output by default. |
|
12658 | 709 |
|
16523 | 710 |
\medskip The next example includes an option to show the type of all |
711 |
variables. The antiquotation |
|
12767 | 712 |
\texttt{{\at}}\verb,{term [show_types] "%x y. x"}, produces the |
40406 | 713 |
output \isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{5C3C436F6C6F6E3E}{\isasymColon}}{\isaliteral{27}{\isacharprime}}a{\isaliteral{29}{\isacharparenright}}\ y{\isaliteral{5C3C436F6C6F6E3E}{\isasymColon}}{\isaliteral{27}{\isacharprime}}b{\isaliteral{2E}{\isachardot}}\ x}. Type inference has figured |
12767 | 714 |
out the most general typings in the present theory context. Terms |
715 |
may acquire different typings due to constraints imposed by their |
|
716 |
environment; within a proof, for example, variables are given the |
|
717 |
same types as they have in the main goal statement. |
|
12658 | 718 |
|
12764 | 719 |
\medskip Several further kinds of antiquotations and options are |
30649
57753e0ec1d4
1. New cancellation simprocs for common factors in inequations
nipkow
parents:
29297
diff
changeset
|
720 |
available \cite{isabelle-isar-ref}. Here are a few commonly used |
12671 | 721 |
combinations: |
12658 | 722 |
|
723 |
\medskip |
|
724 |
||
725 |
\begin{tabular}{ll} |
|
726 |
\texttt{\at}\verb,{typ,~$\tau$\verb,}, & print type $\tau$ \\ |
|
25338 | 727 |
\texttt{\at}\verb,{const,~$c$\verb,}, & check existence of $c$ and print it \\ |
12658 | 728 |
\texttt{\at}\verb,{term,~$t$\verb,}, & print term $t$ \\ |
729 |
\texttt{\at}\verb,{prop,~$\phi$\verb,}, & print proposition $\phi$ \\ |
|
12666 | 730 |
\texttt{\at}\verb,{prop [display],~$\phi$\verb,}, & print large proposition $\phi$ (with linebreaks) \\ |
12658 | 731 |
\texttt{\at}\verb,{prop [source],~$\phi$\verb,}, & check proposition $\phi$, print its input \\ |
732 |
\texttt{\at}\verb,{thm,~$a$\verb,}, & print fact $a$ \\ |
|
733 |
\texttt{\at}\verb,{thm,~$a$~\verb,[no_vars]}, & print fact $a$, fixing schematic variables \\ |
|
12747 | 734 |
\texttt{\at}\verb,{thm [source],~$a$\verb,}, & check availability of fact $a$, print its name \\ |
12658 | 735 |
\texttt{\at}\verb,{text,~$s$\verb,}, & print uninterpreted text $s$ \\ |
736 |
\end{tabular} |
|
737 |
||
738 |
\medskip |
|
739 |
||
12666 | 740 |
Note that \attrdx{no_vars} given above is \emph{not} an |
741 |
antiquotation option, but an attribute of the theorem argument given |
|
742 |
here. This might be useful with a diagnostic command like |
|
743 |
\isakeyword{thm}, too. |
|
12658 | 744 |
|
12666 | 745 |
\medskip The \texttt{\at}\verb,{text, $s$\verb,}, antiquotation is |
12658 | 746 |
particularly interesting. Embedding uninterpreted text within an |
12666 | 747 |
informal body might appear useless at first sight. Here the key |
748 |
virtue is that the string $s$ is processed as Isabelle output, |
|
749 |
interpreting Isabelle symbols appropriately. |
|
12658 | 750 |
|
40406 | 751 |
For example, \texttt{\at}\verb,{text "\<forall>\<exists>"}, produces \isa{{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}}, according to the standard interpretation of these symbol |
12666 | 752 |
(cf.\ \S\ref{sec:doc-prep-symbols}). Thus we achieve consistent |
12658 | 753 |
mathematical notation in both the formal and informal parts of the |
12767 | 754 |
document very easily, independently of the term language of |
755 |
Isabelle. Manual {\LaTeX} code would leave more control over the |
|
756 |
typesetting, but is also slightly more tedious.% |
|
12644 | 757 |
\end{isamarkuptext}% |
758 |
\isamarkuptrue% |
|
759 |
% |
|
12674 | 760 |
\isamarkupsubsection{Interpretation of Symbols \label{sec:doc-prep-symbols}% |
12644 | 761 |
} |
762 |
\isamarkuptrue% |
|
763 |
% |
|
764 |
\begin{isamarkuptext}% |
|
12666 | 765 |
As has been pointed out before (\S\ref{sec:syntax-symbols}), |
12671 | 766 |
Isabelle symbols are the smallest syntactic entities --- a |
12682 | 767 |
straightforward generalization of ASCII characters. While Isabelle |
12666 | 768 |
does not impose any interpretation of the infinite collection of |
12764 | 769 |
named symbols, {\LaTeX} documents use canonical glyphs for certain |
28838
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
27027
diff
changeset
|
770 |
standard symbols \cite{isabelle-isar-ref}. |
12658 | 771 |
|
12767 | 772 |
The {\LaTeX} code produced from Isabelle text follows a simple |
773 |
scheme. You can tune the final appearance by redefining certain |
|
774 |
macros, say in \texttt{root.tex} of the document. |
|
12671 | 775 |
|
776 |
\begin{enumerate} |
|
12658 | 777 |
|
12671 | 778 |
\item 7-bit ASCII characters: letters \texttt{A\dots Z} and |
12747 | 779 |
\texttt{a\dots z} are output directly, digits are passed as an |
12671 | 780 |
argument to the \verb,\isadigit, macro, other characters are |
781 |
replaced by specifically named macros of the form |
|
12666 | 782 |
\verb,\isacharXYZ,. |
12658 | 783 |
|
12767 | 784 |
\item Named symbols: \verb,\,\verb,<XYZ>, is turned into |
785 |
\verb,{\isasymXYZ},; note the additional braces. |
|
12658 | 786 |
|
12767 | 787 |
\item Named control symbols: \verb,\,\verb,<^XYZ>, is turned into |
788 |
\verb,\isactrlXYZ,; subsequent symbols may act as arguments if the |
|
789 |
control macro is defined accordingly. |
|
12671 | 790 |
|
12666 | 791 |
\end{enumerate} |
792 |
||
12764 | 793 |
You may occasionally wish to give new {\LaTeX} interpretations of |
794 |
named symbols. This merely requires an appropriate definition of |
|
12767 | 795 |
\verb,\isasymXYZ,, for \verb,\,\verb,<XYZ>, (see |
12747 | 796 |
\texttt{isabelle.sty} for working examples). Control symbols are |
797 |
slightly more difficult to get right, though. |
|
12666 | 798 |
|
799 |
\medskip The \verb,\isabellestyle, macro provides a high-level |
|
800 |
interface to tune the general appearance of individual symbols. For |
|
12671 | 801 |
example, \verb,\isabellestyle{it}, uses the italics text style to |
802 |
mimic the general appearance of the {\LaTeX} math mode; double |
|
12743 | 803 |
quotes are not printed at all. The resulting quality of typesetting |
804 |
is quite good, so this should be the default style for work that |
|
805 |
gets distributed to a broader audience.% |
|
12644 | 806 |
\end{isamarkuptext}% |
807 |
\isamarkuptrue% |
|
808 |
% |
|
12652 | 809 |
\isamarkupsubsection{Suppressing Output \label{sec:doc-prep-suppress}% |
12644 | 810 |
} |
811 |
\isamarkuptrue% |
|
812 |
% |
|
813 |
\begin{isamarkuptext}% |
|
12749 | 814 |
By default, Isabelle's document system generates a {\LaTeX} file for |
815 |
each theory that gets loaded while running the session. The |
|
816 |
generated \texttt{session.tex} will include all of these in order of |
|
817 |
appearance, which in turn gets included by the standard |
|
12743 | 818 |
\texttt{root.tex}. Certainly one may change the order or suppress |
12747 | 819 |
unwanted theories by ignoring \texttt{session.tex} and load |
820 |
individual files directly in \texttt{root.tex}. On the other hand, |
|
821 |
such an arrangement requires additional maintenance whenever the |
|
822 |
collection of theories changes. |
|
12647 | 823 |
|
824 |
Alternatively, one may tune the theory loading process in |
|
12652 | 825 |
\texttt{ROOT.ML} itself: traversal of the theory dependency graph |
12671 | 826 |
may be fine-tuned by adding \verb,use_thy, invocations, although |
827 |
topological sorting still has to be observed. Moreover, the ML |
|
828 |
operator \verb,no_document, temporarily disables document generation |
|
12767 | 829 |
while executing a theory loader command. Its usage is like this: |
12647 | 830 |
|
831 |
\begin{verbatim} |
|
12666 | 832 |
no_document use_thy "T"; |
12647 | 833 |
\end{verbatim} |
12644 | 834 |
|
17187 | 835 |
\medskip Theory output may be suppressed more selectively, either |
836 |
via \bfindex{tagged command regions} or \bfindex{ignored material}. |
|
12647 | 837 |
|
17187 | 838 |
Tagged command regions works by annotating commands with named tags, |
839 |
which correspond to certain {\LaTeX} markup that tells how to treat |
|
840 |
particular parts of a document when doing the actual type-setting. |
|
841 |
By default, certain Isabelle/Isar commands are implicitly marked up |
|
842 |
using the predefined tags ``\emph{theory}'' (for theory begin and |
|
843 |
end), ``\emph{proof}'' (for proof commands), and ``\emph{ML}'' (for |
|
844 |
commands involving ML code). Users may add their own tags using the |
|
845 |
\verb,%,\emph{tag} notation right after a command name. In the |
|
846 |
subsequent example we hide a particularly irrelevant proof:% |
|
847 |
\end{isamarkuptext}% |
|
848 |
\isamarkuptrue% |
|
849 |
\isacommand{lemma}\isamarkupfalse% |
|
40406 | 850 |
\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{3D}{\isacharequal}}\ x{\isaliteral{22}{\isachardoublequoteclose}}% |
17187 | 851 |
\isadeliminvisible |
852 |
\ % |
|
853 |
\endisadeliminvisible |
|
854 |
% |
|
855 |
\isataginvisible |
|
856 |
\isacommand{by}\isamarkupfalse% |
|
40406 | 857 |
\ {\isaliteral{28}{\isacharparenleft}}simp{\isaliteral{29}{\isacharparenright}}% |
17187 | 858 |
\endisataginvisible |
859 |
{\isafoldinvisible}% |
|
860 |
% |
|
861 |
\isadeliminvisible |
|
862 |
% |
|
863 |
\endisadeliminvisible |
|
864 |
% |
|
865 |
\begin{isamarkuptext}% |
|
866 |
The original source has been ``\verb,lemma "x = x" by %invisible (simp),''. |
|
867 |
Tags observe the structure of proofs; adjacent commands with the |
|
868 |
same tag are joined into a single region. The Isabelle document |
|
869 |
preparation system allows the user to specify how to interpret a |
|
870 |
tagged region, in order to keep, drop, or fold the corresponding |
|
871 |
parts of the document. See the \emph{Isabelle System Manual} |
|
872 |
\cite{isabelle-sys} for further details, especially on |
|
28838
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
27027
diff
changeset
|
873 |
\texttt{isabelle usedir} and \texttt{isabelle document}. |
12647 | 874 |
|
17187 | 875 |
Ignored material is specified by delimiting the original formal |
876 |
source with special source comments |
|
877 |
\verb,(,\verb,*,\verb,<,\verb,*,\verb,), and |
|
878 |
\verb,(,\verb,*,\verb,>,\verb,*,\verb,),. These parts are stripped |
|
879 |
before the type-setting phase, without affecting the formal checking |
|
880 |
of the theory, of course. For example, we may hide parts of a proof |
|
881 |
that seem unfit for general public inspection. The following |
|
882 |
``fully automatic'' proof is actually a fake:% |
|
12649 | 883 |
\end{isamarkuptext}% |
17175 | 884 |
\isamarkuptrue% |
885 |
\isacommand{lemma}\isamarkupfalse% |
|
40406 | 886 |
\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}\ {\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}int{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isadigit{0}}\ {\isaliteral{3C}{\isacharless}}\ x\ {\isaliteral{2A}{\isacharasterisk}}\ x{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
17056 | 887 |
% |
888 |
\isadelimproof |
|
889 |
\ \ % |
|
890 |
\endisadelimproof |
|
891 |
% |
|
892 |
\isatagproof |
|
17175 | 893 |
\isacommand{by}\isamarkupfalse% |
40406 | 894 |
\ {\isaliteral{28}{\isacharparenleft}}auto{\isaliteral{29}{\isacharparenright}}% |
17056 | 895 |
\endisatagproof |
896 |
{\isafoldproof}% |
|
897 |
% |
|
898 |
\isadelimproof |
|
899 |
% |
|
900 |
\endisadelimproof |
|
12649 | 901 |
% |
902 |
\begin{isamarkuptext}% |
|
17187 | 903 |
\noindent The real source of the proof has been as follows: |
12649 | 904 |
|
905 |
\begin{verbatim} |
|
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
13791
diff
changeset
|
906 |
by (auto(*<*)simp add: zero_less_mult_iff(*>*)) |
12658 | 907 |
\end{verbatim} |
908 |
%(* |
|
12649 | 909 |
|
12767 | 910 |
\medskip Suppressing portions of printed text demands care. You |
911 |
should not misrepresent the underlying theory development. It is |
|
912 |
easy to invalidate the visible text by hiding references to |
|
17196 | 913 |
questionable axioms, for example.% |
12635 | 914 |
\end{isamarkuptext}% |
17175 | 915 |
\isamarkuptrue% |
17056 | 916 |
% |
917 |
\isadelimtheory |
|
918 |
% |
|
919 |
\endisadelimtheory |
|
920 |
% |
|
921 |
\isatagtheory |
|
922 |
% |
|
923 |
\endisatagtheory |
|
924 |
{\isafoldtheory}% |
|
925 |
% |
|
926 |
\isadelimtheory |
|
927 |
% |
|
928 |
\endisadelimtheory |
|
11648 | 929 |
\end{isabellebody}% |
930 |
%%% Local Variables: |
|
931 |
%%% mode: latex |
|
932 |
%%% TeX-master: "root" |
|
933 |
%%% End: |