13.3 Categories

The categories of an object are filters (see Filters) determine what operations an object admits. For example, all integers form a category, all rationals form a category, and all rational functions form a category. An object which claims to lie in a certain category is accepting the requirement that it should have methods for certain operations (and perhaps that their behaviour should satisfy certain axioms). For example, an object lying in the category IsList must have methods for Length, IsBound\[\] and the list element access operation \[\].

An object can lie in several categories. For example, a row vector lies in the categories IsList and IsVector; each list lies in the category IsCopyable, and depending on whether or not it is mutable, it may lie in the category IsMutable. Every domain lies in the category IsDomain.

Of course some categories of a mutable object may change when the object is changed. For example, after assigning values to positions of a mutable non-dense list, this list may become part of the category IsDenseList.

However, if an object is immutable then the set of categories it lies in is fixed.

All categories in the library are created during initialization, in particular they are not created dynamically at runtime.

The following list gives an overview of important categories of arithmetic objects. Indented categories are to be understood as subcategories of the non indented category listed above it.

    IsObject
        IsExtLElement
        IsExtRElement
            IsMultiplicativeElement
                IsMultiplicativeElementWithOne
                    IsMultiplicativeElementWithInverse
        IsExtAElement
            IsAdditiveElement
                IsAdditiveElementWithZero
                    IsAdditiveElementWithInverse
Every object lies in the category IsObject.

The categories IsExtLElement and IsExtRElement contain objects that can be multiplied with other objects via * from the left and from the right, respectively. These categories are required for the operands of the operation *.

The category IsMultiplicativeElement contains objects that can be multiplied from the left and from the right with objects from the same family. IsMultiplicativeElementWithOne contains objects obj for which a multiplicatively neutral element can be obtained by taking the zeroth power obj^0. IsMultiplicativeElementWithInverse contains objects obj for which a multiplicative inverse can be obtained by forming obj^-1.

Likewise, the categories IsExtAElement, IsAdditiveElement, IsAdditiveElementWithZero, and IsAdditiveElementWithInverse contain objects that can be added via + to other objects, objects that can be added to objects of the same family, objects for which an additively neutral element can be obtained by multiplication with zero, and objects for which an additive inverse can be obtained by multiplication with -1.

So a vector lies in IsExtLElement, IsExtRElement, and IsAdditiveElementWithInverse. A ring element must additionally lie in IsMultiplicativeElement.

As stated above it is not guaranteed by the categories of objects whether the result of an operation with these objects as arguments is defined. For example, the category IsMatrix is a subcategory of IsMultiplicativeElementWithInverse. Clearly not every matrix has a multiplicative inverse. But the category IsMatrix makes each matrix an admissible argument of the operation Inverse, which may sometimes return 'fail'. Likewise, two matrices can be multiplied only if they are of appropriate shapes.

Analogous to the categories of arithmetic elements, there are categories of domains of these elements.

    IsObject
        IsDomain
            IsMagma
                IsMagmaWithOne
                    IsMagmaWithInversesIfNonzero
                        IsMagmaWithInverses
            IsAdditiveMagma
                IsAdditiveMagmaWithZero
                    IsAdditiveMagmaWithInverses
            IsExtLSet
            IsExtRSet
Of course IsDomain is a subcategory of IsObject. A domain that is closed under multiplication * is called a magma and it lies in the category IsMagma. If a magma is closed under taking the identity, it lies in IsMagmaWithOne, and if it is also closed under taking inverses, it lies in IsMagmaWithInverses. The category IsMagmaWithInversesIfNonzero denotes closure under taking inverses only for nonzero elements, every division ring lies in this category.

Note that every set of categories constitutes its own notion of generation, for example a group may be generated as a magma with inverses by some elements, but to generate it as a magma with one it may be necessary to take the union of these generators and their inverses.

  • CategoriesOfObject( object ) O

    returns a list of the names of the categories in which object lies.

    gap> g:=Group((1,2),(1,2,3));;
    gap> CategoriesOfObject(g);
    [ "IsListOrCollection", "IsCollection", "IsExtLElement", 
      "CategoryCollections(IsExtLElement)", "IsExtRElement", 
      "CategoryCollections(IsExtRElement)", 
      "CategoryCollections(IsMultiplicativeElement)", 
      "CategoryCollections(IsMultiplicativeElementWithOne)", 
      "CategoryCollections(IsMultiplicativeElementWithInverse)", 
      "CategoryCollections(IsAssociativeElement)", 
      "CategoryCollections(IsFiniteOrderElement)", "CategoryCollections(IS_PERM)",
      "IsGeneralizedDomain", "IsMagma", "IsMagmaWithOne", 
      "IsMagmaWithInversesIfNonzero", "IsMagmaWithInverses" ]
    

    [Top] [Previous] [Up] [Next] [Index]

    GAP 4 manual
    February 2000