Reducing to SATISFIABILITY
Context: FIT2014_MOC · the hand skill of Week 11 — the W1 skill of encoding a problem in CNF re-run with a clock attached, so the encoding is now a [[Polynomial-Time Reductions| reduction]] and not just a modelling exercise Problem it solves: given a language in , build a CNF formula from each instance such that is satisfiable iff the instance is a Yes-instance.
Quick Revision
- 🎯 Trigger: you must show (or feed to a SAT solver) ➔ variables describe the certificate, clauses enforce the validity rules.
- ⚡ Key Constraint: the certificate’s variables are not enough — every rule of the language must become clauses, and you must then count them to prove the construction is polynomial. A correct encoding with no time bound is an incomplete reduction.
📝 The four-step recipe
- Variables for the certificate ➔ one Boolean per atomic choice the certificate makes (“is object selected?”).
- Auxiliary variables (optional) ➔ extra Booleans to express conditions the certificate variables cannot state directly.
- Rules → CNF ➔ translate each validity condition into clauses, using the cardinality templates: at least one is a single positive disjunction; at most one is pairwise negative binary clauses.
- Assemble as an algorithm ➔ state the construction as numbered steps on the input, take the conjunction, and bound its running time.
- Why CNF specifically ➔ satisfiable Boolean expressions in CNF, so a formula in any other shape is not an instance of the target language.
- Practical payoff ➔ SAT solvers are mature programs; since anything can be routed through one, this recipe is how NP-hard problems actually get solved in industry.
🧮 Worked reduction —
PARTITION INTO TRIANGLES can be partitioned into 3-sets, each of which induces a triangle in . Note is forced, and the 3-sets must be disjoint and cover everything — a graph can be full of triangles and still fail.
Step 1 — variables. One per triangle of the graph (not per 3-set of vertices):
- Count ➔ at most triangles ⟹ variables.
Step 3 — the two rules. “The chosen triangles partition ” splits into exactly two conditions:
| Rule | Clause shape | One clause per | Count |
|---|---|---|---|
| every vertex is in at least one chosen triangle | over the triangles at that vertex | vertex | |
| no vertex is in more than one | for each pair at that vertex | vertex triangle-pair |
- Recognise the templates ➔ these are precisely at-least-one and at-most-one from CNF Encoding Patterns (At Least, At Most, Exactly); together they say exactly one, which is what partition means.
- Why pairs and not a counter ➔ the pairwise form is already CNF; any arithmetic "" form would need converting.
Worked instance — the 6-vertex graph with triangles
Variables: . At-least-one clauses, one per vertex:
At-most-one clauses, per vertex per pair of triangles at it:
- Key move: vertices and each lie in only one triangle, so their at-least-one clauses are unit clauses and — these force , which then kills and through the negative clauses. is satisfiable, and the partition is .
- Duplicate clauses cost nothing ➔ a pair shared between two vertices is listed once; the conjunction is idempotent.
Step 4 — the algorithm and its cost.
Input: graph G
1. for each triangle Ti of G: create a new variable x_Ti
2. for each vertex v of G: let T1..Tk be the triangles at v
emit clause x_T1 v x_T2 v ... v x_Tk
3. for each pair Ti,Tj sharing a vertex: emit clause ¬x_Ti v ¬x_Tj
4. φ := conjunction of all clauses
5. output φ
Cost ➔ the dominating factor is step 3, the number of triangle pairs sharing a vertex, which is ; each pair costs – work ⟹ the whole construction is polynomial, and by the output-length lemma is polynomial too. Correctness ➔ is satisfiable some set of triangles hits every vertex exactly once .
🔀 Other languages set as exercises
- 3-COLOURABILITY ➔ variables (vertex has colour ); exactly-one-colour per vertex, plus per edge per colour. (Set as an exercise — construction not given in the handout.)
- CUBIC SUBGRAPH ➔ graphs containing a subgraph in which every vertex has degree exactly 3.
- HAMILTONIAN CIRCUIT · FA-Nonempty ➔ the FA exercise asks for variables representing the letter at each position of the input string, so that models the automaton’s execution — the same idea the Cook-Levin Theorem applies to a Turing machine.
⚠️ Common Mistakes
- 💡 Encoding only the certificate ➔ variables alone make every assignment legal. The marks are in the rule clauses; without the at-most-one family, a vertex could sit in two triangles and would still be satisfiable.
- 💡 Skipping the time bound ➔ a [[Polynomial-Time Reductions|]] proof has three marked parts — function, iff, and cost. Counting variables and clauses is the cost argument here.
- 💡 Leaving the formula out of CNF ➔ writing is not an instance of SATISFIABILITY until it is rewritten as .
- 💡 Making a variable per 3-set instead of per triangle ➔ blows the variable count up with 3-sets that are not triangles at all, and forces extra clauses to rule them out.
- 💡 Proving one direction ➔ “a partition gives a satisfying assignment” must be matched by “a satisfying assignment gives a partition”, or the reduction may map a No-instance to a satisfiable .
🧠 Active Recall
Which W1 skill is this, and what has been added to it?
Answer
- Short answer: it is Encoding Problems in Propositional Logic plus a complexity budget — the encoding must now be produced by a polynomial-time algorithm.
- Why: the cardinality templates are unchanged ➔ at least one is still one positive clause of length , at most one still negative binary clauses. What Week 11 adds is that the CNF is the output of a reduction, so its size and construction time must be counted in — which is exactly why the clause count is written down.
How does the recipe generalise from PARTITION INTO TRIANGLES to every language in ?
Answer
- Short answer: by encoding the verifier’s computation instead of the problem’s combinatorics — variables for the machine’s state, tape contents and head position at every timestep, clauses forbidding every illegal transition.
- Why: that is the Cook-Levin Theorem ➔ every has a polynomial-time verifier by definition, so if a machine’s run can be written in CNF, one construction covers all of at once. The FA-Nonempty exercise is the training-wheels version: model an automaton’s execution rather than a Turing machine’s.