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
R
ReLoC-v1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
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
Dan Frumin
ReLoC-v1
Commits
c139a492
Commit
c139a492
authored
Mar 28, 2018
by
Dan Frumin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Logically atomic specifications for FAI and FAD
parent
36b4deb5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
0 deletions
+98
-0
_CoqProject
_CoqProject
+1
-0
theories/examples/FAI.v
theories/examples/FAI.v
+97
-0
No files found.
_CoqProject
View file @
c139a492
...
...
@@ -44,6 +44,7 @@ theories/examples/or.v
theories/examples/symbol.v
theories/examples/generative.v
theories/examples/Y.v
theories/examples/FAI.v
theories/tests/typetest.v
theories/tests/ghosttp.v
theories/tests/tactics.v
...
...
theories/examples/FAI.v
0 → 100644
View file @
c139a492
From
iris
.
proofmode
Require
Import
tactics
.
From
iris_logrel
Require
Import
logrel
.
Definition
FAI
:
val
:=
rec
:
"inc"
"x"
:=
let:
"c"
:=
!
"x"
in
if:
CAS
"x"
"c"
(#
1
+
"c"
)
then
"c"
else
"inc"
"x"
.
Definition
FAD
:
val
:=
rec
:
"dec"
"x"
:=
let:
"c"
:=
!
"x"
in
if:
CAS
"x"
"c"
(
"c"
-
#
1
)
then
"c"
else
"dec"
"x"
.
Section
contents
.
Context
`
{
logrelG
Σ
}
.
Lemma
FAI_atomic
R1
R2
Γ
E
K
x
t
τ
Δ
:
R2
-
∗
□
(
|={
⊤
,
E
}=>
∃
m
:
nat
,
x
↦ᵢ
#
m
∗
R1
m
∗
((
x
↦ᵢ
#
m
∗
R1
m
={
E
,
⊤
}=
∗
True
)
∧
(
x
↦ᵢ
#(
S
m
)
∗
R1
m
-
∗
R2
-
∗
{
E
;
Δ
;
Γ
}
⊨
fill
K
#
m
≤
log
≤
t
:
τ
)))
-
∗
(
{
Δ
;
Γ
}
⊨
fill
K
(
FAI
#
x
)
≤
log
≤
t
:
τ
).
Proof
.
iIntros
"HR2 #H"
.
iL
ö
b
as
"IH"
.
rewrite
{
2
}/
FAI
.
unlock
;
simpl
.
rel_rec_l
.
iPoseProof
"H"
as
"H2"
.
(
*
iMod
later
on
destroys
H
*
)
rel_load_l_atomic
.
iMod
"H"
as
(
n
)
"[Hx [HR Hrev]]"
.
iModIntro
.
iRename
"H2"
into
"H"
.
iExists
#
n
.
iFrame
.
iNext
.
iIntros
"Hx"
.
iDestruct
"Hrev"
as
"[Hrev _]"
.
iMod
(
"Hrev"
with
"[HR Hx]"
)
as
"_"
;
first
by
iFrame
.
rel_rec_l
.
rel_op_l
.
rel_cas_l_atomic
.
iMod
"H"
as
(
n
'
)
"[Hx [HR HQ]]"
.
iModIntro
.
iExists
#
n
'
.
iFrame
.
destruct
(
decide
(
n
=
n
'
));
subst
.
-
iSplitR
;
eauto
.
{
iDestruct
1
as
%
Hfoo
.
exfalso
.
done
.
}
iIntros
"_ !> Hx"
.
simpl
.
iDestruct
"HQ"
as
"[_ HQ]"
.
iSpecialize
(
"HQ"
with
"[Hx HR]"
).
{
iFrame
.
}
rel_if_l
.
by
iApply
"HQ"
.
-
iSplitL
;
eauto
;
last
first
.
{
iDestruct
1
as
%
Hfoo
.
exfalso
.
simplify_eq
.
}
iIntros
"_ !> Hx"
.
simpl
.
rel_if_l
.
iDestruct
"HQ"
as
"[HQ _]"
.
iMod
(
"HQ"
with
"[Hx HR]"
)
as
"_"
;
first
by
iFrame
.
unlock
FAI
.
by
iApply
"IH"
.
Qed
.
Lemma
FAD_atomic
R1
R2
Γ
E
K
x
t
τ
Δ
:
R2
-
∗
□
(
|={
⊤
,
E
}=>
∃
m
:
nat
,
x
↦ᵢ
#
m
∗
R1
m
∗
((
x
↦ᵢ
#
m
∗
R1
m
={
E
,
⊤
}=
∗
True
)
∧
(
x
↦ᵢ
#(
m
-
1
)
∗
R1
m
-
∗
R2
-
∗
{
E
;
Δ
;
Γ
}
⊨
fill
K
#
m
≤
log
≤
t
:
τ
)))
-
∗
(
{
Δ
;
Γ
}
⊨
fill
K
(
FAD
#
x
)
≤
log
≤
t
:
τ
).
Proof
.
iIntros
"HR2 #H"
.
iL
ö
b
as
"IH"
.
rewrite
{
2
}/
FAD
.
unlock
;
simpl
.
rel_rec_l
.
iPoseProof
"H"
as
"H2"
.
(
*
iMod
later
on
destroys
H
*
)
rel_load_l_atomic
.
iMod
"H"
as
(
n
)
"[Hx [HR Hrev]]"
.
iModIntro
.
iRename
"H2"
into
"H"
.
iExists
#
n
.
iFrame
.
iNext
.
iIntros
"Hx"
.
iDestruct
"Hrev"
as
"[Hrev _]"
.
iMod
(
"Hrev"
with
"[HR Hx]"
)
as
"_"
;
first
by
iFrame
.
rel_rec_l
.
rel_op_l
.
rel_cas_l_atomic
.
iMod
"H"
as
(
n
'
)
"[Hx [HR HQ]]"
.
iModIntro
.
iExists
#
n
'
.
iFrame
.
destruct
(
decide
(
n
=
n
'
));
subst
.
-
iSplitR
;
eauto
.
{
iDestruct
1
as
%
Hfoo
.
exfalso
.
done
.
}
iIntros
"_ !> Hx"
.
simpl
.
iDestruct
"HQ"
as
"[_ HQ]"
.
iSpecialize
(
"HQ"
with
"[Hx HR]"
).
{
iFrame
.
}
rel_if_l
.
by
iApply
"HQ"
.
-
iSplitL
;
eauto
;
last
first
.
{
iDestruct
1
as
%
Hfoo
.
exfalso
.
simplify_eq
.
}
iIntros
"_ !> Hx"
.
simpl
.
rel_if_l
.
iDestruct
"HQ"
as
"[HQ _]"
.
iMod
(
"HQ"
with
"[Hx HR]"
)
as
"_"
;
first
by
iFrame
.
unlock
FAD
.
by
iApply
"IH"
.
Qed
.
End
contents
.
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