一句话:为符号自动机与文法提出多项式时间构造,将 Parikh 计数抽象编码为存在 Presburger 公式,避免指数爆炸。
Parikh 定理是自动机理论的基本结果,说明正则或上下文无关语言的字母计数抽象可用 Presburger 算术定义,并广泛用于软件验证、密码协议验证和数据库查询。然而,实际应用常涉及大字母表甚至无限字母表,符号自动机虽能有效处理,但朴素套用经典 Parikh 定理会得到指数规模的存在 Presburger 公式。本文为符号自动机和文法提出新的 Parikh 构造:不再按字母计数,而是计数输入序列满足不同谓词的次数,并在多项式时间内生成无量词 Presburger 与基理论中的存在公式。该构造还扩展到表达能力很强的参数化符号文法。作者实现了算法,并表明它可求解现有求解器难以处理的字符串约束。
Parikh’s Theorem is a fundamental result in automata theory with numerous applications in computer science. These include software verification (e.g. infinite-state verification, string constraints, and theory of arrays), verification of cryptographic protocols (e.g. using Horn clauses modulo equational theories) and database querying (e.g. evaluating path-queries in graph databases), among others. Parikh’s Theorem states that the letter-counting abstraction of a language recognized by finite automata or context-free grammars is definable in Linear Integer Arithmetic (a.k.a. Presburger Arithmetic). In fact, there is a linear-time algorithm computing existential Presburger formulas capturing such abstractions, which enables an efficient analysis via SMT-solvers. Unfortunately, real-world applications typically require large alphabets (e.g. Unicode, containing a million of characters) — which are well-known to be not amenable to explicit treatment of the alphabets — or even worse infinite alphabets. Symbolic automata have proven in the last decade to be an effective algorithmic framework for handling large finite or even infinite alphabets. A symbolic automaton employs an effective boolean algebra, which offers a symbolic representation of character sets (i.e. in terms of predicates) and often lends itself to an exponentially more succinct representation of a language. Instead of letter-counting, Parikh’s Theorem for symbolic automata amounts to counting the number of times different predicates are satisfied by an input sequence. Unfortunately, naively applying Parikh’s Theorem from classical automata theory to symbolic automata yields existential Presburger formulas of exponential size. In this paper, we provide a new construction for Parikh’s Theorem for symbolic automata and grammars, which avoids this exponential blowup: our algorithm computes an existential formula in polynomial-time over (quantifier-free) Presburger and the base theory. In fact, our algorithm extends to the model of parametric symbolic grammars, which are one of the most expressive models of languages over infinite alphabets. We have implemented our algorithm and show it can be used to solve string constraints that are difficult to solve by existing solvers.