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
632f2761
Commit
632f2761
authored
Sep 13, 2021
by
Rodolphe Lepigre
Browse files
Use [cast_to_bool] for expression conditionals as well.
parent
dd8c1d4f
Pipeline
#53600
passed with stage
in 30 minutes and 45 seconds
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
theories/lang/lang.v
View file @
632f2761
...
...
@@ -456,13 +456,9 @@ comparing pointers? (see lambda rust) *)
val_to_loc
v2
=
Some
l
→
valid_ptr
(
l
.
1
,
a
)
σ
.(
st_heap
)
→
expr_step
(
CopyAllocId
(
IntOp
it
)
(
Val
v1
)
(
Val
v2
))
σ
[]
(
Val
(
val_of_loc
(
l
.
1
,
a
)))
σ
[]
|
IfESI
v
it
e1
e2
n
σ
:
val_to_Z
v
it
=
Some
n
→
expr_step
(
IfE
(
IntOp
it
)
(
Val
v
)
e1
e2
)
σ
[]
(
if
bool_decide
(
n
≠
0
)
then
e1
else
e2
)
σ
[]
|
IfESP
v
e1
e2
l
σ
b
:
val_to_loc
v
=
Some
l
→
heap_loc_eq
l
NULL_loc
σ
.(
st_heap
)
=
Some
b
→
expr_step
(
IfE
PtrOp
(
Val
v
)
e1
e2
)
σ
[]
(
if
b
then
e2
else
e1
)
σ
[]
|
IfES
v
ot
e1
e2
b
σ
:
cast_to_bool
ot
v
σ
.(
st_heap
)
=
Some
b
→
expr_step
(
IfE
ot
(
Val
v
)
e1
e2
)
σ
[]
(
if
b
then
e1
else
e2
)
σ
[]
(* no rule for StuckE *)
.
...
...
theories/lang/lifting.v
View file @
632f2761
...
...
@@ -639,9 +639,10 @@ Lemma wp_if_int Φ it v e1 e2 n:
(
if
bool_decide
(
n
≠
0
)
then
WP
e1
{{
Φ
}}
else
WP
e2
{{
Φ
}})
-
∗
WP
IfE
(
IntOp
it
)
(
Val
v
)
e1
e2
{{
Φ
}}.
Proof
.
iIntros
(
?
)
"HΦ"
.
iIntros
(
Hn
)
"HΦ"
.
iApply
wp_lift_expr_step
;
auto
.
iIntros
(
σ
1
)
"?"
.
iModIntro
.
iSplit
;
first
by
eauto
8
using
IfESI
.
iIntros
(
σ
1
)
"?"
.
iModIntro
.
iSplit
.
{
iPureIntro
.
repeat
eexists
.
apply
IfES
.
rewrite
/=
Hn
//.
}
iIntros
(?
?
σ
2
efs
Hst
?)
"!> !>"
.
inv_expr_step
.
iSplit
=>
//.
iFrame
.
by
case_bool_decide
.
Qed
.
...
...
@@ -679,11 +680,11 @@ Lemma wp_if_ptr Φ v e1 e2 l:
(
if
bool_decide
(
l
≠
NULL_loc
)
then
WP
e1
{{
Φ
}}
else
WP
e2
{{
Φ
}})
-
∗
WP
IfE
PtrOp
(
Val
v
)
e1
e2
{{
Φ
}}.
Proof
.
iIntros
(
?
)
"Hlib HΦ"
.
iIntros
(
Hl
)
"Hlib HΦ"
.
iApply
wp_lift_expr_step
;
auto
.
iIntros
(
σ
1
)
"Hσ1"
.
iModIntro
.
iDestruct
(
wp_if_precond_heap_loc_eq
with
"Hlib Hσ1"
)
as
%
?
.
iSplit
;
first
by
eauto
8
using
IfESP
.
iDestruct
(
wp_if_precond_heap_loc_eq
with
"Hlib Hσ1"
)
as
%
Heq
.
iSplit
.
{
iPureIntro
.
repeat
eexists
.
apply
IfES
.
rewrite
/=
Hl
/=
Heq
//.
}
iIntros
(?
?
σ
2
efs
Hst
?)
"!> !>"
.
inv_expr_step
.
iSplit
=>
//.
iFrame
.
by
repeat
case_bool_decide
.
Qed
.
...
...
Rodolphe Lepigre
@lepigre
mentioned in merge request
!111 (merged)
·
Sep 13, 2021
mentioned in merge request
!111 (merged)
mentioned in merge request !111
Toggle commit list
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