Fixpoint equal (A:Type)(cmp : A -> A -> bool)(m1 m2 : t A) : bool :=
match m1, m2 with
| Leaf _, _ => is_empty m2
| _, Leaf _ => is_empty m1
| Node l1 o1 r1, Node l2 o2 r2 =>
(match o1, o2 with
| None, None => true
| Some v1, Some v2 => cmp v1 v2
| _, _ => false
end)
&& equal cmp l1 l2 && equal cmp r1 r2
end.
Definition Equal (A:Type)(m m':t A) :=
forall y, find y m = find y m'.
Definition Equiv (A:Type)(eq_elt:A->A->Prop) m m' :=
(forall k, In k m <-> In k m') /\
(forall k e e', MapsTo k e m -> MapsTo k e' m' -> eq_elt e e').
Definition Equivb (A:Type)(cmp: A->A->bool) := Equiv (Cmp cmp).

Lemma equal_1 : forall (A:Type)(m m':t A)(cmp:A->A->bool),
Equivb cmp m m' -> equal cmp m m' = true.