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
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
tlsomers
Actris
Commits
d577c62a
Commit
d577c62a
authored
5 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Finish `list_sort_client_le_spec`.
parent
48118e9f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theories/examples/list_sort.v
+13
-5
13 additions, 5 deletions
theories/examples/list_sort.v
theories/utils/encodable.v
+4
-0
4 additions, 0 deletions
theories/utils/encodable.v
with
17 additions
and
5 deletions
theories/examples/list_sort.v
+
13
−
5
View file @
d577c62a
...
@@ -246,19 +246,27 @@ Section list_sort.
...
@@ -246,19 +246,27 @@ Section list_sort.
wp_lam
.
wp_pures
.
iApply
"HΦ"
.
eauto
10
with
iFrame
.
wp_lam
.
wp_pures
.
iApply
"HΦ"
.
eauto
10
with
iFrame
.
Qed
.
Qed
.
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
compare_vals
#
l
list_sort_client
compare_vals
#
l
{{{
ys
,
RET
#
();
⌜
Sorted
(
≤
)
ys
⌝
∗
⌜
ys
≡
ₚ
xs
⌝
∗
l
↦
val_encode
ys
}}}
.
{{{
ys
,
RET
#
();
⌜
Sorted
(
≤
)
ys
⌝
∗
⌜
ys
≡
ₚ
xs
⌝
∗
l
↦
val_encode
ys
}}}
.
Proof
.
Proof
.
assert
(
val_encode
x
s
=
val_encode
(
LitV
∘
LitInt
<$>
x
s
))
as
H
xs
.
assert
(
∀
zs
:
list
Z
,
val_encode
z
s
=
val_encode
(
LitV
∘
LitInt
<$>
z
s
))
as
H
enc
.
{
admit
.
}
{
intros
zs
.
induction
zs
;
f_equal
/=
;
auto
with
f_equal
.
}
iIntros
(
Φ
)
"Hl HΦ"
.
iIntros
(
Φ
)
"Hl HΦ"
.
iApply
(
list_sort_client_spec
IZ
(
≤
)
_
_
(
LitV
∘
LitInt
<$>
xs
)
xs
with
"[] [Hl] [HΦ]"
)
.
iApply
(
list_sort_client_spec
IZ
(
≤
)
_
_
(
LitV
∘
LitInt
<$>
xs
)
xs
with
"[] [Hl] [HΦ]"
)
.
{
iApply
compare_vals_spec
.
}
{
iApply
compare_vals_spec
.
}
{
rewrite
-
H
xs
{
Hxs
}
.
iFrame
"Hl"
.
{
rewrite
-
H
enc
.
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
.
}
iFrame
"IH"
.
by
iExists
x
.
}
{
admit
.
}
iIntros
"!>"
(
ys
ws
)
"(?&?&?&HI)"
.
Admitted
.
iAssert
⌜
ws
=
(
LitV
∘
LitInt
)
<$>
ys
⌝%
I
with
"[HI]"
as
%->
.
{
iInduction
ys
as
[|
y
ys
]
"IH"
forall
(
ws
);
destruct
ws
as
[|
w
ws
];
csimpl
;
try
done
.
iDestruct
"HI"
as
"[HI1 HI2]"
;
iDestruct
"HI1"
as
%
(?
&
->
&
->
)
.
by
iDestruct
(
"IH"
with
"HI2"
)
as
%->
.
}
rewrite
-
Henc
.
iApply
(
"HΦ"
$!
ys
with
"[$]"
)
.
Qed
.
End
list_sort
.
End
list_sort
.
This diff is collapsed.
Click to expand it.
theories/utils/encodable.v
+
4
−
0
View file @
d577c62a
...
@@ -53,11 +53,13 @@ Proof. split. by intros []. by intros [[]| | | |] ? [= <-]. Qed.
...
@@ -53,11 +53,13 @@ Proof. split. by intros []. by intros [[]| | | |] ? [= <-]. Qed.
Instance
pair_val_enc
`{
ValEnc
A
,
ValEnc
B
}
:
ValEnc
(
A
*
B
)
:=
λ
p
,
Instance
pair_val_enc
`{
ValEnc
A
,
ValEnc
B
}
:
ValEnc
(
A
*
B
)
:=
λ
p
,
(
val_encode
p
.
1
,
val_encode
p
.
2
)
%
V
.
(
val_encode
p
.
1
,
val_encode
p
.
2
)
%
V
.
Arguments
pair_val_enc
{_
_
_
_}
!
_
/.
Instance
pair_val_dec
`{
ValDec
A
,
ValDec
B
}
:
ValDec
(
A
*
B
)
:=
λ
v
,
Instance
pair_val_dec
`{
ValDec
A
,
ValDec
B
}
:
ValDec
(
A
*
B
)
:=
λ
v
,
match
v
with
match
v
with
|
PairV
v1
v2
=>
x1
←
val_decode
v1
;
x2
←
val_decode
v2
;
Some
(
x1
,
x2
)
|
PairV
v1
v2
=>
x1
←
val_decode
v1
;
x2
←
val_decode
v2
;
Some
(
x1
,
x2
)
|
_
=>
None
|
_
=>
None
end
.
end
.
Arguments
pair_val_dec
{_
_
_
_}
!
_
/.
Instance
pair_val_enc_dec
`{
ValEncDec
A
,
ValEncDec
B
}
:
ValEncDec
(
A
*
B
)
.
Instance
pair_val_enc_dec
`{
ValEncDec
A
,
ValEncDec
B
}
:
ValEncDec
(
A
*
B
)
.
Proof
.
Proof
.
split
.
split
.
...
@@ -70,12 +72,14 @@ Qed.
...
@@ -70,12 +72,14 @@ Qed.
Instance
option_val_enc
`{
ValEnc
A
}
:
ValEnc
(
option
A
)
:=
λ
mx
,
Instance
option_val_enc
`{
ValEnc
A
}
:
ValEnc
(
option
A
)
:=
λ
mx
,
match
mx
with
Some
x
=>
SOMEV
(
val_encode
x
)
|
None
=>
NONEV
end
%
V
.
match
mx
with
Some
x
=>
SOMEV
(
val_encode
x
)
|
None
=>
NONEV
end
%
V
.
Arguments
option_val_enc
{_
_}
!
_
/.
Instance
option_val_dec
`{
ValDec
A
}
:
ValDec
(
option
A
)
:=
λ
v
,
Instance
option_val_dec
`{
ValDec
A
}
:
ValDec
(
option
A
)
:=
λ
v
,
match
v
with
match
v
with
|
SOMEV
v
=>
x
←
val_decode
v
;
Some
(
Some
x
)
|
SOMEV
v
=>
x
←
val_decode
v
;
Some
(
Some
x
)
|
NONEV
=>
Some
None
|
NONEV
=>
Some
None
|
_
=>
None
|
_
=>
None
end
.
end
.
Arguments
option_val_dec
{_
_}
!
_
/.
Instance
option_val_enc_dec
`{
ValEncDec
A
}
:
ValEncDec
(
option
A
)
.
Instance
option_val_enc_dec
`{
ValEncDec
A
}
:
ValEncDec
(
option
A
)
.
Proof
.
Proof
.
split
.
split
.
...
...
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