decidable equality in basics

This commit is contained in:
Philip Wadler 2017-10-01 22:06:35 +01:00
parent 4d04279d04
commit 964ed65922

View file

@ -18,6 +18,7 @@ open import Relation.Binary.PropositionalEquality
data : Set where
zero :
suc :
{-# BUILTIN NATURAL #-}
\end{code}
\begin{code}
@ -31,6 +32,16 @@ distinct : ∀ {m} → zero ≢ suc m
distinct ()
\end{code}
\begin{code}
_≟_ : ∀ (m n : ) → Dec (m ≡ n)
zero ≟ zero = yes refl
zero ≟ suc n = no (λ())
suc m ≟ zero = no (λ())
suc m ≟ suc n with m ≟ n
... | yes refl = yes refl
... | no p = no (λ r → p (injective r))
\end{code}
# Addition and its properties
\begin{code}