src/HOL/MicroJava/J/State.thy
changeset 32356 e11cd88e6ade
parent 30235 58d147683393
child 32359 bc1e123295f5
equal deleted inserted replaced
32355:806d2df4d79d 32356:e11cd88e6ade
     1 (*  Title:      HOL/MicroJava/J/State.thy
     1 (*  Title:      HOL/MicroJava/J/State.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{Program State} *}
     6 header {* \isaheader{Program State} *}
     8 
     7 
     9 theory State imports TypeRel Value begin
     8 theory State
       
     9 imports TypeRel Value
       
    10 begin
    10 
    11 
    11 types 
    12 types 
    12   fields' = "(vname \<times> cname \<rightharpoonup> val)"  -- "field name, defining class, value"
    13   fields' = "(vname \<times> cname \<rightharpoonup> val)"  -- "field name, defining class, value"
    13 
    14 
    14   obj = "cname \<times> fields'"    -- "class instance with class name and fields"
    15   obj = "cname \<times> fields'"    -- "class instance with class name and fields"
    17   obj_ty  :: "obj => ty"
    18   obj_ty  :: "obj => ty"
    18  "obj_ty obj  == Class (fst obj)"
    19  "obj_ty obj  == Class (fst obj)"
    19 
    20 
    20   init_vars :: "('a \<times> ty) list => ('a \<rightharpoonup> val)"
    21   init_vars :: "('a \<times> ty) list => ('a \<rightharpoonup> val)"
    21  "init_vars == map_of o map (\<lambda>(n,T). (n,default_val T))"
    22  "init_vars == map_of o map (\<lambda>(n,T). (n,default_val T))"
    22   
    23 
       
    24 lemma [code] (*manual eta expansion*):
       
    25   "init_vars xs = map_of (map (\<lambda>(n, T). (n, default_val T)) xs)"
       
    26   by (simp add: init_vars_def)
    23 
    27 
    24 types aheap  = "loc \<rightharpoonup> obj"    -- {* "@{text heap}" used in a translation below *}
    28 types aheap  = "loc \<rightharpoonup> obj"    -- {* "@{text heap}" used in a translation below *}
    25       locals = "vname \<rightharpoonup> val"  -- "simple state, i.e. variable contents"
    29       locals = "vname \<rightharpoonup> val"  -- "simple state, i.e. variable contents"
    26 
    30 
    27       state  = "aheap \<times> locals"      -- "heap, local parameter including This"
    31       state  = "aheap \<times> locals"      -- "heap, local parameter including This"