src/HOL/MicroJava/J/Conform.thy
changeset 61994 133a8a888ae8
parent 61361 8b5f00202e1a
child 62042 6c6ccf573479
equal deleted inserted replaced
61993:89206877f0ee 61994:133a8a888ae8
     7 
     7 
     8 theory Conform imports State WellType Exceptions begin
     8 theory Conform imports State WellType Exceptions begin
     9 
     9 
    10 type_synonym 'c env' = "'c prog \<times> (vname \<rightharpoonup> ty)"  -- "same as @{text env} of @{text WellType.thy}"
    10 type_synonym 'c env' = "'c prog \<times> (vname \<rightharpoonup> ty)"  -- "same as @{text env} of @{text WellType.thy}"
    11 
    11 
    12 definition hext :: "aheap => aheap => bool" ("_ <=| _" [51,51] 50) where
    12 definition hext :: "aheap => aheap => bool" ("_ \<le>| _" [51,51] 50) where
    13  "h<=|h' == \<forall>a C fs. h a = Some(C,fs) --> (\<exists>fs'. h' a = Some(C,fs'))"
    13  "h\<le>|h' == \<forall>a C fs. h a = Some(C,fs) --> (\<exists>fs'. h' a = Some(C,fs'))"
    14 
    14 
    15 definition conf :: "'c prog => aheap => val => ty => bool" 
    15 definition conf :: "'c prog => aheap => val => ty => bool" 
    16                                    ("_,_ |- _ ::<= _"  [51,51,51,51] 50) where
    16                                    ("_,_ \<turnstile> _ ::\<preceq> _"  [51,51,51,51] 50) where
    17  "G,h|-v::<=T == \<exists>T'. typeof (map_option obj_ty o h) v = Some T' \<and> G\<turnstile>T'\<preceq>T"
    17  "G,h\<turnstile>v::\<preceq>T == \<exists>T'. typeof (map_option obj_ty o h) v = Some T' \<and> G\<turnstile>T'\<preceq>T"
    18 
    18 
    19 definition lconf :: "'c prog => aheap => ('a \<rightharpoonup> val) => ('a \<rightharpoonup> ty) => bool"
    19 definition lconf :: "'c prog => aheap => ('a \<rightharpoonup> val) => ('a \<rightharpoonup> ty) => bool"
    20                                    ("_,_ |- _ [::<=] _" [51,51,51,51] 50) where
    20                                    ("_,_ \<turnstile> _ [::\<preceq>] _" [51,51,51,51] 50) where
    21  "G,h|-vs[::<=]Ts == \<forall>n T. Ts n = Some T --> (\<exists>v. vs n = Some v \<and> G,h|-v::<=T)"
    21  "G,h\<turnstile>vs[::\<preceq>]Ts == \<forall>n T. Ts n = Some T --> (\<exists>v. vs n = Some v \<and> G,h\<turnstile>v::\<preceq>T)"
    22 
    22 
    23 definition oconf :: "'c prog => aheap => obj => bool" ("_,_ |- _ [ok]" [51,51,51] 50) where
    23 definition oconf :: "'c prog => aheap => obj => bool" ("_,_ \<turnstile> _ \<surd>" [51,51,51] 50) where
    24  "G,h|-obj [ok] == G,h|-snd obj[::<=]map_of (fields (G,fst obj))"
    24  "G,h\<turnstile>obj \<surd> == G,h\<turnstile>snd obj[::\<preceq>]map_of (fields (G,fst obj))"
    25 
    25 
    26 definition hconf :: "'c prog => aheap => bool" ("_ |-h _ [ok]" [51,51] 50) where
    26 definition hconf :: "'c prog => aheap => bool" ("_ \<turnstile>h _ \<surd>" [51,51] 50) where
    27  "G|-h h [ok]    == \<forall>a obj. h a = Some obj --> G,h|-obj [ok]"
    27  "G\<turnstile>h h \<surd>    == \<forall>a obj. h a = Some obj --> G,h\<turnstile>obj \<surd>"
    28  
    28  
    29 definition xconf :: "aheap \<Rightarrow> val option \<Rightarrow> bool" where
    29 definition xconf :: "aheap \<Rightarrow> val option \<Rightarrow> bool" where
    30   "xconf hp vo  == preallocated hp \<and> (\<forall> v. (vo = Some v) \<longrightarrow> (\<exists> xc. v = (Addr (XcptRef xc))))"
    30   "xconf hp vo  == preallocated hp \<and> (\<forall> v. (vo = Some v) \<longrightarrow> (\<exists> xc. v = (Addr (XcptRef xc))))"
    31 
    31 
    32 definition conforms :: "xstate => java_mb env' => bool" ("_ ::<= _" [51,51] 50) where
    32 definition conforms :: "xstate => java_mb env' => bool" ("_ ::\<preceq> _" [51,51] 50) where
    33  "s::<=E == prg E|-h heap (store s) [ok] \<and> 
    33  "s::\<preceq>E == prg E\<turnstile>h heap (store s) \<surd> \<and> 
    34             prg E,heap (store s)|-locals (store s)[::<=]localT E \<and> 
    34             prg E,heap (store s)\<turnstile>locals (store s)[::\<preceq>]localT E \<and> 
    35             xconf (heap (store s)) (abrupt s)"
    35             xconf (heap (store s)) (abrupt s)"
    36 
       
    37 
       
    38 notation (xsymbols)
       
    39   hext  ("_ \<le>| _" [51,51] 50) and
       
    40   conf  ("_,_ \<turnstile> _ ::\<preceq> _" [51,51,51,51] 50) and
       
    41   lconf  ("_,_ \<turnstile> _ [::\<preceq>] _" [51,51,51,51] 50) and
       
    42   oconf  ("_,_ \<turnstile> _ \<surd>" [51,51,51] 50) and
       
    43   hconf  ("_ \<turnstile>h _ \<surd>" [51,51] 50) and
       
    44   conforms  ("_ ::\<preceq> _" [51,51] 50)
       
    45 
    36 
    46 
    37 
    47 subsection "hext"
    38 subsection "hext"
    48 
    39 
    49 lemma hextI: 
    40 lemma hextI: