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

  1. Variables for the certificate ➔ one Boolean per atomic choice the certificate makes (“is object selected?”).
  2. Auxiliary variables (optional) ➔ extra Booleans to express conditions the certificate variables cannot state directly.
  3. 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.
  4. Assemble as an algorithm ➔ state the construction as numbered steps on the input, take the conjunction, and bound its running time.
  • Why CNF specificallysatisfiable Boolean expressions in CNF, so a formula in any other shape is not an instance of the target language.
  • Practical payoffSAT 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:

RuleClause shapeOne clause perCount
every vertex is in at least one chosen triangle over the triangles at that vertexvertex
no vertex is in more than one for each pair at that vertexvertex 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.

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