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}.

Lemma sepcon_orp_distr_r: forall (x y z: expr),
|-- x * (y || z) <--> x * y || x * z.