stableKanren: Integrating Stable Model Semantics with miniKanren

Xiangyu Guo, James Smith, Ajay Bansal

Research output: Chapter in Book/Report/Conference proceedingConference contribution

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.

Original languageEnglish (US)
Title of host publicationProceedings of the 25th International Symposium on Principles and Practice of Declarative Programming, PPDP 2023 - As part of the ACM SIGPLAN conference on Systems, Programming, Languages, and Applications
Subtitle of host publicationSoftware for Humanity, SPLASH 2023, including LOPSTR 2023
PublisherAssociation for Computing Machinery
ISBN (Electronic)9798400708121
DOIs
StatePublished - Oct 22 2023
Event25th International Symposium on Principles and Practice of Declarative Programming, PPDP 2023 - As part of the ACM SIGPLAN conference on Systems, Programming, Languages, and Applications: Software for Humanity, SPLASH 2023, including LOPSTR 2023 - Lisbon, Portugal
Duration: Oct 22 2023Oct 23 2023

Publication series

NameACM International Conference Proceeding Series

Conference

Conference25th International Symposium on Principles and Practice of Declarative Programming, PPDP 2023 - As part of the ACM SIGPLAN conference on Systems, Programming, Languages, and Applications: Software for Humanity, SPLASH 2023, including LOPSTR 2023
Country/TerritoryPortugal
CityLisbon
Period10/22/2310/23/23

Keywords

  • functional programming
  • miniKanren
  • normal logic program solver
  • stable model semantics

ASJC Scopus subject areas

  • Human-Computer Interaction
  • Computer Networks and Communications
  • Computer Vision and Pattern Recognition
  • Software

Fingerprint

Dive into the research topics of 'stableKanren: Integrating Stable Model Semantics with miniKanren'. Together they form a unique fingerprint.

Cite this