coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Petar Maksimovic <petar.maksimovic AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Records and Inductive definitions
- Date: Thu, 1 Oct 2015 14:27:58 +0200
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=petar.maksimovic AT gmail.com; spf=Pass smtp.mailfrom=petar.maksimovic AT gmail.com; spf=None smtp.helo=postmaster AT mail-wi0-f181.google.com
- Ironport-phdr: 9a23:CFp4jhZjccj4qT6VlQ8veIr/LSx+4OfEezUN459isYplN5qZpci8bnLW6fgltlLVR4KTs6sC0LqK9f66EjFdqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh7z0pceYPlgArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIYTGZn9Kq8/VPlTCCksG2Ez/szi8xfZHiWV4X5JamgKmwAAJgHG9xD/WYnwuWOurudh0TPcOMT1VrExXiqj5I9kTRbpjGEMMDtvozKfsdB5kK8O+EHpnBd42YOBOIw=
Any comments? From the developer team, in particular, perhaps? :)
Cheers,
Petar
On 28 September 2015 at 17:27, Petar Maksimovic
<petar.maksimovic AT gmail.com>
wrote:
> Hello everyone,
>
> Why is it not possible to do the following in Coq:
>
> Record list_singleton (T : Type) := {lT :> list T; cond : length lT = 1}.
>
> Inductive T : Type :=
> | T_main : list_singleton T -> T.
>
> It fails with the error message: Error: Non strictly positive
> occurrence of "T" in "list_singleton T -> T".
>
> I feel that this should be able to go through, since
>
> | T_main : list T -> T
>
> would go through, and I am simply putting an extra condition on the
> lists that I allow.
>
> What I would ultimately want is to be able to use Coq's finite maps in
> constructors, somewhat like this:
>
> Module FMnat := FMapWeakList.Make(Nat_as_OT). (or FMapFullAVL, for that
> matter)
>
> Definition FMap := FMnat.t.
>
> Inductive T : Type :=
> | T_main : FMap T -> T.
>
> and I believe that the problem (in this case) boils down to a
> restriction condition in the underlying record definition of slist, on
> which FMapWeakList is based, therefore the simplified example above.
>
> Any ideas, including how I could approach this differently, are very
> appreciated.
>
> Thank you,
> Petar
>
> P.S. The following does not go through:
>
> Inductive T : Type :=
> | T_main : forall T', list_whatever T T' -> T
> with Record list_whatever (T T' : Type) := {lT :> list T; whatever : T'}.
>
> with the error message: Error: Cannot handle mutually (co)inductive
> records, whereas
>
> Record list_whatever (T T' : Type) := {lT :> list T; whatever : T'}.
>
> Inductive T : Type :=
> | T_main : forall T', list_whatever T T' -> T.
>
> goes through just fine. Why is this so?
- Re: [Coq-Club] Records and Inductive definitions, Petar Maksimovic, 10/01/2015
- RE: [Coq-Club] Records and Inductive definitions, Soegtrop, Michael, 10/01/2015
- Re: [Coq-Club] Records and Inductive definitions, Petar Maksimovic, 10/01/2015
- Re: [Coq-Club] Records and Inductive definitions, Pierre-Marie Pédrot, 10/01/2015
- Re: [Coq-Club] Records and Inductive definitions, Epiphanie, 10/01/2015
- Re: [Coq-Club] Records and Inductive definitions, Petar Maksimovic, 10/01/2015
- RE: [Coq-Club] Records and Inductive definitions, Soegtrop, Michael, 10/01/2015
- Re: [Coq-Club] Records and Inductive definitions, Petar Maksimovic, 10/05/2015
- RE: [Coq-Club] Records and Inductive definitions, Soegtrop, Michael, 10/01/2015
- Re: [Coq-Club] Records and Inductive definitions, Petar Maksimovic, 10/01/2015
- RE: [Coq-Club] Records and Inductive definitions, Soegtrop, Michael, 10/01/2015
- Re: [Coq-Club] Records and Inductive definitions, Petar Maksimovic, 10/01/2015
- RE: [Coq-Club] Records and Inductive definitions, Soegtrop, Michael, 10/01/2015
Archive powered by MHonArc 2.6.18.