Documentation

CslibFrontier.Computability.Complexity.Classes.NP.Relation

NP relations #

An NP relation is a search problem whose solutions are checked in polynomial time: Goldreich's class PC Goldreich, Definition 2.3. Here it is presented, like NP itself (Cslib.Complexity.NP), by a certificate-length polynomial p and a verifier V computable in polynomial time: w is a witness for a when w has length exactly p (enc a).length and V (a, w) holds (Cslib.Complexity.NPRelation.IsWitness). Exact certificate lengths are the convention of Cslib.Complexity.IsVerifier; Goldreich only bounds the length of a solution.

An NP relation is a problem in NP together with a chosen verifier: its language, the instances that have a witness, satisfies IsVerifier by definition (Cslib.Complexity.NPRelation.isVerifier_language), and every problem in NP is the language of some NP relation (Cslib.Complexity.mem_NP_iff_exists_npRelation). Witness-preserving (Levin) reductions are defined between NP relations in CslibFrontier.Computability.Complexity.Reduction.Levin.

Main definitions #

Main results #

References #

structure Cslib.Complexity.NPRelation {α : Type} (enc : α ↪ List Bool) :

An NP relation over instances encoded by enc: a polynomial giving the length of certificates as a function of the length of the encoded instance, and a verifier computable in polynomial time on encoded instance–certificate pairs. This is Goldreich's class PC Goldreich, Definition 2.3 with certificates of exactly the prescribed length.

def Cslib.Complexity.NPRelation.IsWitness {α : Type} {enc : α ↪ List Bool} (R : NPRelation enc) (a : α) (w : List Bool) :

w is a witness for a: it has the prescribed length and the verifier accepts it.

Instances For
    @[instance_reducible]
    instance Cslib.Complexity.NPRelation.instDecidableIsWitness {α : Type} {enc : α ↪ List Bool} (R : NPRelation enc) (a : α) (w : List Bool) :
    theorem Cslib.Complexity.NPRelation.IsWitness.length_eq {α : Type} {enc : α ↪ List Bool} {R : NPRelation enc} {a : α} {w : List Bool} (h : R.IsWitness a w) :
    theorem Cslib.Complexity.NPRelation.IsWitness.verifier_eq_true {α : Type} {enc : α ↪ List Bool} {R : NPRelation enc} {a : α} {w : List Bool} (h : R.IsWitness a w) :

    The language of an NP relation: the instances that have a witness.

    theorem Cslib.Complexity.NPRelation.mem_language {α : Type} {enc : α ↪ List Bool} (R : NPRelation enc) {a : α} :
    a ∈ R.language ↔ ∃ (w : List Bool), R.IsWitness a w

    The verifier of an NP relation verifies its language.

    If the verifier of an NP relation verifies A, then A is its language.

    The language of an NP relation is in NP.

    theorem Cslib.Complexity.mem_NP_iff_exists_npRelation {α : Type} {enc : α ↪ List Bool} {A : Set α} :
    A ∈ NP enc ↔ ∃ (R : NPRelation enc), R.language = A

    The problems in NP are exactly the languages of NP relations.