induction s; intros; auto.
simpl fold'.
remember (fold' (list key) (@cons key)) as g.
rewrite <- Heqg.
rewrite <- IHs2.
f_equal. simpl.
f_equal.
apply IHs1.
Qed.

(* Specifications: *)
Lemma fold'_spec:  forall s (A : Type) (i : A) (f : key -> A -> A),
fold' _ f s i = List.fold_left (fun a e => f e a) (List.rev (fold' _ (@cons _) s nil)) i.
Lemma mem_add_valid:
forall x s, valid s -> forall s', Some s' = mem_add' x s -> valid s'.
Lemma InA_rev_fold'_range:
forall k s lo hi,
searchtree lo hi s ->
SetoidList.InA E.eq k (List.rev (fold' (list key) (@cons _) s nil)) ->
(ltopt lo (Some k) /\ ltopt (Some k) hi).
Lemma tree_similar_lemma':
forall c c' k k' s s' lo hi lo' hi',
searchtree lo hi (T c EE k s) ->
searchtree lo' hi' (T c' EE k' s') ->
(forall x : key,
interp (T c EE k s) x <-> interp (T c' EE k' s') x) ->
K.eq k k' /\ (forall x, interp s x -> interp s' x).
Lemma tree_similar_lemma:
forall c c' k k' s s' lo hi lo' hi',
searchtree lo hi (T c EE k s) ->
searchtree lo' hi' (T c' EE k' s') ->
(forall x : key,
interp (T c EE k s) x <-> interp (T c' EE k' s') x) ->
K.eq k k' /\ (forall x, interp s x <-> interp s' x).