[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] how does the interpreter choose signatures?
From: |
Martin Rubey |
Subject: |
[Axiom-developer] how does the interpreter choose signatures? |
Date: |
26 Jan 2008 21:47:01 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Dear all,
I'd like to understand the following behaviour. Consider
-------------------------------------------------------------------------------
)abb package TEST Test
Test(): with
foo: Fraction Integer -> Fraction Integer
foo: PrimeField 5 -> PrimeField 5
foo: Expression Integer -> Expression Integer
== add
foo(n: Fraction Integer) == n
foo(n: PrimeField 5) == n
foo(n: Expression Integer) == n
-------------------------------------------------------------------------------
Then we have:
(4) -> foo 3
Function Selection for foo
Arguments: PI
-> no appropriate foo found in PositiveInteger
-> no appropriate foo found in Integer
-> no appropriate foo found in PositiveInteger
-> no appropriate foo found in Integer
Modemaps from Associated Packages
no modemaps
Remaining General Modemaps
[1] Expression Integer -> Expression Integer from Test
[2] PrimeField 5 -> PrimeField 5 from Test
[3] Fraction Integer -> Fraction Integer from Test
[1] signature: PF 5 -> PF 5
implemented: slot (PrimeField 5)(PrimeField 5) from TEST
[2] signature: FRAC INT -> FRAC INT
implemented: slot (Fraction (Integer))(Fraction (Integer)) from TEST
[3] signature: EXPR INT -> EXPR INT
implemented: slot (Expression (Integer))(Expression (Integer)) from TEST
(4) 3
Type: PrimeField 5
-------------------------------------------------------------------------------
Note that the interpreter seems to prefer PF 5 over FRAC INT over EXPR INT.
Now consider:
p := z^10; s:=z=0..1;
(6) -> integrate(p, s)
Function Selection for integrate
Arguments: (POLY INT,SEGBIND NNI)
-> no appropriate integrate found in Polynomial Integer
-> no appropriate integrate found in SegmentBinding NonNegativeInteger
-> no appropriate integrate found in Polynomial Integer
-> no appropriate integrate found in SegmentBinding NonNegativeInteger
Modemaps from Associated Packages
[1] (Polynomial D2,Symbol) -> Polynomial D2 from Polynomial D2
if D2 has ALGEBRA FRAC INT and D2 has RING
Remaining General Modemaps
[1] (D,D1) -> D from D
if D1 = SYMBOL and D has UTSCAT D2 and D2 has RING and D2
has ACFS INT and D2 has PRIMCAT and D2 has TRANFUN and D2
has ALGEBRA FRAC INT or D1 = SYMBOL and D has UTSCAT D2 and
D2 has RING and D2 has variables: D2 -> List D1 and D2 has
integrate: (D2,D1) -> D2 and D2 has ALGEBRA FRAC INT
[2] (D,D1) -> D from D
if D1 = SYMBOL and D has UPXSCAT D2 and D2 has RING and D2
has ACFS INT and D2 has PRIMCAT and D2 has TRANFUN and D2
has ALGEBRA FRAC INT or D1 = SYMBOL and D has UPXSCAT D2
and D2 has RING and D2 has variables: D2 -> List D1 and D2
has integrate: (D2,D1) -> D2 and D2 has ALGEBRA FRAC INT
[3] (D,D1) -> D from D
if D1 = SYMBOL and D has ULSCAT D2 and D2 has RING and D2
has ACFS INT and D2 has PRIMCAT and D2 has TRANFUN and D2
has ALGEBRA FRAC INT or D1 = SYMBOL and D has ULSCAT D2 and
D2 has RING and D2 has variables: D2 -> List D1 and D2 has
integrate: (D2,D1) -> D2 and D2 has ALGEBRA FRAC INT
[4] (D,D1) -> D from D
if D has MTSCAT(D2,D1) and D2 has RING and D1 has ORDSET
and D2 has ALGEBRA FRAC INT
[5] (Fraction Polynomial D4,Symbol) -> Union(Expression D4,List
Expression D4)
from IntegrationResultRFToFunction D4
if D4 has CHARZ and D4 has Join(GcdDomain,RetractableTo
Integer,OrderedSet,LinearlyExplicitRingOver Integer)
[6] (GeneralUnivariatePowerSeries(D2,D3,D4),Variable D3) ->
GeneralUnivariatePowerSeries(D2,D3,D4)
from GeneralUnivariatePowerSeries(D2,D3,D4)
if D3: SYMBOL and D2 has ALGEBRA FRAC INT and D2 has RING
and D4: D2
[7] (D2,Symbol) -> Union(D2,List D2) from FunctionSpaceIntegration(
D4,D2)
if D4 has Join(EuclideanDomain,OrderedSet,
CharacteristicZero,RetractableTo Integer,
LinearlyExplicitRingOver Integer) and D2 has Join(
TranscendentalFunctionCategory,PrimitiveFunctionCategory,
AlgebraicallyClosedFunctionSpace D4)
[8] (Fraction Polynomial D4,SegmentBinding OrderedCompletion
Fraction Polynomial D4) -> Union(f1: OrderedCompletion Expression
D4,f2: List OrderedCompletion Expression D4,fail: failed,
pole: potentialPole)
from RationalFunctionDefiniteIntegration D4
if D4 has Join(EuclideanDomain,OrderedSet,
CharacteristicZero,RetractableTo Integer,
LinearlyExplicitRingOver Integer)
[9] (Fraction Polynomial D4,SegmentBinding OrderedCompletion
Expression D4) -> Union(f1: OrderedCompletion Expression D4,f2:
List OrderedCompletion Expression D4,fail: failed,pole:
potentialPole)
from RationalFunctionDefiniteIntegration D4
if D4 has Join(EuclideanDomain,OrderedSet,
CharacteristicZero,RetractableTo Integer,
LinearlyExplicitRingOver Integer)
[10] (D2,SegmentBinding OrderedCompletion D2) -> Union(f1:
OrderedCompletion D2,f2: List OrderedCompletion D2,fail: failed,
pole: potentialPole)
from ElementaryFunctionDefiniteIntegration(D4,D2)
if D2 has Join(TranscendentalFunctionCategory,
PrimitiveFunctionCategory,AlgebraicallyClosedFunctionSpace
D4) and D4 has Join(EuclideanDomain,OrderedSet,
CharacteristicZero,RetractableTo Integer,
LinearlyExplicitRingOver Integer)
[1] signature: (EXPR INT,SEGBIND ORDCOMP EXPR INT) -> Union(f1: ORDCOMP
EXPR INT,f2: LIST ORDCOMP EXPR INT,fail: failed,pole: potentialPole)
implemented: slot (Union (: f1 (OrderedCompletion (Expression
(Integer)))) (: f2 (List (OrderedCompletion (Expression (Integer))))) (: fail
failed) (: pole potentialPole))(Expression (Integer))(SegmentBinding
(OrderedCompletion (Expression (Integer)))) from DEFINTEF(INT,EXPR INT)
[2] signature: (FRAC POLY INT,SEGBIND ORDCOMP EXPR INT) -> Union(f1:
ORDCOMP EXPR INT,f2: LIST ORDCOMP EXPR INT,fail: failed,pole: potentialPole)
implemented: slot (Union (: f1 (OrderedCompletion (Expression
(Integer)))) (: f2 (List (OrderedCompletion (Expression (Integer))))) (: fail
failed) (: pole potentialPole))(Fraction (Polynomial (Integer)))(SegmentBinding
(OrderedCompletion (Expression (Integer)))) from DEFINTRF INT
[3] signature: (FRAC POLY INT,SEGBIND ORDCOMP FRAC POLY INT) -> Union(f1:
ORDCOMP EXPR INT,f2: LIST ORDCOMP EXPR INT,fail: failed,pole: potentialPole)
implemented: slot (Union (: f1 (OrderedCompletion (Expression
(Integer)))) (: f2 (List (OrderedCompletion (Expression (Integer))))) (: fail
failed) (: pole potentialPole))(Fraction (Polynomial (Integer)))(SegmentBinding
(OrderedCompletion (Fraction (Polynomial (Integer))))) from DEFINTRF INT
Function Selection for map by coercion facility (map)
Arguments: ((NNI -> ORDCOMP EXPR INT),SEGBIND NNI)
Target type: SEGBIND ORDCOMP EXPR INT
-> no appropriate map found in SegmentBinding NonNegativeInteger
-> no appropriate map found in SegmentBinding OrderedCompletion Expression
Integer
-> no appropriate map found in OrderedCompletion Expression Integer
-> no appropriate map found in NonNegativeInteger
-> no appropriate map found in OrderedCompletion Expression Integer
Modemaps from Associated Packages
[1] ((D4 -> D5),SegmentBinding D4) -> SegmentBinding D5
from SegmentBindingFunctions2(D4,D5)
if D4 has TYPE and D5 has TYPE
[1] signature: ((NNI -> ORDCOMP EXPR INT),SEGBIND NNI) -> SEGBIND ORDCOMP
EXPR INT
implemented: slot (SegmentBinding (OrderedCompletion (Expression
(Integer))))(Mapping (OrderedCompletion (Expression (Integer)))
(NonNegativeInteger))(SegmentBinding (NonNegativeInteger)) from
SEGBIND2(NNI,ORDCOMP EXPR INT)
1
(6) --
11
Type: Union(f1: OrderedCompletion Expression Integer,...)
There are many things I do not understand:
1) why doesn't the interpreter choose the "General Modemap"
[8] (Fraction Polynomial D4,SegmentBinding OrderedCompletion
Fraction Polynomial D4)
?
2) why is its preference different now:
[1] signature: (EXPR INT,SEGBIND ORDCOMP EXPR INT) -> Union(f1: ORDCOMP
EXPR INT,f2: LIST ORDCOMP EXPR INT,fail: failed,pole: potentialPole)
implemented: slot (Union (: f1 (OrderedCompletion (Expression
(Integer)))) (: f2 (List (OrderedCompletion (Expression (Integer))))) (: fail
failed) (: pole potentialPole))(Expression (Integer))(SegmentBinding
(OrderedCompletion (Expression (Integer)))) from DEFINTEF(INT,EXPR INT)
[2] signature: (FRAC POLY INT,SEGBIND ORDCOMP EXPR INT) -> Union(f1:
ORDCOMP EXPR INT,f2: LIST ORDCOMP EXPR INT,fail: failed,pole: potentialPole)
implemented: slot (Union (: f1 (OrderedCompletion (Expression
(Integer)))) (: f2 (List (OrderedCompletion (Expression (Integer))))) (: fail
failed) (: pole potentialPole))(Fraction (Polynomial (Integer)))(SegmentBinding
(OrderedCompletion (Expression (Integer)))) from DEFINTRF INT
[3] signature: (FRAC POLY INT,SEGBIND ORDCOMP FRAC POLY INT) -> Union(f1:
ORDCOMP EXPR INT,f2: LIST ORDCOMP EXPR INT,fail: failed,pole: potentialPole)
implemented: slot (Union (: f1 (OrderedCompletion (Expression
(Integer)))) (: f2 (List (OrderedCompletion (Expression (Integer))))) (: fail
failed) (: pole potentialPole))(Fraction (Polynomial (Integer)))(SegmentBinding
(OrderedCompletion (Fraction (Polynomial (Integer))))) from DEFINTRF INT
I.e., in package DEFINTRF, it seems to prefer (FRAC POLY INT,SEGBIND ORDCOMP
EXPR INT) over (FRAC POLY INT,SEGBIND ORDCOMP FRAC POLY INT).
3) why does it prefer DEFINTEF(INT,EXPR INT) over DEFINTRF INT ?
ANY hints?
Martin
- [Axiom-developer] how does the interpreter choose signatures?,
Martin Rubey <=