Hostname: page-component-5d59c44645-k78ct Total loading time: 0 Render date: 2024-03-02T06:53:14.871Z Has data issue: false hasContentIssue false

The YAP Prolog system

Published online by Cambridge University Press:  18 October 2011

VÍTOR SANTOS COSTA
Affiliation:
DCC & CRACS INESC-Porto LA, Faculty of Sciences, University of Porto, R. do Campo Alegre 1021/1055, 4169-007 Porto, Portugal (e-mail: vsc@dcc.fc.up.pt, ricroc@dcc.fc.up.pt)
RICARDO ROCHA
Affiliation:
DCC & CRACS INESC-Porto LA, Faculty of Sciences, University of Porto, R. do Campo Alegre 1021/1055, 4169-007 Porto, Portugal (e-mail: vsc@dcc.fc.up.pt, ricroc@dcc.fc.up.pt)
LUÍS DAMAS
Affiliation:
LIACC, Faculty of Sciences, University of Porto, R. do Campo Alegre 1021/1055, 4169-007 Porto, Portugal (e-mail: luis@ncc.up.pt)

Abstract

Yet Another Prolog (YAP) is a Prolog system originally developed in the mid-eighties and that has been under almost constant development since then. This paper presents the general structure and design of the YAP system, focusing on three important contributions to the Logic Programming community. First, it describes the main techniques used in YAP to achieve an efficient Prolog engine. Second, most Logic Programming systems have a rather limited indexing algorithm. YAP contributes to this area by providing a dynamic indexing mechanism, or just-in-time indexer. Third, a important contribution of the YAP system has been the integration of both or-parallelism and tabling in a single Logic Programming system.

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2011

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Aggoun, A., Chan, D., Dufresne, P., Falvey, E., Grant, H., Herold, A., Macartney, G., Meier, M., Miller, D., Mudambi, S., Perez, B., van Rossum, E., Schimpf, J., Tsahageas, P. A. and de Villeneuve, D. H. 1995. ECLiPSe 3.5 User Manual. ECRC.Google Scholar
Ali, K. and Karlsson, R. 1990. Full prolog and scheduling OR-parallelism in muse. International Journal of Parallel Programming 19, 6, 445475.Google Scholar
Arnold, D. J., Krauwer, S., Rosner, M., des Tombe, L. and Varile, G. B. 1986. The < C,A >, T framework in Eurotra: A theoretically committed notation for MT. In Proceedings of the 11th Conference on Computational linguistics. Association for Computational Linguistics, Morristown, NJ, 297303.,+T+framework+in+Eurotra:+A+theoretically+committed+notation+for+MT.+In+Proceedings+of+the+11th+Conference+on+Computational+linguistics.+Association+for+Computational+Linguistics,+Morristown,+NJ,+297–303.>Google Scholar
Beer, J. 1989. Concepts, Design, and Performance Analysis of a Parallel Prolog Machine. Lecture Notes in Computer Science, Vol. 404. Springer Verlag, Berlin, DE.Google Scholar
Benton, W. C. and Fischer, C. N. 2007. Interactive, scalable, declarative program analysis: From prototype to implementation. In Proceedings of the 9th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, Wroclaw, Poland, 14–16 July 2007, Leuschel, M. and Podelski, A., Eds. ACM, New York, NY, 1324.Google Scholar
Bueno, F., García de la Banda, M. and Hermenegildo, M. 1999. Effectivness of abstract interpretation in automatic parallelization: A case study in logic programming. ACM Transactions on Programming Languages and Systems 21, 2, 189239.Google Scholar
Camacho, R. 1994. Learning stage transition rules with Indlog. In Proceedings of the 4th International Workshop on Inductive Logic Programming. GMD-Studien, vol. 237. Gesellschaft für Mathematik und Datenverarbeitung MBH, 273290.Google Scholar
Carlsson, M. 1987. Freeze, indexing, and other implementation issues in the wam. In Proceedings of the 4th International Conference on Logic Programming, Lassez, J.-L., Ed. MIT Press Series in Logic Programming. University of Melbourne, MIT Press, Cambridge, MA, USA, 4058.Google Scholar
Carlsson, M. 1990. Design and Implementation of an OR-Parallel Prolog Engine. PhD Thesis, The Royal Institute of Technology. SICS Dissertation Series 02.Google Scholar
Carlsson, M. and Widen, J. 1988. SICStus Prolog User's Manual. Tech. Rep. SICS Research Report R88007B, Swedish Institute of Computer Science, Kista, Sweden.Google Scholar
Castro, L. F. and Costa, V. S. 2001. Understanding memory management in prolog systems. In Proceedings of the 17th International Conference on Logic Programming, ICLP 2001. Lecture Notes in Computer Science, vol. 2237. Paphos, Cyprus, 1126.Google Scholar
Chen, W. and Warren, D. S. 1993. Query evaluation under the well-founded semantics. In Proceedings of 12th PODS. 168–179.Google Scholar
Chico, P., Carro, M., Hermenegildo, M. V., Silva, C. and Rocha, R. 2008. An improved continuation call-based implementation of tabling. In Proceedings of the International Symposium on Practical Aspects of Declarative Languages. LNCS, vol. 4902. Springer-Verlag, Berlin, DE, 197213.Google Scholar
Colmerauer, A. 1993. The birth of prolog. In The Second ACM-SIGPLAN History of Programming Languages Conference. ACM, New York, NY, USA, 3752.Google Scholar
Costa, V. S. 1988. Implementação de prolog. Provas de aptidão pedagógica e capacidade científica, Universidade do Porto.Google Scholar
Costa, V. S. 1999. Optimising bytecode emulation for prolog. In Proceedings of PPDP 1999. LNCS, vol. 1702. Springer-Verlag, Berlin, DE, 261267.Google Scholar
Costa, V. S. 2007. Prolog performance on larger datasets. In Proceedings of the 9th International Symposium on Practical Aspects of Declarative Languages, PADL 2007, Nice, France, 14–15 January 2007, Hanus, M., Ed. Lecture Notes in Computer Science, vol. 4354. Springer, Berlin, DE, 185199.Google Scholar
Costa, V. S. 2008. The life of a logic programming system. In Proceedings of the 24th International Conference on Logic Programming, ICLP 2008, Udine, Italy, 9–13 December 2008, Banda, M. G. de la and Pontelli, E., Eds. Lecture Notes in Computer Science, vol. 5366. Springer, Berlin, DE, 16.Google Scholar
Costa, V. S. 2009. On just in time indexing of dynamic predicates in prolog. In Progress in Artificial Intelligence, 14th Portuguese Conference on Artificial Intelligence, EPIA 2009, Lopes, L. S., Lau, N., Mariano, P. and Rocha, L., Eds. Lecture Notes in Computer Science. Springer, Berlin, DE, 126137.Google Scholar
Costa, V. S., deCastro Dutra, I. Castro Dutra, I. and Rocha, R. 2010. Threads and or-parallelism unified. TPLP 10, 46, 417–432.Google Scholar
Costa, V. S., Page, D. and Cussens, J. 2008. Clp(n): Constraint logic programming for probabilistic knowledge. In Proceedings of Probabilistic Inductive Logic Programming—Theory and Applications, Raedt, L. D., Frasconi, P., Kersting, K. and Muggleton, S., Eds. Lecture Notes in Computer Science, vol. 4911. Springer, Berlin, DE, 156188.Google Scholar
Costa, V. S., Sagonas, K. and Lopes, R. 2007. Demand-driven indexing of prolog clauses. In Proceedings of the 23rd International Conference on Logic Programming, Dahl, V. and Niemelä, I., Eds. Lecture Notes in Computer Science, vol. 4670. Springer, Berlin, DE, 305409.Google Scholar
da Silva, A. F. and Costa, V. S. 2007. Design, implementation, and evaluation of a dynamic compilation framework for the yap system. In Proceedings of the 23rd International Conference on Logic Programming, ICLP 2007, 8–13 September 2007, Lecture Notes in Computer Science, vol. 4670. Springer, Berlin, DE, 410424.Google Scholar
Damas, L. and Milner, R. 1982. Principal type-schemes for functional programs. In POPL. 207–212.Google Scholar
Davis, J., Dutra, I., Page, D. and Costa, V. S. 2005. Establishing identity equivalence in multi-relational domains. In Proceedings of the 2005 International Conference on Intelligence Analysis.Google Scholar
Dawson, S., Ramakrishnan, C. R., Ramakrishnan, I. V., Sagonas, K. F., Skiena, S., Swift, T. and Warren, D. S. 1995. Unification factoring for efficient execution of logic programs. In POPL 1995. ACM Press, New York, 247258.Google Scholar
Demoen, B., Janssens, G. and Vandecasteele, H. 2000. Compiling large disjunctions. In Proceedings of the Workshop on Parallelism and Implementation Technology for (Constraint) Logic Programming Languages, London.Google Scholar
Demoen, B., Mariën, A. and Callebaut, A. 1989. Indexing in prolog. In Proceedings of the North American Conference on Logic Programming, Lusk, E. L. and Overbeek, R. A., Eds. 1001–1012.Google Scholar
Demoen, B. and Nguyen, P.-L. 2000. So many WAM variations, so little time. In Proceedings of the International Conference on Computational Logic—CL 2000. LNAI, vol. 1861. Springer-Verlag, Berlin, DE, 12401254.Google Scholar
Devitt, S., Roo, J. D. and Chen, H. 2005. Desirable features of rule based systems for medical knowledge. In Proceedings of the W3C Workshop on Rule Languages for Interoperability, Washington, DC, 27–28 April 2005, W3C.Google Scholar
Diaz, D. and Codognet, P. 2001. Design and implementation of the GNU prolog system. Journal of Functional and Logic Programming 2001, 2001.Google Scholar
Filgueiras, M. 1984. A prolog interpreter working with infinite terms. In Implementations of Prolog. Campbell, Halsted Press, Chichester, West Sussex, 250258.Google Scholar
Fonseca, N. A., Costa, V. S., Rocha, R., Camacho, R. and Silva, F. M. A. 2009. Improving the efficiency of inductive logic programming systems. Software, Practice and Experience 39, 2, 189219.Google Scholar
Granlund, T. 2004. GNU multiple precision arithmetic library 4.1.4.Google Scholar
Hermenegildo, M. V., Bueno, F., Carro, M., López, P., Morales, J. F. and Puebla, G. 2008. An overview of the ciao multiparadigm language and program development environment and its design philosophy. In Concurrency, Graphs and Models, Essays Dedicated to Ugo Montanari on the Occasion of His 65th Birthday, Degano, P., Nicola, R. D. and Meseguer, J., Eds. Lecture Notes in Computer Science, vol. 5065. Springer, Berlin, DE, 209237.Google Scholar
Kimmig, A., Costa, V. S., Rocha, R., Demoen, B. and Raedt, L. D. 2008. On the efficient execution of problog programs. In Proceedings of the 24th International Conference on Logic Programming, ICLP 2008, Udine, Italy, 9–13 December 2008, Banda, M. G. de la and Pontelli, E., Eds. Lecture Notes in Computer Science, vol. 5366. Springer, Berlin, DE, 175189.Google Scholar
Krall, A. 1996. The vienna abstract machine. Journal of Logic Programming 29, 85106.Google Scholar
Lea, D. 1996. A Memory Allocator. URL: http://gee.cs.oswego.edu/dl/html/malloc.htmlGoogle Scholar
Liang, S., Fodor, P., Wan, H. and Kifer, M. 2009. OpenRuleBench: An analysis of the performance of rule engines. Proceedings of the 18th International Conference on World Wide Web. 601–610.Google Scholar
Mariën, A. 1993. Improving the compilation of prolog in the framework of the warren abstract machine. PhD Thesis, Katholiek Universiteit Leuven, Leuven, BE.Google Scholar
Mariën, A. and Demoen, B. 1989. On the management of choicepoint and environment frames in the WAM. In Proceedings of the North American Conference on Logic Programming, Cleveland, OH, Lusk, E. L. and Overbeek, R. A., Eds. 10301050.Google Scholar
Mariën, A. and Demoen, B. 1991. A new scheme for unification in WAM. In Proceedings of the 1991 International Symposium on Logic Programming, Saraswat, V. A. and Ueda, K., Eds. MIT Press, San Diego, 257271.Google Scholar
Meier, M. 1990. Compilation of compound terms in prolog. In Proceedings of the 1990 North American Conference on Logic Programming, Debray, S. K. and Hermenegildo, M. V., Eds. MIT Press, Austin, TX, 6379.Google Scholar
Morales, J. F., Carro, M. and Hermenegildo, M. V. 2008. Comparing tag scheme variations using an abstract machine generator. In Proceedings of the 10th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, Valencia, Spain, 15–17 July 2008, S. Antoy and Albert, E., Eds. ACM, New York, NY, USA, 3243.Google Scholar
Mungall, C. 2009. Experiences using logic programming in bioinformatics. In Proceedings of the 25th International Conference on Logic Programming, ICLP 2009, Pasadena, CA, 14–17 July 2009, Hill, P. M. and Warren, D. S., Eds. Lecture Notes in Computer Science, vol. 5649. Springer, Berlin, DE, 121.Google Scholar
Nässén, H., Carlsson, M. and Sagonas, K. F. 2001. Instruction merging and specialization in the sicstus prolog virtual machine. In Proceedings of the 3rd International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, Florence, Italy, 5–7 September 2001, ACM, New York, NY, 4960.Google Scholar
Nugues, P. M. 2006. An Introduction to Language Processing with Perl and Prolog: An Outline of Theories, Implementation, and Application with Special Consideration of English, French, and German (Cognitive Technologies). Springer-Verlag New York, Secaucus, NJ.Google Scholar
Page, D. and Srinivasan, A. 2003. Ilp: A short look back and a longer look forward. Journal of Machine Learning Research 4, 415430.Google Scholar
Pereira, F. 1987. C-Prolog 1.5 User Manual. SRI International, Menlo Park, CA.Google Scholar
Quintus, 1986. Quintus Prolog User's Guide and Reference Manual—Version 6.Google Scholar
Ramakrishnan, I. V., Rao, P., Sagonas, K., Swift, T. and Warren, D. S. 1999. Efficient access mechanisms for tabled logic programs. Journal of Logic Programming 38, 1, 3154.Google Scholar
Richardson, M. and Domingos, P. 2006. Markov logic networks. Machine Learning 62, 107136.Google Scholar
Riguzzi, F. 2007. A top down interpreter for lpad and cp-logic. In Proceedings of the 10th Congress of the Italian Association for Artificial Intelligence on Artificial Intelligence and Human-Oriented Computing, AI*IA 2007, Rome, Italy, 10–13 September 2007, Basili, R. and Pazienza, M. T., Eds. Lecture Notes in Computer Science, vol. 4733. Springer, Berlin, DE, 109120.Google Scholar
Rocha, R. 2006. Handling incomplete and complete tables in tabled logic programs. In Proceedings of the International Conference on Logic Programming. LNCS, vol. 4079. Springer-Verlag, Berlin, DE, 427428.Google Scholar
Rocha, R. 2007. On improving the efficiency and robustness of table storage mechanisms for tabled evaluation. In Proceedings of the International Symposium on Practical Aspects of Declarative Languages. LNCS, vol. 4354. Springer-Verlag, Berlin, DE, 155169.Google Scholar
Rocha, R., Silva, F. and Costa, V. S. 1999. YapOr: An Or-parallel prolog system based on environment copying. In Portuguese Conference on Artificial Intelligence. LNAI, vol. 1695. Springer-Verlag, Berlin, DE, 178192.Google Scholar
Rocha, R., Silva, F. and Costa, V. S. 2000. YapTab: A tabling engine designed to support parallelism. In Conference on Tabulation in Parsing and Deduction. 77–87.Google Scholar
Rocha, R., Silva, F. and Costa, V. S. 2002. Achieving scalability in parallel tabled logic programs. In Proceedings of the 16th International Parallel and Distributed Processing Symposium (IPPDPS), Fort Lauderdale, FL, 51.Google Scholar
Rocha, R., Silva, F. and Costa, V. S. 2005a. Dynamic mixed-strategy evaluation of tabled logic programs. In Proceedings of the International Conference on Logic Programming. LNCS, vol. 3668. Springer-Verlag, Berlin, DE, 250264.Google Scholar
Rocha, R., Silva, F. and Costa, V. S. 2005b. On applying Or-parallelism and tabling to logic programs. Theory and Practice of Logic Programming Systems 5, 1/2, 161205.Google Scholar
Roy, P. V. and Despain, A. M. 1992. High-performance logic programming with the aquarius prolog compiler. IEEE Computer 25, 1, 5468.Google Scholar
Sagonas, K. and Swift, T. 1998. An abstract machine for tabled execution of fixed-order stratified Logic Programs. ACM Transactions on Programming Languages and Systems 20, 3, 586634.Google Scholar
Sagonas, K. F., Swift, T., Warren, D. S., Freire, J. and Rao, P. 1997. The XSB programmer's manual. Tech. Rrep., State University of New York at Stony Brook. URL: http://xsb.sourceforge.net/Google Scholar
Sato, T. and Kameya, Y. 2001. Parameter learning of logic programs for symbolic-statistical modeling. Journal of Artificial Intelligence Research 15, 391454.Google Scholar
Schimpf, J. 1990. Garbage collection for prolog based on twin cells. In 2nd NACLP Workshop on Logic Programming Architectures and Implementations. MIT Press, Cambridge, MA, USA.Google Scholar
Schrijvers, T. 2008. Constraint handling rules. In Proceedings of the 24th International Conference on Logic Programming, ICLP 2008, Udine, Italy, 9–13 December 2008, de la Banda, M. G. and Pontelli, E., Eds. Lecture Notes in Computer Science, vol. 5366. Springer, Berlin, DE, 910.Google Scholar
Simon, L., Mallya, A., Bansal, A. and Gupta, G. 2006. Coinductive logic programming. In Proceedings of the 22nd International Conference on Logic Programming, ICLP 2006, Seattle, WA, 17–20 August 2006, Etalle, S. and Truszczynski, M., Eds. Lecture Notes in Computer Science, vol. 4079. Springer, Berlin, DE, 330345.Google Scholar
Somogyi, Z. and Sagonas, K. 2006. Tabling in mercury: Design and implementation. In Proceedings of the International Symposium on Practical Aspects of Declarative Languages. LNCS, vol. 3819. Springer-Verlag, Berlin, DE, 150167.Google Scholar
Srinivasan, A. 2001. The Aleph Manual.Google Scholar
Tarau, P. and Neumerkel, U. 1994. A novel term compression scheme and data representation in the binwam. In Proceedings of the 6th International Symposium on Programming Language Implementation and Logic Programming, PLILP 1994, Madrid, Spain, 14–16 September 1994, Hermenegildo, M. V. and Penjam, J., Eds. Lecture Notes in Computer Science, vol. 844. Springer, Berlin, DE, 7387.Google Scholar
Tarjan, R. E. 1972. Depth-first search and linear graph algorithms. SIAM Journal on Computing 1, 2, 146160.Google Scholar
Tronçon, R., Janssens, G., Demoen, B. and Vandecasteele, H. 2007. Fast frequent querying with lazy control flow compilation. TPLP 7, 4, 481498.Google Scholar
Van Roy, P. 1990. Can logic programming execute as fast as imperative programming? PhD Thesis, University of California, Berkeley, CA.Google Scholar
Vandeginste, R. and Demoen, B. 2007. Incremental copying garbage collection for WAM-based Prolog systems. TPLP 7, 5, 505536.Google Scholar
Vaz, D., Costa, V. S. and Ferreira, M. 2009. User defined indexing. In Proceedings of the 25th International Conference on Logic Programming, ICLP 2009, Pasadena, CA, 14–17 July 2009, Hill, P. M. and Warren, D. S., Eds. Lecture Notes in Computer Science, vol. 5649. Springer, Berlin, DE, 372386.Google Scholar
Warren, D. H. D. 1983. An abstract prolog instruction set. Technical Note 309, SRI International, Menlo Park, CA, USA.Google Scholar
Wielemaker, J. 2003. Native preemptive threads in SWI-prolog. In Proceedings of the 19th International Conference on Logic Programming, ICLP 2003, Mumbai, India, 9–13 December 2003, Palamidessi, C., Ed. Lecture Notes in Computer Science, vol. 2916. Springer, Berlin, DE, 331345.Google Scholar
Wielemaker, J. 2010. SWI-Prolog 5.9.9: Reference Manual. Department of Computer Science, VU University Amsterdam, Amsterdam, The Netherlands.Google Scholar
Wielemaker, J., Hildebrand, M., van Ossenbruggen, J. and Schreiber, G. 2008. Thesaurus-based search in large heterogeneous collections. In Proceedings of the 7th International Semantic Web Conference on the Semantic Web, ISWC 2008, Karlsruhe, Germany, 26–30 October 2008, LNCS, vol. 5318. Springer, Berlin, DE, 695708.Google Scholar
Zhou, N.-F. 2007. A register-free abstract prolog machine with jumbo instructions. In Proceedings of the 23rd International Conference on Logic Programming, ICLP 2007, Porto, Portugal, 8–13 September 2007, Lecture Notes in Computer Science, vol. 4670. Springer, Berlin, DE, 455457.Google Scholar
Zhou, N.-F., Takagi, T. and Kazuo, U. 1990. A matching tree oriented abstract machine for prolog. In Proceedings of the 7th International Conference on Logic Programming, Warren, D. H. D. and Szeredi, P., Eds. MIT Press, Cambridge, MA, USA, 158173.Google Scholar