Minimum 2-satisfiability
AbbreviationMINIMUM 2-SATISFIABILITY instances#✓fully proved
An instance of MINIMUM 2-SATISFIABILITY is a triple \((n, \varphi, K)\) of a natural number \(n\) (the number of variables), a CNF formula \(\varphi\) and a natural number \(K\) (the bound). No condition is placed on \(\varphi\) here; clauses of at most two literals are required separately, by well-formedness.
abbrev MinTwoSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
abbrev CNF := List CNFClause
CSLibExt/Logics/Propositional/CNF/Basic.lean:33
Uses 1 · Used by 3
DefinitionWell-formed MINIMUM 2-SATISFIABILITY instances#✓fully proved
A triple \((n, \varphi, K)\) of a natural number \(n\), a CNF formula \(\varphi\) and a natural number \(K\) is well formed when every clause of \(\varphi\) has at most two literals and every literal of every clause has variable index less than \(n\).
def WellFormed (i : MinTwoSatInstance) : Prop :=
(∀ clause ∈ i.2.1, clause.length ≤ 2 ∧ ∀ l ∈ clause, l.1 < i.1)
abbrev MinTwoSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
WantedExt/Complexity/NPComplete/MinTwoSatWanted.lean:47
Uses 3 · Used by 1
DefinitionFeasible MINIMUM 2-SATISFIABILITY instances#✓fully proved
A triple \((n, \varphi, K)\) of a natural number \(n\), a CNF formula \(\varphi\) with clauses \(C_0, \dots, C_{m-1}\) and a natural number \(K\) is feasible when there is an assignment of truth values to the variables \(0, \dots, n-1\) that, with every variable \(x \ge n\) set to false, satisfies \(C_j\) for at most \(K\) indices \(j < m\).
def MinTwoSatFeasible
(i : MinTwoSatInstance) : Prop :=
∃ assign : List Bool, assign.length = i.1 ∧
∃ S : Finset ℕ, S ⊆ Finset.range i.2.1.length ∧ S.card ≤ i.2.2 ∧
∀ j < i.2.1.length,
Cslib.Logic.PL.CNFClause.Satisfies (fun x => assign.getD x false)
(i.2.1.getD j []) ↔ j ∈ S
abbrev MinTwoSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
WantedExt/Complexity/NPComplete/MinTwoSatWanted.lean:47
def Satisfies (assignment : Nat → Bool) (clause : CNFClause) : Prop :=
∃ literal ∈ clause, CNFLiteral.Satisfies assignment literal
CSLibExt/Logics/Propositional/CNF/Semantics.lean:45
Uses 4 · Used by 1
DefinitionThe MINIMUM 2-SATISFIABILITY decision problem#✓fully proved
MINIMUM 2-SATISFIABILITY is the decision problem that accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding, to a triple \((n, \varphi, K)\) of a natural number \(n\), a CNF formula \(\varphi\) with clauses \(C_0, \dots, C_{m-1}\) and a natural number \(K\) such that every clause has at most two literals, all with variables less than \(n\), and some assignment of truth values to the variables \(0, \dots, n-1\) satisfies \(C_j\) for at most \(K\) indices \(j < m\). Every other bitstring is rejected.
noncomputable def minTwoSatDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := MinTwoSatInstance) x with
| some i => decide (WellFormed i ∧ MinTwoSatFeasible i)
| none => false
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def bitDecode [BitstringEncoding α] (l : List Bool) : Option α := toEncoding.decode l
MathlibExt/Computability/Complexity.lean:58
abbrev MinTwoSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
WantedExt/Complexity/NPComplete/MinTwoSatWanted.lean:47
def WellFormed (i : MinTwoSatInstance) : Prop :=
(∀ clause ∈ i.2.1, clause.length ≤ 2 ∧ ∀ l ∈ clause, l.1 < i.1)
WantedExt/Complexity/NPComplete/MinTwoSatWanted.lean:50
def MinTwoSatFeasible
(i : MinTwoSatInstance) : Prop :=
∃ assign : List Bool, assign.length = i.1 ∧
∃ S : Finset ℕ, S ⊆ Finset.range i.2.1.length ∧ S.card ≤ i.2.2 ∧
∀ j < i.2.1.length,
Cslib.Logic.PL.CNFClause.Satisfies (fun x => assign.getD x false)
(i.2.1.getD j []) ↔ j ∈ S
WantedExt/Complexity/NPComplete/MinTwoSatWanted.lean:54
Uses 14 · Used by 1
TheoremMINIMUM 2-SATISFIABILITY is NP-complete#●ready to prove
Let MINIMUM 2-SATISFIABILITY be the decision problem that accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding, to a triple \((n, \varphi, K)\) of a natural number \(n\), a CNF formula \(\varphi\) with clauses \(C_0, \dots, C_{m-1}\) and a natural number \(K\) such that every clause has at most two literals, all with variables less than \(n\), and some assignment of truth values to the variables \(0, \dots, n-1\) satisfies \(C_j\) for at most \(K\) indices \(j < m\). Then MINIMUM 2-SATISFIABILITY belongs to NP, and every decision problem \(L\) in NP reduces to it by a polynomial-time many-one reduction: there is a polynomial-time computable map \(f\) on bitstrings such that, for every bitstring \(x\), \(L\) accepts \(x\) exactly when MINIMUM 2-SATISFIABILITY accepts \(f(x)\).
public theorem_wanted minTwoSat_npComplete :
minTwoSatDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L minTwoSatDec
noncomputable def minTwoSatDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := MinTwoSatInstance) x with
| some i => decide (WellFormed i ∧ MinTwoSatFeasible i)
| none => false
WantedExt/Complexity/NPComplete/MinTwoSatWanted.lean:64
def NP : DecisionComplexityClass :=
{ L | ∃ (p : Polynomial ℕ), ∃ R : (List Bool × List Bool) → Bool,
IsPolyTime R ∧
∀ x, L x ↔ ∃ w : List Bool, w.length ≤ p.eval x.length ∧ R (x, w) }
MathlibExt/Computability/Complexity.lean:200
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def PolyManyOneRed (L₁ L₂ : MetaMathlibExt.ComplexityTheory.DecisionProblem) : Prop :=
∃ reduce : List Bool → List Bool,
MetaMathlibExt.ComplexityTheory.IsPolyTime reduce ∧ ∀ x, L₁ x = L₂ (reduce x)
CSLibExt/Computability/CookLevin.lean:396
Sources
- M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness (1979), MINIMUM 2-SATISFIABILITY; R. Kohli, R. Krishnamurti, and P. Mirchandani, "The minimum satisfiability problem" (1994).
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.