BIRD: Engineering an Efficient CNF-XOR SAT Solver and its - - PowerPoint PPT Presentation

bird engineering an efficient cnf xor sat solver and its
SMART_READER_LITE
LIVE PREVIEW

BIRD: Engineering an Efficient CNF-XOR SAT Solver and its - - PowerPoint PPT Presentation

BIRD: Engineering an Efficient CNF-XOR SAT Solver and its Applications to Approximate Model Counting Mate Soos Kuldeep S. Meel National University of Singapore AAAI 2019 1/15 Model Counting Given Boolean variables X 1 , X 2 ,


slide-1
SLIDE 1

BIRD: Engineering an Efficient CNF-XOR SAT Solver and its Applications to Approximate Model Counting

Mate Soos Kuldeep S. Meel

National University of Singapore

AAAI 2019

1/15

slide-2
SLIDE 2

Model Counting

  • Given

– Boolean variables X1, X2, · · · Xn – Formula F over X1, X2, · · · Xn

  • Sol(F) = { solutions of F }
  • SAT: Determine whether Sol(F) is non-empty

2/15

slide-3
SLIDE 3

Model Counting

  • Given

– Boolean variables X1, X2, · · · Xn – Formula F over X1, X2, · · · Xn

  • Sol(F) = { solutions of F }
  • SAT: Determine whether Sol(F) is non-empty
  • Model Counting: Determine |Sol(F)|

2/15

slide-4
SLIDE 4

Model Counting

  • Given

– Boolean variables X1, X2, · · · Xn – Formula F over X1, X2, · · · Xn

  • Sol(F) = { solutions of F }
  • SAT: Determine whether Sol(F) is non-empty
  • Model Counting: Determine |Sol(F)|
  • Given

– F := (X1 ∨ X2)

  • Sol(F) = {(0, 1), (1, 0), (1, 1)}

2/15

slide-5
SLIDE 5

Model Counting

  • Given

– Boolean variables X1, X2, · · · Xn – Formula F over X1, X2, · · · Xn

  • Sol(F) = { solutions of F }
  • SAT: Determine whether Sol(F) is non-empty
  • Model Counting: Determine |Sol(F)|
  • Given

– F := (X1 ∨ X2)

  • Sol(F) = {(0, 1), (1, 0), (1, 1)}
  • |Sol(F)| = 3

2/15

slide-6
SLIDE 6

Applications across Computer Science

Counting

Network Reliability Probabilistic Inference Quantified Information Flow Program Synthesis

(DMPV, AAAI17) (CFMSV, AAAI14), (IMMV, CP15), (CFMV, IJCAI15), (CMMV, AAAI16), (CMV, IJCAI16) Fremont, Rabe and Seshia 2017, BEHLM Q-18, Bang-2018 (CFMSV, AAAI14), Fremont et al 2017, Ellis et al 2017, Raghothaman et al 2018

3/15

slide-7
SLIDE 7

Model Counting

  • Given

– Boolean variables X1, X2, · · · Xn – Formula F over X1, X2, · · · Xn

  • Exact Counting: #P-complete

(Valiant 1979)

4/15

slide-8
SLIDE 8

Model Counting

  • Given

– Boolean variables X1, X2, · · · Xn – Formula F over X1, X2, · · · Xn

  • Exact Counting: #P-complete

(Valiant 1979)

  • ApproxCount(F, ε, δ): Compute C such that

Pr[|Sol(F)| 1 + ε ≤ C ≤ |Sol(F)|(1 + ε)] ≥ 1 − δ

4/15

slide-9
SLIDE 9

As Simple as Counting Dots

5/15

slide-10
SLIDE 10

As Simple as Counting Dots

5/15

slide-11
SLIDE 11

As Simple as Counting Dots

Pick a random cell Estimate = Number of solutions in a cell × Number of cells

5/15

slide-12
SLIDE 12

Challenges

How to partition into roughly equal small cells of solutions without knowing the distribution of solutions?

6/15

slide-13
SLIDE 13

Challenges

How to partition into roughly equal small cells of solutions without knowing the distribution of solutions?

  • Use random XORs (x1 ⊕ x3 = 0)
  • F = C1 ∧ C2 · · · Cm
  • G = F ∧ XOR1 ∧ XOR2 · · · XORk.
  • Need a Good SAT Solver to handle CNF+XORs

6/15

slide-14
SLIDE 14

CryptoMiniSAT: Gaussian Elimination Meets CDCL Solving

Soos et al 2009

  • Perform CDCL on CNF Formula
  • Perform Gaussian Elimination on XORs
  • Exchange Unit/Binary Clauses

7/15

slide-15
SLIDE 15

CryptoMiniSAT: Gaussian Elimination Meets CDCL Solving

Soos et al 2009

  • Perform CDCL on CNF Formula
  • Perform Gaussian Elimination on XORs
  • Exchange Unit/Binary Clauses
  • Significantly better than performing CDCL Solving

7/15

slide-16
SLIDE 16

CryptoMiniSAT: Gaussian Elimination Meets CDCL Solving

Soos et al 2009

  • Perform CDCL on CNF Formula
  • Perform Gaussian Elimination on XORs
  • Exchange Unit/Binary Clauses
  • Significantly better than performing CDCL Solving
  • But

7/15

slide-17
SLIDE 17

CryptoMiniSAT: Gaussian Elimination Meets CDCL Solving

Soos et al 2009

  • Perform CDCL on CNF Formula
  • Perform Gaussian Elimination on XORs
  • Exchange Unit/Binary Clauses
  • Significantly better than performing CDCL Solving
  • But the formula in XORs never benefit from CDCL steps, in

particular inprocessing steps

7/15

slide-18
SLIDE 18

Research Meets Beers

Why not perform CDCL and Gaussian Elimination on the entire problem again and again.

(This research is not supported by an IPA brewery).

8/15

slide-19
SLIDE 19

Research Meets Beers

Why not perform CDCL and Gaussian Elimination on the entire problem again and again.

(This research is not supported by an IPA brewery).

  • B: Blast XORs into CNF

8/15

slide-20
SLIDE 20

Research Meets Beers

Why not perform CDCL and Gaussian Elimination on the entire problem again and again.

(This research is not supported by an IPA brewery).

  • B: Blast XORs into CNF
  • I: Perform CDCL (in particular,

Inprocessing)

8/15

slide-21
SLIDE 21

Research Meets Beers

Why not perform CDCL and Gaussian Elimination on the entire problem again and again.

(This research is not supported by an IPA brewery).

  • B: Blast XORs into CNF
  • I: Perform CDCL (in particular,

Inprocessing)

  • R: Recover XORs from CNF and

perform Gaussian Elimination

8/15

slide-22
SLIDE 22

Research Meets Beers

Why not perform CDCL and Gaussian Elimination on the entire problem again and again.

(This research is not supported by an IPA brewery).

  • B: Blast XORs into CNF
  • I: Perform CDCL (in particular,

Inprocessing)

  • R: Recover XORs from CNF and

perform Gaussian Elimination

  • D: Destroy the XORs

8/15

slide-23
SLIDE 23

Research Meets Beers

Why not perform CDCL and Gaussian Elimination on the entire problem again and again.

(This research is not supported by an IPA brewery).

BIRD

  • B: Blast XORs into CNF
  • I: Perform CDCL (in particular,

Inprocessing)

  • R: Recover XORs from CNF and

perform Gaussian Elimination

  • D: Destroy the XORs
  • Loop until SAT or UNSAT

8/15

slide-24
SLIDE 24

Research Meets Beers

Why not perform CDCL and Gaussian Elimination on the entire problem again and again.

(This research is not supported by an IPA brewery).

BIRD

  • B: Blast XORs into CNF
  • I: Perform CDCL (in particular,

Inprocessing)

  • R: Recover XORs from CNF and

perform Gaussian Elimination

  • D: Destroy the XORs
  • Loop until SAT or UNSAT

Challenge 1 Can you recover XORs from CNF efficiently? (Multiple times!) Faster than reading all the clauses! Challenge 2 Handling backtracking to avoid repeated Gaussian Elimination

8/15

slide-25
SLIDE 25

Experimental Results

  • ApproxMC3 = ApproxMC2+BIRD
  • 1896 Benchmarks from probabilistic reasoning, quantified

information flow, program synthesis, functional synthesis....

9/15

slide-26
SLIDE 26

Experimental Results

  • ApproxMC3 = ApproxMC2+BIRD
  • 1896 Benchmarks from probabilistic reasoning, quantified

information flow, program synthesis, functional synthesis....

  • Runtime performance comparison between ApproxMC2 and

ApproxMC3

  • More results in the paper

9/15

slide-27
SLIDE 27

Experimental Results-I

200 400 600 800 1000 1200 instances 1000 2000 3000 4000 5000 CPU time (s) ApproxMC3 ApproxMC2

ApproxMC3 solves 648 benchmarks more than ApproxMC2

10/15

slide-28
SLIDE 28

Experimental Results-II

Benchmark Vars Clauses ApproxMC2 ApproxMC3 time time

  • r-50-10-9-UC-30

100 260 1814.78 2.66 blasted squaring28 1060 3839 1845.47 2.48 55.sk 3 46 3128 12145 TO 1.35 s838 7 4 616 1490 TO 3.91 min-3s 431 1373 TO 3.86 blasted case210 872 2937 TO 5.93 blasted squaring16 1627 5835 TO 11.12

  • r-60-5-2-UC-30

120 315 TO 11.09 s5378a 3 2 3679 8372 TO 68.2 modexp8-4-1 79409 288110 TO 255.05 reverse.sk 11 258 75641 380869 TO 23.4 hash-6 282521 1133816 TO 246.04 modexp8-5-8 101553 402654 TO 1166.54 hash-11-8 518009 2078959 TO 4908.15 karatsuba.sk 7 41 19594 82417 TO 4865.53 01B-3 23393 103379 TO 4275.08

TO: Timeout after 5000 seconds Mean Speedup of ApproxMC3 over ApproxMC2: 284.40

11/15

slide-29
SLIDE 29

Conclusion

  • CNF+XOR Handling is crucial for approximate model counting

(and other hashing-based algorithms)

  • Previous architecture for CNF+XOR did not allow in-processing

and CDCL over XOR formulas

  • We propose a new framework BIRD to have the best of both the

worlds: CDCL+Gaussian Elimination

  • Significant runtime improvement
  • Open-source tool https://tinyurl.com/approxmc

12/15

slide-30
SLIDE 30

B: Blast XORs into CNF

(x1 ∨ x2 ∨ ¬x3) (x1 ∨ ¬x2 ∨ x3) (¬x1 ∨ x2 ∨ x3) (¬x1 ∨ ¬x2 ∨ ¬x3) ⇔ x1 ⊕ x2 ⊕ x3 = 0 (1)

13/15

slide-31
SLIDE 31

I: Inprocessing

(x1 ∨ x2) subsumes (x1 ∨ x2 ∨ ¬x3) (2) (x1 ∨ ¬¬x2) subsumes (x1 ∨ ¬x2 ∨ x3) (3)

14/15

slide-32
SLIDE 32

R: Recover

(x1 ∨ x2 ∨ ¬x3) (x1 ∨ ¬x2 ∨ x3) (¬x1 ∨ x2 ∨ x3) (¬x1 ∨ ¬x2 ∨ ¬x3) ⇔ x1 ⊕ x2 ⊕ x3 = 0 (4)

15/15

slide-33
SLIDE 33

R: Recover

(x1 ∨ x2) (x1 ∨ ¬x2) (¬x1 ∨ x2 ∨ x3) (¬x1 ∨ ¬x2 ∨ ¬x3) → x1 ⊕ x2 ⊕ x3 = 0 (4)

15/15