FiniteCategories-0.5.0.0: Finite categories and usual categorical constructions on them.
CopyrightGuillaume Sabbagh 2022
LicenseGPL-3
Maintainerguillaumesabbagh@protonmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Math.Categories.FunctorCategory

Description

A FunctorCategory D^C (also written [C,D]) where C is a FiniteCategory and D is a Category has Diagrams F : C -> D as objects and NaturalTransformations between them as morphisms. NaturalTransformations compose vertically in this category. See the operator (<=@<=) for horizontal composition.

A Diagram is a heterogeneous functor, meaning that the source category might be different from the target category. We don't see a diagram as a morphism of categories but as a selection in the target category. See FinCat for a context where Diagrams are seen as morphisms of categories.

Diagrams are objects in a FunctorCategory, they therefore can not be composed with the usual operator (@). See (<-@<-) for composing Diagrams.

Beware that source and target are not defined on Diagram because it is not a Morphism, use src and tgt instead.

You can also do left and right whiskering with the operators (<=@<-) and (<-@<=).

A FunctorCategory is a FiniteCategory if the source and target category are finite, but it is only a Category if the target category is not finite.

All operators defined in this module respect the following convention: a "->" arrow represent a functor and a "=>" represent a natural transformation. For example (<-@<=) allows to compose a natural transformation (the "<=" arrow) with a functor (the "<-" arrow), note that composition is always read from right to left.

Synopsis

Diagram

data Diagram c1 m1 o1 c2 m2 o2 Source #

A Diagram is a functor from a FiniteCategory to a Category.

A Diagram can have a source category and a target category with different types. It must obey the following rules :

funct ->$ (source f) == source (funct ->£ f)
funct ->$ (target f) == target (funct ->£ f)
funct ->£ (f @ g) = (funct ->£ f) @ (funct ->£ g)
funct ->£ (identity a) = identity (funct ->$ a)

Diagram is not private because we can't always check functoriality if the target category is infinite. However it is recommanded to use the smart constructor diagram which checks the structure of the Diagram at construction.

Constructors

Diagram 

Fields

  • src :: c1

    The source category

  • tgt :: c2

    The target category

  • omap :: Map o1 o2

    The object map

  • mmap :: Map m1 m2

    The morphism map

Instances

Instances details
(FiniteCategory c m o, Morphism m o, Eq c, Eq m, Eq o) => Category (FinCat c m o) (Diagram c m o c m o) c Source # 
Instance details

Defined in Math.Categories.FinCat

Methods

identity :: FinCat c m o -> c -> Diagram c m o c m o Source #

ar :: FinCat c m o -> c -> c -> Set (Diagram c m o c m o) Source #

genAr :: FinCat c m o -> c -> c -> Set (Diagram c m o c m o) Source #

decompose :: FinCat c m o -> Diagram c m o c m o -> [Diagram c m o c m o] Source #

(PrettyPrint c1, PrettyPrint m1, PrettyPrint o1, Eq m1, Eq o1, PrettyPrint c2, PrettyPrint m2, PrettyPrint o2, Eq m2, Eq o2) => PrettyPrint (Diagram c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

pprint :: Diagram c1 m1 o1 c2 m2 o2 -> String Source #

(Show c1, Show c2, Show o1, Show o2, Show m1, Show m2) => Show (Diagram c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

showsPrec :: Int -> Diagram c1 m1 o1 c2 m2 o2 -> ShowS

show :: Diagram c1 m1 o1 c2 m2 o2 -> String

showList :: [Diagram c1 m1 o1 c2 m2 o2] -> ShowS

(Eq c1, Eq c2, Eq o1, Eq o2, Eq m1, Eq m2) => Eq (Diagram c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

(==) :: Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Bool

(/=) :: Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Bool

(Eq c, Eq m, Eq o) => Morphism (Diagram c m o c m o) c Source # 
Instance details

Defined in Math.Categories.FinCat

Methods

(@?) :: Diagram c m o c m o -> Diagram c m o c m o -> Maybe (Diagram c m o c m o) Source #

source :: Diagram c m o c m o -> c Source #

target :: Diagram c m o c m o -> c Source #

(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Morphism m2 o2, Eq c2, Eq m2, Eq o2) => Morphism (NaturalTransformation c1 m1 o1 c2 m2 o2) (Diagram c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

(@?) :: NaturalTransformation c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> Maybe (NaturalTransformation c1 m1 o1 c2 m2 o2) Source #

source :: NaturalTransformation c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 Source #

target :: NaturalTransformation c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 Source #

(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Category c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2) => Category (FunctorCategory c1 m1 o1 c2 m2 o2) (NaturalTransformation c1 m1 o1 c2 m2 o2) (Diagram c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

identity :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2 Source #

ar :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Set (NaturalTransformation c1 m1 o1 c2 m2 o2) Source #

genAr :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Set (NaturalTransformation c1 m1 o1 c2 m2 o2) Source #

decompose :: FunctorCategory c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> [NaturalTransformation c1 m1 o1 c2 m2 o2] Source #

(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) => FiniteCategory (FunctorCategory c1 m1 o1 c2 m2 o2) (NaturalTransformation c1 m1 o1 c2 m2 o2) (Diagram c1 m1 o1 c2 m2 o2) Source #

A FunctorCategory where the target category is finite allows to enumerate all Diagrams thus making it a FiniteCategory.

Instance details

Defined in Math.Categories.FunctorCategory

Methods

ob :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Set (Diagram c1 m1 o1 c2 m2 o2) Source #

(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Category c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2, Category c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => Category (PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

identity :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

ar :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

genAr :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

decompose :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 -> [NaturalTransformation c1 m1 o1 c3 m3 o3] Source #

(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, Category c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => Category (PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

identity :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

ar :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

genAr :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

decompose :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 -> [NaturalTransformation c1 m1 o1 c3 m3 o3] Source #

(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, FiniteCategory c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => FiniteCategory (PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source #

A PostcomposedFunctorCategory where the target category is finite allows to enumerate all Diagrams thus making it a FiniteCategory.

Instance details

Defined in Math.Categories.FunctorCategory

Methods

ob :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Set (Diagram c1 m1 o1 c3 m3 o3) Source #

(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, FiniteCategory c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => FiniteCategory (PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source #

A PrecomposedFunctorCategory where the target category is finite allows to enumerate all Diagrams thus making it a FiniteCategory.

Instance details

Defined in Math.Categories.FunctorCategory

Methods

ob :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Set (Diagram c1 m1 o1 c3 m3 o3) Source #

Check diagram structure

data DiagramError c1 m1 o1 c2 m2 o2 Source #

A datatype to represent a malformation of a Diagram.

Instances

Instances details
(Show o1, Show o2, Show m1, Show m2) => Show (DiagramError c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

showsPrec :: Int -> DiagramError c1 m1 o1 c2 m2 o2 -> ShowS

show :: DiagramError c1 m1 o1 c2 m2 o2 -> String

showList :: [DiagramError c1 m1 o1 c2 m2 o2] -> ShowS

(Eq o1, Eq o2, Eq m1, Eq m2) => Eq (DiagramError c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

(==) :: DiagramError c1 m1 o1 c2 m2 o2 -> DiagramError c1 m1 o1 c2 m2 o2 -> Bool

(/=) :: DiagramError c1 m1 o1 c2 m2 o2 -> DiagramError c1 m1 o1 c2 m2 o2 -> Bool

checkFiniteDiagram :: (FiniteCategory c1 m1 o1, Morphism m1 o1, Eq m1, Eq o1, FiniteCategory c2 m2 o2, Morphism m2 o2, Eq m2, Eq o2) => Diagram c1 m1 o1 c2 m2 o2 -> Maybe (DiagramError c1 m1 o1 c2 m2 o2) Source #

Check wether the properties of a Diagram are respected where the target category is finite.

checkDiagram :: (FiniteCategory c1 m1 o1, Morphism m1 o1, Eq m1, Eq o1, Category c2 m2 o2, Morphism m2 o2, Eq m2, Eq o2) => Diagram c1 m1 o1 c2 m2 o2 -> Maybe (DiagramError c1 m1 o1 c2 m2 o2) Source #

Check wether the properties of a Diagram are respected where the target category is infinite.

diagram :: (FiniteCategory c1 m1 o1, Morphism m1 o1, Eq m1, Eq o1, FiniteCategory c2 m2 o2, Morphism m2 o2, Eq m2, Eq o2) => c1 -> c2 -> Map o1 o2 -> Map m1 m2 -> Either (DiagramError c1 m1 o1 c2 m2 o2) (Diagram c1 m1 o1 c2 m2 o2) Source #

Smart constructor of Diagram.

Operators

(->$) :: Eq o1 => Diagram c1 m1 o1 c2 m2 o2 -> o1 -> o2 Source #

Apply a Diagram on an object of the source category.

(->£) :: Eq m1 => Diagram c1 m1 o1 c2 m2 o2 -> m1 -> m2 Source #

Apply a Diagram on a morphism of the source category.

(<-@<-) :: (Eq o2, Eq m2) => Diagram c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c3 m3 o3 Source #

Compose two Diagrams.

Usual diagrams

selectObject :: (Category c m o, Morphism m o, Eq o) => c -> o -> Diagram One One One c m o Source #

Construct a Diagram selecting an object in a category.

There is no check that the object belongs in the category.

constantDiagram :: (FiniteCategory c1 m1 o1, Morphism m1 o1, Category c2 m2 o2, Morphism m2 o2) => c1 -> c2 -> o2 -> Diagram c1 m1 o1 c2 m2 o2 Source #

Construct a constant Diagram on an object of the target Category given an indexing FiniteCategory.

There is no check that the object belongs in the category.

discreteDiagram :: (Category c m o, Morphism m o, Eq o) => c -> [o] -> Diagram (DiscreteCategory Int) (DiscreteMorphism Int) Int c m o Source #

Construct a discrete Diagram on a list of objects of the target Category.

We consider list of objects because a single object can be selected several times.

There is no check that the objects belongs in the category.

parallelDiagram :: (Category c m o, Morphism m o, Eq o) => c -> m -> m -> Diagram Parallel ParallelAr ParallelOb c m o Source #

Construct a parallel Diagram on two parallel morphisms of the target Category.

There is no check that the morphisms belongs in the category and no check that the two morphisms are parallel.

Insertion diagrams for subcategories

insertionFunctor1 :: (Category c m o, Morphism m o, Eq o) => FullSubcategory c m o -> Diagram (FullSubcategory c m o) m o c m o Source #

The insertion functor from the FullSubcategory to the original category.

insertionFunctor2 :: (Category c m o, Morphism m o, Eq o) => InheritedFullSubcategory c m o -> Diagram (InheritedFullSubcategory c m o) m o c m o Source #

The insertion functor from the InheritedFullSubcategory to the original category.

Diagram construction helper

completeDiagram :: (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 Source #

Complete a partial Diagram by adding the mapping between identities and the mapping between composite morphisms using the decomposition of the indexing category.

Does not check the structure of the resulting Diagram, you can use checkFiniteDiagram to check afterwards.

pickRandomDiagram :: (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, RandomGen g) => c1 -> c2 -> g -> (Diagram c1 m1 o1 c2 m2 o2, g) Source #

Choose a random diagram in the functor category of an index category and an image category.

Natural transformation

data NaturalTransformation c1 m1 o1 c2 m2 o2 Source #

A NaturalTransformation between two Diagrams from C to D is a mapping from objects of C to morphisms of D such that naturality is respected. C must be a FiniteCategory because we need its objects in the mapping of a NaturalTransformation.

Formally, let F and G be functors, and eta : Ob(C) -> Ar(D). The following properties should be respected :

source F = source G
target F = target G
(eta =>$ target f) @ (F ->£ f) = (G ->£ f) @ (eta =>$ source f)

NaturalTransformation is private, use the smart constructor naturalTransformation to instantiate it.

Instances

Instances details
(PrettyPrint c1, PrettyPrint m1, PrettyPrint o1, Eq m1, Eq o1, PrettyPrint c2, PrettyPrint m2, PrettyPrint o2, Eq m2, Eq o2) => PrettyPrint (NaturalTransformation c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

pprint :: NaturalTransformation c1 m1 o1 c2 m2 o2 -> String Source #

(Show c1, Show m1, Show o1, Show c2, Show m2, Show o2) => Show (NaturalTransformation c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

showsPrec :: Int -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> ShowS

show :: NaturalTransformation c1 m1 o1 c2 m2 o2 -> String

showList :: [NaturalTransformation c1 m1 o1 c2 m2 o2] -> ShowS

(Eq c1, Eq c2, Eq o1, Eq o2, Eq m1, Eq m2) => Eq (NaturalTransformation c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

(==) :: NaturalTransformation c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> Bool

(/=) :: NaturalTransformation c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> Bool

(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Morphism m2 o2, Eq c2, Eq m2, Eq o2) => Morphism (NaturalTransformation c1 m1 o1 c2 m2 o2) (Diagram c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

(@?) :: NaturalTransformation c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> Maybe (NaturalTransformation c1 m1 o1 c2 m2 o2) Source #

source :: NaturalTransformation c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 Source #

target :: NaturalTransformation c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 Source #

(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Category c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2) => Category (FunctorCategory c1 m1 o1 c2 m2 o2) (NaturalTransformation c1 m1 o1 c2 m2 o2) (Diagram c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

identity :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2 Source #

ar :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Set (NaturalTransformation c1 m1 o1 c2 m2 o2) Source #

genAr :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Set (NaturalTransformation c1 m1 o1 c2 m2 o2) Source #

decompose :: FunctorCategory c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> [NaturalTransformation c1 m1 o1 c2 m2 o2] Source #

(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) => FiniteCategory (FunctorCategory c1 m1 o1 c2 m2 o2) (NaturalTransformation c1 m1 o1 c2 m2 o2) (Diagram c1 m1 o1 c2 m2 o2) Source #

A FunctorCategory where the target category is finite allows to enumerate all Diagrams thus making it a FiniteCategory.

Instance details

Defined in Math.Categories.FunctorCategory

Methods

ob :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Set (Diagram c1 m1 o1 c2 m2 o2) Source #

(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Category c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2, Category c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => Category (PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

identity :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

ar :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

genAr :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

decompose :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 -> [NaturalTransformation c1 m1 o1 c3 m3 o3] Source #

(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, Category c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => Category (PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

identity :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

ar :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

genAr :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

decompose :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 -> [NaturalTransformation c1 m1 o1 c3 m3 o3] Source #

(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, FiniteCategory c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => FiniteCategory (PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source #

A PostcomposedFunctorCategory where the target category is finite allows to enumerate all Diagrams thus making it a FiniteCategory.

Instance details

Defined in Math.Categories.FunctorCategory

Methods

ob :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Set (Diagram c1 m1 o1 c3 m3 o3) Source #

(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, FiniteCategory c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => FiniteCategory (PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source #

A PrecomposedFunctorCategory where the target category is finite allows to enumerate all Diagrams thus making it a FiniteCategory.

Instance details

Defined in Math.Categories.FunctorCategory

Methods

ob :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Set (Diagram c1 m1 o1 c3 m3 o3) Source #

Getter

components :: NaturalTransformation c1 m1 o1 c2 m2 o2 -> Map o1 m2 Source #

The components

Check structure

data NaturalTransformationError c1 m1 o1 c2 m2 o2 Source #

A datatype to represent a malformation of a NaturalTransformation.

Instances

Instances details
(Show c1, Show c2, Show o1, Show m1) => Show (NaturalTransformationError c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

showsPrec :: Int -> NaturalTransformationError c1 m1 o1 c2 m2 o2 -> ShowS

show :: NaturalTransformationError c1 m1 o1 c2 m2 o2 -> String

showList :: [NaturalTransformationError c1 m1 o1 c2 m2 o2] -> ShowS

(Eq c1, Eq c2, Eq o1, Eq m1) => Eq (NaturalTransformationError c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

(==) :: NaturalTransformationError c1 m1 o1 c2 m2 o2 -> NaturalTransformationError c1 m1 o1 c2 m2 o2 -> Bool

(/=) :: NaturalTransformationError c1 m1 o1 c2 m2 o2 -> NaturalTransformationError c1 m1 o1 c2 m2 o2 -> Bool

checkNaturalTransformation :: (FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Morphism m2 o2, Eq c2, Eq m2, Eq o2) => NaturalTransformation c1 m1 o1 c2 m2 o2 -> Maybe (NaturalTransformationError c1 m1 o1 c2 m2 o2) Source #

Check wether the structure of a NaturalTransformation is respected.

naturalTransformation :: (FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Morphism m2 o2, Eq c2, Eq m2, Eq o2) => Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Map o1 m2 -> Either (NaturalTransformationError c1 m1 o1 c2 m2 o2) (NaturalTransformation c1 m1 o1 c2 m2 o2) Source #

The smart constructor of NaturalTransformation. Checks wether the structure is correct.

unsafeNaturalTransformation :: Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Map o1 m2 -> NaturalTransformation c1 m1 o1 c2 m2 o2 Source #

Unsafe constructor of NaturalTransformation for performance purposes. It does not check the structure of the NaturalTransformation.

Use this constructor only if the NaturalTransformation is necessarily well formed.

Operators

(=>$) :: Eq o1 => NaturalTransformation c1 m1 o1 c2 m2 o2 -> o1 -> m2 Source #

Apply a NaturalTransformation on an object of the source Diagram.

(<=@<=) :: (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, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => NaturalTransformation c2 m2 o2 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

Compose horizontally NaturalTransformations.

horizontalComposition :: (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, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => NaturalTransformation c2 m2 o2 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

Alias of (<=@<=).

(<=@<-) :: (Morphism m1 o1, FiniteCategory c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => NaturalTransformation c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

Left whiskering allows to compose a Diagram with a NaturalTransformation.

leftWhiskering :: (Morphism m1 o1, FiniteCategory c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => NaturalTransformation c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

Alias of (<=@<-).

(<-@<=) :: (FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Morphism m2 o2, Eq c2, Eq m2, Eq o2) => Diagram c2 m2 o2 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

Right whiskering allows to compose a NaturalTransformation with a Diagram.

rightWhiskering :: (FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Morphism m2 o2, Eq c2, Eq m2, Eq o2) => Diagram c2 m2 o2 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

Alias of (<-@<=).

Functor categories

data FunctorCategory c1 m1 o1 c2 m2 o2 Source #

A FunctorCategory D^C where C is a FiniteCategory and D is a Category has Diagrams F : C -> D as objects and NaturalTransformations between them as morphisms. NaturalTransformations compose vertically in this category.

Constructors

FunctorCategory c1 c2 

Instances

Instances details
(PrettyPrint c1, PrettyPrint c2) => PrettyPrint (FunctorCategory c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

pprint :: FunctorCategory c1 m1 o1 c2 m2 o2 -> String Source #

(Show c1, Show c2) => Show (FunctorCategory c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

showsPrec :: Int -> FunctorCategory c1 m1 o1 c2 m2 o2 -> ShowS

show :: FunctorCategory c1 m1 o1 c2 m2 o2 -> String

showList :: [FunctorCategory c1 m1 o1 c2 m2 o2] -> ShowS

(Eq c1, Eq c2) => Eq (FunctorCategory c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

(==) :: FunctorCategory c1 m1 o1 c2 m2 o2 -> FunctorCategory c1 m1 o1 c2 m2 o2 -> Bool

(/=) :: FunctorCategory c1 m1 o1 c2 m2 o2 -> FunctorCategory c1 m1 o1 c2 m2 o2 -> Bool

(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Category c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2) => Category (FunctorCategory c1 m1 o1 c2 m2 o2) (NaturalTransformation c1 m1 o1 c2 m2 o2) (Diagram c1 m1 o1 c2 m2 o2) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

identity :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2 Source #

ar :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Set (NaturalTransformation c1 m1 o1 c2 m2 o2) Source #

genAr :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Diagram c1 m1 o1 c2 m2 o2 -> Set (NaturalTransformation c1 m1 o1 c2 m2 o2) Source #

decompose :: FunctorCategory c1 m1 o1 c2 m2 o2 -> NaturalTransformation c1 m1 o1 c2 m2 o2 -> [NaturalTransformation c1 m1 o1 c2 m2 o2] Source #

(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) => FiniteCategory (FunctorCategory c1 m1 o1 c2 m2 o2) (NaturalTransformation c1 m1 o1 c2 m2 o2) (Diagram c1 m1 o1 c2 m2 o2) Source #

A FunctorCategory where the target category is finite allows to enumerate all Diagrams thus making it a FiniteCategory.

Instance details

Defined in Math.Categories.FunctorCategory

Methods

ob :: FunctorCategory c1 m1 o1 c2 m2 o2 -> Set (Diagram c1 m1 o1 c2 m2 o2) Source #

data PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 Source #

A FunctorCategory D^C precomposed by a functor F : B -> C where B and C are FiniteCategory and D is a Category.

It has Diagrams G o F : B -> D as objects and NaturalTransformations between them as morphisms. NaturalTransformations compose vertically in this category.

Constructors

PrecomposedFunctorCategory (Diagram c1 m1 o1 c2 m2 o2) c3 

Instances

Instances details
(PrettyPrint c1, PrettyPrint m1, PrettyPrint o1, Eq m1, Eq o1, PrettyPrint c2, PrettyPrint m2, PrettyPrint o2, Eq m2, Eq o2, PrettyPrint c3) => PrettyPrint (PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

pprint :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> String Source #

(Show c1, Show c2, Show o1, Show o2, Show m1, Show m2, Show c3) => Show (PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

showsPrec :: Int -> PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> ShowS

show :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> String

showList :: [PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3] -> ShowS

(Eq c1, Eq c2, Eq o1, Eq o2, Eq m1, Eq m2, Eq c3) => Eq (PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

(==) :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Bool

(/=) :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Bool

(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, Category c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => Category (PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

identity :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

ar :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

genAr :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

decompose :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 -> [NaturalTransformation c1 m1 o1 c3 m3 o3] Source #

(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, FiniteCategory c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => FiniteCategory (PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source #

A PrecomposedFunctorCategory where the target category is finite allows to enumerate all Diagrams thus making it a FiniteCategory.

Instance details

Defined in Math.Categories.FunctorCategory

Methods

ob :: PrecomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Set (Diagram c1 m1 o1 c3 m3 o3) Source #

data PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 Source #

A FunctorCategory D^C postcomposed by a functor F : D -> E where C is a FiniteCategory and D and E are Category.

It has Diagrams F o G : C -> E as objects and NaturalTransformations between them as morphisms. NaturalTransformations compose vertically in this category.

Constructors

PostcomposedFunctorCategory (Diagram c2 m2 o2 c3 m3 o3) c1 

Instances

Instances details
(PrettyPrint c1, PrettyPrint c2, PrettyPrint m2, PrettyPrint o2, Eq m2, Eq o2, PrettyPrint c3, PrettyPrint m3, PrettyPrint o3, Eq m3, Eq o3) => PrettyPrint (PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

pprint :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> String Source #

(Show c2, Show c3, Show o2, Show o3, Show m2, Show m3, Show c1) => Show (PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

showsPrec :: Int -> PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> ShowS

show :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> String

showList :: [PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3] -> ShowS

(Eq c2, Eq c3, Eq o2, Eq o3, Eq m2, Eq m3, Eq c1) => Eq (PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

(==) :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Bool

(/=) :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Bool

(FiniteCategory c1 m1 o1, Morphism m1 o1, Eq c1, Eq m1, Eq o1, Category c2 m2 o2, Morphism m2 o2, Eq c2, Eq m2, Eq o2, Category c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => Category (PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source # 
Instance details

Defined in Math.Categories.FunctorCategory

Methods

identity :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 Source #

ar :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

genAr :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Diagram c1 m1 o1 c3 m3 o3 -> Set (NaturalTransformation c1 m1 o1 c3 m3 o3) Source #

decompose :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> NaturalTransformation c1 m1 o1 c3 m3 o3 -> [NaturalTransformation c1 m1 o1 c3 m3 o3] Source #

(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, FiniteCategory c3 m3 o3, Morphism m3 o3, Eq c3, Eq m3, Eq o3) => FiniteCategory (PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3) (NaturalTransformation c1 m1 o1 c3 m3 o3) (Diagram c1 m1 o1 c3 m3 o3) Source #

A PostcomposedFunctorCategory where the target category is finite allows to enumerate all Diagrams thus making it a FiniteCategory.

Instance details

Defined in Math.Categories.FunctorCategory

Methods

ob :: PostcomposedFunctorCategory c1 m1 o1 c2 m2 o2 c3 m3 o3 -> Set (Diagram c1 m1 o1 c3 m3 o3) Source #