Prolog Tutorial

De Augusto Baffa Wiki
Revisão de 09h23min de 28 de dezembro de 2020 por Abaffa (discussão | contribs) (Criou página com '* Chapter 3 explains the operation of the underlying inference engine of Prolog. Chapter 3...')
Ir para navegação Ir para pesquisar
Outros idiomas:
English • ‎português do Brasil

Este material é uma tradução (com pequenas adaptações e atualizações) do material original publicado pelo professor Dr. John R. Fisher, Ph.D., professor emérito na California State Polytechnic University, Pomona, com sua autorização concedida em 14 de outubro de 2020. Todo o conteúdo está sendo revisado pelo professor Dr. Augusto Baffa, D.Sc., professor do Departamento de Informática da Pontifícia Universidade Católica do Rio de Janeiro (PUC-Rio) que também deverá adicionar novos exemplos com conectores para programas em Python.

Veja todo o conteúdo deste tutorial consultando o sumário.


Introduction

Prolog is the major example of a fourth generation programming language supporting the declarative programming paradigm. The Japanese Fifth-Generation Computer Project, announced in 1981, adopted Prolog as a development language, and thereby focused considerable attention on the language and its capabilities. The programs in this tutorial are written in "standard" (University of) Edinburgh Prolog, as specified in the classic Prolog textbook by authors Clocksin e Mellish (1981, 1992)[1]. The other major kind of Prolog is the PrologII family of Prologs which are the descendants of Marseille Prolog. The reference to Giannesini, et.al. (1986)[2] uses a version of PrologII. There are differences between these two varieties of Prolog; part of the difference is syntax, and part is semantics. However, students who learn either kind of Prolog can easily adapt to the other kind.

This tutorial is intended to be used to help learn the essential, basic concepts of Prolog. The sample programs have been especially chosen to help promote the use of Prolog programming in an artificial intelligence course. Lisp and Prolog are the most frequently used symbolic programming languages for artificial intelligence. They are widely regarded as excellent languages for "exploratory" and "prototype programming".


Chapters

For a complete view of all content, see the table of contents.

  • Chapter 1 explains the Prolog programming environment for the beginner.
  • Chapter 2 explains Prolog syntax and many essentials of Prolog programming through the use of carefully chosen sample programs. The sample programs are arranged to guide the student through the development of Prolog programs that are constructed in a top-down, declarative fashion. Care has been taken to cover Prolog programming techniques that are very useful in an artificial intelligence course. In fact, this primer can serve as a convenient, small, concise Prolog introduction for such a course. Semantic issues have been addressed by introducing early the concept of a program clause tree that is used to define in an abstract way what are supposed to be the consequences of a Prolog program specification. The author believes this to be a viable way to promote the basic semantic issues of software verification for Prolog programming. The last section of this chapter introduces an example that shows that Prolog can be effectively used to give careful, precise specifications of systems, contrary to its usual reputation as being hard to document because it is easy to use as an exploratory programming tool.
  • Chapter 3 explains the operation of the underlying inference engine of Prolog. Chapter 3 should be first read after the student has studied two or three of the sample programs in Chapter 2. The last section in this chapter introduces Prolog meta-interpreters.
  • O Capítulo 4 fornece uma visão resumida dos principais predicados embutidos do Prolog, muitos dos quais são exemplificados no Capítulo 2.
  • O Capítulo 5 fornece um esboço para o desenvolvimento de programas de busca A*. A seção 5.3 tem um programa com busca αβ para o jogo da velha.
  • O Capítulo 6 apresenta uma apresentação única e extensa de um meta-interpretador lógico para bases de regra lógicas normais.
  • O Capítulo 7 fornece uma introdução ao gerador de analise gramatical embutido do Prolog e uma breve visão geral de como o Prolog pode ser usado para analisar sentenças em inglês (linguagem natural). Além disso, há uma seção que cobre a construção de interfaces de linguagem natural idiomática simples para programas.
  • O Capítulo 8 mostra como implementar diversos protótipos Prolog. A seção (§8.4) desenvolve uma conexão interativa entre Prolog (máquina de inferência) e Java (GUI) para jogar jogo da velha. O modelo de conexão simples é amplamente adaptável e aplicável.


Notas Finais do Autor

Versões anteriores de partes deste tutorial datam de 1988. O material introdutório foi originalmente usado para ajudar a explicar um interpretador Prolog desenvolvido pelo autor (não mais disponível) para uso em seus cursos. O autor acredita que o material introdutório, reunido na forma dada aqui, pode ser muito útil para o aluno que deseja uma introdução rápida, mas bem adaptada, ao Prolog.

Para tratamentos mais completos do Prolog, o aluno é aconselhado a consultar os livros de Clocksin e Mellish (1981,1992)[1], de O'Keefe (1990)[3], de Clocksin (1997[4], 2003[5]) ou de Sterling e Shapiro (1986)[6].

For excellent historical notes regarding Prolog and natural language processing using Prolog the text by Pereira e Shieber (1987)[7] is recommended.


References

  • A Prolog Compendium (pdf) by Marc Bezem:This is an excellent conceptual overview of the Prolog suitable for the logical programming component of a Principles of Programming Languages course.

  1. Appel, K.R., and Haken, W., Every planar map is four colorable, Bull. Am. Math. Soc., vol. 82, pp. 711-712, 1976.
  2. Apt, K., and Etalle, S., On the Unification Free Prolog Programs, Computer Science/Department of Software Technology, Report CS-R9331, May 1993.
  3. Baader, and F., Snyder, W., Unification Theory, Chapter 8 of Handbook of Automated Reasoning, edited by Alan Robinson and Andrei Voronkov, Elsevier Science Publishers , 2001.
  4. Bratko, I., Prolog Programming for Artificial Intelligence, Addison-Wesley International Computer Science Series, 1986.
  5. Campbell, J.A., ed., Implementations of Prolog, Wiley, 1984.
  6. Chang, C., and Lee, R. C., Symbolic Logic and Mechanical Theorem Proving, Academic Press, 1973.
  7. Clocksin, W.F., and Mellish, C.S., Programming in Prolog, Springer-Verlag, 1981, 1992.
  8. Clocksin, W.F., Cause and Effect: Prolog programming for the working programmer, Springer-Verlag, 1997.
  9. Clocksin, W.F., Programming in Prolog: using the ISO standard , Springer-Verlag, 2003.
  10. Covington, M. A.,Nute, D., and Vellino, A. Prolog Programming in Depth, Scott, Foresman and Company, Glenview, IL, London, 1988.
  11. DeGroot, D., and Lindstrom, G., Logic Programming, Relations, and Equations, Prentice- Hall, 1986.
  12. Fisher, J.R., Semantic trees for disjunctive logic programs, Intelligent Systems, Proc. Third Golden West International Conference, ed. E.A. Yfantis, pp.291-305, Klewer Academic Publishers, 1995.
  13. Fisher, J.R., Logic program based action specifications, Proc. 1995 Symposium on Applied Computing (SAC'95), Nashville, Tenn., pp.248-52.
  14. Fisher, J.R., and Tran, L., A Visual Logic, Proc. 1996 Symposium on Applied Computing (SAC'96), Philadelphia, Pa., pp.17-21.
  15. Gazdar, G., and Mellish, C., Natural Language Processing in Prolog, Addison-Wesley, 1989.
  16. Giannesini, F, Kanoui, H, Pasero, R., and van Caneghem, M, Prolog, Addison-Wesley International Computer Science Series, 1986.
  17. Green, C., Theorem-proving by resolution as a basis for question-answering systems, in B. Meltzer and D. Michie, eds., Machine Intelligence 4, 183-205, Edinburgh University press, 1968.
  18. Kowalski, R.A., Logic for problem solving, DCL Memo 75, Department of Artificial Intelligence, University of Edinburgh, Scotland, 1974.
  19. Kowalski, R.A., Logic for Problem Solving, North Holland, 1979.
  20. Kowalski, R.A., and Kuehner, D., Linear Resolution with selection function, Artificial Intelligence, (2) 227-60, 1971.
  21. Lloyd, J.W., Foundations of Logic Programming, Springer-Verlag, 1984, 2nd ed. 1987.
  22. Nilsson, N., Principles of Artificial Intelligence, Tioga, 1980.
  23. O'Keefe, Richard A.,The Craft of Prolog, MIT Press, 1990.
  24. Pereira, Fernando C.N., and Shieber, Stuart M., Prolog and Natural-Language Analysis, CSLI, 1987.
  25. Robinson, J.A., A machine-oriented logic based on the resolution principle, Journal A.C.M., (12) 23-44, 1965.
  26. Rowe, W.C., AI Through Prolog, Prentice Hall, 1988.
  27. Shoham, Y., Artificial Intelligence Techniques in Prolog, Morgan Kaufmann Publishers, 1994.
  28. Sterling, Leon, and Shapiro, Ehud, The Art of Prolog, MIT Press, 1986.
  29. Van Le, T., Prolog Programming, Wiley, 1993.
  30. Winston, Patrick Henry, Artificial Intelligence, 2nd. ed., Addison-Wesley, 1984.
  31. Winston, P.H., and Horn, P., Lisp, Addison-Wesley, 1985.


See also


References

  1. 1,0 1,1 Clocksin, W.F., and Mellish, C.S., Programming in Prolog, Springer-Verlag, 1981, 1992.
  2. Giannesini, F, Kanoui, H, Pasero, R., and van Caneghem, M, Prolog, Addison-Wesley International Computer Science Series, 1986.
  3. O'Keefe, Richard A.,The Craft of Prolog, MIT Press, 1990.
  4. Clocksin, W.F., Cause and Effect: Prolog programming for the working programmer, Springer-Verlag, 1997
  5. Clocksin, W.F., Programming in Prolog: using the ISO standard , Springer-Verlag, 2003.
  6. Sterling, Leon, and Shapiro, Ehud, The Art of Prolog, MIT Press, 1986.
  7. Pereira, Fernando C.N., and Shieber, Stuart M., Prolog and Natural-Language Analysis, CSLI, 1987.