Set cover
AbbreviationSet-cover instances#✓fully proved
A set-cover instance is a triple \((n, C, K)\) consisting of a natural number \(n\), the size of the universe, a finite list \(C\) of finite lists of natural numbers, the subsets, and a natural number \(K\), the bound.
Used by 3
DefinitionWell-formed set-cover instances#✓fully proved
A set-cover instance \((n, C, K)\) is well formed when every list \(s\) in \(C\) has no repeated entries and every entry of \(s\) is less than \(n\), that is, each member of \(C\) lists the elements of a subset of \(\{0, \dots, n - 1\}\) without repetition.
def WellFormed (i : SetCoverInstance) : Prop :=
∀ s ∈ i.2.1, s.Nodup ∧ ∀ x ∈ s, x < i.1
abbrev SetCoverInstance := ℕ × List (List ℕ) × ℕ
WantedExt/Complexity/NPComplete/SetCoverWanted.lean:45
Uses 1 · Used by 1
DefinitionFeasible set-cover instances#✓fully proved
A set-cover instance \((n, C, K)\) is feasible when there is a sublist \(D\) of \(C\) (a list obtained from \(C\) by deleting entries while keeping their order) with at most \(K\) entries such that every natural number \(x < n\) belongs to some list in \(D\).
def SetCoverFeasible
(i : SetCoverInstance) : Prop :=
∃ sub : List (List ℕ), sub.Sublist i.2.1 ∧ sub.length ≤ i.2.2 ∧
∀ x < i.1, ∃ s ∈ sub, x ∈ s
abbrev SetCoverInstance := ℕ × List (List ℕ) × ℕ
WantedExt/Complexity/NPComplete/SetCoverWanted.lean:45
Uses 1 · Used by 1
DefinitionThe SET COVER decision problem#✓fully proved
SET COVER is the decision problem that accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding, to a set-cover instance \((n, C, K)\) that is both well formed and feasible: every list in \(C\) has no repeated entries and only entries less than \(n\), and some sublist of \(C\) with at most \(K\) entries contains every natural number \(y < n\) in one of its lists. Bitstrings that do not decode to a set-cover instance are rejected.
noncomputable def setCoverDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := SetCoverInstance) x with
| some i => decide (WellFormed i ∧ SetCoverFeasible 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 SetCoverInstance := ℕ × List (List ℕ) × ℕ
WantedExt/Complexity/NPComplete/SetCoverWanted.lean:45
def WellFormed (i : SetCoverInstance) : Prop :=
∀ s ∈ i.2.1, s.Nodup ∧ ∀ x ∈ s, x < i.1
WantedExt/Complexity/NPComplete/SetCoverWanted.lean:48
def SetCoverFeasible
(i : SetCoverInstance) : Prop :=
∃ sub : List (List ℕ), sub.Sublist i.2.1 ∧ sub.length ≤ i.2.2 ∧
∀ x < i.1, ∃ s ∈ sub, x ∈ s
WantedExt/Complexity/NPComplete/SetCoverWanted.lean:52
Uses 12 · Used by 1
TheoremSET COVER is NP-complete#●ready to prove
The SET COVER decision problem lies in NP, and every decision problem \(L\) in NP has a polynomial-time many-one reduction to SET COVER.
public theorem_wanted setCover_npComplete :
setCoverDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L setCoverDec
noncomputable def setCoverDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := SetCoverInstance) x with
| some i => decide (WellFormed i ∧ SetCoverFeasible i)
| none => false
WantedExt/Complexity/NPComplete/SetCoverWanted.lean:59
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 (1979), SET COVER; R. M. Karp, "Reducibility among combinatorial problems" (1972).
Uses 5
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.