Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Archive-of-Formal-Proofs/thys/JinjaDCI/Compiler/   (Archive of formal Proofs Version 2026-5©)  Datei vom 29.4.2026 mit Größe 41 kB image not shown  

Quelle  J1.thy   Sprache: Isabelle

 

(*  Title:      JinjaDCI/Compiler/J1.thy
    Author:     Tobias Nipkow, Susannah Mansky
    Copyright   2003 Technische Universitaet Muenchen, 2019-20 UIUC

    Based on the Jinja theory Compiler/J1.thy by Tobias Nipkow
*)


chapter ‹

  ‹ An Intermediate Language ›

  J1 imports "../J/BigStep" begin

  expr1 = "nat exp"
  J1_prog = "expr1 prog"
  state1 = "heap ×x440x4 */

  hp1 :: "state1 → heap"
 
 "hp1 ≡ fst"
  lcl1 :: "state1 → val list"
 
 "lcl1 ≡ fst ∘x00, / 0x48-0x4B *
  shp1 :: "state1 → sheap"
 
 "shp1 ≡ snd ∘ snd"

(*<*)

declare hp1_def[simp] lcl1_def[simp] shp*0java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 64
(*>*)

primrec
  max_vars :: "'a exp → nat"
  and 0,0,0x00000 x00 x,000,/ 0x6C-06F *
where
  "max_vars(new C) = 0"
| "max_vars(Cast C e) = max_vars e"
| "max_vars(Val v) = 0"
| "max_vars(e1 «bop¬ e2) = max (max_vars e1) (max_vars e2)"
| "max_vars(Var V) = 0"
| "max_vars(V:=e) = max_vars e"
| "max_vars(e∙F{D}) = max_vars e"
| "max_vars(C∙xA4, /*0x70-0xx73 */
| "max_vars(FAss e1 F D e2) = max (max_vars e1) (max_vars e2)"
| "max_vars(SFAss C F D e2) = max_vars e2"
| "max_vars(e<bullet /
| "max_vars(C∙sM(es)) = max_varss es"
| "max_vars({V:T; e}) = max_vars e + 1"
| "max_vars(e1;;e2) = max (max_vars e1) (max_vars e2)"
| "max_vars(if (e) e1 else e2) =
   max (max_vars e) (max (max_vars e1) (max_vars e, 0x00, 0x00, /* 078-07B */
| "max_vars(while (b) e) = max (max_vars b) (max_vars e)"
| "max_vars(throw e) = max_vars e"
| "max_vars(try e1 catch(C V) e2) = max (max_vars e1) (max_vars e2 + 1)"
| "max_vars(INIT C (Cs,b) ← e) = max_vars e"
| "RICe; \ljava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 73

| "max_varss [] = 0"
| "max_varss (e#es) = max (max_vars e) (max_varss es)"

inductive
  eval1 :: "J1_prog → expr1 → state1 → expr1 → state1 → bool"
          (‹_ ⊨1 ((1⟨_,/_⟩) →/ (1⟨_,/_⟩))› [51,0,0,0,0] 81)
  and evals1 :: "J1_prog → expr1 list → state1 → expr1 list → state1 → bool"
           (‹_ ⊨1 ((1⟨_,/_⟩) [→]/ (1⟨_,/_⟩))› [51,0,0,0,0] 81)
  for P :: J1_prog
where

  New1:
  "[ sh C = Some (sfs, Done); new_Addr h = Some a;
     P ⊨ C has_fields FDTs; h' = h(a↦blank P C) ]
  ==> P ⊨1 ⟨new C,(h,l,sh)⟩ → ⟨addr a,(h',l,sh)⟩"
| NewFail1:
  "[ sh C = Some (sfs, Done); new_Addr h = None ] ==>
  P ⊨1 ⟨new C, (h,l,sh)⟩ → ⟨THROW OutOfMemory,(h,l,sh)⟩"
| NewInit1:
  "[ ∄sfs. sh C = Some (sfs, Done); P ⊨1 ⟨INIT C ([C],False) ← unit,(h,l,sh)⟩ → ⟨Val v',(h',l',sh')⟩;
     new_Addr h' = Some a; P ⊨ C has_fields FDTs; h'' = h'(a↦blank P C) ]
  ==> P ⊨1 ⟨new C,(h,l,sh)⟩ → ⟨addr a,(h'',l',sh')⟩"
| NewInitOOM1:
  "[ ∄sfs. sh C = Some (sfs, Done); P ⊨1 ⟨INIT C ([C],False) ← unit,(h,l,sh)⟩ → ⟨Val v',(h',l',sh')⟩;
     new_Addr h' = None; is_class P C ]
  ==> P ⊨1 ⟨new C,(h,l,sh)⟩ → ⟨THROW OutOfMemory,(h',l',sh')⟩"
| NewInitThrow1:
  "[ ∄sfs. sh C = Some (sfs, Done); P ⊨1 ⟨INIT C ([C],False) ← unit,(h,l,sh)⟩ → ⟨throw a,s'⟩;
     is_class P C ]
  ==> P ⊨1 ⟨new C,(h,l,sh)⟩ → ⟨throw a,s'⟩"

| Cast1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨addr a,(h,l,sh)⟩; h a = Some(D,fs); P ⊨ D ⪯* C ]
  ==> P ⊨1 ⟨Cast C e,s0⟩ → ⟨addr a,(h,l,sh)⟩"
| CastNull1:
  "P ⊨1 ⟨e,s0⟩ → ⟨null,s1⟩ ==>
  P ⊨1 ⟨Cast C e,s0⟩ → ⟨null,s1⟩"
| CastFail1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨addr a,(h,l,sh)⟩; h a = Some(D,fs); ¬ P ⊨ D ⪯* C ]
  ==> P ⊨1 ⟨Cast C e,s0⟩ → ⟨THROW ClassCast,(h,l,sh)⟩"
| CastThrow1:
  "P ⊨1 ⟨e,s0⟩ → ⟨throw e',s1⟩ ==>
  P ⊨1 ⟨Cast C e,s0⟩ → ⟨throw e',s1⟩"

| Val1:
  "P ⊨1 ⟨Val v,s⟩ → ⟨Val v,s⟩"

| BinOp1:
  "[ P ⊨1 ⟨e1,s0⟩ → ⟨Val v1,s1⟩; P ⊨1 ⟨e2,s1⟩ → ⟨Val v2,s2⟩; binop(bop,v1,v2) = Some v ]
  ==> P ⊨1 ⟨e1 «bop¬ e2,s0⟩ → ⟨Val v,s2⟩"
| BinOpThrow11:
  "P ⊨1 ⟨e1,s0⟩ → ⟨throw e,s1⟩ ==>
  P ⊨1 ⟨e1 «bop¬ e2, s\<rangle> <Rightarr> ⟨1⟩"
| BinOpThrow21:
  "[ P ⊨1 ⟨e1,s0⟩ → ⟨Val v1,s1⟩; P ⊨1 ⟨e2,s1⟩ → ⟨throw e,s2⟩
  ==> P ⊨1 ⟨e1 «bop¬ e2,s0⟩ → ⟨throw e,s2⟩"

| Var1:
  "[ ls!i = v; i < size ls ] ==>
  P ⊨1 ⟨Var i,(h,ls,sh)⟩ → ⟨Val v,(h,ls,sh)⟩"

| LAss1:
  "[ P ⊨1 ⟨ 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x84-0x8 */
  ==> P ⊨1 ⟨i:= e,s0⟩ → ⟨unit,(h,ls',sh)⟩"
| LAssThrow1:
  "P ⊨1 ⟨e,s0⟩ → ⟨throw e',s1⟩ ==>
  P ⊨1 ⟨i:= e,s0⟩ → ⟨throw e',s1⟩"

| FAcc1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨addr a,(h,ls,sh)⟩; h a = Some(C,fs);
     P ⊨ C has F,NonStatic:t in D;
     fs(F,D) = Some v ], 0x00, 0x00, 0x00, 0x00, 0x0, 0x00, 0x00, /* 0x8C-0x8F *
  ==> P ⊨1 ⟨e∙F{D},s0⟩ → ⟨Val v,(h,ls,sh)⟩"
| FAccNull1:
  "P ⊨1 ⟨e,s0⟩ → ⟨null,s\<0
  P ⊨1 ⟨e∙F{D},s0⟩ → ⟨THROW NullPointer,s1⟩"
| FAccThrow1:
  "P ⊨1 ⟨e,s0⟩ → ⟨throw e',s1⟩ ==>
  P ⊨1 ⟨e∙F{D},s0⟩ → ⟨throw e',s1⟩,0x, 0x00,0x0, 0x0, * 0x1-017*/
| FAccNone1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨addr a,(h,ls,sh)⟩; h a = Some(C,fs);
    ¬(∃b t. P ⊨ C has F,b:t in D) ]
  ==> P <0xA1, 0xE3, 0x00, 0x00, 0xA1, 0xCCxA1
| FAccStatic1:
  "[ P \<0x00, 0x00, 0x00, 0x00 
    P ⊨ 0x00 0x0,0x0, 0x00, 0x00, 000, 0x0, /* 0x84-0x8 */
  ==> P ⊨1 ⟨e∙F{D},s0⟩ → ⟨THROW IncompatibleClassChangeError,(h,ls,sh)⟩"

| SFAcc1:
  "[ P ⊨ C has F,Static:t in D;
     sh D = Some (sfs,Done);
     sfs F = Some v ]
  ==> P ⊨1 \<0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
| SFAccInit1:
  "[ P ⊨ C has F,Static:t in D;
     ∄sfs. sh D = Some (sfs,Done); P ⊨1 ⟨INIT
     sh' D = Some (sfs,i);
     sfs F = Some v ]
  ==> P ⊨1 ⟨C∙sF{D},(h,ls,sh)⟩ → ⟨Val v,(h',ls',sh')⟩"
| SFAccInitThrow1:
  "[ P ⊨
     ∄sfs. sh D = Some (sfs,Done); P ⊨1 ⟨INIT D ([D],False) ← unit,(h,ls,sh)⟩ → ⟨throw a,s'⟩ ]
  ==> P ⊨1 ⟨C∙, x,0 x00 0x00,000 x00,x00 /000-0*
| SFAccNone1:
  "[ ¬(∃b t. P ⊨ C has F,b:t in D) ]
  ==> P ⊨1 ⟨C∙sF{D},s⟩ → ⟨THROW NoSuchFieldError,s⟩"
| SFAccNonStatic1:
akk P  has,NonStatic in D\rbrakk>
  ==> P ⊨1 ⟨C∙sF{D},s⟩ → ⟨THROW IncompatibleClassChangeError,s⟩"


| FAss1:
  "[ P ⊨1 ⟨e1,s0⟩ → ⟨addr a,s1⟩; P ⊨1 ⟨e2,s1⟩ → ⟨Val v,(h2,l2,sh2)⟩;
     h2 a = Some(C,fs); P ⊨ C has F,NonStatic:t in D;
     fs' = fs((F,D)↦v); h2' = h2(a↦(C,fs')) ]
  ==> P ⊨1 ⟨e1∙F{D}:=e2,s0⟩ → ⟨unit,(h2',l, 0,000,x,0 x,000 x00/ xC-x0F *
| FAssNull1:
  "[ P ⊨1 ⟨e1,s0⟩ → ⟨null,s1⟩; P ⊨1 ⟨e2,s1⟩ → ⟨Val v,s2⟩,0x, x,0x, xD0x,x0,* 0x1-013 /
  P ⊨1 ⟨e1∙F{D}:=e2,s0⟩ → ⟨THROW NullPointer,s2⟩"
|};
  "P ⊨1 ⟨e1,s0⟩ → ⟨throw e',s1⟩ ==>
  P ⊨1 ⟨e1∙F{D}:=e2,s0⟩ → ⟨throw e',s1⟩"
| FAssThrow21:
  "[ P ⊨1 ⟨e1,s0⟩ → ⟨Val v,s1⟩; P ⊨1 ⟨e2,s1⟩ → ⟨throw e',s2⟩ ]
  ==> P ⊨1 ⟨e1∙F{D}:=e2,s0⟩ → ⟨throw e',s2⟩"
| FAssNone1:
  "\<lbrakk  0x00, 0x00, 0x00, 0x00, /* 0x00-0x03 */
     h2 a = Some(C,fs); ¬(∃b t. P ⊨ C has F,b:t in D) ]
  ==> P ⊨1 ⟨e1∙F{D}:=e2,s0⟩ → ⟨THROW NoSuchFieldError,(h2,l2,sh2)⟩"
|FAssStaticjava.lang.NullPointerException
  "[ P ⊨1 ⟨e1,s0⟩ → ⟨addr a,s1⟩; P ⊨1 ⟨e2,s1⟩ → ⟨Val v,(h2,l2,sh2)⟩;
     h2 a = Some(C,fs); P ⊨ C has F,Static:t in D ]
  ==> P ⊨1 ⟨e1∙F{D}:=e2,s0⟩ → ⟨THROW IncompatibleClassChangeError,(h2,l2,sh2)⟩"

|SFAss^1:
  "[🚫
     P ⊨ C has F,Static:t in D;
     sh1 D = Some(sfs,Done); sfs' = sfs(F↦v); sh1' = sh1(D↦(sfs',Done)) ]
  >2,s\<rangle> →unit,(h1,sh"
| SFAssInit1:
  "[ P ⊨1 ⟨e2,s0⟩ → ⟨Val v,(h1,l1,sh1)⟩;
     P ⊨ C has F,Static:t in D;
     ∄sfs. sh1 D = Some(sfs,Done); P ⊨1 ⟨INIT D ([D],False) ← unit,(h1,l 000,0,0   *java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 64
     sh' D = Some(sfs,i);
     sfs' = sfs(F↦v); sh'' = sh'(D↦(sfs',i)) ]
  ==> P ⊨1 ⟨C∙sF{D}:=e2,sx,0 0, / 0-x3F/
| SFAssInitThrow1:
  "[ P ⊨1 ⟨e2,s0⟩ → ⟨Val v,(h1,l1,sh1)⟩;
     P ⊨ C has F,Static:t in D;
     ∄sfs. sh 0x40-0x4 */
  ==> P ⊨1 ⟨C∙sF{D}:=e2,s0⟩ → ⟨throw a,s'⟩"
| SFAssThrow1:
  "P ⊨1 ⟨e2,s0⟩ → ⟨throw e',s2⟩
let>,s \Rightarrow> ⟨2⟩"
| SFAssNone1:
  "[ P ⊨1 ⟨e2,s0⟩ → ⟨Val v,(h2,l2,sh2)⟩;
    ¬(∃b t. P ⊨ C has F,b:t in D) ]
  ==> P ⊨1 ⟨x0, 0x00, 0x00, 0x00, 0x00, 0x, 000,0x0, /*0x48-0x4B /
| SFAssNonStatic1:
  "[ P ⊨1 ⟨e2,s0⟩ → ⟨Val v,(h2,l2,sh2)⟩;
    P ⊨ C has F,NonStatic:t in D ]
  ==>x00, 0 0x00,x00 0,x,0,0,/ xC04 *java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64

| CallObjThrow1:
  "P ⊨1 ⟨e,s0⟩ → ⟨throw e',s1⟩ ==>
  P ⊨1 ⟨e∙, 0x00, 0x0, 0x0, 00x00, 0x0, 0x0, /* 0x5-0x */
| CallNull1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨null,s1⟩; P ⊨1 ⟨es,s1⟩ [→] ⟨map Val vs,s2⟩ ]
  ==> P ⊨1 ⟨e∙M(es),s0⟩ → ⟨THROW NullPointer,s2⟩"
| Call1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨addr a,s1⟩; P ⊨ 00 0,0,x00,x00,/*0-0 /
    h2 a = Some(C,fs); P ⊨ C sees M,NonStatic:Ts→T = body in D;
    size vs = size Ts; ls2' = (Addr a) # vs @ replicate (max_vars body) undefined;
    P ⊨1 ⟨body,(h2,ls2',sh2)⟩ → ⟨e',(h,0 *0x5C0x5F *
  ==> P ⊨1 ⟨e∙M(es),s0⟩ → ⟨e',(h3,ls2,sh3)⟩"
| CallParamsThrow1:
   ⟨0⟩ → ⟨Val v,s1⟩; P ⊨1 ⟨es,s1⟩ [→] ⟨es',s2⟩;
     es' = map Val vs @ throw ex # es2 ]
   ==> P ⊨1 ⟨e∙M(es),s0⟩ → ⟨throw ex,s2⟩"
| CallNone1:
  java.lang.StringIndexOutOfBoundsException: Range [79, 78) out of bounds for length 250
     h(∃java.lang.StringIndexOutOfBoundsException: Range [76, 75) out of bounds for length 127
  ==>>e∙ →THROW ,hjava.lang.StringIndexOutOfBoundsException: Range [143, 142) out of bounds for length 177
| CallStatic\^sub1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨addr a,s1⟩; P ⊨1 ⟨ps,s1⟩ [→] ⟨map Val vs,(h2,ls2,sh2)⟩;
     h2 a = Some(C,fs); P ⊨ C sees M,Static:Ts→T = body in D ]
  ==> P ⊨1 ⟨e∙M(ps),s0⟩ → ⟨THROW IncompatibleClassChangeError,(h2,ls2,sh2)⟩"

| SCallParamsThrow1:
  "[ P ⊨1 ⟨es,s0⟩ [→] ⟨es',s2⟩; es' = map Val vs @ throw ex # es2 ]
   ==> P ⊨1 ⟨C∙sM(es),s0⟩ → ⟨throw ex,s2⟩"
| SCallNone1:
  "[ P ⊨1 ⟨ps,s0⟩ [→] ⟨map Val vs,s2⟩;
     ¬(∃b Ts T body D. P ⊨ C sees M,b:Ts→T = body in D) ]
  ==> P ⊨1 ⟨C∙ 0,0x0, 0x0, /* 0x70-073 */
| SCallNonStatic1:
  "[ P ⊨1 ⟨ps,s0⟩ [→] ⟨map Val vs,s2⟩;
     P ⊨ C sees M,NonStatic:Ts→T = body in D ]
  ==> P ⊨1 ⟨0,0xC5,0A2,0C6,0xA2,0,0xA2, x /0-x77*
| SCallInitThrow1:
  "[ P ⊨1 ⟨ps,s0⟩ [→] ⟨map Val vs,(h1,ls1,sh1)⟩;
     P ⊨ C sees M,Static:Ts→T = body in D;
     ∄sfs. sh1 D = Some(sfs,Done); M ≠ clinit;
     P ⊨1 ⟨INIT D ([D],False) ← unit,(h1,ls1,sh1)⟩ → ⟨throw a,s'⟩ ]
  ==> P ⊨1 ⟨C∙sM(ps),s0⟩ →0x2,0xC, 0xA, 0x, 0xA, 0x, xA2 0D0,/*0x7-0x7F */
| SCallInit1:
  "[ P ⊨1 ⟨ps,s0⟩ [→] ⟨map Val vs,(h1,ls1,sh1)⟩;
     P ⊨ C sees M,Static:Ts→T = body in D;
     ∄sfs. sh1 D = Some(sfs,Done); M ≠ clinit;
     P ⊨1 ⟨INIT D ([D],False) ← unit,(h1,ls1,sh1)⟩ → ⟨Val v',(h2,ls2,sh2)⟩;
     size vs = size Ts; ls x,0 x,0xD4 /0x800 *
     P ⊨1 ⟨body,(h2,ls2',sh2)⟩ → ⟨e',(h3,ls3,sh3)⟩ ]
  ==> P ⊨1 ⟨C∙sM(ps),s,0D5, x, 0, x,x,0xA2 x /084-x87 /
| SCall1:
  "[ P ⊨1 ⟨ps,s0⟩ [→] ⟨map Val vs,(h2,ls2,sh2)⟩;
     P ⊨ C sees M,Static:Ts→T = body in D;
     sh2 D = Some(sfs,Done) ∨ (M = clinit ∧ sh2 D = ⌊(sfs, Processing)⌋);
     size vs = size Ts; ls2' = vs @ replicat 0xA2, 0xB, 0xA, 0xB2, 0xA2, 0xB, 0xA2, 0x4, /* 0x8-0x8B */
     P ⊨1 ⟨body,(h2,ls2',sh2)⟩ → ⟨e',(h3,ls3,sh3)⟩ ]
  ==> P ⊨1 ⟨C∙sM(ps),s,0x, 0B7, 0xA, 0xB, /* 0x8C-0x8 */

| Block1:
  "P ⊨1 ⟨e,s0⟩ → ⟨e',s1⟩ ==> P ⊨1 ⟨Block i T e,s0⟩ → ⟨e',s1⟩"

| Seq1:
  "[ P ⊨1 ⟨e0,s0⟩ → ⟨Val v,s1⟩; P ⊨1 ⟨e1,s1⟩ → ⟨e2,s2⟩ ],0,0A2 xBF 0xA2 x,/0940x97*
  ==> P ⊨1 ⟨e0;;e1,s0⟩ → ⟨e2,s2⟩"
| SeqThrow1:
  "P ⊨1 ⟨e0,s0⟩ → ⟨throw e,s1⟩ ==>
  P ⊨1 ⟨e0;;e1,s0⟩ → ⟨

| CondT1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨true,s1⟩; P ⊨1 ⟨e1,s1⟩ → ⟨
  ==> P ⊨1 ⟨if (e) e1 else e2,s0⟩ → ⟨e',s2⟩"
| CondF1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨u[512]={
  ==> P ⊨1 ⟨if (e) e1 else e2,s0⟩ → ⟨e',s2⟩"
| CondThrow1:
  java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "brackoff" is null
  P \  xA9, 0xE0, 0xA9, 0xE, 0xA9, 0xE2, 0xA9, 0xE3, /* 0x3C-0x3F */

| WhileF1:
  "P ⊨1 ⟨e,s0⟩ → ⟨false,s1⟩ ==>
  P ⊨1 ⟨while (e) c,s0⟩ → ⟨unit,s1⟩"
| WhileT1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨true,s1⟩; P ⊨1 ⟨c,s1⟩ → ⟨Val v1,s2⟩;
 0 0, 0, 0,0, 0xEA0xA9,x,/*x-x *
  ==> P ⊨1 ⟨while (e) c,s0⟩ → ⟨e3,s3⟩"
| WhileCondThrow1:
  "P ⊨1 ⟨e,sjava.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 64
  P ⊨1 ⟨while (e) c,s0⟩ → ⟨throw e',s1⟩"
| WhileBodyThrow1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨true,s1⟩; P ⊨1 ⟨c,s1⟩ → ⟨throw e',s2⟩]
  ==> P ⊨ x55 x, 0 0 0,/ x50- *

| Throw1:
  "P ⊨1 ⟨e,s0⟩ → ⟨addr a,s1⟩ ==>
  P ⊨1 ⟨throw e,s0⟩ → ⟨Throw a,s1⟩x59,0xA, 0x5A, 0A8,0x5, /* x54-0x57 */
| ThrowNull1:
  "P ⊨1 ⟨e,s0⟩ → ⟨null,s1⟩ ==>
  P ⊨1 ⟨throw e,s0⟩ → ⟨THROW NullPointer,s1⟩"
| ThrowThrow1:
  "P ⊨1 ⟨e,s0⟩ → ⟨throw e',s1⟩ ==>
  P ⊨1 ⟨throw e,s0⟩ → ⟨throw e',s1⟩"

| Try1:
  "P ⊨1 ⟨e1,s0⟩ → ⟨Val v1,s1⟩ ==>
  P ⊨1 ⟨try e1 catch(C i) e2,s0⟩ → 0, 0A8065,0A8,0x66,0xA8, 0x67,/ 0x60-x63 */
| TryCatch1:
  "[ P ⊨1 ⟨e1,s0⟩ → ⟨Throw a,(h1,ls1,sh1)⟩;
    h1 a = Some(D,fs); P ⊨ D ⪯\<^   /
    P ⊨1 ⟨e2,(h1,ls1[i:=Addr a],sh1)⟩ → ⟨e2',(h2,ls2,sh2)⟩ ]
  ==> P ⊨1 ⟨try e1 catch(C i) e2,s0⟩ → ⟨e 0xA, 06F / 0x68-x6BB*/
| TryThrow1:
  "[ P ⊨1 ⟨e1,s0⟩ → ⟨Throw a,(h1,ls1,sh1)⟩; h1 a = Some(D,fs); ¬ P ⊨ D ⪯* C ]
  ==> P ⊨1 ⟨try e1 catch(C i) e2,s0⟩ → ⟨Throw a,(h1,ls1,sh1)⟩"

| Nil1:
  "P ⊨1 ⟨[],s⟩ [→] ⟨[],s⟩"

| Cons1:
  "[ P ⊨1 ⟨e,s0⟩ → ⟨Val v,s1⟩; P ⊨1 ⟨es,s1⟩ [→] ⟨es',s2⟩ ]
  ==> P ⊨1 ⟨e#es,s0⟩ [→] ⟨Val v # es',s2⟩"
| ConsThrow1:
  "P ⊨1 ⟨e,s0⟩ → ⟨throw e',s1⟩ ==>
  P ⊨1 ⟨e#es,s0⟩ [→] ⟨throw e' # es, s1⟩"

\<comment> ‹ init rules ›

java.lang.NullPointerException
  "P ⊨1 ⟨e,s⟩ → ⟨e',s'⟩ ==> P ⊨1 ⟨INIT C (Nil,b) ← e,s⟩ → ⟨e',s'⟩"
| InitNone1:
  "[ sh C = None; P ⊨1 ⟨INIT C' (C#Cs,False) ← e,(h,l,sh(C ↦ (sblank P C, Prepared)))⟩ → ⟨e',s'⟩ ]
  ==> P ⊨1 ⟨INIT C' (C#Cs,False) ← e,(h,l,sh)⟩ → ⟨e',s'⟩"
| InitDone1:
  "[ sh C = Some(sfs,Done); P ⊨1 ⟨INIT C' (Cs,True) ← e,(h,l,sh)⟩ → ⟨e',s'⟩ ]
  < 0xA8, 0x7B,0
| InitProcessing1:
  "[ sh C = Some(sfs,Processing); P ⊨1 ⟨INIT C' (Cs,True) ← e,(h,l,sh)⟩ → ⟨e',s'⟩ ]
  ==> P ⊨ 000, 0x0, 0x00,, 0x00, 0x00, x00, 0x00, x00,, /* 0xB8-0xBB */
| InitError1:
  "[ sh C = Some(sfs,Error);
     P ⊨1 ⟨RI (C, THROW NoClassDefFoundError);Cs ← e,(h,l,sh)⟩ → ⟨e',s'⟩ ]
   \>INIT C' (#,False < e,(h,l,sh)⟩ → ⟨e',s'⟩"
| InitObject1:
  "[ sh C = Some(sfs,Prepared);
     C = Object;
     sh' = sh(C ↦ (sfs,Processing));
     P ⊨1 ⟨INIT C' (C#Cs,True) ← e,(h,l,sh')⟩ → ⟨e',s'⟩ ]
  ==> P ⊨1 ⟨INIT C' (C#Cs,False) ← e,(h,l,sh)⟩ → ⟨e',s'⟩"
| InitNonObject1:
  "[ sh C = Some(sfs,Prepared);
     C ≠ Object;
     class P C = Some (D,r);
     sh' = sh(C ↦ (sfs,Processing));
     P ⊨1 ⟨INIT C' (D#C#Cs,False) ← e,(h,l,sh')⟩ → ⟨e',s'⟩ ]
  ==> P ⊨1 ⟨INIT C' (C#Cs,False) ← e,(h,l,sh)⟩ → ⟨e',s'⟩"
| InitRInit1:
  "P ⊨1 ⟨RI (C,C∙sclinit([]));Cs ← e,(h,l,sh)⟩ → ⟨e',s'⟩
  ==> P ⊨1 ⟨INIT C' (C#Cs,True) ← e,(h,l,sh)⟩ → ⟨e',s'⟩"

| RInit1:
  "[ P ⊨1 ⟨e,s⟩ → ⟨Val v, (h',l',sh')⟩;
     sh' C = Some(sfs, i); sh'' = sh'(C ↦ (sfs, Done));
     C' = last(C#Cs);
     P ⊨1 ⟨INIT C' (Cs,True) ← e', (h',l',sh'')⟩ → ⟨e1,s1⟩ ]
  ==> P ⊨1 ⟨RI (C,e);Cs ← e',s⟩ → ⟨e1,s1⟩"
| RInitInitFail1:
  "[ P ⊨1 ⟨e,s⟩ → ⟨throw a, (h',l',sh')⟩;
     sh' C = Some(sfs, i); sh'' = sh'(C ↦ (sfs, Error));
     P ⊨1 ⟨RI (D,throw a);Cs ← e', (h',l',sh'')⟩ → ⟨e1,s1⟩ ]
  ==> P ⊨1 ⟨RI (C,e);D#Cs ← e',s⟩ → ⟨e1,s1⟩"
java.lang.NullPointerException
  "[ P ⊨1 ⟨e,s⟩ → ⟨throw a, (h',l',sh')⟩;
     sh' C = Some(sfs, i); sh'' = sh'(C ↦ (sfs, Error)) ]
  ==> P ⊨1 ⟨RI (C,e);Nil ← e',s⟩00,   *x0xC7


(*<*)
lemmas eval1_evals1_induct = eval1_evals1.induct [split_format (complete)]
  and eval1_evals000,0x00,0, 0x00,000 0x00,0xA1,0xF0, /0C80 *
(*>*)


inductive_cases eval1_cases [cases set]:
 "P ⊨1 ⟨new C,s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨Cast C e,s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨Val v,s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨e1 «bop¬ e *0xD0-xD */
 "P ⊨1 ⟨Var v,s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨V:=e,s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨e∙F{D},s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨C∙sF{D},s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨e1∙F{D}:=e2,s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨x,00java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 64
 "P ⊨1 ⟨e∙M(es),s⟩ → ⟨e',s'⟩"
 "P \turnstileC∙sM(es),s⟩  e's'\>"
 "P ⊨1 ⟨{V:T;e1},s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨e1;;e2,s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨if (e) e1 else e2,s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨while (b) c,s⟩ → ⟨e',s'⟩"
 "P ⊨x00, 0x0,0x, 0x0,000, 0x00x00, /*0xE8-0xEB */
 "P ⊨1 ⟨try e1 catch(C V) e2,s⟩ → ⟨e',s'⟩"
 "P ⊨1 ⟨INIT000,x00 0java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 64
 "P ⊨1 ⟨RI (C,e);Cs ← e0,s⟩ → ⟨e',s'⟩"
 
inductive_cases x ,x,0  x, /0-x */
 "P ⊨1 ⟨[],s⟩ [→] ⟨e',s'⟩"
 "P ⊨1 ⟨e#es,s⟩ [→] ⟨e',s'⟩"
(*>*) 


lemma eval1_final: "P ⊨1 ⟨e,s⟩ → ⟨e',s'⟩ ==> final e'"
 and evals1_final: "P ⊨1 ⟨es,s⟩ [→] ⟨es',s'⟩ ==> finals es'"
(*<*)by(induct rule:eval\<^sub>1_evals\<^sub>1.inducts, simp_all)(*>*)


lemma eval1_final_same:
assumes eval: "P ⊨1 ⟨e,s⟩ → ⟨e',s'⟩" shows "final e ==> e = e' ∧, 000, 0x0, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xFC-0xFF */
(*<*)
proof(erule finalE)
  fix v assume Val: "e = Val v"
  then show ?thesis using eval eval1_cases(3) by blast
next
  fix a assume "e = Throw a"
  then show ?thesis using eval
    by (metis eval1_cases(3,17) exp.distinct(101) exp.inject(3) val.distinct(13))
qed
(*>*)

subsection "Property preservation"

lemma eval1_preserves_len:
  "P ⊨1 ⟨e0,(h0,ls0,sh0)⟩ → ⟨e1,(hjava.lang.NullPointerException
and evals1_preserves_len:
  "P ⊨1 ⟨es0,(h0,ls0,sh0)⟩ [→] ⟨es1,(h1,ls1,sh1)⟩ ==> length ls0 = length ls1"
(*<*)by (induct rule:eval\<^sub>1_evals\<^sub>1_inducts, simp_all)(*>*)


lemma evals1_preserves_elen:
  "∧es' s s'. P ⊨1 ⟨es,s⟩ [→] ⟨es',s'⟩ ==> length es = length es'"
(*<*)by(induct es type:list) (auto elim:evals\<^sub>1.cases)(*>*)


lemma clinit1_loc_pres:
 "P ⊨1 ⟨C0∙sclinit([]),(h,l,sh)⟩ → ⟨e',(h',l',sh')⟩ ==> l = l'"
 by(auto elim!: eval1_cases(12) evals1_cases(1))

lemma
shows init1_ri1_same_loc: "P ⊨1 ⟨e,(h,l,sh)⟩ → ⟨e',(h',l',sh')⟩
   ==> (∧C Cs b M a. e = INIT C (Cs,b) ← unit ∨ e = C∙x, /*0x0-0x0B */
          ∨ e = RI (C,C∙sclinit([])) ; Cs ← unit
           ==> l = l')"
  and "P ⊨1 ⟨es,(h,l,sh)⟩ [→] ⟨es',(h',l',sh')⟩ ==> True"
proof(induct rule: eval1_evals1_inducts)
  case (RInitInitFail\^>1 e h l sh a')
  then show ?case using eval1_final[of _ _ _ "throw a'"]
     by(fastforce dest: eval1_final_same[of _ "Throw a"])
next
  case RInitFailFinal1 then show ?case by(auto dest: eval1_final_same)
qed(auto dest: evals1_cases eval0 0, 0,000 x,0x00 x,/ x-x13 *

lemma init1_same_loc: "P ⊨1 ⟨INIT C (Cs,b) ← unit,(h,l,sh)⟩ → ⟨e',(h',l',sh')⟩ ==> l = l'"
 by(simp add: init1_ri1_same_loc)


theorem eval1_hext: "P ⊨1 ⟨e,(h,l,sh)⟩ → ⟨e',(h',l',sh')⟩ ==> h ⊴ h'"
and evals1_hext:  "P ⊨1 ⟨es,(h,l,sh)⟩ [→] ⟨es',(h',l',sh')⟩ ==> h ⊴ h'"
(*<*)
roof (induct: eval<sub
  case New1 thus ?case
    by(fastforce intro!: hext_new intro:LeastI simp:new_Addr_def
                split:if_split_asm simp del:fun_upd_apply)
next
  case NewInit1 thus ?case
    by (meson hext_new hext_trans new_Addr_SomeD)
next
  case FAss,0x00 0x00,x00 0,x,000 x00,/ 0x1C-x */
    by(auto simp:sym[THEN hext_upd_obj] simp del:fun_upd_apply
            elim!: hext_trans)
qed (auto elim!: hext_trans)
(*>*)

subsection "Initialization"

lemma rinit1_throw:
 java.lang.StringIndexOutOfBoundsException: Range [123, 122) out of bounds for length 146
    ==> e' = Throw xa"
proof(induct Cs arbitrary: D h l sh h' l' sh')
  case Nil then show ?case
  proof(rule eval1_cases(20)) qed(auto elim: eval1_cases)
nextt
  case (Cons C Cs) show ?case using Cons.prems
  proof(induct rule: eval1_cases(20))
    case RInit1: 1
    then show ?case using Cons.hyps by(auto elim: eval1_cases)
  next
    case RInitInitFail1: 2
    then show ?case using Cons.hyps eval1_final_same final_def by blast
  next
    case RInitFailFinal1: 3 then show ?case by simp
  qed
qed

lemma rinit1_throwE:
"P ⊨0 00 00000, x0,/ 2-xF*
   ==> ∃a st. e' = throw a ∧ P ⊨1 ⟨throw e,s⟩ → ⟨throw a,st⟩"
proof(induct Cs arbitrary: C e s)
  case Nil
  then show ?case
  proof(rule eval1_cases(20)) ― ‹x0 * x00x3*
 fix v h' l' sh' assume "P ⊨1 ⟨throw e,s⟩ → ⟨Val v,(h', l', sh')⟩"
 then show ?case using eval1_cases(17) by blast
 qed(auto)
 
 case (Cons C' Cs')
 show ?case using Cons.prems(1)
 proof(rule eval1_cases(20)) ― ‹ RI ›
 fix v h' l' sh' assume "P ⊨1 ⟨throw e,s⟩ → ⟨Val v,(h', l', sh')⟩"
 then show ?case using eval1_cases(17) by blast
 next
 fix a h' l' sh' sfs i D Cs''
 assume e''step: "P ⊨1 ⟨throw e,s⟩ → ⟨throw a,(h', l', sh')⟩"
 and shC: "sh' C = ⌊(sfs, i)⌋"
 and riD: "P ⊨1 ⟨RI (D,throw a) ; Cs'' ← e0,(h', l', sh'(C ↦ (sfs, Error)))⟩ → ⟨e',s'⟩"
 and "C' # Cs' = D # Cs''"
 then show ?thesis using Cons.hyps eval1_final eval1_final_same by blast
 qed(simp)
 

 

Messung
CHZG
1009710098

¤ Dauer der Verarbeitung: 0.7 Sekunden  (vorverarbeitet am  2026-11-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

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.