Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lambda-rust
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Simon Spies
lambda-rust
Commits
36ea1a45
Commit
36ea1a45
authored
8 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
prove dereferencing borrowed unique pointers
parent
ae6b60a0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/typing/borrow.v
+35
-32
35 additions, 32 deletions
theories/typing/borrow.v
with
35 additions
and
32 deletions
theories/typing/borrow.v
+
35
−
32
View file @
36ea1a45
...
@@ -68,19 +68,18 @@ Section borrow.
...
@@ -68,19 +68,18 @@ Section borrow.
rewrite
tctx_interp_singleton
tctx_hasty_val'
//.
iExists
_
.
auto
.
rewrite
tctx_interp_singleton
tctx_hasty_val'
//.
iExists
_
.
auto
.
Qed
.
Qed
.
Lemma
type_deref_uniq_uniq
E
L
κ
κ'
p
ty
:
(* Old Typing *)
lctx_lft_alive
E
L
κ
→
lctx_lft_incl
E
L
κ
κ'
→
Lemma
typed_deref_uniq_bor_bor
ty
ν
κ
κ'
κ''
q
:
typed_instruction_ty
E
L
[
TCtx_hasty
p
(
&
uniq
{
κ
}
&
uniq
{
κ'
}
ty
)]
(
!
p
)
typed_step
(
ν
◁
&
uniq
{
κ'
}
&
uniq
{
κ''
}
ty
∗
κ
⊑
κ'
∗
q
.[
κ
]
∗
κ'
⊑
κ''
)
(
&
uniq
{
κ
}
ty
)
.
(
!
ν
)
(
λ
v
,
v
◁
&
uniq
{
κ'
}
ty
∗
κ
⊑
κ'
∗
q
.[
κ
])
%
P
.
Proof
.
Proof
.
iIntros
(
tid
)
"!#(#HEAP & #LFT & (H◁ & #H⊑1 & Htok & #H⊑2) & $)"
.
wp_bind
ν
.
iIntros
(
Hκ
Hincl
tid
eq
)
"#HEAP #LFT $ HE HL Hp"
.
rewrite
tctx_interp_singleton
.
iApply
(
has_type_wp
with
"H◁"
)
.
iIntros
(
v
)
"Hνv H◁!>"
.
iDestruct
"Hνv"
as
%
Hνv
.
iPoseProof
(
Hincl
with
"[#] [#]"
)
as
"Hincl"
.
rewrite
has_type_value
.
iDestruct
"H◁"
as
(
l
P
)
"[[Heq #HPiff] HP]"
.
{
by
iApply
elctx_interp_persist
.
}
{
by
iApply
llctx_interp_persist
.
}
iDestruct
"Heq"
as
%
[
=->
]
.
iMod
(
Hκ
with
"HE HL"
)
as
(
q
)
"[Htok Hclose]"
;
first
set_solver
.
wp_bind
p
.
iApply
(
wp_hasty
with
"Hp"
)
.
iIntros
(
v
)
"_ Hown"
.
iDestruct
"Hown"
as
(
l
P
)
"[[Heq #HPiff] HP]"
.
iDestruct
"Heq"
as
%
[
=->
]
.
iMod
(
bor_iff
with
"LFT [] HP"
)
as
"H↦"
.
set_solver
.
by
eauto
.
iMod
(
bor_iff
with
"LFT [] HP"
)
as
"H↦"
.
set_solver
.
by
eauto
.
iMod
(
lft_incl_acc
with
"H⊑1 Htok"
)
as
(
q''
)
"[Htok Hclose]"
.
done
.
iMod
(
bor_exists
with
"LFT H↦"
)
as
(
vl
)
"Hbor"
.
done
.
iMod
(
bor_exists
with
"LFT H↦"
)
as
(
vl
)
"Hbor"
.
done
.
iMod
(
bor_sep
with
"LFT Hbor"
)
as
"[H↦ Hbor]"
.
done
.
iMod
(
bor_sep
with
"LFT Hbor"
)
as
"[H↦ Hbor]"
.
done
.
iMod
(
bor_exists
with
"LFT Hbor"
)
as
(
l'
)
"Hbor"
.
done
.
iMod
(
bor_exists
with
"LFT Hbor"
)
as
(
l'
)
"Hbor"
.
done
.
...
@@ -91,34 +90,38 @@ Section borrow.
...
@@ -91,34 +90,38 @@ Section borrow.
rewrite
heap_mapsto_vec_singleton
.
rewrite
heap_mapsto_vec_singleton
.
iApply
(
wp_fupd_step
_
(
⊤∖↑
lftN
)
with
"[Hbor]"
);
try
done
.
iApply
(
wp_fupd_step
_
(
⊤∖↑
lftN
)
with
"[Hbor]"
);
try
done
.
by
iApply
(
bor_unnest
with
"LFT Hbor"
)
.
by
iApply
(
bor_unnest
with
"LFT Hbor"
)
.
wp_read
.
iIntros
"!> Hbor"
.
iFrame
"#"
.
iSplitL
"Hbor"
.
wp_read
.
iIntros
"!> Hbor"
.
iFrame
"#"
.
-
iExists
_,
_
.
iSplitR
.
by
auto
.
iMod
(
"Hclose'"
with
"[H↦]"
)
as
"[H↦ Htok]"
;
first
by
auto
.
iApply
(
bor_shorten
with
"[] Hbor"
)
.
iMod
(
"Hclose"
with
"Htok"
)
as
"($ & $)"
.
iApply
(
lft_incl_glb
with
"H⊑2"
)
.
iApply
lft_incl_refl
.
rewrite
tctx_interp_singleton
tctx_hasty_val'
//.
-
iApply
(
"Hclose"
with
">"
)
.
by
iMod
(
"Hclose'"
with
"[$H↦]"
)
as
"[_ $]"
.
iExists
_,
_
.
iSplitR
;
first
by
auto
.
iApply
(
bor_shorten
with
"[] Hbor"
)
.
iApply
(
lft_incl_glb
with
"Hincl"
)
.
iApply
lft_incl_refl
.
Qed
.
Qed
.
Lemma
type
d
_deref_shr_
bor_bor
ty
ν
κ
κ'
κ''
q
:
Lemma
type_deref_shr_
uniq
E
L
κ
κ'
p
ty
:
typed_step
(
ν
◁
&
shr
{
κ'
}
&
uniq
{
κ''
}
ty
∗
κ
⊑
κ'
∗
q
.[
κ
]
∗
κ'
⊑
κ''
)
lctx_lft_alive
E
L
κ
→
lctx_lft_incl
E
L
κ
κ'
→
(
!
ν
)
typed_instruction_ty
E
L
[
TCtx_hasty
p
(
&
shr
{
κ
}
&
uniq
{
κ'
}
ty
)]
(
!
p
)
(
λ
v
,
v
◁
&
shr
{
κ
'
}
ty
∗
κ
⊑
κ'
∗
q
.[
κ
])
%
P
.
(
&
shr
{
κ
}
ty
)
.
Proof
.
Proof
.
iIntros
(
tid
)
"!#(#HEAP & #LFT & (H◁ & #H⊑1 & [Htok1 Htok2] & #H⊑2) & $)"
.
wp_bind
ν
.
iIntros
(
Hκ
Hincl
tid
eq
)
"#HEAP #LFT $ HE HL Hp"
.
rewrite
tctx_interp_singleton
.
iApply
(
has_type_wp
with
"H◁"
)
.
iIntros
(
v
)
"Hνv H◁!>"
.
iDestruct
"Hνv"
as
%
Hνv
.
iPoseProof
(
Hincl
with
"[#] [#]"
)
as
"Hincl"
.
rewrite
has_type_value
.
iDestruct
"H◁"
as
(
l
)
"[Heq Hshr]"
.
{
by
iApply
elctx_interp_persist
.
}
{
by
iApply
llctx_interp_persist
.
}
iMod
(
Hκ
with
"HE HL"
)
as
(
q
)
"[[Htok1 Htok2] Hclose]"
;
first
set_solver
.
wp_bind
p
.
iApply
(
wp_hasty
with
"Hp"
)
.
iIntros
(
v
)
"_ Hown"
.
iDestruct
"Hown"
as
(
l
)
"[Heq Hshr]"
.
iDestruct
"Heq"
as
%
[
=->
]
.
iDestruct
"Hshr"
as
(
l'
)
"[H↦ Hown]"
.
iDestruct
"Heq"
as
%
[
=->
]
.
iDestruct
"Hshr"
as
(
l'
)
"[H↦ Hown]"
.
iMod
(
lft_incl_acc
with
"H⊑1 Htok1"
)
as
(
q'
)
"[Htok1 Hclose]"
.
done
.
iMod
(
frac_bor_acc
with
"LFT H↦ Htok1"
)
as
(
q''
)
"[>H↦ Hclose']"
.
done
.
iMod
(
frac_bor_acc
with
"LFT H↦ Htok1"
)
as
(
q''
)
"[>H↦ Hclose']"
.
done
.
iAssert
(
κ'
⊑
κ''
∪
κ'
)
%
I
as
"#H⊑3"
.
iAssert
(
κ
⊑
κ'
∪
κ
)
%
I
as
"#Hincl'"
.
{
iApply
(
lft_incl_glb
with
"H⊑2 []"
)
.
iApply
lft_incl_refl
.
}
{
iApply
(
lft_incl_glb
with
"Hincl []"
)
.
iApply
lft_incl_refl
.
}
iMod
(
lft_incl_acc
with
"[] Htok2"
)
as
(
q2
)
"[Htok2 Hclose'']"
.
solve_ndisj
.
iMod
(
lft_incl_acc
with
"Hincl' Htok2"
)
as
(
q2
)
"[Htok2 Hclose'']"
.
solve_ndisj
.
{
iApply
(
lft_incl_trans
with
"[]"
);
done
.
}
iApply
(
wp_fupd_step
_
(_
∖_
)
with
"[Hown Htok2]"
);
try
done
.
iApply
(
wp_fupd_step
_
(_
∖_
)
with
"[Hown Htok2]"
);
try
done
.
-
iApply
(
"Hown"
with
"* [%] Htok2"
)
.
set_solver
+.
-
iApply
(
"Hown"
with
"* [%] Htok2"
)
.
set_solver
+.
-
wp_read
.
iIntros
"!>[#Hshr Htok2]{$H⊑1}"
.
-
wp_read
.
iIntros
"!>[#Hshr Htok2]"
.
iMod
(
"Hclose''"
with
"Htok2"
)
as
"Htok2"
.
iMod
(
"Hclose''"
with
"Htok2"
)
as
"$"
.
iSplitR
.
iMod
(
"Hclose'"
with
"[H↦]"
)
as
"Htok1"
;
first
by
auto
.
*
iExists
_
.
iSplitR
.
done
.
by
iApply
(
ty_shr_mono
with
"LFT H⊑3 Hshr"
)
.
iMod
(
"Hclose"
with
"[Htok1 Htok2]"
)
as
"($ & $)"
;
first
by
iFrame
.
*
iApply
(
"Hclose"
with
">"
)
.
iApply
(
"Hclose'"
with
"[$H↦]"
)
.
rewrite
tctx_interp_singleton
tctx_hasty_val'
//.
iExists
_
.
iSplitR
.
done
.
by
iApply
(
ty_shr_mono
with
"LFT Hincl' Hshr"
)
.
Qed
.
Qed
.
End
borrow
.
End
borrow
.
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