open import Arith::Nat::Core
open import Arith::Nat::Properties
open import Logic::False
open import Logic::Dec
open import Paths

open data infix < Nat Nat
| 0, suc mzc
| suc n, suc msc (n < m)

variable a b c : Nat

def trans< (a < b) (b < c) : a < c
| zc, sc _ ⇒ zc
| sc p1, sc p2sc (trans< p1 p2)

def asym (a < b) : ¬ (b < a)
| zc, ()
| sc p1, sc p2asym p1 p2

def unequal (a < b) : a  b
| zc, pz≠s p
| sc p1, punequal p1 (pmap pred p)

def dichotomy (a b : Nat) : Tri (b < a) (a = b) (a < b)
| 0, 0 ⇒ yesB idp
| 0, suc byesC zc
| suc a, 0 ⇒ yesA zc
| suc a, suc bmatch dichotomy a b
   { yesA pyesA (sc p)
   | yesB pyesB (pmap suc p)
   | yesC pyesC (sc p)
   }

def m<sn (p : a < b) : a < suc b
| zczc
| sc p'// p' : a' < b'
  // Goal : suc a' < suc (suc b')
  sc
    // Goal : a' < suc n'
    (m<sn p')