Abstract
The edit distance between two words $w_1, w_2$ is the minimal number of word operations (letter insertions, deletions, and substitutions) necessary to transform $w_1$ to $w_2$. The edit distance generalizes to languages $\mathcal{L}_1, \mathcal{L}_2$, where the edit distance from $\mathcal{L}_1$ to $\mathcal{L}_2$ is the minimal number $k$ such that for every word from $\mathcal{L}_1$ there exists a word in $\mathcal{L}_2$ with edit distance at most $k$. We study the edit distance computation problem between pushdown automata and their subclasses. The problem of computing edit distance to a pushdown automaton is undecidable, and in practice, the interesting question is to compute the edit distance from a pushdown automaton (the implementation, a standard model for programs with recursion) to a regular language (the specification). In this work, we present a complete picture of decidability and complexity for the following problems: (1)~deciding whether, for a given threshold $k$, the edit distance from a pushdown automaton to a finite automaton is at most $k$, and (2)~deciding whether the edit distance from a pushdown automaton to a finite automaton is finite.
Introduction
In formal verification, the standard approach is to solve the language inclusion problem: "Does the implementation $\mathcal{L}_1$ satisfy the specification $\mathcal{L}_2$?" However, this binary check is often too rigid for real-world applications where minor errors or noise are acceptable. The edit distance offers a quantitative alternative, measuring the maximum number of edits (insertions, deletions, or substitutions) required to map any word in the implementation to its closest counterpart in the specification.
This paper focuses on Pushdown Automata (PDA), the standard mathematical model for recursive programs. The authors explore two primary problems: the Threshold Edit Distance (TED) and the Finite Edit Distance (FED). A critical observation is the asymmetry of language distance; this work focuses on the practically relevant direction of measuring how far a complex, recursive implementation (PDA) is from a simpler, regular specification (NFA/DFA).
Threshold Edit Distance (TED)
The TED problem asks if the edit distance from a PDA to a finite automaton (DFA or NFA) is at most a fixed threshold $k$. This is a direct generalization of the language inclusion problem (where $k=0$).
As illustrated in Figure 4, the TED problem for PDA implementations against regular specifications is ExpTime-complete. Notably, the authors prove that even the case of inclusion ($k=0$) for PDA in NFA is ExpTime-complete, resolving a long-standing complexity gap in classical language theory. Conversely, when the target is a more complex model like a DPDA, the problem becomes undecidable.
Finite Edit Distance (FED)
The FED problem investigates whether the edit distance between two languages is bounded by any finite constant. This is equivalent to asking if the implementation is "eventually" close to the specification, regardless of word length.
The complexity of FED depends heavily on the nature of the target automaton. As shown in Figure 5, while the problem is ExpTime-complete for NFA targets, it drops to coNP-complete for DFA targets. This discrepancy arises from the ability to use specialized Strongly Connected Component (SCC) analysis to identify recurrent states in DFAs that could lead to infinite distances.
Methodology and Key Insights
The authors employ several sophisticated techniques to establish these bounds:
- Impact Automata: To solve TED, they construct "impact automata" that simulate the PDA while tracking the best possible edit distance to every state of the target NFA simultaneously within its control states.
- ATM Reductions: ExpTime-hardness is established via reductions from the linear-space halting problem for Alternating Turing Machines (ATM).
- Exponential or Infinite Dichotomy: A key discovery is that the edit distance between a PDA and an NFA is either bounded by an exponential value ($O(2^{|A_1|} \cdot |A_2|)$) or it is infinite. This "reverse pumping lemma" style insight precludes the existence of "slowly growing" middle grounds.
Conclusion
This research provides a comprehensive complexity landscape for edit distance problems involving pushdown automata. By bridging the gap between qualitative inclusion and quantitative distance, it offers new tools for the robust verification of recursive systems. Future work may extend these results to Visibly Pushdown Automata (VPA) or explore fixed-parameter tractability for practical applications.
Summary updated