The 2nd assignment

Due date: Submission:

Use latex and email. Prepare a 5-10 min. presentation (demo) of the practical part.

T2.1: Invariant generation

Formalize contraint-based invariant generation for linear arithmetic as presented in class using the introduced terminology, i.e., program transitions, their representation in matrix form, invariant and template maps, etc.

Affine form of Farkas' lemma, as used in the class: if Ax ≤ b has a solution and Ax ≤ b imples cx ≤ δ then there exists a non-negative vector λ such that λ A = c and λ b ≤ δ.

T2.2: Farkas' lemma and its affine form

In the class, we used the affine form of Farkas' lemma, which is different from the original lemma. Prove the affine form from the original one (hint: use Duality theorem).

P2.3: From CIL expressions to clp(q,r)

We implement a compiler from CIL expression language to a string representation in the language of the clp(q,r) solver. The compiler should only translate the arithmetic subset, and raise "Not yet implemented" exception on other inputs. Use single quotes aroung variable names. For example, CIL representation of the expression x+y <= -z translates to the string 'x'+'y' =< -'z'.

Extend your C to CFG translator by the compiler for the expression language. Now, the edges of the produced dot-graphs should be decorated by clp(q,r) expressions.

P2.4: Symbolic execution

P2.5: From C to Prolog terms