Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Bib Ind
[Top of Book] [Contents] [Previous Chapter] [Next Chapter]

[MathJax on]

35 Magmas
35.1 Magma Categories
35.1-1 IsMagma
35.1-2 IsMagmaWithOne
35.1-3 IsMagmaWithInversesIfNonzero
35.1-4 IsMagmaWithInverses
35.2 Magma Generation
35.2-1 Magma
35.2-2 MagmaWithOne
35.2-3 MagmaWithInverses
35.2-4 MagmaByGenerators
35.2-5 MagmaWithOneByGenerators
35.2-6 MagmaWithInversesByGenerators
35.2-7 Submagma
35.2-8 SubmagmaWithOne
35.2-9 SubmagmaWithInverses
35.2-10 AsMagma
35.2-11 AsSubmagma
35.2-12 IsMagmaWithZeroAdjoined
35.2-13 InjectionZeroMagma
35.2-14 UnderlyingInjectionZeroMagma
35.3 Magmas Defined by Multiplication Tables
35.3-1 MagmaByMultiplicationTable
35.3-2 MagmaWithOneByMultiplicationTable
35.3-3 MagmaWithInversesByMultiplicationTable
35.3-4 MagmaElement
35.3-5 MultiplicationTable
35.4 Attributes and Properties for Magmas
35.4-1 GeneratorsOfMagma
35.4-2 GeneratorsOfMagmaWithOne
35.4-3 GeneratorsOfMagmaWithInverses
35.4-4 Centralizer
35.4-5 Centre
35.4-6 Idempotents
35.4-7 IsAssociative
35.4-8 IsCentral
35.4-9 IsCommutative
35.4-10 MultiplicativeNeutralElement
35.4-11 MultiplicativeZero
35.4-12 SquareRoots
35.4-13 TrivialSubmagmaWithOne

### 35 Magmas

This chapter deals with domains (see 31) that are closed under multiplication `*`. Following [Bou70], we call them magmas in GAP. Together with the domains closed under addition `+` (see 55), they are the basic algebraic structures; every semigroup, monoid (see 51), group (see 39), ring (see 56), or field (see 58) is a magma. In the cases of a magma-with-one or magma-with-inverses, additional multiplicative structure is present, see 35.1. For functions to create free magmas, see 36.4.

#### 35.1 Magma Categories

##### 35.1-1 IsMagma

`‣ IsMagma`( obj ) | ( category )

A magma in GAP is a domain M with (not necessarily associative) multiplication `*`: M × M → M.

##### 35.1-2 IsMagmaWithOne

`‣ IsMagmaWithOne`( obj ) | ( category )

A magma-with-one in GAP is a magma M with an operation `^0` (or `One` (31.10-2)) that yields the identity of M.

So a magma-with-one M does always contain a unique multiplicatively neutral element e, i.e., e`*` m = m = m`*` e holds for all m ∈ M (see `MultiplicativeNeutralElement` (35.4-10)). This element e can be computed with the operation `One` (31.10-2) as `One(` M`)`, and e is also equal to `One(` m`)` and to m`^0` for each element m ∈ M.

Note that a magma may contain a multiplicatively neutral element but not an identity (see `One` (31.10-2)), and a magma containing an identity may not lie in the category `IsMagmaWithOne` (see Section 31.6).

##### 35.1-3 IsMagmaWithInversesIfNonzero

`‣ IsMagmaWithInversesIfNonzero`( obj ) | ( category )

An object in this GAP category is a magma-with-one M with an operation `^-1`: M ∖ Z → M ∖ Z that maps each element m of M ∖ Z to its inverse m`^-1` (or `Inverse(` m`)`, see `Inverse` (31.10-8)), where Z is either empty or consists exactly of one element of M.

This category was introduced mainly to describe division rings, since the nonzero elements in a division ring form a group; So an object M in `IsMagmaWithInversesIfNonzero` will usually have both a multiplicative and an additive structure (see 55), and the set Z, if it is nonempty, contains exactly the zero element (see `Zero` (31.10-3)) of M.

##### 35.1-4 IsMagmaWithInverses

`‣ IsMagmaWithInverses`( obj ) | ( category )

A magma-with-inverses in GAP is a magma-with-one M with an operation `^-1`: M → M that maps each element m of M to its inverse m`^-1` (or `Inverse(` m`)`, see `Inverse` (31.10-8)).

Note that not every trivial magma is a magma-with-one, but every trivial magma-with-one is a magma-with-inverses. This holds also if the identity of the magma-with-one is a zero element. So a magma-with-inverses-if-nonzero can be a magma-with-inverses if either it contains no zero element or consists of a zero element that has itself as zero-th power.

#### 35.2 Magma Generation

This section describes functions that create magmas from generators (see `Magma` (35.2-1), `MagmaWithOne` (35.2-2), `MagmaWithInverses` (35.2-3)), the underlying operations for which methods can be installed (see `MagmaByGenerators` (35.2-4), `MagmaWithOneByGenerators` (35.2-5), `MagmaWithInversesByGenerators` (35.2-6)), functions for forming submagmas (see `Submagma` (35.2-7), `SubmagmaWithOne` (35.2-8), `SubmagmaWithInverses` (35.2-9)), and functions that form a magma equal to a given collection (see `AsMagma` (35.2-10), `AsSubmagma` (35.2-11)).

`InjectionZeroMagma` (35.2-13) creates a new magma which is the original magma with a zero adjoined.

##### 35.2-1 Magma

`‣ Magma`( [Fam, ]gens ) | ( function )

returns the magma M that is generated by the elements in the list gens, that is, the closure of gens under multiplication `\*` (31.12-1). The family Fam of M can be entered as the first argument; this is obligatory if gens is empty (and hence also M is empty).

##### 35.2-2 MagmaWithOne

`‣ MagmaWithOne`( [Fam, ]gens ) | ( function )

returns the magma-with-one M that is generated by the elements in the list gens, that is, the closure of gens under multiplication `\*` (31.12-1) and `One` (31.10-2). The family Fam of M can be entered as first argument; this is obligatory if gens is empty (and hence M is trivial).

##### 35.2-3 MagmaWithInverses

`‣ MagmaWithInverses`( [Fam, ]gens ) | ( function )

returns the magma-with-inverses M that is generated by the elements in the list gens, that is, the closure of gens under multiplication `\*` (31.12-1), `One` (31.10-2), and `Inverse` (31.10-8). The family Fam of M can be entered as first argument; this is obligatory if gens is empty (and hence M is trivial).

##### 35.2-4 MagmaByGenerators

`‣ MagmaByGenerators`( [Fam, ]gens ) | ( operation )

An underlying operation for `Magma` (35.2-1).

##### 35.2-5 MagmaWithOneByGenerators

`‣ MagmaWithOneByGenerators`( [Fam, ]gens ) | ( operation )

An underlying operation for `MagmaWithOne` (35.2-2).

##### 35.2-6 MagmaWithInversesByGenerators

`‣ MagmaWithInversesByGenerators`( [Fam, ]gens ) | ( operation )

An underlying operation for `MagmaWithInverses` (35.2-3).

##### 35.2-7 Submagma

`‣ Submagma`( D, gens ) | ( function )

`‣ SubmagmaNC`( D, gens ) | ( function )

`Submagma` returns the magma generated by the elements in the list gens, with parent the domain D. `SubmagmaNC` does the same, except that it is not checked whether the elements of gens lie in D.

##### 35.2-8 SubmagmaWithOne

`‣ SubmagmaWithOne`( D, gens ) | ( function )

`‣ SubmagmaWithOneNC`( D, gens ) | ( function )

`SubmagmaWithOne` returns the magma-with-one generated by the elements in the list gens, with parent the domain D. `SubmagmaWithOneNC` does the same, except that it is not checked whether the elements of gens lie in D.

##### 35.2-9 SubmagmaWithInverses

`‣ SubmagmaWithInverses`( D, gens ) | ( function )

`‣ SubmagmaWithInversesNC`( D, gens ) | ( function )

`SubmagmaWithInverses` returns the magma-with-inverses generated by the elements in the list gens, with parent the domain D. `SubmagmaWithInversesNC` does the same, except that it is not checked whether the elements of gens lie in D.

##### 35.2-10 AsMagma

`‣ AsMagma`( C ) | ( attribute )

For a collection C whose elements form a magma, `AsMagma` returns this magma. Otherwise `fail` is returned.

##### 35.2-11 AsSubmagma

`‣ AsSubmagma`( D, C ) | ( operation )

Let D be a domain and C a collection. If C is a subset of D that forms a magma then `AsSubmagma` returns this magma, with parent D. Otherwise `fail` is returned.

##### 35.2-12 IsMagmaWithZeroAdjoined

`‣ IsMagmaWithZeroAdjoined`( M ) | ( category )

Returns: `true` or `false`.

`IsMagmaWithZeroAdjoined` returns `true` if the magma M was created using `InjectionZeroMagma` (35.2-13) or `MagmaWithZeroAdjoined` (35.2-13) and returns `false` if it was not.

    gap> S:=Semigroup(Transformation([1,1,1]), Transformation([1,3,2]));;
    gap> IsMagmaWithZeroAdjoined(S);
    false
    gap> M:=MagmaWithZeroAdjoined(S);
    <<transformation semigroup of degree 3 with 2 generators>
      with 0 adjoined>
    gap> IsMagmaWithZeroAdjoined(M);
    true

##### 35.2-13 InjectionZeroMagma

`‣ InjectionZeroMagma`( M ) | ( attribute )

`‣ MagmaWithZeroAdjoined`( M ) | ( attribute )

`InjectionZeroMagma` returns an embedding from the magma M into a new magma formed from M by adjoining a single new element which is the multiplicative zero of the resulting magma. The elements of the new magma form a family of elements in the category `IsMultiplicativeElementWithZero` (31.14-12) and the magma itself satisfies `IsMagmaWithZeroAdjoined` (35.2-12).

`MagmaWithZeroAdjoined` is just shorthand for `Range(InjectionZeroMagma(M)))`.

If `N` is a magma with zero adjoined, then the embedding used to create `N` can be recovered using `UnderlyingInjectionZeroMagma` (35.2-14).

    gap> S:=Monoid(Transformation( [ 7, 7, 5, 3, 1, 3, 7 ] ),
    > Transformation( [ 5, 1, 4, 1, 4, 4, 7 ] ));;
    gap> MultiplicativeZero(S);
    Transformation( [ 7, 7, 7, 7, 7, 7, 7 ] )
    gap> T:=MagmaWithZeroAdjoined(S);
    <<transformation monoid of degree 7 with 2 generators>
      with 0 adjoined>
    gap> map:=UnderlyingInjectionZeroMagma(T);;
    gap> x:=Transformation( [ 7, 7, 7, 3, 7, 3, 7 ] );;
    gap> x^map;
    <monoid with 0 adjoined elt: Transformation( [ 7, 7, 7, 3, 7, 3, 7 ]
     )>
    gap> PreImage(map, x^map)=x;
    true

##### 35.2-14 UnderlyingInjectionZeroMagma

`‣ UnderlyingInjectionZeroMagma`( M ) | ( attribute )

`UnderlyingInjectionZeroMagma` returns the embedding used to create the magma with zero adjoined M.

    gap> S:=Monoid(Transformation( [ 8, 7, 5, 3, 1, 3, 8, 8 ] ),
    > Transformation( [ 5, 1, 4, 1, 4, 4, 7, 8 ] ));;
    gap> MultiplicativeZero(S);
    Transformation( [ 8, 8, 8, 8, 8, 8, 8, 8 ] )
    gap> T:=MagmaWithZeroAdjoined(S);
    <<transformation monoid of degree 8 with 2 generators>
      with 0 adjoined>
    gap> UnderlyingInjectionZeroMagma(T);
    MappingByFunction( <transformation monoid of degree 8 with 2
     generators>, <<transformation monoid of degree 8 with 2 generators>
      with 0 adjoined>, function( elt ) ... end, function( x ) ... end )

#### 35.3 Magmas Defined by Multiplication Tables

The most elementary (but of course usually not recommended) way to implement a magma with only few elements is via a multiplication table.

##### 35.3-1 MagmaByMultiplicationTable

`‣ MagmaByMultiplicationTable`( A ) | ( function )

For a square matrix A with n rows such that all entries of A are in the range [ 1 .. n ], `MagmaByMultiplicationTable` returns a magma M with multiplication `*` defined by A. That is, M consists of the elements m_1, m_2, ..., m_n, and m_i * m_j = m_k, with k = A[i][j].

The ordering of elements is defined by m_1 < m_2 < ⋯ < m_n, so m_i can be accessed as `MagmaElement( M, i )`, see `MagmaElement` (35.3-4).

    gap> MagmaByMultiplicationTable([[1,2,3],[2,3,1],[1,1,1]]);
    <magma with 3 generators>

##### 35.3-2 MagmaWithOneByMultiplicationTable

`‣ MagmaWithOneByMultiplicationTable`( A ) | ( function )

The only differences between `MagmaByMultiplicationTable` (35.3-1) and `MagmaWithOneByMultiplicationTable` are that the latter returns a magma-with-one (see `MagmaWithOne` (35.2-2)) if the magma described by the matrix A has an identity, and returns `fail` if not.

    gap> MagmaWithOneByMultiplicationTable([[1,2,3],[2,3,1],[3,1,1]]);
    <magma-with-one with 3 generators>
    gap> MagmaWithOneByMultiplicationTable([[1,2,3],[2,3,1],[1,1,1]]);
    fail

##### 35.3-3 MagmaWithInversesByMultiplicationTable

`‣ MagmaWithInversesByMultiplicationTable`( A ) | ( function )

`MagmaByMultiplicationTable` (35.3-1) and `MagmaWithInversesByMultiplicationTable` differ only in that the latter returns magma-with-inverses (see `MagmaWithInverses` (35.2-3)) if each element in the magma described by the matrix A has an inverse, and returns `fail` if not.

    gap> MagmaWithInversesByMultiplicationTable([[1,2,3],[2,3,1],[3,1,2]]);
    <magma-with-inverses with 3 generators>
    gap> MagmaWithInversesByMultiplicationTable([[1,2,3],[2,3,1],[3,2,1]]);
    fail

##### 35.3-4 MagmaElement

`‣ MagmaElement`( M, i ) | ( function )

For a magma M and a positive integer i, `MagmaElement` returns the i-th element of M, w.r.t. the ordering `<`. If M has less than i elements then `fail` is returned.

##### 35.3-5 MultiplicationTable

`‣ MultiplicationTable`( elms ) | ( attribute )

`‣ MultiplicationTable`( M ) | ( attribute )

For a list elms of elements that form a magma M, `MultiplicationTable` returns a square matrix A of positive integers such that A[i][j] = k holds if and only if elms[i] * elms[j] = elms[k]. This matrix can be used to construct a magma isomorphic to M, using `MagmaByMultiplicationTable` (35.3-1).

For a magma M, `MultiplicationTable` returns the multiplication table w.r.t. the sorted list of elements of M.

    gap> l:= [ (), (1,2)(3,4), (1,3)(2,4), (1,4)(2,3) ];;
    gap> a:= MultiplicationTable( l );
    [ [ 1, 2, 3, 4 ], [ 2, 1, 4, 3 ], [ 3, 4, 1, 2 ], [ 4, 3, 2, 1 ] ]
    gap> m:= MagmaByMultiplicationTable( a );
    <magma with 4 generators>
    gap> One( m );
    m1
    gap> elm:= MagmaElement( m, 2 );  One( elm );  elm^2;
    m2
    m1
    m1
    gap> Inverse( elm );
    m2
    gap> AsGroup( m );
    <group of size 4 with 2 generators>
    gap> a:= [ [ 1, 2 ], [ 2, 2 ] ];
    [ [ 1, 2 ], [ 2, 2 ] ]
    gap> m:= MagmaByMultiplicationTable( a );
    <magma with 2 generators>
    gap> One( m );  Inverse( MagmaElement( m, 2 ) );
    m1
    fail

#### 35.4 Attributes and Properties for Magmas

Note that `IsAssociative` (35.4-7) and `IsCommutative` (35.4-9) always refer to the multiplication of a domain. If a magma M has also an additive structure, e.g., if M is a ring (see 56), then the addition `+` is always assumed to be associative and commutative, see 31.12.

##### 35.4-1 GeneratorsOfMagma

`‣ GeneratorsOfMagma`( M ) | ( attribute )

is a list gens of elements of the magma M that generates M as a magma, that is, the closure of gens under multiplication `\*` (31.12-1) is M.

For a free magma, each generator can also be accessed using the `.` operator (see `GeneratorsOfDomain` (31.9-2)).

##### 35.4-2 GeneratorsOfMagmaWithOne

`‣ GeneratorsOfMagmaWithOne`( M ) | ( attribute )

is a list gens of elements of the magma-with-one M that generates M as a magma-with-one, that is, the closure of gens under multiplication `\*` (31.12-1) and `One` (31.10-2) is M.

For a free magma with one, each generator can also be accessed using the `.` operator (see `GeneratorsOfDomain` (31.9-2)).

##### 35.4-3 GeneratorsOfMagmaWithInverses

`‣ GeneratorsOfMagmaWithInverses`( M ) | ( attribute )

is a list gens of elements of the magma-with-inverses M that generates M as a magma-with-inverses, that is, the closure of gens under multiplication `\*` (31.12-1) and taking inverses (see `Inverse` (31.10-8)) is M.

##### 35.4-4 Centralizer

`‣ Centralizer`( M, elm ) | ( operation )

`‣ Centralizer`( M, S ) | ( operation )

`‣ Centralizer`( class ) | ( attribute )

For an element elm of the magma M this operation returns the centralizer of elm. This is the domain of those elements m ∈ M that commute with elm.

For a submagma S it returns the domain of those elements that commute with all elements s of S.

If class is a class of objects of a magma (this magma then is stored as the `ActingDomain` of class) such as given by `ConjugacyClass` (39.10-1), `Centralizer` returns the centralizer of `Representative(class)` (which is a slight abuse of the notation).

    gap> g:=Group((1,2,3,4),(1,2));;
    gap> Centralizer(g,(1,2,3));
    Group([ (1,2,3) ])
    gap> Centralizer(g,Subgroup(g,[(1,2,3)]));
    Group([ (1,2,3) ])
    gap> Centralizer(g,Subgroup(g,[(1,2,3),(1,2)]));
    Group(())

##### 35.4-5 Centre

`‣ Centre`( M ) | ( attribute )

`‣ Center`( M ) | ( attribute )

`Centre` returns the centre of the magma M, i.e., the domain of those elements m ∈ M that commute and associate with all elements of M. That is, the set { m ∈ M; ∀ a, b ∈ M: ma = am, (ma)b = m(ab), (am)b = a(mb), (ab)m = a(bm) }.

`Center` is just a synonym for `Centre`.

For associative magmas we have that `Centre( M ) = Centralizer( M, M )`, see `Centralizer` (35.4-4).

The centre of a magma is always commutative (see `IsCommutative` (35.4-9)). (When one installs a new method for `Centre`, one should set the `IsCommutative` (35.4-9) value of the result to `true`, in order to make this information available.)

##### 35.4-6 Idempotents

`‣ Idempotents`( M ) | ( attribute )

The set of elements of M which are their own squares.

##### 35.4-7 IsAssociative

`‣ IsAssociative`( M ) | ( property )

A collection M of elements that can be multiplied via `\*` (31.12-1) is associative if for all elements a, b, c ∈ M the equality (a`*` b)`*` c = a`*` (b`*` c) holds.

An associative magma is called a semigroup (see 51), an associative magma-with-one is called a monoid (see 51), and an associative magma-with-inverses is called a group (see 39).

##### 35.4-8 IsCentral

`‣ IsCentral`( M, obj ) | ( operation )

`IsCentral` returns `true` if the object obj, which must either be an element or a magma, commutes with all elements in the magma M.

##### 35.4-9 IsCommutative

`‣ IsCommutative`( M ) | ( property )

`‣ IsAbelian`( M ) | ( property )

A collection M of elements that can be multiplied via `\*` (31.12-1) is commutative if for all elements a, b ∈ M the equality a`*` b = b`*` a holds. `IsAbelian` is a synonym of `IsCommutative`.

Note that the commutativity of the addition `\+` (31.12-1) in an additive structure can be tested with `IsAdditivelyCommutative` (55.3-1).

##### 35.4-10 MultiplicativeNeutralElement

`‣ MultiplicativeNeutralElement`( M ) | ( attribute )

returns the element e in the magma M with the property that e`*` m = m = m`*` e holds for all m ∈ M, if such an element exists. Otherwise `fail` is returned.

A magma that is not a magma-with-one can have a multiplicative neutral element e; in this case, e cannot be obtained as `One( M )`, see `One` (31.10-2).

##### 35.4-11 MultiplicativeZero

`‣ MultiplicativeZero`( M ) | ( attribute )

`‣ IsMultiplicativeZero`( M, z ) | ( operation )

`MultiplicativeZero` returns the multiplicative zero of the magma M which is the element `z` in M such that `z * m = m * z = z` for all m in M.

`IsMultiplicativeZero` returns `true` if the element z of the magma M equals the multiplicative zero of M.

    gap> S:=Semigroup( Transformation( [ 1, 1, 1 ] ),
    > Transformation( [ 2, 3, 1 ] ) );
    <transformation semigroup of degree 3 with 2 generators>
    gap> MultiplicativeZero(S);
    fail
    gap> S:=Semigroup( Transformation( [ 1, 1, 1 ] ),
    > Transformation( [ 1, 3, 2 ] ) );
    <transformation semigroup of degree 3 with 2 generators>
    gap> MultiplicativeZero(S);
    Transformation( [ 1, 1, 1 ] )

##### 35.4-12 SquareRoots

`‣ SquareRoots`( M, elm ) | ( operation )

is the proper set of all elements r in the magma M such that r * r = elm holds.

##### 35.4-13 TrivialSubmagmaWithOne

`‣ TrivialSubmagmaWithOne`( M ) | ( attribute )

is the magma-with-one that has the identity of the magma-with-one M as only element.

[Top of Book] [Contents] [Previous Chapter] [Next Chapter]
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Bib Ind

generated by GAPDoc2HTML