module Chapter4.Derivable.Examples.Nat where

open import Data.Bool
open import Data.Unit
open import Data.Sum
open import Data.Product

open import Relation.Nullary
open import Relation.Nullary.Decidable
open import Relation.Binary
open import Relation.Binary.PropositionalEquality

open import Chapter2.Desc
open import Chapter2.Desc.Fixpoint

open import Chapter4.Derivable
open import Chapter4.Derivable.Equality

NatD : Desc
NatD = `1 `+ `var

Nat : Set
Nat = μ NatD

ze : μ NatD
ze =  inj₁ tt 

su : μ NatD  μ NatD
su n =  inj₂ n 


natEq :  (x y : Nat)  Dec (x  y)
natEq = deriving Equality NatD tt

module Test where
  test-neq :  natEq (su ze) ze   false
  test-neq = refl

  test-eq :  natEq (su ze) (su ze)   true
  test-eq = refl