Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Rodolphe Lepigre
Iris
Commits
6a04e745
Commit
6a04e745
authored
Dec 08, 2016
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify wp_unlock and rename into solve_of_val_unlock.
parent
4b2916c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
14 deletions
+8
-14
heap_lang/wp_tactics.v
heap_lang/wp_tactics.v
+8
-14
No files found.
heap_lang/wp_tactics.v
View file @
6a04e745
...
...
@@ -44,20 +44,12 @@ Tactic Notation "wp_value" :=
|
_
=>
fail
"wp_value: not a wp"
end
.
Lemma
of_val_unlock
v
e
:
of_val
v
=
e
→
of_val
(
locked
v
)
=
e
.
Proof
.
by
unlock
.
Qed
.
(* Applied to goals that are equalities of expressions. Will try to unlock the
LHS once if necessary, to get rid of the lock added by the syntactic sugar. *)
Ltac
wp_unlock
:
=
solve
[
reflexivity
|
(* If there are no locks, this is enough. *)
(* Otherwise, use unification to uncover the lock. *)
(* Step 1: Get the LHS into the form "of_val (locked v)" *)
let
v
:
=
fresh
"v"
in
evar
(
v
:
val
)
;
trans
(
of_val
(
locked
v
))
;
subst
v
;
first
reflexivity
;
(* Step 2: Remove the lock from the LHS. *)
etrans
;
first
solve
[
apply
(
f_equal
of_val
)
;
symmetry
;
apply
lock
]
;
(* Now things should be convertible. *)
reflexivity
].
Ltac
solve_of_val_unlock
:
=
try
apply
of_val_unlock
;
reflexivity
.
Tactic
Notation
"wp_rec"
:
=
lazymatch
goal
with
...
...
@@ -65,7 +57,8 @@ Tactic Notation "wp_rec" :=
match
eval
hnf
in
e'
with
App
?e1
_
=>
(* hnf does not reduce through an of_val *)
(* match eval hnf in e1 with Rec _ _ _ => *)
wp_bind_core
K
;
etrans
;
[|
eapply
wp_rec
;
[
wp_unlock
|
wp_done
..]]
;
simpl_subst
;
wp_finish
wp_bind_core
K
;
etrans
;
[|
eapply
wp_rec
;
[
solve_of_val_unlock
|
wp_done
..]]
;
simpl_subst
;
wp_finish
(* end *)
end
)
||
fail
"wp_rec: cannot find 'Rec' in"
e
|
_
=>
fail
"wp_rec: not a 'wp'"
end
.
...
...
@@ -75,7 +68,8 @@ Tactic Notation "wp_lam" :=
|
|-
_
⊢
wp
?E
?e
?Q
=>
reshape_expr
e
ltac
:
(
fun
K
e'
=>
match
eval
hnf
in
e'
with
App
?e1
_
=>
(* match eval hnf in e1 with Rec BAnon _ _ => *)
wp_bind_core
K
;
etrans
;
[|
eapply
wp_lam
;
[
wp_unlock
|
wp_done
..]]
;
simpl_subst
;
wp_finish
wp_bind_core
K
;
etrans
;
[|
eapply
wp_lam
;
[
solve_of_val_unlock
|
wp_done
..]]
;
simpl_subst
;
wp_finish
(* end *)
end
)
||
fail
"wp_lam: cannot find 'Lam' in"
e
|
_
=>
fail
"wp_lam: not a 'wp'"
end
.
...
...
Write
Preview
Markdown
is supported
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