identifying structures in motzkin paths

36
Identifying Structures in Motzkin Paths Kolbeinn Páll Erlingsson Björn Gunnarsson Kristmundur Ágúst Jónsson Advisor: Christian Bean Department of Computer Science University of Reykjavik This dissertation is submitted for the degree of Bachelor of Science December 2018

Upload: others

Post on 03-Apr-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Identifying Structures in Motzkin Paths

Kolbeinn Páll ErlingssonBjörn Gunnarsson

Kristmundur Ágúst Jónsson

Advisor: Christian Bean

Department of Computer ScienceUniversity of Reykjavik

This dissertation is submitted for the degree ofBachelor of Science

December 2018

Acknowledgements

We want to give special thanks to Christian Bean and Henning Ulfarsson for their endlesspatience. Without their insight and vast knowledge, this research would not have beenbrought to fruition. Moreover, we would like to thank the RU faculty for providing us with aworkspace and Sigurður Helgason for keeping up the moral.

Abstract

In this paper we describe a method to enumerate combinatorial avoidance classes for Motzkinpaths automatically. We give an algorithm to find a combinatorial specification for any set ofpatterns. Furthermore, we show that every class of Motzkin paths avoiding a set of patternshas an algebraic generating function.

Table of contents

List of figures ix

1 Introduction 11.1 Dyck and Motzkin Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Symbolic Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2.1 Combinatorial Classes and Counting Sequences . . . . . . . . . . . 31.2.2 Combinatorial Specifications . . . . . . . . . . . . . . . . . . . . . 6

1.3 Avoidance Classes of Motzkin Paths . . . . . . . . . . . . . . . . . . . . . 7

2 A Method for Enumeration 112.1 Solving a Non-Trivial Example . . . . . . . . . . . . . . . . . . . . . . . . 11

2.1.1 Constructing the Combinatorial Specifications . . . . . . . . . . . 112.1.2 Enumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2.2 Automatic Construction of Combinatorial Specifications . . . . . . . . . . 152.2.1 Split of Classical Patterns . . . . . . . . . . . . . . . . . . . . . . 162.2.2 Constructing the Combinatorial Specifications . . . . . . . . . . . 18

3 ComboPal 21

4 Conclusion 234.1 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

4.1.1 Other Combinatorial Specifications . . . . . . . . . . . . . . . . . 234.1.2 Properties of Motzkin paths . . . . . . . . . . . . . . . . . . . . . 24

Bibliography 25

List of figures

1.1 Example of a Dyck path . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Example of a Motzkin path . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Description of Motzkin paths . . . . . . . . . . . . . . . . . . . . . . . . . 31.4 Description of Dyck paths . . . . . . . . . . . . . . . . . . . . . . . . . . 51.5 Specification of Dyck paths . . . . . . . . . . . . . . . . . . . . . . . . . . 71.6 Example of containment . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.1 Expansion of a initial class . . . . . . . . . . . . . . . . . . . . . . . . . . 112.2 Expansion of a non-empty class . . . . . . . . . . . . . . . . . . . . . . . 122.3 Enumeration of a class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.4 Classes containing empty and non-empty patterns . . . . . . . . . . . . . . 152.5 Expansion of the non-empty class . . . . . . . . . . . . . . . . . . . . . . 162.6 Avoidance class of a split set . . . . . . . . . . . . . . . . . . . . . . . . . 182.7 Enumerating a avoidance class . . . . . . . . . . . . . . . . . . . . . . . . 20

3.1 Introduction of ComboPal . . . . . . . . . . . . . . . . . . . . . . . . . . 213.2 Example of a specification from ComboPal . . . . . . . . . . . . . . . . . 22

Chapter 1

Introduction

Automatic discovery of combinatorial proofs is a new and exciting field within the com-binatorics branch of mathematics. In a PhD paper written by Bean [1] we are providedwith methods for enumerating permutation classes. He introduces a general frameworkused to search for combinatorial specifications. This framework is called the CombSpec-Searcher algorithm and is created by Dr.Bean, Dr.Ulfarsson and their collaborators. Usingthis framework that we will come up with our own structures and strategies in order todiscover combinatorial proofs.

At Permutation Patterns 2018 [2], an annual conference centered around the study ofpatterns in permutations and other combinatorial objects, Daly and Ramey from the SoutheastMissouri State University presented work on Pattern Avoidance in Motzkin paths. In thiswork, recurrences are given for avoiding a single pattern of length at most three. As part oftheir future work, they proposed looking at patterns HUDH, UDHH and HHUD. We give analgorithm for enumerating an avoidance class for any set of patterns by finding the generatingfunction, including those of HUDH, UDHH and HHUD. Furthermore, we prove that thisalgorithm can give an algebraic generating function for any avoidance class.

1.1 Dyck and Motzkin Paths

A Dyck path, named after German mathematician Walther von Dyck, is a form of lattice path.

Definition 1.1.1. A Dyck path of length n is a lattice path of even length, starting from (0,0)ending at (n,0) consisting of n

2 diagonal up steps (1,1) and n2 diagonal down steps (1,-1) that

never goes below the x-axis.

We represent a Dyck path with a series of letters from the alphabet {U,D}, where U andD are diagonal Up and Down steps in the path.

2 Introduction

Fig. 1.1 Example of a Dyck path

A Motzkin path, named after Israeli-American mathematician Theodore Motzkin, is asuperset of Dyck paths.

Definition 1.1.2. A Motzkin path of length n is a lattice path from (0,0) ending at (n,0)consisting of diagonal up steps (1,1), diagonal down steps (1,-1), horizontal steps (1,0) thatnever goes below the x-axis.

We represent a Motzkin path with a series of letters from the alphabet {U,D,H}, whereH is the Horizontal step.

Fig. 1.2 Example of a Motzkin path

Let M be the set of all Motzkin paths. By Definition 1.1.2 we can see that M can besplit into the disjoint union of three sets, namely the set containing the empty path, the setcontaining paths starting with a horizontal step and the set of paths starting with an up step.Hence M can be described by Equation 1.1.

Definition 1.1.3. Let MH and MU be the set of Motzkin paths starting with a horizontaland a diagonal up step respectively.

Remark. For a path in MU , the first return is the first step that returns to the x-axis.

By Definition 1.1.3 we can write M as

M= {ε}⊔MH ⊔MU . (1.1)

Equation 1.1 is the disjoint union of three sets, Figure 1.3 illustrates the underlying structureof the equation. We can fully enumerate M by finding the enumeration for each of the three

1.2 Symbolic Method 3

sets. Let M(x),K(x) and D(x) be the generating functions representing the enumeration forM,MH , and MU respectively, then

M(x) = 1+K(x)+D(x). (1.2)

Since MH and MU are non-empty paths in M we can multiply M by x and x2 to representpaths of length at least 1 and at least 2. Hence K(x) = x×M(x) and D(x) = x2 ×M(x)2, wecan substitute into Equation 1.2 and get

M(x) = 1+ x×M(x)+ x2 ×M(x)2 (1.3)

Solving for M(x) gives us

M(x) =−x+√−3x2 −2x+1−1

2x2 . (1.4)

we can Taylor expand the right hand side of Equation 1.4 to obtain the enumeration of M.

M= E+ M+

MM

Fig. 1.3 Description of Motzkin paths

1.2 Symbolic Method

In this section, we will discuss some methodology for counting combinatorial objects andconstructing combinatorial specifications.

1.2.1 Combinatorial Classes and Counting Sequences

We introduce the notion of a combinatorial class and give examples of such classes. Thedefinition of a combinatorial class, stated by Flajolet and Sedgewick [3, p. 16], is thefollowing

Definition 1.2.1. A combinatorial class is a finite or denumerable set on which a sizefunction is defined, satisfying the following conditions

i. the size of an element is a non-negative integerii. the number of elements of any given size is finite.

4 Introduction

If A is a combinatorial class, and a is an element in A then |a| is the size of a. Further,we let An be the set of objects in A s.t. each object has size n. We are particularly interestedin the sequence (an)n≥0, where an = |An|.

Definition 1.2.2. Let A be a combinatorial class. The counting sequence of A is the sequenceof integers (an)n≥0 where an = |An|.

Remark. The counting sequence of A can be encoded with the (ordinary) generatingfunction

C(x) =∞

∑n=0

anxn.

Example 1.2.3. Let C be the class that contains all Dyck paths, and C(x) be the generatingfunction encoding the counting sequence of C. Then

C(x) =∞

∑n=0

|Cn|xn. (1.5)

Where Cn contains all Dyck paths of semi length n, i.e. each path ends at the point (2n,0).Definition 1.1.1 restricts the paths in such a way that for every diagonal up movement thereis a corresponding diagonal down movement. This observation tells us enough about thestructure of C so that we can enumerate it with the following recurrence

|Cn+1|=n

∑k=0

|Ck||Cn−k|. (1.6)

We can now use Equation 1.6 to compute the counting sequence for C up to a fixedparameter n.

The structure of a combinatorial class often depends on a set of other combinatorialclasses, therefore it is necessary to be able to understand how those combinatorial classesbehave within the structure of the class. For this paper it is sufficient to know about twoconstructors, namely disjoint union and cartesian product.

Theorem 1.2.4. Let A and B be combinatorial classes generating functions A(x) and B(x)respectively, then the construction operators for disjoint union and cartesian product are thefollowing.

i. the disjoint union A⊔B has the generating function given by A(x)+B(x)ii. the cartesian product A×B has the generating function given by the convolution

equation A(x) ·B(x).

1.2 Symbolic Method 5

Remark. For construction arguments, we may assume that we have two combinatorialclasses, namely the atomic class Z containing a single object of size 1 and E containing asingle object of size 0. The corresponding generating functions are E(x) = 1 and Z(x) = xrespectively.

Flajolet and Sedgewick [3, p. 28] give a proof of Theorem 1.2.4.

Example 1.2.5. Let C and C(x) be the same as in Example 1.2.3. Recall that from our obser-vations in Example 1.2.3 we know that for every diagonal up step there is a correspondingdiagonal down step. Consider Figure 1.4 which portrays the first diagonal up step and thefirst diagonal down step reaching the x-axis, then in-between those two is a Dyck path andafter the diagonal down step there is also a Dyck path.

D = E+

DD

Fig. 1.4 Description of Dyck paths

From this we can conclude that

C(x) = Z(x)2C(x)2 +E(x) (1.7)

where Z(x)2 corresponds to the two diagonal lines that are in every path and E(x) accountsfor the single empty path, i.e. E(x) = 1. Solving for C(x) in Equation 1.7 gives

C(x) =−√−4x2 +1−1

2x2 . (1.8)

Since

C(x) =−√−4x2 +1−1

2x2 =∞

∑n=0

|Cn|xn

we can Taylor expand C(x) around 0 to extract the coefficients up to n, yielding Table 1.1for n = 10. The coefficients from C(x) form a well-known sequence A000108 on the OEIS,Sloane[6].

6 Introduction

i i-th term of expansion0 12 x2

4 2x4

6 5x6

8 14x8

10 42x10

Table 1.1 Taylor expansion of C(x) (A000108)

1.2.2 Combinatorial Specifications

A specification of a combinatorial class is a description of the structure of a class. We willuse the definition as given by Bean [1], which is equivalent to that of Flajolet [3, p. 31].

Definition 1.2.6. Let C and C1, . . . ,Ck be combinatorial classes and ◦ a constructor, thenC = f◦(C1, . . . ,Ck) is a combinatorial rule if C ∼= C1 ◦ · · · ◦Ck, i.e. there is a length preservingbijection between C and C1 ◦ · · · ◦Ck.

Definition 1.2.7. A combinatorial specification C = (C1, . . . ,Ck) is a set of k rules whereeach Ci appears on the left side of a rule exactly once.

We will address the details of constructing a combinatorial specification for Motzkinpaths in Chapter 2. For now we continue with Example 1.2.5 by illustrating a combinatorialspecification for C, the class containing all Dyck paths. The corresponding specification forC(x) are C = (C1,C2,C3) where

C1 = f⊔(C2,C3)

C2 = EC3 = f×(Z,C1,Z,C1).

(1.9)

Recall that Z and E are defined in the remark of Theorem 1.2.4. In Figure 1.5 there is apictorial representation of this specification.

1.3 Avoidance Classes of Motzkin Paths 7

C(x)

ε C(x)

C(x)

U C(x) D C(x)

Verified

Verified Recursed Verified Recursed

Fig. 1.5 Specification of Dyck paths

The goal of CombSpecSearcher is to find these types of specifications and has two stages,namely an expansion stage and a search stage. The expansion stage starts with a singlecombinatorial class C and tries to compute a rule C = f◦(C1, . . . ,Ck), and for every Ci itcomputes their rules as well. When a rule Ci = f◦( /0) appears we say that we understand Ci.After the expansion stage finishes the CombSpecSearcher will search the set of combinatorialrules for a specification.

1.3 Avoidance Classes of Motzkin Paths

We are interested in specific subsets of Motzkin classes, more precisely we are interested inthose subsets that avoid a particular pattern or a set of patterns.

Definition 1.3.1. Let π ∈M. For a pattern σ we say that π contains σ if σ is a subword 1

in π , denoted by σ ⪯ π . If π does not contain σ we say that it avoids it, denoted by σ ⪯ π .

Remark. We use σ ⪯ σ ′ and σ ⪯ σ ′ when a pattern σ ′ avoids or contains pattern σ

respectively.

Definition 1.3.2. Let P be a set of patterns and π ∈M, if π is contained in every pattern inP, then π contains P and if π avoids every path in P we say that π avoid P.

1A subword is a sequence in a path that is not necessarily consecutive.

8 Introduction

The class avoiding a set of patterns P is denoted by Av(P) where every path in Av(P)avoids P. The structure of the avoidance class can be defined similarly as the structure ofMotzkin paths, i.e. we can view it as a disjoint union between three sets, more specificallythe sets containing paths that avoid P but start with a horizontal step, a diagonal up step or,are empty. We say that Av( /0) =M, and if any pattern in P is empty, then Av(P) = /0.

Definition 1.3.3. Let M be the class of Motzkin paths, and P be a set of patterns, then thetwo avoidance classes AvH and AvU are defined as

AvH(P) = {π ∈MH | σ ⪯ π for all σ ∈ P}

andAvU(P) = {π ∈MU | σ ⪯ π for all σ ∈ P}.

From Definition 1.3.3 we can write

Av(P) = {ε}⊔AvH(P)⊔AvU(P). (1.10)

Equation 1.10 holds if no pattern in P is empty.Another subset of M is the class containing P, denoted by Co(P). This class is necessary

because we often have to compute the intersection between the avoidance and containingclasses, i.e. we want some class avoiding a certain set of patterns but also containing anotherset.

Definition 1.3.4. Let M be the class of Motzkin paths, and P be a set of patterns, then Co(P)is defined as

Co(P) =

{π ∈M | σ ⪯ π for all σ ∈ P} if P = {ε} and P = /0

M otherwise

Example 1.3.5. Let π =UUHHHDD ∈M , σ1 =UHD and σ2 =UDH. Then π containsσ1 and π avoids σ2, Figure 1.6 shows an example of how π contains σ1. The letters of ourpattern do not need to be consecutive within our path in order for the path to contain it. Theyonly need to appear in the same order.

1.3 Avoidance Classes of Motzkin Paths 9

Fig. 1.6 Example of containment

The set of Dyck paths are a subset of Motzkin paths, hence Example 1.2.5 gives anindirect insight into an avoidance class of the Motzkin paths, namely the class of Motzkinpaths avoiding a horizontal step or equivalently Av(H). We will discuss in depth the structuresof avoidance classes in Chapter 2.

Chapter 2

A Method for Enumeration

2.1 Solving a Non-Trivial Example

In this section, we will go through an example of how to construct a specification for anon-trivial avoidance class, namely Av(HH). We will show how to automate this procedurein Section 2.2.

2.1.1 Constructing the Combinatorial Specifications

Consider the avoidance class Av(HH), i.e. all Motzkin paths that contain at most one H.Every path in Av(HH) is empty or it has length at least one, we denote the class not containingthe empty path with Av+(HH), this can be seen in Figure 2.1.

Av(HH)

ε Av+(HH)

Fig. 2.1 Expansion of a initial class

By Equation 1.1 every path in Av+(HH) is in MU or MH , hence we can branchAv+(HH) accordingly. If it starts with a horizontal step we want to avoid H for the re-maining path, otherwise we want to keep avoiding HH.

12 A Method for Enumeration

Av(HH)

ε Av+(HH)

Av(H)

Av(HH)

Av(HH)

H

H

Fig. 2.2 Expansion of a non-empty class

A Motzkin path in AvH(HH) is of the form Hπ where π is in Av(H). This implies thatwe can enumerate the paths in AvH(HH) with Equation 1.8. A Motzkin path in AvU(HH)

can be written as Uπ1Dπ2 where π1 and π2 are Motzkin paths in Av(HH). However, not allchoices of π1 and π2 lead to paths in AvU(HH). For example if π1 = π2 = H, we have a pathUHDH which is not in AvU(HH). To capture this we this we define a new type of pattern.

Definition 2.1.1. A Motzkin path π of length m, contains a crossing pattern σ −τ where σ =

σ1, . . . ,σk and τ = τ1, . . . ,τn−k are words from the alphabet {U,D,H}, if there exists a set ofindices 1 ≤ i1 < i2 < · · · ≤ ik < r+ 1 ≤ ik+1 < · · · < in < m, s.t. σ1σ2 . . .σkτ1τ2 . . .τn−k =

πi1πi2 . . .πin , where r is the index of the first return. If σ is ε or τ is ε then σ −τ is a localizedpattern, denoted by −τ as a right localized and σ− as a left localized crossing pattern. If π

does not contain σ − τ , we say it avoids it.

We can write AvU(HH) in terms of crossing patterns, i.e. we have the localized crossingpatterns −HH,HH− and a non-localized crossing pattern H −H, then the union of thetwo disjoint sets, one allowing a H after the first return but avoiding it before and the othercontaining a H before the first return but avoiding it after, fully describes it

AvU(HH) = AvU(H−,−HH)⊔AvU(HH−,−H)∩Co(H). (2.1)

The two disjoint sets in Equation 2.1 are avoiding localized crossing patterns that restricteach set to avoid H −H but the union of them is AvU(HH). Therefore we can expand theclass as seen in Figure 2.3.

2.1 Solving a Non-Trivial Example 13

Av(HH)

ε Av+(HH)

Av(H)

Av(HH)

Av(HH)

Av(H)

Av(HH)

Av(HH)∩Co(H)

Av(H)

U Av(H) D Av(HH) U Av(HH)∩Co(H)

1

D Av(H)

H Av(H)

H

H

H

H

H

H

Fig. 2.3 Enumeration of a class

Every leaf node in Figure 2.3 is either Av(HH) or we know the enumeration for it, exceptfor the one tagged with 1. We can write it as

Av(HH)∩Co(H) = Av(HH)\Av(H). (2.2)

To formalize Equation 2.2 we introduce the following lemma.

Lemma 2.1.2. Let X and Y be sets of crossing patterns where σ −τ ∈Y , and Y ′=Y \{σ −τ},then

AvU(X)∩Co(Y ′) = AvU(X)∩Co(Y )⊔AvU(X ∪{σ − τ})∩Co(Y ′)

14 A Method for Enumeration

Proof. Let X and Y be sets of crossing patterns where σ − τ ∈ Y , Y ′ = Y \{σ − τ} and π

be a path in AvU(X)∩Co(Y ′). If π avoids σ − τ , then π is in AvU(X ∪{σ − τ})∩Co(Y ′),otherwise π contains σ − τ and is in AvU(X)∩Co(Y ). Therefore

AvU(X)∩Co(Y ′) = AvU(X)∩Co(Y )⊔AvU(X ∪{σ − τ})∩Co(Y ′).

Corollary 2.1.3. Let P(x),Q(x) and R(x) be the generating functions for AvU(X)∩Co(Y ),AvU(x)∩Co(Y ′) and AvU(X ∪{σ − τ})∩Co(Y ′) respectively, then

P(x) = Q(x)−R(x). (2.3)

Proof. We have that

AvU(X)∩Co(Y ′) = AvU(X)∩Co(Y )⊔AvU(X ∪{σ − τ})∩Co(Y ′)

which implies that

AvU(X)∩Co(Y ) = AvU(X)∩Co(Y ′)\AvU(X ∪{σ − τ})∩Co(Y ′).

Furthermore, we have that AvU(X ∪{σ − τ})∩Co(Y ′) is a subset in AvU(X)∩Co(Y ′), sinceAvU(X ∪{σ − τ})∩Co(Y ′) = AvU(X)∩AvU({σ − τ})∩Co(Y ′). Therefore

P(x) = Q(x)−R(x).

2.1.2 Enumeration

We can enumerate Av(HH) directly with the specification outlined in Figure 2.3. Let H(x)and C(x) be the the generating functions for Av(HH) and Av(H) respectively. Then

H(x) = 1+ x ·C(x)+ x2 ·C(x) ·H(x)+ x2 · (H(x)−C(x)) ·C(x)

and solving for H(x) gives

H(x) =C(x)2 · x2 −C(x) · x−1

2C(x) · x2 −1. (2.4)

2.2 Automatic Construction of Combinatorial Specifications 15

In Example 1.2.5, we found the generating function C(x) for Av(H), substituting C(x) intoEquation 2.4 gives Equation 2.5.

H(x) =4x2 −

√−4x2 +1(x−1)+ x−12√−4x2 +1x2

(2.5)

2.2 Automatic Construction of Combinatorial Specifications

The purpose of this section is to prove the following theorem

Theorem 1. For a set P of patterns, Av(P) has an algebraic generating function.

We will outline the algorithm for automatically constructing specifications. As a runningexample, we will enumerate the avoidance class Av(HHH,UDH,UUDD).

To automatically construct a specification, we define our parameter P to be the set ofclassical patterns {HHH,UDH,UUDD}. Our initial class is Av(HHH,UDH,UUDD), byEquation 1.1 we see that it is composed of paths avoiding P that are either empty or are ineither MH or MU .

Av(HHH,UDH,UUDD)

ε Av+(HHH,UDH,UUDD)

Fig. 2.4 Classes containing empty and non-empty patterns

Lemma 2.2.1. Let P be a set of classical patterns and P′ be the set containing every elementin P with H removed from the front when H is in the front, then

AvH(P) = {Hπ | π ∈ Av(P′)}

Proof. Let Hπ ∈ AvH(P), then π avoids P′ since Hπ itself avoids P, hence AvH(P) ⊆{Hπ | π ∈ Av(P′)}. Similarly if Hπ ′ ∈ {Hπ | π ∈ Av(P′)} then π ′ avoids P′, thereforeHπ ′ avoids {H p | p ∈ P′}, and {Hπ | π ∈ Av(P′)} ⊆ AvH(P). This implies that AvH(P) ={Hπ | π ∈ Av(P′)}.

Lemma 2.2.1 together with Equation 1.10 allows us to expand the class of non-emptypaths, i.e. split it into the disjoint sets AvH(HH,UDH,UUDD) and AvU(HHH,UDH,UUDD)

as portrayed in Figure 2.5.

16 A Method for Enumeration

Av(HHH,UDH,UUDD)

ε Av+(HHH,UDH,UUDD)

AvH(HH,UDH,UUDD) AvU(HHH,UDH,UUDD)

Fig. 2.5 Expansion of the non-empty class

In the next section we will introduce a general method for expanding the case where thenon-empty paths start with a diagonal up step.

2.2.1 Split of Classical Patterns

To specify the paths in MU avoiding P, we need to identify the crossing patterns in AvU(P).The non-localized crossing patterns will allow us to expand AvU(P) until we get a specifica-tion. We can obtain the crossing patterns by looking at each pattern in P individually.

Definition 2.2.2. Let p = p1 . . . pn be a classical pattern of length n and p′ = p2 . . . pn ifp1 =U , otherwise p′ = p and |p′|= n′. Then sk(p) = p′1 . . . p′k − p′k+1 . . . p′n′ if neither p′k orp′k+1 is D, otherwise we remove pk if pk = D, if not we remove pk+1 and set sk(p) to be theremaining pattern. The split of p is the set of crossing patterns s(p) = {sk(p) | 0 ≤ k ≤ n′}.

Definition 2.2.3. Let P be a set of classical patterns we define the split of P to be the set ofcrossing patterns

S(P) =⋃p∈P

s(p).

Example 2.2.4. Let p = UDHUDH and p′ = DHUDH then by Definition 2.2.2 splittingp′ gives the set {D−HUDH,DH −UDH,DHU −DH,DHUD−H,DHUDH−}, and re-moving the D’s from the each of the splits gives s(p) = {−HUDH,DH −UDH,DHU −H,DHUDH−}.

By the construction of the split set we can see that any path avoiding P will also beavoiding the set of crossing patterns. We formalize this in the following theorem.

Theorem 2.2.5. Let S(P) be the split of a set of classical patterns P, then AvU(P) =AvU(S(P)).

2.2 Automatic Construction of Combinatorial Specifications 17

Proof. Let π be a Motzkin path containing some p ∈ P, then π can contain p before the firstreturn, after the first return or a combination of both, therefore the construction of S(P) impliesthat π contains some σ −τ ∈ S(P). Conversely, if π avoids every pattern in P, π avoids S(P),hence AvU(P)⊆ AvU(S(P)). Suppose that π contains σ − τ , then the construction of S(P)implies that π also contains some pattern in P, therefore AvU(S(P))⊆ AvU(P).

Using Theorem 2.2.5 we can continue to expand AvU(HHH,UDH,UUDD) in Figure 2.4,we start by computing the split of P

S(HHH) = {−HHH,H −HH,HH −H,HHH−}S(UDH) = {−DH,−H,DH−}S(UUDD) = {−UDD,U −D,UD−}

Then S(P) = S(HHH)∪S(UDH)∪S(UUDD). In between the first diagonal up step and thefirst return we need to avoid all the left localized crossing pattern, then after the return weneed to avoid all the right localized crossing patterns.

Definition 2.2.6. Let σ −τ and σ ′−τ ′ be crossing patterns, we say that σ ′−τ ′ is containedin σ − τ if σ ′ ⪯ σ and τ ′ ⪯ τ .

Left-localized crossing patterns = {HHH−,DH−,UD−}Right-localized crossing patterns = {−HHH,−DH,−H,−UDD}Non-localized crossing patterns = {H −HH,HH −H,U −D}

18 A Method for Enumeration

Av(HHH,UDH,UUDD)

ε Av+(HHH,UDH,UUDD)

Av(HH,UDH,UUDD)

Av({HHH,DH,UD})

Av({H,UDD,HHH})

H

HH

HH

H

D

U

Fig. 2.6 Avoidance class of a split set

Let X be a set of localized patterns where σ and σ ′ are in X , then we can take σ ′ out of Xif σ ⪯ σ ′, because Av(X) = Av(X \{σ ′}). In our running example, we can take the patternHHH out of the set of the right localized crossing patterns in Figure 2.6. Furthermore wecan eliminate all non-localized crossing patterns σ − τ if there exists σ ′− or −τ ′ such thateither of them is contained in σ − τ , because that eliminates the possibility that σ − τ can becontained in the node. Therefore we can eliminate HH −H and H −HH because we avoid−H in Figure 2.6.

2.2.2 Constructing the Combinatorial Specifications

In this section, we introduce a method to expand AvU(S(P)). Let π be a path in the classthat avoids all the localized crossing patterns in S(P), then it is possible that π could containnon-localized pattern σ − τ in S(P). We can split AvU(S(P)) into two disjoint classes, wherewe require one class to avoid σ− and the other to avoid −τ but contain σ−. This is expressedin the following theorem.

Theorem 2.2.7. Let X and Y be a sets of crossing patterns where σ −τ ∈ X are non-localizedcrossing patterns. Furthermore let X ′ = X \{σ − τ}, then

AvU(X)∩Co(Y ) = AvU(X ′∪{σ−})∩Co(Y )⊔AvU(X ′∪{−τ})∩Co(Y ∪{σ−}).

Proof. Let X and Y be sets of crossing patterns where σ − τ ∈ X and let π be a path inAvU(X)∩Co(Y ). If π avoids σ−, then π ∈ AvU(X ′∪{σ−})∩Co(Y )), otherwise π contains

2.2 Automatic Construction of Combinatorial Specifications 19

σ− and therefore avoids −τ , else π would contain σ − τ . Therefore π ∈ AvU(X ′∪{−τ})∩Co(Y ∪{σ−}). Hence

π ∈ (AvU(X ′∪{σ−})∩Co(Y ))⊔ (AvU(X ′∪{−τ})∩Co(Y ∪{σ−}))

Corollary 2.2.8. Let X be a set of crossing patterns where σ − τ ∈ X are non-localizedcrossing patterns, then the case where we only contain ε

AvU(X) = AvU(X \{σ − τ}∪{σ−})⊔AvU(X \{σ − τ}∪{−τ})∩Co({σ−}).

Lemma 2.2.9. Let X be a set of localized crossing patterns then

AvU(X)∼= {U}×Av(XL)×{D}×Av(XR)

XL is the set of left localized crossing patterns in X where U is removed from the front andD is removed from the back if U or D are in the front or the back of each crossing patternrespectively and XR is the set of right localized crossing patterns in X .

Proof. As there are no non-localized crossing patterns in X , every Motzkin path in AvU(X)

is of the form Uπ1Dπ2, where π1 ∈ Av(XL) and π2 ∈ Av(XR), hence Uπ1Dπ2 is in {U}×Av(XL)×{D}×Av(XR). Consider a path in Uπ ′

1Dπ ′2 in {U}×Av(XL)×{D}×Av(XR),

where π ′1 ∈ Av(XL) and π ′

2 ∈ Av(XR), then Uπ ′1Dπ ′

2 has the same form as the paths inAvU(X), therefore the sets are equal.

We can now apply Theorem 2.2.7 to obtain the specification in Figure 2.7.

20 A Method for Enumeration

Av(HHH,UDH,UUDD)

ε Av+(HHH,UDH,UUDD)

Av(HH,UDH,UUDD)

Av({HHH,DH,UD})

Av({H,UDD})

Av({HHH,DH,UD}∪{U})

Av({H,UDD})

Av({HHH,DH,UD})∩Co({U})

Av({H,UDD}∪{D})

D

U

D

U

D

U

Fig. 2.7 Enumerating a avoidance class

We can now get a generating function from the specification in Figure 2.7, if we knowthe generating function for Av(HH,UDH,UUDD), AvU(X) and AvU(Z)∩Co(Y ) where

X = {HHH−,DH−,U−,−H,−UDD}Z = {HHH−,DH−,UD−,−H,−D}Y = {U−}.

Lemma 2.2.9 allows us to solve AvU(X) and we can use Lemma 2.1.2 together with Lemma2.2.9 to solve AvU(Z)∩Co(Y ).

We have shown a general method to find a generating function for Av(P) for any set ofclassical patterns P. By applying Equation 1.10 we can split Av(P) into three disjoint classesand solve each individually using Lemma 2.2.1 and repeatedly applying Theorem 2.2.7. Wecan apply Lemma 2.2.9 and Lemma 2.1.2 to find a generating function for every AvU(X)

where X has only localized patterns, thus giving us a specification. This will terminate sincethe expansion in Theorem 2.2.7 will give two classes avoiding strictly smaller sets withrespect to set size or pattern size, unless it will avoid the initial set, in which case we canrecurse. The constructors in our specification consist of disjoint unions or cartesian products,therefore the generating function will be algebraic. This completes the proof of Theorem 1.

Chapter 3

ComboPal

In this chapter we will discuss the process of integrating our work with ComboPal. ComboPalis a web application developed by Helgason and Robb [5]. It can be used to visualizespecifications for a combinatorial class by drawing trees and as a database of results.

Fig. 3.1 Introduction of ComboPal

The CombSpecSearcher constructs a specification and a generating function for a com-binatorial class. These are stored in a database on ComboPal and can be retrieved via thesearch or random function. Storing the combinatorial specifications in a database provesvaluable since constructing a specification can take time. We use a base template provided byComboPal to describe our combinatorial object. We were able to visualize our combinatorialspecifications for avoidance classes of Motzkin paths using this tool.

22 ComboPal

Fig. 3.2 Example of a specification from ComboPal

Figure 3.2 is an example of a specification for Av(HHH,UDH,UUDD) and the enumer-ation for the class. At the present time we have over a thousand specifications accessible onComboPal [4].

Chapter 4

Conclusion

The work presented in this paper built a system on top of CombSpecSearcher that successfullyenumerates sets of Motzkin paths avoiding classical patterns. The system uses the strategiesintroduced in Section 2.2 to compute combinatorial specifications for these avoidance classesand finds their generating functions. With our system we have been able to automate resultsdone by other researchers in the field of combinatorics and automated work that was posedas future work for the same researchers.

4.1 Future Work

4.1.1 Other Combinatorial Specifications

Are there any avoidance problems that can be reduced to a problem our system solves?

Dyck paths

Dyck paths are given in Definition 1.1.1 and are a subset of Motzkin paths, namely they areMotzkin paths that avoid H. Since we can enumerate all sets of Motzkin paths avoidingclassical patterns, we get the enumeration of Dyck paths as a bonus.

Schröder paths

Schröder paths are similar to the Motzkin paths but can only take two horizontal stepsat a time. To enumerate them we could account for an additional horizontal step in ourconstruction.

24 Conclusion

Narayana paths

Narayana paths are defined by the number of peaks in the path, where steps are definedlike Dyck paths. The set of Naryana paths can be rephrased as Av(P∪{H}∪{(UD)k+1})\Av((UD)k), therefore our algorithm can give us the enumeration for Narayana paths.

4.1.2 Properties of Motzkin paths

Instead of just finding the enumeration for paths avoiding a set of patterns, we could find theenumeration for paths avoiding a set of patterns with respect to specific statistics.

Peaks and Valleys

Given an avoidance class, can we enumerate how many paths of some length have a specificamount of peaks or valleys, where a peak is a consecutive UD and a valley is a consecutiveDU? In our construction, peaks are added when the path between the first up and the firstreturn is empty. By using this fact, extending Lemma 2.2.9 should enable us to keep track ofpeaks. Similar analysis could be done for valleys.

Area under path

Can we determine how many paths of a certain length contain a particular amount of areabetween it and the x-axis? In Lemma 2.2.9, the area under the path is the sum of the areasunder the two Motzkin paths decomposed plus the length of the left hand path. Using thisinformation it is possible to write down recurrence relations, and with some further analysisit might be possible to find a functional equation.

Bibliography

[1] Bean, C. (2018). Finding structure in permutation sets. PhD thesis, Reykjavik University,Department of Computer Science. [Online] Available: https://skemman.is/handle/1946/31663.

[2] Daly, D. and Ramey, M. (2018). Pattern Avoidance in Motzkin Paths. [PowerPointslides] Available: http://permutationpatterns.com/slides/Daly.pdf.

[3] Flajolet, P. and Sedgewick, R. (2009). Analytic Combinatorics. Cambridge UniversityPress.

[4] Helgason, S. and Robb, J. (2018a). ComboPal. [Online] Available: http://combopal.ru.is/.

[5] Helgason, S. and Robb, J. (2018b). Identifying Combinatorial Structures for BinaryStrings and Set Partitions. BSc thesis, Reykjavik University, Department of ComputerScience. [Online] Available: http://hdl.handle.net/1946/31176.

[6] Sloane, N. J. A. (2018). The On-Line Encyclopedia of Integer Sequences. [Online]Available: https://oeis.org/A000108.