End RAMIF_Q.
Ltac formalize :=
match goal with
| |- @derives ?Pred _ ?g (?l * @allp ?Pred _ ?T ?Func) =>
let g' := fresh "g'" in evar (g': T -> Pred);
let l' := fresh "l'" in evar (l': T -> Pred);
let x := fresh "x" in
let H := fresh "H" in
assert (Func = l' -* g') as H;
[
extensionality x; cbv beta;
match goal with
| |- ?L' -* exp ?G' = _ =>
super_pattern L' x; super_pattern_in_func G' x
| |- ?L' -* ?G' = _ =>
super_pattern L' x; super_pattern G' x
end;
match goal with
| |- ?L' _ -* exp (fun a => ?G' a _) = _ =>
instantiate (1 := L') in (Value of l');
instantiate (1 := exp G') in (Value of g')
| |- ?L' _ -* ?G' _ = _ =>
instantiate (1 := L') in (Value of l');
instantiate (1 := G') in (Value of g')
end;
subst g' l';
reflexivity
| subst g' l'; rewrite H; clear H]
end.
End RAMIF_Q.
Module RAMIF_Q'.
Section RAMIF_Q'.
Context {A : Type}.
Context {ND : NatDed A}.
Context {SL : SepLog A}.
Context {CoSL: CorableSepLog A}.

Lemma split: forall {B} g1 g2 l1 l2 (p g1' g2' l1' l2': B -> A),
(forall x: B, corable (p x)) ->
g1 |-- l1 * allp (p --> (l1' -* g1')) ->
g2 |-- l2 * allp (p --> (l2' -* g2')) ->
g1 * g2 |-- (l1 * l2) * allp (p --> (l1' * l2' -* g1' * g2')).