coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- 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:
- don't send your messages multiple times!
- use a sensible user name (you were already asked before to do that)
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:> productName : Product -> string
Theorem T: forall p s, In (productName p) (List.map productName (products s)).
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)
=====================================================
- [Coq-Club] Check Record Field Membership in a List, CoqUser CoqUser
- <Possible follow-ups>
- [Coq-Club] Check Record Field Membership in a List,
CoqUser CoqUser
- Re: [Coq-Club] Check Record Field Membership in a List, Adam Koprowski
- [Coq-Club] Canonical Structures Not at top level, Cedric Auger
- Re: [Coq-Club] Check Record Field Membership in a List, Adam Koprowski
- [Coq-Club] Check Record Field Membership in a List,
Coq User
- Message not available
Archive powered by MhonArc 2.6.16.