Unfortunately, (to the best of my knowledge) it&#39;s not trivial. Agda uses guarded corecursion, which essentially means that you need recursive calls to fibonaccis to have data constructors around them. I think the usual approach to fixing it would be to write an embedded language where zipWith is a constructor (that takes delayed arguments) and then you&#39;d write an interpreter that looks at those arguments and calls the real zipWith on them.<div>
<br></div><div>So basically, you&#39;d be constructing an infinite expression that describes how to compute the fibonaccis, and then interpreting that.</div><div><br></div><div>It may be possible to convince agda your fibonaccis is productive by increasing the termination checker depth, too, but I haven&#39;t played with that with coinduction.</div>
<div><br></div><div>Dan</div><div><br><div class="gmail_quote">On Fri, Jan 7, 2011 at 11:47 AM, Wolfgang Jeltsch <span dir="ltr">&lt;<a href="mailto:g9ks157k@acme.softbase.org">g9ks157k@acme.softbase.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
I just tried to define the Fibonacci sequence as follows:<br>
<br>
    fibonaccis : Stream ℕ<br>
    fibonaccis = 0 ∷ ♯ (1 ∷ ♯ zipWith _+_ fibonaccis (tail fibonaccis))<br>
<br>
However, the identifier “fibonaccis” gets a red background. How can I<br>
fix this?<br>
<br>
Best wishes,<br>
Wolfgang<br>
<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>
</blockquote></div><br></div>