Class IncreasingSeparationAlgebra
      (worlds: Type)
      {R: Relation worlds}
      {J: Join worlds }: Type :=
{
  all_increasing: forall x: worlds, increasing x
}.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
  }.
Lemma Increasing2GarbageCollect:
  forall
    (worlds: Type) {kiM: KripkeIntuitionisticModel worlds}
    {J: Join worlds }{SA: SeparationAlgebra worlds},
    GarbageCollectSeparationAlgebra worlds ->
    IncreasingSeparationAlgebra worlds.
Proof.
  intros.
  constructor; intros; hnf; intros.
  eapply join_has_order1.
  eapply join_comm. eassumption.
Qed.

Lemma GarbageCollect2Increasing:
  forall (worlds: Type) {kiM: KripkeIntuitionisticModel worlds}
    {J: Join worlds }{SA: SeparationAlgebra worlds},
    IncreasingSeparationAlgebra worlds ->
    GarbageCollectSeparationAlgebra worlds.
Proof.
  intros.
  constructor; intros.
  pose (all_increasing m2).
  apply i; apply join_comm; assumption.
Qed.
*)
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 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
}.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
}.

(* Specifications: *)
Lemma unital_is_residual {worlds: Type} {R: Relation worlds} {po_R: PreOrder Krelation} {J: Join worlds}: UnitalSeparationAlgebra worlds -> ResidualSeparationAlgebra worlds.
Lemma incr_unital_iff_residual {worlds: Type} {R: Relation worlds} {po_R: PreOrder Krelation} {J: Join worlds}: IncreasingSeparationAlgebra worlds -> UnitalSeparationAlgebra worlds <-> ResidualSeparationAlgebra worlds.