arXiv:2108.04302v1 [math.CO] 9 Aug 2021 hr pi either is op where n bandfo h nie ftevralsin variables the of indices the from obtained inserting h recurrence the r aee yteeeet of elements the by labeled are hi flength of chain hrfr,wa-reigcan r nmrtdb h sequ the by enumerated are chains weak-ordering Therefore, where lc ftepriinwhenever partition the of block i.I te od,spoeta ed o lo oe with nodes allow not do we that suppose words, other In tie. odrdBl ubr)1 numbers) Bell (ordered aibe.Every variables. A vr element Every o,spoeta ews oso h bv eeaigproces generating above the stop to wish we that suppose Now, ekodrn chain weak-ordering ETITDGNRTN RE O EKORDERINGS WEAK FOR TREES GENERATING RESTRICTED ij AILBRAE,JA .GL AI .KNP,ADMCALD. MICHAEL AND KENEPP, S. DAVID GIL, B. JUAN BIRMAJER, DANIEL y < x otesuyo ecn ttsiso eti ams’patte ‘almost’ certain of statistics descent of study the to certain a aibeit ahnd teeyse.And eoe efei leaf a becomes node A step. every at node each into variable evso eti etitdroe re.Ate forder of tree A trees. weak rooted of restricted enumeration certain the of consider leaves we partitions, ordered and Abstract. sasotu for shortcut a is x i or , 2 23 321 tgte iheither with (together tpigcondition stopping i x − ≤ w oiae ytesuyo atr viac ntecnetof context the in avoidance pattern of study the by Motivated x < 3 213 231 1 .Ti rcs eeae otdlbldte hs oe a nodes whose tree labeled rooted a generates process This 1. y 2 w WOC ∈ n eea odtoso ie3 oeo h ae consider cases the of Some 3. size of conditions several and ) x < r= elet We =. or WOC ∈ 21 f , 4 0 ntevariables the in x 3 = and 1 = , i 13 x < ( x n , 5 ( WOC a ercrieygnrtdsatn with starting generated recursively be can ) n 75 smt nti ae efcso odtoso ie2( 2 size of conditions on focus we paper this In met. is x x < 213 j orsod oa ree atto f[ of partition ordered an to corresponds ) i , and x 541 = < i WOC 1 1. 1 ( f x i x < op .Freape for example, For ). , n r= noapeiul osrce weak-ordering constructed previously a into =) or ij j 312 Introduction 4683 o example, For . = x represents 3 ( i x n 2 X i 1 =1 n , 123 eoetesto l ekodrn hisin chains weak-ordering all of the denote ) op →{{ ←→ x , 12 47293 w 1 1  hr h numbers the where , 2 · · · x , . . . , n i 12  op , 3 f 545835 x n x 2 − i } i n n i = , n 1 13 312 , { sa xrsino h form the of expression an is naodn permutations. rn-avoiding for sgnrtdb netn new a inserting by generated is 4 x n , j , . . . , 5 odrn hisotie as obtained chains -ordering . ne( ence ,w e h tree the get we 3, = n } x hrafter ther , ≥ i 3 123 132 2 { 1 = 4 007] hc satisfy which A000670], [4, 1 } f 12 . , x n { j sso sw aea have we as soon as s i ) 3 n o some for }} and ∈ n N . tp rwhen or steps permutations fFbn numbers Fubini of dhr lead here ed j 123 n r ntesame the in are WEINER = ] x j > i x 1 = n then and , { y 1 , level t n , . . . , ohave to } i 2 BIRMAJER,GIL,KENEPP,ANDWEINER descendants. Then, the above tree would take the form

1 (1.1)

21 12 12

321 231 231 213 213 312 132 132 123 123 with only 11 leaves instead of 13. We call (1.1) a restricted generating tree of weak-ordering chains subject to the stopping condition xi = xj. The goal of this paper is to study the enumeration of weak-ordering chains subject to various stopping conditions. This is equivalent to counting the number of leaves of the corresponding restricted generating subtree of (n). Our strategy relies on separating the leaves thatWOC avoid the stopping condition, call them active leaves, from the leaves that contain the stopping condition, call them inactive leaves. Throughout this paper, we will consistently use an to denote the total number of active leaves after n steps, and bn for the total number of inactive leaves. We also let ∆n be the number of leaves that become inactive at level n, thus ∆1 = 0 and ∆n = bn bn−1 for n 2. Note that the meaning of active/inactive depends on the given stopping− condition. ≥ For example, for the stopping condition xi = xj, we have

a1 = 1, b1 = 0, a2 = 2, b2 = 1, a3 = 6, b3 = 5. The five inactive leaves at step 3 are the ones labelled by 12, 231, 213, 132, and 123. This manuscript is organized as follows. In Section 2, we start with the simpler case when the stopping condition involves only one operation (=, <, or ). In Sections 3–5, ≤ we consider stopping conditions of the form xi1 op xi2 op xi3 where op is either < or . Our approach leads to descent statistics of certain ‘almost’ pattern-avoiding permutations.≤ Finally, in Section 6, we consider the k-equal case and other stopping conditions with restrictions in both the order and the sizes of the parts in the partitions corresponding to the weak-ordering chains.

2. Trees with stopping condition of size 2 In this section, we will discuss the enumeration of weak-ordering chains subject to the stopping conditions xi = xj, xi

In conclusion, wn = an + bn = 2n! 1.  − Theorem 2.2 (Stopping condition xi < xj). If wn is the number of weak-ordering chains n−1 in (n), subject to the stopping condition xi

Proof. The only active chain at level n is xn < xn− < < x , so an = 1. Moreover, 1 · · · 1 the active chain xj− < < x generates 2(j 1) inactive leaves at level j, obtained 1 · · · 1 − by replacing xk with either xk < xj or xk = xj for k 1,...,j 1 . Therefore, bn = n ∈ {2 − } 2(j 1) = n(n 1), which implies wn = an + bn = n n + 1.  j=1 − − − P 3. Stopping condition xi1

x σ(i + 1) in V WOC the permutation σ could come from xσ(i)

Our connection between weak-ordering chains and permutations makes it clear that a leaf is inactive if the associated permutation has a 123 pattern. Thus, in order to count the elements that become inactive at level n, we need to enumerate the following set: For n> 3 and 1 d n 3, define ≤ ≤ − d ′ (123) = σ Sn σ has a 123 pattern, d descents, and σ Sn− (123) , (3.4) Gn { ∈ | ∈ 1 } ′ where σ Sn−1 denotes the permutation obtained from σ Sn by removing n. Clearly,∈ d(123) = d(123) = ∅, and for n = 3, only 123∈ has the desired property. G1 G2 d Proposition 3.5. If gn,d = (123) , then g (0) = 1, and for n> 3 and 1 d n 3, |Gn | 3 ≤ ≤ − gn,d = (d + 1)en− ,d + (n d)en− ,d− en,d, (3.6) 1 − 1 1 − ∞ n−3 d 3 n d where en,d = S (123) . Therefore, G(x,y)= x + gn,d x y satisfies | n | nP=4 dP=1 2 2 G(x,y)= x + (x 1)E(x,y)+ x yEx(x,y) + (xy xy )Ey(x,y). − − RESTRICTEDGENERATINGTREESFORWEAKORDERINGS 5 where Ex, Ey = E, and E(x,y) is the function in (3.2). In other words, h i ∇ 1 4xy(1 + x xy) + 2x2y (1 2xy) 1 4xy(1 + x xy) G(x,y)= − − − − − − . 2xy2 1 4xy(1 + x pxy) − − d p Proof. For n > 3, every σ in n(123) can be generated by inserting n into a permutation ′ d d−1 G σ Sn−1(123) Sn−1(123) at a position where it creates a 123 pattern. ∈ ′ ∪ If σ has d descents, then n may only be inserted at a descent or at the last position of ′ ′ d d σ . Thus, each σ Sn−1(123) generates d + 1 permutations in Sn. On the other hand, if σ′ has d 1 descents,∈ then n will have to be inserted at one of the n d available ascents ′ − ′ d−1 − of σ in order to create an extra descent. Therefore, each σ Sn−1(123) generates n d d ∈ − permutations in Sn. Together, the above insertion procedures generate (d + 1)en− ,d + (n d)en− ,d− permu- 1 − 1 1 tations of size n with d descents. However, since the elements of d(123) are required to Gn have a 123 pattern, we need to remove the en,d permutations that avoid 123. The first statement about G(x,y) then follows from (3.6) by means of routine algebraic manipulations. The closed form statement is just a consequence of (3.2). 

Theorem 3.7. If wn is the number of weak-ordering chains in (n), subject to the WOC stopping condition xi1

n−1 n j−3 d d wn = 2 en,d + 2 gj,d. Xd=0 Xj=3 Xd=0

The sequence (wn)n∈N starts with 1, 3, 13, 69, 401, 2433, 15121, 95441, 609025, 3918273,..., ∞ n and W (x)= wnx satisfies nP=1 x + x√1 8x + 8x2 W (x)= − . 2(1 x)√1 8x + 8x2 − − n−1 d Proof. By (3.1), the number of actives leaves after n steps is an = 2 en,d, and their d=0 generating function A(x) is given by P (1 2x)2 √1 8x + 8x2 A(x)= E(x, 2) = − − − . 8x(1 x) − On the other hand, a weak-ordering chain that becomes inactive at level j 3 leads ′ ≥ to a σ Sj that have a 123 pattern, and such that σ Sj− (123). The number of such ∈ ∈ 1 permutations having d descents is given by gj,d in (3.6). Now, since a descent σ(i) >σ(i+1) d in σ comes from either xσ(i)

n The formula for wn = an + bn follows from the fact that bn = ∆j. j=3 ∞ Pn Finally, using Proposition 3.5 we can write B(x)= n=1 bnx as G(x, 2) 1 8x + 12x2 (1 P4x)√1 8x + 8x2 B(x)= = − − − − , 1 x 8x(1 x)√1 8x + 8x2 − − − and the claimed expression for W (x) is obtained by combining A(x)+ B(x). 

4. Stopping condition xi1 xi2 xi3 with i < i < i ≤ ≤ 1 2 3 This case is more restrictive than the previous one. For example, the chains

x1 = x2

x5 = x7

312 312 231 231

213 213 132 132 123

Finally, we take the complement of σP (keeping the underlines) and construct the weak- c ordering chain wP associated with P by replacing ij in σP with xi

x1

x2

w : x5 = x7

To this weak-ordering chain we associate the underlined permutation σw = 57 26 413 with c complement σw = 31 62 475. Finally, constructing the Dyck path corresponding to 3162475 and making orange the NEE steps above underlined numbers, we arrive at

which is a colored Dyck path of the desired form. Note that a permutation σ on [n] with d descents gives rise to 2d chains. Since the reverse σr is a 123-avoiding permutation with d ascents (hence n 1 d descents), we conclude that the number of active leaves is given by − − n−1 n−1 d n−1−d an = 2 en,n−1−d = 2 en,d, (4.2) Xd=0 Xd=0 d 1 1 where en,d = Sn(123) . Thus A(x) = 2 E(2x, 2 ) with E(x,y) from (3.2), which simplifies to the claimed| expression.| 

Theorem 4.3. If wn is the number of weak-ordering chains in (n), subject to the WOC stopping condition xi1 xi2 xi3 with i < i < i , then ≤ ≤ 1 2 3 n−1 n j−1 n−1−d j−1−d wn = 2 en,d + 2 gj,d. Xd=0 Xj=3 Xd=2 8 BIRMAJER,GIL,KENEPP,ANDWEINER

The sequence (wn)n∈N starts with 1, 3, 13, 59, 269, 1227, 5613, 25771, 118765, 549227,..., and ∞ n the generating function W (x)= wnx satisfies nP=1 x 1 2x 2x2 1+ W (x)= + − − . 1 x2 (1 x2)√1 4x 4x2 − − − − Proof. We already know that the number of active chains is given by (4.2), so we only need to focus on the inactive ones. Note that inactive chains at level j come from permutations in Sj that contain the pattern 321 and such that their reduced permutation (obtained by removing j) belongs to Sj−1(321). The set of such permutations having exactly d descents j−1−d is in bijection with j (123) (as defined in (3.4)), and therefore, each such permutation d G induces 2 gj,j−1−d inactive weak-ordering chains. Hence

j−3 j−1 d j−1−d ∆j = bj bj− = 2 gj,j− −d = 2 gj,d, − 1 1 Xd=0 Xd=2

n n j−1 j−1−d which implies bn = ∆j = 2 gj,d. We can then use Proposition 3.5 to write jP=3 jP=3 dP=2 its generating function B(x) as

1 G(2x, 1 ) 1 4x (1 2x)√1 4x 4x2 B(x)= 2 2 = − − − − − . 1 x 2x(1 x)√1 4x 4x2 − − − − Combined with Prop. 4.1, this gives a closed form for 1 + W (x)=1+ A(x)+ B(x). 

5. Stopping condition xi1 xi2

Proof. We will use the same map between 321-avoiding permutations and Dyck paths used in Proposition 4.1 to provide a bijection between active weak-ordering chains of length n and Dyck paths from (0, 0) to (n,n) in which valleys may be marked. It is easy to check that these paths are counted by the little Schr¨oder numbers. For every possibly marked Dyck path P , we plot the corresponding 321-avoiding permu- tation σP and underline adjacent elements of σP if there is a marked valley between their plots. For example, for n = 3 there are 11 such elements:

312 132 132 213 213 RESTRICTEDGENERATINGTREESFORWEAKORDERINGS 9

132 132 123 123 123 123 Note that, by construction, a 312 pattern can never occur. We then take the reverse of σP (keeping the underlines) and construct the weak-ordering chain wP associated with P by r replacing ij in σP with xi

x2 3 and 1 d n 2, define ≤ ≤ − d ′ (213) = σ Sn σ has a 213 pattern, d descents, and σ Sn− (213) , Gn { ∈ | ∈ 1 } ′ d where σ Sn− is the reduced permutation obtained by removing n. Clearly, (213) and ∈ 1 G1 d(213) are empty, and d(213) = 213 . G2 G3 { } d Proposition 5.2. If ℓn,d = (213) , then ℓ , = 1, and for n> 3 and 1 d n 2, |Gn | 3 1 ≤ ≤ − ℓn,d = (d + 1)Nn− ,d + (n d)Nn− ,d− Nn,d. 1 − 1 1 − ∞ n−2 3 n d Moreover, L(x,y)= x + ℓn,d x y has the closed form nP=4 dP=1 x(y + 1) 2(y2 y)x4 1 (1 xy)2 + x2 2x L(x,y)= − − − + − − 2xy 2xy 1 2x(y +1)+ x2(y 1)2 − − p Proof. The formula for ℓn,d follows from an argument similar to the one made for the proof of (3.6). There are (d+1)Nn−1,d permutations of size n with d descents that can be created by d inserting n (at a descent or at the end) into the Nn−1,d elements of Sn−1(213). In addition, d−1 there are (n d)Nn− ,d− such permutations that can be generated from S (213). To get − 1 1 n−1 the total number of elements in d(213), we combine the above permutations and remove Gn the ones that avoid 213 (counted by Nn,d). 10 BIRMAJER,GIL,KENEPP,ANDWEINER

As a consequence, if N(x,y) is the generating function for the Narayana numbers, then 3 2 2 L(x,y)= x + (1 y)x + (x 1)N(x,y)+ x yNx(x,y) + (xy xy )Ny(x,y). − − − Finally, using the known formula 1 x(y + 1) 1 2x(y +1)+ x2(y 1)2 N(x,y)= − − − − , p 2xy one derives the closed form of L(x,y). 

Theorem 5.3. If wn is the number of weak-ordering chains in (n), subject to the WOC stopping condition xi1 xi2

The sequence (wn)n∈N starts with 1, 3, 13, 65, 341, 1827, 9913, 54273, 299209, 1658723,..., ∞ n and the function W (x)= n=1 wnx satisfies P (1 x)2 (1 3x)√1 6x + x2 W (x)= − − − − . 4(1 x)√1 6x + x2 − − Proof. The first summation in the claimed formula for wn represents the number of active weak-ordering chains (Proposition 5.1). Thus their generating function can be written as 1 3x √1 6x + x2 A(x)= N(x, 2) = − − − . 4x In order to derive a formula for the number ∆j of inactive chains that become inactive at level j, we will provide a bijection φ between these chains and the set of permutations in j−2 d d=1 j (213) where descents may be underlined. That implies ∆1 =∆2 = 0, and for j 3, Gj−2 ≥ S d ∆j = 2 ℓj,d. As a consequence, the total number of inactive chains will be given by dP=1 n n j−2 d b = b = 0, and bn = ∆j = 2 ℓj,d for n 3, 1 2 ≥ Xj=3 Xj=3 Xd=1 with generating function x3 + L(x, 2) 3x 1 5x 1 B(x)= = − − . 1 x 4x(1 x) − 4x√1 6x + x2 − − − Combining the active and inactive chains, we get the formulas for wn and W (x). We finish the proof by describing the bijection φ. Let w (n) be a chain that ∈ WOC becomes inactive at level n, and let σw be the permutation corresponding to w obtained from the indices of the variables, with the usual convention that indices of equal elements are underlined and listed in decreasing order. Observe that for w to be inactive, the entry n in σw must be part of either a 123 pattern or a 213 pattern, while the reduced permutation ′ σw must avoid both patterns. If n 1 and n are not adjacent, we proceed as follows: ′ − ′ Map σw to the 213-avoiding permutation τw having the same right-to-left maxima, • keeping the underlines in the same positions. RESTRICTED GENERATING TREES FOR WEAK ORDERINGS 11

If i is the position of n in σw, we let φ(w) be the permutation obtained by inserting • ′ n into τw at position i. Since n 1 must be left of n in σw, the permutation φ(w) will always contain a 213-pattern. − For example, for the chain x6

σw = 687429513 σ′ = 68742513 τ ′ = 68714523 w 7→ w φ(w) = 687149523.

If n 1 and n are adjacent in σw, then it must be of the form σ0(n 1)n , where σ0 is a decreasing− permutation of size at least 1 with no underlines. In this− case,∗ we create the permutationσ ˜w = (n 1)σ n and proceed as in the previous case. For example, for the − 0 ∗ chain x6

σw = 658974213 σ˜w = 865974213 7→ σ˜′ = 86574213 τ ′ = 85674123 w 7→ w φ(w) = 856974123.

Observe that if the original permutation σw starts with n 1, there must be either an ascent − or a 21 pattern left of n,soσ ˜w cannot create a duplicate. The above algorithm can be easily reversed, showing the invertibility of φ. 

6. Other stopping conditions

In this section, we generalize the stopping condition xi = xj to chains of arbitrary length. We also consider some conditions with restrictions in both the order and the sizes of the parts in the partitions corresponding to the weak-ordering chains.

The k-equal stopping condition. For the stopping condition xi1 = = xik with k> 1, active chains in the set (n) correspond to ordered partitions of [·n ·] · with parts of size WOC at most k 1. Thus, an (number of active leaves at level n) satisfies the recurrence − − k 1 n ai = fi for 1 i

Theorem 6.1. If wn is the number of weak-ordering chains in (n), subject to the WOC stopping condition xi1 = = xik with k > 1, then wi = fi for 1 i < k, where fi is the ith Fubini number, and for· · ·n k, ≤ ≥ k−1 n j−k n j 1 j k wn = an−i + − − aia − − , i  k 1  i  j k i Xi=1 Xj=k − Xi=0 where (an)n∈N is the sequence that counts the corresponding active chains.

For example, for k = 3, we have w1 = 1, w2 = 3, and n j−3 n j 1 j 3 wn = nan− + an− + − − aiaj− −i for n 3. 1 2 2  2   i  3 ≥ Xj=3 Xi=0 This sequence starts with 1, 3, 13, 73, 505, 4165, 39985, 438145,... .

Stopping condition xi1

∆n = n∆n− + (n 2)an− , for n 3. (6.2) 1 − 2 ≥ RESTRICTED GENERATING TREES FOR WEAK ORDERINGS 13

First observe that, given an active partition πa of [n 2], the partition obtained by adding − the block n 1,n to the end of πa is inactive. Moreover, πa can be used to create n 3 more inactive{ − partitions} as follows: Choose i such that 2 i n 2. Then, for every− ≤ ≤ − element j i of πa, replace j by j + 1 and place the block i, n at the end of the modified ≥ { } partition. This gives (n 2)an−2 inactive partitions of [n] having a last block of size 2. The remaining inactive− partitions must have a last block of size 1 or larger than 2. They can be generated from the ∆n− inactive partitions at level n 1 by the following process: 1 − For every inactive partition π of [n 1] and i 1,...,n 1 , replace j by j + 1 • for every j i and add the − i to the∈ end { of the− modified} partition. This ≥ { } gives (n 1)∆n− inactive partitions of [n]. − 1 Alternatively, replacing j by j +1 in π and adding 1 to the last block, yields ∆n−1 • additional inactive partitions of [n]. (n+1)! In conclusion, we arrive at the recurrence relation (6.2). Since an = 2 , we can solve (6.2) an obtain the explicit formula n n! k 2 ∆n = − , for n 3. 2 k ≥ Xk=3

Stopping condition xi1 xi2 = xi3 with i < i < i . As in the above case, we start by ≤ 1 2 3 discussing the actives chains. Once again, a1 = 1 and a2 = 3. If π = B ,B ,...,Bℓ is the partition corresponding to an active chain, we must have { 1 2 } Bℓ 2. This tells us that Bℓ is either a singleton ik or a block of the form 1, ik . All | |≤ { } { } other blocks must correspond to an active partition of k,...,n ik . We therefore have { } \ { } the recurrence relation (with a0 = a1 = 1)

an = nan− + (n 1)an− for n 2. 1 − 2 ≥ For the enumeration of the chains that become inactive at step n, the base cases are ∆ =∆ =0, and ∆ = 2 (namely x

(d) Finally, every active partition πa of [n 3] generates n 2 inactive partitions of [n] − − obtained by relabeling πa so that we can add the block 1,i,n with i 2,...,n 1 { } ∈ { − } to the end of it. There are (n 2)an− inactive partitions of this type. − 3 The relation (6.3) follows from the fact that (n 2)(an− + an− )= an− an− . − 2 3 1 − 2 References [1] M. Barnabei, F. Bonetti, and M. Silimbani, The descent statistic on 123-avoiding permutations, S´em. Lothar. Combin. 63 (2010), Art. B63a, 8 pp. [2] W.Y.C. Chen, A.Y.L. Dai, and R.D.P. Zhou, Ordered partitions avoiding a permutation pattern of length 3, European J. Combin. 36 (2014), 416–424. [3] S. Kitaev, Patterns in permutations and words, Monographs in Theoretical Computer Science, an EATCS Series, Springer, Heidelberg, 2011. [4] The On-Line Encyclopedia of Integer , published electronically at https://oeis.org, 2020.

Nazareth College, 4245 East Ave., Rochester, NY 14618 Email address: [email protected]

Penn State Altoona, 3000 Ivyside Park, Altoona, PA 16601 Email address: [email protected], [email protected]

Department of Mathematics, UC Davis, One Shields Ave., Davis, CA 95616 Email address: [email protected]