skip to main content
10.1145/3610612.3610617acmotherconferencesArticle/Chapter ViewAbstractPublication PagesppdpConference Proceedingsconference-collections
research-article

stableKanren: Integrating Stable Model Semantics with miniKanren

Published:22 October 2023Publication History

ABSTRACT

This paper presents stableKanren, a miniKanren extension with normal logic programming support under stable model semantics. MiniKanren is a relational programming solver implemented atop Scheme via shallow embedding, which means the predicate in each rule is encoded as a goal function directly. The solver utilizes the pattern matching macro in Scheme to transform the input goal function and form a static search stream through continuations to achieve the essential features, resolution and unification, in Prolog. However, the static stream only works on monotonic reasoning. Even though the core miniKanren is designed to be easily modified and extended with new features, none of the existing extensions support solving normal logic programs. Also, no normal logic program solvers are based on a functional programming language. We identify and categorize the roles of resolution and unification in top-down solving. And we realize that a dynamic search stream is needed to support non-monotonic reasoning. So we evolve both resolution and unification with new roles, and we exploit the advantages of using macros and continuations further to weave the information generated during runtime into future streams dynamically. We create multiple innovative macros to compile the normal logic program into a program with its complement form, obtain the domain of a variable under different contexts, and generate the new search stream during solving. And we use the coinductive resolution to handle the loop in the normal logic program. In future work, we plan to apply bottom-up optimization to improve our top-down system performance and support various input rules.

References

  1. Dirk Abels, Julian Jordi, Max Ostrowski, Torsten Schaub, Ambra Toletti, and Philipp Wanko. 2021. Train Scheduling with Hybrid Answer Set Programming. Theory and Practice of Logic Programming 21, 3 (2021), 317–347. https://doi.org/10.1017/S1471068420000046Google ScholarGoogle ScholarCross RefCross Ref
  2. William E. Byrd. 2009. Relational Programming in Minikanren: Techniques, Applications, and Implementations. Ph. D. Dissertation. USA. Advisor(s) Friedman, Daniel P. AAI3380156.Google ScholarGoogle Scholar
  3. Keith L. Clark. 1978. Negation as Failure. Logic and Data Bases (1978), 293–322. https://doi.org/10.1007/978-1-4684-3384-5_11Google ScholarGoogle ScholarCross RefCross Ref
  4. Carmine Dodaro and Marco Maratea. 2017. Nurse Scheduling via Answer Set Programming. In Logic Programming and Nonmonotonic Reasoning, Marcello Balduccini and Tomi Janhunen (Eds.). Springer International Publishing, Cham, 301–307.Google ScholarGoogle Scholar
  5. D.P. Friedman, W.E. Byrd, and O. Kiselyov. 2005. The Reasoned Schemer. MIT Press. https://books.google.com/books?id=_xciAQAAIAAJGoogle ScholarGoogle Scholar
  6. Daniel P. Friedman, William E. Byrd, Oleg Kiselyov, and Jason Hemann. 2018. The Reasoned Schemer (2nd ed.). The MIT Press.Google ScholarGoogle Scholar
  7. Daniel P. Friedman and Matthias Felleisen. 1996. The Little Schemer (4th Ed.). MIT Press, Cambridge, MA, USA.Google ScholarGoogle Scholar
  8. Martin Gebser, Benjamin Kaufmann, André Neumann, and Torsten Schaub. 2007. Conflict-Driven Answer Set Solving. In Proceedings of the 20th International Joint Conference on Artifical Intelligence (Hyderabad, India) (IJCAI’07). Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 386–392.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Michael Gelfond and Vladimir Lifschitz. 1988. The stable model semantics for logic programming.. In ICLP/SLP, Vol. 88. Cambridge, MA, 1070–1080.Google ScholarGoogle Scholar
  10. Gopal Gupta, Ajay Bansal, Richard Min, Luke Simon, and Ajay Mallya. 2007. Coinductive Logic Programming and Its Applications. In Proceedings of the 23rd International Conference on Logic Programming (Porto, Portugal) (ICLP’07). Springer-Verlag, Berlin, Heidelberg, 27–44.Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Michael Hanus, Herbert Kuchen, and Juan Jose Moreno-Navarro. 1995. Curry: A truly functional logic language. In Proc. ILPS, Vol. 95. 95–107.Google ScholarGoogle Scholar
  12. Jason Hemann and Daniel Friedman. 2017. A Framework for Extending microKanren with Constraints. Electronic Proceedings in Theoretical Computer Science 234 (01 2017). https://doi.org/10.4204/EPTCS.234.10Google ScholarGoogle ScholarCross RefCross Ref
  13. Intl. Organization for Standardization.1995. ISO/IEC 13211-1:1995: Information technology — Programming languages — Prolog — Part 1: General core. 199 pages. https://www.iso.org/standard/21413.htmlGoogle ScholarGoogle Scholar
  14. Intl. Organization for Standardization. 2000. ISO/IEC 13211-2:2000: Information technology — Programming languages — Prolog — Part 2: Modules. https://www.iso.org/standard/20775.htmlGoogle ScholarGoogle Scholar
  15. Roland Kaminski, Torsten Schaub, and Philipp Wanko. 2017. A Tutorial on Hybrid Answer Set Solving with clingo. Springer International Publishing, Cham, 167–203. https://doi.org/10.1007/978-3-319-61033-7_6Google ScholarGoogle ScholarCross RefCross Ref
  16. John W. Lloyd. 1987. Foundations of Logic Programming, 2nd Edition. Springer. https://doi.org/10.1007/978-3-642-83189-8Google ScholarGoogle ScholarCross RefCross Ref
  17. Kyle Marple, Elmer Salazar, and Gopal Gupta. 2017. Computing Stable Models of Normal Logic Programs Without Grounding. CoRR abs/1709.00501 (2017). arxiv:1709.00501http://arxiv.org/abs/1709.00501Google ScholarGoogle Scholar
  18. John McCarthy. 1960. Programs with Common Sense. Technical Report. Cambridge, MA, USA.Google ScholarGoogle Scholar
  19. Richard Min and Gopal Gupta. 2010. Coinductive Logic Programming with Negation. In Logic-Based Program Synthesis and Transformation, Danny De Schreye (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 97–112.Google ScholarGoogle Scholar
  20. Evgenii Moiseenko. 2019. Constructive negation for minikanren. In ICFP 2019, The miniKanren and Relational Programming Workshop.Google ScholarGoogle Scholar
  21. Raymond Reiter. 1981. On closed world data bases. In Readings in artificial intelligence. Elsevier, 119–140.Google ScholarGoogle Scholar
  22. J. A. Robinson and E. E. Sibert. 1982. LogLisp: Motivation, Design and Implementation. K.L. Clark and S.-A. Tarnlund (Eds.): Logic Programming, Academic Press, New York, 229–314.Google ScholarGoogle Scholar
  23. Zoltan Somogyi, Fergus J Henderson, and Thomas Charles Conway. 1995. Mercury, an efficient purely declarative logic programming language. Australian Computer Science Communications 17 (1995), 499–512.Google ScholarGoogle Scholar
  24. Miroslaw Truszczynski. 2012. Connecting first-order ASP and the logic FO (ID) through reducts. Correct Reasoning: Essays on Logic-Based AI in Honour of Vladimir Lifschitz (2012), 543–559.Google ScholarGoogle Scholar
  25. Philip Wadler. 1985. How to replace failure by a list of successes a method for exception handling, backtracking, and pattern matching in lazy functional languages. In Functional Programming Languages and Computer Architecture, Jean-Pierre Jouannaud (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 113–128.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. stableKanren: Integrating Stable Model Semantics with miniKanren

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Other conferences
        PPDP '23: Proceedings of the 25th International Symposium on Principles and Practice of Declarative Programming
        October 2023
        173 pages
        ISBN:9798400708121
        DOI:10.1145/3610612

        Copyright © 2023 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 22 October 2023

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article
        • Research
        • Refereed limited

        Acceptance Rates

        Overall Acceptance Rate230of486submissions,47%
      • Article Metrics

        • Downloads (Last 12 months)12
        • Downloads (Last 6 weeks)3

        Other Metrics

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      HTML Format

      View this article in HTML Format .

      View HTML Format