Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Iris
RefinedC
Commits
56b1e8a0
Commit
56b1e8a0
authored
Aug 18, 2021
by
Michael Sammler
Browse files
add simple instances for lookup of list that results in an evar
parent
8823bd56
Pipeline
#52221
passed with stage
in 14 minutes and 30 seconds
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
theories/lithium/simpl_instances.v
View file @
56b1e8a0
...
...
@@ -455,6 +455,18 @@ Proof.
rewrite
list_lookup_insert_Some
.
naive_solver
.
Qed
.
Global
Instance
simpl_and_lookup_protected
{
A
}
(
l
:
list
A
)
(
i
:
nat
)
v
`
{!
IsProtected
v
}
`
{
Inhabited
A
}
:
SimplAndRel
(=)
(
l
!!
i
)
(
Some
v
)
(
λ
T
,
i
<
length
l
∧
v
=
l
!!!
i
∧
T
).
Proof
.
split
.
-
move
=>
-[?
[->
?]].
split
;
[|
done
].
apply
:
list_lookup_lookup_total_lt
.
lia
.
-
move
=>
[/
list_lookup_alt
?].
naive_solver
lia
.
Qed
.
Global
Instance
simpl_and_lookup_lookup_total
{
A
}
(
l
:
list
A
)
(
i
:
nat
)
`
{
Inhabited
A
}
:
SimplBothRel
(=)
(
l
!!
i
)
(
Some
(
l
!!!
i
))
(
i
<
length
l
).
Proof
.
rewrite
/
SimplBothRel
list_lookup_alt
.
naive_solver
lia
.
Qed
.
Global
Instance
simpl_learn_insert_some_len_impl
{
A
}
l
i
(
x
:
A
)
:
(* The false is important here as we learn additional information,
but don't want to get stuck in an endless loop. *)
...
...
tutorial/t07_arrays.c
View file @
56b1e8a0
...
...
@@ -16,6 +16,15 @@ void permute(int* ar, int i, int j){
ar
[
j
]
=
k
;
}
[[
rc
::
parameters
(
"ar : loc"
,
"elts : {list Z}"
,
"n : nat"
)]]
[[
rc
::
args
(
"ar @ &own<array<i32, {elts `at_type` (int i32)}>>"
,
"n @ int<i32>"
)]]
[[
rc
::
requires
(
"{2 < length elts}"
)]]
[[
rc
::
ensures
(
"own ar : array<i32, {elts `at_type` (int i32)}>"
)]]
void
use_permute
(
int
*
ar
,
int
n
)
{
permute
(
ar
,
1
,
2
);
permute
(
ar
,
1
,
2
);
}
[[
rc
::
parameters
(
"ar : loc"
,
"elts : {list Z}"
,
"n : nat"
)]]
[[
rc
::
args
(
"ar @&own<array<i32, {elts `at_type` (int i32)}>>"
)]]
[[
rc
::
args
(
"n @ int<i32>"
)]]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment