StructuralOrder.agda 858 B

12345678910111213141516171819202122232425262728293031323334353637
  1. -- some examples for structural order in the termination checker
  2. module StructuralOrder where
  3. data Nat : Set where
  4. zero : Nat
  5. succ : Nat -> Nat
  6. -- c t > t for any term t
  7. -- e.g., succ (succ y) > succ y
  8. plus : Nat -> Nat -> Nat
  9. plus x (succ (succ y)) = succ (plus x (succ y))
  10. plus x (succ zero) = succ x
  11. plus x zero = x
  12. -- constructor names do not matter
  13. -- c (c' t) > c'' t
  14. -- e.g. c0 (c1 x) > c0 x
  15. -- c0 (c0 x) > c1 x
  16. -- Actually constructor names does matter until the non-mattering is
  17. -- implemented properly.
  18. {- TEMPORARILY REMOVED by Ulf since there are problems with the constructor-name ignoring
  19. data Bin : Set where
  20. eps : Bin
  21. c0 : Bin -> Bin
  22. c1 : Bin -> Bin
  23. foo : Bin -> Nat
  24. foo eps = zero
  25. foo (c0 eps) = zero
  26. foo (c0 (c1 x)) = succ (foo (c0 x))
  27. foo (c0 (c0 x)) = succ (foo (c1 x))
  28. foo (c1 x) = succ (foo x)
  29. -}