Edit Distance for Pushdown Automata

Krishnendu Chatterjee, Thomas A. Henzinger, Rasmus Ibsen-Jensen, Jan Otop

Introduction

In formal verification, the relationship between an implementation $L_1$ and a specification $L_2$ is traditionally binary: either $L_1 \subseteq L_2$ or it is not. However, real-world systems often involve minor deviations due to noise, transmission errors, or implementation quirks. The edit distance provides a quantitative framework to measure how many insertions, deletions, or substitutions are required to transform a word from the implementation into one that satisfies the specification.

This paper provides a comprehensive complexity analysis for computing edit distances involving Pushdown Automata (PDA), which model recursive programs, and Finite Automata (DFA/NFA), which represent regular specifications.

Core Decision Problems

The research addresses two fundamental questions regarding the proximity of languages:

  1. Threshold Edit Distance (TED): Is the edit distance from $L_1$ to $L_2$ at most a given threshold $k$?
  2. Finite Edit Distance (FED): Is the edit distance from $L_1$ to $L_2$ finite?

Algorithmic Innovations

To navigate the complexity of these problems, the authors introduce several theoretical tools:

  • The Impact Automaton: A specialized PDA that simulates the source automaton while tracking a vector of minimum edits needed for the target NFA to reach its various states. If the "edit budget" is exhausted across all possible accepting states, a violation is detected.
  • Compact G-decomposition: A structural decomposition for Context-Free Grammars (CFGs) that acts as a "reverse pumping lemma." This tool reveals a critical dichotomy: the edit distance between a PDA and a regular language is either exponentially bounded or infinite.
  • ATM Reductions: Lower bounds are established by reducing the halting problem of Alternating Turing Machines (ATMs) to language inclusion, demonstrating the inherent difficulty of these quantitative checks.

The Complexity Landscape

The paper's primary contribution is a complete mapping of the computational complexity for these problems. A key finding is the decidability boundary: while computing distance to a PDA is undecidable, computing distance from a PDA to a regular language is decidable.

Complexity results for the Finite Edit Distance (FED) problem across different classes of automata.

As illustrated in the FED complexity table above, determining if the distance is finite for a PDA against a DFA is coNP-complete, while checking against an NFA is ExpTime-complete.

Complexity results for the Language Inclusion and Threshold Edit Distance problems.

For the TED and Inclusion problems, the complexity is consistently ExpTime-complete for PDA sources against NFA targets. This reflects the significant computational overhead required to manage recursion alongside non-deterministic specifications.

Key Insights

  • Closing the Inclusion Gap: The authors resolve a long-standing question in language theory by proving that the inclusion of a PDA language in an NFA language is ExpTime-complete, narrowing the previously known PSpace-hard bound.
  • Exponential Dichotomy: For PDAs, a finite edit distance can be exponentially large relative to the size of the automata. This is a significant jump from the polynomial bounds characteristic of finite automata.
  • The Cost of Recursion: The transition from coNP to ExpTime complexity underscores how the addition of a stack (representing recursion) fundamentally changes the difficulty of quantitative verification.

Conclusion

This work establishes the theoretical limits of quantitative verification for recursive programs. While regular specifications are manageable, the undecidability of distance to PDA targets suggests that future research should focus on subclasses like Visibly Pushdown Automata or explore alternative metrics like average edit distance, which remains a significant open challenge in the field.

Summary updated

BibTeX
@inproceedings{chatterjee2015edit,
  author = {Krishnendu Chatterjee and Thomas A. Henzinger and Rasmus Ibsen-Jensen and Jan Otop},
  title = {{Edit Distance for Pushdown Automata}},
  booktitle = {ICALP},
  year = {2015},
  url = {https://openreview.net/forum?id=yZJAAzdVAD},
}
Figure