Nat.agda 418 B

1234567891011121314151617181920212223242526272829303132
  1. module Nat where
  2. open import Prelude
  3. open import Star
  4. Nat : Set
  5. Nat = Star One _ _
  6. zero : Nat
  7. zero = ε
  8. suc : Nat -> Nat
  9. suc n = _ • n
  10. infixl 50 _+_ _-_
  11. infixl 60 _*_
  12. _+_ : Nat -> Nat -> Nat
  13. _+_ = _++_
  14. _*_ : Nat -> Nat -> Nat
  15. x * y = bind id (\ _ -> y) x
  16. _-_ : Nat -> Nat -> Nat
  17. n - ε = n
  18. ε - m = ε
  19. (_ • n) - (_ • m) = n - m
  20. test : Nat
  21. test = suc (suc zero) * suc (suc zero)