This research, originally presented at the 14th Workshop on Answer Set Programming and Other Computing Paradigms, explores the integration of symbolic logic with continuous optimization. The authors propose a gradient-based methodology for identifying "supported models" of logic programs by embedding them into vector spaces, effectively bridging the gap between discrete reasoning and differentiable computing.
Problem Statement: The Limits of Symbolic Inference
Traditional logic programming relies on symbolic inference, which involves searching through discrete state spaces to find truth assignments (models) that satisfy a program's rules. While robust, these symbolic methods often struggle with scalability and do not naturally leverage the parallel processing capabilities of modern hardware like GPUs.
Previous attempts to address this by representing logic programs as matrices and interpretations as vectors encountered a significant hurdle: the operations required to verify if a model is "supported"—where every true statement is justified by a rule—are typically non-differentiable. This lack of differentiability prevents the use of efficient gradient-based optimization, often causing solvers to converge on fractional "middle points" that lack logical meaning.
Methodology
The authors develop a pipeline to transform a discrete logic program into a continuous optimization landscape through four key steps:
- Translation & Encoding: "Normal" logic programs (including negation) are converted into a positive form by treating negated atoms as distinct entities. This program is then encoded into a binary matrix $Q$.
- Differentiable $T_P$ Operator: The core of the approach is the implementation of the "immediate consequence operator" ($T_P$) using matrix-vector multiplication followed by a parameterized $\theta$-thresholding function.
As shown in the figure above, the authors utilize a variant of the hardtanh activation function. This makes the logic "almost everywhere differentiable," allowing the system to navigate the search space using gradients.
- Loss Function Design: To converge on a supported model, the system minimizes a multi-component loss function:
- Fixed-point error: Measures the distance from a stable state of the $T_P$ operator.
- Binary Regularization: Forces vector entries toward discrete values (0 or 1).
- Fact Preservation: Ensures that established facts remain true throughout the optimization process.
- Rounding Heuristic: A "peeking" mechanism rounds the current vector to binary values during descent. If a valid model is found early, the process terminates, significantly accelerating convergence.
Experimental Evaluation
The method was evaluated using synthetic benchmarks designed to test complex logical structures:
- N-negative loops: Programs with $N$ pairs of mutually exclusive rules, creating multiple valid models.
- Choose 1 out of N: A task requiring the solver to find a model where exactly one of $N$ possible atoms is true.
Key Results
- Improved Success Rates: In the "N-negative loops" task, the proposed gradient-based method significantly outperformed previous state-of-the-art algebraic methods when using uniform random initialization.
- Scalability: For the "Choose 1 out of N" task, the authors demonstrated that a "max_retry" strategy—restarting with new random seeds—achieved near 100% success rates even as problem complexity scaled.
- Efficient Trajectories: Qualitative analysis showed that the rounding heuristic allows the solver to bypass the "bottom of the valley" in the optimization landscape, jumping directly to valid binary interpretations once the gradient brings the vector sufficiently close to a solution.
Conclusion and Future Work
While the method successfully finds supported models, the authors note that these are a broader class than the stable models typically sought in Answer Set Programming (ASP), as they may contain self-justifying loops. Future work involves refining the approach to specifically target stable models and conducting extensive performance benchmarking against high-performance symbolic solvers like Clingo to determine if the GPU-friendly nature of this approach yields real-world speed advantages.
Summary updated