diff options
Diffstat (limited to 'src/algebra')
49 files changed, 209 insertions, 220 deletions
diff --git a/src/algebra/algfunc.spad.pamphlet b/src/algebra/algfunc.spad.pamphlet index 9d70445d..abe4bd82 100644 --- a/src/algebra/algfunc.spad.pamphlet +++ b/src/algebra/algfunc.spad.pamphlet @@ -162,7 +162,7 @@ AlgebraicallyClosedField(): Category == Join(Field,RadicalCategory) with ++ Description: ++ Model for algebraically closed function spaces. ++ Keywords: algebraic, closure, field. -AlgebraicallyClosedFunctionSpace(R:Join(OrderedSet, IntegralDomain)): +AlgebraicallyClosedFunctionSpace(R: IntegralDomain): Category == Join(AlgebraicallyClosedField, FunctionSpace R) with rootOf : $ -> $ ++ rootOf(p) returns y such that \spad{p(y) = 0}. @@ -296,7 +296,7 @@ test and give $$1/(-2)^(1/n) \ne (-1/2)^(1/n)$$ ++ Keywords: algebraic, function. AlgebraicFunction(R, F): Exports == Implementation where - R: Join(OrderedSet, IntegralDomain) + R: IntegralDomain F: FunctionSpace R SE ==> Symbol @@ -478,7 +478,7 @@ AlgebraicFunction(R, F): Exports == Implementation where if R has imaginary:() -> R then iroot(r, n) == nthRoot(r, n)::F else iroot(r, n) == - odd? n or r >= 0 => nthRoot(r, n)::F + odd? n or not before?(r,0) => nthRoot(r, n)::F iroot0(r, n) else iroot(r, n) == iroot0(r, n) diff --git a/src/algebra/combfunc.spad.pamphlet b/src/algebra/combfunc.spad.pamphlet index 41fe5af5..25e7d3e4 100644 --- a/src/algebra/combfunc.spad.pamphlet +++ b/src/algebra/combfunc.spad.pamphlet @@ -60,7 +60,7 @@ to reduce to zero. CombinatorialFunction(R, F): Exports == Implementation where - R: Join(OrderedSet, IntegralDomain) + R: IntegralDomain F: FunctionSpace R OP ==> BasicOperator @@ -518,7 +518,7 @@ dummy variable is introduced to make the indexing variable \lq local\rq. if R has RetractableTo(Z) and F has Algebra(Fraction(Z)) then iibinom l == (s:=retractIfCan(first l-second l)@Union(R,"failed")) case R and - (t:=retractIfCan(s)@Union(Z,"failed")) case Z and s>0=> + (t:=retractIfCan(s)@Union(Z,"failed")) case Z and t > 0 => ans:=1::F for i in 1..t repeat ans:=ans*(second l+i::R::F) @@ -616,7 +616,7 @@ equality. ++ Description: Provides some special functions over an integral domain. ++ Keywords: special, function. FunctionalSpecialFunction(R, F): Exports == Implementation where - R: Join(OrderedSet, IntegralDomain) + R: IntegralDomain F: FunctionSpace R OP ==> BasicOperator @@ -716,7 +716,7 @@ FunctionalSpecialFunction(R, F): Exports == Implementation where iabs x == zero? x => 0 is?(x, opabs) => x - x < 0 => kernel(opabs, -x) + before?(x,0) => kernel(opabs, -x) kernel(opabs, x) -- Could put more conditional special rules for other functions here @@ -805,7 +805,7 @@ FunctionalSpecialFunction(R, F): Exports == Implementation where ++ Date Last Updated: 19 April 1991 ++ Description: computes sums of top-level expressions; FunctionSpaceSum(R, F): Exports == Implementation where - R: Join(IntegralDomain, OrderedSet, + R: Join(IntegralDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer) F: Join(FunctionSpace R, CombinatorialOpsCategory, AlgebraicallyClosedField, TranscendentalFunctionCategory) diff --git a/src/algebra/d03agents.spad.pamphlet b/src/algebra/d03agents.spad.pamphlet index 53085713..59ec9dfc 100644 --- a/src/algebra/d03agents.spad.pamphlet +++ b/src/algebra/d03agents.spad.pamphlet @@ -55,6 +55,10 @@ d03AgentsPackage(): E == I where sum(a:EDF,b:EDF):EDF == a+b + greater(x: EDF, y: EDF): EDF == + before?(x,y) => y + x + varList(s:Symbol,n:NonNegativeInteger):LS == [subscript(s,[t::OutputForm]) for t in expand([1..n])$Segment(Integer)] @@ -69,7 +73,7 @@ d03AgentsPackage(): E == I where ls := variables(reduce(sum,p)) le := [equation(u::EDF,v)$EEDF for u in ls for v in [x::EDF,y::EDF]] l := [eval(u,le)$EDF for u in p] - max(l.4,l.5) < 20 * max(l.1,max(l.2,l.3)) + before?(greater(l.4,l.5), 20 * greater(l.1,greater(l.2,l.3))) elliptic?(args:PDEB):Boolean == (args.st)="elliptic" => true diff --git a/src/algebra/defintef.spad.pamphlet b/src/algebra/defintef.spad.pamphlet index e4fb77e3..d4130460 100644 --- a/src/algebra/defintef.spad.pamphlet +++ b/src/algebra/defintef.spad.pamphlet @@ -21,7 +21,7 @@ ++ provides functions to compute definite ++ integrals of elementary functions. ElementaryFunctionDefiniteIntegration(R, F): Exports == Implementation where - R : Join(EuclideanDomain, OrderedSet, CharacteristicZero, + R : Join(EuclideanDomain, CharacteristicZero, RetractableTo Integer, LinearlyExplicitRingOver Integer) F : Join(TranscendentalFunctionCategory, PrimitiveFunctionCategory, AlgebraicallyClosedFunctionSpace R) diff --git a/src/algebra/defintrf.spad.pamphlet b/src/algebra/defintrf.spad.pamphlet index 421f1aa4..fc1c6e09 100644 --- a/src/algebra/defintrf.spad.pamphlet +++ b/src/algebra/defintrf.spad.pamphlet @@ -20,7 +20,7 @@ ++ \spadtype{DefiniteIntegrationTools} provides common tools used ++ by the definite integration of both rational and elementary functions. DefiniteIntegrationTools(R, F): Exports == Implementation where - R : Join(GcdDomain, OrderedSet, RetractableTo Integer, + R : Join(GcdDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer) F : Join(TranscendentalFunctionCategory, AlgebraicallyClosedFunctionSpace R) @@ -272,7 +272,7 @@ DefiniteIntegrationTools(R, F): Exports == Implementation where RationalFunctionDefiniteIntegration(R): Exports == Implementation where - R : Join(EuclideanDomain, OrderedSet, CharacteristicZero, + R : Join(EuclideanDomain, CharacteristicZero, RetractableTo Integer, LinearlyExplicitRingOver Integer) SE ==> Symbol diff --git a/src/algebra/degred.spad.pamphlet b/src/algebra/degred.spad.pamphlet index 59a6f220..6bd8d3f6 100644 --- a/src/algebra/degred.spad.pamphlet +++ b/src/algebra/degred.spad.pamphlet @@ -15,7 +15,7 @@ ++ This package \undocumented{} DegreeReductionPackage(R1, R2): Cat == Capsule where R1: Ring - R2: Join(IntegralDomain,OrderedSet) + R2: IntegralDomain I ==> Integer PI ==> PositiveInteger diff --git a/src/algebra/efstruc.spad.pamphlet b/src/algebra/efstruc.spad.pamphlet index 320842e5..381030eb 100644 --- a/src/algebra/efstruc.spad.pamphlet +++ b/src/algebra/efstruc.spad.pamphlet @@ -112,7 +112,7 @@ TangentExpansions(R:Field): Exports == Implementation where ++ which are not considered simplifications. ++ Keywords: elementary, function, structure. ElementaryFunctionStructurePackage(R,F): Exports == Implementation where - R : Join(IntegralDomain, OrderedSet, RetractableTo Integer, + R : Join(IntegralDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer) F : Join(AlgebraicallyClosedField, TranscendentalFunctionCategory, FunctionSpace R) @@ -506,7 +506,7 @@ ElementaryFunctionStructurePackage(R,F): Exports == Implementation where ++ F and FG should be the same type of function space. ++ Keywords: trigonometric, function, manipulation. InnerTrigonometricManipulations(R,F,FG): Exports == Implementation where - R : Join(IntegralDomain, OrderedSet) + R : IntegralDomain F : Join(FunctionSpace R, RadicalCategory, TranscendentalFunctionCategory) FG : Join(FunctionSpace Complex R, RadicalCategory, @@ -672,7 +672,7 @@ InnerTrigonometricManipulations(R,F,FG): Exports == Implementation where ++ trigonometric functions to complex exponentials and logarithms, and back. ++ Keywords: trigonometric, function, manipulation. TrigonometricManipulations(R, F): Exports == Implementation where - R : Join(GcdDomain, OrderedSet, RetractableTo Integer, + R : Join(GcdDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer) F : Join(AlgebraicallyClosedField, TranscendentalFunctionCategory, FunctionSpace R) @@ -816,7 +816,7 @@ TrigonometricManipulations(R, F): Exports == Implementation where ++ compute the real and imaginary parts of complex functions. ++ Keywords: complex, function, manipulation. ComplexTrigonometricManipulations(R, F): Exports == Implementation where - R : Join(IntegralDomain, OrderedSet, RetractableTo Integer) + R : Join(IntegralDomain, RetractableTo Integer) F : Join(AlgebraicallyClosedField, TranscendentalFunctionCategory, FunctionSpace Complex R) diff --git a/src/algebra/elemntry.spad.pamphlet b/src/algebra/elemntry.spad.pamphlet index e0f0c440..1b645e04 100644 --- a/src/algebra/elemntry.spad.pamphlet +++ b/src/algebra/elemntry.spad.pamphlet @@ -19,7 +19,7 @@ ++ Examples: )r EF INPUT ++ Description: Provides elementary functions over an integral domain. ElementaryFunction(R, F): Exports == Implementation where - R: Join(OrderedSet, IntegralDomain) + R: IntegralDomain F: Join(FunctionSpace R, RadicalCategory) B ==> Boolean @@ -610,7 +610,7 @@ ElementaryFunction(R, F): Exports == Implementation where iexp x == zero? x => 1 is?(x, oplog) => first argument kernel x - x < 0 and empty? variables x => inv iexp(-x) + before?(x,0) and empty? variables x => inv iexp(-x) h := inv(2::F) i := iisqrt1() s2 := h * iisqrt2() diff --git a/src/algebra/expexpan.spad.pamphlet b/src/algebra/expexpan.spad.pamphlet index 34ab10d2..346bf3eb 100644 --- a/src/algebra/expexpan.spad.pamphlet +++ b/src/algebra/expexpan.spad.pamphlet @@ -36,7 +36,7 @@ ++ in computing limits involving functions with essential singularities. ExponentialOfUnivariatePuiseuxSeries(FE,var,cen):_ Exports == Implementation where - FE : Join(Field,OrderedSet) + FE : Field var : Symbol cen : FE UPXS ==> UnivariatePuiseuxSeries(FE,var,cen) @@ -75,7 +75,7 @@ ExponentialOfUnivariatePuiseuxSeries(FE,var,cen):_ ordf < ordg => false (fCoef := coefficient(f,ordf)) = (gCoef := coefficient(g,ordg)) => reductum(f) < reductum(g) - fCoef < gCoef -- this is "random" if FE is EXPR INT + before?(fCoef,gCoef) -- this is "random" if FE is EXPR INT coerce(f:%):OutputForm == ("%e" :: OutputForm) ** ((coerce$Rep)(complete f)@OutputForm) @@ -107,7 +107,7 @@ ExponentialOfUnivariatePuiseuxSeries(FE,var,cen):_ ++ degree. UnivariatePuiseuxSeriesWithExponentialSingularity(R,FE,var,cen):_ Exports == Implementation where - R : Join(OrderedSet,RetractableTo Integer,_ + R : Join(RetractableTo Integer,_ LinearlyExplicitRingOver Integer,GcdDomain) FE : Join(AlgebraicallyClosedField,TranscendentalFunctionCategory,_ FunctionSpace R) @@ -381,7 +381,7 @@ UnivariatePuiseuxSeriesWithExponentialSingularity(R,FE,var,cen):_ ++ are quotients of sums, where each term in the sum is a univariate Puiseux ++ series times the exponential of a univariate Puiseux series. ExponentialExpansion(R,FE,var,cen): Exports == Implementation where - R : Join(OrderedSet,RetractableTo Integer,_ + R : Join(RetractableTo Integer,_ LinearlyExplicitRingOver Integer,GcdDomain) FE : Join(AlgebraicallyClosedField,TranscendentalFunctionCategory,_ FunctionSpace R) diff --git a/src/algebra/expr.spad.pamphlet b/src/algebra/expr.spad.pamphlet index cc82f5ca..85dc5a24 100644 --- a/src/algebra/expr.spad.pamphlet +++ b/src/algebra/expr.spad.pamphlet @@ -18,7 +18,7 @@ ++ Date Last Updated: October 1993 (P.Gianni), February 1995 (MB) ++ Description: Expressions involving symbolic functions. ++ Keywords: operator, kernel, function. -Expression(R:OrderedSet): Exports == Implementation where +Expression(R: SetCategory): Exports == Implementation where Q ==> Fraction Integer K ==> Kernel % MP ==> SparseMultivariatePolynomial(R, K) @@ -66,7 +66,8 @@ Expression(R:OrderedSet): Exports == Implementation where belong? op == true retNotUnit x == - (u := constantIfCan(k := retract(x)@K)) case R => u::R + R has OrderedSet and + (u := constantIfCan(k := retract(x)@K)) case R => u::R error "Not retractable" retNotUnitIfCan x == @@ -127,7 +128,7 @@ Expression(R:OrderedSet): Exports == Implementation where n = 1 => x simplifyPower(numerator x,n pretend Integer) / simplifyPower(denominator x,n pretend Integer) - x:% < y:% == x <$Rep y + before?(x:%,y:%) == before?(x,y)$Rep x:% = y:% == x =$Rep y numer x == numer(x)$Rep denom x == denom(x)$Rep @@ -375,7 +376,7 @@ Expression(R:OrderedSet): Exports == Implementation where x:% * y:% == x *$Rep y x:% + y:% == x +$Rep y x:% = y:% == x =$Rep y - x:% < y:% == x <$Rep y + before?(x:%,y:%) == before?(x,y)$Rep numer x == x@Rep coerce(p:MP):% == p @@ -437,7 +438,7 @@ Expression(R:OrderedSet): Exports == Implementation where 0 == 0$Rep x:% + y:% == x +$Rep y x:% = y:% == x =$Rep y - x:% < y:% == x <$Rep y + before?(x:%,y:%) == before?(x,y)$Rep coerce(k:K):% == coerce(k)$Rep kernels x == [f.gen for f in terms x] coerce(x:R):% == (zero? x => 0; constantKernel(x)::%) @@ -493,7 +494,7 @@ Expression(R:OrderedSet): Exports == Implementation where Rep := K - x:% < y:% == x <$Rep y + before?(x:%,y:%) == before?(x,y)$Rep x:% = y:% == x =$Rep y coerce(k:K):% == k kernels x == [x pretend K] @@ -562,7 +563,7 @@ PolynomialAN2Expression():Target == Implementation where ++ Description: Lifting of maps to Expressions. ++ Date Created: 16 Jan 1989 ++ Date Last Updated: 22 Jan 1990 -ExpressionFunctions2(R:OrderedSet, S:OrderedSet): +ExpressionFunctions2(R: SetCategory, S: SetCategory): Exports == Implementation where K ==> Kernel R F2 ==> FunctionSpaceFunctions2(R, Expression R, S, Expression S) @@ -589,7 +590,7 @@ ExpressionFunctions2(R:OrderedSet, S:OrderedSet): ++ Date Last Updated: 23 May 1990 ++ Keywords: pattern, matching. FunctionSpaceAttachPredicates(R, F, D): Exports == Implementation where - R: OrderedSet + R: SetCategory F: FunctionSpace R D: Type @@ -639,7 +640,7 @@ FunctionSpaceAttachPredicates(R, F, D): Exports == Implementation where ++ Date Last Updated: 23 May 1990 ++ Keywords: pattern, matching. FunctionSpaceAssertions(R, F): Exports == Implementation where - R: OrderedSet + R: SetCategory F: FunctionSpace R K ==> Kernel F @@ -837,7 +838,7 @@ Pi(): Exports == Implementation where ++ integer coefficients to any Expression type. ++ Date Created: 21 Feb 1990 ++ Date Last Updated: 21 Feb 1990 -PiCoercions(R:Join(OrderedSet, IntegralDomain)): with +PiCoercions(R: IntegralDomain): with coerce: Pi -> Expression R ++ coerce(f) returns f as an Expression(R). == add diff --git a/src/algebra/expr2ups.spad.pamphlet b/src/algebra/expr2ups.spad.pamphlet index fb0c2f6c..830ca944 100644 --- a/src/algebra/expr2ups.spad.pamphlet +++ b/src/algebra/expr2ups.spad.pamphlet @@ -27,7 +27,7 @@ ++ This package provides functions to convert functional expressions ++ to power series. ExpressionToUnivariatePowerSeries(R,FE): Exports == Implementation where - R : Join(GcdDomain,OrderedSet,RetractableTo Integer,_ + R : Join(GcdDomain,RetractableTo Integer,_ LinearlyExplicitRingOver Integer) FE : Join(AlgebraicallyClosedField,TranscendentalFunctionCategory,_ FunctionSpace R) diff --git a/src/algebra/exprode.spad.pamphlet b/src/algebra/exprode.spad.pamphlet index 8a9bf6d4..f6000408 100644 --- a/src/algebra/exprode.spad.pamphlet +++ b/src/algebra/exprode.spad.pamphlet @@ -19,7 +19,7 @@ ++ Description: Taylor series solutions of explicit ODE's; ++ Keywords: differential equation, ODE, Taylor series ExpressionSpaceODESolver(R, F): Exports == Implementation where - R: Join(OrderedSet, IntegralDomain, ConvertibleTo InputForm) + R: Join(IntegralDomain, ConvertibleTo InputForm) F: FunctionSpace R K ==> Kernel F diff --git a/src/algebra/fortran.spad.pamphlet b/src/algebra/fortran.spad.pamphlet index 25da16cc..77385b00 100644 --- a/src/algebra/fortran.spad.pamphlet +++ b/src/algebra/fortran.spad.pamphlet @@ -1176,7 +1176,7 @@ ThreeDimensionalMatrix(R) : Exports == Implementation where ++ domains into a FORTRAN subprogram called \axiom{f}. ++ These can then be translated into legal FORTRAN code. SimpleFortranProgram(R,FS): Exports == Implementation where - R : OrderedSet + R : SetCategory FS : FunctionSpace(R) FST ==> FortranScalarType diff --git a/src/algebra/fr.spad.pamphlet b/src/algebra/fr.spad.pamphlet index fc7ccdc9..082ff876 100644 --- a/src/algebra/fr.spad.pamphlet +++ b/src/algebra/fr.spad.pamphlet @@ -191,8 +191,6 @@ Factored(R: IntegralDomain): Exports == Implementation where empty? rest l => first l binary(convert(_*::Symbol)@InputForm, l)@InputForm - orderedR? := R has OrderedSet - -- Private function signatures: reciprocal : % -> % qexpand : % -> R @@ -288,7 +286,7 @@ Factored(R: IntegralDomain): Exports == Implementation where empty? x => empty() x := sort_!(LispLessP, x) x := SimplifyFactorization1(first x, rest x) - if orderedR? then x := sort_!(LispLessP, x) + x := sort!(LispLessP, x) x SimplifyFactorization1(f, x) == @@ -332,9 +330,7 @@ Factored(R: IntegralDomain): Exports == Implementation where qexpand u LispLessP(y, y1) == - orderedR? => y.fctr < y1.fctr - GGREATERP(y.fctr, y1.fctr)$Lisp => false - true + before?(y.fctr, y1.fctr) stricterFlag(fl1, fl2) == fl1 case "prime" => fl1 @@ -513,7 +509,7 @@ which causes wrong results as soon as units are involved, for example in f1 := rest f1 x1 := concat(y, x1) f3 := rest f3 - if orderedR? then x1 := sort_!(LispLessP, x1) + x1 := sort!(LispLessP, x1) mkFF(1, x1) else -- R not a GCD domain diff --git a/src/algebra/fraction.spad.pamphlet b/src/algebra/fraction.spad.pamphlet index 56d14743..604771b7 100644 --- a/src/algebra/fraction.spad.pamphlet +++ b/src/algebra/fraction.spad.pamphlet @@ -51,6 +51,7 @@ Localize(M:Module R, zero? x == zero? (x.num) -x== [-x.num,x.den] x=y == y.den*x.num = x.den*y.num + before?(x,y) == before?(y.den*x.num, x.den*y.num) numer x == x.num denom x == x.den if M has OrderedAbelianGroup then diff --git a/src/algebra/fs2expxp.spad.pamphlet b/src/algebra/fs2expxp.spad.pamphlet index ad344d99..c27917f6 100644 --- a/src/algebra/fs2expxp.spad.pamphlet +++ b/src/algebra/fs2expxp.spad.pamphlet @@ -27,7 +27,7 @@ ++ expansions. FunctionSpaceToExponentialExpansion(R,FE,x,cen):_ Exports == Implementation where - R : Join(GcdDomain,OrderedSet,RetractableTo Integer,_ + R : Join(GcdDomain,RetractableTo Integer,_ LinearlyExplicitRingOver Integer) FE : Join(AlgebraicallyClosedField,TranscendentalFunctionCategory,_ FunctionSpace R) diff --git a/src/algebra/fs2ups.spad.pamphlet b/src/algebra/fs2ups.spad.pamphlet index e27f4900..055d5a7b 100644 --- a/src/algebra/fs2ups.spad.pamphlet +++ b/src/algebra/fs2ups.spad.pamphlet @@ -31,7 +31,7 @@ ++ whose coefficients may involve functions of \spad{log(x)}. FunctionSpaceToUnivariatePowerSeries(R,FE,Expon,UPS,TRAN,x):_ Exports == Implementation where - R : Join(GcdDomain,OrderedSet,RetractableTo Integer,_ + R : Join(GcdDomain,RetractableTo Integer,_ LinearlyExplicitRingOver Integer) FE : Join(AlgebraicallyClosedField,TranscendentalFunctionCategory,_ FunctionSpace R) with coerce: Expon -> % diff --git a/src/algebra/fspace.spad.pamphlet b/src/algebra/fspace.spad.pamphlet index 6196c550..5618839b 100644 --- a/src/algebra/fspace.spad.pamphlet +++ b/src/algebra/fspace.spad.pamphlet @@ -25,7 +25,7 @@ ExpressionSpace(): Category == Defn where OP ==> BasicOperator SY ==> Symbol - Defn ==> Join(OrderedSet, RetractableTo K, + Defn ==> Join(SetCategory, RetractableTo K, InnerEvalable(K, %), Evalable %) with elt : (OP, %) -> % ++ elt(op,x) or op(x) applies the unary operator op to x. @@ -168,9 +168,8 @@ ExpressionSpace(): Category == Defn where macro PAREN == '%paren macro BOX == '%box macro DUMMYVAR == '%dummyVar - allKernels: % -> Set K - listk : % -> List K - allk : List % -> Set K + allKernels: % -> List K + allk : List % -> List K unwrap : (List K, %) -> % okkernel : (OP, List %) -> % mkKerLists: List Equation % -> Record(lstk: List K, lstv:List %) @@ -181,16 +180,15 @@ ExpressionSpace(): Category == Defn where box(x:%) == box [x] paren(x:%) == paren [x] belong? op == op = oppren or op = opbox - listk f == parts allKernels f - tower f == sort_! listk f - allk l == reduce("union", [allKernels f for f in l], {}) - operators f == [operator k for k in listk f] + tower f == sort! allKernels f + allk l == reduce("setUnion", [allKernels f for f in l], nil$List(K)) + operators f == [operator k for k in allKernels f] height f == reduce("max", [height k for k in kernels f], 0) - freeOf?(x:%, s:SY) == not member?(s, [name k for k in listk x]) - distribute x == unwrap([k for k in listk x | is?(k, oppren)], x) + freeOf?(x:%, s:SY) == not member?(s, [name k for k in allKernels x]) + distribute x == unwrap([k for k in allKernels x | is?(k, oppren)], x) box(l:List %) == opbox l paren(l:List %) == oppren l - freeOf?(x:%, k:%) == not member?(retract k, listk x) + freeOf?(x:%, k:%) == not member?(retract k, allKernels x) kernel(op:OP, arg:%) == kernel(op, [arg]) elt(op:OP, x:%) == op [x] elt(op:OP, x:%, y:%) == op [x, y] @@ -233,18 +231,18 @@ ExpressionSpace(): Category == Defn where -- arguments of rootOf's, integrals, sums and products which appear only in -- their first arguments allKernels f == - s := brace(l := kernels f) + s := removeDuplicates(l := kernels f) for k in l repeat t := (u := property(operator k, DUMMYVAR)) case None => arg := argument k - s0 := remove_!(retract(second arg)@K, allKernels first arg) + s0 := remove!(retract(second arg)@K, allKernels first arg) arg := rest rest arg n := (u::None) pretend N if n > 1 then arg := rest arg - union(s0, allk arg) + setUnion(s0, allk arg) allk argument k - s := union(s, t) + s := setUnion(s, t) s kernel(op:OP, args:List %) == @@ -286,8 +284,8 @@ ExpressionSpace(): Category == Defn where distribute(x, y) == ky := retract y - unwrap([k for k in listk x | - is?(k, '%paren) and member?(ky, listk(k::%))], x) + unwrap([k for k in allKernels x | + is?(k, '%paren) and member?(ky, allKernels(k::%))], x) -- in case of conflicting substitutions e.g. [x = a, x = b], -- the first one prevails. @@ -382,7 +380,7 @@ ExpressionSpaceFunctions2(E:ExpressionSpace, F:ExpressionSpace): with ++ A space of formal functions with arguments in an arbitrary ++ ordered set. ++ Keywords: operator, kernel, function. -FunctionSpace(R:OrderedSet): Category == Definition where +FunctionSpace(R: SetCategory): Category == Definition where OP ==> BasicOperator O ==> OutputForm SY ==> Symbol @@ -622,7 +620,7 @@ FunctionSpace(R:OrderedSet): Category == Definition where elt(op:OP, args:List %) == unary? op and ((od? := has?(op, ODD)) or has?(op, EVEN)) and - leadingCoefficient(numer first args) < 0 => + before?(leadingCoefficient(numer first args),0) => x := op(- first args) od? => -x x @@ -1029,7 +1027,7 @@ FunctionSpace(R:OrderedSet): Category == Definition where ++ This package allows a mapping R -> S to be lifted to a mapping ++ from a function space over R to a function space over S; FunctionSpaceFunctions2(R, A, S, B): Exports == Implementation where - R, S: Join(Ring, OrderedSet) + R, S: Ring A : FunctionSpace R B : FunctionSpace S diff --git a/src/algebra/funcpkgs.spad.pamphlet b/src/algebra/funcpkgs.spad.pamphlet index eae260a6..9b852d35 100644 --- a/src/algebra/funcpkgs.spad.pamphlet +++ b/src/algebra/funcpkgs.spad.pamphlet @@ -19,7 +19,7 @@ ++ Keywords: function, space, polynomial, factoring FunctionSpaceUnivariatePolynomialFactor(R, F, UP): Exports == Implementation where - R : Join(IntegralDomain, OrderedSet, RetractableTo Integer) + R : Join(IntegralDomain, RetractableTo Integer) F : FunctionSpace R UP: UnivariatePolynomialCategory F diff --git a/src/algebra/gaussian.spad.pamphlet b/src/algebra/gaussian.spad.pamphlet index abbe8cee..25836835 100644 --- a/src/algebra/gaussian.spad.pamphlet +++ b/src/algebra/gaussian.spad.pamphlet @@ -35,7 +35,6 @@ ComplexCategory(R:CommutativeRing): Category == imag : % -> R ++ imag(x) returns imaginary part of x. real : % -> R ++ real(x) returns real part of x. norm : % -> R ++ norm(x) returns x * conjugate(x) - if R has OrderedSet then OrderedSet if R has IntegralDomain then IntegralDomain _exquo : (%,R) -> Union(%,"failed") @@ -77,6 +76,10 @@ ComplexCategory(R:CommutativeRing): Category == import MatrixCategoryFunctions2(%, Vector %, Vector %, Matrix %, R, Vector R, Vector R, Matrix R) SUP ==> SparseUnivariatePolynomial + before?(x,y) == + real x = real y => before?(imag x,imag y) + before?(real x,real y) + characteristicPolynomial x == v := monomial(1,1)$SUP(R) v**2 - trace(x)*v**1 + norm(x)*v**0 @@ -230,11 +233,6 @@ ComplexCategory(R:CommutativeRing): Category == patternMatch(x, p, l)$ComplexPatternMatch(Float, R, %) - if R has OrderedSet then - x < y == - real x = real y => imag x < imag y - real x < real y - if R has IntegerNumberSystem then rational? x == zero? imag x diff --git a/src/algebra/genups.spad.pamphlet b/src/algebra/genups.spad.pamphlet index efc99560..96d45342 100644 --- a/src/algebra/genups.spad.pamphlet +++ b/src/algebra/genups.spad.pamphlet @@ -26,7 +26,7 @@ ++ \spadtype{GenerateUnivariatePowerSeries} provides functions that create ++ power series from explicit formulas for their \spad{n}th coefficient. GenerateUnivariatePowerSeries(R,FE): Exports == Implementation where - R : Join(IntegralDomain,OrderedSet,RetractableTo Integer,_ + R : Join(IntegralDomain,RetractableTo Integer,_ LinearlyExplicitRingOver Integer) FE : Join(AlgebraicallyClosedField,TranscendentalFunctionCategory,_ FunctionSpace R) diff --git a/src/algebra/intaf.spad.pamphlet b/src/algebra/intaf.spad.pamphlet index d226fa79..284e11ea 100644 --- a/src/algebra/intaf.spad.pamphlet +++ b/src/algebra/intaf.spad.pamphlet @@ -24,7 +24,7 @@ ++ The rationalization is done for integration, limited integration, ++ extended integration and the risch differential equation; GenusZeroIntegration(R, F, L): Exports == Implementation where - R: Join(GcdDomain, RetractableTo Integer, OrderedSet, CharacteristicZero, + R: Join(GcdDomain, RetractableTo Integer, CharacteristicZero, LinearlyExplicitRingOver Integer) F: Join(FunctionSpace R, AlgebraicallyClosedField, TranscendentalFunctionCategory) @@ -282,7 +282,7 @@ GenusZeroIntegration(R, F, L): Exports == Implementation where ++ extended integration and the risch differential equation for ++ pure algebraic integrands; PureAlgebraicIntegration(R, F, L): Exports == Implementation where - R: Join(GcdDomain,RetractableTo Integer,OrderedSet, CharacteristicZero, + R: Join(GcdDomain,RetractableTo Integer, CharacteristicZero, LinearlyExplicitRingOver Integer) F: Join(FunctionSpace R, AlgebraicallyClosedField, TranscendentalFunctionCategory) @@ -662,7 +662,7 @@ PureAlgebraicIntegration(R, F, L): Exports == Implementation where ++ This package provides functions for the integration of ++ algebraic integrands over transcendental functions; AlgebraicIntegration(R, F): Exports == Implementation where - R : Join(OrderedSet, IntegralDomain) + R : IntegralDomain F : Join(AlgebraicallyClosedField, FunctionSpace R) SY ==> Symbol diff --git a/src/algebra/intalg.spad.pamphlet b/src/algebra/intalg.spad.pamphlet index cb4b7d08..4bf34804 100644 --- a/src/algebra/intalg.spad.pamphlet +++ b/src/algebra/intalg.spad.pamphlet @@ -148,7 +148,7 @@ AlgebraicHermiteIntegration(F,UP,UPUP,R):Exports == Implementation where ++ This package provides functions for integrating a function ++ on an algebraic curve. AlgebraicIntegrate(R0, F, UP, UPUP, R): Exports == Implementation where - R0 : Join(OrderedSet, IntegralDomain, RetractableTo Integer) + R0 : Join(IntegralDomain, RetractableTo Integer) F : Join(AlgebraicallyClosedField, FunctionSpace R0) UP : UnivariatePolynomialCategory F UPUP : UnivariatePolynomialCategory Fraction UP diff --git a/src/algebra/intef.spad.pamphlet b/src/algebra/intef.spad.pamphlet index ab6821ba..1adbcdf3 100644 --- a/src/algebra/intef.spad.pamphlet +++ b/src/algebra/intef.spad.pamphlet @@ -23,7 +23,7 @@ ++ Keywords: elementary, function, integration. ++ Examples: )r INTEF INPUT ElementaryIntegration(R, F): Exports == Implementation where - R : Join(GcdDomain, OrderedSet, CharacteristicZero, + R : Join(GcdDomain, CharacteristicZero, RetractableTo Integer, LinearlyExplicitRingOver Integer) F : Join(AlgebraicallyClosedField, TranscendentalFunctionCategory, FunctionSpace R) diff --git a/src/algebra/integrat.spad.pamphlet b/src/algebra/integrat.spad.pamphlet index fb83e7f3..e09eb80d 100644 --- a/src/algebra/integrat.spad.pamphlet +++ b/src/algebra/integrat.spad.pamphlet @@ -21,7 +21,7 @@ ++ indefinite integration of complex-valued functions. ++ Keywords: function, integration. FunctionSpaceComplexIntegration(R, F): Exports == Implementation where - R : Join(EuclideanDomain, OrderedSet, CharacteristicZero, + R : Join(EuclideanDomain, CharacteristicZero, RetractableTo Integer, LinearlyExplicitRingOver Integer) F : Join(TranscendentalFunctionCategory, AlgebraicallyClosedFunctionSpace R) @@ -98,7 +98,7 @@ FunctionSpaceComplexIntegration(R, F): Exports == Implementation where ++ indefinite integration of real-valued functions. ++ Examples: )r INTEF INPUT FunctionSpaceIntegration(R, F): Exports == Implementation where - R : Join(EuclideanDomain, OrderedSet, CharacteristicZero, + R : Join(EuclideanDomain, CharacteristicZero, RetractableTo Integer, LinearlyExplicitRingOver Integer) F : Join(TranscendentalFunctionCategory, PrimitiveFunctionCategory, AlgebraicallyClosedFunctionSpace R) diff --git a/src/algebra/intpm.spad.pamphlet b/src/algebra/intpm.spad.pamphlet index aca1a275..3ac33ab1 100644 --- a/src/algebra/intpm.spad.pamphlet +++ b/src/algebra/intpm.spad.pamphlet @@ -20,7 +20,7 @@ ++ the pattern matcher to find some indefinite and definite integrals ++ involving special functions and found in the litterature. PatternMatchIntegration(R, F): Exports == Implementation where - R : Join(OrderedSet, RetractableTo Integer, GcdDomain, + R : Join(RetractableTo Integer, GcdDomain, LinearlyExplicitRingOver Integer) F : Join(AlgebraicallyClosedField, TranscendentalFunctionCategory, FunctionSpace R) @@ -87,7 +87,7 @@ PatternMatchIntegration(R, F): Exports == Implementation where w := suchThat(optional(pmw::F), empty? variables #1) s := suchThat(optional(pms::F), empty? variables #1 and real? #1) m := suchThat(optional(pmm::F), - (retractIfCan(#1)@Union(Z,"failed") case Z) and #1 >= 0) + (retractIfCan(#1)@Union(Z,"failed") case Z) and not before?(#1,0)) spi := sqrt(pi()$F) @@ -125,7 +125,6 @@ PatternMatchIntegration(R, F): Exports == Implementation where if R has ConvertibleTo Pattern Integer and R has PatternMatchable Integer then if F has LiouvillianFunctionCategory then - import ElementaryFunctionSign(R, F) insqrt : F -> F matchei : (F, SY) -> REC diff --git a/src/algebra/irexpand.spad.pamphlet b/src/algebra/irexpand.spad.pamphlet index 47fc84a2..e2d1daac 100644 --- a/src/algebra/irexpand.spad.pamphlet +++ b/src/algebra/irexpand.spad.pamphlet @@ -22,7 +22,7 @@ ++ that the indexing polynomial can be factored into quadratics. ++ Keywords: integration, expansion, function. IntegrationResultToFunction(R, F): Exports == Implementation where - R: Join(GcdDomain, RetractableTo Integer, OrderedSet, + R: Join(GcdDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer) F: Join(AlgebraicallyClosedFunctionSpace R, TranscendentalFunctionCategory) @@ -235,7 +235,7 @@ IntegrationResultToFunction(R, F): Exports == Implementation where ++ Date Created: 21 August 1988 ++ Date Last Updated: 4 October 1993 IntegrationResultRFToFunction(R): Exports == Implementation where - R: Join(GcdDomain, RetractableTo Integer, OrderedSet, + R: Join(GcdDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer) RF ==> Fraction Polynomial R diff --git a/src/algebra/kl.spad.pamphlet b/src/algebra/kl.spad.pamphlet index d07e5b90..de767784 100644 --- a/src/algebra/kl.spad.pamphlet +++ b/src/algebra/kl.spad.pamphlet @@ -19,7 +19,7 @@ ++ Description: ++ A cachable set is a set whose elements keep an integer as part ++ of their structure. -CachableSet: Category == OrderedSet with +CachableSet: Category == SetCategory with position : % -> NonNegativeInteger ++ position(x) returns the integer n associated to x. setPosition: (%, NonNegativeInteger) -> Void @@ -118,13 +118,13 @@ SortedCache(S:CachableSet): Exports == Implementation where ++ Description: ++ A kernel over a set S is an operator applied to a given list ++ of arguments from S. -Kernel(S:OrderedSet): Exports == Implementation where +Kernel(S: SetCategory): Exports == Implementation where O ==> OutputForm N ==> NonNegativeInteger OP ==> BasicOperator - Exports ==> Join(CachableSet, Patternable S) with + Exports ==> Join(CachableSet, OrderedSet, Patternable S) with name : % -> Symbol ++ name(op(a1,...,an)) returns the name of op. operator: % -> OP @@ -219,7 +219,7 @@ Kernel(S:OrderedSet): Exports == Implementation where ((func := property(operator k1, SPECIALEQUAL)) case None) and (((func@None) pretend ((%, %) -> Boolean)) (k1, k2)) => 0 for x1 in argument(k1) for x2 in argument(k2) repeat - x1 ~= x2 => return B2Z(x1 < x2) + x1 ~= x2 => return B2Z before?(x1,x2) 0 if S has ConvertibleTo InputForm then diff --git a/src/algebra/laplace.spad.pamphlet b/src/algebra/laplace.spad.pamphlet index 28e2a1dd..05d97079 100644 --- a/src/algebra/laplace.spad.pamphlet +++ b/src/algebra/laplace.spad.pamphlet @@ -18,7 +18,7 @@ ++ Date Last Updated: 13 December 1995 ++ Description: This package computes the forward Laplace Transform. LaplaceTransform(R, F): Exports == Implementation where - R : Join(EuclideanDomain, OrderedSet, CharacteristicZero, + R : Join(EuclideanDomain, CharacteristicZero, RetractableTo Integer, LinearlyExplicitRingOver Integer) F : Join(TranscendentalFunctionCategory, PrimitiveFunctionCategory, AlgebraicallyClosedFunctionSpace R) @@ -232,7 +232,7 @@ LaplaceTransform(R, F): Exports == Implementation where ++ Date Last Updated: 3 Sept 1991 ++ Description: This package computes the inverse Laplace Transform. InverseLaplaceTransform(R, F): Exports == Implementation where - R : Join(EuclideanDomain, OrderedSet, CharacteristicZero, + R : Join(EuclideanDomain, CharacteristicZero, RetractableTo Integer, LinearlyExplicitRingOver Integer) F : Join(TranscendentalFunctionCategory, PrimitiveFunctionCategory, SpecialFunctionCategory, AlgebraicallyClosedFunctionSpace R) @@ -303,7 +303,7 @@ InverseLaplaceTransform(R, F): Exports == Implementation where e := exp(c*t) b := b+a*c d := d-c**2 - d > 0 => + before?(0,d) => alpha:F := sqrt d e*(a*cos(t*alpha) + b*sin(t*alpha)/alpha) alpha :F := sqrt(-d) diff --git a/src/algebra/limitps.spad.pamphlet b/src/algebra/limitps.spad.pamphlet index b2f66076..5a52d5bc 100644 --- a/src/algebra/limitps.spad.pamphlet +++ b/src/algebra/limitps.spad.pamphlet @@ -29,7 +29,7 @@ ++ limiting value. Included are two-sided limits, left- and right- ++ hand limits, and limits at plus or minus infinity. PowerSeriesLimitPackage(R,FE): Exports == Implementation where - R : Join(GcdDomain,OrderedSet,RetractableTo Integer,_ + R : Join(GcdDomain,RetractableTo Integer,_ LinearlyExplicitRingOver Integer) FE : Join(AlgebraicallyClosedField,TranscendentalFunctionCategory,_ FunctionSpace R) @@ -548,7 +548,7 @@ PowerSeriesLimitPackage(R,FE): Exports == Implementation where ++ This package provides functions to determine the sign of an ++ elementary function around a point or infinity. ElementaryFunctionSign(R,F): Exports == Implementation where - R : Join(IntegralDomain,OrderedSet,RetractableTo Integer,_ + R : Join(IntegralDomain,RetractableTo Integer,_ LinearlyExplicitRingOver Integer,GcdDomain) F : Join(AlgebraicallyClosedField,TranscendentalFunctionCategory,_ FunctionSpace R) diff --git a/src/algebra/liouv.spad.pamphlet b/src/algebra/liouv.spad.pamphlet index 587f8b23..efd960e3 100644 --- a/src/algebra/liouv.spad.pamphlet +++ b/src/algebra/liouv.spad.pamphlet @@ -20,7 +20,7 @@ ++ Description: ++ This package provides liouvillian functions over an integral domain. LiouvillianFunction(R, F): Exports == Implementation where - R:Join(OrderedSet, IntegralDomain) + R: IntegralDomain F:Join(FunctionSpace R,RadicalCategory,TranscendentalFunctionCategory) OP ==> BasicOperator diff --git a/src/algebra/manip.spad.pamphlet b/src/algebra/manip.spad.pamphlet index 49c0e5ce..eaf5fafc 100644 --- a/src/algebra/manip.spad.pamphlet +++ b/src/algebra/manip.spad.pamphlet @@ -228,7 +228,7 @@ AlgebraicManipulations(R, F): Exports == Implementation where ratPoly : F -> SparseUnivariatePolynomial F ++ ratPoly(f) returns a polynomial p such that p has no ++ algebraic coefficients, and \spad{p(f) = 0}. - if R has Join(OrderedSet, GcdDomain, RetractableTo Integer) + if R has Join(GcdDomain, RetractableTo Integer) and F has FunctionSpace(R) then rootPower : F -> F ++ rootPower(f) transforms every radical power of the form @@ -294,7 +294,7 @@ AlgebraicManipulations(R, F): Exports == Implementation where [map(innerRF(#1, ll), kk) for kk in lk]), k, minPoly k) map(innerRF(#1, ll), q) (map(innerRF(#1, ll), k)) - if R has Join(OrderedSet, GcdDomain, RetractableTo Integer) + if R has Join(GcdDomain, RetractableTo Integer) and F has FunctionSpace(R) then import PolynomialRoots(IndexedExponents K, K, R, P, F) @@ -407,7 +407,7 @@ SimplifyAlgebraicNumberConvertPackage(): with ++ expand expressions involving transcendental operators. ++ Keywords: transcendental, manipulation. TranscendentalManipulations(R, F): Exports == Implementation where - R : Join(OrderedSet, GcdDomain) + R : GcdDomain F : Join(FunctionSpace R, TranscendentalFunctionCategory) Z ==> Integer diff --git a/src/algebra/nlode.spad.pamphlet b/src/algebra/nlode.spad.pamphlet index b43c0102..8458fdd2 100644 --- a/src/algebra/nlode.spad.pamphlet +++ b/src/algebra/nlode.spad.pamphlet @@ -20,7 +20,7 @@ ++ differential equations of order 1. ++ Keywords: differential equation, ODE NonLinearFirstOrderODESolver(R, F): Exports == Implementation where - R: Join(OrderedSet, EuclideanDomain, RetractableTo Integer, + R: Join(EuclideanDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer, CharacteristicZero) F: Join(AlgebraicallyClosedFunctionSpace R, TranscendentalFunctionCategory, PrimitiveFunctionCategory) diff --git a/src/algebra/odeef.spad.pamphlet b/src/algebra/odeef.spad.pamphlet index 8f71bbc0..1b1cc186 100644 --- a/src/algebra/odeef.spad.pamphlet +++ b/src/algebra/odeef.spad.pamphlet @@ -86,7 +86,7 @@ ReductionOfOrder(F, L): Exports == Impl where ++ differential equations and initial value problems. ++ Keywords: differential equation, ODE ElementaryFunctionLODESolver(R, F, L): Exports == Implementation where - R: Join(OrderedSet, EuclideanDomain, RetractableTo Integer, + R: Join(EuclideanDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer, CharacteristicZero) F: Join(AlgebraicallyClosedFunctionSpace R, TranscendentalFunctionCategory, PrimitiveFunctionCategory) @@ -338,7 +338,7 @@ ElementaryFunctionLODESolver(R, F, L): Exports == Implementation where ++ differential equations and initial value problems. ++ Keywords: differential equation, ODE ElementaryFunctionODESolver(R, F): Exports == Implementation where - R: Join(OrderedSet, EuclideanDomain, RetractableTo Integer, + R: Join(EuclideanDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer, CharacteristicZero) F: Join(AlgebraicallyClosedFunctionSpace R, TranscendentalFunctionCategory, PrimitiveFunctionCategory) diff --git a/src/algebra/oderf.spad.pamphlet b/src/algebra/oderf.spad.pamphlet index 08ba4213..bc256aef 100644 --- a/src/algebra/oderf.spad.pamphlet +++ b/src/algebra/oderf.spad.pamphlet @@ -679,7 +679,7 @@ ODETools(F, LODO): Exports == Implementation where ++ This package is intended for use ++ by the differential equations solver but not at top-level. ODEIntegration(R, F): Exports == Implementation where - R: Join(OrderedSet, EuclideanDomain, RetractableTo Integer, + R: Join(EuclideanDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer, CharacteristicZero) F: Join(AlgebraicallyClosedFunctionSpace R, TranscendentalFunctionCategory, PrimitiveFunctionCategory) @@ -753,7 +753,7 @@ ODEIntegration(R, F): Exports == Implementation where isQlog f == is?(f, 'log) => [1, first argument(retract(f)@K)] (v := isTimes f) case List(F) and (#(l := v::List(F)) <= 3) => - l := reverse_! sort_! l + l := reverse! sort!(before?,l) is?(first l, 'log) and ((u := isQ rest l) case Q) => [u::Q, first argument(retract(first(l))@K)] "failed" @@ -768,7 +768,7 @@ ODEIntegration(R, F): Exports == Implementation where ++ Date Last Updated: 3 February 1994 ++ Description: Solution of linear ordinary differential equations, constant coefficient case. ConstantLODE(R, F, L): Exports == Implementation where - R: Join(OrderedSet, EuclideanDomain, RetractableTo Integer, + R: Join(EuclideanDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer, CharacteristicZero) F: Join(AlgebraicallyClosedFunctionSpace R, TranscendentalFunctionCategory, PrimitiveFunctionCategory) diff --git a/src/algebra/openmath.spad.pamphlet b/src/algebra/openmath.spad.pamphlet index 62f19a37..1ebbb4fc 100644 --- a/src/algebra/openmath.spad.pamphlet +++ b/src/algebra/openmath.spad.pamphlet @@ -23,7 +23,7 @@ ++ References: ++ Description: \spadtype{ExpressionToOpenMath} provides support for ++ converting objects of type \spadtype{Expression} into OpenMath. -ExpressionToOpenMath(R: Join(OpenMath, OrderedSet, Ring)): with +ExpressionToOpenMath(R: Join(OpenMath, Ring)): with OMwrite : Expression R -> String OMwrite : (Expression R, Boolean) -> String OMwrite : (OpenMathDevice, Expression R) -> Void diff --git a/src/algebra/patmatch1.spad.pamphlet b/src/algebra/patmatch1.spad.pamphlet index 8d6408ed..087b8c71 100644 --- a/src/algebra/patmatch1.spad.pamphlet +++ b/src/algebra/patmatch1.spad.pamphlet @@ -263,7 +263,7 @@ PatternMatchSymbol(S:SetCategory): with ++ Keywords: pattern, matching, kernel. PatternMatchKernel(S, E): Exports == Implementation where S: SetCategory - E: Join(OrderedSet, RetractableTo Kernel %, + E: Join(SetCategory, RetractableTo Kernel %, ConvertibleTo Pattern S, PatternMatchable S) PAT ==> Pattern S @@ -460,7 +460,7 @@ PatternMatchPushDown(S, A, B): Exports == Implementation where ++ Keywords: pattern, matching, tools. PatternMatchTools(S, R, P): Exports == Implementation where S: SetCategory - R: Join(Ring, OrderedSet) + R: Ring P: Join(Ring, ConvertibleTo Pattern S, RetractableTo R) PAT ==> Pattern S @@ -498,9 +498,10 @@ PatternMatchTools(S, R, P): Exports == Implementation where mn1 := convert(-1::P)@Pattern(S) negConstant l == - for x in l repeat - ((r := retractIfCan(x)@Union(R, "failed")) case R) and - (r::R < 0) => return x + if R has OrderedSet then + for x in l repeat + ((r := retractIfCan(x)@Union(R, "failed")) case R) and + (r::R < 0) => return x "failed" -- tries to match the list of patterns lp to the list of subjects rc.s diff --git a/src/algebra/patmatch2.spad.pamphlet b/src/algebra/patmatch2.spad.pamphlet index 0c86c747..11063aad 100644 --- a/src/algebra/patmatch2.spad.pamphlet +++ b/src/algebra/patmatch2.spad.pamphlet @@ -138,7 +138,7 @@ PatternMatchPolynomialCategory(S,E,V,R,P):Exports== Implementation where S: SetCategory E: OrderedAbelianMonoidSup V: OrderedSet - R: Join(Ring, OrderedSet, PatternMatchable S) + R: Join(Ring, PatternMatchable S) P: Join(PolynomialCategory(R, E, V), ConvertibleTo Pattern S) N ==> NonNegativeInteger @@ -219,7 +219,7 @@ PatternMatchPolynomialCategory(S,E,V,R,P):Exports== Implementation where ++ Keywords: pattern, matching, function, space. PatternMatchFunctionSpace(S, R, F): Exports== Implementation where S: SetCategory - R: Join(IntegralDomain, OrderedSet, PatternMatchable S) + R: Join(IntegralDomain, PatternMatchable S) F: Join(FunctionSpace R, ConvertibleTo Pattern S, PatternMatchable S, RetractableTo Kernel %) -- that one is redundant but won't -- compile without it diff --git a/src/algebra/pfo.spad.pamphlet b/src/algebra/pfo.spad.pamphlet index e5232cc1..118e5d5d 100644 --- a/src/algebra/pfo.spad.pamphlet +++ b/src/algebra/pfo.spad.pamphlet @@ -230,7 +230,7 @@ PointsOfFiniteOrderRational(UP, UPUP, R): Exports == Implementation where ++ the kernels and the integers is fixed between calls to new(). ++ Keywords: function, space, redcution. FunctionSpaceReduce(R, F): Exports == Implementation where - R: Join(OrderedSet, IntegralDomain, RetractableTo Integer) + R: Join(IntegralDomain, RetractableTo Integer) F: FunctionSpace R Z ==> Integer @@ -290,7 +290,7 @@ FunctionSpaceReduce(R, F): Exports == Implementation where ++ Keywords: divisor, algebraic, curve. ++ Examples: )r PFO INPUT PointsOfFiniteOrder(R0, F, UP, UPUP, R): Exports == Implementation where - R0 : Join(OrderedSet, IntegralDomain, RetractableTo Integer) + R0 : Join(IntegralDomain, RetractableTo Integer) F : FunctionSpace R0 UP : UnivariatePolynomialCategory F UPUP : UnivariatePolynomialCategory Fraction UP diff --git a/src/algebra/polycat.spad.pamphlet b/src/algebra/polycat.spad.pamphlet index 0847febd..60e29ed0 100644 --- a/src/algebra/polycat.spad.pamphlet +++ b/src/algebra/polycat.spad.pamphlet @@ -290,7 +290,6 @@ PolynomialCategory(R:Ring, E:OrderedAbelianMonoidSup, VarSet:OrderedSet): ++ primitiveMonomials(p) gives the list of monomials of the ++ polynomial p with their coefficients removed. ++ Note: \spad{primitiveMonomials(sum(a_(i) X^(i))) = [X^(1),...,X^(n)]}. - if R has OrderedSet then OrderedSet -- OrderedRing view removed to allow EXPR to define abs --if R has OrderedRing then OrderedRing if (R has ConvertibleTo InputForm) and @@ -573,23 +572,24 @@ PolynomialCategory(R:Ring, E:OrderedAbelianMonoidSup, VarSet:OrderedSet): unitNormal((p exquo content p) ::%).canonical primitivePart(p,v) == unitNormal((p exquo content(p,v)) ::%).canonical - if R has OrderedSet then - p:% < q:% == - (dp:= degree p) < (dq := degree q) => (leadingCoefficient q) > 0 - dq < dp => (leadingCoefficient p) < 0 - leadingCoefficient(p - q) < 0 - if (R has PatternMatchable Integer) and - (VarSet has PatternMatchable Integer) then - patternMatch(p:%, pat:Pattern Integer, - l:PatternMatchResult(Integer, %)) == - patternMatch(p, pat, - l)$PatternMatchPolynomialCategory(Integer,E,VarSet,R,%) - if (R has PatternMatchable Float) and - (VarSet has PatternMatchable Float) then - patternMatch(p:%, pat:Pattern Float, - l:PatternMatchResult(Float, %)) == - patternMatch(p, pat, - l)$PatternMatchPolynomialCategory(Float,E,VarSet,R,%) + + before?(p:%, q:%) == + (dp:= degree p) < (dq := degree q) => before?(0, leadingCoefficient q) + dq < dp => before?(leadingCoefficient p,0) + before?(leadingCoefficient(p - q),0) + + if (R has PatternMatchable Integer) and + (VarSet has PatternMatchable Integer) then + patternMatch(p:%, pat:Pattern Integer, + l:PatternMatchResult(Integer, %)) == + patternMatch(p, pat, + l)$PatternMatchPolynomialCategory(Integer,E,VarSet,R,%) + if (R has PatternMatchable Float) and + (VarSet has PatternMatchable Float) then + patternMatch(p:%, pat:Pattern Float, + l:PatternMatchResult(Float, %)) == + patternMatch(p, pat, + l)$PatternMatchPolynomialCategory(Float,E,VarSet,R,%) if (R has ConvertibleTo Pattern Integer) and (VarSet has ConvertibleTo Pattern Integer) then diff --git a/src/algebra/primelt.spad.pamphlet b/src/algebra/primelt.spad.pamphlet index 551acce8..1e392bdd 100644 --- a/src/algebra/primelt.spad.pamphlet +++ b/src/algebra/primelt.spad.pamphlet @@ -126,7 +126,7 @@ PrimitiveElement(F): Exports == Implementation where ++ primitive elements in functions spaces; ++ Keywords: algebraic, extension, primitive. FunctionSpacePrimitiveElement(R, F): Exports == Implementation where - R: Join(IntegralDomain, OrderedSet, CharacteristicZero) + R: Join(IntegralDomain, CharacteristicZero) F: FunctionSpace R SY ==> Symbol diff --git a/src/algebra/rdeef.spad.pamphlet b/src/algebra/rdeef.spad.pamphlet index 0f5c1ffb..971fe2a6 100644 --- a/src/algebra/rdeef.spad.pamphlet +++ b/src/algebra/rdeef.spad.pamphlet @@ -17,7 +17,7 @@ ++ Date Created: 25 April 1990 ++ Date Last Updated: 9 June 1993 ++ Keywords: elementary, function, integration. -IntegrationTools(R:OrderedSet, F:FunctionSpace R): Exp == Impl where +IntegrationTools(R: SetCategory, F:FunctionSpace R): Exp == Impl where K ==> Kernel F SE ==> Symbol P ==> SparseMultivariatePolynomial(R, K) @@ -153,7 +153,7 @@ IntegrationTools(R:OrderedSet, F:FunctionSpace R): Exp == Impl where ++ Date Last Updated: 2 November 1995 ++ Keywords: elementary, function, integration. ElementaryRischDE(R, F): Exports == Implementation where - R : Join(GcdDomain, OrderedSet, CharacteristicZero, + R : Join(GcdDomain, CharacteristicZero, RetractableTo Integer, LinearlyExplicitRingOver Integer) F : Join(TranscendentalFunctionCategory, AlgebraicallyClosedField, FunctionSpace R) diff --git a/src/algebra/rdesys.spad.pamphlet b/src/algebra/rdesys.spad.pamphlet index b2eabefd..59c68600 100644 --- a/src/algebra/rdesys.spad.pamphlet +++ b/src/algebra/rdesys.spad.pamphlet @@ -232,7 +232,7 @@ TranscendentalRischDESystem(F, UP): Exports == Implementation where ++ Date Last Updated: 17 August 1992 ++ Keywords: elementary, function, integration. ElementaryRischDESystem(R, F): Exports == Implementation where - R : Join(GcdDomain, OrderedSet, CharacteristicZero, + R : Join(GcdDomain, CharacteristicZero, RetractableTo Integer, LinearlyExplicitRingOver Integer) F : Join(TranscendentalFunctionCategory, AlgebraicallyClosedField, FunctionSpace R) diff --git a/src/algebra/rule.spad.pamphlet b/src/algebra/rule.spad.pamphlet index 6b089035..74771fd6 100644 --- a/src/algebra/rule.spad.pamphlet +++ b/src/algebra/rule.spad.pamphlet @@ -19,7 +19,7 @@ ++ Keywords: pattern, matching, rule. RewriteRule(Base, R, F): Exports == Implementation where Base : SetCategory - R : Join(Ring, PatternMatchable Base, OrderedSet, + R : Join(Ring, PatternMatchable Base, ConvertibleTo Pattern Base) F : Join(FunctionSpace R, PatternMatchable Base, ConvertibleTo Pattern Base) @@ -155,7 +155,7 @@ RewriteRule(Base, R, F): Exports == Implementation where ++ Keywords: pattern, matching, rule. ApplyRules(Base, R, F): Exports == Implementation where Base : SetCategory - R : Join(Ring, PatternMatchable Base, OrderedSet, + R : Join(Ring, PatternMatchable Base, ConvertibleTo Pattern Base) F : Join(FunctionSpace R, PatternMatchable Base, ConvertibleTo Pattern Base) @@ -275,7 +275,7 @@ ApplyRules(Base, R, F): Exports == Implementation where ++ Keywords: pattern, matching, rule. Ruleset(Base, R, F): Exports == Implementation where Base : SetCategory - R : Join(Ring, PatternMatchable Base, OrderedSet, + R : Join(Ring, PatternMatchable Base, ConvertibleTo Pattern Base) F : Join(FunctionSpace R, PatternMatchable Base, ConvertibleTo Pattern Base) diff --git a/src/algebra/solverad.spad.pamphlet b/src/algebra/solverad.spad.pamphlet index 95b9375d..34927401 100644 --- a/src/algebra/solverad.spad.pamphlet +++ b/src/algebra/solverad.spad.pamphlet @@ -27,7 +27,7 @@ ++ expressed in terms of radicals for systems of equations ++ of rational functions with coefficients in an integral domain R. RadicalSolvePackage(R): Cat == Capsule where - R : Join(EuclideanDomain, OrderedSet, CharacteristicZero) + R : Join(EuclideanDomain, CharacteristicZero) PI ==> PositiveInteger NNI==> NonNegativeInteger Z ==> Integer diff --git a/src/algebra/strap/POLYCAT-.lsp b/src/algebra/strap/POLYCAT-.lsp index 7fd8802c..902eba73 100644 --- a/src/algebra/strap/POLYCAT-.lsp +++ b/src/algebra/strap/POLYCAT-.lsp @@ -122,7 +122,7 @@ |POLYCAT-;primitivePart;SVarSetS;37|)) (DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Shell|) |%Boolean|) - |POLYCAT-;<;2SB;38|)) + |POLYCAT-;before?;2SB;38|)) (DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Thing| |%Shell|) |%Thing|) @@ -1489,13 +1489,13 @@ (|getShellEntry| $ 210)) 1)))) -(DEFUN |POLYCAT-;<;2SB;38| (|p| |q| $) +(DEFUN |POLYCAT-;before?;2SB;38| (|p| |q| $) (PROG (|dp| |dq|) (RETURN (SEQ (LETT |dp| (SPADCALL |p| (|getShellEntry| $ 75)) - |POLYCAT-;<;2SB;38|) + |POLYCAT-;before?;2SB;38|) (LETT |dq| (SPADCALL |q| (|getShellEntry| $ 75)) - |POLYCAT-;<;2SB;38|) + |POLYCAT-;before?;2SB;38|) (EXIT (COND ((SPADCALL |dp| |dq| (|getShellEntry| $ 215)) (SPADCALL (|spadConstant| $ 28) @@ -1570,8 +1570,7 @@ (|HasCategory| |#4| '(|ConvertibleTo| (|InputForm|))) (|HasCategory| |#2| - '(|ConvertibleTo| (|InputForm|))) - (|HasCategory| |#2| '(|OrderedSet|)))) . #0#)) + '(|ConvertibleTo| (|InputForm|))))) . #0#)) (|stuffDomainSlots| $) (|setShellEntry| $ 6 |#1|) (|setShellEntry| $ 7 |#2|) @@ -1671,26 +1670,21 @@ |POLYCAT-;primitivePart;SVarSetS;37|) $))))) (COND - ((|testBitVector| |pv$| 15) - (PROGN - (|setShellEntry| $ 217 - (CONS (|dispatchFunction| |POLYCAT-;<;2SB;38|) $)) - (COND - ((|testBitVector| |pv$| 8) - (COND - ((|testBitVector| |pv$| 7) - (|setShellEntry| $ 223 - (CONS (|dispatchFunction| - |POLYCAT-;patternMatch;SP2Pmr;39|) - $)))))) - (COND - ((|testBitVector| |pv$| 6) - (COND - ((|testBitVector| |pv$| 5) - (|setShellEntry| $ 230 - (CONS (|dispatchFunction| - |POLYCAT-;patternMatch;SP2Pmr;40|) - $))))))))) + ((|testBitVector| |pv$| 8) + (COND + ((|testBitVector| |pv$| 7) + (|setShellEntry| $ 223 + (CONS (|dispatchFunction| + |POLYCAT-;patternMatch;SP2Pmr;39|) + $)))))) + (COND + ((|testBitVector| |pv$| 6) + (COND + ((|testBitVector| |pv$| 5) + (|setShellEntry| $ 230 + (CONS (|dispatchFunction| + |POLYCAT-;patternMatch;SP2Pmr;40|) + $)))))) (COND ((|testBitVector| |pv$| 12) (COND @@ -1808,38 +1802,38 @@ (|:| |associate| $)) (702 . |unitNormal|) (707 . |primitivePart|) (712 . |content|) (718 . |exquo|) (724 . |primitivePart|) - (730 . <) (736 . <) (742 . <) (|PatternMatchResult| 103 6) - (|Pattern| 103) + (730 . <) (736 . |before?|) |POLYCAT-;before?;2SB;38| + (|PatternMatchResult| 103 6) (|Pattern| 103) (|PatternMatchPolynomialCategory| 103 8 9 7 6) - (748 . |patternMatch|) (|PatternMatchResult| 103 $) - (755 . |patternMatch|) (|Float|) + (742 . |patternMatch|) (|PatternMatchResult| 103 $) + (749 . |patternMatch|) (|Float|) (|PatternMatchResult| 224 6) (|Pattern| 224) (|PatternMatchPolynomialCategory| 224 8 9 7 6) - (762 . |patternMatch|) (|PatternMatchResult| 224 $) - (769 . |patternMatch|) (776 . |convert|) (781 . |convert|) + (756 . |patternMatch|) (|PatternMatchResult| 224 $) + (763 . |patternMatch|) (770 . |convert|) (775 . |convert|) (|Mapping| 219 9) (|Mapping| 219 7) - (|PolynomialCategoryLifting| 8 9 7 6 219) (786 . |map|) - (793 . |convert|) (798 . |convert|) (803 . |convert|) + (|PolynomialCategoryLifting| 8 9 7 6 219) (780 . |map|) + (787 . |convert|) (792 . |convert|) (797 . |convert|) (|Mapping| 226 9) (|Mapping| 226 7) - (|PolynomialCategoryLifting| 8 9 7 6 226) (808 . |map|) - (815 . |convert|) (|InputForm|) (820 . |convert|) - (825 . |convert|) (|Mapping| 245 9) (|Mapping| 245 7) - (|PolynomialCategoryLifting| 8 9 7 6 245) (830 . |map|) - (837 . |convert|) (|Matrix| 103) (|Vector| 103) + (|PolynomialCategoryLifting| 8 9 7 6 226) (802 . |map|) + (809 . |convert|) (|InputForm|) (814 . |convert|) + (819 . |convert|) (|Mapping| 245 9) (|Mapping| 245 7) + (|PolynomialCategoryLifting| 8 9 7 6 245) (824 . |map|) + (831 . |convert|) (|Matrix| 103) (|Vector| 103) (|Record| (|:| |mat| 253) (|:| |vec| 254)) (|Union| 103 '"failed") (|Fraction| 103) (|Union| 257 '"failed") (|Union| 7 '"failed")) - '#(|totalDegree| 842 |squareFreePart| 853 |squareFree| 858 - |solveLinearPolynomialEquation| 863 |retractIfCan| 869 - |retract| 874 |resultant| 879 |reducedSystem| 886 - |primitivePart| 897 |primitiveMonomials| 908 - |patternMatch| 913 |monomials| 927 |monomial| 932 - |monicDivide| 939 |isTimes| 946 |isPlus| 951 |isExpt| 956 - |gcdPolynomial| 961 |factorSquareFreePolynomial| 967 - |factorPolynomial| 972 |factor| 977 |eval| 982 - |discriminant| 988 |convert| 994 |content| 1009 - |conditionP| 1015 |coefficient| 1020 |charthRoot| 1034 < - 1039) + '#(|totalDegree| 836 |squareFreePart| 847 |squareFree| 852 + |solveLinearPolynomialEquation| 857 |retractIfCan| 863 + |retract| 868 |resultant| 873 |reducedSystem| 880 + |primitivePart| 891 |primitiveMonomials| 902 + |patternMatch| 907 |monomials| 921 |monomial| 926 + |monicDivide| 933 |isTimes| 940 |isPlus| 945 |isExpt| 950 + |gcdPolynomial| 955 |factorSquareFreePolynomial| 961 + |factorPolynomial| 966 |factor| 971 |eval| 976 + |discriminant| 982 |convert| 988 |content| 1003 + |conditionP| 1009 |coefficient| 1014 |charthRoot| 1028 + |before?| 1033) 'NIL (CONS (|makeByteWordVec2| 1 'NIL) (CONS '#() @@ -1897,27 +1891,27 @@ 6 7 0 207 2 6 171 0 7 208 1 6 209 0 210 1 0 0 0 211 2 6 0 0 9 212 2 6 171 0 0 213 2 0 0 0 9 214 2 8 10 0 0 215 - 2 7 10 0 0 216 2 0 10 0 0 217 3 220 - 218 6 219 218 221 3 0 222 0 219 222 - 223 3 227 225 6 226 225 228 3 0 229 0 - 226 229 230 1 9 219 0 231 1 7 219 0 - 232 3 235 219 233 234 6 236 1 0 219 0 - 237 1 9 226 0 238 1 7 226 0 239 3 242 - 226 240 241 6 243 1 0 226 0 244 1 9 - 245 0 246 1 7 245 0 247 3 250 245 248 - 249 6 251 1 0 245 0 252 2 0 45 0 19 - 93 1 0 45 0 88 1 0 0 0 204 1 0 147 0 - 196 2 0 139 138 58 140 1 0 15 0 74 1 - 0 9 0 73 3 0 0 0 0 9 95 1 0 110 119 - 120 2 0 128 119 129 130 2 0 0 0 9 214 - 1 0 0 0 211 1 0 20 0 77 3 0 222 0 219 - 222 223 3 0 229 0 226 229 230 1 0 20 - 0 34 3 0 0 0 19 63 71 3 0 191 0 0 9 - 193 1 0 38 0 52 1 0 38 0 39 1 0 56 0 - 57 2 0 58 58 58 133 1 0 143 58 146 1 - 0 143 58 144 1 0 147 0 164 2 0 0 0 23 - 24 2 0 0 0 9 97 1 0 245 0 252 1 0 219 - 0 237 1 0 226 0 244 2 0 0 0 9 206 1 0 - 178 119 183 3 0 0 0 19 63 69 3 0 0 0 - 9 45 62 1 0 171 0 185 2 0 10 0 0 217))))) + 2 7 10 0 0 216 3 220 218 6 219 218 + 221 3 0 222 0 219 222 223 3 227 225 6 + 226 225 228 3 0 229 0 226 229 230 1 9 + 219 0 231 1 7 219 0 232 3 235 219 233 + 234 6 236 1 0 219 0 237 1 9 226 0 238 + 1 7 226 0 239 3 242 226 240 241 6 243 + 1 0 226 0 244 1 9 245 0 246 1 7 245 0 + 247 3 250 245 248 249 6 251 1 0 245 0 + 252 2 0 45 0 19 93 1 0 45 0 88 1 0 0 + 0 204 1 0 147 0 196 2 0 139 138 58 + 140 1 0 15 0 74 1 0 9 0 73 3 0 0 0 0 + 9 95 2 0 128 119 129 130 1 0 110 119 + 120 2 0 0 0 9 214 1 0 0 0 211 1 0 20 + 0 77 3 0 229 0 226 229 230 3 0 222 0 + 219 222 223 1 0 20 0 34 3 0 0 0 19 63 + 71 3 0 191 0 0 9 193 1 0 38 0 52 1 0 + 38 0 39 1 0 56 0 57 2 0 58 58 58 133 + 1 0 143 58 146 1 0 143 58 144 1 0 147 + 0 164 2 0 0 0 23 24 2 0 0 0 9 97 1 0 + 219 0 237 1 0 245 0 252 1 0 226 0 244 + 2 0 0 0 9 206 1 0 178 119 183 3 0 0 0 + 9 45 62 3 0 0 0 19 63 69 1 0 171 0 + 185 2 0 10 0 0 217))))) '|lookupComplete|)) diff --git a/src/algebra/strap/POLYCAT.lsp b/src/algebra/strap/POLYCAT.lsp index db85c3c6..ea77dcd8 100644 --- a/src/algebra/strap/POLYCAT.lsp +++ b/src/algebra/strap/POLYCAT.lsp @@ -151,10 +151,7 @@ (|has| |t#1| (|GcdDomain|))) ((|squareFreePart| ($ $)) (|has| |t#1| (|GcdDomain|)))) - '(((|OrderedSet|) - (|has| |t#1| - (|OrderedSet|))) - ((|ConvertibleTo| + '(((|ConvertibleTo| (|InputForm|)) (AND (|has| |t#3| diff --git a/src/algebra/sum.spad.pamphlet b/src/algebra/sum.spad.pamphlet index e866dc11..0a4cd212 100644 --- a/src/algebra/sum.spad.pamphlet +++ b/src/algebra/sum.spad.pamphlet @@ -288,7 +288,7 @@ GosperSummationMethod(E, V, R, P, Q): Exports == Impl where ++ Date Last Updated: 19 April 1991 ++ Description: Computes sums of rational functions; RationalFunctionSum(R): Exports == Impl where - R: Join(IntegralDomain, OrderedSet, RetractableTo Integer) + R: Join(IntegralDomain, RetractableTo Integer) P ==> Polynomial R RF ==> Fraction P diff --git a/src/algebra/transsolve.spad.pamphlet b/src/algebra/transsolve.spad.pamphlet index f4bb6f6b..9b96e460 100644 --- a/src/algebra/transsolve.spad.pamphlet +++ b/src/algebra/transsolve.spad.pamphlet @@ -36,7 +36,7 @@ TransSolvePackage(R) : Exports == Implementation where - R : Join(OrderedSet, EuclideanDomain, RetractableTo Integer, + R : Join(EuclideanDomain, RetractableTo Integer, LinearlyExplicitRingOver Integer, CharacteristicZero) I ==> Integer @@ -559,7 +559,7 @@ generates the error (reported as bug \# 102): ++ to FRAC SUP EXPR INT and then the solution is \spad{func3:=X**3+X**2-X} ++ of type FRAC SUP EXPR INT TransSolvePackageService(R) : Exports == Implementation where - R : Join(IntegralDomain, OrderedSet) + R : IntegralDomain RE ==> Expression R EQ ==> Equation |