The Probabilistic Termination Tool Amber

Marcel Moosbrugger, Ezio Bartocci, Joost-Pieter Katoen, Laura Kovács

Abstract

Verifying the termination of probabilistic programs is a fundamental challenge in formal methods, as it requires reasoning about uncertainty and infinite state spaces. We present Amber, an automated tool designed to prove and refute termination properties—specifically Almost Sure Termination (AST) and Positive Almost Sure Termination (PAST)—for a broad class of probabilistic loops. By integrating martingale theory with symbolic asymptotic bounding and optimized moment computation, Amber significantly expands the scope of verifiable programs to include those with continuous distributions and symbolic constants. Experimental results demonstrate that Amber outperforms existing state-of-the-art tools across diverse benchmark suites, offering a unified framework for both certification and refutation.

Introduction

Probabilistic programming has emerged as a vital paradigm for modeling uncertainty in fields ranging from robotics to artificial intelligence. However, the inherent randomness makes formal verification particularly difficult. One of the most critical properties to verify is termination. Unlike deterministic programs, probabilistic programs require a more nuanced definition of termination:

  1. Almost-Sure Termination (AST): The program terminates with probability 1 on all inputs.
  2. Positive Almost-Sure Termination (PAST): The program terminates with probability 1, and its expected runtime is finite.

While PAST implies AST, the converse is not necessarily true. Existing verification tools, such as MGen, LexRSM, or Absynth, often specialize in one property and frequently fail when faced with complex probability distributions, distributions with infinite support, or symbolic parameters. Amber addresses these gaps by providing a unified framework capable of both proving and refuting these properties across a much broader class of probabilistic programs.

System Architecture and Methodology

Amber is designed to analyze single while-loops characterized by polynomial arithmetic and acyclic variable dependencies. The tool's workflow is centered around a decision-witness cycle that leverages several key components to automate complex mathematical proofs.

The architecture of Amber, illustrating the interaction between proof rules, the bound store, and the witness generation process.

The core of Amber's methodology lies in its automation of martingale-based proof rules. It utilizes four primary rules: Initial State, Ranking Supermartingale (SM), Repulsing SM, and general Supermartingale rules. To apply these rules effectively without requiring manual templates from the user, Amber introduces several technical innovations:

  • Asymptotic Bounding Functions: Instead of requiring users to provide complex bounds, Amber uses symbolic computation to derive asymptotic bounds that certify termination properties.
  • Optimized Moment Computation: Amber incorporates an enhanced version of the Mora tool (Mora v2), utilizing dynamic programming to efficiently calculate closed-form expressions for the statistical moments of program variables.
  • Symbolic Algebra: By leveraging the diofant Python package, Amber handles the heavy lifting of polynomial arithmetic and symbolic constants, allowing it to verify entire families of programs simultaneously.

Experimental Evaluation

To assess Amber's capabilities, it was tested against a comprehensive suite of 50 benchmarks. This suite includes 39 programs from existing literature and 11 new benchmarks featuring symbolic constants and noise from continuous distributions like Gaussian and Laplace. Amber was compared against five state-of-the-art tools: Absynth, MGen, LexRSM, KoAT2, and ecoimp.

Comparative performance of Amber against other state-of-the-art probabilistic termination tools on PAST benchmarks.

Key Results

  • PAST Verification: Out of 27 PAST benchmarks, Amber successfully certified 23. In comparison, the next most effective tool, ecoimp, solved only 13.
  • AST without PAST: In scenarios where programs terminate almost surely but have infinite expected runtime (AST but not PAST), Amber certified 12 out of 14 cases. Competing tools like LexRSM failed entirely in this category as they require PAST subprograms.
  • Refutation: Amber is uniquely capable of refuting termination. It successfully identified 8 out of 9 non-terminating benchmarks.
  • Efficiency: The tool is highly performant; most analyses completed within seconds on standard hardware, well within the 50-second experimental timeout.

Discussion and Future Work

Amber's ability to handle "tricky" small programs—such as adversarial random walks where termination is not obvious—sets it apart. While other tools may scale to larger programs with simpler logic, they often stumble on subtle probabilistic behaviors that Amber handles gracefully through its rigorous martingale analysis. Furthermore, its support for symbolic constants allows for more generalized verification of program families.

Currently, Amber is limited to single-loop programs with acyclic dependencies. Future developments aim to extend its underlying algebraic recurrence techniques to support multi-loop structures and more complex, cyclic variable interactions. Despite these constraints, Amber represents a significant leap forward in the automated verification of probabilistic systems.

Summary updated

BibTeX
@inproceedings{moosbrugger2022probabilistic,
  author = {Marcel Moosbrugger and Ezio Bartocci and Joost-Pieter Katoen and Laura Kovács},
  title = {{The Probabilistic Termination Tool Amber}},
  booktitle = {Formal Methods Syst. Des},
  year = {2022},
  url = {https://openreview.net/forum?id=wG-rc0bkrc},
}
Figure