Abstract
We address the problem of model checking context-free specifications for probabilistic pushdown automata, which has relevant applications in the verification of recursive probabilistic programs. Operator Precedence Languages (OPLs) are an expressive subclass of context-free languages suitable for model checking recursive programs. The derived Precedence Oriented Temporal Logic (POTL) can express fundamental OPL specifications such as pre/post-conditions and exception safety. We introduce probabilistic Operator Precedence Automata (pOPA), a class of probabilistic pushdown automata whose traces are OPLs, and study their model checking problem against POTL specifications. We identify a fragment of POTL, called POTLf$\chi$, for which we develop an EXPTIME algorithm for qualitative probabilistic model checking, and an EXPSPACE algorithm for the quantitative variant. The algorithms rely on the property of separation of automata generated from POTLf$\chi$ formulas. The same property allows us to employ these algorithms for model checking pOPA against Linear Temporal Logic (LTL) specifications. POTLf$\chi$ is then the first context-free logic for which an optimal probabilistic model checking algorithm has been developed, matching its EXPTIME lower bound in complexity. In comparison, the best known algorithm for probabilistic model checking of CaRet, a prominent temporal logic based on Visibly Pushdown Languages (VPL), is doubly exponential.
The Challenge of Recursive Probabilistic Verification
Verifying software is inherently difficult; verifying probabilistic software with recursive calls adds layers of complexity. While standard tools like Linear Temporal Logic (LTL) are effective for checking "regular" properties (e.g., "the program never crashes"), they struggle with properties that require reasoning about the program's stack. For instance, LTL cannot easily express a post-condition like "if function A is called, it must eventually return a specific value, ignoring any nested calls it makes in between."
To handle recursion, researchers often use Pushdown Automata (PDA). When probabilities are involved—common in randomized algorithms or Bayesian inference—Probabilistic PDAs are required. While logics like CaRet were designed for these "context-free" properties, their probabilistic model-checking algorithms are notoriously inefficient, often requiring doubly exponential time. This research seeks a more expressive yet computationally efficient "sweet spot" for verifying these complex systems.
Methods: pOPA and the POTLf$\chi$ Fragment
The authors bridge the gap between expressivity and efficiency using several novel components:
- Probabilistic Operator Precedence Automata (pOPA): A new class of automata where the stack operations (push/pop) are determined by precedence relationships between symbols rather than just the current state. This effectively models modern probabilistic programming constructs like
observeandquery. - POTLf$\chi$ Fragment: A specific subset of Precedence Oriented Temporal Logic capable of expressing complex stack-related properties, such as exception safety and pre/post-conditions.
- The "Separation" Property: This technical core allows formulas to be converted into a special type of automaton where languages accepted from different states are disjoint. This avoids the "determinization" step that typically causes exponential complexity explosions.
- Support Chains: The infinite-state pOPA is transformed into a finite Markov Chain called a "support chain," capturing the limit behavior of the program while keeping the mathematics tractable.
Key Results and Complexity Analysis
The most significant contribution of this work is the performance leap in verification complexity. By exploiting the separation property, the authors achieved EXPTIME complexity for qualitative checking and EXPSPACE for quantitative checking. This matches the theoretical lower bounds, making the algorithm as efficient as mathematically possible for this problem class.
Compared to the best-known algorithm for CaRet (which is doubly exponential), this approach is singly exponential. In practical terms, this is the difference between an algorithm that finishes in seconds versus one that might never terminate. The prototype tool successfully verified properties of the Schelling Coordination Game—a model with 311 states and over 1,200 non-linear equations—in under three minutes.
Limitations and Future Work
While a massive improvement, the current optimal algorithm is limited to the POTLf$\chi$ fragment, which lacks "past" operators. Extending this to the full logic without losing efficiency remains a challenge. Additionally, the quantitative variant relies on solving systems of non-linear polynomial equations; while numerical methods currently work well, extremely large or high-precision requirements may still face scaling hurdles. Future work will focus on further optimizing the implementation for industry-scale probabilistic programs.
Summary updated