Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Iris
c
Commits
30503baf
Commit
30503baf
authored
Apr 29, 2018
by
Dan Frumin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the `iUnlock` tactic
parent
c9f47674
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
7 deletions
+90
-7
_CoqProject
_CoqProject
+1
-0
theories/c_translation/proofmode.v
theories/c_translation/proofmode.v
+1
-0
theories/lib/unlock_classes.v
theories/lib/unlock_classes.v
+81
-0
theories/tests/test1.v
theories/tests/test1.v
+7
-7
No files found.
_CoqProject
View file @
30503baf
...
...
@@ -5,6 +5,7 @@ theories/lib/mset.v
theories/lib/flock.v
theories/lib/locking_heap.v
theories/lib/U.v
theories/lib/unlock_classes.v
theories/c_translation/monad.v
theories/c_translation/lifting.v
theories/c_translation/proofmode.v
...
...
theories/c_translation/proofmode.v
View file @
30503baf
...
...
@@ -3,6 +3,7 @@ From iris.heap_lang Require Import spin_lock assert par.
From
iris
.
algebra
Require
Import
frac
auth
.
From
iris
.
base_logic
.
lib
Require
Import
fractional
.
From
iris_c
.
lib
Require
Import
locking_heap
mset
flock
.
From
iris_c
.
lib
Require
Export
unlock_classes
.
From
iris_c
.
c_translation
Require
Export
monad
lifting
.
From
iris
.
proofmode
Require
Import
coq_tactics
.
...
...
theories/lib/unlock_classes.v
0 → 100644
View file @
30503baf
From
iris
.
proofmode
Require
Import
coq_tactics
.
From
iris
.
proofmode
Require
Export
tactics
.
From
iris_c
.
lib
Require
Export
locking_heap
U
.
Import
uPred
.
Section
classes
.
Context
`
{
heapG
Σ
,
locking_heapG
Σ
}.
Class
IntoUnlock
(
P
Q
:
iProp
Σ
)
:
=
into_unlock
:
P
⊢
U
Q
.
Class
FromUnlock
(
P
Q
:
iProp
Σ
)
:
=
from_unlock
:
U
Q
⊢
P
.
Global
Instance
into_unlock_intro
P
:
IntoUnlock
(
U
P
)
P
.
Proof
.
rewrite
/
IntoUnlock
.
reflexivity
.
Qed
.
Global
Instance
into_unlock_id
P
:
IntoUnlock
P
P
|
10
.
Proof
.
apply
U_intro
.
Qed
.
Global
Instance
into_unlock_unlock
l
v
:
IntoUnlock
(
l
↦
L
v
)%
I
(
l
↦
U
v
)%
I
|
0
.
Proof
.
apply
U_unlock
.
Qed
.
Global
Instance
from_unlock_unlock
P
:
FromUnlock
(
U
P
)
P
.
Proof
.
rewrite
/
FromUnlock
.
reflexivity
.
Qed
.
Class
IntoUnlockEnv
(
Γ
1
Γ
2
:
env
(
iProp
Σ
))
:
=
into_unlock_env
:
env_Forall2
IntoUnlock
Γ
1
Γ
2
.
Class
IntoUnlockEnvs
(
Δ
1
Δ
2
:
envs
(
iResUR
Σ
))
:
=
{
into_unlock_persistent
:
[
∗
]
(
env_persistent
Δ
1
)
⊢
[
∗
]
(
env_persistent
Δ
2
)
;
into_unlocks_wf
:
envs_wf
Δ
1
→
envs_wf
Δ
2
;
into_unlock_spatial
:
IntoUnlockEnv
(
env_spatial
Δ
1
)
(
env_spatial
Δ
2
)
}.
Global
Instance
into_unlock_env_nil
:
IntoUnlockEnv
Enil
Enil
.
Proof
.
constructor
.
Qed
.
Global
Instance
into_unlock_env_snoc
Γ
1
Γ
2
i
P
Q
:
IntoUnlockEnv
Γ
1
Γ
2
→
IntoUnlock
P
Q
→
IntoUnlockEnv
(
Esnoc
Γ
1
i
P
)
(
Esnoc
Γ
2
i
Q
).
Proof
.
by
constructor
.
Qed
.
Global
Instance
into_unlock_envs
Γ
p
Γ
s1
Γ
s2
:
IntoUnlockEnv
Γ
s1
Γ
s2
→
IntoUnlockEnvs
(
Envs
Γ
p
Γ
s1
)
(
Envs
Γ
p
Γ
s2
).
Proof
.
split
;
try
done
.
destruct
1
;
constructor
;
try
naive_solver
eauto
using
env_Forall2_wf
,
env_Forall2_fresh
.
Qed
.
Lemma
into_unlock_env_sound
Δ
1
Δ
2
:
IntoUnlockEnv
Δ
1
Δ
2
→
[
∗
]
Δ
1
⊢
U
([
∗
]
Δ
2
).
Proof
.
intros
Hs
;
simpl
.
induction
Hs
;
simpl
.
-
apply
U_intro
.
-
rewrite
-
U_multiplicative
.
by
apply
uPred
.
sep_mono
.
Qed
.
Lemma
into_unlock_envs_sound
Δ
1
Δ
2
:
IntoUnlockEnvs
Δ
1
Δ
2
→
of_envs
Δ
1
⊢
U
(
of_envs
Δ
2
).
Proof
.
intros
[
Hp
Hs
]
;
rewrite
/
of_envs
/=
-!
U_multiplicative
.
repeat
apply
uPred
.
sep_mono
;
try
apply
uPred
.
persistently_mono
.
-
rewrite
-
U_intro
.
apply
uPred
.
pure_mono
.
apply
Hs
.
-
rewrite
-
U_intro
.
by
rewrite
Hp
.
-
by
apply
into_unlock_env_sound
.
Qed
.
Lemma
tac_unlock
Δ
Δ
'
Q
Q'
:
FromUnlock
Q
Q'
→
IntoUnlockEnvs
Δ
Δ
'
→
envs_entails
Δ
'
Q'
→
envs_entails
Δ
Q
.
Proof
.
rewrite
/
envs_entails
=>
Hf
?
HQ
.
rewrite
into_unlock_envs_sound
.
rewrite
/
FromUnlock
in
Hf
.
rewrite
-
Hf
.
by
apply
U_mono
.
Qed
.
End
classes
.
Tactic
Notation
"iUnlock"
:
=
iStartProof
;
let
P
:
=
match
goal
with
|-
envs_entails
_
?P
=>
P
end
in
eapply
tac_unlock
;
[
apply
_
||
fail
"iUnlock:"
P
"does not contain U"
|
apply
_
|
lazy
beta
(* remove beta redexes caused by removing laters under binders*)
].
theories/tests/test1.v
View file @
30503baf
...
...
@@ -15,23 +15,23 @@ Section test.
iIntros
"Hl"
.
iApply
awp_bind
.
iApply
a_seq_spec
.
rewrite
U_unlock
.
iRevert
"Hl"
.
rewrite
-(
U_mono
(
l
↦
U
#
1
)
(
awp
_
_
_
))%
I
.
eauto
.
iIntros
"Hl"
.
awp_pure
_
.
iUnlock
.
awp_lam
.
iApply
(
a_load_spec
with
"Hl"
).
iIntros
"Hl"
.
eauto
.
Qed
.
Lemma
test2
(
l
:
loc
)
R
`
{
Timeless
_
R
}
:
l
↦
U
#
3
-
∗
Lemma
test2
(
l
r
:
loc
)
R
`
{
Timeless
_
R
}
:
l
↦
U
#
3
-
∗
r
↦
L
#
0
-
∗
awp
(
a_store
(
a_ret
#
l
)
(
a_ret
#
1
)
;;;
a_seq
#()
;;;
a_load
(
a_ret
#
l
))%
E
R
(
fun
v
=>
⌜
v
=
#
1
⌝
).
Proof
.
iIntros
"Hl"
.
iIntros
"Hl
Hr
"
.
iApply
awp_bind
.
iApply
(
a_store_spec
with
"Hl"
).
iIntros
"Hl"
.
awp_lam
.
iApply
awp_bind
.
iApply
a_seq_spec
.
rewrite
U_unlock
.
iRevert
"Hl"
.
rewrite
-(
U_mono
(
l
↦
U
#
1
)
(
awp
_
_
_
))%
I
.
eauto
.
iIntros
"Hl"
.
awp_pure
_
.
iUnlock
.
awp_lam
.
iApply
(
a_load_spec
with
"Hl"
).
iIntros
"Hl"
.
eauto
.
Qed
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment