Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lambda-rust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Simon Spies
lambda-rust
Commits
660239df
Commit
660239df
authored
7 years ago
by
Jacques-Henri Jourdan
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/eq-loc'
parents
2b874427
89129662
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
_CoqProject
+1
-0
1 addition, 0 deletions
_CoqProject
theories/lang/lib/tests.v
+18
-0
18 additions, 0 deletions
theories/lang/lib/tests.v
theories/lang/lifting.v
+42
-5
42 additions, 5 deletions
theories/lang/lifting.v
theories/lang/proofmode.v
+2
-0
2 additions, 0 deletions
theories/lang/proofmode.v
with
63 additions
and
5 deletions
_CoqProject
+
1
−
0
View file @
660239df
...
...
@@ -27,6 +27,7 @@ theories/lang/lib/new_delete.v
theories/lang/lib/spawn.v
theories/lang/lib/lock.v
theories/lang/lib/arc.v
theories/lang/lib/tests.v
theories/typing/base.v
theories/typing/type.v
theories/typing/util.v
...
...
This diff is collapsed.
Click to expand it.
theories/lang/lib/tests.v
0 → 100644
+
18
−
0
View file @
660239df
From
iris
.
program_logic
Require
Import
weakestpre
.
From
iris
.
proofmode
Require
Import
tactics
.
From
lrust
.
lang
Require
Import
lang
proofmode
notation
.
Set
Default
Proof
Using
"Type"
.
Section
tests
.
Context
`{
!
lrustG
Σ
}
.
Lemma
test_location_cmp
E
(
l1
l2
:
loc
)
q1
q2
v1
v2
:
{{{
▷
l1
↦
{
q1
}
v1
∗
▷
l2
↦
{
q2
}
v2
}}}
#
l1
=
#
l2
@
E
{{{
(
b
:
bool
),
RET
LitV
(
lit_of_bool
b
);
(
if
b
then
⌜
l1
=
l2
⌝
else
⌜
l1
≠
l2
⌝
)
∗
l1
↦
{
q1
}
v1
∗
l2
↦
{
q2
}
v2
}}}
.
Proof
.
iIntros
(
Φ
)
"[Hl1 Hl2] HΦ"
.
wp_op
;
try
(
by
eauto
);
[|];
intros
?;
iApply
"HΦ"
;
by
iFrame
.
Qed
.
End
tests
.
This diff is collapsed.
Click to expand it.
theories/lang/lifting.v
+
42
−
5
View file @
660239df
...
...
@@ -268,15 +268,54 @@ Lemma wp_eq_int E (n1 n2 : Z) P Φ :
(
n1
≠
n2
→
P
-∗
▷
Φ
(
LitV
false
))
→
P
-∗
WP
BinOp
EqOp
(
Lit
(
LitInt
n1
))
(
Lit
(
LitInt
n2
))
@
E
{{
Φ
}}
.
Proof
.
iIntros
(
H
l
Hg
)
"HP"
.
destruct
(
bool_decide_reflect
(
n1
=
n2
));
[
rewrite
H
l
//|
rewrite
H
g
//
];
clear
H
l
Hg
;
iApply
wp_bin_op_pure
;
subst
.
iIntros
(
H
eq
Hne
)
"HP"
.
destruct
(
bool_decide_reflect
(
n1
=
n2
));
[
rewrite
H
eq
//|
rewrite
H
ne
//
];
clear
H
ne
Heq
;
iApply
wp_bin_op_pure
;
subst
.
-
intros
.
apply
BinOpEqTrue
.
constructor
.
-
iNext
;
iIntros
(??
Heval
)
.
by
inversion_clear
Heval
;
inv_lit
.
-
intros
.
apply
BinOpEqFalse
.
by
constructor
.
-
iNext
;
iIntros
(??
Heval
)
.
by
inversion_clear
Heval
;
inv_lit
.
Qed
.
Lemma
wp_eq_loc
E
(
l1
:
loc
)
(
l2
:
loc
)
P
Φ
:
(
P
-∗
∃
q
v
,
▷
l1
↦
{
q
}
v
)
→
(
P
-∗
∃
q
v
,
▷
l2
↦
{
q
}
v
)
→
(
l1
=
l2
→
P
-∗
▷
Φ
(
LitV
true
))
→
(
l1
≠
l2
→
P
-∗
▷
Φ
(
LitV
false
))
→
P
-∗
WP
BinOp
EqOp
(
Lit
(
LitLoc
l1
))
(
Lit
(
LitLoc
l2
))
@
E
{{
Φ
}}
.
Proof
.
iIntros
(
Hl1
Hl2
Heq
Hne
)
"HP"
.
destruct
(
bool_decide_reflect
(
l1
=
l2
))
.
-
rewrite
Heq
//
{
Heq
Hne
}
.
iApply
wp_bin_op_pure
;
subst
.
+
intros
.
apply
BinOpEqTrue
.
constructor
.
+
iNext
.
iIntros
(??
Heval
)
.
by
inversion_clear
Heval
;
inv_lit
.
-
clear
Heq
.
iApply
wp_lift_atomic_head_step_no_fork
;
subst
=>
//.
iIntros
(
σ1
)
"Hσ1"
.
iModIntro
.
inv_head_step
.
iSplitR
.
{
iPureIntro
.
eexists
_,
_,
_
.
constructor
.
apply
BinOpEqFalse
.
by
auto
.
}
(* We need to do a little gymnastics here to apply Hne now and strip away a
▷ but also have the ↦s. *)
iAssert
((
▷
∃
q
v
,
l1
↦
{
q
}
v
)
∧
(
▷
∃
q
v
,
l2
↦
{
q
}
v
)
∧
▷
Φ
(
LitV
false
))
%
I
with
"[HP]"
as
"HP"
.
{
iSplit
;
last
iSplit
.
-
iDestruct
(
Hl1
with
"HP"
)
as
(??)
"?"
.
iNext
.
eauto
.
-
iDestruct
(
Hl2
with
"HP"
)
as
(??)
"?"
.
iNext
.
eauto
.
-
by
iApply
Hne
.
}
clear
Hne
Hl1
Hl2
.
iNext
.
iIntros
(
e2
σ2
efs
Hs
)
"!>"
.
inv_head_step
.
iSplitR
=>
//.
match
goal
with
[
H
:
bin_op_eval
_
_
_
_
_
|
-
_
]
=>
inversion
H
end
;
inv_lit
=>
//.
*
iExFalso
.
iDestruct
"HP"
as
"[Hl1 _]"
.
iDestruct
"Hl1"
as
(??)
"Hl1"
.
iDestruct
(
heap_read
σ2
with
"Hσ1 Hl1"
)
as
(
n'
)
"%"
.
simplify_eq
.
*
iExFalso
.
iDestruct
"HP"
as
"[_ [Hl2 _]]"
.
iDestruct
"Hl2"
as
(??)
"Hl2"
.
iDestruct
(
heap_read
σ2
with
"Hσ1 Hl2"
)
as
(
n'
)
"%"
.
simplify_eq
.
*
iDestruct
"HP"
as
"[_ [_ $]]"
.
done
.
Qed
.
Lemma
wp_eq_loc_0_r
E
(
l
:
loc
)
P
Φ
:
(
P
-∗
▷
Φ
(
LitV
false
))
→
P
-∗
WP
BinOp
EqOp
(
Lit
(
LitLoc
l
))
(
Lit
(
LitInt
0
))
@
E
{{
Φ
}}
.
...
...
@@ -293,8 +332,6 @@ Proof.
rewrite
HΦ
.
iNext
.
iIntros
(??
Heval
)
.
by
inversion_clear
Heval
;
inv_lit
.
Qed
.
(* TODO: wp_eq for locations, if needed. *)
Lemma
wp_offset
E
l
z
Φ
:
▷
Φ
(
LitV
$
LitLoc
$
l
+
ₗ
z
)
-∗
WP
BinOp
OffsetOp
(
Lit
$
LitLoc
l
)
(
Lit
$
LitInt
z
)
@
E
{{
Φ
}}
.
...
...
This diff is collapsed.
Click to expand it.
theories/lang/proofmode.v
+
2
−
0
View file @
660239df
...
...
@@ -94,6 +94,8 @@ Tactic Notation "wp_op" :=
|
BinOp
LeOp
_
_
=>
wp_bind_core
K
;
apply
wp_le
;
wp_finish
|
BinOp
EqOp
(
Lit
(
LitInt
_))
(
Lit
(
LitInt
_))
=>
wp_bind_core
K
;
apply
wp_eq_int
;
wp_finish
|
BinOp
EqOp
(
Lit
(
LitLoc
_))
(
Lit
(
LitLoc
_))
=>
wp_bind_core
K
;
apply
wp_eq_loc
;
wp_finish
|
BinOp
EqOp
(
Lit
(
LitLoc
_))
(
Lit
(
LitInt
0
))
=>
wp_bind_core
K
;
apply
wp_eq_loc_0_r
;
wp_finish
|
BinOp
EqOp
(
Lit
(
LitInt
0
))
(
Lit
(
LitLoc
_))
=>
...
...
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