*Domain* is **GAP**'s name for structured sets. We already saw examples of domains in Chapters 5 and 6: the groups `s8`

and `a8`

in Section 5.1 are domains, likewise the field `f`

and the vector space `v`

in Section 6.1 are domains. They were constructed by functions such as `Group`

(Reference: Group Libraries) and `GF`

(Reference: GF for field size), and they could be passed as arguments to other functions such as `DerivedSubgroup`

(Reference: DerivedSubgroup) and `Dimension`

(Reference: Dimension).

First of all, a domain D is a set. If D is finite then a list with the elements of this set can be computed with the functions `AsList`

(Reference: AsList) and `AsSortedList`

(Reference: AsSortedList). For infinite D, `Enumerator`

(Reference: Enumerator) and `EnumeratorSorted`

(Reference: EnumeratorSorted) may work, but it is also possible that one gets an error message.

Domains can be used as arguments of set functions such as `Intersection`

(Reference: Intersection) and `Union`

(Reference: Union). **GAP** tries to return a domain in these cases, moreover it tries to return a domain with as much structure as possible. For example, the intersection of two groups is (either empty or) again a group, and **GAP** will try to return it as a group. For `Union`

(Reference: Union), the situation is different because the union of two groups is in general not a group.

gap> g:= Group( (1,2), (3,4) );; gap> h:= Group( (3,4), (5,6) );; gap> Intersection( g, h ); Group([ (3,4) ])

Two domains are regarded as equal w.r.t. the operator "`=`

" if and only if they are equal *as sets*, regardless of the additional structure of the domains.

gap> mats:= [ [ [ 0*Z(2), Z(2)^0 ], [ Z(2)^0, 0*Z(2) ] ], > [ [ Z(2)^0, 0*Z(2) ], [ 0*Z(2), Z(2)^0 ] ] ];; gap> Ring( mats ) = VectorSpace( GF(2), mats ); true

Additionally, a domain is regarded as equal to the sorted list of its elements.

gap> g:= Group( (1,2) );; gap> l:= AsSortedList( g ); [ (), (1,2) ] gap> g = l; true gap> IsGroup( l ); IsList( g ); false false

The additional structure of D is constituted by the facts that D is known to be closed under certain operations such as addition or multiplication, and that these operations have additional properties. For example, if D is a group then it is closed under multiplication (D × D → D, (g,h) ↦ g * h), under taking inverses (D → D, g ↦ g^-1) and under taking the identity g`^0`

of each element g in D; additionally, the multiplication in D is associative.

The same set of elements can carry different algebraic structures. For example, a semigroup is defined as being closed under an associative multiplication, so each group is also a semigroup. Likewise, a monoid is defined as a semigroup D in which the identity g`^0`

is defined for every element g, so each group is a monoid, and each monoid is a semigroup.

Other examples of domains are vector spaces, which are defined as additive groups that are closed under (left) multiplication with elements in a certain domain of scalars. Also conjugacy classes in a group D are domains, they are closed under the conjugation action of D.

We have seen that a domain is closed under certain operations. Usually a domain is constructed as the closure of some elements under these operations. In this situation, we say that the elements *generate* the domain.

For example, a list of matrices of the same shape over a common field can be used to generate an additive group or a vector space over a suitable field; if the matrices are square then we can also use the matrices as generators of a semigroup, a ring, or an algebra. We illustrate some of these possibilities:

gap> mats:= [ [ [ 0*Z(2), Z(2)^0 ], > [ Z(2)^0, 0*Z(2) ] ], > [ [ Z(2)^0, 0*Z(2) ], > [ 0*Z(2), Z(2)^0 ] ] ];; gap> Size( AdditiveMagma( mats ) ); 4 gap> Size( VectorSpace( GF(8), mats ) ); 64 gap> Size( Algebra( GF(2), mats ) ); 4 gap> Size( Group( mats ) ); 2

Each combination of operations under which a domain could be closed gives a notion of generation. So each group has group generators, and since it is a monoid, one can also ask for monoid generators of a group.

Note that one cannot simply ask for "the generators of a domain", it is always necessary to specify what notion of generation is meant. Access to the different generators is provided by functions with names of the form `GeneratorsOfSomething`

. For example, `GeneratorsOfGroup`

(Reference: GeneratorsOfGroup) denotes group generators, `GeneratorsOfMonoid`

(Reference: GeneratorsOfMonoid) denotes monoid generators, and so on. The result of `GeneratorsOfVectorSpace`

(Reference: GeneratorsOfVectorSpace) is of course to be understood relative to the field of scalars of the vector space in question.

gap> GeneratorsOfVectorSpace( GF(4)^2 ); [ [ Z(2)^0, 0*Z(2) ], [ 0*Z(2), Z(2)^0 ] ] gap> v:= AsVectorSpace( GF(2), GF(4)^2 );; gap> GeneratorsOfVectorSpace( v ); [ [ Z(2)^0, 0*Z(2) ], [ 0*Z(2), Z(2)^0 ], [ Z(2^2), 0*Z(2) ], [ 0*Z(2), Z(2^2) ] ]

A group can be constructed from a list of group generators `gens` by `Group( `

, likewise one can construct rings and algebras with the functions `gens` )`Ring`

(Reference: Ring) and `Algebra`

(Reference: Algebra).

Note that it is not always or completely checked that `gens` is in fact a valid list of group generators, for example whether the elements of `gens` can be multiplied or whether they are invertible. This means that **GAP** trusts you, at least to some extent, that the desired domain `Something( `

does exist.`gens` )

Besides constructing domains from generators, one can also form the closure of a given domain with an element or another domain. There are different notions of closure, one has to specify one according to the desired result and the structure of the given domain. The functions to compute closures have names such as `ClosureSomething`

. For example, if `D` is a group and one wants to construct the group generated by `D` and an element `g` then one can use `ClosureGroup( `

.`D`, `g` )

The same set of elements can have different algebraic structures. For example, it may happen that a monoid M does in fact contain the inverses of all of its elements, and thus M is equal to the group formed by the elements of M.

gap> m:= Monoid( mats );; gap> m = Group( mats ); true gap> IsGroup( m ); false

The last result in the above example may be surprising. But the monoid `m`

is not regarded as a group in **GAP**, and moreover there is no way to turn `m`

into a group. Let us formulate this as a rule:

*The set of operations under which the domain is closed is fixed in the construction of a domain, and cannot be changed later.*

(Contrary to this, a domain *can* acquire knowledge about properties such as whether the multiplication is associative or commutative.)

If one needs a domain with a different structure than the given one, one can construct a new domain with the required structure. The functions that do these constructions have names such as `AsSomething`

, they return a domain that has the same elements as the argument in question but the structure `Something`

. In the above situation, one can use `AsGroup`

(Reference: AsGroup).

gap> g:= AsGroup( m );; gap> m = g; true gap> IsGroup( g ); true

If it is impossible to construct the desired domain, the `AsSomething`

functions return `fail`

.

gap> AsVectorSpace( GF(4), GF(2)^2 ); fail

The functions `AsList`

(Reference: AsList) and `AsSortedList`

(Reference: AsSortedList) mentioned above do not return domains, but they fit into the general pattern in the sense that they forget all the structure of the argument, including the fact that it is a domain, and return a list with the same elements as the argument has.

It is possible to construct a domain as a subset of an existing domain. The respective functions have names such as `Subsomething`

, they return domains with the structure `Something`

. (Note that the second `s`

in `Subsomething`

is not capitalized.) For example, if one wants to deal with the subgroup of the domain `D` that is generated by the elements in the list `gens`, one can use `Subgroup( `

. It is not required that `D`, `gens` )`D` is itself a group, only that the group generated by `gens` must be a subset of `D`.

The superset of a domain `S` that was constructed by a `Subsomething`

function can be accessed as `Parent( `

.`S` )

gap> g:= SymmetricGroup( 5 );; gap> gens:= [ (1,2), (1,2,3,4) ];; gap> s:= Subgroup( g, gens );; gap> h:= Group( gens );; gap> s = h; true gap> Parent( s ) = g; true

Many functions return subdomains of their arguments, for example the result of `SylowSubgroup( `

is a group with parent group `G` )`G`.

If you are sure that the domain `Something( `

is contained in the domain `gens` )`D` then you can also call `SubsomethingNC( `

instead of `D`, `gens` )`Subsomething( `

. The `D`, `gens` )`NC`

stands for "no check", and the functions whose names end with `NC`

omit the check of containment.

More information about domains can be found in Chapter Reference: Domains. Many other other chapters deal with specific types of domain such as groups, vector spaces or algebras.

generated by GAPDoc2HTML