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