Synthesis, Analysis, and Verification Lecture 08 Lectures: Viktor Kuncak BAPA: Quantifier Elimination and Decision Procedures WS1S: Automata-Based Decision.

Slides:



Advertisements
Similar presentations
Logical Abstract Interpretation Sumit Gulwani Microsoft Research, Redmond.
Advertisements

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Synthesis, Analysis, and Verification Lecture 04c Lectures: Viktor Kuncak VC Generation for Programs with Data Structures “Beyond Integers”
Chapter 28 – Part II Matrix Operations. Gaussian elimination Gaussian elimination LU factorization LU factorization Gaussian elimination with partial.
Linked List Implementation class List { private List next; private Object data; private static List root; private static int size; public static void addNew(Object.
6.1 Vector Spaces-Basic Properties. Euclidean n-space Just like we have ordered pairs (n=2), and ordered triples (n=3), we also have ordered n-tuples.
Approximation Algorithms Chapter 14: Rounding Applied to Set Cover.
Lecture 23. Subset Sum is NPC
Panel on Decision Procedures Panel on Decision Procedures Randal E. Bryant Lintao Zhang Nils Klarlund Harald Ruess Sergey Berezin Rajeev Joshi.
SECTION 3.6 COMPLEX ZEROS; COMPLEX ZEROS; FUNDAMENTAL THEOREM OF ALGEBRA FUNDAMENTAL THEOREM OF ALGEBRA.
On the Use of Automata Techniques to Decide Satisfiability Mia Minnes May 3, 2005.
Decision Procedures for Presburger Arithmetic Presented by Constantinos Bartzis.
Combining Theories Sharing Set Operations Thomas Wies joint work with Ruzica Piskac and Viktor Kuncak TexPoint fonts used in EMF. Read the TexPoint manual.
ISM 206 Lecture 4 Duality and Sensitivity Analysis.
4 4.6 © 2012 Pearson Education, Inc. Vector Spaces RANK.
Ofer Strichman, Technion Deciding Combined Theories.
Mathematics1 Mathematics 1 Applied Informatics Štefan BEREŽNÝ.
1 First order theories. 2 Satisfiability The classic SAT problem: given a propositional formula , is  satisfiable ? Example:  Let x 1,x 2 be propositional.
1/25 Pointer Logic Changki PSWLAB Pointer Logic Daniel Kroening and Ofer Strichman Decision Procedure.
1. Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Systems of Equations CHAPTER 9.1Solving Systems of Linear Equations Graphically.
7.2 Solving Recurrence Relations. Definition 1 (p. 460)- LHRR-K Def: A linear homogeneous recurrence relations of degree k with constant coefficients.
Decision Procedures An Algorithmic Point of View
ECON 1150 Matrix Operations Special Matrices
MA2213 Lecture 5 Linear Equations (Direct Solvers)
1 Copyright © 2015, 2011, 2007 Pearson Education, Inc. Chapter 2-1 Equations and Inequalities Chapter 2.
Section 4.1 Vectors in ℝ n. ℝ n Vectors Vector addition Scalar multiplication.
Simplex method (algebraic interpretation)
Linear Programming System of Linear Inequalities  The solution set of LP is described by Ax  b. Gauss showed how to solve a system of linear.
Lesson 4-1 Polynomial Functions.
Calculus of Data Structures for verification, and synthesis Viktor Kuncak Lab for Automated Reasoning and Analysis EPFL School of Computer and Communication.
5.5 Row Space, Column Space, and Nullspace
4 4.6 © 2012 Pearson Education, Inc. Vector Spaces RANK.
Vector Spaces RANK © 2016 Pearson Education, Inc..
Integrating high-level constructs into programming languages Language extensions to make programming more productive Underspecified programs –give assertions,
Week 6 - Friday.  What did we talk about last time?  Solving recurrence relations.
Zeros of Polynomials 2.5.
Elementary Linear Algebra Anton & Rorres, 9 th Edition Lecture Set – 07 Chapter 7: Eigenvalues, Eigenvectors.
Chapter 2 … part1 Matrices Linear Algebra S 1. Ch2_2 2.1 Addition, Scalar Multiplication, and Multiplication of Matrices Definition A matrix is a rectangular.
OR Simplex method (algebraic interpretation) Add slack variables( 여유변수 ) to each constraint to convert them to equations. (We may refer it as.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
Linear Algebra Chapter 2 Matrices.
Section 6.4. Powers of Binomial Expressions Definition: A binomial expression is the sum of two terms, such as x + y. (More generally, these terms can.
Binomial Coefficients and Identities
Selected Decision Procedures and Techniques for SMT More on combination – theories sharing sets – convex theory Un-interpreted function symbols (quantifier-free.
Sullivan Algebra and Trigonometry: Section 12.9 Objectives of this Section Set Up a Linear Programming Problem Solve a Linear Programming Problem.
Linear Programming Chap 2. The Geometry of LP  In the text, polyhedron is defined as P = { x  R n : Ax  b }. So some of our earlier results should.
2009/6/30 CAV Quantifier Elimination via Functional Composition Jie-Hong Roland Jiang Dept. of Electrical Eng. / Grad. Inst. of Electronics Eng.
Approximation Algorithms based on linear programming.
Runge Kutta schemes Taylor series method Numeric solutions of ordinary differential equations.
Linear Algebra Engineering Mathematics-I. Linear Systems in Two Unknowns Engineering Mathematics-I.
Section 6.2 Solving Linear Equations Math in Our World.
The Fundamental Theorem of Algebra and Complete Factorization
Copyright © Cengage Learning. All rights reserved.
Perturbation method, lexicographic method
Chap 9. General LP problems: Duality and Infeasibility
Polyhedron Here, we derive a representation of polyhedron and see the properties of the generators. We also see how to identify the generators. The results.
Polyhedron Here, we derive a representation of polyhedron and see the properties of the generators. We also see how to identify the generators. The results.
2. Generating All Valid Inequalities
Equations and Inequalities
Elementary Linear Algebra
I.4 Polyhedral Theory (NW)
Linear Algebra Lecture 32.
Maths for Signals and Systems Linear Algebra in Engineering Lectures 4-5, Tuesday 18th October 2016 DR TANIA STATHAKI READER (ASSOCIATE PROFFESOR) IN.
I.4 Polyhedral Theory.
Viktor Kuncak EPFL Martin Rinard MIT
Linear Algebra Lecture 7.
Chapter 2. Simplex method
Vector Spaces RANK © 2012 Pearson Education, Inc..
Sharing Set Operations
Chapter 2. Simplex method
Presentation transcript:

Synthesis, Analysis, and Verification Lecture 08 Lectures: Viktor Kuncak BAPA: Quantifier Elimination and Decision Procedures WS1S: Automata-Based Decision Procedure

Boolean Algebra with Presburger Arithmetic

Quantifier Elimination Usually harder than just satisfiability checking High-level idea: – express everything using cardinalities – separate integer arithmetic and set part (using auxiliary integer variables) – reduce set quantifier to integer quantifier – eliminate integer quantifier – eliminate auxiliary integer variables

Eliminate Quantifier

Another Example

Quantifier-free Boolean Algebra with Presburger Arithmetic (QFBAPA) If sets are over integers: φASTcφASTc ::= φ ∨ φ, φ ∧ φ, ¬ φ, A ::= S = S, S ⊆ S, T = T, T ≤ T ::= s i, ∅, S ∪ S, S ∩ S, S \ S ::= k i, c, c · T, T + T, T - T, |S| ::= …, -2, -1, 0, 1, 2, … ASAS ::= …, T ∈ S ::= …, { T }

A Decision Procedure for QFBAPA | A | > 1 ∧ A ⊆ B ∧ | B ∩ C | ≤ 2 A B C k7k7 k6k6 k5k5 k4k4 k3k3 k2k2 k1k1 k0k0 k 1 + k 4 + k 5 + k 7 > 1 k 1 + k 5 = 0 k 6 + k 7 ≤ 2 ∀ i ∈ { 0, …, 7 }. k i ≥ 0 k 4 = k 7 = 1 ∀ i ∉ { 4, 7 }. k i = 0 A = { 1, 2 }, B = { 1, 2 }, C = { 2 }

A Decision Procedure for QFBAPA Simple proof of decidability. Very simple linear arithmetic constraints, but… …for n set variables, uses 2 n integer variables Two orthogonal ways to improve it – sparse solutions – identifying independent constraints

Sparse Solutions The difficulty of the general problem reduces to integer linear programming problems with many integer variables but still polynomially many constraints. card(A B) = k 1 card(B C) = k 2 x 1 + x 2 + x 3 + x 5 + x 6 + x 7 = k 1 x 6 + x 7 = k A B C 5 7 0

Caratheodory theorem Vector v of dimension d is a convex combination of { a 1, …, a n } Then it is a convex combination of a subset { a k(1), …, a k(d+1) } of (d+1) of them

ILP associated w/ formula of size n x 1 + x 2 + x 3 + x 5 + x 6 + x 7 = p... x 6 + x 7 = q n equations 2 n variables Integer linear programming problem: for non-negative x i Are there sparse solutions where O(n k ) variables are non-zero? for reals- yes, matrix rank is O(n) for non-negative reals for non-negative integers - yes, Caratheodory them - Eisenbrand, Shmonin’06 Integer Caratheodory thm. (only when coefficients are bounded)

Independent Constraints A B C D A B C | A U B | = 3 ∧ C ⊆ D | A \ B | = | C |

Independent Constraints A and C are only indirectly related. All that matters is that the models for B are compatible. | A U B | = 4 ∧ | B ∩ C | = 2 A B B C

When can Models be Combined? |A| = 1 ∧ |B| = 1 ∧ |A ∩ B| = 1 ∧ |A| = 1 ∧ |C| = 1 ∧ |A ∩ C| = 1 ∧ |B| = 1 ∧ |C| = 1 ∧ |B ∩ C| = 0 |A| = 1 ∧ |B| = 1 ∧ |A ∩ B| = 1 ∧ |A| = 1 ∧ |C| = 1 ∧ |A ∩ C| = 1 ∧ |B| = 1 ∧ |C| = 1 ∧ |B ∩ C| = 0 A A B B C C The models are pairwise compatible, yet cannot be combined.

When can Models be Combined? Let φ 1, …, φ n be BAPA constraints. Let V be the set of all set variables that appear in at least two constraints. Models M 1, …, M n for φ 1, …, φ n can be combined into a model M for φ 1 ∧ … ∧ φ n if and only if they “agree” on the sizes of all Venn regions of the variables in V. Theorem 3

When can Models be Combined? |A| = 1 ∧ |B| = 1 ∧ |A ∩ B| = 1 ∧ |A| = 1 ∧ |C| = 1 ∧ |A ∩ C| = 1 ∧ |B| = 1 ∧ |C| = 1 ∧ |B ∩ C| = 0 |A| = 1 ∧ |B| = 1 ∧ |A ∩ B| = 1 ∧ |A| = 1 ∧ |C| = 1 ∧ |A ∩ C| = 1 ∧ |B| = 1 ∧ |C| = 1 ∧ |B ∩ C| = 0 A A B B C C V = { A, B, C } and models don’t agree on | A ∩ B ∩ C |.

|A \ B| > |A ∩ B| ∧ B ∩ C ∩ D = ∅ ∧ |B \ D| > |B \ C| A B B B D C A,B B,C,D B

|A \ B| > |A ∩ B| ∧ B ∩ C ∩ D = ∅ ∧ |B \ D| > |B \ C| A B B B D C k3k3 k2k2 k1k1 k0k0 k5k5 k4k4 k 13 k 11 k 12 k 10 k9k9 k8k8 k7k7 k6k6 k 0 + k 1 = k 4 k 2 + k 3 = k 5 k 4 = k 6 + k 8 + k 9 + k 12 k 5 = k 7 + k 10 + k 11 + k 13 k 1 > k 3 ∧ k 13 = 0 ∧ k 7 + k 10 > k 7 + k 11 A,B B,C,D B

|A \ B| > |A ∩ B| ∧ B ∩ C ∩ D = ∅ ∧ |B \ D| > |B \ C| A B B B D C A,B B,C,D B k3k3 k2k2 k1k1 k0k0 k5k5 k4k4 k 13 k 11 k 12 k 10 k9k9 k8k8 k7k7 k6k6

Hypertree Decomposition A,B B,C C,D,E C,D,F F,G B C,D G |A ∪ B| ≤ 3 ∧ C ⊆ B ∧ |(C ∩ D) \ E| = 2 ∧ |(C ∩ F) \ D| = 2 ∧ G ⊆ F |A ∪ B| ≤ 3 ∧ C ⊆ B ∧ |(C ∩ D) \ E| = 2 ∧ |(C ∩ F) \ D| = 2 ∧ G ⊆ F Hyperedges correspond to applications of Theorem 3.

Functional Programs: Example Given: def length(lst : List[Int]) : Int = lst match { case Nil ⇒ 0 case Cons(x, xs) ⇒ 1 + length(xs) } length(list) > | content(list) | ∧ content(Nil) = ∅ ∧ ∀ x: Int, ∀ xs: List[Int] : content(Cons(x, xs)) = { x } ∪ content(xs) ∧ length(Nil) = 0 ∧ ∀ x: Int, ∀ xs: List[Int] : length(Cons(x, xs)) = 1 + length(xs) def content(lst: List[Int]) : Set[Int] = lst match { case Nil ⇒ ∅ case Cons(x, xs) ⇒ { x } ∪ content(xs) } We want to prove: ∀ list : List[Int]. | content(list) | ≤ length(list) SMT query:

JVM Maintains the hypertree decomposition Translates constraints on sets to constraints on integers Lifts integer model to model for sets Reasons about all other theories Communicates new BAPA constraints Notifies when push/pop occurs System Architecture

WS1S Weak Monadic Second-Order Logic of One Successor Like BAPA, allows quantification over sets Unlike BAPA, does not allow |A|=|B| However, it allows talking about lists – BAPA talks only about identities of elements – (There is a way to combine WS1S and BAPA) WS1S generalizes to WSkS – reachability in trees!

A Verification Condition in WS1S