TY - GEN
T1 - stableKanren
T2 - 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: Software for Humanity, SPLASH 2023, including LOPSTR 2023
AU - Guo, Xiangyu
AU - Smith, James
AU - Bansal, Ajay
N1 - Publisher Copyright: © 2023 ACM.
PY - 2023/10/22
Y1 - 2023/10/22
N2 - 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.
AB - 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.
KW - functional programming
KW - miniKanren
KW - normal logic program solver
KW - stable model semantics
UR - http://www.scopus.com/inward/record.url?scp=85175492986&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85175492986&partnerID=8YFLogxK
U2 - 10.1145/3610612.3610617
DO - 10.1145/3610612.3610617
M3 - Conference contribution
T3 - ACM International Conference Proceeding Series
BT - Proceedings 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
PB - Association for Computing Machinery
Y2 - 22 October 2023 through 23 October 2023
ER -