Quadratic assignment problem
AbbreviationInstances of QUADRATIC ASSIGNMENT#✓fully proved
An instance of quadratic assignment is a tuple \((n, F, D, K)\) consisting of a natural number \(n\) (the size), a flow matrix \(F\) and a distance matrix \(D\), each given as a list of rows that are lists of natural numbers, and a natural number \(K\) (the cost bound).
DefinitionWell-formed quadratic assignment instances#✓fully proved
An instance \((n, F, D, K)\) of quadratic assignment is well formed when the flow matrix \(F\) and the distance matrix \(D\) each have exactly \(n\) rows and every row of each has length \(n\).
def WellFormed (i : QuadraticAssignmentInstance) : Prop :=
i.2.1.length = i.1 ∧ (∀ row ∈ i.2.1, row.length = i.1) ∧
i.2.2.1.length = i.1 ∧ ∀ row ∈ i.2.2.1, row.length = i.1
abbrev QuadraticAssignmentInstance := ℕ × List (List ℕ) × List (List ℕ) × ℕ
WantedExt/Complexity/NPComplete/QuadraticAssignmentWanted.lean:47
Uses 1 · Used by 1
DefinitionFeasible quadratic assignment instances#✓fully proved
An instance \((n, F, D, K)\) of quadratic assignment is feasible when there is a permutation \(\pi\) of the numbers \(0, \dots, n - 1\) such that
Here \(F_{a b}\) is entry \(b\) of row \(a\) of \(F\), and likewise for \(D\); an entry that is missing, because the matrix has too few rows or the row is too short, is read as \(0\).
def QuadraticAssignmentFeasible
(i : QuadraticAssignmentInstance) : Prop :=
∃ perm : List ℕ, perm.Perm (List.range i.1) ∧
(Finset.range i.1).sum (fun a => (Finset.range i.1).sum (fun b =>
(i.2.1.getD a []).getD b 0 *
(i.2.2.1.getD (perm.getD a 0) []).getD (perm.getD b 0) 0)) ≤ i.2.2.2
abbrev QuadraticAssignmentInstance := ℕ × List (List ℕ) × List (List ℕ) × ℕ
WantedExt/Complexity/NPComplete/QuadraticAssignmentWanted.lean:47
Uses 1 · Used by 1
DefinitionQUADRATIC ASSIGNMENT as a decision problem#✓fully proved
The decision problem QUADRATIC ASSIGNMENT accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding, to a quadratic assignment instance that is well formed and feasible; bitstrings that do not decode are rejected.
noncomputable def quadraticAssignmentDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := QuadraticAssignmentInstance) x with
| some i => decide (WellFormed i ∧ QuadraticAssignmentFeasible 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 QuadraticAssignmentInstance := ℕ × List (List ℕ) × List (List ℕ) × ℕ
WantedExt/Complexity/NPComplete/QuadraticAssignmentWanted.lean:47
def WellFormed (i : QuadraticAssignmentInstance) : Prop :=
i.2.1.length = i.1 ∧ (∀ row ∈ i.2.1, row.length = i.1) ∧
i.2.2.1.length = i.1 ∧ ∀ row ∈ i.2.2.1, row.length = i.1
WantedExt/Complexity/NPComplete/QuadraticAssignmentWanted.lean:50
def QuadraticAssignmentFeasible
(i : QuadraticAssignmentInstance) : Prop :=
∃ perm : List ℕ, perm.Perm (List.range i.1) ∧
(Finset.range i.1).sum (fun a => (Finset.range i.1).sum (fun b =>
(i.2.1.getD a []).getD b 0 *
(i.2.2.1.getD (perm.getD a 0) []).getD (perm.getD b 0) 0)) ≤ i.2.2.2
WantedExt/Complexity/NPComplete/QuadraticAssignmentWanted.lean:55
Uses 12 · Used by 1
TheoremQUADRATIC ASSIGNMENT is NP-complete#●ready to prove
The decision problem QUADRATIC ASSIGNMENT lies in NP, and every decision problem in NP reduces to it by a polynomial-time many-one reduction.
public theorem_wanted quadraticAssignment_npComplete :
quadraticAssignmentDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L quadraticAssignmentDec
noncomputable def quadraticAssignmentDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := QuadraticAssignmentInstance) x with
| some i => decide (WellFormed i ∧ QuadraticAssignmentFeasible i)
| none => false
WantedExt/Complexity/NPComplete/QuadraticAssignmentWanted.lean:64
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), QUADRATIC ASSIGNMENT PROBLEM; S. Sahni and T. Gonzalez, "P-complete approximation problems" (1976).
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.