Skip to main content

Combining Logic Programming and Imperative Programming in LPS

  • Chapter
  • First Online:
Prolog: The Next 50 Years

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

Abstract

Logic programs and imperative programs employ different notions of computing. Logic programs compute by proving that a goal is a logical consequence of the program, or by showing that the goal is true in a model defined by the program. Imperative programs compute by starting from an initial state, executing actions to transition from one state to the next, and terminating (if at all) in a final state when the goal is solved.

In this paper, we present the language LPS (Logic Production Systems), which combines the logic programming and imperative programming notions of computing. Programs in LPS compute by using beliefs, represented by logic programs, to model the changing world, and by executing actions, to change the world, to satisfy goals, represented by reactive rules and constraints.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 64.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 84.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://demo.logicalcontracts.com/example/fintechExamples.swinb.

References

  1. Alferes, J.J., Brogi, A., Leite, J.A., Pereira, L.M.: Evolving logic programs. In: Flesca, S., Greco, S., Ianni, G., Leone, N. (eds.) JELIA 2002. LNCS (LNAI), vol. 2424, pp. 50–62. Springer, Heidelberg (2002). https://doi.org/10.1007/3-540-45757-7_5

    Chapter  Google Scholar 

  2. Barringer, H., Fisher, M., Gabbay, D., Owens, R., Reynolds, M.: The imperative future: principles of executable temporal logic. John Wiley & Sons, Inc. (1996)

    Google Scholar 

  3. Boella, G., der Torre, L.V.: Regulative and constitutive norms in the design of normative multiagent systems. In International Workshop on Computational Logic in Multi-Agent Systems, pp. 303–319, Springer (2005)

    Google Scholar 

  4. Bonner, A., Kifer, M.: Transaction logic programming. In: Warren D.S. (ed.) Logic Programming: Proc. of the 10th International Conf., pp. 257–279 (1993)

    Google Scholar 

  5. Carro, M., Hermenegildo, M.: Concurrency in Prolog Using Threads and a Shared Database. 1999 International Conference on Logic Programming, pp. 320–334, MIT Press, Cambridge (1999)

    Google Scholar 

  6. Flesca, S., Greco, S., Ianni, G., Leone, N. (eds.): JELIA 2002. LNCS (LNAI), vol. 2424. Springer, Heidelberg (2002). https://doi.org/10.1007/3-540-45757-7

    Book  Google Scholar 

  7. Davila, J.: Rock-Paper-Scissors (2017). https://demo.logicalcontracts.com/p/rps-gets.pl

  8. Denecker, M., Vennekens, J.: Building a knowledge base system for an integration of logic programming and classical logic. In: Garcia de la Banda, M., Pontelli, E. (eds.) ICLP 2008. LNCS, vol. 5366, pp. 71–76. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-89982-2_12

    Chapter  MATH  Google Scholar 

  9. Schrijvers, T., Frühwirth, T. (eds.): Constraint Handling Rules. LNCS (LNAI), vol. 5388. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-92243-8

    Book  MATH  Google Scholar 

  10. Genesereth, M.: Dynamic Logic Programming. In: Warren, D., Dahl, V., Eiter, T., Hermenegildo, M., Kowalski, R. and Rossi, F. (eds.) Prolog - The Next 50 Years. LNCS, vol. 13900. Springer (2023)

    Google Scholar 

  11. Harel, D.: Statecharts: A Visual Formalism for Complex Systems. Sci. Comput. Programming 8, 231–274 (1987)

    Article  MathSciNet  MATH  Google Scholar 

  12. Kakas, A., Kowalski, R., Toni, F. : The Role of Logic Programming in Abduction. In: Gabbay, D., Hogger, C.J., Robinson, J.A. (eds.) Handbook of Logic in Artificial Intelligence and Programming 5, pp. 235–324. Oxford University Press (1998)

    Google Scholar 

  13. Kowalski, R.: Computational logic and human thinking: how to be artificially intelligent. Cambridge University Press (2011)

    Google Scholar 

  14. Kowalski, R., Dávila, J., Sartor, G., Calejo, M.: Logical english for law and education. In: Warren, D., Dahl, V., Eiter, T., Hermenegildo, M., Kowalski, R., Rossi, F. (eds.) Prolog - The Next 50 Years. LNCS, vol. 13900. Springer (2023)

    Google Scholar 

  15. Kowalski, R., Sadri, F.: Logic Programming towards multi-agent systems. Ann. Math. Artif. Intell. 25, 391–419 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  16. Kowalski, R., Sadri, F.: Integrating logic programming and production systems in abductive logic programming agents. In: Polleres, A., Swift, T. (eds.) RR 2009. LNCS, vol. 5837, pp. 1–23. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-05082-4_1

    Chapter  Google Scholar 

  17. Kowalski, R., Sadri, F.: An agent language with destructive assignment and model-theoretic semantics. In: Dix, J., Leite, J., Governatori, G., Jamroga, W. (eds.) CLIMA 2010. LNCS (LNAI), vol. 6245, pp. 200–218. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-14977-1_16

    Chapter  MATH  Google Scholar 

  18. Kowalski, R., Sadri, F.: Abductive logic programming agents with destructive databases. Ann. Math. Artif. Intell. 62(1), 129–158 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  19. Kowalski, R., Sadri, F.: A Logic-based framework for reactive systems. In: Bikakis, A., Giurca, A. (eds.) RuleML 2012. LNCS, vol. 7438, pp. 1–15. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-32689-9_1

    Chapter  Google Scholar 

  20. Kowalski, R., Sadri, F.: A logical characterization of a reactive system language. In: Bikakis, A., Fodor, P., Roman, D. (eds.) RuleML 2014. LNCS, vol. 8620, pp. 22–36. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-09870-8_2

    Chapter  Google Scholar 

  21. Kowalski, R., Sadri, F.: Model-theoretic and operational semantics for Reactive Computing. N. Gener. Comput. 33(1), 33–67 (2015)

    Article  MATH  Google Scholar 

  22. Kowalski, R., Sadri, F.: Programming in logic without logic programming. Theory Pract. Logic Program. 16(3), 269–295 (2016)

    Article  MathSciNet  MATH  Google Scholar 

  23. Kowalski, R., Sergot, M.: A Logic-based Calculus of Events. In: New Generation Computing, Vol. 4, No.1, 67--95 (1986). Also in: Inderjeet Mani, J. Pustejovsky, and R. Gaizauskas (eds.) The Language of Time: A Reader, Oxford University Press (2005)

    Google Scholar 

  24. Lifschitz, V. Answer set programming. Springer (2019)

    Google Scholar 

  25. McCarthy, J., Hayes, P.J.: Some philosophical problems from the standpoint of artificial intelligence. In: Readings in artificial intelligence, pp. 431–450. Morgan Kaufmann (1981)

    Google Scholar 

  26. Meister, M., Djelloul, K., Robin, J.: Unified semantics for Constraint Handling Rules in transaction logic. In International Conference on Logic Programming and Nonmonotonic Reasoning, pp. 201–213. Springer (2007)

    Google Scholar 

  27. Newell, A., Simon, H.A.: Human problem solving vol. 104, No. 9. Prentice-Hall, Englewood Cliffs, NJ (1972)

    Google Scholar 

  28. Nicolas, J.M., Gallaire, H.: Database: Theory vs. Interpretation. In: Gallaire, H., Minker, J. (eds.) Logic and Databases, Plenum, New York (1978)

    Google Scholar 

  29. OMG. (Object Management Group): Semantics of Business Vocabulary and Rules (SBVR), OMG Standard, v. 1.0. (2008)

    Google Scholar 

  30. Rao, P., Sagonas, K., Swift, T., Warren, D.S., Freire, J.: XSB: a system for efficiently computing well-founded semantics. In: Dix, J., Furbach, U., Nerode, A. (eds.) LPNMR 1997. LNCS, vol. 1265, pp. 430–440. Springer, Heidelberg (1997). https://doi.org/10.1007/3-540-63255-7_33

    Chapter  Google Scholar 

  31. Russell, S.J., Norvig, P.: Artificial intelligence: a modern approach, 2nd edn. Prentice Hall, Upper Saddle River, NJ (2003)

    MATH  Google Scholar 

  32. Sadri F., Kowalski R.: A Theorem-Proving Approach to Database Integrity. In: Minker, J. (ed.) Foundations of Deductive Databases and Logic Programming, Morgan Kaufmann, pp. 313–362 (1988)

    Google Scholar 

  33. Stenning, K., van Lambalgen M.: Human Reasoning and Cognitive Science. MIT Press (2012)

    Google Scholar 

  34. Thagard, P.: Mind: Introduction to Cognitive Science. Second Edition. MIT Press (2005)

    Google Scholar 

  35. Warren, D. S., Denecker, M.: A better semantics for prolog. In: Warren, D., Dahl, V., Eiter, T., Hermenegildo, M., Kowalski, R. and Rossi, F. (eds.) Prolog - The Next 50 Years. LNCS, vol. 13900. Springer, Heidelberg (2023)

    Google Scholar 

  36. Wason, P.C.: Reasoning about a rule. Q. J. Exp. Psychol. 20(3), 273–281 (1968)

    Article  Google Scholar 

  37. Widom, J., Ceri, S. (eds.) Active database systems: Triggers and rules for advanced database processing. Morgan Kaufmann (1995)

    Google Scholar 

  38. Wielemaker, J., Riguzzi, F., Kowalski, R.A., Lager, T., Sadri, F., Calejo, M.: Using SWISH to realise interactive web-based tutorials for logic-based languages. Theory Pract. Logic Program. 19(2), 229–261 (2019)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Robert Kowalski .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Kowalski, R., Sadri, F., Calejo, M., Dávila, J. (2023). Combining Logic Programming and Imperative Programming in LPS. In: Warren, D.S., Dahl, V., Eiter, T., Hermenegildo, M.V., Kowalski, R., Rossi, F. (eds) Prolog: The Next 50 Years. Lecture Notes in Computer Science(), vol 13900. Springer, Cham. https://doi.org/10.1007/978-3-031-35254-6_17

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-35254-6_17

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-35253-9

  • Online ISBN: 978-3-031-35254-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics