From c3380e97a2214053a188aebc664d8a12cb176aa0 Mon Sep 17 00:00:00 2001 From: Waldek Hebisch Date: Tue, 23 Jul 2024 01:45:02 +0200 Subject: [PATCH] Add more explicit imports --- ChangeLog | 4 ++++ src/algebra/alg_top.spad | 11 +++++++++++ src/algebra/algfact.spad | 3 +++ src/algebra/algfunc.spad | 6 ++++++ src/algebra/charpol.spad | 2 ++ src/algebra/combfunc.spad | 4 ++++ src/algebra/constant.spad | 8 ++++++++ src/algebra/contfrac.spad | 1 + src/algebra/cra.spad | 2 ++ src/algebra/crfp.spad | 1 + src/algebra/cycles.spad | 2 ++ src/algebra/cyclo.spad | 2 ++ src/algebra/cyldec.spad | 6 ++++++ src/algebra/fmt.spad | 6 ++++++ src/algebra/gaussian.spad | 1 + src/algebra/jet.spad | 2 ++ src/algebra/logic.spad | 4 ++++ src/algebra/mkfunc.spad | 2 ++ src/algebra/naalg.spad | 2 ++ src/algebra/numsolve.spad | 1 + src/algebra/outform.spad | 2 ++ src/algebra/sf.spad | 2 ++ src/algebra/tree.spad | 3 +++ 23 files changed, 77 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3d0931963..f183dd439 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2024-07-23 Waldek Hebisch + + * src/algebra/*: Add more explicit imports + 2024-07-21 Frederic Chapoton * src/*: Spelling fixes diff --git a/src/algebra/alg_top.spad b/src/algebra/alg_top.spad index d08365faf..24e60e0f7 100644 --- a/src/algebra/alg_top.spad +++ b/src/algebra/alg_top.spad @@ -230,6 +230,8 @@ FacetCategory() : Category == Definition where add + import from NNI + -- is empty if it contains no vertices or if multiplier is zero empty?(orf : %) : Boolean == if order(orf) = 0 then return true @@ -1004,6 +1006,9 @@ CubicalFacet() : Exports == Impl where -- treat it as an integer. Rep := Record(mul : Integer, fac : List(Segment(Integer))) + import from Integer + import from List(Segment(Integer)) + -- Constructor for cubical facet -- intervals are always stored in low..high order -- orientation is calculated by the number of intervals that have @@ -1401,6 +1406,8 @@ ChainComplex() : Exports == Impl where transition_matrices(a : %) : List(Matrix(Integer)) == a::Rep + import from PrintPackage + -- true if this is a valid chain complex, that is: -- 1) maps compose -- 2) product of adjacent maps is zero @@ -1544,6 +1551,8 @@ CoChainComplex(VS : AbelianGroup) : Exports == Impl where tm := reverse!(tm) map(transpose, tm) + import from PrintPackage + -- true if this is a valid cochain complex, that is: -- 1) maps compose -- 2) product of adjacent maps is zero @@ -2531,6 +2540,8 @@ FiniteCubicalComplex(VS : AbelianGroup) : Exports == Impl where Impl ==> add + import from List(Segment(Integer)) + -- Representation holds whole Cubical Complex. This consists of -- a vertex set, here represented as a vertex list so that we can -- index it. diff --git a/src/algebra/algfact.spad b/src/algebra/algfact.spad index 6d742a7ea..07974d352 100644 --- a/src/algebra/algfact.spad +++ b/src/algebra/algfact.spad @@ -178,6 +178,9 @@ AlgFactor(UP) : Exports == Implementation where liftpoly : UPQ -> UP irred? : UP -> Boolean + import from List(AN) + import from Factored(UP) + liftpoly p == map(x +-> x::AN, p)$UPCF2(Q, UPQ, AN, UP) downpoly p == map(x +-> retract(x)@Q, p)$UPCF2(AN, UP , Q, UPQ) ifactor(p, l) == (fact(p pretend UP, l)) pretend Factored(SUP) diff --git a/src/algebra/algfunc.spad b/src/algebra/algfunc.spad index e4774815f..c4124b4ba 100644 --- a/src/algebra/algfunc.spad +++ b/src/algebra/algfunc.spad @@ -325,6 +325,12 @@ AlgebraicFunction(R, F) : Exports == Implementation where belong? op == has?(op, ALGOP) or is?(op, '%root_sum) dalg l == second(l)::OutputForm + import from UP + import from Fraction(UP) + import from Integer + import from SparseMultivariatePolynomial(R, Kernel(F)) + import from List(F) + rootOf(p, x) == k := kernel(x)$K (r := retractIfCan(p)@Union(F, "failed")) case "failed" => diff --git a/src/algebra/charpol.spad b/src/algebra/charpol.spad index 4eb953b0b..6a880914d 100644 --- a/src/algebra/charpol.spad +++ b/src/algebra/charpol.spad @@ -109,6 +109,8 @@ CharacteristicPolynomial3(R : IntegralDomain) : Exports == Implementation where Implementation ==> add + import from F + char_pol_via_interpolation0(m : Mat, ld : List(R)) : UpF == n := ncols(m) n ~= nrows(m) => error "matrix not square" diff --git a/src/algebra/combfunc.spad b/src/algebra/combfunc.spad index da2baa585..31b2ea7ce 100644 --- a/src/algebra/combfunc.spad +++ b/src/algebra/combfunc.spad @@ -103,6 +103,10 @@ CombinatorialFunction(R, F) : Exports == Implementation where Implementation ==> add + import from List(Symbol) + import from BasicOperator + import from Segment(F) + COMB := 'comb ifact : F -> F diff --git a/src/algebra/constant.spad b/src/algebra/constant.spad index 526bde8bb..fb6e8dea1 100644 --- a/src/algebra/constant.spad +++ b/src/algebra/constant.spad @@ -90,6 +90,11 @@ AlgebraicNumber() : Exports == Implementation where makeUnivariate(p : P, k : Kernel %) : SUP % == map(x +-> x::%, univariate(p, k))$SparseUnivariatePolynomialFunctions2(P, %) + + import from P + import from List(K) + import from Fraction(Z) + -- public a, b : % differentiate(x : %) : % == 0 @@ -148,13 +153,16 @@ AlgebraicNumber() : Exports == Implementation where coerceToType(convert(x pretend Rep)$Rep)$InputFormFunctions1(%) convert(x : %) : Float == + import from Expression(Float) retract map(y +-> y::Float, x pretend FE)$ExpressionFunctions2(Z, Float) convert(x : %) : DoubleFloat == + import from Expression(DoubleFloat) retract map(y +-> y::DoubleFloat, x pretend FE)$ExpressionFunctions2(Z, DoubleFloat) convert(x : %) : Complex(Float) == + import from Expression(Complex(Float)) retract map(y +-> y::Complex(Float), x pretend FE)$ExpressionFunctions2(Z, Complex Float) diff --git a/src/algebra/contfrac.spad b/src/algebra/contfrac.spad index 3862a0f70..4b7f1bc5a 100644 --- a/src/algebra/contfrac.spad +++ b/src/algebra/contfrac.spad @@ -118,6 +118,7 @@ ContinuedFraction(R) : Exports == Implementation where Rep := Record(value : Record(whole : R, fract : Str), reduced? : Boolean) import from Str + import from Stream(Q) genFromSequence : Stream Q -> % genReducedForm : (Q, Stream Q, MT) -> Stream Rec diff --git a/src/algebra/cra.spad b/src/algebra/cra.spad index 1ab70beed..9fcb95724 100644 --- a/src/algebra/cra.spad +++ b/src/algebra/cra.spad @@ -20,6 +20,8 @@ CRApackage(R : EuclideanDomain) : Exports == Implementation where ++ multiEuclideanTree(l, r) \undocumented{} Implementation == add + import from Integer + BB := BalancedBinaryTree(R) x : BB diff --git a/src/algebra/crfp.spad b/src/algebra/crfp.spad index 3030a16c4..65fa3b3d3 100644 --- a/src/algebra/crfp.spad +++ b/src/algebra/crfp.spad @@ -145,6 +145,7 @@ ComplexRootFindingPackage(R, UP) : public == private where private ==> add + import from List(UP) Rep := ModMonic(C, UP) diff --git a/src/algebra/cycles.spad b/src/algebra/cycles.spad index cba6e107c..09898d3bc 100644 --- a/src/algebra/cycles.spad +++ b/src/algebra/cycles.spad @@ -90,6 +90,8 @@ CycleIndicators : Exports == Implementation where Implementation ==> add import from PartitionsAndPermutations import from IntegerNumberTheoryFunctions + import from Factored(Integer) + import from Fraction(Integer) trm : PTN -> SPOL RN trm pt == monomial(inv(pdct(pt) :: RN), pt) diff --git a/src/algebra/cyclo.spad b/src/algebra/cyclo.spad index 902d26db5..b69273e9a 100644 --- a/src/algebra/cyclo.spad +++ b/src/algebra/cyclo.spad @@ -33,6 +33,8 @@ CyclotomicUtilities : Exports == Implementation where Implementation ==> add + import from Factored(Integer) + lU ==> Union(List(Integer), "failed") recursive_check_even : (pA, Integer, Integer, Integer, diff --git a/src/algebra/cyldec.spad b/src/algebra/cyldec.spad index 160f9b609..52f2bf32a 100644 --- a/src/algebra/cyldec.spad +++ b/src/algebra/cyldec.spad @@ -30,6 +30,8 @@ CylindricalAlgebraicDecompositionUtilities(R, P) : PUB == PRIV where PRIV == add + import from Integer + gcdBasisAdd : (P, List(P)) -> List(P) -- add one polynomial to list of pairwise relatively prime polynomials @@ -212,6 +214,8 @@ Cell(TheField) : PUB == PRIV where RepT ==> List(SCELL) + import from SCELL + simpleCells(c) == c pretend RepT Rep := RepT @@ -322,6 +326,8 @@ CylindricalAlgebraicDecompositionPackage(TheField) : PUB == PRIV where PACK1 ==> CylindricalAlgebraicDecompositionUtilities(ThePols, RUP) PACK2 ==> CylindricalAlgebraicDecompositionUtilities(TheField, BUP) + import from Integer + specialise(lpols, cell) == lpols = [] => error("specialise: empty list of pols") sp := samplePoint(cell) diff --git a/src/algebra/fmt.spad b/src/algebra/fmt.spad index 8035d096e..e78cdaae7 100644 --- a/src/algebra/fmt.spad +++ b/src/algebra/fmt.spad @@ -1333,6 +1333,12 @@ of a \spad{ROW} operator without the wrapping \spad{MATRIX} operator. minPrecedence(): Z == 0 maxPrecedence(): Z == 10000 + import from Character + import from Symbol + import from Integer + import from List(OutputForm) + import from String + numberOfPrimes(a2: E): Z == -- second argument of a PRIME expression import from OutputFormTools atom? a2 => -- Is should be a number of commas. diff --git a/src/algebra/gaussian.spad b/src/algebra/gaussian.spad index e1423e080..b0a32eb59 100644 --- a/src/algebra/gaussian.spad +++ b/src/algebra/gaussian.spad @@ -520,6 +520,7 @@ ComplexPatternMatch(R, S, CS) : C == T where import from PatternMatchPushDown(R, S, CS) import from PatternMatchResultFunctions2(R, PS, CS) import from PatternMatchResultFunctions2(R, CS, PS) + import from Integer ivar : PS := '%i::PS diff --git a/src/algebra/jet.spad b/src/algebra/jet.spad index 22a01efda..c2c9df905 100644 --- a/src/algebra/jet.spad +++ b/src/algebra/jet.spad @@ -4812,6 +4812,8 @@ CartanKuranishi(JB : JBC, D : JBFC) : Cat == Def where remember : Table(NREC, NNI) := dictionary() + import from List(NNI) + stirling(i : NNI, k : NNI, q : NNI) : NNI == -- Evaluates the symmetric polynomial of degree k in i variables -- for the values q+1, ..., q+i. diff --git a/src/algebra/logic.spad b/src/algebra/logic.spad index 633644f3e..c286ca4a2 100644 --- a/src/algebra/logic.spad +++ b/src/algebra/logic.spad @@ -779,6 +779,8 @@ Poset(S) : Category == Definition where ++ \url{http://www.euclideanspace.com/prog/scratchpad/mycode/discrete/logic/moebius/} add + import from List(S) + import from List(List(Boolean)) -- adds an object to this poset addObject!(s : %, n : S) : % == @@ -4134,6 +4136,8 @@ BitStreamFrame() : Exports == Impl where hash(s : %) : SingleInteger == 0$SingleInteger + import from Integer + -- returns true if x equals y -- this is equality and not isomorphism -- that is it returns true only if exact index values and names are used diff --git a/src/algebra/mkfunc.spad b/src/algebra/mkfunc.spad index 1e97b64dd..892ed1de9 100644 --- a/src/algebra/mkfunc.spad +++ b/src/algebra/mkfunc.spad @@ -122,6 +122,8 @@ InputForm(): 'LET)@%, a, conv(concat(first l, [u.symb for u in l2]))@%]$List(%))@%), a] + import from Symbol + strsym s == string? s => string s symbol? s => string symbol s diff --git a/src/algebra/naalg.spad b/src/algebra/naalg.spad index 5bd43351e..2d408b846 100644 --- a/src/algebra/naalg.spad +++ b/src/algebra/naalg.spad @@ -96,6 +96,8 @@ AlgebraGivenByStructuralConstants(R : CommutativeRing, n : PositiveInteger, _ v(i) := x(i) directProduct(v) + import from OV + construct(l : List(Term)) : % == v : Vector R := new(n, 0) for el in l repeat diff --git a/src/algebra/numsolve.spad b/src/algebra/numsolve.spad index ec3360958..d5fe102d7 100644 --- a/src/algebra/numsolve.spad +++ b/src/algebra/numsolve.spad @@ -38,6 +38,7 @@ ComplexRootPackage(UP, Par) : T == C where C == add import from Factored(UP) + import from Factored(SparseUnivariatePolynomial(Complex(Integer))) complexZeros(p : UP, eps : Par) : List CP == x1 : Symbol() := new() diff --git a/src/algebra/outform.spad b/src/algebra/outform.spad index 133820f2f..a246b91fd 100644 --- a/src/algebra/outform.spad +++ b/src/algebra/outform.spad @@ -469,6 +469,8 @@ OutputForm() : Join(SetCategory, ConvertibleTo InputForm) with outputForm s == sform concat(quote()$Character, concat(s, quote()$Character)) + import from Character + convert(a: %): InputForm == b: SExpression := a pretend SExpression if atom?(b)$SExpression then diff --git a/src/algebra/sf.spad b/src/algebra/sf.spad index 9145c3030..355751787 100644 --- a/src/algebra/sf.spad +++ b/src/algebra/sf.spad @@ -494,6 +494,8 @@ DoubleFloat() : Join(FloatingPointSystem, DifferentialRing, OpenMath, airyBiPrime(x) == airyBiPrime(sfx)$SFSFUN2 pretend % digamma(x) == polygamma(0, sfx)$SFSFUN2 pretend % + import from DoubleFloat + polygamma(x, y) == if (n := retractIfCan(sfx)@Union(Integer, "failed")) case Integer _ and n >= 0 then diff --git a/src/algebra/tree.spad b/src/algebra/tree.spad index 73f503197..8d1d886dd 100644 --- a/src/algebra/tree.spad +++ b/src/algebra/tree.spad @@ -219,6 +219,9 @@ BinaryTree(S : SetCategory) : Exports == Implementation where empty? t => error "binaryTree:no value to set" setvalue!(first(t::Rep), nd) nd + + import from Tree(S) + setleft!(t1, t2) == empty? t1 => error "binaryTree:no left to set" setchildren!(first(t1::Rep), t2::Rep)