[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Axiom-developer] what is meaining of % in SPAD

From: Page, Bill
Subject: RE: [Axiom-developer] what is meaining of % in SPAD
Date: Wed, 20 Jul 2005 19:38:43 -0400

Let me attempt an answer to my earlier question.

On Wednesday, July 20, 2005 5:54 PM I wrote:

> What does the % represent?

It means "self" or "this". So that in the example definition of the
domain Expression

> )abbrev domain EXPR Expression
> Expression(R:OrderedSet): Exports == Implementation where
>   K   ==> Kernel %

if I write



  K ==> Kernel EXPR INT

> Or more specifically, what exactly is the value of Rep above
> if I write:
> (%e<%pi)$EXPR INT

William already answered this question implicitly in a previous

>  MP  ==> SparseMultivariatePolynomial(R, K)
> Implementation --> Add
>    if R has IntegralDomain then
>      Rep := Fraction MP

So we get

  Rep := Fraction SparseMultivariatePolynomial(INT,Kernel EXPR INT)


The point of this is the definition of the '<' operator in

  x:% < y:% == x <$Rep y

It turns out that the ordering of %e and %pi in Rep are determined
by the ordering given by Kernel EXPR INT. And this magic is encanted
in the file 'kl.spad.pamphlet' where CachableSet is implemented. We
see that the '<' operator in Kernel depends on the position of the
expressions %e and %pi in the cache associated with EXPR INT.

    k1 < k2 ==
      if k1.posit = 0 then enterInCache(k1, triage)
      if k2.posit = 0 then enterInCache(k2, triage)
      k1.posit < k2.posit

The position in the cashe in turn is determined by the following
deeply mysterious function:

    triage(k1, k2) ==
      k1.nest   ^= k2.nest   => B2Z(k1.nest   < k2.nest)
      k1.op ^= k2.op => B2Z(k1.op < k2.op)
      (n1 := #(argument k1)) ^= (n2 := #(argument k2)) => B2Z(n1 < n2)
      ((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)

In any case, it seems that as symbols %e ends up at a higher location
in the cache then %pi inspite of the numerical values that they (usually)
represent. Perhaps, if we really would like the ordering in EXPR INT
to be less surprizing to the novice user of Axiom, then we need to
tweak the above routine.

Bill Page.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]