/usr/share/axiom-20170501/src/algebra/QFCAT.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 | )abbrev category QFCAT QuotientFieldCategory
++ Date Last Updated: 5th March 1996
++ Description:
++ QuotientField(S) is the category of fractions of an Integral Domain S.
--QuotientFieldCategory(S) : Category == SIG where
-- S : IntegralDomain
-- F ==> Field
-- A ==> Algebra(S)
-- RT ==> RetractableTo(S)
-- FEO ==> FullyEvalableOver(S)
-- DE ==> DifferentialExtension(S)
-- FLERO ==> FullyLinearlyExplicitRingOver(S)
-- P ==> Patternable(S)
-- FPM ==> FullyPatternMatchable(S)
-- SIG ==> Join(F,A,RT,FEO,DE,FLERO,P,FPM) with
QuotientFieldCategory(S) : Category == SIG where
S : IntegralDomain
SIG ==> Join(Field, Algebra S, RetractableTo S, FullyEvalableOver S,
DifferentialExtension S, FullyLinearlyExplicitRingOver S,
Patternable S, FullyPatternMatchable S) with
_/ : (S, S) -> %
++ d1 / d2 returns the fraction d1 divided by d2.
numer : % -> S
++ numer(x) returns the numerator of the fraction x.
denom : % -> S
++ denom(x) returns the denominator of the fraction x.
numerator : % -> %
++ numerator(x) is the numerator of the fraction x converted to %.
denominator : % -> %
++ denominator(x) is the denominator of the fraction x converted to %.
if S has StepThrough then StepThrough
if S has RetractableTo Integer then
RetractableTo Integer
RetractableTo Fraction Integer
if S has OrderedSet then OrderedSet
if S has OrderedIntegralDomain then OrderedIntegralDomain
if S has RealConstant then RealConstant
if S has ConvertibleTo InputForm then ConvertibleTo InputForm
if S has CharacteristicZero then CharacteristicZero
if S has CharacteristicNonZero then CharacteristicNonZero
if S has RetractableTo Symbol then RetractableTo Symbol
if S has EuclideanDomain then
wholePart : % -> S
++ wholePart(x) returns the whole part of the fraction x
++ the truncated quotient of the numerator by the denominator.
fractionPart : % -> %
++ fractionPart(x) returns the fractional part of x.
++ x = wholePart(x) + fractionPart(x)
if S has IntegerNumberSystem then
random : () -> %
++ random() returns a random fraction.
ceiling : % -> S
++ ceiling(x) returns the smallest integral element above x.
floor : % -> S
++ floor(x) returns the largest integral element below x.
if S has PolynomialFactorizationExplicit then
PolynomialFactorizationExplicit
add
import MatrixCommonDenominator(S, %)
numerator(x) == numer(x)::%
denominator(x) == denom(x)::%
if S has StepThrough then
init() == init()$S / 1$S
nextItem(n) ==
m:= nextItem(numer(n))
m case "failed" =>
error "We seem to have a Fraction of a finite object"
m / 1
map(fn, x) == (fn numer x) / (fn denom x)
reducedSystem(m:Matrix %):Matrix S == clearDenominator m
characteristic() == characteristic()$S
differentiate(x:%, deriv:S -> S) ==
n := numer x
d := denom x
(deriv n * d - n * deriv d) / (d**2)
if S has ConvertibleTo InputForm then
convert(x:%):InputForm == (convert numer x) / (convert denom x)
if S has RealConstant then
convert(x:%):Float == (convert numer x) / (convert denom x)
convert(x:%):DoubleFloat == (convert numer x) / (convert denom x)
-- Note that being a Join(OrderedSet,IntegralDomain) is not the same
-- as being an OrderedIntegralDomain.
if S has OrderedIntegralDomain then
if S has canonicalUnitNormal then
x:% < y:% ==
(numer x * denom y) < (numer y * denom x)
else
x:% < y:% ==
if denom(x) < 0 then (x,y):=(y,x)
if denom(y) < 0 then (x,y):=(y,x)
(numer x * denom y) < (numer y * denom x)
else if S has OrderedSet then
x:% < y:% ==
(numer x * denom y) < (numer y * denom x)
if (S has EuclideanDomain) then
fractionPart x == x - (wholePart(x)::%)
if S has RetractableTo Symbol then
coerce(s:Symbol):% == s::S::%
retract(x:%):Symbol == retract(retract(x)@S)
retractIfCan(x:%):Union(Symbol, "failed") ==
(r := retractIfCan(x)@Union(S,"failed")) case "failed" =>"failed"
retractIfCan(r::S)
if (S has ConvertibleTo Pattern Integer) then
convert(x:%):Pattern(Integer)==(convert numer x)/(convert denom x)
if (S has PatternMatchable Integer) then
patternMatch(x:%, p:Pattern Integer,
l:PatternMatchResult(Integer, %)) ==
patternMatch(x, p,
l)$PatternMatchQuotientFieldCategory(Integer, S, %)
if (S has ConvertibleTo Pattern Float) then
convert(x:%):Pattern(Float) == (convert numer x)/(convert denom x)
if (S has PatternMatchable Float) then
patternMatch(x:%, p:Pattern Float,
l:PatternMatchResult(Float, %)) ==
patternMatch(x, p,
l)$PatternMatchQuotientFieldCategory(Float, S, %)
if S has RetractableTo Integer then
coerce(x:Fraction Integer):% == numer(x)::% / denom(x)::%
if not(S is Integer) then
retract(x:%):Integer == retract(retract(x)@S)
retractIfCan(x:%):Union(Integer, "failed") ==
(u := retractIfCan(x)@Union(S, "failed")) case "failed" =>
"failed"
retractIfCan(u::S)
if S has IntegerNumberSystem then
random():% ==
while zero?(d:=random()$S) repeat d
random()$S / d
reducedSystem(m:Matrix %, v:Vector %):
Record(mat:Matrix S, vec:Vector S) ==
n := reducedSystem(horizConcat(v::Matrix(%), m))@Matrix(S)
[subMatrix(n, minRowIndex n, maxRowIndex n, 1 + minColIndex n,
maxColIndex n), column(n, minColIndex n)]
|