Lifting Abstract Interpreters to Quantified Logical Domains Sumit Gulwani, MSR Bill McCloskey, UCB Ashish Tiwari, SRI 1.

Slides:



Advertisements
Similar presentations
Assertion Checking over Combined Abstraction of Linear Arithmetic and Uninterpreted Functions Sumit Gulwani Microsoft Research, Redmond Ashish Tiwari SRI.
Advertisements

Join Algorithms for the Theory of Uninterpreted Functions Sumit Gulwani Ashish Tiwari George Necula UC-Berkeley SRI UC-Berkeley.
Combining Abstract Interpreters Sumit Gulwani Microsoft Research Redmond, Group Ashish Tiwari SRI RADRAD.
A Polynomial-Time Algorithm for Global Value Numbering SAS 2004 Sumit Gulwani George C. Necula.
Logical Abstract Interpretation Sumit Gulwani Microsoft Research, Redmond.
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
© Anvesh Komuravelli Quantified Invariants in Rich Domains using Model Checking and Abstract Interpretation Anvesh Komuravelli, CMU Joint work with Ken.
Discussion #33 Adjacency Matrices. Topics Adjacency matrix for a directed graph Reachability Algorithmic Complexity and Correctness –Big Oh –Proofs of.
1 Cover Algorithms and Their Combination Sumit Gulwani, Madan Musuvathi Microsoft Research, Redmond.
Sorting. Sorting Considerations We consider sorting a list of records, either into ascending or descending order, based upon the value of some field of.
A Basic Study on the Algorithm Analysis Chapter 2. Getting Started 한양대학교 정보보호 및 알고리즘 연구실 이재준 담당교수님 : 박희진 교수님 1.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 5.
Analysis of Algorithms CS 477/677 Sorting – Part B Instructor: George Bebis (Chapter 7)
Computability Start complexity. Motivation by thinking about sorting. Homework: Finish examples.
25 May Quick Sort (11.2) CSE 2011 Winter 2011.
Search algorithm In computer science, a search algorithm is an algorithm that takes a problem as input and returns a solution to the problem, usually after.
Assertion Checking Unified Sumit Gulwani Microsoft Research, Redmond Ashish Tiwari SRI.
CS 253: Algorithms Chapter 7 Mergesort Quicksort Credit: Dr. George Bebis.
1 Model Checking, Abstraction- Refinement, and Their Implementation Based on slides by: Orna Grumberg Presented by: Yael Meller June 2008.
Sorting. Input: A sequence of n numbers a 1, …, a n Output: A reordering a 1 ’, …, a n ’, such that a 1 ’ < … < a n ’
TDDB56 DALGOPT-D DALG-C Lecture 8 – Sorting (part I) Jan Maluszynski - HT Sorting: –Intro: aspects of sorting, different strategies –Insertion.
A Numerical Abstract Domain based on Expression Abstraction + Max Operator with Application in Timing Analysis Sumit Gulwani (MSR Redmond) Bhargav Gulavani.
Data Structures Review Session 1
Complexity (Running Time)
Fall 2008 Insertion Sort – review of loop invariants.
VS 3 : Verification and Synthesis using SMT Solvers SMT Solvers for Program Verification Saurabh Srivastava * Sumit Gulwani ** Jeffrey S. Foster * * University.
Program Verification using Templates over Predicate Abstraction Saurabh Srivastava University of Maryland, College Park Sumit Gulwani Microsoft Research,
CS Main Questions Given that the computer is the Great Symbol Manipulator, there are three main questions in the field of computer science: What kinds.
Unit 1. Sorting and Divide and Conquer. Lecture 1 Introduction to Algorithm and Sorting.
Lecture 2 MAS 714 Hartmut Klauck
By: Pashootan Vaezipoor Path Invariant Simon Fraser University – Spring 09.
A Parametric Segmentation Functor for Fully Automatic and Scalable Array Content Analysis Patrick Cousot, NYU & ENS Radhia Cousot, CNRS & ENS & MSR Francesco.
10/14/ Algorithms1 Algorithms - Ch2 - Sorting.
Examples using Arrays. Summing Squares Problem: To compute the sum of the squares of N numbers N is given N values are also given These should be read.
Some Advanced Features of Procedures. Recursion Recursive Calls –A procedure can call itself (Self Recursion) –A can call B, B calls C, etc, Z calls A.
Lecture 2 Sorting. Sorting Problem Insertion Sort, Merge Sort e.g.,
Merge sort, Insertion sort. Sorting I / Slide 2 Sorting * Selection sort (iterative, recursive?) * Bubble sort.
September 17, 2001 Algorithms and Data Structures Lecture II Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Data Structure Introduction.
Proving Programs Robust Swarat Chaudhuri 1,3 Sumit Gulwani 2 Roberto Lublinerman 1 Sara Navidpour 1 1 Pennsylvania State University 2 Microsoft Research.
Program Verification and Synthesis using Templates over Predicate Abstraction Saurabh Srivastava # Sumit Gulwani * Jeffrey S. Foster # # University of.
Chapter 5 Algorithms (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
September 9, Algorithms and Data Structures Lecture II Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Sorting. Sorting Terminology Sort Key –each element to be sorted must be associated with a sort key which can be compared with other keys e.g. for any.
Elementary Data Organization. Outline  Data, Entity and Information  Primitive data types  Non primitive data Types  Data structure  Definition 
Random Interpretation Sumit Gulwani UC-Berkeley. 1 Program Analysis Applications in all aspects of software development, e.g. Program correctness Compiler.
2IS80 Fundamentals of Informatics Fall 2015 Lecture 6: Sorting and Searching.
CS357 Lecture 13: Symbolic model checking without BDDs Alex Aiken David Dill 1.
Computer Science 1620 Sorting. cases exist where we would like our data to be in ascending (descending order) binary searching printing purposes selection.
CSC317 1 So far so good, but can we do better? Yes, cheaper by halves... orkbook/cheaperbyhalf.html.
2IS80 Fundamentals of Informatics Fall 2015 Lecture 7: Sorting and Directed Graphs.
SORTING ALGORITHMS Christian Jonsson Jonathan Fagerström And implementation.
1/20 Arrays Changki PSWLAB Arrays Daniel Kroening and Ofer Strichman Decision Procedure.
© Anvesh Komuravelli Spacer Compositional Verification of Procedural Programs using Horn Clauses over Integers and Arrays Anvesh Komuravelli work done.
1 Computer Algorithms Tutorial 2 Mathematical Induction Some of these slides are courtesy of D. Plaisted et al, UNC and M. Nicolescu, UNR.
September 18, Algorithms and Data Structures Lecture II Simonas Šaltenis Aalborg University
CS6045: Advanced Algorithms Sorting Algorithms. Sorting Input: sequence of numbers Output: a sorted sequence.
Lifting Abstract Interpreters to Quantified Logical Domains (POPL’08)
Analysis of Algorithms CS 477/677
Tutorial: Proving termination and liveness
Unit 1. Sorting and Divide and Conquer
CS 3343: Analysis of Algorithms
Algorithms Chapter 3 With Question/Answer Animations
Analysis of Bubble Sort and Loop Invariant
Proving correctness.
Data Structures Review Session
Algorithms Key Revision Points.
Applications of Inclusion-Exclusion: Selected Exercises
Algorithms and Data Structures Lecture II
Presentation transcript:

Lifting Abstract Interpreters to Quantified Logical Domains Sumit Gulwani, MSR Bill McCloskey, UCB Ashish Tiwari, SRI 1

Motivating Example 2 a[0] = 0; for (i=1; i<n; i++) a[i] = 0; Postcondition: i  n  a[0] = 0   k (0 ≤ k < i  a[k] = 0)

How Are Quantifiers Useful? Reasoning about arrays –  k (0 ≤ k < STRLEN(s)  s[k]  '!') –  j, k (0 ≤ j < k < n  a[j] ≤ a[k]) Reasoning about pointer-based data structures –  u (R(hd, u)  R(u, tl)  u  data = 0) means list is initialized from hd to tl Security properties Sorting uv R(u, v) 3

What Do Quantifiers Look Like? 4  k ( 0 ≤ k < n  a[k] = 0 ) Typically see only universal quantifiers Comes from some domain, e.g. linear arithmetic Belongs to another domain, e.g. equality of uninterpreted functions Goal: Create a universally quantified domain parameterized by base domains – Take advantage of existing domains, transfer functions Quantifier-Free Domain Quantified Domain

Universally Quantified Domain 5 A   V 1.(B 1  C 1 ) ...   V n.(B n  C n ) Domain Element Definition Partial Order Definition  V.(B  C)  V. (B'  C') C v C' B' v B A   V.(B  C) v A'   V.(B'  C') if 1. A v A' 2. A A  A A 

Transfer Function Example 6 A[0] := 0; i := 1 true ? ? ? ? i = 1  A[0] = 0 i = 2  A[0] = 0  A[1] = 0 6 i < n TF ? A[i] := 0; i := i+1

Transfer Function Example 7 A[0] := 0; i := 1 true i = 1  A[0] = 0 i = 2  A[0] = 0  A[1] = 0 7 i < n TF ? A[i] := 0; i := i+1 i < n TF i = 1  A[0] = 0 Join Algorithm i = 1  A[0] = 0i = 2  A[0] = 0  A[1] = 0 1  i  2  A[0] = 0

Transfer Function Example 8 A[0] := 0; i := 1 true i = 1  A[0] = 0 i = 2  A[0] = 0  A[1] = 0 8 i < n TF ? A[i] := 0; i := i+1 i < n TF i = 1  A[0] = 0 Join Algorithm i = 1  A[0] = 0i = 2  A[0] = 0  A[1] = 0 i = 1   k(k = 0  A[k] = 0) i = 2   k(0  k  1  A[k] = 0) 1  i  2   k(0  k < i  A[k] = 0)

Transfer Function Example 9 A[0] := 0; i := 1 i < n A[i] := 0; i := i+1 TF true 9 i = 1   k(k = 0  A[k] = 0) 1  i   k(0  k < i  A[k] = 0) 1  i < n   k(0  k < i  A[k] = 0) 2  i  n   k(0  k < i  A[k] = 0) i  n   k(0  k < i  A[k] = 0)

Outline Join Algorithm – Quantifier introduction – Joining quantifiers Experiments Conclusion 10

Quantifier Introduction Quantified facts are drawn from standard facts in A User gives set of templates to guide quantification Experiments show that few templates are needed b[0] = 0 b[0] ≤ b[1]  k (k = 0  b[k] = 0)  j, k (j = 0  k = 1  b[j] ≤ b[k]) b[0] = 0  k(k = 0  b[k] = 0) A[*] = c 11 Env factTemplateQuantified fact (result) b[0] ≤ b[1] A[*] ≤ A[*]  j, k (j = 0  k = 1  b[j] ≤ b[k])

Outline Join Algorithm – Quantifier introduction – Joining quantifiers Experiments Conclusion 12

Transfer Function Example 13 A[0] := 0; i := 1 true i = 1  A[0] = 0 i = 2  A[0] = 0  A[1] = 0 13 i < n TF ? A[i] := 0; i := i+1 i < n TF i = 1  A[0] = 0 Join Algorithm i = 1  A[0] = 0i = 2  A[0] = 0  A[1] = 0 i = 1   k(k = 0  A[k] = 0) i = 2   k(0  k  1  A[k] = 0) 1  i  2   k(0  k < i  A[k] = 0)

Joining Quantifiers Goal: (A L   V.(B L  C L )) t (A R   V. (B R  C R )) Result must be above both inputs in v, so: – A L   V.(B L  C L ) v A   V.(B  C) – A R   V. (B R  C R ) v A   V.(B  C) Based on v definition: A L v A and A R v A  V.(B L  C L )  V. (B  C) AL  CL v CAL  CL v C A L  B v B L 2.  V.(B R  C R ) A R  C R v C A R  B v B R so A = A L t A R

Joining Quantifiers C = (A L  C L ) t (A R  C R ) Rewriting for B: Best solution for B = (A L  B L )  (A R  B R ) If it's not in domain, pick best under-approximation 15 B v  A L  B L and B v  A R  B R or, B v A L  B L and B v A R  B R  V.(B L  C L )  V. (B  C) AL  CL v CAL  CL v C A L  B v B L  V.(B R  C R ) A R  C R v C A R  B v B R

Under-Approximation Example Compute  (i = 1  k = 0)  (i = 2  0  k  1)  in LA 1 st step: guess an over-approximation of the answer 2 nd step: Check if (0  k < i) is correct; refine if not 16 (i = 1  k = 0) t (i = 2  0  k  1) = (1  i  2  0  k < i) Many details skipped. See paper! (0  k < i)  (i = 1  k = 0)  (i = 2  0  k  1) ? YES

Outline Join Algorithm – Quantifier introduction – Joining quantifiers Experiments Conclusion 17

Experiments Procedure  Time (s) Ratio to base# Tmpls Array initialization3.2 s2.1x1 C main() argument scan4.1 s2.1x1 Array copy5.5 s2.5x1 Array copy (start with non-zero elements)11.3 s1.7x1 Array copy (only copy positive elements)12.0 s2.0x1 Find element in array24.6 s3.0x1 Partition array into zero/non-zero parts73.0 s3.2x2 Insertion sort inner loop35.9 s18x3 Quicksort inner loop42.2 s9.4x3 Selection sort inner loop59.2 s7.3x3 Merge sort inner loop334.1 s4.5x3 Linked list remove20.5 s14.6x1 Linked list insert23.9 s17.1x1 Linked list initialization24.5 s12.9x1 Linked list creation42.0 s12.4x1 Invariant: a[k] = b[k] for all k Invariant: All data fields of list are zero

Quantified Domain Construction Works! 19 Base domain D partial order transfer functions Under-approximation operators for D (optional) Quantified domain Q 3x slowdown relative to D transfer functions relatively complete Under- approximation