Checking whether Two Unambiguous Context-Free Grammars Describe the Same Set of Strings of Length n
摘要
The slice equivalence problem for unambiguous context-free grammars is stated as follows: given two unambiguous context-free grammars \(G_1\) and \(G_2\) , tell whether or not they describe the same set of strings of length n. The paper presents an \(O({{\,\textrm{poly}\,}}(n, |G_1|, |G_2|))\) randomized algorithm for this problem. If the sets are different, the algorithm constructs the lexicographically smallest string on which they do not agree. The algorithm combines the idea of the Cocke–Kasami–Younger parsing algorithm and the Schwartz–Zippel lemma.