Section CMCONSTR.
Variable ge: genv.
Variable sp: val.
Variable e: env.
Variable m: mem.
Definition unary_constructor_sound (cstr: expr -> expr) (sem: val -> val) : Prop :=
forall le a x,
eval_expr ge sp e m le a x ->
exists v, eval_expr ge sp e m le (cstr a) v /\ Val.lessdef (sem x) v.
Definition binary_constructor_sound (cstr: expr -> expr -> expr) (sem: val -> val -> val) : Prop :=
forall le a x b y,
eval_expr ge sp e m le a x ->
eval_expr ge sp e m le b y ->
exists v, eval_expr ge sp e m le (cstr a b) v /\ Val.lessdef (sem x y) v.
Definition partial_unary_constructor_sound (cstr: expr -> expr) (sem: val -> option val) : Prop :=
forall le a x y,
eval_expr ge sp e m le a x ->
sem x = Some y ->
exists v, eval_expr ge sp e m le (cstr a) v /\ Val.lessdef y v.
Definition partial_binary_constructor_sound (cstr: expr -> expr -> expr) (sem: val -> val -> option val) : Prop :=
forall le a x b y z,
eval_expr ge sp e m le a x ->
eval_expr ge sp e m le b y ->
sem x y = Some z ->
exists v, eval_expr ge sp e m le (cstr a b) v /\ Val.lessdef z v.
(** ** Constants *)
(** ** Conversions *)
(** ** Addition, opposite, subtraction *)
(** ** Immediate shifts *)
Remark eval_shllimm_base: forall le a n x,
eval_expr ge sp e m le a x ->
Int.ltu n Int64.iwordsize' = true ->
eval_expr ge sp e m le (shllimm_base a n) (Val.shll x (Vint n)).
Remark eval_shrluimm_base: forall le a n x,
eval_expr ge sp e m le a x ->
Int.ltu n Int64.iwordsize' = true ->
eval_expr ge sp e m le (shrluimm_base a n) (Val.shrlu x (Vint n)).
Remark sub_shift_amount:
forall y z,
Int.ltu y Int64.iwordsize' = true -> Int.ltu z Int64.iwordsize' = true -> Int.unsigned y <= Int.unsigned z ->
Int.ltu (Int.sub z y) Int64.iwordsize' = true.
Remark eval_shrlimm_base: forall le a n x,
eval_expr ge sp e m le a x ->
Int.ltu n Int64.iwordsize' = true ->
eval_expr ge sp e m le (shrlimm_base a n) (Val.shrl x (Vint n)).
(** ** Multiplication *)
(** Integer conversions *)
(** Bitwise not, and, or, xor *)

Theorem eval_andlimm:
forall n, unary_constructor_sound (andlimm n) (fun x => Val.andl x (Vlong n)).