diff options
Diffstat (limited to 'src')
24 files changed, 57 insertions, 111 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7b1351e0..297c7c21 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,26 @@ 2008-11-20 Gabriel Dos Reis <gdr@cs.tamu.edu> + * algebra/alql.spad.pamphlet (Database): Now CoercibleFrom List S. + * algebra/asp.spad.pamphlet (Asp20): Now CoercibleFrom MAT FEXPR. + (Asp6): Now CoercibleFrom Vector FEXPR. + * algebra/catdef.spad.pamphlet (Algebra): Extend CoercibleFrom R. + (Ring): Extend CoercibleFrom Integer. + * algebra/formula.spad.pamphlet (ScriptFormulaFormat): Now + CoercibleFrom E. + * algebra/fortran.spad.pamphlet (FortranCode): Remove redundant + signature. + * algebra/fs2ups.spad.pamphlet + (FunctionSpaceToUnivariatePowerSeries): Tidy parameter. + * algebra/laurent.spad.pamphlet + (UnivariateLaurentSeriesConstructorCategory): Extend CoercibleFrom + UTS. + * algebra/manip.spad.pamphlet (PolynomialRoots): Tidy parameter. + * algebra/modmon.spad.pamphlet (ModMonic): Now CoercibleFrom Rep. + * algebra/ore.spad.pamphlet (UnivariateSkewPolynomial): Now + CoercibleFrom Variable x. + +2008-11-20 Gabriel Dos Reis <gdr@cs.tamu.edu> + * algebra/annacat.spad.pamphlet (NumericalIntegrationProblem): Remove redundant signature. (NumericalODEProblem): Likewise. diff --git a/src/algebra/alql.spad.pamphlet b/src/algebra/alql.spad.pamphlet index 4e568141..a7f895a1 100644 --- a/src/algebra/alql.spad.pamphlet +++ b/src/algebra/alql.spad.pamphlet @@ -114,7 +114,7 @@ Database(S): Exports == Implementation where ++ display(x) displays x in some form fullDisplay: % -> Void ++ fullDisplay(x) displays x in detail - Exports == SetCategory with + Exports == Join(SetCategory, CoercibleFrom List S) with elt: (%,QueryEquation) -> % ++ elt(db,q) returns all elements of \axiom{db} which satisfy \axiom{q}. elt: (%,Symbol) -> DataList String @@ -124,8 +124,6 @@ Database(S): Exports == Implementation where _-: (%,%) -> % ++ db1-db2 returns the difference of databases db1 and db2 i.e. consisting ++ of elements in db1 but not in db2 - coerce: List S -> % - ++ coerce(l) makes a database out of a list display: % -> Void ++ display(db) prints a summary line for each entry in \axiom{db}. fullDisplay: % -> Void diff --git a/src/algebra/asp.spad.pamphlet b/src/algebra/asp.spad.pamphlet index b83fcbf5..e5f2b900 100644 --- a/src/algebra/asp.spad.pamphlet +++ b/src/algebra/asp.spad.pamphlet @@ -654,12 +654,8 @@ Asp20(name): Exports == Implementation where MAT EXPR FLOAT, FEXPR,VEC FEXPR,VEC FEXPR,MAT FEXPR) - Exports ==> FortranMatrixFunctionCategory with - coerce: MAT FEXPR -> $ - ++coerce(f) takes objects from the appropriate instantiation of - ++\spadtype{FortranExpression} and turns them into an ASP. - - Implementation ==> add + Exports == Join(FortranMatrixFunctionCategory, CoercibleFrom MAT FEXPR) + Implementation == add real : UFST := ["real"::FST]$UFST syms : SYMTAB := empty() @@ -2986,11 +2982,7 @@ Asp6(name): Exports == Implementation where VEC ==> Vector VF2 ==> VectorFunctions2 - Exports == FortranVectorFunctionCategory with - coerce: Vector FEXPR -> % - ++coerce(f) takes objects from the appropriate instantiation of - ++\spadtype{FortranExpression} and turns them into an ASP. - + Exports == Join(FortranVectorFunctionCategory, CoercibleFrom Vector FEXPR) Implementation == add real : UFST := ["real"::FST]$UFST diff --git a/src/algebra/catdef.spad.pamphlet b/src/algebra/catdef.spad.pamphlet index 56860d9f..45d087d0 100644 --- a/src/algebra/catdef.spad.pamphlet +++ b/src/algebra/catdef.spad.pamphlet @@ -149,10 +149,7 @@ AbelianSemiGroup(): Category == SetCategory with ++ \spad{b*x = (b::%)*x} ++ \spad{r*(a*b) = (r*a)*b = a*(r*b)} Algebra(R:CommutativeRing): Category == - Join(Ring, Module R) with - --operations - coerce: R -> % - ++ coerce(r) maps the ring element r to a member of the algebra. + Join(Ring, Module R, CoercibleFrom R) add coerce(x:R):% == x * 1$% @@ -1529,7 +1526,7 @@ RightModule(R:Rng):Category == AbelianGroup with ++ not necessarily commutative. --Ring(): Category == Join(Rng,Monoid,LeftModule(%:Rng)) with -Ring(): Category == Join(Rng,Monoid,LeftModule(%)) with +Ring(): Category == Join(Rng,Monoid,LeftModule(%),CoercibleFrom Integer) with --operations characteristic: () -> NonNegativeInteger ++ characteristic() returns the characteristic of the ring @@ -1537,9 +1534,6 @@ Ring(): Category == Join(Rng,Monoid,LeftModule(%)) with ++ \spad{n*x=0} for all x in the ring, or zero if no such n ++ exists. --We can not make this a constant, since some domains are mutable - coerce: Integer -> % - ++ coerce(i) converts the integer i to a member of the given domain. --- recip: % -> Union(%,"failed") -- inherited from Monoid unitsKnown ++ recip truly yields ++ reciprocal or "failed" if not a unit. diff --git a/src/algebra/formula.spad.pamphlet b/src/algebra/formula.spad.pamphlet index 51506fc6..a46bf05d 100644 --- a/src/algebra/formula.spad.pamphlet +++ b/src/algebra/formula.spad.pamphlet @@ -44,10 +44,7 @@ ScriptFormulaFormat(): public == private where L ==> List S ==> String - public == SetCategory with - coerce: E -> % - ++ coerce(o) changes o in the standard output format to - ++ SCRIPT formula format. + public == Join(SetCategory, CoercibleFrom E) with convert: (E,I) -> % ++ convert(o,step) changes o in standard output format to ++ SCRIPT formula format and also adds the given step number. diff --git a/src/algebra/fortran.spad.pamphlet b/src/algebra/fortran.spad.pamphlet index f0c2cc29..2507beda 100644 --- a/src/algebra/fortran.spad.pamphlet +++ b/src/algebra/fortran.spad.pamphlet @@ -163,8 +163,6 @@ FortranCode(): public == private where commonBranch:COMMON, printBranch:PRINTLIST) public == SetCategory with - coerce: $ -> O - ++ coerce(f) returns an object of type OutputForm. forLoop: (SegmentBinding PIN,$) -> $ ++ forLoop(i=1..10,c) creates a representation of a FORTRAN DO loop with ++ \spad{i} ranging over the values 1 to 10. diff --git a/src/algebra/fs2ups.spad.pamphlet b/src/algebra/fs2ups.spad.pamphlet index 9751dd40..a27834ae 100644 --- a/src/algebra/fs2ups.spad.pamphlet +++ b/src/algebra/fs2ups.spad.pamphlet @@ -34,10 +34,7 @@ FunctionSpaceToUnivariatePowerSeries(R,FE,Expon,UPS,TRAN,x):_ R : Join(GcdDomain,OrderedSet,RetractableTo Integer,_ LinearlyExplicitRingOver Integer) FE : Join(AlgebraicallyClosedField,TranscendentalFunctionCategory,_ - FunctionSpace R) - with - coerce: Expon -> % - ++ coerce(e) converts an 'exponent' e to an 'expression' + FunctionSpace R, CoercibleFrom Expon) Expon : OrderedRing UPS : Join(UnivariatePowerSeriesCategory(FE,Expon),Field,_ TranscendentalFunctionCategory) diff --git a/src/algebra/laurent.spad.pamphlet b/src/algebra/laurent.spad.pamphlet index 1a162ede..23d39979 100644 --- a/src/algebra/laurent.spad.pamphlet +++ b/src/algebra/laurent.spad.pamphlet @@ -35,7 +35,7 @@ UnivariateLaurentSeriesConstructorCategory(Coef,UTS):_ I ==> Integer Definition ==> Join(UnivariateLaurentSeriesCategory(Coef),_ - RetractableTo UTS) with + RetractableTo UTS, CoercibleFrom UTS) with laurent: (I,UTS) -> % ++ \spad{laurent(n,f(x))} returns \spad{x**n * f(x)}. degree: % -> I @@ -63,9 +63,6 @@ UnivariateLaurentSeriesConstructorCategory(Coef,UTS):_ ++ 'leading zero' is removed from the Laurent series as follows: ++ the series is rewritten by increasing the exponent by 1 and ++ dividing the Taylor series by its variable. - coerce: UTS -> % - ++ \spad{coerce(f(x))} converts the Taylor series \spad{f(x)} to a - ++ Laurent series. taylor: % -> UTS ++ taylor(f(x)) converts the Laurent series f(x) to a Taylor series, ++ if possible. Error: if this is not possible. diff --git a/src/algebra/manip.spad.pamphlet b/src/algebra/manip.spad.pamphlet index 83657f90..cfe3fcc6 100644 --- a/src/algebra/manip.spad.pamphlet +++ b/src/algebra/manip.spad.pamphlet @@ -67,13 +67,11 @@ PolynomialRoots(E, V, R, P, F):Exports == Implementation where V: OrderedSet R: IntegralDomain P: PolynomialCategory(R, E, V) - F: Field with + F: Join(Field,CoercibleFrom P) with numer : $ -> P ++ numer(x) \undocumented denom : $ -> P ++ denom(x) \undocumented - coerce: P -> $ - ++ coerce(p) \undocumented N ==> NonNegativeInteger Z ==> Integer diff --git a/src/algebra/modmon.spad.pamphlet b/src/algebra/modmon.spad.pamphlet index 0d4241e2..79ad7718 100644 --- a/src/algebra/modmon.spad.pamphlet +++ b/src/algebra/modmon.spad.pamphlet @@ -21,7 +21,7 @@ ModMonic(R,Rep): C == T where R: Ring Rep: UnivariatePolynomialCategory(R) - C == UnivariatePolynomialCategory(R) with + C == Join(UnivariatePolynomialCategory(R),CoercibleFrom Rep) with --operations setPoly : Rep -> Rep ++ setPoly(x) \undocumented @@ -31,8 +31,6 @@ ModMonic(R,Rep): C == T ++ reduce(x) \undocumented lift: % -> Rep --reduce lift = identity ++ lift(x) \undocumented - coerce: Rep -> % - ++ coerce(x) \undocumented Vectorise: % -> Vector(R) ++ Vectorise(x) \undocumented UnVectorise: Vector(R) -> % diff --git a/src/algebra/ore.spad.pamphlet b/src/algebra/ore.spad.pamphlet index 3e2f769c..87268627 100644 --- a/src/algebra/ore.spad.pamphlet +++ b/src/algebra/ore.spad.pamphlet @@ -506,9 +506,7 @@ SparseUnivariateSkewPolynomial(R:Ring, sigma:Automorphism R, delta: R -> R): ++ coefficient field in a named variable. ++ The multiplication is given by \spad{x a = \sigma(a) x + \delta a}. UnivariateSkewPolynomial(x:Symbol, R:Ring, sigma:Automorphism R, delta: R -> R): - UnivariateSkewPolynomialCategory R with - coerce: Variable x -> % - ++ coerce(x) returns x as a skew-polynomial. + Join(UnivariateSkewPolynomialCategory R,CoercibleFrom Variable x) == SparseUnivariateSkewPolynomial(R, sigma, delta) add Rep := SparseUnivariateSkewPolynomial(R, sigma, delta) coerce(v:Variable(x)):% == monomial(1, 1) diff --git a/src/algebra/poly.spad.pamphlet b/src/algebra/poly.spad.pamphlet index 9cdc6ad8..ff21510e 100644 --- a/src/algebra/poly.spad.pamphlet +++ b/src/algebra/poly.spad.pamphlet @@ -785,9 +785,7 @@ SparseUnivariatePolynomialFunctions2(R:Ring, S:Ring): with ++ Note: if the coefficient ring is a field, then this domain forms a euclidean domain. UnivariatePolynomial(x:Symbol, R:Ring): - UnivariatePolynomialCategory(R) with - coerce: Variable(x) -> % - ++ coerce(x) converts the variable x to a univariate polynomial. + Join(UnivariatePolynomialCategory(R),CoercibleFrom Variable x) with fmecg: (%,NonNegativeInteger,R,%) -> % ++ fmecg(p1,e,r,p2) finds X : p1 - r * X**e * p2 == SparseUnivariatePolynomial(R) add diff --git a/src/algebra/prtition.spad.pamphlet b/src/algebra/prtition.spad.pamphlet index 45466b9c..dd09fcd3 100644 --- a/src/algebra/prtition.spad.pamphlet +++ b/src/algebra/prtition.spad.pamphlet @@ -36,7 +36,7 @@ Partition: Exports == Implementation where UN ==> Union(%,"failed") Exports ==> Join(OrderedCancellationAbelianMonoid, - ConvertibleTo List Integer) with + ConvertibleTo List Integer,CoercibleTo List Integer) with partition: L I -> % ++ partition(li) converts a list of integers li to a partition powers: L I -> L L I @@ -51,8 +51,6 @@ Partition: Exports == Implementation where ++ This function is used in the package \spadtype{CycleIndicators}. conjugate: % -> % ++ conjugate(p) returns the conjugate partition of a partition p - coerce:% -> List Integer - ++ coerce(p) coerces a partition into a list of integers Implementation ==> add diff --git a/src/algebra/puiseux.spad.pamphlet b/src/algebra/puiseux.spad.pamphlet index 8b4bb665..e0c2dc5d 100644 --- a/src/algebra/puiseux.spad.pamphlet +++ b/src/algebra/puiseux.spad.pamphlet @@ -36,7 +36,7 @@ UnivariatePuiseuxSeriesConstructorCategory(Coef,ULS):_ RN ==> Fraction Integer Definition ==> Join(UnivariatePuiseuxSeriesCategory(Coef),_ - RetractableTo ULS) with + RetractableTo ULS,CoercibleFrom ULS) with puiseux: (RN,ULS) -> % ++ \spad{puiseux(r,f(x))} returns \spad{f(x^r)}. rationalPower: % -> RN @@ -48,9 +48,6 @@ UnivariatePuiseuxSeriesConstructorCategory(Coef,ULS):_ degree: % -> RN ++ \spad{degree(f(x))} returns the degree of the leading term of the ++ Puiseux series \spad{f(x)}, which may have zero as a coefficient. - coerce: ULS -> % - ++ \spad{coerce(f(x))} converts the Laurent series \spad{f(x)} to a - ++ Puiseux series. laurent: % -> ULS ++ \spad{laurent(f(x))} converts the Puiseux series \spad{f(x)} to a ++ Laurent series if possible. Error: if this is not possible. @@ -448,10 +445,7 @@ UnivariatePuiseuxSeries(Coef,var,cen): Exports == Implementation where ULS ==> UnivariateLaurentSeries(Coef,var,cen) Exports ==> Join(UnivariatePuiseuxSeriesConstructorCategory(Coef,ULS),_ - RetractableTo UTS) with - coerce: Variable(var) -> % - ++ coerce(var) converts the series variable \spad{var} into a - ++ Puiseux series. + RetractableTo UTS,CoercibleFrom Variable var) with differentiate: (%,Variable(var)) -> % ++ \spad{differentiate(f(x),x)} returns the derivative of ++ \spad{f(x)} with respect to \spad{x}. diff --git a/src/algebra/radix.spad.pamphlet b/src/algebra/radix.spad.pamphlet index 3fb80cd2..80b12c4c 100644 --- a/src/algebra/radix.spad.pamphlet +++ b/src/algebra/radix.spad.pamphlet @@ -42,9 +42,8 @@ RadixExpansion(bb): Exports == Implementation where ST ==> Stream Integer QuoRem ==> Record(quotient: Integer, remainder: Integer) - Exports ==> QuotientFieldCategory(Integer) with - coerce: % -> Fraction Integer - ++ coerce(rx) converts a radix expansion to a rational number. + Exports == Join(QuotientFieldCategory(Integer),_ + CoercibleTo Fraction Integer) with fractionPart: % -> Fraction Integer ++ fractionPart(rx) returns the fractional part of a radix expansion. wholeRagits: % -> List Integer @@ -280,11 +279,8 @@ RadixExpansion(bb): Exports == Implementation where ++ binary expansions. BinaryExpansion(): Exports == Implementation where - Exports ==> QuotientFieldCategory(Integer) with - coerce: % -> Fraction Integer - ++ coerce(b) converts a binary expansion to a rational number. - coerce: % -> RadixExpansion(2) - ++ coerce(b) converts a binary expansion to a radix expansion with base 2. + Exports == Join(QuotientFieldCategory(Integer),_ + CoercibleTo Fraction Integer,CoercibleTo RadixExpansion(2)) with fractionPart: % -> Fraction Integer ++ fractionPart(b) returns the fractional part of a binary expansion. binary: Fraction Integer -> % @@ -312,12 +308,8 @@ BinaryExpansion(): Exports == Implementation where ++ This domain allows rational numbers to be presented as repeating ++ decimal expansions. DecimalExpansion(): Exports == Implementation where - Exports ==> QuotientFieldCategory(Integer) with - coerce: % -> Fraction Integer - ++ coerce(d) converts a decimal expansion to a rational number. - coerce: % -> RadixExpansion(10) - ++ coerce(d) converts a decimal expansion to a radix expansion - ++ with base 10. + Exports == Join(QuotientFieldCategory(Integer),_ + CoercibleTo Fraction Integer,CoercibleTo RadixExpansion 10) with fractionPart: % -> Fraction Integer ++ fractionPart(d) returns the fractional part of a decimal expansion. decimal: Fraction Integer -> % @@ -346,12 +338,9 @@ DecimalExpansion(): Exports == Implementation where ++ hexadecimal expansions. HexadecimalExpansion(): Exports == Implementation where - Exports ==> QuotientFieldCategory(Integer) with - coerce: % -> Fraction Integer - ++ coerce(h) converts a hexadecimal expansion to a rational number. - coerce: % -> RadixExpansion(16) - ++ coerce(h) converts a hexadecimal expansion to a radix expansion - ++ with base 16. + Exports == Join(QuotientFieldCategory(Integer),_ + CoercibleTo Fraction Integer,_ + CoercibleTo RadixExpansion 16) with fractionPart: % -> Fraction Integer ++ fractionPart(h) returns the fractional part of a hexadecimal expansion. hex: Fraction Integer -> % diff --git a/src/algebra/rf.spad.pamphlet b/src/algebra/rf.spad.pamphlet index c8e40f71..764a50a7 100644 --- a/src/algebra/rf.spad.pamphlet +++ b/src/algebra/rf.spad.pamphlet @@ -26,8 +26,7 @@ PolynomialCategoryQuotientFunctions(E, V, R, P, F): V: OrderedSet R: Ring P: PolynomialCategory(R, E, V) - F: Field with - coerce: P -> % + F: Join(Field,CoercibleFrom P) with numer : % -> P denom : % -> P diff --git a/src/algebra/stream.spad.pamphlet b/src/algebra/stream.spad.pamphlet index 66d7a227..a691aab2 100644 --- a/src/algebra/stream.spad.pamphlet +++ b/src/algebra/stream.spad.pamphlet @@ -587,13 +587,11 @@ Stream(S): Exports == Implementation where NNI ==> NonNegativeInteger U ==> UniversalSegment I - Exports ==> LazyStreamAggregate(S) with + Exports == Join(LazyStreamAggregate(S),CoercibleFrom L S) with shallowlyMutable ++ one may destructively alter a stream by assigning new ++ values to its entries. - coerce: L S -> % - ++ coerce(l) converts a list l to a stream. repeating: L S -> % ++ repeating(l) is a repeating stream whose period is the list l. if S has SetCategory then diff --git a/src/algebra/sum.spad.pamphlet b/src/algebra/sum.spad.pamphlet index e866dc11..a4eef16f 100644 --- a/src/algebra/sum.spad.pamphlet +++ b/src/algebra/sum.spad.pamphlet @@ -79,8 +79,8 @@ GosperSummationMethod(E, V, R, P, Q): Exports == Impl where V: OrderedSet R: IntegralDomain P: PolynomialCategory(R, E, V) - Q: Join(RetractableTo Fraction Integer, Field with - (coerce: P -> %; numer : % -> P; denom : % -> P)) + Q: Join(RetractableTo Fraction Integer, CoercibleFrom P, Field with + (numer : % -> P; denom : % -> P)) I ==> Integer RN ==> Fraction I diff --git a/src/algebra/supxs.spad.pamphlet b/src/algebra/supxs.spad.pamphlet index 311d6cd6..adddd2e9 100644 --- a/src/algebra/supxs.spad.pamphlet +++ b/src/algebra/supxs.spad.pamphlet @@ -43,10 +43,7 @@ SparseUnivariatePuiseuxSeries(Coef,var,cen): Exports == Implementation where SUPS ==> InnerSparseUnivariatePowerSeries(Coef) Exports ==> Join(UnivariatePuiseuxSeriesConstructorCategory(Coef,SULS),_ - RetractableTo SUTS) with - coerce: Variable(var) -> % - ++ coerce(var) converts the series variable \spad{var} into a - ++ Puiseux series. + RetractableTo SUTS,CoercibleFrom Variable var) with differentiate: (%,Variable(var)) -> % ++ \spad{differentiate(f(x),x)} returns the derivative of ++ \spad{f(x)} with respect to \spad{x}. diff --git a/src/algebra/symbol.spad.pamphlet b/src/algebra/symbol.spad.pamphlet index 8367da5c..b41a4f0a 100644 --- a/src/algebra/symbol.spad.pamphlet +++ b/src/algebra/symbol.spad.pamphlet @@ -23,7 +23,7 @@ Symbol(): Exports == Implementation where Scripts ==> Record(sub:L,sup:L,presup:L,presub:L,args:L) Exports ==> Join(OrderedSet, ConvertibleTo InputForm, OpenMath, - ConvertibleTo Symbol, + ConvertibleTo Symbol,CoercibleFrom String, ConvertibleTo Pattern Integer, ConvertibleTo Pattern Float, PatternMatchable Integer, PatternMatchable Float) with new: () -> % @@ -33,8 +33,6 @@ Symbol(): Exports == Implementation where resetNew: () -> Void ++ resetNew() resets the internals counters that new() and ++ new(s) use to return distinct symbols every time. - coerce: String -> % - ++ coerce(s) converts the string s to a symbol. name: % -> % ++ name(s) returns s without its scripts. scripted?: % -> Boolean diff --git a/src/algebra/syntax.spad.pamphlet b/src/algebra/syntax.spad.pamphlet index e0d71282..ca967397 100644 --- a/src/algebra/syntax.spad.pamphlet +++ b/src/algebra/syntax.spad.pamphlet @@ -372,9 +372,7 @@ import CoercibleTo Syntax ++ Date Last Modified: September 21, 2008 ++ Description: This is the category of Spad abstract syntax trees. AbstractSyntaxCategory(): Category == - Join(SetCategory, CoercibleTo Syntax) with - coerce: Syntax -> % - ++ coerce(s) parses syntax object `s' as a Spad construct. + Join(SetCategory, HomotopicTo Syntax) add coerce(x: %): Syntax == x pretend Syntax diff --git a/src/algebra/tex.spad.pamphlet b/src/algebra/tex.spad.pamphlet index adc11106..1144842d 100644 --- a/src/algebra/tex.spad.pamphlet +++ b/src/algebra/tex.spad.pamphlet @@ -89,10 +89,7 @@ TexFormat(): public == private where S ==> String US ==> UniversalSegment(Integer) - public == SetCategory with - coerce: E -> $ - ++ coerce(o) changes o in the standard output format to TeX - ++ format. + public == Join(SetCategory,CoercibleFrom E) with convert: (E,I) -> $ ++ convert(o,step) changes o in standard output format to ++ TeX format and also adds the given step number. This is useful diff --git a/src/algebra/tree.spad.pamphlet b/src/algebra/tree.spad.pamphlet index c574d9a4..5b573f8f 100644 --- a/src/algebra/tree.spad.pamphlet +++ b/src/algebra/tree.spad.pamphlet @@ -615,14 +615,11 @@ BalancedBinaryTree(S: SetCategory): Exports == Implementation where ++ A PendantTree(S)is either a leaf? and is an S or has ++ a left and a right both PendantTree(S)'s PendantTree(S: SetCategory): T == C where - T == BinaryRecursiveAggregate(S) with + T == Join(BinaryRecursiveAggregate(S),CoercibleTo Tree S) with ptree : S->% ++ ptree(s) is a leaf? pendant tree ptree:(%, %)->% ++ ptree(x,y) \undocumented - coerce:%->Tree S - ++ coerce(x) \undocumented - C == add Rep := Tree S diff --git a/src/algebra/xpoly.spad.pamphlet b/src/algebra/xpoly.spad.pamphlet index 4049f1b6..c80e3e53 100644 --- a/src/algebra/xpoly.spad.pamphlet +++ b/src/algebra/xpoly.spad.pamphlet @@ -379,10 +379,7 @@ import Algebra ++ Author: Michel Petitot (petitot@lifl.fr) XAlgebra(R: Ring): Category == - Join(Ring, BiModule(R,R)) with - --operations - coerce: R -> % - ++ \spad{coerce(r)} equals \spad{r*1}. + Join(Ring, BiModule(R,R),CoercibleFrom R) with -- attributs if R has CommutativeRing then Algebra(R) -- if R has CommutativeRing then Module(R) @@ -548,14 +545,12 @@ XPolynomialRing(R:Ring,E:OrderedMonoid): T == C where EX ==> OutputForm NNI ==> NonNegativeInteger - T == Join(Ring, XAlgebra(R), FreeModuleCat(R,E)) with + T == Join(Ring, XAlgebra(R), FreeModuleCat(R,E),CoercibleFrom E) with --operations "*": (%,R) -> % ++ \spad{p*r} returns the product of \spad{p} by \spad{r}. "#": % -> NonNegativeInteger ++ \spad{# p} returns the number of terms in \spad{p}. - coerce: E -> % - ++ \spad{coerce(e)} returns \spad{1*e} maxdeg: % -> E ++ \spad{maxdeg(p)} returns the greatest word occurring in the polynomial \spad{p} ++ with a non-zero coefficient. An error is produced if \spad{p} is zero. |