proposition: Lemma wordToN_mod: forall sz (a b: word sz), wordToN (a ^% b) = (wordToN a mod wordToN b)%N.
proof: Proof. intros. unfold wmod, wordBin. rewrite wordToN_NToWord_2; [ reflexivity | ]. destruct (wordToN b) eqn: E. - unfold N.modulo, N.div_eucl. destruct (wordToN a) eqn: F; simpl. + apply Npow2_pos. + rewrite <- F. apply wordToN_bound. - eapply N.lt_trans. + apply N.mod_upper_bound. congruence. + rewrite <- E. apply wordToN_bound. 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