Nat.agda 529 B

1234567891011121314151617181920212223242526272829303132333435
  1. module Nat where
  2. import Bool
  3. open Bool
  4. data Nat : Set where
  5. zero : Nat
  6. suc : Nat -> Nat
  7. infixr 25 _+_
  8. _+_ : Nat -> Nat -> Nat
  9. zero + m = m
  10. suc n + m = suc (n + m)
  11. infix 10 _==_ _<_
  12. _==_ : Nat -> Nat -> Bool
  13. zero == zero = true
  14. suc n == zero = false
  15. zero == suc m = false
  16. suc n == suc m = n == m
  17. _<_ : Nat -> Nat -> Bool
  18. n < zero = false
  19. zero < suc m = true
  20. suc n < suc m = n < m
  21. {-# BUILTIN NATURAL Nat #-}
  22. -- {-# BUILTIN NATPLUS _+_ #-}
  23. -- {-# BUILTIN NATEQUALS _==_ #-}
  24. -- {-# BUILTIN NATLESS _<_ #-}