48 |
48 |
49 \subsection{Comments} |
49 \subsection{Comments} |
50 |
50 |
51 Large chunks of plain \railqtoken{text} are usually given |
51 Large chunks of plain \railqtoken{text} are usually given |
52 \railtoken{verbatim}, i.e.\ enclosed in \verb|{*|\dots\verb|*}|. For |
52 \railtoken{verbatim}, i.e.\ enclosed in \verb|{*|\dots\verb|*}|. For |
53 convenience, any of the smaller text conforming to \railqtoken{nameref} are |
53 convenience, any of the smaller text units conforming to \railqtoken{nameref} |
54 admitted as well. Almost any of the Isar commands may be annotated by some |
54 are admitted as well. Almost any of the Isar commands may be annotated by |
55 marginal \railnonterm{comment} of the form \texttt{--} \railqtoken{text}. |
55 some marginal \railnonterm{comment} of the form \texttt{--} \railqtoken{text}. |
56 Note that this kind of comment is actually part of the language, while source |
56 Note that this kind of comment is actually part of the language, while source |
57 level comments \verb|(*|\dots\verb|*)| are already stripped at the lexical |
57 level comments \verb|(*|\dots\verb|*)| are already stripped at the lexical |
58 level. A few commands such as $\PROOFNAME$ admit additional markup with a |
58 level. A few commands such as $\PROOFNAME$ admit additional markup with a |
59 ``level of interest'': \texttt{\%} followed by an optional number $n$ (default |
59 ``level of interest'': \texttt{\%} followed by an optional number $n$ (default |
60 $n = 1$) indicates that the respective part of the document becomes $n$ levels |
60 $n = 1$) indicates that the respective part of the document becomes $n$ levels |
94 \subsection{Types and terms}\label{sec:types-terms} |
94 \subsection{Types and terms}\label{sec:types-terms} |
95 |
95 |
96 The actual inner Isabelle syntax, that of types and terms of the logic, is far |
96 The actual inner Isabelle syntax, that of types and terms of the logic, is far |
97 too flexible in order to be modeled explicitly at the outer theory level. |
97 too flexible in order to be modeled explicitly at the outer theory level. |
98 Basically, any such entity has to be quoted at the outer level to turn it into |
98 Basically, any such entity has to be quoted at the outer level to turn it into |
99 a single token, with the actual parsing deferred to some functions for reading |
99 a single token (the parsing and type-checking is performed later). For |
100 and type-checking. For convenience, a more liberal convention is adopted: |
100 convenience, a slightly more liberal convention is adopted: quotes may be |
101 quotes may be omitted for any type or term that is already \emph{atomic} at |
101 omitted for any type or term that is already \emph{atomic at the outer level}. |
102 the outer level. E.g.\ one may write \texttt{x} instead of \texttt{"x"}. |
102 E.g.\ one may write just \texttt{x} instead of \texttt{"x"}. |
103 |
103 |
104 \indexoutertoken{type}\indexoutertoken{term}\indexoutertoken{prop} |
104 \indexoutertoken{type}\indexoutertoken{term}\indexoutertoken{prop} |
105 \begin{rail} |
105 \begin{rail} |
106 type: nameref | typefree | typevar |
106 type: nameref | typefree | typevar |
107 ; |
107 ; |
163 Attributes (and proof methods, see \S\ref{sec:syn-meth}) have their own |
163 Attributes (and proof methods, see \S\ref{sec:syn-meth}) have their own |
164 ``semi-inner'' syntax, which does not have to be atomic at the outer level |
164 ``semi-inner'' syntax, which does not have to be atomic at the outer level |
165 unlike that of types and terms. Instead, the attribute argument |
165 unlike that of types and terms. Instead, the attribute argument |
166 specifications may be any sequence of atomic entities (identifiers, strings |
166 specifications may be any sequence of atomic entities (identifiers, strings |
167 etc.), or properly bracketed argument lists. Below \railqtoken{atom} refers |
167 etc.), or properly bracketed argument lists. Below \railqtoken{atom} refers |
168 to any atomic entity, including keywords that conform to \railtoken{symident}. |
168 to any atomic entity, including \railtoken{keyword}s conforming to |
|
169 \railtoken{symident}. |
169 |
170 |
170 \indexoutertoken{atom}\indexouternonterm{args}\indexouternonterm{attributes} |
171 \indexoutertoken{atom}\indexouternonterm{args}\indexouternonterm{attributes} |
171 \begin{rail} |
172 \begin{rail} |
172 atom: nameref | typefree | typevar | var | textvar | nat | keyword |
173 atom: nameref | typefree | typevar | var | textvar | nat | keyword |
173 ; |
174 ; |
178 attributes: '[' (nameref args * ',') ']' |
179 attributes: '[' (nameref args * ',') ']' |
179 ; |
180 ; |
180 \end{rail} |
181 \end{rail} |
181 |
182 |
182 Theorem specifications come in several flavors: \railnonterm{axmdecl} and |
183 Theorem specifications come in several flavors: \railnonterm{axmdecl} and |
183 \railnonterm{thmdecl} usually refer to assumptions or results of goal |
184 \railnonterm{thmdecl} usually refer to axioms, assumptions or results of goal |
184 statements, \railnonterm{thmdef} collects lists of existing theorems, |
185 statements, \railnonterm{thmdef} collects lists of existing theorems. |
185 \railnonterm{thmrefs} refers to any lists of existing theorems. Any of these |
186 Existing theorems are given by \railnonterm{thmref} and \railnonterm{thmrefs} |
186 may include lists of attributes, which are applied to the preceding theorem or |
187 (the former requires an actual singleton result). Any of these theorem |
187 list of theorems. |
188 specifications may include lists of attributes both on the left and right hand |
|
189 sides; attributes are applied to the any immediately preceding theorem. |
188 |
190 |
189 \indexouternonterm{thmdecl}\indexouternonterm{axmdecl} |
191 \indexouternonterm{thmdecl}\indexouternonterm{axmdecl} |
190 \indexouternonterm{thmdef}\indexouternonterm{thmrefs} |
192 \indexouternonterm{thmdef}\indexouternonterm{thmrefs} |
191 \begin{rail} |
193 \begin{rail} |
192 axmdecl: name attributes? ':' |
194 axmdecl: name attributes? ':' |
193 ; |
195 ; |
194 thmdecl: thmname ':' |
196 thmdecl: thmname ':' |
195 ; |
197 ; |
196 thmdef: thmname '=' |
198 thmdef: thmname '=' |
197 ; |
199 ; |
198 thmrefs: nameref attributes? + |
200 thmref: nameref attributes? |
|
201 ; |
|
202 thmrefs: thmref + |
199 ; |
203 ; |
200 |
204 |
201 thmname: name attributes | name | attributes |
205 thmname: name attributes | name | attributes |
202 ; |
206 ; |
203 \end{rail} |
207 \end{rail} |
204 |
208 |
205 |
209 |
206 \subsection{Proof methods}\label{sec:syn-meth} |
210 \subsection{Proof methods}\label{sec:syn-meth} |
207 |
211 |
208 Proof methods are either basic ones, or expressions composed of methods via |
212 Proof methods are either basic ones, or expressions composed of methods via |
209 ``\texttt{,}'' (sequential composition), ``\texttt{|}'' (alternatives), |
213 ``\texttt{,}'' (sequential composition), ``\texttt{|}'' (alternative choices), |
210 ``\texttt{?}'' (try), ``\texttt{*}'' (repeat ${} \ge 0$ times), ``\texttt{+}'' |
214 ``\texttt{?}'' (try), ``\texttt{*}'' (repeat ${} \ge 0$ times), ``\texttt{+}'' |
211 (repeat ${} > 0$ times). In practice, proof methods are usually just a comma |
215 (repeat ${} > 0$ times). In practice, proof methods are usually just a comma |
212 separated list of \railqtoken{nameref}~\railnonterm{args} specifications. |
216 separated list of (\railqtoken{nameref}~\railnonterm{args}) specifications. |
213 Thus the syntax is similar to that of attributes, with plain parentheses |
217 Thus the syntax is similar to that of attributes, with plain parentheses |
214 instead of square brackets (see also \S\ref{sec:syn-att}). Note that |
218 instead of square brackets (see also \S\ref{sec:syn-att}). Note that |
215 parentheses may be dropped for single method specifications without arguments. |
219 parentheses may be dropped for single method specifications without arguments. |
216 |
220 |
217 \indexouternonterm{method} |
221 \indexouternonterm{method} |