/usr/share/axiom-20170501/src/algebra/PMPREDFS.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 | )abbrev package PMPREDFS FunctionSpaceAttachPredicates
++ Author: Manuel Bronstein
++ Date Created: 21 Mar 1989
++ Date Last Updated: 23 May 1990
++ Description:
++ Attaching predicates to symbols for pattern matching.
FunctionSpaceAttachPredicates(R, F, D) : SIG == CODE where
R : OrderedSet
F : FunctionSpace R
D : Type
K ==> Kernel F
PMPRED ==> "%pmpredicate"
SIG ==> with
suchThat : (F, D -> Boolean) -> F
++ suchThat(x, foo) attaches the predicate foo to x;
++ error if x is not a symbol.
suchThat : (F, List(D -> Boolean)) -> F
++ suchThat(x, [f1, f2, ..., fn]) attaches the predicate
++ f1 and f2 and ... and fn to x.
++ Error: if x is not a symbol.
CODE ==> add
import AnyFunctions1(D -> Boolean)
st : (K, List Any) -> F
preds: K -> List Any
mkk : BasicOperator -> F
suchThat(p:F, f:D -> Boolean) == suchThat(p, [f])
mkk op == kernel(op, empty()$List(F))
preds k ==
(u := property(operator k, PMPRED)) case "failed" => empty()
(u::None) pretend List(Any)
st(k, l) ==
mkk assert(setProperty(copy operator k, PMPRED,
concat(preds k, l) pretend None), string(new()$Symbol))
suchThat(p:F, l:List(D -> Boolean)) ==
retractIfCan(p)@Union(Symbol, "failed") case Symbol =>
st(retract(p)@K, [f::Any for f in l])
error "suchThat must be applied to symbols only"
|