a bit more basics of arithmetic
This commit is contained in:
parent
9067c7a317
commit
4d04279d04
1 changed files with 13 additions and 3 deletions
|
@ -6,14 +6,19 @@ permalink : /Basics
|
||||||
---
|
---
|
||||||
|
|
||||||
\begin{code}
|
\begin{code}
|
||||||
open import Data.Nat using (ℕ; zero; suc)
|
|
||||||
open import Data.Empty using (⊥; ⊥-elim)
|
open import Data.Empty using (⊥; ⊥-elim)
|
||||||
open import Relation.Nullary using (¬_; Dec; yes; no)
|
open import Relation.Nullary using (¬_; Dec; yes; no)
|
||||||
open import Relation.Binary.PropositionalEquality
|
open import Relation.Binary.PropositionalEquality
|
||||||
using (_≡_; refl; _≢_; trans; sym)
|
using (_≡_; refl; _≢_; trans; sym)
|
||||||
\end{code}
|
\end{code}
|
||||||
|
|
||||||
# Addition and its properties
|
# Natural numbers
|
||||||
|
|
||||||
|
\begin{code}
|
||||||
|
data ℕ : Set where
|
||||||
|
zero : ℕ
|
||||||
|
suc : ℕ → ℕ
|
||||||
|
\end{code}
|
||||||
|
|
||||||
\begin{code}
|
\begin{code}
|
||||||
congruent : ∀ {m n} → m ≡ n → suc m ≡ suc n
|
congruent : ∀ {m n} → m ≡ n → suc m ≡ suc n
|
||||||
|
@ -21,8 +26,13 @@ congruent refl = refl
|
||||||
|
|
||||||
injective : ∀ {m n} → suc m ≡ suc n → m ≡ n
|
injective : ∀ {m n} → suc m ≡ suc n → m ≡ n
|
||||||
injective refl = refl
|
injective refl = refl
|
||||||
|
|
||||||
|
distinct : ∀ {m} → zero ≢ suc m
|
||||||
|
distinct ()
|
||||||
\end{code}
|
\end{code}
|
||||||
|
|
||||||
|
# Addition and its properties
|
||||||
|
|
||||||
\begin{code}
|
\begin{code}
|
||||||
_+_ : ℕ → ℕ → ℕ
|
_+_ : ℕ → ℕ → ℕ
|
||||||
zero + n = n
|
zero + n = n
|
||||||
|
|
Loading…
Reference in a new issue