(** For integers, we do have a binary complement function *)
Definition lnot a := P (-a).
#[global]
Instance lnot_wd : Proper (eq==>eq) lnot.

(* Specifications: *)
Lemma lnot_involutive : forall a, lnot (lnot a) == a.
Lemma lnot_0 : lnot 0 == -1.
Lemma lnot_m1 : lnot (-1) == 0.
(** Complement and other operations *)
Lemma lor_m1_r : forall a, lor a (-1) == -1.
Lemma lor_m1_l : forall a, lor (-1) a == -1.
Lemma land_m1_r : forall a, land a (-1) == a.
Lemma land_m1_l : forall a, land (-1) a == a.
Lemma ldiff_m1_r : forall a, ldiff a (-1) == 0.
Lemma ldiff_m1_l : forall a, ldiff (-1) a == lnot a.
Lemma lor_lnot_diag : forall a, lor a (lnot a) == -1.
Lemma add_lnot_diag : forall a, a + lnot a == -1.
Lemma ldiff_land : forall a b, ldiff a b == land a (lnot b).
Lemma land_lnot_diag : forall a, land a (lnot a) == 0.
Lemma lnot_lor : forall a b, lnot (lor a b) == land (lnot a) (lnot b).
Lemma lnot_land : forall a b, lnot (land a b) == lor (lnot a) (lnot b).
Lemma lnot_ldiff : forall a b, lnot (ldiff a b) == lor (lnot a) b.
Lemma lxor_lnot_lnot : forall a b, lxor (lnot a) (lnot b) == lxor a b.
Lemma lnot_lxor_l : forall a b, lnot (lxor a b) == lxor (lnot a) b.
Lemma lnot_lxor_r : forall a b, lnot (lxor a b) == lxor a (lnot b).
Lemma lxor_m1_r : forall a, lxor a (-1) == lnot a.
Lemma lxor_m1_l : forall a, lxor (-1) a == lnot a.
Lemma lxor_lor : forall a b, land a b == 0 ->
lxor a b == lor a b.
Lemma lnot_shiftr : forall a n, 0<=n -> lnot (a >> n) == (lnot a) >> n.
Definition ones n := P (1<<n).