Shortest common supersequence
AbbreviationShortest common supersequence instances#✓fully proved
An instance of SHORTEST COMMON SUPERSEQUENCE is a pair \((R, K)\) of a list \(R\) of binary strings (lists of booleans) and a natural number \(K\), the length bound.
DefinitionFeasible shortest common supersequence instances#✓fully proved
An instance \((R, K)\) of SHORTEST COMMON SUPERSEQUENCE, a list \(R\) of lists of booleans together with a natural number \(K\), is feasible when there is a list \(w\) of booleans of length at most \(K\) such that every list in \(R\) is a subsequence of \(w\) (its entries occur in \(w\) in the same order, not necessarily consecutively).
def ShortestCommonSupersequenceFeasible
(i : ShortestCommonSupersequenceInstance) : Prop :=
∃ super : List Bool, super.length ≤ i.2 ∧ ∀ s ∈ i.1, s.Sublist super
abbrev ShortestCommonSupersequenceInstance := List (List Bool) × ℕ
WantedExt/Complexity/NPComplete/ShortestCommonSupersequenceWanted.lean:47
Uses 1 · Used by 1
DefinitionThe SHORTEST COMMON SUPERSEQUENCE decision problem#✓fully proved
SHORTEST COMMON SUPERSEQUENCE is the decision problem that accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding, to a pair \((R, K)\) of a list \(R\) of lists of booleans and a natural number \(K\) for which some list of booleans of length at most \(K\) has every list in \(R\) as a subsequence. Bitstrings that do not decode to such a pair are rejected.
noncomputable def shortestCommonSupersequenceDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := ShortestCommonSupersequenceInstance) x with
| some i => decide (ShortestCommonSupersequenceFeasible 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 ShortestCommonSupersequenceInstance := List (List Bool) × ℕ
WantedExt/Complexity/NPComplete/ShortestCommonSupersequenceWanted.lean:47
def ShortestCommonSupersequenceFeasible
(i : ShortestCommonSupersequenceInstance) : Prop :=
∃ super : List Bool, super.length ≤ i.2 ∧ ∀ s ∈ i.1, s.Sublist super
WantedExt/Complexity/NPComplete/ShortestCommonSupersequenceWanted.lean:50
Uses 11 · Used by 1
TheoremSHORTEST COMMON SUPERSEQUENCE is NP-complete#●ready to prove
The SHORTEST COMMON SUPERSEQUENCE decision problem over binary strings belongs to NP, and every decision problem in NP reduces to it by a polynomial-time many-one reduction.
public theorem_wanted shortestCommonSupersequence_npComplete :
shortestCommonSupersequenceDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L shortestCommonSupersequenceDec
noncomputable def shortestCommonSupersequenceDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := ShortestCommonSupersequenceInstance) x with
| some i => decide (ShortestCommonSupersequenceFeasible i)
| none => false
WantedExt/Complexity/NPComplete/ShortestCommonSupersequenceWanted.lean:56
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
- K.-J. Räihä and E. Ukkonen, "The shortest common supersequence problem over binary alphabet is NP-complete", Theoretical Computer Science 16 (1981), 187-198. (D. Maier, "The complexity of some problems on subsequences and supersequences", JACM 25 (1978), 322-336, proves SCS only for a five- symbol alphabet; the binary case is Räihä-Ukkonen.)
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.