This file is indexed.

/usr/share/axiom-20170501/src/algebra/FAMR.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
)abbrev category FAMR FiniteAbelianMonoidRing
++ Date Last Updated: 14.08.2000 Exported pomopo! and binomThmExpt [MMM]
++ Description: 
++ This category is similar to AbelianMonoidRing, except that the sum is 
++ assumed to be finite. It is a useful model for polynomials,
++ but is somewhat more general.

FiniteAbelianMonoidRing(R,E) : Category == SIG where
  R : Ring
  E : OrderedAbelianMonoid

  SIG ==> Join(AbelianMonoidRing(R,E),FullyRetractableTo R) with

    ground? : % -> Boolean
      ++ ground?(p) tests if polynomial p is a member of the 
      ++ coefficient ring.
      -- can't be defined earlier, since a power series
      -- might not know if there were other terms or not

    ground : % -> R
      ++ ground(p) retracts polynomial p to the coefficient ring.

    coefficients : % -> List R
      ++ coefficients(p) gives the list of non-zero coefficients 
      ++ of polynomial p.

    numberOfMonomials : % -> NonNegativeInteger
      ++ numberOfMonomials(p) gives the number of non-zero monomials 
      ++ in polynomial p.

    minimumDegree : % -> E
      ++ minimumDegree(p) gives the least exponent of a non-zero term 
      ++ of polynomial p. Error: if applied to 0.

    mapExponents : (E -> E, %) -> %
      ++ mapExponents(fn,u) maps function fn onto the exponents
      ++ of the non-zero monomials of polynomial u.

    pomopo! : (%,R,E,%) -> %
      ++ \spad{pomopo!(p1,r,e,p2)} returns \spad{p1 + monomial(e,r) * p2}
      ++ and may use \spad{p1} as workspace. The constaant \spad{r} is
      ++ assumed to be nonzero.

    if R has CommutativeRing then

       binomThmExpt : (%,%,NonNegativeInteger) -> %
         ++ \spad{binomThmExpt(p,q,n)} returns \spad{(x+y)^n}
         ++ by means of the binomial theorem trick.

    if R has IntegralDomain then

       "exquo" : (%,R) -> Union(%,"failed")
       ++ exquo(p,r) returns the exact quotient of polynomial p by r, 
       ++ or "failed" if none exists.

    if R has GcdDomain then

       content : % -> R
         ++ content(p) gives the gcd of the coefficients of polynomial p.

       primitivePart : % -> %
         ++ primitivePart(p) returns the unit normalized form of polynomial p
         ++ divided by the content of p.

   add

     pomopo!(p1,r,e,p2) == p1 + r * mapExponents(x1+->x1+e,p2)
 
     if R has CommutativeRing then 

        binomThmExpt(x,y,nn) ==
                nn = 0 => 1$%
                ans,xn,yn: %
                bincoef: Integer
                powl: List(%):= [x]
                for i in 2..nn repeat powl:=[x * powl.first, :powl]
                yn:=y; ans:=powl.first; i:=1; bincoef:=nn
                for xn in powl.rest repeat
                   ans:= bincoef * xn * yn + ans
                   bincoef:= (nn-i) * bincoef quo (i+1);  i:= i+1
                   -- last I and BINCOEF unused
                   yn:= y * yn
                ans + yn

     ground? x ==
       retractIfCan(x)@Union(R,"failed") case "failed" => false
       true

     ground x == retract(x)@R
 
     mapExponents (fn:E -> E, x: %) ==
          -- this default definition assumes that reductum is cheap
        zero? x => 0
        monomial(leadingCoefficient x,fn degree x)+mapExponents(fn,reductum x)
 
     coefficients x ==
       zero? x => empty()
       concat(leadingCoefficient x, coefficients reductum x)
 
     if R has Field then

        x/r == map(x1+->x1/r,x)

     if R has IntegralDomain then

        x exquo r ==
           -- probably not a very good definition in most special cases
           zero? x => 0
           ans:% :=0
           t:=leadingCoefficient x exquo r
           while not (t case "failed") and not zero? x repeat
             ans:=ans+monomial(t::R,degree x)
             x:=reductum x
             if not zero? x then t:=leadingCoefficient x exquo r
           t case "failed" => "failed"
           ans
 
     if R has GcdDomain then

        content x ==       -- this assumes  reductum is cheap
           zero? x => 0
           r:=leadingCoefficient x
           x:=reductum x
           while not zero? x and not (r = 1) repeat
             r:=gcd(r,leadingCoefficient x)
             x:=reductum x
           r
 
        primitivePart x ==
           zero? x => x
           c := content x
           unitCanonical((x exquo c)::%)