compositional program analysis using max smt
play

Compositional Program Analysis using Max-SMT Albert Rubio Cristina - PowerPoint PPT Presentation

Compositional Program Analysis using Max-SMT Albert Rubio Cristina Borralleras, Marc Brockschmidt, Daniel Larraz, Albert Oliveras, Jos Miguel Rivero and Enric Rodrguez-Carbonell Universitat Politcnica de Catalunya - Barcelona Tech UCM


  1. Compositional Program Analysis using Max-SMT Albert Rubio Cristina Borralleras, Marc Brockschmidt, Daniel Larraz, Albert Oliveras, José Miguel Rivero and Enric Rodríguez-Carbonell Universitat Politècnica de Catalunya - Barcelona Tech UCM Seminar March 2018 Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 1 / 44

  2. Overview of the talk 1 Introduction 2 SMT/Max-SMT solving 3 Invariant generation 4 Compositional safety verification 5 VeryMax Tool 6 Conclusions and current work Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 2 / 44

  3. Overview of the talk 1 Introduction 2 SMT/Max-SMT solving 3 Invariant generation 4 Compositional safety verification 5 VeryMax Tool 6 Conclusions and current work Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 3 / 44

  4. Motivation Main Goal: Build static analysis tools for programmers. Fully automatic. Efficient. Scalable. Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 4 / 44

  5. Motivation Main Goal: Build static analysis tools for programmers. Fully automatic. Efficient. Scalable. Strategy: Take advantage of powerful arithmetic constraint solvers. SMT solvers Constraint-based Program Analysis techniques Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 4 / 44

  6. Motivation Main Goal: Build static analysis tools for programmers. Fully automatic. Efficient. Scalable. Strategy: Take advantage of powerful arithmetic constraint solvers. Max-SMT solvers Constraint-based Program Analysis techniques Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 4 / 44

  7. Motivation Main Goal: Build static analysis tools for programmers. Fully automatic. Efficient. Scalable. Strategy: Take advantage of powerful arithmetic constraint solvers. Max-SMT solvers Constraint-based Program Analysis techniques Goal : Verify safety and liveness properties of programs Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 4 / 44

  8. Motivation Main Goal: Build static analysis tools for programmers. Fully automatic. Efficient. Scalable. Strategy: Take advantage of powerful arithmetic constraint solvers. Max-SMT solvers Constraint-based Program Analysis techniques Goal : Verify safety and liveness properties of programs Challenge: discover (loop) invariants. How can we guide the search? Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 4 / 44

  9. Overview of the talk 1 Introduction 2 SMT/Max-SMT solving 3 Invariant generation 4 Compositional safety verification 5 VeryMax Tool 6 Conclusions and current work Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 5 / 44

  10. SMT solvers We make extensive use of SMT solvers inside our program analysis tools. SAT and SMT solvers gain efficiency by: addressing only (expressive enough) decidable fragments of a certain logic incorporate domain-specific reasoning, e.g: arithmetic reasoning equality data structures (arrays, lists, stacks, ...) SAT: use propositional logic as the formalization language + high degree of efficiency - expressive (all NP-complete) but involved encodings SMT: propositional logic + domain-specific reasoning + improves the expressivity - certain (but acceptable) loss of efficiency Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 6 / 44

  11. Need and Applications of SMT Some problems are more naturally expressed in other logics than propositional logic, e.g: Software verification needs reasoning about equality, arithmetic, data structures, ... SMT consists of deciding the satisfiability of a (ground) FO formula with respect to a background theory Example ( Equality with Uninterpreted Functions – EUF ): g ( a )= c ∧ ( f ( g ( a )) � = f ( c ) ∨ g ( a )= d ) ∧ c � = d Wide range of applications: Scheduling Predicate abstraction Test generation Model checking ... Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 7 / 44

  12. Theories of Interest - Arithmetic Very useful for obvious reasons Restricted fragments support more efficient methods: Bounds: x ⊲ ⊳ k with ⊲ ⊳ ∈ { <, >, ≤ , ≥ , = } Difference logic: x − y ⊲ ⊳ k , with ⊲ ⊳ ∈ { <, >, ≤ , ≥ , = } UTVPI: ± x ± y ⊲ ⊳ k , with ⊲ ⊳ ∈ { <, >, ≤ , ≥ , = } Linear arithmetic, e.g: 2 x − 3 y + 4 z ≤ 5 Non-linear arithmetic, e.g: 2 xy + 4 xz 2 − 5 y ≤ 10 Variables are either reals or integers Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 8 / 44

  13. SMT problems Input: Given a boolean formula ϕ over some theory T . Question: Is there any interpretation (solution) that satisfies the formula? Example: T = linear integer/real arithmetic. ( x < 0 ∨ x ≤ y ∨ y < z ) ∧ ( x ≥ 0 ) ∧ ( x > y ∨ y < z ) { x = 1 , y = 0 , z = 2 } Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 9 / 44

  14. SMT problems Input: Given a boolean formula ϕ over some theory T . Question: Is there any interpretation (solution) that satisfies the formula? Example: T = linear integer/real arithmetic. ( x < 0 ∨ x ≤ y ∨ y < z ) ∧ ( x ≥ 0 ) ∧ ( x > y ∨ y < z ) { x = 1 , y = 0 , z = 2 } Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 9 / 44

  15. SMT problems Input: Given a boolean formula ϕ over some theory T . Question: Is there any interpretation (solution) that satisfies the formula? Example: T = linear integer/real arithmetic. ( x < 0 ∨ x ≤ y ∨ y < z ) ∧ ( x ≥ 0 ) ∧ ( x > y ∨ y < z ) { x = 1 , y = 0 , z = 2 } There exist very efficient solvers: yices, z3, Barcelogic, ... Can handle large formulas with a complex boolean structure. Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 9 / 44

  16. Optimization problems (Weighted) Max-SMT problem Input: Given an SMT formula ϕ = C 1 ∧ . . . ∧ C m in CNF, where some of the clauses are hard and the others soft with a weight. Output: An assignment for the hard clauses that minimizes the sum of the weights of the falsified soft clauses. ( x 2 + y 2 > 2 ∨ x · z ≤ y ∨ y · z < z 2 ) ∧ ( x > y ∨ 0 < z ∨ w ( 5 )) ∧ . . . Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 10 / 44

  17. Non-linear SMT solving Input: Given a boolean formula ϕ over some theory T . Question: Is there any solution that satisfies the formula? Example: T = non-linear (polynomial) integer/real arithmetic. ( x 2 + y 2 > 2 ∨ x · z ≤ y ∨ y · z < z 2 ) ∧ ( x > y ∨ 0 < z ) { x = 0 , y = 1 , z = 1 } Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 11 / 44

  18. Non-linear SMT solving Input: Given a boolean formula ϕ over some theory T . Question: Is there any solution that satisfies the formula? Example: T = non-linear (polynomial) integer/real arithmetic. ( x 2 + y 2 > 2 ∨ x · z ≤ y ∨ y · z < z 2 ) ∧ ( x > y ∨ 0 < z ) { x = 0 , y = 1 , z = 1 } Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 11 / 44

  19. Non-linear SMT solving Input: Given a boolean formula ϕ over some theory T . Question: Is there any solution that satisfies the formula? Example: T = non-linear (polynomial) integer/real arithmetic. ( x 2 + y 2 > 2 ∨ x · z ≤ y ∨ y · z < z 2 ) ∧ ( x > y ∨ 0 < z ) { x = 0 , y = 1 , z = 1 } Non-linear arithmetic decidability: Integers: undecidable (Hilbert’s 10th problem). Reals: decidable (Tarski) but algorithms have prohibitive complexity. Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 11 / 44

  20. Non-linear SMT solving Input: Given a boolean formula ϕ over some theory T . Question: Is there any solution that satisfies the formula? Example: T = non-linear (polynomial) integer/real arithmetic. ( x 2 + y 2 > 2 ∨ x · z ≤ y ∨ y · z < z 2 ) ∧ ( x > y ∨ 0 < z ) { x = 0 , y = 1 , z = 1 } Non-linear arithmetic decidability: Integers: undecidable (Hilbert’s 10th problem). Reals: decidable (Tarski) but algorithms have prohibitive complexity. Incomplete solvers focus on either satisfiability or unsatisfiability. Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 11 / 44

  21. Non-linear SMT solving Input: Given a boolean formula ϕ over some theory T . Question: Is there any solution that satisfies the formula? Example: T = non-linear (polynomial) integer/real arithmetic. ( x 2 + y 2 > 2 ∨ x · z ≤ y ∨ y · z < z 2 ) ∧ ( x > y ∨ 0 < z ) { x = 0 , y = 1 , z = 1 } Non-linear arithmetic decidability: Integers: undecidable (Hilbert’s 10th problem). Reals: decidable (Tarski) but algorithms have prohibitive complexity. Incomplete solvers focus on either satisfiability or unsatisfiability. Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 11 / 44

  22. Solving non-linear SMT formulas Need to handle large formulas with non-linear arithmetic and complex boolean structure. Barcelogic has shown to be the best SMT-solver proving satisfiability of this kind of problems. Barcelogic can handle Max-SMT formulas (over non-linear arithmetic) as well. Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 12 / 44

  23. Overview of the talk 1 Introduction 2 SMT/Max-SMT solving 3 Invariant generation 4 Compositional safety verification 5 VeryMax Tool 6 Conclusions and current work Albert Rubio (UPC) Program Analysis using Max-SMT UCM Seminar 2018 13 / 44

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