90 likes | 226 Views
Randomized Analysis with Repeated Conditionals for Affine Equalities. Bor-Yuh Evan Chang CS263 Final Project December 4, 2002. Using Randomization. Goal: Use randomized approaches to: obtain more complete analyses ( i.e. discover more properties of programs) more efficient algorithms
E N D
Randomized Analysis with Repeated Conditionals for Affine Equalities Bor-Yuh Evan Chang CS263 Final Project December 4, 2002
Using Randomization • Goal: • Use randomized approaches to: • obtain more complete analyses (i.e. discover more properties of programs) • more efficient algorithms • simpler to implement or understand • Maintain soundness with very high probability • My Contribution: • Build on existing techniques for discovering affine equalities [Gulwani and Necula ’03] • Obtain a more complete analysis with respect to repeated conditionals.
Arbitrary conditionals c = 1 p, d – a 5 p Equivalent conditionals c = 1 p, d – a = 5 X c = 1 X, d – a = 5 X Same weights for equivalent conditionals c = 1 X, d – a = 5 p Problem c1 a := 0 b := 1 a := 1 b := 2 a := 1 b := 5 w1 = 4 a = -3, b = -2 a = -3, b = -11 c1 c := b - a d := 5 c := 1 d := 6 w1 = 4 w2 = -2 c = 1, d = 6 c = -8, d = 5 c = 1, d = 5 c = 19, d = 8 c = 1, d = 8 c = -35, d = 2 c = 1? d – a = 5?
Intuition: If w1 is selected from {0, 1}, then we’re evaluating a specific path. w12 = w1 w1(1 – w1) = 0 (1 – w1)2 = (1 – w1) Naïve Solution: Don’t combine if “defined under” a “repeated” conditional. Problem c1 a := 0 b := 1 a := 1 b := 5 a = w1¢ 0 + (1 – w1) ¢ 1, b = w1¢ 1 + (1 – w1) ¢ 5 c1 c := b - a c := 1 c = 1 c = w1¢ 1 + (1 – w1) ¢ 4 c = w1¢ (w1¢ 1 + (1 – w1) ¢ 4) + (1 – w1) ¢ 1 c = w12¢ 1 + w1(1 – w1) ¢ 4 + (1 – w1) ¢ 1 c = 1?
Fork-Join Programs • Affine equations and fork-join programs • “noise” terms occur from “defined with some conditional c” and then “used under some conditional c”
Randomized Interpreter where K = dom(V) and sample S is a collection of states
Example p a – b – y = 0? weight(c1) = 2, weight(c2) = 4
Summary • Avoids always performing an exponential analysis • Should be sound with high probability as before • Can be used incrementally • Consider no conditionals repeated • Add some conditionals that may be considered repeated
Future Work • Implement and test on some examples • Extend to non-fork-join programs • Dependence between conditionals beyond equivalent conditionals • Non-abstract conditionals • Apply to handling memory operations???