decidable equality in basics
This commit is contained in:
parent
4d04279d04
commit
964ed65922
1 changed files with 11 additions and 0 deletions
|
@ -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}
|
||||
|
|
Loading…
Reference in a new issue