(* The simpl_nat_of_P tactic is a complete hack, needed for compatibility between Coq 8.3/8.4, because the name of the thing to unfold varies between the two versions *)
Ltac simpl_nat_of_P :=
match goal with |- context [nat_of_P ?n] =>
match n with xI _ => idtac | xO _ => idtac | xH => idtac | _ => fail end;
let N := fresh "N" in
set (N:= nat_of_P n);
compute in N;
unfold N; clear N
end.
Ltac grab_indexes_SEP ns :=
rewrite (grab_indexes_SEP ns);
unfold grab_indexes; simpl grab_calc;
unfold grab_indexes', insert;
repeat simpl_nat_of_P; cbv beta iota;
unfold app_alt; fold @app_alt.
Tactic Notation "focus_SEP" constr(a) :=
grab_indexes_SEP (a::nil).
Tactic Notation "focus_SEP" constr(a) constr(b) :=
grab_indexes_SEP (a::b::nil).
Tactic Notation "focus_SEP" constr(a) constr(b) constr(c) :=
grab_indexes_SEP (a::b::c::nil).
Tactic Notation "focus_SEP" constr(a) constr(b) constr(c) constr(d) :=
grab_indexes_SEP (a::b::c::d::nil).
Tactic Notation "focus_SEP" constr(a) constr(b) constr(c) constr(d) constr(e) :=
grab_indexes_SEP (a::b::c::d::e::nil).
Tactic Notation "focus_SEP" constr(a) constr(b) constr(c) constr(d) constr(e) constr(f) :=
grab_indexes_SEP (a::b::c::d::e::f::nil).
Tactic Notation "focus_SEP" constr(a) constr(b) constr(c) constr(d) constr(e) constr(f) constr(g) :=
grab_indexes_SEP (a::b::c::d::e::f::g::nil).
Tactic Notation "focus_SEP" constr(a) constr(b) constr(c) constr(d) constr(e) constr(f) constr(g) constr(h) :=
grab_indexes_SEP (a::b::c::d::e::f::g::h::nil).
Tactic Notation "focus_SEP" constr(a) constr(b) constr(c) constr(d) constr(e) constr(f) constr(g) constr(h) constr(i) :=
grab_indexes_SEP (a::b::c::d::e::f::g::h::i::nil).
Tactic Notation "focus_SEP" constr(a) constr(b) constr(c) constr(d) constr(e) constr(f) constr(g) constr(h) constr(i) constr(j) :=
grab_indexes_SEP (a::b::c::d::e::f::g::h::i::j::nil).
(* TESTING Variables (a b c d e f g h i j : assert). Goal (SEP (a;b;c;d;e;f;g;h;i;j) = SEP (b;d;a;c;e;f;g;h;i;j)). focus_SEP 1 3. auto. Qed. Goal (SEP (a;b;c;d;e;f;g;h;i;j) = SEP (d;b;a;c;e;f;g;h;i;j)). focus_SEP 3 1. auto. Qed.  *)
(* Lemma semax_post0: forall (R': ret_assert) Espec {cs: compspecs} Delta (R: ret_assert) P c, (R' |-- R) -> @semax cs Espec Delta P c R' ->  @semax cs Espec Delta P c R. *)

(* Specifications: *)
Lemma local_unfold: forall P rho, local P rho = !! (P rho).
Hint Rewrite exp_unfold: norm2.