Table of Contents
Fetching ...

A faster algorithm for the construction of optimal factoring automata

Thomas Erlebach, Kleitos Papadopoulos

TL;DR

The paper tackles the optimal factoring automata (OFA) problem, central to unification factoring for efficient logic-program execution, by improving the previous dynamic-programming approach from $O(n^2 m (n+m))$ to $O(n^2 m)$ time while preserving $O(nm+n^2)$ space. The key innovation is reusing information from previously computed DP entries to evaluate $D(i,i')$ in $O(m)$ time per pair, using auxiliary arrays and carefully structured updates that avoid recomputing the entire sum for each root-choice $k$. The authors also adapt the method to the weighted OFA problem, show how to perform preprocessing to support constant-time access to combinatorial quantities, and outline how to construct the optimal FA in $O(nm)$. Overall, the results deliver a significantly faster algorithm, with the same space footprint as the prior work, and extend naturally to the weighted variant, offering practical impact for preprocessing in logic programming systems. The approach also suggests potential parallelization opportunities through table-based DP.

Abstract

The problem of constructing optimal factoring automata arises in the context of unification factoring for the efficient execution of logic programs. Given an ordered set of $n$ strings of length $m$, the problem is to construct a trie-like tree structure of minimum size in which the leaves in left-to-right order represent the input strings in the given order. Contrary to standard tries, the order in which the characters of a string are encountered can be different on different root-to-leaf paths. Dawson et al. [ACM Trans. Program. Lang. Syst. 18(5):528--563, 1996] gave an algorithm that solves the problem in time $O(n^2 m (n+m))$. In this paper, we present an improved algorithm with running-time $O(n^2m)$.

A faster algorithm for the construction of optimal factoring automata

TL;DR

The paper tackles the optimal factoring automata (OFA) problem, central to unification factoring for efficient logic-program execution, by improving the previous dynamic-programming approach from to time while preserving space. The key innovation is reusing information from previously computed DP entries to evaluate in time per pair, using auxiliary arrays and carefully structured updates that avoid recomputing the entire sum for each root-choice . The authors also adapt the method to the weighted OFA problem, show how to perform preprocessing to support constant-time access to combinatorial quantities, and outline how to construct the optimal FA in . Overall, the results deliver a significantly faster algorithm, with the same space footprint as the prior work, and extend naturally to the weighted variant, offering practical impact for preprocessing in logic programming systems. The approach also suggests potential parallelization opportunities through table-based DP.

Abstract

The problem of constructing optimal factoring automata arises in the context of unification factoring for the efficient execution of logic programs. Given an ordered set of strings of length , the problem is to construct a trie-like tree structure of minimum size in which the leaves in left-to-right order represent the input strings in the given order. Contrary to standard tries, the order in which the characters of a string are encountered can be different on different root-to-leaf paths. Dawson et al. [ACM Trans. Program. Lang. Syst. 18(5):528--563, 1996] gave an algorithm that solves the problem in time . In this paper, we present an improved algorithm with running-time .
Paper Structure (8 sections, 1 theorem, 16 equations, 1 figure, 1 algorithm)

This paper contains 8 sections, 1 theorem, 16 equations, 1 figure, 1 algorithm.

Key Result

Theorem 1

The OFA problem can be solved in $O(n^2m)$ time using $O(nm+n^2)$ space.

Figures (1)

  • Figure 1: Optimal FA for the string tuple $\mathcal{S}=(\textsf{aaa},\textsf{bbc},\textsf{aab},\textsf{acb})$. For each non-leaf node $q$, the position $p(q)$ is shown to the right of the node.

Theorems & Definitions (1)

  • Theorem 1