Documentation

Complexitylib.Classes.P.Cobham.Defs

Cobham's characterization of FP — definitions #

This file defines Cobham's machine-independent characterization of the polynomial-time computable functions on bitstrings (Cobham, The intrinsic computational difficulty of functions, 1965): the smallest class of functions (Fin n → List Bool) → List Bool containing the projections, the empty string, the two bit successors, and the smash function, and closed under composition and limited recursion on notation.

Bitstrings are LSB-first: in the recursion on notation, the head of the list is the least-significant (innermost) bit, so the bit successors prepend a bit (x ↦ b :: x, the string analogue of n ↦ 2·n + bit), and recursion on notation peels bits off the head.

The functions are multi-arity (indexed by Fin n argument vectors) because limited recursion on notation inherently produces functions of higher arity; the unary fragment is collected in CobhamFP, which Complexitylib.Classes.P.Cobham proves equal to the machine class FP.

Main definitions #

Design notes #

The bound in Cobham.boundedRec follows Cobham's original formulation: the recursively defined function must be length-bounded by another function of the class (rather than by an external polynomial). Together with smash and the successors this realizes exactly the polynomial length bounds, which is what makes the class no larger than FP; dropping the bound would admit iterated doubling and hence exponential growth.

The string toolkit the proof is written in — bit dispatch, flags, fixed-width blocks — is not part of this statement and lives in Complexitylib.Classes.P.Cobham.Internal.Blocks.

Cobham's smash function in the binary-word presentation: smash x y = 1^(|x| · |y|). This is the length-arithmetic engine of the class: composing smash with the bit successors and projections realizes every polynomial length bound, which is what lets Cobham.boundedRec bound recursions by a function of the class itself.

This all-one word is the customary string analogue of Cobham's original number-theoretic smash x # y = 2^(|x|·|y|).

Equations
Instances For
    @[simp]
    def Complexity.recNotation {n : } (g : (Fin nList Bool)List Bool) (h₀ h₁ : (Fin (n + 2)List Bool)List Bool) :
    List Bool(Fin nList Bool)List Bool

    Recursion on notation: the string analogue of primitive recursion, recursing on the bit structure of the first argument.

    recNotation g h₀ h₁ x v computes g v when x is empty, and on b :: x applies the step function selected by the bit b to the argument vector consisting of the tail x, the recursive value on the tail, and the parameters v.

    Equations
    Instances For
      @[simp]
      theorem Complexity.recNotation_nil {n : } (g : (Fin nList Bool)List Bool) (h₀ h₁ : (Fin (n + 2)List Bool)List Bool) (v : Fin nList Bool) :
      recNotation g h₀ h₁ [] v = g v
      @[simp]
      theorem Complexity.recNotation_cons {n : } (g : (Fin nList Bool)List Bool) (h₀ h₁ : (Fin (n + 2)List Bool)List Bool) (b : Bool) (x : List Bool) (v : Fin nList Bool) :
      recNotation g h₀ h₁ (b :: x) v = (bif b then h₁ else h₀) (Fin.cons x (Fin.cons (recNotation g h₀ h₁ x v) v))
      inductive Complexity.Cobham {n : } :
      ((Fin nList Bool)List Bool)Prop

      Cobham's function algebra: the smallest class of bitstring functions containing the projections, the empty string, the bit successors x ↦ b :: x, and smash, and closed under composition and limited recursion on notation.

      In boundedRec, the recursion is limited: the result must be length-bounded, uniformly in the arguments, by a function j already in the class. This is the polynomial-growth leash that pins the class to exactly FP (see Complexitylib.Classes.P.Cobham).

      Instances For

        The unary fragment of Cobham's function algebra, as a class of string functions. Complexitylib.Classes.P.Cobham proves CobhamFP = FP: this machine-independent algebra carves out exactly the polynomial-time computable functions.

        Equations
        Instances For