Thorsten, if by a good idea you mean intuitiveness, readaibility and ease of manipulation, I would agree that the alternatives clearly make more sense.<br><br><div class="gmail_quote">2011/5/30 Thorsten Altenkirch <span dir="ltr">&lt;<a href="mailto:txa@cs.nott.ac.uk">txa@cs.nott.ac.uk</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Thank you, Dan for summarizing the issues so well.<br>
<br>
One additional remark on a foundational level that it is not clear wether it is a good idea to &quot;explain&quot; e.g. the natural numbers via higher order functions and impredicative quantification.<br>
<br>
Cheers,<br>
<font color="#888888">Thorsten<br>
</font><div><div></div><div class="h5"><br>
On 29 May 2011, at 16:25, Dan Doel wrote:<br>
<br>
&gt; On Fri, May 27, 2011 at 5:49 PM, Anthony de Almeida Lopes<br>
&gt; &lt;<a href="mailto:anthony.de.almeida.lopes@falsifiable.net">anthony.de.almeida.lopes@falsifiable.net</a>&gt; wrote:<br>
&gt;&gt; Does anyone know why Wadler&#39;s &quot;Recursive Types for Free&quot; techniques are not<br>
&gt;&gt; used more widely, for example in Agda? Is it because of the inefficiency of<br>
&gt;&gt; execution?<br>
&gt;<br>
&gt; There are additional issues.<br>
&gt;<br>
&gt; First, the encoding requires impredicativity for it to be useful. If<br>
&gt; you don&#39;t have impredicativity, your datatypes end up being one level<br>
&gt; higher than they can eliminate over, so they can&#39;t eliminate over<br>
&gt; themselves. This would mean, for instance, that you can&#39;t define<br>
&gt; multiplication of naturals by iterated addition, you have to instead<br>
&gt; work with the underlying representation.<br>
&gt;<br>
&gt; Another problem with impredicativity is that it only the lowest level<br>
&gt; of a universe hierarchy may be impredicative without introducing<br>
&gt; inconsistency (at best). So, you cannot use this encoding for any data<br>
&gt; structures you want to use together with types and such, if you want<br>
&gt; them to be able to compute with themselves, as mentioned.<br>
&gt;<br>
&gt; A second problem is that you need to internalize parametricity to get<br>
&gt; strong induction principles for these encoded datatypes. I think this<br>
&gt; corresponds to weakly initial algebras vs. initial algebras, which<br>
&gt; Wadler talks about. However, how to incorporate parametricity into a<br>
&gt; theory is still a research question, and the only person I know making<br>
&gt; headway on it is Jean-Philipe Bernardy (who hangs out here<br>
&gt; occasionally).<br>
&gt;<br>
&gt; A third problem is that there&#39;s no obvious way to do large elimination<br>
&gt; for this encoding. If natural numbers are:<br>
&gt;<br>
&gt;  (R : Set) -&gt; R -&gt; (R -&gt; R) -&gt; R<br>
&gt;<br>
&gt; then you cannot eliminate into Set. If you choose:<br>
&gt;<br>
&gt;  (R : Set1) -&gt; R -&gt; (R -&gt; R) -&gt; R<br>
&gt;<br>
&gt; then you need to have cumulativity for normal functioning, and you<br>
&gt; can&#39;t eliminate into Set2. Etc. And if you try:<br>
&gt;<br>
&gt;  (i : Level) -&gt; (R : Set i) -&gt; R -&gt; (R -&gt; R) -&gt; R<br>
&gt;<br>
&gt; well, no one knows if it&#39;s safe to stick that sort of thing into Set<br>
&gt; impredicatively.<br>
&gt;<br>
&gt; And if you are trying to get large elimination, here&#39;s some food for<br>
&gt; thought: strong, impredicative sums are known to be inconsistent. You<br>
&gt; probably can&#39;t have all three of the above together without<br>
&gt; introducing partiality.<br>
&gt;<br>
&gt; So, there are a lot of issues before you even get to the fact that<br>
&gt; these encodings are asymptotically slower for a lot of uses.<br>
&gt;<br>
&gt; -- Dan<br>
&gt; _______________________________________________<br>
&gt; Agda mailing list<br>
&gt; <a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a><br>
&gt; <a href="https://lists.chalmers.se/mailman/listinfo/agda" target="_blank">https://lists.chalmers.se/mailman/listinfo/agda</a><br>
<br>
_______________________________________________<br>
Agda mailing list<br>
<a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a><br>
<a href="https://lists.chalmers.se/mailman/listinfo/agda" target="_blank">https://lists.chalmers.se/mailman/listinfo/agda</a><br>
</div></div></blockquote></div><br>