Abstract
Meta-level compositions of object logic programs are naturally implemented by means of meta-programming techniques. Metainterpreters defining program compositions however suffer from a computational overhead that is due partly to the interpretation layer present in all meta-programs, and partly to the specific interpretation layer needed to deal with program compositions. We show that meta-interpreters implementing compositions of object programs can be fruitfully specialised w.r.t. meta-level queries of the form Demo(E,G), where E denotes a program expression and G denotes a (partially instantiated) object level query. More precisely, we describe the design and implementation of a declarative program specialiser that suitably transforms such metainterpreters so as to sensibly reduce — if not to completely remove — the overhead due to the handling of program compositions. In many cases the specialiser succeeds in eliminating also the overhead due to meta-interpretation.
Preview
Unable to display preview. Download preview PDF.
References
J. Barklund. Metaprogramming in Logic. In A. Kent and J.G. Williams, editors, Encyclopedia of Computer Sciene and Technology, chapter 33, pages 205–227. Marcel Dekker, 1995.
K. Benkerimi and J.W. Lloyd. A Partial Evaluation Procedure for Logic Programs. In S. Debray and M. Hermenegildo, editors, Logic Programming: Proceedings of the 1990 North American Conference, pages 343–358. The MIT Press, 1990.
A. F. Bowers and C. A. Gurr. Towards Fast and Declarative Meta-Programming. In K. Apt and F. Turini, editors, Meta-Logics and Logic Progamming, chapter 2, pages 137–166. The MIT Press, 1995.
A. Brogi. Program Construction in Computational Logic. PhD thesis, Department of Computer Science, University of Pisa, 1993.
A. Brogi and S. Contiero. Composing logic programs by meta-programming in Gödel. In K. Apt and F.Turini, editors, Meta-programming and Logic Programming, chapter 7, pages 167–194. The MIT Press, 1995.
A. Brogi and S. Contiero. A Program Specialiser for Meta-level Compositions of Logic Programs. TR 96-20, Dpt. of Computer Science, University of Pisa, 1996.
A. Brogi, P. Mancarella, D. Pedreschi, and F. Turini. Modular Logic Programming. ACM Transactions on Programming Languages and Systems, 16(4):1361–1398, 1994.
A. Brogi, C. Renso, and F. Turini. Amalgamating Language and Meta-Language for Composing Logic Programs. In M. Alpuente, R. Barbuti, and I. Ramos, editors, Proc. of the GULP-PRODE'94 Joint Conference, vol.2, pages 408–422, 1994.
A. Brogi and F. Turini. Meta-Logic for Program Composition: Semantics Issues. In K.R. Apt and F. Turini, editors, Meta-logics and Logic Programming, chapter 4, pages 83–110. The MIT Press, 1995.
M. Bruynooghe, D. De Schreye, and B. Martens. A General Criterion for Avoiding Infinite Unfolding during Partial Evaluation. New Generation Computing, 11(1):47–79, 1992.
M. Bugliesi, E. Lamma, and P. Mello. Partial Deduction for Structured Logic Programming. Journal of Logic Programming, 16(1, 2):89–122, 1993.
S. Costantini, P. Dell'Acqua, and G. A. Lanzarone. Extending Horn Clauses Theories by Reflection Principles. In M. MacNish, D. Pearce, and L. M. Pereira, editors, Logics in Artificial Intelligence, LNAI 838, pages 400–413. Springer-Verlag, 1994.
Y. Futamura. Partial Computation of Programs. In J. Hartmanis and G. Goos, editors, RIMS Symp. on Software Science and Engineering, LNCS 147, pages 1–35. Springer-Verlag, 1982.
J. Gallagher. Transforming Logic Programs By Specialising Interpreters. In ECAI-86, pages 313–326, 1986.
J. Gallagher. A System For Specialising Logic Programs. Technical Report 91-32, University of Bristol, 1991.
J. Gallagher. Tutorial on Specialisation of Logic Programs. In Proceedings PEPM93, ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pages 88–98. ACM Press, 1993.
J. Gallagher and M. Bruynooghe. Some Low-Level Source Transformations for Logic Programs. In M. Bruynooghe, editor, Proceedings of the Second Workshop on Meta-Programming in Logic, Leuven, Belgium, pages 229–244, 1990.
J. Gallagher and M. Bruynooghe. The Derivation of an Alghoritm for Program Specialisation. New Generation Computing, 9(3–4):305–333, 1991.
C.A. Gurr. A Self-Applicable Partial Evaluator for the Logic Programming Language Gödel. PhD thesis, University of Bristol, 1994.
P. Hill and J. Gallagher. Metaprogramming in Logic programming. In A. Robinson and C. Hogger, editors, Handbook of Logic in Artificial Intelligence and Logic Programming, chapter 5. Oxford University Press, 1996.
P.M. Hill and J.W. Lloyd. Analysis of metaprograms. In H.D. Abramson and M.H. Rogers, editors, Metaprogramming in Logic Programming, pages 23–52. The MIT Press, 1989.
P.M. Hill and J.W. Lloyd. The Gödel Programming Language. The MIT Press, 1994.
J. Jørgensen, M. Leuschel, and B. Martens. Conjunctive Partial Deduction. In J. Gallagher (editor) Pre-proceedings of LOPSTR-96, pages 46–62, 1996.
J. Komorowski. An Introduction to Partial Deduction. In A. Pettorossi, editor, Meta-Programming in Logic, LNCS 649, pages 49–69. Springer-Verlag, 1996.
E. Lamma, P. Mello, and A. Natali. Reflection Mechanisms for Combining Prolog Databases. Software: Practice and Experience, 21(6):603–624, 1991.
M. Leuschel and B. Martens. Partial Deduction of the Ground Representation and its Application to Integrity Checking. In John Lloyd, editor, Proceedings of ILPS'95, pages 495–509. The MIT Press, 1995.
M. Leuschel and B. Martens. Global Control for Partial Deduction through Characteristic Atoms and Global Trees. In Proceedings of the 1996 Dagstuhl Seminar on Partial Evaluation, LNCS 1110, pages 263–283, 1996.
M. Leuschel and D. De Schreye. An Almost Perfect Abstract Operation for Partial Deduction Using Characteristic Trees. In Technical Report CW 215, October 1995.
G. Levi and G. Sardu. Partial Evaluation of Metaprograms in a “Multiple Worlds” Logic Language. New Generation Computing, 6(2,3):227–247, 1988.
J.W. Lloyd. Foundations of logic programming. Springer-Verlag, 2nd, 1987.
J.W. Lloyd and J.C. Shepherdson. Partial evaluation in logic programming. Journal of Logic Programming, 11:217–242, 1991.
B. Martens and J. Gallagher. Ensuring Global Termination of Partial Deduction while Allowing Flexible Polyvariance. In L. Sterling, editor, Proceedings of ICLP95, pages 597–611. The MIT Press, 1995.
B. Martens and D. De Schreye. Why untyped non-ground meta-programming is not (much of) a problem. Journal of Logic Programming, 22(1):47–99, 1995.
B. Martens and D. De Schreye. Automatic Finite Unfolding using Well-Founded Measures. In Journal of Logic Programming, 1996 (to appear).
B. Martens, D. De Schreye, and T. Horváth. Sound and Complete Partial Deduction with Unfolding Based on Well-Founded Measures. Theoretical Computer Science, 122(1–2):97–117, 1995.
L. Monteiro and A. Porto. Contextual logic programming. In G. Levi and M. Martelli, editors, Proceedings Sixth ICLP, pages 284–302. The MIT Press, 1989.
S. Owen. Issues in the Partial Evaluation of Meta-Interpreters. In H. Abramson and M.H. Rogers, editors, Meta-Programming in Logic Programming, pages 319–340. The MIT Press, 1989.
A. Pettorossi and M. Proietti. Transformations of logic programs: Foundations and techniques. The Journal of Logic Programming, 19 & 20:261–320, 1994.
D. Sahlin. An Automatic Partial Evaluator for Full Prolog. PhD thesis, KTH, Dpt. of Telecommunications and Computer Systems, Stockolm, Sweden, 1991.
M. Sørensen and R. Glück. An Algorithm of Generalization in Positive Supercompilation. In John Lloyd, editor, Proceedings of ILPS'95, the International Logic Programming Symposium, pages 465–479. The MIT Press, 1995.
L. Sterling and E. Shapiro. The Art of Prolog. The MIT Press, 1986.
A. Takeuchi. Affinity between meta interpreters and partial evaluation. In H.-J. Kugler, editor, Information Processing 86, pages 279–282. North-Holland, 1986.
A. Takeuchi and K. Furukawa. Partial evaluation of Prolog programs and its application to meta-programming. In H.-J. Kugler, editor, Information Processing 86, pages 415–420. North-Holland, 1986.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1997 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Brogi, A., Contiero, S. (1997). Specialising meta-level compositions of logic programs. In: Gallagher, J. (eds) Logic Program Synthesis and Transformation. LOPSTR 1996. Lecture Notes in Computer Science, vol 1207. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-62718-9_16
Download citation
DOI: https://doi.org/10.1007/3-540-62718-9_16
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-62718-0
Online ISBN: 978-3-540-68494-7
eBook Packages: Springer Book Archive