Definition partition'  (f: key -> bool) (s: tree) : (tree*tree) :=
  match partition_aux f s (1%positive, nil) (1%positive,  nil)
   with ((n1,l1),(n2,l2)) => (fst (treeify_g n1 l1), fst (treeify_g n2 l2))
  end.

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).