1. The Safe Learning Landscape

What "safe" means, the three research traditions, who works on what, and how to read this section

Before you start

This module assumes:

How to study this module

Core reading. Read the seven meanings of safety, the guarantee table, and the notation reference. On a first pass, aim to say what is constrained, over what horizon, and over which randomness. Use the explorer to compare meanings on one system.

Practice route. Try the three readiness checks. If a skill is rusty, use its exact review link, then return. Work through Easy P1–P4, Medium P5–P8, and Hard P9–P12; each has a separate hint and a full worked solution. Reattempt a missed problem later without opening the answer.

Optional research reading. The full conformal, duality, and barrier-function theorems are research previews. Their proofs, the researcher directory, timeline, and original comparative exercises can wait until you know the tools they mention; later modules are not prerequisites for the new graded practice.

Readiness check — Three prerequisite skills

Try these before opening the answer. The review links lead to earlier material.

  1. If $C=\{x:x^2\le1\}$, does $-1$ belong to $C$? Review sets and inequalities.
  2. If an indicator is 1 on an event of probability 0.2, what is its expectation? Review indicators and expectation.
  3. If $x_{t+1}=x_t/2$ and $x_0=1$, what are $x_1$ and $x_2$? Review state updates.
Show readiness answers

The set is $[-1,1]$, so $-1$ is included. The indicator's expectation is $1(0.2)+0(0.8)=0.2$. The trajectory begins $1,1/2,1/4$. If any step felt uncertain, use its review link and try that primer's Easy practice before continuing.

Book contents · Apply this chapter to a real decision · Glossary

Contents
1. What "Safe" Means 2. Three Traditions 3. Types of Guarantees 4. Who's Who 5. Timeline of Landmark Papers 6. Notation for This Section Interactive: Constraint Semantics Application lab & chapter review Exercises Graded practice: Easy, Medium & Hard Key Papers Flashcards

1. What "Safe" Means

Intuition — A starting example

A first example. Suppose the safe state range is $C=[-1,1]$. “The next state lies in $C$” concerns one time. “Every state on this 10-step trajectory lies in $C$” concerns one whole trajectory. “At least 99% of such trajectories stay in $C$” adds a probability distribution. “Starting anywhere in $C$, this controller stays in $C$ for all time and every allowed disturbance” adds universal initial-state, time and disturbance requirements. Keep these four sentences distinct as the definitions become more formal.

"Safe" is the most overloaded word in this literature: a constrained-RL paper, a barrier-function paper and a Lipschitz-network paper all claim it and mean three different mathematical objects. Throughout this section a safety claim is read as a statement about a set (of states, trajectories or inputs), a probability (or none; see Primer C), a horizon, and a list of assumptions. Seven formalisations recur.

We use the control notation of the notation table: state $x_t\in X$, input $u_t\in U$, dynamics $x_{t+1}=f(x_t,u_t)$ (possibly plus noise $w_t$; Primer D), policy $u_t=\pi(x_t)$ (Primer D), safe set $C=\{x:h(x)\ge0\}$ (set-builder notation: Primer 0); the RL modules call the same objects $s$, $a$, $\pi_\theta$.

How to read this section. Start with primers 0 and A–E, which build from first-course linear algebra and single-variable calculus. Read the seven meanings of safety next, then the walkthroughs and explorer. Names of advanced tools are previews; their forward links lead to later modules that explain the constructions.

Definition — (a) Hard state constraints and forward invariance
$C\subseteq X$ is forward invariant under the closed loop $x_{t+1}=f(x_t,\pi(x_t))$ if $x_0\in C$ implies $x_t\in C$ for all $t\ge0$ (continuous time: $x(0)\in C\Rightarrow x(t)\in C$ for all $t\ge0$). The hard-constraint requirement is
$$x_t\in C\ \text{ and }\ u_t\in U\quad\text{for all } t\text{ and every disturbance sequence } w_t\in W,$$
the "Safety Level III" of Brunke et al., Annu. Rev. 2022, written there as $c^j_k(x_k,u_k,w_k)\le0$ for all times $k$ and indices $j$. Example: a manipulator never exceeds its joint limits for any payload in the specified range. Deterministic and worst-case over $W$; needs a model of $f$ and $W$.

When disturbances are present, write $x_{t+1}=f(x_t,u_t,w_t)$ with $w_t\in W$; additive noise is the special case $f(x_t,u_t)+w_t$. Robust safety requires the same controller to succeed for every allowed disturbance sequence, from each initial state covered by the claim.

Definition — (b) Chance constraints
A joint (trajectory-level) chance constraint asks
$$\mathbb P\big(x_t\in C\ \ \forall t\in\{0,\dots,T\}\big)\ \ge\ 1-\delta,$$
a per-step one asks $\mathbb P(x_t\in C)\ge1-\delta_t$ for each $t$ (Brunke et al.'s Level II, $\Pr(c^j_k\le0)\ge p_j$ at each $k$). The union bound (Primer C) gives $\mathbb P(\exists t: x_t\notin C)\le\sum_t\delta_t$. Conversely, the joint constraint gives $\mathbb P(x_t\notin C)\le\delta$ at every single $t$, because $\{x_t\notin C\}\subseteq\{\exists s:x_s\notin C\}$; it does not give any smaller per-step budgets $\delta_t$. Always ask over which randomness: process noise (stochastic MPC, Primer D); the measurement noise seen by a learner (frequentist GP bounds: $f$ fixed, probability over the noise, jointly for all $t$; a Gaussian process models any finite set of unknown function values as jointly Gaussian, Module 3); a prior over $f$ (Bayesian bounds, Primer C); or the calibration data together with the fresh test point (conformal prediction: marginal coverage, which needs the calibration and test examples to be jointly exchangeable, Primer C; theorem below). Example: the quadrotor stays inside the flight cage in at least 99% of flights.
Theorem — Split-conformal marginal coverage (Angelopoulos & Bates 2023)

Fix a measurable score $s(x,y)$ (larger means less plausible), trained on separate data if training is needed. Conditional on that training, assume the $n$ calibration pairs $(X_i,Y_i)$ and fresh pair $(X_{n+1},Y_{n+1})$ are exchangeable. For $0<\delta<1$, let $k=\lceil(n+1)(1-\delta)\rceil$ and $q$ be the $k$-th smallest calibration score, or $+\infty$ when $k=n+1$. Define $\widehat C(x)=\{y:s(x,y)\le q\}$. Then

$$\mathbb P\{Y_{n+1}\in\widehat C(X_{n+1})\}\ge1-\delta.$$

Why. Without ties, exchangeability makes the rank of the fresh score among all $n+1$ scores uniform on $\{1,\dots,n+1\}$. The fresh score is $\le q$ exactly when its rank is at most $k$, which has probability $k/(n+1)\ge1-\delta$; ties only increase coverage. The score must not be fitted on the calibration examples (that breaks exchangeability). Coverage averages over calibration and test draws; it need not hold conditional on a particular input or a particular calibration sample. Explained in Module 15 (Angelopoulos & Bates, Found. Trends Mach. Learn. 2023).

Definition — (c) Expected-cost constraints: the CMDP
A constrained MDP (Primer E) adds cost functions $c_i$ and budgets $d_i$ to an MDP and restricts the policy class (Altman, 1999; notation of Achiam et al., ICML 2017; $\operatorname{arg\,max}$: Primer B):
$$\pi^\star=\operatorname*{arg\,max}_{\pi}\ J(\pi)\quad\text{s.t.}\quad J_{c_i}(\pi)=\mathbb E_{\tau\sim\pi}\Big[\sum_{t=0}^{\infty}\gamma^t c_i(s_t,a_t,s_{t+1})\Big]\le d_i .$$
The constraint is an expectation over episodes of a discounted sum; single episodes may violate arbitrarily. Altman minimises a cost with discount $\alpha$ and initial law $\beta$; Paternain et al., NeurIPS 2019 maximise with reward-type constraints $V_i(\pi)\ge c_i$. We use the reward-max, cost-$\le d$ form everywhere. Example: Safety Gym's budget $d=25$: expected (undiscounted) cost per 1000-step episode, one unit for every step spent in a hazard or other unsafe contact (Ray, Achiam & Amodei, 2019).

Here $J(\pi)=\mathbb E_{\tau\sim\pi}[\sum_{t\ge0}\gamma^t r_t]$ with $0\le\gamma\lt1$, and $\tau\sim\pi$ means that the trajectory $\tau=(s_0,a_0,s_1,\dots)$ is generated by a fixed initial-state distribution, the policy and the transition law. $J_{c_i}$ is an expected discounted sum; papers that use the normalized $(1-\gamma)J_{c_i}$ (a weighted average, since the weights $(1-\gamma)\gamma^t$ sum to 1) scale their budgets by the same factor. Rewards and costs are assumed bounded, so all these expectations are finite.

Definition — (d) Risk-sensitive constraints: CVaR
For an integrable cost $Z$ ($\mathbb E|Z|<\infty$; large is bad) and $\alpha\in(0,1)$, the conditional value-at-risk in the Rockafellar–Uryasev form used by Chow, Ghavamzadeh, Janson & Pavone, JMLR 2018 is
$$\operatorname{CVaR}_\alpha(Z)=\min_{\nu\in\mathbb R}\Big\{\nu+\frac{1}{1-\alpha}\,\mathbb E\big[(Z-\nu)^+\big]\Big\},$$
the average of the worst $(1-\alpha)$-fraction of outcomes: $\alpha\to1$ is the tail, $\alpha\to0$ recovers $\mathbb E[Z]$. A risk constraint reads $\operatorname{CVaR}_\alpha(\sum_t c_t)\le d$. Example: the 5% worst episodes must average fewer than $d$ contacts. It controls frequency and magnitude of bad episodes, which neither (b) nor (c) does alone (first walkthrough below, Step 5).
Caveat — two conventions for $\alpha$
Chow et al. (and this section) use $\alpha$ as the confidence level: the worst $1-\alpha$ fraction is averaged and $\alpha\to1$ is risk-averse. Their prose says "worst-case $\alpha$-fraction" while their formula, with $1/(1-\alpha)$, averages the worst $(1-\alpha)$-fraction; the formula is authoritative. WCSAC-type deep RL papers use $\alpha$ for the tail fraction, so there $\alpha\to0$ is risk-averse. Check the formula, not the words.
Definition — (e) Stability and regions of attraction
An equilibrium $x^\ast$ is asymptotically stable if it is Lyapunov stable (trajectories that start close to $x^\ast$ stay close) and attractive (Primer D); its region of attraction $\mathcal R$ is the set of initial states whose trajectories converge to $x^\ast$. A Lyapunov function (continuous, positive definite about $x^\ast$) certifies a subset: if the closed-loop map $F(x)=f(x,\pi(x))$ is continuous with $F(x^\ast)=x^\ast$ and $V(F(x))-V(x)\lt0$ for all $x\ne x^\ast$ in a compact sublevel set $\mathcal V(c)=\{x:V(x)\le c\}$ (compact means closed and bounded in $\mathbb R^n$, Primer 0), then $\mathcal V(c)$ is forward invariant and $\mathcal V(c)\subseteq\mathcal R$ (continuity of $F$ is what makes the limit set, the points that $x_t$ approaches along some sequence of times $t_k\to\infty$, invariant; without it $V$ can decrease forever without reaching $x^\ast$). Berkenkamp et al., NeurIPS 2017 define the safety constraint as never leaving the region of attraction and certify it through a Lyapunov sublevel set: the pendulum may move but never falls. Deterministic given a model; with a GP model the decrease condition is checked on an upper confidence bound and holds with probability $1-\delta$ (Module 11).
Definition — (f) Robustness of a learned model
A network $\varphi:\mathbb R^n\to\mathbb R^m$ (Primer E) is $L$-Lipschitz in $\ell_2$ (Primer B; norms: Primer A) if $\|\varphi(x)-\varphi(y)\|_2\le L\|x-y\|_2$ for all $x,y$. For a classifier with logits $\varphi_j$ and predicted class $c$ (Primer E), with margin $M(x)=\varphi_c(x)-\max_{j\ne c}\varphi_j(x)\gt0$ this gives a deterministic certified radius: the label cannot change for $\|\delta\|_2\lt M(x)/(\sqrt2L)$, because $\varphi_c-\varphi_j=(e_c-e_j)^{\top}\varphi$ is $\sqrt2L$-Lipschitz ($\|e_c-e_j\|_2=\sqrt2$). If $L=0$, the network is constant and its positive-margin label is unchanged everywhere. Randomized smoothing (Gaussian noise: Primer C) certifies a different object, the Gaussian-smoothed classifier $g(x)=\operatorname*{arg\,max}_c\mathbb P_{\varepsilon\sim\mathcal N(0,\sigma^2I)}\big(\text{label}(x+\varepsilon)=c\big)$: whenever a lower confidence bound $\underline{p_A}\gt1/2$ on the top-class probability is available, $g$ keeps its label for $\|\delta\|_2\lt\sigma\,\Phi^{-1}(\underline{p_A})$, a radius that holds only with the Monte-Carlo confidence of $\underline{p_A}$ (Cohen et al.'s CERTIFY, which abstains otherwise; Cohen, Rosenfeld & Kolter, ICML 2019). This is a property of a function, not a trajectory; it enters closed-loop safety through small-gain (Primer D) and IQC arguments (integral quadratic constraints: quadratic inequalities on whole input/output signals, Module 2; used in Module 14). Example: a perception network whose output moves by at most $0.3$ under any input perturbation of norm at most $0.1$ (guaranteed, for instance, by $L\le3$).
Derivation — The certified radius $M(x)/(\sqrt2L)$

$e_j$ is the $j$-th standard basis vector (a 1 in coordinate $j$, zeros elsewhere), so $\varphi_j=e_j^{\top}\varphi$. For $j\ne c$ set $d_j(x)=\varphi_c(x)-\varphi_j(x)=(e_c-e_j)^{\top}\varphi(x)$. Cauchy–Schwarz and then the Lipschitz bound give

$$|d_j(x+\delta)-d_j(x)|=\big|(e_c-e_j)^{\top}\big(\varphi(x+\delta)-\varphi(x)\big)\big|\le\|e_c-e_j\|_2\,L\|\delta\|_2=\sqrt2L\|\delta\|_2 .$$

The margin definition gives $d_j(x)\ge M(x)$, so $d_j(x+\delta)\ge M(x)-\sqrt2L\|\delta\|_2\gt0$ for every $j\ne c$ whenever $\|\delta\|_2\lt M(x)/(\sqrt2L)$: class $c$ keeps the strictly largest logit. (If $L=0$ the output is constant and every radius is certified.)

In randomized smoothing, let $A$ be the selected top class and $p_A=\mathbb P_\varepsilon(\mathrm{label}(x+\varepsilon)=A)$ its true probability. CERTIFY estimates $p_A$ from Monte-Carlo samples and returns $\underline{p_A}$ with $\mathbb P_{\mathrm{samples}}(\underline{p_A}\le p_A)\ge1-\eta$ ($A$ is chosen from a separate batch of samples, so this bound stays valid). On that event, $\underline{p_A}\gt1/2$ certifies the radius $\sigma\Phi^{-1}(\underline{p_A})$ for $g$. The confidence $1-\eta$ is over the sampling; on that event the radius holds for every perturbation.

Definition — (g) Viability
Given a failure set $X_F$, the viability kernel is the set of states from which failure can be avoided forever (Massiani, Heim, Solowjow & Trimpe, TAC 2023, Def. 1):
$$X_V=\{x\in X:\ \exists u\in\mathcal U,\ \forall t\in\mathcal T,\ \varphi^u_x(t)\notin X_F\},$$
with $\varphi^u_x$ the trajectory from $x$ under controller $u$. The complement $X_U=X\setminus X_V$ is the unviability kernel; it contains the failure set itself (a state in $X_F$ has failed at $t=0$) and the doomed states $X_U\setminus X_F$: not yet failed, but unable to avoid failure. $X_V$ is the largest controlled-invariant subset (Primer D; defined below) of $X\setminus X_F$, so a hard-constraint problem with constraint set $X\setminus X_F$ is feasible from $x_0$ iff $x_0\in X_V$. Example: a car at 100 km/h one metre from a wall is in $X_U$. The guarantee is one of existence; computing $X_V$ needs a model (HJ reachability, Primer D, computes $X_U$ as a backward reachable tube) or a learned safety measure (Module 7).

$\mathcal U$ denotes the allowed controllers or control signals, and $\mathcal T$ the time set, including zero. In this definition there is no adversarial disturbance: from each $x\in X_V$, some admissible control avoids failure forever. In discrete time, controlled invariance means that for every state in the set an allowed input keeps the next state in the set. With disturbances, robust viability instead requires a causal controller that succeeds for every admissible disturbance sequence.

FormalisationTypical guaranteeTypical toolsModules
(a) Hard constraint / invariancedeterministic, for all $w\in W$ and all $t$Nagumo (Primer D), CBF-QP (QPs: Primer B), HJ reachability, robust and tube MPC, shields10, 11
(b) Chance constraint$1-\delta$ over noise, data or prior; joint or per stepstochastic MPC, GP confidence bounds plus Lipschitz continuity (SafeOpt), conformal prediction, scenario approach4, 5, 6, 15
(c) Expected cost (CMDP)in expectation; asymptotic for primal-dual; near-satisfaction per iteration (CPO)Lagrangians (Primer B), occupancy-measure LPs, trust regions (Primer E)8, 9
(d) Risk (CVaR)tail average bounded; implies (b) for the same random variable and threshold, with $\delta=1-\alpha$Rockafellar–Uryasev, distributional critics8
(e) Stability / ROAdeterministic given the model; $1-\delta$ with a GP modelLyapunov functions, contraction, LMIs11, 14
(f) Robustness of a modeldeterministic Lipschitz / reachable-set bounds; probabilistic smoothing radiiLipSDP, direct parameterizations, bound propagation, IQCs12, 13, 15
(g) Viabilityexistence of a safe controller; largest safe setviability theory, HJ backward reachable tubes, safe value functions7, 10

Reading the tools column. The tools are previews, not prerequisites of this module. A shield (safety filter) checks a proposed action and replaces it when it cannot be certified safe (Module 10). An occupancy-measure LP optimizes over discounted state-action visit frequencies, which satisfy linear probability-flow equations (Module 8; Primer E). A distributional critic predicts the whole distribution of future cost, not only its mean (Module 8). Contraction means that the distance between any two trajectories shrinks, which is stronger than convergence to one equilibrium (Module 11). An LMI requires a symmetric matrix that is affine in the decision variables to be semidefinite, and an SDP optimizes a linear objective subject to LMIs (Module 2). Bound propagation pushes an enclosure of the input set through the layers of a network to bound every possible output (Module 15). The scenario approach imposes a constraint only for sampled uncertainty values and bounds the violation probability on fresh ones (theorem below).

Row (d) needs care: for the same integrable random variable $Z$ and threshold $b$, $\operatorname{CVaR}_\alpha(Z)\le b$ implies $\mathbb P(Z\gt b)\le1-\alpha$ (because $\operatorname{CVaR}_\alpha(Z)\ge\operatorname{VaR}_\alpha(Z)$, first walkthrough, Step 5). A trajectory-safety statement needs $Z=\max_{0\le t\le T}[-h(x_t)]$ and $b=0$, since $Z\gt0$ exactly when some state is unsafe. A CVaR budget on the total cost instead bounds only the probability that the total cost exceeds that budget.

Theorem — Scenario approach (Campi & Garatti 2008, Thm. 2.4)

Choose a design $z_N\in K\subseteq\mathbb R^q$ ($K$ closed and convex) by minimizing a fixed linear objective subject to $g(z,w_i)\le0$ for $i=1,\dots,N$, where $N\ge q$ and $w_1,\dots,w_N$ are drawn independently from the distribution of the uncertainty $w$ met in deployment. Assume that every set $\{z:g(z,w)\le0\}$ is closed and convex and (their Assumption 1, as in Module 15) that every sampled program is feasible, its feasible set has nonempty interior, and its optimal solution exists and is unique. Let $V(z)=\mathbb P_w(g(z,w)\gt0)$ be the probability that a fixed design $z$ violates the constraint for a fresh $w$. Then for every $0\lt\epsilon\lt1$,

$$\mathbb P_{w_1,\ldots,w_N}\{V(z_N)>\epsilon\}\le\sum_{j=0}^{q-1}\binom Nj\epsilon^j(1-\epsilon)^{N-j}.$$

Intuition. A convex program in $q$ variables is pinned down by at most $q$ of its sampled constraints, and the right-hand side is the probability that a $\mathrm{Bin}(N,\epsilon)$ count is at most $q-1$ (Primer C), which shrinks as $N$ grows. The outer probability is over the $N$ design samples; $V$ is over one fresh sample. Convexity and uniqueness are substantive assumptions, so this is no certificate for arbitrary neural-network training. Explained in Module 15 (Campi & Garatti, SIAM J. Optim. 2008).

Theorem — CPO near-satisfaction, finite-MDP case (Achiam et al. 2017, Prop. 2)

Use a finite discounted MDP with bounded costs, fixed initial law and transition probabilities, $0<\gamma<1$, and stationary randomized policies $\pi,\pi'$. Define $V_c^\pi(s)$ as the expected discounted cost collected from state $s$ onwards under $\pi$, $Q_c^\pi(s,a)$ the same after first taking action $a$, and the advantage $A_c^\pi=Q_c^\pi-V_c^\pi$ (Primer E). Let $d^\pi(s)=(1-\gamma)\sum_{t\ge0}\gamma^t\mathbb P_\pi(s_t=s)$ and $\varepsilon_c=\max_s|\sum_a\pi'(a|s)A_c^\pi(s,a)|$. Suppose the exact cost surrogate and trust-region constraints hold:

$$J_c(\pi)+\frac{\mathbb E_{s\sim d^\pi,a\sim\pi'}A_c^\pi(s,a)}{1-\gamma}\le d,\qquad \mathbb E_{s\sim d^\pi}D_{\rm KL}(\pi'(\cdot|s)\|\pi(\cdot|s))\le\eta.$$

Here $\eta\ge0$ and $D_{\rm KL}(p\|q)=\sum_a p_a\log(p_a/q_a)$, with $0\log(0/q)=0$ and positive-over-zero terms infinite. Then

$$J_c(\pi')\le d+\frac{\gamma\varepsilon_c\sqrt{2\eta}}{(1-\gamma)^2}.$$

Intuition. The surrogate measures costs using old state frequencies; the remainder pays for their change. Exact feasible CPO updates obey these constraints. Estimated expectations and numerical approximations need additional error control. Explained in Module 9; Achiam et al., Proposition 2.

Key insight
The seven formalisations are only partially ordered. The first walkthrough derives the implications that hold (hard $\Rightarrow$ chance, CVaR $\Rightarrow$ chance, chance $\Rightarrow$ expected cost up to the factor $T+1$, expected cost $\Rightarrow$ chance only through Markov's inequality, which is vacuous for budgets $d\ge1$) and those that fail (a positive discounted budget alone gives no nontrivial bound on infinite-horizon eventual failure; finite-horizon and zero-budget cases are different). The explorer shows one policy being "safe" under one formalisation and "unsafe" under another.
Lemma — A finite failure penalty suffices when failure times are bounded (elementary special case of Massiani et al. 2023, Thm. 2)

Fix an initial state of a deterministic continuous-time system and a class of admissible controllers $u$. Assume trajectories exist for all time, some admissible controller is safe (never reaches the failure set), rewards are measurable with $|r|\le R$, and every unsafe controller reaches the failure set by a common time $T_f\lt\infty$; its first failure time is $t_f\le T_f$. With discount time constant $\tau_d\gt0$ (subscript $d$ because $\tau$ denotes a trajectory elsewhere in this section), maximize the penalized return $G(u)-p\,e^{-t_f/\tau_d}$, where $G(u)=\int_0^\infty e^{-t/\tau_d}r(x(t),u(t))\,dt$ and the penalty term is zero if failure never occurs; assume the maximum is attained. Then

$$p\gt2R\tau_d\,e^{T_f/\tau_d}$$

makes every maximizer safe, hence optimal among the safe controllers, whose returns the penalty does not change. Proof. $|G(u)|\le\int_0^\infty e^{-t/\tau_d}R\,dt=R\tau_d$ for every $u$. An unsafe $u$ has $e^{-t_f/\tau_d}\ge e^{-T_f/\tau_d}$, so

$$G(u)-p\,e^{-t_f/\tau_d}\le R\tau_d-p\,e^{-T_f/\tau_d}\lt R\tau_d-2R\tau_d=-R\tau_d\le G(u_{\rm safe}),$$

so no unsafe controller can be a maximizer. $\square$

Intuition. The time bound keeps the discounted penalty away from zero; bounded rewards limit what failure can buy. Massiani et al. prove a sharper threshold under their Assumption 1, explained in Module 7 (Massiani et al., TAC 2023).

Background — One-sided derivatives and minima at corners

For a function $F$ of one variable (below, $F=F_\alpha$), the right derivative is $F^{\prime}_+(v)=\lim_{a\downarrow0}[F(v+a)-F(v)]/a$ and the left derivative $F^{\prime}_-(v)$ is the same limit with $a\uparrow0$. For $F(v)=|v|$ they are $+1$ and $-1$ at $v=0$, where no ordinary derivative exists. If $F$ is convex, its chord slope $[F(v+a)-F(v)]/a$ never decreases as $a$ increases, so it is $\ge F^{\prime}_+(v)$ for every $a\gt0$ and $\le F^{\prime}_-(v)$ for every $a\lt0$. Multiplying by $a$ (and flipping the inequality when $a\lt0$) gives $F(v+a)-F(v)\ge aF^{\prime}_+(v)$ for $a\gt0$ and $F(v+a)-F(v)\ge aF^{\prime}_-(v)$ for $a\lt0$. Hence $F^{\prime}_-(v)\le0\le F^{\prime}_+(v)$ makes both right-hand sides $\ge0$: no step lowers $F$, so $v$ is a global minimizer, even at a corner. The CVaR objective has such corners when $Z$ has probability atoms.

Background — Limits inside expectations

Bounded convergence says: on a probability space, if measurable $Y_n$ converge almost surely to $Y$ and $|Y_n|\le M$ for one finite constant $M$, then $\mathbb E Y_n\to\mathbb E Y$. For instance, $Y_n=\mathbf1\{U\le1/n\}$ with $U$ uniform on $(0,1)$ tends to zero, and $\mathbb E Y_n=1/n\to0$. Step 2 of the walkthrough below applies this to the difference quotients of the hinge $(Z-\nu)^+$, which are bounded by 1.

Going deeper — Where each formalisation comes from

(a), (e), (g) are classical control and viability theory: set invariance (Blanchini, Automatica 1999), viability kernels (Aubin, Viability Theory, 1991; reprint 2009), barrier certificates (Prajna & Jadbabaie, HSCC 2004), Lyapunov theory, and reachability as a Hamilton–Jacobi PDE (Mitchell, Bayen & Tomlin, TAC 2005). (b) comes from stochastic MPC and from bandit confidence bounds (Srinivas et al., ICML 2010). (c) is Altman's CMDP theory, adopted by deep RL through CPO and the Lagrangian baselines. (d) is the finance notion of coherent risk (Rockafellar–Uryasev), imported into RL by Chow and co-authors among others. (f) is adversarial-robustness research, brought into control language by LipSDP (Fazlyab et al., NeurIPS 2019). García & Fernández, JMLR 2015 classified safe RL by whether it modifies the optimality criterion (worst case, risk, constraints) or the exploration process; Brunke et al. (2022) proposed instead the Level I/II/III taxonomy (constraint satisfaction encouraged, with probability $p$, guaranteed) that maps roughly onto (c)/(b)/(a).

Coherent risk. For losses, a risk functional $\rho$ is coherent if it is monotone ($Z\le Y$ implies $\rho(Z)\le\rho(Y)$), translation equivariant ($\rho(Z+b)=\rho(Z)+b$ for constants $b$), positively homogeneous ($\rho(aZ)=a\rho(Z)$ for $a\ge0$), and subadditive ($\rho(Z+Y)\le\rho(Z)+\rho(Y)$), on a domain where these quantities are finite. For example, expected loss satisfies all four, and $\rho(2Z+3)=2\rho(Z)+3$. CVaR also satisfies them; VaR need not satisfy subadditivity. These rules explain why CVaR treats a sure added cost predictably and does not penalize diversification.

2. Three Traditions

Three communities work on the same word with different assumptions, tools and guarantees. Knowing a paper's tradition tells you what it will assume before you reach the theorem.

TraditionAssumesGuaranteesTypical failure modeModules
Constrained RL
CMDPs, Lagrangians, trust regions
an MDP you can sample (simulator or real system), a scalar cost signal, and that violations during training are tolerable and counted$J_c(\pi)\le d$ in expectation at convergence; near-satisfaction per iteration (CPO); zero duality gap over all policies under Slater's condition and bounded rewards, so the Lagrangian relaxation is exact there (Paternain et al.); for a parametrised policy class the gap is only bounded in terms of its approximation errorviolations while learning; averages hide rare catastrophes; oscillating multipliers (Stooke et al., ICML 2020)8, 9
Control-theoretic certificates and filters
Lyapunov, CBF, HJ, MPC, safe BO
a model: nominal dynamics with a bounded disturbance set, or a GP with a known Lipschitz constant and a known RKHS-norm bound (a bound on the unknown function's norm in the function space defined by the kernel, Module 3); a known constraint set; a safe seed or backup controller; a QP or MPC solved in real timedeterministic invariance or stability, or $1-\delta$ jointly for all $t$; active during learning (filters, SafeOpt) and at deploymentmodel misspecification; an RKHS-norm bound nobody can verify; infeasible QP/MPC; sampled-data effects4–7, 10, 11
Certified models
Lipschitz/SDP, verification, statistical guarantees
a fixed trained network with slope-restricted activations (see Primer D), or an architecture that is Lipschitz by construction; for statistical certificates, calibration and test data that are jointly exchangeable (conformal) or i.i.d. scenarios (scenario approach)deterministic Lipschitz constants, reachable sets, robustness radii; distribution-free coverage (conformal) or violation bounds (scenario approach)loose bounds at scale; distribution shift breaks exchangeability; says nothing about the closed loop unless combined with 10–11 or 1412–15
Theorem — Zero duality gap, finite-MDP case (Paternain et al. 2019, Thm. 1)

Assume finite state and action sets (so rewards and costs are bounded), a fixed initial distribution and transition law, $0\le\gamma\lt1$, finitely many budgets, and optimization over all randomized policies. Suppose one policy satisfies $J_{c_i}(\pi)\lt d_i$ for every $i$ (Slater's strict feasibility). Define the feasible optimum $P^*=\sup_{\pi:J_{c_i}(\pi)\le d_i}J(\pi)$ and

$$\mathcal L(\pi,\lambda)=J(\pi)-\sum_i\lambda_i(J_{c_i}(\pi)-d_i),\qquad D^*=\inf_{\lambda\ge0}\sup_\pi\mathcal L(\pi,\lambda).$$

Then $D^*=P^*$: the duality gap $D^*-P^*$ is zero. The inequality $D^*\ge P^*$ (weak duality) is one line: for feasible $\pi$ and $\lambda\ge0$ every term $-\lambda_i(J_{c_i}(\pi)-d_i)$ is $\ge0$, so $\sup_{\pi'}\mathcal L(\pi',\lambda)\ge\mathcal L(\pi,\lambda)\ge J(\pi)$; take the sup over feasible $\pi$, then the inf over $\lambda$. The theorem is the reverse inequality.

Intuition. State-action frequencies satisfy linear probability-flow equations, which turns this case into a linear program, and linear-programming duality closes the gap; Paternain et al. prove the result for general state spaces, where Slater's condition is what makes it work. Discounting keeps all values finite. The unrestricted policy class matters: a neural family need not realize the needed frequencies. Equality of optimal values does not ensure safe learning iterates. Explained in Module 8; Paternain et al., NeurIPS 2019.

The module map shows the section as a prerequisite graph: solid arrows are prerequisites, dashed arrows conceptual bridges that the target module makes explicit. The small labels name each module's key tools; for instance, dissipativity (Module 14) means that the energy stored in a system can grow only by the energy supplied through its inputs (Module 2).

Foundations 1 The landscape · 2 Duality, LMIs & the S-procedure · 3 Kernels, GPs & uncertainty bounds 3, 22, 322 Safe exploration (Trimpe lens)Control-theoretic safetyConstrained deep RLCertified NNs (Pauli lens) 4 Safe Bayesian opt.5 Is safe BO safe?6 GoSafe, GoSafeOpt7 Viability 10 Barriers, reachability11 Lyapunov, safe MBRL 8 CMDPs, duality9 Trust regions, CPO 12 Lipschitz via SDP13 Lipschitz by design14 NNs in the loop15 Verification SafeOpt, controller tuningReal-β-SafeOpt, LoSBOglobal safe explorationsafe value functions, UPSi CBF-QP, HJ, safety filterslearning-based MPC Lagrangian methodsmodern safe policy opt. LipSDP and beyonddirect parameterizationsQCs, IQCs, dissipativitydistribution-free guarantees viability = complement of the BRTbackups as filtersNN controllers in closed loop

In the map, BRT is the backward reachable tube of the failure set, read here as the set of states from which failure is unavoidable, with the same horizon and quantifiers as the viability problem. Without disturbances and over an infinite horizon it is $X_U=\{x:\ \forall u\in\mathcal U\ \exists t\in\mathcal T:\ \varphi_x^u(t)\in X_F\}$; negating the quantifiers in the definition of $X_V$ ("some $u$ avoids $X_F$ at all $t$") gives exactly this set, so $X_U=X\setminus X_V$. A finite-horizon tube gives finite-horizon viability. A tube defined by "some control reaches the failure set" ($\exists u$ instead of $\forall u$) is in general a larger set.

Why it matters
The traditions are converging. Safety filters (Wabersich et al., IEEE CSM 2023) wrap any RL policy in a control-theoretic certificate; Lipschitz-bounded training (Pauli et al., L-CSS 2022) gives a learned model a robustness margin that closed-loop analyses of NN controllers can build on (Module 14); and the Trimpe group's critique of safe BO (Fiedler et al., TMLR 2024) applies the control question "which assumptions can an engineer check?" to a learning algorithm.

3. Types of Guarantees

Independently of what is guaranteed, guarantees differ in how strongly and when they hold.

TypeStatementRandomnessExamples here
Deterministicholds for every admissible disturbance and initial state, given the assumptionsnoneCBF invariance, LipSDP bounds, tube MPC, HJ safe sets
High probability$\mathbb P(\text{property})\ge1-\delta$noise sequence (frequentist, $f$ fixed), prior over $f$ (Bayesian), calibration data and the test point jointly (conformal, marginal coverage), sampled scenarios, Monte-Carlo estimates (smoothing)SafeOpt Thm 1, GP error bounds (Fiedler, Scherer & Trimpe, AAAI 2021), conformal planning
In expectation$J_c(\pi)\le d$episodes and policyevery CMDP method
Asymptotica property of the limit only (convergence, vanishing average regret, Primer E)variesprimal-dual convergence; GP-UCB's no-regret property (its regret bound itself holds w.h.p. for every finite $T$)
Finite-sampleafter $t^\ast(\epsilon,\delta)$ samples the property holdsas aboveSafeOpt's $t^\ast$, scenario sample sizes

During learning versus at deployment. SafeOpt, SafeMDP, GoSafeOpt, safety filters and Berkenkamp-style model-based RL protect the system while it learns; CPO offers near-satisfaction at every iteration; plain Lagrangian methods promise the constraint only at convergence and may violate it freely on the way (what Safety Gym's cost-rate metric measures). Verification, Lipschitz certificates and conformal prediction certify a finished model and say nothing about the data collection that produced it.

Two representative theorems, one deterministic and one high-probability, show how much the assumptions carry.

Background — Open neighbourhoods, boundaries and regular values

An open neighbourhood $D$ of $C$ contains a small ball around every point of $C$, so a condition required on $D$ is also checked just outside $C$. The boundary $\partial C$ consists of the points that have both points of $C$ and points outside $C$ arbitrarily close; for continuous $h$, $h=0$ on $\partial C$ (Primer 0). $0$ is a regular value of $h$ if $\nabla h(x)\ne0$ wherever $h(x)=0$. Then $\nabla h(x)$ is a normal to the boundary pointing into $C$, and the sign of $\dot h=\nabla h(x)^{\top}\dot x$ distinguishes inward from outward motion. For $h(x)=1-x^2$, $C=[-1,1]$ and $h'(\pm1)=\mp2\ne0$ point into $C$. For $h(x)=-x^3$, $h'(0)=0$, so $\dot h=0$ at the boundary whatever the velocity, and a boundary-only check cannot see a crossing (worked out below the theorem).

Theorem — Forward invariance from a zeroing CBF (Ames, Xu, Grizzle & Tabuada, TAC 2017, Def. 5 and Cor. 2)
Assumptions. Control-affine dynamics $\dot x=f(x)+g(x)u$ (Primer D) with $f,g$ locally Lipschitz and known; $C=\{x:h(x)\ge0\}$ for a continuously differentiable ($C^1$) $h$ (gradients: Primer B) with $C\subseteq D\subset\mathbb R^n$, where either $D$ is an open neighbourhood of $C$ or $0$ is a regular value of $h$ ($\nabla h(x)\ne0$ for all $x\in\partial C$: no boundary point has a vanishing gradient; the condition the ECC 2019 tutorial adds in its Theorem 2); $h$ is a zeroing control barrier function on $D$: there is an extended class-$\mathcal K$ function $\alpha$ (continuous, strictly increasing, $\alpha(0)=0$; Primer D) with
$$\sup_{u\in U}\big[L_fh(x)+L_gh(x)\,u+\alpha(h(x))\big]\ge0\quad\forall x\in D.$$
Statement. Every Lipschitz continuous controller $u:D\to U$ with $u(x)\in K_{\rm zcbf}(x)=\{u\in U:\ L_fh(x)+L_gh(x)u+\alpha(h(x))\ge0\}$ renders $C$ forward invariant (Ames et al., TAC 2017; tutorial in Ames et al., ECC 2019).
In words. If an input keeping $\dot h\ge-\alpha(h)$ always exists, $h$ stays nonnegative along the closed loop, so the trajectory never leaves $C$; for a locally Lipschitz $\alpha$ the comparison lemma adds that $h$, if positive at the start, stays positive, so the boundary is approached at most asymptotically.
Why each assumption matters. Lipschitz $f,g,u$: solutions exist and are unique, otherwise "the" trajectory is undefined. Known $f,g$: the constraint is evaluated with the model; model error shifts $\dot h$ and needs a robust or ISSf version (Module 10). Open $D$ or regular $h$: Ames et al. (2017) prove invariance through Nagumo's boundary condition $\dot h\ge0$ on $\partial C$, which controls the flow only when $0$ is a regular value of $h$ ($\nabla h\ne0$ on $\partial C$; Remark 5 of the 2019 tutorial notes that the 2017 statement leaves this unstated although its proof needs it); if $D$ is an open neighbourhood of $C$, the inequality on $D$ gives invariance without it (while $h(x(t))\lt0$ it would satisfy $\dot h\ge-\alpha(h)\gt0$, so it can never become negative). With neither, the conclusion fails: $h(x)=-x^3$, $D=C=(-\infty,0]$, $\dot x=1$ and $\alpha(r)=3\,\mathrm{sign}(r)\,|r|^{2/3}$ satisfy the barrier inequality on $D$ (with equality), yet $x(t)=-1+t$ leaves $C$ after $t=1$. Admissible inputs on all of $D$ (sup versus max: Primer B): where the sup is negative, $K_{\rm zcbf}(x)=\emptyset$, the CBF-QP has no solution and the guarantee is void; a positive supremum guarantees a feasible input; a supremum of zero needs attainment. A continuous affine expression attains a finite supremum on a nonempty compact set or nonempty closed polyhedron; on $\mathbb R^m$ a nonconstant affine expression is unbounded above but still supplies feasible inputs. Feasibility can fail for an open $U$ ($h=x$, $\dot x=-1+u$, $U=(0,1)$: at $x=0$ the sup is $0$, yet every admissible $u$ gives $\dot h\lt0$); a Lipschitz controller with values in $K_{\rm zcbf}$ is a further requirement. Forward completeness: Corollary 2 gives invariance on the maximal interval of existence of the closed-loop solution (Ames et al., Remark 9: the closed loop need not be forward complete); the "for all $t\ge0$" of formalisation (a) follows when $C$ is compact or the closed loop is otherwise forward complete.
Derivation — Lie derivatives: why the barrier condition is affine in $u$

Here $x\in\mathbb R^n$, $u\in\mathbb R^m$, $f(x)\in\mathbb R^n$, $g(x)\in\mathbb R^{n\times m}$ and $h(x)\in\mathbb R$. Along a trajectory the chain rule gives

$$\dot h=\frac{d}{dt}h(x(t))=\nabla h(x)^{\top}\dot x=\underbrace{\nabla h(x)^{\top}f(x)}_{L_fh(x)}+\underbrace{\nabla h(x)^{\top}g(x)}_{L_gh(x)}\,u ,$$

with the Lie derivatives $L_fh(x)$ (a scalar) and $L_gh(x)$ (a $1\times m$ row vector). At each fixed $x$ the barrier inequality $L_fh(x)+L_gh(x)u+\alpha(h(x))\ge0$ is therefore one linear inequality in $u$, which is why the CBF-QP has linear constraints. ($C^1$ means that the first partial derivatives exist and are continuous.)

Derivation — Checking the counterexample $h(x)=-x^3$

Take $n=1$, $\dot x=1$ ($g=0$, so no input can help) and $C=D=(-\infty,0]$. For $x\le0$: $h=-x^3\ge0$, $\dot h=h'(x)\dot x=-3x^2$, and $\alpha(h)=3(-x^3)^{2/3}=3x^2$, so $\dot h+\alpha(h)=0$ throughout $D$ and the barrier inequality holds. At the boundary point $x=0$, $h'(0)=0$ gives $\dot h=0$, so Nagumo's condition $\dot h\ge0$ on $\partial C$ holds as well, yet $\dot x=1$ pushes the state out: from $x(0)=-1$ the solution $x(t)=-1+t$ leaves $C$ for $t\gt1$. Just outside $C$ ($x\gt0$), $h=-x^3\lt0$, $\alpha(h)=-3x^2$ and $\dot h+\alpha(h)=-6x^2\lt0$, so requiring the inequality on an open neighbourhood of $C$ would have rejected this example.

Theorem — SafeOpt is safe with high probability (Sui, Gotovos, Burdick & Krause, ICML 2015, Thm 1)
Assumptions. $f:D\to\mathbb R$ on a finite $D$ is $L$-Lipschitz for a known metric $d$; $\|f\|_k^2\le B$ for a known kernel $k$ and known $B$ ($B$ bounds the squared RKHS norm in this paper; RKHS norm: first box below and Primer A); the noise $n_t$ is zero-mean conditioned on the history (see Primer C) and uniformly bounded by $\sigma_0$; the posterior $\mu_t,\sigma_t$ is that of a zero-mean GP prior with kernel $k$ and Gaussian likelihood variance $\lambda=\sigma_0^2$, the regulariser in $(K_t+\lambda I)^{-1}$ (a larger $\lambda$ is also valid); a non-empty safe seed $S_0$ with $f(x)\ge h$ on $S_0$ is given; $\beta_t=2B+300\gamma_t\log^3(t/\delta)$ with $\gamma_t$ the maximum information gain (the most information about $f$ that $t$ noisy measurements can provide; third box below, mutual information in Primer C), computed for the same $\lambda$.
Algorithm assumption. Initialize $S_0$ as above. Intersect successive confidence intervals, retaining the known seed bounds, to obtain lower bounds $l_t$. Set $S_t=S_{t-1}\cup\{x\in D:\exists z\in S_{t-1},\ l_t(z)-Ld(z,x)\ge h\}$ and choose $x_t\in S_t$. The particular maximizer/expander choice is needed for optimality, not safety.
Statement. For $0<\delta<1$, $\lambda\ge\sigma_0^2>0$, and this query rule, with probability at least $1-\delta$ (over the noise, jointly for all $t\ge1$) every query satisfies $f(x_t)\ge h$. This is the safety part of Theorem 1. Its second part, a finite-sample optimality result (after $t^\ast$ iterations the best guess $\hat x_t=\arg\max_{x\in S_t}l_t(x)$ is $\epsilon$-optimal within the $\epsilon$-reachable safe region, last box below), is proved in Module 4 (Sui et al., ICML 2015).
In words. The intervals $\mu_{t-1}\pm\beta_t^{1/2}\sigma_{t-1}$ that guide the $t$-th query, built from the posterior after $t-1$ observations, contain $f$ everywhere at all times (Srinivas et al.'s Theorem 6 states the same after $T$ observations as $|\mu_T-f|\le\beta_{T+1}^{1/2}\sigma_T$); Lipschitz continuity extends "certified safe" from evaluated points to their neighbours; so nothing unsafe is ever queried. In this section's convention (norm bound $\|f\|_k\le\tilde B$ with $\tilde B=B^{1/2}$, band $\mu_{t-1}\pm\tilde\beta_t\sigma_{t-1}$) the same multiplier reads $\tilde\beta_t=\beta_t^{1/2}=\big(2\tilde B^2+300\gamma_t\log^3(t/\delta)\big)^{1/2}$.
Why each assumption matters. $B$ and $\beta_t$: too small a $B$ makes the intervals lie and the safety proof collapses (numbers below). $L$: it controls extension to neighbours in the original safe-set rule; other GP safety rules can also certify points directly from their own lower bounds. Bounded noise with this $\beta_t$: Lemma 1 rests on Srinivas et al.'s Theorem 6, which assumes bounded noise although the algorithm uses a Gaussian likelihood; the GP is a deliberately misspecified but frequentist-valid tool, provided its likelihood variance matches the bound: Theorem 6 uses one $\sigma$ both as the bound on $|n_t|$ and as the likelihood standard deviation (also inside $\gamma_t$), and a smaller $\lambda$ shrinks $\sigma_t$ without shrinking the noise (as $\lambda\to0$ the posterior interpolates the noisy data with $\sigma_t\to0$ at the queried points, and the intervals miss $f$). $S_0$: safety is only propagated, never created. Finite $D$: SafeOpt enumerates $S_t$, $G_t$, $M_t$ and the $\epsilon$-reachable set, and $t^\ast$ grows with $|\bar R_0(S_0)|$; the confidence lemma itself (Srinivas et al.'s Theorem 6) is uniform over $x$ through the RKHS structure and does not need a finite domain. Proof in Module 4, $\beta_t$ in Module 3.
Background — The RKHS norm in one paragraph

A kernel $k$ is positive semidefinite if every Gram matrix $K$ with $K_{ij}=k(x_i,x_j)$ is PSD. Such a kernel determines a Hilbert space of functions $\mathcal H_k$, the RKHS, with the reproducing property $f(x)=\langle f,k(x,\cdot)\rangle_k$: evaluating $f$ at $x$ is an inner product with the kernel section $k(x,\cdot)$. For $f=\sum_i a_ik(x_i,\cdot)$ the reproducing property gives $\|f\|_k^2=\sum_{i,j}a_ia_j\langle k(x_i,\cdot),k(x_j,\cdot)\rangle_k=\sum_{i,j}a_ia_jk(x_i,x_j)=a^{\top}Ka$; the space also contains limits of such sums. A bound $\|f\|_k^2\le B$ therefore restricts the whole unknown function relative to the chosen kernel, not only its observed values. Explained in Module 3.

Background — The GP posterior mean and variance

A Gaussian process assigns a joint Gaussian distribution to the function values at any finite collection of inputs. After observing $y_i=f(x_i)+n_i$, $i=1,\dots,t$, write $K_t=(k(x_i,x_j))_{i,j=1}^t$, $k_t(x)=(k(x_1,x),\ldots,k(x_t,x))^{\top}$ and $y=(y_1,\ldots,y_t)^{\top}$. Gaussian conditioning (Primer C) with prior mean zero and noise variance $\lambda$ gives $\mu_t(x)=k_t(x)^\top(K_t+\lambda I)^{-1}y$ and $\sigma_t^2(x)=k(x,x)-k_t(x)^\top(K_t+\lambda I)^{-1}k_t(x)$. This is uncertainty about the latent function, not the variance of a fresh noisy observation. In the frequentist theorem these formulas are a prediction procedure even though the actual bounded noise need not be Gaussian. Derived in Module 3.

Background — The maximum information gain $\gamma_t$

For a design of $t$ query points with Gram matrix $K$, the information that the noisy observations carry about $f$ (their mutual information under the GP model with noise variance $\lambda$) is $\tfrac12\log\det(I+\lambda^{-1}K)$. The quantity

$$\gamma_t=\max_{(x_1,\dots,x_t)\in D^t}\ \tfrac12\log\det\big(I+\lambda^{-1}K\big),\qquad K_{ij}=k(x_i,x_j),$$

is the most any $t$ measurements could provide, computed with the same $\lambda$ as the posterior. Designs are ordered lists in $D^t$, so repeated queries are allowed ($K$ then has repeated rows and columns); this is what covers algorithms that revisit a point. Explained in Module 3.

Derivation — How Lipschitz continuity extends certified safety

Suppose $l_t(z)\le f(z)$ is a valid lower bound. Lipschitz continuity gives $f(x)\ge f(z)-L d(z,x)\ge l_t(z)-L d(z,x)$, so any $x$ with $l_t(z)-L d(z,x)\ge h$ is safe. The confidence lemma (Module 3) gives one event, of probability at least $1-\delta$, on which $l_t(z)\le f(z)$ for all $z$ and $t$. On that event every point that the rule adds to $S_t$ is safe, $S_0$ is safe by assumption, and so every query $x_t\in S_t$ is safe. SafeOpt's expanders are candidates for enlarging $S_t$ and its potential maximizers candidates for the best safe value. For example, $l_t(z)=1.4$, $h=1$, $L=2$ certifies points at distance at most $(1.4-1)/2=0.2$. Explained in Module 4.

Background — $\epsilon$-optimality and the $\epsilon$-reachable safe region

An $\epsilon$-optimal point of a set $A$ is any $x\in A$ with $f(x)\ge\max_{x'\in A}f(x')-\epsilon$. SafeOpt is compared not with all safe points but with those the Lipschitz rule can reach from the seed with an $\epsilon$ margin: $R_\epsilon(S)=S\cup\{x\in D:\ \exists z\in S,\ f(z)-\epsilon-Ld(z,x)\ge h\}$, applied repeatedly until nothing is added; the result is $\bar R_\epsilon(S_0)$. A safe point separated from the seed by an unsafe gap is never reached. The time $t^\ast$ comes from a sample-complexity bound proved in Module 4; the safety statement above does not need it.

The Trimpe-group thesis: a guarantee is only as good as its assumptions, so prefer assumptions a user can check. The recurring premises, sorted by whether an engineer can verify them:

AssumptionWhere it appearsCan a user check it?
known dynamics $f,g$, or a nominal model plus a disturbance set $W$CBF, HJ, robust and tube MPC, predictive safety filterspartly: physics and identification, with explicit uncertainty margins
Lipschitz constant $L$ of the unknown functionSafeOpt, SafeMDP, LoSBO, Berkenkamp 2017plausibly: rate limits, actuator bandwidth, physical gradient bounds
noise bound $E$ (LoSBO) or sub-Gaussian parameter $R$ (see Primer C)LoSBO, GP confidence boundsonly with a justified sensor specification or physical model (for $E$) or distributional model (for $R$); measurements can refute a proposed bound but never prove that larger errors are impossible
RKHS-norm bound $\|f\|_k\le B$ for a known kernelGP-UCB, SafeOpt, Real-$\beta$-SafeOpt, GP-based safe MBRLno: such a bound "at the moment appears to be impossible to derive from reasonable prior knowledge in practically relevant scenarios" (Fiedler et al., TMLR 2024)
non-empty safe seed $S_0$ / backup controllerSafeOpt family, GoSafe, safety filtersyes: a conservative default controller
calibration and test data jointly exchangeable; i.i.d. scenariosconformal prediction, scenario approachonly if the deployment distribution matches; shift silently breaks it
exact weights, and activations that satisfy a valid quadratic constraint: componentwise slope restriction for the original LipSDP, other activation-specific QCs (GroupSort, MaxMin, Householder) in its extensionsLipSDP and the SDP certificates built on ityes, by construction of the network
a simulator faithful enough that training violations are acceptableconstrained deep RLrarely quantified
Pitfall — a guarantee is only as good as its assumptions: the $\beta$ heuristic
SafeOpt's theorem needs $\beta_t=2B+300\gamma_t\log^3(t/\delta)$ with a valid bound $B$ on the squared RKHS norm; the resulting intervals are so wide that the safe set barely grows, so implementations replaced $\beta_t$ by a constant. Fiedler et al. list $\beta\equiv2$ (the quadrotor experiments of Berkenkamp, Schoellig & Krause, ICRA 2016, and SafeMDP), $3$ (GoSafe) and $4$ (GoSafeOpt). Read such constants with care, because the papers put them in different places: the quadrotor paper writes its band as $\mu_{n-1}\pm\beta_n\sigma_{n-1}$ with $\beta_n=2$; SafeOpt-MC and GoSafeOpt keep Sui et al.'s $\mu_{n-1}\pm\beta_n^{1/2}\sigma_{n-1}$ but fix the multiplier $\beta_n^{1/2}$ itself ($2$ in SafeOpt-MC; $4$ in GoSafeOpt's 8-D simulation, $3$ in its other experiments); SafeMDP sets $\beta_t=2$ under the square root, a band of only $1.41\,\sigma_t$. The experiment below uses $\mu_t\pm\beta\sigma_t$, so $\beta\equiv2$ there means $2\sigma_t$. Fiedler, Menn, Kreisköther & Trimpe (TMLR 2024) measured the cost: 100 functions sampled from a squared-exponential RKHS (the function space of the smooth kernel $k(x,y)=a^2\exp(-\|x-y\|_2^2/(2\ell^2))$, with amplitude $a>0$ and length scale $\ell>0$; explained in Module 3) with norm $10$, each algorithm run $10^4$ times per function from two safe points (their Table 1). SafeOpt with $\beta\equiv2$ made unsafe queries in 3.95% of runs on average and 28.62% on the worst function. Real-$\beta$-SafeOpt, which evaluates the rigorous bound (in the norm convention, $\|f\|_k\le B$), with an under-estimated norm bound $B=2.5$: 0.859% (13.38% worst). With the true norm $B=10$ or a conservative $B=20$: 0% violations, but the algorithm never left its two initial points in 30.40% and 68.34% of runs. LoSBO, whose safe set uses only a Lipschitz constant and a hard noise bound: 0% violations, 0.018% not started, and the best final performance (90.9% versus 88.75% for $\beta\equiv2$). The lesson is not "use a larger $\beta$" but "build safety on an assumption you can verify" (Module 5).
Key insight — reading a safety theorem in four questions
(1) What object is constrained: a state at each time, a trajectory, an expectation over episodes, a tail average, a function's gain, or the existence of a controller? (2) With what strength: deterministic, $1-\delta$ over which randomness and jointly or per step, in expectation, asymptotic, finite-sample? (3) When: during data collection, every iteration, at convergence, or for the deployed model only? (4) Under which assumptions, and which can I check? Most disagreements in the literature answer (2) or (3) differently: CPO's bound is a per-iteration near-satisfaction statement for the exact trust-region update with exact expectations, while Safety Gym reports that "it appears to be the case that approximation errors in CPO prevent it from fully satisfying constraints on virtually all" of its environments (Ray et al. 2019). Both are right.

4. Who's Who

The section is organised around two lenses, Sebastian Trimpe's group (safe exploration and learning-based control with checkable guarantees) and Patricia Pauli's work (certified neural networks via SDP and dissipativity), embedded in the wider community. Positions are as of September 2026; Trimpe's and Pauli's were verified against their institutional pages, the others follow the references cited. Landmark papers are linked in the timeline and the Key Papers table.

WhoWhereThemesLandmarks hereModules
Sebastian Trimpe (DSME)Full Professor and head of the Institute for Data Science in Mechanical Engineering (DSME), RWTH Aachen, since 2020; one of the two Executive Directors of the RWTH AI Center (with Holger Hoos) since 2023; formerly Max Planck Research Group Leader (Intelligent Control Systems) at the MPI for Intelligent Systemslearning-based control with guarantees: safe BO, rigorous GP bounds, viability-based safe RL, event-triggered learning, approximate MPC, uncertainty-aware model-based RLMarco 2016; Fiedler 2021; Massiani 2023; Fiedler 2024; UPSi 20263–7
Patricia PauliAssistant Professor, Control Systems Technology, Dept. of Mechanical Engineering, TU Eindhoven (since Oct 2025); PhD 2019–2025 at IST, University of Stuttgart, with Frank Allgöwer; research stay in Sydney 2022safe AI-based control for high-tech systems: Lipschitz-bounded networks via SDP and dissipativity, LMI certificates for NN controllers, CNN parameterizationsPauli 2021 (CDC), 2022 (L-CSS), 2024 (ICLR); LipKernel 202612–14
Frank AllgöwerIST, University of StuttgartMPC, data-driven control, NN certification (Pauli's advisor)co-author of the Pauli papers and of Hertneck et al. 2018 with Trimpe11–14
Carsten SchererUniversity of StuttgartIQCs, robust control, LMIsFiedler, Scherer & Trimpe 20212, 3, 11, 14
Andreas Krause (LAS)ETH ZürichGP bandits, SafeOpt, SafeMDP, GoSafeOptSrinivas 2010; Sui 2015; Turchetta 2016; Berkenkamp 2017; Sukhija et al. 20233–6, 11
Melanie Zeilinger (IDSC)ETH Zürichpredictive safety filters, learning-based MPCWabersich & Zeilinger 2021; Hewing et al. 202010, 11
Aaron AmesCaltechcontrol barrier functionsAmes, Grizzle & Tabuada 2014; Ames et al. 2017, 201910
Claire Tomlin / Jaime FisacUC Berkeley / PrincetonHJ reachability, safety filters, reachability via RLMitchell et al. 2005; Fisac et al. 201910
Angela SchoelligTU Munich (Humboldt Professor, since 2022); also UTIAS, University of Torontosafe learning in robotics, benchmarksBerkenkamp 2017; Brunke 20224, 11
Ian Manchester & Ruigang WangUniversity of SydneyRENs, Sandwich layers, LipKernel co-authorsWang & Manchester 2023; Revay et al. 202413
Bin HuUIUCLipSDP extensions, control-theoretic MLco-author of Pauli et al. ICLR 202412
Mahyar FazlyabJohns Hopkins (formerly UPenn)LipSDP, DeepSDPFazlyab 2019; Fazlyab et al. 202212, 15
Dominik BaumannAalto UniversityGoSafe, safe RL in uncertain contexts, lightweight safe learningGoSafeOpt 20236
Christian FiedlerTU Munich (Munich Center for Machine Learning); formerly RWTH Aachen (DSME)rigorous GP bounds, LoSBOFiedler 2021, 20243, 5
Key insight — there is no joint Pauli–Trimpe paper
The arXiv query au:Trimpe AND au:Pauli returns zero results and Crossref lists no shared publication. The two lenses are linked only indirectly: (i) shared co-authors, Johannes Köhler (with Pauli at L4DC 2021; with Trimpe on Hose et al., TCST 2025, and Tokmak et al., TAC 2025) and Frank Allgöwer (Hertneck, Köhler, Trimpe & Allgöwer, L-CSS 2018); (ii) the Stuttgart/Tübingen MPI-IS and IMPRS-IS ecosystem, where Trimpe led a Max Planck research group (he moved to RWTH Aachen in 2020) and Pauli was an IMPRS-IS doctoral scholar from 2019; (iii) the shared topic of certified neural-network approximations of MPC (Module 11).

5. Timeline of Landmark Papers

Twenty-two landmarks coloured by tradition (colours as in the module map); vertical spacing is proportional to time except where labels would overlap. Each label links to the paper.

Three phases: until about 2013 the ingredients mostly lived apart, certificates (barriers, HJ reachability) on the control side and confidence bounds (GP-UCB) on the learning side, with only early combinations such as learning-based MPC that keeps its safety from the nominal model (Aswani et al. 2013) and reachability supervisors with disturbance bounds learned online (Gillula & Tomlin, RSS 2012); between 2014 and 2019 each tradition produced its template (CBF-QP filters, SafeOpt and SafeMDP, CPO and the zero-duality-gap result, LipSDP); since 2020 the work has been about making the templates honest and scalable: rigorous yet usable GP bounds, PID multipliers (see Primer D), predictive filters, direct Lipschitz parameterizations, and, from the Trimpe group, the demonstration that SafeOpt's practical variants had left their guarantees behind.

6. Notation for This Section

Every module defines its symbols on first use; this table is the shared reference. Where the traditions collide we keep each tradition's convention inside its own modules and flag the clash.

AreaSymbolMeaning
RL$s\in\mathcal S$, $a\in\mathcal A$, $\pi_\theta$state, action, parametrised policy
$r$, $c$, $\gamma$reward, cost, discount factor
$V^\pi$, $Q^\pi$, $A^\pi$value, action-value, advantage
$V_c^\pi$, $Q_c^\pi$, $A_c^\pi$the same for the cost
$J_c(\pi)\le d$, $\lambda\ge0$expected discounted cost constraint with budget $d$; Lagrange multiplier
$\rho_\pi$ (or $d_\pi$)discounted occupancy measure
Control$x\in X$, $u\in U$state, input
$x_{t+1}=f(x_t,u_t)$; $\dot x=f(x)+g(x)u$discrete dynamics; continuous control-affine dynamics
$C=\{x:h(x)\ge0\}$, $h$safe set and barrier function
$V(x)$, $\alpha(\cdot)$Lyapunov function; class-$\mathcal K$ (or extended class-$\mathcal K$) function
$L$Lipschitz constant
GP / safe BO$f:D\to\mathbb R$, $h$unknown function; safety threshold, $f(x)\ge h$ is safe (SafeOpt convention)
$k$, $\mathcal H_k$, $\|f\|_k\le B$kernel, RKHS, norm bound. $B$ bounds the norm; Srinivas et al. and SafeOpt write $\|f\|_k^2\le B$ with $\beta_t^{1/2}$, which we translate explicitly
$\mu_t$, $\sigma_t$GP posterior mean and standard deviation after $t$ data
$\lambda$ in $(K_t+\lambda I)^{-1}$; $\sigma_n^2$regularisation parameter; the physical noise variance when they differ
$\beta_t$, band $\mu_{t-1}\pm\beta_t\sigma_{t-1}$confidence scaling (Chowdhury–Gopalan convention); the band before query $t$, from the posterior after $t-1$ data
$\gamma_t$maximum information gain (never the discount in BO modules)
$S_t$, $G_t$, $M_t$, $l_t(x)$, $u_t(x)$safe set, expanders, maximisers, lower and upper confidence bounds
$E$hard noise bound (LoSBO)
Neural networks$W_i$, $b_i$, $\varphi$layer weights, biases, activation
$\varphi$ slope-restricted in $[\alpha,\beta]$LipSDP convention: $\alpha\le\frac{\varphi(a)-\varphi(b)}{a-b}\le\beta$
$L$, $\rho=L^2$Lipschitz constant; LipSDP's decision variable is the square (LipKernel uses $\rho$ for $L$ itself)
$T=\mathrm{diag}(\lambda_i)\succeq0$diagonal multiplier ($\lambda_i\ge0$; $\succeq$: Primer A) of the incremental quadratic constraint, a quadratic inequality satisfied by the input and output increments of every slope-restricted activation (Module 2)
$M\preceq0$the LMI certificate: a symmetric matrix affine in the decision variables $z$, $M(z)=M_0+\sum_iz_iM_i$, with $v^{\top}M(z)v\le0$ for every vector $v$; an SDP optimizes a linear objective subject to such constraints (Module 2)
$V$, $s(w,z)$, $(Q,S,R)$storage function $V\ge0$, supply rate, QSR dissipativity matrices: for input $w$ and output $z$, $V(x_{t+1})-V(x_t)\le s(w_t,z_t)$ (stored energy grows at most by the supplied energy), with $s(w,z)=z^{\top}Qz+2z^{\top}Sw+w^{\top}Rw$ (Module 2)
Common mistake — symbol clashes across traditions
  • $h$: SafeOpt's safety threshold ($f\ge h$) versus the barrier function ($C=\{h\ge0\}$); Modules 4–6 use the first (Module 6 also writes $h$ for GoSafe’s GP selector function and says so there), 10–11 the second.
  • $\gamma$: discount factor (RL) versus information gain $\gamma_t$ (BO) versus the $\ell_2$-gain bound of dissipativity (Module 2).
  • $\beta$: confidence scaling $\beta_t$ (BO) versus the upper slope bound in $[\alpha,\beta]$ (LipSDP); also Altman's initial law.
  • $\alpha$: class-$\mathcal K$ function (CBF), CVaR level, lower slope bound (LipSDP), Altman's discount.
  • $\lambda$: Lagrange multiplier (CMDP), GP regularisation, entries of LipSDP's $T=\mathrm{diag}(\lambda_i)$.
  • $B$: bound on $\|f\|_k$ (this section, Chowdhury–Gopalan) or on $\|f\|_k^2$ (Srinivas et al., SafeOpt); $\beta_t$ versus $\beta_t^{1/2}$ changes with it.
  • $S_t$, $G_t$, $M_t$: SafeOpt's safe set, expanders and maximisers (Modules 4–6) versus, in the confidence-bound proofs of Module 3, the noise-weighted feature sum, the realised information gain and the supermartingale.
  • $d$: CMDP budget versus the metric $d(x,x')$ in SafeOpt's safe-set update.
  • $V$: value function (RL), Lyapunov function (control), storage function (dissipativity).
  • $\rho$: occupancy measure (RL), $L^2$ (LipSDP), $L$ (LipKernel), risk $\rho(x,u)$ (Safe Value Functions).
  • $\delta$: failure probability, CLF-relaxation slack in CLF-CBF QPs (slack variables: Primer B), input perturbation in robustness.

Interactive: Constraint Semantics

One stochastic system, one policy, four verdicts. The scalar system $x_{t+1}=x_t+u_t+w_t$, $w_t\sim\mathcal N(0,\sigma^2)$ (seeded, so results reproduce), is driven by $u_t=-k\,(x_t-x_{\rm goal})$ towards $x_{\rm goal}=0.8$, right next to the boundary $x\le1$ of the safe set $C=(-\infty,1]$, from $x_0=0$.

The explorer simulates 200 episodes of length $T$ (Monte Carlo: Primer C) and evaluates, for the same policy: the expected number of violating steps $\mathbb E[N]$ (CMDP view, cost $c_t=\mathbf 1\{x_t\gt1\}$, budget $d$); the probability that an episode ever violates (chance view, level $\delta$); $\operatorname{CVaR}_\alpha$ of the signed maximum excursion $Z=\max_t(x_t-1)$ (risk view, must be $\le0$); and whether every sampled episode stayed inside (hard view).

The CMDP verdict uses the exact $\mathbb E[N]$ from the Gaussian marginals of the linear system (Exercise 1.5), with the sample mean shown as a cross-check; the other three verdicts are estimates from the 200 episodes. The same 200 noise sequences are reused when a slider moves (only "Resample noise" draws new ones), so every change you see is caused by the policy, the horizon or the question, not by new noise.

The noise is independent across time and across episodes (Exercise 1.5 writes the same noise as $\sigma w_t$ with $w_t\sim\mathcal N(0,1)$). States within one episode can be dependent because later states carry earlier noise. With $\sigma\gt0$, only at $k=1$, where $x_{t+1}=0.8+w_t$, are the states after time zero independent; then, with per-step violation probability $p$, an episode violates at least once with probability $1-(1-p)^T$. With $\sigma=0$ the hard verdict checks the single trajectory from $x_0=0$ up to time $T$ exactly, but certifies neither other initial states nor later times: with $k=1.1$ the state $x=-10\in C$ maps to $x^+=(1-k)x+0.8k=1+0.88=1.88\gt1$, so $C=(-\infty,1]$ is not invariant even when the displayed trajectory passes.

Constraint Semantics Explorer
seed 1, 200 episodes

The $\pm$ values are one estimated standard error (Primer C): $s_N/\sqrt{200}$ for the mean count, with $s_N$ the sample standard deviation of $N$ over the 200 episodes, and $\sqrt{\widehat p(1-\widehat p)/200}$ for the observed failure fraction $\widehat p$. They are not confidence intervals, and they are $0$ when no episode fails, although zero failures in 200 independent episodes does not prove $p=0$: the exact one-sided 95% upper bound is the $p$ with $(1-p)^{200}=0.05$, i.e. $1-0.05^{1/200}\approx0.0149$. The chance, risk and hard badges compare sample statistics with thresholds (SAMPLE PASSES / SAMPLE FAILS); only the CMDP badge uses the analytical expectation, evaluated numerically.

Top: every second one of the 200 sampled episodes (orange = at least one violation). Bottom: histogram of the signed maximum excursion $Z$; purple lines mark $\operatorname{VaR}_\alpha$ (dashed) and $\operatorname{CVaR}_\alpha$ (solid), grey the mean.

A stationary distribution (Primer C) is a probability law that one update of the system leaves unchanged. Here $x_{t+1}-0.8=(1-k)(x_t-0.8)+w_t$, so $x_t\sim\mathcal N(0.8,v)$ gives $x_{t+1}\sim\mathcal N(0.8,(1-k)^2v+\sigma^2)$, the same law exactly when $v=\sigma^2/[1-(1-k)^2]=\sigma^2/[k(2-k)]$. For $0\lt k\lt2$ the law of $x_t$ converges to this stationary law (Exercise 1.5); its standard deviation is the stationary spread and the initial approach is the transient. With $\sigma\gt0$ the states keep fluctuating: stability of the recursion does not mean that the sample path settles at $0.8$, and "removes the error in one step" at $k=1$ refers to the deterministic part of the error.

Key insight
With the defaults the CMDP verdict passes (exact $\mathbb E[N]\approx0.23$ violating steps per episode, well under $d=1$) while the chance, risk and hard verdicts fail: about one episode in five brushes past the boundary at least once. The behaviour is the same in all four rows; only the question asked of it differs. Raise $\sigma$ and the CMDP verdict flips too (the exact $\mathbb E[N]$ crosses $1$ near $\sigma\approx0.09$). Lower $k$ and, down to about $k=0.2$, every verdict gets worse: a sluggish controller lets the noise accumulate, since the stationary spread $\sigma/\sqrt{k(2-k)}$ grows as $k$ falls below $1$, and for $k$ between $0.1$ and $0.2$ even the CMDP verdict fails. At the bottom of the slider the trend reverses because the transient takes over: with $k=0.05$ the mean has only reached $m_{40}\approx0.70$ when the episode ends, so the gain acts non-monotonically. Raise $k$ towards $1$, the deadbeat gain (see Primer D) that removes the error in one step, and the stationary spread falls to its minimum $\sigma$; every number improves up to about $k=0.8$, but not monotonically beyond, because over a finite horizon the transient mean matters too: the exact $\mathbb E[N]$ bottoms out near $k\approx0.96$ ($0.0843$) and is $0.0855$ at $k=1$, and with the default seed the sampled violation probability rises from $0.035$ at $k=0.9$ to $0.040$ at $k=1$ (the sampled CVaR keeps falling). Even at $k=1$ the states $x_t\sim\mathcal N(0.8,\sigma^2)$, $t\ge1$, are i.i.d. and an episode violates with probability $1-(1-0.0021)^{40}\approx0.08\gt\delta$ (200 samples may still show SAMPLE PASSES: the chance, risk and hard badges are statistics, not certificates). Beyond $k=1$ the controller overshoots the goal: at $k=1.5$ the mean jumps to $m_1=1.2$ and almost every episode crosses the boundary at $t=1$. Shorten $T$ and every verdict improves, because all four are horizon-dependent; since the noise sequences are reused, this holds episode by episode.

From the mathematics to a real decision

Learning objectives

A commissioning decision

A hypothetical laboratory is commissioning a small heated robot enclosure. A batch lasts six minutes. The components must remain at or below $60\,{}^\circ\mathrm C$ throughout a batch. An engineer proposes optimizing the mean of the batch's peak temperature. Another proposes requiring a small probability of any overheating. These are different commissioning specifications, even though both use the same temperature sensor.

For a deliberately simple comparison, assume the peak temperature $Z$ has a known distribution under each fixed schedule. Schedule A produces $58\,{}^\circ\mathrm C$ with probability 0.9 and $68\,{}^\circ\mathrm C$ with probability 0.1; schedule B always produces $59\,{}^\circ\mathrm C$. These numbers define a teaching model, rather than measurements. All variability is represented by this distribution; sensor bias, changing loads, and actuator faults are excluded.

A separate model describes minute-by-minute operation: $T_t$ is temperature in degrees Celsius, $u_t\in[0,12]$ is heater power in kilowatts, and $w_t\in[-1,1]$ is the net disturbance contribution in degrees Celsius during one minute. Assume the update below holds exactly for every admissible disturbance and that power changes occur at the sample times. This second model supports a different kind of evidence.

Worked decision, with its limits

First, name the requested event. Write $E=\{Z\gt60\}$ for overheating at any time during a batch. The expected peaks are $0.9(58)+0.1(68)=59$ for A and $59$ for B. A mean-peak budget of 60 accepts both. Nevertheless, $\mathbb P(E)$ is 0.1 for A and zero for B. Thus a 1% batch-overheating budget rejects A. Averaging the peak already includes the time maximum, but expectation still averages across batches.

Next, translate a repeated-use promise. Suppose six batches each have overheating probability at most 0.01. Without assuming independence, the union bound guarantees only that all six avoid overheating with probability at least $1-6(0.01)=0.94$. Under independence the lower bound becomes $0.99^6\approx0.94148$. Neither reaches 0.99. Allocating $0.01/6$ to each batch is sufficient for a 99% six-batch promise without independence. Shared sensor errors make independence particularly questionable.

$$T_{t+1}=0.8T_t+4+0.5u_t+w_t.$$

Finally, examine a universal claim. The offset 4 is the ambient contribution in degrees Celsius per update; the power coefficient has units degrees Celsius per kilowatt. For $T_t\in[15,60]$, monotonicity in all three variables gives a smallest next temperature $0.8(15)+4-1=15$ and a largest $0.8(60)+4+0.5(12)+1=59$. Therefore this entire interval is invariant for every allowed input and disturbance. Induction extends the one-step calculation to every integer sample time.

The conclusion concerns the stated sampled model. It does not establish a temperature bound between samples, and it fails to cover disturbances outside the assumed interval. The lower endpoint also matters: saying only that the upper temperature decreases would not prove invariance of a two-sided operating range. The appropriate commissioning decision is to select B for the distributional batch specification, or to use the invariant-set argument for a requirement that actually matches the sampled thermal model.

A tempting wrong approach

Common mistake — One successful summary statistic

Reporting “both schedules average 59 degrees” discards precisely the rare hot batches the component specification forbids. Conversely, the robust sampled calculation cannot be presented as a 99% empirical reliability estimate: it contains no probability distribution or observed failure frequency. A certificate should retain its original quantifiers when it is summarized for a colleague.

Transfer the argument

Exercise 1.B1 — Medium: Budget a fleet demonstration

Twenty robot enclosures each run one batch. Require probability at least 0.95 that none overheats. Give an equal per-enclosure risk budget sufficient without independence. What bound follows if the events are independent?

Review: Chance constraints and joint events.

Show hint

Allocate the total failure budget 0.05 across twenty events. Independence multiplies success probabilities instead.

Show worked solution

Allocate the failure budget to the actual event. Let $F_i$ be overheating of enclosure $i$ in its one batch, for $i=1,\ldots,20$. The desired event is that none of these failures occurs. Its complement is $\bigcup_{i=1}^{20}F_i$. If each enclosure satisfies $\Pr(F_i)\le\delta_i$, the union bound gives

$$\Pr(\text{at least one overheats}) =\Pr\left(\bigcup_{i=1}^{20}F_i\right) \le\sum_{i=1}^{20}\Pr(F_i) \le\sum_{i=1}^{20}\delta_i.$$

The allowed fleet failure probability is $1-0.95=0.05$. Equal budgets therefore need $20\delta_i\le0.05$; choose $\delta_i=0.05/20=0.0025$, or $0.25\%$ per enclosure. Taking complements yields fleet success probability at least $1-20(0.0025)=0.95$. No independence is used.

Calculate the stronger bound if independence is justified. Independent failure events also have independent complements. Each enclosure's success probability is at least $1-0.0025=0.9975$, so

$$\Pr(\text{none overheats}) =\prod_{i=1}^{20}\Pr(F_i^c) \ge(0.9975)^{20}\approx0.951170.$$

This is a lower bound; it becomes the exact success probability if every individual failure probability equals its budget. The corresponding failure upper bound is about $0.048830$. A common calibration error or shared load can make the events dependent, so the product calculation requires evidence for independence. The union-bound allocation remains sufficient under such dependence.

Exercise 1.B2 — Hard: A rare spike changes the chosen specification

A third schedule has peak $59\,{}^\circ\mathrm C$ with probability 0.98 and $109\,{}^\circ\mathrm C$ otherwise. Compare a mean-peak cap of 60, a 1% overheating cap, and a $\operatorname{CVaR}_{0.95}$ cap of 75 degrees.

Review: CVaR and its tail convention.

Show hint

The worst 5% includes all of the 2% hot outcomes and another 3% of the ordinary outcomes.

Show worked solution

Use the same peak-temperature random variable in each specification. Here $Z=59$ degrees Celsius with probability $0.98$, and $Z=109$ degrees with probability $0.02$. The mean is

$$\mathbb E[Z]=0.98(59)+0.02(109) =57.82+2.18=60\ \text{degrees Celsius}.$$

The mean-peak cap uses $\mathbb E[Z]\le60$, so it accepts at equality. This average allows cool batches to offset very hot ones.

Check the overheating event. Overheating is $Z\gt60$. Only the $109$-degree outcome satisfies it, so $\Pr(Z\gt60)=0.02=2\%$. This exceeds the permitted $1\%$, and the chance constraint rejects.

Fill the worst five-percent tail, including part of an atom. The confidence level is $0.95$, so CVaR averages the worst $1-0.95=0.05$ fraction. The hot outcomes supply only mass $0.02$. The remaining $0.05-0.02=0.03$ must come from the atom at $59$ degrees. Its tail average is therefore

$$\operatorname{CVaR}_{0.95}(Z) =\frac{0.02(109)+0.03(59)}{0.05} =\frac{2.18+1.77}{0.05} =\frac{3.95}{0.05}=79\ \text{degrees Celsius}.$$

The variational formula confirms the split automatically. At the lower $0.95$ quantile $\nu=59$, the positive excess is zero for the ordinary outcome and $109-59=50$ for the hot outcome, so

$$59+\frac{\mathbb E[(Z-59)^+]}{0.05} =59+\frac{0.02(50)}{0.05}=59+20=79.$$

To check minimization, for $59\le\nu\le109$ the objective is $\nu+0.02(109-\nu)/0.05=43.6+0.6\nu$, which increases with $\nu$; for $\nu\le59$, all outcomes contribute and the objective is $\nu+(60-\nu)/0.05=1200-19\nu$, which decreases toward $59$. For $\nu\ge109$ it equals $\nu$. Thus $\nu=59$ is a global minimizer.

Because $79\gt75$, the CVaR cap rejects. Conditioning only on $Z\gt59$ would average the worst $2\%$ and give $109$; that is a different tail size. The three decisions—accept, reject, reject—are consistent because the specifications constrain a mean, an event probability, and a worst-tail average, respectively.

Synthesis and bridge

The first design artifact should be a sentence specifying what must stay within a limit, for how long, from which initial conditions, and under which randomness or disturbances. The thermal plant, the robot controller, and its learned sensor model can each require different sentences. A bound on one component is useful only after an argument connects it to the final requirement.

The next toolkit chapter turns a dynamical requirement into an inequality that can be checked for an entire set of states. The GP chapter then asks how a model bound can remain meaningful when the quantities needed by that inequality are learned from noisy measurements.

Exercises

Graded practice — Build the argument yourself

There are 12 new problems: four Easy, four Medium, and four Hard. Start with the level that lets you make progress without opening the solution. Easy problems rebuild individual operations; Medium problems combine them; Hard problems ask for proofs, boundary cases, and the limits of a guarantee. The required concepts are explained on this page or in the linked earlier material.

Easy — Warm up one skill at a time.

Exercise 1.P1 — Easy: Read a safe set

For the scalar state $x$, let $h(x)=4-x^2$ and $C=\{x:h(x)\ge0\}$. Write $C$ as an interval. Are $x=-2$, $x=1.5$, and $x=3$ safe? Does knowing that $x_0\in C$ alone prove that later states stay safe?

Review if needed: Primer 0: sets and inequalities. Apply here: this module's explanation.

Show hint

Solve $x^2\le4$; then distinguish a property of one state from a property of a trajectory.

Show worked solution

Translate the defining inequality into an interval. The set contains exactly the real numbers with $h(x)=4-x^2\ge0$. Add $x^2$ to both sides and use that $x^2=|x|^2$:

$$4-x^2\ge0 \iff x^2\le4 \iff |x|\le\sqrt4=2 \iff -2\le x\le2.$$

The square root is valid because both $|x|$ and $2$ are nonnegative. Thus $C=[-2,2]$. Its endpoints are included: the definition allows $h(x)=0$, as well as positive values.

Test each state using the same definition.

$$\begin{aligned} h(-2)&=4-(-2)^2=4-4=0,\\ h(1.5)&=4-(1.5)^2=4-2.25=1.75,\\ h(3)&=4-3^2=4-9=-5. \end{aligned}$$

Therefore $-2$ is safe on the boundary, $1.5$ is safe in the interior, and $3$ is unsafe. A negative value of $h$ means that the state violates the defining inequality.

Separate a safe state from a safe trajectory. Knowing $x_0\in C$ gives the initial step of an invariance argument, but says nothing about the update. For a counterexample, choose the deterministic dynamics $x_{t+1}=x_t+3$ and initial state $x_0=0$. Then $h(x_0)=4\ge0$, but $x_1=0+3=3$ and $h(x_1)=-5\lt0$.

To prove that all later states stay in $C$, one must additionally show that the actual dynamics and chosen controller send each admissible safe current state to another safe state, with any required disturbances covered. Repeating that one-step implication gives the trajectory statement by induction. Initial membership alone supplies only its base case.

Exercise 1.P2 — Easy: Averages of indicator costs

Let $N$ count unsafe steps in one episode. Suppose $N=0$ with probability $0.9$ and $N=5$ with probability $0.1$. Compute $\mathbb E[N]$ and the probability of any violation. Which constraints pass: $\mathbb E[N]\le0.6$ and $\Pr(N\ge1)\le0.05$?

Review if needed: Primer C: expectations and indicators. Apply here: this module's explanation.

Show hint

Multiply each count by its probability. For the chance constraint, count episodes with any unsafe step once.

Show worked solution

Plan. Compute the two quantities straight from the two-point distribution of $N$, then compare each with its own budget.

Step 1 — List the distribution. The random variable $N$ takes only two values: $N=0$ (a fully safe episode) with probability $0.9$, and $N=5$ (an episode with five unsafe steps) with probability $0.1$. These probabilities add to $0.9+0.1=1$, so no other value is possible.

Step 2 — Compute the expectation. For a discrete random variable the expectation is the probability-weighted sum of its values, $\mathbb E[N]=\sum_n n\Pr(N=n)$:

$$\mathbb E[N]=0\cdot0.9+5\cdot0.1=0+0.5=0.5.$$

Step 3 — Compute the probability of any violation. “At least one unsafe step” is the event $\{N\ge1\}$. Of the two possible values, $0$ does not satisfy $N\ge1$ and $5$ does. Hence

$$\Pr(N\ge1)=\Pr(N=5)=0.1.$$

Note that the episode with five violations is counted once here, not five times: the event only asks whether the episode had any violation.

Step 4 — Compare with the budgets. The expected-cost constraint asks $\mathbb E[N]\le0.6$; since $0.5\le0.6$, it passes. The chance constraint asks $\Pr(N\ge1)\le0.05$; since $0.1\gt0.05$, it fails.

Check. Exercise 1.3 proves $\Pr(N\ge1)\le\mathbb E[N]$ for a count of unsafe steps. Here $0.1\le0.5$, consistent with that inequality. The gap is large because each bad episode contributes $5$ to the count but only $1$ to the event indicator: $\mathbb E[N]=5\Pr(N\ge1)$.

Interpretation. The expectation counts unsafe steps, while the chance constraint counts unsafe episodes; here one in ten episodes has five violations, which the step budget tolerates and the episode budget does not. Neither number tells us their physical severity; a separate magnitude-based cost would be needed for that.

Exercise 1.P3 — Easy: One-step versus joint confidence

There are four monitored steps. At each step the failure probability is at most $0.01$. Give a guaranteed lower bound on the probability that all four steps are safe. Is independence needed?

Review if needed: Primer C: union bounds. Apply here: this module's explanation.

Show hint

The complement of “all safe” is the union of the four failure events.

Show worked solution

Plan. Bound the probability that some step fails with the union bound, then take the complement to get the probability that all steps are safe.

Step 1 — Name the events. Let $F_t$ be the event “step $t$ fails”, for $t=1,2,3,4$. We are told $\Pr(F_t)\le0.01$ for each $t$. The event “all four steps are safe” is $F_1^c\cap F_2^c\cap F_3^c\cap F_4^c$.

Step 2 — Rewrite “all safe” through its complement. By De Morgan's law, “not every step is safe” is the same as “at least one step fails”:

$$\begin{gathered} \left(\bigcap_{t=1}^4F_t^c\right)^c=\bigcup_{t=1}^4F_t,\\ \text{so}\quad\Pr(\text{all four safe})=1-\Pr\left(\bigcup_{t=1}^4F_t\right). \end{gathered}$$

Step 3 — Apply the union bound. For any events, $\Pr(A\cup B)=\Pr(A)+\Pr(B)-\Pr(A\cap B)\le\Pr(A)+\Pr(B)$, because the subtracted overlap is nonnegative. Applying this repeatedly to four events gives

$$\Pr\left(\bigcup_{t=1}^4F_t\right)\le\sum_{t=1}^4\Pr(F_t)\le4(0.01)=0.04.$$

Step 4 — Take the complement. Subtracting from one reverses the inequality:

$$\Pr(\text{all four safe})\ge1-0.04=0.96.$$

Step 5 — Is independence needed? No. The only fact used in Step 3 is $\Pr(A\cap B)\ge0$, which is true for any events, dependent or not. So the bound remains valid for the dependent states of one trajectory.

Check. Under the additional assumption of independent failures with probability exactly $0.01$ each, the safe probability would be the product $0.99^4=0.96059601$. This is slightly above $0.96$, as it must be: the union bound is a guaranteed lower bound, and the gap $0.00059601$ is the overlap that the union bound throws away. Without independence, multiplying the four probabilities is unjustified.

Interpretation. A per-step budget of $1\%$ buys a joint four-step guarantee of only $96\%$; per-step risks add up across the horizon.

Exercise 1.P4 — Easy: Translate notation across traditions

A control paper writes $x_{t+1}=f(x_t,u_t)$ and $u_t=\pi(x_t)$. An RL paper uses state $s_t$, action $a_t$, and policy $\pi$. Translate the deterministic closed-loop update into RL notation. What extra object is needed for stochastic transitions?

Review if needed: Primer E: states, actions and policies. Apply here: this module's explanation.

Show hint

The different letters describe the same roles; randomness changes a map into a conditional distribution.

Show worked solution

Plan. Match the symbols by their roles, substitute, then compose the policy into the dynamics; finally ask what replaces a map when the next state is random.

Step 1 — Match roles, not letters. In both traditions there is a quantity describing the system at time $t$ and a quantity chosen by the decision maker at time $t$. So the dictionary is

$$\begin{aligned} x_t&\ \leftrightarrow\ s_t&&(\text{state}),\\ u_t&\ \leftrightarrow\ a_t&&(\text{input / action}),\\ \pi&\ \leftrightarrow\ \pi&&(\text{feedback law / policy}). \end{aligned}$$

Step 2 — Substitute into both equations. The controller $u_t=\pi(x_t)$ becomes $a_t=\pi(s_t)$, and the dynamics $x_{t+1}=f(x_t,u_t)$ become $s_{t+1}=f(s_t,a_t)$.

Step 3 — Close the loop. The closed-loop update eliminates the action by inserting the policy into the dynamics (a function composition):

$$s_{t+1}=f\big(s_t,\pi(s_t)\big)=:f_\pi(s_t).$$

Now the next state depends on the current state alone, which is what “closed loop” means. The function $f$ here is a transition map, rather than the unknown performance function called $f$ in BO.

Step 4 — Replace the map by a distribution for stochastic transitions. If the same $(s,a)$ can lead to different next states, there is no single value $f(s,a)$ to write down. What is needed is a transition kernel $P(\cdot\mid s,a)$, a probability distribution over next states for each state–action pair, and the update becomes $s_{t+1}\sim P(\cdot\mid s_t,a_t)$. The deterministic case is the special case in which $P(\cdot\mid s,a)$ puts all its mass on the single point $f(s,a)$. If the policy is stochastic too, the action is likewise sampled, $a_t\sim\pi(\cdot\mid s_t)$.

Check. Setting $P(\cdot\mid s,a)$ to the point mass at $f(s,a)$ and $\pi(\cdot\mid s)$ to the point mass at $\pi(s)$ recovers exactly the update of Step 3, so the stochastic description contains the deterministic one.

Interpretation. Once transitions or actions are random, a safety probability must specify whether it averages over transitions, actions, initial states, learned data, or several of these.

Medium — Combine definitions and compute a certificate.

Exercise 1.P5 — Medium: Allocate a trajectory risk budget

A 20-step task has total allowed failure probability $\delta=0.02$. Choose equal per-step budgets that suffice by the union bound. If instead every step receives budget $0.02$, what run-wide bound follows?

Review if needed: Primer C: simultaneous probability statements. Apply here: this module's explanation.

Show hint

Add the budgets before taking the complement.

Show worked solution

Plan. Write the run failure as a union of step failures, use the union bound to turn per-step budgets into a run bound, and solve for the equal budget; then repeat the bound with the larger per-step budget.

Step 1 — Express run failure through step failures. Let $F_t$ be failure at step $t$, $t=1,\ldots,20$, with $\Pr(F_t)\le\delta_t$. The run fails exactly when at least one step fails, i.e. on $\bigcup_{t=1}^{20}F_t$. The union bound (valid for any events, since overlaps are only ever over-counted) gives

$$\Pr(\text{run fails})=\Pr\left(\bigcup_{t=1}^{20}F_t\right)\le\sum_{t=1}^{20}\delta_t.$$

Step 2 — Solve for an equal budget. It suffices to make the right-hand side at most the allowed $\delta=0.02$. With all $\delta_t$ equal to some $\delta_{\rm step}$, the sum is $20\,\delta_{\rm step}$, so we need

$$20\,\delta_{\rm step}\le0.02 \iff\delta_{\rm step}\le\frac{0.02}{20}=0.001.$$

Choosing $\delta_t=0.001$ for every $t$ gives $\sum_t\delta_t=20(0.001)=0.02$, hence $\Pr(\text{run fails})\le0.02$ and $\Pr(\text{all safe})\ge1-0.02=0.98$. This is a sufficient allocation; dependence between steps may make it conservative.

Step 3 — Repeat with budget $0.02$ per step. Now the sum is

$$\begin{gathered} \sum_{t=1}^{20}0.02=20(0.02)=0.4,\\ \text{so}\quad\Pr(\text{all safe})\ge1-0.4=0.6. \end{gathered}$$

That is the only run-wide statement the union bound supports: a $60\%$ guarantee instead of the intended $98\%$.

Check. The bound in Step 2 is achievable, so it cannot be improved without more assumptions: if the twenty failure events are disjoint (at most one step can fail per run), each with probability exactly $0.001$, the run-failure probability is exactly $20(0.001)=0.02$. Under the different hypothesis of independence the safe probabilities would multiply; for example $0.999^{20}\approx0.98019$ and $0.98^{20}\approx0.66761$, each slightly above the corresponding union-bound value $0.98$ and $0.6$, as a lower bound must be.

Interpretation. Reusing a full run-wide budget at every step changes the guarantee. No independence assumption repairs the arithmetic of the union bound; independence would allow a different calculation if its hypotheses were justified.

Exercise 1.P6 — Medium: Compute a tail risk with an atom

The nonnegative episode cost $Z$ is 0 with probability $0.8$, 2 with probability $0.15$, and 10 with probability $0.05$. Compute its mean, $\operatorname{VaR}_{0.9}$, and $\operatorname{CVaR}_{0.9}$, using the confidence-level convention.

Review if needed: Primer C: quantiles and CVaR. Apply here: this module's explanation.

Show hint

The worst 10% contains all the cost-10 outcomes and only part of the cost-2 outcomes.

Show worked solution

Compute the mean and lower quantile first. Multiply every cost by its probability:

$$\mathbb E[Z]=0(0.8)+2(0.15)+10(0.05)=0+0.3+0.5=0.8.$$

The lower $0.9$ quantile is the smallest threshold whose cumulative probability is at least $0.9$. The cumulative probability is $0.8$ at zero and $0.8+0.15=0.95$ at two. Since $0.8\lt0.9\le0.95$, $\operatorname{VaR}_{0.9}(Z)=2$.

Average exactly the worst ten percent. The confidence-level convention means tail mass $1-0.9=0.1$. All the $0.05$ mass at cost $10$ belongs in that tail. Another $0.1-0.05=0.05$ must be taken from the cost-$2$ atom. Consequently,

$$\operatorname{CVaR}_{0.9}(Z) =\frac{0.05(10)+0.05(2)}{0.1} =\frac{0.5+0.1}{0.1}=6.$$

Verify the variational minimum, including its corners. Let $F(\nu)=\nu+10\,\mathbb E[(Z-\nu)^+]$, where $a^+=\max\{a,0\}$. At $\nu=2$, only cost $10$ gives positive excess, so $F(2)=2+10(0.05)(10-2)=2+4=6$. Expanding the hinge on each interval gives

$$F(\nu)= \begin{cases} 8-9\nu,&\nu\le0,\\ 8-\nu,&0\le\nu\le2,\\ 5+\frac12\nu,&2\le\nu\le10,\\ \nu,&\nu\ge10. \end{cases}$$

For example, on $[0,2]$ the excess expectation is $0.15(2-\nu)+0.05(10-\nu)=0.8-0.2\nu$, giving $8-\nu$; on $[2,10]$ it is only $0.05(10-\nu)$. The formulas agree at their endpoints. The objective decreases up to $\nu=2$ and increases afterward, proving the global minimum is $6$.

Averaging all outcomes with $Z\ge2$ would use probability mass $0.15+0.05=0.20$ and give $(0.3+0.5)/0.20=4$. Conditioning on $Z\gt2$ would use only $5\%$ and give $10$. Neither averages the requested worst $10\%$; splitting the atom is essential.

Exercise 1.P7 — Medium: Stability and constraints answer different questions

For $x_{t+1}=x_t/2$ with equilibrium 0, compare the constraints $C_1=[-1,1]$ and $C_2=[1,2]$. Is each set invariant? Does the system converge to 0 from $x_0=2$? Explain why convergence alone does not establish either constraint.

Review if needed: Primer D: stability and invariant sets. Apply here: this module's explanation.

Show hint

Compute the image of each interval under multiplication by $1/2$.

Show worked solution

Plan. A set $C$ is (forward) invariant when every state in $C$ is mapped back into $C$ by one update; induction then keeps the whole trajectory inside. So compute the one-step image of each interval and compare it with the interval, then solve the recursion from $x_0=2$.

Step 1 — Image of $C_1=[-1,1]$. The update map is $g(x)=x/2$, which is increasing (slope $1/2\gt0$). An increasing function maps an interval $[a,b]$ onto $[g(a),g(b)]$, so

$$g(C_1)=\left[\tfrac{-1}{2},\tfrac{1}{2}\right]=[-0.5,0.5]\subseteq[-1,1]=C_1.$$

Every state of $C_1$ therefore lands in $C_1$. If $x_t\in C_1$ then $x_{t+1}\in C_1$; with $x_0\in C_1$ as base case, induction gives $x_t\in C_1$ for all $t$. So $C_1$ is invariant.

Step 2 — Image of $C_2=[1,2]$. By the same reasoning,

$$g(C_2)=\left[\tfrac12,\tfrac22\right]=[0.5,1].$$

This is not a subset of $[1,2]$: for example $g(1)=0.5\lt1$. Concretely, $x_0=1\in C_2$ gives $x_1=0.5\notin C_2$, so the state leaves at the first step. $C_2$ is not invariant. (In fact every $x\in[1,2)$ is mapped into $[0.5,1)$, outside $C_2$; only $x=2\mapsto1$ stays. One counterexample already suffices.)

Step 3 — Solve the recursion from $x_0=2$. Each step halves the state, so after $t$ steps $x_t=2\cdot(1/2)^t=2^{1-t}$. Check by induction: $x_0=2^{1}=2$, and if $x_t=2^{1-t}$ then $x_{t+1}=2^{1-t}/2=2^{1-(t+1)}$. Since $0\lt1/2\lt1$, $(1/2)^t\to0$, hence $x_t\to0$: the system converges. The first values are

$$x_0=2,\quad x_1=1,\quad x_2=0.5,\quad x_3=0.25,\ \ldots$$

Step 4 — Compare convergence with each constraint. For $C_1$: $x_0=2\gt1$, so the trajectory violates $C_1$ already at $t=0$, even though it converges. For $C_2$: $x_0=2$ and $x_1=1$ lie in $[1,2]$, but $x_2=0.5\lt1$, so the trajectory leaves $C_2$ at $t=2$ and never returns (all later values are below $0.5$).

Check. The equilibrium $0$ lies in $C_1$ but not in $C_2$. That is consistent with the results: a converging trajectory must eventually leave any closed set that does not contain its limit, and $C_2$ is such a set.

Interpretation. Stability concerns behavior near an equilibrium; a state constraint concerns a specified set. They coincide only when an additional invariant-set argument connects them.

Exercise 1.P8 — Medium: A robustness radius in numbers

A classifier has logit margin $M(x)=0.6$ and its vector of logits is $L$-Lipschitz in Euclidean norm with $L=2$. Compute the certified radius $M(x)/(\sqrt2L)$. Are perturbation norms $0.2$ and $0.22$ certified? What does failure to certify mean?

Review if needed: Primer A: norms and Cauchy–Schwarz. Apply here: this module's explanation.

Show hint

Evaluate the radius, and remember that the theorem uses a strict inequality.

Show worked solution

Plan. Recall why the radius formula holds (each logit gap can shrink by at most $\sqrt2L\|\delta\|_2$), evaluate it, and then evaluate the guaranteed remaining gap for each perturbation size.

Step 1 — Why the formula applies. Let $c$ be the predicted class and $d_j=\varphi_c-\varphi_j$ the gap to a competitor $j\ne c$. As derived on this page, $d_j=(e_c-e_j)^{\top}\varphi$, and Cauchy–Schwarz with $\|e_c-e_j\|_2=\sqrt2$ and the $L$-Lipschitz bound give $|d_j(x+\delta)-d_j(x)|\le\sqrt2L\|\delta\|_2$. A number can fall below another by at most the size of their difference, so $d_j(x+\delta)\ge d_j(x)-|d_j(x+\delta)-d_j(x)|$. The margin is the smallest gap, so $d_j(x)\ge M(x)$. Chaining these,

$$\begin{aligned} d_j(x+\delta)&\ge d_j(x)-\sqrt2L\|\delta\|_2\\ &\ge M(x)-\sqrt2L\|\delta\|_2\qquad\text{for every }j\ne c. \end{aligned}$$

The label is kept whenever the right-hand side is strictly positive, i.e. whenever $\|\delta\|_2\lt M(x)/(\sqrt2L)$. The hypotheses hold here: the logits are $L$-Lipschitz in the Euclidean norm with $L=2$, and the margin $M(x)=0.6$ is positive.

Step 2 — Evaluate the radius. With $\sqrt2L=2\sqrt2\approx2.828427$,

$$r=\frac{M(x)}{\sqrt2L}=\frac{0.6}{2\sqrt2}=\frac{0.3}{\sqrt2}=\frac{0.3\sqrt2}{2}\approx0.212132.$$

Step 3 — Test $\|\delta\|_2=0.2$. Since $0.2\lt0.212132$, it is inside the radius. Directly, the guaranteed gap is

$$0.6-2\sqrt2(0.2)\approx0.6-0.565685=0.034315\gt0,$$

so every competitor stays strictly below class $c$: perturbations of norm $0.2$ are certified.

Step 4 — Test $\|\delta\|_2=0.22$. Since $0.22\gt0.212132$, it is outside the radius. The same lower bound becomes

$$0.6-2\sqrt2(0.22)\approx0.6-0.622254=-0.022254\lt0,$$

which no longer proves anything about the sign of the gap: norm $0.22$ is not certified. At the radius itself the lower bound on a competing logit gap is exactly zero, so the strict-label guarantee does not include the boundary.

Step 5 — What failure to certify means. A negative lower bound is not a negative gap. Outside the radius, a label change is possible under the bound but not proved to happen; the actual network may well keep its label. The certificate is a sufficient condition only.

Check. Units and scaling: doubling $L$ halves the radius and doubling the margin doubles it, as the formula $M/(\sqrt2L)$ requires; and plugging $\|\delta\|_2=r$ into Step 1 gives $0.6-2\sqrt2\cdot0.3/\sqrt2=0.6-0.6=0$.

Interpretation. The certificate describes the classifier at this input; obtaining a guarantee for the controlled system still requires connecting prediction error to the system dynamics.

Hard — Explain why the argument works and where it stops.

Exercise 1.P9 — Hard: Negate the viability quantifiers

In a deterministic system, state $x$ is viable when there exists an admissible controller $u$ such that for all times $t$, the trajectory $\varphi_x^u(t)$ avoids the failure set $X_F$. Negate this statement. Explain why “some controller eventually fails” is not its negation.

Review if needed: Primer 0: quantifiers and negation. Apply here: this module's explanation.

Show hint

Negating an existential quantifier gives a universal one, and vice versa.

Show worked solution

Plan. Write the definition with explicit quantifiers, push the negation inward one quantifier at a time using the two negation rules, then compare with the formula for “some controller eventually fails” and give a concrete case where they differ.

Step 1 — Formalize viability. Ranging $u$ over admissible controllers and $t$ over times,

$$\text{viable}(x)\iff\exists u\ \forall t:\ \varphi_x^u(t)\notin X_F.$$

Step 2 — Recall the negation rules. “It is not true that some object has property $P$” means “every object fails $P$”, and “it is not true that every object has $P$” means “some object fails $P$”:

$$\begin{gathered} \neg\,\exists u\,P(u)\iff\forall u\,\neg P(u),\\ \neg\,\forall t\,Q(t)\iff\exists t\,\neg Q(t). \end{gathered}$$

Step 3 — Negate one quantifier at a time. Apply the first rule with $P(u)$ the statement “$\forall t:\varphi_x^u(t)\notin X_F$”, then the second rule inside it, then negate the atomic statement:

$$\begin{aligned} \neg\,\text{viable}(x) &\iff\forall u\ \neg\big(\forall t:\varphi_x^u(t)\notin X_F\big)\\ &\iff\forall u\ \exists t:\ \neg\big(\varphi_x^u(t)\notin X_F\big)\\ &\iff\forall u\ \exists t:\ \varphi_x^u(t)\in X_F. \end{aligned}$$

In words: every admissible controller eventually fails. Because $\exists t$ comes after $\forall u$, the failure time is allowed to depend on the controller.

Step 4 — Formalize the tempting alternative. “Some controller eventually fails” is

$$\exists u\ \exists t:\ \varphi_x^u(t)\in X_F.$$

Only the outer quantifier differs from Step 3: $\exists u$ instead of $\forall u$.

Step 5 — Show the two statements are not equivalent. Take a car at a state $x$ in front of a wall $X_F$. Controller $u_1$ accelerates and hits the wall at some time $t_1$; controller $u_2$ brakes and stops before the wall forever. Then $u_2$ witnesses $\exists u\,\forall t:\varphi_x^u(t)\notin X_F$, so $x$ is viable, while $u_1$ witnesses $\exists u\,\exists t:\varphi_x^u(t)\in X_F$. Both statements are true at once, so the second cannot be the negation of the first (a statement and its negation are never simultaneously true).

Check. The statement of Step 3 does imply that of Step 4 whenever at least one admissible controller exists, since a property of all controllers holds for some controller. The converse fails, as Step 5 shows. So “some controller fails” is strictly weaker than non-viability.

Interpretation. Viability asks whether at least one safe continuation exists, rather than whether all available behaviors are safe.

Exercise 1.P10 — Hard: Why a discounted budget can hide certain failure

A deterministic trajectory is safe until time 50 and unsafe at every integer time $t\ge50$. With discount $\gamma=0.9$ and indicator cost $c_t$, compute $\sum_{t\ge0}\gamma^tc_t$. Does it pass budget $0.1$? What is the probability of eventual failure?

Review if needed: Primer 0: geometric series. Apply here: this module's explanation.

Show hint

Factor out $\gamma^{50}$ and sum the remaining geometric series.

Show worked solution

Write the indicator costs explicitly. The trajectory is safe for $t\lt50$, so $c_t=0$ there. It is unsafe for every integer $t\ge50$, so $c_t=1$ at all those times. The discounted cost is

$$\begin{aligned} \sum_{t\ge0}0.9^t c_t &=\sum_{t=50}^{\infty}0.9^t\\ &=0.9^{50}(1+0.9+0.9^2+\cdots)\\ &=\frac{0.9^{50}}{1-0.9} =\frac{0.005153775207\ldots}{0.1} \approx0.051537752. \end{aligned}$$

The geometric series converges because $0\lt0.9\lt1$. Its sum is $1/(1-0.9)=10$, obtained by subtracting $0.9$ times the series from the series itself. Since $0.051537752\lt0.1$, the discounted-cost budget passes.

Assess the different event. The event “failure occurs at some time” is certain: this deterministic trajectory first becomes unsafe at time $50$. Its probability is therefore $1$. A small weight $0.9^{50}$ makes the late violations cheap in the objective; it does not make them unlikely.

The undiscounted unsafe-step count is infinite, and an infinite-horizon joint chance requirement with any failure budget below $1$ rejects this behavior. The horizon, discount convention and constrained quantity must all remain attached to the reported guarantee.

Exercise 1.P11 — Hard: A finite experiment is not an invariant-set proof

Consider $x_{t+1}=x_t+0.01$ from $x_0=0$, with safe set $C=(-\infty,1]$. An experiment checks only times 0 through 100 and sees no violation. Determine the first violating time. State exactly what the experiment establishes and what an invariance claim would additionally require.

Review if needed: Primer D: trajectories and state updates. Apply here: this module's explanation.

Show hint

Unroll the recurrence, paying attention to whether the boundary is safe.

Show worked solution

Plan. Unroll the recursion into a closed formula, prove it by induction, solve the inequality $x_t\gt1$ for the first integer $t$, and then compare what was checked with what invariance demands.

Step 1 — Guess the closed form. Each step adds $0.01$ to the previous state, starting from $0$: $x_1=0.01$, $x_2=0.02$, $x_3=0.03$. After $t$ steps, $t$ increments have been added, suggesting $x_t=0.01t$.

Step 2 — Prove it by induction. Base case: $x_0=0=0.01\cdot0$. Inductive step: if $x_t=0.01t$, then

$$x_{t+1}=x_t+0.01=0.01t+0.01=0.01(t+1).$$

Hence $x_t=0.01t$ for every integer $t\ge0$.

Step 3 — Find the first violating time. The safe set $C=(-\infty,1]$ includes its boundary $1$, so a violation means $x_t\gt1$:

$$0.01t\gt1\iff t\gt100.$$

The smallest integer strictly greater than $100$ is $101$. Checking the neighbours: $x_{100}=0.01(100)=1\in C$ (on the boundary, still safe) and $x_{101}=0.01(101)=1.01\notin C$. Therefore the first violation is at time $101$.

Step 4 — What the experiment establishes. It checked $t=0,\ldots,100$, and Step 3 confirms $x_t=0.01t\le1$ for all of these. So it establishes safety of this one trajectory over the finite checked horizon, under the experiment's model and conditions, and nothing about $t\ge101$.

Step 5 — What invariance would require. Forward invariance of $C$ means: for every initial state in $C$, the state remains in $C$ for all subsequent times. Equivalently (by induction), every $x\in C$ must satisfy $x+0.01\in C$. This fails at $x=1\in C$, whose successor is $1.01\notin C$. So $C$ is not invariant, and no finite experiment could have shown that it is.

Check. The answer is consistent with the boundary convention: had the safe set been the open interval $(-\infty,1)$, the first violation would be at $t=100$ instead, since then $x_{100}=1$ would already be unsafe.

Interpretation. Even exact measurements of many safe finite trajectories cannot replace the missing universal argument.

Exercise 1.P12 — Hard: Prove a robust invariant interval

For $x_{t+1}=0.5x_t+w_t$ with every disturbance satisfying $|w_t|\le0.1$, find the smallest radius $r\ge0$ such that $[-r,r]$ is robustly invariant. Give the induction argument, including its base case.

Review if needed: Primer A: triangle inequality. Apply here: this module's explanation.

Show hint

The worst successor magnitude is $0.5r+0.1$. Require this to be at most $r$.

Show worked solution

Plan. $[-r,r]$ is robustly invariant when every state in it, under every allowed disturbance, is mapped back into it. Bound the worst successor from above (sufficiency), show the bound is actually reached (necessity), solve for $r$, and finish with induction.

Step 1 — Upper bound on the successor (sufficiency). Suppose $|x_t|\le r$ and $|w_t|\le0.1$. The triangle inequality $|a+b|\le|a|+|b|$ and $|0.5x_t|=0.5|x_t|$ give

$$|x_{t+1}|=|0.5x_t+w_t|\le0.5|x_t|+|w_t|\le0.5r+0.1.$$

So if $0.5r+0.1\le r$, every successor lies in $[-r,r]$.

Step 2 — The bound is attained (necessity). Choose the admissible pair $x_t=r$ and $w_t=0.1$. Then $x_{t+1}=0.5r+0.1$ exactly. If $0.5r+0.1\gt r$, this successor leaves $[-r,r]$, so the interval is not robustly invariant. Hence the condition of Step 1 is not only sufficient but also necessary.

Step 3 — Solve for $r$.

$$0.5r+0.1\le r\iff0.1\le r-0.5r=0.5r\iff r\ge\frac{0.1}{0.5}=0.2.$$

The admissible radii are exactly $r\ge0.2$, so the smallest is $r=0.2$.

Step 4 — Induction argument for $r=0.2$. Base case: assume the initial state satisfies $|x_0|\le0.2$. Inductive step: if $|x_t|\le0.2$, Step 1 gives $|x_{t+1}|\le0.5(0.2)+0.1=0.2$. Hence $|x_t|\le0.2$ for every $t\ge0$ and every allowed disturbance sequence, because the inductive step used only $|w_t|\le0.1$, not any particular value of $w_t$.

Check. At the boundary $r=0.2$ the worst successor is exactly $0.5(0.2)+0.1=0.2$, so it touches but does not leave. For a slightly smaller radius, say $r=0.19$, the worst successor is $0.5(0.19)+0.1=0.195\gt0.19$, confirming that $0.2$ cannot be lowered. The answer is also the fixed point of the worst-case map $r\mapsto0.5r+0.1$.

Interpretation. The contraction by $0.5$ removes half the current size each step while the disturbance can add $0.1$; the two balance at $0.2$. The result is deterministic under the stated disturbance bound; no distribution or confidence parameter is involved.

Further practice — Original problems and research connections

The original exercises below retain their numbering. Some compare later methods or ask for longer research derivations; use the graded set above first, and return to a research-connection problem after reading the relevant linked module.

Exercise 1.1 — Classify the safety statements

Assign each statement to a formalisation (a)–(g) of Section 1 and name its guarantee type (Section 3).
1. "The quadrotor remains inside the flight cage in at least 99% of test flights."
2. "Over training, the average number of hazard contacts per episode must not exceed 25."
3. "No admissible wind gust ($\|w\|\le2$ m/s) may push the drone outside the cage."
4. "The average cost of the 5% worst episodes stays below 10."
5. "From every initial condition in the certified set the tracking error converges to zero."
6. "The perception network's output changes by at most 0.3 for any input perturbation of $\ell_2$-norm at most 0.1."
7. "From the current state some control sequence avoids the obstacle forever."
8. "With probability at least $1-\delta$ over the measurement noise, every controller SafeOpt evaluates satisfies $f(x_t)\ge h$."

Read the percentages and averages as claims about the underlying trajectory distribution. If they only summarize observed episodes they are empirical statistics, and turning them into an expected-cost or chance guarantee needs a sampling model and an uncertainty bound.

Show answer

Use the formalisation to name what is constrained, then separately name the guarantee's strength and randomness. As stipulated, the percentages and averages concern the underlying distribution; a raw observed percentage would need a sampling model and an uncertainty bound before receiving the same interpretation.

  1. 99% of flights stay inside: (b), a joint chance constraint. A flight succeeds only if every relevant time in that flight is safe, so the failure event is “outside at least once” and its budget is $\delta=0.01$. The guarantee is probabilistic over the stated flight distribution. The sentence alone does not specify which factors generate that distribution; process noise, initial conditions and policy randomization must be identified in an application. It does not promise every flight succeeds.

  2. Average hazard contacts at most 25: (c), an expected-cost constraint. The episode's contact count is the random cost, and $d=25$ is its mean budget. The strength is in expectation over training episodes. As stated, an average over training does not provide a separate bound at every policy iteration or for every episode. If the count is undiscounted, that convention must be retained rather than silently converted into a discounted return.

  3. No admissible gust causes escape: (a), a hard robust constraint. The statement quantifies over every allowed disturbance in $W=\{w:\|w\|\le2\text{ m/s}\}$. Its guarantee is deterministic under the model and disturbance assumptions, for the initial conditions and horizon covered by the claim. An invariance proof would connect those conditions to remaining in the cage at every later time; no probability distribution on gusts is needed.

  4. Worst 5% average below 10: (d), a CVaR constraint. In the page's confidence-level convention, $1-\alpha=0.05$ means $\alpha=0.95$ and the budget is $10$. This is a tail expectation of episode cost, including a partial probability atom if necessary. It is neither a maximum-cost bound nor the ordinary whole-distribution mean.

  5. Tracking error converges to zero: (e), a region-of-attraction statement. Every initial point in the certified set is attracted to the zero-error equilibrium, under the stated closed-loop model. The guarantee is asymptotic convergence, deterministic if the model certificate is deterministic. Convergence alone is attractivity; asymptotic stability additionally requires Lyapunov stability, meaning that sufficiently close starts stay close. A suitable positive-level Lyapunov sublevel certificate supplies that extra property. The sentence also needs a separate containment argument to imply physical state constraints.

  6. Output moves at most 0.3 on a radius-0.1 input ball: (f), robustness of a learned model. This is a deterministic output-deviation certificate for the specified perturbations. A global Lipschitz bound $L\le3$ would imply it because $L(0.1)\le0.3$. The converse fails: the scalar map $z\mapsto\operatorname{clip}(30z,-0.15,0.15)$ has output range of width $0.3$, so any two outputs differ by at most $0.3$, yet its slope near zero is $30$. A bounded deviation on one ball does not establish a global Lipschitz constant of $3$ or closed-loop safety.

  7. Some control avoids the obstacle forever: (g), viability. This says the current state lies in $X_V$: there exists at least one admissible safe continuation for all times, including the initial time. It is an existence statement in the deterministic model. Other controls can still fail; robust viability in the presence of adversarial disturbances would require additional disturbance quantifiers and a causal controller.

  8. Every SafeOpt query is safe with probability at least $1-\delta$: (b), a joint high-probability learning guarantee. Here the randomness is explicitly the measurement-noise sequence used by the learner, with the unknown target function fixed in the frequentist reading. One event of probability at least $1-\delta$ covers all query times together. The protected object is $f(x_t)\ge h$ at every evaluated controller parameter; $x_t$ here labels a query, rather than necessarily a plant state. The guarantee acts during learning and differs from a separate per-query confidence statement or a probability over deployment noise.

Exercise 1.2 — CVaR by hand

Ten episodes have signed maximum excursions $Z\in\{-0.6,-0.5,-0.4,-0.3,-0.2,-0.1,0,0.2,0.5,1.5\}$, each with probability $0.1$ (positive means the boundary was crossed). Compute $\mathbb E[Z]$, $\mathbb P(Z\gt0)$, $\operatorname{VaR}_\alpha(Z)$ and $\operatorname{CVaR}_\alpha(Z)$ for $\alpha=0.75$ and $\alpha=0.9$, once as a tail average and once from the Rockafellar–Uryasev formula. Which of the verdicts (mean excursion with budget $\mathbb E[Z]\le0.05$, chance with $\delta=0.2$, CVaR $\le0$, hard) call this behaviour safe?

Show answer

Compute the mean and the failure event. There are ten equally likely outcomes. The negative excursions add to $-(0.6+0.5+0.4+0.3+0.2+0.1)=-2.1$; the positive ones add to $0.2+0.5+1.5=2.2$, and zero contributes nothing. Thus

$$\mathbb E[Z]=\frac{-2.1+2.2}{10}=0.01,\qquad \Pr(Z\gt0)=0.1+0.1+0.1=0.3.$$

Equality $Z=0$ is safe because failure requires a strictly positive excursion.

At confidence level $\alpha=0.9$. The cumulative probability at $0.2$ is $0.8$, and at $0.5$ it is $0.9$. Therefore the lower quantile $\inf\{z:\Pr(Z\le z)\ge0.9\}$ is $\operatorname{VaR}_{0.9}=0.5$. The worst $10\%$ is exactly the atom at $1.5$, so the tail average is $1.5$.

For the variational formula $F_\alpha(\nu)=\nu+\mathbb E[(Z-\nu)^+]/(1-\alpha)$, choose $\nu=0.5$. Only the $1.5$ outcome has positive excess, and

$$F_{0.9}(0.5)=0.5+\frac{0.1(1.5-0.5)}{0.1} =0.5+1=1.5.$$

At confidence level $\alpha=0.75$. The cumulative probabilities at zero and at $0.2$ are $0.7$ and $0.8$. Since $0.7\lt0.75\le0.8$, $\operatorname{VaR}_{0.75}=0.2$. The tail mass is $0.25$. Include the entire $0.1$ atoms at $1.5$ and $0.5$, then another $0.25-0.2=0.05$ from the atom at $0.2$:

$$\operatorname{CVaR}_{0.75} =\frac{0.1(1.5)+0.1(0.5)+0.05(0.2)}{0.25} =\frac{0.15+0.05+0.01}{0.25} =\frac{0.21}{0.25}=0.84.$$

At $\nu=0.2$, the two strictly larger outcomes give excesses $0.3$ and $1.3$. Therefore

$$F_{0.75}(0.2) =0.2+\frac{0.1(0.5-0.2)+0.1(1.5-0.2)}{0.25} =0.2+\frac{0.03+0.13}{0.25} =0.2+0.64=0.84.$$

Why these substitutions minimize the formula. Each hinge $(Z-\nu)^+$ is convex in $\nu$, hence so is $F_\alpha$. As $\nu$ increases, an outcome strictly above it contributes derivative $-1$ inside the expectation, while an outcome below it contributes zero. At an atom, the one-sided derivatives are

$$F_{\alpha,-}'(\nu)=1-\frac{\Pr(Z\ge\nu)}{1-\alpha},\qquad F_{\alpha,+}'(\nu)=1-\frac{\Pr(Z\gt\nu)}{1-\alpha}.$$

At $\nu=0.5$, $\Pr(Z\ge0.5)=0.2$ and $\Pr(Z\gt0.5)=0.1$, so for $\alpha=0.9$ the derivatives are $-1$ and $0$. At $\nu=0.2$, these probabilities are $0.3$ and $0.2$, so for $\alpha=0.75$ the derivatives are $1-0.3/0.25=-0.2$ and $1-0.2/0.25=0.2$. In both cases the left derivative is nonpositive and the right derivative nonnegative; convexity therefore proves a global minimum. At level $0.9$, any $\nu$ between $0.5$ and $1.5$ also minimizes, although the lower VaR convention selects $0.5$.

Read all four verdicts. The mean-excursion constraint accepts because $0.01\le0.05$. The chance constraint rejects because $0.3\gt0.2$. Both CVaR constraints reject because $0.84\gt0$ and $1.5\gt0$. The hard view rejects because the maximum excursion is $1.5\gt0$. Only the mean accepts; negative excursions offset positive ones in that signed average. This is a CMDP-style average on the specified $Z$, rather than an unsafe-step indicator cost, and it is not a statement that every episode stays safe.

Exercise 1.3 — An expected-cost constraint does not bound the violation probability

Let $c_t=\mathbf 1\{x_t\notin C\}$, $N=\sum_{t=0}^{T}c_t$ and $E=\{N\ge1\}$. (i) Prove $\mathbb P(E)\le\mathbb E[N]$ and show the bound is tight. (ii) For any $d\ge1$, construct a trajectory distribution with $\mathbb E[N]\le d$ and $\mathbb P(E)=1$. (iii) With the discounted cost $J_c^\gamma=\mathbb E[\sum_{t\ge0}\gamma^tc_t]$ and infinite horizon, with $0<\gamma<1$ and $E$ now meaning eventual failure, construct for every $d\gt0$ a policy with $J_c^\gamma\le d$ and $\mathbb P(E)=1$. (iv) Show conversely that $\mathbb P(E)\le\delta$ only gives $\mathbb E[N]\le(T+1)\delta$, and that this is tight.

Show answer

(i) Bound failure by the unsafe-step count. The finite-horizon count $N=\sum_{t=0}^{T}c_t$ is a nonnegative integer. If no failure occurs, $N=0$ and $\mathbf1_E=0$; if some failure occurs, $N\ge1$ and $\mathbf1_E=1$. Thus $N\ge\mathbf1_E$ on every trajectory. Taking expectations gives

$$\mathbb E[N]\ge\mathbb E[\mathbf1_E]=\Pr(E).$$

This is Markov's inequality at threshold one. It is tight: with probability $p$, violate at exactly one monitored time, and with probability $1-p$, never violate. Then $N$ equals one or zero, respectively, so $\mathbb E[N]=p=\Pr(E)$ for any $0\le p\le1$.

(ii) A budget at least one can permit certain failure. Let every episode violate at exactly one monitored step. Then $N=1$ surely, so $\mathbb E[N]=1\le d$ for every $d\ge1$, while $\Pr(E)=1$. Randomizing the time of that single violation does not change either quantity. The expected count budget therefore yields no nontrivial failure-probability bound in this range.

(iii) Delay a certain persistent failure to defeat every positive discounted budget. Consider a model with a safe state and an absorbing failure state. A controller can remain in the safe state for a chosen number of steps, then move to the failure state. Choose its first unsafe time $t_0\ge1$. Its costs are $c_t=0$ for $t\lt t_0$ and $c_t=1$ for $t\ge t_0$, without randomness. Consequently,

$$J_c^\gamma =\sum_{t=t_0}^{\infty}\gamma^t =\gamma^{t_0}\sum_{j=0}^{\infty}\gamma^j =\frac{\gamma^{t_0}}{1-\gamma}.$$

Because $0\lt\gamma\lt1$, this tends to zero as $t_0$ increases. If $d(1-\gamma)\lt1$, taking logarithms of $\gamma^{t_0}\le d(1-\gamma)$ gives $t_0\log\gamma\le\log(d(1-\gamma))$. Dividing by $\log\gamma\lt0$ reverses the inequality. A sufficient integer choice for every $d\gt0$ is therefore

$$t_0=\max\left\{1,\ \left\lceil\frac{\log(d(1-\gamma))}{\log\gamma}\right\rceil\right\}.$$

If $d(1-\gamma)\ge1$, any $t_0\ge1$ already works since $\gamma^{t_0}\le1$. With this choice the cost budget passes, but $\Pr(E)=1$ because failure is certain at the finite time $t_0$. This constructs a counterexample model and policy; it does not claim every fixed physical system permits arbitrary postponement. Discounted failure penalties face the same late-failure issue discussed in Module 7.

The positive-budget qualification matters. If $J_c^\gamma=0$, all terms are nonnegative with strictly positive weights. Each $\Pr(c_t=1)$ must then be zero, and the countable union bound gives zero probability of eventual failure. The counterexample requires $d\gt0$.

(iv) Convert a joint chance budget into a count budget. There are $T+1$ monitored times because the sum includes $t=0$. On $E^c$ the count is zero, and on $E$ it is at most $T+1$. Thus $N\le(T+1)\mathbf1_E$ pointwise, giving

$$\mathbb E[N]\le(T+1)\Pr(E)\le(T+1)\delta.$$

Tightness is achieved by a distribution that violates at every monitored time with probability $\delta$ and never violates otherwise. Its expected count is $(T+1)\delta$, and its probability of any violation is $\delta$.

For an infinite discounted horizon, the corresponding pointwise bound is $\sum_{t\ge0}\gamma^tc_t\le\mathbf1_E/(1-\gamma)$, so $\Pr(E)\le\delta$ implies $J_c^\gamma\le\delta/(1-\gamma)$. These arguments use no independence assumption. Indicator costs count unsafe times; they contain no information about violation magnitude, which requires a different loss such as the excursion in the CVaR exercise.

Exercise 1.4 — What a SafeOpt guarantee needs versus what a CBF guarantee needs

List the assumptions behind SafeOpt's Theorem 1 and behind the ZCBF invariance theorem. For each say (i) whether the guarantee is deterministic or probabilistic and over what, (ii) whether it protects the learning phase, (iii) which assumptions an engineer can check and what happens when one silently fails.

Show answer

SafeOpt needs a finite $D$; $f$ $L$-Lipschitz for a known $L$; $\|f\|_k^2\le B$ for a known kernel and known $B$; noise zero-mean given the past and bounded by $\sigma_0$, with the GP posterior (and $\gamma_t$) computed for likelihood variance $\lambda=\sigma_0^2$ or larger; a non-empty safe seed $S_0$ with $f\ge h$; $\beta_t=2B+300\gamma_t\log^3(t/\delta)$. It gives, with probability $\ge1-\delta$ over the noise and jointly for all $t$, $f(x_t)\ge h$ at every query, with a separate finite-sample optimality result previewed in Module 4. It protects the learning phase: exploration never leaves the certified set. Checkable: $S_0$ (a conservative controller), $L$ (physical rate limits, plausibly), the noise bound (a justified sensor specification; finite sensor data alone cannot prove it). Difficult to justify for an unknown $f$: $B$ and the kernel. Too small a $B$, or a heuristic constant in place of $\beta_t$, can produce intervals that are too narrow and admit unsafe points. Fiedler et al. (2024, Table 1) report 3.95% unsafe runs on average (28.62% worst) with $\beta\equiv2$, and 0.859% (13.38% worst) for Real-$\beta$-SafeOpt using their data-dependent formula (7) in arXiv v1, with a norm bound $\|f\|_k\le2.5$ against a true norm of $10$. Too small an $L$ can wrongly certify unevaluated points; if an unsafe seed point is selected at $t=1$, that first query violates safety. LoSBO drops $B$ and the kernel (safety from $L$ and a noise bound $E$ alone) and is exactly the "checkable assumptions" repair.

ZCBF needs known control-affine $f,g$, locally Lipschitz; a $C^1$ function $h$ with $C=\{h\ge0\}\subseteq D$, where $D$ is an open ambient neighbourhood of $C$ for the stated locally Lipschitz closed loop; for a boundary-only check, $0$ must additionally be a regular value of $h$ (with an open $D$ the inequality on $D$ already excludes leaving $C$; a check on $\partial C$ alone, Nagumo's condition, needs $\nabla h\ne0$ on $\partial C$; with neither, $h=-x^3$ on $D=C=(-\infty,0]$ with $\dot x=1$ satisfies the inequality and still leaves $C$); an extended class-$\mathcal K$ $\alpha$ with $\sup_u[L_fh+L_ghu+\alpha(h)]\ge0$ on $D$, feasible inputs $K_{\rm zcbf}(x)\ne\emptyset$ (automatic for $U=\mathbb R^m$, a closed polyhedron or a compact $U$; for an open $U$ a zero supremum need not be attained, see the theorem in Section 3); a Lipschitz continuous controller $u:D\to U$ with values in $K_{\rm zcbf}(x)$. It gives deterministic forward invariance of $C$ from every $x_0\in C$, no probability at all, on the maximal interval of existence of the closed-loop solution (for all $t\ge0$ when the closed loop is forward complete, e.g. for compact $C$), for the deployed controller and equally for a learning policy filtered through the CBF-QP (so it protects learning whenever the filter is active). Checkable: the structure of $h$ and $\alpha$ and the regular-value condition (by construction); the barrier inequality with $K_{\rm zcbf}(x)\ne\emptyset$ on all of $D$ (analytically, by an SOS certificate, or by gridding plus Lipschitz bounds with a margin that covers the space between grid points; a plain grid check certifies only the grid points); Lipschitz continuity of the QP solution (regularity conditions in Ames et al. 2017). Not directly checkable: the model. If $f,g$ are wrong, $\dot h$ is mis-evaluated and $C$ can be left; the repair is a robust or input-to-state-safe CBF with an uncertainty margin, or a learned residual with a GP bound, which re-imports SafeOpt's kind of assumptions (Module 10).

Background — SOS certificates and grid margins

An SOS certificate writes a polynomial as a sum of squared polynomials, which proves it is nonnegative; certifying only a constrained domain requires additional domain conditions. For a grid argument, suppose every state $x$ is within distance $r$ of some grid point $x_i$ and the residual $b(x)$ of the inequality to be certified (for example the barrier inequality, $b\ge0$ wanted) is $L_b$-Lipschitz. If every grid value satisfies $b(x_i)\ge L_b r$, then $b(x)\ge b(x_i)-L_b\|x-x_i\|\ge L_br-L_br=0$ throughout the domain. Checking only $b(x_i)\ge0$ is insufficient.

For example, $x^4+2x^2+1=(x^2+1)^2\ge0$. With grid radius $r=0.1$ and residual Lipschitz bound $L_b=2$, every grid residual must be at least $0.2$ to certify the intervening states.

Summary: SafeOpt buys "no model needed" with statistical and function-class assumptions that can be difficult to justify for an unknown target; the CBF buys a deterministic guarantee with a model assumption engineers are used to quantifying. LoSBO and rigorous GP bounds on one side, learned residuals with bounds on the other, meet in the middle.

Exercise 1.5 — Exact expected violations for the explorer's system

For $x_{t+1}=x_t-k(x_t-x_{\rm goal})+\sigma w_t$, $w_t\sim\mathcal N(0,1)$ i.i.d., $x_0=0$, $0\lt k\lt2$: (i) derive the mean $m_t$ and variance $v_t$ of $x_t$ and the stationary variance; (ii) give the exact expected number of violating steps $\mathbb E[N]=\sum_{t=1}^T\mathbb P(x_t\gt1)$; (iii) evaluate it for $k=0.5$, $\sigma=0.1$, $T=40$, $x_{\rm goal}=0.8$ and compare with the Markov bound on the violation probability.

Show answer

(i) Center the recursion at its goal. Let $e_t=x_t-x_{\rm goal}$ and $a=1-k$. Subtract the goal from the update to obtain $e_{t+1}=ae_t+\sigma w_t$, with $e_0=-x_{\rm goal}$. The condition $0\lt k\lt2$ is exactly $|a|\lt1$. The first two substitutions are $e_1=ae_0+\sigma w_0$ and $e_2=a^2e_0+\sigma(aw_0+w_1)$; continuing gives

$$e_t=a^te_0+\sigma\sum_{j=0}^{t-1}a^{t-1-j}w_j.$$

Each noise has mean zero and variance one. Thus the deterministic initial term supplies the mean, while independence makes every cross-covariance of different noises zero. It follows that

$$m_t=\mathbb E[x_t]=x_{\rm goal}(1-a^t),\qquad v_t=\operatorname{Var}(x_t)=\sigma^2\sum_{j=0}^{t-1}a^{2(t-1-j)} =\sigma^2\sum_{i=0}^{t-1}a^{2i}.$$

Use the finite geometric sum with ratio $a^2\lt1$. Since $1-a^2=1-(1-k)^2=2k-k^2=k(2-k)\gt0$,

$$v_t=\sigma^2\frac{1-(1-k)^{2t}}{k(2-k)} \ \longrightarrow\ \sigma_\infty^2=\frac{\sigma^2}{k(2-k)},\qquad m_t\longrightarrow x_{\rm goal}.$$

This is also the stationary variance: substituting a Gaussian state of mean $x_{\rm goal}$ and variance $v$ into one update gives variance $a^2v+\sigma^2$, which equals $v$ exactly when $v=\sigma^2/(1-a^2)$. With $\sigma\gt0$, convergence of the distribution to that stationary Gaussian does not mean individual noisy trajectories settle at the goal.

(ii) Add the marginal failure probabilities. A linear combination of independent Gaussians is Gaussian, so $x_t\sim\mathcal N(m_t,v_t)$ exactly. If $v_t\gt0$, standardization gives

$$p_t:=\Pr(x_t\gt1) =\Pr\left(\frac{x_t-m_t}{\sqrt{v_t}}\gt\frac{1-m_t}{\sqrt{v_t}}\right) =Q\left(\frac{1-m_t}{\sqrt{v_t}}\right),\qquad Q(z)=1-\Phi(z).$$

Here $\Phi$ is the standard-normal cumulative distribution. Writing the unsafe count as a sum of indicators and using linearity of expectation,

$$N=\sum_{t=1}^{T}\mathbf1\{x_t\gt1\},\qquad \mathbb E[N]=\sum_{t=1}^{T}p_t =\sum_{t=1}^{T}Q\left(\frac{1-m_t}{\sqrt{v_t}}\right).$$

Time zero is excluded because $x_0=0$ is safe. No independence between the states is needed for this sum. If $\sigma=0$, then $v_t=0$ and standardization is invalid: instead use $p_t=\mathbf1\{m_t\gt1\}$, with equality $m_t=1$ safe.

Evaluate small tails without subtractive cancellation. Use $Q(z)=\tfrac12\operatorname{erfc}(z/\sqrt2)$, where $\operatorname{erfc}(u)=\tfrac{2}{\sqrt\pi}\int_u^\infty e^{-s^2}\,ds$. The substitution $r=\sqrt2s$ in the normal-tail integral yields this identity. In floating-point arithmetic, $\Phi(z)$ may round to $1$ for large positive $z$, so $1-\Phi(z)$ can become a false zero. Direct upper-tail evaluation avoids that subtraction, though sufficiently extreme tails can still underflow and require stronger numerical methods. For $\sigma\gt0$ every true finite-threshold Gaussian tail is strictly positive; a displayed rounded zero cannot certify a zero cost budget. “Exact expectation” refers to the analytical formula, whose numerical evaluation still has rounding error.

(iii) Substitute and sum the specified forty steps. Now $a=0.5$, $\sigma^2=0.01$ and $x_{\rm goal}=0.8$, so

$$m_t=0.8(1-0.5^t),\qquad v_t=\frac{0.01(1-0.25^t)}{0.75},\qquad p_t=\frac12\operatorname{erfc}\left(\frac{1-0.8(1-0.5^t)} {\sqrt{2(0.01)(1-0.25^t)/0.75}}\right).$$

For example, at $t=1$, $m_1=0.4$ and $v_1=0.01$, so the standardized threshold is $(1-0.4)/0.1=6$. Selected intermediate values are:

$t$$m_t$$v_t$Standardized threshold$p_t$
10.40.016$9.86588\times10^{-10}$
30.70.0131252.6186150.00441438
50.7750.0133203131.9495090.02561732
100.799218750.0133333211.7388170.04103344
40$\approx0.8$$\approx0.013333333$$\approx1.732051$0.04163226

Evaluating the same formula for every integer $t=1,\ldots,40$ and adding gives $\mathbb E[N]\approx1.484230454$. The stationary variance is $0.01/0.75=1/75$, with standard deviation $1/\sqrt{75}\approx0.115470$. Its standardized threshold is $0.2\sqrt{75}=\sqrt3$, so $p_\infty=Q(\sqrt3)\approx0.041632258$ and $40p_\infty\approx1.665290333$. The stationary approximation is larger because it ignores the initially safer transient.

Compare with the joint-failure bound. Since $N\ge\mathbf1\{N\ge1\}$, Markov's inequality gives $\Pr(\text{some violation})\le\mathbb E[N]\approx1.48423$. Probabilities are already at most one, so the useful bound is only $\min\{1,\mathbb E[N]\}=1$: it is vacuous here. The expected count is not itself a probability and may exceed one.

The joint event requires the dependence between states. For $s\le t$, unrolling from time $s$ gives $e_t=a^{t-s}e_s$ plus noises after $s$, independent of $e_s$; hence $\operatorname{Cov}(x_s,x_t)=a^{t-s}v_s$. The vector of forty states is jointly Gaussian with these covariances, and its all-safe probability is a multivariate Gaussian probability, rather than a product of marginal safe probabilities. The explorer estimates that joint quantity by simulation; the existing illustrative value about $0.69$ is a simulation result, not an identity derived from the marginal sum or a certified probability. The analytical expected count and the joint chance constraint answer different questions.

Key Papers

Research update — checked 2 November 2026

Optional reading after the core material. The entries below distinguish conditional theory from reported experiments.

PaperVenueContributionWhy read it
Brunke, Greeff, Hall, Yuan, Zhou, Panerati & Schoellig, Safe Learning in Robotics: From Learning-Based Control to Safe Reinforcement LearningAnnu. Rev. Control Robot. Auton. Syst. 5, 2022unifies safe learning control and safe RL; Level I/II/III taxonomy; safe-control-gymthe best single entry survey; its taxonomy maps onto (c)/(b)/(a)
Fiedler, Menn, Kreisköther & Trimpe, On Safety in Safe Bayesian OptimizationTMLR 2024why SafeOpt implementations lose their guarantees; Real-$\beta$-SafeOpt, LoSBO, LoS-GP-UCBthe thesis of this section: guarantees need checkable assumptions
Wabersich, Taylor, Choi, Sreenath, Tomlin, Ames & Zeilinger, Data-Driven Safety Filters: Hamilton-Jacobi Reachability, Control Barrier Functions, and Predictive Methods for Uncertain SystemsIEEE Control Systems Magazine 43(5), 2023HJ, CBF and predictive filters as approximations of one ideal minimally invasive filterthe control tradition in one tutorial
García & Fernández, A Comprehensive Survey on Safe Reinforcement LearningJMLR 16(42), 2015the two-branch taxonomy: optimality criterion versus exploration processhistorical baseline of the RL view
Altman, Constrained Markov Decision ProcessesChapman & Hall/CRC, 1999occupation-measure LPs, Lagrangian duality, optimal stationary randomised policiesthe reference for formalisation (c)
Achiam, Held, Tamar & Abbeel, Constrained Policy OptimizationICML 2017trust-region policy search for CMDPs with per-iteration guaranteesfixes the deep-RL CMDP notation used here
Chow, Ghavamzadeh, Janson & Pavone, Risk-Constrained Reinforcement Learning with Percentile Risk CriteriaJMLR 18(167), 2018chance- and CVaR-constrained MDPs; Lagrangian gradients with the VaR parameterformalisation (d) and the $\alpha$ convention
Ames, Xu, Grizzle & Tabuada, Control Barrier Function Based Quadratic Programs for Safety Critical SystemsIEEE TAC 62(8), 2017reciprocal and zeroing CBFs, the CLF-CBF QP, Lipschitz continuity of the QP controllerthe deterministic invariance theorem quoted above
Massiani, Heim, Solowjow & Trimpe, Safe Value FunctionsIEEE TAC 68(5), 2023when failure penalties give safe and optimal value functions; the finite threshold and its $e^{T_f/\tau}$ scalingformalisation (g) and the bridge from viability to RL
Sui, Gotovos, Burdick & Krause, Safe Exploration for Optimization with Gaussian ProcessesICML 2015SafeOpt: safe set from a seed, expanders and maximisers, safety w.h.p.the safe-exploration template and its assumption list
Srinivas, Krause, Kakade & Seeger, Gaussian Process Optimization in the Bandit Setting: No Regret and Experimental DesignICML 2010 (IEEE TIT 2012)GP-UCB, $\beta_t$ and the information gain $\gamma_T$where the confidence machinery and the squared-norm convention come from
Berkenkamp, Turchetta, Schoellig & Krause, Safe Model-based Reinforcement Learning with Stability GuaranteesNeurIPS 2017safe = inside a certified region of attraction; GP plus Lipschitz discretisationformalisation (e) as a learning problem
Fazlyab, Robey, Hassani, Morari & Pappas, Efficient and Accurate Estimation of Lipschitz Constants for Deep Neural NetworksNeurIPS 2019LipSDP: slope restriction as an incremental quadratic constraint, Lipschitz bound by SDPentry point of the certified-model tradition (read with Pauli et al.'s correction)
Paternain, Chamon, Calvo-Fullana & Ribeiro, Constrained Reinforcement Learning Has Zero Duality GapNeurIPS 2019CMDPs have zero duality gap under Slater's conditionwhy Lagrangian methods are principled despite non-convexity
A Decade of Learning-Based Control: From Theoretic Foundations to Practical DeploymentarXiv preprint, 2026-10-21Tutorial connecting learned dynamics, learning-based MPC, policy learning and Bayesian controller tuning through stability and safety concepts, with examples and implementation resources.An updated overview and reading route connecting the course's separate modules.

The full atlas of verified papers for the section is in the Paper Atlas.

Flashcards