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 maps_add_in : forall l m (k : A) (v : B) (Hcompat : all_compatible l),
In m l -> m k = Some v -> maps_add l k = Some v.