# FreeModuleCategory(R, S)¶

- R: Join(SemiRng, AbelianMonoid)
- S: Comparable

A domain of this category implements formal linear combinations of elements from a domain `Basis`

with coefficients in a domain `R`

. The domain `Basis`

needs only to belong to the category SetCategory and `R`

to the category Ring. Thus the coefficient ring may be non-commutative. See the XDistributedPolynomial constructor for examples of domains built with the FreeModuleCategory category constructor. Author: Michel Petitot (petitot@lifl.`fr`

) Note (Franz Lehner, June 2009): Since `leadingTerm`

makes no sense for unordered base sets, and at the time of this writing this domain was never used for such, the base set is required to be `Comparable`

. `FreeModule`

originally was not of FreeModuleCategory. Some functions (like `support`

, `coefficients`

, `monomials`

, …) from here could be moved to `IndexedDirectProductCategory`

but at the moment there is no need for this.

- 0: %
- from AbelianMonoid
- *: (%, R) -> %
- from RightModule R
- *: (Integer, %) -> % if R has AbelianGroup
- from AbelianGroup
- *: (NonNegativeInteger, %) -> %
- from AbelianMonoid
- *: (PositiveInteger, %) -> %
- from AbelianSemiGroup
- *: (R, %) -> %
- from LeftModule R

- *: (R, S) -> %
`r*b`

returns the product of`r`

by`b`

.

- *: (S, R) -> %
`s*r`

returns the product`r*s`

used by XRecursivePolynomial- +: (%, %) -> %
- from AbelianSemiGroup
- -: % -> % if R has AbelianGroup
- from AbelianGroup
- -: (%, %) -> % if R has AbelianGroup
- from AbelianGroup
- <: (%, %) -> Boolean if R has OrderedAbelianMonoid and S has OrderedSet or R has OrderedAbelianMonoidSup and S has OrderedSet
- from PartialOrder
- <=: (%, %) -> Boolean if R has OrderedAbelianMonoid and S has OrderedSet or R has OrderedAbelianMonoidSup and S has OrderedSet
- from PartialOrder
- =: (%, %) -> Boolean
- from BasicType
- >: (%, %) -> Boolean if R has OrderedAbelianMonoid and S has OrderedSet or R has OrderedAbelianMonoidSup and S has OrderedSet
- from PartialOrder
- >=: (%, %) -> Boolean if R has OrderedAbelianMonoid and S has OrderedSet or R has OrderedAbelianMonoidSup and S has OrderedSet
- from PartialOrder
- ~=: (%, %) -> Boolean
- from BasicType

- coefficient: (%, S) -> R
`coefficient(x, s)`

returns the coefficient of the basis element`s`

- coefficients: % -> List R
`coefficients(x)`

returns the list of coefficients of`x`

.- coerce: % -> OutputForm
- from CoercibleTo OutputForm
- coerce: S -> % if R has SemiRing
- from RetractableTo S
- construct: List Record(k: S, c: R) -> %
- from IndexedDirectProductCategory(R, S)
- constructOrdered: List Record(k: S, c: R) -> %
- from IndexedDirectProductCategory(R, S)
- hash: % -> SingleInteger
- from SetCategory
- hashUpdate!: (HashState, %) -> HashState
- from SetCategory
- latex: % -> String
- from SetCategory
- leadingCoefficient: % -> R
- from IndexedDirectProductCategory(R, S)
- leadingMonomial: % -> %
- from IndexedDirectProductCategory(R, S)
- leadingSupport: % -> S
- from IndexedDirectProductCategory(R, S)
- leadingTerm: % -> Record(k: S, c: R)
- from IndexedDirectProductCategory(R, S)

- linearExtend: (S -> R, %) -> R if R has CommutativeRing
`linearExtend: (f, x)`

returns the linear extension of a map defined on the basis applied to a linear combination- listOfTerms: % -> List Record(k: S, c: R)
- from IndexedDirectProductCategory(R, S)
- map: (R -> R, %) -> %
- from IndexedDirectProductCategory(R, S)
- max: (%, %) -> % if R has OrderedAbelianMonoid and S has OrderedSet or R has OrderedAbelianMonoidSup and S has OrderedSet
- from OrderedSet
- min: (%, %) -> % if R has OrderedAbelianMonoid and S has OrderedSet or R has OrderedAbelianMonoidSup and S has OrderedSet
- from OrderedSet
- monomial: (R, S) -> %
- from IndexedDirectProductCategory(R, S)
- monomial?: % -> Boolean
- from IndexedDirectProductCategory(R, S)

- monomials: % -> List %
`monomials(x)`

returns the list of`r_i*b_i`

whose sum is`x`

.- numberOfMonomials: % -> NonNegativeInteger
- from IndexedDirectProductCategory(R, S)
- opposite?: (%, %) -> Boolean
- from AbelianMonoid
- reductum: % -> %
- from IndexedDirectProductCategory(R, S)
- retract: % -> S if R has SemiRing
- from RetractableTo S
- retractIfCan: % -> Union(S, failed) if R has SemiRing
- from RetractableTo S
- sample: %
- from AbelianMonoid
- smaller?: (%, %) -> Boolean if R has Comparable
- from Comparable
- subtractIfCan: (%, %) -> Union(%, failed)
- from CancellationAbelianMonoid
- sup: (%, %) -> % if R has OrderedAbelianMonoidSup and S has OrderedSet
- from OrderedAbelianMonoidSup

- support: % -> List S
`support(x)`

returns the list of basis elements with nonzero coefficients.

totalDegree: % -> NonNegativeInteger if S has coerce: S -> Vector NonNegativeInteger

- zero?: % -> Boolean
- from AbelianMonoid

AbelianGroup if R has AbelianGroup

BiModule(R, R)

Comparable if R has Comparable

IndexedDirectProductCategory(R, S)

Module R if R has CommutativeRing

OrderedAbelianMonoid if R has OrderedAbelianMonoid and S has OrderedSet or R has OrderedAbelianMonoidSup and S has OrderedSet

OrderedAbelianMonoidSup if R has OrderedAbelianMonoidSup and S has OrderedSet

OrderedAbelianSemiGroup if R has OrderedAbelianMonoid and S has OrderedSet or R has OrderedAbelianMonoidSup and S has OrderedSet

OrderedCancellationAbelianMonoid if R has OrderedAbelianMonoidSup and S has OrderedSet

OrderedSet if R has OrderedAbelianMonoid and S has OrderedSet or R has OrderedAbelianMonoidSup and S has OrderedSet

PartialOrder if R has OrderedAbelianMonoid and S has OrderedSet or R has OrderedAbelianMonoidSup and S has OrderedSet

RetractableTo S if R has SemiRing