Download presentation
Presentation is loading. Please wait.
1
Randomized Analysis with Repeated Conditionals for Affine Equalities Bor-Yuh Evan Chang CS263 Final Project December 4, 2002
2
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.
3
c = 1, d = 8 c = 1, d = 5 c = 19, d = 8 c = -8, d = 5 a = -3, b = -11 a := 1 b := 2 a := 1 b := 5 Problem 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 a := 0 b := 1 c := b - a d := 5 c := 1 d := 6 c = 1? d – a = 5? w 1 = 4 a = -3, b = -2 w 2 = -2 c = 1, d = 6 c1c1 c1c1 w 1 = 4 c = -35, d = 2
4
Problem Intuition: If w 1 is selected from {0, 1}, then we’re evaluating a specific path. w 1 2 = w 1 w 1 (1 – w 1 ) = 0 (1 – w 1 ) 2 = (1 – w 1 ) Naïve Solution: Don’t combine if “defined under” a “repeated” conditional. c = w 1 ¢ (w 1 ¢ 1 + (1 – w 1 ) ¢ 4) + (1 – w 1 ) ¢ 1 c = w 1 ¢ 1 + (1 – w 1 ) ¢ 4 a = w 1 ¢ 0 + (1 – w 1 ) ¢ 1, b = w 1 ¢ 1 + (1 – w 1 ) ¢ 5 a := 1 b := 5 a := 0 b := 1 c := b - ac := 1 c = 1? c = 1 c1c1 c1c1 c = w 1 2 ¢ 1 + w 1 (1 – w 1 ) ¢ 4 + (1 – w 1 ) ¢ 1
5
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”
6
Randomized Interpreter where K = dom(V) and sample S is a collection of states
7
Example a – b – y = 0? weight(c 1 ) = 2, weight(c 2 ) = 4 p
8
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
9
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???
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.