(* This map instance requires that maps be disjoint, providing e.g. uniqueness of timestamps for histories. *)
Definition disjoint m1 m2 := forall k v1, m1 k = Some v1 -> m2 k = None.
Global Instance disjoint_comm : Symmetric disjoint.

(* Specifications: *)
Lemma disjoint_compatible : forall m1 m2, disjoint m1 m2 -> compatible m1 m2.
Instance map_disj_join : Join (A -> option B) :=
fun a b c => forall k, match a k, b k with Some v, None | None, Some v => c k = Some v | None, None => c k = None | _, _ => False end.
Lemma map_disj_join_spec : forall m1 m2 m3, join m1 m2 m3 <-> disjoint m1 m2 /\ m3 = map_add m1 m2.
Lemma disjoint_incl : forall m1 m2 m (Hcompat : disjoint m2 m) (Hincl : map_incl m1 m2), disjoint m1 m.
Lemma disjoint_add : forall m1 m2 m3, disjoint m1 m2 -> disjoint m1 m3 -> disjoint m1 (map_add m2 m3).
Global Program Instance map_disj_PCM : Ghost := { valid a := True; Join_G := map_disj_join }.