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 with vectors each, are there and with
Think of each vector as a subset of : the question is whether some set from is disjoint from some set from . Trying all pairs costs . If is small, say , one can do better by listing all possible vectors, so the interesting regime is for a constant , the low-dimensional regime.
OV conjecture. For every there is a such that OV with cannot be solved in time .
The best known algorithm, using the polynomial method, runs in time for (Abboud, Williams and Yu, 2015; Chan and Williams, 2016; stated): the savings shrink as grows, in the same way as the savings over for -SAT shrink as grows.
SETH implies the OV conjecture
Theorem (Williams, 2005). If OV with dimensions can be solved in time for some , then CNF-SAT on variables and clauses can be solved in time , so SETH is false.
The reduction (split and list). Let have variables and clauses . Split the variables into two halves and of each.
- For each of the assignments to , make a vector with if already satisfies (some literal of over is true), and 1 otherwise.
- Do the same for each assignment to , giving .
- means that for every clause, or satisfies it: the combined assignment satisfies .
So is satisfiable iff the OV instance with vectors per side and is a YES instance. The construction takes time. An OV algorithm gives for CNF-SAT. For this to contradict SETH we need it for -CNF with every , and the dimension must be : by the sparsification lemma (The Exponential Time Hypothesis and SETH) a -CNF formula reduces to formulas with clauses each, which costs only a small loss in the exponent.
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 assignments of brute force.
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 pairs: it is brute force in disguise. That is the point. Any algorithm that inspects substantially fewer than pairs in the worst case would beat brute force for SAT.
In C++
With 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 vectors per side and solves both.
#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 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 , and sparsification makes . In higher dimension the conjecture is not needed; in lower dimension it is false:
| Dimension | Status |
|---|---|
| time is possible via the possible vectors | |
| conjectured as ; best known | |
| at least as hard; fast matrix multiplication gives for |
A variant that matters for later reductions: in unbalanced OV, and ; under SETH it needs 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 of the vector record?
- Whether variable is true
- Whether the half-assignment leaves clause unsatisfied (1) or already satisfies it (0)
- The number of literals in
- Whether contains a negation
An OV algorithm for would give what for CNF-SAT on variables?
- , refuting SETH
- Polynomial time
- Nothing
Why does the reduction need the sparsification lemma?
- To make the formula satisfiable
- To keep the dimension at , the regime where the OV conjecture is stated
- To halve the number of variables
- It does not need it