This file is indexed.

/usr/share/axiom-20170501/src/algebra/PMKERNEL.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
)abbrev package PMKERNEL PatternMatchKernel
++ Author: Manuel Bronstein
++ Date Created: 12 Jan 1990
++ Date Last Updated: 4 May 1992
++ Description:
++ This package provides pattern matching functions on kernels.

PatternMatchKernel(S, E) : SIG == CODE where
  S: SetCategory
  E: Join(OrderedSet, RetractableTo Kernel %,
          ConvertibleTo Pattern S, PatternMatchable S)

  PAT ==> Pattern S
  PRS ==> PatternMatchResult(S, E)
  POWER ==> "%power"::Symbol
  NTHRT ==> "nthRoot"::Symbol

  SIG ==> with

    patternMatch : (Kernel E, PAT, PRS) -> PRS
      ++ patternMatch(f(e1,...,en), pat, res) matches the pattern pat
      ++ to \spad{f(e1,...,en)}; res contains the variables of pat which
      ++ are already matched and their matches.

  CODE ==> add

    patternMatchArg  : (List E, List PAT, PRS) -> PRS
    patternMatchInner: (Kernel E, PAT, PRS) -> Union(PRS, "failed")

    -- matches the ordered lists ls and lp.
    patternMatchArg(ls, lp, l) ==
      #ls ^= #lp => failed()
      for p in lp for s in ls repeat
        generic? p and failed?(l := addMatch(p,s,l)) => return failed()
      for p in lp for s in ls repeat
        not(generic? p) and failed?(l := patternMatch(s, p, l)) =>
                                                         return failed()
      l

    patternMatchInner(s, p, l) ==
      generic? p => addMatch(p, s::E, l)
      (u := isOp p) case Record(op:BasicOperator, arg: List PAT) =>
        ur := u::Record(op:BasicOperator, arg: List PAT)
        ur.op = operator s => patternMatchArg(argument s, ur.arg, l)
        failed()
      constant? p =>
        ((v := retractIfCan(p)@Union(Symbol, "failed")) case Symbol)
          and ((w := symbolIfCan s) case Symbol) and
            (v::Symbol = w::Symbol) => l
        failed()
      "failed"

    if E has Monoid then

      patternMatchMonoid: (Kernel E, PAT, PRS) -> Union(PRS, "failed")
      patternMatchOpt   : (E, List PAT, PRS, E) -> PRS

      patternMatchOpt(x, lp, l, id) ==
        (u := optpair lp) case List(PAT) =>
          failed?(l := addMatch(first(u::List(PAT)), id, l)) => failed()
          patternMatch(x, second(u::List(PAT)), l)
        failed()

      patternMatchMonoid(s, p, l) ==
        (u := patternMatchInner(s, p, l)) case PRS => u::PRS
        (v := isPower p) case Record(val:PAT, exponent:PAT) =>
          vr := v::Record(val:PAT, exponent: PAT)
          is?(op := operator s, POWER) =>
            patternMatchArg(argument s, [vr.val, vr.exponent], l)
          is?(op,NTHRT) and ((r := recip(second(arg := argument s))) case E) =>
            patternMatchArg([first arg, r::E], [vr.val, vr.exponent], l)
          optional?(vr.exponent) =>
            failed?(l := addMatch(vr.exponent, 1, l)) => failed()
            patternMatch(s::E, vr.val, l)
          failed()
        (w := isTimes p) case List(PAT) =>
          patternMatchOpt(s::E, w::List(PAT), l, 1)
        "failed"

      if E has AbelianMonoid then

        patternMatch(s, p, l) ==
          (u := patternMatchMonoid(s, p, l)) case PRS => u::PRS
          (w := isPlus p) case List(PAT) =>
            patternMatchOpt(s::E, w::List(PAT), l, 0)
          failed()

      else

        patternMatch(s, p, l) ==
          (u := patternMatchMonoid(s, p, l)) case PRS => u::PRS
          failed()

    else

      patternMatch(s, p, l) ==
        (u := patternMatchInner(s, p, l)) case PRS => u::PRS
        failed()