posets : a mathematica packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · posets :...

48
POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker, Department of Mathematics, Haverford College 19041, July 1990 Updates 1992-94: John Dollhopf, Sam Hsiao, Curtis Greene Updates 2008: Erica Greene, Curtis Greene Updates 2010-2012: Ian Burnette, Curtis Greene 0. Introduction Part 1 of the documentation contains examples illustrating the basic commands. Part 2 (this notebook) contains more complicated examples and several "case studies" illustrating applications to various problems in combinatorics. The package should be run first, e.g., by entering << posets300.m or by opening the document and clicking on the "run package" button. 6. Sandpile Posets The "sandpile posets" are a class of posets related to both chip-firing posets and majorization posets (MajP[n]). Essentially, the covering relation is defined as in the majorization lattice, except that only adjacent elements may be transformed. The commands defining these posets are built into the package, but are included here as an illustration. SOrder@w_D := Module@8outlist = 8<,i<, If@w@@- 1DD >= 2, AppendTo@outlist, Join@Drop@w, - 1D, Join@8w@@- 1DD - 1<, 81<DDDD; Do@ If@w@@iDD - w@@i + 1DD > 1 && w@@iDD > 0 , AppendTo@outlist, Adjust@i, wDDD, 8i, Length@wD - 1<D; outlist D; Adjust@j_, w_D := Module@8t = w<, t@@jDD = w@@jDD - 1; t@@j + 1DD = w@@j + 1DD + 1; tD; SPM@n_D := 8SOrder, 88n<<,n^4<;

Upload: others

Post on 12-Sep-2019

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

POSETS : A Mathematica Package PART 2: More Complicated Examples

Curtis Greene, Eugenie Hunsicker, Department of Mathematics, Haverford College 19041, July 1990Updates 1992-94: John Dollhopf, Sam Hsiao, Curtis GreeneUpdates 2008: Erica Greene, Curtis GreeneUpdates 2010-2012: Ian Burnette, Curtis Greene

0. IntroductionPart 1 of the documentation contains examples illustrating the basic commands. Part 2 (this notebook) contains morecomplicated examples and several "case studies" illustrating applications to various problems in combinatorics.

The package should be run first, e.g., by entering

<< posets300.m

or by opening the document and clicking on the "run package" button.

6. Sandpile PosetsThe "sandpile posets" are a class of posets related to both chip-firing posets and majorization posets (MajP[n]).Essentially, the covering relation is defined as in the majorization lattice, except that only adjacent elements may betransformed. The commands defining these posets are built into the package, but are included here as an illustration.

SOrder@w_D := Module@8outlist = 8<, i<,If@w@@-1DD >= 2, AppendTo@outlist, Join@Drop@w, -1D, Join@8w@@-1DD - 1<, 81<DDDD;Do@

If@w@@iDD - w@@i + 1DD > 1 && w@@iDD > 0 , AppendTo@outlist, Adjust@i, wDDD,8i, Length@wD - 1<D;

outlistD;

Adjust@j_, w_D := Module@8t = w<,t@@jDD = w@@jDD - 1; t@@j + 1DD = w@@j + 1DD + 1;

tD;

SPM@n_D := 8SOrder, 88n<<, n^4<;

Page 2: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@SPM@9D, spm9DChangeLabel@spm9, Compact, 1DDiagram@spm9, ShowLabels ® 1D

Building poset spm9 ...

Done

9

81

72

711 63

621 54

531

441 522

432 5211

4311

4221

3321

Technically, the sandpile poset is the dual of what we have just constructed.

BuildDual@spm9, dspm9DChangeLabel@dspm9, Compact, 1DDiagram@dspm9, ShowLabels ® 1D

Building poset dspm9 ...

Done

3321

4221

4311

5211 432

522 441

531

54 621

63 711

72

81

9

2 posets300-doc2.nb

Page 3: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

LatticeQ@spm9DDistributiveLatticeQ@spm9D

True

True

The sandpile posets are always lattices, but (unfortunately) not always distributive.

Build@SPM@10D, spm10DBuildDual@spm10, dspm10DChangeLabel@dspm10, Compact, 1DDiagram@dspm10, ShowLabels ® 1D

Building poset spm10 ...

Done

Building poset dspm10 ...

Done

4321

433 5221 4411

442 5311

6211 532

622 541

55 631

64 721

73 811

82

91

10

LatticeQ@dspm10DDistributiveLatticeQ@dspm10D

True

False

Is it an interval in the majorization order?

Build@MajP@10D, majp10DRankedQ@majp10Dspindices = LocateSet@majp10, P@dspm10DDIntervalQ@majp10, spindicesD

Building poset majp10 ...

Done

False

822, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42<

False

The answer appears to be "no". Let' s look at the situation a little more carefully. Output from the Diagram commandis not particularly useful, but it is possible to see much more using the Manipulate option. (Try it yourself, shrinkingthe dots, shifting, stretching, zooming, etc.)

posets300-doc2.nb 3

Page 4: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

The answer appears to be "no". Let' s look at the situation a little more carefully. Output from the Diagram commandis not particularly useful, but it is possible to see much more using the Manipulate option. (Try it yourself, shrinkingthe dots, shifting, stretching, zooming, etc.)

ChangeLabel@majp10, Compact, 1DDiagram@majp10, spindices, ShowLabels ® 1DDiagram@majp10, spindices, Manipulate ® TrueD

1111111111

211111111

22111111

2221111 31111111

222211 3211111

22222 322111 4111111

32221 331111

421111 33211

42211 511111 3322

4222 43111 52111

3331 4321

5221 61111 433 4411

5311 6211

442 532

622 7111 541

631 721

55 64

73 811

82

91

10

4 posets300-doc2.nb

Page 5: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Stretch

Shift

Zoom

Reset Save Load

Shifts and Stretches Special Points Points and Lines Label Commands Save and Reset

Here is a "blown-up" version of the diagram, created using the Diagram/Manipulate command.

posets300-doc2.nb 5

Page 6: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Here is a "blown-up" version of the diagram, created using the Diagram/Manipulate command.

Diagram@majp10, spindices, ShowLabels ® 1D

22222 322111 4111111

32221 331111

421111 33211

42211 511111 3322

4222 43111 52111

3331 4321

5221 61111 433 4411

5311 6211

442 532

622 7111 541

631 721

55 64

73 811

82

91

10

If you explore the diagram carefully you will see that the sandpile lattice is not an interval: the partition (6, 2, 1, 1) is inthe sandpile poset, i.e. it can be obtained from (10) by sandpile operations. On the other hand, (7, 1, 1, 1) lies above itin the majorization order, but does not lie in the sandpile poset.

7. Fibonacci LatticesThe r-Fibonacci lattice, denoted by Fib(r), is defined as follows. Let A(r) = {0,1,...,r}, and let A(r)* denote the set ofall finite words formed from letters in A(r). Define Fib(r) by taking A(r)* as the underlying set, and letting v cover u ifu can be obtained from v by changing a 0 in v to an x¹0 or by removing the last digit in v if it is non-zero. It is clearthat Fib(r) is a graded poset with a unique minimal element. Furthermore, when r = 1, the number of elements at rank n

is the Fibonacci number Fn+1 (where F1= F2=1, Fn+1=Fn + Fn–1).

The first step is to define the covering function for Fib(r). Here fiblattice[r,h] returns a triple {fibcover, {{}}, h},where fibcover is the covering function (depending on r), {} is the unique minimal element (the empty word), and h isthe the rank up to which we wish to build Fib(r). Thus, applying Build to fiblattice[r,h] yields Fib(r) "up to" rank h.

fiblattice@r_, h_D := Block@8<, fibcover@w_D := Block@8coverlist = 8<, len = Length@wD<, Do@AppendTo@coverlist, Flatten@8w, i<DD, 8i, r<D; Do@

If@! HwPiT == 0L, AppendTo@coverlist, Join@Take@w, i - 1D, 80<, Take@w, -Hlen - iLDDDD,8i, len<D; coverlistD; Return@8fibcover, 88<<, h<D;D;

6 posets300-doc2.nb

Page 7: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@fiblattice@1, 5D, fib105DChangeLabel@fib105, Compact, 1D;Diagram@fib105, ShowLabels ® 1D

Building poset fib105 ...

Done

1

11 0

111 01 10

1111 011 101 110 00

11111 0111 1011 1101 1110 001 010 100

NK@fib105D

81, 1, 2, 3, 5, 8<

The poset we have constructed is obviously not a lattice, because we have constructed only finitely many ranks.However, the principal order ideals in Fib[r] are lattices. In fact when r=1 they are distributive lattices.

posets300-doc2.nb 7

Page 8: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

indices = IntervalP@fib105, 8<, 81, 0, 1, 1<DBuildSubPoset@fib105, indices, ideal105DDiagram@ideal105, ShowLabels ® 1D

81, 2, 3, 5, 7, 8, 10, 15<

Building Subposet ideal105 ...

Building poset ideal105 ...

Done

8<

81<

81, 1<

81, 1, 1< 81, 0<

81, 1, 1, 1< 81, 0, 1<

81, 0, 1, 1<

DistributiveLatticeQ@ideal105D

True

Next we construct Fib[2].

8 posets300-doc2.nb

Page 9: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@fiblattice@2, 3D, fib203DChangeLabel@fib203, Compact, 1DDiagram@fib203, ShowLabels ® 1D

Building poset fib203 ...

Done

1 2

11 12 0 21 22

111 112 01 10 121 122 02 211 212 20 221 222

Build@fiblattice@2, 5D, fib205DDiagram@fib205, Manipulate ® TrueD;

Building poset fib205 ...

Done

RGF@fib205D

1 + 2 q + 5 q2 + 12 q3 + 29 q4 + 70 q5

MaximalChainsDown@fib205D

81, 1, 1, 1, 1, 2, 1, 1, 1, 1, 4, 2, 1, 1, 4, 1, 1, 2, 1, 1, 1, 1, 6, 4, 2, 1, 1, 6, 4, 12, 1,1, 6, 2, 1, 1, 6, 1, 1, 4, 2, 1, 1, 4, 1, 1, 2, 1, 1, 1, 1, 8, 6, 4, 2, 1, 1, 8, 6, 4, 32,16, 12, 1, 1, 8, 6, 2, 1, 1, 8, 6, 32, 1, 1, 8, 4, 2, 1, 1, 8, 4, 16, 1, 1, 8, 2, 1, 1,8, 1, 1, 6, 4, 2, 1, 1, 6, 4, 12, 1, 1, 6, 2, 1, 1, 6, 1, 1, 4, 2, 1, 1, 4, 1, 1, 2, 1, 1<

Exercise: what is a formula for the number of maximal chains down from each element of Fib[2]?

posets300-doc2.nb 9

Page 10: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

indices = IntervalP@fib205, 8<, 82, 0, 0<DBuildSubPoset@fib205, indices, ideal205DChangeLabel@ideal205, Compact, 1DDiagram@ideal205, ShowLabels ® 1D

81, 3, 7, 8, 16, 17, 18, 19, 20, 40, 41, 44, 47, 100<

Building Subposet ideal205 ...

Building poset ideal205 ...

Done

2

21 22

211 212 20 221 222

201 210 202 220

200

LatticeQ@ideal205DDistributiveLatticeQ@ideal205D

True

False

For r > 1 the Fibonacci lattice F[r] is not distributive.

8. The "Poset Conjecture"Recall that OmegaGF[P,q] is the rational generating function for the order polynomial of P.

Conjecture: For any poset P, the numerator of OmegaGF[p,q] has only real roots, and they are all nonpositive.

This was known as the Neggers Conjecture (after Neggers [1978]), or sometimes just the Poset Conjecture, until itwas finally disproved in 2007 by John Stembridge.

We will illustrate the calculation on three random posets with 8 elements. Before Stembridge's counterexample, wemight have considered this positive evidence for the conjecture.

10 posets300-doc2.nb

Page 11: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@RandomP@8, .5D, testposetD;Diagram@testposetDnum = Numerator@OmegaGF@testposet, qDD;NRoots@num == 0, qD

Building poset testposet ...

Done

q � -6.60276 ÈÈ q � -1. ÈÈ q � -0.80293 ÈÈ q � -0.0943119 ÈÈ q � 0.

posets300-doc2.nb 11

Page 12: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@RandomP@8, .5D, testposetD;Diagram@testposetDnum = Numerator@OmegaGF@testposet, qDD;NRoots@num == 0, qD

Building poset testposet ...

Done

q � -6.60276 ÈÈ q � -1. ÈÈ q � -0.80293 ÈÈ q � -0.0943119 ÈÈ q � 0.

Build@RandomP@8, .3D, testposetD;Diagram@testposetD;num = Numerator@OmegaGF@testposet, qDD;NRoots@num == 0, qD

Building poset testposet ...

Done

q � -6.60276 ÈÈ q � -1. ÈÈ q � -0.80293 ÈÈ q � -0.0943119 ÈÈ q � 0.

Stembridge showed that the smallest counterexamples to the Poset Conjecture have 17 elements. We conclude thissection by constructing one of them.

stex = 8881, 3<, 83, 5<, 85, 7<, 87, 9<, 89, 11<, 811, 13<, 813, 15<,815, 17<, 82, 4<, 84, 6<, 86, 8<, 88, 10<, 810, 12<, 812, 14<, 814, 16<,81, 12<, 83, 14<, 85, 16<, 82, 3<, 84, 5<, 86, 7<, 88, 9<,810, 11<, 812, 13<, 814, 17<<, 17<;

12 posets300-doc2.nb

Page 13: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@stex, stemDDiagram@stem, ShowLabels ® TrueDnum = Numerator@OmegaGF@stem, qDDNRoots@num == 0, qD

Building poset stem ...

Done

q + 32 q2 + 336 q3 + 1420 q4 + 2534 q5 + 1946 q6 + 658 q7 + 86 q8 + 3 q9

q � -18.6404 ÈÈ q � -5.328 ÈÈ q � -1.85884 - 0.149768 ä ÈÈ q � -1.85884 + 0.149768 ä ÈÈq � -0.561746 ÈÈ q � -0.24424 ÈÈ q � -0.111421 ÈÈ q � -0.0631306 ÈÈ q � 0.

9. The "Distributive Lattice Conjecture"

Let P be a poset with 0 and 1. Let ci(P) be the number of chains of length i from 0 to 1 in P (so,

in particular, c0(P)=0 and c1(P)=1). Define the chain polynomial of P by

C(P;q) = Úi ³ 1 ci(P) qi .

Conjecture: Let L be a distributive lattice. Then the polynomial C(L;q) has only real zeros.

This has come to be known as the Distributive Lattice Conjecture. As a matter of fact, it is equivalent to the "PosetConjecture" described in the previous section. The reason is that L = J(P) for some poset P, and it turns out thatC(P;q) is related to OmegaGF(P;q) by a simple change of variables. We will illustrate this by computing both expres-sions for some randomly generated posets.

We can calculate C(P;q) using the "ChainsBetweenGF" command:

posets300-doc2.nb 13

Page 14: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@RandomP@5, .3D, rand5DDiagram@rand5DBuild@JofP@rand5D, jprand5DDiagram@jprand5Dchainpoly = ChainsBetweenGF@jprand5, 1, Card@jprand5DD

Building poset rand5 ...

Done

Building poset jprand5 ...

Done

q + 14 q2 + 48 q3 + 60 q4 + 25 q5

nn = Numerator@OmegaGF@rand5, qDD

q + 10 q2 + 12 q3 + 2 q4

14 posets300-doc2.nb

Page 15: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

ExpandBTogetherB nn �.q ®t

1 + tH1 + tL5FF

t + 14 t2 + 48 t3 + 60 t4 + 25 t5

NRoots@chainpoly == 0, qD

q � -1. ÈÈ q � -0.834017 ÈÈ q � -0.462222 ÈÈ q � -0.103761 ÈÈ q � 0.

Build@RandomP@7, .5D, rand7DDiagram@rand7DBuild@JofP@rand7D, jprand7Dchainpoly = ChainsBetweenGF@jprand7, 1, Card@jprand7DD

Building poset rand7 ...

Done

Building poset jprand7 ...

Done

q + 14 q2 + 66 q3 + 146 q4 + 167 q5 + 96 q6 + 22 q7

posets300-doc2.nb 15

Page 16: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Diagram@jprand7D

NRoots@chainpoly == 0, qD

q � -1. ÈÈ q � -1. ÈÈ q � -1. ÈÈ q � -0.823497 ÈÈ q � -0.403263 ÈÈ q � -0.136876 ÈÈ q � 0.

Again Stembridge' s counterexamples show that the Distributive Lattice Conjecture is false in general :

Build@JofP@stemD, jpstemDchainpoly = ChainsBetweenGF@jpstem, 1, Card@jpstemDD

Building poset jpstem ...

Done

q + 48 q2 + 936 q3 + 10044 q4 + 67950 q5 + 313466 q6 +

1035868 q7 + 2530748 q8 + 4661145 q9 + 6538420 q10 + 6999852 q11 +

5683476 q12 + 3442872 q13 + 1508466 q14 + 451880 q15 + 82852 q16 + 7016 q17

NRoots@chainpoly == 0, qD

q � -1.06658 ÈÈ q � -1.06252 ÈÈ q � -1.03417 ÈÈ q � -1.02636 ÈÈq � -0.983865 ÈÈ q � -0.983659 ÈÈ q � -0.937142 ÈÈ q � -0.928866 ÈÈ q � -0.912186 ÈÈq � -0.842022 ÈÈ q � -0.651166 - 0.0182745 ä ÈÈ q � -0.651165 + 0.0182753 ä ÈÈq � -0.359691 ÈÈ q � -0.196297 ÈÈ q � -0.100251 ÈÈ q � -0.0593818 ÈÈ q � 0.

10. Case Study: Zig-Zag PosetsNext we will perform an extended study of properties of a family of posets called (for obvious reasons) "zigzagposets". Some of the observations made here were discovered using this package.

16 posets300-doc2.nb

Page 17: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@ZigZag@6D, zz6DDiagram@zz6, ShowLabels ® 81, 2<D

Building poset zz6 ...

Done

1 3 5

2 4 6

1 2 3

4 5 6

Note that the red labels (on the left) are the elements of P[zz6] and the blue labels (on the right) are the indices of thoseelements. First we construct the lattice of order ideals of P[zz6] and compute its rank generating function.

Build@JofP@zz6D, jofzz6DDiagram@jofzz6D

Building poset jofzz6 ...

Done

RGF@jofzz6D

1 + 3 q + 4 q2 + 5 q3 + 4 q4 + 3 q5 + q6

posets300-doc2.nb 17

Page 18: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

A study of the roots of these polynomials led us to conjecture and prove (with Michelle Thompson) an explicit formulafor the rank generating function. It can be expressed neatly in terms of Chebyshev polynomials:

ExpandBq3 ChebyshevUB3,1

2q + 1 +

1

qFF

1 + 3 q + 4 q2 + 5 q3 + 4 q4 + 3 q5 + q6

Next we compute the linear extensions and topological sortings of P[zz5].

Build@ZigZag@5D, zz5DDiagram@zz5, ShowLabels ® 81, 2<D

Building poset zz5 ...

Done

1 3 5

2 4

1 2 3

4 5

LinearExtensions@zz5DTopSortings@zz5D

884, 2, 1, 5, 3<, 83, 2, 1, 5, 4<, 83, 2, 1, 4, 5<, 84, 1, 2, 5, 3<,83, 1, 2, 5, 4<, 83, 1, 2, 4, 5<, 82, 1, 4, 3, 5<, 82, 1, 3, 5, 4<,82, 1, 3, 4, 5<, 82, 3, 1, 5, 4<, 82, 3, 1, 4, 5<, 81, 3, 2, 5, 4<,81, 3, 2, 4, 5<, 81, 2, 4, 3, 5<, 81, 2, 3, 5, 4<, 81, 2, 3, 4, 5<<

883, 2, 5, 1, 4<, 83, 2, 1, 5, 4<, 83, 2, 1, 4, 5<, 82, 3, 5, 1, 4<,82, 3, 1, 5, 4<, 82, 3, 1, 4, 5<, 82, 1, 4, 3, 5<, 82, 1, 3, 5, 4<,82, 1, 3, 4, 5<, 83, 1, 2, 5, 4<, 83, 1, 2, 4, 5<, 81, 3, 2, 5, 4<,81, 3, 2, 4, 5<, 81, 2, 4, 3, 5<, 81, 2, 3, 5, 4<, 81, 2, 3, 4, 5<<

These objects are essentially equivalent to alternating permutations, that is, permutations having the pattern a < b > c< d > e ... , which are of great combinatorial interest. One way to see this is to observe that, if in each topologicalsorting, we map indices onto the original labels, we obtain a permutation in which the entries 1, 2, … have a “right-left-right-left ...”. pattern, and the inverses of such permutations are alternating in the usual sense.

18 posets300-doc2.nb

Page 19: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

tsort = TopSortings@zz5D �.81 ® 1, 2 ® 3, 3 ® 5, 4 ® 2, 5 ® 4<Map@InversePermutation, tsortD

885, 3, 4, 1, 2<, 85, 3, 1, 4, 2<, 85, 3, 1, 2, 4<, 83, 5, 4, 1, 2<,83, 5, 1, 4, 2<, 83, 5, 1, 2, 4<, 83, 1, 2, 5, 4<, 83, 1, 5, 4, 2<,83, 1, 5, 2, 4<, 85, 1, 3, 4, 2<, 85, 1, 3, 2, 4<, 81, 5, 3, 4, 2<,81, 5, 3, 2, 4<, 81, 3, 2, 5, 4<, 81, 3, 5, 4, 2<, 81, 3, 5, 2, 4<<

884, 5, 2, 3, 1<, 83, 5, 2, 4, 1<, 83, 4, 2, 5, 1<, 84, 5, 1, 3, 2<,83, 5, 1, 4, 2<, 83, 4, 1, 5, 2<, 82, 3, 1, 5, 4<, 82, 5, 1, 4, 3<,82, 4, 1, 5, 3<, 82, 5, 3, 4, 1<, 82, 4, 3, 5, 1<, 81, 5, 3, 4, 2<,81, 4, 3, 5, 2<, 81, 3, 2, 5, 4<, 81, 5, 2, 4, 3<, 81, 4, 2, 5, 3<<

A famous result of D. Andre states that alternating permutations are enumerated by the Eulerian numbers. These arethe number whose exponential generating function is Tan[x] + Sec[x] . Thus for example, for n=5, we have

Length@LinearExtensions@zz5DD

16

¶8x,5< HTan@xD + Sec@xDL �.x ® 0

16

The subposet of WeakS[5] consisting of the topological sortings of P[zz5] has some interesting properties. In order todisplay it, we use the command LocateSet to find the indices of corresponding elements in WeakS[5].Build@WeakS@5D, weaks5Dindices = LocateSet@weaks5, tsortDDiagram@weaks5, indicesD

Building poset weaks5 ...

Done

811, 22, 25, 41, 44, 45, 63, 64, 67, 68, 85, 86, 89, 102, 103, 114<

This subposet is actually an interval in P[weaks5], i.e. it consists of all elements lying between two fixed elements.This property is somewhat difficult to verify visually, and the following test can be used to confirm it:

IntervalQ@weaks5, indicesDindices == IntervalP@weaks5, P@weaks5DP11T, P@weaks5DP114TD

True

True

posets300-doc2.nb 19

Page 20: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

The observation just made follows from a more general result due to Björner and Wachs ("Permutation statistics andlinear extensions of posets", Jour. Combinatorial Theory A 57 (1991)).

Next we extract the sub-poset and take a good look at it.

BuildSubPoset@weaks5, indices, interval5DChangeLabel@interval5, Compact, 1DDiagram@interval5, ShowLabels ® 1D

Building Subposet interval5 ...

Building poset interval5 ...

Done

13254

31254 13524

31524 13542 15324

31542 35124 15342 51324

35142 53124 51342

35412 53142

53412

Next we compute number of maximal chains from the bottom element to each element of P.

MaximalChainsDown@interval5D

81, 1, 1, 2, 1, 1, 3, 2, 2, 1, 5, 3, 3, 5, 11, 16<

Is it a coincidence that the number (16) of maximal chains from bottom to top in the interval of topological sortings ofP[ZigZag[5]] is equal to the total number of such topological sortings (16)? Yes (unfortunately) this is a coincidence,and is not true in general. However, another similar numerical observation turns out not to be a coincidence.

We compute the number of maximal chains from bottom to top in P[weaks4], a poset with very different structure.This number also equals 16 -- and this is a theorem.

20 posets300-doc2.nb

Page 21: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@WeakS@4D, weaks4DDiagram@weaks4DMaximalChainsDown@weaks4D

Building poset weaks4 ...

Done

81, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 2, 2, 1, 3, 3, 3, 2, 3, 5, 6, 5, 16<

Theorem: the number of maximal chains in the interval of topological sortings of P[ZigZag[n]] in the weak order ofSn is equal to the number of maximal chains in Sn-1 .

Another illustration (with n=6) of this phenomenon:

posets300-doc2.nb 21

Page 22: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@ZigZag@6D, zz6Dtsort6 = TopSortings@zz6D �.81 ® 1, 2 ® 3, 3 ® 5, 4 ® 2, 5 ® 4, 6 ® 6<Build@WeakS@6D, weaks6Dindices6 = LocateSet@weaks6, tsort6D;IntervalQ@weaks6, indices6DBuildSubPoset@weaks6, indices6, interval6DMaximalChainsDown@interval6D �� Last

Building poset zz6 ...

Done

885, 6, 3, 4, 1, 2<, 85, 3, 6, 4, 1, 2<, 85, 3, 4, 6, 1, 2<, 85, 3, 4, 1, 6, 2<, 85, 3, 4, 1, 2, 6<,85, 6, 3, 1, 4, 2<, 85, 3, 6, 1, 4, 2<, 85, 3, 1, 6, 4, 2<, 85, 3, 1, 4, 6, 2<, 85, 3, 1, 4, 2, 6<,85, 6, 3, 1, 2, 4<, 85, 3, 6, 1, 2, 4<, 85, 3, 1, 6, 2, 4<, 85, 3, 1, 2, 6, 4<, 85, 3, 1, 2, 4, 6<,83, 5, 6, 4, 1, 2<, 83, 5, 4, 6, 1, 2<, 83, 5, 4, 1, 6, 2<, 83, 5, 4, 1, 2, 6<, 83, 5, 6, 1, 4, 2<,83, 5, 1, 6, 4, 2<, 83, 5, 1, 4, 6, 2<, 83, 5, 1, 4, 2, 6<, 83, 5, 6, 1, 2, 4<,83, 5, 1, 6, 2, 4<, 83, 5, 1, 2, 6, 4<, 83, 5, 1, 2, 4, 6<, 83, 1, 2, 5, 6, 4<,83, 1, 2, 5, 4, 6<, 83, 1, 5, 6, 4, 2<, 83, 1, 5, 4, 6, 2<, 83, 1, 5, 4, 2, 6<,83, 1, 5, 6, 2, 4<, 83, 1, 5, 2, 6, 4<, 83, 1, 5, 2, 4, 6<, 85, 6, 1, 3, 4, 2<,85, 1, 6, 3, 4, 2<, 85, 1, 3, 6, 4, 2<, 85, 1, 3, 4, 6, 2<, 85, 1, 3, 4, 2, 6<,85, 6, 1, 3, 2, 4<, 85, 1, 6, 3, 2, 4<, 85, 1, 3, 6, 2, 4<, 85, 1, 3, 2, 6, 4<,85, 1, 3, 2, 4, 6<, 81, 5, 6, 3, 4, 2<, 81, 5, 3, 6, 4, 2<, 81, 5, 3, 4, 6, 2<,81, 5, 3, 4, 2, 6<, 81, 5, 6, 3, 2, 4<, 81, 5, 3, 6, 2, 4<, 81, 5, 3, 2, 6, 4<, 81, 5, 3, 2, 4, 6<,81, 3, 2, 5, 6, 4<, 81, 3, 2, 5, 4, 6<, 81, 3, 5, 6, 4, 2<, 81, 3, 5, 4, 6, 2<,81, 3, 5, 4, 2, 6<, 81, 3, 5, 6, 2, 4<, 81, 3, 5, 2, 6, 4<, 81, 3, 5, 2, 4, 6<<

Building poset weaks6 ...

Done

True

Building Subposet interval6 ...

Building poset interval6 ...

Done

768

Build@WeakS@5D, weaks5DMaximalChainsDown@weaks5D �� Last

Building poset weaks5 ...

Done

768

11. Case Study: 2-Rowed Standard Young TableauxThis example illustrates an interesting poset whose elements correspond to 2-rowed standard tableaux. The ordering isdefined by reading each tableau from left to right, top to bottom (the standard reading order), and considering thesepermutations as a subposet of the right weak order.

We illustrate this construction with tableaux of shape Λ = {4,3}.

22 posets300-doc2.nb

Page 23: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

st43 = STableaux@84, 3<D;Map@Grid, st43Dperms43 = Map@Flatten, st43D

:1 2 3 4

5 6 7,

1 2 3 5

4 6 7,

1 2 3 6

4 5 7,

1 2 3 7

4 5 6,

1 2 4 5

3 6 7,

1 2 4 6

3 5 7,

1 2 4 7

3 5 6,

1 2 5 6

3 4 7,

1 2 5 7

3 4 6,

1 3 4 5

2 6 7,

1 3 4 6

2 5 7,

1 3 4 7

2 5 6,

1 3 5 6

2 4 7,

1 3 5 7

2 4 6>

881, 2, 3, 4, 5, 6, 7<, 81, 2, 3, 5, 4, 6, 7<, 81, 2, 3, 6, 4, 5, 7<,81, 2, 3, 7, 4, 5, 6<, 81, 2, 4, 5, 3, 6, 7<, 81, 2, 4, 6, 3, 5, 7<,81, 2, 4, 7, 3, 5, 6<, 81, 2, 5, 6, 3, 4, 7<, 81, 2, 5, 7, 3, 4, 6<, 81, 3, 4, 5, 2, 6, 7<,81, 3, 4, 6, 2, 5, 7<, 81, 3, 4, 7, 2, 5, 6<, 81, 3, 5, 6, 2, 4, 7<, 81, 3, 5, 7, 2, 4, 6<<

Build@RWeakS@7D, ws7Dind43 = LocateSet@ws7, perms43DBuildSubPoset@ws7, ind43, poset43DDiagram@poset43D

Building poset ws7 ...

Done

81, 5, 22, 23, 67, 68, 71, 161, 163, 164, 326, 327, 330, 583<

Building Subposet poset43 ...

Building poset poset43 ...

Done

Next, we' ll illustrate some complicated manipulation of labels. At this point P[poset43] contains a list the permuta-tions that were used to define the sub-order of RWeakS[7], and these are also mirrored in Labels@poset43D@@1DD.

P@poset43D

881, 2, 3, 4, 5, 6, 7<, 81, 2, 3, 5, 4, 6, 7<, 81, 2, 4, 5, 3, 6, 7<,81, 2, 3, 6, 4, 5, 7<, 81, 3, 4, 5, 2, 6, 7<, 81, 2, 4, 6, 3, 5, 7<,81, 2, 3, 7, 4, 5, 6<, 81, 3, 4, 6, 2, 5, 7<, 81, 2, 5, 6, 3, 4, 7<, 81, 2, 4, 7, 3, 5, 6<,81, 3, 5, 6, 2, 4, 7<, 81, 3, 4, 7, 2, 5, 6<, 81, 2, 5, 7, 3, 4, 6<, 81, 3, 5, 7, 2, 4, 6<<

It will be convenient to access these in their original tableau form, so we will redefine Labels[poset43][[1]] astableaux.

posets300-doc2.nb 23

Page 24: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

ChangeLabel@poset43, Tabify@ð, 84, 3<D &, 1DLabels@poset43D@@1DD

8881, 2, 3, 4<, 85, 6, 7<<, 881, 2, 3, 5<, 84, 6, 7<<,881, 2, 4, 5<, 83, 6, 7<<, 881, 2, 3, 6<, 84, 5, 7<<, 881, 3, 4, 5<, 82, 6, 7<<,881, 2, 4, 6<, 83, 5, 7<<, 881, 2, 3, 7<, 84, 5, 6<<, 881, 3, 4, 6<, 82, 5, 7<<,881, 2, 5, 6<, 83, 4, 7<<, 881, 2, 4, 7<, 83, 5, 6<<, 881, 3, 5, 6<, 82, 4, 7<<,881, 3, 4, 7<, 82, 5, 6<<, 881, 2, 5, 7<, 83, 4, 6<<, 881, 3, 5, 7<, 82, 4, 6<<<

We would also like to display these tableaux in compact form, so we' ll redefine Labels[poset43][[2]] as actualtableaux.

ChangeLabel@poset43, P@poset43D, 2DChangeLabel@poset43, Tabify@ð, 84, 3<D &, 2DChangeLabel@poset43, Grid, 2DLabels@poset43D@@2DD

:1 2 3 4

5 6 7,

1 2 3 5

4 6 7,

1 2 4 5

3 6 7,

1 2 3 6

4 5 7,

1 3 4 5

2 6 7,

1 2 4 6

3 5 7,

1 2 3 7

4 5 6,

1 3 4 6

2 5 7,

1 2 5 6

3 4 7,

1 2 4 7

3 5 6,

1 3 5 6

2 4 7,

1 3 4 7

2 5 6,

1 2 5 7

3 4 6,

1 3 5 7

2 4 6>

Diagram@poset43, Manipulate ® True, BackGround2 ® YellowD

Save All

Load All

Reset All

Shifts and Stretches Special

24 posets300-doc2.nb

Page 25: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Diagram@poset43, ShowLabels ® TrueD

1 2 3 4

5 6 7

1 2 3 5

4 6 7

1 2 4 5

3 6 7

1 2 3 6

4 5 7

1 3 4 5

2 6 7

1 2 4 6

3 5 7

1 2 3 7

4 5 6

1 3 4 6

2 5 7

1 2 5 6

3 4 7

1 2 4 7

3 5 6

1 3 5 6

2 4 7

1 3 4 7

2 5 6

1 2 5 7

3 4 6

1 3 5 7

2 4 6

Next we’ll separate the tableaux into two classes, according to whether the largest number is in the first row or thesecond, and display those in the first class as "special" points.

tabs = Labels@poset43D@@1DDfirstrow = Select@tabs, MemberQ@ð@@1DD, 7D &Dfirstpos = Table@Position@tabs, firstrow@@jDDD, 8j, Length@firstrowD<D �� Flatten

8881, 2, 3, 4<, 85, 6, 7<<, 881, 2, 3, 5<, 84, 6, 7<<,881, 2, 4, 5<, 83, 6, 7<<, 881, 2, 3, 6<, 84, 5, 7<<, 881, 3, 4, 5<, 82, 6, 7<<,881, 2, 4, 6<, 83, 5, 7<<, 881, 2, 3, 7<, 84, 5, 6<<, 881, 3, 4, 6<, 82, 5, 7<<,881, 2, 5, 6<, 83, 4, 7<<, 881, 2, 4, 7<, 83, 5, 6<<, 881, 3, 5, 6<, 82, 4, 7<<,881, 3, 4, 7<, 82, 5, 6<<, 881, 2, 5, 7<, 83, 4, 6<<, 881, 3, 5, 7<, 82, 4, 6<<<

8881, 2, 3, 7<, 84, 5, 6<<, 881, 2, 4, 7<, 83, 5, 6<<,881, 3, 4, 7<, 82, 5, 6<<, 881, 2, 5, 7<, 83, 4, 6<<, 881, 3, 5, 7<, 82, 4, 6<<<

87, 10, 12, 13, 14<

Diagram@poset43, firstpos, Manipulate ® TrueD

posets300-doc2.nb 25

Page 26: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Stretch

Shift

Zoom

Reset Save Load

Shifts and Stretches Special Points Points and Lines Label Commands Save

26 posets300-doc2.nb

Page 27: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Diagram@poset43, firstpos, ShowLabels ® 2D

1 2 3 4

5 6 7

1 2 3 5

4 6 7

1 2 4 5

3 6 7

1 2 3 6

4 5 7

1 3 4 5

2 6 7

1 2 4 6

3 5 7

1 2 3 7

4 5 6

1 3 4 6

2 5 7

1 2 5 6

3 4 7

1 2 4 7

3 5 6

1 3 5 6

2 4 7

1 3 4 7

2 5 6

1 2 5 7

3 4 6

1 3 5 7

2 4 6

The selected elements form an interval subposet :

IntervalQ@poset43, firstposD

True

It is interesting that 2-row tableaux posets are always distributive lattices.

DistributiveLatticeQ@poset43D

True

Also, the ordering on tableaux is identical to that induced by the strong order on permutations.

Build@StrongS@7D, ss7Dind43s = LocateSet@ss7, perms43DBuildSubPoset@ss7, ind43s, sposet43D

Building poset ss7 ...

Done

81, 5, 20, 23, 54, 66, 71, 144, 159, 164, 306, 311, 330, 569<

Building Subposet sposet43 ...

Building poset sposet43 ...

Done

posets300-doc2.nb 27

Page 28: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Diagram@sposet43D

IsomorphicQ@poset43, sposet43DP@poset43D == P@sposet43DCoverRelations@poset43D � CoverRelations@sposet43D

True

True

True

Neither of the last two stated properties is true for posets constructed using tableaux with more than two rows.

Example :

st321 = STableaux@83, 2, 1<D;Map@Grid, st321Dperms321 = Map@Flatten, st321D;

:

1 2 3

4 5

6

,1 2 3

4 6

5

,1 2 4

3 5

6

,1 2 4

3 6

5

,1 2 5

3 4

6

,1 2 6

3 4

5

,1 2 5

3 6

4

,1 2 6

3 5

4

,

1 3 4

2 5

6

,1 3 4

2 6

5

,1 3 5

2 4

6

,1 3 6

2 4

5

,1 3 5

2 6

4

,1 3 6

2 5

4

,1 4 5

2 6

3

,1 4 6

2 5

3

>

28 posets300-doc2.nb

Page 29: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@RWeakS@6D, ws6Dind321 = LocateSet@ws6, perms321D;BuildSubPoset@ws6, ind321, poset321DDiagram@poset321D

Building poset ws6 ...

Done

Building Subposet poset321 ...

Building poset poset321 ...

Done

DistributiveLatticeQ@poset321D

False

posets300-doc2.nb 29

Page 30: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@StrongS@6D, ss6Dind321s = LocateSet@ss6, perms321D;BuildSubPoset@ss6, ind321s, sposet321DDiagram@sposet321D

Building poset ss6 ...

Done

Building Subposet sposet321 ...

Building poset sposet321 ...

Done

IsomorphicQ@poset321, sposet321D

Different number of CoverRelations.

False

12. “Rowmotion”We illustrate an interesting map on the ideals of a poset that has been studied by various people (Brouwer-Schriver,Cameron-Fon Der Flass, Panyushev, Armstrong-Stump-Thomas, Striker-Williams, Roby-Propp).

One defines a bijective map T: J[P] � J[P] on ideals of P, as follows: if I is an ideal, then T[I] is the ideal generatedby the minimal elements of the complement of P.

The orbit structure of T has proved to be of great interest. For example, Propp and Roby have shown that, if P is aproduct of chains, then the average size of an ideal is independent of the orbit. We illustrate their result with the posetChain[3]× Chain[4].

T@name_, ideal_D :=

OrderIdeal@name, MinElements@name, Complement@Range@Card@nameDD, idealDDD

Build@CP@Chain@3D, Chain@4DD, cp34DDiagram@cp34, ShowLabels ® 2D

30 posets300-doc2.nb

Page 31: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Building poset cp34 ...

Done

1

2 3

4 5 6

7 8 9

10 11

12

T@cp34, 81, 2, 3, 4, 6<D

81, 2, 3, 4, 5, 7<

orbit@name_, ideal_D := Module@8orb = 8ideal<, next<,next = T@name, idealD;While@next ¹ ideal, orb = Append@orb, nextD; next = T@name, nextDD;orb

D

orb12346 = orbit@cp34, 81, 2, 3, 4, 6<DApply@Plus, Map@Length, %DD � Length@%D

881, 2, 3, 4, 6<, 81, 2, 3, 4, 5, 7<, 81, 2, 3, 4, 5, 6, 8<,81, 2, 3, 4, 5, 6, 7, 9<, 81, 2, 3, 4, 5, 8<, 81, 2, 3, 4, 6, 7<, 81, 2, 3, 5<<

6

orb1 = orbit@cp34, 81<DApply@Plus, Map@Length, %DD � Length@%D

881<, 81, 2, 3<, 81, 2, 3, 4, 5, 6<, 81, 2, 3, 4, 5, 6, 7, 8, 9<,81, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11<, 81, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12<, 8<<

6

orb12 = orbit@cp34, 81, 2<DApply@Plus, Map@Length, %DD � Length@%D

881, 2<, 81, 2, 3, 4<, 81, 2, 3, 4, 5, 6, 7<, 81, 2, 3, 4, 5, 6, 8, 9<,81, 2, 3, 4, 5, 6, 7, 8, 9, 11<, 81, 2, 3, 4, 5, 7, 8, 10<, 81, 3, 6<<

6

orb13 = orbit@cp34, 81, 3<DApply@Plus, Map@Length, %DD � Length@%D

881, 3<, 81, 2, 3, 6<, 81, 2, 3, 4, 5<, 81, 2, 3, 4, 5, 6, 7, 8<,81, 2, 3, 4, 5, 6, 7, 8, 9, 10<, 81, 2, 3, 4, 5, 6, 8, 9, 11<, 81, 2, 4, 7<<

6

posets300-doc2.nb 31

Page 32: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

orb124 = orbit@cp34, 81, 2, 4<DApply@Plus, Map@Length, %DD � Length@%D

881, 2, 4<, 81, 2, 3, 4, 7<, 81, 2, 3, 5, 6<, 81, 2, 3, 4, 5, 6, 9<,81, 2, 3, 4, 5, 7, 8<, 81, 2, 3, 4, 5, 6, 7, 8, 10<, 81, 2, 3, 5, 6, 9<<

6

Check to see that we have all of the orbits :

Join@orb1, orb12, orb13, orb124, orb12346D �� Sort% � HOrderIdeals@cp34D �� SortL

88<, 81<, 81, 2<, 81, 3<, 81, 2, 3<, 81, 2, 4<, 81, 3, 6<, 81, 2, 3, 4<, 81, 2, 3, 5<,81, 2, 3, 6<, 81, 2, 4, 7<, 81, 2, 3, 4, 5<, 81, 2, 3, 4, 6<, 81, 2, 3, 4, 7<, 81, 2, 3, 5, 6<,81, 2, 3, 4, 5, 6<, 81, 2, 3, 4, 5, 7<, 81, 2, 3, 4, 5, 8<, 81, 2, 3, 4, 6, 7<,81, 2, 3, 5, 6, 9<, 81, 2, 3, 4, 5, 6, 7<, 81, 2, 3, 4, 5, 6, 8<, 81, 2, 3, 4, 5, 6, 9<,81, 2, 3, 4, 5, 7, 8<, 81, 2, 3, 4, 5, 6, 7, 8<, 81, 2, 3, 4, 5, 6, 7, 9<, 81, 2, 3, 4, 5, 6, 8, 9<,81, 2, 3, 4, 5, 7, 8, 10<, 81, 2, 3, 4, 5, 6, 7, 8, 9<, 81, 2, 3, 4, 5, 6, 7, 8, 10<,81, 2, 3, 4, 5, 6, 8, 9, 11<, 81, 2, 3, 4, 5, 6, 7, 8, 9, 10<, 81, 2, 3, 4, 5, 6, 7, 8, 9, 11<,81, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11<, 81, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12<<

True

Here' s a larger example, with animation.

Build@CP@Chain@7D, Chain@11DD, cp711DDiagram@cp711, ShowLabels ® 2Dorb = orbit@cp711, OrderIdeal@cp711, 817, 29<DD;Apply@Plus, Map@Length, %DD � Length@%DManipulate@Diagram@cp711, MaxElements@cp711, orb@@kDDDD, 8k, 1, Length@orbD, 1<D

Building poset cp711 ...

Done

1

2 3

4 5 6

7 8 9 10

11 12 13 14 15

16 17 18 19 20 21

22 23 24 25 26 27 28

29 30 31 32 33 34 35

36 37 38 39 40 41 42

43 44 45 46 47 48 49

50 51 52 53 54 55 56

57 58 59 60 61 62

63 64 65 66 67

68 69 70 71

72 73 74

75 76

77

77

2

32 posets300-doc2.nb

Page 33: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

13. The Complete RepertoireWe conclude by taking a very simple poset (P =[ZigZag[4]) and applying almost every command to either P or J(P).

posets300-doc2.nb 33

Page 34: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Build@ZigZag@4D, zz4DBuild@JofP@zz4D, jofzz4D

Building poset zz4 ...

Done

Building poset jofzz4 ...

Done

P@jofzz4DPGraded@jofzz4D

88<, 83<, 84<, 81, 3<, 83, 4<, 81, 3, 4<, 82, 3, 4<, 81, 2, 3, 4<<

888<<, 883<, 84<<, 881, 3<, 83, 4<<, 881, 3, 4<, 82, 3, 4<<, 881, 2, 3, 4<<<

RankedQ@jofzz4DRank@jofzz4DNK@jofzz4DRGF@jofzz4D

True

80, 1, 1, 2, 2, 3, 3, 4<

81, 2, 2, 2, 1<

1 + 2 q + 2 q2 + 2 q3 + q4

ChangeLabel@jofzz4, Compact, 1DDiagram@jofzz4, ShowLabels ® 81, 2<D

3 4

13 34

134 234

1234

1

2 3

4 5

6 7

8

SpecialPoints@jofzz4, MemberQ@ð, 1D &D

84, 6, 8<

34 posets300-doc2.nb

Page 35: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

points = MaxAntichain@jofzz4Dlinks = DilworthCover@jofzz4DDiagram@jofzz4, points, links, ShowLabels ® 81, 2<D

86, 7<

881, 2<, 82, 4<, 83, 5<, 84, 6<, 85, 7<, 87, 8<<

3 4

13 34

134 234

1234

1

2 3

4 5

6 7

8

Diagram@jofzz4, points, links, Manipulate ® TrueD;

Fuse@DilworthCover@jofzz4DD H*Combines links into chains *L

881, 2, 4, 6<, 83, 5, 7, 8<<

JoinSubLatticeQ@jofzz4, 82, 4, 5, 7<DMeetSubLatticeQ@jofzz4, 82, 4, 5, 7<D

False

True

indices = JoinSubLattice@jofzz4, 82, 4, 5, 7<DBuildSubPoset@jofzz4, indices, jsubDDiagram@jsub, Manipulate ® TrueD;

82, 4, 5, 6, 7, 8<

Building Subposet jsub ...

Building poset jsub ...

Done

Ups@jofzz4DDowns@jofzz4DStrictUps@jofzz4DStrictDowns@jofzz4D

881, 2, 3, 4, 5, 6, 7, 8<, 82, 4, 5, 6, 7, 8<,83, 5, 6, 7, 8<, 84, 6, 8<, 85, 6, 7, 8<, 86, 8<, 87, 8<, 88<<

881<, 81, 2<, 81, 3<, 81, 2, 4<, 81, 2, 3, 5<,81, 2, 3, 4, 5, 6<, 81, 2, 3, 5, 7<, 81, 2, 3, 4, 5, 6, 7, 8<<

882, 3, 4, 5, 6, 7, 8<, 84, 5, 6, 7, 8<, 85, 6, 7, 8<, 86, 8<, 86, 7, 8<, 88<, 88<, 8<<

88<, 81<, 81<, 81, 2<, 81, 2, 3<, 81, 2, 3, 4, 5<, 81, 2, 3, 5<, 81, 2, 3, 4, 5, 6, 7<<

posets300-doc2.nb 35

Page 36: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

CoverRelations@jofzz4DCovers@jofzz4DUpDegree@jofzz4DCoCovers@jofzz4DDownDegree@jofzz4D

881, 2<, 81, 3<, 82, 4<, 82, 5<, 83, 5<, 84, 6<, 85, 6<, 85, 7<, 86, 8<, 87, 8<<

882, 3<, 84, 5<, 85<, 86<, 86, 7<, 88<, 88<, 8<<

82, 2, 1, 1, 2, 1, 1, 0<

88<, 81<, 81<, 82<, 82, 3<, 84, 5<, 85<, 86, 7<<

80, 1, 1, 1, 2, 2, 1, 2<

OrderIdeals@jofzz4DMap@MaxElements@jofzz4, ðD &, %D

881, 2, 3, 4, 5, 6, 7, 8<, 81, 2, 3, 4, 5, 6, 7<,81, 2, 3, 4, 5, 7<, 81, 2, 3, 4, 5, 6<, 81, 2, 3, 5, 7<, 81, 2, 3, 4, 5<,81, 2, 3, 5<, 81, 2, 3, 4<, 81, 2, 4<, 81, 2, 3<, 81, 3<, 81, 2<, 81<, 8<<

888<, 86, 7<, 84, 7<, 86<, 87<, 84, 5<, 85<, 83, 4<, 84<, 82, 3<, 83<, 82<, 81<, 8<<

DualOrderIdeals@jofzz4DMap@MinElements@jofzz4, ðD &, %D

88<, 88<, 86, 8<, 87, 8<, 84, 6, 8<, 86, 7, 8<, 84, 6, 7, 8<,85, 6, 7, 8<, 83, 5, 6, 7, 8<, 84, 5, 6, 7, 8<, 82, 4, 5, 6, 7, 8<,83, 4, 5, 6, 7, 8<, 82, 3, 4, 5, 6, 7, 8<, 81, 2, 3, 4, 5, 6, 7, 8<<

88<, 88<, 86<, 87<, 84<, 86, 7<, 84, 7<, 85<, 83<, 84, 5<, 82<, 83, 4<, 82, 3<, 81<<

MatrixForm@ZetaP@jofzz4DDMatrixForm@Mu@jofzz4DD

1 1 1 1 1 1 1 1

0 1 0 1 1 1 1 1

0 0 1 0 1 1 1 1

0 0 0 1 0 1 0 1

0 0 0 0 1 1 1 1

0 0 0 0 0 1 0 1

0 0 0 0 0 0 1 1

0 0 0 0 0 0 0 1

1 -1 -1 0 1 0 0 0

0 1 0 -1 -1 1 0 0

0 0 1 0 -1 0 0 0

0 0 0 1 0 -1 0 0

0 0 0 0 1 -1 -1 1

0 0 0 0 0 1 0 -1

0 0 0 0 0 0 1 -1

0 0 0 0 0 0 0 1

ToRelation@ZetaP@jofzz4DD

881, 1<, 81, 2<, 81, 3<, 81, 4<, 81, 5<, 81, 6<, 81, 7<, 81, 8<, 82, 2<, 82, 4<,82, 5<, 82, 6<, 82, 7<, 82, 8<, 83, 3<, 83, 5<, 83, 6<, 83, 7<, 83, 8<, 84, 4<,84, 6<, 84, 8<, 85, 5<, 85, 6<, 85, 7<, 85, 8<, 86, 6<, 86, 8<, 87, 7<, 87, 8<, 88, 8<<

36 posets300-doc2.nb

Page 37: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

MaximalChainsUp@jofzz4DMaximalChainsDown@jofzz4DLinearExtensions@zz4DTopSortings@zz4D

85, 3, 2, 1, 2, 1, 1, 1<

81, 1, 1, 1, 2, 3, 2, 5<

883, 1, 4, 2<, 82, 1, 4, 3<, 82, 1, 3, 4<, 81, 2, 4, 3<, 81, 2, 3, 4<<

882, 4, 1, 3<, 82, 1, 4, 3<, 82, 1, 3, 4<, 81, 2, 4, 3<, 81, 2, 3, 4<<

ChainsBetweenGF@jofzz4, 1, Card@jofzz4DD

q + 6 q2 + 10 q3 + 5 q4

Together@ZetaPoly@jofzz4DDTogether@Omega@zz4, nDD

1

24I2 n + 7 n2 + 10 n3 + 5 n4M

1

24I2 n + 7 n2 + 10 n3 + 5 n4M

OmegaGF@zz4, qDOmegaBarGF@zz4, qD

q + 3 q2 + q3

H1 - qL5

q2 + 3 q3 + q4

H1 - qL5

G@zz4, qDGBar@zz4, qD

1 + q + q2 + q3 + q4

H1 - qL I1 - q2M I1 - q3M I1 - q4M

q2 + q3 + q4 + q5 + q6

H1 - qL I1 - q2M I1 - q3M I1 - q4M

posets300-doc2.nb 37

Page 38: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

LatticeQ@jofzz4DMatrixForm@LJoin@jofzz4DDMatrixForm@LMeet@jofzz4DD

True

1 2 3 4 5 6 7 8

2 2 5 4 5 6 7 8

3 5 3 6 5 6 7 8

4 4 6 4 6 6 8 8

5 5 5 6 5 6 7 8

6 6 6 6 6 6 8 8

7 7 7 8 7 8 7 8

8 8 8 8 8 8 8 8

1 1 1 1 1 1 1 1

1 2 1 2 2 2 2 2

1 1 3 1 3 3 3 3

1 2 1 4 2 4 2 4

1 2 3 2 5 5 5 5

1 2 3 4 5 6 5 6

1 2 3 2 5 5 7 7

1 2 3 4 5 6 7 8

Build@CP@jofzz4, Chain@4DD, biggerDDiagram@biggerD

Building poset bigger ...

Done

38 posets300-doc2.nb

Page 39: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

BuildSubPoset@bigger, JI@biggerD, joinirreduciblesDDiagram@joinirreduciblesD

Building Subposet joinirreducibles ...

Building poset joinirreducibles ...

Done

Diagram@bigger, JI@biggerD, JICoverRelations@biggerDD

posets300-doc2.nb 39

Page 40: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Diagram@bigger, MI@biggerD, MICoverRelations@biggerDD

MatrixForm@ZetaMI@biggerDD

1 0 0 0 1 1 0

0 1 0 1 0 0 1

0 0 1 0 1 0 0

0 0 0 1 0 0 1

0 0 0 0 1 0 0

0 0 0 0 0 1 0

0 0 0 0 0 0 1

40 posets300-doc2.nb

Page 41: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

BuildDual@jofzz4, jofzz4dualDDiagram@jofzz4dual, ShowLabels ® 1DDiagram@jofzz4dual, ShowLabels ® 2D

Building poset jofzz4dual ...

Done

81, 2, 3, 4<

82, 3, 4< 81, 3, 4<

83, 4< 81, 3<

84< 83<

8<

1

2 3

4 5

6 7

8

IsomorphicQ@jofzz4, jofzz4dualD

True

Zap@zz4DZap@jofzz4D

14. Catalog of Small Posets and LatticesAlong with the package itself, we have supplied two more files, allposets1-7.txt and alllattices1-9.txt. These containdescriptions of all non-isomorphic posets of size £ 7, and all non-isomorphic lattices of size £ 9. They were generatedusing John Stembridge's Maple package for posets, and then translated into Mathematica format.

posets300-doc2.nb 41

Page 42: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Along with the package itself, we have supplied two more files, allposets1-7.txt and alllattices1-9.txt. These containdescriptions of all non-isomorphic posets of size £ 7, and all non-isomorphic lattices of size £ 9. They were generatedusing John Stembridge's Maple package for posets, and then translated into Mathematica format.

This data can be accessed as follows. First be sure that the two files are in a directory that Mathematica searches wheninput is requested (for example, the AddOns/ExtraPackages folder in the PC version). Then, for example, execute

<< allposets1-7.txt;

The data is now recorded in a variable called AllPosets. For example, AllPosets[3] is a list of all posets of size 3.Each entry consists of a list of relations. Thus, to build the kth poset, one executes the command Build[{AllPoset-s[3][[k]],3}].AllPosets@3D

88<, 881, 2<<, 881, 3<, 82, 3<<, 881, 2<, 82, 3<<, 881, 2<, 81, 3<<<

For@k = 1, k £ 5, k++, Build@8AllPosets@3DPkT, 3<, sampleD; Diagram@sampleD �� PrintD

Building poset sample ...

Done

Building poset sample ...

Done

42 posets300-doc2.nb

Page 43: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Building poset sample ...

Done

Building poset sample ...

Done

posets300-doc2.nb 43

Page 44: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Building poset sample ...

Done

The command NumPosets assumes that allposets1-7 has been read, and returns the number of posets of each size. Forexample,

Table@NumPosets@nD, 8n, 1, 7<D

81, 2, 5, 16, 63, 318, 2045<

Exercise: check this sequence and the next one (lattices of size n, for 1 b n £ 9) by looking in Neil Sloane's book.

<< alllattices1-9.txt

Table@NumLattices@nD, 8n, 1, 9<D

81, 1, 1, 2, 5, 15, 53, 222, 1078<

We can build all the posets of a size n and test them for various properties. Beware that for large N this may consumea lot of memory. We illustrate by checking all of the posets with 4 elements to be sure there that no two are isomor-phic (output shortened to save space).

44 posets300-doc2.nb

Page 45: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

We can build all the posets of a size n and test them for various properties. Beware that for large N this may consumea lot of memory. We illustrate by checking all of the posets with 4 elements to be sure there that no two are isomor-phic (output shortened to save space).

For@k = 1, k £ 16, k++, Build@8AllPosets@4DPkT, 4<, test@kDDD

Building poset test@1D ...

Done

Building poset test@2D ...

Done

...

Building poset test@15D ...

Done

Building poset test@16D ...

Done

posets300-doc2.nb 45

Page 46: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

For@j = 1, j £ 16, j++, For@k = j + 1, k £ 16, k++, Print@"------------------------"D;Print@"Testing posets ", j, ", ", kD; If@IsomorphicQ@test@jD, test@kDD,

Print@"***** Posets ", j, " and ", k, " are isomorphic!"DD;DD

------------------------

------------------------Testing posets 1, 2Different number of CoverRelations.------------------------Testing posets 1, 3Different number of CoverRelations.------------------------Testing posets 1, 4Different number of CoverRelations.------------------------Testing posets 1, 5Different number of CoverRelations.------------------------...------------------------Testing posets 6, 9Different number of CoverRelations.------------------------Testing posets 6, 10UpDegree distribution is different.------------------------Testing posets 6, 11UpDegree distribution is different.------------------------...------------------------Testing posets 9, 16Different number of CoverRelations.------------------------Testing posets 10, 11Number of ones in Zeta matrix is different.------------------------Testing posets 10, 12DownDegree distribution is different.------------------------Testing posets 10, 13UpDegree distribution is different.------------------------Testing posets 10, 14UpDegree distribution is different.------------------------Testing posets 10, 15Different number of CoverRelations.------------------------...------------------------Testing posets 13, 15Different number of CoverRelations.------------------------Testing posets 13, 16UpDegree distribution is different.------------------------Testing posets 14, 15Different number of CoverRelations.------------------------Testing posets 14, 16UpDegree distribution is different.------------------------Testing posets 15, 16Different number of CoverRelations.

46 posets300-doc2.nb

Page 47: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

Appendix: List of All CommandsFor more information about a particular command, type

Information@"<command>", LongForm ® FalseD

For example:

Information@"DownDegree", LongForm ® FalseD

DownDegree@nameD@@xDD is the number of

elements covered by P@nameD@@xDD.

To see a list of all Poset commands containing a particular string, type

ListCommands@"string"D

or

Information@"Posets`*string*", LongForm ® TrueD

For example:

ListCommands@"Chain"D

Chain MaximalChainsDown

ChainsBetweenGF MaximalChainsUp

LongestChain ---

For a complete list of all commands known to Posets, type

ListCommands@D

AllTableaux MeetSubLattice

AMAJ MeetSubLatticeQ

Antichain MI

ASC MICoverRelations

Background1 MinElements

Background2 MSL

Build Mu

BuildDual NewLabel

BuildSubPoset NK

Card NonXP

Chain NumLattices

ChainsBetweenGF NumP

ChangeLabel NumPosets

CharPoly Omega

CleanRank OmegaBarCoCovers OmegaBarGF

Compact OmegaGF

ContractionLattice OrderIdeal

CoverRelations OrderIdealQ

Covers OrderIdeals

CP OrdinalSum

CProduct OSDES P

Diagram PGraded

DilworthCover PGradedIndices

DisjointSum PolyToGF

DistributiveLatticeQ PosetP

Div RandomP

DownDegree Rank

posets300-doc2.nb 47

Page 48: POSETS : A Mathematica Packageww3.haverford.edu/math/cgreene/posets/posets300-doc2.pdf · POSETS : A Mathematica Package PART 2: More Complicated Examples Curtis Greene, Eugenie Hunsicker,

DownDegree

Downs RankedQ

DS ResetLabel

DualOrderIdeal RGF

DualOrderIdealQ RWeakS

DualOrderIdeals SavedSettingsFerrers SaveOne

Fuse SetP

G Sets

GBar ShowLabels

GenFun Silent

GetIsomorphism SL

GFToPoly SortByRanksH SP

InfiniteProduct SpecialPoints

IntervalP SPM

IntervalQ STableaux

InversionCode StrictDowns

IsomorphicQ StrictUps

JI StrongRankedQ

JICoverRelations StrongS

JofP SubLattice

JoinL SubLatticeQ

JoinSubLattice Subwords

JoinSubLatticeQ Tabify

JSL TClosure

L TensorProduct

Labels ToMatrix

LatticeQ ToPermutation

LinearExtensions TopSort

ListCommands TopSortings

LJoin ToRelationLMeet UpDegree

LocateElement UpsLocateSet Ver

LongestChain WeakS

L$ YoungsLatticeMAJ Zap

MajP ZeroDiffs

MaxAntichain ZetaJI

MaxElements ZetaMI

MaximalChainsDown ZetaP

MaximalChainsUp ZetaPoly

MeetL ZigZag

For more information about each command, please consult the "usage" section of the package. This gives the precisesyntax for each command, and can even be printed out as a compact "user's manual", if desired.

48 posets300-doc2.nb