src/HOL/MicroJava/Comp/CorrCompTp.thy
changeset 58886 8a6cac7c7247
parent 58263 6c907aad90ba
child 59199 cb8e5f7a5e4a
equal deleted inserted replaced
58885:47fdd4f40d00 58886:8a6cac7c7247
    35 done
    35 done
    36 
    36 
    37 
    37 
    38 
    38 
    39 (********************************************************************************)
    39 (********************************************************************************)
    40 section "index"
    40 subsection "index"
    41 
    41 
    42 lemma local_env_snd: "
    42 lemma local_env_snd: "
    43   snd (local_env G C (mn, pTs) pns lvars) = map_of lvars(pns[\<mapsto>]pTs)(This\<mapsto>Class C)"
    43   snd (local_env G C (mn, pTs) pns lvars) = map_of lvars(pns[\<mapsto>]pTs)(This\<mapsto>Class C)"
    44 by (simp add: local_env_def)
    44 by (simp add: local_env_def)
    45 
    45 
   193 done
   193 done
   194 
   194 
   195 
   195 
   196 (********************************************************************************)
   196 (********************************************************************************)
   197 
   197 
   198 section "Preservation of ST and LT by compTpExpr / compTpStmt"
   198 subsection "Preservation of ST and LT by compTpExpr / compTpStmt"
   199 
   199 
   200 lemma sttp_of_comb_nil [simp]: "sttp_of (comb_nil sttp) = sttp"
   200 lemma sttp_of_comb_nil [simp]: "sttp_of (comb_nil sttp) = sttp"
   201 by (simp add: comb_nil_def)
   201 by (simp add: comb_nil_def)
   202 
   202 
   203 lemma mt_of_comb_nil [simp]: "mt_of (comb_nil sttp) = []"
   203 lemma mt_of_comb_nil [simp]: "mt_of (comb_nil sttp) = []"
   785 
   785 
   786 
   786 
   787 
   787 
   788 
   788 
   789   (* ********************************************************************** *)
   789   (* ********************************************************************** *)
   790 section "length of compExpr/ compTpExprs"
   790 subsection "length of compExpr/ compTpExprs"
   791   (* ********************************************************************** *)
   791   (* ********************************************************************** *)
   792 
   792 
   793 lemma length_comb [simp]:  "length (mt_of ((f1 \<box> f2) sttp)) = 
   793 lemma length_comb [simp]:  "length (mt_of ((f1 \<box> f2) sttp)) = 
   794   length (mt_of (f1 sttp)) + length (mt_of (f2 (sttp_of (f1 sttp))))"
   794   length (mt_of (f1 sttp)) + length (mt_of (f2 (sttp_of (f1 sttp))))"
   795 by (simp add: comb_def split_beta)
   795 by (simp add: comb_def split_beta)
   851   "\<forall> sttp. length (mt_of (compTpInitLvars jmb lvars sttp)) = length (compInitLvars jmb lvars)"
   851   "\<forall> sttp. length (mt_of (compTpInitLvars jmb lvars sttp)) = length (compInitLvars jmb lvars)"
   852 by (induct lvars,  (simp add: compInitLvars_def length_compTpInit split_beta)+)
   852 by (induct lvars,  (simp add: compInitLvars_def length_compTpInit split_beta)+)
   853 
   853 
   854 
   854 
   855   (* ********************************************************************** *)
   855   (* ********************************************************************** *)
   856 section "Correspondence bytecode - method types"
   856 subsection "Correspondence bytecode - method types"
   857   (* ********************************************************************** *)
   857   (* ********************************************************************** *)
   858 
   858 
   859 abbreviation (input)
   859 abbreviation (input)
   860   ST_of :: "state_type \<Rightarrow> opstack_type"
   860   ST_of :: "state_type \<Rightarrow> opstack_type"
   861   where "ST_of == fst"
   861   where "ST_of == fst"
  2557 by (auto simp: comp_def compClass_def)
  2557 by (auto simp: comp_def compClass_def)
  2558 
  2558 
  2559 
  2559 
  2560   (* ---------------------------------------------------------------------- *)
  2560   (* ---------------------------------------------------------------------- *)
  2561 
  2561 
  2562 section "Main Theorem"
  2562 subsection "Main Theorem"
  2563   (* MAIN THEOREM: 
  2563   (* MAIN THEOREM: 
  2564   Methodtype computed by comp is correct for bytecode generated by compTp *)
  2564   Methodtype computed by comp is correct for bytecode generated by compTp *)
  2565 theorem wt_prog_comp: "wf_java_prog G  \<Longrightarrow> wt_jvm_prog (comp G) (compTp G)"
  2565 theorem wt_prog_comp: "wf_java_prog G  \<Longrightarrow> wt_jvm_prog (comp G) (compTp G)"
  2566 apply (simp add: wf_prog_def)
  2566 apply (simp add: wf_prog_def)
  2567 
  2567