Require Export VST.veric.environ_lemmas.
Ltac unfold_tc_denote :=
unfold denote_tc_nonzero in *;
unfold isptr in *;
unfold denote_tc_igt in *;
unfold denote_tc_Zle in *;
unfold denote_tc_Zge in *;
unfold denote_tc_samebase in *;
unfold denote_tc_nodivover in *;
unfold denote_tc_initialized in *.
Definition unOp_result_type op t :=
match op with
| Cop.Onotbool =>match t with
| Tint _ _ _ => Tint IBool Signed noattr
| Tlong _ _ => Tint IBool Signed noattr
| Tpointer _ _ => Tint I32 Signed noattr
| Tfloat _ _ => Tint IBool Signed noattr
| Tarray _ _ _ => Tint IBool Signed noattr
| Tfunction _ _ _ => Tint IBool Signed noattr
| _ => Tvoid
end
| Cop.Onotint => match t with
| Tint _ _ _ => Tint I32 Signed noattr
| Tlong _ _ => Tlong Signed noattr
| _ => Tvoid
end
| Cop.Oneg => match t with
| Tint _ _ _ => Tint I32 Signed noattr
| Tlong _ _ => Tlong Signed noattr
| Tfloat _ _ => t
| _ => Tvoid
end
| Cop.Oabsfloat => t
end.

Lemma typecheck_deref_sound:
forall {CS: compspecs} Delta rho m e t pt,
typecheck_environ Delta rho ->
(denote_tc_assert (typecheck_expr Delta e) rho m ->
tc_val (typeof e) (eval_expr e rho)) /\
(forall pt0 : type,
denote_tc_assert (typecheck_lvalue Delta e) rho m ->
is_pointer_type pt0 = true -> tc_val pt0 (eval_lvalue e rho)) ->
denote_tc_assert (typecheck_lvalue Delta (Ederef e t)) rho m ->
is_pointer_type pt = true ->
tc_val pt (eval_lvalue (Ederef e t) rho).