Instance eqmap_equiv : Equivalence eqmap.Definition upd {A} (m : nat -> A) x e :=
  fun y => if eq_nat_dec x y then e else m y.Definition updatemap (m : map) (x e : nat) : option map :=
  match m x with Some _ => Some (upd m x (Some (inl e))) | None => None end.Definition assertmap (m : map) (x : nat) : Prop :=
  match m x with Some (inl (S _)) => True | _ => False end.(*+ Join relation on resources and resource maps *)

Definition joincell (a b : option val) : option (option val) :=
  match a, b with
    | None, None => Some None
    | Some a, None | None, Some a => Some (Some a)
    | Some _, Some _ => None
  end.Definition join (m n o : map) : Prop := forall x, joincell (m x) (n x) = Some (o x).Definition joins (m n : map) : Prop := exists o, join m n o.

Lemma join_eqmap_compat_l {m m' n o} : eqmap m m' -> join m n o -> join m' n o.