src/HOL/MicroJava/J/Conform.thy
changeset 80914 d97fdabd9e2b
parent 67443 3abf6a722518
equal deleted inserted replaced
80913:46f59511b7bb 80914:d97fdabd9e2b
     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)"  \<comment> \<open>same as \<open>env\<close> of \<open>WellType.thy\<close>\<close>
    10 type_synonym 'c env' = "'c prog \<times> (vname \<rightharpoonup> ty)"  \<comment> \<open>same as \<open>env\<close> of \<open>WellType.thy\<close>\<close>
    11 
    11 
    12 definition hext :: "aheap => aheap => bool" ("_ \<le>| _" [51,51] 50) where
    12 definition hext :: "aheap => aheap => bool" (\<open>_ \<le>| _\<close> [51,51] 50) where
    13  "h\<le>|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                                    ("_,_ \<turnstile> _ ::\<preceq> _"  [51,51,51,51] 50) where
    16                                    (\<open>_,_ \<turnstile> _ ::\<preceq> _\<close>  [51,51,51,51] 50) where
    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"
    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                                    ("_,_ \<turnstile> _ [::\<preceq>] _" [51,51,51,51] 50) where
    20                                    (\<open>_,_ \<turnstile> _ [::\<preceq>] _\<close> [51,51,51,51] 50) where
    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)"
    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" ("_,_ \<turnstile> _ \<surd>" [51,51,51] 50) where
    23 definition oconf :: "'c prog => aheap => obj => bool" (\<open>_,_ \<turnstile> _ \<surd>\<close> [51,51,51] 50) where
    24  "G,h\<turnstile>obj \<surd> == G,h\<turnstile>snd obj[::\<preceq>]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" ("_ \<turnstile>h _ \<surd>" [51,51] 50) where
    26 definition hconf :: "'c prog => aheap => bool" (\<open>_ \<turnstile>h _ \<surd>\<close> [51,51] 50) where
    27  "G\<turnstile>h h \<surd>    == \<forall>a obj. h a = Some obj --> G,h\<turnstile>obj \<surd>"
    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" ("_ ::\<preceq> _" [51,51] 50) where
    32 definition conforms :: "xstate => java_mb env' => bool" (\<open>_ ::\<preceq> _\<close> [51,51] 50) where
    33  "s::\<preceq>E == prg E\<turnstile>h heap (store s) \<surd> \<and> 
    33  "s::\<preceq>E == prg E\<turnstile>h heap (store s) \<surd> \<and> 
    34             prg E,heap (store s)\<turnstile>locals (store s)[::\<preceq>]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 
    36 
    37 
    37