Fixed-Parameter Computations Compose

Lax496464.WH_A4_MachineFacts · concepts/Lax496464/WH_A4_MachineFacts.lean · lax-496464

proven

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

    Theorem

    The identity is computable in fixed-parameter time, and fixed-parameter computations compose: if FF is computable in time f(κ(x))⋅∣x∣O(1)f(\kappa(x))\cdot|x|^{O(1)} on DD, maps DD into EE and increases the parameter by at most a computable function, and GG is computable in time f′(κ′(y))⋅∣y∣O(1)f'(\kappa'(y))\cdot|y|^{O(1)} on EE, then G∘FG \circ F is computable in time f′′(κ(x))⋅∣x∣O(1)f''(\kappa(x))\cdot|x|^{O(1)} on DD for a computable f′′f''. Restricting the set of inputs, or changing the function outside it, preserves the bound.

    Two facts about the input size, from which running-time bounds are usually derived, complete the list: a word has at most as many entries as bits, and each entry is below 2∣x∣2^{|x|}.

    These are the only facts about programs that the calculus of reductions (WHA3ReductionCalculusWH_A3_ReductionCalculus) uses.

    Concept map
    5 concepts
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A
    Evidence

    Lean source view on GitHub

    1import Lax496464.WH_A1_FptTime
    2
    3/-!
    4---
    5title: Fixed-Parameter Computations Compose
    6type: theorem
    7---
    8The identity is computable in fixed-parameter time, and fixed-parameter computations compose: if
    9FF is computable in time f(κ(x))⋅∣x∣O(1)f(\kappa(x))\cdot|x|^{O(1)} on DD, maps DD into EE and increases the
    10parameter by at most a computable function, and GG is computable in time
    11f′(κ′(y))⋅∣y∣O(1)f'(\kappa'(y))\cdot|y|^{O(1)} on EE, then G∘FG \circ F is computable in time
    12f′′(κ(x))⋅∣x∣O(1)f''(\kappa(x))\cdot|x|^{O(1)} on DD for a computable f′′f''. Restricting the set of inputs, or
    13changing the function outside it, preserves the bound.
    14
    15Two facts about the input size, from which running-time bounds are usually derived, complete the
    16list: a word has at most as many entries as bits, and each entry is below 2∣x∣2^{|x|}.
    17
    18These are the only facts about programs that the calculus of reductions (`WH_A3_ReductionCalculus`)
    19uses.
    20
    21# Formalization Notes
    22
    23The composite runs the first program, keeps its output in memory, and runs the second program on
    24it. The output of the first program has at most B1=f(κ(x))(∣x∣+1)dB_1 = f(\kappa(x))(|x|+1)^d entries of at most
    25B1B_1 bits each, so its bit size is at most B1(B1+1)B_1(B_1+1), and the second program runs within
    26f′(κ′(Fx)) (B1(B1+1)+1)d′f'(\kappa'(F x))\,(B_1(B_1+1)+1)^{d'} steps. Since κ′(Fx)≤g(κ(x))\kappa'(F x) \le g(\kappa(x)) and f′f' may be
    27replaced by the computable nondecreasing function m↦∑i≤mf′(i)m \mapsto \sum_{i\le m} f'(i), this is again a
    28bound f′′(κ(x)) (∣x∣+1)d′′f''(\kappa(x))\,(|x|+1)^{d''} with f′′f'' computable.
    29-/
    30
    31namespace Lax496464.WH_A4_MachineFacts
    32
    33open Lax496464.WH_A1_FptTime Lax759944.BinaryWordEncoding
    34
    35/-- The identity is computable in fixed-parameter time (indeed in linear time). -/
    36axiom fptTimeOn_id (D : Set (List ℕ)) (κ : List ℕ → ℕ) : FptTimeOn D κ fun x => x
    37
    38/-- **Composition.** A fixed-parameter computation followed by one on its outputs, whose parameter
    39is bounded by a computable function of the first parameter, is a fixed-parameter computation. -/
    40axiom fptTimeOn_comp {D E : Set (List ℕ)} {κ κ' : List ℕ → ℕ} {F G : List ℕ → List ℕ}
    41 {g : ℕ → ℕ} (hF : FptTimeOn D κ F) (hmaps : ∀ x ∈ D, F x ∈ E) (hg : Computable g)
    42 (hκ : ∀ x ∈ D, κ' (F x) ≤ g (κ x)) (hG : FptTimeOn E κ' G) :
    43 FptTimeOn D κ fun x => G (F x)
    44
    45/-- A bound on a set of inputs holds on every subset. -/
    46axiom fptTimeOn_mono {D D' : Set (List ℕ)} {κ : List ℕ → ℕ} {F : List ℕ → List ℕ} :
    47 D' ⊆ D → FptTimeOn D κ F → FptTimeOn D' κ F
    48
    49/-- Only the values on the inputs of `D` matter. -/
    50axiom fptTimeOn_congr {D : Set (List ℕ)} {κ : List ℕ → ℕ} {F G : List ℕ → List ℕ} :
    51 (∀ x ∈ D, F x = G x) → FptTimeOn D κ F → FptTimeOn D κ G
    52
    53/-- Polynomial time is fixed-parameter time, for every parameter. -/
    54axiom fptTimeOn_of_polyTimeOn {D : Set (List ℕ)} {F : List ℕ → List ℕ} (κ : List ℕ → ℕ) :
    55 PolyTimeOn D F → FptTimeOn D κ F
    56
    57/-- A word has at most as many entries as bits: each entry costs at least its separator. -/
    58axiom length_le_bitSize (x : List ℕ) : x.length ≤ bitSize x
    59
    60/-- Every entry of a word is smaller than `2` to the bit size of the word. -/
    61axiom lt_two_pow_bitSize {x : List ℕ} {v : ℕ} : v ∈ x → v < 2 ^ bitSize x
    62
    63end Lax496464.WH_A4_MachineFacts
    64
    Show ProofShow ProofShow ProofShow ProofShow ProofShow ProofShow Proof
    Formalization Notes

    The composite runs the first program, keeps its output in memory, and runs the second program on it. The output of the first program has at most B1=f(κ(x))(∣x∣+1)dB_1 = f(\kappa(x))(|x|+1)^d entries of at most B1B_1 bits each, so its bit size is at most B1(B1+1)B_1(B_1+1), and the second program runs within f′(κ′(Fx)) (B1(B1+1)+1)d′f'(\kappa'(F x))\,(B_1(B_1+1)+1)^{d'} steps. Since κ′(Fx)≤g(κ(x))\kappa'(F x) \le g(\kappa(x)) and f′f' may be replaced by the computable nondecreasing function m↦∑i≤mf′(i)m \mapsto \sum_{i\le m} f'(i), this is again a bound f′′(κ(x)) (∣x∣+1)d′′f''(\kappa(x))\,(|x|+1)^{d''} with f′′f'' computable.

    Builds on
    Used by

    none

    From Mathlib

    none

    Discussion

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

    Loading discussion…