Dear GAP Forum,
Chris Wensley asked:
Assume I am constructing functions for TestOps, and that X
is an object and f a morphism in the correcponding category.
Does TestOps contain operations for X or for f?
>
> 1. I define a function TestOps.Image
> and then call >TestOps.Image( f, X );
> This results in an error message which I believe comes from
> GroupOps.Image or MappingOps.Image.
> However >TestOps.Image( f, X ); works ok.
I'm a bit confused as I cannot spot any difference between the two commands.
Did you probably call just 'Image' once?
In this case, 'Image' checks whether X is contained in f.source (by 'in')
and calls f.operations.ImageElm(f,X) otherwise it checks, whether X is
a subset of f.souce, and calls f.opreration.ImagesSet.
Thus TestOps ought to be operations for the morphism f.
The standard operations 'MappingOps' (from which you'll likely inherit)
define 'MappingOps.ImageElm' and 'MappingOps.ImagesSet' to call
'Images(f,el)' with the element (respective the sets elements of X).
'Images' in turn calls then f.operations.Images(f,el).
Thus when inheriting from MappingOps, you'll only need to define your own
'Images' to compute all images of an element. Of course, you can overlay
also 'ImageElm' or 'ImagesSet' to become more efficient.
Please note, that this dispatching process will change substantially in GAP 4.
2. I also wish to define TestOps.DirectProduct
and call this function by >DirectProduct( X, Y );
However, the dispatcher function DirectProduct in file gprprods.g
appears to insist that all the arguments should be groups:
( ... if nor ForAll( arg, IsGroup ) then Error ... )
Again, >TestOps.DirectProduct( X, Y ); is ok.
The objects X,Y are not groups, but contain groups,
so the term DirectProduct is an appropriate one.
So far, the dispatcher function 'DirectProduct' requires the arguments to be
groups. I'm not sure what you mean by the phrase 'X and Y contain groups'.
If they are indeed groups in GAPs sense, then you should set X.isGroup and
Y.isGroup to true. If not, and you want 'DirectProduct' to work also for
your type of objects, you will need to change the dispatcher function.
Best,
Alexander Hulpke