coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Greg Morrisett <greg AT eecs.harvard.edu>
- To: Nuno Gaspar <nmpgaspar AT gmail.com>, Coq Club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] records
- Date: Wed, 30 Nov 2011 08:14:35 -0500
Hi Nuno,
You could just use an inductive definition as in:
[[
Inductive X : Type :=
| Con : list Stuff -> list X -> X.
]]
Then you can define operations such as:
[[
Definition foo(x:X) : list Stuff :=
match x with
| Cons f b => f
end.
Definition bar(x:X) : list X :=
match x with
| Cons f b => b
end.
]]
-Greg
On Nov 30, 2011, at 8:09 AM, Nuno Gaspar wrote:
> Hello.
>
> From what I saw, recursive records are not allowed in Coq. So one cannot do
> something like:
>
> Record X: Type :=
> Con {
> foo : list Stuff;
> bar : list X
> }.
>
> Is there any way to go around this restriction? I mean what is the standard
> approach for a coq user to follow whenever faced with this situation?
>
> Thank you!
>
> --
> Bart: Look at me, I'm a grad student, I'm 30 years old and I made $600
> dollars last year.
> Marge: Bart! Don't make fun of grad students, they just made a terrible
> life choice.
- [Coq-Club] records, Nuno Gaspar
- Re: [Coq-Club] records, Greg Morrisett
- Re: [Coq-Club] records, Alexandre Pilkiewicz
- <Possible follow-ups>
- Re: [Coq-Club] records,
Paolo Herms
- Re: [Coq-Club] records, Nuno Gaspar
Archive powered by MhonArc 2.6.16.