(* Merge *)

Definition merge (uf: t) (a b: elt) : t :=
  let a' := repr uf a in
  let b' := repr uf b in
  match M.elt_eq a' b' with
  | left EQ => uf
  | right NEQ => identify uf a' b (repr_res_none uf a) (not_eq_sym NEQ)
  end.

(* Specifications: *)
Lemma repr_merge: forall uf a b x, repr (merge uf a b) x = repr (union uf a b) x.
Lemma sameclass_merge: forall uf a b x y, sameclass (merge uf a b) x y <-> sameclass (union uf a b) x y.
Lemma repr_merge: forall uf a b x, repr (merge uf a b) x = repr (union uf a b) x.
Lemma sameclass_merge: forall uf a b x y, sameclass (merge uf a b) x y <-> sameclass (union uf a b) x y.