Strictness Analysis as Finite-Domain Constraint Solving

  • Authors:
  • Tihomir Gabric;Kevin Glynn;Harald Søndergaard

  • Affiliations:
  • -;-;-

  • Venue:
  • LOPSTR '98 Proceedings of the 8th International Workshop on Logic Programming Synthesis and Transformation
  • Year:
  • 1998

Quantified Score

Hi-index 0.00

Visualization

Abstract

It has become popular to express dataflow analyses in logical form. In this paper we investigate a new approach to the analysis of functional programs, based on synthesis of constraint logic programs. We sketch how the language Toupie, originally designed with logic program analysis as one objective, lends itself also to sophisticated strictness analysis. Strictness analysis is straightforward in the simplest case, that of analysing a FIrst-order functional language using just two strictness values, namely divergence and "don't know". Mycroft's classical translation immediately yields perfectly valid Boolean constraint logic programs, which, when run, provide the desired strictness information. However, more sophisticated analysis requires more complex domains of strictness values. We recast Wadler's classical analysis over a 2n-point domain as FInite-domain constraint solving. This approach has several advantages. First, the translation is relatively simple. We translate a recursive function deFInition into one or two constraint program clauses, in a manner which naturally extends Mycroft's translation for the 2-point case, where the classical approach translate the definition of an n-place function over lists into 4n mutually recursive equations. Second, the resulting program produces relational information, allowing for example to ask which combinations of properties of input will produce a given output. Third, the approach allows us to leverage from established technology, for solving FInite-domain constraints, as well as for FInding FIxed points. Finally, the use of (disjunctive) constraints can yield a higher precision in the analysis of some programs.