(* methods *)

Definition def h := if h is Def _ _ then true else false.Definition empty := @Def (finmap.nil _ _) is_true_true.Definition free x h := 
  if h is Def hs ns then Def (free_nullP x ns) else Undef.Definition find (x : ptr) h := 
  if h is Def hs _ then fnd x hs else None.Definition union h1 h2 := 
  if (h1, h2) is (Def hs1 ns1, Def hs2 ns2) then  
    if disj hs1 hs2 then 
       Def (@un_nullP _ _ ns1 ns2)
    else Undef
  else Undef.Definition um_filter q f := 
  if f is Def fs pf then Def (@filt_nullP fs q pf) else Undef.Definition pts (x : ptr) v := upd x v empty.Definition undefb h := if h is Undef then true else false.Definition from (f : heap) : base :=
  if f is Def hs ns then UM.Def (heap_base ns) else UM.Undef _ _.Definition to (b : base) : heap := 
  if b is UM.Def hs ns then Def (base_heap ns) else Undef.

Lemma empbE f : empb f = UM.empb (from f).