Draft — mutable and not usable as a dependency; its citation marks the draft state.

Lax678846.NondeterministicPolynomialTime

NP through polynomially bounded certificates

concepts/Lax678846/NondeterministicPolynomialTime.lean · lax-678846

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.

    Concept map

    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Definition

    A bit-string language belongs to NP if membership is equivalent to the existence of a certificate of polynomially bounded length accepted by a deterministic polynomial-time verifier. This is the usual certificate definition of NP. The verifier is a concrete finite multi-stack Turing machine in mathlib, with its machine-step polynomial bound.

    The verifier reads a pair of bit strings: the input and the certificate. Each input bit is preceded by a one-bit; a zero-bit terminates the input, and the remaining bits form the certificate. This uniquely decodable pair encoding has length twice the input length plus the certificate length plus one. Runtime is polynomial in this total length; certificate length is bounded by a polynomial in the original input length.

    A property belongs to NP when its language of structure encodings does. The language excludes malformed encodings. No logical definability or simulation theorem occurs in this definition.

    Lean source view on GitHub

    1import Lax678846.FiniteStructures
    2import Mathlib.Computability.TuringMachine.Computable
    3
    4/-!
    5---
    6title: NP through polynomially bounded certificates
    7type: definition
    8---
    9A bit-string language belongs to NP if membership is equivalent to the
    10existence of a certificate of polynomially bounded length accepted by a
    11deterministic polynomial-time verifier. This is the usual certificate
    12definition of NP. The verifier is a concrete finite multi-stack Turing
    13machine in mathlib, with its machine-step polynomial bound.
    14
    15The verifier reads a pair of bit strings: the input and the certificate.
    16Each input bit is preceded by a one-bit; a zero-bit terminates the input,
    17and the remaining bits form the certificate. This uniquely decodable
    18pair encoding has length twice the input length plus the certificate
    19length plus one. Runtime is polynomial in this total length; certificate
    20length is bounded by a polynomial in the original input length.
    21
    22A property belongs to NP when its language of structure encodings does.
    23The language excludes malformed encodings. No logical definability or
    24simulation theorem occurs in this definition.
    25-/
    26
    27namespace Lax678846.NondeterministicPolynomialTime
    28
    29open Lax678846.FiniteStructures
    30
    31def encodePair (p : List Bool × List Bool) : List Bool :=
    32 p.1.flatMap (fun b => [true, b]) ++ false :: p.2
    33
    34def LanguageInNP (L : List Bool → Prop) : Prop :=
    35 ∃ (V : List Bool × List Bool → Bool) (p : Polynomial Nat),
    36 Nonempty (Turing.TM2ComputableInPolyTime encodePair (fun b => [b]) V) ∧
    37 ∀ w, L w ↔ ∃ c : List Bool, c.length ≤ p.eval w.length ∧ V (w, c) = true
    38
    39def InNP {σ : Vocabulary} (Q : Property σ) : Prop :=
    40 LanguageInNP (language Q)
    41
    42end Lax678846.NondeterministicPolynomialTime
    43

    Community review

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above; your ORCID profile must share a public name.

    0 comments

    Loading discussion…