Acc.agda 973 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. module Acc where
  2. data Rel(A : Set) : Set1 where
  3. rel : (A -> A -> Set) -> Rel A
  4. _is_than_ : {A : Set} -> A -> Rel A -> A -> Set
  5. x is rel f than y = f x y
  6. data Acc {A : Set} (less : Rel A) (x : A) : Set where
  7. acc : ((y : A) -> x is less than y -> Acc less y) -> Acc less x
  8. data WO {A : Set} (less : Rel A) : Set where
  9. wo : ((x : A) -> Acc less x) -> WO less
  10. data False : Set where
  11. data True : Set where
  12. tt : True
  13. data Nat : Set where
  14. Z : Nat
  15. S : Nat -> Nat
  16. data ∏ {A : Set} (f : A -> Set) : Set where
  17. ∏I : ((z : A) -> f z) -> ∏ f
  18. data Ord : Set where
  19. z : Ord
  20. lim : (Nat -> Ord) -> Ord
  21. zp : Ord -> Ord
  22. zp z = z
  23. zp (lim f) = lim (\x -> zp (f x))
  24. _<_ : Ord -> Ord -> Set
  25. z < _ = True
  26. lim _ < z = False
  27. lim f < lim g = ∏ \(n : Nat) -> f n < g n
  28. ltNat : Nat -> Nat -> Set
  29. ltNat Z Z = False
  30. ltNat Z (S n) = True
  31. ltNat (S m) (S n) = ltNat m n
  32. ltNat (S m) Z = False
  33. ltNatRel : Rel Nat
  34. ltNatRel = rel ltNat
  35. postulate woltNat : WO ltNatRel