<div dir="ltr">But this one is tail recursive, last operation is the recursive call, it will not terminate but probably will not cause any runtime problem.<div><br></div><div>As for the termination checker, I think somebody else can answer this question. From what I know Agda should easily detect such conditions, but the type checking is separated from the termination checking.<br>
<div><div><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 4, 2013 at 4:01 PM, Dan Piponi <span dir="ltr">&lt;<a href="mailto:dpiponi@gmail.com" target="_blank">dpiponi@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">I thought such things were supposed to be caught by the termination checker. For example</span></div>
<div class="im"><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><br>
</span></div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">f (suc n) = f (suc n)</span><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><br></span></div></div>
<div>
<font color="#500050" face="arial, sans-serif">isn&#39;t structurally decreasing either, but it doesn&#39;t cause a stack overflow.</font></div><div><font color="#500050" face="arial, sans-serif"><br></font></div><div><font color="#500050" face="arial, sans-serif">Maybe I misunderstood what the termination checker can catch.</font></div>

</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 4, 2013 at 7:47 AM, Wojciech Meyer <span dir="ltr">&lt;<a href="mailto:wojciech.meyer@gmail.com" target="_blank">wojciech.meyer@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>It&#39;s not a bug in Agda, but the reason for that is that the recursion is not terminating at all.</div>

<div><div><br></div><div> f (suc n) = f (suc n) ■ refl</div></div><div>the argument is not structurally decreasing, after each recursive call.</div>
<div><br></div><div>You should write instead:</div><div> f (suc n) = f n ■ refl</div><div><br></div><div>Wojciech</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Wed, Sep 4, 2013 at 3:25 PM, Dan Piponi <span dir="ltr">&lt;<a href="mailto:dpiponi@gmail.com" target="_blank">dpiponi@gmail.com</a>&gt;</span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div>This short piece of code causes a stack overflow in 2.3.2.1 (sometimes after a long wait):</div>

<div>
<br></div><div>{-# OPTIONS --without-K --type-in-type #-}</div><div><br></div><div>module bug where</div>
<div><br></div><div> open import Data.Nat</div><div><br></div><div> infix 3 _≡_</div><div><br></div><div> data _≡_ {A : Set} : A → A → Set where</div><div>   refl : {a : A} → a ≡ a</div><div><br></div><div> infixr 14 _■_</div>



<div> _■_ : {A : Set} {x y z : A} → (x ≡ y) → (y ≡ z) → (x ≡ z)</div><div> refl ■ refl = refl</div><div><br></div><div> f : ℕ → ℕ ≡ ℕ</div><div> f zero = refl</div><div> f (suc n) = f (suc n) ■ refl</div></div>
<br></div></div>_______________________________________________<br>
Agda mailing list<br>
<a href="mailto:Agda@lists.chalmers.se" target="_blank">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>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>