Recursive species - Combinatorics

Skip to content
Back to top
View this page
Edit this page

# Recursive species

class sage.combinat.species.recursive_species.CombinatorialSpecies(min=None)

  Bases: `GenericCombinatorialSpecies`

  EXAMPLES:

  Sage

      sage: F = CombinatorialSpecies()
      doctest:warning...
      DeprecationWarning: combinat.species is superseded by LazyCombinatorialSpecies
      See https://github.com/sagemath/sage/issues/38544 for details.
      sage: loads(dumps(F))
      Combinatorial species

  Python

      >>> from sage.all import *
      >>> F = CombinatorialSpecies()
      doctest:warning...
      DeprecationWarning: combinat.species is superseded by LazyCombinatorialSpecies
      See https://github.com/sagemath/sage/issues/38544 for details.
      >>> loads(dumps(F))
      Combinatorial species

  Sage

      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]

  [Python]

      >>> 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)

    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

        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*{}))]

    Python

        >>> 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

        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]]

    [Python]

        >>> 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()

    EXAMPLES:

    Sage

        sage: F = species.CombinatorialSpecies()
        sage: F.weight_ring()
        Rational Field

    Python

        >>> from sage.all import *
        >>> F = species.CombinatorialSpecies()
        >>> F.weight_ring()
        Rational Field

    Sage

        sage: X = species.SingletonSpecies()
        sage: E = species.EmptySetSpecies()
        sage: L = CombinatorialSpecies()
        sage: L.define(E+X*L)
        sage: L.weight_ring()
        Rational Field

    [Python]

        >>> 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)

  Bases: `SpeciesStructureWrapper`