Fixpoint xfind (i j : key) (m : t A) : option A :=
match i, j with
| _, xH => find i m
| xO ii, xO jj => xfind ii jj m
| xI ii, xI jj => xfind ii jj m
| _, _ => None
end.

(* Specifications: *)
Lemma xfind_left :
forall (j i : key) (m1 m2 : t A) (o : option A) (v : A),
xfind i (append j (xO xH)) m1 = Some v -> xfind i j (Node m1 o m2) = Some v.
Lemma xelements_ii :
forall (m: t A) (i j : key) (v: A),
List.In (xI i, v) (xelements m (xI j)) -> List.In (i, v) (xelements m j).
Lemma xelements_io :
forall (m: t A) (i j : key) (v: A),
~List.In (xI i, v) (xelements m (xO j)).
Lemma xelements_oo :
forall (m: t A) (i j : key) (v: A),
List.In (xO i, v) (xelements m (xO j)) -> List.In (i, v) (xelements m j).
Lemma xelements_oi :
forall (m: t A) (i j : key) (v: A),
~List.In (xO i, v) (xelements m (xI j)).
Lemma xelements_ih :
forall (m1 m2: t A) (o: option A) (i : key) (v: A),
List.In (xI i, v) (xelements (Node m1 o m2) xH) -> List.In (i, v) (xelements m2 xH).
Lemma xelements_oh :
forall (m1 m2: t A) (o: option A) (i : key) (v: A),
List.In (xO i, v) (xelements (Node m1 o m2) xH) -> List.In (i, v) (xelements m1 xH).
Lemma xelements_hi :
forall (m: t A) (i : key) (v: A),
~List.In (xH, v) (xelements m (xI i)).
Lemma xelements_ho :
forall (m: t A) (i : key) (v: A),
~List.In (xH, v) (xelements m (xO i)).
Lemma find_xfind_h :
forall (m: t A) (i: key), find i m = xfind i xH m.
Lemma xelements_complete:
forall (i j : key) (m: t A) (v: A),
List.In (i, v) (xelements m j) -> xfind i j m = Some v.
Theorem elements_complete:
forall (m: t A) (i: key) (v: A),
List.In (i, v) (elements m) -> find i m = Some v.
Lemma cardinal_1 :
forall (m: t A), cardinal m = length (elements m).