@@ -428,6 +428,19 @@ inferType v = case v of
428428 _ -> error $ " inferType: not neutral " ++ show (showVal v)
429429
430430(@@) :: ToFormula a => Val -> a -> Val
431+ (VTrans (VPLam i (VPathP p v0 v1)) psi u) @@ phi = case toFormula phi of
432+ -- This actually doesn't seem to matter, probably due to laziness!
433+ -- Dir 0 -> v0 `face` (i~>1)
434+ -- Dir 1 -> v1 `face` (i~>1)
435+ f -> let uf = u @@ f
436+ in comp i (p @@ f) uf
437+ (unionSystem (border v0 (invSystem f Zero ))
438+ (unionSystem (border v1 (invSystem f One ))
439+ (border uf (invSystem psi One ))))
440+ -- (VHComp i (VPathP p v0 v1) u us) @@ phi = case toFormula phi of
441+ -- f -> hcomp i (p @@ f) (u @@ f)
442+ -- (unionSystem (border v0 (invSystem f Zero))
443+ -- (unionSystem (border v1 (invSystem f One)) (mapSystem (@@ f) us)))
431444(Ter (PLam i u) rho) @@ phi = eval (sub (i,toFormula phi) rho) u
432445(VPLam i u) @@ phi = case toFormula phi of
433446 Dir d -> act True u (i,Dir d)
@@ -469,6 +482,8 @@ hfill i a u us = hcomp j a u (insertSystem (i ~> 0) u $ us `conj` (i,j))
469482hcomp :: Name -> Val -> Val -> System Val -> Val
470483hcomp i a u us | eps `member` us = (us ! eps) `face` (i ~> 1 )
471484hcomp i a u us = case a of
485+ -- For some reason it doesn't seem to work to treat hcomp in Path negatively. Why?
486+ -- VPathP{} -> VHComp i a u us
472487 VPathP p v0 v1 ->
473488 let j = fresh (Atom i,a,u,us)
474489 in VPLam j $ hcomp i (p @@@ j) (u @@@ j) (insertsSystem [(j ~> 0 ,v0),(j ~> 1 ,v1)]
@@ -477,7 +492,7 @@ hcomp i a u us = case a of
477492 VSigma a f
478493 | isNonDep f -> VPair (hcomp i a (fstVal u) (mapSystem fstVal us))
479494 (hcomp i (app f (VVar " impossible" VU )) (sndVal u) (mapSystem sndVal us))
480- | otherwise ->
495+ | otherwise ->
481496 let (us1, us2) = (mapSystem fstVal us, mapSystem sndVal us)
482497 (u1, u2) = (fstVal u, sndVal u)
483498 u1fill = hfill i a u1 us1
@@ -619,11 +634,12 @@ fillNeg i a u ts = (fill i (a `sym` i) u (ts `sym` i)) `sym` i
619634trans :: Val -> Formula -> Val -> Val
620635trans _ (Dir One ) u = u
621636trans (VPLam i a) phi u = case a of
622- VPathP p v0 v1 ->
623- let j = fresh (Atom i,a,phi,u)
624- uj = u @@@ j
625- in VPLam j $ comp i (p @@@ j) uj (insertsSystem [(j ~> 0 ,v0),(j ~> 1 ,v1)]
626- (border uj (invSystem phi One )))
637+ VPathP {} -> VTrans (VPLam i a) phi u
638+ -- VPathP p v0 v1 ->
639+ -- let j = fresh (Atom i,a,phi,u)
640+ -- uj = u @@@ j
641+ -- in VPLam j $ comp i (p @@@ j) uj (insertsSystem [(j ~> 0,v0),(j ~> 1,v1)]
642+ -- (border uj (invSystem phi One)))
627643 -- VId b v0 v1 -> undefined
628644 VSigma a f
629645 | isNonDep f -> VPair (trans (VPLam i a) phi (fstVal u))
@@ -1067,22 +1083,24 @@ instance Convertible Val where
10671083 (VOpaque x _, VOpaque x' _) -> x == x'
10681084 (VVar x _, VVar x' _) -> x == x'
10691085 (VPathP a b c,VPathP a' b' c') -> conv ns a a' && conv ns b b' && conv ns c c'
1070-
10711086 (Ter (PLam i a) e,Ter (PLam i' a') e') ->
10721087 conv ns (eval (sub (i,Atom j) e) a) (eval (sub (i',Atom j) e') a')
10731088 (Ter (PLam i a) e,a') -> conv ns (eval (sub (i,Atom j) e) a) (a' @@ j)
10741089 (a,Ter (PLam i' a') e) -> conv ns (a @@ j) (eval (sub (i',Atom j) e) a')
1075-
10761090 (VPLam i a,VPLam i' a') -> conv ns (a `swap` (i,j)) (a' `swap` (i',j))
10771091 (VPLam i a,p') -> conv ns (a `swap` (i,j)) (p' @@ j)
10781092 (p,VPLam i' a') -> conv ns (p @@ j) (a' `swap` (i',j))
10791093 (VAppFormula u x,VAppFormula u' x') -> conv ns (u,x) (u',x')
1094+
1095+ (VTrans (VPLam i (VPathP _ _ _)) _ _,_) -> conv ns (u @@ j) (v @@ j)
1096+ (_,VTrans (VPLam i (VPathP _ _ _)) _ _) -> conv ns (u @@ j) (v @@ j)
10801097 (VTrans a phi u,VTrans a' phi' u') ->
1081- -- TODO: Maybe identify via (- = 1)? Or change argument to a system..
10821098 conv ns (a,invSystem phi One ,u) (a',invSystem phi' One ,u')
1083- -- conv ns (a,phi,u) (a',phi',u')
1084- (VHComp j a u ts,VHComp j' a' u' ts') -> -- TODO
1099+ (VHComp _ (VPathP _ _ _) _ _,_) -> conv ns (u @@ j) (v @@ j)
1100+ (_,VHComp _ (VPathP _ _ _) _ _) -> conv ns (u @@ j) (v @@ j)
1101+ (VHComp j a u ts,VHComp j' a' u' ts') ->
10851102 conv ns (a,u,mapSystem (VPLam j) ts) (a',u',mapSystem (VPLam j') ts')
1103+
10861104 (VComp j a u ts,VComp j' a' u' ts') -> conv ns (VPLam j a,u,mapSystem (VPLam j) ts) (VPLam j' a',u',mapSystem (VPLam j') ts')
10871105 (VGlue v equivs,VGlue v' equivs') -> conv ns (v,equivs) (v',equivs')
10881106 (VGlueElem (VUnGlueElem b a equivs) ts,g) -> conv ns (border b equivs,b) (ts,g)
@@ -1157,8 +1175,16 @@ instance Normal Val where
11571175 VPCon n u us phis -> VPCon n (normal ns u) (normal ns us) phis
11581176 VPathP a u0 u1 -> VPathP (normal ns a) (normal ns u0) (normal ns u1)
11591177 VPLam i u -> VPLam i (normal ns u)
1178+
1179+ u@ (VTrans (VPLam _ (VPathP _ _ _)) _ _) ->
1180+ let j = fresh ()
1181+ in normal ns (VPLam j $ u @@ j)
11601182 VTrans a phi u -> VTrans (normal ns a) (normal ns phi) (normal ns u)
1161- VHComp j u v vs -> VHComp j (normal ns u) (normal ns v) (normal ns vs)
1183+ u@ (VHComp _ (VPathP _ _ _) _ _) ->
1184+ let j = fresh ()
1185+ in normal ns (VPLam j $ u @@ j)
1186+ VHComp j u v vs -> VHComp j (normal ns u) (normal ns v) (normal ns vs)
1187+
11621188 VComp j u v vs -> VComp j (normal ns u) (normal ns v) (normal ns vs)
11631189 VGlue u equivs -> VGlue (normal ns u) (normal ns equivs)
11641190 -- VGlueElem (VUnGlueElem b _ _) _ -> normal ns b
0 commit comments