(** Bitwise operations: and, or, xor, not *)

Definition bitwise (x: nval) := x.Remark bitwise_idem: forall nv, bitwise (bitwise nv) = bitwise nv.

Lemma vagree_bitwise_binop: forall f, (forall p1 p2 q1 q2 m, iagree p1 q1 m -> iagree p2 q2 m -> iagree (f p1 p2) (f q1 q2) m) -> forall v1 w1 v2 w2 x, vagree v1 w1 (bitwise x) -> vagree v2 w2 (bitwise x) -> vagree (match v1, v2 with Vint i1, Vint i2 => Vint(f i1 i2) | _, _ => Vundef end) (match w1, w2 with Vint i1, Vint i2 => Vint(f i1 i2) | _, _ => Vundef end) x.