**Links:** Probabilistic Programming lecture on RWTHonline, exercise class on RWTHonline, and the Moodle course. You can contact us via probprog@moves.rwth-aachen.de.

## News

- 28.03.2024: We are online!

## Schedule

Type | Day | Time | Hall | Start | Lecturer |

Lecture | Mon | 10:30 – 12:00 | AH 3 | April 15 | Katoen |

Tue | 12:30 – 14:00 | AH 5 | April 16 | Katoen | |

Exercise | Wed | 16:30 – 18:00 | AH 3 | April 23 | Ahrens, Schroer, Verscht |

Most of the time, lectures will be held on Mondays and Tuesdays and exercise classes on Wednesday, but there are some notable exceptions. For example, the exercise class is usually on Wednesdays, but it starts on Tuesday, April 23!

You can find the schedules in RWTHonline: Probabilistic Programming (lecture) on RWTHonline and Probabilistic Programming (exercise class) on RWTHonline.

**Motivation and Background**

Probabilistic programs support *random choices* like “execute program *P* with probability 1/3 and program *Q* with probability 2/3″. Probabilistic programs are typically normal-looking sequential programs describing posterior probability distributions. Describing randomized algorithms has been the classical application of these programs. Applications in biology, machine learning, quantum computing, security, and so on, have led to a rapidly growing interest in probabilistic programs in the last decade. For almost all programming languages, such as C, C#, Prolog, Haskell, Scala, LISP, a probabilistic variant does exist; and even a variant of Microsoft’s Excel has been developed.

Most of these languages feature, in addition to sampling from probability distributions, the ability to *condition* values of variables in a program. Conditioning allows for adding information about observed events into the program that may influence the posterior distribution. It is one of the key features in Bayesian networks that rely on Bayes’ rule as the basis for updating information. It is this feature that distinguishes modern probabilistic programming languages from those in the early days describing randomized algorithms.

What is special about probabilistic programs? Although probabilistic programs are normal-looking programs, reasoning about their correctness is intricate. They do not generate a single output but a *distribution over outputs*. The key property of program termination exemplifies this. Whereas a classical program terminates or not, this is no longer true for probabilistic programs. They can diverge, but this may happen with probability zero. That is, even if programs terminate with probability one, they may have non-terminating runs! In addition, in contrast to classical programs that either do not terminate at all or terminate in finitely many steps, a probabilistic program may take infinitely many steps on average to terminate, even if its termination probability is one.

Establishing correctness of probabilistic programs needs — even more so than ordinary programs — formal reasoning.

## Lecture Contents

This lecture series will introduce the probabilistic programming language *webppl*, a functional language based on JavaScript with a simple web interface. Subsequently, we will go into elementary questions such as:

- What do probabilistic programs mean, exactly?
- What does it mean for a program to not terminate with some likelihood?
- How to analyze that a probabilistic program does what it is supposed to do?
- How to prove that a probabilistic program is (more) efficient?
- What are Bayesian networks and how are they related to probabilistic programs?

We will also use the new deductive verification infrastructure Caesar to verify probabilistic programs. It is being developed in our group and we will use it in the exercises to check our formal proofs.

## Prerequisites

Basic knowledge of programming and probability theory.

## Exercises

- There will be weekly or biweekly exercise sheets issued via Moodle.
- Hand in the solutions digitally via Moodle, in groups of 3 or 4 people.
- In order to be admitted to the final exam, at least 50% of the exercise’s points have to be achieved.

## Further Information

- The lecture will be given in
**English**. All course material will be in English. - The students will be awarded
**6 ECTS**credits for the lecture after passing the final exam.

## Literature

The course is based several research papers and material from several books:

- Annabelle McIver and Carroll Morgan — Abstraction, Refinement and Proof for Probabilistic Systems, Springer, 2005.
- Noah Goodman and Andreas Stuhlmüller (electronic) — The Design and Implementation of Probabilistic Programming Languages, 2018.
- Benjamin Lucien Kaminski — Advanced Weakest Precondition Calculi for Probabilistic Programs, Ph.D. Thesis 2019.
- Gilles Barthe, Alexandra Silva, and Joost-Pieter Katoen (Eds.) — Foundations of Probabilistic Programming, Cambridge University Press, 2020.

## Research

Several of our researchers are working on formal semantics and verification of probabilistic programs. This includes all four lecturers of this lecture and the exercise classes. Though not necessarily included in the lecture, you can find all of our latest research on this page. If you’re interested in doing research on probabilistic programming with us, contact us! For example, write to Philipp Schroer.