Let. Exp ::= "let" "{" [Decl] "}" "in" Exp ;
Lam. Exp ::= "\\" [PTele] "->" Exp ;
-Path. Exp ::= "<" AIdent ">" Exp ;
+Path. Exp ::= "<" [AIdent] ">" Exp ;
Fun. Exp1 ::= Exp2 "->" Exp1 ;
Pi. Exp1 ::= [PTele] "->" Exp1 ;
Sigma. Exp1 ::= [PTele] "*" Exp1 ;
terminator nonempty PTele "" ;
position token AIdent ((letter|'_')(letter|digit|'\''|'_')*) ;
-terminator AIdent "" ;
\ No newline at end of file
+separator AIdent "" ;
\ No newline at end of file
lams :: [(Ident,Exp)] -> Resolver Ter -> Resolver Ter
lams = flip $ foldr lam
+path :: AIdent -> Resolver Ter -> Resolver Ter
+path i e = CTT.Path (C.Name (unAIdent i)) <$> local (insertName i) e
+
+paths :: [AIdent] -> Resolver Ter -> Resolver Ter
+paths [] _ = throwError "Empty path lambda"
+paths xs e = foldr path e xs
+
bind :: (Ter -> Ter) -> (Ident,Exp) -> Resolver Ter -> Resolver Ter
bind f (x,t) e = f <$> lam (x,t) e
U -> return CTT.U
Var x -> resolveVar x
App t s -> resolveApps x xs
- where (x,xs) = unApps t [s]
+ where (x,xs) = unApps t [s]
Sigma ptele b -> do
tele <- flattenPTele ptele
binds CTT.Sigma tele (resolveExp b)
Let decls e -> do
(rdecls,names) <- resolveDecls decls
CTT.mkWheres rdecls <$> local (insertIdents names) (resolveExp e)
- Path i e ->
- CTT.Path (C.Name (unAIdent i)) <$> local (insertName i) (resolveExp e)
+ Path is e -> paths is (resolveExp e)
AppFormula e phi -> CTT.AppFormula <$> resolveExp e <*> resolveFormula phi
resolveWhere :: ExpWhere -> Resolver Ter
= IdP (<i> (IdP (<j> A) (u @ i) (v @ i))) r0 r1
testSquare (A : U) (a : A) (p : Id A a a) : Square A a a p a a p p p =
- <i> <j> comp A a
+ <i j> comp A a
[(i = 0) -> <k> p @ (j \/ - k),
(i = 1) -> <k> p @ (j /\ k),
(j = 0) -> <k> p @ (i \/ - k),