gensym xs = head (ys \\ xs)
where ys = map Name $ ["i","j","k","l"] ++ map (('i':) . show) [0..]
+gensymNice :: Name -> [Name] -> Name
+gensymNice i@(Name s) xs = head (ys \\ xs)
+ where ys = i:map (\n -> Name (s ++ show n)) [0..]
+
-- gensym :: [Name] -> Name
-- gensym xs = Name ('?' : show max)
-- where max = maximum' [ read x | Name ('?':x) <- xs ]
fresh :: Nominal a => a -> Name
fresh = gensym . support
+freshNice :: Nominal a => Name -> a -> Name
+freshNice i = gensymNice i . support
+
freshs :: Nominal a => a -> [Name]
freshs = gensyms . support
Hole{} -> Ter v rho
IdP a e0 e1 -> VIdP (eval rho a) (eval rho e0) (eval rho e1)
Path i t ->
- let j = fresh rho
+ let j = freshNice i rho
in VPath j (eval (Sub rho (i,Atom j)) t)
Trans u v -> transLine (eval rho u) (eval rho v)
AppFormula e phi -> (eval rho e) @@ (evalFormula rho phi)