🤖 AI Summary
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.
📝 Abstract
We present WAMpy, a Python framework optimized for synthesizing Prolog programs. Unlike general-purpose Prolog systems, WAMpy targets workloads that repeatedly generate and evaluate small candidate programs. WAMpy compiles Prolog clauses into NumPy array-based WAM instructions and supports partial recompilation of hypotheses against fixed background knowledge. Performance-critical routines are accelerated using Numba just-in-time (JIT) compilation. In a benchmark of repeated compilation-and-evaluation workloads, WAMpy improves end-to-end performance compared with SWI-Prolog accessed from Python using Janus.