Maximum satisfiability
AbbreviationMAX-SAT instances#✓fully proved
A MAX-SAT instance 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).
abbrev MaxSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
abbrev CNF := List CNFClause
CSLibExt/Logics/Propositional/CNF/Basic.lean:33
Uses 1 · Used by 3
DefinitionWell-formed MAX-SAT instances#✓fully proved
A MAX-SAT instance \((n, \varphi, K)\) is well formed when every literal \((x, b)\) in every clause of \(\varphi\) has variable index \(x < n\).
def WellFormed (i : MaxSatInstance) : Prop :=
(∀ clause ∈ i.2.1, ∀ l ∈ clause, l.1 < i.1)
abbrev MaxSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
WantedExt/Complexity/NPComplete/MaxSatWanted.lean:46
Uses 3 · Used by 1
DefinitionFeasible MAX-SAT instances#✓fully proved
A MAX-SAT instance \((n, \varphi, K)\) is feasible when there are truth values \(a_0, \dots, a_{n-1}\) such that at least \(K\) of the clauses in the list \(\varphi\), counted with multiplicity, are satisfied by the assignment \(v\) with \(v(x) = a_x\) for \(x < n\) and \(v(x) = \mathrm{false}\) for \(x \ge n\).
def MaxSatFeasible
(i : MaxSatInstance) : Prop :=
∃ assign : List Bool, assign.length = i.1 ∧
∃ sub : Cslib.Logic.PL.CNF, sub.Sublist i.2.1 ∧ i.2.2 ≤ sub.length ∧
∀ clause ∈ sub, Cslib.Logic.PL.CNFClause.Satisfies
(fun x => assign.getD x false) clause
abbrev MaxSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
WantedExt/Complexity/NPComplete/MaxSatWanted.lean:46
abbrev CNF := List CNFClause
CSLibExt/Logics/Propositional/CNF/Basic.lean:33
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
DefinitionMAXIMUM SATISFIABILITY as a decision problem#✓fully proved
The decision problem MAXIMUM SATISFIABILITY accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding of MAX-SAT instances, to an instance \((n, \varphi, K)\) that is well formed (every literal of \(\varphi\) has variable index less than \(n\)) and feasible (some assignment of truth values to the \(n\) variables satisfies at least \(K\) of the clauses of \(\varphi\), counted with multiplicity). Bitstrings that do not decode, and bitstrings that decode to instances that are not well formed, are rejected.
noncomputable def maxSatDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := MaxSatInstance) x with
| some i => decide (WellFormed i ∧ MaxSatFeasible 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 MaxSatInstance := ℕ × Cslib.Logic.PL.CNF × ℕ
WantedExt/Complexity/NPComplete/MaxSatWanted.lean:46
def WellFormed (i : MaxSatInstance) : Prop :=
(∀ clause ∈ i.2.1, ∀ l ∈ clause, l.1 < i.1)
WantedExt/Complexity/NPComplete/MaxSatWanted.lean:49
def MaxSatFeasible
(i : MaxSatInstance) : Prop :=
∃ assign : List Bool, assign.length = i.1 ∧
∃ sub : Cslib.Logic.PL.CNF, sub.Sublist i.2.1 ∧ i.2.2 ≤ sub.length ∧
∀ clause ∈ sub, Cslib.Logic.PL.CNFClause.Satisfies
(fun x => assign.getD x false) clause
WantedExt/Complexity/NPComplete/MaxSatWanted.lean:53
Uses 14 · Used by 1
TheoremMAXIMUM SATISFIABILITY is NP-complete#●ready to prove
The decision problem MAXIMUM SATISFIABILITY over bitstrings lies in NP, and every decision problem in NP has a polynomial-time many-one reduction to it.
public theorem_wanted maxSat_npComplete :
maxSatDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L maxSatDec
noncomputable def maxSatDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := MaxSatInstance) x with
| some i => decide (WellFormed i ∧ MaxSatFeasible i)
| none => false
WantedExt/Complexity/NPComplete/MaxSatWanted.lean:62
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), MAXIMUM SATISFIABILITY.
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.