Local Open Scope logic_base.
Local Open Scope syntax.
Class SeparationLogic
(L: Language)
{minL: MinimunLanguage L}
{pL: PropositionalLanguage L}
{sL: SeparationLanguage L}
(Gamma: ProofTheory L)
{minAX: MinimunAxiomatization L Gamma}
{ipGamma: IntuitionisticPropositionalLogic L Gamma} := {
sepcon_comm_impp: forall x y, |-- x * y --> y * x;
sepcon_assoc: forall x y z, |-- x * (y * z) <--> (x * y) * z;
wand_sepcon_adjoint: forall x y z, |-- x * y --> z <-> |-- x --> (y -* z)
}.
Class EmpSeparationLogic
(L: Language)
{minL: MinimunLanguage L}
{pL: PropositionalLanguage L}
{sL: SeparationLanguage L}
{s'L: SeparationEmpLanguage L}
(Gamma: ProofTheory L)
{minAX: MinimunAxiomatization L Gamma}
{ipGamma: IntuitionisticPropositionalLogic L Gamma}
{sGamma: SeparationLogic L Gamma} := {
sepcon_emp: forall x, |-- x * emp <--> x
}.
Class ExtSeparationLogic
(L: Language)
{minL: MinimunLanguage L}
{pL: PropositionalLanguage L}
{sL: SeparationLanguage L}
(Gamma: ProofTheory L)
{minAX: MinimunAxiomatization L Gamma}
{ipGamma: IntuitionisticPropositionalLogic L Gamma}
{sGamma: SeparationLogic L Gamma} := {
sepcon_ext: forall x, |-- x --> x * TT
}.
Class NonsplitEmpSeparationLogic
(L: Language)
{minL: MinimunLanguage L}
{pL: PropositionalLanguage L}
{sL: SeparationLanguage L}
{s'L: SeparationEmpLanguage L}
(Gamma: ProofTheory L)
{minAX: MinimunAxiomatization L Gamma}
{ipGamma: IntuitionisticPropositionalLogic L Gamma}
{sGamma: SeparationLogic L Gamma}
{eGamma: EmpSeparationLogic L Gamma} := {
emp_sepcon_truep_elim: forall x, |-- x * TT && emp --> x
}.
Class DupEmpSeparationLogic
(L: Language)
{minL: MinimunLanguage L}
{pL: PropositionalLanguage L}
{sL: SeparationLanguage L}
{s'L: SeparationEmpLanguage L}
(Gamma: ProofTheory L)
{minAX: MinimunAxiomatization L Gamma}
{ipGamma: IntuitionisticPropositionalLogic L Gamma}
{sGamma: SeparationLogic L Gamma}
{eGamma: EmpSeparationLogic L Gamma} := {
emp_dup: forall x, |-- x && emp --> x * x
}.
Class MallocFreeSeparationLogic
(L: Language)
{minL: MinimunLanguage L}
{pL: PropositionalLanguage L}
{sL: SeparationLanguage L}
{s'L: SeparationEmpLanguage L}
(Gamma: ProofTheory L)
{minAX: MinimunAxiomatization L Gamma}
{ipGamma: IntuitionisticPropositionalLogic L Gamma}
{sGamma: SeparationLogic L Gamma}
{eGamma: EmpSeparationLogic L Gamma} := {
MallocFreeSeparationLogic_NonsplitEmpSeparationLogic :>
NonsplitEmpSeparationLogic L Gamma;
MallocFreeSeparationLogic_DupEmpSeparationLogic :>
DupEmpSeparationLogic L Gamma
}.
Class GarbageCollectSeparationLogic
(L: Language)
{minL: MinimunLanguage L}
{pL: PropositionalLanguage L}
{sL: SeparationLanguage L}
(Gamma: ProofTheory L)
{minAX: MinimunAxiomatization L Gamma}
{ipGamma: IntuitionisticPropositionalLogic L Gamma}
{sGamma: SeparationLogic L Gamma} := {
sepcon_elim1: forall x y, |-- x * y --> x
}.
Section DerivableRules.
Context {L: Language}
{minL: MinimunLanguage L}
{pL: PropositionalLanguage L}
{sL: SeparationLanguage L}
{Gamma: ProofTheory L}
{minAX: MinimunAxiomatization L Gamma}
{ipGamma: IntuitionisticPropositionalLogic L Gamma}
{sGamma: SeparationLogic L Gamma}.

(* Specifications: *)
Lemma wand_sepcon_Adj: Adjointness L Gamma sepcon wand.
Lemma sepcon_orp_distr_l: forall (x y z: expr),
|-- (x || y) * z <--> x * z || y * z.
Lemma falsep_sepcon: forall (x: expr),
|-- FF * x <--> FF.
Lemma provable_wand_sepcon_modus_ponens1: forall (x y: expr),
|-- (x -* y) * x --> y.
Lemma wand_andp: forall x y z: expr,
|-- x -* y && z <--> (x -* y) && (x -* z).
Lemma sepcon_Comm: Commutativity L Gamma sepcon.
Lemma sepcon_comm: forall (x y: expr),
|-- x * y <--> y * x.
Lemma sepcon_orp_distr_r: forall (x y z: expr),
|-- x * (y || z) <--> x * y || x * z.
Lemma sepcon_falsep: forall (x: expr),
|-- x * FF <--> FF.
Lemma provable_wand_sepcon_modus_ponens2: forall (x y: expr),
|-- x * (x -* y) --> y.
Lemma wand_mono: forall x1 x2 y1 y2, |-- x2 --> x1 -> |-- y1 --> y2 -> |-- (x1 -* y1) --> (x2 -* y2).
Lemma orp_wand: forall x y z: expr,
|-- (x || y) -* z <--> (x -* z) && (y -* z).
Lemma sepcon_Mono: Monotonicity L Gamma sepcon.
Lemma sepcon_mono: forall x1 x2 y1 y2, |-- x1 --> x2 -> |-- y1 --> y2 -> |-- (x1 * y1) --> (x2 * y2).
Lemma sepcon_Assoc: Associativity L Gamma sepcon.
Lemma sepcon_LU {s'L: SeparationEmpLanguage L} {eGamma: EmpSeparationLogic L Gamma}: LeftUnit L Gamma emp sepcon.
Lemma sepcon_RU {s'L: SeparationEmpLanguage L} {eGamma: EmpSeparationLogic L Gamma}: RightUnit L Gamma emp sepcon.
Lemma sepcon_elim2: forall {gcsGamma: GarbageCollectSeparationLogic L Gamma} (x y: expr),
|-- x * y --> y.
Lemma emp_sepcon_elim1: forall {s'L: SeparationEmpLanguage L} {eGamma: EmpSeparationLogic L Gamma} {nssGamma: NonsplitEmpSeparationLogic L Gamma} x y,
|-- x * y && emp --> x.
Lemma emp_sepcon_elim2: forall {s'L: SeparationEmpLanguage L} {eGamma: EmpSeparationLogic L Gamma} {nssGamma: NonsplitEmpSeparationLogic L Gamma} x y,
|-- x * y && emp --> y.