Closest string
AbbreviationClosest-string instances#✓fully proved
A closest-string instance is a pair \((S, d)\) of a finite list \(S\) of bitstrings (finite lists of booleans) and a natural number \(d\), the distance bound.
The bitstrings are not required to have equal length; that is the well-formedness condition.
DefinitionWell-formed closest-string instances#✓fully proved
A closest-string instance \((S, d)\) is well formed when all bitstrings in the list \(S\) have the same length.
def WellFormed (i : ClosestStringInstance) : Prop :=
∀ s ∈ i.1, ∀ t ∈ i.1, s.length = t.length
abbrev ClosestStringInstance := List (List Bool) × ℕ
WantedExt/Complexity/NPComplete/ClosestStringWanted.lean:46
Uses 1 · Used by 1
DefinitionFeasible closest-string instances#✓fully proved
Write \(\ell(x)\) for the length of a bitstring \(x\). A closest-string instance \((S, d)\) is feasible when there is a bitstring \(c\) with \(\ell(c) = \ell(s_1)\), where \(s_1\) is the first bitstring of \(S\) (and \(\ell(c) = 0\) if \(S\) is empty), such that for every \(s\) in \(S\) the number of positions \(j < \min(\ell(c), \ell(s))\) at which \(c\) and \(s\) differ is at most \(d\).
If all bitstrings of \(S\) have length \(\ell(c)\), this number is the Hamming distance between \(c\) and \(s\).
def ClosestStringFeasible
(i : ClosestStringInstance) : Prop :=
∃ center : List Bool, center.length = (i.1.getD 0 []).length ∧
∀ s ∈ i.1, ((List.zip center s).filter (fun p => !(p.1 == p.2))).length ≤ i.2
abbrev ClosestStringInstance := List (List Bool) × ℕ
WantedExt/Complexity/NPComplete/ClosestStringWanted.lean:46
Uses 1 · Used by 1
DefinitionThe CLOSEST STRING decision problem#✓fully proved
The decision problem CLOSEST STRING accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding of closest-string instances, to an instance that is well formed and feasible. Bitstrings that do not decode to a closest-string instance are rejected.
noncomputable def closestStringDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := ClosestStringInstance) x with
| some i => decide (WellFormed i ∧ ClosestStringFeasible 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 ClosestStringInstance := List (List Bool) × ℕ
WantedExt/Complexity/NPComplete/ClosestStringWanted.lean:46
def WellFormed (i : ClosestStringInstance) : Prop :=
∀ s ∈ i.1, ∀ t ∈ i.1, s.length = t.length
WantedExt/Complexity/NPComplete/ClosestStringWanted.lean:49
def ClosestStringFeasible
(i : ClosestStringInstance) : Prop :=
∃ center : List Bool, center.length = (i.1.getD 0 []).length ∧
∀ s ∈ i.1, ((List.zip center s).filter (fun p => !(p.1 == p.2))).length ≤ i.2
WantedExt/Complexity/NPComplete/ClosestStringWanted.lean:53
Uses 12 · Used by 1
TheoremCLOSEST STRING is NP-complete#●ready to prove
The CLOSEST STRING decision problem belongs to NP, and every decision problem in NP has a polynomial-time many-one reduction to it.
public theorem_wanted closestString_npComplete :
closestStringDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L closestStringDec
noncomputable def closestStringDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := ClosestStringInstance) x with
| some i => decide (WellFormed i ∧ ClosestStringFeasible i)
| none => false
WantedExt/Complexity/NPComplete/ClosestStringWanted.lean:60
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
- J. K. Lanctot et al., "Distinguishing string selection problems" (2003); M. Frances and A. Litman, "On covering problems of codes" (1997).
Uses 5
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.