Ltac spec H := match type of H with ?A -> _ =>
let H' := fresh in (assert (H' : A); [ | specialize (H H'); clear H']) end.

Lemma treeify_g_length:
forall n l, S (length l) >= nat_of_P n ->
length(snd(treeify_g n l))+nat_of_P n = S (length l).