Skip to content
Snippets Groups Projects
Commit eb553b28 authored by Ralf Jung's avatar Ralf Jung
Browse files

Merge branch 'master' of https://gitlab.mpi-sws.org/iris/iris

parents d77b159c 3aef0170
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
discarded. Conversely, knowing that a fraction has been discarded implies discarded. Conversely, knowing that a fraction has been discarded implies
that no one can own 1. And, since discarding is an irreversible operation, that no one can own 1. And, since discarding is an irreversible operation,
it also implies that no one can own 1 in the future *) it also implies that no one can own 1 in the future *)
From stdpp Require Import countable.
From iris.algebra Require Export cmra. From iris.algebra Require Export cmra.
From iris.algebra Require Import proofmode_classes updates frac. From iris.algebra Require Import proofmode_classes updates frac.
From iris.prelude Require Import options. From iris.prelude Require Import options.
...@@ -37,6 +38,24 @@ Section dfrac. ...@@ -37,6 +38,24 @@ Section dfrac.
Implicit Types p q : Qp. Implicit Types p q : Qp.
Implicit Types dp dq : dfrac. Implicit Types dp dq : dfrac.
Global Instance dfrac_inhabited : Inhabited dfrac := populate DfracDiscarded.
Global Instance dfrac_eq_dec : EqDecision dfrac.
Proof. solve_decision. Defined.
Global Instance dfrac_countable : Countable dfrac.
Proof.
set (enc dq := match dq with
| DfracOwn q => inl q
| DfracDiscarded => inr (inl ())
| DfracBoth q => inr (inr q)
end).
set (dec y := Some match y with
| inl q => DfracOwn q
| inr (inl ()) => DfracDiscarded
| inr (inr q) => DfracBoth q
end).
refine (inj_countable enc dec _). by intros [].
Qed.
Global Instance DfracOwn_inj : Inj (=) (=) DfracOwn. Global Instance DfracOwn_inj : Inj (=) (=) DfracOwn.
Proof. by injection 1. Qed. Proof. by injection 1. Qed.
Global Instance DfracBoth_inj : Inj (=) (=) DfracBoth. Global Instance DfracBoth_inj : Inj (=) (=) DfracBoth.
......
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