ProofRep.agda 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. module ProofRep where
  2. import Prelude
  3. import Logic.Relations
  4. import Logic.Identity
  5. import Data.Nat
  6. import Data.Nat.Properties
  7. open Prelude
  8. open Data.Nat hiding (_==_; _≡_)
  9. open Data.Nat.Properties
  10. open Logic.Relations
  11. module Foo (Var : Set) where
  12. data _==_ : (x y : Var) -> Set where
  13. cRefl : {x : Var} -> x == x
  14. cSym : {x y : Var} -> y == x -> x == y
  15. cTrans : {x y z : Var} -> x == z -> z == y -> x == y
  16. cAxiom : {x y : Var} -> x == y
  17. data Axioms {A : Set}(_≈_ : Rel A)([_] : Var -> A) : Set where
  18. noAxioms : Axioms _≈_ [_]
  19. anAxiom : (x y : Var) -> [ x ] ≈ [ y ] -> Axioms _≈_ [_]
  20. manyAxioms : Axioms _≈_ [_] -> Axioms _≈_ [_] -> Axioms _≈_ [_]
  21. refl : {x : Var} -> x == x
  22. refl = cRefl
  23. sym : {x y : Var} -> x == y -> y == x
  24. sym (cRefl xy) = cRefl (Var.sym xy)
  25. sym cAxiom = cSym cAxiom
  26. sym (cSym p) = p
  27. sym (cTrans z p q) = cTrans z (sym q) (sym p)
  28. trans : {x y z : Var} -> x == y -> y == z -> x == z
  29. trans {x}{y}{z} (cRefl xy) q = Var.subst (\w -> w == z) (Var.sym xy) q
  30. trans {x}{y}{z} p (cRefl yz) = Var.subst (\w -> x == w) yz p
  31. trans {x}{y}{z} (cTrans w p q) r = cTrans w p (trans q r)
  32. trans p q = cTrans _ p q