Locally testable code

From HandWiki
Short description: Type of error-correcting code

A locally testable code is a type of error-correcting code for which it can be determined if a string is a word in that code by looking at a small (frequently constant) number of bits of the string. In some situations, it is useful to know if the data is corrupted without decoding all of it so that appropriate action can be taken in response. For example, in communication, if the receiver encounters a corrupted code, it can request the data be re-sent, which could increase the accuracy of said data. Similarly, in data storage, these codes can allow for damaged data to be recovered and rewritten properly.

In contrast, locally decodable codes use a small number of bits of the codeword to probabilistically recover the original information. The fraction of errors determines how likely it is that the decoder correctly recovers the original bit; however, not all locally decodable codes are locally testable.[1]

Clearly, any valid codeword should be accepted as a codeword, but strings that are not codewords could be only one bit off, which would require many (certainly more than a constant number) probes. To account for this, testing failure is only defined if the string is off by at least a set fraction of its bits. This implies words of the code must be longer than the input strings by adding some redundancy.

Definition

To measure the distance between two strings, the Hamming distance is used

[math]\displaystyle{ \Delta(x,y)=|\{i:x_i \neq y_i\}| }[/math]

The distance of a string [math]\displaystyle{ w }[/math] from a code [math]\displaystyle{ C:\{0,1\}^k\to\{0,1\}^n }[/math] is computed by

[math]\displaystyle{ \Delta(w,C)=\min_x\{\Delta(w,C(x))\} }[/math]

Relative distances are computed as a fraction of the number of bits

[math]\displaystyle{ \delta(x,y)=\Delta(x,y)/n \text{ and } \delta(w,C)=\Delta(w,C)/n }[/math]

A code [math]\displaystyle{ C:\{0,1\}^k\to\{0,1\}^n }[/math] is called [math]\displaystyle{ q }[/math]-local [math]\displaystyle{ \delta }[/math]-testable if there exists a Turing machine M given random access to an input [math]\displaystyle{ w }[/math] that makes at most [math]\displaystyle{ q }[/math] non-adaptive queries of [math]\displaystyle{ w }[/math] and satisfies the following:[2]

  • For any [math]\displaystyle{ x\in\{0,1\}^k }[/math] and [math]\displaystyle{ w=C(x) }[/math], [math]\displaystyle{ Pr[M^w(1^k)=1]=1 }[/math]. In other words, M accepts given access to any codeword of C.
  • For [math]\displaystyle{ w\in\{0,1\}^n }[/math] such that [math]\displaystyle{ \delta(w,C)\gt \delta }[/math], [math]\displaystyle{ Pr[M^w(1^k)=1]\leq1/2 }[/math]. M must reject strings [math]\displaystyle{ \delta }[/math]-far from C at least half the time.

Also the rate of a code is the ratio between its message length and codeword length

[math]\displaystyle{ r=\frac{|x|}{|C(x)|} }[/math]

Limits

It remains an open question whether there are any locally testable codes of linear size, but there are several constructions that are considered "nearly linear":[3]

  1. Polynomial arbitrarily close to linear; for any [math]\displaystyle{ \epsilon\gt 0 }[/math], [math]\displaystyle{ n=k^{1+\epsilon} }[/math].
  2. Functions of the form [math]\displaystyle{ n=k^{1+\epsilon(k)} }[/math], where [math]\displaystyle{ \epsilon(k) }[/math] is a function tending toward 0. This makes n closer to linear as k increases. For example:
    • [math]\displaystyle{ 1/\log \log k }[/math]
    • [math]\displaystyle{ 1/(\log k)^c }[/math] for some [math]\displaystyle{ c\in (0,1) }[/math]
    • [math]\displaystyle{ \exp((\log \log \log k)^c)/\log k }[/math] for [math]\displaystyle{ c\in (0,1) }[/math]

These have both been achieved, even with constant query complexity and a binary alphabet, such as with [math]\displaystyle{ n=k^{1+1/(\log k)^c} }[/math] for any [math]\displaystyle{ c\in (0,1) }[/math]. The next nearly linear goal is linear up to a polylogarithmic factor; [math]\displaystyle{ n=\text{poly}(\log k)*k }[/math]. Nobody has yet to come up with a linearly testable code that satisfies this constraint.[3]

In November 2021 two preprints have reported[4][5][6][7] the first polynomial-time construction of "[math]\displaystyle{ c^3 }[/math]-LTCs" namely locally testable codes with constant rate [math]\displaystyle{ r }[/math], constant distance [math]\displaystyle{ \delta }[/math] and constant locality [math]\displaystyle{ q }[/math].

Connection with probabilistically checkable proofs

Locally testable codes have a lot in common with probabilistically checkable proofs (PCPs). This should be apparent from the similarities of their construction. In both, we are given [math]\displaystyle{ q }[/math] random nonadaptive queries into a large string and if we want to accept, we must with probability 1, and if not, we must accept no more than half the time. The major difference is that PCPs are interested in accepting [math]\displaystyle{ x }[/math] if there exists a [math]\displaystyle{ w }[/math] so that [math]\displaystyle{ M^w(x)=1 }[/math]. Locally testable codes, on the other hand, accept [math]\displaystyle{ w }[/math] if it is part of the code. Many things can go wrong in assuming a PCP proof encodes a locally testable code. For example, the PCP definition says nothing about invalid proofs, only invalid inputs.

Despite this difference, locally testable codes and PCPs are similar enough that frequently to construct one, a prover will construct the other along the way.[8]

Examples

Hadamard code

One of the most famous error-correcting codes, the Hadamard code, is a locally testable code. A codeword x is encoded in the Hadamard code to be the linear function [math]\displaystyle{ f(y)={\sum_i {x_i y_i}} }[/math] (mod 2). This requires listing out the result of this function for every possible y, which requires exponentially more bits than its input. To test if a string w is a codeword of the Hadamard code, all we have to do is test if the function it encodes is linear. This means simply checking if [math]\displaystyle{ w(x)\oplus w(y)=w(x\oplus y) }[/math] for x and y uniformly random vectors (where [math]\displaystyle{ \oplus }[/math] denotes bitwise XOR).

It is easy to see that for any valid encoding [math]\displaystyle{ w }[/math], this equation is true, as that is the definition of a linear function. Somewhat harder, however, is showing that a string that is [math]\displaystyle{ \delta }[/math]-far from C will have an upper bound on its error in terms of [math]\displaystyle{ \delta }[/math]. One bound is found by the direct approach of approximating the chances of exactly one of the three probes yielding an incorrect result. Let A, B, and C be the events of [math]\displaystyle{ w(x) }[/math], [math]\displaystyle{ w(y) }[/math], and [math]\displaystyle{ w(x\oplus y) }[/math] being incorrect. Let E be the event of exactly one of these occurring. This comes out to

[math]\displaystyle{ \begin{align}P(E) &\geq P(A\cup B\cup C)-3*P(A\cup B)\\ &\geq 3*P(A)-3*P(A\cup B)-3*P(A\cup B)\\ &\geq 3\delta-6\delta^2\end{align} }[/math]

This works for [math]\displaystyle{ 0\lt \delta\leq5/16 }[/math], but shortly after, [math]\displaystyle{ 3\delta-6\delta^2\lt \delta }[/math]. With additional work, it can be shown that the error is bounded by

[math]\displaystyle{ f(x) = \begin{cases} 3\delta-6\delta^2 & : 0\leq\delta\leq 5/16 \\ 45/128 & : 5/16\leq \delta\leq45/128 \\ \delta & :45/128 \leq \delta\leq 1/2 \end{cases} }[/math]

For any given [math]\displaystyle{ \delta }[/math], this only has a constant chance of false positives, so we can simply check a constant number of times to get the probability below 1/2.[3]

Long code

The Long code is another code with very large blowup which is close to locally testable. Given an input [math]\displaystyle{ 0\leq i\leq2^k }[/math] (note, this takes [math]\displaystyle{ k }[/math] bits to represent), the function that returns the [math]\displaystyle{ i^{th} }[/math] bit of the input, [math]\displaystyle{ f_i(x)=x_i }[/math], is evaluated on all possible [math]\displaystyle{ 2^k }[/math]-bit inputs [math]\displaystyle{ 0\leq x\leq2^{2^k} }[/math], and the codeword is the concatenation of these (of length [math]\displaystyle{ n=2^{2^k} }[/math]). The way to locally test this with some errors is to pick a uniformly random input [math]\displaystyle{ x }[/math] and set [math]\displaystyle{ y=x }[/math], but with a small chance of flipping each bit, [math]\displaystyle{ \mu\gt 0 }[/math]. Accept a function [math]\displaystyle{ f }[/math] as a codeword if [math]\displaystyle{ f(x)=f(y) }[/math]. If [math]\displaystyle{ f }[/math] is a codeword, this will accept [math]\displaystyle{ f }[/math] as long as [math]\displaystyle{ x_i }[/math] was unchanged, which happens with probability [math]\displaystyle{ 1-\mu }[/math]. This violates the requirement that codewords are always accepted, but may be good enough for some needs.[9]

Other locally testable codes include Reed-Muller codes (see locally decodable codes for a decoding algorithm), Reed-Solomon codes, and the short code.

See also

References

  1. Kaufman, Tali; Viderman, Michael. "Locally Testable vs. Locally Decodable Codes". http://eccc.hpi-web.de/report/2010/130/revision/1/download/. 
  2. Ben-Sasson, Eli; Sudan, Madhu. "Robust Locally Testable Codes and Products of Codes". http://people.csail.mit.edu/madhu/papers/2004/rltc-conf.pdf. 
  3. 3.0 3.1 3.2 Goldreich, Oded (2005). "Short Locally Testable Codes and Proofs (Survey)". http://eccc.hpi-web.de/eccc-reports/2005/TR05-014/index.html. 
  4. Panteleev, Pavel; Kalachev, Gleb (2021-11-05). "Asymptotically Good Quantum and Locally Testable Classical LDPC Codes". arXiv:2111.03654 [cs.IT].
  5. Dinur, Irit; Evra, Shai; Livne, Ron; Lubotzky, Alexander; Mozes, Shahar (2021-11-08). "Locally Testable Codes with constant rate, distance, and locality". arXiv:2111.04808 [cs.IT].
  6. Rorvig, Mordechai (2021-11-24). "Researchers Defeat Randomness to Create Ideal Code" (in en). https://www.quantamagazine.org/researchers-defeat-randomness-to-create-ideal-code-20211124/. 
  7. Rorvig, Mordechai (2022-01-06). "Qubits Can Be as Safe as Bits, Researchers Show" (in en). https://www.quantamagazine.org/qubits-can-be-as-safe-as-bits-researchers-show-20220106/. 
  8. Cheraghchi, Mahdi. "Locally Testable Codes.". http://eccc.hpi-web.de/static/books/Locally_Testable_Codes/. 
  9. Kol, Gillat; Raz, Ran. "Bounds on Locally Testable Codes with Unique Tests". http://www.wisdom.weizmann.ac.il/~ranraz/publications/Punique_codes.pdf. 

External links