proposition: Lemma combine_wones_WO sz: forall w, w <> wzero sz -> split2 sz 1 (combine (wones sz) ($ 0) ^+ combine w ($ 0)) = WO~1.
proof: Proof. intros. match goal with | |- split2 _ _ (?a ^+ ?b) = _ => rewrite <- (@natToWord_wordToNat _ a); rewrite <- (@natToWord_wordToNat _ b) end. rewrite <- natToWord_plus. rewrite ?wordToNat_combine. simpl. rewrite wones_pow2_minus_one. pose proof (wordToNat_bound w) as sth. pose proof (wordToNat_nonZero H). assert (sth2: 2^sz <= 2 ^ sz - 1 + wordToNat w < 2 ^ (S sz)). { pose proof (pow2_zero sz) as sth3. split; simpl; lia. } apply split2_pow2 in sth2. rewrite Nat.mul_0_r. rewrite ?Nat.add_0_r. apply (f_equal (natToWord 1)) in sth2. rewrite natToWord_wordToNat in sth2. assumption. 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