14

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.

Sebastian Paaske Tørholm
  • 45,185
  • 9
  • 92
  • 111
MetallicPriest
  • 25,675
  • 38
  • 166
  • 299

3 Answers3

12

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.

ihji
  • 1,376
  • 10
  • 19
1

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.

N.S.
  • 777
  • 4
  • 11
0

It boils down to "Efficiency vs accuracy".

Dataflow analysis tries to merge path data much more than abstract interpretation. Abstract interpretation walks over all paths, keeping data values abstract.

Michael Donohue
  • 11,606
  • 5
  • 29
  • 44
  • 4
    This answer is wrong. Path sensitivity is irrelevant to the difference between abstract interpretation and data flow analysis. – ihji Sep 23 '14 at 12:36