Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 549 Bytes

Integers.lagda.md

File metadata and controls

27 lines (21 loc) · 549 Bytes

Imports are necessary obviously!

{-# OPTIONS --cubical #-}

open import Cubical.Core.Everything

Let's make the goddamned integers!

data  : Set where
  zero :succ :pred :succ∙pred≡id :  {z : ℤ}  succ (pred z) ≡ z
  pred∙succ≡id :  {z : ℤ}  pred (succ z) ≡ z

Let us define addition using the old properties of associativity : a + (b + 1) = (a + b) + 1

_+_ : ℤ
zero + n = n
(succ n) + m = succ (n + m)
(pred n) + m = n + m