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
e4f77c74
Commit
e4f77c74
authored
5 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Fix merge.
parent
fab8ab30
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/examples/sort.v
+25
-24
25 additions, 24 deletions
theories/examples/sort.v
with
25 additions
and
24 deletions
theories/examples/sort.v
+
25
−
24
View file @
e4f77c74
...
...
@@ -3,16 +3,15 @@ From actris.channel Require Import proto_channel proofmode.
From
iris
.
heap_lang
Require
Import
proofmode
notation
.
From
actris
.
utils
Require
Export
llist
compare
.
Definition
lmerge
:
val
.
(*
Definition
lmerge
:
val
:=
rec
:
"go"
"cmp"
"ys"
"zs"
:=
if: lisnil "ys" then "zs" else
if: lisnil "zs" then
"ys"
else
if
:
lisnil
"ys"
then
lapp
"ys"
"zs"
else
if
:
lisnil
"zs"
then
#
()
else
let
:
"y"
:=
lhead
"ys"
in
let
:
"z"
:=
lhead
"zs"
in
if
:
"cmp"
"y"
"z"
then lcons "y" ("go" "cmp" (ltail "ys") "zs")
else lcons "z" ("go" "cmp" "ys" (ltail "zs")).
*)
Admitted
.
then
lpop
"ys"
;;
"go"
"cmp"
"ys"
"zs"
;;
lcons
"y"
"ys"
;;
#
()
else
lpop
"zs"
;;
"go"
"cmp"
"ys"
"zs"
;;
lcons
"z"
"ys"
;;
#
()
.
Definition
sort_service
:
val
:=
rec
:
"go"
"c"
:=
...
...
@@ -51,32 +50,34 @@ Section sort.
}}}
lmerge
cmp
#
l1
#
l2
{{{
ws
,
RET
#
();
llist
l1
ws
∗
[
∗
list
]
x
;
v
∈
list_merge
R
xs1
xs2
;
ws
,
I
x
v
}}}
.
Proof
.
(*
iIntros "#Hcmp" (Ψ) "!> [HI1 HI2] HΨ". iLöb as "IH" forall (xs1 xs2 vs1 vs2 Ψ).
wp_lam. wp_apply (lisnil_spec with "[//]"); iIntros (_).
Proof
.
iIntros
"#Hcmp"
(
Ψ
)
"!> (Hl1 & Hl2 & HI1 & HI2) HΨ"
.
iLöb
as
"IH"
forall
(
l2
xs1
xs2
vs1
vs2
Ψ
)
.
wp_lam
.
wp_apply
(
lisnil_spec
with
"Hl1"
);
iIntros
"Hl1"
.
destruct
xs1
as
[|
x1
xs1
],
vs1
as
[|
v1
vs1
];
simpl
;
done
||
wp_pures
.
{ iApply "HΨ". by rewrite list_merge_nil_l. }
wp_apply (lisnil_spec with "[//]"); iIntros (_).
{
wp_apply
(
lapp_spec
with
"[$Hl1 $Hl2]"
);
iIntros
"[Hl1 _] /="
.
iApply
"HΨ"
.
iFrame
.
by
rewrite
list_merge_nil_l
.
}
wp_apply
(
lisnil_spec
with
"Hl2"
);
iIntros
"Hl2"
.
destruct
xs2
as
[|
x2
xs2
],
vs2
as
[|
v2
vs2
];
simpl
;
done
||
wp_pures
.
{
iApply
"HΨ"
.
iFrame
.
}
wp_apply (lhead_spec with "
[//]
"); iIntros
(_)
.
wp_apply (lhead_spec with "
[//]
"); iIntros
(_)
.
wp_apply
(
lhead_spec
with
"
Hl1
"
);
iIntros
"Hl1"
.
wp_apply
(
lhead_spec
with
"
Hl2
"
);
iIntros
"Hl2"
.
iDestruct
"HI1"
as
"[HI1 HI1']"
;
iDestruct
"HI2"
as
"[HI2 HI2']"
.
wp_apply
(
"Hcmp"
with
"[$HI1 $HI2]"
);
iIntros
"[HI1 HI2]"
.
case_bool_decide
;
wp_pures
.
-
rewrite
decide_True
//.
wp_apply (l
tail
_spec with "
[//]
"); iIntros
(_)
.
wp_apply ("IH" $! _ (x2 :: _) with "H
I1'[
HI2 HI2']")
; [simpl; iFrame|]
.
iIntros (ws) "HI".
wp_apply (lcons_spec with "
[//]
"); iIntros
(_)
.
iApply "HΨ". iFrame.
wp_apply
(
l
pop
_spec
with
"
Hl1
"
);
iIntros
"Hl1"
.
wp_apply
(
"IH"
$!
_
_
(
x2
::
_)
with
"H
l1 Hl2 HI1' [$
HI2
$
HI2']"
)
.
iIntros
(
ws
)
"
[Hl1
HI
]
"
.
wp_apply
(
lcons_spec
with
"
Hl1
"
);
iIntros
"Hl1"
.
wp_pures
.
iApply
"HΨ"
.
iFrame
.
-
rewrite
decide_False
//.
wp_apply (l
tail
_spec with "
[//]
"); iIntros
(_)
.
wp_apply ("IH" $! (x1 :: _) with "
[
HI1 HI1'] HI2'")
; [simpl; iFrame|]
.
iIntros (ws) "HI".
wp_apply (lcons_spec with "
[//]
"); iIntros
(_)
.
iApply "HΨ". iFrame.
Qed.
*)
Admitted
.
wp_apply
(
l
pop
_spec
with
"
Hl2
"
);
iIntros
"Hl2"
.
wp_apply
(
"IH"
$!
_
(
x1
::
_)
with
"
Hl1 Hl2 [$
HI1
$
HI1'] HI2'"
)
.
iIntros
(
ws
)
"
[Hl1
HI
]
"
.
wp_apply
(
lcons_spec
with
"
Hl1
"
);
iIntros
"Hl1"
.
wp_pures
.
iApply
"HΨ"
.
iFrame
.
Qed
.
Lemma
sort_service_spec
p
c
:
{{{
c
↣
iProto_dual
sort_protocol
<++>
p
@
N
}}}
...
...
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