author | wenzelm |
Mon, 29 Nov 2010 11:27:39 +0100 | |
changeset 40802 | 3cd23f676c5b |
parent 40784 | 177e8cea3e09 |
child 41249 | 26f12f98f50a |
permissions | -rw-r--r-- |
26869 | 1 |
% |
2 |
\begin{isabellebody}% |
|
3 |
\def\isabellecontext{Spec}% |
|
4 |
% |
|
5 |
\isadelimtheory |
|
6 |
% |
|
7 |
\endisadelimtheory |
|
8 |
% |
|
9 |
\isatagtheory |
|
10 |
\isacommand{theory}\isamarkupfalse% |
|
11 |
\ Spec\isanewline |
|
12 |
\isakeyword{imports}\ Main\isanewline |
|
13 |
\isakeyword{begin}% |
|
14 |
\endisatagtheory |
|
15 |
{\isafoldtheory}% |
|
16 |
% |
|
17 |
\isadelimtheory |
|
18 |
% |
|
19 |
\endisadelimtheory |
|
20 |
% |
|
27047 | 21 |
\isamarkupchapter{Theory specifications% |
26869 | 22 |
} |
23 |
\isamarkuptrue% |
|
24 |
% |
|
29746 | 25 |
\begin{isamarkuptext}% |
26 |
The Isabelle/Isar theory format integrates specifications and |
|
27 |
proofs, supporting interactive development with unlimited undo |
|
28 |
operation. There is an integrated document preparation system (see |
|
29 |
\chref{ch:document-prep}), for typesetting formal developments |
|
30 |
together with informal text. The resulting hyper-linked PDF |
|
31 |
documents can be used both for WWW presentation and printed copies. |
|
32 |
||
33 |
The Isar proof language (see \chref{ch:proofs}) is embedded into the |
|
34 |
theory language as a proper sub-language. Proof mode is entered by |
|
35 |
stating some \hyperlink{command.theorem}{\mbox{\isa{\isacommand{theorem}}}} or \hyperlink{command.lemma}{\mbox{\isa{\isacommand{lemma}}}} at the theory |
|
36 |
level, and left again with the final conclusion (e.g.\ via \hyperlink{command.qed}{\mbox{\isa{\isacommand{qed}}}}). Some theory specification mechanisms also require a proof, |
|
37 |
such as \hyperlink{command.typedef}{\mbox{\isa{\isacommand{typedef}}}} in HOL, which demands non-emptiness of |
|
38 |
the representing sets.% |
|
39 |
\end{isamarkuptext}% |
|
40 |
\isamarkuptrue% |
|
41 |
% |
|
26870 | 42 |
\isamarkupsection{Defining theories \label{sec:begin-thy}% |
43 |
} |
|
44 |
\isamarkuptrue% |
|
45 |
% |
|
46 |
\begin{isamarkuptext}% |
|
47 |
\begin{matharray}{rcl} |
|
40406 | 48 |
\indexdef{}{command}{theory}\hypertarget{command.theory}{\hyperlink{command.theory}{\mbox{\isa{\isacommand{theory}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}toplevel\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\ |
49 |
\indexdef{global}{command}{end}\hypertarget{command.global.end}{\hyperlink{command.global.end}{\mbox{\isa{\isacommand{end}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ toplevel{\isaliteral{22}{\isachardoublequote}}} \\ |
|
26870 | 50 |
\end{matharray} |
51 |
||
28788 | 52 |
Isabelle/Isar theories are defined via theory files, which may |
53 |
contain both specifications and proofs; occasionally definitional |
|
54 |
mechanisms also require some explicit proof. The theory body may be |
|
55 |
sub-structured by means of \emph{local theory targets}, such as |
|
56 |
\hyperlink{command.locale}{\mbox{\isa{\isacommand{locale}}}} and \hyperlink{command.class}{\mbox{\isa{\isacommand{class}}}}. |
|
26870 | 57 |
|
28788 | 58 |
The first proper command of a theory is \hyperlink{command.theory}{\mbox{\isa{\isacommand{theory}}}}, which |
59 |
indicates imports of previous theories and optional dependencies on |
|
60 |
other source files (usually in ML). Just preceding the initial |
|
61 |
\hyperlink{command.theory}{\mbox{\isa{\isacommand{theory}}}} command there may be an optional \hyperlink{command.header}{\mbox{\isa{\isacommand{header}}}} declaration, which is only relevant to document |
|
62 |
preparation: see also the other section markup commands in |
|
63 |
\secref{sec:markup}. |
|
64 |
||
65 |
A theory is concluded by a final \hyperlink{command.global.end}{\mbox{\isa{\isacommand{end}}}} command, |
|
66 |
one that does not belong to a local theory target. No further |
|
67 |
commands may follow such a global \hyperlink{command.global.end}{\mbox{\isa{\isacommand{end}}}}, |
|
68 |
although some user-interfaces might pretend that trailing input is |
|
69 |
admissible. |
|
26870 | 70 |
|
71 |
\begin{rail} |
|
72 |
'theory' name 'imports' (name +) uses? 'begin' |
|
73 |
; |
|
74 |
||
75 |
uses: 'uses' ((name | parname) +); |
|
76 |
\end{rail} |
|
77 |
||
28788 | 78 |
\begin{description} |
26870 | 79 |
|
40406 | 80 |
\item \hyperlink{command.theory}{\mbox{\isa{\isacommand{theory}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C494D504F5254533E}{\isasymIMPORTS}}\ B\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ B\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ {\isaliteral{5C3C424547494E3E}{\isasymBEGIN}}{\isaliteral{22}{\isachardoublequote}}} |
28788 | 81 |
starts a new theory \isa{A} based on the merge of existing |
40406 | 82 |
theories \isa{{\isaliteral{22}{\isachardoublequote}}B\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ B\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}}. |
26870 | 83 |
|
28788 | 84 |
Due to the possibility to import more than one ancestor, the |
85 |
resulting theory structure of an Isabelle session forms a directed |
|
86 |
acyclic graph (DAG). Isabelle's theory loader ensures that the |
|
87 |
sources contributing to the development graph are always up-to-date: |
|
88 |
changed files are automatically reloaded whenever a theory header |
|
89 |
specification is processed. |
|
26870 | 90 |
|
26902 | 91 |
The optional \indexdef{}{keyword}{uses}\hypertarget{keyword.uses}{\hyperlink{keyword.uses}{\mbox{\isa{\isakeyword{uses}}}}} specification declares additional |
26870 | 92 |
dependencies on extra files (usually ML sources). Files will be |
28788 | 93 |
loaded immediately (as ML), unless the name is parenthesized. The |
94 |
latter case records a dependency that needs to be resolved later in |
|
95 |
the text, usually via explicit \indexref{}{command}{use}\hyperlink{command.use}{\mbox{\isa{\isacommand{use}}}} for ML files; |
|
96 |
other file formats require specific load commands defined by the |
|
97 |
corresponding tools or packages. |
|
26870 | 98 |
|
28788 | 99 |
\item \hyperlink{command.global.end}{\mbox{\isa{\isacommand{end}}}} concludes the current theory |
100 |
definition. Note that local theory targets involve a local |
|
101 |
\hyperlink{command.local.end}{\mbox{\isa{\isacommand{end}}}}, which is clear from the nesting. |
|
27042 | 102 |
|
28788 | 103 |
\end{description}% |
27042 | 104 |
\end{isamarkuptext}% |
105 |
\isamarkuptrue% |
|
106 |
% |
|
107 |
\isamarkupsection{Local theory targets \label{sec:target}% |
|
108 |
} |
|
109 |
\isamarkuptrue% |
|
110 |
% |
|
111 |
\begin{isamarkuptext}% |
|
112 |
A local theory target is a context managed separately within the |
|
113 |
enclosing theory. Contexts may introduce parameters (fixed |
|
114 |
variables) and assumptions (hypotheses). Definitions and theorems |
|
115 |
depending on the context may be added incrementally later on. Named |
|
116 |
contexts refer to locales (cf.\ \secref{sec:locale}) or type classes |
|
40406 | 117 |
(cf.\ \secref{sec:class}); the name ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2D}{\isacharminus}}{\isaliteral{22}{\isachardoublequote}}}'' signifies the |
27042 | 118 |
global theory context. |
119 |
||
120 |
\begin{matharray}{rcll} |
|
40406 | 121 |
\indexdef{}{command}{context}\hypertarget{command.context}{\hyperlink{command.context}{\mbox{\isa{\isacommand{context}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
122 |
\indexdef{local}{command}{end}\hypertarget{command.local.end}{\hyperlink{command.local.end}{\mbox{\isa{\isacommand{end}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
27042 | 123 |
\end{matharray} |
124 |
||
125 |
\indexouternonterm{target} |
|
126 |
\begin{rail} |
|
127 |
'context' name 'begin' |
|
128 |
; |
|
129 |
||
130 |
target: '(' 'in' name ')' |
|
131 |
; |
|
132 |
\end{rail} |
|
133 |
||
28788 | 134 |
\begin{description} |
27042 | 135 |
|
40406 | 136 |
\item \hyperlink{command.context}{\mbox{\isa{\isacommand{context}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{5C3C424547494E3E}{\isasymBEGIN}}{\isaliteral{22}{\isachardoublequote}}} recommences an |
27042 | 137 |
existing locale or class context \isa{c}. Note that locale and |
27052 | 138 |
class definitions allow to include the \hyperlink{keyword.begin}{\mbox{\isa{\isakeyword{begin}}}} keyword as |
139 |
well, in order to continue the local theory immediately after the |
|
140 |
initial specification. |
|
27042 | 141 |
|
28788 | 142 |
\item \hyperlink{command.local.end}{\mbox{\isa{\isacommand{end}}}} concludes the current local theory |
27042 | 143 |
and continues the enclosing global theory. Note that a global |
144 |
\hyperlink{command.global.end}{\mbox{\isa{\isacommand{end}}}} has a different meaning: it concludes the |
|
145 |
theory itself (\secref{sec:begin-thy}). |
|
146 |
||
40406 | 147 |
\item \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{22}{\isachardoublequote}}}\indexdef{}{keyword}{in}\hypertarget{keyword.in}{\hyperlink{keyword.in}{\mbox{\isa{\isakeyword{in}}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} given after any |
29746 | 148 |
local theory command specifies an immediate target, e.g.\ |
40406 | 149 |
``\hyperlink{command.definition}{\mbox{\isa{\isacommand{definition}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C494E3E}{\isasymIN}}\ c{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}}'' or ``\hyperlink{command.theorem}{\mbox{\isa{\isacommand{theorem}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C494E3E}{\isasymIN}}\ c{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}}''. This works both in a local or |
27042 | 150 |
global theory context; the current target context will be suspended |
40406 | 151 |
for this command only. Note that ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C494E3E}{\isasymIN}}\ {\isaliteral{2D}{\isacharminus}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}'' will |
27042 | 152 |
always produce a global result independently of the current target |
153 |
context. |
|
154 |
||
28788 | 155 |
\end{description} |
27042 | 156 |
|
157 |
The exact meaning of results produced within a local theory context |
|
158 |
depends on the underlying target infrastructure (locale, type class |
|
159 |
etc.). The general idea is as follows, considering a context named |
|
40406 | 160 |
\isa{c} with parameter \isa{x} and assumption \isa{{\isaliteral{22}{\isachardoublequote}}A{\isaliteral{5B}{\isacharbrackleft}}x{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}}. |
27042 | 161 |
|
162 |
Definitions are exported by introducing a global version with |
|
163 |
additional arguments; a syntactic abbreviation links the long form |
|
164 |
with the abstract version of the target context. For example, |
|
40406 | 165 |
\isa{{\isaliteral{22}{\isachardoublequote}}a\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ t{\isaliteral{5B}{\isacharbrackleft}}x{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} becomes \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{2E}{\isachardot}}a\ {\isaliteral{3F}{\isacharquery}}x\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ t{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{3F}{\isacharquery}}x{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} at the theory |
166 |
level (for arbitrary \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3F}{\isacharquery}}x{\isaliteral{22}{\isachardoublequote}}}), together with a local |
|
167 |
abbreviation \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ c{\isaliteral{2E}{\isachardot}}a\ x{\isaliteral{22}{\isachardoublequote}}} in the target context (for the |
|
27042 | 168 |
fixed parameter \isa{x}). |
169 |
||
170 |
Theorems are exported by discharging the assumptions and |
|
40406 | 171 |
generalizing the parameters of the context. For example, \isa{{\isaliteral{22}{\isachardoublequote}}a{\isaliteral{3A}{\isacharcolon}}\ B{\isaliteral{5B}{\isacharbrackleft}}x{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} becomes \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{2E}{\isachardot}}a{\isaliteral{3A}{\isacharcolon}}\ A{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{3F}{\isacharquery}}x{\isaliteral{5D}{\isacharbrackright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ B{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{3F}{\isacharquery}}x{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}}, again for arbitrary |
172 |
\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3F}{\isacharquery}}x{\isaliteral{22}{\isachardoublequote}}}.% |
|
27042 | 173 |
\end{isamarkuptext}% |
174 |
\isamarkuptrue% |
|
175 |
% |
|
176 |
\isamarkupsection{Basic specification elements% |
|
177 |
} |
|
178 |
\isamarkuptrue% |
|
179 |
% |
|
180 |
\begin{isamarkuptext}% |
|
181 |
\begin{matharray}{rcll} |
|
40406 | 182 |
\indexdef{}{command}{axiomatization}\hypertarget{command.axiomatization}{\hyperlink{command.axiomatization}{\mbox{\isa{\isacommand{axiomatization}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} & (axiomatic!) \\ |
183 |
\indexdef{}{command}{definition}\hypertarget{command.definition}{\hyperlink{command.definition}{\mbox{\isa{\isacommand{definition}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
28788 | 184 |
\indexdef{}{attribute}{defn}\hypertarget{attribute.defn}{\hyperlink{attribute.defn}{\mbox{\isa{defn}}}} & : & \isa{attribute} \\ |
40406 | 185 |
\indexdef{}{command}{abbreviation}\hypertarget{command.abbreviation}{\hyperlink{command.abbreviation}{\mbox{\isa{\isacommand{abbreviation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
186 |
\indexdef{}{command}{print\_abbrevs}\hypertarget{command.print-abbrevs}{\hyperlink{command.print-abbrevs}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}abbrevs}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ {\isaliteral{22}{\isachardoublequote}}} \\ |
|
27042 | 187 |
\end{matharray} |
188 |
||
189 |
These specification mechanisms provide a slightly more abstract view |
|
190 |
than the underlying primitives of \hyperlink{command.consts}{\mbox{\isa{\isacommand{consts}}}}, \hyperlink{command.defs}{\mbox{\isa{\isacommand{defs}}}} (see \secref{sec:consts}), and \hyperlink{command.axioms}{\mbox{\isa{\isacommand{axioms}}}} (see |
|
191 |
\secref{sec:axms-thms}). In particular, type-inference is commonly |
|
192 |
available, and result names need not be given. |
|
193 |
||
194 |
\begin{rail} |
|
195 |
'axiomatization' target? fixes? ('where' specs)? |
|
196 |
; |
|
197 |
'definition' target? (decl 'where')? thmdecl? prop |
|
198 |
; |
|
199 |
'abbreviation' target? mode? (decl 'where')? prop |
|
200 |
; |
|
201 |
||
202 |
fixes: ((name ('::' type)? mixfix? | vars) + 'and') |
|
203 |
; |
|
204 |
specs: (thmdecl? props + 'and') |
|
205 |
; |
|
206 |
decl: name ('::' type)? mixfix? |
|
207 |
; |
|
208 |
\end{rail} |
|
209 |
||
28788 | 210 |
\begin{description} |
27042 | 211 |
|
40406 | 212 |
\item \hyperlink{command.axiomatization}{\mbox{\isa{\isacommand{axiomatization}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub m\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ {\isaliteral{5C3C7068693E}{\isasymphi}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{5C3C7068693E}{\isasymphi}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} |
28788 | 213 |
introduces several constants simultaneously and states axiomatic |
214 |
properties for these. The constants are marked as being specified |
|
215 |
once and for all, which prevents additional specifications being |
|
216 |
issued later on. |
|
27042 | 217 |
|
218 |
Note that axiomatic specifications are only appropriate when |
|
28110 | 219 |
declaring a new logical system; axiomatic specifications are |
220 |
restricted to global theory contexts. Normal applications should |
|
221 |
only use definitional mechanisms! |
|
27042 | 222 |
|
40406 | 223 |
\item \hyperlink{command.definition}{\mbox{\isa{\isacommand{definition}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ eq{\isaliteral{22}{\isachardoublequote}}} produces an |
224 |
internal definition \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ t{\isaliteral{22}{\isachardoublequote}}} according to the specification |
|
27042 | 225 |
given as \isa{eq}, which is then turned into a proven fact. The |
226 |
given proposition may deviate from internal meta-level equality |
|
227 |
according to the rewrite rules declared as \hyperlink{attribute.defn}{\mbox{\isa{defn}}} by the |
|
40406 | 228 |
object-logic. This usually covers object-level equality \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3D}{\isacharequal}}\ y{\isaliteral{22}{\isachardoublequote}}} and equivalence \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C6C65667472696768746172726F773E}{\isasymleftrightarrow}}\ B{\isaliteral{22}{\isachardoublequote}}}. End-users normally need not |
27042 | 229 |
change the \hyperlink{attribute.defn}{\mbox{\isa{defn}}} setup. |
230 |
||
231 |
Definitions may be presented with explicit arguments on the LHS, as |
|
40406 | 232 |
well as additional conditions, e.g.\ \isa{{\isaliteral{22}{\isachardoublequote}}f\ x\ y\ {\isaliteral{3D}{\isacharequal}}\ t{\isaliteral{22}{\isachardoublequote}}} instead of |
233 |
\isa{{\isaliteral{22}{\isachardoublequote}}f\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\ y{\isaliteral{2E}{\isachardot}}\ t{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}y\ {\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}\ {\isadigit{0}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ g\ x\ y\ {\isaliteral{3D}{\isacharequal}}\ u{\isaliteral{22}{\isachardoublequote}}} instead of an |
|
234 |
unrestricted \isa{{\isaliteral{22}{\isachardoublequote}}g\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\ y{\isaliteral{2E}{\isachardot}}\ u{\isaliteral{22}{\isachardoublequote}}}. |
|
27042 | 235 |
|
40406 | 236 |
\item \hyperlink{command.abbreviation}{\mbox{\isa{\isacommand{abbreviation}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ eq{\isaliteral{22}{\isachardoublequote}}} introduces a |
28788 | 237 |
syntactic constant which is associated with a certain term according |
238 |
to the meta-level equality \isa{eq}. |
|
27042 | 239 |
|
240 |
Abbreviations participate in the usual type-inference process, but |
|
241 |
are expanded before the logic ever sees them. Pretty printing of |
|
242 |
terms involves higher-order rewriting with rules stemming from |
|
243 |
reverted abbreviations. This needs some care to avoid overlapping |
|
244 |
or looping syntactic replacements! |
|
245 |
||
246 |
The optional \isa{mode} specification restricts output to a |
|
247 |
particular print mode; using ``\isa{input}'' here achieves the |
|
248 |
effect of one-way abbreviations. The mode may also include an |
|
249 |
``\hyperlink{keyword.output}{\mbox{\isa{\isakeyword{output}}}}'' qualifier that affects the concrete syntax |
|
250 |
declared for abbreviations, cf.\ \hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}} in |
|
251 |
\secref{sec:syn-trans}. |
|
252 |
||
40406 | 253 |
\item \hyperlink{command.print-abbrevs}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}abbrevs}}}} prints all constant abbreviations |
27042 | 254 |
of the current context. |
255 |
||
28788 | 256 |
\end{description}% |
27042 | 257 |
\end{isamarkuptext}% |
258 |
\isamarkuptrue% |
|
259 |
% |
|
260 |
\isamarkupsection{Generic declarations% |
|
261 |
} |
|
262 |
\isamarkuptrue% |
|
263 |
% |
|
264 |
\begin{isamarkuptext}% |
|
265 |
Arbitrary operations on the background context may be wrapped-up as |
|
266 |
generic declaration elements. Since the underlying concept of local |
|
267 |
theories may be subject to later re-interpretation, there is an |
|
268 |
additional dependency on a morphism that tells the difference of the |
|
269 |
original declaration context wrt.\ the application context |
|
270 |
encountered later on. A fact declaration is an important special |
|
271 |
case: it consists of a theorem which is applied to the context by |
|
272 |
means of an attribute. |
|
273 |
||
274 |
\begin{matharray}{rcl} |
|
40406 | 275 |
\indexdef{}{command}{declaration}\hypertarget{command.declaration}{\hyperlink{command.declaration}{\mbox{\isa{\isacommand{declaration}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
40784 | 276 |
\indexdef{}{command}{syntax\_declaration}\hypertarget{command.syntax-declaration}{\hyperlink{command.syntax-declaration}{\mbox{\isa{\isacommand{syntax{\isaliteral{5F}{\isacharunderscore}}declaration}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
40406 | 277 |
\indexdef{}{command}{declare}\hypertarget{command.declare}{\hyperlink{command.declare}{\mbox{\isa{\isacommand{declare}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
27042 | 278 |
\end{matharray} |
279 |
||
280 |
\begin{rail} |
|
40784 | 281 |
('declaration' | 'syntax_declaration') ('(pervasive)')? target? text |
27042 | 282 |
; |
283 |
'declare' target? (thmrefs + 'and') |
|
284 |
; |
|
285 |
\end{rail} |
|
286 |
||
28788 | 287 |
\begin{description} |
27042 | 288 |
|
28788 | 289 |
\item \hyperlink{command.declaration}{\mbox{\isa{\isacommand{declaration}}}}~\isa{d} adds the declaration |
27042 | 290 |
function \isa{d} of ML type \verb|declaration|, to the current |
291 |
local theory under construction. In later application contexts, the |
|
292 |
function is transformed according to the morphisms being involved in |
|
293 |
the interpretation hierarchy. |
|
294 |
||
40406 | 295 |
If the \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}pervasive{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} option is given, the corresponding |
33516 | 296 |
declaration is applied to all possible contexts involved, including |
297 |
the global background theory. |
|
298 |
||
40784 | 299 |
\item \hyperlink{command.syntax-declaration}{\mbox{\isa{\isacommand{syntax{\isaliteral{5F}{\isacharunderscore}}declaration}}}} is similar to \hyperlink{command.declaration}{\mbox{\isa{\isacommand{declaration}}}}, but is meant to affect only ``syntactic'' tools by |
300 |
convention (such as notation and type-checking information). |
|
301 |
||
28788 | 302 |
\item \hyperlink{command.declare}{\mbox{\isa{\isacommand{declare}}}}~\isa{thms} declares theorems to the |
27042 | 303 |
current local theory context. No theorem binding is involved here, |
304 |
unlike \hyperlink{command.theorems}{\mbox{\isa{\isacommand{theorems}}}} or \hyperlink{command.lemmas}{\mbox{\isa{\isacommand{lemmas}}}} (cf.\ |
|
305 |
\secref{sec:axms-thms}), so \hyperlink{command.declare}{\mbox{\isa{\isacommand{declare}}}} only has the effect |
|
306 |
of applying attributes as included in the theorem specification. |
|
307 |
||
28788 | 308 |
\end{description}% |
27042 | 309 |
\end{isamarkuptext}% |
310 |
\isamarkuptrue% |
|
311 |
% |
|
312 |
\isamarkupsection{Locales \label{sec:locale}% |
|
313 |
} |
|
314 |
\isamarkuptrue% |
|
315 |
% |
|
316 |
\begin{isamarkuptext}% |
|
33847 | 317 |
Locales are parametric named local contexts, consisting of a list of |
27042 | 318 |
declaration elements that are modeled after the Isar proof context |
319 |
commands (cf.\ \secref{sec:proof-context}).% |
|
320 |
\end{isamarkuptext}% |
|
321 |
\isamarkuptrue% |
|
322 |
% |
|
33847 | 323 |
\isamarkupsubsection{Locale expressions \label{sec:locale-expr}% |
324 |
} |
|
325 |
\isamarkuptrue% |
|
326 |
% |
|
327 |
\begin{isamarkuptext}% |
|
328 |
A \emph{locale expression} denotes a structured context composed of |
|
329 |
instances of existing locales. The context consists of a list of |
|
330 |
instances of declaration elements from the locales. Two locale |
|
331 |
instances are equal if they are of the same locale and the |
|
332 |
parameters are instantiated with equivalent terms. Declaration |
|
333 |
elements from equal instances are never repeated, thus avoiding |
|
334 |
duplicate declarations. |
|
335 |
||
336 |
\indexouternonterm{localeexpr} |
|
337 |
\begin{rail} |
|
338 |
localeexpr: (instance + '+') ('for' (fixes + 'and'))? |
|
339 |
; |
|
340 |
instance: (qualifier ':')? nameref (posinsts | namedinsts) |
|
341 |
; |
|
342 |
qualifier: name ('?' | '!')? |
|
343 |
; |
|
344 |
posinsts: (term | '_')* |
|
345 |
; |
|
346 |
namedinsts: 'where' (name '=' term + 'and') |
|
347 |
; |
|
348 |
\end{rail} |
|
349 |
||
350 |
A locale instance consists of a reference to a locale and either |
|
351 |
positional or named parameter instantiations. Identical |
|
352 |
instantiations (that is, those that instante a parameter by itself) |
|
40406 | 353 |
may be omitted. The notation `\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{22}{\isachardoublequote}}}' enables to omit the |
40256 | 354 |
instantiation for a parameter inside a positional instantiation. |
33847 | 355 |
|
356 |
Terms in instantiations are from the context the locale expressions |
|
357 |
is declared in. Local names may be added to this context with the |
|
358 |
optional for clause. In addition, syntax declarations from one |
|
359 |
instance are effective when parsing subsequent instances of the same |
|
360 |
expression. |
|
361 |
||
362 |
Instances have an optional qualifier which applies to names in |
|
363 |
declarations. Names include local definitions and theorem names. |
|
364 |
If present, the qualifier itself is either optional |
|
365 |
(``\texttt{?}''), which means that it may be omitted on input of the |
|
366 |
qualified name, or mandatory (``\texttt{!}''). If neither |
|
367 |
``\texttt{?}'' nor ``\texttt{!}'' are present, the command's default |
|
368 |
is used. For \hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}} and \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}} |
|
369 |
the default is ``mandatory'', for \hyperlink{command.locale}{\mbox{\isa{\isacommand{locale}}}} and \hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}} the default is ``optional''.% |
|
370 |
\end{isamarkuptext}% |
|
371 |
\isamarkuptrue% |
|
372 |
% |
|
373 |
\isamarkupsubsection{Locale declarations% |
|
27042 | 374 |
} |
375 |
\isamarkuptrue% |
|
376 |
% |
|
377 |
\begin{isamarkuptext}% |
|
378 |
\begin{matharray}{rcl} |
|
40406 | 379 |
\indexdef{}{command}{locale}\hypertarget{command.locale}{\hyperlink{command.locale}{\mbox{\isa{\isacommand{locale}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
380 |
\indexdef{}{command}{print\_locale}\hypertarget{command.print-locale}{\hyperlink{command.print-locale}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}locale}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
381 |
\indexdef{}{command}{print\_locales}\hypertarget{command.print-locales}{\hyperlink{command.print-locales}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}locales}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
382 |
\indexdef{}{method}{intro\_locales}\hypertarget{method.intro-locales}{\hyperlink{method.intro-locales}{\mbox{\isa{intro{\isaliteral{5F}{\isacharunderscore}}locales}}}} & : & \isa{method} \\ |
|
383 |
\indexdef{}{method}{unfold\_locales}\hypertarget{method.unfold-locales}{\hyperlink{method.unfold-locales}{\mbox{\isa{unfold{\isaliteral{5F}{\isacharunderscore}}locales}}}} & : & \isa{method} \\ |
|
27042 | 384 |
\end{matharray} |
385 |
||
33847 | 386 |
\indexouternonterm{contextelem} |
27042 | 387 |
\indexisarelem{fixes}\indexisarelem{constrains}\indexisarelem{assumes} |
28788 | 388 |
\indexisarelem{defines}\indexisarelem{notes} |
27042 | 389 |
\begin{rail} |
33847 | 390 |
'locale' name ('=' locale)? 'begin'? |
27042 | 391 |
; |
40255
9ffbc25e1606
eliminated obsolete \_ escapes in rail environments;
wenzelm
parents:
40240
diff
changeset
|
392 |
'print_locale' '!'? nameref |
27042 | 393 |
; |
33847 | 394 |
locale: contextelem+ | localeexpr ('+' (contextelem+))? |
27042 | 395 |
; |
33847 | 396 |
contextelem: |
397 |
'fixes' (fixes + 'and') |
|
398 |
| 'constrains' (name '::' type + 'and') |
|
399 |
| 'assumes' (props + 'and') |
|
400 |
| 'defines' (thmdecl? prop proppat? + 'and') |
|
401 |
| 'notes' (thmdef? thmrefs + 'and') |
|
27042 | 402 |
; |
403 |
\end{rail} |
|
404 |
||
28788 | 405 |
\begin{description} |
27042 | 406 |
|
40406 | 407 |
\item \hyperlink{command.locale}{\mbox{\isa{\isacommand{locale}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}loc\ {\isaliteral{3D}{\isacharequal}}\ import\ {\isaliteral{2B}{\isacharplus}}\ body{\isaliteral{22}{\isachardoublequote}}} defines a |
27042 | 408 |
new locale \isa{loc} as a context consisting of a certain view of |
409 |
existing locales (\isa{import}) plus some additional elements |
|
410 |
(\isa{body}). Both \isa{import} and \isa{body} are optional; |
|
411 |
the degenerate form \hyperlink{command.locale}{\mbox{\isa{\isacommand{locale}}}}~\isa{loc} defines an empty |
|
412 |
locale, which may still be useful to collect declarations of facts |
|
413 |
later on. Type-inference on locale expressions automatically takes |
|
414 |
care of the most general typing that the combined context elements |
|
415 |
may acquire. |
|
416 |
||
33847 | 417 |
The \isa{import} consists of a structured locale expression; see |
418 |
\secref{sec:proof-context} above. Its for clause defines the local |
|
419 |
parameters of the \isa{import}. In addition, locale parameters |
|
420 |
whose instantance is omitted automatically extend the (possibly |
|
421 |
empty) for clause: they are inserted at its beginning. This means |
|
422 |
that these parameters may be referred to from within the expression |
|
423 |
and also in the subsequent context elements and provides a |
|
424 |
notational convenience for the inheritance of parameters in locale |
|
425 |
declarations. |
|
27042 | 426 |
|
33847 | 427 |
The \isa{body} consists of context elements. |
27042 | 428 |
|
28788 | 429 |
\begin{description} |
27042 | 430 |
|
40406 | 431 |
\item \hyperlink{element.fixes}{\mbox{\isa{\isakeyword{fixes}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\ {\isaliteral{28}{\isacharparenleft}}mx{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} declares a local |
432 |
parameter of type \isa{{\isaliteral{5C3C7461753E}{\isasymtau}}} and mixfix annotation \isa{mx} (both |
|
433 |
are optional). The special syntax declaration ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C5354525543545552453E}{\isasymSTRUCTURE}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}'' means that \isa{x} may be referenced |
|
27042 | 434 |
implicitly in this context. |
435 |
||
40406 | 436 |
\item \hyperlink{element.constrains}{\mbox{\isa{\isakeyword{constrains}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} introduces a type |
437 |
constraint \isa{{\isaliteral{5C3C7461753E}{\isasymtau}}} on the local parameter \isa{x}. This |
|
38110 | 438 |
element is deprecated. The type constraint should be introduced in |
33847 | 439 |
the for clause or the relevant \hyperlink{element.fixes}{\mbox{\isa{\isakeyword{fixes}}}} element. |
27042 | 440 |
|
40406 | 441 |
\item \hyperlink{element.assumes}{\mbox{\isa{\isakeyword{assumes}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}a{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7068693E}{\isasymphi}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{5C3C7068693E}{\isasymphi}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} |
27042 | 442 |
introduces local premises, similar to \hyperlink{command.assume}{\mbox{\isa{\isacommand{assume}}}} within a |
443 |
proof (cf.\ \secref{sec:proof-context}). |
|
444 |
||
40406 | 445 |
\item \hyperlink{element.defines}{\mbox{\isa{\isakeyword{defines}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}a{\isaliteral{3A}{\isacharcolon}}\ x\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ t{\isaliteral{22}{\isachardoublequote}}} defines a previously |
27042 | 446 |
declared parameter. This is similar to \hyperlink{command.def}{\mbox{\isa{\isacommand{def}}}} within a |
447 |
proof (cf.\ \secref{sec:proof-context}), but \hyperlink{element.defines}{\mbox{\isa{\isakeyword{defines}}}} |
|
448 |
takes an equational proposition instead of variable-term pair. The |
|
449 |
left-hand side of the equation may have additional arguments, e.g.\ |
|
40406 | 450 |
``\hyperlink{element.defines}{\mbox{\isa{\isakeyword{defines}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}f\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ t{\isaliteral{22}{\isachardoublequote}}}''. |
27042 | 451 |
|
40406 | 452 |
\item \hyperlink{element.notes}{\mbox{\isa{\isakeyword{notes}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}a\ {\isaliteral{3D}{\isacharequal}}\ b\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ b\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} |
27042 | 453 |
reconsiders facts within a local context. Most notably, this may |
454 |
include arbitrary declarations in any attribute specifications |
|
455 |
included here, e.g.\ a local \hyperlink{attribute.simp}{\mbox{\isa{simp}}} rule. |
|
456 |
||
28788 | 457 |
The initial \isa{import} specification of a locale expression |
458 |
maintains a dynamic relation to the locales being referenced |
|
459 |
(benefiting from any later fact declarations in the obvious manner). |
|
27042 | 460 |
|
28788 | 461 |
\end{description} |
27042 | 462 |
|
40406 | 463 |
Note that ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C49533E}{\isasymIS}}\ p\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ p\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}'' patterns given |
27042 | 464 |
in the syntax of \hyperlink{element.assumes}{\mbox{\isa{\isakeyword{assumes}}}} and \hyperlink{element.defines}{\mbox{\isa{\isakeyword{defines}}}} above |
465 |
are illegal in locale definitions. In the long goal format of |
|
466 |
\secref{sec:goals}, term bindings may be included as expected, |
|
467 |
though. |
|
468 |
||
33847 | 469 |
\medskip Locale specifications are ``closed up'' by |
40406 | 470 |
turning the given text into a predicate definition \isa{loc{\isaliteral{5F}{\isacharunderscore}}axioms} and deriving the original assumptions as local lemmas |
27042 | 471 |
(modulo local definitions). The predicate statement covers only the |
472 |
newly specified assumptions, omitting the content of included locale |
|
473 |
expressions. The full cumulative view is only provided on export, |
|
474 |
involving another predicate \isa{loc} that refers to the complete |
|
475 |
specification text. |
|
476 |
||
477 |
In any case, the predicate arguments are those locale parameters |
|
478 |
that actually occur in the respective piece of text. Also note that |
|
479 |
these predicates operate at the meta-level in theory, but the locale |
|
480 |
packages attempts to internalize statements according to the |
|
40406 | 481 |
object-logic setup (e.g.\ replacing \isa{{\isaliteral{5C3C416E643E}{\isasymAnd}}} by \isa{{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}}, and |
482 |
\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}{\isaliteral{22}{\isachardoublequote}}} by \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}{\isaliteral{22}{\isachardoublequote}}} in HOL; see also |
|
483 |
\secref{sec:object-logic}). Separate introduction rules \isa{loc{\isaliteral{5F}{\isacharunderscore}}axioms{\isaliteral{2E}{\isachardot}}intro} and \isa{loc{\isaliteral{2E}{\isachardot}}intro} are provided as well. |
|
27042 | 484 |
|
40406 | 485 |
\item \hyperlink{command.print-locale}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}locale}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}locale{\isaliteral{22}{\isachardoublequote}}} prints the |
33868 | 486 |
contents of the named locale. The command omits \hyperlink{element.notes}{\mbox{\isa{\isakeyword{notes}}}} |
40406 | 487 |
elements by default. Use \hyperlink{command.print-locale}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}locale}}}}\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{21}{\isacharbang}}{\isaliteral{22}{\isachardoublequote}}} to |
33868 | 488 |
have them included. |
27042 | 489 |
|
40406 | 490 |
\item \hyperlink{command.print-locales}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}locales}}}} prints the names of all locales |
27042 | 491 |
of the current theory. |
492 |
||
40406 | 493 |
\item \hyperlink{method.intro-locales}{\mbox{\isa{intro{\isaliteral{5F}{\isacharunderscore}}locales}}} and \hyperlink{method.unfold-locales}{\mbox{\isa{unfold{\isaliteral{5F}{\isacharunderscore}}locales}}} |
27042 | 494 |
repeatedly expand all introduction rules of locale predicates of the |
40406 | 495 |
theory. While \hyperlink{method.intro-locales}{\mbox{\isa{intro{\isaliteral{5F}{\isacharunderscore}}locales}}} only applies the \isa{loc{\isaliteral{2E}{\isachardot}}intro} introduction rules and therefore does not decend to |
496 |
assumptions, \hyperlink{method.unfold-locales}{\mbox{\isa{unfold{\isaliteral{5F}{\isacharunderscore}}locales}}} is more aggressive and applies |
|
497 |
\isa{loc{\isaliteral{5F}{\isacharunderscore}}axioms{\isaliteral{2E}{\isachardot}}intro} as well. Both methods are aware of locale |
|
28728 | 498 |
specifications entailed by the context, both from target statements, |
499 |
and from interpretations (see below). New goals that are entailed |
|
500 |
by the current context are discharged automatically. |
|
27042 | 501 |
|
28788 | 502 |
\end{description}% |
27042 | 503 |
\end{isamarkuptext}% |
504 |
\isamarkuptrue% |
|
505 |
% |
|
33847 | 506 |
\isamarkupsubsection{Locale interpretations% |
27042 | 507 |
} |
508 |
\isamarkuptrue% |
|
509 |
% |
|
510 |
\begin{isamarkuptext}% |
|
33847 | 511 |
Locale expressions may be instantiated, and the instantiated facts |
512 |
added to the current context. This requires a proof of the |
|
513 |
instantiated specification and is called \emph{locale |
|
514 |
interpretation}. Interpretation is possible in locales \hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}}, theories (command \hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}}) and |
|
515 |
also within a proof body (command \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}}). |
|
27042 | 516 |
|
517 |
\begin{matharray}{rcl} |
|
40406 | 518 |
\indexdef{}{command}{sublocale}\hypertarget{command.sublocale}{\hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{28}{\isacharparenleft}}prove{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
519 |
\indexdef{}{command}{interpretation}\hypertarget{command.interpretation}{\hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{28}{\isacharparenleft}}prove{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
520 |
\indexdef{}{command}{interpret}\hypertarget{command.interpret}{\hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}proof{\isaliteral{28}{\isacharparenleft}}state{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{7C}{\isacharbar}}\ proof{\isaliteral{28}{\isacharparenleft}}chain{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{28}{\isacharparenleft}}prove{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
521 |
\indexdef{}{command}{print\_interps}\hypertarget{command.print-interps}{\hyperlink{command.print-interps}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}interps}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
27042 | 522 |
\end{matharray} |
523 |
||
524 |
\indexouternonterm{interp} |
|
525 |
\begin{rail} |
|
33847 | 526 |
'sublocale' nameref ('<' | subseteq) localeexpr |
27042 | 527 |
; |
33847 | 528 |
'interpretation' localeepxr equations? |
27042 | 529 |
; |
38110 | 530 |
'interpret' localeexpr equations? |
27042 | 531 |
; |
40255
9ffbc25e1606
eliminated obsolete \_ escapes in rail environments;
wenzelm
parents:
40240
diff
changeset
|
532 |
'print_interps' nameref |
33847 | 533 |
; |
534 |
equations: 'where' (thmdecl? prop + 'and') |
|
27042 | 535 |
; |
536 |
\end{rail} |
|
537 |
||
28788 | 538 |
\begin{description} |
27042 | 539 |
|
40406 | 540 |
\item \hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}name\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ expr{\isaliteral{22}{\isachardoublequote}}} |
33847 | 541 |
interprets \isa{expr} in the locale \isa{name}. A proof that |
542 |
the specification of \isa{name} implies the specification of |
|
543 |
\isa{expr} is required. As in the localized version of the |
|
544 |
theorem command, the proof is in the context of \isa{name}. After |
|
545 |
the proof obligation has been dischared, the facts of \isa{expr} |
|
546 |
become part of locale \isa{name} as \emph{derived} context |
|
547 |
elements and are available when the context \isa{name} is |
|
548 |
subsequently entered. Note that, like import, this is dynamic: |
|
549 |
facts added to a locale part of \isa{expr} after interpretation |
|
550 |
become also available in \isa{name}. |
|
27042 | 551 |
|
33847 | 552 |
Only specification fragments of \isa{expr} that are not already |
553 |
part of \isa{name} (be it imported, derived or a derived fragment |
|
554 |
of the import) are considered in this process. This enables |
|
555 |
circular interpretations to the extent that no infinite chains are |
|
556 |
generated in the locale hierarchy. |
|
27042 | 557 |
|
33847 | 558 |
If interpretations of \isa{name} exist in the current theory, the |
559 |
command adds interpretations for \isa{expr} as well, with the same |
|
560 |
qualifier, although only for fragments of \isa{expr} that are not |
|
561 |
interpreted in the theory already. |
|
27042 | 562 |
|
40406 | 563 |
\item \hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}expr\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ eqns{\isaliteral{22}{\isachardoublequote}}} |
33847 | 564 |
interprets \isa{expr} in the theory. The command generates proof |
565 |
obligations for the instantiated specifications (assumes and defines |
|
566 |
elements). Once these are discharged by the user, instantiated |
|
567 |
facts are added to the theory in a post-processing phase. |
|
568 |
||
569 |
Additional equations, which are unfolded during |
|
27042 | 570 |
post-processing, may be given after the keyword \hyperlink{keyword.where}{\mbox{\isa{\isakeyword{where}}}}. |
571 |
This is useful for interpreting concepts introduced through |
|
572 |
definition specification elements. The equations must be proved. |
|
573 |
||
574 |
The command is aware of interpretations already active in the |
|
28085
914183e229e9
Interpretation commands no longer accept interpretation attributes.
ballarin
parents:
27834
diff
changeset
|
575 |
theory, but does not simplify the goal automatically. In order to |
40406 | 576 |
simplify the proof obligations use methods \hyperlink{method.intro-locales}{\mbox{\isa{intro{\isaliteral{5F}{\isacharunderscore}}locales}}} |
577 |
or \hyperlink{method.unfold-locales}{\mbox{\isa{unfold{\isaliteral{5F}{\isacharunderscore}}locales}}}. Post-processing is not applied to |
|
28085
914183e229e9
Interpretation commands no longer accept interpretation attributes.
ballarin
parents:
27834
diff
changeset
|
578 |
facts of interpretations that are already active. This avoids |
914183e229e9
Interpretation commands no longer accept interpretation attributes.
ballarin
parents:
27834
diff
changeset
|
579 |
duplication of interpreted facts, in particular. Note that, in the |
914183e229e9
Interpretation commands no longer accept interpretation attributes.
ballarin
parents:
27834
diff
changeset
|
580 |
case of a locale with import, parts of the interpretation may |
914183e229e9
Interpretation commands no longer accept interpretation attributes.
ballarin
parents:
27834
diff
changeset
|
581 |
already be active. The command will only process facts for new |
914183e229e9
Interpretation commands no longer accept interpretation attributes.
ballarin
parents:
27834
diff
changeset
|
582 |
parts. |
27042 | 583 |
|
584 |
Adding facts to locales has the effect of adding interpreted facts |
|
585 |
to the theory for all active interpretations also. That is, |
|
586 |
interpretations dynamically participate in any facts added to |
|
587 |
locales. |
|
588 |
||
40406 | 589 |
\item \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}expr\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ eqns{\isaliteral{22}{\isachardoublequote}}} interprets |
38110 | 590 |
\isa{expr} in the proof context and is otherwise similar to |
591 |
interpretation in theories. Note that rewrite rules given to |
|
592 |
\hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}} should be explicitly universally quantified. |
|
27042 | 593 |
|
40406 | 594 |
\item \hyperlink{command.print-interps}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}interps}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}locale{\isaliteral{22}{\isachardoublequote}}} lists all |
595 |
interpretations of \isa{{\isaliteral{22}{\isachardoublequote}}locale{\isaliteral{22}{\isachardoublequote}}} in the current theory or proof |
|
38110 | 596 |
context, including those due to a combination of a \hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}} or \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}} and one or several |
597 |
\hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}} declarations. |
|
33868 | 598 |
|
28788 | 599 |
\end{description} |
27042 | 600 |
|
601 |
\begin{warn} |
|
602 |
Since attributes are applied to interpreted theorems, |
|
603 |
interpretation may modify the context of common proof tools, e.g.\ |
|
33868 | 604 |
the Simplifier or Classical Reasoner. As the behavior of such |
605 |
tools is \emph{not} stable under interpretation morphisms, manual |
|
606 |
declarations might have to be added to the target context of the |
|
607 |
interpretation to revert such declarations. |
|
27042 | 608 |
\end{warn} |
609 |
||
610 |
\begin{warn} |
|
38110 | 611 |
An interpretation in a theory or proof context may subsume previous |
27042 | 612 |
interpretations. This happens if the same specification fragment |
613 |
is interpreted twice and the instantiation of the second |
|
614 |
interpretation is more general than the interpretation of the |
|
33847 | 615 |
first. The locale package does not attempt to remove subsumed |
616 |
interpretations. |
|
27042 | 617 |
\end{warn}% |
618 |
\end{isamarkuptext}% |
|
619 |
\isamarkuptrue% |
|
620 |
% |
|
621 |
\isamarkupsection{Classes \label{sec:class}% |
|
622 |
} |
|
623 |
\isamarkuptrue% |
|
624 |
% |
|
625 |
\begin{isamarkuptext}% |
|
626 |
A class is a particular locale with \emph{exactly one} type variable |
|
40406 | 627 |
\isa{{\isaliteral{5C3C616C7068613E}{\isasymalpha}}}. Beyond the underlying locale, a corresponding type class |
27042 | 628 |
is established which is interpreted logically as axiomatic type |
629 |
class \cite{Wenzel:1997:TPHOL} whose logical content are the |
|
630 |
assumptions of the locale. Thus, classes provide the full |
|
631 |
generality of locales combined with the commodity of type classes |
|
632 |
(notably type-inference). See \cite{isabelle-classes} for a short |
|
633 |
tutorial. |
|
634 |
||
635 |
\begin{matharray}{rcl} |
|
40406 | 636 |
\indexdef{}{command}{class}\hypertarget{command.class}{\hyperlink{command.class}{\mbox{\isa{\isacommand{class}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
637 |
\indexdef{}{command}{instantiation}\hypertarget{command.instantiation}{\hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
638 |
\indexdef{}{command}{instance}\hypertarget{command.instance}{\hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
639 |
\indexdef{}{command}{instance}\hypertarget{command.instance}{\hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{28}{\isacharparenleft}}prove{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
640 |
\indexdef{}{command}{subclass}\hypertarget{command.subclass}{\hyperlink{command.subclass}{\mbox{\isa{\isacommand{subclass}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
641 |
\indexdef{}{command}{print\_classes}\hypertarget{command.print-classes}{\hyperlink{command.print-classes}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}classes}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
642 |
\indexdef{}{command}{class\_deps}\hypertarget{command.class-deps}{\hyperlink{command.class-deps}{\mbox{\isa{\isacommand{class{\isaliteral{5F}{\isacharunderscore}}deps}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
643 |
\indexdef{}{method}{intro\_classes}\hypertarget{method.intro-classes}{\hyperlink{method.intro-classes}{\mbox{\isa{intro{\isaliteral{5F}{\isacharunderscore}}classes}}}} & : & \isa{method} \\ |
|
27042 | 644 |
\end{matharray} |
645 |
||
646 |
\begin{rail} |
|
647 |
'class' name '=' ((superclassexpr '+' (contextelem+)) | superclassexpr | (contextelem+)) \\ |
|
648 |
'begin'? |
|
649 |
; |
|
650 |
'instantiation' (nameref + 'and') '::' arity 'begin' |
|
651 |
; |
|
652 |
'instance' |
|
653 |
; |
|
31914 | 654 |
'instance' (nameref + 'and') '::' arity |
31681 | 655 |
; |
27042 | 656 |
'subclass' target? nameref |
657 |
; |
|
31681 | 658 |
'instance' nameref ('<' | subseteq) nameref |
659 |
; |
|
40255
9ffbc25e1606
eliminated obsolete \_ escapes in rail environments;
wenzelm
parents:
40240
diff
changeset
|
660 |
'print_classes' |
27042 | 661 |
; |
40255
9ffbc25e1606
eliminated obsolete \_ escapes in rail environments;
wenzelm
parents:
40240
diff
changeset
|
662 |
'class_deps' |
29706 | 663 |
; |
27042 | 664 |
|
665 |
superclassexpr: nameref | (nameref '+' superclassexpr) |
|
666 |
; |
|
667 |
\end{rail} |
|
668 |
||
28788 | 669 |
\begin{description} |
27042 | 670 |
|
40406 | 671 |
\item \hyperlink{command.class}{\mbox{\isa{\isacommand{class}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{3D}{\isacharequal}}\ superclasses\ {\isaliteral{2B}{\isacharplus}}\ body{\isaliteral{22}{\isachardoublequote}}} defines |
27042 | 672 |
a new class \isa{c}, inheriting from \isa{superclasses}. This |
673 |
introduces a locale \isa{c} with import of all locales \isa{superclasses}. |
|
674 |
||
675 |
Any \hyperlink{element.fixes}{\mbox{\isa{\isakeyword{fixes}}}} in \isa{body} are lifted to the global |
|
40406 | 676 |
theory level (\emph{class operations} \isa{{\isaliteral{22}{\isachardoublequote}}f\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ f\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} of class \isa{c}), mapping the local type parameter |
677 |
\isa{{\isaliteral{5C3C616C7068613E}{\isasymalpha}}} to a schematic type variable \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3F}{\isacharquery}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ c{\isaliteral{22}{\isachardoublequote}}}. |
|
27042 | 678 |
|
679 |
Likewise, \hyperlink{element.assumes}{\mbox{\isa{\isakeyword{assumes}}}} in \isa{body} are also lifted, |
|
40406 | 680 |
mapping each local parameter \isa{{\isaliteral{22}{\isachardoublequote}}f\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} to its |
681 |
corresponding global constant \isa{{\isaliteral{22}{\isachardoublequote}}f\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{3F}{\isacharquery}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ c{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}}. The |
|
682 |
corresponding introduction rule is provided as \isa{c{\isaliteral{5F}{\isacharunderscore}}class{\isaliteral{5F}{\isacharunderscore}}axioms{\isaliteral{2E}{\isachardot}}intro}. This rule should be rarely needed directly |
|
683 |
--- the \hyperlink{method.intro-classes}{\mbox{\isa{intro{\isaliteral{5F}{\isacharunderscore}}classes}}} method takes care of the details of |
|
27042 | 684 |
class membership proofs. |
685 |
||
40406 | 686 |
\item \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}t\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ s\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{29}{\isacharparenright}}s\ {\isaliteral{5C3C424547494E3E}{\isasymBEGIN}}{\isaliteral{22}{\isachardoublequote}}} opens a theory target (cf.\ \secref{sec:target}) which |
687 |
allows to specify class operations \isa{{\isaliteral{22}{\isachardoublequote}}f\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ f\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} corresponding |
|
688 |
to sort \isa{s} at the particular type instance \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ s\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{29}{\isacharparenright}}\ t{\isaliteral{22}{\isachardoublequote}}}. A plain \hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}} command in the |
|
28788 | 689 |
target body poses a goal stating these type arities. The target is |
690 |
concluded by an \indexref{local}{command}{end}\hyperlink{command.local.end}{\mbox{\isa{\isacommand{end}}}} command. |
|
27042 | 691 |
|
692 |
Note that a list of simultaneous type constructors may be given; |
|
31914 | 693 |
this corresponds nicely to mutually recursive type definitions, e.g.\ |
27042 | 694 |
in Isabelle/HOL. |
695 |
||
28788 | 696 |
\item \hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}} in an instantiation target body sets |
40406 | 697 |
up a goal stating the type arities claimed at the opening \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}}. The proof would usually proceed by \hyperlink{method.intro-classes}{\mbox{\isa{intro{\isaliteral{5F}{\isacharunderscore}}classes}}}, and then establish the characteristic theorems of |
27042 | 698 |
the type classes involved. After finishing the proof, the |
699 |
background theory will be augmented by the proven type arities. |
|
700 |
||
40406 | 701 |
On the theory level, \hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}t\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ s\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{29}{\isacharparenright}}s{\isaliteral{22}{\isachardoublequote}}} provides a convenient way to instantiate a type class with no |
37115 | 702 |
need to specify operations: one can continue with the |
31681 | 703 |
instantiation proof immediately. |
704 |
||
28788 | 705 |
\item \hyperlink{command.subclass}{\mbox{\isa{\isacommand{subclass}}}}~\isa{c} in a class context for class |
27042 | 706 |
\isa{d} sets up a goal stating that class \isa{c} is logically |
707 |
contained in class \isa{d}. After finishing the proof, class |
|
708 |
\isa{d} is proven to be subclass \isa{c} and the locale \isa{c} is interpreted into \isa{d} simultaneously. |
|
709 |
||
31681 | 710 |
A weakend form of this is available through a further variant of |
40406 | 711 |
\hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}}: \hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{22}{\isachardoublequote}}} opens |
712 |
a proof that class \isa{{\isaliteral{22}{\isachardoublequote}}c\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}{\isaliteral{22}{\isachardoublequote}}} implies \isa{{\isaliteral{22}{\isachardoublequote}}c\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}} without reference |
|
31681 | 713 |
to the underlying locales; this is useful if the properties to prove |
714 |
the logical connection are not sufficent on the locale level but on |
|
715 |
the theory level. |
|
716 |
||
40406 | 717 |
\item \hyperlink{command.print-classes}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}classes}}}} prints all classes in the current |
27042 | 718 |
theory. |
719 |
||
40406 | 720 |
\item \hyperlink{command.class-deps}{\mbox{\isa{\isacommand{class{\isaliteral{5F}{\isacharunderscore}}deps}}}} visualizes all classes and their |
29706 | 721 |
subclass relations as a Hasse diagram. |
722 |
||
40406 | 723 |
\item \hyperlink{method.intro-classes}{\mbox{\isa{intro{\isaliteral{5F}{\isacharunderscore}}classes}}} repeatedly expands all class |
27042 | 724 |
introduction rules of this theory. Note that this method usually |
725 |
needs not be named explicitly, as it is already included in the |
|
726 |
default proof step (e.g.\ of \hyperlink{command.proof}{\mbox{\isa{\isacommand{proof}}}}). In particular, |
|
727 |
instantiation of trivial (syntactic) classes may be performed by a |
|
40406 | 728 |
single ``\hyperlink{command.ddot}{\mbox{\isa{\isacommand{{\isaliteral{2E}{\isachardot}}{\isaliteral{2E}{\isachardot}}}}}}'' proof step. |
26870 | 729 |
|
28788 | 730 |
\end{description}% |
26870 | 731 |
\end{isamarkuptext}% |
732 |
\isamarkuptrue% |
|
733 |
% |
|
27042 | 734 |
\isamarkupsubsection{The class target% |
735 |
} |
|
736 |
\isamarkuptrue% |
|
737 |
% |
|
738 |
\begin{isamarkuptext}% |
|
739 |
%FIXME check |
|
740 |
||
741 |
A named context may refer to a locale (cf.\ \secref{sec:target}). |
|
742 |
If this locale is also a class \isa{c}, apart from the common |
|
743 |
locale target behaviour the following happens. |
|
744 |
||
745 |
\begin{itemize} |
|
746 |
||
40406 | 747 |
\item Local constant declarations \isa{{\isaliteral{22}{\isachardoublequote}}g{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} referring to the |
748 |
local type parameter \isa{{\isaliteral{5C3C616C7068613E}{\isasymalpha}}} and local parameters \isa{{\isaliteral{22}{\isachardoublequote}}f{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} |
|
749 |
are accompanied by theory-level constants \isa{{\isaliteral{22}{\isachardoublequote}}g{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{3F}{\isacharquery}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ c{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} |
|
750 |
referring to theory-level class operations \isa{{\isaliteral{22}{\isachardoublequote}}f{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{3F}{\isacharquery}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ c{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}}. |
|
27042 | 751 |
|
752 |
\item Local theorem bindings are lifted as are assumptions. |
|
753 |
||
40406 | 754 |
\item Local syntax refers to local operations \isa{{\isaliteral{22}{\isachardoublequote}}g{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} and |
755 |
global operations \isa{{\isaliteral{22}{\isachardoublequote}}g{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{3F}{\isacharquery}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ c{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} uniformly. Type inference |
|
27042 | 756 |
resolves ambiguities. In rare cases, manual type annotations are |
757 |
needed. |
|
758 |
||
759 |
\end{itemize}% |
|
760 |
\end{isamarkuptext}% |
|
761 |
\isamarkuptrue% |
|
762 |
% |
|
37768
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
763 |
\isamarkupsubsection{Co-regularity of type classes and arities% |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
764 |
} |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
765 |
\isamarkuptrue% |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
766 |
% |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
767 |
\begin{isamarkuptext}% |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
768 |
The class relation together with the collection of |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
769 |
type-constructor arities must obey the principle of |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
770 |
\emph{co-regularity} as defined below. |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
771 |
|
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
772 |
\medskip For the subsequent formulation of co-regularity we assume |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
773 |
that the class relation is closed by transitivity and reflexivity. |
40406 | 774 |
Moreover the collection of arities \isa{{\isaliteral{22}{\isachardoublequote}}t\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7665633E}{}\isactrlvec s{\isaliteral{29}{\isacharparenright}}c{\isaliteral{22}{\isachardoublequote}}} is |
775 |
completed such that \isa{{\isaliteral{22}{\isachardoublequote}}t\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7665633E}{}\isactrlvec s{\isaliteral{29}{\isacharparenright}}c{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ c{\isaliteral{27}{\isacharprime}}{\isaliteral{22}{\isachardoublequote}}} |
|
776 |
implies \isa{{\isaliteral{22}{\isachardoublequote}}t\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7665633E}{}\isactrlvec s{\isaliteral{29}{\isacharparenright}}c{\isaliteral{27}{\isacharprime}}{\isaliteral{22}{\isachardoublequote}}} for all such declarations. |
|
37768
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
777 |
|
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
778 |
Treating sorts as finite sets of classes (meaning the intersection), |
40406 | 779 |
the class relation \isa{{\isaliteral{22}{\isachardoublequote}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{22}{\isachardoublequote}}} is extended to sorts as |
37768
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
780 |
follows: |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
781 |
\[ |
40406 | 782 |
\isa{{\isaliteral{22}{\isachardoublequote}}s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}\ {\isaliteral{5C3C696E3E}{\isasymin}}\ s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{2E}{\isachardot}}\ {\isaliteral{5C3C6578697374733E}{\isasymexists}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C696E3E}{\isasymin}}\ s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2E}{\isachardot}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{22}{\isachardoublequote}}} |
37768
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
783 |
\] |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
784 |
|
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
785 |
This relation on sorts is further extended to tuples of sorts (of |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
786 |
the same length) in the component-wise way. |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
787 |
|
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
788 |
\smallskip Co-regularity of the class relation together with the |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
789 |
arities relation means: |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
790 |
\[ |
40406 | 791 |
\isa{{\isaliteral{22}{\isachardoublequote}}t\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7665633E}{}\isactrlvec s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{29}{\isacharparenright}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ t\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7665633E}{}\isactrlvec s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{29}{\isacharparenright}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ \isaliteral{5C3C5E7665633E}{}\isactrlvec s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{22}{\isachardoublequote}}} |
37768
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
792 |
\] |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
793 |
\noindent for all such arities. In other words, whenever the result |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
794 |
classes of some type-constructor arities are related, then the |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
795 |
argument sorts need to be related in the same way. |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
796 |
|
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
797 |
\medskip Co-regularity is a very fundamental property of the |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
798 |
order-sorted algebra of types. For example, it entails principle |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
799 |
types and most general unifiers, e.g.\ see \cite{nipkow-prehofer}.% |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
800 |
\end{isamarkuptext}% |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
801 |
\isamarkuptrue% |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
802 |
% |
27042 | 803 |
\isamarkupsection{Unrestricted overloading% |
804 |
} |
|
805 |
\isamarkuptrue% |
|
806 |
% |
|
807 |
\begin{isamarkuptext}% |
|
808 |
Isabelle/Pure's definitional schemes support certain forms of |
|
31047 | 809 |
overloading (see \secref{sec:consts}). Overloading means that a |
40406 | 810 |
constant being declared as \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ decl{\isaliteral{22}{\isachardoublequote}}} may be |
31047 | 811 |
defined separately on type instances |
40406 | 812 |
\isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C626574613E}{\isasymbeta}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C626574613E}{\isasymbeta}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{29}{\isacharparenright}}\ t\ decl{\isaliteral{22}{\isachardoublequote}}} |
31047 | 813 |
for each type constructor \isa{t}. At most occassions |
27042 | 814 |
overloading will be used in a Haskell-like fashion together with |
815 |
type classes by means of \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}} (see |
|
816 |
\secref{sec:class}). Sometimes low-level overloading is desirable. |
|
817 |
The \hyperlink{command.overloading}{\mbox{\isa{\isacommand{overloading}}}} target provides a convenient view for |
|
818 |
end-users. |
|
819 |
||
820 |
\begin{matharray}{rcl} |
|
40406 | 821 |
\indexdef{}{command}{overloading}\hypertarget{command.overloading}{\hyperlink{command.overloading}{\mbox{\isa{\isacommand{overloading}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
27042 | 822 |
\end{matharray} |
823 |
||
824 |
\begin{rail} |
|
825 |
'overloading' \\ |
|
826 |
( string ( '==' | equiv ) term ( '(' 'unchecked' ')' )? + ) 'begin' |
|
827 |
\end{rail} |
|
828 |
||
28788 | 829 |
\begin{description} |
27042 | 830 |
|
40406 | 831 |
\item \hyperlink{command.overloading}{\mbox{\isa{\isacommand{overloading}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C414E443E}{\isasymAND}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ {\isaliteral{5C3C424547494E3E}{\isasymBEGIN}}{\isaliteral{22}{\isachardoublequote}}} |
27042 | 832 |
opens a theory target (cf.\ \secref{sec:target}) which allows to |
833 |
specify constants with overloaded definitions. These are identified |
|
40406 | 834 |
by an explicitly given mapping from variable names \isa{{\isaliteral{22}{\isachardoublequote}}x\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}} to |
835 |
constants \isa{{\isaliteral{22}{\isachardoublequote}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}} at particular type instances. The |
|
28788 | 836 |
definitions themselves are established using common specification |
40406 | 837 |
tools, using the names \isa{{\isaliteral{22}{\isachardoublequote}}x\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}} as reference to the |
28788 | 838 |
corresponding constants. The target is concluded by \hyperlink{command.local.end}{\mbox{\isa{\isacommand{end}}}}. |
27042 | 839 |
|
40406 | 840 |
A \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}unchecked{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} option disables global dependency checks for |
27042 | 841 |
the corresponding definition, which is occasionally useful for |
31047 | 842 |
exotic overloading (see \secref{sec:consts} for a precise description). |
843 |
It is at the discretion of the user to avoid |
|
27042 | 844 |
malformed theory specifications! |
845 |
||
28788 | 846 |
\end{description}% |
27042 | 847 |
\end{isamarkuptext}% |
848 |
\isamarkuptrue% |
|
849 |
% |
|
850 |
\isamarkupsection{Incorporating ML code \label{sec:ML}% |
|
851 |
} |
|
852 |
\isamarkuptrue% |
|
853 |
% |
|
854 |
\begin{isamarkuptext}% |
|
855 |
\begin{matharray}{rcl} |
|
40406 | 856 |
\indexdef{}{command}{use}\hypertarget{command.use}{\hyperlink{command.use}{\mbox{\isa{\isacommand{use}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
857 |
\indexdef{}{command}{ML}\hypertarget{command.ML}{\hyperlink{command.ML}{\mbox{\isa{\isacommand{ML}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
858 |
\indexdef{}{command}{ML\_prf}\hypertarget{command.ML-prf}{\hyperlink{command.ML-prf}{\mbox{\isa{\isacommand{ML{\isaliteral{5F}{\isacharunderscore}}prf}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}proof\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{22}{\isachardoublequote}}} \\ |
|
859 |
\indexdef{}{command}{ML\_val}\hypertarget{command.ML-val}{\hyperlink{command.ML-val}{\mbox{\isa{\isacommand{ML{\isaliteral{5F}{\isacharunderscore}}val}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}any\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
860 |
\indexdef{}{command}{ML\_command}\hypertarget{command.ML-command}{\hyperlink{command.ML-command}{\mbox{\isa{\isacommand{ML{\isaliteral{5F}{\isacharunderscore}}command}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}any\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\ |
|
861 |
\indexdef{}{command}{setup}\hypertarget{command.setup}{\hyperlink{command.setup}{\mbox{\isa{\isacommand{setup}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
862 |
\indexdef{}{command}{local\_setup}\hypertarget{command.local-setup}{\hyperlink{command.local-setup}{\mbox{\isa{\isacommand{local{\isaliteral{5F}{\isacharunderscore}}setup}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
863 |
\indexdef{}{command}{attribute\_setup}\hypertarget{command.attribute-setup}{\hyperlink{command.attribute-setup}{\mbox{\isa{\isacommand{attribute{\isaliteral{5F}{\isacharunderscore}}setup}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
27042 | 864 |
\end{matharray} |
865 |
||
866 |
\begin{rail} |
|
867 |
'use' name |
|
868 |
; |
|
40255
9ffbc25e1606
eliminated obsolete \_ escapes in rail environments;
wenzelm
parents:
40240
diff
changeset
|
869 |
('ML' | 'ML_prf' | 'ML_val' | 'ML_command' | 'setup' | 'local_setup') text |
27042 | 870 |
; |
40255
9ffbc25e1606
eliminated obsolete \_ escapes in rail environments;
wenzelm
parents:
40240
diff
changeset
|
871 |
'attribute_setup' name '=' text text |
30527 | 872 |
; |
27042 | 873 |
\end{rail} |
874 |
||
28788 | 875 |
\begin{description} |
27042 | 876 |
|
40406 | 877 |
\item \hyperlink{command.use}{\mbox{\isa{\isacommand{use}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}file{\isaliteral{22}{\isachardoublequote}}} reads and executes ML |
878 |
commands from \isa{{\isaliteral{22}{\isachardoublequote}}file{\isaliteral{22}{\isachardoublequote}}}. The current theory context is passed |
|
28788 | 879 |
down to the ML toplevel and may be modified, using \verb|Context.>>| or derived ML commands. The file name is checked with |
27042 | 880 |
the \indexref{}{keyword}{uses}\hyperlink{keyword.uses}{\mbox{\isa{\isakeyword{uses}}}} dependency declaration given in the theory |
881 |
header (see also \secref{sec:begin-thy}). |
|
28281 | 882 |
|
883 |
Top-level ML bindings are stored within the (global or local) theory |
|
884 |
context. |
|
27042 | 885 |
|
40406 | 886 |
\item \hyperlink{command.ML}{\mbox{\isa{\isacommand{ML}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}text{\isaliteral{22}{\isachardoublequote}}} is similar to \hyperlink{command.use}{\mbox{\isa{\isacommand{use}}}}, |
887 |
but executes ML commands directly from the given \isa{{\isaliteral{22}{\isachardoublequote}}text{\isaliteral{22}{\isachardoublequote}}}. |
|
28788 | 888 |
Top-level ML bindings are stored within the (global or local) theory |
889 |
context. |
|
28281 | 890 |
|
40406 | 891 |
\item \hyperlink{command.ML-prf}{\mbox{\isa{\isacommand{ML{\isaliteral{5F}{\isacharunderscore}}prf}}}} is analogous to \hyperlink{command.ML}{\mbox{\isa{\isacommand{ML}}}} but works |
28788 | 892 |
within a proof context. |
28281 | 893 |
|
894 |
Top-level ML bindings are stored within the proof context in a |
|
895 |
purely sequential fashion, disregarding the nested proof structure. |
|
40406 | 896 |
ML bindings introduced by \hyperlink{command.ML-prf}{\mbox{\isa{\isacommand{ML{\isaliteral{5F}{\isacharunderscore}}prf}}}} are discarded at the |
28281 | 897 |
end of the proof. |
27042 | 898 |
|
40406 | 899 |
\item \hyperlink{command.ML-val}{\mbox{\isa{\isacommand{ML{\isaliteral{5F}{\isacharunderscore}}val}}}} and \hyperlink{command.ML-command}{\mbox{\isa{\isacommand{ML{\isaliteral{5F}{\isacharunderscore}}command}}}} are diagnostic |
28788 | 900 |
versions of \hyperlink{command.ML}{\mbox{\isa{\isacommand{ML}}}}, which means that the context may not be |
40406 | 901 |
updated. \hyperlink{command.ML-val}{\mbox{\isa{\isacommand{ML{\isaliteral{5F}{\isacharunderscore}}val}}}} echos the bindings produced at the ML |
902 |
toplevel, but \hyperlink{command.ML-command}{\mbox{\isa{\isacommand{ML{\isaliteral{5F}{\isacharunderscore}}command}}}} is silent. |
|
27042 | 903 |
|
40406 | 904 |
\item \hyperlink{command.setup}{\mbox{\isa{\isacommand{setup}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}text{\isaliteral{22}{\isachardoublequote}}} changes the current theory |
905 |
context by applying \isa{{\isaliteral{22}{\isachardoublequote}}text{\isaliteral{22}{\isachardoublequote}}}, which refers to an ML expression |
|
30463 | 906 |
of type \verb|theory -> theory|. This enables to initialize |
907 |
any object-logic specific tools and packages written in ML, for |
|
908 |
example. |
|
909 |
||
40406 | 910 |
\item \hyperlink{command.local-setup}{\mbox{\isa{\isacommand{local{\isaliteral{5F}{\isacharunderscore}}setup}}}} is similar to \hyperlink{command.setup}{\mbox{\isa{\isacommand{setup}}}} for |
30463 | 911 |
a local theory context, and an ML expression of type \verb|local_theory -> local_theory|. This allows to |
912 |
invoke local theory specification packages without going through |
|
913 |
concrete outer syntax, for example. |
|
27042 | 914 |
|
40406 | 915 |
\item \hyperlink{command.attribute-setup}{\mbox{\isa{\isacommand{attribute{\isaliteral{5F}{\isacharunderscore}}setup}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}name\ {\isaliteral{3D}{\isacharequal}}\ text\ description{\isaliteral{22}{\isachardoublequote}}} |
916 |
defines an attribute in the current theory. The given \isa{{\isaliteral{22}{\isachardoublequote}}text{\isaliteral{22}{\isachardoublequote}}} has to be an ML expression of type |
|
30527 | 917 |
\verb|attribute context_parser|, cf.\ basic parsers defined in |
918 |
structure \verb|Args| and \verb|Attrib|. |
|
919 |
||
920 |
In principle, attributes can operate both on a given theorem and the |
|
921 |
implicit context, although in practice only one is modified and the |
|
922 |
other serves as parameter. Here are examples for these two cases: |
|
923 |
||
924 |
\end{description}% |
|
925 |
\end{isamarkuptext}% |
|
926 |
\isamarkuptrue% |
|
927 |
% |
|
928 |
\isadelimML |
|
929 |
\ \ \ \ % |
|
930 |
\endisadelimML |
|
931 |
% |
|
932 |
\isatagML |
|
40406 | 933 |
\isacommand{attribute{\isaliteral{5F}{\isacharunderscore}}setup}\isamarkupfalse% |
934 |
\ my{\isaliteral{5F}{\isacharunderscore}}rule\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{7B2A}{\isacharverbatimopen}}\isanewline |
|
935 |
\ \ \ \ \ \ Attrib{\isaliteral{2E}{\isachardot}}thms\ {\isaliteral{3E}{\isachargreater}}{\isaliteral{3E}{\isachargreater}}\ {\isaliteral{28}{\isacharparenleft}}fn\ ths\ {\isaliteral{3D}{\isacharequal}}{\isaliteral{3E}{\isachargreater}}\isanewline |
|
936 |
\ \ \ \ \ \ \ \ Thm{\isaliteral{2E}{\isachardot}}rule{\isaliteral{5F}{\isacharunderscore}}attribute\ {\isaliteral{28}{\isacharparenleft}}fn\ context{\isaliteral{3A}{\isacharcolon}}\ Context{\isaliteral{2E}{\isachardot}}generic\ {\isaliteral{3D}{\isacharequal}}{\isaliteral{3E}{\isachargreater}}\ fn\ th{\isaliteral{3A}{\isacharcolon}}\ thm\ {\isaliteral{3D}{\isacharequal}}{\isaliteral{3E}{\isachargreater}}\isanewline |
|
937 |
\ \ \ \ \ \ \ \ \ \ let\ val\ th{\isaliteral{27}{\isacharprime}}\ {\isaliteral{3D}{\isacharequal}}\ th\ OF\ ths\isanewline |
|
938 |
\ \ \ \ \ \ \ \ \ \ in\ th{\isaliteral{27}{\isacharprime}}\ end{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{2A7D}{\isacharverbatimclose}}\ \ {\isaliteral{22}{\isachardoublequoteopen}}my\ rule{\isaliteral{22}{\isachardoublequoteclose}}\isanewline |
|
30527 | 939 |
\isanewline |
40406 | 940 |
\ \ \ \ \isacommand{attribute{\isaliteral{5F}{\isacharunderscore}}setup}\isamarkupfalse% |
941 |
\ my{\isaliteral{5F}{\isacharunderscore}}declaration\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{7B2A}{\isacharverbatimopen}}\isanewline |
|
942 |
\ \ \ \ \ \ Attrib{\isaliteral{2E}{\isachardot}}thms\ {\isaliteral{3E}{\isachargreater}}{\isaliteral{3E}{\isachargreater}}\ {\isaliteral{28}{\isacharparenleft}}fn\ ths\ {\isaliteral{3D}{\isacharequal}}{\isaliteral{3E}{\isachargreater}}\isanewline |
|
943 |
\ \ \ \ \ \ \ \ Thm{\isaliteral{2E}{\isachardot}}declaration{\isaliteral{5F}{\isacharunderscore}}attribute\ {\isaliteral{28}{\isacharparenleft}}fn\ th{\isaliteral{3A}{\isacharcolon}}\ thm\ {\isaliteral{3D}{\isacharequal}}{\isaliteral{3E}{\isachargreater}}\ fn\ context{\isaliteral{3A}{\isacharcolon}}\ Context{\isaliteral{2E}{\isachardot}}generic\ {\isaliteral{3D}{\isacharequal}}{\isaliteral{3E}{\isachargreater}}\isanewline |
|
944 |
\ \ \ \ \ \ \ \ \ \ let\ val\ context{\isaliteral{27}{\isacharprime}}\ {\isaliteral{3D}{\isacharequal}}\ context\isanewline |
|
945 |
\ \ \ \ \ \ \ \ \ \ in\ context{\isaliteral{27}{\isacharprime}}\ end{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{2A7D}{\isacharverbatimclose}}\ \ {\isaliteral{22}{\isachardoublequoteopen}}my\ declaration{\isaliteral{22}{\isachardoublequoteclose}}% |
|
30527 | 946 |
\endisatagML |
947 |
{\isafoldML}% |
|
948 |
% |
|
949 |
\isadelimML |
|
950 |
% |
|
951 |
\endisadelimML |
|
952 |
% |
|
27042 | 953 |
\isamarkupsection{Primitive specification elements% |
954 |
} |
|
955 |
\isamarkuptrue% |
|
956 |
% |
|
957 |
\isamarkupsubsection{Type classes and sorts \label{sec:classes}% |
|
958 |
} |
|
959 |
\isamarkuptrue% |
|
960 |
% |
|
961 |
\begin{isamarkuptext}% |
|
962 |
\begin{matharray}{rcll} |
|
40406 | 963 |
\indexdef{}{command}{classes}\hypertarget{command.classes}{\hyperlink{command.classes}{\mbox{\isa{\isacommand{classes}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\ |
964 |
\indexdef{}{command}{classrel}\hypertarget{command.classrel}{\hyperlink{command.classrel}{\mbox{\isa{\isacommand{classrel}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} & (axiomatic!) \\ |
|
965 |
\indexdef{}{command}{default\_sort}\hypertarget{command.default-sort}{\hyperlink{command.default-sort}{\mbox{\isa{\isacommand{default{\isaliteral{5F}{\isacharunderscore}}sort}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} |
|
27042 | 966 |
\end{matharray} |
967 |
||
968 |
\begin{rail} |
|
969 |
'classes' (classdecl +) |
|
970 |
; |
|
971 |
'classrel' (nameref ('<' | subseteq) nameref + 'and') |
|
972 |
; |
|
40255
9ffbc25e1606
eliminated obsolete \_ escapes in rail environments;
wenzelm
parents:
40240
diff
changeset
|
973 |
'default_sort' sort |
27042 | 974 |
; |
975 |
\end{rail} |
|
976 |
||
28788 | 977 |
\begin{description} |
27042 | 978 |
|
40406 | 979 |
\item \hyperlink{command.classes}{\mbox{\isa{\isacommand{classes}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} declares class |
980 |
\isa{c} to be a subclass of existing classes \isa{{\isaliteral{22}{\isachardoublequote}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}}. |
|
28788 | 981 |
Isabelle implicitly maintains the transitive closure of the class |
982 |
hierarchy. Cyclic class structures are not permitted. |
|
983 |
||
40406 | 984 |
\item \hyperlink{command.classrel}{\mbox{\isa{\isacommand{classrel}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{22}{\isachardoublequote}}} states subclass |
985 |
relations between existing classes \isa{{\isaliteral{22}{\isachardoublequote}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}c\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{22}{\isachardoublequote}}}. |
|
37768
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
986 |
This is done axiomatically! The \indexref{}{command}{subclass}\hyperlink{command.subclass}{\mbox{\isa{\isacommand{subclass}}}} and |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
987 |
\indexref{}{command}{instance}\hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}} commands (see \secref{sec:class}) provide |
e86221f3bac7
moved co-regularity to class section; avoid duplicated class_deps
haftmann
parents:
37115
diff
changeset
|
988 |
a way to introduce proven class relations. |
27042 | 989 |
|
40406 | 990 |
\item \hyperlink{command.default-sort}{\mbox{\isa{\isacommand{default{\isaliteral{5F}{\isacharunderscore}}sort}}}}~\isa{s} makes sort \isa{s} the |
28788 | 991 |
new default sort for any type variable that is given explicitly in |
992 |
the text, but lacks a sort constraint (wrt.\ the current context). |
|
993 |
Type variables generated by type inference are not affected. |
|
27042 | 994 |
|
28788 | 995 |
Usually the default sort is only changed when defining a new |
996 |
object-logic. For example, the default sort in Isabelle/HOL is |
|
39831 | 997 |
\isa{type}, the class of all HOL types. |
27042 | 998 |
|
28788 | 999 |
When merging theories, the default sorts of the parents are |
1000 |
logically intersected, i.e.\ the representations as lists of classes |
|
1001 |
are joined. |
|
1002 |
||
1003 |
\end{description}% |
|
27042 | 1004 |
\end{isamarkuptext}% |
1005 |
\isamarkuptrue% |
|
1006 |
% |
|
1007 |
\isamarkupsubsection{Types and type abbreviations \label{sec:types-pure}% |
|
1008 |
} |
|
1009 |
\isamarkuptrue% |
|
1010 |
% |
|
1011 |
\begin{isamarkuptext}% |
|
1012 |
\begin{matharray}{rcll} |
|
40406 | 1013 |
\indexdef{}{command}{types}\hypertarget{command.types}{\hyperlink{command.types}{\mbox{\isa{\isacommand{types}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
1014 |
\indexdef{}{command}{typedecl}\hypertarget{command.typedecl}{\hyperlink{command.typedecl}{\mbox{\isa{\isacommand{typedecl}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1015 |
\indexdef{}{command}{arities}\hypertarget{command.arities}{\hyperlink{command.arities}{\mbox{\isa{\isacommand{arities}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} & (axiomatic!) \\ |
|
27042 | 1016 |
\end{matharray} |
1017 |
||
1018 |
\begin{rail} |
|
35351
7425aece4ee3
allow general mixfix syntax for type constructors;
wenzelm
parents:
35282
diff
changeset
|
1019 |
'types' (typespec '=' type mixfix? +) |
27042 | 1020 |
; |
35351
7425aece4ee3
allow general mixfix syntax for type constructors;
wenzelm
parents:
35282
diff
changeset
|
1021 |
'typedecl' typespec mixfix? |
27042 | 1022 |
; |
1023 |
'arities' (nameref '::' arity +) |
|
1024 |
; |
|
1025 |
\end{rail} |
|
1026 |
||
28788 | 1027 |
\begin{description} |
27042 | 1028 |
|
40406 | 1029 |
\item \hyperlink{command.types}{\mbox{\isa{\isacommand{types}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{29}{\isacharparenright}}\ t\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} introduces a |
1030 |
\emph{type synonym} \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{29}{\isacharparenright}}\ t{\isaliteral{22}{\isachardoublequote}}} for the existing type |
|
1031 |
\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}}. Unlike actual type definitions, as are available in |
|
28788 | 1032 |
Isabelle/HOL for example, type synonyms are merely syntactic |
1033 |
abbreviations without any logical significance. Internally, type |
|
1034 |
synonyms are fully expanded. |
|
27042 | 1035 |
|
40406 | 1036 |
\item \hyperlink{command.typedecl}{\mbox{\isa{\isacommand{typedecl}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{29}{\isacharparenright}}\ t{\isaliteral{22}{\isachardoublequote}}} declares a new |
28788 | 1037 |
type constructor \isa{t}. If the object-logic defines a base sort |
1038 |
\isa{s}, then the constructor is declared to operate on that, via |
|
40406 | 1039 |
the axiomatic specification \hyperlink{command.arities}{\mbox{\isa{\isacommand{arities}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}t\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}s{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ s{\isaliteral{29}{\isacharparenright}}s{\isaliteral{22}{\isachardoublequote}}}. |
28788 | 1040 |
|
40406 | 1041 |
\item \hyperlink{command.arities}{\mbox{\isa{\isacommand{arities}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}t\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}s\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ s\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{29}{\isacharparenright}}s{\isaliteral{22}{\isachardoublequote}}} augments |
28788 | 1042 |
Isabelle's order-sorted signature of types by new type constructor |
35282
8fd9d555d04d
dropped references to old axclass from documentation
haftmann
parents:
33868
diff
changeset
|
1043 |
arities. This is done axiomatically! The \indexref{}{command}{instantiation}\hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}} |
8fd9d555d04d
dropped references to old axclass from documentation
haftmann
parents:
33868
diff
changeset
|
1044 |
target (see \secref{sec:class}) provides a way to introduce |
28788 | 1045 |
proven type arities. |
1046 |
||
1047 |
\end{description}% |
|
1048 |
\end{isamarkuptext}% |
|
1049 |
\isamarkuptrue% |
|
1050 |
% |
|
27042 | 1051 |
\isamarkupsubsection{Constants and definitions \label{sec:consts}% |
1052 |
} |
|
1053 |
\isamarkuptrue% |
|
1054 |
% |
|
1055 |
\begin{isamarkuptext}% |
|
1056 |
Definitions essentially express abbreviations within the logic. The |
|
40406 | 1057 |
simplest form of a definition is \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7369676D613E}{\isasymsigma}}\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ t{\isaliteral{22}{\isachardoublequote}}}, where \isa{c} is a newly declared constant. Isabelle also allows derived forms |
27042 | 1058 |
where the arguments of \isa{c} appear on the left, abbreviating a |
40406 | 1059 |
prefix of \isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}}-abstractions, e.g.\ \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\ y{\isaliteral{2E}{\isachardot}}\ t{\isaliteral{22}{\isachardoublequote}}} may be |
1060 |
written more conveniently as \isa{{\isaliteral{22}{\isachardoublequote}}c\ x\ y\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ t{\isaliteral{22}{\isachardoublequote}}}. Moreover, |
|
27042 | 1061 |
definitions may be weakened by adding arbitrary pre-conditions: |
40406 | 1062 |
\isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ c\ x\ y\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ t{\isaliteral{22}{\isachardoublequote}}}. |
27042 | 1063 |
|
1064 |
\medskip The built-in well-formedness conditions for definitional |
|
1065 |
specifications are: |
|
1066 |
||
1067 |
\begin{itemize} |
|
1068 |
||
1069 |
\item Arguments (on the left-hand side) must be distinct variables. |
|
1070 |
||
1071 |
\item All variables on the right-hand side must also appear on the |
|
1072 |
left-hand side. |
|
1073 |
||
1074 |
\item All type variables on the right-hand side must also appear on |
|
40406 | 1075 |
the left-hand side; this prohibits \isa{{\isaliteral{22}{\isachardoublequote}}{\isadigit{0}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ length\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ list{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} for example. |
27042 | 1076 |
|
1077 |
\item The definition must not be recursive. Most object-logics |
|
1078 |
provide definitional principles that can be used to express |
|
1079 |
recursion safely. |
|
1080 |
||
1081 |
\end{itemize} |
|
1082 |
||
31047 | 1083 |
The right-hand side of overloaded definitions may mention overloaded constants |
27042 | 1084 |
recursively at type instances corresponding to the immediate |
40406 | 1085 |
argument types \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C626574613E}{\isasymbeta}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C626574613E}{\isasymbeta}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}}. Incomplete |
27042 | 1086 |
specification patterns impose global constraints on all occurrences, |
40406 | 1087 |
e.g.\ \isa{{\isaliteral{22}{\isachardoublequote}}d\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{5C3C74696D65733E}{\isasymtimes}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{22}{\isachardoublequote}}} on the left-hand side means that all |
27042 | 1088 |
corresponding occurrences on some right-hand side need to be an |
40406 | 1089 |
instance of this, general \isa{{\isaliteral{22}{\isachardoublequote}}d\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{5C3C74696D65733E}{\isasymtimes}}\ {\isaliteral{5C3C626574613E}{\isasymbeta}}{\isaliteral{22}{\isachardoublequote}}} will be disallowed. |
27042 | 1090 |
|
1091 |
\begin{matharray}{rcl} |
|
40406 | 1092 |
\indexdef{}{command}{consts}\hypertarget{command.consts}{\hyperlink{command.consts}{\mbox{\isa{\isacommand{consts}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\ |
1093 |
\indexdef{}{command}{defs}\hypertarget{command.defs}{\hyperlink{command.defs}{\mbox{\isa{\isacommand{defs}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
27042 | 1094 |
\end{matharray} |
1095 |
||
1096 |
\begin{rail} |
|
1097 |
'consts' ((name '::' type mixfix?) +) |
|
1098 |
; |
|
1099 |
'defs' ('(' 'unchecked'? 'overloaded'? ')')? \\ (axmdecl prop +) |
|
1100 |
; |
|
1101 |
\end{rail} |
|
1102 |
||
28788 | 1103 |
\begin{description} |
27042 | 1104 |
|
40406 | 1105 |
\item \hyperlink{command.consts}{\mbox{\isa{\isacommand{consts}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7369676D613E}{\isasymsigma}}{\isaliteral{22}{\isachardoublequote}}} declares constant \isa{c} to have any instance of type scheme \isa{{\isaliteral{5C3C7369676D613E}{\isasymsigma}}}. The optional |
28788 | 1106 |
mixfix annotations may attach concrete syntax to the constants |
1107 |
declared. |
|
27042 | 1108 |
|
40406 | 1109 |
\item \hyperlink{command.defs}{\mbox{\isa{\isacommand{defs}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}name{\isaliteral{3A}{\isacharcolon}}\ eqn{\isaliteral{22}{\isachardoublequote}}} introduces \isa{eqn} |
27042 | 1110 |
as a definitional axiom for some existing constant. |
1111 |
||
40406 | 1112 |
The \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}unchecked{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} option disables global dependency checks |
27042 | 1113 |
for this definition, which is occasionally useful for exotic |
1114 |
overloading. It is at the discretion of the user to avoid malformed |
|
1115 |
theory specifications! |
|
1116 |
||
40406 | 1117 |
The \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}overloaded{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} option declares definitions to be |
27042 | 1118 |
potentially overloaded. Unless this option is given, a warning |
1119 |
message would be issued for any definitional equation with a more |
|
1120 |
special type than that of the corresponding constant declaration. |
|
1121 |
||
28788 | 1122 |
\end{description}% |
27042 | 1123 |
\end{isamarkuptext}% |
1124 |
\isamarkuptrue% |
|
1125 |
% |
|
1126 |
\isamarkupsection{Axioms and theorems \label{sec:axms-thms}% |
|
1127 |
} |
|
1128 |
\isamarkuptrue% |
|
1129 |
% |
|
1130 |
\begin{isamarkuptext}% |
|
1131 |
\begin{matharray}{rcll} |
|
40406 | 1132 |
\indexdef{}{command}{axioms}\hypertarget{command.axioms}{\hyperlink{command.axioms}{\mbox{\isa{\isacommand{axioms}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} & (axiomatic!) \\ |
1133 |
\indexdef{}{command}{lemmas}\hypertarget{command.lemmas}{\hyperlink{command.lemmas}{\mbox{\isa{\isacommand{lemmas}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1134 |
\indexdef{}{command}{theorems}\hypertarget{command.theorems}{\hyperlink{command.theorems}{\mbox{\isa{\isacommand{theorems}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
27042 | 1135 |
\end{matharray} |
1136 |
||
1137 |
\begin{rail} |
|
1138 |
'axioms' (axmdecl prop +) |
|
1139 |
; |
|
1140 |
('lemmas' | 'theorems') target? (thmdef? thmrefs + 'and') |
|
1141 |
; |
|
1142 |
\end{rail} |
|
1143 |
||
28788 | 1144 |
\begin{description} |
27042 | 1145 |
|
40406 | 1146 |
\item \hyperlink{command.axioms}{\mbox{\isa{\isacommand{axioms}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}a{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7068693E}{\isasymphi}}{\isaliteral{22}{\isachardoublequote}}} introduces arbitrary |
27042 | 1147 |
statements as axioms of the meta-logic. In fact, axioms are |
1148 |
``axiomatic theorems'', and may be referred later just as any other |
|
1149 |
theorem. |
|
1150 |
||
1151 |
Axioms are usually only introduced when declaring new logical |
|
1152 |
systems. Everyday work is typically done the hard way, with proper |
|
1153 |
definitions and proven theorems. |
|
1154 |
||
40406 | 1155 |
\item \hyperlink{command.lemmas}{\mbox{\isa{\isacommand{lemmas}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}a\ {\isaliteral{3D}{\isacharequal}}\ b\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ b\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} retrieves and stores |
28788 | 1156 |
existing facts in the theory context, or the specified target |
1157 |
context (see also \secref{sec:target}). Typical applications would |
|
1158 |
also involve attributes, to declare Simplifier rules, for example. |
|
27042 | 1159 |
|
28788 | 1160 |
\item \hyperlink{command.theorems}{\mbox{\isa{\isacommand{theorems}}}} is essentially the same as \hyperlink{command.lemmas}{\mbox{\isa{\isacommand{lemmas}}}}, but marks the result as a different kind of facts. |
27042 | 1161 |
|
28788 | 1162 |
\end{description}% |
27042 | 1163 |
\end{isamarkuptext}% |
1164 |
\isamarkuptrue% |
|
1165 |
% |
|
1166 |
\isamarkupsection{Oracles% |
|
1167 |
} |
|
1168 |
\isamarkuptrue% |
|
1169 |
% |
|
1170 |
\begin{isamarkuptext}% |
|
28788 | 1171 |
Oracles allow Isabelle to take advantage of external reasoners |
1172 |
such as arithmetic decision procedures, model checkers, fast |
|
1173 |
tautology checkers or computer algebra systems. Invoked as an |
|
1174 |
oracle, an external reasoner can create arbitrary Isabelle theorems. |
|
27042 | 1175 |
|
28788 | 1176 |
It is the responsibility of the user to ensure that the external |
1177 |
reasoner is as trustworthy as the application requires. Another |
|
1178 |
typical source of errors is the linkup between Isabelle and the |
|
1179 |
external tool, not just its concrete implementation, but also the |
|
1180 |
required translation between two different logical environments. |
|
1181 |
||
1182 |
Isabelle merely guarantees well-formedness of the propositions being |
|
1183 |
asserted, and records within the internal derivation object how |
|
1184 |
presumed theorems depend on unproven suppositions. |
|
1185 |
||
40240 | 1186 |
\begin{matharray}{rcll} |
40406 | 1187 |
\indexdef{}{command}{oracle}\hypertarget{command.oracle}{\hyperlink{command.oracle}{\mbox{\isa{\isacommand{oracle}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} & (axiomatic!) \\ |
28788 | 1188 |
\end{matharray} |
27042 | 1189 |
|
1190 |
\begin{rail} |
|
28291 | 1191 |
'oracle' name '=' text |
27042 | 1192 |
; |
1193 |
\end{rail} |
|
1194 |
||
28788 | 1195 |
\begin{description} |
27042 | 1196 |
|
40406 | 1197 |
\item \hyperlink{command.oracle}{\mbox{\isa{\isacommand{oracle}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}name\ {\isaliteral{3D}{\isacharequal}}\ text{\isaliteral{22}{\isachardoublequote}}} turns the given ML |
1198 |
expression \isa{{\isaliteral{22}{\isachardoublequote}}text{\isaliteral{22}{\isachardoublequote}}} of type \verb|'a -> cterm| into an |
|
28291 | 1199 |
ML function of type \verb|'a -> thm|, which is bound to the |
28788 | 1200 |
global identifier \verb|name|. This acts like an infinitary |
1201 |
specification of axioms! Invoking the oracle only works within the |
|
1202 |
scope of the resulting theory. |
|
27042 | 1203 |
|
28788 | 1204 |
\end{description} |
1205 |
||
40802 | 1206 |
See \verb|~~/src/HOL/ex/Iff_Oracle.thy| for a worked example of |
28788 | 1207 |
defining a new primitive rule as oracle, and turning it into a proof |
1208 |
method.% |
|
27042 | 1209 |
\end{isamarkuptext}% |
1210 |
\isamarkuptrue% |
|
1211 |
% |
|
1212 |
\isamarkupsection{Name spaces% |
|
1213 |
} |
|
1214 |
\isamarkuptrue% |
|
1215 |
% |
|
1216 |
\begin{isamarkuptext}% |
|
1217 |
\begin{matharray}{rcl} |
|
40406 | 1218 |
\indexdef{}{command}{hide\_class}\hypertarget{command.hide-class}{\hyperlink{command.hide-class}{\mbox{\isa{\isacommand{hide{\isaliteral{5F}{\isacharunderscore}}class}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\ |
1219 |
\indexdef{}{command}{hide\_type}\hypertarget{command.hide-type}{\hyperlink{command.hide-type}{\mbox{\isa{\isacommand{hide{\isaliteral{5F}{\isacharunderscore}}type}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1220 |
\indexdef{}{command}{hide\_const}\hypertarget{command.hide-const}{\hyperlink{command.hide-const}{\mbox{\isa{\isacommand{hide{\isaliteral{5F}{\isacharunderscore}}const}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
1221 |
\indexdef{}{command}{hide\_fact}\hypertarget{command.hide-fact}{\hyperlink{command.hide-fact}{\mbox{\isa{\isacommand{hide{\isaliteral{5F}{\isacharunderscore}}fact}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\ |
|
27042 | 1222 |
\end{matharray} |
1223 |
||
1224 |
\begin{rail} |
|
40255
9ffbc25e1606
eliminated obsolete \_ escapes in rail environments;
wenzelm
parents:
40240
diff
changeset
|
1225 |
( 'hide_class' | 'hide_type' | 'hide_const' | 'hide_fact' ) ('(open)')? (nameref + ) |
27042 | 1226 |
; |
1227 |
\end{rail} |
|
1228 |
||
1229 |
Isabelle organizes any kind of name declarations (of types, |
|
1230 |
constants, theorems etc.) by separate hierarchically structured name |
|
1231 |
spaces. Normally the user does not have to control the behavior of |
|
1232 |
name spaces by hand, yet the following commands provide some way to |
|
1233 |
do so. |
|
1234 |
||
28788 | 1235 |
\begin{description} |
27042 | 1236 |
|
40406 | 1237 |
\item \hyperlink{command.hide-class}{\mbox{\isa{\isacommand{hide{\isaliteral{5F}{\isacharunderscore}}class}}}}~\isa{names} fully removes class |
1238 |
declarations from a given name space; with the \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}open{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} |
|
39977
c9cbc16e93ce
do not mention unqualified names, now that 'global' and 'local' are gone
krauss
parents:
39280
diff
changeset
|
1239 |
option, only the base name is hidden. |
36177
8e0770d2e499
separate commands 'hide_class', 'hide_type', 'hide_const', 'hide_fact';
wenzelm
parents:
35681
diff
changeset
|
1240 |
|
27042 | 1241 |
Note that hiding name space accesses has no impact on logical |
28788 | 1242 |
declarations --- they remain valid internally. Entities that are no |
27042 | 1243 |
longer accessible to the user are printed with the special qualifier |
40406 | 1244 |
``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3F}{\isacharquery}}{\isaliteral{3F}{\isacharquery}}{\isaliteral{22}{\isachardoublequote}}}'' prefixed to the full internal name. |
27042 | 1245 |
|
40406 | 1246 |
\item \hyperlink{command.hide-type}{\mbox{\isa{\isacommand{hide{\isaliteral{5F}{\isacharunderscore}}type}}}}, \hyperlink{command.hide-const}{\mbox{\isa{\isacommand{hide{\isaliteral{5F}{\isacharunderscore}}const}}}}, and \hyperlink{command.hide-fact}{\mbox{\isa{\isacommand{hide{\isaliteral{5F}{\isacharunderscore}}fact}}}} are similar to \hyperlink{command.hide-class}{\mbox{\isa{\isacommand{hide{\isaliteral{5F}{\isacharunderscore}}class}}}}, but hide types, |
36177
8e0770d2e499
separate commands 'hide_class', 'hide_type', 'hide_const', 'hide_fact';
wenzelm
parents:
35681
diff
changeset
|
1247 |
constants, and facts, respectively. |
8e0770d2e499
separate commands 'hide_class', 'hide_type', 'hide_const', 'hide_fact';
wenzelm
parents:
35681
diff
changeset
|
1248 |
|
28788 | 1249 |
\end{description}% |
27042 | 1250 |
\end{isamarkuptext}% |
1251 |
\isamarkuptrue% |
|
1252 |
% |
|
26869 | 1253 |
\isadelimtheory |
1254 |
% |
|
1255 |
\endisadelimtheory |
|
1256 |
% |
|
1257 |
\isatagtheory |
|
1258 |
\isacommand{end}\isamarkupfalse% |
|
1259 |
% |
|
1260 |
\endisatagtheory |
|
1261 |
{\isafoldtheory}% |
|
1262 |
% |
|
1263 |
\isadelimtheory |
|
1264 |
% |
|
1265 |
\endisadelimtheory |
|
1266 |
\isanewline |
|
1267 |
\end{isabellebody}% |
|
1268 |
%%% Local Variables: |
|
1269 |
%%% mode: latex |
|
1270 |
%%% TeX-master: "root" |
|
1271 |
%%% End: |