Griddings of permutations and hardness of pattern matching

07/22/2021 ∙ by Vít Jelínek, et al. ∙ Charles University in Prague 0

We study the complexity of the decision problem known as Permutation Pattern Matching, or PPM. The input of PPM consists of a pair of permutations τ (the `text') and π (the `pattern'), and the goal is to decide whether τ contains π as a subpermutation. On general inputs, PPM is known to be NP-complete by a result of Bose, Buss and Lubiw. In this paper, we focus on restricted instances of PPM where the text is assumed to avoid a fixed (small) pattern σ; this restriction is known as Av(σ)-PPM. It has been previously shown that Av(σ)-PPM is polynomial for any σ of size at most 3, while it is NP-hard for any σ containing a monotone subsequence of length four. In this paper, we present a new hardness reduction which allows us to show, in a uniform way, that Av(σ)-PPM is hard for every σ of size at least 6, for every σ of size 5 except the symmetry class of 41352, as well as for every σ symmetric to one of the three permutations 4321, 4312 and 4231. Moreover, assuming the exponential time hypothesis, none of these hard cases of Av(σ)-PPM can be solved in time 2^o(n/log n). Previously, such conditional lower bound was not known even for the unconstrained PPM problem. On the tractability side, we combine the CSP approach of Guillemot and Marx with the structural results of Huczynska and Vatter to show that for any monotone-griddable permutation class C, PPM is polynomial when the text is restricted to a permutation from C.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Permutation Pattern Matching, or PPM, is one of the most fundamental decision problems related to permutations. In PPM, the input consists of two permutations: , referred to as the ‘text’, and , referred to as the ‘pattern’. The two permutations are represented as sequences of distinct integers. The goal is to determine whether the text contains the pattern , that is, whether has a subsequence order-isomorphic to (see Section 2 for precise definitions).

Bose, Buss and Lubiw [7] have shown that the PPM problem is NP-complete. Thus, most recent research into the complexity of PPM focuses either on parametrized or superpolynomial algorithms, or on restricted instances of the problem.

For a pattern of size and a text of size , a straightforward brute-force approach can solve PPM in time . This was improved by Ahal and Rabinovich [1] to , and then by Berendsohn, Kozma and Marx [6] to .

When is large in terms of , a brute-force approach solves PPM in time . The first improvement upon this bound was obtained by Bruner and Lackner [8], whose algorithm achieves the running time , which was in turn improved by Berendsohn, Kozma and Marx [6] to .

Guillemot and Marx [11] have shown, perhaps surprisingly, that PPM is fixed-parameter tractable with parameter , via an algorithm with running time , later improved to by Fox [10].

Restricted instances

Given that PPM is NP-hard on general inputs, various authors have sought to identify restrictions on the input permutations that would allow for an efficient pattern matching algorithm. These restrictions usually take the form of specifying that the pattern must belong to a prescribed set of permutations (the so-called -Pattern PPM problem), or that both the pattern and the text must belong to a set (known as -PPM problem). The most commonly considered choices for are sets of the form of all the permutations that do not contain a fixed pattern .

Note that for the class , consisting of all the increasing permutations, -Pattern PPM corresponds to the problem of finding the longest increasing subsequence in the given text, a well-known polynomially solvable problem [17]. Another polynomially solvable case is -Pattern PPM, which follows from more general results of Bose et al. [7].

In contrast, for the class of permutations avoiding a decreasing subsequence of length 3 (or equivalently, the class of permutations formed by merging two increasing sequences), -Pattern PPM is already NP-complete, as shown by Jelínek and Kynčl [15]. In fact, Jelínek and Kynčl show that -Pattern PPM is polynomial for and NP-complete otherwise.

For the more restricted -PPM problem, a polynomial algorithm for was found by Guillemot and Vialette [12] (see also Albert et al. [2]), and it follows that -PPM is polynomial for any of length at most 3. In contrast, the case (and by symmetry also ) is NP-complete [15]. It follows that -PPM is NP-complete whenever contains or as subpermutation, and in particular, it is NP-complete for any of length 10 or more.

In this paper, our main motivation is to close the gap between the polynomial and the NP-complete cases of -PPM. We develop a general type of hardness reduction, applicable to any permutation class that contains a suitable grid-like substructure. We then verify that for most choices of large enough, the class contains the required substructure. Specifically, we can prove that -PPM is NP-complete in the following cases:

  • Any of size at least 6.

  • Any of size 5, except the symmetry type of (i.e., the two symmetric permutations and ).

  • Any symmetric to one of , or .

Note that the list above includes the previously known case . Our hardness reduction, apart from being more general than previous results, has also the advantage of being more efficient: we reduce an instance of 3-SAT of size to an instance of PPM of size . This implies, assuming the exponential time hypothesis (ETH), that none of these NP-complete cases of -PPM can be solved in time . Previously, this lower bound was not known to hold even for the unconstrained PPM problem.

Grid classes

The sets of permutations of the form , i.e., the sets determined by a single forbidden pattern, are the most common type of permutation sets considered; however, such sets are not necessarily the most convenient tools to understand the precise boundary between polynomial and NP-complete cases of PPM. We will instead work with the more general concept of permutation class, which is a set of permutations with the property that for any , all the subpermutations of are in as well.

A particularly useful family of permutation classes are the so-called grid classes. When dealing with grid classes, it is useful to represent a permutation by its diagram, which is the set of points . A grid class is defined in terms of a gridding matrix , whose entries are (possibly empty) permutation classes. We say that a permutation has an -gridding, if its diagram can be partitioned, by horizontal and vertical cuts, into an array of rectangles, where each rectangle induces in a subpermutation from the permutation class in the corresponding cell of . The permutation class then consists of all the permutations that have an -gridding.

To a gridding matrix we associate a cell graph, which is the graph whose vertices are the entries in that correspond to infinite classes, with two vertices being adjacent if they belong to the same row or column of and there is no other infinite entry of between them.

In the griddings we consider in this paper, a prominent role is played by four specific classes, forming two symmetry pairs: one pair are the monotone classes and , containing all the increasing and all the decreasing permutations, respectively. Note that any infinite class of permutations contains at least one of and as a subclass, by the Erdős–Szekeres theorem [9].

The other relevant pair of classes involves the so-called Fibonacci class, denoted , and its mirror image . The Fibonacci class can be defined as the class of permutations avoiding the three patterns , and , or equivalently, it is the class of permutations satisfying for every .

Griddings have been previously used, sometimes implicitly, in the analysis of special cases of PPM, where they were applied both in the design of polynomial algorithms [2, 12], and in NP-hardness proofs [15, 16]. In fact, all the known NP-hardness arguments for special cases of -Pattern PPM are based on the existence of suitable grid subclasses of the class . In particular, previous results of the authors [16] imply that for any gridding matrix that only involves monotone or Fibonacci cells, -Pattern PPM is polynomial when the cell graph of is a forest, and it is NP-complete otherwise. Of course, if -Pattern PPM is polynomial then -PPM is polynomial as well. However, the results in this paper identify a broad family of examples where -PPM is polynomial, while -Pattern PPM is known to be NP-complete.

Our main hardness result, Theorem 3.1, can be informally rephrased as a claim that -PPM is hard for a class whenever contains, for each and a fixed , a grid subclass whose cell graph is a path of length , and at least of its cells are Fibonacci classes. A somewhat less technical consequence, Corollary 3.9, says that -PPM is NP-hard whenever the cell graph of is a cycle with no three vertices in the same row or column and with at least one Fibonacci cell.

Corollary 3.9 is, in a certain sense, best possible, since our main tractability result, Theorem 4.2, states that -PPM is polynomial whenever is monotone-griddable, that is, , where contains only monotone (or empty) cells. Moreover, by a result of Huczynska and Vatter [13], every class that does not contain or is monotone griddable. Taken together, these results show that -PPM is polynomial whenever no cell of contains or as a subclass.

2 Preliminaries

A permutation of length is a sequence in which each element of the set appears exactly once. When writing out short permutations explicitly, we shall omit all punctuation and write, e.g., for the permutation . The permutation diagram of is the set of points in the plane. Observe that no two points from share the same - or -coordinate. We say that such a set is in general position. Note that we blur the distinction between permutations and their permutation diagrams, e.g., we shall refer to ‘the point of ’.

For a point in the plane, we let denote its horizontal coordinate and its vertical coordinate. Two finite sets in general position are order-isomorphic, or just isomorphic for short, if there is a bijection such that for any pair of points of we have if and only if , and if and only if ; in such case, the function is the isomorphism from to . The reduction of a finite set in general position is the unique permutation such that is isomorphic to .

A permutation contains a permutation , denoted by , if there is a subset that is isomorphic to . Such a subset is then called an occurrence of in , and the isomorphism from to is an embedding of into . If does not contain , we say that avoids .

A permutation class is any down-set of permutations, i.e., a set such that if and then also . For a permutation , we let denote the class of all -avoiding permutations. We shall throughout use the symbols and as short-hands for the class of increasing permutations and the class of decreasing permutations .

Observe that for every permutation of length at most , the permutation diagram is a subset of the set , called -box. This fact motivates us to extend the usual permutation symmetries to bijections of the whole -box. In particular, there are eight symmetries generated by:

reversal

which reflects the -box through its vertical axis, i.e., the image of a point is the point ,

complement

which reflects the -box through its horizontal axis, i.e., the image of a point is the point ,

inverse

which reflects the -box through its ascending diagonal axis, i.e., the image of a point is the point .

We say that a permutation is symmetric to a permutation if can be transformed into by any of the eight symmetries generated by reversal, complement and inverse. The symmetry type111We chose the term ‘symmetry type’ over the more customary ‘symmetry class’, to avoid possible confusion with the notion of permutation class. of a permutation is the set of all the permutations symmetric to .

The symmetries generated by reversal, complement and inverse can be applied not only to individual permutations but also to their classes. Formally, if is one of the eight symmetries and is a permutation class, then refers to the set . We may easily see that is again a permutation class.

Consider a pair of permutations of length and of length . The inflation of a point of by is the reduction of the point set

Informally, we replace the point with a tiny copy of .

The direct sum of and , denoted by , is the result of inflating the ‘1’ in 12 with and then inflating the ‘2’ with . Similarly, the skew sum of and , denoted by , is the result of inflating the ‘2’ in 21 with and then inflating the ‘1’ with . If a permutation cannot be obtained as direct sum of two shorter permutations, we say that is sum-indecomposable

and if it cannot be obtained as a skew sum of two shorter permutations, we say that it is

skew-indecomposable. Moreover, we say that a permutation class is sum-closed if for any we have . We define skew-closed analogously.

We define the sum completion of a permutation to be the permutation class

Analogously, we define the skew completion of . The class is known as the Fibonacci class.

2.1 Grid classes

When we deal with matrices, we number their rows from bottom to top to be consistent with the Cartesian coordinates we use for permutation diagrams. For the same reason, we let the column coordinates precede the row coordinates; in particular, a matrix is a matrix with columns and rows, and for a matrix , we let denote its entry in column and row .

A matrix whose entries are permutation classes is called a gridding matrix. Moreover, if the entries of belong to the set then we say that is a monotone gridding matrix.

A -gridding of a permutation of length are two weakly increasing sequences and . For each and , we call the set of points such that and the -cell of . An -gridding of a permutation is a -gridding such that the reduction of the -cell of belongs to the class  for every and . If has an -gridding, then is said to be -griddable, and the grid class of , denoted by , is the class of all -griddable permutations.

The cell graph of the gridding matrix , denoted , is the graph whose vertices are pairs such that is an infinite class, with two vertices being adjacent if they share a row or a column of and all the entries between them are finite or empty. See Figure 1. We slightly abuse the notation and use the vertices of for indexing , i.e., for a vertex of , we write to denote the corresponding entry.

A proper-turning path in is a path such that no three vertices of share the same row or column. Similarly, a proper-turning cycle in is a cycle such that no three vertices of share the same row or column.

           

Figure 1: A gridding matrix on the left and a permutation equipped with an -gridding on the right. Empty entries of are omitted and the edges of are displayed inside .

Let be a permutation, and let be its -gridding, where and . A permutation together with a gridding form a gridded permutation. When dealing with gridded permutations, it is often convenient to apply symmetry transforms to individual columns or rows of the gridding. Specifically, the reversal of the -th column of is the operation which generates a new -gridded permutation by taking the diagram of , and then reflecting the rectangle in the diagram through its vertical axis, producing the diagram of the new permutation . Note that differs from by having all the entries at positions in reverse order. If , then .

Similarly, the complementation of the -th row of the -gridded permutation is obtained by taking the rectangle and turning it upside down, obtaining a permutation diagram of a new permutation.

Column reversals and row complementations can also be applied to gridding matrices: a reversal of a column in a gridding matrix simply replaces all the classes appearing in the entries of the -th column by their reverses; a row complementation is defined analogously.

We often need to perform several column reversals and row complementations at once. To describe such operations succinctly, we introduce the concept of -orientation. A -orientation is a pair of functions with and . To apply the orientation to a -gridded permutation means to create a new permutation by reversing in each column for which and complementing each row for which . Note that the order in which we perform the reversals and complementations does not affect the final outcome. Note also that is an involution, that is, for any -gridded permutation .

We may again also apply to a gridding matrix . By performing, in some order, the row reversals and column complementations prescribed by on the matrix , we obtain a new gridding matrix . For instance, taking the gridding matrix and applying reversal to its first column yields the gridding matrix . Observe that if is an -gridding of a permutation , then the same gridding is also an -gridding of the permutation .

Let be a monotone gridding matrix. An orientation of is consistent if all the nonempty entries of are equal to . For instance, the matrix has a consistent orientation acting by reversing the first column and complementing the first row, while the matrix has no consistent orientation.

A vital role in our arguments is played by the concept of monotone griddability. We say that a class is monotone-griddable if there exists a monotone gridding matrix such that is contained in . Huczynska and Vatter [13] provided a neat and useful characterization of monotone-griddable classes.

Theorem 2.1 (Huczynska and Vatter [13]).

A permutation class is monotone-griddable if and only if it contains neither the Fibonacci class nor its symmetry .

A monotone grid class where both and are non-empty is called a horizontal monotone juxtaposition. Analogously, a vertical monotone juxtaposition is a monotone grid class with both and non-empty. A monotone juxtaposition is simply a class that is either a horizontal or a vertical monotone juxtaposition.

2.2 Pattern matching complexity

In this paper, we deal with the complexity of the decision problem known as -PPM. For a permutation class , the input of -PPM is a pair of permutations with both and belonging to . An instance of -PPM is then accepted if contains , and rejected if avoids . In the context of pattern-matching, is referred to as the pattern, while is the text.

Note that an algorithm for -PPM does not need to verify that the two input permutations belong to the class , and the algorithm may answer arbitrarily on inputs that fail to fulfill this constraint. Decision problems that place this sort of validity restrictions on their inputs are commonly known as promise problems.

Our NP-hardness results for -PPM are based on a general reduction scheme from the classical 3-SAT problem. Given that -PPM is a promise problem, the reduction must map instances of 3-SAT to valid instances of -PPM, i.e., the instances where both and belong to .

On top of NP-hardness arguments, we also provide time-complexity lower bounds for the hard cases of -PPM. These lower bounds are conditioned on the exponential-time hypothesis (ETH), a classical hardness assumption which states that there is a constant such that 3-SAT cannot be solved in time , where is the number of variables of the 3-SAT instance. In particular, ETH implies that 3-SAT cannot be solved in time .

Given an instance of -PPM, we always use to denote the length of the text . We also freely assume that has length at most since otherwise the instance can be straightforwardly rejected. Following established practice, we express our complexity bounds for -PPM in terms of . Note that inputs of -PPM of size actually require bits to encode.

3 Hardness of PPM

In this section, we present the main technical hardness result and then derive its several corollaries. However, we first need to introduce one more definition.

We say that a permutation class has the -rich path property for a class if there is a positive constant such that for every , the class contains a grid subclass whose cell graph is a proper-turning path of length with at least entries equal to . Moreover, we say that has the computable -rich path property, if has the -rich path property and there is an algorithm that, for a given , outputs a witnessing proper-turning path of length with at least copies of in time polynomial in .

Theorem 3.1.

Let be a permutation class with the computable -rich path property for a non-monotone-griddable class . Then -PPM is NP-complete, and unless ETH fails, there can be no algorithm that solves -PPM

  • in time if moreover contains any monotone juxtaposition,

  • in time otherwise.

We remark, without going into detail, that the two lower bounds we obtained under ETH are close to optimal. It is clear that the bound of matches, up to the term in the exponent, the trivial brute-force algorithm for PPM. Moreover, the lower bound of for -PPM also cannot be substantially improved without adding assumptions about the class . Consider for instance the class . As we shall see in Proposition 3.8, this class has the computable -rich path property, and therefore the conditional lower bound applies to it. However, by using the technique of Ahal and Rabinovich [1], which is based on the concept of treewidth of permutations, we can solve -PPM (even -Pattern PPM) in time . This is because we can show that a permutation of size has treewidth at most . We omit the details of the argument here.

3.1 Overview of the proof of Theorem 3.1

The proof of Theorem 3.1 is based on a reduction from the well-known 3-SAT problem. The individual steps of the construction are rather technical, and we therefore begin with a general overview if the reduction. In Subsection 3.2, we then present the reduction in full detail, together with the proof of correctness.

Suppose that is a class with the computable -rich path property, where is not monotone griddable. This means that contains the Fibonacci class or its reversal as subclass. Suppose then, without loss of generality, that contains .

To reduce 3-SAT to -PPM, consider a 3-SAT formula , with variables and clauses. We may assume that each clause of has exactly 3 literals.

Let be an integer whose value will be specified later. By the -rich path property, contains a grid subclass where the cell graph of is a path of length , in which a constant fraction of cells is equal to .

To simplify our notation in this high-level overview, we will assume that the cell graph of corresponds to an increasing staircase. More precisely, the cells of representing infinite classes can be arranged into a sequence , where is the bottom-left cell of

, each odd-numbered cell

corresponds to the diagonal cell , and each even numbered cell corresponds to . All the remaining cells of are empty. To simplify the exposition even further, we will assume that each odd-numbered cell of the path is equal to and each even-numbered cell is equal to . See Figure 2.

Figure 2: The gridding matrix , the gridded permutation (the pattern) and the gridded permutation (the text), used in the simplified overview of the proof of Theorem 3.1.

With the gridding matrix specified above, we will construct two -gridded permutations, the pattern and the text , such that can be embedded into if and only if the formula is satisfiable. We will describe and geometrically, as permutation diagrams, which are partitioned into blocks by the -gridding. We let denote the part of corresponding to the cell of , and similarly we let be the part of corresponding to .

To get an intuitive understanding of the reduction, it is convenient to first restrict our attention to grid-preserving embeddings of into , that is, to embeddings which map the elements of to elements of for each .

The basic building blocks in the description of and are the atomic pairs, which are specific pairs of points appearing inside a single block or . It is a feature of the construction that in any grid preserving embedding of into , an atomic pair inside a pattern block is mapped to an atomic pair inside the corresponding text block . Moreover, each atomic pair in or is associated with one of the variables of , and any grid-preserving embedding will maintain the association, that is, atomic pairs associated to a variable inside will map to atomic pairs associated to in .

To describe and , we need to specify the relative positions of the atomic pairs in two adjacent blocks and (or and ). These relative positions are given by several typical configurations, which we call gadgets. Several examples of gadgets are depicted in Figure 3. In the figure, the pairs of points enclosed by an ellipse are atomic pairs. The choose, multiply and merge gadgets are used in the construction of , while the pick and follow gadgets are used in . The copy gadget will be used in both. We also need more complicated gadgets, namely the flip gadgets of Figure 4, which span more than two consecutive blocks. In all cases, the atomic pairs participating in a single gadget are all associated to the same variable of .

The copy gadget      The choose gadget      The pick gadget

The multiply gadget      The merge gadget      The follow gadget

Figure 3: The constructions of simple gadgets. The tile is always on the left and the tile is on the right. The dotted lines show the relative vertical order of points.

The sequence of pattern blocks , as well as their corresponding text blocks , is divided into several contiguous parts, which we call phases. We now describe the individual phases in the order in which they appear.

The initial phase and the assignment phase.

The initial phase involves a single pattern block and the corresponding text block . Both and consist of an increasing sequence of points, divided into consecutive atomic pairs and , numbered in increasing order. The pairs and are both associated to the variable . Clearly any embedding of into will map the pair to the pair , for each .

The initial phase is followed by the assignment phase, which also involves only one pattern block and the corresponding text block . will consist of an increasing sequence of atomic pairs , where each is a decreasing pair, i.e., a copy of 21. Moreover, forms the pick gadget, so the first two pattern blocks can be viewed as a sequence of pick gadgets stacked on top of each other.

The block then consists of atomic pairs , positioned in such a way that is a choose gadget. Thus, is a sequence of choose gadgets stacked on top of each other, each associated with one of the variables of .

In a grid-preserving embedding of into , each pick gadget must be mapped to the corresponding choose gadget , with mapped to , and mapped either to or to . There are thus grid-preserving embeddings of into , and these embeddings encode in a natural way to the assignments of truth values to the variables of . Specifically, if is mapped to , we will say that is false, while if maps to , we say that is true. The aim is to ensure that an embedding of into can be extended to an embedding of into if and only if the assignment encoded by the embedding satisfies .

Each atomic pair that appears in one of the text blocks is not only associated with a variable of , but also with its truth value; that is, there are ‘true’ and ‘false’ atomic pairs associated with each variable . The construction of and ensures that in an embedding of into in which is mapped to (corresponding to setting to false), all the atomic pairs associated to in the subsequent stages of will map to false atomic pairs associated to in , and conversely, if is mapped to , then the atomic pairs of associated to will only map to the true atomic pairs associated to in .

   

Figure 4: A flip text gadget on the left and a flip pattern gadget on the right. The first tile pictured is and the last tile is where . As before, the dotted lines show the relative order of points.
The multiplication phase.

The purpose of the multiplication phase is to ‘duplicate’ the information encoded in the assignment phase. Without delving into the technical details, we describe the end result of the multiplication phase and its intended behaviour with respect to embeddings. Let be the number of occurrences (positive or negative) of the variable in . Note that , since has clauses, each of them with three literals. Let and be the final pattern block and text block of the multiplication phase. Then is an increasing sequence of increasing atomic pairs, among which there are atomic pairs associated to . Moreover, the pairs are ordered in such a way that the pairs associated to are at the bottom, followed by the pairs associated to and so on. The structure of is similar to , except that has atomic pairs. In fact, we may obtain from by replacing each atomic pair associated to a variable by two adjacent atomic pairs , associated to the same variable, where is false and is true.

It is useful to identify each pair as well as the corresponding two pairs with a specific occurrence of in . Thus, each literal in is represented by one atomic pair in and two adjacent atomic pairs of opposite truth values in .

The blocks and are constructed in such a way that any embedding of into that encodes an assignment in which is false has the property that all the atomic pairs in associated to are mapped to the false atomic pairs of associated to , and similarly, when is encoded as true in the assignment phase, the pairs of associated to are only mapped to the true atomic pairs of . Thus, the mapping of any atomic pair of encodes the information on the truth assignment of the associated variable.

The multiplication phase is implemented by a combination of multiply gadgets and flip text gadgets in , and copy gadgets and flip pattern gadgets in . It requires no more than blocks in and , i.e., .

The sorting phase.

The purpose of the sorting phase is to rearrange the relative positions of the atomic pairs. While at the end of the multiplication phase, the pairs representing occurrences of the same variable appear consecutively, after the sorting phase, the pairs representing literals belonging to the same clause will appear consecutively. More precisely, letting and denote the last pattern block and the last text block of the sorting phase, has the same number of atomic pairs associated to a given variable as , and similarly for and . If are the clauses of , then for each clause , contains three consecutive atomic pairs corresponding to the three literals in , and contains the corresponding six atomic pairs, again appearing consecutively. Similarly as in and , each atomic pair in must map to an atomic pair in representing the same literal and having the correct truth value encoded in the assignment phase.

To prove Theorem 3.1, we need two different ways to implement the sorting phase, depending on whether the class contains a monotone juxtaposition or not. The first construction, which we call sorting by gadgets, does not put any extra assumptions on . However, it may require up to blocks to perform the sorting, that is .

The other implementation of the sorting phase, which we call sorting by juxtapositions is only applicable when contains a monotone juxtaposition, and it can be performed with only blocks. The difference between the lengths of the two versions of sorting is the reason for the two different lower bounds in Theorem 3.1.

The evaluation phase.

The final phase of the construction is the evaluation phase. The purpose of this phase is to ensure that for any embedding of into , the truth assignment encoded by the embedding satisfies all the clauses of . For each clause , we attach suitable gadgets to the atomic pairs in and representing the literals of . Using the fact that the atomic pairs representing the literals of a given clause are consecutive in and , this can be done for all the clauses simultaneously, with only blocks in and . This completes an overview of the hardness reduction proving Theorem 3.1.

When the reduction is performed with sorting by gadgets, it produces permutations and of size , since we have blocks and each block has size . When sorting is done by juxtapositions, the number of blocks drops to , hence and have size . ETH implies that 3-SAT with variables and clauses cannot be solved in time  [14]. From this, the lower bounds from Theorem 3.1 follow.

The details of the reduction, as well as the full correctness proof, are presented in the following subsections.

3.2 Details of the hardness reduction

Our job is to construct a pair of permutations and , both having a gridding corresponding to a -rich path, with the property that the embeddings of into will simulate satisfying assignments of a given 3-SAT formula. We will describe the two permutations in terms of their diagrams, or more precisely, in terms of point sets order-isomorphic to the diagrams, constructed inside the prescribed gridding.

The formal description of the point sets faces several purely technical complications: firstly, some monotone cells of the given -rich path correspond to , others to , and it would be a nuisance to distinguish the two symmetric possibilities in every step of the construction. We will sidestep the issue by fixing a consistent orientation of the gridding which will, informally speaking, allow us to treat the monotone cells as if they were all increasing.

Another complication stems from the fact that when describing the contents of a given cell in the gridding, the coordinates of the points in the cell depend on the position of the cell within the gridding matrix. It would be more convenient to assume that each cell has its own local coordinate system whose origin is in the bottom-left corner of the cell. We address this issue by treating each cell as an independent ‘tile’, and only in the end of the construction we translate the individual tiles (after applying appropriate symmetries implied by the consistent orientation) to their proper place in the gridding.

To make these informal considerations rigorous, we now introduce the concept of -assembly.

3.2.1 -assembly

Recall that a orientation is a pair of functions , and .

A finite subset of the -box in general position is called an -tile and a family of -tiles is a set where each is an -tile. Let be a orientation and let be a family of -tiles for , . The -assembly of is the point set defined as follows.

First, we define for every , the point set

where is an identity if and reversal otherwise, while is an identity if and complement otherwise. Next, we set . The set might not be in a general position. If that is the case, we rotate clockwise by a tiny angle such that there are no longer any points with a shared coordinate, and at the same time, the order of all the other points is preserved. We call the resulting point set the -assembly of . See Figure 5.

The -assembly allows us to describe our constructions more succinctly and independently from the actual matrix . Recall that an orientation of a monotone gridding matrix is consistent, if every non-empty entry of is equal to . Gridding matrices whose cell graph is a path always admit a consistent orientation – this follows from the following more general result of Vatter and Waton [18].

Lemma 3.2 (Vatter and Waton [18]).

Any monotone gridding matrix whose cell graph is acyclic has a consistent orientation.

           

Figure 5: A family of tiles on the left and its -assembly on the right for a orientation given next to each row and column on the right. Notice that the -assembly of would belong to the class for any such that and .

3.2.2 The reduction

We describe a reduction from 3-SAT to -PPM. Let be a given 3-CNF formula with variables and clauses . We furthermore assume, without loss of generality, that each clause contains exactly three literals. We will construct permutations such that is satisfiable if and only if contains .

Let be a gridding matrix such that is a subclass of , the cell graph is a proper-turning path of sufficient length to be determined later, a constant fraction of its entries is equal to , and the remaining entries of the path are monotone. We aim to construct and such that they both belong to . We remark that this is the only step where the computable part of the computable -rich path property comes into play.

First, we label the vertices of the path as choosing the direction such that at least half of the -entries share a row with their predecessor. We claim that there is a orientation such that the class is equal to for every monotone entry and the class contains for every -entry . To see this, consider a gridding matrix obtained by replacing every -entry in with if contains or with if contains . It then suffices to apply Lemma 3.2 on .

Our plan is to simultaneously construct two families of -tiles and and then set and to be the -assemblies of and , respectively. We abuse the notation and for any family of tiles (in particular for and ), we use instead of to denote the tile corresponding to the -th cell of the path.

For now, we will only consider restricted embeddings that respect the partition into tiles and deal with arbitrary embeddings later. Let be an -assembly of and an -assembly of ; we then say that an embedding of into is grid-preserving if the image of tile is mapped to the image of for every and . We slightly abuse the terminology in the case of grid-preserving embeddings and say that a point in the tile is mapped to a point in the tile instead of saying that the image of under the -assembly is mapped to the image of under the -assembly.

Many of the definitions to follow are stated for a general family of tiles as we later apply them on both and . We say that a pair of points in the tile sandwiches a set of points in the tile if for every point

  • in case and occupy a common row, or

  • in case and occupy a common column.

Moreover, we say that a pair of points strictly sandwiches a set of points if the pair sandwiches and there exists no other point sandwiched by .

3.2.3 Simple gadgets

We construct the tiles in and from pairs of points that we call atomic pairs. Before constructing the actual tile families, we describe several simple gadgets that we will utilize later. All these gadgets include either one atomic pair or two atomic pairs for in the tile and one atomic pair or two atomic pairs for in the tile . Moreover, the coordinates of the points in are fully determined from the coordinates of the points in . We assume that each tile is formed as direct sum of the corresponding pieces of individual gadgets; in other words, if are point sets of two different gadgets, then either lies entirely to the right and above or vice versa.

We describe the gadgets in the case when and share a common row and is left from , as the other cases are symmetric. Moreover, we assume that in the case of a single atomic pair in , and that in the case of two atomic pairs in . See Figure 3.

The copy gadget.

The copy gadget consists of one atomic pair in and one atomic pair in defined as

where is small positive value such that form an occurrence of 12. We say that the copy gadget connects to . Since sandwiches , we can use the copy gadget to extend the construction to additional tiles along the path while preserving the embedding properties.

Observation 3.3.

Suppose there is a copy gadget in that connects an atomic pair in the tile to an atomic pair in the tile , and a copy gadget in that connects an atomic pair in the tile to an atomic pair in the tile . In any grid-preserving embedding of into , if is mapped to , then is mapped to .

The multiply gadget.

The multiply gadget is only slightly more involved than the previous one, and it consists of one atomic pair in and two atomic pairs in the tile defined as

where is small positive value such that form an occurrence of . We say that the multiply gadget multiplies to and . A property analogous to Observation 3.3 holds when both text and pattern contain a multiply gadget.

The choose gadget.

The choose gadget consists of one atomic pair in and two atomic pairs in the tile defined as

where is small positive value such that form an occurrence of . We say that the choose gadget branches to and .

The pick gadget.

The pick gadget is essentially identical to the copy gadget except that the pair forms an occurrence of instead of . Formally, the pick gadget consists of one atomic pair in and one atomic pair in defined as

where is chosen such that form an occurrence of 21. We say that the pick gadget connects to .

The name of the choose and pick gadgets becomes clear with the following observation that follows from the fact that 2143 admits only two possible embeddings of the pattern 21.

Observation 3.4.

Suppose there is a choose gadget in that branches an atomic pair in the tile to two atomic pairs and in the tile , and a pick gadget in that connects an atomic pair in the tile to an atomic pair in the tile . In any grid-preserving embedding of into , if is mapped to then is mapped either to or to .

The merge gadget.

The merge gadget consists of two atomic pairs , in and one atomic pair in defined as

where is chosen small such that the relative order of the points of merge gadget and the points outside is not changed. Notice that now sandwiches the set . We say that the merge gadget merges and into .

The follow gadget.

This gadget is almost identical to the pick gadget except that here sandwiches . Formally, the follow gadget contains one atomic pair in and one atomic pair in defined as

where is chosen small such that the relative order of follow gadget with points outside is not changed. We say that the follow gadget connects to .

We can observe that merge and follow gadgets act in a way as an inverse to choose and pick gadgets.

Observation 3.5.

Suppose there is a merge gadget in that merges atomic pairs and in the tile into an atomic pair in the tile , and a follow gadget in that connects an atomic pair in the tile to an atomic pair in the tile . In any grid-preserving embedding of into , if