Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tej Chajed
iris
Commits
bcd25ed8
Commit
bcd25ed8
authored
1 year ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
add token ghost library
parent
caaff570
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
_CoqProject
+1
-0
1 addition, 0 deletions
_CoqProject
iris/base_logic/lib/token.v
+54
-0
54 additions, 0 deletions
iris/base_logic/lib/token.v
with
55 additions
and
0 deletions
_CoqProject
+
1
−
0
View file @
bcd25ed8
...
...
@@ -112,6 +112,7 @@ iris/base_logic/lib/mono_nat.v
iris/base_logic/lib/gset_bij.v
iris/base_logic/lib/ghost_map.v
iris/base_logic/lib/later_credits.v
iris/base_logic/lib/token.v
iris/program_logic/adequacy.v
iris/program_logic/lifting.v
iris/program_logic/weakestpre.v
...
...
This diff is collapsed.
Click to expand it.
iris/base_logic/lib/token.v
0 → 100644
+
54
−
0
View file @
bcd25ed8
(** This library provides assertions that represent "unique tokens".
The [token γ] assertion provides ownership of the token named [γ],
and the key lemma [token_exclusive] proves only one token exists. *)
From
iris
.
algebra
Require
Import
excl
.
From
iris
.
proofmode
Require
Import
proofmode
.
From
iris
.
base_logic
.
lib
Require
Export
own
.
From
iris
.
prelude
Require
Import
options
.
(** The CMRA we need. *)
Class
tokenG
Σ
:=
TokenG
{
token_inG
:
inG
Σ
(
exclR
unitO
);
}
.
Local
Existing
Instance
token_inG
.
Global
Hint
Mode
tokenG
-
:
typeclass_instances
.
Definition
tokenΣ
:
gFunctors
:=
#
[
GFunctor
(
exclR
unitO
)
]
.
Global
Instance
subG_tokenΣ
Σ
:
subG
tokenΣ
Σ
→
tokenG
Σ
.
Proof
.
solve_inG
.
Qed
.
Local
Definition
token_def
`{
!
tokenG
Σ
}
(
γ
:
gname
)
:
iProp
Σ
:=
own
γ
(
Excl
())
.
Local
Definition
token_aux
:
seal
(
@
token_def
)
.
Proof
.
by
eexists
.
Qed
.
Definition
token
:=
token_aux
.(
unseal
)
.
Local
Definition
token_unseal
:
@
token
=
@
token_def
:=
token_aux
.(
seal_eq
)
.
Global
Arguments
token
{
Σ
_}
γ
.
Local
Ltac
unseal
:=
rewrite
?token_unseal
/
token_def
.
Section
lemmas
.
Context
`{
!
tokenG
Σ
}
.
Global
Instance
token_timeless
γ
:
Timeless
(
token
γ
)
.
Proof
.
unseal
.
apply
_
.
Qed
.
Lemma
token_alloc_strong
(
P
:
gname
→
Prop
)
:
pred_infinite
P
→
⊢
|
==>
∃
γ
,
⌜
P
γ
⌝
∗
token
γ
.
Proof
.
unseal
.
intros
.
iApply
own_alloc_strong
;
done
.
Qed
.
Lemma
token_alloc
:
⊢
|
==>
∃
γ
,
token
γ
.
Proof
.
unseal
.
iApply
own_alloc
.
done
.
Qed
.
Lemma
token_exclusive
γ
:
token
γ
-∗
token
γ
-∗
False
.
Proof
.
unseal
.
iIntros
"Htok1 Htok2"
.
iCombine
"Htok1 Htok2"
gives
%
[]
.
Qed
.
End
lemmas
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment