/usr/share/axiom-20170501/src/algebra/QCMPACK.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 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | )abbrev package QCMPACK QuasiComponentPackage
++ Author: Marc Moreno Maza <marc@nag.co.uk>
++ Date Created: 08/30/1998
++ Date Last Updated: 12/16/1998
++ References :
++ [1] D. LAZARD "A new method for solving algebraic systems of
++ positive dimension" Discr. App. Math. 33:147-160,1991
++ [2] M. MORENO MAZA "Calculs de pgcd au-dessus des tours
++ d'extensions simples et resolution des systemes d'equations
++ algebriques" These, Universite P.etM. Curie, Paris, 1997.
++ [3] M. MORENO MAZA "A new algorithm for computing triangular
++ decomposition of algebraic varieties" NAG Tech. Rep. 4/98.
++ Description:
++ A package for removing redundant quasi-components and redundant
++ branches when decomposing a variety by means of quasi-components
++ of regular triangular sets.
QuasiComponentPackage(R,E,V,P,TS) : SIG == CODE where
R : GcdDomain
E : OrderedAbelianMonoidSup
V : OrderedSet
P : RecursivePolynomialCategory(R,E,V)
TS : RegularTriangularSetCategory(R,E,V,P)
N ==> NonNegativeInteger
Z ==> Integer
B ==> Boolean
S ==> String
LP ==> List P
PtoP ==> P -> P
PS ==> GeneralPolynomialSet(R,E,V,P)
PWT ==> Record(val : P, tower : TS)
BWT ==> Record(val : Boolean, tower : TS)
LpWT ==> Record(val : (List P), tower : TS)
Branch ==> Record(eq: List P, tower: TS, ineq: List P)
UBF ==> Union(Branch,"failed")
Split ==> List TS
Key ==> Record(left:TS, right:TS)
Entry ==> Boolean
H ==> TabulatedComputationPackage(Key, Entry)
polsetpack ==> PolynomialSetUtilitiesPackage(R,E,V,P)
SIG ==> with
startTable! : (S,S,S) -> Void
++ \axiom{startTableGcd!(s1,s2,s3)}
++ is an internal subroutine, exported only for developement.
stopTable! : () -> Void
++ \axiom{stopTableGcd!()}
++ is an internal subroutine, exported only for developement.
supDimElseRittWu? : (TS,TS) -> Boolean
++ \axiom{supDimElseRittWu(ts,us)} returns true iff \axiom{ts}
++ has less elements than \axiom{us} otherwise if \axiom{ts}
++ has higher rank than \axiom{us} w.r.t. Riit and Wu ordering.
algebraicSort : Split -> Split
++ \axiom{algebraicSort(lts)} sorts \axiom{lts} w.r.t
++ supDimElseRittWu?
moreAlgebraic? : (TS,TS) -> Boolean
++ \axiom{moreAlgebraic?(ts,us)} returns false iff \axiom{ts}
++ and \axiom{us} are both empty, or \axiom{ts}
++ has less elements than \axiom{us}, or some variable is
++ algebraic w.r.t. \axiom{us} and is not w.r.t. \axiom{ts}.
subTriSet? : (TS,TS) -> Boolean
++ \axiom{subTriSet?(ts,us)} returns true iff \axiom{ts} is
++ a sub-set of \axiom{us}.
subPolSet? : (LP, LP) -> Boolean
++ \axiom{subPolSet?(lp1,lp2)} returns true iff \axiom{lp1} is
++ a sub-set of \axiom{lp2}.
internalSubPolSet? : (LP, LP) -> Boolean
++ \axiom{internalSubPolSet?(lp1,lp2)} returns true iff \axiom{lp1} is
++ a sub-set of \axiom{lp2} assuming that these lists are sorted
++ increasingly w.r.t.
++ infRittWu? from RecursivePolynomialCategory.
internalInfRittWu? : (LP, LP) -> Boolean
++ \axiom{internalInfRittWu?(lp1,lp2)}
++ is an internal subroutine, exported only for developement.
infRittWu? : (LP, LP) -> Boolean
++ \axiom{infRittWu?(lp1,lp2)}
++ is an internal subroutine, exported only for developement.
internalSubQuasiComponent? : (TS,TS) -> Union(Boolean,"failed")
++ \axiom{internalSubQuasiComponent?(ts,us)} returns a
++ boolean \spad{b} value if the fact that the regular
++ zero set of \axiom{us} contains that of
++ \axiom{ts} can be decided (and in that case \axiom{b} gives this
++ inclusion) otherwise returns \axiom{"failed"}.
subQuasiComponent? : (TS,TS) -> Boolean
++ \axiom{subQuasiComponent?(ts,us)} returns true iff
++ internalSubQuasiComponent?
++ returs true.
subQuasiComponent? : (TS,Split) -> Boolean
++ \axiom{subQuasiComponent?(ts,lus)} returns true iff
++ \axiom{subQuasiComponent?(ts,us)} holds for one \spad{us}
++ in \spad{lus}.
removeSuperfluousQuasiComponents : Split -> Split
++ \axiom{removeSuperfluousQuasiComponents(lts)} removes
++ from \axiom{lts} any \spad{ts} such that
++ \axiom{subQuasiComponent?(ts,us)} holds for
++ another \spad{us} in \axiom{lts}.
subCase? : (LpWT,LpWT) -> Boolean
++ \axiom{subCase?(lpwt1,lpwt2)}
++ is an internal subroutine, exported only for developement.
removeSuperfluousCases : List LpWT -> List LpWT
++ \axiom{removeSuperfluousCases(llpwt)}
++ is an internal subroutine, exported only for developement.
prepareDecompose : (LP, List(TS),B,B) -> List Branch
++ \axiom{prepareDecompose(lp,lts,b1,b2)}
++ is an internal subroutine, exported only for developement.
branchIfCan : (LP,TS,LP,B,B,B,B,B) -> Union(Branch,"failed")
++ \axiom{branchIfCan(leq,ts,lineq,b1,b2,b3,b4,b5)}
++ is an internal subroutine, exported only for developement.
CODE ==> add
squareFreeFactors(lp: LP): LP ==
lsflp: LP := []
for p in lp repeat
lsfp := squareFreeFactors(p)$polsetpack
lsflp := concat(lsfp,lsflp)
sort(infRittWu?,removeDuplicates lsflp)
startTable!(ok: S, ko: S, domainName: S): Void ==
initTable!()$H
if (not empty? ok) and (not empty? ko) then printInfo!(ok,ko)$H
if (not empty? domainName) then startStats!(domainName)$H
void()
stopTable!(): Void ==
if makingStats?()$H then printStats!()$H
clearTable!()$H
supDimElseRittWu? (ts:TS,us:TS): Boolean ==
#ts < #us => true
#ts > #us => false
lp1 :LP := members(ts)
lp2 :LP := members(us)
while (not empty? lp1)
and (not infRittWu?(first(lp2),first(lp1))) repeat
lp1 := rest lp1
lp2 := rest lp2
not empty? lp1
algebraicSort (lts:Split): Split ==
lts := removeDuplicates lts
sort(supDimElseRittWu?,lts)
moreAlgebraic?(ts:TS,us:TS): Boolean ==
empty? ts => empty? us
empty? us => true
#ts < #us => false
for p in (members us) repeat
not algebraic?(mvar(p),ts) => return false
true
subTriSet?(ts:TS,us:TS): Boolean ==
empty? ts => true
empty? us => false
mvar(ts) > mvar(us) => false
mvar(ts) < mvar(us) => subTriSet?(ts,rest(us)::TS)
first(ts)::P = first(us)::P => subTriSet?(rest(ts)::TS,rest(us)::TS)
false
internalSubPolSet?(lp1: LP, lp2: LP): Boolean ==
empty? lp1 => true
empty? lp2 => false
associates?(first lp1, first lp2) =>
internalSubPolSet?(rest lp1, rest lp2)
infRittWu?(first lp1, first lp2) => false
internalSubPolSet?(lp1, rest lp2)
subPolSet?(lp1: LP, lp2: LP): Boolean ==
lp1 := sort(infRittWu?, lp1)
lp2 := sort(infRittWu?, lp2)
internalSubPolSet?(lp1,lp2)
infRittWu?(lp1: LP, lp2: LP): Boolean ==
lp1 := sort(infRittWu?, lp1)
lp2 := sort(infRittWu?, lp2)
internalInfRittWu?(lp1,lp2)
internalInfRittWu?(lp1: LP, lp2: LP): Boolean ==
empty? lp1 => not empty? lp2
empty? lp2 => false
infRittWu?(first lp1, first lp2)$P => true
infRittWu?(first lp2, first lp1)$P => false
infRittWu?(rest lp1, rest lp2)$$
subCase? (lpwt1:LpWT,lpwt2:LpWT): Boolean ==
-- ASSUME lpwt.{1,2}.val is sorted w.r.t. infRittWu?
not internalSubPolSet?(lpwt2.val, lpwt1.val) => false
subQuasiComponent?(lpwt1.tower,lpwt2.tower)
internalSubQuasiComponent?(ts:TS,us:TS): Union(Boolean,"failed") ==
-- "failed" is false iff saturate(us) is radical
subTriSet?(us,ts) => true
not moreAlgebraic?(ts,us) => false::Union(Boolean,"failed")
for p in (members us) repeat
mdeg(p) < mdeg(select(ts,mvar(p))::P) =>
return("failed"::Union(Boolean,"failed"))
for p in (members us) repeat
not zero? initiallyReduce(p,ts) =>
return("failed"::Union(Boolean,"failed"))
lsfp := squareFreeFactors(initials us)
for p in lsfp repeat
not invertible?(p,ts)@B =>
return(false::Union(Boolean,"failed"))
true::Union(Boolean,"failed")
subQuasiComponent?(ts:TS,us:TS): Boolean ==
k: Key := [ts, us]
e := extractIfCan(k)$H
e case Entry => e::Entry
ubf: Union(Boolean,"failed") := internalSubQuasiComponent?(ts,us)
b: Boolean := (ubf case Boolean) and (ubf::Boolean)
insert!(k,b)$H
b
subQuasiComponent?(ts:TS,lus:Split): Boolean ==
for us in lus repeat
subQuasiComponent?(ts,us)@B => return true
false
removeSuperfluousCases (cases:List LpWT) ==
#cases < 2 => cases
toSee :=
sort((x:LpWT,y:LpWT):Boolean +->
supDimElseRittWu?(x.tower,y.tower),cases)
lpwt1,lpwt2 : LpWT
toSave,headmaxcases,maxcases,copymaxcases : List LpWT
while not empty? toSee repeat
lpwt1 := first toSee
toSee := rest toSee
toSave := []
for lpwt2 in toSee repeat
if subCase?(lpwt1,lpwt2)
then
lpwt1 := lpwt2
else
if not subCase?(lpwt2,lpwt1)
then
toSave := cons(lpwt2,toSave)
if empty? maxcases
then
headmaxcases := [lpwt1]
maxcases := headmaxcases
else
copymaxcases := maxcases
while (not empty? copymaxcases) and _
(not subCase?(lpwt1,first(copymaxcases))) repeat
copymaxcases := rest copymaxcases
if empty? copymaxcases
then
setrest!(headmaxcases,[lpwt1])
headmaxcases := rest headmaxcases
toSee := reverse toSave
maxcases
removeSuperfluousQuasiComponents(lts: Split): Split ==
lts := removeDuplicates lts
#lts < 2 => lts
toSee := algebraicSort lts
toSave,headmaxlts,maxlts,copymaxlts : Split
while not empty? toSee repeat
ts := first toSee
toSee := rest toSee
toSave := []
for us in toSee repeat
if subQuasiComponent?(ts,us)@B
then
ts := us
else
if not subQuasiComponent?(us,ts)@B
then
toSave := cons(us,toSave)
if empty? maxlts
then
headmaxlts := [ts]
maxlts := headmaxlts
else
copymaxlts := maxlts
while (not empty? copymaxlts) and _
(not subQuasiComponent?(ts,first(copymaxlts))@B) repeat
copymaxlts := rest copymaxlts
if empty? copymaxlts
then
setrest!(headmaxlts,[ts])
headmaxlts := rest headmaxlts
toSee := reverse toSave
algebraicSort maxlts
removeAssociates (lp:LP):LP ==
removeDuplicates [primitivePart(p) for p in lp]
branchIfCan(leq: LP,ts: TS,lineq: LP, b1:B,b2:B,b3:B,b4:B,b5:B):UBF ==
-- ASSUME pols in leq are squarefree and mainly primitive
-- if b1 then CLEAN UP leq
-- if b2 then CLEAN UP lineq
-- if b3 then SEARCH for ZERO in lineq with leq
-- if b4 then SEARCH for ZERO in lineq with ts
-- if b5 then SEARCH for ONE in leq with lineq
if b1
then
leq := removeAssociates(leq)
leq := remove(zero?,leq)
any?(ground?,leq) =>
return("failed"::Union(Branch,"failed"))
if b2
then
any?(zero?,lineq) =>
return("failed"::Union(Branch,"failed"))
lineq := removeRedundantFactors(lineq)$polsetpack
if b3
then
ps: PS := construct(leq)$PS
for q in lineq repeat
zero? remainder(q,ps).polnum =>
return("failed"::Union(Branch,"failed"))
(empty? leq) or (empty? lineq) => ([leq, ts, lineq]$Branch)::UBF
if b4
then
for q in lineq repeat
zero? initiallyReduce(q,ts) =>
return("failed"::Union(Branch,"failed"))
if b5
then
newleq: LP := []
for p in leq repeat
for q in lineq repeat
if mvar(p) = mvar(q)
then
g := gcd(p,q)
newp := (p exquo g)::P
ground? newp =>
return("failed"::Union(Branch,"failed"))
newleq := cons(newp,newleq)
else
newleq := cons(p,newleq)
leq := newleq
leq := sort(infRittWu?, removeDuplicates leq)
([leq, ts, lineq]$Branch)::UBF
prepareDecompose(lp: LP, lts: List(TS), b1: B, b2: B): List Branch ==
-- if b1 then REMOVE REDUNDANT COMPONENTS in lts
-- if b2 then SPLIT the input system with squareFree
lp := sort(infRittWu?, remove(zero?,removeAssociates(lp)))
any?(ground?,lp) => []
empty? lts => []
if b1 then lts := removeSuperfluousQuasiComponents lts
not b2 =>
[[lp,ts,squareFreeFactors(initials ts)]$Branch for ts in lts]
toSee: List Branch
lq: LP := []
toSee := [[lq,ts,squareFreeFactors(initials ts)]$Branch for ts in lts]
empty? lp => toSee
for p in lp repeat
lsfp := squareFreeFactors(p)$polsetpack
branches: List Branch := []
lq := []
for f in lsfp repeat
for branch in toSee repeat
leq : LP := branch.eq
ts := branch.tower
lineq : LP := branch.ineq
ubf1: UBF := branchIfCan(leq,ts,lq,false,false,true,true,true)@UBF
ubf1 case "failed" => "leave"
ubf2: UBF :=
branchIfCan([f],ts,lineq,false,false,true,true,true)@UBF
ubf2 case "failed" => "leave"
leq := sort(infRittWu?,removeDuplicates concat(ubf1.eq,ubf2.eq))
lineq :=
sort(infRittWu?,removeDuplicates concat(ubf1.ineq,ubf2.ineq))
newBranch :=
branchIfCan(leq,ts,lineq,false,false,false,false,false)
branches:= cons(newBranch::Branch,branches)
lq := cons(f,lq)
toSee := branches
sort((x,y) +-> supDimElseRittWu?(x.tower,y.tower),toSee)
|