/usr/share/axiom-20170501/src/algebra/AMR.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | )abbrev category AMR AbelianMonoidRing
++ Description:
++ Abelian monoid ring elements (not necessarily of finite support)
++ of this ring are of the form formal SUM (r_i * e_i)
++ where the r_i are coefficents and the e_i, elements of the
++ ordered abelian monoid, are thought of as exponents or monomials.
++ The monomials commute with each other, and with
++ the coefficients (which themselves may or may not be commutative).
++ See \spadtype{FiniteAbelianMonoidRing} for the case of finite support
++ a useful common model for polynomials and power series.
++ Conceptually at least, only the non-zero terms are ever operated on.
AbelianMonoidRing(R,E) : Category == SIG where
R : Ring
E : OrderedAbelianMonoid
SIG ==> Join(Ring,BiModule(R,R)) with
leadingCoefficient : % -> R
++ leadingCoefficient(p) returns the coefficient highest
++ degree term of p.
leadingMonomial : % -> %
++ leadingMonomial(p) returns the monomial of p with the highest degree.
degree : % -> E
++ degree(p) returns the maximum of the exponents of the terms of p.
map : (R -> R, %) -> %
++ map(fn,u) maps function fn onto the coefficients
++ of the non-zero monomials of u.
monomial? : % -> Boolean
++ monomial?(p) tests if p is a single monomial.
monomial : (R,E) -> %
++ monomial(r,e) makes a term from a coefficient r and an exponent e.
reductum : % -> %
++ reductum(u) returns u minus its leading monomial
++ returns zero if handed the zero element.
coefficient : (%,E) -> R
++ coefficient(p,e) extracts the coefficient of the monomial with
++ exponent e from polynomial p, or returns zero if exponent
++ is not present.
if R has Field then
"/" : (%,R) -> %
++ p/c divides p by the coefficient c.
if R has CommutativeRing then
CommutativeRing
Algebra R
if R has CharacteristicZero then CharacteristicZero
if R has CharacteristicNonZero then CharacteristicNonZero
if R has IntegralDomain then IntegralDomain
if R has Algebra Fraction Integer then Algebra Fraction Integer
add
monomial? x == zero? reductum x
map(fn:R -> R, x: %) ==
-- this default definition assumes that reductum is cheap
zero? x => 0
r:=fn leadingCoefficient x
zero? r => map(fn,reductum x)
monomial(r, degree x) + map(fn,reductum x)
if R has Algebra Fraction Integer then
q:Fraction(Integer) * p:% == map(x1 +-> q * x1, p)
|