login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for SandBoxSpeciesAldor revision 10 of 11

1 2 3 4 5 6 7 8 9 10 11
Editor: Bill Page
Time: 2008/06/17 16:08:35 GMT-7
Note: Suspicious juxtaposition

added:

From BillPage Tue Jun 17 16:08:35 -0700 2008
From: Bill Page
Date: Tue, 17 Jun 2008 16:08:35 -0700
Subject: Suspicious juxtaposition
Message-ID: <20080617160835-0700@axiom-wiki.newsynthesis.org>

What is the intention of 'BugWorkaround' in this code::

  local cisCoefficient(n: I): P == BugWorkaround(
    PrimePowerProduct has with {
            divisors: % -> Generator %;
            /: (%, %) -> %;
    }
  ){
        import from Z, V, SmallIntegerTools;
        ...

It results in the message::

  L94 C2] #2 (Warning) Suspicious juxtaposition.  Check for missing `;'.


Test species in axiom/FriCAS?.

The species project is written in Aldor. Thus we need to load the libraries explicitly:

axiom
)cd ~/combinat/src
The current FriCAS default directory is /var/zope2/var/LatexWiki
axiom
)re ../lib/combinat.input
The file ../lib/combinat.input is needed but does not exist.

Let's define a binary tree.

aldor
#includeDir "/var/lib/zope/combinat/include"
#libraryDir "/var/lib/zope/combinat/lib"
#include "combinat"
macro { E == EmptySetSpecies; X == SingletonSpecies; + == Plus; * == Times; }
A(L: LabelType): CombinatorialSpecies L == (E + X*A*A)(L) add;
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/5200085684951427974-25px002.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file 
      ./5200085684951427974-25px002.lsp
   Issuing )library command for 5200085684951427974-25px002
   Reading /var/zope2/var/LatexWiki/5200085684951427974-25px002.asy
   A is now explicitly exposed in frame initial 
>> System error: The value |OutputType| is not of type LIST.

aldor
#includeDir "/var/lib/zope/combinat/include"
#libraryDir "/var/lib/zope/combinat/lib"
#assert MacrosCombinat
#assert Axiom
#include "combinat"
macro {
        SPECIES == (L: LabelType) -> CombinatorialSpecies L;
        V == CycleIndexVariable;
        NonNegativeMachineInteger == I;
        T == SparseIndexedPowerProduct(V, NonNegativeMachineInteger);
        P == SparseDistributedPolynomial(Q, V, T);
}
LinearOrder(L: LabelType): with {
CombinatorialSpecies L;
coerce: % -> List L;
} == List L add {
        Rep == List L;
        import from Rep;
coerce(x: %): List L == rep x; local lists(l: List L): Generator List L == generate { empty? l => yield l; current := l; c := first current; for u in lists(rest l) repeat yield cons(c, u); assert(not empty? current); while not empty?(tmp := rest current) repeat { c := first tmp; setrest!(current, rest tmp); -- remove c from l for u in lists l repeat yield cons(c, u); setrest!(current, tmp); -- put c back into l current := tmp; } } structures(s: SetSpecies L): Generator % == generate { for l in lists(s :: List L) repeat yield per l; } local LinearOrderIsomorphismType: IsomorphismTypeCategory L == add { isomorphismTypes(s: MultiSet L): Generator % == never; (x:%) = (y:%): Boolean == never; (tw: TextWriter) << (x: %): TextWriter == never; }
IsomorphismType: IsomorphismTypeCategory L == LinearOrderIsomorphismType; generatingSeries: ExponentialGeneratingSeries == { (stream(1$Q)$DataStream(Q)) :: ExponentialGeneratingSeries; } isomorphismTypeGeneratingSeries: OrdinaryGeneratingSeries == { (stream(1$Z)$DataStream(Z)) :: OrdinaryGeneratingSeries; } local cisGenerator: Generator P == generate { import from I, T, P; x1: V := 1::V; for n: I in 0.. repeat yield power(x1, n) :: P; } cycleIndexSeries: CycleIndexSeries == cisGenerator :: CycleIndexSeries; import from String; expression: SpeciesExpression == leaf("LinearOrder"); }
Cycle(L: LabelType): with { CombinatorialSpecies L; coerce: % -> List L; cycle: List L -> %; } == List L add { Rep == List L; import from I, Rep;
local cisCycle(ao: I): Generator P == generate { macro PrimePowerProduct == SparseIndexedPowerProduct(I, I);
local multiply(k: PrimePowerProduct): I == { r: I := 1; for ep in k repeat {(e, p) := ep; r := r * p^e} r; }
local eulerPhi(t: SparseIndexedPowerProduct(I, I)): I == { phi: I := 1; for ep in t repeat { (e, p) := ep; phi := phi * p^(e-1) * (p-1) } phi; }
local cisCoefficient(n: I): P == BugWorkaround( PrimePowerProduct has with { divisors: % -> Generator %; /: (%, %) -> %; } ){ import from Z, V, SmallIntegerTools; nn: PrimePowerProduct := factor n; p: P := 0; for m in divisors nn repeat { k: PrimePowerProduct := nn/m; q: Q := (eulerPhi(k) :: Z) / (n :: Z); xk: V := multiply(k) :: V; t: T := power(xk, multiply m); p := [q, t]$P + p; } p; } yield 0$P; for n:I in 1.. repeat yield cisCoefficient(n); } coerce(x: %): List L == rep x; cycle(l: List L): % == per l; structures(s: SetSpecies L): Generator % == generate { import from LinearOrder L; if not empty? s then { l: List L := s :: List L; u := first l; for t in structures(set rest l)$LinearOrder(L) repeat { yield per cons(u, t :: List L); } } }
local CycleIsomorphismType: IsomorphismTypeCategory L == add { isomorphismTypes(s: MultiSet L): Generator % == never; (x:%) = (y:%): Boolean == never; (tw: TextWriter) << (x: %): TextWriter == never; } IsomorphismType: IsomorphismTypeCategory L == CycleIsomorphismType; local cycleOrder(): SeriesOrder == 1 :: SeriesOrder; egsCycle(ao: I): Generator Q == generate { import from Z, Q; yield 0; for n:I in 1.. repeat yield inv(n :: Z); } generatingSeries: ExponentialGeneratingSeries == new(egsCycle, cycleOrder); ogsCycle(ao: I): Generator Z == generate {yield 0$Z; yield 1$Z}; isomorphismTypeGeneratingSeries: OrdinaryGeneratingSeries == { new(ogsCycle, cycleOrder); } cycleIndexSeries: CycleIndexSeries == new(cisCycle, cycleOrder); import from String; expression: SpeciesExpression == leaf("Cycle"); }
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/6373670188426008557-25px003.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
"/var/zope2/var/LatexWiki/6373670188426008557-25px003.as", line 94: 
){
.^
[L94 C2] #1 (Warning) Suspicious juxtaposition.  Check for missing `;'.
Check indentation if you are using `#pile'.
Compiling Lisp source code from file ./6373670188426008557-25px003.lsp Issuing )library command for 6373670188426008557-25px003 Reading /var/zope2/var/LatexWiki/6373670188426008557-25px003.asy LinearOrder is now explicitly exposed in frame initial
>> System error: The value |OutputType| is not of type LIST.

axiom
labels: SetSpecies ACINT := set [i::ACINT for i in 1..3]
There are no library operations named SetSpecies Use HyperDoc Browse or issue )what op SetSpecies to learn if there is any operation containing " SetSpecies " in its name.
Cannot find a definition or applicable library operation named SetSpecies with argument type(s) Variable(ACINT)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.
axiom
)set output tex off
 
axiom
)set output algebra on
[structures(labels)$Cycle(ACINT)]$ACLIST(Cycle(ACINT))
There are no library operations named Cycle Use HyperDoc Browse or issue )what op Cycle to learn if there is any operation containing " Cycle " in its name.
Cannot find a definition or applicable library operation named Cycle with argument type(s) Variable(ACINT)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

axiom
I := ACMachineInteger
(1) ACMachineInteger
Type: Variable(ACMachineInteger?)
axiom
Z := ACInteger
(2) ACInteger
Type: Variable(ACInteger?)
axiom
Q := ACFraction Z
There are no library operations named ACFraction Use HyperDoc Browse or issue )what op ACFraction to learn if there is any operation containing " ACFraction " in its name.
Cannot find a definition or applicable library operation named ACFraction with argument type(s) Variable(ACInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. V := CycleIndexVariable
(3) CycleIndexVariable
Type: Variable(CycleIndexVariable?)
axiom
T := SparseIndexedPowerProduct(V, I)
There are no library operations named SparseIndexedPowerProduct Use HyperDoc Browse or issue )what op SparseIndexedPowerProduct to learn if there is any operation containing " SparseIndexedPowerProduct " in its name.
Cannot find a definition or applicable library operation named SparseIndexedPowerProduct with argument type(s) Variable(CycleIndexVariable) Variable(ACMachineInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. P := SparseDistributedPolynomial(Q, V, T)
There are no library operations named SparseDistributedPolynomial Use HyperDoc Browse or issue )what op SparseDistributedPolynomial to learn if there is any operation containing " SparseDistributedPolynomial " in its name.
Cannot find a definition or applicable library operation named SparseDistributedPolynomial with argument type(s) Variable(Q) Variable(CycleIndexVariable) Variable(T)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. S := CycleIndexSeries;
Type: Variable(CycleIndexSeries?)
axiom
X := A(Z)
Cannot convert the first argument of A(Z) to the type NIL.
axiom
)show X
The )show system command is used to display information about types or partial types. For example, )show Integer will show information about Integer .
X is not the name of a known type constructor. If you want to see information about any operations named X , issue )display operations X labels: SetSpecies Z := set [i::Z for i in 1..3]
There are no library operations named SetSpecies Use HyperDoc Browse or issue )what op SetSpecies to learn if there is any operation containing " SetSpecies " in its name.
Cannot find a definition or applicable library operation named SetSpecies with argument type(s) Variable(ACInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.
axiom
)set output tex off
 
axiom
)set output algebra on
[structures(labels)$X]$ACLIST(X)
There are no library operations named ACLIST Use HyperDoc Browse or issue )what op ACLIST to learn if there is any operation containing " ACLIST " in its name.
Cannot find a definition or applicable library operation named ACLIST with argument type(s) Variable(X)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.
axiom
)set output tex on
 
axiom
)set output algebra off

Let's count how many structures of a certain size exist. This is encoded in the generating series. Note that this is an exponential generating series.

axiom
es: ExponentialGeneratingSeries := generatingSeries()$X;
The function generatingSeries is not implemented in NIL . [coefficient(es, i) for i in 0..10]
There are 8 exposed and 4 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation. Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(es) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. FriCAS will attempt to step through and interpret the code. There are 8 exposed and 4 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(es) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. [count(es, i) for i in 0..10]
There are 2 exposed and 0 unexposed library operations named count having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op count to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation. Cannot find a definition or applicable library operation named count with argument type(s) Variable(es) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. FriCAS will attempt to step through and interpret the code. There are 2 exposed and 0 unexposed library operations named count having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op count to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named count with argument type(s) Variable(es) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

AldorCombinat? can also count the number of isomorphism types of structures. That is encoded in the isomorphism type series.

axiom
os: OrdinaryGeneratingSeries := isomorphismTypeGeneratingSeries()$X;
The function isomorphismTypeGeneratingSeries is not implemented in NIL . [coefficient(os, i) for i in 0..10]
There are 8 exposed and 4 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation. Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(os) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. FriCAS will attempt to step through and interpret the code. There are 8 exposed and 4 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(os) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. [count(os, i) for i in 0..10]
There are 2 exposed and 0 unexposed library operations named count having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op count to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation. Cannot find a definition or applicable library operation named count with argument type(s) Variable(os) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. FriCAS will attempt to step through and interpret the code. There are 2 exposed and 0 unexposed library operations named count having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op count to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named count with argument type(s) Variable(os) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. cs: S := cycleIndexSeries()$X;
The function cycleIndexSeries is not implemented in NIL .

The output of the next command apparently causes a "Proxy Error" on the mathaction server. This can be avoided by changing the output from LaTeX? to ASCII mode:

axiom
)set output tex off
 
axiom
)set output algebra on
coeffs3: ACList P := [coefficient(cs, i) for i in 0..5]
There are no library operations named ACList Use HyperDoc Browse or issue )what op ACList to learn if there is any operation containing " ACList " in its name.
Cannot find a definition or applicable library operation named ACList with argument type(s) Variable(P)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.
axiom
)set output tex on
 
axiom
)set output algebra off

P is the polynomial domain in infinitely many variables with rational coefficients.

axiom
p: P := 1$P
The function One is not implemented in NIL . v: V := 3::I::V
Cannot convert from type PositiveInteger to NIL for value 3
t: T := power(v,2) * power(5::I::V,3)
There are no exposed library operations named power but there is one unexposed operation with that name. Use HyperDoc Browse or issue )display op power to learn more about the available operation.
Cannot find a definition or applicable library operation named power with argument type(s) Variable(v) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. t2: T := power(v,3) * power(1::I::V,2)
There are no exposed library operations named power but there is one unexposed operation with that name. Use HyperDoc Browse or issue )display op power to learn more about the available operation.
Cannot find a definition or applicable library operation named power with argument type(s) Variable(v) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. p := t :: P + 3*t2
Cannot convert from type Variable(t) to NIL for value t

Let's do some more advanced stuff with Aldor-Combinat . See the functorial composition testpage for more details.

Here we compute the cycle index series of simple graphs.

axiom
e: S := cycleIndexSeries() $ SetSpecies(Z);
There are no library operations named SetSpecies Use HyperDoc Browse or issue )what op SetSpecies to learn if there is any operation containing " SetSpecies " in its name.
Cannot find a definition or applicable library operation named SetSpecies with argument type(s) Variable(ACInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. e2: S := term(coefficient(e, 2), 2);
There are 8 exposed and 4 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(e) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. h: S := functorialCompose(e * e, e2 * e);
There are no library operations named functorialCompose Use HyperDoc Browse or issue )what op functorialCompose to learn if there is any operation containing " functorialCompose " in its name.
Cannot find a definition or applicable library operation named functorialCompose with argument type(s) Polynomial(Integer) Polynomial(Integer)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. coefficient(h, 0)
There are 8 exposed and 4 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(h) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. coefficient(h, 1)
There are 8 exposed and 4 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(h) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. coefficient(h, 2)
There are 8 exposed and 4 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(h) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. coefficient(h, 3)
There are 8 exposed and 4 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(h) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. coefficient(h, 4)
There are 8 exposed and 4 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(h) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. coefficient(h, 5)
There are 8 exposed and 4 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(h) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

Suspicious juxtaposition --Bill Page, Tue, 17 Jun 2008 16:08:35 -0700 reply
What is the intention of BugWorkaround in this code:
  local cisCoefficient(n: I): P == BugWorkaround(
    PrimePowerProduct has with {
            divisors: % -> Generator %;
            /: (%, %) -> %;
    }
  ){
        import from Z, V, SmallIntegerTools;
        ...

It results in the message:

  L94 C2] #2 (Warning) Suspicious juxtaposition.  Check for missing `;'.