# 5.7 ActionWithZero

`ActionWithZero( M, D )`
`ActionWithZero( M, D, action )`

`ActionWithZero` returns a transformation monoid with the same number of generators as M, such that each generator of the transformation monoid acts on the set `[1..Length(D)+1]` in the same way as the corresponding generator of the monoid M acts on the domain <D> cup {0}, which may be a list of arbitrary type.

Here it is not required that D be invariant under M. Whenever the image of a point d under the monoid element m does not lie in D it is set to 0. The image of 0 under every monoid element is set to 0. Note that this way the resulting monoid is a homomorphic image of M if and only if D is a union of strong orbits. The point 0 is represented by `Length(D) + 1` in the domain of the transformation monoid returned by `ActionWithZero`.

`ActionWithZero` accepts a function action of two arguments d and m as optional third argument, which specifies how the elements of M act on D (see Other Actions).

`ActionWithZero` calls
`M.operations.ActionWithZero( M, D, action )`
and returns the value. Note that the third argument is not optional for functions called this way.

The default function called this way is `MonoidOps.ActionWithZero`, which simply applies each generator of M to all the points of D, finds the position of the image in D, and finally constructs the transformation (see Transformation) defined by the list of those positions and `Length(D)+1` for every image not in D.

```    gap> M:= Monoid( [ Transformation( [ 5, 4, 4, 2, 2 ] ),
Transformation( [ 2, 5, 5, 4, 1 ] ) ] );;
gap> M.name:= "M";;
gap> class:= LClass( M, Transformation( [ 1, 4, 4, 5, 5 ] ) );
LClass( M, Transformation( [ 1, 4, 4, 5, 5 ] ) )
gap> orb:= ShortOrbit(M, class, OnLClasses, Rank);
[ LClass( M, Transformation( [ 1, 4, 4, 5, 5 ] ) ),
LClass( M, Transformation( [ 2, 4, 4, 1, 1 ] ) ),
LClass( M, Transformation( [ 4, 2, 2, 5, 5 ] ) ) ]
gap> ActionWithZero(M, orb, OnLClasses);
Monoid( [ Transformation( [ 4, 3, 4, 4 ] ),
Transformation( [ 2, 3, 1, 4 ] ) ] )```

Version 2.4 (May 1998)