Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama.

Post on 17-Dec-2015

219 views 1 download

Transcript of Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama.

Smooth Interpretation

Swarat Chaudhuri and Armando Solar-Lezama

The Parameter Synthesis Problem

tOff := ??; tOn := ??; h := ??repeat(Át) { temp := readTemp(); if (isOn() && temp > tOff) switchHeaterOff(); elseif ( !isOn() && temp < tOn) switchHeaterOn(h); }

Cooling:

Warming:

The Parameter Synthesis Problem

tem

p

time

75·

Can we find values of (tOff, tOn, h) to minimize Err?

Minimization by numerical search

What about gradient descent?

Smoothing to the Rescue

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 random

variable with Normal distribution

2. Execute the program on this random variable

3. Return the expected value of the program output

P(x) = if x > 2 then 1 else 0;

Tuning knob: Standard deviation .b

Smooth InterpretationHow 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.

ProgramApproximation of

expected output

Input x

Smooth Interpretation: Branch

if( x > 0 )

falsetrue

Smooth Interpretation: Join

if( x > 0 )

falsetrue

Smooth Interpretation: Join

if( x > 0 )

falsetrue

Does this work?

Back to the thermostat

original 𝛽=1 𝛽=13 𝛽=1 0

Parallel ParkingResult of Search With Smoothing

Result of Search Without Smoothing

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