proposition: Theorem drop_sub : forall sz n k, (k * pow2 sz <= n)%nat -> natToWord sz (n - k * pow2 sz) = natToWord sz n.
proof: Proof. induction sz as [|sz IHsz]; simpl; intros n k *; intuition; repeat rewrite untimes2 in *; f_equal. rewrite Nat.mul_assoc. rewrite (Nat.mul_comm k). rewrite <- Nat.mul_assoc. apply drop_mod2. rewrite Nat.mul_assoc. rewrite (Nat.mul_comm 2). rewrite <- Nat.mul_assoc. auto. rewrite <- (IHsz (Nat.div2 n) k). rewrite Nat.mul_assoc. rewrite (Nat.mul_comm k). rewrite <- Nat.mul_assoc. rewrite div2_minus_2. reflexivity. rewrite Nat.mul_assoc. rewrite (Nat.mul_comm 2). rewrite <- Nat.mul_assoc. auto. apply div2_bound. rewrite Nat.mul_assoc. rewrite (Nat.mul_comm 2). rewrite <- Nat.mul_assoc. 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