Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Iris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
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
Simcha van Collem
Iris
Commits
7c354ddb
Commit
7c354ddb
authored
9 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
change some lfiting lemmas to make it clear why they are called 'atomic'
parent
0dbb9032
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
docs/derived.tex
+4
-4
4 additions, 4 deletions
docs/derived.tex
heap_lang/lang.v
+1
-1
1 addition, 1 deletion
heap_lang/lang.v
heap_lang/lifting.v
+14
-10
14 additions, 10 deletions
heap_lang/lifting.v
program_logic/lifting.v
+16
-14
16 additions, 14 deletions
program_logic/lifting.v
with
35 additions
and
29 deletions
docs/derived.tex
+
4
−
4
View file @
7c354ddb
...
...
@@ -208,13 +208,13 @@ The following rules can be derived for Hoare triples.
We can derive some specialized forms of the lifting axioms for the operational semantics.
\begin{mathparpagebreakable}
\infer
[wp-lift-atomic-step]
{
\to
val
(
\expr
_
1)
=
\bot
\and
{
\
a
to
mic
(
\expr
_
1)
\and
\red
(
\expr
_
1,
\state
_
1)
\and
\All
\expr
_
2,
\state
_
2,
\expr
_
f.
\expr
_
1,
\state
_
1
\step
\expr
_
2,
\state
_
2,
\expr
_
f
\Ra
\
Exists\val
_
2.
\toval
(
\expr
_
2) =
\val
_
2
\land
\pred
(
\val
_
2,
\state
_
2,
\expr
_
f)
}
{
\later\ownPhys
{
\state
_
1
}
*
\later\All
\val
,
\state
_
2,
\expr
_
f.
\pred
(
\val
,
\state
_
2,
\expr
_
f)
\land
\ownPhys
{
\state
_
2
}
\wand
\prop
*
\wpre
{
\expr
_
f
}
[
\top
]
{
\Ret\any
.
\TRUE
}
\proves
\wpre
{
\expr
_
1
}
[
\mask
_
1]
{
\Ret\va
l
.
\prop
}}
\All
\expr
_
2,
\state
_
2,
\expr
_
f.
\expr
_
1,
\state
_
1
\step
\expr
_
2,
\state
_
2,
\expr
_
f
\Ra
\
pred
(
\expr
_
2,
\state
_
2,
\expr
_
f)
}
{
\later\ownPhys
{
\state
_
1
}
*
\later\All
\val
_
2
,
\state
_
2,
\expr
_
f.
\pred
(
\
of
val
(
\val
)
,
\state
_
2,
\expr
_
f)
\land
\ownPhys
{
\state
_
2
}
\wand
\prop
[\val_2/\var]
*
\wpre
{
\expr
_
f
}
[
\top
]
{
\Ret\any
.
\TRUE
}
\proves
\wpre
{
\expr
_
1
}
[
\mask
_
1]
{
\Ret\va
r
.
\prop
}}
\infer
[wp-lift-atomic-det-step]
{
\to
val
(
\expr
_
1)
=
\bot
\and
{
\
a
to
mic
(
\expr
_
1)
\and
\red
(
\expr
_
1,
\state
_
1)
\and
\All
\expr
'
_
2,
\state
'
_
2,
\expr
_
f'.
\expr
_
1,
\state
_
1
\step
\expr
_
2,
\state
_
2,
\expr
_
f
\Ra
\state
_
2 =
\state
_
2'
\land
\toval
(
\expr
_
2') =
\val
_
2
\land
\expr
_
f =
\expr
_
f'
}
{
\later\ownPhys
{
\state
_
1
}
*
\later
(
\ownPhys
{
\state
_
2
}
\wand
\prop
[\val_2/\var]
*
\wpre
{
\expr
_
f
}
[
\top
]
{
\Ret\any
.
\TRUE
}
)
\proves
\wpre
{
\expr
_
1
}
[
\mask
_
1]
{
\Ret\var
.
\prop
}}
...
...
This diff is collapsed.
Click to expand it.
heap_lang/lang.v
+
1
−
1
View file @
7c354ddb
...
...
@@ -447,7 +447,7 @@ Proof.
end
;
auto
with
f_equal
.
Qed
.
Instance
:
Inj
(
=
)
(
=
)
of_val
.
Instance
of_val_inj
:
Inj
(
=
)
(
=
)
of_val
.
Proof
.
by
intros
??
Hv
;
apply
(
inj
Some
);
rewrite
-!
to_of_val
Hv
.
Qed
.
Instance
fill_item_inj
Ki
:
Inj
(
=
)
(
=
)
(
fill_item
Ki
)
.
...
...
This diff is collapsed.
Click to expand it.
heap_lang/lifting.v
+
14
−
10
View file @
7c354ddb
...
...
@@ -25,16 +25,18 @@ Lemma wp_alloc_pst E σ e v Φ :
⊢
WP
Alloc
e
@
E
{{
Φ
}}
.
Proof
.
(* TODO RJ: This works around ssreflect bug #22. *)
intros
.
set
(
φ
v'
σ'
ef
:=
∃
l
,
ef
=
None
∧
v
'
=
Loc
V
l
∧
σ'
=
<
[
l
:=
v
]
>
σ
∧
σ
!!
l
=
None
)
.
intros
.
set
(
φ
(
e'
:
expr
[])
σ'
ef
:=
∃
l
,
ef
=
None
∧
e
'
=
Loc
l
∧
σ'
=
<
[
l
:=
v
]
>
σ
∧
σ
!!
l
=
None
)
.
rewrite
-
(
wp_lift_atomic_step
(
Alloc
e
)
φ
σ
)
//
/
φ
;
last
by
intros
;
inv_step
;
eauto
8
.
last
(
by
intros
;
inv_step
;
eauto
8
);
last
(
by
simpl
;
eauto
)
.
apply
sep_mono
,
later_mono
;
first
done
.
apply
forall_intro
=>
e
2
;
apply
forall_intro
=>
σ2
;
apply
forall_intro
=>
ef
.
apply
forall_intro
=>
v
2
;
apply
forall_intro
=>
σ2
;
apply
forall_intro
=>
ef
.
apply
wand_intro_l
.
rewrite
always_and_sep_l
-
assoc
-
always_and_sep_l
.
apply
const_elim_l
=>
-
[
l
[
->
[
->
[
->
?]]]]
.
by
rewrite
(
forall_elim
l
)
right_id
const_equiv
//
left_id
wand_elim_r
.
apply
const_elim_l
=>
-
[
l
[
->
[
Hl
[
->
?]]]]
.
rewrite
(
forall_elim
l
)
right_id
const_equiv
//
left_id
wand_elim_r
.
rewrite
-
(
of_to_val
(
Loc
l
)
(
LocV
l
))
//
in
Hl
.
apply
of_val_inj
in
Hl
.
by
subst
.
Qed
.
Lemma
wp_load_pst
E
σ
l
v
Φ
:
...
...
@@ -42,7 +44,7 @@ Lemma wp_load_pst E σ l v Φ :
(
▷
ownP
σ
★
▷
(
ownP
σ
-★
Φ
v
))
⊢
WP
Load
(
Loc
l
)
@
E
{{
Φ
}}
.
Proof
.
intros
.
rewrite
-
(
wp_lift_atomic_det_step
σ
v
σ
None
)
?right_id
//
;
last
by
intros
;
inv_step
;
eauto
using
to_of_val
.
last
(
by
intros
;
inv_step
;
eauto
using
to_of_val
);
simpl
;
by
eauto
.
Qed
.
Lemma
wp_store_pst
E
σ
l
e
v
v'
Φ
:
...
...
@@ -51,7 +53,7 @@ Lemma wp_store_pst E σ l e v v' Φ :
⊢
WP
Store
(
Loc
l
)
e
@
E
{{
Φ
}}
.
Proof
.
intros
.
rewrite
-
(
wp_lift_atomic_det_step
σ
(
LitV
LitUnit
)
(
<
[
l
:=
v
]
>
σ
)
None
)
?right_id
//
;
last
by
intros
;
inv_step
;
eauto
.
?right_id
//
;
last
(
by
intros
;
inv_step
;
eauto
);
simpl
;
by
eauto
.
Qed
.
Lemma
wp_cas_fail_pst
E
σ
l
e1
v1
e2
v2
v'
Φ
:
...
...
@@ -60,7 +62,8 @@ Lemma wp_cas_fail_pst E σ l e1 v1 e2 v2 v' Φ :
⊢
WP
CAS
(
Loc
l
)
e1
e2
@
E
{{
Φ
}}
.
Proof
.
intros
.
rewrite
-
(
wp_lift_atomic_det_step
σ
(
LitV
$
LitBool
false
)
σ
None
)
?right_id
//
;
last
by
intros
;
inv_step
;
eauto
.
?right_id
//
;
last
(
by
intros
;
inv_step
;
eauto
);
simpl
;
split_and
?;
by
eauto
.
Qed
.
Lemma
wp_cas_suc_pst
E
σ
l
e1
v1
e2
v2
Φ
:
...
...
@@ -69,7 +72,8 @@ Lemma wp_cas_suc_pst E σ l e1 v1 e2 v2 Φ :
⊢
WP
CAS
(
Loc
l
)
e1
e2
@
E
{{
Φ
}}
.
Proof
.
intros
.
rewrite
-
(
wp_lift_atomic_det_step
σ
(
LitV
$
LitBool
true
)
(
<
[
l
:=
v2
]
>
σ
)
None
)
?right_id
//
;
last
by
intros
;
inv_step
;
eauto
.
(
<
[
l
:=
v2
]
>
σ
)
None
)
?right_id
//
;
last
(
by
intros
;
inv_step
;
eauto
);
simpl
;
split_and
?;
by
eauto
.
Qed
.
(** Base axioms for core primitives of the language: Stateless reductions *)
...
...
This diff is collapsed.
Click to expand it.
program_logic/lifting.v
+
16
−
14
View file @
7c354ddb
...
...
@@ -61,40 +61,42 @@ Qed.
Import
uPred
.
Lemma
wp_lift_atomic_step
{
E
Φ
}
e1
(
φ
:
val
Λ
→
state
Λ
→
option
(
expr
Λ
)
→
Prop
)
σ1
:
to
_val
e1
=
None
→
(
φ
:
expr
Λ
→
state
Λ
→
option
(
expr
Λ
)
→
Prop
)
σ1
:
a
to
mic
e1
→
reducible
e1
σ1
→
(
∀
e2
σ2
ef
,
prim_step
e1
σ1
e2
σ2
ef
→
∃
v2
,
to_val
e2
=
Some
v2
∧
φ
v
2
σ2
ef
)
→
(
▷
ownP
σ1
★
▷
∀
v2
σ2
ef
,
■
φ
v2
σ2
ef
∧
ownP
σ2
-★
Φ
v2
★
wp_fork
ef
)
prim_step
e1
σ1
e2
σ2
ef
→
φ
e
2
σ2
ef
)
→
(
▷
ownP
σ1
★
▷
∀
v2
σ2
ef
,
■
φ
(
of_val
v2
)
σ2
ef
∧
ownP
σ2
-★
Φ
v2
★
wp_fork
ef
)
⊢
WP
e1
@
E
{{
Φ
}}
.
Proof
.
intros
.
rewrite
-
(
wp_lift_step
E
E
(
λ
e2
σ2
ef
,
∃
v2
,
to_val
e2
=
Some
v2
∧
φ
v2
σ2
ef
)
_
e1
σ1
)
//
;
[]
.
intros
.
rewrite
-
(
wp_lift_step
E
E
(
λ
e2
σ2
ef
,
is_Some
(
to_val
e2
)
∧
φ
e2
σ2
ef
)
_
e1
σ1
)
//
;
try
by
(
eauto
using
atomic_not_val
,
atomic_step
)
.
rewrite
-
pvs_intro
.
apply
sep_mono
,
later_mono
;
first
done
.
apply
forall_intro
=>
e2'
;
apply
forall_intro
=>
σ2'
.
apply
forall_intro
=>
ef
;
apply
wand_intro_l
.
rewrite
always_and_sep_l
-
assoc
-
always_and_sep_l
.
apply
const_elim_l
=>
-
[
v2
'
[
Hv
?]
]
/=.
apply
const_elim_l
=>
-
[
[
v2
Hv
]
?]
/=.
rewrite
-
pvs_intro
.
rewrite
(
forall_elim
v2'
)
(
forall_elim
σ2'
)
(
forall_elim
ef
)
const_equiv
//.
by
rewrite
left_id
wand_elim_r
-
(
wp_value
_
_
e2'
v2'
)
.
rewrite
(
forall_elim
v2
)
(
forall_elim
σ2'
)
(
forall_elim
ef
)
const_equiv
//.
rewrite
left_id
wand_elim_r
-
(
wp_value
_
_
e2'
v2
)
//.
by
erewrite
of_to_val
.
Qed
.
Lemma
wp_lift_atomic_det_step
{
E
Φ
e1
}
σ1
v2
σ2
ef
:
to
_val
e1
=
None
→
a
to
mic
e1
→
reducible
e1
σ1
→
(
∀
e2'
σ2'
ef'
,
prim_step
e1
σ1
e2'
σ2'
ef'
→
σ2
=
σ2'
∧
to_val
e2'
=
Some
v2
∧
ef
=
ef'
)
→
(
▷
ownP
σ1
★
▷
(
ownP
σ2
-★
Φ
v2
★
wp_fork
ef
))
⊢
WP
e1
@
E
{{
Φ
}}
.
Proof
.
intros
.
rewrite
-
(
wp_lift_atomic_step
_
(
λ
v
2'
σ2'
ef'
,
σ2
=
σ2'
∧
v2
=
v2
'
∧
ef
=
ef'
)
σ1
)
//
;
last
naive_solver
.
intros
.
rewrite
-
(
wp_lift_atomic_step
_
(
λ
e
2'
σ2'
ef'
,
σ2
=
σ2'
∧
to_val
e2'
=
Some
v2
∧
ef
=
ef'
)
σ1
)
//.
apply
sep_mono
,
later_mono
;
first
done
.
apply
forall_intro
=>
e2'
;
apply
forall_intro
=>
σ2'
;
apply
forall_intro
=>
ef'
.
apply
wand_intro_l
.
rewrite
always_and_sep_l
-
assoc
-
always_and_sep_l
.
apply
const_elim_l
=>
-
[
->
[
->
->
]]
/=.
by
rewrite
wand_elim_r
.
rewrite
always_and_sep_l
-
assoc
-
always_and_sep_l
to_of_val
.
apply
const_elim_l
=>
-
[
->
[
[
->
]
->
]]
/=.
by
rewrite
wand_elim_r
.
Qed
.
Lemma
wp_lift_pure_det_step
{
E
Φ
}
e1
e2
ef
:
...
...
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