🤖 AI Summary
This paper addresses the challenge of efficient traversal and composition of associative set data structures. We propose Index Stream Fusion: a technique that compiles set operations into stateless index stream sequences, enabling runtime fusion of multi-level joins and filters while eliminating intermediate set allocations and redundant traversals. Unlike prior approaches, our method requires no specialized compiler support or staged compilation, achieving high composability and performance competitive with hand-optimized code. We implement the technique across three languages—Lean (for mechanized verification of functional correctness), Morphic, and Rust—delivering a cross-language library. Empirical evaluation shows a 72% average reduction in memory overhead while preserving high performance. Moreover, we present the first formal verification of the core algorithm in Lean, significantly enhancing the reliability and expressive power of set operation libraries.
📝 Abstract
We present a system of efficient methods for traversing and combining associative collection data structures. A distinguishing feature of the system is that, like traditional sequential iterator libraries, it does not require specialized compiler infrastructure or staged compilation for efficiency and composability. By using a representation based on indexed streams, the library can express complex joins over input collections while using no intermediate allocations. We implement the library for the Lean, Morphic, and Rust programming languages and provide a mechanized proof of functional correctness in Lean.