Compositional width bounds for binary routines #
This module exposes pointwise width certificates for routine leaves,
sequential composition, fixed repetition, branches, and binary loops. Loop
certificates collapse the recursive maximum in binaryForSpace to four local
obligations, so the number of iterations does not appear additively in the
resulting auxiliary-space bound. A final polynomial width bound converts the
composed certificate to logarithmic space.
Updating one binary register preserves a common pointwise upper bound when both the old vector and the replacement value satisfy that bound.
A pointwise logarithmic envelope proves logarithmic routine space along a fixed input-indexed trajectory.
Strengthening a precondition preserves an asymptotic space certificate.
Sequential phases preserve logarithmic space when the second certificate is stated along the first phase's exact pure effect.
Both branches sharing one logarithmic envelope make a zero branch logarithmic, independently of which branch is selected at each input.
A logarithmic pointwise envelope for all reachable comparisons, iterations, and successors proves logarithmic space for a binary loop.
Enlarging the controlling value preserves a pointwise width certificate.
Strengthening a precondition preserves a pointwise width certificate.
Fixed-word emission has a pointwise width certificate for every input trajectory.
The routine identity has a pointwise width certificate.
Clearing a value bounded by the controlling width has a pointwise width certificate.
Successor on a value bounded by the controlling width has a pointwise width certificate.
Predecessor has a pointwise width certificate when its exact positive space argument is bounded by the controlling value.
Copying two width-bounded values has a pointwise width certificate.
Fixed addition has a pointwise width certificate when its result is bounded by the controlling value.
Setting a width-bounded value to another width-bounded value has a pointwise width certificate.
Preserved-source addition has a pointwise width certificate when its source and result are bounded by the controlling value.
Multiply-add has a pointwise width certificate when both factors and the largest addition intermediate are width-bounded.
Fixed-polynomial evaluation has a pointwise width certificate when its explicit Horner-prefix cap is width-bounded.
Natural-code emission of a width-bounded value has a pointwise width certificate.
Raw-gate emission from two width-bounded references has a pointwise width certificate.
Emitting and advancing one gate from width-bounded references and a width-bounded frontier has a pointwise width certificate.
Sequential pointwise width certificates compose along the first phase's exact pure effect.
A list of pointwise width certificates composes along its exact pure prefix effects.
Width certificates for two routine lists compose when the second list is certified along the first list's exact pure effect.
Fixed repetition has a pointwise width certificate when one invariant both supplies the body certificate and is preserved by its pure effect.
Pointwise width certificates for both branches certify a zero branch.
A polynomial upper bound on the controlling value turns a pointwise width certificate into logarithmic space.
Fixed-word emission preserves logarithmic incoming space.
The routine identity preserves logarithmic incoming space.
A pointwise loop envelope of the standard width-controlled form certifies the complete binary loop without exposing its recursive maximum.
A width certificate over the canonical paired-and-clamped body trajectory lifts to the complete binary loop. The limit and every reachable counter value must fit the same width; the resulting constant is uniform in both the input index and the loop iteration.
A pointwise envelope bounds the recursive maximum over all reachable iterations.
A pointwise envelope bounds the complete comparison-plus-iteration space formula of a binary count-up loop.
A pointwise envelope directly bounds the advertised space budget of the corresponding proof-carrying binary loop.