a vertex N that burns a colour, a triangle per clause

3NAE ≤p 3COL

3NAE≤p3COL\mathrm{3NAE}\le_p\mathrm{3COL}, hence 3COL\mathrm{3COL} is NP-complete.

The construction

On a 3CNF formula φ\varphi over x1,…,xnx_1,\dots,x_n with mm clauses. The output is a graph alone — no number, since k=3k=3 is part of the problem's DNA.

  1. Vertices. For each ii, a vertex for xix_i and one for xi‾\overline{x_i} (literal vertices); one special vertex NN; and for each clause CjC_j three further vertices, one per literal (clause vertices). In all 2n+1+3m2n+1+3m vertices.
  2. Edges.
    • Black: NN to every literal vertex — 2n2n edges.
    • Blue: every literal to its negation — nn edges.
    • Red: per clause, a triangle on its three clause vertices, plus an edge from each clause vertex to its corresponding literal vertex — 3+3=63+3=6 edges per clause.
  3. Return GG.

The intuition. In a legal colouring, w.l.o.g. f(N)=1f(N)=1. Since NN is joined to every literal vertex, each literal vertex is coloured 22 or 33; and since xix_i is joined to xi‾\overline{x_i}, exactly one of each such pair is 22 and exactly one is 33. The colours {2,3}\{2,3\} behave exactly like {true,false}\{\text{true},\text{false}\}, with NN "burning" the first colour for us. The triangles enforce the NAE condition.

A distinction that confused the class: each clause has three vertices of its own, objects separate from the literal vertices. A clause vertex "corresponds" to a literal only in the sense that a red edge joins them.

Visualization

Guided construction

3NAE → 3-Colouring

Step 1 of 7
Input φ(x ∨ y ∨ z) ∧ (¬x ∨ y ∨ ¬z)
3NAE to 3-colouring: N, literal vertices and clause trianglesA special vertex N is joined by black edges to six literal vertices; blue edges join each literal to its negation; each of the two clauses owns a red triangle whose vertices are linked to the literals of that clause.NN — burns colour 1x¬xy¬yz¬zliteral vertices — 2n = 61:x1:y1:z2:¬x2:y2:¬zC₁ = (x ∨ y ∨ z)C₂ = (¬x ∨ y ∨ ¬z)clause vertices — 3m = 6

Correctness — both directions

3NAE ∈ ⟹ 3COL ∈

Suppose φ∈3NAE\varphi\in\mathrm{3NAE}, with NAE-satisfying assignment VV. Build a colouring ff:

  1. f(N)=1f(N)=1.
  2. For each ii: if V(xi)=1V(x_i)=1 then f(xi)=2f(x_i)=2, f(xi‾)=3f(\overline{x_i})=3; otherwise f(xi)=3f(x_i)=3, f(xi‾)=2f(\overline{x_i})=2. Equivalently, the uniform rule f(ℓ)=2  ⟺  V(ℓ)=1,f(ℓ)=3  ⟺  V(ℓ)=0(∗)f(\ell)=2\iff V(\ell)=1,\qquad f(\ell)=3\iff V(\ell)=0\qquad(\ast)
  3. Let CC be a clause with literals ℓ1,ℓ2,ℓ3\ell_1,\ell_2,\ell_3 and clause vertices c1,c2,c3c_1,c_2,c_3 (ctc_t joined to ℓt\ell_t). Since VV NAE-satisfies CC, some tt has V(ℓt)=1V(\ell_t)=1 and some t′t' has V(ℓt′)=0V(\ell_{t'})=0; pick one of each and colour f(ct)=3f(c_t)=3, f(ct′)=2f(c_{t'})=2, f(ct′′)=1f(c_{t''})=1 for the third.

Now check no edge is monochromatic:

  • Black: f(N)=1f(N)=1 while every literal has f(ℓ)∈{2,3}f(\ell)\in\{2,3\}. ✓
  • Blue: by step 2 one is 22 and the other 33. ✓
  • Clause triangle: the three vertices got 3,2,13,2,1 — three distinct colours. ✓
  • Red, clause vertex to its literal: f(ct)=3f(c_t)=3 while by (∗)(\ast) f(ℓt)=2f(\ell_t)=2; f(ct′)=2f(c_{t'})=2 while by (∗)(\ast) f(ℓt′)=3f(\ell_{t'})=3; and f(ct′′)=1f(c_{t''})=1 while f(ℓt′′)∈{2,3}f(\ell_{t''})\in\{2,3\}. ✓ (Colour 11 is always free for a clause vertex, since only NN takes it and NN is not joined to clause vertices.)

So ff is a legal 3-colouring, i.e. G∈3COLG\in\mathrm{3COL}.

3COL ∈ ⟹ 3NAE ∈

Let ff be a legal 3-colouring of GG. Since permuting colour names preserves legality, w.l.o.g. f(N)=1f(N)=1.

Step 1. Every literal vertex ℓ\ell is joined to NN by a black edge, so f(ℓ)≠1f(\ell)\ne1, i.e. f(ℓ)∈{2,3}f(\ell)\in\{2,3\}.

Step 2. For each ii the blue edge xixi‾x_i\overline{x_i} forces f(xi)≠f(xi‾)f(x_i)\ne f(\overline{x_i}). With Step 1: exactly one of xi,xi‾x_i,\overline{x_i} is coloured 22 and the other 33.

Step 3 (the assignment). Define V(xi)=1  ⟺  f(xi)=2V(x_i)=1\iff f(x_i)=2. By Step 2 this makes f(xi‾)=3f(\overline{x_i})=3, so the uniform rule (∗)(\ast) holds again. The definition is consistent and well defined for every variable.

Step 4 (every clause is NAE-satisfied). Let CC be a clause with literals ℓ1,ℓ2,ℓ3\ell_1,\ell_2,\ell_3 and clause vertices c1,c2,c3c_1,c_2,c_3. The three form a triangle, so in a legal colouring they carry three distinct colours: {f(c1),f(c2),f(c3)}={1,2,3}\{f(c_1),f(c_2),f(c_3)\}=\{1,2,3\}. In particular:

  • some tt has f(ct)=2f(c_t)=2. The red edge ctℓtc_t\ell_t forces f(ℓt)≠2f(\ell_t)\ne2, and Step 1 gives f(ℓt)=3f(\ell_t)=3, so by (∗)(\ast) V(ℓt)=0V(\ell_t)=0.
  • some ss has f(cs)=3f(c_s)=3. The red edge csℓsc_s\ell_s forces f(ℓs)≠3f(\ell_s)\ne3, so f(ℓs)=2f(\ell_s)=2, so V(ℓs)=1V(\ell_s)=1.

And t≠st\ne s since the colours differ, so ℓt≠ℓs\ell_t\ne\ell_s are two distinct literals of CC — this is where the assumption of three distinct literals per clause enters.

So CC holds a literal assigned 11 and one assigned 00, i.e. VV NAE-satisfies CC. As CC was arbitrary, φ∈3NAE\varphi\in\mathrm{3NAE}.

Cost of the reduction

TimeO(|φ|)
SpaceO(|φ|)
Output sizeO(|φ|)

Vertices: 2n+1+3m2n+1+3m, and since n,m≤∣φ∣n,m\le|\varphi| that is O(∣φ∣)O(|\varphi|). Edges: 2n2n black, nn blue, and exactly six red per clause — 6m6m. Altogether ∣V∣+∣E∣=O(∣φ∣)|V|+|E|=O(|\varphi|), i.e. linear time.

What it buys

3COL\mathrm{3COL} is NP-hard, and lies in NP\mathrm{NP} (witness the colouring; the verifier scans the edges), hence NP-complete. From there 4COL\mathrm{4COL} follows through 3COL≤p4COL\mathrm{3COL}\le_p\mathrm{4COL}.

Pitfalls

  • You cannot colour "all xix_i with 2 and all xi‾\overline{x_i} with 3". The colouring must depend on the assignment; otherwise two literals the assignment valued differently would share a colour and the link between colour and truth value would break.

  • Each clause triangle is coloured completely independently of the others — just as in the MAXCUT\mathrm{MAXCUT} reduction each clause contributed its own edges.

The chain

Used later by

Where this was read from

  • Lesson 10משפט 6: 3NAE≤p3COL\mathrm{3NAE} \le_p \mathrm{3COL}, ולכן 3COL\mathrm{3COL} היא NP-שלמה
  • The ⟸\Longleftarrow direction was left as homework in the lecture and only sketched in the recording's final minute; the full proof in the lesson file is a completion following the lecturer's sketch.