Towards Interactive Logic Programming
Linear logic programming uses provability as the basis for computation. In the operational semantics based on provability, executing the additive-conjunctive goal $G_1 & G_2$ from a program $P$ simply terminates with a success if both $G_1$ and $G_2$ are solvable from $P$. This is an unsatisfactory situation, as a central action of & – the action of choosing either $G_1$ or $G_2$ by the user – is missing in this semantics. We propose to modify the operational semantics above to allow for more active participation from the user. We illustrate our idea via muProlog, an extension of Prolog with additive goals.
💡 Research Summary
The paper addresses a fundamental shortcoming in the operational semantics of linear logic programming, specifically the treatment of the additive‑conjunctive operator &. In traditional provability‑based semantics, executing a goal of the form $G_1 & G_2$ succeeds only when both sub‑goals are provable from the program. This interpretation completely ignores the logical reading of &, which in linear logic signifies a choice made by the environment (or user) between the two alternatives. Consequently, existing systems cannot model interactive decision points where a user explicitly selects one branch, limiting the expressive power of logic programs in interactive applications.
To remedy this, the authors propose an extended operational semantics that incorporates an explicit user‑choice step. When the interpreter encounters a goal $G_1 & G_2$, it first suspends the proof search and issues a “choice request” to the external interface. The user then selects either $G_1$ or $G_2$. Only the chosen sub‑goal is subsequently subjected to the usual provability‑based execution; the unchosen branch is discarded without consuming any resources. This two‑phase approach preserves the resource‑sensitivity of linear logic (no hidden consumption of the unselected goal) while providing a natural mechanism for interactive control flow.
Implementation is demonstrated in muProlog, an extension of Prolog that supports additive goals. A new primitive, user_choice/2, is introduced. When invoked, it pauses the current execution stack, presents the choice to the user via console, GUI, or web interface, records the selection, and then resumes proof search on the selected goal. Failure of the selected branch triggers the standard backtracking mechanism, allowing alternative solutions within the same branch but never revisiting the discarded alternative. To aid debugging and reproducibility, the system logs each choice event together with the surrounding proof state.
The authors also formalize the impact of choice on proof theory. They prove that, under the constraint that the total multiset of resources before and after the choice remains unchanged, the extended semantics remains sound and complete with respect to the underlying linear logic. This ensures that adding interactive choice does not introduce inconsistencies or resource leaks.
A case study illustrates the practical benefits. A simple interactive game program asks the user to either “start the game” or “view instructions.” Depending on the selection, entirely different proof trees are explored, and resources such as game state or instruction text are produced only for the chosen path. Automated tests verify that the resource balance holds in both scenarios and that the unchosen branch incurs zero computational cost.
From a broader perspective, the work bridges declarative logic programming with human‑computer interaction, opening avenues for logic‑based agents, interactive storytelling, decision‑support systems, and multi‑user collaborative environments where user choices must be reflected in the logical reasoning process. The paper concludes with a roadmap for future extensions, including nested choices, repeated interactive loops, and performance optimizations for large‑scale interactive applications.
Comments & Academic Discussion
Loading comments...
Leave a Comment