Skip to main content

Strictness Analysis as Finite-Domain Constraint Solving

  • Conference paper
  • First Online:
Book cover Logic-Based Program Synthesis and Transformation (LOPSTR 1998)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1559))

  • 205 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. M.-M. Corsini, K. Musumbu, A. Rauzy, and B. Le Charlier. Efficient bottom-up abstract interpretation of Prolog by means of constraint solving over symbolic finite domains. In M. Bruynooghe and J. Penjam, editors, Programming Language Implementation and Logic Programming, LNCS 714, pages 75–91. Springer-Verlag, 1993.

    Google Scholar 

  2. P. Cousot and R. Cousot. Higher-order abstract interpretation (and application to comportment analysis generalizing strictness, termination, projection and PER analysis of functional languages. In Proc. 1994 Int. Conf. Computer Languages, pages 95–112. IEEE Computer Society, 1994.

    Google Scholar 

  3. F. Henglein. Efficient type inference for higher-order binding-time analysis. In J. Hughes, editor, Functional Programming Languages and Computer Architecture, LNCS 523, pages 448–472. Springer-Verlag, 1991.

    Google Scholar 

  4. T. P. Jensen. Disjunctive strictness analysis. In Proc. Seventh Ann. IEEE Symp. Logic in Computer Science, pages 174–185, 1992.

    Google Scholar 

  5. J. M. Kewley and K. Glynn. Evaluation annotations for Hope+. Functional Programming: Proc. 1989 Glasgow Workshop, pages 329–337. Springer-Verlag, 1990.

    Google Scholar 

  6. A. Mycroft. Abstract Interpretation and Optimising Transformations for Applicative Programs. PhD thesis, University of Edinburgh, Scotland, 1981.

    Google Scholar 

  7. R. Plasmeijer and M. van Eekelen. Functional Programming and Parallel Graph Rewriting. Addison-Wesley, 1993.

    Google Scholar 

  8. R. Sekar and I. V. Ramakrishnan. Fast strictness analysis based on demand propagation. ACM Trans. Programming Languages and Systems, 17(6):896–937, 1995.

    Article  MathSciNet  Google Scholar 

  9. Martin Sulzmann, Martin Odersky, and Martin Wehr. Type inference with constrained types (extended abstract). In B. Pierce, editor, Proc. Fourth Int. Workshop Foundations of Object-Oriented Languages, 1997. http://www.cs.indiana.edu/hyplan/pierce/fool.

  10. P. Wadler. Strictness analysis on non-flat domains (by abstract interpretation over finite domains). In S. Abramsky and C. Hankin, editors, Abstract Interpretation of Declarative Languages, pages 266–275. Ellis Horwood, 1987.

    Google Scholar 

  11. D. A. Wright. Linear, strictness and usage logics. In M. Houle and P. Eades, editors, Proc. CATS’96, Australian Computer Science Communications 18(3), pages 73–80, 1996.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1999 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Gabrić, T., Glynn, K., Søndergaard, H. (1999). Strictness Analysis as Finite-Domain Constraint Solving. In: Flener, P. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 1998. Lecture Notes in Computer Science, vol 1559. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-48958-4_14

Download citation

  • DOI: https://doi.org/10.1007/3-540-48958-4_14

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-65765-1

  • Online ISBN: 978-3-540-48958-0

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics