Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Mutual Fixpoints into mutual inductive types

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Mutual Fixpoints into mutual inductive types


Chronological Thread 
  • From: Joachim Breitner <mail AT joachim-breitner.de>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Mutual Fixpoints into mutual inductive types
  • Date: Sun, 07 Jan 2018 22:59:10 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=mail AT joachim-breitner.de; spf=Neutral smtp.mailfrom=mail AT joachim-breitner.de; spf=None smtp.helo=postmaster AT hermes.serverama.de
  • Ironport-phdr: 9a23:S9chFxQCYBubllP3qY+K0UBWqdpsv+yvbD5Q0YIujvd0So/mwa6yZxeN2/xhgRfzUJnB7Loc0qyK6/mmATRIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfa5+IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbDVwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4qF2QxHqlSgHLSY0/mLKhMJwkqxVrhCupxJjzIDTb46YL/V+cr/HcN4AX2dNQsRcWipcCY28dYsPCO8BMP5coYn6vVQBsRu+BQipBOjy1zJInGH53awm0+QnDw7GxhErEtULsHvOrdX1MLwfUeKyzKbS0TrDb/JW2TLk5IfTaBAuv/CMXa52ccXP00kjDR7KgUuJpIHjIjib2OMNs22B4OphU+Kik2wnqwZrrTezxscsi4zJipsOxVDe6yp5wZo1JdumR05he9KrDYVfuzmVN4t3XsMiQ3xotz0gxrIavp67eTAGyI87xxHFd/OHcI+I4gz9W+aLLzd4gHVlebylixmu9kigz+vxXdS33lZStidJj9vBu3EX2xHX8MSLVOZx80m71TqS2Q3e5OdJKl0um6XBMZ4u2Lswm4ITsUvdGi/2n137jK+IeUU+/+in9f/nbq/9ppCCLY90lB/xMr40lcy6G+s0KBUBUHaD9eS90r3s41H5Ta1XgvA0k6TVqpTXKd4FqqKkDQJZyJsv5hixAju+1dQXh3gHLFZLeBKdiIjpPknDIPXiAve+h1ShizVrx/fcMbL9ApXNL33DnK76crZn9UFcyRYzzdZB6JJOEL0OPez8VlfrtNPEFh85LxC0w+H/Bdph0YMeQHuDDbOdMKPPqlCF/fkvIumJZI8NojnxMfkl5/j0jX84g1ARZ6ep3YFEIEy/S/9hOgCSZWfmqtYHC2YD+AQkH8Lwj1jXczlabHazWuoW/Dw6FISrF8+XQ4mshJSD2y6wHpxTI2pcB1GQF3ryMYmJDaRfIBmOK9Nsx2RXHYOqTJUsgEmj

Hi,

can you show us your definitions of traverse, sequence or map? Probably
you can fix this by adjusting your definition of traverse (e.g. by not
passing f in the recursive function, but rather follow the “local go”
pattern).

Cheers,
Joachim

Am Sonntag, den 07.01.2018, 12:02 +0000 schrieb Merlin Göttlinger:
> Hi,
>
> after rewriting all my typeclasses to this CPS-transformed ones, it
> was still one indirection too many for the termination checker BUT if
> I additionally change traverse to sequence after Vector.map it works
> as expected. It is also entirely possible that I made a mistake
> somewhere that causes this behaviour but at any rate it works now
> without having to inline the vector definition or other tricks.
> Thanks for your help.
>
> Cheers,
> Merlin
>
> Joachim Breitner
> <mail AT joachim-breitner.de>
> schrieb am Fr., 5. Jan. 2018 um 21:37 Uhr:
> > Hi,
> >
> > I at least found the time to search for where I wrote about this
> > before. I think you are hitting the problem that I describe in
> > https://stackoverflow.com/q/47082796/946226
> > The question talks about records, and not classes, but since Coq
> > classes are (normally) record type, it is the same problem – the
> > termination checker runs after type class resolution and sees the
> > underlying record.
> >
> > I describe our solution with CPS-transformed types for classes in the
> > first answer.
> >
> > Feel free to ask for further clarification, either here or on SE.
> >
> > Cheers,
> > Joachim
> >
> >
> > Am Freitag, den 05.01.2018, 18:55 +0000 schrieb Merlin Göttlinger:
> > > Hi,
> > >
> > > that sounds promising. I would be interrested to hear how this trick
> > > works because it certainly isn't obvious to me from looking a tthe code.
> > > So if you find the time later on to explain this I would be greatfull,
> > > but in any case thank you both for your help.
> > >
> > > Cheers,
> > > Merlin
> > >
> > > Joachim Breitner
> > > <mail AT joachim-breitner.de>
> > > schrieb am Fr., 5. Jan. 2018 um 19:14 Uhr:
> > > > Hi,
> > > >
> > > > Am Freitag, den 05.01.2018, 11:54 +0000 schrieb Merlin Göttlinger:
> > > > > VectorUtils.traverse depends on a bunch of stuff I implemented and
> > > > > is
> > > > > the usual operation known from e.g. Haskell with signature G A -> (A
> > > > > -> F B) -> F (G B) where G is (fun T => Vector.t T n) and F is list
> > > > > in my case.
> > > >
> > > > Coq’s termination checker cannot look through type class instances.
> > > >
> > > > There is a trick, however, if you get to choose the type class. See
> > > > https://github.com/antalsz/hs-to-coq/blob/master/base/GHC/Base.v#L41-L54
> > > > and let me know if you want more explanation (I am on the run right
> > > > now).
> > > >
> > > > Joachim
> > > >
> > > > --
> > > > Joachim Breitner
> > > >
> > > > mail AT joachim-breitner.de
> > > > http://www.joachim-breitner.de/
> > --
> > Joachim Breitner
> >
> > mail AT joachim-breitner.de
> > http://www.joachim-breitner.de/
--
Joachim Breitner

mail AT joachim-breitner.de
http://www.joachim-breitner.de/

Attachment: signature.asc
Description: This is a digitally signed message part




Archive powered by MHonArc 2.6.18.

Top of Page