Next Obligation.
exists (fun _ => empty_map); auto; repeat intro.
simpl.
destruct (t k); auto.
Defined.
Next Obligation.
constructor.
- intros.
extensionality k.
specialize (H k); specialize (H0 k).
destruct (x k), (y k); try congruence; contradiction.
- intros.
rewrite map_disj_join_spec in *.
destruct H, H0; subst.
rewrite map_add_assoc.
eexists; rewrite !map_disj_join_spec; repeat split.
+ eapply disjoint_incl; eauto.
rewrite map_add_comm by (apply disjoint_compatible; auto); apply map_incl_add.
+ apply disjoint_add; auto.
eapply disjoint_incl; eauto.
apply map_incl_add.
- intros ???; rewrite !map_disj_join_spec; intros []; subst.
split; [symmetry | apply map_add_comm, disjoint_compatible]; auto.
- intros.
extensionality k; specialize (H k); specialize (H0 k).
destruct (a k), (b k); auto.
+ destruct (a' k); [contradiction | auto].
+ destruct (a' k); [contradiction | auto].
+ destruct (b' k); [contradiction | auto].
Defined.
Next Obligation.
auto.
Defined.

Lemma disj_join_sub : forall m1 m2, map_incl m1 m2 -> exists m3, join m1 m3 m2.
Definition all_disjoint (l : list (A -> option B)) := forall i j, 0 <= i < Zlength l -> 0 <= j < Zlength l ->
i <> j -> disjoint (Znth i l) (Znth j l).