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