Skip to main content

Implementing a notion of modules in the logic programming language λProlog

  • Conference paper
  • First Online:
Extensions of Logic Programming (ELP 1992)

Part of the book series: Lecture Notes in Computer Science ((LNAI,volume 660))

Included in the following conference series:

Abstract

Issues concerning the implementation of a notion of modules in the higher-order logic programming language λProlog are examined. A program in this language is a composite of type declarations and procedure definitions. The module construct that is considered permits large collections of such declarations and definitions to be decomposed into smaller units. Mechanisms are provided for controlling the interaction of these units and for restricting the visibility of names used within any unit. The typical interaction between modules has both a static and a dynamic nature. The parsing of expressions in a module might require declarations in a module that it interacts with, and this information must be available during compilation. Procedure definitions within a module might utilize procedures presented in other modules and support must be provided for making the appropriate invocation during execution. Our concern here is largely with the dynamic aspects of module interaction. We describe a method for compiling each module into an independent fragment of code. Static interactions prevent the compilation of interacting modules from being completely decoupled. However, using the idea of an interface definition presented here, a fair degree of independence can be achieved even at this level. The dynamic semantics of the module construct involve enhancing existing program contexts with the procedures defined in particular modules. A method is presented for achieving this effect through a linking process applied to the compiled code generated for each module. A direct implementation of the dynamic semantics leads to considerable redundancy in search. We present a way in which this redundancy can be controlled, prove the correctness of our approach and describe run-time structures for incorporating this idea into the overall implementation.

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

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Alonzo Church. A formulation of the simple theory of types. Journal of Symbolic Logic, 5:56–68, 1940.

    Google Scholar 

  2. Conal Elliott and Frank Pfenning. eLP, a Common Lisp Implementation of λProlog. Implemented as part of the CMU ERGO project, May 1989.

    Google Scholar 

  3. Conal Elliott and Frank Pfenning. A semi-functional implementation of a higher-order logic programming language. In Peter Lee, editor, Topics in Advanced Language Implementation, pages 289–325. MIT Press, 1991.

    Google Scholar 

  4. Elsa L. Gunter. Extensions to logic programming motivated by the construction of a generic theorem prover. In Peter Schroeder-Heister, editor, Extensions of Logic Programming: International Workshop, Tübingen FRG, December 1989, pages 223–244. Springer-Verlag, 1991. Volume 475 of Lecture Notes in Artificial Intelligence.

    Google Scholar 

  5. J. Roger Hindley and Jonathan P. Seldin. Introduction to Combinatory Logic and Lambda Calculus. Cambridge University Press, 1986.

    Google Scholar 

  6. Gérard Huet. A unification algorithm for typed λ-calculus. Theoretical Computer Science, 1:27–57, 1975.

    Google Scholar 

  7. Keehang Kwon, Gopalan Nadathur, and Debra Sue Wilson. Implementing polymorphic typing in a logic programming language. Submitted, August 1992.

    Google Scholar 

  8. Evelina Lamma, Paola Mello, and Antonio Natali. The design of an abstract machine for efficient implementation of contexts in logic programming. In Sixth International Logic Programming Conference, pages 303–317, Lisbon, Portugal, June 1989. MIT Press.

    Google Scholar 

  9. Dale Miller and Gopalan Nadathur. λProlog version 2.7. Distributed in C-Prolog and Quintus Prolog source code, August 1988.

    Google Scholar 

  10. Dale Miller. Lexical scoping as universal quantification. In Sixth International Logic Programming Conference, pages 268–283, Lisbon, Portugal, June 1989. MIT Press.

    Google Scholar 

  11. Dale Miller. A logical analysis of modules in logic programming. Journal of Logic Programming, 6:79–108, 1989.

    Google Scholar 

  12. Dale Miller. A proposal for modules in λProlog. In Workshop on the λProlog Programming Language, Philadelphia, July 1992.

    Google Scholar 

  13. Dale Miller, Gopalan Nadathur, Frank Pfenning, and Andre Scedrov. Uniform proofs as a foundation for logic programming. Annals of Pure and Applied Logic, 51:125–157, 1991.

    Google Scholar 

  14. Luis Monteiro and António Porto. Contextual logic programming. In Sixth International Logic Programming Conference, pages 284–299, Lisbon, Portugal, June 1989. MIT Press.

    Google Scholar 

  15. Gopalan Nadathur and Frank Pfenning. The type system of a higher-order logic programming language. In Frank Pfenning, editor, Types in Logic Programming, pages 245–283. MIT Press, 1992.

    Google Scholar 

  16. Gopalan Nadathur, Bharat Jayaraman, and Keehang Kwon. Scoping constructs in logic programming: Implementation problems and their solution. Submitted, May 1992.

    Google Scholar 

  17. Gopalan Nadathur, Bharat Jayaraman, and Debra Sue Wilson. Implementation considerations for higher-order features. Submitted, November 1992.

    Google Scholar 

  18. Gopalan Nadathur. A proof procedure for the logic of hereditary Harrop formulas. To appear in the Journal of Automated Reasoning.

    Google Scholar 

  19. Richard O'Keefe. Towards an algebra for constructing logic programs. In 1985 Symposium on Logic Programming, pages 152–160, Boston, 1985.

    Google Scholar 

  20. D.T. Sannella and L.A. Wallen. A calculus for the construction of modular Prolog programs. Journal of Logic Programming, 12:147–178, January 1992.

    Google Scholar 

  21. D.H.D. Warren. An abstract Prolog instruction set. Technical report, SRI International, October 1983. Technical Note 309.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

E. Lamma P. Mello

Rights and permissions

Reprints and permissions

Copyright information

© 1993 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Kwon, K., Nadathur, G., Wilson, D.S. (1993). Implementing a notion of modules in the logic programming language λProlog. In: Lamma, E., Mello, P. (eds) Extensions of Logic Programming. ELP 1992. Lecture Notes in Computer Science, vol 660. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-56454-3_18

Download citation

  • DOI: https://doi.org/10.1007/3-540-56454-3_18

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-56454-6

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

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics