(** ** Abstract operations over value needs. *)
Ltac InvAgree :=
simpl vagree in *;
repeat (
auto || exact Logic.I ||
match goal with
| [ H: False |- _ ] => contradiction
| [ H: match ?v with Vundef => _ | Vint _ => _ | Vlong _ => _ | Vfloat _ => _ | Vsingle _ => _ | Vptr _ _ => _ end |- _ ] => destruct v
| [ |- context [if Archi.ptr64 then _ else _] ] => destruct Archi.ptr64 eqn:?
end).
(** And immediate, or immediate *)
Definition andimm (x: nval) (n: int) :=
match x with
| Nothing => Nothing
| I m => I (Int.and m n)
| All => I n
end.

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