(***************************************  Load/store lemmas about mapsto: semax_load_nth_ram. semax_cast_load_nth_ram. semax_store_nth_ram.  ***************************************)

Lemma semax_store_nth_ram:
forall {Espec: OracleKind} {cs: compspecs} n Delta P Q R e1 e2 Pre Post p v sh t1,
typeof e1 = t1 ->
ENTAIL Delta, PROPx P (LOCALx Q (SEPx R)) |--
local (`(eq p) (eval_lvalue e1)) ->
ENTAIL Delta, PROPx P (LOCALx Q (SEPx R)) |--
local (`(eq v) (eval_expr (Ecast e2 t1))) ->
nth_error R n = Some Pre ->
writable_share sh ->
Pre |-- mapsto_ sh t1 p * (mapsto sh t1 p v -* Post) ->
ENTAIL Delta, PROPx P (LOCALx Q (SEPx R)) |--
(tc_lvalue Delta e1) && (tc_expr Delta (Ecast e2 t1)) ->
semax Delta
(|> PROPx P (LOCALx Q (SEPx R)))
(Sassign e1 e2)
(normal_ret_assert
(PROPx P (LOCALx Q (SEPx (replace_nth n R Post))))).