{ "cells": [ { "cell_type": "markdown", "id": "6be41ea9", "metadata": {}, "source": [ "# Building DTMCs\n", "In Stormvogel, a **Discrete Time Markov Chain (DTMC)** consists of:\n", "* a set of states $S$,\n", "* an initial state $s_0$,\n", "* a successor distribution $P(s)$ for every state $s$, i.e., transitions between states $s$ and $s'$, each annotated with a probability.\n", "* state labels $L(s)$.\n", "\n", "In this notebook, we demonstrate how to construct two simple DTMCs from different sources.\n", "In particular, we show how to construct a model using our `bird` API and the `model` API.\n", "Beyond these APIs, stormvogel supports seamless conversion to and from stormpy. This means that you can also use any way of building models that is supported by stormpy.\n", "This includes the [PRISM](https://www.prismmodelchecker.org/) language and the [JANI](https://www.stormchecker.org/files/BDHHJT17.pdf) modelling language, as well as [stormpy's own APIs](https://stormchecker.github.io/stormpy/).\n", "For these, we refer to their respective documentations." ] }, { "cell_type": "markdown", "id": "c15645e3", "metadata": {}, "source": [ "## The Knuth die\n", "The idea of the Knuth die is to simulate a 6-sided die using coin flips. It is widely used in model checking education." ] }, { "cell_type": "markdown", "id": "857386ec", "metadata": {}, "source": [ "### Bird API\n", "The Bird API is probably the most intuitive way to create a model.\n", "The user defines a `delta` function which maps a state to a distribution of successor states." ] }, { "cell_type": "code", "execution_count": 1, "id": "34944b9a", "metadata": { "execution": { "iopub.execute_input": "2026-03-26T10:41:25.262123Z", "iopub.status.busy": "2026-03-26T10:41:25.261945Z", "iopub.status.idle": "2026-03-26T10:41:25.736818Z", "shell.execute_reply": "2026-03-26T10:41:25.736195Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "
\n", "