<div dir="ltr"><div><div><div>&gt; But  thm  is useless, because the type for its first argument is empty.<br></div><a href="http://www.cse.chalmers.se/~nad/listings/lib-0.7/Data.Empty.html#326">⊥-elim</a> is looking at you questionably?</div>
<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-02 20:42 GMT+03:00 Sergei Meshveliani <span dir="ltr">&lt;<a href="mailto:mechvel@botik.ru" target="_blank">mechvel@botik.ru</a>&gt;</span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, 2014-07-02 at 18:00 +0200, Ulf Norell wrote:<br>
&gt;<br>
&gt; [..]<br>
<div><div class="h5"><br>
<br>
&gt;         &gt; For instance,<br>
&gt;         &gt;<br>
&gt;         &gt; False : ℕ → Set<br>
&gt;         &gt; False _ = ⊥<br>
&gt;         &gt;<br>
&gt;         &gt; decFalse : Decidable False<br>
&gt;         &gt; decFalse _ = no (λ x → x)<br>
&gt;         &gt;<br>
&gt;         &gt; loopy : ¬ (∀ n → ¬ False n) → Σ ℕ False<br>
&gt;         &gt; loopy H = findNatByContra False decFalse H<br>
&gt;         &gt;<br>
&gt;         &gt;<br>
&gt;         &gt; Here, loopy will happily evaluate forever with the<br>
&gt;         hypothetical<br>
&gt;         &gt; (classical) proof that there is a number satisfying False.<br>
&gt;         There &gt; is no need to evaluate under the case since decFalse<br>
&gt;         comes back &gt; &#39;no&#39; for any number.<br>
&gt;<br>
&gt;<br>
&gt;         Can you, please, explain further?<br>
&gt;<br>
&gt;         To apply  (loopy H),  one needs to provide<br>
&gt;                                            H : (∀ n → ¬ False n) → ⊥.<br>
&gt;<br>
&gt;         And this is not possible, because its type normalizes to<br>
&gt;<br>
&gt;         ((n : ℕ) → (False n → ⊥)) → ⊥,  and to  ((n : ℕ) → (⊥ → ⊥)) →<br>
&gt;         ⊥,<br>
&gt;<br>
&gt;         and the type  (n : ℕ) → (⊥ → ⊥)  has a value  (\n → id)  in<br>
&gt;         it.<br>
&gt;<br>
&gt;<br>
&gt;         As one cannot provide any argument value to `loopy&#39;,  how can<br>
&gt;         it<br>
&gt;         evaluate forever?<br>
&gt;<br>
&gt;<br>
&gt; The problem is that in Agda programs need to terminate not only at<br>
&gt; run-time when you apply them to actual arguments, but also at type<br>
&gt; checking-time when the type checker runs programs to check for<br>
&gt; equality. For instance, suppose you define loopy as above and then try<br>
&gt; to prove that loopy always returns 42<br>
&gt;<br>
&gt;<br>
&gt; thm : (H : ¬ (∀ n → ¬ False n)) → proj₁ (loopy H) ≡ 42<br>
&gt; thm _ = refl<br>
&gt;<br>
&gt;<br>
&gt; In this case the type checker needs to evaluate loopy in the context<br>
&gt; of the<br>
&gt; free variable H to check if it normalises to 42. This evaluation will<br>
&gt; not terminate<br>
&gt; with your definition of findNatByContra.<br>
&gt;<br>
<br>
</div></div>But  thm  is useless, because the type for its first argument is empty.<br>
I hope, I can provide examples of practically usable programs which<br>
apply  findNatByContra.<br>
<br>
1) But can `loopy&#39; be introduced other than by a mistake?<br>
   Is there an example of a practically usable program which also uses<br>
   `loopy&#39; ?<br>
<br>
2) Suppose one introduces `loopy&#39; by a mistake, and sets its various<br>
invocations, also by a mistake. What can happen then, in the worst case?<br>
Probably, the type checker will loop forever, and the user will<br>
interrupt the process of checking (as I did 10 minutes ago!).<br>
This will not make the whole usage worse, because there are many other<br>
ways in Agda to make the checker loop forever.<br>
<br>
Am I missing something?<br>
<div class="HOEnZb"><div class="h5"><br>
Regards,<br>
<br>
------<br>
Sergei<br>
<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>
</div></div></blockquote></div><br></div>