Section IDENTIFY.
Variable uf: t.
Variables a b: elt.
Hypothesis a_canon: M.get a uf.(m) = None.
Hypothesis not_same_class: repr uf b <> a.
Remark identify_Acc_b:
forall x,
Acc (order uf.(m)) x -> repr uf x <> a -> Acc (order (M.set a b uf.(m))) x.
Remark identify_Acc:
forall x,
Acc (order uf.(m)) x -> Acc (order (M.set a b uf.(m))) x.
Definition identify := mk (M.set a b uf.(m)) identify_wf.
End IDENTIFY.
(* Union *)
Remark union_not_same_class:
forall uf a b, repr uf a <> repr uf b -> repr uf (repr uf b) <> repr uf a.
Definition union (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) (union_not_same_class uf a b NEQ)
end.

Lemma sameclass_union_2:
forall uf a b x y, sameclass uf x y -> sameclass (union uf a b) x y.