-
Notifications
You must be signed in to change notification settings - Fork 3
[Rule] 3-SATISFIABILITY to MONOCHROMATIC TRIANGLE #884
Description
Source: 3-SATISFIABILITY (3SAT)
Target: MONOCHROMATIC TRIANGLE
Motivation: Establishes NP-completeness of MONOCHROMATIC TRIANGLE via polynomial-time reduction from 3SAT. The reduction by Burr (1976) shows that deciding whether edges can be 2-colored to avoid monochromatic triangles is computationally hard. This connects satisfiability to Ramsey-theoretic graph coloring.
Reference: Garey & Johnson, Computers and Intractability, A1.1 GT6; Burr, S. A. (1976). "Generalized Ramsey theory for graphs — a survey." In Graphs and Combinatorics, Lecture Notes in Mathematics, vol. 406, Springer, pp. 52-75.
GJ Source Entry
MONOCHROMATIC TRIANGLE
INSTANCE: Graph G = (V,E).
QUESTION: Can E be partitioned into two sets E_1 and E_2 such that neither (V,E_1) nor (V,E_2) contains a triangle?Reference: [Burr, 1976]. Transformation from 3-SATISFIABILITY.
Reduction Algorithm
Given a KSatisfiability<K3> instance with n variables and m clauses, construct a MonochromaticTriangle graph G = (V', E') as follows:
-
Literal vertices: For each variable x_i (i = 1, ..., n), create a positive vertex p_i and a negative vertex n_i. Add a negation edge (p_i, n_i). This gives 2n vertices and n edges.
-
Clause gadgets: For each clause C_j = (l_1 ∨ l_2 ∨ l_3), map each literal to its vertex (x_i maps to p_i; ¬x_i maps to n_i). Let v_1, v_2, v_3 be the three literal vertices.
For each pair (v_a, v_b) from {v_1, v_2, v_3}, create a fresh intermediate vertex m_{ab}^j and add fan edges (v_a, m_{ab}^j) and (v_b, m_{ab}^j). This produces 3 intermediate vertices and 6 fan edges per clause.
Connect the three intermediate vertices to form a clause triangle:
(m_{12}^j, m_{13}^j), (m_{12}^j, m_{23}^j), (m_{13}^j, m_{23}^j)Each clause gadget produces 4 triangles: the clause triangle plus three fan triangles.
-
Solution extraction: From a valid 2-edge-coloring c of G, read the truth assignment: τ(x_i) = 1 if c(p_i, n_i) = 0, else τ(x_i) = 0.
Correctness: The local gadget lemma (verified exhaustively): for every assignment of the three clause literals, the clause gadget admits a monochromatic-triangle-free 2-edge-coloring iff the clause is satisfied. Forward: a satisfying assignment encodes on negation edges, and each clause's gadget can be colored locally. Backward: if all three literals are false, the fan constraints force the clause triangle to be monochromatic.
Size Overhead
| Target metric (code name) | Expression |
|---|---|
num_vertices |
2 * num_vars + 3 * num_clauses |
num_edges |
num_vars + 9 * num_clauses |
Implementation Note
MonochromaticTriangle currently has 0 outgoing reductions (no ILP solver). A MonochromaticTriangle → ILP rule should be implemented alongside this rule:
- Binary variable c_e ∈ {0,1} per edge (the 2-coloring)
- For each triangle (e1, e2, e3): c_e1 + c_e2 + c_e3 ≥ 1 and c_e1 + c_e2 + c_e3 ≤ 2
- Feasibility objective (Value = Or)
- Overhead:
num_vars = "num_edges", constraints = 2 × num_triangles
Example
Source (KSatisfiability):
n = 6 variables (x_1, ..., x_6), m = 4 clauses:
- C_1 = (x_1 ∨ x_2 ∨ ¬x_3)
- C_2 = (¬x_1 ∨ x_4 ∨ x_5)
- C_3 = (x_3 ∨ ¬x_4 ∨ x_6)
- C_4 = (¬x_2 ∨ ¬x_5 ∨ ¬x_6)
Each variable appears exactly twice with opposite polarity across clauses — maximally balanced structure.
Target (MonochromaticTriangle):
- 2·6 + 3·4 = 24 vertices, 6 + 9·4 = 42 edges
- Literal vertices: p_1, ..., p_6, n_1, ..., n_6 (12 vertices)
- Intermediate vertices: 3 per clause × 4 clauses = 12 vertices
- Negation edges (6): (p_1,n_1), (p_2,n_2), (p_3,n_3), (p_4,n_4), (p_5,n_5), (p_6,n_6)
- Per clause: 6 fan edges + 3 clause-triangle edges = 9 edges × 4 clauses = 36 edges
- Total: 6 + 36 = 42 edges
Satisfying assignment: x_1=1, x_2=1, x_3=0, x_4=1, x_5=0, x_6=1
- C_1: x_1=T ✓
- C_2: x_4=T ✓
- C_3: x_6=T ✓
- C_4: ¬x_5=T ✓
Non-satisfying assignment: x_1=1, x_2=1, x_3=1, x_4=1, x_5=1, x_6=1
- C_4: (¬x_2 ∨ ¬x_5 ∨ ¬x_6) = (F ∨ F ∨ F) = F ✗
By correctness, when the source is satisfiable, the target MonochromaticTriangle admits a valid 2-edge-coloring; the failing assignment above corresponds to a target coloring with at least one monochromatic triangle.
Validation Method
- Closed-loop test: reduce KSatisfiability to MonochromaticTriangle, solve target via ILP (MonochromaticTriangle → ILP), extract truth assignment from negation edge colors, verify all clauses satisfied
- Test with both satisfiable and unsatisfiable instances
- Verified by PR docs: batch verify-reduction — 34 implementable reductions verified #992 with 12K automated checks (constructor + adversary scripts)
References
- Burr, S. A. (1976). "Generalized Ramsey theory for graphs — a survey." In Graphs and Combinatorics, Lecture Notes in Mathematics, vol. 406, Springer, pp. 52-75.
- Garey, M. R., & Johnson, D. S. (1979). Computers and Intractability, A1.1 GT6.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status