Next: Type quatern, Previous: Type residue-class-ring, Up: Types of Numbers [Contents][Index]
The type ‘residue-class’ is actually a world of worlds where residue class ring elements may live. Their actual “type” is the residue class ring where the element is contained. Therefore (higher-ary) operations over residue classes must always perform two type checks, firstly whether an object lives in the world of worlds of residue classes, and secondly whether all of the residue classes are contained in the same ring. The underlying C-type is ‘resc_elm’.
Lisp objects can be tested for the type ‘residue-class’ by the following predicate.
Return t
if object is a residue class, nil
otherwise.
For ‘residue-class’ objects exists an accessor function to obtain the ring in which a certain residue class is contained.
Return the parental residue class ring (the world) of resclass.
The read syntax of ‘residue-class’es is inspired by the
traditional algebra, hence the lisp reader interprets
c+mZ
as ‘residue-class’ whenever both c
and m are rational integers, and m is positive. We
call c a representant of the residue class.
Of course, there exists a constructor to derive a residue class from a given representant:
Return the residue class of element in ring.
This is a lift of the integer element into one of the classes of ring.
Note that arbitrary class members of a residue class are mapped to one canonical representant.
2+9Z ⇒ 2+9Z (make-residue-class 2 Z/9Z) ⇒ 2+9Z
;; a canonicalisation 24+9Z ⇒ 6+9Z
To regain the representant’s integer value there is an accessor
function residue-class-representant
:
Return the representant of the residue class element lifted to the ring of rational integers.
Similarly there is an accessor for the modulus:
Return the modulus of the residue class ring ring-or-element, or the modulus of a residue class, respectively.
(residue-class-representant 3+4Z) ⇒ 3 (residue-class-representant 6+4Z) ⇒ 2
(residue-class-modulus 3+4Z) ⇒ 4 (residue-class-modulus Z/7Z) ⇒ 7
Next: Type quatern, Previous: Type residue-class-ring, Up: Types of Numbers [Contents][Index]