Experiments with Associative-Commutative Discrimination Nets

Leo Bachmair, Ta Chen, I. V. Ramakrishnan, Siva Anantharaman, Jacques Chabin

Abstract

In automated theorem proving, matching terms with associative-commutative (AC) properties is a computationally expensive task, often reaching NP-complete complexity. This paper presents a high-performance two-stage matching algorithm centered around a specialized data structure: the AC-discrimination net. By implementing a polynomial-time linear filter followed by a consistency check, the proposed method achieves significant speedups—up to four-fold in term matching—and enhances the overall efficiency of equational theorem provers like REVEAL.

Introduction: The AC Matching Bottleneck

Automated theorem provers rely heavily on "matching"—the process of determining if a general rule applies to a specific expression. When functions possess Associative-Commutative (AC) properties (e.g., $a + b = b + a$), the number of possible permutations for matching grows exponentially. Since theorem provers spend the vast majority of their execution time on term rewriting, this bottleneck significantly limits performance. The challenge lies in performing many-to-one matching (matching one subject against many patterns) efficiently without succumbing to the exponential cost of general AC-matching.

Methods: A Two-Phase Filtering Approach

The authors propose an AC-discrimination net that decomposes the matching process into two distinct phases:

  1. Phase 1: The Linear Filter. The algorithm first "linearizes" pattern terms by treating all variables as unique. Matching these linearized terms in an AC environment is achievable in polynomial time. This phase acts as a high-speed sieve; if a subject term fails to match the linearized pattern, it is guaranteed not to match the original.
  2. Phase 2: Consistency Checking. Only patterns that pass the first phase proceed to the second, more expensive stage. This phase verifies that multiple occurrences of the same variable are consistently assigned the same subterm (e.g., in $f(x, x)$, both instances of $x$ must be identical).
Figure 5: The structure of an AC-discrimination net, illustrating AC-nodes and control blocks for complex terms.

Technical Innovations

To optimize the AC-discrimination net, several key techniques were employed:

  • Flattened Term Representation: AC terms are represented in a "flat" format to ignore irrelevant nesting of parentheses.
  • Secondary Automata: To handle the bipartite matching problems inherent in AC-matching, the authors pre-compute "secondary automata." These state machines provide instant solutions for small-scale matching problems (up to rank 5), replacing slow general algorithms with efficient table lookups.
Figure 2: A secondary automaton used to efficiently solve bipartite matching problems during the AC-matching process.
  • Non-Deterministic Nets: The implementation uses a non-deterministic variant of discrimination nets, facilitating the dynamic insertion and deletion of rules required during theorem proving runs.

Results and Insights

The effectiveness of the AC-discrimination net was evaluated using terms from the OTTER prover and benchmarks from the REVEAL suite (e.g., Grobner bases, Group Theory, and Robbins Algebra).

Key findings include:

  • Substantial Speedups: The system achieved a 3x to 4x speedup in finding the first valid match, the most frequent operation in term rewriting.
  • High Filtering Efficiency: In benchmarks like uqsl2, the linear filter rejected all patterns in 88% of cases, demonstrating that "fast rejection" is a powerful optimization strategy.
  • Overall Prover Impact: Integration into the REVEAL prover resulted in total execution time reductions of up to 2.2x for complex AC problems.
  • Minimal Overhead: For non-AC problems, the AC-discrimination net performs comparably to standard nets, ensuring no performance penalty for simpler tasks.

Conclusion

The AC-discrimination net provides a robust solution to the AC-matching problem by prioritizing fast, polynomial-time rejection of impossible matches. By combining linear filtering with pre-computed secondary automata, the authors have significantly reduced the computational burden of equational logic, paving the way for more efficient automated reasoning in complex mathematical domains.

Summary updated

BibTeX
@inproceedings{bachmair1995experiments,
  author = {Leo Bachmair and Ta Chen and I. V. Ramakrishnan and Siva Anantharaman and Jacques Chabin},
  title = {{Experiments with Associative-Commutative Discrimination Nets}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {1995},
}
Figure