induction x; intuition; simpl in *.
omega.
destruct (eq_nat_dec x 1); subst.
exists 1.
exists 0.
intuition; omega.
edestruct (IHx).
omega.
destruct H0.
intuition.
destruct x1.
rewrite plus_0_r in H3.
exists x0.
exists 1.
subst.
intuition; omega.
exists (S x0).
exists 0.
subst.
intuition.
Qed.

Theorem log2_div2 :
forall x y,
S y = Nat.log2 x ->
Nat.log2 (div2 x) = y.