## 1 Introduction

*Davenport-Schinzel sequences of order * avoid alternations of length and have no adjacent same letters [3]. They have many applications including upper bounds on the complexity of lower envelopes of sets of polynomials of bounded degree [3], the complexity of faces in arrangements of arcs with bounded pairwise crossings [25], and the complexity of unions of fat triangles [21]. *Generalized Davenport-Schinzel sequences* avoid a forbidden sequence (or a family of sequences) and have every consecutive letters distinct, where is the number of distinct letters in . Their applications include bounds on the number of edges in -quasiplanar graphs [5, 10] and extremal functions of tuples stabbing interval chains [6] and 0-1 matrices [13, 2].

We say that sequence *contains* sequence if has some subsequence (not necessarily contiguous) that is isomorphic to ( can be changed into by a one-to-one renaming of its letters). Otherwise *avoids* . We call a sequence *-sparse* if every consecutive letters are distinct. For any sequence , define to be the maximum possible length of an -sparse sequence with distinct letters that avoids , where is the number of distinct letters in . Furthermore, define to be the maximum possible length of a sequence with distinct letters that avoids and can be partitioned into contiguous blocks of distinct letters. The function has been used to find bounds on . Bounds on are known for several families of sequences such as alternations [1, 20, 22] and more generally the sequences [10]. Let denote the alternation of length . It is known that that , , , , , and for all , where [3, 1, 20, 22].

Relatively little about is known for arbitrary forbidden sequences . However, one way to find upper bounds on for any sequence is to use -formations, which are concatenations of permutations of distinct letters. We define to be the family of all -formations. We define the function to be the maximum possible length of an -sparse sequence with distinct letters that avoids all -formations, and we define the function to be the maximum possible length of a sequence with distinct letters that avoids all -formations and can be partitioned into blocks of distinct letters. Like and , the function has been used to find bounds on .

Let denote the minimum for which there exists such that every -formation contains , and let denote the minimum value of for which every -formation contains . These parameters were defined in [10], where it was observed that . This uses the fact that increasing the sparsity in the definition of only changes the value by at most a constant factor, which was proved by Klazar in [15]. Using the upper bound with and known bounds on , it is possible to find sharp bounds on for many sequences .

Nivasch [20] and Pettie [22] found tight bounds on for all fixed . In particular, and for all even , where . Although the known bounds on are tight, they are not exact, even for . Klazar [15], Nivasch [20], and Pettie [22] showed that , , , and . In this paper, we prove that , , , and . We also prove a conjecture from [10] that for all . As a result, we obtain the bounds for . We also prove that and for . In addition, we improve an upper bound of Klazar [14], who proved that , with and . Here we prove that in Klazar’s bound can be replaced with .

Recently, -formations were generalized to -dimensional 0-1 matrices [9]. For any family of -dimensional 0-1 matrices , define to be the maximum number of ones in a -dimensional matrix of sidelength that has no submatrix which can be changed to an exact copy of an element of by changing any number of ones to zeroes. When has only one element , we also write as . Most research on has been on the case , but several results for have been generalized to higher values of . For example, Marcus and Tardos proved that for every permutation matrix [18], and this was later generalized by Klazar and Marcus [16], who proved that for every -dimensional permutation matrix . Fox improved the upper bound of Marcus and Tardos to for permutation matrices [4], and this was later generalized to an upper bound of for -dimensional permutation matrices of sidelength in [11]. Another example is the upper bound for double permutation matrices from [8], which was generalized to an upper bound for -dimensional double permutation matrices in [11].

Define the *projection* of the -dimensional 0-1 matrix to be the -dimensional 0-1 matrix with if and only if there exists such that . An *-row* of a -dimensional 0-1 matrix is a maximal set of entries that have all coordinates the same except for the the coordinate. An *-cross section* of a -dimensional 0-1 matrix is a maximal set of entries that have the same coordinate.

Given a -dimensional 0-1 matrix with ones, a -formation is a -dimensional 0-1 matrix with ones that can be partitioned into disjoint -dimensional 0-1 matrices each with ones so that any two have ones in the same sets of -rows of , the greatest first coordinate of any one in is less than the least first coordinate of any one in for , and . For each -dimensional matrix , define to be the set of all -formations. Geneson [9] proved that for all positive integers and -dimensional 0-1 matrices . Here we prove that and for any -dimensional 0-1 matrix . By using a generalization of the Kővári-Sós-Turán upper bound, we also generalize a result from [7] by proving that if and only if .

In Section 2, we determine the exact values of , , , and . We also find the exact values of and for . In Section 3, we find and , giving tight bounds on and , and we improve the upper bound on . Finally, in section 4, we prove results on formations in -dimensional 0-1 matrices. In particular, we prove that and .

## 2 Exact values

In this section, we prove that , , , and . We note an interesting relationship with a past result about patterns called *interval minors*. As in [5], we say that a matrix is an interval minor of a matrix if there are disjoint intervals of rows with before if , disjoint intervals of columns with before if , and for all , the submatrix contains a if . The right side of the equality is the same as the upper bound proved in [19] on the maximum possible number of ones in an 0-1 matrix that avoids the all-ones matrix as an interval minor, and the bound in [19] is known to be tight for infinitely many values of .

It is not surprising that is at least the maximum possible number of ones in an 0-1 matrix that avoids the all-ones matrix as an interval minor: can be alternatively defined in terms of -formations in 0-1 matrices instead of sequences, with columns corresponding to letters and rows corresponding to blocks, and any copy of an -formation in a matrix is also an interval minor for a all-ones matrix. The interesting part is that although an interval minor for a all-ones matrix does not have to be an -formation, the extra flexibility in the definition does not cause the interval minor extremal function to be lower than the formation extremal function for the values of where the interval minor extremal function has been exactly determined. For the results in this section, we assume that .

###### Theorem 2.1.

###### Proof.

Suppose that is a sequence on blocks with distinct letters that avoids . Delete the first occurrence of every letter in . This empties the first block, leaving a sequence with at most nonempty blocks that must have at most letters per block, or else would have contained a pattern of . Thus has length at most , giving the upper bound.

For the lower bound, consider the sequence obtained from concatenating with . This sequence has distinct letters, blocks, and clearly avoids . ∎

###### Theorem 2.2.

###### Proof.

Suppose that is a sequence on blocks with distinct letters that avoids . Delete the first occurrence of every letter in , as well as the last occurrence. This empties the first and last blocks, leaving a sequence with at most nonempty blocks that must have at most letters per block, or else would have contained a pattern of . Thus has length at most , giving the upper bound.

For the lower bound, consider the sequence obtained from concatenating , , and again. This sequence has distinct letters, blocks, and clearly avoids . ∎

###### Theorem 2.3.

###### Proof.

Suppose that is an -sparse sequence with distinct letters that avoids . Partition into blocks of size , except for the last block which may have size at most . Every block of length must have the first occurrence of some letter (or else would contain a pattern in ), and the first block has first occurrences. This gives the upper bound.

For the lower bound, consider the sequence obtained by starting with and concatenating to the end for . This sequence has length , it is -sparse, and clearly avoids . ∎

###### Theorem 2.4.

###### Proof.

Suppose that is an -sparse sequence with distinct letters that avoids . Partition into blocks of size , except for some block besides the first or last which may have size at most . Every block of length must have the first or last occurrence of some letter (or else would contain a pattern in ), the first block has first occurrences, and the last block has last occurrences. This gives the upper bound.

For the lower bound, consider the sequence obtained by starting with and concatenating to the end for . This sequence has length , it is -sparse, and clearly avoids . ∎

Next we find the exact value of for . Note that this result shows that .

###### Theorem 2.5.

If , then .

###### Proof.

The upper bound follows since every pattern in contains . For the lower bound, consider the sequence obtained from concatenating with . For any copy of in this sequence, any letter occurring after the copy must be making its first occurrence in the sequence. Thus the sequence avoids , and it has distinct letters and blocks. ∎

We also find the exact value of . While we found that in the last result, the same does not happen for .

###### Theorem 2.6.

If , then .

###### Proof.

For the upper bound, let be an -sparse sequence with distinct letters that avoids . Note that all of the letters for cannot occur later in , or else would contain . This implies the upper bound.

For the lower bound, consider the sequence obtained by concatenating with . Any letter that occurs twice in this sequence must have all occurrences among the first and last letters in the sequence. Thus this sequence avoids , it has length , and it is -sparse for . ∎

## 3 Improved bounds using formations

Klazar’s proof that , where and , uses the Erdös-Szekeres theorem to find the copy of [14]. Here we use the Erdös-Szekeres theorem in a different way to improve the upper bound with respect to .

###### Theorem 3.1.

Every -formation contains .

###### Proof.

Without loss of generality suppose that the first permutation of has all letters in increasing order. By the Erdös-Szekeres theorem, the second permutation contains letters in increasing order or letters in decreasing order. If the former, then we have a copy of . Otherwise if the second permutation has letters in decreasing order, then among those same letters the third permutation has letters in increasing or decreasing order. This also makes a copy of . ∎

Besides the application of the Erdös-Szekeres theorem, the proof of the next theorem is the same as the proof of Klazar’s bound in [14].

###### Theorem 3.2.

, where and .

###### Proof.

Set and . Let be an -sparse sequence with at most distinct letters. Suppose that has length at least . Split into disjoint intervals, each of length at least . At least one interval contains no first or last occurrence of any letter in . If has fewer than distinct letters, then contains by the definition of and . If has at least distinct letters, then all of these letters occur before , in , and after . Thus contains an -formation. By Theorem 3.1, contains , completing the proof. ∎

The next theorem generalizes Theorem 3.1. This sharpens a bound from [10], where it was shown that every -formation contains . For this theorem, we define a *binary formation* as a formation in which every pair of permutations are either the same or in reverse.

###### Theorem 3.3.

For , every -formation contains .

###### Proof.

The first permutations of contain a binary -formation [10]. If any permutation occurs times in , then its occurrences contain a copy of . Thus without loss of generality we may assume that has occurrences of and occurrences of .

Among the letters in , the permutation of contains letters in increasing order or letters in decreasing order by the Erdös-Szekeres theorem. If the former, then we have a copy of . Otherwise if the permutation has letters in decreasing order, then among those same letters the permutation has letters in increasing or decreasing order. This also makes a copy of . ∎

The next theorem confirms a conjecture from [10] that for all , where denotes the minimum for which there exists such that every -formation contains . This gives an upper bound of for [10, 20]. The sequence contains , so there was already a lower bound of for , where we are using Klazar’s sparsity result [15] in the first inequality. The next result uses the fact proved in [10] that is the minimum for which every binary -formation contains , where is the number of distinct letters in . Also in the next two results, we use the terminology *has* to mean that some subsequence of is an exact copy of , so *has* is stronger than *contains* .

###### Theorem 3.4.

For all , .

###### Proof.

The proof is trivial for , so suppose . It suffices by [10] to show that every binary -formation contains . Consider any binary -formation with permutations and . Without loss of generality suppose permutations through of have . Then has unless the first six letters of are or the last six letters of are .

If the first six letters of are , then has . So we assume that the last six letters of are . Now if the first six letters of are or , then has . Otherwise if the first six letters of are or , then first note that has if the through permutations of have . Otherwise the through permutations of have , in which case has . ∎

###### Corollary 3.5.

for .

Next we prove that , which implies that for .

###### Lemma 3.6.

For all , .

###### Proof.

First note that has an alternation of length , so . To check the upper bound it suffices to show that every binary -formation contains [10]. We will denote an arbitrary binary -formation with permutations or by Without loss of generality, assume that has . If has and , then has , has , has , has , and has . Thus we have . If has and then note that we can choose from , from , and from .

Now suppose that has both and . Note that if has and has then has It can be easily checked that does not have or does not have exactly when or , or .

Suppose that but .

If and : Then has zxy, has zyx, has the letter has and . Thus we have .

If and : Then has , has , has the letter , has and . Thus we have .

If and and Then has has and . Thus we have .

If and and Then has has and . Thus we have .

If and and Then has has and . Thus we have .

If and and : Then has , has and . Thus we have .

Next, suppose that , .

If or : then has and has and has . Thus in this case we have

If and : then has and has and has . Thus in this case we have

If and : then has and has and has . Thus in this case we have

If and and : then has and has and has . Thus in this case we have

If and and : then has and has and has . Thus in this case we have

If and and