# Products of groups

## Direct products

`DirectProductGroup`

— Type`DirectProductGroup`

Either direct product of two or more groups of any type, or subgroup of a direct product of groups.

`direct_product`

— Method```
direct_product(L::AbstractVector{<:GAPGroup}; morphisms)
direct_product(L::GAPGroup...)
```

Return the direct product of the groups in the collection `L`

.

The keyword argument `morphisms`

is `false`

by default. If it is set `true`

, then the output is a triple (`G`

, `emb`

, `proj`

), where `emb`

and `proj`

are the vectors of the embeddings (resp. projections) of the direct product `G`

.

**Examples**

```
julia> H = symmetric_group(3)
Permutation group of degree 3 and order 6
julia> K = symmetric_group(2)
Permutation group of degree 2 and order 2
julia> G = direct_product(H,K)
Direct product of
Permutation group of degree 3 and order 6
Permutation group of degree 2 and order 2
julia> elements(G)
12-element Vector{Oscar.BasicGAPGroupElem{DirectProductGroup}}:
()
(4,5)
(2,3)
(2,3)(4,5)
(1,2)
(1,2)(4,5)
(1,2,3)
(1,2,3)(4,5)
(1,3,2)
(1,3,2)(4,5)
(1,3)
(1,3)(4,5)
```

`inner_direct_product`

— Method```
inner_direct_product(L::AbstractVector{T}; morphisms)
inner_direct_product(L::T...)
```

Return a direct product of groups of the same type `T`

as a group of type `T`

. It works for `T`

of the following types:

`PermGroup`

,`PcGroup`

,`FPGroup`

.

The keyword argument `morphisms`

is `false`

by default. If it is set `true`

, then the output is a triple (`G`

, `emb`

, `proj`

), where `emb`

and `proj`

are the vectors of the embeddings (resp. projections) of the direct product `G`

.

`number_of_factors`

— Method`number_of_factors(G::DirectProductGroup)`

Return the number of factors of `G`

.

`cartesian_power`

— Method`cartesian_power(G::GAPGroup, n::Int)`

Return the direct product of `n`

copies of `G`

.

`inner_cartesian_power`

— Method`inner_cartesian_power(G::T, n::Int; morphisms)`

Return the direct product of `n`

copies of `G`

as group of type `T`

.

The keyword argument `morphisms`

is `false`

by default. If it is set `true`

, then the output is a triple (`G`

, `emb`

, `proj`

), where `emb`

and `proj`

are the vectors of the embeddings (resp. projections) of the direct product `G`

.

`factor_of_direct_product`

— Method`factor_of_direct_product(G::DirectProductGroup, j::Int)`

Return the `j`

-th factor of `G`

.

`embedding`

— Method`embedding(G::DirectProductGroup, j::Int)`

Return the embedding of the `j`

-th component of `G`

into `G`

, for `j`

= 1,...,#factors of `G`

.

**Examples**

```
julia> H = symmetric_group(3)
Permutation group of degree 3 and order 6
julia> K = symmetric_group(2)
Permutation group of degree 2 and order 2
julia> G = direct_product(H,K)
Direct product of
Permutation group of degree 3 and order 6
Permutation group of degree 2 and order 2
julia> emb1 = embedding(G,1)
Group homomorphism
from permutation group of degree 3 and order 6
to direct product of
Permutation group of degree 3 and order 6
Permutation group of degree 2 and order 2
julia> h = perm(H,[2,3,1])
(1,2,3)
julia> emb1(h)
(1,2,3)
julia> emb2 = embedding(G,2)
Group homomorphism
from permutation group of degree 2 and order 2
to direct product of
Permutation group of degree 3 and order 6
Permutation group of degree 2 and order 2
julia> k = perm(K,[2,1])
(1,2)
julia> emb2(k)
(4,5)
julia> emb1(h)*emb2(k)
(1,2,3)(4,5)
```

`projection`

— Method`projection(G::DirectProductGroup, j::Int)`

Return the projection of `G`

into the `j`

-th component of `G`

, for `j`

= 1,...,#factors of `G`

.

**Examples**

```
julia> H = symmetric_group(3)
Permutation group of degree 3 and order 6
julia> K = symmetric_group(2)
Permutation group of degree 2 and order 2
julia> G = direct_product(H,K)
Direct product of
Permutation group of degree 3 and order 6
Permutation group of degree 2 and order 2
julia> proj1 = projection(G,1)
Group homomorphism
from direct product of
Permutation group of degree 3 and order 6
Permutation group of degree 2 and order 2
to permutation group of degree 3 and order 6
julia> proj2 = projection(G,2)
Group homomorphism
from direct product of
Permutation group of degree 3 and order 6
Permutation group of degree 2 and order 2
to permutation group of degree 2 and order 2
julia> g = perm([2,3,1,5,4])
(1,2,3)(4,5)
julia> proj1(g)
(1,2,3)
julia> proj2(g)
(1,2)
```

`write_as_full`

— Method`write_as_full(G::DirectProductGroup)`

If `G`

is a subgroup of the direct product $G_1 \times G_2 \times \cdots \times G_n$ such that `G`

has the form $H_1 \times H_2 \times \cdots \times H_n$, for subgroups $H_i$ of $G_i$, return this full direct product of the $H_i$.

An exception is thrown if such $H_i$ do not exist.

`is_full_direct_product`

— Method`is_full_direct_product(G::DirectProductGroup)`

Return whether `G`

is direct product of its factors (`false`

if it is a proper subgroup).

## Semidirect products

`SemidirectProductGroup`

— Type`SemidirectProductGroup{S,T}`

Semidirect product of two groups of type `S`

and `T`

respectively, or subgroup of a semidirect product of groups.

`semidirect_product`

— Method`semidirect_product(N::S, f::GAPGroupHomomorphism, H::T)`

Return the semidirect product of `N`

and `H`

, of type `SemidirectProductGroup{S,T}`

, where `f`

is a group homomorphism from `H`

to the automorphism group of `N`

.

`normal_subgroup`

— Method`normal_subgroup(G::SemidirectProductGroup)`

Return `N`

, where `G`

is the semidirect product of the normal subgroup `N`

and `H`

.

`acting_subgroup`

— Method`acting_subgroup(G::SemidirectProductGroup)`

Return `H`

, where `G`

is the semidirect product of the normal subgroup `N`

and `H`

.

`homomorphism_of_semidirect_product`

— Method`homomorphism_of_semidirect_product(G::SemidirectProductGroup)`

Return `f,`

where `G`

is the semidirect product of the normal subgroup `N`

and the group `H`

acting on `N`

via the homomorphism `h`

.

`is_full_semidirect_product`

— Method`is_full_semidirect_product(G::SemidirectProductGroup)`

Return whether `G`

is a semidirect product of two groups, instead of a proper subgroup.

`embedding`

— Method`embedding(G::SemidirectProductGroup, n::Int)`

Return the embedding of the `n`

-th component of `G`

into `G`

, for `n`

= 1,2. It is not defined for proper subgroups of semidirect products.

`projection`

— Method`projection(G::SemidirectProductGroup)`

Return the projection of `G`

into the second component of `G`

.

## Wreath products

`WreathProductGroup`

— Type`WreathProductGroup`

Wreath product of a group `G`

and a group of permutations `H`

, or a generic group `H`

together with the homomorphism `a`

from `H`

to a permutation group.

`wreath_product`

— Method```
wreath_product(G::T, H::S, a::GAPGroupHomomorphism{S,PermGroup})
wreath_product(G::T, H::PermGroup) where T<: Group
```

Return the wreath product of the group `G`

and the group `H`

, where `H`

acts on `n`

copies of `G`

through the homomorphism `a`

from `H`

to a permutation group, and `n`

is the number of moved points of `Image(a)`

.

If `a`

is not specified, then `H`

must be a group of permutations. In this case, `n`

is NOT the number of moved points, but the degree of `H`

.

If `W`

is a wreath product of `G`

and `H`

, {`g_1`

, ..., `g_n`

} are elements of `G`

and `h`

in `H`

, the element `(g_1, ..., h)`

of `W`

can be obtained by typing

` W(g_1,...,g_n, h).`

**Examples**

```
julia> G = cyclic_group(3)
Pc group of order 3
julia> H = symmetric_group(2)
Permutation group of degree 2 and order 2
julia> W = wreath_product(G,H)
<group of size 18 with 2 generators>
julia> a = gen(W,1)
WreathProductElement(f1,<identity> of ...,())
julia> b = gen(W,2)
WreathProductElement(<identity> of ...,<identity> of ...,(1,2))
julia> a*b
WreathProductElement(f1,<identity> of ...,(1,2))
```

`normal_subgroup`

— Method`normal_subgroup(W::WreathProductGroup)`

Return `G`

, where `W`

is the wreath product of `G`

and `H`

.

**Examples**

```
julia> G = cyclic_group(3)
Pc group of order 3
julia> H = symmetric_group(2)
Permutation group of degree 2 and order 2
julia> W = wreath_product(G,H)
<group of size 18 with 2 generators>
julia> normal_subgroup(W)
Pc group of order 3
```

`acting_subgroup`

— Method`acting_subgroup(W::WreathProductGroup)`

Return `H`

, where `W`

is the wreath product of `G`

and `H`

.

**Examples**

```
julia> G = cyclic_group(3)
Pc group of order 3
julia> H = symmetric_group(2)
Permutation group of degree 2 and order 2
julia> W = wreath_product(G,H)
<group of size 18 with 2 generators>
julia> acting_subgroup(W)
Permutation group of degree 2 and order 2
```

`homomorphism_of_wreath_product`

— Method`homomorphism_of_wreath_product(G::WreathProductGroup)`

If `W`

is the wreath product of `G`

and `H`

, then return the homomorphism `f`

from `H`

to `Sym(n)`

, where `n`

is the number of copies of `G`

.

`is_full_wreath_product`

— Method`is_full_wreath_product(G::WreathProductGroup)`

Return whether `G`

is a wreath product of two groups, instead of a proper subgroup.

`projection`

— Method`projection(G::WreathProductGroup)`

Return the projection of `wreath_product(G,H)`

onto the permutation group `H`

.

`embedding`

— Method`embedding(G::WreathProductGroup, n::Int)`

Return the embedding of the `n`

-th component of `G`

into `G`

.