/usr/share/axiom-20170501/src/algebra/REPDB.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 | )abbrev package REPDB RepeatedDoubling
++ Description:
++ Implements multiplication by repeated addition
-- the following package is only instantiated over %
-- thus shouldn't be cached. We prevent it
-- from being cached by declaring it to be mutableDomains
)bo PUSH('RepeatedDoubling, $mutableDomains)
RepeatedDoubling(S) : SIG == CODE where
S : SetCategory with
"+" : (%,%)->%
++ x+y returns the sum of x and y
SIG ==>with
double : (PositiveInteger,S) -> S
++ double(i, r) multiplies r by i using repeated doubling.
CODE ==> add
x: S
n: PositiveInteger
double(n,x) ==
(n = 1) => x
odd?(n)$Integer =>
x + double(shift(n,-1) pretend PositiveInteger,(x+x))
double(shift(n,-1) pretend PositiveInteger,(x+x))
|