Polynomial-time loops — proof internals #
The helper facts behind Complexitylib.Classes.P.Iterate. The two machines are
Cobham's: Cobham.iterate_mem_FP runs a step under a width clamp, and
Cobham.recFoldClamp_mem_FP runs a fold with every intermediate value truncated.
What is proved here is that the clamps never fire under the hypotheses the
surface statements ask for, and how to feed a fold with an arbitrary workspace
and an arbitrary string to fold over.
Contents #
iterate_length_le_of_step_le— per-step growth adds up along an orbitrecFoldClamp_eq_of_eqns— a clamped fold computes any function obeying the fold's equations, as long as that function's values on the suffixes fitfoldUnpack— the step argument the fold hands over, with a workspace that also carries the input, rewritten to the workspace the caller asked forrecFold_mem_FP_of_bound_internal— the fold with a polynomially short state
Iterating a step that grows by a bounded amount #
If each of the first N steps adds at most c bits, then after m ≤ N steps
the state is at most c * m bits longer than the start.
Folds whose values stay short #
A clamped fold computes its specification. If f obeys the equations of
the fold of A (on a false bit) and B (on a true bit) from e with
workspace W, and f is at most bound bits long on every suffix of s, then
the fold clamped to bound bits computes f s: the truncation never fires.
The fold of recFold_mem_FP_of_bound_internal runs with the workspace
pair W z, so that the start can read the input z. Each step first rewrites
its argument pair (pair (pair W z) acc) t to pair (pair W acc) t, the argument
the caller's step expects.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A fold with a polynomially short state is polynomial-time. The value is
Cobham's clamped fold, run on pair (pair (w z) z) (s z) with the steps
precomposed with foldUnpack and a clamp polynomial in the length of that
argument. The clamp never fires (recFoldClamp_eq_of_eqns), because the length
of the argument is at least |z|.