Hi Waldek,

I need some hints.

After a few fixes wrt the aldor-interface, I am stuck with the following error.

#1 (Error) Argument 2 of `FiniteDivisor' did not match any possible parameter type.
    The rejected type is UnivariatePolynomialCategory(#1 pretend Ring).
    Expected type UnivariatePolynomialCategory(#2 pretend Field).

It steams from ap/PFO.ap. The original code is in pfo.spad.pamphlet (copied below). What looks a bit strange and that is where this error comes from is the translation of

  if R0 has CharacteristicZero and F has AlgebraicallyClosedField then
    simplifyCoeffs : (FD, List K) -> N

into the .ap format. That's done via |makeAxExportForm| from ax.boot.
(See generate-ax-file in src/aldor/gendepap.lsp.)

Only in this "if" body there appear |PretendTo| expressions (see below) that seem to let the aldor compilation fail. For sure there must be some technicalities to ensure that inside that "if" body R0 and F belong additionally to other categories, but I don't quite understand why I see "(|PretendTo| |#2| |Field|)" or (|PretendTo| |#1| |Ring|)".

I don't know exactly which part of the FriCAS code is responsible for this, but I've the feeling that it is not ax.boot, since that is just translating the available data structures.

Anyway, this generation even looks wrong to me. Let's suppose the context is Foo: Cat1. Then

  if Foo has Cat2 then CODE

should mean that inside CODE we can claim Foo: Join(Cat1, Cat2).

But as you see below, it looks as if FriCAS just "|PretendTo| whatever FiniteDivisor or UnivariatePolynomialCategory is originally defined.

UnivariatePolynomialCategory(R:Ring): Category == ...
FiniteDivisorCategory(F, UP, UPUP, R): Category == Result where
  F   : Field
  ...



Do you think the generated code is correct and Aldor simply shouldn't fail? Or is the error rather on the FriCAS side?

Ralf

PS: Removing all the |PretendTo| expressions from the .ap file and simply writing

                (|If| (|Test| (|Has| |#1| |CharacteristicZero|))
                  (|If| (|Test| (|Has| |#2| |AlgebraicallyClosedField|))
                   (|Declare| |simplifyCoeffs|
                    (|Apply| ->
                     (|Comma|
                      (|Apply| |FiniteDivisor| |#2| |#3| |#4| |#5|)
                      (|Apply| |List| (|Apply| |Kernel| |#2|)))
                     |NonNegativeInteger|))
                   NIL)
                  NIL)

let's aldor compile PFO.ap without any error message.


====================================
from pfo.spad.pamphlet
https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/pfo.spad.pamphlet#L154
====================================
PointsOfFiniteOrder(R0, F, UP, UPUP, R): Exports == Implementation where
  R0   : Join(Comparable, IntegralDomain, RetractableTo Integer)
  F    : FunctionSpace R0
  UP   : UnivariatePolynomialCategory F
  UPUP : UnivariatePolynomialCategory Fraction UP
  R    : FunctionFieldCategory(F, UP, UPUP)

  PI  ==> PositiveInteger
  N   ==> NonNegativeInteger
  Z   ==> Integer
  Q   ==> Fraction Integer
  UPF ==> SparseUnivariatePolynomial F
  UPQ ==> SparseUnivariatePolynomial Q
  QF  ==> Fraction UP
  UPUPQ ==> SparseUnivariatePolynomial Fraction UPQ
  UP2 ==> SparseUnivariatePolynomial UPQ
  UP3 ==> SparseUnivariatePolynomial UP2
  FD  ==> FiniteDivisor(F, UP, UPUP, R)
  K   ==> Kernel F
  REC ==> Record(ncurve:UP3, disc:Z, dfpoly:UPQ)
  RC0 ==> Record(ncurve:UPUPQ, disc:Z)
  ID  ==> FractionalIdeal(UP, QF, UPUP, R)
  SMP ==> SparseMultivariatePolynomial(R0,K)

  Exports ==> with
    order        : FD -> Union(N, "failed")
        ++ order(f) \undocumented
    torsion?     : FD -> Boolean
        ++ torsion?(f) \undocumented
    torsionIfCan : FD -> Union(Record(order:N, function:R), "failed")
        ++ torsionIfCan(f)\ undocumented
    cmult        : List SMP -> SMP
        ++ cmult(x) should be local but conditional
    possibleOrder : FD -> N
    if R0 has CharacteristicZero and F has AlgebraicallyClosedField then
        simplifyCoeffs : (FD, List K) -> N
          ++ simplifyCoeffs(d, la) should be local but conditional

====================================
from PFO.ap
====================================
(|If| (|Test| (|Has| |#1| |CharacteristicZero|))
                  (|If| (|Test| (|Has| |#2| |AlgebraicallyClosedField|))
                   (|Declare| |simplifyCoeffs|
                    (|Apply| ->
                     (|Comma|
                      (|Apply| |FiniteDivisor| (|PretendTo| |#2| |Field|)
                       (|PretendTo| |#3|
                        (|Apply| |UnivariatePolynomialCategory|
                         (|PretendTo| |#1| |Ring|)))
                       (|PretendTo| |#4|
                        (|Apply| |UnivariatePolynomialCategory|
                         (|PretendTo|
                          (|Apply| |Fraction|
                           (|PretendTo| |#2| |IntegralDomain|))
                          |Ring|)))
                       (|PretendTo| |#5|
                        (|Apply| |FunctionFieldCategory|
                         (|PretendTo| |#1| |UniqueFactorizationDomain|)
                         (|PretendTo| |#2|
                          (|Apply| |UnivariatePolynomialCategory|
                           (|PretendTo| |#1| |Ring|)))
                         (|PretendTo| |#3|
                          (|Apply| |UnivariatePolynomialCategory|
                           (|PretendTo|
                            (|Apply| |Fraction|
                             (|PretendTo| |#2| |IntegralDomain|))
                            |Ring|))))))
                      (|Apply| |List|
                       (|PretendTo|
                        (|Apply| |Kernel| (|PretendTo| |#2| |Comparable|))
                        |Type|)))
                     |NonNegativeInteger|))
                   NIL)
                  NIL)

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to