/usr/share/axiom-20170501/src/algebra/IDPOAMS.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 | )abbrev domain IDPOAMS IndexedDirectProductOrderedAbelianMonoidSup
++ Author: Mark Botch
++ Description:
++ Indexed direct products of ordered abelian monoid sups \spad{A},
++ generators indexed by the ordered set S.
++ All items have finite support: only non-zero terms are stored.
IndexedDirectProductOrderedAbelianMonoidSup(A,S) : SIG == CODE where
A : OrderedAbelianMonoidSup
S : OrderedSet
SIG ==> Join(OrderedAbelianMonoidSup,IndexedDirectProductCategory(A,S))
CODE ==> IndexedDirectProductOrderedAbelianMonoid(A,S) add
--representations
Term:= Record(k:S,c:A)
Rep:= List Term
x,y: %
r: A
s: S
subtractIfCan(x,y) ==
empty? y => x
empty? x => "failed"
x.first.k < y.first.k => "failed"
x.first.k > y.first.k =>
t:= subtractIfCan(x.rest, y)
t case "failed" => "failed"
cons( x.first, t)
u:=subtractIfCan(x.first.c, y.first.c)
u case "failed" => "failed"
zero? u => subtractIfCan(x.rest, y.rest)
t:= subtractIfCan(x.rest, y.rest)
t case "failed" => "failed"
cons([x.first.k,u],t)
sup(x,y) ==
empty? y => x
empty? x => y
x.first.k < y.first.k => cons(y.first,sup(x,y.rest))
x.first.k > y.first.k => cons(x.first,sup(x.rest,y))
u:=sup(x.first.c, y.first.c)
cons([x.first.k,u],sup(x.rest,y.rest))
|