[GAP Forum] Filter trouble

Stefan Kohl kohl at mathematik.uni-stuttgart.de
Tue Jun 14 09:43:56 BST 2005


Dear Forum,

Marc Roeder wrote:

> when using DeclareOperation and InstallMethod, some filters produce strange results.
> For example:
> 
> gap> DeclareOperation("CoeffList2CyclotomicList",[IsList,IsIntegralCyclotomic]);
> gap> InstallMethod(CoeffList2CyclotomicList,
> 
>>        [IsList,IsIntegralCyclotomic],
>>        function(list,root)
>>    return List([1..Size(list)],i->list[i]*root^(i-1));
>>end);
> 
> gap> CoeffList2CyclotomicList([1,2,3],E(3));
> Error, no method found!...
> 
> substituting IsIntegralCyclotomic with IsCyc gives the desired result.
> 
> Are there different forms of filters or did I misunderstand the concept?

The point is that `IsCyc' resp. `IsCyclotomic' denotes elements of
the "Category" of Cyclotomics (note that "Category" in the GAP sense
means something different than in category theory -- see ?Categories),
but `IsIntegralCyclotomic' is a property.

Any Object "knows" from its creation on which Categories it belongs to,
but whether it has a given Property is only checked when you explicitly
or implicitly ask GAP for it.

The point of Properties is mainly to allow quicker methods when the
corresponding information about an Object is known, in particular in
cases where computing the information would be even slower than the
original slower method. In fact, sometimes determining whether a given
Object has some given Property can be computationally very difficult
or in general even algorithmically undecidable.

If your Operation only makes sense for Objects which are actually
Integral Cyclotomics, for instance, you have to install at least one
Method requiring only a suitable Category IsCyc, and do the test for
IsIntegralCyclotomic inside the Method.

Hope this helps,

     Stefan Kohl

- I would like to acknowledge hints by Steve Linton -





More information about the Forum mailing list