src/HOL/Bali/State.thy
changeset 32960 69916a850301
parent 31127 b63c3f6bd3be
child 33965 f57c11db4ad4
equal deleted inserted replaced
32959:23a8c5ac35f8 32960:69916a850301
    17 *}
    17 *}
    18 
    18 
    19 section "objects"
    19 section "objects"
    20 
    20 
    21 datatype  obj_tag =     --{* tag for generic object   *}
    21 datatype  obj_tag =     --{* tag for generic object   *}
    22 	  CInst qtname  --{* class instance           *}
    22           CInst qtname  --{* class instance           *}
    23 	| Arr  ty int   --{* array with component type and length *}
    23         | Arr  ty int   --{* array with component type and length *}
    24     --{* | CStat qtname   the tag is irrelevant for a class object,
    24     --{* | CStat qtname   the tag is irrelevant for a class object,
    25 			   i.e. the static fields of a class,
    25                            i.e. the static fields of a class,
    26                            since its type is given already by the reference to 
    26                            since its type is given already by the reference to 
    27                            it (see below) *}
    27                            it (see below) *}
    28 
    28 
    29 types	vn   = "fspec + int"                    --{* variable name      *}
    29 types   vn   = "fspec + int"                    --{* variable name      *}
    30 record	obj  = 
    30 record  obj  = 
    31           tag :: "obj_tag"                      --{* generalized object *}
    31           tag :: "obj_tag"                      --{* generalized object *}
    32           "values" :: "(vn, val) table"      
    32           "values" :: "(vn, val) table"      
    33 
    33 
    34 translations 
    34 translations 
    35   "fspec" <= (type) "vname \<times> qtname" 
    35   "fspec" <= (type) "vname \<times> qtname" 
   212 done
   212 done
   213 
   213 
   214 
   214 
   215 section "stores"
   215 section "stores"
   216 
   216 
   217 types	globs               --{* global variables: heap and static variables *}
   217 types   globs               --{* global variables: heap and static variables *}
   218 	= "(oref , obj) table"
   218         = "(oref , obj) table"
   219 	heap
   219         heap
   220 	= "(loc  , obj) table"
   220         = "(loc  , obj) table"
   221 (*	locals                   
   221 (*      locals                   
   222 	= "(lname, val) table" *) (* defined in Value.thy local variables *)
   222         = "(lname, val) table" *) (* defined in Value.thy local variables *)
   223 
   223 
   224 translations
   224 translations
   225  "globs"  <= (type) "(oref , obj) table"
   225  "globs"  <= (type) "(oref , obj) table"
   226  "heap"   <= (type) "(loc  , obj) table"
   226  "heap"   <= (type) "(loc  , obj) table"
   227 (*  "locals" <= (type) "(lname, val) table" *)
   227 (*  "locals" <= (type) "(lname, val) table" *)
   228 
   228 
   229 datatype st = (* pure state, i.e. contents of all variables *)
   229 datatype st = (* pure state, i.e. contents of all variables *)
   230 	 st globs locals
   230          st globs locals
   231 
   231 
   232 subsection "access"
   232 subsection "access"
   233 
   233 
   234 constdefs
   234 constdefs
   235 
   235 
   479 primrec "the_Jump (Jump j) = j"
   479 primrec "the_Jump (Jump j) = j"
   480 primrec "the_Loc (Loc a) = a"
   480 primrec "the_Loc (Loc a) = a"
   481 primrec "the_Std (Std x) = x"
   481 primrec "the_Std (Std x) = x"
   482 
   482 
   483 
   483 
   484 	
   484         
   485 
   485 
   486 constdefs
   486 constdefs
   487   abrupt_if    :: "bool \<Rightarrow> abopt \<Rightarrow> abopt \<Rightarrow> abopt"
   487   abrupt_if    :: "bool \<Rightarrow> abopt \<Rightarrow> abopt \<Rightarrow> abopt"
   488  "abrupt_if c x' x \<equiv> if c \<and> (x = None) then x' else x"
   488  "abrupt_if c x' x \<equiv> if c \<and> (x = None) then x' else x"
   489 
   489