proposition: Theorem wordToNat_minus_one': forall sz n, n <> natToWord sz 0 -> S (wordToNat (n ^- natToWord sz 1)) = wordToNat n.
proof: Proof. intros. destruct sz. rewrite word0 with (w:=n) in H. rewrite word0 with (w:=natToWord 0 0) in H. exfalso; auto. destruct (weq n (natToWord (S sz) 0)); intuition. rewrite wminus_Alt. rewrite wminus_Alt2. unfold wordBinN. rewrite roundTrip_1. erewrite wordToNat_natToWord_bound with (bound:=n); try lia. assert (wordToNat n <> 0); try lia. unfold not; intros; apply n0; clear n0. rewrite <- H0; rewrite natToWord_wordToNat; auto. unfold not; intros; apply n0; clear n0. apply wlt_lt in H0. replace n with (natToWord (S sz) (wordToNat n)) by (rewrite natToWord_wordToNat; auto). f_equal; rewrite roundTrip_1 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