Recursive Species#

class sage.combinat.species.recursive_species.CombinatorialSpecies(min=None)[source]#

Bases: GenericCombinatorialSpecies

EXAMPLES:

sage: F = CombinatorialSpecies()
sage: loads(dumps(F))
Combinatorial species
>>> from sage.all import *
>>> F = CombinatorialSpecies()
>>> loads(dumps(F))
Combinatorial species
sage: X = species.SingletonSpecies()
sage: E = species.EmptySetSpecies()
sage: L = CombinatorialSpecies()
sage: L.define(E+X*L)
sage: L.generating_series()[0:4]
[1, 1, 1, 1]
sage: LL = loads(dumps(L))
sage: LL.generating_series()[0:4]
[1, 1, 1, 1]
>>> from sage.all import *
>>> X = species.SingletonSpecies()
>>> E = species.EmptySetSpecies()
>>> L = CombinatorialSpecies()
>>> L.define(E+X*L)
>>> L.generating_series()[Integer(0):Integer(4)]
[1, 1, 1, 1]
>>> LL = loads(dumps(L))
>>> LL.generating_series()[Integer(0):Integer(4)]
[1, 1, 1, 1]
define(x)[source]#

Define self to be equal to the combinatorial species x.

This is used to define combinatorial species recursively. All of the real work is done by calling the .set() method for each of the series associated to self.

EXAMPLES: The species of linear orders L can be recursively defined by \(L = 1 + X*L\) where 1 represents the empty set species and X represents the singleton species.

sage: X = species.SingletonSpecies()
sage: E = species.EmptySetSpecies()
sage: L = CombinatorialSpecies()
sage: L.define(E+X*L)
sage: L.generating_series()[0:4]
[1, 1, 1, 1]
sage: L.structures([1,2,3]).cardinality()
6
sage: L.structures([1,2,3]).list()
[1*(2*(3*{})),
 1*(3*(2*{})),
 2*(1*(3*{})),
 2*(3*(1*{})),
 3*(1*(2*{})),
 3*(2*(1*{}))]
>>> from sage.all import *
>>> X = species.SingletonSpecies()
>>> E = species.EmptySetSpecies()
>>> L = CombinatorialSpecies()
>>> L.define(E+X*L)
>>> L.generating_series()[Integer(0):Integer(4)]
[1, 1, 1, 1]
>>> L.structures([Integer(1),Integer(2),Integer(3)]).cardinality()
6
>>> L.structures([Integer(1),Integer(2),Integer(3)]).list()
[1*(2*(3*{})),
 1*(3*(2*{})),
 2*(1*(3*{})),
 2*(3*(1*{})),
 3*(1*(2*{})),
 3*(2*(1*{}))]
sage: L = species.LinearOrderSpecies()
sage: L.generating_series()[0:4]
[1, 1, 1, 1]
sage: L.structures([1,2,3]).cardinality()
6
sage: L.structures([1,2,3]).list()
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
>>> from sage.all import *
>>> L = species.LinearOrderSpecies()
>>> L.generating_series()[Integer(0):Integer(4)]
[1, 1, 1, 1]
>>> L.structures([Integer(1),Integer(2),Integer(3)]).cardinality()
6
>>> L.structures([Integer(1),Integer(2),Integer(3)]).list()
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
weight_ring()[source]#

EXAMPLES:

sage: F = species.CombinatorialSpecies()
sage: F.weight_ring()
Rational Field
>>> from sage.all import *
>>> F = species.CombinatorialSpecies()
>>> F.weight_ring()
Rational Field
sage: X = species.SingletonSpecies()
sage: E = species.EmptySetSpecies()
sage: L = CombinatorialSpecies()
sage: L.define(E+X*L)
sage: L.weight_ring()
Rational Field
>>> from sage.all import *
>>> X = species.SingletonSpecies()
>>> E = species.EmptySetSpecies()
>>> L = CombinatorialSpecies()
>>> L.define(E+X*L)
>>> L.weight_ring()
Rational Field
class sage.combinat.species.recursive_species.CombinatorialSpeciesStructure(parent, s, **options)[source]#

Bases: SpeciesStructureWrapper