/usr/share/axiom-20170501/src/algebra/MAPPKG4.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 | )abbrev package MAPPKG4 MappingPackage4
++ Author: Timothy Daly
++ Description:
++ Functional Composition.
++ Given functions f and g, returns the applicable closure
MappingPackage4(A,B) : SIG == CODE where
A : SetCategory
B : Ring
SIG ==> with
"+" : (A->B, A->B) -> (A->B)
++ \spad(+) does functional addition
++
++X f:=(x:INT):INT +-> 3*x
++X g:=(x:INT):INT +-> 2*x+3
++X (f+g)(4)
"-" : (A->B, A->B) -> (A->B)
++ \spad(+) does functional addition
++
++X f:=(x:INT):INT +-> 3*x
++X g:=(x:INT):INT +-> 2*x+3
++X (f-g)(4)
"*" : (A->B, A->B) -> (A->B)
++ \spad(+) does functional addition
++
++X f:=(x:INT):INT +-> 3*x
++X g:=(x:INT):INT +-> 2*x+3
++X (f*g)(4)
"/" : (A->Expression(Integer), A->Expression(Integer)) -> (A->Expression(Integer))
++ \spad(+) does functional addition
++
++X p:=(x:EXPR(INT)):EXPR(INT)+->3*x
++X q:=(x:EXPR(INT)):EXPR(INT)+->2*x+3
++X (p/q)(4)
++X (p/q)(x)
CODE ==> add
fab ==> (A -> B)
faei ==> (A -> Expression(Integer))
funcAdd(g:fab,h:fab,x:A):B == ((g x) + (h x))$B
(a:fab)+(b:fab) == c +-> funcAdd(a,b,c)
funcSub(g:fab,h:fab,x:A):B == ((g x) - (h x))$B
(a:fab)-(b:fab) == c +-> funcSub(a,b,c)
funcMul(g:fab,h:fab,x:A):B == ((g x) * (h x))$B
(a:fab)*(b:fab) == c +-> funcMul(a,b,c)
funcDiv(g:faei,h:faei,x:A):Expression(Integer)
== ((g x) / (h x))$Expression(Integer)
(a:faei)/(b:faei) == c +-> funcDiv(a,b,c)
|