Alerus: verifying probabilistic Rust with error credits
(authored by agents unless marked đ§)
Alexander Y. Bai and Joseph Tassarotti, Verifying Probabilistic Programs in Rust, arXiv 2607.12282v1, July 14, 2026. Saved PDF, extracted text.
Alerus extends Verus through a library, rather than a new verifier, to prove probability bounds and exact sampler distributions. The important qualification is that its mechanized semantic model does not justify every demonstrated feature. §6, p.24: âthe soundness of this aspect of our encoding is not captured in AlerusBelt.â Here âthis aspectâ is almost-sure termination through credit amplification.
Method and reusable techniques
An error credit is ghost state representing permission for a bounded probability of failure. §2.2, p.6: âa logical permission to execute actions that might cause an error with probability at mostâ the credit amount. The total-correctness interpretation counts unsafe execution, a wrong returned value and nontermination as failure. A probabilistic postcondition must be read together with its initial credit, not as an ordinary assertion about every random outcome.
- Encode credits using Verus tracked resource algebra. §3.1, p.8: âAll error credits live at a single global ghost location.â The carrier has a real-valued credit, an empty identity and an invalid element. Composition adds nonnegative values; validity requires a value in [0,1). Splitting and joining follow the existing resource interfaces. Reaching credit 1 produces a contradiction because that resource is invalid. This permits excluding a bad branch while accounting for its probability.
- Connect randomness to ghost accounting with a trusted sampling contract. §3.2, p.9: âexpectation preservation (Err-Rand-Exp) and thin air (Err-Thin-Air), are the only constructs Alerus adds as trusted axioms.â
rand_ubigdraws uniformly below an arbitrary-precision bound. A caller chooses an allocation function over outcomes; its average must not exceed the input credit. The returned credit equals that function at the actual sampled outcome. This is the bridge from deterministic SMT arithmetic to probabilistic meaning. - Characterize a whole distribution by preserving expectations for arbitrary bounded outcome-credit functions. §2.2, p.7: âappropriately bounding error probabilities suffices to completely characterize the distribution of values that a program can return.â The expectation-preserving transformation specification quantifies over allocations, rather than proving only one bad-event bound. Indicator allocations recover individual event probabilities.
- Work backward from the desired returned allocation through each sampler call. §5, p.14 and §5.1, p.16: âWe prove this specification by reasoning backwards from the credit allocationâ. Each intermediate allocation must cover its conditional expected downstream credit. Separate pure mathematical identities from the implementation proof.
- Prove almost-sure termination using a ghost fuel measure. §4, p.12: âfind a way to bound the number of steps or repetitions that it will take to reachâ credit 1. Obtain an arbitrary positive thin-air credit. For a geometric loop, double it on the continuing branch and give zero to the terminating branch; choose a finite ghost depth at which it reaches 1. The depth decreases, while executable behavior remains unbounded. This proves termination with probability 1, not a deterministic runtime bound.
- For harder termination arguments, define finite-horizon nontermination probability recursively, prove it tends to zero, and match that recurrence to code. §4, p.13: âIsolating the pure mathematical reasoning in steps 1 and 2 from the code reasoning in step 3 helps to structure the proofs.â The one-dimensional random walk needs position-dependent allocations, not a constant amplification factor. Appendix A gives its tail reasoning; escaping spline and higher-order rejection sampling are additional examples.
- Separate deterministic preprocessing from probabilistic sampling through a well-formed table contract. §5.2, p.20: âthe probabilistic sampling step just updates credits, relying on the table being correctly structuredâ. The alias-table constructor proves shape, bounds and conservation of weighted mass; its sampler assumes that predicate. §5.3 repeats the pattern for the fast loaded dice roller, representing probability mass by decision-tree leaves. This is especially reusable for agents: the proof splits at a meaningful data invariant rather than arbitrary function boundaries.
Case studies and foundations
The full paper develops discrete negative-exponential Bernoulli, geometric Bernoulli, discrete Laplace and discrete Gaussian samplers, plus Walkerâs alias method and the fast loaded dice roller (§5). Rejection samplers maintain one credit supply for distribution correctness and another for termination. §5, p.15: âThis separates out the termination reasoning from reasoning aboutâ sampler correctness. Appendix B develops Bernoulli allocations; Appendix C states the exponential Taylor bound; Appendix D proves the fast geometric sampler; Appendix E gives the Laplace credit split; Appendix F develops the Gaussian sampler; Appendix G supplies dice-roller allocation bounds.
These are proof demonstrations, not a benchmark of autonomous agent success. §1, p.3: âwe employ Claude Opus 4.7 and 4.8â. The paper does not provide a controlled comparison establishing the modelâs success rate or the cost of a VL-style pipeline.
AlerusBelt ports VerusBelt/RustBelt by swapping the Iris weakest-precondition interface for Erisâs probabilistic one. §6, p.23: âwe replace the Iris weakest precondition with the Eris weakest precondition in the lower layers.â Preserving the interface allows reuse of much of the existing Rocq development. Later credits required changed logical modalities and a revised soundness argument. This is evidence that adding a small axiom surface can still require substantial foundational work.
Trust and limits
§3.2, p.9: âWe give the bignum operations trusted specifications, since verifying the bignum library itself is beyond the scope of this paper.â The primitive random generator must meet its uniform contract. §5.1, p.16 represents the exponential âas an uninterpreted function in Verus and axiomatize the properties we need.â Appendix C includes an external_body Taylor-tail lemma. Therefore, âtwo axiomsâ describes the new probabilistic rules, not the entire examplesâ trusted mathematical and library surface.
§6, p.24: âIrisâs prophecy variables are known to be unsound when combined with Erisâs error creditsâ. The model removes the returning-mutable-reference extension that depends on those variables. It also removes concurrency: âwe have additionally removed concurrencyâ. Its weakest precondition covers partial correctness and does not model Verus decreases clauses. The mechanized theorem applies to the modeled core, not arbitrary Rust or every Verus feature.
§7, p.24 also limits expressiveness: âbounds on expected values of running times and properties like positive almost-sure terminationâ are examples of properties not directly captured by Alerus specifications but supported by HeyVL/Caesar. Almost-sure termination does not establish finite expected running time.
Inference: an ordinary Verus pass after adding these axioms cannot by itself establish probabilistic soundness. A VL run must identify the logic extension, enforce its compatible feature subset, and account for mathematical axioms, generator contracts and numeric libraries.
What VL can learn and product threat
Recommendations: reuse tracked probability resources, outcome-allocation templates, backward expectation reasoning, and constructor/sampler decomposition for probabilistic targets. Keep foundation coverage distinct from accepted example proofs. Record a feature-compatibility check before permitting prophecy-based borrows or concurrency with error credits. These are proposed practices, not implemented VL changes.
The threat is specialized: Alerus already supplies probability proof infrastructure and realistic Rust sampler examples, so VL should not sell their invention as its novelty. The paper does not demonstrate autonomous specification discovery or repository-wide project generation. It is a potential enabling dependency and a specialized proof target, rather than evidence that the full VL product already exists. Its relationship to Forte is complementary: sensitivity accounting does not prove that a noise sampler has the promised distribution.
Evidence and VL context
Page numbers below are PDF pages unless printed pages are explicitly named. Quotations and reported results come from the linked primary paper, not an independent reproduction. Recommendations and competitive assessments are our inferences. VLâs current vision says: âThe product direction is autonomous Verus project generation.â Its intended inputs are ordinary intent, code, tests and project documents. This study does not establish that VL currently achieves that goal.
Validation
Material quotations were checked against the PDF text, including a second raw-text extraction for Vostiâs two-column layout. A separate reviewer checked all five studies against the primary text; the citation correction and omitted scope qualifications were incorporated. No code or published experimental results were independently reproduced.
ChatGPT cross-check completed on 2026-10-12; the checked additions are recorded above. The primary-text synthesis and independent review remain the evidence.
ChatGPT cross-check (2026-10-12)
The complete ChatGPT answer was checked against probabilistic_rust.txt. These additions hold:
- Alerus adds two probabilistic rules as trusted axioms: âexpectation preservation (Err-Rand-Exp) and thin air (Err-Thin-Air)â (§3.2, p. 9), while bignum operations have trusted specifications because âverifying the bignum library itself is beyond the scope of this paperâ (§3.2, p. 9)
- the paper states that
external_bodyspecifications extend the trusted computing base (§3.1, p. 8), so âonly two axiomsâ does not describe the whole trust surface - the authors report that Claude Opus 4.7 and 4.8 produced the mathematical lemmas âwithout human interventionâ (§5, p. 15), but the paper gives no controlled success-rate or cost evaluation for complete end-to-end tasks
- the model removes concurrency: âwe have additionally removed concurrencyâ (§6, p. 24), and Caesar/HeyVL support properties ânot directly captured by specifications with Alerus,â including expected running-time bounds (§7, p. 24)
The answerâs termination caveats, threat rating, and interpretation of missing experimental denominators are analysis. No artifact execution was performed.
Last edited: