Tactic Notation "replace_SEP" constr(n) constr(R) :=
first [apply (replace_SEP' (nat_of_Z n) R) | apply (replace_SEP'' (nat_of_Z n) R)];
unfold my_nth,replace_nth; simpl nat_of_Z;
repeat simpl_nat_of_P; cbv beta iota; cbv beta iota.
Tactic Notation "replace_SEP" constr(n) constr(R) "by" tactic1(t):=
first [apply (replace_SEP' (nat_of_Z n) R) | apply (replace_SEP'' (nat_of_Z n) R)];
unfold my_nth,replace_nth; simpl nat_of_Z;
repeat simpl_nat_of_P; cbv beta iota; cbv beta iota; [ now t | ].

Lemma replace_SEP'_bupd:
forall n R' Espec {cs: compspecs} Delta P Q Rs c Post,
ENTAIL Delta, PROPx P (LOCALx Q (SEPx (my_nth n Rs TT ::  nil))) |-- `(|==> R') ->
@semax cs Espec Delta (PROPx P (LOCALx Q (SEPx (replace_nth n Rs R')))) c Post ->
@semax cs Espec Delta (PROPx P (LOCALx Q (SEPx Rs))) c Post.