GAP (CAP) - Chapter 5: Category of Categories

Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Ind
[Top of Book] [Contents] [Previous Chapter] [Next Chapter]

[MathJax on]

5 Category of Categories
5.1 The Category Cat
5.1-1 CapCat
5.2 Categories
5.2-1 IsCapCategoryAsCatObject
5.2-2 IsCapFunctor
5.2-3 IsCapNaturalTransformation
5.3 Constructors
5.3-1 AsCatObject
5.3-2 AsCapCategory
5.4 Functors
5.4-1 CapFunctor
5.4-2 CapFunctor
5.4-3 SourceOfFunctor
5.4-4 RangeOfFunctor
5.4-5 AddObjectFunction
5.4-6 FunctorObjectOperation
5.4-7 AddMorphismFunction
5.4-8 FunctorMorphismOperation
5.4-9 ApplyFunctor
5.4-10 InputSignature
5.4-11 InstallFunctor
5.4-12 IdentityFunctor
5.4-13 FunctorCanonicalizeZeroObjects
5.4-14 NaturalIsomorphismFromIdentityToCanonicalizeZeroObjects
5.4-15 FunctorCanonicalizeZeroMorphisms
5.4-16 NaturalIsomorphismFromIdentityToCanonicalizeZeroMorphisms
5.5 Natural transformations
5.5-1 Name
5.5-2 NaturalTransformation
5.5-3 AddNaturalTransformationFunction
5.5-4 ApplyNaturalTransformation
5.5-5 InstallNaturalTransformation
5.5-6 HorizontalPreComposeNaturalTransformationWithFunctor
5.5-7 HorizontalPreComposeFunctorWithNaturalTransformation

### 5 Category of Categories

Categories itself with functors as morphisms form a category Cat. So the data structure of `CapCategory`s is designed to be objects in a category. This category is implemented in `CapCat`. For every category, the corresponding object in Cat can be obtained via `AsCatObject`. The implemetation of the category of categories offers a data structure for functors. Those are implemented as morphisms in this category, so functors can be handled like morphisms in a category. Also convenience functions to install functors as methods are implemented (in order to avoid `ApplyFunctor`).

#### 5.1 The Category Cat

##### 5.1-1 CapCat

`‣ CapCat` | ( global variable )

This variable stores the category of categories. Every category object is constructed as an object in this category, so Cat is constructed when loading the package.

#### 5.2 Categories

##### 5.2-1 IsCapCategoryAsCatObject

`‣ IsCapCategoryAsCatObject`( object ) | ( filter )

Returns: `true` or `false`

The GAP category of CAP categories seen as object in Cat.

##### 5.2-2 IsCapFunctor

`‣ IsCapFunctor`( object ) | ( filter )

Returns: `true` or `false`

The GAP category of functors.

##### 5.2-3 IsCapNaturalTransformation

`‣ IsCapNaturalTransformation`( object ) | ( filter )

Returns: `true` or `false`

The GAP category of natural transformations.

#### 5.3 Constructors

##### 5.3-1 AsCatObject

`‣ AsCatObject`( C ) | ( attribute )

Given a CAP category C, this method returns the corresponding object in Cat. For technical reasons, the filter `IsCapCategory` must not imply the filter `IsCapCategoryObject`. For example, if `InitialObject` is applied to an object, it returns the initial object of its category. If it is applied to a category, it returns the initial object of the category. If a CAP category would be a category object itself, this would be ambiguous. So categories must be wrapped in a CatObject to be an object in Cat. This method returns the wrapper object. The category can be reobtained by `AsCapCategory`.

##### 5.3-2 AsCapCategory

`‣ AsCapCategory`( C ) | ( attribute )

For an object C in Cat, this method returns the underlying CAP category. This method is inverse to `AsCatObject`, i.e. AsCapCategory( AsCatObject( A ) ) = A.

#### 5.4 Functors

Functors are morphisms in Cat, thus they have source and target which are categories. A multivariate functor can be constructed via a product category as source, a presheaf is constructed via the opposite category as source. However, the user can explicitly decide the arity of a functor (which will only have technical implications). Thus, it is for example possible to consider a functor A \times B \rightarrow C either as a unary functor with source category A \times B or as a binary functor. Moreover, an object and a morphism function can be added to a functor, to apply it to objects or morphisms in the source category.

##### 5.4-1 CapFunctor

`‣ CapFunctor`( name, A, B ) | ( operation )

`‣ CapFunctor`( name, A, B ) | ( operation )

`‣ CapFunctor`( name, A, B ) | ( operation )

`‣ CapFunctor`( name, A, B ) | ( operation )

These methods construct a unary CAP functor. The first argument is a string for the functor's name. A and B are the source and target of the functor, and they can be given as objects in `CapCat` or as a CAP-category.

##### 5.4-2 CapFunctor

`‣ CapFunctor`( name, list, B ) | ( operation )

`‣ CapFunctor`( name, list, B ) | ( operation )

These methods construct a possible multivariate CAP functor. The first argument is a string for the functor's name. The second argument is a list encoding the input signature of the functor. It can be given as a list of pairs [ [ A_1, b_1 ], \dots, [ A_n, b_n ] ] where a pair consists of a category A_i (given as an object in `CapCat` or as a CAP-category) and a boolean b_i for i = 1, \dots, n. Instead of a pair [ A_i, b_i ], you can also give simply A_i, which will be interpreted as the pair [ A_i, \mathtt{false} ]. The third argument is the target B of the functor, and it can be given as an object in `CapCat` or as a CAP-category. The output is a functor with source given by the product category D_1 \times ... \times D_n, where D_i = A_i if b_i = \mathtt{false}, and D_i = A_i^{\mathrm{op}} otherwise.

##### 5.4-3 SourceOfFunctor

`‣ SourceOfFunctor`( F ) | ( attribute )

The argument is a functor F. The output is its source as CAP category.

##### 5.4-4 RangeOfFunctor

`‣ RangeOfFunctor`( F ) | ( attribute )

The argument is a functor F. The output is its range as CAP category.

##### 5.4-5 AddObjectFunction

`‣ AddObjectFunction`( F, f ) | ( operation )

This operation adds a function f to the functor F which can then be applied to objects in the source. The given function f has to take arguments according to the `InputSignature` of F, i.e., if the input signature is given by [ [A_1, b_1], \dots, [A_n,b_n] ], then f must take n arguments, where the i-th argument is an object in the category A_i (the boolean b_i is ignored). The function should return an object in the range of the functor, except when the automatic call of `AddObject` was enabled via `EnableAddForCategoricalOperations`. In this case the output only has to be a GAP object in `IsAttributeStoringRep`, which will be automatically added as an object to the range of the functor.

##### 5.4-6 FunctorObjectOperation

`‣ FunctorObjectOperation`( F ) | ( attribute )

Returns: a GAP operation

The argument is a functor F. The output is the GAP operation realizing the action of F on objects.

##### 5.4-7 AddMorphismFunction

`‣ AddMorphismFunction`( F, f ) | ( operation )

This operation adds a function f to the functor F which can then be applied to morphisms in the source. The given function f has to take as its first argument an object s that is equal (via `IsEqualForObjects`) to the source of the result of applying F to the input morphisms. The next arguments of f have to morphisms according to the `InputSignature` of F, i.e., if the input signature is given by [ [A_1, b_1], \dots, [A_n,b_n] ], then f must take n arguments, where the i-th argument is a morphism in the category A_i (the boolean b_i is ignored). The last argument of f must be an object r that is equal (via `IsEqualForObjects`) to the range of the result of applying F to the input morphisms. The function should return a morphism in the range of the functor, except when the automatic call of `AddMorphism` was enabled via `EnableAddForCategoricalOperations`. In this case the output only has to be a GAP object in `IsAttributeStoringRep` (with attributes `Source` and `Range` containing also GAP objects in `IsAttributeStoringRep`), which will be automatically added as a morphism to the range of the functor.

##### 5.4-8 FunctorMorphismOperation

`‣ FunctorMorphismOperation`( F ) | ( attribute )

Returns: a GAP operation

The argument is a functor F. The output is the GAP operation realizing the action of F on morphisms.

##### 5.4-9 ApplyFunctor

`‣ ApplyFunctor`( func, A[, B, ...] ) | ( function )

Returns: IsCapCategoryCell

Applies the functor func either to

- an object or morphism A in the source of func or

- to objects or morphisms belonging to the categories in the input signature of func.

##### 5.4-10 InputSignature

`‣ InputSignature`( F ) | ( attribute )

Returns: IsList

The argument is a functor F. The output is a list of pairs [ [ A_1, b_1 ], \dots, [ A_n, b_n ] ] where a pair consists of a CAP-category A_i and a boolean b_i for i = 1, \dots, n. The source of F is given by the product category D_1 \times ... \times D_n, where D_i = A_i if b_i = \mathtt{false}, and D_i = A_i^{\mathrm{op}} otherwise.

##### 5.4-11 InstallFunctor

`‣ InstallFunctor`( F, s ) | ( operation )

Returns: nothing

The arguments are a functor F and a string s. To simplify the description of this operation, we let [ [ A_1, b_1 ], \dots, [ A_n, b_n ] ] denote the input signature of F. This method tries to install 3 operations: an operation \omega_1 with the name s, an operation \omega_2 with the name s\mathtt{OnObjects}, and an operation \omega_3 with the name s\mathtt{OnMorphisms}. The operation \omega_1 takes as input either n- objects/morphisms in A_i or a single object/morphism in the source of F, and outputs the result of applying F to this input. \omega_2 and \omega_3 are the corresponding variants for objects or morphisms only. This function can only be called once for each functor, every further call will be ignored.

##### 5.4-12 IdentityFunctor

`‣ IdentityFunctor`( cat ) | ( attribute )

Returns: a functor

Returns the identity functor of the category cat viewed as an object in the category of categories.

##### 5.4-13 FunctorCanonicalizeZeroObjects

`‣ FunctorCanonicalizeZeroObjects`( cat ) | ( attribute )

Returns: a functor

Returns the endofunctor of the category cat with zero which maps each (object isomorphic to the) zero object to `ZeroObject`(cat) and to itself otherwise. This functor is equivalent to the identity functor.

##### 5.4-14 NaturalIsomorphismFromIdentityToCanonicalizeZeroObjects

`‣ NaturalIsomorphismFromIdentityToCanonicalizeZeroObjects`( cat ) | ( attribute )

Returns: a natural transformation

Returns the natural isomorphism from the identity functor to `FunctorCanonicalizeZeroObjects`(cat).

##### 5.4-15 FunctorCanonicalizeZeroMorphisms

`‣ FunctorCanonicalizeZeroMorphisms`( cat ) | ( attribute )

Returns: a functor

Returns the endofunctor of the category cat with zero which maps each object to itself, each morphism ϕ to itself, unless it is congruent to the zero morphism; in this case it is mapped to `ZeroMorphism`(`Source`(ϕ), `Range`(ϕ)). This functor is equivalent to the identity functor.

##### 5.4-16 NaturalIsomorphismFromIdentityToCanonicalizeZeroMorphisms

`‣ NaturalIsomorphismFromIdentityToCanonicalizeZeroMorphisms`( cat ) | ( attribute )

Returns: a natural transformation

Returns the natural isomorphism from the identity functor to `FunctorCanonicalizeZeroMorphisms`(cat).

#### 5.5 Natural transformations

Natural transformations form the 2-cells of Cat. As such, it is possible to compose them vertically and horizontally, see Section 4.2.

##### 5.5-1 Name

`‣ Name`( arg ) | ( attribute )

Returns: a string

As every functor, every natural transformation has a name attribute. It has to be a string and will be set by the Constructor.

##### 5.5-2 NaturalTransformation

`‣ NaturalTransformation`( [name, ]F, G ) | ( operation )

Returns: a natural transformation

Constructs a natural transformation between the functors F:A \rightarrow B and G:A \rightarrow B. The string name is optional, and, if not given, set automatically from the names of the functors

##### 5.5-3 AddNaturalTransformationFunction

`‣ AddNaturalTransformationFunction`( N, func ) | ( operation )

Adds the function (or list of functions) func to the natural transformation N. The function or each function in the list should take three arguments. If N: F \rightarrow G, the arguments should be F(A), A, G(A). The ouptput should be a morphism, F(A) \rightarrow G(A).

##### 5.5-4 ApplyNaturalTransformation

`‣ ApplyNaturalTransformation`( N, A ) | ( function )

Returns: a morphism

Given a natural transformation N:F \rightarrow G and an object A, this function should return the morphism F(A) \rightarrow G(A), corresponding to N.

##### 5.5-5 InstallNaturalTransformation

`‣ InstallNaturalTransformation`( N, name ) | ( operation )

Installs the natural transformation N as operation with the name name. Argument for this operation is an object, output is a morphism.

##### 5.5-6 HorizontalPreComposeNaturalTransformationWithFunctor

`‣ HorizontalPreComposeNaturalTransformationWithFunctor`( N, F ) | ( operation )

Returns: a natural transformation

Computes the horizontal composition of the natural transformation N and the functor F.

##### 5.5-7 HorizontalPreComposeFunctorWithNaturalTransformation

`‣ HorizontalPreComposeFunctorWithNaturalTransformation`( F, N ) | ( operation )

Returns: a natural transformation

Computes the horizontal composition of the functor F and the natural transformation N.

[Top of Book] [Contents] [Previous Chapter] [Next Chapter]
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Ind

generated by GAPDoc2HTML