Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Actris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Iris
Actris
Commits
0dae5fe6
Commit
0dae5fe6
authored
5 years ago
by
Jonas Kastberg Hinrichsen
Browse files
Options
Downloads
Patches
Plain Diff
Bumped iris
parent
aa527705
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/examples/list_sort.v
+16
-25
16 additions, 25 deletions
theories/examples/list_sort.v
with
16 additions
and
25 deletions
theories/examples/list_sort.v
+
16
−
25
View file @
0dae5fe6
...
@@ -65,14 +65,18 @@ Section ListSortExample.
...
@@ -65,14 +65,18 @@ Section ListSortExample.
{{{
RET
encode
(
bool_decide
(
R
x
y
));
True
}}})
%
I
.
{{{
RET
encode
(
bool_decide
(
R
x
y
));
True
}}})
%
I
.
Lemma
lmerge_spec
(
cmp
:
val
)
(
ys
zs
:
list
T
)
:
Lemma
lmerge_spec
(
cmp
:
val
)
(
ys
zs
:
list
T
)
:
cmp_spec
cmp
→
cmp_spec
cmp
-∗
{{{
True
}}}
{{{
True
}}}
lmerge
cmp
(
encode
ys
)
(
encode
zs
)
lmerge
cmp
(
encode
ys
)
(
encode
zs
)
{{{
RET
(
encode
(
list_merge
(
R
)
ys
zs
));
True
}}}
.
{{{
RET
(
encode
(
list_merge
(
R
)
ys
zs
));
True
}}}
.
Proof
.
Proof
.
revert
ys
zs
.
revert
ys
zs
.
iLöb
as
"IH"
.
iLöb
as
"IH"
.
iIntros
(
ys
zs
Hcmp_spec
Φ
_)
"HΦ"
.
iIntros
(
ys
zs
)
.
iIntros
"#Hcmp_spec"
.
iIntros
(
Φ
)
.
iModIntro
.
iIntros
(_)
"HΦ"
.
wp_lam
.
wp_lam
.
destruct
ys
as
[|
y
ys
]
.
destruct
ys
as
[|
y
ys
]
.
{
wp_pures
.
rewrite
list_merge_emp1
.
by
iApply
(
"HΦ"
)
.
}
{
wp_pures
.
rewrite
list_merge_emp1
.
by
iApply
(
"HΦ"
)
.
}
...
@@ -80,7 +84,7 @@ Section ListSortExample.
...
@@ -80,7 +84,7 @@ Section ListSortExample.
{
wp_pures
.
rewrite
list_merge_emp2
.
by
iApply
(
"HΦ"
)
.
}
{
wp_pures
.
rewrite
list_merge_emp2
.
by
iApply
(
"HΦ"
)
.
}
wp_apply
(
lhead_spec
)=>
//
;
iIntros
"_"
.
wp_apply
(
lhead_spec
)=>
//
;
iIntros
"_"
.
wp_apply
(
lhead_spec
)=>
//
;
iIntros
"_"
.
wp_apply
(
lhead_spec
)=>
//
;
iIntros
"_"
.
wp_apply
(
Hcmp_spec
)=>
//
;
iIntros
"_"
.
wp_apply
(
"
Hcmp_spec
"
)=>
//
;
iIntros
"_"
.
rewrite
list_merge_cons
.
rewrite
list_merge_cons
.
destruct
(
decide
(
R
y
z
))
.
destruct
(
decide
(
R
y
z
))
.
-
rewrite
bool_decide_true
=>
//.
-
rewrite
bool_decide_true
=>
//.
...
@@ -98,14 +102,17 @@ Section ListSortExample.
...
@@ -98,14 +102,17 @@ Section ListSortExample.
"lxs"
<-
lmerge
"cmp"
"hys"
"hzs"
.
"lxs"
<-
lmerge
"cmp"
"hys"
"hzs"
.
Lemma
lmerge_ref_spec
(
cmp
:
val
)
ldx
tmp
ys
zs
:
Lemma
lmerge_ref_spec
(
cmp
:
val
)
ldx
tmp
ys
zs
:
cmp_spec
cmp
→
cmp_spec
cmp
-∗
{{{
ldx
↦
tmp
}}}
{{{
ldx
↦
tmp
}}}
lmerge_ref
cmp
#
ldx
(
encode
ys
)
(
encode
zs
)
lmerge_ref
cmp
#
ldx
(
encode
ys
)
(
encode
zs
)
{{{
RET
#
();
ldx
↦
encode
(
list_merge
R
ys
zs
)
}}}
.
{{{
RET
#
();
ldx
↦
encode
(
list_merge
R
ys
zs
)
}}}
.
Proof
.
Proof
.
iIntros
(
cmp_spec
Φ
)
"Hldx HΦ"
.
iIntros
"#Hcmp_spec"
.
iIntros
(
Φ
)
.
iModIntro
.
iIntros
"Hldx HΦ"
.
wp_lam
.
wp_lam
.
wp_apply
(
lmerge_spec
cmp
ys
zs
)=>
//.
wp_apply
(
lmerge_spec
cmp
ys
zs
with
"Hcmp_spec"
)=>
//.
iIntros
(_)
.
iIntros
(_)
.
wp_store
.
wp_store
.
by
iApply
(
"HΦ"
)
.
by
iApply
(
"HΦ"
)
.
...
@@ -132,7 +139,7 @@ Section ListSortExample.
...
@@ -132,7 +139,7 @@ Section ListSortExample.
send
"c"
#
Right
"xs"
.
send
"c"
#
Right
"xs"
.
Definition
sort_protocol
xs
:=
Definition
sort_protocol
xs
:=
(
<
?
>
cmp
@
⌜
cmp_spec
cmp
⌝
,
(
<
?
>
cmp
@
cmp_spec
cmp
,
<
?
>
l
@
l
↦
encode
xs
,
<
?
>
l
@
l
↦
encode
xs
,
<!>
l'
@
⌜
l
=
l'
⌝
∗
<!>
l'
@
⌜
l
=
l'
⌝
∗
(
∃
ys
:
list
T
,
(
∃
ys
:
list
T
,
...
@@ -151,8 +158,7 @@ Section ListSortExample.
...
@@ -151,8 +158,7 @@ Section ListSortExample.
iIntros
(
γ
c
xs
Φ
)
"Hstr HΦ"
.
iIntros
(
γ
c
xs
Φ
)
"Hstr HΦ"
.
wp_lam
.
wp_lam
.
wp_apply
(
recv_st_spec
N
val
with
"Hstr"
)
.
wp_apply
(
recv_st_spec
N
val
with
"Hstr"
)
.
iIntros
(
cmp
)
"[Hstr cmp_spec]"
.
iIntros
(
cmp
)
"[Hstr #Hcmp_spec]"
.
iDestruct
(
"cmp_spec"
)
as
%
Hcmp_spec
.
wp_pures
.
wp_pures
.
wp_apply
(
recv_st_spec
N
loc
with
"Hstr"
)
.
wp_apply
(
recv_st_spec
N
loc
with
"Hstr"
)
.
iIntros
(
v
)
"Hstr"
.
iIntros
(
v
)
"Hstr"
.
...
@@ -204,8 +210,7 @@ Section ListSortExample.
...
@@ -204,8 +210,7 @@ Section ListSortExample.
iDestruct
"Hzs'_sorted_of"
as
%
[
Hzs'_sorted
Hzs'_perm
]
.
iDestruct
"Hzs'_sorted_of"
as
%
[
Hzs'_sorted
Hzs'_perm
]
.
wp_load
.
wp_load
.
wp_load
.
wp_load
.
wp_pures
.
wp_apply
(
lmerge_ref_spec
with
"Hcmp_spec Hhdx"
)
.
wp_apply
(
lmerge_ref_spec
with
"[Hhdx]"
)=>
//.
iIntros
"Hhdx"
.
iIntros
"Hhdx"
.
wp_apply
(
send_st_spec
N
loc
with
"[Hstr Hhdx]"
)
.
wp_apply
(
send_st_spec
N
loc
with
"[Hstr Hhdx]"
)
.
{
{
...
@@ -227,9 +232,6 @@ Section ListSortExample.
...
@@ -227,9 +232,6 @@ Section ListSortExample.
Definition
compare_vals
:
val
:=
Definition
compare_vals
:
val
:=
λ
:
"x"
"y"
,
"x"
≤
"y"
.
λ
:
"x"
"y"
,
"x"
≤
"y"
.
Instance
total_le
:
Total
Z
.
le
.
Proof
.
intros
x
y
.
lia
.
Qed
.
Lemma
compare_vals_spec
(
x
y
:
Z
)
:
Lemma
compare_vals_spec
(
x
y
:
Z
)
:
{{{
True
}}}
{{{
True
}}}
compare_vals
(
encode
x
)
(
encode
y
)
compare_vals
(
encode
x
)
(
encode
y
)
...
@@ -260,19 +262,8 @@ Section ListSortExample.
...
@@ -260,19 +262,8 @@ Section ListSortExample.
}
}
wp_apply
(
send_st_spec
N
val
with
"[$Hstl]"
)
.
wp_apply
(
send_st_spec
N
val
with
"[$Hstl]"
)
.
{
{
iPureIntro
.
iIntros
(
x
y
Φ'
)
.
iIntros
(
x
y
Φ'
)
.
iModIntro
.
iIntros
(_)
"HΦ"
.
iApply
compare_vals_spec
=>
//.
iApply
compare_vals_spec
=>
//.
iNext
.
iIntros
(_)
.
destruct
(
decide
(
x
≤
y
))
.
-
rewrite
bool_decide_true
=>
//.
rewrite
bool_decide_true
=>
//.
by
iApply
"HΦ"
.
-
rewrite
bool_decide_false
=>
//.
rewrite
bool_decide_false
=>
//.
by
iApply
"HΦ"
.
}
}
iIntros
"Hstl"
.
iIntros
"Hstl"
.
wp_apply
(
send_st_spec
N
loc
with
"[Hc $Hstl]"
)
.
iFrame
.
wp_apply
(
send_st_spec
N
loc
with
"[Hc $Hstl]"
)
.
iFrame
.
...
...
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