Section MAKE_BIN.
Variable sem_int: signedness -> int -> int -> option val.
Variable sem_long: signedness -> int64 -> int64 -> option val.
Variable sem_float: float -> float -> option val.
Variables iop iopu fop lop lopu: binary_operation.
Hypothesis iop_ok:
forall x y m, eval_binop iop (Vint x) (Vint y) m = sem_int Signed x y.
Hypothesis iopu_ok:
forall x y m, eval_binop iopu (Vint x) (Vint y) m = sem_int Unsigned x y.
Hypothesis lop_ok:
forall x y m, eval_binop lop (Vlong x) (Vlong y) m = sem_long Signed x y.
Hypothesis lopu_ok:
forall x y m, eval_binop lopu (Vlong x) (Vlong y) m = sem_long Unsigned x y.
Hypothesis fop_ok:
forall x y m, eval_binop fop (Vfloat x) (Vfloat y) m = sem_float x y.
End MAKE_BIN.
Hint Extern 2 (@eq (option val) _ _) => (simpl; reflexivity) : cshm.
Ltac comput val :=
let x := fresh in set val as x in *; vm_compute in x; subst x.
Remark small_shift_amount_1:
forall i,
Int64.ltu i Int64.iwordsize = true ->
Int.ltu (Int64.loword i) Int64.iwordsize' = true
/\ Int64.unsigned i = Int.unsigned (Int64.loword i).
Remark small_shift_amount_2:
forall i,
Int64.ltu i (Int64.repr 32) = true ->
Int.ltu (Int64.loword i) Int.iwordsize = true.
(* Lemma make_memcpy_correct: forall f dst src ty k e le m b ofs v m', eval_expr ge e le m dst (Vptr b ofs) -> eval_expr ge e le m src v -> assign_loc ty m b ofs v m' -> access_mode ty = By_copy -> step ge (State f (make_memcpy dst src ty) k e le m) E0 (State f Sskip k e le m').  (*Will be needed for builtin: Lemma make_memcpy_correct: forall f dst src ty k e le m b ofs v m', eval_expr ge e le m dst (Vptr b ofs) -> eval_expr ge e le m src v -> assign_loc ty m b ofs v m' -> access_mode ty = By_copy -> CSharpMin_corestep ge (CSharpMin_State f (make_memcpy dst src ty) k e le) m (CSharpMin_State f Sskip k e le) m'. *)
(* Lemma make_memcpy_correct_BuiltinEffect: forall f dst src ty k e le m b ofs v m', eval_expr ge e le m dst (Vptr b ofs) -> eval_expr ge e le m src v -> assign_loc ty m b ofs v m' -> access_mode ty = By_copy -> exists b' ofs', v = Vptr b' ofs' /\ effstep csharpmin_eff_sem ge (BuiltinEffect ge (ef_sig (EF_memcpy (sizeof ty) (alignof_blockcopy ty))) (Vptr b ofs :: Vptr b' ofs' :: nil) m) (CSharpMin_State f (make_memcpy dst src ty) k e le) m (CSharpMin_State f Sskip k e le) m'. *)
(*WILL be needed for builtin Lemma make_memcpy_correct_assignlocEffect: forall f dst src ty k e le m b ofs v m', eval_expr ge e le m dst (Vptr b ofs) -> eval_expr ge e le m src v -> assign_loc ty m b ofs v m' -> access_mode ty = By_copy -> exists b' ofs', v = Vptr b' ofs' /\ effstep csharpmin_eff_sem ge (assign_loc_Effect ty b ofs v) (CSharpMin_State f (make_memcpy dst src ty) k e le) m (CSharpMin_State f Sskip k e le) m'. Lemma make_store_correct: forall addr ty rhs code e le m b ofs v m' f k, make_store addr ty rhs = OK code -> eval_expr ge e le m addr (Vptr b ofs) -> eval_expr ge e le m rhs v -> assign_loc ty m b ofs v m' -> CSharpMin_corestep ge (CSharpMin_State f code k e le) m (CSharpMin_State f Sskip k e le) m'.  Lemma make_store_correct_StoreEffect: forall addr ty rhs code e le m b ofs v m' f k, make_store addr ty rhs = OK code -> eval_expr ge e le m addr (Vptr b ofs) -> eval_expr ge e le m rhs v -> assign_loc ty m b ofs v m' -> match access_mode ty with By_value chunk => effstep csharpmin_eff_sem ge (StoreEffect (Vptr b ofs) (encode_val chunk v)) (CSharpMin_State f code k e le) m (CSharpMin_State f Sskip k e le) m' | By_copy => True (*WILL be needed for builtin: exists b' ofs', v = Vptr b' ofs' /\ effstep csharpmin_eff_sem ge (BuiltinEffect ge (ef_sig (EF_memcpy (sizeof ty) (alignof_blockcopy ty))) (Vptr b ofs :: Vptr b' ofs' :: nil) m) (CSharpMin_State f code k e le) m (CSharpMin_State f Sskip k e le) m'*)
| _ => False
end.

Lemma make_store_correct_AssignlocEffect:
forall addr ty rhs code e le m b ofs v m' f k,
make_store addr ty rhs = OK code ->
eval_expr ge e le m addr (Vptr b ofs) ->
eval_expr ge e le m rhs v ->
assign_loc ty m b ofs v m' ->
effstep csharpmin_eff_sem ge
(assign_loc_Effect ty b ofs v)
(CSharpMin_State f code k e le) m
(CSharpMin_State f Sskip k e le) m'.