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

Types, Category Names and Structures

The following functions deal with types or category names and general structures. A type itself has type Type.

Type(x) : Elt -> BoolElt
Category(x) : Elt -> BoolElt
Given any object x, return the type (or category name) of x.
ISA(T, U) : Cat, Cat -> BoolElt
Given types T and U, return whether T ISA U, i.e., whether objects of type T inherit properties of type U. For example, ISA(RngInt, Rng) is true, because the ring of integers Z is a ring.
MakeType(S) : MonStgElt -> Cat
Given a string S specifying a type return the actual type corresponding to S. This is useful when some intrinsic name hides the symbol which normally refers to the actual type.
ElementType(S) : Str -> Cat
Given any structure S, return the type of the elements of S. For example, the element type of the ring of integers Z is RngIntElt since that is the type of the integers which lie in Z.
CoveringStructure(S, T) : Str, Str -> Str
Given structures S and T, return a covering structure C for S and T, so that S and T both embed into C. An error results if no such covering structure exists.
ExistsCoveringStructure(S, T) : Str, Str -> BoolElt, Str
Given structures S and T, return whether a covering structure C for S and T exists, and if so, return such a C, so that S and T both embed into C.

Example State_TypeStructures (H1E18)

We demonstrate the type and structure functions. GetVersion.

> Type(3);
RngIntElt
> t := MakeType("RngIntElt");
> t;
RngIntElt
> Type(3) eq t;
true
> Z := IntegerRing();
> Type(Z);
RngInt
> ElementType(Z);
RngIntElt
> ISA(RngIntElt, RngElt);
true
> ISA(RngIntElt, GrpElt);
false
> ISA(FldRat, Fld);
true
The following give examples of when covering structures exist or do not exist.

> Q := RationalField();
> CoveringStructure(Z, Q);
Rational Field
> ExistsCoveringStructure(Z, DihedralGroup(3));
false
> ExistsCoveringStructure(Z, CyclotomicField(5));
true Cyclotomic Field of order 5 and degree 4
> ExistsCoveringStructure(CyclotomicField(3), CyclotomicField(5));
true Cyclotomic Field of order 15 and degree 8
> ExistsCoveringStructure(GF(2), GF(3));                          
false
> ExistsCoveringStructure(GF(2^6), GF(2, 15));
true Finite field of size 2^30

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