/usr/share/axiom-20170501/src/algebra/IFAMON.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 | )abbrev domain IFAMON InnerFreeAbelianMonoid
++ Author: Manuel Bronstein
++ Date Created: November 1989
++ Date Last Updated: 6 June 1991
++ Description:
++ Internal implementation of a free abelian monoid on any set of generators
InnerFreeAbelianMonoid(S,E,un) : SIG == CODE where
S : SetCategory
E : CancellationAbelianMonoid
un : E
SIG ==> FreeAbelianMonoidCategory(S, E)
CODE ==> ListMonoidOps(S, E, un) add
Rep := ListMonoidOps(S, E, un)
0 == makeUnit()
zero? f == empty? listOfMonoms f
terms f == copy listOfMonoms f
nthCoef(f, i) == nthExpon(f, i)
nthFactor(f, i) == nthFactor(f, i)$Rep
s:S + f:$ == plus(s, un, f)
f:$ + g:$ == plus(f, g)
(f:$ = g:$):Boolean == commutativeEquality(f,g)
n:E * s:S == makeTerm(s, n)
n:NonNegativeInteger * f:$ == mapExpon(x +-> n*x, f)
coerce(f:$):OutputForm == outputForm(f, "+", (x,y) +-> y*x, 0)
mapCoef(f, x) == mapExpon(f, x)
mapGen(f, x) == mapGen(f, x)$Rep
coefficient(s, f) ==
for x in terms f repeat
x.gen = s => return(x.exp)
0
if E has OrderedAbelianMonoid then
highCommonTerms(f, g) ==
makeMulti [[x.gen, min(x.exp, n)] for x in listOfMonoms f |
(n := coefficient(x.gen, g)) > 0]
|