coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Merlin Göttlinger <megoettlinger AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Mutual Fixpoints into mutual inductive types
- Date: Sun, 07 Jan 2018 12:02:34 +0000
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=megoettlinger AT gmail.com; spf=Pass smtp.mailfrom=megoettlinger AT gmail.com; spf=None smtp.helo=postmaster AT mail-it0-f42.google.com
- Ironport-phdr: 9a23:BDG3QxRxUXwdvghJQqPBKq+uldpsv+yvbD5Q0YIujvd0So/mwa6yZxON2/xhgRfzUJnB7Loc0qyK6/mmATRIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfa5+IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbDVwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4qF2QxHqlSgHLSY0/27ZisNyjKxVrhGvqQFhzYHIe4yaLuZyc7nHcN8GWWZMXMBcXDFBDIOmaIsPCvIMM+FGoInno1sOrB2+ChGtCvvp1j9Imnv23aw80+QuDw7GxhErEtULsHvKo9X1M7kdUfypzKnMzDXDafxW1inn6IXTfRAhpOuDXbN0ccbL1UYvEAbFg0yWpIf4MT2V0eENvHKa7+pmTe+viWknpBttrTivx8csj5DFiZkPyl/a9CV53IA1KsOiSEJhfNGrDoNcty6bN4tqQsMiXnpntDwmxb0BvJ63ZDMKyIg9yBHDaPyHdJaI7Qz5VOafJTd4g3xkdKijiBa19EitzPD3WMqs0FtSsCZJjt3BumoO2hHT8MSLVOZx80i71TuAyQze7PxPL1oumqrBMZEhx6Y9lpoNvkTHGS/7gED2g7WXdkUg4+So6vjnbqn/qp+SOIJ4lBvyMqspmsy4DuQ4NhYBU3KH9uS70b3v5Uz5QLNUgf0qiqTVrozWKMABqqO6AwJZyJgv5wuwAju839kUg2ELLFdfdxKGi4jpNUvOIPf9DfqnhlSjjjhrx/fYMb39HpXNKnnDkLHufblj8U5R0wUzzdVF6JJVDrENOu78Wkj0tNDAFB82LxS0w/r7CNV6zo4RRWWPAraAPKzOtV+I+/kgLvKXZI4VvTb9M+Iq6+TvjX8/g18dfLOm0YEZaHCiTbxaJBCSZmOpidMcG08LuBA/Rarkkg6sSzlWMlO/RaY94AYUlp66CYbFSY23yOiE0Si8E4FKYmFABV2WOXjtfoSAHfwLbXTBcYdajjUYWO35GMca3ha0uVqixg==
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/
- [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Pierre Courtieu, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Pierre Courtieu, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/07/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/07/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/07/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Pierre Courtieu, 01/05/2018
Archive powered by MHonArc 2.6.18.