proposition: Lemma wrshifta_extz_sext: forall sz (w: word sz) n1 n2, existT word _ (wrshifta (extz w (n1 + n2)) n1) = existT word _ (sext (extz w n2) n1).
proof: Proof. intros. rewrite <-extz_sext. apply wordToNat_existT; [lia|]. rewrite wordToNat_wrshifta. replace (wordToNat (sext (extz w (n1 + n2)) n1)) with (wordToNat (sext (extz (extz w n2) n1) n1)). - replace (wordToNat (sext (extz (extz w n2) n1) n1)) with (wordToNat (extz (sext (extz w n2) n1) n1)) by apply existT_wordToNat, extz_sext. do 2 rewrite wordToNat_extz. rewrite Nat.mul_comm, Nat.div_mul by (pose proof (zero_lt_pow2 n1); lia). replace (wordToNat (sext (extz w n2) n1)) with (wordToNat (extz (sext w n1) n2)) by apply existT_wordToNat, extz_sext. rewrite wordToNat_extz. reflexivity. - apply wordToNat_sext_bypass; [lia|]. apply existT_wordToNat. apply extz_extz. 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