(***********************************)
(* Separation Algebra Generators   *)
(***********************************)
Section trivialSA.
Context {worlds: Type}.
Definition trivial_Join: Join worlds:=  (fun a b c => False).
Definition trivial_SA: @SeparationAlgebra worlds trivial_Join.
(* Trivial algebra is upwards closed *)
(* Trivial is NOT downwards closed *)
Definition trivial_uSA {R: Relation worlds}:
@UpwardsClosedSeparationAlgebra worlds R (trivial_Join).
(*Increasing*)
Definition trivial_incrSA: @IncreasingSeparationAlgebra
worlds eq trivial_Join.
(*Trivial is NOT necessarily unital*)
(*Trivial is NOT necessarily residual*)
End trivialSA.
Section unitSA.
Definition unit_Join: Join unit:=  (fun _ _ _ => True).
Definition unit_SA: @SeparationAlgebra unit unit_Join.
(* Unit algebra is upwards closed *)
Definition unit_uSA:
@UpwardsClosedSeparationAlgebra unit eq unit_Join.
(* Unit algebra is downwards closed *)
Definition unit_dSA:
@DownwardsClosedSeparationAlgebra unit eq unit_Join.
(*Increasing*)
Instance unit_incrSA:
@IncreasingSeparationAlgebra unit eq unit_Join.
Instance unit_residual:
@ResidualSeparationAlgebra unit eq unit_Join.
Definition unit_unital:
@UnitalSeparationAlgebra unit eq unit_Join.
End unitSA.
Section equivSA.
Context {worlds: Type}.
Definition equiv_Join: Join worlds:=  (fun a b c => a = c /\ b = c).
Definition equiv_SA: @SeparationAlgebra worlds equiv_Join.
(* Identity algebra is upwards closed *)
(* Identity is NOT downwards closed *)
Definition identity_uSA {R: Relation worlds}:
@UpwardsClosedSeparationAlgebra worlds R equiv_Join.
Definition equiv_incrSA: @IncreasingSeparationAlgebra
worlds eq equiv_Join.
Definition ikiM_uSA {R: Relation worlds} {po_R: PreOrder Krelation} {ikiM: IdentityKripkeIntuitionisticModel worlds} {J: Join worlds}: UpwardsClosedSeparationAlgebra worlds.
Definition ikiM_dSA {R: Relation worlds} {po_R: PreOrder Krelation} {ikiM: IdentityKripkeIntuitionisticModel worlds} {J: Join worlds}: DownwardsClosedSeparationAlgebra worlds.
(*Identity is NOT necessarily increasing*)
(*Identity is NOT necessarily unital*)
(*Identity is NOT necessarily residual*)
End equivSA.
Section optionSA.
Context (worlds: Type).
Inductive option_join {J: Join worlds}: option worlds -> option worlds -> option worlds -> Prop :=
| None_None_join: option_join None None None
| None_Some_join: forall a, option_join None (Some a) (Some a)
| Some_None_join: forall a, option_join (Some a) None (Some a)
| Some_Some_join: forall a b c, join a b c -> option_join (Some a) (Some b) (Some c).
Definition option_Join {SA: Join worlds}: Join (option worlds):=
(@option_join SA).
Definition option_SA
{J: Join worlds}
{SA: SeparationAlgebra worlds}:
@SeparationAlgebra (option worlds) (option_Join).

(* Specifications: *)
(* Ordered option Upwards closed *)
Lemma option_ord_uSA
{R: Relation worlds}
{J: Join worlds}
(uSA: UpwardsClosedSeparationAlgebra worlds):
@UpwardsClosedSeparationAlgebra (option worlds) (option01_relation Krelation) option_Join.
(* Downwards closed IF the algebra is increasing*)
Lemma option_ord_dSA
{R: Relation worlds}
{po_R: PreOrder Krelation}
{J: Join worlds}
{SA: SeparationAlgebra worlds}
(dSA: DownwardsClosedSeparationAlgebra worlds)
{incrSA: IncreasingSeparationAlgebra worlds}:
@DownwardsClosedSeparationAlgebra (option worlds) (option01_relation Krelation) option_Join.
Lemma option_ord_incr_None
{R: Relation worlds}
{po_R: PreOrder Krelation}
{J: Join worlds}
{SA: SeparationAlgebra worlds}:
@increasing (option worlds) (option01_relation Krelation) option_Join None.
Lemma option_ord_res_None
{R: Relation worlds}
{po_R: PreOrder Krelation}
{J: Join worlds}
{SA: SeparationAlgebra worlds}:
forall n, @residue (option worlds) (option01_relation Krelation) option_Join n None.
Lemma option_ord_USA
{R: Relation worlds}
{po_R: PreOrder Krelation}
{J: Join worlds}
{SA: SeparationAlgebra worlds}:
@UnitalSeparationAlgebra (option worlds) (option01_relation Krelation) option_Join.
(* Disjoint option Upwards closed*)
Lemma option_disj_uSA
{R: Relation worlds}
{J: Join worlds}
(uSA: UpwardsClosedSeparationAlgebra worlds):
@UpwardsClosedSeparationAlgebra (option worlds) (option00_relation Krelation) option_Join.
(* Disjointed option Downwards *)
Lemma option_disj_dSA
{R: Relation worlds}
{J: Join worlds}
{SA: SeparationAlgebra worlds}
(dSA: DownwardsClosedSeparationAlgebra worlds):
@DownwardsClosedSeparationAlgebra (option worlds) (option00_relation Krelation) option_Join.
Lemma option_disj_incr_None
{R: Relation worlds}
{po_R: PreOrder Krelation}
{J: Join worlds}
{SA: SeparationAlgebra worlds}:
@increasing (option worlds) (option00_relation Krelation) option_Join None.
Lemma option_disj_res_None
{R: Relation worlds}
{po_R: PreOrder Krelation}
{J: Join worlds}
{SA: SeparationAlgebra worlds}:
forall n, @residue (option worlds) (option00_relation Krelation) option_Join n None.
Lemma option_disj_USA
{R: Relation worlds}
{po_R: PreOrder Krelation}
{J: Join worlds}
{SA: SeparationAlgebra worlds}:
@UnitalSeparationAlgebra (option worlds) (option00_relation Krelation) option_Join.
Lemma option_disj_USA'
{R: Relation worlds}
{po_R: PreOrder Krelation}
{J: Join worlds}
{SA: SeparationAlgebra worlds}:
@UnitalSeparationAlgebra' (option worlds) (option00_relation Krelation) option_Join.