on the sparsity of xors in approximate model counting
play

On the Sparsity of XORs in Approximate Model Counting Durgesh - PowerPoint PPT Presentation

On the Sparsity of XORs in Approximate Model Counting Durgesh Agrawal 1 Bhavishya 1 Kuldeep S. Meel 2 1 Indian Institute of Technology, Kanpur 2 School of Computing, National University of Singapore SAT 2020 1/18 Model Counting Given


  1. On the Sparsity of XORs in Approximate Model Counting Durgesh Agrawal 1 Bhavishya 1 Kuldeep S. Meel 2 1 Indian Institute of Technology, Kanpur 2 School of Computing, National University of Singapore SAT 2020 1/18

  2. Model Counting • Given – Boolean variables X 1 , X 2 , · · · X n – Formula F over X 1 , X 2 , · · · X n • Sol( F ) = { solutions of F } 2/18

  3. Model Counting • Given – Boolean variables X 1 , X 2 , · · · X n – Formula F over X 1 , X 2 , · · · X n • Sol( F ) = { solutions of F } • Model Counting: Determine | Sol( F ) | 2/18

  4. Model Counting • Given – Boolean variables X 1 , X 2 , · · · X n – Formula F over X 1 , X 2 , · · · X n • Sol( F ) = { solutions of F } • Model Counting: Determine | Sol( F ) | • Given F := ( X 1 ∨ X 2 ) 2/18

  5. Model Counting • Given – Boolean variables X 1 , X 2 , · · · X n – Formula F over X 1 , X 2 , · · · X n • Sol( F ) = { solutions of F } • Model Counting: Determine | Sol( F ) | • Given F := ( X 1 ∨ X 2 ) • Sol( F ) = { (0 , 1) , (1 , 0) , (1 , 1) } 2/18

  6. Model Counting • Given – Boolean variables X 1 , X 2 , · · · X n – Formula F over X 1 , X 2 , · · · X n • Sol( F ) = { solutions of F } • Model Counting: Determine | Sol( F ) | • Given F := ( X 1 ∨ X 2 ) • Sol( F ) = { (0 , 1) , (1 , 0) , (1 , 1) } • | Sol( F ) | = 3 2/18

  7. Model Counting • Given – Boolean variables X 1 , X 2 , · · · X n – Formula F over X 1 , X 2 , · · · X n • Sol( F ) = { solutions of F } • Model Counting: Determine | Sol( F ) | • Given F := ( X 1 ∨ X 2 ) • Sol( F ) = { (0 , 1) , (1 , 0) , (1 , 1) } • | Sol( F ) | = 3 • Model counting is #P-complete (Valiant 1979) 2/18

  8. Different Shades of Approximation • Probabilistic (1 + ε )-Approximation � | Sol( F ) | � Pr ≤ ApproxCount ( F , ε, δ ) ≤ | Sol( F ) | (1 + ε ) ≥ 1 − δ 1 + ε 3/18

  9. Different Shades of Approximation • Probabilistic (1 + ε )-Approximation � | Sol( F ) | � Pr ≤ ApproxCount ( F , ε, δ ) ≤ | Sol( F ) | (1 + ε ) ≥ 1 − δ 1 + ε • Constant Factor Approximation: (4, δ ) � | Sol( F ) | � Pr ≤ ConstantCount ( F , δ ) ≤ 4 · | Sol( F ) | ≥ 1 − δ 4 3/18

  10. Different Shades of Approximation • Probabilistic (1 + ε )-Approximation � | Sol( F ) | � Pr ≤ ApproxCount ( F , ε, δ ) ≤ | Sol( F ) | (1 + ε ) ≥ 1 − δ 1 + ε • Constant Factor Approximation: (4, δ ) � | Sol( F ) | � Pr ≤ ConstantCount ( F , δ ) ≤ 4 · | Sol( F ) | ≥ 1 − δ 4 • From 4 to 2-factor Let G = F 1 ∧ F 2 (i.e., two identical copies of F ) √ | Sol( G ) | ⇒ | Sol( F ) | ≤ C ≤ 4 · | Sol( G ) | = ≤ C ≤ 2 · | Sol( F ) | 4 2 3/18

  11. Different Shades of Approximation • Probabilistic (1 + ε )-Approximation � | Sol( F ) | � Pr ≤ ApproxCount ( F , ε, δ ) ≤ | Sol( F ) | (1 + ε ) ≥ 1 − δ 1 + ε • Constant Factor Approximation: (4, δ ) � | Sol( F ) | � Pr ≤ ConstantCount ( F , δ ) ≤ 4 · | Sol( F ) | ≥ 1 − δ 4 • From 4 to 2-factor Let G = F 1 ∧ F 2 (i.e., two identical copies of F ) √ | Sol( G ) | ⇒ | Sol( F ) | ≤ C ≤ 4 · | Sol( G ) | = ≤ C ≤ 2 · | Sol( F ) | 4 2 • From 4 to (1 + ε )-factor ε And then we can take 1 Construct G = F 1 ∧ F 2 . . . F 1 ε -root 3/18

  12. Applications across Computer Science Hardware Validation Computational Biology Network Model Reliability Counting Neural Network Robustness Quantified Information Flow 4/18

  13. As Simple as Counting Dots The Rise of Hashing-based Approach: Promise of Scalability and Guarantees (S83,GSS06,GHSS07,CMV13b,EGSS13b,CMV14,CDR15,CMV16,ZCSE16,AD16 KM18,ATD18,SM19,ABM20,SGM20) 5/18

  14. As Simple as Counting Dots 5/18

  15. As Simple as Counting Dots 5/18

  16. As Simple as Counting Dots Pick a random cell Estimate = Number of solutions in a cell × Number of cells 5/18

  17. Challenges Challenge 1 What is exactly a small cell ? 6/18

  18. Challenges Challenge 1 What is exactly a small cell ? Challenge 2 How to partition into roughly equal small cells of solutions without knowing the distribution of solutions? 6/18

  19. Challenges Challenge 1 What is exactly a small cell ? • A cell is small cell if it has ≈ thresh solutions. • Two choices for thresh. – thresh = constant → 4-factor approximation – thresh = O ( 1 ε 2 ) gives (1 + ε )-approximation directly 6/18

  20. Challenges Challenge 1 What is exactly a small cell ? • A cell is small cell if it has ≈ thresh solutions. • Two choices for thresh. – thresh = constant → 4-factor approximation – thresh = O ( 1 ε 2 ) gives (1 + ε )-approximation directly • Z m be the number of solutions in a randomly chosen cell ; we are interested in cases E[ Z m ] ≥ 1 6/18

  21. Challenges Challenge 1 What is exactly a small cell ? • A cell is small cell if it has ≈ thresh solutions. • Two choices for thresh. – thresh = constant → 4-factor approximation – thresh = O ( 1 ε 2 ) gives (1 + ε )-approximation directly • Z m be the number of solutions in a randomly chosen cell ; we are interested in cases E[ Z m ] ≥ 1 • For thresh = O ( 1 ε 2 ), we need dispersion index: σ 2 [ Z m ] (E[ Z m ]) ≤ some constant • For thresh = constant , sufficient to have σ 2 [ Z m ] coefficient of variation: (E[ Z m ]) 2 ≤ some constant 6/18

  22. Challenges Challenge 1 What is exactly a small cell ? • A cell is small cell if it has ≈ thresh solutions. • Two choices for thresh. – thresh = constant → 4-factor approximation – thresh = O ( 1 ε 2 ) gives (1 + ε )-approximation directly • Z m be the number of solutions in a randomly chosen cell ; we are interested in cases E[ Z m ] ≥ 1 • For thresh = O ( 1 ε 2 ), we need dispersion index: σ 2 [ Z m ] (E[ Z m ]) ≤ some constant • For thresh = constant , sufficient to have σ 2 [ Z m ] coefficient of variation: (E[ Z m ]) 2 ≤ some constant Techniques based on thresh = O ( 1 ε 2 ) such as ApproxMC scale significantly better than those based on thresh = constant . 6/18

  23. Challenges Challenge 1 What is exactly a small cell ? Challenge 2 How to partition into roughly equal small cells of solutions without knowing the distribution of solutions? 7/18

  24. Challenges Challenge 1 What is exactly a small cell ? Challenge 2 How to partition into roughly equal small cells of solutions without knowing the distribution of solutions? • Designing function h : assignments → cells (hashing) • Solutions in a cell α : Sol( F ) ∩ { y | h ( y ) = α } 7/18

  25. Challenges Challenge 1 What is exactly a small cell ? Challenge 2 How to partition into roughly equal small cells of solutions without knowing the distribution of solutions? • Designing function h : assignments → cells (hashing) • Solutions in a cell α : Sol( F ) ∩ { y | h ( y ) = α } • Choose h randomly from a specially constructed large family H of hash functions Carter and Wegman 1977 7/18

  26. 2-wise Independent Hashing • Let H be family of 2-wise independent hash functions mapping { 0 , 1 } n to { 0 , 1 } m R ∀ y 1 , y 2 ∈ { 0 , 1 } n , α 1 , α 2 ∈ { 0 , 1 } m , h ← − H � 1 � Pr[ h ( y 1 ) = α 1 ] = Pr[ h ( y 2 ) = α 2 ] = 2 m � 1 � 2 Pr[ h ( y 1 ) = α 1 ∧ h ( y 2 ) = α 2 ] = 2 m 8/18

  27. 2-wise Independent Hashing • Let H be family of 2-wise independent hash functions mapping { 0 , 1 } n to { 0 , 1 } m R ∀ y 1 , y 2 ∈ { 0 , 1 } n , α 1 , α 2 ∈ { 0 , 1 } m , h ← − H � 1 � Pr[ h ( y 1 ) = α 1 ] = Pr[ h ( y 2 ) = α 2 ] = 2 m � 1 � 2 Pr[ h ( y 1 ) = α 1 ∧ h ( y 2 ) = α 2 ] = 2 m • The power of 2-wise independence – Z m be the number of solutions in a randomly chosen cell – E[ Z m ] = | Sol( F ) | 2 m – σ 2 [ Z m ] ≤ E[ Z m ] 8/18

  28. 2-wise Independent Hashing • Let H be family of 2-wise independent hash functions mapping { 0 , 1 } n to { 0 , 1 } m R ∀ y 1 , y 2 ∈ { 0 , 1 } n , α 1 , α 2 ∈ { 0 , 1 } m , h ← − H � 1 � Pr[ h ( y 1 ) = α 1 ] = Pr[ h ( y 2 ) = α 2 ] = 2 m � 1 � 2 Pr[ h ( y 1 ) = α 1 ∧ h ( y 2 ) = α 2 ] = 2 m • The power of 2-wise independence – Z m be the number of solutions in a randomly chosen cell – E[ Z m ] = | Sol( F ) | 2 m – σ 2 [ Z m ] ≤ E[ Z m ] (Interested only in the cases when E[ Z m ] ≥ 1 ) 8/18

  29. 2-wise Independent Hashing • Let H be family of 2-wise independent hash functions mapping { 0 , 1 } n to { 0 , 1 } m R ∀ y 1 , y 2 ∈ { 0 , 1 } n , α 1 , α 2 ∈ { 0 , 1 } m , h ← − H � 1 � Pr[ h ( y 1 ) = α 1 ] = Pr[ h ( y 2 ) = α 2 ] = 2 m � 1 � 2 Pr[ h ( y 1 ) = α 1 ∧ h ( y 2 ) = α 2 ] = 2 m • The power of 2-wise independence – Z m be the number of solutions in a randomly chosen cell – E[ Z m ] = | Sol( F ) | 2 m – σ 2 [ Z m ] ≤ E[ Z m ] (Interested only in the cases when E[ Z m ] ≥ 1 ) – Z m be the number of solutions in a randomly chosen cell σ 2 [ Z m ] – dispersion index: E[ Z m ] ≤ 1 σ 2 [ Z m ] – coefficient of variation: (E[ Z m ]) 2 ≤ 1 8/18

  30. 2-wise Independent Hashing • Variables: X 1 , X 2 , · · · X n • To construct h : { 0 , 1 } n → { 0 , 1 } m , choose m random XORs • Pick every X i with prob. 1 2 and XOR them – X 1 ⊕ X 3 ⊕ X 6 · · · ⊕ X n − 2 – Expected size of each XOR: n 2 9/18

Recommend


More recommend