/usr/share/axiom-20170501/src/algebra/SINT.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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | )abbrev domain SINT SingleInteger
-- following patch needed to deal with *:(I,%) -> %
-- affects behavior of SourceLevelSubset
--)bo $noSubsets := true
-- No longer - JHD !! still needed 5/3/91 BMT
++ Author: Michael Monagan
++ Date Created: January 1988
++ Change History:
++ References:
++ Corl00 According to Abramowitz and Stegun or arccoth needn't be Uncouth
++ Fate01a A Critique of OpenMath and Thoughts on Encoding Mathematics
++ Description:
++ SingleInteger is intended to support machine integer arithmetic.
SingleInteger() : SIG == CODE where
SIG ==> Join(IntegerNumberSystem,Logic,OpenMath) with
canonical
++ \spad{canonical} means that mathematical equality is
++ implied by data structure equality.
canonicalsClosed
++ \spad{canonicalClosed} means two positives multiply to
++ give positive.
noetherian
++ \spad{noetherian} all ideals are finitely generated
++ (in fact principal).
max : () -> %
++ max() returns the largest single integer.
min : () -> %
++ min() returns the smallest single integer.
-- bit operations
"not" : % -> %
++ not(n) returns the bit-by-bit logical not of the single integer n.
"~" : % -> %
++ ~ n returns the bit-by-bit logical not of the single integer n.
"/\" : (%, %) -> %
++ \axiom{n /\ m} returns the bit-by-bit logical and of
++ the single integers n and m.
"\/" : (%, %) -> %
++ \axiom{n \/ m} returns the bit-by-bit logical or of
++ the single integers n and m.
"xor" : (%, %) -> %
++ xor(n,m) returns the bit-by-bit logical xor of
++ the single integers n and m.
Not : % -> %
++ Not(n) returns the bit-by-bit logical not of the single integer n.
And : (%,%) -> %
++ And(n,m) returns the bit-by-bit logical and of
++ the single integers n and m.
Or : (%,%) -> %
++ Or(n,m) returns the bit-by-bit logical or of
++ the single integers n and m.
CODE ==> add
seed : % := 1$Lisp -- for random()
MAXINT ==> MOST_-POSITIVE_-FIXNUM$Lisp
MININT ==> MOST_-NEGATIVE_-FIXNUM$Lisp
BASE ==> 67108864$Lisp -- 2**26
MULTIPLIER ==> 314159269$Lisp -- from Knuth's table
MODULUS ==> 2147483647$Lisp -- 2**31-1
writeOMSingleInt(dev: OpenMathDevice, x: %): Void ==
if x < 0 then
OMputApp(dev)
OMputSymbol(dev, "arith1", "unary_minus")
OMputInteger(dev, convert(-x))
OMputEndApp(dev)
else
OMputInteger(dev, convert(x))
OMwrite(x: %): String ==
s: String := ""
sp := OM_-STRINGTOSTRINGPTR(s)$Lisp
dev: OpenMathDevice := OMopenString(sp @ String, OMencodingXML)
OMputObject(dev)
writeOMSingleInt(dev, x)
OMputEndObject(dev)
OMclose(dev)
s := OM_-STRINGPTRTOSTRING(sp)$Lisp @ String
s
OMwrite(x: %, wholeObj: Boolean): String ==
s: String := ""
sp := OM_-STRINGTOSTRINGPTR(s)$Lisp
dev: OpenMathDevice := OMopenString(sp @ String, OMencodingXML)
if wholeObj then
OMputObject(dev)
writeOMSingleInt(dev, x)
if wholeObj then
OMputEndObject(dev)
OMclose(dev)
s := OM_-STRINGPTRTOSTRING(sp)$Lisp @ String
s
OMwrite(dev: OpenMathDevice, x: %): Void ==
OMputObject(dev)
writeOMSingleInt(dev, x)
OMputEndObject(dev)
OMwrite(dev: OpenMathDevice, x: %, wholeObj: Boolean): Void ==
if wholeObj then
OMputObject(dev)
writeOMSingleInt(dev, x)
if wholeObj then
OMputEndObject(dev)
reducedSystem m == m pretend Matrix(Integer)
coerce(x):OutputForm == (convert(x)@Integer)::OutputForm
convert(x:%):Integer == x pretend Integer
i:Integer * y:% == i::% * y
0 == 0$Lisp
1 == 1$Lisp
base() == 2$Lisp
max() == MAXINT
min() == MININT
x = y == EQL(x,y)$Lisp
_~ x == LOGNOT(x)$Lisp
not(x) == LOGNOT(x)$Lisp
_/_\(x,y) == LOGAND(x,y)$Lisp
_\_/(x,y) == LOGIOR(x,y)$Lisp
Not(x) == LOGNOT(x)$Lisp
And(x,y) == LOGAND(x,y)$Lisp
Or(x,y) == LOGIOR(x,y)$Lisp
xor(x,y) == LOGXOR(x,y)$Lisp
x < y == QSLESSP(x,y)$Lisp
inc x == QSADD1(x)$Lisp
dec x == QSSUB1(x)$Lisp
- x == QSMINUS(x)$Lisp
x + y == QSPLUS(x,y)$Lisp
x:% - y:% == QSDIFFERENCE(x,y)$Lisp
x:% * y:% == QSTIMES(x,y)$Lisp
x:% ** n:NonNegativeInteger == ((EXPT(x, n)$Lisp) @ Integer)::%
x quo y == QSQUOTIENT(x,y)$Lisp
x rem y == QSREMAINDER(x,y)$Lisp
divide(x, y) == CONS(QSQUOTIENT(x,y)$Lisp,QSREMAINDER(x,y)$Lisp)$Lisp
gcd(x,y) == GCD(x,y)$Lisp
abs(x) == QSABSVAL(x)$Lisp
odd?(x) == QSODDP(x)$Lisp
zero?(x) == QSZEROP(x)$Lisp
one?(x) == x = 1
max(x,y) == QSMAX(x,y)$Lisp
min(x,y) == QSMIN(x,y)$Lisp
hash(x) == SXHASH(x)$Lisp
length(x) == INTEGER_-LENGTH(x)$Lisp
shift(x,n) == QSLEFTSHIFT(x,n)$Lisp
mulmod(a,b,p) == QSMULTMOD(a,b,p)$Lisp
addmod(a,b,p) == QSADDMOD(a,b,p)$Lisp
submod(a,b,p) == QSDIFMOD(a,b,p)$Lisp
negative?(x) == QSMINUSP$Lisp x
reducedSystem(m, v) ==
[m pretend Matrix(Integer), v pretend Vector(Integer)]
positiveRemainder(x,n) ==
r := QSREMAINDER(x,n)$Lisp
QSMINUSP(r)$Lisp =>
QSMINUSP(n)$Lisp => QSDIFFERENCE(x, n)$Lisp
QSPLUS(r, n)$Lisp
r
coerce(x:Integer):% ==
(x <= max pretend Integer) and (x >= min pretend Integer) =>
x pretend %
error "integer too large to represent in a machine word"
random() ==
seed := REMAINDER(TIMES(MULTIPLIER,seed)$Lisp,MODULUS)$Lisp
REMAINDER(seed,BASE)$Lisp
random(n) == RANDOM(n)$Lisp
UCA ==> Record(unit:%,canonical:%,associate:%)
unitNormal x ==
x < 0 => [-1,-x,-1]$UCA
[1,x,1]$UCA
)bo $noSubsets := false
|