Loop-Invariant Synthesis using Techniques from Constraint Programming

Slides:



Advertisements
Similar presentations
Basics of Recursion Programming with Recursion
Advertisements

Label Placement and graph drawing Imo Lieberwerth.
8 Algorithms Foundations of Computer Science ã Cengage Learning.
© University of Wisconsin, CS559 Spring 2004
UNIVERSITY OF JYVÄSKYLÄ Yevgeniy Ivanchenko Yevgeniy Ivanchenko University of Jyväskylä
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
 Percentage Bar graphs are similar ways to pie graphs. They are used to show different amounts of related data.  They are construct using a single bar.
Copyright © Cengage Learning. All rights reserved. CHAPTER 11 ANALYSIS OF ALGORITHM EFFICIENCY ANALYSIS OF ALGORITHM EFFICIENCY.
AII.7 - The student will investigate and analyze functions algebraically and graphically. Key concepts include a) domain and range, including limited and.
The Effects of Linear Transformations on Two –dimensional Objects.
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
Lecture 8. How to Form Recursive relations 1. Recap Asymptotic analysis helps to highlight the order of growth of functions to compare algorithms Common.
Are You Smarter Than a 5 th Grader?. 1,000,000 5th Grade Topic 15th Grade Topic 24th Grade Topic 34th Grade Topic 43rd Grade Topic 53rd Grade Topic 62nd.
Acute angle An angle with a measure less than 90 degrees.
Section 1.2 Using Data to Create Scatterplots. Table of Data Year Percent of Students Buying Textbooks Online
Time velocity After 4 seconds, the object has gone 12 feet. Consider an object moving at a constant rate of 3 ft/sec. Since rate. time = distance: If we.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
1. Searching The basic characteristics of any searching algorithm is that searching should be efficient, it should have less number of computations involved.
VECTORS AND THE GEOMETRY OF SPACE 10. VECTORS AND THE GEOMETRY OF SPACE In this chapter, we introduce vectors and coordinate systems for three-dimensional.
4. Affine transformations. Reading Required:  Watt, Section 1.1. Further reading:  Foley, et al, Chapter  David F. Rogers and J. Alan Adams,
The normal approximation for probability histograms.
Properties of Transformations. Translate Figures and Use Vectors Translation: moves every point of a figure the same distance in the same direction Image:
Function Recursion to understand recursion you must understand recursion.
Detail Issues in Robust Pathfinding Thomas Young
Virtual University of Pakistan
Vocabulary detail التفاصيل Elevation ارتفاع
Algorithms and Networks
3.6 Rational Functions.
to understand recursion you must understand recursion
Functions of Complex Variable and Integral Transforms
© University of Wisconsin, CS559 Spring 2004
Character Animation Forward and Inverse Kinematics
Geometric Transformations
Designing Cross-Language Information Retrieval System using various Techniques of Query Expansion and Indexing for Improved Performance  Hello everyone,
Introduction to Functions of Several Variables
Vectors and the Geometry
C++ coding standard suggestion… Separate reasoning from action, in every block. Hi, this talk is to suggest a rule (or guideline) to simplify C++ code.
CS 326 Programming Languages, Concepts and Implementation
10.3 Details of Recursion.
Graphing.
Copyright © Cengage Learning. All rights reserved.
Quicksort
F o r w a r d K i n e m a t i c s.
Copyright © Cengage Learning. All rights reserved.
Outline Drawing types and scales Types of views used on drawings.
Recursive Thinking Chapter 9 introduces the technique of recursive programming. As you have seen, recursive programming involves spotting smaller occurrences.
Feature description and matching
The histograms represent the distribution of five different data sets, each containing 28 integers from 1 through 7. The horizontal and vertical scales.
Linear Equations Mr. Abbott.
to understand recursion you must understand recursion
Recursive Thinking Chapter 9 introduces the technique of recursive programming. As you have seen, recursive programming involves spotting smaller occurrences.
Symbolic Implementation of the Best Transformer
Exploring Transformations
Localizing the Delaunay Triangulation and its Parallel Implementation
Vectors and the Geometry
Digital Media Dr. Jim Rowan ITEC 2110.
College Algebra Fifth Edition
3.6 Rational Functions.
Graphing Rules: According to DRTAILSS
Characteristics of Functions
Advanced Implementation of Tables
Create a design (image) on the graph paper on the last page, making sure at least 3 vertices land on whole number (integer) coordinates, in the upper left.
The Basics of Physics with Calculus – Part II
Module Recognition Algorithms
By: Harshal Nallapareddy and Eric Wang
Measures of Relative Position
Scalable light field coding using weighted binary images
Lecture 6 - Recursion.
Presentation transcript:

Loop-Invariant Synthesis using Techniques from Constraint Programming Antoine Miné Jason Breck Thomas Reps Hi, everyone. My name is Jason Breck, I’m a graduate student at the University of Wisconsin-Madison, this is joint work with my advisor, Tom Reps, and part of the larger Pliny project. I’m going to present some work on a loop invariant synthesis technique that borrows some ideas from the world of constraint programming. We are working to extend of a loop invariant synthesis algorithm called CPSolver, which was created by a collaborator of ours, Antoine Mine of ENS. In my talk today, I’ll first introduce the algorithm, then I’ll talk about how we have extended the algorithm and then what we plan to do next. Dagstuhl, November 2015

The Pliny Project Corpus Question for future work: How can we make the best use of loop invariants to support code search, synthesis, and repair? How best to: measure similarity between invariants relate buggy and fixed code program analysis database code search synthesis repair Dagstuhl, November 2015

The CPSolver Algorithm 𝑥 1 ∈ 2,4 𝑥 2 ∈[2,4] x2 4 Program states are in ℝd d=2 case may be visualized on the plane Invariants are geometric shapes. They may be approximated by sets of rectangles CPSolver iteratively refines a set of rectangles to find an invariant 2 -4 -2 2 4 x1 The CPSolver algorithm analyzes single-loop programs with real-valued variables, so in any loop that we analyze, you can think of a program state as being a vector of real numbers. In the case where we have two program variables, we can draw the space of program states on the plane for easy visualization, so, the horizontal axis is one program variable (say, x_1) and the vertical axis is another (say, x_2). Then, a loop invariant is some geometric shape, and we can approximate... What we mean by rectangle or box here is a conjunction of interval constraints... The CPSolver algorithm searches for an invariant by iteratively refining a set of boxes until either the set of boxes becomes an invariant, or else we reach a failure condition. This abstract domain of sets of boxes, and the techniques used to refine it, are ideas taken from constraint programming. -2 𝑥 1 ∈ 0,4 𝑥 2 ∈[−2,0] -4 Dagstuhl, November 2015

45° rotation with a slight inward scaling Now I’d like to show you an example of what this iterative process looks like. We’ll take the example of analyzing a loop whose body performs a 45 degree rotation of the point (x,y) with a slight inward scaling. No single box will be inductive, of course, because when you rotate a box 45 degrees, its corners map outside of the original box. Here’s what happens when you an example like this to CPSolver. The result is a shape that actually does map inside itself after a 45 degree rotation. 45° rotation with a slight inward scaling

Now I’d like to show you an example of what this iterative process looks like. We’ll take the example of analyzing a loop whose body performs a 45 degree rotation of the point (x,y) with a slight inward scaling. No single box will be inductive, of course, because when you rotate a box 45 degrees, its corners map outside of the original box. Here’s what happens when you an example like this to CPSolver. The result is a shape that actually does map inside itself after a 45 degree rotation.

The CPSolver Algorithm x2 4 2 -4 -2 2 4 x1 How do we refine our set of boxes? Well, basically, we split and delete boxes according to various rules. Here’s an example of the reasoning. Suppose that we determine that, when the program state is within this lower-right box here, one iteration of the loop that we’re analyzing will take the program state to the brown box shown here. That tells us that our current set of boxes is not an inductive loop invariant because it goes outside of our current set of boxes; we need to refine our set. So, what we will do is split this box, like so. Suppose now that this new lower-right box now maps, with one iteration of the loop, entirely outside our set of boxes; because it maps entirely outside, we’ll delete it. On the other hand, this box here maps entirely inside our set of boxes, so we will keep this box. If all of the boxes map entirely back into our set of boxes, then our set of boxes is an inductive loop invariant, and we’re done. -2 -4 Dagstuhl, November 2015

The CPSolver Algorithm x2 4 2 -4 -2 2 4 x1 How do we refine our set of boxes? Well, basically, we split and delete boxes according to various rules. Here’s an example of the reasoning. Suppose that we determine that, when the program state is within this lower-right box here, one iteration of the loop that we’re analyzing will take the program state to the brown box shown here. That tells us that our current set of boxes is not an inductive loop invariant because it goes outside of our current set of boxes; we need to refine our set. So, what we will do is split this box, like so. Suppose now that this new lower-right box now maps, with one iteration of the loop, entirely outside our set of boxes; because it maps entirely outside, we’ll delete it. On the other hand, this box here maps entirely inside our set of boxes, so we will keep this box. If all of the boxes map entirely back into our set of boxes, then our set of boxes is an inductive loop invariant, and we’re done. -2 -4 Dagstuhl, November 2015

The CPSolver Algorithm x2 4 2 -4 -2 2 4 x1 How do we refine our set of boxes? Well, basically, we split and delete boxes according to various rules. Here’s an example of the reasoning. Suppose that we determine that, when the program state is within this lower-right box here, one iteration of the loop that we’re analyzing will take the program state to the brown box shown here. That tells us that our current set of boxes is not an inductive loop invariant because it goes outside of our current set of boxes; we need to refine our set. So, what we will do is split this box, like so. Suppose now that this new lower-right box now maps, with one iteration of the loop, entirely outside our set of boxes; because it maps entirely outside, we’ll delete it. On the other hand, this box here maps entirely inside our set of boxes, so we will keep this box. If all of the boxes map entirely back into our set of boxes, then our set of boxes is an inductive loop invariant, and we’re done. -2 -4 Dagstuhl, November 2015

The Octagon Abstract Domain Box 𝑥 𝑖 ∈[ 𝑎 𝑖 , 𝑏 𝑖 ] Octagon 𝑥 𝑖 + 𝑥 𝑗 ∈[ 𝑎 𝑖,𝑗 , 𝑏 𝑖,𝑗 ] 𝑥 𝑖 − 𝑥 𝑗 ∈[ 𝑐 𝑖,𝑗 , 𝑑 𝑖,𝑗 ] Dagstuhl, November 2015

Relative Completeness An algorithm is relatively complete if provides this guarantee: If an inductive invariant exists in the abstract domain, and its inductiveness can be proven using the abstract domain, then the algorithm will find an inductive invariant. (related to “robustness” in [Madhusudan and Garg ‘14]) We created a relatively-complete version of CPSolver Dagstuhl, November 2015

Experiments Experimental design Results 11 simple, single-loop programs from the literature All variables are reals Box and octagon abstract domain Results Box domain: we found an invariant in all cases 3.84 sec average, 0.33 sec median Octagon domain: we found an invariant in all but 2 cases 29.8 sec average, 1.62 sec median Invariants are simpler (about half as many octagons as boxes) Dagstuhl, November 2015

Summary Concept Completed work Future work Thanks for your attention! Synthesize numerical loop invariants Use ideas from constraint programming (box abstract domain) Completed work Relatively-complete variant of original algorithm Use octagon abstract domain Future work Other abstract domains Applications in synthesis/repair or searching a Big Code corpus Thanks for your attention! Any questions? jbreck@cs.wisc.edu Dagstuhl, November 2015