Skip to content
Snippets Groups Projects
Commit 609de3aa authored by Ralf Jung's avatar Ralf Jung
Browse files

add rename-by-pattern tactic

parent 96cb4bc9
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,8 @@ Coq 8.8 and 8.9 are no longer supported. ...@@ -43,6 +43,8 @@ Coq 8.8 and 8.9 are no longer supported.
- Rename `seq_S_end_app` to `seq_S`. (The lemma `seq_S` is also in Coq's stdlib - Rename `seq_S_end_app` to `seq_S`. (The lemma `seq_S` is also in Coq's stdlib
since Coq 8.12.) since Coq 8.12.)
- Remove `omega` import and hint database in `tactics` file. - Remove `omega` import and hint database in `tactics` file.
- Add `rename select <pat> into <name>` tactic to find a hypothesis by pattern
and give it a fixed name.
The following `sed` script should perform most of the renaming The following `sed` script should perform most of the renaming
(on macOS, replace `sed` by `gsed`, installed via e.g. `brew install gnu-sed`): (on macOS, replace `sed` by `gsed`, installed via e.g. `brew install gnu-sed`):
......
...@@ -48,3 +48,6 @@ Proof. ...@@ -48,3 +48,6 @@ Proof.
intros * HH. split_and!; [ destruct_and? HH; assumption | destruct_and?; assumption | ]. intros * HH. split_and!; [ destruct_and? HH; assumption | destruct_and?; assumption | ].
destruct_and?. Fail destruct_and!. assumption. destruct_and?. Fail destruct_and!. assumption.
Qed. Qed.
Goal forall (n : nat), m : nat, True.
Proof. intros ?. rename select nat into m. exists m. done. Qed.
...@@ -537,6 +537,9 @@ Tactic Notation "select" open_constr(pat) tactic3(tac) := ...@@ -537,6 +537,9 @@ Tactic Notation "select" open_constr(pat) tactic3(tac) :=
(** [select_revert] reverts the first hypothesis matching [pat]. *) (** [select_revert] reverts the first hypothesis matching [pat]. *)
Tactic Notation "revert" "select" open_constr(pat) := select pat (fun H => revert H). Tactic Notation "revert" "select" open_constr(pat) := select pat (fun H => revert H).
Tactic Notation "rename" "select" open_constr(pat) "into" ident(name) :=
select pat (fun H => rename H into name).
(** Coq's [firstorder] tactic fails or loops on rather small goals already. In (** Coq's [firstorder] tactic fails or loops on rather small goals already. In
particular, on those generated by the tactic [unfold_elem_ofs] which is used particular, on those generated by the tactic [unfold_elem_ofs] which is used
to solve propositions on sets. The [naive_solver] tactic implements an to solve propositions on sets. The [naive_solver] tactic implements an
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment