-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Source: KSatisfiability (3-SAT)
Target: SubsetSum
Motivation: Classical Karp reduction bridging Boolean satisfiability (formula domain) to number theory (algebraic domain). The canonical proof that SubsetSum is NP-complete. Uses a base-10 digit encoding where each digit position is independent (no carries).
Reference: Karp, 1972; Sipser, Introduction to the Theory of Computation, 2012, Theorem 7.56; CLRS, 4th ed., 2022, §34.5.5
Reduction Algorithm
Notation:
- Source: 3-CNF formula
$\phi$ with$n$ variables$x_1, \ldots, x_n$ and$m$ clauses$C_1, \ldots, C_m$ - Target: SubsetSum instance with set
$S$ of$2n + 2m$ integers and target$T$ , each integer having$(n + m)$ decimal digits
Step 1 — Variable integers (
For each variable
where
Step 2 — Slack integers (
For each clause
Step 3 — Target:
Why no carries: Each variable digit sums to exactly 1 (we pick
Why it works: Selecting
Solution extraction: For each
Size Overhead
| Target metric (code name) | Polynomial (using symbols above) |
|---|---|
num_elements |
|
max_digits |
Validation Method
Closed-loop testing: solve 3-SAT by brute-force (
Example
Source instance: 3-SAT formula
Constructed integers (5-digit base-10):
| Integer |
|
|
Decimal | |||
|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 1 | 0 | 10010 | |
| 1 | 0 | 0 | 0 | 1 | 10001 | |
| 0 | 1 | 0 | 1 | 0 | 1010 | |
| 0 | 1 | 0 | 0 | 1 | 1001 | |
| 0 | 0 | 1 | 1 | 1 | 111 | |
| 0 | 0 | 1 | 0 | 0 | 100 | |
| 0 | 0 | 0 | 1 | 0 | 10 | |
| 0 | 0 | 0 | 2 | 0 | 20 | |
| 0 | 0 | 0 | 0 | 1 | 1 | |
| 0 | 0 | 0 | 0 | 2 | 2 |
Target:
Verification: Assignment
- Select
$y_1 + y_2 + y_3 = 10010 + 1010 + 111 = 11131$ - Clause digits:
$C_1 = 3, C_2 = 1$ . Need$+1$ for$C_1$ ,$+3$ for$C_2$ - Add
$g_1 + h_2 + g_2 = 10 + 2 + 1 = 13$ - Total:
$11131 + 13 = 11144 = T$ ✓
Assignment
- Select
$z_1 + z_2 + z_3 = 10001 + 1001 + 100 = 11102$ - Clause digits:
$C_1 = 0, C_2 = 2$ . Need$+4$ for$C_1$ — but max slack is$g_1 + h_1 = 3$ . Cannot reach 4. ✗