conflict driven clause learning
play

Conflict-Driven Clause Learning Armin Biere SAT/SMT/AR Summer - PowerPoint PPT Presentation

Conflict-Driven Clause Learning Armin Biere SAT/SMT/AR Summer School 2019 Lisbon, Portugal July 4, 2019 Dress Code Summer School Speaker as SAT Problem propositional logic: variables tie shirt negation (not) disjunction (or)


  1. Conflict-Driven Clause Learning Armin Biere SAT/SMT/AR Summer School 2019 Lisbon, Portugal July 4, 2019

  2. Dress Code Summer School Speaker as SAT Problem propositional logic: variables tie shirt negation ¬ (not) disjunction ∨ (or) conjunction ∧ (and) clauses (conditions / constraints) 1. clearly one should not wear a tie without a shirt ¬ tie ∨ shirt 2. not wearing a tie nor a shirt is impolite tie ∨ shirt 3. wearing a tie and a shirt is overkill ¬ ( tie ∧ shirt ) ≡ ¬ tie ∨¬ shirt Is this formula in conjunctive normal form (CNF) satisfiable? ( ¬ tie ∨ shirt ) ∧ ( tie ∨ shirt ) ∧ ( ¬ tie ∨¬ shirt )

  3. What is Practical SAT Solving? reencoding encoding inprocessing simplifying search CDCL

  4. Equivalence Checking If-Then-Else Chains original C code optimized C code if(!a && !b) h(); if(a) f(); else if(!a) g(); else if(b) g(); else f(); else h(); ⇓ ⇑ if(!a) { if(a) f(); ⇒ else { if(!b) h(); else g(); if(!b) h(); } else f(); else g(); } How to check that these two versions are equivalent?

  5. Compilation ≡ if ¬ a ∧¬ b then h else if ¬ a then g else f original ≡ ( ¬ a ∧¬ b ) ∧ h ∨ ¬ ( ¬ a ∧¬ b ) ∧ if ¬ a then g else f ≡ ( ¬ a ∧¬ b ) ∧ h ∨ ¬ ( ¬ a ∧¬ b ) ∧ ( ¬ a ∧ g ∨ a ∧ f ) ≡ optimized if a then f else if b then g else h ≡ a ∧ f ∨ ¬ a ∧ if b then g else h ≡ a ∧ f ∨ ¬ a ∧ ( b ∧ g ∨ ¬ b ∧ h ) ( ¬ a ∧¬ b ) ∧ h ∨ ¬ ( ¬ a ∧¬ b ) ∧ ( ¬ a ∧ g ∨ a ∧ f ) �⇔ a ∧ f ∨ ¬ a ∧ ( b ∧ g ∨ ¬ b ∧ h ) satisfying assignment gives counter-example to equivalence

  6. Tseitin Transformation: Circuit to CNF y o ∧ ( x ↔ a ∧ c ) ∧ x ( y ↔ b ∨ x ) ∧ o ( u ↔ a ∨ b ) ∧ u a ( v ↔ b ∨ c ) ∧ ( w ↔ u ∧ v ) ∧ b w w ( o ↔ y ⊕ w ) v c o ∧ ( x → a ) ∧ ( x → c ) ∧ ( x ← a ∧ c ) ∧ ... o ∧ ( x ∨ a ) ∧ ( x ∨ c ) ∧ ( x ∨ a ∨ c ) ∧ ...

  7. Tseitin Transformation: Gate Constraints x ↔ y ⇔ ( x → y ) ∧ ( y → x ) Negation: ⇔ ( x ∨ y ) ∧ ( y ∨ x ) Disjunction: x ↔ ( y ∨ z ) ⇔ ( y → x ) ∧ ( z → x ) ∧ ( x → ( y ∨ z )) ⇔ ( y ∨ x ) ∧ ( z ∨ x ) ∧ ( x ∨ y ∨ z ) Conjunction: x ↔ ( y ∧ z ) ⇔ ( x → y ) ∧ ( x → z ) ∧ (( y ∧ z ) → x ) ⇔ ( x ∨ y ) ∧ ( x ∨ z ) ∧ (( y ∧ z ) ∨ x ) ⇔ ( x ∨ y ) ∧ ( x ∨ z ) ∧ ( y ∨ z ∨ x ) Equivalence: x ↔ ( y ↔ z ) ⇔ ( x → ( y ↔ z )) ∧ (( y ↔ z ) → x ) ⇔ ( x → (( y → z ) ∧ ( z → y )) ∧ (( y ↔ z ) → x ) ⇔ ( x → ( y → z )) ∧ ( x → ( z → y )) ∧ (( y ↔ z ) → x ) ⇔ ( x ∨ y ∨ z ) ∧ ( x ∨ z ∨ y ) ∧ (( y ↔ z ) → x ) ⇔ ( x ∨ y ∨ z ) ∧ ( x ∨ z ∨ y ) ∧ ((( y ∧ z ) ∨ ( y ∧ z )) → x ) ⇔ ( x ∨ y ∨ z ) ∧ ( x ∨ z ∨ y ) ∧ (( y ∧ z ) → x ) ∧ (( y ∧ z ) → x ) ⇔ ( x ∨ y ∨ z ) ∧ ( x ∨ z ∨ y ) ∧ ( y ∨ z ∨ x ) ∧ ( y ∨ z ∨ x )

  8. Bit-Blasting of Bit-Vector Addition addition of 4-bit numbers x , y with result s also 4-bit: s = x + y [ s 3 , s 2 , s 1 , s 0 ] 4 = [ x 3 , x 2 , x 1 , x 0 ] 4 +[ y 3 , y 2 , y 1 , y 0 ] 4 [ s 3 , · ] 2 = FullAdder ( x 3 , y 3 , c 2 ) [ s 2 , c 2 ] 2 = FullAdder ( x 2 , y 2 , c 1 ) [ s 1 , c 1 ] 2 = FullAdder ( x 1 , y 1 , c 0 ) [ s 0 , c 0 ] 2 = FullAdder ( x 0 , y 0 , false ) where [ s , o ] 2 = FullAdder ( x , y , i ) with = s x xor y xor i = ( x ∧ y ) ∨ ( x ∧ i ) ∨ ( y ∧ i ) = (( x + y + i ) ≥ 2 ) o

  9. Boolector Architecture API subst Expr BTOR parse O2 Expr synthesize slice rewrite SMT norm O1 AIG Vector O3 O1 = bottom up simplification optimize O2 = global but almost linear O3 = normalizing (often non−linear) [default] AIG Lingeling / PicoSAT / MiniSAT / CaDiCaL encode SAT Solver CNF

  10. Intermediate Representations encoding directly into CNF is hard, so we use intermediate levels: 1. application level 2. bit-precise semantics world-level operations (bit-vectors) 3. bit-level representations such as And-Inverter Graphs (AIGs) 4. conjunctive normal form (CNF) encoding “logical” constraints is another story

  11. XOR as AIG x y negation/sign are edge attributes not part of node x xor y ≡ ( x ∧ y ) ∨ ( x ∧ y ) ≡ ( x ∧ y ) ∧ ( x ∧ y )

  12. O0 O0 106 50 ��ΦΜΞ�ΕΗΗΙς O1 102 104 110 94 100 O1 46 48 O2 108 92 98 96 54 38 44 114 86 90 32 30 O3 112 84 88 34 2[0] 1[0] O2 52 36 42 40 118 78 82 2 4 O4 116 76 80 36 1[1] 2[1] O3 58 30 34 14 16 122 70 74 6 8 62 56 28 32 18 1[0] 2[0] O5 120 68 72 38 1[2] 2[2] 126 62 66 10 12 60 22 26 4 2 O6 124 60 64 40 1[3] 2[3] 10 12 24 20 2[1] 1[1] O7 130 54 58 16 14 134 128 52 56 42 2[4] 1[4] 1[3] 2[3] 6 8 132 46 50 20 18 1[2] 2[2] 26 28 48 44 2[5] 1[5] ��ΦΜΞ�ΕΗΗΙς 1[7] 2[7] 22 24 1[6] 2[6]

  13. O0 O6 O1 O2 O7 O4 O5 O3 130 O8 334 216 O14 O9 254 348 O10 306 O15 320 O12 292 O13 O11 84 174 328 236 300 128 350 314 332 362 342 274 214 352 252 346 354 364 304 358 318 290 360 356 82 172 234 298 312 326 272 126 330 340 2 212 250 344 302 316 288 60 80 150 170 224 294 232 308 322 296 262 270 104 336 310 324 2[0] 194 124 244 338 248 210 282 286 58 148 222 78 168 230 260 102 268 4 192 242 246 280 208 284 122 48 56 138 146 218 220 68 76 256 166 158 226 228 264 258 92 266 100 2[1] 182 190 238 240 276 278 112 202 206 120 46 136 54 144 66 74 164 156 90 6 180 98 188 110 200 204 118 42 44 132 134 50 52 140 142 62 64 72 160 152 162 86 70 154 88 2[2] 176 178 94 96 184 186 106 108 196 198 114 116 8 12 14 16 18 24 20 26 10 22 28 30 32 34 36 38 40 1[0] 1[1] 1[2] 1[3] 1[4] 1[7] 1[5] 1[8] 2[3] 1[6] 1[9] 1[10] 1[11] 1[12] 1[13] 1[14] 1[15] bit-vector of length 16 shifted by bit-vector of length 4

  14. O0 402 400 398 394 396 392 390 32 388 2[0] 386 384 O1 380 382 406 378 376 298 404 374 300 294 296 370 372 290 292 O2 28 366 368 288 410 2[1] 362 364 284 286 214 408 360 302 280 282 212 356 358 276 278 24 210 352 354 274 216 2[2] 350 348 270 272 206 208 O3 346 304 266 268 204 414 344 342 262 264 200 202 146 412 340 338 260 218 196 198 144 334 336 256 258 192 194 20 142 332 306 252 254 190 148 2[3] 328 330 248 250 186 188 138 140 O4 324 326 246 220 182 184 136 418 322 320 242 244 178 180 132 134 94 416 308 238 240 176 150 128 130 92 234 236 172 174 124 126 16 90 318 232 222 168 170 122 96 2[4] 314 316 228 230 164 166 118 120 86 O5 88 310 312 224 162 152 114 116 84 422 30 26 158 160 110 112 80 82 420 58 1[0] 226 1[1] 154 108 98 76 78 56 22 104 106 72 12 74 54 1[2] 156 100 70 2[5] 60 O6 18 102 66 68 50 52 426 1[3] 62 48 38 424 O7 14 64 44 46 36 428 1[4] 40 42 34 6 8 4 10 2 1[7] 2[6] 2[7] 1[5] 1[6]

  15. Encoding Logical Constraints Tseitin construction suitable for most kinds of “model constraints” assuming simple operational semantics: encode an interpreter small domains: one-hot encoding large domains: binary encoding harder to encode properties or additional constraints temporal logic / fix-points environment constraints example for fix-points / recursive equations: x = ( a ∨ y ) , y = ( b ∨ x ) x = y = ( a ∨ b ) has unique least fix-point and unique largest fix-point x = y = true but unfortunately ... ... only largest fix-point can be (directly) encoded in SAT otherwise need stable models / logical programming / ASP

  16. Example of Logical Constraints: Cardinality Constraints given a set of literals { l 1 ,... l n } constraint the number of literals assigned to true l 1 + ··· + l n ≥ k or l 1 + ··· + l n ≤ k or l 1 + ··· + l n = k combined make up exactly all fully symmetric boolean functions multiple encodings of cardinality constraints na¨ ıve encoding exponential: at-most-one quadratic, at-most-two cubic, etc. quadratic O ( k · n ) encoding goes back to Shannon linear O ( n ) parallel counter encoding [Sinz’05] many variants even for at-most-one constraints for an O ( n · log n ) encoding see Prestwich’s chapter in Handbook of SAT Pseudo-Boolean constraints (PB) or 0/1 ILP constraints have many encodings too 2 · a + b + c + d + 2 · e ≥ 3 actually used to handle MaxSAT in SAT4J for configuration in Eclipse

  17. BDD-Based Encoding of Cardinality Constraints 2 ≤ l 1 + ··· l 9 ≤ 3 l 1 l 2 l 3 l 4 l 5 l 6 l 7 l 8 l 9 0 l 2 l 3 l 4 l 5 l 6 l 7 l 8 l 9 0 l 3 l 4 l 5 l 6 l 7 l 8 l 9 1 l 4 l 5 l 6 l 7 l 8 l 9 1 0 0 0 0 0 0 If-Then-Else gates (MUX) with “then” edge downward, dashed “else” edge to the right

Recommend


More recommend