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 17:05:14 -0500

Eugene Kirpichov wrote:
2010/1/30 Adam 
Chlipala<adam AT chlipala.net>:
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.
Thanks, but the following statement also doesn't work.

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

Your goal isn't a [match]. Rather, your goal is an equality whose lefthand side is such a [match]. You can add [= _] to your pattern or use a [context] pattern.

By the way, I still don't understand why Coq needs type information in
this case, if Ltac is untyped and operates over syntax...

It's clear if you look at Coq's kernel representation of Gallina programs, where a [match] contains an array of cases, one per constructor, regardless of which patterns were entered at the source level. I agree that this isn't very convenient from the user's perspective.



Archive powered by MhonArc 2.6.16.

Top of Page