Definition strict_bool_val (v: val) (t: type) : option bool :=
   match v, t with
   | Vint n, Tint _ _ _ => Some (negb (Int.eq n Int.zero))
   | Vlong n, Tlong _ _ => Some (negb (Int64.eq n Int64.zero))
   | (Vint n), (Tpointer _ _ | Tarray _ _ _ | Tfunction _ _ _ ) =>
            if Archi.ptr64 then None else if Int.eq n Int.zero then Some false else None
   | Vlong n, (Tpointer _ _ | Tarray _ _ _ | Tfunction _ _ _ ) =>
            if Archi.ptr64 then if Int64.eq n Int64.zero then Some false else None else None
   | Vptr b ofs, (Tpointer _ _ | Tarray _ _ _ | Tfunction _ _ _ ) => Some true
   | Vfloat f, Tfloat F64 _ => Some (negb(Float.cmp Ceq f Float.zero))
   | Vsingle f, Tfloat F32 _ => Some (negb(Float32.cmp Ceq f Float32.zero))
   | _, _ => None
   end.Definition type_is_by_value (t:type) : bool :=
  match t with
  | Tint _ _ _
  | Tlong _ _
  | Tfloat _ _
  | Tpointer _ _ => true
  | _ => false
  end.Definition type_is_by_reference t : bool :=
  match t with
  | Tarray _ _ _
  | Tfunction _ _ _ => true
  | _ => false
  end.Definition t := positive -> option B.Definition get (h: t) (a:positive) : option B := h a.Definition set (a:positive) (v: B) (h: t) : t :=
  fun i => if ident_eq i a then Some v else h i.Definition remove (a: positive) (h: t) : t :=
  fun i => if ident_eq i a then None else h i.Definition empty : t := fun _ => None.

(* Specifications: *)
Lemma gss h x v : get (set x v h) x = Some v.
Lemma gso h x y v : x<>y -> get (set x v h) y = get h y.
Lemma grs h x : get (remove x h) x = None.
Lemma gro h x y : x<>y -> get (remove x h) y = get h y.
Lemma ext h h' : (forall x, get h x = get h' x) -> h=h'.
Lemma override (a: positive) (b b' : B) h : set a b' (set a b h) = set a b' h.
Lemma gsspec: forall (i j: positive) (x: B) (m: t), get (set j x m) i = if ident_eq i j then Some x else get m i.
Lemma override_same : forall id t (x:B), get t id = Some x -> set id x t = t.