/usr/share/axiom-20170501/src/algebra/LO.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 79 80 | )abbrev domain LO Localize
++ Author: Dave Barton, Barry Trager
++ Description:
++ Localize(M,R,S) produces fractions with numerators
++ from an R module M and denominators from some multiplicative subset D of R.
Localize(M,R,S) : SIG == CODE where
M : Module R
R : CommutativeRing
S : SubsetCategory(Monoid, R)
SIG ==> Module R with
if M has OrderedAbelianGroup then OrderedAbelianGroup
_/ : (%,S) -> %
++ x / d divides the element x by d.
_/ : (M,S) -> %
++ m / d divides the element m by d.
numer : % -> M
++ numer x returns the numerator of x.
denom : % -> S
++ denom x returns the denominator of x.
CODE ==> add
--representation
Rep:= Record(num:M,den:S)
--declarations
x,y: %
n: Integer
m: M
r: R
d: S
--definitions
0 == [0,1]
zero? x == zero? (x.num)
-x== [-x.num,x.den]
x=y == y.den*x.num = x.den*y.num
numer x == x.num
denom x == x.den
if M has OrderedAbelianGroup then
x < y ==
y.den*x.num < x.den*y.num
x+y == [y.den*x.num+x.den*y.num, x.den*y.den]
n*x == [n*x.num,x.den]
r*x == if r=x.den then [x.num,1] else [r*x.num,x.den]
x/d ==
zero?(u:S:=d*x.den) => error "division by zero"
[x.num,u]
m/d == if zero? d then error "division by zero" else [m,d]
coerce(x:%):OutputForm ==
((xd:=x.den) = 1) => (x.num)::OutputForm
(x.num)::OutputForm / (xd::OutputForm)
latex(x:%): String ==
((xd:=x.den) = 1) => latex(x.num)
nl : String := concat("{", concat(latex(x.num), "}")$String)$String
dl : String := concat("{", concat(latex(x.den), "}")$String)$String
concat("{ ", concat(nl, _
concat(" \over ", concat(dl, " }")$String)$String)$String)$String
|