Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Check Record Field Membership in a List

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Check Record Field Membership in a List


chronological Thread 
  • From: Adam Koprowski <adam.koprowski AT gmail.com>
  • To: CoqUser CoqUser <coquser AT yahoo.com>
  • Cc: coq-club AT pauillac.inria.fr
  • Subject: Re: [Coq-Club] Check Record Field Membership in a List
  • Date: Thu, 30 Jul 2009 10:57:29 +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=hn9359Ax11ZdoPml7HPgFck7/YNZldqeSsLN6rx2q9BvJhU8OzvRA4ZhTKSxh2olxt 2Y7fVaEyxf6ZfpEDe6jC3qpP8twjA4WM+6K7xJx3nLZeQQEk3BUuZt/ibwITZl9qHYT1 zwpMkMX+yh9ykhJZEiudMb5d3TU1H/2bIJRQE=
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>


  Two suggestions if you expect help from people on this list:

Example Code:
Require Import String.
Require Import List.
Record Product:Set := {productName:string}.
Record Store:Set := {products:list Product}.

Theorem T: forall p:Product,forall s:Store, In (productName p) (productName (products s)).
(*A product's name must be in the list of Product Names that a Store has.
How is this written?  I don't want to check that the Product is in the list of
Products, only that the name is in the Store's list of product names.*)
  Obviously you get an error because productName is a function from Product to string:
Check productName
> productName : Product -> string
  and products gives a list of products:
Check productName
> productName : Product -> string

  so Coq's error message makes perfect sense. What you probably want to do is this:
Theorem T: forall p s, In (productName p) (List.map productName (products s)).
  though I hope you are aware that you will not be able to prove this theorem.

  Cheers,
  Adam

--
=====================================================
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