smooth interpretation swarat chaudhuri and armando solar-lezama

15
Smooth Interpretation warat Chaudhuri and Armando Solar-Leza

Upload: avis-andrews

Post on 17-Dec-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

Smooth Interpretation

Swarat Chaudhuri and Armando Solar-Lezama

Page 2: 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:

Page 3: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

The Parameter Synthesis Problem

tem

p

time

75·

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

Page 4: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

Minimization by numerical search

What about gradient descent?

Page 5: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

Smoothing to the Rescue

Page 6: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

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

What if we could do this for programs?

Page 7: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

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

Page 8: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

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

Page 9: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

Smooth Interpretation: Branch

if( x > 0 )

falsetrue

Page 10: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

Smooth Interpretation: Join

if( x > 0 )

falsetrue

Page 11: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

Smooth Interpretation: Join

if( x > 0 )

falsetrue

Page 12: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

Does this work?

Page 13: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

Back to the thermostat

original 𝛽=1 𝛽=13 𝛽=1 0

Page 14: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

Parallel ParkingResult of Search With Smoothing

Result of Search Without Smoothing

Page 15: Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama

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