150 likes | 167 Views
This article explores the application of smoothing techniques in program analysis, specifically focusing on the parameter synthesis problem. It discusses the use of numerical methods and gradient descent for minimization, as well as the benefits of using smoothing to approximate program semantics. The article also highlights the challenges and considerations in executing a program on a distribution of inputs.
E N D
Smooth Interpretation Swarat Chaudhuri and Armando Solar-Lezama
The Parameter Synthesis Problem Warming: tOff := ??; tOn := ??; h := ?? repeat(Át) { temp := readTemp(); if (isOn() && temp > tOff) switchHeaterOff(); elseif( !isOn() && temp < tOn) switchHeaterOn(h); } Cooling:
The Parameter Synthesis Problem temp time 75· Can we find values of (tOff, tOn, h) to minimize Err?
Minimization by numerical search What about gradient descent?
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: • Make input a random variable with Normal distribution • Execute the program on this random variable • Return the expected value of the program output P(x) = if x > 2 then 1 else 0; Tuning knob: Standard deviationb.
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: Join if( x > 0 ) true false
Smooth Interpretation: Join if( x > 0 ) true false
Back to the thermostat original 𝛽=1 𝛽=13 𝛽=1 0
Parallel Parking Result 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