Skip to main content
Log in

Abstract conjunctive partial deduction for the analysis and compilation of coroutines

  • Original Article
  • Published:
Formal Aspects of Computing

Abstract

We provide an approach to formally analyze the computational behavior of coroutines in logic programs and to compile these computations into new programs, not requiring any support for coroutines. The problem was already studied near to 30 years ago, in an analysis and transformation technique called compiling control. However, this technique had a strong ad hoc flavor: the completeness of the analysis was not well understood and its symbolic evaluation was also rather ad hoc. We show how abstract conjunctive partial deduction, introduced by Leuschel in 2004, provides an appropriate setting to redefine compiling control. We define an abstract domain and all abstract operations required by abstract conjunctive partial deduction. We prove that these concepts satisfy all the correctness conditions imposed by the framework and therefore inherit its main correctness theorem. We also show that there exist more complex coroutining examples which do not fit within abstract conjunctive partial deduction and we propose some further extensions to include them.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Boulanger D, Bruynooghe M, De Schreye D (1993) Compiling control revisited: a new approach based upon abstract interpretation for constraint logic programs. In: Proceedings of the 5th workshop on logic programming environments (LPE 1993), October 29–30, 1993, in conjunction with ILPS 1993, Vancouver, British Columbia, Canada, pp 39–51

  2. Bruynooghe M, De Schreye D, Krekels B (1986) Compiling control. In: Proceedings of the 1986 symposium on logic programming, pp 70–77, Salt Lake City. IEEE Society Press

  3. Bruynooghe M, De Schreye D, Krekels B: Compiling control. J Logic Program 6(1), 135–162 (1989)

    Article  MATH  Google Scholar 

  4. Baader F, Nipkow T: Term rewriting and all that. Cambridge University Press, Cambridge (1999)

    MATH  Google Scholar 

  5. Bruynooghe M: A practical framework for the abstract interpretation of logic programs. J Logic Program 10(2), 91–124 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  6. De Angelis E, Fioravanti F, Pettorossi A, Proietti (2015) Proving correctness of imperative programs by linearizing constrained horn clauses. TPLP 15(4–5):635–650

  7. De Schreye D, Glück R, Jørgensen J, Leuschel M, Martens B, Sørensen MH: Conjunctive partial deduction: foundations, control, algorithms, and experiments. J Logic Program 41(2), 231–277 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  8. De Schreye D, Nys V, Nicholson C (2014) Analysing and compiling coroutines with abstract conjunctive partial deduction. In: Logic-based program synthesis and transformation. Springer, Berlin, pp 21–38

  9. Gallagher JP (1986) Transforming logic programs by specialising interpreters. In: ECAI, pp 313–326

  10. Hruza J, Stepánek P: Speedup of logic programs by binarization and partial deduction. TPLP 4(3), 355–380 (2004)

    MathSciNet  MATH  Google Scholar 

  11. Komorowski HJ (1981) A specification of an abstract Prolog machine and its application to partial evaluation. PhD thesis, Linköping University

  12. Leuschel M: A framework for the integration of partial evaluation and abstract interpretation of logic programs. ACM Trans Program Lang Syst (TOPLAS) 26(3), 413–463 (2004)

    Article  Google Scholar 

  13. Lloyd J: Foundations of logic programming. Springer, Berlin (1987)

    Book  MATH  Google Scholar 

  14. Leuschel M, Martens B (1996) Global control for partial deduction through characteristic atoms and global trees. In: Partial evaluation, international seminar, Dagstuhl Castle, Germany, February 12–16, 1996, Selected Papers, pp 263–283

  15. Leuschel M, Martens B, De Schreye D: Controlling generalization and polyvariance in partial deduction of normal logic programs. ACM Trans Program Lang Syst 20(1), 208–258 (1998)

    Article  Google Scholar 

  16. Lloyd JW, Shepherdson JC: Partial evaluation in logic programming. J Logic Program 11(3), 217–242 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  17. Martens B, De Schreye D, Horváth T: Sound and complete partial deduction with unfolding based on well-founded measures. Theor Comput Sci 122(1), 97–117 (1994)

    Article  MathSciNet  MATH  Google Scholar 

  18. Martelli A, Montanari U: An efficient unification algorithm. ACM Trans Program Lang Syst (TOPLAS) 4(2), 258–282 (1982)

    Article  MATH  Google Scholar 

  19. Nys V (2004) Extended concepts acpd. http://perswww.kuleuven.be/~u0055408/generalization-acpd.html

  20. Nys V (2015) Examples of coroutining programs. http://perswww.kuleuven.be/~u0055408/analyzed-examples-acpd.html

  21. Nys V (2016) Implementation of ACPD. http://perswww.kuleuven.be/~u0055408/implementation-acpd.html

  22. Puebla G, Garcia de la Banda MJ, Marriott K, Stuckey PJ (1997) Optimization of logic programs with dynamic scheduling. In: Logic programming: proceedings of the international conference on logic programming, vol 97. MIT Press, pp 93–107

  23. Pettorossi A, Proietti M: Transformation of logic programs: foundations and techniques. J Logic Program 19, 261–320 (1994)

    Article  MathSciNet  MATH  Google Scholar 

  24. Pettorossi A, Proietti M: The list introduction strategy for the derivation of logic programs. Formal Aspects Comput 13(3-5), 233–251 (2002)

    Article  MATH  Google Scholar 

  25. Vidal G (2011) A hybrid approach to conjunctive partial evaluation of logic programs. In: Logic-based program synthesis and transformation. Springer, Berlin, pp 200–214

  26. Vidal G: Annotation of logic programs for independent and-parallelism by partial evaluation. Theory Pract Logic Program 12(4-5), 583–600 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  27. Wiggins GA (1990) The improvement of Prolog program efficiency by compiling control: a proof-theoretic view. Department of Artificial Intelligence, University of Edinburgh

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Vincent Nys.

Additional information

Maurizio Proietti, Hirohisa Seki, and Jim Woodcock

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Nys, V., De Schreye, D. Abstract conjunctive partial deduction for the analysis and compilation of coroutines. Form Asp Comp 29, 125–153 (2017). https://doi.org/10.1007/s00165-016-0389-8

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00165-016-0389-8

Keywords

Navigation