Subset.agda 556 B

123456789101112131415161718192021222324252627282930313233343536
  1. -- Proof irrelevance is nice when you want to work with subsets.
  2. module Subset where
  3. data True : Prop where
  4. tt : True
  5. data False : Prop where
  6. data (|) (A:Set)(P:A -> Prop) : Set where
  7. sub : (x:A) -> P x -> A | P
  8. data Nat : Set where
  9. zero : Nat
  10. suc : Nat -> Nat
  11. mutual
  12. IsEven : Nat -> Prop
  13. IsEven zero = True
  14. IsEven (suc n) = IsOdd n
  15. IsOdd : Nat -> Prop
  16. IsOdd zero = False
  17. IsOdd (suc n) = IsEven n
  18. Even : Set
  19. Even = Nat | IsEven
  20. Odd : Set
  21. Odd = Nat | IsOdd
  22. (+) : Nat -> Nat -> Nat
  23. zero + m = m
  24. suc n + m = suc (n + m)