Abstract
This paper introduces a novel methodology for computing the semantics of logic programs—specifically stable and supported models—by leveraging continuous vector spaces and gradient-based optimization. By representing logical atoms as vectors and rules as matrices, the authors transform the traditionally discrete search for logical models into a differentiable fixed-point problem. Using a Sigmoid-based approximation of the immediate consequence operator ($T_P$), the framework employs Newton’s method to converge on models from arbitrary points in the vector space. Evaluation on synthetic logic programs, including complex structures like negative loops and choice rules, demonstrates that gradient information significantly enhances search efficiency and scalability compared to discrete methods.
Introduction
In traditional symbolic logic and Answer Set Programming (ASP), finding models—sets of true statements satisfying a program—is a discrete search problem. Conventional solvers rely on backtracking and conflict analysis. While powerful, this discrete nature hinders the integration of symbolic reasoning with deep learning, which operates in continuous, differentiable spaces.
Existing neuro-symbolic approaches often rely on fuzzy logic approximations, which can sacrifice the precise non-monotonic nature of logic, such as "negation as failure." This research addresses a fundamental question: Can exact logical inference be performed in a continuous space using standard mathematical optimization tools?
Methodology
The proposed framework maps propositional logic into the domain of linear algebra through several key steps:
- Embeddings: Atoms within a program are mapped to one-hot vectors in $\mathbb{R}^N$. An interpretation (a set of true atoms) is represented as a binary vector.
- Matrix Representation: Logic rules are transformed into matrices. The authors demonstrate that the "immediate consequence operator" ($T_P$), the core of logical deduction, can be computed via matrix-vector multiplication.
- Differentiable Approximation: The discrete Heaviside step function typically used in $T_P$ is replaced with a Sigmoid function. The authors provide mathematical proofs for the "confidence thresholds" and "temperatures" ($\tau$) required to ensure the continuous approximation remains faithful to the original discrete logic.
- Newton Deduction: Finding a supported model is reframed as finding a fixed point where $T_P(I) = I$. This is treated as a root-finding problem ($F(v) = 0$), solved using Newton’s method to converge on a model from a random or semantically-guided starting point.
Experimental Results
The approach was evaluated using synthetically generated propositional logic programs designed with challenging structures, such as negative loops, positive loops, and choice rules.
Performance on Negative Loops and Scalability
A critical finding is the existence of a "temperature" sweet spot. If $\tau$ is too low, the system mimics discrete logic and loses gradient information; if too high, the logic becomes too "fuzzy." As shown in the following figure, the algorithm achieves a near 100% success rate for a single negative loop at an optimal temperature of $\tau \approx 0.087$.
The method also demonstrates impressive scalability. It successfully identified models for programs containing up to 32 independent negative loops within one second on a standard CPU, maintaining a perfect success rate when using semantic sampling. Semantic sampling—starting the search from a point already near a valid interpretation—significantly improves convergence speed and success rates.
Performance on Positive Loops
The experiments also highlighted the distinction between supported and stable models. While positive loops increased the success rate for finding supported models (up to 99% in some cases), they significantly complicated the search for stable models, with success rates dropping to as low as 7% in similar configurations. This reflects the inherent complexity of stable model semantics compared to supported models.
Performance on Choice Rules
The framework was also tested on "Choice Rules," which require selecting exactly one option from a set. As the number of choices increases, the search space grows, and the success rate typically declines.
As illustrated in the figure above, the "Semantic" and "Semantic (Short)" sampling methods generally outperform uniform sampling, though the complexity of the choice rules eventually impacts the success rate as the number of choices grows beyond 4 or 5.
Discussion and Future Work
The research highlights that logic can be effectively treated as linear algebra, provided programs meet a "Multiple Definitions" (MD) condition. Gradients provide a vital "steering" mechanism, guiding the algorithm toward valid models more effectively than random search.
However, limitations remain. Newton’s method is not guaranteed to converge. In some cases, the algorithm converged to "spurious" roots (e.g., vectors of 0.5s) that do not correspond to a clear logical state. Furthermore, the current implementation is restricted to propositional logic; extending this to first-order logic remains a significant hurdle. The authors also note that because matrix operations are highly parallelizable, future GPU-based implementations could offer even greater efficiency, paving the way for neural-symbolic systems that learn logic rules directly from data.
Summary updated