/usr/share/axiom-20170501/src/algebra/PMASSFS.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 | )abbrev package PMASSFS FunctionSpaceAssertions
++ Author: Manuel Bronstein
++ Date Created: 21 Mar 1989
++ Date Last Updated: 23 May 1990
++ Description:
++ Attaching assertions to symbols for pattern matching;
FunctionSpaceAssertions(R, F) : SIG == CODE where
R : OrderedSet
F : FunctionSpace R
K ==> Kernel F
PMOPT ==> "%pmoptional"
PMMULT ==> "%pmmultiple"
PMCONST ==> "%pmconstant"
SIG ==> with
assert : (F, String) -> F
++ assert(x, s) makes the assertion s about x.
++ Error: if x is not a symbol.
constant : F -> F
++ constant(x) tells the pattern matcher that x should
++ match only the symbol 'x and no other quantity.
++ Error: if x is not a symbol.
optional : F -> F
++ optional(x) tells the pattern matcher that x can match
++ an identity (0 in a sum, 1 in a product or exponentiation).
++ Error: if x is not a symbol.
multiple : F -> F
++ multiple(x) tells the pattern matcher that x should
++ preferably match a multi-term quantity in a sum or product.
++ For matching on lists, multiple(x) tells the pattern matcher
++ that x should match a list instead of an element of a list.
++ Error: if x is not a symbol.
CODE ==> add
ass : (K, String) -> F
asst : (K, String) -> F
mkk : BasicOperator -> F
mkk op == kernel(op, empty()$List(F))
ass(k, s) ==
has?(op := operator k, s) => k::F
mkk assert(copy op, s)
asst(k, s) ==
has?(op := operator k, s) => k::F
mkk assert(op, s)
assert(x, s) ==
retractIfCan(x)@Union(Symbol, "failed") case Symbol =>
asst(retract(x)@K, s)
error "assert must be applied to symbols only"
constant x ==
retractIfCan(x)@Union(Symbol, "failed") case Symbol =>
ass(retract(x)@K, PMCONST)
error "constant must be applied to symbols only"
optional x ==
retractIfCan(x)@Union(Symbol, "failed") case Symbol =>
ass(retract(x)@K, PMOPT)
error "optional must be applied to symbols only"
multiple x ==
retractIfCan(x)@Union(Symbol, "failed") case Symbol =>
ass(retract(x)@K, PMMULT)
error "multiple must be applied to symbols only"
|