# A catalog of posets and lattices.¶

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

sage: posets.PentagonPoset()
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. 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. 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. 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$$.

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

static AntichainPoset(n, facade=None)

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

INPUT:

EXAMPLES:

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

static BooleanLattice(n, facade=None)

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

EXAMPLES:

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

static ChainPoset(n, facade=None)

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

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])
sage: posets.CoxeterGroupAbsoluteOrderPoset(W)
Finite poset containing 48 elements

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

static Crown(n, facade=None)

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:

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:

static DiamondPoset(n, facade=None)

Return the lattice of rank two containing n elements.

INPUT:

EXAMPLES:

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

static DivisorLattice(n, facade=None)

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:

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 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
Finite poset containing 15 elements
sage: len(P.cover_relations())
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
Finite lattice containing 11 elements
sage: P.cover_relations()
[[[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 NoncrossingPartitions(W)

Return the lattice of noncrossing partitions.

INPUT:

• W – a finite Coxeter group or a Weyl group

EXAMPLES:

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

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

static PentagonPoset(facade=None)

Return the Pentagon poset.

INPUT:

EXAMPLES:

sage: P = posets.PentagonPoset(); P
Finite lattice containing 5 elements
sage: P.cover_relations()
[[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
Finite poset containing 33 elements
sage: sorted(P4.lower_covers(Permutation([2,4,1,3])))
[[1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2]]

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
Finite poset containing 14 elements
sage: R.moebius_function(R.bottom(),R.top())
-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 futher 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
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
Finite meet-semilattice containing 19 elements
sage: all(P.is_chain() for P in P3.maximal_elements())
True

static ProductOfChains(chain_lengths, facade=None)

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
Finite lattice containing 4 elements
sage: P.linear_extension()
[(0, 0), (0, 1), (1, 0), (1, 1)]
sage: P.upper_covers((0,0))
[(0, 1), (1, 0)]
sage: P.lower_covers((1,1))
[(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
Finite lattice containing 8 elements
sage: L.cover_relations()
[[7, 6], [7, 3], [7, 1], ..., [5, 4], [2, 4], [1, 4], [0, 4]]
sage: L = posets.RandomLattice(10, 0, properties=['dismantlable'])
sage: L.is_dismantlable()
True

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

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
Finite poset containing 15 elements
sage: len(P.cover_relations())
17

static SSTPoset(s, f=None)

The 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])
Finite poset containing 8 elements

sage: posets.SSTPoset([2,1],4)
Finite poset containing 20 elements

sage: posets.SSTPoset([2,1],2).cover_relations()
[[[[1, 1], [2]], [[1, 2], [2]]]]

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

sage: posets.SSTPoset([3,2],4).maximal_elements()
[[[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)
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

static StandardExample(n, facade=None)

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)
Finite poset containing 24 elements
sage: posets.SymmetricGroupAbsoluteOrderPoset(3, labels="cycles")
Finite poset containing 6 elements
sage: posets.SymmetricGroupAbsoluteOrderPoset(3, labels="reduced_words")
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)
sage: p = A.lattice()
sage: ji = p.join_irreducibles_poset()
sage: tet = posets.TetrahedralPoset(3, 'green','yellow','blue','orange')
sage: ji.is_isomorphic(tet)
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)]
[1, 2, 3, 5, 8, 13]

static YoungDiagramPoset(lam)

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

INPUT:

• lam – a partition

EXAMPLES:

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

sage: sorted(P.cover_relations())
[[(0, 0), (0, 1)], [(0, 0), (1, 0)], [(0, 1), (1, 1)], [(1, 0), (1, 1)]]

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
Finite meet-semilattice containing 20 elements
sage: sorted(Y5.upper_covers(Word('211')))
[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
Finite meet-semilattice containing 7 elements
sage: P.cover_relations()
[[[], [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]))
sage: P
Finite lattice containing 6 elements
sage: P.cover_relations()
[[[], [1]],
[[1], [1, 1]],
[[1], [2]],
[[1, 1], [2, 1]],
[[2], [2, 1]],
[[2, 1], [2, 2]]]

sage.combinat.posets.poset_examples.posets