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.
Similar content being viewed by others
References
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
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
Bruynooghe M, De Schreye D, Krekels B: Compiling control. J Logic Program 6(1), 135–162 (1989)
Baader F, Nipkow T: Term rewriting and all that. Cambridge University Press, Cambridge (1999)
Bruynooghe M: A practical framework for the abstract interpretation of logic programs. J Logic Program 10(2), 91–124 (1991)
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
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)
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
Gallagher JP (1986) Transforming logic programs by specialising interpreters. In: ECAI, pp 313–326
Hruza J, Stepánek P: Speedup of logic programs by binarization and partial deduction. TPLP 4(3), 355–380 (2004)
Komorowski HJ (1981) A specification of an abstract Prolog machine and its application to partial evaluation. PhD thesis, Linköping University
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)
Lloyd J: Foundations of logic programming. Springer, Berlin (1987)
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
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)
Lloyd JW, Shepherdson JC: Partial evaluation in logic programming. J Logic Program 11(3), 217–242 (1991)
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)
Martelli A, Montanari U: An efficient unification algorithm. ACM Trans Program Lang Syst (TOPLAS) 4(2), 258–282 (1982)
Nys V (2004) Extended concepts acpd. http://perswww.kuleuven.be/~u0055408/generalization-acpd.html
Nys V (2015) Examples of coroutining programs. http://perswww.kuleuven.be/~u0055408/analyzed-examples-acpd.html
Nys V (2016) Implementation of ACPD. http://perswww.kuleuven.be/~u0055408/implementation-acpd.html
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
Pettorossi A, Proietti M: Transformation of logic programs: foundations and techniques. J Logic Program 19, 261–320 (1994)
Pettorossi A, Proietti M: The list introduction strategy for the derivation of logic programs. Formal Aspects Comput 13(3-5), 233–251 (2002)
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
Vidal G: Annotation of logic programs for independent and-parallelism by partial evaluation. Theory Pract Logic Program 12(4-5), 583–600 (2012)
Wiggins GA (1990) The improvement of Prolog program efficiency by compiling control: a proof-theoretic view. Department of Artificial Intelligence, University of Edinburgh
Author information
Authors and Affiliations
Corresponding author
Additional information
Maurizio Proietti, Hirohisa Seki, and Jim Woodcock
Rights and permissions
About this article
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
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00165-016-0389-8