learning to solve smt formulas
play

Learning to Solve SMT Formulas Mislav Balunovic, Pavol Bielik , - PowerPoint PPT Presentation

Learning to Solve SMT Formulas Mislav Balunovic, Pavol Bielik , Martin Vechev Department of Computer Science SMT Formula Does there exist a valid assignment to b, x, y? = (b -x 2 2.3y sin(x) 3 = cos(log(y) x)) (b y


  1. Learning to Solve SMT Formulas Mislav Balunović, Pavol Bielik , Martin Vechev Department of Computer Science

  2. SMT Formula Does there exist a valid assignment to b, x, y? φ = (b ∨ -x 2 ≥ 2.3y ∨ sin(x) 3 = cos(log(y) • x)) ∧ (¬b ∨ y < -34.4 ∨ exp(y) > y/x) where b ∊ {true, false}, x, y ∊ ℝ SMT Theories Booleans , Reals , Integers, Arrays, BitVectors, Strings, ... SAT

  3. SMT Solvers Does there exist a valid assignment to b, x, y? φ = (b ∨ -x 2 ≥ 2.3y ∨ sin(x) 3 = cos(log(y) • x)) ∧ (¬b ∨ y < -34.4 ∨ exp(y) > y/x) where b ∊ {true, false}, x, y ∊ ℝ b = true Find an assignment to all free variables x = 14.32 in φ such that φ evaluates to true y = -37.2 SAT + model First-order φ SMT Solver logic formula UNSAT + unsat core

  4. SMT Solvers Applications Planning Software & Hardware Verification Type Inference Scheduling Neural Networks Verification Symbolic Execution Graph Problems Program Synthesis Static Program Analysis Find an assignment to all free variables in φ such that φ evaluates to true SAT + model First-order φ SMT Solver logic formula UNSAT + unsat core

  5. Solving SMT Formulas is Hard Theory Complexity Quantifier Free Booleans (SAT) NP-Complete O (n k ) n k Linear Real Arithmetic 2-EXPTIME O (2 2 ) n k 2 Linear Integer Arithmetic 3-EXPTIME O (2 2 ) Non-linear Integer Arithmetic undecidable SAT + model First-order φ SMT Solver logic formula UNSAT + unsat core

  6. Solving SMT Formulas is Hard Theory Complexity Quantifier Free Booleans (SAT) NP-Complete O (n k ) n k Linear Real Arithmetic 2-EXPTIME O (2 2 ) n k 2 Linear Integer Arithmetic 3-EXPTIME O (2 2 ) Non-linear Integer Arithmetic undecidable SAT + model First-order φ Set of Handcrafted logic formula Strategies UNSAT + unsat core

  7. Solving SMT Formulas is Hard State-of-the-art SMT Solvers ✘ Easily perform badly on new problems ✘ Require expert knowledge to fix SAT + model First-order φ Set of Handcrafted logic formula Strategies UNSAT + unsat core

  8. Learning to Solve SMT Formulas State-of-the-art SMT Solvers Our Work: ✘ Easily perform badly on new problems ✔ Learn fast strategies ✘ Require expert knowledge to fix ✔ No prior knowledge Fast SAT + model First-order φ Learned Strategies logic formula UNSAT + unsat core

  9. SMT Formula Solving apply transformation (tactic) t 1 t 2 t 3 true (SAT) φ φ φ φ 1 2 3 false (UNSAT) Constant Folding Bit Blasting x 3 = 0 ∧ x 2 = 1 ∧ x + 0 x x = 5 Action x 1 = 0 ∧ x 0 = 1 0101 2 Space Normalize Bounds Decision Procedure x ’ = x - k Reals, Integers, BitVectors, ... k ≤ x 0 ≤ x ’

  10. SMT Formula Solving φ 1 532 s 2 apply transformation φ 1 TIMEOUT (tactic) 3 φ φ φ φ 2 2 12 s 1 2 3 φ 3 TIMEOUT 3 φ 3 TIMEOUT 2 Handcrafted strategies determine which path to take

  11. Learning to Solve Formula Predict Strategy φ SAT + model Hard to Learn SMT UNSAT + unsat core Strategy φ Model t 1 ; … ; t n

  12. Learning to Solve Formula φ 1 532 s 2 apply transformation φ 1 TIMEOUT (tactic) 3 φ φ φ φ 2 2 12 s 1 2 3 φ 3 TIMEOUT 3 φ 3 TIMEOUT 2 Handcrafted strategies determine which path to take

  13. Learning to Solve Formula s 1 532 s 2 a 1 s 1 TIMEOUT a 1 3 a 1 a 2 a 2 s s s s 2 2 12 s 1 2 3 a 3 s 3 TIMEOUT a 3 3 s 3 TIMEOUT 2 Learn path with lowest runtime

  14. SMT Formula Solving Predict Strategy φ SAT + model Hard to Learn SMT UNSAT + unsat core Strategy φ Model t 1 ; … ; t n Predict Single Transformations Easier to Learn SAT φ φ 1 Policy SMT Policy SMT t 1 t 2 ... UNSAT Runtime Overhead Internal SMT State Lost Model Not Available Bit Blasting x 3 = 0 ∧ x 2 = 1 ∧ x = 5 x 1 = 0 ∧ x 0 = 1 0101 2

  15. Learning to Solve SMT Formulas Learning Policy Dataset of Formulas Policy Tactic no SAT SMT solved? φ yes UNSAT Learn a policy to select next tactic

  16. Learning to Solve SMT Formulas Learning Policy Policy Extraction Dataset of Program with Formulas Branches Policy SAT + model φ + SMT Tactic no UNSAT + unsat core SAT SMT solved? φ yes UNSAT ✔ No runtime overhead ✔ Integration with existing SMT Solvers Learn a policy to Use the learned policy to select next tactic synthesize a Strategy program

  17. Neural Network Policy Prior Actions Embedding [simplify, bit_blast, … ] eval on φ Formula Measures [1733, 0, … ] [num_consts, is_pb, … ] eval on φ Formula Representation Embedding BOW | Skip-Gram | AST

  18. Neural Network Policy Probability distribution over tactics Prior Actions Embedding Tactics [simplify, bit_blast, … ] SoftMax 0.70: pb2bv ReLU 0.15: smt eval on φ ... Formula Measures ReLU [1733, 0, … ] [num_consts, is_pb, … ] Parameters Sigmoid 0.20: flat ReLU eval on φ 0.75: som Formula Representation Embedding 95: factor BOW | Skip-Gram | AST ... Regression to predict each parameter

  19. Training = { φ , ψ, …, χ } Dataset of Formulas

  20. Training Policy no = { φ , ψ, …, χ } Tactic SAT SMT solved? φ yes UNSAT Dataset of Formulas Sample Policy

  21. Training Policy no = { φ , ψ, …, χ } Tactic SAT SMT solved? φ yes UNSAT Dataset of Formulas Sample Policy Training Dataset

  22. Training Policy no = { φ , ψ, …, χ } Tactic SAT SMT solved? φ yes UNSAT Dataset of Formulas Sample Policy Retrain Policy Training Dataset tactic weighted average of cross-entropy loss = + mean-square-error parameters

  23. Training Policy no = { φ , ψ, …, χ } Tactic SAT SMT solved? φ yes UNSAT Evaluate Sample Policy Retrain Policy Training Dataset tactic weighted average of cross-entropy loss = + mean-square-error parameters

  24. Learning 𝜌 (a | s) a 1 a 2 φ a 3 a 5 a 4 ψ a 1 a 5 a 4 χ a 1 Sequential Strategies

  25. Learning Policy Extraction 𝜌 (a | s) a 1 a 2 φ if expr then a 2 else a 4 a 3 a 5 a 5 a 4 a 4 a 1 ψ a 1 a 2 a 3 a 5 a 4 χ a 1 { φ , ψ , …, χ } Strategy with Branches Sequential Strategies

  26. Evaluation state-of-the-art SMT Solver Z3 Academic Benchmarks Industrial Benchmarks leipzig core hycomp AProVE Sage2 Learning Learning Learning Learning Learning + + + + + Policy Extraction Policy Extraction Policy Extraction Policy Extraction Policy Extraction

  27. Speed-up over Z3 Speed-up log scale 1000 100 10 faster Z3 handcrafted 1 strategy slower 0.1 0 20 40 60 80 100 Formulas

  28. Speed-up over Z3 Speed-up log scale 1000 100 Synthesized Sage2 10x Strategy 10 faster Z3 handcrafted 1 strategy slower 0.1 0 20 40 60 80 100 Formulas

  29. Speed-up over Z3 Speed-up log scale 1000x 1000 AProVE 100x 100 Synthesized Sage2 10x Strategy 10 faster Z3 handcrafted 1 strategy slower 0.1 0 20 40 60 80 100 Formulas

  30. Speed-up over Z3 Speed-up log scale 1000x 1000 AProVE 100x 100 Synthesized Sage2 10x Strategy 10 leipzig hycomp faster core Z3 handcrafted 1 strategy slower 0.1 0 20 40 60 80 100 Formulas

  31. Learning to Solve SMT Formulas http://fastsmt.ethz.ch/ Learning Policy Policy Extraction Dataset of Program with Formulas Branches Policy SAT + model φ + SMT Tactic no UNSAT + unsat core SAT SMT solved? φ yes UNSAT ✔ No runtime overhead ✔ Integration with existing SMT Solvers Learn a policy to Use the learned policy to select next tactic synthesize a Strategy program

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend