Countable Nondeterminism in Weighted Programming with an Application to Mechanized Foundations for Probabilistic Program Verification
Sebastian Körner, Oliver Emil Bøving, Christoph Matheja
Abstract
Weighted programming is a framework by Batz et al. for describing mathematical models or optimization problems as imperative programs parametrized over semirings and then analyzing them with program verification techniques like weakest precondition calculi. Applications include reasoning about expected outcomes of probabilistic programs and competitive analysis of online algorithms. We extend weighted programming with (1) countable nondeterminism and (2) user-defined additive rewards, where programs are parametrized over modules instead of semirings. The resulting framework enables reasoning about expected resource consumption of probabilistic programs and about optimal scores of combinatorial games. A technical challenge is that wp-calculi for weighted programs with (1) and (2) over arbitrary modules can be unsound, because it is well-known that continuity properties commonly used in program semantics break in the presence of countable nondeterminism. We study conditions under which a wp-style transformer for reasoning about weighted programs is sound with respect to an operational ground truth defined in terms of weighted decision processes (WDPs) - transition systems that generalize Markov decision processes by drawing transition weights and state rewards from a module. Based on those conditions, we show that a range of concrete instances of the weighted programming framework enjoy sound weakest precondition reasoning. We demonstrate the usefulness of our wp-semantics through case studies for different modules. We mechanized our extended weighted programming framework and our main soundness results in the interactive theorem prover Lean. Instantiating these results for probabilistic programming yields, to the best of our knowledge, the first mechanized proof of a fixed point characterization of minimal expected rewards in Markov decision processes with countable nondeterminism.
Create a lesson
Related papers
Corten - Foundational Verification of Rust Programs
Shared title terminology · František Farka, Carmine Abate, Sven Linker et al.
Simulating Quantum Computation Using Probabilistic Programming
Shared title terminology · Yafei Yang, Chung-chieh Shan
Agent-Native by Design: A Programming Language for Agentic Applications
Shared title terminology · Jayanaka Dantanarayana, Savini Kashmira, Xiaoyu Ma et al.
Mathematical foundations for symmetric programming and reasoning
Shared title terminology · Ohad Kammar, Matija Pretnar
Stochastic Summaries: Characterizing Structured Datasets Using Probabilistic Programs
Shared title terminology · Jack Stanek, Adithya Murali
Compositional Information Geometry of Probabilistic Programs
Shared title terminology · Jacek Karwowski, Frank Nielsen, Sam Staton