src/HOL/MicroJava/Comp/CorrCompTp.thy
author haftmann
Tue, 24 Nov 2009 14:37:23 +0100
changeset 33954 1bc3b688548c
parent 33640 0d82107dc07a
child 35102 cc7a0b9f938c
permissions -rwxr-xr-x
backported parts of abstract byte code verifier from AFP/Jinja
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
     1
(*  Title:      HOL/MicroJava/Comp/CorrCompTp.thy
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
     2
    Author:     Martin Strecker
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
     3
*)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
     4
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15236
diff changeset
     5
theory CorrCompTp
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15236
diff changeset
     6
imports LemmasComp TypeInf "../BV/JVM" "../BV/Altern"
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15236
diff changeset
     7
begin
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
     8
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
     9
declare split_paired_All [simp del]
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    10
declare split_paired_Ex [simp del]
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    11
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    12
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    13
(**********************************************************************)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    14
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    15
constdefs     
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    16
   inited_LT :: "[cname, ty list, (vname \<times> ty) list] \<Rightarrow> locvars_type"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    17
  "inited_LT C pTs lvars == (OK (Class C))#((map OK pTs))@(map (Fun.comp OK snd) lvars)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    18
   is_inited_LT :: "[cname, ty list, (vname \<times> ty) list, locvars_type] \<Rightarrow> bool"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    19
  "is_inited_LT C pTs lvars LT == (LT = (inited_LT C pTs lvars))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    20
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    21
  local_env :: "[java_mb prog, cname, sig, vname list,(vname \<times> ty) list] \<Rightarrow> java_mb env"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    22
  "local_env G C S pns lvars == 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    23
     let (mn, pTs) = S in (G,map_of lvars(pns[\<mapsto>]pTs)(This\<mapsto>Class C))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    24
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    25
lemma local_env_fst [simp]: "fst (local_env G C S pns lvars) = G"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    26
by (simp add: local_env_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    27
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    28
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
    29
lemma wt_class_expr_is_class: "\<lbrakk> ws_prog G; E \<turnstile> expr :: Class cname;
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    30
  E = local_env G C (mn, pTs) pns lvars\<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    31
  \<Longrightarrow> is_class G cname "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    32
apply (subgoal_tac "((fst E), (snd E)) \<turnstile> expr :: Class cname")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    33
apply (frule ty_expr_is_type) apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    34
apply simp apply (simp (no_asm_use))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    35
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    36
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    37
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    38
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    39
(********************************************************************************)
13679
2ebad1cb045f fixed latex output
kleing
parents: 13676
diff changeset
    40
section "index"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    41
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    42
lemma local_env_snd: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    43
  snd (local_env G C (mn, pTs) pns lvars) = map_of lvars(pns[\<mapsto>]pTs)(This\<mapsto>Class C)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    44
by (simp add: local_env_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    45
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    46
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    47
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    48
lemma index_in_bounds: " length pns = length pTs \<Longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    49
  snd (local_env G C (mn, pTs) pns lvars) vname = Some T
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    50
       \<Longrightarrow> index (pns, lvars, blk, res) vname < length (inited_LT C pTs lvars)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    51
apply (simp add: local_env_snd index_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    52
apply (case_tac "vname = This")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    53
apply (simp add: inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    54
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    55
apply (drule map_of_upds_SomeD)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    56
apply (drule length_takeWhile)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    57
apply (simp add: inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    58
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    59
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    60
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    61
lemma map_upds_append [rule_format (no_asm)]: 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    62
  "\<forall> x1s m. (length k1s = length x1s 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    63
  \<longrightarrow> m(k1s[\<mapsto>]x1s)(k2s[\<mapsto>]x2s) = m ((k1s@k2s)[\<mapsto>](x1s@x2s)))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    64
apply (induct k1s)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    65
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    66
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    67
apply (subgoal_tac "\<exists> x xr. x1s = x # xr")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    68
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    69
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    70
  (* subgoal *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    71
apply (case_tac x1s)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    72
apply auto
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    73
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    74
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    75
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    76
lemma map_of_append [rule_format]: 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    77
  "\<forall> ys. (map_of ((rev xs) @ ys) = (map_of ys) ((map fst xs) [\<mapsto>] (map snd xs)))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    78
apply (induct xs)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    79
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    80
apply (rule allI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    81
apply (drule_tac x="a # ys" in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    82
apply (simp only: rev.simps append_assoc append_Cons append_Nil
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13679
diff changeset
    83
  map.simps map_of.simps map_upds_Cons hd.simps tl.simps)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    84
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    85
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    86
lemma map_of_as_map_upds: "map_of (rev xs) = empty ((map fst xs) [\<mapsto>] (map snd xs))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    87
by (rule map_of_append [of _ "[]", simplified])
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    88
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    89
lemma map_of_rev: "unique xs \<Longrightarrow> map_of (rev xs) = map_of xs"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    90
apply (induct xs)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    91
apply simp
14025
d9b155757dc8 *** empty log message ***
nipkow
parents: 13679
diff changeset
    92
apply (simp add: unique_def map_of_append map_of_as_map_upds [THEN sym]
d9b155757dc8 *** empty log message ***
nipkow
parents: 13679
diff changeset
    93
                 Map.map_of_append[symmetric] del:Map.map_of_append)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    94
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    95
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    96
lemma map_upds_rev [rule_format]: "\<forall> xs. (distinct ks \<longrightarrow> length ks = length xs 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    97
  \<longrightarrow> m (rev ks [\<mapsto>] rev xs) = m (ks [\<mapsto>] xs))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    98
apply (induct ks)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
    99
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   100
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   101
apply (subgoal_tac "\<exists> x xr. xs = x # xr")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   102
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   103
apply (drule_tac x=xr in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   104
apply (simp add: map_upds_append [THEN sym])
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   105
  (* subgoal *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   106
apply (case_tac xs)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   107
apply auto
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   108
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   109
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   110
lemma map_upds_takeWhile [rule_format]:
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   111
  "\<forall> ks. (empty(rev ks[\<mapsto>]rev xs)) k = Some x \<longrightarrow> length ks = length xs \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   112
    xs ! length (takeWhile (\<lambda>z. z \<noteq> k) ks) = x"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   113
apply (induct xs)
17778
93d7e524417a changes due to new neq_simproc in simpdata.ML
nipkow
parents: 15792
diff changeset
   114
 apply simp
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   115
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   116
apply (subgoal_tac "\<exists> k' kr. ks = k' # kr")
17778
93d7e524417a changes due to new neq_simproc in simpdata.ML
nipkow
parents: 15792
diff changeset
   117
 apply (clarify)
93d7e524417a changes due to new neq_simproc in simpdata.ML
nipkow
parents: 15792
diff changeset
   118
 apply (drule_tac x=kr in spec)
93d7e524417a changes due to new neq_simproc in simpdata.ML
nipkow
parents: 15792
diff changeset
   119
 apply (simp only: rev.simps)
93d7e524417a changes due to new neq_simproc in simpdata.ML
nipkow
parents: 15792
diff changeset
   120
 apply (subgoal_tac "(empty(rev kr @ [k'][\<mapsto>]rev xs @ [a])) = empty (rev kr[\<mapsto>]rev xs)([k'][\<mapsto>][a])")
93d7e524417a changes due to new neq_simproc in simpdata.ML
nipkow
parents: 15792
diff changeset
   121
  apply (simp split:split_if_asm)
93d7e524417a changes due to new neq_simproc in simpdata.ML
nipkow
parents: 15792
diff changeset
   122
 apply (simp add: map_upds_append [THEN sym])
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   123
apply (case_tac ks)
17778
93d7e524417a changes due to new neq_simproc in simpdata.ML
nipkow
parents: 15792
diff changeset
   124
 apply auto
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   125
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   126
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   127
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   128
lemma local_env_inited_LT: "\<lbrakk> snd (local_env G C (mn, pTs) pns lvars) vname = Some T;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   129
  length pns = length pTs; distinct pns; unique lvars \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   130
  \<Longrightarrow> (inited_LT C pTs lvars ! index (pns, lvars, blk, res) vname) = OK T"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   131
apply (simp add: local_env_snd index_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   132
apply (case_tac "vname = This")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   133
apply (simp add: inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   134
apply (simp add: inited_LT_def)
33640
0d82107dc07a Remove map_compose, replaced by map_map
hoelzl
parents: 32960
diff changeset
   135
apply (simp (no_asm_simp) only: map_map [symmetric] map_append [symmetric] map.simps [symmetric])
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   136
apply (subgoal_tac "length (takeWhile (\<lambda>z. z \<noteq> vname) (pns @ map fst lvars)) < length (pTs @ map snd lvars)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   137
apply (simp (no_asm_simp) only: List.nth_map ok_val.simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   138
apply (subgoal_tac "map_of lvars = map_of (map (\<lambda> p. (fst p, snd p)) lvars)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   139
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   140
apply (subgoal_tac "distinct (map fst lvars)") 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   141
apply (frule_tac g=snd in AuxLemmas.map_of_map_as_map_upd)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   142
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   143
apply (simp add: map_upds_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   144
apply (frule map_upds_SomeD)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   145
apply (rule map_upds_takeWhile)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   146
apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   147
apply (simp add: map_upds_append [THEN sym])
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   148
apply (simp add: map_upds_rev)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   149
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   150
  (* show length (pns @ map fst lvars) = length (pTs @ map snd lvars) *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   151
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   152
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   153
  (* show distinct (map fst lvars) *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   154
apply (simp only: unique_def Fun.comp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   155
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   156
  (* show map_of lvars = map_of (map (\<lambda>p. (fst p, snd p)) lvars) *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   157
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   158
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   159
  (* show length (takeWhile (\<lambda>z. z \<noteq> vname) (pns @ map fst lvars)) < length (pTs @ map snd lvars) *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   160
apply (drule map_of_upds_SomeD)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   161
apply (drule length_takeWhile)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   162
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   163
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   164
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   165
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   166
lemma inited_LT_at_index_no_err: " i < length (inited_LT C pTs lvars)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   167
  \<Longrightarrow> inited_LT C pTs lvars ! i \<noteq> Err"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   168
apply (simp only: inited_LT_def)
33640
0d82107dc07a Remove map_compose, replaced by map_map
hoelzl
parents: 32960
diff changeset
   169
apply (simp only: map_map [symmetric] map_append [symmetric] map.simps [symmetric] length_map)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   170
apply (simp only: nth_map)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   171
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   172
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   173
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   174
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   175
lemma sup_loc_update_index: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   176
  \<lbrakk> G \<turnstile> T \<preceq> T'; is_type G T'; length pns = length pTs; distinct pns; unique lvars;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   177
  snd (local_env G C (mn, pTs) pns lvars) vname = Some T' \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   178
  \<Longrightarrow> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   179
  comp G \<turnstile> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   180
  inited_LT C pTs lvars [index (pns, lvars, blk, res) vname := OK T] <=l 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   181
  inited_LT C pTs lvars"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   182
apply (subgoal_tac " index (pns, lvars, blk, res) vname < length (inited_LT C pTs lvars)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   183
apply (frule_tac blk=blk and res=res in local_env_inited_LT, assumption+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   184
apply (rule sup_loc_trans)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   185
apply (rule_tac b="OK T'" in sup_loc_update)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   186
apply (simp add: comp_widen) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   187
apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   188
apply (rule sup_loc_refl)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   189
apply (simp add: list_update_same_conv [THEN iffD2])
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   190
  (* subgoal *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   191
apply (rule index_in_bounds)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   192
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   193
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   194
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   195
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   196
(********************************************************************************)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   197
13679
2ebad1cb045f fixed latex output
kleing
parents: 13676
diff changeset
   198
section "Preservation of ST and LT by compTpExpr / compTpStmt"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   199
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   200
lemma sttp_of_comb_nil [simp]: "sttp_of (comb_nil sttp) = sttp"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   201
by (simp add: comb_nil_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   202
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   203
lemma mt_of_comb_nil [simp]: "mt_of (comb_nil sttp) = []"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   204
by (simp add: comb_nil_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   205
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   206
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   207
lemma sttp_of_comb [simp]: "sttp_of ((f1 \<box> f2) sttp) = sttp_of (f2 (sttp_of (f1 sttp)))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   208
apply (case_tac "f1 sttp")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   209
apply (case_tac "(f2 (sttp_of (f1 sttp)))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   210
apply (simp add: comb_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   211
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   212
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   213
lemma mt_of_comb: "(mt_of ((f1 \<box> f2) sttp)) = 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   214
  (mt_of (f1 sttp)) @ (mt_of (f2 (sttp_of (f1 sttp))))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   215
by (simp add: comb_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   216
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   217
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   218
lemma mt_of_comb_length [simp]: "\<lbrakk> n1 = length (mt_of (f1 sttp)); n1 \<le> n \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   219
  \<Longrightarrow> (mt_of ((f1 \<box> f2) sttp) ! n) = (mt_of (f2 (sttp_of (f1 sttp))) ! (n - n1))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   220
by (simp add: comb_def nth_append split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   221
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   222
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   223
lemma compTpExpr_Exprs_LT_ST: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   224
  \<lbrakk>jmb = (pns, lvars, blk, res); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   225
  wf_prog wf_java_mdecl G;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   226
  wf_java_mdecl G C ((mn, pTs), rT, jmb);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   227
  E = local_env G C (mn, pTs) pns lvars \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   228
 \<Longrightarrow> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   229
  (\<forall> ST LT T. 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   230
  E \<turnstile> ex :: T \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   231
  is_inited_LT C pTs lvars LT \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   232
  sttp_of (compTpExpr jmb G ex (ST, LT)) = (T # ST, LT))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   233
 \<and>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   234
 (\<forall> ST LT Ts. 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   235
  E \<turnstile> exs [::] Ts \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   236
  is_inited_LT C pTs lvars LT \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   237
  sttp_of (compTpExprs jmb G exs (ST, LT)) = ((rev Ts) @ ST, LT))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   238
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   239
apply (rule expr.induct)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   240
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   241
(* expresssions *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   242
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   243
(* NewC *) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   244
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   245
apply (drule NewC_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   246
apply (simp add: pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   247
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   248
(* Cast *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   249
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   250
apply (drule Cast_invers, clarify)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   251
apply ((drule_tac x=ST in spec), (drule spec)+, (drule mp, assumption)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   252
apply (simp add: replST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   253
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   254
(* Lit *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   255
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   256
apply (drule Lit_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   257
apply (simp add: pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   258
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   259
(* BinOp *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   260
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   261
apply (drule BinOp_invers, clarify)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   262
apply (drule_tac x=ST in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   263
apply (drule_tac x="Ta # ST" in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   264
apply ((drule spec)+, (drule mp, assumption)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   265
  apply (case_tac binop)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   266
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   267
    apply (simp (no_asm_simp) add: popST_def pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   268
  apply (simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   269
    apply (simp (no_asm_simp) add: replST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   270
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   271
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   272
(* LAcc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   273
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   274
apply (drule LAcc_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   275
apply (simp add: pushST_def is_inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   276
apply (simp add: wf_prog_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   277
apply (frule wf_java_mdecl_disjoint_varnames) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   278
  apply (simp add: disjoint_varnames_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   279
apply (frule wf_java_mdecl_length_pTs_pns)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   280
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   281
apply (simp (no_asm_simp) add: local_env_inited_LT)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   282
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   283
(* LAss *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   284
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   285
apply (drule LAss_invers, clarify)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   286
apply (drule LAcc_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   287
apply ((drule_tac x=ST in spec), (drule spec)+, (drule mp, assumption)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   288
apply (simp add: popST_def dupST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   289
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   290
(* FAcc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   291
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   292
apply (drule FAcc_invers, clarify)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   293
apply ((drule_tac x=ST in spec), (drule spec)+, (drule mp, assumption)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   294
apply (simp add: replST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   295
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   296
  (* show   snd (the (field (G, cname) vname)) = T *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   297
  apply (subgoal_tac "is_class G Ca")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   298
  apply (subgoal_tac "is_class G cname \<and> field (G, cname) vname = Some (cname, T)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   299
  apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   300
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   301
  (* show is_class G cname \<and> field (G, cname) vname = Some (cname, T) *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   302
  apply (rule field_in_fd) apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   303
  (* show is_class G Ca *)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
   304
  apply (fast intro: wt_class_expr_is_class)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   305
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   306
(* FAss *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   307
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   308
apply (drule FAss_invers, clarify)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   309
apply (drule FAcc_invers, clarify)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   310
apply (drule_tac x=ST in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   311
apply (drule_tac x="Class Ca # ST" in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   312
apply ((drule spec)+, (drule mp, assumption)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   313
apply (simp add: popST_def dup_x1ST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   314
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   315
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   316
(* Call *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   317
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   318
apply (drule Call_invers, clarify)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   319
apply (drule_tac x=ST in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   320
apply (drule_tac x="Class cname # ST" in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   321
apply ((drule spec)+, (drule mp, assumption)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   322
apply (simp add: replST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   323
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   324
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   325
(* expression lists *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   326
(* nil *) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   327
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   328
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   329
apply (drule Nil_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   330
apply (simp add: comb_nil_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   331
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   332
(* cons *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   333
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   334
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   335
apply (drule Cons_invers, clarify)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   336
apply (drule_tac x=ST in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   337
apply (drule_tac x="T # ST" in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   338
apply ((drule spec)+, (drule mp, assumption)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   339
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   340
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   341
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   342
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   343
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   344
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   345
lemmas compTpExpr_LT_ST [rule_format (no_asm)] = 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   346
  compTpExpr_Exprs_LT_ST [THEN conjunct1]
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   347
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   348
lemmas compTpExprs_LT_ST [rule_format (no_asm)] = 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   349
  compTpExpr_Exprs_LT_ST [THEN conjunct2]
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   350
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   351
lemma compTpStmt_LT_ST [rule_format (no_asm)]: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   352
  \<lbrakk> jmb = (pns,lvars,blk,res); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   353
  wf_prog wf_java_mdecl G;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   354
  wf_java_mdecl G C ((mn, pTs), rT, jmb);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   355
  E = (local_env G C (mn, pTs) pns lvars)\<rbrakk> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   356
\<Longrightarrow> (\<forall> ST LT.
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   357
  E \<turnstile> s\<surd> \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   358
  (is_inited_LT C pTs lvars LT)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   359
\<longrightarrow> sttp_of (compTpStmt jmb G s (ST, LT)) = (ST, LT))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   360
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   361
apply (rule stmt.induct)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   362
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   363
(* Skip *) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   364
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   365
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   366
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   367
(* Expr *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   368
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   369
apply (drule Expr_invers, erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   370
apply (simp (no_asm_simp) add: compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   371
apply (frule_tac ST=ST in compTpExpr_LT_ST, assumption+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   372
apply (simp add: popST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   373
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   374
(* Comp *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   375
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   376
apply (drule Comp_invers, clarify)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   377
apply (simp (no_asm_use))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   378
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   379
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   380
(* Cond *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   381
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   382
apply (drule Cond_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   383
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   384
apply (drule_tac x=ST in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   385
apply (drule_tac x=ST in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   386
apply (drule spec)+ apply (drule mp, assumption)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   387
apply (drule_tac ST="PrimT Boolean # ST" in compTpExpr_LT_ST, assumption+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   388
apply (simp add: popST_def pushST_def nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   389
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   390
(* Loop *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   391
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   392
apply (drule Loop_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   393
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   394
apply (drule_tac x=ST in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   395
apply (drule spec)+ apply (drule mp, assumption)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   396
apply (drule_tac ST="PrimT Boolean # ST" in compTpExpr_LT_ST, assumption+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   397
apply (simp add: popST_def pushST_def nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   398
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   399
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   400
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   401
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   402
lemma compTpInit_LT_ST: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   403
  sttp_of (compTpInit jmb (vn,ty) (ST, LT)) = (ST, LT[(index jmb vn):= OK ty])"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   404
by (simp add: compTpInit_def storeST_def pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   405
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   406
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   407
lemma compTpInitLvars_LT_ST_aux [rule_format (no_asm)]:
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   408
  "\<forall> pre lvars_pre lvars0.
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   409
  jmb = (pns,lvars0,blk,res) \<and>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   410
  lvars0 = (lvars_pre @ lvars) \<and>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   411
  (length pns) + (length lvars_pre) + 1 = length pre \<and>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   412
  disjoint_varnames pns (lvars_pre @ lvars)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   413
  \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   414
sttp_of (compTpInitLvars jmb lvars (ST, pre @ replicate (length lvars) Err))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   415
    = (ST, pre @ map (Fun.comp OK snd) lvars)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   416
apply (induct lvars)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   417
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   418
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   419
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   420
apply (subgoal_tac "\<exists> vn ty. a = (vn, ty)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   421
  prefer 2 apply (simp (no_asm_simp)) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   422
  apply ((erule exE)+, simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   423
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   424
apply (drule_tac x="pre @ [OK ty]" in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   425
apply (drule_tac x="lvars_pre @ [a]" in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   426
apply (drule_tac x="lvars0" in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   427
apply (simp add: compTpInit_LT_ST index_of_var2)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   428
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   429
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   430
lemma compTpInitLvars_LT_ST: 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   431
  "\<lbrakk> jmb = (pns, lvars, blk, res); wf_java_mdecl G C ((mn, pTs), rT, jmb) \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   432
\<Longrightarrow>(sttp_of (compTpInitLvars jmb lvars (ST, start_LT C pTs (length lvars))))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   433
  = (ST, inited_LT C pTs lvars)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   434
apply (simp add: start_LT_def inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   435
apply (simp only: append_Cons [THEN sym])
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   436
apply (rule compTpInitLvars_LT_ST_aux)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   437
apply (auto dest: wf_java_mdecl_length_pTs_pns wf_java_mdecl_disjoint_varnames)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   438
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   439
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   440
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   441
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   442
(********************************************************************************)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   443
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   444
lemma max_of_list_elem: "x \<in> set xs \<Longrightarrow> x \<le> (max_of_list xs)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   445
by (induct xs, auto intro: le_maxI1 simp: le_max_iff_disj max_of_list_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   446
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   447
lemma max_of_list_sublist: "set xs \<subseteq> set ys 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   448
  \<Longrightarrow> (max_of_list xs) \<le> (max_of_list ys)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   449
by (induct xs, auto dest: max_of_list_elem simp: max_of_list_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   450
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   451
lemma max_of_list_append [simp]:
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   452
  "max_of_list (xs @ ys) = max (max_of_list xs) (max_of_list ys)" 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   453
apply (simp add: max_of_list_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   454
apply (induct xs)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   455
apply simp
31082
54a442b2d727 interface changes in linarith.ML
haftmann
parents: 30235
diff changeset
   456
using [[linarith_split_limit = 0]]
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   457
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   458
apply arith
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   459
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   460
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   461
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   462
lemma app_mono_mxs: "\<lbrakk> app i G mxs rT pc et s; mxs \<le> mxs' \<rbrakk> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   463
  \<Longrightarrow> app i G mxs' rT pc et s"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   464
apply (case_tac s)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   465
apply (simp add: app_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   466
apply (case_tac i)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   467
apply (auto intro: less_trans)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   468
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   469
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   470
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   471
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   472
lemma err_mono [simp]: "A \<subseteq> B \<Longrightarrow> err A \<subseteq> err B"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   473
by (auto simp: err_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   474
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   475
lemma opt_mono [simp]: "A \<subseteq> B \<Longrightarrow> opt A \<subseteq> opt B"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   476
by (auto simp: opt_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   477
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   478
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   479
lemma states_mono: "\<lbrakk> mxs \<le> mxs' \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   480
  \<Longrightarrow> states G mxs mxr \<subseteq> states G mxs' mxr"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   481
apply (simp add: states_def JVMType.sl_def)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
   482
apply (simp add: Product.esl_def stk_esl_def reg_sl_def 
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
   483
  upto_esl_def Listn.sl_def Err.sl_def  JType.esl_def)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   484
apply (simp add: Err.esl_def Err.le_def Listn.le_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   485
apply (simp add: Product.le_def Product.sup_def Err.sup_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   486
apply (simp add: Opt.esl_def Listn.sup_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   487
apply (rule err_mono)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   488
apply (rule opt_mono)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   489
apply (rule Sigma_mono)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   490
apply (rule Union_mono)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   491
apply auto 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   492
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   493
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   494
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   495
lemma check_type_mono: "\<lbrakk> check_type G mxs mxr s; mxs \<le> mxs' \<rbrakk> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   496
  \<Longrightarrow> check_type G mxs' mxr s"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   497
apply (simp add: check_type_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   498
apply (frule_tac G=G and mxr=mxr in states_mono)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   499
apply auto
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   500
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   501
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   502
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   503
  (* wt is preserved when adding instructions/state-types at the end *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   504
lemma wt_instr_prefix: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   505
 \<lbrakk> wt_instr_altern (bc ! pc) cG rT mt mxs mxr max_pc et pc; 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   506
  bc' = bc @ bc_post; mt' = mt @ mt_post; 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   507
  mxs \<le> mxs'; max_pc \<le> max_pc'; 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   508
  pc < length bc; pc < length mt; 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   509
  max_pc = (length mt)\<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   510
\<Longrightarrow> wt_instr_altern (bc' ! pc) cG rT mt' mxs' mxr max_pc' et pc"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   511
apply (simp add: wt_instr_altern_def nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   512
apply (auto intro: app_mono_mxs check_type_mono)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   513
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   514
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   515
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   516
(************************************************************************)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   517
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   518
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   519
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   520
lemma pc_succs_shift: "pc'\<in>set (succs i (pc'' + n))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   521
 \<Longrightarrow> ((pc' - n) \<in>set (succs i pc''))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   522
apply (induct i)
23315
df3a7e9ebadb tuned Proof
chaieb
parents: 23022
diff changeset
   523
apply simp_all
df3a7e9ebadb tuned Proof
chaieb
parents: 23022
diff changeset
   524
apply arith
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   525
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   526
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   527
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   528
lemma pc_succs_le: "\<lbrakk> pc' \<in> set (succs i (pc'' + n));   
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   529
  \<forall> b. ((i = (Goto b) \<or> i=(Ifcmpeq b)) \<longrightarrow> 0 \<le> (int pc'' + b)) \<rbrakk> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   530
  \<Longrightarrow> n \<le> pc'"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   531
apply (induct i)
23315
df3a7e9ebadb tuned Proof
chaieb
parents: 23022
diff changeset
   532
apply simp_all
df3a7e9ebadb tuned Proof
chaieb
parents: 23022
diff changeset
   533
apply arith
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   534
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   535
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   536
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   537
(**********************************************************************)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   538
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   539
constdefs
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   540
  offset_xcentry :: "[nat, exception_entry] \<Rightarrow> exception_entry"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   541
  "offset_xcentry == 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   542
      \<lambda> n (start_pc, end_pc, handler_pc, catch_type).
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   543
          (start_pc + n, end_pc + n, handler_pc + n, catch_type)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   544
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   545
  offset_xctable :: "[nat, exception_table] \<Rightarrow> exception_table"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   546
  "offset_xctable n == (map (offset_xcentry n))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   547
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   548
lemma match_xcentry_offset [simp]: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   549
  match_exception_entry G cn (pc + n) (offset_xcentry n ee) = 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   550
  match_exception_entry G cn pc ee"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   551
by (simp add: match_exception_entry_def offset_xcentry_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   552
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   553
lemma match_xctable_offset: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   554
  (match_exception_table G cn (pc + n) (offset_xctable n et)) =
30235
58d147683393 Made Option a separate theory and renamed option_map to Option.map
nipkow
parents: 24110
diff changeset
   555
  (Option.map (\<lambda> pc'. pc' + n) (match_exception_table G cn pc et))"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   556
apply (induct et)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   557
apply (simp add: offset_xctable_def)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   558
apply (case_tac "match_exception_entry G cn pc a")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   559
apply (simp add: offset_xcentry_def split_beta)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   560
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   561
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   562
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   563
lemma match_offset [simp]: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   564
  match G cn (pc + n) (offset_xctable n et) = match G cn pc et"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   565
apply (induct et)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   566
apply (simp add: offset_xctable_def)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   567
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   568
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   569
lemma match_any_offset [simp]: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   570
  match_any G (pc + n) (offset_xctable n et) = match_any G pc et"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   571
apply (induct et)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   572
apply (simp add: offset_xctable_def offset_xcentry_def split_beta)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   573
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   574
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   575
lemma app_mono_pc: "\<lbrakk> app i G mxs rT pc et s; pc'= pc + n \<rbrakk> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   576
  \<Longrightarrow> app i G mxs rT pc' (offset_xctable n et) s"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   577
apply (case_tac s)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   578
apply (simp add: app_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   579
apply (case_tac i)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   580
apply (auto)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   581
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   582
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   583
(**********************************************************************)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   584
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   585
  (* Currently: empty exception_table *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   586
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   587
syntax
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   588
  empty_et :: exception_table
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   589
translations
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   590
  "empty_et" => "[]"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   591
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   592
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   593
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   594
  (* move into Effect.thy *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   595
lemma xcpt_names_Nil [simp]: "(xcpt_names (i, G, pc, [])) = []"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   596
by (induct i, simp_all)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   597
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   598
lemma xcpt_eff_Nil [simp]: "(xcpt_eff i G pc s []) = []"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   599
by (simp add: xcpt_eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   600
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   601
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   602
lemma app_jumps_lem: "\<lbrakk> app i cG mxs rT pc empty_et s; s=(Some st) \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   603
  \<Longrightarrow>  \<forall> b. ((i = (Goto b) \<or> i=(Ifcmpeq b)) \<longrightarrow> 0 \<le> (int pc + b))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   604
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   605
apply (induct i)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   606
apply auto
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   607
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   608
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   609
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   610
(* wt is preserved when adding instructions/state-types to the front *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   611
lemma wt_instr_offset: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   612
 \<lbrakk> \<forall> pc'' < length mt. 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   613
    wt_instr_altern ((bc@bc_post) ! pc'') cG rT (mt@mt_post) mxs mxr max_pc empty_et pc''; 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   614
  bc' = bc_pre @ bc @ bc_post; mt' = mt_pre @ mt @ mt_post; 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   615
  length bc_pre = length mt_pre; length bc = length mt;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   616
  length mt_pre \<le> pc; pc < length (mt_pre @ mt); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   617
  mxs \<le> mxs'; max_pc + length mt_pre \<le> max_pc' \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   618
\<Longrightarrow> wt_instr_altern (bc' ! pc) cG rT mt' mxs' mxr max_pc' empty_et pc"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   619
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   620
apply (simp add: wt_instr_altern_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   621
apply (subgoal_tac "\<exists> pc''. pc = pc'' + length mt_pre", erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   622
prefer 2 apply (rule_tac x="pc - length mt_pre" in exI, arith)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   623
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   624
apply (drule_tac x=pc'' in spec)
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32642
diff changeset
   625
apply (drule mp) apply arith    (* show pc'' < length mt *)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   626
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   627
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   628
apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   629
  (* app *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   630
  apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   631
  apply (rule app_mono_mxs)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   632
  apply (frule app_mono_pc) apply (rule HOL.refl) apply (simp add: offset_xctable_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   633
  apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   634
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   635
  (* check_type *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   636
apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   637
apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   638
apply (rule  check_type_mono) apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   639
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   640
  (* ..eff.. *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   641
apply (intro ballI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   642
apply (subgoal_tac "\<exists> pc' s'. x = (pc', s')", (erule exE)+, simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   643
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   644
apply (case_tac s')
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   645
  (* s' = None *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   646
apply (simp add: eff_def nth_append norm_eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   647
apply (frule_tac x="(pc', None)" and  f=fst and b=pc' in rev_image_eqI) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   648
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   649
  apply (simp only: fst_conv image_compose [THEN sym] Fun.comp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   650
  apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   651
  apply (frule pc_succs_shift)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   652
apply (drule bspec, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   653
apply arith
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   654
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   655
  (* s' = Some a *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   656
apply (drule_tac x="(pc' - length mt_pre, s')" in bspec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   657
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   658
  (* show  (pc' - length mt_pre, s') \<in> set (eff \<dots>) *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   659
apply (simp add: eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   660
    (* norm_eff *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   661
  apply (clarsimp simp: nth_append pc_succs_shift)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   662
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   663
  (* show P x of bspec *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   664
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   665
  apply (subgoal_tac "length mt_pre \<le> pc'")
20432
07ec57376051 lin_arith_prover: splitting reverted because of performance loss
webertj
parents: 20272
diff changeset
   666
  apply (simp add: nth_append) apply arith
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   667
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   668
  (* subgoals *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   669
apply (simp add: eff_def xcpt_eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   670
apply (clarsimp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   671
apply (rule pc_succs_le) apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   672
apply (subgoal_tac "\<exists> st. mt ! pc'' = Some st", erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   673
 apply (rule_tac s="Some st" and st=st and cG=cG and mxs=mxs and rT=rT
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   674
        in app_jumps_lem)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   675
  apply (simp add: nth_append)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   676
    (* subgoal \<exists> st. mt ! pc'' = Some st *)
30235
58d147683393 Made Option a separate theory and renamed option_map to Option.map
nipkow
parents: 24110
diff changeset
   677
  apply (simp add: norm_eff_def Option.map_def nth_append)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   678
  apply (case_tac "mt ! pc''")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   679
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   680
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   681
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   682
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   683
(**********************************************************************)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   684
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   685
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   686
constdefs
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   687
  start_sttp_resp_cons :: "[state_type \<Rightarrow> method_type \<times> state_type] \<Rightarrow> bool"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   688
  "start_sttp_resp_cons f == 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   689
     (\<forall> sttp. let (mt', sttp') = (f sttp) in (\<exists>mt'_rest. mt' = Some sttp # mt'_rest))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   690
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   691
  start_sttp_resp :: "[state_type \<Rightarrow> method_type \<times> state_type] \<Rightarrow> bool"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   692
  "start_sttp_resp f == (f = comb_nil) \<or> (start_sttp_resp_cons f)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   693
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   694
lemma start_sttp_resp_comb_nil [simp]: "start_sttp_resp comb_nil"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   695
by (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   696
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   697
lemma start_sttp_resp_cons_comb_cons [simp]: "start_sttp_resp_cons f 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   698
  \<Longrightarrow> start_sttp_resp_cons (f \<box> f')"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   699
apply (simp add: start_sttp_resp_cons_def comb_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   700
apply (rule allI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   701
apply (drule_tac x=sttp in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   702
apply auto
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   703
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   704
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   705
lemma start_sttp_resp_cons_comb_cons_r: "\<lbrakk> start_sttp_resp f; start_sttp_resp_cons f'\<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   706
  \<Longrightarrow> start_sttp_resp_cons (f \<box> f')"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   707
apply (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   708
apply (erule disjE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   709
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   710
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   711
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   712
lemma start_sttp_resp_cons_comb [simp]: "start_sttp_resp_cons f 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   713
  \<Longrightarrow> start_sttp_resp (f \<box> f')"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   714
by (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   715
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   716
lemma start_sttp_resp_comb: "\<lbrakk> start_sttp_resp f; start_sttp_resp f' \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   717
  \<Longrightarrow> start_sttp_resp (f \<box> f')"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   718
apply (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   719
apply (erule disjE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   720
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   721
apply (erule disjE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   722
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   723
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   724
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   725
lemma start_sttp_resp_cons_nochangeST [simp]: "start_sttp_resp_cons nochangeST"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   726
by (simp add: start_sttp_resp_cons_def nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   727
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   728
lemma start_sttp_resp_cons_pushST [simp]: "start_sttp_resp_cons (pushST Ts)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   729
by (simp add: start_sttp_resp_cons_def pushST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   730
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   731
lemma start_sttp_resp_cons_dupST [simp]: "start_sttp_resp_cons dupST"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   732
by (simp add: start_sttp_resp_cons_def dupST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   733
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   734
lemma start_sttp_resp_cons_dup_x1ST [simp]: "start_sttp_resp_cons dup_x1ST"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   735
by (simp add: start_sttp_resp_cons_def dup_x1ST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   736
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   737
lemma start_sttp_resp_cons_popST [simp]: "start_sttp_resp_cons (popST n)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   738
by (simp add: start_sttp_resp_cons_def popST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   739
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   740
lemma start_sttp_resp_cons_replST [simp]: "start_sttp_resp_cons (replST n tp)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   741
by (simp add: start_sttp_resp_cons_def replST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   742
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   743
lemma start_sttp_resp_cons_storeST [simp]: "start_sttp_resp_cons (storeST i tp)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   744
by (simp add: start_sttp_resp_cons_def storeST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   745
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   746
lemma start_sttp_resp_cons_compTpExpr [simp]: "start_sttp_resp_cons (compTpExpr jmb G ex)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   747
apply (induct ex)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   748
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   749
apply (simp add: start_sttp_resp_cons_def comb_def pushST_def split_beta) (* LAcc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   750
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   751
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   752
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   753
lemma start_sttp_resp_cons_compTpInit [simp]: "start_sttp_resp_cons (compTpInit jmb lv)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   754
by (simp add: compTpInit_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   755
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   756
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   757
lemma start_sttp_resp_nochangeST [simp]: "start_sttp_resp nochangeST"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   758
by (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   759
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   760
lemma start_sttp_resp_pushST [simp]: "start_sttp_resp (pushST Ts)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   761
by (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   762
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   763
lemma start_sttp_resp_dupST [simp]: "start_sttp_resp dupST"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   764
by (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   765
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   766
lemma start_sttp_resp_dup_x1ST [simp]: "start_sttp_resp dup_x1ST"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   767
by (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   768
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   769
lemma start_sttp_resp_popST [simp]: "start_sttp_resp (popST n)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   770
by (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   771
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   772
lemma start_sttp_resp_replST [simp]: "start_sttp_resp (replST n tp)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   773
by (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   774
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   775
lemma start_sttp_resp_storeST [simp]: "start_sttp_resp (storeST i tp)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   776
by (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   777
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   778
lemma start_sttp_resp_compTpExpr [simp]: "start_sttp_resp (compTpExpr jmb G ex)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   779
by (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   780
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   781
lemma start_sttp_resp_compTpExprs [simp]: "start_sttp_resp (compTpExprs jmb G exs)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   782
by (induct exs, (simp add: start_sttp_resp_comb)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   783
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   784
lemma start_sttp_resp_compTpStmt [simp]: "start_sttp_resp (compTpStmt jmb G s)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   785
by (induct s, (simp add: start_sttp_resp_comb)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   786
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   787
lemma start_sttp_resp_compTpInitLvars [simp]: "start_sttp_resp (compTpInitLvars jmb lvars)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   788
by (induct lvars, simp+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   789
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   790
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   791
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   792
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   793
  (* ********************************************************************** *)
13679
2ebad1cb045f fixed latex output
kleing
parents: 13676
diff changeset
   794
section "length of compExpr/ compTpExprs"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   795
  (* ********************************************************************** *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   796
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   797
lemma length_comb [simp]:  "length (mt_of ((f1 \<box> f2) sttp)) = 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   798
  length (mt_of (f1 sttp)) + length (mt_of (f2 (sttp_of (f1 sttp))))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   799
by (simp add: comb_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   800
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   801
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   802
lemma length_comb_nil [simp]: "length (mt_of (comb_nil sttp)) = 0"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   803
by (simp add: comb_nil_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   804
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   805
lemma length_nochangeST [simp]: "length (mt_of (nochangeST sttp)) = 1"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   806
by (simp add: nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   807
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   808
lemma length_pushST [simp]: "length (mt_of (pushST Ts sttp)) = 1"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   809
by (simp add: pushST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   810
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   811
lemma length_dupST [simp]: "length (mt_of (dupST sttp)) = 1"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   812
by (simp add: dupST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   813
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   814
lemma length_dup_x1ST [simp]: "length (mt_of (dup_x1ST sttp)) = 1"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   815
by (simp add: dup_x1ST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   816
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   817
lemma length_popST [simp]: "length (mt_of (popST n sttp)) = 1"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   818
by (simp add: popST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   819
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   820
lemma length_replST [simp]: "length (mt_of (replST n tp sttp)) = 1"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   821
by (simp add: replST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   822
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   823
lemma length_storeST [simp]: "length (mt_of (storeST i tp sttp)) = 1"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   824
by (simp add: storeST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   825
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   826
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   827
lemma length_compTpExpr_Exprs [rule_format]: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   828
  (\<forall> sttp. (length (mt_of (compTpExpr jmb G ex sttp)) = length (compExpr jmb ex)))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   829
  \<and> (\<forall> sttp. (length (mt_of (compTpExprs jmb G exs sttp)) = length (compExprs jmb exs)))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   830
apply (rule  expr.induct)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   831
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   832
apply (case_tac binop)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   833
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   834
apply (simp add: pushST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   835
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   836
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   837
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   838
lemma length_compTpExpr: "length (mt_of (compTpExpr jmb G ex sttp)) = length (compExpr jmb ex)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   839
by (rule length_compTpExpr_Exprs [THEN conjunct1 [THEN spec]])
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   840
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   841
lemma length_compTpExprs: "length (mt_of (compTpExprs jmb G exs sttp)) = length (compExprs jmb exs)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   842
by (rule length_compTpExpr_Exprs [THEN conjunct2 [THEN spec]])
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   843
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   844
lemma length_compTpStmt [rule_format]: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   845
  (\<forall> sttp. (length (mt_of (compTpStmt jmb G s sttp)) = length (compStmt jmb s)))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   846
apply (rule stmt.induct)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   847
apply (simp add: length_compTpExpr)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   848
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   849
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   850
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   851
lemma length_compTpInit: "length (mt_of (compTpInit jmb lv sttp)) = length (compInit jmb lv)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   852
by (simp add: compTpInit_def compInit_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   853
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   854
lemma length_compTpInitLvars [rule_format]: 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   855
  "\<forall> sttp. length (mt_of (compTpInitLvars jmb lvars sttp)) = length (compInitLvars jmb lvars)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   856
by (induct lvars,  (simp add: compInitLvars_def length_compTpInit split_beta)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   857
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   858
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   859
  (* ********************************************************************** *)
13679
2ebad1cb045f fixed latex output
kleing
parents: 13676
diff changeset
   860
section "Correspondence bytecode - method types"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   861
  (* ********************************************************************** *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   862
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   863
syntax
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   864
  ST_of :: "state_type \<Rightarrow> opstack_type"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   865
  LT_of :: "state_type \<Rightarrow> locvars_type"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   866
translations
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   867
  "ST_of" => "fst"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   868
  "LT_of" => "snd"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   869
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   870
lemma states_lower:
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   871
  "\<lbrakk> OK (Some (ST, LT)) \<in> states cG mxs mxr; length ST \<le> mxs\<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   872
  \<Longrightarrow> OK (Some (ST, LT)) \<in> states cG (length ST) mxr"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   873
apply (simp add: states_def JVMType.sl_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   874
apply (simp add: Product.esl_def stk_esl_def reg_sl_def upto_esl_def Listn.sl_def Err.sl_def
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   875
  JType.esl_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   876
apply (simp add: Err.esl_def Err.le_def Listn.le_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   877
apply (simp add: Product.le_def Product.sup_def Err.sup_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   878
apply (simp add: Opt.esl_def Listn.sup_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   879
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   880
apply auto
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   881
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   882
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   883
lemma check_type_lower:
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   884
  "\<lbrakk> check_type cG mxs mxr (OK (Some (ST, LT))); length ST \<le> mxs\<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   885
  \<Longrightarrow>check_type cG (length ST) mxr (OK (Some (ST, LT)))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   886
by (simp add: check_type_def states_lower)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   887
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   888
  (* ******************************************************************* *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   889
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   890
constdefs
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   891
   bc_mt_corresp :: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   892
  [bytecode, state_type \<Rightarrow> method_type \<times> state_type, state_type, jvm_prog, ty, nat, p_count]
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   893
  \<Rightarrow> bool"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   894
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   895
  "bc_mt_corresp bc f sttp0 cG rT mxr idx ==
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   896
  let (mt, sttp) = f sttp0 in
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   897
  (length bc = length mt \<and> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   898
    ((check_type cG (length (ST_of sttp0)) mxr (OK (Some sttp0))) \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   899
    (\<forall>  mxs. 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   900
     mxs = max_ssize (mt@[Some sttp]) \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   901
     (\<forall> pc. pc < idx \<longrightarrow> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   902
      wt_instr_altern (bc ! pc) cG rT (mt@[Some sttp]) mxs mxr (length mt + 1) empty_et pc)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   903
     \<and> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   904
     check_type cG mxs mxr (OK ((mt@[Some sttp]) ! idx)))))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   905
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   906
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   907
lemma bc_mt_corresp_comb: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   908
  \<lbrakk> bc' = (bc1@bc2); l' = (length bc');
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   909
  bc_mt_corresp bc1 f1 sttp0 cG rT mxr (length bc1);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   910
  bc_mt_corresp bc2 f2 (sttp_of (f1 sttp0)) cG rT mxr (length bc2);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   911
  start_sttp_resp f2\<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   912
\<Longrightarrow> bc_mt_corresp bc' (f1 \<box> f2) sttp0 cG rT mxr l'"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   913
apply (subgoal_tac "\<exists> mt1 sttp1. (f1 sttp0) = (mt1, sttp1)", (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   914
apply (subgoal_tac "\<exists> mt2 sttp2. (f2 sttp1) = (mt2, sttp2)", (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   915
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   916
  (* unfold start_sttp_resp and make case distinction *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   917
apply (simp only: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   918
apply (erule disjE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   919
  (* case f2 = comb_nil *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   920
apply (simp add: bc_mt_corresp_def comb_nil_def start_sttp_resp_cons_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   921
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   922
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   923
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   924
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   925
  (* case start_sttp_resp_cons f2 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   926
apply (simp add: bc_mt_corresp_def comb_def start_sttp_resp_cons_def del: all_simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   927
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   928
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   929
apply (drule mp, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   930
apply (subgoal_tac "check_type cG (length (fst sttp1)) mxr (OK (Some sttp1))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   931
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   932
apply (drule mp, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   933
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   934
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   935
apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   936
  (* show wt_instr  \<dots> *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   937
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   938
apply (drule_tac x=sttp1 in spec, simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   939
apply (erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   940
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   941
apply (case_tac "pc < length mt1")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   942
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   943
  (* case pc < length mt1 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   944
apply (drule spec, drule mp, simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   945
apply simp 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   946
apply (rule_tac mt="mt1 @ [Some sttp1]" in wt_instr_prefix)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   947
  apply assumption+ apply (rule HOL.refl)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   948
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   949
  apply (simp (no_asm_simp) add: max_ssize_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   950
  apply (simp add: max_of_list_def max_ac)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   951
  apply arith
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   952
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   953
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   954
  (* case pc \<ge> length mt1 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   955
apply (rule_tac bc=bc2 and mt=mt2 and bc_post="[]" and mt_post="[Some sttp2]" 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   956
  and mxr=mxr 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   957
  in wt_instr_offset)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   958
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   959
apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   960
apply simp
32443
16464c3f86bd tuned proofs
nipkow
parents: 32436
diff changeset
   961
apply (simp add: max_ssize_def max_of_list_append) apply (simp (no_asm_simp))
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   962
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   963
  (* show check_type \<dots> *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   964
apply (subgoal_tac "((mt2 @ [Some sttp2]) ! length bc2) = Some sttp2")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   965
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   966
apply (rule check_type_mono) apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   967
apply (simp (no_asm_simp)  add: max_ssize_def max_of_list_append max_ac)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   968
apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   969
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   970
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   971
apply (case_tac sttp1)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   972
apply (simp add: check_type_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   973
apply (rule states_lower, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   974
apply (simp (no_asm_simp) add: max_ssize_def max_of_list_append)
32443
16464c3f86bd tuned proofs
nipkow
parents: 32436
diff changeset
   975
apply (simp (no_asm_simp) add: max_of_list_def ssize_sto_def)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   976
apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   977
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   978
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   979
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   980
lemma bc_mt_corresp_zero [simp]: "\<lbrakk> length (mt_of (f sttp)) = length bc; start_sttp_resp f\<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   981
  \<Longrightarrow> bc_mt_corresp bc f sttp cG rT mxr 0"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   982
apply (simp add: bc_mt_corresp_def start_sttp_resp_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   983
apply (erule disjE)
22780
41162a270151 Adapted to new parse translation for case expressions.
berghofe
parents: 21312
diff changeset
   984
apply (simp add: max_ssize_def max_of_list_def ssize_sto_def split: prod.split)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   985
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   986
apply (simp add: start_sttp_resp_cons_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   987
apply (drule_tac x=sttp in spec, erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   988
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   989
apply (rule check_type_mono, assumption)
32443
16464c3f86bd tuned proofs
nipkow
parents: 32436
diff changeset
   990
apply (simp add: max_ssize_def max_of_list_def ssize_sto_def split: prod.split)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   991
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   992
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   993
  (* ********************************************************************** *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   994
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   995
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   996
constdefs
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   997
  mt_sttp_flatten :: "method_type \<times> state_type \<Rightarrow> method_type"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   998
  "mt_sttp_flatten mt_sttp == (mt_of mt_sttp) @ [Some (sttp_of mt_sttp)]"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
   999
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1000
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1001
lemma mt_sttp_flatten_length [simp]: "n = (length (mt_of (f sttp)))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1002
 \<Longrightarrow> (mt_sttp_flatten (f sttp)) ! n = Some (sttp_of (f sttp))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1003
by (simp add: mt_sttp_flatten_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1004
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1005
lemma mt_sttp_flatten_comb: "(mt_sttp_flatten ((f1 \<box> f2) sttp)) = 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1006
  (mt_of (f1 sttp)) @ (mt_sttp_flatten (f2 (sttp_of (f1 sttp))))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1007
by (simp add: mt_sttp_flatten_def comb_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1008
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1009
lemma mt_sttp_flatten_comb_length [simp]: "\<lbrakk> n1 = length (mt_of (f1 sttp)); n1 \<le> n \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1010
  \<Longrightarrow> (mt_sttp_flatten ((f1 \<box> f2) sttp) ! n) = (mt_sttp_flatten (f2 (sttp_of (f1 sttp))) ! (n - n1))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1011
by (simp add: mt_sttp_flatten_comb nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1012
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1013
lemma mt_sttp_flatten_comb_zero [simp]: "start_sttp_resp f 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1014
  \<Longrightarrow> (mt_sttp_flatten (f sttp)) ! 0 = Some sttp"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1015
apply (simp only: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1016
apply (erule disjE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1017
apply (simp add: comb_nil_def mt_sttp_flatten_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1018
apply (simp add: start_sttp_resp_cons_def mt_sttp_flatten_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1019
apply (drule_tac x=sttp in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1020
apply (erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1021
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1022
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1023
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1024
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1025
(* move into prelude -- compare with nat_int_length *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1026
lemma int_outside_right: "0 \<le> (m::int) \<Longrightarrow> m + (int n) = int ((nat m) + n)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1027
by simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1028
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1029
lemma int_outside_left: "0 \<le> (m::int) \<Longrightarrow> (int n) + m = int (n + (nat m))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1030
by simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1031
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1032
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1033
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1034
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1035
  (* ********************************************************************** *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1036
  (* bc_mt_corresp for individual instructions                              *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1037
  (* ---------------------------------------------------------------------- *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1038
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1039
lemma less_Suc [simp] : "n \<le> k \<Longrightarrow> (k < Suc n) = (k = n)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1040
  by arith
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1041
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1042
lemmas check_type_simps = check_type_def states_def JVMType.sl_def
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1043
   Product.esl_def stk_esl_def reg_sl_def upto_esl_def Listn.sl_def Err.sl_def
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1044
  JType.esl_def Err.esl_def Err.le_def Listn.le_def Product.le_def Product.sup_def Err.sup_def
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1045
  Opt.esl_def Listn.sup_def
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1046
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1047
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1048
lemma check_type_push: "\<lbrakk> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1049
  is_class cG cname; check_type cG (length ST) mxr (OK (Some (ST, LT))) \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1050
  \<Longrightarrow> check_type cG (Suc (length ST)) mxr (OK (Some (Class cname # ST, LT)))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1051
apply (simp add: check_type_simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1052
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1053
apply (rule_tac x="Suc (length ST)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1054
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1055
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1056
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1057
lemma bc_mt_corresp_New: "\<lbrakk>is_class cG cname \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1058
  \<Longrightarrow> bc_mt_corresp [New cname] (pushST [Class cname]) (ST, LT) cG rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1059
apply (simp add: bc_mt_corresp_def pushST_def wt_instr_altern_def
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1060
    max_ssize_def max_of_list_def ssize_sto_def eff_def norm_eff_def min_max.sup_absorb2)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1061
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1062
apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1063
apply (rule check_type_mono, assumption, simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1064
apply (simp add: check_type_push)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1065
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1066
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1067
lemma bc_mt_corresp_Pop: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1068
  bc_mt_corresp [Pop] (popST (Suc 0)) (T # ST, LT) cG rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1069
  apply (simp add: bc_mt_corresp_def popST_def wt_instr_altern_def eff_def norm_eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1070
  apply (simp add: max_ssize_def ssize_sto_def max_of_list_def) 
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1071
  apply (simp add: check_type_simps min_max.sup_absorb1)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1072
  apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1073
  apply (rule_tac x="(length ST)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1074
  apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1075
  done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1076
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1077
lemma bc_mt_corresp_Checkcast: "\<lbrakk> is_class cG cname; sttp = (ST, LT); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1078
  (\<exists>rT STo. ST = RefT rT # STo) \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1079
  \<Longrightarrow> bc_mt_corresp [Checkcast cname] (replST (Suc 0) (Class cname)) sttp cG rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1080
  apply (erule exE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1081
  apply (simp add: bc_mt_corresp_def replST_def wt_instr_altern_def eff_def norm_eff_def)
32443
16464c3f86bd tuned proofs
nipkow
parents: 32436
diff changeset
  1082
  apply (simp add: max_ssize_def max_of_list_def ssize_sto_def)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1083
  apply (simp add: check_type_simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1084
  apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1085
  apply (rule_tac x="Suc (length STo)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1086
  apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1087
  done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1088
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1089
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1090
lemma bc_mt_corresp_LitPush: "\<lbrakk> typeof (\<lambda>v. None) val = Some T \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1091
  \<Longrightarrow> bc_mt_corresp [LitPush val] (pushST [T]) sttp cG rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1092
apply (subgoal_tac "\<exists> ST LT. sttp= (ST, LT)", (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1093
  apply (simp add: bc_mt_corresp_def pushST_def wt_instr_altern_def
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1094
              max_ssize_def max_of_list_def ssize_sto_def eff_def norm_eff_def min_max.sup_absorb2)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1095
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1096
  apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1097
  apply (rule check_type_mono, assumption, simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1098
  apply (simp add: check_type_simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1099
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1100
apply (rule_tac x="Suc (length ST)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1101
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1102
apply (drule sym)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1103
apply (case_tac val)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1104
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1105
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1106
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1107
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1108
lemma bc_mt_corresp_LitPush_CT: "\<lbrakk> typeof (\<lambda>v. None) val = Some T \<and> cG \<turnstile> T \<preceq> T';
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1109
  is_type cG T' \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1110
  \<Longrightarrow> bc_mt_corresp [LitPush val] (pushST [T']) sttp cG rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1111
apply (subgoal_tac "\<exists> ST LT. sttp= (ST, LT)", (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1112
  apply (simp add: bc_mt_corresp_def pushST_def wt_instr_altern_def
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1113
              max_ssize_def max_of_list_def ssize_sto_def eff_def norm_eff_def min_max.sup_absorb2)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1114
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1115
  apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1116
  apply (rule check_type_mono, assumption, simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1117
  apply (simp add: check_type_simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1118
  apply (simp add: sup_state_Cons)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1119
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1120
apply (rule_tac x="Suc (length ST)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1121
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1122
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1123
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1124
33954
1bc3b688548c backported parts of abstract byte code verifier from AFP/Jinja
haftmann
parents: 33640
diff changeset
  1125
declare not_Err_eq [iff del]
1bc3b688548c backported parts of abstract byte code verifier from AFP/Jinja
haftmann
parents: 33640
diff changeset
  1126
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1127
lemma bc_mt_corresp_Load: "\<lbrakk> i < length LT; LT ! i \<noteq> Err; mxr = length LT \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1128
  \<Longrightarrow> bc_mt_corresp [Load i] 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1129
         (\<lambda>(ST, LT). pushST [ok_val (LT ! i)] (ST, LT)) (ST, LT) cG rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1130
apply (simp add: bc_mt_corresp_def pushST_def wt_instr_altern_def
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1131
            max_ssize_def max_of_list_def ssize_sto_def eff_def norm_eff_def min_max.sup_absorb2)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1132
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1133
  apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1134
  apply (rule check_type_mono, assumption, simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1135
apply (simp add: check_type_simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1136
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1137
apply (rule_tac x="Suc (length ST)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1138
apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1139
  apply (simp only: err_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1140
  apply (frule listE_nth_in) apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1141
apply (subgoal_tac "LT ! i \<in> {x. \<exists>y\<in>types cG. x = OK y}")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1142
apply (drule CollectD) apply (erule bexE)
33954
1bc3b688548c backported parts of abstract byte code verifier from AFP/Jinja
haftmann
parents: 33640
diff changeset
  1143
apply (simp (no_asm_simp))
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1144
apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1145
apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1146
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1147
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1148
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1149
lemma bc_mt_corresp_Store_init: "\<lbrakk> i < length LT \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1150
  \<Longrightarrow> bc_mt_corresp [Store i] (storeST i T) (T # ST, LT) cG rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1151
 apply (simp add: bc_mt_corresp_def storeST_def wt_instr_altern_def eff_def norm_eff_def)
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1152
  apply (simp add: max_ssize_def  max_of_list_def)
32436
10cd49e0c067 Turned "x <= y ==> sup x y = y" (and relatives) into simp rules
nipkow
parents: 31082
diff changeset
  1153
  apply (simp add: ssize_sto_def)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1154
  apply (intro strip)
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1155
apply (simp add: check_type_simps min_max.sup_absorb1)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1156
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1157
apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1158
apply (rule_tac x="(length ST)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1159
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1160
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1161
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1162
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1163
lemma bc_mt_corresp_Store: "\<lbrakk> i < length LT; cG  \<turnstile>  LT[i := OK T] <=l LT \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1164
  \<Longrightarrow> bc_mt_corresp [Store i] (popST (Suc 0)) (T # ST, LT) cG rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1165
  apply (simp add: bc_mt_corresp_def popST_def wt_instr_altern_def eff_def norm_eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1166
  apply (simp add: sup_state_conv)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1167
  apply (simp add: max_ssize_def max_of_list_def ssize_sto_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1168
 apply (intro strip)
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1169
apply (simp add: check_type_simps min_max.sup_absorb1)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1170
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1171
apply (rule_tac x="(length ST)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1172
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1173
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1174
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1175
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1176
lemma bc_mt_corresp_Dup: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1177
  bc_mt_corresp [Dup] dupST (T # ST, LT) cG rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1178
 apply (simp add: bc_mt_corresp_def dupST_def wt_instr_altern_def
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1179
             max_ssize_def max_of_list_def ssize_sto_def eff_def norm_eff_def min_max.sup_absorb2)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1180
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1181
  apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1182
  apply (rule check_type_mono, assumption, simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1183
apply (simp add: check_type_simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1184
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1185
apply (rule_tac x="Suc (Suc (length ST))" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1186
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1187
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1188
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1189
lemma bc_mt_corresp_Dup_x1: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1190
  bc_mt_corresp [Dup_x1] dup_x1ST (T1 # T2 # ST, LT) cG rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1191
  apply (simp add: bc_mt_corresp_def dup_x1ST_def wt_instr_altern_def
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1192
              max_ssize_def max_of_list_def ssize_sto_def eff_def norm_eff_def min_max.sup_absorb2)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1193
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1194
  apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1195
  apply (rule check_type_mono, assumption, simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1196
apply (simp add: check_type_simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1197
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1198
apply (rule_tac x="Suc (Suc (Suc (length ST)))" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1199
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1200
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1201
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1202
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1203
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1204
lemma bc_mt_corresp_IAdd: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1205
  bc_mt_corresp [IAdd] (replST 2 (PrimT Integer)) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1206
         (PrimT Integer # PrimT Integer # ST, LT) cG rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1207
  apply (simp add: bc_mt_corresp_def replST_def wt_instr_altern_def eff_def norm_eff_def)
32443
16464c3f86bd tuned proofs
nipkow
parents: 32436
diff changeset
  1208
  apply (simp add: max_ssize_def max_of_list_def ssize_sto_def)
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1209
  apply (simp add: check_type_simps min_max.sup_absorb1)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1210
  apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1211
  apply (rule_tac x="Suc (length ST)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1212
  apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1213
  done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1214
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1215
lemma bc_mt_corresp_Getfield: "\<lbrakk> wf_prog wf_mb G; 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1216
  field (G, C) vname = Some (cname, T);  is_class G C \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1217
  \<Longrightarrow> bc_mt_corresp [Getfield vname cname] 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1218
        (replST (Suc 0) (snd (the (field (G, cname) vname))))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1219
        (Class C # ST, LT) (comp G) rT mxr (Suc 0)"
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1220
  apply (frule wf_prog_ws_prog [THEN wf_subcls1])
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1221
  apply (frule field_in_fd, assumption+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1222
  apply (frule widen_field, assumption+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1223
  apply (simp add: bc_mt_corresp_def replST_def wt_instr_altern_def eff_def norm_eff_def)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1224
  apply (simp add: comp_field comp_subcls1 comp_widen comp_is_class)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1225
  apply (simp add: max_ssize_def max_of_list_def ssize_sto_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1226
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1227
apply (simp add: check_type_simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1228
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1229
apply (rule_tac x="Suc (length ST)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1230
apply simp+
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1231
apply (simp only: comp_is_type)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1232
apply (rule_tac C=cname in fields_is_type)
23022
9872ef956276 added qualification for ambiguous definition names
haftmann
parents: 22780
diff changeset
  1233
apply (simp add: TypeRel.field_def)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1234
apply (drule JBasis.table_of_remap_SomeD)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1235
apply assumption+
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1236
apply (erule wf_prog_ws_prog)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1237
apply assumption
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1238
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1239
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1240
lemma bc_mt_corresp_Putfield: "\<lbrakk> wf_prog wf_mb G; 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1241
  field (G, C) vname = Some (cname, Ta); G \<turnstile> T \<preceq> Ta; is_class G C \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1242
  \<Longrightarrow> bc_mt_corresp [Putfield vname cname] (popST 2) (T # Class C # T # ST, LT)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1243
           (comp G) rT mxr (Suc 0)"
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1244
  apply (frule wf_prog_ws_prog [THEN wf_subcls1])
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1245
  apply (frule field_in_fd, assumption+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1246
  apply (frule widen_field, assumption+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1247
  apply (simp add: bc_mt_corresp_def popST_def wt_instr_altern_def eff_def norm_eff_def)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1248
  apply (simp add: comp_field comp_subcls1 comp_widen comp_is_class)
32443
16464c3f86bd tuned proofs
nipkow
parents: 32436
diff changeset
  1249
  apply (simp add: max_ssize_def max_of_list_def ssize_sto_def)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1250
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1251
  apply (intro strip)
32642
026e7c6a6d08 be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
haftmann
parents: 32443
diff changeset
  1252
apply (simp add: check_type_simps min_max.sup_absorb1)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1253
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1254
apply (rule_tac x="Suc (length ST)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1255
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1256
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1257
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1258
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1259
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1260
lemma Call_app: "\<lbrakk> wf_prog wf_mb G; is_class G cname;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1261
STs = rev pTsa @ Class cname # ST;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1262
max_spec G cname (mname, pTsa) = {((md, T), pTs')} \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1263
  \<Longrightarrow> app (Invoke cname mname pTs') (comp G) (length (T # ST)) rT 0 empty_et (Some (STs, LTs))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1264
  apply (subgoal_tac "(\<exists>mD' rT' comp_b. 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1265
    method (comp G, cname) (mname, pTs') = Some (mD', rT', comp_b))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1266
  apply (simp add: comp_is_class)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1267
  apply (rule_tac x=pTsa in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1268
  apply (rule_tac x="Class cname" in exI)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1269
  apply (simp add: max_spec_preserves_length comp_is_class)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1270
  apply (frule max_spec2mheads, (erule exE)+, (erule conjE)+)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1271
  apply (simp add: split_paired_all comp_widen list_all2_def)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1272
  apply (frule max_spec2mheads, (erule exE)+, (erule conjE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1273
  apply (rule exI)+
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1274
  apply (simp add: wf_prog_ws_prog [THEN comp_method])
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1275
  apply auto
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1276
  done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1277
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1278
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1279
lemma bc_mt_corresp_Invoke: "\<lbrakk> wf_prog wf_mb G; 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1280
  max_spec G cname (mname, pTsa) = {((md, T), fpTs)};
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1281
  is_class G cname \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1282
 \<Longrightarrow> bc_mt_corresp [Invoke cname mname fpTs] (replST (Suc (length pTsa)) T)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1283
           (rev pTsa @ Class cname # ST, LT) (comp G) rT mxr (Suc 0)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1284
  apply (simp add: bc_mt_corresp_def wt_instr_altern_def eff_def norm_eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1285
  apply (simp add: replST_def del: appInvoke)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1286
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1287
  apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1288
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1289
  -- "app"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1290
  apply (rule Call_app [THEN app_mono_mxs]) apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1291
    apply (rule HOL.refl) apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1292
    apply (simp add: max_ssize_def max_of_list_elem ssize_sto_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1293
13676
b1915d3e571d fixed latex error
kleing
parents: 13673
diff changeset
  1294
  -- {* @{text "<=s"} *}
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1295
  apply (frule max_spec2mheads, (erule exE)+, (erule conjE)+)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1296
  apply (simp add: wf_prog_ws_prog [THEN comp_method])
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1297
  apply (simp add: max_spec_preserves_length [THEN sym])
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1298
13676
b1915d3e571d fixed latex error
kleing
parents: 13673
diff changeset
  1299
  -- "@{text check_type}"
32443
16464c3f86bd tuned proofs
nipkow
parents: 32436
diff changeset
  1300
apply (simp add: max_ssize_def ssize_sto_def)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1301
apply (simp add: max_of_list_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1302
apply (subgoal_tac "(max (length pTsa + length ST) (length ST)) = (length pTsa + length ST)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1303
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1304
apply (simp add: check_type_simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1305
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1306
apply (rule_tac x="Suc (length ST)" in exI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1307
apply simp+
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1308
apply (simp only: comp_is_type)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1309
apply (frule method_wf_mdecl) apply assumption apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1310
apply (simp add: wf_mdecl_def wf_mhead_def)
32443
16464c3f86bd tuned proofs
nipkow
parents: 32436
diff changeset
  1311
apply (simp)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1312
  done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1313
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1314
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1315
lemma wt_instr_Ifcmpeq: "\<lbrakk>Suc pc < max_pc; 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1316
  0 \<le> (int pc + i);  nat (int pc + i) < max_pc;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1317
  (mt_sttp_flatten f ! pc = Some (ts#ts'#ST,LT)) \<and> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1318
  ((\<exists>p. ts = PrimT p \<and> ts' = PrimT p) \<or> (\<exists>r r'. ts = RefT r \<and> ts' = RefT r'));
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1319
  mt_sttp_flatten f ! Suc pc = Some (ST,LT);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1320
  mt_sttp_flatten f ! nat (int pc + i) = Some (ST,LT);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1321
  check_type (TranslComp.comp G) mxs mxr (OK (Some (ts # ts' # ST, LT))) \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1322
    \<Longrightarrow>  wt_instr_altern (Ifcmpeq i) (comp G) rT  (mt_sttp_flatten f) mxs mxr max_pc empty_et pc"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1323
by (simp  add: wt_instr_altern_def eff_def norm_eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1324
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1325
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1326
lemma wt_instr_Goto: "\<lbrakk> 0 \<le> (int pc + i); nat (int pc + i) < max_pc;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1327
  mt_sttp_flatten f ! nat (int pc + i) = (mt_sttp_flatten f ! pc);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1328
  check_type (TranslComp.comp G) mxs mxr (OK (mt_sttp_flatten f ! pc)) \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1329
  \<Longrightarrow> wt_instr_altern (Goto i) (comp G) rT  (mt_sttp_flatten f) mxs mxr max_pc empty_et pc"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1330
apply (case_tac "(mt_sttp_flatten f ! pc)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1331
apply (simp  add: wt_instr_altern_def eff_def norm_eff_def app_def xcpt_app_def)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1332
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1333
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1334
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1335
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1336
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1337
  (* ********************************************************************** *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1338
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1339
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1340
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1341
lemma bc_mt_corresp_comb_inside: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1342
  \<lbrakk> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1343
  bc_mt_corresp bc' f' sttp0 cG rT mxr l1;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1344
  bc' = (bc1@bc2@bc3); f'= (f1 \<box> f2 \<box> f3); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1345
  l1 = (length bc1); l12 = (length (bc1@bc2));
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1346
  bc_mt_corresp bc2 f2 (sttp_of (f1 sttp0)) cG rT mxr (length bc2);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1347
  length bc1 = length (mt_of (f1 sttp0));
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1348
  start_sttp_resp f2; start_sttp_resp f3\<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1349
\<Longrightarrow> bc_mt_corresp bc' f' sttp0 cG rT mxr l12"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1350
apply (subgoal_tac "\<exists> mt1 sttp1. (f1 sttp0) = (mt1, sttp1)", (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1351
apply (subgoal_tac "\<exists> mt2 sttp2. (f2 sttp1) = (mt2, sttp2)", (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1352
apply (subgoal_tac "\<exists> mt3 sttp3. (f3 sttp2) = (mt3, sttp3)", (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1353
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1354
  (* unfold start_sttp_resp and make case distinction *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1355
apply (simp only: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1356
apply (erule_tac Q="start_sttp_resp_cons f2" in disjE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1357
  (* case f2 = comb_nil *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1358
apply (simp add: bc_mt_corresp_def comb_nil_def start_sttp_resp_cons_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1359
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1360
  (* case start_sttp_resp_cons f2 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1361
apply (simp add: bc_mt_corresp_def comb_def start_sttp_resp_cons_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1362
apply (drule_tac x=sttp1 in spec, simp, erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1363
apply (intro strip, (erule conjE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1364
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1365
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1366
  (* get rid of all check_type info *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1367
apply (subgoal_tac "check_type cG (length (fst sttp1)) mxr (OK (Some sttp1))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1368
apply (subgoal_tac "check_type cG (max_ssize (mt2 @ [Some sttp2])) mxr (OK (Some sttp2))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1369
apply (subgoal_tac "check_type cG (max_ssize (mt1 @ mt2 @ mt3 @ [Some sttp3])) mxr
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1370
           (OK ((mt2 @ mt3 @ [Some sttp3]) ! length mt2))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1371
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1372
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1373
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1374
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1375
apply (intro strip, (erule conjE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1376
apply (case_tac "pc < length mt1")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1377
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1378
  (* case pc < length mt1 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1379
apply (drule spec, drule mp, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1380
apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1381
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1382
  (* case pc \<ge> length mt1 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1383
  (* case distinction on start_sttp_resp f3 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1384
apply (erule_tac P="f3 = comb_nil" in disjE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1385
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1386
  (* case f3 = comb_nil *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1387
apply (subgoal_tac "mt3 = [] \<and> sttp2 = sttp3")  apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1388
apply (subgoal_tac "bc3=[]")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1389
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1390
apply (rule_tac bc_pre=bc1 and bc=bc2 and bc_post=bc3
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1391
  and mt_pre=mt1 and mt=mt2 and mt_post="mt3@ [Some sttp3]" 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1392
  and mxs="(max_ssize (mt2 @ [(Some sttp2)]))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1393
  and max_pc="(Suc (length mt2))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1394
  in wt_instr_offset)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1395
  apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1396
  apply (rule HOL.refl)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1397
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1398
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1399
  apply (simp (no_asm_simp) add: max_ssize_def del: max_of_list_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1400
    apply (rule max_of_list_sublist)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1401
    apply (simp (no_asm_simp) only: set_append set.simps map.simps) apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1402
  apply (simp (no_asm_simp))
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32642
diff changeset
  1403
  apply simp                    (* subgoal bc3 = [] *)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1404
  apply (simp add: comb_nil_def) (* subgoal mt3 = [] \<and> sttp2 = sttp3 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1405
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1406
  (* case start_sttp_resp_cons f3 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1407
apply (subgoal_tac "\<exists>mt3_rest. (mt3 = Some sttp2 # mt3_rest)", erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1408
apply (rule_tac bc_pre=bc1 and bc=bc2 and bc_post=bc3
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1409
  and mt_pre=mt1 and mt=mt2 and mt_post="mt3@ [Some sttp3]" 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1410
  and mxs="(max_ssize (mt2 @ [Some sttp2]))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1411
  and max_pc="(Suc (length mt2))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1412
  in wt_instr_offset)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1413
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1414
apply (rule_tac bc=bc2 and mt="(mt2 @ [Some sttp2])"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1415
  and mxs="(max_ssize (mt2 @ [Some sttp2]))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1416
  and max_pc="(Suc (length mt2))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1417
  in wt_instr_prefix)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1418
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1419
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1420
     (* preconditions of  wt_instr_prefix *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1421
  apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1422
  apply (rule HOL.refl)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1423
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1424
  apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1425
     (* (some) preconditions of  wt_instr_offset *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1426
  apply (simp (no_asm_simp) add: max_ssize_def del: max_of_list_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1427
  apply (rule max_of_list_sublist)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1428
    apply (simp (no_asm_simp) only: set_append set.simps map.simps) apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1429
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1430
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1431
apply (drule_tac x=sttp2 in spec, simp) (* subgoal \<exists>mt3_rest. \<dots> *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1432
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1433
  (* subgoals check_type*)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1434
  (* \<dots> ! length mt2 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1435
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1436
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1437
apply (erule_tac P="f3 = comb_nil" in disjE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1438
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1439
  (* -- case f3 = comb_nil *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1440
apply (subgoal_tac "mt3 = [] \<and> sttp2 = sttp3")  apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1441
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1442
apply (rule check_type_mono, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1443
apply (simp only: max_ssize_def) apply (rule max_of_list_sublist) apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1444
apply blast
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32642
diff changeset
  1445
  apply simp                    (* subgoal bc3 = [] *)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1446
  apply (simp add: comb_nil_def) (* subgoal mt3 = [] \<and> sttp2 = sttp3 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1447
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1448
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1449
  (* -- case start_sttp_resp_cons f3 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1450
apply (subgoal_tac "\<exists>mt3_rest. (mt3 = Some sttp2 # mt3_rest)", erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1451
apply (simp (no_asm_simp) add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1452
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1453
apply (rule check_type_mono, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1454
apply (simp only: max_ssize_def) apply (rule max_of_list_sublist) apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1455
apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1456
apply (drule_tac x=sttp2 in spec, simp) (* subgoal \<exists>mt3_rest. \<dots> *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1457
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1458
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1459
  (* subgoal check_type \<dots> Some sttp2 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1460
apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1461
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1462
  (* subgoal check_type \<dots> Some sttp1 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1463
apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1464
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1465
apply (case_tac "sttp1", simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1466
apply (rule check_type_lower) apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1467
apply (simp (no_asm_simp) add: max_ssize_def ssize_sto_def)
32443
16464c3f86bd tuned proofs
nipkow
parents: 32436
diff changeset
  1468
apply (simp (no_asm_simp) add: max_of_list_def)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1469
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1470
  (* subgoals \<exists> ... *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1471
apply (rule surj_pair)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1472
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1473
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1474
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1475
  (* ******************** *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1476
constdefs 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1477
  contracting :: "(state_type \<Rightarrow> method_type \<times> state_type) \<Rightarrow> bool"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1478
  "contracting f == (\<forall> ST LT. 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1479
                    let (ST', LT') = sttp_of (f (ST, LT)) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1480
                    in (length ST' \<le> length ST \<and> set ST' \<subseteq> set ST  \<and>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1481
                        length LT' = length LT \<and> set LT' \<subseteq> set LT))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1482
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1483
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1484
  (* ### possibly move into HOL *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1485
lemma set_drop_Suc [rule_format]: "\<forall> xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1486
apply (induct n)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1487
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1488
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1489
apply (rule list.induct)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1490
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1491
apply simp apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1492
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1493
apply (rule_tac 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1494
  P="\<lambda> xs. set (drop (Suc (Suc n)) xs) \<subseteq> set (drop (Suc n) xs)" in list.induct)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1495
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1496
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1497
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1498
lemma set_drop_le [rule_format,simp]: "\<forall> n xs. n \<le> m \<longrightarrow> set (drop m xs) \<subseteq> set (drop n xs)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1499
apply (induct m)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1500
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1501
apply (intro strip)
15236
f289e8ba2bb3 Proofs needed to be updated because induction now preserves name of
nipkow
parents: 14981
diff changeset
  1502
apply (subgoal_tac "n \<le> m \<or> n = Suc m")
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1503
apply (erule disjE)
15236
f289e8ba2bb3 Proofs needed to be updated because induction now preserves name of
nipkow
parents: 14981
diff changeset
  1504
apply (frule_tac x=n in spec, drule_tac x=xs in spec, drule mp, assumption)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1505
apply (rule set_drop_Suc [THEN subset_trans], assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1506
apply auto
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1507
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1508
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1509
lemma set_drop [simp] : "set (drop m xs) \<subseteq> set xs"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1510
apply (rule_tac B="set (drop 0 xs)" in subset_trans)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1511
apply (rule set_drop_le)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1512
apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1513
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1514
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1515
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1516
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1517
lemma contracting_popST [simp]: "contracting (popST n)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1518
by (simp add: contracting_def popST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1519
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1520
lemma contracting_nochangeST [simp]: "contracting nochangeST"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1521
by (simp add: contracting_def nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1522
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1523
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1524
lemma check_type_contracting: "\<lbrakk> check_type cG mxs mxr (OK (Some sttp)); contracting f\<rbrakk> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1525
  \<Longrightarrow> check_type cG mxs mxr (OK (Some (sttp_of (f sttp))))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1526
apply (subgoal_tac "\<exists> ST LT. sttp = (ST, LT)", (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1527
apply (simp add: check_type_simps contracting_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1528
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1529
apply (drule_tac x=ST in spec, drule_tac x=LT in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1530
apply (case_tac "(sttp_of (f (ST, LT)))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1531
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1532
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1533
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1534
apply (drule listE_set)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1535
apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1536
apply (rule_tac x="length a" in exI) apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1537
apply (rule listI) apply simp apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1538
apply (rule listI) apply simp apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1539
apply auto
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1540
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1541
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1542
  (* ******************** *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1543
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1544
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1545
lemma bc_mt_corresp_comb_wt_instr: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1546
  \<lbrakk> bc_mt_corresp bc' f' sttp0 cG rT mxr l1;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1547
  bc' = (bc1@[inst]@bc3); f'= (f1 \<box> f2 \<box> f3); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1548
  l1 = (length bc1); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1549
  length bc1 = length (mt_of (f1 sttp0));
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1550
  length (mt_of (f2 (sttp_of (f1 sttp0)))) = 1;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1551
  start_sttp_resp_cons f1; start_sttp_resp_cons f2; start_sttp_resp f3;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1552
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1553
  check_type cG (max_ssize (mt_sttp_flatten (f' sttp0))) mxr
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1554
             (OK ((mt_sttp_flatten (f' sttp0)) ! (length bc1)))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1555
  \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1556
  wt_instr_altern inst cG rT 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1557
      (mt_sttp_flatten (f' sttp0)) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1558
      (max_ssize (mt_sttp_flatten (f' sttp0)))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1559
      mxr
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1560
      (Suc (length bc'))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1561
      empty_et
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1562
      (length bc1);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1563
  contracting f2
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1564
 \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1565
\<Longrightarrow> bc_mt_corresp bc' f' sttp0 cG rT mxr (length (bc1@[inst]))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1566
apply (subgoal_tac "\<exists> mt1 sttp1. (f1 sttp0) = (mt1, sttp1)", (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1567
apply (subgoal_tac "\<exists> mt2 sttp2. (f2 sttp1) = (mt2, sttp2)", (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1568
apply (subgoal_tac "\<exists> mt3 sttp3. (f3 sttp2) = (mt3, sttp3)", (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1569
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1570
apply (simp add: bc_mt_corresp_def comb_def start_sttp_resp_cons_def
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1571
  mt_sttp_flatten_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1572
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1573
apply (intro strip, (erule conjE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1574
apply (drule mp, assumption)+ apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1575
apply (drule mp, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1576
apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1577
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1578
  (* wt_instr \<dots> *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1579
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1580
apply (case_tac "pc < length mt1")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1581
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1582
  (* case pc < length mt1 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1583
apply (drule spec, drule mp, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1584
apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1585
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1586
  (* case pc \<ge> length mt1 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1587
apply (subgoal_tac "pc = length mt1") prefer 2 apply arith
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1588
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1589
apply (simp add: nth_append mt_sttp_flatten_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1590
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1591
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1592
  (* check_type \<dots> *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1593
apply (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1594
apply (drule_tac x="sttp0" in spec, simp, erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1595
apply (drule_tac x="sttp1" in spec, simp, erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1596
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1597
apply (subgoal_tac "check_type cG (max_ssize (mt1 @ mt2 @ mt3 @ [Some sttp3])) mxr 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1598
                    (OK (Some (sttp_of (f2 sttp1))))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1599
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1600
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1601
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1602
apply (erule disjE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1603
    (* case f3 = comb_nil *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1604
apply (subgoal_tac "((mt1 @ mt2 @ mt3 @ [Some sttp3]) ! Suc (length mt1)) = (Some (snd (f2 sttp1)))")apply (subgoal_tac "mt3 = [] \<and> sttp2 = sttp3")  apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1605
apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1606
apply (simp add: comb_nil_def) (* subgoal mt3 = [] \<and> sttp2 = sttp3 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1607
apply (simp add: nth_append comb_nil_def) (* subgoal \<dots> ! Suc (length mt1) *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1608
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1609
    (* case start_sttp_resp_cons f3 *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1610
apply (simp add: start_sttp_resp_cons_def)  
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1611
apply (drule_tac x="sttp2" in spec, simp, erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1612
apply (simp  add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1613
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1614
  (* subgoal check_type *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1615
apply (rule check_type_contracting)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1616
apply (subgoal_tac "((mt1 @ mt2 @ mt3 @ [Some sttp3]) ! length mt1) = (Some sttp1)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1617
apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1618
apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1619
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1620
apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1621
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1622
(* subgoals *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1623
apply (rule surj_pair)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1624
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1625
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1626
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1627
lemma compTpExpr_LT_ST_rewr [simp]: "\<lbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1628
  wf_java_prog G;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1629
  wf_java_mdecl G C ((mn, pTs), rT, (pns, lvars, blk, res));
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1630
  local_env G C (mn, pTs) pns lvars \<turnstile> ex :: T;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1631
  is_inited_LT C pTs lvars LT\<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1632
\<Longrightarrow> sttp_of (compTpExpr (pns, lvars, blk, res) G ex (ST, LT)) = (T # ST, LT)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1633
apply (rule compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1634
apply auto
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1635
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1636
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1637
20432
07ec57376051 lin_arith_prover: splitting reverted because of performance loss
webertj
parents: 20272
diff changeset
  1638
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1639
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1640
lemma wt_method_compTpExpr_Exprs_corresp: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1641
  \<lbrakk> jmb = (pns,lvars,blk,res); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1642
  wf_prog wf_java_mdecl G;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1643
  wf_java_mdecl G C ((mn, pTs), rT, jmb);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1644
  E = (local_env G C (mn, pTs) pns lvars)\<rbrakk> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1645
\<Longrightarrow> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1646
 (\<forall> ST LT T bc' f'.
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1647
  E \<turnstile> ex :: T \<longrightarrow>  
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1648
  (is_inited_LT C pTs lvars LT) \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1649
  bc' = (compExpr jmb ex) \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1650
  f' = (compTpExpr jmb G ex)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1651
  \<longrightarrow> bc_mt_corresp bc' f' (ST, LT) (comp G) rT (length LT) (length bc'))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1652
 \<and>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1653
 (\<forall> ST LT Ts.
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1654
  E \<turnstile> exs [::] Ts \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1655
  (is_inited_LT C pTs lvars LT) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1656
  \<longrightarrow> bc_mt_corresp (compExprs jmb exs) (compTpExprs jmb G exs) (ST, LT) (comp G) rT (length LT) (length (compExprs jmb exs)))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1657
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1658
apply (rule  expr.induct)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1659
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1660
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1661
(* expresssions *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1662
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1663
(* NewC *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1664
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1665
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1666
apply (drule NewC_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1667
apply (simp (no_asm_use))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1668
apply (rule bc_mt_corresp_New)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1669
apply (simp add: comp_is_class)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1670
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1671
(* Cast *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1672
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1673
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1674
apply (drule Cast_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1675
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1676
apply (simp (no_asm_use))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1677
apply (rule bc_mt_corresp_comb) apply (rule HOL.refl, simp (no_asm_simp), blast)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1678
apply (simp (no_asm_simp), rule bc_mt_corresp_Checkcast)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1679
apply (simp add: comp_is_class)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1680
apply (simp only: compTpExpr_LT_ST)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1681
apply (drule cast_RefT)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1682
apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1683
apply (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1684
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1685
(* Lit *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1686
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1687
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1688
apply (drule Lit_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1689
(* apply (simp (no_asm_use)) *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1690
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1691
apply (rule bc_mt_corresp_LitPush)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1692
   apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1693
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1694
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1695
(* BinOp *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1696
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1697
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1698
apply (simp (no_asm_simp) only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1699
apply (drule BinOp_invers, erule exE, (erule conjE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1700
apply (case_tac binop)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1701
apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1702
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1703
  (* case Eq *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1704
apply (subgoal_tac "bc_mt_corresp bc' f' (ST, LT) (comp G) rT (length LT) 0")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1705
prefer 2
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1706
  apply (rule bc_mt_corresp_zero) apply (simp add: length_compTpExpr) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1707
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1708
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1709
apply (drule_tac ?bc1.0="[]" and ?bc2.0 = "compExpr jmb expr1" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1710
  and ?f1.0=comb_nil and ?f2.0 = "compTpExpr jmb G expr1" 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1711
  in bc_mt_corresp_comb_inside)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1712
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1713
  apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1714
  apply (simp (no_asm_simp) add: length_compTpExpr)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1715
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1716
apply (drule_tac ?bc2.0 = "compExpr jmb expr2" and ?f2.0 = "compTpExpr jmb G expr2" 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1717
  in bc_mt_corresp_comb_inside)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1718
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1719
  apply (simp only: compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1720
  apply (simp (no_asm_simp) add: length_compTpExpr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1721
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1722
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1723
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1724
apply (drule_tac ?bc1.0 = "compExpr jmb expr1 @ compExpr jmb expr2" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1725
    and inst = "Ifcmpeq 3" and ?bc3.0 = "[LitPush (Bool False),Goto 2, LitPush (Bool True)]"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1726
  and ?f1.0="compTpExpr jmb G expr1 \<box> compTpExpr jmb G expr2"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1727
  and ?f2.0="popST 2" and ?f3.0="pushST [PrimT Boolean] \<box> popST 1 \<box> pushST [PrimT Boolean]"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1728
  in bc_mt_corresp_comb_wt_instr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1729
  apply (simp (no_asm_simp) add: length_compTpExpr)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1730
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1731
    (* wt_instr *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1732
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1733
  apply (simp (no_asm_simp) add: wt_instr_altern_def length_compTpExpr eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1734
  apply (simp (no_asm_simp) add: norm_eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1735
  apply (simp (no_asm_simp) only: int_outside_left nat_int)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1736
  apply (simp (no_asm_simp) add: length_compTpExpr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1737
  apply (simp only: compTpExpr_LT_ST)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1738
  apply (simp add: eff_def norm_eff_def popST_def pushST_def mt_sttp_flatten_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1739
  apply (case_tac Ta) apply (simp (no_asm_simp)) apply (simp (no_asm_simp))
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32642
diff changeset
  1740
  apply (rule contracting_popST)                (* contracting (popST 2)  *)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1741
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1742
apply (drule_tac ?bc1.0 = "compExpr jmb expr1 @ compExpr jmb expr2 @ [Ifcmpeq 3]"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1743
  and ?bc2.0 = "[LitPush (Bool False)]" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1744
  and ?bc3.0 = "[Goto 2, LitPush (Bool True)]" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1745
  and ?f1.0 = "compTpExpr jmb G expr1 \<box> compTpExpr jmb G expr2 \<box> popST 2"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1746
  and ?f2.0 = "pushST [PrimT Boolean]" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1747
  and ?f3.0 = "popST (Suc 0) \<box> pushST [PrimT Boolean]"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1748
  in bc_mt_corresp_comb_inside)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1749
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1750
  apply (simp add: compTpExpr_LT_ST_rewr popST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1751
  apply (rule_tac T="(PrimT Boolean)" in bc_mt_corresp_LitPush) apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1752
  apply (simp (no_asm_simp) add: length_compTpExpr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1753
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1754
  apply (simp (no_asm_simp) add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1755
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1756
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1757
apply (drule_tac ?bc1.0 = "compExpr jmb expr1 @ compExpr jmb expr2 @ [Ifcmpeq 3, LitPush (Bool False)]" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1758
    and inst = "Goto 2" and ?bc3.0 = "[LitPush (Bool True)]"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1759
  and ?f1.0="compTpExpr jmb G expr1 \<box> compTpExpr jmb G expr2 \<box> popST 2 \<box> pushST [PrimT Boolean]"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1760
  and ?f2.0="popST 1" and ?f3.0="pushST [PrimT Boolean]"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1761
  in bc_mt_corresp_comb_wt_instr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1762
  apply (simp (no_asm_simp) add: length_compTpExpr)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1763
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1764
    (* wt_instr *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1765
  apply (simp (no_asm_simp) add: wt_instr_altern_def length_compTpExpr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1766
  apply (simp (no_asm_simp) add: eff_def norm_eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1767
  apply (simp (no_asm_simp) only: int_outside_right nat_int)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1768
  apply (simp (no_asm_simp) add: length_compTpExpr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1769
  apply (simp only: compTpExpr_LT_ST)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1770
  apply (simp add: eff_def norm_eff_def popST_def pushST_def)
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32642
diff changeset
  1771
  apply (rule contracting_popST)                (* contracting (popST 1) *)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1772
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1773
apply (drule_tac 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1774
  ?bc1.0 = "compExpr jmb expr1 @ compExpr jmb expr2 @ [Ifcmpeq 3, LitPush (Bool False), Goto 2]" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1775
  and ?bc2.0 = "[LitPush (Bool True)]"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1776
  and ?bc3.0 = "[]"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1777
  and ?f1.0 = "compTpExpr jmb G expr1 \<box> compTpExpr jmb G expr2 \<box> popST 2 \<box> 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1778
                pushST [PrimT Boolean] \<box> popST (Suc 0)"
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1779
  and ?f2.0 = "pushST [PrimT Boolean]"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1780
  and ?f3.0 = "comb_nil" 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1781
  in bc_mt_corresp_comb_inside)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1782
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1783
  apply (simp add: compTpExpr_LT_ST_rewr popST_def) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1784
  apply (rule_tac T="(PrimT Boolean)" in bc_mt_corresp_LitPush) apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1785
  apply (simp (no_asm_simp) add: length_compTpExpr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1786
  apply (simp (no_asm_simp) add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1787
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1788
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1789
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1790
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1791
  (* case Add *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1792
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1793
apply (rule bc_mt_corresp_comb) apply (rule HOL.refl) apply simp apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1794
apply (rule bc_mt_corresp_comb, rule HOL.refl) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1795
   apply (simp only: compTpExpr_LT_ST) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1796
apply (simp only: compTpExpr_LT_ST) apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1797
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1798
apply (simp only: compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1799
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1800
apply (rule bc_mt_corresp_IAdd)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1801
apply (simp (no_asm_simp) add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1802
apply (simp (no_asm_simp) add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1803
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1804
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1805
  (* LAcc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1806
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1807
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1808
apply (drule LAcc_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1809
apply (frule wf_java_mdecl_length_pTs_pns)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1810
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1811
apply (simp add: is_inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1812
apply (rule bc_mt_corresp_Load)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1813
  apply (rule index_in_bounds) apply simp apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1814
  apply (rule inited_LT_at_index_no_err)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1815
  apply (rule index_in_bounds) apply simp apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1816
apply (rule HOL.refl)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1817
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1818
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1819
  (* LAss *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1820
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1821
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1822
apply (drule LAss_invers, erule exE, (erule conjE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1823
apply (drule LAcc_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1824
apply (frule wf_java_mdecl_disjoint_varnames, simp add: disjoint_varnames_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1825
apply (frule wf_java_mdecl_length_pTs_pns)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1826
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1827
apply (simp (no_asm_use))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1828
apply (rule bc_mt_corresp_comb) apply (rule HOL.refl, simp (no_asm_simp), blast)
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1829
apply (rule_tac ?bc1.0="[Dup]" and ?bc2.0="[Store (index (pns, lvars, blk, res) vname)]" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1830
       and ?f1.0="dupST" and ?f2.0="popST (Suc 0)"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1831
       in bc_mt_corresp_comb) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1832
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1833
  apply (rule bc_mt_corresp_Dup)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1834
  apply (simp only: compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1835
  apply (simp add: dupST_def is_inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1836
  apply (rule bc_mt_corresp_Store)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1837
  apply (rule index_in_bounds)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1838
    apply simp apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1839
  apply (rule sup_loc_update_index, assumption+) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1840
    apply simp apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1841
apply (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1842
apply (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1843
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1844
  (* FAcc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1845
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1846
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1847
apply (drule FAcc_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1848
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1849
apply (simp (no_asm_use))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1850
apply (rule bc_mt_corresp_comb) apply (rule HOL.refl, simp (no_asm_simp), blast) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1851
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1852
  apply (rule bc_mt_corresp_Getfield) apply assumption+
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1853
     apply (fast intro: wt_class_expr_is_class)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1854
apply (simp (no_asm_simp) add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1855
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1856
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1857
  (* FAss *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1858
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1859
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1860
apply (drule FAss_invers, erule exE, (erule conjE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1861
apply (drule FAcc_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1862
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1863
apply (simp (no_asm_use))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1864
apply (rule bc_mt_corresp_comb) apply (rule HOL.refl) apply simp apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1865
  apply (simp only: compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1866
apply (rule bc_mt_corresp_comb, (rule HOL.refl)+) apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1867
  apply (simp only: compTpExpr_LT_ST)
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1868
apply (rule_tac ?bc1.0="[Dup_x1]" and ?bc2.0="[Putfield vname cname]" in bc_mt_corresp_comb) 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1869
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1870
apply (rule bc_mt_corresp_Dup_x1)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1871
  apply (simp (no_asm_simp) add: dup_x1ST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1872
apply (rule bc_mt_corresp_Putfield) apply assumption+
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1873
     apply (fast intro: wt_class_expr_is_class)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1874
apply (simp (no_asm_simp) add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1875
apply (simp (no_asm_simp) add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1876
apply (simp (no_asm_simp) add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1877
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1878
(* Call *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1879
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1880
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1881
apply (drule Call_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1882
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1883
apply (simp (no_asm_use))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1884
apply (rule bc_mt_corresp_comb) apply (rule HOL.refl) apply simp apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1885
  apply (simp only: compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1886
apply (rule bc_mt_corresp_comb, (rule HOL.refl)+) apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1887
  apply (simp only: compTpExprs_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1888
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1889
apply (rule bc_mt_corresp_Invoke) apply assumption+
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  1890
     apply (fast intro: wt_class_expr_is_class)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1891
apply (simp (no_asm_simp) add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1892
apply (rule start_sttp_resp_comb) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1893
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1894
  apply (simp (no_asm_simp) add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1895
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1896
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1897
(* expression lists *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1898
(* nil *) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1899
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1900
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1901
apply (drule Nil_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1902
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1903
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1904
(* cons *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1905
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1906
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1907
apply (drule Cons_invers, (erule exE)+, (erule conjE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1908
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1909
apply (simp (no_asm_use))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1910
apply (rule bc_mt_corresp_comb) apply (rule HOL.refl) apply simp apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1911
  apply (simp only: compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1912
apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1913
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1914
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1915
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1916
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1917
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1918
lemmas wt_method_compTpExpr_corresp [rule_format (no_asm)] = 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1919
  wt_method_compTpExpr_Exprs_corresp [THEN conjunct1]
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1920
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1921
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1922
  (* ********************************************************************** *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1923
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1924
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1925
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1926
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1927
lemma wt_method_compTpStmt_corresp [rule_format (no_asm)]: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1928
  \<lbrakk> jmb = (pns,lvars,blk,res); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1929
  wf_prog wf_java_mdecl G;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1930
  wf_java_mdecl G C ((mn, pTs), rT, jmb);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1931
  E = (local_env G C (mn, pTs) pns lvars)\<rbrakk> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1932
\<Longrightarrow> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1933
 (\<forall> ST LT T bc' f'.
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1934
  E \<turnstile> s\<surd> \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1935
  (is_inited_LT C pTs lvars LT) \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1936
  bc' = (compStmt jmb s) \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1937
  f' = (compTpStmt jmb G s)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1938
  \<longrightarrow> bc_mt_corresp bc' f' (ST, LT) (comp G) rT (length LT) (length bc'))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1939
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1940
apply (rule stmt.induct)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1941
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1942
(* Skip *) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1943
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1944
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1945
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1946
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1947
(* Expr *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1948
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1949
apply (drule Expr_invers, erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1950
apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1951
apply (rule bc_mt_corresp_comb) apply (rule HOL.refl, simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1952
apply (rule wt_method_compTpExpr_corresp) apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1953
apply (simp add: compTpExpr_LT_ST [of _ pns lvars blk res])+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1954
apply (rule bc_mt_corresp_Pop)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1955
apply (simp add: start_sttp_resp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1956
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1957
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1958
(* Comp *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1959
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1960
apply (drule Comp_invers)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1961
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1962
apply (simp (no_asm_use))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1963
apply (rule bc_mt_corresp_comb) apply (rule HOL.refl) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1964
   apply (simp (no_asm_simp)) apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1965
apply (simp only: compTpStmt_LT_ST) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1966
apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1967
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1968
(* Cond *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1969
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1970
apply (simp (no_asm_simp) only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1971
apply (drule Cond_invers, (erule conjE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1972
apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1973
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1974
apply (subgoal_tac "bc_mt_corresp bc' f' (ST, LT) (comp G) rT (length LT) 0")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1975
prefer 2 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1976
apply (rule bc_mt_corresp_zero) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1977
  apply (simp (no_asm_simp) add: length_compTpStmt length_compTpExpr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1978
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1979
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1980
apply (drule_tac ?bc1.0="[]" and ?bc2.0 = "[LitPush (Bool False)]" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1981
  and ?bc3.0="compExpr jmb expr @ Ifcmpeq (2 + int (length (compStmt jmb stmt1))) #
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1982
            compStmt jmb stmt1 @ Goto (1 + int (length (compStmt jmb stmt2))) #
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1983
            compStmt jmb stmt2" 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1984
  and ?f1.0=comb_nil and ?f2.0 = "pushST [PrimT Boolean]" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1985
  and ?f3.0="compTpExpr jmb G expr \<box> popST 2 \<box> compTpStmt jmb G stmt1 \<box>
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1986
            nochangeST \<box> compTpStmt jmb G stmt2"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1987
  in bc_mt_corresp_comb_inside)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1988
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1989
  apply (rule_tac T="(PrimT Boolean)" in bc_mt_corresp_LitPush)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1990
  apply (simp (no_asm_simp) add: start_sttp_resp_def)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1991
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1992
apply (drule_tac ?bc1.0="[LitPush (Bool False)]" and ?bc2.0 = "compExpr jmb expr"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1993
  and ?bc3.0="Ifcmpeq (2 + int (length (compStmt jmb stmt1))) #
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1994
            compStmt jmb stmt1 @ Goto (1 + int (length (compStmt jmb stmt2))) #
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1995
            compStmt jmb stmt2" 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1996
  and ?f1.0="pushST [PrimT Boolean]" and ?f2.0 = "compTpExpr jmb G expr"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  1997
  and ?f3.0="popST 2 \<box> compTpStmt jmb G stmt1 \<box>
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1998
            nochangeST \<box> compTpStmt jmb G stmt2"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  1999
  in bc_mt_corresp_comb_inside)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2000
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2001
  apply (simp (no_asm_simp)  add: pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2002
  apply (rule  wt_method_compTpExpr_corresp) apply assumption+ 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2003
      apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2004
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2005
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2006
apply (drule_tac ?bc1.0 = "[LitPush (Bool False)] @ compExpr jmb expr" 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2007
    and inst = "Ifcmpeq (2 + int (length (compStmt jmb stmt1)))" 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2008
  and ?bc3.0 = "compStmt jmb stmt1 @ Goto (1 + int (length (compStmt jmb stmt2))) #
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2009
            compStmt jmb stmt2"
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2010
  and ?f1.0="pushST [PrimT Boolean] \<box> compTpExpr jmb G expr" and ?f2.0 = "popST 2"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2011
  and ?f3.0="compTpStmt jmb G stmt1 \<box> nochangeST \<box> compTpStmt jmb G stmt2"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2012
  in bc_mt_corresp_comb_wt_instr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2013
  apply (simp (no_asm_simp) add: length_compTpExpr)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2014
  apply (simp (no_asm_simp) add: start_sttp_resp_comb)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2015
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2016
    (* wt_instr *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2017
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2018
  apply (rule_tac ts="PrimT Boolean" and ts'="PrimT Boolean" 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2019
    and ST=ST and LT=LT 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2020
    in wt_instr_Ifcmpeq)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2021
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2022
  apply (simp (no_asm_simp) only: int_outside_right nat_int, simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2023
  apply (simp (no_asm_simp) only: int_outside_right nat_int, simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2024
    (* current pc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2025
  apply (simp add: length_compTpExpr pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2026
  apply (simp only: compTpExpr_LT_ST) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2027
    (* Suc pc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2028
  apply (simp add: length_compTpExpr pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2029
  apply (simp add: popST_def start_sttp_resp_comb)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2030
    (* jump goal *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2031
  apply (simp (no_asm_simp) only: int_outside_right nat_int, simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2032
  apply (simp add: length_compTpExpr pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2033
  apply (simp add: popST_def start_sttp_resp_comb length_compTpStmt)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2034
  apply (simp only: compTpStmt_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2035
  apply (simp add: nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2036
    (* check_type *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2037
  apply (subgoal_tac "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2038
    (mt_sttp_flatten (f' (ST, LT)) ! length ([LitPush (Bool False)] @ compExpr jmb expr)) = 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2039
    (Some (PrimT Boolean # PrimT Boolean # ST, LT))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2040
  apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2041
  apply (simp (no_asm_simp)) apply (rule trans, rule mt_sttp_flatten_comb_length) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2042
    apply (rule HOL.refl) apply (simp (no_asm_simp) add: length_compTpExpr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2043
    apply (simp (no_asm_simp) add: length_compTpExpr pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2044
    apply (simp only: compTpExpr_LT_ST_rewr) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2045
    (* contracting\<dots> *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2046
  apply (rule contracting_popST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2047
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2048
apply (drule_tac 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2049
  ?bc1.0="[LitPush (Bool False)] @ compExpr jmb expr @ 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2050
           [Ifcmpeq (2 + int (length (compStmt jmb stmt1)))] " 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2051
  and ?bc2.0 = "compStmt jmb stmt1"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2052
  and ?bc3.0="Goto (1 + int (length (compStmt jmb stmt2))) # compStmt jmb stmt2"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2053
  and ?f1.0="pushST [PrimT Boolean] \<box> compTpExpr jmb G expr \<box> popST 2" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2054
  and ?f2.0 = "compTpStmt jmb G stmt1"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2055
  and ?f3.0="nochangeST \<box> compTpStmt jmb G stmt2"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2056
  in bc_mt_corresp_comb_inside)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2057
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2058
  apply (simp (no_asm_simp) add: pushST_def popST_def compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2059
  apply (simp only: compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2060
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2061
  apply (simp (no_asm_simp) add: length_compTpExpr)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2062
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2063
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2064
apply (drule_tac ?bc1.0 = "[LitPush (Bool False)] @ compExpr jmb expr @ [Ifcmpeq (2 + int (length (compStmt jmb stmt1)))] @ compStmt jmb stmt1" 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2065
    and inst = "Goto (1 + int (length (compStmt jmb stmt2)))"
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2066
  and ?bc3.0 = "compStmt jmb stmt2"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2067
  and ?f1.0="pushST [PrimT Boolean] \<box> compTpExpr jmb G expr \<box> popST 2 \<box> 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2068
              compTpStmt jmb G stmt1" 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2069
  and ?f2.0 = "nochangeST"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2070
  and ?f3.0="compTpStmt jmb G stmt2"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2071
  in bc_mt_corresp_comb_wt_instr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2072
  apply (simp (no_asm_simp) add: length_compTpExpr length_compTpStmt)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2073
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2074
  apply (rule wt_instr_Goto)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2075
  apply (simp (no_asm_simp) only: int_outside_right nat_int, simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2076
  apply (simp (no_asm_simp) only: int_outside_right nat_int, simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2077
    (* \<dots> ! nat (int pc + i) = \<dots> ! pc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2078
  apply (simp (no_asm_simp) add: length_compTpExpr length_compTpStmt)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2079
  apply (simp (no_asm_simp) add: pushST_def popST_def nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2080
  apply (simp only: compTpExpr_LT_ST compTpStmt_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2081
  apply (simp (no_asm_simp) add: pushST_def popST_def nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2082
  apply (simp only: compTpExpr_LT_ST compTpStmt_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2083
  apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2084
  apply (simp add: length_compTpExpr length_compTpStmt)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2085
  apply (rule contracting_nochangeST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2086
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2087
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2088
apply (drule_tac 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2089
  ?bc1.0= "[LitPush (Bool False)] @ compExpr jmb expr @ 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2090
            [Ifcmpeq (2 + int (length (compStmt jmb stmt1)))] @ 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2091
            compStmt jmb stmt1 @ [Goto (1 + int (length (compStmt jmb stmt2)))]"
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2092
  and ?bc2.0 = "compStmt jmb stmt2"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2093
  and ?bc3.0="[]"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2094
  and ?f1.0="pushST [PrimT Boolean] \<box> compTpExpr jmb G expr \<box> popST 2 \<box> 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2095
              compTpStmt jmb G stmt1 \<box> nochangeST"
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2096
  and ?f2.0 = "compTpStmt jmb G stmt2"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2097
  and ?f3.0="comb_nil"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2098
  in bc_mt_corresp_comb_inside)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2099
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2100
  apply (simp (no_asm_simp) add: pushST_def popST_def nochangeST_def compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2101
  apply (simp only: compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2102
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2103
  apply (simp only: compTpStmt_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2104
  apply (simp (no_asm_simp) add: length_compTpExpr length_compTpStmt)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2105
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2106
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2107
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2108
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2109
(* Loop *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2110
apply (intro allI impI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2111
apply (simp (no_asm_simp) only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2112
apply (drule Loop_invers, (erule conjE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2113
apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2114
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2115
apply (subgoal_tac "bc_mt_corresp bc' f' (ST, LT) (comp G) rT (length LT) 0")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2116
prefer 2 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2117
apply (rule bc_mt_corresp_zero) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2118
  apply (simp (no_asm_simp) add: length_compTpStmt length_compTpExpr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2119
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2120
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2121
apply (drule_tac ?bc1.0="[]" and ?bc2.0 = "[LitPush (Bool False)]" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2122
  and ?bc3.0="compExpr jmb expr @ Ifcmpeq (2 + int (length (compStmt jmb stmt))) #
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2123
            compStmt jmb stmt @ 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2124
            [Goto (-2 + (- int (length (compStmt jmb stmt)) - int (length (compExpr jmb expr))))]" 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2125
  and ?f1.0=comb_nil and ?f2.0 = "pushST [PrimT Boolean]" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2126
  and ?f3.0="compTpExpr jmb G expr \<box> popST 2 \<box> compTpStmt jmb G stmt \<box> nochangeST"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2127
  in bc_mt_corresp_comb_inside)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2128
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2129
  apply (rule_tac T="(PrimT Boolean)" in bc_mt_corresp_LitPush)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2130
  apply (simp (no_asm_simp) add: start_sttp_resp_def)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2131
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2132
apply (drule_tac ?bc1.0="[LitPush (Bool False)]" and ?bc2.0 = "compExpr jmb expr"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2133
  and ?bc3.0="Ifcmpeq (2 + int (length (compStmt jmb stmt))) #
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2134
            compStmt jmb stmt @ 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2135
            [Goto (-2 + (- int (length (compStmt jmb stmt)) - int (length (compExpr jmb expr))))]" 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2136
  and ?f1.0="pushST [PrimT Boolean]" and ?f2.0 = "compTpExpr jmb G expr"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2137
  and ?f3.0="popST 2 \<box> compTpStmt jmb G stmt \<box> nochangeST"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2138
  in bc_mt_corresp_comb_inside)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2139
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2140
  apply (simp (no_asm_simp)  add: pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2141
  apply (rule  wt_method_compTpExpr_corresp) apply assumption+ 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2142
      apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2143
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2144
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2145
apply (drule_tac ?bc1.0 = "[LitPush (Bool False)] @ compExpr jmb expr" 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2146
    and inst = "Ifcmpeq (2 + int (length (compStmt jmb stmt)))" 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2147
  and ?bc3.0 = "compStmt jmb stmt @ 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2148
       [Goto (-2 + (- int (length (compStmt jmb stmt)) - int (length (compExpr jmb expr))))]"
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2149
  and ?f1.0="pushST [PrimT Boolean] \<box> compTpExpr jmb G expr" and ?f2.0 = "popST 2"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2150
  and ?f3.0="compTpStmt jmb G stmt \<box> nochangeST"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2151
  in bc_mt_corresp_comb_wt_instr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2152
  apply (simp (no_asm_simp) add: length_compTpExpr)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2153
  apply (simp (no_asm_simp) add: start_sttp_resp_comb)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2154
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2155
    (* wt_instr *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2156
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2157
  apply (rule_tac ts="PrimT Boolean" and ts'="PrimT Boolean" 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2158
    and ST=ST and LT=LT 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2159
    in wt_instr_Ifcmpeq)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2160
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2161
  apply (simp (no_asm_simp) only: int_outside_right nat_int, simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2162
  apply (simp (no_asm_simp) only: int_outside_right nat_int, simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2163
    (* current pc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2164
  apply (simp add: length_compTpExpr pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2165
  apply (simp only: compTpExpr_LT_ST) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2166
    (* Suc pc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2167
  apply (simp add: length_compTpExpr pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2168
  apply (simp add: popST_def start_sttp_resp_comb)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2169
    (* jump goal *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2170
  apply (simp (no_asm_simp) only: int_outside_right nat_int, simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2171
  apply (simp add: length_compTpExpr pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2172
  apply (simp add: popST_def start_sttp_resp_comb length_compTpStmt)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2173
  apply (simp only: compTpStmt_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2174
  apply (simp add: nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2175
    (* check_type *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2176
  apply (subgoal_tac "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2177
    (mt_sttp_flatten (f' (ST, LT)) ! length ([LitPush (Bool False)] @ compExpr jmb expr)) = 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2178
    (Some (PrimT Boolean # PrimT Boolean # ST, LT))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2179
  apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2180
  apply (simp (no_asm_simp)) apply (rule trans, rule mt_sttp_flatten_comb_length) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2181
    apply (rule HOL.refl) apply (simp (no_asm_simp) add: length_compTpExpr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2182
    apply (simp (no_asm_simp) add: length_compTpExpr pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2183
    apply (simp only: compTpExpr_LT_ST_rewr) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2184
    (* contracting\<dots> *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2185
  apply (rule contracting_popST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2186
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2187
apply (drule_tac 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2188
  ?bc1.0="[LitPush (Bool False)] @ compExpr jmb expr @ 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2189
           [Ifcmpeq (2 + int (length (compStmt jmb stmt)))] " 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2190
  and ?bc2.0 = "compStmt jmb stmt"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2191
  and ?bc3.0="[Goto (-2 + (- int (length (compStmt jmb stmt)) - int (length (compExpr jmb expr))))]"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2192
  and ?f1.0="pushST [PrimT Boolean] \<box> compTpExpr jmb G expr \<box> popST 2" 
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2193
  and ?f2.0 = "compTpStmt jmb G stmt"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2194
  and ?f3.0="nochangeST"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2195
  in bc_mt_corresp_comb_inside)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2196
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2197
  apply (simp (no_asm_simp) add: pushST_def popST_def compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2198
  apply (simp only: compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2199
  apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2200
  apply (simp (no_asm_simp) add: length_compTpExpr)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2201
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2202
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2203
apply (drule_tac ?bc1.0 = "[LitPush (Bool False)] @ compExpr jmb expr @ [Ifcmpeq (2 + int (length (compStmt jmb stmt)))] @ compStmt jmb stmt" 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2204
    and inst = "Goto (-2 + (- int (length (compStmt jmb stmt)) - int (length (compExpr jmb expr))))"
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2205
  and ?bc3.0 = "[]"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2206
  and ?f1.0="pushST [PrimT Boolean] \<box> compTpExpr jmb G expr \<box> popST 2 \<box> 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2207
              compTpStmt jmb G stmt" 
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2208
  and ?f2.0 = "nochangeST"
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2209
  and ?f3.0="comb_nil"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2210
  in bc_mt_corresp_comb_wt_instr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2211
  apply (simp (no_asm_simp) add: length_compTpExpr length_compTpStmt)+ 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2212
  apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2213
  apply (rule wt_instr_Goto)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2214
  apply arith
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2215
  apply arith
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2216
    (* \<dots> ! nat (int pc + i) = \<dots> ! pc *)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2217
  apply (simp (no_asm_simp))
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2218
  apply (simp (no_asm_simp) add: length_compTpExpr length_compTpStmt)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2219
  apply (simp (no_asm_simp) add: pushST_def popST_def nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2220
  apply (simp only: compTpExpr_LT_ST compTpStmt_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2221
  apply (simp (no_asm_simp) add: length_compTpExpr length_compTpStmt)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2222
  apply (simp only: compTpExpr_LT_ST compTpStmt_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2223
  apply (simp (no_asm_simp) add: pushST_def popST_def nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2224
  apply (simp (no_asm_simp) add: length_compTpExpr length_compTpStmt)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2225
  apply (simp only: compTpExpr_LT_ST compTpStmt_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2226
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2227
  apply (simp add: length_compTpExpr length_compTpStmt) (* check_type *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2228
    apply (simp add: pushST_def popST_def compTpExpr_LT_ST compTpStmt_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2229
  apply (rule contracting_nochangeST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2230
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2231
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2232
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2233
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2234
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2235
  (**********************************************************************************)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2236
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2237
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2238
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2239
lemma wt_method_compTpInit_corresp: "\<lbrakk> jmb = (pns,lvars,blk,res); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2240
  wf_java_mdecl G C ((mn, pTs), rT, jmb); mxr = length LT;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2241
  length LT = (length pns) + (length lvars) + 1;  vn \<in> set (map fst lvars);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2242
  bc = (compInit jmb (vn,ty)); f = (compTpInit jmb (vn,ty));
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2243
  is_type G ty \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2244
  \<Longrightarrow> bc_mt_corresp bc f (ST, LT) (comp G) rT mxr (length bc)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2245
apply (simp add: compInit_def compTpInit_def split_beta)
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 14045
diff changeset
  2246
apply (rule_tac ?bc1.0="[load_default_val ty]" and ?bc2.0="[Store (index jmb vn)]" 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2247
  in bc_mt_corresp_comb) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2248
  apply simp+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2249
  apply (simp add: load_default_val_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2250
   apply (rule typeof_default_val [THEN exE]) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2251
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2252
  apply (rule bc_mt_corresp_LitPush_CT) apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2253
    apply (simp add: comp_is_type)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2254
apply (simp add: pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2255
  apply (rule bc_mt_corresp_Store_init)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2256
  apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2257
  apply (rule index_length_lvars [THEN conjunct2])
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2258
apply auto
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2259
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2260
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2261
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2262
lemma wt_method_compTpInitLvars_corresp_aux [rule_format (no_asm)]: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2263
  \<forall> lvars_pre lvars0 ST LT.
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2264
  jmb = (pns,lvars0,blk,res) \<and>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2265
  lvars0 = (lvars_pre @ lvars) \<and>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2266
  length LT = (length pns) + (length lvars0) + 1 \<and>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2267
  wf_java_mdecl G C ((mn, pTs), rT, jmb)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2268
 \<longrightarrow> bc_mt_corresp (compInitLvars jmb lvars) (compTpInitLvars jmb lvars) (ST, LT) (comp G) rT 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2269
       (length LT) (length (compInitLvars jmb lvars))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2270
apply (induct lvars)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2271
apply (simp add: compInitLvars_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2272
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2273
apply (intro strip, (erule conjE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2274
apply (subgoal_tac "\<exists> vn ty. a = (vn, ty)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2275
  prefer 2 apply (simp (no_asm_simp)) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2276
  apply ((erule exE)+, simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2277
apply (drule_tac x="lvars_pre @ [a]" in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2278
apply (drule_tac x="lvars0" in spec)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2279
apply (simp (no_asm_simp) add: compInitLvars_def)
15236
f289e8ba2bb3 Proofs needed to be updated because induction now preserves name of
nipkow
parents: 14981
diff changeset
  2280
apply (rule_tac ?bc1.0="compInit jmb a" and ?bc2.0="compInitLvars jmb lvars"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2281
  in bc_mt_corresp_comb)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2282
apply (simp (no_asm_simp) add: compInitLvars_def)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2283
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2284
apply (rule_tac vn=vn and ty=ty in wt_method_compTpInit_corresp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2285
apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2286
apply (simp (no_asm_simp))+ 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32642
diff changeset
  2287
apply (simp add: wf_java_mdecl_def)     (* is_type G ty *)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2288
apply (simp add: compTpInit_def storeST_def pushST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2289
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2290
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2291
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2292
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2293
lemma wt_method_compTpInitLvars_corresp: "\<lbrakk> jmb = (pns,lvars,blk,res); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2294
  wf_java_mdecl G C ((mn, pTs), rT, jmb);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2295
  length LT = (length pns) + (length lvars) + 1; mxr = (length LT);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2296
  bc = (compInitLvars jmb lvars); f= (compTpInitLvars jmb lvars) \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2297
  \<Longrightarrow> bc_mt_corresp bc f (ST, LT) (comp G) rT mxr (length bc)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2298
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2299
apply (subgoal_tac "bc_mt_corresp (compInitLvars (pns, lvars, blk, res) lvars)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2300
        (compTpInitLvars (pns, lvars, blk, res) lvars) (ST, LT) (TranslComp.comp G) rT
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2301
        (length LT) (length (compInitLvars (pns, lvars, blk, res) lvars))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2302
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2303
apply (rule_tac lvars_pre="[]" in wt_method_compTpInitLvars_corresp_aux)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2304
apply auto
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2305
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2306
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2307
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2308
  (**********************************************************************************)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2309
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2310
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2311
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2312
lemma wt_method_comp_wo_return: "\<lbrakk> wf_prog wf_java_mdecl G;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2313
  wf_java_mdecl G C ((mn, pTs), rT, jmb); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2314
  bc = compInitLvars jmb lvars @ compStmt jmb blk @ compExpr jmb res;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2315
  jmb = (pns,lvars,blk,res); 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2316
  f = (compTpInitLvars jmb lvars \<box> compTpStmt jmb G blk \<box> compTpExpr jmb G res);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2317
  sttp = (start_ST, start_LT C pTs (length lvars));
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2318
  li = (length (inited_LT C pTs lvars))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2319
  \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2320
\<Longrightarrow> bc_mt_corresp bc f sttp (comp G) rT  li (length bc)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2321
apply (subgoal_tac "\<exists> E. (E = (local_env G C (mn, pTs) pns lvars) \<and> E \<turnstile> blk \<surd> \<and> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2322
                         (\<exists>T. E\<turnstile>res::T \<and> G\<turnstile>T\<preceq>rT))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2323
   apply (erule exE, (erule conjE)+)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2324
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2325
apply (rule bc_mt_corresp_comb) apply (rule HOL.refl)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2326
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2327
  (* InitLvars *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2328
apply (rule wt_method_compTpInitLvars_corresp) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2329
   apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2330
   apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2331
   apply (simp (no_asm_simp) add: start_LT_def) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2332
       apply (rule wf_java_mdecl_length_pTs_pns, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2333
   apply (simp (no_asm_simp) only: start_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2334
   apply (simp (no_asm_simp) add: inited_LT_def)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2335
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2336
apply (rule bc_mt_corresp_comb) apply (rule HOL.refl)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2337
   apply (simp (no_asm_simp) add: compTpInitLvars_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2338
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2339
     (* stmt *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2340
apply (simp only: compTpInitLvars_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2341
apply (subgoal_tac "(Suc (length pTs + length lvars)) = (length (inited_LT C pTs lvars))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2342
   prefer 2 apply (simp (no_asm_simp) add: inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2343
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2344
apply (rule_tac s=blk in wt_method_compTpStmt_corresp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2345
   apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2346
   apply (simp only:)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2347
   apply (simp (no_asm_simp) add: is_inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2348
   apply (simp only:)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2349
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2350
     (* expr *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2351
apply (simp only: compTpInitLvars_LT_ST compTpStmt_LT_ST is_inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2352
apply (subgoal_tac "(Suc (length pTs + length lvars)) = (length (inited_LT C pTs lvars))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2353
   prefer 2 apply (simp (no_asm_simp) add: inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2354
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2355
apply (rule_tac ex=res in wt_method_compTpExpr_corresp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2356
   apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2357
   apply (simp only:)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2358
   apply (simp (no_asm_simp) add: is_inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2359
   apply (simp only:)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2360
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2361
     (* start_sttp_resp *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2362
apply (simp add: start_sttp_resp_comb)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2363
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2364
  (* subgoal *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2365
apply (simp add: wf_java_mdecl_def local_env_def) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2366
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2367
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2368
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2369
  (**********************************************************************************)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2370
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2371
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2372
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2373
lemma check_type_start: "\<lbrakk> wf_mhead cG (mn, pTs) rT; is_class cG C\<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2374
  \<Longrightarrow> check_type cG (length start_ST) (Suc (length pTs + mxl))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2375
              (OK (Some (start_ST, start_LT C pTs mxl)))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2376
apply (simp add: check_type_def wf_mhead_def start_ST_def start_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2377
apply (simp add: check_type_simps)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2378
apply (simp only: list_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2379
apply (auto simp: err_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2380
apply (subgoal_tac "set (replicate mxl Err) \<subseteq>  {Err}")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2381
apply blast
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2382
apply (rule subset_replicate)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2383
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2384
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2385
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2386
lemma wt_method_comp_aux: "\<lbrakk>   bc' = bc @ [Return]; f' = (f \<box> nochangeST);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2387
  bc_mt_corresp bc f sttp0 cG rT (1+length pTs+mxl) (length bc);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2388
  start_sttp_resp_cons f';
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2389
  sttp0 = (start_ST, start_LT C pTs mxl);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2390
  mxs = max_ssize (mt_of (f' sttp0));
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2391
  wf_mhead cG (mn, pTs) rT; is_class cG C;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2392
  sttp_of (f sttp0) = (T # ST, LT);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2393
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2394
  check_type cG mxs (1+length pTs+mxl) (OK (Some (T # ST, LT))) \<longrightarrow>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2395
  wt_instr_altern Return cG rT (mt_of (f' sttp0)) mxs (1+length pTs+mxl) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2396
         (Suc (length bc)) empty_et (length bc)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2397
\<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2398
\<Longrightarrow> wt_method_altern cG C pTs rT mxs mxl bc' empty_et (mt_of (f' sttp0))"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2399
apply (subgoal_tac "check_type cG (length start_ST) (Suc (length pTs + mxl))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2400
              (OK (Some (start_ST, start_LT C pTs mxl)))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2401
apply (subgoal_tac "check_type cG mxs (1+length pTs+mxl) (OK (Some (T # ST, LT)))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2402
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2403
apply (simp add: wt_method_altern_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2404
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2405
  (* length (.. f ..) = length bc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2406
apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2407
apply (simp add: bc_mt_corresp_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2408
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2409
  (* check_bounded *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2410
apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2411
apply (simp add: bc_mt_corresp_def split_beta check_bounded_def) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2412
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2413
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2414
apply (subgoal_tac "pc < (length bc) \<or> pc = length bc")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2415
  apply (erule disjE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2416
    (* case  pc < length bc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2417
    apply (subgoal_tac "(bc' ! pc) = (bc ! pc)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2418
    apply (simp add: wt_instr_altern_def eff_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2419
      (* subgoal *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2420
    apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2421
    (* case  pc = length bc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2422
    apply (subgoal_tac "(bc' ! pc) = Return")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2423
    apply (simp add: wt_instr_altern_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2424
      (* subgoal *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2425
    apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2426
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2427
    (* subgoal pc < length bc \<or> pc = length bc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2428
apply arith
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2429
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2430
  (* wt_start *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2431
apply (rule conjI)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2432
apply (simp add: wt_start_def start_sttp_resp_cons_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2433
  apply (drule_tac x=sttp0 in spec) apply (erule exE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2434
  apply (simp add: mt_sttp_flatten_def start_ST_def start_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2435
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2436
  (* wt_instr *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2437
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2438
apply (subgoal_tac "pc < (length bc) \<or> pc = length bc")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2439
apply (erule disjE)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2440
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2441
  (* pc < (length bc) *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2442
apply (simp (no_asm_use) add: bc_mt_corresp_def mt_sttp_flatten_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2443
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2444
apply (drule mp, assumption)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2445
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2446
apply (drule spec, drule mp, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2447
apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2448
apply (simp (no_asm_simp) add: comb_def split_beta nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2449
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2450
  (* pc = length bc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2451
apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2452
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2453
  (* subgoal pc < (length bc) \<or> pc = length bc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2454
apply arith
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2455
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2456
  (* subgoals *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2457
apply (simp (no_asm_use) add: bc_mt_corresp_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2458
apply (subgoal_tac "check_type cG (length (fst sttp0)) (Suc (length pTs + mxl))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2459
         (OK (Some sttp0))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2460
apply ((erule conjE)+, drule mp, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2461
apply (simp add: nth_append)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2462
apply (simp (no_asm_simp) add: comb_def nochangeST_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2463
apply (simp (no_asm_simp))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2464
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2465
apply (rule check_type_start, assumption+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2466
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2467
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2468
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2469
lemma wt_instr_Return: "\<lbrakk>fst f ! pc = Some (T # ST, LT); (G \<turnstile> T \<preceq> rT); pc < max_pc;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2470
  check_type (TranslComp.comp G) mxs mxr (OK (Some (T # ST, LT)))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2471
  \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2472
  \<Longrightarrow> wt_instr_altern Return (comp G) rT  (mt_of f) mxs mxr max_pc empty_et pc"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2473
  apply (case_tac "(mt_of f ! pc)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2474
  apply (simp  add: wt_instr_altern_def eff_def norm_eff_def app_def)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2475
  apply (drule sym)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2476
  apply (simp add: comp_widen xcpt_app_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2477
  done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2478
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2479
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2480
theorem wt_method_comp: "
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2481
  \<lbrakk> wf_java_prog G; (C, D, fds, mths) \<in> set G; jmdcl \<in> set mths;
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2482
  jmdcl = ((mn,pTs), rT, jmb);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2483
  mt = (compTpMethod G C jmdcl);
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2484
  (mxs, mxl, bc, et) = mtd_mb (compMethod G C jmdcl) \<rbrakk>
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2485
  \<Longrightarrow> wt_method (comp G) C pTs rT mxs mxl bc et mt"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2486
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2487
  (* show statement for wt_method_altern *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2488
apply (rule wt_method_altern_wt_method)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2489
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2490
apply (subgoal_tac "wf_java_mdecl G C jmdcl")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2491
apply (subgoal_tac "wf_mhead G (mn, pTs) rT")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2492
apply (subgoal_tac "is_class G C")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2493
apply (subgoal_tac "\<forall> jmb. \<exists> pns lvars blk res. jmb = (pns, lvars, blk, res)")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2494
   apply (drule_tac x=jmb in spec, (erule exE)+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2495
apply (subgoal_tac "\<exists> E. (E = (local_env G C (mn, pTs) pns lvars) \<and> E \<turnstile> blk \<surd> \<and> 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2496
                         (\<exists>T. E\<turnstile>res::T \<and> G\<turnstile>T\<preceq>rT))")
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2497
   apply (erule exE, (erule conjE)+)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2498
apply (simp add: compMethod_def compTpMethod_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2499
apply (rule_tac T=T and LT="inited_LT C pTs lvars" and ST=start_ST in wt_method_comp_aux)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2500
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2501
  (* bc *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2502
apply (simp only: append_assoc [THEN sym])
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2503
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2504
  (* comb *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2505
apply (simp only: comb_assoc [THEN sym])
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2506
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2507
  (* bc_corresp *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2508
apply (rule wt_method_comp_wo_return)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2509
  apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2510
  apply (simp (no_asm_use) only: append_assoc)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2511
  apply (rule HOL.refl)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2512
  apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2513
  apply (simp (no_asm_simp) add: inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2514
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2515
  (* start_sttp_resp *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2516
apply (simp add: start_sttp_resp_cons_comb_cons_r)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2517
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2518
  (* wf_mhead / is_class *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2519
apply (simp add: wf_mhead_def comp_is_type)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2520
apply (simp add: comp_is_class)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2521
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2522
  (* sttp_of .. = (T # ST, LT) *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2523
apply (simp (no_asm_simp) add: compTpInitLvars_LT_ST compTpExpr_LT_ST compTpStmt_LT_ST is_inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2524
apply (subgoal_tac "(snd (compTpInitLvars (pns, lvars, blk, res) lvars
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2525
                              (start_ST, start_LT C pTs (length lvars))))
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2526
                = (start_ST, inited_LT C pTs lvars)") 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2527
   prefer 2 apply (rule compTpInitLvars_LT_ST) apply (rule HOL.refl) apply assumption
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2528
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2529
apply (subgoal_tac "(snd (compTpStmt (pns, lvars, blk, res) G blk
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2530
                       (start_ST, inited_LT C pTs lvars))) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2531
                = (start_ST, inited_LT C pTs lvars)") 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2532
   prefer 2 apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2533
   apply (rule compTpStmt_LT_ST) apply (rule HOL.refl) apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2534
   apply (simp only:)+ apply (simp (no_asm_simp) add: is_inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2535
apply (simp only:)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2536
apply (rule compTpExpr_LT_ST) apply (rule HOL.refl) apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2537
   apply (simp only:)+ apply (simp (no_asm_simp) add: is_inited_LT_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2538
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2539
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2540
   (* Return *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2541
apply (intro strip)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2542
apply (rule_tac T=T and ST=start_ST and LT="inited_LT C pTs lvars" in wt_instr_Return)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2543
apply (simp (no_asm_simp) add: nth_append 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2544
  length_compTpInitLvars length_compTpStmt length_compTpExpr)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2545
apply (simp only: compTpInitLvars_LT_ST compTpStmt_LT_ST compTpExpr_LT_ST 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2546
  nochangeST_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2547
apply (simp only: is_inited_LT_def compTpStmt_LT_ST compTpExpr_LT_ST)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2548
apply (simp (no_asm_simp))+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2549
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2550
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2551
  (* subgoal \<exists> E. \<dots> *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2552
apply (simp add: wf_java_mdecl_def local_env_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2553
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2554
  (* subgoal jmb = (\<dots>) *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2555
apply (simp only: split_paired_All, simp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2556
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2557
  (* subgoal is_class / wf_mhead / wf_java_mdecl *)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2558
apply (blast intro: methd [THEN conjunct2])
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2559
apply (frule wf_prog_wf_mdecl, assumption+) apply (simp only:) apply (simp add: wf_mdecl_def)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2560
apply (rule wf_java_prog_wf_java_mdecl, assumption+)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2561
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2562
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2563
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2564
lemma comp_set_ms: "(C, D, fs, cms)\<in>set (comp G) 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2565
  \<Longrightarrow> \<exists> ms. (C, D, fs, ms) \<in>set G   \<and> cms = map (compMethod G C) ms"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2566
by (auto simp: comp_def compClass_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2567
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2568
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2569
  (* ---------------------------------------------------------------------- *)
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2570
13679
2ebad1cb045f fixed latex output
kleing
parents: 13676
diff changeset
  2571
section "Main Theorem"
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2572
  (* MAIN THEOREM: 
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2573
  Methodtype computed by comp is correct for bytecode generated by compTp *)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2574
theorem wt_prog_comp: "wf_java_prog G  \<Longrightarrow> wt_jvm_prog (comp G) (compTp G)"
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2575
apply (simp add: wf_prog_def)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2576
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2577
apply (subgoal_tac "wf_java_prog G") prefer 2 apply (simp add: wf_prog_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2578
apply (simp (no_asm_simp) add: wf_prog_def wt_jvm_prog_def)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2579
apply (simp add: comp_ws_prog)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2580
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2581
apply (intro strip)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2582
apply (subgoal_tac "\<exists> C D fs cms. c = (C, D, fs, cms)")
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2583
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2584
apply (frule comp_set_ms)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2585
apply clarify
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2586
apply (drule bspec, assumption)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2587
apply (rule conjI)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2588
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2589
  (* wf_mrT *)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2590
apply (case_tac "C = Object")
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2591
apply (simp add: wf_mrT_def)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2592
apply (subgoal_tac "is_class G D")
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2593
apply (simp add: comp_wf_mrT)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2594
apply (simp add: wf_prog_def ws_prog_def ws_cdecl_def)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2595
apply blast
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2596
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2597
  (* wf_cdecl_mdecl *)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2598
apply (simp add: wf_cdecl_mdecl_def)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2599
apply (simp add: split_beta)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2600
apply (intro strip)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2601
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2602
  (* show wt_method \<dots> *)
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2603
apply (subgoal_tac "\<exists> sig rT mb. x = (sig, rT, mb)") 
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2604
apply (erule exE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2605
apply (simp (no_asm_simp) add: compMethod_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2606
apply (erule conjE)+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2607
apply (drule_tac x="(sig, rT, mb)" in bspec) apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2608
apply (rule_tac mn="fst sig" and pTs="snd sig" in wt_method_comp)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2609
  apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2610
  apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2611
apply (simp (no_asm_simp) add: compTp_def)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2612
apply (simp (no_asm_simp) add: compMethod_def split_beta)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2613
apply (frule WellForm.methd) apply assumption+
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2614
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2615
apply simp
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2616
apply (simp add: compMethod_def split_beta)
14045
a34d89ce6097 Introduced distinction wf_prog vs. ws_prog
streckem
parents: 14025
diff changeset
  2617
apply auto
13673
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2618
done
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2619
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2620
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2621
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2622
  (**********************************************************************************)
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2623
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2624
declare split_paired_All [simp add]
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2625
declare split_paired_Ex [simp add]
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2626
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2627
2950128b8206 First checkin of compiler
streckem
parents:
diff changeset
  2628
end