Dynamically Discovering Likely Program Invariants All material in this presentation is derived from documentation online at the Daikon website,

Slides:



Advertisements
Similar presentations
Chapter 22 Implementing lists: linked implementations.
Advertisements

Introduction to Java 2 Programming Lecture 3 Writing Java Applications, Java Development Tools.
50.530: Software Engineering Sun Jun SUTD. Week 10: Invariant Generation.
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Koushik Sen CS 265.
Composition CMSC 202. Code Reuse Effective software development relies on reusing existing code. Code reuse must be more than just copying code and changing.
FIT FIT1002 Computer Programming Unit 19 Testing and Debugging.
Characteristics of Instruments P M V Subbarao Professor Mechanical Engineering Department A Step Towards Design of Instruments….
Michael Ernst, page 1 Learning and repair tools background Michael Ernst MIT Lab for Computer Science Joint work with Jake.
Dynamic Invariant Discovery Modified from Tevfik Bultan’s original presentation.
Dynamically Discovering Likely Program Invariants to Support Program Evolution Michael D. Ernst, Jake Cockrell, William G. Griswold, David Notkin Presented.
272: Software Engineering Fall 2008 Instructor: Tevfik Bultan Lecture 16: Dynamic Invariant Discovery.
Logical Operators Java provides two binary logical operators (&& and ||) that are used to combine boolean expressions. Java also provides one unary (!)
Dynamically Discovering Likely Program Invariants to Support Program Evolution Michael Ernst, Jake Cockrell, William Griswold, David Notkin Presented by.
Dynamically Discovering Likely Program Invariants to Support Program Evolution Michael D. Ernst, Jake Cockrell, William G. Griswold, David Notkin Presented.
Michael Ernst, page 1 Improving Test Suites via Operational Abstraction Michael Ernst MIT Lab for Computer Science Joint.
Ernst, ICSE 99, page 1 Dynamically Detecting Likely Program Invariants Michael Ernst, Jake Cockrell, Bill Griswold (UCSD), and David Notkin University.
CMSC 104, Version 8/061L22Arrays1.ppt Arrays, Part 1 of 2 Topics Definition of a Data Structure Definition of an Array Array Declaration, Initialization,
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Java and C++, The Difference An introduction Unit - 00.
1. Reference  2  Algorithm :- Outline the essence of a computational procedure, step by step instructions.  Program :- an.
Dynamically Discovering Likely Program Invariants to Support Program Evolution Presented By: Wes Toland, Geoff Gerfin Michael D. Ernst, Jake Cockrell,
Week 10 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Introduction to C++ Systems Programming. Systems Programming: Introduction to C++ 2 Systems Programming: 2 Introduction to C++  Syntax differences between.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
Array Processing - 2. Objectives Demonstrate a swap. Demonstrate a linear search of an unsorted array Demonstrate how to search an array for a high value.
The basics of the array data structure. Storing information Computer programs (and humans) cannot operate without information. Example: The array data.
Chapter 6Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 6 l Array Basics l Arrays and Methods l Programming with Arrays.
Extended Static Checking for Java  ESC/Java finds common errors in Java programs: null dereferences, array index bounds errors, type cast errors, race.
The Daikon system for dynamic detection of likely invariants MIT Computer Science and Artificial Intelligence Lab. 16 January 2007 Presented by Chervet.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
02/12/2014 Presenter: Yuanhang Wang Instructor: Christoph Csallner 1 Dynamically Discovering Likely Program Invariants to Support Program Evolution Michael.
1 Arrays An array is a collection of data values, all of which have the same type. The size of the array is fixed at creation. To refer to specific values.
Today’s Agenda  Quick Review  Continue on JML Formal Methods in Software Engineering1.
Data Structure Introduction.
1 Test Selection for Result Inspection via Mining Predicate Rules Wujie Zheng
Fall 2002CS 150: Intro. to Computing1 Streams and File I/O (That is, Input/Output) OR How you read data from files and write data to files.
Using Loop Invariants to Detect Transient Faults in the Data Caches Seung Woo Son, Sri Hari Krishna Narayanan and Mahmut T. Kandemir Microsystems Design.
Computer Organization and Design Pointers, Arrays and Strings in C Montek Singh Sep 18, 2015 Lab 5 supplement.
CSCI 62 Data Structures Dr. Joshua Stough September 11, 2008.
Higher Computing Science 2016 Prelim Revision. Topics to revise Computational Constructs parameter passing (value and reference, formal and actual) sub-programs/routines,
Two Dimensional Arrays Found in chapter 8, Section 8.9.
Software testing techniques Software testing techniques REGRESSION TESTING Presentation on the seminar Kaunas University of Technology.
Arrays Chap. 9 Storing Collections of Values 1. Introductory Example Problem: Teachers need to be able to compute a variety of grading statistics for.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
REGRESSION TESTING Audrius Čėsna IFM-0/2. Regression testing is any type of software testing that seeks to uncover new errors, or regressions, in existing.
Jeremy Nimmer, page 1 Automatic Generation of Program Specifications Jeremy Nimmer MIT Lab for Computer Science Joint work with.
Insertion sort Loop invariants Dynamic memory
Introduction to Algorithms
Computer Organization and Design Pointers, Arrays and Strings in C
Functions.
CS Computer Science IA: Procedural Programming
2008/11/19: Lecture 18 CMSC 104, Section 0101 John Y. Park
Introduction to C++ Systems Programming.
Data Structures Interview / VIVA Questions and Answers
Accessible Formal Methods A Study of the Java Modeling Language
Objects First with Java CITS1001
Objects First with Java CITS1001
Arrays, Part 1 of 2 Topics Definition of a Data Structure
Automated Support for Program Refactoring Using Invariants
Hoare-style program verification
Defining methods and more arrays
SWE 619 Software Construction Last Modified, Fall 2015 Paul Ammann
Introduction to JUnit IT323 – Software Engineering II
Arrays, Part 1 of 2 Topics Definition of a Data Structure
Arrays, Part 1 of 2 Topics Definition of a Data Structure
Introduction to Algorithms
Java Modeling Language (JML)
2008/11/19: Lecture 18 CMSC 104, Section 0101 John Y. Park
50.530: Software Engineering
Arrays, Part 1 of 2 Topics Definition of a Data Structure
Presentation transcript:

Dynamically Discovering Likely Program Invariants All material in this presentation is derived from documentation online at the Daikon website, and from publications by Michael D. Ernst, Jake Cockrell, William G. Griswold, and David Notkin. Presented by Neeraj Khanolkar

Daikon Means.. A daikon is a type of Asian radish. Daikon is pronounced like the two English words die-con. The name can be thought of as standing for "dynamic conjectures".

Current Release of Daikon Is completely written in Java. (Needs JVM 1.5 to run) Is quite easy to install and use for inference on Java programs. (Simply put daikon.jar in your classpath) Has a rich suite of tools operating on invariants. (Daikon tools can be used to print the inferred invariants in JML format, and to automatically annotate source files with the JML specs)

Original Program Instrumented Program Instrumentation Data trace database Execution with test suite Invariants Detection of Invariants Architecture of the Daikon tool

A Simple Example public class ArraySum{ private void dummy(int sum, int[] theArray){ }... public int getSum(int[] b){ int i = 0; int s = 0; int n = b.length; while(i != n){ s = s + b[i]; i = i + 1; } this.dummy(s,b); return s; } The call to dummy(s,b) is a hack to record the local variable s. Daikon's current front ends do not produce output for local variables, only for variables visible from outside a procedure.

Daikon Output In JML Format ArraySum.getSum(int[]):::ENTER Variables: … b != null (daikon.Quant.size(b) >> daikon.Quant.size(b)-1 == 0) =================================================== ArraySum.getSum(int[]):::EXIT Variables: … assignable b, b[*] daikon.Quant.pairwiseEqual(b, \old(b)) \result != daikon.Quant.size(b)-1 (\old(daikon.Quant.size(b)) >> daikon.Quant.size(b)-1 == 0)

Simple Example II public class ArraySum{... public int[] getReverse(int[] b){ int[] reverse = new int[b.length]; for(int i = 0; i < reverse.length; i++){ reverse[i] = b[reverse.length - i - 1]; } return reverse; }... }

Daikon Output In JML Format ArraySum.getReverse(int[]):::ENTER Variables: …. b != null (daikon.Quant.size(b) >> daikon.Quant.size(b)-1 == 0) =================================================== ArraySum.getReverse(int[]):::EXIT Variables: … assignable b, b[*] daikon.Quant.pairwiseEqual(b, \old(b)) daikon.Quant.size(\result) == \old(daikon.Quant.size(b)) \result != null daikon.Quant.isReverse(b, \result) daikon.Quant.size(\result) >> daikon.Quant.size(b)-1 == 0)

What Invariants Are Inferred? Invariants over any variable –Constant Value –Uninitialized Invariants over a single numeric variable –Range limits –Non-zero Invariants over two numeric variables –Linear relationship y = ax + b –Ordering comparison

What Invariants Are Inferred? Invariants over three numeric variables Invariants over a single sequence variable –Range: Minimum and maximum sequence values –Element ordering Invariants over two sequence variables –Subsequence relationship –Reversal Invariants over a sequence and a numeric variable

How Are Invariants Inferred? For each variable or tuple of variables, each potential invariant is tested. For instance, given 3 variables x, y and z –Each potential binary invariant is checked for, for and for. –Each potential unary invariant is checked for x, for y and for z. –Each potential ternary invariant is checked for.

How Are Invariants Inferred? A sample is a tuple of values for the instrumented variables at a program point, stemming from one execution of that program point. An invariant is checked by testing each sample in turn. As soon as a sample not satisfying the invariant is encountered, the invariant is known not to hold and is not checked for any subsequent samples.

Additional Derived Variables From sequence s –Length i.e. size(s) –Extremal elements: s[0], s[size(s) – 1] From any numeric sequence s –Minimum and maximum: min(s) and max(s) From any sequence s and any numeric variable i –Element at index s[i] –Subsequence s[0..i] From function invocations –Number of calls

Inferred Invariants Useful In Modifying Programs. (Case Study Experience) Explicated data structures. Confirmed and contradicted expectations. Revealed a bug. Demonstrated test suite inadequacy. Validated program changes.