module Math.FiniteCategories.ConeCategory.Example
(
main
)
where
import Math.Category
import Math.Categories.FinGrph
import Math.FiniteCategories.ConeCategory
import Math.FiniteCategories.FunctorCategory
import Math.FiniteCategories.V
import Math.FiniteCategories.Hat
import Math.FiniteCategories.SafeCompositionGraph
import Math.IO.PrettyPrint
import Math.FiniteCategory
import Data.WeakSet (Set)
import qualified Data.WeakSet as Set
import Data.WeakSet.Safe
import Data.WeakMap (Map)
import qualified Data.WeakMap as Map
import Data.WeakMap.Safe
main :: IO ()
main :: IO ()
main = do
String -> IO ()
putStrLn String
"Start of Math.FiniteCategories.ConeCategory.Example"
let Right SafeCompositionGraph Char Char
scg = Graph Char Char
-> CompositionLaw Char Char
-> Int
-> Either
(FiniteCategoryError (SCGMorphism Char Char) Char)
(SafeCompositionGraph Char Char)
forall a b.
(Eq a, Eq b) =>
Graph a b
-> CompositionLaw a b
-> Int
-> Either
(FiniteCategoryError (SCGMorphism a b) a)
(SafeCompositionGraph a b)
safeCompositionGraph (Set Char -> Set (Arrow Char Char) -> Graph Char Char
forall n e. Set n -> Set (Arrow n e) -> Graph n e
unsafeGraph (String -> Set Char
forall a. [a] -> Set a
set String
"ABCD") ([Arrow Char Char] -> Set (Arrow Char Char)
forall a. [a] -> Set a
set [Arrow{sourceArrow :: Char
sourceArrow = Char
'A', targetArrow :: Char
targetArrow = Char
'B', labelArrow :: Char
labelArrow=Char
'f'}, Arrow{sourceArrow :: Char
sourceArrow = Char
'A', targetArrow :: Char
targetArrow = Char
'C', labelArrow :: Char
labelArrow=Char
'g'}, Arrow{sourceArrow :: Char
sourceArrow = Char
'B', targetArrow :: Char
targetArrow = Char
'D', labelArrow :: Char
labelArrow=Char
'h'}, Arrow{sourceArrow :: Char
sourceArrow = Char
'C', targetArrow :: Char
targetArrow = Char
'D', labelArrow :: Char
labelArrow=Char
'I'}])) (AssociationList [Arrow Char Char] [Arrow Char Char]
-> CompositionLaw Char Char
forall k v. AssociationList k v -> Map k v
weakMap [([Arrow{sourceArrow :: Char
sourceArrow = Char
'C', targetArrow :: Char
targetArrow = Char
'D', labelArrow :: Char
labelArrow=Char
'I'}, Arrow{sourceArrow :: Char
sourceArrow = Char
'A', targetArrow :: Char
targetArrow = Char
'C', labelArrow :: Char
labelArrow=Char
'g'}],[Arrow{sourceArrow :: Char
sourceArrow = Char
'B', targetArrow :: Char
targetArrow = Char
'D', labelArrow :: Char
labelArrow=Char
'h'}, Arrow{sourceArrow :: Char
sourceArrow = Char
'A', targetArrow :: Char
targetArrow = Char
'B', labelArrow :: Char
labelArrow=Char
'f'}])]) Int
3
let diag :: Diagram
V
VAr
VOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
diag = Diagram
V
VAr
VOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
-> Diagram
V
VAr
VOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
forall c1 m1 o1 c2 m2 o2.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq m1, Eq o1,
Category c2 m2 o2, Morphism m2 o2) =>
Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2
completeDiagram Diagram{src :: V
src=V
V,tgt :: SafeCompositionGraph Char Char
tgt=SafeCompositionGraph Char Char
scg,omap :: Map VOb Char
omap=AssociationList VOb Char -> Map VOb Char
forall k v. AssociationList k v -> Map k v
weakMap [(VOb
VA,Char
'D'),(VOb
VB,Char
'B'),(VOb
VC,Char
'C')], mmap :: Map VAr (SCGMorphism Char Char)
mmap=AssociationList VAr (SCGMorphism Char Char)
-> Map VAr (SCGMorphism Char Char)
forall k v. AssociationList k v -> Map k v
weakMap [(VAr
VF,Set (SCGMorphism Char Char) -> SCGMorphism Char Char
forall a. Set a -> a
anElement (SafeCompositionGraph Char Char
-> Char -> Char -> Set (SCGMorphism Char Char)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
genAr SafeCompositionGraph Char Char
scg Char
'B' Char
'D')),(VAr
VG,Set (SCGMorphism Char Char) -> SCGMorphism Char Char
forall a. Set a -> a
anElement (SafeCompositionGraph Char Char
-> Char -> Char -> Set (SCGMorphism Char Char)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
genAr SafeCompositionGraph Char Char
scg Char
'C' Char
'D'))]}
String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ Diagram
V
VAr
VOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
-> String
forall a. PrettyPrint a => a -> String
pprint Diagram
V
VAr
VOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
diag
String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ ConeCategory
V
VAr
VOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
-> String
forall c m o.
(FiniteCategory c m o, Morphism m o, PrettyPrint c, PrettyPrint m,
PrettyPrint o, Eq m, Eq o) =>
c -> String
pprintFiniteCategory (Diagram
V
VAr
VOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
-> ConeCategory
V
VAr
VOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
forall c1 m1 o1 c2 m2 o2.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1,
FiniteCategory c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2) =>
Diagram c1 m1 o1 c2 m2 o2 -> ConeCategory c1 m1 o1 c2 m2 o2
coneCategory Diagram
V
VAr
VOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
diag)
let diag2 :: Diagram
Hat
HatAr
HatOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
diag2 = Diagram
Hat
HatAr
HatOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
-> Diagram
Hat
HatAr
HatOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
forall c1 m1 o1 c2 m2 o2.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq m1, Eq o1,
Category c2 m2 o2, Morphism m2 o2) =>
Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2
completeDiagram Diagram{src :: Hat
src=Hat
Hat,tgt :: SafeCompositionGraph Char Char
tgt=SafeCompositionGraph Char Char
scg,omap :: Map HatOb Char
omap=AssociationList HatOb Char -> Map HatOb Char
forall k v. AssociationList k v -> Map k v
weakMap [(HatOb
HatA,Char
'A'),(HatOb
HatB,Char
'B'),(HatOb
HatC,Char
'C')], mmap :: Map HatAr (SCGMorphism Char Char)
mmap=AssociationList HatAr (SCGMorphism Char Char)
-> Map HatAr (SCGMorphism Char Char)
forall k v. AssociationList k v -> Map k v
weakMap [(HatAr
HatF,Set (SCGMorphism Char Char) -> SCGMorphism Char Char
forall a. Set a -> a
anElement (SafeCompositionGraph Char Char
-> Char -> Char -> Set (SCGMorphism Char Char)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
genAr SafeCompositionGraph Char Char
scg Char
'A' Char
'B')),(HatAr
HatG,Set (SCGMorphism Char Char) -> SCGMorphism Char Char
forall a. Set a -> a
anElement (SafeCompositionGraph Char Char
-> Char -> Char -> Set (SCGMorphism Char Char)
forall c m o.
(Category c m o, Morphism m o) =>
c -> o -> o -> Set m
genAr SafeCompositionGraph Char Char
scg Char
'A' Char
'C'))]}
String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ Diagram
Hat
HatAr
HatOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
-> String
forall a. PrettyPrint a => a -> String
pprint Diagram
Hat
HatAr
HatOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
diag2
String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ CoconeCategory
Hat
HatAr
HatOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
-> String
forall c m o.
(FiniteCategory c m o, Morphism m o, PrettyPrint c, PrettyPrint m,
PrettyPrint o, Eq m, Eq o) =>
c -> String
pprintFiniteCategory (Diagram
Hat
HatAr
HatOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
-> CoconeCategory
Hat
HatAr
HatOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
forall c1 m1 o1 c2 m2 o2.
(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1,
FiniteCategory c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2) =>
Diagram c1 m1 o1 c2 m2 o2 -> CoconeCategory c1 m1 o1 c2 m2 o2
coconeCategory Diagram
Hat
HatAr
HatOb
(SafeCompositionGraph Char Char)
(SCGMorphism Char Char)
Char
diag2)
String -> IO ()
putStrLn String
"End of Math.FiniteCategories.ConeCategory.Example"