Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Short implementation examples of abstract interpretation

I am taking a course on abstract interpretation, but I haven't seen any examples of how the theory maps down to actual code.

I am looking for short code examples, where I preferably won't have to work with a whole compiler. The analysis doesn't have to be useful, I would just like to see an example where the analysis is derived and then implemented.

Does anyone know of any such examples, perhaps from a university course?

like image 355
Jørgen Fogh Avatar asked May 28 '10 11:05

Jørgen Fogh


4 Answers

There is this paper by Bertot

Structural abstract interpretation, A formal study using Coq

That gives a full implementation of an abstract interpreter for a simple toy language using the Coq Proof Assistant. I used this for a concrete reference, and found it useful, although a little hard going, which is to be expected given the subject matter. Coq is a great little piece of software.

I also came across in a Cousot paper:

A gentle introduction to formal verification of computer systems by abstract interpretation

rough details (but I am sure there will be useful citations for full details) of an implementation in Astrée, I am not familiar with Astrée, so didn't actually read that section, but I think it meets your criteria.

If you come across anymore, please let me know! Would especially like to see a prolog abstract interpreter.

like image 160
Tom Avatar answered Nov 20 '22 12:11

Tom


Maybe this tool is also interesting for you: Interproc Analyzer

It is an abstract analyzer for a very simple language, which however offers interprocedural analyses. You can try out the analysis and get numerical invariants about the analyzed program. The source code is available (OCaml).

A really thorough and precise course, given by one of the "creators" of Abstract Interpretation, Patrick Cousot (already mentioned in one of the answers): MIT course about Abstract Interpretation. The course also offers assignments, in OCaml.

like image 42
Pachelbel Avatar answered Nov 20 '22 14:11

Pachelbel


AI is based on a mathematic theory name Galois Connection. The theory is very simple:

  1. Abstract the behaviour of the program.
  2. Perform the analysis on the abstract level.

Galois connection: To relate the Actual and Abstract program.

This is the best tutorial I have seen so far about Abstract Interpretation:

like image 5
MARYAM Avatar answered Nov 20 '22 13:11

MARYAM


There is MonoREIL, which comes with the recently open sourced tool BinNavi.

See here is a short intro.

Note that the context of the MonoREIL framework is not compilers but the analysis of binary code. Yet, it has been used for real world applications, see slide 34 ff of this introduction (which contains more formal background).

like image 1
langlauf.io Avatar answered Nov 20 '22 13:11

langlauf.io