The complexity class P

Lax434930.PolynomialTime · concepts/Lax434930/PolynomialTime.lean · lax-434930

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 language of finite binary strings belongs to P\mathrm{P} if a deterministic Turing machine decides membership in that language in polynomial time. Precisely, there are a single machine and a polynomial p∈N[X]p \in \mathbb{N}[X] such that, on every input ww, the machine halts within p(∣w∣)p(|w|) steps and returns the bit 11 if ww belongs to the language and 00 otherwise.

    The definition uses mathlib's deterministic stack machines, the identity encoding of binary strings, and a singleton Boolean output. Time counts transitions of fixed finite instruction blocks. We also prove equivalence with elementary single-tape machines.

    Concept map
    1 concept
    100%
    DefinitionThis conceptDescendants are omitted for concepts with more than 10 descendants.

    In the paper

    • page 1 of this submission's paper

    Lean source view on GitHub

    1import Mathlib.Computability.TuringMachine.Computable
    2
    3/-!
    4---
    5title: The complexity class P
    6type: definition
    7---
    8A language of finite binary strings belongs to P\mathrm{P} if a deterministic
    9Turing machine decides membership in that language in polynomial time.
    10Precisely, there are a single machine and a polynomial p∈N[X]p \in \mathbb{N}[X]
    11such that, on every input ww, the machine halts within p(∣w∣)p(|w|) steps and
    12returns the bit 11 if ww belongs to the language and 00 otherwise.
    13
    14The definition uses mathlib's deterministic stack machines, the identity
    15encoding of binary strings, and a singleton Boolean output. Time counts
    16transitions of fixed finite instruction blocks. We also prove equivalence
    17with elementary single-tape machines.
    18-/
    19
    20namespace Lax434930.PolynomialTime
    21
    22/-- A finite binary string. -/
    23abbrev Word := List Bool
    24
    25/-- A language of finite binary strings. -/
    26abbrev Language := Set Word
    27
    28/-- Languages whose Boolean characteristic functions are computable in polynomial time. -/
    29def P : Set Language :=
    30 {L | ∃ f : Word → Bool,
    31 (∀ w, f w = true ↔ w ∈ L) ∧
    32 Nonempty (Turing.TM2ComputableInPolyTime id Computability.encodeBool f)}
    33
    34end Lax434930.PolynomialTime
    35

    Discussion

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

    Loading discussion…