[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Constructor

Constructor

The term "constructor" is used in Magma to mean an entity which returns some value, but is not a call to a function or operator.

Constructors of sets, sequences and tuples have special bracketing symbols around them. For instance, the indexed set {@ 6, 2, 8 @} is created by a constructor bracketed with the compound symbols {@ and @}, and the tuple <x^2 + 3, 4> (where x is an indeterminate of a polynomial ring, say) has the bracketing symbols < and > . More complex forms of set and sequence constructors have several parts within the bracketing. See Sets and Sequences.

However, most constructors are of the form NAME< LEFTSIDE | RIGHTSIDE > The NAME is frequently a short lower-case word, the most common of these being: elt element constructor sub submagma constructor quo quotient magma constructor ncl normal closure constructor ideal ideal constructor lideal left ideal constructor rideal right ideal constructor ext extension constructor func function constructor case case-expression constructor map mapping constructor pmap partial mapping constructor hom homomorphism constructor

The contents of the LEFTSIDE and RIGHTSIDE are highly dependent upon which constructor is being used and which category is involved. In general, apart from func , LEFTSIDE specifies the magma used for the construction, and RIGHTSIDE is a list of objects such as generators or relations, from which the constructor will build the new object, relative to LEFTSIDE.

A few constructors have names beginning with capital letters. These constructors are typically one-step versions of a two-step process: creating a generic magma, and forming a submagma or quotient. Examples are Semigroup and Monoid .

Some constructors can return more than one value, when a Multiple Assignment is used. The main value will always be the newly-constructed object, and the second value will be the associated mapping. For instance, quo returns the quotient magma as its principal value, and the natural homomorphism as its second value.

Example

> gaussians<i> := sub< MatrixRing(Integers(), 2) | [0, 1, -1, 0] >; > print gaussians; Matrix Algebra of degree 2 with 1 generator over Integer Ring

> F<a, b> := FreeGroup(2); > G<c, d> := quo<F | a^2, b^3, (a * b)^4 >; > print G; Finitely presented group G on 2 generators Relations c^2 = Id(G) d^3 = Id(G) (c * d)^4 = Id(G) > > // OR, IN ONE STEP: > G1<c, d> := Group< c, d | c^2, d^3, (c * d)^4 >; > print G1; Finitely presented group G1 on 2 generators Relations c^2 = Id(G1) d^3 = Id(G1) (c * d)^4 = Id(G1)

[Next] [Prev] [Right] [Left] [Up] [Index] [Root]