Abstractions Eric Feron. Outline Principles of abstraction Motivating example Abstracting variables Abstracting functions Abstracting operators Recommended.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Continuing Abstract Interpretation We have seen: 1.How to compile abstract syntax trees into control-flow graphs 2.Lattices, as structures that describe.
Boyce/DiPrima 9th ed, Ch 2.8: The Existence and Uniqueness Theorem Elementary Differential Equations and Boundary Value Problems, 9th edition, by William.
CSCI 115 Chapter 6 Order Relations and Structures.
Signals and Systems March 25, Summary thus far: software engineering Focused on abstraction and modularity in software engineering. Topics: procedures,
Roundoff and truncation errors
Hybrid Systems Presented by: Arnab De Anand S. An Intuitive Introduction to Hybrid Systems Discrete program with an analog environment. What does it mean?
Timed Automata.
Tutorial on Widening (and Narrowing) Hongseok Yang Seoul National University.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 13.
Christopher Dougherty EC220 - Introduction to econometrics (review chapter) Slideshow: asymptotic properties of estimators: plims and consistency Original.
1 Formal Methods in SE Qaisar Javaid Assistant Professor Lecture 05.
Infinite Sequences and Series
Ugo Montanari On the optimal approximation of descrete functions with low- dimentional tables.
CSCE 411 Design and Analysis of Algorithms Andreas Klappenecker TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAA.
CS 536 Spring Global Optimizations Lecture 23.
Discrete Mathematics Lecture 4 Harper Langston New York University.
Data Flow Analysis Compiler Design Nov. 3, 2005.
FSM Decomposition using Partitions on States 290N: The Unknown Component Problem Lecture 24.
Analysis of Software Eric Feron From "Semantic Foundations of Program Analysis" by P. Cousot in "Program Flow Analysis Theory and Applications" Muchnik.
4/25/08Prof. Hilfinger CS164 Lecture 371 Global Optimization Lecture 37 (From notes by R. Bodik & G. Necula)
Program analysis Mooly Sagiv html://
Data Flow Analysis Compiler Design Nov. 8, 2005.
Preference Analysis Joachim Giesen and Eva Schuberth May 24, 2006.
Prof. Fateman CS 164 Lecture 221 Global Optimization Lecture 22.
Orderings and Bounds Parallel FSM Decomposition Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 10 Update and modified by Marek.
Overview of program analysis Mooly Sagiv html://
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.
Programming Language Semantics Denotational Semantics Chapter 5 Part III Based on a lecture by Martin Abadi.
Course Outline Traditional Static Program Analysis –Theory Compiler Optimizations; Control Flow Graphs Data-flow Analysis: Data-flow frameworks –Classic.
Prof. Bodik CS 164 Lecture 16, Fall Global Optimization Lecture 16.
Krakow, Summer 2011 Circle and Sphere Orders William T. Trotter
©2003/04 Alessandro Bogliolo Background Information theory Probability theory Algorithms.
Abstract Interpretation (Cousot, Cousot 1977) also known as Data-Flow Analysis.
Regular Model Checking Ahmed Bouajjani,Benget Jonsson, Marcus Nillson and Tayssir Touili Moran Ben Tulila
Solving fixpoint equations
Chapter 1 Infinite Series, Power Series
Lecture 12 Statistical Inference (Estimation) Point and Interval estimation By Aziza Munir.
The importance of sequences and infinite series in calculus stems from Newton’s idea of representing functions as sums of infinite series.  For instance,
DISCRETE MATHEMATICS I CHAPTER 11 Dr. Adam Anthony Spring 2011 Some material adapted from lecture notes provided by Dr. Chungsim Han and Dr. Sam Lomonaco.
General (point-set) topology Jundong Liu Ohio Univ.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
The Integers. The Division Algorithms A high-school question: Compute 58/17. We can write 58 as 58 = 3 (17) + 7 This forms illustrates the answer: “3.
Lecture 10 Abstract Interpretation using Fixpoints.
Chapter 5 Parameter estimation. What is sample inference? Distinguish between managerial & financial accounting. Understand how managers can use accounting.
CS 267: Automated Verification Lecture 3: Fixpoints and Temporal Properties Instructor: Tevfik Bultan.
Unit 3.2 Properties of Real Functions ‘Real function’ refers to a function whose domain and range are sets of real numbers.
Sets and Subsets Set A set is a collection of well-defined objects (elements/members). The elements of the set are said to belong to (or be contained in)
12 INFINITE SEQUENCES AND SERIES. In general, it is difficult to find the exact sum of a series.  We were able to accomplish this for geometric series.
1/6/20161 CS 3343: Analysis of Algorithms Lecture 2: Asymptotic Notations.
1/32 This Lecture Substitution model An example using the substitution model Designing recursive procedures Designing iterative procedures Proving that.
Program Correctness. The designer of a distributed system has the responsibility of certifying the correctness of the system before users start using.
Rate Distortion Theory. Introduction The description of an arbitrary real number requires an infinite number of bits, so a finite representation of a.
Department of Statistics University of Rajshahi, Bangladesh
Semilattices presented by Niko Simonson, CSS 548, Autumn 2012 Semilattice City, © 2009 Nora Shader.
Chaotic Iterations Mooly Sagiv Tel Aviv University Textbook: Principles of Program Analysis.
Chaotic Iterations Mooly Sagiv Tel Aviv University Textbook: Principles of Program Analysis.
Ch03-Algorithms 1. Algorithms What is an algorithm? An algorithm is a finite set of precise instructions for performing a computation or for solving a.
Euclidean space Euclidean space is the set of all n-tuples of real numbers, formally with a number called distance assigned to every pair of its elements.
DFA foundations Simone Campanoni
SS 2017 Software Verification Timed Automata
Fixpoints and Reachability
Sampling Distributions and Estimation
Instructor: Rajeev Alur
Simone Campanoni DFA foundations Simone Campanoni
Chapter 1 Infinite Series, Power Series
Concurrent Models of Computation
Lecture 20: Dataflow Analysis Frameworks 11 Mar 02
This Lecture Substitution model
Algorithms and Data Structures Lecture II
Presentation transcript:

Abstractions Eric Feron

Outline Principles of abstraction Motivating example Abstracting variables Abstracting functions Abstracting operators Recommended readings

Principles of abstractions We consider software or hardware objects which are too complicated to describe exactly. We approximate them by embedding them into larger objects, but whose description is simpler. If the original objects are subject to manipulations, we are able to manipulate their abstractions at comparable computational cost. Hopefully we learn something useful.

Example Prototype program [1] while x> 1000 do [2] x:=x+y ; [3] od; [4] (x,y) in [-b-1;b] integer b is overflow limit. Program characteristics: Program terminates without error iff (x>0, y0<0). Execution never terminates iff (1000< x0<b)  (y0=0). Execution leads to run-time error (by overflow) iff (x0>1000)  (y0>0). These are desirable characteristics to be found

Where can the states of a program go? [1] while x> 1000 do [2] x:=x+y ; [3] od; [4] (x,y) in I =[-b;b] integer if x> 1000 if x<1000 if x>1000 if x<1000 Representation of program behavior by means of automaton possible but not really compact.

Reachable states

Order relation is that of inclusion: A set is smaller than another if it is included in it Forms a complete lattice: Any finite set of sets has a least upper bound and a greatest lower bound. Reachable set always grows with iterations Basic theorem: A sequence of sets that always grows ends up converging. But convergence can take a very long time

Example of complete lattice Set L of subsets of states in a state-space S: Partial order is traditional inclusion H = {H1,H2}  L H1 U H2 is the least upper bound for H. H1  H2 is the greatest lower bound for H. Obviously these exist for any H. L has an infimum: The empty set L has a supremum: S. H1 H2 Problem: Arbitrary sets are often not computer-representable, thus hard to do computations with them.

(Discrete) Complete Lattices Some element in the set A Least upper bound Greatest lower bound For our purposes, each element is a set. So A is a set of sets. A

if x> 1000 if x<1000 if x>1000  if x<1000 Back to our program Assume y 0. Clearly insufficient to identify what will happen to program states Could use abstraction by means of intervals: eg: x in [200;2000], y in [-2 -1] Can extract "propagation laws" for intervals rather than numbers.

Lattice of Intervals least upper bound (lub) greatest lower bound (glb) In two dimensions Greatest lower bound Least upper bound In one dimension

if x> 1000 if x<1000 if x>1000  if x<1000 From program on variables to abstracted program on abstracted variables if x<1000 if x>1000  if x<1000 (X1,Y1) if x> 1000 (X2,Y2)= (lub((X1  [1000;b]) U (X3  [1000;b])),lub(Y1UY3)) (X3,Y3) = (X2+Y2,Y2) (X4,Y4)=(lub((X1  [-b;1000]) U(X3  [-b;1000])), lub(Y1UY3)

Step if x> 1000 if x<1000 if x>1000 if x<1000 X1 = [200;2000], Y1 = [-2 -1] X2= , Y2 =  X3= , Y3 =  x= , y =  (X2,Y2)= (lub((X1  [1000;b]) U (X3  [1000;b])),lub(Y1UY3)) (X4,Y4)=(lub((X1  [-b;1000]) U(X3  [-b;1000])), lub(Y1UY3) (X3,Y3) = (X2+Y2,Y2)

Step if x> 1000 if x<1000 if x>1000  if x<1000 X1 =[200;2000], Y1 = [-2 -1] X2 = [1000;2000] Y2 = [-2 -1] X3= , Y3 =  X4= , Y4=  (X2,Y2)= (lub((X1  [1000;b]) U (X3  [1000;b])),lub(Y1UY3)) (X4,Y4)=(lub((X1  [-b;1000]) U(X3  [-b;1000])), lub(Y1UY3) (X3,Y3) = (X2+Y2,Y2)

Step if x> 1000 if x<1000 if x>1000  if x<1000 X1 =[200;2000], Y1 = [-2 -1] X2 = [1000;2000] Y2 = [-2 -1] X3= [998,1999], Y3 = [-2-1] X4= , Y4=  (X2,Y2)= (lub((X1  [1000;b]) U (X3  [1000;b])),lub(Y1UY3)) (X4,Y4)=(lub((X1  [-b;1000]) U(X3  [-b;1000])), lub(Y1UY3) (X3,Y3) = (X2+Y2,Y2)

Step if x> 1000 if x<1000 if x>1000  if x<1000 X1 =[200;2000], Y1 = [-2 -1] X2 = [1000;2000] Y2 = [-2 -1] X3= [998,1999], Y3 = [-2;-1] X4= [200,999], Y4= [-2;-1] (X2,Y2)= (lub((X1  [1000;b]) U (X3  [1000;b])),lub(Y1UY3)) (X4,Y4)=(lub((X1  [-b;1000]) U(X3  [-b;1000])), lub(Y1UY3) (X3,Y3) = (X2+Y2,Y2) Any further iteration would not yield any change to the values of (Xi, Yi)s: We have reached a fixed point.

Step if x> 1000 if x<1000 if x>1000 if x<1000 X1 = [1200;2000], Y1 = [-2 -1] X2= , Y2 =  X3= , Y3 =  x= , y =  (X2,Y2)= (lub((X1  [1000;b]) U (X3  [1000;b])),lub(Y1UY3)) (X4,Y4)=(lub((X1  [-b;1000]) U(X3  [-b;1000])), lub(Y1UY3) (X3,Y3) = (X2+Y2,Y2) New initial conditions

Step if x> 1000 if x<1000 if x>1000  if x<1000 X1 =[1200;2000], Y1 = [-2 -1] X2 = [1200;2000] Y2 = [-2 -1] X3= , Y3 =  X4= , Y4=  (X2,Y2)= (lub((X1  [1000;b]) U (X3  [1000;b])),lub(Y1UY3)) (X4,Y4)=(lub((X1  [-b;1000]) U(X3  [-b;1000])), lub(Y1UY3) (X3,Y3) = (X2+Y2,Y2)

Step if x> 1000 if x<1000 if x>1000  if x<1000 X1 =[1200;2000], Y1 = [-2 -1] X2 = [1200;2000] Y2 = [-2 -1] X3= [1198,1999], Y3 = [-2-1] X4= , Y4=  (X2,Y2)= (lub((X1  [1000;b]) U (X3  [1000;b])),lub(Y1UY3)) (X4,Y4)=(lub((X1  [-b;1000]) U(X3  [-b;1000])), lub(Y1UY3) (X3,Y3) = (X2+Y2,Y2)

Step if x> 1000 if x<1000 if x>1000  if x<1000 (X2,Y2)= (lub((X1  [1000;b]) U (X3  [1000;b])),lub(Y1UY3)) (X4,Y4)=(lub((X1  [-b;1000]) U(X3  [-b;1000])), lub(Y1UY3) (X3,Y3) = (X2+Y2,Y2) We are not finished with iterations..... X1 =[1200;2000], Y1 = [-2 -1] X2 = [1200;2000] Y2 = [-2 -1] X3= [1198,1999], Y3 = [-2-1] X4= , Y4= 

Step if x> 1000 if x<1000 if x>1000  if x<1000 (X2,Y2)= (lub((X1  [1000;b]) U (X3  [1000;b])),lub(Y1UY3)) (X4,Y4)=(lub((X1  [-b;1000]) U(X3  [-b;1000])), lub(Y1UY3) (X3,Y3) = (X2+Y2,Y2) X1 =[1200;2000], Y1 = [-2 -1] X2 = [1198;2000] Y2 = [-2 -1] X3= [1198,1999], Y3 = [-2-1] X4= , Y4= 

Step if x> 1000 if x<1000 if x>1000  if x<1000 (X2,Y2)= (lub((X1  [1000;b]) U (X3  [1000;b])),lub(Y1UY3)) (X4,Y4)=(lub((X1  [-b;1000]) U(X3  [-b;1000])), lub(Y1UY3) (X3,Y3) = (X2+Y2,Y2) X1 =[1200;2000], Y1 = [-2 -1] X2 = [1198;2000] Y2 = [-2 -1] X3= [1196,1999], Y3 = [-2-1] X4= , Y4=  All this is going to take a while to converge towards fixed point...

Some interesting questions How can I speed up the convergence of the computations leading to a fixed point? Does the order in which I do the computation (the sequence of vertices where reachable sets are computed) have much importance? How do I automatically write the "abstracted program"?

Abstracting state spaces further {Set of all subsets of signed integer numbers between -b and b}   if x = T then x is any value if x = + then 0<x<b if x = 0 then x = 0 if x = - then -b<x<0 if x =  then  Some Rules: = T but = error = error Effect: Go from huge state-space decompositions to finite and simple state-space decomposition + U - = T o  T = o

if x> 1000 if x<1000 if x>1000  if x<1000 From program on variables to abstracted program on abstracted variables if x<1000 if x>1000  if x<1000 (X1,Y1) if x> 1000 (X2,Y2)=((X3  +)U (X1  +),Y1UY3) (X3,Y3) =(X2+Y2,Y2) (X4,Y4)=(X1UX3,Y1UY3)

if x> 1000 if x<1000 if x>1000  if x<1000 X1= +, Y1 = - Step 1 X2= , Y2 =  X3= , Y3 =  X4 = , Y4 =  (X2,Y2)=((X3  +)U (X1  +),Y1UY3) (X3,Y3) =(X2+Y2,Y2) (X4,Y4)=(X1UX3,Y1UY3)

if x> 1000 if x<1000 if x>1000  if x<1000 X1= +, Y1 = - Step 2 X2= +, Y2 = - X3= , Y3 =  X4 = , Y4 =  (X2,Y2)=((X3  +)U (X1  +),Y1UY3) (X3,Y3) =(X2+Y2,Y2) (X4,Y4)=(X1UX3,Y1UY3)

if x> 1000 if x<1000 if x>1000  if x<1000 X1= +, Y1 = - Step 3 X2= +, Y2 = - X3= T, Y3 = - X4 = , Y4 =  (X2,Y2)=((X3  +)U (X1  +),Y1UY3) (X3,Y3) =(X2+Y2,Y2) (X4,Y4)=(X1UX3,Y1UY3)

if x> 1000 if x<1000 if x>1000  if x<1000 X1= +, Y1 = - Step 4 X2= +, Y2 = - X3= T, Y3 = - X4 = T, Y4 = - (X2,Y2)=((X3  +)U (X1  +),Y1UY3) (X3,Y3) =(X2+Y2,Y2) (X4,Y4)=(X1UX3,Y1UY3)... and we have reached a fixed point....

Other motivating example In ideal world (real numbers are reals and multiplies are truly working as they should, the sequence converges to 1 for any delta and x0. But real world is populated by, well, floats, and things become more hairy. In particular, system may exhibit disgraceful behaviors, including non convergence to zero (or its vicinity). Assume we would like to “establish good behavior” of the system over a range of possible initial conditions and values of delta. Issue: Exhaustive exploration of state-space is necessary but impossible in current form. Must work at higher abstract level.

Abstraction of floats Float format (figuratively) defined as: Geometric distribution: 0 How do we prove things work over this range? Possibly LOTS of floats between f1 and f2. Abstraction: Consider the whole real interval between f1 and f2: [f1 f2]. Counterintuitive because reals are not machine representable. Simple object though – the object itself (the interval) is machine-representable. f1 f2

Working with abstractions Intuitively: But Must have some machine-representable description of where interval could “land” after “+” operation. Sounds trivial but requires monotonicity properties of ‘+’ operation over floats. In this case it’s OK. So we can write

Associativity counts… and + under floats is not associative

Back to system Must define interval for xks. Transition rules for intervals: “Abstracted transitions” So in this case we can monitor behavior of entire interval by monitoring bounds.

Nonconvergence :

Would like to “bound” possible behaviors From observations: Looks like it stays around 1. Look at behaviors of intervals in vicinity of 1. Eg pick By induction, true for all following iterations: So we know [ ] is invariant. Nonconvergence (to 1) maybe, but could that be sufficient level of precision for practical purposes?? Note analysis is for fixed delta (1e-5) – so far.

Guaranteed convergence to region of nonconvergence Fix delta and a for simplicity (you make them live in intervals for HW) Look in more detail at behavior of Need easy to analyze upper bounds for x+ and lower bounds for x- Requires abstraction of float operations (+ and x) themselves!

Abstraction of float operations

Back to problem