less prototype, less bad code implementation of CCHM type theory
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
992 B

  1. {-# PRIMITIVE Type #-}
  2. {-# PRIMITIVE Pretype #-}
  3. I : Pretype
  4. {-# PRIMITIVE Interval I #-}
  5. i0 : I
  6. i1 : I
  7. {-# PRIMITIVE i0 #-}
  8. {-# PRIMITIVE i1 #-}
  9. iand : I -> I -> I
  10. {-# PRIMITIVE iand #-}
  11. ior : I -> I -> I
  12. {-# PRIMITIVE ior #-}
  13. inot : I -> I
  14. {-# PRIMITIVE inot #-}
  15. PathP : (A : I -> Pretype) -> A i0 -> A i1 -> Type
  16. {-# PRIMITIVE PathP #-}
  17. Path : {A : Pretype} -> A -> A -> Type
  18. Path {A} = PathP (\i -> A)
  19. refl : {A : Pretype} {x : A} -> Path x x
  20. refl {A} {x} i = x
  21. sym : {A : I -> Pretype} {x : A i0} {y : A i1} -> PathP A x y -> PathP (\i -> A (inot i)) y x
  22. sym p i = p (inot i)
  23. the : (A : Pretype) -> A -> A
  24. the A x = x
  25. iElim : {A : I -> Pretype} {x : A i0} {y : A i1} -> PathP A x y -> (i : I) -> A i
  26. iElim p i = p i
  27. Singl : (A : Type) -> A -> Type
  28. Singl A x = (y : A) * Path x y
  29. isContr : Type -> Type
  30. isContr A = (x : A) * ((y : A) -> Path x y)
  31. singContr : {A : Type} {a : A} -> isContr (Singl A a)
  32. singContr {A} {a} = ((a, \i -> a), \y i -> (y.2 i, \j -> y.2 (iand i j)))