2017-06-22 15:04:51 +02:00
|
|
|
|
export WreathProduct, WreathProductElem
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
#
|
|
|
|
|
# WreathProduct / WreathProductElem
|
|
|
|
|
#
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
doc"""
|
2018-07-30 14:03:51 +02:00
|
|
|
|
WreathProduct(N, P) <: Group
|
|
|
|
|
> Implements Wreath product of a group `N` by permutation group $P = S_n$,
|
2017-06-22 14:21:25 +02:00
|
|
|
|
> usually written as $N \wr P$.
|
|
|
|
|
> The multiplication inside wreath product is defined as
|
2018-07-30 14:03:51 +02:00
|
|
|
|
> > `(n, σ) * (m, τ) = (n*σ(m), στ)`
|
|
|
|
|
> where `σ(m)` denotes the action (from the right) of the permutation group on
|
|
|
|
|
> `n-tuples` of elements from `N`
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
|
|
|
|
# Arguments:
|
2018-07-30 14:03:51 +02:00
|
|
|
|
* `N::Group` : the single factor of group $N$
|
|
|
|
|
* `P::Generic.PermGroup` : full `PermutationGroup`
|
2017-06-22 14:21:25 +02:00
|
|
|
|
"""
|
2018-04-10 13:09:50 +02:00
|
|
|
|
struct WreathProduct{T<:Group, I<:Integer} <: Group
|
2017-07-21 13:33:40 +02:00
|
|
|
|
N::DirectProductGroup{T}
|
2018-04-10 13:09:50 +02:00
|
|
|
|
P::Generic.PermGroup{I}
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
2018-04-10 13:09:50 +02:00
|
|
|
|
function WreathProduct{T, I}(Gr::T, P::Generic.PermGroup{I}) where {T, I}
|
|
|
|
|
N = DirectProductGroup(Gr, Int(P.n))
|
2017-06-22 14:21:25 +02:00
|
|
|
|
return new(N, P)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2018-04-10 13:09:50 +02:00
|
|
|
|
struct WreathProductElem{T<:GroupElem, I<:Integer} <: GroupElem
|
2017-07-21 13:33:40 +02:00
|
|
|
|
n::DirectProductGroupElem{T}
|
2018-04-10 13:09:50 +02:00
|
|
|
|
p::Generic.perm{I}
|
2017-07-21 13:33:40 +02:00
|
|
|
|
# parent::WreathProduct
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
2018-04-10 13:09:50 +02:00
|
|
|
|
function WreathProductElem{T, I}(n::DirectProductGroupElem{T}, p::Generic.perm{I},
|
|
|
|
|
check::Bool=true) where {T, I}
|
2017-07-21 16:00:19 +02:00
|
|
|
|
if check
|
2018-08-01 22:39:43 +02:00
|
|
|
|
length(n.elts) == length(p.d) || throw(DomainError(
|
2018-07-30 14:59:11 +02:00
|
|
|
|
"Can't form WreathProductElem: lengths differ"))
|
2017-07-21 16:00:19 +02:00
|
|
|
|
end
|
2018-04-10 13:09:50 +02:00
|
|
|
|
return new(n, p)
|
2017-06-22 14:21:25 +02:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
#
|
|
|
|
|
# Type and parent object methods
|
|
|
|
|
#
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
2018-07-30 14:07:42 +02:00
|
|
|
|
elem_type(::Type{WreathProduct{T, I}}) where {T, I} = WreathProductElem{elem_type(T), I}
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
2018-04-10 13:09:50 +02:00
|
|
|
|
parent_type(::Type{WreathProductElem{T, I}}) where {T, I} =
|
|
|
|
|
WreathProduct{parent_type(T), I}
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
2017-07-21 13:36:39 +02:00
|
|
|
|
parent(g::WreathProductElem) = WreathProduct(parent(g.n[1]), parent(g.p))
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
#
|
|
|
|
|
# WreathProduct / WreathProductElem constructors
|
|
|
|
|
#
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
2018-04-10 13:09:50 +02:00
|
|
|
|
WreathProduct(G::T, P::Generic.PermGroup{I}) where {T, I} = WreathProduct{T, I}(G, P)
|
2017-07-21 13:40:54 +02:00
|
|
|
|
|
2018-07-30 14:03:51 +02:00
|
|
|
|
WreathProduct(G::T, P::Generic.PermGroup{I}) where {T<:AbstractAlgebra.Ring, I} = WreathProduct(AddGrp(G), P)
|
|
|
|
|
|
|
|
|
|
WreathProductElem(n::DirectProductGroupElem{T}, p::Generic.perm{I}, check=true) where {T,I} = WreathProductElem{T,I}(n, p, check)
|
|
|
|
|
|
|
|
|
|
WreathProductElem(n::DirectProductGroupElem{T}, p::Generic.perm{I}, check=true) where {T<:AbstractAlgebra.RingElem, I} = WreathProductElem(DirectProductGroupElem(AddGrpElem.(n.elts)), p, check)
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
#
|
|
|
|
|
# Parent object call overloads
|
|
|
|
|
#
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
function (G::WreathProduct)(g::WreathProductElem)
|
2017-07-21 13:37:28 +02:00
|
|
|
|
n = try
|
2017-06-22 14:21:25 +02:00
|
|
|
|
G.N(g.n)
|
|
|
|
|
catch
|
2018-07-30 14:59:11 +02:00
|
|
|
|
throw(DomainError("Can't coerce $(g.n) to $(G.N) factor of $G"))
|
2017-06-22 14:21:25 +02:00
|
|
|
|
end
|
2017-07-21 13:37:28 +02:00
|
|
|
|
p = try
|
2017-06-22 14:21:25 +02:00
|
|
|
|
G.P(g.p)
|
|
|
|
|
catch
|
2018-07-30 14:59:11 +02:00
|
|
|
|
throw(DomainError("Can't coerce $(g.p) to $(G.P) factor of $G"))
|
2017-06-22 14:21:25 +02:00
|
|
|
|
end
|
2017-07-21 16:02:07 +02:00
|
|
|
|
return WreathProductElem(n, p)
|
2017-06-22 14:21:25 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
doc"""
|
2017-09-15 18:54:32 +02:00
|
|
|
|
(G::WreathProduct)(n::DirectProductGroupElem, p::Generic.perm)
|
2017-06-22 14:21:25 +02:00
|
|
|
|
> Creates an element of wreath product `G` by coercing `n` and `p` to `G.N` and
|
|
|
|
|
> `G.P`, respectively.
|
|
|
|
|
"""
|
2017-09-15 18:54:32 +02:00
|
|
|
|
(G::WreathProduct)(n::DirectProductGroupElem, p::Generic.perm) = WreathProductElem(n,p)
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
2017-07-21 16:00:19 +02:00
|
|
|
|
(G::WreathProduct)() = WreathProductElem(G.N(), G.P(), false)
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
|
|
|
|
doc"""
|
2017-09-15 18:54:32 +02:00
|
|
|
|
(G::WreathProduct)(p::Generic.perm)
|
2017-06-22 14:21:25 +02:00
|
|
|
|
> Returns the image of permutation `p` in `G` via embedding `p -> (id,p)`.
|
|
|
|
|
"""
|
2017-09-15 18:54:32 +02:00
|
|
|
|
(G::WreathProduct)(p::Generic.perm) = G(G.N(), p)
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
|
|
|
|
doc"""
|
|
|
|
|
(G::WreathProduct)(n::DirectProductGroupElem)
|
|
|
|
|
> Returns the image of `n` in `G` via embedding `n -> (n,())`. This is the
|
|
|
|
|
> embedding that makes sequence `1 -> N -> G -> P -> 1` exact.
|
|
|
|
|
"""
|
|
|
|
|
(G::WreathProduct)(n::DirectProductGroupElem) = G(n, G.P())
|
|
|
|
|
|
2018-07-30 15:01:20 +02:00
|
|
|
|
(G::WreathProduct)(n,p) = G(G.N(n), G.P(p))
|
|
|
|
|
|
2017-06-22 14:21:25 +02:00
|
|
|
|
###############################################################################
|
|
|
|
|
#
|
|
|
|
|
# Basic manipulation
|
|
|
|
|
#
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
function hash(G::WreathProduct, h::UInt)
|
|
|
|
|
return hash(G.N, hash(G.P, hash(WreathProduct, h)))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function hash(g::WreathProductElem, h::UInt)
|
2017-07-21 16:03:26 +02:00
|
|
|
|
return hash(g.n, hash(g.p, hash(WreathProductElem, h)))
|
2017-06-22 14:21:25 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
#
|
|
|
|
|
# String I/O
|
|
|
|
|
#
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
function show(io::IO, G::WreathProduct)
|
2017-07-21 14:31:05 +02:00
|
|
|
|
print(io, "Wreath Product of $(G.N.group) by $(G.P)")
|
2017-06-22 14:21:25 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function show(io::IO, g::WreathProductElem)
|
|
|
|
|
print(io, "($(g.n)≀$(g.p))")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
#
|
|
|
|
|
# Comparison
|
|
|
|
|
#
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
function (==)(G::WreathProduct, H::WreathProduct)
|
|
|
|
|
G.N == H.N || return false
|
|
|
|
|
G.P == H.P || return false
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function (==)(g::WreathProductElem, h::WreathProductElem)
|
|
|
|
|
g.n == h.n || return false
|
|
|
|
|
g.p == h.p || return false
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
#
|
2017-07-21 14:33:53 +02:00
|
|
|
|
# Group operations
|
2017-06-22 14:21:25 +02:00
|
|
|
|
#
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
2018-07-30 13:54:15 +02:00
|
|
|
|
(p::perm)(n::DirectProductGroupElem) = DirectProductGroupElem(n.elts[p.d])
|
|
|
|
|
|
2017-06-22 14:21:25 +02:00
|
|
|
|
doc"""
|
|
|
|
|
*(g::WreathProductElem, h::WreathProductElem)
|
|
|
|
|
> Return the wreath product group operation of elements, i.e.
|
|
|
|
|
>
|
2017-07-21 16:05:49 +02:00
|
|
|
|
> `g*h = (g.n*g.p(h.n), g.p*h.p)`,
|
2017-06-22 14:21:25 +02:00
|
|
|
|
>
|
2017-09-15 18:54:32 +02:00
|
|
|
|
> where `g.p(h.n)` denotes the action of `g.p::Generic.perm` on
|
2017-06-22 14:21:25 +02:00
|
|
|
|
> `h.n::DirectProductGroupElem` via standard permutation of coordinates.
|
|
|
|
|
"""
|
2017-07-21 15:59:47 +02:00
|
|
|
|
function *(g::WreathProductElem, h::WreathProductElem)
|
2018-07-30 13:54:15 +02:00
|
|
|
|
return WreathProductElem(g.n*g.p(h.n), g.p*h.p, false)
|
2017-07-21 15:59:47 +02:00
|
|
|
|
end
|
2017-06-22 14:21:25 +02:00
|
|
|
|
|
|
|
|
|
doc"""
|
|
|
|
|
inv(g::WreathProductElem)
|
|
|
|
|
> Returns the inverse of element of a wreath product, according to the formula
|
2017-07-21 16:02:44 +02:00
|
|
|
|
> `g^-1 = (g.n, g.p)^-1 = (g.p^-1(g.n^-1), g.p^-1)`.
|
2017-06-22 14:21:25 +02:00
|
|
|
|
"""
|
|
|
|
|
function inv(g::WreathProductElem)
|
2018-07-30 13:54:15 +02:00
|
|
|
|
pinv = inv(g.p)
|
|
|
|
|
return WreathProductElem(pinv(inv(g.n)), pinv, false)
|
2017-06-22 14:21:25 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
#
|
|
|
|
|
# Misc
|
|
|
|
|
#
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
matrix_repr(g::WreathProductElem) = Any[matrix_repr(g.p) g.n]
|
|
|
|
|
|
|
|
|
|
function elements(G::WreathProduct)
|
2018-08-08 14:12:55 +02:00
|
|
|
|
Nelts = collect(elements(G.N))
|
|
|
|
|
Pelts = collect(elements(G.P))
|
|
|
|
|
return (WreathProductElem(n, p, false) for n in Nelts, p in Pelts)
|
2017-06-22 14:21:25 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
order(G::WreathProduct) = order(G.P)*order(G.N)
|