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
|
data ℕ : Set where
|
||||||
zero : ℕ
|
zero : ℕ
|
||||||
suc : ℕ → ℕ
|
suc : ℕ → ℕ
|
||||||
|
{-# BUILTIN NATURAL ℕ #-}
|
||||||
\end{code}
|
\end{code}
|
||||||
|
|
||||||
\begin{code}
|
\begin{code}
|
||||||
|
@ -31,6 +32,16 @@ distinct : ∀ {m} → zero ≢ suc m
|
||||||
distinct ()
|
distinct ()
|
||||||
\end{code}
|
\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
|
# Addition and its properties
|
||||||
|
|
||||||
\begin{code}
|
\begin{code}
|
||||||
|
|
Loading…
Reference in a new issue