coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jason Gross <jasongross9 AT gmail.com>
- To: Leonardo Rodriguez <leonardomatiasrodriguez AT gmail.com>
- Cc: coq-club <coq-club AT inria.fr>
- Subject: [Coq-Club] renaming hypotheses with patterns?
- Date: Tue, 16 Jul 2013 13:46:52 -0400
You are looking for the [open_constr] tag for tactic notation:
Tactic Notation "rename_hyp" open_constr(Pattern) ident(H) :=
match goal with
| [ H' : Pattern |- _ ] => rename H' into H
end.
Note that you do not need the [clear].
As for your other question, you probably want to look at the [fresh] tactic, which generates a fresh name not currently used as a hypothesis. So you could replace [rename H' into H] with something like [let H := fresh in rename H' into H].
-Jason
On Tuesday, July 16, 2013, Leonardo Rodriguez wrote:
On Tuesday, July 16, 2013, Leonardo Rodriguez wrote:
HiI'm relatively new in Coq. I wonder how to write proofs which
are independent of the name generation algorithm of Coq.For example, consider this tactic and the following lemma (a simplified version of my actual code)
Ltac rename_hyp Pattern H :=
match goal with
| [H' : Pattern |- _]
=> rename H' into H ; clear H'
end.
Inductive T : Prop :=
| a : T
| b : T.
Axiom P : Prop.
Axiom Q : T -> Prop.
Axiom R : T -> Prop.
Lemma whatever : P -> Q a -> Q b -> R b -> True.
intros.
rename_hyp P new_name_for_P.
rename_hyp (Q a) new_name_for_Q_a.
(* Doesn't work : *)
rename_hyp (R _) new_name_for_R.I want to write (or use) a tactic which can take any pattern as an argument.But I also want to ask in general, how to write proof independent of the names
generated by Coq.Thank you!
- [Coq-Club] renaming hypotheses with patterns?, Leonardo Rodriguez, 07/16/2013
- [Coq-Club] renaming hypotheses with patterns?, Jason Gross, 07/16/2013
Archive powered by MHonArc 2.6.18.