Definition weak_mapsto_ sh e rho :=
match (eval_expr e rho) with
| Vptr b o => (mapsto_ sh (typeof e) (Vptr b o)) ||
(mapsto_ sh (typeof e) (Vptr b o))
| _ => FF
end.

(* Specifications: *)
Lemma extend_sepcon_TT {A} {JA: Join A} {PA: Perm_alg A}{SA: Sep_alg A} {AG: ageable A} {Aga: Age_alg A}:
forall P, boxy extendM (P * TT).
Lemma semax_ptr_compare:
forall (Delta: tycontext) (P: assert) id cmp e1 e2 ty sh1 sh2,
nonidentity sh1 -> nonidentity sh2 ->
is_comparison cmp = true  ->
eqb_type (typeof e1) int_or_ptr_type = false ->
eqb_type (typeof e2) int_or_ptr_type = false ->
(typecheck_tid_ptr_compare Delta id = true) ->
semax Espec Delta
(fun rho =>
|> (tc_expr Delta e1 rho && tc_expr Delta e2 rho  &&
!!(blocks_match cmp (eval_expr e1 rho) (eval_expr e2 rho)) &&
(mapsto_ sh1 (typeof e1) (eval_expr e1 rho) * TT) &&
(mapsto_ sh2 (typeof e2) (eval_expr e2 rho) * TT) &&
P rho))
(Sset id (Ebinop cmp e1 e2 ty))
(normal_ret_assert
(fun rho => (EX old:val,
!!(eval_id id rho =  subst id old
(eval_expr (Ebinop cmp e1 e2 ty)) rho) &&
subst id old P rho))).
Lemma semax_set_forward:
forall (Delta: tycontext) (P: assert) id e,
semax Espec Delta
(fun rho =>
|> (tc_expr Delta e rho  && (tc_temp_id id (typeof e) Delta e rho) && P rho))
(Sset id e)
(normal_ret_assert
(fun rho => (EX old:val,
!! (eval_id id rho =  subst id old (eval_expr e) rho) &&
subst id old P rho))).
Lemma semax_set_forward':
forall (Delta: tycontext) (P: assert) id e t,
typeof_temp Delta id = Some t ->
is_neutral_cast (typeof e) t = true ->
semax Espec Delta
(fun rho =>
|> ((tc_expr Delta e rho) && P rho))
(Sset id e)
(normal_ret_assert
(fun rho => (EX old:val,
!! (eval_id id rho =  subst id old (eval_expr e) rho) &&
subst id old P rho))).
Lemma semax_cast_set:
forall (Delta: tycontext) (P: assert) id e t,
typeof_temp Delta id = Some t ->
semax Espec Delta
(fun rho =>
|> ((tc_expr Delta (Ecast e t) rho) && P rho))
(Sset id (Ecast e t))
(normal_ret_assert
(fun rho => (EX old:val,
!! (eval_id id rho = subst id old (eval_expr (Ecast e t)) rho) &&
subst id old P rho))).
Lemma eval_cast_Vundef:
forall t1 t2, eval_cast t1 t2 Vundef = Vundef.