We propose a rich foundational theory of typed data streams and stream transformers, motivated by two high-level goals: (1) the type of a stream should be able to express complex sequential patterns of events over time, and (2) it should describe the parallel structure of the stream to enable deterministic stream processing on parallel and distributed systems. To this end, we introduce stream types, with operators capturing sequential composition, parallel composition, and iteration, plus a core calculus of transformers over typed streams which naturally supports a number of common streaming idioms, including punctuation, windowing, and parallel partitioning, as first-class constructions. The calculus exploits a Curry-Howard-like correspondence with an ordered variant of the logic of Bunched Implication to program with streams compositionally and uses Brzozowski-style derivatives to enable an incremental, event-based operational semantics. To validate our design, we provide a reference interpreter and machine-checked proofs of the main results.
翻译:暂无翻译