Publications

2023

EMSOFT23
Timothy Bourke, Basile Pesin, and Marc Pouzet. Verified compilation of synchronous dataflow with state machines. ACM Transactions on Embedded Computing Systems, 22(5s):137:1–137:26, September 2023. ESWEEK special issue including presentations at the 23rd Int. Conf. on Embedded Software (EMSOFT 2023).
bib | DOI | http | .pdf ]

Safety-critical embedded software is routinely programmed in block-diagram languages. Recent work in the Vélus project specifies such a language and its compiler in the Coq proof assistant. It builds on the CompCert verified C compiler to give an end-to-end proof linking the dataflow semantics of source programs to traces of the generated assembly code. We extend this work with switched blocks, shared variables, reset blocks, and state machines; define a relational semantics to integrate these block- and mode-based constructions into the existing stream-based model; adapt the standard source-to-source rewriting scheme to compile the new constructions; and reestablish the correctness theorem.

JFLA23
Timothy Bourke, Basile Pesin, and Marc Pouzet. Analyse de dépendance vérifiée pour un langage synchrone à flot de données. In Timothy Bourke and Delphine Demange, editors, JFLA 2023 - Les trente-quatrièmes Journées Francophones des Langages Applicatifs, pages 101–120, Praz-sur-Arly, France, January/February 2023.
bib | http | .pdf ]

Vélus is a formalisation of a synchronous dataflow language and compiler in the Coq proof assistant. It includes a definition of the source language's dynamic semantics, a compiler that produces imperative code, and an end-to-end proof that the compiler preserves the semantics of programs.

In this article, we extend Vélus with the semantics of two activation structures that are provided by modern compilers: switchs and local declarations. These new constructions require adapting the static dependency analysis of Vélus, which produces an acyclic graph as a witness that a program is well formed. We use this witness to construct an induction schema and apply it to show, in Coq, that the semantic model is deterministic.

2022

TYPES22
Timothy Bourke, Paul Jeanmaire, and Marc Pouzet. Towards a denotational semantics of streams for a verified Lustre compiler (short talk). In 28th International Conference on Types for Proofs and Programs, Nantes, France, June 2022.
bib | .pdf ]

2021

EMSOFT21
Timothy Bourke, Paul Jeanmaire, Basile Pesin, and Marc Pouzet. Verified Lustre normalization with node subsampling. ACM Transactions on Embedded Computing Systems, 20(5s):Article 98, October 2021. ESWEEK special issue including presentations at the 21st Int. Conf. on Embedded Software (EMSOFT 2021).
bib | DOI | http | .pdf ]

Dataflow languages allow the specification of reactive systems by mutually recursive stream equations, functions, and boolean activation conditions called clocks. Lustre and Scade are dataflow languages for programming embedded systems. Dataflow programs are compiled by a succession of passes. This article focuses on the normalization pass which rewrites programs into the simpler form required for code generation.

Vélus is a compiler from a normalized form of Lustre to CompCert's Clight language. Its specification in the Coq interactive theorem prover includes an end-to-end correctness proof that the values prescribed by the dataflow semantics of source programs are produced by executions of generated assembly code. We describe how to extend Vélus with a normalization pass and to allow subsampled node inputs and outputs. We propose semantic definitions for the unrestricted language, divide normalization into three steps to facilitate proofs, adapt the clock type system to handle richer node definitions, and extend the end-to-end correctness theorem to incorporate the new features. The proofs require reasoning about the relation between static clock annotations and the presence and absence of values in the dynamic semantics. The generalization of node inputs requires adding a compiler pass to ensure the initialization of variables passed in function calls.

JFLA21
Timothy Bourke, Paul Jeanmaire, Basile Pesin, and Marc Pouzet. Normalisation vérifiée du langage Lustre. In JFLA 2021 - Les trente-deuxièmes Journées Francophones des Langages Applicatifs, pages 117–133, Online, April 2021.
bib | http | .pdf ]

Lustre is a synchronous dataflow language designed for programming embedded systems. In the Vélus project, we use Coq to develop and formalize a compiler that accepts a normalized form of the language and produces imperative code. While this restricted form is suitable for code generated from a user interface based on block diagrams, we wanted to allow programmers to use the complete language.

In this article, we present the normalization pass that transforms the complete language into the normalized one. This transformation is divided into three steps so as to simplify the correctness proofs. To show that the semantics is preserved, it is necessary to prove that the three steps preserve certain static and dynamic properties of the language. In particular, the relation between the clock types and the dynamic semantic must be established.

2020

Brun20
Lélio Brun. Mechanized Semantics and Verified Compilation for a Dataflow Synchronous Language with Reset. PhD thesis, PSL Research University, June 2020.
bib | .pdf ]

Specifications based on block diagrams and state machines are used to design control software, especially in the certified development of safety-critical applications. Tools like Scade and Simulink/Stateflow are equipped with compilers that translate such specifications into executable code. They provide programming languages for composing functions over streams as typified by dataflow synchronous languages like Lustre.

In this thesis we present Vélus, a Lustre compiler verified in the interactive theorem prover Coq. We develop semantic models for the various languages in the compilation chain, and build on the verified CompCert C compiler to generate executable code and give an end-to-end correctness proof. The main challenge is to show semantic preservation between the dataflow paradigm and the imperative paradigm, and to reason about byte-level representations of program states.

We treat, in particular, the modular reset construct, a primitive for resetting subsystems. This necessitates the design of suitable semantic models, compilation algorithms and corresponding correctness proofs. We introduce a novel intermediate language into the usual clock-directed modular compilation scheme of Lustre. This permits the implementation of compilation passes that generate better sequential code, and facilitates reasoning about the correctness of the successive transformations of the modular reset construct.

POPL20
Timothy Bourke, Lélio Brun, and Marc Pouzet. Mechanized semantics and verified compilation for a dataflow synchronous language with reset. Proceedings of the ACM on Programming Languages, 4(POPL):1–29, January 2020.
bib | DOI | http | .pdf ]

Specifications based on block diagrams and state machines are used to design control software, especially in the certified development of safety-critical applications. Tools like SCADE Suite and Simulink/Stateflow are equipped with compilers that translate such specifications into executable code. They provide programming languages for composing functions over streams as typified by Dataflow Synchronous Languages like Lustre.

Recent work builds on CompCert to specify and verify a compiler for the core of Lustre in the Coq Interactive Theorem Prover. It formally links the stream-based semantics of the source language to the sequential memory manipulations of generated assembly code. We extend this work to treat a primitive for resetting subsystems. Our contributions include new semantic rules that are suitable for mechanized reasoning, a novel intermediate language for generating optimized code, and proofs of correctness for the associated compilation passes.

2019

JFLA19
Timothy Bourke and Marc Pouzet. Clocked arguments in a verified Lustre compiler. In JFLA 2019 - Les trentièmes Journées Francophones des Langages Applicatifs, Les actes des trentièmes Journées Francophones des Langages Applicatifs (JFLA 2019), page 16, Les Rousses, France, January 2019.
bib | http | .pdf ]

Lustre is a synchronous language for programming systems as block diagrams from which low-level imperative code is generated automatically. Recent work applies the Coq interactive proof assistant to specify a compiler from a core subset of Lustre to the Clight input language of CompCert from which assembly code is generated. The overall correctness proof connects the stream semantics of Lustre to the imperative semantics of the assembly code.

Every stream in a Lustre program is associated with a static ‘clock’ that represents when it is active. Compilation transforms the clocks into conditional statements that control when the corresponding value are calculated. Previous work made the simplifying assumption that the inputs and outputs of any given block shared the same static clock. This paper describes one way to lift this restriction. It requires enriching the static typing rules for clocks and the semantic model, and, to satisfy the Clight semantics, adding a compilation pass to ensure that any variable passed to a function call has been initialized.

2018

SCOPES18
Timothy Bourke, Lélio Brun, and Marc Pouzet. Towards a verified Lustre compiler with modular reset. In 21st International Workshop on Software and Compilers for Embedded Systems (SCOPES 2018), Proceedings of the 21st International Workshop on Software and Compilers for Embedded Systems (SCOPES 2018), page 4, Sankt Goar, Germany, May 2018. ACM Press.
bib | DOI | http | .pdf ]

This paper presents ongoing work to add a modular reset construct to a verified Lustre compiler. We present a novel formal specification for the construct and sketch our plans to integrate it into the compiler and its correctness proof.

2017

PLDI17
Timothy Bourke, Lélio Brun, Pierre-Evariste Dagand, Xavier Leroy, Marc Pouzet, and Lionel Rieg. A Formally Verified Compiler for Lustre. In PLDI 2017 - 38th ACM SIGPLAN Conference on Programming Language Design and Implementation, Barcelone, Spain, June 2017. ACM.
bib | http | .pdf ]

The correct compilation of block diagram languages like Lustre, Scade, and a discrete subset of Simulink is important since they are used to program critical embedded control software. We describe the specification and verification in an Interactive Theorem Prover of a compilation chain that treats the key aspects of Lustre: sampling, nodes, and delays. Building on CompCert, we show that repeated execution of the generated assembly code faithfully implements the dataflow semantics of source programs.

We resolve two key technical challenges. The first is the change from a synchronous dataflow semantics, where programs manipulate streams of values, to an imperative one, where computations manipulate memory sequentially. The second is the verified compilation of an imperative language with encapsulated state to C code where the state is realized by nested records. We also treat a standard control optimization that eliminates unnecessary conditional statements.

JFLA17
Timothy Bourke, Pierre-Evariste Dagand, Marc Pouzet, and Lionel Rieg. Vérification de la génération modulaire du code impératif pour Lustre. In JFLA 2017 - Vingt-huitième Journées Francophones des Langages Applicatifs, Gourette, France, January 2017.
bib | http | .pdf ]

Synchronous languages are used to program critical control applications. The Scade language, used in industry for these applications, is based on the Lustre language introduced by Caspi and Halbwachs. In this article we treat the formalization and proof, in the Coq proof assistant, of a key compilation pass: the translation of programs from Lustre into an imperative language. The challenge is to change from a synchronous dataflow semantics, where programs manipulate streams, to an imperative semantics, where the program manipulates memory sequentially. We specify and verify a simple code generator that treats core Lustre features: sampling, nodes, and delays. The proof uses an intermediate semantic model that mixes dataflow and imperative characteristics and allows the statement of an essential inductive invariant. We exploit this formalization to verify a classic optimization that fuses conditional structures in the generated imperative code.