## TP3 — Interval analysis

Comes mainly from here.Thanks Antoine!

The goal of this session is to transform the denotational interpreter for our simple language
developed in the second session into an abstract
interpreter over the **interval** domain.

In addition to the provided front-end, the analyzer consists in two modules:

- an interval abstract domain;
- an iterator for our language.

These two parts should be made into modules as independent as possible so that:

- you can replace the interval domain with another one without changing the iterator (we will do this next week);
- you can reuse the interval domain for the static analysis project, which uses a different input language and a different intermediate representation for programs.

#### Iterator

The iterator should work by induction on the syntax tree of the program. It is actually very similar to the iterator we used in the denotational concrete semantics.

The main difference with the concrete semantics is the use of a **widening** to ensure the
termination of the analysis. For this practical exercise, we will focus first on the simplest
iteration techniques and then, if time allows, consider more advanced ones (widening with
thresholds, decreasing iterations, etc.).

#### Interval domain

We suggest that you create two modules:

- a module abstracting sets of integers as intervals;
- a functor lifting abstractions of sets of integers into abstractions of sets of mappings from variables to integers, using a non-relational abstraction (i.e., a map from variables to abstract sets of integers).

Additional advice is available at the end of this week's course.

During this practical exercise, you will only need to handle precisely simple tests, such as comparing a variable with another variable or a constant. In case the test is not simple, the analyzer should still be sound (e.g., by returning its environment argument unchanged). We leave the precise handling of arbitrary conditions for the project.