From: Simon Huber Date: Thu, 16 Apr 2015 12:32:17 +0000 (+0200) Subject: change mkVar back to how it was X-Git-Url: https://git.ak3n.com/?a=commitdiff_plain;h=3a80f8c7f9f33059c1b686c4295398dabf1f814e;p=cubicaltt.git change mkVar back to how it was --- diff --git a/CTT.hs b/CTT.hs index 7cf14d9..998cd96 100644 --- a/CTT.hs +++ b/CTT.hs @@ -211,9 +211,8 @@ isNeutralComp (VGlue _ as) u ts | isNeutral u = True 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 @@ -373,8 +372,7 @@ showVal v = case v of 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] diff --git a/Eval.hs b/Eval.hs index 5cd0131..9c8fcfd 100644 --- a/Eval.hs +++ b/Eval.hs @@ -690,13 +690,13 @@ instance Convertible Val where 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' @@ -705,10 +705,10 @@ instance Convertible Val where (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' @@ -789,7 +789,7 @@ instance Normal Val where 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) diff --git a/TypeChecker.hs b/TypeChecker.hs index 412aad7..456da62 100644 --- a/TypeChecker.hs +++ b/TypeChecker.hs @@ -65,7 +65,7 @@ runInfer lenv e = runTyping lenv (infer e) addTypeVal :: (Ident,Val) -> TEnv -> TEnv addTypeVal (x,a) (TEnv k ind rho v) = - TEnv (k+1) ind (Upd rho (x,mkVar k (show a) a)) v + TEnv (k+1) ind (Upd rho (x,mkVar k a)) v addSub :: (Name,Formula) -> TEnv -> TEnv addSub iphi (TEnv k ind rho v) = TEnv k ind (Sub rho iphi) v @@ -115,7 +115,7 @@ constPath = VPath (Name "_") mkVars :: Int -> Tele -> Env -> [(Ident,Val)] mkVars k [] _ = [] mkVars k ((x,a):xas) nu = - let w = mkVar k (show a) (eval nu a) + let w = mkVar k (eval nu a) in (x,w) : mkVars (k+1) xas (Upd nu (x,w)) -- Construct a fuction "(_ : va) -> vb" @@ -177,7 +177,7 @@ check a t = case (a,t) of rho <- asks env unlessM (a === eval rho a') $ throwError "check: lam types don't match" - let var = mkVar k (show a) a + let var = mkVar k a local (addTypeVal (x,a)) $ check (app f var) t (VSigma a f, Pair t1 t2) -> do check a t1