proofs.agda 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. module proofs where
  2. open import univ
  3. open import cwf
  4. open import Base
  5. open import Nat
  6. open import help
  7. {-
  8. lem-id∘ : {Γ Δ : Con}(σ : Γ ─→ Δ) -> id ∘ σ == σ
  9. lem-id∘ (el < σ , pσ >) = eq \x -> ref
  10. lem-∘id : {Γ Δ : Con}(σ : Γ ─→ Δ) -> σ ∘ id == σ
  11. lem-∘id (el < σ , pσ >) = eq \x -> ref
  12. lem-∘assoc : {Γ Δ Θ Ξ : Con}(σ : Θ ─→ Ξ)(δ : Δ ─→ Θ)(θ : Γ ─→ Δ) ->
  13. (σ ∘ δ) ∘ θ == σ ∘ (δ ∘ θ)
  14. lem-∘assoc (el < σ , pσ >) (el < δ , pδ >) (el < θ , pθ >) = eq \x -> ref
  15. -}
  16. lem-/∘ : {Γ Δ Θ : Con}(A : Type Γ)(σ : Δ ─→ Γ)(δ : Θ ─→ Δ) ->
  17. A / σ ∘ δ =Ty A / σ / δ
  18. lem-/∘ A (el < _ , _ >) (el < _ , _ >) = eqTy \x -> refS
  19. {-
  20. lem-//id : {Γ : Con}{A : Type Γ}{u : Elem Γ A} -> u // id =El castElem lem-/id u
  21. lem-//id {Γ}{A}{elem (el < u , pu >)} = eqEl (eq prf)
  22. where
  23. prf : (x : El Γ) -> _
  24. prf x =
  25. chain> u x
  26. === _ << u (refS << x) by pu (sym (ref<< x))
  27. === _ << u (refS << x) by pfi _ _ _
  28. where open module C11 = Chain _==_ (ref {_}) (trans {_})
  29. lem-//∘ : {Γ Δ Θ : Con}{A : Type Γ}(u : Elem Γ A)(σ : Δ ─→ Γ)(δ : Θ ─→ Δ) ->
  30. u // σ ∘ δ =El castElem (lem-/∘ A σ δ) (u // σ // δ)
  31. lem-//∘ {Γ}{Δ}{Θ} (elem (el < u , pu >)) σ'@(el < σ , _ >) δ'@(el < δ , _ >) = eqEl (eq prf)
  32. where
  33. prf : (x : El Θ) -> _
  34. prf x =
  35. chain> u (σ (δ x))
  36. === _ << u (σ (δ (refS << x))) by pu (p─→ σ' (p─→ δ' (sym (ref<< x))))
  37. === _ << u (σ (δ (refS << x))) by pfi _ _ _
  38. where open module C12 = Chain _==_ (ref {_}) (trans {_})
  39. lem-wk∘σ,,u : {Γ Δ : Con}{A : Type Γ}(σ : Δ ─→ Γ)(u : Elem Δ (A / σ)) ->
  40. wk ∘ (σ ,, u) == σ
  41. lem-wk∘σ,,u (el < σ , pσ >) (elem (el < u , pu >)) = eq \x -> ref
  42. lem-/wk∘σ,,u : {Γ Δ : Con}(A : Type Γ)(σ : Δ ─→ Γ)(u : Elem Δ (A / σ)) ->
  43. A / wk / (σ ,, u) =Ty A / σ
  44. lem-/wk∘σ,,u A (el < σ , pσ >) (elem (el < u , pu >)) = eqTy \x -> refS
  45. lem-vz/σ,,u : {Γ Δ : Con}{A : Type Γ}(σ : Δ ─→ Γ)(u : Elem Δ (A / σ)) ->
  46. vz // (σ ,, u) =El castElem (lem-/wk∘σ,,u A σ u) u
  47. lem-vz/σ,,u (el < σ , pσ >) (elem (el < u , pu >)) = eqEl (eq \x -> prf x)
  48. where
  49. prf : (x : El _) -> u x == _ << u (refS << x)
  50. prf x =
  51. chain> u x
  52. === _ << u (refS << x) by pu (sym (ref<< x))
  53. === _ << u (refS << x) by pfi _ _ _
  54. where open module C15 = Chain _==_ (ref {_}) (trans {_})
  55. lem-σ,,u∘ : {Γ Δ Θ : Con}{A : Type Γ}
  56. (σ : Δ ─→ Γ)(u : Elem Δ (A / σ))(δ : Θ ─→ Δ) ->
  57. (σ ,, u) ∘ δ == (σ ∘ δ ,, castElem (lem-/∘ A σ δ) (u // δ))
  58. lem-σ,,u∘ (el < σ , _ >) (elem (el < u , pu >)) δ'@(el < δ , _ >) =
  59. eq \x -> eq < ref , prf x >
  60. where
  61. prf : (x : El _) -> u (δ x) == _ << _ << u (δ (refS << x))
  62. prf x =
  63. chain> u (δ x)
  64. === _ << u (δ (refS << x)) by pu (p─→ δ' (sym (ref<< x)))
  65. === _ << _ << u (δ (refS << x)) by sym (casttrans _ _ _ _)
  66. where open module C15 = Chain _==_ (ref {_}) (trans {_})
  67. lem-wk,,vz : {Γ : Con}{A : Type Γ} -> (wk ,, vz) == id {Γ , A}
  68. lem-wk,,vz {Γ}{A} = eq prf
  69. where
  70. prf : (x : El (Γ , A)) -> _
  71. prf (el < x , y >) = ref
  72. -}
  73. lem-Π/ : {Γ Δ : Con}{A : Type Γ}(B : Type (Γ , A))(σ : Δ ─→ Γ) ->
  74. Π A B / σ =Ty Π (A / σ) (B / (σ ∘ wk ,, castElem (lem-/∘ A σ wk) vz))
  75. lem-Π/ B (el < σ , pσ >) =
  76. eqTy \x -> eqS < refS , (\y -> pFam B (eq < ref , prf x y >)) >
  77. where
  78. postulate prf : (x : El _)(y : El _) -> y == _ << _ << _ << _ << y
  79. -- prf x y =
  80. -- chain> y
  81. -- === _ << _ << y by sym (castref2 _ _ y)
  82. -- === _ << _ << _ << y by trans<< _ _ _
  83. -- === _ << _ << _ << _ << y by trans<< _ _ _
  84. -- where open module C16 = Chain _==_ (ref {_}) (trans {_})
  85. {-
  86. lem-β : {Γ : Con}{A : Type Γ}{B : Type (Γ , A)}
  87. (v : Elem (Γ , A) B)(u : Elem Γ A) ->
  88. (ƛ v) ∙ u =El v // [ u ]
  89. lem-β {Γ}{A}{B} (elem (el < v , pv >)) (elem (el < u , pu >)) = eqEl (eq \x -> prf x _ _)
  90. where
  91. prf : (x : El Γ)(q : _ =S _)(p : _ =S _) ->
  92. p << v (el < x , u x >) == v (el < x , q << u (refS << x) >)
  93. prf x q p =
  94. chain> p << v (el < x , u x >)
  95. === p << q0 << v (el < x , q1 << u (refS << x) >)
  96. by p<< p (pv (eqSnd (pu (sym (ref<< x)))))
  97. === q2 << v (el < x , q1 << u (refS << x) >)
  98. by sym (trans<< p q0 _)
  99. === q2 << q3 << v (el < x , q << u (refS << x) >)
  100. by p<< q2 (pv (eqSnd (pfi q1 q _)))
  101. === v (el < x , q << u (refS << x) >)
  102. by castref2 q2 q3 _
  103. where
  104. open module C17 = Chain _==_ (ref {_}) (trans {_})
  105. q0 = _
  106. q1 = _
  107. q2 = _
  108. q3 = _
  109. -}