This file is indexed.

/usr/share/axiom-20170501/src/algebra/PATTERN1.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
)abbrev package PATTERN1 PatternFunctions1
++ Author: Manuel Bronstein
++ Date Created: 28 Nov 1989
++ Date Last Updated: 5 Jul 1990
++ Description: 
++ Utilities for handling patterns

PatternFunctions1(R,D) : SIG == CODE where
  R : SetCategory
  D : Type

  SIG ==> with

    suchThat : (Pattern R, D -> Boolean) -> Pattern R
      ++ suchThat(p, f) makes a copy of p and adds the predicate
      ++ f to the copy, which is returned.

    suchThat : (Pattern R, List(D -> Boolean)) -> Pattern R
      ++ \spad{suchThat(p, [f1,...,fn])} makes a copy of p and adds the
      ++ predicate f1 and ... and fn to the copy, which is returned.

    suchThat : (Pattern R, List Symbol, List D -> Boolean) -> Pattern R
      ++ \spad{suchThat(p, [a1,...,an], f)} returns a copy of p with
      ++ the top-level predicate set to \spad{f(a1,...,an)}.

    predicate : Pattern R -> (D -> Boolean)
      ++ predicate(p) returns the predicate attached to p, the
      ++ constant function true if p has no predicates attached to it.

    satisfy? : (D, Pattern R) -> Boolean
      ++ satisfy?(v, p) returns f(v) where f is the predicate
      ++ attached to p.

    satisfy? : (List D, Pattern R) -> Boolean
      ++ \spad{satisfy?([v1,...,vn], p)} returns \spad{f(v1,...,vn)} 
      ++ where f is the
      ++ top-level predicate attached to p.

    addBadValue : (Pattern R, D) -> Pattern R
      ++ addBadValue(p, v) adds v to the list of "bad values" for p;
      ++ p is not allowed to match any of its "bad values".

    badValues : Pattern R -> List D
      ++ badValues(p) returns the list of "bad values" for p;
      ++ p is not allowed to match any of its "bad values".

  CODE ==> add

    A1D ==> AnyFunctions1(D)
    A1  ==> AnyFunctions1(D -> Boolean)
    A1L ==> AnyFunctions1(List D -> Boolean)
 
    applyAll: (List Any, D) -> Boolean
    st      : (Pattern R, List Any) -> Pattern R
 
    st(p, l)          == withPredicates(p, concat(predicates p, l))

    predicate p       == (d1:D):Boolean +-> applyAll(predicates p, d1)

    addBadValue(p, v) == addBadValue(p, coerce(v)$A1D)

    badValues p       == [retract(v)$A1D for v in getBadValues p]

    suchThat(p, l, f) == setTopPredicate(copy p, l, coerce(f)$A1L)

    suchThat(p:Pattern R, f:D -> Boolean) == st(p, [coerce(f)$A1])

    satisfy?(d:D, p:Pattern R)            == applyAll(predicates p, d)
 
    satisfy?(l:List D, p:Pattern R) ==
      empty?((rec := topPredicate p).var) => true
      retract(rec.pred)$A1L l
 
    applyAll(l, d) ==
      for f in l repeat
        not(retract(f)$A1 d) => return false
      true
 
    suchThat(p:Pattern R, l:List(D -> Boolean)) ==
      st(p, [coerce(f)$A1 for f in l])