Guest User

Untitled

a guest
Apr 25th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.88 KB | None | 0 0
  1. // Homogeneous groupoid operations
  2.  
  3. theorem Refl(#l:lvl) :
  4. (->
  5. [ty : (U #l kan)]
  6. [a : ty]
  7. (path [_] ty a a))
  8. by {
  9. lam ty a => abs _ => `a
  10. }.
  11.  
  12. theorem Symm(#l:lvl) :
  13. (->
  14. [ty : (U #l kan)]
  15. [p : (line [_] ty)]
  16. (path [_] ty (@ p 1) (@ p 0)))
  17. by {
  18. lam ty p => abs x =>
  19. `(hcom 0~>1 ty (@ p 0)
  20. [x=0 [y] (@ p y)]
  21. [x=1 [_] (@ p 0)])
  22. }.
  23.  
  24. theorem Trans(#l:lvl) :
  25. (->
  26. [ty : (U #l kan)]
  27. [p : (line [_] ty)]
  28. [q : (line [_] ty)]
  29. [eq : (= ty (@ p 1) (@ q 0))]
  30. (path [_] ty (@ p 0) (@ q 1)))
  31. by {
  32. lam ty p q eq => (abs x =>
  33. `(hcom 0~>1 ty (@ p x)
  34. [x=0 [_] (@ p 0)]
  35. [x=1 [z] (@ q z)]));
  36. auto; assumption
  37. }.
  38.  
  39. theorem Symm/Unit(#l:lvl) :
  40. (->
  41. [ty : (U #l kan)]
  42. [a : ty]
  43. (path [_]
  44. (path [_] ty a a)
  45. (abs [_] a)
  46. ($ (Symm #l) ty (abs [_] a))))
  47. by {
  48. lam ty a =>
  49. abs y x =>
  50. `(hcom 0~>y ty a [x=0 [_] a] [x=1 [_] a])
  51. }.
  52.  
  53. theorem Trans/Unit/R(#l:lvl) :
  54. (->
  55. [ty : (U #l kan)]
  56. [p : (line [_] ty)]
  57. (path [_]
  58. (path [_] ty (@ p 0) (@ p 1))
  59. p
  60. ($ (Trans #l) ty p (abs [_] (@ p 1)) ax)))
  61. by {
  62. lam ty p =>
  63. (abs y x =>
  64. `(hcom 0~>y ty (@ p x) [x=0 [_] (@ p 0)] [x=1 [_] (@ p 1)]));
  65.  
  66. refine path/eq/from-line; auto
  67. }.
  68.  
  69. // Thanks to Bruno Bentzen for already doing this and drawing a picture! -Carlo
  70. theorem Trans/Sym/R(#l:lvl) :
  71. (->
  72. [ty : (U #l kan)]
  73. [p : (line [_] ty)]
  74. (path [_]
  75. (path [_] ty (@ p 0) (@ p 0))
  76. (abs [_] (@ p 0))
  77. ($ (Trans #l) ty p ($ (Symm #l) ty p) ax)))
  78. by {
  79. lam ty p =>
  80. (abs z x =>
  81. `(hcom 0~>1 ty (@ p x)
  82. [x=0 [_] (@ p 0)]
  83. [x=1 [y] (@ ($ (Symm #l) ty p) y)]
  84. [z=0 [y] (hcom 0~>x ty (@ p 0) [y=0 [x] (@ p x)] [y=1 [_] (@ p 0)])]
  85. [z=1 [y]
  86. (hcom 0~>y ty (@ p x)
  87. [x=0 [_] (@ p 0)]
  88. [x=1 [y] (@ ($ (Symm #l) ty p) y)])]));
  89. unfold Symm; auto
  90. }.
  91.  
  92. //// My tests - Bruno
  93.  
  94. // My first theorem in RedPRL! :D - Bruno
  95.  
  96. theorem Refl/Inv(#l:lvl) :
  97. (->
  98. [ty : (U #l kan)]
  99. [a : ty]
  100. (path [_]
  101. (path [_] ty a a)
  102. (abs [_] a)
  103. ($ (Symm #l) ty ($ (Symm #l) ty (abs [_] a) )) ))
  104. by {
  105. lam ty a =>
  106. (abs z x =>
  107. `(hcom 0~>1 ty a
  108. [x=0 [y] (@ ($ (Symm/Unit #l) ty a) z y)]
  109. [x=1 [_] a]
  110. [z=0 [y] a]
  111. [z=1 [y] (hcom 0~>y ty (@ ($ (Symm #l) ty (abs [_] a)) 0)
  112. [x=0 [y] (@ ($ (Symm #l) ty (abs [_] a)) y)]
  113. [x=1 [_] (@ ($ (Symm #l) ty (abs [_] a)) 0)]) ]
  114. )
  115. );
  116. unfold Symm; auto
  117. }.
  118.  
  119. // Thanks to Carlo for helping me with this! - Bruno
  120.  
  121. theorem Square/Swap(#l:lvl) :
  122. (->
  123. [ty : (U #l kan)]
  124. [p : (-> dim dim ty)]
  125. (path [z] (path [_] ty
  126. (@ ($ (Symm #l) ty (abs [z] (@ p z 0))) z)
  127. (@ ($ (Symm #l) ty (abs [z] (@ p z 1))) z))
  128. (@ p 1)
  129. (@ p 0)))
  130. by {
  131. lam ty p =>
  132. (abs x z =>
  133. `(hcom 0~>1 ty (@ p 0 z)
  134. [x=0 [y] (@ p y z) ]
  135. [x=1 [_] (@ p 0 z) ]
  136. [z=0 [y] (hcom 0~>y ty (@ p 0 0)
  137. [x=0 [y] (@ p y 0)]
  138. [x=1 [_] (@ p 0 0)]) ]
  139. [z=1 [y] (hcom 0~>y ty (@ p 0 1)
  140. [x=0 [y] (@ p y 1)]
  141. [x=1 [_] (@ p 0 1)]) ]
  142. )
  143. ); auto; symmetry; unfold Symm; refine path/eq/eta;
  144. [id, refine path/eq/from-line, id, refine path/eq/from-line]; auto
  145. }.
  146.  
  147. // This is the error message I am getting with this double square swap function:
  148. // Error resolving abt: SortError
  149. // I suspect that the root of problem here is that ($ (Square/Swap #l) ty (@ p z x))
  150. // is an element of (path [z] (path [_] ty ...) while Square/Swap is expecting an
  151. // object of (-> dim dim ty).
  152. // If this is the case, can we cast the former type into the latter?
  153.  
  154. theorem Double/Swap(#l:lvl) :
  155. (->
  156. [ty : (U #l kan)]
  157. [p : (-> dim dim ty)]
  158. (path [z] (path [_] ty
  159. (@ ($ (Symm #l) ty ($ (Symm #l) ty (abs [z] (@ p z 0)))) z)
  160. (@ ($ (Symm #l) ty ($ (Symm #l) ty (abs [z] (@ p z 1)))) z))
  161. (@ p 0)
  162. (@ p 1)))
  163. by {
  164. lam ty p =>
  165. (abs z x =>
  166. ($ (Square/Swap #l) ty ($ (Square/Swap #l) ty (@ p z x)))
  167. );
  168. auto
  169. }.
  170.  
  171. // The reason I need double square swap is to mechanize my proof that p = p^-1^-1:
  172.  
  173. //theorem Sym/Inv(#l:lvl) :
  174. // (->
  175. // [ty : (U #l kan)]
  176. // [p : (line [_] ty)]
  177. // (path [_] (path [_] ty
  178. // (@ p 0)
  179. // (@ p 1))
  180. // p
  181. // ($ (Symm #l) ty ($ (Symm #l) ty p )) ))
  182. //by {
  183. // lam ty a =>
  184. // (abs z x =>
  185. // `(hcom 0~>1 ty (@ ($ (Refl/Inv #l) ty (@ p 0) ) z x)
  186. // [x=0 [y] (@ ($ (Symm #l) ty p) y)]
  187. // [x=1 [_] ($ (Trans #l) ty ($ (Symm #l) ty p) p ax) ]
  188. // [z=0 [y] (hcom 0~>x ty (@ ($ (Symm #l) ty p) y)
  189. // [y=0 [_] (@ p 1)]
  190. // [y=1 [x] (@ p x)]) ]
  191. //
  192. // [z=1 [y] ...Needs the Double/Swap of the above hcom here... ]
  193. // )
  194. // );
  195. // unfold Symm; auto
  196. //}.
  197.  
  198. // This is another proof I am stuck with:
  199. // 22 Remaining obligations
  200. // Am I doing something silly here again?
  201.  
  202. theorem Square/Op(#l:lvl) :
  203. (->
  204. [ty : (U #l kan)]
  205. [p : (line [_] ty)]
  206. (path [z] (path [_] ty
  207. (@ p 0)
  208. (@ ($ (Symm #l) ty p) z) )
  209. p
  210. (abs [_] (@ p 0)) ))
  211. by {
  212. lam ty p =>
  213. (abs z x =>
  214. `(hcom 0~>1 ty (hcom 0~>z ty (@ p x)
  215. [x=0 [_] (@ p 0)]
  216. [x=1 [z] (@ ($ (Symm #l) ty p) z)])
  217. [x=0 [_] (@ p 0)]
  218. [x=1 [_] (@ ($ (Symm #l) ty p) z)]
  219. [z=0 [_] (@ p x)]
  220. [z=1 [y] (@ ($ (Symm #l) ty
  221. ($ (Trans/Sym/R #l) ty p)
  222. )
  223. y x) ]
  224. ));
  225. unfold Symm; auto
  226. }.
  227.  
  228. //// End - Bruno
  229.  
  230. // Heterogeneous groupoid operations
  231.  
  232. theorem DSymm(#l:lvl) :
  233. (->
  234. [ty : (line [_] (U #l kan))]
  235. [p : (line [x] (@ ty x))]
  236. (path [x]
  237. (@ ($ (Symm (++ #l)) (U #l kan) ty) x)
  238. (@ p 1)
  239. (@ p 0)))
  240. by {
  241. lam ty p =>
  242. (abs x =>
  243. `(com 0~>1
  244. [y] (hcom 0~>y (U #l kan) (@ ty 0) [x=0 [y] (@ ty y)] [x=1 [_] (@ ty 0)])
  245. (@ p 0)
  246. [x=0 [y] (@ p y)]
  247. [x=1 [_] (@ p 0)]));
  248. unfold Symm; auto
  249. }.
Add Comment
Please, Sign In to add comment