verifying a lustre compiler part 1
play

Verifying a Lustre Compiler (Part 1) Timothy Bourke 1 , 2 Llio Brun 1 - PowerPoint PPT Presentation

Verifying a Lustre Compiler (Part 1) Timothy Bourke 1 , 2 Llio Brun 1 , 2 Pierre-variste Dagand 3 Xavier Leroy 1 Marc Pouzet 4 , 2 , 1 Lionel Rieg 5 1. INRIA Paris 2. DI, cole normale suprieure 3. CNRS 4. Univ. Pierre et Marie Curie 5.


  1. Verifying a Lustre Compiler (Part 1) Timothy Bourke 1 , 2 Lélio Brun 1 , 2 Pierre-Évariste Dagand 3 Xavier Leroy 1 Marc Pouzet 4 , 2 , 1 Lionel Rieg 5 1. INRIA Paris 2. DI, École normale supérieure 3. CNRS 4. Univ. Pierre et Marie Curie 5. Yale University SYNCHRON Workshop, Bamberg—December 2016 1 / 20

  2. What are we doing? • Implementing a Lustre compiler in the Coq Interactive Theorem Prover • Proving that the generated code implements the dataflow semantics (Part of the ITEA 3 14014 ASSUME Project.) 2 / 20

  3. What are we doing? • Implementing a Lustre compiler in the Coq Interactive Theorem Prover • Proving that the generated code implements the dataflow semantics (Part of the ITEA 3 14014 ASSUME Project.) Coq [ The Coq Development Team (2016): The Coq proof ] assistant reference manual • A functional programming language; • ‘Extraction’ to OCaml programs; • A specification language (higher-order logic); • Tactic-based interactive proof. • Why not use Isabelle, PVS, ACL2, Agda, or � your favourite tool � ? 2 / 20

  4. What are we doing? • Implementing a Lustre compiler in the Coq Interactive Theorem Prover • Proving that the generated code implements the dataflow semantics (Part of the ITEA 3 14014 ASSUME Project.) Coq [ The Coq Development Team (2016): The Coq proof ] assistant reference manual • A functional programming language; • ‘Extraction’ to OCaml programs; • A specification language (higher-order logic); • Tactic-based interactive proof. • Why not use Isabelle, PVS, ACL2, Agda, or � your favourite tool � ? CompCert: a formal model and compiler for a subset of C • A generic machine-level model of execution and memory • A verified path to assembly code � Blazy, Dargaye, and Leroy (2006): “Formal � � Leroy (2009): “Formal verification of a � Verification of a C Compiler Front-End” realistic compiler” 2 / 20

  5. What are we doing? • Implementing a Lustre compiler in the Coq Interactive Theorem Prover • Proving that the generated code implements the dataflow semantics (Part of the ITEA 3 14014 ASSUME Project.) Coq [ The Coq Development Team (2016): The Coq proof ] assistant reference manual • A functional programming language; • ‘Extraction’ to OCaml programs; • A specification language (higher-order logic); • Tactic-based interactive proof. • Why not use Isabelle, PVS, ACL2, Agda, or � your favourite tool � ? CompCert: a formal model and compiler for a subset of C • A generic machine-level model of execution and memory • A verified path to assembly code � Blazy, Dargaye, and Leroy (2006): “Formal � � Leroy (2009): “Formal verification of a � Verification of a C Compiler Front-End” realistic compiler” • Computer assistance is all but essential for such detailed models. 2 / 20

  6. The Vélus Lustre Compiler (normalized) elaboration / scheduling check parsing elaboration normalization scheduling Unannotated Lustre N-Lustre SN-Lustre Lustre dataflow translation imperative fusion optimization Obc generation Clight compilation Assembly printing 3 / 20

  7. The Vélus Lustre Compiler (normalized) elaboration / scheduling check parsing elaboration normalization scheduling Unannotated Lustre N-Lustre SN-Lustre Lustre dataflow translation imperative fusion optimization • Implemented in Coq and (some) OCaml Obc generation Clight compilation Assembly printing 3 / 20

  8. The Vélus Lustre Compiler (normalized) elaboration / scheduling check parsing elaboration normalization scheduling Unannotated Lustre N-Lustre SN-Lustre Lustre dataflow translation imperative fusion optimization • Implemented in Coq and (some) OCaml Obc • Validated parser ( menhir –coq ) [ Jourdan, Pottier, and Leroy (2012): “Validating LR(1) parsers” ] generation Clight compilation Assembly printing 3 / 20

  9. The Vélus Lustre Compiler (normalized) elaboration / scheduling check parsing elaboration normalization scheduling Unannotated Lustre N-Lustre SN-Lustre Lustre dataflow translation imperative fusion optimization • Implemented in Coq and (some) OCaml Obc • Validated parser ( menhir –coq ) [ Jourdan, Pottier, and Leroy (2012): “Validating LR(1) parsers” ] generation • Not yet implemented: normalization and scheduling Clight [ Auger (2013): “Compilation certifiée de SCADE/LUSTRE” ] compilation Assembly printing 3 / 20

  10. The Vélus Lustre Compiler (normalized) elaboration / scheduling check parsing elaboration normalization scheduling Unannotated Lustre N-Lustre SN-Lustre Lustre dataflow translation imperative fusion optimization • Implemented in Coq and (some) OCaml Obc • Validated parser ( menhir –coq ) [ Jourdan, Pottier, and Leroy (2012): “Validating LR(1) parsers” ] generation • Not yet implemented: normalization and scheduling Clight [ Auger (2013): “Compilation certifiée de SCADE/LUSTRE” ] • Elaboration to Scheduled and Normalized Lustre. compilation Assembly printing 3 / 20

  11. The Vélus Lustre Compiler (normalized) elaboration / scheduling check parsing elaboration normalization scheduling Unannotated Lustre N-Lustre SN-Lustre Lustre dataflow translation imperative fusion optimization • Implemented in Coq and (some) OCaml Obc • Validated parser ( menhir –coq ) [ Jourdan, Pottier, and Leroy (2012): “Validating LR(1) parsers” ] generation • Not yet implemented: normalization and scheduling Clight [ Auger (2013): “Compilation certifiée de SCADE/LUSTRE” ] • Elaboration to Scheduled and Normalized Lustre. compilation • Translation to intermediate Obc code. Assembly printing 3 / 20

  12. The Vélus Lustre Compiler (normalized) elaboration / scheduling check parsing elaboration normalization scheduling Unannotated Lustre N-Lustre SN-Lustre Lustre dataflow translation imperative fusion optimization • Implemented in Coq and (some) OCaml Obc • Validated parser ( menhir –coq ) [ Jourdan, Pottier, and Leroy (2012): “Validating LR(1) parsers” ] generation • Not yet implemented: normalization and scheduling Clight [ Auger (2013): “Compilation certifiée de SCADE/LUSTRE” ] • Elaboration to Scheduled and Normalized Lustre. compilation • Translation to intermediate Obc code. Assembly • Optimization of intermediate Obc code. printing 3 / 20

  13. The Vélus Lustre Compiler (normalized) elaboration / scheduling check parsing elaboration normalization scheduling Unannotated Lustre N-Lustre SN-Lustre Lustre dataflow translation imperative fusion optimization • Implemented in Coq and (some) OCaml Obc • Validated parser ( menhir –coq ) [ Jourdan, Pottier, and Leroy (2012): “Validating LR(1) parsers” ] generation • Not yet implemented: normalization and scheduling Clight [ Auger (2013): “Compilation certifiée de SCADE/LUSTRE” ] • Elaboration to Scheduled and Normalized Lustre. compilation • Translation to intermediate Obc code. Assembly • Optimization of intermediate Obc code. printing • Generation of CompCert Clight code. 3 / 20

  14. The Vélus Lustre Compiler (normalized) elaboration / scheduling check parsing elaboration normalization scheduling Unannotated Lustre N-Lustre SN-Lustre Lustre dataflow translation imperative fusion optimization • Implemented in Coq and (some) OCaml Obc • Validated parser ( menhir –coq ) [ Jourdan, Pottier, and Leroy (2012): “Validating LR(1) parsers” ] generation • Not yet implemented: normalization and scheduling Clight [ Auger (2013): “Compilation certifiée de SCADE/LUSTRE” ] • Elaboration to Scheduled and Normalized Lustre. compilation • Translation to intermediate Obc code. Assembly • Optimization of intermediate Obc code. printing • Generation of CompCert Clight code. • Rely on CompCert for compilation. 3 / 20

  15. Lustre 30 years later? [ ] Caspi et al. (1987): “LUSTRE: A declarative language for programming synchronous systems” Not quite. . . • No pre : use fby , avoid initialization analysis for now • No sub-clocking on inputs or outputs • No current : use (binary) merge • No external calls 4 / 20

  16. Lustre 30 years later? [ ] Caspi et al. (1987): “LUSTRE: A declarative language for programming synchronous systems” Not quite. . . • No pre : use fby , avoid initialization analysis for now • No sub-clocking on inputs or outputs • No current : use (binary) merge • No external calls Two talks 1 Tim: • Overview • Translation correctness: SN-Lustre to Obc (recap) • Control-fusion optimization • Integration of Clight operators 2 Lélio: • Obc to Clight • Demo 4 / 20

  17. Outline Verifying Lustre compilation in Coq Translation correctness: SN-Lustre to Obc Fusion of control structures Integrating Clight operators into N-Lustre and Obc Conclusion 5 / 20

  18. Translation of SN-Lustre to Obc translation SN-Lustre Obc 6 / 20

  19. Translation of SN-Lustre to Obc translation SN-Lustre Obc functional program ( ≈ 100 lines) 6 / 20

  20. Translation of SN-Lustre to Obc translation SN-Lustre Obc functional program ( ≈ 100 lines) sem_node G f xss yss ( f t , s 0 ) stream ( T + i ) → stream ( T + o ) S × T + → T + o × S S i 6 / 20

  21. Translation of SN-Lustre to Obc translation SN-Lustre Obc functional program ( ≈ 100 lines) induction is too weak ✪ sem_node G f xss yss ( f t , s 0 ) stream ( T + i ) → stream ( T + o ) S × T + → T + o × S S i 6 / 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend