Next Obligation.
exists (fun _ => empty_map); auto; repeat intro.
split; auto; intros [|]; auto; discriminate.
Defined.
Next Obligation.
constructor.
- intros.
extensionality k.
specialize (H k); specialize (H0 k).
destruct (z k).
+ destruct (H b) as [X _]; specialize (X eq_refl).
rewrite <- H0 in X; auto.
+ destruct (z' k); auto.
destruct (H0 b) as [X _]; specialize (X eq_refl).
rewrite <- H in X; auto.
- intros.
rewrite map_join_spec in *.
destruct H, H0; subst.
rewrite map_add_assoc.
eexists; rewrite !map_join_spec; repeat split.
+ eapply compatible_incl; eauto.
rewrite map_add_comm by auto; apply map_incl_add.
+ apply compatible_add_assoc; auto.
- intros ???; rewrite !map_join_spec; intros []; subst.
split; [symmetry | apply map_add_comm]; auto.
- intros.
extensionality k; specialize (H k); specialize (H0 k).
destruct (a k), (b k); auto.
+ apply H0; auto.
+ destruct (H b0) as [_ H']; lapply H'; auto.
+ destruct (H0 b0) as [_ H']; lapply H'; auto.
Defined.
Next Obligation.
auto.
Defined.
Instance fmap_order : PCM_order map_incl.

Lemma compatible_upd : forall m1 m2 k v, compatible m1 m2 -> m2 k = None ->
compatible (map_upd m1 k v) m2.