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 [28 , 19 , 1 ] . It is thus natural to pose the question:
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 [11 , 24 ] , while UnigramLM is an expectation-maximisation algorithm for log-likelihood [18 , 21 ] . 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
analysed objective. Studying unboundedly large alphabets, a set of initial papers proved that tokenisation’s optimisation problem is NP-hard [26 , 17 , 20 ] .2 Follow up work then showed it is still NP-hard over unary alphabets, and APX-hard over binary ones [16 ] .3 These results, however, leave open three main questions:
(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 = N P P = NP P = N P , no polynomialtime 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). Figure 1 summarises prior results and ours.
Figure 1. Approximation ratios ruled out for tokenisation, assuming P ≠ N P P \ne NP P = N P . A ratio of 1 means exact solutions (NP-hardness), c c c some constant (APX-hardness), and “any c c c ” every constant (not in APX). Under compression, N N N is achieved by character-level tokenisation.
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 ([25 ] ). Future work should explore what makes natural language so much easier to tokenise than our worst-case constructions, and explore data-specific algorithmic guarantees.
Tokenisation
Let c ∈ Σ ∗ \mathbf{c} \in\Sigma^{*} c ∈ Σ ∗ be a character-string over an alphabet Σ \Sigma Σ , and let D = { c n } m = 1 M \mathcal{D} = \{c_n\}_{m=1}^{M} D = { c n } m = 1 M be a dataset (a multiset of such strings) with total length N ≔ ∑ c ∈ D ∣ c ∣ N \coloneqq\sum_{\mathbf{c}\in\mathcal{D}} |\mathbf{c}| N : = ∑ c ∈ D ∣ c ∣ .6 We say the alphabet is binary if ∣ Σ ∣ = 2 |\Sigma|=2 ∣Σ∣ = 2 and unary if ∣ Σ ∣ = 1 |\Sigma|=1 ∣Σ∣ = 1 . A tokeniser’s job is then to segment c \mathbf{c} c as a sequence of tokens s = ⟨ s 1 , … , s m ⟩ \mathbf{s}=\langle s_1,\ldots,s_m\rangle s = ⟨ s 1 , … , s m ⟩ from its vocabulary S ⊂ Σ + \mathcal{S}\subset\Sigma^{+} S ⊂ Σ + , which we write as tok ( c ) = s \operatorname{tok}(\mathbf{c})=\mathbf{s} tok ( c ) = s s.t. concat ( s ) ≔ s 1 ∘ ⋯ ∘ s m = c \operatorname{concat}(\mathbf{s})\coloneqq s_1\circ\cdots\circ s_m=\mathbf{c} concat ( s ) : = s 1 ∘ ⋯ ∘ s m = c . To guarantee any string can be encoded, we enforce Σ ⊆ S \Sigma\subseteq\mathcal{S} Σ ⊆ S and define the vocabulary’s budget as K ≔ ∣ S ∣ − ∣ Σ ∣ K\coloneqq|\mathcal{S}|-|\Sigma| K : = ∣ S ∣ − ∣Σ∣ .
Given these definitions, how do we now choose a tokeniser? As described above, we first choose an objective function G \mathcal{G} G ; given a class of realisable tokenisers T \mathcal{T} T , we then select the one optimising it. The optimal objective value achievable is then:
G ⋆ ( D ) ≔ min tok ∈ T G ( tok , D ) . (1) \mathcal{G}^{\star}(\mathcal{D}) \coloneqq\min_{\operatorname{tok}\in\mathcal{T}} \mathcal{G}(\operatorname{tok},\mathcal{D}). \tag*{(1)} G ⋆ ( D ) : = tok ∈ T min G ( tok , D ) . (1)
We say a tokenisation algorithm is a ρ \rho ρ -approximation if, given any dataset D \mathcal{D} D , it returns a tokeniser tok \operatorname{tok} tok with G ( tok , D ) ≤ ρ G ⋆ \mathcal{G}(\operatorname{tok},\mathcal{D})\leq\rho\mathcal{G}^{\star} G ( tok , D ) ≤ ρ G ⋆ . A problem with no ρ = 1 \rho=1 ρ = 1 approximation is then NP-hard, with no ρ = 1 + ε \rho=1+\varepsilon ρ = 1 + ε approximation (for some ε > 0 \varepsilon>0 ε > 0 ) is APX-hard, and with no ρ = c \rho=c ρ = c (for all constants c > 1 c>1 c > 1 ) is not in the APX class (all unless P = NP).
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 log-likelihood ([18 ] ), 95%-ile token frequency ([13 ] ), Rényi efficiency ([28 ] ), and compression ([12 ] ). It is thus natural to use them as an objective for tokenisation. We analyse two of them here.
A tokeniser’s compression G c o m p \mathcal{G}_{\mathrm{comp}} G comp , defined as the number of tokens it uses to represent a dataset, and its unigram negative log-likelihood G l l \mathcal{G}_{\mathrm{ll}} G ll , 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 s f_s f s for the frequency of token s s s in dataset D \mathcal{D} D and F = ∑ s f s F=\sum_s f_s F = ∑ s f s as the total token count, we formalise these objectives as
G c o m p ( tok , D ) ≔ ∑ c ∈ D ∣ tok ( c ) ∣ , (2) \mathcal{G}_{\mathrm{comp}}(\operatorname{tok},\mathcal{D}) \coloneqq\sum_{\mathbf{c}\in\mathcal{D}}|\operatorname{tok}(\mathbf{c})|, \tag*{(2)} G comp ( tok , D ) : = c ∈ D ∑ ∣ tok ( c ) ∣ , (2)
G l l ( tok , D ) ≔ ∑ s ∈ S f s > 0 f s log F f s . (3) \mathcal{G}_{\mathrm{ll}}(\operatorname{tok},\mathcal{D}) \coloneqq\sum_{\substack{s\in\mathcal{S}\\ f_s>0}} f_s\log\frac{F}{f_s}. \tag*{(3)} G ll ( tok , D ) : = s ∈ S f s > 0 ∑ f s log f s F . (3)
Classes of Tokenisers
Several classes of tokenisers exist. We consider two of them here. First, given a vocabulary S \mathcal{S} S and a training dataset D \mathcal{D} D , direct tokenisers segment each character string c ∈ D \mathbf{c}\in\mathcal{D} c ∈ D optimally under the given objective, being defined as:
tok S , D ( c ) ≔ arg min s ∈ S ∗ : concat ( s ) = c G S [ S , D ] ( s , { c } ) . (4) \operatorname{tok}_{\mathcal{S},\mathcal{D}}(\mathbf{c}) \coloneqq\underset{\mathbf{s}\in\mathcal{S}^{*}:\,\operatorname{concat}(\mathbf{s})=\mathbf{c}}{\arg\min}\ \mathcal{G}_{\mathcal{S}}[\mathcal{S},\mathcal{D](\mathbf{s},\{\mathbf{c}\})}. \tag*{(4)} tok S , D ( c ) : = s ∈ S ∗ : concat ( s ) = c arg min G S [ S , D ] ( s , { c }) . (4)
where G S [ S , D ] \mathcal{G}_{\mathcal{S}}[\mathcal{S},\mathcal{D}] G S [ S , D ] returns a function which outputs the objective value (compression or negative log-likelihood) of a specific segmentation s \mathbf{s} s considering the entire training dataset.8 Second, bottom-up tokenisers are specified by a sequence of merges m = ⟨ m 1 , … , m ∣ m ∣ ⟩ ∈ M ∗ \mathbf{m}=\langle m_1,\ldots,m_{|\mathbf{m}|}\rangle\in\mathcal{M}^{*} m = ⟨ m 1 , … , m ∣ m ∣ ⟩ ∈ M ∗ , where M = Σ + × Σ + \mathcal{M}=\Sigma^{+}\times\Sigma^{+} M = Σ + × Σ + and each m k = s k ∘ s k ′ m_k=s_k\circ s'_k m k = s k ∘ s k ′ , which they apply in order to iteratively merge pairs of tokens in a string. Writing merge m k \operatorname{merge}_{m_k} merge m k as a function that replaces, from left to right, every non-overlapping occurrence of adjacent tokens ⟨ s k , s k ′ ⟩ \langle s_k,s'_k\rangle ⟨ s k , s k ′ ⟩ by the single token s k n e w = s k ∘ s k ′ s_k^{\mathrm{new}}=s_k\circ s'_k s k new = s k ∘ s k ′ , we formalise these tokenisers as:
tok [ m ] ( c ) ≔ ( ∏ k = 1 ∣ m ∣ merge m k ) ( c ) . (5) \operatorname{tok}_{[\mathbf{m}]}(\mathbf{c})\coloneqq\left(\prod_{k=1}^{|\mathbf{m}|}\operatorname{merge}_{m_k}\right)(\mathbf{c}). \tag*{(5)} tok [ m ] ( c ) : = k = 1 ∏ ∣ m ∣ merge m k ( c ) . (5)
where ∘ \circ ∘ denotes function composition. UnigramLM is an example of a direct tokeniser, while BPE is a bottom-up tokeniser. We write T K \mathcal{T}_K T K for the set of tokenisers with budget K K K , noting bottom-up tokenisers have K = ∣ S ∣ − ∣ Σ ∣ = ∣ m ∣ K=|S|-|\Sigma|=|\mathbf{m}| K = ∣ S ∣ − ∣Σ∣ = ∣ m ∣ .
Direct Tokenisation is not in APX
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 |\Sigma|=2 ∣Σ∣ = 2 also proves it for all ∣ Σ ∣ > 2 |\Sigma|>2 ∣Σ∣ > 2 .
Finite-Word Rank
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 [22 ] . Let X = { x m } m = 1 M \mathcal{X}=\{x_m\}_{m=1}^{M} X = { x m } m = 1 M be a finite set of words, composed of strings in an alphabet Σ w r \Sigma_{\mathrm{wr}} Σ wr , i.e., x m ∈ Σ w r + x_m\in\Sigma_{\mathrm{wr}}^{+} x m ∈ Σ wr + . This problem then asks if there is any set of strings Y ⊆ Σ w r + \mathcal{Y}\subseteq\Sigma_{\mathrm{wr}}^{+} Y ⊆ Σ wr + with size at most K w r K_{\mathrm{wr}} K wr which covers X \mathcal{X} X .
Definition 1. Let X ⊂ Σ w r + \mathcal{X}\subset\Sigma_{\mathrm{wr}}^{+} X ⊂ Σ wr + be a finite set of words and K w r ∈ N K_{\mathrm{wr}}\in\mathbb{N} K wr ∈ N a target size. The finite-word rank decision problem requires deciding whether there exists a set Y ⊆ Σ w r + \mathcal{Y}\subseteq\Sigma_{\mathrm{wr}}^{+} Y ⊆ Σ wr + that covers X \mathcal{X} X , i.e., X ⊆ Y ∗ \mathcal{X}\subseteq\mathcal{Y}^{*} X ⊆ Y ∗ , with size at most ∣ Y ∣ ≤ K w r |\mathcal{Y}|\leq K_{\mathrm{wr}} ∣ Y ∣ ≤ K wr . Defining rank ( X ) \operatorname{rank}(\mathcal{X}) rank ( X ) as X \mathcal{X} X ’s smallest possible cover size, we write:
K w r ≥ rank ( X ) = d e f min Y ⊆ Σ w r + s . t . X ⊆ Y ∗ ∣ Y ∣ (6) K_{\mathrm{wr}}\geq\operatorname{rank}(\mathcal{X})\mathrel{\mathop=^{\mathrm{def}}}\min_{\mathcal{Y}\subseteq\Sigma_{\mathrm{wr}}^{+}\ \mathrm{s.t.}\ \mathcal{X}\subseteq\mathcal{Y}^{*}}|\mathcal{Y}| \tag*{(6)} K wr ≥ rank ( X ) = def Y ⊆ Σ wr + s.t. X ⊆ Y ∗ min ∣ Y ∣ (6)
The finite-word rank problem is closely related to tokenisation, but differs in two main ways. First, Y \mathcal{Y} Y need not contain Σ w r \Sigma_{\mathrm{wr}} Σ wr , allowing for solutions that cannot represent all strings in Σ w r ∗ \Sigma_{\mathrm{wr}}^{*} Σ wr ∗ . Second, it asks about the size of Y \mathcal{Y} Y , instead of how compactly X \mathcal{X} X can be represented using tokens in Y \mathcal{Y} Y . Leveraging these differences will be the key to our results.
Reducing from Finite-Word Rank
We now provide the reduction from finite-word rank instances to binary direct tokenisation. The main idea is to define a function enc : Σ w r → { 0 , 1 } ∗ \operatorname{enc}:\Sigma_{\mathrm{wr}}\to\{0,1\}^{*} enc : Σ wr → { 0 , 1 } ∗ which will replace each symbol in finite-word rank instances with long unique binary blocks.
Reduction 1. Let ( X , K w r ) (\mathcal{X},K_{\mathrm{wr}}) ( X , K wr ) define a finite-word rank instance. Now, fix an integer R ≥ 2 R\geq2 R ≥ 2 . We construct a tokenisation instance as:
K = K w r , Σ = { 0 , 1 } (7) K=K_{\mathrm{wr}},\quad\Sigma=\{0,1\} \tag*{(7)} K = K wr , Σ = { 0 , 1 } (7)
D = { enc ( x 1 ) ∘ ⋯ ∘ enc ( x ∣ x ∣ ) ∣ x ∈ X } (8) \mathcal{D}=\{\operatorname{enc}(x_1)\circ\cdots\circ\operatorname{enc}(x_{|x|})\mid x\in\mathcal{X}\} \tag*{(8)} D = { enc ( x 1 ) ∘ ⋯ ∘ enc ( x ∣ x ∣ ) ∣ x ∈ X } (8)
enc ( x ) = d e f enc 1 ( x ) ∘ enc 2 ( x ) ∘ ⋯ ∘ enc R ( x ) (9) \operatorname{enc}(x)\mathrel{\mathop=^{\mathrm{def}}}\operatorname{enc}_1(x)\circ\operatorname{enc}_2(x)\circ\cdots\circ\operatorname{enc}_R(x) \tag*{(9)} enc ( x ) = def enc 1 ( x ) ∘ enc 2 ( x ) ∘ ⋯ ∘ enc R ( x ) (9)
enc r ( x ) = d e f 11 ∘ 0 y 1 ∘ 0 y 2 ∘ ⋯ ∘ 0 y L ∘ 0 (10) \operatorname{enc}_r(x)\mathrel{\mathop=^{\mathrm{def}}}1 1\circ0y_1\circ0y_2\circ\cdots\circ0y_L\circ0 \tag*{(10)} enc r ( x ) = def 11 ∘ 0 y 1 ∘ 0 y 2 ∘ ⋯ ∘ 0 y L ∘ 0 (10)
where y 1 y 2 ⋯ y L ∈ { 0 , 1 } L y_1y_2\cdots y_L\in\{0,1\}^{L} y 1 y 2 ⋯ y L ∈ { 0 , 1 } L is a binary fixed-length unique representation of each pair in Σ w r × { 1 , … , R } \Sigma_{\mathrm{wr}}\times\{1,\ldots,R\} Σ wr × { 1 , … , R } ; we thus have L = ⌈ log 2 ( ∣ Σ w r ∣ R ) ⌉ L=\lceil\log_2(|\Sigma_{\mathrm{wr}}|R)\rceil L = ⌈ log 2 ( ∣ Σ wr ∣ R )⌉ .
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 O c o m p \mathcal{O}_{\mathrm{comp}} O comp is not in APX. In fact, for every constant ϵ > 0 \epsilon>0 ϵ > 0 , it admits no polynomial-time N 1 − ϵ N^{1-\epsilon} N 1 − ϵ -approximation.
Proof sketch. See a formal proof in §A.1. For a target approximation factor ρ \rho ρ , apply Reduction 1 to a finite-word rank instance ( X , K w r ) (\mathcal{X},K_{\mathrm{wr}}) ( X , K wr ) using R ≥ ⌈ ρ T ⌉ R\geq\lceil\rho T\rceil R ≥ ⌈ ρT ⌉ . We can prove
rank ( X ) ≤ K w r ⟹ O c o m p ∗ ( D ) ≤ T , (11) \operatorname{rank}(\mathcal{X})\leq K_{\mathrm{wr}}\Longrightarrow\mathcal{O}_{\mathrm{comp}}^{*}(\mathcal{D})\leq T, \tag*{(11)} rank ( X ) ≤ K wr ⟹ O comp ∗ ( D ) ≤ T , (11)
rank ( X ) > K w r ⟹ O c o m p ∗ ( D ) > R ≥ ρ T . (12) \operatorname{rank}(\mathcal{X})>K_{\mathrm{wr}}\Longrightarrow\mathcal{O}_{\mathrm{comp}}^{*}(\mathcal{D})>R\geq\rho T. \tag*{(12)} rank ( X ) > K wr ⟹ O comp ∗ ( D ) > R ≥ ρT . (12)
where T = d e f ∑ x ∈ X ∣ x ∣ T\mathrel{\mathop=^{\mathrm{def}}}\sum_{x\in\mathcal{X}}|x| T = def ∑ x ∈ X ∣ x ∣ . If rank ( X ) ≤ K w r \operatorname{rank}(\mathcal{X})\leq K_{\mathrm{wr}} rank ( X ) ≤ K wr , simply encoding the optimal Y \mathcal{Y} Y for the finite-word rank with enc \operatorname{enc} enc would lead to at most T T T tokens being used by the tokeniser, leading to Eq. (7a). If rank ( X ) > K w r \operatorname{rank}(\mathcal{X})>K_{\mathrm{wr}} rank ( X ) > K wr , the tokeniser must cut some block enc r ( x ) \operatorname{enc}_r(x) enc r ( x ) for every r ≤ R r\leq R r ≤ R , requiring more than R R R tokens. Setting R = T c R=T^{c} R = T c with c ≥ 3 / ϵ c\geq3/\epsilon c ≥ 3/ ϵ gives N 1 − ϵ T < R N^{1-\epsilon}T<R N 1 − ϵ T < R , ruling out N 1 − ϵ N^{1-\epsilon} N 1 − ϵ -approximations. □ \square □
Theorem 2. Unless P = NP, binary direct tokenisation under the unigram log-likelihood objective is not in APX. In fact, for every constant ϵ > 0 \epsilon>0 ϵ > 0 , it admits no polynomial-time N 1 − ϵ N^{1-\epsilon} N 1 − ϵ -approximation.
Proof sketch. See a formal proof in §A.2. Using Reduction 1 with R = T 4 R=T^{4} R = T 4 , we can use a similar logic to above—but while also bounding token frequencies—to prove that:
rank ( X ) ≤ K w r ⟹ O l l ∗ ( D ) ≤ T log T , (13) \operatorname{rank}(\mathcal{X})\leq K_{\mathrm{wr}}\Longrightarrow\mathcal{O}_{\mathrm{ll}}^{*}(\mathcal{D})\leq T\log T, \tag*{(13)} rank ( X ) ≤ K wr ⟹ O ll ∗ ( D ) ≤ T log T , (13)
rank ( X ) > K w r ⟹ G l l ⋆ ( D ) > T 3 4 . (14) \operatorname{rank}(\mathcal{X}) > K_{\mathrm{wr}} \Longrightarrow\mathcal{G}^{\star}_{\mathrm{ll}}(\mathcal{D}) > \frac{T^{3}}{4}. \tag*{(14)} rank ( X ) > K wr ⟹ G ll ⋆ ( D ) > 4 T 3 . (14)
Setting R = T c R=T^{c} R = T c with c ≥ 4 / ε c \ge4/\varepsilon c ≥ 4/ ε instead raises the NO bound to T c − 1 / 4 T^{c-1}/4 T c − 1 /4 , which exceeds N 1 − ε T log T N^{1-\varepsilon}T\log T N 1 − ε T log T and so rules out N 1 − ε N^{1-\varepsilon} N 1 − ε -approximations.
Bottom-up Tokenisation is not in APX
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
Gap Maximum Cut on Cubic Graphs
First, let a graph G G G be cubic if each of its vertices has degree 3, and simple if it has no loops or multiedges. Further, let J J J be a graph’s number of vertices, and μ ( G ) \mu(G) μ ( 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 ) \mu(G) μ ( G ) on simple cubic graphs is APX-complete ([2 ] ). Moreover, there is a constant ε 0 > 0 \varepsilon_0 > 0 ε 0 > 0 for which it is NP-hard to distinguish cubic graphs with μ ( G ) ≥ κ \mu(G) \ge\kappa μ ( G ) ≥ κ from those with μ ( G ) ≤ κ − ε 0 J \mu(G) \le\kappa-\varepsilon_0J μ ( G ) ≤ κ − ε 0 J , for a given target $\kappa ({xref}Lemma 3`).
Reducing from Maximum Cut
Given an instance ( G , κ ) (G,\kappa) ( G , κ ) , we (i) replace every node of G G G by λ = ⌈ 40 / ε 0 ⌉ \lambda=\lceil40/\varepsilon_0\rceil λ = ⌈ 40/ ε 0 ⌉ copies, (ii) write all three-vertex walks of this graph into one string, and (iii) encode it as a binary string.
Reduction 2. Let ( G , κ ) (G,\kappa) ( G , κ ) be an instance of maximum cut on a simple cubic graph. Now, let G λ G_\lambda G λ be a copy of G G G where every node v j v_j v j is replaced with λ = ⌈ 40 / ε 0 ⌉ \lambda=\lceil40/\varepsilon_0\rceil λ = ⌈ 40/ ε 0 ⌉ copies v j , n v_{j,n} v j , n (n ≤ λ n \le\lambda n ≤ λ ), and two nodes v j , n , v j ′ , n ′ v_{j,n},v_{j',n'} v j , n , v j ′ , n ′ are connected if v j , v j ′ v_j,v_{j'} v j , v j ′ were connected in G G G . We construct a tokenisation instance as:
K = H + 3 M + ∣ A λ ∣ − λ 2 κ , Σ = { 0 , 1 } (15) K=H+3M+|\mathcal{A}_\lambda|-\lambda^2\kappa,\qquad\Sigma=\{0,1\} \tag*{(15)} K = H + 3 M + ∣ A λ ∣ − λ 2 κ , Σ = { 0 , 1 } (15)
D = { ◯ x ∈ graph2str ( G λ ) bin ( x ) } (16) \mathcal{D}=\left\{\mathop{\bigcirc}_{x\in\operatorname{graph2str}(G_\lambda)}\operatorname{bin}(x)\right\} \tag*{(16)} D = { ◯ x ∈ graph2str ( G λ ) bin ( x ) } (16)
graph2str ( G λ ) = ◯ ω ∈ walk ( G λ ) ( ω ⋄ χ ) # (17) \operatorname{graph2str}(G_\lambda)=\mathop{\bigcirc}_{\omega\in\operatorname{walk}(G_\lambda)}\left(\omega\diamond_{\chi}\right)\# \tag*{(17)} graph2str ( G λ ) = ◯ ω ∈ walk ( G λ ) ( ω ⋄ χ ) # (17)
where ◯ \bigcirc ◯ denotes string concatenation, walk \operatorname{walk} walk returns all three-vertex walks ω = v v ′ v ′ ′ \omega=vv'v'' ω = v v ′ v ′′ in a graph, ⋄ χ \diamond_{\chi} ⋄ χ are separator symbols, unique per pair of walk endpoints, # \# # is an end symbol, and bin \operatorname{bin} bin returns a binary codeword for each node or symbol. Further, ∣ A λ ∣ |\mathcal{A}_\lambda| ∣ A λ ∣ is twice the number of edges of the blown-up graph, M M M is the number of such walks, and H H H is the number of merges used to build all codewords.
Note that D \mathcal{D} D has a single string, which we denote by w ˉ \bar{w} w ˉ . We now present our main theorems for bottom-up tokenisation.
Theorem 3. Unless P = N P \mathrm{P}=\mathrm{NP} 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 ) o(N/\log N) o ( N / log N ) -approximation on length-N N N datasets.
Proof sketch. See formal proof in §B.1. For graphs with large enough J J J , we can show that:
μ ( G ) ≥ κ ⟹ G c o m p ⋆ ( D ) = 1 , (18) \mu(G)\ge\kappa\Longrightarrow\mathcal{G}^{\star}_{\mathrm{comp}}(\mathcal{D})=1, \tag*{(18)} μ ( G ) ≥ κ ⟹ G comp ⋆ ( D ) = 1 , (18) μ ( G ) ≤ κ − ε 0 J ⟹ G c o m p ⋆ ( D ) > ε 0 2 λ 2 J (19) \mu(G)\le\kappa-\varepsilon_0J \Longrightarrow\mathcal{G}^{\star}_{\mathrm{comp}}(\mathcal{D})>\frac{\varepsilon_0}{2}\lambda^2J \tag*{(19)} μ ( G ) ≤ κ − ε 0 J ⟹ G comp ⋆ ( D ) > 2 ε 0 λ 2 J (19) which presents a gap amplification.
For log-likelihood, a single token would have negative log-likelihood 0 0 0 , so we add the string 0 0 0 , which no merge can change, and use D = { w ˉ , 0 } \mathcal{D}=\{\bar{w},0\} D = { w ˉ , 0 } .
Theorem 4. Unless P = N P \mathrm{P}=\mathrm{NP} P = NP , binary bottom-up tokenisation under the unigram negative log-likelihood objective G l l ⋆ \mathcal{G}^{\star}_{\mathrm{ll}} G ll ⋆ is not in APX. In fact, it admits no polynomial-time o ( log N ) o(\log N) o ( log N ) -approximation on datasets of total length N N N .
Proof sketch. See formal proof in §B.2. Similarly to before, for large enough J J J , we show that:
μ ( G ) ≥ κ ⟹ G l l ⋆ ( D ) ≤ 2 log 2 , (20) \mu(G)\ge\kappa\Longrightarrow\mathcal{G}^{\star}_{\mathrm{ll}}(\mathcal{D})\le2\log2, \tag*{(20)} μ ( G ) ≥ κ ⟹ G ll ⋆ ( D ) ≤ 2 log 2 , (20) μ ( G ) ≤ κ − ε 0 J ⟹ G l l ⋆ ( D ) > log ( ε 0 2 λ 2 J ) \mu(G)\le\kappa-\varepsilon_0J \Longrightarrow\mathcal{G}^{\star}_{\mathrm{ll}}(\mathcal{D})>\log\left(\frac{\varepsilon_0}{2}\lambda^2J\right) μ ( G ) ≤ κ − ε 0 J ⟹ G ll ⋆ ( D ) > log ( 2 ε 0 λ 2 J ) which again presents a gap amplification.
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
Limitations
Our hardness results rely on carefully constructed datasets, which differ substantially from natural-language 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 ([17 ] ), remain open. We suspect, however, that most interesting classes of tokenisers and objective functions will also be hard to approximate.
Acknowledgements
We would like to thank Gregor Bachmann and Jan Tempus for conversations about this topic.
Binary Direct Tokenisation is not in APX
Proof of thm:binarycompressionnotapx (Compression)
Theorem 1. Unless P = N P \mathrm{P}=\mathrm{NP} P = NP , binary direct tokenisation under the compression objective G c o m p \mathcal{G}_{\mathrm{comp}} G comp is not in APX. In fact, for every constant ε > 0 \varepsilon>0 ε > 0 , it admits no polynomial-time N 1 − ε N^{1-\varepsilon} N 1 − ε -approximation.
Proof. Consider a FINITE-WORD-RANK instance ( X , K w r ) (\mathcal{X},K_{\mathrm{wr}}) ( X , K wr ) and its binary encoding D \mathcal{D} D from § 3.2 (Figure 2 a). Recall that T = ∑ x ∈ X ∣ x ∣ T=\sum_{\mathbf{x}\in\mathcal{X}}|\mathbf{x}| T = ∑ x ∈ X ∣ x ∣ . We first establish the following two implications:
Figure 2. (a) Each symbol becomes R R R blocks enc j ( c ) \operatorname{enc}_j(c) enc j ( c ) , each a start marker 11 11 11 followed by an identifier of ( c , j ) (c,j) ( c , j ) . (b) Each boundary cuts at most one block, so fewer than R R R boundaries leave some index j ⋆ j^\star j ⋆ uncut; the j ⋆ j^\star j ⋆ -blocks of each token spell a word, and these words generate X \mathcal{X} X .
rank ( X ) ≤ K w r ⟹ G c o m p ∗ ( D ) ≤ T , (21) \operatorname{rank}(\mathcal{X})\le K_{\mathrm{wr}}\quad\Longrightarrow\quad\mathcal{G}^{*}_{\mathrm{comp}}(\mathcal{D})\le T, \tag*{(21)} rank ( X ) ≤ K wr ⟹ G comp ∗ ( D ) ≤ T , (21)
rank ( X ) > K w r ⟹ G c o m p ∗ ( D ) > R . (22) \operatorname{rank}(\mathcal{X})>K_{\mathrm{wr}}\quad\Longrightarrow\quad\mathcal{G}^{*}_{\mathrm{comp}}(\mathcal{D})>R. \tag*{(22)} rank ( X ) > K wr ⟹ G comp ∗ ( D ) > R . (22)
This is done in steps ① and ② below. We then show how to choose R R R such that no constant approximation exists (step ③). Finally, we strengthen these results to show no N 1 − ε N^{1-\varepsilon} N 1 − ε -approximation exists (step ④).
Step ①. First implication (Eq. (12)). Suppose rank ( X ) ≤ K w r \operatorname{rank}(\mathcal{X})\le K_{\mathrm{wr}} rank ( X ) ≤ K wr . Then there exists a generating set Y ⊆ Σ w r + \mathcal{Y}\subseteq\Sigma_{\mathrm{wr}}^{+} Y ⊆ Σ wr + with ∣ Y ∣ ≤ K w r |\mathcal{Y}|\le K_{\mathrm{wr}} ∣ Y ∣ ≤ K wr and X ⊆ Y ∗ \mathcal{X}\subseteq\mathcal{Y}^{*} X ⊆ Y ∗ . We construct a direct-tokenisation vocabulary containing, for every y ∈ Y y\in\mathcal{Y} y ∈ Y , the token enc ( y ) \operatorname{enc}(y) enc ( y ) . If ∣ Y ∣ < K w r |\mathcal{Y}|<K_{\mathrm{wr}} ∣ Y ∣ < K wr , the remaining vocabulary entries may be chosen arbitrarily.
Take any word x ∈ X \mathbf{x}\in\mathcal{X} x ∈ X . Since Y \mathcal{Y} Y generates X \mathcal{X} X , we can write
x = y 1 y 2 ⋯ y ℓ , y i ∈ Y ⟹ enc ( x ) = enc ( y 1 ) enc ( y 2 ) ⋯ enc ( y ℓ ) (23) \mathbf{x}=y_{1}y_{2}\cdots y_{\ell},\qquad y_i\in\mathcal{Y}
\quad\Longrightarrow\quad
\operatorname{enc}(\mathbf{x})=\operatorname{enc}(y_{1})\operatorname{enc}(y_{2})\cdots\operatorname{enc}(y_{\ell}) \tag*{(23)} x = y 1 y 2 ⋯ y ℓ , y i ∈ Y ⟹ enc ( x ) = enc ( y 1 ) enc ( y 2 ) ⋯ enc ( y ℓ ) (23)
where the implication follows from the construction of the binary encoding. Hence enc ( x ) \operatorname{enc}(\mathbf{x}) enc ( x ) can be represented using at most ℓ \ell ℓ tokens. Moreover, every y i y_i y i is non-empty, so ℓ ≤ ∣ x ∣ \ell\le|\mathbf{x}| ℓ ≤ ∣ x ∣ . Since direct tokenisation chooses a minimum-length representation,
∣ tok S ( enc ( x ) ) ∣ ≤ ℓ ≤ ∣ x ∣ . (24) \left|\operatorname{tok}_{\mathcal{S}}(\operatorname{enc}(\mathbf{x}))\right|\le\ell\le|\mathbf{x}|. \tag*{(24)} ∣ tok S ( enc ( x )) ∣ ≤ ℓ ≤ ∣ x ∣. (24)
Summing over all x ∈ X \mathbf{x}\in\mathcal{X} x ∈ X gives
G c o m p ( tok S , D ) ≤ ∑ x ∈ X ∣ x ∣ = T . (25) \mathcal{G}_{\mathrm{comp}}\left(\operatorname{tok}_{\mathcal{S}},\mathcal{D}\right)\le\sum_{\mathbf{x}\in\mathcal{X}}|\mathbf{x}|=T. \tag*{(25)} G comp ( tok S , D ) ≤ x ∈ X ∑ ∣ x ∣ = T . (25)
Therefore,
rank ( X ) ≤ K w r ⟹ G c o m p ∗ ( D ) ≤ T . (26) \operatorname{rank}(\mathcal{X})\le K_{\mathrm{wr}}\quad\Longrightarrow\quad\mathcal{G}^{*}_{\mathrm{comp}}(\mathcal{D})\le T. \tag*{(26)} rank ( X ) ≤ K wr ⟹ G comp ∗ ( D ) ≤ T . (26)
Step ②. Second implication (Eq. (13)). We prove the contrapositive of Eq. (13). Suppose there exists a direct-tokenisation vocabulary S \mathcal{S} S with at most K w r K_{\mathrm{wr}} K wr tokens such that
G c o m p ( tok S , D ) ≤ R . (27) \mathcal{G}_{\mathrm{comp}}\left(\operatorname{tok}_{\mathcal{S}},\mathcal{D}\right)\le R. \tag*{(27)} G comp ( tok S , D ) ≤ R . (27)
Across the entire tokenised dataset, there are thus at most R R R tokens, and at most R − 1 R-1 R − 1 token boundaries. Now, letting ℓ m \ell_m ℓ m be the number of tokens used to encode enc ( x m ) \operatorname{enc}(\mathbf{x}_m) enc ( x m ) , we have that:
∑ m = 1 M ( ℓ m − 1 ) < ∑ m = 1 M ℓ m ≤ R , (28) \sum_{m=1}^{M}(\ell_m-1)<\sum_{m=1}^{M}\ell_m\le R, \tag*{(28)} m = 1 ∑ M ( ℓ m − 1 ) < m = 1 ∑ M ℓ m ≤ R , (28)
where ℓ m − 1 \ell_m-1 ℓ m − 1 then represents the number of boundaries between tokens for each word. As the number of token boundaries is smaller than R R R —and since each such boundary can cut through at most one of the R R R blocks enc j ∗ ( c ) \operatorname{enc}_{j^{*}}(\mathbf{c}) enc j ∗ ( c ) —there must exist at least one index j ∗ j^{*} j ∗ such that no block enc j ∗ ( c ) \operatorname{enc}_{j^{*}}(c) enc j ∗ ( c ) is cut by a token boundary anywhere in D \mathcal{D} D (Figure 2 b).
We now construct a generating set for X \mathcal{X} X . For each non-character token s ∈ S s\in\mathcal{S} s ∈ S , read from left to right all complete blocks of the form enc j ∗ ( c ) \operatorname{enc}_{j^{*}}(c) enc j ∗ ( c ) contained in s s s , and record their corresponding symbols c c c . If such block occurs in s s s , we discard it. Let Y \mathcal{Y} Y be the set of non-empty words obtained in this way. Since S \mathcal{S} S contains at most K w r K_{\mathrm{wr}} K wr non-character tokens,
∣ Y ∣ ≤ K w r . (29) |\mathcal{Y}| \le K_{\mathrm{wr}}. \tag*{(29)} ∣ Y ∣ ≤ K wr . (29)
It remains to show that Y \mathcal{Y} Y generates X \mathcal{X} X . Take any x = c 1 ⋯ c m ∈ X x=c_1\cdots c_m\in\mathcal{X} x = c 1 ⋯ c m ∈ X . Its encoding enc ( x ) \operatorname{enc}(x) enc ( x ) contains, in order, the blocks
enc j ⋆ ( c 1 ) , enc j ⋆ ( c 2 ) , … , enc j ⋆ ( c m ) . (30) \operatorname{enc}_{j^\star}(c_1),\operatorname{enc}_{j^\star}(c_2),\ldots,\operatorname{enc}_{j^\star}(c_m). \tag*{(30)} enc j ⋆ ( c 1 ) , enc j ⋆ ( c 2 ) , … , enc j ⋆ ( c m ) . (30)
By the choice of j ⋆ j^\star j ⋆ , every one of these blocks lies entirely inside a single token. Thus, reading the complete j ⋆ j^\star j ⋆ -blocks from the tokens of enc ( x ) \operatorname{enc}(x) enc ( x ) recovers c 1 , … , c m c_1,\ldots,c_m c 1 , … , c m in order. The corresponding words from Y \mathcal{Y} Y therefore concatenate to x x x , and hence x ∈ Y ∗ x\in\mathcal{Y}^\ast x ∈ Y ∗ .
Since this holds for every x ∈ X x\in\mathcal{X} x ∈ X , X ⊆ Y ∗ \mathcal{X}\subseteq\mathcal{Y}^\ast X ⊆ Y ∗ , and therefore rank ( X ) ≤ ∣ Y ∣ ≤ K w r \operatorname{rank}(\mathcal{X})\le|\mathcal{Y}|\le K_{\mathrm{wr}} rank ( X ) ≤ ∣ Y ∣ ≤ K wr . We have shown that
C c o m p ⋆ ( D ) ≤ R ⟹ rank ( X ) ≤ K w r . (31) \mathcal{C}^{\star}_{\mathrm{comp}}(\mathcal{D})\le R \;\Longrightarrow\; \operatorname{rank}(\mathcal{X})\le K_{\mathrm{wr}}. \tag*{(31)} C comp ⋆ ( D ) ≤ R ⟹ rank ( X ) ≤ K wr . (31)
Taking the contrapositive gives
rank ( X ) > K w r ⟹ C c o m p ⋆ ( D ) > R , (32) \operatorname{rank}(\mathcal{X})>K_{\mathrm{wr}} \;\Longrightarrow\; \mathcal{C}^{\star}_{\mathrm{comp}}(\mathcal{D})>R, \tag*{(32)} rank ( X ) > K wr ⟹ C comp ⋆ ( D ) > R , (32)
proving Eq. (22) .
Step 3. No constant approximation. Suppose that there exists a polynomial-time ρ \rho ρ -approximation algorithm for some constant ρ ≥ 1 \rho\ge1 ρ ≥ 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 = N P \mathrm{P}=\mathrm{NP} P = NP .
To this end, set R = ⌈ ρ T ⌉ R=\lceil\rho T\rceil R = ⌈ ρT ⌉ . Since ρ \rho ρ is constant, R = O ( T ) R=O(T) R = O ( T ) and the construction remains polynomial in size. If rank ( X ) ≤ K w r \operatorname{rank}(\mathcal{X})\le K_{\mathrm{wr}} rank ( X ) ≤ K wr , then by Eq. (21) the approximation algorithm returns a solution of value at most
ρ C c o m p ⋆ ( D ) ≤ ρ T ≤ R . (33) \rho\mathcal{C}^{\star}_{\mathrm{comp}}(\mathcal{D})\le\rho T\le R. \tag*{(33)} ρ C comp ⋆ ( D ) ≤ ρT ≤ R . (33)
Conversely, if rank ( X ) > K w r \operatorname{rank}(\mathcal{X}) > K_{\mathrm{wr}} rank ( X ) > K wr , then by Eq. (22) every feasible solution has value strictly greater than R R R .
We could thus decide FINITE-WORD-RANK as follows: build D D D , run the approximation algorithm, count the tokens its vocabulary uses, and answer “rank ( X ) ≤ K w r \operatorname{rank}(\mathcal{X}) \le K_{\mathrm{wr}} rank ( X ) ≤ K wr ” if and only if there are at most R R R . Each of these steps takes polynomial time, which is impossible unless P = N P \mathrm{P} = \mathrm{NP} P = NP , as FINITE-WORD-RANK is NP-hard. Since ρ \rho ρ was arbitrary, no polynomial-time constant-factor approximation exists.
Step ④. No N 1 − ε N^{1-\varepsilon} N 1 − ε -approximation. The same argument rules out much larger ratios. Fix ε > 0 \varepsilon> 0 ε > 0 and set R = T c R = T^c R = T c for a constant c ≥ 3 / ε c \ge3/\varepsilon c ≥ 3/ ε , and suppose that a polynomial-time N 1 − ε N^{1-\varepsilon} N 1 − ε -approximation algorithm exists. Let S \mathcal{S} S be the vocabulary it returns on D D D . We show that the number of tokens it uses would reveal whether rank ( X ) ≤ K w r \operatorname{rank}(\mathcal{X}) \le K_{\mathrm{wr}} rank ( X ) ≤ K wr ; for sufficiently large T T T ,
rank ( X ) ≤ K w r ⟹ G c o m p ( tok S [ S ] , D ) ≤ R , (34) \operatorname{rank}(\mathcal{X}) \le K_{\mathrm{wr}} \Longrightarrow\mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\mathcal{S}}[S],D) \le R, \tag*{(34)} rank ( X ) ≤ K wr ⟹ G comp ( tok S [ S ] , D ) ≤ R , (34)
rank ( X ) > K w r ⟹ G c o m p ( tok S [ S ] , D ) > R . (35) \operatorname{rank}(\mathcal{X}) > K_{\mathrm{wr}} \Longrightarrow\mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\mathcal{S}}[S],D) > R. \tag*{(35)} rank ( X ) > K wr ⟹ G comp ( tok S [ S ] , D ) > R . (35)
We now prove both implications.
First implication (Eq. (25a)). The returned vocabulary is within a factor N 1 − ε N^{1-\varepsilon} N 1 − ε of the optimum, which step ① (Eq. (21) ) bounds by T T T on YES instances. It thus uses at most N 1 − ε T N^{1-\varepsilon}T N 1 − ε T tokens, and it suffices to show that this is below R R R . Each encoded pair has 2 L + 3 = O ( log T ) 2L+3 = O(\log T) 2 L + 3 = O ( log T ) characters, so the dataset has total length N = T R ( 2 L + 3 ) = T c + 1 ( 2 L + 3 ) N = T R(2L+3) = T^{c+1}(2L+3) N = T R ( 2 L + 3 ) = T c + 1 ( 2 L + 3 ) , and for sufficiently large T T T :
N 1 − ε T = ( T c + 1 ( 2 L + 3 ) ) 1 − ε T ≤ T ( c + 1 ) ( 1 − ε ) ( 2 L + 3 ) T ≤ T c − 1 ( 2 L + 3 ) < T c = R , (36) \begin{aligned}
N^{1-\varepsilon}T &= \left(T^{c+1}(2L+3)\right)^{1-\varepsilon}T \\
&\le T^{(c+1)(1-\varepsilon)}(2L+3)T \\
&\le T^{c-1}(2L+3) \\
&< T^c = R, \tag*{(36)}
\end{aligned} N 1 − ε T = ( T c + 1 ( 2 L + 3 ) ) 1 − ε T ≤ T ( c + 1 ) ( 1 − ε ) ( 2 L + 3 ) T ≤ T c − 1 ( 2 L + 3 ) < T c = R , (36)
where ( 2 L + 3 ) 1 − ε ≤ 2 L + 3 (2L+3)^{1-\varepsilon} \le2L+3 ( 2 L + 3 ) 1 − ε ≤ 2 L + 3 , ε ( c + 1 ) ≥ 3 \varepsilon(c+1) \ge3 ε ( c + 1 ) ≥ 3 , and 2 L + 3 = O ( log T ) < T 2L+3 = O(\log T) < T 2 L + 3 = O ( log T ) < T for sufficiently large T T T . This proves the first implication.
Second implication (Eq. (25b)). The implication proved in step ② (Eq. (22) ) holds for every choice of R R R : on NO instances, every vocabulary within the budget uses more than R R R tokens. This includes the returned vocabulary S \mathcal{S} S , which proves the second implication (Eq. (25b)).
Using this, we can decide FINITE-WORD-RANK in polynomial time. Hence, unless P = N P \mathrm{P} = \mathrm{NP} P = NP , no polynomial-time N 1 − ε N^{1-\varepsilon} N 1 − ε -approximation algorithm exists, which concludes the proof. □
Proof of Theorem 2 (Log-Likelihood)
Theorem 2. Unless P = N P \mathrm{P} = \mathrm{NP} P = NP , binary direct tokenisation under the unigram log-likelihood objective is not in APX. In fact, for every constant ε > 0 \varepsilon> 0 ε > 0 , it admits no polynomial-time N 1 − ε N^{1-\varepsilon} N 1 − ε -approximation.
Proof. Consider a FINITE-WORD-RANK instance ( X , K w r ) (\mathcal{X}, K_{\mathrm{wr}}) ( X , K wr ) and its binary encoding D D D from § 3.2 (Figure 2 a). Recall that
T = ∑ x ∈ X ∣ x ∣ , (37) T = \sum_{x \in\mathcal{X}} |x|, \tag*{(37)} T = x ∈ X ∑ ∣ x ∣ , (37)
and, for this reduction, set R = T 4 R = T^4 R = T 4 . Let q ≔ ∣ encr ( x ) ∣ = 2 L + 3 q \coloneqq|\operatorname{encr}(x)| = 2L+3 q : = ∣ encr ( x ) ∣ = 2 L + 3 denote the common length of an encoded pair, and let b ≔ T + 2 q − 1 b \coloneqq T+2q-1 b : = T + 2 q − 1 . We establish the following gap:
rank ( X ) ≤ K w r ⟹ G 11 ⋆ ( D ) ≤ T log T , (38) \operatorname{rank}(\mathcal{X}) \le K_{\mathrm{wr}} \Longrightarrow\mathcal{G}_{11}^{\star}(D) \le T\log T, \tag*{(38)} rank ( X ) ≤ K wr ⟹ G 11 ⋆ ( D ) ≤ T log T , (38)
rank ( X ) > K w r ⟹ G 11 ⋆ ( D ) > T 3 4 , (39) \operatorname{rank}(\mathcal{X}) > K_{\mathrm{wr}} \Longrightarrow\mathcal{G}_{11}^{\star}(D) > \frac{T^3}{4}, \tag*{(39)} rank ( X ) > K wr ⟹ G 11 ⋆ ( D ) > 4 T 3 , (39)
for sufficiently large T T T . This is done in steps ① and ②. We then show that no constant approximation exists (step ③), and finally that no N 1 − ε N^{1-\varepsilon} N 1 − ε -approximation exists (step ④).
Step 1. First implication (Eq. (38) ). Suppose rank ( X ) ≤ K w r \operatorname{rank}(\mathcal{X}) \le K_{\mathrm{wr}} rank ( X ) ≤ K wr . As in the first implication of Theorem 1, there exists a vocabulary S \mathcal{S} S and a segmentation of D \mathcal{D} D over S \mathcal{S} S using at most T T T tokens. Let F ≤ T F \le T F ≤ T denote this total token count and let f s f_s f s denote the frequency of token s s s . Since tok S [ S ] \operatorname{tok}_{\mathcal{S}}[\mathcal{S}] tok S [ S ] minimises the log-likelihood over all segmentations of D \mathcal{D} D , we have
G l l ( tok S [ S ] , D ) ≤ ∑ s ∈ S f s log F f s ≤ ∑ s ∈ S f s log F = F log F ≤ T log T . (40) \mathcal{G}_{\mathrm{ll}}(\operatorname{tok}_{\mathcal{S}}[\mathcal{S}],\mathcal{D}) \le\sum_{s\in\mathcal{S}} f_s \log\frac{F}{f_s} \le\sum_{s\in\mathcal{S}} f_s \log F = F\log F \le T\log T. \tag*{(40)} G ll ( tok S [ S ] , D ) ≤ s ∈ S ∑ f s log f s F ≤ s ∈ S ∑ f s log F = F log F ≤ T log T . (40)
Therefore,
rank ( X ) ≤ K w r ⟹ G l l ⋆ ( D ) ≤ T log T . (41) \operatorname{rank}(\mathcal{X}) \le K_{\mathrm{wr}} \Longrightarrow\mathcal{G}^{\star}_{\mathrm{ll}}(\mathcal{D}) \le T\log T. \tag*{(41)} rank ( X ) ≤ K wr ⟹ G ll ⋆ ( D ) ≤ T log T . (41)
Step 2. Second implication (Eq. (39) ). Suppose rank ( X ) > K w r \operatorname{rank}(\mathcal{X}) > K_{\mathrm{wr}} rank ( X ) > K wr , and let S ⋆ \mathcal{S}^{\star} S ⋆ be a vocabulary minimising the negative log-likelihood objective. Let F ⋆ F^{\star} F ⋆ be the total number of tokens produced by tok S [ S ⋆ ] \operatorname{tok}_{\mathcal{S}}[\mathcal{S}^{\star}] tok S [ S ⋆ ] on D \mathcal{D} D , let f s f_s f s be the frequency of token s s s , and let
f max = d e f max s ∈ S ⋆ f s . (42) f_{\max} \mathrel{\mathop{=}^{\mathrm{def}}} \max_{s\in\mathcal{S}^{\star}} f_s. \tag*{(42)} f m a x = def s ∈ S ⋆ max f s . (42)
We first bound the longest consecutive occurrence of any token s s s to have length at most b = T + 2 q − 1 b = T + 2q - 1 b = T + 2 q − 1 . The proof for this step is given in Lemma 1. We then use this bound to control token frequencies. Let M = ∣ X ∣ M = |\mathcal{X}| M = ∣ X ∣ be the number of strings in the original FINITE-WORD-RANK instance. Fix a token s s s with frequency f s f_s f s . This token occurs in sequences of at most b b 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 F^{\star} - f_s F ⋆ − f s ) or the strings end (of which there are M M M ). Its frequency can thus be bounded as:
f s ≤ b ( F ⋆ − f s + M ) . (43) f_s \le b(F^{\star} - f_s + M). \tag*{(43)} f s ≤ b ( F ⋆ − f s + M ) . (43)
with the same holding for the most frequent token. Now, with a slight rearrangement, we can show that:
b ( F ⋆ − f max + M ) ≥ f max (44) b(F^{\star} - f_{\max} + M) \ge f_{\max} \tag*{(44)} b ( F ⋆ − f m a x + M ) ≥ f m a x (44)
b ( F ⋆ − f max ) ≥ f max − b M (45) b(F^{\star} - f_{\max}) \ge f_{\max} - bM \tag*{(45)} b ( F ⋆ − f m a x ) ≥ f m a x − b M (45)
( b + 1 ) ( F ⋆ − f max ) ≥ F ⋆ − b M (46) (b+1)(F^{\star} - f_{\max}) \ge F^{\star} - bM \tag*{(46)} ( b + 1 ) ( F ⋆ − f m a x ) ≥ F ⋆ − b M (46)
F ⋆ − f max ≥ F ⋆ − b M b + 1 . (47) F^{\star} - f_{\max} \ge\frac{F^{\star} - bM}{b+1}. \tag*{(47)} F ⋆ − f m a x ≥ b + 1 F ⋆ − b M . (47)
We can now lower-bound the optimal negative log-likelihood:
G l l ⋆ ( D ) = ∑ s ∈ S ⋆ f s log F ⋆ f s definition of ll objective ≥ ∑ s ∈ S ⋆ f s log F ⋆ f max f s ≤ f max = F ⋆ log F ⋆ f max ≥ F ⋆ ( 1 − f max F ⋆ ) − log x ≥ 1 − x = F ⋆ − f max ≥ F ⋆ − b M b + 1 xref‘Eq. (34d)‘ (48) \begin{aligned}
\mathcal{G}^{\star}_{\mathrm{ll}}(\mathcal{D}) &= \sum_{s\in\mathcal{S}^{\star}} f_s \log\frac{F^{\star}}{f_s} && \text{definition of ll objective}\\
&\ge\sum_{s\in\mathcal{S}^{\star}} f_s \log\frac{F^{\star}}{f_{\max}} && f_s \le f_{\max}\\
&= F^{\star}\log\frac{F^{\star}}{f_{\max}}\\
&\ge F^{\star}\left(1-\frac{f_{\max}}{F^{\star}}\right) && -\log x \ge1-x\\
&= F^{\star}-f_{\max}\\
&\ge\frac{F^{\star}-bM}{b+1} && \text{{xref}`Eq. (34d)`} \tag*{(48)}
\end{aligned} G ll ⋆ ( D ) = s ∈ S ⋆ ∑ f s log f s F ⋆ ≥ s ∈ S ⋆ ∑ f s log f m a x F ⋆ = F ⋆ log f m a x F ⋆ ≥ F ⋆ ( 1 − F ⋆ f m a x ) = F ⋆ − f m a x ≥ b + 1 F ⋆ − b M definition of ll objective f s ≤ f m a x − log x ≥ 1 − x xref ‘Eq. (34d)‘ (48)
By the second implication of Theorem 1, the assumption rank ( X ) > K w r \operatorname{rank}(\mathcal{X}) > K_{\mathrm{wr}} rank ( X ) > K wr implies that every feasible vocabulary produces more than R R R tokens on D \mathcal{D} D . As such, we have that F ⋆ > R F^{\star} > R F ⋆ > R and thus,
G l l ⋆ ( D ) > R − b M b + 1 . (49) \mathcal{G}^{\star}_{\mathrm{ll}}(\mathcal{D}) > \frac{R-bM}{b+1}. \tag*{(49)} G ll ⋆ ( D ) > b + 1 R − b M . (49)
Recall that R = T 4 R = T^4 R = T 4 . Moreover, since every word in X \mathcal{X} X is non-empty, M ≤ T M \le T M ≤ T . Each encoding pair has q = 2 L + 3 = O ( log T ) q = 2L + 3 = O(\log T) q = 2 L + 3 = O ( log T ) characters, and therefore, for sufficiently large T T T , b = T + 2 q − 1 < 2 T b = T + 2q - 1 < 2T b = T + 2 q − 1 < 2 T . Consequently,
G 11 ⋆ ( D ) > T 4 − b M b + 1 (50) \mathcal{G}_{11}^{\star}(\mathcal{D}) > \frac{T^4-bM}{b+1} \tag*{(50)} G 11 ⋆ ( D ) > b + 1 T 4 − b M (50)
Eq. (49) , R = T 4 R = T^4 R = T 4
≥ T 4 − b T b + 1 (51) \ge\frac{T^4-bT}{b+1} \tag*{(51)} ≥ b + 1 T 4 − b T (51)
M ≤ T M \le T M ≤ T
> T 4 − 2 T 2 2 T (52) > \frac{T^4-2T^2}{2T} \tag*{(52)} > 2 T T 4 − 2 T 2 (52)
b < 2 T b < 2T b < 2 T
= T 3 2 − T (53) = \frac{T^3}{2}-T \tag*{(53)} = 2 T 3 − T (53)
≥ T 3 4 (54) \ge\frac{T^3}{4} \tag*{(54)} ≥ 4 T 3 (54)
T ≥ 2 T \ge2 T ≥ 2
proving the implication (Eq. (39) ).
Step 3. No constant approximation. Suppose for contradiction that there exists a polynomial-time ρ \rho ρ -approximation algorithm for some constant ρ ≥ 1 \rho\ge1 ρ ≥ 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 T ,
ρ T log T < T 3 4 . (55) \rho T\log T < \frac{T^3}{4}. \tag*{(55)} ρT log T < 4 T 3 . (55)
Hence, on a YES instance of FINITE-WORD-RANK, the algorithm returns a solution of value strictly below T 3 / 4 T^3/4 T 3 /4 , while on a NO instance every feasible solution has value strictly above T 3 / 4 T^3/4 T 3 /4 . We could thus decide FINITE-WORD-RANK as follows: build D \mathcal{D} D , run the approximation algorithm, compute the objective of the vocabulary it returns, and answer “rank( X ) ≤ K w r (\mathcal{X}) \le K_{\mathrm{wr}} ( X ) ≤ K wr ” if and only if it is below T 3 / 4 T^3/4 T 3 /4 . Each of these steps takes polynomial time, which is impossible unless P = NP, as FINITE-WORD-RANK is NP-hard.
Since ρ \rho ρ was arbitrary, no polynomial-time constant-factor approximation exists.
Step 4. No N 1 − ε N^{1-\varepsilon} N 1 − ε -approximation. As for Theorem 1, the same argument rules out much larger ratios. Fix ε > 0 \varepsilon> 0 ε > 0 and set R = T c R = T^c R = T c for a constant c ≥ max { 3 , 4 / ε } c \ge\max\{3, 4/\varepsilon\} c ≥ max { 3 , 4/ ε } .
Suppose for a contradiction that a polynomial-time N 1 − ε N^{1-\varepsilon} N 1 − ε -approximation algorithm exists, and let S \mathcal{S} S be the vocabulary this algorithm returns on D \mathcal{D} D . We show that the objective of this vocabulary would reveal whether rank( X ) ≤ K w r (\mathcal{X}) \le K_{\mathrm{wr}} ( X ) ≤ K wr ; for sufficiently large T T T ,
rank ( X ) ≤ K w r ⟹ G 11 ( tok Φ [ S ] , D ) < T c − 1 4 (56) \operatorname{rank}(\mathcal{X}) \le K_{\mathrm{wr}}
\Longrightarrow
\mathcal{G}_{11}(\operatorname{tok}_{\Phi}[\mathcal{S}],\mathcal{D})
< \frac{T^{c-1}}{4} \tag*{(56)} rank ( X ) ≤ K wr ⟹ G 11 ( tok Φ [ S ] , D ) < 4 T c − 1 (56)
rank ( X ) > K w r ⟹ G 11 ( tok Φ [ S ] , D ) > T c − 1 4 (57) \operatorname{rank}(\mathcal{X}) > K_{\mathrm{wr}}
\Longrightarrow
\mathcal{G}_{11}(\operatorname{tok}_{\Phi}[\mathcal{S}],\mathcal{D})
> \frac{T^{c-1}}{4} \tag*{(57)} rank ( X ) > K wr ⟹ G 11 ( tok Φ [ S ] , D ) > 4 T c − 1 (57)
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 ((56) ). The returned vocabulary is within a factor N 1 − ε N^{1-\varepsilon} N 1 − ε of the optimum, which step 1 (Eq. (38) ) bounds by T log T T\log T T log T on YES instances. Its objective is thus at most N 1 − ε T log T N^{1-\varepsilon}T\log T N 1 − ε T log T , and it suffices to show that this is below T c − 1 / 4 T^{c-1}/4 T c − 1 /4 . The dataset has total length N = T R q = T c + 1 q N = TRq = T^{c+1}q N = T R q = T c + 1 q , so for sufficiently large T T T :
N 1 − ε T log T = ( T c + 1 q ) 1 − ε T log T (58) N^{1-\varepsilon}T\log T
= (T^{c+1}q)^{1-\varepsilon}T\log T \tag*{(58)} N 1 − ε T log T = ( T c + 1 q ) 1 − ε T log T (58)
N = T c + 1 q N = T^{c+1}q N = T c + 1 q
≤ T ( c + 1 ) ( 1 − ε ) q T log T (59) \le T^{(c+1)(1-\varepsilon)}qT\log T \tag*{(59)} ≤ T ( c + 1 ) ( 1 − ε ) q T log T (59)
q 1 − ε ≤ q q^{1-\varepsilon} \le q q 1 − ε ≤ q
≤ T c − 2 q log T (60) \le T^{c-2}q\log T \tag*{(60)} ≤ T c − 2 q log T (60)
ε ( c + 1 ) ≥ 4 \varepsilon(c+1) \ge4 ε ( c + 1 ) ≥ 4
< T c − 1 4 (61) < \frac{T^{c-1}}{4} \tag*{(61)} < 4 T c − 1 (61)
4 q log T < T 4q\log T < T 4 q log T < T 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 T^{c-1}/4 T c − 1 /4 on NO instances. For this, we reuse the bound of step 2 (Eq. (49) ), which holds for every choice of R R R . Each encoded pair still has q = O ( log T ) q = O(\log T) q = O ( log T ) characters, so b = T + 2 q − 1 < 2 T b = T + 2q - 1 < 2T b = T + 2 q − 1 < 2 T for sufficiently large T T T , and we get:
ℓ 11 ∗ ( D ) > T c − b M b + 1 Eq. (36), R = T c (62) \ell_{11}^{*}(\mathcal{D}) > \frac{T^{c}-bM}{b+1}
\qquad\text{Eq. (36), } R=T^{c} \tag*{(62)} ℓ 11 ∗ ( D ) > b + 1 T c − b M Eq. (36), R = T c (62)
≥ T c − b T b + 1 M ≤ T (63) \ge\frac{T^{c}-bT}{b+1}
\qquad M\le T \tag*{(63)} ≥ b + 1 T c − b T M ≤ T (63)
> T c − 2 T 2 2 T b < 2 T (64) > \frac{T^{c}-2T^{2}}{2T}
\qquad b<2T \tag*{(64)} > 2 T T c − 2 T 2 b < 2 T (64)
= T c − 1 2 − T (65) = \frac{T^{c-1}}{2}-T \tag*{(65)} = 2 T c − 1 − T (65)
≥ T c − 1 4 T c − 2 ≥ 4 (66) \ge\frac{T^{c-1}}{4}
\qquad T^{c-2}\ge4 \tag*{(66)} ≥ 4 T c − 1 T c − 2 ≥ 4 (66)
which proves the second implication.
An N 1 − ε N^{1-\varepsilon} N 1 − ε -approximation would thus return objective below T c − 1 / 4 T^{c-1}/4 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 \mathcal{D} D , has length at most T + 2 q − 1 T + 2q - 1 T + 2 q − 1 .
Proof. Consider any token s s s of length d d d and any maximal run of r r r consecutive copies of s s s in the tokenisation of some encoded word enc ( x ) \operatorname{enc}(x) enc ( x ) .
If d < q d < q d < q and r ≥ 2 q r \ge2q r ≥ 2 q , then the overlap between the run and its shift by d d d has length at least
( r − 1 ) d ≥ 2 q − 1 ≥ q + 1. (67) (r-1)d \ge2q-1 \ge q+1. \tag*{(67)} ( r − 1 ) d ≥ 2 q − 1 ≥ q + 1. (67) This overlap therefore contains a complete occurrence of the marker 11. Since the run is periodic with period d d d , another occurrence of 11 appears exactly d d d positions later. However, by construction, 11 occurs only at the beginnings of encoded pairs, which are spaced q q q positions apart. Hence q q q divides d d d , contradicting d < q d < q d < q . Thus,
d < q ⟹ r ≤ 2 q − 1. (68) d<q \Longrightarrow r\le2q-1. \tag*{(68)} d < q ⟹ r ≤ 2 q − 1. (68) If d = q d=q d = q , three consecutive copies of s s 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 R R . Since R ≥ 2 R \ge2 R ≥ 2 , this is impossible, and hence r ≤ 2 r \le2 r ≤ 2 .
Finally, suppose d > q d > q d > q and r ≥ 2 r \ge2 r ≥ 2 . The first occurrence of s s s contains a complete marker 11, and the identical second occurrence contains the same marker exactly d d d positions later. As above, this implies that q q q divides d d d . Write d = k q d = kq d = k q . Since d > q d > q d > q , we have k ≥ 2 k \ge2 k ≥ 2 , so the first copy of s s s contains at least one complete encoded pair. The corresponding pair in the second copy lies exactly k k k blocks later and must be identical. The block indices cycle through 1 , … , R 1,\ldots,R 1 , … , R , so equality of the two encoded pairs implies
k ≡ 0 ( m o d R ) . (69) k \equiv0 \pmod{R}. \tag*{(69)} k ≡ 0 ( mod R ) . (69) Consequently, d ≥ R q d \ge Rq d ≥ R q . Since ∣ enc ( x ) ∣ = ∣ x ∣ R q |\operatorname{enc}(x)| = |x|Rq ∣ enc ( x ) ∣ = ∣ x ∣ R q , such a token can occur consecutively at most ∣ x ∣ ≤ T |x| \le T ∣ x ∣ ≤ T times.
Combining the three cases, every run of any token has length at most
b = T + 2 q − 1. (70) b=T+2q-1. \tag*{(70)} b = T + 2 q − 1. (70)
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.
Proof of thm:bucompressionnotapx (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 ) o(N / \log N) o ( N / log N ) -approximation on length-N N N datasets.
Proof. Suppose that there is a polynomial-time ρ \rho ρ -approximation algorithm for some constant ρ ≥ 1 \rho\ge1 ρ ≥ 1 . We use it to decide 3SAT in polynomial time. Given a 3SAT formula φ \varphi φ , we compute ( G , κ ) (G,\kappa) ( G , κ ) by Lemma 3, and let J 0 = d e f max { 9 λ + 1 , ⌈ 2 ρ / ( ε 0 λ 2 ) ⌉ } J_0 \mathrel{\overset{\mathrm{def}}{=}} \max\{9\lambda+1,\lceil2\rho/(\varepsilon_0\lambda^2)\rceil\} J 0 = def max { 9 λ + 1 , ⌈ 2 ρ / ( ε 0 λ 2 )⌉} .
Small graphs. If J < J 0 J < J_0 J < J 0 , we compute μ ( G ) \mu(G) μ ( G ) by enumerating all colourings, which takes constant time, and accept if and only if μ ( G ) ≥ κ \mu(G) \ge\kappa μ ( G ) ≥ κ . This is correct by Lemma 3, as κ − ε 0 J < κ \kappa-\varepsilon_0J < \kappa κ − ε 0 J < κ .
Large graphs. Otherwise, we compute ( w ~ , K ) = R ↑ ( G , κ ) (\widetilde{w},K)=R_{\uparrow}(G,\kappa) ( w , K ) = R ↑ ( G , κ ) , run the algorithm on the dataset { w ~ } \{\widetilde{w}\} { w } with budget K K K , and accept if and only if its merge sequence leaves at most ρ \rho ρ tokens. If φ \varphi φ is satisfiable, then μ ( G ) ≥ κ \mu(G) \ge\kappa μ ( G ) ≥ κ , so the optimal compressed length is 1 by Proposition 1(i), and the algorithm leaves at most ρ \rho ρ tokens. If φ \varphi φ is unsatisfiable, then μ ( G ) ≤ κ − ε 0 J \mu(G) \le\kappa-\varepsilon_0J μ ( G ) ≤ κ − ε 0 J , so by Proposition 1(ii), every feasible merge sequence leaves more than ε 0 2 λ 2 J ≥ ρ \frac{\varepsilon_0}{2}\lambda^2J \ge\rho 2 ε 0 λ 2 J ≥ ρ tokens.
All steps take polynomial time, so 3SAT would be in P, which contradicts its NP-hardness unless P = NP.
The same argument rules out much larger ratios. The string w ~ \widetilde{w} w has length N = q ( 4 M + 1 ) = Θ ( J log J ) N=q(4M+1)=\Theta(J\log J) N = q ( 4 M + 1 ) = Θ ( J log J ) , and thus J = Θ ( N / log N ) J=\Theta(N/\log N) J = Θ ( N / log N ) . Hence, for any ratio ρ ( N ) = o ( N / log N ) \rho(N)=o(N/\log N) ρ ( N ) = o ( N / log N ) , we have ρ ( N ) < ε 0 2 λ 2 J \rho(N)<\frac{\varepsilon_0}{2}\lambda^2J ρ ( N ) < 2 ε 0 λ 2 J once J J J exceeds some constant, below which we again enumerate all colourings. Accepting if and only if the algorithm leaves at most ρ ( N ) \rho(N) ρ ( N ) tokens then decides 3SAT as before.
Proof of thm:bulogliknotapx (Log-Likelihood)
For the log-likelihood objective, we use the following lower bound.
Lemma 2. If a tokenised dataset consists of F ≥ 2 F \ge2 F ≥ 2 tokens of at least two distinct types, its unigram negative log-likelihood is at least log F \log F log F .
Proof. Let s ⋆ s^\star s ⋆ be a most frequent token, and let q = d e f F − f s ⋆ q \mathrel{\overset{\mathrm{def}}{=}} F-f_{s^\star} q = def F − f s ⋆ count all other tokens. As at least two types occur, 1 ≤ q ≤ F − 1 1 \le q \le F-1 1 ≤ q ≤ F − 1 , and every token s ≠ s ⋆ s \ne s^\star s = s ⋆ has f s ≤ q f_s \le q f s ≤ q . Writing H 2 ( x ) = d e f − x log x − ( 1 − x ) log ( 1 − x ) \mathrm{H}_2(x) \mathrel{\overset{\mathrm{def}}{=}} -x\log x-(1-x)\log(1-x) H 2 ( x ) = def − x log x − ( 1 − x ) log ( 1 − x ) for the binary entropy,
L 1 = f s ⋆ log F f s ⋆ + ∑ s ≠ s ⋆ f s log F f s (71) \mathcal{L}_{1} = f_{s^\star}\log\frac{F}{f_{s^\star}}+\sum_{s\ne s^\star} f_s\log\frac{F}{f_s} \tag*{(71)} L 1 = f s ⋆ log f s ⋆ F + s = s ⋆ ∑ f s log f s F (71)
≥ ( F − q ) log F F − q + q log F q f s ≤ q for s ≠ s ⋆ (72) \ge(F-q)\log\frac{F}{F-q}+q\log\frac{F}{q}
\qquad f_s\le q\text{ for }s\ne s^\star \tag*{(72)} ≥ ( F − q ) log F − q F + q log q F f s ≤ q for s = s ⋆ (72)
= F ⋅ H 2 ( q F ) ≥ F ⋅ H 2 ( 1 F ) H 2 concave and symmetric (73) =F\cdot\mathrm{H}_2\left(\frac{q}{F}\right)\ge F\cdot\mathrm{H}_2\left(\frac{1}{F}\right)
\qquad\mathrm{H}_2\text{ concave and symmetric} \tag*{(73)} = F ⋅ H 2 ( F q ) ≥ F ⋅ H 2 ( F 1 ) H 2 concave and symmetric (73)
= log F + ( F − 1 ) log F F − 1 ≥ log F . (74) =\log F+(F-1)\log\frac{F}{F-1}\ge\log F. \tag*{(74)} = log F + ( F − 1 ) log F − 1 F ≥ log F . (74)
The inequality in the third line holds since a concave function attains its minimum over the interval [ 1 F , 1 − 1 F ] \left[\frac{1}{F},1-\frac{1}{F}\right] [ F 1 , 1 − F 1 ] at an endpoint, where H 2 \mathrm{H}_2 H 2 takes the same value.
Theorem 4. Unless P = N P \mathrm{P}=\mathrm{NP} P = NP , binary bottom-up tokenisation under the unigram negative log-likelihood objective G l l \mathcal{G}_{\mathrm{ll}} G ll is not in APX. In fact, it admits no polynomial-time o ( log N ) o(\log N) o ( log N ) -approximation on datasets of total length N N N .
Proof. For an output ( w ~ , K ) = R ↑ ( G , κ ) (\widetilde{w},K)=R_{\uparrow}(G,\kappa) ( w , K ) = R ↑ ( G , κ ) , consider the dataset D : = { w ~ , 0 } \mathcal{D}\mathrel{\mathop:}=\{\widetilde{w},0\} D : = { w , 0 } with budget K K K . No merge acts on the string 0 0 0 , which is always the single token 0 0 0 ; and every tokenisation of w ~ \widetilde{w} w contains a token with a 1 1 1 , which differs from 0 0 0 . So every merge sequence produces F ≥ 2 F\ge2 F ≥ 2 tokens of at least two types on D \mathcal{D} D , and by Lemma 2,
G l l ( tok ↑ [ m ] , D ) ≥ log F ≥ log 2. (75) \mathcal{G}_{\mathrm{ll}}(\operatorname{tok}_{\uparrow}^{[m]},\mathcal{D})\ge\log F\ge\log2. \tag*{(75)} G ll ( tok ↑ [ m ] , D ) ≥ log F ≥ log 2. (75)
In particular, the optimal objective is strictly positive. We now establish the gap.
YES instances. If μ ( G ) ≥ κ \mu(G)\ge\kappa μ ( G ) ≥ κ , the merge sequence of Proposition 1(i) tokenises D \mathcal{D} D into the two distinct tokens w ~ \widetilde{w} w and 0 0 0 , each with frequency 1 1 1 , so G l l ⋆ ( D ) ≤ 2 log 2 \mathcal{G}_{\mathrm{ll}}^\star(\mathcal{D})\le2\log2 G ll ⋆ ( D ) ≤ 2 log 2 .
NO instances. If μ ( G ) ≤ κ − ε 0 J \mu(G)\le\kappa-\varepsilon_0J μ ( G ) ≤ κ − ε 0 J , every feasible merge sequence leaves more than ε 0 2 λ 2 J \frac{\varepsilon_0}{2}\lambda^2J 2 ε 0 λ 2 J tokens on w ~ \widetilde{w} w by Proposition 1(ii), so F > ε 0 2 λ 2 J F>\frac{\varepsilon_0}{2}\lambda^2J F > 2 ε 0 λ 2 J , and G l l ⋆ ( D ) > log ( ε 0 2 λ 2 J ) \mathcal{G}_{\mathrm{ll}}^\star(\mathcal{D})>\log\left(\frac{\varepsilon_0}{2}\lambda^2J\right) G ll ⋆ ( D ) > log ( 2 ε 0 λ 2 J ) by Eq. (75) .
Deciding 3SAT. Suppose that there is a polynomial-time ρ \rho ρ -approximation algorithm for some constant ρ ≥ 1 \rho\ge1 ρ ≥ 1 . Given a 3SAT formula φ \varphi φ , we compute ( G , κ ) (G,\kappa) ( G , κ ) by Lemma 3, and let J 0 : = max { 9 λ + 1 , ⌈ 2 ⋅ 4 ρ / ( ε 0 λ 2 ) ⌉ } J_0\mathrel{\mathop:}=\max\{9\lambda+1,\lceil2\cdot4^\rho/(\varepsilon_0\lambda^2)\rceil\} J 0 : = max { 9 λ + 1 , ⌈ 2 ⋅ 4 ρ / ( ε 0 λ 2 )⌉} . If J < J 0 J<J_0 J < J 0 , we decide φ \varphi φ by enumerating all colourings of G G G , as in the proof of Theorem 3. Otherwise, we run the algorithm on D \mathcal{D} D with budget K K K , count the number F F F of tokens its merge sequence produces, and accept if and only if F ≤ 4 ρ F\le4^\rho F ≤ 4 ρ . If φ \varphi φ is satisfiable, the returned objective is at most 2 ρ log 2 2\rho\log2 2 ρ log 2 , so log F ≤ 2 ρ log 2 \log F\le2\rho\log2 log F ≤ 2 ρ log 2 by Eq. (75) , i.e., F ≤ 4 ρ F\le4^\rho F ≤ 4 ρ . If φ \varphi φ is unsatisfiable, every feasible merge sequence produces F > ε 0 2 λ 2 J ≥ 4 ρ F>\frac{\varepsilon_0}{2}\lambda^2J\ge4^\rho F > 2 ε 0 λ 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 = N P \mathrm{P}=\mathrm{NP} P = NP .
The same argument rules out ratios ρ ( N ) = o ( log N ) \rho(N)=o(\log N) ρ ( N ) = o ( log N ) , where N = ∣ w ~ ∣ + 1 N=|\widetilde{w}|+1 N = ∣ w ∣ + 1 . We accept if and only if F ≤ 4 ρ ( N ) F\le4^{\rho(N)} F ≤ 4 ρ ( N ) ; on YES instances this holds as before, while on NO instances
F > ε 0 2 λ 2 J = Θ ( N log N ) > N o ( 1 ) = 4 ρ ( N ) (76) F>\frac{\varepsilon_0}{2}\lambda^2J=\Theta\left(\frac{N}{\log N}\right)>N^{o(1)}=4^{\rho(N)} \tag*{(76)} F > 2 ε 0 λ 2 J = Θ ( log N N ) > N o ( 1 ) = 4 ρ ( N ) (76)
once J J J exceeds some constant. □ \square □
Maximum Cut on Cubic Graphs
Let G = ( V , E ) G=(\mathcal{V},\mathcal{E}) G = ( V , E ) be a finite, simple, undirected graph with J = ∣ V ∣ J=|\mathcal{V}| J = ∣ V ∣ vertices and I = ∣ E ∣ I=|\mathcal{E}| I = ∣ E ∣ edges; we call it cubic if every vertex has degree exactly 3 3 3 , in which case I = 3 2 J I=\frac{3}{2}J I = 2 3 J and J ≥ 4 J\ge4 J ≥ 4 . A colouring σ : V → { B , W } \sigma:\mathcal{V}\to\{B,W\} σ : 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:
cut G ( σ ) : = ∑ ( v , v ′ ) ∈ E 1 { σ ( v ) ≠ σ ( v ′ ) } . (77) \operatorname{cut}_{G}(\sigma)\mathrel{\mathop:}=\sum_{(v,v')\in\mathcal{E}}\mathbb{1}_{\{\sigma(v)\ne\sigma(v')\}}. \tag*{(77)} cut G ( σ ) : = ( v , v ′ ) ∈ E ∑ 1 { σ ( v ) = σ ( v ′ )} . (77)
Definition 2. Let G = ( V , E ) G=(\mathcal{V},\mathcal{E}) G = ( V , E ) be a simple cubic graph. Given a target κ ∈ N \kappa\in\mathbb{N} κ ∈ N , the 3-MAX-CUT decision problem requires deciding whether there exists a colouring σ \sigma σ with cut G ( σ ) ≥ κ \operatorname{cut}_{G}(\sigma)\ge\kappa cut G ( σ ) ≥ κ . The 3-MAX-CUT optimisation problem requires finding the maximum cut size. Formally:
κ ≤ ? max σ ∈ { B , W } V cut G ( σ ) μ ( G ) = max σ ∈ { B , W } V cut G ( σ ) (78) \kappa\mathrel{\mathop{\le}^{?}}\max_{\sigma\in\{B,W\}^{\mathcal{V}}}\operatorname{cut}_{G}(\sigma)
\qquad
\mu(G)=\max_{\sigma\in\{B,W\}^{\mathcal{V}}}\operatorname{cut}_{G}(\sigma) \tag*{(78)} κ ≤ ? σ ∈ { B , W } V max cut G ( σ ) μ ( G ) = σ ∈ { B , W } V max cut G ( σ ) (78)
Alimonti and Kann [2 ] proved that 3-MAX-CUT is APX-complete. We will also use the following standard facts.
Fact 1. Given a simple cubic graph G G G , a colouring σ \sigma σ 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 . (79) J \le\mu(G) \le I. \tag*{(79)} J ≤ μ ( G ) ≤ I . (79) 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 I I , so at most I I I moves occur. At termination, no vertex has more uncut than cut incident edges; as each vertex has degree 3 3 3 , it has at least two cut incident edges. Counting cut edges from both endpoints gives cut G ( σ ) ≥ 2 J / 2 = J \operatorname{cut}_G(\sigma) \ge2J/2 = J cut G ( σ ) ≥ 2 J /2 = J . The upper bound is trivial.
Lemma 3 (Gap maximum cut). There is a constant ε 0 > 0 \varepsilon_0 > 0 ε 0 > 0 and a polynomial-time algorithm which maps every 3SAT formula φ \varphi φ to a pair ( G , κ ) (G,\kappa) ( G , κ ) , where G G G is a simple cubic graph with J J J vertices and κ ≤ I \kappa\le I κ ≤ I , such that
φ satisfiable ⟹ μ ( G ) ≥ κ , (80) \varphi\ \text{satisfiable} \Longrightarrow\mu(G) \ge\kappa, \tag*{(80)} φ satisfiable ⟹ μ ( G ) ≥ κ , (80) φ unsatisfiable ⟹ μ ( G ) ≤ κ − ε 0 J . (81) \varphi\ \text{unsatisfiable} \Longrightarrow\mu(G) \le\kappa- \varepsilon_0 J. \tag*{(81)} φ unsatisfiable ⟹ μ ( G ) ≤ κ − ε 0 J . (81) Proof. By the PCP theorem and Håstad [14 ] , there are constants 0 < s < c ≤ 1 0 < s < c \le1 0 < s < c ≤ 1 such that it is NP-hard to decide whether a MAX-E2-LIN2 instance has a c c c -fraction or at most an s s s -fraction of its equations simultaneously satisfiable, and this hardness is witnessed by a polynomial-time reduction from 3SAT. Berman and Karpinski [8 ] 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 φ \varphi φ , a simple cubic graph G G G and thresholds κ y e s > κ n o \kappa_{\mathrm{yes}} > \kappa_{\mathrm{no}} κ yes > κ no with κ y e s − κ n o = Θ ( I ) = Θ ( J ) \kappa_{\mathrm{yes}} - \kappa_{\mathrm{no}} = \Theta(I) = \Theta(J) κ yes − κ no = Θ ( I ) = Θ ( J ) , such that μ ( G ) ≥ κ y e s \mu(G) \ge\kappa_{\mathrm{yes}} μ ( G ) ≥ κ yes if φ \varphi φ is satisfiable and μ ( G ) ≤ κ n o \mu(G) \le\kappa_{\mathrm{no}} μ ( G ) ≤ κ no otherwise. Setting κ ≔ κ y e s ≤ I \kappa\coloneqq\kappa_{\mathrm{yes}} \le I κ : = κ yes ≤ I and choosing ε 0 \varepsilon_0 ε 0 such that κ y e s − κ n o ≥ ε 0 J \kappa_{\mathrm{yes}} - \kappa_{\mathrm{no}} \ge\varepsilon_0J κ yes − κ no ≥ ε 0 J proves the lemma.
Definition 3. Let G = ( V , E ) G = (\mathcal{V}, \mathcal{E}) G = ( V , E ) be a graph and t ≥ 1 t \ge1 t ≥ 1 an integer. Its t t t -blow-up G t = ( V t , E t ) G_t = (\mathcal{V}_t, \mathcal{E}_t) G t = ( V t , E t ) has vertices V t ≔ V × { 1 , … , t } \mathcal{V}_t \coloneqq\mathcal{V} \times\{1,\ldots,t\} V t : = V × { 1 , … , t } and edges
E t ≔ { ( ( v , k ) , ( v ′ , k ′ ) ) ∣ { v , v ′ } ∈ E , 1 ≤ k , k ′ ≤ t } . (82) \mathcal{E}_t \coloneqq\{((v,k),(v',k')) \mid\{v,v'\} \in\mathcal{E},\ 1 \le k,k' \le t\}. \tag*{(82)} E t : = {(( v , k ) , ( v ′ , k ′ )) ∣ { v , v ′ } ∈ E , 1 ≤ k , k ′ ≤ t } . (82) Each vertex thus becomes a cluster of t t t clones, and each edge a complete bipartite graph between two clusters. If G G G is cubic, G t G_t G t is a simple 3 t 3t 3 t -regular graph with t J tJ t J vertices and t 2 I t^2 I t 2 I edges (Figure 3 ).
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.
Lemma 4. Let G G G be a simple graph and t ≥ 1 t \ge1 t ≥ 1 .
(a) A colouring σ G \sigma_G σ G of G G G induces the colouring σ \sigma σ of G t G_t G t which gives every clone ( v , k ) (v,k) ( v , k ) the colour σ G ( v ) \sigma_G(v) σ G ( v ) , and cut G t ( σ ) = t 2 cut G ( σ G ) \operatorname{cut}_{G_t}(\sigma) = t^2\operatorname{cut}_G(\sigma_G) cut G t ( σ ) = t 2 cut G ( σ G ) .
(b) μ ( G t ) = t 2 μ ( G ) \mu(G_t) = t^2\mu(G) μ ( G t ) = t 2 μ ( G ) .
Proof. Part (a): every cut edge of G G G yields t 2 t^2 t 2 cut edges of G t G_t G t , and no other edge is cut. Part (b): part (a) gives μ ( G t ) ≥ t 2 μ ( G ) \mu(G_t) \ge t^2\mu(G) μ ( G t ) ≥ t 2 μ ( G ) . Conversely, let σ \sigma σ be any colouring of G t G_t G t , and let x v ∈ { 0 , … , t } x_v \in\{0,\ldots,t\} x v ∈ { 0 , … , t } be the number of clones of v v v coloured B. Then
cut G t ( σ ) = ∑ { v , v ′ } ∈ E ( x v ( t − x v ′ ) + ( t − x v ) x v ′ ) . (83) \operatorname{cut}_{G_t}(\sigma)=\sum_{\{v,v'\}\in\mathcal{E}}\left(x_v(t-x_{v'})+(t-x_v)x_{v'}\right). \tag*{(83)} cut G t ( σ ) = { v , v ′ } ∈ E ∑ ( x v ( t − x v ′ ) + ( t − x v ) x v ′ ) . (83)
As G G G has no loops, this sum is affine in each x v x_v x v when all other counts are fixed, and is thus maximised at x v = 0 x_v=0 x v = 0 or x v = t x_v=t x v = 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 \sigma_G σ G of G G G . Hence cut G t ( σ ) ≤ t 2 cut G ( σ G ) ≤ t 2 μ ( G ) \operatorname{cut}_{G_t}(\sigma)\le t^2\operatorname{cut}_G(\sigma_G)\le t^2\mu(G) cut G t ( σ ) ≤ t 2 cut G ( σ G ) ≤ t 2 μ ( G ) .
The Reduction
We reduce from the gap version of 3-MAX-CUT in Lemma 3, using the notation of §B.3: G = ( V , E ) G=(\mathcal{V},\mathcal{E}) G = ( V , E ) is a simple cubic graph with J J J vertices and I = 3 2 J I=\frac{3}{2}J I = 2 3 J edges, and μ ( G ) \mu(G) μ ( G ) is the size of its maximum cut. Given an instance ( G , κ ) (G,\kappa) ( G , κ ) , our reduction proceeds in three stages: it blows up G G G , writes down a source string over a large alphabet, and encodes this string in binary.
Stage 1: blowing up the graph. Fix the constant λ : = ⌈ 40 / ε 0 ⌉ \lambda\mathrel{\mathop:}=\left\lceil40/\varepsilon_0\right\rceil λ : = ⌈ 40/ ε 0 ⌉ , and let G λ = ( V λ , E λ ) G_\lambda=(\mathcal{V}_\lambda,\mathcal{E}_\lambda) G λ = ( V λ , E λ ) be the λ \lambda λ -blow-up of G G G (Definition 3). It is a simple 3 λ 3\lambda 3 λ -regular graph with λ J \lambda J λ J vertices, and μ ( G λ ) = λ 2 μ ( G ) \mu(G_\lambda)=\lambda^2\mu(G) μ ( G λ ) = λ 2 μ ( G ) by Lemma 4(b). This is the graph G λ G_\lambda G λ of Reduction 2, whose copy v j , n v_{j,n} v j , n is the clone ( v j , n ) (v_j,n) ( v j , n ) .
Stage 2: a source string. An arc is an edge of G λ G_\lambda G λ with a direction; the set of arcs is
A λ : = { ( v , v ′ ) ∣ { v , v ′ } ∈ E λ } , ∣ A λ ∣ = 3 λ 2 J . (84) \mathcal{A}_\lambda\mathrel{\mathop:}=\{(v,v')\mid\{v,v'\}\in\mathcal{E}_\lambda\},\qquad|\mathcal{A}_\lambda|=3\lambda^2J. \tag*{(84)} A λ : = {( v , v ′ ) ∣ { v , v ′ } ∈ E λ } , ∣ A λ ∣ = 3 λ 2 J . (84)
A walk is a string ω = v v ′ v ′ ′ \omega=vv'v'' ω = v v ′ v ′′ of three vertices such that ( v , v ′ ) (v,v') ( v , v ′ ) and ( v ′ , v ′ ′ ) (v',v'') ( v ′ , v ′′ ) are arcs, where v = v ′ ′ v=v'' v = v ′′ is allowed; we call these two arcs the bigrams of ω \omega ω . Let Ω : = walk ( G λ ) \Omega\mathrel{\mathop:}=\operatorname{walk}(G_\lambda) Ω : = 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
M : = ∣ Ω ∣ = λ J ⋅ ( 3 λ ) 2 = 9 λ 3 J . (85) M\mathrel{\mathop:}=|\Omega|=\lambda J\cdot(3\lambda)^2=9\lambda^3J. \tag*{(85)} M : = ∣Ω∣ = λ J ⋅ ( 3 λ ) 2 = 9 λ 3 J . (85)
We list the walks in an arbitrary order ω 1 , … , ω M \omega_1,\ldots,\omega_M ω 1 , … , ω M and define the source string w : = graph2str ( G λ ) \mathbf{w}\mathrel{\mathop:}=\operatorname{graph2str}(G_\lambda) w : = graph2str ( G λ ) as
graph2str ( G λ ) : = ω 1 ⋄ χ 1 ω 2 ⋄ χ 2 ⋯ ω M ⋄ χ M # , (86) \operatorname{graph2str}(G_\lambda)\mathrel{\mathop:}=\omega_1\diamond\chi_1\omega_2\diamond\chi_2\cdots\omega_M\diamond\chi_M\#, \tag*{(86)} graph2str ( G λ ) : = ω 1 ⋄ χ 1 ω 2 ⋄ χ 2 ⋯ ω M ⋄ χ M # , (86)
in which every walk is followed by a separator ⋄ χ i \diamond\chi_i ⋄ χ i , with χ i ∈ { 1 , … , 9 λ 2 } \chi_i\in\{1,\ldots,9\lambda^2\} χ 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 Γ \Gamma Γ for the set of symbols occurring in w \mathbf{w} w : the λ J \lambda J λ J vertices, at most 9 λ 2 9\lambda^2 9 λ 2 separators, and # \# # . The source string has length ∣ w ∣ = 4 M + 1 |\mathbf{w}|=4M+1 ∣ w ∣ = 4 M + 1 , and Figure 4 shows an example. The separators ensure that only walk bigrams repeat in w \mathbf{w} w .
Figure 4. The source string of Eq. (86) , for the path a a a –b b b –c c c and λ = 1 \lambda= 1 λ = 1 (for illustration only, as this graph is not cubic). (a) The graph has four arcs and six walks, a b a aba aba , a b c abc ab c , c b a cba c ba , c b c cbc c b c , b a b bab bab , and b c b bcb b c b ; with distinct separators, its source string is w = a b a ⋄ 1 a b c ⋄ 2 c b a ⋄ 3 c b c ⋄ 4 b a b ⋄ 5 b c b ⋄ 6 # \mathbf{w} = aba\diamond_1abc\diamond_2cba\diamond_3cbc\diamond_4bab\diamond_5bcb\diamond_6\# w = aba ⋄ 1 ab c ⋄ 2 c ba ⋄ 3 c b c ⋄ 4 bab ⋄ 5 b c b ⋄ 6 # , of length 4 M + 1 = 25 4M + 1 = 25 4 M + 1 = 25 . (b) A maximum cut, with b b b coloured B and a a a , c c c coloured W. The two arcs from B to W are kept (solid); the other two arcs, ( a , b ) (a,b) ( a , b ) and ( c , b ) (c,b) ( c , b ) , are merged (dashed) and form the covering set U ⋆ U^\star U ⋆ of Lemma 6. (c) Merging these two bigrams shortens every walk by one token (phase 1 of Lemma 7 ). The remaining 3 M + 1 = 19 3M + 1 = 19 3 M + 1 = 19 tokens are then joined by 18 merges (phase 2), so collapsing w \mathbf{w} w takes ν = 2 + 18 = 20 \nu= 2 + 18 = 20 ν = 2 + 18 = 20 merges, as given by Eq. (89) . (d) Keeping arcs which enter and leave the same vertex (here, ( a , b ) (a,b) ( a , b ) and ( b , c ) (b,c) ( b , c ) at b b b ) leaves a walk with no merged bigram (here, a b c abc ab c ): the kept arcs of a covering set must form a cut.
Lemma 5 (Uniqueness). The source string w \mathbf{w} w satisfies the following:
(a) every bigram of w \mathbf{w} w containing a separator or $# occurs only once in w \mathbf{w} w ;
(b) every substring of w \mathbf{w} w of length at least 3 occurs only once in w \mathbf{w} w ;
(c) any two adjacent vertices in w \mathbf{w} w lie in the same walk, and thus form one of its bigrams.
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 v v followed by a separator ⋄ χ \diamond_\chi ⋄ χ marks the end of a walk which ends in v v v ; by our choice of separators, no other walk ending in v v v is followed by ⋄ χ \diamond_\chi ⋄ χ , 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.
Stage 3: a binary encoding. Let L : = ⌈ log 2 ∣ Γ ∣ ⌉ L \mathrel{\mathop:}= \lceil\log_2 |\Gamma| \rceil L : = ⌈ log 2 ∣Γ∣ ⌉ , and give every symbol a ∈ Γ a \in\Gamma a ∈ Γ a distinct identifier id ( a ) = y 1 ⋯ y L ∈ { 0 , 1 } L \operatorname{id}(a) = y_1 \cdots y_L \in\{0,1\}^L id ( a ) = y 1 ⋯ y L ∈ { 0 , 1 } L . We encode a a a by its codeword bin ( a ) \operatorname{bin}(a) bin ( a ) , which we write a ~ \widetilde{a} a for short; it consists of two copies of a half-word ⟨ a ⟩ \langle a\rangle ⟨ a ⟩ , followed by a 0 0 0 :
⟨ a ⟩ : = 11 y 1 0 y 2 ⋯ 0 y L 0 , a ~ : = ⟨ a ⟩ ∘ ⟨ a ⟩ ∘ 0. (87) \langle a\rangle\mathrel{\mathop:}= 11y_1 0y_2 \cdots0y_L 0,\qquad\widetilde{a} \mathrel{\mathop:}= \langle a\rangle\circ\langle a\rangle\circ0. \tag*{(87)} ⟨ a ⟩ : = 11 y 1 0 y 2 ⋯ 0 y L 0 , a : = ⟨ a ⟩ ∘ ⟨ a ⟩ ∘ 0. (87)
We encode a string c = a 1 ⋯ a m ∈ Γ + \mathbf{c} = a_1 \cdots a_m \in\Gamma^+ c = a 1 ⋯ a m ∈ Γ + codeword by codeword, as c ~ : = ◯ i = 1 m bin ( a i ) = a ~ 1 ∘ ⋯ ∘ a ~ m \widetilde{\mathbf{c}} \mathrel{\mathop:}= \bigcirc_{i=1}^{m} \operatorname{bin}(a_i) = \widetilde{a}_1 \circ\cdots\circ\widetilde{a}_m c : = ◯ i = 1 m bin ( a i ) = a 1 ∘ ⋯ ∘ a m . Half-words have length r : = 2 L + 3 r \mathrel{\mathop:}= 2L + 3 r : = 2 L + 3 , and codewords length q : = 2 r + 1 q \mathrel{\mathop:}= 2r + 1 q : = 2 r + 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 (Figure 5 ). Centres play no role in the reduction itself, but are our main tool to analyse it in §B.7.
Figure 5. The binary encoding of Eq. (87) . (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 ⟩ \langle a\rangle\circ0 \circ\langle b\rangle ⟨ a ⟩ ∘ 0 ∘ ⟨ b ⟩ , so a token containing both reveals both symbols (Lemma 10).
Reduction 3 (Full version of Reduction 2). Given an instance ( G , κ ) (G,\kappa) ( G , κ ) of Lemma 3, construct the source string w \mathbf{w} w as above, and output the dataset D : = { w } \mathcal{D} \mathrel{\mathop:}= \{\mathbf{w}\} D : = { w } over the alphabet Σ : = { 0 , 1 } \Sigma\mathrel{\mathop:}= \{0,1\} Σ : = { 0 , 1 } , together with the budget
K ≔ H + 3 M + ∣ A λ ∣ − λ 2 κ , (88) K \coloneqq H + 3M + |A_\lambda| - \lambda^2\kappa, \tag*{(88)} K : = H + 3 M + ∣ A λ ∣ − λ 2 κ , (88)
where H ≔ ∣ m p r e p ∣ H \coloneqq|\mathbf{m}_{\mathrm{prep}}| H : = ∣ m prep ∣ is the number of merges in the sequence m p r e p \mathbf{m}_{\mathrm{prep}} m prep of Lemma 8 , which builds the codewords.
We write R ↑ ( G , κ ) R_{\uparrow}(G,\kappa) R ↑ ( G , κ ) for the output ( w ~ , K ) (\widetilde{\mathbf{w}},K) ( w , K ) . Since κ ≤ I \kappa\le I κ ≤ I (Lemma 3), we have λ 2 κ ≤ ∣ A λ ∣ \lambda^2\kappa\le|A_\lambda| λ 2 κ ≤ ∣ A λ ∣ , and thus K > 0 K > 0 K > 0 . As λ \lambda λ is a constant, ∣ Γ ∣ = O ( J ) |\Gamma| = O(J) ∣Γ∣ = O ( J ) , L = O ( log J ) L = O(\log J) L = O ( log J ) , and ∣ w ~ ∣ = q ( 4 M + 1 ) = O ( J log J ) |\widetilde{\mathbf{w}}| = q(4M+1) = O(J\log J) ∣ w ∣ = q ( 4 M + 1 ) = O ( J log J ) ; all three stages run in polynomial time.
The Gap
Both implications revolve around the collapse cost
ν ≔ 3 M + ∣ A λ ∣ − λ 2 μ ( G ) , (89) \nu\coloneqq3M + |A_\lambda| - \lambda^2\mu(G), \tag*{(89)} ν : = 3 M + ∣ A λ ∣ − λ 2 μ ( G ) , (89)
the number of merges needed to tokenise the source string w \mathbf{w} w as a single token. Collapsing w \mathbf{w} w naively takes ∣ w ∣ − 1 = 4 M |\mathbf{w}|-1=4M ∣ w ∣ − 1 = 4 M 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 ) M-|A_\lambda|+\lambda^2\mu(G) M − ∣ A λ ∣ + λ 2 μ ( G ) merges in total (see Figure 4 ). Conversely, no merge sequence does better, even over the binary alphabet: a merge sequence which is x x x merges short of ν \nu ν leaves at least x + 1 x+1 x + 1 tokens. The budget K K K pays for building the codewords, plus the collapse cost of a graph with maximum cut κ \kappa κ . 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 \varepsilon_0\lambda^2J-H ε 0 λ 2 J − H , which is more than ε 0 2 λ 2 J \frac{\varepsilon_0}{2}\lambda^2J 2 ε 0 λ 2 J by our choice of λ \lambda λ .
Proposition 1. Let ( w ~ , K ) = R ↑ ( G , κ ) (\widetilde{\mathbf{w}},K)=R_{\uparrow}(G,\kappa) ( w , K ) = R ↑ ( G , κ ) , where G G G has J ≥ 9 λ + 1 J\ge9\lambda+1 J ≥ 9 λ + 1 vertices.
(i) Forward implication. If μ ( G ) ≥ κ \mu(G)\ge\kappa μ ( G ) ≥ κ , then some merge sequence m \mathbf{m} m with ∣ m ∣ ≤ K |\mathbf{m}|\le K ∣ m ∣ ≤ K tokenises w ~ \widetilde{\mathbf{w}} w as a single token.
(ii) Backward implication. If some merge sequence m \mathbf{m} m with ∣ m ∣ ≤ K |\mathbf{m}|\le K ∣ m ∣ ≤ K leaves at most ε 0 2 λ 2 J \frac{\varepsilon_0}{2}\lambda^2J 2 ε 0 λ 2 J tokens on w ~ \widetilde{\mathbf{w}} w , then μ ( G ) > κ − ε 0 J \mu(G)>\kappa-\varepsilon_0J μ ( G ) > κ − ε 0 J .
In particular, if μ ( G ) ≥ κ \mu(G)\ge\kappa μ ( G ) ≥ κ , the optimal compressed length of { w ~ } \{\widetilde{\mathbf{w}}\} { w } is 1 1 1 ; and if μ ( G ) ≤ κ − ε 0 J \mu(G)\le\kappa-\varepsilon_0J μ ( G ) ≤ κ − ε 0 J , every merge sequence with ∣ m ∣ ≤ K |\mathbf{m}|\le K ∣ m ∣ ≤ K leaves more than ε 0 2 λ 2 J \frac{\varepsilon_0}{2}\lambda^2J 2 ε 0 λ 2 J tokens on w ~ \widetilde{\mathbf{w}} w .
Proof of the Forward Implication
We now build a merge sequence which collapses w ~ \widetilde{\mathbf{w}} w into a single token. We proceed in three steps: we relate maximum cuts to sets of bigrams which shorten every walk (Lemma 6); we use such a set to collapse w \mathbf{w} w with ν \nu ν merges (Lemma 7 ); and we transfer this collapse to w ~ \widetilde{\mathbf{w}} w (Lemmas 8 and 9).
We say that a set of arcs U ⊆ A λ U\subseteq A_\lambda U ⊆ A λ covers a walk if it contains one of the walk’s bigrams, and we write cov ( U ) \operatorname{cov}(U) cov ( U ) for the number of walks covered by U U U . Merging the bigrams in U U 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 U U which covers all walks has ∣ U ∣ ≥ ∣ A λ ∣ − λ 2 μ ( G ) |U|\ge|A_\lambda|-\lambda^2\mu(G) ∣ U ∣ ≥ ∣ A λ ∣ − λ 2 μ ( G ) , and some such set U ⋆ U^\star U ⋆ attains equality.
(b) Every set of arcs U ⊆ A λ U\subseteq A_\lambda U ⊆ A λ satisfies cov ( U ) − ∣ U ∣ ≤ M − ∣ A λ ∣ + λ 2 μ ( G ) \operatorname{cov}(U)-|U|\le M-|A_\lambda|+\lambda^2\mu(G) cov ( U ) − ∣ U ∣ ≤ M − ∣ A λ ∣ + λ 2 μ ( G ) .
Proof. We prove the two parts separately.
Part (a), lower bound. Let U U U cover all walks, and call the arcs not in U U U kept. No vertex v ′ v' v ′ has both a kept arc ( v , v ′ ) (v,v') ( v , v ′ ) entering it and a kept arc ( v ′ , v ′ ′ ) (v',v'') ( v ′ , v ′′ ) leaving it, as the walk v v ′ v ′ ′ vv'v'' v v ′ v ′′ would then not be covered (Figure 4 d). Now colour every vertex with a kept arc leaving it B B B , and all other vertices W W W . Every kept arc ( v , v ′ ) (v,v') ( v , v ′ ) then crosses this cut from B B B to W W W : v v v is coloured B B B since ( v , v ′ ) (v,v') ( v , v ′ ) leaves it, and v ′ v' v ′ is coloured W W W since ( v , v ′ ) (v,v') ( v , v ′ ) enters it, so no kept arc leaves it. Moreover, two kept arcs never lie on the same edge, as ( v , v ′ ) (v,v') ( v , v ′ ) and ( v ′ , v ) (v',v) ( v ′ , v ) would both enter and leave v ′ v' v ′ . The kept arcs thus lie on distinct cut edges, and by Lemma 4,
∣ A λ ∣ − ∣ U ∣ ≤ μ ( G λ ) = λ 2 μ ( G ) . (90) |\mathcal{A}_{\lambda}|-|\mathcal{U}| \le\mu(G_{\lambda})=\lambda^2\mu(G). \tag*{(90)} ∣ A λ ∣ − ∣ U ∣ ≤ μ ( G λ ) = λ 2 μ ( G ) . (90)
Part (a), equality. Take a colouring of G λ G_{\lambda} G λ with maximum cut, and let U ⋆ \mathcal{U}^{\star} U ⋆ contain all arcs except those from a B B B vertex to a W W W vertex (Figure 4 b). Then ∣ A λ ∣ − ∣ U ⋆ ∣ = μ ( G λ ) = λ 2 μ ( G ) |\mathcal{A}_{\lambda}|-|\mathcal{U}^{\star}|=\mu(G_{\lambda})=\lambda^2\mu(G) ∣ A λ ∣ − ∣ U ⋆ ∣ = μ ( G λ ) = λ 2 μ ( G ) . Moreover, U ⋆ \mathcal{U}^{\star} U ⋆ covers every walk v v ′ v ′ ′ vv'v'' v v ′ v ′′ : otherwise, both ( v , v ′ ) (v,v') ( v , v ′ ) and ( v ′ ′ , v ′ ) (v'',v') ( v ′′ , v ′ ) would go from a B B B vertex to a W W W vertex, and v ′ v' v ′ would be coloured both W W W and B B B .
Part (b). Given U \mathcal{U} 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 ) |\mathcal{U}|+M-\operatorname{cov}(\mathcal{U}) ∣ U ∣ + M − cov ( U ) arcs, so by part (a),
∣ A λ ∣ − λ 2 μ ( G ) ≤ ∣ U ∣ + M − cov ( U ) . (91) |\mathcal{A}_{\lambda}|-\lambda^2\mu(G)\le|\mathcal{U}|+M-\operatorname{cov}(\mathcal{U}). \tag*{(91)} ∣ A λ ∣ − λ 2 μ ( G ) ≤ ∣ U ∣ + M − cov ( U ) . (91)
Rearranging gives part (b).
Lemma 7 (Collapsing the source string). There is a merge sequence m s r c \mathbf{m}_{\mathrm{src}} m src with ∣ m s r c ∣ = ν |\mathbf{m}_{\mathrm{src}}|=\nu ∣ m src ∣ = ν which tokenises w w w as a single token.
Proof. Let U ⋆ \mathcal{U}^{\star} U ⋆ be the covering set of Lemma 6(a), with ∣ U ⋆ ∣ = ∣ A λ ∣ − λ 2 μ ( G ) |\mathcal{U}^{\star}|=|\mathcal{A}_{\lambda}|-\lambda^2\mu(G) ∣ U ⋆ ∣ = ∣ A λ ∣ − λ 2 μ ( G ) . We build m s r c \mathbf{m}_{\mathrm{src}} m src in two phases.
Phase 1: merging bigrams (Figure 4 c). For every arc ( v , v ′ ) ∈ U ⋆ (v,v')\in\mathcal{U}^{\star} ( v , v ′ ) ∈ U ⋆ , in arbitrary order, we merge v ∘ v ′ v\mathbin{\circ}v' v ∘ v ′ . By Lemma 5(c), two adjacent vertices only occur inside walks, and since v ≠ v ′ v\ne v' v = v ′ , the occurrences of the pair never overlap. So a merge v ∘ v ′ v\mathbin{\circ}v' v ∘ v ′ only changes the walks which have ( v , v ′ ) (v,v') ( 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 ⋆ \mathcal{U}^{\star} U ⋆ covers all walks, every walk is shortened by exactly one token. This phase uses ∣ U ⋆ ∣ |\mathcal{U}^{\star}| ∣ U ⋆ ∣ merges and leaves ∣ w ∣ − M = 3 M + 1 |w|-M=3M+1 ∣ w ∣ − M = 3 M + 1 tokens, the last of which is # \# # .
Phase 2: merging from the right. Let s 1 , … , s 3 M + 1 s_1,\ldots,s_{3M+1} s 1 , … , s 3 M + 1 be the current tokens. For i = 3 M , … , 1 i=3M,\ldots,1 i = 3 M , … , 1 , in this order, we merge s i ∘ s i + 1 ∘ ⋯ ∘ s 3 M + 1 s_i\mathbin{\circ}s_{i+1}\mathbin{\circ}\cdots\mathbin{\circ}s_{3M+1} s i ∘ s i + 1 ∘ ⋯ ∘ s 3 M + 1 . The right token of this merge contains # \# # and thus occurs only once, so the merge combines s i s_i s i with the token to its right. After these 3 M 3M 3 M merges, a single token remains.
In total, ∣ m s r c ∣ = ∣ U ⋆ ∣ + 3 M = ν |\mathbf{m}_{\mathrm{src}}|=|\mathcal{U}^{\star}|+3M=\nu ∣ m src ∣ = ∣ U ⋆ ∣ + 3 M = ν .
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 m p r e p \mathbf{m}_{\mathrm{prep}} m prep with H = ∣ m p r e p ∣ < 10 ∣ Γ ∣ H=|\mathbf{m}_{\mathrm{prep}}|<10|\Gamma| H = ∣ m prep ∣ < 10∣Γ∣ which, for every string c = a 1 ⋯ a m ∈ Γ + \mathbf{c}=a_1\cdots a_m\in\Gamma^+ c = a 1 ⋯ a m ∈ Γ + , gives
tok ↑ [ m p r e p ] ( c ~ ) = ⟨ a ~ 1 , … , a ~ m ⟩ . (92) \operatorname{tok}_{\uparrow}[\mathbf{m}_{\mathrm{prep}}](\widetilde{\mathbf{c}})=\langle\widetilde{a}_1,\ldots,\widetilde{a}_m\rangle. \tag*{(92)} tok ↑ [ m prep ] ( c ) = ⟨ a 1 , … , a m ⟩ . (92)
Proof. The sequence m p r e p \mathbf{m}_{\mathrm{prep}} m prep consists of three stages:
markers: merge 1 ∘ 1 1\mathbin{\circ}1 1 ∘ 1 ;
half-words: for k = 3 , … , r k=3,\ldots,r k = 3 , … , r , in this order: for every string s s s of length k − 1 k-1 k − 1 and character c ∈ { 0 , 1 } c\in\{0,1\} c ∈ { 0 , 1 } such that s ∘ c s\mathbin{\circ}c s ∘ c is a prefix of some half-word, merge s ∘ c s\mathbin{\circ}c s ∘ c ;
codewords: for every a ∈ Γ a\in\Gamma a ∈ Γ , merge ⟨ a ⟩ ∘ ⟨ a ⟩ \langle a\rangle\mathbin{\circ}\langle a\rangle ⟨ a ⟩ ∘ ⟨ a ⟩ , and then ⟨ a ⟩ ∘ ⟨ a ⟩ ∘ 0 \langle a\rangle\mathbin{\circ}\langle a\rangle\mathbin{\circ}0 ⟨ a ⟩ ∘ ⟨ a ⟩ ∘ 0 .
Correctness. We follow an encoded string through the three stages.
Stage (i): markers. In an encoded string, every pair of adjacent 1 1 1 s starts a half-word, and is preceded by a 0 0 0 (or the string’s start) and followed by a 0 0 0 . Stage (i) thus merges exactly the first two characters of every half-word.
Stage (ii): half-words. We show, by induction on k k k , that after the iteration for k k k , the first k k k characters of every half-word form a single token, and all other characters are single-character tokens. For k = 2 k=2 k = 2 , this is the state after stage (i). Now let 3 ≤ k ≤ r 3\le k\le r 3 ≤ k ≤ r , and assume the claim for k − 1 k-1 k − 1 . Then every token s s s with at least two characters is the prefix of length k − 1 k-1 k − 1 of a half-word, at its start, and is followed by the k k k -th character c c c of that half-word as a single-character token. The merge s ⊛ c s \mathbin{\circledast} c s ⊛ c thus applies exactly at the half-words starting with s ∘ c s \circ c s ∘ c . Each half-word is therefore extended by exactly one merge of this iteration; the resulting token has length k k k , so no later merge of the iteration, whose left token has length k − 1 k-1 k − 1 , matches it. After iteration r r r , the encoded string is thus tokenised as ⟨ ⟨ a 1 ⟩ , ⟨ a 1 ⟩ , 0 , ⟨ a 2 ⟩ , ⟨ a 2 ⟩ , 0 , … ⟩ \langle\langle a_1\rangle,\langle a_1\rangle,0,\langle a_2\rangle,\langle a_2\rangle,0,\ldots\rangle ⟨⟨ a 1 ⟩ , ⟨ a 1 ⟩ , 0 , ⟨ a 2 ⟩ , ⟨ a 2 ⟩ , 0 , … ⟩ .
Stage (iii): codewords. As distinct symbols have distinct half-words, each token ⟨ a ⟩ \langle a\rangle ⟨ a ⟩ occurs in runs of exactly two. The merge ⟨ a ⟩ ⊛ ⟨ a ⟩ \langle a\rangle\mathbin{\circledast} \langle a\rangle ⟨ a ⟩ ⊛ ⟨ a ⟩ thus joins the two halves of every codeword of a a a , and the next merge appends the trailing 0 0 0 .
Size. Stages (i) and (ii) use one merge per distinct half-word prefix of length between 2 and r r r . For each j ∈ { 1 , … , L } j \in\{1,\ldots,L\} j ∈ { 1 , … , L } , the prefixes ending with 0 0 0 just before bit y j y_j y j number at most 2 j − 1 2^{j-1} 2 j − 1 , and those ending with y j y_j y j at most 2 j 2^j 2 j ; there is one prefix of length 2, and at most ∣ Γ ∣ |\Gamma| ∣Γ∣ of length r r r . Stage (iii) uses 2 ∣ Γ ∣ 2|\Gamma| 2∣Γ∣ merges. As 2 L < 2 ∣ Γ ∣ 2^L < 2|\Gamma| 2 L < 2∣Γ∣ , we get
H ≤ 1 + ∑ j = 1 L ( 2 j − 1 + 2 j ) + 3 ∣ Γ ∣ = 3 ⋅ 2 L − 2 + 3 ∣ Γ ∣ < 10 ∣ Γ ∣ . (93) H \le1+\sum_{j=1}^{L}(2^{j-1}+2^j)+3|\Gamma|=3\cdot2^L-2+3|\Gamma|<10|\Gamma|. \tag*{(93)} H ≤ 1 + j = 1 ∑ L ( 2 j − 1 + 2 j ) + 3∣Γ∣ = 3 ⋅ 2 L − 2 + 3∣Γ∣ < 10∣Γ∣. (93)
Lemma 9 (Simulating merges). Let m m m be a merge sequence over Γ \Gamma Γ , and let c ∈ Γ + c \in\Gamma^+ c ∈ Γ + . If tok ↑ [ m ] ( c ) = ⟨ s 1 , … , s n ⟩ \operatorname{tok}_{\uparrow}[m](c)=\langle s_1,\ldots,s_n\rangle tok ↑ [ m ] ( c ) = ⟨ s 1 , … , s n ⟩ , then applying m p r e p \mathbf{m}_{\mathrm{prep}} m prep and then m ~ \widetilde{m} m to c ~ \widetilde{c} c gives ⟨ s ~ 1 , … , s ~ n ⟩ \langle\widetilde{s}_1,\ldots,\widetilde{s}_n\rangle ⟨ s 1 , … , s n ⟩ .
Proof. Codewords have equal lengths, and distinct symbols have distinct codewords; so for strings s , s ′ ∈ Γ + s,s' \in\Gamma^+ s , s ′ ∈ Γ + , we have s ~ = s ′ ~ \widetilde{s}=\widetilde{s'} s = s ′ if and only if s = s ′ s=s' s = s ′ . By Lemma 8, after m p r e p \mathbf{m}_{\mathrm{prep}} m prep the binary tokenisation is the encoding, token by token, of the source string’s characters. Suppose that, before some merge s ⊛ s ′ s\mathbin{\circledast}s' s ⊛ s ′ of m m m , the binary tokenisation ⟨ s ~ 1 , … , s ~ n ⟩ \langle\widetilde{s}_1,\ldots,\widetilde{s}_n\rangle ⟨ s 1 , … , s n ⟩ encodes the source tokenisation ⟨ s 1 , … , s n ⟩ \langle s_1,\ldots,s_n\rangle ⟨ s 1 , … , s n ⟩ token by token. Then the pair ⟨ s ~ , s ′ ~ ⟩ \langle\widetilde{s},\widetilde{s'}\rangle ⟨ s , s ′ ⟩ occurs at index j j j of the binary tokenisation if and only if ⟨ s , s ′ ⟩ \langle s,s'\rangle ⟨ s , s ′ ⟩ occurs at index j j j of the source tokenisation. Both left-to-right scans thus replace pairs at the same indices, and as s ~ j ∘ s ~ j + 1 = s j ∘ s j + 1 ~ \widetilde{s}_j\circ\widetilde{s}_{j+1}=\widetilde{s_j\circ s_{j+1}} s j ∘ s j + 1 = s j ∘ s j + 1 , the two tokenisations still correspond afterwards. Induction over the merges of m m m proves the lemma.
Proof of Proposition 1(i). Suppose μ ( G ) ≥ κ \mu(G)\ge\kappa μ ( G ) ≥ κ . Then, by Eqs. (88) and (89) ,
ν = 3 M + ∣ A λ ∣ − λ 2 μ ( G ) ≤ 3 M + ∣ A λ ∣ − λ 2 κ = K − H . (94) \nu=3M+|A_\lambda|-\lambda^2\mu(G)\le3M+|A_\lambda|-\lambda^2\kappa=K-H. \tag*{(94)} ν = 3 M + ∣ A λ ∣ − λ 2 μ ( G ) ≤ 3 M + ∣ A λ ∣ − λ 2 κ = K − H . (94)
By Lemma 7, the merge sequence m s r c \mathbf{m}_{\mathrm{src}} m src tokenises w w w as ⟨ w ⟩ \langle w\rangle ⟨ w ⟩ . By Lemma 9, applying m p r e p \mathbf{m}_{\mathrm{prep}} m prep and then m ~ s r c \widetilde{\mathbf{m}}_{\mathrm{src}} m src tokenises w ~ \widetilde{w} w as ⟨ w ~ ⟩ \langle\widetilde{w}\rangle ⟨ w ⟩ , a single token, using H + ν ≤ K H+\nu\le K H + ν ≤ K merges.
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 } \{0,1\} { 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 m m leaves at least ν − ∣ m ∣ + 1 \nu-|m|+1 ν − ∣ m ∣ + 1 tokens on w ~ \widetilde{w} w (Lemma 11). To this end, we track the centres. Every codeword contains exactly one centre, so initially 4 M + 1 4M+1 4 M + 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.
Lemma 10 (Recognition). Let s ∈ { 0 , 1 } + s\in\{0,1\}^+ s ∈ { 0 , 1 } + be a string which, at some occurrence in w ~ \widetilde{w} w , contains at least two centres. Then:
(a) at every occurrence of s s s in w ~ \widetilde{w} w , its centres lie at the same positions within s s s ;
(b) at every occurrence, these centres belong to the codewords of the same substring of w w w , which we denote by src ( s ) \operatorname{src}(s) src ( s ) .
Proof. A short binary string, such as 0110, occurs all over w ~ \widetilde{w} w and carries no information about where it 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.
To make “where it sits” precise, number the positions of w ~ \widetilde{w} w from 0, and call p m o d q p \bmod q p mod q the phase of position p p p . Every codeword starts at phase 0, and its centre lies at phase r r 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 r 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 r r positions later. After a marker of phase r r r , the next one starts only after the half-word and the trailing 0, that is, r + 1 r + 1 r + 1 positions later (Figure 6 ). Two consecutive markers thus reveal the phase of the first: it is 0 if they are r r r apart, and r r r if they are r + 1 r + 1 r + 1 apart.
Figure 6. Markers 11 (tinted) start every half-word, at phases 0 and r r r , and centres (shaded, with dots) lie at phase r r r ; here r = 7 r = 7 r = 7 and q = 15 q = 15 q = 15 . The gap to the next marker is r r r after a phase-0 marker and r + 1 r + 1 r + 1 after a phase-r r r one. The first two markers inside s s s are r + 1 r + 1 r + 1 apart, so the first of them is a centre (Lemma 10).
Part (a). It therefore suffices to show that every occurrence of s s s contains two complete consecutive markers. As s s s contains two centres, which are q q q positions apart, we have ∣ s ∣ ≥ q + 1 |s| \ge q + 1 ∣ s ∣ ≥ q + 1 . Let an occurrence of s s s start at position p p p . If a marker starts at p p p , the next one starts at most r + 1 r + 1 r + 1 positions later, and thus ends by position p + q p + q p + q . Otherwise, let m < p m < p m < p be the start of the last marker before p p p ; the two markers following it both start after p p p , and since consecutive gaps sum to q q q , the second of them starts at m + q m + q m + q and ends by position p + q p + q p + q . Either way, the occurrence contains two complete consecutive markers. Since every 11 in w ~ \widetilde{w} w is a marker, these are simply the first two occurrences of 11 in s s s ; their distance depends on s s s alone, and fixes the phase of the first of them, and hence of every position in s s s . All occurrences of s s s thus start at the same phase, and their centres, the positions of phase r r r , lie at the same positions within s s s .
Part (b). Knowing where the centres lie, we can now read off the symbols. Take two consecutive centres in an occurrence of s s s , belonging to the codewords a ~ \widetilde{a} a and b ~ \widetilde{b} b of two adjacent symbols a b ab ab of w w w . Between them, s s s contains ⟨ a ⟩ 0 0 ⟨ b ⟩ \langle a\rangle0\,0 \langle b\rangle ⟨ a ⟩ 0 0 ⟨ b ⟩ , the second half-word of a ~ \widetilde{a} a , its trailing 0, and the first half-word of b ~ \widetilde{b} b (Figure 5 b), at positions fixed by part (a). As identifiers are distinct, these half-words determine a a a and b b 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 s s determines every symbol whose centre it contains. As consecutive centres belong to consecutive codewords, these symbols form a substring of w w 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 \mathbf{m} m be a merge sequence, whose merges may be arbitrary pairs of strings, and apply it to w ~ \widetilde{w} w . Its merge forest records every replacement as a node whose two children are the nodes (or characters) of the two tokens it combines. A node is created by step k k k if the replacement is made by the merge m k \mathbf{m}_k m k , and it is a join if both of its children contain a centre.
The leaves of the merge forest are the characters of w ~ \widetilde{w} w , and its roots are the tokens of tok m ( w ~ ) \operatorname{tok}_{\mathbf{m}}(\widetilde{w}) tok m ( w ) (Figure 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.
Figure 7. A merge forest on the encoding of a source string a 1 a 2 a 3 a 4 a_1a_2a_3a_4 a 1 a 2 a 3 a 4 , 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 a ~ 3 \tilde{a}_3 a ~ 3 together with the first two characters of a ~ 4 \tilde{a}_4 a ~ 4 , ignoring codeword boundaries. The forest has Z = 3 Z = 3 Z = 3 roots containing a centre and 4 − 3 = 1 4 - 3 = 1 4 − 3 = 1 join, as in the first step of the proof of Lemma 11.
Lemma 11 (Centre bound). Let m \mathbf{m} m be any merge sequence, and let Z Z Z be the number of tokens of
tok ↑ [ m ] ( w ~ ) \operatorname{tok}_{\uparrow}^{[m]}(\widetilde{\mathbf{w}}) tok ↑ [ m ] ( w ) which contain a centre. Then
Z ≥ ν − ∣ m ∣ + 1. (95) Z \ge\nu- |\mathbf{m}| + 1. \tag*{(95)} Z ≥ ν − ∣ m ∣ + 1. (95)
Proof. We proceed in five steps: ① we count the joins in the merge forest; ② we show that each merge step creates either only joins or none; ③ we show that most such joining steps create a single node; ④ we bound the joins created by the remaining steps, which merge walk bigrams; ⑤ we combine these bounds.
Step ①. The merge forest contains exactly 4 M + 1 − Z 4M + 1 - Z 4 M + 1 − Z joins.
Proof. Track the number of current tokens which contain a centre. Initially, it is 4 M + 1 4M + 1 4 M + 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 Z Z .
Step ②. If step k k k creates a join, then every node created by step k k k is a join.
Proof. Let m k = s ∘ s ′ m_k = s \circ s' m k = s ∘ s ′ . Every node created by step k k k spans an occurrence of s ∘ s ′ s \circ s' s ∘ s ′ , with its left child spanning the first ∣ s ∣ |s| ∣ s ∣ characters. If one of these nodes is a join, then s ∘ s ′ s \circ s' 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 k k , both children contain a centre.
We call a step joining if it creates a join. For a joining step with m k = s ∘ s ′ m_k = s \circ s' m k = s ∘ s ′ , we write src ( k ) = d e f src ( s ∘ s ′ ) \operatorname{src}(k) \mathrel{\stackrel{\mathrm{def}}{=}} \operatorname{src}(s \circ s') src ( k ) = def src ( s ∘ s ′ ) for the substring of w \mathbf{w} w it covers (Lemma 10(b)). We call it a bigram step if src ( k ) \operatorname{src}(k) src ( k ) consists of exactly two vertices; by Lemma 5(c), src ( k ) \operatorname{src}(k) src ( k ) is then an arc.
Step ③. Every joining step which is not a bigram step creates exactly one node.
Proof. For such a step, src ( k ) \operatorname{src}(k) 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 \mathbf{w} w . By Lemma 10, every occurrence of s ∘ s ′ s \circ s' s ∘ s ′ covers the centres of exactly these symbols, at fixed positions within s ∘ s ′ s \circ s' s ∘ s ′ ; all its occurrences therefore start at the same position. As distinct nodes span distinct intervals, step k k k creates only one node.
Step ④. Let U ⊆ A λ \mathcal{U} \subseteq\mathcal{A}_{\lambda} U ⊆ A λ be the set of arcs src ( k ) \operatorname{src}(k) src ( k ) of all bigram steps k k k . Then bigram steps create at most cov ( U ) \operatorname{cov}(\mathcal{U}) cov ( U ) nodes in total.
Proof. Identify every centre with the position of its symbol in w \mathbf{w} w . A node created by a bigram step contains exactly two centres, at adjacent positions i i i and i + 1 i+1 i + 1 , whose symbols form an arc in U \mathcal{U} U . By Lemma 5(c), both positions lie in the same walk, which U \mathcal{U} 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 j , j + 1 j+1 j + 1 and j + 2 j+2 j + 2 , the nodes assigned to it have centres { j , j + 1 } \{j,j+1\} { j , j + 1 } or { j + 1 , j + 2 } \{j+1,j+2\} { 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 common ancestor. And a node with centres { j , j + 1 } \{j, j + 1\} { j , j + 1 } and one with centres { j + 1 , j + 2 } \{j + 1, j + 2\} { j + 1 , j + 2 } cannot both exist: both contain centre j + 1 j + 1 j + 1 , so their intervals would be nested, and so would their sets of centres.
Step 5. Z ≥ ν − ∣ m ∣ + 1 Z \ge\nu- |\mathbf{m}| + 1 Z ≥ ν − ∣ m ∣ + 1 .
Proof. There are at least ∣ U ∣ |\mathcal{U}| ∣ U ∣ bigram steps, so at most ∣ m ∣ − ∣ U ∣ |\mathbf{m}| - |\mathcal{U}| ∣ m ∣ − ∣ U ∣ other joining steps. By Steps (2) to (4), the merge forest thus contains at most cov ( U ) + ∣ m ∣ − ∣ U ∣ \operatorname{cov}(\mathcal{U}) + |\mathbf{m}| - |\mathcal{U}| cov ( U ) + ∣ m ∣ − ∣ U ∣ joins. With Step (1) and Lemma 6(b), we get
4 M + 1 − Z ≤ cov ( U ) − ∣ U ∣ + ∣ m ∣ ≤ M − ∣ A λ ∣ + λ 2 μ ( G ) + ∣ m ∣ . (96) 4M + 1 - Z \le\operatorname{cov}(\mathcal{U}) - |\mathcal{U}| + |\mathbf{m}| \le M - |\mathcal{A}_{\lambda}| + \lambda^2 \mu(G) + |\mathbf{m}|. \tag*{(96)} 4 M + 1 − Z ≤ cov ( U ) − ∣ U ∣ + ∣ m ∣ ≤ M − ∣ A λ ∣ + λ 2 μ ( G ) + ∣ m ∣. (96)
Rearranging gives Z ≥ 3 M + ∣ A λ ∣ − λ 2 μ ( G ) − ∣ m ∣ + 1 = ν − ∣ m ∣ + 1 Z \ge3M + |\mathcal{A}_{\lambda}| - \lambda^2\mu(G) - |\mathbf{m}| + 1 = \nu- |\mathbf{m}| + 1 Z ≥ 3 M + ∣ 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 Γ \Gamma Γ has at most λ J + 9 λ 2 + 1 ≤ 2 λ J \lambda J + 9\lambda^2 + 1 \le2\lambda J λ J + 9 λ 2 + 1 ≤ 2 λ J symbols, as J ≥ 9 λ + 1 J \ge9\lambda+ 1 J ≥ 9 λ + 1 . By Lemma 8 and λ ≥ 40 / ε 0 \lambda\ge40/\varepsilon_0 λ ≥ 40/ ε 0 , we thus have
H < 10 ∣ Γ ∣ ≤ 20 λ J ≤ ε 0 2 λ 2 J . (97) H < 10|\Gamma| \le20\lambda J \le\frac{\varepsilon_0}{2}\lambda^2 J. \tag*{(97)} H < 10∣Γ∣ ≤ 20 λ J ≤ 2 ε 0 λ 2 J . (97)
Now let m \mathbf{m} m be a merge sequence with ∣ m ∣ ≤ K |\mathbf{m}| \le K ∣ m ∣ ≤ K which leaves at most ε 0 2 λ 2 J \frac{\varepsilon_0}{2}\lambda^2 J 2 ε 0 λ 2 J tokens. As Z Z Z counts only some of the remaining tokens, Lemma 11 gives
ν − K + 1 ≤ Z ≤ ε 0 2 λ 2 J . (98) \nu- K + 1 \le Z \le\frac{\varepsilon_0}{2}\lambda^2 J. \tag*{(98)} ν − K + 1 ≤ Z ≤ 2 ε 0 λ 2 J . (98)
Substituting ν \nu ν and K K K from Eqs. (60) and (61), the terms 3 M + ∣ A λ ∣ 3M + |\mathcal{A}_{\lambda}| 3 M + ∣ A λ ∣ cancel, and with Eq. (69):
λ 2 ( κ − μ ( G ) ) ≤ ε 0 2 λ 2 J + H − 1 < ε 0 λ 2 J . (99) \lambda^2(\kappa- \mu(G)) \le\frac{\varepsilon_0}{2}\lambda^2 J + H - 1 < \varepsilon_0\lambda^2 J. \tag*{(99)} λ 2 ( κ − μ ( G )) ≤ 2 ε 0 λ 2 J + H − 1 < ε 0 λ 2 J . (99)
Dividing by λ 2 \lambda^2 λ 2 gives μ ( G ) > κ − ε 0 J \mu(G) > \kappa- \varepsilon_0 J μ ( G ) > κ − ε 0 J .
Unary Direct Tokenisation is APX-hard
Kastreva et al. [16 ] 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 ℓ a^{\ell} a ℓ with its length ℓ ∈ N \ell\in\mathbb{N} ℓ ∈ 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 G c o m p \mathcal{G}_{\mathrm{comp}} G comp , viewed as an optimisation problem: given a dataset and a budget K K 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 Δ \Delta Δ 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.
AP-Reductions
For an instance I \mathcal{I} I of an optimisation problem and a feasible solution s s s with objective value G ( s ) \mathcal{G}(s) G ( s ) , let the performance ratio be
R ( I , s ) : = max ( G ( s ) OPT ( I ) , OPT ( I ) G ( s ) ) ≥ 1 , (100) R(\mathcal{I},s) \mathrel{\mathop{\mathop:}=} \max\left(\frac{\mathcal{G}(s)}{\operatorname{OPT}(\mathcal{I})}, \frac{\operatorname{OPT}(\mathcal{I})}{\mathcal{G}(s)}\right) \ge1, \tag*{(100)} R ( I , s ) : = max ( OPT ( I ) G ( s ) , G ( s ) OPT ( I ) ) ≥ 1 , (100)
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 ≤ A P B A \le_{\mathrm{AP}} B A ≤ AP B ) if there exist functions f f f and g g g and a constant α ≥ 1 \alpha\ge1 α ≥ 1 such that, for every instance I A \mathcal{I}_A I A of A and every rational r > 1 r > 1 r > 1 :
(i) I B = f ( I A , r ) \mathcal{I}_{B}=f(\mathcal{I}_{A},r) I B = f ( I A , r ) is an instance of B, computable in time polynomial in ∣ I A ∣ |\mathcal{I}_{A}| ∣ I A ∣ for every fixed r r r ;
(ii) for every feasible solution s B s_{B} s B of I B \mathcal{I}_{B} I B , g ( I A , s B , r ) g(\mathcal{I}_{A},s_{B},r) g ( I A , s B , r ) is a feasible solution of I A \mathcal{I}_{A} I A , computable in time polynomial in ∣ I A ∣ |\mathcal{I}_{A}| ∣ I A ∣ and ∣ s B ∣ |s_{B}| ∣ s B ∣ for every fixed r r r ;
(iii) the approximation quality is preserved up to α \alpha α :
R B ( I B , s B ) ≤ r ⟹ R A ( I A , g ( I A , s B , r ) ) ≤ 1 + α ( r − 1 ) . (101) R_{B}(\mathcal{I}_{B},s_{B}) \le r \;\Longrightarrow\; R_{A}(\mathcal{I}_{A},g(\mathcal{I}_{A},s_{B},r)) \le1+\alpha(r-1). \tag*{(101)} R B ( I B , s B ) ≤ r ⟹ R A ( I A , g ( I A , s B , r )) ≤ 1 + α ( r − 1 ) . (101)
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 ≤ A P \le_{\mathrm{AP}} ≤ AP B, then B is APX-hard [9 , 5 ] . The reduction we give below does not depend on r r r .
The Reduction
Our reduction first blows up G G G with J J J clones per vertex: we write G J = ( V J , E J ) G_J=(\mathcal{V}_J,\mathcal{E}_J) G J = ( V J , E J ) for its J J J -blow-up Definition 3, so each vertex becomes a cluster of J J J clones and each edge a complete bipartite graph between two clusters. If G G G is cubic, G J G_J G J is simple, has J 2 J^2 J 2 vertices and I J 2 IJ^2 I J 2 edges, each of its vertices has degree 3 J 3J 3 J , and colourings induced from G G G cut J 2 J^2 J 2 times as many edges Lemma 4(a).
Reduction 4. Consider an instance G = ( V , E ) G=(\mathcal{V},\mathcal{E}) G = ( V , E ) of the 3-MAX-CUT optimisation problem. Index the vertices of G J G_J G J as V J = { 1 , … , J 2 } \mathcal{V}_J=\{1,\ldots,J^2\} V J = { 1 , … , J 2 } . Now, define the label base, the two markers, and a label for each vertex:
β ≔ 8 J 8 + 1 , B ≔ β 10 , W ≔ β 15 , enc ( v i ) ≔ ∑ k = 1 4 i k β k . (102) \beta\coloneqq8J^8+1,\qquad B\coloneqq\beta^{10},\qquad W\coloneqq\beta^{15},\qquad\operatorname{enc}(v_i)\coloneqq\sum_{k=1}^{4}i^k\beta^k. \tag*{(102)} β : = 8 J 8 + 1 , B : = β 10 , W : = β 15 , enc ( v i ) : = k = 1 ∑ 4 i k β k . (102)
From these, we define the string-lengths, for i ∈ V J i\in\mathcal{V}_J i ∈ V J , θ ∈ { B , W } \theta\in\{B,W\} θ ∈ { B , W } , and { i , j } ∈ E J \{i,j\}\in\mathcal{E}_J { i , j } ∈ E J :
ℓ i ≔ enc ( v i ) , ℓ i θ ≔ enc ( v i ) + θ , (103) \ell_i\coloneqq\operatorname{enc}(v_i),\qquad\ell_i^\theta\coloneqq\operatorname{enc}(v_i)+\theta, \tag*{(103)} ℓ i : = enc ( v i ) , ℓ i θ : = enc ( v i ) + θ , (103)
ℓ i ′ ≔ enc ( v i ) + B + W , ℓ i , j ′ ′ ≔ enc ( v i ) + enc ( v j ) + B + W . (104) \ell_i'\coloneqq\operatorname{enc}(v_i)+B+W,\qquad\ell_{i,j}''\coloneqq\operatorname{enc}(v_i)+\operatorname{enc}(v_j)+B+W. \tag*{(104)} ℓ i ′ : = enc ( v i ) + B + W , ℓ i , j ′′ : = enc ( v i ) + enc ( v j ) + B + W . (104)
We build five subdatasets from these values:
Table 77.
with multiplicities f ≔ 20 J f\coloneqq20J f : = 20 J , f ′ ≔ 17 J f'\coloneqq17J f ′ : = 17 J , and f ′ ′ ≔ 15 J f''\coloneqq15J f ′′ : = 15 J . A full dataset is then formed by joining these subdatasets: D = D 1 ∪ ⋯ ∪ D 5 \mathcal{D}=\mathcal{D}_1\cup\cdots\cup\mathcal{D}_5 D = D 1 ∪ ⋯ ∪ D 5 . Finally, we set the number of allowed tokens to K = 2 J 2 + 2 K=2J^2+2 K = 2 J 2 + 2 , and define the base cost
Δ ≔ ( 2 f + f ′ + 3 f ′ ′ + 2 ) J 2 + 3 I J 2 = 213 2 J 3 + 2 J 2 . (105) \Delta\coloneqq(2f+f'+3f''+2)J^2+3IJ^2=\frac{213}{2}J^3+2J^2. \tag*{(105)} Δ : = ( 2 f + f ′ + 3 f ′′ + 2 ) J 2 + 3 I J 2 = 2 213 J 3 + 2 J 2 . (105)
We write R α ( G ) R_{\alpha}(G) R α ( G ) for the D-1-TOK instance ( D , K ) (\mathcal{D},K) ( D , K ) output by this reduction. It contains 177 2 J 3 + J 2 \frac{177}{2}J^3+J^2 2 177 J 3 + J 2 strings, each shorter than 2 W = O ( J 120 ) 2W=O(J^{120}) 2 W = O ( J 120 ) , so it can be written down explicitly in unary in polynomial time. Following Kastreva et al. [16 ] , we split the intended tokens into structural tokens S b a s e \mathcal{S}_{\mathrm{base}} S base , which every good vocabulary should contain, and choice tokens S c h o i c e \mathcal{S}_{\mathrm{choice}} S choice , from which it should pick one per vertex:
S b a s e = { B , W } ∪ { ℓ i ∣ i ∈ V J } , S c h o i c e = { ℓ i B , ℓ i W ∣ i ∈ V J } . (106) \mathcal{S}_{\mathrm{base}}=\{B,W\}\cup\{\ell_i\mid i\in\mathcal{V}_J\},\qquad\mathcal{S}_{\mathrm{choice}}=\{\ell_i^B,\ell_i^W\mid i\in\mathcal{V}_J\}. \tag*{(106)} S base = { B , W } ∪ { ℓ i ∣ i ∈ V J } , S choice = { ℓ i B , ℓ i W ∣ i ∈ V J } . (106)
We call the members of S c o m p l ≔ Σ ∪ S b a s e ∪ S c h o i c e S_{\mathrm{compl}} \coloneqq\Sigma\cup S_{\mathrm{base}} \cup S_{\mathrm{choice}} S compl : = Σ ∪ S base ∪ S choice compliant tokens, and all other tokens non-compliant. We further call a vocabulary cut-compliant if it contains Σ ∪ S b a s e \Sigma\cup S_{\mathrm{base}} Σ ∪ S base and exactly one of ℓ i B \ell_i^B ℓ i B or ℓ i W \ell_i^W ℓ i W for each i ∈ V J i \in V_J i ∈ V J . Cut-compliant vocabularies are in one-to-one correspondence with colourings of G J G_J G J : colouring σ \sigma σ corresponds to
S σ ≔ Σ ∪ S b a s e ∪ { ℓ i σ ( i ) ∣ i ∈ V J } , (107) S_\sigma\coloneqq\Sigma\cup S_{\mathrm{base}} \cup\{\ell_i^{\sigma(i)} \mid i \in V_J\}, \tag*{(107)} S σ : = Σ ∪ S base ∪ { ℓ i σ ( i ) ∣ i ∈ V J } , (107)
which has exactly ∣ Σ ∣ + K = 2 J 2 + 3 |\Sigma| + K = 2J^2 + 3 ∣Σ∣ + K = 2 J 2 + 3 tokens. Under S σ S_\sigma S σ , an edge-string ℓ i , j ′ ′ \ell_{i,j}^{\prime\prime} ℓ i , j ′′ is compressed to two symbols, ⟨ ℓ i B , ℓ j W ⟩ \langle\ell_i^B,\ell_j^W\rangle ⟨ ℓ i B , ℓ j W ⟩ or ⟨ ℓ i W , ℓ j B ⟩ \langle\ell_i^W,\ell_j^B\rangle ⟨ ℓ i W , ℓ j B ⟩ , if σ ( i ) ≠ σ ( j ) \sigma(i) \ne\sigma(j) σ ( 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 labels bound the savings of a set S n c S_{\mathrm{nc}} S nc of non-compliant tokens by a degree term, 3 J ∣ S n c ∣ 3J|S_{\mathrm{nc}}| 3 J ∣ S nc ∣ in G J G_J G J , and a term ∣ S n c ∣ ∣ S n c ∣ \sqrt{|S_{\mathrm{nc}}|}|S_{\mathrm{nc}}| ∣ S nc ∣ ∣ S nc ∣ (SubLemma 4). Without the blow-up, the degree of each vertex is a constant 3 while ∣ S n c ∣ |S_{\mathrm{nc}}| ∣ S nc ∣ can grow with the graph, so no constant multiplicities pay for non-compliant tokens; yet non-constant multiplicities destroy the constant ratio between the tokenisation and the cut objectives. With J J J clones per vertex, both the degree 3 J 3J 3 J and ∣ S n c ∣ ≤ 2 J \sqrt{|S_{\mathrm{nc}}|} \le\sqrt{2}J ∣ S nc ∣ ≤ 2 J are O ( J ) O(J) O ( J ) , so multiplicities linear in J J J suffice. Both the full objective Δ \Delta Δ and the amplified cut J 2 μ ( G ) J^2\mu(G) J 2 μ ( G ) are then Θ ( J 3 ) \Theta(J^3) Θ ( J 3 ) , which preserves a constant approximation gap.
Unary Direct Tokenisation is Hard to Approximate
Reduction 4 is not an L-reduction: the optimum of R ∅ ( G ) R_{\varnothing}(G) R ∅ ( G ) is Θ ( J 2 ) \Theta(J^2) Θ ( J 2 ) times larger than μ ( G ) \mu(G) μ ( G ) , so it cannot be an L-reduction with constant parameters. Its two L-reduction constants are, however, O ( J 2 ) O(J^2) O ( J 2 ) and J − 2 J^{-2} J − 2 , with constant product. This is exactly the situation handled by AP-reductions (Crescenzi, [9 ] ; 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 σ S_\sigma S σ , every marker- and vertex-string is a single token, the two colour-strings of vertex i i i cost 1 + 2 1 + 2 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 G c o m p ( tok Φ [ S σ ] , D ) = Δ − cut G J ( σ ) \mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\Phi}[S_\sigma],D) = \Delta- \operatorname{cut}_{G_J}(\sigma) G comp ( tok Φ [ S σ ] , D ) = Δ − cut G J ( σ ) . Colourings induced from G G G cut J 2 J^2 J 2 times as many edges, giving G c o m p ⋆ ( D ) ≤ Δ − J 2 μ ( G ) \mathcal{G}_{\mathrm{comp}}^\star(D) \le\Delta- J^2\mu(G) 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 S S , we compute in polynomial time a colouring of G G G with cut size C C C such that G c o m p ( tok Φ [ S ] , D ) ≥ Δ − J 2 C \mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\Phi}[S],D) \ge\Delta- J^2C G comp ( tok Φ [ S ] , D ) ≥ Δ − J 2 C . If a marker is missing, D 1 D_1 D 1 alone pushes the cost above Δ \Delta Δ . 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 S S to a single colouring of G G G . Each non-compliant token costs a vocabulary slot, which is charged f ′ ′ + J = 16 J f'' + J = 16J f ′′ + J = 16 J symbols, while all non-compliant tokens together save at most 12 J + 3 12J + 3 12 J + 3 symbols per token.
Approximation accounting. See a formal proof in Lemma 14 in §C.6. The two steps together give G c o m p ⋆ ( D ) = Δ − J 2 μ ( G ) ≤ 106 J 2 μ ( G ) \mathcal{G}_{\mathrm{comp}}^\star(D) = \Delta- J^2\mu(G) \le106J^2\mu(G) G comp ⋆ ( D ) = Δ − J 2 μ ( G ) ≤ 106 J 2 μ ( G ) and J 2 ( μ ( G ) − C ) ≤ G c o m p ( tok Φ [ S ] , D ) − G c o m p ⋆ ( D ) J^2(\mu(G)-C) \le\mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\Phi}[S],D) - \mathcal{G}_{\mathrm{comp}}^\star(D) J 2 ( μ ( G ) − C ) ≤ G comp ( tok Φ [ S ] , D ) − G comp ⋆ ( D ) . A tokeniser with ratio 1 + ε 1+\varepsilon 1 + ε of optimal thus does a cut within ratio roughly 1 + 106 ε 1+106\varepsilon 1 + 106 ε , which yields an AP-reduction with constant α = 212 \alpha= 212 α = 212 . Since 3-MAX-CUT is APX-hard (Alimonti and Kann, [2 ] ), so is D-1-TOK.
Proof of Forward Step of Theorem 5
Lemma 12. Let ( D , K ) = R ∅ ( G ) (D,K) = R_{\varnothing}(G) ( D , K ) = R ∅ ( G ) . For every colouring σ \sigma σ of G J G_J G J , the cut-compliant vocabulary S σ S_\sigma S σ satisfies
G c o m p ( tok Φ [ S σ ] , D ) = Δ − cut G J ( σ ) . (108) \mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\Phi}[S_\sigma],D) = \Delta- \operatorname{cut}_{G_J}(\sigma). \tag*{(108)} G comp ( tok Φ [ S σ ] , D ) = Δ − cut G J ( σ ) . (108)
Consequently, G c o m p ⋆ ( D ) ≤ Δ − J 2 μ ( G ) \mathcal{G}_{\mathrm{comp}}^\star(D) \le\Delta- J^2\mu(G) G comp ⋆ ( D ) ≤ Δ − J 2 μ ( G ) .
Proof. Note that ∣ S σ ∣ = ∣ Σ ∣ + K |S_\sigma| = |\Sigma| + K ∣ S σ ∣ = ∣Σ∣ + K , as required. We write θ ˉ \bar{\theta} θ ˉ for the marker other than θ \theta θ . By SubLemma 3(a), a string is compressed to one symbol if and only if its length is in S σ S_\sigma S σ . Under this tokeniser, we have:
tok [ S σ ] ( D 1 ) = { ⟨ B ⟩ , ⟨ W ⟩ (length 1) } × f J 2 (109) \operatorname{tok}_{[S_\sigma]}(\mathcal{D}_1) = \{\langle B\rangle, \langle W\rangle\text{ (length 1)}\} \times fJ^2 \tag*{(109)} tok [ S σ ] ( D 1 ) = {⟨ B ⟩ , ⟨ W ⟩ (length 1) } × f J 2 (109)
tok [ S σ ] ( D 2 ) = { ⟨ ℓ i ⟩ (length 1) ∣ i ∈ V J } × f ′ (110) \operatorname{tok}_{[S_\sigma]}(\mathcal{D}_2) = \{\langle\ell_i\rangle\text{ (length 1)} \mid i \in\mathcal{V}_J\} \times f' \tag*{(110)} tok [ S σ ] ( D 2 ) = {⟨ ℓ i ⟩ (length 1) ∣ i ∈ V J } × f ′ (110)
tok [ S σ ] ( D 3 ) = { ⟨ ℓ i σ ( i ) ⟩ (length 1) , ⟨ ℓ i , σ ( i ) ‾ ⟩ (length 2) ∣ i ∈ V J } × f ′ ′ (111) \operatorname{tok}_{[S_\sigma]}(\mathcal{D}_3) = \{\langle\ell_i^{\sigma(i)}\rangle\text{ (length 1)}, \langle\ell_i,\overline{\sigma(i)}\rangle\text{ (length 2)} \mid i \in\mathcal{V}_J\} \times f'' \tag*{(111)} tok [ S σ ] ( D 3 ) = {⟨ ℓ i σ ( i ) ⟩ (length 1) , ⟨ ℓ i , σ ( i ) ⟩ (length 2) ∣ i ∈ V J } × f ′′ (111)
tok [ S σ ] ( D 4 ) = { ⟨ ℓ i σ ( i ) , σ ( i ) ‾ ⟩ (length 2) ∣ i ∈ V J } × 1 (112) \operatorname{tok}_{[S_\sigma]}(\mathcal{D}_4) = \{\langle\ell_i^{\sigma(i)},\overline{\sigma(i)}\rangle\text{ (length 2)} \mid i \in\mathcal{V}_J\} \times1 \tag*{(112)} tok [ S σ ] ( D 4 ) = {⟨ ℓ i σ ( i ) , σ ( i ) ⟩ (length 2) ∣ i ∈ V J } × 1 (112)
tok [ S σ ] ( ℓ i , j ′ ′ ) = { ⟨ ℓ i σ ( i ) , ℓ j σ ( j ) ⟩ (length 2) if σ ( i ) ≠ σ ( j ) ⟨ ℓ i σ ( i ) , ℓ j , σ ( i ) ‾ ⟩ (length 3) else for { i , j } ∈ E J (113) \operatorname{tok}_{[S_\sigma]}(\ell_{i,j}'') =
\begin{cases}
\langle\ell_i^{\sigma(i)},\ell_j^{\sigma(j)}\rangle\text{ (length 2)} & \text{if } \sigma(i) \ne\sigma(j) \\
\langle\ell_i^{\sigma(i)},\ell_j,\overline{\sigma(i)}\rangle\text{ (length 3)} & \text{else}
\end{cases}
\quad\text{for } \{i,j\} \in\mathcal{E}_J \tag*{(113)} tok [ S σ ] ( ℓ i , j ′′ ) = { ⟨ ℓ i σ ( i ) , ℓ j σ ( j ) ⟩ (length 2) ⟨ ℓ i σ ( i ) , ℓ j , σ ( i ) ⟩ (length 3) if σ ( i ) = σ ( j ) else for { i , j } ∈ E J (113)
The strings of length 2 cannot be compressed to one symbol, as their lengths are not in S σ S_\sigma S σ . An uncut edge-string cannot be compressed to two symbols: by SubLemma 3(b), this would require ℓ i W , ℓ j W ∈ S σ \ell_i^W,\ell_j^W \in S_\sigma ℓ i W , ℓ j W ∈ S σ or ℓ i W , ℓ j B ∈ S σ \ell_i^W,\ell_j^B \in S_\sigma ℓ i W , ℓ j B ∈ S σ , i.e., σ ( i ) ≠ σ ( j ) \sigma(i) \ne\sigma(j) σ ( i ) = σ ( j ) . Summing these compressed lengths, we get
G c o m p ( tok [ S σ ] , D ) = ( 2 f + f ′ + 3 f ′ ′ + 2 ) J 2 + 3 I J 2 − cut G J ( σ ) = Δ − cut G J ( σ ) . (114) \mathfrak{G}_{\mathrm{comp}}(\operatorname{tok}_{[S_\sigma]},\mathcal{D}) = (2f+f'+3f''+2)J^2+3IJ^2-\operatorname{cut}_{G_J}(\sigma)=\Delta-\operatorname{cut}_{G_J}(\sigma). \tag*{(114)} G comp ( tok [ S σ ] , D ) = ( 2 f + f ′ + 3 f ′′ + 2 ) J 2 + 3 I J 2 − cut G J ( σ ) = Δ − cut G J ( σ ) . (114)
Finally, let σ G \sigma_G σ G be a maximum cut of G G G and σ \sigma σ the colouring of G J G_J G J it induces. Then cut G J ( σ ) = J 2 μ ( G ) \operatorname{cut}_{G_J}(\sigma)=J^2\mu(G) cut G J ( σ ) = J 2 μ ( G ) , which proves the bound on the optimum.
Proof of Backward Step of Theorem 5
Before starting our lemma’s proof, we define a few notions for an arbitrary feasible vocabulary S S S , with Σ ⊆ S \Sigma\subseteq S Σ ⊆ S and ∣ S ∣ ≤ ∣ Σ ∣ + K = 2 J 2 + 3 |S| \leq|\Sigma|+K=2J^2+3 ∣ S ∣ ≤ ∣Σ∣ + K = 2 J 2 + 3 . As in the proofs of Kastreva et al. [16 ] , we write S n c ≔ S ∖ S c o m p l S_{\mathrm{nc}} \coloneqq S\setminus S_{\mathrm{compl}} S nc : = S ∖ S compl for its non-compliant tokens and S m i s s i n g ≔ S b a s e ∖ S S_{\mathrm{missing}} \coloneqq S_{\mathrm{base}}\setminus S S missing : = S base ∖ S for its missing structural tokens. Further, each vertex i ∈ V J i\in\mathcal{V}_J i ∈ V J gets the palette Π i ≔ { θ ∈ { B , W } ∣ ℓ i θ ∈ S } \Pi_i \coloneqq\{\theta\in\{B,W\}\mid\ell_i^\theta\in S\} Π i : = { θ ∈ { B , W } ∣ ℓ i θ ∈ S } of colours whose colour-string is a token; note that ∑ i ∣ Π i ∣ = ∣ S ∩ S c h o i c e ∣ \sum_i|\Pi_i|=|S\cap S_{\mathrm{choice}}| ∑ i ∣ Π i ∣ = ∣ S ∩ S choice ∣ . Let g g g count the edges of G J G_J G J whose palettes permit unequal colours, as in SubLemma 5. We define the decoder dec ( S ) \operatorname{dec}(S) dec ( S ) as follows: if B ∉ S B\notin S B ∈ / S or W ∉ S W\notin S W ∈ / S , it returns a locally maximal colouring of G G G (Fact 1); otherwise, it returns the colouring of SubLemma 5 applied to the palettes Π i \Pi_i Π i . Both branches run in deterministic polynomial time.
Lemma 13. Let ( D , K ) = R ↛ ( G ) (D,K)=R_{\not\to}(G) ( D , K ) = R → ( G ) , let S S S be any feasible vocabulary, and let C = cut G ( dec ( S ) ) C=\operatorname{cut}_G(\operatorname{dec}(S)) C = cut G ( dec ( S )) . Then
G c o m p ( tok [ S ] , D ) ≥ Δ − J 2 C . (115) \mathfrak{G}_{\mathrm{comp}}(\operatorname{tok}_{[S]},D)\geq\Delta-J^2C. \tag*{(115)} G comp ( tok [ S ] , D ) ≥ Δ − J 2 C . (115)
Proof. We proceed in five steps: ① we show that a vocabulary missing a marker costs more than Δ \Delta Δ ; ② we relate non-compliant tokens to missing compliant tokens via the vocabulary budget; ③ we lower-bound the compressed length of D 1 \mathcal{D}_1 D 1 to D 4 \mathcal{D}_4 D 4 by counting whole-string tokens; ④ we lower-bound the compressed length of D 5 \mathcal{D}_5 D 5 by bounding the edge-strings compressed to one or two symbols; ⑤ we combine these bounds with SubLemma 5.
Step ①. If B ∉ S B\notin S B ∈ / S or W ∉ S W\notin S W ∈ / S , then G c o m p ( tok [ S ] , D ) > Δ \mathfrak{G}_{\mathrm{comp}}(\operatorname{tok}_{[S]},D)>\Delta G comp ( tok [ S ] , D ) > Δ .
Proof. Each of the f J 2 fJ^2 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 = 5 J − 1 f-f''-1=5J-1 f − f ′′ − 1 = 5 J − 1 and 2 I = 3 J 2I=3J 2 I = 3 J :
G c o m p ( tok [ S ] , D ) ≥ ( 3 f + f ′ + 2 f ′ ′ + 1 ) J 2 + I J 2 (116) \mathfrak{G}_{\mathrm{comp}}(\operatorname{tok}_{[S]},D)\geq(3f+f'+2f''+1)J^2+IJ^2 \tag*{(116)} G comp ( tok [ S ] , D ) ≥ ( 3 f + f ′ + 2 f ′′ + 1 ) J 2 + I J 2 (116)
= Δ + ( f − f ′ ′ − 1 ) J 2 − 2 I J 2 (117) =\Delta+(f-f''-1)J^2-2IJ^2 \tag*{(117)} = Δ + ( f − f ′′ − 1 ) J 2 − 2 I J 2 (117)
= Δ + ( 2 J − 1 ) J 2 > Δ . (118) =\Delta+(2J-1)J^2>\Delta. \tag*{(118)} = Δ + ( 2 J − 1 ) J 2 > Δ. (118)
As C ≥ 0 C\geq0 C ≥ 0 , Eq. (115) holds in this case.
From now on, we assume B , W ∈ S B,W\in S B , W ∈ S , so S m i s s i n g S_{\mathrm{missing}} S missing contains only vertex-strings.
Step ②. The vocabulary budget implies
J 2 − ∣ S ∩ S c h o i c e ∣ ≥ ∣ S n c ∣ − ∣ S m i s s i n g ∣ and ∣ S n c ∣ ≤ 2 J 2 . (119) J^2-|S\cap S_{\mathrm{choice}}|\geq|S_{\mathrm{nc}}|-|S_{\mathrm{missing}}|
\qquad\text{and}\qquad
|S_{\mathrm{nc}}|\leq2J^2. \tag*{(119)} J 2 − ∣ S ∩ S choice ∣ ≥ ∣ S nc ∣ − ∣ S missing ∣ and ∣ S nc ∣ ≤ 2 J 2 . (119)
Proof. The vocabulary partitions into Σ \Sigma Σ , the 2 + J 2 − ∣ S m i s s i n g ∣ 2+J^2-|S_{\mathrm{missing}}| 2 + J 2 − ∣ S missing ∣ structural tokens it contains, S ∩ S c h o i c e S\cap S_{\mathrm{choice}} S ∩ S choice , and S n c S_{\mathrm{nc}} S nc . Its size is at most 2 J 2 + 3 2J^2+3 2 J 2 + 3 , so
3 + J 2 − ∣ S m i s s i n g ∣ + ∣ S ∩ S c h o i c e ∣ + ∣ S n c ∣ ≤ 2 J 2 + 3. (120) 3+J^2-|S_{\mathrm{missing}}|+|S\cap S_{\mathrm{choice}}|+|S_{\mathrm{nc}}|\le2J^2+3. \tag*{(120)} 3 + J 2 − ∣ S missing ∣ + ∣ S ∩ S choice ∣ + ∣ S nc ∣ ≤ 2 J 2 + 3. (120)
Rearranging gives the first claim; the second follows from ∣ S m i s s i n g ∣ ≤ J 2 |S_{\mathrm{missing}}|\le J^2 ∣ S missing ∣ ≤ J 2 .
Step ③. The compressed lengths of the first four subdatasets satisfy:
G c o m p ( tok ℓ [ S ] , D 1 ) = 2 f J 2 , G c o m p ( tok ℓ [ S ] , D 2 ) ≥ f ′ ( J 2 + ∣ S m i s s i n g ∣ ) , G c o m p ( tok ℓ [ S ] , D 3 ) ≥ f ′ ′ ( 4 J 2 − ∣ S ∩ S c h o i c e ∣ ) , G c o m p ( tok ℓ [ S ] , D 4 ) ≥ 2 J 2 − ∣ S n c ∣ . (121) \begin{aligned}
\mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\ell}[S],\mathcal{D}_1)&=2fJ^2,\\
\mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\ell}[S],\mathcal{D}_2)&\ge f'(J^2+|S_{\mathrm{missing}}|),\\
\mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\ell}[S],\mathcal{D}_3)&\ge f''(4J^2-|S\cap S_{\mathrm{choice}}|),\\
\mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\ell}[S],\mathcal{D}_4)&\ge2J^2-|S_{\mathrm{nc}}|. \tag*{(121)}
\end{aligned} G comp ( tok ℓ [ S ] , D 1 ) G comp ( tok ℓ [ S ] , D 2 ) G comp ( tok ℓ [ S ] , D 3 ) G comp ( tok ℓ [ S ] , D 4 ) = 2 f J 2 , ≥ f ′ ( J 2 + ∣ S missing ∣ ) , ≥ f ′′ ( 4 J 2 − ∣ S ∩ S choice ∣ ) , ≥ 2 J 2 − ∣ S nc ∣. (121)
G c o m p ( tok ℓ [ S ] , D 2 ) ≥ f ′ ( J 2 + ∣ S m i s s i n g ∣ ) (122) \mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\ell}[S],\mathcal{D}_2)\ge f'(J^2+|S_{\mathrm{missing}}|) \tag*{(122)} G comp ( tok ℓ [ S ] , D 2 ) ≥ f ′ ( J 2 + ∣ S missing ∣ ) (122)
G c o m p ( tok ℓ [ S ] , D 3 ) ≥ f ′ ′ ( 4 J 2 − ∣ S ∩ S c h o i c e ∣ ) (123) \mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\ell}[S],\mathcal{D}_3)\ge f''(4J^2-|S\cap S_{\mathrm{choice}}|) \tag*{(123)} G comp ( tok ℓ [ S ] , D 3 ) ≥ f ′′ ( 4 J 2 − ∣ S ∩ S choice ∣ ) (123)
G c o m p ( tok ℓ [ S ] , D 4 ) ≥ 2 J 2 − ∣ S n c ∣ . (124) \mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\ell}[S],\mathcal{D}_4)\ge2J^2-|S_{\mathrm{nc}}|. \tag*{(124)} G comp ( tok ℓ [ S ] , D 4 ) ≥ 2 J 2 − ∣ S nc ∣. (124)
Proof. A string costs one symbol if its length is in S S S , and at least two otherwise. Both markers are tokens. Exactly ∣ S m i s s i n g ∣ |S_{\mathrm{missing}}| ∣ S missing ∣ vertex-strings and 2 J 2 − ∣ S ∩ S c h o i c e ∣ 2J^2-|S\cap S_{\mathrm{choice}}| 2 J 2 − ∣ S ∩ S choice ∣ colour-strings are not tokens, each repeated f ′ f' f ′ and f ′ ′ f'' f ′′ times, respectively; this gives the bounds on D 2 \mathcal{D}_2 D 2 and D 3 \mathcal{D}_3 D 3 . Finally, bridge-strings are not compliant (SubLemma 3(a)), so at most ∣ S n c ∣ |S_{\mathrm{nc}}| ∣ S nc ∣ of them are tokens.
Step ④. The compressed length of the edge-strings satisfies
G c o m p ( tok ℓ [ S ] , D 5 ) ≥ 3 I J 2 − g − ( 12 J + 2 ) ∣ S n c ∣ . (125) \mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\ell}[S],\mathcal{D}_5)\ge3IJ^2-g-(12J+2)|S_{\mathrm{nc}}|. \tag*{(125)} G comp ( tok ℓ [ S ] , D 5 ) ≥ 3 I J 2 − g − ( 12 J + 2 ) ∣ S nc ∣. (125)
Proof. Let E J 1 \mathcal{E}_J^1 E J 1 and E J 2 \mathcal{E}_J^2 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 G c o m p ( tok ℓ [ S ] , D 5 ) ≥ 3 I J 2 − 2 ∣ E J 1 ∣ − ∣ E J 2 ∣ \mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\ell}[S],\mathcal{D}_5)\ge3IJ^2-2|\mathcal{E}_J^1|-|\mathcal{E}_J^2| G comp ( tok ℓ [ S ] , D 5 ) ≥ 3 I J 2 − 2∣ E J 1 ∣ − ∣ E J 2 ∣ . An edge in E J 1 \mathcal{E}_J^1 E J 1 has ℓ e ′ ′ ∈ S \ell_e''\in S ℓ e ′′ ∈ S , and since ℓ e ′ ′ \ell_e'' ℓ e ′′ is not compliant, ℓ e ′ ′ ∈ S n c \ell_e''\in S_{\mathrm{nc}} ℓ e ′′ ∈ S nc ; so ∣ E J 1 ∣ ≤ ∣ S n c ∣ |\mathcal{E}_J^1|\le|S_{\mathrm{nc}}| ∣ E J 1 ∣ ≤ ∣ S nc ∣ . An edge in E J 2 \mathcal{E}_J^2 E J 2 has ℓ e ′ ′ = p + p ′ \ell_e''=p+p' ℓ e ′′ = p + p ′ for two tokens p , p ′ ∈ S p,p'\in S p , p ′ ∈ S , and we distinguish three cases:
Both compliant. By SubLemma 3(b), { p , p ′ } \{p,p'\} { p , p ′ } is { ℓ i B , ℓ j W } \{\ell_i^B,\ell_j^W\} { ℓ i B , ℓ j W } or { ℓ i W , ℓ j B } \{\ell_i^W,\ell_j^B\} { ℓ i W , ℓ j B } , so the vocabulary contains colour tokens for the two endpoints with opposite colours. There are at most g g g such edges.
One compliant, one non-compliant. By SubLemma 3(c), each non-compliant token serves at most 3 J 3J 3 J edges this way, for at most 3 J ∣ S n c ∣ 3J|S_{\mathrm{nc}}| 3 J ∣ S nc ∣ edges.
Both non-compliant. Then ℓ e ′ ′ ∈ S n c + S n c \ell_e''\in S_{\mathrm{nc}}+S_{\mathrm{nc}} ℓ e ′′ ∈ S nc + S nc . By SubLemma 4 with Q = S n c Q=S_{\mathrm{nc}} Q = S nc , there are at most ( 6 J + ∣ S n c ∣ + 1 ) ∣ S n c ∣ (6J+\sqrt{|S_{\mathrm{nc}}|}+1)|S_{\mathrm{nc}}| ( 6 J + ∣ S nc ∣ + 1 ) ∣ S nc ∣ such edges. As ∣ S n c ∣ ≤ 2 J 2 |S_{\mathrm{nc}}|\le2J^2 ∣ S nc ∣ ≤ 2 J 2 (Step ②), we have ∣ S n c ∣ ≤ 2 J \sqrt{|S_{\mathrm{nc}}|}\le2J ∣ S nc ∣ ≤ 2 J , and this is at most 9 J ∣ S n c ∣ 9J|S_{\mathrm{nc}}| 9 J ∣ S nc ∣ .
Thus ∣ E J 2 ∣ ≤ g + 12 J ∣ S n c ∣ |\mathcal{E}_J^2|\le g+12J|S_{\mathrm{nc}}| ∣ E J 2 ∣ ≤ g + 12 J ∣ S nc ∣ , and (125) follows.
Step ⑤. If B , W ∈ S B,W\in S B , W ∈ S , then (115) holds.
Proof. Summing Steps ③ and ④, and subtracting Δ \Delta Δ from (105) , we get
G c o m p ( tok ℓ [ S ] , D ) − Δ ≥ f ′ ∣ S m i s s i n g ∣ + f ′ ′ ( J 2 − ∣ S ∩ S c h o i c e ∣ ) − g − ( 12 J + 3 ) ∣ S n c ∣ . (126) \mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\ell}[S],\mathcal{D})-\Delta\ge f'|S_{\mathrm{missing}}|+f''(J^2-|S\cap S_{\mathrm{choice}}|)-g-(12J+3)|S_{\mathrm{nc}}|. \tag*{(126)} G comp ( tok ℓ [ S ] , D ) − Δ ≥ f ′ ∣ S missing ∣ + f ′′ ( J 2 − ∣ S ∩ S choice ∣ ) − g − ( 12 J + 3 ) ∣ S nc ∣. (126)
By SubLemma 5, C = cut G ( dec ( S ) ) C=\operatorname{cut}_G(\operatorname{dec}(S)) C = cut G ( dec ( S )) satisfies − g ≥ − J 2 C + J ( J 2 − ∣ S ∩ S c h o i c e ∣ ) -g\ge-J^2C+J(J^2-|S\cap S_{\mathrm{choice}}|) − g ≥ − J 2 C + J ( J 2 − ∣ S ∩ S choice ∣ ) . Then, as f ′ ′ + J = 16 J > 0 f''+J=16J>0 f ′′ + J = 16 J > 0 , (119) gives:
G c o m p ( tok ℓ [ S ] , D ) − Δ + J 2 C ≥ f ′ ∣ S m i s s i n g ∣ + ( f ′ ′ + J ) ( J 2 − ∣ S ∩ S c h o i c e ∣ ) − ( 12 J + 3 ) ∣ S n c ∣ (127) \mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\ell}[S],\mathcal{D})-\Delta+J^2C\ge f'|S_{\mathrm{missing}}|+(f''+J)(J^2-|S\cap S_{\mathrm{choice}}|)-(12J+3)|S_{\mathrm{nc}}| \tag*{(127)} G comp ( tok ℓ [ S ] , D ) − Δ + J 2 C ≥ f ′ ∣ S missing ∣ + ( f ′′ + J ) ( J 2 − ∣ S ∩ S choice ∣ ) − ( 12 J + 3 ) ∣ S nc ∣ (127)
≥ 17 J ∣ S m i s s i n g ∣ + 16 J ( ∣ S n c ∣ − ∣ S m i s s i n g ∣ ) − ( 12 J + 3 ) ∣ S n c ∣ (128) \ge17J|S_{\mathrm{missing}}|+16J(|S_{\mathrm{nc}}|-|S_{\mathrm{missing}}|)-(12J+3)|S_{\mathrm{nc}}| \tag*{(128)} ≥ 17 J ∣ S missing ∣ + 16 J ( ∣ S nc ∣ − ∣ S missing ∣ ) − ( 12 J + 3 ) ∣ S nc ∣ (128)
= J ∣ S m i s s i n g ∣ + ( 4 J − 3 ) ∣ S n c ∣ ≥ 0. (129) =J|S_{\mathrm{missing}}|+(4J-3)|S_{\mathrm{nc}}|\ge0. \tag*{(129)} = J ∣ S missing ∣ + ( 4 J − 3 ) ∣ S nc ∣ ≥ 0. (129)
In words: after rounding, each non-compliant token occupies a slot charged 16 J 16J 16 J symbols, while all non-compliant tokens together save at most 12 J + 3 12J+3 12 J + 3 symbols per token on edge- and bridge-strings.
Steps ① and ⑤ cover both cases, which concludes the proof.
Corollary 1. For ( D , K ) = R ⋄ ( G ) (\mathcal{D}, K) = \mathcal{R}_{\diamond}(G) ( D , K ) = R ⋄ ( G ) , we have G c o m p ⋆ ( D ) = Δ − J 2 μ ( G ) \mathcal{G}^{\star}_{\mathrm{comp}}(\mathcal{D}) = \Delta- J^{2}\mu(G) G comp ⋆ ( D ) = Δ − J 2 μ ( G ) , and every feasible S S S satisfies
J 2 ( μ ( G ) − cut G ( dec ( S ) ) ) ≤ G c o m p ( tok ⋄ [ S ] , D ) − G c o m p ⋆ ( D ) . (130) J^{2}\left(\mu(G) - \operatorname{cut}_{G}(\operatorname{dec}(S))\right) \leq\mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\diamond}[S],\mathcal{D}) - \mathcal{G}^{\star}_{\mathrm{comp}}(\mathcal{D}). \tag*{(130)} J 2 ( μ ( G ) − cut G ( dec ( S )) ) ≤ G comp ( tok ⋄ [ S ] , D ) − G comp ⋆ ( D ) . (130)
Proof. Lemma 13 and cut G ( dec ( S ) ) ≤ μ ( G ) \operatorname{cut}_{G}(\operatorname{dec}(S)) \leq\mu(G) cut G ( dec ( S )) ≤ μ ( G ) give G c o m p ⋆ ( D ) ≥ Δ − J 2 μ ( G ) \mathcal{G}^{\star}_{\mathrm{comp}}(\mathcal{D}) \geq\Delta- J^{2}\mu(G) G comp ⋆ ( D ) ≥ Δ − J 2 μ ( G ) ; Lemma 12 gives the reverse inequality. Substituting the optimum into Eq. (115) gives Eq. (130) .
Proof of Theorem 5 (Unary Direct Tokenisation is APX-hard)
Lemma 14. 3-MAX-CUT A P AP A P -reduces to D-1-TOK with constant α = 212 \alpha= 212 α = 212 .
Proof. We define f D - 1 - T O K ( G , r ) d e f = R ⋄ ( G ) f_{\mathrm{D\text{-}1\text{-}TOK}}(G,r) \mathrel{\mathop{\mathrm{def}}}= \mathcal{R}_{\diamond}(G) f D - 1 - TOK ( G , r ) def = R ⋄ ( G ) , ignoring r r r ; it outputs O ( J 3 ) O(J^{3}) O ( J 3 ) unary strings of length O ( J 120 ) O(J^{120}) O ( J 120 ) , so it is computable in polynomial time. We define g D - 1 - T O K ( G , S , r ) g_{\mathrm{D\text{-}1\text{-}TOK}}(G,S,r) g D - 1 - TOK ( G , S , r ) as whichever of the two colourings dec ( S ) \operatorname{dec}(S) dec ( S ) and σ l o c \sigma_{\mathrm{loc}} σ loc cuts more edges of G G G (either, in case of a tie), where σ l o c \sigma_{\mathrm{loc}} σ loc is the locally maximal colouring returned by the local search of Fact 1; both are computable in polynomial time. Let C C C be the cut size of this output. It remains to show condition (iii) of Definition 5.
Recall that J ≥ 4 J \geq4 J ≥ 4 and, by Eq. (79) , μ ( G ) ≥ J \mu(G) \geq J μ ( G ) ≥ J . Then, by corollary 1 and Eq. (105) :
G c o m p ⋆ ( D ) ≤ Δ − J 3 = 211 2 J 3 + 2 J 2 ≤ 106 J 3 ≤ 106 J 2 μ ( G ) , (131) \mathcal{G}^{\star}_{\mathrm{comp}}(\mathcal{D}) \leq\Delta- J^{3} = \frac{211}{2}J^{3} + 2J^{2} \leq106J^{3} \leq106J^{2}\mu(G), \tag*{(131)} G comp ⋆ ( D ) ≤ Δ − J 3 = 2 211 J 3 + 2 J 2 ≤ 106 J 3 ≤ 106 J 2 μ ( G ) , (131) where the second inequality uses J ≥ 4 J \geq4 J ≥ 4 . Now let S S S achieve ratio at most r = 1 + ε r = 1 + \varepsilon r = 1 + ε , i.e., G c o m p ( tok ⋄ [ S ] , D ) − G c o m p ⋆ ( D ) ≤ ε G c o m p ⋆ ( D ) \mathcal{G}_{\mathrm{comp}}(\operatorname{tok}_{\diamond}[S],\mathcal{D}) - \mathcal{G}^{\star}_{\mathrm{comp}}(\mathcal{D}) \leq\varepsilon\mathcal{G}^{\star}_{\mathrm{comp}}(\mathcal{D}) G comp ( tok ⋄ [ S ] , D ) − G comp ⋆ ( D ) ≤ ε G comp ⋆ ( D ) . Combining Eqs. (130) and (131) and dividing by J 2 J^{2} J 2 :
μ ( G ) − C ≤ μ ( G ) − cut G ( dec ( S ) ) ≤ 106 ε μ ( G ) . (132) \mu(G) - C \leq\mu(G) - \operatorname{cut}_{G}(\operatorname{dec}(S)) \leq106\varepsilon\mu(G). \tag*{(132)} μ ( G ) − C ≤ μ ( G ) − cut G ( dec ( S )) ≤ 106 ε μ ( G ) . (132) If ε ≤ 1 / 212 \varepsilon\leq1/212 ε ≤ 1/212 , then
μ ( G ) C ≤ 1 1 − 106 ε ≤ 1 + 212 ε , (133) \frac{\mu(G)}{C} \leq\frac{1}{1 - 106\varepsilon} \leq1 + 212\varepsilon, \tag*{(133)} C μ ( G ) ≤ 1 − 106 ε 1 ≤ 1 + 212 ε , (133) where the last inequality is equivalent to 106 ε ( 1 − 212 ε ) ≥ 0 106\varepsilon(1 - 212\varepsilon) \geq0 106 ε ( 1 − 212 ε ) ≥ 0 . If ε > 1 / 212 \varepsilon> 1/212 ε > 1/212 , the locally maximal colouring gives C ≥ J ≥ 2 3 μ ( G ) C \geq J \geq\frac{2}{3}\mu(G) C ≥ J ≥ 3 2 μ ( G ) , as μ ( G ) ≤ I = 3 2 J \mu(G) \leq I = \frac{3}{2}J μ ( G ) ≤ I = 2 3 J ; so μ ( G ) / C ≤ 3 / 2 < 1 + 212 ε \mu(G)/C \leq3/2 < 1 + 212\varepsilon μ ( G ) / C ≤ 3/2 < 1 + 212 ε . In both cases, R ( G , g D - 1 - T O K ( G , S , r ) ) ≤ 1 + 212 ( r − 1 ) \mathcal{R}(G,g_{\mathrm{D\text{-}1\text{-}TOK}}(G,S,r)) \leq1 + 212(r - 1) R ( G , g D - 1 - TOK ( G , S , r )) ≤ 1 + 212 ( r − 1 ) .
Proof of Theorem 5. 3-MAX-CUT is APX-hard (Alimonti and Kann, [2 ] ), and Lemma 14 gives an AP-reduction 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 \varepsilon= \eta/106 ε = η /106 , would yield a cut of size at least ( 1 − η ) μ ( G ) (1 - \eta)\mu(G) ( 1 − η ) μ ( G ) for every fixed η > 0 \eta> 0 η > 0 , contradicting the hardness of 3-MAX-CUT unless P = NP.
Arithmetic of Reduction 4
We now show the technical sublemmas used throughout our proof.
SubLemma 1 (Label uniqueness). Let J \mathcal{J} J and J ′ \mathcal{J}' J ′ be multisets of at most four indices in V J \mathcal{V}_{J} V J each. If ∑ i ∈ J enc ( v i ) = ∑ i ∈ J ′ enc ( v i ) \sum_{i\in\mathcal{J}}\operatorname{enc}(v_i) = \sum_{i\in\mathcal{J}'}\operatorname{enc}(v_i) ∑ i ∈ J enc ( v i ) = ∑ i ∈ J ′ enc ( v i ) , then J = J ′ \mathcal{J} = \mathcal{J}' J = J ′ . Moreover, enc ( v i ) < β 5 \operatorname{enc}(v_i) < \beta^{5} enc ( v i ) < β 5 for every i ∈ V J i \in\mathcal{V}_{J} i ∈ V J .
Proof. Let a number ( d 4 , d 3 , d 2 , d 1 , d 0 ) β (d_{4},d_{3},d_{2},d_{1},d_{0})_{\beta} ( d 4 , d 3 , d 2 , d 1 , d 0 ) β denote ∑ k = 0 4 d k β k \sum_{k=0}^{4}d_{k}\beta^{k} ∑ k = 0 4 d k β k . We have enc ( v i ) = ( i 4 , i 3 , i 2 , i , 0 ) β \operatorname{enc}(v_i) = (i^{4},i^{3},i^{2},i,0)_{\beta} enc ( v i ) = ( i 4 , i 3 , i 2 , i , 0 ) β , and in a sum of at most four labels each digit is at most 4 J 8 < β 4J^{8} < \beta 4 J 8 < β . No carries thus occur, and the equality of the two sums implies equality of each digit:
∑ i ∈ J i k = ∑ i ∈ J ′ i k for k ∈ { 1 , 2 , 3 , 4 } . (134) \sum_{i\in\mathcal{J}} i^{k} = \sum_{i\in\mathcal{J}'} i^{k} \qquad\text{for } k \in\{1,2,3,4\}. \tag*{(134)} i ∈ J ∑ i k = i ∈ J ′ ∑ i k for k ∈ { 1 , 2 , 3 , 4 } . (134) 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 ′ \mathcal{J} = \mathcal{J}' J = J ′ . Finally, i k ≤ J 8 < β / 8 i^{k} \leq J^{8} < \beta/8 i k ≤ J 8 < β /8 for 1 ≤ k ≤ 4 1 \leq k \leq4 1 ≤ k ≤ 4 , so enc ( v i ) < β 8 ( β + β 2 + β 3 + β 4 ) < β 5 \operatorname{enc}(v_i) < \frac{\beta}{8}(\beta+ \beta^{2} + \beta^{3} + \beta^{4}) < \beta^{5} enc ( v i ) < 8 β ( β + β 2 + β 3 + β 4 ) < β 5 .
Every length in Reduction 4 is an integer combination of the unit 1, the two markers, and the labels. For such a combination x = c 1 + c B B + c W W + ∑ i ∈ V J c i enc ( v i ) x=c_1+c_BB+c_WW+\sum_{i\in V_J}c_i\operatorname{enc}(v_i) x = c 1 + c B B + c W W + ∑ i ∈ V J c i enc ( v i ) , we call c ( x ) : = ( c 1 , c B , c W , ( c i ) i ∈ V J ) c(x)\mathrel{\mathop:}=(c_1,c_B,c_W,(c_i)_{i\in V_J}) c ( x ) : = ( c 1 , c B , c W , ( c i ) i ∈ V J ) its formal coefficients . For an integer vector d = ( d i ) i ∈ V J \mathbf{d}=(d_i)_{i\in V_J} d = ( d i ) i ∈ V J , we write d i + : = max ( d i , 0 ) d_i^{+}\mathrel{\mathop:}=\max(d_i,0) d i + : = max ( d i , 0 ) and d i − : = max ( − d i , 0 ) d_i^{-}\mathrel{\mathop:}=\max(-d_i,0) d i − : = max ( − d i , 0 ) , so that d i = d i + − d i − d_i=d_i^{+}-d_i^{-} d i = d i + − d i − and d i + d i − = 0 d_i^{+}d_i^{-}=0 d i + d i − = 0 .
SubLemma 2 (Coefficient matching). Let α 1 , α B , α W ∈ Z \alpha_1,\alpha_B,\alpha_W\in\mathbb{Z} α 1 , α B , α W ∈ Z and d ∈ Z V J \mathbf{d}\in\mathbb{Z}^{V_J} d ∈ Z V J satisfy
∣ α 1 ∣ , ∣ α B ∣ , ∣ α W ∣ ≤ 2 , ∑ i ∈ V J d i + ≤ 4 , ∑ i ∈ V J d i − ≤ 4. (135) |\alpha_1|,|\alpha_B|,|\alpha_W|\le2,\qquad\sum_{i\in V_J}d_i^{+}\le4,\qquad\sum_{i\in V_J}d_i^{-}\le4. \tag*{(135)} ∣ α 1 ∣ , ∣ α B ∣ , ∣ α W ∣ ≤ 2 , i ∈ V J ∑ d i + ≤ 4 , i ∈ V J ∑ d i − ≤ 4. (135) If
α 1 + α B B + α W W + ∑ i ∈ V J d i enc ( v i ) = 0 , (136) \alpha_1+\alpha_BB+\alpha_WW+\sum_{i\in V_J}d_i\operatorname{enc}(v_i)=0, \tag*{(136)} α 1 + α B B + α W W + i ∈ V J ∑ d i enc ( v i ) = 0 , (136) then α 1 = α B = α W = 0 \alpha_1=\alpha_B=\alpha_W=0 α 1 = α B = α W = 0 and d = 0 \mathbf{d}=0 d = 0 .
Proof. We use one elementary fact three times: for integers a a a and R R R and a positive integer Y Y Y ,
a Y + R = 0 and ∣ R ∣ < Y ⟹ a = R = 0 , (137) aY+R=0\quad\text{and}\quad|R|<Y\Longrightarrow a=R=0, \tag*{(137)} aY + R = 0 and ∣ R ∣ < Y ⟹ a = R = 0 , (137)
since a ≠ 0 a\ne0 a = 0 would give ∣ a Y ∣ ≥ Y > ∣ R ∣ = ∣ a Y ∣ |aY|\ge Y>|R|=|aY| ∣ aY ∣ ≥ Y > ∣ R ∣ = ∣ aY ∣ . Write the vertex part as V : = ∑ i ∈ V J d i enc ( v i ) = P − M V\mathrel{\mathop:}=\sum_{i\in V_J}d_i\operatorname{enc}(v_i)=P-M V : = ∑ i ∈ V J d i enc ( v i ) = P − M , where
P : = ∑ i ∈ V J d i + enc ( v i ) , M : = ∑ i ∈ V J d i − enc ( v i ) . (138) P\mathrel{\mathop:}=\sum_{i\in V_J}d_i^{+}\operatorname{enc}(v_i),\qquad M\mathrel{\mathop:}=\sum_{i\in V_J}d_i^{-}\operatorname{enc}(v_i). \tag*{(138)} P : = i ∈ V J ∑ d i + enc ( v i ) , M : = i ∈ V J ∑ d i − enc ( v i ) . (138)
Each of P P P and M M M is a sum of at most four labels by Eq. (135) , and every label satisfies 0 < enc ( v i ) < β 5 0<\operatorname{enc}(v_i)<\beta^5 0 < enc ( v i ) < β 5 (SubLemma 1). Hence 0 ≤ P , M < 4 β 5 0\le P,M<4\beta^5 0 ≤ P , M < 4 β 5 , and
∣ V ∣ < 4 β 5 . (139) |V|<4\beta^5. \tag*{(139)} ∣ V ∣ < 4 β 5 . (139)
We also use β = 8 J 8 + 1 ≥ 9 \beta=8J^8+1\ge9 β = 8 J 8 + 1 ≥ 9 .
Step ①. α W = 0 \alpha_W=0 α W = 0 .
Proof. Rewrite Eq. (136) as α W W + R W = 0 \alpha_WW+R_W=0 α W W + R W = 0 with R W : = α 1 + α B B + V R_W\mathrel{\mathop:}=\alpha_1+\alpha_BB+V R W : = α 1 + α B B + V . By Eqs. (135) and (139) ,
∣ R W ∣ ≤ ∣ α 1 ∣ + ∣ α B ∣ B + ∣ V ∣ < 2 + 2 β 10 + 4 β 5 ≤ 3 β 10 < β 15 = W . (140) |R_W|\le|\alpha_1|+|\alpha_B|B+|V|<2+2\beta^{10}+4\beta^5\le3\beta^{10}<\beta^{15}=W. \tag*{(140)} ∣ R W ∣ ≤ ∣ α 1 ∣ + ∣ α B ∣ B + ∣ V ∣ < 2 + 2 β 10 + 4 β 5 ≤ 3 β 10 < β 15 = W . (140)
By Eq. (137) with Y = W Y=W Y = W , we get α W = 0 \alpha_W=0 α W = 0 .
Step ②. α B = 0 \alpha_B=0 α B = 0 .
Proof. With α W = 0 \alpha_W=0 α W = 0 , Eq. (136) reads α B B + R B = 0 \alpha_BB+R_B=0 α B B + R B = 0 with R B : = α 1 + V R_B\mathrel{\mathop:}=\alpha_1+V R B : = α 1 + V , and
∣ R B ∣ ≤ ∣ α 1 ∣ + ∣ V ∣ < 2 + 4 β 5 < β 10 = B . (141) |R_B|\le|\alpha_1|+|V|<2+4\beta^5<\beta^{10}=B. \tag*{(141)} ∣ R B ∣ ≤ ∣ α 1 ∣ + ∣ V ∣ < 2 + 4 β 5 < β 10 = B . (141)
By Eq. (137) with Y = B Y=B Y = B , we get α B = 0 \alpha_B=0 α B = 0 .
Step ③. α 1 = 0 \alpha_1=0 α 1 = 0 and V = 0 V=0 V = 0 .
Proof. Every label is a multiple of β \beta β : enc ( v i ) = β ∑ k = 1 4 i k β k − 1 \operatorname{enc}(v_i)=\beta\sum_{k=1}^{4}i^k\beta^{k-1} enc ( v i ) = β ∑ k = 1 4 i k β k − 1 . Hence V = β V ′ V=\beta V' V = β V ′ with V ′ : = ∑ i d i ∑ k = 1 4 i k β k − 1 ∈ Z V'\mathrel{\mathop:}=\sum_i d_i\sum_{k=1}^{4}i^k\beta^{k-1}\in\mathbb{Z} V ′ : = ∑ i d i ∑ k = 1 4 i k β k − 1 ∈ Z , and Eq. (136) reads V ′ β + α 1 = 0 V'\beta+\alpha_1=0 V ′ β + α 1 = 0 . As ∣ α 1 ∣ ≤ 2 < β |\alpha_1|\le2<\beta ∣ α 1 ∣ ≤ 2 < β , Eq. (137) with Y = β Y=\beta Y = β gives V ′ = 0 V'=0 V ′ = 0 and α 1 = 0 \alpha_1=0 α 1 = 0 , so V = 0 V=0 V = 0 .
Step ④. d = 0 \mathbf{d}=0 d = 0 . Proof. From V = 0 V=0 V = 0 we get P = M P=M P = M , i.e.,
∑ i ∈ J d i + enc ( v i ) = ∑ i ∈ J d i − enc ( v i ) . (142) \sum_{i\in J} d_i^{+}\,\operatorname{enc}(v_i)=\sum_{i\in J} d_i^{-}\,\operatorname{enc}(v_i). \tag*{(142)} i ∈ J ∑ d i + enc ( v i ) = i ∈ J ∑ d i − enc ( v i ) . (142)
Let J + \mathcal{J}^{+} J + and J − \mathcal{J}^{-} J − be the multisets containing each index i i i with multiplicity d i + d_i^{+} d i + and d i − d_i^{-} d i − , respectively; both have size at most four. By SubLemma 1, J + = J − \mathcal{J}^{+}=\mathcal{J}^{-} J + = J − , so d i + = d i − d_i^{+}=d_i^{-} d i + = d i − for every i i i . Since d i + d i − = 0 d_i^{+}d_i^{-}=0 d i + d i − = 0 , both are zero, and hence d i = 0 d_i=0 d i = 0 for every i i i .
Steps ① to ④ prove the sublemma.
We now check that SubLemma 2 applies to every comparison we need. Table 1 lists the formal coefficients of all lengths in D ∪ S c o m p l \mathcal{D}\cup\mathcal{S}_{\mathrm{compl}} D ∪ S compl , where e i e_i e i denotes the i i i -th unit vector.
Table 1. Formal coefficients of the lengths in Reduction 4.
Every entry of the table has c 1 , c B , c W ∈ { 0 , 1 } c_1,c_B,c_W\in\{0,1\} c 1 , c B , c W ∈ { 0 , 1 } and a non-negative label vector with ∑ i c i ≤ 2 \sum_i c_i\leq2 ∑ i c i ≤ 2 . We consider three kinds of equalities, and in each case let ( α 1 , α B , α W , d ) (\alpha_1,\alpha_B,\alpha_W,\mathbf{d}) ( α 1 , α B , α W , d ) be the difference of the formal coefficients of the two sides:
(i) x = y x=y x = y for x , y ∈ D ∪ S c o m p l x,y\in\mathcal{D}\cup\mathcal{S}_{\mathrm{compl}} x , y ∈ D ∪ S compl . Each coefficient of the difference lies in { − 1 , 0 , 1 } \{-1,0,1\} { − 1 , 0 , 1 } , and ∑ i d i + ≤ 2 \sum_i d_i^{+}\leq2 ∑ i d i + ≤ 2 and ∑ i d i − ≤ 2 \sum_i d_i^{-}\leq2 ∑ i d i − ≤ 2 .
(ii) ℓ e ′ ′ = p + p ′ \ell_e''=p+p' ℓ e ′′ = p + p ′ for p , p ′ ∈ S c o m p l p,p'\in\mathcal{S}_{\mathrm{compl}} p , p ′ ∈ S compl . Here α 1 ∈ { − 2 , − 1 , 0 } \alpha_1\in\{-2,-1,0\} α 1 ∈ { − 2 , − 1 , 0 } and α B , α W ∈ { − 1 , 0 , 1 } \alpha_B,\alpha_W\in\{-1,0,1\} α B , α W ∈ { − 1 , 0 , 1 } ; the positive label part comes from ℓ e ′ ′ \ell_e'' ℓ e ′′ alone and the negative one from p + p ′ p+p' p + p ′ , so ∑ i d i + ≤ 2 \sum_i d_i^{+}\leq2 ∑ i d i + ≤ 2 and ∑ i d i − ≤ 2 \sum_i d_i^{-}\leq2 ∑ i d i − ≤ 2 .
(iii) ℓ e ′ ′ − p = ℓ f ′ ′ − p ′ \ell_e''-p=\ell_f''-p' ℓ e ′′ − p = ℓ f ′′ − p ′ for p , p ′ ∈ S c o m p l p,p'\in\mathcal{S}_{\mathrm{compl}} p , p ′ ∈ S compl , i.e., ℓ e ′ ′ + p ′ = ℓ f ′ ′ + p \ell_e''+p'=\ell_f''+p ℓ e ′′ + p ′ = ℓ f ′′ + p . Each side has unit coefficient in { 0 , 1 } \{0,1\} { 0 , 1 } , marker coefficients in { 1 , 2 } \{1,2\} { 1 , 2 } , and label mass at most 3; hence α 1 , α B , α W ∈ { − 1 , 0 , 1 } \alpha_1,\alpha_B,\alpha_W\in\{-1,0,1\} α 1 , α B , α W ∈ { − 1 , 0 , 1 } , ∑ i d i + ≤ 3 \sum_i d_i^{+}\leq3 ∑ i d i + ≤ 3 , and ∑ i d i − ≤ 3 \sum_i d_i^{-}\leq3 ∑ i d i − ≤ 3 .
In all three cases Eq. (135) holds, so SubLemma 2 gives c(\text{left-hand side})=c(\text{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 \mathcal{D} D have distinct lengths, the $3+3J^2$ compliant tokens are distinct, and ℓ i ′ ∉ S c o m p l \ell_i'\notin\mathcal{S}_{\mathrm{compl}} ℓ i ′ ∈ / S compl and ℓ e ′ ′ ∉ S c o m p l \ell_e''\notin\mathcal{S}_{\mathrm{compl}} ℓ e ′′ ∈ / S compl for all i i i and $e.
(b) For e = { i , j } ∈ E J e=\{i,j\}\in E_J e = { i , j } ∈ E J , the only ways to write ℓ e ′ ′ = p + p ′ \ell_e''=p+p' ℓ e ′′ = p + p ′ with p , p ′ ∈ S c o m p l p,p'\in\mathcal{S}_{\mathrm{compl}} p , p ′ ∈ S compl are, up to order, ℓ i B + ℓ j W \ell_i^B+\ell_j^W ℓ i B + ℓ j W and ℓ i W + ℓ j B \ell_i^W+\ell_j^B ℓ i W + ℓ j B .
(c) For every q ∈ N ∖ S c o m p l q\in\mathbb{N}\setminus\mathcal{S}_{\mathrm{compl}} q ∈ N ∖ S compl , at most 3 J 3J 3 J edges e ∈ E J e\in E_J e ∈ E J satisfy ℓ e ′ ′ − q ∈ S c o m p l \ell_e''-q\in\mathcal{S}_{\mathrm{compl}} ℓ e ′′ − q ∈ S compl .
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 ′ ′ \ell_e^{\prime\prime} ℓ e ′′ has marker coefficients ( 1 , 1 ) (1,1) ( 1 , 1 ) , unit coefficient 0 0 0 , and label coefficients 1 1 1 at exactly i i i and j j j . A sum of two compliant tokens matches the marker coefficients only if it takes one B B B and one W W W , either from { B , W } \{B,W\} { B , W } themselves or from colour-strings; it matches the unit coefficient only if it avoids 1 1 1 ; and it matches the label coefficients only if it contributes exactly one label at i i i and one at j j j . This leaves only the two decompositions in the statement.
Part (c). Fix a non-compliant token q ∉ S c o m p l q \notin S_{\mathrm{compl}} q ∈ / S compl . We bound the number of edges e ∈ E J e \in\mathcal{E}_J e ∈ E J for which
ℓ e ′ ′ − q ∈ S c o m p l . (143) \ell_e^{\prime\prime}-q \in S_{\mathrm{compl}}. \tag*{(143)} ℓ e ′′ − q ∈ S compl . (143)
Equivalently, suppose that for some edge e = { i , j } e=\{i,j\} e = { i , j } there exists a compliant token p ∈ S c o m p l p \in S_{\mathrm{compl}} p ∈ S compl such that
q = ℓ e ′ ′ − p . (144) q=\ell_e^{\prime\prime}-p. \tag*{(144)} q = ℓ e ′′ − p . (144)
We classify the possibilities according to the form of p p p .
(α \alpha α ) Suppose p ∈ { 1 , B , W } p \in\{1,B,W\} p ∈ { 1 , B , W } . None of these tokens contains a vertex label, whereas ℓ e ′ ′ \ell_e^{\prime\prime} ℓ e ′′ contains exactly the two labels enc ( v i ) \operatorname{enc}(v_i) enc ( v i ) and enc ( v j ) \operatorname{enc}(v_j) enc ( v j ) . Hence the label coefficients of q q q are + 1 +1 + 1 exactly at i i i and j j j . In particular, the positive label coefficients of q q q uniquely determine the edge e = { i , j } e=\{i,j\} e = { i , j } .
(β \beta β ) Suppose
p ∈ { ℓ k , ℓ k B , ℓ k W } for some k ∉ { i , j } . (145) p \in\{\ell_k,\ell_k^B,\ell_k^W\}\qquad\text{for some }k\notin\{i,j\}. \tag*{(145)} p ∈ { ℓ k , ℓ k B , ℓ k W } for some k ∈ / { i , j } . (145)
The token p p p contributes one copy of the label enc ( v k ) \operatorname{enc}(v_k) enc ( v k ) , so the label coefficients of q = ℓ e ′ ′ − p q=\ell_e^{\prime\prime}-p q = ℓ e ′′ − p are + 1 +1 + 1 at i i i and j j j , − 1 -1 − 1 at k k k , and zero elsewhere. Again, the two positive label coefficients uniquely identify the endpoints of e e e .
(γ \gamma γ ) It remains to consider the case where p p p is associated with an endpoint of e e e . Without loss of generality, let
p ∈ { ℓ i , ℓ i B , ℓ i W } . (146) p \in\{\ell_i,\ell_i^B,\ell_i^W\}. \tag*{(146)} p ∈ { ℓ i , ℓ i B , ℓ i W } . (146)
Since
ℓ e ′ ′ = enc ( v i ) + enc ( v j ) + B + W , (147) \ell_e^{\prime\prime}=\operatorname{enc}(v_i)+\operatorname{enc}(v_j)+B+W, \tag*{(147)} ℓ e ′′ = enc ( v i ) + enc ( v j ) + B + W , (147)
the three possible choices of p p p give
ℓ e ′ ′ − ℓ i = enc ( v j ) + B + W = ℓ j ′ , (148) \ell_e^{\prime\prime}-\ell_i=\operatorname{enc}(v_j)+B+W=\ell_j^\prime, \tag*{(148)} ℓ e ′′ − ℓ i = enc ( v j ) + B + W = ℓ j ′ , (148)
ℓ e ′ ′ − ℓ i B = enc ( v j ) + W = ℓ j W , (149) \ell_e^{\prime\prime}-\ell_i^B=\operatorname{enc}(v_j)+W=\ell_j^W, \tag*{(149)} ℓ e ′′ − ℓ i B = enc ( v j ) + W = ℓ j W , (149)
ℓ e ′ ′ − ℓ i W = enc ( v j ) + B = ℓ j B . (150) \ell_e^{\prime\prime}-\ell_i^W=\operatorname{enc}(v_j)+B=\ell_j^B. \tag*{(150)} ℓ e ′′ − ℓ i W = enc ( v j ) + B = ℓ j B . (150)
The latter two values belong to S c o m p l S_{\mathrm{compl}} S compl , whereas q ∉ S c o m p l q \notin S_{\mathrm{compl}} q ∈ / S compl by assumption. They are therefore impossible, and necessarily
q = ℓ j ′ . (151) q=\ell_j^\prime. \tag*{(151)} q = ℓ j ′ . (151)
Thus the fixed token q q q determines one endpoint j j j of e e e , but it does not determine the other endpoint. Consequently, every edge that yields this same q q q must be incident to j j j . Since every vertex of G J G_J G J has degree 3 J 3J 3 J , at most 3 J 3J 3 J edges can arise in this case.
It remains to verify that the same numerical value of q q q cannot arise from different cases in a way that evades these bounds. Suppose
q = ℓ e ′ ′ − p = ℓ f ′ − p ′ (152) q = \ell^{\prime\prime}_{e} - p = \ell^{\prime}_{f} - p^{\prime} \tag*{(152)} q = ℓ e ′′ − p = ℓ f ′ − p ′ (152)
for edges e , f ∈ E J e,f \in\mathcal{E}_J e , f ∈ E J and compliant tokens p , p ′ ∈ S c o m p l p,p^{\prime} \in\mathcal{S}_{\mathrm{compl}} 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 ( α ) (\alpha) ( α ) has two positive coefficients, case ( β ) (\beta) ( β ) has two positive and one negative coefficient, and case ( γ ) (\gamma) ( γ ) has a single positive coefficient. Hence the two representations of q q q must fall in the same case.
In cases ( α ) (\alpha) ( α ) and ( β ) (\beta) ( β ) , the positive label coefficients determine both endpoints of the edge, so necessarily e = f e=f e = f . In case ( γ ) (\gamma) ( γ ) , the fixed token q = ℓ j ′ q=\ell^{\prime}_{j} q = ℓ j ′ determines one endpoint j j j , so all possible edges are incident to j j j ; there are exactly 3 J 3J 3 J such edges in G J G_J G J . Therefore, for every q ∉ S c o m p l q \notin\mathcal{S}_{\mathrm{compl}} q ∈ / S compl , at most 3 J 3J 3 J edges e ∈ E J e \in\mathcal{E}_J e ∈ E J satisfy ℓ e ′ ′ − q ∈ S c o m p l \ell^{\prime\prime}_{e}-q \in\mathcal{S}_{\mathrm{compl}} ℓ 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 Q Q of tokens can split in this way. A priori, this number could be as large as the number of pairs, roughly ∣ Q ∣ 2 / 2 |Q|^2/2 ∣ Q ∣ 2 /2 . We show that it is instead at most linear in ∣ Q ∣ |Q| ∣ Q ∣ , up to a factor of order J + ∣ Q ∣ J+\sqrt{|Q|} 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 Q \subset\mathbb{Z} 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 Q Q satisfies
∣ { e ∈ E J ∣ ℓ e ′ ′ = q + q ′ for some q , q ′ ∈ Q } ∣ ≤ ( 6 J + ∣ Q ∣ + 1 ) ∣ Q ∣ . (153) \left|\left\{e \in\mathcal{E}_J \mathrel{\big|} \ell^{\prime\prime}_{e}=q+q^{\prime}\text{ for some }q,q^{\prime}\in Q\right\}\right| \le(6J+\sqrt{|Q|}+1)|Q|. \tag*{(153)} { e ∈ E J ℓ e ′′ = q + q ′ for some q , q ′ ∈ Q } ≤ ( 6 J + ∣ Q ∣ + 1 ) ∣ Q ∣. (153) Proof. Let E J Q \mathcal{E}_J^Q E J Q denote the set of edges counted on the left-hand side of Eq. (153) . We turn the counting problem into a question about a graph.
The split graph. For every edge e ∈ E J Q e \in\mathcal{E}_J^Q e ∈ E J Q , fix one pair { q e , q e ′ } ⊆ Q \{q_e,q^{\prime}_e\} \subseteq Q { q e , q e ′ } ⊆ Q with q e + q e ′ = ℓ e ′ ′ q_e+q^{\prime}_e=\ell^{\prime\prime}_e q e + q e ′ = ℓ e ′′ ; if several such pairs exist, choose any one of them. The split graph Γ \Gamma Γ has vertex set Q Q Q and, for every e ∈ E J Q e \in\mathcal{E}_J^Q e ∈ E J Q , one edge between q e q_e q e and q e ′ q^{\prime}_e q e ′ , which we label with e e e . (To avoid confusion, we call the elements of Q Q Q tokens and the edges of Γ \Gamma Γ splits ; “vertex” and “edge” always refer to G J G_J G J .) Two different edges e ≠ f e \ne f e = f cannot produce the same split: that would give ℓ e ′ ′ = q e + q e ′ = q f + q f ′ = ℓ f ′ ′ \ell^{\prime\prime}_e=q_e+q^{\prime}_e=q_f+q^{\prime}_f=\ell^{\prime\prime}_f ℓ e ′′ = q e + q e ′ = q f + q f ′ = ℓ f ′′ , whereas edge-strings of different edges have different lengths (SubLemma 3(a)). Hence Γ \Gamma Γ has no parallel splits, each split carries a different label, and
∣ E J Q ∣ = number of splits of Γ . (154) |\mathcal{E}_J^Q|=\text{number of splits of }\Gamma. \tag*{(154)} ∣ E J Q ∣ = number of splits of Γ. (154) A split with q e = q e ′ q_e=q^{\prime}_e q e = q e ′ is a loop. Each token q q q has at most one loop, since a loop at q q q has length 2 q 2q 2 q and hence determines its label; so there are at most ∣ Q ∣ |Q| ∣ Q ∣ loops. We set them aside and bound the number of remaining splits, which form a simple graph Γ 0 \Gamma_0 Γ 0 .
Consider two consecutive splits q − r q-r q − r and r − z r-z r − z in Γ 0 \Gamma_0 Γ 0 , labelled with edges e = { i , j } e=\{i,j\} e = { i , j } and f = { k , l } f=\{k,l\} f = { k , l } , respectively. By definition,
q + r = ℓ i , j ′ ′ and r + z = ℓ k , l ′ ′ . (155) q+r=\ell^{\prime\prime}_{i,j}
\qquad\text{and}\qquad
r+z=\ell^{\prime\prime}_{k,l}. \tag*{(155)} q + r = ℓ i , j ′′ and r + z = ℓ k , l ′′ . (155) Subtracting the first equation from the second, both the middle token r r r and the markers B + W B+W B + W cancel:
z − q = ℓ k , l ′ ′ − ℓ i , j ′ ′ = enc ( v k ) + enc ( v l ) − enc ( v i ) − enc ( v j ) . (156) z-q=\ell^{\prime\prime}_{k,l}-\ell^{\prime\prime}_{i,j}
=\operatorname{enc}(v_k)+\operatorname{enc}(v_l)-\operatorname{enc}(v_i)-\operatorname{enc}(v_j). \tag*{(156)} z − q = ℓ k , l ′′ − ℓ i , j ′′ = enc ( v k ) + enc ( v l ) − enc ( v i ) − enc ( v j ) . (156) 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 q-r-z q − r − z a disjoint two-step path if its labels e e e and f f f share no vertex. The first step of the proof shows that such a path is determined by its two ends.
Step ①. For any two tokens q , z ∈ Q q,z \in Q q , z ∈ Q , there is at most one disjoint two-step path from q q q to z z z in Γ 0 \Gamma_0 Γ 0 .
Proof. Let q − r − z q-r-z q − r − z and q − r ′ − z q-r'-z q − r ′ − z be disjoint two-step paths with labels ( e , f ) (e,f) ( e , f ) and ( e ′ , f ′ ) (e',f') ( e ′ , f ′ ) , respectively. Applying Eq. (156) to both paths gives
ℓ f ′ ′ − ℓ e ′ ′ = z − q = ℓ f ′ ′ ′ − ℓ e ′ ′ ′ . (157) \ell''_{f}-\ell''_{e}=z-q=\ell''_{f'}-\ell''_{e'}. \tag*{(157)} ℓ f ′′ − ℓ e ′′ = z − q = ℓ f ′ ′′ − ℓ e ′ ′′ . (157)
Cancelling the markers and moving the negative terms to the other side, we obtain an equality between two sums of four labels:
∑ i ∈ f enc ( v i ) + ∑ i ∈ e ′ enc ( v i ) = ∑ i ∈ f ′ enc ( v i ) + ∑ i ∈ e enc ( v i ) . (158) \sum_{i\in f}\operatorname{enc}(v_i)+\sum_{i\in e'}\operatorname{enc}(v_i)=\sum_{i\in f'}\operatorname{enc}(v_i)+\sum_{i\in e}\operatorname{enc}(v_i). \tag*{(158)} i ∈ f ∑ enc ( v i ) + i ∈ e ′ ∑ enc ( v i ) = i ∈ f ′ ∑ enc ( v i ) + i ∈ e ∑ enc ( v i ) . (158)
By SubLemma 1, the two index multisets agree: f ⊎ e ′ = f ′ ⊎ e f \mathbin{\uplus} e'=f'\mathbin{\uplus} e f ⊎ e ′ = f ′ ⊎ e . Equivalently, the signed indicator vectors agree, 1 f − 1 e = 1 f ′ − 1 e ′ \mathbf{1}_{f}-\mathbf{1}_{e}=\mathbf{1}_{f'}-\mathbf{1}_{e'} 1 f − 1 e = 1 f ′ − 1 e ′ . Since e ∩ f = ∅ e\cap f=\varnothing e ∩ f = ∅ , the vector 1 f − 1 e \mathbf{1}_{f}-\mathbf{1}_{e} 1 f − 1 e equals + 1 +1 + 1 exactly on the two endpoints of f f f and − 1 -1 − 1 exactly on the two endpoints of e e e ; the same holds for 1 f ′ − 1 e ′ \mathbf{1}_{f'}-\mathbf{1}_{e'} 1 f ′ − 1 e ′ , since e ′ ∩ f ′ = ∅ e'\cap f'=\varnothing e ′ ∩ f ′ = ∅ . Comparing where the two vectors are positive gives f = f ′ f=f' f = f ′ , and comparing where they are negative gives e = e ′ e=e' e = e ′ . Finally, the middle token is determined by q q q and e e e , since r = ℓ e ′ ′ − q = ℓ e ′ ′ ′ − q = r ′ r=\ell''_{e}-q=\ell''_{e'}-q=r' r = ℓ e ′′ − q = ℓ e ′ ′′ − q = r ′ . The two paths are therefore identical.
Step ① limits how many disjoint two-step paths can leave a single token: they all end at different tokens, and there are only ∣ Q ∣ |Q| ∣ Q ∣ tokens. If every token had many splits, there would be too many such paths. The next step makes this precise.
Step ②. Every non-empty subgraph of Γ 0 \Gamma_0 Γ 0 contains a token with at most 6 J + ∣ Q ∣ 6J+\sqrt{|Q|} 6 J + ∣ Q ∣ splits in that subgraph.
Proof. Suppose, for contradiction, that some non-empty subgraph Γ ′ \Gamma' Γ ′ of Γ 0 \Gamma_0 Γ 0 has minimum degree d > 6 J + ∣ Q ∣ d>6J+\sqrt{|Q|} d > 6 J + ∣ Q ∣ . Fix any token q q q in Γ ′ \Gamma' Γ ′ and count the disjoint two-step paths starting at q q q within Γ ′ \Gamma' Γ ′ .
First split. Token q q q has at least d d d splits q − r q-r q − r in Γ ′ \Gamma' Γ ′ . Fix one, and let e = { i , j } e=\{i,j\} e = { i , j } be its label.
Second split. Token r r r also has at least d d d splits in Γ ′ \Gamma' Γ ′ . We must discard those whose label shares a vertex with e e e . Each vertex of G J G_J G J has degree 3 J 3J 3 J , so at most 3 J + 3 J − 1 = 6 J − 1 3J+3J-1=6J-1 3 J + 3 J − 1 = 6 J − 1 edges of G J G_J G J touch i i i or j j j . As different splits carry different labels, at most 6 J − 1 6J-1 6 J − 1 splits at r r r are discarded, leaving at least d − 6 J + 1 d-6J+1 d − 6 J + 1 .
Different choices of the two splits give different paths, so at least d ( d − 6 J + 1 ) d(d-6J+1) d ( d − 6 J + 1 ) disjoint two-step paths start at q q q . By Step ①, they end at pairwise different tokens, so their number is at most ∣ Q ∣ |Q| ∣ Q ∣ . However, d > ∣ Q ∣ d>\sqrt{|Q|} d > ∣ Q ∣ and d − 6 J + 1 > ∣ Q ∣ d-6J+1>\sqrt{|Q|} d − 6 J + 1 > ∣ Q ∣ , so
d ( d − 6 J + 1 ) > ∣ Q ∣ ⋅ ∣ Q ∣ = ∣ Q ∣ . (159) d(d-6J+1)>\sqrt{|Q|}\cdot\sqrt{|Q|}=|Q|. \tag*{(159)} d ( d − 6 J + 1 ) > ∣ Q ∣ ⋅ ∣ Q ∣ = ∣ Q ∣. (159)
a contradiction.
Step ③. Γ 0 \Gamma_0 Γ 0 has at most ( 6 J + ∣ Q ∣ ) ∣ Q ∣ (6J+\sqrt{|Q|})|Q| ( 6 J + ∣ Q ∣ ) ∣ Q ∣ splits.
Proof. We delete the tokens of Γ 0 \Gamma_0 Γ 0 one by one. By Step ②, applied to what remains of Γ 0 \Gamma_0 Γ 0 at each point, we can always delete a token that has at most 6 J + ∣ Q ∣ 6J+\sqrt{|Q|} 6 J + ∣ Q ∣ remaining splits, and we delete those splits with it. After ∣ Q ∣ |Q| ∣ Q ∣ deletions nothing remains, so every split was deleted in some round. Each round deletes at most 6 J + ∣ Q ∣ 6J+\sqrt{|Q|} 6 J + ∣ Q ∣ splits, which gives the bound.
Adding back the at most ∣ Q ∣ |Q| ∣ Q ∣ loops, the split graph Γ \Gamma Γ has at most ( 6 J + ∣ Q ∣ + 1 ) ∣ Q ∣ (6J+\sqrt{|Q|}+1)|Q| ( 6 J + ∣ Q ∣ + 1 ) ∣ Q ∣ splits, which proves Eq. (153) .
The degree term cannot be avoided. Since β \beta β is odd, B + W B+W B + W is even, and the J 2 J^2 J 2 tokens x i = d e f enc ( v i ) + 1 2 ( B + W ) x_i\mathrel{\mathop{=}^{\mathrm{def}}}\operatorname{enc}(v_i)+\frac{1}{2}(B+W) x i = def enc ( v i ) + 2 1 ( B + W ) satisfy x i + x j = ℓ i , j ′ ′ x_i+x_j=\ell''_{i,j} x i + x j = ℓ i , j ′′ for every edge { i , j } ∈ E J \{i,j\}\in\mathcal{E}_J { i , j } ∈ E J ; together they split all 3 2 J 3 \frac{3}{2}J^3 2 3 J 3 edge-strings, that is, 3 2 J \frac{3}{2}J 2 3 J per token. Non-compliant tokens can thus save Θ ( J ) \Theta(J) Θ ( J ) symbols each, so the multiplicities must grow linearly in J J J ; the blow-up makes this affordable, as both Δ \Delta Δ and J 2 μ ( G ) J^2\mu(G) J 2 μ ( G ) are then Θ ( J 3 ) \Theta(J^3) Θ ( J 3 ) .
Rounding Palettes to a Cut
SubLemma 5 (Rounding). Let G G G be a simple cubic graph and G J G_J G J its J J J -blow-up. Give each i ∈ V J i \in\mathcal{V}_J i ∈ V J a palette Π i ⊆ { B , W } \Pi_i \subseteq\{B, W\} Π i ⊆ { B , W } , and let g g g count the edges { i , j } ∈ E J \{i,j\} \in\mathcal{E}_J { i , j } ∈ E J whose palettes permit unequal colours, i.e., for which there exist θ ∈ Π i \theta\in\Pi_i θ ∈ Π i and θ ′ ∈ Π j \theta' \in\Pi_j θ ′ ∈ Π j with θ ≠ θ ′ \theta\ne\theta' θ = θ ′ . Then a colouring σ G \sigma_G σ G of G G G with
J 2 cut G ( σ G ) ≥ g + J ( J 2 − ∑ i ∈ V J ∣ Π i ∣ ) (160) J^2\operatorname{cut}_G(\sigma_G) \ge g + J\left(J^2-\sum_{i\in\mathcal{V}_J}|\Pi_i|\right) \tag*{(160)} J 2 cut G ( σ G ) ≥ g + J ( J 2 − i ∈ V J ∑ ∣ Π i ∣ ) (160) can be found in deterministic polynomial time.
Proof. We proceed in two steps: we first round palettes on G G G itself, and then reduce the blow-up to that case.
Step ①. Given palettes Π v \Pi_v Π v on the vertices v ∈ V v \in\mathcal{V} v ∈ V , with g G g_G g G edges of G G G permitting unequal colours, we can find in polynomial time a colouring σ G \sigma_G σ G with cut G ( σ G ) ≥ g G + J − ∑ v ∈ V ∣ Π v ∣ \operatorname{cut}_G(\sigma_G) \ge g_G+J-\sum_{v\in\mathcal{V}}|\Pi_v| cut G ( σ G ) ≥ g G + J − ∑ v ∈ V ∣ Π v ∣ .
Proof. Let d d d vertices have both colours and z z z have neither, so ∑ v ∣ Π v ∣ = J + d − z \sum_{v}|\Pi_v|=J+d-z ∑ 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 g_G g G that is uncut has a doubly coloured endpoint, so at least g G − d g_G-d 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 z z cut edges are incident to empty-palette vertices. The edges counted before are unaffected, so the final cut has size at least g G − d + z = g G + J − ∑ v ∣ Π v ∣ g_G-d+z=g_G+J-\sum_{v}|\Pi_v| g G − d + z = g G + J − ∑ v ∣ Π v ∣ . Each phase terminates after at most I I I improving moves. □
Step ②. We can select in deterministic polynomial time one representative clone per cluster whose palettes, assigned to the corresponding source vertices, satisfy
g G + J − ∑ v ∈ V ∣ Π v ∣ ≥ g J 2 + J − 1 J ∑ i ∈ V J ∣ Π i ∣ . (161) g_G+J-\sum_{v\in\mathcal{V}}|\Pi_v| \ge\frac{g}{J^2}+J-\frac{1}{J}\sum_{i\in\mathcal{V}_J}|\Pi_i|. \tag*{(161)} g G + J − v ∈ V ∑ ∣ Π v ∣ ≥ J 2 g + J − J 1 i ∈ V J ∑ ∣ Π i ∣. (161)
Proof. Choose one representative independently and uniformly from each cluster. Each edge of G J G_J G J lies between two clusters joined by a source edge, and each source edge has J 2 J^2 J 2 such edges; hence the expected value of g G g_G g G is g / J 2 g/J^2 g / J 2 . Each cluster has J J J clones, so the expected value of ∑ v ∣ Π v ∣ \sum_v|\Pi_v| ∑ v ∣ Π v ∣ is 1 J ∑ i ∣ Π i ∣ \frac{1}{J}\sum_i|\Pi_i| J 1 ∑ 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 ① to the representatives of Step ② and multiplying by J 2 J^2 J 2 gives Eq. (160) . No random choices are made. □