model.v 2.71 KB
Newer Older
1 2 3
From algebra Require Export upred.
From program_logic Require Export resources.
From algebra Require Import cofe_solver.
4

Ralf Jung's avatar
Ralf Jung committed
5 6 7 8
(* The Iris program logic is parametrized by a functor from the category of
COFEs to the category of CMRAs, which is instantiated with [laterC iProp]. The
[laterC iProp] can be used to construct impredicate CMRAs, such as the stored
propositions using the agreement CMRA. *)
9 10 11

Module Type iProp_solution_sig.
Parameter iPreProp : language  rFunctor  cofeT.
12
Definition iGst (Λ : language) (Σ : rFunctor) : cmraT := Σ (iPreProp Λ Σ).
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Definition iRes Λ Σ := res Λ (laterC (iPreProp Λ Σ)) (iGst Λ Σ).
Definition iResR Λ Σ := resR Λ (laterC (iPreProp Λ Σ)) (iGst Λ Σ).
Definition iWld Λ Σ := gmap positive (agree (laterC (iPreProp Λ Σ))).
Definition iPst Λ := excl (state Λ).
Definition iProp (Λ : language) (Σ : rFunctor) : cofeT := uPredC (iResR Λ Σ).

Parameter iProp_unfold:  {Λ Σ}, iProp Λ Σ -n> iPreProp Λ Σ.
Parameter iProp_fold:  {Λ Σ}, iPreProp Λ Σ -n> iProp Λ Σ.
Parameter iProp_fold_unfold:  {Λ Σ} (P : iProp Λ Σ),
  iProp_fold (iProp_unfold P)  P.
Parameter iProp_unfold_fold:  {Λ Σ} (P : iPreProp Λ Σ),
  iProp_unfold (iProp_fold P)  P.
End iProp_solution_sig.

Module Export iProp_solution : iProp_solution_sig.
28
Definition iProp_result (Λ : language) (Σ : rFunctor) :
29
  solution (uPredCF (resRF Λ laterCF Σ)) := solver.result _.
30

31
Definition iPreProp (Λ : language) (Σ : rFunctor) : cofeT := iProp_result Λ Σ.
32
Definition iGst (Λ : language) (Σ : rFunctor) : cmraT := Σ (iPreProp Λ Σ).
33 34 35 36 37 38 39 40
Definition iRes Λ Σ := res Λ (laterC (iPreProp Λ Σ)) (iGst Λ Σ).
Definition iResR Λ Σ := resR Λ (laterC (iPreProp Λ Σ)) (iGst Λ Σ).
Definition iWld Λ Σ := gmap positive (agree (laterC (iPreProp Λ Σ))).
Definition iPst Λ := excl (state Λ).

Definition iProp (Λ : language) (Σ : rFunctor) : cofeT := uPredC (iResR Λ Σ).
Definition iProp_unfold {Λ Σ} : iProp Λ Σ -n> iPreProp Λ Σ :=
  solution_fold (iProp_result Λ Σ).
41 42
Definition iProp_fold {Λ Σ} : iPreProp Λ Σ -n> iProp Λ Σ := solution_unfold _.
Lemma iProp_fold_unfold {Λ Σ} (P : iProp Λ Σ) : iProp_fold (iProp_unfold P)  P.
43
Proof. apply solution_unfold_fold. Qed.
44 45
Lemma iProp_unfold_fold {Λ Σ} (P : iPreProp Λ Σ) :
  iProp_unfold (iProp_fold P)  P.
46
Proof. apply solution_fold_unfold. Qed.
47 48
End iProp_solution.

49
Bind Scope uPred_scope with iProp.
50

51
Instance iProp_fold_inj n Λ Σ : Inj (dist n) (dist n) (@iProp_fold Λ Σ).
52
Proof. by intros X Y H; rewrite -(iProp_unfold_fold X) H iProp_unfold_fold. Qed.
53
Instance iProp_unfold_inj n Λ Σ :
54
  Inj (dist n) (dist n) (@iProp_unfold Λ Σ).
55
Proof. by intros X Y H; rewrite -(iProp_fold_unfold X) H iProp_fold_unfold. Qed.