[Up] [Previous] [Index]

8.5 Filters and Categories

The following was originally posted at the GAP forum by Thomas Breuer BreuersAnswer.

Each filter in GAP is either a simple filter or a meet of filters. For example, IsInt and IsPosRat are simple filters, and IsPosInt is defined as their meet IsInt and IsPosRat.

Each simple filter is of one of the following kinds.

1. property: Such a filter is an operation, the filter value can be computed. The (unary) methods of this operation must return true or false, and the return value is stored in the argument, except if the argument is of a basic data type such as cyclotomic (including rationals and integers), finite field element, permutation, or internally represented list --the latter with a few exceptions. Examples of properties are IsFinite, IsAbelian, IsSSortedList.

2. attribute tester: Such a filter is associated to an operation that has been created via DeclareAttribute, in the sense that the value is true if and only if a return value for (a unary method of) this operation is stored in the argument. Currently, attribute values are stored in objects in the filter IsAttributeStoringRep. Examples of attribute testers are HasSize, HasCentre, HasDerivedSubgroup.

2.' property tester: Such a filter is similar to an attribute tester, but the associated operation is a property. So property testers can return true also if the argument is not in the filter IsAttributeStoringRep. Examples of property testers are HasIsFinite, HasIsAbelian, HasIsSSortedList.

3. category or representation: These filters are not associated to operations, their values cannot be computed but are set upon creation of an object and should not be changed later, such that for a filter of this kind, one can rely on the fact that if the value is true then it was true already when the object in question was created.

The distinction between representation and category is intended to express dependency on or independence of the way how the object is stored internally. For example, IsPositionalObjectRep, IsComponentObjectRep, and IsInternalRep are filters of the representation kind; the idea is that such filters are used in low level methods, and that higher level methods can be implemented without referring to these filters.

Examples of categories are IsInt, IsRat, IsPerm, IsFFE, and filters expressing algebraic structures, such as IsMagma, IsMagmaWithOne, IsAdditiveMagma. When one calls such a filter, one can be sure that no computation is triggered. For example, whenever a quotient of two integers is formed, the result is clearly in the filter IsRat, but the system also stores the value of IsInt, i.e., GAP does not support ``unevaluated rationals'' for which the IsInt value is computed on demand and then stored.

4. other filters: Some filters do not belong to the above kinds, they are not associated to operations but they are intended to be set (or even reset) by the user or by functions also after the creation of objects. Examples are IsQuickPositionList, CanEasilyTestMembership, IsHandledByNiceBasis.

Each meet of filters can involve computable simple filters (properties, attribute and property testers) and not computable simple filters (categories, representations, other filters). When one calls a meet of two filters then the two filters from which the meet was formed are evaluated (if necessary). So a meet of filters is computable only if at least one computable simple filter is involved.

  • IsComputableFilter( filter ) F

    'IsComputableFilter(filter)' returns true if a the filter filter is computable. Filters for which 'IsComputableFilter' returns false may be used in 'DeclareOperation'.

        gap> IsComputableFilter( IsFinite );
        true
        gap> IsComputableFilter( HasSize );
        true
        gap> IsComputableFilter( HasIsFinite );
        true
        gap> IsComputableFilter( IsPositionalObjectRep );
        false
        gap> IsComputableFilter( IsInt );
        false
        gap> IsComputableFilter( IsQuickPositionList );
        false
        gap> IsComputableFilter( IsInt and IsPosRat );
        false
        gap> IsComputableFilter( IsMagma );
        false
    

    [Up] [Previous] [Index]

    RDS manual
    November 2006