Streaming reductions with committed, write-only output
DefinitionStreamReductionResidualRankcomplexity-theoryformal-verification
A deterministic transducer reads one input symbol at a time, updates its state, and emits a finite output block. Output blocks concatenate, and a final block can depend on the last state.
Definition code
import Mathlib
set_option autoImplicit false
namespace PvsNP.StreamReductionRank
universe u v w x y
structure Transducer (A : Type u) (B : Type v) (S : Type w) where
init : S
step : S → A → S × List B
finish : S → List B
variable {A : Type u} {B : Type v} {S : Type w}
def Transducer.run (R : Transducer A B S) : S → List A → S × List B
| q, [] => (q, [])
| q, a :: xs =>
let first := R.step q a
let rest := R.run first.1 xs
(rest.1, first.2 ++ rest.2)
def Transducer.output (R : Transducer A B S) (xs : List A) : List B :=
let reached := R.run R.init xs
reached.2 ++ R.finish reached.1
end PvsNP.StreamReductionRank
Source
Basic operational semantics of a one-way streaming reduction.