model.v 2.71 KB
 Robbert Krebbers committed Feb 13, 2016 1 2 3 ``````From algebra Require Export upred. From program_logic Require Export resources. From algebra Require Import cofe_solver. `````` Robbert Krebbers committed Jan 16, 2016 4 `````` `````` Ralf Jung committed Feb 05, 2016 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. *) `````` Robbert Krebbers committed Mar 03, 2016 9 10 11 `````` Module Type iProp_solution_sig. Parameter iPreProp : language → rFunctor → cofeT. `````` Robbert Krebbers committed Mar 06, 2016 12 ``````Definition iGst (Λ : language) (Σ : rFunctor) : cmraT := Σ (iPreProp Λ Σ). `````` Robbert Krebbers committed Mar 03, 2016 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. `````` Robbert Krebbers committed Mar 02, 2016 28 ``````Definition iProp_result (Λ : language) (Σ : rFunctor) : `````` Robbert Krebbers committed Mar 06, 2016 29 `````` solution (uPredCF (resRF Λ laterCF Σ)) := solver.result _. `````` Robbert Krebbers committed Jan 16, 2016 30 `````` `````` Robbert Krebbers committed Mar 02, 2016 31 ``````Definition iPreProp (Λ : language) (Σ : rFunctor) : cofeT := iProp_result Λ Σ. `````` Robbert Krebbers committed Mar 06, 2016 32 ``````Definition iGst (Λ : language) (Σ : rFunctor) : cmraT := Σ (iPreProp Λ Σ). `````` Robbert Krebbers committed Mar 02, 2016 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 Λ Σ). `````` Robbert Krebbers committed Feb 01, 2016 41 42 ``````Definition iProp_fold {Λ Σ} : iPreProp Λ Σ -n> iProp Λ Σ := solution_unfold _. Lemma iProp_fold_unfold {Λ Σ} (P : iProp Λ Σ) : iProp_fold (iProp_unfold P) ≡ P. `````` Robbert Krebbers committed Jan 16, 2016 43 ``````Proof. apply solution_unfold_fold. Qed. `````` Robbert Krebbers committed Feb 01, 2016 44 45 ``````Lemma iProp_unfold_fold {Λ Σ} (P : iPreProp Λ Σ) : iProp_unfold (iProp_fold P) ≡ P. `````` Robbert Krebbers committed Jan 16, 2016 46 ``````Proof. apply solution_fold_unfold. Qed. `````` Robbert Krebbers committed Mar 03, 2016 47 48 ``````End iProp_solution. `````` Robbert Krebbers committed Jan 16, 2016 49 ``````Bind Scope uPred_scope with iProp. `````` Robbert Krebbers committed Jan 16, 2016 50 `````` `````` Robbert Krebbers committed Feb 11, 2016 51 ``````Instance iProp_fold_inj n Λ Σ : Inj (dist n) (dist n) (@iProp_fold Λ Σ). `````` Robbert Krebbers committed Jan 16, 2016 52 ``````Proof. by intros X Y H; rewrite -(iProp_unfold_fold X) H iProp_unfold_fold. Qed. `````` Robbert Krebbers committed Feb 01, 2016 53 ``````Instance iProp_unfold_inj n Λ Σ : `````` Robbert Krebbers committed Feb 11, 2016 54 `````` Inj (dist n) (dist n) (@iProp_unfold Λ Σ). `````` Robbert Krebbers committed Jan 16, 2016 55 ``Proof. by intros X Y H; rewrite -(iProp_fold_unfold X) H iProp_fold_unfold. Qed.``