TExcelTAD
Home › Parameterized & Fine-Grained Complexity › Orthogonal Vectors and the Split-and-List Reduction

Orthogonal Vectors and the Split-and-List Reduction

SETH is a statement about exponential time. Most fine-grained lower bounds for problems in P go through one intermediate problem that turns it into a statement about quadratic time: Orthogonal Vectors. This lesson defines it, proves Williams' reduction from CNF-SAT (2005), and shows why the dimension of the vectors matters.

The problem

ORTHOGONAL VECTORS (OV). Given two sets A,B⊆{0,1}dA, B \subseteq \{0, 1\}^d with nn vectors each, are there a∈Aa \in A and b∈Bb \in B with

a⋅b=∑i=1daibi=0  ?a \cdot b = \sum_{i=1}^{d} a_i b_i = 0 \;?

Think of each vector as a subset of {1,…,d}\{1, \ldots, d\}: the question is whether some set from AA is disjoint from some set from BB. Trying all pairs costs O(n2d)O(n^2 d). If dd is small, say d≤log⁡2nd \le \log_2 n, one can do better by listing all 2d≤n2^d \le n possible vectors, so the interesting regime is d=clog⁡nd = c \log n for a constant c>1c > 1, the low-dimensional regime.

OV conjecture. For every ε>0\varepsilon > 0 there is a cc such that OV with d=clog⁡nd = c \log n cannot be solved in time O(n2−ε)O(n^{2 - \varepsilon}).

The best known algorithm, using the polynomial method, runs in n2−1/O(log⁡c)n^{2 - 1/O(\log c)} time for d=clog⁡nd = c \log n (Abboud, Williams and Yu, 2015; Chan and Williams, 2016; stated): the savings shrink as cc grows, in the same way as the savings over 2n2^n for kk-SAT shrink as kk grows.

SETH implies the OV conjecture

Theorem (Williams, 2005). If OV with d=O(log⁡n)d = O(\log n) dimensions can be solved in time O(n2−ε)O(n^{2 - \varepsilon}) for some ε>0\varepsilon > 0, then CNF-SAT on NN variables and mm clauses can be solved in time O(2(1−ε/2)N⋅poly(m))O(2^{(1 - \varepsilon/2) N} \cdot \text{poly}(m)), so SETH is false.

The reduction (split and list). Let φ\varphi have variables x1,…,xNx_1, \ldots, x_N and clauses C1,…,CmC_1, \ldots, C_m. Split the variables into two halves X1X_1 and X2X_2 of N/2N/2 each.

  1. For each of the 2N/22^{N/2} assignments α\alpha to X1X_1, make a vector aα∈{0,1}ma_\alpha \in \{0, 1\}^m with aα[j]=0a_\alpha[j] = 0 if α\alpha already satisfies CjC_j (some literal of CjC_j over X1X_1 is true), and 1 otherwise.
  2. Do the same for each assignment β\beta to X2X_2, giving bβb_\beta.
  3. aα⋅bβ=0a_\alpha \cdot b_\beta = 0 means that for every clause, α\alpha or β\beta satisfies it: the combined assignment satisfies φ\varphi.

So φ\varphi is satisfiable iff the OV instance with n=2N/2n = 2^{N/2} vectors per side and d=md = m is a YES instance. The construction takes O(2N/2⋅mN)O(2^{N/2} \cdot m N) time. An O(n2−ε)O(n^{2 - \varepsilon}) OV algorithm gives O(2(N/2)(2−ε))=O(2(1−ε/2)N)O(2^{(N/2)(2 - \varepsilon)}) = O(2^{(1 - \varepsilon/2) N}) for CNF-SAT. For this to contradict SETH we need it for kk-CNF with every kk, and the dimension must be d=O(log⁡n)=O(N)d = O(\log n) = O(N): by the sparsification lemma (The Exponential Time Hypothesis and SETH) a kk-CNF formula reduces to 2ε′N2^{\varepsilon' N} formulas with m=O(N)m = O(N) clauses each, which costs only a small loss in the exponent. □\square

The program carries out the reduction on random 3-CNF formulas and compares with brute force, counting the pairs inspected by the naive OV algorithm against the 2N2^N assignments of brute force.

python · try it yourself
import random
from itertools import product

def random_cnf(N, m, k, rng):
    return [tuple(rng.choice([1, -1]) * v for v in rng.sample(range(1, N + 1), k)) for _ in range(m)]

def satisfies_clause(lit_values, clause):
    return any(lit_values.get(abs(l)) == (l > 0) for l in clause)

def split_and_list(N, F):
    half = N // 2
    X1, X2 = range(1, half + 1), range(half + 1, N + 1)
    def vectors(X):
        out = []
        for bits in product([False, True], repeat=len(X)):
            vals = dict(zip(X, bits))
            mask = 0
            for j, c in enumerate(F):
                if not satisfies_clause(vals, c):
                    mask |= 1 << j                    # coordinate j is 1: clause still open
            out.append(mask)
        return out
    return vectors(X1), vectors(X2)

def ov_naive(A, B):
    pairs = 0
    for a in A:
        for b in B:
            pairs += 1
            if a & b == 0:
                return True, pairs
    return False, pairs

def brute_sat(N, F):
    for bits in product([False, True], repeat=N):
        vals = dict(zip(range(1, N + 1), bits))
        if all(satisfies_clause(vals, c) for c in F):
            return True
    return False

rng = random.Random(10)
print(" N   m  |A| = |B|  OV says  brute force  pairs checked  2^N")
for N, m in [(10, 30), (12, 40), (12, 56), (14, 50), (14, 64)]:
    F = random_cnf(N, m, 3, rng)
    A, B = split_and_list(N, F)
    ov, pairs = ov_naive(A, B)
    print(f"{N:2} {m:3} {len(A):10}  {ov!s:7}  {brute_sat(N, F)!s:11} {pairs:13} {2 ** N:5}")
 N   m  |A| = |B|  OV says  brute force  pairs checked  2^N
10  30         32  True     True                  349  1024
12  40         64  True     True                 1169  4096
12  56         64  False    False                4096  4096
14  50        128  True     True                 3204 16384
14  64        128  False    False               16384 16384

When the formula is unsatisfiable, the naive OV algorithm inspects all 2N/2⋅2N/2=2N2^{N/2} \cdot 2^{N/2} = 2^N pairs: it is brute force in disguise. That is the point. Any algorithm that inspects substantially fewer than n2n^2 pairs in the worst case would beat brute force for SAT.

In C++

With m≤64m \le 64 clauses, each vector fits in one 64-bit word and a dot product is one &. The program reduces a random 3-CNF formula with 26 variables and 64 clauses to OV with 213=81922^{13} = 8192 vectors per side and solves both.

cpp · try it yourself
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <vector>

int main() {
    const int N = 26, m = 64, half = N / 2;
    unsigned s = 31;
    auto rnd = [&](int k) { s = s * 1103515245u + 12345u; return int((s >> 8) % k); };
    std::vector<std::vector<int>> F(m);
    for (auto& c : F)
        while (c.size() < 3) {
            int v = 1 + rnd(N);
            bool dup = false;
            for (int l : c) if (std::abs(l) == v) dup = true;
            if (!dup) c.push_back(rnd(2) ? v : -v);
        }
    auto vectors = [&](int lo) {                   // assignments to variables lo .. lo + half - 1
        std::vector<uint64_t> out;
        for (int bits = 0; bits < (1 << half); bits++) {
            uint64_t mask = 0;
            for (int j = 0; j < m; j++) {
                bool sat = false;
                for (int l : F[j]) {
                    int v = std::abs(l);
                    if (v >= lo && v < lo + half && ((bits >> (v - lo) & 1) == (l > 0))) sat = true;
                }
                if (!sat) mask |= 1ULL << j;
            }
            out.push_back(mask);
        }
        return out;
    };
    auto A = vectors(1), B = vectors(1 + half);
    long long pairs = 0;
    bool found = false;
    for (size_t i = 0; i < A.size() && !found; i++)
        for (size_t j = 0; j < B.size(); j++) {
            pairs++;
            if ((A[i] & B[j]) == 0) { found = true; break; }
        }
    std::printf("OV: %zu x %zu vectors, %s after %lld pairs\n", A.size(), B.size(),
                found ? "orthogonal pair found (satisfiable)" : "no orthogonal pair (unsatisfiable)", pairs);
}
OV: 8192 x 8192 vectors, orthogonal pair found (satisfiable) after 17148 pairs

This formula is satisfiable, so the search stops early. An unsatisfiable one would force all 226≈6.7⋅1072^{26} \approx 6.7 \cdot 10^7 pairs, the same count as brute force over the assignments; one machine word per vector makes each pair cheap, but not fewer.

Why the dimension matters

The reduction produces dimension d=md = m, and sparsification makes m=O(N)=O(log⁡n)m = O(N) = O(\log n). In higher dimension the conjecture is not needed; in lower dimension it is false:

Dimension Status
d≤log⁡2nd \le \log_2 n O(nd)O(n d) time is possible via the 2d≤n2^d \le n possible vectors
d=clog⁡nd = c \log n conjectured n2−o(1)n^{2 - o(1)} as c→∞c \to \infty; best known n2−1/O(log⁡c)n^{2 - 1/O(\log c)}
d=nΩ(1)d = n^{\Omega(1)} at least as hard; fast matrix multiplication gives O(nω)O(n^{\omega}) for d=nd = n

A variant that matters for later reductions: in unbalanced OV, ∣A∣=n\lvert A \rvert = n and ∣B∣=nα\lvert B \rvert = n^{\alpha}; under SETH it needs n1+α−o(1)n^{1 + \alpha - o(1)} time. Many SETH lower bounds for problems on strings and graphs (edit distance, LCS, Fréchet distance, graph diameter approximation) are proved by encoding OV, and the next lesson shows the shape of such an encoding.

Test yourself

In the split-and-list reduction, what does coordinate jj of the vector aαa_\alpha record?

  1. Whether variable xjx_j is true
  2. Whether the half-assignment α\alpha leaves clause CjC_j unsatisfied (1) or already satisfies it (0)
  3. The number of literals in CjC_j
  4. Whether CjC_j contains a negation

An O(n1.9)O(n^{1.9}) OV algorithm for d=O(log⁡n)d = O(\log n) would give what for CNF-SAT on NN variables?

  1. O(20.5N)O(2^{0.5N})
  2. O(20.95N⋅poly(m))O(2^{0.95N} \cdot \text{poly}(m)), refuting SETH
  3. Polynomial time
  4. Nothing

Why does the reduction need the sparsification lemma?

  1. To make the formula satisfiable
  2. To keep the dimension d=md = m at O(N)=O(log⁡n)O(N) = O(\log n), the regime where the OV conjecture is stated
  3. To halve the number of variables
  4. It does not need it