This file is indexed.

/usr/share/axiom-20170501/src/algebra/PBWLB.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
)abbrev domain PBWLB PoincareBirkhoffWittLyndonBasis
++ Author: Michel Petitot (petitot@lifl.fr).
++ Date Created: 91
++ Date Last Updated: 7 Juillet 92
++ Description:
++ This domain provides the internal representation
++ of polynomials in non-commutative variables written
++ over the Poincare-Birkhoff-Witt basis.
++ See the \spadtype{XPBWPolynomial} domain constructor.
++ See Free Lie Algebras by C. Reutenauer 
++ (Oxford science publications). 

PoincareBirkhoffWittLyndonBasis(VarSet) : SIG == CODE where
  VarSet : OrderedSet

  WORD    ==> OrderedFreeMonoid(VarSet)
  LWORD   ==> LyndonWord(VarSet)
  LWORDS  ==> List(LWORD)
  PI      ==> PositiveInteger
  NNI     ==> NonNegativeInteger
  EX      ==> OutputForm

  SIG ==> Join(OrderedSet, RetractableTo LWORD) with

      1 : constant -> %
        ++ \spad{1} returns the empty list.

      coerce : $ -> WORD
        ++ \spad{coerce([l1]*[l2]*...[ln])} returns the word 
        ++ \spad{l1*l2*...*ln},
        ++ where \spad{[l_i]} is the backeted form of the 
        ++ Lyndon word \spad{l_i}.

      coerce : VarSet -> $
        ++ \spad{coerce(v)} return \spad{v}

      first : $ -> LWORD
        ++ \spad{first([l1]*[l2]*...[ln])} returns the Lyndon word \spad{l1}.

      length : $ -> NNI
        ++ \spad{length([l1]*[l2]*...[ln])} returns the length of the 
        ++ word \spad{l1*l2*...*ln}.

      listOfTerms : $ -> LWORDS
        ++ \spad{listOfTerms([l1]*[l2]*...[ln])} returns the list of 
        ++ words \spad{l1, l2, .... ln}.

      rest : $ -> $
        ++ \spad{rest([l1]*[l2]*...[ln])} returns the list \spad{l2, .... ln}.

      retractable? : $ -> Boolean
        ++ \spad{retractable?([l1]*[l2]*...[ln])} returns true 
        ++ iff \spad{n}  equals \spad{1}.

      varList : $ -> List VarSet
        ++ \spad{varList([l1]*[l2]*...[ln])} returns the list of
        ++ variables in the word \spad{l1*l2*...*ln}.
   
  CODE ==> add

    -- Representation
     Rep := LWORDS

    -- Locales
     recursif: ($,$) -> Boolean

    -- Define
     1 == nil

     x = y == x =$Rep y

     varList x ==
        null x => nil
        le: List VarSet := "setUnion"/ [varList$LWORD l for l in x]

     first x == first(x)$Rep
     rest x == rest(x)$Rep

     coerce(v: VarSet):$ == [ v::LWORD ]
     coerce(l: LWORD):$ == [l]
     listOfTerms(x:$):LWORDS == x pretend LWORDS      

     coerce(x:$):WORD ==
       null x => 1
       x.first :: WORD *$WORD coerce(x.rest)

     coerce(x:$):EX ==
       null x => outputForm(1$Integer)$EX
       reduce(_* ,[l :: EX for l in x])$List(EX)

     retractable? x == 
       null x => false
       null x.rest

     retract x == 
        #x ^= 1 => error "cannot convert to Lyndon word"
        x.first

     retractIfCan x ==
        retractable? x => x.first
        "failed"
      
     length x ==
        n: Integer := +/[ length l for l in x]
        n::NNI

     recursif(x, y) ==
       null y => false
       null x => true
       x.first = y.first => recursif(rest(x), rest(y))
       lexico(x.first, y.first)

     x < y == 
       lx: NNI := length x; ly: NNI := length y 
       lx = ly => recursif(x,y)
       lx < ly