Fixpoint countLeadingZerosWord ni no: word ni -> word no :=
match ni return word ni -> word no with
| 0 => fun _ => $ 0
| S m => fun e =>
if (weq (split2 m 1 (nat_cast (fun n => word n) (eq_sym (Nat.add_1_r m)) e)) WO~0)
then $ 1 ^+ @countLeadingZerosWord m no (split1 m 1 (nat_cast (fun n => word n) (eq_sym (Nat.add_1_r m)) e))
else $ 0
end.

Lemma pow2_lt_pow2_S:
forall n, pow2 n < pow2 (n+1).