Section nat_algs.
Definition nat_leR: Relation nat := le.
Definition nat_geR: Relation nat := ge.
Instance po_nat_leR: PreOrder (@Krelation _ nat_leR) := Nat.le_preorder.
Instance po_nat_geR: PreOrder (@Krelation _ nat_geR).
Definition indexAlg: @SeparationAlgebra nat equiv_Join.
(* Increasing*)
Instance IndexAlg_increasing:
@IncreasingSeparationAlgebra _ nat_geR equiv_Join.
(* Residual*)
Instance IndexAlg_residual:
@ResidualSeparationAlgebra _ nat_geR equiv_Join.
(* Unital *)
Instance IndexAlg_unital:
@UnitalSeparationAlgebra _ nat_geR equiv_Join.
(* Minimum Algebra *)
Inductive min_Join: nat -> nat -> nat -> Prop:=
| min_j x y z: z <= x -> z <= y -> min_Join x y z.
Definition minAlg: @SeparationAlgebra nat min_Join.
(* upwards-closed *)
Instance minAlg_uSA:
@UpwardsClosedSeparationAlgebra _ nat_geR min_Join.
(* downwards-closed *)
Instance minAlg_dSA:
@DownwardsClosedSeparationAlgebra _ nat_geR min_Join.
(* Increasing *)
Instance minAlg_increasing:
@IncreasingSeparationAlgebra _ nat_geR min_Join.
(*Residual*)
Instance minAlg_residual:
@ResidualSeparationAlgebra _ nat_geR min_Join.
(* Unital *)
Instance minAlg_unital:
@UnitalSeparationAlgebra _ nat_geR min_Join.
(** *Sum Algebra on NAT*)
Inductive sum_Join: nat -> nat -> nat -> Prop:=
|sum_j x y z: x + y = z -> sum_Join x y z.
Definition sumAlg: @SeparationAlgebra _ sum_Join.
(* upwards-closed*)
Instance sumAlg_uSA:
@UpwardsClosedSeparationAlgebra _ nat_geR sum_Join.
(* downwards-closed*)
Instance sumAlg_dSA:
@DownwardsClosedSeparationAlgebra _ nat_geR sum_Join.
(* Unital *)
Instance sumAlg_unital:
@UnitalSeparationAlgebra _ nat_geR sum_Join.
(*Residual*)
Instance sumAlg_residual:
@ResidualSeparationAlgebra _ nat_geR sum_Join.
(** *Minimum Algebra on Positive integers*)
Record natPlus: Type:=
natp { nat_p:> nat;
is_pos: 0 < nat_p}.
Inductive sump_Join: natPlus -> natPlus -> natPlus -> Prop:=
|sump_j (x y z:natPlus): x + y = z -> sump_Join x y z.
Definition lep (n m:natPlus):= n <= m.
Definition natPlus_R: Relation natPlus:= lep.
Definition po_natPlus_R: PreOrder (@Krelation _ natPlus_R) :=
lep_preorder.
Definition sumpAlg: @SeparationAlgebra _ sump_Join.
(* it is NOT upwards-closed*)
Instance sumpAlg_uSA:
@UpwardsClosedSeparationAlgebra _ natPlus_R sump_Join.
(*it is NOT Residual*)
Instance sumpAlg_residual:
@ResidualSeparationAlgebra _ natPlus_R sump_Join.
(* upwards-closed*)
Instance suminvAlg_uSA:
@UpwardsClosedSeparationAlgebra _ nat_leR sum_Join.
(* downwards-closed*)
Instance suminvAlg_dSA:
@DownwardsClosedSeparationAlgebra _ nat_leR sum_Join.
(*Residual*)
Instance suminvAlg_increasing:
@IncreasingSeparationAlgebra _ nat_leR sum_Join.
(*Residual*)
Instance suminvAlg_residual:
@ResidualSeparationAlgebra _ nat_leR sum_Join.
(* Unital *)
Instance suminvAlg_unital:
@UnitalSeparationAlgebra _ nat_leR sum_Join.
End nat_algs.
(***********************************)
(* ALGEBRAS ON RATIONALS           *)
(***********************************)
(*Require Import Coq.Reals.Rdefinitions.*)
(*Q overloads <= !*)
(** *Minimum Algebra on Positive rationals*)
(* Record QPlus: Type:= qp { q_p:> Q; qis_pos: (0 < q_p)}.   Inductive sumqp_Join: QPlus -> QPlus -> QPlus -> Prop:= |sumqp_j (x y z:QPlus): (x + y) = z -> sumqp_Join x y z.  Definition leqp (n m:QPlus):= (n <= m). Lemma leqp_preorder: RelationClasses.PreOrder leqp.  Definition QPlus_kiM: KripkeIntuitionisticModel QPlus:= Build_KripkeIntuitionisticModel _ _ leqp_preorder.  Definition qpAlg: @SeparationAlgebra _ sumqp_Join.  (* it is NOT upwards-closed*)
Instance sumqpAlg_dSA:
@UpwardsClosedSeparationAlgebra _ sumqp_Join QPlus_kiM.
(*it is NOT Residual*)
Instance sumpAlg_residual:
@ResidualSeparationAlgebra _ natPlus_kiM sump_Join.
(*Downwards-closed*)
Instance discHeap_dSA:
@DownwardsClosedSeparationAlgebra Heap discHeap_R Heap_Join.

(*Empty heap is increasing element*)
Lemma discHeap_empty_increasing:
@increasing Heap discHeap_R Heap_Join (fun _ => None).