Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Pattern matching on vectors

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Pattern matching on vectors


chronological Thread 
  • From: Adam Koprowski <adam.koprowski AT gmail.com>
  • To: Jeff Vaughan <jeff AT seas.harvard.edu>
  • Cc: Coq List <coq-club AT pauillac.inria.fr>
  • Subject: Re: [Coq-Club] Pattern matching on vectors
  • Date: Fri, 9 Oct 2009 10:30:05 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=Th6c74IbK/nqdTThVYHaJx6DXlcPZwKGrwxfqjxxkZ33HDiladMp/IZIyoXfMYfUjb z8kHFiM/AlggksUNhmhVIv+0uHrJIDQOfFkcwDvk7ro0PamDQCvXJNyu8BKSZYYuz7lm Bx+t+c2GRhTYGw5cu1Rr1tUw8Tax8YMBPmv7k=
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

  Dear Jeff,

  I'd just like to point out that the CoLoR library has a rich set of results on vectors (as an extension to Coq's stdlib). You'll also find Vsn_eq there from which your lemma trivially follows. Hope that helps.

  Cheers,
   Adam

On Fri, Oct 9, 2009 at 00:20, Jeff Vaughan <jeff AT seas.harvard.edu> wrote:
Hi,

I'm trying to prove some simple theorems using types defined in terms of vectors.  I'm getting suck because I'm not sure how to destruct a vector when there are constraints on its length.

Vectors are defined as follows:

 Set Implicit Arguments.

 Inductive vector (A: Type): nat -> Type :=
 | vnil: vector A O
 | vcons: forall len, A -> vector A len -> vector A (S len).
 Implicit Arguments vnil [A].

And I would like to prove, for instance, this lemma:

 Lemma openVector: forall A n (v: vector A (S n)),
   exists a, exists v0, v = vcons a v0.

The problem---as I understand it---is that induction (elim/destruct/generalized induction...) on v produces goals that are ill-typed.  For instance,

 exists a, exists v0, vnil = vcons a v0

Note that the left hand side of the equality has type (vector A 0) and the right hand side has type (vector A (S _)).  I tried using John Major equality.  This let me take a small step forward, but didn't enable real progress.

Any tips?

Best,
Jeff Vaughan

--------------------------------------------------------
Bug reports: http://logical.saclay.inria.fr/coq-bugs
Archives: http://pauillac.inria.fr/pipermail/coq-club
        http://pauillac.inria.fr/bin/wilma/coq-club
Info: http://pauillac.inria.fr/mailman/listinfo/coq-club



--
=====================================================
Adam.Koprowski AT gmail.com, http://www.cs.ru.nl/~Adam.Koprowski
The difference between impossible and possible
lies in determination (Tommy Lasorda)
=====================================================



Archive powered by MhonArc 2.6.16.

Top of Page