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

Edit detail for SandBoxCombinat revision 4 of 8

1 2 3 4 5 6 7 8
Editor: hemmecke
Time: 2008/06/12 01:03:47 GMT-7
Note:

added:
\begin{aldor}
#include "combinat"

macro {
        E == EmptySetSpecies;
        X == SingletonSpecies;
        + == Plus;
        * == Times;
}

A(L: LabelType): CombinatorialSpecies L == (E + X*A*A)(L) add;
\end{aldor}


fricas
(1) -> <aldor>
#include "axiom.as"
macro CCC == CombinatorialClassCategory; import from Integer; import from List Integer; import from OutputForm;
CombinatorialClassCategory: Category == with { list: Integer -> List %; count: Integer -> Integer; import from NonNegativeInteger; default count(i: Integer): Integer == (#list(i))::Integer; coerce: % -> OutputForm; }
Primitive(n: Integer): CombinatorialClassCategory == add { Rep == Integer; count(i: Integer): Integer == if i=n then 1 else 0; list(i: Integer): List % == if i=n then [per 1] else []; coerce(x: %): OutputForm == message(" ") }
Epsilon: CombinatorialClassCategory == Primitive(0) add;
Atom: CombinatorialClassCategory == Primitive(1) add;
UnionClass(S1: CCC, S2: CCC): CCC == add { Rep == Union(s1: S1, s2: S2); count(i: Integer): Integer == count(i)$S1 + count(i)$S2; import from Rep; import from List S1; import from List S2; list(i: Integer): List % == { result: List % := []; for a in list(i)$S1 repeat result := cons(per union a, result); for b in list(i)$S2 repeat result := cons(per union b, result); result; } coerce(x: %): OutputForm == { (rep x) case s1 => ((rep x).s1)::OutputForm; ((rep x).s2)::OutputForm; } }
CrossClass(S1: CCC, S2: CCC): with { CombinatorialClassCategory } == add { Rep == Record(t1: S1, t2: S2); count(i: Integer): Integer == { result := 0; for k in 1 .. i-1 repeat { result := result + count(k)$S1 * count(i-k)$S2; } result; } import from Rep; import from List S1; import from List S2; list(i: Integer): List % == { result: List % := []; for k in 1..i-1 repeat { for a in list(k)$S1 repeat { for b in list(i-k)$S2 repeat { result := cons(per record(a, b), result); } } } result; } coerce(x: %): OutputForm == { a := ((rep x).t1)::OutputForm; b := ((rep x).t2)::OutputForm; c: List OutputForm := [a, b]; vconcat [hconcat [hspace 1, message("o")], hconcat [hspace 1, message("/"), hspace 1, message("\")], hconcat [a,hspace 3,b]] } }
TreeClass: CombinatorialClassCategory == UnionClass(Atom, CrossClass(TreeClass, TreeClass)
fricas
) add;</aldor>
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/386348539091125073-25px001.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      . Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libfricas.al'.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/386348539091125073-25px001.as", line 1: 
#include "axiom.as"
^
[L1 C1] #2 (Error) Could not open file `axiom.as'.
The )library system command was not called after compilation.

fricas
[count(i)$TreeClass for i in 1..7]
TreeClass is not a valid type.

fricas
)set output tex off
 
fricas
)set output algebra on
(list(5)$TreeClass)::List OutputForm
TreeClass is not a valid type.

Test species in axiom/FriCAS?.

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

This should give the set partitions of {1,2,3,4}

fricas
lab: SetSpecies ACINT := set [i::ACINT for i in 1..4]
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.

aldor
#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/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6037167008170035778-25px006.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      . Use the system command )set compiler args to change these 
      options.
#1 (Warning) Could not use archive file `libfricas.al'.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6037167008170035778-25px006.as", line 1: 
#include "combinat"
^
[L1 C1] #2 (Error) Could not open file `combinat'.
The )library system command was not called after compilation.