TerminationTwoConstructors.agda 329 B

12345678910111213141516171819202122
  1. {-# OPTIONS --termination-depth=2 #-}
  2. module TerminationTwoConstructors where
  3. data Nat : Set where
  4. zero : Nat
  5. suc : Nat -> Nat
  6. f : Nat -> Nat
  7. f zero = zero
  8. f (suc zero) = zero
  9. f (suc (suc n)) with zero
  10. ... | m = f (suc n)
  11. {- this type checks with --termination-depth >= 2
  12. calls:
  13. f -> f_with (-2)
  14. f_with -> f (+1)
  15. -}