prolog programming

Designs and implements declarative programs and knowledge bases using the Prolog language, writing predicates, clauses, rules, and queries to encode logical relations and inference processes. Uses Prolog features such as unification, backtracking, recursion, cuts/negation, DCGs and constraint-logic extensions to build, test, and debug inference engines, parsers, and rule-based systems.

prologprogramming

Recent Skill Trend

Momentum and market value over time
Trending
Score
No comparison yet
-0.48
Oct 01, 2026Oct 01, 2026
Career
Value
No comparison yet
$200K/year
Oct 01, 2026Oct 01, 2026

Must-Read Papers

Most classic and influential ideas
View more

This work addresses the lack of effective debugging mechanisms for beginners in Prolog, which hinders the scalability of logic programming education. It proposes the first automated debugging and repair approach tailored to the declarative language Prolog by integrating large language models (LLMs) with spectrum-based fault localization and mutation testing. The method leverages student code submissions and Git commit histories to automatically identify bugs and generate targeted repair suggestions. Evaluated on 1,499 real student assignments, the system demonstrates high efficacy in fault detection and repair generation, significantly enhancing the capacity for automated, personalized feedback in Prolog programming instruction.

automated feedbackdebuggingdeclarative programming

Subgraph Isomorphism: Prolog vs. Conventional

Nov 17, 2025
CY
Claire Y. Yin
🏛️ University of Notre Dame

This study addresses the NP-hard subgraph isomorphism problem, comparing the efficiency of Prolog-based logic programming against conventional (including parallel) algorithms for complex pattern matching in large-scale graphs. We formalize graph patterns as first-order logic rules and automatically compile them into Prolog predicates, leveraging Prolog’s declarative modeling, backtracking search, and constraint propagation capabilities. Experimental evaluation demonstrates that, on high-branching, multi-constrained subgraph matching tasks, the Prolog implementation maintains stable performance scalability with increasing graph size—outperforming several mainstream explicit algorithms by 1.3–2.1× on average—while significantly reducing code complexity. These results validate the effectiveness and scalability of the logic programming paradigm for structured graph search tasks, offering a novel, declarative approach to complex graph analysis.

Analyzes complexity differences between logical and conventional programming approachesCompares Prolog logic programming with conventional subgraph isomorphism implementationsEvaluates efficiency of logic paradigm for solving complex graph pattern problems

A Prolog Program for Bottom-up Evaluation

Feb 11, 2025
DS
David S. Warren
🏛️ Stony Brook University

This paper addresses the bottom-up evaluation of positive Horn clause logic programs. Methodologically, it proposes a concise Prolog meta-interpreter that transforms original rules into meta-rules and employs `assert/1` to dynamically assert newly derived facts, thereby constructing the least Herbrand model via semi-naïve iteration. Crucially, `assert/1` is treated as semantically essential—not merely a pragmatic implementation device—enabling a natural and precise operational semantics for model construction. This design eliminates explicit set operations and complex control structures, preserving high code readability while guaranteeing semantic correctness. Experimental results demonstrate that the implementation achieves both theoretical clarity and engineering practicality. It establishes a novel paradigm for the principled modeling of side-effecting operations in logic programming and exemplifies the fruitful integration of Prolog metaprogramming with model-theoretic semantics.

Prolog program for bottom-up evaluationTransforms object rules into metarulesUses metainterpreter to compute program model

This work addresses the challenge of concisely expressing Datalog-style logical rules and queries within Lean, a highly expressive yet complex proof assistant based on the Calculus of Inductive Constructions (CIC). To this end, the authors propose a shallowly embedded domain-specific language (DSL) that enables, for the first time, a seamless integration of Datalog into Lean. The DSL supports declarative definitions of facts and rules, backward-chaining queries, and—crucially—the automatic translation of Datalog queries into theorems accompanied by proof scripts, thereby establishing bidirectional interoperability with Lean’s native reasoning framework. The effectiveness of the approach is demonstrated through three representative case studies, which collectively illustrate its expressiveness in rule formulation, readability of queries, and capability to support formal verification.

bidirectional interoperabilityDatalogdomain-specific language

Existing Grassroots Logic Programs (GLPs) lack type support for interactive, potentially deadlocking, or non-terminating computations, making it difficult to ensure communication reliability in AI-assisted development. This work proposes the first modal path regular type system incorporating directional modes, which distinguishes between read and write directions of subterms to enable static type checking for partial, interactive, and even non-terminating programs. By integrating covariance and contravariance semantic conditions with formal syntactic rules, the system establishes that well-typedness is equivalent to semantic paths satisfying directional constraints. Furthermore, a correct-by-construction Dart implementation is automatically generated from the formal specification by an AI, demonstrating the feasibility of human-AI collaborative programming.

AI-assisted programmingconcurrent logic programmingGrassroots Logic Programs

Latest Papers

What's happening recently
View more

This work addresses the efficiency bottleneck of repeatedly generating and evaluating small candidate Prolog programs within Python by proposing an execution framework optimized for Prolog program synthesis. The core innovation lies in compiling Prolog clauses into NumPy array-based Warren Abstract Machine (WAM) instructions, coupled with a partial recompilation mechanism that supports fixed background knowledge. Furthermore, Numba just-in-time (JIT) compilation is integrated to accelerate performance-critical routines. Experimental results demonstrate that, on benchmarks involving repeated compilation and evaluation, the proposed framework achieves significantly superior end-to-end performance compared to SWI-Prolog invoked via the Janus interface.

inductive logic programmingprogram evaluationProlog synthesis

This work proposes an end-to-end approach that integrates large language models with formal verification to automatically generate correct and reliable Prolog programs from natural language prompts alone. Leveraging Claude, the method translates English specifications into Prolog code and accompanying test cases, and—novelty—incorporates the LPTP theorem prover to perform fully automated formal verification of critical properties such as typing, termination, and uniqueness. In experiments, the system successfully produced 58 logic procedures, 508 test cases, and 257 lemmas, yielding 11,800 lines of human-reviewed proof code that all passed LPTP verification. This represents a pioneering step toward merging “vibe-coding” with “vericoding,” establishing a new paradigm for trustworthy program synthesis.

Formal VerificationLarge Language ModelProgram Synthesis

This study addresses the lack of systematic guidance for selecting logic programming languages in neuro-symbolic AI. It surveys rule-based languages—including Datalog, Answer Set Programming, and probabilistic logic programs—across four dimensions such as semantics and expressiveness, while analyzing over fifty systems. By constructing application-feature mapping and decision matrices, this work compares formal methodological differences across domains and examines integration techniques with neural networks. Ultimately, it establishes a selection guideline for rule-based languages alongside a future research roadmap, providing theoretical support for system design and the resolution of open problems in this field.

Logic programmingNeurosymbolic AIRule-based languages

Prolog lacks a mainstream static type system, making it difficult to detect type errors prior to execution. To address this limitation, this work presents the first implementation of an operational semantics based on Typed SLD-resolution in Maude, yielding an interpreter named MaudeTypedLog. This interpreter integrates a typed unification algorithm to dynamically identify type errors in both Prolog programs and queries during execution. By doing so, the study not only fills a gap in Maude’s support for typed logic programming but also provides Prolog with an effective runtime mechanism for type safety, thereby enhancing program reliability without requiring static type annotations.

dynamic type checkingPrologtype error

Existing approaches struggle to effectively animate, validate, and visualize transition systems defined in Prolog, limiting their utility in formal verification, education, and strategy evaluation. This work addresses these limitations by extending the Prolog animation mode of the ProB platform to support statistical model checking, reliable trace replay, interactive user input, and enhanced state visualization, thereby establishing a unified framework for interactive simulation and analysis. The proposed enhancements substantially improve the observability and usability of Prolog-based transition systems. The framework has been successfully applied to evaluate game-playing strategies in Connect Four, verify proof obligations in Event-B models, and enrich pedagogical demonstrations with greater interactivity and intuitiveness.

animationPrologtransition systems

Hot Scholars

YA

Yanhong A. Liu

Stony Brook University, State University of New York
Languages and AlgorithmsDesign and Optimization
WJ

William Jurayj

Johns Hopkins University
Natural Language ProcessingReinforcement LearningProgram Synthesis
JZ

Jingyu Zhang

WNLO Huazhong University of Science and Technology
optical
BV

Benjamin Van Durme

Johns Hopkins University / Microsoft
LinguisticsNatural Language ProcessingArtificial Intelligence
TY

Tingting Yu

Associate Professor, University of Connecticut
Software EngineeringSoftware Testing