# Catalog of posets and lattices#

Some common posets can be accessed through the posets.<tab> object:

sage: posets.PentagonPoset()                                                        # optional - sage.modules
Finite lattice containing 5 elements

Moreover, the set of all posets of order $$n$$ is represented by Posets(n):

sage: Posets(5)
Posets containing 5 elements

The infinite set of all posets can be used to find minimal examples:

sage: for P in Posets():
....:     if not P.is_series_parallel():
....:         break
sage: P
Finite poset containing 4 elements

Catalog of common posets:

 AntichainPoset() Return an antichain on $$n$$ elements. BooleanLattice() Return the Boolean lattice on $$2^n$$ elements. ChainPoset() Return a chain on $$n$$ elements. Crown() Return the crown poset on $$2n$$ elements. DexterSemilattice() Return the Dexter semilattice. DiamondPoset() Return the lattice of rank two on $$n$$ elements. DivisorLattice() Return the divisor lattice of an integer. DoubleTailedDiamond() Return the double tailed diamond poset on $$2n + 2$$ elements. IntegerCompositions() Return the poset of integer compositions of $$n$$. IntegerPartitions() Return the poset of integer partitions of n. IntegerPartitionsDominanceOrder() Return the lattice of integer partitions on the integer $$n$$ ordered by dominance. MobilePoset() Return the mobile poset formed by the $$ribbon$$ with $$hangers$$ below and an $$anchor$$ above. NoncrossingPartitions() Return the poset of noncrossing partitions of a finite Coxeter group W. PentagonPoset() Return the Pentagon poset. PermutationPattern() Return the Permutation pattern poset. PermutationPatternInterval() Return an interval in the Permutation pattern poset. PermutationPatternOccurrenceInterval() Return the occurrence poset for a pair of comparable elements in the Permutation pattern poset. PowerPoset() Return a power poset. ProductOfChains() Return a product of chain posets. RandomLattice() Return a random lattice on $$n$$ elements. RandomPoset() Return a random poset on $$n$$ elements. RibbonPoset() Return a ribbon on $$n$$ elements with descents at $$descents$$. RestrictedIntegerPartitions() Return the poset of integer partitions of $$n$$, ordered by restricted refinement. SetPartitions() Return the poset of set partitions of the set $$\{1,\dots,n\}$$. ShardPoset() Return the shard intersection order. SSTPoset() Return the poset on semistandard tableaux of shape $$s$$ and largest entry $$f$$ that is ordered by componentwise comparison. StandardExample() Return the standard example of a poset with dimension $$n$$. SymmetricGroupAbsoluteOrderPoset() The poset of permutations with respect to absolute order. SymmetricGroupBruhatIntervalPoset() The poset of permutations with respect to Bruhat order. SymmetricGroupBruhatOrderPoset() The poset of permutations with respect to Bruhat order. SymmetricGroupWeakOrderPoset() The poset of permutations of $$\{ 1, 2, \ldots, n \}$$ with respect to the weak order. TamariLattice() Return the Tamari lattice. TetrahedralPoset() Return the Tetrahedral poset with $$n-1$$ layers based on the input colors. UpDownPoset() Return the up-down poset on $$n$$ elements. YoungDiagramPoset() Return the poset of cells in the Young diagram of a partition. YoungsLattice() Return Young’s Lattice up to rank $$n$$. YoungsLatticePrincipalOrderIdeal() Return the principal order ideal of the partition $$lam$$ in Young’s Lattice. YoungFibonacci() Return the Young-Fibonacci lattice up to rank $$n$$.

Other available posets:

 face_lattice() Return the face lattice of a polyhedron. face_lattice() Return the face lattice of a combinatorial polyhedron.

## Constructions#

class sage.combinat.posets.poset_examples.Posets#

Bases: object

A collection of posets and lattices.

EXAMPLES:

sage: posets.BooleanLattice(3)
Finite lattice containing 8 elements
sage: posets.ChainPoset(3)
Finite lattice containing 3 elements
sage: posets.RandomPoset(17,.15)
Finite poset containing 17 elements

The category of all posets:

sage: Posets()
Category of posets

The enumerated set of all posets on $$3$$ elements, up to an isomorphism:

sage: Posets(3)
Posets containing 3 elements

Return an antichain (a poset with no comparable elements) containing $$n$$ elements.

INPUT:

• n (an integer) – number of elements

• facade (boolean) – whether to make the returned poset a facade poset (see sage.categories.facade_sets); the default behaviour is the same as the default behaviour of the Poset() constructor

EXAMPLES:

sage: A = posets.AntichainPoset(6); A
Finite poset containing 6 elements

Return the Boolean lattice containing $$2^n$$ elements.

• n – integer; number of elements will be $$2^n$$

• facade – boolean; whether to make the returned poset a facade poset (see sage.categories.facade_sets); the default behaviour is the same as the default behaviour of the Poset() constructor

• use_subsets – boolean (default: False); if True, then label the elements by subsets of $$\{1, 2, \ldots, n\}$$; otherwise label the elements by $$0, 1, 2, \ldots, 2^n-1$$

EXAMPLES:

sage: posets.BooleanLattice(5)
Finite lattice containing 32 elements

sage: sorted(posets.BooleanLattice(2))
[0, 1, 2, 3]
sage: sorted(posets.BooleanLattice(2, use_subsets=True), key=list)
[{}, {1}, {1, 2}, {2}]

Return a chain (a totally ordered poset) containing n elements.

• n (an integer) – number of elements.

• facade (boolean) – whether to make the returned poset a facade poset (see sage.categories.facade_sets); the default behaviour is the same as the default behaviour of the Poset() constructor

EXAMPLES:

sage: C = posets.ChainPoset(6); C
Finite lattice containing 6 elements
sage: C.linear_extension()
[0, 1, 2, 3, 4, 5]
static CoxeterGroupAbsoluteOrderPoset(W, use_reduced_words=True)#

Return the poset of elements of a Coxeter group with respect to absolute order.

INPUT:

• W – a Coxeter group

• use_reduced_words – boolean (default: True); if True, then the elements are labeled by their lexicographically minimal reduced word

EXAMPLES:

sage: W = CoxeterGroup(['B', 3])                                            # optional - sage.combinat sage.groups
sage: posets.CoxeterGroupAbsoluteOrderPoset(W)                              # optional - sage.combinat sage.groups
Finite poset containing 48 elements

sage: W = WeylGroup(['B', 2], prefix='s')                                   # optional - sage.combinat sage.groups
sage: posets.CoxeterGroupAbsoluteOrderPoset(W, False)                       # optional - sage.combinat sage.groups
Finite poset containing 8 elements

Return the crown poset of $$2n$$ elements.

In this poset every element $$i$$ for $$0 \leq i \leq n-1$$ is covered by elements $$i+n$$ and $$i+n+1$$, except that $$n-1$$ is covered by $$n$$ and $$n+1$$.

INPUT:

• n – number of elements, an integer at least 2

• facade (boolean) – whether to make the returned poset a facade poset (see sage.categories.facade_sets); the default behaviour is the same as the default behaviour of the Poset() constructor

EXAMPLES:

sage: posets.Crown(3)
Finite poset containing 6 elements
static DexterSemilattice(n)#

Return the $$n$$-th Dexter meet-semilattice.

INPUT:

• n – a nonnegative integer (the index)

OUTPUT:

a finite meet-semilattice

The elements of the semilattice are Dyck paths in the $$(n+1 \times n)$$-rectangle.

EXAMPLES:

sage: posets.DexterSemilattice(3)
Finite meet-semilattice containing 5 elements

sage: P = posets.DexterSemilattice(4); P
Finite meet-semilattice containing 14 elements
sage: len(P.maximal_chains())
15
sage: len(P.maximal_elements())
4
sage: P.chain_polynomial()
q^5 + 19*q^4 + 47*q^3 + 42*q^2 + 14*q + 1

REFERENCES:

Return the lattice of rank two containing n elements.

INPUT:

• n – number of elements, an integer at least 3

• facade (boolean) – whether to make the returned poset a facade poset (see sage.categories.facade_sets); the default behaviour is the same as the default behaviour of the Poset() constructor

EXAMPLES:

sage: posets.DiamondPoset(7)
Finite lattice containing 7 elements

Return the divisor lattice of an integer.

Elements of the lattice are divisors of $$n$$ and $$x < y$$ in the lattice if $$x$$ divides $$y$$.

INPUT:

• n – an integer

• facade (boolean) – whether to make the returned poset a facade poset (see sage.categories.facade_sets); the default behaviour is the same as the default behaviour of the Poset() constructor

EXAMPLES:

sage: P = posets.DivisorLattice(12)
sage: sorted(P.cover_relations())
[[1, 2], [1, 3], [2, 4], [2, 6], [3, 6], [4, 12], [6, 12]]

sage: P(2) < P(5)
False
static DoubleTailedDiamond(n)#

Return a double-tailed diamond of $$2n + 2$$ elements.

INPUT:

• n – a positive integer

EXAMPLES:

sage: P = posets.DoubleTailedDiamond(2); P
Finite d-complete poset containing 6 elements
sage: P.cover_relations()
[[1, 2], [2, 3], [2, 4], [3, 5], [4, 5], [5, 6]]
static IntegerCompositions(n)#

Return the poset of integer compositions of the integer n.

A composition of a positive integer $$n$$ is a list of positive integers that sum to $$n$$. The order is reverse refinement: $$[p_1,p_2,...,p_l] < [q_1,q_2,...,q_m]$$ if $$q$$ consists of an integer composition of $$p_1$$, followed by an integer composition of $$p_2$$, and so on.

EXAMPLES:

sage: P = posets.IntegerCompositions(7); P
Finite poset containing 64 elements
sage: len(P.cover_relations())
192
static IntegerPartitions(n)#

Return the poset of integer partitions on the integer n.

A partition of a positive integer $$n$$ is a non-increasing list of positive integers that sum to $$n$$. If $$p$$ and $$q$$ are integer partitions of $$n$$, then $$p$$ covers $$q$$ if and only if $$q$$ is obtained from $$p$$ by joining two parts of $$p$$ (and sorting, if necessary).

EXAMPLES:

sage: P = posets.IntegerPartitions(7); P                                    # optional - sage.combinat
Finite poset containing 15 elements
sage: len(P.cover_relations())                                              # optional - sage.combinat
28
static IntegerPartitionsDominanceOrder(n)#

Return the lattice of integer partitions on the integer $$n$$ ordered by dominance.

That is, if $$p=(p_1,\ldots,p_i)$$ and $$q=(q_1,\ldots,q_j)$$ are integer partitions of $$n$$, then $$p$$ is greater than $$q$$ if and only if $$p_1+\cdots+p_k > q_1+\cdots+q_k$$ for all $$k$$.

INPUT:

• n – a positive integer

EXAMPLES:

sage: P = posets.IntegerPartitionsDominanceOrder(6); P                      # optional - sage.combinat
Finite lattice containing 11 elements
sage: P.cover_relations()                                                   # optional - sage.combinat
[[[1, 1, 1, 1, 1, 1], [2, 1, 1, 1, 1]],
[[2, 1, 1, 1, 1], [2, 2, 1, 1]],
[[2, 2, 1, 1], [2, 2, 2]],
[[2, 2, 1, 1], [3, 1, 1, 1]],
[[2, 2, 2], [3, 2, 1]],
[[3, 1, 1, 1], [3, 2, 1]],
[[3, 2, 1], [3, 3]],
[[3, 2, 1], [4, 1, 1]],
[[3, 3], [4, 2]],
[[4, 1, 1], [4, 2]],
[[4, 2], [5, 1]],
[[5, 1], [6]]]
static MobilePoset(ribbon, hangers, anchor=None)#

Return a mobile poset with the ribbon ribbon and with hanging d-complete posets specified in hangers and a d-complete poset attached above, specified in anchor.

INPUT:

• ribbon – a finite poset that is a ribbon

• hangers – a dictionary mapping an element on the ribbon to a list of d-complete posets that it covers

• anchor – (optional) a tuple (ribbon_elmt, anchor_elmt, anchor_poset), where anchor_elmt covers ribbon_elmt, and anchor_elmt is an acyclic element of anchor_poset

EXAMPLES:

sage: R = Posets.RibbonPoset(5, [1,2])
sage: H = Poset([[5, 6, 7], [(5, 6), (6,7)]])
sage: M = Posets.MobilePoset(R, {3: [H]})
sage: len(M.cover_relations())
7

sage: P = posets.MobilePoset(posets.RibbonPoset(7, [1,3]),                  # optional - sage.combinat
....: {1: [posets.YoungDiagramPoset([3, 2], dual=True)],
....: 3: [posets.DoubleTailedDiamond(6)]},
....: anchor=(4, 2, posets.ChainPoset(6)))
sage: len(P.cover_relations())                                              # optional - sage.combinat
33
static NoncrossingPartitions(W)#

Return the lattice of noncrossing partitions.

INPUT:

• W – a finite Coxeter group or a Weyl group

EXAMPLES:

sage: W = CoxeterGroup(['A', 3])                                            # optional - sage.combinat sage.groups
sage: posets.NoncrossingPartitions(W)                                       # optional - sage.combinat sage.groups
Finite lattice containing 14 elements

sage: W = WeylGroup(['B', 2], prefix='s')                                   # optional - sage.combinat sage.groups
sage: posets.NoncrossingPartitions(W)                                       # optional - sage.combinat sage.groups
Finite lattice containing 6 elements

Return the Pentagon poset.

INPUT:

• facade (boolean) – whether to make the returned poset a facade poset (see sage.categories.facade_sets); the default behaviour is the same as the default behaviour of the Poset() constructor

EXAMPLES:

sage: P = posets.PentagonPoset(); P                                         # optional - sage.modules
Finite lattice containing 5 elements
sage: P.cover_relations()                                                   # optional - sage.modules
[[0, 1], [0, 2], [1, 4], [2, 3], [3, 4]]
static PermutationPattern(n)#

Return the poset of permutations under pattern containment up to rank n.

INPUT:

• n – a positive integer

A permutation $$u = u_1 \cdots u_n$$ contains the pattern $$v = v_1 \cdots v_m$$ if there is a (not necessarily consecutive) subsequence of $$u$$ of length $$m$$ whose entries have the same relative order as $$v$$.

EXAMPLES:

sage: P4 = posets.PermutationPattern(4); P4                                 # optional - sage.combinat
Finite poset containing 33 elements
sage: sorted(P4.lower_covers(Permutation([2,4,1,3])))                       # optional - sage.combinat
[[1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2]]

has_pattern()

static PermutationPatternInterval(bottom, top)#

Return the poset consisting of an interval in the poset of permutations under pattern containment between bottom and top.

INPUT:

• bottom, top – permutations where top contains bottom as a pattern

A permutation $$u = u_1 \cdots u_n$$ contains the pattern $$v = v_1 \cdots v_m$$ if there is a (not necessarily consecutive) subsequence of $$u$$ of length $$m$$ whose entries have the same relative order as $$v$$.

EXAMPLES:

sage: t = Permutation([2,3,1])
sage: b = Permutation([4,6,2,3,5,1])
sage: R = posets.PermutationPatternInterval(t, b); R                        # optional - sage.combinat
Finite poset containing 14 elements
sage: R.moebius_function(R.bottom(),R.top())                                # optional - sage.combinat
-4

static PermutationPatternOccurrenceInterval(bottom, top, pos)#

Return the poset consisting of an interval in the poset of permutations under pattern containment between bottom and top, where a specified instance of bottom in top must be maintained.

INPUT:

• bottom, top – permutations where top contains

bottom as a pattern

• pos – a list of indices indicating a distinguished copy of

bottom inside top (indexed starting at 0)

For further information (and picture illustrating included example), see [ST2010] .

EXAMPLES:

sage: t = Permutation([3,2,1])
sage: b = Permutation([6,3,4,5,2,1])
sage: A = posets.PermutationPatternOccurrenceInterval(t, b, (0,2,4)); A     # optional - sage.combinat
Finite poset containing 8 elements
static PowerPoset(n)#

Return the power poset on $$n$$ element posets.

Elements of the power poset are all posets on the set $$\{0, 1, \ldots, n-1\}$$ ordered by extension. That is, the antichain of $$n$$ elements is the bottom and $$P_a \le P_b$$ in the power poset if $$P_b$$ is an extension of $$P_a$$.

These were studied in [Bru1994].

EXAMPLES:

sage: P3 = posets.PowerPoset(3); P3                                         # optional - sage.modules
Finite meet-semilattice containing 19 elements
sage: all(P.is_chain() for P in P3.maximal_elements())                      # optional - sage.modules
True

Return a product of chains.

• chain_lengths – A list of nonnegative integers; number of elements in each chain.

• facade – boolean; whether to make the returned poset a facade poset (see sage.categories.facade_sets); the default behaviour is the same as the default behaviour of the Poset() constructor

EXAMPLES:

sage: P = posets.ProductOfChains([2, 2]); P                                 # optional - sage.modules
Finite lattice containing 4 elements
sage: P.linear_extension()                                                  # optional - sage.modules
[(0, 0), (0, 1), (1, 0), (1, 1)]
sage: P.upper_covers((0,0))                                                 # optional - sage.modules
[(0, 1), (1, 0)]
sage: P.lower_covers((1,1))                                                 # optional - sage.modules
[(0, 1), (1, 0)]
static RandomLattice(n, p, properties=None)#

Return a random lattice on n elements.

INPUT:

• n – number of elements, a non-negative integer

• p – a probability, a positive real number less than one

• properties – a list of properties for the lattice. Currently implemented:

• None, no restrictions for lattices to create

• 'planar', the lattice has an upward planar drawing

• 'dismantlable' (implicated by 'planar')

• 'distributive' (implicated by 'stone')

• 'stone'

OUTPUT:

A lattice on $$n$$ elements. When properties is None, the probability $$p$$ roughly measures number of covering relations of the lattice. To create interesting examples, make the probability a little below one, for example $$0.9$$.

Currently parameter p has no effect only when properties is not None.

Note

Results are reproducible in same Sage version only. Underlying algorithm may change in future versions.

EXAMPLES:

sage: set_random_seed(0)  # Results are reproducible
sage: L = posets.RandomLattice(8, 0.995); L                                 # optional - sage.modules
Finite lattice containing 8 elements
sage: L.cover_relations()                                                   # optional - sage.modules
[[7, 6], [7, 3], [7, 1], ..., [5, 4], [2, 4], [1, 4], [0, 4]]
sage: L = posets.RandomLattice(10, 0, properties=['dismantlable'])          # optional - sage.modules
sage: L.is_dismantlable()                                                   # optional - sage.modules
True

RandomPoset()

static RandomPoset(n, p)#

Generate a random poset on n elements according to a probability p.

INPUT:

• n - number of elements, a non-negative integer

• p - a probability, a real number between 0 and 1 (inclusive)

OUTPUT:

A poset on $$n$$ elements. The probability $$p$$ roughly measures width/height of the output: $$p=0$$ always generates an antichain, $$p=1$$ will return a chain. To create interesting examples, keep the probability small, perhaps on the order of $$1/n$$.

EXAMPLES:

sage: set_random_seed(0)  # Results are reproducible
sage: P = posets.RandomPoset(5, 0.3)
sage: P.cover_relations()
[[5, 4], [4, 2], [1, 2]]

RandomLattice()

static RestrictedIntegerPartitions(n)#

Return the poset of integer partitions on the integer $$n$$ ordered by restricted refinement.

That is, if $$p$$ and $$q$$ are integer partitions of $$n$$, then $$p$$ covers $$q$$ if and only if $$q$$ is obtained from $$p$$ by joining two distinct parts of $$p$$ (and sorting, if necessary).

EXAMPLES:

sage: P = posets.RestrictedIntegerPartitions(7); P                          # optional - sage.combinat
Finite poset containing 15 elements
sage: len(P.cover_relations())                                              # optional - sage.combinat
17
static RibbonPoset(n, descents)#

Return a ribbon poset on n vertices with descents at descents.

INPUT:

• n – the number of vertices

• descents – an iterable; the indices on the ribbon where $$y > x$$

EXAMPLES:

sage: R = Posets.RibbonPoset(5, [1,2])
sage: sorted(R.cover_relations())
[[0, 1], [2, 1], [3, 2], [3, 4]]
static SSTPoset(s, f=None)#

The lattice poset on semistandard tableaux of shape s and largest entry f that is ordered by componentwise comparison of the entries.

INPUT:

• s - shape of the tableaux

• f - maximum fill number. This is an optional argument. If no maximal number is given, it will use the number of cells in the shape.

Note

This is a basic implementation and most certainly not the most efficient.

EXAMPLES:

sage: posets.SSTPoset([2,1])                                                # optional - sage.combinat
Finite lattice containing 8 elements

sage: posets.SSTPoset([2,1],4)                                              # optional - sage.combinat
Finite lattice containing 20 elements

sage: posets.SSTPoset([2,1],2).cover_relations()                            # optional - sage.combinat
[[[[1, 1], [2]], [[1, 2], [2]]]]

sage: posets.SSTPoset([3,2]).bottom()  # long time (6s on sage.math, 2012)  # optional - sage.combinat
[[1, 1, 1], [2, 2]]

sage: posets.SSTPoset([3,2],4).maximal_elements()                           # optional - sage.combinat
[[[3, 3, 4], [4, 4]]]
static SetPartitions(n)#

Return the lattice of set partitions of the set $$\{1,\ldots,n\}$$ ordered by refinement.

INPUT:

• n – a positive integer

EXAMPLES:

sage: posets.SetPartitions(4)                                               # optional - sage.combinat
Finite lattice containing 15 elements
static ShardPoset(n)#

Return the shard intersection order on permutations of size $$n$$.

This is defined on the set of permutations. To every permutation, one can attach a pre-order, using the descending runs and their relative positions.

The shard intersection order is given by the implication (or refinement) order on the set of pre-orders defined from all permutations.

This can also be seen in a geometrical way. Every pre-order defines a cone in a vector space of dimension $$n$$. The shard poset is given by the inclusion of these cones.

EXAMPLES:

sage: P = posets.ShardPoset(4); P  # indirect doctest
Finite poset containing 24 elements
sage: P.chain_polynomial()
34*q^4 + 90*q^3 + 79*q^2 + 24*q + 1
sage: P.characteristic_polynomial()
q^3 - 11*q^2 + 23*q - 13
sage: P.zeta_polynomial()
17/3*q^3 - 6*q^2 + 4/3*q
sage: P.is_self_dual()
False

Return the partially ordered set on 2n elements with dimension n.

Let $$P$$ be the poset on $$\{0, 1, 2, \ldots, 2n-1\}$$ whose defining relations are that $$i < j$$ for every $$0 \leq i < n \leq j < 2n$$ except when $$i + n = j$$. The poset $$P$$ is the so-called standard example of a poset with dimension $$n$$.

INPUT:

• n – an integer $$\ge 2$$, dimension of the constructed poset

• facade (boolean) – whether to make the returned poset a facade poset (see sage.categories.facade_sets); the default behaviour is the same as the default behaviour of the Poset() constructor

OUTPUT:

The standard example of a poset of dimension $$n$$.

EXAMPLES:

sage: A = posets.StandardExample(3); A
Finite poset containing 6 elements
sage: A.dimension()
3

REFERENCES:

static SymmetricGroupAbsoluteOrderPoset(n, labels='permutations')#

Return the poset of permutations with respect to absolute order.

INPUT:

• n – a positive integer

• label – (default: 'permutations') a label for the elements of the poset returned by the function; the options are

• 'permutations' - labels the elements are given by their one-line notation

• 'reduced_words' - labels the elements by the lexicographically minimal reduced word

• 'cycles' - labels the elements by their expression as a product of cycles

EXAMPLES:

sage: posets.SymmetricGroupAbsoluteOrderPoset(4)                            # optional - sage.groups
Finite poset containing 24 elements
sage: posets.SymmetricGroupAbsoluteOrderPoset(3, labels="cycles")           # optional - sage.groups
Finite poset containing 6 elements
sage: posets.SymmetricGroupAbsoluteOrderPoset(3, labels="reduced_words")    # optional - sage.groups
Finite poset containing 6 elements
static SymmetricGroupBruhatIntervalPoset(start, end)#

The poset of permutations with respect to Bruhat order.

INPUT:

• start - list permutation

• end - list permutation (same n, of course)

Note

Must have start <= end.

EXAMPLES:

Any interval is rank symmetric if and only if it avoids these permutations:

sage: P1 = posets.SymmetricGroupBruhatIntervalPoset([1,2,3,4], [3,4,1,2])
sage: P2 = posets.SymmetricGroupBruhatIntervalPoset([1,2,3,4], [4,2,3,1])
sage: ranks1 = [P1.rank(v) for v in P1]
sage: ranks2 = [P2.rank(v) for v in P2]
sage: [ranks1.count(i) for i in sorted(set(ranks1))]
[1, 3, 5, 4, 1]
sage: [ranks2.count(i) for i in sorted(set(ranks2))]
[1, 3, 5, 6, 4, 1]
static SymmetricGroupBruhatOrderPoset(n)#

The poset of permutations with respect to Bruhat order.

EXAMPLES:

sage: posets.SymmetricGroupBruhatOrderPoset(4)
Finite poset containing 24 elements
static SymmetricGroupWeakOrderPoset(n, labels='permutations', side='right')#

The poset of permutations of $$\{ 1, 2, \ldots, n \}$$ with respect to the weak order (also known as the permutohedron order, cf. permutohedron_lequal()).

The optional variable labels (default: "permutations") determines the labelling of the elements if $$n < 10$$. The optional variable side (default: "right") determines whether the right or the left permutohedron order is to be used.

EXAMPLES:

sage: posets.SymmetricGroupWeakOrderPoset(4)
Finite poset containing 24 elements
static TamariLattice(n, m=1)#

Return the $$n$$-th Tamari lattice.

Using the slope parameter $$m$$, one can also get the $$m$$-Tamari lattices.

INPUT:

• $$n$$ – a nonnegative integer (the index)

• $$m$$ – an optional nonnegative integer (the slope, default to 1)

OUTPUT:

a finite lattice

In the usual case, the elements of the lattice are Dyck paths in the $$(n+1 \times n)$$-rectangle. For a general slope $$m$$, the elements are Dyck paths in the $$(m n+1 \times n)$$-rectangle.

See Tamari lattice for mathematical background.

EXAMPLES:

sage: posets.TamariLattice(3)
Finite lattice containing 5 elements

sage: posets.TamariLattice(3, 2)
Finite lattice containing 12 elements

REFERENCES:

static TetrahedralPoset(n, *colors, **labels)#

Return the tetrahedral poset based on the input colors.

This method will return the tetrahedral poset with n-1 layers and covering relations based on the input colors of ‘green’, ‘red’, ‘orange’, ‘silver’, ‘yellow’ and ‘blue’ as defined in [Striker2011]. For particular color choices, the order ideals of the resulting tetrahedral poset will be isomorphic to known combinatorial objects.

For example, for the colors ‘blue’, ‘yellow’, ‘orange’, and ‘green’, the order ideals will be in bijection with alternating sign matrices. For the colors ‘yellow’, ‘orange’, and ‘green’, the order ideals will be in bijection with semistandard Young tableaux of staircase shape. For the colors ‘red’, ‘orange’, ‘green’, and optionally ‘yellow’, the order ideals will be in bijection with totally symmetric self-complementary plane partitions in a $$2n \times 2n \times 2n$$ box.

INPUT:

• n - Defines the number (n-1) of layers in the poset.

• colors - The colors that define the covering relations of the poset. Colors used are ‘green’, ‘red’, ‘yellow’, ‘orange’, ‘silver’, and ‘blue’.

• labels - Keyword variable used to determine whether the poset is labeled with integers or tuples. To label with integers, the method should be called with labels='integers'. Otherwise, the labeling will default to tuples.

EXAMPLES:

sage: posets.TetrahedralPoset(4,'green','red','yellow','silver','blue','orange')
Finite poset containing 10 elements

sage: posets.TetrahedralPoset(4,'green','red','yellow','silver','blue','orange', labels='integers')
Finite poset containing 10 elements

sage: A = AlternatingSignMatrices(3)                                        # optional - sage.combinat sage.modules
sage: p = A.lattice()                                                       # optional - sage.combinat sage.modules
sage: ji = p.join_irreducibles_poset()                                      # optional - sage.combinat sage.modules
sage: tet = posets.TetrahedralPoset(3, 'green','yellow','blue','orange')    # optional - sage.combinat sage.modules
sage: ji.is_isomorphic(tet)                                                 # optional - sage.combinat sage.modules
True
static UpDownPoset(n, m=1)#

Return the up-down poset on $$n$$ elements where every $$(m+1)$$ step is down and the rest are up.

The case where $$m=1$$ is sometimes referred to as the zig-zag poset or the fence.

INPUT:

• n - nonnegative integer, number of elements in the poset

• m - nonnegative integer (default 1), how frequently down steps occur

OUTPUT:

The partially ordered set on $$\{ 0, 1, \ldots, n-1 \}$$ where $$i$$ covers $$i+1$$ if $$m$$ divides $$i+1$$, and $$i+1$$ covers $$i$$ otherwise.

EXAMPLES:

sage: P = posets.UpDownPoset(7, 2); P
Finite poset containing 7 elements
sage: sorted(P.cover_relations())
[[0, 1], [1, 2], [3, 2], [3, 4], [4, 5], [6, 5]]

Fibonacci numbers as the number of antichains of a poset:

sage: [len(posets.UpDownPoset(n).antichains().list()) for n in range(6)]    # optional - sage.combinat
[1, 2, 3, 5, 8, 13]
static YoungDiagramPoset(lam, dual=False)#

Return the poset of cells in the Young diagram of a partition.

INPUT:

• lam – a partition

• dual – (default: False) determines the orientation of the poset; if True, then it is a join semilattice, otherwise it is a meet semilattice

EXAMPLES:

sage: P = posets.YoungDiagramPoset(Partition([2, 2])); P                    # optional - sage.combinat
Finite meet-semilattice containing 4 elements

sage: sorted(P.cover_relations())                                           # optional - sage.combinat
[[(0, 0), (0, 1)], [(0, 0), (1, 0)], [(0, 1), (1, 1)], [(1, 0), (1, 1)]]

sage: posets.YoungDiagramPoset([3, 2], dual=True)                           # optional - sage.combinat
Finite join-semilattice containing 5 elements
static YoungFibonacci(n)#

Return the Young-Fibonacci lattice up to rank $$n$$.

Elements of the (infinite) lattice are words with letters ‘1’ and ‘2’. The covers of a word are the words with another ‘1’ added somewhere not after the first occurrence of an existing ‘1’ and, additionally, the words where the first ‘1’ is replaced by a ‘2’. The lattice is truncated to have rank $$n$$.

EXAMPLES:

sage: Y5 = posets.YoungFibonacci(5); Y5                                     # optional - sage.combinat
Finite meet-semilattice containing 20 elements
sage: sorted(Y5.upper_covers(Word('211')))                                  # optional - sage.combinat
[word: 1211, word: 2111, word: 221]
static YoungsLattice(n)#

Return Young’s Lattice up to rank $$n$$.

In other words, the poset of partitions of size less than or equal to $$n$$ ordered by inclusion.

INPUT:

• n – a positive integer

EXAMPLES:

sage: P = posets.YoungsLattice(3); P                                        # optional - sage.combinat
Finite meet-semilattice containing 7 elements
sage: P.cover_relations()                                                   # optional - sage.combinat
[[[], [1]],
[[1], [1, 1]],
[[1], [2]],
[[1, 1], [1, 1, 1]],
[[1, 1], [2, 1]],
[[2], [2, 1]],
[[2], [3]]]
static YoungsLatticePrincipalOrderIdeal(lam)#

Return the principal order ideal of the partition $$lam$$ in Young’s Lattice.

INPUT:

• lam – a partition

EXAMPLES:

sage: P = posets.YoungsLatticePrincipalOrderIdeal(Partition([2,2]))         # optional - sage.combinat
sage: P                                                                     # optional - sage.combinat
Finite lattice containing 6 elements
sage: P.cover_relations()                                                   # optional - sage.combinat
[[[], [1]],
[[1], [1, 1]],
[[1], [2]],
[[1, 1], [2, 1]],
[[2], [2, 1]],
[[2, 1], [2, 2]]]
sage = <module 'sage' (<_frozen_importlib_external._NamespaceLoader object>)>#
sage.combinat.posets.poset_examples.check_int(n, minimum=0)#

Check that n is an integer at least equal to minimum.

This is a boilerplate function ensuring input safety.

INPUT:

• n – anything

• minimum – an optional integer (default: 0)

EXAMPLES:

sage: from sage.combinat.posets.poset_examples import check_int
sage: check_int(6, 3)
6
sage: check_int(6)
6

sage: check_int(-1)
Traceback (most recent call last):
...
ValueError: number of elements must be a non-negative integer, not -1

sage: check_int(1, 3)
Traceback (most recent call last):
...
ValueError: number of elements must be an integer at least 3, not 1

sage: check_int('junk')
Traceback (most recent call last):
...
ValueError: number of elements must be a non-negative integer, not junk
sage.combinat.posets.poset_examples.posets#

alias of Posets