Minimum-ones 3-SAT
AbbreviationMINIMUM ONES 3-SAT instances#✓fully proved
An instance of MINIMUM ONES 3-SAT 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 exactly three literals are required separately, by well-formedness.
abbrev MinOnesThreeSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
abbrev CNF := List CNFClause
CSLibExt/Logics/Propositional/CNF/Basic.lean:33
Uses 1 · Used by 3
DefinitionWell-formed MINIMUM ONES 3-SAT 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\) is a list of exactly three literals and every literal of every clause has variable index less than \(n\).
def WellFormed (i : MinOnesThreeSatInstance) : Prop :=
(∀ clause ∈ i.2.1, clause.length = 3 ∧ ∀ l ∈ clause, l.1 < i.1)
abbrev MinOnesThreeSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
WantedExt/Complexity/NPComplete/MinOnesThreeSatWanted.lean:46
Uses 3 · Used by 1
DefinitionFeasible MINIMUM ONES 3-SAT instances#✓fully proved
A triple \((n, \varphi, K)\) of a natural number \(n\), a CNF formula \(\varphi\) 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 \(\varphi\) and sets at most \(K\) of the variables \(0, \dots, n-1\) to true.
def MinOnesThreeSatFeasible
(i : MinOnesThreeSatInstance) : Prop :=
∃ assign : List Bool, assign.length = i.1 ∧
(Cslib.Logic.PL.CNF.Satisfies (fun x => assign.getD x false) i.2.1) ∧
(assign.filter (fun b => b)).length ≤ i.2.2
abbrev MinOnesThreeSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
WantedExt/Complexity/NPComplete/MinOnesThreeSatWanted.lean:46
def Satisfies (assignment : Nat → Bool) (formula : CNF) : Prop :=
∀ clause ∈ formula, CNFClause.Satisfies assignment clause
CSLibExt/Logics/Propositional/CNF/Semantics.lean:71
Uses 3 · Used by 1
DefinitionThe MINIMUM ONES 3-SAT decision problem#✓fully proved
MINIMUM ONES 3-SAT 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\) and a natural number \(K\) such that every clause of \(\varphi\) is a list of exactly three literals whose variables are all less than \(n\), and some assignment of truth values to the variables \(0, \dots, n-1\) satisfies \(\varphi\) and sets at most \(K\) of them to true. Every other bitstring is rejected.
noncomputable def minOnesThreeSatDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := MinOnesThreeSatInstance) x with
| some i => decide (WellFormed i ∧ MinOnesThreeSatFeasible 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 MinOnesThreeSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
WantedExt/Complexity/NPComplete/MinOnesThreeSatWanted.lean:46
def WellFormed (i : MinOnesThreeSatInstance) : Prop :=
(∀ clause ∈ i.2.1, clause.length = 3 ∧ ∀ l ∈ clause, l.1 < i.1)
WantedExt/Complexity/NPComplete/MinOnesThreeSatWanted.lean:49
def MinOnesThreeSatFeasible
(i : MinOnesThreeSatInstance) : Prop :=
∃ assign : List Bool, assign.length = i.1 ∧
(Cslib.Logic.PL.CNF.Satisfies (fun x => assign.getD x false) i.2.1) ∧
(assign.filter (fun b => b)).length ≤ i.2.2
WantedExt/Complexity/NPComplete/MinOnesThreeSatWanted.lean:53
Uses 14 · Used by 1
TheoremMINIMUM ONES 3-SAT is NP-complete#●ready to prove
Let MINIMUM ONES 3-SAT 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\) and a natural number \(K\) such that every clause of \(\varphi\) is a list of exactly three literals whose variables are all less than \(n\), and some assignment of truth values to the variables \(0, \dots, n-1\) satisfies \(\varphi\) and sets at most \(K\) of them to true. Then MINIMUM ONES 3-SAT 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 ONES 3-SAT accepts \(f(x)\).
public theorem_wanted minOnesThreeSat_npComplete :
minOnesThreeSatDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L minOnesThreeSatDec
noncomputable def minOnesThreeSatDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := MinOnesThreeSatInstance) x with
| some i => decide (WellFormed i ∧ MinOnesThreeSatFeasible i)
| none => false
WantedExt/Complexity/NPComplete/MinOnesThreeSatWanted.lean:61
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 ONES 3-SAT.
Uses 5
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.