This file is indexed.

/usr/share/axiom-20170501/src/algebra/BOP1.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
)abbrev package BOP1 BasicOperatorFunctions1
++ Author: Manuel Bronstein
++ Date Created: 28 Mar 1988
++ Date Last Updated: 15 May 1990
++ Description:
++ This package exports functions to set some commonly used properties
++ of operators, including properties which contain functions.

BasicOperatorFunctions1(A) : SIG == CODE where
  A:SetCategory

  OP    ==> BasicOperator
  EVAL  ==> "%eval"
  CONST ==> "%constant"
  DIFF  ==> "%diff"
  OUT   ==> OutputForm
  IN    ==> InputForm

  SIG ==> with

    evaluate : (OP, List A) -> Union(A, "failed")
      ++ evaluate(op, [a1,...,an]) checks if op has an "%eval"
      ++ property f. If it has, then \spad{f(a1,...,an)} is returned, and
      ++ "failed" otherwise.

    evaluate : (OP, List A -> A) -> OP
      ++ evaluate(op, foo) attaches foo as the "%eval" property
      ++ of op. If op has an "%eval" property f, then applying op
      ++ to \spad{(a1,...,an)} returns the result of \spad{f(a1,...,an)}.

    evaluate : (OP, A -> A) -> OP
      ++ evaluate(op, foo) attaches foo as the "%eval" property
      ++ of op. If op has an "%eval" property f, then applying op
      ++ to a returns the result of \spad{f(a)}. Argument op must be unary.

    evaluate : OP -> Union(List A -> A, "failed")
      ++ evaluate(op) returns the value of the "%eval" property of
      ++ op if it has one, and "failed" otherwise.

    derivative : (OP, List (List A -> A)) -> OP
      ++ derivative(op, [foo1,...,foon]) attaches [foo1,...,foon] as
      ++ the "%diff" property of op. If op has an "%diff" property
      ++ \spad{[f1,...,fn]} then applying a derivation D 
      ++ to \spad{op(a1,...,an)}
      ++ returns \spad{f1(a1,...,an) * D(a1) + ... + fn(a1,...,an) * D(an)}.

    derivative : (OP, A -> A) -> OP
      ++ derivative(op, foo) attaches foo as the "%diff" property
      ++ of op. If op has an "%diff" property f, then applying a
      ++ derivation D to op(a) returns \spad{f(a) * D(a)}. 
      ++ Argument op must be unary.

    derivative : OP -> Union(List(List A -> A), "failed")
      ++ derivative(op) returns the value of the "%diff" property of
      ++ op if it has one, and "failed" otherwise.

    if A has OrderedSet then

      constantOperator : A -> OP
        ++ constantOperator(a) returns a nullary operator op
        ++ such that \spad{op()} always evaluate to \spad{a}.

      constantOpIfCan : OP -> Union(A, "failed")
        ++ constantOpIfCan(op) returns \spad{a} if op is the constant
        ++ nullary operator always returning \spad{a}, "failed" otherwise.

  CODE ==> add

    evaluate(op:OP, func:A -> A) == 
       evaluate(op, (ll:List(A)):A +-> func first ll)

    evaluate op ==
      (func := property(op, EVAL)) case "failed" => "failed"
      (func::None) pretend (List A -> A)

    evaluate(op:OP, args:List A) ==
      (func := property(op, EVAL)) case "failed" => "failed"
      ((func::None) pretend (List A -> A)) args

    evaluate(op:OP, func:List A -> A) ==
      setProperty(op, EVAL, func pretend None)

    derivative op ==
      (func := property(op, DIFF)) case "failed" => "failed"
      ((func::None) pretend List(List A -> A))

    derivative(op:OP, grad:List(List A -> A)) ==
      setProperty(op, DIFF, grad pretend None)

    derivative(op:OP, f:A -> A) ==
      unary? op or nary? op =>
        derivative(op, [(ll:List(A)):A +-> f first ll]$List(List A -> A))
      error "Operator is not unary"

    if A has OrderedSet then

      cdisp   : (OUT, List OUT) -> OUT
      csex    : (IN,  List IN) -> IN
      eqconst?: (OP, OP) -> Boolean
      ltconst?: (OP, OP) -> Boolean
      constOp : A -> OP

      opconst:OP :=
        comparison(equality(operator("constant"::Symbol, 0), eqconst?),
                                                               ltconst?)

      cdisp(a, l) == a

      csex(a, l)  == a

      eqconst?(a, b) ==
        (va := property(a, CONST)) case "failed" => not has?(b, CONST)
        ((vb := property(b, CONST)) case None) and
           ((va::None) pretend A) = ((vb::None) pretend A)

      ltconst?(a, b) ==
        (va := property(a, CONST)) case "failed" => has?(b, CONST)
        ((vb := property(b, CONST)) case None) and
           ((va::None) pretend A) < ((vb::None) pretend A)

      constOp a ==
        setProperty(
          display(copy opconst, (ll:List(OUT)):OUT +-> cdisp(a::OUT, ll)),
            CONST, a pretend None)

      constantOpIfCan op ==
        is?(op, "constant"::Symbol) and
          ((u := property(op, CONST)) case None) => (u::None) pretend A
        "failed"

      if A has ConvertibleTo IN then

        constantOperator a == 
          input(constOp a, (ll:List(IN)):IN +-> csex(convert a, ll))

      else

        constantOperator a == constOp a