synthesis of domain specific encoders for bit vector
play

Synthesis of Domain Specific Encoders for Bit- Vector Solvers - PowerPoint PPT Presentation

Synthesis of Domain Specific Encoders for Bit- Vector Solvers Jeevana Priya Inala with Rohit Singh, Armando Solar-Lezama Appears in SAT16 High-level constraint to CNF clauses SMT solver SAT solver High-level constraint CNF clauses msb


  1. Synthesis of Domain Specific Encoders for Bit- Vector Solvers Jeevana Priya Inala with Rohit Singh, Armando Solar-Lezama Appears in SAT’16

  2. High-level constraint to CNF clauses SMT solver SAT solver High-level constraint CNF clauses msb lsb y x > o1 ite o2 ….

  3. High-level constraint to CNF clauses SMT solver SAT solver High-level constraint CNF clauses y 1 ∨ x 1 ∨ t 1 t 1 ∨ y 0 ∨ x 0 ∨ t 2 y 1 ∨ x 1 ∨ t 1 t 3 ∨ y 1 msb lsb y 1 ∨ x 1 ∨ t 1 t 3 ∨ x 1 y 1 ∨ x 1 ∨ t 1 y 1 ∨ x 1 ∨ t 3 y x t 2 ∨ t 1 o 1 ∨ t 2 t 2 ∨ y 0 o 1 ∨ t 3 t 2 ∨ x 0 t 2 ∨ t 3 ∨ o 1 Is this the “best” > encoding? o1 ite o 1 ∨ x 1 ∨ o 2 1 o 1 ∨ x 0 ∨ o 2 0 o 1 ∨ x 1 ∨ o 2 1 o 1 ∨ x 0 ∨ o 2 0 o2 o 1 ∨ y 1 ∨ o 2 1 o 1 ∨ y 0 ∨ o 2 0 o 1 ∨ y 1 ∨ o 2 1 o 1 ∨ y 0 ∨ o 2 0 x 1 ∨ y 1 ∨ o 2 1 x 0 ∨ y 0 ∨ o 2 0 …. x 1 ∨ y 1 ∨ o 2 1 x 0 ∨ y 0 ∨ o 2 0 …. Goal: Synthesize better code for this translation

  4. How SAT solvers work? SAT solvers use unit propagation to infer variable • assignments

  5. How SAT solvers work? SAT solvers use unit propagation to infer variable • assignments Current variables assignment x 1 = F, x 2 = T, x 3 = F, x 4 = F

  6. How SAT solvers work? SAT solvers use unit propagation to infer variable • assignments Current variables assignment x 1 = F, x 2 = T, x 3 = F, x 4 = F false Unit clause x 1 ∨ x 2 ∨ x 4 ∨ x 5

  7. How SAT solvers work? SAT solvers use unit propagation to infer variable • assignments Current variables assignment x 1 = F, x 2 = T, x 3 = F, x 4 = F, x 5 = T x 1 ∨ x 2 ∨ x 4 ∨ x 5

  8. Criteria for a good encoding Maximal propagation • Maximize what we learn through unit propagations • Fewer clauses • Fewer variables •

  9. msb lsb y 1 ∨ x 1 ∨ t 1 t 1 ∨ y 0 ∨ x 0 ∨ t 2 1 y 1 ∨ x 1 ∨ t 1 t 3 ∨ y 1 y x y 1 ∨ x 1 ∨ t 1 t 3 ∨ x 1 y 1 ∨ x 1 ∨ t 1 y 1 ∨ x 1 ∨ t 3 t 2 ∨ t 1 o 1 ∨ t 2 > t 2 ∨ y 0 o 1 ∨ t 3 t 2 ∨ x 0 t 2 ∨ t 3 ∨ o 1 o1 ite o2 o 1 ∨ x 1 ∨ o 2 1 o 1 ∨ x 0 ∨ o 2 0 1 o 1 ∨ x 1 ∨ o 2 1 o 1 ∨ x 0 ∨ o 2 0 o 1 ∨ y 1 ∨ o 2 1 o 1 ∨ y 0 ∨ o 2 0 o 1 ∨ y 1 ∨ o 2 1 o 1 ∨ y 0 ∨ o 2 0 x 1 ∨ y 1 ∨ o 2 1 x 0 ∨ y 0 ∨ o 2 0 x 1 ∨ y 1 ∨ o 2 1 x 0 ∨ y 0 ∨ o 2 0 Unit prop x 1 = 1 → o 2 1 = 1 − − − − − − Composing encodings does not preserve optimality

  10. Focus on optimizing encodings for these patterns

  11. How do we come Do these encodings What patterns to up with “optimal” actually improve the target? encoding for a performance? pattern?

  12. How do we come Do these encodings What patterns to up with “optimal” actually improve the target? encoding for a performance? pattern? x y > ite Synthesis of Auto-tuning Pattern Finding Patterns Encodings Encodings (Machine (Sampling) (Sketch) Learning) Optimal solver Corpus of benchmarks

  13. Related Work Automatic Generation of Propagation Complete SAT • Encodings ( VMCAI’16) Algorithm configuration for solver parameters • Logic synthesis based SMT solvers •

  14. x y > ite Synthesis of Auto-tuning Pattern Finding Patterns Encodings Encodings (Machine (Sampling) (Sketch) Learning) Optimal solver Corpus of benchmarks

  15. Synthesis as a SyGus problem Boolean predicate P CNF clauses C Template Sketch Correct program (SyGus solver) Specification

  16. Templates Boolean predicate P CNF clauses C t 1 = true t 2 = true for i from N to 1 : o = ITE N (( GT N , x, y ) , x, y ) t 3 = newV ar t 4 = newV ar clause ( { x [ i ] , y [ i ] , o [ i ] } ) clause ( { x [ i ] , t 1 , t 3 } ) msb lsb clause ( { x [ i ] , t 2 , o [ i ] , t 4 } ) clause ( { x [ i ] , o [ i ] , t 3 } ) y x clause ( { x [ i ] , y [ i ] , o [ i ] } ) clause ( { x [ i ] , t 2 , o [ i ] } ) clause ( { x [ i ] , t 2 , t 4 } ) > clause ( { y [ i ] , t 2 , t 4 } ) clause ( { y [ i ] , o [ i ] , t 3 } ) ite clause ( { y [ i ] , t 1 , t 3 } ) clause ( { y [ i ] , o [ i ] , t 3 } ) o clause ( { t 1 , t 3 } ) clause ( { t 1 , o [ i ] , t 3 } ) clause ( { t 2 , t 4 } ) clause ( { t 3 , t 4 } ) t 1 = t 3 t 2 = t 4

  17. Templates Boolean predicate P CNF clauses C t 1 = true t 2 = true for i from N to 1 : o = ITE N (( GT N , x, y ) , x, y ) t 3 = newV ar t 4 = newV ar clause ( { x [ i ] , y [ i ] , o [ i ] } ) clause ( { x [ i ] , t 1 , t 3 } ) msb lsb clause ( { x [ i ] , t 2 , o [ i ] , t 4 } ) clause ( { x [ i ] , o [ i ] , t 3 } ) y x clause ( { x [ i ] , y [ i ] , o [ i ] } ) clause ( { x [ i ] , t 2 , o [ i ] } ) clause ( { x [ i ] , t 2 , t 4 } ) > clause ( { y [ i ] , t 2 , t 4 } ) clause ( { y [ i ] , o [ i ] , t 3 } ) ite clause ( { y [ i ] , t 1 , t 3 } ) clause ( { y [ i ] , o [ i ] , t 3 } ) o clause ( { t 1 , t 3 } ) clause ( { t 1 , o [ i ] , t 3 } ) clause ( { t 2 , t 4 } ) clause ( { t 3 , t 4 } ) t 1 = t 3 t 2 = t 4

  18. Templates Boolean predicate P CNF clauses C t 1 = true t 2 = true for i from N to 1 : o = ITE N (( GT N , x, y ) , x, y ) t 3 = newV ar t 4 = newV ar clause ( { x [ i ] , y [ i ] , o [ i ] } ) clause ( { x [ i ] , t 1 , t 3 } ) msb lsb clause ( { x [ i ] , t 2 , o [ i ] , t 4 } ) clause ( { x [ i ] , o [ i ] , t 3 } ) y x clause ( { x [ i ] , y [ i ] , o [ i ] } ) clause ( { x [ i ] , t 2 , o [ i ] } ) clause ( { x [ i ] , t 2 , t 4 } ) > clause ( { y [ i ] , t 2 , t 4 } ) clause ( { y [ i ] , o [ i ] , t 3 } ) ite clause ( { y [ i ] , t 1 , t 3 } ) clause ( { y [ i ] , o [ i ] , t 3 } ) o clause ( { t 1 , t 3 } ) clause ( { t 1 , o [ i ] , t 3 } ) clause ( { t 2 , t 4 } ) clause ( { t 3 , t 4 } ) t 1 = t 3 t 2 = t 4

  19. Templates Boolean predicate P CNF clauses C t 1 = true t 2 = true for i from N to 1 : o = ITE N (( GT N , x, y ) , x, y ) t 3 = newV ar t 4 = newV ar clause ( { x [ i ] , y [ i ] , o [ i ] } ) clause ( { x [ i ] , t 1 , t 3 } ) msb lsb clause ( { x [ i ] , t 2 , o [ i ] , t 4 } ) clause ( { x [ i ] , o [ i ] , t 3 } ) y x clause ( { x [ i ] , y [ i ] , o [ i ] } ) clause ( { x [ i ] , t 2 , o [ i ] } ) clause ( { x [ i ] , t 2 , t 4 } ) > clause ( { y [ i ] , t 2 , t 4 } ) clause ( { y [ i ] , o [ i ] , t 3 } ) ite clause ( { y [ i ] , t 1 , t 3 } ) clause ( { y [ i ] , o [ i ] , t 3 } ) o clause ( { t 1 , t 3 } ) clause ( { t 1 , o [ i ] , t 3 } ) clause ( { t 2 , t 4 } ) clause ( { t 3 , t 4 } ) t 1 = t 3 t 2 = t 4

  20. Templates t 1 = ?? t 2 = ?? for i from ?? to ?? : t 3 = newV ar t 4 = newV ar genClauses ( x [ i ] , y [ i ] , o [ i ] , t 1 , t 2 , t 3 , t 4) t 1 = t 3 t 2 = t 4

  21. Synthesis as a SyGus problem Boolean predicate P CNF clauses C Template Sketch Correct program (SyGus solver) Specification

  22. Specification Boolean predicate P CNF clauses C Correctness: ∀ σ . P ( σ ) = C ( σ ) σ = variables assignment d = ite ( a, b, c ) ∧ e = d a = T, b = T, c = F, d = T, e = T a ∨ c ∨ d T ∨ F ∨ F a ∨ c ∨ d T ∨ T ∨ T a ∨ b ∨ d F ∨ T ∨ F P ( σ ) = C ( σ ) = T a ∨ b ∨ d F ∨ F ∨ T T ∨ F ∨ F b ∨ c ∨ d F ∨ T ∨ T b ∨ c ∨ d T ∨ F d ∨ e F ∨ T d ∨ e

  23. Specification Boolean predicate P CNF clauses C Correctness: ∀ σ . P ( σ ) = C ( σ ) σ = variables assignment d = ite ( a, b, c ) ∧ e = d a = F, b = T, c = F, d = T, e = T a ∨ c ∨ d F ∨ F ∨ F a ∨ c ∨ d F ∨ T ∨ T a ∨ b ∨ d T ∨ T ∨ F P ( σ ) = C ( σ ) = F a ∨ b ∨ d T ∨ F ∨ T T ∨ F ∨ F b ∨ c ∨ d F ∨ T ∨ T b ∨ c ∨ d T ∨ F d ∨ e F ∨ T d ∨ e

  24. Specification Boolean predicate P CNF clauses C Maximal ∀ σ . satisfiable ( σ , P ) = ⇒ Propagation d = ite ( a, b, c ) ∧ e = d b = T, c = T a ∨ c ∨ d a ∨ c ∨ d a ∨ b ∨ d a ∨ b ∨ d b ∨ c ∨ d b ∨ c ∨ d d ∨ e d ∨ e

  25. Specification Boolean predicate P CNF clauses C Maximal ∀ σ . satisfiable ( σ , P ) = ⇒ Propagation ∀ x i , b i . ( forces ( σ , P, x i , b i ) = ⇒ d = ite ( a, b, c ) ∧ e = d b = T, c = T ⇒ e = T = a ∨ c ∨ d a ∨ c ∨ d a ∨ b ∨ d a ∨ b ∨ d b ∨ c ∨ d b ∨ c ∨ d d ∨ e d ∨ e

  26. Specification Boolean predicate P CNF clauses C Maximal ∀ σ . satisfiable ( σ , P ) = ⇒ Propagation ∀ x i , b i . ( forces ( σ , P, x i , b i ) = UP ( C, σ ) v extend ( σ , x i , b i )) ⇒ d = ite ( a, b, c ) ∧ e = d b = T, c = T ⇒ e = T = a ∨ c ∨ d a ∨ T ∨ d a ∨ c ∨ d a ∨ F ∨ d a ∨ b ∨ d a ∨ T ∨ d a ∨ F ∨ d a ∨ b ∨ d T ∨ T ∨ d b ∨ c ∨ d F ∨ F ∨ d b ∨ c ∨ d d ∨ e d ∨ e d ∨ e d ∨ e

  27. Specification Boolean predicate P CNF clauses C Maximal ∀ σ . satisfiable ( σ , P ) = ⇒ Propagation ∀ x i , b i . ( forces ( σ , P, x i , b i ) = UP ( C, σ ) v extend ( σ , x i , b i )) ⇒ d = ite ( a, b, c ) ∧ e = d b = T, c = T, d = T ⇒ e = T = a ∨ T ∨ F a ∨ c ∨ d a ∨ F ∨ T a ∨ c ∨ d a ∨ T ∨ F a ∨ b ∨ d a ∨ F ∨ T a ∨ b ∨ d T ∨ T ∨ F b ∨ c ∨ d F ∨ F ∨ T b ∨ c ∨ d T ∨ e d ∨ e F ∨ e d ∨ e

  28. Specification Boolean predicate P CNF clauses C Maximal ∀ σ . satisfiable ( σ , P ) = ⇒ Propagation ∀ x i , b i . ( forces ( σ , P, x i , b i ) = UP ( C, σ ) v extend ( σ , x i , b i )) ⇒ d = ite ( a, b, c ) ∧ e = d b = T, c = T, d = T, e = T ⇒ e = T = a ∨ T ∨ F a ∨ c ∨ d a ∨ F ∨ T a ∨ c ∨ d a ∨ T ∨ F a ∨ b ∨ d a ∨ F ∨ T a ∨ b ∨ d T ∨ T ∨ F b ∨ c ∨ d F ∨ F ∨ T b ∨ c ∨ d T ∨ e d ∨ e F ∨ e d ∨ e

Recommend


More recommend