Synchronous Programming with Refinement Types
Jiawei Chen, José Luiz Vargas de Mendonça, Bereket Shimels Ayele, Bereket Ngussie Bekele, Shayan Jalili, Pranjal Sharma, Nicholas Wohlfeil, Yicheng Zhang, Jean-Baptiste Jeannin
TL;DR
The paper tackles the challenge of ensuring safety in cyber-physical systems by introducing MARVeLus, a synchronous language augmented with refinement types that enable verification directly in the executable source. It develops a formal metatheory including a time-aware type system with LTL-like predicates, plus a proof of type safety via progress and preservation adapted to streaming semantics. The approach is demonstrated on a robotics collision-avoidance scenario, implemented as an extension to the Zélus compiler and verified with an SMT-based verifier, achieving both simulation and real-world execution within moments. This work bridges verification and deployment for CPS, reducing translation errors and enabling end-to-end confidence in safety-critical behavior.
Abstract
Cyber-Physical Systems (CPS) consist of software interacting with the physical world, such as robots, vehicles, and industrial processes. CPS are frequently responsible for the safety of lives, property, or the environment, and so software correctness must be determined with a high degree of certainty. To that end, simply testing a CPS is insufficient, as its interactions with the physical world may be difficult to predict, and unsafe conditions may not be immediately obvious. Formal verification can provide stronger safety guarantees but relies on the accuracy of the verified system in representing the real system. Bringing together verification and implementation can be challenging, as languages that are typically used to implement CPS are not easy to formally verify, and languages that lend themselves well to verification often abstract away low-level implementation details. Translation between verification and implementation languages is possible, but requires additional assurances in the translation process and increases software complexity; having both in a single language is desirable. This paper presents a formalization of MARVeLus, a CPS language which combines verification and implementation. We develop a metatheory for its synchronous refinement type system and demonstrate verified synchronous programs executing on real systems.
