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
Model registry
Operate
Environments
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
Iris
Actris
Commits
198e38f7
Commit
198e38f7
authored
5 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
More fancy `wp_branch` tactic that supports pure propositions with Coq intro patterns.
parent
54a2fb5d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
theories/channel/proofmode.v
+11
-4
11 additions, 4 deletions
theories/channel/proofmode.v
theories/examples/list_sort_elem.v
+5
-7
5 additions, 7 deletions
theories/examples/list_sort_elem.v
theories/examples/list_sort_elem_client.v
+1
-1
1 addition, 1 deletion
theories/examples/list_sort_elem_client.v
with
17 additions
and
12 deletions
theories/channel/proofmode.v
+
11
−
4
View file @
198e38f7
...
@@ -194,7 +194,7 @@ Proof.
...
@@ -194,7 +194,7 @@ Proof.
rewrite
envs_app_sound
//
;
simpl
.
by
rewrite
right_id
HΦ
.
rewrite
envs_app_sound
//
;
simpl
.
by
rewrite
right_id
HΦ
.
Qed
.
Qed
.
Tactic
Notation
"wp_branch"
"as"
constr
(
pat1
)
constr
(
pat
2
)
:=
Tactic
Notation
"wp_branch
_core
"
"as"
tactic3
(
tac1
)
tactic3
(
tac
2
)
:=
let
solve_mapsto
_
:=
let
solve_mapsto
_
:=
let
c
:=
match
goal
with
|
-
_
=
Some
(_,
(
?c
↣
_
@
_)
%
I
)
=>
c
end
in
let
c
:=
match
goal
with
|
-
_
=
Some
(_,
(
?c
↣
_
@
_)
%
I
)
=>
c
end
in
iAssumptionCore
||
fail
"wp_branch: cannot find"
c
"↣ ? @ ?"
in
iAssumptionCore
||
fail
"wp_branch: cannot find"
c
"↣ ? @ ?"
in
...
@@ -207,12 +207,19 @@ Tactic Notation "wp_branch" "as" constr(pat1) constr(pat2) :=
...
@@ -207,12 +207,19 @@ Tactic Notation "wp_branch" "as" constr(pat1) constr(pat2) :=
|
fail
1
"wp_branch: cannot find 'recv' in"
e
];
|
fail
1
"wp_branch: cannot find 'recv' in"
e
];
[
solve_mapsto
()
[
solve_mapsto
()
|
iSolveTC
||
fail
1
"wp_send: protocol not of the shape <&>"
|
iSolveTC
||
fail
1
"wp_send: protocol not of the shape <&>"
|
pm_reduce
;
intros
[];
|
pm_reduce
;
intros
[];
[
tac1
Hnew
|
tac2
Hnew
];
wp_finish
]
[
iDestructHyp
Hnew
as
pat1
|
iDestructHyp
Hnew
as
pat2
];
wp_finish
]
|
_
=>
fail
"wp_branch: not a 'wp'"
|
_
=>
fail
"wp_branch: not a 'wp'"
end
.
end
.
Tactic
Notation
"wp_branch"
:=
wp_branch
as
"_"
"_"
.
Tactic
Notation
"wp_branch"
"as"
constr
(
pat1
)
"|"
constr
(
pat2
)
:=
wp_branch_core
as
(
fun
H
=>
iDestructHyp
H
as
pat1
)
(
fun
H
=>
iDestructHyp
H
as
pat2
)
.
Tactic
Notation
"wp_branch"
"as"
"%"
intropattern
(
pat1
)
"|"
constr
(
pat2
)
:=
wp_branch_core
as
(
fun
H
=>
iPure
H
as
pat1
)
(
fun
H
=>
iDestructHyp
H
as
pat2
)
.
Tactic
Notation
"wp_branch"
"as"
constr
(
pat1
)
"|"
"%"
intropattern
(
pat2
)
:=
wp_branch_core
as
(
fun
H
=>
iDestructHyp
H
as
pat1
)
(
fun
H
=>
iPure
H
as
pat2
)
.
Tactic
Notation
"wp_branch"
"as"
"%"
intropattern
(
pat1
)
"|"
"%"
intropattern
(
pat2
)
:=
wp_branch_core
as
(
fun
H
=>
iPure
H
as
pat1
)
(
fun
H
=>
iPure
H
as
pat2
)
.
Tactic
Notation
"wp_branch"
:=
wp_branch
as
%
_
|
%
_
.
Lemma
tac_wp_select
`{
!
proto_chanG
Σ
,
!
heapG
Σ
}
Δ
neg
i
js
K
N
Lemma
tac_wp_select
`{
!
proto_chanG
Σ
,
!
heapG
Σ
}
Δ
neg
i
js
K
N
c
(
b
:
bool
)
p
P1
P2
(
p1
p2
:
iProto
Σ
)
Φ
:
c
(
b
:
bool
)
p
P1
P2
(
p1
p2
:
iProto
Σ
)
Φ
:
...
...
This diff is collapsed.
Click to expand it.
theories/examples/list_sort_elem.v
+
5
−
7
View file @
198e38f7
...
@@ -122,7 +122,7 @@ Section list_sort_elem.
...
@@ -122,7 +122,7 @@ Section list_sort_elem.
Proof
.
Proof
.
iIntros
(
Hxs
Hys
Hsorted
Hrel
Ψ
)
"[Hc Hcin] HΨ"
.
iIntros
(
Hxs
Hys
Hsorted
Hrel
Ψ
)
"[Hc Hcin] HΨ"
.
iLöb
as
"IH"
forall
(
c
cin
xs
ys
xs'
ys'
Hxs
Hys
Hsorted
Hrel
)
.
iLöb
as
"IH"
forall
(
c
cin
xs
ys
xs'
ys'
Hxs
Hys
Hsorted
Hrel
)
.
wp_rec
.
wp_branch
as
"_"
"
Hys'
"
.
wp_rec
.
wp_branch
as
%
_
|
%
Hys'
.
-
wp_recv
(
x
v
)
as
(
Htl
)
"HI"
.
-
wp_recv
(
x
v
)
as
(
Htl
)
"HI"
.
wp_select
.
wp_send
with
"[$HI]"
;
first
by
auto
.
wp_select
.
wp_send
with
"[$HI]"
;
first
by
auto
.
wp_apply
(
"IH"
with
"[%] [%] [%] [%] Hc Hcin HΨ"
)
.
wp_apply
(
"IH"
with
"[%] [%] [%] [%] Hc Hcin HΨ"
)
.
...
@@ -131,7 +131,7 @@ Section list_sort_elem.
...
@@ -131,7 +131,7 @@ Section list_sort_elem.
*
auto
using
Sorted_snoc
.
*
auto
using
Sorted_snoc
.
*
intros
x'
.
*
intros
x'
.
inversion
1
;
discriminate_list
||
simplify_list_eq
.
by
constructor
.
inversion
1
;
discriminate_list
||
simplify_list_eq
.
by
constructor
.
-
iDestruct
"Hys'"
as
%
Hys'
.
wp_select
with
"[]"
.
-
wp_select
with
"[]"
.
{
by
rewrite
/=
Hys
Hxs
Hys'
.
}
{
by
rewrite
/=
Hys
Hxs
Hys'
.
}
iApply
"HΨ"
.
iFrame
.
iApply
"HΨ"
.
iFrame
.
Qed
.
Qed
.
...
@@ -154,7 +154,7 @@ Section list_sort_elem.
...
@@ -154,7 +154,7 @@ Section list_sort_elem.
iIntros
(
Hxs
Hys
Hsort
Htl
Htl_le
)
"#Hcmp !>"
.
iIntros
(
Hxs
Hys
Hsort
Htl
Htl_le
)
"#Hcmp !>"
.
iIntros
(
Ψ
)
"(Hc & Hc1 & Hc2 & HIy1) HΨ"
.
iIntros
(
Ψ
)
"(Hc & Hc1 & Hc2 & HIy1) HΨ"
.
iLöb
as
"IH"
forall
(
c1
c2
xs1
xs2
ys
y1
w1
ys1
ys2
Hxs
Hys
Hsort
Htl
Htl_le
)
.
iLöb
as
"IH"
forall
(
c1
c2
xs1
xs2
ys
y1
w1
ys1
ys2
Hxs
Hys
Hsort
Htl
Htl_le
)
.
wp_rec
.
wp_branch
as
"_"
"
Hys2
"
.
wp_rec
.
wp_branch
as
%
_
|
%
Hys2
.
-
wp_recv
(
x
v
)
as
(
Htl2
)
"HIx"
.
-
wp_recv
(
x
v
)
as
(
Htl2
)
"HIx"
.
wp_pures
.
wp_apply
(
"Hcmp"
with
"[$HIy1 $HIx]"
);
iIntros
"[HIy1 HIx]"
.
wp_pures
.
wp_apply
(
"Hcmp"
with
"[$HIy1 $HIx]"
);
iIntros
"[HIy1 HIx]"
.
case_bool_decide
.
case_bool_decide
.
...
@@ -174,8 +174,7 @@ Section list_sort_elem.
...
@@ -174,8 +174,7 @@ Section list_sort_elem.
*
constructor
.
by
apply
total_not
.
*
constructor
.
by
apply
total_not
.
*
intros
x'
.
*
intros
x'
.
inversion
1
;
discriminate_list
||
simplify_list_eq
.
by
constructor
.
inversion
1
;
discriminate_list
||
simplify_list_eq
.
by
constructor
.
-
iDestruct
"Hys2"
as
%
Hys2
.
-
wp_select
.
wp_send
with
"[$HIy1 //]"
.
wp_select
.
wp_send
with
"[$HIy1 //]"
.
wp_apply
(
list_sort_elem_service_move_spec
with
"[$Hc $Hc1]"
)
.
wp_apply
(
list_sort_elem_service_move_spec
with
"[$Hc $Hc1]"
)
.
*
done
.
*
done
.
*
by
rewrite
Hys
Hys2
-!
assoc_L
(
comm
_
xs2
)
.
*
by
rewrite
Hys
Hys2
-!
assoc_L
(
comm
_
xs2
)
.
...
@@ -205,8 +204,7 @@ Section list_sort_elem.
...
@@ -205,8 +204,7 @@ Section list_sort_elem.
wp_select
.
wp_send
with
"[$HIx2]"
.
wp_select
.
wp_send
with
"[$HIx2]"
.
wp_apply
(
list_sort_elem_service_split_spec
with
"[$Hc $Hcy $Hcz]"
)
.
wp_apply
(
list_sort_elem_service_split_spec
with
"[$Hc $Hcy $Hcz]"
)
.
iIntros
(
xs'
xs1'
xs2'
);
iDestruct
1
as
(
Hxs'
)
"(Hc & Hcy & Hcz) /="
.
iIntros
(
xs'
xs1'
xs2'
);
iDestruct
1
as
(
Hxs'
)
"(Hc & Hcy & Hcz) /="
.
wp_branch
as
"_"
"Hnil"
;
last
first
.
wp_branch
as
%
_
|
%
[]
%
Permutation_nil_cons
.
{
by
iDestruct
"Hnil"
as
%
?
%
Permutation_nil_cons
.
}
wp_recv
(
x
v
)
as
"[_ HIx]"
.
wp_recv
(
x
v
)
as
"[_ HIx]"
.
wp_apply
(
list_sort_elem_service_merge_spec
_
_
_
_
_
_
[]
_
_
_
_
[]
[]
wp_apply
(
list_sort_elem_service_merge_spec
_
_
_
_
_
_
[]
_
_
_
_
[]
[]
with
"Hcmp [$Hc $Hcy $Hcz $HIx]"
);
simpl
;
auto
using
TlRel_nil
,
Sorted_nil
.
with
"Hcmp [$Hc $Hcy $Hcz $HIx]"
);
simpl
;
auto
using
TlRel_nil
,
Sorted_nil
.
...
...
This diff is collapsed.
Click to expand it.
theories/examples/list_sort_elem_client.v
+
1
−
1
View file @
198e38f7
...
@@ -53,7 +53,7 @@ Section list_sort_elem_client.
...
@@ -53,7 +53,7 @@ Section list_sort_elem_client.
Proof
.
Proof
.
iIntros
(
Hsort
Φ
)
"Hc HΦ"
.
iIntros
(
Hsort
Φ
)
"Hc HΦ"
.
iLöb
as
"IH"
forall
(
xs
ys'
Φ
Hsort
)
.
iLöb
as
"IH"
forall
(
xs
ys'
Φ
Hsort
)
.
wp_lam
.
wp_branch
as
"_"
"
Hperm
"
;
wp_pures
.
wp_lam
.
wp_branch
as
%
_
|
%
Hperm
;
wp_pures
.
-
wp_recv
(
y
v
)
as
(
Htl
)
"HIxv"
.
-
wp_recv
(
y
v
)
as
(
Htl
)
"HIxv"
.
wp_apply
(
"IH"
with
"[] Hc"
);
first
by
auto
using
Sorted_snoc
.
wp_apply
(
"IH"
with
"[] Hc"
);
first
by
auto
using
Sorted_snoc
.
iIntros
(
ys
ws
)
.
rewrite
-!
assoc_L
.
iDestruct
1
as
(??)
"[Hc HI]"
.
iIntros
(
ys
ws
)
.
rewrite
-!
assoc_L
.
iDestruct
1
as
(??)
"[Hc HI]"
.
...
...
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