(** ** Detecting operations that are redundant and can be turned into a move *)

Definition andimm_redundant (x: nval) (n: int) :=
  match x with
  | Nothing => true
  | I m => Int.eq_dec (Int.and m (Int.not n)) Int.zero
  | _ => false
  end.

(* Specifications: *)
Lemma andimm_redundant_sound: forall v w x n, andimm_redundant x n = true -> vagree v w (andimm x n) -> vagree (Val.and v (Vint n)) w x.