arXiv:2610.41048cs.DSOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.41048

Faster #PPM from faster #3SAT

László Kozma

Abstract

The counting variant (#PPM) of the permutation pattern matching (PPM) problem asks for the number of occurrences of a permutation pattern in a host permutation of length nn. The problem admits faster algorithms than the trivial O∗(2n)\mathcal{O}^*(2^n) time enumeration; the best known running time, for both PPM and #PPM, is O(1.415n)\mathcal{O}(1.415^n) (Gawrychowski and Rzepecki). It is also known that PPM is ETH-hard: an algorithm with running time 2o(n/log⁡n)2^{o(n/\log n)} would imply a subexponential algorithm for 3SAT (Jelínek, Opler, and Pekárek).

We give a reduction in the opposite direction, showing that an algorithm for counting satisfying assignments of a 3-CNF formula (#3SAT) in time 2O(n/f(n))2^{\mathcal{O}(n/f(n))}, where nn is the number of variables, yields an algorithm for #PPM with running time 2O(nlog⁡f(n)/f(n))2^{\mathcal{O}(n\sqrt{\log f(n)}/f(n))}. In particular, the recently claimed refutation of ETH by OpenAI implies a #3SAT algorithm with an improvement factor f(n)∈Ω(log⁡n/log⁡log⁡n)f(n) \in \Omega(\sqrt{\log n}/\log \log n) in the exponent; this yields, through our reduction, a subexponential algorithm for #PPM.

Note: This is a technical report not intended for conference or journal publication. AI tools were used interactively to derive and check essential parts of the result; the writeup is by the author.

1 Introduction

In this short note we show that a subexponential algorithm for #3SAT (counting satisfying assignments of a 3-CNF formula) implies a subexponential algorithm for #PPM (counting occurrences of a permutation pattern in a host permutation). Previous work established hardness results for PPM and #PPM under the exponential-time hypothesis (ETH), i.e., through reductions from 3SAT to PPM. Here, we give a reduction in the opposite direction.

The motivation for our study is the recent claim [Ope26] of a subexponential algorithm for #3SAT (which, in particular, refutes ETH). We find the change of perspective from “reducing for hardness” to “reducing for easiness” refreshing, allowing the re-use of techniques and tricks familiar from practical SAT solving. We anticipate that results of this flavor will be established for many problems, and we see #PPM as an interesting and simple, yet not entirely trivial, case study.

A permutation τ\tau of size nn is a bijection τ:[n]→[n]\tau: [n] \to [n], viewed alternatively as the sequence τ(1)τ(2)⋯τ(n)\tau(1)\tau(2)\cdots\tau(n). We refer to τ(i)\tau(i) as the value corresponding to index ii.

Given permutations τ\tau and π\pi of size nn and kk respectively, with k≤nk \leq n, an occurrence of π\pi in τ\tau is a set of kk indices S={u1<u2<⋯<uk}⊆[n]S = \{u_1 < u_2 < \cdots < u_k\} \subseteq [n], whose corresponding values in τ\tau are in the same relative order as the pattern π\pi, i.e.

τ(ui)<τ(uj)  ⟺  π(i)<π(j)for all i,j∈[k].\tau(u_i) < \tau(u_j) \iff \pi(i) < \pi(j) \quad \text{for all } i,j \in [k].

For example, S={3,5,6}S = \{3,5,6\} is an occurrence of pattern π=312\pi = 312 in τ=136524\tau = 136524, since the values 6,2,46,2,4 are ordered like 3,1,23,1,2. Another occurrence of the same pattern is S={4,5,6}S = \{4,5,6\}.

Let occ(τ,π)\mathrm{occ}(\tau,\pi) denote the number of occurrences of π\pi in τ\tau. Permutation pattern matching (PPM) asks whether occ(τ,π)>0\mathrm{occ}(\tau,\pi)>0 and its counting version (#PPM\# \mathrm{PPM}) asks to compute occ(τ,π)\mathrm{occ}(\tau,\pi).

Both PPM and #PPM are well-studied problems. A naive enumeration algorithm (check all subsets S⊆[n]S\subseteq[n] of size kk) solves both, running in time O∗(2n)\mathcal{O}^*(2^n). A series of improvements [BL16, BKM21, GR22] led to the current best runtime of O(1.415n)\mathcal{O}(1.415^n) for both problems, found by Gawrychowski and Rzepecki.

In the setting where the pattern size kk is separately considered, an algorithm with runtime nk/4+o(k)n^{k/4+o(k)} was given by Berendsohn, Kozma, and Marx [BKM21] for both PPM and #PPM. For PPM, an algorithm with runtime of the form n⋅2O(k2log⁡k)n\cdot 2^{\mathcal{O}(k^2 \log k)} was found by Guillemot and Marx [GM14], with a subsequent improvement to n⋅2O(k2)n\cdot 2^{\mathcal{O}(k^2)} by Fox [Fox13]. These latter results established the FPT status of PPM; note that they do not transfer to #PPM.

On the complexity side, Jélinek, Opler, and Pekárek [JOP21] showed that, assuming the exponential-time hypothesis (ETH), PPM does not admit a runtime of 2o(n/log⁡n)2^{o(n/\log n)} (the existence of such an algorithm would imply solving 3SAT in time 2o(n)2^{o(n)}). Berendsohn, Kozma, and Marx [BKM21] ruled out, also under the ETH, a runtime of the form g(k)⋅no(k/log⁡k)g(k)\cdot n^{o(k/\log k)} for #PPM.

In this paper we study the complexity of #PPM assuming the “easiness” of #3SAT. We establish that a subexponential algorithm for #3SAT implies a subexponential algorithm for #PPM (and consequently for PPM), improving the previous exponential bounds. We focus on running times expressed in terms of nn only.¹

Theorem 1.1. An algorithm for #3SAT with running time 2O(n/f(n))2^{\mathcal{O}(n/f(n))} implies an algorithm for #PPM with running time 2O(nlog⁡f(n)/f(n))2^{\mathcal{O}(n\sqrt{\log f(n)/f(n)})}.

Here ff is assumed to be a non-decreasing, efficiently computable function satisfying 2≤f(n)≤n2\leq f(n)\leq n for all sufficiently large nn. In particular, the claimed breakthrough for #3SAT [Ope26] implies a function f(n)∈Ω(log⁡n/log⁡log⁡n)f(n)\in\Omega(\sqrt{\log n}/\log \log n) in the exponent of the running time. This yields (assuming that the result holds), an algorithm for #PPM with runtime 2O(nlog⁡log⁡n/(log⁡n)1/4)2^{\mathcal{O}(n\log \log n/(\log n)^{1/4})}.

Idea of the reduction. The natural idea is to encode the set SS of indices of an occurrence as a bitvector of length nn, and design a circuit (eventually converted to a 3-CNF formula) that verifies whether SS indeed describes a valid occurrence of π\pi in τ\tau. A straightforward implementation would do a pass through the text permutation τ\tau, counting for each index ii that is in SS, the number of values smaller than the current value τ(i)\tau(i), corresponding to already seen indices from SS; these counts should then be compared to those of the pattern permutation π\pi, to verify the match. This approach involves, however, operations and comparisons with possibly log⁡n\log n-bit numbers, resulting in a circuit with Ω(nlog⁡n)\Omega(n \log n) variables. To take advantage of a (slightly) subexponential #3SAT algorithm, we need a circuit of size close to linear.

To get around this issue, we split [n][n] into blocks of size bb. Both the space of indices and the space of values are partitioned into such blocks, and we “guess” for an occurrence of π\pi in τ\tau how many indices i∈Si\in S fall into each index-block and how many corresponding values τ(i)\tau(i) fall into each value-block.

Assuming these guesses are correct, verifying whether a given occurrence set SS (represented as a length nn bitvector) is correct becomes easier. Indeed, one only needs to check whether each index- and value-block has the correct number of items selected, and whether the selected indices and values indeed describe the pattern permutation π\pi. For the latter task, we can aggregate the block counts offline, and the Boolean circuit only needs to work with local counts inside blocks, represented by O(log⁡b)\mathcal{O}(\log b) bits. A further optimization allows parts of the circuit to be reused for multiple equality tests. This gives O(b)\mathcal{O}(b) gates per index, for a final 3-CNF formula of size O(nb)\mathcal{O}(nb).

¹We note that the bounds parameterized by kk mentioned earlier remain preferable to the new bounds derived here, for smaller values of kk, e.g., when k∈O(n/log⁡2n)k\in\mathcal{O}(n/\log^2 n).

For a suitably chosen value b≈f(n)b \approx \sqrt{f(n)}, both the guessing (iterating through all feasible block-counts) and the #3SAT subroutine take similar subexponential time, yielding the overall speedup.

We describe the detailed reduction (proving Theorem 1.1) in the next section.