comch.symmetric: Symmetric Groups and Rings

comch.symmetric.SymmetricGroupElement(iterable)

Element in a finite symmetric group.

comch.symmetric.SymmetricRingElement([data, ...])

Element in the group ring of finite symmetric groups.

comch.symmetric.SymmetricRing()

Produces symmetric ring elements of interest.

class comch.symmetric.SymmetricGroupElement(iterable)[source]

Element in a finite symmetric group.

We refer to elements in the group of permutations of \(r\) elements \(\mathrm S_r\) as symmetric group elements of arity \(r\). An element \(\pi \in \mathrm S_r\) can be thought of as a bijection from \(\{1,\dots,r\}\) to itself, and can be represented by the tuple of its images \((\pi(1), \dots, \pi(r))\).

__init__(iterable)[source]

Initializes self.

Parameters:

interable (:class:'iterable') – Used to create a tuple representing a permutation of (1,…,r) for some r.

Example

>>> print(SymmetricGroupElement((1,3,2)))
(1,3,2)
property sign

Sign of self.

The sign is defined as the mod 2 number of transpositions required to express the element.

Returns:

The sign of self.

Return type:

class: int

Example

>>> SymmetricGroupElement((5,2,4,3,1)).sign
1
to_cycles(singletons=False)[source]

Collection of cycles representing self.

Parameters:

singletons (bool) – Show cycles of length 1.

Returns:

The representation of self as a product of cycles.

Return type:

class: list of tuple

Example

>>> SymmetricGroupElement((5,2,4,3,1)).to_cycles()
[(1, 5), (3, 4)]
property arity

Arity of self

The arity of a symmetric group element is defined as the cardinality of its domain.

Returns:

The arity of self.

Return type:

class: ‘int’

Example

>>> SymmetricGroupElement((5,2,4,3,1)).arity
5
__mul__(other)[source]

Product: self * other.

This product agrees with the composition of bijections: self \(\circ\) other.

Returns:

The product of self and other.

Return type:

class: comch.symmetric.SymmetricGroupElement object

Example

>>> x = SymmetricGroupElement((1,3,2))
>>> y = SymmetricGroupElement((2,3,1))
>>> print(y * x)
(2,1,3)
inverse()[source]

Multiplicative inverse: self\(^{-1}\).

Returns:

The multiplicative inverse of self.

Return type:

class: comch.symmetric.SymmetricGroupElement object

Examples

>>> pi = SymmetricGroupElement((2,3,1))
>>> print(pi.inverse())
(3,1,2)
__pow__(times)[source]

Iterated product of self: self * … * self.

Returns:

The product of self with itself times number of times.

Return type:

class: comch.symmetric.SymmetricGroupElement object

Example

>>> x = SymmetricGroupElement((2,3,4,5,1))
>>> print(x**5)
(1,2,3,4,5)
compose(other, position)[source]

Operadic compositions: self \(\circ_{position}\) other.

The (operadic) composition of symmetric elements is defined as follows: Given \(\pi \in \Sigma_r\), \(\tau \in \Sigma_{s}\) and \(i \in \{1, \dots, r\}\) produces a permutation in \(\Sigma_{r + s - 1}\). We begin by considering \(\{1, 2, \dots, r + s - 1\}\) as an ordered set \(R\) with \(r\) elements by grouping the subset \(S = \{i, \dots, i+s-1\}\) into a single element, then applying \(\pi\) to \(R\) and \(\sigma\) to the \(S\), and, finally, forgetting the grouping. More precisely, for integers \(r, s \geq 1\) and \(i \in \{1, \ldots, r\}\) the partial composition is the linear map

\[\circ_i : \Sigma_r \otimes \Sigma_s \to \Sigma_{r+s-1}\]

is defined for \(\pi = (\pi(1), \dots, \pi(r))\) and \(\sigma = (\sigma(1), \dots, \sigma(s))\) to be the sequence obtained by replacing in position \(i\) of the sequence \(\pi\) the sequence obtained by adding \(i-1\) to the entries of \(s\) and adding \(s-1\) to the entries of \(\pi\) that whose value is greater than \(i\).

Returns:

The composition of self and other.

Return type:

class: comch.symmetric.SymmetricGroupElement object

Example

>>> x = SymmetricGroupElement((1,3,2))
>>> y = SymmetricGroupElement((2,1))
>>> print(x.compose(y, 1))
(2,1,4,3)
class comch.symmetric.SymmetricRingElement(data=None, torsion=None)[source]

Element in the group ring of finite symmetric groups.

Let \(R\) be a ring and \(\Gamma\) a group. The free \(R\)-module generated by \(\Gamma\) is a ring with product defined by linearly extending the group product, i.e.,

\[\left( \sum_i r_ia_i \right) \left( \sum_j s_jb_j \right) = \sum_{i,j} (r_is_j)(a_ib_{j}).\]

Elements in the group rings \(\mathbb Z[\mathrm S_r]\) or \(\mathbb Z/n\mathbb Z[\mathrm S_r]\) are referred to as symmetric ring elements.

Parameters:
  • data (int or None, default: None) – Dictionary representing a linear combination of basis elements. Items in the dictionary correspond to basis_element: coefficient pairs. Each basis_element must create a SymmetricGroupElement and coefficient must be an int.

  • torsion (int) – The non-neg int \(n\) of the ring \(\mathbb Z/n \mathbb Z\).

torsion

The non-neg int \(n\) of the ring \(\mathbb Z/n \mathbb Z\).

Type:

int

Example

>>> print(SymmetricGroupElement((1,3,2)))
(1,3,2)
__init__(data=None, torsion=None)[source]

Initializes self.

Parameters:
  • data (dict) – Dictionary representing a linear combination of basis elements. Items in the dict correspond to pairs (basis_element: coefficient).

  • torsion (int) – The non-neg int \(n\) of the ring \(\mathbb Z/n \mathbb Z\).

Example

>>> print(FreeModuleElement())
0
>>> print(FreeModuleElement({'a': 1, 'b': -1, 'c': 0}))
a - b
property arity

Return the arity of self if homogeneous and None otherwise.

self is said to be homogeneous if all basis elements belong to the same arity.

Returns:

The arity of self if homogeneous or None else

Return type:

None or comch.free_module.FreeModuleElement object

Example

>>> SymmetricRingElement({(5,2,4,3,1): 1}).arity
5
>>> SymmetricRingElement({(2,3,1): 1, (1,2): 1}).arity
__mul__(other)[source]

Linear product in the symmetric group ring: self * other.

Parameters:

other (comch.symmetric.SymmetricRingElement object or comch.symmetric.SymmetricGroupElement object or int) – The element to multiply with self.

Returns:

The product of self and other.

Return type:

comch.symmetric.SymmetricRingElement object

Examples

>>> p = SymmetricRingElement({(4,3,2,1): 1, (1,2,3,4): 2})
>>> print(3 * p)
3(4,3,2,1) + 6(1,2,3,4)
>>> q = SymmetricRingElement({(4,1,2,3): 1})
>>> print(p * q)
(1,4,3,2) + 2(4,1,2,3)
__pow__(times)[source]

Iterated product of self: self * … * self.

Returns:

The iterated product of self.

Return type:

comch.symmetric.SymmetricRingElement object

Examples

>>> p = SymmetricRingElement({(4,3,2,1): 1, (1,2,3,4): 2})
>>> p ** 2
SymmetricRingElement({(1, 2, 3, 4): 3})
compose(other, position)[source]

Linear operadic compositions: self \(\circ_{position}\) other.

The operadic composition is defined by extending linearly the operadic composition of symmetric group elements.

Parameters:
Returns:

The composition of self and other at position.

Return type:

comch.symmetric.SymmetricRingElement object

Examples

>>> x = SymmetricRingElement({(2,3,1): 1, (1,2,3): -1})
>>> y = SymmetricRingElement({(2,1): 1, (1,2): 1})
>>> print(x.compose(y, 2))
(3,2,4,1) + (2,3,4,1) - (1,3,2,4) - (1,2,3,4)
class comch.symmetric.SymmetricRing[source]

Produces symmetric ring elements of interest.

static identity_element(arity, torsion=None)[source]

The identity \(\mathrm{id}\) in \(\mathrm S_r\).

Parameters:
  • arity (int positive) – The arity of \(\mathrm S_r\), i.e., \(r\)

  • torsion (int positive) – The non-neg int \(n\) of the ring \(\mathbb Z/n \mathbb Z\).

Returns:

The identity element (1,…,r).

Return type:

comch.symmetric.SymmetricRingElement object

Examples

>>> print(SymmetricRing.identity_element(3))
(1,2,3)
static rotation_element(arity, torsion=None)[source]

The element \(\rho\).

Defined as the preferred generator of the cyclic subgroup of order \(r\) in \(\mathrm S_r\). Explicitely,

\[\begin{split}\rho(i) = \begin{cases} i+1 & i < r, \\ 1 & i = r. \end{cases}\end{split}\]
Parameters:
  • arity (int positive) – The arity of \(\mathrm S_r\), i.e., \(r\)

  • torsion (int positive) – The non-neg int \(n\) of the ring \(\mathbb Z/n \mathbb Z\).

Returns:

The rotation element (2,3,…,r-1).

Return type:

comch.symmetric.SymmetricRingElement object

Examples

>>> print(SymmetricRing.rotation_element(3))
(2,3,1)
static transposition_element(arity, torsion=None)[source]

The element \(\rho - \mathrm{id}\).

Parameters:
  • arity (int positive) – The arity of \(\mathrm S_r\), i.e., \(r\)

  • torsion (int positive) – The non-neg int \(n\) of the ring \(\mathbb Z/n \mathbb Z\).

Returns:

The transposition element \(\rho - \mathrm{id}\).

Return type:

comch.symmetric.SymmetricRingElement object

Examples

>>> print(SymmetricRing.transposition_element(3))
(2,3,1) - (1,2,3)
static norm_element(arity, torsion=None)[source]

The element \(\mathrm{id} + \rho + \cdots + \rho^{r-1}\).

Parameters:
  • arity (int positive) – The arity of \(\mathrm S_r\), i.e., \(r\)

  • torsion (int positive) – The non-neg int \(n\) of the ring \(\mathbb Z/n \mathbb Z\).

Returns:

The norm element \(\mathrm{id} + \rho + \cdots + \rho^{r-1}\).

Return type:

comch.symmetric.SymmetricRingElement object

Examples

>>> print(SymmetricRing.norm_element(3))
(1,2,3) + (2,3,1) + (3,1,2)