src/HOL/ex/Exceptions.thy
author wenzelm
Wed, 09 Jun 2004 18:52:42 +0200
changeset 14898 a25550451b51
parent 14569 78b75a9eec01
permissions -rw-r--r--
Url.File;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14569
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/ex/Exceptions.thy
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
     2
    ID:         $Id$
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
     3
    Author:     Tobias Nipkow
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
     4
    Copyright   2004 TU Muenchen
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
     5
*)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
     6
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
     7
header {* Compiling exception handling *}
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
     8
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
     9
theory Exceptions = List_Prefix:
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    10
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    11
text{* This is a formalization of \cite{HuttonW04}. *}
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    12
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    13
subsection{*The source language*}
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    14
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    15
datatype expr = Val int | Add expr expr | Throw | Catch expr expr
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    16
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    17
consts eval :: "expr \<Rightarrow> int option"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    18
primrec
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    19
"eval (Val i) = Some i"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    20
"eval (Add x y) =
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    21
 (case eval x of None \<Rightarrow> None
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    22
  | Some i \<Rightarrow> (case eval y of None \<Rightarrow> None
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    23
               | Some j \<Rightarrow> Some(i+j)))"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    24
"eval Throw = None"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    25
"eval (Catch x h) = (case eval x of None \<Rightarrow> eval h | Some i \<Rightarrow> Some i)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    26
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    27
subsection{*The target language*}
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    28
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    29
datatype instr =
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    30
  Push int | ADD | THROW | Mark nat | Unmark | Label nat | Jump nat
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    31
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    32
datatype item = VAL int | HAN nat
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    33
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    34
types code = "instr list"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    35
      stack = "item list"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    36
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    37
consts
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    38
  exec2 :: "bool * code * stack \<Rightarrow> stack"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    39
  jump :: "nat * code \<Rightarrow> code"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    40
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    41
recdef jump "measure(%(l,cs). size cs)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    42
"jump(l,[]) = []"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    43
"jump(l, Label l' # cs) = (if l = l' then cs else jump(l,cs))"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    44
"jump(l, c # cs) = jump(l,cs)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    45
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    46
lemma size_jump1: "size (jump (l, cs)) < Suc(size cs)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    47
apply(induct cs)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    48
 apply simp
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    49
apply(case_tac a)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    50
apply auto
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    51
done
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    52
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    53
lemma size_jump2: "size (jump (l, cs)) < size cs \<or> jump(l,cs) = cs"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    54
apply(induct cs)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    55
 apply simp
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    56
apply(case_tac a)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    57
apply auto
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    58
done
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    59
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    60
syntax
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    61
  exec   :: "code \<Rightarrow> stack \<Rightarrow> stack"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    62
  unwind :: "code \<Rightarrow> stack \<Rightarrow> stack"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    63
translations
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    64
  "exec cs s" == "exec2(True,cs,s)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    65
  "unwind cs s" == "exec2(False,cs,s)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    66
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    67
recdef exec2
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    68
 "inv_image (measure(%cs. size cs) <*lex*> measure(%s. size s))
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    69
            (%(b,cs,s). (cs,s))"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    70
"exec [] s = s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    71
"exec (Push i#cs) s = exec cs (VAL i # s)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    72
"exec (ADD#cs) (VAL j # VAL i # s) = exec cs (VAL(i+j) # s)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    73
"exec (THROW#cs) s = unwind cs s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    74
"exec (Mark l#cs) s = exec cs (HAN l # s)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    75
"exec (Unmark#cs) (v # HAN l # s) = exec cs (v # s)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    76
"exec (Label l#cs) s = exec cs s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    77
"exec (Jump l#cs) s = exec (jump(l,cs)) s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    78
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    79
"unwind cs [] = []"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    80
"unwind cs (VAL i # s) = unwind cs s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    81
"unwind cs (HAN l # s) = exec (jump(l,cs)) s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    82
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    83
(hints recdef_simp: size_jump1 size_jump2)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    84
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    85
subsection{*The compiler*}
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    86
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    87
consts
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    88
  compile :: "nat \<Rightarrow> expr \<Rightarrow> code * nat"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    89
primrec
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    90
"compile l (Val i) = ([Push i], l)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    91
"compile l (Add x y) = (let (xs,m) = compile l x; (ys,n) = compile m y
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    92
                     in (xs @ ys @ [ADD], n))"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    93
"compile l Throw = ([THROW],l)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    94
"compile l (Catch x h) =
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    95
  (let (xs,m) = compile (l+2) x; (hs,n) = compile m h
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    96
   in (Mark l # xs @ [Unmark, Jump (l+1), Label l] @ hs @ [Label(l+1)], n))"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    97
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    98
syntax cmp :: "nat \<Rightarrow> expr \<Rightarrow> code"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
    99
translations "cmp l e" == "fst(compile l e)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   100
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   101
consts
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   102
  isFresh :: "nat \<Rightarrow> stack \<Rightarrow> bool"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   103
primrec
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   104
"isFresh l [] = True"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   105
"isFresh l (it#s) = (case it of VAL i \<Rightarrow> isFresh l s
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   106
                     | HAN l' \<Rightarrow> l' < l \<and> isFresh l s)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   107
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   108
constdefs
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   109
  conv :: "code \<Rightarrow> stack \<Rightarrow> int option \<Rightarrow> stack"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   110
 "conv cs s io == case io of None \<Rightarrow> unwind cs s
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   111
                  | Some i \<Rightarrow> exec cs (VAL i # s)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   112
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   113
subsection{* The proofs*}
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   114
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   115
declare
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   116
  conv_def[simp] option.splits[split] Let_def[simp]
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   117
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   118
lemma 3:
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   119
  "(\<And>l. c = Label l \<Longrightarrow> isFresh l s) \<Longrightarrow> unwind (c#cs) s = unwind cs s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   120
apply(induct s)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   121
 apply simp
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   122
apply(auto)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   123
apply(case_tac a)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   124
apply auto
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   125
apply(case_tac c)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   126
apply auto
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   127
done
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   128
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   129
corollary [simp]:
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   130
  "(!!l. c \<noteq> Label l) \<Longrightarrow> unwind (c#cs) s = unwind cs s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   131
by(blast intro: 3)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   132
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   133
corollary [simp]:
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   134
  "isFresh l s \<Longrightarrow> unwind (Label l#cs) s = unwind cs s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   135
by(blast intro: 3)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   136
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   137
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   138
lemma 5: "\<lbrakk> isFresh l s; l \<le> m \<rbrakk> \<Longrightarrow> isFresh m s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   139
apply(induct s)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   140
 apply simp
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   141
apply(auto split:item.split)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   142
done
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   143
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   144
corollary [simp]: "isFresh l s \<Longrightarrow> isFresh (Suc l) s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   145
by(auto intro:5)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   146
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   147
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   148
lemma 6: "\<And>l. l \<le> snd(compile l e)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   149
proof(induct e)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   150
  case Val thus ?case by simp
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   151
next
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   152
  case (Add x y)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   153
  have "l \<le> snd (compile l x)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   154
   and "snd (compile l x) \<le> snd (compile (snd (compile l x)) y)" .
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   155
  thus ?case by(simp_all add:split_def)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   156
next
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   157
  case Throw thus ?case by simp
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   158
next
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   159
  case (Catch x h)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   160
  have "l+2 \<le> snd (compile (l+2) x)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   161
   and "snd (compile (l+2) x) \<le> snd (compile (snd (compile (l+2) x)) h)" .
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   162
  thus ?case by(simp_all add:split_def)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   163
qed
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   164
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   165
corollary [simp]: "l < m \<Longrightarrow> l < snd(compile m e)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   166
using 6[where l = m and e = e] by auto
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   167
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   168
corollary [simp]: "isFresh l s \<Longrightarrow> isFresh (snd(compile l e)) s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   169
using 5 6 by blast
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   170
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   171
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   172
text{* Contrary to the order of the lemmas in the paper, lemma 4 needs the
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   173
above corollary of 5 and 6. *}
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   174
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   175
lemma 4 [simp]: "\<And>l cs. isFresh l s \<Longrightarrow> unwind (cmp l e @ cs) s = unwind cs s"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   176
by (induct e) (auto simp add:split_def)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   177
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   178
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   179
lemma 7[simp]: "\<And>m cs. l < m \<Longrightarrow> jump(l, cmp m e @ cs) = jump(l, cs)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   180
by (induct e) (simp_all add:split_def)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   181
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   182
text{* The compiler correctness theorem: *}
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   183
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   184
theorem "\<And>l s cs. isFresh l s \<Longrightarrow> exec (cmp l e @ cs) s = conv cs s (eval e)"
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   185
by(induct e)(auto simp add:split_def)
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   186
78b75a9eec01 Added ex/Exceptions.thy
nipkow
parents:
diff changeset
   187
end