in isNeutralSystem (Map.filterWithKey testFace ts)
isNeutralComp _ _ _ = False
--- TODO: Use the String!
-mkVar :: Int -> String -> Val -> Val
-mkVar k x = VVar ("X_" ++ show k)
+mkVar :: Int -> Val -> Val
+mkVar k = VVar ("X" ++ show k)
unCon :: Val -> [Val]
unCon (VCon _ vs) = vs
VLam x t e -> char '\\' <> parens (text x <+> colon <+> showVal t) <+>
text "->" <+> showVal e
VSplit u v -> showVal u <+> showVal1 v
- VVar x t | head x == '_' -> text x -- Special case, otherwise it is X_0
- | otherwise -> text x -- text (takeWhile (/= '_') x)
+ VVar x _ -> text x
VFst u -> showVal1 u <> text ".1"
VSnd u -> showVal1 u <> text ".2"
VIdP v0 v1 v2 -> text "IdP" <+> showVals [v0,v1,v2]
let j = fresh (u,v)
in case (simplify k j u, simplify k j v) of
(Ter (Lam x a u) e,Ter (Lam x' a' u') e') ->
- let v = mkVar k x (eval e a)
+ let v = mkVar k (eval e a)
in conv (k+1) (eval (Upd e (x,v)) u) (eval (Upd e' (x',v)) u')
(Ter (Lam x a u) e,u') ->
- let v = mkVar k x (eval e a)
+ let v = mkVar k (eval e a)
in conv (k+1) (eval (Upd e (x,v)) u) (app u' v)
(u',Ter (Lam x a u) e) ->
- let v = mkVar k x (eval e a)
+ let v = mkVar k (eval e a)
in conv (k+1) (app u' v) (eval (Upd e (x,v)) u)
(Ter (Split _ p _ _) e,Ter (Split _ p' _ _) e') -> (p == p') && conv k e e'
(Ter (Sum p _ _) e,Ter (Sum p' _ _) e') -> (p == p') && conv k e e'
(Ter Hole{} e,_) -> True
(_,Ter Hole{} e') -> True
(VPi u v,VPi u' v') ->
- let w = mkVar k "X" u -- TODO: What string to put here?
+ let w = mkVar k u
in conv k u u' && conv (k+1) (app v w) (app v' w)
(VSigma u v,VSigma u' v') ->
- let w = mkVar k "X" u -- TODO: What string to put here?
+ let w = mkVar k u
in conv k u u' && conv (k+1) (app v w) (app v' w)
(VCon c us,VCon c' us') -> (c == c') && conv k us us'
(VPair u v,VPair u' v') -> conv k u u' && conv k v v'
normal _ VU = VU
normal k (Ter (Lam x t u) e) = VLam name w $ normal (k+1) (eval (Upd e (x,v)) u)
where w = eval e t
- v@(VVar name _) = mkVar k x w
+ v@(VVar name _) = mkVar k w
normal k (VPi u v) = VPi (normal k u) (normal k v)
normal k (VSigma u v) = VSigma (normal k u) (normal k v)
normal k (VPair u v) = VPair (normal k u) (normal k v)
\r
addTypeVal :: (Ident,Val) -> TEnv -> TEnv\r
addTypeVal (x,a) (TEnv k ind rho v) =\r
- TEnv (k+1) ind (Upd rho (x,mkVar k (show a) a)) v\r
+ TEnv (k+1) ind (Upd rho (x,mkVar k a)) v\r
\r
addSub :: (Name,Formula) -> TEnv -> TEnv\r
addSub iphi (TEnv k ind rho v) = TEnv k ind (Sub rho iphi) v\r
mkVars :: Int -> Tele -> Env -> [(Ident,Val)]\r
mkVars k [] _ = []\r
mkVars k ((x,a):xas) nu =\r
- let w = mkVar k (show a) (eval nu a)\r
+ let w = mkVar k (eval nu a)\r
in (x,w) : mkVars (k+1) xas (Upd nu (x,w))\r
\r
-- Construct a fuction "(_ : va) -> vb"\r
rho <- asks env\r
unlessM (a === eval rho a') $\r
throwError "check: lam types don't match"\r
- let var = mkVar k (show a) a\r
+ let var = mkVar k a\r
local (addTypeVal (x,a)) $ check (app f var) t\r
(VSigma a f, Pair t1 t2) -> do\r
check a t1\r