Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Data Flow Analysis and Abstract Interpretation

What is the difference between Data Flow Analysis and Abstract Interpretation and are they used for the same purpose? What are the pros and cons of these two relative to each other.

like image 383
MetallicPriest Avatar asked Jun 28 '13 18:06

MetallicPriest


People also ask

What do you mean by data flow analysis?

Data-flow analysis is a technique for gathering information about the possible set of values calculated at various points in a computer program. A program's control-flow graph (CFG) is used to determine those parts of a program to which a particular value assigned to a variable might propagate.

What is data flow abstraction?

Data flow has been proposed as an abstraction for specifying the global behavior of distributed system components: in the live distributed objects programming model, distributed data flows are used to store and communicate state, and as such, they play the role analogous to variables, fields, and parameters in Java- ...


2 Answers

In short, they are in different categories. It's like comparing cloths and pants.

Abstract interpretation is a framework that formalizes fixed point computation using an abstract domain and abstract transfer functions. Abstract interpretation guarantees that the fixed point should be found in finite steps if the certain conditions are met (for the details: http://www.di.ens.fr/~cousot/COUSOTpapers/POPL77.shtml). What greatness of abstract interpretation comes from widening and narrowing. Abstract interpretation can compute a fixed point over an infinite domain because of them.

IMO, data flow analysis is just one instance of abstract interpretation. Since most concrete domains used by data flow analysis are finite, you don't even need widening and narrowing.

like image 171
ihji Avatar answered Sep 24 '22 03:09

ihji


I'm not sure any of the answers here really address the intent of the original question, which seems to be asking for an intuitive, not technical, explanation. Dataflow analysis is concerned with getting the value of some piece of information at a given location. Examples of "information" are which definitions reach a given location, which variables are live at a given location, which expressions are constant at at a given location etc. Dataflow frameworks will typically require that the domain of values forms a finite lattice, that the transfer functions be monotone (the transfer function determines how that information is propagated from entry to the exit of the block), all this with the aim of being able to compute a fixed-point of dataflow values. It is used in compilers.

Abstract Interpretation (AI) OTOH aims to construct an abstract interpreter of the language. The goal is to determine "What does this piece of code compute? Lets try and answer that question in an abstract sense". For example, if the computation returns the value of some index variable i, AI might compute a range for i so you can answer if there will be a bounds violation or something. So the domain of abstract values is slightly different, it might be a range domain, a polyhedral domain, etc. For this reason AI places different constraints from dataflow: the concrete and abstract domains are typically required to be related by something called a galois connection, which relates sets of concrete values to abstract ones. Because the domains used aren't required to be finite, AI won't always converge without intervention, in the form of widening/narrowing operations. AI is used in formal verification tools. They both share in common a desire to have the function iteration converge but that's about it. So use dataflow analysis if you want to know the value of something at a location, use AI if you want to know what a program abstractly computes.

Both dataflow and AI can be used together. For example the disassembler tool Jakstab combines both - the dataflow is used to determine values for indirect jump targets (ie. what is new computed the value of the PC that will be loaded) and the AI is used to abstractly evaluate the piece of binary code.

like image 42
N.S. Avatar answered Sep 20 '22 03:09

N.S.