doc-src/TutorialI/CodeGen/document/CodeGen.tex
author paulson
Wed, 15 Jan 2003 16:43:12 +0100
changeset 13778 61272514e3b5
parent 13758 ee898d32de21
child 13791 3b6ff7ceaf27
permissions -rw-r--r--
auto-update
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9722
a5f86aed785b *** empty log message ***
nipkow
parents: 9721
diff changeset
     1
%
a5f86aed785b *** empty log message ***
nipkow
parents: 9721
diff changeset
     2
\begin{isabellebody}%
9924
3370f6aa3200 updated;
wenzelm
parents: 9844
diff changeset
     3
\def\isabellecontext{CodeGen}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
     4
\isamarkupfalse%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
     5
%
10878
b254d5ad6dd4 auto update
paulson
parents: 10795
diff changeset
     6
\isamarkupsection{Case Study: Compiling Expressions%
10395
7ef380745743 updated;
wenzelm
parents: 10187
diff changeset
     7
}
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
     8
\isamarkuptrue%
9844
8016321c7de1 *** empty log message ***
nipkow
parents: 9722
diff changeset
     9
%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    10
\begin{isamarkuptext}%
9844
8016321c7de1 *** empty log message ***
nipkow
parents: 9722
diff changeset
    11
\label{sec:ExprCompiler}
11458
09a6c44a48ea numerous stylistic changes and indexing
paulson
parents: 11428
diff changeset
    12
\index{compiling expressions example|(}%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    13
The task is to develop a compiler from a generic type of expressions (built
10795
9e888d60d3e5 minor edits to Chapters 1-3
paulson
parents: 10395
diff changeset
    14
from variables, constants and binary operations) to a stack machine.  This
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    15
generic type of expressions is a generalization of the boolean expressions in
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    16
\S\ref{sec:boolex}.  This time we do not commit ourselves to a particular
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    17
type of variables or values but make them type parameters.  Neither is there
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    18
a fixed set of binary operations: instead the expression contains the
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    19
appropriate function itself.%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    20
\end{isamarkuptext}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    21
\isamarkuptrue%
9673
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    22
\isacommand{types}\ {\isacharprime}v\ binop\ {\isacharequal}\ {\isachardoublequote}{\isacharprime}v\ {\isasymRightarrow}\ {\isacharprime}v\ {\isasymRightarrow}\ {\isacharprime}v{\isachardoublequote}\isanewline
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    23
\isamarkupfalse%
9673
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    24
\isacommand{datatype}\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}v{\isacharparenright}expr\ {\isacharequal}\ Cex\ {\isacharprime}v\isanewline
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    25
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ Vex\ {\isacharprime}a\isanewline
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    26
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ Bex\ {\isachardoublequote}{\isacharprime}v\ binop{\isachardoublequote}\ \ {\isachardoublequote}{\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}v{\isacharparenright}expr{\isachardoublequote}\ \ {\isachardoublequote}{\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}v{\isacharparenright}expr{\isachardoublequote}\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    27
%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    28
\begin{isamarkuptext}%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    29
\noindent
8771
026f37a86ea7 *** empty log message ***
nipkow
parents: 8746
diff changeset
    30
The three constructors represent constants, variables and the application of
026f37a86ea7 *** empty log message ***
nipkow
parents: 8746
diff changeset
    31
a binary operation to two subexpressions.
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    32
10795
9e888d60d3e5 minor edits to Chapters 1-3
paulson
parents: 10395
diff changeset
    33
The value of an expression with respect to an environment that maps variables to
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    34
values is easily defined:%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    35
\end{isamarkuptext}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    36
\isamarkuptrue%
9673
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    37
\isacommand{consts}\ value\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}v{\isacharparenright}expr\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}v{\isacharparenright}\ {\isasymRightarrow}\ {\isacharprime}v{\isachardoublequote}\isanewline
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    38
\isamarkupfalse%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    39
\isacommand{primrec}\isanewline
9673
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    40
{\isachardoublequote}value\ {\isacharparenleft}Cex\ v{\isacharparenright}\ env\ {\isacharequal}\ v{\isachardoublequote}\isanewline
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    41
{\isachardoublequote}value\ {\isacharparenleft}Vex\ a{\isacharparenright}\ env\ {\isacharequal}\ env\ a{\isachardoublequote}\isanewline
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    42
{\isachardoublequote}value\ {\isacharparenleft}Bex\ f\ e{\isadigit{1}}\ e{\isadigit{2}}{\isacharparenright}\ env\ {\isacharequal}\ f\ {\isacharparenleft}value\ e{\isadigit{1}}\ env{\isacharparenright}\ {\isacharparenleft}value\ e{\isadigit{2}}\ env{\isacharparenright}{\isachardoublequote}\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    43
%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    44
\begin{isamarkuptext}%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    45
The stack machine has three instructions: load a constant value onto the
10795
9e888d60d3e5 minor edits to Chapters 1-3
paulson
parents: 10395
diff changeset
    46
stack, load the contents of an address onto the stack, and apply a
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    47
binary operation to the two topmost elements of the stack, replacing them by
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    48
the result. As for \isa{expr}, addresses and values are type parameters:%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    49
\end{isamarkuptext}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    50
\isamarkuptrue%
9673
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    51
\isacommand{datatype}\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}v{\isacharparenright}\ instr\ {\isacharequal}\ Const\ {\isacharprime}v\isanewline
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    52
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ Load\ {\isacharprime}a\isanewline
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    53
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ Apply\ {\isachardoublequote}{\isacharprime}v\ binop{\isachardoublequote}\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    54
%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    55
\begin{isamarkuptext}%
8771
026f37a86ea7 *** empty log message ***
nipkow
parents: 8746
diff changeset
    56
The execution of the stack machine is modelled by a function
026f37a86ea7 *** empty log message ***
nipkow
parents: 8746
diff changeset
    57
\isa{exec} that takes a list of instructions, a store (modelled as a
026f37a86ea7 *** empty log message ***
nipkow
parents: 8746
diff changeset
    58
function from addresses to values, just like the environment for
026f37a86ea7 *** empty log message ***
nipkow
parents: 8746
diff changeset
    59
evaluating expressions), and a stack (modelled as a list) of values,
10971
6852682eaf16 *** empty log message ***
nipkow
parents: 10878
diff changeset
    60
and returns the stack at the end of the execution --- the store remains
8771
026f37a86ea7 *** empty log message ***
nipkow
parents: 8746
diff changeset
    61
unchanged:%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    62
\end{isamarkuptext}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    63
\isamarkuptrue%
9673
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    64
\isacommand{consts}\ exec\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}v{\isacharparenright}instr\ list\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a{\isasymRightarrow}{\isacharprime}v{\isacharparenright}\ {\isasymRightarrow}\ {\isacharprime}v\ list\ {\isasymRightarrow}\ {\isacharprime}v\ list{\isachardoublequote}\isanewline
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    65
\isamarkupfalse%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    66
\isacommand{primrec}\isanewline
9673
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    67
{\isachardoublequote}exec\ {\isacharbrackleft}{\isacharbrackright}\ s\ vs\ {\isacharequal}\ vs{\isachardoublequote}\isanewline
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    68
{\isachardoublequote}exec\ {\isacharparenleft}i{\isacharhash}is{\isacharparenright}\ s\ vs\ {\isacharequal}\ {\isacharparenleft}case\ i\ of\isanewline
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    69
\ \ \ \ Const\ v\ \ {\isasymRightarrow}\ exec\ is\ s\ {\isacharparenleft}v{\isacharhash}vs{\isacharparenright}\isanewline
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    70
\ \ {\isacharbar}\ Load\ a\ \ \ {\isasymRightarrow}\ exec\ is\ s\ {\isacharparenleft}{\isacharparenleft}s\ a{\isacharparenright}{\isacharhash}vs{\isacharparenright}\isanewline
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    71
\ \ {\isacharbar}\ Apply\ f\ \ {\isasymRightarrow}\ exec\ is\ s\ {\isacharparenleft}{\isacharparenleft}f\ {\isacharparenleft}hd\ vs{\isacharparenright}\ {\isacharparenleft}hd{\isacharparenleft}tl\ vs{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharhash}{\isacharparenleft}tl{\isacharparenleft}tl\ vs{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequote}\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    72
%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    73
\begin{isamarkuptext}%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    74
\noindent
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    75
Recall that \isa{hd} and \isa{tl}
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    76
return the first element and the remainder of a list.
11458
09a6c44a48ea numerous stylistic changes and indexing
paulson
parents: 11428
diff changeset
    77
Because all functions are total, \cdx{hd} is defined even for the empty
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    78
list, although we do not know what the result is. Thus our model of the
10795
9e888d60d3e5 minor edits to Chapters 1-3
paulson
parents: 10395
diff changeset
    79
machine always terminates properly, although the definition above does not
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    80
tell us much about the result in situations where \isa{Apply} was executed
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    81
with fewer than two elements on the stack.
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    82
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    83
The compiler is a function from expressions to a list of instructions. Its
10795
9e888d60d3e5 minor edits to Chapters 1-3
paulson
parents: 10395
diff changeset
    84
definition is obvious:%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    85
\end{isamarkuptext}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    86
\isamarkuptrue%
9673
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    87
\isacommand{consts}\ comp\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}v{\isacharparenright}expr\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}v{\isacharparenright}instr\ list{\isachardoublequote}\isanewline
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    88
\isamarkupfalse%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    89
\isacommand{primrec}\isanewline
9673
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    90
{\isachardoublequote}comp\ {\isacharparenleft}Cex\ v{\isacharparenright}\ \ \ \ \ \ \ {\isacharequal}\ {\isacharbrackleft}Const\ v{\isacharbrackright}{\isachardoublequote}\isanewline
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
    91
{\isachardoublequote}comp\ {\isacharparenleft}Vex\ a{\isacharparenright}\ \ \ \ \ \ \ {\isacharequal}\ {\isacharbrackleft}Load\ a{\isacharbrackright}{\isachardoublequote}\isanewline
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    92
{\isachardoublequote}comp\ {\isacharparenleft}Bex\ f\ e{\isadigit{1}}\ e{\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}comp\ e{\isadigit{2}}{\isacharparenright}\ {\isacharat}\ {\isacharparenleft}comp\ e{\isadigit{1}}{\isacharparenright}\ {\isacharat}\ {\isacharbrackleft}Apply\ f{\isacharbrackright}{\isachardoublequote}\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    93
%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    94
\begin{isamarkuptext}%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    95
Now we have to prove the correctness of the compiler, i.e.\ that the
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    96
execution of a compiled expression results in the value of the expression:%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
    97
\end{isamarkuptext}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
    98
\isamarkuptrue%
13778
61272514e3b5 auto-update
paulson
parents: 13758
diff changeset
    99
\isacommand{theorem}\ {\isachardoublequote}exec\ {\isacharparenleft}comp\ e{\isacharparenright}\ s\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ {\isacharbrackleft}value\ e\ s{\isacharbrackright}{\isachardoublequote}\isanewline
61272514e3b5 auto-update
paulson
parents: 13758
diff changeset
   100
\isamarkupfalse%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   101
\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   102
%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   103
\begin{isamarkuptext}%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   104
\noindent
11458
09a6c44a48ea numerous stylistic changes and indexing
paulson
parents: 11428
diff changeset
   105
This theorem needs to be generalized:%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   106
\end{isamarkuptext}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   107
\isamarkuptrue%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   108
\isacommand{theorem}\ {\isachardoublequote}{\isasymforall}vs{\isachardot}\ exec\ {\isacharparenleft}comp\ e{\isacharparenright}\ s\ vs\ {\isacharequal}\ {\isacharparenleft}value\ e\ s{\isacharparenright}\ {\isacharhash}\ vs{\isachardoublequote}\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   109
%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   110
\begin{isamarkuptxt}%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   111
\noindent
11458
09a6c44a48ea numerous stylistic changes and indexing
paulson
parents: 11428
diff changeset
   112
It will be proved by induction on \isa{e} followed by simplification.  
09a6c44a48ea numerous stylistic changes and indexing
paulson
parents: 11428
diff changeset
   113
First, we must prove a lemma about executing the concatenation of two
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   114
instruction sequences:%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   115
\end{isamarkuptxt}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   116
\isamarkuptrue%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   117
\isamarkupfalse%
9673
1b2d4f995b13 updated;
wenzelm
parents: 9541
diff changeset
   118
\isacommand{lemma}\ exec{\isacharunderscore}app{\isacharbrackleft}simp{\isacharbrackright}{\isacharcolon}\isanewline
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   119
\ \ {\isachardoublequote}{\isasymforall}vs{\isachardot}\ exec\ {\isacharparenleft}xs{\isacharat}ys{\isacharparenright}\ s\ vs\ {\isacharequal}\ exec\ ys\ s\ {\isacharparenleft}exec\ xs\ s\ vs{\isacharparenright}{\isachardoublequote}\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   120
%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   121
\begin{isamarkuptxt}%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   122
\noindent
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   123
This requires induction on \isa{xs} and ordinary simplification for the
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   124
base cases. In the induction step, simplification leaves us with a formula
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   125
that contains two \isa{case}-expressions over instructions. Thus we add
11458
09a6c44a48ea numerous stylistic changes and indexing
paulson
parents: 11428
diff changeset
   126
automatic case splitting, which finishes the proof:%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   127
\end{isamarkuptxt}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   128
\isamarkuptrue%
13778
61272514e3b5 auto-update
paulson
parents: 13758
diff changeset
   129
\isacommand{apply}{\isacharparenleft}induct{\isacharunderscore}tac\ xs{\isacharcomma}\ simp{\isacharcomma}\ simp\ split{\isacharcolon}\ instr{\isachardot}split{\isacharparenright}\isanewline
61272514e3b5 auto-update
paulson
parents: 13758
diff changeset
   130
\isamarkupfalse%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   131
\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   132
%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   133
\begin{isamarkuptext}%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   134
\noindent
11428
332347b9b942 tidying the index
paulson
parents: 10971
diff changeset
   135
Note that because both \methdx{simp_all} and \methdx{auto} perform simplification, they can
332347b9b942 tidying the index
paulson
parents: 10971
diff changeset
   136
be modified in the same way as \isa{simp}.  Thus the proof can be
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   137
rewritten as%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   138
\end{isamarkuptext}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   139
\isamarkuptrue%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   140
\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   141
\isamarkupfalse%
13778
61272514e3b5 auto-update
paulson
parents: 13758
diff changeset
   142
\isacommand{apply}{\isacharparenleft}induct{\isacharunderscore}tac\ xs{\isacharcomma}\ simp{\isacharunderscore}all\ split{\isacharcolon}\ instr{\isachardot}split{\isacharparenright}\isanewline
61272514e3b5 auto-update
paulson
parents: 13758
diff changeset
   143
\isamarkupfalse%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   144
\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   145
%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   146
\begin{isamarkuptext}%
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   147
\noindent
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   148
Although this is more compact, it is less clear for the reader of the proof.
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   149
8771
026f37a86ea7 *** empty log message ***
nipkow
parents: 8746
diff changeset
   150
We could now go back and prove \isa{exec (comp e) s [] = [value e s]}
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   151
merely by simplification with the generalized version we just proved.
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   152
However, this is unnecessary because the generalized version fully subsumes
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   153
its instance.%
11458
09a6c44a48ea numerous stylistic changes and indexing
paulson
parents: 11428
diff changeset
   154
\index{compiling expressions example|)}%
8746
ccbb5e0dccdf Adding generated files.
nipkow
parents:
diff changeset
   155
\end{isamarkuptext}%
11866
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   156
\isamarkuptrue%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   157
\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   158
\isamarkupfalse%
fbd097aec213 updated;
wenzelm
parents: 11458
diff changeset
   159
\isamarkupfalse%
9722
a5f86aed785b *** empty log message ***
nipkow
parents: 9721
diff changeset
   160
\end{isabellebody}%
9145
9f7b8de5bfaf updated;
wenzelm
parents: 8771
diff changeset
   161
%%% Local Variables:
9f7b8de5bfaf updated;
wenzelm
parents: 8771
diff changeset
   162
%%% mode: latex
9f7b8de5bfaf updated;
wenzelm
parents: 8771
diff changeset
   163
%%% TeX-master: "root"
9f7b8de5bfaf updated;
wenzelm
parents: 8771
diff changeset
   164
%%% End: