Introduction
Verifying the safety of complex cyber-physical systems (CPS)—such as autonomous vehicles, medical devices, or high-speed rail—presents a significant challenge in formal methods. These systems integrate discrete software control with continuous physical dynamics, often resulting in "monolithic" models that are too large and mathematically complex for existing automated theorem provers to handle efficiently. While modularity is a cornerstone of traditional software engineering, applying it to hybrid systems is difficult because physical processes do not respect component boundaries; time progresses uniformly across the system, and continuous states are often interdependent. This paper proposes a framework for Tactical Contract Composition, enabling the decomposition of global safety properties into local, manageable component proofs.
Component-Based Modeling and Contracts
The core of the proposed approach is the formalization of components and their interactions through an interface-based model. Each component is treated as a "behavior model" wrapped in an "interaction model" or interface.
As shown in Figure 1, a component interacts with its environment via input ports ($In_i$) and output ports ($Out_j$). These ports are governed by contracts:
- Input Assumptions ($\pi^{in}$): The conditions the component requires from its environment to function safely.
- Output Guarantees ($\pi^{out}$): The promises the component makes regarding its behavior, provided its assumptions are met.
A key innovation in this framework is the support for change and rate contracts. Instead of merely specifying static value bounds, these contracts describe how variables evolve over time (e.g., "the velocity will not increase by more than $5 m/s$ over a $1s$ interval"). This allows components to abstract the continuous-time behavior of their neighbors into discrete-time observations, significantly simplifying the underlying differential equations.
Tactical Composition and Proof Automation
The framework relies on a Composition Theorem implemented within the KeYmaera X theorem prover using differential dynamic logic (dL). The theorem states that if individual components satisfy their respective contracts and their interfaces are mutually compatible, the safety of the entire composed system is mathematically guaranteed.
Figure 4 illustrates this composition process. When linking components (e.g., $C_1$ to $C_4$), the framework checks for compatibility ($\pi^{out} \leftrightarrow \pi^{in}$). If the output guarantee of a preceding component satisfies the input requirement of the following one, the connection is considered safe.
To make this practical, the authors developed a specialized "tactic" in KeYmaera X. This tactic automates the "program shape adaptation" required to fit pre-existing component proofs into the context of a larger system. By reordering code and removing irrelevant variables automatically, the tactic allows for extensive proof reuse, sparing engineers from re-proving safety from scratch for every system configuration.
Evaluation and Results
The effectiveness of the tactical composition approach was evaluated across several benchmarks, including a tele-operated robot (RC Robot), the European Train Control System (ETCS), and Adaptive Cruise Control (ACC) scenarios.
The modular approach showed significant performance gains over monolithic verification:
- Computational Efficiency: In the ETCS case study, the modular approach achieved a nearly 20x speedup, reducing verification time from over 4 hours (15,306 seconds) to approximately 15 minutes (873 seconds).
- Reduced Manual Intervention: For the "Robix" robot model, the number of manual tactic applications required by a human expert dropped from 96 in the monolithic version to just 31 for the most complex component, with the remaining composition steps fully automated.
- Scalability: The results suggest that as systems grow in complexity, the benefits of decomposition become more pronounced, making previously "unverifiable" systems manageable.
Conclusion and Future Work
Tactical contract composition provides a scalable path forward for the formal verification of large-scale hybrid systems. By abstracting continuous dynamics into discrete contracts and automating the proof-stitching process, the framework reduces the mathematical burden on both automated tools and human engineers.
Current limitations include the manual effort still required to draft initial component contracts and their base proofs. Future research aims to extend the framework to handle "lossy" communication models—where data may be delayed or dropped—and to develop tools that can automatically derive contracts from high-level system requirements.
Summary updated