FreeMonoid S¶
free.spad line 110 [edit on github]
S: SetCategory
The free monoid on a set S
is the monoid of finite products of the form reduce(*, [si ^ ni])
where the si
's
are in S
, and the ni
's
are nonnegative integers. The multiplication is not commutative. When S
is an OrderedSet, then FreeMonoid(S
) has order: for two elements x
and y
the relation x < y
holds if either length(x) < length(y)
holds or if these lengths are equal and if x
is smaller than y
w
.r
.t
. the lexicographical ordering induced by S
.
- 1: %
from MagmaWithUnit
- *: (%, S) -> %
x * s
returns the product ofx
bys
on the right.
- *: (S, %) -> %
s * x
returns the product ofx
bys
on the left.
- <=: (%, %) -> Boolean if S has OrderedSet
from PartialOrder
- <: (%, %) -> Boolean if S has OrderedSet
from PartialOrder
- >=: (%, %) -> Boolean if S has OrderedSet
from PartialOrder
- >: (%, %) -> Boolean if S has OrderedSet
from PartialOrder
- ^: (%, NonNegativeInteger) -> %
from MagmaWithUnit
- ^: (%, PositiveInteger) -> %
from Magma
- ^: (S, NonNegativeInteger) -> %
s ^ n
returns the product ofs
by itselfn
times.
- coerce: % -> OutputForm
from CoercibleTo OutputForm
- coerce: S -> %
from CoercibleFrom S
- divide: (%, %) -> Union(Record(lm: %, rm: %), failed)
divide(x, y)
returns the left and right exact quotients ofx
byy
, i.e.[l, r]
such thatx = l * y * r
, “failed” ifx
is not of the forml * y * r
.
- factors: % -> List Record(gen: S, exp: NonNegativeInteger)
factors(a1\^e1, ..., an\^en)
returns[[a1, e1], ..., [an, en]]
.
- first: % -> S
first(x)
returns the first letter ofx
.
- hclf: (%, %) -> %
hclf(x, y)
returns the highest common left factor ofx
andy
, i.e. the largestd
such thatx = d a
andy = d b
.
- hcrf: (%, %) -> %
hcrf(x, y)
returns the highest common right factor ofx
andy
, i.e. the largestd
such thatx = a d
andy = b d
.
- latex: % -> String
from SetCategory
- leftPower: (%, NonNegativeInteger) -> %
from MagmaWithUnit
- leftPower: (%, PositiveInteger) -> %
from Magma
- leftRecip: % -> Union(%, failed)
from MagmaWithUnit
- length: % -> NonNegativeInteger
length(x)
returns the length ofx
.
- lexico: (%, %) -> Boolean if S has OrderedSet
lexico(x, y)
returnstrue
iffx
is smaller thany
w
.r
.t
. the pure lexicographical ordering induced byS
.
- lquo: (%, %) -> Union(%, failed)
lquo(x, y)
returns the exact left quotient ofx
byy
i.e.q
such thatx = y * q
, “failed” ifx
is not of the formy * q
.
- lquo: (%, S) -> Union(%, failed)
lquo(x, s)
returns the exact left quotient ofx
bys
.
- mapExpon: (NonNegativeInteger -> NonNegativeInteger, %) -> %
mapExpon(f, a1\^e1 ... an\^en)
returnsa1\^f(e1) ... an\^f(en)
.
- mapGen: (S -> S, %) -> %
mapGen(f, a1\^e1 ... an\^en)
returnsf(a1)\^e1 ... f(an)\^en
.
- max: (%, %) -> % if S has OrderedSet
from OrderedSet
- min: (%, %) -> % if S has OrderedSet
from OrderedSet
- mirror: % -> %
mirror(x)
returns the reversed word ofx
.
- nthExpon: (%, Integer) -> NonNegativeInteger
nthExpon(x, n)
returns the exponent of the n^th monomial ofx
.
- nthFactor: (%, Integer) -> S
nthFactor(x, n)
returns the factor of the n^th monomial ofx
.
- one?: % -> Boolean
from MagmaWithUnit
- overlap: (%, %) -> Record(lm: %, mm: %, rm: %)
overlap(x, y)
returns[l, m, r]
such thatx = l * m
,y = m * r
andl
andr
have no overlap, i.e.overlap(l, r) = [l, 1, r]
.
- recip: % -> Union(%, failed)
from MagmaWithUnit
- rest: % -> %
rest(x)
returnsx
except the first letter.
- retract: % -> S
from RetractableTo S
- retractIfCan: % -> Union(S, failed)
from RetractableTo S
- rightPower: (%, NonNegativeInteger) -> %
from MagmaWithUnit
- rightPower: (%, PositiveInteger) -> %
from Magma
- rightRecip: % -> Union(%, failed)
from MagmaWithUnit
- rquo: (%, %) -> Union(%, failed)
rquo(x, y)
returns the exact right quotient ofx
byy
i.e.q
such thatx = q * y
, “failed” ifx
is not of the formq * y
.
- rquo: (%, S) -> Union(%, failed)
rquo(x, s)
returns the exact right quotient ofx
bys
.
- sample: %
from MagmaWithUnit
- size: % -> NonNegativeInteger
size(x)
returns the number of monomials inx
.
- smaller?: (%, %) -> Boolean if S has Comparable
from Comparable
- varList: % -> List S
varList(x)
returns the list of variables ofx
.
Comparable if S has Comparable
OrderedMonoid if S has OrderedSet
OrderedSemiGroup if S has OrderedSet
OrderedSet if S has OrderedSet
PartialOrder if S has OrderedSet