This library code is based directly on MappingPackage3? in
mappkg.spad.pamphlet
(1) -> )abbrev package MAPHAC2X MapPackInternalHac2x ++ Description: Mapping hack for Addition ++ The function \spad{funcAdd(f,g, x)} is \spad{fx+gx} which is needed below MapPackInternalHac2x(A: SetCategory, B: Ring): with funcAdd: (A->B, A->B, A) -> B == add funcAdd(g, h, x) == ((g x) + (h x))$B
Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1147191614234250090-25px.001.spad using old system compiler. MAPHAC2X abbreviates package MapPackInternalHac2x ------------------------------------------------------------------------ initializing NRLIB MAPHAC2X for MapPackInternalHac2x compiling into NRLIB MAPHAC2X compiling exported funcAdd : (A -> B,A -> B, A) -> B Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |MapPackInternalHac2x| REDEFINED
;;; *** |MapPackInternalHac2x| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor MapPackInternalHac2x Time: 0 seconds
finalizing NRLIB MAPHAC2X Processing MapPackInternalHac2x for Browser database: --------constructor--------- --->-->MapPackInternalHac2x((funcAdd (B (Mapping B A) (Mapping B A) A))): Not documented!!!! ; compiling file "/var/aw/var/LatexWiki/MAPHAC2X.NRLIB/MAPHAC2X.lsp" (written 22 FEB 2025 09:23:44 AM):
; wrote /var/aw/var/LatexWiki/MAPHAC2X.NRLIB/MAPHAC2X.fasl ; compilation finished in 0:00:00.008 ------------------------------------------------------------------------ MapPackInternalHac2x is now explicitly exposed in frame initial MapPackInternalHac2x will be automatically loaded when needed from /var/aw/var/LatexWiki/MAPHAC2X.NRLIB/MAPHAC2X
This package is the one that actually provides the Functional Addition operator. The overloaded symbol + also represents this type of addition.
)abbrev package MAPPK2X MappingPackage2x ++ Description: Functional Addition ++ Given functions f and g,returns the function \spad{fx+gx} ++ \spad{f+g} is the function \spad{h} such that \spad{h x = f x + g x}. MappingPackage2x(A:SetCategory, B:Ring): with "+": (A->B, A->B) -> (A->B) == add import MapPackInternalHac2x(A, B) fab: A -> B fab1 + fab2 == (xx:A) : B +-> funcAdd(fab1, fab2, xx)
Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/2049699721911340732-25px.002.spad using old system compiler. MAPPK2X abbreviates package MappingPackage2x ------------------------------------------------------------------------ initializing NRLIB MAPPK2X for MappingPackage2x compiling into NRLIB MAPPK2X importing MapPackInternalHac2x(A,B) compiling exported + : (A -> B, A -> B) -> A -> B Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |MappingPackage2x| REDEFINED
;;; *** |MappingPackage2x| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor MappingPackage2x Time: 0 seconds
finalizing NRLIB MAPPK2X Processing MappingPackage2x for Browser database: --------constructor--------- --->-->MappingPackage2x((+ ((Mapping B A) (Mapping B A) (Mapping B A)))): Not documented!!!! ; compiling file "/var/aw/var/LatexWiki/MAPPK2X.NRLIB/MAPPK2X.lsp" (written 22 FEB 2025 09:23:44 AM):
; wrote /var/aw/var/LatexWiki/MAPPK2X.NRLIB/MAPPK2X.fasl ; compilation finished in 0:00:00.004 ------------------------------------------------------------------------ MappingPackage2x is now explicitly exposed in frame initial MappingPackage2x will be automatically loaded when needed from /var/aw/var/LatexWiki/MAPPK2X.NRLIB/MAPPK2X
f := (x:INT):INT +-> 3*x
g := (x:INT):INT +-> 2*x+3
(f+g)(3)
We should be able to generalize this to SandBox Direct Product