Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Ltac-matching a "match..with"

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Ltac-matching a "match..with"


chronological Thread 
  • From: Adam Chlipala <adam AT chlipala.net>
  • To: Eugene Kirpichov <ekirpichov AT gmail.com>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Ltac-matching a "match..with"
  • Date: Fri, 29 Jan 2010 16:31:57 -0500

Eugene Kirpichov wrote:
Suppose I'm proving the following theorem.
Theorem t : forall n, match n with | O =>  O | S x =>  S x end = n.
   intros n.

   (* Here I could just do "destruct n", but I'd like to do that 
automatically *)

   match goal with [ |- match ?n with _ end ] =>  destruct n end.

This doesn't work. Replacing _ with _ =>  _ doesn't work, either, and
neither does work anything that I managed to invent.

Is there a way to achieve what I'm trying to do? namely, say,
"destruct" all variables that are being the head of a match?

The only way I know is to write a pattern that includes the [O] and [S] cases explicitly. You can safely leave underscores for the case bodies and pattern variables, but Coq needs to know which inductive type you're matching on.



Archive powered by MhonArc 2.6.16.

Top of Page