reasoning about sound programs
play

Reasoning About Sound Programs Emilio Jess Gallego Arias Joint work - PowerPoint PPT Presentation

Reasoning About Sound Programs Emilio Jess Gallego Arias Joint work with O. Hermant & P . Jouvelot MINES ParisTech, PSL Research University, France Rennes, 15 Avril 2015 Software verification? Software verification? What is our gain?


  1. Reasoning About Sound Programs Emilio Jesús Gallego Arias Joint work with O. Hermant & P . Jouvelot MINES ParisTech, PSL Research University, France Rennes, 15 Avril 2015

  2. Software verification?

  3. Software verification? What is our gain?

  4. Let’s assume a simple IIR filter: smooth n “ p 1 ´ c q ¨ x n ` c ¨ smooth n ´ 1

  5. Let’s assume a simple IIR filter: smooth n “ p 1 ´ c q ¨ x n ` c ¨ smooth n ´ 1 What would we like to know about it?

  6. smooth n “ p 1 ´ c q ¨ x n ` c ¨ smooth n ´ 1 Natural questions are: § Frequency response; § Stability; § Linearity/Time Invariance. Standard DSP theory gives answers.

  7. smooth n “ p 1 ´ c q ¨ x n ` c ¨ smooth n ´ 1 Natural questions are: § Frequency response; § Stability; § Linearity/Time Invariance. Standard DSP theory gives answers. What about the implementation of the filter? We dive into the realm of PL theory!

  8. smooth n “ p 1 ´ c q ¨ x n ` c ¨ smooth n ´ 1 Natural questions are: § Frequency response; § Stability; § Linearity/Time Invariance. Standard DSP theory gives answers. What about the implementation of the filter? We dive into the realm of PL theory! Paradigm shift!

  9. Faust § Functional PL for digital signal processing. § Synchronous paradigm, geared towards audio. § Programs: circuits/block diagrams with feedback. § Semantics: streams of samples. § Efficiency is crucial . § Created in 2000 by Yann Orlarey et al. at GRAME. § Mature, compiles to more than 14 platforms.

  10. Faust’s Ecosystem Users: § Grame: Multiple projects, main developer. § Stanford: Class/books on signal processing, STK instrument toolkit, Faust2android, Mephisto. . . § Ircam: Acoustic libraries, effects libraries,. . . § Other: Guitarix, moForte guitar, etc...

  11. Faust’s Ecosystem Users: § Grame: Multiple projects, main developer. § Stanford: Class/books on signal processing, STK instrument toolkit, Faust2android, Mephisto. . . § Ircam: Acoustic libraries, effects libraries,. . . § Other: Guitarix, moForte guitar, etc... It has its market! Much easier than dwelling into C.

  12. Faust’s Ecosystem Users: § Grame: Multiple projects, main developer. § Stanford: Class/books on signal processing, STK instrument toolkit, Faust2android, Mephisto. . . § Ircam: Acoustic libraries, effects libraries,. . . § Other: Guitarix, moForte guitar, etc... It has its market! Much easier than dwelling into C. Recent Events: § Faust day at Stanford, LAC 2015. § Faust program competition ( e 2,000). § FEEVER project :)

  13. Syntax and Well-Formedness TERM $ ! : 1 Ñ 0 ID $ _ : 1 Ñ 1 PAR $ f 1 : i 1 Ñ o 1 ¨ ¨ ¨ $ f n : i n Ñ o n n n ÿ ÿ $ p f 1 , . . . , f n q : i j Ñ o j j j COMP $ f : i Ñ k $ g : k Ñ o $ p f : g q : i Ñ o PAN $ f : i Ñ k $ g : k ˚ n Ñ o 0 ă k ^ 0 ă n $ f ă : g : i Ñ o

  14. Feedback FEED $ f : o g ` i f Ñ i g ` o f $ g : i g Ñ o g $ f „ g : i f Ñ i g ` o f Diagram for + „ sin :

  15. Back to the Filter smooth n “ p 1 ´ c q x n ` c ¨ smooth n ´ 1 Using Faust: smooth(c) = *(1-c) : + „ *(c) [For c = 0.9]

  16. Feedback Delay Network fdnrev(N, dp, freqs, durs, loopgainmax) = delaylines „ (delayfilters : feedbackmatrix) where delaylines = rep(N,i,delay(dp[i]))); delayfilters = rep(N,filter(freqs,durs)); feedbackmatrix = bhadamard(N);

  17. Feedback Delay Network fdnrev(N, dp, freqs, durs, loopgainmax) = delaylines „ (delayfilters : feedbackmatrix) where delaylines = rep(N,i,delay(dp[i]))); delayfilters = rep(N,filter(freqs,durs)); feedbackmatrix = bhadamard(N);

  18. PL & Faust § Causal/Synchronous Programming. See next week’s talk! § Functional Reactive Programming/Arrows. § String Diagrams, Monoidal Closed Categories. § Stream/Data Flow Programming.

  19. PL & Faust § Causal/Synchronous Programming. See next week’s talk! § Functional Reactive Programming/Arrows. § String Diagrams, Monoidal Closed Categories. § Stream/Data Flow Programming. Data-intensive vs control-intensive require quite different control techniques. [Berry, 2000]

  20. PL & Faust § Causal/Synchronous Programming. See next week’s talk! § Functional Reactive Programming/Arrows. § String Diagrams, Monoidal Closed Categories. § Stream/Data Flow Programming. Data-intensive vs control-intensive require quite different control techniques. [Berry, 2000] Spectral processing may open a new gap from all of those!

  21. PL & Faust § Causal/Synchronous Programming. See next week’s talk! § Functional Reactive Programming/Arrows. § String Diagrams, Monoidal Closed Categories. § Stream/Data Flow Programming. Data-intensive vs control-intensive require quite different control techniques. [Berry, 2000] Spectral processing may open a new gap from all of those! Some related DSL: VOBLA, Ziria, Halide, Darkroom, Julia.

  22. DSP & Faust § Real-time Linear Processing. § Real-time Non-linear Processing. § Frequency Domain Processing. § Non-necessarily causal. § Filters, Feedback Networks, Interpolation. § Windowing! § Numerical issues. § Nyquist/precision/aliasing.

  23. Verification in DSP/Faust Use mechanized techniques to ensure correct behavior.

  24. Verification in DSP/Faust Use mechanized techniques to ensure correct behavior. § Model checking/automata. § Program analysis/logics. § Strong type systems/correct by construction.

  25. Verification in DSP/Faust Use mechanized techniques to ensure correct behavior. § Model checking/automata. § Program analysis/logics. § Strong type systems/correct by construction. § Main efforts in DSP audio are numeric so far [Souari,Tahar, et al].

  26. Verification in DSP/Faust Use mechanized techniques to ensure correct behavior. § Model checking/automata. § Program analysis/logics. § Strong type systems/correct by construction. § Main efforts in DSP audio are numeric so far [Souari,Tahar, et al]. § Other non-DSP efforts (Antescofo, [Poncelet et. al]).

  27. Verification in DSP/Faust Use mechanized techniques to ensure correct behavior. § Model checking/automata. § Program analysis/logics. § Strong type systems/correct by construction. § Main efforts in DSP audio are numeric so far [Souari,Tahar, et al]. § Other non-DSP efforts (Antescofo, [Poncelet et. al]). Problems with Audio: bad sound, stability/glitches, under/overflows, time, safety/security, remote distribution. We need more!

  28. A Case Study: Stability Test-bed: use Coq Coq is a theorem prover that provides very strong evidence as compared to Mathlab, etc. . .

  29. A Case Study: Stability Test-bed: use Coq Coq is a theorem prover that provides very strong evidence as compared to Mathlab, etc. . . Stability of Smooth When is smooth stable? smooth n “ p 1 ´ c q x n ` c ¨ smooth n ´ 1

  30. A Case Study: Stability Test-bed: use Coq Coq is a theorem prover that provides very strong evidence as compared to Mathlab, etc. . . Stability of Smooth When is smooth stable? smooth n “ p 1 ´ c q x n ` c ¨ smooth n ´ 1 Smooth is stable when c Ps 0 , 1 r . Formally: @ i P r a , b s , c Ps 0 , 1 rÑ smooth p c q i P r a , b s Let’s build a mechanized constructive proof.

  31. What’s the plan? 1. Define the syntax of Faust inside Coq.

  32. What’s the plan? 1. Define the syntax of Faust inside Coq. 2. Define a representation for (sampled) sound.

  33. What’s the plan? 1. Define the syntax of Faust inside Coq. 2. Define a representation for (sampled) sound. 3. Link the two: Interpretation.

  34. What’s the plan? 1. Define the syntax of Faust inside Coq. 2. Define a representation for (sampled) sound. 3. Link the two: Interpretation. 4. Define a logic to simplify reasoning.

  35. What’s the plan? 1. Define the syntax of Faust inside Coq. 2. Define a representation for (sampled) sound. 3. Link the two: Interpretation. 4. Define a logic to simplify reasoning. 5. Verify!

  36. Mechanized Semantics for Streams § Coinductive semantics [Boulmé, et al]: problematic. § Didn’t consider PACO, etc. . . . § Our wish: Sequences S of a base type R [Auger2013]

  37. Mechanized Semantics for Streams § Coinductive semantics [Boulmé, et al]: problematic. § Didn’t consider PACO, etc. . . . § Our wish: Sequences S of a base type R [Auger2013] Soundness needs stronger semantics (also [Guatto2014]): � $ f : i Ñ o � n : � R ˆ . . . ˆ R � n Ñ � R ˆ . . . ˆ R � n l jh n l jh n o i Index by number of steps; equality of streams more intensional wrt to ( N Ñ R ).

  38. The Second Piece: Real Analysis What about the base type R ? § Reals not in Mathcomp – algebraic structures good enough for most of our experiments so far. § There are lots of work to do here. We lack convenient complex numbers, exponentials, etc...

  39. The Second Piece: Real Analysis What about the base type R ? § Reals not in Mathcomp – algebraic structures good enough for most of our experiments so far. § There are lots of work to do here. We lack convenient complex numbers, exponentials, etc...

  40. Proving Stability We could do the proof directly in Coq; it is not difficult, but a bit cumbersome in general. What is worse, the same patterns with minor variations are repeated in each proof: Not practical.

Recommend


More recommend