Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stdpp
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
Model registry
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
Iris
stdpp
Commits
87eed2dc
Commit
87eed2dc
authored
9 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
make f_equiv behaior more like the original f_equiv: It applies a *single* Proper
parent
a9173997
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/tactics.v
+25
-19
25 additions, 19 deletions
theories/tactics.v
with
25 additions
and
19 deletions
theories/tactics.v
+
25
−
19
View file @
87eed2dc
...
@@ -229,30 +229,23 @@ Ltac setoid_subst :=
...
@@ -229,30 +229,23 @@ Ltac setoid_subst :=
|
H
:
@
equiv
?A
?e
_
?x
|
-
_
=>
symmetry
in
H
;
setoid_subst_aux
(
@
equiv
A
e
)
x
|
H
:
@
equiv
?A
?e
_
?x
|
-
_
=>
symmetry
in
H
;
setoid_subst_aux
(
@
equiv
A
e
)
x
end
.
end
.
(** f_equiv
solves
goals of the form "f _ = f _", for any relation and any
(** f_equiv
works on
goals of the form "f _ = f _", for any relation and any
number of arguments
, by
look
ing
for appropriate "Proper" instance
s.
number of arguments
. It
look
s
for
an
appropriate "Proper" instance
, and
If it cannot solve an equality, it will leave that to the user
. *)
applies it
. *)
Ltac
f_equiv
:=
Ltac
f_equiv
:=
(* Deal with "pointwise_relation" *)
match
goal
with
repeat
lazymatch
goal
with
|
_
=>
reflexivity
|
|
-
pointwise_relation
_
_
_
_
=>
intros
?
end
;
(* Normalize away equalities. *)
simplify_eq
;
(* repeatedly apply congruence lemmas and use the equalities in the hypotheses. *)
try
match
goal
with
|
_
=>
first
[
reflexivity
|
assumption
|
symmetry
;
assumption
]
(* We support matches on both sides, *if* they concern the same
(* We support matches on both sides, *if* they concern the same
variable.
variable.
TODO: We should support different variables, provided that we can
TODO: We should support different variables, provided that we can
derive contradictions for the off-diagonal cases. *)
derive contradictions for the off-diagonal cases. *)
|
|
-
?R
(
match
?x
with
_
=>
_
end
)
(
match
?x
with
_
=>
_
end
)
=>
|
|
-
?R
(
match
?x
with
_
=>
_
end
)
(
match
?x
with
_
=>
_
end
)
=>
destruct
x
;
f_equiv
destruct
x
(* First assume that the arguments need the same relation as the result *)
(* First assume that the arguments need the same relation as the result *)
|
|
-
?R
(
?f
?x
)
(
?f
_)
=>
|
|
-
?R
(
?f
?x
)
(
?f
_)
=>
apply
(_
:
Proper
(
R
==>
R
)
f
)
;
f_equiv
apply
(_
:
Proper
(
R
==>
R
)
f
)
|
|
-
?R
(
?f
?x
?y
)
(
?f
_
_)
=>
|
|
-
?R
(
?f
?x
?y
)
(
?f
_
_)
=>
apply
(_
:
Proper
(
R
==>
R
==>
R
)
f
)
;
f_equiv
apply
(_
:
Proper
(
R
==>
R
==>
R
)
f
)
(* Next, try to infer the relation. Unfortunately, there is an instance
(* Next, try to infer the relation. Unfortunately, there is an instance
of Proper for (eq ==> _), which will always be matched. *)
of Proper for (eq ==> _), which will always be matched. *)
(* TODO: Can we exclude that instance? *)
(* TODO: Can we exclude that instance? *)
...
@@ -260,15 +253,28 @@ Ltac f_equiv :=
...
@@ -260,15 +253,28 @@ Ltac f_equiv :=
query for "pointwise_relation"'s. But that leads to a combinatorial
query for "pointwise_relation"'s. But that leads to a combinatorial
explosion about which arguments are and which are not the same. *)
explosion about which arguments are and which are not the same. *)
|
|
-
?R
(
?f
?x
)
(
?f
_)
=>
|
|
-
?R
(
?f
?x
)
(
?f
_)
=>
apply
(_
:
Proper
(_
==>
R
)
f
)
;
f_equiv
apply
(_
:
Proper
(_
==>
R
)
f
)
|
|
-
?R
(
?f
?x
?y
)
(
?f
_
_)
=>
|
|
-
?R
(
?f
?x
?y
)
(
?f
_
_)
=>
apply
(_
:
Proper
(_
==>
_
==>
R
)
f
)
;
f_equiv
apply
(_
:
Proper
(_
==>
_
==>
R
)
f
)
(* In case the function symbol differs, but the arguments are the same,
(* In case the function symbol differs, but the arguments are the same,
maybe we have a pointwise_relation in our context. *)
maybe we have a pointwise_relation in our context. *)
|
H
:
pointwise_relation
_
?R
?f
?g
|
-
?R
(
?f
?x
)
(
?g
?x
)
=>
|
H
:
pointwise_relation
_
?R
?f
?g
|
-
?R
(
?f
?x
)
(
?g
?x
)
=>
apply
H
;
f_equiv
apply
H
end
.
end
.
(** auto_proper solves goals of the form "f _ = f _", for any relation and any
number of arguments, by repeatedly apply f_equiv and handling trivial cases.
If it cannot solve an equality, it will leave that to the user. *)
Ltac
auto_proper
:=
(* Deal with "pointwise_relation" *)
repeat
lazymatch
goal
with
|
|
-
pointwise_relation
_
_
_
_
=>
intros
?
end
;
(* Normalize away equalities. *)
simplify_eq
;
(* repeatedly apply congruence lemmas and use the equalities in the hypotheses. *)
try
(
f_equiv
;
assumption
||
(
symmetry
;
assumption
)
||
auto_proper
)
.
(** solve_proper solves goals of the form "Proper (R1 ==> R2)", for any
(** solve_proper solves goals of the form "Proper (R1 ==> R2)", for any
number of relations. All the actual work is done by f_equiv;
number of relations. All the actual work is done by f_equiv;
solve_proper just introduces the assumptions and unfolds the first
solve_proper just introduces the assumptions and unfolds the first
...
@@ -291,7 +297,7 @@ Ltac solve_proper :=
...
@@ -291,7 +297,7 @@ Ltac solve_proper :=
|
|
-
?R
(
?f
_
_)
(
?f
_
_)
=>
unfold
f
|
|
-
?R
(
?f
_
_)
(
?f
_
_)
=>
unfold
f
|
|
-
?R
(
?f
_)
(
?f
_)
=>
unfold
f
|
|
-
?R
(
?f
_)
(
?f
_)
=>
unfold
f
end
;
end
;
solve
[
f_equiv
]
.
solve
[
auto_proper
]
.
(** The tactic [intros_revert tac] introduces all foralls/arrows, performs tac,
(** The tactic [intros_revert tac] introduces all foralls/arrows, performs tac,
and then reverts them. *)
and then reverts them. *)
...
...
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