Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Proposition for strictly positive occurrence

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Proposition for strictly positive occurrence


Chronological Thread 
  • From: Thorsten Altenkirch <Thorsten.Altenkirch AT nottingham.ac.uk>
  • To: "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Proposition for strictly positive occurrence
  • Date: Tue, 3 Jul 2018 22:05:53 +0000
  • Accept-language: en-US
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=Thorsten.Altenkirch AT nottingham.ac.uk; spf=Pass smtp.mailfrom=Thorsten.Altenkirch AT nottingham.ac.uk; spf=None smtp.helo=postmaster AT uidappmx02.nottingham.ac.uk
  • Ironport-phdr: 9a23:N/1/3hOYU35jTs8mrEol6mtUPXoX/o7sNwtQ0KIMzox0I/jzrarrMEGX3/hxlliBBdydt6oazbKO+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxlJiTanfb9+MAi9oBnMuMURnYZsMLs6xAHTontPdeRWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbYUwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr0yRD+s7bpkSAXwhSkHKTA37X3XhMJzgqJVoh2uqR1/zJLbb4yOLvVyYrnQcMkGSWdbXMtcUTFKDIOmb4sICuoMJfhWr4n6p1sUthu+GRejBOXywTJUgn/2wbM10+IiEQHHxgwvA9IOu2nTodvrNKcSVvq1zLLUzTrdafNawyvw6IzUch8/p/GMXrNwcdDNxkkvDA7FiFKQqZD5PzOU0OQNvGib4PBlVe61kWEotxt9oiWsxso1jITCm4wbylfB9SpjwYY1I8W1SFZhYd6jEptQtTuWOJVrQs4kXmpmuz46x6UbtZKlfyUG0ooryhHRZvCdfIWF7AjvWPuPLTp4nH5oe7Oyiwys/UWj0OHwSNe43VdQoiZYkdTAqGgB1xLN5cWEVvdw+0Ks1SuS2AzO6+xJJF07mKjVK5I8x7M8i4QcvlnfESLzmkj7j6Cbelgi9+O18eroeK/mqYWZN4JsigHxLKAumsunDOQlMwgBQnKU+fyk1L3m8kz1XKtGgucwkqnerJDaOcUbpqi2Aw9VyIkj7gyzAC2639gCgHkHL0pJeBOBj4f3J1HDOO30Aem8jli2jjtmyP7LMqfuD5jDNHTPjantcLZl505Z0gUzzNRf55xOCrEGJfL+QlH/tNzfDh8jKAy03/joCNNn2o4CXWKPHrGWMKXRsV+J/OIgP+mMaZQTuDb6N/gl+//ujXk2mV8dZ6ap2IEbZ2qkEfh8PkWZYmLggs0dHmcSogo+UOvqhUWeXj5Ufna+Rr4z5jUmCI29ForDXYCsgLmZ3CihBJFWZ2ZGCkqNEXjybYmEVe0MO2quJZormTsdELOlVoUJ1Be0tQa8xaAtZr7f/TRdvpb+3vB04ffSnFc872onId6a1jSxT2ZuhX8FQXcf2Lxyp0980FyDmfxEg/tCDsBe4bVgVhs3M53d1ed6I9b1Rh7AeNiJQVPgS97gHDJnHYF5+MMHf0soQ4bqtRvExSf/W+ZExYzOP4Q99+fn51a0Is98z3jc06x43wsgRddTNGuphqd6sQHYQZPKwRzAy/SaMJ8E1SuIz1+tiHKUtRgIAgh3TbnEW38fb06QpN+/+0CQF+bzW4RiCRNIzIu5EoUPatDtig8XFuriNN3Ge2ehwz32AxGU2rKKY4rjfiMU12PACxpcng==
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

A strictly positive datatype is given by a container, I.e. 
S : Type
P : S -> Type
It's initial algebra is the W-type. 

There is no point quantifying over all functors because functors don't always have initial algebras.

Thorsten

From: <coq-club-request AT inria.fr> on behalf of roux cody <cody.roux AT gmail.com>
Reply-To: "coq-club AT inria.fr" <coq-club AT inria.fr>
Date: Tuesday, 3 July 2018 at 22:37
To: "coq-club AT inria.fr" <coq-club AT inria.fr>
Subject: Re: [Coq-Club] Proposition for strictly positive occurrence

Ralph is a black belt at this kind of thing, so I suspect his advice is very valuable.

There are a couple of cheap tricks that may work in certain circumstances, though. Here is one:

Context (f : Type -> Type).

Fixpoint foobar_n (n : nat) : Type :=
match n return Type with
 | 0 => False
 | S m => f (foobar_n m)
 end

Definition foobar := { n : nat & foobar_n n}.

If the type function f is very well behaved, you may be able to do something with (foobar f). I've used it successfully in the case where f is a monotone functional with reasonable properties.

Best,
Cody


On Tue, Jul 3, 2018 at 5:06 PM, Yixuan Chen <xlk AT umich.edu> wrote:
Dear Ralph and Dan,

Thanks for your suggestions. It seems like the problem is much more complicated than I expected to be :( I might just take a detour to avoid the problem for now, but I will take a look into your suggestions later. Anyway, thanks a lot!
On Jul 3, 2018, 9:19 AM -0400, Ralph Matthes <Ralph.Matthes AT irit.fr>, wrote:

Dear Yixuan Chen,

Your question refers to a very old problem of Coq. It is just not possible to do categorical datatypes there in a generic fashion. One would like to speak about an arbitrary "functor" f and later use the generic construction in concrete instances that would even mostly be strictly positive. But this is not supported by Coq.

I have written papers where I suggested other recursion schemes that would work - even in Coq - for a class of f that is far more liberal than strict positivity (see my papers in JFP and SCP). The requirement for that class can be encapsulated logically, as you described in your post.

You can also switch off the checks, see the benefits of it in my TYPES'18 talk (in particular the second last slide of it), available at https://types2018.projj.eu/conference-programme/#session8 - move two lines up there and click on the title of the talk.

Kind regards,    Ralph Matthes



Le 03/07/2018 à 02:20, Yixuan Chen a écrit :
Dear Coq users,

I met a situation where I need to define an inductive type like,

Context (f: Type -> Type).

Inductive foobar: Type :=
| something_of: (f foobar) -> foobar
| nothing: foobar.

This does not pass the positive occurrence check, and it shouldn’t. However, the actual definition that would be passed as f should always guarantee to generate only legitimate types. Is there a way to write “strictly positive occurrence” as an proposition in Coq and make it as an hypothesis for f in the client and proved by the provider(s) of f? Thanks.

Best Regards,
Yixuan (Luke) Chen




This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please contact the sender and delete the email and
attachment. 

Any views or opinions expressed by the author of this email do not
necessarily reflect the views of the University of Nottingham. Email
communications with the University of Nottingham may be monitored 
where permitted by law.






Archive powered by MHonArc 2.6.18.

Top of Page