Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Binding variables within nested matches

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Binding variables within nested matches


chronological Thread 
  • From: Adam Chlipala <adam AT chlipala.net>
  • To: Ben Moseley <ben_moseley AT mac.com>
  • Cc: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Binding variables within nested matches
  • Date: Thu, 25 Nov 2010 14:57:54 -0500

Ben Moseley wrote:
   match goal with | [ |- context [match ?d with
                                     | Some _ =>  (match ?y with
                                                    | Left  =>  true
                                                    | Right =>  true
                                                  end)
                                     | None =>  true
                                   end] ] =>  destruct d; [|reflexivity]
   end.

... then the match fails.

If instead I replace the '?y' with '_', then it succeeds.

A term bound to a simple Ltac pattern variable isn't allowed to contain locally-bound variables. The locally-bound variable that causes the trouble in this example is what you're writing as [_] for the [Some] pattern.

Conversely, a [_] pattern may match terms containing local variables, since there's no need to produce a version of the matched term that can be dropped into other contexts.



Archive powered by MhonArc 2.6.16.

Top of Page