Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iris-coq
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
Janno
iris-coq
Commits
17f06665
Commit
17f06665
authored
9 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Change auth_fsa to have an existential quantifier for the update.
This works better with class interference.
parent
6e275ac6
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
heap_lang/heap.v
+16
-18
16 additions, 18 deletions
heap_lang/heap.v
program_logic/auth.v
+43
-20
43 additions, 20 deletions
program_logic/auth.v
with
59 additions
and
38 deletions
heap_lang/heap.v
+
16
−
18
View file @
17f06665
...
@@ -77,23 +77,23 @@ Section heap.
...
@@ -77,23 +77,23 @@ Section heap.
P
⊑
wp
E
(
Alloc
e
)
Q
.
P
⊑
wp
E
(
Alloc
e
)
Q
.
Proof
.
Proof
.
rewrite
/
heap_ctx
/
heap_own
.
intros
HN
Hval
Hctx
HP
.
rewrite
/
heap_ctx
/
heap_own
.
intros
HN
Hval
Hctx
HP
.
set
(
LU
(
l
:
loc
)
:=
local_update_op
(
A
:=
heapRA
)
({[
l
↦
Excl
v
]}))
.
eapply
(
auth_fsa
(
heap_inv
HeapI
)
(
wp_fsa
_));
simpl
;
eauto
.
eapply
(
auth_fsa
(
heap_inv
HeapI
)
(
wp_fsa
_)
_
(
LU
:=
LU
));
simpl
.
{
by
eauto
.
}
{
by
eauto
.
}
{
by
eauto
.
}
rewrite
HP
=>{
HP
Hctx
HN
}
.
apply
sep_mono
;
first
done
.
rewrite
HP
=>{
HP
Hctx
HN
}
.
apply
sep_mono
;
first
done
.
apply
forall_intro
=>
hf
.
apply
wand_intro_l
.
rewrite
/
heap_inv
.
apply
forall_intro
=>
hf
.
apply
wand_intro_l
.
rewrite
/
heap_inv
.
rewrite
-
assoc
.
apply
const_elim_sep_l
=>
Hv
/=.
rewrite
-
assoc
.
apply
const_elim_sep_l
=>
Hv
/=.
rewrite
{
1
}[(
▷
ownP
_)
%
I
]
pvs_timeless
!
pvs_frame_r
.
apply
wp_strip_pvs
.
rewrite
{
1
}[(
▷
ownP
_)
%
I
]
pvs_timeless
!
pvs_frame_r
.
apply
wp_strip_pvs
.
rewrite
-
wp_alloc_pst
;
first
(
apply
sep_mono
;
first
done
);
try
done
;
[]
.
rewrite
-
wp_alloc_pst
;
first
(
apply
sep_mono
;
first
done
);
try
done
;
[]
.
apply
later_mono
,
forall_intro
=>
l
.
rewrite
(
forall_elim
l
)
.
apply
wand_intro_l
.
apply
later_mono
,
forall_intro
=>
l
.
rewrite
(
forall_elim
l
)
.
apply
wand_intro_l
.
rewrite
-
(
exist_intro
l
)
!
left_id
.
rewrite
always_and_sep_l
-
assoc
.
rewrite
-
(
exist_intro
(
op
{[
l
↦
Excl
v
]}))
.
repeat
erewrite
<-
exist_intro
by
apply
_;
simpl
.
rewrite
always_and_sep_l
-
assoc
.
apply
const_elim_sep_l
=>
Hfresh
.
apply
const_elim_sep_l
=>
Hfresh
.
assert
(
σ
!!
l
=
None
)
as
Hfresh_σ
.
assert
(
σ
!!
l
=
None
)
as
Hfresh_σ
.
{
move
:
Hfresh
(
Hv
0
%
nat
l
)
.
rewrite
/
from_heap
/
to_heap
lookup_omap
.
{
move
:
Hfresh
(
Hv
0
%
nat
l
)
.
rewrite
/
from_heap
/
to_heap
lookup_omap
.
rewrite
lookup_op
!
lookup_fmap
.
rewrite
lookup_op
!
lookup_fmap
.
case
_:(
σ
!!
l
)=>[
v'
|]
/=
;
case
_:(
hf
!!
l
)=>[[?||]|]
/=
;
done
.
}
case
_:(
σ
!!
l
)=>[
v'
|]
/=
;
case
_:(
hf
!!
l
)=>[[?||]|]
/=
;
done
.
}
rewrite
const_equiv
//
const_equiv
;
last
first
.
rewrite
const_equiv
//
const_equiv
;
last
first
.
{
move
=>
n
l'
.
move
:(
Hv
n
l'
)
Hfresh
.
{
split
;
first
done
.
move
=>
n
l'
.
move
:(
Hv
n
l'
)
Hfresh
.
rewrite
/
from_heap
/
to_heap
!
lookup_omap
!
lookup_op
!
lookup_fmap
!
Hfresh_σ
/=.
rewrite
/
from_heap
/
to_heap
!
lookup_omap
!
lookup_op
!
lookup_fmap
!
Hfresh_σ
/=.
destruct
(
decide
(
l
=
l'
))
.
destruct
(
decide
(
l
=
l'
))
.
-
subst
l'
.
rewrite
lookup_singleton
!
Hfresh_σ
.
-
subst
l'
.
rewrite
lookup_singleton
!
Hfresh_σ
.
...
@@ -116,14 +116,13 @@ Section heap.
...
@@ -116,14 +116,13 @@ Section heap.
Lemma
wp_alloc
N
E
γ
e
v
P
Q
:
Lemma
wp_alloc
N
E
γ
e
v
P
Q
:
nclose
N
⊆
E
→
to_val
e
=
Some
v
→
nclose
N
⊆
E
→
to_val
e
=
Some
v
→
P
⊑
heap_ctx
HeapI
γ
N
→
P
⊑
heap_ctx
HeapI
γ
N
→
P
⊑
(
▷
(
∀
l
,
heap_mapsto
HeapI
γ
l
v
-★
Q
(
LocV
l
))
)
→
P
⊑
▷
(
∀
l
,
heap_mapsto
HeapI
γ
l
v
-★
Q
(
LocV
l
))
→
P
⊑
wp
E
(
Alloc
e
)
Q
.
P
⊑
wp
E
(
Alloc
e
)
Q
.
Proof
.
Proof
.
intros
HN
?
Hctx
HP
.
eapply
sep_elim_True_r
.
intros
HN
?
Hctx
HP
.
eapply
sep_elim_True_r
.
{
eapply
(
auth_empty
γ
)
.
}
{
eapply
(
auth_empty
E
γ
)
.
}
rewrite
pvs_frame_l
.
apply
wp_strip_pvs
.
rewrite
pvs_frame_l
.
apply
wp_strip_pvs
.
eapply
wp_alloc_heap
with
(
σ
:=
∅
);
try
done
;
[|]
.
eapply
wp_alloc_heap
with
N
γ
∅
v
;
eauto
with
I
.
{
eauto
with
I
.
}
rewrite
HP
comm
.
apply
sep_mono
.
rewrite
HP
comm
.
apply
sep_mono
.
-
rewrite
/
heap_own
.
f_equiv
.
apply
:
map_eq
=>
l
.
by
rewrite
lookup_fmap
!
lookup_empty
.
-
rewrite
/
heap_own
.
f_equiv
.
apply
:
map_eq
=>
l
.
by
rewrite
lookup_fmap
!
lookup_empty
.
-
apply
later_mono
,
forall_mono
=>
l
.
apply
wand_mono
;
last
done
.
eauto
with
I
.
-
apply
later_mono
,
forall_mono
=>
l
.
apply
wand_mono
;
last
done
.
eauto
with
I
.
...
@@ -137,7 +136,7 @@ Section heap.
...
@@ -137,7 +136,7 @@ Section heap.
P
⊑
wp
E
(
Load
(
Loc
l
))
Q
.
P
⊑
wp
E
(
Load
(
Loc
l
))
Q
.
Proof
.
Proof
.
rewrite
/
heap_ctx
/
heap_own
.
intros
Hl
HN
Hctx
HP
.
rewrite
/
heap_ctx
/
heap_own
.
intros
Hl
HN
Hctx
HP
.
eapply
(
auth_fsa
(
heap_inv
HeapI
)
(
wp_fsa
_)
(
λ
_:(),
id
)
)
;
simpl
;
eauto
.
eapply
(
auth_fsa
'
(
heap_inv
HeapI
)
(
wp_fsa
_)
id
);
simpl
;
eauto
.
rewrite
HP
=>{
HP
Hctx
HN
}
.
apply
sep_mono
;
first
done
.
rewrite
HP
=>{
HP
Hctx
HN
}
.
apply
sep_mono
;
first
done
.
apply
forall_intro
=>
hf
.
apply
wand_intro_l
.
rewrite
/
heap_inv
.
apply
forall_intro
=>
hf
.
apply
wand_intro_l
.
rewrite
/
heap_inv
.
rewrite
-
assoc
.
apply
const_elim_sep_l
=>
Hv
/=.
rewrite
-
assoc
.
apply
const_elim_sep_l
=>
Hv
/=.
...
@@ -146,7 +145,7 @@ Section heap.
...
@@ -146,7 +145,7 @@ Section heap.
{
move
:
(
Hv
0
%
nat
l
)
.
rewrite
lookup_omap
lookup_op
lookup_fmap
Hl
/=.
{
move
:
(
Hv
0
%
nat
l
)
.
rewrite
lookup_omap
lookup_op
lookup_fmap
Hl
/=.
case
_:(
hf
!!
l
)=>[[?||]|];
by
auto
.
}
case
_:(
hf
!!
l
)=>[[?||]|];
by
auto
.
}
apply
later_mono
,
wand_intro_l
.
apply
later_mono
,
wand_intro_l
.
rewrite
-
(
exist_intro
())
left_id
const_equiv
//
left_id
.
rewrite
left_id
const_equiv
//
left_id
.
by
rewrite
-
later_intro
.
by
rewrite
-
later_intro
.
Qed
.
Qed
.
...
@@ -168,8 +167,7 @@ Section heap.
...
@@ -168,8 +167,7 @@ Section heap.
P
⊑
wp
E
(
Store
(
Loc
l
)
e
)
Q
.
P
⊑
wp
E
(
Store
(
Loc
l
)
e
)
Q
.
Proof
.
Proof
.
rewrite
/
heap_ctx
/
heap_own
.
intros
Hl
Hval
HN
Hctx
HP
.
rewrite
/
heap_ctx
/
heap_own
.
intros
Hl
Hval
HN
Hctx
HP
.
eapply
(
auth_fsa
(
heap_inv
HeapI
)
(
wp_fsa
_)
eapply
(
auth_fsa'
(
heap_inv
HeapI
)
(
wp_fsa
_)
(
alter
(
λ
_,
Excl
v
)
l
));
simpl
;
eauto
.
(
λ
_:(),
alter
(
λ
_,
Excl
v
)
l
));
simpl
;
eauto
.
rewrite
HP
=>{
HP
Hctx
HN
}
.
apply
sep_mono
;
first
done
.
rewrite
HP
=>{
HP
Hctx
HN
}
.
apply
sep_mono
;
first
done
.
apply
forall_intro
=>
hf
.
apply
wand_intro_l
.
rewrite
/
heap_inv
.
apply
forall_intro
=>
hf
.
apply
wand_intro_l
.
rewrite
/
heap_inv
.
rewrite
-
assoc
.
apply
const_elim_sep_l
=>
Hv
/=.
rewrite
-
assoc
.
apply
const_elim_sep_l
=>
Hv
/=.
...
@@ -178,7 +176,7 @@ Section heap.
...
@@ -178,7 +176,7 @@ Section heap.
{
move
:
(
Hv
0
%
nat
l
)
.
rewrite
lookup_omap
lookup_op
lookup_fmap
Hl
/=.
{
move
:
(
Hv
0
%
nat
l
)
.
rewrite
lookup_omap
lookup_op
lookup_fmap
Hl
/=.
case
_:(
hf
!!
l
)=>[[?||]|];
by
auto
.
}
case
_:(
hf
!!
l
)=>[[?||]|];
by
auto
.
}
apply
later_mono
,
wand_intro_l
.
apply
later_mono
,
wand_intro_l
.
rewrite
-
(
exist_intro
())
const_equiv
//
;
last
first
.
rewrite
const_equiv
//
;
last
first
.
(* TODO I think there are some general fin_map lemmas hiding in here. *)
(* TODO I think there are some general fin_map lemmas hiding in here. *)
{
split
.
{
split
.
-
exists
(
Excl
v'
)
.
by
rewrite
lookup_fmap
Hl
.
-
exists
(
Excl
v'
)
.
by
rewrite
lookup_fmap
Hl
.
...
@@ -222,7 +220,7 @@ Section heap.
...
@@ -222,7 +220,7 @@ Section heap.
P
⊑
wp
E
(
Cas
(
Loc
l
)
e1
e2
)
Q
.
P
⊑
wp
E
(
Cas
(
Loc
l
)
e1
e2
)
Q
.
Proof
.
Proof
.
rewrite
/
heap_ctx
/
heap_own
.
intros
He1
He2
Hl
Hne
HN
Hctx
HP
.
rewrite
/
heap_ctx
/
heap_own
.
intros
He1
He2
Hl
Hne
HN
Hctx
HP
.
eapply
(
auth_fsa
(
heap_inv
HeapI
)
(
wp_fsa
_)
(
λ
_:(),
id
)
)
;
simpl
;
eauto
.
eapply
(
auth_fsa
'
(
heap_inv
HeapI
)
(
wp_fsa
_)
id
);
simpl
;
eauto
.
{
split_ands
;
eexists
;
eauto
.
}
{
split_ands
;
eexists
;
eauto
.
}
rewrite
HP
=>{
HP
Hctx
HN
}
.
apply
sep_mono
;
first
done
.
rewrite
HP
=>{
HP
Hctx
HN
}
.
apply
sep_mono
;
first
done
.
apply
forall_intro
=>
hf
.
apply
wand_intro_l
.
rewrite
/
heap_inv
.
apply
forall_intro
=>
hf
.
apply
wand_intro_l
.
rewrite
/
heap_inv
.
...
@@ -232,7 +230,7 @@ Section heap.
...
@@ -232,7 +230,7 @@ Section heap.
{
move
:
(
Hv
0
%
nat
l
)
.
rewrite
lookup_omap
lookup_op
lookup_fmap
Hl
/=.
{
move
:
(
Hv
0
%
nat
l
)
.
rewrite
lookup_omap
lookup_op
lookup_fmap
Hl
/=.
case
_:(
hf
!!
l
)=>[[?||]|];
by
auto
.
}
case
_:(
hf
!!
l
)=>[[?||]|];
by
auto
.
}
apply
later_mono
,
wand_intro_l
.
apply
later_mono
,
wand_intro_l
.
rewrite
-
(
exist_intro
())
left_id
const_equiv
//
left_id
.
rewrite
left_id
const_equiv
//
left_id
.
by
rewrite
-
later_intro
.
by
rewrite
-
later_intro
.
Qed
.
Qed
.
...
@@ -255,7 +253,7 @@ Section heap.
...
@@ -255,7 +253,7 @@ Section heap.
P
⊑
wp
E
(
Cas
(
Loc
l
)
e1
e2
)
Q
.
P
⊑
wp
E
(
Cas
(
Loc
l
)
e1
e2
)
Q
.
Proof
.
Proof
.
rewrite
/
heap_ctx
/
heap_own
.
intros
Hv1
Hv2
Hl
HN
Hctx
HP
.
rewrite
/
heap_ctx
/
heap_own
.
intros
Hv1
Hv2
Hl
HN
Hctx
HP
.
eapply
(
auth_fsa
(
heap_inv
HeapI
)
(
wp_fsa
_)
(
λ
_:(),
alter
(
λ
_,
Excl
v2
)
l
));
simpl
;
eauto
.
eapply
(
auth_fsa
'
(
heap_inv
HeapI
)
(
wp_fsa
_)
(
alter
(
λ
_,
Excl
v2
)
l
));
simpl
;
eauto
.
{
split_ands
;
eexists
;
eauto
.
}
{
split_ands
;
eexists
;
eauto
.
}
rewrite
HP
=>{
HP
Hctx
HN
}
.
apply
sep_mono
;
first
done
.
rewrite
HP
=>{
HP
Hctx
HN
}
.
apply
sep_mono
;
first
done
.
apply
forall_intro
=>
hf
.
apply
wand_intro_l
.
rewrite
/
heap_inv
.
apply
forall_intro
=>
hf
.
apply
wand_intro_l
.
rewrite
/
heap_inv
.
...
@@ -265,7 +263,7 @@ Section heap.
...
@@ -265,7 +263,7 @@ Section heap.
{
move
:
(
Hv
0
%
nat
l
)
.
rewrite
lookup_omap
lookup_op
lookup_fmap
Hl
/=.
{
move
:
(
Hv
0
%
nat
l
)
.
rewrite
lookup_omap
lookup_op
lookup_fmap
Hl
/=.
case
_:(
hf
!!
l
)=>[[?||]|];
by
auto
.
}
case
_:(
hf
!!
l
)=>[[?||]|];
by
auto
.
}
apply
later_mono
,
wand_intro_l
.
apply
later_mono
,
wand_intro_l
.
rewrite
-
(
exist_intro
())
const_equiv
//
;
last
first
.
rewrite
const_equiv
//
;
last
first
.
(* TODO I think there are some general fin_map lemmas hiding in here. *)
(* TODO I think there are some general fin_map lemmas hiding in here. *)
{
split
.
{
split
.
-
exists
(
Excl
v1
)
.
by
rewrite
lookup_fmap
Hl
.
-
exists
(
Excl
v1
)
.
by
rewrite
lookup_fmap
Hl
.
...
...
This diff is collapsed.
Click to expand it.
program_logic/auth.v
+
43
−
20
View file @
17f06665
...
@@ -11,7 +11,8 @@ Class AuthInG Λ Σ (i : gid) (A : cmraT) `{Empty A} := {
...
@@ -11,7 +11,8 @@ Class AuthInG Λ Σ (i : gid) (A : cmraT) `{Empty A} := {
(* TODO: Once we switched to RAs, it is no longer necessary to remember that a is
(* TODO: Once we switched to RAs, it is no longer necessary to remember that a is
constantly valid. *)
constantly valid. *)
Definition
auth_inv
{
Λ
Σ
A
}
(
i
:
gid
)
`{
AuthInG
Λ
Σ
i
A
}
Definition
auth_inv
{
Λ
Σ
A
}
(
i
:
gid
)
`{
AuthInG
Λ
Σ
i
A
}
(
γ
:
gname
)
(
φ
:
A
→
iPropG
Λ
Σ
)
:
iPropG
Λ
Σ
:=
(
∃
a
,
(
■✓
a
∧
own
i
γ
(
●
a
))
★
φ
a
)
%
I
.
(
γ
:
gname
)
(
φ
:
A
→
iPropG
Λ
Σ
)
:
iPropG
Λ
Σ
:=
(
∃
a
,
(
■
✓
a
∧
own
i
γ
(
●
a
))
★
φ
a
)
%
I
.
Definition
auth_own
{
Λ
Σ
A
}
(
i
:
gid
)
`{
AuthInG
Λ
Σ
i
A
}
Definition
auth_own
{
Λ
Σ
A
}
(
i
:
gid
)
`{
AuthInG
Λ
Σ
i
A
}
(
γ
:
gname
)
(
a
:
A
)
:
iPropG
Λ
Σ
:=
own
i
γ
(
◯
a
)
.
(
γ
:
gname
)
(
a
:
A
)
:
iPropG
Λ
Σ
:=
own
i
γ
(
◯
a
)
.
Definition
auth_ctx
{
Λ
Σ
A
}
(
i
:
gid
)
`{
AuthInG
Λ
Σ
i
A
}
Definition
auth_ctx
{
Λ
Σ
A
}
(
i
:
gid
)
`{
AuthInG
Λ
Σ
i
A
}
...
@@ -29,6 +30,10 @@ Section auth.
...
@@ -29,6 +30,10 @@ Section auth.
Implicit
Types
a
b
:
A
.
Implicit
Types
a
b
:
A
.
Implicit
Types
γ
:
gname
.
Implicit
Types
γ
:
gname
.
Lemma
auto_own_op
γ
a
b
:
auth_own
AuthI
γ
(
a
⋅
b
)
≡
(
auth_own
AuthI
γ
a
★
auth_own
AuthI
γ
b
)
%
I
.
Proof
.
by
rewrite
/
auth_own
-
own_op
auth_frag_op
.
Qed
.
Lemma
auth_alloc
N
a
:
Lemma
auth_alloc
N
a
:
✓
a
→
φ
a
⊑
pvs
N
N
(
∃
γ
,
auth_ctx
AuthI
γ
N
φ
∧
auth_own
AuthI
γ
a
)
.
✓
a
→
φ
a
⊑
pvs
N
N
(
∃
γ
,
auth_ctx
AuthI
γ
N
φ
∧
auth_own
AuthI
γ
a
)
.
Proof
.
Proof
.
...
@@ -45,12 +50,12 @@ Section auth.
...
@@ -45,12 +50,12 @@ Section auth.
by
rewrite
always_and_sep_l
.
by
rewrite
always_and_sep_l
.
Qed
.
Qed
.
Lemma
auth_empty
γ
E
:
True
⊑
pvs
E
E
(
auth_own
AuthI
γ
∅
)
.
Lemma
auth_empty
E
γ
:
True
⊑
pvs
E
E
(
auth_own
AuthI
γ
∅
)
.
Proof
.
by
rewrite
own_update_empty
/
auth_own
.
Qed
.
Proof
.
by
rewrite
own_update_empty
/
auth_own
.
Qed
.
Lemma
auth_opened
E
a
γ
:
Lemma
auth_opened
E
γ
a
:
(
▷
auth_inv
AuthI
γ
φ
★
auth_own
AuthI
γ
a
)
(
▷
auth_inv
AuthI
γ
φ
★
auth_own
AuthI
γ
a
)
⊑
pvs
E
E
(
∃
a'
,
■
✓
(
a
⋅
a'
)
★
▷
φ
(
a
⋅
a'
)
★
own
AuthI
γ
(
●
(
a
⋅
a'
)
⋅
◯
a
))
.
⊑
pvs
E
E
(
∃
a'
,
■
✓
(
a
⋅
a'
)
★
▷
φ
(
a
⋅
a'
)
★
own
AuthI
γ
(
●
(
a
⋅
a'
)
⋅
◯
a
))
.
Proof
.
Proof
.
rewrite
/
auth_inv
.
rewrite
later_exist
sep_exist_r
.
apply
exist_elim
=>
b
.
rewrite
/
auth_inv
.
rewrite
later_exist
sep_exist_r
.
apply
exist_elim
=>
b
.
rewrite
later_sep
[(
▷
(_
∧
_))
%
I
]
pvs_timeless
!
pvs_frame_r
.
apply
pvs_mono
.
rewrite
later_sep
[(
▷
(_
∧
_))
%
I
]
pvs_timeless
!
pvs_frame_r
.
apply
pvs_mono
.
...
@@ -59,8 +64,7 @@ Section auth.
...
@@ -59,8 +64,7 @@ Section auth.
rewrite
own_valid_r
auth_validI
/=
and_elim_l
sep_exist_l
sep_exist_r
/=.
rewrite
own_valid_r
auth_validI
/=
and_elim_l
sep_exist_l
sep_exist_r
/=.
apply
exist_elim
=>
a'
.
apply
exist_elim
=>
a'
.
rewrite
left_id
-
(
exist_intro
a'
)
.
rewrite
left_id
-
(
exist_intro
a'
)
.
apply
(
eq_rewrite
b
(
a
⋅
a'
)
apply
(
eq_rewrite
b
(
a
⋅
a'
)
(
λ
x
,
■✓
x
★
▷
φ
x
★
own
AuthI
γ
(
●
x
⋅
◯
a
))
%
I
)
.
(
λ
x
,
■✓
x
★
▷
φ
x
★
own
AuthI
γ
(
●
x
⋅
◯
a
))
%
I
)
.
{
by
move
=>
n
?
?
/
timeless_iff
->
.
}
{
by
move
=>
n
?
?
/
timeless_iff
->
.
}
{
by
eauto
with
I
.
}
{
by
eauto
with
I
.
}
rewrite
const_equiv
//
left_id
comm
.
rewrite
const_equiv
//
left_id
comm
.
...
@@ -68,7 +72,7 @@ Section auth.
...
@@ -68,7 +72,7 @@ Section auth.
by
rewrite
sep_elim_l
.
by
rewrite
sep_elim_l
.
Qed
.
Qed
.
Lemma
auth_closing
E
`{
!
LocalUpdate
Lv
L
}
a
a'
γ
:
Lemma
auth_closing
`{
!
LocalUpdate
Lv
L
}
E
γ
a
a'
:
Lv
a
→
✓
(
L
a
⋅
a'
)
→
Lv
a
→
✓
(
L
a
⋅
a'
)
→
(
▷
φ
(
L
a
⋅
a'
)
★
own
AuthI
γ
(
●
(
a
⋅
a'
)
⋅
◯
a
))
(
▷
φ
(
L
a
⋅
a'
)
★
own
AuthI
γ
(
●
(
a
⋅
a'
)
⋅
◯
a
))
⊑
pvs
E
E
(
▷
auth_inv
AuthI
γ
φ
★
auth_own
AuthI
γ
(
L
a
))
.
⊑
pvs
E
E
(
▷
auth_inv
AuthI
γ
φ
★
auth_own
AuthI
γ
(
L
a
))
.
...
@@ -80,36 +84,55 @@ Section auth.
...
@@ -80,36 +84,55 @@ Section auth.
by
apply
own_update
,
(
auth_local_update_l
L
)
.
by
apply
own_update
,
(
auth_local_update_l
L
)
.
Qed
.
Qed
.
Context
{
V
}
(
fsa
:
FSA
Λ
(
globalF
Σ
)
V
)
`{
!
FrameShiftAssertion
fsaV
fsa
}
.
(* Notice how the user has to prove that `b⋅a'` is valid at all
(* Notice how the user has to prove that `b⋅a'` is valid at all
step-indices. However, since A is timeless, that should not be
step-indices. However, since A is timeless, that should not be
a restriction.
a restriction. *)
"I" here is an index type, so that the proof can still have some influence on
Lemma
auth_fsa
E
N
P
(
Q
:
V
→
iPropG
Λ
Σ
)
γ
a
:
which concrete action is executed *after* it saw the full, authoritative state. *)
Lemma
auth_fsa
{
B
I
}
(
fsa
:
FSA
Λ
(
globalF
Σ
)
B
)
`{
!
FrameShiftAssertion
fsaV
fsa
}
L
{
Lv
}
{
LU
:
∀
i
:
I
,
LocalUpdate
(
Lv
i
)
(
L
i
)}
N
E
P
(
Q
:
B
→
iPropG
Λ
Σ
)
γ
a
:
fsaV
→
fsaV
→
nclose
N
⊆
E
→
nclose
N
⊆
E
→
P
⊑
auth_ctx
AuthI
γ
N
φ
→
P
⊑
auth_ctx
AuthI
γ
N
φ
→
P
⊑
(
auth_own
AuthI
γ
a
★
(
∀
a'
,
P
⊑
(
auth_own
AuthI
γ
a
★
∀
a'
,
■
✓
(
a
⋅
a'
)
★
▷
φ
(
a
⋅
a'
)
-★
■
✓
(
a
⋅
a'
)
★
▷
φ
(
a
⋅
a'
)
-★
fsa
(
E
∖
nclose
N
)
(
λ
x
,
fsa
(
E
∖
nclose
N
)
(
λ
x
,
∃
L
Lv
(
Hup
:
LocalUpdate
Lv
L
),
∃
i
,
■
(
Lv
i
a
∧
✓
(
L
i
a
⋅
a'
))
★
▷
φ
(
L
i
a
⋅
a'
)
★
■
(
Lv
a
∧
✓
(
L
a
⋅
a'
))
★
▷
φ
(
L
a
⋅
a'
)
★
(
auth_own
AuthI
γ
(
L
i
a
)
-★
Q
x
)))
)
→
(
auth_own
AuthI
γ
(
L
a
)
-★
Q
x
)))
→
P
⊑
fsa
E
Q
.
P
⊑
fsa
E
Q
.
Proof
.
Proof
.
rewrite
/
auth_ctx
=>?
HN
Hinv
Hinner
.
rewrite
/
auth_ctx
=>?
HN
Hinv
Hinner
.
eapply
(
inv_fsa
fsa
);
eauto
.
rewrite
Hinner
=>{
Hinner
Hinv
P
}
.
eapply
(
inv_fsa
fsa
);
eauto
.
rewrite
Hinner
=>{
Hinner
Hinv
P
}
.
apply
wand_intro_l
.
apply
wand_intro_l
.
rewrite
assoc
.
rewrite
assoc
auth_opened
!
pvs_frame_r
!
sep_exist_r
.
rewrite
(
auth_opened
(
E
∖
N
))
!
pvs_frame_r
!
sep_exist_r
.
apply
(
fsa_strip_pvs
fsa
)
.
apply
exist_elim
=>
a'
.
apply
(
fsa_strip_pvs
fsa
)
.
apply
exist_elim
=>
a'
.
rewrite
(
forall_elim
a'
)
.
rewrite
[(
▷_
★
_)
%
I
]
comm
.
rewrite
(
forall_elim
a'
)
.
rewrite
[(
▷_
★
_)
%
I
]
comm
.
(* Getting this wand eliminated is really annoying. *)
(* Getting this wand eliminated is really annoying. *)
rewrite
[(
■_
★
_)
%
I
]
comm
-!
assoc
[(
▷
φ
_
★
_
★
_)
%
I
]
assoc
[(
▷
φ
_
★
_)
%
I
]
comm
.
rewrite
[(
■_
★
_)
%
I
]
comm
-!
assoc
[(
▷
φ
_
★
_
★
_)
%
I
]
assoc
[(
▷
φ
_
★
_)
%
I
]
comm
.
rewrite
wand_elim_r
fsa_frame_l
.
rewrite
wand_elim_r
fsa_frame_l
.
apply
(
fsa_mono_pvs
fsa
)=>
x
.
rewrite
sep_exist_l
.
apply
exist_elim
=>
i
.
apply
(
fsa_mono_pvs
fsa
)=>
b
.
rewrite
sep_exist_l
;
apply
exist_elim
=>
L
.
rewrite
sep_exist_l
;
apply
exist_elim
=>
Lv
.
rewrite
sep_exist_l
;
apply
exist_elim
=>
?
.
rewrite
comm
-!
assoc
.
apply
const_elim_sep_l
=>
-
[
HL
Hv
]
.
rewrite
comm
-!
assoc
.
apply
const_elim_sep_l
=>
-
[
HL
Hv
]
.
rewrite
assoc
[(_
★
(_
-★
_))
%
I
]
comm
-
assoc
.
rewrite
assoc
[(_
★
(_
-★
_))
%
I
]
comm
-
assoc
.
rewrite
auth_closing
//
;
[]
.
erewrite
pvs_frame_l
.
apply
pvs_mono
.
rewrite
(
auth_closing
(
E
∖
N
))
//
;
[]
.
rewrite
pvs_frame_l
.
apply
pvs_mono
.
by
rewrite
assoc
[(_
★
▷_
)
%
I
]
comm
-
assoc
wand_elim_l
.
by
rewrite
assoc
[(_
★
▷_
)
%
I
]
comm
-
assoc
wand_elim_l
.
Qed
.
Qed
.
Lemma
auth_fsa'
L
`{
!
LocalUpdate
Lv
L
}
E
N
P
(
Q
:
V
→
iPropG
Λ
Σ
)
γ
a
:
fsaV
→
nclose
N
⊆
E
→
P
⊑
auth_ctx
AuthI
γ
N
φ
→
P
⊑
(
auth_own
AuthI
γ
a
★
(
∀
a'
,
■
✓
(
a
⋅
a'
)
★
▷
φ
(
a
⋅
a'
)
-★
fsa
(
E
∖
nclose
N
)
(
λ
x
,
■
(
Lv
a
∧
✓
(
L
a
⋅
a'
))
★
▷
φ
(
L
a
⋅
a'
)
★
(
auth_own
AuthI
γ
(
L
a
)
-★
Q
x
))))
→
P
⊑
fsa
E
Q
.
Proof
.
intros
???
HP
.
eapply
auth_fsa
with
N
γ
a
;
eauto
.
rewrite
HP
;
apply
sep_mono
;
first
done
;
apply
forall_mono
=>
a'
.
apply
wand_mono
;
first
done
.
apply
(
fsa_mono
fsa
)=>
b
.
rewrite
-
(
exist_intro
L
)
.
by
repeat
erewrite
<-
exist_intro
by
apply
_
.
Qed
.
End
auth
.
End
auth
.
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