proposition: Theorem natToWord_inj : forall sz n m, natToWord sz n = natToWord sz m -> (n < pow2 sz)%nat -> (m < pow2 sz)%nat -> n = m.
proof: Proof. intros sz n m H H0 H1. apply (f_equal (@wordToNat _)) in H. destruct (wordToNat_natToWord sz n) as [x H2]. destruct (wordToNat_natToWord sz m) as [x0 H3]. intuition. match goal with | [ H : wordToNat ?x = wordToNat ?y, H' : wordToNat ?x = ?a, H'' : wordToNat ?y = ?b |- _ ] => let H0 := fresh in assert (H0 : a = b) by congruence; clear H H' H''; rename H0 into H end. assert (x = 0). destruct x; auto; try nia. assert (x0 = 0). destruct x0; auto; try nia. subst; simpl in *; lia. 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