proposition: Lemma wordToNat_combine: forall sz1 (w1: word sz1) sz2 (w2: word sz2), wordToNat (combine w1 w2) = wordToNat w1 + pow2 sz1 * wordToNat w2.
proof: Proof. dependent induction w1; intros; [simpl; lia|]. unfold pow2; fold pow2. rewrite Nat.mul_comm with (n:= 2). simpl; destruct b. - rewrite IHw1; simpl. rewrite Nat.mul_comm with (n:= pow2 n * 2). rewrite Nat.mul_assoc. rewrite <-Nat.mul_add_distr_r. rewrite Nat.mul_comm with (n:= pow2 n). reflexivity. - rewrite IHw1. rewrite Nat.mul_comm with (n:= pow2 n * 2). rewrite Nat.mul_assoc. rewrite <-Nat.mul_add_distr_r. rewrite Nat.mul_comm with (n:= pow2 n). reflexivity. 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