Function compare' (s t : tree) {measure size s} : comparison :=
 match gopher s, gopher t with
 | EE , EE => Eq
 | T _ EE j sr , T _ EE j' tr =>
    match K.compare j j' with
    | Gt => Gt | Lt => Lt | Eq => compare' sr tr
    end
 | T _ _ _ _, T _ _ _ _ => Eq (* impossible *)
 | T _ _ _ _, EE => Gt
 |  EE, T _ _ _ _ => Lt
 end.

(* Specifications: *)
Lemma interp_compare': forall a b, compare' a b = Eq -> (forall k, interp a k <-> interp b k).
Lemma compare'_interp_aux: forall a lo hi b lo' hi', searchtree lo hi a -> searchtree lo' hi' b -> (forall k, interp a k <-> interp b k) -> compare' a b = Eq.