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

Edit detail for SandBoxCombinat revision 6 of 8

 1 2 3 4 5 6 7 8 Editor: Bill Page Time: 2008/06/12 07:25:24 GMT-7 Note: corrrect spelling of include, missing quote

```changed:
-#includeDir "/var/lib/zope/combinat/inlcude"
-#libraryDir "/var/lib/zope/combinat/lib
#includeDir "/var/lib/zope/combinat/include"
#libraryDir "/var/lib/zope/combinat/lib"
```

```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)
aldor
```   Compiling FriCAS source code from file
/var/zope2/var/LatexWiki/386348539091125073-25px001.as using
AXIOM-XL compiler and options
-O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y \$AXIOM/algebra
Use the system command )set compiler args to change these
options.
#1 (Warning) Deprecated message prefix: use `ALDOR_' instead of `_AXL'
Compiling Lisp source code from file
./386348539091125073-25px001.lsp
Issuing )library command for 386348539091125073-25px001
TreeClass is now explicitly exposed in frame initial
TreeClass will be automatically loaded when needed from
/var/zope2/var/LatexWiki/386348539091125073-25px001
CombinatorialClassCategory is now explicitly exposed in frame
initial
CombinatorialClassCategory will be automatically loaded when needed
from /var/zope2/var/LatexWiki/386348539091125073-25px001
UnionClass is now explicitly exposed in frame initial
UnionClass will be automatically loaded when needed from
/var/zope2/var/LatexWiki/386348539091125073-25px001
Atom is now explicitly exposed in frame initial
Atom will be automatically loaded when needed from
/var/zope2/var/LatexWiki/386348539091125073-25px001
CrossClass is now explicitly exposed in frame initial
CrossClass will be automatically loaded when needed from
/var/zope2/var/LatexWiki/386348539091125073-25px001
Primitive is now explicitly exposed in frame initial
Primitive will be automatically loaded when needed from
/var/zope2/var/LatexWiki/386348539091125073-25px001
Epsilon is now explicitly exposed in frame initial
Epsilon will be automatically loaded when needed from
/var/zope2/var/LatexWiki/386348539091125073-25px001```

`axiom[count(i)\$TreeClass for i in 1..7]`
 (1)
Type: List Integer

```axiom)set output tex off
)set output algebra on
(list(5)\$TreeClass)::List OutputForm
(2)
[        o        ,         o        ,         o        ,         o        ,
/ \                / \                / \
/ \
o                  o                  o                  o
/ \                / \                / \
/ \
o                  o            o       o            o
/ \                / \          / \     / \
/ \
o              o                                     o
/ \            / \                                   /
\
o        ,         o        ,         o        ,         o        ,
/ \                / \                / \
/ \
o          o         o        o         o          o         o
/ \        / \       / \      / \       / \
/ \       / \
o                        o              o              o
/ \                      / \            / \            /
\
o
/ \
o        ,         o        ,         o        ,         o        ,
/ \                / \                / \
/ \
o         o          o                  o                  o
/ \       / \        / \                / \
/ \
o                        o                  o            o       o
/ \                      / \                / \          /
\     / \
o              o
/ \            / \
o        ,         o        ]
/ \                / \
o                  o
/ \                / \
o                  o
/ \                / \
o              o
/ \            / \```
Type: List OutputForm?

Test species in axiom/FriCAS?.

```axiom)cd ~/combinat/src
The current FriCAS default directory is /var/lib/zope/combinat/src
)re ../lib/combinat.input
)lib cscombinatversion.ao
LibraryInformationCombinat is now explicitly exposed in frame
initial
LibraryInformationCombinat will be automatically loaded when needed
from /var/lib/zope/combinat/src/cscombinatversion
)lib csaxcompat.ao
ACCharacter is now explicitly exposed in frame initial
ACCharacter will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
ACFraction is now explicitly exposed in frame initial
ACFraction will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
ACIntegerTools is now explicitly exposed in frame initial
ACIntegerTools will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
ACInteger is now explicitly exposed in frame initial
ACInteger will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
ACList is now explicitly exposed in frame initial
ACList will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
ACMachineInteger is now explicitly exposed in frame initial
ACMachineInteger will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
ACPrimitiveArray is now explicitly exposed in frame initial
ACPrimitiveArray will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
ACString is now explicitly exposed in frame initial
ACString will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
ACSymbol is now explicitly exposed in frame initial
ACSymbol will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
Array is now explicitly exposed in frame initial
Array will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
ACLabelType is now explicitly exposed in frame initial
ACLabelType will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
OutputType is now explicitly exposed in frame initial
OutputType will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
TotallyOrderedType is now explicitly exposed in frame initial
TotallyOrderedType will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat
)lib csaxcompat2.ao
ExpressionTreeExpt is now explicitly exposed in frame initial
ExpressionTreeExpt will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
ExpressionTreeLeaf is now explicitly exposed in frame initial
ExpressionTreeLeaf will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
ExpressionTreePlus is now explicitly exposed in frame initial
ExpressionTreePlus will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
ExpressionTreePrefix is now explicitly exposed in frame initial
ExpressionTreePrefix will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
ExpressionTreeTimes is now explicitly exposed in frame initial
ExpressionTreeTimes will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
ExpressionTree is now explicitly exposed in frame initial
ExpressionTree will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
GeneratorException is now explicitly exposed in frame initial
GeneratorException will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
Generator is now explicitly exposed in frame initial
Generator will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
ExpressionTreeOperator is now explicitly exposed in frame initial
ExpressionTreeOperator will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
Partial is now explicitly exposed in frame initial
Partial will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
ExpressionType is now explicitly exposed in frame initial
ExpressionType will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
GeneratorExceptionType is now explicitly exposed in frame initial
GeneratorExceptionType will be automatically loaded when needed from
/var/lib/zope/combinat/src/csaxcompat2
Won't parse: (Type)->NIL
)lib csistruc.ao
SparseAdditiveArray is now explicitly exposed in frame initial
SparseAdditiveArray will be automatically loaded when needed from
/var/lib/zope/combinat/src/csistruc
SparseFiniteMonoidRing is now explicitly exposed in frame initial
SparseFiniteMonoidRing will be automatically loaded when needed from
/var/lib/zope/combinat/src/csistruc
IndexedFreeAdditiveCombinationType is now explicitly exposed in
frame initial
needed from /var/lib/zope/combinat/src/csistruc
IndexedFreeArithmeticType is now explicitly exposed in frame initial
IndexedFreeArithmeticType will be automatically loaded when needed
from /var/lib/zope/combinat/src/csistruc
)lib csdistpoly.ao
SparseDistributedPolynomial is now explicitly exposed in frame
initial
SparseDistributedPolynomial will be automatically loaded when needed
from /var/lib/zope/combinat/src/csdistpoly
)lib csstream.ao
DataStream is now explicitly exposed in frame initial
DataStream will be automatically loaded when needed from
/var/lib/zope/combinat/src/csstream
)lib csseries.ao
FormalPowerSeries is now explicitly exposed in frame initial
FormalPowerSeries will be automatically loaded when needed from
/var/lib/zope/combinat/src/csseries
FormalPowerSeriesCategory is now explicitly exposed in frame initial
FormalPowerSeriesCategory will be automatically loaded when needed
from /var/lib/zope/combinat/src/csseries
SeriesOrder is now explicitly exposed in frame initial
SeriesOrder will be automatically loaded when needed from
/var/lib/zope/combinat/src/csseries
)lib csidxpp.ao
SparseIndexedPowerProduct is now explicitly exposed in frame initial
SparseIndexedPowerProduct will be automatically loaded when needed
from /var/lib/zope/combinat/src/csidxpp
)lib cssiprimes.ao
SmallIntegerPrimes is now explicitly exposed in frame initial
SmallIntegerPrimes will be automatically loaded when needed from
/var/lib/zope/combinat/src/cssiprimes
)lib cssitools.ao
SmallIntegerTools is now explicitly exposed in frame initial
SmallIntegerTools will be automatically loaded when needed from
/var/lib/zope/combinat/src/cssitools
)lib csgseries.ao
CycleIndexSeries is now explicitly exposed in frame initial
CycleIndexSeries will be automatically loaded when needed from
/var/lib/zope/combinat/src/csgseries
CycleIndexVariable is now explicitly exposed in frame initial
CycleIndexVariable will be automatically loaded when needed from
/var/lib/zope/combinat/src/csgseries
ExponentialGeneratingSeries is now explicitly exposed in frame
initial
ExponentialGeneratingSeries will be automatically loaded when needed
from /var/lib/zope/combinat/src/csgseries
OrdinaryGeneratingSeries is now explicitly exposed in frame initial
OrdinaryGeneratingSeries will be automatically loaded when needed
from /var/lib/zope/combinat/src/csgseries
)lib csmultinom.ao
MultinomialTools is now explicitly exposed in frame initial
MultinomialTools will be automatically loaded when needed from
/var/lib/zope/combinat/src/csmultinom
)lib csspexpr.ao
SpeciesExpression is now explicitly exposed in frame initial
SpeciesExpression will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspexpr
)lib csspecies.ao
ACIsomorphismType is now explicitly exposed in frame initial
ACIsomorphismType will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
Subset is now explicitly exposed in frame initial
Subset will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
Times is now explicitly exposed in frame initial
Times will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
Augment is now explicitly exposed in frame initial
Augment will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
CharacteristicSpecies is now explicitly exposed in frame initial
CharacteristicSpecies will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
Combination is now explicitly exposed in frame initial
Combination will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
Compose is now explicitly exposed in frame initial
Compose will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
Derivative is now explicitly exposed in frame initial
Derivative will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
DropEmpty is now explicitly exposed in frame initial
DropEmpty will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
EmptySetSpecies is now explicitly exposed in frame initial
EmptySetSpecies will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
FunctorialCompose is now explicitly exposed in frame initial
FunctorialCompose will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
MultiCompose is now explicitly exposed in frame initial
MultiCompose will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
MultiDerivative is now explicitly exposed in frame initial
MultiDerivative will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
MultiPlus is now explicitly exposed in frame initial
MultiPlus will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
MultiSetCombination is now explicitly exposed in frame initial
MultiSetCombination will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
MultiSetPartition is now explicitly exposed in frame initial
MultiSetPartition will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
MultiSet is now explicitly exposed in frame initial
MultiSet will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
MultiSubset is now explicitly exposed in frame initial
MultiSubset will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
MultiTimes is now explicitly exposed in frame initial
MultiTimes will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
Multiple is now explicitly exposed in frame initial
Multiple will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
CombinatorialSpecies is now explicitly exposed in frame initial
CombinatorialSpecies will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
NonEmpty is now explicitly exposed in frame initial
NonEmpty will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
Plus is now explicitly exposed in frame initial
Plus will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
RestrictedSpecies is now explicitly exposed in frame initial
RestrictedSpecies will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
SetSpecies is now explicitly exposed in frame initial
SetSpecies will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
IsomorphismTypeCategory is now explicitly exposed in frame initial
IsomorphismTypeCategory will be automatically loaded when needed
from /var/lib/zope/combinat/src/csspecies
SingletonSpecies is now explicitly exposed in frame initial
SingletonSpecies will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
Partition is now explicitly exposed in frame initial
Partition will be automatically loaded when needed from
/var/lib/zope/combinat/src/csspecies
)lib csexamples.ao
ACBinaryTree is now explicitly exposed in frame initial
ACBinaryTree will be automatically loaded when needed from
/var/lib/zope/combinat/src/csexamples
Combination is already explicitly exposed in frame initial
Combination will be automatically loaded when needed from
/var/lib/zope/combinat/src/csexamples
Generator is already explicitly exposed in frame initial
Generator will be automatically loaded when needed from
/var/lib/zope/combinat/src/csexamples
SetSpecies is already explicitly exposed in frame initial
SetSpecies will be automatically loaded when needed from
/var/lib/zope/combinat/src/csexamples
Won't parse: (Type)->NIL
Won't parse: (ACLabelType)->NIL
)lib csinterp.ao
Interpret is now explicitly exposed in frame initial
Interpret will be automatically loaded when needed from
/var/lib/zope/combinat/src/csinterp
InterpretingTools is now explicitly exposed in frame initial
InterpretingTools will be automatically loaded when needed from
/var/lib/zope/combinat/src/csinterp
LabelSpecies is now explicitly exposed in frame initial
LabelSpecies will be automatically loaded when needed from
/var/lib/zope/combinat/src/csinterp
)lib csparse.ao
MyParser is now explicitly exposed in frame initial
MyParser will be automatically loaded when needed from
/var/lib/zope/combinat/src/csparse```

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

```axiomlab: SetSpecies ACINT := set [i::ACINT for i in 1..4]
(3)  [1,2,3,4]```
Type: SetSpecies? ACInteger?
```axiomstructures(lab)\$Partition ACINT
(4)  [<generator>]```
Type: Generator Partition ACInteger?

```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-25px006.as using
AXIOM-XL compiler and options
-O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y \$AXIOM/algebra
Use the system command )set compiler args to change these
options.
#1 (Warning) Deprecated message prefix: use `ALDOR_' instead of `_AXL'
Compiling Lisp source code from file
./5200085684951427974-25px006.lsp
Issuing )library command for 5200085684951427974-25px006