<div dir="ltr">You can define an irrelevant version of ⊥-elim which you can use in foo2 and foo3:<div><br></div><div><div>⊥-elim-irr : .(x : ⊥) → ∀ {a}{A : Set a} → A</div><div>⊥-elim-irr ()</div></div><div><br></div><div>
/ Ulf</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jan 19, 2014 at 2:50 PM, Sergei Meshveliani <span dir="ltr"><<a href="mailto:mechvel@botik.ru" target="_blank">mechvel@botik.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Please,<br>
how to fix foo2, foo3 shown below?<br>
<br>
----------------------------------------------------------------<br>
open import Relation.Binary.PropositionalEquality as PE using (_≡_; _≢_)<br>
open import Data.Empty using (⊥-elim)<br>
open import Data.Nat using (ℕ; module ℕ)<br>
<br>
open ℕ<br>
<br>
foo : (m n : ℕ) → n ≢ zero → ℕ -- this works<br>
foo _ (suc n) _ = n<br>
foo _ zero nz = ⊥-elim (nz PE.refl)<br>
<br>
<br>
foo2 : (m n : ℕ) → .(n ≢ zero) → ℕ<br>
foo2 _ (suc n) _ = n<br>
foo2 _ zero _ = ⊥-elim (u PE.refl) -- is not type-checked<br>
where<br>
u : zero ≢ zero<br>
u = _<br>
{-<br>
foo3 : (m n : ℕ) → .{nz : n ≢ zero} → ℕ<br>
foo3 _ (suc n) {_} = n<br>
foo3 _ zero {_} = ⊥-elim (u PE.refl) -- is not type-checked<br>
where<br>
u : zero ≢ zero<br>
u = {!!}<br>
-}<br>
---------------------------------------------------------------------<br>
<br>
The checker (of development Agda of January 8, 2014)<br>
<br>
does not allow to skip the `zero' branch, nor to set () there,<br>
nor to apply ⊥-elim<br>
(nz is rejected for u, as well as '_').<br>
<br>
Thanks,<br>
<br>
------<br>
Sergei<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>