Introduction
Program synthesis—the automated creation of code from specifications—often fails to scale because it attempts to reason about an entire system at once. This paper introduces Modular System Synthesis (MOSS), a framework that applies the software engineering principle of "information hiding" to synthesis. By breaking a system into layers and using implementation-agnostic specifications to bridge them, MOSS enables the synthesis of large, complex programs that were previously unreachable for automated tools.
The Challenge: Search Space Explosion
The primary obstacle in program synthesis is the "search space explosion." Most modern synthesis tools require a concrete implementation of every component a program uses. For instance, when synthesizing a high-level application that utilizes a Queue, which in turn relies on a Stack, the synthesizer typically must reason about low-level details like linked-list pointers at the bottom of the stack to understand the application's behavior at the top.
As systems grow in complexity, this "monolithic" reasoning becomes computationally intractable. MOSS addresses this by mirroring human software design: modularity. A programmer using a Queue only needs to understand its logical behavior (e.g., "first-in, first-out") rather than its internal implementation. The challenge lies in automating this "information hiding" so synthesizers can work on individual modules without sacrificing correctness.
Methodology: The MOSS Framework
The authors propose a two-step "bottom-up" synthesis process implemented in a tool called MOSSKIT. This process creates a "sandwich" effect where each module is synthesized using only the behavioral interface of the layer below it.
- Module-Implementation Synthesis: Given an implementation-agnostic specification of a lower layer (Layer $i-1$), the tool synthesizes the code for the current layer (Layer $i$). It utilizes JLIBSKETCH, which fills in "holes" in a program sketch to satisfy algebraic assertions.
- Module-Specification Synthesis: Once the code for Layer $i$ is synthesized, the tool uses SPYRO to automatically generate a new implementation-agnostic specification for that layer. These specifications, often algebraic rewrite rules (e.g.,
pop(push(s, x)) = s), are then passed up to Layer $i+1$.
Evaluation and Key Results
The researchers evaluated MOSS using several benchmarks, including a deep three-layer TicketVendor system, standard data structure benchmarks (e.g., ArrayList, HashMap), and a simplified Kafka-style message broker backend.
Scalability and Performance
Monolithic synthesis crashed when attempting to synthesize the full TicketVendor system. In contrast, MOSS successfully synthesized the entire stack by modularizing the problem. Synthesizing the Queue module using the Stack's specification took 188 seconds, whereas using the Stack's concrete code took 799 seconds, demonstrating a significant performance gain through abstraction.
Modular Independence
A key strength of MOSS is the independence of layers. The authors demonstrated that they could swap a Queue implementation (e.g., from a two-stack version to a linked-list version) without needing to re-synthesize the higher-level TicketVendor module. This confirms the effectiveness of the implementation-agnostic boundary.
Key Insights
- Modularity as Search Pruning: Information hiding is a powerful tool for pruning the synthesizer's search space. By hiding the "how" and only showing the "what," the synthesizer avoids exploring irrelevant low-level states.
- Bug Discovery: The automated process identified bugs in manually written specifications and "mock" implementations from previous peer-reviewed work. The synthesizer's exhaustive nature caught edge cases, such as hash collisions, that human programmers had overlooked.
Limitations and Future Work
While effective, MOSSKIT relies on the SKETCH solver, which provides bounded soundness rather than a formal proof for all possible inputs. Additionally, the specification synthesis step is sensitive to the user-provided "grammar" of properties. Future work includes integrating MOSS with full-verification tools like Dafny and handling more complex, mutually recursive module hierarchies beyond simple directed acyclic graphs.
Summary updated