Algorithm Search⌘K

Proofs: Edit distance hardness under SETH

These are the human proofs of Edit distance hardness under SETH, at full length.

Proof of the edit distance hardness theorem full

This proof shows: statement.

Positions in strings are numbered from 1 in this proof, and coordinates of vectors also from 1. For a symbol γ\gamma and an integer h≥0h \ge 0, γh\gamma^h is the string of hh copies of γ\gamma. The distance ed\mathrm{ed} is the Levenshtein distance with unit costs.

Alignments and gain

An alignment of strings xx and yy is a set of pairs (i,j)(i, j) with 1≤i≤∣x∣1 \le i \le |x| and 1≤j≤∣y∣1 \le j \le |y|, such that no two pairs share an ii or a jj, and for any two pairs (i,j)(i, j) and (i′,j′)(i', j'), i<i′i < i' holds if and only if j<j′j < j'. A pair is equal when x[i]=y[j]x[i] = y[j] and unequal otherwise. A symbol in no pair is unpaired. The cost of the alignment is the number of unpaired symbols of xx and yy plus the number of unequal pairs. Each unpaired symbol and each unequal pair is one unit of cost.

Lemma 1. ed(x,y)\mathrm{ed}(x, y) is the least cost of an alignment of xx and yy. If an alignment has π\pi pairs, of which μ\mu are equal, its cost is ∣x∣+∣y∣−(π+μ)|x| + |y| - (\pi + \mu).

Proof. Given an alignment, delete the unpaired symbols of xx, substitute y[j]y[j] for x[i]x[i] in each unequal pair, and insert the unpaired symbols of yy. Because the pairs are in the same order in both strings, this turns xx into yy with as many operations as the cost. Conversely, take a sequence of cc operations that turns xx into yy, and follow each symbol of xx through it. Pair x[i]x[i] with y[j]y[j] when the symbol at position ii of xx is never deleted and ends at position jj of yy. Insertions, deletions and substitutions keep the order of the symbols that they do not remove, so this is an alignment. Each unpaired symbol of xx was deleted, each unpaired symbol of yy comes from an insertion, and the symbol of each unequal pair was substituted at least once. These are distinct operations, so the cost of the alignment is at most cc. For the formula: there are ∣x∣−π|x| - \pi unpaired symbols in xx, ∣y∣−π|y| - \pi in yy and π−μ\pi - \mu unequal pairs, and the sum is ∣x∣+∣y∣−π−μ|x| + |y| - \pi - \mu. □\square

Call π+μ\pi + \mu the gain of the alignment: each pair gains 1, and 2 when it is equal. Let g(x,y)=∣x∣+∣y∣−ed(x,y)g(x, y) = |x| + |y| - \mathrm{ed}(x, y), the largest gain of an alignment of xx and yy. Lemma 1 turns each lower bound on ed\mathrm{ed} into an upper bound on the gain. Reversing both strings maps alignments to alignments with the same pairs read backwards, so ed\mathrm{ed} and gg do not change under the reversal of both arguments.

The next fact is used many times. Let (i1,j1)(i_1, j_1) and (i2,j2)(i_2, j_2) be pairs of an alignment with i1<i2i_1 < i_2, so j1<j2j_1 < j_2.

(B) A symbol of yy at a position strictly between j1j_1 and j2j_2 is unpaired or paired with a position of xx strictly between i1i_1 and i2i_2. The same holds with the roles of xx and yy exchanged.

This follows from the definition: a pair (i,j)(i, j) with j1<j<j2j_1 < j < j_2 needs i1<i<i2i_1 < i < i_2.

From SETH to orthogonal vectors

Lemma 2. If there are constants δ>0\delta > 0 and cc and an algorithm that solves OV with nn vectors of dimension dd on each side in time O(n2−δdc)O(n^{2-\delta} d^c), then SETH is false.

Proof. A smaller δ\delta gives a weaker assumption, so we may assume δ≤1\delta \le 1. Let ε=δ/4\varepsilon = \delta / 4 and let kk be any integer. Take a kk-CNF formula φ\varphi with ν\nu variables. Add one unused variable if ν\nu is odd, and remove repeated clauses. A clause is a set of at most kk literals out of 2ν2\nu, so there are κ≤(2ν+1)k\kappa \le (2\nu + 1)^k clauses. Split the variables into two halves V1V_1 and V2V_2 of size ν/2\nu / 2. For each assignment α\alpha of V1V_1, let uα∈{0,1}κu_\alpha \in \{0, 1\}^\kappa have coordinate rr equal to 0 when some literal of clause rr on a variable of V1V_1 is true under α\alpha, and 1 otherwise. Define wβw_\beta in the same way for each assignment β\beta of V2V_2. Then uα⋅wβ=0u_\alpha \cdot w_\beta = 0 if and only if each clause has a literal that is true under α\alpha or under β\beta, that is, if and only if the joint assignment satisfies φ\varphi. So φ\varphi is satisfiable if and only if the OV instance with the n=2ν/2n = 2^{\nu/2} vectors uαu_\alpha and the nn vectors wβw_\beta has an orthogonal pair. Building the instance takes O(nκk)O(n \kappa k) time, and the algorithm takes O(n2−δκc)=O(2(1−δ/2)ν(2ν+1)kc)O(n^{2-\delta} \kappa^c) = O(2^{(1 - \delta/2)\nu} (2\nu + 1)^{kc}). For fixed kk, (2ν+1)kc≤2δν/4(2\nu + 1)^{kc} \le 2^{\delta \nu / 4} for all large ν\nu, so the total time is O(2(1−ε)ν)O(2^{(1 - \varepsilon)\nu}). This holds for every kk, which contradicts SETH for this ε\varepsilon. □\square

Coordinate gadgets

Fix t≥1t \ge 1. The alphabet has distinct symbols σℓ,0\sigma_{\ell, 0}, σℓ,1\sigma_{\ell, 1} and τℓ\tau_\ell for 1≤ℓ≤t1 \le \ell \le t. For u,w∈{0,1}tu, w \in \{0, 1\}^t let

L(u)=σ1,u1σ2,u2⋯σt,ut,Q(w)=β1(w1)β2(w2)⋯βt(wt),L(u) = \sigma_{1, u_1} \sigma_{2, u_2} \cdots \sigma_{t, u_t}, \qquad Q(w) = \beta_1(w_1) \beta_2(w_2) \cdots \beta_t(w_t),

where the block βℓ(0)=σℓ,0σℓ,1\beta_\ell(0) = \sigma_{\ell, 0} \sigma_{\ell, 1} and βℓ(1)=σℓ,0τℓ\beta_\ell(1) = \sigma_{\ell, 0} \tau_\ell. So ∣L(u)∣=t|L(u)| = t and ∣Q(w)∣=2t|Q(w)| = 2t.

Lemma 3. ed(L(u),Q(w))=t+u⋅w\mathrm{ed}(L(u), Q(w)) = t + u \cdot w.

Proof. The symbol σℓ,uℓ\sigma_{\ell, u_\ell} at position ℓ\ell of L(u)L(u) occurs in Q(w)Q(w) only in block ℓ\ell, and it occurs there exactly when uℓ=0u_\ell = 0 or wℓ=0w_\ell = 0, that is, when uℓwℓ=0u_\ell w_\ell = 0. So an alignment has at most t−u⋅wt - u \cdot w equal pairs, and at most tt pairs, because ∣L(u)∣=t|L(u)| = t. Its gain is at most 2t−u⋅w2t - u \cdot w, and by Lemma 1 its cost is at least 3t−(2t−u⋅w)=t+u⋅w3t - (2t - u \cdot w) = t + u \cdot w. For the upper bound, pair position ℓ\ell of L(u)L(u) with the copy of σℓ,uℓ\sigma_{\ell, u_\ell} in block ℓ\ell when there is one, and with the first symbol of block ℓ\ell otherwise. The pairs are in increasing order in both strings, there are tt of them, and t−u⋅wt - u \cdot w are equal, so the gain is 2t−u⋅w2t - u \cdot w and the cost is t+u⋅wt + u \cdot w. □\square

A gadget with two options

Lemma 4. Let α\alpha and β\beta be two symbols, and let LL, RR and DD be strings that contain neither of them, with ∣L∣=∣R∣=p|L| = |R| = p and ∣D∣=q|D| = q. Let h≥2qh \ge 2q, and

X=αhLβhRαh,Y=βhDβh.X = \alpha^h L \beta^h R \alpha^h, \qquad Y = \beta^h D \beta^h.

Then ed(X,Y)=2h+p+min⁡(ed(L,D),ed(R,D))\mathrm{ed}(X, Y) = 2h + p + \min(\mathrm{ed}(L, D), \mathrm{ed}(R, D)).

Proof. Name the parts X=Z1LV0RZ2X = Z_1 L V_0 R Z_2 and Y=V1DV2Y = V_1 D V_2, with Z1=Z2=αhZ_1 = Z_2 = \alpha^h and V0=V1=V2=βhV_0 = V_1 = V_2 = \beta^h. Then ∣X∣=3h+2p|X| = 3h + 2p and ∣Y∣=2h+q|Y| = 2h + q.

Upper bound. Pair Z1Z_1 with V1V_1 symbol by symbol (hh unequal pairs), align LL with DD at cost ed(L,D)\mathrm{ed}(L, D), pair V0V_0 with V2V_2 (hh equal pairs), and leave RR and Z2Z_2 unpaired (p+hp + h units). The cost is 2h+p+ed(L,D)2h + p + \mathrm{ed}(L, D). In the same way, leaving Z1Z_1 and LL unpaired, pairing V0V_0 with V1V_1, RR with DD and Z2Z_2 with V2V_2 costs 2h+p+ed(R,D)2h + p + \mathrm{ed}(R, D).

Lower bound. By Lemma 1 it suffices to show that each alignment has gain at most 3h+max⁡(g(L,D),g(R,D))3h + \max(g(L, D), g(R, D)), since then the cost is at least (5h+2p+q)−3h−(p+q)+min⁡(ed(L,D),ed(R,D))(5h + 2p + q) - 3h - (p + q) + \min(\mathrm{ed}(L, D), \mathrm{ed}(R, D)). Fix an alignment. Each pair has its YY end in V1∪V2V_1 \cup V_2 or in DD. Let ΓV\Gamma_V be the gain of the pairs with their YY end in V1∪V2V_1 \cup V_2, and ΓD\Gamma_D the gain of the pairs with their YY end in DD. The only symbols β\beta of XX are in V0V_0, so an equal pair with its YY end in V1∪V2V_1 \cup V_2 has its XX end in V0V_0. There are three cases.

Case 1: DD has a partner in Z1LZ_1 L and a partner in RZ2R Z_2. All of V0V_0 lies strictly between these two partners, so by (B) each symbol of V0V_0 is unpaired or paired with a symbol of DD. So no pair with its YY end in V1∪V2V_1 \cup V_2 is equal, and ΓV≤2h\Gamma_V \le 2h. Each symbol of DD gains at most 2, so ΓD≤2q≤h\Gamma_D \le 2q \le h. The gain is at most 3h3h.

Case 2: DD has no partner in RZ2R Z_2. The partners of DD lie in Z1Z_1, LL and V0V_0. Let kZk_Z and kVk_V be the numbers of pairs between DD and Z1Z_1, and between DD and V0V_0. Each of these pairs is unequal and gains 1. The pairs between LL and DD form an alignment of LL and DD, so they gain at most g(L,D)g(L, D). So ΓD≤g(L,D)+kZ+kV\Gamma_D \le g(L, D) + k_Z + k_V. Now bound ΓV\Gamma_V. The number of equal pairs that it counts is at most h−kVh - k_V, because only symbols of V0V_0 can be their XX ends and kVk_V symbols of V0V_0 are paired with DD. The number of pairs that it counts is 2h−e2h - e, where ee is the number of unpaired symbols of V1V2V_1 V_2. If kZ>0k_Z > 0, let ss be the smallest position in Z1Z_1 of a symbol paired with DD. All of V1V_1 comes before DD in YY, so a symbol of V1V_1 can only be paired with one of the s−1s - 1 symbols of Z1Z_1 before position ss. So at least h−s+1h - s + 1 symbols of V1V_1 are unpaired, while kZ≤h−s+1k_Z \le h - s + 1. So e≥kZe \ge k_Z, which also holds when kZ=0k_Z = 0. Hence ΓV≤(2h−kZ)+(h−kV)\Gamma_V \le (2h - k_Z) + (h - k_V), and the gain is ΓV+ΓD≤3h+g(L,D)\Gamma_V + \Gamma_D \le 3h + g(L, D).

Case 3: DD has no partner in Z1LZ_1 L. Reverse both strings. The reversed XX is αhR′βhL′αh\alpha^h R' \beta^h L' \alpha^h and the reversed YY is βhD′βh\beta^h D' \beta^h, where ′' denotes reversal. The reversed alignment is in Case 2 for these strings, with R′R' in the place of LL. So its gain, which is the same as before, is at most 3h+g(R′,D′)=3h+g(R,D)3h + g(R', D') = 3h + g(R, D).

Each alignment is in at least one of the three cases, because an alignment that is not in Case 1 has no partner of DD in Z1LZ_1 L or none in RZ2R Z_2. Since g≥0g \ge 0, each case gives a gain of at most 3h+max⁡(g(L,D),g(R,D))3h + \max(g(L, D), g(R, D)). □\square

Vector gadgets

Let d≥1d \ge 1, t=d+1t = d + 1 and h=4th = 4t. For a∈{0,1}da \in \{0, 1\}^d let a^=(0,a1,…,ad)\hat a = (0, a_1, \ldots, a_d), for b∈{0,1}db \in \{0, 1\}^d let b^=(1,b1,…,bd)\hat b = (1, b_1, \ldots, b_d), and let e1=(1,0,…,0)∈{0,1}te_1 = (1, 0, \ldots, 0) \in \{0, 1\}^t and 1t=(1,…,1)1^t = (1, \ldots, 1). Define

G1(a)=αhL(a^)βhL(e1)αh,G2(w)=βhQ(w)βh(w∈{0,1}t).G_1(a) = \alpha^h L(\hat a) \beta^h L(e_1) \alpha^h, \qquad G_2(w) = \beta^h Q(w) \beta^h \quad (w \in \{0, 1\}^t).

So ∣G1(a)∣=3h+2t=14t|G_1(a)| = 3h + 2t = 14t and ∣G2(w)∣=2h+2t=10t|G_2(w)| = 2h + 2t = 10t. Let Es=10tE_s = 10t and Eu=10t+1E_u = 10t + 1.

Lemma 5. For all a,b∈{0,1}da, b \in \{0, 1\}^d: ed(G1(a),G2(b^))=Es\mathrm{ed}(G_1(a), G_2(\hat b)) = E_s if a⋅b=0a \cdot b = 0 and EuE_u otherwise, and ed(G1(a),G2(1t))=Es\mathrm{ed}(G_1(a), G_2(1^t)) = E_s if aa is the zero vector and EuE_u otherwise.

Proof. Apply Lemma 4 with L=L(a^)L = L(\hat a), R=L(e1)R = L(e_1), D=Q(w)D = Q(w), p=tp = t and q=2tq = 2t. These strings contain no α\alpha or β\beta, and h=4t=2qh = 4t = 2q. With Lemma 3, ed(G1(a),G2(w))=2h+t+min⁡(t+a^⋅w,t+e1⋅w)=10t+min⁡(a^⋅w,w1)\mathrm{ed}(G_1(a), G_2(w)) = 2h + t + \min(t + \hat a \cdot w, t + e_1 \cdot w) = 10t + \min(\hat a \cdot w, w_1). For w=b^w = \hat b: a^⋅b^=a⋅b\hat a \cdot \hat b = a \cdot b and w1=1w_1 = 1. For w=1tw = 1^t: a^⋅1t\hat a \cdot 1^t is the number of ones of aa, and w1=1w_1 = 1. □\square

The pattern distance

For strings PP and TT, let pd(P,T)\mathrm{pd}(P, T) be the least value of ed(P,T′)\mathrm{ed}(P, T') over all substrings T′T' of TT, the empty one included.

Let A=(a1,…,an)A = (a_1, \ldots, a_n) and B=(b1,…,bn)B = (b_1, \ldots, b_n) be an OV instance in dimension dd. Let #\# be a new symbol and H=EuH = E_u. Let Ki=G1(ai)K_i = G_1(a_i) for 1≤i≤n1 \le i \le n. Let c1,…,c3n−2c_1, \ldots, c_{3n-2} be the vectors 1t1^t (n−1n - 1 times), b^1,…,b^n\hat b_1, \ldots, \hat b_n, then 1t1^t (n−1n - 1 times), so cn−1+j=b^jc_{n - 1 + j} = \hat b_j, and let Lj=G2(cj)L_j = G_2(c_j). Define

P=#HK1#2HK2#2H⋯#2HKn#H,T=∏j=13n−2#HLj#H.P = \#^H K_1 \#^{2H} K_2 \#^{2H} \cdots \#^{2H} K_n \#^H, \qquad T = \prod_{j=1}^{3n-2} \#^H L_j \#^H.

The strings KiK_i and LjL_j are the cores. The runs of #\# in PP are ρ0\rho_0 (before K1K_1), ρi\rho_i between KiK_i and Ki+1K_{i+1}, and ρn\rho_n (after KnK_n). Each has at least HH symbols, and ρ1,…,ρn−1\rho_1, \ldots, \rho_{n-1} have 2H2H. Between LjL_j and Lj+1L_{j+1} the text has a run of 2H2H symbols #\#. No core contains #\#.

Lemma 6. If ai⋅bj=0a_i \cdot b_j = 0 for some ii and jj, then pd(P,T)≤nEu−1\mathrm{pd}(P, T) \le n E_u - 1. If ai⋅bj≥1a_i \cdot b_j \ge 1 for all ii and jj, then pd(P,T)≥nEu\mathrm{pd}(P, T) \ge n E_u.

Proof of the first claim. Let s=n−1+j−is = n - 1 + j - i. Then 0≤s0 \le s and s+n≤3n−2s + n \le 3n - 2, because 1≤i,j≤n1 \le i, j \le n. Let T′T' be the substring ∏r=1n#HLs+r#H\prod_{r=1}^{n} \#^H L_{s+r} \#^H of TT. It has the same runs of #\# as PP, with Ls+rL_{s+r} in the place of KrK_r. Pair the runs of #\# symbol by symbol, at no cost, and align each KrK_r with Ls+rL_{s+r} optimally. The cost is ∑r=1ned(Kr,Ls+r)\sum_{r=1}^n \mathrm{ed}(K_r, L_{s+r}). By Lemma 5 each term is at most EuE_u, and the term for r=ir = i is ed(G1(ai),G2(b^j))=Es=Eu−1\mathrm{ed}(G_1(a_i), G_2(\hat b_j)) = E_s = E_u - 1, since s+i=n−1+js + i = n - 1 + j. □\square

Proof of the second claim. No aia_i is the zero vector, since otherwise ai⋅b1=0a_i \cdot b_1 = 0. So by Lemma 5, ed(Ki,Lj)=Eu\mathrm{ed}(K_i, L_j) = E_u for all ii and jj. Fix a substring T′T' of TT and an alignment of PP with T′T'. A core KiK_i touches LjL_j when a symbol of KiK_i is paired with a symbol of LjL_j. For each jj, let IjI_j be the set of ii such that KiK_i touches LjL_j.

Order. If i<i′i < i', KiK_i touches LjL_j and Ki′K_{i'} touches Lj′L_{j'}, then j≤j′j \le j', because the pairs are in the same order in both strings. Hence, if IjI_j and Ij′I_{j'} are nonempty and j<j′j < j', then max⁡Ij≤min⁡Ij′\max I_j \le \min I_{j'}.

Sort each core KiK_i into one class:

  • (C0) KiK_i touches no core.
  • (C2) KiK_i touches at least two cores.
  • (C1) KiK_i touches exactly one core LjL_j. It is clean if Ij={i}I_j = \{i\} and all of LjL_j lies inside T′T', cut if Ij={i}I_j = \{i\} and some symbol of LjL_j is outside T′T', and shared if ∣Ij∣≥2|I_j| \ge 2.

We now give sets of units, pairwise disjoint, that together contain at least nEun E_u units.

(C0). Let UiU_i hold the unpaired symbols of KiK_i and the pairs with an end in KiK_i. Such a pair has its other end in a #\# of T′T', because KiK_i touches no core, so it is unequal. So ∣Ui∣=∣Ki∣=14t≥Eu|U_i| = |K_i| = 14t \ge E_u.

(C2). Let KiK_i touch LjL_j and Lj′L_{j'} with j<j′j < j'. The run of 2H2H symbols #\# between LjL_j and Lj+1L_{j+1} lies strictly between a partner of KiK_i in LjL_j and a partner of KiK_i in Lj′L_{j'}, so it lies inside T′T'. By (B), each of its symbols is unpaired or paired with a symbol of KiK_i, which is not #\#. Let UiU_i hold these 2H2H units. So ∣Ui∣=2H≥Eu|U_i| = 2H \ge E_u.

Clean (C1). Let UiU_i hold the unpaired symbols of KiK_i and of LjL_j, and the unequal pairs with an end in KiK_i or in LjL_j. A pair with an end in KiK_i has its other end in LjL_j or in a #\#, since KiK_i touches only LjL_j. A pair with an end in LjL_j has its other end in KiK_i or in a #\# of PP, since Ij={i}I_j = \{i\}. Drop the pairs with an end in a #\#. The pairs between KiK_i and LjL_j that remain form an alignment of KiK_i with LjL_j, which is whole inside T′T'. Its cost counts the unpaired symbols of KiK_i and LjL_j, the symbols of KiK_i and LjL_j that were paired with a #\#, and the unequal pairs between KiK_i and LjL_j. Each of these is one unit of UiU_i, counted once. So ∣Ui∣≥ed(Ki,Lj)=Eu|U_i| \ge \mathrm{ed}(K_i, L_j) = E_u.

Shared (C1). For each jj with ∣Ij∣≥2|I_j| \ge 2, let p=min⁡Ij<q=max⁡Ijp = \min I_j < q = \max I_j. The runs ρp,…,ρq−1\rho_p, \ldots, \rho_{q-1} lie strictly between a symbol of KpK_p and a symbol of KqK_q whose partners are in LjL_j. By (B), each of their 2H(q−p)2H(q - p) symbols is unpaired or paired with a symbol of LjL_j, which is not #\#. Let U(j)U^{(j)} hold these units. Each shared core whose touched core is LjL_j has its index in Ij⊆{p,…,q}I_j \subseteq \{p, \ldots, q\}, so there are at most q−p+1≤2(q−p)q - p + 1 \le 2(q - p) of them. So ∣U(j)∣=2H(q−p)≥Eu|U^{(j)}| = 2H(q - p) \ge E_u times the number of these cores.

Cut (C1). Here Ij={i}I_j = \{i\}, T′T' contains a symbol of LjL_j and misses another one, so T′T' starts or ends strictly inside LjL_j. Suppose that it starts inside LjL_j. Let x0x_0 be the first symbol of KiK_i that has a partner, and y0y_0 its partner. Some symbol of KiK_i has a partner in LjL_j, and that partner is at or after y0y_0, so y0y_0 lies in the part of T′T' up to that partner, which is inside LjL_j. Each symbol of ρi−1\rho_{i-1} comes before x0x_0 in PP, so its partner, if any, comes before y0y_0 in T′T' and is a symbol of LjL_j. Let UiU_i hold the ∣ρi−1∣≥H=Eu|\rho_{i-1}| \ge H = E_u units of the symbols of ρi−1\rho_{i-1}. If T′T' does not start inside LjL_j, it ends inside LjL_j, and the same argument with the last symbol of KiK_i that has a partner gives ∣ρi∣≥Eu|\rho_i| \ge E_u units from ρi\rho_i; let UiU_i hold those.

Disjointness. Unpaired core symbols appear only in the sets of (C0) and clean cores, each for its own core, and the core LjL_j of a clean KiK_i is touched by no other core, so no other set holds it. Unpaired symbols #\# of TT appear only in (C2) sets. A run of TT in the set of KiK_i lies strictly between two partners of KiK_i. If it also lay strictly between two partners of Ki′K_{i'} with i<i′i < i', then a partner of KiK_i after the run would come before a partner of Ki′K_{i'} before the run, against the order of the pairs. So two (C2) sets use different runs. Unpaired symbols #\# of PP appear only in shared and cut sets. By the order property, the index ranges {p,…,q−1}\{p, \ldots, q - 1\} of two shared sets are disjoint. A cut core KiK_i with Ij={i}I_j = \{i\} uses ρi−1\rho_{i-1} or ρi\rho_i. If one of these were in the range of a shared set for j′j', then p≤i≤qp \le i \le q for p=min⁡Ij′p = \min I_{j'} and q=max⁡Ij′q = \max I_{j'}. If i=pi = p or i=qi = q, then KiK_i touches Lj′L_{j'}. If p<i<qp < i < q, then by (B) every partner of KiK_i lies strictly between two symbols of Lj′L_{j'}, so it is in Lj′L_{j'} and again KiK_i touches Lj′L_{j'}. Either way j′=jj' = j, which is impossible because ∣Ij∣=1<2≤∣Ij′∣|I_j| = 1 < 2 \le |I_{j'}|. At most one cut core uses the run before it, since T′T' starts inside only one core, and at most one uses the run after it. If the first one is KiK_i and the second is Ki−1K_{i-1}, they would use the same run ρi−1\rho_{i-1}. But T′T' starts inside the core LjL_j touched by KiK_i and ends inside the core Lj′L_{j'} touched by Ki−1K_{i-1}, so j≤j′j \le j', and the order property gives j′≤jj' \le j. Then LjL_j is touched by both cores, against ∣Ij∣=1|I_j| = 1. Now the unequal pairs. A pair between a core KiK_i and a #\# of TT appears only in the set of KiK_i. A pair between a core LjL_j and a #\# of PP appears only in a clean set with this LjL_j, in U(j)U^{(j)}, or in a cut set with this LjL_j, and exactly one of these kinds can exist for a given jj. A pair between two cores appears only in a clean set. So the sets are pairwise disjoint.

Every core is in one class, and each class gives at least EuE_u units for each of its cores, so the cost of the alignment is at least nEun E_u. This holds for every T′T' and every alignment, so pd(P,T)≥nEu\mathrm{pd}(P, T) \ge n E_u. □\square

Padding

Lemma 7. Let PP and TT be strings, let &\& be a symbol that occurs in neither, and let m0≥∣T∣m_0 \ge |T|. Then ed(&m0P&m0,T)=2m0+pd(P,T)\mathrm{ed}(\&^{m_0} P \&^{m_0}, T) = 2 m_0 + \mathrm{pd}(P, T).

Proof. Upper bound. Let T=yT′zT = y T' z with ed(P,T′)=pd(P,T)\mathrm{ed}(P, T') = \mathrm{pd}(P, T). Pair the last ∣y∣|y| symbols of the first run of &\& with yy and the first ∣z∣|z| symbols of the second run with zz, align PP with T′T' optimally, and leave the other symbols &\& unpaired. Each of the 2m02 m_0 symbols &\& is one unit, and nothing else costs more than the alignment of PP with T′T'.

Lower bound. Fix an alignment. Each symbol &\& is unpaired or in an unequal pair, so the symbols &\& give 2m02 m_0 units. If no symbol of PP is paired, the ∣P∣|P| symbols of PP give ∣P∣=ed(P,ε)≥pd(P,T)|P| = \mathrm{ed}(P, \varepsilon) \ge \mathrm{pd}(P, T) more units. Otherwise, let T′T' be the substring of TT from the first to the last partner of a symbol of PP. By (B), the symbols of T′T' are unpaired or paired with symbols of PP, and the symbols of PP are unpaired or paired with symbols of T′T'. So the pairs between PP and T′T' form an alignment of PP with T′T', and its units are units of the whole alignment that do not involve &\&. Its cost is at least ed(P,T′)≥pd(P,T)\mathrm{ed}(P, T') \ge \mathrm{pd}(P, T). □\square

Proof of the theorem

Part 1. Given the OV instance, build PP and TT as in Lemma 6, and let X=&∣T∣P&∣T∣X = \&^{|T|} P \&^{|T|}, Y=TY = T and θ=2∣T∣+nEu\theta = 2|T| + n E_u. By Lemmas 6 and 7, ed(X,Y)≤θ−1\mathrm{ed}(X, Y) \le \theta - 1 when there is an orthogonal pair, and ed(X,Y)≥θ\mathrm{ed}(X, Y) \ge \theta otherwise. The lengths are ∣T∣=(3n−2)(2H+10t)|T| = (3n - 2)(2H + 10t) and ∣P∣=n⋅14t+2nH|P| = n \cdot 14t + 2nH with H=10t+1H = 10t + 1 and t=d+1t = d + 1, so ∣X∣=2∣T∣+∣P∣|X| = 2|T| + |P| and ∣Y∣|Y| are O(nd)O(nd), and the strings are written in O(nd)O(nd) time. The symbols are σℓ,0,σℓ,1,τℓ\sigma_{\ell,0}, \sigma_{\ell,1}, \tau_\ell for 1≤ℓ≤t1 \le \ell \le t, and α\alpha, β\beta, #\# and &\&: 3t+4=3d+73t + 4 = 3d + 7 in all.

Part 2. Suppose that an algorithm computes the edit distance of two strings of length at most NN over at most NN symbols in time O(N2−δ)O(N^{2-\delta}). Given an OV instance, build XX, YY and θ\theta by part 1 and compare ed(X,Y)\mathrm{ed}(X, Y) with θ\theta. Here N=max⁡(∣X∣,∣Y∣)=O(nd)N = \max(|X|, |Y|) = O(nd) and 3d+7≤N3d + 7 \le N, so for δ≤1\delta \le 1, which we may assume, the time is O(nd+(nd)2−δ)=O(n2−δd2)O(nd + (nd)^{2-\delta}) = O(n^{2-\delta} d^2). By Lemma 2 with c=2c = 2, SETH is false. ■\blacksquare

Back to Edit distance hardness under SETH