Skip to content
Snippets Groups Projects
Commit 19cca411 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Owning a monoid element.

parent d6456080
No related branches found
No related tags found
No related merge requests found
...@@ -137,6 +137,17 @@ Next Obligation. ...@@ -137,6 +137,17 @@ Next Obligation.
auto using ra_unit_preserving, cmra_unit_valid. auto using ra_unit_preserving, cmra_unit_valid.
Qed. Qed.
Program Definition iprop_own {A : cmraT} (a : A) : iProp A :=
{| iprop_holds n x := a', x ={n}= a a' |}.
Next Obligation. by intros A a x1 x2 n [a' Hx] ?; exists a'; rewrite <-Hx. Qed.
Next Obligation.
intros A a x1 x n1 n2; rewrite ra_included_spec; intros [x2 Hx] ?? [a' Hx1].
exists (a' x2). by rewrite (associative op), <-(dist_le _ _ _ _ Hx1), Hx.
Qed.
Program Definition iprop_valid {A : cmraT} (a : A) : iProp A :=
{| iprop_holds n x := validN n a |}.
Solve Obligations with naive_solver eauto 2 using cmra_valid_le.
Definition iprop_fixpoint {A} (P : iProp A iProp A) Definition iprop_fixpoint {A} (P : iProp A iProp A)
`{!Contractive P} : iProp A := fixpoint P (iprop_const True). `{!Contractive P} : iProp A := fixpoint P (iprop_const True).
...@@ -402,9 +413,24 @@ Proof. ...@@ -402,9 +413,24 @@ Proof.
by rewrite ra_unit_l, ra_unit_idempotent. by rewrite ra_unit_l, ra_unit_idempotent.
Qed. Qed.
(* Own *)
Lemma iprop_own_op (a1 a2 : A) :
iprop_own (a1 a2) (iprop_own a1 iprop_own a2)%I.
Proof.
intros x n ?; split.
* intros [z ?]; exists a1, (a2 z); split; [by rewrite (associative op)|].
split. by exists (unit a1); rewrite ra_unit_r. by exists z.
* intros (y1&y2&Hx&[z1 Hy1]&[z2 Hy2]); exists (z1 z2).
rewrite (associative op), <-(commutative op z1), <-!(associative op), <-Hy2.
by rewrite (associative op), (commutative op z1), <-Hy1.
Qed.
Lemma iprop_own_valid (a : A) : iprop_own a iprop_valid a.
Proof.
intros x n Hv [a' Hx]; simpl; rewrite Hx in Hv; eauto using cmra_valid_op_l.
Qed.
(* Fix *) (* Fix *)
Lemma iprop_fixpoint_unfold (P : iProp A iProp A) `{!Contractive P} : Lemma iprop_fixpoint_unfold (P : iProp A iProp A) `{!Contractive P} :
iprop_fixpoint P P (iprop_fixpoint P). iprop_fixpoint P P (iprop_fixpoint P).
Proof. apply fixpoint_unfold. Qed. Proof. apply fixpoint_unfold. Qed.
End logic. End logic.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment