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
595edcf5
Commit
595edcf5
authored
5 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Tweak.
parent
513d2cd7
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_instances.v
+12
-15
12 additions, 15 deletions
theories/examples/list_sort_instances.v
with
12 additions
and
15 deletions
theories/examples/list_sort_instances.v
+
12
−
15
View file @
595edcf5
...
@@ -4,45 +4,42 @@ From iris.heap_lang Require Import proofmode notation.
...
@@ -4,45 +4,42 @@ From iris.heap_lang Require Import proofmode notation.
From
osiris
.
utils
Require
Import
list
.
From
osiris
.
utils
Require
Import
list
.
From
osiris
.
examples
Require
Import
list_sort
.
From
osiris
.
examples
Require
Import
list_sort
.
Definition
cmpZ
:
val
:=
λ
:
"x"
"y"
,
"x"
≤
"y"
.
Section
list_sort_instances
.
Section
list_sort_instances
.
Context
`{
!
heapG
Σ
,
!
proto_chanG
Σ
}
(
N
:
namespace
)
.
Context
`{
!
heapG
Σ
,
!
proto_chanG
Σ
}
(
N
:
namespace
)
.
(* Example: Sort of integers *)
(* Example: Sort of integers *)
Definition
IZ
(
x
:
Z
)
(
v
:
val
)
:
iProp
Σ
:=
Definition
IZ
(
x
:
Z
)
(
v
:
val
)
:
iProp
Σ
:=
⌜
v
=
#
x
⌝%
I
.
⌜∃
w
,
v
=
LitV
$
LitInt
w
∧
x
=
w
⌝%
I
.
Definition
compareZ
:
val
:=
λ
:
"x"
"y"
,
"x"
≤
"y"
.
Lemma
c
o
mp
are
Z_spec
:
cmp_spec
IZ
(
≤
)
c
o
mp
are
Z
.
Lemma
cmpZ_spec
:
cmp_spec
IZ
(
≤
)
cmpZ
.
Proof
.
Proof
.
iIntros
(
x
x'
v
v'
Φ
)
"!>"
.
rewrite
/
IZ
.
iIntros
(
x
x'
v
v'
Φ
[
->
->
])
"!> HΦ"
.
iIntros
([[
w
[
->
->
]]
[
w'
[
->
->
]]])
"HΦ"
.
wp_lam
.
wp_pures
.
by
iApply
"HΦ"
.
wp_lam
.
wp_pures
.
iApply
"HΦ"
.
eauto
10
with
iFrame
.
Qed
.
Qed
.
Local
Arguments
val_encode
_
_
!
_
/.
Local
Arguments
val_encode
_
_
!
_
/.
Lemma
list_sort_client_le_spec
l
(
xs
:
list
Z
)
:
Lemma
list_sort_client_le_spec
l
(
xs
:
list
Z
)
:
{{{
l
↦
val_encode
xs
}}}
{{{
l
↦
val_encode
xs
}}}
list_sort_client
c
o
mp
are
Z
#
l
list_sort_client
cmpZ
#
l
{{{
ys
,
RET
#
();
⌜
Sorted
(
≤
)
ys
⌝
∗
⌜
ys
≡
ₚ
xs
⌝
∗
l
↦
val_encode
ys
}}}
.
{{{
ys
,
RET
#
();
⌜
Sorted
(
≤
)
ys
⌝
∗
⌜
ys
≡
ₚ
xs
⌝
∗
l
↦
val_encode
ys
}}}
.
Proof
.
Proof
.
assert
(
∀
zs
:
list
Z
,
val_encode
zs
=
val_encode
(
LitV
∘
LitInt
<$>
zs
))
as
Henc
.
assert
(
∀
zs
:
list
Z
,
val_encode
zs
=
val_encode
(
LitV
∘
LitInt
<$>
zs
))
as
Henc
.
{
intros
zs
.
induction
zs
;
f_equal
/=
;
auto
with
f_equal
.
}
{
intros
zs
.
induction
zs
;
f_equal
/=
;
auto
with
f_equal
.
}
iIntros
(
Φ
)
"Hl HΦ"
.
iIntros
(
Φ
)
"Hl HΦ"
.
iApply
(
list_sort_client_spec
N
IZ
(
≤
)
_
_
(
LitV
∘
LitInt
<$>
xs
)
xs
with
"[] [Hl] [HΦ]"
)
.
iApply
(
list_sort_client_spec
N
IZ
(
≤
)
_
_
(
LitV
∘
LitInt
<$>
xs
)
xs
with
"[] [Hl] [HΦ]"
)
.
{
iApply
c
o
mp
are
Z_spec
.
}
{
iApply
cmpZ_spec
.
}
{
rewrite
-
Henc
.
iFrame
"Hl"
.
{
rewrite
-
Henc
.
iFrame
"Hl"
.
iInduction
xs
as
[|
x
xs
]
"IH"
;
csimpl
;
first
by
iFrame
.
iInduction
xs
as
[|
x
xs
]
"IH"
;
csimpl
;
first
by
iFrame
.
iFrame
"IH"
.
by
iExists
x
.
}
by
iFrame
"IH"
.
}
iIntros
"!>"
(
ys
ws
)
"(?&?&?&HI)"
.
iIntros
"!>"
(
ys
ws
)
"(?&?&?&HI)"
.
iAssert
⌜
ws
=
(
LitV
∘
LitInt
)
<$>
ys
⌝%
I
with
"[HI]"
as
%->
.
iAssert
⌜
ws
=
(
LitV
∘
LitInt
)
<$>
ys
⌝%
I
with
"[HI]"
as
%->
.
{
iInduction
ys
as
[|
y
ys
]
"IH"
forall
(
ws
);
{
iInduction
ys
as
[|
y
ys
]
"IH"
forall
(
ws
);
destruct
ws
as
[|
w
ws
];
csimpl
;
try
done
.
destruct
ws
as
[|
w
ws
];
csimpl
;
try
done
.
iDestruct
"HI"
as
"[
HI1
HI2]"
;
iDestruct
"HI1"
as
%
(?
&
->
&
->
)
.
iDestruct
"HI"
as
"[
->
HI2]"
.
by
iDestruct
(
"IH"
with
"HI2"
)
as
%->
.
}
by
iDestruct
(
"IH"
with
"HI2"
)
as
%->
.
}
rewrite
-
Henc
.
iApply
(
"HΦ"
$!
ys
with
"[$]"
)
.
rewrite
-
Henc
.
iApply
(
"HΦ"
$!
ys
with
"[$]"
)
.
Qed
.
Qed
.
End
list_sort_instances
.
End
list_sort_instances
.
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