Streaming fold combinator for paired framed lists #
Provides Turing.MultiTapeTM.ComputableInTimeAndSpace.streamFold_pair_list, a quantitative
single-pass streaming fold wrapper over (init x, elems x) with polynomial-time callbacks and a
uniform encoded state/element size bound. Placed in its own module rather than
Complexity.Streaming to avoid triggering rebuilds across unrelated importers of Streaming.
theorem Turing.MultiTapeTM.ComputableInTimeAndSpace.streamFold_pair_list {α σ β γ : Type} {encA : α ↪ List Bool} {encS : σ ↪ List Bool} {encB : β ↪ List Bool} {encIn : γ ↪ List Bool} (init : γ → σ) (elems : γ → List α) (hL : ∀ (x : γ), encIn x = (encPair encS (encList encA)) (init x, elems x)) {next : σ × α → σ} {emit : σ × α → List β} {g : γ → List β} (hnext : ComputableInPolyTime next (encPair encS encA) encS) (hemit : ComputableInPolyTime emit (encPair encS encA) (encList encB)) (hg : ∀ (x : γ), (encList encB) (g x) = streamEmit next (fun (p : σ × α) => (encList encB) (emit p)) (init x) (elems x)) {lMax : γ → ℕ} (hS : ∀ (x : γ), ∀ j ≤ (elems x).length, (encS (streamState (init x) next (elems x) j)).length ≤ lMax x) (hA : ∀ (x : γ) (j : ℕ) (hj : j < (elems x).length), (encA (elems x)[j]).length ≤ lMax x) :
Single-pass streaming fold over a framed pair-encoded list (init x, elems x) with
polynomial-time step/emit callbacks and uniform encoded state/element size bound lMax x.