- hnf; intros.
hnf; reflexivity.
- hnf; intros.
hnf in H, H0.
hnf; transitivity y; auto.
Qed.
Instance THeap_R': Relation THeap' := THeap_order'.
Instance po_THeap_R': PreOrder (@Krelation _ THeap_R').
Instance THeap_dSA:
@DownwardsClosedSeparationAlgebra THeap THeap_R THeap_Join.
(* Increasing *)
Instance THeap_increasingSA':
@IncreasingSeparationAlgebra _ THeap_R' THeap_Join'.
Instance THeap_increasingSA:
@IncreasingSeparationAlgebra _ THeap_R THeap_Join.
(*Residual*)
Instance THeap_residualSA':
@ResidualSeparationAlgebra _ THeap_R' THeap_Join'.
Instance THeap_residualSA:
@ResidualSeparationAlgebra _ THeap_R THeap_Join.
(*Unital*)
Instance THeap_UnitalSA':
@UnitalSeparationAlgebra _ THeap_R' THeap_Join'.
Instance THeap_UnitalSA:
@UnitalSeparationAlgebra _ THeap_R THeap_Join.
End typed_heaps.
(***********************************)
(* Step-Index                      *)
(***********************************)
Section step_index.
Definition StepIndex_R (worlds: Type) {R: Relation worlds}:
Relation (nat * worlds) :=
@RelProd _ _ nat_geR R.
Definition po_StepIndex_R (worlds: Type) {R: Relation worlds} {po_R: PreOrder (@Krelation _ R)}:
PreOrder (@Krelation _ (StepIndex_R worlds)):=
@RelProd_Preorder _ _ _ _ po_nat_geR po_R.
Definition StepIndex_Join (worlds: Type) {J: Join worlds}: Join (nat * worlds) :=
@prod_Join _ _ equiv_Join J.
Definition StepIndex_SA
(worlds: Type)
{J: Join worlds}
{SA: SeparationAlgebra worlds}:
@SeparationAlgebra (nat * worlds)
(StepIndex_Join worlds) := @prod_SA _ _ _ _ equiv_SA SA.
Definition StepIndex_uSA (worlds: Type) {R: Relation worlds}
{J: Join worlds} {uSA: UpwardsClosedSeparationAlgebra worlds}:
@UpwardsClosedSeparationAlgebra (nat * worlds) (StepIndex_R worlds) (StepIndex_Join worlds) :=
@prod_uSA _ _ _ _  _ _ (@identity_uSA _ nat_geR) uSA.
Definition StepIndex_Increasing
(worlds: Type) {R: Relation worlds}
{J: Join worlds} {incrSA: IncreasingSeparationAlgebra worlds}:
@IncreasingSeparationAlgebra (nat * worlds)
(StepIndex_R worlds)
(StepIndex_Join worlds) :=
@prod_incrSA _ _ _ _ _ _ IndexAlg_increasing incrSA.
Definition StepIndex_Unital
(worlds: Type) {R: Relation worlds}
{J: Join worlds} {USA: UnitalSeparationAlgebra worlds}:
@UnitalSeparationAlgebra (nat * worlds)
(StepIndex_R worlds)
(StepIndex_Join worlds) :=
@prod_unitalSA _ _ _  _ _ _ IndexAlg_unital USA.
Definition StepIndex_Residual
(worlds: Type) {R: Relation worlds}
{J: Join worlds} {rSA: ResidualSeparationAlgebra worlds}:
@ResidualSeparationAlgebra (nat * worlds)
(StepIndex_R worlds)
(StepIndex_Join worlds) :=
@prod_residualSA _ _ _  _ _ _ IndexAlg_residual rSA.
(** *step-indexed HEAPS*)
Context (addr val: Type).
Notation heap:= (Heap addr val).
Instance heap_jn: Join heap:= (Heap_Join addr val).
Instance SIheap_Join: Join (nat * heap) := StepIndex_Join heap.
(** *Monotonic, step-indexed heap *)
Definition monSIheap_R := @StepIndex_R heap (monHeap_R addr val).
Definition po_monSIheap_R := @po_StepIndex_R heap _ (po_monHeap_R addr val).
(*Upwards-closed *)
Instance monSIheap_uSA:
@UpwardsClosedSeparationAlgebra _ monSIheap_R SIheap_Join.
(* NOT Downwards-closed *)
(* Increasing *)
Instance monSIheap_increasing:
@IncreasingSeparationAlgebra _ monSIheap_R SIheap_Join.
(*Unital *)
Instance monSIheap_unital:
@UnitalSeparationAlgebra _ monSIheap_R SIheap_Join.
(*Residual *)
Instance monSIheap_residual:
@ResidualSeparationAlgebra _ monSIheap_R SIheap_Join.
(** *Discrete, step-indexed heap *)
Definition discSIheap_R:= @StepIndex_R heap (discHeap_R addr val).
Definition po_discSIheap_R:= @po_StepIndex_R heap _ (po_discHeap_R addr val).
(*Upwards-closed *)
Instance discSIheap_uSA:
@UpwardsClosedSeparationAlgebra _ discSIheap_R SIheap_Join.
(* NOT Downwards-closed *)
(* NOT Decreasing *)
(*Unital *)
Instance discSIheap_unital:
@UnitalSeparationAlgebra _ discSIheap_R SIheap_Join.
(*Residual *)
Instance discSIheap_residual:
@ResidualSeparationAlgebra _ discSIheap_R SIheap_Join.
End step_index.
(***********************************)
(* ALGEBRAS ON NATURALS            *)
(***********************************)
Section Prop_alg.
Instance Prop_Join: Join Prop := fun P Q R => (P \/ Q <-> R) /\ (P -> Q -> False).
Instance discProp_R: Relation Prop := fun P Q => P <-> Q.
Instance Prop_SA: SeparationAlgebra Prop.
Instance po_discProp_R: PreOrder Krelation.
Instance discProp_ikiM: IdentityKripkeIntuitionisticModel Prop.
Instance discProp_uSA:
@UpwardsClosedSeparationAlgebra Prop discProp_R Prop_Join.
Instance discProp_dSA:
@DownwardsClosedSeparationAlgebra Prop discProp_R Prop_Join.
Instance discProp_unitSA:
@UnitalSeparationAlgebra Prop discProp_R Prop_Join.
End Prop_alg.
Section pred_alg.
Context (A : Type).
Definition Pred: Type := A -> Prop.
Instance Pred_Join: Join Pred :=
@fun_Join _ _ Prop_Join.
Instance Pred_SA: SeparationAlgebra Pred :=
@fun_SA _ _ _ Prop_SA.
Instance discPred_R: Relation Pred := pointwise_relation _ discProp_R.
Instance po_discPred_R: PreOrder Krelation := pointwise_preorder _ _ po_discProp_R.
Instance discPred_uSA: @UpwardsClosedSeparationAlgebra Pred discPred_R Pred_Join :=
fun_uSA _ _ discProp_uSA.
Instance discPred_dSA: @DownwardsClosedSeparationAlgebra Pred discPred_R Pred_Join :=
fun_dSA _ _ discProp_dSA.
Instance discPred_unital: @UnitalSeparationAlgebra Pred discPred_R Pred_Join :=
fun_unitSA _ _ discProp_unitSA.
End pred_alg.
(***********************************)
(* Resource Bounds                 *)
(***********************************)
(* (** * Discrete heap *)
Instance discHeap_kiM: KripkeIntuitionisticModel Heap :=
identity_kiM.
Program Instance discHeap_ikiM: IdentityKripkeIntuitionisticModel Heap.
(*Upwards-closed*)
Instance discHeap_dSA:
@UpwardsClosedSeparationAlgebra Heap Heap_Join discHeap_kiM.
(*Downwards-closed*)
Instance discHeap_uSA:
@DownwardsClosedSeparationAlgebra Heap Heap_Join discHeap_kiM.

(*Empty heap is decreasing element*)
Lemma discHeap_empty_decreasing:
@nonpositive Heap discHeap_kiM Heap_Join (fun _ => None).