/usr/share/axiom-20170501/src/algebra/FAGROUP.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 | )abbrev domain FAGROUP FreeAbelianGroup
++ Author: Manuel Bronstein
++ Date Created: November 1989
++ Date Last Updated: 6 June 1991
++ Description:
++ Free abelian group on any set of generators
++ The free abelian group on a set S is the monoid of finite sums of
++ the form \spad{reduce(+,[ni * si])} where the si's are in S, and the ni's
++ are integers. The operation is commutative.
FreeAbelianGroup(S) : SIG == CODE where
S : SetCategory
SIG ==> Join(AbelianGroup, Module Integer,
FreeAbelianMonoidCategory(S, Integer)) with
if S has OrderedSet then OrderedSet
CODE ==> InnerFreeAbelianMonoid(S, Integer, 1) add
- f == mapCoef("-", f)
if S has OrderedSet then
inmax: List Record(gen: S, exp: Integer) -> Record(gen: S, exp:Integer)
inmax l ==
mx := first l
for t in rest l repeat
if mx.gen < t.gen then mx := t
mx
-- lexicographic order
a < b ==
zero? a =>
zero? b => false
0 < (inmax terms b).exp
ta := inmax terms a
zero? b => ta.exp < 0
tb := inmax terms b
ta.gen < tb.gen => 0 < tb.exp
tb.gen < ta.gen => ta.exp < 0
ta.exp < tb.exp => true
tb.exp < ta.exp => false
lc := ta.exp * ta.gen
(a - lc) < (b - lc)
|