Section strong.
Variable P : nat -> Prop.
Hypothesis PH : forall n, (forall m, m < n -> P m) -> P n.
induction n; simpl; intuition; apply PH; intuition.
elimtype False; omega.
Qed.
intros; eapply strong'; eauto.
Qed.
End strong.
induction n as [n] using strong; simpl; intuition.
destruct n as [|n]; simpl in *; intuition.
discriminate.
destruct n as [|n]; simpl in *; intuition.
do 2 f_equal.
replace (div2 n + S (div2 n + 0)) with (S (div2 n + (div2 n + 0))); auto.
Qed.
induction n as [n] using strong; simpl; intuition.
destruct n as [|n]; simpl in *; intuition.
destruct n as [|n]; simpl in *; intuition.
discriminate.
f_equal.
replace (div2 n + S (div2 n + 0)) with (S (div2 n + (div2 n + 0))); auto.
Qed.
induction n as [n] using strong; intros.
do 2 (destruct n; simpl in *; repeat rewrite untimes2 in *; intuition).
destruct k; simpl in *; intuition.
destruct k; simpl; intuition.
rewrite <- plus_n_Sm.
repeat rewrite untimes2 in *.
simpl; auto.
apply H; omega.
Qed.
induction n as [n] using strong; intros.
do 2 (destruct n; simpl in *; intuition; repeat rewrite untimes2 in *).
destruct k; simpl in *; intuition.
destruct k; simpl in *; intuition.
rewrite <- plus_n_Sm.
apply H; omega.
Qed.
intros ? n H; case_eq (mod2 n); intro Heq.
rewrite (div2_odd _ Heq) in H.
omega.
rewrite (div2_even _ Heq) in H.
omega.
Qed.
(* otherwise b is made implicit, while a isn't, which is weird *)
Arguments div2_compat_lt_l {_} {_} _.

Lemma mod2sub: forall a b,
b <= a ->
mod2 (a - b) = xorb (mod2 a) (mod2 b).