#[global]
Instance remove_rb s x : Rbt s -> Rbt (remove x s).(** ** Treeify *)

Definition treeify_rb_invariant size depth (f:treeify_t) :=
 forall acc,
 size <= length acc ->
  rbt depth (fst (f acc)) /\
  size + length (snd (f acc)) = length acc.

Lemma treeify_one_rb : treeify_rb_invariant 1 0 treeify_one.