This file is indexed.

/usr/share/axiom-20170501/src/algebra/PRTITION.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
)abbrev domain PRTITION Partition
++ Author: William H. Burge
++ Date Created: 29 October 1987
++ Date Last Updated: 23 Sept 1991
++ Description:
++ Domain for partitions of positive integers
++ Partition is an OrderedCancellationAbelianMonoid which is used
++ as the basis for symmetric polynomial representation of the
++ sums of powers in SymmetricPolynomial.  Thus, \spad{(5 2 2 1)} will
++ represent \spad{s5 * s2**2 * s1}.

Partition() : SIG == CODE where

  L   ==> List
  I   ==> Integer
  OUT ==> OutputForm
  NNI ==> NonNegativeInteger
  UN  ==> Union(%,"failed")
 
  SIG ==> Join(OrderedCancellationAbelianMonoid,
                   ConvertibleTo List Integer) with

    partition : L I -> %
      ++ partition(li) converts a list of integers li to a partition

    powers : L I -> L L I
      ++ powers(li) returns a list of 2-element lists.  For each 2-element
      ++ list, the first element is an entry of li and the second
      ++ element is the multiplicity with which the first element
      ++ occurs in li.  There is a 2-element list for each value
      ++ occurring in l.

    pdct : % -> I
      ++ \spad{pdct(a1**n1 a2**n2 ...)} returns 
      ++ \spad{n1! * a1**n1 * n2! * a2**n2 * ...}.
      ++ This function is used in the package \spadtype{CycleIndicators}.

    conjugate : % -> %
      ++ conjugate(p) returns the conjugate partition of a partition p

    coerce : % -> List Integer
      ++ coerce(p) coerces a partition into a list of integers
 
  CODE ==> add
 
    import PartitionsAndPermutations
 
    Rep := List Integer

    0 == nil()
 
    coerce (s:%) == s pretend List Integer

    convert x == copy(x pretend L I)
 
    partition list == sort((i1:Integer,i2:Integer):Boolean +-> i2 < i1,list)
 
    x < y ==
      empty? x => not empty? y
      empty? y => false
      first x = first y => rest x < rest y
      first x < first y
 
    x = y ==
        EQUAL(x,y)$Lisp
 
    x + y ==
      empty? x => y
      empty? y => x
      first x > first y => concat(first x,rest(x) + y)
      concat(first y,x + rest(y))
    n:NNI * x:% == (zero? n => 0; x + (subtractIfCan(n,1) :: NNI) * x)
 
    dp: (I,%) -> %
    dp(i,x) ==
      empty? x => 0
      first x = i => rest x
      concat(first x,dp(i,rest x))
 
    remv: (I,%) -> UN
    remv(i,x) == (member?(i,x) => dp(i,x); "failed")
 
    subtractIfCan(x, y) ==
      empty? x =>
        empty? y => 0
        "failed"
      empty? y => x
      (aa := remv(first y,x)) case "failed" => "failed"
      subtractIfCan((aa :: %), rest y)
 
    li1 : L I  --!! 'bite' won't compile without this
    bite: (I,L I) -> L I
    bite(i,li) ==
      empty? li => concat(0,nil())
      first li = i =>
        li1 := bite(i,rest li)
        concat(first(li1) + 1,rest li1)
      concat(0,li)
 
    li : L I  --!!  'powers' won't compile without this
    powers l ==
      empty? l => nil()
      li := bite(first l,rest l)
      concat([first l,first(li) + 1],powers(rest li))
 
    conjugate x == conjugate(x pretend Rep)$PartitionsAndPermutations
 
    mkterm: (I,I) -> OUT
    mkterm(i1,i2) ==
      i2 = 1 => (i1 :: OUT) ** (" " :: OUT)
      (i1 :: OUT) ** (i2 :: OUT)
 
    mkexp1: L L I -> L OUT
    mkexp1 lli ==
      empty? lli => nil()
      li := first lli
      empty?(rest lli) and second(li) = 1 =>
        concat(first(li) :: OUT,nil())
      concat(mkterm(first li,second li),mkexp1(rest lli))
 
    coerce(x:%):OUT == 
        empty? (x pretend Rep) => coerce(x pretend Rep)$Rep
        paren(reduce("*",mkexp1(powers(x pretend Rep))))
 
    pdct x ==
      */[factorial(second a) * (first(a) ** (second(a) pretend NNI))
                 for a in powers(x pretend Rep)]