The probabilistic termination tool amber

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

Abstract

We describe the Amber tool for proving and refuting the termination of a class of probabilistic while-programs with polynomial arithmetic, in a fully automated manner. Amber combines martingale theory with properties of asymptotic bounding functions and implements relaxed versions of existing probabilistic termination proof rules to prove/disprove (positive) almost sure termination of probabilistic loops. Amber supports programs parametrized by symbolic constants and drawing from common probability distributions. Our experimental comparisons give practical evidence of Amber outperforming existing state-of-the-art tools.

Introduction

In traditional software verification, termination is typically treated as a binary property: a program either stops or enters an infinite loop. However, in probabilistic programming—where variables are drawn from distributions such as Normal or Uniform—the concept of termination becomes more nuanced. Researchers distinguish between Almost-Sure Termination (AST), where a program stops with probability 1, and Positive AST (PAST), where the expected runtime is finite.

Verifying these properties is notoriously difficult and often undecidable. Most existing tools require human-provided "templates" or "ranking functions" to assist the solver. Furthermore, many tools are specialized for either proving termination or refuting it, but rarely both. AMBER addresses these challenges by providing a unified, fully automated framework for both proofs and refutations in polynomial probabilistic loops.

The AMBER Framework

AMBER’s effectiveness stems from the integration of three core components:

1. Martingale-Based Proof Rules

AMBER implements "relaxed" versions of classic proof rules, such as the Ranking SM-Rule, SM-Rule, and Repulsing SM-Rule. These rules utilize martingales—sequences of random variables where the future expected value is determined by the current value—to track program progress. By leveraging these rules, AMBER can reason about the convergence or divergence of program states.

2. Asymptotic Bounding Functions

A key innovation in AMBER is the automated computation of asymptotic behavior. Instead of requiring manual proof witnesses, AMBER calculates the long-term behavior of program variables using C-finite recurrence equations. This allows the tool to find closed-form solutions for how variables evolve over time, effectively automating the discovery of ranking functions.

3. Handling Complex Distributions and Symbolic Constants

To manage distributions that return both positive and negative values, AMBER employs a branch-splitting technique. It divides a single probabilistic branch into three: strictly negative, near zero, and strictly positive. This allows for reasoning about the "worst-case" direction of a random walk. Additionally, AMBER supports symbolic constants (e.g., a step size $c$ rather than a fixed value), treating them as arbitrary positive real numbers to maintain generality.

Experimental Evaluation

The authors evaluated AMBER against a benchmark suite of 50 probabilistic programs, including 39 from prior literature and 11 new benchmarks designed to test symbolic constants and "noisy" distributions. The suite includes classic problems like the 1D-random walk and the coupon collector.

Key Results

  • Superior Coverage: AMBER successfully certified 23 out of 27 PAST benchmarks, significantly outperforming competitors like Absynth (9), MGen (11), and LexRSM (12).
  • AST Mastery: In the category of programs that terminate but have infinite expected runtime (AST but not PAST), AMBER certified 12 benchmarks, while the next best tool (LexRSM) certified none.
  • Efficiency: Despite the complex symbolic mathematics involved, most experiments concluded within seconds on a standard laptop.
  • Versatility: AMBER is the first tool to support both discrete and continuous distributions with infinite support (e.g., Normal distribution) in a unified termination analysis.

Discussion and Future Work

AMBER demonstrates that focusing on properties that hold eventually (as the number of loop iterations $i \to \infty$) makes automation more robust by allowing the tool to ignore transient initial behaviors. The loop guard itself often serves as the potential witness; by calculating its asymptotic bound, AMBER can automatically determine if it acts as a "ranking supermartingale."

Limitations

Currently, AMBER is restricted to single loops with acyclic variable dependencies and linear self-dependencies (e.g., $x = x + y$ is supported, but $x = x^2$ is not). It also assumes symbolic constants are positive. Future work aims to extend the tool to handle complex control flows, nested loops, and more general symbolic reasoning.

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