proposition: Lemma countLeadingZerosWord_nat_correct ni: forall no (w: word ni), ni < pow2 no -> #(countLeadingZerosWord no w) = countLeadingZerosWord_nat w.
proof: Proof. induction ni; intros; simpl; auto. - rewrite ?wordToNat_natToWord_idempotent'; auto. - match goal with | |- # (if ?P then _ else _) = if ?P then _ else _ => destruct P end. + rewrite <- wordToNat_plus. rewrite ?wordToNat_natToWord_idempotent'; try lia. * simpl;f_equal. rewrite IHni; auto. * rewrite ?wordToNat_natToWord_idempotent'; try lia. match goal with | |- 1 + #(countLeadingZerosWord no ?x) < _ => pose proof (@countLeadingZerosWord_le_len_nat no ni ltac:(lia) x) as sth end. lia. + rewrite roundTrip_0; auto. Qed.
imports: Coq.Classes.Morphisms Coq.Classes.Morphisms_Prop Coq.Classes.Equivalence Coq.Arith.PeanoNat Coq.ZArith.BinInt  Coq.Arith.Arith Coq.NArith.NArith Coq.Bool.Bool Coq.ZArith.ZArith Coq.Logic.Eqdep_dec Coq.Logic.EqdepFacts Coq.Program.Tactics Coq.Program.Equality Coq.setoid_ring.Ring Coq.setoid_ring.Ring_polynom bbv.Nomega bbv.ZLib bbv.NatLib bbv.NLib bbv.N_Z_nat_conversions bbv.DepEq bbv.DepEqNat bbv.ReservedNotations Coq.micromega.Lia