Local Open Scope kripke_model.
Definition increasing
{worlds: Type}
{R: Relation worlds}
{J: Join worlds}: worlds -> Prop :=
fun m => forall n n', join m n n' -> n <= n'.
Definition increasing'
{worlds: Type}
{R: Relation worlds}
{J: Join worlds}: worlds -> Prop :=
fun m => forall n, m <= n -> increasing n.
Class IncreasingSeparationAlgebra
(worlds: Type)
{R: Relation worlds}
{J: Join worlds }: Type :=
{
all_increasing: forall x: worlds, increasing x
}.
(* (* -Legacy definition-            * * Garbage Collected algebra      * * Is equivalent to increasing *)
Class GarbageCollectSeparationAlgebra(worlds: Type) {kiM: KripkeIntuitionisticModel worlds} {J: Join worlds }: Type :=
{
join_has_order1: forall (m1 m2 m: worlds), join m1 m2 m -> m1 <= m
}.
*)
Definition residue
{worlds: Type}
{R: Relation worlds}
{J: Join worlds}
(m n: worlds): Prop :=
exists n', join n n' m /\ m <= n'.
Class ResidualSeparationAlgebra
(worlds: Type)
{R: Relation worlds}
{J: Join worlds}: Type :=
{
residue_exists: forall n: worlds, exists m, residue n m;
}.
Class UnitalSeparationAlgebra
(worlds: Type)
{R: Relation worlds}
{J: Join worlds}: Type :=
{
incr_exists: forall n: worlds, exists m, residue n m /\ increasing m
}.
Class UnitalSeparationAlgebra'
(worlds: Type)
{R: Relation worlds}
{J: Join worlds}: Type :=
{
incr'_exists: forall n: worlds, exists m, residue n m /\ increasing' m
}.

(* A unital separation algebra is residual. *)
Lemma unital_is_residual
{worlds: Type}
{R: Relation worlds}
{po_R: PreOrder Krelation}
{J: Join worlds}:
UnitalSeparationAlgebra worlds ->
ResidualSeparationAlgebra worlds.