-- the faces should be incomparable
type System a = Map Face a
-showSystem :: Show a => System a -> String
-showSystem ts =
+showListSystem :: Show a => [(Face,a)] -> String
+showListSystem ts =
"[ " ++ intercalate ", " [ showFace alpha ++ " -> " ++ show u
- | (alpha,u) <- Map.toList ts ] ++ " ]"
+ | (alpha,u) <- ts ] ++ " ]"
+
+showSystem :: Show a => System a -> String
+showSystem = showListSystem . Map.toList
insertSystem :: Face -> a -> System a -> System a
insertSystem alpha v ts = case find (comparable alpha) (Map.keys ts) of
resolveWhere = resolveExp . unWhere
resolveSystem :: System -> Resolver (C.System Ter)
-resolveSystem (System ts) =
+resolveSystem (System ts) = do
+ ts' <- sequence [ (,) <$> resolveFace alpha <*> resolveExp u
+ | Side alpha u <- ts ]
+ let alphas = map fst ts'
+ unless (nub alphas == alphas) $
+ throwError $ "system contains same face multiple times: " ++ C.showListSystem ts'
-- Note: the symbols in alpha are in scope in u, but they mean 0 or 1
- Map.fromList <$> sequence [ (,) <$> resolveFace alpha <*> resolveExp u
- | Side alpha u <- ts ]
+ return $ Map.fromList ts'
resolveFace :: [Face] -> Resolver C.Face
resolveFace alpha =
refl (A : U) (a : A) : Id A a a = <i> a
+testEta (A : U) (a b : A) (p : Id A a b) : Id (Id A a b) p p = refl (Id A a b) (<i> p @ i)
+
mapOnPath (A B : U) (f : A -> B) (a b : A)
(p : Id A a b) : Id B (f a) (f b) = <i> f (p @ i)