Section: New Results
Verified compilation of Lustre
Participants : Timothy Bourke, Lélio Brun, Paul Jeanmaire, Marc Pouzet.
Vélus is a compiler for a subset of Lustre and Scade that is specified in the Coq [28] Interactive Theorem Prover (ITP). It integrates the CompCert C compiler [34], [29] to define the semantics of machine operations (integer addition, floatingpoint multiplication, etcetera) and to generate assembly code for different architectures. The research challenges are to

to mechanize, i.e., put into Coq, the semantics of the programming constructs used in modern languages for MBD;

to interactively verify source programs and guarantee that the obtained invariants also hold of the generated code.
This year we created a website for the project (https://velus.inria.fr) and made an initial release under an Inria noncommerical license (https://github.com/Inria/velus). T. Bourke's JCJC (“Jeune Chercheuse Jeune Chercheur”) project FidelR was accepted for funding by the ANR: it aims to develop ITPbased techniques for treating state machines and interactive program verification. We also made progress on the compilation of the modular reset construct, the treatment of (nonnormalized) Lustre, and our longer term goal of strengthening the main correctness theorem. These results are detailed below.
Compiling the modular reset construct.
In the original Lustre language, the only way to reset the internal state of an instantiated function is to propagate and test explicit reset signals. Later languages, like Lucid Synchrone and Scade , provide a construct for resetting an instance modularly (it works for any function) and efficiently (testing occurs only at the point of instantiation). Last year we showed how to encode the semantics of this construct in Coq. This year we focused on its compilation and the associated proof of correctness. We designed and implemented a new intermediate language that exposes different step and reset actions on node instances. This language facilitates the optimization of conditional statements in the generated code and permits the transformation to imperative code and its proof of correctness to be treated in two steps: one to introduce named memories and another to fix the sequential order of execution. This work forms the core of L. Brun's thesis, to be defended early next year, and an article accepted at the ACM SIGBED international conference on Principles of Programming Languages (POPL 2020).
Nonnormalized Lustre.
Our previous work has focused on a subset of “normalized” programs where the form of expressions and equations is constrained to facilitate the compilation. We have generalized the definitions of syntax and semantics in our prototype compiler to accept nonnormalized programs. This included simplifying and generalizing the formalization of clocks presented in [20]. With P. Jeanmaire (M2 internship), we have implemented a compilation pass to translate normalized programs from one syntactical form to another. The main challenge was to formally prove an alignment property (signals are present iff their clocks are true) that had been assumed until now. The proof is finished except for the inductive case for the reset construct which we hope to complete soon.
Strengthening the correctness theorem.
The current correctness theorem assumes that an accepted program can be given a semantics in terms of the mechanized model. It should be possible to prove this fact for programs that pass the initial typechecking and clockchecking algorithms, that can be scheduled, and which never invoke an undefined operation (such as a division by zero). We made good progress on this problem by defining an interpreter for normalized Lustre programs and showing that the results it calculates satisfy the semantic predicates. This initial work gives some useful insights into how to proceed. We presented it at the Synchron 2019 workshop.