## Section: New Results

### Static analysis via proof theory

Participant : Dale Miller.

Static analysis of logic programs can provide useful information for programmers and compilers. Typing systems, such as in Prolog [50] [51] , have proved valuable during the development of code: type errors often represent program errors that are caught at compile time when they are easier to find and fix than at runtime when they are much harder to repair. Static type information also provides valuable documentation of code since it provides a concise approximation to what the code does.

In [43] , Miller described a method by which it is possible to infer that certain relationships concerning collections underlying structured data hold. For collections, both multisets and sets were used to approximate more complicated structures as lists and binary trees. Consider, for example, a list sorting program that maintains duplicates of elements. Part of the correctness of a sort program includes the fact that if the atomic formula sort( t, s) is provable, then s is a permutation of t that is in-order. The proof of such a property is likely to involve inductive arguments requiring the invention of invariants: in other words, this is not likely to be a property that can be inferred statically during compile time. On the other hand, if the lists t and s are approximated by multisets (that is, if we forget the order of items in lists), then it might be possible to establish that if the atomic formula sort( t, s) is provable, then the multiset associated to s is equal to the multiset associated to t . If that is so, then it is immediate that the lists t and s are, in fact, permutations of one another (in other words, no elements were dropped, duplicated, or created during sorting). Such properties based on using multisets to approximate lists can often be inferred statically.

While this work focused exclusively on the static analysis of first-order Horn clauses, it does so by making substitution instances of such Horn clauses that carry them into linear logic. Proofs for the resulting linear logic formulas are then attempted as part of static analysis.

Work such as this suggests that declarative languages might permit rich kinds of static analysis. Such preliminary work provided a partial justification of the need for flexible connections between programming languages and static analysis that is briefly described in [38] .

Logo Inria