Documentation

Complexity.Algorithms.WordRAM.ThreeSum.Frontend.Bounds

Derived native frontend word width and charged cost #

The physical unsigned width is four times the existing complete parameter width. This coarse positive logarithmic threshold covers all descriptor/payload addresses and native intermediates. The bit budget passed to radix is the explicit magnitude-derived label count, never physical width.

Main definitions #

Layout computed from the actual unsigned input-length header and polynomial promise.

Instances For

    Physical unsigned width, including the two bits reserved when composing signed kernels.

    Instances For

      Concrete charged instruction bound, including the final halt.

      Instances For

        The width coefficient is positive, including exponent zero and empty input.

        theorem Cslib.Algorithms.WordRAM.ThreeSum.Frontend.width_eq (κ n : ℕ) :
        width κ n = (80 * κ + 484) * Nat.clog 2 (n + 2)

        The physical width is explicitly Cκ * clog₂(n+2) with a positive coefficient.

        All frontend arithmetic is bounded by the fourth power of the existing parameter budget.

        The derived physical width discharges the complete native frontend budget.

        theorem Cslib.Algorithms.WordRAM.ThreeSum.Frontend.input_fits {κ w : ℕ} (input : List ℤ) (hw : width κ input.length ≤ w) (hvalues : ∀ z ∈ input, |z| ≤ ↑((input.length + 2) ^ κ)) :

        Input/header fitting follows from the same global magnitude and width promises.

        The lower-level radix bit bound includes the largest signed key, even when κ=0.

        The explicit radix bit count has a logarithmic bound independent of admitted physical width.

        The entire allocated region and arithmetic budget are polynomial in actual input length.

        theorem Cslib.Algorithms.WordRAM.ThreeSum.Frontend.signed_output_fits {κ n w : ℕ} (hw : width κ n ≤ w) {z : ℤ} (hz : |z| ≤ ↑(2 * (n + 2) ^ κ)) :

        Every compact output integer fits the parent's signed kernel width physicalWidth-2. Thus the parent's native signed arithmetic compiler runs at exactly the physical width here.

        theorem Cslib.Algorithms.WordRAM.ThreeSum.Frontend.two_pow_width_le (κ n : ℕ) :
        2 ^ width κ n ≤ (n + 2) ^ (160 * κ + 968)

        A word at the canonical physical width has polynomial magnitude.