src/Doc/Codegen/Evaluation.thy
author wenzelm
Sat, 22 Oct 2016 21:10:02 +0200
changeset 64350 3af8566788e7
parent 63670 8e0148e1f5f4
child 65041 2525e680f94f
permissions -rw-r--r--
remote_builds has PAR-SEQ semantics of old isatest-makedist; tuned signature;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
     1
theory Evaluation
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
     2
imports Setup
59378
065f349852e6 separate image for prerequisites of codegen tutorial
haftmann
parents: 59377
diff changeset
     3
begin (*<*)
065f349852e6 separate image for prerequisites of codegen tutorial
haftmann
parents: 59377
diff changeset
     4
065f349852e6 separate image for prerequisites of codegen tutorial
haftmann
parents: 59377
diff changeset
     5
ML \<open>
065f349852e6 separate image for prerequisites of codegen tutorial
haftmann
parents: 59377
diff changeset
     6
  Isabelle_System.mkdirs (File.tmp_path (Path.basic "examples"))
065f349852e6 separate image for prerequisites of codegen tutorial
haftmann
parents: 59377
diff changeset
     7
\<close> (*>*)
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
     8
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
     9
section \<open>Evaluation \label{sec:evaluation}\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    10
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    11
text \<open>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    12
  Recalling \secref{sec:principle}, code generation turns a system of
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    13
  equations into a program with the \emph{same} equational semantics.
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    14
  As a consequence, this program can be used as a \emph{rewrite
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    15
  engine} for terms: rewriting a term @{term "t"} using a program to a
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    16
  term @{term "t'"} yields the theorems @{prop "t \<equiv> t'"}.  This
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    17
  application of code generation in the following is referred to as
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    18
  \emph{evaluation}.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    19
\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    20
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    21
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    22
subsection \<open>Evaluation techniques\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    23
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    24
text \<open>
40350
1ef7ee8dd165 fixed typos
haftmann
parents: 39745
diff changeset
    25
  The existing infrastructure provides a rich palette of evaluation
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    26
  techniques, each comprising different aspects:
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    27
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    28
  \begin{description}
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    29
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    30
    \item[Expressiveness.]  Depending on how good symbolic computation
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    31
      is supported, the class of terms which can be evaluated may be
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    32
      bigger or smaller.
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    33
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    34
    \item[Efficiency.]  The more machine-near the technique, the
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    35
      faster it is.
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    36
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    37
    \item[Trustability.]  Techniques which a huge (and also probably
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    38
      more configurable infrastructure) are more fragile and less
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    39
      trustable.
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    40
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    41
  \end{description}
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    42
\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    43
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    44
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    45
subsubsection \<open>The simplifier (@{text simp})\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    46
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    47
text \<open>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    48
  The simplest way for evaluation is just using the simplifier with
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    49
  the original code equations of the underlying program.  This gives
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    50
  fully symbolic evaluation and highest trustablity, with the usual
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    51
  performance of the simplifier.  Note that for operations on abstract
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    52
  datatypes (cf.~\secref{sec:invariant}), the original theorems as
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    53
  given by the users are used, not the modified ones.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    54
\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    55
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    56
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    57
subsubsection \<open>Normalization by evaluation (@{text nbe})\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    58
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    59
text \<open>
58620
7435b6a3f72e more antiquotations;
wenzelm
parents: 58310
diff changeset
    60
  Normalization by evaluation @{cite "Aehlig-Haftmann-Nipkow:2008:nbe"}
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    61
  provides a comparably fast partially symbolic evaluation which
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    62
  permits also normalization of functions and uninterpreted symbols;
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    63
  the stack of code to be trusted is considerable.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    64
\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    65
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    66
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    67
subsubsection \<open>Evaluation in ML (@{text code})\<close>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    68
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    69
text \<open>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    70
  Highest performance can be achieved by evaluation in ML, at the cost
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    71
  of being restricted to ground results and a layered stack of code to
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    72
  be trusted, including code generator configurations by the user.
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    73
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    74
  Evaluation is carried out in a target language \emph{Eval} which
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    75
  inherits from \emph{SML} but for convenience uses parts of the
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    76
  Isabelle runtime environment.  The soundness of computation carried
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
    77
  out there depends crucially on the correctness of the code
39643
29cc021398fc corrections and tuning
haftmann
parents: 39609
diff changeset
    78
  generator setup; this is one of the reasons why you should not use
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
    79
  adaptation (see \secref{sec:adaptation}) frivolously.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    80
\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    81
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    82
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    83
subsection \<open>Aspects of evaluation\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    84
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    85
text \<open>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    86
  Each of the techniques can be combined with different aspects.  The
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    87
  most important distinction is between dynamic and static evaluation.
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    88
  Dynamic evaluation takes the code generator configuration \qt{as it
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    89
  is} at the point where evaluation is issued.  Best example is the
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    90
  @{command_def value} command which allows ad-hoc evaluation of
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
    91
  terms:
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    92
\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    93
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    94
value %quote "42 / (12 :: rat)"
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    95
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
    96
text \<open>
56927
4044a7d1720f hardcoded nbe and sml into value command
haftmann
parents: 55418
diff changeset
    97
  \noindent @{command value} tries first to evaluate using ML, falling
4044a7d1720f hardcoded nbe and sml into value command
haftmann
parents: 55418
diff changeset
    98
  back to normalization by evaluation if this fails.
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
    99
58100
f54a8a4134d3 restored generic value slot, retaining default behaviour and separate approximate command
haftmann
parents: 56927
diff changeset
   100
  A particular technique may be specified in square brackets, e.g.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   101
\<close>
58100
f54a8a4134d3 restored generic value slot, retaining default behaviour and separate approximate command
haftmann
parents: 56927
diff changeset
   102
f54a8a4134d3 restored generic value slot, retaining default behaviour and separate approximate command
haftmann
parents: 56927
diff changeset
   103
value %quote [nbe] "42 / (12 :: rat)"
f54a8a4134d3 restored generic value slot, retaining default behaviour and separate approximate command
haftmann
parents: 56927
diff changeset
   104
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   105
text \<open>
43656
9ece73262746 adding documentation of the value antiquotation to the code generation manual
bulwahn
parents: 41184
diff changeset
   106
  To employ dynamic evaluation in the document generation, there is also
56927
4044a7d1720f hardcoded nbe and sml into value command
haftmann
parents: 55418
diff changeset
   107
  a @{text value} antiquotation with the same evaluation techniques 
4044a7d1720f hardcoded nbe and sml into value command
haftmann
parents: 55418
diff changeset
   108
  as @{command value}.
43656
9ece73262746 adding documentation of the value antiquotation to the code generation manual
bulwahn
parents: 41184
diff changeset
   109
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   110
  Static evaluation freezes the code generator configuration at a
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   111
  certain point and uses this context whenever evaluation is issued
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   112
  later on.  This is particularly appropriate for proof procedures
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   113
  which use evaluation, since then the behaviour of evaluation is not
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   114
  changed or even compromised later on by actions of the user.
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   115
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   116
  As a technical complication, terms after evaluation in ML must be
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   117
  turned into Isabelle's internal term representation again.  Since
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   118
  this is also configurable, it is never fully trusted.  For this
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   119
  reason, evaluation in ML comes with further aspects:
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   120
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   121
  \begin{description}
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   122
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   123
    \item[Plain evaluation.]  A term is normalized using the provided
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   124
      term reconstruction from ML to Isabelle; for applications which
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   125
      do not need to be fully trusted.
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   126
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   127
    \item[Property conversion.]  Evaluates propositions; since these
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   128
      are monomorphic, the term reconstruction is fixed once and for all
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   129
      and therefore trustable.
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   130
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   131
    \item[Conversion.]  Evaluates an arbitrary term @{term "t"} first
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   132
      by plain evaluation and certifies the result @{term "t'"} by
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   133
      checking the equation @{term "t \<equiv> t'"} using property
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   134
      conversion.
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   135
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   136
  \end{description}
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   137
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   138
  \noindent The picture is further complicated by the roles of
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   139
  exceptions.  Here three cases have to be distinguished:
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   140
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   141
  \begin{itemize}
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   142
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   143
    \item Evaluation of @{term t} terminates with a result @{term
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   144
      "t'"}.
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   145
63161
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   146
    \item Evaluation of @{term t} terminates which an exception
40350
1ef7ee8dd165 fixed typos
haftmann
parents: 39745
diff changeset
   147
      indicating a pattern match failure or a non-implemented
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   148
      function.  As sketched in \secref{sec:partiality}, this can be
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   149
      interpreted as partiality.
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   150
     
39643
29cc021398fc corrections and tuning
haftmann
parents: 39609
diff changeset
   151
    \item Evaluation raises any other kind of exception.
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   152
     
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   153
  \end{itemize}
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   154
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   155
  \noindent For conversions, the first case yields the equation @{term
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   156
  "t = t'"}, the second defaults to reflexivity @{term "t = t"}.
39643
29cc021398fc corrections and tuning
haftmann
parents: 39609
diff changeset
   157
  Exceptions of the third kind are propagated to the user.
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   158
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   159
  By default return values of plain evaluation are optional, yielding
40350
1ef7ee8dd165 fixed typos
haftmann
parents: 39745
diff changeset
   160
  @{text "SOME t'"} in the first case, @{text "NONE"} in the
1ef7ee8dd165 fixed typos
haftmann
parents: 39745
diff changeset
   161
  second, and propagating the exception in the third case.  A strict
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   162
  variant of plain evaluation either yields @{text "t'"} or propagates
51713
4fd969609b4d spelling
haftmann
parents: 48985
diff changeset
   163
  any exception, a liberal variant captures any exception in a result
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   164
  of type @{text "Exn.result"}.
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   165
  
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   166
  For property conversion (which coincides with conversion except for
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   167
  evaluation in ML), methods are provided which solve a given goal by
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   168
  evaluation.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   169
\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   170
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   171
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   172
subsection \<open>Schematic overview\<close>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   173
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   174
text \<open>
39693
2ef15ec8e7dc tuned schema table
haftmann
parents: 39643
diff changeset
   175
  \newcommand{\ttsize}{\fontsize{5.8pt}{8pt}\selectfont}
2ef15ec8e7dc tuned schema table
haftmann
parents: 39643
diff changeset
   176
  \fontsize{9pt}{12pt}\selectfont
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   177
  \begin{tabular}{ll||c|c|c}
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   178
    & & @{text simp} & @{text nbe} & @{text code} \tabularnewline \hline \hline
58100
f54a8a4134d3 restored generic value slot, retaining default behaviour and separate approximate command
haftmann
parents: 56927
diff changeset
   179
    \multirow{5}{1ex}{\rotatebox{90}{dynamic}}
f54a8a4134d3 restored generic value slot, retaining default behaviour and separate approximate command
haftmann
parents: 56927
diff changeset
   180
      & interactive evaluation 
f54a8a4134d3 restored generic value slot, retaining default behaviour and separate approximate command
haftmann
parents: 56927
diff changeset
   181
      & @{command value} @{text "[simp]"} & @{command value} @{text "[nbe]"} & @{command value} @{text "[code]"}
f54a8a4134d3 restored generic value slot, retaining default behaviour and separate approximate command
haftmann
parents: 56927
diff changeset
   182
      \tabularnewline
39693
2ef15ec8e7dc tuned schema table
haftmann
parents: 39643
diff changeset
   183
    & plain evaluation & & & \ttsize@{ML "Code_Evaluation.dynamic_value"} \tabularnewline \cline{2-5}
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   184
    & evaluation method & @{method code_simp} & @{method normalization} & @{method eval} \tabularnewline
39693
2ef15ec8e7dc tuned schema table
haftmann
parents: 39643
diff changeset
   185
    & property conversion & & & \ttsize@{ML "Code_Runtime.dynamic_holds_conv"} \tabularnewline \cline{2-5}
41184
5c6f44d22f51 simplified evaluation function names
haftmann
parents: 40751
diff changeset
   186
    & conversion & \ttsize@{ML "Code_Simp.dynamic_conv"} & \ttsize@{ML "Nbe.dynamic_conv"}
5c6f44d22f51 simplified evaluation function names
haftmann
parents: 40751
diff changeset
   187
      & \ttsize@{ML "Code_Evaluation.dynamic_conv"} \tabularnewline \hline \hline
39693
2ef15ec8e7dc tuned schema table
haftmann
parents: 39643
diff changeset
   188
    \multirow{3}{1ex}{\rotatebox{90}{static}}
41184
5c6f44d22f51 simplified evaluation function names
haftmann
parents: 40751
diff changeset
   189
    & plain evaluation & & & \ttsize@{ML "Code_Evaluation.static_value"} \tabularnewline \cline{2-5}
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   190
    & property conversion & &
39693
2ef15ec8e7dc tuned schema table
haftmann
parents: 39643
diff changeset
   191
      & \ttsize@{ML "Code_Runtime.static_holds_conv"} \tabularnewline \cline{2-5}
41184
5c6f44d22f51 simplified evaluation function names
haftmann
parents: 40751
diff changeset
   192
    & conversion & \ttsize@{ML "Code_Simp.static_conv"}
5c6f44d22f51 simplified evaluation function names
haftmann
parents: 40751
diff changeset
   193
      & \ttsize@{ML "Nbe.static_conv"}
5c6f44d22f51 simplified evaluation function names
haftmann
parents: 40751
diff changeset
   194
      & \ttsize@{ML "Code_Evaluation.static_conv"}
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   195
  \end{tabular}
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   196
\<close>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   197
63161
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   198
text \<open>
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   199
  \noindent Note that @{ML Code_Evaluation.static_value} and
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   200
  @{ML Code_Evaluation.static_conv} require certain code equations to
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   201
  reconstruct Isabelle terms from results and certify results.  This is
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   202
  achieved as follows:
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   203
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   204
  \<^enum> Identify which result types are expected.
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   205
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   206
  \<^enum> Define an auxiliary operation which for each possible result type @{text \<tau>}
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   207
    contains a term @{const Code_Evaluation.TERM_OF} of type @{text "\<tau> itself"}
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   208
    (for @{ML Code_Evaluation.static_value}) or
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   209
    a term @{const Code_Evaluation.TERM_OF_EQUAL} of type @{text "\<tau> itself"}
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   210
    (for @{ML Code_Evaluation.static_conv}) respectively.
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   211
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   212
  \<^enum> Include that auxiliary operation into the set of constants when generating
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   213
    the static conversion.
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   214
\<close>
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   215
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   216
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   217
subsection \<open>Preprocessing HOL terms into evaluable shape\<close>
52287
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   218
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   219
text \<open>
63161
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   220
  When integrating decision procedures developed inside HOL into HOL itself,
52287
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   221
  it is necessary to somehow get from the Isabelle/ML representation to
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   222
  the representation used by the decision procedure itself (``reification'').
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   223
  One option is to hardcode it using code antiquotations (see \secref{sec:code_antiq}).
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   224
  Another option is to use pre-existing infrastructure in HOL:
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   225
  @{ML "Reification.conv"} and @{ML "Reification.tac"}
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   226
63161
2660ba498798 delegate inclusion of required dictionaries to user-space instead of half-working magic
haftmann
parents: 61337
diff changeset
   227
  A simplistic example:
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   228
\<close>
52287
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   229
58310
91ea607a34d8 updated news
blanchet
parents: 58305
diff changeset
   230
datatype %quote form_ord = T | F | Less nat nat
52287
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   231
  | And form_ord form_ord | Or form_ord form_ord | Neg form_ord
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   232
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   233
primrec %quote interp :: "form_ord \<Rightarrow> 'a::order list \<Rightarrow> bool"
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   234
where
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   235
  "interp T vs \<longleftrightarrow> True"
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   236
| "interp F vs \<longleftrightarrow> False"
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   237
| "interp (Less i j) vs \<longleftrightarrow> vs ! i < vs ! j"
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   238
| "interp (And f1 f2) vs \<longleftrightarrow> interp f1 vs \<and> interp f2 vs"
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   239
| "interp (Or f1 f2) vs \<longleftrightarrow> interp f1 vs \<or> interp f2 vs"
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   240
| "interp (Neg f) vs \<longleftrightarrow> \<not> interp f vs"
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   241
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   242
text \<open>
52287
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   243
  The datatype @{type form_ord} represents formulae whose semantics is given by
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   244
  @{const interp}.  Note that values are represented by variable indices (@{typ nat})
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   245
  whose concrete values are given in list @{term vs}.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   246
\<close>
52287
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   247
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   248
ML (*<*) \<open>\<close>
61337
4645502c3c64 fewer aliases for toplevel theorem statements;
wenzelm
parents: 60754
diff changeset
   249
schematic_goal "thm": fixes x y z :: "'a::order" shows "x < y \<and> x < z \<equiv> ?P"
52287
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   250
ML_prf 
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   251
(*>*) \<open>val thm =
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   252
  Reification.conv @{context} @{thms interp.simps} @{cterm "x < y \<and> x < z"}\<close> (*<*)
60754
02924903a6fd prefer tactics with explicit context;
wenzelm
parents: 59378
diff changeset
   253
by (tactic \<open>ALLGOALS (resolve_tac @{context} [thm])\<close>)
52287
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   254
(*>*) 
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   255
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   256
text \<open>
52287
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   257
  By virtue of @{fact interp.simps}, @{ML "Reification.conv"} provides a conversion
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   258
  which, for this concrete example, yields @{thm thm [no_vars]}.  Note that the argument
59335
haftmann
parents: 59334
diff changeset
   259
  to @{const interp} does not contain any free variables and can thus be evaluated
52287
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   260
  using evaluation.
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   261
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   262
  A less meager example can be found in the AFP, session @{text "Regular-Sets"},
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   263
  theory @{text Regexp_Method}.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   264
\<close>
52287
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   265
7e54c4d964e7 some meagure hints concerning reification
haftmann
parents: 51713
diff changeset
   266
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   267
subsection \<open>Intimate connection between logic and system runtime\<close>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   268
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   269
text \<open>
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   270
  The toolbox of static evaluation conversions forms a reasonable base
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   271
  to interweave generated code and system tools.  However in some
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   272
  situations more direct interaction is desirable.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   273
\<close>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   274
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   275
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   276
subsubsection \<open>Static embedding of generated code into system runtime -- the @{text code} antiquotation \label{sec:code_antiq}\<close>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   277
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   278
text \<open>
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   279
  The @{text code} antiquotation allows to include constants from
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   280
  generated code directly into ML system code, as in the following toy
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   281
  example:
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   282
\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   283
58310
91ea607a34d8 updated news
blanchet
parents: 58305
diff changeset
   284
datatype %quote form = T | F | And form form | Or form form (*<*)
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   285
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   286
(*>*) ML %quotett \<open>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   287
  fun eval_form @{code T} = true
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   288
    | eval_form @{code F} = false
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   289
    | eval_form (@{code And} (p, q)) =
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   290
        eval_form p andalso eval_form q
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   291
    | eval_form (@{code Or} (p, q)) =
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   292
        eval_form p orelse eval_form q;
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   293
\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   294
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   295
text \<open>
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   296
  \noindent @{text code} takes as argument the name of a constant;
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   297
  after the whole ML is read, the necessary code is generated
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   298
  transparently and the corresponding constant names are inserted.
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   299
  This technique also allows to use pattern matching on constructors
39643
29cc021398fc corrections and tuning
haftmann
parents: 39609
diff changeset
   300
  stemming from compiled datatypes.  Note that the @{text code}
29cc021398fc corrections and tuning
haftmann
parents: 39609
diff changeset
   301
  antiquotation may not refer to constants which carry adaptations;
29cc021398fc corrections and tuning
haftmann
parents: 39609
diff changeset
   302
  here you have to refer to the corresponding adapted code directly.
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   303
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   304
  For a less simplistic example, theory @{text Approximation} in
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   305
  the @{text Decision_Procs} session is a good reference.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   306
\<close>
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   307
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   308
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   309
subsubsection \<open>Static embedding of generated code into system runtime -- @{text code_reflect}\<close>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   310
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   311
text \<open>
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   312
  The @{text code} antiquoation is lightweight, but the generated code
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   313
  is only accessible while the ML section is processed.  Sometimes this
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   314
  is not appropriate, especially if the generated code contains datatype
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   315
  declarations which are shared with other parts of the system.  In these
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   316
  cases, @{command_def code_reflect} can be used:
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   317
\<close>
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   318
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   319
code_reflect %quote Sum_Type
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   320
  datatypes sum = Inl | Inr
55418
9f25e0cca254 adapted to renaming of 'Projl' and 'Projr'
blanchet
parents: 52287
diff changeset
   321
  functions "Sum_Type.sum.projl" "Sum_Type.sum.projr"
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   322
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   323
text \<open>
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   324
  \noindent @{command_def code_reflect} takes a structure name and
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   325
  references to datatypes and functions; for these code is compiled
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   326
  into the named ML structure and the \emph{Eval} target is modified
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   327
  in a way that future code generation will reference these
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   328
  precompiled versions of the given datatypes and functions.  This
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   329
  also allows to refer to the referenced datatypes and functions from
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   330
  arbitrary ML code as well.
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   331
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   332
  A typical example for @{command code_reflect} can be found in the
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   333
  @{theory Predicate} theory.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   334
\<close>
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   335
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   336
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   337
subsubsection \<open>Separate compilation -- @{text code_reflect}\<close>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   338
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   339
text \<open>
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   340
  For technical reasons it is sometimes necessary to separate
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   341
  generation and compilation of code which is supposed to be used in
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   342
  the system runtime.  For this @{command code_reflect} with an
63670
wenzelm
parents: 63175
diff changeset
   343
  optional \<^theory_text>\<open>file\<close> argument can be used:
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   344
\<close>
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   345
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   346
code_reflect %quote Rat
63175
d191892b1c23 explicit check that abstract constructors cannot be part of official interface
haftmann
parents: 63161
diff changeset
   347
  datatypes rat
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   348
  functions Fract
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   349
    "(plus :: rat \<Rightarrow> rat \<Rightarrow> rat)" "(minus :: rat \<Rightarrow> rat \<Rightarrow> rat)"
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   350
    "(times :: rat \<Rightarrow> rat \<Rightarrow> rat)" "(divide :: rat \<Rightarrow> rat \<Rightarrow> rat)"
59334
f0141b991c8f avoid writing into source
haftmann
parents: 58620
diff changeset
   351
  file "$ISABELLE_TMP/examples/rat.ML"
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   352
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   353
text \<open>
39643
29cc021398fc corrections and tuning
haftmann
parents: 39609
diff changeset
   354
  \noindent This merely generates the referenced code to the given
39609
0af12dea761f sections on @{code} and code_reflect
haftmann
parents: 39599
diff changeset
   355
  file which can be included into the system runtime later on.
59377
056945909f60 modernized cartouches
haftmann
parents: 59335
diff changeset
   356
\<close>
39599
d9c247f7afa3 continued section abut evaluation
haftmann
parents: 39067
diff changeset
   357
38510
ec0408c7328b stub for evaluation chapter
haftmann
parents:
diff changeset
   358
end
46522
2b1e87b3967f tuned whitespace
haftmann
parents: 43656
diff changeset
   359