src/HOL/MicroJava/J/Conform.thy
changeset 35416 d8d7d1b785af
parent 30235 58d147683393
child 35417 47ee18b6ae32
equal deleted inserted replaced
35342:4dc65845eab3 35416:d8d7d1b785af
     1 (*  Title:      HOL/MicroJava/J/Conform.thy
     1 (*  Title:      HOL/MicroJava/J/Conform.thy
     2     ID:         $Id$
       
     3     Author:     David von Oheimb
     2     Author:     David von Oheimb
     4     Copyright   1999 Technische Universitaet Muenchen
     3     Copyright   1999 Technische Universitaet Muenchen
     5 *)
     4 *)
     6 
     5 
     7 header {* \isaheader{Conformity Relations for Type Soundness Proof} *}
     6 header {* \isaheader{Conformity Relations for Type Soundness Proof} *}
     8 
     7 
     9 theory Conform imports State WellType Exceptions begin
     8 theory Conform imports State WellType Exceptions begin
    10 
     9 
    11 types 'c env' = "'c prog \<times> (vname \<rightharpoonup> ty)"  -- "same as @{text env} of @{text WellType.thy}"
    10 types 'c env' = "'c prog \<times> (vname \<rightharpoonup> ty)"  -- "same as @{text env} of @{text WellType.thy}"
    12 
    11 
    13 constdefs
    12 definition hext :: "aheap => aheap => bool" ("_ <=| _" [51,51] 50) where
    14 
       
    15   hext :: "aheap => aheap => bool" ("_ <=| _" [51,51] 50)
       
    16  "h<=|h' == \<forall>a C fs. h a = Some(C,fs) --> (\<exists>fs'. h' a = Some(C,fs'))"
    13  "h<=|h' == \<forall>a C fs. h a = Some(C,fs) --> (\<exists>fs'. h' a = Some(C,fs'))"
    17 
    14 
    18   conf :: "'c prog => aheap => val => ty => bool" 
    15 definition conf :: "'c prog => aheap => val => ty => bool" 
    19                                    ("_,_ |- _ ::<= _"  [51,51,51,51] 50)
    16                                    ("_,_ |- _ ::<= _"  [51,51,51,51] 50) where
    20  "G,h|-v::<=T == \<exists>T'. typeof (Option.map obj_ty o h) v = Some T' \<and> G\<turnstile>T'\<preceq>T"
    17  "G,h|-v::<=T == \<exists>T'. typeof (Option.map obj_ty o h) v = Some T' \<and> G\<turnstile>T'\<preceq>T"
    21 
    18 
    22   lconf :: "'c prog => aheap => ('a \<rightharpoonup> val) => ('a \<rightharpoonup> ty) => bool"
    19 definition lconf :: "'c prog => aheap => ('a \<rightharpoonup> val) => ('a \<rightharpoonup> ty) => bool"
    23                                    ("_,_ |- _ [::<=] _" [51,51,51,51] 50)
    20                                    ("_,_ |- _ [::<=] _" [51,51,51,51] 50) where
    24  "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|-vs[::<=]Ts == \<forall>n T. Ts n = Some T --> (\<exists>v. vs n = Some v \<and> G,h|-v::<=T)"
    25 
    22 
    26   oconf :: "'c prog => aheap => obj => bool" ("_,_ |- _ [ok]" [51,51,51] 50)
    23 definition oconf :: "'c prog => aheap => obj => bool" ("_,_ |- _ [ok]" [51,51,51] 50) where
    27  "G,h|-obj [ok] == G,h|-snd obj[::<=]map_of (fields (G,fst obj))"
    24  "G,h|-obj [ok] == G,h|-snd obj[::<=]map_of (fields (G,fst obj))"
    28 
    25 
    29   hconf :: "'c prog => aheap => bool" ("_ |-h _ [ok]" [51,51] 50)
    26 definition hconf :: "'c prog => aheap => bool" ("_ |-h _ [ok]" [51,51] 50) where
    30  "G|-h h [ok]    == \<forall>a obj. h a = Some obj --> G,h|-obj [ok]"
    27  "G|-h h [ok]    == \<forall>a obj. h a = Some obj --> G,h|-obj [ok]"
    31  
    28  
    32   xconf :: "aheap \<Rightarrow> val option \<Rightarrow> bool"
    29 definition xconf :: "aheap \<Rightarrow> val option \<Rightarrow> bool" where
    33   "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))))"
    34 
    31 
    35   conforms :: "xstate => java_mb env' => bool" ("_ ::<= _" [51,51] 50)
    32 definition conforms :: "xstate => java_mb env' => bool" ("_ ::<= _" [51,51] 50) where
    36  "s::<=E == prg E|-h heap (store s) [ok] \<and> 
    33  "s::<=E == prg E|-h heap (store s) [ok] \<and> 
    37             prg E,heap (store s)|-locals (store s)[::<=]localT E \<and> 
    34             prg E,heap (store s)|-locals (store s)[::<=]localT E \<and> 
    38             xconf (heap (store s)) (abrupt s)"
    35             xconf (heap (store s)) (abrupt s)"
    39 
    36 
    40 
    37