Funding Manuel Bodirsky: Funded by the European Union (project POCOCOP, ERC Synergy grant No. 101071674). Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research Council Executive Agency. Neither the European Union nor the granting authority can be held responsible for them.
Disclosure of AI assistance.
ChatGPT with the GPT 5.6 Sol model was used during development of the fixed forbidden set B f i n a l B_{\mathrm{final}} B final . The interaction used Generalized Coloring of Permutations by Jelínek, Opler, and Valtr [12 ] as background and involved about 150 prompts over about four days. An initial suggested construction had 224 forbidden patterns, the longest of length 481. The suggestions to use increasing oscillations and simple permutations came from ChatGPT. The routing idea came from the provided paper. The construction was subsequently checked and simplified by the authors. The entire paper was thoroughly revised by the authors, and GPT 6 Astra and Claude Opus 5.5 were used for proofreading. The authors take full responsibility for the final text.
Introduction
Permutation patterns describe the relative order of selected entries in a permutation. A permutation contains a pattern if some subsequence has the same relative order as that pattern, and avoids it otherwise. For example, 2413 contains 132 through the entries 2, 4, 3, but avoids 321. Pattern avoidance provides a common language for structural and counting questions about permutations [20 ] .
For a finite set of permutations B B B , let Av n ( B ) \operatorname{Av}_n(B) Av n ( B ) be the permutations of length n n n that avoid every member of B B B . We study the algorithmic task of enumerating all members of Av n ( B ) \operatorname{Av}_n(B) Av n ( B ) . Here enumeration means outputting the objects (whereas counting means computing their number). For fixed B B B , let EnumAvoid B \operatorname{EnumAvoid}_B EnumAvoid B denote the problem of enumerating all members of Av n ( B ) \operatorname{Av}_n(B) Av n ( B ) , without repetitions, where n n n is given in unary.
An enumeration algorithm has polynomial delay if the time before the first output, between consecutive outputs, and between the last output and termination is bounded by a polynomial in the input size. This also requires polynomial-time termination when there is no output. We write DelayP for the class of enumeration problems admitting such an algorithm. An enumeration algorithm is output-polynomial if its total running time is bounded by a polynomial in the input size and the total encoded size of all outputs. We write OutputP for the corresponding class [13 , 18 ] .
Successive insertions of new maxima give a natural search tree, which we call the insert-maximum tree . When the class is nonempty, the root is the empty permutation. The children of a permutation are obtained by inserting the next maximum such that the resulting permutation is still in the class. Deleting the maximum gives each nonroot node a unique parent, so level n n n contains exactly Av n ( B ) \operatorname{Av}_n(B) Av n ( B ) , without repetitions. Therefore, the required permutations can be enumerated with depth-first search. The difficulty is that a finite branch may contain many nodes but no permutation of the target length.
To guide the traversal, we consider an auxiliary decision problem. Fix a finite forbidden set B B B . Given a permutation ρ \rho ρ and a nonnegative integer k k k , the problem ExtendMax B \operatorname{ExtendMax}_B ExtendMax B asks whether ρ \rho ρ has a B B B -avoiding extension obtained by inserting k k k new maxima. Equivalently, it asks whether the subtree rooted at ρ \rho ρ reaches depth k k k . If this problem is solvable in polynomial time, then flashlight search (a general method for turning an extension oracle into an enumeration algorithm [18 Section 3.3] ) can discard every branch that contains no output and thereby enumerate the target level with polynomial delay. We use ExtendMax B u n \operatorname{ExtendMax}^{\mathrm{un}}_B ExtendMax B un with the superscripts un and bin to specify whether the given k ∈ N k \in\mathbb{N} k ∈ N is encoded in unary or in binary.
Results
Every fixed finite set B B B of forbidden permutations admits output-polynomial avoider enumeration. We give sufficient conditions on B B B for polynomial-time extension and polynomial-delay enumeration. For a nonempty set of permutations B B B , we write ∥ B ∥ : = max β ∈ B ∣ β ∣ \lVert B\rVert:= \max_{\beta\in B} \lvert\beta\rvert ∥ B ∥ := max β ∈ B ∣ β ∣ . A node is viable if it has extensions of arbitrary depth, and mortal otherwise. A pocket is a maximal finite subtree.
Theorem 1.1. For every finite set of permutations B B B , the following hold.
EnumAvoid B ∈ \operatorname{EnumAvoid}_B \in EnumAvoid B ∈ OutputP.
ExtendMax B b i n \operatorname{ExtendMax}^{\mathrm{bin}}_B ExtendMax B bin belongs to NP. For nonempty B B B containing only nonempty patterns, every mortal permutation ρ \rho ρ has depth at most ( ∥ B ∥ − 1 ) 2 ( ∣ ρ ∣ + 1 ) (\lVert B\rVert- 1)^2(\lvert\rho\rvert+ 1) (∥ B ∥ − 1 ) 2 (∣ ρ ∣ + 1 ) .
If there is a polynomial p p p such that every pocket rooted at ρ \rho ρ has at most p ( ∣ ρ ∣ ) p(\lvert\rho\rvert) p (∣ ρ ∣) nodes, then ExtendMax B u n \operatorname{ExtendMax}^{\mathrm{un}}_B ExtendMax B un and ExtendMax B b i n \operatorname{ExtendMax}^{\mathrm{bin}}_B ExtendMax B bin belong to P, and there is a polynomial delay algorithm for the extension enumeration problem.
If Av ( B ) \operatorname{Av}(B) Av ( B ) is well-quasi-ordered, if it has a regular insertion encoding, or if B B B consists of nonempty patterns and omits one of the leftmost, interior, or rightmost maximum-position types, then there is a constant D D D such that every pocket has depth at most D D D . Consequently, every pocket rooted at ρ \rho ρ has size bounded by a polynomial in ∣ ρ ∣ \lvert\rho\rvert ∣ ρ ∣ , as required in the preceding item.
A partial order is well-quasi-ordered if it contains neither an infinite strictly descending chain nor an infinite antichain. Since the poset of finite permutations under pattern containment has no infinite strictly descending chains, a permutation class is well-quasi-ordered if and only if it contains no infinite antichain. This concept has been studied e.g. in [4 ] . Regular insertion encodings have been introduced in [2 Section 4] .
Our main hardness result shows that efficient extension cannot be expected for every fixed basis. The result holds even when the forbidden set is fixed: only the starting permutation and the target depth are part of the input.
Theorem 1.2. There exists a set B f i n a l B_{\mathrm{final}} B final of 55 permutations, each of length at most 191, such that ExtendMax B f i n a l u n \operatorname{ExtendMax}^{\mathrm{un}}_{B_{\mathrm{final}}} ExtendMax B final un and ExtendMax B f i n a l b i n \operatorname{ExtendMax}^{\mathrm{bin}}_{B_{\mathrm{final}}} ExtendMax B final bin are NP-complete.
We prove NP-hardness by reduction from monotone NAE-3SAT. In the constructed starting permutation, each Boolean state is represented by a pair of insertion sites ; choosing one of the two sites encodes a bit. Fixed forbidden patterns ensure that an extension of maximum possible depth chooses exactly one site from every pair. Further patterns enforce equality along wires and the not-all-equal condition on clause triples. Increasing oscillations and simple marker permutations make these local constraints recognizable by ordinary pattern containment. A substantial part of the proof excludes unintended occurrences of the forbidden patterns.
For a fixed finite set B B B of forbidden permutations, Hanika introduced the forbidden permutation constraint satisfaction problem FPCSP ( B ) \operatorname{FPCSP}(B) FPCSP ( B ) , where the input consists of two acyclic relations on a common finite set, and the task is to decide whether these relations can be completed to linear orders whose induced permutation avoids the fixed forbidden set B B B [10 Problem 4.1] . Hanika asked whether there exists a fixed finite set B B B of forbidden patterns for which FPCSP ( B ) \operatorname{FPCSP}(B) FPCSP ( B ) is NP-complete. Since insert-maximum extension is a restriction of this problem, Theorem 1.2 answers his question affirmatively: FPCSP ( B f i n a l ) \operatorname{FPCSP}(B_{\mathrm{final}}) FPCSP ( B final ) is NP-complete.
The hardness conclusion does not transfer to avoider enumeration. In particular, we do not prove that enumerating Av n ( B f i n a l ) \operatorname{Av}_n(B_{\mathrm{final}}) Av n ( B final ) lacks a polynomial-delay algorithm. The distinction between an empty start and a supplied start is essential.
Related work
The insert-maximum tree is also called the pattern-avoidance tree [19 Section 1] . Kuszmaul uses the same insertion rule in an output-sensitive algorithm generating avoiders of all lengths at most n n n [15 Algorithm 2] . Its runtime bound involves the total size of these levels and does not directly control the delay at a single target level. Gray-code constructions give efficient generation for several particular classes [7 , 6 ] . Hartung, Hoang, Mütze, and Williams develop a broader generation framework based on permutation languages [11 ] .
The insert-maximum tree and enumeration
We first fix the notation and the input conventions. The set B B B of forbidden permutations is fixed throughout the paper. All algorithmic constants may depend on it.
A permutation π = π 1 ⋯ π n \pi= \pi_1 \cdots\pi_n π = π 1 ⋯ π n of length ∣ π ∣ = n |\pi| = n ∣ π ∣ = n contains each element of [ n ] = { 1 , … , n } [n] = \{1,\ldots,n\} [ n ] = { 1 , … , n } exactly once. We call π i \pi_i π i the entry at position i i i . The empty permutation is denoted by ε \varepsilon ε . For distinct numbers a 1 , … , a m a_1,\ldots,a_m a 1 , … , a m , their standardization st ( a 1 , … , a m ) \operatorname{st}(a_1,\ldots,a_m) st ( a 1 , … , a m ) is the unique permutation with the same relative order. A set of entries { π i 1 , … , π i m } \{\pi_{i_1},\ldots,\pi_{i_m}\} { π i 1 , … , π i m } , where i 1 < ⋯ < i m i_1 < \cdots< i_m i 1 < ⋯ < i m , is an occurrence of a permutation τ \tau τ in π \pi π if st ( π i 1 , … , π i m ) = τ \operatorname{st}(\pi_{i_1},\ldots,\pi_{i_m}) = \tau st ( π i 1 , … , π i m ) = τ . We call τ \tau τ a pattern of π \pi π and write τ ≤ π \tau\leq\pi τ ≤ π if such an occurrence exists. The entries of an occurrence induce τ \tau τ . Define Av ( B ) = { π : β ≰ π for all β ∈ B } \operatorname{Av}(B) = \{\pi: \beta\not\leq\pi\text{ for all }\beta\in B\} Av ( B ) = { π : β ≤ π for all β ∈ B } . A basis is an antichain of minimal excluded permutations. A finite forbidden set need not be a basis, but deleting its redundant members does not change the class. For nonempty B B B , write ∥ B ∥ : = max β ∈ B ∣ β ∣ \|B\| := \max_{\beta\in B}|\beta| ∥ B ∥ := max β ∈ B ∣ β ∣ .
A permutation of length n n n has gaps 0 , … , n 0,\ldots,n 0 , … , n , which are the positions before and after the entries of the permutation; gap g ∈ { 1 , … , n − 1 } g \in\{1,\ldots,n-1\} g ∈ { 1 , … , n − 1 } is between the g g g -th and the g + 1 g+1 g + 1 -st entry. Let ins g ( π ) \operatorname{ins}_g(\pi) ins g ( π ) be the permutation obtained from π \pi π by inserting n + 1 n+1 n + 1 into gap g g g . A gap is active if this permutation belongs to Av ( B ) \operatorname{Av}(B) Av ( B ) and inactive otherwise. The children of π \pi π in the insert-maximum tree are the permutations of the form ins g ( π ) \operatorname{ins}_g(\pi) ins g ( π ) for the active gaps g g g of π \pi π .
An extension of ρ \rho ρ is a permutation σ ∈ Av ( B ) \sigma\in\operatorname{Av}(B) σ ∈ Av ( B ) such that deleting its ∣ σ ∣ − ∣ ρ ∣ |\sigma|-|\rho| ∣ σ ∣ − ∣ ρ ∣ largest entries leaves ρ \rho ρ . We write ρ ⇝ σ \rho\leadsto\sigma ρ ⇝ σ . Its depth over ρ \rho ρ is ∣ σ ∣ − ∣ ρ ∣ |\sigma|-|\rho| ∣ σ ∣ − ∣ ρ ∣ . Hereditary avoidance ensures that the unique sequence of successive maximum deletions from σ \sigma σ to ρ \rho ρ stays in the class. Put
d B ( ρ ) = sup { ∣ σ ∣ − ∣ ρ ∣ : ρ ⇝ σ } . d_B(\rho) = \sup\{|\sigma|-|\rho| : \rho\leadsto\sigma\}. d B ( ρ ) = sup { ∣ σ ∣ − ∣ ρ ∣ : ρ ⇝ σ } .
For ρ ∈ Av ( B ) \rho\in\operatorname{Av}(B) ρ ∈ Av ( B ) this belongs to Z ≥ 0 ∪ { ∞ } \mathbb{Z}_{\geq0} \cup\{\infty\} Z ≥ 0 ∪ { ∞ } . Given ρ ⇝ σ \rho\leadsto\sigma ρ ⇝ σ , we call the entries of σ \sigma σ inherited from ρ \rho ρ the root entries with respect to ρ \rho ρ , or simply the root entries when ρ \rho ρ is clear. The root gap of an inserted entry x x x is the number of root entries appearing to the left of x x x in σ \sigma σ .
The input to ExtendMax B \operatorname{ExtendMax}_B ExtendMax B is ( ρ , k ) (\rho,k) ( ρ , k ) , and the answer is Yes exactly when ρ \rho ρ has an extension of depth k k k . For enumeration, k k k is encoded in unary. This is natural because an extension at depth k k k has length ∣ ρ ∣ + k |\rho|+k ∣ ρ ∣ + k , so with a binary target even writing one output may require time exponential in the input length. On input ( ρ , 1 k ) (\rho,1^k) ( ρ , 1 k ) , the extension enumeration problem EnumExt B \operatorname{EnumExt}_B EnumExt B outputs all extensions of ρ \rho ρ at depth k k k , without repetitions. On input 1 n 1^n 1 n , the problem EnumAvoid B \operatorname{EnumAvoid}_B EnumAvoid B is the special case ρ = ε \rho=\varepsilon ρ = ε and k = n k=n k = n .
Proposition 2.1. For every fixed finite set of permutations B B B ,
ExtendMax B u n ∈ P ⟺ EnumExt B ∈ D e l a y P ⟹ EnumAvoid B ∈ D e l a y P . \operatorname{ExtendMax}^{\mathrm{un}}_B \in\mathrm{P}
\quad\Longleftrightarrow\quad
\operatorname{EnumExt}_B \in\mathrm{DelayP}
\quad\Longrightarrow\quad
\operatorname{EnumAvoid}_B \in\mathrm{DelayP}. ExtendMax B un ∈ P ⟺ EnumExt B ∈ DelayP ⟹ EnumAvoid B ∈ DelayP . Proof. Suppose that D B D_B D B is an algorithm that decides whether a given permutation τ \tau τ has an extension of depth j j j in time polynomial in ∣ τ ∣ + j |\tau|+j ∣ τ ∣ + j . On input ( ρ , 1 k ) (\rho,1^k) ( ρ , 1 k ) , first execute D B ( ρ , k ) D_B(\rho,k) D B ( ρ , k ) and terminate if the answer is No. Otherwise, traverse the subtree of the insert-maximum tree rooted at ρ \rho ρ in depth-first order, stopping at level n : = ∣ ρ ∣ + k n := |\rho|+k n := ∣ ρ ∣ + k . For each child σ \sigma σ of a visited permutation, descend to σ \sigma σ only if D B ( σ , n − ∣ σ ∣ ) D_B(\sigma,n-|\sigma|) D B ( σ , n − ∣ σ ∣ ) returns Yes. At level n n n , output the permutation.
The oracle tests ensure that only branches leading to the target level are explored. Since every extension has a unique path from ρ \rho ρ , every required extension is output exactly once. Between consecutive outputs, the search backtracks and descends through at most 2 k 2k 2 k levels, considering at most n + 1 n+1 n + 1 children at each level. Since each oracle call takes polynomial time in n n n , the delay is polynomial. The same holds before the first output and after the last.
Conversely, a polynomial-delay enumerator decides extension existence in polynomial time by running until its first output or termination.
Finally, setting ρ = ε \rho=\varepsilon ρ = ε gives EnumAvoid B ∈ D e l a y P \operatorname{EnumAvoid}_B \in\mathrm{DelayP} EnumAvoid B ∈ DelayP .
Output-polynomial avoider enumeration
An enumeration problem belongs to OutputP if its total running time is polynomial in the input size and the total size of the output.
Theorem 3.1. For every fixed finite set B B B of permutations. EnumAvoidB ∈ _B \in B ∈ OutputP.
Proof. Write a j : = ∣ Av j ( B ) ∣ a_j := |\operatorname{Av}_j(B)| a j := ∣ Av j ( B ) ∣ and A < n : = ∑ j = 0 n − 1 a j A_{<n} := \sum_{j=0}^{n-1} a_j A < n := ∑ j = 0 n − 1 a j . If B = ∅ B = \varnothing B = ∅ or ε ∈ B \varepsilon\in B ε ∈ B then the statement is trivial, so let us assume that this is not the case. We first claim that A < n A_{<n} A < n is bounded by a polynomial in n n n and a n a_n a n . The Kaiser–Klazar growth gap says that a permutation class either has polynomial growth or satisfies a n ≥ λ n a_n \ge\lambda^n a n ≥ λ n for all sufficiently large n n n and some λ > 1 \lambda> 1 λ > 1 [14 Theorem 3.4] . In the first case the claim is immediate. In the second case, Marcus–Tardos gives a constant M > 1 M > 1 M > 1 with a j ≤ M j a_j \le M^j a j ≤ M j for all j j j [16 Corollary 2] . Choose an integer r r r with M ≤ λ r M \le\lambda^r M ≤ λ r . For all sufficiently large n n n ,
A < n ≤ ∑ j = 0 n − 1 M j ≤ M n M − 1 ≤ a n r M − 1 . A_{<n} \le\sum_{j=0}^{n-1} M^j \le\frac{M^n}{M-1} \le\frac{a_n^r}{M-1}. A < n ≤ j = 0 ∑ n − 1 M j ≤ M − 1 M n ≤ M − 1 a n r .
Increasing the polynomial to cover the finitely many remaining values of n n n proves the claim. Now traverse the insert-maximum tree depth first from ε \varepsilon ε , stopping at level n n n . The traversal visits exactly the A < n A_{<n} A < n avoiders below the target level and outputs every member of Av n ( B ) \operatorname{Av}_n(B) Av n ( B ) once. For fixed B B B , avoidance of B B B can be tested in linear time: apply the algorithm of Guillemot and Marx to each fixed pattern in B B B [9 Theorem 1.1] . Each internal node has at most n n n candidate children, each of length at most n n n , so the total time is
O ( n 2 A < n + n a n ) . O(n^2 A_{<n} + n a_n). O ( n 2 A < n + n a n ) .
By the claim, this is polynomial in the input size and the total output size n a n n a_n n a n .
A bound on finite extension depth
In this section, we prove that ExtendMaxB b i n _B^{\mathrm{bin}} B bin belongs to NP. If ( ρ , k ) (\rho,k) ( ρ , k ) is an input to this problem, then we may not simply guess an extension of ρ \rho ρ at depth k k k in Av ( B ) \operatorname{Av}(B) Av ( B ) nondeterministically, because k k k might be exponential in the input size. However, we can exploit that a sufficiently long extension contains a monotone subsequence that can be lengthened indefinitely. We will use the following result of Erdős–Szekeres [8 p. 468] .
Theorem 4.1. Every sequence of ( u − 1 ) ( v − 1 ) + 1 (u-1)(v-1)+1 ( u − 1 ) ( v − 1 ) + 1 distinct numbers contains an increasing subsequence of length u u u or a decreasing subsequence of length v v v .
Lemma 4.2 (Infinite-depth criterion). Let B B B be a nonempty finite set of nonempty permutations and let ρ ∈ Av ( B ) \rho\in\operatorname{Av}(B) ρ ∈ Av ( B ) have length n n n . Then the following are equivalent:
(i) d B ( ρ ) = ∞ d_B(\rho) = \infty d B ( ρ ) = ∞ ;
(ii) inserting ∥ B ∥ \lVert B\rVert ∥ B ∥ new maxima in monotone order into some gap of ρ \rho ρ produces a permutation in Av ( B ) \operatorname{Av}(B) Av ( B ) ;
(iii) d B ( ρ ) ≥ ( ∥ B ∥ − 1 ) 2 ( n + 1 ) + 1 d_B(\rho) \ge(\lVert B\rVert-1)^2(n+1)+1 d B ( ρ ) ≥ (∥ B ∥ − 1 ) 2 ( n + 1 ) + 1 .
Proof. The implication (i)⇒ \Rightarrow ⇒ (iii) is immediate. Suppose (iii) holds. Distribute the inserted entries of an extension of that depth among the n + 1 n+1 n + 1 root gaps. Some gap contains at least ( ∥ B ∥ − 1 ) 2 + 1 (\lVert B\rVert-1)^2+1 (∥ B ∥ − 1 ) 2 + 1 inserted entries. Theorem 4.1 gives a monotone subsequence of length ∥ B ∥ \lVert B\rVert ∥ B ∥ among them. Delete all other inserted entries and standardize. The remaining new maxima form a monotone subsequence in one root gap, proving (ii).
For (ii)⇒(i), insert ℓ ≥ ∥ B ∥ \ell\ge\lVert B\rVert ℓ ≥ ∥ B ∥ new maxima in monotone order into the same gap of ρ \rho ρ . If the resulting permutation contained β ∈ B \beta\in B β ∈ B , that occurrence would use at most ∣ β ∣ ≤ ∥ B ∥ |\beta| \le\lVert B\rVert ∣ β ∣ ≤ ∥ B ∥ inserted entries. Since all inserted entries lie in the same gap and are monotone, the same occurrence could be formed using the ∥ B ∥ \lVert B\rVert ∥ B ∥ inserted entries from (ii), contradicting avoidance. Arbitrarily many new maxima can be inserted successively in this way, so d B ( ρ ) = ∞ d_B(\rho) = \infty d B ( ρ ) = ∞ .
For fixed B B B , avoidance is polynomial-time testable by checking each possible occurrence of each forbidden pattern. In fact it is linear-time testable by fixed-pattern matching [9 ] , but the elementary polynomial bound suffices here. Consequently, viability is polynomial-time decidable: test the 2 ( n + 1 ) 2(n+1) 2 ( n + 1 ) monotone extensions in Lemma 4.2 .
Corollary 4.3. Every mortal permutation ρ \rho ρ has depth at most ( ∥ B ∥ − 1 ) 2 ( ∣ ρ ∣ + 1 ) (\lVert B\rVert-1)2(|\rho|+1) (∥ B ∥ − 1 ) 2 ( ∣ ρ ∣ + 1 ) , under the assumptions of Lemma 4.2 .
Theorem 4.4. For every finite set B B B of permutations, ExtendMax B b i n \operatorname{ExtendMax}^{\mathrm{bin}}_B ExtendMax B bin belongs to NP.
Proof. If B = ∅ B = \varnothing B = ∅ , every permutation has extensions of every depth. If ε ∈ B \varepsilon\in B ε ∈ B , no avoiding permutation exists. So suppose that B ≠ ∅ B \ne\varnothing B = ∅ does not contain ε \varepsilon ε . Reject if ρ ∉ Av ( B ) \rho\notin\operatorname{Av}(B) ρ ∈ / Av ( B ) . Put n : = ∣ ρ ∣ n := |\rho| n := ∣ ρ ∣ and H : = ( ∥ B ∥ − 1 ) 2 ( n + 1 ) + 1 H := (\lVert B\rVert-1)2(n+1)+1 H := (∥ B ∥ − 1 ) 2 ( n + 1 ) + 1 . If k < H k < H k < H , guess an extension of length n + k n+k n + k and check avoidance and the restriction to the n n n smallest entries. Its length is in O ( n + 1 ) O(n+1) O ( n + 1 ) , because B B B is fixed. If k ≥ H k \ge H k ≥ H , Lemma 4.2 reduces the question to viability, which is polynomial-time decidable.*
Pockets and polynomial delay
The finite subtrees of the insert-maximum tree that contain no output are the possible source of long delays.
Definition 5.1. A pocket is the subtree of the insert-maximum tree rooted at a mortal node whose parent, if it exists, is viable. The size of a pocket is its number of nodes, including its root, and its depth is the number of edges of the longest path starting at the root.
So pockets are exactly the maximal finite subtrees. The insert-maximum tree is finitely branching, so a subtree of finite depth is finite. Every descendant of a mortal node is mortal, and every mortal node lies in a unique pocket, obtained by following parents until mortality first begins.
Theorem 5.2. Suppose a nondecreasing polynomial q q q bounds the size of every pocket rooted at ρ \rho ρ by q ( ∣ ρ ∣ ) q(|\rho|) q ( ∣ ρ ∣ ) . Then both target encodings of ExtendMax B \operatorname{ExtendMax}_B ExtendMax B are polynomial-time solvable, and both EnumExt B \operatorname{EnumExt}_B EnumExt B and EnumAvoid B \operatorname{EnumAvoid}_B EnumAvoid B are in DelayP.
Proof. The cases B = ∅ B = \varnothing B = ∅ and ε ∈ B \varepsilon\in B ε ∈ B are immediate. On input ( ρ , k ) (\rho,k) ( ρ , k ) , first check ρ ∈ Av ( B ) \rho\in\operatorname{Av}(B) ρ ∈ Av ( B ) . Decide viability by the infinite-depth criterion (Lemma 4.2 ). If ρ \rho ρ is viable, accept for every k k k . Otherwise its subtree lies in a pocket rooted at an ancestor α \alpha α . Since ∣ α ∣ ≤ ∣ ρ ∣ |\alpha| \le|\rho| ∣ α ∣ ≤ ∣ ρ ∣ , that pocket has at most q ( ∣ ρ ∣ ) q(|\rho|) q ( ∣ ρ ∣ ) nodes. Traverse the subtree of ρ \rho ρ and accept precisely when depth k k k is reached. Each visited permutation has length at most ∣ ρ ∣ + q ( ∣ ρ ∣ ) |\rho|+q(|\rho|) ∣ ρ ∣ + q ( ∣ ρ ∣ ) , so constructing and checking all its candidate children takes polynomial time. There are polynomially many visited nodes. The algorithm works even for a binary target, since it never iterates up to k k k unless that depth is reached in the finite subtree. The enumeration conclusions follow from Proposition 2.1 .
Corollary 5.3. A uniform bound on pocket depth implies all conclusions of Theorem 5.2 .
Proof. If each pocket has depth at most D D D , then a pocket rooted at length m m m has at most ( D + 1 ) ( m + D + 1 ) D (D+1)(m+D+1)^D ( D + 1 ) ( m + D + 1 ) D nodes. For fixed D D D this is a nondecreasing polynomial in m m m .
Corollary 4.3 bounds the depth of every pocket by a linear function of its root length. This alone does not give a polynomial size bound: the exponent in the counting argument in the proof of Corollary 5.3 would no longer be constant. The next section gives conditions that remove dependence on the root length.
Structural conditions for bounded pocket depth
We give three sufficient conditions for bounded pocket depth.
Well-quasi-ordered classes
Recall from § 2.1 that a class of permutations is well-quasi-ordered if it contains no infinite antichain under pattern containment. For example, the class Av ( { 2413 , 3142 } ) \operatorname{Av}(\{2413,3142\}) Av ({ 2413 , 3142 }) of all separable permutations is well-quasi-ordered [1 ] . A trap is a mortal permutation minimal under containment among the mortal members of the class.
Lemma 6.1. If π ≤ σ \pi\le\sigma π ≤ σ and both belong to Av ( B ) \operatorname{Av}(B) Av ( B ) , then d B ( σ ) ≤ d B ( π ) d_B(\sigma) \le d_B(\pi) d B ( σ ) ≤ d B ( π ) .
Proof. Fix an occurrence of π \pi π in σ \sigma σ . In an arbitrary extension of σ \sigma σ , retain this occurrence and all inserted entries, deleting every other root entry. Standardization gives an extension of π \pi π at the same depth. It avoids B B B by heredity. Every depth attainable from σ \sigma σ is therefore attainable from π \pi π .
Theorem 6.2. If Av ( B ) \operatorname{Av}(B) Av ( B ) is well-quasi-ordered , its pocket depth is uniformly bounded.
Proof. Distinct traps are incomparable by minimality, so the traps form an antichain. There are therefore only finitely many. If there are none, every node is viable. Otherwise, let D D D be the maximum of their finite depths. Every pocket root ρ \rho ρ contains a trap τ \tau τ , and Lemma 6.1 gives d B ( ρ ) ≤ d B ( τ ) ≤ D d_B(\rho) \le d_B(\tau) \le D d B ( ρ ) ≤ d B ( τ ) ≤ D .
This is a fixed-class result. The proof supplies a constant depending on B B B ; it does not claim an algorithm computing that constant from an arbitrary input basis. The extension algorithm itself only needs the viability test and traversal, not an explicit list of traps.
Regular insertion encodings
Insertion encodings record how a permutation is built by inserting its entries in increasing order. A configuration is a word containing the entries already inserted and zero or more slots , denoted by ⋄ \diamond ⋄ . An insertion replaces the j j j -th slot by v v v (f j f_j f j ), v ⋄ v\diamond v ⋄ (l j l_j l j ), ⋄ v \diamond v ⋄ v (r j r_j r j ), or ⋄ v ⋄ \diamond v\diamond ⋄ v ⋄ (m j m_j m j ) where v v v is the next maximum. These choices f j f_j f j , l j l_j l j , r j r_j r j , m j m_j m j record whether the new value fills the j j j -th slot, leaves space on the right, on the left, or on both sides. Starting from the single slot ⋄ \diamond ⋄ , the sequence of operations that ends at a permutation π \pi π is called its insertion encoding . It can be viewed as a word over the infinite alphabet ⋃ j ≥ 1 { f j , l j , r j , m j } \bigcup_{j\ge1}\{f_j,l_j,r_j,m_j\} ⋃ j ≥ 1 { f j , l j , r j , m j } . For a permutation class C C C , we write L ( C ) L(C) L ( C ) for the set of all insertion encodings of permutations in C C C . For some classes C C C , only finitely many symbols of this alphabet appear, and sometimes L ( C ) L(C) L ( C ) is even a regular language. In this case we say that C C C has a regular insertion encoding . An example of such a class is Av ( 321 , 3412 ) \operatorname{Av}(321,3412) Av ( 321 , 3412 ) (see, e.g., [2 ] ; it is not well-quasi-ordered [3 Lemma 4.5 and its proof] ). We need the following result from [2 Section 4] .
Theorem 6.3. Let B B B be a finite set of permutations. Then Av ( B ) \operatorname{Av}(B) Av ( B ) has a regular insertion encoding if and only if there exists a k ∈ N k \in\mathbb{N} k ∈ N such that every configuration that appears in the insertion encoding of a permutation from Av ( B ) \operatorname{Av}(B) Av ( B ) contains at most k k k slots.
Theorem 6.4. Let B B B be a finite nonempty set of nonempty patterns. If Av ( B ) \operatorname{Av}(B) Av ( B ) has a regular insertion encoding, then its pocket depth is uniformly bounded.
Proof. Let k k k be the number from Theorem 6.3. Let ρ ∈ Av ( B ) \rho\in\operatorname{Av}(B) ρ ∈ Av ( B ) be mortal and let σ \sigma σ be an extension of ρ \rho ρ . In the insertion encoding of σ \sigma σ , consider the configuration just after the entries of ρ \rho ρ have been inserted. Its slots correspond exactly to the root gaps used by the inserted entries of σ \sigma σ . Thus at most k k k root gaps are used. No such gap can contain more than ( ∥ B ∥ − 1 ) 2 (\lVert B\rVert- 1)^2 (∥ B ∥ − 1 ) 2 inserted entries: otherwise Erdős–Szekeres (Theorem 4.1) and the infinite-depth criterion (Lemma 4.2) would make ρ \rho ρ viable. Thus, the total extension depth is at most k ( ∥ B ∥ − 1 ) 2 k(\lVert B\rVert- 1)^2 k (∥ B ∥ − 1 ) 2 .
Maximum-position types
Call a nonempty pattern an L L L -pattern if its maximum is leftmost, an R R R -pattern if its maximum is rightmost, and an M M M -pattern if its maximum is at neither endpoint. The singleton pattern has both endpoint types. In this section we will prove the following.
Theorem 6.5. Let B B B be a finite set of nonempty permutations. If B B B has no L L L -pattern or no R R R -pattern, then Av ( B ) \operatorname{Av}(B) Av ( B ) has no pockets. If B B B is nonempty and has no M M M -pattern, then every pocket of Av ( B ) \operatorname{Av}(B) Av ( B ) has depth at most ( ∥ B ∥ − 1 ) 2 (\lVert B\rVert- 1)^2 (∥ B ∥ − 1 ) 2 .
For a permutation τ \tau τ and 0 ≤ i ≤ ∣ τ ∣ 0 \leq i \leq|\tau| 0 ≤ i ≤ ∣ τ ∣ , let τ − i \tau^{-i} τ − i be the permutation obtained by deleting its i i i largest entries. For τ ∈ Av ( B ) \tau\in\operatorname{Av}(B) τ ∈ Av ( B ) and an active gap g g g of τ \tau τ , the increasing run at g g g inserts the maximum at gap g g g , and then repeatedly inserts the next maximum immediately to the right of the preceding insertion, as long as the result stays in Av ( B ) \operatorname{Av}(B) Av ( B ) . The decreasing run is defined analogously, but uses the left side instead. The length of a run is the number of insertions, and may be infinite.
Lemma 6.6 (One-sided blocking). Assume that B B B is nonempty and has no M M M -pattern. If the increasing run at an active gap g g g of a permutation π ∈ Av ( B ) \pi\in\operatorname{Av}(B) π ∈ Av ( B ) has finite length, then there is an R R R -pattern β ∈ B \beta\in B β ∈ B and an integer 2 ≤ p ≤ ∣ β ∣ ≤ ∥ B ∥ 2 \leq p \leq|\beta| \leq\lVert B\rVert 2 ≤ p ≤ ∣ β ∣ ≤ ∥ B ∥ such that
β − p \beta^{-p} β − p occurs entirely to the left of g g g ,
the last p p p entries of β \beta β are its p p p largest entries, appearing in increasing order,
the increasing run at g g g has length p − 1 p-1 p − 1 .
Symmetrically, a finite decreasing run yields an L L L -pattern whose first q q q entries are its q q q largest entries, in decreasing order, and whose remaining entries occur to the right of g g g .
Proof. Let the increasing run have length k k k , with inserted entries x 1 < ⋯ < x k x_1 < \cdots< x_k x 1 < ⋯ < x k , and let x k + 1 x_{k+1} x k + 1 be the first unsuccessful insertion. Note that k ≥ 1 k \geq1 k ≥ 1 since g g g is active. Choose an occurrence of some β ∈ B \beta\in B β ∈ B . It uses x k + 1 x_{k+1} x k + 1 as its maximum. Since B B B has no M M M -pattern, this maximum is at an endpoint. It cannot be the left endpoint: all other entries of such an occurrence would lie to its right, and replacing x k + 1 x_{k+1} x k + 1 by x k x_k x k would reproduce the occurrence after the preceding valid insertion. Thus, β \beta β is an R R R -pattern.
Every root entry used by the occurrence lies to the left of g g g . Let p p p be the number of inserted entries it uses. If p ≤ k p \leq k p ≤ k , the same root entries together with x 1 , … , x p x_1,\ldots,x_p x 1 , … , x p would already form β \beta β after the p p p th insertion. Hence, p = k + 1 p=k+1 p = k + 1 : all inserted entries are used and play the p p p largest entries of β \beta β . They form an increasing suffix, while the root entries form β − p \beta^{-p} β − p . Since the first insertion was valid, p ≥ 2 p \ge2 p ≥ 2 . Reflecting positions proves the decreasing-run statement.
Proof of Theorem 6.5. If there is no R R R -pattern, inserting every new maximum in the rightmost gap can never create a forbidden occurrence. Every node is therefore viable. The case of no L L L -pattern is symmetric.
Suppose that B B B has no M M M -pattern, and let ρ \rho ρ be a pocket root. If ρ \rho ρ has no active gap, its pocket has depth zero. Otherwise, all increasing runs from ρ \rho ρ are finite, because ρ \rho ρ is mortal. Apply Lemma 6.6 to the increasing run at the leftmost active gap. It gives an occurrence T R T_R T R of β R − p \beta_R^{-p} β R − p to the left of every active gap, where the p p p largest entries of β R \beta_R β R form an increasing suffix. Applying the symmetric statement at the rightmost active gap gives an occurrence T L T_L T L of β L − q \beta_L^{-q} β L − q to the right of every active gap, where the q q q largest entries form a decreasing prefix. Here 2 ≤ p , q ≤ ∥ B ∥ 2 \le p,q \le\lVert B\rVert 2 ≤ p , q ≤ ∥ B ∥ .
Take a longest path from ρ \rho ρ to a leaf of its pocket, and read its newly inserted entries from left to right as a sequence X X X . Every insertion lies between the fixed root occurrences T R T_R T R and T L T_L T L . An increasing subsequence of length p p p in X X X would complete T R T_R T R to an occurrence of β R \beta_R β R ; a decreasing subsequence of length q q q would complete T L T_L T L to an occurrence of β L \beta_L β L . Erdős–Szekeres (Theorem 4.1) therefore gives
∣ X ∣ ≤ ( p − 1 ) ( q − 1 ) ≤ ( ∥ B ∥ − 1 ) 2 . |X| \le(p-1)(q-1) \le(\lVert B\rVert-1)^2. ∣ X ∣ ≤ ( p − 1 ) ( q − 1 ) ≤ (∥ B ∥ − 1 ) 2 .
This is the depth of the pocket.
Together with Corollary 5.3, these three results (Theorem 6.2, Theorem 6.4, and Theorem 6.5) prove the structural part of Theorem 1.1.
NP-completeness for a fixed basis
We now describe the fixed forbidden set of permutations B f i n a l B_{\mathrm{final}} B final and the reduction proving the NP-hardness of ExtendMax B f i n a l u n \operatorname{ExtendMax}^{\mathrm{un}}_{B_{\mathrm{final}}} ExtendMax B final un (Theorem 1.2). The main text gives the construction principles and the correctness argument. Appendix A provides all pattern definitions, coordinates, and occurrence proofs.
Boolean states in the insert-maximum tree
The source problem is monotone NAE-3SAT: every clause contains three unnegated variable occurrences, and a satisfying assignment must give each clause both a zero and a one. This problem is NP-complete [17 Theorem 2.1] . Let Φ \Phi Φ be an instance of this problem with n n n variables x 1 , … , x n x_1,\ldots,x_n x 1 , … , x n and q q q clauses C 1 , … , C q C_1,\ldots,C_q C 1 , … , C q , each of the form ( x i , x j , x k ) (x_i,x_j,x_k) ( x i , x j , x k ) for i , j , k ∈ { 1 , … , n } i,j,k \in\{1,\ldots,n\} i , j , k ∈ { 1 , … , n } . We may assume that each of the variables appears in a clause. The empty formula is mapped to the Yes-instance ( ε , 1 0 ) (\varepsilon,1^0) ( ε , 1 0 ) of ExtendMax B f i n a l u n \operatorname{ExtendMax}^{\mathrm{un}}_{B_{\mathrm{final}}} ExtendMax B final un , so we assume q ≥ 1 q \ge1 q ≥ 1 . If n = 1 n=1 n = 1 , then Φ \Phi Φ is unsatisfiable. Replacing it by the fixed unsatisfiable instance ( x , x , x ) ∧ ( y , y , x ) (x,x,x) \land(y,y,x) ( x , x , x ) ∧ ( y , y , x ) preserves the answer. We therefore assume n ≥ 2 n \ge2 n ≥ 2 .
A block of a permutation is a set of entries whose positions and values each form a set of consecutive integers. It is a k k k -block if its entries form an occurrence of τ \tau τ . A permutation π \pi π is simple if every block of π \pi π has size 0 0 0 , 1 1 1 , or ∣ π ∣ |\pi| ∣ π ∣ . Let σ = σ 1 ⋯ σ m \sigma=\sigma_1\cdots\sigma_m σ = σ 1 ⋯ σ m be a permutation. The inflation σ [ α 1 , … , α m ] \sigma[\alpha_1,\ldots,\alpha_m] σ [ α 1 , … , α m ] is the permutation obtained from σ \sigma σ by replacing each entry σ i \sigma_i σ i by a block inducing α i \alpha_i α i . These blocks appear from left to right in the order i = 1 , … , m i=1,\ldots,m i = 1 , … , m , and every entry of the i i i -th block is smaller than every entry of the j j j -th block exactly when σ i < σ j \sigma_i < \sigma_j σ i < σ j [1 ] . The direct sum ⊕ \mathbin{\oplus} ⊕ is defined as α ⊕ β = 12 [ α , β ] \alpha\mathbin{\oplus} \beta= 12[\alpha,\beta] α ⊕ β = 12 [ α , β ] .
We use the following four simple marker permutations of length 10:
D = 9 , 3 , 10 , 8 , 6 , 4 , 2 , 5 , 1 , 7 , S = 4 , 9 , 7 , 1 , 6 , 10 , 5 , 3 , 8 , 2 , D = 9, 3, 10, 8, 6, 4, 2, 5, 1, 7,\qquad S = 4, 9, 7, 1, 6, 10, 5, 3, 8, 2, D = 9 , 3 , 10 , 8 , 6 , 4 , 2 , 5 , 1 , 7 , S = 4 , 9 , 7 , 1 , 6 , 10 , 5 , 3 , 8 , 2 ,
E = 5 , 9 , 3 , 8 , 10 , 7 , 1 , 6 , 4 , 2 , N = 8 , 1 , 7 , 5 , 10 , 4 , 9 , 3 , 6 , 2. E = 5, 9, 3, 8, 10, 7, 1, 6, 4, 2,\qquad N = 8, 1, 7, 5, 10, 4, 9, 3, 6, 2. E = 5 , 9 , 3 , 8 , 10 , 7 , 1 , 6 , 4 , 2 , N = 8 , 1 , 7 , 5 , 10 , 4 , 9 , 3 , 6 , 2.
They are pairwise distinct and have longest decreasing subsequence length 6. Put J : = 12 J := 12 J := 12 and define the state permutation F : = S ⊕ J F := S \mathbin{\oplus} J F := S ⊕ J (see Figure 1 , left side). The gaps P 0 : = 10 P_0 := 10 P 0 := 10 and P 1 : = 11 P_1 := 11 P 1 := 11 of F F F are called the insertion sites : a new maximum at P b P_b P b represents the bit b b b .
Figure 1. Left: the state permutation F = S ⊕ 12 F = S \mathbin{\oplus} 12 F = S ⊕ 12 . The black dots represent the entries of S S S , the blue dots represent the final increasing pair 12, and the dashed lines mark the insertion sites P 0 P_0 P 0 and P 1 P_1 P 1 . Right: the increasing oscillation ω 16 \omega_{16} ω 16 . The blue dots mark the entries replaced by copies of F F F in ρ 3 ∗ \rho_3^* ρ 3 ∗ .
For the moment, let r ≥ 1 r \ge1 r ≥ 1 be arbitrary; it denotes the number of state blocks that we want to place in one permutation. To arrange r r r such blocks, let ω m \omega_m ω m be the (increasing) oscillation obtained by standardizing the first m m m entries of 4 , 1 , 6 , 3 , 8 , 5 , 10 , 7 , … 4, 1, 6, 3, 8, 5, 10, 7, \ldots 4 , 1 , 6 , 3 , 8 , 5 , 10 , 7 , … (see Figure 1 , right side). The base permutation is the inflation
ρ r ∗ = ω 4 r + 4 [ α 1 , … , α 4 r + 4 ] , ( α 1 , … , α 4 r + 4 ) = ( D , N , ( F , N , N , N ) r , E , N ) . \rho_r^* = \omega_{4r+4}[\alpha_1,\ldots,\alpha_{4r+4}],\qquad(\alpha_1,\ldots,\alpha_{4r+4}) = (D,N,(F,N,N,N)^r,E,N). ρ r ∗ = ω 4 r + 4 [ α 1 , … , α 4 r + 4 ] , ( α 1 , … , α 4 r + 4 ) = ( D , N , ( F , N , N , N ) r , E , N ) .
It contains r r r state blocks and 3 r + 4 3r + 4 3 r + 4 further marker blocks, so ∣ ρ r ∗ ∣ = 42 r + 40 |\rho_r^*| = 42r + 40 ∣ ρ r ∗ ∣ = 42 r + 40 . For each i ∈ [ 4 r + 4 ] i \in[4r + 4] i ∈ [ 4 r + 4 ] , let I i I_i I i be the block replacing the i i i -th entry of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 in this inflation. We call I i I_i I i the block α i \alpha_i α i corresponding to position i i i . For 0 ≤ c < r 0 \le c < r 0 ≤ c < r , let F ( c ) : = I 4 c + 3 F(c) := I_{4c+3} F ( c ) := I 4 c + 3 be the c c c -th state block, and let S ( c ) S(c) S ( c ) and J ( c ) J(c) J ( c ) consist of its first ten and last two entries, respectively, in positional order. We call the sets S ( c ) S(c) S ( c ) , for 0 ≤ c < r 0 \le c < r 0 ≤ c < r , the copies of S S S , and similarly the sets J ( c ) J(c) J ( c ) the *copies of J J J . The copies of D D D , N N N , E E E , and S S S are called the marker copies . Define
A : = 3142 [ F , N , N , N ] , U : = 3142 [ N , N , F , N ] , A := 3142[F,N,N,N],\qquad U := 3142[N,N,F,N], A := 3142 [ F , N , N , N ] , U := 3142 [ N , N , F , N ] ,
U D : = 3142 [ D , N , F , N ] , U E : = 3142 [ N , N , E , N ] . U_D := 3142[D,N,F,N],\qquad U_E := 3142[N,N,E,N]. U D := 3142 [ D , N , F , N ] , U E := 3142 [ N , N , E , N ] .
For 0 ≤ c < r 0 \le c < r 0 ≤ c < r , the four copies replacing positions 4 c + 3 , … , 4 c + 6 4c + 3,\ldots,4c + 6 4 c + 3 , … , 4 c + 6 of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 form the state window of F ( c ) F(c) F ( c ) . For 0 ≤ c < r − 1 0 \le c < r - 1 0 ≤ c < r − 1 , the four copies replacing positions 4 c + 5 , … , 4 c + 8 4c + 5,\ldots,4c + 8 4 c + 5 , … , 4 c + 8 form the overlap window between F ( c ) F(c) F ( c ) and F ( c + 1 ) F(c + 1) F ( c + 1 ) . The first and last four copies form the left boundary window and right boundary window , respectively. These windows induce A A A , U U U , U D U_D U D , and U E U_E U E , respectively.
To allow at most one insertion in each state block, exclusively at the insertion sites P 0 P_0 P 0 and P 1 P_1 P 1 of each state block, we forbid a fixed set of permutations B s t a t e B_{\mathrm{state}} B state , which we will specify next. Let ins g ↗ 2 ( π ) \operatorname{ins}^{\nearrow2}_{g}(\pi) ins g ↗ 2 ( π ) be the permutation obtained from π \pi π by inserting two increasing new maxima into the same original gap g g g . For g 1 < ⋯ < g t g_{1}<\cdots<g_{t} g 1 < ⋯ < g t , let ins g 1 , … , g t ↗ ( π ) \operatorname{ins}^{\nearrow}_{g_{1},\ldots,g_{t}}(\pi) ins g 1 , … , g t ↗ ( π ) be obtained by inserting t t t new maxima, increasing from left to right, into the indicated original gaps. The set B s t a t e \mathcal{B}_{\mathrm{state}} B state is the union of the following families:
Figure 2. The base permutation ρ 2 ⋆ \rho^{\star}_{2} ρ 2 ⋆ : the plot of ω 12 \omega_{12} ω 12 with each entry replaced by its corresponding block. Blue boxes are state blocks and gray boxes are marker blocks. The red box is the first state window. The green overlap window consists of the final two N N N -copies of that window, the next state block, and its first following N N N -copy.
B c o r e = { ins g ( T ) : T ∈ { D , S , E , N } , 1 ≤ g ≤ 9 } , B g a p = { ins 12 ( A ) , ins 22 ( A ) } , B c a p = { ins 10 ↗ 2 ( A ) , ins 11 ↗ 2 ( A ) } , B c o n f = { ins 10 , 11 ↗ ( A ) } , B o v e r l a p = { ins 10 ( U ) , ins 20 ( U ) } , B b o u n d a r y = { ins 0 ( D ) , ins 10 ( U D ) , ins 20 ( U D ) , ins 10 ( U E ) , ins 20 ( U E ) , ins 30 ( U E ) , ins 40 ( U E ) } , B o r d e r = { 4312 [ 1 , 1 , N , E ] } . \begin{aligned}
\mathcal{B}_{\mathrm{core}} &= \{\operatorname{ins}_{g}(T): T\in\{D,S,E,N\},\ 1\leq g\leq9\},\\
\mathcal{B}_{\mathrm{gap}} &= \{\operatorname{ins}_{12}(A),\operatorname{ins}_{22}(A)\},\\
\mathcal{B}_{\mathrm{cap}} &= \{\operatorname{ins}^{\nearrow2}_{10}(A),\operatorname{ins}^{\nearrow2}_{11}(A)\},\\
\mathcal{B}_{\mathrm{conf}} &= \{\operatorname{ins}^{\nearrow}_{10,11}(A)\},\\
\mathcal{B}_{\mathrm{overlap}} &= \{\operatorname{ins}_{10}(U),\operatorname{ins}_{20}(U)\},\\
\mathcal{B}_{\mathrm{boundary}} &= \{\operatorname{ins}_{0}(D),\operatorname{ins}_{10}(U_D),\operatorname{ins}_{20}(U_D),\\
&\qquad\operatorname{ins}_{10}(U_E),\operatorname{ins}_{20}(U_E),\operatorname{ins}_{30}(U_E),\operatorname{ins}_{40}(U_E)\},\\
\mathcal{B}_{\mathrm{order}} &= \{4312[1,1,N,E]\}.
\end{aligned} B core B gap B cap B conf B overlap B boundary B order = { ins g ( T ) : T ∈ { D , S , E , N } , 1 ≤ g ≤ 9 } , = { ins 12 ( A ) , ins 22 ( A )} , = { ins 10 ↗ 2 ( A ) , ins 11 ↗ 2 ( A )} , = { ins 10 , 11 ↗ ( A )} , = { ins 10 ( U ) , ins 20 ( U )} , = { ins 0 ( D ) , ins 10 ( U D ) , ins 20 ( U D ) , ins 10 ( U E ) , ins 20 ( U E ) , ins 30 ( U E ) , ins 40 ( U E )} , = { 4312 [ 1 , 1 , N , E ]} .
The core patterns B c o r e \mathcal{B}_{\mathrm{core}} B core close the interior gaps of marker copies. The gap and overlap patterns B g a p ∪ B o v e r l a p \mathcal{B}_{\mathrm{gap}}\cup\mathcal{B}_{\mathrm{overlap}} B gap ∪ B overlap close gaps 12, 22, 32, 42 in a state window. The boundary patterns B b o u n d a r y \mathcal{B}_{\mathrm{boundary}} B boundary deal with gaps at the ends. Only sites 10 and 11 remain. The capacity patterns B c a p \mathcal{B}_{\mathrm{cap}} B cap forbid two insertions at the same site, whether that site is 10 or 11. The conflict pattern in B c o n f \mathcal{B}_{\mathrm{conf}} B conf forbids one insertion at site 10 and another at site 11 of the same state block. The ordering pattern in B o r d e r \mathcal{B}_{\mathrm{order}} B order forces all inserted maxima to increase from left to right.
Lemma 7.1 (State behavior). Let r ≥ 1 r\geq1 r ≥ 1 . In Av ( B s t a t e ) \operatorname{Av}(\mathcal{B}_{\mathrm{state}}) Av ( B state ) , the active gaps of ρ r ⋆ \rho^{\star}_{r} ρ r ⋆ are exactly the two sites of each state block. Every B s t a t e \mathcal{B}_{\mathrm{state}} B state -avoiding extension inserts entries only at these sites and contains at most one inserted entry in each state block. Moreover, for each ( b 0 , … , b r − 1 ) ∈ { 0 , 1 } r (b_{0},\ldots,b_{r-1})\in\{0,1\}^{r} ( b 0 , … , b r − 1 ) ∈ { 0 , 1 } r , inserting a maximum at site P b c P_{b_{c}} P b c of block c c c , processing the blocks from left to right, defines a bijection between { 0 , 1 } r \{0,1\}^{r} { 0 , 1 } r and the depth-r r r extensions of ρ r ⋆ \rho^{\star}_{r} ρ r ⋆ . In particular, d B s t a t e ( ρ r ⋆ ) = r d_{\mathcal{B}_{\mathrm{state}}}(\rho^{\star}_{r})=r d B state ( ρ r ⋆ ) = r .
Proof. The core, gap, overlap, and boundary patterns make every root gap except the two sites of each state block inactive. Since an inactive root gap remains inactive after further insertions, every inserted entry in an avoiding extension must lie at a site.
The N N N -copy immediately before E E E and the E E E -copy lie to the right of all sites. Two inserted entries in decreasing left-to-right order would therefore form 4312 [ 1 , 1 , N , E ] 4312[1,1,N,E] 4312 [ 1 , 1 , N , E ] together with these copies. Hence, the inserted entries increase from left to right. Lemmas A.32, A.33, and A.34 in Appendix A then show that every occurrence of a marker permutation coincides with a marker copy. Consequently, occurrences of A A A and U E UE U E are designated windows, and occurrences of U U U and U D UD U D agree with designated windows on their marker entries. The capacity patterns therefore forbid two entries at the same site, while the conflict pattern forbids using both sites of one block. Thus every extension has depth at most r r r .
Fix ( b 0 , … , b r − 1 ) ∈ { 0 , 1 } r (b_0,\ldots,b_{r-1}) \in\{0,1\}^{r} ( b 0 , … , b r − 1 ) ∈ { 0 , 1 } r and insert a maximum at site P b c P_{b_c} P b c of block c c c , processing the blocks from left to right. The resulting permutation avoids B s t a t e B_{\mathrm{state}} B state and is therefore an extension of depth r r r .
Conversely, let σ \sigma σ be any extension of ρ r ∗ \rho_r^* ρ r ∗ of depth r r r . Since every inserted entry lies at a site and each state block contains at most one inserted entry, σ \sigma σ uses exactly one site in every state block. Write P b c P_{b_c} P b c for the site used in block c c c . Then σ \sigma σ is exactly the extension constructed from ( b 0 , … , b r − 1 ) (b_0,\ldots,b_{r-1}) ( b 0 , … , b r − 1 ) . Thus, the construction is a bijection. Full details are given in Lemmas A.29–A.38.
Routing and clause constraints
Let x i 1 , … , x i h x_{i_1},\ldots,x_{i_h} x i 1 , … , x i h , where h = 3 q h=3q h = 3 q , denote the appearances of the variables in Φ \Phi Φ in the order in which they appear in the clauses C 1 , … , C q C_1,\ldots,C_q C 1 , … , C q . Relabel the variables so that i h = n i_h=n i h = n . Put λ : = ⌈ log 2 n ⌉ \lambda:= \lceil\log_2 n\rceil λ := ⌈ log 2 n ⌉ and r : = ( λ + 2 ) h + n r := (\lambda+2)h+n r := ( λ + 2 ) h + n . We partition the state blocks of ρ r ∗ \rho_r^* ρ r ∗ into λ + 3 \lambda+3 λ + 3 levels.
The levels are convex in the sense that between the positions of blocks on the same level there are no positions of blocks from another level. Levels 0 , … , λ + 1 0,\ldots,\lambda+1 0 , … , λ + 1 contain one state block for each variable occurrence, while level λ + 2 \lambda+2 λ + 2 contains one state block for each variable. For ℓ ∈ { 0 , … , λ + 1 } \ell\in\{0,\ldots,\lambda+1\} ℓ ∈ { 0 , … , λ + 1 } and u ∈ { 1 , … , h } u \in\{1,\ldots,h\} u ∈ { 1 , … , h } , let F ( ℓ , u ) F(\ell,u) F ( ℓ , u ) denote the u u u -th state block on level ℓ \ell ℓ (here we refer to the order of the state blocks in ρ r ∗ \rho_r^* ρ r ∗ ). Levels 0 and 1 have their state blocks in clause order: for every ℓ ∈ { 0 , 1 } \ell\in\{0,1\} ℓ ∈ { 0 , 1 } and u ∈ { 1 , … , h } u \in\{1,\ldots,h\} u ∈ { 1 , … , h } , the block F ( ℓ , u ) F(\ell,u) F ( ℓ , u ) represents the occurrence x i u x_{i_u} x i u .
Give each variable x j x_j x j a λ \lambda λ -bit code: for 1 ≤ j < n 1 \le j < n 1 ≤ j < n , the code of x j x_j x j is the binary representation of j − 1 j-1 j − 1 , padded with leading zeros, while the code of x n x_n x n consists of λ \lambda λ ones. Number the bit positions from 0, starting with the least significant bit. To obtain level a + 2 a+2 a + 2 from level a + 1 a+1 a + 1 , first list, in their order on level a + 1 a+1 a + 1 , all blocks representing occurrences of variables whose code has 0 in bit position a a a ; then list, again in their order on level a + 1 a+1 a + 1 , all blocks representing occurrences of variables whose code has 1 in bit position a a a . After the λ \lambda λ passes, all occurrences of each variable are consecutive.
A wire s → t s \to t s → t is an ordered pair of state-block indices, requiring the bits of F ( s ) F(s) F ( s ) and F ( t ) F(t) F ( t ) to agree. We call s s s its source and t t t its target . For 0 ≤ ℓ ≤ λ 0 \le\ell\le\lambda 0 ≤ ℓ ≤ λ , include a wire between the blocks representing the same variable occurrence on levels ℓ \ell ℓ and ℓ + 1 \ell+1 ℓ + 1 , directed towards the latter. Also include a wire from each occurrence block on level λ + 1 \lambda+1 λ + 1 to the block representing its variable on level λ + 2 \lambda+2 λ + 2 . For the formal details on how to implement wires, see Section 7.3. At each reordering, the positions of the blocks on the preceding level, read in their new order, form two increasing subsequences. Their longest decreasing subsequence therefore has length at most two. Figure 3 summarizes the routing. The blocks on level 1 are partitioned into consecutive triples, called clause triples , whose assigned bits are required to be not all equal. Section 7.3 also explains how to implement these.
Figure 3. The routing for an example with h = 12 h=12 h = 12 and three variables. Level 1 contains the clause triples, the middle box represents the stable binary partitions, and the final transition joins all occurrences of a variable to its merge block.
Wires and their encoding
We now build ρ Φ \rho_{\Phi} ρ Φ from ρ r ⋆ \rho_{r}^{\star} ρ r ⋆ to implement the wires and clause triples. We use four further simple permutations of length 10:
Q L = 8 , 10 , 7 , 5 , 3 , 9 , 2 , 6 , 1 , 4 , Q R = 3 , 5 , 10 , 8 , 6 , 4 , 2 , 9 , 1 , 7 , Q_L=8,10,7,5,3,9,2,6,1,4,\qquad Q_R=3,5,10,8,6,4,2,9,1,7, Q L = 8 , 10 , 7 , 5 , 3 , 9 , 2 , 6 , 1 , 4 , Q R = 3 , 5 , 10 , 8 , 6 , 4 , 2 , 9 , 1 , 7 ,
C L = 5 , 10 , 2 , 8 , 6 , 4 , 7 , 3 , 1 , 9 , C R = 8 , 10 , 7 , 4 , 6 , 1 , 5 , 3 , 9 , 2. C_L=5,10,2,8,6,4,7,3,1,9,\qquad C_R=8,10,7,4,6,1,5,3,9,2. C L = 5 , 10 , 2 , 8 , 6 , 4 , 7 , 3 , 1 , 9 , C R = 8 , 10 , 7 , 4 , 6 , 1 , 5 , 3 , 9 , 2.
They are pairwise distinct, distinct from the four marker permutations, and have longest decreasing subsequence length 6.
A wire s → t s\to t s → t is encoded by placing copies of Q L Q_L Q L and Q R Q_R Q R around F ( t ) F(t) F ( t ) in position and between S ( s ) S(s) S ( s ) and J ( s ) J(s) J ( s ) in value (see Figure 4 ). The value placement identifies the source s s s , while the positional placement identifies the target t t t . Similarly, copies of C L C_L C L and C R C_R C R are placed on opposite sides of the three blocks of a clause triple. For sets of entries U U U and V V V , write U < V U<V U < V when every value in U U U is smaller than every value in V V V . Every source block has exactly one outgoing wire, so the two copies encoding a wire can be indexed by its source.
Figure 4. The copies Q L ( s ) Q_L(s) Q L ( s ) and Q R ( s ) Q_R(s) Q R ( s ) lie between S ( s ) S(s) S ( s ) and J ( s ) J(s) J ( s ) in value, and S ( t ) S(t) S ( t ) and J ( t ) J(t) J ( t ) lie between Q L ( s ) Q_L(s) Q L ( s ) and Q R ( s ) Q_R(s) Q R ( s ) in position. The source window lies below the target window.
Definition 7.2. Define the permutation ρ Φ \rho_{\Phi} ρ Φ from ρ r ⋆ \rho_{r}^{\star} ρ r ⋆ by the following three rules. The copies of Q L Q_L Q L , Q R Q_R Q R , C L C_L C L , and C R C_R C R introduced below are called the constraint copies.
(D1) For each state block t t t with incoming wires s 1 → t , … , s m → t s_1\to t,\ldots,s_m\to t s 1 → t , … , s m → t , list the sources in their left-to-right order. For every i i i , introduce two disjoint sets of ten new entries, denoted by Q L ( s i ) Q_L(s_i) Q L ( s i ) and Q R ( s i ) Q_R(s_i) Q R ( s i ) , inducing Q L Q_L Q L and Q R Q_R Q R , respectively. Place Q L ( s 1 ) , … , Q L ( s m ) Q_L(s_1),\ldots,Q_L(s_m) Q L ( s 1 ) , … , Q L ( s m ) consecutively immediately before F ( t ) F(t) F ( t ) and Q R ( s 1 ) , … , Q R ( s m ) Q_R(s_1),\ldots,Q_R(s_m) Q R ( s 1 ) , … , Q R ( s m ) consecutively immediately after F ( t ) F(t) F ( t ) . Place their values so that
S ( s i ) < Q L ( s i ) < Q R ( s i ) < J ( s i ) . S(s_i)<Q_L(s_i)<Q_R(s_i)<J(s_i). S ( s i ) < Q L ( s i ) < Q R ( s i ) < J ( s i ) . (D2) For each clause triple ( t 0 , t 1 , t 2 ) (t_0,t_1,t_2) ( t 0 , t 1 , t 2 ) , let s i → t i s_i\to t_i s i → t i be the incoming wire for i ∈ { 0 , 1 , 2 } i\in\{0,1,2\} i ∈ { 0 , 1 , 2 } . Introduce two disjoint sets of ten new entries, denoted by C L ( s 0 ) C_L(s_0) C L ( s 0 ) and C R ( s 0 ) C_R(s_0) C R ( s 0 ) , inducing C L C_L C L and C R C_R C R , respectively. Place C L ( s 0 ) C_L(s_0) C L ( s 0 ) immediately before Q L ( s 0 ) Q_L(s_0) Q L ( s 0 ) and C R ( s 0 ) C_R(s_0) C R ( s 0 ) immediately after Q R ( s 2 ) Q_R(s_2) Q R ( s 2 ) . Place their values so that
S ( s 0 ) < C L ( s 0 ) < Q L ( s 0 ) < Q R ( s 0 ) < C R ( s 0 ) < J ( s 0 ) . S(s_0)<C_L(s_0)<Q_L(s_0)<Q_R(s_0)<C_R(s_0)<J(s_0). S ( s 0 ) < C L ( s 0 ) < Q L ( s 0 ) < Q R ( s 0 ) < C R ( s 0 ) < J ( s 0 ) . (D3) Add no other constraint copies.
All constraint copies are pairwise disjoint and occupy consecutive positions and consecutive values in ρ Φ \rho_{\Phi} ρ Φ . These rules preserve the relative position and value orders of the original ρ r ⋆ \rho_{r}^{\star} ρ r ⋆ entries and determine ρ Φ \rho_{\Phi} ρ Φ uniquely.
Figure 4 shows the geometry of one wire.
There are ( λ + 2 ) h (\lambda+ 2)h ( λ + 2 ) h wires and q q q clause triples. Consequently, ∣ ρ Φ ∣ = ( 42 r + 40 ) + 20 ( λ + 2 ) h + 20 q = O ( h log h ) |\rho_\Phi| = (42r + 40) + 20(\lambda+ 2)h + 20q = O(h \log h) ∣ ρ Φ ∣ = ( 42 r + 40 ) + 20 ( λ + 2 ) h + 20 q = O ( h log h ) . The permutation ρ Φ \rho_\Phi ρ Φ and the unary target 1 r 1^r 1 r can therefore be constructed in polynomial time.
Four violation patterns
For a wire s → t s \to t s → t , take the four blocks of the source window, the copy Q L ( s ) Q_L(s) Q L ( s ) , the state block F ( t ) F(t) F ( t ) , the copy Q R ( s ) Q_R(s) Q R ( s ) , and the three N N N -copies of the target window, in positional order. These 104 entries induce a fixed permutation A e q A_{\mathrm{eq}} A eq , independent of the chosen wire. The source sites are gaps 10, 11 and the target sites are gaps 62, 63 in A e q A_{\mathrm{eq}} A eq . Define
P 01 ≠ = ins 10 , 63 ↗ ( A e q ) , P 10 ≠ = ins 11 , 62 ↗ ( A e q ) . P^{\neq}_{01} = \operatorname{ins}^{\nearrow}_{10,63}(A_{\mathrm{eq}}), \qquad P^{\neq}_{10} = \operatorname{ins}^{\nearrow}_{11,62}(A_{\mathrm{eq}}). P 01 = = ins 10 , 63 ↗ ( A eq ) , P 10 = = ins 11 , 62 ↗ ( A eq ) .
Both patterns have length 106 and represent the two unequal assignments to the endpoints.
For a clause triple ( t 0 , t 1 , t 2 ) (t_0,t_1,t_2) ( t 0 , t 1 , t 2 ) , let s 0 s_0 s 0 be the source of the incoming wire at t 0 t_0 t 0 . Take the source window, the copy C L ( s 0 ) C_L(s_0) C L ( s 0 ) , the complete windows of t 0 t_0 t 0 and t 1 t_1 t 1 , the state block F ( t 2 ) F(t_2) F ( t 2 ) , the copy C R ( s 0 ) C_R(s_0) C R ( s 0 ) , and the three N N N -copies of the window of t 2 t_2 t 2 , in positional order. These 188 entries induce a fixed permutation A n a e A_{\mathrm{nae}} A nae , independent of the chosen clause triple. The sites of the three target blocks are gaps 62, 63, 104, 105, and 146, 147. Define
P 000 m o n o = ins 62 , 104 , 146 ↗ ( A n a e ) , P 111 m o n o = ins 63 , 105 , 147 ↗ ( A n a e ) . P^{\mathrm{mono}}_{000} = \operatorname{ins}^{\nearrow}_{62,104,146}(A_{\mathrm{nae}}), \qquad P^{\mathrm{mono}}_{111} = \operatorname{ins}^{\nearrow}_{63,105,147}(A_{\mathrm{nae}}). P 000 mono = ins 62 , 104 , 146 ↗ ( A nae ) , P 111 mono = ins 63 , 105 , 147 ↗ ( A nae ) .
Both patterns have length 191 and represent the two constant assignments to a clause triple. The independence of the standardizations from the chosen wire or clause is proved in Lemmas A.20 and A.22. Finally, define our fixed forbidden set
B f i n a l : = B s t a t e ∪ { P 01 ≠ , P 10 ≠ , P 000 m o n o , P 111 m o n o } . B_{\mathrm{final}} := B_{\mathrm{state}} \cup\{P^{\neq}_{01}, P^{\neq}_{10}, P^{\mathrm{mono}}_{000}, P^{\mathrm{mono}}_{111}\}. B final := B state ∪ { P 01 = , P 10 = , P 000 mono , P 111 mono } .
No unintended occurrences
The following lemma summarizes the properties of ρ Φ \rho_\Phi ρ Φ needed for correctness. For each ( b 0 , … , b r − 1 ) ∈ { 0 , 1 } r (b_0,\ldots,b_{r-1}) \in\{0,1\}^r ( b 0 , … , b r − 1 ) ∈ { 0 , 1 } r , start with ρ Φ \rho_\Phi ρ Φ and insert one maximum at site P b c P_{bc} P b c of each state block F ( c ) F(c) F ( c ) , processing the sites from left to right. We call the resulting permutation an assignment configuration of ρ Φ \rho_\Phi ρ Φ .
Lemma 7.3 (Properties of ρ Φ \rho_\Phi ρ Φ ). The permutation ρ Φ \rho_\Phi ρ Φ (Definition 7.2 ) has the following properties.
(i) ρ Φ ∈ Av ( B f i n a l ) \rho_{\Phi} \in\operatorname{Av}(B_{\mathrm{final}}) ρ Φ ∈ Av ( B final ) and d B s t a t e ( ρ Φ ) = r d_{B_{\mathrm{state}}}(\rho_{\Phi}) = r d B state ( ρ Φ ) = r .
(ii) The depth-r r r B s t a t e B_{\mathrm{state}} B state -avoiding extensions of ρ Φ \rho_{\Phi} ρ Φ are exactly the assignment configurations of ρ Φ \rho_{\Phi} ρ Φ .
(iii) Let π \pi π be an assignment configuration of ρ Φ \rho_{\Phi} ρ Φ . For each ( a , b ) ∈ { ( 0 , 1 ) , ( 1 , 0 ) } (a,b) \in\{(0,1),(1,0)\} ( a , b ) ∈ {( 0 , 1 ) , ( 1 , 0 )} , the pattern P a b ≠ P_{ab}^{\ne} P ab = occurs in π \pi π exactly when some wire s → t s \to t s → t satisfies ( b s , b t ) = ( a , b ) (b_s,b_t) = (a,b) ( b s , b t ) = ( a , b ) . For each b ∈ { 0 , 1 } b \in\{0,1\} b ∈ { 0 , 1 } , the pattern P b b b m o n o P_{bbb}^{\mathrm{mono}} P bbb mono occurs in π \pi π exactly when some clause triple ( t 0 , t 1 , t 2 ) (t_0,t_1,t_2) ( t 0 , t 1 , t 2 ) satisfies ( b t 0 , b t 1 , b t 2 ) = ( b , b , b ) (b_{t_0},b_{t_1},b_{t_2}) = (b,b,b) ( b t 0 , b t 1 , b t 2 ) = ( b , b , b ) .
Proof overview. First let σ \sigma σ be any B s t a t e B_{\mathrm{state}} B state -avoiding extension of ρ Φ \rho_{\Phi} ρ Φ . Deleting the constraint-copy entries in σ \sigma σ and standardizing gives a B s t a t e B_{\mathrm{state}} B state -avoiding extension of ρ Φ ⋆ \rho_{\Phi}^{\star} ρ Φ ⋆ at the same depth. Lemma 7.1 therefore bounds the depth by r r r . If the depth is r r r , that lemma also shows that exactly one site P b c P_{bc} P b c is used in every state block, in left-to-right order. Hence, σ \sigma σ is the corresponding assignment configuration. It remains to show that every assignment configuration π \pi π avoids B s t a t e B_{\mathrm{state}} B state . After deleting the constraint-copy entries and standardizing, we obtain the depth-r r r extension of ρ Φ ⋆ \rho_{\Phi}^{\star} ρ Φ ⋆ encoded by the same bits, which avoids B s t a t e B_{\mathrm{state}} B state by Lemma 7.1 . Thus, a new occurrence of a member of B s t a t e B_{\mathrm{state}} B state would have to use an entry of a constraint copy. The same occurrence results used in Lemma 7.1 apply to π \pi π . By Lemmas A.32 , A.33 , and A.34 , marker and constraint occurrences are copies, occurrences of A , U E A,U_E A , U E are windows, and occurrences of U , U D U,U_D U , U D match windows on marker entries.
Constraint-copy entries cannot create occurrences of members of B s t a t e B_{\mathrm{state}} B state . Constraint copies lie neither inside marker copies nor at sites, excluding the core, capacity, and conflict patterns. In every relevant gap of a state or overlap window, a constraint-copy entry lies below the window, while the additional entry of the forbidden pattern lies above it. All constraint copies lie below the final copy of E E E , so the two entries above E E E in the ordering pattern would have to be inserted maxima, which increase from left to right. Finally, the placement rules leave the relevant boundary gaps free of constraint copies. Hence, π \pi π avoids B s t a t e B_{\mathrm{state}} B state . Such a configuration has depth r r r , while the first paragraph gave the matching upper bound and characterized every extension at that depth. This proves d B s t a t e ( ρ Φ ) = r d_{B_{\mathrm{state}}}(\rho_{\Phi}) = r d B state ( ρ Φ ) = r and (ii). Deleting the inserted maxima also shows that ρ Φ \rho_{\Phi} ρ Φ avoids B s t a t e B_{\mathrm{state}} B state .
Fix an assignment configuration π \pi π . Remove the two largest entries from an occurrence of P a b ≠ P_{ab}^{\ne} P ab = in π \pi π . The marker and constraint occurrences within this occurrence of A e q A_{\mathrm{eq}} A eq are copies. The Q L Q_L Q L - and Q R Q_R Q R -copies lie between S ( s ) S(s) S ( s ) and J ( s ) J(s) J ( s ) in value and positionally bracket the target state block. They therefore encode an actual wire s → t s \to t s → t , and the removed entries are the inserted maxima at site P a P_a P a of F ( s ) F(s) F ( s ) and site P b P_b P b of F ( t ) F(t) F ( t ) . Removing the three largest entries from an occurrence of P b b b m o n o P_{bbb}^{\mathrm{mono}} P bbb mono similarly identifies an actual clause triple and shows that the removed entries are its three inserted maxima at the P b P_b P b sites. Thus every violation-pattern occurrence in π \pi π uses inserted maxima. If ρ Φ \rho_{\Phi} ρ Φ contained such a pattern, the same root entries would form an occurrence in π \pi π , which is impossible. Hence, ρ Φ \rho_{\Phi} ρ Φ avoids the four violation patterns. Together with its B s t a t e B_{\mathrm{state}} B state -avoidance, this proves ρ Φ ∈ Av ( B f i n a l ) \rho_{\Phi} \in\operatorname{Av}(B_{\mathrm{final}}) ρ Φ ∈ Av ( B final ) and completes (i).
Conversely, every wire s → t s \to t s → t with bit a a a at s s s and bit b b b at t t t , where a ≠ b a \ne b a = b , gives an occurrence of P a b ≠ P_{ab}^{\ne} P ab = , and every clause triple whose three blocks have bit b b b gives an occurrence of P b b b m o n o P_{bbb}^{\mathrm{mono}} P bbb mono . Combined with the preceding recognition of all occurrences, this proves (iii). The complete arguments are given in Theorem A.41 , Corollary A.42 , Corollaries A.45 and A.48 , and Lemma A.49 .
Correctness and consequences
Lemma 7.3 (ii)–(iii) shows that a B f i n a l B_{\mathrm{final}} B final -avoiding extension of depth r r r exists exactly when one can choose one bit per state block, with equal bits on every wire and a nonconstant triple in every clause. Such choices exist exactly when Φ \Phi Φ is NAE-satisfiable.
Theorem 7.4. We have d B f i n a l ( ρ Φ ) ≤ r d_{B_{\mathrm{final}}}(\rho_\Phi) \le r d B final ( ρ Φ ) ≤ r , with equality if and only if Φ \Phi Φ is NAE-satisfiable.
Proof. Lemma 7.3(i) gives root avoidance and the depth upper bound, as B s t a t e ⊆ B f i n a l B_{\mathrm{state}} \subseteq B_{\mathrm{final}} B state ⊆ B final . If Φ \Phi Φ is satisfiable, choose a satisfying assignment and assign each state block its variable’s bit. The bits agree along wires and are nonconstant on clause triples, so parts (ii) and (iii) give a B f i n a l B_{\mathrm{final}} B final -avoiding extension of depth r r r .
Conversely, by part (ii), any avoiding extension at depth r r r uses exactly one site per state block. Part (iii) forces bit agreement along wires and nonconstant clause triples. The wire paths to merge blocks then force all occurrences of each variable to agree, yielding a NAE-satisfying assignment of Φ \Phi Φ .
Proof of Theorem 1.2. Map Φ \Phi Φ to ( ρ Φ , 1 r ) (\rho_\Phi,1^r) ( ρ Φ , 1 r ) . The size bounds make this a polynomial-time reduction, and Theorem 7.4 proves its correctness. Hence ExtendMax B f i n a l u n \operatorname{ExtendMax}^{\mathrm{un}}_{B_{\mathrm{final}}} ExtendMax B final un is NP-hard. Replacing the unary representation of r r r by its binary representation gives NP-hardness of ExtendMax B f i n a l b i n \operatorname{ExtendMax}^{\mathrm{bin}}_{B_{\mathrm{final}}} ExtendMax B final bin . Theorem 4.4 gives NP membership for both encodings.
By Proposition 2.1, EnumExt B f i n a l ∉ DelayP \operatorname{EnumExt}_{B_{\mathrm{final}}} \notin\operatorname{DelayP} EnumExt B final ∈ / DelayP unless P = NP \operatorname{P} = \operatorname{NP} P = NP . The class also has unbounded pocket depth, without any complexity assumption. Take satisfiable formulas with arbitrarily many disjoint clauses. Their roots are mortal and have unbounded finite depth r r r . Each lies in a pocket of at least that depth.
Finally, consider Hanika’s problem FPCSP ( B ) \operatorname{FPCSP}(B) FPCSP ( B ) . Its input is a finite set V V V and two acyclic relations E 1 , E 2 E_1,E_2 E 1 , E 2 on V V V . It asks whether linear orders extending the relations induce a permutation in Av ( B ) \operatorname{Av}(B) Av ( B ) : label the elements by their order in the first linear order and read them in the second. The following answers [10 Problem 4.1] .
Corollary 7.5. FPCSP ( B f i n a l ) \operatorname{FPCSP}(B_{\mathrm{final}}) FPCSP ( B final ) is NP-complete, even when the first order is fixed.
Proof. Given ( ρ , 1 k ) (\rho,1^k) ( ρ , 1 k ) with ∣ ρ ∣ = n |\rho|=n ∣ ρ ∣ = n , set V = { 1 , … , n + k } V=\{1,\ldots,n+k\} V = { 1 , … , n + k } . Let E 1 E_1 E 1 be the chain 1 < ⋯ < n + k 1<\cdots<n+k 1 < ⋯ < n + k , and let E 2 E_2 E 2 require ρ 1 < ⋯ < ρ n \rho_1<\cdots<\rho_n ρ 1 < ⋯ < ρ n , with the remaining elements unconstrained. The induced permutations are exactly the insert-maximum extensions of ρ \rho ρ at depth k k k . This is a polynomial-time reduction, because k k k is represented in unary. Membership in NP follows by guessing the two orders and checking the relations and avoidance for fixed B B B .
Conclusion and Open Problems
For every fixed finite set B B B of forbidden permutations the problem EnumAvoid B \operatorname{EnumAvoid}_B EnumAvoid B belongs to OutputP \operatorname{OutputP} OutputP . For some B B B , we even obtain a polynomial-delay algorithm. To prove such polynomial-delay results, we introduced the problem ExtendMax B u n \operatorname{ExtendMax}^{\mathrm{un}}_B ExtendMax B un . If ExtendMax B u n \operatorname{ExtendMax}^{\mathrm{un}}_B ExtendMax B un is in P, then EnumAvoid B \operatorname{EnumAvoid}_B EnumAvoid B is in DelayP \operatorname{DelayP} DelayP . We introduce and study pockets and use this concept to formulate three structural conditions on B B B that imply that ExtendMax B u n \operatorname{ExtendMax}^{\mathrm{un}}_B ExtendMax B un is in P. Finally, we find a finite set B f i n a l B_{\mathrm{final}} B final of permutations such that ExtendMax B f i n a l u n \operatorname{ExtendMax}^{\mathrm{un}}_{B_{\mathrm{final}}} ExtendMax B final un is NP-complete.
The main remaining question is whether every finitely based permutation class admits polynomial-delay avoider enumeration. In particular, the complexity of EnumAvoid B f i n a l \operatorname{EnumAvoid}_{B_{\mathrm{final}}} EnumAvoid B final remains unresolved here. Another question is whether fixed-basis insert-maximum extension admits a dichotomy between polynomial time and NP-completeness.
References
Write LDS ( π ) \operatorname{LDS}(\pi) LDS ( π ) for the lengths of the longest increasing and decreasing subsequences of π \pi π .
Full construction and proof of fixed-basis hardness
In this appendix we provide the full details of the proof that E x t e n d M a x B f i n a l \mathrm{ExtendMaxB}_{\mathrm{final}} ExtendMaxB final is NP-hard. As mentioned in the main text, the reduction is from monotone NAE-3SAT and builds the starting permutation from Boolean state blocks arranged in levels. The first level encodes the clauses, successive levels reorder the variable occurrences, and a final merge brings together the variable occurrences belonging to each variable. Fixed forbidden patterns force every maximum-depth extension to choose one bit in each state block, require all occurrences of each variable to choose the same bit, and enforce the not-all-equal condition in every clause. Thus, an extension of the target depth exists exactly when the formula has a not-all-equal satisfying assignment.
Permutation operations used in the reduction
The construction uses blocks, inflations, sums, and decreasing subsequences. Blocks, simple permutations, and inflations were defined in § 8 . For example, the entries 3 and 2 of 1324 form a block, while 2413 is simple. An example of an inflation is
213 [ 21 , 12 , 1 ] = 43125. 213[21,12,1] = 43125. 213 [ 21 , 12 , 1 ] = 43125.
The three inflated blocks are shown in Figure 5 .
Figure 5. The inflation 213[21, 12, 1] = 43125. The dashed rectangles mark the three blocks, which induce 21, 12, and 1, respectively.
The source problem and reduction outline
The reduction starts from monotone not-all-equal satisfiability.
Definition A.1 (Monotone NAE-3SAT). An instance is a formula Φ \Phi Φ in conjunctive normal form (CNF) in which every clause consists of exactly three unnegated variable occurrences. The question is whether there is a truth assignment that makes every clause not-all-equal; that is, each clause must contain at least one true and at least one false variable occurrence.
Theorem A.2 (Schaefer). The problem in Definition A.1 is NP-complete [17 Theorem 2.1] .
Let Φ \Phi Φ have n n n variables and q q q clauses, and let h h h be its number of variable occurrences. Then h = 3 q h = 3q h = 3 q . We take the variables of Φ \Phi Φ to be exactly those that occur in the formula, so n ≤ h n \le h n ≤ h . The empty formula is mapped to the Yes-instance ( ε , 1 0 ) (\varepsilon,1^{0}) ( ε , 1 0 ) , so we assume q ≥ 1 q \ge1 q ≥ 1 and hence h ≥ 3 h \ge3 h ≥ 3 . If n = 1 n = 1 n = 1 , then Φ \Phi Φ is unsatisfiable. Replacing it by the fixed unsatisfiable instance ( x , x , x ) ∧ ( y , x , x ) (x,x,x) \land(y,x,x) ( x , x , x ) ∧ ( y , x , x ) preserves the answer. We therefore assume n ≥ 2 n \ge2 n ≥ 2 .
We now construct the permutation instance from a formula. Three Boolean requirements must be enforced. Each variable occurrence must carry a bit. The three variable occurrences belonging to a clause must not all carry the same bit. All variable occurrences belonging to any one variable must carry a common bit. The following sections address these requirements.
Encoding a bit in a state block
We first construct a state block that carries one bit. It contains two possible insertion sites. The forbidden patterns introduced below permit at most one of them to be used, and the two choices encode 0 and 1.
Marker permutations
Definition A.3 (Marker permutations). Let D , S , E , N ∈ S 10 D, S, E, N \in\mathcal{S}_{10} D , S , E , N ∈ S 10 be the four permutations displayed and drawn in Appendix § 12 . We call them the marker permutations.
Proposition A.4 (Properties of the marker permutations). The four marker permutations are pairwise distinct and simple, and every marker permutation T T T satisfies LDS ( T ) = 6 \operatorname{LDS}(T) = 6 LDS ( T ) = 6 .
Proof. A short program exhaustively checks the four displayed permutations of length 10 and confirms the stated properties. ◀
The copies of these permutations placed by the construction in the root are the marker copies . The simplicity and common longest-decreasing-subsequence length of the marker permutations are used later to identify every placed copy uniquely.
State blocks and their Boolean states
Each state block consists of one copy of S S S followed by a short increasing tail. Two gaps are potential insertion sites, and exactly one is used in a maximum-depth extension.
Definition A.5 (State permutation and sites). Put J = 12 ∈ S 2 J = 12 \in\mathcal{S}_{2} J = 12 ∈ S 2 and define the state permutation
F = S ⊕ J = 12 [ S , J ] ∈ S 12 . F = S \oplus J = 12[S,J] \in\mathcal{S}_{12}. F = S ⊕ J = 12 [ S , J ] ∈ S 12 . The two sites are
P 0 = gap 10 , P 1 = gap 11. P_{0} = \operatorname{gap} 10,\qquad P_{1} = \operatorname{gap} 11. P 0 = gap 10 , P 1 = gap 11. A maximum inserted at P 0 P_{0} P 0 encodes 0, and a maximum inserted at P 1 P_{1} P 1 encodes 1. A site is used if an inserted maximum is placed there. A state block is assigned bit b ∈ { 0 , 1 } b \in\{0,1\} b ∈ { 0 , 1 } when its set of used sites is exactly { P b } \{P_{b}\} { P b } . F ( s ) F(s) F ( s ) denotes the state block indexed by s s s , and S ( s ) S(s) S ( s ) and J ( s ) J(s) J ( s ) denote its designated copies of S S S and J J J .
Figure 1 (left) illustrates F F F and its two sites.
Building the base permutation
To place many state blocks in one permutation, we arrange them along an increasing oscillation. This produces a base permutation with r r r state blocks. The construction will later determine r r r from the formula and assign a role to each state block.
The increasing oscillation
Increasing oscillations arrange the state blocks in a repeated local pattern. The four-entry pattern ϑ \vartheta ϑ will be used to identify them.
Definition A.6 (Increasing oscillations). Let
a 1 , a 2 , a 3 , … = 4 , 1 , 6 , 3 , 8 , 5 , 10 , 7 , … , a_1, a_2, a_3, \ldots= 4,1,6,3,8,5,10,7,\ldots, a 1 , a 2 , a 3 , … = 4 , 1 , 6 , 3 , 8 , 5 , 10 , 7 , … , where, for k ≥ 1 k \ge1 k ≥ 1 ,
a 2 k − 1 = 2 k + 2 and a 2 k = 2 k − 1. a_{2k-1}=2k+2 \qquad\text{and}\qquad a_{2k}=2k-1. a 2 k − 1 = 2 k + 2 and a 2 k = 2 k − 1. For m ≥ 2 m \ge2 m ≥ 2 , put ω m = st ( a 1 , … , a m ) \omega_m=\operatorname{st}(a_1,\ldots,a_m) ω m = st ( a 1 , … , a m ) . Finally, put ϑ = 3142 = ω 4 \vartheta=3142=\omega_4 ϑ = 3142 = ω 4 . We call ( a i ) i ≥ 1 (a_i)_{i\ge1} ( a i ) i ≥ 1 the defining sequence of the oscillations.
Figure 1 (right) illustrates an increasing oscillation.
We now inflate an increasing oscillation with state blocks and marker copies to form the base permutation.
Definition A.7 (Base permutation). For r ≥ 1 r \ge1 r ≥ 1 , define the base permutation
ρ r ∗ = ω 4 r + 4 [ D , N , ( F , N , N , N ) r , E , N ] . \rho_r^*=\omega_{4r+4}[D,N,(F,N,N,N)^r,E,N]. ρ r ∗ = ω 4 r + 4 [ D , N , ( F , N , N , N ) r , E , N ] . The r r r copies of F F F are the state blocks. We index them by c = 0 , 1 , … , r − 1 c=0,1,\ldots,r-1 c = 0 , 1 , … , r − 1 , so state block c c c sits at position 4 c + 3 4c+3 4 c + 3 of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 .
There are r r r state blocks of length 12 and 3 r + 4 3r+4 3 r + 4 additional marker copies of length 10, so
∣ ρ r ∗ ∣ = 42 r + 40. (1) |\rho_r^*|=42r+40. \tag*{(1)} ∣ ρ r ∗ ∣ = 42 r + 40. (1)
State windows and their forbidden patterns
The same forbidden patterns should control every state block independently of its position in the base permutation. We therefore use the state block together with the three N N N -copies that follow it.
Definition A.8 (State window). Set
A = ϑ [ F , N , N , N ] . A=\vartheta[F,N,N,N]. A = ϑ [ F , N , N , N ] . Thus A A A has length 12 + 3 ⋅ 10 = 42 12+3\cdot10=42 12 + 3 ⋅ 10 = 42 . In ρ r ∗ \rho_r^* ρ r ∗ , the state window of state block c c c consists of the four copies at positions 4 c + 3 , … , 4 c + 6 4c+3,\ldots,4c+6 4 c + 3 , … , 4 c + 6 of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 and induces A A A .
For state block c c c , exactly 20 + 42 c 20+42c 20 + 42 c entries precede its copy of F F F , so its complete window occupies positions
20 + 42 c + 1 , … , 20 + 42 c + 42. 20+42c+1,\ldots,20+42c+42. 20 + 42 c + 1 , … , 20 + 42 c + 42.
Some of the forbidden patterns are obtained from a state window by adding two or three new maxima. In addition to the single-insertion notation ins g ( π ) \operatorname{ins}_g(\pi) ins g ( π ) from Section 2, we use the following notation. All gaps refer to the original permutation π \pi π .
For g 1 < ⋯ < g t g_1 < \cdots< g_t g 1 < ⋯ < g t , the notation ins g 1 , … , g t ↗ ( π ) \operatorname{ins}^{\nearrow}_{g_1,\ldots,g_t}(\pi) ins g 1 , … , g t ↗ ( π ) from the main text inserts t t t new maxima into the specified gaps, increasing from left to right.
It is enough to prove that each unwanted root gap is inactive. Indeed, an insertion into an inactive root gap in any extension would, by deleting the other inserted entries and standardizing, yield a forbidden one-step extension of the root. The first family of forbidden patterns forbids insertions into the nine interior gaps of the marker copies:
B c o r e = { ins g ( T ) : T ∈ { D , S , E , N } , 1 ≤ g ≤ 9 } . \mathcal{B}_{\mathrm{core}}=\{\operatorname{ins}_{g}(T):T\in\{D,S,E,N\},\ 1\leq g\leq9\}. B core = { ins g ( T ) : T ∈ { D , S , E , N } , 1 ≤ g ≤ 9 } .
Within A A A , gap 12 follows F F F and gap 22 follows the first N N N -copy. The next family makes precisely those two gaps inactive:
B g a p = { ins 12 ( A ) , ins 22 ( A ) } . \mathcal{B}_{\mathrm{gap}}=\{\operatorname{ins}_{12}(A),\operatorname{ins}_{22}(A)\}. B gap = { ins 12 ( A ) , ins 22 ( A )} .
The capacity patterns
B c a p = { ins 10 ↗ 2 ( A ) , ins 11 ↗ 2 ( A ) } \mathcal{B}_{\mathrm{cap}}=\{\operatorname{ins}^{\nearrow2}_{10}(A),\operatorname{ins}^{\nearrow2}_{11}(A)\} B cap = { ins 10 ↗ 2 ( A ) , ins 11 ↗ 2 ( A )}
prevent a site from being used twice, while the conflict pattern
B c o n f = { ins 10 , 11 ↗ ( A ) } \mathcal{B}_{\mathrm{conf}}=\{\operatorname{ins}^{\nearrow}_{10,11}(A)\} B conf = { ins 10 , 11 ↗ ( A )}
prevents both sites of one state block from being used. These patterns are written with increasing inserted maxima. The ordering pattern defined below will force that order.
The remaining gaps
The previous forbidden patterns leave the final two gaps of each state window and the gaps at the two ends of the root. The following patterns describe the overlap and boundary windows that locate those gaps.
Definition A.9 (Overlap and boundary windows). Set
U = ϑ [ N , N , F , N ] , U D = ϑ [ D , N , F , N ] , U E = ϑ [ N , N , E , N ] . U=\vartheta[N,N,F,N],\qquad U_D=\vartheta[D,N,F,N],\qquad U_E=\vartheta[N,N,E,N]. U = ϑ [ N , N , F , N ] , U D = ϑ [ D , N , F , N ] , U E = ϑ [ N , N , E , N ] . The patterns U U U and U D U_D U D have length 42, while U E U_E U E has length 40. The four designated copies at positions 4 c + 5 , … , 4 c + 8 4c+5,\ldots,4c+8 4 c + 5 , … , 4 c + 8 form the overlap window between F ( c ) F(c) F ( c ) and F ( c + 1 ) F(c+1) F ( c + 1 ) . The first and last four designated copies form the left and right boundary windows, respectively. They induce U U U , U D U_D U D , and U E U_E U E as appropriate.
For two consecutive state windows, the occurrence of U U U uses the final two N N N -copies of the first window, the next state block, and its first following N N N -copy. Hence
B o v e r l a p = { ins 10 ( U ) , ins 20 ( U ) } \mathcal{B}_{\mathrm{overlap}}=\{\operatorname{ins}_{10}(U),\operatorname{ins}_{20}(U)\} B overlap = { ins 10 ( U ) , ins 20 ( U )} makes gaps 32 and 42 of every nonfinal state window inactive. The pattern ins 0 ( D ) \operatorname{ins}_{0}(D) ins 0 ( D ) makes the initial gap of the root inactive. The designated occurrence of U D U_D U D in the base permutation consists of the initial copies of D D D , N N N , the first state block, and its first following N N N -copy. Thus ins 10 ( U D ) \operatorname{ins}_{10}(U_D) ins 10 ( U D ) makes the gap after D D D inactive, and ins 20 ( U D ) \operatorname{ins}_{20}(U_D) ins 20 ( U D ) makes the gap between the initial N N N and the first state block inactive. The designated occurrence of U E U_E U E consists of the final two N N N -copies of the last state window followed by E , N E,N E , N .
Its gaps 10 and 20 are gaps 32 and 42 of the final state window, gap 30 is the gap after E E E , and gap 40 is the final gap of the root. We therefore set
B b o u n d a r y = { ins 0 ( D ) , ins 10 ( U D ) , ins 20 ( U D ) , ins 10 ( U E ) , ins 20 ( U E ) , ins 30 ( U E ) , ins 40 ( U E ) } . \mathcal{B}_{\mathrm{boundary}} = \{\operatorname{ins}_{0}(D), \operatorname{ins}_{10}(U_D), \operatorname{ins}_{20}(U_D), \operatorname{ins}_{10}(U_E), \operatorname{ins}_{20}(U_E), \operatorname{ins}_{30}(U_E), \operatorname{ins}_{40}(U_E)\}. B boundary = { ins 0 ( D ) , ins 10 ( U D ) , ins 20 ( U D ) , ins 10 ( U E ) , ins 20 ( U E ) , ins 30 ( U E ) , ins 40 ( U E )} .
The third N N N -copy following the final state block and the final copy of E E E also support the ordering pattern in
B o r d e r = { 4312 [ 1 , 1 , N , E ] } , \mathcal{B}_{\mathrm{order}} = \{4312[1,1,N,E]\}, B order = { 4312 [ 1 , 1 , N , E ]} ,
which will force all inserted maxima to increase from left to right.
Figure 6 summarizes how the repeated families treat the gaps in one state window.
Figure 6. The gap map of one state window, with gap numbers measured within the window. The patterns ins g ( T ) \operatorname{ins}_g(T) ins g ( T ) make the interior gaps of the marker copies inactive. The brace illustrates these gaps for the S S S -copy, and the same applies to each N N N -copy. The two gaps P 0 P_0 P 0 , P 1 P_1 P 1 remain as sites. Gaps 12 and 22 are made inactive by A A A -based patterns. Gaps 32 and 42 are made inactive by U U U -based patterns for nonfinal windows and by U E U_E U E -based patterns for the final window.
Definition A.10 (The state forbidden set). The state forbidden set is
B s t a t e = B c o r e ∪ B g a p ∪ B c a p ∪ B c o n f ∪ B o v e r l a p ∪ B o r d e r ∪ B b o u n d a r y . \mathcal{B}_{\mathrm{state}} = \mathcal{B}_{\mathrm{core}} \cup\mathcal{B}_{\mathrm{gap}} \cup\mathcal{B}_{\mathrm{cap}} \cup\mathcal{B}_{\mathrm{conf}}
\cup\mathcal{B}_{\mathrm{overlap}} \cup\mathcal{B}_{\mathrm{order}} \cup\mathcal{B}_{\mathrm{boundary}}. B state = B core ∪ B gap ∪ B cap ∪ B conf ∪ B overlap ∪ B order ∪ B boundary .
Proposition A.11 (Size of B s t a t e \mathcal{B}_{\mathrm{state}} B state ). The set B s t a t e \mathcal{B}_{\mathrm{state}} B state contains 51 distinct permutations, consisting of 37 permutations of length 11, one of length 22, four of length 41, six of length 43, and three of length 44.
Proof. The seven families in Definition A.10 have sizes 36, 2, 2, 1, 2, 1, and 7, giving 51 in total and the displayed length distribution. A short program checks every pair of the resulting permutations and confirms that they are distinct.
Routing the variable occurrences
The base permutation supplies the state blocks that will be assigned bits. We now determine how many are needed and how they must be connected to encode the formula. We arrange them into levels.
Treat each appearance of a variable in Φ \Phi Φ as a distinct variable occurrence and initially order the h h h variable occurrences clause by clause. Relabel the variables x 1 , … , x n x_1,\ldots,x_n x 1 , … , x n , choosing x n x_n x n to be the variable of the last variable occurrence in this order, and put λ = ⌈ log 2 n ⌉ \lambda= \lceil\log_2 n \rceil λ = ⌈ log 2 n ⌉ .
Levels 0 , … , λ + 1 0,\ldots,\lambda+1 0 , … , λ + 1 each contain one state block for every variable occurrence. The blocks representing the same variable occurrence in successive levels are required to have the same
tbl:1 The seven families of patterns in B s t a t e \mathcal{B}_{\mathrm{state}} B state and what each family enforces.
bit, so that bit is preserved while its position may change. Levels 0 and 1 both use clause order, where each consecutive triple represents one clause. The next λ \lambda λ levels gradually change clause order into an order in which all variable occurrences belonging to each variable are consecutive. The final level λ + 2 \lambda+2 λ + 2 is the merge level. It contains one state block for each variable, whose bit is required to agree with the bits of all its variable occurrences. We write b c b_c b c for the bit assigned to state block c c c .
The intermediate levels are needed because the proof of correctness requires that, when a new level is read from left to right, the positions of its variable occurrences in the preceding level have longest decreasing subsequence at most 2. A direct change from clause order to variable order need not satisfy this requirement. We instead pass through a sequence of stable binary partitions. Each pass preserves the order within the two groups. The preceding-level positions therefore form two increasing subsequences and satisfy the requirement.
Give x j x_j x j , for 1 ≤ j < n 1 \leq j < n 1 ≤ j < n , the λ \lambda λ -bit code representing j − 1 j-1 j − 1 . Give x n x_n x n the all-ones code 2 λ − 1 2^\lambda-1 2 λ − 1 . Starting from clause order, for 0 ≤ a < λ 0 \leq a < \lambda 0 ≤ a < λ stably partition the variable occurrences according to bit position a a a of their codes, from least significant to most significant. All variable occurrences whose code bit is 0 come first, followed by those whose code bit is 1, while the relative order within each group is preserved. After pass a a a the occurrences are ordered by the lowest a + 1 a+1 a + 1 code bits. After λ \lambda λ passes they are grouped in variable order x 1 , x 2 , … , x n x_1,x_2,\ldots,x_n x 1 , x 2 , … , x n with all variable occurrences belonging to each variable consecutive. The last variable occurrence has code bit 1 in every pass and therefore remains last throughout the reordering.
Levels, wires, and clause triples
The following construction turns these orders into levels of state blocks. It specifies which pairs of blocks must have the same bit and which triples must satisfy the not-all-equal condition.
Set r = ( λ + 2 ) h + n r=(\lambda+2)h+n r = ( λ + 2 ) h + n and, for 0 ≤ ℓ ≤ λ + 1 0 \leq\ell\leq\lambda+1 0 ≤ ℓ ≤ λ + 1 and 0 ≤ i < h 0 \leq i<h 0 ≤ i < h , index the state blocks of ρ i ∗ \rho_i^* ρ i ∗ by c ( ℓ , i ) = ℓ h + i c(\ell, i)=\ell h+i c ( ℓ , i ) = ℓ h + i . Thus, c ( ℓ , i ) c(\ell, i) c ( ℓ , i ) is the index of the state block F ( ℓ , i + 1 ) F(\ell, i+1) F ( ℓ , i + 1 ) from the main text. For each ℓ \ell ℓ , the blocks c ( ℓ , 0 ) , … , c ( ℓ , h − 1 ) c(\ell,0),\ldots,c(\ell,h-1) c ( ℓ , 0 ) , … , c ( ℓ , h − 1 ) form level ℓ \ell ℓ . The final n n n state blocks, with indices
( λ + 2 ) h + j − 1 , 1 ≤ j ≤ n , (\lambda+2)h+j-1,\qquad1\le j\le n, ( λ + 2 ) h + j − 1 , 1 ≤ j ≤ n ,
form level λ + 2 \lambda+2 λ + 2 , with block ( λ + 2 ) h + j − 1 (\lambda+2)h+j-1 ( λ + 2 ) h + j − 1 corresponding to x j x_j x j .
A wire is a directed pair s → t s\to t s → t connecting a state block s s s in one level to a state block t t t in the following level. We call s s s its source and t t t its target . A wire requires b s = b t b_s=b_t b s = b t . A transition is the set of wires between two successive levels. Let W Φ W_\Phi W Φ be the following set of wires:
In the transition from level 0 to level 1, add c ( 0 , i ) → c ( 1 , i ) c(0,i)\to c(1,i) c ( 0 , i ) → c ( 1 , i ) for every i i i . The triples
( c ( 1 , 3 k ) , c ( 1 , 3 k + 1 ) , c ( 1 , 3 k + 2 ) ) , 0 ≤ k < q , \bigl(c(1,3k),c(1,3k+1),c(1,3k+2)\bigr),\qquad0\le k<q, ( c ( 1 , 3 k ) , c ( 1 , 3 k + 1 ) , c ( 1 , 3 k + 2 ) ) , 0 ≤ k < q ,
form the set C Φ C_\Phi C Φ of clause triples .
For 0 ≤ a < λ 0\le a<\lambda 0 ≤ a < λ , the transition from level a + 1 a+1 a + 1 to level a + 2 a+2 a + 2 performs the a a a th stable binary partition described above. Add a wire from each variable occurrence in level a + 1 a+1 a + 1 to the block carrying the same variable occurrence in level a + 2 a+2 a + 2 .
In the transition from level λ + 1 \lambda+1 λ + 1 to level λ + 2 \lambda+2 λ + 2 , if a variable occurrence of x j x_j x j occupies position i i i in level λ + 1 \lambda+1 λ + 1 , add
c ( λ + 1 , i ) → ( λ + 2 ) h + j − 1. c(\lambda+1,i)\to(\lambda+2)h+j-1. c ( λ + 1 , i ) → ( λ + 2 ) h + j − 1.
We call the transition from level 0 to level 1 the clause transition , and level 1 the clause level . We call level λ + 2 \lambda+2 λ + 2 the merge level , and its state blocks the merge blocks . The final transition is the merge transition .
Lemma A.12 (Wire separation). Every wire s → t s\to t s → t satisfies t − s ≥ 2 t-s\ge2 t − s ≥ 2 .
Proof. First consider a wire between two levels that each contain h h h blocks. Suppose its source is at position i i i in level ℓ \ell ℓ and its target is at position j j j in level ℓ + 1 \ell+1 ℓ + 1 . The definitions of the block indices give
s = ℓ h + i , t = ( ℓ + 1 ) h + j , s=\ell h+i,\qquad t=(\ell+1)h+j, s = ℓ h + i , t = ( ℓ + 1 ) h + j , and hence
t − s = h + j − i . t-s=h+j-i. t − s = h + j − i . In the clause transition, the source and target have the same position, so j = i j=i j = i and t − s = h ≥ 3 t-s=h\ge3 t − s = h ≥ 3 . In a reordering transition, if i ≤ h − 2 i\le h-2 i ≤ h − 2 , then j ≥ 0 j\ge0 j ≥ 0 gives
t − s = h + j − i ≥ h − i ≥ 2. t-s=h+j-i\ge h-i\ge2. t − s = h + j − i ≥ h − i ≥ 2. If i = h − 1 i=h-1 i = h − 1 , the source is the last variable occurrence. This variable occurrence remains last through every stable binary partition, so j = h − 1 j=h-1 j = h − 1 and t − s = h t-s=h t − s = h .
It remains to consider the merge transition. If the source is at position i i i and its variable is x j x_j x j , then
s = ( λ + 1 ) h + i , t = ( λ + 2 ) h + j − 1 , s=(\lambda+1)h+i,\qquad t=(\lambda+2)h+j-1, s = ( λ + 1 ) h + i , t = ( λ + 2 ) h + j − 1 , so t − s = h + j − 1 − i t-s=h+j-1-i t − s = h + j − 1 − i . If i ≤ h − 2 i\le h-2 i ≤ h − 2 , then t − s ≥ h − i ≥ 2 t-s\ge h-i\ge2 t − s ≥ h − i ≥ 2 . If i = h − 1 i=h-1 i = h − 1 , the source is the final variable occurrence, which belongs to x n x_n x n . Therefore j = n j=n j = n and t − s = n ≥ 2 t-s=n\ge2 t − s = n ≥ 2 .
Figure 3 summarizes the levels and the transitions.
Lemma A.13 (Correctness of the routing). The formula Φ \Phi Φ is NAE-satisfiable if and only if bits can be assigned to the r r r state blocks so that every wire has equal endpoint bits and every clause triple is nonconstant.
Proof. Suppose Φ \Phi Φ has an NAE-satisfying assignment β \beta β . Give each level-0 block the truth value of the variable it represents, and propagate these bits through the clause and reordering levels. Give the merge block for x j x_j x j the bit β ( x j ) \beta(x_j) β ( x j ) . Every wire has equal endpoint bits, and each clause triple contains the truth values of the three variable occurrences in one clause, so it is nonconstant.
Conversely, suppose the block bits satisfy every wire and clause triple. The clause and reordering transitions propagate the bit associated with each variable occurrence while merely changing its position. The merge wires therefore force all variable occurrences belonging to x j x_j x j to have the bit of its merge block. Define β ( x j ) \beta(x_j) β ( x j ) to be this bit. Each clause triple then has the three truth values assigned to its clause and is nonconstant. Thus β \beta β NAE-satisfies Φ \Phi Φ .
Encoding the wires and clauses
We now augment ρ r ∗ \rho_r^* ρ r ∗ to encode the wires and clause triples. Each wire s → t s \to t s → t is encoded by two patterns whose values identify the source s s s and whose positions bracket the target block F ( t ) F(t) F ( t ) . Each clause triple is encoded by two further patterns placed on either side of its three state blocks.
Definition A.14 (Constraint permutations). Let
Q L , Q R , C L , C R ∈ S 10 Q_L, Q_R, C_L, C_R \in\mathcal{S}_{10} Q L , Q R , C L , C R ∈ S 10
be the four permutations listed and plotted in Appendix B. Collectively they are the constraint permutations. These four permutations identify the wires and clause triples.
Proposition A.15 (Properties of the constraint permutations). The four constraint permutations are pairwise distinct and simple, none is equal to a marker permutation, and every constraint permutation T T T satisfies LDS ( T ) = 6 \operatorname{LDS}(T) = 6 LDS ( T ) = 6 .
Proof. A short program exhaustively checks the four displayed permutations of length 10, together with the four marker permutations, and confirms the stated properties.
The designated copies of Q L Q_L Q L , Q R Q_R Q R , C L C_L C L , and C R C_R C R are collectively called constraint copies . These copies encode the wires and clause triples. The four violation patterns introduced in the next section exclude bit assignments with unequal wire endpoints or constant clause triples. We first specify the available relative value positions for these copies.
Definition A.16 (Value band). Let s s s be the source block of a wire. In the value interval between S ( s ) S(s) S ( s ) and J ( s ) J(s) J ( s ) , reserve four possible slots, ordered from lowest to highest as the C L C_L C L -, Q L Q_L Q L -, Q R Q_R Q R -, and C R C_R C R -slots of s s s .
S ( s ) < C L -slot < Q L -slot < Q R -slot < C R -slot < J ( s ) , S(s) < C_L\text{-slot} < Q_L\text{-slot} < Q_R\text{-slot} < C_R\text{-slot} < J(s), S ( s ) < C L -slot < Q L -slot < Q R -slot < C R -slot < J ( s ) , where U < V U < V U < V means that every value in U U U is smaller than every value in V V V . An occupied slot contains one copy of the corresponding constraint permutation and consists of ten consecutive values. An unused slot contains no entries. The union of the occupied slots is the value band of s s s .
For each wire s → t s \to t s → t , copies of Q L Q_L Q L and Q R Q_R Q R occupy the value band of s s s and lie on opposite sides of F ( t ) F(t) F ( t ) in position. Thus their values identify the source, while their positions identify the target. Similarly, copies of C L C_L C L and C R C_R C R bracket the three state blocks of a clause triple. We next give the precise placement rules. Every block that is a source of a wire has exactly one outgoing wire, so the corresponding copies can be indexed by that source. The permutation ρ Φ \rho_\Phi ρ Φ is obtained from ρ r ∗ \rho_r^* ρ r ∗ by the following placement rules:
(D1) For each state block t t t with incoming wires s 1 → t , … , s m → t s_1 \to t, \ldots, s_m \to t s 1 → t , … , s m → t , where s 1 < ⋯ < s m s_1 < \cdots< s_m s 1 < ⋯ < s m , add two constraint copies Q L ( s i ) Q_L(s_i) Q L ( s i ) and Q R ( s i ) Q_R(s_i) Q R ( s i ) for each i i i . Place
Q L ( s 1 ) , … , Q L ( s m ) Q_L(s_1), \ldots, Q_L(s_m) Q L ( s 1 ) , … , Q L ( s m )
consecutively immediately before F ( t ) F(t) F ( t ) , and place
Q R ( s 1 ) , … , Q R ( s m ) Q_R(s_1), \ldots, Q_R(s_m) Q R ( s 1 ) , … , Q R ( s m )
consecutively immediately after F ( t ) F(t) F ( t ) . For each i i i , the values of Q L ( s i ) Q_L(s_i) Q L ( s i ) and Q R ( s i ) Q_R(s_i) Q R ( s i ) occupy the Q L Q_L Q L - and Q R Q_R Q R -slots, respectively, in the value band of s i s_i s i .
(D2) For each clause triple ( t 0 , t 1 , t 2 ) ∈ C Φ (t_0,t_1,t_2) \in C_\Phi ( t 0 , t 1 , t 2 ) ∈ C Φ , let s 0 → t 0 s_0 \to t_0 s 0 → t 0 be the incoming wire to t 0 t_0 t 0 . Add two constraint copies C L ( s 0 ) C_L(s_0) C L ( s 0 ) and C R ( s 0 ) C_R(s_0) C R ( s 0 ) . Place C L ( s 0 ) C_L(s_0) C L ( s 0 ) immediately before the Q L Q_L Q L -copy at t 0 t_0 t 0 and C R ( s 0 ) C_R(s_0) C R ( s 0 ) immediately after the Q R Q_R Q R -copy at t 2 t_2 t 2 . The values of C L ( s 0 ) C_L(s_0) C L ( s 0 ) and C R ( s 0 ) C_R(s_0) C R ( s 0 ) occupy the C L C_L C L - and C R C_R C R -slots, respectively, in the value band of s 0 s_0 s 0 .
(D3) No other constraint copies are added.
Rules D1–D3, together with the value order in Definition A.16, determine ρ Φ \rho_\Phi ρ Φ uniquely.
Lemma A.17 (Separation of nonadjacent windows). Let c c c and c ′ c' c ′ index state blocks of ρ Φ \rho_\Phi ρ Φ , and suppose that c ′ ≥ c + 2 c' \ge c + 2 c ′ ≥ c + 2 . Then the window of c c c lies below the window of c ′ c' c ′ . If c c c is a source block, its value band also lies below the window of c ′ c' c ′ .
In particular, for every wire s → t s \to t s → t , the window and value band of s s s lie below the window of t t t .
Proof. By Definition A.6, the defining-sequence values underlying the window of c c c are
( a 4 c + 3 , … , a 4 c + 6 ) = ( 4 c + 6 , 4 c + 3 , 4 c + 8 , 4 c + 5 ) , (a_{4c+3}, \ldots, a_{4c+6}) = (4c + 6, 4c + 3, 4c + 8, 4c + 5), ( a 4 c + 3 , … , a 4 c + 6 ) = ( 4 c + 6 , 4 c + 3 , 4 c + 8 , 4 c + 5 ) ,
whose maximum is 4 c + 8 4c + 8 4 c + 8 . The minimum of the corresponding four values for c ′ c' c ′ is 4 c ′ + 3 4c' + 3 4 c ′ + 3 . Since c ′ ≥ c + 2 c' \ge c + 2 c ′ ≥ c + 2 ,
4 c ′ + 3 ≥ 4 c + 11 > 4 c + 8. 4c' + 3 \ge4c + 11 > 4c + 8. 4 c ′ + 3 ≥ 4 c + 11 > 4 c + 8.
Standardization and inflation preserve this order, so the window of c c c lies below the window of c ′ c' c ′ . If c c c is a source block, its value band lies below J ( c ) J(c) J ( c ) , which belongs to the window of c c c , and hence also lies below the window of c ′ c' c ′ .
For a wire s → t s \to t s → t , Lemma A.12 gives t ≥ s + 2 t \ge s + 2 t ≥ s + 2 , so the preceding result applies with c = s c=s c = s and c ′ = t c'=t c ′ = t . ◀
The placement rules also determine which state blocks lie between the constraint copies.
Lemma A.18 (Positional brackets). For every wire s → t s \to t s → t , the only state block between Q L ( s ) Q_L(s) Q L ( s ) and Q R ( s ) Q_R(s) Q R ( s ) in position is F ( t ) F(t) F ( t ) , and no other marker copy lies between them.
For every clause triple ( t 0 , t 1 , t 2 ) ∈ C Φ (t_0,t_1,t_2) \in C_\Phi ( t 0 , t 1 , t 2 ) ∈ C Φ , let s 0 → t 0 s_0 \to t_0 s 0 → t 0 be the incoming wire to t 0 t_0 t 0 . The state blocks between C L ( s 0 ) C_L(s_0) C L ( s 0 ) and C R ( s 0 ) C_R(s_0) C R ( s 0 ) in position are exactly F ( t 0 ) , F ( t 1 ) , F ( t 2 ) F(t_0), F(t_1), F(t_2) F ( t 0 ) , F ( t 1 ) , F ( t 2 ) , in that order.
Proof. Immediate from Rules D1–D3 and the definition of C Φ \mathcal{C}_{\Phi} C Φ .
The construction uses ( λ + 2 ) h (\lambda+ 2)h ( λ + 2 ) h wires and q q q clause triples. Consequently
∣ ρ Φ ∣ = ( 42 r + 40 ) + 20 ( λ + 2 ) h + 20 q . (2) |\rho_{\Phi}| = (42r + 40) + 20(\lambda+ 2)h + 20q. \tag*{(2)} ∣ ρ Φ ∣ = ( 42 r + 40 ) + 20 ( λ + 2 ) h + 20 q . (2)
The reduction maps Φ \Phi Φ to ( ρ Φ , 1 r ) (\rho_{\Phi},1^r) ( ρ Φ , 1 r ) . Since n ≤ h n \le h n ≤ h , we have λ = O ( log h ) \lambda= O(\log h) λ = O ( log h ) and r = O ( h log h ) r = O(h\log h) r = O ( h log h ) . Moreover, q = h / 3 q = h/3 q = h /3 , so (2) gives ∣ ρ Φ ∣ = O ( h log h ) |\rho_{\Phi}| = O(h\log h) ∣ ρ Φ ∣ = O ( h log h ) . Thus the output has polynomial size and can be constructed in polynomial time.
The four violation patterns
The constraint copies identify the wires and clause triples but do not yet restrict the bits assigned to their state blocks. We now define four forbidden patterns that complete the construction. Two forbid unequal endpoints of a wire, and two forbid the constant assignments on a clause triple.
Equality along wires
Definition A.19 (A e q A_{\mathrm{eq}} A eq ). Let s → t ∈ W Φ s \to t \in\mathcal{W}_{\Phi} s → t ∈ W Φ . Define A e q A_{\mathrm{eq}} A eq to be the permutation induced by the following 104 entries, given in positional order:
the four blocks of the window of s s s (42 entries).
the copy Q L ( s ) Q_L(s) Q L ( s ) (10).
the state block F ( t ) F(t) F ( t ) (12).
the copy Q R ( s ) Q_R(s) Q R ( s ) (10).
the three N N N -copies in the window of t t t (30).
Lemma A.20 (A e q A_{\mathrm{eq}} A eq is well defined). A e q A_{\mathrm{eq}} A eq is a permutation of length 104, independent of Φ \Phi Φ and of the chosen wire.
Proof. Definition A.19 fixes the positional order of the selected entries. The windows of s s s and t t t both induce A A A . By Lemma A.17 , the window and value band of s s s lie below the window of t t t . By Definition A.16 and Rule D1, Q L ( s ) Q_L(s) Q L ( s ) and Q R ( s ) Q_R(s) Q R ( s ) lie between S ( s ) S(s) S ( s ) and J ( s ) J(s) J ( s ) in value, with Q L ( s ) < Q R ( s ) Q_L(s) < Q_R(s) Q L ( s ) < Q R ( s ) . Thus the induced permutation is independent of Φ \Phi Φ and of the chosen wire. Its length is 42 + 10 + 12 + 10 + 30 = 104 42 + 10 + 12 + 10 + 30 = 104 42 + 10 + 12 + 10 + 30 = 104 .
In A e q A_{\mathrm{eq}} A eq the source state block occupies positions 1 , … , 12 1,\ldots,12 1 , … , 12 , so its sites are gaps 10 and 11. The target state block occupies positions 53 , … , 64 53,\ldots,64 53 , … , 64 , so its sites are gaps 62 and 63. We therefore define
P 01 ≠ = ins 10 , 63 ↗ ( A e q ) , P 10 ≠ = ins 11 , 62 ↗ ( A e q ) . P_{01}^{\ne} = \operatorname{ins}^{\nearrow}_{10,63}(A_{\mathrm{eq}}), \qquad P_{10}^{\ne} = \operatorname{ins}^{\nearrow}_{11,62}(A_{\mathrm{eq}}). P 01 = = ins 10 , 63 ↗ ( A eq ) , P 10 = = ins 11 , 62 ↗ ( A eq ) .
Both patterns have length 106. The first represents state 0 at the source and state 1 at the target. The second represents state 1 at the source and state 0 at the target.
Not-all-equal clauses
Definition A.21 (A n a e A_{\mathrm{nae}} A nae ). Let ( t 0 , t 1 , t 2 ) ∈ C Φ (t_0,t_1,t_2) \in\mathcal{C}_{\Phi} ( t 0 , t 1 , t 2 ) ∈ C Φ , and let s 0 → t 0 s_0 \to t_0 s 0 → t 0 be the incoming wire to t 0 t_0 t 0 . Define A n a e A_{\mathrm{nae}} A nae to be the pattern induced by the following 188 entries, given in positional order:
the four blocks of the window of s 0 s_0 s 0 (42).
the copy C L ( s 0 ) C_L(s_0) C L ( s 0 ) (10).
(iii) the four blocks of the window of t 0 t_0 t 0 (42).
(iv) the four blocks of the window of t 1 t_1 t 1 (42).
(v) the state block F ( t 2 ) F(t_2) F ( t 2 ) (12).
(vi) the copy C R ( s 0 ) C_{\mathrm{R}}(s_0) C R ( s 0 ) (10).
(vii) the three N N N -copies in the window of t 2 t_2 t 2 (30).
Lemma A.22 (A n a e A_{\mathrm{nae}} A nae is well defined). A n a e A_{\mathrm{nae}} A nae is a permutation of length 188, independent of Φ \Phi Φ and of the chosen clause triple.
Proof. Definition A.21 fixes the positional order of the selected entries. By Definition A.16 and Rule D2, the copies of C L C_{\mathrm{L}} C L and C R C_{\mathrm{R}} C R have fixed positions in the value band of s 0 s_0 s 0 . By Lemma A.17, the source window and its value band lie below the three target windows. It remains only to determine the relative values of those target windows.
Write t 0 = u t_0=u t 0 = u , t 1 = u + 1 t_1=u+1 t 1 = u + 1 , and t 2 = u + 2 t_2=u+2 t 2 = u + 2 . The defining-sequence values underlying the window of a state block v v v are
4 v + 6 , 4 v + 3 , 4 v + 8 , 4 v + 5. 4v+6,\quad4v+3,\quad4v+8,\quad4v+5. 4 v + 6 , 4 v + 3 , 4 v + 8 , 4 v + 5.
Hence the values underlying the three target windows are 4 u + { 3 , 5 , 6 , 8 } 4u+\{3,5,6,8\} 4 u + { 3 , 5 , 6 , 8 } , 4 u + { 7 , 9 , 10 , 12 } 4u+\{7,9,10,12\} 4 u + { 7 , 9 , 10 , 12 } , and 4 u + { 11 , 13 , 14 , 16 } 4u+\{11,13,14,16\} 4 u + { 11 , 13 , 14 , 16 } . Their increasing order is
3 , 5 , 6 ⏟ t 0 , 7 ⏟ t 1 , 8 , 9 , 10 ⏟ t 0 , t 1 , 11 ⏟ t 2 , 12 ⏟ t 1 , 13 , 14 , 16 ⏟ t 2 \underbrace{3,5,6}_{t_0},\quad
\underbrace{7}_{t_1},\quad
\underbrace{8,9,10}_{t_0,t_1},\quad
\underbrace{11}_{t_2},\quad
\underbrace{12}_{t_1},\quad
\underbrace{13,14,16}_{t_2} t 0 3 , 5 , 6 , t 1 7 , t 0 , t 1 8 , 9 , 10 , t 2 11 , t 1 12 , t 2 13 , 14 , 16
up to the common offset 4 u 4u 4 u . This order is independent of u u u , and every inflated block induces a fixed permutation. Thus A n a e A_{\mathrm{nae}} A nae is independent of Φ \Phi Φ and of the chosen clause triple. Its length is 42 + 10 + 42 + 42 + 12 + 10 + 30 = 188 42+10+42+42+12+10+30=188 42 + 10 + 42 + 42 + 12 + 10 + 30 = 188 .
In A n a e A_{\mathrm{nae}} A nae the state blocks of t 0 , t 1 , t 2 t_0,t_1,t_2 t 0 , t 1 , t 2 occupy positions 53–64, 95–106 and 137–148, so their sites are the gaps
P 0 : 62 , 104 , 146 , P 1 : 63 , 105 , 147. P_0: 62,\,104,\,146,\qquad P_1: 63,\,105,\,147. P 0 : 62 , 104 , 146 , P 1 : 63 , 105 , 147.
We therefore define
P 000 m o n o = ins 62 , 104 , 146 ↗ ( A n a e ) , P 111 m o n o = ins 63 , 105 , 147 ↗ ( A n a e ) . P^{\mathrm{mono}}_{000}=\operatorname{ins}^{\nearrow}_{62,104,146}(A_{\mathrm{nae}}),\qquad
P^{\mathrm{mono}}_{111}=\operatorname{ins}^{\nearrow}_{63,105,147}(A_{\mathrm{nae}}). P 000 mono = ins 62 , 104 , 146 ↗ ( A nae ) , P 111 mono = ins 63 , 105 , 147 ↗ ( A nae ) .
Both patterns have length 191. In the two patterns, the inserted maxima occupy, respectively, the three P 0 P_0 P 0 sites and the three P 1 P_1 P 1 sites of the state blocks in the clause triple.
Collectively, these four permutations form the set of violation patterns
B v i o l = { P 01 ≠ , P 10 ≠ , P 000 m o n o , P 111 m o n o } . \mathcal{B}_{\mathrm{viol}}=\{P^{\ne}_{01},P^{\ne}_{10},P^{\mathrm{mono}}_{000},P^{\mathrm{mono}}_{111}\}. B viol = { P 01 = , P 10 = , P 000 mono , P 111 mono } .
Table 2 shows the assignments excluded by the violation patterns.
Table 2. The equality and NAE conditions enforced by the violation patterns.
The forbidden set B f i n a l B_{\mathrm{final}} B final
The patterns in B s t a t e B_{\mathrm{state}} B state control where maxima may be inserted. The four violation patterns impose the Boolean conditions on the wires and clause triples. Their union is the fixed forbidden set used in the reduction.
Definition A.23 (B f i n a l B_{\mathrm{final}} B final ). B f i n a l = B s t a t e ∪ B v i o l B_{\mathrm{final}}=B_{\mathrm{state}}\cup B_{\mathrm{viol}} B final = B state ∪ B viol .
The reduction and the forbidden set B f i n a l B_{\mathrm{final}} B final are now fully defined. The rest of the appendix proves that the base permutation has extension depth r r r and that every maximum-depth extension assigns a unique bit to each state block. It then proves that adding constraint copies preserves both conclusions and that every occurrence of a violation pattern corresponds to an unequal wire or a constant clause triple.
Verification of the base permutation and ρ Φ \rho_{\Phi} ρ Φ
We first prove that every occurrence of a marker or constraint permutation is one of the copies placed above. We then show that B s t a t e B_{\mathrm{state}} B state leaves exactly two sites in every state block and gives depth r r r , both before and after the constraint copies are added. Finally, we prove that the violation patterns occur exactly on wires with unequal endpoint bits and clause triples with equal bits.
Occurrences of ϑ \vartheta ϑ in increasing oscillations
This subsection proves the properties of increasing oscillations used later.
Lemma A.24 (Occurrences of ϑ \vartheta ϑ in ω m \omega_m ω m ). Let m ≥ 4 m \ge4 m ≥ 4 . The occurrences of ϑ \vartheta ϑ in ω m \omega_m ω m are exactly the sets of four consecutive positions
p , p + 1 , p + 2 , p + 3 , p, p+1, p+2, p+3, p , p + 1 , p + 2 , p + 3 , where p p p is odd and p + 3 ≤ m p+3 \le m p + 3 ≤ m .
Proof. Write a 1 , a 2 , … a_1,a_2,\ldots a 1 , a 2 , … for the defining sequence of Definition A.6, so a 2 k − 1 = 2 k + 2 a_{2k-1}=2k+2 a 2 k − 1 = 2 k + 2 and a 2 k = 2 k − 1 a_{2k}=2k-1 a 2 k = 2 k − 1 . Let G m G_m G m be the inversion graph on positions 1 , … , m 1,\ldots,m 1 , … , m , with an edge { i , j } \{i,j\} { i , j } for i < j i<j i < j when a i > a j a_i>a_j a i > a j . Directly from the formulas for a i a_i a i ,
E ( G m ) = { { 2 k − 1 , 2 k } : 2 k ≤ m } ∪ { { 2 k − 1 , 2 k + 2 } : 2 k + 2 ≤ m } . E(G_m)=\{\{2k-1,2k\}:2k\le m\}\cup\{\{2k-1,2k+2\}:2k+2\le m\}. E ( G m ) = {{ 2 k − 1 , 2 k } : 2 k ≤ m } ∪ {{ 2 k − 1 , 2 k + 2 } : 2 k + 2 ≤ m } .
Here E ( G m ) E(G_m) E ( G m ) denotes the edge set of G m G_m G m . If m m m is even, G m G_m G m is the path
2 − 1 − 4 − 3 − 6 − 5 − ⋯ − m − ( m − 1 ) . 2-1-4-3-6-5-\cdots-m-(m-1). 2 − 1 − 4 − 3 − 6 − 5 − ⋯ − m − ( m − 1 ) .
If m m m is odd, the same path uses positions 1 , … , m − 1 1,\ldots,m-1 1 , … , m − 1 , and position m m m is isolated. Write the vertices in their path order as
v 2 i − 1 = 2 i , v 2 i = 2 i − 1 for 1 ≤ i ≤ ⌊ m / 2 ⌋ . v_{2i-1}=2i,\qquad v_{2i}=2i-1\qquad\text{for }1\le i\le\lfloor m/2\rfloor. v 2 i − 1 = 2 i , v 2 i = 2 i − 1 for 1 ≤ i ≤ ⌊ m /2 ⌋ .
The inversion graph of ϑ = 3142 \vartheta=3142 ϑ = 3142 has edges
{ 1 , 2 } , { 1 , 4 } , { 3 , 4 } , \{1,2\},\ \{1,4\},\ \{3,4\}, { 1 , 2 } , { 1 , 4 } , { 3 , 4 } ,
and is the path 2 − 1 − 4 − 3 2-1-4-3 2 − 1 − 4 − 3 . Hence the positions of any occurrence of ϑ \vartheta ϑ induce a four-vertex path in G m G_m G m . Since G m G_m G m is itself a path apart from a possible isolated vertex, these positions must be v s , v s + 1 , v s + 2 , v s + 3 v_s,v_{s+1},v_{s+2},v_{s+3} v s , v s + 1 , v s + 2 , v s + 3 for some s s s .
If s s s is odd, write s = 2 i − 1 s=2i-1 s = 2 i − 1 . The four vertices are
v 2 i − 1 , … , v 2 i + 2 = 2 i , 2 i − 1 , 2 i + 2 , 2 i + 1 , v_{2i-1},\ldots,v_{2i+2}=2i,\ 2i-1,\ 2i+2,\ 2i+1, v 2 i − 1 , … , v 2 i + 2 = 2 i , 2 i − 1 , 2 i + 2 , 2 i + 1 ,
which, in increasing position order, are 2 i − 1 , … , 2 i + 2 2i-1,\ldots,2i+2 2 i − 1 , … , 2 i + 2 . Moreover,
st ( a 2 i − 1 , … , a 2 i + 2 ) = 3142 = ϑ . \operatorname{st}(a_{2i-1},\ldots,a_{2i+2})=3142=\vartheta. st ( a 2 i − 1 , … , a 2 i + 2 ) = 3142 = ϑ .
If s s s is even, write s = 2 i s=2i s = 2 i . The selected positions in increasing order are
2 i − 1 , 2 i + 1 , 2 i + 2 , 2 i + 4 , 2i-1,\ 2i+1,\ 2i+2,\ 2i+4, 2 i − 1 , 2 i + 1 , 2 i + 2 , 2 i + 4 ,
and
st ( a 2 i − 1 , a 2 i + 1 , a 2 i + 2 , a 2 i + 4 ) = 2413 ≠ ϑ . \operatorname{st}(a_{2i-1},a_{2i+1},a_{2i+2},a_{2i+4})=2413\ne\vartheta. st ( a 2 i − 1 , a 2 i + 1 , a 2 i + 2 , a 2 i + 4 ) = 2413 = ϑ .
Thus every occurrence of ϑ \vartheta ϑ occupies four consecutive positions beginning at an odd position. Conversely, the displayed standardization shows that every such set of positions induces ϑ \vartheta ϑ .
We use the following bound for decreasing subsequences.
Lemma A.25 (Subadditivity of LDS). If the entries of π \pi π are partitioned into parts P 1 , … , P t P_1,\ldots,P_t P 1 , … , P t with LDS ( P i ) ≤ a i \operatorname{LDS}(P_i)\le a_i LDS ( P i ) ≤ a i , then LDS ( π ) ≤ a 1 + ⋯ + a t \operatorname{LDS}(\pi)\le a_1+\cdots+a_t LDS ( π ) ≤ a 1 + ⋯ + a t .
Proof. A decreasing subsequence meets P i P_i P i in a decreasing subsequence, hence in at most a i a_i a i entries. Summing over the parts gives the stated bound.
Lemma A.26 (Longest decreasing subsequences of ω m \omega_m ω m ). LDS ( ω m ) ≤ 2 \operatorname{LDS}(\omega_m)\le2 LDS ( ω m ) ≤ 2 for all m ≥ 2 m\ge2 m ≥ 2 .
Proof. In the defining sequence, the values in odd positions form the increasing sequence 4 , 6 , 8 , … 4,6,8,\ldots 4 , 6 , 8 , … , while the values in even positions form the increasing sequence 1 , 3 , 5 , … 1,3,5,\ldots 1 , 3 , 5 , … . Standardization preserves these orders, so ω m \omega_m ω m is the union of two increasing subsequences and LDS ( ω m ) ≤ 2 \operatorname{LDS}(\omega_m)\le2 LDS ( ω m ) ≤ 2 by Lemma A.25.
We next prove that an occurrence of a marker or constraint permutation cannot use entries from several copies placed by the construction.
Occurrences of marker and constraint permutations
The following lemma shows how a simple occurrence can meet a block.
Lemma A.27 (A simple occurrence meeting a block). Let τ \tau τ be a simple permutation, and let I I I be a block of a permutation σ \sigma σ . If an occurrence of τ \tau τ in σ \sigma σ meets I I I in at least two entries, then the whole occurrence lies inside I I I .
Proof. Let O O O be an occurrence of τ \tau τ in σ \sigma σ . We show that O ∩ I O\cap I O ∩ I is a block of the permutation induced by O O O . Since I I I occupies consecutive positions in σ \sigma σ , the entries of O ∩ I O\cap I O ∩ I occupy consecutive positions within O O O . Similarly, any entry of O O O whose value lies between the values of two entries in O ∩ I O\cap I O ∩ I must also lie in I I I , because I I I contains a consecutive set of values. Hence O ∩ I O\cap I O ∩ I occupies consecutive value ranks within O O O . Therefore O ∩ I O\cap I O ∩ I is a block of O O O . Since τ \tau τ is simple and ∣ O ∩ I ∣ ≥ 2 |O\cap I|\ge2 ∣ O ∩ I ∣ ≥ 2 , this block must be all of O O O , and hence O ⊆ I O\subseteq I O ⊆ I .
Throughout this subsection, a configuration means either the base permutation ρ r ∗ \rho_r^* ρ r ∗ or ρ Φ \rho_\Phi ρ Φ , together with any inserted maxima placed at sites. Here marker copy and constraint copy refer to copies placed by the construction, whereas occurrence has its pattern-containment meaning. We prove below that every occurrence of one of the eight marker and constraint permutations is a copy placed by the construction.
Blocks occupied by construction copies
We first show that every placed marker or constraint copy remains a block after constraint copies and inserted maxima are added. This lets us use simplicity whenever an occurrence meets one copy more than once.
Lemma A.28 (Marker and constraint copies are blocks). In every configuration, each marker copy and each constraint copy is a block.
Proof. Positions. Each copy was placed as a run of consecutive positions. By D1–D3, constraint copies are placed immediately before or after state blocks or adjacent runs of constraint copies, never inside a marker copy. Inserted maxima lie only at sites, which occur after the marker copy inside a state block. Hence no later placement separates the positions of a marker or constraint copy, so every such copy still occupies consecutive positions.
Values. A marker copy outside a state block occupies the entire value interval of its corresponding entry of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 , which is consecutive. Inside a state block, the marker copy S ( c ) S(c) S ( c ) occupies the bottom 10 values of the block’s value interval. If c c c is a source block, Definition A.16 places its value band strictly between S ( c ) S(c) S ( c ) and J ( c ) J(c) J ( c ) . Thus every marker copy occupies consecutive values. Each constraint copy fills the corresponding consecutive 10-value slot from Definition A.16. Every inserted maximum is greater than every root entry, so it cannot separate the consecutive values of a marker or constraint copy. Hence every marker and constraint copy still occupies consecutive values.
State blocks themselves need not be blocks in the formal sense. A state block F ( s ) F(s) F ( s ) of ρ Φ \rho_{\Phi} ρ Φ is a run of consecutive positions, but as soon as the value band of s s s is nonempty its values are not consecutive: the band separates S ( s ) S(s) S ( s ) from J ( s ) J(s) J ( s ) in value while the band’s entries occur outside F ( s ) F(s) F ( s ) in position. Lemma A.27 is therefore applied below to marker and constraint copies, never to state blocks.
Lemma A.29 (Inserted maxima increase from left to right). Let π \pi π be a configuration avoiding B s t a t e B_{\mathrm{state}} B state . Then its inserted maxima increase from left to right in value.
Proof. In ρ ∗ \rho^{*} ρ ∗ , the third N N N -copy following the final state block and the final copy of E E E lie to the right of every site, and every value in that N N N -copy is smaller than every value in E E E . Constructing ρ Φ \rho_{\Phi} ρ Φ and inserting maxima neither deletes nor reorders root entries. Suppose inserted maxima x x x and y y y satisfy x < y x < y x < y in position but x > y x > y x > y in value. Then x x x , y y y together with these copies of N N N and E E E form an occurrence of 4312 [ 1 , 1 , N , E ] 4312[1,1,N,E] 4312 [ 1 , 1 , N , E ] , contradicting the assumed B s t a t e B_{\mathrm{state}} B state -avoidance.
Decreasing subsequences among constraint copies
We next bound how many distinct constraint copies can contribute to a decreasing subsequence. We will combine this bound with the common decreasing-subsequence length of the fixed marker permutations.
Lemma A.30 (Constraint copies have LDS at most 2). Let β \beta β be the pattern induced by choosing one arbitrary entry from each constraint copy of ρ Φ \rho_{\Phi} ρ Φ . Then LDS ( β ) ≤ 2 \operatorname{LDS}(\beta) \le2 LDS ( β ) ≤ 2 .
Proof. By Lemma A.28 , each constraint copy is a block, so the relative order of the chosen entries depends only on their copies. Let δ \delta δ be a decreasing subsequence of β \beta β . Associate the two copies of each wire with its transition, and associate every copy of C L C_L C L or C R C_R C R with the clause transition. If 0 ≤ a < b ≤ λ + 1 0 \le a < b \le\lambda+ 1 0 ≤ a < b ≤ λ + 1 , every copy associated with the transition out of level a a a lies before and below every copy associated with the transition out of level b b b . Indeed, their positions surround blocks in the corresponding target levels, and their values lie in bands of the corresponding source levels. Hence δ \delta δ uses copies from only one transition.
The clause transition. For a clause triple with consecutive sources s 0 , s 1 , s 2 s_0, s_1, s_2 s 0 , s 1 , s 2 , its eight constraint copies appear in positional order
C L ( s 0 ) , Q L ( s 0 ) , Q R ( s 0 ) , Q L ( s 1 ) , Q R ( s 1 ) , Q L ( s 2 ) , Q R ( s 2 ) , C R ( s 0 ) , C_L(s_0), Q_L(s_0), Q_R(s_0), Q_L(s_1), Q_R(s_1), Q_L(s_2), Q_R(s_2), C_R(s_0), C L ( s 0 ) , Q L ( s 0 ) , Q R ( s 0 ) , Q L ( s 1 ) , Q R ( s 1 ) , Q L ( s 2 ) , Q R ( s 2 ) , C R ( s 0 ) ,
and their value ranks are
1 , 2 , 3 , 5 , 6 , 7 , 8 , 4. 1, 2, 3, 5, 6, 7, 8, 4. 1 , 2 , 3 , 5 , 6 , 7 , 8 , 4.
Distinct triples increase in both position and value, so δ \delta δ uses copies from only one triple. The first seven ranks are increasing, so δ \delta δ contains at most one of them and possibly the final rank. Thus ∣ δ ∣ ≤ 2 |\delta| \le2 ∣ δ ∣ ≤ 2 .
A reordering transition. Reading the target level from left to right, the source indices appear first for the variable occurrences whose relevant binary bit is 0 0 0 , in their original order, and then for those whose bit is 1 1 1 , also in their original order. Thus the source indices are the union of two increasing subsequences. For each source, the selected entries from its Q L Q_L Q L - and Q R Q_R Q R -copies form an increasing pair because the Q L Q_L Q L -slot precedes the Q R Q_R Q R -slot in value. Hence δ \delta δ contains at most one of them. Since each value band lies between S ( s ) S(s) S ( s ) and J ( s ) J(s) J ( s ) , the value bands increase with the source index. The source indices used by δ \delta δ therefore form a decreasing subsequence of the displayed target order, so ∣ δ ∣ ≤ 2 |\delta| \le2 ∣ δ ∣ ≤ 2 .
The merge transition. At each merge block, the incoming Q L Q_L Q L -copies form one run in increasing source order before the block, and the corresponding Q R Q_R Q R -copies form one run in increasing source order after it. Each run is increasing in both position and value. Different merge blocks increase in both position and source value, so δ \delta δ uses copies from only one merge block and at most one copy from each of its two runs. Thus ∣ δ ∣ ≤ 2 |\delta| \le2 ∣ δ ∣ ≤ 2 .
In every case ∣ δ ∣ ≤ 2 |\delta| \le2 ∣ δ ∣ ≤ 2 , and therefore LDS ( β ) ≤ 2 \operatorname{LDS}(\beta) \le2 LDS ( β ) ≤ 2 . ◀
Occurrences are construction copies
We now combine the block and decreasing-subsequence bounds. An occurrence meeting several marker or constraint copies would have a decreasing subsequence that is too short. Thus every occurrence must lie in a single such copy.
Lemma A.31 (Decreasing subsequences meeting each copy once). Let β \beta β be the pattern induced by choosing entries from a configuration π \pi π whose inserted maxima increase from left to right, with at most one entry chosen from each marker copy and each constraint copy. Then LDS ( β ) ≤ 5 \operatorname{LDS}(\beta) \le5 LDS ( β ) ≤ 5 .
Proof. Let δ \delta δ be a decreasing subsequence of β \beta β .
First consider the entries of δ \delta δ belonging to the base permutation ρ r ∗ \rho_r^* ρ r ∗ . Each such entry lies in a block corresponding to one entry of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 . If that block is a marker copy, at most one entry was chosen from it. If it is a state block, its selected entry from S S S , if any, and all its selected entries from J J J form an increasing sequence because S S S lies below and to the left of J J J . Since δ \delta δ is decreasing, it contains at most one entry from the whole state block. Thus each block corresponding to an entry of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 contributes at most one entry to δ \delta δ . Replacing each such entry by the corresponding entry of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 preserves relative order, so the resulting entries form a decreasing subsequence of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 . Lemma A.26 therefore bounds their number by 2.
Likewise, at most one entry was chosen from each constraint copy. Lemma A.30 therefore bounds the number of constraint-copy entries in δ \delta δ by 2. Finally, the inserted maxima increase from left to right, so δ \delta δ contains at most one inserted maximum. Hence
∣ δ ∣ ≤ 2 + 2 + 1 = 5. |\delta| \le2 + 2 + 1 = 5. ∣ δ ∣ ≤ 2 + 2 + 1 = 5.
Lemma A.32 (Occurrences of marker and constraint permutations). Let π \pi π be a configuration whose inserted maxima increase from left to right. For every marker or constraint permutation T T T , every occurrence of T T T in π \pi π is one of the copies of T T T placed by the construction.
Proof. Let O O O be an occurrence of T T T . Suppose O O O is not contained in a single marker or constraint copy. All such copies are blocks by Lemma A.28 , and T T T is simple of length 10 ≥ 4 \ge4 ≥ 4 by Propositions A.4 and A.15 . Thus Lemma A.27 shows that O O O meets each marker or constraint copy in at most one entry. Lemma A.31 then gives LDS ( O ) ≤ 5 \operatorname{LDS}(O) \le5 LDS ( O ) ≤ 5 . But O O O induces T T T , and LDS ( T ) = 6 \operatorname{LDS}(T) = 6 LDS ( T ) = 6 by the same two propositions. This contradicts LDS ( O ) = LDS ( T ) \operatorname{LDS}(O) = \operatorname{LDS}(T) LDS ( O ) = LDS ( T ) . Hence O O O lies inside a single marker or constraint copy M M M . Every such copy has 10 entries, so O = M O = M O = M . The eight permutations are pairwise distinct by Propositions A.4 and A.15 , so M M M is a copy of T T T placed by the construction.
Occurrences of the window patterns
We next use the marker copies to locate the windows.
Lemma A.33 (Occurrences of the state window). Let π \pi π be a configuration whose inserted maxima increase from left to right. Every occurrence of A A A in π \pi π is exactly the window of a state block.
Proof. Consider an occurrence of A = ϑ [ F , N , N , N ] A = \vartheta[F, N, N, N] A = ϑ [ F , N , N , N ] . It contains one occurrence of S S S inside its F F F -block and three occurrences of N N N , so by Lemma A.32 these are four marker copies. Associate each marker copy with the entry of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 whose inflated block contains it. For the copy of S S S , this is the entry inflated by its state block. The four associated entries induce ϑ \vartheta ϑ , so Lemma A.24 makes them four consecutive positions beginning at an odd position. The selected S S S -copy lies in the first inflated block and belongs to a state block. Hence the four consecutive positions begin with that state block and form its window. Denote this state block by t t t .
It remains to identify the two entries playing J J J . They lie positionally between the selected copy of S S S and the first selected copy of N N N , with values above S S S and below the second following N N N -copy. The candidates in that positional range are the copy of J J J in the state block, maxima inserted at its sites, the copies Q R ( s ) Q_R(s) Q R ( s ) for wires s → t s \to t s → t , and possibly a copy C R ( s ) C_R(s) C R ( s ) when t t t is the last block of a clause triple. Inserted maxima lie above every root entry. In the first case t ≥ s + 2 t \ge s + 2 t ≥ s + 2 by Lemma A.12 . In the second case, s s s has a wire to the first block of the clause triple, which precedes t t t by two state blocks, so again t ≥ s + 2 t \ge s + 2 t ≥ s + 2 . Lemma A.17 therefore places every such constraint copy below the window of t t t . Thus only the copy of J J J remains, and the occurrence uses both of its entries.
Lemma A.34 (Occurrences of the overlap and boundary windows). Let π \pi π be a configuration whose inserted maxima increase from left to right. In every occurrence of U D U_D U D , the copies of D , N , S , N D, N, S, N D , N , S , N selected by the occurrence are, respectively, the initial copies of D , N D, N D , N , the S S S -copy in the first state block, and its first following N N N -copy. In every occurrence of U U U , the copies of
N , N , S , N N,N,S,N N , N , S , N selected by the occurrence are, respectively, the final two N N N -copies of one state window, the S S S -copy in the next state block, and its first following N N N -copy. Every occurrence of U E U_E U E consists of the final two N N N -copies of the last state window followed by the final copies E , N E,N E , N .
Proof. For U D = ϑ [ D , N , F , N ] U_D=\vartheta[D,N,F,N] U D = ϑ [ D , N , F , N ] , Lemma A.32 forces the selected copies of D , N , S , N D,N,S,N D , N , S , N to be copies placed by the construction. The copy of D D D is unique and is the first block of the root. Lemma A.24 therefore forces the four positions of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 corresponding to these copies to be 1 , 2 , 3 , 4 1,2,3,4 1 , 2 , 3 , 4 , which are the stated four copies.
For U = ϑ [ N , N , F , N ] U=\vartheta[N,N,F,N] U = ϑ [ N , N , F , N ] , the selected copy of S S S lies inside the third inflated block and is a copy placed by the construction. It lies at position 4 c + 3 4c+3 4 c + 3 for some state block c c c . The four positions of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 corresponding to these copies are consecutive and begin at an odd position, so they are 4 c + 1 , … , 4 c + 4 4c+1,\ldots,4c+4 4 c + 1 , … , 4 c + 4 . The case c = 0 c=0 c = 0 is impossible because its two preceding blocks are D , N D,N D , N , whereas U U U requires N , N N,N N , N . Thus c ≥ 1 c\ge1 c ≥ 1 , and the selected copies are the final two N N N -copies of state window c − 1 c-1 c − 1 , the S S S -copy in state block c c c , and its first following N N N -copy.
For U E = ϑ [ N , N , E , N ] U_E=\vartheta[N,N,E,N] U E = ϑ [ N , N , E , N ] , all four inflated blocks are marker permutations. Lemma A.32 makes them copies placed by the construction, and the copy of E E E is unique at position 4 r + 3 4r+3 4 r + 3 of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 . Since the E E E -copy is the third inflated block, Lemma A.24 forces positions 4 r + 1 , … , 4 r + 4 4r+1,\ldots,4r+4 4 r + 1 , … , 4 r + 4 , which are the stated four copies.
Lemma A.35 (The overlap patterns do not occur). Let π \pi π be a configuration whose inserted maxima increase from left to right. Neither ins 10 ( U ) \operatorname{ins}_{10}(U) ins 10 ( U ) nor ins 20 ( U ) \operatorname{ins}_{20}(U) ins 20 ( U ) occurs in π \pi π .
Proof. Suppose one of the two patterns occurs. Deleting its largest entry leaves an occurrence of U U U , whose marker copies identify the designated overlap window immediately before some state block t ≥ 1 t\ge1 t ≥ 1 , by Lemma A.34 .
The entry playing the largest value of the forbidden pattern lies in gap 10 or 20 of this occurrence. Gap 10 contains no root entry or constraint copy. Gap 20 may contain incoming copies placed immediately before F ( t ) F(t) F ( t ) . The four positions of ω 4 r + 4 \omega_{4r+4} ω 4 r + 4 corresponding to the occurrence are 4 t + 1 , … , 4 t + 4 4t+1,\ldots,4t+4 4 t + 1 , … , 4 t + 4 , whose defining-sequence values have minimum 4 t + 1 4t+1 4 t + 1 . Any incoming constraint copy has a source s ≤ t − 2 s\le t-2 s ≤ t − 2 by Lemma A.12 . Its value band lies inside the value interval of F ( s ) F(s) F ( s ) , whose defining-sequence value is 4 s + 6 ≤ 4 t − 2 4s+6\le4t-2 4 s + 6 ≤ 4 t − 2 . Hence every such copy lies below all four blocks of the overlap window and cannot supply the largest entry. Neither gap is a site, so it contains no inserted maximum. Thus neither gap can contain the largest entry required by the forbidden pattern, contradicting the assumed occurrence.
Lemmas A.33, A.34, and A.35 determine the state windows and marker copies that can occur in A , U , U D , U E A,U,U_D,U_E A , U , U D , U E , and exclude the two overlap patterns. We can now determine the active gaps and maximum extension depth.
Open gaps and maximum depth in the base permutation
This section analyzes the base permutation ρ r ⋆ \rho_r^\star ρ r ⋆ under B s t a t e B_{\mathrm{state}} B state .
A site configuration is obtained from ρ r ⋆ \rho_r^\star ρ r ⋆ by choosing at most one of P 0 , P 1 P_0,P_1 P 0 , P 1 in each state block and inserting one maximum into each chosen site in left-to-right order.
Lemma A.36 (Site configurations avoid B s t a t e B_{\mathrm{state}} B state ). Every site configuration avoids B s t a t e B_{\mathrm{state}} B state . In particular, ρ r ⋆ ∈ Av ( B s t a t e ) \rho_r^\star\in\operatorname{Av}(B_{\mathrm{state}}) ρ r ⋆ ∈ Av ( B state ) .
Proof. We check each family in tbl:1 . Throughout, π \pi π is the configuration. Its inserted maxima lie at sites and increase from left to right by definition. Hence Lemmas A.32 , A.33 , A.34 , and A.35 apply.
B c o r e \mathcal{B}_{\mathrm{core}} B core . By Lemma A.32 , an occurrence of ins g ( T ) \operatorname{ins}_{g}(T) ins g ( T ) would need a marker copy of T T T together with an extra entry above it, positioned strictly inside it. No inserted maximum and no other entry lies inside a marker copy.
B o r d e r \mathcal{B}_{\mathrm{order}} B order . An occurrence of 4312 [ 1 , 1 , N , E ] 4312[1,1,N,E] 4312 [ 1 , 1 , N , E ] needs copies of N N N and E E E placed by the construction together with two entries above E E E , to their left, in decreasing order. Such entries would be inserted maxima, which increase from left to right.
B g a p \mathcal{B}_{\mathrm{gap}} B gap . By Lemma A.33 , an occurrence of ins g ( A ) \operatorname{ins}_{g}(A) ins g ( A ) , g ∈ { 12 , 22 } g \in\{12,22\} g ∈ { 12 , 22 } , forces one state window plus an entry above it in the corresponding root gap. Those gaps are not sites, so no such entry exists.
B c a p \mathcal{B}_{\mathrm{cap}} B cap and B c o n f \mathcal{B}_{\mathrm{conf}} B conf . These need two maxima in the same site or in both sites of one state block. This is excluded by the definition of a site configuration.
B o v e r l a p \mathcal{B}_{\mathrm{overlap}} B overlap . These patterns are excluded by Lemma A.35 .
B b o u n d a r y \mathcal{B}_{\mathrm{boundary}} B boundary . Lemma A.34 shows that every occurrence of U D U_D U D and U E U_E U E uses the specified copies. A site configuration has no entry before D D D , in either of the two gaps of U D U_D U D used by the boundary patterns, or in any of the four relevant gaps of U E U_E U E . Hence no boundary pattern occurs.
The active gaps are the sites
We can now classify all gaps of the base permutation and prove that only the two designated gaps of each state block remain active.
Lemma A.37 (The active gaps are the sites). Let r ≥ 1 r \ge1 r ≥ 1 . In ρ r ∗ \rho_r^* ρ r ∗ , every gap is inactive for B s t a t e B_{\mathrm{state}} B state except the 2 r 2r 2 r sites. Consequently, every inserted entry in an extension of ρ r ∗ \rho_r^* ρ r ∗ lies at a site.
Proof. The root ρ r ∗ \rho_r^* ρ r ∗ avoids B s t a t e B_{\mathrm{state}} B state by Lemma A.36 . We show that inserting a maximum into any non-site gap creates a member of B s t a t e B_{\mathrm{state}} B state .
B c o r e \mathcal{B}_{\mathrm{core}} B core . The nine interior gaps of every marker copy inducing T T T are made inactive by ins g ( T ) \operatorname{ins}_{g}(T) ins g ( T ) , 1 ≤ g ≤ 9 1 \le g \le9 1 ≤ g ≤ 9 .
B g a p \mathcal{B}_{\mathrm{gap}} B gap . Apart from the interior gaps of marker copies, the gaps numbered within every state window are 10, 11, 12, 22, 32, 42. Gaps 10 and 11 are the sites. Gaps 12 and 22 are made inactive by ins 12 ( A ) \operatorname{ins}_{12}(A) ins 12 ( A ) and ins 22 ( A ) \operatorname{ins}_{22}(A) ins 22 ( A ) .
B o v e r l a p \mathcal{B}_{\mathrm{overlap}} B overlap . For a nonfinal state block c c c , the occurrence of U U U associated with state block c + 1 c+1 c + 1 begins after the first 22 entries of the window of c c c . Its gaps 10 and 20 are therefore exactly gaps 32 and 42 of that window. The patterns ins 10 ( U ) \operatorname{ins}_{10}(U) ins 10 ( U ) and ins 20 ( U ) \operatorname{ins}_{20}(U) ins 20 ( U ) make them inactive.
B b o u n d a r y \mathcal{B}_{\mathrm{boundary}} B boundary . The pattern ins 0 ( D ) \operatorname{ins}_{0}(D) ins 0 ( D ) makes the initial root gap inactive. In the occurrence of U D U_D U D described by Lemma A.34 , gaps 10 and 20 are, respectively, the gap after D D D and the gap between the initial N N N and the first state block. In the occurrence of U E U_E U E described by the same lemma, gaps 10 and 20 are gaps 32 and 42 of the final state window, gap 30 is the gap after E E E , and gap 40 is the final root gap. The corresponding six boundary patterns make these gaps inactive.
Every non-site gap is shown inactive in one of these cases. Each site is active because the configuration using only that site is a site configuration and therefore avoids B s t a t e B_{\mathrm{state}} B state by Lemma A.36 . Finally, deleting all but one inserted entry and standardizing shows that an inactive root gap remains unused in every avoiding extension. Hence every inserted entry in an extension lies at a site.
Lemma A.38 (At most one site is used per block). In every extension of ρ r ∗ \rho_r^* ρ r ∗ in Av ( B s t a t e ) \operatorname{Av}(B_{\mathrm{state}}) Av ( B state ) , each site receives at most one inserted maximum, and at most one of the two sites of a state block is used.
Proof. By Lemma A.29, the inserted maxima increase from left to right. Suppose two inserted maxima have the same root gap, corresponding to site g g g of a state block. Together with its window they form an occurrence of ins g ↗ 2 ( A ) \operatorname{ins}^{\nearrow2}_{g}(A) ins g ↗ 2 ( A ) , contradicting B s t a t e B_{\mathrm{state}} B state -avoidance. If both sites of one state block are used, the two maxima together with its window form an occurrence of ins 10 , 11 ↗ ( A ) \operatorname{ins}^{\nearrow}_{10,11}(A) ins 10 , 11 ↗ ( A ) , again contradicting B s t a t e B_{\mathrm{state}} B state -avoidance.
Theorem A.39 (Depth of the base permutation). For every r ≥ 1 r \ge1 r ≥ 1 , d B s t a t e ( ρ r ∗ ) = r d_{B_{\mathrm{state}}}(\rho_r^*) = r d B state ( ρ r ∗ ) = r . Moreover, for every ( b 0 , … , b r − 1 ) ∈ { 0 , 1 } r (b_0,\ldots,b_{r-1}) \in\{0,1\}^{r} ( b 0 , … , b r − 1 ) ∈ { 0 , 1 } r , there is an extension of depth r r r in which state block c c c is assigned bit b c b_c b c for every c ∈ { 0 , … , r − 1 } c \in\{0,\ldots,r-1\} c ∈ { 0 , … , r − 1 } , and every extension of depth r r r arises from exactly one such tuple.
Proof. Upper bound. By Lemma A.37, every inserted maximum lies at a site. By Lemma A.38, at most one site is used in each state block. Thus every extension has depth at most r r r .
Lower bound and Boolean states. Choose a bit b c b_c b c for each block c c c and insert a maximum at site P b c P_{b_c} P b c , processing all r r r chosen sites from left to right. The resulting site configuration avoids B s t a t e B_{\mathrm{state}} B state by Lemma A.36 and is therefore an extension of depth r r r . Conversely, an extension of depth r r r must use exactly one site in every state block, and it is P b P_b P b for a unique b ∈ { 0 , 1 } b \in\{0,1\} b ∈ { 0 , 1 } , so the block is assigned bit b b b . By Lemma A.29, the inserted entries occur in increasing order from left to right.
Constraint copies preserve B s t a t e B_{\mathrm{state}} B state -avoidance
Theorem A.39 gives two independent choices in each state block. To obtain ρ Φ \rho_{\Phi} ρ Φ , we add the constraint copies. We now prove that these copies do not create active gaps or occurrences of members of B s t a t e B_{\mathrm{state}} B state .
Lemma A.40 (Constraint copies create no new active gaps). Every inserted entry in an extension of ρ Φ \rho_{\Phi} ρ Φ in Av ( B s t a t e ) \operatorname{Av}(B_{\mathrm{state}}) Av ( B state ) lies at a site.
Proof. Deleting the entries of all constraint copies and standardizing maps ρ Φ \rho_{\Phi} ρ Φ to ρ r ∗ \rho_r^* ρ r ∗ . By D1–D3, this deletion preserves every site and maps every non-site gap to a non-site gap of ρ r ∗ \rho_r^* ρ r ∗ . Suppose an extension σ \sigma σ contains an inserted entry x x x outside the sites. Delete all entries of constraint copies and all inserted entries except x x x , then standardize. The remaining permutation is ins g ( ρ r ∗ ) \operatorname{ins}_{g}(\rho_r^*) ins g ( ρ r ∗ ) for a non-site gap g g g , so it does not avoid B s t a t e B_{\mathrm{state}} B state by Lemma A.37. However, it is a pattern of σ \sigma σ and hence avoids B s t a t e B_{\mathrm{state}} B state , a contradiction. Thus every inserted entry lies at a site.
An assignment configuration of ρ Φ \rho_{\Phi} ρ Φ is obtained by choosing b c ∈ { 0 , 1 } b_c \in\{0,1\} b c ∈ { 0 , 1 } for every state block c c c and inserting a maximum at the site P b c P_{b_c} P b c , processing all chosen sites from left to right. It contains exactly r r r inserted maxima.
Theorem A.41 (Constraint copies preserve B s t a t e B_{\mathrm{state}} B state -avoidance). Every assignment configuration of ρ Φ \rho_{\Phi} ρ Φ avoids B s t a t e B_{\mathrm{state}} B state .
Proof. Let π \pi π be an assignment configuration, and let π ˉ \bar{\pi} π ˉ be obtained by deleting the entries of its constraint copies and standardizing. Then π ˉ \bar{\pi} π ˉ is a site configuration and avoids B s t a t e B_{\mathrm{state}} B state by Lemma A.36. Hence any occurrence in π \pi π of a member of B s t a t e B_{\mathrm{state}} B state must use an entry of a constraint copy. By definition of an assignment configuration, the inserted maxima of π \pi π increase from left to right. Hence Lemmas A.32–A.35 apply to π \pi π .
By D1–D3, no constraint copy lies inside a marker copy or at a site. Thus constraint copies cannot create occurrences from B c o r e B_{\mathrm{core}} B core , B c a p B_{\mathrm{cap}} B cap , or B c o n f B_{\mathrm{conf}} B conf . They also cannot create $4312[1 , 1 N,E] . Every constraint-copy entry lies below the final copy of E E E , so the two entries above E E E would have to be inserted maxima in decreasing left-to-right order.
For B g a p \mathcal{B}_{\mathrm{gap}} B gap , Lemma A.33 forces the required window. Among its two relevant gaps, only gap 12 can contain constraint-copy entries. Those entries lie below the window by Lemma A.17 , while the extra entry of the forbidden pattern must lie above it. The overlap patterns are excluded directly by Lemma A.35 .
For the left boundary, Lemma A.34 places the selected copies of D D D , N N N at the start of the root and the selected copy of S S S in the first state block. The first state block is in level 0 and has no incoming wire, while every constraint copy whose source is that block is positioned at a later target. Hence no constraint copy lies after D D D or between the initial N N N and the first state block. For the right boundary, the same lemma places the occurrence of U E U_E U E on the final two N N N -copies of the last state window and the final copies E , N E,N E , N . Constraint copies targeting the final state block lie immediately before or after its copy of F F F , hence before its first following N N N -copy, while the four relevant gaps of U E U_E U E begin after its second following N N N -copy. Thus no boundary pattern occurs.
Corollary A.42 (Depth of ρ Φ \rho_\Phi ρ Φ ). ρ Φ ∈ Av ( B s t a t e ) \rho_\Phi\in\operatorname{Av}(B_{\mathrm{state}}) ρ Φ ∈ Av ( B state ) and d B s t a t e ( ρ Φ ) = r d_{B_{\mathrm{state}}}(\rho_\Phi)=r d B state ( ρ Φ ) = r .
Proof. An assignment configuration exists, contains r r r inserted maxima, and avoids B s t a t e B_{\mathrm{state}} B state by Theorem A.41 . Hence d B s t a t e ( ρ Φ ) ≥ r d_{B_{\mathrm{state}}}(\rho_\Phi)\ge r d B state ( ρ Φ ) ≥ r . Since ρ Φ \rho_\Phi ρ Φ is obtained from this configuration by deleting the inserted maxima, hereditary avoidance also gives ρ Φ ∈ Av ( B s t a t e ) \rho_\Phi\in\operatorname{Av}(B_{\mathrm{state}}) ρ Φ ∈ Av ( B state ) .
For any extension of ρ Φ \rho_\Phi ρ Φ in Av ( B s t a t e ) \operatorname{Av}(B_{\mathrm{state}}) Av ( B state ) , delete the constraint-copy entries and standardize. This gives an extension of ρ Φ ∗ \rho_\Phi^* ρ Φ ∗ at the same depth, so Theorem A.39 bounds that depth by r r r . Thus d B s t a t e ( ρ Φ ) = r d_{B_{\mathrm{state}}}(\rho_\Phi)=r d B state ( ρ Φ ) = r .
Thus the extension depth of ρ Φ \rho_\Phi ρ Φ in Av ( B s t a t e ) \operatorname{Av}(B_{\mathrm{state}}) Av ( B state ) is r r r , and every extension of depth r r r chooses one of the two Boolean states in each block, exactly as for the base permutation. It remains to characterize occurrences of the violation patterns, beginning with P 01 ≠ P_{01}^{\ne} P 01 = and P 10 ≠ P_{10}^{\ne} P 10 = .
Occurrences of the violation patterns
The violation patterns were defined in Section A.7. We now prove that every occurrence of a violation pattern comes from a wire or clause triple.
Equality along wires
Throughout this subsection, π \pi π is an assignment configuration of ρ Φ \rho_\Phi ρ Φ . For each state block c c c , the notation b c b_c b c denotes the unique bit assigned to c c c in π \pi π .
Lemma A.43 (Occurrences of A e q A_{\mathrm{eq}} A eq ). For every occurrence of A e q A_{\mathrm{eq}} A eq in π \pi π , there is a wire s → t ∈ W Φ s\to t\in W_\Phi s → t ∈ W Φ such that the occurrence consists exactly of the windows of s s s and t t t together with the copies Q L ( s ) Q_L(s) Q L ( s ) and Q R ( s ) Q_R(s) Q R ( s ) .
Proof. Let O O O be an occurrence of A e q A_{\mathrm{eq}} A eq . Deleting the entries in its Q L Q_L Q L - and Q R Q_R Q R -blocks leaves two occurrences of A A A . By Lemma A.33 , they are the windows of state blocks s s s and t t t , in that order.
By Lemma A.32 , the deleted entries form copies of Q L Q_L Q L and Q R Q_R Q R placed by the construction. Their values place both copies in the value blocks. Rules D1 and D3 therefore identify them as Q L ( s ) Q_L(s) Q L ( s ) and Q R ( s ) Q_R(s) Q R ( s ) for a wire with source s s s . The state block of the second window is F ( t ) F(t) F ( t ) and lies positionally between these copies. By Lemma A.18 , it is the target of that wire. Hence s → t s\to t s → t is a wire, and O O O has the required form.
Figure 7. Block-level plot of P 01 ≠ = ins 10 , 63 ( A e q ) P^{\ne}_{01}=\operatorname{ins}_{10,63}(A_{\mathrm{eq}}) P 01 = = ins 10 , 63 ( A eq ) . The orange copies of Q L Q_L Q L and Q R Q_R Q R lie in the value band of the source but bracket the target state block in position. Matching outline colors identify the four blocks of the source and target windows. In particular, Q R ( s ) Q_R(s) Q R ( s ) is not part of the window of t t t . The two inserted maxima occupy site P 0 P_0 P 0 of F ( s ) F(s) F ( s ) and site P 1 P_1 P 1 of F ( t ) F(t) F ( t ) , so this pattern detects the forbidden unequal assignment ( b s , b t ) = ( 0 , 1 ) (b_s,b_t)=(0,1) ( b s , b t ) = ( 0 , 1 ) . The pattern P 10 ≠ P^{\ne}_{10} P 10 = is obtained by using the other site in each state block.
Lemma A.44 (P 01 ≠ P^{\ne}_{01} P 01 = and P 10 ≠ P^{\ne}_{10} P 10 = detect unequal endpoints). For each ( a , b ) ∈ { ( 0 , 1 ) , ( 1 , 0 ) } (a,b)\in\{(0,1),(1,0)\} ( a , b ) ∈ {( 0 , 1 ) , ( 1 , 0 )} , the occurrences of P a b ≠ P^{\ne}_{ab} P ab = in π \pi π are exactly those obtained from wires s → t s\to t s → t satisfying ( b s , b t ) = ( a , b ) (b_s,b_t)=(a,b) ( b s , b t ) = ( a , b ) by adding the inserted maxima at site P a P_a P a of F ( s ) F(s) F ( s ) and site P b P_b P b of F ( t ) F(t) F ( t ) to the associated A e q A_{\mathrm{eq}} A eq -occurrence.
Proof. Fix ( a , b ) ∈ { ( 0 , 1 ) , ( 1 , 0 ) } (a,b)\in\{(0,1),(1,0)\} ( a , b ) ∈ {( 0 , 1 ) , ( 1 , 0 )} .
Suppose first that ( b s , b t ) = ( a , b ) (b_s,b_t)=(a,b) ( b s , b t ) = ( a , b ) for a wire s → t s\to t s → t . The corresponding A e q A_{\mathrm{eq}} A eq -occurrence is present in π \pi π , and site P a P_a P a of F ( s ) F(s) F ( s ) and site P b P_b P b of F ( t ) F(t) F ( t ) contain inserted maxima. The first maximum lies to the left of the second, so Lemma A.29 makes their values increase from left to right. By the definition of P a b ≠ P^{\ne}_{ab} P ab = , these entries form an occurrence of P a b ≠ P^{\ne}_{ab} P ab = .
Conversely, fix an occurrence O O O of P a b ≠ P^{\ne}_{ab} P ab = and remove its two largest entries. The remaining entries form an occurrence of A e q A_{\mathrm{eq}} A eq , so Lemma A.43 associates them with a wire s → t s\to t s → t . By the definition of P a b ≠ P^{\ne}_{ab} P ab = , the deleted entries lie at site P a P_a P a of F ( s ) F(s) F ( s ) and site P b P_b P b of F ( t ) F(t) F ( t ) . Since π \pi π is an assignment configuration, they are inserted maxima. Thus these two sites are used, giving ( b s , b t ) = ( a , b ) (b_s,b_t)=(a,b) ( b s , b t ) = ( a , b ) .
:::
Corollary A.45 (Avoidance enforces equality). π \pi π avoids { P 01 ≠ , P 10 ≠ } \{P^{\ne}_{01},P^{\ne}_{10}\} { P 01 = , P 10 = } if and only if b s = b t b_s=b_t b s = b t for every wire s → t ∈ W Φ s\to t\in W_\Phi s → t ∈ W Φ .
Proof. The two forbidden bit pairs are exactly the two unequal pairs in { 0 , 1 } 2 \{0,1\}^2 { 0 , 1 } 2 .
Not-all-equal clauses
For a clause triple t = ( t 0 , t 1 , t 2 ) ∈ C Φ \mathbf{t}=(t_0,t_1,t_2)\in C_\Phi t = ( t 0 , t 1 , t 2 ) ∈ C Φ , put b ( t ) = ( b t 0 , b t 1 , b t 2 ) \mathbf{b}(\mathbf{t})=(b_{t_0},b_{t_1},b_{t_2}) b ( t ) = ( b t 0 , b t 1 , b t 2 ) .
Figure 8. Block-level plot of P 000 m o n o P^{\mathrm{mono}}_{000} P 000 mono . The four blocks of each state window have relative order 3142, and matching outline colors identify which four blocks form each window. The copies of C L C_L C L and C R C_R C R lie in the value band of the source but occupy positions bracketing the three target state blocks. The three inserted maxima use the three P 0 P_0 P 0 sites, detecting the forbidden assignment 000. P 111 m o n o P^{\mathrm{mono}}_{111} P 111 mono instead uses the three P 1 P_1 P 1 sites.
Lemma A.46 (Occurrences of A n a e A_{\mathrm{nae}} A nae ). For every occurrence of A n a e A_{\mathrm{nae}} A nae in π \pi π , there is a clause triple t = ( t 0 , t 1 , t 2 ) ∈ C Φ \mathbf{t}=(t_0,t_1,t_2)\in C_\Phi t = ( t 0 , t 1 , t 2 ) ∈ C Φ such that the occurrence consists exactly of the windows of s 0 , t 0 , t 1 , t 2 s_0,t_0,t_1,t_2 s 0 , t 0 , t 1 , t 2 together with the copies C L ( s 0 ) C_L(s_0) C L ( s 0 ) and C R ( s 0 ) C_R(s_0) C R ( s 0 ) , where s 0 s_0 s 0 is the source of the incoming wire to t 0 t_0 t 0 .
Proof. Let O O O be an occurrence of A n a e A_{\mathrm{nae}} A nae . Deleting the entries in its C L C_L C L - and C R C_R C R -blocks leaves four occurrences of A A A . By Lemma A.33 , they are the windows of state blocks s 0 , t 0 , t 1 , t 2 s_0,t_0,t_1,t_2 s 0 , t 0 , t 1 , t 2 in the order prescribed by A n a e A_{\mathrm{nae}} A nae .
By Lemma A.32 , the deleted entries form copies of C L C_L C L and C R C_R C R placed by the construction. Their values place both copies in the value band of s 0 s_0 s 0 . Rules D2 and D3 therefore identify them as C L ( s 0 ) C_L(s_0) C L ( s 0 ) and C R ( s 0 ) C_R(s_0) C R ( s 0 ) for a clause triple whose incoming wire to its first state block has source s 0 s_0 s 0 . By Lemma A.18 , the three state blocks positionally between these copies are exactly the targets of that triple, in order. Hence the triple is t = ( t 0 , t 1 , t 2 ) \mathbf{t}=(t_0,t_1,t_2) t = ( t 0 , t 1 , t 2 ) , and O O O consists exactly of the copies and windows stated in the lemma.
Lemma A.47 (P 000 m o n o P^{\mathrm{mono}}_{000} P 000 mono and P 111 m o n o P^{\mathrm{mono}}_{111} P 111 mono detect constant triples). The occurrences of P 000 m o n o P^{\mathrm{mono}}_{000} P 000 mono in π \pi π are exactly those obtained from clause triples t = ( t 0 , t 1 , t 2 ) \mathbf{t}=(t_0,t_1,t_2) t = ( t 0 , t 1 , t 2 ) satisfying b ( t ) = ( 0 , 0 , 0 ) b(\mathbf{t})=(0,0,0) b ( t ) = ( 0 , 0 , 0 ) by adding the inserted maxima at site P 0 P_0 P 0 of each F ( t i ) F(t_i) F ( t i ) , i = 0 , 1 , 2 i=0,1,2 i = 0 , 1 , 2 to the associated A n a e A_{\mathrm{nae}} A nae -occurrence. The occurrences of P 111 m o n o P^{\mathrm{mono}}_{111} P 111 mono are described analogously, with 1 in place of 0.
Proof. Fix a ∈ { 0 , 1 } a\in\{0,1\} a ∈ { 0 , 1 } , and let P a v i o l P^{\mathrm{viol}}_a P a viol denote P 000 m o n o P^{\mathrm{mono}}_{000} P 000 mono when a = 0 a=0 a = 0 and P 111 m o n o P^{\mathrm{mono}}_{111} P 111 mono when $a=1. Suppose first that b ( t ) = ( a , a , a ) b(t)=(a,a,a) b ( t ) = ( a , a , a ) for a clause triple t = ( t 0 , t 1 , t 2 ) t=(t_0,t_1,t_2) t = ( t 0 , t 1 , t 2 ) . The associated A n a e A_{\mathrm{nae}} A nae -occurrence is present in π \pi π , and site P a P_a P a of each F ( t i ) F(t_i) F ( t i ) , i = 0 , 1 , 2 i=0,1,2 i = 0 , 1 , 2 , contains an inserted maximum. These maxima increase from left to right by Lemma A.29 , so the definition of P a v i o l P_a^{\mathrm{viol}} P a viol gives an occurrence of P a v i o l P_a^{\mathrm{viol}} P a viol .
Conversely, fix an occurrence O O O of P a v i o l P_a^{\mathrm{viol}} P a viol and remove its three largest entries. The remaining entries form an occurrence of A n a e A_{\mathrm{nae}} A nae , so Lemma A.46 associates them with a clause triple t = ( t 0 , t 1 , t 2 ) t=(t_0,t_1,t_2) t = ( t 0 , t 1 , t 2 ) .
By the definition of P a v i o l P_a^{\mathrm{viol}} P a viol , the deleted entries lie at site P a P_a P a of each F ( t i ) F(t_i) F ( t i ) , i = 0 , 1 , 2 i=0,1,2 i = 0 , 1 , 2 . Since π \pi π is an assignment configuration, they are inserted maxima. Thus these three sites are used, giving b ( t ) = ( a , a , a ) b(t)=(a,a,a) b ( t ) = ( a , a , a ) .
Corollary A.48 (Avoidance enforces NAE). π \pi π avoids { P 000 m o n o , P 111 m o n o } \{P_{000}^{\mathrm{mono}},P_{111}^{\mathrm{mono}}\} { P 000 mono , P 111 mono } if and only if b ( t ) b(t) b ( t ) is not constant for every clause triple t ∈ C Φ t\in C_{\Phi} t ∈ C Φ .
Proof. By Lemma A.47 , the two forbidden patterns occur exactly on the two constant triples 000 and 111.
Later levels create no additional A n a e A_{\mathrm{nae}} A nae -occurrences. Lemma A.46 applies to the whole permutation π \pi π , not only to the clause level. Thus every occurrence of A n a e A_{\mathrm{nae}} A nae uses the source window and the windows of the three state blocks in one clause triple. By D2, copies of C L C_L C L and C R C_R C R occur only in the value bands of the sources of the incoming wires to the first blocks of clause triples, and Lemma A.18 forces the corresponding three state blocks. Later levels add copies of Q L Q_L Q L and Q R Q_R Q R and state blocks but no copies of C L C_L C L or C R C_R C R , so they create no further occurrence of A n a e A_{\mathrm{nae}} A nae .
We have now proved that B s t a t e B_{\mathrm{state}} B state gives two states per block, that adding constraint copies preserves B s t a t e B_{\mathrm{state}} B state -avoidance, and that the violation patterns occur exactly on unequal wires and constant clause triples.
Correctness of the formula instance
We now combine Theorem A.39 , Theorem A.41 , and Corollaries A.45 and A.48 to prove that the constructed instance has the required depth exactly when the formula is satisfiable.
Lemma A.49 (The permutation ρ Φ \rho_{\Phi} ρ Φ avoids B f i n a l B_{\mathrm{final}} B final ). ρ Φ \rho_{\Phi} ρ Φ lies in Av ( B f i n a l ) \operatorname{Av}(B_{\mathrm{final}}) Av ( B final ) .
Proof. Choose any assignment configuration π \pi π of ρ Φ \rho_{\Phi} ρ Φ . By Theorem A.41 , π \pi π avoids B s t a t e B_{\mathrm{state}} B state . Since ρ Φ \rho_{\Phi} ρ Φ is obtained from π \pi π by deleting the inserted maxima, hereditary avoidance gives ρ Φ ∈ Av ( B s t a t e ) \rho_{\Phi}\in\operatorname{Av}(B_{\mathrm{state}}) ρ Φ ∈ Av ( B state ) .
Suppose that ρ Φ \rho_{\Phi} ρ Φ contained a violation pattern. The same root entries would form an occurrence in π \pi π . Lemmas A.44 and A.47 , however, show that every such occurrence in π \pi π uses two or three inserted maxima. This is impossible for an occurrence formed entirely from root entries. Thus ρ Φ \rho_{\Phi} ρ Φ also avoids B v i o l B_{\mathrm{viol}} B viol , and Definition A.23 gives ρ Φ ∈ Av ( B f i n a l ) \rho_{\Phi}\in\operatorname{Av}(B_{\mathrm{final}}) ρ Φ ∈ Av ( B final ) .
Theorem A.50 (Correctness of the formula instance). The permutation ρ Φ \rho_{\Phi} ρ Φ lies in Av ( B f i n a l ) \operatorname{Av}(B_{\mathrm{final}}) Av ( B final ) , and
d B f i n a l ( ρ Φ ) ≤ r . d_{B_{\mathrm{final}}}(\rho_{\Phi})\le r. d B final ( ρ Φ ) ≤ r . Equality holds if and only if Φ \Phi Φ is NAE-satisfiable.
Proof. Lemma A.49 gives ρ Φ ∈ Av ( B f i n a l ) \rho_{\Phi} \in\operatorname{Av}(B_{\mathrm{final}}) ρ Φ ∈ Av ( B final ) . Since B s t a t e ⊆ B f i n a l B_{\mathrm{state}} \subseteq B_{\mathrm{final}} B state ⊆ B final , every B f i n a l B_{\mathrm{final}} B final -avoiding extension is also a B s t a t e B_{\mathrm{state}} B state -avoiding extension. Hence Corollary A.42 gives
d B f i n a l ( ρ Φ ) ≤ d B s t a t e ( ρ Φ ) = r . d_{B_{\mathrm{final}}}(\rho_{\Phi}) \le d_{B_{\mathrm{state}}}(\rho_{\Phi}) = r. d B final ( ρ Φ ) ≤ d B state ( ρ Φ ) = r .
Suppose first that Φ \Phi Φ is NAE-satisfiable. By Lemma A.13 , choose a bit b c ∈ { 0 , 1 } b_c \in\{0,1\} b c ∈ { 0 , 1 } for each state block c c c such that the chosen bits are equal along every wire and nonconstant on every clause triple. Insert a maximum at P b c P_{b_c} P b c in each state block, processing the selected sites from left to right. The resulting assignment configuration avoids B s t a t e B_{\mathrm{state}} B state by Theorem A.41 , P 01 ≠ P_{01}^{\ne} P 01 = and P 10 ≠ P_{10}^{\ne} P 10 = by Corollary A.45 , and P 000 m o n o P_{000}^{\mathrm{mono}} P 000 mono and P 111 m o n o P_{111}^{\mathrm{mono}} P 111 mono by Corollary A.48 . It therefore avoids B f i n a l B_{\mathrm{final}} B final . It contains r r r inserted entries and is therefore an extension of ρ Φ \rho_{\Phi} ρ Φ at depth r r r .
Conversely, let π \pi π be a B f i n a l B_{\mathrm{final}} B final -avoiding extension of ρ Φ \rho_{\Phi} ρ Φ at depth r r r . Lemma A.40 places every inserted entry at a site. Deleting the constraint-copy entries and standardizing gives an extension of ρ ∗ \rho^{*} ρ ∗ at the same depth. By Theorem A.39 , it uses the site P b c P_{b_c} P b c for a unique bit b c b_c b c in every state block. Therefore π \pi π is the corresponding assignment configuration of ρ Φ \rho_{\Phi} ρ Φ . Since π \pi π avoids the violation patterns, Corollaries A.45 and A.48 show that these bits are equal along every wire and nonconstant on every clause triple. Lemma A.13 now gives an NAE-satisfying assignment of Φ \Phi Φ . ◀
The same theorem also gives the promised unbounded-pocket-depth result. There are NAE-satisfiable instances with arbitrarily many disjoint clauses, so the corresponding values of r r r are unbounded. For each such instance, Theorem A.50 gives a mortal permutation ρ Φ \rho_{\Phi} ρ Φ with d B f i n a l ( ρ Φ ) = r d_{B_{\mathrm{final}}}(\rho_{\Phi}) = r d B final ( ρ Φ ) = r . Every mortal permutation is contained in a pocket whose depth is at least d B f i n a l ( ρ Φ ) = r d_{B_{\mathrm{final}}}(\rho_{\Phi}) = r d B final ( ρ Φ ) = r . Hence Av ( B f i n a l ) \operatorname{Av}(B_{\mathrm{final}}) Av ( B final ) has unbounded pocket depth.
NP-hardness and NP-completeness
Theorem A.50 establishes the correctness of the construction. The following theorem gives its complexity consequence.
Theorem A.51 (NP-hardness). The unary-target problem ExtendMax B f i n a l u n \operatorname{ExtendMax}^{\mathrm{un}}_{B_{\mathrm{final}}} ExtendMax B final un is NP-hard, and the same holds for the binary-target problem ExtendMax B f i n a l b i n \operatorname{ExtendMax}^{\mathrm{bin}}_{B_{\mathrm{final}}} ExtendMax B final bin .
Proof. The construction is polynomial by Equation (2) and correct by Theorem A.50 . The source problem is NP-complete by Theorem A.2 . Since r r r is polynomial in ∣ Φ ∣ |\Phi| ∣Φ∣ , its unary encoding has polynomial length. The construction therefore proves that ExtendMax B f i n a l u n \operatorname{ExtendMax}^{\mathrm{un}}_{B_{\mathrm{final}}} ExtendMax B final un is NP-hard. Binary-target hardness follows by encoding the same polynomially bounded target r r r in binary. ◀
Proof of Theorem 1.2. We have already specified the 55 permutations of size at most 191 in B f i n a l B_{\mathrm{final}} B final . Theorem A.51 gives NP-hardness. Membership in NP follows from Theorem 4.4 applied to B f i n a l B_{\mathrm{final}} B final of Definition A.23 . ◀
The equivalence from Proposition 2.1 now gives an enumeration consequence for the same class.
Corollary A.52. Unless P = NP, EnumExt B f i n a l ∉ DelayP \operatorname{EnumExt}_{B_{\mathrm{final}}} \notin\operatorname{DelayP} EnumExt B final ∈ / DelayP .
Proof. Theorem 1.2 makes the unary existence problem ExtendMax B f i n a l u n \operatorname{ExtendMax}^{\mathrm{un}}_{B_{\mathrm{final}}} ExtendMax B final un NP-complete. If EnumExt B f i n a l \operatorname{EnumExt}_{B_{\mathrm{final}}} EnumExt B final had polynomial delay, Proposition 2.1 would put that existence problem in P. ◀
This does not show that EnumAvoid B f i n a l ∉ DelayP \operatorname{EnumAvoid}_{B_{\mathrm{final}}} \notin\operatorname{DelayP} EnumAvoid B final ∈ / DelayP . The problem EnumExt B f i n a l \operatorname{EnumExt}_{B_{\mathrm{final}}} EnumExt B final allows an arbitrary starting permutation ρ \rho ρ , whereas EnumAvoid B f i n a l \operatorname{EnumAvoid}_{B_{\mathrm{final}}} EnumAvoid B final fixes the start to ε \varepsilon ε . More generally, it remains open whether there exists any fixed finite set B B B for which EnumAvoid B ∉ DelayP \operatorname{EnumAvoid}_{B} \notin\operatorname{DelayP} EnumAvoid B ∈ / DelayP .
NP-completeness of the forbidden permutation CSP
The forbidden permutation CSP introduced by Hanika allows both linear orders representing a permutation to be completed from partial information [10 Problem 4.1] . For a finite set V V V and linear orders L 1 , L 2 L_1,L_2 L 1 , L 2 on V V V , label the elements of V V V by 1 , … , ∣ V ∣ 1,\ldots,|V| 1 , … , ∣ V ∣ in their L 1 L_1 L 1 order. Reading these labels in their L 2 L_2 L 2 order gives the induced permutation Π ( V , L 1 , L 2 ) \Pi(V,L_1,L_2) Π ( V , L 1 , L 2 ) . We use the following formulation of the problem.
Definition A.53 (Forbidden permutation CSP). Fix a finite set B B B of permutations. The problem FPCSP ( B ) \operatorname{FPCSP}(B) FPCSP ( B ) takes as input a finite ground set V V V and two acyclic directed relations E 1 , E 2 E_1,E_2 E 1 , E 2 on V V V . It asks whether there are linear orders L 1 ⊇ E 1 L_1 \supseteq E_1 L 1 ⊇ E 1 and L 2 ⊇ E 2 L_2 \supseteq E_2 L 2 ⊇ E 2 such that
Π ( V , L 1 , L 2 ) ∈ Av ( B ) . \Pi(V,L_1,L_2) \in\operatorname{Av}(B). Π ( V , L 1 , L 2 ) ∈ Av ( B ) .
Insert-maximum extension is the restriction in which the first order is fixed and the second order already specifies the relative order of the root entries.
Proposition A.54. For every fixed finite forbidden set B B B , there is a polynomial-time many-one reduction from ExtendMax B u n \operatorname{ExtendMax}^{\mathrm{un}}_B ExtendMax B un to FPCSP ( B ) \operatorname{FPCSP}(B) FPCSP ( B ) .
Proof. Let ( ρ , 1 k ) (\rho,1^k) ( ρ , 1 k ) be an instance of ExtendMax B u n \operatorname{ExtendMax}^{\mathrm{un}}_B ExtendMax B un , where ρ ∈ S n \rho\in\mathfrak{S}_n ρ ∈ S n , and put N = n + k N=n+k N = n + k . Take V = { 1 , … , N } V=\{1,\ldots,N\} V = { 1 , … , N } and define
E 1 = { ( i , i + 1 ) : 1 ≤ i < N } E_1=\{(i,i+1):1\leq i<N\} E 1 = {( i , i + 1 ) : 1 ≤ i < N }
and
E 2 = { ( ρ i , ρ i + 1 ) : 1 ≤ i < n } . E_2=\{(\rho_i,\rho_{i+1}):1\leq i<n\}. E 2 = {( ρ i , ρ i + 1 ) : 1 ≤ i < n } .
Every linear order extending E 1 E_1 E 1 is the natural order on V V V . A linear order extends E 2 E_2 E 2 exactly when its restriction to { 1 , … , n } \{1,\ldots,n\} { 1 , … , n } lists those elements in the order ρ 1 , ρ 2 , … , ρ n \rho_1,\rho_2,\ldots,\rho_n ρ 1 , ρ 2 , … , ρ n . Consequently, the permutations induced by linear-order extensions of ( E 1 , E 2 ) (E_1,E_2) ( E 1 , E 2 ) are exactly the permutations of length N N N obtained from ρ \rho ρ by inserting the new maximum entries n + 1 , … , N n+1,\ldots,N n + 1 , … , N . It follows that ( ρ , 1 k ) (\rho,1^k) ( ρ , 1 k ) is a Yes-instance of ExtendMax B u n \operatorname{ExtendMax}^{\mathrm{un}}_B ExtendMax B un exactly when ( V , E 1 , E 2 ) (V,E_1,E_2) ( V , E 1 , E 2 ) is a Yes-instance of FPCSP ( B ) \operatorname{FPCSP}(B) FPCSP ( B ) . The construction has size O ( n + k ) O(n+k) O ( n + k ) and is polynomial because k k k is encoded in unary. ◀
Corollary A.55. The problem FPCSP ( B f i n a l ) \operatorname{FPCSP}(B_{\mathrm{final}}) FPCSP ( B final ) is N P NP N P -complete.
Proof. Theorem 1.2 and Proposition A.54 give N P NP N P -hardness. Membership in N P NP N P holds for every fixed forbidden set [10 Remark 4.3] . ◀
Hanika asked whether FPCSP ( B ) \operatorname{FPCSP}(B) FPCSP ( B ) is N P NP N P -complete for some fixed set of patterns and noted that no N P NP N P -hard example was known. Corollary A.55 answers this question with the explicit fixed set B = B f i n a l B=B_{\mathrm{final}} B = B final .
Marker and Constraint Permutations
The four marker permutations of Definition A.3 and the four constraint permutations of Definition A.14 are
D = 9 , 3 , 10 , 8 , 6 , 4 , 2 , 5 , 1 , 7 , S = 4 , 9 , 7 , 1 , 6 , 10 , 5 , 3 , 8 , 2 , E = 5 , 9 , 3 , 8 , 10 , 7 , 1 , 6 , 4 , 2 , N = 8 , 1 , 7 , 5 , 10 , 4 , 9 , 3 , 6 , 2 , Q L = 8 , 10 , 7 , 5 , 3 , 9 , 2 , 6 , 1 , 4 , Q R = 3 , 5 , 10 , 8 , 6 , 4 , 2 , 9 , 1 , 7 , C L = 5 , 10 , 2 , 8 , 6 , 4 , 7 , 3 , 1 , 9 , C R = 8 , 10 , 7 , 4 , 6 , 1 , 5 , 3 , 9 , 2. \begin{aligned}
D &= 9, 3, 10, 8, 6, 4, 2, 5, 1, 7,\\
S &= 4, 9, 7, 1, 6, 10, 5, 3, 8, 2,\\
E &= 5, 9, 3, 8, 10, 7, 1, 6, 4, 2,\\
N &= 8, 1, 7, 5, 10, 4, 9, 3, 6, 2,\\
Q_L &= 8, 10, 7, 5, 3, 9, 2, 6, 1, 4,\\
Q_R &= 3, 5, 10, 8, 6, 4, 2, 9, 1, 7,\\
C_L &= 5, 10, 2, 8, 6, 4, 7, 3, 1, 9,\\
C_R &= 8, 10, 7, 4, 6, 1, 5, 3, 9, 2.
\end{aligned} D S E N Q L Q R C L C R = 9 , 3 , 10 , 8 , 6 , 4 , 2 , 5 , 1 , 7 , = 4 , 9 , 7 , 1 , 6 , 10 , 5 , 3 , 8 , 2 , = 5 , 9 , 3 , 8 , 10 , 7 , 1 , 6 , 4 , 2 , = 8 , 1 , 7 , 5 , 10 , 4 , 9 , 3 , 6 , 2 , = 8 , 10 , 7 , 5 , 3 , 9 , 2 , 6 , 1 , 4 , = 3 , 5 , 10 , 8 , 6 , 4 , 2 , 9 , 1 , 7 , = 5 , 10 , 2 , 8 , 6 , 4 , 7 , 3 , 1 , 9 , = 8 , 10 , 7 , 4 , 6 , 1 , 5 , 3 , 9 , 2.
Figure 9. The eight simple permutations. Their pairwise distinctness, simplicity, and longest decreasing subsequence length are given in Propositions A.4 and A.15 .