Table of Contents
Fetching ...

Learning Deterministic Finite-State Machines from the Prefixes of a Single String is NP-Complete

Radu Cosmin Dumitru, Ryo Yoshinaka, Ayumi Shinohara

TL;DR

This work investigates learning a smallest DFA from prefix-closed samples, which corresponds to recovering a minimum Moore machine along a single run. Through a sequence of polynomial-time reductions from Graph Coloring, it establishes NP-completeness for ConDFA/ConADFA with binary alphabets and prefix-complete samples, and extends the hardness to Moore/Mealy variants. It further proves inapproximability results: no polynomial-time polynomial-ratio approximation is possible for these prefix-complete instances unless P=NP, and hardness persists when samples are prefixes of a single string. These results reveal that even highly structured, trace-like data remain intractable for automata learning, informing the limits of tractable learning and guiding future research on restricted approximation or heuristic approaches in trace-based settings.

Abstract

It is well known that computing a minimum DFA consistent with a given set of positive and negative examples is NP-hard. Previous work has identified conditions on the input sample under which the problem becomes tractable or remains hard. In this paper, we study the computational complexity of the case where the input sample is prefix-closed. This formulation is equivalent to computing a minimum Moore machine consistent with observations along its runs. We show that the problem is NP-hard to approximate when the sample set consists of all prefixes of binary strings. Furthermore, we show that the problem remains NP-hard as a decision problem even when the sample set consists of the prefixes of a single binary string. Our argument also extends to the corresponding problem for Mealy machines.

Learning Deterministic Finite-State Machines from the Prefixes of a Single String is NP-Complete

TL;DR

This work investigates learning a smallest DFA from prefix-closed samples, which corresponds to recovering a minimum Moore machine along a single run. Through a sequence of polynomial-time reductions from Graph Coloring, it establishes NP-completeness for ConDFA/ConADFA with binary alphabets and prefix-complete samples, and extends the hardness to Moore/Mealy variants. It further proves inapproximability results: no polynomial-time polynomial-ratio approximation is possible for these prefix-complete instances unless P=NP, and hardness persists when samples are prefixes of a single string. These results reveal that even highly structured, trace-like data remain intractable for automata learning, informing the limits of tractable learning and guiding future research on restricted approximation or heuristic approaches in trace-based settings.

Abstract

It is well known that computing a minimum DFA consistent with a given set of positive and negative examples is NP-hard. Previous work has identified conditions on the input sample under which the problem becomes tractable or remains hard. In this paper, we study the computational complexity of the case where the input sample is prefix-closed. This formulation is equivalent to computing a minimum Moore machine consistent with observations along its runs. We show that the problem is NP-hard to approximate when the sample set consists of all prefixes of binary strings. Furthermore, we show that the problem remains NP-hard as a decision problem even when the sample set consists of the prefixes of a single binary string. Our argument also extends to the corresponding problem for Mealy machines.
Paper Structure (8 sections, 5 theorems, 8 equations, 4 figures)

This paper contains 8 sections, 5 theorems, 8 equations, 4 figures.

Key Result

lemma 1

A graph $G$ admits a $K$-coloring if and only if $(S_+,S_-)$ admits a consistent DFA with less than $m=(K+1)L$ states.

Figures (4)

  • Figure 1: Example of (a modification of) Zhang's reduction.
  • Figure 2: Tree representation of the sample $(S_+,S_-)$ obtained from the graph in Figure \ref{['fig:inputgraph']}. The state marked with $\tilde{v}_i$ is reached by reading $\tilde{v}_i$. The two states marked with $\tilde{e}_{ij}$ are reached by reading $\tilde{v}_i 0^L \tilde{e}_{ij}$ and $\tilde{v}_j 0^L \tilde{e}_{ij}$. The colors of states correspond to the coloring on the graph in Figure \ref{['fig:inputgraph']}.
  • Figure 3: Consistent ADFA with less than $(K+1)L = 4L$ states obtained by merging some states of the tree automaton in Figure \ref{['fig:consistentPTA']}.
  • Figure 4: DFA Consistent with the sample set obtained from the graph in Figure \ref{['fig:inputgraph']}.

Theorems & Definitions (9)

  • Example 1
  • lemma 1
  • proof
  • theorem 1
  • proof
  • theorem 2
  • lemma 2
  • proof
  • theorem 3