Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Archive-of-Formal-Proofs/thys/Jinja/BV/   (Sammlung formaler Beweise Version 2026-5©)  Datei vom 31.4.2026 mit Größe 5 kB image not shown  

Quelle  BVConform.thy

  Sprache: Isabelle
 

(*  Title:      HOL/MicroJava/BV/Correct.thy

    Author:     Cornelia Pusch, Gerwin Klein
    Copyright   1999 Technische Universitaet Muenchen

The invariant for the type safety proof.
*)


section BV Type Safety Invariant

theory BVConform
imports BVSpec "../JVM/JVMExec" "../Common/Conform"
begin


definition confT :: "'c prog ==> heap ==> val ==> ty err ==> bool" 
    (_,_ _ :\ _ [51,51,51,5150)
where
  "P,h v :\<top> E case E of Err ==> True | OK T ==> P,h v : T"

notation (ASCII)
  confT  (_,_ |- _ :<=T _ [51,51,51,5150)

abbreviation
  confTs :: "'c prog ==> heap ==> val list ==> tyl ==> bool" 
      (_,_ _ [:\] _ [51,51,51,5150where
  "P,h vs [:\<top>] Ts list_all2 (confT P h) vs Ts"

notation (ASCII)
  confTs  (_,_ |- _ [:<=T] _ [51,51,51,5150)

definition conf_f  :: "jvm_prog ==> heap ==> tyi ==> bytecode ==> frame ==> bool"
where
  "conf_f P h λ(ST,LT) is (stk,loc,C,M,pc).
  P,h stk [:] ST P,h loc [:\<top>] LT pc < size is"

lemma conf_f_def2:
  "conf_f P h (ST,LT) is (stk,loc,C,M,pc)
  P,h stk [:] ST P,h loc [:\<top>] LT pc < size is"
  by (simp add: conf_f_def)


primrec conf_fs :: "[jvm_prog,heap,tyP,mname,nat,ty,frame list] ==> bool"
where
  "conf_fs P h Φ M0 n0 T0 [] = True"
"conf_fs P h Φ M0 n0 T0 (f#frs) =
  (let (stk,loc,C,M,pc) = f in
  (ST LT Ts T mxs mxl0 is xt.
    Φ C M ! pc = Some (ST,LT)
    (P C sees M:Ts T = (mxs,mxl0,is,xt) in C)
    (D Ts' T' m D'.
       is!pc = (Invoke M0 n0) ST!n0 = Class D
       P D sees M0:Ts' T' = m in D' P T0 T')
    conf_f P h (ST, LT) is f conf_fs P h Φ M (size Ts) T frs))"


definition correct_state :: "[jvm_prog,tyP,jvm_state] ==> bool"  (_,_ _  [61,0,061)
where
  "correct_state P Φ λ(xp,h,frs).
  case xp of
     None ==> (case frs of
             [] ==> True
             | (f#fs) ==> P h
             (let (stk,loc,C,M,pc) = f
              in Ts T mxs mxl0 is xt τ.
                    (P C sees M:TsT = (mxs,mxl0,is,xt) in C)
                    Φ C M ! pc = Some τ
                    conf_f P h τ is f conf_fs P h Φ M (size Ts) T fs))
  | Some x ==> frs = []" 

notation
  correct_state  (_,_ |- _ [ok]  [61,0,061)


subsection Values and

lemma confT_Err [iff]: "P,h x :\<top> Err" 
  by (simp add: confT_def)

lemma confT_OK [iff]:  "P,h x :\<top> OK T = (P,h x : T)"
  by (simp add: confT_def)

lemma confT_cases:
  "P,h x :\<top> X = (X = Err (T. X = OK T P,h x : T))"
  by (cases X) auto

lemma confT_hext [intro?, trans]:
  "[ P,h x :\<top> T; h h' ] ==> P,h' x :\<top> T"
  by (cases T) (blast intro: conf_hext)+

lemma confT_widen [intro?, trans]:
  "[ P,h x :\<top> T; P T \<top> T' ] ==> P,h x :\<top> T'"
  by (cases T', auto intro: conf_widen)


subsection Stack and Registers

lemmas confTs_Cons1 [iff] = list_all2_Cons1 [of "confT P h"for P h

lemma confTs_confT_sup:
  "[ P,h loc [:\<top>] LT; n < size LT; LT!n = OK T; P T T' ]
  ==> P,h (loc!n) : T'"
(*<*)
  apply (frule list_all2_lengthD)
  apply (drule list_all2_nthD, simp)
  apply simp
  apply (erule conf_widen, assumption+)
  done
(*>*)

lemma confTs_hext [intro?]:
  "P,h loc [:\<top>] LT ==> h h' ==> P,h' loc [:\<top>] LT"
  by (fast elim: list_all2_mono confT_hext)    

lemma confTs_widen [intro?, trans]:
  "P,h loc [:\<top>] LT ==> P LT [\<top>] LT' ==> P,h loc [:\<top>] LT'"
  by (rule list_all2_trans, rule confT_widen)

lemma confTs_map [iff]:
  "vs. (P,h vs [:\<top>] map OK Ts) = (P,h vs [:] Ts)"
  by (induct Ts) (auto simp add: list_all2_Cons2)

lemma reg_widen_Err [iff]:
  "LT. (P replicate n Err [\<top>] LT) = (LT = replicate n Err)"
  by (induct n) (auto simp add: list_all2_Cons1)
    
lemma confTs_Err [iff]:
  "P,h replicate n v [:\<top>] replicate n Err"
  by (induct n) auto

  
subsection correct-frames

lemmas [simp del] = fun_upd_apply

lemma conf_fs_hext:
  "M n Tr.
  [ conf_fs P h Φ M n Tr frs; h h' ] ==> conf_fs P h' Φ M n Tr frs"
(*<*)
apply (induct frs)
 apply simp
apply clarify
apply (simp (no_asm_use))
apply clarify
apply (unfold conf_f_def)
apply (simp (no_asm_use))
apply clarify
apply (fast elim!: confs_hext confTs_hext)
done
(*>*)

end

Messung V0.5 in Prozent
C=82 H=84 G=82

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.