Smooth Interpretation Swarat Chaudhuri and Armando SolarLezama The

  • Slides: 15
Download presentation
Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

The Parameter Synthesis Problem t. Off : = ? ? ; t. On :

The Parameter Synthesis Problem t. Off : = ? ? ; t. On : = ? ? ; h : = ? ? repeat(Át) { temp : = read. Temp(); if (is. On() && temp > t. Off) switch. Heater. Off(); elseif ( !is. On() && temp < t. On) switch. Heater. On(h); } Warming: Cooling:

The Parameter Synthesis Problem temp 75· time Can we find values of (t. Off,

The Parameter Synthesis Problem temp 75· time Can we find values of (t. Off, t. On, h) to minimize Err?

Minimization by numerical search What about gradient descent?

Minimization by numerical search What about gradient descent?

Smoothing to the Rescue

Smoothing to the Rescue

Smoothing in Signal Processing • Gaussian Smoothing – Given a function – produces a

Smoothing in Signal Processing • Gaussian Smoothing – Given a function – produces a smooth function What if we could do this for programs?

Smoothed semantics of programs • • Smoothed program: Probabilistic semantics: 1. Make input a

Smoothed semantics of programs • • Smoothed program: Probabilistic semantics: 1. Make input a random variable with Normal distribution 2. Execute the program on this random variable 3. Return the expected value of the program output Tuning knob: Standard deviation b. P(x) = if x > 2 then 1 else 0;

Smooth Interpretation How do we execute a program on a distribution of inputs? –

Smooth Interpretation How do we execute a program on a distribution of inputs? – Not by sampling • we would miss essential features of the search landscape. – Symbolic execution: • propagate symbolic representations of distributions. Input x Program Approximation of expected output

Smooth Interpretation: Branch if( x > 0 ) true false

Smooth Interpretation: Branch if( x > 0 ) true false

Smooth Interpretation: Join if( x > 0 ) true false

Smooth Interpretation: Join if( x > 0 ) true false

Smooth Interpretation: Join if( x > 0 ) true false

Smooth Interpretation: Join if( x > 0 ) true false

Does this work?

Does this work?

Back to thermostat original �� =13 �� =1 0

Back to thermostat original �� =13 �� =1 0

Parallel Parking Result of Search With Smoothing Result of Search Without Smoothing

Parallel Parking Result of Search With Smoothing Result of Search Without Smoothing

Conclusions • • Numerical methods can benefit program analysis They can not be applied

Conclusions • • Numerical methods can benefit program analysis They can not be applied blindly – numerical methods work better in continuous spaces – continuous approximations essential for good results – insights about program semantics are crucial