Local Open Scope logic.
Require Export mc_reify.reify.
Require Export mc_reify.bool_funcs.
Require Export MirrorCore.RTac.Repeat.
Require Export MirrorCore.RTac.Try.
Require Export MirrorCore.RTac.First.
Require Export mc_reify.funcs.
Require Export mc_reify.reflexivity_tacs.
(************************************************  Lemmas for rtac version of hoist_later_in_pre  ************************************************)
Fixpoint rstrip_1_later_sep (R: expr typ func) : expr typ func :=
match R with
| Inj (inr (Data (fnil tympred))) => Inj (inr (Data (fnil tympred)))
| App (App (Inj (inr (Data (fcons tympred)))) hd) tl =>
match hd with
| App (Inj (inr (Smx flater))) hd0 => App (App (Inj (inr (Data (fcons tympred)))) hd0) (rstrip_1_later_sep tl)
| _ => App (App (Inj (inr (Data (fcons tympred)))) hd) (rstrip_1_later_sep tl)
end
| _ => R
end.

(* Specifications: *)
Lemma SEPx_map_liftx: forall R, SEPx (map liftx R) = liftx (fold_right sepcon emp R).
Lemma hoist_later_in_pre_aux:
forall temp var ret gt s
gs P T1 T2 R R' Post,
forall {Espec: OracleKind},
fold_right sepcon emp R |-- |> (fold_right sepcon emp R') ->
semax (mk_tycontext temp var ret gt gs) (|> (assertD P (localD T1 T2) R')) s (normal_ret_assert Post) ->
semax (mk_tycontext temp var ret gt gs) (assertD P (localD T1 T2) R) s (normal_ret_assert Post).
Lemma fold_right_sepcon_later_derives: forall P P' Q Q' R,
P |-- |> P' ->
fold_right sepcon emp Q |-- |> (fold_right sepcon emp Q') ->
(fold_right sepcon emp (P' :: Q')) = R ->
fold_right sepcon emp (P :: Q) |-- |> R.