Inductive ramif_frame_gen: mpred -> mpred -> Prop :=
| ramif_frame_gen_refl: forall P, ramif_frame_gen P P
| ramif_frame_gen_prop: forall (Pure: Prop) P Q, Pure -> ramif_frame_gen P (imp (prop Pure) Q) -> ramif_frame_gen P Q
| ramif_frame_gen_allp: forall {A: Type} (x: A) P Q, (forall x: A, ramif_frame_gen (P x) (Q x)) -> ramif_frame_gen (allp P) (Q x).
Ltac prove_ramif_frame_gen_rec wit :=
match wit with
| pair ?wit0 ?x =>
prove_ramif_frame_gen_rec wit0;
match goal with
| |- ramif_frame_gen _ ?P => super_pattern P x
end;
apply (ramif_frame_gen_allp x);
clear dependent x;
intros x
| _ =>
match goal with
| |- ramif_frame_gen _ ?P => super_pattern P wit
end;
apply (ramif_frame_gen_allp wit);
clear dependent wit;
intros wit
end.
Ltac prove_ramif_frame_gen wit :=
prove_ramif_frame_gen_rec wit;
apply ramif_frame_gen_refl.
Ltac conj_gen assu :=
match assu with
| pair ?assu0 ?a => let r := conj_gen assu0 in constr:(conj r a)
| _ => constr:(assu)
end.
Ltac prove_ramif_frame_gen_prop assu :=
let H := conj_gen assu in
let Pure := type of H in
apply (ramif_frame_gen_prop Pure _ _ H).

(* Specifications: *)
Lemma ramif_frame_gen_spec: forall P Q, ramif_frame_gen P Q -> P |-- Q.
Lemma unlocalizeQ_triple: forall R_G2 Espec {cs: compspecs} Delta P Q R R_FR R_L1 R_G1 R_L2 F c Post w,
split_FRZ_in_SEP R R_L2 (@FRZR R_L1 R_G1 w :: R_FR) ->
ramif_frame_gen F (wand (fold_right_sepcon R_L2) (fold_right_sepcon R_G2)) ->
(exists (H: (fold_right_sepcon R_G1) |-- sepcon (fold_right_sepcon R_L1) F), w = @Freezer.FRZRw_constr _ _ _ H) ->
(@abbreviate _ (fun _ _ => True) R_L1 R_G1 -> @semax cs Espec Delta (PROPx P (LOCALx Q (SEPx (R_G2 ++ R_FR)))) c Post) ->
@semax cs Espec Delta (PROPx P (LOCALx Q (SEPx R))) c Post.
Lemma unlocalizeQ_derives_canon: forall R_G2 Delta P Q R R_FR R_L1 R_G1 R_L2 F Post w,
split_FRZ_in_SEP R R_L2 (@FRZR R_L1 R_G1 w :: R_FR) ->
ramif_frame_gen F (wand (fold_right_sepcon R_L2) (fold_right_sepcon R_G2)) ->
(exists (H: (fold_right_sepcon R_G1) |-- sepcon (fold_right_sepcon R_L1) F), w = @Freezer.FRZRw_constr _ _ _ H) ->
(@abbreviate _ (fun _ _ => True) R_L1 R_G1 -> local (tc_environ Delta) && PROPx P (LOCALx Q (SEPx (R_G2 ++ R_FR))) |-- Post) ->
local (tc_environ Delta) && PROPx P (LOCALx Q (SEPx R)) |-- Post.
Lemma unlocalizeQ_derives_unlift: forall R_G2 Pre R R_FR R_L1 R_G1 R_L2 F Post w,
construct_fold_right_sepcon Pre R ->
split_FRZ_in_SEP R R_L2 (@FRZR R_L1 R_G1 w :: R_FR) ->
ramif_frame_gen F (wand (fold_right_sepcon R_L2) (fold_right_sepcon R_G2)) ->
(exists (H: (fold_right_sepcon R_G1) |-- sepcon (fold_right_sepcon R_L1) F), w = @Freezer.FRZRw_constr _ _ _ H) ->
(@abbreviate _ (fun _ _ => True) R_L1 R_G1 -> fold_left_sepconx (R_G2 ++ R_FR) |-- Post) ->
Pre |-- Post.