# [GAP Forum] Define function with domain and codomain

Jack Schmidt jack at ms.uky.edu
Fri Apr 4 21:10:25 BST 2008

GroupHomomorphismByImages or GroupHomomorphismByFunction are probably
what you are looking for.  The first argument is the domain, and the
second argument is the codomain.

Here is an example:

C4 := CyclicGroup(IsPermGroup,4);
S4 := SymmetricGroup(4);
dom := DirectProduct( C4, C4, C4, S4 );;
cod := GL(1,Integers);;
fun := h -> Product( [1..4], i -> SignPerm( Image( Projection( dom, i),
h ) ) );;
homf := GroupHomomorphismByFunction( dom, cod, h -> [[ fun(h) ]] );;
homi := GroupHomomorphismByImages( dom, cod, GeneratorsOfGroup(dom),
List( GeneratorsOfGroup(dom), h -> [[ fun(h) ]] ) );;
kerf := Kernel(homf);
keri := Kernel(homi);

gap> kerf=keri;
true
gap> StructureDescription(keri);
"C4 x C4 x (A4 : C4)"
gap> Elements(cod);
[ [ [ -1 ] ], [ [ 1 ] ] ]

Note that kerf has many more generators than keri, so it is less
efficient to work with kerf than with keri.  However, as you can see,
the groups are equal.

You cannot literally use [1,-1] as a group, since exponentiation is
defined differently for group elements than for rational numbers, but
you can use 1x1 matrices instead, which are equivalent in an easy to see
way.

Inneke Van Gelder wrote:
> Dear GAP-forum,
>
>
>
>
>
> How can I define a function with explicit domain and codomain?
>
> I need it do find the size of the kernel of the mapping
>
> t: C_4^3 \times S_4 \rightarrow \{ \pm 1 \}: (h_1,h_2,h_3,h_4) \mapsto
> sgn(h_1)sgn(h_2)sgn(h_3)sgn(h_4)
>
>
>
>
>
>
>
> Best regards,
>
> Inneke Van Gelder
>
>
>
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum