#[local] Ltac caseq :=
  match goal with [ |- context [match ?t with _ => _ end] ] =>
    let cmp := fresh in
    let H := fresh in
    remember t as cmp eqn:H; symmetry in H; destruct cmp
  end.

(* Specifications: *)
Lemma compare_aux_Cmp : forall e, Cmp (compare_aux e) (flatten_e (fst e)) (flatten_e (snd e)).
Lemma compare_Cmp : forall m1 m2, Cmp (compare_aux (Raw.cons m1 (Raw.End _), Raw.cons m2 (Raw.End _))) (Raw.elements m1) (Raw.elements m2).