/usr/share/axiom-20170501/src/algebra/DIV.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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | )abbrev domain DIV Divisor
++ Author: Gaetan Hache
++ Date Created: 17 nov 1992
++ Date Last Updated: May 2010 by Tim Daly
++ Description:
++ The following is part of the PAFF package
Divisor(S) : SIG == CODE where
S : SetCategoryWithDegree
PT ==> Record(gen:S,exp: Integer)
INT ==> Integer
BOOLEAN ==> Boolean
LIST ==> List
SIG ==> DivisorCategory(S) with
head : % -> PT
reductum : % -> %
CODE ==> List PT add
Rep := List PT
incr(d)==
[ [ pt.gen , pt.exp + 1 ] for pt in d ]
inOut: PT -> OutputForm
inOut(pp)==
one?(pp.exp) => pp.gen :: OutputForm
bl:OutputForm:= " " ::OutputForm
(pp.exp :: OutputForm) * hconcat(bl,pp.gen :: OutputForm)
coerce(d:%):OutputForm==
zero?(d) => ("0"::OutputForm)
ll:List OutputForm:=[inOut df for df in d]
reduce("+",ll)
reductum(d)==
zero?(d) => d
dl:Rep:= d pretend Rep
dlr := rest dl
empty?(dlr) => 0
dlr
head(d)==
zero?(d) => error "Cannot take head of zero"
dl:Rep:= d pretend Rep
first dl
coerce(s:S) == [[s,1]$PT]::%
split(a) ==
zero?(a) => []
[[r]::% for r in a]
coefficient(s,a)==
r:INT:=0
for pt in terms(a) repeat
if pt.gen=s then
r:=pt.exp
r
terms(a)==a::Rep
0==empty()$Rep
supp(a)==
aa:=terms(collect(a))
[p.gen for p in aa | ^zero?(p.exp)]
suppOfZero(a)==
aa:=terms(collect(a))
[p.gen for p in aa | (p.exp) > 0 ]
suppOfPole(a)==
aa:=terms(collect(a))
[p.gen for p in aa | p.exp < 0 ]
divOfZero(a)==
aa:=terms(collect(a))
[p for p in aa | (p.exp) > 0 ]::%
divOfPole(a)==
aa:=terms(collect(a))
[p for p in aa | p.exp < 0 ]::%
zero?(a)==
((collect(a)::Rep)=empty()$Rep)::BOOLEAN
collect(d)==
a:=d::Rep
empty?(a) => 0
t:Rep:=empty()
ff:PT:=first(a)
one?(#(a)) =>
if zero?(ff.exp) then
t::%
else
a::%
inList?:Boolean:=false()
newC:INT
restred:=terms(collect((rest(a)::%)))
zero?(ff.exp) =>
restred::%
for bb in restred repeat
b:=bb::PT
if b.gen=ff.gen then
newC:=b.exp+ff.exp
if ^zero?(newC) then
t:=concat(t,[b.gen,newC]$PT)
inList?:=true()
else
t:=concat(t,b)
if ^inList? then
t:=cons(ff,t)
t::%
a:% + b:% ==
collect(concat(a pretend Rep,b pretend Rep))
a:% - b:% ==
a + (-1)*b
-a:% == (-1)*a
n:INT * a:% ==
zero?(n) => 0
t:Rep:=empty()
for p in a pretend Rep repeat
t:=concat(t,[ p.gen, n*p.exp]$PT)
t::%
a:% <= b:% ==
bma:= b - a
effective? bma => true
false
effective?(a)== empty?(suppOfPole(a))
degree(d:%):Integer==
reduce("+",[(p.exp * degree(p.gen)) for p in d @ Rep],0$INT)
|