Tokenisation is not in APX
Analyze & explore related research in Conceptio
Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.
Tokenisation is not in APX Violeta Kastreva, Philip Whittington, Dennis Komm, Tiago Pimentel Department of Computer Science, ETH Zürich vkastreva@ethz.ch, {philip.whittington, dennis.komm, tiago.pimentel}@inf.ethz.ch
arXiv:2611.34938v1 [cs.CL] 25 Nov 2026
Abstract
unary direct compression binary direct compression binary direct log-likelihood binary bottom-up compression binary bottom-up log-likelihood
In this paper, we prove that, unless P = NP, no polynomial-time algorithm can find a tokeniser whose objective is within any constant factor of the optimum, meaning that tokenisation is not in the APX complexity class. We prove this for direct and bottom-up tokenisation, under both a compression or unigram log-likelihood objectives, and for binary or larger alphabets. We further show that, even over unary alphabets, direct tokenisation is APX-hard, and thus admits no polynomial-time approximation scheme.
1
1
any c N 1−ε approximation ratio this paper known before c
N open
Figure 1: Approximation ratios ruled out for tokenisation, assuming P ̸= NP. A ratio of 1 means exact solutions (NP-hardness), c some constant (APX-hardness), and “any c” every constant (not in APX). Under compression, N is achieved by character-level tokenisation.
Introduction
Tokenisers are the “glasses” through which language models (LMs) see the world, converting raw text—made of bytes or characters—into sequences of tokens. They define an LM’s API costs, impact the models’ throughput, affect their performance, and directly shape output distributions (Zouhar et al., 2023; Lesci et al., 2025; Ahia et al., 2023). It is thus natural to pose the question:
analysed objective. Studying unboundedly large alphabets, a set of initial papers proved that tokenisation’s optimisation problem is NP-hard (Whittington et al., 2025; Kozma and Voderholzer, 2026; Lim et al., 2025).2 Follow up work then showed it is still NP-hard over unary alphabets, and APX-hard over binary ones (Kastreva et al., 2026).3 These results, however, leave open three main questions:
how should one choose a tokeniser? A recent line of research frames this question as an optimisation problem: define an objective function, and find a tokeniser that performs well on it. In fact, famous tokenisation algorithms can be seen as instantiations of this principle. BPE is a greedy algorithm for compression, iteratively merging the most frequent pair of adjacent tokens (Gage, 1994; Sennrich et al., 2016), while UnigramLM is an expectation-maximisation algorithm for loglikelihood (Kudo, 2018; Meister, 2026). Notably, these methods are purely heuristic, having no guarantees regarding their solutions’ quality.1 A few recent works have explored whether it is even possible to propose tokenisers with optimality guarantees—all focusing on compression as their
(i) is tokenisation hard for other objectives beyond compression? (ii) does any constant-factor approximation algorithm exist for tokenisation? (iii) is unary tokenisation also hard to approximate? In this work, we tackle these three questions. First, we answer (i) and (ii) showing that binary tokenisation is not in APX; we prove this for direct and bottom-up tokenisation, covering both the compression and unigram log-likelihood objectives. This means that, unless P = NP, no polynomial2
More precisely, Whittington et al. (2025) showed that both direct and bottom-up tokenisation are NP-complete, Kozma and Voderholzer (2026) showed that bottom-up tokenisation, with or without partial merges, is APX-hard, and Lim et al. (2025) showed that direct tokenisation is NP-hard. 3 Explicitly, APX-hardness means that, for some constant c > 1, no polynomial-time algorithm can guarantee a solution within a factor c of the optimum, unless P = NP.
1
BPE, in particular, can have arbitrarily bad compression (Kozma and Voderholzer, 2026). See Yavuz et al. (2026) for an analysis of how these methods’ objective functions and optimisation algorithms interact when selecting a tokeniser.
1
2.1 Tokenisation Objectives Although no perfect objective seems to exist for tokenisation, several functions are said to correlate with a tokeniser’s performance: e.g., unigram loglikelihood (Kudo, 2018), 95%-ile token frequency (Gowda and May, 2020), Rényi efficiency (Zouhar et al., 2023), and compression (Gallé, 2019). It is thus natural to use them as an objective for tokenisation. We analyse two of them here. A tokeniser’s compression Gcomp , defined as the number of tokens it uses to represent a dataset, and its unigram negative log-likelihood Gll , defined as the log-likelihood of the tokenised dataset under a unigram distribution. Notably, compression is the objective behind BPE, while log-likelihood is used by UnigramLM.7 Writing f sP for the frequency of token s in dataset D and F = s f s as the total token count, we formalise these objectives as X def Gcomp (tok, D) = |tok(c)|, (2a)
time algorithm can approximate binary tokenisation within any constant factor, under either objective.4 Second, we answer (iii) by proving that unary tokenisation is APX-hard—so even in such simple alphabets, tokenisation cannot be approximated arbitrarily well (shown in §C due to space). Fig. 1 summarises prior results and ours. Overall, our results rule out the existence of (unconditional) approximation algorithms for tokenisation.5 Guarantees for practical tokenisers must therefore be dataset-specific, rather than hold for all possible inputs. In fact, in practice, tokenisers perform fairly well when applied to natural languages, coming within about 1% of the optimal compression (Tempus et al., 2026). Future work should explore what makes natural language so much easier to tokenise than our worst-case constructions, and explore data-specific algorithmic guarantees.
2
Tokenisation
c∈D
Let c ∈ Σ∗ be a character-string over an alphabet Σ, and let D = {cn }M (a multiset m=1 be a dataset P def of such strings) with total length N = c∈D |c|.6 We say the alphabet is binary if |Σ| = 2 and unary if |Σ| = 1. A tokeniser’s job is then to segment c as a sequence of tokens s = ⟨s1 , . . . , sm ⟩ from its vocabulary S ⊂ Σ+ , which we write as tok(c) = s def s.t. concat(s) = s1 ◦ · · · ◦ sm = c. To guarantee any string can be encoded, we enforce Σ ⊆ S and def define the vocabulary’s budget as K = |S| − |Σ|. Given these definitions, how do we now choose a tokeniser? As described above, we first choose an objective function G; given a class of realisable tokenisers T , we then select the one optimising it. The optimal objective value achievable is then: def
G⋆ (D) = min G(tok, D).
def
Gll (tok, D) =
X
f s log
s∈S : f s >0
F . fs
(2b)
2.2 Classes of Tokenisers Several classes of tokenisers exist. We consider two of them here. First, given a vocabulary S and a training dataset D, direct tokenisers segment each character string c ∈ D optimally under the given objective, being defined as: def
tok [S, D](c) = arg min Gs [S, D](s, {c}) (3) s∈S ∗ s.t. concat(s)=c
where Gs [S, D] returns a function which outputs the objective value (compression or negative loglikelihood) of a specific segmentation s considering the entire training dataset.8 Second, bottom-up tokenisers are specified by a sequence of merges def m = ⟨m1 , . . . , m|m| ⟩ ∈ M∗ , where M = Σ+ × + ′ Σ and each mk = sk ⊚ sk , which they apply in order to iteratively merge pairs of tokens in a string. Writing mergemk as a function that replaces, from left to right, every non-overlapping occurrence of adjacent tokens ⟨sk , s′k ⟩ by the single token snew k = sk ◦ s′k , we formalise these tokenisers as: K |m| def tok↑ [m](c) = mergemk c , (4)
(1)
tok∈T
We say a tokenisation algorithm is a ρapproximation if, given any dataset D, it returns a tokeniser tok with G(tok, D) ≤ ρ G⋆ . A problem with no ρ = 1 approximation is then NP-hard, with no ρ = 1+ε approximation (for some ε > 0) is APX-hard, and with no ρ = c (for all constants c > 1) is not in the APX class (all unless P = NP). 4
7
Concurrently, Baliga et al. (2026) showed this for bottomup tokenisation, and Ion et al. (2026) and Bastan et al. (2026) for direct tokenisation, all under a compression objective. 5 In fact, for compression, our bounds nearly match those achieved by trivial character-level tokenisers. 6 We follow the notation of Whittington et al. (2025) here.
k=1
Notably, UnigramLM optimises for a marginal likelihood over all possible segmentations under latent fs ; instead, we optimise over the log-likelihood of actually produced tokens. Whether our results extend to UnigramLM remains open. 8 For log-likelihood, s is thus evaluated under the unigram distribution over S that is optimal for the whole dataset D.
2
J where denotes function composition. UnigramLM is an example of a direct tokeniser, while BPE is a bottom-up tokeniser. We write TK for the set of tokenisers with budget K, noting bottom-up tokenisers have K = |S| − |Σ| = |m|.
3
3.2
We now provide the reduction from finite-word rank instances to binary direct tokenisation. The main idea is to define a function enc : Σwr → {0, 1}∗ which will replace each symbol in finiteword rank instances with long unique binary blocks.
Direct Tokenisation is not in APX
Reduction 1. Let (X , K wr ) define a finite-word rank instance. Now, fix an integer R ≥ 2. We construct a tokenisation instance as:
We now prove that direct tokenisation is not in the APX class. We do so using a gap reduction from a known NP-hard problem, finite-word rank, to binary direct tokenisation. From an instance of this NP-hard decision problem—whose desired output is a YES or NO answer—we build an instance of the tokenisation optimisation problem whose optimal objective will be small if the answer to the finite-word rank instance is YES, and large if it is NO. By making this gap arbitrarily large, we then show that any constant-factor approximation to tokenisation would allow us to distinguish YES from NO answers in finite-word rank.9 Unless P = NP, this is thus infeasible in polynomial time. Notably, proving the hardness of tokenisation with |Σ| = 2 also proves it for all |Σ| > 2. 3.1
K = K wr , Σ = {0, 1} def
enc(x) = enc1 (x)◦enc2 (x)◦· · ·◦encR (x) (6c) def
encr (x) = 11 ◦ 0y 1 ◦ 0y 2 ◦ · · · ◦ 0y L ◦ 0
We can now use this reduction to prove our main results regarding direct tokenisation. Theorem 1. Unless P = NP, binary direct tokenisation under the compression objective Gcomp is not in APX. In fact, for every constant ε > 0, it admits no polynomial-time N 1−ε -approximation. Proof sketch. See a formal proof in §A.1. For a target approximation factor ρ, apply Reduction 1 to a finite-word rank instance (X , K wr ) using R ≥ ⌈ρT ⌉. We can prove
Definition 1. Let X ⊂ Σ+ wr be a finite set of words and K wr ∈ N a target size. The finite-word rank decision problem requires deciding whether there ∗ exists a set Y ⊆ Σ+ wr that covers X , i.e., X ⊆ Y , with size at most |Y| ≤ K wr . Defining rank(X ) as X ’s smallest possible cover size, we write: def
min
∗ Y⊆Σ+ wr s.t. X ⊆Y
|Y|
(6d)
where y 1 y 2 · · · y L ∈ {0, 1}L is a binary fixedlength unique representation of each pair in Σwr × def {1, . . . , R}; we thus have L = ⌈log2 (|Σwr |R)⌉.
As the starting point of our reductions, we will use the finite-word rank decision problem, which was proven to be NP-complete by Néraud (1990). Let X = {xm }M m=1 be a finite set of words, composed of strings in an alphabet Σwr , i.e., xm ∈ Σ+ wr . This problem then asks if there is any set of strings Y ⊆ Σ+ wr with size at most K wr which covers X .
?
(6a)
D = {enc(x1 ) ◦ · · · ◦ enc(x|x| ) | x ∈ X } (6b)
Finite-Word Rank
K wr ≥ rank(X ) =
Reducing from Finite-Word Rank
rank(X ) ≤ K wr =⇒ G⋆comp (D) ≤ T,
(7a)
rank(X ) > K wr =⇒ G⋆comp (D) > R ≥ ρT.
(7b)
def P where T = x∈X |x|. If rank(X ) ≤ K wr , simply encoding the optimal Y for finite-word rank with enc would lead to at most T tokens being used by the tokeniser, leading to Eq. (7a). If rank(X ) > K wr , the tokeniser must cut some block encr (x) for every r ≤ R, requiring more than R tokens. Setting R = T c with c ≥ 3/ε gives N 1−ε T < R, ruling out N 1−ε -approximations.
(5)
The finite-word rank problem is closely related to tokenisation, but differs in two main ways. First, Y need not contain Σwr , allowing for solutions that cannot represent all strings in Σ∗wr . Second, it asks about the size of Y, instead of how compactly X can be represented using tokens in Y. Leveraging these differences will be the key to our results.
Theorem 2. Unless P = NP, binary direct tokenisation under the unigram log-likelihood objective is not in APX. In fact, for every constant ε > 0, it admits no polynomial-time N 1−ε -approximation. Proof sketch. See a formal proof in §A.2. Using Reduction 1 with R = T 4 , we can use a similar logic to above—but while also bounding tokens frequencies—to prove that:
9 Gap reductions are a classic technique, used, e.g., to show that the general travelling salesman problem admits no constant-factor approximation (Sahni and Gonzalez, 1976).
rank(X ) ≤ K wr =⇒ G⋆ll (D) ≤ T log T, (8a) 3
rank(X ) > K wr =⇒ G⋆ll (D) >
T3 . 4
where ⃝ denotes string concatenation, walk returns all three-vertex walks ω = vv ′ v ′′ in a graph, ⋄χ are separator symbols, unique per pair of walk endpoints, # is an end symbol, and bin returns a binary codeword for each node or symbol. Further, |Aλ | is twice the number of edges of the blown-up graph, M is the number of such walks, and H is the number of merges used to build all codewords. Note that D has a single string, which we denote e We now present our main theorems for by w. bottom-up tokenisation. Theorem 3. Unless P = NP, binary bottom-up tokenisation under the compression objective is not in APX. In fact, it admits no polynomial-time o(N/ log N )-approximation on length-N datasets.
(8b)
Setting R = T c with c ≥ 4/ε instead raises the NO bound to T c−1 /4, which exceeds N 1−ε T log T and so rules out N 1−ε -approximations.
Bottom-up Tokenisation is not in APX
4
We now show that binary bottom-up tokenisation is also not in the APX class, under either objective. To this end, we will reduce from maximum cut on cubic graphs. Here, we rely on a gap amplification reduction. Our reduction outputs a single binary string which collapses into one token within the budget on YES instances, but keeps a growing number of tokens on NO instances.10 4.1
Proof sketch. See formal proof in §B.1. For graphs with large enough J, we can show that:
Gap Maximum Cut on Cubic Graphs
µ(G) ≥ κ =⇒ G⋆comp (D) = 1,
First, let a graph G be cubic if each of its vertices has degree 3, and simple if it has no loops or multiedges. Further, let J be a graph’s number of vertices, and µ(G) be its maximum cut, i.e., the largest number of edges crossing a partition of its vertices into two sets (see Definition 2 in the appendix). Computing µ(G) on simple cubic graphs is APXcomplete (Alimonti and Kann, 2000). Moreover, there is a constant ε0 > 0 for which it is NP-hard to distinguish cubic graphs with µ(G) ≥ κ from those with µ(G) ≤ κ − ε0 J, for a given target κ (Lemma 3). 4.2
µ(G) ≤ κ−ε0 J =⇒ G⋆comp (D) > ε20 λ2 J (10b) which presents a gap amplification. For log-likelihood, a single token would have negative log-likelihood 0, so we add the string 0, e 0}. which no merge can change, and use D = {w, Theorem 4. Unless P = NP, binary bottomup tokenisation under the unigram negative loglikelihood objective Gll is not in APX. In fact, it admits no polynomial-time o(log N )approximation on datasets of total length N .
Reducing from Maximum Cut
Proof sketch. See formal proof in §B.2. Similarly to before, for large enough J, we show that:
Given an instance (G, κ), we (i) replace every node of G by λ = ⌈40/ε0 ⌉ copies, (ii) write all threevertex walks of this graph into one string, and (iii) encode it as a binary string.
µ(G) ≥ κ =⇒ G⋆ll (D) ≤ 2 log 2, µ(G) ≤ κ − ε0 J =⇒
G⋆ll (D) > log
(11)
ε0 2 2λ J
which again presents a gap amplification.
Reduction 2. Let (G, κ) be an instance of maximum cut on a simple cubic graph. Now, let Gλ be a copy of G where every node v j is replaced with λ = ⌈40/ε0 ⌉ copies v j,n (n ≤ λ), and two nodes v j,n , v j ′ ,n′ are connected if v j , v j ′ were connected in G. We construct a tokenisation instance as:
5
Conclusion
In this work, we proved that binary tokenisation is not in APX, and that unary direct tokenisation is APX-hard. In fact, our reductions leave open only relatively trivial approximation guarantees, close in approximation ratio to, e.g., character-level tokenisation. Any practical approximation guarantee for tokenisers must thus be dataset-specific. Future work should thus seek such conditional guarantees, e.g., by certifying how close a tokeniser is to optimal on a given target dataset.11
K = H + 3M + |Aλ | − λ2 κ, Σ = {0, 1} (9a) D = {⃝x∈graph2str(Gλ ) bin(x)} graph2str(Gλ ) = ⃝ ω ⋄χ #
(10a)
(9b) (9c)
ω∈walk(Gλ ) 10
Notably, this reduction amplifies the gap of the PCP theorem (Arora and Safra, 1998; Arora et al., 1998; Dinur, 2007). Known reductions carry this gap over to maximum cut on cubic graphs (Håstad, 2001; Berman and Karpinski, 2001).
11
A first step towards this goal was done by Tempus et al. (2026) using linear programming.
4
Limitations
Piotr Berman and Marek Karpinski. 2001. Efficient amplifiers and bounded degree optimization. Technical Report TR01-053, Electronic Colloquium on Computational Complexity.
Our hardness results rely on carefully constructed datasets, which differ substantially from natural text; our results thus say little about the naturallanguage datasets tokenisers are trained on, where current algorithms may be near-optimal. Further, our analysis covers two objectives, compression and unigram log-likelihood, and two kinds of tokenisers, direct and bottom-up; other objectives, such as Rényi efficiency, and other variants, such as those allowing partial merges (Kozma and Voderholzer, 2026), remain open. We suspect, however, that most interesting classes of tokenisers and objective functions will also be hard to approximate.
Pierluigi Crescenzi. 1997. A short guide to approximation preserving reductions. In Proceedings of the Twelfth Annual IEEE Conference on Computational Complexity, pages 262–273. Irit Dinur. 2007. The PCP theorem by gap amplification. Journal of the ACM, 54(3):12. Philip Gage. 1994. A new algorithm for data compression. C Users Journal, 12(2):23–38. Matthias Gallé. 2019. Investigating the effectiveness of BPE: The power of shorter sequences. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 1375–1381, Hong Kong, China. Association for Computational Linguistics.
Acknowledgements We would like to thank Gregor Bachmann and Jan Tempus for conversations about this topic.
Thamme Gowda and Jonathan May. 2020. Finding the optimal vocabulary size for neural machine translation. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 3955–3964, Online. Association for Computational Linguistics.
References Orevaoghene Ahia, Sachin Kumar, Hila Gonen, Jungo Kasai, David Mortensen, Noah A. Smith, and Yulia Tsvetkov. 2023. Do all languages cost the same? tokenization in the era of commercial language models. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 9904–9923, Singapore. Association for Computational Linguistics.
Johan Håstad. 2001. Some optimal inapproximability results. Journal of the ACM, 48(4):798–859. Andrei Robert Ion, Rares Mateiu, Adrian Miclaus, and Alexandru Popa. 2026. How hard is tokenisation? Algorithms and complexity beyond NP-hardness. Preprint, arXiv:2611.12348.
Paola Alimonti and Viggo Kann. 2000. Some APXcompleteness results for cubic graphs. Theoretical Computer Science, 237(1–2):123–134.
Violeta Kastreva, Philip Whittington, Dennis Komm, and Tiago Pimentel. 2026. Tokenisation over bounded alphabets is hard. In The Fourteenth International Conference on Learning Representations.
Sanjeev Arora, Carsten Lund, Rajeev Motwani, Madhu Sudan, and Mario Szegedy. 1998. Proof verification and the hardness of approximation problems. Journal of the ACM, 45(3):501–555.
László Kozma and Johannes Voderholzer. 2026. Theoretical Analysis of Byte-Pair Encoding. In 34th Annual European Symposium on Algorithms (ESA 2026), volume 388 of Leibniz International Proceedings in Informatics (LIPIcs), pages 80:1–80:17.
Sanjeev Arora and Shmuel Safra. 1998. Probabilistic checking of proofs: A new characterization of NP. Journal of the ACM, 45(1):70–122. Giorgio Ausiello, Pierluigi Crescenzi, Giorgio Gambosi, Viggo Kann, Alberto Marchetti-Spaccamela, and Marco Protasi. 2012. Complexity and approximation: Combinatorial optimization problems and their approximability properties. Springer Science & Business Media.
Taku Kudo. 2018. Subword regularization: Improving neural network translation models with multiple subword candidates. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 66–75, Melbourne, Australia. Association for Computational Linguistics.
Kundan Baliga, Aiden Xie, and Aditya Byju. 2026. Pair-merge tokenisation is hard to approximate on binary strings and strongly NP-hard on unary datasets. Preprint, arXiv:2611.13568.
Pietro Lesci, Clara Meister, Thomas Hofmann, Andreas Vlachos, and Tiago Pimentel. 2025. Causal estimation of tokenisation bias. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 28325– 28340, Vienna, Austria. Association for Computational Linguistics.
Atieh Bastan, Xiaoling He, A. Pavan, and N. V. Vinodchandran. 2026. Tokenization: Hardness and bicriteria approximation algorithms. Preprint, arXiv:2611.15074.
5
Jia Peng Lim, Shawn Tan, Davin Choo, and Hady W. Lauw. 2025. A partition cover approach to tokenization. In Advances in Neural Information Processing Systems, volume 38, pages 74286–74318. Clara Meister. 2026. UnigramLM: An attempt at writing the missing manual. Blog post. Jean Néraud. 1990. Elementariness of a finite set of words is co-NP-complete. RAIRO – Theoretical Informatics and Applications, 24(5):459–470. Sartaj Sahni and Teofilo Gonzalez. 1976. P-complete approximation problems. Journal of the ACM, 23(3):555–565. Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1715–1725, Berlin, Germany. Association for Computational Linguistics. Jan Tempus, Philip Whittington, Craig W. Schmidt, Dennis Komm, and Tiago Pimentel. 2026. Tokenisation via convex relaxations. Preprint, arXiv:2605.22821. Philip Whittington, Gregor Bachmann, and Tiago Pimentel. 2025. Tokenisation is NP-complete. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 28133–28153, Vienna, Austria. Association for Computational Linguistics. Ahmetcan Yavuz, Clara Meister, and Tiago Pimentel. 2026. Objective vs. search: Decomposing what makes a good tokeniser. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing, pages 52425–52444, Budapest, Hungary. Association for Computational Linguistics. Vilém Zouhar, Clara Meister, Juan Gastaldi, Li Du, Mrinmaya Sachan, and Ryan Cotterell. 2023. Tokenization and the noiseless channel. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 5184–5207, Toronto, Canada. Association for Computational Linguistics.
6
A
Binary Direct Tokenisation is not in APX
A.1
Proof of Theorem 1 (Compression)
Theorem 1. Unless P = NP, binary direct tokenisation under the compression objective Gcomp is not in APX. In fact, for every constant ε > 0, it admits no polynomial-time N 1−ε -approximation. Proof. Consider P a FINITE-WORD-RANK instance (X , K wr ) and its binary encoding D from §3.2 (Fig. 2a). Recall that T = x∈X |x|. We first establish the following two implications: rank(X ) ≤ K wr =⇒ G⋆comp (D) ≤ T,
(12)
G⋆comp (D) > R.
(13)
rank(X ) > K wr =⇒
This is done in steps 1 and 2 below. We then show how to choose R such that no constant approximation exists (step 3 ). Finally, we strengthen these results to show no N 1−ε -approximation exists (step 4 ). Step 1 . First implication (Eq. (12)). Suppose rank(X ) ≤ K wr . Then there exists a generating set ∗ Y ⊆ Σ+ wr with |Y| ≤ K wr and X ⊆ Y . We construct a direct-tokenisation vocabulary containing, for every y ∈ Y, the token enc(y). If |Y| < K wr , the remaining vocabulary entries may be chosen arbitrarily. Take any word x ∈ X . Since Y generates X , we can write x = y1 y2 · · · yℓ ,
yi ∈ Y.
enc(x) = enc(y1 )enc(y2 ) · · · enc(yℓ )
=⇒
(14)
where the implication follows from the construction of the binary encoding. Hence enc(x) can be represented using at most ℓ tokens. Moreover, every yi is non-empty, so ℓ ≤ |x|. Since direct tokenisation chooses a minimum-length representation, |tok [S](enc(x))| ≤ ℓ ≤ |x|.
(15)
Summing over all x ∈ X gives Gcomp (tok [S], D) ≤
X
|x| = T.
(16)
rank(X ) ≤ K wr =⇒ G⋆comp (D) ≤ T.
(17)
x∈X
Therefore,
Step 2 . Second implication (Eq. (13)). We prove the contrapositive of Eq. (13). Suppose there exists a direct-tokenisation vocabulary S with at most K wr tokens such that Gcomp (tok [S], D) ≤ R.
(18)
Across the entire tokenised dataset, there are thus at most R tokens, and at most R − 1 token boundaries. Now, letting ℓm be the number of tokens used to encode enc(xm ), we have that: M X
(ℓm − 1) <
m=1
M X
ℓm ≤ R,
(19)
m=1
where ℓm − 1 then represents the number of boundaries between tokens for each word. As the number of token boundaries is smaller than R—and since each such boundary can cut through at most one of the R blocks encr (x)— there must exist at least one index j ⋆ such that no block encj ⋆ (c) is cut by a token boundary anywhere in D (Fig. 2b). We now construct a generating set for X . For each non-character token s ∈ S, read from left to right all complete blocks of the form encj ⋆ (c) contained in s, and record their corresponding symbols c. If no 7
identifier of (a, 2)
start
1 0y 1 0y 2 · · · 0y L 0
enc2 (a) =
1
enc(ab) =
enc1 (a)
enc2 (a) · · ·
encR (a)
enc1 (b)
enc(a): R blocks
enc2 (b)
···
encR (b)
enc(b): R blocks
token enc(ab) if ab ∈ Y (a) Binary encoding of the word x = ab. enc(ab)
enc1 (a)
enc2 (a)
enc3 (a)
enc1 (b)
enc2 (b)
enc3 (b)
enc1 (a)
enc2 (a)
enc3 (a)
ab enc(bab)
enc1 (b)
enc2 (b)
enc3 (b)
b enc(bb)
enc1 (b)
enc2 (b)
enc3 (b)
ab
enc2 (b)
enc3 (b)
enc1 (b)
enc2 (b)
enc3 (b)
b ⋆
enc1 (b)
never cut (j =3)
b cut
token
(b) Tokenising X = {ab, bab, bb}, with R = 3.
Figure 2: (a) Each symbol becomes R blocks encj (c), each a start marker 11 followed by an identifier of (c, j). (b) Each boundary cuts at most one block, so fewer than R boundaries leave some index j ⋆ uncut; the j ⋆ -blocks of each token spell a word, and these words generate X .
such block occurs in s, we discard it. Let Y be the set of non-empty words obtained in this way. Since S contains at most K wr non-character tokens, |Y| ≤ K wr .
(20)
It remains to show that Y generates X . Take any x = c1 · · · cm ∈ X . Its encoding enc(x) contains, in order, the blocks encj ⋆ (c1 ), encj ⋆ (c2 ), . . . , encj ⋆ (cm ).
(21)
By the choice of j ⋆ , every one of these blocks lies entirely inside a single token. Thus, reading the complete j ⋆ -blocks from the tokens of enc(x) recovers c1 , . . . , cm in order. The corresponding words from Y therefore concatenate to x, and hence x ∈ Y ∗ . Since this holds for every x ∈ X , X ⊆ Y ∗ , and therefore rank(X ) ≤ |Y| ≤ K wr . We have shown that G⋆comp (D) ≤ R =⇒ rank(X ) ≤ K wr .
(22)
rank(X ) > K wr =⇒ G⋆comp (D) > R,
(23)
Taking the contrapositive gives
proving Eq. (13). Step 3 . No constant approximation. Suppose that there exists a polynomial-time ρ-approximation algorithm for some constant ρ ≥ 1. We are going to show that this algorithm could be used to decide FINITE-WORD-RANK in polynomial time, which is impossible unless P = NP. To this end, set R = ⌈ρT ⌉. Since ρ is constant, R = O(T ) and the construction remains polynomial in size. If rank(X ) ≤ K wr , then by Eq. (12) the approximation algorithm returns a solution of value at most ρG⋆comp (D) ≤ ρT ≤ R. 8
(24)
Conversely, if rank(X ) > K wr , then by Eq. (13) every feasible solution has value strictly greater than R. We could thus decide FINITE-WORD-RANK as follows: build D, run the approximation algorithm, count the tokens its vocabulary uses, and answer “rank(X ) ≤ K wr ” if and only if there are at most R. Each of these steps takes polynomial time, which is impossible unless P = NP, as FINITE-WORD-RANK is NP-hard. Since ρ was arbitrary, no polynomial-time constant-factor approximation exists. Step 4 . No N 1−ε -approximation. The same argument rules out much larger ratios. Fix ε > 0 and set R = T c for a constant c ≥ 3/ε, and suppose that a polynomial-time N 1−ε -approximation algorithm exists. Let S be the vocabulary it returns on D. We show that the number of tokens it uses would reveal whether rank(X ) ≤ K wr ; for sufficiently large T , rank(X ) ≤ K wr =⇒ Gcomp (tok [S], D) ≤ R,
(25a)
rank(X ) > K wr =⇒ Gcomp (tok [S], D) > R.
(25b)
We now prove both implications. First implication (Eq. (25a)). The returned vocabulary is within a factor N 1−ε of the optimum, which step 1 (Eq. (12)) bounds by T on YES instances. It thus uses at most N 1−ε T tokens, and it suffices to show that this is below R. Each encoded pair has 2L + 3 = O(log T ) characters, so the dataset has total length N = T R (2L + 3) = T c+1 (2L + 3), and for sufficiently large T : N 1−ε T = T c+1 (2L + 3) ≤T
(c+1)(1−ε)
≤T
c−1
1−ε
N = T c+1 (2L + 3)
T
1−ε
≤ 2L + 3
(26b)
ε(c + 1) ≥ 3
(26c)
2L + 3 = O(log T ) < T
(26d)
(2L + 3) T
(2L + 3)
(2L + 3)
c
< T = R,
(26a)
which proves the first implication. Second implication (Eq. (25b)). The implication proved in step 2 (Eq. (13)) holds for every choice of R: on NO instances, every vocabulary within the budget uses more than R tokens. This includes the returned vocabulary S, which proves the second implication (Eq. (25b)). Using this, we can decide FINITE-WORD-RANK in polynomial time. Hence, unless P = NP, no polynomial-time N 1−ε -approximation algorithm exists, which concludes the proof.
A.2
Proof of Theorem 2 (Log-Likelihood)
Theorem 2. Unless P = NP, binary direct tokenisation under the unigram log-likelihood objective is not in APX. In fact, for every constant ε > 0, it admits no polynomial-time N 1−ε -approximation. Proof. Consider a FINITE-WORD-RANK instance (X , K wr ) and its binary encoding D from §3.2 (Fig. 2a). Recall that X T = |x|, (27) x∈X def
and, for this reduction, set R = T 4 . Let q = |encr (x)| = 2L + 3 denote the common length of an encoded def pair, and let b = T + 2q − 1. We establish the following gap: rank(X ) ≤ K wr =⇒ G⋆ll (D) ≤ T log T, rank(X ) > K wr =⇒ G⋆ll (D) >
T3 4
,
(28) (29)
for sufficiently large T . This is done in steps 1 and 2 . We then show that no constant approximation exists (step 3 ), and finally that no N 1−ε -approximation exists (step 4 ). 9
Step 1 . First implication (Eq. (28)). Suppose rank(X ) ≤ K wr . As in the first implication of Theorem 1, there exists a vocabulary S and a segmentation of D over S using at most T tokens. Let F ≤ T denote this total token count and let f s denote the frequency of token s. Since tok [S] minimises the log-likelihood over all segmentations of D, we have Gll (tok [S], D) ≤
X
f s log
X F ≤ f s log F = F log F ≤ T log T. fs
(30)
s∈S
s∈S
Therefore, rank(X ) ≤ K wr =⇒ G⋆ll (D) ≤ T log T.
(31)
Step 2 . Second implication (Eq. (29)). Suppose rank(X ) > K wr , and let S ⋆ be a vocabulary minimising the negative log-likelihood objective. Let F ⋆ be the total number of tokens produced by tok [S ⋆ ] on D, let f s be the frequency of token s, and let def
fmax = max⋆ f s .
(32)
s∈S
We first bound the longest consecutive occurrence of any token s to have length at most b = T + 2q − 1. The proof for this step is given in Lemma 1. We then use this bound to control token frequencies. Let M = |X | be the number of strings in the original FINITE-WORD-RANK instance. Fix a token s with frequency f s . This token occurs in sequences of at most b consecutive appearances at a time, and each of these sequences must end before either another token (of which there are at most F ⋆ − f s ) or the strings end (of which there are M ). Its frequency can thus be bounded as: f s ≤ b (F ⋆ − f s + M ) .
(33)
with the same holding for the most frequent token. Now, with a slight rearrangement, we can show that: b (F ⋆ − fmax + M ) ≥ fmax
(34a)
⋆
b (F − fmax ) ≥ fmax − b M ⋆
(34b)
⋆
(b + 1) (F − fmax ) ≥ F − b M F ⋆ − bM F ⋆ − fmax ≥ . b+1
(34c) (34d)
We can now lower-bound the optimal negative log-likelihood: G⋆ll (D) =
X
f s log
F⋆ fs
f s log
F⋆ fmax
s∈S ⋆
≥
X s∈S ⋆
F⋆ = F ⋆ log f max fmax ≥ F⋆ 1 − ⋆ F ⋆ = F − fmax F ⋆ − bM ≥ . b+1
definition of ll objective
(35a)
f s ≤ fmax
(35b) (35c)
− log x ≥ 1 − x
(35d) (35e)
Eq. (34d)
(35f)
By the second implication of Theorem 1, the assumption rank(X ) > K wr implies that every feasible vocabulary produces more than R tokens on D. As such, we have that F ⋆ > R and thus, G⋆ll (D) >
R − bM . b+1
10
(36)
Recall that R = T 4 . Moreover, since every word in X is non-empty, M ≤ T . Each encoding pair has q = 2L + 3 = O(log T ) characters, and therefore, for sufficiently large T , b = T + 2q − 1 < 2T. Consequently, T 4 − bM b+1 T4 − bT ≥ b+1 4 T − 2T 2 > 2T 3 T = −T 2 T3 ≥ 4
G⋆ll (D) >
Eq. (36), R = T 4
(37a)
M ≤T
(37b)
b < 2T
(37c) (37d)
T ≥2
(37e)
proving the implication (Eq. (29)). Step 3 . No constant approximation. Suppose for contradiction that there exists a polynomialtime ρ-approximation algorithm for some constant ρ ≥ 1. We show that it could be used to decide FINITE-WORD-RANK in polynomial time, which is impossible unless P = NP. For sufficiently large T , ρ T log T <
T3 . 4
(38)
Hence, on a YES instance of FINITE-WORD-RANK, the algorithm returns a solution of value strictly below T 3 /4, while on a NO instance every feasible solution has value strictly above T 3 /4. We could thus decide FINITE-WORD-RANK as follows: build D, run the approximation algorithm, compute the objective of the vocabulary it returns, and answer “rank(X ) ≤ K wr ” if and only if it is below T 3 /4. Each of these steps takes polynomial time, which is impossible unless P = NP, as FINITE-WORD-RANK is NP-hard. Since ρ was arbitrary, no polynomial-time constant-factor approximation exists. Step 4 . No N 1−ε -approximation. As for Theorem 1, the same argument rules out much larger ratios. Fix ε > 0 and set R = T c for a constant c ≥ max{3, 4/ε}. Suppose for a contradiction that a polynomial-time N 1−ε -approximation algorithm exists, and let S be the vocabulary this algorithm returns on D. We show that the objective of this vocabulary would reveal whether rank(X ) ≤ K wr ; for sufficiently large T , T c−1 , 4 T c−1 rank(X ) > K wr =⇒ Gll (tok [S], D) > 4 rank(X ) ≤ K wr =⇒ Gll (tok [S], D) <
(39a) (39b)
and we could then use the value given by the approximation algorithm to solve the FINITE-WORD-RANK decision problem in polynomial time. We now prove both implications. First implication (Eq. (39a)). The returned vocabulary is within a factor N 1−ε of the optimum, which step 1 (Eq. (28)) bounds by T log T on YES instances. Its objective is thus at most N 1−ε T log T , and it suffices to show that this is below T c−1 /4. The dataset has total length N = T Rq = T c+1 q, so for sufficiently large T : 1−ε N 1−ε T log T = T c+1 q T log T N = T c+1 q (40a) ≤ T (c+1)(1−ε) q T log T ≤T <
c−2
q log T
T c−1 4 11
q 1−ε ≤ q
(40b)
ε(c + 1) ≥ 4
(40c)
4q log T < T
(40d)
which proves the implication. Second implication (Eq. (39b)). No vocabulary has a lower objective than the optimum, so it suffices to show that the optimum itself exceeds T c−1 /4 on NO instances. For this, we reuse the bound of step 2 (Eq. (36)), which holds for every choice of R. Each encoded pair still has q = O(log T ) characters, so b = T + 2q − 1 < 2T for sufficiently large T , and we get: T c − bM b+1 Tc − bT ≥ b+1 c T − 2T 2 > 2T c−1 T = −T 2 T c−1 ≥ 4
G⋆ll (D) >
Eq. (36), R = T c
(41a)
M ≤T
(41b)
b < 2T
(41c) (41d)
T c−2 ≥ 4
(41e)
which proves the second implication. An N 1−ε -approximation would thus return objective below T c−1 /4 on YES instances, while every tokeniser exceeds it on NO instances, deciding FINITE-WORD-RANK in polynomial time. Lemma 1. Under Reduction 1, every run, i.e., maximal sequence of consecutive occurrences of the same token in a tokenised string of D, has length at most T + 2q − 1. Proof. Consider any token s of length d and any maximal run of r consecutive copies of s in the tokenisation of some encoded word enc(x). If d < q and r ≥ 2q, then the overlap between the run and its shift by d has length at least (r − 1)d ≥ 2q − 1 ≥ q + 1.
(42)
This overlap therefore contains a complete occurrence of the marker 11. Since the run is periodic with period d, another occurrence of 11 appears exactly d positions later. However, by construction, 11 occurs only at the beginnings of encoded pairs, which are spaced q positions apart. Hence q divides d, contradicting d < q. Thus, d < q =⇒ r ≤ 2q − 1.
(43)
If d = q, three consecutive copies of s would contain two complete consecutive pair encodings at corresponding positions. Periodicity would force these two pair encodings to be identical, although their indices differ by one modulo R. Since R ≥ 2, this is impossible, and hence r ≤ 2. Finally, suppose d > q and r ≥ 2. The first occurrence of s contains a complete marker 11, and the identical second occurrence contains the same marker exactly d positions later. As above, this implies that q divides d. Write d = kq. Since d > q, we have k ≥ 2, so the first copy of s contains at least one complete encoded pair. The corresponding pair in the second copy lies exactly k blocks later and must be identical. The block indices cycle through 1, . . . , R, so equality of the two encoded pairs implies k≡0
(mod R).
(44)
Consequently, d ≥ Rq. Since |enc(x)| = |x|Rq, such a token can occur consecutively at most |x| ≤ T times. Combining the three cases, every run of any token has length at most b = T + 2q − 1.
12
(45)
B
Proof that Binary Bottom-up Tokenisation is not in APX
This appendix proves Theorem 3 and Theorem 4. Both follow from a single reduction from gap maximum cut on cubic graphs, and from the gap it creates, which we state as a forward and a backward implication (Proposition 1). Taking this gap as given, §B.1 and §B.2 first prove the two theorems. The remaining subsections build up to Proposition 1: §B.3 recalls maximum cut on cubic graphs, §B.4 constructs the reduction, and §B.5 states the gap. Finally, §B.6 turns a maximum cut into a short merge sequence that collapses the encoded string into a single token, and §B.7 shows that no merge sequence over the binary alphabet can do better. B.1
Proof of Theorem 3 (Compression)
Theorem 3. Unless P = NP, binary bottom-up tokenisation under the compression objective is not in APX. In fact, it admits no polynomial-time o(N/ log N )-approximation on length-N datasets. Proof. Suppose that there is a polynomial-time ρ-approximation algorithm for some constant ρ ≥ 1. We use it to decide 3SAT in polynomial time. Given a 3SAT formula φ, we compute (G, κ) by Lemma 3, and def let J 0 = max{9λ + 1, ⌈2ρ/(ε0 λ2 )⌉}. Small graphs. If J < J 0 , we compute µ(G) by enumerating all colourings, which takes constant time, and accept if and only if µ(G) ≥ κ. This is correct by Lemma 3, as κ − ε0 J < κ. e K) = R↑ (G, κ), run the algorithm on the dataset {w} e with Large graphs. Otherwise, we compute (w, budget K, and accept if and only if its merge sequence leaves at most ρ tokens. If φ is satisfiable, then µ(G) ≥ κ, so the optimal compressed length is 1 by Proposition 1(i), and the algorithm leaves at most ρ tokens. If φ is unsatisfiable, then µ(G) ≤ κ − ε0 J, so by Proposition 1(ii), every feasible merge sequence leaves more than ε20 λ2 J ≥ ρ tokens. All steps take polynomial time, so 3SAT would be in P, which contradicts its NP-hardness unless P = NP. e has length N = q(4M +1) = Θ(J log J), The same argument rules out much larger ratios. The string w and thus J = Θ(N/ log N ). Hence, for any ratio ρ(N ) = o(N/ log N ), we have ρ(N ) < ε20 λ2 J once J exceeds some constant, below which we again enumerate all colourings. Accepting if and only if the algorithm leaves at most ρ(N ) tokens then decides 3SAT as before. B.2
Proof of Theorem 4 (Log-Likelihood)
For the log-likelihood objective, we use the following lower bound. Lemma 2. If a tokenised dataset consists of F ≥ 2 tokens of at least two distinct types, its unigram negative log-likelihood is at least log F . def
Proof. Let s⋆ be a most frequent token, and let g = F − f s⋆ count all other tokens. As at least two types def occur, 1 ≤ g ≤ F −1, and every token s ̸= s⋆ has f s ≤ g. Writing H2 (x) = −x log x−(1−x) log(1−x) for the binary entropy, Gll = f s⋆ log
X F F + f s log f s⋆ f s ⋆
(46a)
s̸=s
F F ≥ (F − g) log + g log F −g g g 1 = F · H2 ≥ F · H2 F F F ≥ log F. = log F + (F − 1) log F −1
f s ≤ g for s ̸= s⋆
(46b)
H2 concave and symmetric
(46c) (46d)
The inequality in the third line holds since a concave function attains its minimum over the interval [ F1 , 1 − F1 ] at an endpoint, where H2 takes the same value. 13
Theorem 4. Unless P = NP, binary bottom-up tokenisation under the unigram negative log-likelihood objective Gll is not in APX. In fact, it admits no polynomial-time o(log N )-approximation on datasets of total length N . def
e K) = R↑ (G, κ), consider the dataset D = {w, e 0} with budget K. No merge Proof. For an output (w, e contains a token with acts on the string 0, which is always the single token 0; and every tokenisation of w a 1, which differs from 0. So every merge sequence produces F ≥ 2 tokens of at least two types on D, and by Lemma 2, Gll (tok↑ [m], D) ≥ log F ≥ log 2.
(47)
In particular, the optimal objective is strictly positive. We now establish the gap. YES instances. If µ(G) ≥ κ, the merge sequence of Proposition 1(i) tokenises D into the two distinct e and 0, each with frequency 1, so G⋆ll (D) ≤ 2 log 2. tokens w NO instances. If µ(G) ≤ κ − ε0 J, every feasible merge sequence leaves more than ε20 λ2 J tokens on e by Proposition 1(ii), so F > ε20 λ2 J, and G⋆ll (D) > log( ε20 λ2 J) by Eq. (47). w Deciding 3SAT. Suppose that there is a polynomial-time ρ-approximation algorithm for some constant def ρ ≥ 1. Given a 3SAT formula φ, we compute (G, κ) by Lemma 3, and let J 0 = max{9λ + 1, ⌈2 · 4ρ /(ε0 λ2 )⌉}. If J < J 0 , we decide φ by enumerating all colourings of G, as in the proof of Theorem 3. Otherwise, we run the algorithm on D with budget K, count the number F of tokens its merge sequence produces, and accept if and only if F ≤ 4ρ . If φ is satisfiable, the returned objective is at most 2ρ log 2, so log F ≤ 2ρ log 2 by Eq. (47), i.e., F ≤ 4ρ . If φ is unsatisfiable, every feasible merge sequence produces F > ε20 λ2 J ≥ 4ρ tokens. This test only compares integers, and all steps take polynomial time; so 3SAT would be in P, which contradicts its NP-hardness unless P = NP. e + 1. We accept if and only if The same argument rules out ratios ρ(N ) = o(log N ), where N = |w| ρ(N ) F ≤4 ; on YES instances this holds as before, while on NO instances F >
N ε0 2 λ J =Θ > N o(1) = 4ρ(N ) 2 log N
(48)
once J exceeds some constant. B.3
Maximum Cut on Cubic Graphs
Let G = (V, E) be a finite, simple, undirected graph with J = |V| vertices and I = |E| edges; we call it cubic if every vertex has degree exactly 3, in which case I = 32 J and J ≥ 4. A colouring σ : V → {B, W } places each vertex on one of two sides; unlike in graph colouring, adjacent vertices may share a side.12 Its cut size is the number of edges whose endpoints lie on different sides:
1σ {σ(v) ̸= σ(v′ )}.
X
def
cutG (σ) =
(49)
(v,v ′ )∈E
Definition 2. Let G = (V, E) be a simple cubic graph. Given a target κ ∈ N, the 3-MAX-CUT decision problem requires deciding whether there exists a colouring σ with cutG (σ) ≥ κ. The 3-MAX-CUT optimisation problem requires finding the maximum cut size. Formally: ?
κ ≤ max cutG (σ) σ∈{B,W }V | {z } 3-MAX-CUT decision problem
µ(G) = max cutG (σ) σ∈{B,W }V | {z }
(50)
3-MAX-CUT optimisation problem
Alimonti and Kann (2000) proved that 3-MAX-CUT is APX-complete. We will also use the following standard facts. 12
We name the two sides after the two marker strings of Reduction 4; the reduction identifies a side with its marker.
14
a
a t=3 c
b
c
b G3
G
Figure 3: The 3-blow-up of a triangle (Definition 3). Each edge becomes a complete bipartite graph between two clusters, drawn in the edge’s colour.
Fact 1. Given a simple cubic graph G, a colouring σ in which every vertex has at least two cut incident edges (a locally maximal colouring) can be found in polynomial time. Consequently, J ≤ µ(G) ≤ I.
(51)
Proof. Start from any colouring and repeatedly move a vertex to the other side while this increases the cut size. Each move increases an integer bounded by I, so at most I moves occur. At termination, no vertex has more uncut than cut incident edges; as each vertex has degree 3, it has at least two cut incident edges. Counting cut edges from both endpoints gives cutG (σ) ≥ 2J/2 = J. The upper bound is trivial. Lemma 3 (Gap maximum cut). There is a constant ε0 > 0 and a polynomial-time algorithm which maps every 3SAT formula φ to a pair (G, κ), where G is a simple cubic graph with J vertices and κ ≤ I, such that φ satisfiable =⇒ µ(G) ≥ κ, φ unsatisfiable =⇒ µ(G) ≤ κ − ε0 J.
(52) (53)
Proof. By the PCP theorem and Håstad (2001), there are constants 0 < s < c ≤ 1 such that it is NP-hard to decide whether a MAX-E2-LIN2 instance has a c-fraction or at most an s-fraction of its equations simultaneously satisfiable, and this hardness is witnessed by a polynomial-time reduction from 3SAT. Berman and Karpinski (2001) give an explicit, deterministic gap-preserving reduction from MAX-E2-LIN2 to maximum cut on simple 3-regular graphs whose number of edges is linear in the number of equations. Composing the two yields, for each formula φ, a simple cubic graph G and thresholds κyes > κno with κyes − κno = Θ(I) = Θ(J), such that µ(G) ≥ κyes if φ is satisfiable and µ(G) ≤ κno otherwise. Setting def κ = κyes ≤ I and choosing ε0 such that κyes − κno ≥ ε0 J proves the lemma. Definition 3. Let G = (V, E) be a graph and t ≥ 1 an integer. Its t-blow-up Gt = (V t , E t ) has vertices def V t = V × {1, . . . , t} and edges def E t = {(v, k), (v ′ , k ′ )} | {v, v ′ } ∈ E,
1 ≤ k, k ′ ≤ t .
(54)
Each vertex thus becomes a cluster of t clones, and each edge a complete bipartite graph between two clusters. If G is cubic, Gt is a simple 3t-regular graph with tJ vertices and t2 I edges (Fig. 3). Lemma 4. Let G be a simple graph and t ≥ 1. (a) A colouring σG of G induces the colouring σ of Gt which gives every clone (v, k) the colour σG (v), and cutGt (σ) = t2 cutG (σG ). (b) µ(Gt ) = t2 µ(G). 15
Proof. Part (a): every cut edge of G yields t2 cut edges of Gt , and no other edge is cut. Part (b): part (a) gives µ(Gt ) ≥ t2 µ(G). Conversely, let σ be any colouring of Gt , and let xv ∈ {0, . . . , t} be the number of clones of v coloured B. Then X cutGt (σ) = xv (t − xv′ ) + (t − xv )xv′ . (55) {v,v ′ }∈E
As G has no loops, this sum is affine in each xv when all other counts are fixed, and is thus maximised at xv = 0 or xv = t. Recolouring all clones of each vertex in turn with the better of the two colours therefore never decreases the cut, and ends in a colouring induced by some colouring σG of G. Hence cutGt (σ) ≤ t2 cutG (σG ) ≤ t2 µ(G). B.4
The Reduction
We reduce from the gap version of 3-MAX-CUT in Lemma 3, using the notation of §B.3: G = (V, E) is a simple cubic graph with J vertices and I = 23 J edges, and µ(G) is the size of its maximum cut. Given an instance (G, κ), our reduction proceeds in three stages: it blows up G, writes down a source string over a large alphabet, and encodes this string in binary. def
Stage 1: blowing up the graph. Fix the constant λ = ⌈40/ε0 ⌉, and let Gλ = (V λ , E λ ) be the λblow-up of G (Definition 3). It is a simple 3λ-regular graph with λJ vertices, and µ(Gλ ) = λ2 µ(G) by Lemma 4(b). This is the graph Gλ of Reduction 2, whose copy v j,n is the clone (v j , n). Stage 2: a source string.
An arc is an edge of Gλ with a direction; the set of arcs is Aλ = {(v, v ′ ) | {v, v ′ } ∈ E λ }, def
|Aλ | = 3λ2 J.
(56)
A walk is a string ω = vv ′ v ′′ of three vertices such that (v, v ′ ) and (v ′ , v ′′ ) are arcs, where v = v ′′ is def allowed; we call these two arcs the bigrams of ω. Let Ω = walk(Gλ ) be the set of walks. A walk is determined by its middle vertex and that vertex’s two neighbours in the walk, so def
M = |Ω| = λJ · (3λ)2 = 9λ3 J.
(57) def
We list the walks in an arbitrary order ω 1 , . . . , ω M and define the source string w = graph2str(Gλ ) as def
graph2str(Gλ ) = ω 1 ⋄χ1 ω 2 ⋄χ2 · · · ω M ⋄χM #,
(58)
in which every walk is followed by a separator ⋄χi , with χi ∈ {1, . . . , 9λ2 }, and which ends with an end symbol #. We choose the separators such that walks ending in the same vertex are followed by different separators, and walks starting with the same vertex are preceded by different separators.13 We write Γ for the set of symbols occurring in w: the λJ vertices, at most 9λ2 separators, and #. The source string has length |w| = 4M + 1, and Fig. 4 shows an example. The separators ensure that only walk bigrams repeat in w. Lemma 5 (Uniqueness). The source string w satisfies the following: (a) every bigram of w containing a separator or # occurs only once in w; (b) every substring of w of length at least 3 occurs only once in w; (c) any two adjacent vertices in w lie in the same walk, and thus form one of its bigrams. 13 Such separators exist and can be found in polynomial time. Consider the bipartite multigraph with one edge for each i ∈ {1, . . . , M }, joining the last vertex of ω i , as a left vertex, to the first vertex of ω i+1 , as a right vertex (or to a dummy right vertex, for i = M ). Every vertex ends exactly 9λ2 walks and starts exactly 9λ2 walks, so this multigraph has maximum degree 9λ2 . By Kőnig’s edge-colouring theorem, its edges can be properly coloured with 9λ2 colours, and such a colouring can be computed in polynomial time; we let χi be the colour of edge i.
16
a
c
b
(a) Arcs of the graph.
a
b
c
W
B
W
walk
after phase 1
aba abc cba cbc bab bcb
⟨ab, a⟩ ⟨ab, c⟩ ⟨cb, a⟩ ⟨cb, c⟩ ⟨b, ab⟩ ⟨b, cb⟩
a
(c) Merging a ⊚ b, c ⊚ b.
(b) A maximum cut.
c
b
(d) Not a cut.
Figure 4: The source string of Eq. (58), for the path a–b–c and λ = 1 (for illustration only, as this graph is not cubic). (a) The graph has four arcs and six walks, aba, abc, cba, cbc, bab, and bcb; with distinct separators, its source string is w = aba⋄1 abc⋄2 cba⋄3 cbc⋄4 bab⋄5 bcb⋄6 #, of length 4M + 1 = 25. (b) A maximum cut, with b coloured B and a, c coloured W . The two arcs from B to W are kept (solid); the other two arcs, (a, b) and (c, b), are merged (dashed) and form the covering set U ⋆ of Lemma 6. (c) Merging these two bigrams shortens every walk by one token (phase 1 of Lemma 7). The remaining 3M + 1 = 19 tokens are then joined by 18 merges (phase 2), so collapsing w takes ν = 2 + 18 = 20 merges, as given by Eq. (61). (d) Keeping arcs which enter and leave the same vertex (here, (a, b) and (b, c) at b) leaves a walk with no merged bigram (here, abc): the kept arcs of a covering set must form a cut. centre
⟨a⟩, length r
e b
e a
1 1 0y 1 · · · 0y L 0 1 1 0y 1 · · · 0y L 0 0 ⟨a⟩
⟨a⟩, length r
⟨a⟩
0
⟨b⟩
⟨b⟩
e a, length q = 2r + 1
⟨a⟩ ◦ 0 ◦ ⟨b⟩, length q
(a) A codeword.
(b) Two consecutive codewords.
0
Figure 5: The binary encoding of Eq. (59). (a) The pattern 11 starts each half-word, and the centre (shaded) starts the second one. (b) Between two consecutive centres (dots) lies ⟨a⟩ ◦ 0 ◦ ⟨b⟩, so a token containing both reveals both symbols (Lemma 10).
Proof. Part (c) holds since consecutive walks are separated by a separator. For part (a), note that separators are never adjacent to each other, and that # occurs only once. A bigram consisting of a vertex v followed by a separator ⋄χ marks the end of a walk which ends in v; by our choice of separators, no other walk ending in v is followed by ⋄χ , so this bigram occurs only once. The same holds, symmetrically, for a separator followed by a vertex. For part (b), it suffices to consider substrings of length exactly 3, as longer substrings contain one. A substring of length 3 containing a separator or # contains a bigram from part (a), and thus occurs only once. Otherwise, its three symbols are vertices, which by part (c) lie in the same walk; as walks have length 3, the substring is a walk, and walks are pairwise distinct. def
Stage 3: a binary encoding. Let L = ⌈log2 |Γ|⌉, and give every symbol a ∈ Γ a distinct identifier id(a) = y 1 · · · y L ∈ {0, 1}L . We encode a by its codeword bin(a), which we write e a for short; it consists of two copies of a half-word ⟨a⟩, followed by a 0: def
⟨a⟩ = 110y 1 0y 2 · · · 0y L 0,
def
e a = ⟨a⟩ ◦ ⟨a⟩ ◦ 0.
(59)
def
We encode a string c = a1 · · · am ∈ Γ+ codeword by codeword, as e c = ⃝m f m. i=1 bin(ai ) = ae1 ◦ · · · ◦ a def def Half-words have length r = 2L + 3, and codewords length q = 2r + 1. As in §3.2, the pattern 11 occurs in an encoded string exactly at the starts of half-words. We call the first character of the second half-word of a codeword its centre (Fig. 5). Centres play no role in the reduction itself, but are our main tool to analyse it in §B.7. Reduction 3 (Full version of Reduction 2). Given an instance (G, κ) of Lemma 3, construct the source def def e over the alphabet Σ = {0, 1}, together with the string w as above, and output the dataset D = {w} 17
budget def
K = H + 3M + |Aλ | − λ2 κ,
(60)
def
where H = |mprep | is the number of merges in the sequence mprep of Lemma 8, which builds the codewords. e K). Since κ ≤ I (Lemma 3), we have λ2 κ ≤ |Aλ |, and thus We write R↑ (G, κ) for the output (w, e = q(4M + 1) = O(J log J); all three K > 0. As λ is a constant, |Γ| = O(J), L = O(log J), and |w| stages run in polynomial time. B.5
The Gap
Both implications revolve around the collapse cost def
ν = 3M + |Aλ | − λ2 µ(G),
(61)
the number of merges needed to tokenise the source string w as a single token. Collapsing w naively takes |w| − 1 = 4M merges, each making a single replacement. Merging a walk bigram is cheaper, as one such merge shortens many walks at once; a maximum cut tells us which bigrams to merge, saving M − |Aλ | + λ2 µ(G) merges in total (Fig. 4). Conversely, no merge sequence does better, even over the binary alphabet: a merge sequence which is x merges short of ν leaves at least x + 1 tokens. The budget K pays for building the codewords, plus the collapse cost of a graph with maximum cut κ. In a YES instance, the collapse cost thus fits in the budget; in a NO instance, it exceeds the budget by at least ε0 λ2 J − H, which is more than ε20 λ2 J by our choice of λ. e K) = R↑ (G, κ), where G has J ≥ 9λ + 1 vertices. Proposition 1. Let (w, e as a (i) Forward implication. If µ(G) ≥ κ, then some merge sequence m with |m| ≤ K tokenises w single token. (ii) Backward implication. If some merge sequence m with |m| ≤ K leaves at most ε20 λ2 J tokens on e then µ(G) > κ − ε0 J. w, e is 1; and if µ(G) ≤ κ − ε0 J, every In particular, if µ(G) ≥ κ, the optimal compressed length of {w} e merge sequence with |m| ≤ K leaves more than ε20 λ2 J tokens on w. B.6
Proof of the Forward Implication
e into a single token. We proceed in three steps: we We now build a merge sequence which collapses w relate maximum cuts to sets of bigrams which shorten every walk (Lemma 6); we use such a set to collapse e (Lemmas 8 and 9). w with ν merges (Lemma 7); and we transfer this collapse to w We say that a set of arcs U ⊆ Aλ covers a walk if it contains one of the walk’s bigrams, and we write cov(U) for the number of walks covered by U. Merging the bigrams in U shortens each covered walk by one token (Lemma 7). Part (b) of the following lemma is only needed for the backward implication. Lemma 6 (Covering walks). (a) Every set of arcs U which covers all walks has |U| ≥ |Aλ | − λ2 µ(G), and some such set U ⋆ attains equality. (b) Every set of arcs U ⊆ Aλ satisfies cov(U) − |U| ≤ M − |Aλ | + λ2 µ(G). Proof. We prove the two parts separately. Part (a), lower bound. Let U cover all walks, and call the arcs not in U kept. No vertex v ′ has both a kept arc (v, v ′ ) entering it and a kept arc (v ′ , v ′′ ) leaving it, as the walk vv ′ v ′′ would then not be covered (Fig. 4d). Now colour every vertex with a kept arc leaving it B, and all other vertices W . Every kept arc (v, v ′ ) then crosses this cut from B to W : v is coloured B since (v, v ′ ) leaves it, and v ′ is coloured W since (v, v ′ ) enters it, so no kept arc leaves it. Moreover, two kept arcs never lie on the same edge, 18
as (v, v ′ ) and (v ′ , v) would both enter and leave v ′ . The kept arcs thus lie on distinct cut edges, and by Lemma 4, |Aλ | − |U | ≤ µ(Gλ ) = λ2 µ(G).
(62)
Part (a), equality. Take a colouring of Gλ with maximum cut, and let U ⋆ contain all arcs except those from a B vertex to a W vertex (Fig. 4b). Then |Aλ | − |U ⋆ | = µ(Gλ ) = λ2 µ(G). Moreover, U ⋆ covers every walk vv ′ v ′′ : otherwise, both (v, v ′ ) and (v ′ , v ′′ ) would go from a B vertex to a W vertex, and v ′ would be coloured both W and B. Part (b). Given U, add to it one bigram of each walk which it does not cover. The resulting set covers all walks and has at most |U| + M − cov(U ) arcs, so by part (a), |Aλ | − λ2 µ(G) ≤ |U| + M − cov(U).
(63)
Rearranging gives part (b). Lemma 7 (Collapsing the source string). There is a merge sequence msrc with |msrc | = ν which tokenises w as a single token. Proof. Let U ⋆ be the covering set of Lemma 6(a), with |U ⋆ | = |Aλ | − λ2 µ(G). We build msrc in two phases. Phase 1: merging bigrams (Fig. 4c). For every arc (v, v ′ ) ∈ U ⋆ , in arbitrary order, we merge v ⊚ v ′ . By Lemma 5(c), two adjacent vertices only occur inside walks, and since v ̸= v ′ , the occurrences of the pair never overlap. So a merge v ⊚ v ′ only changes the walks which have (v, v ′ ) as a bigram. Once one bigram of a walk is merged, the walk’s middle vertex lies inside a token of two symbols, and no later merge of this phase changes the walk. As U ⋆ covers all walks, every walk is shortened by exactly one token. This phase uses |U ⋆ | merges and leaves |w| − M = 3M + 1 tokens, the last of which is #. Phase 2: merging from the right. Let s1 , . . . , s3M +1 be the current tokens. For i = 3M , . . . , 1, in this order, we merge si ⊚ si+1 ◦ · · · ◦ s3M +1 . The right token of this merge contains # and thus occurs only once, so the merge combines si with the token to its right. After these 3M merges, a single token remains. In total, |msrc | = |U ⋆ | + 3M = ν. It remains to transfer this collapse to the binary string. We first build every codeword as a token, using few merges. Lemma 8 (Building the codewords). There is a merge sequence mprep with H = |mprep | < 10|Γ| which, for every string c = a1 · · · am ∈ Γ+ , gives tok↑ [mprep ](e c) = ⟨ae1 , . . . , af m ⟩.
(64)
Proof. The sequence mprep consists of three stages: (i) markers: merge 1 ⊚ 1; (ii) half-words: for k = 3, . . . , r, in this order: for every string s of length k − 1 and character c ∈ {0, 1} such that s ◦ c is a prefix of some half-word, merge s ⊚ c; (iii) codewords: for every a ∈ Γ, merge ⟨a⟩ ⊚ ⟨a⟩, and then ⟨a⟩ ◦ ⟨a⟩ ⊚ 0. Correctness. We follow an encoded string through the three stages. Stage (i): markers. In an encoded string, every pair of adjacent 1s starts a half-word, and is preceded by a 0 (or the string’s start) and followed by a 0. Stage (i) thus merges exactly the first two characters of every half-word. Stage (ii): half-words. We show, by induction on k, that after the iteration for k, the first k characters of every half-word form a single token, and all other characters are single-character tokens. For k = 2, this is the state after stage (i). Now let 3 ≤ k ≤ r, and assume the claim for k − 1. Then every token s with at least two characters is the prefix of length k − 1 of a half-word, at its start, and is followed by the 19
k-th character c of that half-word as a single-character token. The merge s ⊚ c thus applies exactly at the half-words starting with s ◦ c. Each half-word is therefore extended by exactly one merge of this iteration; the resulting token has length k, so no later merge of the iteration, whose left token has length k − 1, matches it. After iteration r, the encoded string is thus tokenised as ⟨⟨a1 ⟩, ⟨a1 ⟩, 0, ⟨a2 ⟩, ⟨a2 ⟩, 0, . . .⟩. Stage (iii): codewords. As distinct symbols have distinct half-words, each token ⟨a⟩ occurs in runs of exactly two. The merge ⟨a⟩ ⊚ ⟨a⟩ thus joins the two halves of every codeword of a, and the next merge appends the trailing 0. Size. Stages (i) and (ii) use one merge per distinct half-word prefix of length between 2 and r. For each j ∈ {1, . . . , L}, the prefixes ending with 0 just before bit y j number at most 2j−1 , and those ending with y j at most 2j ; there is one prefix of length 2, and at most |Γ| of length r. Stage (iii) uses 2|Γ| merges. As 2L < 2|Γ|, we get H ≤1+
L X
2j−1 + 2j + 3|Γ| = 3 · 2L − 2 + 3|Γ| < 10|Γ|.
(65)
j=1
Once every codeword is a token, the binary string behaves like the source string. For a merge sequence def ′ g e = ⟨se1 ⊚ se′1 , . . . , sg m over Γ with merges mk = sk ⊚ s′k , let m |m| ⊚ s|m| ⟩. Lemma 9 (Simulating merges). Let m be a merge sequence over Γ, and let c ∈ Γ+ . If tok↑ [m](c) = e to e ⟨s1 , . . . , sn ⟩, then applying mprep and then m c gives ⟨se1 , . . . , sen ⟩. Proof. Codewords have equal lengths, and distinct symbols have distinct codewords; so for strings s, s′ ∈ Γ+ , we have e s = se′ if and only if s = s′ . By Lemma 8, after mprep the binary tokenisation is the encoding, token by token, of the source string’s characters. Suppose that, before some merge s ⊚ s′ of m, the binary tokenisation ⟨se1 , . . . , sen ⟩ encodes the source tokenisation ⟨s1 , . . . , sn ⟩ token by token. Then the pair ⟨e s, se′ ⟩ occurs at index j of the binary tokenisation if and only if ⟨s, s′ ⟩ occurs at index j of the source tokenisation. Both left-to-right scans thus replace pairs at the same indices, and as sej ◦ sg ◦ sj+1 , the two tokenisations still correspond afterwards. Induction over the merges of m j+1 = sj^ proves the lemma. Proof of Proposition 1(i). Suppose µ(G) ≥ κ. Then, by Eqs. (60) and (61), ν = 3M + |Aλ | − λ2 µ(G) ≤ 3M + |Aλ | − λ2 κ = K − H.
(66)
By Lemma 7, the merge sequence msrc tokenises w as ⟨w⟩. By Lemma 9, applying mprep and then e as ⟨w⟩, e a single token, using H + ν ≤ K merges. m ] src tokenises w B.7
Proof of the Backward Implication
The forward implication used a merge sequence which respects codewords. The backward implication must handle any merge sequence over {0, 1}, which may split codewords, combine parts of different codewords, or never build a codeword at all. We show that any merge sequence m leaves at least e (Lemma 11). To this end, we track the centres. Every codeword contains exactly ν − |m| + 1 tokens on w one centre, so initially 4M + 1 tokens contain a centre, and reducing this number requires replacements which combine two tokens that both contain a centre. Such tokens are long enough to reveal which source symbols they cover (Lemma 10), so the merges creating them behave like merges on the source string. e contains at least Lemma 10 (Recognition). Let s ∈ {0, 1}+ be a string which, at some occurrence in w, two centres. Then: e its centres lie at the same positions within s; (a) at every occurrence of s in w, (b) at every occurrence, these centres belong to the codewords of the same substring of w, which we denote by src(s). 20
an occurrence of s e a e w:
e c···
e b
1 1 0 0 0 1 0 1 1 0 0 0 1 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 1 0 1 0 1 1 ··· r
phase: 0
r
r+1 r
r
0
r
r+1 0
r
Figure 6: Markers 11 (tinted) start every half-word, at phases 0 and r, and centres (shaded, with dots) lie at phase r; here r = 7 and q = 15. The gap to the next marker is r after a phase-0 marker and r + 1 after a phase-r one. The first two markers inside s are r + 1 apart, so the first of them is a centre (Lemma 10).
e and carries no information about where it Proof. A short binary string, such as 0110, occurs all over w sits. The lemma says that this changes once a string contains two centres: its content alone then tells us where it sits relative to the codewords, and which source symbols it covers. e from 0, and call p mod q the phase of To make “where it sits” precise, number the positions of w position p. Every codeword starts at phase 0, and its centre lies at phase r. We call each occurrence of 11 a marker; as noted in Stage 3, markers are exactly the starts of half-words, so they start at phases 0 and r. The difficulty is that these two kinds of markers look alike: a codeword and its second half both begin with the same half-word. What tells them apart is the distance to the next marker. After a marker of phase 0, the next one starts a half-word later, that is, r positions later. After a marker of phase r, the next one starts only after the half-word and the trailing 0, that is, r + 1 positions later (Fig. 6). Two consecutive markers thus reveal the phase of the first: it is 0 if they are r apart, and r if they are r + 1 apart. Part (a). It therefore suffices to show that every occurrence of s contains two complete consecutive markers. As s contains two centres, which are q positions apart, we have |s| ≥ q + 1. Let an occurrence of s start at position p. If a marker starts at p, the next one starts at most r + 1 positions later, and thus ends by position p + q. Otherwise, let m < p be the start of the last marker before p; the two markers following it both start after p, and since consecutive gaps sum to q, the second of them starts at m + q and ends by position p + q. Either way, the occurrence contains two complete consecutive markers. Since e is a marker, these are simply the first two occurrences of 11 in s; their distance depends on every 11 in w s alone, and fixes the phase of the first of them, and hence of every position in s. All occurrences of s thus start at the same phase, and their centres, the positions of phase r, lie at the same positions within s. Part (b). Knowing where the centres lie, we can now read off the symbols. Take two consecutive centres in an occurrence of s, belonging to the codewords e a and eb of two adjacent symbols ab of w. Between them, s contains ⟨a⟩ ◦ 0 ◦ ⟨b⟩, the second half-word of e a, its trailing 0, and the first half-word of eb (Fig. 5b), at positions fixed by part (a). As identifiers are distinct, these half-words determine a and b. This is why codewords repeat their half-word: with a single half-word, the string between two centres would reveal only the first of the two symbols. Applying this to every pair of consecutive centres, the content of s determines every symbol whose centre it contains. As consecutive centres belong to consecutive codewords, these symbols form a substring of w, the same at every occurrence. To count how often tokens containing centres are combined, we record the entire run of a merge sequence as a forest. Definition 4 (Merge forest). Let m be a merge sequence, whose merges may be arbitrary pairs of strings, e Its merge forest records every replacement as a node whose two children are the nodes and apply it to w. (or characters) of the two tokens it combines. A node is created by step k if the replacement is made by the merge mk , and it is a join if both of its children contain a centre. e and its roots are the tokens of tok↑ [m](w) e The leaves of the merge forest are the characters of w, (Fig. 7). Every node spans an interval of positions, which spells out its token; the intervals of two nodes are either nested or disjoint, and distinct nodes span distinct intervals. Lemma 11 (Centre bound). Let m be any merge sequence, and let Z be the number of tokens of 21
join
ae1
not a join
ae2
ae3
ae4
Figure 7: A merge forest on the encoding of a source string a1 a2 a3 a4 , with codewords drawn schematically as five characters each and centres in black. Shaded triangles abbreviate subtrees which build a whole codeword; they contain no join, as every codeword contains a single centre. The forest has one join (highlighted), which combines two tokens that each contain a centre. The other two roots have only one child containing a centre each; in particular, the middle root spans codeword ae3 together with the first two characters of ae4 , ignoring codeword boundaries. The forest has Z = 3 roots containing a centre and 4 − 3 = 1 join, as in the first step of the proof of Lemma 11.
e which contain a centre. Then tok↑ [m](w) Z ≥ ν − |m| + 1.
(67)
Proof. We proceed in five steps: 1 we count the joins in the merge forest; 2 we show that each merge step creates either only joins or none; 3 we show that most such joining steps create a single node; 4 we bound the joins created by the remaining steps, which merge walk bigrams; 5 we combine these bounds. Step 1 . The merge forest contains exactly 4M + 1 − Z joins. Proof. Track the number of current tokens which contain a centre. Initially, it is 4M + 1, as each centre is a single character. A join decreases this number by one, and any other replacement leaves it unchanged. At the end, it equals Z. Step 2 . If step k creates a join, then every node created by step k is a join. Proof. Let mk = s ⊚ s′ . Every node created by step k spans an occurrence of s ◦ s′ , with its left child spanning the first |s| characters. If one of these nodes is a join, then s ◦ s′ contains two centres at that occurrence; by Lemma 10(a), it then contains its centres at the same positions at every occurrence. So, at every node created by step k, both children contain a centre. def
We call a step joining if it creates a join. For a joining step with mk = s ⊚ s′ , we write src(k) = src(s ◦ s′ ) for the substring of w it covers (Lemma 10(b)). We call it a bigram step if src(k) consists of exactly two vertices; by Lemma 5(c), src(k) is then an arc. Step 3 . Every joining step which is not a bigram step creates exactly one node.
Proof. For such a step, src(k) either has length at least 3, or is a bigram containing a separator or #. By Lemma 5(a)–(b), it thus occurs at a single position of w. By Lemma 10, every occurrence of s ◦ s′ covers the centres of exactly these symbols, at fixed positions within s ◦ s′ ; all its occurrences therefore start at the same position. As distinct nodes span distinct intervals, step k creates only one node. Step 4 . Let U ⊆ Aλ be the set of arcs src(k) of all bigram steps k. Then bigram steps create at most cov(U) nodes in total. Proof. Identify every centre with the position of its symbol in w. A node created by a bigram step contains exactly two centres, at adjacent positions i and i + 1, whose symbols form an arc in U. By Lemma 5(c), both positions lie in the same walk, which U thus covers; we assign the node to this walk. It suffices to show that every walk is assigned at most one node. If a walk occupies positions j, j + 1 and j + 2, the nodes assigned to it have centres {j, j + 1} or {j + 1, j + 2}. Two joins with the same two centres coincide, as each separates these centres between its two children, and is thus their lowest 22
common ancestor. And a node with centres {j, j + 1} and one with centres {j + 1, j + 2} cannot both exist: both contain centre j + 1, so their intervals would be nested, and so would their sets of centres. Step 5 . Z ≥ ν − |m| + 1. Proof. There are at least |U| bigram steps, so at most |m| − |U| other joining steps. By Steps 2 to 4 , the merge forest thus contains at most cov(U) + |m| − |U | joins. With Step 1 and Lemma 6(b), we get 4M + 1 − Z ≤ cov(U) − |U| + |m| ≤ M − |Aλ | + λ2 µ(G) + |m|.
(68)
Rearranging gives Z ≥ 3M + |Aλ | − λ2 µ(G) − |m| + 1 = ν − |m| + 1. Step 5 concludes the proof. Proof of Proposition 1(ii). We first bound the cost of building the codewords. The alphabet Γ has at most λJ + 9λ2 + 1 ≤ 2λJ symbols, as J ≥ 9λ + 1. By Lemma 8 and λ ≥ 40/ε0 , we thus have H < 10|Γ| ≤ 20λJ ≤
ε0 2 λ J. 2
(69)
Now let m be a merge sequence with |m| ≤ K which leaves at most ε20 λ2 J tokens. As Z counts only some of the remaining tokens, Lemma 11 gives ν−K +1≤Z ≤
ε0 2 λ J. 2
(70)
Substituting ν and K from Eqs. (60) and (61), the terms 3M + |Aλ | cancel, and with Eq. (69): ε0 λ2 κ − µ(G) ≤ λ2 J + H − 1 < ε0 λ2 J. 2
(71)
Dividing by λ2 gives µ(G) > κ − ε0 J.
C
Unary Direct Tokenisation is APX -hard
Kastreva et al. (2026) showed that unary direct tokenisation is strongly NP-complete; this appendix shows that it is also APX-hard (Theorem 5), by an AP-reduction from 3-MAX-CUT. As in their work, we identify a unary string aℓ with its length ℓ ∈ N, a dataset with a multiset of lengths, and a vocabulary with the set of its token lengths; the alphabet symbol is then the length-1 token, which every vocabulary contains. We write D-1-TOK for unary direct tokenisation under the compression objective Gcomp , viewed as an optimisation problem: given a dataset and a budget K, find a vocabulary that minimises the compressed length. §C.1 recalls AP-reductions, and §C.2 constructs the reduction. §C.3 states its two key properties: every cut-compliant vocabulary achieves compressed length ∆ minus the cut it encodes (Lemma 12), and every vocabulary decodes into a cut that does no worse (Lemma 13). Taking these as given, §C.6 proves Theorem 5. The remaining subsections prove the two lemmas, using the label arithmetic of §C.7 and the rounding argument of §C.8. C.1
AP-Reductions
For an instance I of an optimisation problem and a feasible solution s with objective value G(s), let the performance ratio be G(s) OPT(I) def R(I, s) = max , ≥ 1, (72) OPT(I) G(s) which covers both minimisation and maximisation problems. Definition 5. Let A and B be optimisation problems. We say that A AP-reduces to B (denoted A ≤AP B) if there exist functions f and g and a constant α ≥ 1 such that, for every instance IA of A and every rational r > 1: 23
(i) IB = f (IA , r) is an instance of B, computable in time polynomial in |IA | for every fixed r; (ii) for every feasible solution sB of IB , g(IA , sB , r) is a feasible solution of IA , computable in time polynomial in |IA | and |sB | for every fixed r; (iii) the approximation quality is preserved up to α: RB (IB , sB ) ≤ r =⇒ RA IA , g(IA , sB , r) ≤ 1 + α(r − 1).
(73)
AP-reductions compose, map polynomial-time approximation schemes for B to ones for A, and thus preserve APX-hardness: if A is APX-hard and A ≤AP B, then B is APX-hard (Crescenzi, 1997; Ausiello et al., 2012). The reduction we give below does not depend on r. C.2
The Reduction
Our reduction first blows up G with J clones per vertex: we write GJ = (V J , E J ) for its J-blow-up (Definition 3), so each vertex becomes a cluster of J clones and each edge a complete bipartite graph between two clusters. If G is cubic, GJ is simple, has J 2 vertices and IJ 2 edges, each of its vertices has degree 3J, and colourings induced from G cut J 2 times as many edges (Lemma 4(a)). Reduction 4. Consider an instance G = (V, E) of the 3-MAX-CUT optimisation problem. Index the vertices of GJ as V J = {1, . . . , J 2 }. Now, define the label base, the two markers, and a label for each vertex: def
def
β = 8J 8 + 1,
def
B = β 10 ,
W = β 15 ,
4 def X enc v i = ik β k .
(74)
k=1
From these, we define the string-lengths, for i ∈ V J , θ ∈ {B, W }, and {i, j} ∈ E J : def ℓi = enc v i , def ℓ′i = enc v i + B + W ,
def ℓθi = enc v i + θ, def ℓ′′i,j = enc v i + enc v j + B + W .
(75) (76)
We build five subdatasets from these values: D1 = {B, W } × f J 2 D2 = {ℓi | i ∈ V J } × f
′
W ′′ D3 = {ℓB i , ℓi | i ∈ V J } × f D4 = {ℓ′i | i ∈ V J } × 1 D5 = {ℓ′′i,j | {i, j} ∈ E J } × 1 def
def
marker-strings
(77a)
vertex-strings
(77b)
colour-strings
(77c)
bridge-strings
(77d)
edge-strings
(77e)
def
with multiplicities f = 20J, f ′ = 17J, and f ′′ = 15J. A full dataset is then formed by joining these subdatasets: D = D1 ∪ · · · ∪ D5 . Finally, we set the number of allowed tokens to K = 2J 2 + 2, and define the base cost ∆ = (2f + f ′ + 3f ′′ + 2)J 2 + 3IJ 2 = def
213 3 J + 2J 2 . 2
(78)
3 2 We write R (G) for the D-1-TOK instance (D, K) output by this reduction. It contains 177 2 J +J 120 strings, each shorter than 2W = O(J ), so it can be written down explicitly in unary in polynomial time. Following Kastreva et al. (2026), we split the intended tokens into structural tokens S base , which every good vocabulary should contain, and choice tokens S choice , from which it should pick one per vertex: def
S base = {B, W } ∪ {ℓi | i ∈ V J }, 24
def
W S choice = {ℓB i , ℓi | i ∈ V J }.
(79)
def
We call the members of S compl = Σ ∪ S base ∪ S choice compliant tokens, and all other tokens noncompliant. We further call a vocabulary cut-compliant if it contains Σ ∪ S base and exactly one of ℓB i or W ℓi for each i ∈ V J . Cut-compliant vocabularies are in one-to-one correspondence with colourings of GJ : colouring σ corresponds to σ(i)
def
S σ = Σ ∪ S base ∪ {ℓi
| i ∈ V J },
(80)
which has exactly |Σ| + K = 2J 2 + 3 tokens. Under S σ , an edge-string ℓ′′i,j is compressed to two symbols, W W B ⟨ℓB i , ℓj ⟩ or ⟨ℓi , ℓj ⟩, if σ(i) ̸= σ(j), and to three symbols otherwise. Why the blow-up? We aim to show that no vocabulary beats all cut-compliant ones; the danger is non-compliant tokens, which may each serve many edge-strings at once. Our p labels bound the savings of a set S nc of non-compliant tokens by a degree term, 3J|S nc | in GJ , and a term |S nc ||S nc | (SubLemma 4). Without the blow-up, the degree of each vertex is a constant 3 while |S nc | can grow with the graph, so no constant multiplicities pay for non-compliant tokens; yet non-constant multiplicities destroy the constant ratio p between √ the tokenisation and the cut objectives. With J clones per vertex, both the degree 3J and |S nc | ≤ 2J are O(J), so multiplicities linear in J suffice. Both the full objective ∆ and the amplified cut J 2 µ(G) are then Θ(J 3 ), which preserves a constant approximation gap. C.3
Unary Direct Tokenisation is Hard to Approximate
Reduction 4 is not an L-reduction: the optimum of R (G) is Θ(J 2 ) times larger than µ(G), so it cannot be an L-reduction with constant parameters. Its two L-reduction constants are, however, O(J 2 ) and J −2 , with constant product. This is exactly the situation handled by AP-reductions (Crescenzi, 1997; see Definition 5 in §C.1), which also preserve APX-hardness. Theorem 5. Unary direct tokenisation under the compression objective is APX-hard. In particular, unless P = NP, it admits no polynomial-time approximation scheme. Proof sketch. This proof is done in three steps. Forward step (cut-compliant vocabularies encode cuts). See a formal proof in Lemma 12 in §C.4. Under the cut-compliant vocabulary S σ , every marker- and vertex-string is a single token, the two colourstrings of vertex i cost 1 + 2 symbols, and its bridge-string costs 2. An edge-string costs 2 symbols if its endpoints have different colours and 3 otherwise. Hence Gcomp (tok [S σ ], D) = ∆ − cutGJ (σ). Colourings induced from G cut J 2 times as many edges, giving G⋆comp (D) ≤ ∆ − J 2 µ(G). Backward step (every vocabulary decodes to a cut). See a formal proof in Lemma 13 in §C.5. Given any vocabulary S, we compute in polynomial time a colouring of G with cut size C such that Gcomp (tok [S], D) ≥ ∆ − J 2 C. If a marker is missing, D1 alone pushes the cost above ∆. Otherwise, we count whole-string savings on each subdataset, bound the edge-strings compressed by non-compliant tokens with our label arithmetic, and round the colour tokens in S to a single colouring of G. Each noncompliant token costs a vocabulary slot, which is charged f ′′ + J = 16J symbols, while all non-compliant tokens together save at most 12J + 3 symbols per token. Approximation accounting. See a formal proof in Lemma 14 in §C.6. The two steps together give ⋆ Gcomp (D) = ∆ − J 2 µ(G) ≤ 106J 2 µ(G) and J 2 (µ(G) − C) ≤ Gcomp (tok [S], D) − G⋆comp (D). A tokeniser within ratio 1 + ε of optimal thus decodes to a cut within ratio roughly 1 + 106ε, which yields an AP-reduction with constant α = 212. Since 3-MAX-CUT is APX-hard (Alimonti and Kann, 2000), so is D-1-TOK. C.4
Proof of Forward Step of Theorem 5
Lemma 12. Let (D, K) = R (G). For every colouring σ of GJ , the cut-compliant vocabulary S σ satisfies Gcomp (tok [S σ ], D) = ∆ − cutGJ (σ). Consequently, G⋆comp (D) ≤ ∆ − J 2 µ(G). 25
(81)
Proof. Note that |S σ | = |Σ| + K, as required. We write θ for the marker other than θ. By SubLemma 3(a), a string is compressed to one symbol if and only if its length is in S σ . Under this tokeniser, we have: tok [S σ ](D1 ) = ⟨B⟩, ⟨W ⟩ (length 1) × f J 2 (82a) ′ tok [S σ ](D2 ) = ⟨ℓi ⟩ (length 1) | i ∈ V J × f (82b) σ(i) (82c) tok [S σ ](D3 ) = ⟨ℓi ⟩ (length 1), ⟨ℓi , σ(i)⟩ (length 2) | i ∈ V J × f ′′ σ(i) tok [S σ ](D4 ) = ⟨ℓi , σ(i)⟩ (length 2) | i ∈ V J × 1 (82d) ( σ(i) σ(j) ⟨ℓi , ℓj ⟩ (length 2) if σ(i) ̸= σ(j) tok [S σ ](ℓ′′i,j ) = for {i, j} ∈ E J (82e) σ(i) ⟨ℓi , ℓj , σ(i)⟩ (length 3) else The strings of length 2 cannot be compressed to one symbol, as their lengths are not in S σ . An uncut W edge-string cannot be compressed to two symbols: by SubLemma 3(b), this would require ℓB i , ℓj ∈ S σ B or ℓW i , ℓj ∈ S σ , i.e., σ(i) ̸= σ(j). Summing these compressed lengths, we get Gcomp (tok [S σ ], D) = (2f + f ′ + 3f ′′ + 2)J 2 + 3IJ 2 − cutGJ (σ) = ∆ − cutGJ (σ).
(83)
Finally, let σG be a maximum cut of G and σ the colouring of GJ it induces. Then cutGJ (σ) = J 2 µ(G), which proves the bound on the optimum. C.5
Proof of Backward Step of Theorem 5
Before starting our lemma’s proof, we define a few notions for an arbitrary feasible vocabulary S, with def Σ ⊆ S and |S| ≤ |Σ|+K = 2J 2 +3. As in the proofs of Kastreva et al. (2026), we write S nc = S \S compl def for its non-compliant tokens and S missing = S base \ S for its missing structural tokens. Further, each def vertex i ∈PV J gets the palette Πi = {θ ∈ {B, W } | ℓθi ∈ S} of colours whose colour-string is a token; note that i |Πi | = |S ∩ S choice |. Let g count the edges of GJ whose palettes permit unequal colours, as in SubLemma 5. We define the decoder dec(S) as follows: if B ∈ / S or W ∈ / S, it returns a locally maximal colouring of G (Fact 1); otherwise, it returns the colouring of SubLemma 5 applied to the palettes Πi . Both branches run in deterministic polynomial time. Lemma 13. Let (D, K) = R (G), let S be any feasible vocabulary, and let C = cutG (dec(S)). Then Gcomp (tok [S], D) ≥ ∆ − J 2 C.
(84)
Proof. We proceed in five steps: 1 we show that a vocabulary missing a marker costs more than ∆; 2 we relate non-compliant tokens to missing compliant tokens via the vocabulary budget; 3 we lower-bound the compressed length of D1 to D4 by counting whole-string tokens; 4 we lower-bound the compressed length of D5 by bounding the edge-strings compressed to one or two symbols; 5 we combine these bounds with SubLemma 5. / S or W ∈ / S, then Gcomp (tok [S], D) > ∆. Step 1 . If B ∈ Proof. Each of the f J 2 copies of the missing marker costs at least two symbols, and every other string costs at least one. With f − f ′′ − 1 = 5J − 1 and 2I = 3J: Gcomp (tok [S], D) ≥ (3f + f ′ + 2f ′′ + 1)J 2 + IJ 2 ′′
2
= ∆ + (f − f − 1)J − 2IJ
2
2
= ∆ + (2J − 1)J > ∆.
(85a) (85b) (85c)
As C ≥ 0, Eq. (84) holds in this case. From now on, we assume B, W ∈ S, so S missing contains only vertex-strings. Step 2 . The vocabulary budget implies J 2 − |S ∩ S choice | ≥ |S nc | − |S missing | 26
and
|S nc | ≤ 2J 2 .
(86)
Proof. The vocabulary partitions into Σ, the 2 + J 2 − |S missing | structural tokens it contains, S ∩ S choice , and S nc . Its size is at most 2J 2 + 3, so 3 + J 2 − |S missing | + |S ∩ S choice | + |S nc | ≤ 2J 2 + 3.
(87)
Rearranging gives the first claim; the second follows from |S missing | ≤ J 2 . Step 3 . The compressed lengths of the first four subdatasets satisfy: Gcomp (tok [S], D1 ) = 2f J 2 , ′
(88a)
2
Gcomp (tok [S], D2 ) ≥ f J + |S missing | , Gcomp (tok [S], D3 ) ≥ f
′′
2
4J − |S ∩ S choice | ,
Gcomp (tok [S], D4 ) ≥ 2J 2 − |S nc |.
(88b) (88c) (88d)
Proof. A string costs one symbol if its length is in S, and at least two otherwise. Both markers are tokens. Exactly |S missing | vertex-strings and 2J 2 − |S ∩ S choice | colour-strings are not tokens, each repeated f ′ and f ′′ times, respectively; this gives the bounds on D2 and D3 . Finally, bridge-strings are not compliant (SubLemma 3(a)), so at most |S nc | of them are tokens. Step 4 . The compressed length of the edge-strings satisfies Gcomp (tok [S], D5 ) ≥ 3IJ 2 − g − (12J + 2)|S nc |.
(89)
Proof. Let E J 1 and E J 2 be the sets of edges whose strings are compressed to one and two symbols, respectively; all other edge-strings cost at least three. Hence Gcomp (tok [S], D5 ) ≥ 3IJ 2 −2|E J 1 |−|E J 2 |. An edge in E J 1 has ℓ′′e ∈ S, and since ℓ′′e is not compliant, ℓ′′e ∈ S nc ; so |E J 1 | ≤ |S nc |. An edge in E J 2 has ℓ′′e = p + p′ for two tokens p, p′ ∈ S, and we distinguish three cases: W W B • Both compliant. By SubLemma 3(b), {p, p′ } is {ℓB i , ℓj } or {ℓi , ℓj }, so the vocabulary contains colour tokens for the two endpoints with opposite colours. There are at most g such edges.
• One compliant, one non-compliant. By SubLemma 3(c), each non-compliant token serves at most 3J edges this way, for at most 3J|S nc | edges. • Both non-compliant. Then ℓ′′e ∈ S nc + S nc . By SubLemma 4 with Q = p S nc , there are at most p 2 (6J + |S nc | + 1)|S nc | such edges. As |S nc | ≤ 2J (Step 2 ), we have |S nc | ≤ 2J, and this is at most 9J|S nc |. Thus |E J 2 | ≤ g + 12J|S nc |, and Eq. (89) follows. Step 5 . If B, W ∈ S, then Eq. (84) holds. Proof. Summing Steps 3 and 4 , and subtracting ∆ from Eq. (78), we get Gcomp (tok [S], D) − ∆ ≥ f ′ |S missing | + f ′′ J 2 − |S ∩ S choice | − g − (12J + 3)|S nc |.
(90a)
By SubLemma 5, C = cutG (dec(S)) satisfies −g ≥ −J 2 C + J(J 2 − |S ∩ S choice |). Then, as f ′′ + J = 16J > 0, Eq. (86) gives: Gcomp (tok [S], D) − ∆ + J 2 C ≥ f ′ |S missing | + (f ′′ + J) J 2 − |S ∩ S choice | − (12J + 3)|S nc |
(91) ≥ 17J|S missing | + 16J |S nc | − |S missing | − (12J + 3)|S nc | (92) = J|S missing | + (4J − 3)|S nc | ≥ 0.
(93)
In words: after rounding, each non-compliant token occupies a slot charged 16J symbols, while all non-compliant tokens together save at most 12J + 3 symbols per token on edge- and bridge-strings. 27
Steps 1 and 5 cover both cases, which concludes the proof. Corollary 1. For (D, K) = R (G), we have G⋆comp (D) = ∆ − J 2 µ(G), and every feasible S satisfies J 2 µ(G) − cutG (dec(S)) ≤ Gcomp (tok [S], D) − G⋆comp (D). (94) Proof. Lemma 13 and cutG (dec(S)) ≤ µ(G) give G⋆comp (D) ≥ ∆ − J 2 µ(G); Lemma 12 gives the reverse inequality. Substituting the optimum into Eq. (84) gives Eq. (94). C.6
Proof of Theorem 5 (Unary Direct Tokenisation is APX-hard)
Lemma 14. 3-MAX-CUT AP-reduces to D-1-TOK with constant α = 212. def
Proof. We define fD-1-TOK (G, r) = R (G), ignoring r; it outputs O(J 3 ) unary strings of length O(J 120 ), so it is computable in polynomial time. We define gD-1-TOK (G, S, r) as whichever of the two colourings dec(S) and σ loc cuts more edges of G (either, in case of a tie), where σ loc is the locally maximal colouring returned by the local search of Fact 1; both are computable in polynomial time. Let C be the cut size of this output. It remains to show condition (iii) of Definition 5. Recall that J ≥ 4 and, by Eq. (51), µ(G) ≥ J. Then, by corollary 1 and Eq. (78): G⋆comp (D) ≤ ∆ − J 3 =
211 3 J + 2J 2 ≤ 106J 3 ≤ 106J 2 µ(G), 2
(95)
where the second inequality uses J ≥ 4. Now let S achieve ratio at most r = 1 + ε, i.e., Gcomp (tok [S], D) − G⋆comp (D) ≤ εG⋆comp (D). Combining Eqs. (94) and (95) and dividing by J 2 : µ(G) − C ≤ µ(G) − cutG (dec(S)) ≤ 106εµ(G).
(96)
1 µ(G) ≤ ≤ 1 + 212ε, C 1 − 106ε
(97)
If ε ≤ 1/212, then
where the last inequality is equivalent to 106ε(1 − 212ε) ≥ 0. If ε > 1/212, the locally maximal colouring gives C ≥ J ≥ 23 µ(G), as µ(G) ≤ I = 32 J; so µ(G)/C ≤ 3/2 < 1 + 212ε. In both cases, R(G, gD-1-TOK (G, S, r)) ≤ 1 + 212(r − 1). Proof of Theorem 5. 3-MAX-CUT is APX-hard (Alimonti and Kann, 2000), and Lemma 14 gives an APreduction from it to D-1-TOK; hence D-1-TOK is APX-hard. Explicitly, a polynomial-time approximation scheme for D-1-TOK, run with ε = η/106, would yield a cut of size at least (1 − η)µ(G) for every fixed η > 0, contradicting the hardness of 3-MAX-CUT unless P = NP. C.7
Arithmetic of Reduction 4
We now show the technical sublemmas used throughout our proof. ′ SubLemma 1 (Label four indices in V J each. If Let J and ′J be multisets of at most P P uniqueness). 5 for every i ∈ V . enc v = enc v , then J = J . Moreover, enc v < β i i i J i∈J i∈J ′ P4 Proof. Let a number (d4 , d3 , d2 , d1 , d0 )β denote k=0 dk β k . We have enc v i = (i4 , i3 , i2 , i, 0)β , and in a sum of at most four labels each digit is at most 4J 8 < β. No carries thus occur, and the equality of the two sums implies equality of each digit: X X ik = ik for k ∈ {1, 2, 3, 4}. (98) i∈J
i∈J ′
Pad both multisets with zeros to size four; this does not change the power sums above. By Newton’s identities, the first four power sums of four numbers determine their elementary symmetric polynomials, and hence the monic polynomial whose roots they are. The padded multisets are therefore equal, and removing the zeros gives J = J ′ . Finally, ik ≤ J 8 < β/8 for 1 ≤ k ≤ 4, so enc v i < β 2 3 4 5 8 (β + β + β + β ) < β . 28
Every length in Reduction 4 is an integer combination of the unit 1, the two markers, and the labels. For P def such a combination x = c1 + cB B + cW W + i∈V J ci enc v i , we call c(x) = c1 , cB , cW , (ci )i∈V J − its formal coefficients. For an integer vector d = (di )i∈V J , we write d+ i = max(di , 0) and di = + − + − max(−di , 0), so that di = di − di and di di = 0. def
def
SubLemma 2 (Coefficient matching). Let α1 , αB , αW ∈ Z and d ∈ ZV J satisfy X X |α1 |, |αB |, |αW | ≤ 2, d+ d− i ≤ 4, i ≤ 4.
(99)
i∈V J
i∈V J
If α1 + αB B + αW W +
X
di enc v i = 0,
(100)
i∈V J
then α1 = αB = αW = 0 and d = 0. Proof. We use one elementary fact three times: for integers a and R and a positive integer Y , aY + R = 0
and
|R| < Y =⇒ a = R = 0, def
since a ̸= 0 would give |aY | ≥ Y > |R| = |aY |. Write the vertex part as V = where X X def def P = d+ M = d− i enc v i , i enc v i . i∈V J
(101) P
i di enc v i
= P − M,
(102)
i∈V J
Each of P and M is a sum of at most four labels by Eq. (99), and every label satisfies 0 < enc v i < β 5 (SubLemma 1). Hence 0 ≤ P, M < 4β 5 , and |V | < 4β 5 .
(103)
We also use β = 8J 8 + 1 ≥ 9. Step 1 . αW = 0. def
Proof. Rewrite Eq. (100) as αW W + RW = 0 with RW = α1 + αB B + V . By Eqs. (99) and (103), |RW | ≤ |α1 | + |αB |B + |V | < 2 + 2β 10 + 4β 5 ≤ 3β 10 < β 15 = W .
(104)
By Eq. (101) with Y = W , we get αW = 0. Step 2 . αB = 0. def
Proof. With αW = 0, Eq. (100) reads αB B + RB = 0 with RB = α1 + V , and |RB | ≤ |α1 | + |V | < 2 + 4β 5 < β 10 = B.
(105)
By Eq. (101) with Y = B, we get αB = 0. Step 3 . α1 = 0 and V = 0. P def Proof. Every label is a multiple of β: enc v i = β 4k=1 ik β k−1 . Hence V = βV ′ with V ′ = P P4 k k−1 ∈ Z, and Eq. (100) reads V ′ β + α = 0. As |α | ≤ 2 < β, Eq. (101) with Y = β 1 1 i di k=1 i β ′ gives V = 0 and α1 = 0, so V = 0. Step 4 . d = 0. 29
Proof. From V = 0 we get P = M , i.e., X
X d+ enc v = d− i i i enc v i .
i∈V J
i∈V J
(106)
− Let J + and J − be the multisets containing each index i with multiplicity d+ i and di , respectively; both + − − + − have size at most four. By SubLemma 1, J = J , so di = di for every i. Since d+ i di = 0, both are zero, and hence di = 0 for every i.
Steps 1 to 4 prove the sublemma. We now check that SubLemma 2 applies to every comparison we need. Tab. 1 lists the formal coefficients of all lengths in D ∪ S compl , where ei denotes the i-th unit vector. Length x
c1
cB
cW
(ci )i∈V J
1 B W ℓi ℓB i ℓW i ℓ′i ℓ′′i,j
1 0 0 0 0 0 0 0
0 1 0 0 1 0 1 1
0 0 1 0 0 1 1 1
0 0 0 ei ei ei ei ei + ej
Table 1: Formal coefficients of the lengths in Reduction 4.
P Every entry of the table has c1 , cB , cW ∈ {0, 1} and a non-negative label vector with i ci ≤ 2. We consider three kinds of equalities, and in each case let (α1 , αB , αW , d) be the difference of the formal coefficients of the two sides: (i) x = P y for x, y ∈ D ∪ S compl . Each coefficient of the difference lies in {−1, 0, 1}, and and i d− i ≤ 2.
+ i di ≤ 2
P
(ii) ℓ′′e = p + p′ for p, p′ ∈ S compl . Here α1 ∈ {−2, −1, 0} and αB ,P αW ∈ {−1, 0, 1}; P the− positive label part comes from ℓ′′e alone and the negative one from p + p′ , so i d+ ≤ 2 and i di ≤ 2. i (iii) ℓ′′e − p = ℓ′′f − p′ for p, p′ ∈ S compl , i.e., ℓ′′e + p′ = ℓ′′f + p. Each side has unit coefficient in {0, 1}, P + marker coefficients in {1, 2}, and label mass at most 3; hence α , α , α ∈ {−1, 0, 1}, 1 B W i di ≤ 3, P − and i di ≤ 3. In all three cases Eq. (99) holds, so SubLemma 2 gives c(left-hand side) = c(right-hand side). In words, a numerical equality of any of these three kinds holds only if the two sides agree as formal expressions, and we may compare them coefficient by coefficient. SubLemma 3 (Compliant-token structure). The following hold for the instance output by Reduction 4: (a) The distinct strings in D have distinct lengths, the 3 + 3J 2 compliant tokens are distinct, and ℓ′i ∈ / S compl and ℓ′′e ∈ / S compl for all i and e. W (b) For e = {i, j} ∈ E J , the only ways to write ℓ′′e = p + p′ with p, p′ ∈ S compl are, up to order, ℓB i + ℓj W B and ℓi + ℓj .
(c) For every q ∈ N \ S compl , at most 3J edges e ∈ E J satisfy ℓ′′e − q ∈ S compl . 30
Proof. By SubLemma 2, all comparisons below can be made formally. Part (a). Each string-length has a distinct formal pattern: its marker coefficients identify the family, and its label coefficients identify the index or the edge. Bridge- and edge-strings contain both markers, which no compliant token does. Part (b). The formal expression ℓ′′e has marker coefficients (1, 1), unit coefficient 0, and label coefficients 1 at exactly i and j. A sum of two compliant tokens matches the marker coefficients only if it takes one B and one W , either from {B, W } themselves or from colour-strings; it matches the unit coefficient only if it avoids 1; and it matches the label coefficients only if it contributes exactly one label at i and one at j. This leaves only the two decompositions in the statement. Part (c). Fix a non-compliant token q ∈ / S compl . We bound the number of edges e ∈ E J for which ℓ′′e − q ∈ S compl .
(107)
Equivalently, suppose that for some edge e = {i, j} there exists a compliant token p ∈ S compl such that q = ℓ′′e − p.
(108)
We classify the possibilities according to the form of p. (α) Suppose p ∈ {1, B, W }. None of these tokens contains a vertex label, whereas ℓ′′e contains exactly the two labels enc v i and enc v j . Hence the label coefficients of q are +1 exactly at i and j. In particular, the positive label coefficients of q uniquely determine the edge e = {i, j}. (β) Suppose W p ∈ {ℓk , ℓB k , ℓk }
for some k ∈ / {i, j}. (109) The token p contributes one copy of the label enc v k , so the label coefficients of q = ℓ′′e − p are +1 at i and j, −1 at k, and zero elsewhere. Again, the two positive label coefficients uniquely identify the endpoints of e. (γ) It remains to consider the case where p is associated with an endpoint of e. Without loss of generality, let W p ∈ {ℓi , ℓB i , ℓi }.
(110)
ℓ′′e = enc v i + enc v j + B + W ,
(111)
Since
the three possible choices of p give ℓ′′e − ℓi = enc v j + B + W = ℓ′j , W ℓ′′e − ℓB i = enc v j + W = ℓj , B ℓ′′e − ℓW i = enc v j + B = ℓj .
(112) (113) (114)
The latter two values belong to S compl , whereas q ∈ / S compl by assumption. They are therefore impossible, and necessarily q = ℓ′j .
(115)
Thus the fixed token q determines one endpoint j of e, but it does not determine the other endpoint. Consequently, every edge that yields this same q must be incident to j. Since every vertex of GJ has degree 3J, at most 3J edges can arise in this case. 31
It remains to verify that the same numerical value of q cannot arise from different cases in a way that evades these bounds. Suppose q = ℓ′′e − p = ℓ′′f − p′
(116)
for edges e, f ∈ E J and compliant tokens p, p′ ∈ S compl . By comparison (iii) above and SubLemma 2, this numerical equality is also an equality of formal coefficient vectors. The three cases have distinct label-coefficient patterns: case (α) has two positive coefficients, case (β) has two positive and one negative coefficient, and case (γ) has a single positive coefficient. Hence the two representations of q must fall in the same case. In cases (α) and (β), the positive label coefficients determine both endpoints of the edge, so necessarily e = f . In case (γ), the fixed token q = ℓ′j determines one endpoint j, so all possible edges are incident to j; there are exactly 3J such edges in GJ . Therefore, for every q ∈ / S compl , at most 3J edges e ∈ E J ′′ satisfy ℓe − q ∈ S compl , as claimed. In the backward step, an edge-string may be compressed to two symbols by splitting it into two non-compliant tokens. The next sublemma bounds how many edge-strings a set Q of tokens can split in 2 this way. A priori, this number could be as large as the number p of pairs, roughly |Q| /2. We show that it is instead at most linear in |Q|, up to a factor of order J + |Q|. The reason is that our labels leave the edge-strings with almost no additive structure: the only coincidences between their sums and differences come from edges sharing a vertex. SubLemma 4 (Pair-sum bound). Let Q ⊂ Z be a finite set of integers. Then the number of edge-strings that are the sum of two (not necessarily distinct) elements of Q satisfies p {e ∈ E J | ℓ′′e = q + q ′ for some q, q ′ ∈ Q} ≤ 6J + |Q| + 1 |Q|. (117) Proof. Let E J Q denote the set of edges counted on the left-hand side of Eq. (117). We turn the counting problem into a question about a graph. The split graph. For every edge e ∈ E J Q , fix one pair {qe , qe′ } ⊆ Q with qe + qe′ = ℓ′′e ; if several such pairs exist, choose any one of them. The split graph Γ has vertex set Q and, for every e ∈ E J Q , one edge between qe and qe′ , which we label with e. (To avoid confusion, we call the elements of Q tokens and the edges of Γ splits; “vertex” and “edge” always refer to GJ .) Two different edges e ̸= f cannot produce the same split: that would give ℓ′′e = qe + qe′ = qf + qf′ = ℓ′′f , whereas edge-strings of different edges have different lengths (SubLemma 3(a)). Hence Γ has no parallel splits, each split carries a different label, and |E J Q | = number of splits of Γ.
(118)
A split with qe = qe′ is a loop. Each token q has at most one loop, since a loop at q has length 2q and hence determines its label; so there are at most |Q| loops. We set them aside and bound the number of remaining splits, which form a simple graph Γ0 . Consider two consecutive splits q − r and r − z in Γ0 , labelled with edges e = {i, j} and f = {k, l}, respectively. By definition, q + r = ℓ′′i,j
and
r + z = ℓ′′k,l .
(119)
Subtracting the first equation from the second, both the middle token r and the markers B + W cancel: z − q = ℓ′′k,l − ℓ′′i,j = enc v k + enc v l − enc v i − enc v j . (120) The difference of the outer tokens is thus a signed sum of four labels, and by SubLemma 1 such a sum reveals its indices. We call the path q − r − z a disjoint two-step path if its labels e and f share no vertex. The first step of the proof shows that such a path is determined by its two ends. Step 1 . For any two tokens q, z ∈ Q, there is at most one disjoint two-step path from q to z in Γ0 . 32
Proof. Let q − r − z and q − r′ − z be disjoint two-step paths with labels (e, f ) and (e′ , f ′ ), respectively. Applying Eq. (120) to both paths gives ℓ′′f − ℓ′′e = z − q = ℓ′′f ′ − ℓ′′e′ .
(121)
Cancelling the markers and moving the negative terms to the other side, we obtain an equality between two sums of four labels: X X X X enc v i + enc v i = enc v i + enc v i . (122) i∈f
i∈e′
i∈f ′
i∈e
By SubLemma 1, the two index multisets agree: f ⊎ e′ = f ′ ⊎ e. Equivalently, the signed indicator vectors agree, 1f − 1e = 1f ′ − 1e′ . Since e ∩ f = ∅, the vector 1f − 1e equals +1 exactly on the two endpoints of f and −1 exactly on the two endpoints of e; the same holds for 1f ′ − 1e′ , since e′ ∩ f ′ = ∅. Comparing where the two vectors are positive gives f = f ′ , and comparing where they are negative gives e = e′ . Finally, the middle token is determined by q and e, since r = ℓ′′e − q = ℓ′′e′ − q = r′ . The two paths are therefore identical. Step 1 limits how many disjoint two-step paths can leave a single token: they all end at different tokens, and there are only |Q| tokens. If every token had many splits, there would be too many such paths. The next step makes this precise. p Step 2 . Every non-empty subgraph of Γ0 contains a token with at most 6J + |Q| splits in that subgraph. Proof.pSuppose, for contradiction, that some non-empty subgraph Γ′ of Γ0 has minimum degree d > 6J + |Q|. Fix any token q in Γ′ and count the disjoint two-step paths starting at q within Γ′ . • First split. Token q has at least d splits q − r in Γ′ . Fix one, and let e = {i, j} be its label. • Second split. Token r also has at least d splits in Γ′ . We must discard those whose label shares a vertex with e. Each vertex of GJ has degree 3J, so at most 3J + 3J − 1 = 6J − 1 edges of GJ touch i or j. As different splits carry different labels, at most 6J − 1 splits at r are discarded, leaving at least d − 6J + 1. Different choices of the two splits give different paths, so at least d(d − 6J + 1) disjoint two-step paths start p at q. By Step 1 , they end pat pairwise different tokens, so their number is at most |Q|. However, d > |Q| and d − 6J + 1 > |Q|, so d(d − 6J + 1) >
p
|Q| ·
p |Q| = |Q|,
(123)
a contradiction. Step 3 . Γ0 has at most (6J +
p |Q|)|Q| splits.
Proof. We delete the tokens of Γ0 one by one. By p Step 2 , applied to what remains of Γ0 at each point, we can always delete a token that has at most 6J + |Q| remaining splits, and we delete those splits with it. After |Q|pdeletions nothing remains, so every split was deleted in some round. Each round deletes at most 6J + |Q| splits, which gives the bound. p Adding back the at most |Q| loops, the split graph Γ has at most (6J + |Q| + 1)|Q| splits, which proves Eq. (117). def
The degree term cannot be avoided. Since β is odd, B + W is even, and the J 2 tokens xi = enc v i + 12 (B + W ) satisfy xi + xj = ℓ′′i,j for every edge {i, j} ∈ E J ; together they split all 32 J 3 edge-strings, that is, 32 J per token. Non-compliant tokens can thus save Θ(J) symbols each, so the multiplicities must grow linearly in J; the blow-up makes this affordable, as both ∆ and J 2 µ(G) are then Θ(J 3 ). 33
C.8
Rounding Palettes to a Cut
SubLemma 5 (Rounding). Let G be a simple cubic graph and GJ its J-blow-up. Give each i ∈ V J a palette Πi ⊆ {B, W }, and let g count the edges {i, j} ∈ E J whose palettes permit unequal colours, i.e., for which there exist θ ∈ Πi and θ′ ∈ Πj with θ ̸= θ′ . Then a colouring σG of G with X J 2 cutG (σG ) ≥ g + J J 2 − |Πi | (124) i∈V J
can be found in deterministic polynomial time. Proof. We proceed in two steps: we first round palettes on G itself, and then reduce the blow-up to that case. Step 1 . Given palettes Πv on the vertices v ∈ V, with g G edges of G permitting unequal colours, we P can find in polynomial time a colouring σG with cutG (σG ) ≥ g G + J − v∈V |Πv |. P Proof. Let d vertices have both colours and z have neither, so v |Πv | = J + d − z. Colour each singly coloured vertex with its colour. Colour the doubly coloured vertices arbitrarily, and then perform improving moves, only on doubly coloured vertices, in the subgraph induced by vertices with non-empty palettes. At termination, each doubly coloured vertex has at most one uncut incident edge in this subgraph, since its degree is at most three. Every edge counted by g G that is uncut has a doubly coloured endpoint, so at least g G − d of them are cut. Next, colour the vertices with empty palettes, and perform improving moves only on them, now in the full graph. Each such vertex finishes with at least two cut incident edges; counting each edge at most twice, at least z cut edges are incident to empty-palette vertices. P The edges counted before are unaffected, so the final cut has size at least g G − d + z = g G + J − v |Πv |. Each phase terminates after at most I improving moves. Step 2 . We can select in deterministic polynomial time one representative clone per cluster whose palettes, assigned to the corresponding source vertices, satisfy gG + J −
X v∈V
|Πv | ≥
g 1 X + J − |Πi |. J2 J
(125)
i∈V J
Proof. Choose one representative independently and uniformly from each cluster. Each edge of GJ lies between two clusters joined by a source edge, and each source edge has J 2 such P the P edges; hence expected value of g G is g/J 2 . Each cluster has J clones, so the expected value of v |Πv | is J1 i |Πi |. The left-hand side is a sum of vertex and edge contributions, so its conditional expectation given the representatives of any subset of clusters can be computed exactly in polynomial time. Fixing clusters one at a time, always keeping a representative whose conditional expectation is at least the current one (method of conditional expectations), yields the claim. Applying Step 1 to the representatives of Step 2 and multiplying by J 2 gives Eq. (124). No random choices are made.
34
Related documents
- Tokenisation is not in APX#1775704
- A Non-constant Lower Bound for Grammar-Based Compression with Greedy#1000075
- Solving Linear and Integer Programs Faster Using Data#1634897
- (Implicitly) Characterizing Probabilistic Polynomial Time as Used in Cryptography#1325635
- Informational Actualism and the Foundation G: From Metaphysics to Computable Facts#170106
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive