author | wenzelm |
Tue, 31 Mar 2015 22:31:05 +0200 | |
changeset 59886 | e0dc738eb08c |
parent 59853 | 4039d8aecda4 |
child 60131 | 2506f17d2739 |
permissions | -rw-r--r-- |
27037 | 1 |
theory Outer_Syntax |
42651 | 2 |
imports Base Main |
27037 | 3 |
begin |
4 |
||
58618 | 5 |
chapter \<open>Outer syntax --- the theory language \label{ch:outer-syntax}\<close> |
27037 | 6 |
|
58618 | 7 |
text \<open> |
27037 | 8 |
The rather generic framework of Isabelle/Isar syntax emerges from |
9 |
three main syntactic categories: \emph{commands} of the top-level |
|
10 |
Isar engine (covering theory and proof elements), \emph{methods} for |
|
11 |
general goal refinements (analogous to traditional ``tactics''), and |
|
12 |
\emph{attributes} for operations on facts (within a certain |
|
13 |
context). Subsequently we give a reference of basic syntactic |
|
14 |
entities underlying Isabelle/Isar syntax in a bottom-up manner. |
|
15 |
Concrete theory and proof language elements will be introduced later |
|
16 |
on. |
|
17 |
||
18 |
\medskip In order to get started with writing well-formed |
|
19 |
Isabelle/Isar documents, the most important aspect to be noted is |
|
20 |
the difference of \emph{inner} versus \emph{outer} syntax. Inner |
|
21 |
syntax is that of Isabelle types and terms of the logic, while outer |
|
22 |
syntax is that of Isabelle/Isar theory sources (specifications and |
|
23 |
proofs). As a general rule, inner syntax entities may occur only as |
|
24 |
\emph{atomic entities} within outer syntax. For example, the string |
|
58724 | 25 |
@{verbatim \<open>"x + y"\<close>} and identifier @{verbatim z} are legal term |
27037 | 26 |
specifications within a theory, while @{verbatim "x + y"} without |
27 |
quotes is not. |
|
28 |
||
29 |
Printed theory documents usually omit quotes to gain readability |
|
30 |
(this is a matter of {\LaTeX} macro setup, say via @{verbatim |
|
58552 | 31 |
"\\isabellestyle"}, see also @{cite "isabelle-sys"}). Experienced |
27037 | 32 |
users of Isabelle/Isar may easily reconstruct the lost technical |
33 |
information, while mere readers need not care about quotes at all. |
|
58618 | 34 |
\<close> |
27037 | 35 |
|
36 |
||
58618 | 37 |
section \<open>Commands\<close> |
50213 | 38 |
|
58618 | 39 |
text \<open> |
50213 | 40 |
\begin{matharray}{rcl} |
41 |
@{command_def "print_commands"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\ |
|
42 |
@{command_def "help"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\ |
|
43 |
\end{matharray} |
|
44 |
||
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
45 |
@{rail \<open> |
50213 | 46 |
@@{command help} (@{syntax name} * ) |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
47 |
\<close>} |
50213 | 48 |
|
49 |
\begin{description} |
|
50 |
||
51 |
\item @{command "print_commands"} prints all outer syntax keywords |
|
52 |
and commands. |
|
53 |
||
54 |
\item @{command "help"}~@{text "pats"} retrieves outer syntax |
|
55 |
commands according to the specified name patterns. |
|
56 |
||
57 |
\end{description} |
|
58618 | 58 |
\<close> |
50213 | 59 |
|
60 |
||
58618 | 61 |
subsubsection \<open>Examples\<close> |
50213 | 62 |
|
58618 | 63 |
text \<open>Some common diagnostic commands are retrieved like this |
64 |
(according to usual naming conventions):\<close> |
|
50213 | 65 |
|
66 |
help "print" |
|
67 |
help "find" |
|
68 |
||
69 |
||
58618 | 70 |
section \<open>Lexical matters \label{sec:outer-lex}\<close> |
27037 | 71 |
|
58618 | 72 |
text \<open>The outer lexical syntax consists of three main categories of |
28776 | 73 |
syntax tokens: |
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
74 |
|
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
75 |
\begin{enumerate} |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
76 |
|
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
77 |
\item \emph{major keywords} --- the command names that are available |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
78 |
in the present logic session; |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
79 |
|
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
80 |
\item \emph{minor keywords} --- additional literal tokens required |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
81 |
by the syntax of commands; |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
82 |
|
28776 | 83 |
\item \emph{named tokens} --- various categories of identifiers etc. |
27037 | 84 |
|
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
85 |
\end{enumerate} |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
86 |
|
28776 | 87 |
Major keywords and minor keywords are guaranteed to be disjoint. |
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
88 |
This helps user-interfaces to determine the overall structure of a |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
89 |
theory text, without knowing the full details of command syntax. |
28776 | 90 |
Internally, there is some additional information about the kind of |
91 |
major keywords, which approximates the command type (theory command, |
|
92 |
proof command etc.). |
|
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
93 |
|
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
94 |
Keywords override named tokens. For example, the presence of a |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
95 |
command called @{verbatim term} inhibits the identifier @{verbatim |
58724 | 96 |
term}, but the string @{verbatim \<open>"term"\<close>} can be used instead. |
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
97 |
By convention, the outer syntax always allows quoted strings in |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
98 |
addition to identifiers, wherever a named entity is expected. |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
99 |
|
28776 | 100 |
When tokenizing a given input sequence, the lexer repeatedly takes |
101 |
the longest prefix of the input that forms a valid token. Spaces, |
|
102 |
tabs, newlines and formfeeds between tokens serve as explicit |
|
103 |
separators. |
|
104 |
||
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
105 |
\medskip The categories for named tokens are defined once and for |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
106 |
all as follows. |
27037 | 107 |
|
28776 | 108 |
\begin{center} |
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
109 |
\begin{supertabular}{rcl} |
53059 | 110 |
@{syntax_def ident} & = & @{text "letter (subscript\<^sup>? quasiletter)\<^sup>*"} \\ |
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
111 |
@{syntax_def longident} & = & @{text "ident("}@{verbatim "."}@{text "ident)\<^sup>+"} \\ |
58724 | 112 |
@{syntax_def symident} & = & @{text "sym\<^sup>+ | "}@{verbatim \<open>\\<close>}@{verbatim "<"}@{text ident}@{verbatim ">"} \\ |
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
113 |
@{syntax_def nat} & = & @{text "digit\<^sup>+"} \\ |
40290
47f572aff50a
support for floating-point tokens in outer syntax (coinciding with inner syntax version);
wenzelm
parents:
35841
diff
changeset
|
114 |
@{syntax_def float} & = & @{syntax_ref nat}@{verbatim "."}@{syntax_ref nat}@{text " | "}@{verbatim "-"}@{syntax_ref nat}@{verbatim "."}@{syntax_ref nat} \\ |
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
115 |
@{syntax_def var} & = & @{verbatim "?"}@{text "ident | "}@{verbatim "?"}@{text ident}@{verbatim "."}@{text nat} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
116 |
@{syntax_def typefree} & = & @{verbatim "'"}@{text ident} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
117 |
@{syntax_def typevar} & = & @{verbatim "?"}@{text "typefree | "}@{verbatim "?"}@{text typefree}@{verbatim "."}@{text nat} \\ |
58724 | 118 |
@{syntax_def string} & = & @{verbatim \<open>"\<close>} @{text "\<dots>"} @{verbatim \<open>"\<close>} \\ |
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
119 |
@{syntax_def altstring} & = & @{verbatim "`"} @{text "\<dots>"} @{verbatim "`"} \\ |
55033 | 120 |
@{syntax_def cartouche} & = & @{verbatim "\<open>"} @{text "\<dots>"} @{verbatim "\<close>"} \\ |
58725 | 121 |
@{syntax_def verbatim} & = & @{verbatim "{*"} @{text "\<dots>"} @{verbatim "*}"} \\[1ex] |
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
122 |
|
58724 | 123 |
@{text letter} & = & @{text "latin | "}@{verbatim \<open>\\<close>}@{verbatim "<"}@{text latin}@{verbatim ">"}@{text " | "}@{verbatim \<open>\\<close>}@{verbatim "<"}@{text "latin latin"}@{verbatim ">"}@{text " | greek |"} \\ |
53059 | 124 |
@{text subscript} & = & @{verbatim "\<^sub>"} \\ |
28775
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
125 |
@{text quasiletter} & = & @{text "letter | digit | "}@{verbatim "_"}@{text " | "}@{verbatim "'"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
126 |
@{text latin} & = & @{verbatim a}@{text " | \<dots> | "}@{verbatim z}@{text " | "}@{verbatim A}@{text " | \<dots> | "}@{verbatim Z} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
127 |
@{text digit} & = & @{verbatim "0"}@{text " | \<dots> | "}@{verbatim "9"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
128 |
@{text sym} & = & @{verbatim "!"}@{text " | "}@{verbatim "#"}@{text " | "}@{verbatim "$"}@{text " | "}@{verbatim "%"}@{text " | "}@{verbatim "&"}@{text " | "}@{verbatim "*"}@{text " | "}@{verbatim "+"}@{text " | "}@{verbatim "-"}@{text " | "}@{verbatim "/"}@{text " |"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
129 |
& & @{verbatim "<"}@{text " | "}@{verbatim "="}@{text " | "}@{verbatim ">"}@{text " | "}@{verbatim "?"}@{text " | "}@{verbatim "@"}@{text " | "}@{verbatim "^"}@{text " | "}@{verbatim "_"}@{text " | "}@{verbatim "|"}@{text " | "}@{verbatim "~"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
130 |
@{text greek} & = & @{verbatim "\<alpha>"}@{text " | "}@{verbatim "\<beta>"}@{text " | "}@{verbatim "\<gamma>"}@{text " | "}@{verbatim "\<delta>"}@{text " |"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
131 |
& & @{verbatim "\<epsilon>"}@{text " | "}@{verbatim "\<zeta>"}@{text " | "}@{verbatim "\<eta>"}@{text " | "}@{verbatim "\<theta>"}@{text " |"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
132 |
& & @{verbatim "\<iota>"}@{text " | "}@{verbatim "\<kappa>"}@{text " | "}@{verbatim "\<mu>"}@{text " | "}@{verbatim "\<nu>"}@{text " |"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
133 |
& & @{verbatim "\<xi>"}@{text " | "}@{verbatim "\<pi>"}@{text " | "}@{verbatim "\<rho>"}@{text " | "}@{verbatim "\<sigma>"}@{text " | "}@{verbatim "\<tau>"}@{text " |"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
134 |
& & @{verbatim "\<upsilon>"}@{text " | "}@{verbatim "\<phi>"}@{text " | "}@{verbatim "\<chi>"}@{text " | "}@{verbatim "\<psi>"}@{text " |"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
135 |
& & @{verbatim "\<omega>"}@{text " | "}@{verbatim "\<Gamma>"}@{text " | "}@{verbatim "\<Delta>"}@{text " | "}@{verbatim "\<Theta>"}@{text " |"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
136 |
& & @{verbatim "\<Lambda>"}@{text " | "}@{verbatim "\<Xi>"}@{text " | "}@{verbatim "\<Pi>"}@{text " | "}@{verbatim "\<Sigma>"}@{text " |"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
137 |
& & @{verbatim "\<Upsilon>"}@{text " | "}@{verbatim "\<Phi>"}@{text " | "}@{verbatim "\<Psi>"}@{text " | "}@{verbatim "\<Omega>"} \\ |
d25fe9601dbd
tuned outer lexical syntax; fixed var/tvar: really need question marks here;
wenzelm
parents:
28774
diff
changeset
|
138 |
\end{supertabular} |
28776 | 139 |
\end{center} |
27037 | 140 |
|
28778 | 141 |
A @{syntax_ref var} or @{syntax_ref typevar} describes an unknown, |
142 |
which is internally a pair of base name and index (ML type @{ML_type |
|
143 |
indexname}). These components are either separated by a dot as in |
|
144 |
@{text "?x.1"} or @{text "?x7.3"} or run together as in @{text |
|
145 |
"?x1"}. The latter form is possible if the base name does not end |
|
146 |
with digits. If the index is 0, it may be dropped altogether: |
|
147 |
@{text "?x"} and @{text "?x0"} and @{text "?x.0"} all refer to the |
|
148 |
same unknown, with basename @{text "x"} and index 0. |
|
149 |
||
150 |
The syntax of @{syntax_ref string} admits any characters, including |
|
58724 | 151 |
newlines; ``@{verbatim \<open>"\<close>}'' (double-quote) and ``@{verbatim \<open>\\<close>}'' |
152 |
(backslash) need to be escaped by a backslash; arbitrary |
|
153 |
character codes may be specified as ``@{verbatim \<open>\\<close>}@{text ddd}'', |
|
27037 | 154 |
with three decimal digits. Alternative strings according to |
28778 | 155 |
@{syntax_ref altstring} are analogous, using single back-quotes |
156 |
instead. |
|
157 |
||
58725 | 158 |
The body of @{syntax_ref verbatim} may consist of any text not containing |
159 |
``@{verbatim "*}"}''; this allows to include quotes without further |
|
160 |
escapes, but there is no way to escape ``@{verbatim "*}"}''. Cartouches |
|
161 |
do not have this limitation. |
|
28778 | 162 |
|
55033 | 163 |
A @{syntax_ref cartouche} consists of arbitrary text, with properly |
164 |
balanced blocks of ``@{verbatim "\<open>"}~@{text "\<dots>"}~@{verbatim |
|
165 |
"\<close>"}''. Note that the rendering of cartouche delimiters is |
|
166 |
usually like this: ``@{text "\<open> \<dots> \<close>"}''. |
|
167 |
||
28778 | 168 |
Source comments take the form @{verbatim "(*"}~@{text |
169 |
"\<dots>"}~@{verbatim "*)"} and may be nested, although the user-interface |
|
170 |
might prevent this. Note that this form indicates source comments |
|
171 |
only, which are stripped after lexical analysis of the input. The |
|
172 |
Isar syntax also provides proper \emph{document comments} that are |
|
173 |
considered as part of the text (see \secref{sec:comments}). |
|
27037 | 174 |
|
175 |
Common mathematical symbols such as @{text \<forall>} are represented in |
|
176 |
Isabelle as @{verbatim \<forall>}. There are infinitely many Isabelle |
|
177 |
symbols like this, although proper presentation is left to front-end |
|
58842 | 178 |
tools such as {\LaTeX} or Isabelle/jEdit. A list of |
47822
34b44d28fc4b
some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x;
wenzelm
parents:
47114
diff
changeset
|
179 |
predefined Isabelle symbols that work well with these tools is given |
34b44d28fc4b
some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x;
wenzelm
parents:
47114
diff
changeset
|
180 |
in \appref{app:symbols}. Note that @{verbatim "\<lambda>"} does not belong |
34b44d28fc4b
some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x;
wenzelm
parents:
47114
diff
changeset
|
181 |
to the @{text letter} category, since it is already used differently |
58618 | 182 |
in the Pure term language.\<close> |
27037 | 183 |
|
184 |
||
58618 | 185 |
section \<open>Common syntax entities\<close> |
27037 | 186 |
|
58618 | 187 |
text \<open> |
27037 | 188 |
We now introduce several basic syntactic entities, such as names, |
189 |
terms, and theorem specifications, which are factored out of the |
|
190 |
actual Isar language elements to be described later. |
|
58618 | 191 |
\<close> |
27037 | 192 |
|
193 |
||
58618 | 194 |
subsection \<open>Names\<close> |
27037 | 195 |
|
58618 | 196 |
text \<open>Entity @{syntax name} usually refers to any name of types, |
27037 | 197 |
constants, theorems etc.\ that are to be \emph{declared} or |
198 |
\emph{defined} (so qualified identifiers are excluded here). Quoted |
|
199 |
strings provide an escape for non-identifier names or those ruled |
|
58724 | 200 |
out by outer syntax keywords (e.g.\ quoted @{verbatim \<open>"let"\<close>}). |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
201 |
Already existing objects are usually referenced by @{syntax |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
202 |
nameref}. |
27037 | 203 |
|
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
204 |
@{rail \<open> |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
205 |
@{syntax_def name}: @{syntax ident} | @{syntax symident} | |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
206 |
@{syntax string} | @{syntax nat} |
27037 | 207 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
208 |
@{syntax_def parname}: '(' @{syntax name} ')' |
27037 | 209 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
210 |
@{syntax_def nameref}: @{syntax name} | @{syntax longident} |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
211 |
\<close>} |
58618 | 212 |
\<close> |
40296 | 213 |
|
214 |
||
58618 | 215 |
subsection \<open>Numbers\<close> |
40296 | 216 |
|
58618 | 217 |
text \<open>The outer lexical syntax (\secref{sec:outer-lex}) admits |
40296 | 218 |
natural numbers and floating point numbers. These are combined as |
219 |
@{syntax int} and @{syntax real} as follows. |
|
220 |
||
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
221 |
@{rail \<open> |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
222 |
@{syntax_def int}: @{syntax nat} | '-' @{syntax nat} |
27037 | 223 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
224 |
@{syntax_def real}: @{syntax float} | @{syntax int} |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
225 |
\<close>} |
40296 | 226 |
|
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
227 |
Note that there is an overlap with the category @{syntax name}, |
40296 | 228 |
which also includes @{syntax nat}. |
58618 | 229 |
\<close> |
27037 | 230 |
|
231 |
||
58618 | 232 |
subsection \<open>Comments \label{sec:comments}\<close> |
27037 | 233 |
|
58725 | 234 |
text \<open>Large chunks of plain @{syntax text} are usually given @{syntax |
235 |
verbatim}, i.e.\ enclosed in @{verbatim "{*"}~@{text "\<dots>"}~@{verbatim "*}"}, |
|
236 |
or as @{syntax cartouche} @{text "\<open>\<dots>\<close>"}. For convenience, any of the |
|
237 |
smaller text units conforming to @{syntax nameref} are admitted as well. A |
|
238 |
marginal @{syntax comment} is of the form @{verbatim "--"}~@{syntax text}. |
|
239 |
Any number of these may occur within Isabelle/Isar commands. |
|
27037 | 240 |
|
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
241 |
@{rail \<open> |
56499
7e0178c84994
allow text cartouches in regular outer syntax categories "text" and "altstring";
wenzelm
parents:
56451
diff
changeset
|
242 |
@{syntax_def text}: @{syntax verbatim} | @{syntax cartouche} | @{syntax nameref} |
27037 | 243 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
244 |
@{syntax_def comment}: '--' @{syntax text} |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
245 |
\<close>} |
58618 | 246 |
\<close> |
27037 | 247 |
|
248 |
||
58618 | 249 |
subsection \<open>Type classes, sorts and arities\<close> |
27037 | 250 |
|
58618 | 251 |
text \<open> |
27037 | 252 |
Classes are specified by plain names. Sorts have a very simple |
253 |
inner syntax, which is either a single class name @{text c} or a |
|
254 |
list @{text "{c\<^sub>1, \<dots>, c\<^sub>n}"} referring to the |
|
255 |
intersection of these classes. The syntax of type arities is given |
|
256 |
directly at the outer level. |
|
257 |
||
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
258 |
@{rail \<open> |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
259 |
@{syntax_def classdecl}: @{syntax name} (('<' | '\<subseteq>') (@{syntax nameref} + ','))? |
27037 | 260 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
261 |
@{syntax_def sort}: @{syntax nameref} |
27037 | 262 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
263 |
@{syntax_def arity}: ('(' (@{syntax sort} + ',') ')')? @{syntax sort} |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
264 |
\<close>} |
58618 | 265 |
\<close> |
27037 | 266 |
|
267 |
||
58618 | 268 |
subsection \<open>Types and terms \label{sec:types-terms}\<close> |
27037 | 269 |
|
58618 | 270 |
text \<open> |
27037 | 271 |
The actual inner Isabelle syntax, that of types and terms of the |
272 |
logic, is far too sophisticated in order to be modelled explicitly |
|
273 |
at the outer theory level. Basically, any such entity has to be |
|
274 |
quoted to turn it into a single token (the parsing and type-checking |
|
275 |
is performed internally later). For convenience, a slightly more |
|
276 |
liberal convention is adopted: quotes may be omitted for any type or |
|
277 |
term that is already atomic at the outer level. For example, one |
|
58724 | 278 |
may just write @{verbatim x} instead of quoted @{verbatim \<open>"x"\<close>}. |
27037 | 279 |
Note that symbolic identifiers (e.g.\ @{verbatim "++"} or @{text |
280 |
"\<forall>"} are available as well, provided these have not been superseded |
|
281 |
by commands or other keywords already (such as @{verbatim "="} or |
|
282 |
@{verbatim "+"}). |
|
283 |
||
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
284 |
@{rail \<open> |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
285 |
@{syntax_def type}: @{syntax nameref} | @{syntax typefree} | |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
286 |
@{syntax typevar} |
27037 | 287 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
288 |
@{syntax_def term}: @{syntax nameref} | @{syntax var} |
27037 | 289 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
290 |
@{syntax_def prop}: @{syntax term} |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
291 |
\<close>} |
27037 | 292 |
|
59853 | 293 |
Positional instantiations are specified as a sequence of terms, or the |
294 |
placeholder ``@{text _}'' (underscore), which means to skip a position. |
|
27037 | 295 |
|
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
296 |
@{rail \<open> |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
297 |
@{syntax_def inst}: '_' | @{syntax term} |
27037 | 298 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
299 |
@{syntax_def insts}: (@{syntax inst} *) |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
300 |
\<close>} |
27037 | 301 |
|
59853 | 302 |
Named instantiations are specified as pairs of assignments @{text "v = |
303 |
t"}, which refer to schematic variables in some theorem that is |
|
304 |
instantiated. Both type and terms instantiations are admitted, and |
|
305 |
distinguished by the usual syntax of variable names. |
|
306 |
||
307 |
@{rail \<open> |
|
308 |
@{syntax_def named_inst}: variable '=' (type | term) |
|
309 |
; |
|
310 |
@{syntax_def named_insts}: (named_inst @'and' +) |
|
311 |
; |
|
312 |
variable: @{syntax name} | @{syntax var} | @{syntax typefree} | @{syntax typevar} |
|
313 |
\<close>} |
|
314 |
||
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
315 |
Type declarations and definitions usually refer to @{syntax |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
316 |
typespec} on the left-hand side. This models basic type constructor |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
317 |
application at the outer syntax level. Note that only plain postfix |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
318 |
notation is available here, but no infixes. |
27037 | 319 |
|
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
320 |
@{rail \<open> |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
321 |
@{syntax_def typespec}: |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
322 |
(() | @{syntax typefree} | '(' ( @{syntax typefree} + ',' ) ')') @{syntax name} |
27037 | 323 |
; |
42705 | 324 |
@{syntax_def typespec_sorts}: |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
325 |
(() | (@{syntax typefree} ('::' @{syntax sort})?) | |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
326 |
'(' ( (@{syntax typefree} ('::' @{syntax sort})?) + ',' ) ')') @{syntax name} |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
327 |
\<close>} |
58618 | 328 |
\<close> |
27037 | 329 |
|
330 |
||
58618 | 331 |
subsection \<open>Term patterns and declarations \label{sec:term-decls}\<close> |
28754
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
332 |
|
58618 | 333 |
text \<open>Wherever explicit propositions (or term fragments) occur in a |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
334 |
proof text, casual binding of schematic term variables may be given |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
335 |
specified via patterns of the form ``@{text "(\<IS> p\<^sub>1 \<dots> p\<^sub>n)"}''. |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
336 |
This works both for @{syntax term} and @{syntax prop}. |
28754
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
337 |
|
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
338 |
@{rail \<open> |
42705 | 339 |
@{syntax_def term_pat}: '(' (@'is' @{syntax term} +) ')' |
28754
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
340 |
; |
42705 | 341 |
@{syntax_def prop_pat}: '(' (@'is' @{syntax prop} +) ')' |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
342 |
\<close>} |
28754
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
343 |
|
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
344 |
\medskip Declarations of local variables @{text "x :: \<tau>"} and |
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
345 |
logical propositions @{text "a : \<phi>"} represent different views on |
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
346 |
the same principle of introducing a local scope. In practice, one |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
347 |
may usually omit the typing of @{syntax vars} (due to |
28754
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
348 |
type-inference), and the naming of propositions (due to implicit |
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
349 |
references of current facts). In any case, Isar proof elements |
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
350 |
usually admit to introduce multiple such items simultaneously. |
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
351 |
|
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
352 |
@{rail \<open> |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
353 |
@{syntax_def vars}: (@{syntax name} +) ('::' @{syntax type})? |
28754
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
354 |
; |
42705 | 355 |
@{syntax_def props}: @{syntax thmdecl}? (@{syntax prop} @{syntax prop_pat}? +) |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
356 |
\<close>} |
28754
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
357 |
|
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
358 |
The treatment of multiple declarations corresponds to the |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
359 |
complementary focus of @{syntax vars} versus @{syntax props}. In |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
360 |
``@{text "x\<^sub>1 \<dots> x\<^sub>n :: \<tau>"}'' the typing refers to all variables, while |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
361 |
in @{text "a: \<phi>\<^sub>1 \<dots> \<phi>\<^sub>n"} the naming refers to all propositions |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
362 |
collectively. Isar language elements that refer to @{syntax vars} |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
363 |
or @{syntax props} typically admit separate typings or namings via |
28754
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
364 |
another level of iteration, with explicit @{keyword_ref "and"} |
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
365 |
separators; e.g.\ see @{command "fix"} and @{command "assume"} in |
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
366 |
\secref{sec:proof-context}. |
59785 | 367 |
|
368 |
@{rail \<open> |
|
369 |
@{syntax_def "fixes"}: |
|
370 |
((@{syntax name} ('::' @{syntax type})? @{syntax mixfix}? | @{syntax vars}) + @'and') |
|
371 |
; |
|
372 |
@{syntax_def "for_fixes"}: (@'for' @{syntax "fixes"})? |
|
373 |
\<close>} |
|
374 |
||
375 |
The category @{syntax "fixes"} is a richer variant of @{syntax vars}: it |
|
376 |
admits specification of mixfix syntax for the entities that are introduced |
|
377 |
into the context. An optional suffix ``@{keyword "for"}~@{text "fixes"}'' |
|
378 |
is admitted in many situations to indicate a so-called ``eigen-context'' |
|
379 |
of a formal element: the result will be exported and thus generalized over |
|
380 |
the given variables.\<close> |
|
28754
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
381 |
|
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
382 |
|
58618 | 383 |
subsection \<open>Attributes and theorems \label{sec:syn-att}\<close> |
27037 | 384 |
|
58618 | 385 |
text \<open>Attributes have their own ``semi-inner'' syntax, in the sense |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
386 |
that input conforming to @{syntax args} below is parsed by the |
28754
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
387 |
attribute a second time. The attribute argument specifications may |
6f2e67a3dfaa
moved section "Proof method expressions" to proof chapter;
wenzelm
parents:
28753
diff
changeset
|
388 |
be any sequence of atomic entities (identifiers, strings etc.), or |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
389 |
properly bracketed argument lists. Below @{syntax atom} refers to |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
390 |
any atomic entity, including any @{syntax keyword} conforming to |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
391 |
@{syntax symident}. |
27037 | 392 |
|
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
393 |
@{rail \<open> |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
394 |
@{syntax_def atom}: @{syntax nameref} | @{syntax typefree} | |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
395 |
@{syntax typevar} | @{syntax var} | @{syntax nat} | @{syntax float} | |
55045
99056d23e05b
cartouche within nested args (attributes, methods, etc.);
wenzelm
parents:
55033
diff
changeset
|
396 |
@{syntax keyword} | @{syntax cartouche} |
27037 | 397 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
398 |
arg: @{syntax atom} | '(' @{syntax args} ')' | '[' @{syntax args} ']' |
27037 | 399 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
400 |
@{syntax_def args}: arg * |
27037 | 401 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
402 |
@{syntax_def attributes}: '[' (@{syntax nameref} @{syntax args} * ',') ']' |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
403 |
\<close>} |
27037 | 404 |
|
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
405 |
Theorem specifications come in several flavors: @{syntax axmdecl} |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
406 |
and @{syntax thmdecl} usually refer to axioms, assumptions or |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
407 |
results of goal statements, while @{syntax thmdef} collects lists of |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
408 |
existing theorems. Existing theorems are given by @{syntax thmref} |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
409 |
and @{syntax thmrefs}, the former requires an actual singleton |
27037 | 410 |
result. |
411 |
||
412 |
There are three forms of theorem references: |
|
413 |
\begin{enumerate} |
|
414 |
||
415 |
\item named facts @{text "a"}, |
|
416 |
||
417 |
\item selections from named facts @{text "a(i)"} or @{text "a(j - k)"}, |
|
418 |
||
56499
7e0178c84994
allow text cartouches in regular outer syntax categories "text" and "altstring";
wenzelm
parents:
56451
diff
changeset
|
419 |
\item literal fact propositions using token syntax @{syntax_ref altstring} |
7e0178c84994
allow text cartouches in regular outer syntax categories "text" and "altstring";
wenzelm
parents:
56451
diff
changeset
|
420 |
@{verbatim "`"}@{text "\<phi>"}@{verbatim "`"} or @{syntax_ref cartouche} |
7e0178c84994
allow text cartouches in regular outer syntax categories "text" and "altstring";
wenzelm
parents:
56451
diff
changeset
|
421 |
@{text "\<open>\<phi>\<close>"} (see also method @{method_ref fact}). |
27037 | 422 |
|
423 |
\end{enumerate} |
|
424 |
||
425 |
Any kind of theorem specification may include lists of attributes |
|
426 |
both on the left and right hand sides; attributes are applied to any |
|
427 |
immediately preceding fact. If names are omitted, the theorems are |
|
428 |
not stored within the theorem database of the theory or proof |
|
429 |
context, but any given attributes are applied nonetheless. |
|
430 |
||
431 |
An extra pair of brackets around attributes (like ``@{text |
|
432 |
"[[simproc a]]"}'') abbreviates a theorem reference involving an |
|
433 |
internal dummy fact, which will be ignored later on. So only the |
|
434 |
effect of the attribute on the background context will persist. |
|
435 |
This form of in-place declarations is particularly useful with |
|
436 |
commands like @{command "declare"} and @{command "using"}. |
|
437 |
||
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
438 |
@{rail \<open> |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
439 |
@{syntax_def axmdecl}: @{syntax name} @{syntax attributes}? ':' |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
440 |
; |
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
441 |
@{syntax_def thmdecl}: thmbind ':' |
27037 | 442 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
443 |
@{syntax_def thmdef}: thmbind '=' |
27037 | 444 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
445 |
@{syntax_def thmref}: |
56499
7e0178c84994
allow text cartouches in regular outer syntax categories "text" and "altstring";
wenzelm
parents:
56451
diff
changeset
|
446 |
(@{syntax nameref} selection? | @{syntax altstring} | @{syntax cartouche}) |
7e0178c84994
allow text cartouches in regular outer syntax categories "text" and "altstring";
wenzelm
parents:
56451
diff
changeset
|
447 |
@{syntax attributes}? | |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
448 |
'[' @{syntax attributes} ']' |
27037 | 449 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
450 |
@{syntax_def thmrefs}: @{syntax thmref} + |
27037 | 451 |
; |
452 |
||
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
453 |
thmbind: @{syntax name} @{syntax attributes} | @{syntax name} | @{syntax attributes} |
27037 | 454 |
; |
42596
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents:
40296
diff
changeset
|
455 |
selection: '(' ((@{syntax nat} | @{syntax nat} '-' @{syntax nat}?) + ',') ')' |
55112
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
wenzelm
parents:
55045
diff
changeset
|
456 |
\<close>} |
58618 | 457 |
\<close> |
27037 | 458 |
|
459 |
end |