Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Tact Notation: conflict between constr and ident

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Tact Notation: conflict between constr and ident


chronological Thread 
  • From: Alexandre Pilkiewicz <alexandre.pilkiewicz AT polytechnique.org>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: [Coq-Club] Tact Notation: conflict between constr and ident
  • Date: Thu, 10 Mar 2011 11:05:54 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:content-type; b=OcmXWpGn//g+ZzRu5kM+tcluLX6+gDElHJHqGjAr9DabP+WnvvXzLhG1jRDj9hrT8s 4o2CtB7OWbwYNUaDhDanzfwDeJkA4QS69lIPP27LQkgwKBQfB1Vm8RZzQqB6kNVPPtMW tRXgv1so2mMvXH9hwRpMca5Zqq0BybZSgdQOA=

Dear list.

I am working on some tactics, and I would like to have them behaves
"like destruct" in the following sens:

destruct accepts either an ident of a constr. If it's an ident, and it
is not introduced yet, it performs an "intros until".

The only way I found to simulate this is:


Tactic Notation "exists_hyp" hyp(H) :=
  idtac.

Tactic Notation "ointros" ident(id) :=
  first [exists_hyp id | intros until id|idtac].

Tactic Notation "mydestruct" constr(trm) :=
  do_something trm.

Tactic Notation "mydestruct" ident(trm) :=
  ointros trm;
  do_something trm.


But this forces me to duplicate all my code, and I have several
versions of mydestruct, some with "as" patterns for example (on a side
note, I sadly can't find a way to use as_ipat or with_induction_names,
so I have to deal with each case separately.)

So what I'm looking for is some sort of constr_or_ident, or even
"any". Does that exists ? Then I would be able to write something like

Tactic Notation "exists_hyp" hyp(H) :=
  idtac.

Tactic Notation "ointros" any(id) :=
  first [exists_hyp id | intros until id|idtac].

Tactic Notation "mydestruct" any(trm) :=
  ointros trm;
  do_something trm.


Thanks in advance

Alexandre



Archive powered by MhonArc 2.6.16.

Top of Page