28447
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
|
3 |
\def\isabellecontext{Further}%
|
|
4 |
%
|
|
5 |
\isadelimtheory
|
|
6 |
%
|
|
7 |
\endisadelimtheory
|
|
8 |
%
|
|
9 |
\isatagtheory
|
|
10 |
\isacommand{theory}\isamarkupfalse%
|
|
11 |
\ Further\isanewline
|
|
12 |
\isakeyword{imports}\ Setup\isanewline
|
|
13 |
\isakeyword{begin}%
|
|
14 |
\endisatagtheory
|
|
15 |
{\isafoldtheory}%
|
|
16 |
%
|
|
17 |
\isadelimtheory
|
|
18 |
%
|
|
19 |
\endisadelimtheory
|
|
20 |
%
|
|
21 |
\isamarkupsection{Further issues \label{sec:further}%
|
|
22 |
}
|
|
23 |
\isamarkuptrue%
|
|
24 |
%
|
|
25 |
\isamarkupsubsection{Further reading%
|
|
26 |
}
|
|
27 |
\isamarkuptrue%
|
|
28 |
%
|
|
29 |
\begin{isamarkuptext}%
|
34155
|
30 |
To dive deeper into the issue of code generation, you should visit
|
|
31 |
the Isabelle/Isar Reference Manual \cite{isabelle-isar-ref}, which
|
28593
|
32 |
contains exhaustive syntax diagrams.%
|
28447
|
33 |
\end{isamarkuptext}%
|
|
34 |
\isamarkuptrue%
|
|
35 |
%
|
37426
|
36 |
\isamarkupsubsection{Locales and interpretation%
|
|
37 |
}
|
|
38 |
\isamarkuptrue%
|
|
39 |
%
|
|
40 |
\begin{isamarkuptext}%
|
|
41 |
A technical issue comes to surface when generating code from
|
|
42 |
specifications stemming from locale interpretation.
|
|
43 |
|
|
44 |
Let us assume a locale specifying a power operation
|
|
45 |
on arbitrary types:%
|
|
46 |
\end{isamarkuptext}%
|
|
47 |
\isamarkuptrue%
|
|
48 |
%
|
|
49 |
\isadelimquote
|
|
50 |
%
|
|
51 |
\endisadelimquote
|
|
52 |
%
|
|
53 |
\isatagquote
|
|
54 |
\isacommand{locale}\isamarkupfalse%
|
|
55 |
\ power\ {\isacharequal}\isanewline
|
|
56 |
\ \ \isakeyword{fixes}\ power\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}b\ {\isasymRightarrow}\ {\isacharprime}b{\isachardoublequoteclose}\isanewline
|
|
57 |
\ \ \isakeyword{assumes}\ power{\isacharunderscore}commute{\isacharcolon}\ {\isachardoublequoteopen}power\ x\ {\isasymcirc}\ power\ y\ {\isacharequal}\ power\ y\ {\isasymcirc}\ power\ x{\isachardoublequoteclose}\isanewline
|
|
58 |
\isakeyword{begin}%
|
|
59 |
\endisatagquote
|
|
60 |
{\isafoldquote}%
|
|
61 |
%
|
|
62 |
\isadelimquote
|
|
63 |
%
|
|
64 |
\endisadelimquote
|
|
65 |
%
|
|
66 |
\begin{isamarkuptext}%
|
|
67 |
\noindent Inside that locale we can lift \isa{power} to exponent lists
|
|
68 |
by means of specification relative to that locale:%
|
|
69 |
\end{isamarkuptext}%
|
|
70 |
\isamarkuptrue%
|
|
71 |
%
|
|
72 |
\isadelimquote
|
|
73 |
%
|
|
74 |
\endisadelimquote
|
|
75 |
%
|
|
76 |
\isatagquote
|
|
77 |
\isacommand{primrec}\isamarkupfalse%
|
|
78 |
\ powers\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}b\ {\isasymRightarrow}\ {\isacharprime}b{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
|
|
79 |
\ \ {\isachardoublequoteopen}powers\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ id{\isachardoublequoteclose}\isanewline
|
|
80 |
{\isacharbar}\ {\isachardoublequoteopen}powers\ {\isacharparenleft}x\ {\isacharhash}\ xs{\isacharparenright}\ {\isacharequal}\ power\ x\ {\isasymcirc}\ powers\ xs{\isachardoublequoteclose}\isanewline
|
|
81 |
\isanewline
|
|
82 |
\isacommand{lemma}\isamarkupfalse%
|
|
83 |
\ powers{\isacharunderscore}append{\isacharcolon}\isanewline
|
|
84 |
\ \ {\isachardoublequoteopen}powers\ {\isacharparenleft}xs\ {\isacharat}\ ys{\isacharparenright}\ {\isacharequal}\ powers\ xs\ {\isasymcirc}\ powers\ ys{\isachardoublequoteclose}\isanewline
|
|
85 |
\ \ \isacommand{by}\isamarkupfalse%
|
|
86 |
\ {\isacharparenleft}induct\ xs{\isacharparenright}\ simp{\isacharunderscore}all\isanewline
|
|
87 |
\isanewline
|
|
88 |
\isacommand{lemma}\isamarkupfalse%
|
|
89 |
\ powers{\isacharunderscore}power{\isacharcolon}\isanewline
|
|
90 |
\ \ {\isachardoublequoteopen}powers\ xs\ {\isasymcirc}\ power\ x\ {\isacharequal}\ power\ x\ {\isasymcirc}\ powers\ xs{\isachardoublequoteclose}\isanewline
|
|
91 |
\ \ \isacommand{by}\isamarkupfalse%
|
|
92 |
\ {\isacharparenleft}induct\ xs{\isacharparenright}\isanewline
|
|
93 |
\ \ \ \ {\isacharparenleft}simp{\isacharunderscore}all\ del{\isacharcolon}\ o{\isacharunderscore}apply\ id{\isacharunderscore}apply\ add{\isacharcolon}\ o{\isacharunderscore}assoc\ {\isacharbrackleft}symmetric{\isacharbrackright}{\isacharcomma}\isanewline
|
|
94 |
\ \ \ \ \ \ simp\ del{\isacharcolon}\ o{\isacharunderscore}apply\ add{\isacharcolon}\ o{\isacharunderscore}assoc\ power{\isacharunderscore}commute{\isacharparenright}\isanewline
|
|
95 |
\isanewline
|
|
96 |
\isacommand{lemma}\isamarkupfalse%
|
|
97 |
\ powers{\isacharunderscore}rev{\isacharcolon}\isanewline
|
|
98 |
\ \ {\isachardoublequoteopen}powers\ {\isacharparenleft}rev\ xs{\isacharparenright}\ {\isacharequal}\ powers\ xs{\isachardoublequoteclose}\isanewline
|
|
99 |
\ \ \ \ \isacommand{by}\isamarkupfalse%
|
|
100 |
\ {\isacharparenleft}induct\ xs{\isacharparenright}\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ powers{\isacharunderscore}append\ powers{\isacharunderscore}power{\isacharparenright}\isanewline
|
|
101 |
\isanewline
|
|
102 |
\isacommand{end}\isamarkupfalse%
|
|
103 |
%
|
|
104 |
\endisatagquote
|
|
105 |
{\isafoldquote}%
|
|
106 |
%
|
|
107 |
\isadelimquote
|
|
108 |
%
|
|
109 |
\endisadelimquote
|
|
110 |
%
|
|
111 |
\begin{isamarkuptext}%
|
|
112 |
After an interpretation of this locale (say, \hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}} \isa{fun{\isacharunderscore}power{\isacharcolon}} \isa{{\isachardoublequote}power\ {\isacharparenleft}{\isasymlambda}n\ {\isacharparenleft}f\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isacharparenright}{\isachardot}\ f\ {\isacharcircum}{\isacharcircum}\ n{\isacharparenright}{\isachardoublequote}}), one would expect to have a constant \isa{fun{\isacharunderscore}power{\isachardot}powers\ {\isacharcolon}{\isacharcolon}\ nat\ list\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isacharparenright}\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a} for which code
|
|
113 |
can be generated. But this not the case: internally, the term
|
|
114 |
\isa{fun{\isacharunderscore}power{\isachardot}powers} is an abbreviation for the foundational
|
|
115 |
term \isa{{\isachardoublequote}power{\isachardot}powers\ {\isacharparenleft}{\isasymlambda}n\ {\isacharparenleft}f\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isacharparenright}{\isachardot}\ f\ {\isacharcircum}{\isacharcircum}\ n{\isacharparenright}{\isachardoublequote}}
|
|
116 |
(see \cite{isabelle-locale} for the details behind).
|
|
117 |
|
|
118 |
Furtunately, with minor effort the desired behaviour can be achieved.
|
|
119 |
First, a dedicated definition of the constant on which the local \isa{powers}
|
|
120 |
after interpretation is supposed to be mapped on:%
|
|
121 |
\end{isamarkuptext}%
|
|
122 |
\isamarkuptrue%
|
|
123 |
%
|
|
124 |
\isadelimquote
|
|
125 |
%
|
|
126 |
\endisadelimquote
|
|
127 |
%
|
|
128 |
\isatagquote
|
|
129 |
\isacommand{definition}\isamarkupfalse%
|
|
130 |
\ funpows\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ list\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isacharparenright}\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
|
|
131 |
\ \ {\isacharbrackleft}code\ del{\isacharbrackright}{\isacharcolon}\ {\isachardoublequoteopen}funpows\ {\isacharequal}\ power{\isachardot}powers\ {\isacharparenleft}{\isasymlambda}n\ f{\isachardot}\ f\ {\isacharcircum}{\isacharcircum}\ n{\isacharparenright}{\isachardoublequoteclose}%
|
|
132 |
\endisatagquote
|
|
133 |
{\isafoldquote}%
|
|
134 |
%
|
|
135 |
\isadelimquote
|
|
136 |
%
|
|
137 |
\endisadelimquote
|
|
138 |
%
|
|
139 |
\begin{isamarkuptext}%
|
|
140 |
\noindent In general, the pattern is \isa{c\ {\isacharequal}\ t} where \isa{c} is
|
|
141 |
the name of the future constant and \isa{t} the foundational term
|
|
142 |
corresponding to the local constant after interpretation.
|
|
143 |
|
|
144 |
The interpretation itself is enriched with an equation \isa{t\ {\isacharequal}\ c}:%
|
|
145 |
\end{isamarkuptext}%
|
|
146 |
\isamarkuptrue%
|
|
147 |
%
|
|
148 |
\isadelimquote
|
|
149 |
%
|
|
150 |
\endisadelimquote
|
|
151 |
%
|
|
152 |
\isatagquote
|
|
153 |
\isacommand{interpretation}\isamarkupfalse%
|
|
154 |
\ fun{\isacharunderscore}power{\isacharcolon}\ power\ {\isachardoublequoteopen}{\isasymlambda}n\ {\isacharparenleft}f\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isacharparenright}{\isachardot}\ f\ {\isacharcircum}{\isacharcircum}\ n{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
|
|
155 |
\ \ {\isachardoublequoteopen}power{\isachardot}powers\ {\isacharparenleft}{\isasymlambda}n\ f{\isachardot}\ f\ {\isacharcircum}{\isacharcircum}\ n{\isacharparenright}\ {\isacharequal}\ funpows{\isachardoublequoteclose}\isanewline
|
|
156 |
\ \ \isacommand{by}\isamarkupfalse%
|
|
157 |
\ unfold{\isacharunderscore}locales\isanewline
|
|
158 |
\ \ \ \ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ expand{\isacharunderscore}fun{\isacharunderscore}eq\ funpow{\isacharunderscore}mult\ mult{\isacharunderscore}commute\ funpows{\isacharunderscore}def{\isacharparenright}%
|
|
159 |
\endisatagquote
|
|
160 |
{\isafoldquote}%
|
|
161 |
%
|
|
162 |
\isadelimquote
|
|
163 |
%
|
|
164 |
\endisadelimquote
|
|
165 |
%
|
|
166 |
\begin{isamarkuptext}%
|
|
167 |
\noindent This additional equation is trivially proved by the definition
|
|
168 |
itself.
|
|
169 |
|
|
170 |
After this setup procedure, code generation can continue as usual:%
|
|
171 |
\end{isamarkuptext}%
|
|
172 |
\isamarkuptrue%
|
|
173 |
%
|
|
174 |
\isadelimquote
|
|
175 |
%
|
|
176 |
\endisadelimquote
|
|
177 |
%
|
|
178 |
\isatagquote
|
|
179 |
%
|
|
180 |
\begin{isamarkuptext}%
|
|
181 |
\isatypewriter%
|
|
182 |
\noindent%
|
|
183 |
\hspace*{0pt}funpow ::~forall a.~Nat -> (a -> a) -> a -> a;\\
|
37432
|
184 |
\hspace*{0pt}funpow Zero{\char95}nat f = id;\\
|
37426
|
185 |
\hspace*{0pt}funpow (Suc n) f = f .~funpow n f;\\
|
|
186 |
\hspace*{0pt}\\
|
|
187 |
\hspace*{0pt}funpows ::~forall a.~[Nat] -> (a -> a) -> a -> a;\\
|
|
188 |
\hspace*{0pt}funpows [] = id;\\
|
|
189 |
\hspace*{0pt}funpows (x :~xs) = funpow x .~funpows xs;%
|
|
190 |
\end{isamarkuptext}%
|
|
191 |
\isamarkuptrue%
|
|
192 |
%
|
|
193 |
\endisatagquote
|
|
194 |
{\isafoldquote}%
|
|
195 |
%
|
|
196 |
\isadelimquote
|
|
197 |
%
|
|
198 |
\endisadelimquote
|
|
199 |
%
|
28447
|
200 |
\isamarkupsubsection{Modules%
|
|
201 |
}
|
|
202 |
\isamarkuptrue%
|
|
203 |
%
|
|
204 |
\begin{isamarkuptext}%
|
|
205 |
When invoking the \hyperlink{command.export-code}{\mbox{\isa{\isacommand{export{\isacharunderscore}code}}}} command it is possible to leave
|
|
206 |
out the \hyperlink{keyword.module-name}{\mbox{\isa{\isakeyword{module{\isacharunderscore}name}}}} part; then code is distributed over
|
|
207 |
different modules, where the module name space roughly is induced
|
28635
|
208 |
by the \isa{Isabelle} theory name space.
|
28447
|
209 |
|
|
210 |
Then sometimes the awkward situation occurs that dependencies between
|
|
211 |
definitions introduce cyclic dependencies between modules, which in the
|
|
212 |
\isa{Haskell} world leaves you to the mercy of the \isa{Haskell} implementation
|
|
213 |
you are using, while for \isa{SML}/\isa{OCaml} code generation is not possible.
|
|
214 |
|
|
215 |
A solution is to declare module names explicitly.
|
|
216 |
Let use assume the three cyclically dependent
|
|
217 |
modules are named \emph{A}, \emph{B} and \emph{C}.
|
|
218 |
Then, by stating%
|
|
219 |
\end{isamarkuptext}%
|
|
220 |
\isamarkuptrue%
|
28593
|
221 |
%
|
|
222 |
\isadelimquote
|
|
223 |
%
|
|
224 |
\endisadelimquote
|
|
225 |
%
|
|
226 |
\isatagquote
|
28447
|
227 |
\isacommand{code{\isacharunderscore}modulename}\isamarkupfalse%
|
|
228 |
\ SML\isanewline
|
|
229 |
\ \ A\ ABC\isanewline
|
|
230 |
\ \ B\ ABC\isanewline
|
|
231 |
\ \ C\ ABC%
|
28593
|
232 |
\endisatagquote
|
|
233 |
{\isafoldquote}%
|
|
234 |
%
|
|
235 |
\isadelimquote
|
|
236 |
%
|
|
237 |
\endisadelimquote
|
|
238 |
%
|
28447
|
239 |
\begin{isamarkuptext}%
|
34155
|
240 |
\noindent
|
|
241 |
we explicitly map all those modules on \emph{ABC},
|
28447
|
242 |
resulting in an ad-hoc merge of this three modules
|
|
243 |
at serialisation time.%
|
|
244 |
\end{isamarkuptext}%
|
|
245 |
\isamarkuptrue%
|
|
246 |
%
|
|
247 |
\isamarkupsubsection{Evaluation oracle%
|
|
248 |
}
|
|
249 |
\isamarkuptrue%
|
|
250 |
%
|
28593
|
251 |
\begin{isamarkuptext}%
|
|
252 |
Code generation may also be used to \emph{evaluate} expressions
|
|
253 |
(using \isa{SML} as target language of course).
|
34155
|
254 |
For instance, the \hyperlink{command.value}{\mbox{\isa{\isacommand{value}}}} reduces an expression to a
|
28593
|
255 |
normal form with respect to the underlying code equations:%
|
|
256 |
\end{isamarkuptext}%
|
|
257 |
\isamarkuptrue%
|
|
258 |
%
|
|
259 |
\isadelimquote
|
|
260 |
%
|
|
261 |
\endisadelimquote
|
|
262 |
%
|
|
263 |
\isatagquote
|
|
264 |
\isacommand{value}\isamarkupfalse%
|
|
265 |
\ {\isachardoublequoteopen}{\isadigit{4}}{\isadigit{2}}\ {\isacharslash}\ {\isacharparenleft}{\isadigit{1}}{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ rat{\isacharparenright}{\isachardoublequoteclose}%
|
|
266 |
\endisatagquote
|
|
267 |
{\isafoldquote}%
|
|
268 |
%
|
|
269 |
\isadelimquote
|
|
270 |
%
|
|
271 |
\endisadelimquote
|
|
272 |
%
|
|
273 |
\begin{isamarkuptext}%
|
|
274 |
\noindent will display \isa{{\isadigit{7}}\ {\isacharslash}\ {\isadigit{2}}}.
|
|
275 |
|
|
276 |
The \hyperlink{method.eval}{\mbox{\isa{eval}}} method tries to reduce a goal by code generation to \isa{True}
|
|
277 |
and solves it in that case, but fails otherwise:%
|
|
278 |
\end{isamarkuptext}%
|
|
279 |
\isamarkuptrue%
|
|
280 |
%
|
|
281 |
\isadelimquote
|
|
282 |
%
|
|
283 |
\endisadelimquote
|
|
284 |
%
|
|
285 |
\isatagquote
|
|
286 |
\isacommand{lemma}\isamarkupfalse%
|
|
287 |
\ {\isachardoublequoteopen}{\isadigit{4}}{\isadigit{2}}\ {\isacharslash}\ {\isacharparenleft}{\isadigit{1}}{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ rat{\isacharparenright}\ {\isacharequal}\ {\isadigit{7}}\ {\isacharslash}\ {\isadigit{2}}{\isachardoublequoteclose}\isanewline
|
|
288 |
\ \ \isacommand{by}\isamarkupfalse%
|
|
289 |
\ eval%
|
|
290 |
\endisatagquote
|
|
291 |
{\isafoldquote}%
|
|
292 |
%
|
|
293 |
\isadelimquote
|
|
294 |
%
|
|
295 |
\endisadelimquote
|
|
296 |
%
|
|
297 |
\begin{isamarkuptext}%
|
|
298 |
\noindent The soundness of the \hyperlink{method.eval}{\mbox{\isa{eval}}} method depends crucially
|
|
299 |
on the correctness of the code generator; this is one of the reasons
|
31050
|
300 |
why you should not use adaptation (see \secref{sec:adaptation}) frivolously.%
|
28593
|
301 |
\end{isamarkuptext}%
|
|
302 |
\isamarkuptrue%
|
|
303 |
%
|
28447
|
304 |
\isamarkupsubsection{Code antiquotation%
|
|
305 |
}
|
|
306 |
\isamarkuptrue%
|
|
307 |
%
|
28593
|
308 |
\begin{isamarkuptext}%
|
|
309 |
In scenarios involving techniques like reflection it is quite common
|
|
310 |
that code generated from a theory forms the basis for implementing
|
|
311 |
a proof procedure in \isa{SML}. To facilitate interfacing of generated code
|
|
312 |
with system code, the code generator provides a \isa{code} antiquotation:%
|
|
313 |
\end{isamarkuptext}%
|
28447
|
314 |
\isamarkuptrue%
|
|
315 |
%
|
28593
|
316 |
\isadelimquote
|
|
317 |
%
|
|
318 |
\endisadelimquote
|
|
319 |
%
|
|
320 |
\isatagquote
|
|
321 |
\isacommand{datatype}\isamarkupfalse%
|
30880
|
322 |
\ form\ {\isacharequal}\ T\ {\isacharbar}\ F\ {\isacharbar}\ And\ form\ form\ {\isacharbar}\ Or\ form\ form\ %
|
30227
|
323 |
\endisatagquote
|
|
324 |
{\isafoldquote}%
|
|
325 |
%
|
|
326 |
\isadelimquote
|
|
327 |
%
|
|
328 |
\endisadelimquote
|
|
329 |
%
|
|
330 |
\isadelimquotett
|
30880
|
331 |
\ %
|
30227
|
332 |
\endisadelimquotett
|
|
333 |
%
|
|
334 |
\isatagquotett
|
28593
|
335 |
\isacommand{ML}\isamarkupfalse%
|
|
336 |
\ {\isacharverbatimopen}\isanewline
|
|
337 |
\ \ fun\ eval{\isacharunderscore}form\ %
|
|
338 |
\isaantiq
|
|
339 |
code\ T%
|
|
340 |
\endisaantiq
|
|
341 |
\ {\isacharequal}\ true\isanewline
|
|
342 |
\ \ \ \ {\isacharbar}\ eval{\isacharunderscore}form\ %
|
|
343 |
\isaantiq
|
|
344 |
code\ F%
|
|
345 |
\endisaantiq
|
|
346 |
\ {\isacharequal}\ false\isanewline
|
|
347 |
\ \ \ \ {\isacharbar}\ eval{\isacharunderscore}form\ {\isacharparenleft}%
|
|
348 |
\isaantiq
|
|
349 |
code\ And%
|
|
350 |
\endisaantiq
|
|
351 |
\ {\isacharparenleft}p{\isacharcomma}\ q{\isacharparenright}{\isacharparenright}\ {\isacharequal}\isanewline
|
|
352 |
\ \ \ \ \ \ \ \ eval{\isacharunderscore}form\ p\ andalso\ eval{\isacharunderscore}form\ q\isanewline
|
|
353 |
\ \ \ \ {\isacharbar}\ eval{\isacharunderscore}form\ {\isacharparenleft}%
|
|
354 |
\isaantiq
|
|
355 |
code\ Or%
|
|
356 |
\endisaantiq
|
|
357 |
\ {\isacharparenleft}p{\isacharcomma}\ q{\isacharparenright}{\isacharparenright}\ {\isacharequal}\isanewline
|
|
358 |
\ \ \ \ \ \ \ \ eval{\isacharunderscore}form\ p\ orelse\ eval{\isacharunderscore}form\ q{\isacharsemicolon}\isanewline
|
|
359 |
{\isacharverbatimclose}%
|
30227
|
360 |
\endisatagquotett
|
|
361 |
{\isafoldquotett}%
|
28593
|
362 |
%
|
30227
|
363 |
\isadelimquotett
|
28593
|
364 |
%
|
30227
|
365 |
\endisadelimquotett
|
28593
|
366 |
%
|
28447
|
367 |
\begin{isamarkuptext}%
|
28593
|
368 |
\noindent \isa{code} takes as argument the name of a constant; after the
|
|
369 |
whole \isa{SML} is read, the necessary code is generated transparently
|
|
370 |
and the corresponding constant names are inserted. This technique also
|
|
371 |
allows to use pattern matching on constructors stemming from compiled
|
|
372 |
\isa{datatypes}.
|
|
373 |
|
29798
|
374 |
For a less simplistic example, theory \hyperlink{theory.Ferrack}{\mbox{\isa{Ferrack}}} is
|
28593
|
375 |
a good reference.%
|
28447
|
376 |
\end{isamarkuptext}%
|
|
377 |
\isamarkuptrue%
|
|
378 |
%
|
|
379 |
\isamarkupsubsection{Imperative data structures%
|
|
380 |
}
|
|
381 |
\isamarkuptrue%
|
|
382 |
%
|
28593
|
383 |
\begin{isamarkuptext}%
|
|
384 |
If you consider imperative data structures as inevitable for a specific
|
|
385 |
application, you should consider
|
|
386 |
\emph{Imperative Functional Programming with Isabelle/HOL}
|
34155
|
387 |
\cite{bulwahn-et-al:2008:imperative};
|
28593
|
388 |
the framework described there is available in theory \hyperlink{theory.Imperative-HOL}{\mbox{\isa{Imperative{\isacharunderscore}HOL}}}.%
|
|
389 |
\end{isamarkuptext}%
|
|
390 |
\isamarkuptrue%
|
|
391 |
%
|
28447
|
392 |
\isadelimtheory
|
|
393 |
%
|
|
394 |
\endisadelimtheory
|
|
395 |
%
|
|
396 |
\isatagtheory
|
|
397 |
\isacommand{end}\isamarkupfalse%
|
|
398 |
%
|
|
399 |
\endisatagtheory
|
|
400 |
{\isafoldtheory}%
|
|
401 |
%
|
|
402 |
\isadelimtheory
|
|
403 |
%
|
|
404 |
\endisadelimtheory
|
|
405 |
\isanewline
|
|
406 |
\end{isabellebody}%
|
|
407 |
%%% Local Variables:
|
|
408 |
%%% mode: latex
|
|
409 |
%%% TeX-master: "root"
|
|
410 |
%%% End:
|