Technology from seed Automatic Equivalence Checking of UF+IA Programs Nuno Lopes and José Monteiro.

Slides:



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

Path-Sensitive Analysis for Linear Arithmetic and Uninterpreted Functions SAS 2004 Sumit Gulwani George Necula EECS Department University of California,
Logical Abstract Interpretation Sumit Gulwani Microsoft Research, Redmond.
1 Parametric Heap Usage Analysis for Functional Programs Leena Unnikrishnan Scott D. Stoller.
Functional Decompositions for Hardware Verification With a few speculations on formal methods for embedded systems Ken McMillan.
Copyright 2000 Cadence Design Systems. Permission is granted to reproduce without modification. Introduction An overview of formal methods for hardware.
A Program Transformation For Faster Goal-Directed Search Akash Lal, Shaz Qadeer Microsoft Research.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
1 Regression-Verification Benny Godlin Ofer Strichman Technion.
1 1 Regression Verification for Multi-Threaded Programs Sagar Chaki, SEI-Pittsburgh Arie Gurfinkel, SEI-Pittsburgh Ofer Strichman, Technion-Haifa Originally.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Program Analysis as Constraint Solving Sumit Gulwani (MSR Redmond) Ramarathnam Venkatesan (MSR Redmond) Saurabh Srivastava (Univ. of Maryland) TexPoint.
Technology from seed Weakest Precondition Synthesis for Compiler Optimizations Nuno Lopes and José Monteiro.
ISBN Chapter 3 Describing Syntax and Semantics.
1/22 Programs : Semantics and Verification Charngki PSWLAB Programs: Semantics and Verification Mordechai Ben-Ari Mathematical Logic for Computer.
Technology from seed Automatic Synthesis of Weakest Preconditions for Compiler Optimizations Nuno Lopes Advisor: José Monteiro.
Automated Soundness Proofs for Dataflow Analyses and Transformations via Local Rules Sorin Lerner* Todd Millstein** Erika Rice* Craig Chambers* * University.
An Integration of Program Analysis and Automated Theorem Proving Bill J. Ellis & Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt.
White Box Testing and Symbolic Execution Written by Michael Beder.
1 Regression-Verification Benny Godlin Ofer Strichman Technion.
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
Translation Validation for an Optimizing Compiler Guy Erez Based on George C. Necula article (ACM SIGPLAN 2000) Advanced Programming Languages Seminar,
White Box Testing and Symbolic Execution Written by Michael Beder.
Validating High-Level Synthesis Sudipta Kundu, Sorin Lerner, Rajesh Gupta Department of Computer Science and Engineering, University of California, San.
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Describing Syntax and Semantics
Composing Dataflow Analyses and Transformations Sorin Lerner (University of Washington) David Grove (IBM T.J. Watson) Craig Chambers (University of Washington)
CHAPTER 10 Recursion. 2 Recursive Thinking Recursion is a programming technique in which a method can call itself to solve a problem A recursive definition.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
Using Mathematica for modeling, simulation and property checking of hardware systems Ghiath AL SAMMANE VDS group : Verification & Modeling of Digital systems.
Chapter 3 (Part 3): Mathematical Reasoning, Induction & Recursion  Recursive Algorithms (3.5)  Program Correctness (3.6)
Chapter 25 Formal Methods Formal methods Specify program using math Develop program using math Prove program matches specification using.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Cliff Shaffer Computer Science Computational Complexity.
Lazy Annotation for Program Testing and Verification Speaker: Chen-Hsuan Adonis Lin Advisor: Jie-Hong Roland Jiang November 26,
Recursive Algorithms &
Semantics In Text: Chapter 3.
Proving Non-Termination Gupta, Henzinger, Majumdar, Rybalchenko, Ru-Gang Xu presentation by erkan.
Motivation  Parallel programming is difficult  Culprit: Non-determinism Interleaving of parallel threads But required to harness parallelism  Sequential.
Points-To Analysis in Almost Linear Time Josh Bauman Jason Bartkowiak CSCI 3294 OCTOBER 9, 2001.
13 Aug 2013 Program Verification. Proofs about Programs Why make you study logic? Why make you do proofs? Because we want to prove properties of programs.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
Random Interpretation Sumit Gulwani UC-Berkeley. 1 Program Analysis Applications in all aspects of software development, e.g. Program correctness Compiler.
C HAPTER 3 Describing Syntax and Semantics. D YNAMIC S EMANTICS Describing syntax is relatively simple There is no single widely acceptable notation or.
© Andrew IrelandDependable Systems Group Increasing Automation for Exception Freedom Proofs Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt.
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Credible Compilation With Pointers Martin Rinard and Darko Marinov Laboratory for Computer Science Massachusetts Institute of Technology.
SS 2017 Software Verification Bounded Model Checking, Outlook
ADT Implementation: Recursion, Algorithm Analysis, and Standard Algorithms Chapter 10 Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second.
Weakest Precondition of Unstructured Programs
Proving Loops Testing debugging and verification
Formal Methods in Software Engineering 1
Introduction to Software Verification
State your reasons or how to keep proofs while optimizing code
Propositional Calculus: Boolean Algebra and Simplification
IAS 0600 Digital Systems Design
Programming Languages and Compilers (CS 421)
What is an equation? An equation is a mathematical statement that two expressions are equal. For example, = 7 is an equation. Note: An equation.
Compilers have many bugs
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
IAS 0600 Digital Systems Design
CSE 1020:Software Development
CIS 720 Lecture 3.
Programming Languages and Compilers (CS 421)
Instructor: Aaron Roth
CIS 720 Lecture 3.
COP4020 Programming Languages
Presentation transcript:

technology from seed Automatic Equivalence Checking of UF+IA Programs Nuno Lopes and José Monteiro

technology from seed Algorithm recognition Regression checking Manual optimization checking Compiler optimization verification Information flow (non-interference) proofs Automatic Equivalence Checking of UF+IA Programs Why Equivalence Checking?

technology from seed i := 0 while i < n do k := f(k, i) i := i + 1 Automatic Equivalence Checking of UF+IA Programs Example: Are these programs equivalent? i := n while i ≥ 1 do k := f(k, n - i) i := i - 1 if n ≤ 0 then i := 0 else i := n

technology from seed assume v = v i := 0 while i < n do k := f(k, i) i := i + 1 i := n while i ≥ 1 do k := f(k, n - i) i := i - 1 if n ≤ 0 then i := 0 else i := n assert v = v Automatic Equivalence Checking of UF+IA Programs Example: Sequential composition is no solution

technology from seed Program equivalence Example Algorithm Application to compiler optimizations Evaluation: CORK Automatic Equivalence Checking of UF+IA Programs Outline

technology from seed Functional equivalence: non-deterministic behavior is not supported Partial equivalence: check only terminating paths Automatic Equivalence Checking of UF+IA Programs Program equivalence

technology from seed i := 0 while i < n do k := f(k, i) i := i + 1 Automatic Equivalence Checking of UF+IA Programs Running example i := n while i ≥ 1 do k := f(k, n - i) i := i - 1 if n ≤ 0 then i := 0 else i := n

technology from seed assume v = v i := 0 while i < n do k := f(k, i) i := i + 1 i := n while i ≥ 1 do k := f(k, n - i) i := i - 1 if n ≤ 0 then i := 0 else i := n assert v = v Automatic Equivalence Checking of UF+IA Programs Running example: 1) Sequential composition

technology from seed assume v = v i := 0 while i < n do k := a·k + b · i + c i := i + 1 (…) assert v = v Automatic Equivalence Checking of UF+IA Programs Running example: 2) Eliminate UFs f(k, i)

technology from seed assume v = v i := 0 if i < n then assume R i (j-1) < n ∧ R i (j) ≥ n k := R k (j) i := R i (j) (…) assert v = v Automatic Equivalence Checking of UF+IA Programs Running example: 3) Eliminate Loops assume v = v i := 0 while i < n do k := a·k + b · i + c i := i + 1 (…) assert v = v R i (j) = R i (j-1) + 1 R i (0) = 0 R k (j) = a × R k (j-1) + b × R i (j-1) + c R k (0) = k 0

technology from seed assume v = v i := 0 if i < n then assume R i (j-1) < n ∧ R i (j) ≥ n k := R k (j) i := R i (j) i := n if i ≥ 1 then assume V i (j-1) ≥ 1 ∧ V i (j) < 1 k := V k (j) i := V i (j) if n ≤ 0 then i := 0 else i := n assert v = v Automatic Equivalence Checking of UF+IA Programs Running example: 3) Eliminate Loops

technology from seed Program equivalence Example Algorithm Application to compiler optimizations Evaluation: CORK Automatic Equivalence Checking of UF+IA Programs Outline

technology from seed 1.Sequential composition 2.Replace UFs with polynomials 3.Replace loops with recurrences 4.Prove safety of resulting program Automatic Equivalence Checking of UF+IA Programs Algorithm

technology from seed Automatic Equivalence Checking of UF+IA Programs Algorithm: 1) Sequential Composition assume v = v P1(v) P2(v) assert v = v

technology from seed u(f, i) is equal to the maximum number of applications of f with distinct values in the ith parameter in all paths minus one Automatic Equivalence Checking of UF+IA Programs Algorithm: Function u if i < n then k := f(y, 3) else k := f(z, 3) if f(x, 3) < 0 ∧ k < 0 then … u(f, 1) = 1 u(f, 2) = 0

technology from seed Automatic Equivalence Checking of UF+IA Programs Algorithm: Polynomial Interpolation

technology from seed UFs are rewritten to polynomials over its inputs Automatic Equivalence Checking of UF+IA Programs Algorithm: 2) UF -> Polynomial

technology from seed Automatic Equivalence Checking of UF+IA Programs Algorithm: 3) Loops -> Recurrences while b do c if b then assume σ n-1 (b) ∧ σ n (¬b) v i := σ n (v i ) else assume n = 0 →

technology from seed Resulting program is correct iff the 2 programs are partially equivalent Standard model checkers or VC gen + constraint solving can now prove correctness Automatic Equivalence Checking of UF+IA Programs Algorithm: 4) Prove safety of resulting program

technology from seed Program equivalence Example Algorithm Application to compiler optimizations Evaluation: CORK Automatic Equivalence Checking of UF+IA Programs Outline

technology from seed Compiler optimization –Transformation function –Precondition –Profitability heuristic Automatic Equivalence Checking of UF+IA Programs Compiler Optimizations

technology from seed while I < N do S I := I + 1 Automatic Equivalence Checking of UF+IA Programs Loop Unrolling while (I + 1) < N do S I := I + 1 S I := I + 1 if I < N then S I := I + 1 ⇒ Precondition: R(S) = {I, N, c 1 } W(S) = {c 1 }

technology from seed while i < n do x := i + 2 i := i + 1 Automatic Equivalence Checking of UF+IA Programs Loop Unrolling: Example instantiation while (i + 1) < n do x := i + 2 i := i + 1 x := i + 2 i := i + 1 if i < n then x := i + 2 i := i + 1 while I < N do S I := I + 1 ⇒ S ≡ x := i + 2 I ≡ i N ≡ n while (I + 1) < N do S I := I + 1 S I := I + 1 if I < N then S I := I + 1

technology from seed Transformation function specified as 2 template programs Precondition specified as read/write sets for template statements and expressions plus IA formulas Automatic Equivalence Checking of UF+IA Programs Compiler Optimizations: Our abstraction

technology from seed A transformation function can be written as two UF+IA programs –Template statements are converted to UFs, that read and write from/to their read/write sets Automatic Equivalence Checking of UF+IA Programs Transformation function to UF+IA Program S x,y := S x (y, z), S y (y, z) Precondition: R(S) = {y, z} W(S) = {x, y} →

technology from seed Program equivalence Example Algorithm Application to compiler optimizations Evaluation: CORK Automatic Equivalence Checking of UF+IA Programs Outline

technology from seed Implemented in OCaml (~1,100 LoC) Uses Wolfram Mathematica 8 for constraint and recurrence solving Automatic Equivalence Checking of UF+IA Programs CORK: Compiler Optimization Correctness Checker

technology from seed Automatic Equivalence Checking of UF+IA Programs CORK: Results Benchmarks available from

technology from seed Presented a new algorithm to prove equivalence of UF+IA programs Presented CORK, a compiler optimization verifier, that can prove more optimizations correct than others Automatic Equivalence Checking of UF+IA Programs Conclusion

technology from seed Título da apresentação technology from seed