Complexity classes, cofinal hardness, and NP

Lax904597.Classes · concepts/Lax904597/Classes.lean · lax-904597

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    A complexity class is given by a membership predicate and a hardness predicate on decision problems over arbitrary relational vocabularies. The classes of this development are built from their membership predicate alone, with hardness read cofinally: a problem PP is hard when every member of the class reduces, by a relativized ordered first-order reduction, to every problem that PP itself reduces to. This is equivalent to the usual “every member reduces to PP” (stated in NP is a complexity class), and is the form the library this submission comes from uses. A problem is complete for a class when it belongs to it and is hard for it.

    NP is the class whose members are the Σ1\Sigma_1-definable problems, by Fagin's theorem; more generally the level Σk+1\Sigma_{k+1} of the polynomial hierarchy has the Σk+1\Sigma_{k+1}-definable problems as members. The library this submission comes from makes closure under first-order reductions part of the definition of a class; that NP is closed is stated separately, in NP is a complexity class.

    Concept map
    5 concepts; 3 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Lax904597.Problems
    2import Lax904597.Interpretations
    3import Lax904597.Relativized
    4import Lax904597.SecondOrder
    5
    6/-!
    7---
    8title: Complexity classes, cofinal hardness, and NP
    9type: definition
    10---
    11A complexity class is given by a membership predicate and a hardness
    12predicate on decision problems over arbitrary relational vocabularies. The
    13classes of this development are built from their membership predicate
    14alone, with hardness read *cofinally*: a problem PP is hard when every
    15member of the class reduces, by a relativized ordered first-order reduction,
    16to every problem that PP itself reduces to. This is equivalent to the
    17usual “every member reduces to PP” (stated in *NP is a complexity
    18class*), and is the form the library this submission comes from uses. A
    19problem is complete for a class when it belongs to it and is hard for it.
    20
    21NP is the class whose members are the Σ1\Sigma_1-definable problems, by
    22Fagin's theorem; more generally the level Σk+1\Sigma_{k+1} of the polynomial
    23hierarchy has the Σk+1\Sigma_{k+1}-definable problems as members. The
    24library this submission comes from makes closure under first-order
    25reductions part of the definition of a class; that NP is closed is stated
    26separately, in *NP is a complexity class*.
    27-/
    28
    29namespace Lax904597.Classes
    30
    31open FirstOrder FirstOrder.Language
    32open Lax904597.Problems Lax904597.Interpretations Lax904597.Relativized Lax904597.SecondOrder
    33
    34/-- A complexity class: a membership predicate and a hardness predicate on
    35decision problems, over arbitrary relational vocabularies. -/
    36structure ComplexityClass where
    37 /-- The problems belonging to the class. -/
    38 Mem : ∀ {L : Language.{0, 0}} [L.IsRelational], DecisionProblem L → Prop
    39 /-- The problems every problem of the class reduces to. -/
    40 Hard : ∀ {L : Language.{0, 0}} [L.IsRelational], DecisionProblem L → Prop
    41
    42variable {L : Language.{0, 0}} [L.IsRelational]
    43
    44/-- Cofinal hardness for a collection of problems: every problem of the
    45collection reduces to every relational problem that `P` reduces to. -/
    46def CofinalHard (Mem : ∀ {L₀ : Language.{0, 0}} [L₀.IsRelational], DecisionProblem L₀ → Prop)
    47 (P : DecisionProblem L) : Prop :=
    48 ∀ {L' : Language.{0, 0}} [L'.IsRelational] (S : DecisionProblem L'),
    49 Nonempty (RelOrderedFOReduction P S) →
    50 ∀ {L'' : Language.{0, 0}} [L''.IsRelational] (Q : DecisionProblem L''),
    51 Mem Q → Nonempty (RelOrderedFOReduction Q S)
    52
    53/-- The class with the given membership and cofinal hardness. -/
    54def ComplexityClass.ofMem
    55 (Mem : ∀ {L₀ : Language.{0, 0}} [L₀.IsRelational], DecisionProblem L₀ → Prop) :
    56 ComplexityClass where
    57 Mem P := Mem P
    58 Hard P := CofinalHard Mem P
    59
    60/-- A problem is complete for a class if it belongs to it and is hard for
    61it. -/
    62def ComplexityClass.Complete (C : ComplexityClass) (P : DecisionProblem L) : Prop :=
    63 C.Mem P ∧ C.Hard P
    64
    65/-- The level `Σₖ₊₁ᵖ` of the polynomial hierarchy: the problems definable with
    66`k + 1` alternating blocks of second-order quantifiers, existential first. -/
    67def sigmaLevel (k : ℕ) : ComplexityClass :=
    68 .ofMem fun P => SigmaSODefinable (k + 1) P
    69
    70/-- NP is `Σ₁ᵖ`: by definition, the existential-second-order definable
    71problems (Fagin's theorem). -/
    72def NP : ComplexityClass := sigmaLevel 0
    73
    74end Lax904597.Classes
    75

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…