Definition wbring (sz : nat) : semi_ring_theory (wzero sz) (wones sz) (@wor sz) (@wand sz) (@eq _) :=
  mk_srt _ _ _ _ _
  (@wor_unit _) (@wor_comm _) (@wor_assoc _)
  (@wand_unit _) (@wand_kill _) (@wand_comm _) (@wand_assoc _)
  (@wand_or_distr _).(** * Inequality proofs *)

Ltac word_simpl := unfold sext, zext, wzero in *; simpl in *.Ltac word_eq := ring.Ltac word_eq1 := match goal with
                   | _ => ring
                   | [ H : _ = _ |- _ ] => ring [H]
                 end.Ltac word_neq := apply word_neq; let H := fresh "H" in intro H; simpl in H; ring_simplify in H; try discriminate.Ltac word_contra := match goal with
                      | [ H : _ <> _ |- False ] => apply H; ring
                    end.Ltac word_contra1 := match goal with
                       | [ H : _ <> _ |- False ] => apply H;
                         match goal with
                           | _ => ring
                           | [ H' : _ = _ |- _ ] => ring [H']
                         end
                     end.

Lemma pow2_minus_one_wones: forall {sz} (w: word sz), wordToNat w = pow2 sz - 1 -> w = wones sz.