mechanized semantics and verified compilation for a
play

MECHANIZED SEMANTICS AND VERIFIED COMPILATION FOR A DATAFLOW - PowerPoint PPT Presentation

MECHANIZED SEMANTICS AND VERIFIED COMPILATION FOR A DATAFLOW SYNCHRONOUS LANGUAGE WITH RESET Timothy Bourke 1,2 Llio Brun 1,2 Marc Pouzet 3,2,1 POPL20 January 24, 2020 1 Inria Paris 2 cole normale suprieure PSL University


  1. MECHANIZED SEMANTICS AND VERIFIED COMPILATION FOR A DATAFLOW SYNCHRONOUS LANGUAGE WITH RESET Timothy Bourke 1,2 Lélio Brun 1,2 Marc Pouzet 3,2,1 POPL’20 — January 24, 2020 1 Inria Paris 2 École normale supérieure – PSL University velus.inria.fr 3 Sorbonne University github.com/INRIA/velus

  2. MOTIVATION: MODEL BASED DESIGN IN SCADE SUITE www.ansys.com/products/embedded-software/ansys-scade-suite node euler(x0, u: double) x = x0 fby (x + 0.1 * u); returns (x: double); let tel sequential program block / node = system = stream function (C, Ada, assembly) line = signal = stream of values 1/15

  3. MOTIVATION: MODEL BASED DESIGN IN SCADE SUITE www.ansys.com/products/embedded-software/ansys-scade-suite node euler(x0, u: double) x = x0 fby (x + 0.1 * u); returns (x: double); let tel sequential program block / node = system = stream function (C, Ada, assembly) line = signal = stream of values 1/15

  4. MOTIVATION: MODEL BASED DESIGN IN SCADE SUITE www.ansys.com/products/embedded-software/ansys-scade-suite node euler(x0, u: double) x = x0 fby (x + 0.1 * u); returns (x: double); let tel sequential program block / node = system = stream function (C, Ada, assembly) line = signal = stream of values 1/15

  5. MOTIVATION: MODEL BASED DESIGN IN SCADE SUITE www.ansys.com/products/embedded-software/ansys-scade-suite node euler(x0, u: double) x = x0 fby (x + 0.1 * u); returns (x: double); let tel sequential program block / node = system = stream function (C, Ada, assembly) line = signal = stream of values 1/15

  6. MOTIVATION: MODEL BASED DESIGN IN SCADE SUITE www.ansys.com/products/embedded-software/ansys-scade-suite node euler(x0, u: double) x = x0 fby (x + 0.1 * u); returns (x: double); let tel sequential program block / node = system = stream function (C, Ada, assembly) line = signal = stream of values 1/15

  7. Focus: modular reset THE VÉLUS PROJECT Model-Based Design Interactive Theorem + Provers Languages SCADE, Lustre, Simulink Coq Challenges 1. Mechanize the semantics 2. Prove the compilation algorithms correct 2/15

  8. THE VÉLUS PROJECT Model-Based Design Interactive Theorem + Provers Languages SCADE, Lustre, Simulink Coq Challenges 1. Mechanize the semantics 2. Prove the compilation algorithms correct Focus: modular reset 2/15

  9. [Caspi et al. (1987); Colaço, Pagano, and Pouzet (2017)] EXAMPLE node euler(x0, u: double) FBY returns (x: double); u x let 1 0.1 x = x0 fby (x + 0.1 * u); x0 tel x 0 0 . 00 1 . 55 3 . 62 5 . 46 · · · u 15 . 00 20 . 00 17 . 00 12 . 00 · · · x + 0 . 1 × u 1 . 50 3 . 50 5 . 20 6 . 70 · · · x 0 . 00 1 . 50 3 . 50 5 . 20 · · · 3/15

  10. [Caspi et al. (1987); Colaço, Pagano, and Pouzet (2017)] EXAMPLE node euler(x0, u: double) FBY returns (x: double); u x let 1 0.1 x = x0 fby (x + 0.1 * u); x0 tel x 0 0 . 00 1 . 55 3 . 62 5 . 46 · · · u 15 . 00 20 . 00 17 . 00 12 . 00 · · · x + 0 . 1 × u 1 . 50 3 . 50 5 . 20 6 . 70 · · · x 0 . 00 1 . 50 3 . 50 5 . 20 · · · 3/15

  11. [Caspi et al. (1987); Colaço, Pagano, and Pouzet (2017)] EXAMPLE node euler(x0, u: double) FBY returns (x: double); u x let 1 0.1 x = x0 fby (x + 0.1 * u); x0 tel x 0 0 . 00 1 . 55 3 . 62 5 . 46 · · · u 15 . 00 20 . 00 17 . 00 12 . 00 · · · x + 0 . 1 × u 1 . 50 3 . 50 5 . 20 6 . 70 · · · x 0 . 00 1 . 50 3 . 50 5 . 20 · · · 3/15

  12. [Caspi et al. (1987); Colaço, Pagano, and Pouzet (2017)] EXAMPLE node ins(gps, xv: double) FBY k returns (x: double, alarm: bool) alarm 1 var pxa, xe: double; k: int; 50 0 1 let k = 0 fby (k + 1); alarm alarm FBY pxa WHEN alarm = (k ≥ 50); x 1 xe = euler((gps, xv) when not alarm); 0.0 pxa = (0. fby x) when alarm; gps x0 alarm xe x = merge alarm pxa xe; WHEN u euler tel xv gps 0 . 00 1 . 55 3 . 62 5 . 46 86 . 52 88 . 40 90 . 91 · · · · · · xv 15 . 00 20 . 00 17 . 00 12 . 00 18 . 00 23 . 00 20 . 00 · · · · · · k 0 1 2 3 49 50 51 · · · · · · alarm F F F F F T T · · · · · · xe 0 . 00 1 . 50 3 . 50 5 . 20 77 . 35 · · · · · · pxa 77 . 35 77 . 35 · · · · · · x 0 . 00 1 . 50 3 . 50 5 . 20 77 . 35 77 . 35 77 . 35 3/15 · · · · · ·

  13. [Caspi et al. (1987); Colaço, Pagano, and Pouzet (2017)] EXAMPLE node ins(gps, xv: double) FBY k returns (x: double, alarm: bool) alarm 1 var pxa, xe: double; k: int; 50 0 1 let k = 0 fby (k + 1); alarm alarm FBY pxa WHEN alarm = (k ≥ 50); x 1 xe = euler((gps, xv) when not alarm); 0.0 pxa = (0. fby x) when alarm; gps x0 alarm xe x = merge alarm pxa xe; WHEN u euler tel xv gps 0 . 00 1 . 55 3 . 62 5 . 46 86 . 52 88 . 40 90 . 91 · · · · · · xv 15 . 00 20 . 00 17 . 00 12 . 00 18 . 00 23 . 00 20 . 00 · · · · · · k 0 1 2 3 49 50 51 · · · · · · alarm F F F F F T T · · · · · · xe 0 . 00 1 . 50 3 . 50 5 . 20 77 . 35 · · · · · · pxa 77 . 35 77 . 35 · · · · · · x 0 . 00 1 . 50 3 . 50 5 . 20 77 . 35 77 . 35 77 . 35 3/15 · · · · · ·

  14. [Caspi et al. (1987); Colaço, Pagano, and Pouzet (2017)] EXAMPLE node ins(gps, xv: double) FBY k returns (x: double, alarm: bool) alarm 1 var pxa, xe: double; k: int; 50 0 1 let k = 0 fby (k + 1); alarm alarm FBY pxa WHEN alarm = (k ≥ 50); x 1 xe = euler((gps, xv) when not alarm); 0.0 pxa = (0. fby x) when alarm; gps x0 alarm xe x = merge alarm pxa xe; WHEN u euler tel xv gps 0 . 00 1 . 55 3 . 62 5 . 46 86 . 52 88 . 40 90 . 91 · · · · · · xv 15 . 00 20 . 00 17 . 00 12 . 00 18 . 00 23 . 00 20 . 00 · · · · · · k 0 1 2 3 49 50 51 · · · · · · alarm F F F F F T T · · · · · · xe 0 . 00 1 . 50 3 . 50 5 . 20 77 . 35 · · · · · · pxa 77 . 35 77 . 35 · · · · · · x 0 . 00 1 . 50 3 . 50 5 . 20 77 . 35 77 . 35 77 . 35 3/15 · · · · · ·

  15. [Caspi et al. (1987); Colaço, Pagano, and Pouzet (2017)] EXAMPLE node ins(gps, xv: double) FBY k returns (x: double, alarm: bool) alarm 1 var pxa, xe: double; k: int; 50 0 1 let k = 0 fby (k + 1); alarm alarm FBY pxa WHEN alarm = (k ≥ 50); x 1 xe = euler((gps, xv) when not alarm); 0.0 pxa = (0. fby x) when alarm; gps x0 alarm xe x = merge alarm pxa xe; WHEN u euler tel xv gps 0 . 00 1 . 55 3 . 62 5 . 46 86 . 52 88 . 40 90 . 91 · · · · · · xv 15 . 00 20 . 00 17 . 00 12 . 00 18 . 00 23 . 00 20 . 00 · · · · · · k 0 1 2 3 49 50 51 · · · · · · alarm F F F F F T T · · · · · · xe 0 . 00 1 . 50 3 . 50 5 . 20 77 . 35 · · · · · · pxa 77 . 35 77 . 35 · · · · · · x 0 . 00 1 . 50 3 . 50 5 . 20 77 . 35 77 . 35 77 . 35 3/15 · · · · · ·

  16. [Caspi et al. (1987); Colaço, Pagano, and Pouzet (2017)] EXAMPLE node ins(gps, xv: double) FBY k returns (x: double, alarm: bool) alarm 1 var pxa, xe: double; k: int; 50 0 1 let x = merge alarm pxa xe; alarm alarm FBY pxa WHEN k = 0 fby (k + 1); x 1 pxa = (0. fby x) when alarm; 0.0 xe = euler((gps, xv) when not alarm); gps x0 alarm xe alarm = (k ≥ 50); WHEN u euler tel xv gps 0 . 00 1 . 55 3 . 62 5 . 46 86 . 52 88 . 40 90 . 91 · · · · · · xv 15 . 00 20 . 00 17 . 00 12 . 00 18 . 00 23 . 00 20 . 00 · · · · · · k 0 1 2 3 49 50 51 · · · · · · alarm F F F F F T T · · · · · · xe 0 . 00 1 . 50 3 . 50 5 . 20 77 . 35 · · · · · · pxa 77 . 35 77 . 35 · · · · · · x 0 . 00 1 . 50 3 . 50 5 . 20 77 . 35 77 . 35 77 . 35 3/15 · · · · · ·

  17. We need a way to reset the state of a node [Caspi et al. (1987); Colaço, Pagano, and Pouzet (2017)] [Colaço, Pagano, and Pouzet (2005)] EXAMPLE <NAV> s GPS INS 1 gps x gps x ins f alse alarm 1 xv alarm s Can be compiled into simple constructs 3/15

  18. [Caspi et al. (1987); Colaço, Pagano, and Pouzet (2017)] [Colaço, Pagano, and Pouzet (2005)] EXAMPLE <NAV> s GPS INS 1 gps x gps x ins f alse alarm 1 xv alarm s Can be compiled into simple constructs We need a way to reset the state of a node 3/15

  19. [Caspi (1994); Hamon and Pouzet (2000)] WITHOUT MODULAR RESET node euler(x0, u: double, r: bool) returns (x: double); let x = if r then x0 else x0 fby (x + 0.1 * u); tel node ins(gps, xv: double, r: bool) returns (x: double, alarm: bool) var k: int; let x = merge alarm ((0. fby x) when alarm) (euler((gps, xv, r) whenot alarm)); alarm = (k ≥ 50); k = if r then 0 else 0 fby (k + 1); tel ... (x, a) = ins(gps, xv, r); 4/15

  20. [Caspi (1994); Hamon and Pouzet (2000)] WITHOUT MODULAR RESET WITH MODULAR RESET node euler(x0, u: double, r: bool) node euler(x0, u: double) returns (x: double); returns (x: double); let let x = if r then x0 else x0 fby (x + 0.1 * u); x = x0 fby (x + 0.1 * u); tel tel node ins(gps, xv: double, r: bool) node ins(gps, xv: double) returns (x: double, alarm: bool) returns (x: double, alarm: bool) var k: int; var pxa, xe: double; k: int; let let x = merge alarm k = 0 fby (k + 1); ((0. fby x) when alarm) alarm = (k ≥ 50); (euler((gps, xv, r) whenot alarm)); xe = euler((gps, xv) when not alarm); alarm = (k ≥ 50); pxa = (0. fby x) when alarm; k = if r then 0 else 0 fby (k + 1); x = merge alarm pxa xe; tel tel ... ... (x, a) = ins(gps, xv, r); (x, a) = (restart ins every r) (gps, xv); 4/15

  21. GRAPHICAL MODULAR RESET CONSTRUCT SCADE Simulink r gps R x xv a gps x Resettable R Subsystem ins a xv Reset 1 gps x 1 gps x 2 xv alarm 2 xv a ins 5/15

Recommend


More recommend