author | wenzelm |
Sat, 10 May 2008 00:14:00 +0200 | |
changeset 26870 | 94bedbb34b92 |
parent 26867 | 6274cf7e2b8e |
child 26895 | d066f9db833b |
permissions | -rw-r--r-- |
26767 | 1 |
% |
2 |
\begin{isabellebody}% |
|
3 |
\def\isabellecontext{pure}% |
|
4 |
% |
|
5 |
\isadelimtheory |
|
6 |
\isanewline |
|
7 |
\isanewline |
|
8 |
% |
|
9 |
\endisadelimtheory |
|
10 |
% |
|
11 |
\isatagtheory |
|
12 |
\isacommand{theory}\isamarkupfalse% |
|
13 |
\ pure\isanewline |
|
14 |
\isakeyword{imports}\ CPure\isanewline |
|
15 |
\isakeyword{begin}% |
|
16 |
\endisatagtheory |
|
17 |
{\isafoldtheory}% |
|
18 |
% |
|
19 |
\isadelimtheory |
|
20 |
% |
|
21 |
\endisadelimtheory |
|
22 |
% |
|
23 |
\isamarkupchapter{Basic language elements \label{ch:pure-syntax}% |
|
24 |
} |
|
25 |
\isamarkuptrue% |
|
26 |
% |
|
27 |
\begin{isamarkuptext}% |
|
28 |
Subsequently, we introduce the main part of Pure theory and proof |
|
29 |
commands, together with fundamental proof methods and attributes. |
|
30 |
\Chref{ch:gen-tools} describes further Isar elements provided by |
|
31 |
generic tools and packages (such as the Simplifier) that are either |
|
32 |
part of Pure Isabelle or pre-installed in most object logics. |
|
26852 | 33 |
Specific language elements introduced by the major object-logics are |
34 |
described in \chref{ch:hol} (Isabelle/HOL), \chref{ch:holcf} |
|
35 |
(Isabelle/HOLCF), and \chref{ch:zf} (Isabelle/ZF). Nevertheless, |
|
36 |
examples given in the generic parts will usually refer to |
|
37 |
Isabelle/HOL as well. |
|
26767 | 38 |
|
39 |
\medskip Isar commands may be either \emph{proper} document |
|
40 |
constructors, or \emph{improper commands}. Some proof methods and |
|
41 |
attributes introduced later are classified as improper as well. |
|
42 |
Improper Isar language elements, which are subsequently marked by |
|
26842 | 43 |
``\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}}'', are often helpful when developing proof |
26767 | 44 |
documents, while their use is discouraged for the final |
45 |
human-readable outcome. Typical examples are diagnostic commands |
|
46 |
that print terms or theorems according to the current context; other |
|
47 |
commands emulate old-style tactical theorem proving.% |
|
48 |
\end{isamarkuptext}% |
|
49 |
\isamarkuptrue% |
|
50 |
% |
|
51 |
\isamarkupsection{Theory commands% |
|
52 |
} |
|
53 |
\isamarkuptrue% |
|
54 |
% |
|
55 |
\isamarkupsubsection{Markup commands \label{sec:markup-thy}% |
|
56 |
} |
|
57 |
\isamarkuptrue% |
|
58 |
% |
|
59 |
\begin{isamarkuptext}% |
|
60 |
\begin{matharray}{rcl} |
|
26776 | 61 |
\indexdef{}{command}{chapter}\mbox{\isa{\isacommand{chapter}}} & : & \isarkeep{local{\dsh}theory} \\ |
62 |
\indexdef{}{command}{section}\mbox{\isa{\isacommand{section}}} & : & \isarkeep{local{\dsh}theory} \\ |
|
63 |
\indexdef{}{command}{subsection}\mbox{\isa{\isacommand{subsection}}} & : & \isarkeep{local{\dsh}theory} \\ |
|
64 |
\indexdef{}{command}{subsubsection}\mbox{\isa{\isacommand{subsubsection}}} & : & \isarkeep{local{\dsh}theory} \\ |
|
65 |
\indexdef{}{command}{text}\mbox{\isa{\isacommand{text}}} & : & \isarkeep{local{\dsh}theory} \\ |
|
26854
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
66 |
\indexdef{}{command}{text\_raw}\mbox{\isa{\isacommand{text{\isacharunderscore}raw}}} & : & \isarkeep{local{\dsh}theory} \\ |
26767 | 67 |
\end{matharray} |
68 |
||
69 |
Apart from formal comments (see \secref{sec:comments}), markup |
|
70 |
commands provide a structured way to insert text into the document |
|
71 |
generated from a theory (see \cite{isabelle-sys} for more |
|
72 |
information on Isabelle's document preparation tools). |
|
73 |
||
74 |
\begin{rail} |
|
75 |
('chapter' | 'section' | 'subsection' | 'subsubsection' | 'text') target? text |
|
76 |
; |
|
77 |
'text\_raw' text |
|
78 |
; |
|
79 |
\end{rail} |
|
80 |
||
81 |
\begin{descr} |
|
82 |
||
26776 | 83 |
\item [\mbox{\isa{\isacommand{chapter}}}, \mbox{\isa{\isacommand{section}}}, \mbox{\isa{\isacommand{subsection}}}, and \mbox{\isa{\isacommand{subsubsection}}}] mark chapter and |
26767 | 84 |
section headings. |
85 |
||
26776 | 86 |
\item [\mbox{\isa{\isacommand{text}}}] specifies paragraphs of plain text. |
26767 | 87 |
|
26776 | 88 |
\item [\mbox{\isa{\isacommand{text{\isacharunderscore}raw}}}] inserts {\LaTeX} source into the |
26767 | 89 |
output, without additional markup. Thus the full range of document |
90 |
manipulations becomes available. |
|
91 |
||
92 |
\end{descr} |
|
93 |
||
26842 | 94 |
The \isa{{\isachardoublequote}text{\isachardoublequote}} argument of these markup commands (except for |
26776 | 95 |
\mbox{\isa{\isacommand{text{\isacharunderscore}raw}}}) may contain references to formal entities |
26767 | 96 |
(``antiquotations'', see also \secref{sec:antiq}). These are |
26842 | 97 |
interpreted in the present theory context, or the named \isa{{\isachardoublequote}target{\isachardoublequote}}. |
26767 | 98 |
|
99 |
Any of these markup elements corresponds to a {\LaTeX} command with |
|
100 |
the name prefixed by \verb|\isamarkup|. For the sectioning |
|
101 |
commands this is a plain macro with a single argument, e.g.\ |
|
26842 | 102 |
\verb|\isamarkupchapter{|\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}\verb|}| for |
26776 | 103 |
\mbox{\isa{\isacommand{chapter}}}. The \mbox{\isa{\isacommand{text}}} markup results in a |
26842 | 104 |
{\LaTeX} environment \verb|\begin{isamarkuptext}| \isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}} \verb|\end{isamarkuptext}|, while \mbox{\isa{\isacommand{text{\isacharunderscore}raw}}} |
26767 | 105 |
causes the text to be inserted directly into the {\LaTeX} source. |
106 |
||
107 |
\medskip Additional markup commands are available for proofs (see |
|
26776 | 108 |
\secref{sec:markup-prf}). Also note that the \indexref{}{command}{header}\mbox{\isa{\isacommand{header}}} declaration (see \secref{sec:begin-thy}) admits to insert |
26767 | 109 |
section markup just preceding the actual theory definition.% |
110 |
\end{isamarkuptext}% |
|
111 |
\isamarkuptrue% |
|
112 |
% |
|
113 |
\isamarkupsubsection{Type classes and sorts \label{sec:classes}% |
|
114 |
} |
|
115 |
\isamarkuptrue% |
|
116 |
% |
|
117 |
\begin{isamarkuptext}% |
|
118 |
\begin{matharray}{rcll} |
|
26776 | 119 |
\indexdef{}{command}{classes}\mbox{\isa{\isacommand{classes}}} & : & \isartrans{theory}{theory} \\ |
120 |
\indexdef{}{command}{classrel}\mbox{\isa{\isacommand{classrel}}} & : & \isartrans{theory}{theory} & (axiomatic!) \\ |
|
121 |
\indexdef{}{command}{defaultsort}\mbox{\isa{\isacommand{defaultsort}}} & : & \isartrans{theory}{theory} \\ |
|
26854
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
122 |
\indexdef{}{command}{class\_deps}\mbox{\isa{\isacommand{class{\isacharunderscore}deps}}} & : & \isarkeep{theory~|~proof} \\ |
26767 | 123 |
\end{matharray} |
124 |
||
125 |
\begin{rail} |
|
126 |
'classes' (classdecl +) |
|
127 |
; |
|
128 |
'classrel' (nameref ('<' | subseteq) nameref + 'and') |
|
129 |
; |
|
130 |
'defaultsort' sort |
|
131 |
; |
|
132 |
\end{rail} |
|
133 |
||
134 |
\begin{descr} |
|
135 |
||
26842 | 136 |
\item [\mbox{\isa{\isacommand{classes}}}~\isa{{\isachardoublequote}c\ {\isasymsubseteq}\ c\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ c\isactrlsub n{\isachardoublequote}}] |
137 |
declares class \isa{c} to be a subclass of existing classes \isa{{\isachardoublequote}c\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ c\isactrlsub n{\isachardoublequote}}. Cyclic class structures are not permitted. |
|
26767 | 138 |
|
26842 | 139 |
\item [\mbox{\isa{\isacommand{classrel}}}~\isa{{\isachardoublequote}c\isactrlsub {\isadigit{1}}\ {\isasymsubseteq}\ c\isactrlsub {\isadigit{2}}{\isachardoublequote}}] states |
140 |
subclass relations between existing classes \isa{{\isachardoublequote}c\isactrlsub {\isadigit{1}}{\isachardoublequote}} and |
|
141 |
\isa{{\isachardoublequote}c\isactrlsub {\isadigit{2}}{\isachardoublequote}}. This is done axiomatically! The \indexref{}{command}{instance}\mbox{\isa{\isacommand{instance}}} command (see \secref{sec:axclass}) provides a way to |
|
26767 | 142 |
introduce proven class relations. |
143 |
||
26776 | 144 |
\item [\mbox{\isa{\isacommand{defaultsort}}}~\isa{s}] makes sort \isa{s} the |
26767 | 145 |
new default sort for any type variables given without sort |
146 |
constraints. Usually, the default sort would be only changed when |
|
147 |
defining a new object-logic. |
|
148 |
||
26776 | 149 |
\item [\mbox{\isa{\isacommand{class{\isacharunderscore}deps}}}] visualizes the subclass relation, |
26767 | 150 |
using Isabelle's graph browser tool (see also \cite{isabelle-sys}). |
151 |
||
152 |
\end{descr}% |
|
153 |
\end{isamarkuptext}% |
|
154 |
\isamarkuptrue% |
|
155 |
% |
|
156 |
\isamarkupsubsection{Primitive types and type abbreviations \label{sec:types-pure}% |
|
157 |
} |
|
158 |
\isamarkuptrue% |
|
159 |
% |
|
160 |
\begin{isamarkuptext}% |
|
161 |
\begin{matharray}{rcll} |
|
26776 | 162 |
\indexdef{}{command}{types}\mbox{\isa{\isacommand{types}}} & : & \isartrans{theory}{theory} \\ |
163 |
\indexdef{}{command}{typedecl}\mbox{\isa{\isacommand{typedecl}}} & : & \isartrans{theory}{theory} \\ |
|
164 |
\indexdef{}{command}{nonterminals}\mbox{\isa{\isacommand{nonterminals}}} & : & \isartrans{theory}{theory} \\ |
|
165 |
\indexdef{}{command}{arities}\mbox{\isa{\isacommand{arities}}} & : & \isartrans{theory}{theory} & (axiomatic!) \\ |
|
26767 | 166 |
\end{matharray} |
167 |
||
168 |
\begin{rail} |
|
169 |
'types' (typespec '=' type infix? +) |
|
170 |
; |
|
171 |
'typedecl' typespec infix? |
|
172 |
; |
|
173 |
'nonterminals' (name +) |
|
174 |
; |
|
175 |
'arities' (nameref '::' arity +) |
|
176 |
; |
|
177 |
\end{rail} |
|
178 |
||
179 |
\begin{descr} |
|
180 |
||
26842 | 181 |
\item [\mbox{\isa{\isacommand{types}}}~\isa{{\isachardoublequote}{\isacharparenleft}{\isasymalpha}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlsub n{\isacharparenright}\ t\ {\isacharequal}\ {\isasymtau}{\isachardoublequote}}] |
182 |
introduces \emph{type synonym} \isa{{\isachardoublequote}{\isacharparenleft}{\isasymalpha}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlsub n{\isacharparenright}\ t{\isachardoublequote}} |
|
183 |
for existing type \isa{{\isachardoublequote}{\isasymtau}{\isachardoublequote}}. Unlike actual type definitions, as |
|
26767 | 184 |
are available in Isabelle/HOL for example, type synonyms are just |
185 |
purely syntactic abbreviations without any logical significance. |
|
186 |
Internally, type synonyms are fully expanded. |
|
187 |
||
26842 | 188 |
\item [\mbox{\isa{\isacommand{typedecl}}}~\isa{{\isachardoublequote}{\isacharparenleft}{\isasymalpha}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlsub n{\isacharparenright}\ t{\isachardoublequote}}] |
26767 | 189 |
declares a new type constructor \isa{t}, intended as an actual |
190 |
logical type (of the object-logic, if available). |
|
191 |
||
26776 | 192 |
\item [\mbox{\isa{\isacommand{nonterminals}}}~\isa{c}] declares type |
26767 | 193 |
constructors \isa{c} (without arguments) to act as purely |
194 |
syntactic types, i.e.\ nonterminal symbols of Isabelle's inner |
|
195 |
syntax of terms or types. |
|
196 |
||
26842 | 197 |
\item [\mbox{\isa{\isacommand{arities}}}~\isa{{\isachardoublequote}t\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}s\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ s\isactrlsub n{\isacharparenright}\ s{\isachardoublequote}}] augments Isabelle's order-sorted signature of types by new type |
26776 | 198 |
constructor arities. This is done axiomatically! The \indexref{}{command}{instance}\mbox{\isa{\isacommand{instance}}} command (see \S\ref{sec:axclass}) provides a way to |
26767 | 199 |
introduce proven type arities. |
200 |
||
201 |
\end{descr}% |
|
202 |
\end{isamarkuptext}% |
|
203 |
\isamarkuptrue% |
|
204 |
% |
|
205 |
\isamarkupsubsection{Primitive constants and definitions \label{sec:consts}% |
|
206 |
} |
|
207 |
\isamarkuptrue% |
|
208 |
% |
|
209 |
\begin{isamarkuptext}% |
|
210 |
Definitions essentially express abbreviations within the logic. The |
|
26842 | 211 |
simplest form of a definition is \isa{{\isachardoublequote}c\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}\ {\isasymequiv}\ t{\isachardoublequote}}, where \isa{c} is a newly declared constant. Isabelle also allows derived forms |
26767 | 212 |
where the arguments of \isa{c} appear on the left, abbreviating a |
26842 | 213 |
prefix of \isa{{\isasymlambda}}-abstractions, e.g.\ \isa{{\isachardoublequote}c\ {\isasymequiv}\ {\isasymlambda}x\ y{\isachardot}\ t{\isachardoublequote}} may be |
214 |
written more conveniently as \isa{{\isachardoublequote}c\ x\ y\ {\isasymequiv}\ t{\isachardoublequote}}. Moreover, |
|
26767 | 215 |
definitions may be weakened by adding arbitrary pre-conditions: |
26842 | 216 |
\isa{{\isachardoublequote}A\ {\isasymLongrightarrow}\ c\ x\ y\ {\isasymequiv}\ t{\isachardoublequote}}. |
26767 | 217 |
|
218 |
\medskip The built-in well-formedness conditions for definitional |
|
219 |
specifications are: |
|
220 |
||
221 |
\begin{itemize} |
|
222 |
||
223 |
\item Arguments (on the left-hand side) must be distinct variables. |
|
224 |
||
225 |
\item All variables on the right-hand side must also appear on the |
|
226 |
left-hand side. |
|
227 |
||
228 |
\item All type variables on the right-hand side must also appear on |
|
26842 | 229 |
the left-hand side; this prohibits \isa{{\isachardoublequote}{\isadigit{0}}\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymequiv}\ length\ {\isacharparenleft}{\isacharbrackleft}{\isacharbrackright}\ {\isacharcolon}{\isacharcolon}\ {\isasymalpha}\ list{\isacharparenright}{\isachardoublequote}} for example. |
26767 | 230 |
|
231 |
\item The definition must not be recursive. Most object-logics |
|
232 |
provide definitional principles that can be used to express |
|
233 |
recursion safely. |
|
234 |
||
235 |
\end{itemize} |
|
236 |
||
26842 | 237 |
Overloading means that a constant being declared as \isa{{\isachardoublequote}c\ {\isacharcolon}{\isacharcolon}\ {\isasymalpha}\ decl{\isachardoublequote}} may be defined separately on type instances \isa{{\isachardoublequote}c\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}{\isasymbeta}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymbeta}\isactrlsub n{\isacharparenright}\ t\ decl{\isachardoublequote}} for each type constructor \isa{t}. The right-hand side may mention overloaded constants |
26767 | 238 |
recursively at type instances corresponding to the immediate |
26842 | 239 |
argument types \isa{{\isachardoublequote}{\isasymbeta}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymbeta}\isactrlsub n{\isachardoublequote}}. Incomplete |
26767 | 240 |
specification patterns impose global constraints on all occurrences, |
26842 | 241 |
e.g.\ \isa{{\isachardoublequote}d\ {\isacharcolon}{\isacharcolon}\ {\isasymalpha}\ {\isasymtimes}\ {\isasymalpha}{\isachardoublequote}} on the left-hand side means that all |
26767 | 242 |
corresponding occurrences on some right-hand side need to be an |
26842 | 243 |
instance of this, general \isa{{\isachardoublequote}d\ {\isacharcolon}{\isacharcolon}\ {\isasymalpha}\ {\isasymtimes}\ {\isasymbeta}{\isachardoublequote}} will be disallowed. |
26767 | 244 |
|
245 |
\begin{matharray}{rcl} |
|
26776 | 246 |
\indexdef{}{command}{consts}\mbox{\isa{\isacommand{consts}}} & : & \isartrans{theory}{theory} \\ |
247 |
\indexdef{}{command}{defs}\mbox{\isa{\isacommand{defs}}} & : & \isartrans{theory}{theory} \\ |
|
248 |
\indexdef{}{command}{constdefs}\mbox{\isa{\isacommand{constdefs}}} & : & \isartrans{theory}{theory} \\ |
|
26767 | 249 |
\end{matharray} |
250 |
||
251 |
\begin{rail} |
|
252 |
'consts' ((name '::' type mixfix?) +) |
|
253 |
; |
|
254 |
'defs' ('(' 'unchecked'? 'overloaded'? ')')? \\ (axmdecl prop +) |
|
255 |
; |
|
256 |
\end{rail} |
|
257 |
||
258 |
\begin{rail} |
|
259 |
'constdefs' structs? (constdecl? constdef +) |
|
260 |
; |
|
261 |
||
262 |
structs: '(' 'structure' (vars + 'and') ')' |
|
263 |
; |
|
264 |
constdecl: ((name '::' type mixfix | name '::' type | name mixfix) 'where'?) | name 'where' |
|
265 |
; |
|
266 |
constdef: thmdecl? prop |
|
267 |
; |
|
268 |
\end{rail} |
|
269 |
||
270 |
\begin{descr} |
|
271 |
||
26842 | 272 |
\item [\mbox{\isa{\isacommand{consts}}}~\isa{{\isachardoublequote}c\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}{\isachardoublequote}}] declares constant |
26767 | 273 |
\isa{c} to have any instance of type scheme \isa{{\isasymsigma}}. The |
274 |
optional mixfix annotations may attach concrete syntax to the |
|
275 |
constants declared. |
|
276 |
||
26842 | 277 |
\item [\mbox{\isa{\isacommand{defs}}}~\isa{{\isachardoublequote}name{\isacharcolon}\ eqn{\isachardoublequote}}] introduces \isa{eqn} |
26767 | 278 |
as a definitional axiom for some existing constant. |
279 |
||
26842 | 280 |
The \isa{{\isachardoublequote}{\isacharparenleft}unchecked{\isacharparenright}{\isachardoublequote}} option disables global dependency checks |
26767 | 281 |
for this definition, which is occasionally useful for exotic |
282 |
overloading. It is at the discretion of the user to avoid malformed |
|
283 |
theory specifications! |
|
284 |
||
26842 | 285 |
The \isa{{\isachardoublequote}{\isacharparenleft}overloaded{\isacharparenright}{\isachardoublequote}} option declares definitions to be |
26767 | 286 |
potentially overloaded. Unless this option is given, a warning |
287 |
message would be issued for any definitional equation with a more |
|
288 |
special type than that of the corresponding constant declaration. |
|
289 |
||
26776 | 290 |
\item [\mbox{\isa{\isacommand{constdefs}}}] provides a streamlined combination of |
26767 | 291 |
constants declarations and definitions: type-inference takes care of |
292 |
the most general typing of the given specification (the optional |
|
26776 | 293 |
type constraint may refer to type-inference dummies ``\isa{{\isacharunderscore}}'' as usual). The resulting type declaration needs to agree with |
26767 | 294 |
that of the specification; overloading is \emph{not} supported here! |
295 |
||
296 |
The constant name may be omitted altogether, if neither type nor |
|
297 |
syntax declarations are given. The canonical name of the |
|
298 |
definitional axiom for constant \isa{c} will be \isa{c{\isacharunderscore}def}, |
|
299 |
unless specified otherwise. Also note that the given list of |
|
300 |
specifications is processed in a strictly sequential manner, with |
|
301 |
type-checking being performed independently. |
|
302 |
||
26842 | 303 |
An optional initial context of \isa{{\isachardoublequote}{\isacharparenleft}structure{\isacharparenright}{\isachardoublequote}} declarations |
304 |
admits use of indexed syntax, using the special symbol \verb|\<index>| (printed as ``\isa{{\isachardoublequote}{\isasymindex}{\isachardoublequote}}''). The latter concept is |
|
26767 | 305 |
particularly useful with locales (see also \S\ref{sec:locale}). |
306 |
||
307 |
\end{descr}% |
|
308 |
\end{isamarkuptext}% |
|
309 |
\isamarkuptrue% |
|
310 |
% |
|
311 |
\isamarkupsubsection{Syntax and translations \label{sec:syn-trans}% |
|
312 |
} |
|
313 |
\isamarkuptrue% |
|
314 |
% |
|
315 |
\begin{isamarkuptext}% |
|
316 |
\begin{matharray}{rcl} |
|
26776 | 317 |
\indexdef{}{command}{syntax}\mbox{\isa{\isacommand{syntax}}} & : & \isartrans{theory}{theory} \\ |
26854
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
318 |
\indexdef{}{command}{no\_syntax}\mbox{\isa{\isacommand{no{\isacharunderscore}syntax}}} & : & \isartrans{theory}{theory} \\ |
26776 | 319 |
\indexdef{}{command}{translations}\mbox{\isa{\isacommand{translations}}} & : & \isartrans{theory}{theory} \\ |
26854
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
320 |
\indexdef{}{command}{no\_translations}\mbox{\isa{\isacommand{no{\isacharunderscore}translations}}} & : & \isartrans{theory}{theory} \\ |
26767 | 321 |
\end{matharray} |
322 |
||
323 |
\begin{rail} |
|
324 |
('syntax' | 'no\_syntax') mode? (constdecl +) |
|
325 |
; |
|
326 |
('translations' | 'no\_translations') (transpat ('==' | '=>' | '<=' | rightleftharpoons | rightharpoonup | leftharpoondown) transpat +) |
|
327 |
; |
|
328 |
||
329 |
mode: ('(' ( name | 'output' | name 'output' ) ')') |
|
330 |
; |
|
331 |
transpat: ('(' nameref ')')? string |
|
332 |
; |
|
333 |
\end{rail} |
|
334 |
||
335 |
\begin{descr} |
|
336 |
||
26842 | 337 |
\item [\mbox{\isa{\isacommand{syntax}}}~\isa{{\isachardoublequote}{\isacharparenleft}mode{\isacharparenright}\ decls{\isachardoublequote}}] is similar to |
26776 | 338 |
\mbox{\isa{\isacommand{consts}}}~\isa{decls}, except that the actual logical |
26767 | 339 |
signature extension is omitted. Thus the context free grammar of |
340 |
Isabelle's inner syntax may be augmented in arbitrary ways, |
|
341 |
independently of the logic. The \isa{mode} argument refers to the |
|
26776 | 342 |
print mode that the grammar rules belong; unless the \indexref{}{keyword}{output}\mbox{\isa{\isakeyword{output}}} indicator is given, all productions are added both to the |
26767 | 343 |
input and output grammar. |
344 |
||
26842 | 345 |
\item [\mbox{\isa{\isacommand{no{\isacharunderscore}syntax}}}~\isa{{\isachardoublequote}{\isacharparenleft}mode{\isacharparenright}\ decls{\isachardoublequote}}] removes |
26776 | 346 |
grammar declarations (and translations) resulting from \isa{decls}, which are interpreted in the same manner as for \mbox{\isa{\isacommand{syntax}}} above. |
26767 | 347 |
|
26776 | 348 |
\item [\mbox{\isa{\isacommand{translations}}}~\isa{rules}] specifies syntactic |
26842 | 349 |
translation rules (i.e.\ macros): parse~/ print rules (\isa{{\isachardoublequote}{\isasymrightleftharpoons}{\isachardoublequote}}), |
350 |
parse rules (\isa{{\isachardoublequote}{\isasymrightharpoonup}{\isachardoublequote}}), or print rules (\isa{{\isachardoublequote}{\isasymleftharpoondown}{\isachardoublequote}}). |
|
26767 | 351 |
Translation patterns may be prefixed by the syntactic category to be |
352 |
used for parsing; the default is \isa{logic}. |
|
353 |
||
26776 | 354 |
\item [\mbox{\isa{\isacommand{no{\isacharunderscore}translations}}}~\isa{rules}] removes syntactic |
26767 | 355 |
translation rules, which are interpreted in the same manner as for |
26776 | 356 |
\mbox{\isa{\isacommand{translations}}} above. |
26767 | 357 |
|
358 |
\end{descr}% |
|
359 |
\end{isamarkuptext}% |
|
360 |
\isamarkuptrue% |
|
361 |
% |
|
362 |
\isamarkupsubsection{Axioms and theorems \label{sec:axms-thms}% |
|
363 |
} |
|
364 |
\isamarkuptrue% |
|
365 |
% |
|
366 |
\begin{isamarkuptext}% |
|
367 |
\begin{matharray}{rcll} |
|
26776 | 368 |
\indexdef{}{command}{axioms}\mbox{\isa{\isacommand{axioms}}} & : & \isartrans{theory}{theory} & (axiomatic!) \\ |
369 |
\indexdef{}{command}{lemmas}\mbox{\isa{\isacommand{lemmas}}} & : & \isarkeep{local{\dsh}theory} \\ |
|
370 |
\indexdef{}{command}{theorems}\mbox{\isa{\isacommand{theorems}}} & : & isarkeep{local{\dsh}theory} \\ |
|
26767 | 371 |
\end{matharray} |
372 |
||
373 |
\begin{rail} |
|
374 |
'axioms' (axmdecl prop +) |
|
375 |
; |
|
376 |
('lemmas' | 'theorems') target? (thmdef? thmrefs + 'and') |
|
377 |
; |
|
378 |
\end{rail} |
|
379 |
||
380 |
\begin{descr} |
|
381 |
||
26842 | 382 |
\item [\mbox{\isa{\isacommand{axioms}}}~\isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}{\isachardoublequote}}] introduces arbitrary |
26767 | 383 |
statements as axioms of the meta-logic. In fact, axioms are |
384 |
``axiomatic theorems'', and may be referred later just as any other |
|
385 |
theorem. |
|
386 |
||
387 |
Axioms are usually only introduced when declaring new logical |
|
388 |
systems. Everyday work is typically done the hard way, with proper |
|
389 |
definitions and proven theorems. |
|
390 |
||
26842 | 391 |
\item [\mbox{\isa{\isacommand{lemmas}}}~\isa{{\isachardoublequote}a\ {\isacharequal}\ b\isactrlsub {\isadigit{1}}\ {\isasymdots}\ b\isactrlsub n{\isachardoublequote}}] |
26767 | 392 |
retrieves and stores existing facts in the theory context, or the |
393 |
specified target context (see also \secref{sec:target}). Typical |
|
394 |
applications would also involve attributes, to declare Simplifier |
|
395 |
rules, for example. |
|
396 |
||
26776 | 397 |
\item [\mbox{\isa{\isacommand{theorems}}}] is essentially the same as \mbox{\isa{\isacommand{lemmas}}}, but marks the result as a different kind of facts. |
26767 | 398 |
|
399 |
\end{descr}% |
|
400 |
\end{isamarkuptext}% |
|
401 |
\isamarkuptrue% |
|
402 |
% |
|
403 |
\isamarkupsubsection{Name spaces% |
|
404 |
} |
|
405 |
\isamarkuptrue% |
|
406 |
% |
|
407 |
\begin{isamarkuptext}% |
|
408 |
\begin{matharray}{rcl} |
|
26776 | 409 |
\indexdef{}{command}{global}\mbox{\isa{\isacommand{global}}} & : & \isartrans{theory}{theory} \\ |
410 |
\indexdef{}{command}{local}\mbox{\isa{\isacommand{local}}} & : & \isartrans{theory}{theory} \\ |
|
411 |
\indexdef{}{command}{hide}\mbox{\isa{\isacommand{hide}}} & : & \isartrans{theory}{theory} \\ |
|
26767 | 412 |
\end{matharray} |
413 |
||
414 |
\begin{rail} |
|
415 |
'hide' ('(open)')? name (nameref + ) |
|
416 |
; |
|
417 |
\end{rail} |
|
418 |
||
419 |
Isabelle organizes any kind of name declarations (of types, |
|
420 |
constants, theorems etc.) by separate hierarchically structured name |
|
421 |
spaces. Normally the user does not have to control the behavior of |
|
422 |
name spaces by hand, yet the following commands provide some way to |
|
423 |
do so. |
|
424 |
||
425 |
\begin{descr} |
|
426 |
||
26776 | 427 |
\item [\mbox{\isa{\isacommand{global}}} and \mbox{\isa{\isacommand{local}}}] change the |
26767 | 428 |
current name declaration mode. Initially, theories start in |
26776 | 429 |
\mbox{\isa{\isacommand{local}}} mode, causing all names to be automatically |
430 |
qualified by the theory name. Changing this to \mbox{\isa{\isacommand{global}}} |
|
26767 | 431 |
causes all names to be declared without the theory prefix, until |
26776 | 432 |
\mbox{\isa{\isacommand{local}}} is declared again. |
26767 | 433 |
|
434 |
Note that global names are prone to get hidden accidently later, |
|
435 |
when qualified names of the same base name are introduced. |
|
436 |
||
26842 | 437 |
\item [\mbox{\isa{\isacommand{hide}}}~\isa{{\isachardoublequote}space\ names{\isachardoublequote}}] fully removes |
438 |
declarations from a given name space (which may be \isa{{\isachardoublequote}class{\isachardoublequote}}, |
|
439 |
\isa{{\isachardoublequote}type{\isachardoublequote}}, \isa{{\isachardoublequote}const{\isachardoublequote}}, or \isa{{\isachardoublequote}fact{\isachardoublequote}}); with the \isa{{\isachardoublequote}{\isacharparenleft}open{\isacharparenright}{\isachardoublequote}} option, only the base name is hidden. Global |
|
26767 | 440 |
(unqualified) names may never be hidden. |
441 |
||
442 |
Note that hiding name space accesses has no impact on logical |
|
443 |
declarations -- they remain valid internally. Entities that are no |
|
444 |
longer accessible to the user are printed with the special qualifier |
|
26842 | 445 |
``\isa{{\isachardoublequote}{\isacharquery}{\isacharquery}{\isachardoublequote}}'' prefixed to the full internal name. |
26767 | 446 |
|
447 |
\end{descr}% |
|
448 |
\end{isamarkuptext}% |
|
449 |
\isamarkuptrue% |
|
450 |
% |
|
451 |
\isamarkupsubsection{Incorporating ML code \label{sec:ML}% |
|
452 |
} |
|
453 |
\isamarkuptrue% |
|
454 |
% |
|
455 |
\begin{isamarkuptext}% |
|
456 |
\begin{matharray}{rcl} |
|
26776 | 457 |
\indexdef{}{command}{use}\mbox{\isa{\isacommand{use}}} & : & \isarkeep{theory~|~local{\dsh}theory} \\ |
458 |
\indexdef{}{command}{ML}\mbox{\isa{\isacommand{ML}}} & : & \isarkeep{theory~|~local{\dsh}theory} \\ |
|
26854
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
459 |
\indexdef{}{command}{ML\_val}\mbox{\isa{\isacommand{ML{\isacharunderscore}val}}} & : & \isartrans{\cdot}{\cdot} \\ |
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
460 |
\indexdef{}{command}{ML\_command}\mbox{\isa{\isacommand{ML{\isacharunderscore}command}}} & : & \isartrans{\cdot}{\cdot} \\ |
26776 | 461 |
\indexdef{}{command}{setup}\mbox{\isa{\isacommand{setup}}} & : & \isartrans{theory}{theory} \\ |
26854
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
462 |
\indexdef{}{command}{method\_setup}\mbox{\isa{\isacommand{method{\isacharunderscore}setup}}} & : & \isartrans{theory}{theory} \\ |
26767 | 463 |
\end{matharray} |
464 |
||
465 |
\begin{rail} |
|
466 |
'use' name |
|
467 |
; |
|
468 |
('ML' | 'ML\_val' | 'ML\_command' | 'setup') text |
|
469 |
; |
|
470 |
'method\_setup' name '=' text text |
|
471 |
; |
|
472 |
\end{rail} |
|
473 |
||
474 |
\begin{descr} |
|
475 |
||
26842 | 476 |
\item [\mbox{\isa{\isacommand{use}}}~\isa{{\isachardoublequote}file{\isachardoublequote}}] reads and executes ML |
477 |
commands from \isa{{\isachardoublequote}file{\isachardoublequote}}. The current theory context is passed |
|
478 |
down to the ML toplevel and may be modified, using \verb|"Context.>>"| or derived ML commands. The file name is checked with |
|
26776 | 479 |
the \indexref{}{keyword}{uses}\mbox{\isa{\isakeyword{uses}}} dependency declaration given in the theory |
26767 | 480 |
header (see also \secref{sec:begin-thy}). |
481 |
||
26842 | 482 |
\item [\mbox{\isa{\isacommand{ML}}}~\isa{{\isachardoublequote}text{\isachardoublequote}}] is similar to \mbox{\isa{\isacommand{use}}}, but executes ML commands directly from the given \isa{{\isachardoublequote}text{\isachardoublequote}}. |
26767 | 483 |
|
26776 | 484 |
\item [\mbox{\isa{\isacommand{ML{\isacharunderscore}val}}} and \mbox{\isa{\isacommand{ML{\isacharunderscore}command}}}] are |
485 |
diagnostic versions of \mbox{\isa{\isacommand{ML}}}, which means that the context |
|
486 |
may not be updated. \mbox{\isa{\isacommand{ML{\isacharunderscore}val}}} echos the bindings produced |
|
487 |
at the ML toplevel, but \mbox{\isa{\isacommand{ML{\isacharunderscore}command}}} is silent. |
|
26767 | 488 |
|
26842 | 489 |
\item [\mbox{\isa{\isacommand{setup}}}~\isa{{\isachardoublequote}text{\isachardoublequote}}] changes the current theory |
490 |
context by applying \isa{{\isachardoublequote}text{\isachardoublequote}}, which refers to an ML expression |
|
491 |
of type \verb|"theory -> theory"|. This enables to initialize |
|
26767 | 492 |
any object-logic specific tools and packages written in ML, for |
493 |
example. |
|
494 |
||
26842 | 495 |
\item [\mbox{\isa{\isacommand{method{\isacharunderscore}setup}}}~\isa{{\isachardoublequote}name\ {\isacharequal}\ text\ description{\isachardoublequote}}] |
496 |
defines a proof method in the current theory. The given \isa{{\isachardoublequote}text{\isachardoublequote}} has to be an ML expression of type \verb|"Args.src ->|\isasep\isanewline% |
|
497 |
\verb| Proof.context -> Proof.method"|. Parsing concrete method syntax |
|
26767 | 498 |
from \verb|Args.src| input can be quite tedious in general. The |
499 |
following simple examples are for methods without any explicit |
|
500 |
arguments, or a list of theorems, respectively. |
|
501 |
||
502 |
%FIXME proper antiquotations |
|
503 |
{\footnotesize |
|
504 |
\begin{verbatim} |
|
505 |
Method.no_args (Method.METHOD (fn facts => foobar_tac)) |
|
506 |
Method.thms_args (fn thms => Method.METHOD (fn facts => foobar_tac)) |
|
507 |
Method.ctxt_args (fn ctxt => Method.METHOD (fn facts => foobar_tac)) |
|
508 |
Method.thms_ctxt_args (fn thms => fn ctxt => |
|
509 |
Method.METHOD (fn facts => foobar_tac)) |
|
510 |
\end{verbatim} |
|
511 |
} |
|
512 |
||
513 |
Note that mere tactic emulations may ignore the \isa{facts} |
|
514 |
parameter above. Proper proof methods would do something |
|
515 |
appropriate with the list of current facts, though. Single-rule |
|
516 |
methods usually do strict forward-chaining (e.g.\ by using \verb|Drule.multi_resolves|), while automatic ones just insert the facts |
|
517 |
using \verb|Method.insert_tac| before applying the main tactic. |
|
518 |
||
519 |
\end{descr}% |
|
520 |
\end{isamarkuptext}% |
|
521 |
\isamarkuptrue% |
|
522 |
% |
|
523 |
\isamarkupsubsection{Syntax translation functions% |
|
524 |
} |
|
525 |
\isamarkuptrue% |
|
526 |
% |
|
527 |
\begin{isamarkuptext}% |
|
528 |
\begin{matharray}{rcl} |
|
26854
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
529 |
\indexdef{}{command}{parse\_ast\_translation}\mbox{\isa{\isacommand{parse{\isacharunderscore}ast{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\ |
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
530 |
\indexdef{}{command}{parse\_translation}\mbox{\isa{\isacommand{parse{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\ |
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
531 |
\indexdef{}{command}{print\_translation}\mbox{\isa{\isacommand{print{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\ |
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
532 |
\indexdef{}{command}{typed\_print\_translation}\mbox{\isa{\isacommand{typed{\isacharunderscore}print{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\ |
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
533 |
\indexdef{}{command}{print\_ast\_translation}\mbox{\isa{\isacommand{print{\isacharunderscore}ast{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\ |
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
534 |
\indexdef{}{command}{token\_translation}\mbox{\isa{\isacommand{token{\isacharunderscore}translation}}} & : & \isartrans{theory}{theory} \\ |
26767 | 535 |
\end{matharray} |
536 |
||
537 |
\begin{rail} |
|
538 |
( 'parse\_ast\_translation' | 'parse\_translation' | 'print\_translation' | |
|
539 |
'typed\_print\_translation' | 'print\_ast\_translation' ) ('(advanced)')? text |
|
540 |
; |
|
541 |
||
542 |
'token\_translation' text |
|
543 |
; |
|
544 |
\end{rail} |
|
545 |
||
546 |
Syntax translation functions written in ML admit almost arbitrary |
|
547 |
manipulations of Isabelle's inner syntax. Any of the above commands |
|
548 |
have a single \railqtok{text} argument that refers to an ML |
|
549 |
expression of appropriate type, which are as follows by default: |
|
550 |
||
551 |
%FIXME proper antiquotations |
|
552 |
\begin{ttbox} |
|
553 |
val parse_ast_translation : (string * (ast list -> ast)) list |
|
554 |
val parse_translation : (string * (term list -> term)) list |
|
555 |
val print_translation : (string * (term list -> term)) list |
|
556 |
val typed_print_translation : |
|
557 |
(string * (bool -> typ -> term list -> term)) list |
|
558 |
val print_ast_translation : (string * (ast list -> ast)) list |
|
559 |
val token_translation : |
|
560 |
(string * string * (string -> string * real)) list |
|
561 |
\end{ttbox} |
|
562 |
||
26842 | 563 |
If the \isa{{\isachardoublequote}{\isacharparenleft}advanced{\isacharparenright}{\isachardoublequote}} option is given, the corresponding |
26767 | 564 |
translation functions may depend on the current theory or proof |
565 |
context. This allows to implement advanced syntax mechanisms, as |
|
566 |
translations functions may refer to specific theory declarations or |
|
567 |
auxiliary proof data. |
|
568 |
||
569 |
See also \cite[\S8]{isabelle-ref} for more information on the |
|
570 |
general concept of syntax transformations in Isabelle. |
|
571 |
||
572 |
%FIXME proper antiquotations |
|
573 |
\begin{ttbox} |
|
574 |
val parse_ast_translation: |
|
575 |
(string * (Context.generic -> ast list -> ast)) list |
|
576 |
val parse_translation: |
|
577 |
(string * (Context.generic -> term list -> term)) list |
|
578 |
val print_translation: |
|
579 |
(string * (Context.generic -> term list -> term)) list |
|
580 |
val typed_print_translation: |
|
581 |
(string * (Context.generic -> bool -> typ -> term list -> term)) list |
|
582 |
val print_ast_translation: |
|
583 |
(string * (Context.generic -> ast list -> ast)) list |
|
584 |
\end{ttbox}% |
|
585 |
\end{isamarkuptext}% |
|
586 |
\isamarkuptrue% |
|
587 |
% |
|
588 |
\isamarkupsubsection{Oracles% |
|
589 |
} |
|
590 |
\isamarkuptrue% |
|
591 |
% |
|
592 |
\begin{isamarkuptext}% |
|
593 |
\begin{matharray}{rcl} |
|
26776 | 594 |
\indexdef{}{command}{oracle}\mbox{\isa{\isacommand{oracle}}} & : & \isartrans{theory}{theory} \\ |
26767 | 595 |
\end{matharray} |
596 |
||
26776 | 597 |
The oracle interface promotes a given ML function \verb|theory -> T -> term| to \verb|theory -> T -> thm|, for some |
598 |
type \verb|T| given by the user. This acts like an infinitary |
|
26767 | 599 |
specification of axioms -- there is no internal check of the |
600 |
correctness of the results! The inference kernel records oracle |
|
601 |
invocations within the internal derivation object of theorems, and |
|
26842 | 602 |
the pretty printer attaches ``\isa{{\isachardoublequote}{\isacharbrackleft}{\isacharbang}{\isacharbrackright}{\isachardoublequote}}'' to indicate results |
26767 | 603 |
that are not fully checked by Isabelle inferences. |
604 |
||
605 |
\begin{rail} |
|
606 |
'oracle' name '(' type ')' '=' text |
|
607 |
; |
|
608 |
\end{rail} |
|
609 |
||
610 |
\begin{descr} |
|
611 |
||
26842 | 612 |
\item [\mbox{\isa{\isacommand{oracle}}}~\isa{{\isachardoublequote}name\ {\isacharparenleft}type{\isacharparenright}\ {\isacharequal}\ text{\isachardoublequote}}] turns the |
613 |
given ML expression \isa{{\isachardoublequote}text{\isachardoublequote}} of type |
|
614 |
\verb|theory ->|~\isa{{\isachardoublequote}type{\isachardoublequote}}~\verb|-> term| into an |
|
26776 | 615 |
ML function of type |
26842 | 616 |
\verb|theory ->|~\isa{{\isachardoublequote}type{\isachardoublequote}}~\verb|-> thm|, which is |
26776 | 617 |
bound to the global identifier \verb|name|. |
26767 | 618 |
|
619 |
\end{descr}% |
|
620 |
\end{isamarkuptext}% |
|
621 |
\isamarkuptrue% |
|
622 |
% |
|
623 |
\isamarkupsection{Proof commands% |
|
624 |
} |
|
625 |
\isamarkuptrue% |
|
626 |
% |
|
627 |
\isamarkupsubsection{Markup commands \label{sec:markup-prf}% |
|
628 |
} |
|
629 |
\isamarkuptrue% |
|
630 |
% |
|
631 |
\begin{isamarkuptext}% |
|
632 |
\begin{matharray}{rcl} |
|
26776 | 633 |
\indexdef{}{command}{sect}\mbox{\isa{\isacommand{sect}}} & : & \isartrans{proof}{proof} \\ |
634 |
\indexdef{}{command}{subsect}\mbox{\isa{\isacommand{subsect}}} & : & \isartrans{proof}{proof} \\ |
|
635 |
\indexdef{}{command}{subsubsect}\mbox{\isa{\isacommand{subsubsect}}} & : & \isartrans{proof}{proof} \\ |
|
636 |
\indexdef{}{command}{txt}\mbox{\isa{\isacommand{txt}}} & : & \isartrans{proof}{proof} \\ |
|
26854
9b4aec46ad78
improved treatment of "_" thanks to underscore.sty;
wenzelm
parents:
26852
diff
changeset
|
637 |
\indexdef{}{command}{txt\_raw}\mbox{\isa{\isacommand{txt{\isacharunderscore}raw}}} & : & \isartrans{proof}{proof} \\ |
26767 | 638 |
\end{matharray} |
639 |
||
640 |
These markup commands for proof mode closely correspond to the ones |
|
641 |
of theory mode (see \S\ref{sec:markup-thy}). |
|
642 |
||
643 |
\begin{rail} |
|
644 |
('sect' | 'subsect' | 'subsubsect' | 'txt' | 'txt\_raw') text |
|
645 |
; |
|
646 |
\end{rail}% |
|
647 |
\end{isamarkuptext}% |
|
648 |
\isamarkuptrue% |
|
649 |
% |
|
650 |
\isamarkupsection{Other commands% |
|
651 |
} |
|
652 |
\isamarkuptrue% |
|
653 |
% |
|
654 |
\isamarkupsubsection{Diagnostics% |
|
655 |
} |
|
656 |
\isamarkuptrue% |
|
657 |
% |
|
658 |
\begin{isamarkuptext}% |
|
659 |
\begin{matharray}{rcl} |
|
26867 | 660 |
\indexdef{}{command}{pr}\mbox{\isa{\isacommand{pr}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\ |
661 |
\indexdef{}{command}{thm}\mbox{\isa{\isacommand{thm}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
662 |
\indexdef{}{command}{term}\mbox{\isa{\isacommand{term}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
663 |
\indexdef{}{command}{prop}\mbox{\isa{\isacommand{prop}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
664 |
\indexdef{}{command}{typ}\mbox{\isa{\isacommand{typ}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
665 |
\indexdef{}{command}{prf}\mbox{\isa{\isacommand{prf}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
666 |
\indexdef{}{command}{full\_prf}\mbox{\isa{\isacommand{full{\isacharunderscore}prf}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
26767 | 667 |
\end{matharray} |
668 |
||
669 |
These diagnostic commands assist interactive development. Note that |
|
26776 | 670 |
\mbox{\isa{\isacommand{undo}}} does not apply here, the theory or proof |
26767 | 671 |
configuration is not changed. |
672 |
||
673 |
\begin{rail} |
|
674 |
'pr' modes? nat? (',' nat)? |
|
675 |
; |
|
676 |
'thm' modes? thmrefs |
|
677 |
; |
|
678 |
'term' modes? term |
|
679 |
; |
|
680 |
'prop' modes? prop |
|
681 |
; |
|
682 |
'typ' modes? type |
|
683 |
; |
|
684 |
'prf' modes? thmrefs? |
|
685 |
; |
|
686 |
'full\_prf' modes? thmrefs? |
|
687 |
; |
|
688 |
||
689 |
modes: '(' (name + ) ')' |
|
690 |
; |
|
691 |
\end{rail} |
|
692 |
||
693 |
\begin{descr} |
|
694 |
||
26842 | 695 |
\item [\mbox{\isa{\isacommand{pr}}}~\isa{{\isachardoublequote}goals{\isacharcomma}\ prems{\isachardoublequote}}] prints the current |
26767 | 696 |
proof state (if present), including the proof context, current facts |
697 |
and goals. The optional limit arguments affect the number of goals |
|
698 |
and premises to be displayed, which is initially 10 for both. |
|
699 |
Omitting limit values leaves the current setting unchanged. |
|
700 |
||
26842 | 701 |
\item [\mbox{\isa{\isacommand{thm}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}] retrieves |
26767 | 702 |
theorems from the current theory or proof context. Note that any |
703 |
attributes included in the theorem specifications are applied to a |
|
704 |
temporary context derived from the current theory or proof; the |
|
26842 | 705 |
result is discarded, i.e.\ attributes involved in \isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ a\isactrlsub n{\isachardoublequote}} do not have any permanent effect. |
26767 | 706 |
|
26776 | 707 |
\item [\mbox{\isa{\isacommand{term}}}~\isa{t} and \mbox{\isa{\isacommand{prop}}}~\isa{{\isasymphi}}] |
26767 | 708 |
read, type-check and print terms or propositions according to the |
709 |
current theory or proof context; the inferred type of \isa{t} is |
|
710 |
output as well. Note that these commands are also useful in |
|
711 |
inspecting the current environment of term abbreviations. |
|
712 |
||
26776 | 713 |
\item [\mbox{\isa{\isacommand{typ}}}~\isa{{\isasymtau}}] reads and prints types of the |
26767 | 714 |
meta-logic according to the current theory or proof context. |
715 |
||
26776 | 716 |
\item [\mbox{\isa{\isacommand{prf}}}] displays the (compact) proof term of the |
26767 | 717 |
current proof state (if present), or of the given theorems. Note |
718 |
that this requires proof terms to be switched on for the current |
|
719 |
object logic (see the ``Proof terms'' section of the Isabelle |
|
720 |
reference manual for information on how to do this). |
|
721 |
||
26776 | 722 |
\item [\mbox{\isa{\isacommand{full{\isacharunderscore}prf}}}] is like \mbox{\isa{\isacommand{prf}}}, but displays |
26767 | 723 |
the full proof term, i.e.\ also displays information omitted in the |
26776 | 724 |
compact proof term, which is denoted by ``\isa{{\isacharunderscore}}'' placeholders |
725 |
there. |
|
26767 | 726 |
|
727 |
\end{descr} |
|
728 |
||
729 |
All of the diagnostic commands above admit a list of \isa{modes} |
|
730 |
to be specified, which is appended to the current print mode (see |
|
731 |
also \cite{isabelle-ref}). Thus the output behavior may be modified |
|
26842 | 732 |
according particular print mode features. For example, \mbox{\isa{\isacommand{pr}}}~\isa{{\isachardoublequote}{\isacharparenleft}latex\ xsymbols\ symbols{\isacharparenright}{\isachardoublequote}} would print the current |
26767 | 733 |
proof state with mathematical symbols and special characters |
734 |
represented in {\LaTeX} source, according to the Isabelle style |
|
735 |
\cite{isabelle-sys}. |
|
736 |
||
737 |
Note that antiquotations (cf.\ \secref{sec:antiq}) provide a more |
|
738 |
systematic way to include formal items into the printed text |
|
739 |
document.% |
|
740 |
\end{isamarkuptext}% |
|
741 |
\isamarkuptrue% |
|
742 |
% |
|
743 |
\isamarkupsubsection{Inspecting the context% |
|
744 |
} |
|
745 |
\isamarkuptrue% |
|
746 |
% |
|
747 |
\begin{isamarkuptext}% |
|
748 |
\begin{matharray}{rcl} |
|
26867 | 749 |
\indexdef{}{command}{print\_commands}\mbox{\isa{\isacommand{print{\isacharunderscore}commands}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\ |
750 |
\indexdef{}{command}{print\_theory}\mbox{\isa{\isacommand{print{\isacharunderscore}theory}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
751 |
\indexdef{}{command}{print\_syntax}\mbox{\isa{\isacommand{print{\isacharunderscore}syntax}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
752 |
\indexdef{}{command}{print\_methods}\mbox{\isa{\isacommand{print{\isacharunderscore}methods}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
753 |
\indexdef{}{command}{print\_attributes}\mbox{\isa{\isacommand{print{\isacharunderscore}attributes}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
754 |
\indexdef{}{command}{print\_theorems}\mbox{\isa{\isacommand{print{\isacharunderscore}theorems}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
755 |
\indexdef{}{command}{find\_theorems}\mbox{\isa{\isacommand{find{\isacharunderscore}theorems}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
756 |
\indexdef{}{command}{thms\_deps}\mbox{\isa{\isacommand{thms{\isacharunderscore}deps}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{theory~|~proof} \\ |
|
757 |
\indexdef{}{command}{print\_facts}\mbox{\isa{\isacommand{print{\isacharunderscore}facts}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{proof} \\ |
|
758 |
\indexdef{}{command}{print\_binds}\mbox{\isa{\isacommand{print{\isacharunderscore}binds}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{proof} \\ |
|
26767 | 759 |
\end{matharray} |
760 |
||
761 |
\begin{rail} |
|
762 |
'print\_theory' ( '!'?) |
|
763 |
; |
|
764 |
||
765 |
'find\_theorems' (('(' (nat)? ('with\_dups')? ')')?) (criterion *) |
|
766 |
; |
|
767 |
criterion: ('-'?) ('name' ':' nameref | 'intro' | 'elim' | 'dest' | |
|
768 |
'simp' ':' term | term) |
|
769 |
; |
|
770 |
'thm\_deps' thmrefs |
|
771 |
; |
|
772 |
\end{rail} |
|
773 |
||
774 |
These commands print certain parts of the theory and proof context. |
|
775 |
Note that there are some further ones available, such as for the set |
|
776 |
of rules declared for simplifications. |
|
777 |
||
778 |
\begin{descr} |
|
779 |
||
26776 | 780 |
\item [\mbox{\isa{\isacommand{print{\isacharunderscore}commands}}}] prints Isabelle's outer theory |
26767 | 781 |
syntax, including keywords and command. |
782 |
||
26776 | 783 |
\item [\mbox{\isa{\isacommand{print{\isacharunderscore}theory}}}] prints the main logical content of |
26842 | 784 |
the theory context; the ``\isa{{\isachardoublequote}{\isacharbang}{\isachardoublequote}}'' option indicates extra |
26767 | 785 |
verbosity. |
786 |
||
26776 | 787 |
\item [\mbox{\isa{\isacommand{print{\isacharunderscore}syntax}}}] prints the inner syntax of types |
26767 | 788 |
and terms, depending on the current context. The output can be very |
789 |
verbose, including grammar tables and syntax translation rules. See |
|
790 |
\cite[\S7, \S8]{isabelle-ref} for further information on Isabelle's |
|
791 |
inner syntax. |
|
792 |
||
26776 | 793 |
\item [\mbox{\isa{\isacommand{print{\isacharunderscore}methods}}}] prints all proof methods |
26767 | 794 |
available in the current theory context. |
795 |
||
26776 | 796 |
\item [\mbox{\isa{\isacommand{print{\isacharunderscore}attributes}}}] prints all attributes |
26767 | 797 |
available in the current theory context. |
798 |
||
26776 | 799 |
\item [\mbox{\isa{\isacommand{print{\isacharunderscore}theorems}}}] prints theorems resulting from |
26767 | 800 |
the last command. |
801 |
||
26776 | 802 |
\item [\mbox{\isa{\isacommand{find{\isacharunderscore}theorems}}}~\isa{criteria}] retrieves facts |
26767 | 803 |
from the theory or proof context matching all of given search |
26842 | 804 |
criteria. The criterion \isa{{\isachardoublequote}name{\isacharcolon}\ p{\isachardoublequote}} selects all theorems |
26767 | 805 |
whose fully qualified name matches pattern \isa{p}, which may |
26842 | 806 |
contain ``\isa{{\isachardoublequote}{\isacharasterisk}{\isachardoublequote}}'' wildcards. The criteria \isa{intro}, |
26767 | 807 |
\isa{elim}, and \isa{dest} select theorems that match the |
808 |
current goal as introduction, elimination or destruction rules, |
|
26842 | 809 |
respectively. The criterion \isa{{\isachardoublequote}simp{\isacharcolon}\ t{\isachardoublequote}} selects all rewrite |
26767 | 810 |
rules whose left-hand side matches the given term. The criterion |
811 |
term \isa{t} selects all theorems that contain the pattern \isa{t} -- as usual, patterns may contain occurrences of the dummy |
|
26776 | 812 |
``\isa{{\isacharunderscore}}'', schematic variables, and type constraints. |
26767 | 813 |
|
26842 | 814 |
Criteria can be preceded by ``\isa{{\isachardoublequote}{\isacharminus}{\isachardoublequote}}'' to select theorems that |
26767 | 815 |
do \emph{not} match. Note that giving the empty list of criteria |
816 |
yields \emph{all} currently known facts. An optional limit for the |
|
817 |
number of printed facts may be given; the default is 40. By |
|
818 |
default, duplicates are removed from the search result. Use |
|
26776 | 819 |
\mbox{\isa{\isakeyword{with{\isacharunderscore}dups}}} to display duplicates. |
26767 | 820 |
|
26842 | 821 |
\item [\mbox{\isa{\isacommand{thm{\isacharunderscore}deps}}}~\isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}] |
26767 | 822 |
visualizes dependencies of facts, using Isabelle's graph browser |
823 |
tool (see also \cite{isabelle-sys}). |
|
824 |
||
26776 | 825 |
\item [\mbox{\isa{\isacommand{print{\isacharunderscore}facts}}}] prints all local facts of the |
26767 | 826 |
current context, both named and unnamed ones. |
827 |
||
26776 | 828 |
\item [\mbox{\isa{\isacommand{print{\isacharunderscore}binds}}}] prints all term abbreviations |
26767 | 829 |
present in the context. |
830 |
||
831 |
\end{descr}% |
|
832 |
\end{isamarkuptext}% |
|
833 |
\isamarkuptrue% |
|
834 |
% |
|
835 |
\isamarkupsubsection{History commands \label{sec:history}% |
|
836 |
} |
|
837 |
\isamarkuptrue% |
|
838 |
% |
|
839 |
\begin{isamarkuptext}% |
|
840 |
\begin{matharray}{rcl} |
|
26776 | 841 |
\indexdef{}{command}{undo}\mbox{\isa{\isacommand{undo}}}^{{ * }{ * }} & : & \isarkeep{\cdot} \\ |
842 |
\indexdef{}{command}{redo}\mbox{\isa{\isacommand{redo}}}^{{ * }{ * }} & : & \isarkeep{\cdot} \\ |
|
843 |
\indexdef{}{command}{kill}\mbox{\isa{\isacommand{kill}}}^{{ * }{ * }} & : & \isarkeep{\cdot} \\ |
|
26767 | 844 |
\end{matharray} |
845 |
||
846 |
The Isabelle/Isar top-level maintains a two-stage history, for |
|
847 |
theory and proof state transformation. Basically, any command can |
|
26776 | 848 |
be undone using \mbox{\isa{\isacommand{undo}}}, excluding mere diagnostic |
849 |
elements. Its effect may be revoked via \mbox{\isa{\isacommand{redo}}}, unless |
|
850 |
the corresponding \mbox{\isa{\isacommand{undo}}} step has crossed the beginning |
|
851 |
of a proof or theory. The \mbox{\isa{\isacommand{kill}}} command aborts the |
|
26767 | 852 |
current history node altogether, discontinuing a proof or even the |
853 |
whole theory. This operation is \emph{not} undo-able. |
|
854 |
||
855 |
\begin{warn} |
|
856 |
History commands should never be used with user interfaces such as |
|
857 |
Proof~General \cite{proofgeneral,Aspinall:TACAS:2000}, which takes |
|
858 |
care of stepping forth and back itself. Interfering by manual |
|
26776 | 859 |
\mbox{\isa{\isacommand{undo}}}, \mbox{\isa{\isacommand{redo}}}, or even \mbox{\isa{\isacommand{kill}}} |
26767 | 860 |
commands would quickly result in utter confusion. |
861 |
\end{warn}% |
|
862 |
\end{isamarkuptext}% |
|
863 |
\isamarkuptrue% |
|
864 |
% |
|
865 |
\isamarkupsubsection{System operations% |
|
866 |
} |
|
867 |
\isamarkuptrue% |
|
868 |
% |
|
869 |
\begin{isamarkuptext}% |
|
870 |
\begin{matharray}{rcl} |
|
26867 | 871 |
\indexdef{}{command}{cd}\mbox{\isa{\isacommand{cd}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\ |
872 |
\indexdef{}{command}{pwd}\mbox{\isa{\isacommand{pwd}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\ |
|
873 |
\indexdef{}{command}{use\_thy}\mbox{\isa{\isacommand{use{\isacharunderscore}thy}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\ |
|
874 |
\indexdef{}{command}{display\_drafts}\mbox{\isa{\isacommand{display{\isacharunderscore}drafts}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\ |
|
875 |
\indexdef{}{command}{print\_drafts}\mbox{\isa{\isacommand{print{\isacharunderscore}drafts}}}\isa{{\isachardoublequote}\isactrlsup {\isacharasterisk}{\isachardoublequote}} & : & \isarkeep{\cdot} \\ |
|
26767 | 876 |
\end{matharray} |
877 |
||
878 |
\begin{rail} |
|
879 |
('cd' | 'use\_thy' | 'update\_thy') name |
|
880 |
; |
|
881 |
('display\_drafts' | 'print\_drafts') (name +) |
|
882 |
; |
|
883 |
\end{rail} |
|
884 |
||
885 |
\begin{descr} |
|
886 |
||
26776 | 887 |
\item [\mbox{\isa{\isacommand{cd}}}~\isa{path}] changes the current directory |
26767 | 888 |
of the Isabelle process. |
889 |
||
26776 | 890 |
\item [\mbox{\isa{\isacommand{pwd}}}] prints the current working directory. |
26767 | 891 |
|
26776 | 892 |
\item [\mbox{\isa{\isacommand{use{\isacharunderscore}thy}}}~\isa{A}] preload theory \isa{A}. |
26767 | 893 |
These system commands are scarcely used when working interactively, |
894 |
since loading of theories is done automatically as required. |
|
895 |
||
26776 | 896 |
\item [\mbox{\isa{\isacommand{display{\isacharunderscore}drafts}}}~\isa{paths} and \mbox{\isa{\isacommand{print{\isacharunderscore}drafts}}}~\isa{paths}] perform simple output of a given list |
26767 | 897 |
of raw source files. Only those symbols that do not require |
898 |
additional {\LaTeX} packages are displayed properly, everything else |
|
899 |
is left verbatim. |
|
900 |
||
901 |
\end{descr}% |
|
902 |
\end{isamarkuptext}% |
|
903 |
\isamarkuptrue% |
|
904 |
% |
|
905 |
\isadelimtheory |
|
906 |
% |
|
907 |
\endisadelimtheory |
|
908 |
% |
|
909 |
\isatagtheory |
|
910 |
\isacommand{end}\isamarkupfalse% |
|
911 |
% |
|
912 |
\endisatagtheory |
|
913 |
{\isafoldtheory}% |
|
914 |
% |
|
915 |
\isadelimtheory |
|
916 |
% |
|
917 |
\endisadelimtheory |
|
918 |
\isanewline |
|
919 |
\end{isabellebody}% |
|
920 |
%%% Local Variables: |
|
921 |
%%% mode: latex |
|
922 |
%%% TeX-master: "root" |
|
923 |
%%% End: |