A Scalable and Nearly Uniform Generator of SAT Witnesses Supratik Chakraborty 1 , Kuldeep S Meel 2 , Moshe Y Vardi 2 1 Indian Institute of Technology Bombay, India 2 Department of Computer Science, Rice University CAV 2013
Life in the 21 st Century! How do we guarantee that the systems work correctly ?
Motivating Example How do we verify that this circuit works ? a b • Formal Verification – Not Scalable! 64 bit 64 bit • Randomly sample some a’s and b’s Division circuit • Wait! None of the circuits in the past c = a/b faulted when 10 < b < 40 • Finite resources! 64 bit c • Lets sample from regions where it is likely to fault
Constraints Design 4 Designing Constraints • Designers: b a 1. 100 < b < 200 2. 300 < a < 451 64 bit 64 bit 3. 40 < a < 50 and 30 < b < 40 • Past Experience: c = a b 1. 400 < a < 2000 2. 120 < b < 230 • Users: 64 bit 1. 1000<a < 1100 2. 20000 < b < a < 22000 c Problem: How can we uniformly sample the values of a and b satisfying the above constraints?
Uniform Generation of SAT-Witnesses 5 Set of Constraints SAT Formula Given a SAT formula, can one uniformly sample solutions without enumerating all solutions
Uniform Generation of SAT-Witnesses 6 Set of Constraints SAT Formula Given a SAT formula, can one uniformly sample solutions without enumerating all solutions while scaling to real world problems?
Overview Prior Work & Our Approach Theoretical Results Experimental Results Where do we go from here?
Prior Work 8 BDD-based SAT-based heuristics INDUSTRY Guarantees: strong Guarantees: weak Performance: weak Performance: strong Theoretical Work Heuristic Work Guarantees: strong Guarantees: weak ACADEMIA Performance: weak Performance: strong XORSample ’ BGP Algorithm
Our Contribution 9 BDD-based SAT-based heuristics INDUSTRY Guarantees: strong Guarantees: weak Performance: weak Performance: strong UniWit Guarantees : strong Performance: strong Theoretical Work Heuristic Work Guarantees: strong Guarantees: weak ACADEMIA Performance: weak Performance: strong XORSample ’ BGP Algorithm
Central Idea 10
Partitioning into equal “small” cells 11
How to Partition? 12 How to partition into roughly equal small cells of solutions without knowing the distribution of solutions? Universal Hashing [Carter-Wegman 1979, Sipser 1983]
Lower Universality Lower Complexity 13 H(n,m,r): Family of r-universal hash functions mapping {0,1} n to {0,1} m (2 n elements to 2 m cells) Higher the r => Stronger guarantees on range of size of cells r-wise universality => Polynomials of degree r-1 Lower universality => lower complexity
Hashing-Based Approaches 14 Solution space RF : Solution space n-universal hashing 3-independent ndependent Prior Work BGP Algorithm “ ” Partitioned space “ ” “ ” All cells are “ small ” All cells should be small Uniform Generation
Scaling to Thousands of Variables 15 Solution space RF : Solution space n-universal hashing 2-universal hashing 3-independent ndependent Random Hashing Random Prior Our Work BGP Algorithm Approach UniWit “ ” Partitioned space “ ” Partitioned space “ ” All cells are “ small ” Only a randomly chosen A random cells is “ small ” “ ” All cells should be small cells needs to be “small” Uniform Generation Near Uniform Generation
Scaling to Thousands of Variables 16 Solution space RF : Solution space n-universal hashing 2-independent hashing 3-independent From tens of variables to ndependent Random Hashing Random thousands of variables! Prior Our Work BGP Algorithm Approach UniWit “ ” Partitioned space “ ” Partitioned space “ ” All cells are “ small ” Only a randomly chosen A random cells is “ small ” “ ” All cells should be small cells needs to be “small” Uniform Generation Near Uniform Generation
Highlights 17 Employs XOR-based hash functions instead of computationally infeasible algebraic hash functions Uses off-the-shelf SAT solver CryptoMiniSAT (MiniSAT+XOR support)
Strong Theoretical Guarantees Uniformity For every solution y of R F Pr [y is output] = 1/|R F |
Strong Theoretical Guarantees Near Uniformity For every solution y of R F Pr [y is output] >= 1 /8 x 1/|R F | Success Probability Algorithm UniWit succeeds with probability at least 1/8 Polynomial: O(n 3/2 ) calls to SAT Solver
Experimental Methodology Benchmarks (over 200) Bit-blasted versions of word level constraints from VHDL designs Bit-blasted versions from SMTLib version and ISCAS’85 Objectives Comparison with algorithms BGP & XORSample ’ ◼ Uniformity ◼ Performance
Better Uniformity than State-of-art Generators 21 100000 100000 XORSample’ Uniwit Uniform Uniform Uniform/8 Uniform/8 10000 10000 Frequency 1000 Frequency 1000 100 100 10 10 1 1 0 4000 8000 12000 16000 0 4000 8000 12000 16000 Solutions Solutions XORSample ’ UniWit • Benchmark: case110.cnf; #var: 287; #clauses: 1263 • Total Runs : 1.08x10 8 ; Total Solutions : 16384 • XORSample ’ could not find 772 solutions and more than 250 solutions were generated only once
22 Time(s) 2-3 Orders of Magnitude Faster 100000 10000 1000 100 0.1 10 1 case47 case_3_b14_3 case105 case8 case203 case145 case61 Benchmarks case9 case15 case140 case_2_b14_1 case_3_b14_1 squaring14 squaring7 case_2_ptb_1 case_1_ptb_1 case_2_b14_2 case_3_b14_2 XORSample' UniWit
2-3 Orders of Magnitude Faster 23 100000 10000 1000 • UniWit is is 2-3 orders of magnitude faster than XORSample ’ Time(s) 100 10 • Observed success probability = 0.6 ( >> theoretical guarantee of 0.125) UniWit 1 XORSample' 0.1 case47 case8 case61 case9 case15 squaring14 case_3_b14_3 case105 case203 case145 case140 case_2_b14_1 case_3_b14_1 squaring7 case_2_ptb_1 case_1_ptb_1 case_2_b14_2 case_3_b14_2 Benchmarks
Key Takeaways Uniform sampling is an important problem Prior work didn’t scale or offered weak guarantees We use 2-wise independent hash function to divide solution space into “small” partitions Only a randomly chosen partition has to be small Theoretical guarantees of near uniformity Major improvements in running time and uniformity compared to the existing generators Tool is available at http://www.cfdvs.iitb.ac.in/reports/UniWit/
Where Do We Go From Here? Extension to SMT Extending the technique to model counting (CP’13) Stronger Guarantees Efficient hash functions
Discussion Acknowledgments • NSF • ExCAPE • Intel • BRNS, India • Sun Microsystems • Sigma Solutions,Inc Thank You for your attention!
UniWit R F
UniWit R F NO
UniWit
UniWit NO
UniWit
UniWit YES
UniWit Select a solution randomly with YES probability “c” from the partition. If no solution is picked, return Failure
Recommend
More recommend