10. Barrier Functions, Reachability & Safety Filters

Forward invariance, CBF-QPs, high-order and robust CBFs, HJ reachability, predictive safety filters, shields and the unified safety-filter view

Before you start

This module assumes:

A route through this module

First build the core calculation: invariance, the barrier inequality, projection onto safe inputs, the worked filter. Try the Easy practice as you go, then the Medium applications. Then add input limits, higher relative degree and model error. Read reachability, predictive filtering, shields and learned filters as ways to build or maintain the safe set.

The Hard practice checks proofs and assumptions. The original longer exercises remain for a deeper pass. If a calculation stalls, follow its prerequisite review link and return after practising that skill.

Background — check the skills used next

Check set membership, differentiation along a trajectory and scalar projection.

Show hint

A barrier turns safety into an inequality; the chain rule turns its change into an input constraint.

Show worked check

For $h(x)=x^2-1$, safe means $|x|\ge1$. With $\dot x=u$, the chain rule gives $\dot h=2xu$. A nominal input $-2$ projected onto $u\ge-1$ becomes $-1$, the nearest allowed input. Review set-builder notation, the chain rule, and projection before the general formulas.

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

Contents
1. Forward Invariance and Nagumo's Theorem 2. Control Barrier Functions 3. The CBF-QP Safety Filter and Its Closed Form 4. High Relative Degree: ECBFs and HOCBFs 5. Robust CBFs, ISSf and Learned Residuals 6. Hamilton–Jacobi Reachability 7. Predictive Safety Filters (Wabersich & Zeilinger) 8. Shields and the Unified Safety-Filter View 9. Learned and Uncertainty-Aware Filters (incl. UPSi) Walkthrough: From the CBF Condition to the Filtered Input Interactive: CBF-QP Safety Filter on a Robot Application lab & chapter review Exercises Graded practice: Easy → Medium → Hard Key Papers Flashcards

Modules 4–9 made safety a property of the learner: a safe set in parameter space, a constrained MDP, a trust region. This module makes safety a property of a runtime filter wrapped around any controller, including an RL policy (see Primer E) that knows nothing about safety. The filter watches the state, checks whether the proposed input keeps a certified set invariant, and minimally corrects it if not. Three families do this: control barrier functions (a one-step, gradient-based check), Hamilton–Jacobi reachability (the exact maximal safe set, computed offline) and predictive safety filters (an MPC-like search for a backup plan). The unifying view of Hsu, Hu & Fisac, Annu. Rev. 2024 shows they are all instances of one theorem: keep a fallback policy, monitor whether it can still rescue you, and intervene only when it could not.

Notation for this module (and clashes)
State $x\in X\subseteq\mathbb R^n$, input $u\in U\subseteq\mathbb R^m$, control-affine dynamics $\dot x=f(x)+g(x)u$ or discrete $x_{k+1}=f(x_k,u_k)$; safe set $C=\{x: h(x)\ge 0\}$ with barrier $h$; class-$\mathcal K$ function $\alpha$ (see Primer D); Lie derivatives $L_fh=\nabla h^\top f$, $L_gh=\nabla h^\top g$ (a $1\times m$ row; see Primer B).
Reference — notation changes across papers
Clashes: the barrier $h$ is not the SafeOpt threshold $h$ of Modules 4–6 (there $f(x)\ge h$ is safe); $V$ is a control Lyapunov function in Section 2 and the HJ safety value from Section 6 on; $\gamma$ is the discount factor (Bansal et al. use $\gamma$ for disturbance strategies, which we write $\beta$; $\beta(r):=-\alpha(-r)$ in the ISSf theorem is unrelated). Where we quote a source we keep its symbols, so $\gamma$ also appears as the class-$\mathcal K$ rate of the CLF condition, the ISSf inflation $\gamma(\|d\|_\infty)$, the exponential rate of the CBVF, Fisac et al.'s safety confidence $\gamma(x)$, the error-set scale of the predictive safety filter and Robey et al.'s margins $\gamma_{\mathrm{safe}},\gamma_{\mathrm{unsafe}},\gamma_{\mathrm{dyn}}$; our own linear class-$\mathcal K$ gain is always $\alpha_0$, as in $\alpha(r)=\alpha_0r$. The QP multiplier is $\mu$, not the CMDP multiplier $\lambda$ of Module 8 (following the sources, $\mu$ is also the virtual input $h^{(r)}$ of an ECBF in Section 4, the disturbance argument of the ISSf conditions in Section 5, and in Section 9 UPSi's nominal dynamics and Dyna-SAuR's filter policy). Likewise $a,b$ denote the drift and input parts of the CBF constraint only in Section 3, the walkthrough and the explorer: Taylor et al.'s residual terms are also called $a,b$ (Section 5), and Xiao & Belta write the constraint function as $b(x)$ and its relative degree as $m$ (Section 4), while elsewhere $m$ is the input dimension. RL papers write $s,a$ for our $x,u$.

1. Forward Invariance and Nagumo's Theorem

Safety in this module means one thing: the state never leaves a prescribed set. Everything else (CBFs, reachability, predictive filters, shields) is a way to certify or enforce that property, so we start with the property itself. Consider $\dot x=f(x)$ with $f$ locally Lipschitz (see Primer B), so that every $x_0$ has a unique solution on a maximal interval $I(x_0)=[0,\tau_{\max})$, with $\tau_{\max}=\infty$ if the system is forward complete (see Primer D).

Definition — Safe set and forward invariance (Ames et al. 2019, Def. 1)
Let $h:D\to\mathbb R$ be continuously differentiable on an open set $D\subseteq\mathbb R^n$ (see Primer 0) and assume $\nabla h\ne0$ wherever $h=0$ for the boundary/interior identities below. Then $$C=\{x\in D: h(x)\ge 0\},\qquad \partial C=\{x\in D: h(x)=0\},\qquad \operatorname{Int}(C)=\{x\in D: h(x)>0\}.$$ $C$ is forward invariant if for every $x_0\in C$ the solution satisfies $x(t)\in C$ for all $t\in I(x_0)$. The system is safe with respect to $C$ if $C$ is forward invariant.

Terms. A point lies in the interior of a set if some small ball around it lies in the set, and on its boundary if every small ball around it meets both the set and its complement (here relative to $D$). The regularity assumption is what makes the two identities true: for $h\equiv0$ we get $C=D$, whose relative boundary is empty although $\{h=0\}=D$. A neighbourhood of $C$ is an open set containing $C$, so $h$ can be differentiated on both sides of $\partial C$; compact means closed and bounded; $h|_C$ is $h$ evaluated only on $C$.

Key insight
Stability means trajectories starting close to a point or set remain close; asymptotic stability additionally requires convergence to it; safety is a property of a set that trajectories do not leave. A trajectory may wander anywhere inside $C$, so nothing is required in the interior. The whole question is what happens at the boundary $\partial C$.
Theorem — Nagumo's theorem, superlevel-set form (Wabersich et al. 2023, Thm. 1; Ames et al. 2019, Sec. I-A and Rem. 5)
Let $f$ be locally Lipschitz, $\operatorname{Int}(C)\neq\emptyset$ and $\nabla h(x)\neq 0$ for all $x\in\partial C$ (0 is a regular value of $h$). Then $C$ is forward invariant if and only if $$\dot h(x)=\nabla h(x)^\top f(x)\ \ge\ 0\qquad\text{for all }x\in\partial C.$$

In words: only the boundary matters, and there the vector field must point inward or be tangent. Why the assumptions: Lipschitz $f$ gives uniqueness of solutions (otherwise one solution could stay and another leave); the regularity condition makes $\{v:\nabla h^\top v\ge 0\}$ the tangent cone of $C$ at the boundary. Nagumo's original 1942 theorem is stated for closed sets with the Bouligand tangent cone, $f(x)\in T_C(x)$ for all $x\in C$ (see the survey of Blanchini, Automatica 1999); if $\nabla h$ vanished somewhere on $\partial C$ the condition $\dot h\ge 0$ would be vacuous there and the equivalence fails. The "only if" direction is elementary (a trajectory starting on $\partial C$ with $\dot h<0$ enters $\{h<0\}$ immediately); the "if" direction is the substance and is a viability-theory result.

Background — Tangent cones

A tangent-cone direction is a velocity that can be approximated by arbitrarily short moves staying in $C$: $v\in T_C(x)$ if there are $t_j\downarrow0$ and $x_j\in C$ with $(x_j-x)/t_j\to v$. At a smooth regular boundary of $\{h\ge0\}$ this cone is $\{v:\nabla h(x)^\top v\ge0\}$. For $C=[0,\infty)$ at $x=0$, this gives $T_C(0)=[0,\infty)$: negative velocities immediately leave the set.

Nagumo is a test, not a design tool, and it is fragile: it constrains $\dot h$ only on the boundary and says nothing about how fast trajectories may approach it, so a small model error or a sampled implementation can push the state over. Two ideas repair this. The first predates CBFs and is the verification ancestor of everything on this page.

Definition — Barrier certificate (Prajna & Jadbabaie 2004)
For $\dot x=f(x,d)$ with disturbance $d\in\mathcal D$, initial set $X_0$ and unsafe set $X_u$, a differentiable $B:X\to\mathbb R$ is a barrier certificate if $$B(x)\le 0\ \ \forall x\in X_0,\qquad B(x)>0\ \ \forall x\in X_u,\qquad \frac{\partial B}{\partial x}(x)\,f(x,d)\le 0\ \ \forall (x,d)\in X\times\mathcal D.$$ Then no trajectory starting in $X_0$ ever reaches $X_u$. Proof: $B(x(t))$ is non-increasing along every trajectory, starts at a value $\le 0$, and $X_u$ requires $B>0$. For polynomial $f,B$ and semialgebraic sets the three conditions can be certified by sum-of-squares constraints with polynomial multipliers, the polynomial analogue of the S-procedure of Module 2 (a sufficient condition, see the note below). With fixed degrees and unknown coefficients entering affinely this is an SDP, so a successful certificate needs no trajectory simulation.
Background — Polynomial positivity and SOS

A semialgebraic region is described by polynomial inequalities. A polynomial $p$ is sum-of-squares (SOS) if $p=\sum_j q_j^2$, which guarantees $p\ge0$. For a fixed monomial vector $z(x)$, an SOS certificate has the form $p(x)=z(x)^\top Qz(x)$ with $Q\succeq0$; matching polynomial coefficients gives linear equations. For a region $q_i\ge0$, requiring $p-\sum_i s_iq_i$ and each $s_i$ to be SOS is a sufficient positivity certificate. With fixed degrees and coefficients entering affinely, this is an SDP. It is generally a sufficient relaxation; products of unknown barrier and multiplier coefficients need additional treatment. For example, $1+x^2=(1)^2+x^2$ uses $z=(1,x)^\top$ and $Q=I$; $[-1,1]=\{x:1-x^2\ge0\}$ is semialgebraic. This lets us certify all states in a region without sampling them.

The certificate's sign convention is the mirror image of ours ($B\approx -h$), and its third condition ($\dot h\ge 0$ everywhere) is much stronger than Nagumo's. The second idea, due to Ames, Xu, Grizzle and Tabuada, interpolates between the two: allow $h$ to decrease, but at most at a rate that vanishes as the boundary is approached.

Definition — Extended class-K function and zeroing barrier function (Ames et al. 2017, Defs. 2–3)
A continuous $\alpha:(-b,a)\to\mathbb R$ ($a,b>0$, possibly $\infty$) is an extended class-$\mathcal K$ function if it is strictly increasing with $\alpha(0)=0$ (a class-$\mathcal K$ function is the restriction to $[0,a)$). A continuously differentiable $h$ is a zeroing barrier function (ZBF) for $C$ if there exist an extended class-$\mathcal K$ $\alpha$ and a set $D\supseteq C$ such that $$L_fh(x)\ \ge\ -\alpha(h(x))\qquad\text{for all }x\in D.$$ Proposition 1 (Ames et al. 2017, with the hypothesis added in Ames et al. 2019, Thm. 2 and Rem. 5): a ZBF renders $C$ forward invariant if $\nabla h\neq 0$ on $\partial C$ (0 is a regular value of $h$), or if $D$ is an open neighbourhood of $C$. The 2017 statement allows $D=C$ and assumes neither, and then it fails: for $\dot x=1$, $h(x)=(1-x^2)^3$ and $\alpha(r)=6\,\operatorname{sgn}(r)|r|^{2/3}$ one has $L_fh+\alpha(h)=6(1-x^2)^2(1-x)\ge 0$ on $C=[-1,1]$, yet $x(0)=0$ leaves $C$ at $t=1$, a boundary point where $\nabla h=0$. Proposition 3: if $C$ is compact and forward invariant, then $h|_C$ is a ZBF (with $D=C$). So for compact $C$ with $\nabla h\neq 0$ on $\partial C$: forward invariant $\iff$ a ZBF exists.
ConditionImposed whereRequirementGives
Nagumo$\partial C$ only$\dot h\ge 0$invariance (iff), no robustness
Barrier certificateall of $X$$\dot B\le 0$, sign conditions on $X_0,X_u$unreachability of $X_u$; SOS-searchable
Zeroing barrier functionopen $D\supseteq C$, or $D=C$ if $\nabla h\neq 0$ on $\partial C$$\dot h\ge-\alpha(h)$invariance of $C$ and (for compact $C$, open $D$) asymptotic stability of $C$ (Section 2; see Primer D)

2. Control Barrier Functions

Barrier functions verify a closed loop; control barrier functions let us design one, exactly as Sontag's control Lyapunov functions extend Lyapunov functions. Take the control-affine system $\dot x=f(x)+g(x)u$ with $f,g$ locally Lipschitz, $x\in D\subset\mathbb R^n$, $u\in U\subseteq\mathbb R^m$. Along any trajectory $$\dot h(x,u)=L_fh(x)+L_gh(x)\,u,$$ which is affine in $u$. This single fact is why CBF conditions become linear constraints and safety filters become quadratic programs.

Background — Control Lyapunov functions

For a goal at $x=0$, an exponential control Lyapunov function is a differentiable $V$ with $c_1\|x\|^2\le V(x)\le c_2\|x\|^2$ for positive constants $c_1,c_2$, and with an admissible input satisfying $L_fV+L_gVu\le-c_3V$, $c_3>0$, at each state in its domain. It measures goal error and offers a control that decreases that error. In the CLF-CBF QP below assume $H(x)=H(x)^\top\succ0$ and $p>0$ (see Primer A). The optimizer is the pair $(u^*,\delta^*)$; only its first component is applied to the plant.

For $\dot x=u$, choose $V=x^2$ and $u=-x$. Then $\dot V=2xu=-2x^2=-2V$, so $c_1=c_2=1$, $c_3=2$ work. A CLF supplies a goal-seeking control direction; the barrier later restricts it to protect safety.

Definition — Control barrier function (Ames et al. 2019, Def. 2; the zeroing CBF of Ames et al. 2017, Def. 5)
Let $C\subset D$ be the superlevel set of a continuously differentiable $h:D\to\mathbb R$. Then $h$ is a control barrier function on $D$ if there exists an extended class-$\mathcal K_\infty$ function $\alpha$ such that $$\sup_{u\in U}\big[L_fh(x)+L_gh(x)\,u\big]\ \ge\ -\alpha(h(x))\qquad\text{for all }x\in D.$$ The set of safe inputs at $x$ is $$K_{\mathrm{cbf}}(x)=\{u\in U:\ L_fh(x)+L_gh(x)u+\alpha(h(x))\ge 0\}.$$ (The 2017 paper allows an extended class-$\mathcal K$ $\alpha$ on a finite interval; the 2019 tutorial takes $\alpha$ on all of $\mathbb R$. The distinction never matters below.) An extended class-$\mathcal K_\infty$ function $\alpha:\mathbb R\to\mathbb R$ is continuous and strictly increasing with $\alpha(0)=0$ and $\alpha(r)\to\pm\infty$ as $r\to\pm\infty$; restricted to $r\ge 0$ it is a class-$\mathcal K_\infty$ function (class $\mathcal K$ and unbounded). For suprema and whether they are attained, see Primer 0 and Primer B.
Theorem — Safety via CBFs (Ames et al. 2019, Thm. 2; Ames et al. 2017, Cor. 2 and Prop. 2)
Let $h$ be a CBF on $D$ with $\nabla h(x)\neq 0$ for all $x\in\partial C$. Then any Lipschitz continuous controller $u(x)\in K_{\mathrm{cbf}}(x)$ renders $C$ forward invariant (safe). Moreover, if $C$ is compact, $C$ is asymptotically stable: trajectories that start in $D$ close enough to $C$ converge to it. (The tutorial states asymptotic stability "in $D$" without compactness, and Ames et al. 2017 also list forward completeness of the closed loop as sufficient; both readings need an extra condition tying $\max\{0,-h\}$ to the distance from $C$ (see Primer A): for $\dot z=1$, $\dot y=0$ and $h=e^{-z}y$ one has $\dot h=-h$ everywhere and a regular boundary, yet from $y=-1$ the distance to $C=\{y\ge 0\}$ stays 1.)

In words: pick any input from $K_{\mathrm{cbf}}(x)$ at every state, continuously enough, and you never leave $C$; if a small disturbance kicks you out, you come back. Why each assumption matters: Lipschitz $u(x)$ makes the closed loop $\dot x=f+g\,u(x)$ locally Lipschitz so that solutions exist and are unique (Section 3 checks this for the QP controller); the regularity of $\partial C$ is inherited from Nagumo; defining $h$ on $D\supsetneq C$ is what gives the robustness statement, since the inequality $\dot h\ge-\alpha(h)>0$ holds outside $C$ too.

Proof — Forward invariance and asymptotic stability via the comparison lemma

Step 1 (reduce to a scalar inequality). Let $x(t)$ be the closed-loop solution from $x_0\in C$ and set $\eta(t):=h(x(t))$, which is $C^1$ on $I(x_0)$. Because $u(x(t))\in K_{\mathrm{cbf}}(x(t))$, $$\dot\eta(t)=L_fh(x(t))+L_gh(x(t))\,u(x(t))\ \ge\ -\alpha(\eta(t)).$$

Step 2 (the comparison system). Consider $\dot y=-\alpha(y)$, $y(0)=\eta(0)=h(x_0)\ge 0$. Its right-hand side is continuous and non-increasing in $y$ ($\alpha$ is strictly increasing), which is enough for forward uniqueness of solutions even though $\alpha$ need not be Lipschitz: if $y_1,y_2$ both solve $\dot y=F(y):=-\alpha(y)$ from the same initial value, then $\frac{d}{dt}(y_1-y_2)^2=2(y_1-y_2)\big(F(y_1)-F(y_2)\big)\le 0$ because $F$ is non-increasing, so the square, which starts at 0 and cannot become negative, stays 0. (Ames et al. 2017 invoke exactly this uniqueness in the proof of their Lemma 1 and note, in the proof of their Theorem 1, that the comparison lemma uses Lipschitz continuity only to get it.) Since $y\equiv 0$ is a solution and forward solutions cannot cross, $y(0)\ge 0$ implies $y(t)\ge 0$ for all $t$, and $y$ decreases monotonically to 0. It may reach 0 in finite time when $\alpha$ is not Lipschitz at 0: for $\alpha(r)=\operatorname{sgn}(r)\sqrt{|r|}$ the solution is $y(t)=\big(\max\{\sqrt{y(0)}-t/2,\ 0\}\big)^2$. Only $y\ge 0$ is needed below.

Step 3 (comparison lemma). The comparison lemma (Khalil, Lemma 3.4; see Primer D) says: if $\dot v\le F(v)$ and $\dot w=F(w)$, $v(0)\le w(0)$, with $F$ continuous and solutions of the $w$-equation unique, then $v(t)\le w(t)$. Apply it to $v=-\eta$, $w=-y$, $F(v)=\alpha(-v)$: Step 1 gives $\dot v=-\dot\eta\le\alpha(\eta)=\alpha(-v)$, and Step 2 gives uniqueness. Hence $-\eta\le -y$, i.e. $$h(x(t))=\eta(t)\ \ge\ y(t)\ \ge\ 0\qquad\forall t\in I(x_0),$$ which is $x(t)\in C$. (Khalil states the lemma with $F$ locally Lipschitz; that hypothesis is used only for uniqueness, which Step 2 supplies.)

Step 4 (asymptotic stability). For $x\in D\setminus C$ we have $h<0$, so $\dot h\ge-\alpha(h)>0$: $h$ strictly increases towards 0. Formally $V_C(x):=\max\{0,-h(x)\}$ is a Lyapunov function for the set $C$ (Ames et al. 2017, eq. 20 and Prop. 2): outside $C$, $V_C=-h>0$ and $\dot V_C=-\dot h\le\alpha(h)=\alpha(-V_C)\lt 0$, while inside $C$ invariance keeps $V_C=0$, so the argument never needs the derivative of the kink of $V_C$ on $\partial C$. To conclude convergence to $C$ one also needs $V_C$ to be bounded below by a class-$\mathcal K$ function of the distance $\operatorname{dist}(x,C)=\inf_{y\in C}\|x-y\|$, which holds near a compact $C$ with regular boundary; this is why the theorem above assumes compactness (see the counterexample there). For the linear choice $\alpha(r)=\alpha_0 r$ the comparison system is explicit and Grönwall gives the quantitative bound $$h(x(t))\ \ge\ h(x_0)\,e^{-\alpha_0 t}.$$

Intuition: what $\alpha$ buys you
With $\alpha(r)=\alpha_0 r$ the barrier value may decay at most like $e^{-\alpha_0 t}$. Small $\alpha_0$: the controller must start turning away long before the boundary (conservative, smooth). Large $\alpha_0$: it may approach the boundary almost until contact (aggressive). The $\alpha_0$ slider of the explorer below shows precisely this trade-off. Necessity holds too: if $C$ is compact with regular boundary and some controller renders it safe, then $h|_C$ is a CBF (Ames et al. 2019, Thm. 3). So the conservatism of a CBF filter comes from the choice of $h$ (hence of $C$, which is typically far smaller than the maximal safe set of Section 6) and of $\alpha$, not from the CBF condition itself.

Reciprocal versus zeroing barriers

The first CBF-QP paper, Ames, Grizzle & Tabuada, CDC 2014, used a barrier in the optimization sense: $B(x)=1/h(x)$ or $B=-\log\frac{h}{1+h}$, which blows up on $\partial C$, with the condition $\inf_u[L_fB+L_gBu-\gamma/B]\le 0$. The journal version Ames, Xu, Grizzle & Tabuada, TAC 2017 introduced both notions side by side.

Definition — Reciprocal control barrier function (Ames et al. 2017, Def. 4, eqs. 23–24)
$B:\operatorname{Int}(C)\to\mathbb R$ is an RCBF for $C$ if there are class-$\mathcal K$ functions $\alpha_1,\alpha_2,\alpha_3$ with, for all $x\in\operatorname{Int}(C)$, $$\frac{1}{\alpha_1(h(x))}\le B(x)\le\frac{1}{\alpha_2(h(x))},\qquad \inf_{u\in U}\big[L_fB(x)+L_gB(x)u-\alpha_3(h(x))\big]\le 0.$$ With $K_{\mathrm{rcbf}}(x):=\{u\in U:\ L_fB(x)+L_gB(x)u-\alpha_3(h(x))\le 0\}$, any locally Lipschitz $u(x)\in K_{\mathrm{rcbf}}(x)$ renders $\operatorname{Int}(C)$ forward invariant (Cor. 1).
Reciprocal (RCBF)Zeroing (ZCBF / CBF)
Defined on$\operatorname{Int}(C)$$D\supseteq C$ (also outside $C$)
On $\partial C$$B\to\infty$$h=0$
Invariant set$\operatorname{Int}(C)$$C$ (closed)
Robustnessnone: nothing is defined outside$C$ asymptotically stable
Numericsill-conditioned near the boundarybenign; affine constraint
Used inCDC 2014, TAC 2017 QPECC 2019 tutorial and essentially all later work

Mediating performance and safety: the CLF-CBF QP

Given an exponentially stabilizing CLF $V$ (condition $\inf_u[L_fV+L_gVu+c_3V]\le 0$) and a barrier, the TAC 2017 paper unifies both in one quadratic program (see Primer B) (eqs. 33–34), here in the zeroing form of the 2019 tutorial:

$$(u^*(x),\delta^*(x))=\operatorname*{arg\,min}_{(u,\delta)\in\mathbb R^m\times\mathbb R}\ \tfrac12 u^\top H(x)u+p\,\delta^2\quad\text{s.t.}\quad L_fV+L_gV\,u\le-\gamma(V(x))+\delta,\qquad L_fh+L_gh\,u\ge-\alpha(h(x)).$$

The stability constraint is relaxed by a slack $\delta$ (see Primer B) penalized with $p>0$; the safety constraint is hard. When both cannot be met, performance yields and safety wins. Theorem 3 of the TAC paper (stated for the RCBF form $L_fB+L_gBu-\alpha(h)\le 0$) proves that if $f,g,\nabla B,\nabla V$ and the cost terms $H,F$ are locally Lipschitz (the TAC objective has an extra linear term $F(x)^\top u$) and $L_gB(x)\neq 0$ on $\operatorname{Int}(C)$, then $u^*(x)$ is locally Lipschitz, so the invariance theorem applies to the closed loop and an explicit closed form exists.

Caveat — undesirable equilibria and a corrected theorem
Reis, Aguiar & Tabuada, L-CSS 2021 show that CLF-CBF QPs can introduce undesirable asymptotically stable equilibria (see Primer D) on $\partial C$: the closed loop may converge to a point on the obstacle boundary instead of the goal, because there the stabilizing and the safety directions cancel. The explorer reproduces the phenomenon for a pure CBF-QP filter: start exactly on the line through the obstacle centre and the goal and the robot stops in front of the obstacle. (There the spurious equilibrium is a saddle, since any lateral offset frees the robot; Reis et al. exhibit cases, already for linear systems with one convex obstacle, in which it is asymptotically stable, so the closed loop genuinely converges to the obstacle boundary.) Also note that the robustness paper of Xu, Tabuada, Grizzle & Ames, IFAC ADHS 2015 (which introduced the extended class-$\mathcal K$ CBF condition and the asymptotic-stability argument) has a corrected arXiv version (its Theorem 3); use that one.

3. The CBF-QP Safety Filter and Its Closed Form

Suppose a nominal controller $k(x)$ (a tracking law, a planner, an RL policy) is given and may violate the CBF condition. For unrestricted inputs ($U=\mathbb R^m$) and $L_gh(x)\neq 0$, $K_{\mathrm{cbf}}(x)$ is a half-space in $u$, so the minimally invasive repair is a projection:

Definition — The CBF-QP safety filter (Ames et al. 2019, "CBF-QP")
$$u^*(x)=\operatorname*{arg\,min}_{u\in\mathbb R^m}\ \tfrac12\|u-k(x)\|^2\qquad\text{s.t.}\qquad L_fh(x)+L_gh(x)\,u\ \ge\ -\alpha(h(x)).$$ With input bounds $u\in U$ (a polytope) it remains a QP but loses its closed form.
Key equation — Closed form of the single-constraint CBF-QP
Write $a(x):=L_fh(x)+\alpha(h(x))$ and $b(x):=L_gh(x)^\top\in\mathbb R^m$ with $b(x)\neq 0$. Then $$u^*(x)=k(x)+\max\Big\{0,\ -\frac{a(x)+b(x)^\top k(x)}{b(x)^\top b(x)}\Big\}\,b(x).$$ The scalar $\psi(x):=a(x)+b(x)^\top k(x)=\dot h(x,k(x))+\alpha(h(x))$ is the nominal controller's safety margin: the filter is inactive when $\psi\ge 0$ and otherwise adds exactly the correction $-\psi/\|b\|^2\cdot b$ along $b=g(x)^\top\nabla h(x)$, the direction in input space that increases $\dot h$ fastest. The derivation, via the KKT conditions, is the walkthrough below.
Algorithm 1: CBF-QP safety filter, sampled-data implementation
  1. At each sampling instant $t_k$: measure $x$, compute $u_{\mathrm{nom}}=k(x)$.
  2. Compute $a=L_fh(x)+\alpha(h(x))$, $b=L_gh(x)^\top$, $\psi=a+b^\top u_{\mathrm{nom}}$.
  3. If $b^\top b>0$: $u=u_{\mathrm{nom}}+\max\{0,-\psi/(b^\top b)\}\,b$. // projection onto the half-space
  4. Else ($b=0$, the constraint reads $a\ge 0$): if $a\ge 0$, $u=u_{\mathrm{nom}}$; otherwise no input satisfies it: flag infeasibility and switch to a fallback whose safety from the current state was certified separately (infeasibility alone does not provide one). // $b\equiv 0$ near $\partial C$ means relative degree $>1$, see Section 4
  5. With input bounds $U\neq\mathbb R^m$, replace steps 3–4 by $\min_u\|u-u_{\mathrm{nom}}\|^2$ over $K_{\mathrm{cbf}}(x)\cap U$ (a QP for box or polytopic $U$). // clipping the projected input can violate the constraint even when $K_{\mathrm{cbf}}(x)\cap U\neq\emptyset$; the explorer clips only for illustration
  6. Hold $u$ on $[t_k,t_k+\Delta t)$ (sample-and-hold, see Primer D).

Four things the closed form tells you

Lipschitz continuity. $r\mapsto\max\{0,r\}$ is 1-Lipschitz, and products and quotients of locally Lipschitz functions are locally Lipschitz wherever the denominator is bounded away from zero. Hence $u^*$ is locally Lipschitz wherever $a,b,k$ are and $b(x)\neq 0$, which is exactly the hypothesis $L_gB\neq 0$ of Theorem 3 in Ames et al. 2017. This is not a technicality: the invariance theorem needs a Lipschitz closed loop, so an implementation that switches discontinuously between controllers forfeits the guarantee unless it is analysed separately.

Feasibility with input bounds. With $U=\mathbb R^m$ and $b(x)\neq 0$ the half-space is always non-empty. With bounds, the QP is feasible iff $K_{\mathrm{cbf}}(x)\cap U\neq\emptyset$, which agrees with the CBF supremum test when the finite supremum is attained (in particular for nonempty compact $U$). The bounds must then be inside the QP: clipping the unconstrained solution afterwards can violate the constraint even when $K_{\mathrm{cbf}}(x)\cap U\neq\emptyset$ (the explorer below has an example). A function that is a CBF for $U=\mathbb R^m$ need not be one for a box $U$: a double integrator at distance $\Delta$ from a wall with approach speed $v$ needs $|u|\ge v^2/(2\Delta)$ to stop, whatever $\alpha$ says. Ames et al. 2017 (Rem. 11) note that their constructions for higher relative degree may cease to be valid once $U\neq\mathbb R^m$ and list CBF design under input constraints as an open question; the remedies are the high-order constructions of Section 4, predictive filters (Section 7), and value-function CBFs that respect the bounds by construction (Section 9). The other extreme is instructive too: for a drift-free single integrator $\dot x=u$ the input $u=0$ always satisfies $L_gh\,u\ge-\alpha(h)$ when $h\ge 0$, and scaling any feasible $u$ towards zero keeps it feasible, so a norm bound $\|u\|\le u_{\max}$ can never make the QP infeasible. Input constraints only bite when the drift $L_fh$ works against you, which is why the explorer includes a drift term.

In general $K_{\mathrm{cbf}}(x)=U\cap\{u:\ a(x)+b(x)^\top u\ge 0\}$, a half-space only when $U=\mathbb R^m$. Attainment is not a technicality: for $U=(-1,0)$ and the constraint $u\ge 0$ at a boundary state ($a=0$, $b=1$) the supremum of $a+bu$ over $U$ is $0\ge-\alpha(0)$, so the supremum test passes, yet no admissible input satisfies the constraint. What the filter needs is an actual element of $K_{\mathrm{cbf}}(x)$.

Derivation — Stopping distance of the double integrator

For approach speed $v_0>0$ and constant maximum braking $u=-u_{\max}$, the stopping time is $t_s=v_0/u_{\max}$. Integrating the velocity gives distance $\int_0^{t_s}(v_0-u_{\max}t)\,dt=v_0^2/(2u_{\max})$. Stopping before a wall at distance $\Delta$ therefore requires $v_0^2\le2u_{\max}\Delta$, i.e. $u_{\max}\ge v_0^2/(2\Delta)$. Speeds directed away from the wall need no braking.

Sampled data. The theory is continuous-time; the QP is solved every $\Delta t$ and the input is held. Between samples $h$ can undershoot. Hsu, Hu & Fisac (Cor. 1.2) argue safety under $\alpha(r)\lt r/\Delta t$ (for $\alpha(r)=\alpha_0 r$: $\alpha_0\Delta t\lt 1$) through the first-order step $h(x')\ge h(x)-\alpha(h(x))\Delta t$, which neglects the integration error between control cycles (their footnote 8, which adds that practical implementations typically enforce a positive margin such as $\dot h\ge\epsilon>0$). The paper prints the condition "for all $a\in\mathbb R$", which cannot hold at $a=0$ and reverses for $a\lt 0$; only arguments $a=h(x)\ge 0$ enter the proof, where it gives $h(x')\gt 0$ if $h(x)\gt 0$ and $h(x')\ge 0$ at $h(x)=0$. It is therefore a first-order argument, not a sampled-data guarantee: an exact one needs a bound on the inter-sample error or a genuinely discrete-time barrier condition. The cleaner route is a discrete-time CBF: Cheng et al., AAAI 2019 (Def. 1) require $\sup_{a}\big[h(f(s)+g(s)a+d(s))+(\eta-1)h(s)\big]\ge 0$ with $\eta\in[0,1]$, i.e. $h(s_{t+1})\ge(1-\eta)h(s_t)$, whose discrete comparison argument is one line: $h_t\ge(1-\eta)^th_0\ge 0$.

Slack. Adding a slack $\epsilon\ge 0$ with a large penalty (as in Cheng et al.'s QP (9)) guarantees a solution always exists, but what is then invariant, for $0\lt\eta\le 1$ and a slack bound $\epsilon\le\epsilon_{\max}$ on that set, is the enlarged set $\{h\ge-\epsilon_{\max}/\eta\}$ (their Lemma 1); for $\eta=0$ the slack can accumulate, $h_{t+1}\ge h_t-\epsilon_{\max}$, and no fixed inflation holds. Graceful degradation, not safety.

Derivation — Why slack inflates the invariant set to $\{h\ge-\epsilon_{\max}/\eta\}$

If $h_{k+1}\ge(1-\eta)h_k-\epsilon_{\max}$ and $0<\eta\le1$, define $z_k=h_k+\epsilon_{\max}/\eta$. Then $z_{k+1}\ge(1-\eta)h_k-\epsilon_{\max}+\epsilon_{\max}/\eta=(1-\eta)h_k+(1-\eta)\epsilon_{\max}/\eta=(1-\eta)z_k$. Consequently $z_0\ge0$ implies $z_k\ge0$ for every $k$, provided the same slack bound remains valid throughout that enlarged set.

Connection to Modules 9 and 11
The same closed form appears wherever an action is projected onto one affine constraint: the "safety layer" of Dalal et al., 2018 (a learned linearization of each constraint cost, solved in closed form when a single constraint is active), the action projection of Chow et al.'s Lyapunov-based safe RL (Module 11) and the learned hyperplane filter of Dyna-SAuR (Section 9) are literally this formula with $(a,b)$ supplied by a learned model. Policy-space projections such as PCPO (Module 9) project parameters rather than actions, but the KKT algebra is identical.

4. High Relative Degree: ECBFs and HOCBFs

Iterated Lie derivatives mean $L_f^0h=h$ and $L_f^{j+1}h=\nabla(L_f^jh)^\top f$; $L_gL_f^jh=\nabla(L_f^jh)^\top g$. Here $f(x)\in\mathbb R^n$ and $g(x)\in\mathbb R^{n\times m}$, so the latter is a row with $m$ entries. The notation $C^r$ means that derivatives through order $r$ exist and are continuous; assume the dynamics and barrier are smooth enough for all derivatives written below.

The relative degree of $h$ with respect to $\dot x=f+gu$ is the number $r$ of times one must differentiate $h$ along the dynamics before the input appears: $L_gL_f^kh\equiv 0$ for $k=0,\dots,r-2$ and $L_gL_f^{r-1}h\neq 0$, so that $$h^{(r)}(x,u)=L_f^rh(x)+L_gL_f^{r-1}h(x)\,u.$$ Most robotic constraints have $r\ge 2$: a position constraint under a force input, a distance constraint for a vehicle whose input is acceleration. Then $L_gh\equiv 0$ and the CBF constraint $L_fh+\alpha(h)\ge 0$ contains no $u$ at all: $K_{\mathrm{cbf}}(x)$ is either all of $U$ or empty (Ames et al. 2017, Sec. III-C), and the closed form divides by $b^\top b=0$. The fix is to push the constraint down the chain of derivatives.

Definition — Exponential CBF (Nguyen & Sreenath 2016, as restated in Ames et al. 2019, Def. 7)
Let $h$ be $r$ times continuously differentiable and $\eta_b(x):=\big[h(x),\ L_fh(x),\ \dots,\ L_f^{r-1}h(x)\big]^\top$. Then $h$ is an ECBF if there is a row vector $K_\alpha\in\mathbb R^{r}$ such that $$\sup_{u\in U}\big[L_f^rh(x)+L_gL_f^{r-1}h(x)\,u\big]\ \ge\ -K_\alpha\,\eta_b(x)\qquad\forall x\in\operatorname{Int}(C),$$ which, for real negative poles of $F-GK_\alpha$ (its eigenvalues; see Primer D on matrix exponentials and poles and impulse responses), gives $h(x(t))\ge C_c\,e^{(F-GK_\alpha)t}\eta_b(x_0)$. Here $F,G,C_c$ are the integrator-chain matrices: with $\mu:=h^{(r)}$, $\dot\eta_b=F\eta_b+G\mu$ and $h=C_c\eta_b$. The tutorial's definition adds "$\ge 0$ whenever $h(x_0)\ge 0$", but that needs the pole and initial-condition requirements below (its Remark 8): with both poles at $-1$, i.e. $\ddot h+2\dot h+h=0$, and $h(0)=1$, $\dot h(0)=-3$, one gets $h(t)=(1-2t)e^{-t}\lt 0$ for $t\gt\tfrac12$.

Why it works. Treat $\mu=h^{(r)}$ as a virtual input to a chain of $r$ integrators. With $\mu=-K_\alpha\eta_b$ the barrier obeys a linear ODE, $h(t)=C_ce^{(F-GK_\alpha)t}\eta_b(x_0)$; with $\mu\ge-K_\alpha\eta_b$ the excess $\mu+K_\alpha\eta_b\ge 0$ enters $h$ through the impulse response of the closed-loop chain, which is a convolution of decaying exponentials and hence nonnegative when the poles are real, so the inequality follows (with complex poles the impulse response changes sign and it can fail). The gains are chosen by pole placement (see Primer D), but not arbitrarily: define $\nu_0=h$, $\nu_i=\dot\nu_{i-1}+p_i\nu_{i-1}$ and $C_i=\{\nu_i\ge 0\}$, where $-p_1,\dots,-p_r$ are the eigenvalues of $F-GK_\alpha$. Then (Ames et al. 2019, Prop. 6 and Thms. 7–8, from Nguyen & Sreenath): if $C_i$ is forward invariant, $p_i>0$ and $x_0\in C_i\cap C_{i-1}$, then $C_{i-1}$ is forward invariant; hence if the controller enforces $\nu_r(x,u)\ge0$ at every time and $\nu_0(x_0),\ldots,\nu_{r-1}(x_0)\ge0$, then $C$ is invariant. The initial-condition requirement $\nu_i(x_0)=\dot\nu_{i-1}(x_0)+p_i\nu_{i-1}(x_0)\ge 0$, i.e. $p_i\ge-\dot\nu_{i-1}(x_0)/\nu_{i-1}(x_0)$ when $\nu_{i-1}(x_0)\gt 0$, says the pole magnitudes must be large enough relative to how fast you are initially moving towards the boundary (if $\nu_{i-1}(x_0)=0$ it reads $\dot\nu_{i-1}(x_0)\ge 0$, which no choice of $p_i$ can repair). Only $\nu_0,\dots,\nu_{r-1}$ are initial-state tests; $\nu_r$ contains $u$ and is the input constraint the controller enforces. (The ECC tutorial is not consistent here: it first calls $p_1,\dots,p_r$ the roots of the characteristic polynomial, then requires $p_i>0$ for "real negative poles", and Theorem 8 prints the initial-condition inequality with the eigenvalue $\lambda_i(F-GK_\alpha)\ge-\dot\nu_{i-1}(x_0)/\nu_{i-1}(x_0)$. Read consistently, with $-p_i$ the poles, the condition is $p_i\ge-\dot\nu_{i-1}(x_0)/\nu_{i-1}(x_0)$, as Exercise 10.3 checks on a concrete case.)

Derivation — The integrator chain and the variation-of-constants bound

For $r=2$: $\eta_b=(h,\dot h)^\top$, $F=\begin{pmatrix}0&1\\0&0\end{pmatrix}$, $G=\begin{pmatrix}0\\1\end{pmatrix}$, $C_c=\begin{pmatrix}1&0\end{pmatrix}$, so $\dot\eta_b=F\eta_b+G\mu$ says $\frac{d}{dt}h=\dot h$ and $\frac{d}{dt}\dot h=\mu$. In general $F$ has ones just above the diagonal, $G$ feeds $\mu$ into the last coordinate and $C_c$ reads off the first. Write the excess as $\omega(t):=\mu(t)+K_\alpha\eta_b(t)\ge 0$ and $A_{\mathrm{cl}}:=F-GK_\alpha$; then $\dot\eta_b=A_{\mathrm{cl}}\eta_b+G\omega$, and variation of constants gives $$h(t)=C_ce^{A_{\mathrm{cl}}t}\eta_b(0)+\int_0^t C_ce^{A_{\mathrm{cl}}(t-s)}G\,\omega(s)\,ds.$$ The kernel $C_ce^{A_{\mathrm{cl}}t}G$ is the impulse response of the chain, a convolution of the decaying exponentials $e^{-p_it}$, hence nonnegative for real poles; with $\omega\ge 0$ the integral is nonnegative and $h(t)\ge C_ce^{A_{\mathrm{cl}}t}\eta_b(0)$.

Definition — High-order CBF (Xiao & Belta, TAC 2022, Defs. 7–8)
For an $m$ times differentiable constraint $b(x,t)\ge 0$ of relative degree $m$ define, with class-$\mathcal K$ functions $\alpha_1,\dots,\alpha_m$ such that $\alpha_i$ is $(m-i)$ times differentiable for $i\lt m$, $$\psi_0:=b,\qquad \psi_i:=\dot\psi_{i-1}+\alpha_i(\psi_{i-1})\ \ (i=1,\dots,m),\qquad C_i:=\{x:\psi_{i-1}(x,t)\ge 0\}.$$ $b$ is an HOCBF of relative degree $m$ if $$\sup_{u\in U}\Big[L_f^mb+L_gL_f^{m-1}b\,u+\frac{\partial^mb}{\partial t^m}+O(b)+\alpha_m(\psi_{m-1})\Big]\ \ge\ 0\qquad\forall (x,t)\in (C_1\cap\dots\cap C_m)\times[t_0,\infty),$$ where $O(b)$ (a label, not big-O notation) collects the remaining Lie derivatives and time partials of order $\le m-1$; the bracket is exactly $\psi_m(x,t,u)$, and $K_{\mathrm{hocbf}}(x,t):=\{u\in U:\ \psi_m(x,t,u)\ge 0\}$. (The TAC text asks only for "differentiable" $\alpha_i$, but $\psi_i$ is differentiated $m-i$ more times on the way to $\psi_m$, e.g. $\psi_3$ contains $\alpha_1''(b)\,\dot b^2$, so $(m-i)$-fold differentiability is what the construction needs; Xiao, Belta & Cassandras, Adaptive CBFs, TAC 2022 state it this way, Def. 4 of the arXiv version, with $\alpha_m$ merely class-$\mathcal K$.) Theorem 4 (Theorem 5 in the CDC 2019 version): if $x(t_0)\in C_1(t_0)\cap\dots\cap C_m(t_0)$, every Lipschitz continuous $u(t)\in K_{\mathrm{hocbf}}$ renders $C_1\cap\dots\cap C_m$ forward invariant.
Worked example — The HOCBF constraint for relative degree two

For a time-independent $b$ with $L_gb\equiv 0$: $\psi_1=\dot b+\alpha_1(b)=L_fb+\alpha_1(b)$, and differentiating once more along $\dot x=f+gu$ (chain rule, with $\dot b=L_fb$), $$\psi_2=\dot\psi_1+\alpha_2(\psi_1)=L_f^2b+L_gL_fb\,u+\alpha_1'(b)\,L_fb+\alpha_2\big(L_fb+\alpha_1(b)\big),$$ which is affine in $u$, so $K_{\mathrm{hocbf}}$ is again $U$ intersected with a half-space. For time-dependent $b(x,t)$ each differentiation is $\dot\psi=\partial_t\psi+\nabla_x\psi^\top(f+gu)$, which produces the time partials and mixed terms collected in $O(b)$.

Derivation — HOCBF invariance by backward induction

Only the last function contains $u$ (the input enters $\psi_m$ through $\dot\psi_{m-1}$, and $L_gL_f^{m-1}b\neq 0$). Choosing $u\in K_{\mathrm{hocbf}}$ means $\psi_m=\dot\psi_{m-1}+\alpha_m(\psi_{m-1})\ge 0$, i.e. $$\dot\psi_{m-1}\ \ge\ -\alpha_m(\psi_{m-1}),\qquad \psi_{m-1}(x(t_0),t_0)\ge 0\ \ (\text{because }x(t_0)\in C_m).$$ By the comparison lemma of Section 2, $\psi_{m-1}(t)\ge 0$ for all $t\ge t_0$. But $\psi_{m-1}\ge 0$ reads $\dot\psi_{m-2}\ge-\alpha_{m-1}(\psi_{m-2})$, and $x(t_0)\in C_{m-1}$ gives $\psi_{m-2}(t_0)\ge 0$, so the same lemma yields $\psi_{m-2}(t)\ge 0$. Descending the chain, each step consumes one initial condition $x(t_0)\in C_i$ and delivers $\psi_{i-1}\ge 0$, until $\psi_0=b\ge 0$. Every nested set must contain $x(t_0)$: dropping one breaks the chain (the same requirement as $x_0\in\bigcap_iC_i$ for ECBFs above, and Xiao & Belta's Remark 1 notes that it can fail, e.g. if $b(x(t_0))=0$ and $\dot b(x(t_0))\lt 0$, whatever class-$\mathcal K$ functions are chosen). Since $\psi_{i-1}\ge 0$ is maintained on the nested sets, class-$\mathcal K$ functions on $[0,a)$ suffice, whereas the relative-degree-one CBF needed an extended class-$\mathcal K$ $\alpha$ to be meaningful outside $C$.

With linear $\alpha_i(r)=k_ir$, $k_i>0$, the recursion $\psi_i=\dot\psi_{i-1}+k_i\psi_{i-1}$ reproduces the ECBF exactly (Xiao & Belta, Rem. 3 of the TAC version): the HOCBF is the nonlinear generalization. Nonlinear $\alpha_i$ (their ACC example uses $\alpha_i(r)=r^2$) enlarge the feasible input region far from the boundary; and multiplying each $\alpha_i$ by a tunable penalty $p_i\ge 0$ is their recipe for recovering feasibility under input bounds.

Worked example — Double integrator with a position constraint

Take $\dot p=v$, $\dot v=u$ and the wall constraint $b(x)=p_{\max}-p\ge 0$. Then $\dot b=-v$ (no $u$: relative degree 2) and $\ddot b=-u$. With linear $\alpha_1(r)=k_1r$, $\alpha_2(r)=k_2r$: $$\psi_1=\dot b+k_1b=-v+k_1(p_{\max}-p),\qquad \psi_2=\dot\psi_1+k_2\psi_1=-u-k_1v+k_2\big(-v+k_1(p_{\max}-p)\big).$$ The HOCBF constraint $\psi_2\ge 0$ is a single affine inequality in $u$: $$u\ \le\ a(x):=k_1k_2\,(p_{\max}-p)-(k_1+k_2)\,v .$$ The invariant set is $C_1\cap C_2=\{p\le p_{\max},\ v\le k_1(p_{\max}-p)\}$: the admissible approach speed shrinks linearly with the distance to the wall. Compare with the physical braking limit under $|u|\le u_{\max}$, $v\le\sqrt{2u_{\max}(p_{\max}-p)}$, a parabola. At distance $\Delta$ the linear cone lies inside the parabola iff $k_1\Delta\le\sqrt{2u_{\max}\Delta}$, i.e. $\Delta\le 2u_{\max}/k_1^2$: far from the wall the linear HOCBF admits speeds the actuator cannot brake, and along such a trajectory the constraint eventually demands $u\le a(x)\lt-u_{\max}$ (otherwise the invariance theorem would keep $p\le p_{\max}$ with admissible inputs, which the braking limit rules out). This is the input-constraint feasibility problem of Section 3 in its simplest form; matching the parabola would need $\alpha_1(r)\propto\sqrt r$, which is not differentiable at 0 and so falls outside Xiao & Belta's hypotheses. In the walkthrough (Step 6) we show that the closed form for this scalar constraint reduces to clipping: $u^*=\min\{u_{\mathrm{nom}},a(x)\}$.

5. Robust CBFs, ISSf and Learned Residuals

Everything so far assumed the model is exact. With a model error the true barrier rate is $\dot h=L_fh+L_ghu+\nabla h^\top d$ for an unmatched error $\dot x=f+gu+d$, or $\dot h=L_fh+L_gh(u+d)$ for a matched error entering through the input channel. A CBF condition certified on the model can then fail by $|\nabla h^\top d|$. There are two responses: robustify the condition (accept a slightly larger invariant set), or learn the error and shrink it.

Input-to-state safety

Kolathaya & Ames, L-CSS 2019 consider a safeguarding controller $k(x)$ applied with a bounded additive input disturbance, $\dot x=\bar f(x)+g(x)d(t)$ with $\bar f:=f+gk$ and $\|d\|_\infty\le\bar d$, and ask for the safety analogue of input-to-state stability: invariance of a set that inflates with the disturbance and approaches $C$ as the chosen disturbance bound tends to zero.

Background — Disturbance signals and input-to-state stability

Here $|d(t)|$ means the Euclidean size of the disturbance at one time, whereas $\|d\|_\infty=\sup_{t\ge0}|d(t)|$ (see Primer 0) bounds the whole signal (for measurable signals, the essential supremum, which ignores values on a set of times of measure zero). Input-to-state stability bounds state error by a decaying initial-error term plus a function of disturbance size. ISSf replaces that state-error conclusion by invariance of an enlarged safe set.

With $D=\|d\|_\infty$, a precise ISS estimate is $\|x(t)\|\le\beta(\|x(0)\|,t)+\gamma(D)$: $\beta(r,t)$ increases from zero with $r$ and decreases to zero with $t$, while $\gamma$ is class-$\mathcal K$. For $\dot x=-x+d$, integration gives $x(t)=e^{-t}x(0)+\int_0^te^{-(t-s)}d(s)\,ds$, hence $|x(t)|\le e^{-t}|x(0)|+D(1-e^{-t})$: $\beta(r,t)=e^{-t}r$, $\gamma(D)=D$.

Definition — ISSf sets, ISSf-BFs and ISSf-CBFs (Kolathaya & Ames 2019, Defs. 3–5, eqs. 12, 20, 26)
For a class-$\mathcal K$ function $\gamma$ define the inflated set $$C_d:=\{x\in\mathbb R^n:\ h(x)+\gamma(\|d\|_\infty)\ge 0\}.$$ $C$ is (locally) input-to-state safe if there exist $\gamma\in\mathcal K_{[0,a)}$ with $\lim_{r\to a}\gamma(r)=b$ (so that $C_d$ stays inside the domain $D=\{h+b>0\}$) and $\bar d\in[0,a)$ such that $C_d$ is forward invariant for every $d$ with $\|d\|_\infty\le\bar d$. $h$ is an ISSf barrier function if there are an extended class-$\mathcal K$ $\alpha$ and a class-$\mathcal K$ $\iota$ with $$L_{\bar f}h(x)+L_gh(x)\,\mu\ \ge\ -\alpha(h(x))-\iota(|\mu|)\qquad\forall x\in D,\ |\mu|\le\bar d,$$ and $h$ is an ISSf control barrier function if $$\sup_{u\in U}\big[L_fh(x)+L_gh(x)(u+\mu)\big]\ \ge\ -\alpha(h(x))-\iota(|\mu|)\qquad\forall x\in D,\ |\mu|\le\bar d.$$
Theorem — ISSf (Kolathaya & Ames 2019, Thms. 1–2, eqs. 24–28)
Theorem 1. If $h$ is an ISSf-BF on $D$, then $C$ is ISSf with $\gamma=\beta^{-1}\circ\iota$, where $\beta(r):=-\alpha(-r)$, for every $\bar d$ such that $\beta^{-1}\circ\iota(\bar d)\lt b$ (their condition (24)), where $b>0$ is the constant fixing the domain $D=\{x: h(x)+b>0\}$ (their eq. 8) on which the ISSf-BF inequality holds; the condition guarantees $C_d\subset D$. For the linear choice $\alpha(h)=\lambda h$ the invariant set is (eq. 25) $$C_d=\Big\{x:\ h(x)+\tfrac{1}{\lambda}\,\iota(\|d\|_\infty)\ge 0\Big\}.$$ Theorem 2. If for all $x\in D$ $$\sup_{u\in U}\big[L_fh(x)+L_gh(x)u-L_gh(x)L_gh(x)^\top\big]\ \ge\ -\alpha(h(x)),$$ then $h$ is an ISSf-CBF, with $\iota(r)=r^2/4$. If $k$ is safeguarding ($L_fh+L_ghk\ge-\alpha(h)$), the controller $u(x)=k(x)+L_gh(x)^\top$ (eq. 27) satisfies the inequality in (28) whenever it lies in $U$ (always for $U=\mathbb R^m$); with input bounds one enforces the robust constraint together with the bounds, and in a QP the constraint becomes $L_fh+L_ghu-\varepsilon L_ghL_gh^\top\ge-\alpha(h)$ with a user gain $\varepsilon>0$ (ISSf-QP).
Derivation — Both ISSf theorems in a few lines

Theorem 1. Define $\eta(x,d):=h(x)+\gamma(\|d\|_\infty)$, so $C_d=\{\eta\ge 0\}$ and, since $\gamma(\|d\|_\infty)$ is a constant along the trajectory, $\dot\eta=\dot h$. On $\partial C_d$ we have $\eta=0$, i.e. $h=-\gamma(\|d\|_\infty)$. The ISSf-BF inequality with $\mu=d(t)$ and $|d(t)|\le\|d\|_\infty$ gives $$\dot\eta\ \ge\ -\alpha\big(-\gamma(\|d\|_\infty)\big)-\iota(\|d\|_\infty)=\beta\big(\gamma(\|d\|_\infty)\big)-\iota(\|d\|_\infty)=\iota(\|d\|_\infty)-\iota(\|d\|_\infty)=0,$$ using $\beta(r)=-\alpha(-r)$ and the choice $\gamma=\beta^{-1}\circ\iota$ (this is why $\gamma$ has that form: it is exactly what makes the two terms cancel). So $\dot\eta\ge 0$ on $\partial C_d$, and Nagumo gives forward invariance of $C_d$ provided $\nabla h\neq 0$ on $\partial C_d=\{h=-\gamma(\|d\|_\infty)\}$, i.e. $-\gamma(\|d\|_\infty)$ is a regular value of $h$. This is the analogue of the regularity assumption on $\partial C$ (a different level set, so it does not follow from it); the paper leaves it implicit by deferring to the proof of Prop. 1 of Ames et al. 2017. Condition (24), $\beta^{-1}\circ\iota(\bar d)\lt b$, keeps $C_d$ inside the domain $D$ where the inequality holds and makes $\beta$ a valid class-$\mathcal K$ function on the needed range.

Theorem 2. Let $u\in U$ be any input that satisfies the inequality inside (28), $L_fh+L_ghu-L_ghL_gh^\top\ge-\alpha(h)$. (The supremum itself need not be attained: for $U=\mathbb R^m$ and $L_gh\neq 0$ it is $+\infty$. The choice $u=k+L_gh^\top$ with a safeguarding $k$ works whenever it lies in $U$.) Then for the disturbed system $$\dot h(x,d)=L_fh+L_gh(u+d)\ \ge\ -\alpha(h)+|L_gh|^2+L_gh\,d\ \ge\ -\alpha(h)+|L_gh|^2-|L_gh|\,\|d\|_\infty .$$ The last step is Cauchy–Schwarz, $L_gh\,d\ge-|L_gh|\,|d|$ (see Primer A). Complete the square: $|L_gh|^2-|L_gh|\|d\|_\infty=\big(|L_gh|-\tfrac12\|d\|_\infty\big)^2-\tfrac14\|d\|_\infty^2\ge-\tfrac14\|d\|_\infty^2$. Hence $\dot h\ge-\alpha(h)-\|d\|_\infty^2/4$, which is the ISSf-CBF form with $\iota(r)=r^2/4$. The term $-L_ghL_gh^\top$ in the constraint is a robustness tax that grows with control authority; it buys an invariant set that inflates only by $\iota(\|d\|)/\lambda$.

ISSf-QP gain. With $-\varepsilon L_ghL_gh^\top$ in the constraint the same steps give $\dot h\ge-\alpha(h)+\varepsilon z^2-zD$ with $z=|L_gh|$, $D=\|d\|_\infty$, and $\varepsilon z^2-zD=\varepsilon\big(z-\tfrac{D}{2\varepsilon}\big)^2-\tfrac{D^2}{4\varepsilon}\ge-\tfrac{D^2}{4\varepsilon}$. So $\iota(r)=r^2/(4\varepsilon)$ and, for $\alpha(h)=\lambda h$, the set inflates by $D^2/(4\varepsilon\lambda)$: a larger $\varepsilon$ costs more control effort and buys a smaller inflation.

Learning the residual of $\dot h$

The alternative is to learn the error where it matters, which is only inside $\dot h$. Taylor, Singletary, Yue & Ames, L4DC 2020 note that with a nominal model $\hat f,\hat g$ the true barrier rate is $$\dot h(x,u)=\underbrace{\nabla h^\top(\hat f+\hat g u)}_{\text{nominal}}+\underbrace{\nabla h^\top\big((f-\hat f)+(g-\hat g)u\big)}_{=:\ b(x)+a(x)^\top u},$$ still affine in $u$ (here $a,b$ are Taylor et al.'s residual terms, not the $a,b$ of Section 3). They fit $\hat a,\hat b$ by empirical risk minimization (see Primer E) on data $(x_i,u_i,\dot h_i)$ (with $\dot h_i$ estimated from the measured trajectories), use $\widehat{\dot h}$ inside the LCBF-QP $\operatorname{arg\,min}\tfrac12\|u-k_d(x)\|^2$ s.t. $\widehat{\dot h}(x,u)\ge-\alpha(h)$, then run the filter, aggregate the new data DAgger-style and refit. The constraint stays affine and the QP stays convex; with a bound on the residual error, the ISSf argument above gives invariance of an inflated set. Validated on a Segway.

Cheng, Orosz, Murray & Burdick, AAAI 2019 (RL-CBF) do the same in discrete time with a GP: $s_{t+1}=f(s_t)+g(s_t)a_t+d(s_t)$, $|\mu_d(s)-d(s)|\le k_\delta\sigma_d(s)$ with probability $1-\delta$ (GP band, Module 3), affine $h=p^\top s+q$, and the compensator problem (their eq. 14, which the paper calls a QP although it prints the unsquared norm) $$\min_{a,\epsilon}\ \|a\|_2+K_\epsilon\,\epsilon\quad\text{s.t.}\quad p^\top f+p^\top g\,(u^{RL}_\theta(s_t)+a)+p^\top\mu_d(s_t)-k_\delta|p|^\top\sigma_d(s_t)+q\ \ge\ (1-\eta)h(s_t)-\epsilon,\quad a_{\mathrm{low}}\le a+u^{RL}_\theta\le a_{\mathrm{high}},\quad \epsilon\ge 0,$$ applied as $u=u^{RL}_\theta+u^{CBF}$. The paper leaves $\epsilon\ge 0$ implicit; without it the linear penalty rewards negative slack, i.e. an over-tightened constraint and a needlessly large correction. A large $K_\epsilon$ ($10^{12}$ in the paper) makes slack expensive but does not by itself force $\epsilon=0$ whenever the hard constraint can be met: this $\ell_1$ penalty is exact only if $K_\epsilon$ exceeds the Lagrange multiplier of the hard-constrained problem, which is $1/\|g^\top p\|$ for the unsquared norm without active bounds and is unbounded as the input loses authority over $h$ (for instance $\min_{0\le a\le 1}|a|+10^{12}\epsilon$ s.t. $10^{-13}a\ge 10^{-13}-\epsilon$, $\epsilon\ge 0$ is solved by $a=0$, $\epsilon=10^{-13}$ at cost $0.1$, not by the feasible $a=1$, $\epsilon=0$ at cost 1). Zero slack whenever possible needs a verified penalty bound, or solving the hard-constrained QP first and relaxing only if it is infeasible. With $\epsilon$ fixed to 0, $\|a\|_2$ and $\|a\|_2^2$ have the same minimizer; with slack their exactness thresholds differ ($1/\|g^\top p\|$ versus $2\|a^\star\|/\|g^\top p\|$), so the two objectives can differ even when the hard constraint is feasible. Lemma 1: if a solution with $\epsilon=0$ exists on all of $C$, $C$ is forward invariant with probability $1-\delta$; for $0\lt\eta\le 1$, if $\epsilon\le\epsilon_{\max}$ at every state of the enlarged set $\{h\ge-\epsilon_{\max}/\eta\}$, that set is forward invariant (the proof applies Definition 1 to $h+\epsilon_{\max}/\eta$). For $\eta=0$ no finite inflation follows: $h_{t+1}\ge h_t-\epsilon_{\max}$ lets $h$ drift down by $\epsilon_{\max}$ per step. The second contribution is to feed past CBF corrections back into the policy so the RL agent learns to stop proposing unsafe actions (TRPO or DDPG; inverted pendulum and car-following).

Derivation — The robust term $k_\delta|p|^\top\sigma_d$ and the exact-penalty threshold

Robust term. Read the GP band componentwise, $|d_j-\mu_{d,j}|\le k_\delta\sigma_{d,j}$, and let $|p|$ be the vector of absolute values $|p_j|$. On the event that every component lies in its band, $p^\top d=p^\top\mu_d+\sum_jp_j(d_j-\mu_{d,j})\ge p^\top\mu_d-\sum_j|p_j|\,k_\delta\sigma_{d,j}$, which is the term in the constraint. The confidence level must cover all components jointly, and all states and times if a whole trajectory is to be certified (see the caveat below).

Penalty threshold. Write the hard constraint as $c^\top a\ge r$ with $c=g^\top p\neq 0$ and suppose it is active ($r>0$) with no input bound active. The minimum-norm correction is $a^\star=rc/\|c\|^2$. Stationarity of $\|a\|-\mu(c^\top a-r)$ gives $a^\star/\|a^\star\|=\mu c$, hence $\mu=1/\|c\|$; for the squared norm, $2a^\star=\mu c$ gives $\mu=2\|a^\star\|/\|c\|$. The $\ell_1$ slack penalty is exact only if $K_\epsilon$ exceeds this $\mu$.

Caveat — "with probability $1-\delta$" is per step
The GP band in Cheng et al. is the marginal Gaussian quantile ($k_\delta=2$ for 95%), which holds at one state and one time. A statement about the whole trajectory needs a band that is uniform in time and space, i.e. the $\beta_t$ of Chowdhury–Gopalan or the data-dependent bound of Fiedler, Scherer & Trimpe (Module 3), with a known RKHS-norm bound, and the same "real $\beta$ versus heuristic $\beta$" issue as in Module 5 applies.

Learning the barrier itself

Robey et al., CDC 2020 learn $h_\theta$ from safe expert trajectories by a margin program (trained like a neural network, see Primer E), $$\min_\theta\ \|\theta\|^2+\lambda_s\!\!\sum_{x_i\in\bar X_{\mathrm{safe}}}\!\![\gamma_{\mathrm{safe}}-h_\theta(x_i)]_++\lambda_u\!\!\sum_{x_i\in X_N}\!\![h_\theta(x_i)+\gamma_{\mathrm{unsafe}}]_++\lambda_d\!\!\sum_{(x_i,u_i)\in Z_{\mathrm{dyn}}}\!\!\big[\gamma_{\mathrm{dyn}}-\langle\nabla h_\theta(x_i),f(x_i,u_i)\rangle-\alpha(h_\theta(x_i))\big]_+,$$ which is convex when $h_\theta$ is linear in $\theta$ and $\alpha$ is linear (then every hinge has an affine argument; their Sec. 3.4.1 makes this point for the constrained version of the program, whose Lipschitz constraints are checked afterwards). For DNNs or a nonlinear $\alpha$ it is non-convex and is trained by stochastic gradient methods. They prove with Lipschitz arguments on $\epsilon$-nets that if the samples are dense enough relative to the margins (schematically $\epsilon\lesssim\gamma/L$), the learned function is a valid CBF on the sampled region. The hinge form is reused by much of the later neural-CBF training, including the multi-agent GCBF+ of Section 9 and many of the certificates surveyed in Module 11; the PNCBF of Section 9 is a notable exception, since it regresses a policy value instead.

Background — Finite samples and epsilon-nets

Write $[r]_+=\max(0,r)$. The three losses penalize insufficient positivity on safe samples, insufficient negativity on unsafe samples, and violation of the derivative inequality on state-input demonstrations. A sample set is an $\epsilon$-net of a region if every point of that region lies within $\epsilon$ of a sample. If a residual $q$ is $L$-Lipschitz and every sample satisfies $q(x_i)\ge\gamma$, then choose a sample with $\|x-x_i\|\le\epsilon$ and use $q(x)\ge q(x_i)-L\|x-x_i\|\ge\gamma-L\epsilon$ throughout the covered region. Thus $\gamma\ge L\epsilon$ certifies nonnegativity there. A small average hinge loss alone does not establish these uniform sample inequalities.

For example, with $L=2$, covering radius $\epsilon=0.1$ and sample margin $\gamma=0.3$, every point has residual at least $0.3-2(0.1)=0.1$.

Finally, Choi, Lee, Sreenath, Tomlin & Herbert, CDC 2021 build the bridge to Section 6. Their robust control barrier-value function $$B_\gamma(x,t):=\min_{\xi_d\in\Xi_{[t,0]}}\ \max_{u(\cdot)\in\mathcal U_{[t,0]}}\ \min_{s\in[t,0]}e^{\gamma(s-t)}\,l(x(s))$$ is the HJ safety value of Section 6 with an exponential weight. It satisfies the CBVF variational inequality (see Primer D) $$0=\min\Big\{l(x)-B_\gamma(x,t),\ D_tB_\gamma+\max_{u\in U}\min_{d\in\mathcal D}D_xB_\gamma\cdot f(x,u,d)+\gamma B_\gamma(x,t)\Big\},\qquad B_\gamma(x,0)=l(x),$$ in the viscosity sense made precise below.

Background — Reading the CBVF as a game

Read this as a finite-horizon game on $[t,0]$, with $t\le0$: $u(\cdot)$ is a complete control signal, and $\xi_d$ is a rule that chooses disturbances using only controls already revealed. The inner minimum selects the worst safety margin along the trajectory. $D_tB$ is the time partial derivative and $D_xB$ is the state gradient. Section 6 develops these ingredients; the present paragraph may be read after it. The exponential weight is positive, so it does not change whether a fixed trajectory's margin stays nonnegative.

Theorem — The robust CBVF recovers the viability kernel (Choi et al. 2021, Thm. 3 and Prop. 2)
Assume $U\subset\mathbb R^m$ and $\mathcal D$ are compact and convex; $f(x,u,d)$ is bounded and Lipschitz in $x$; $l$ is bounded and Lipschitz; control and disturbance signals are measurable on $[t,0]$, $t\le 0$; the disturbance plays non-anticipative strategies $\xi_d\in\Xi_{[t,0]}$ (it may react to the control applied so far, never to future control); and $\gamma\ge 0$. (The paper takes the minimum and maximum in the definition of $B_\gamma$ to be attained, citing compactness and convexity of $U$ and $\mathcal D$.) Then (i) $B_\gamma$ is Lipschitz continuous and is the unique viscosity solution of the CBVF variational inequality with $B_\gamma(x,0)=l(x)$ (Thm. 3); (ii) for every $t\le 0$, $\{x: B_\gamma(x,t)\ge 0\}=S(t)$, the finite-horizon viability kernel of $\{l\ge 0\}$: the states from which, for every disturbance strategy, some control keeps $l(x(s))\ge 0$ for all $s\in[t,0]$ (Prop. 2). In particular this set is the same for every $\gamma\ge 0$.

In words: the exponential weight changes the value but not its sign pattern, so $B_\gamma$ keeps the largest possible safe set while behaving like a CBF: where $B_\gamma$ is differentiable, any $u$ in the safe-input set $K_{B_\gamma}$ below gives $\frac{d}{ds}\big(e^{\gamma s}B_\gamma(x(s),s)\big)=e^{\gamma s}\big(\dot B_\gamma+\gamma B_\gamma\big)\ge 0$ against every disturbance, i.e. $\dot B_\gamma\ge-\gamma B_\gamma$. Why the assumptions: compact sets and bounded Lipschitz data make the game value well defined and Lipschitz, which viscosity theory needs for existence and uniqueness; the non-anticipative strategy fixes the order "for every disturbance strategy there is a control", which cannot be swapped for its reverse; the horizon is finite, so (ii) certifies safety on $[t,0]$ only, not for all time; and the inequality holds only in the viscosity sense, so the classical CBF argument applies where $D_xB_\gamma$ exists (for kinks see the note below).

The safe-input set is $K_{B_\gamma}(x,t)=\{u\in U: D_tB_\gamma+\min_{d}D_xB_\gamma\cdot f(x,u,d)+\gamma B_\gamma\ge 0\}$ (their eq. 16). For dynamics affine in control and disturbance, $\dot x=p(x)+q(x)u+r(x)d$ (their eq. 18), the minimum over $d$ does not depend on $u$, so this set is $U$ intersected with a half-space in $u$, and with a polytopic $U$ the robust CBVF-QP is feasible wherever $D_xB_\gamma$ exists (Prop. 3). Unlike the least-restrictive switch, which acts only at the boundary, this filter adjusts any reference input everywhere inside $S(t)$ (their Remark 3); the paper claims nothing about the regularity of the resulting feedback, and where the gradient does not exist it falls back on super- or subdifferentials (Remark 4). In this precise sense $B_\gamma$ is a CBF with $\alpha(r)=\gamma r$ whose safe set is the largest possible one, and $\gamma=0$ recovers the HJ value itself.

Background — Derivatives at a kink

A supergradient $p$ gives a local upper linear approximation: $V(x+v)\le V(x)+p^\top v+o(\|v\|)$. A subgradient reverses the inequality. The remainder divided by $\|v\|$ tends to zero. For $V(x)=|x|$ at zero, the subgradients form $[-1,1]$; no classical derivative exists. For $-|x|$, the supergradients form $[-1,1]$. These are sets of possible slopes, not interchangeable choices of a gradient. A viscosity test uses a smooth function touching from above or below, so a barrier inequality at a kink needs the relevant nonsmooth theorem.

6. Hamilton–Jacobi Reachability

A CBF certifies a set you propose. Reachability computes the largest set that can be kept safe, together with the controller that does it, by solving a differential game offline. Consider $\dot x=f(x,u,d)$ with control $u\in U$ and disturbance $d\in\mathcal D$ (model error, an adversary, wind). The disturbance plays with non-anticipative strategies $\beta\in\mathcal B$: $\beta[u](t)$ may depend on $u$ only up to time $t$, which gives it the information advantage that makes the analysis worst-case.

Definition — Safety value function and safe set (Fisac et al. 2019, eqs. 5–6, Defs. 2–3, Prop. 3; Wabersich et al. 2023, eqs. 13–14)
Let the constraint set be $K=\{x: l(x)\ge 0\}$ with $l$ Lipschitz (a signed distance to the failure set works). For a trajectory $\xi$ from $x$ under signals $u(\cdot),d(\cdot)$ define the lowest margin ever attained and the game value $$V(x,u(\cdot),d(\cdot)):=\inf_{t\ge 0}l(\xi(t)),\qquad V(x):=\inf_{\beta\in\mathcal B}\ \sup_{u(\cdot)}\ V\big(x,u(\cdot),\beta[u](\cdot)\big).$$ Then $\Omega:=\{x: V(x)\ge 0\}$ is the discriminating kernel of $K$: the set of states from which the controller can keep the state in $K$ forever against every disturbance strategy, i.e. the maximal robust controlled invariant subset of $K$. Wabersich et al. (Thm. 2) add that every $\epsilon$-superlevel set $\{V\ge\epsilon\}$ is control invariant (a tunable buffer against numerical error), that $\{V\ge 0\}$ is the maximal control invariant set in $X$, and that for compact $U$, $\max_{u\in U}\nabla V(x)^\top f(x,u)\ge 0$ wherever $\nabla V$ exists on $\{V\ge 0\}$. (Fisac et al. state the characterization of $\Omega$ as a direct consequence of the definitions, their Prop. 3, inside their game setting: measurable signals, non-anticipative strategies $\beta$ and Lipschitz dynamics. At the zero level it also presumes that the supremum over $u(\cdot)$ is attained; a supremum equal to 0 does not by itself exhibit a safe control.)
Background — Almost everywhere and generalized ODE solutions

“Almost everywhere” permits exceptions on a set of measure zero, such as finitely many times or points. An absolutely continuous trajectory has changes equal to the integral of its derivative. A Carathéodory solution obeys $x(t)=x(0)+\int_0^t F(x(s))\,ds$, so the ODE need only hold almost everywhere. For example, $|t|$ has a kink at zero but is absolutely continuous on bounded intervals. Measurable signals are the very broad class (it contains every piecewise-continuous signal) for which such integrals make sense; that is why control and disturbance signals are taken to be measurable.

A Filippov solution instead allows velocities in the closed convex hull of nearby limiting velocities, ignoring measure-zero exceptions. At a switch between $-1$ and $1$, this can allow every velocity in $[-1,1]$. This helps describe discontinuous control, but its barrier proof must check the whole allowed velocity set. Rademacher’s theorem says a locally Lipschitz function on an open subset of Euclidean space is differentiable almost everywhere; it does not make the missing derivatives at kinks available.

Key equation — The HJI variational inequality (Fisac et al. 2019, eq. 7)
On a horizon $[0,T]$ the value $V(x,t)$ is the viscosity solution of $$\min\Big\{\,l(x)-V(x,t),\ \ \frac{\partial V}{\partial t}(x,t)+\max_{u\in U}\min_{d\in\hat{\mathcal D}(x)}\frac{\partial V}{\partial x}(x,t)\,f(x,u,d)\Big\}=0,\qquad V(x,T)=l(x).$$ Reading it: the value can never exceed the current margin $l(x)$ (that is the "inf over time"); where that constraint is inactive, the game's Hamilton–Jacobi equation holds. Why "viscosity solution": with Lipschitz $f$ and $l$ the value is Lipschitz, hence differentiable almost everywhere (Rademacher's theorem, as used in the proof of their Prop. 4), but in general not $C^1$: kinks appear where the optimal action switches or where the worst time shifts. The equation then holds wherever $V$ is differentiable and, at kinks, as one-sided inequalities for smooth test functions touching $V$ from above or below; in this weak sense the variational inequality has a unique solution, which is why it characterizes $V$. Behind it is the dynamic programming principle (see Primer D) $$V(x,t)=\inf_\beta\sup_{u}\min\Big\{\min_{s\in[t,t+\delta]}l(\xi(s)),\ V\big(\xi(t+\delta),t+\delta\big)\Big\},$$ whose discrete-time version is the safety Bellman equation below. As $T\to\infty$, $V(x,t)$ becomes independent of $t$ inside the safe set and one recovers $V(x)$. The optimal safe policy is (Def. 4) $$\kappa^*(x)=\operatorname*{arg\,max}_{u\in U}\ \min_{d\in\hat{\mathcal D}(x)}\ \frac{\partial V}{\partial x}(x)\,f(x,u,d),$$ and Prop. 4 states that every nonnegative superlevel set of $V$ is robust controlled invariant, not just $\{V\ge 0\}$ (Cor. 2: $\kappa^*$ keeps $\{V\ge\alpha\}$ invariant if the true $d(x)$ lies in $\hat{\mathcal D}(x)$ on the level set $\{V=\alpha\}$).
Derivation — Reading $\min\{A,B\}=0$ and where the Hamiltonian comes from

The equation $\min\{A,B\}=0$ means $A\ge0$, $B\ge0$, and at least one equals zero. Here $A=l-V$, so $V\le l$. Where $V\lt l$, we must have $B=0$. Along a differentiable trajectory, $\frac{d}{ds}V(x(s),s)=\partial_tV+\nabla_xV^\top f(x,u,d)$; maximizing over the controller and minimizing over the disturbance produces the Hamiltonian. At a kink, this calculation is replaced by the viscosity-solution theorem rather than by an arbitrarily chosen gradient.

Targets and tubes. The founding formulation of Mitchell, Bayen & Tomlin, TAC 2005 is phrased for a target $\{g\le 0\}$ (the unsafe set) and computes the set of states from which the minimizing player can force entry into it within time $\tau$, against the maximizing player: the zero sublevel set $\mathcal G(\tau)=\{x: v(x,-\tau)\le 0\}$ of the viscosity solution of $$D_tv(x,t)+\min\big[0,\ H(x,D_xv(x,t))\big]=0,\qquad v(x,0)=g(x),\qquad H(x,p)=\max_{a\in A}\min_{b\in B}p^\top f(x,a,b).$$ The $\min[0,\cdot]$ freezes $v$ once a trajectory has entered the target, which turns a reachable set (target hit at exactly time $\tau$) into a reachable tube (hit at some time within $\tau$). The tutorial of Bansal, Chen, Herbert & Tomlin, CDC 2017 writes the BRS as $\mathcal G(t)=\{x: G(t,x)\le 0\}$ with $D_tG+H(t,x,\lambda)=0$, $G(0,x)=g(x)$, $H=\max_{a}\min_{b}\lambda\cdot f(x,a,b)$ (eqs. 11–13), the optimal control $a^*=\operatorname{arg\,max}_a\min_b\lambda\cdot f$ (eq. 14), and the BRT as $$\mathcal G(t)=\{x:\ \exists\beta\in\Gamma(t),\ \forall a(\cdot)\in\mathcal A,\ \exists s\in[t,0]:\ \zeta(s;x,t,a(\cdot),\beta[a](\cdot))\in\mathcal G_0\}\qquad\text{(eq. 16)},$$ computed from a final-value PDE similar to the BRS one, for instance Mitchell's $\min\{0,H\}$ form. Their rule of thumb: whenever a set asks "there exists a control", that input is minimized in the Hamiltonian; "for all controls" means maximized. The safe set is the complement of the BRT of the failure set, and Fisac's $\{V\ge 0\}$ is the same object with $l=g$ (both margins are positive on the safe side), the horizon written as $[0,T]$ with $V(x,T)=l(x)$ instead of $[-\tau,0]$ with $v(x,0)=g(x)$, and one boundary convention swapped: Mitchell's target $\{g\le 0\}$ is closed, so the complement of the BRT is the open set $\{v\gt 0\}$, whereas Fisac's safe set $\{V\ge 0\}$ is closed and counts the level set $\{V=0\}$ as safe.

Pitfall — sign and time conventions differ between papers
PaperSafe / target encodingSafe set
Ames et al., Kolathaya & Ames, Wabersich et al. (CSM)$h\ge 0$ safe$\{h\ge 0\}$
Dawson, Gao & Fan (survey, Module 11)$h\le 0$ safe$\{h\le 0\}$
Mitchell 2005, Bansal 2017target (unsafe) $=\{g\le 0\}$, horizon $[t,0]$ with $t\le 0$complement of BRT $\{v\le 0\}$
DeepReachtarget (unsafe) $=\{l\le 0\}$, horizon $[t,T]$ with $V(x,T)=l(x)$complement of BRT $\{V\le 0\}$
Fisac 2019 (both), latent filters$l\ge 0$ safe$\{V\ge 0\}$
Gameplay filters$g\lt 0$ failure, $\ell\ge 0$ targetreach–avoid win $\{V\ge 0\}$
Hsu et al. RSS 2021$g>0$ failure, $l\le 0$ targetreach-avoid set $\{V\le 0\}$
So et al. (PNCBF)avoid set $\{h>0\}$$\{V\le 0\}$
Always check which player maximizes and whether the horizon is $[-T,0]$ or $[0,T]$ before comparing formulas.

The least-restrictive filter and the Fisac et al. safety framework

Because every superlevel set of $V$ is invariant, the filter can be lazy: apply any learning controller $\kappa_l$ while $V(x)>0$ and switch to $\kappa^*$ only on the boundary. Fisac et al., TAC 2019 wrap this around an arbitrary RL controller with two additions. First, the disturbance bound is learned: a GP on the unmodelled dynamics $d(x)$ gives a state-dependent set $\hat{\mathcal D}(x)$ containing $d(x)$ with probability $p$, and reachability is run with $d\in\hat{\mathcal D}(x)$. Second, the guarantee is monitored: their Prop. 5 shows that a level set which is robustly invariant under $\hat{\mathcal D}$ stays invariant if the true $d$ lies in $\hat{\mathcal D}$ merely on that level set's boundary, so what must be believed is not "the model is right everywhere" but "the model is right on some level set we can retreat to". The posterior probability of that event, the global safety confidence $\gamma(x)$ (their eq. 14: the posterior probability that some level set $\{V=\alpha\}$ with $0\le\alpha\le V(x)$ has $d\in\hat{\mathcal D}$ everywhere on it), drives the least-restrictive law (eq. 15) $$\kappa(x)=\begin{cases}\kappa_l(x), & \gamma(x)>\gamma_0\ \wedge\ V(x)>0,\\ \kappa^*(x), & \text{otherwise,}\end{cases}$$ with a cheaper local variant based on the reliability of $\hat{\mathcal D}$ at the current state (their Prop. 1, which bounds how long a locally reliable model stays reliable by Lipschitz constants). In experiments a quadrotor learning by policy gradient never crashes, including under an unmodelled fan. The switching itself is discontinuous and can chatter; the CBVF-QP of Section 5 is the minimally invasive alternative that acts everywhere inside the safe set rather than only on its boundary.

Background — Switching and chattering

Switching chooses between different control laws. If the decision changes whenever a measured margin crosses zero, small measurement noise can make the input alternate rapidly: this is chattering. For example, the rule $u=1$ for a negative measurement and $u=-1$ otherwise flips at every noisy sign change. Hysteresis uses separate switch-on and switch-off thresholds; a sampled controller holds the selected input between measurements. Both alter the mathematical system and require their own margin or hybrid-system safety proof.

Bridging to reinforcement learning

Grid-based HJ solvers scale exponentially in $n$ (Bansal & Tomlin put their direct use at up to about five state dimensions). Fisac, Lugovoy, Rubies-Royo, Ghosh & Tomlin, ICRA 2019 observed that the undiscounted safety Bellman equation $V(x)=\min\{l(x),\max_uV(f(x,u))\}$ is not a contraction (see Primer E), so temporal-difference methods have no convergence guarantee, but a discounted version is:

Key equation — Discounted safety Bellman equation (Fisac et al., ICRA 2019)
$$V(x)=(1-\gamma)\,l(x)+\gamma\,\min\Big\{l(x),\ \max_{u\in U}V\big(f(x,u)\big)\Big\},\qquad\gamma\in[0,1),$$ with the Q-learning target $Q(x,u)\leftarrow(1-\gamma)l(x)+\gamma\min\{l(x),\max_{u'}Q(x^+,u')\}$. The right-hand side defines a $\gamma$-contraction in the sup norm, so exact value iteration converges; tabular Q-learning converges under the hypotheses of the theorem below, and deep RL is used to approximate the HJ safe set and policy without a model or a grid; as $\gamma\to 1$ the undiscounted value is recovered and the safe set is $\{V\ge 0\}$.
Theorem — Convergence of discounted safety learning (Fisac et al., ICRA 2019, plus standard stochastic approximation)

For finite state/action sets, bounded $l$, deterministic transition $f$ and $0\le\gamma\lt1$, define $TQ(x,u)=(1-\gamma)l(x)+\gamma\min\{l(x),\max_vQ(f(x,u),v)\}$. Then (i) (Fisac et al.) $T$ is a $\gamma$-contraction in the sup norm, $\|TQ_1-TQ_2\|_\infty\le\gamma\|Q_1-Q_2\|_\infty$, so it has a unique fixed point $Q^*$ and exact iteration $Q_{j+1}=TQ_j$ converges to it from any bounded table.

(ii) (the standard convergence theorem for tabular Q-learning, applied to $T$) For asynchronous updates $Q_{j+1}(x,u)=Q_j(x,u)+a_j(Y_j-Q_j(x,u))$, require infinite updates of every pair; per-pair step sizes $0\lt a_j\le1$, $\sum_j a_j=\infty$, $\sum_j a_j^2\lt\infty$; and $Y_j=TQ_j(x,u)+M_j$ with conditional mean-zero noise and uniformly bounded conditional second moment. Then $Q_j\to Q^*$ almost surely. Exact targets have $M_j=0$; noisy state predictions need not yield unbiased targets.

Contraction shrinks errors, infinite visits prevent neglected entries, and the step-size sums allow continued correction while averaging noise. For example $a_j=1/(j+1)$ works. Neural approximations and general stochastic transitions need separate analysis.

Proof sketch — Why discounting gives a contraction

Let $\mathcal B[V](x):=(1-\gamma)l(x)+\gamma\min\{l(x),\max_uV(f(x,u))\}$. Two elementary facts: $|\min\{c,p\}-\min\{c,q\}|\le|p-q|$ and $|\max_up_u-\max_uq_u|\le\max_u|p_u-q_u|$ (both because $\min$ and $\max$ are 1-Lipschitz in each argument). Hence $$|\mathcal B[V_1](x)-\mathcal B[V_2](x)|\le\gamma\,\Big|\max_uV_1(f(x,u))-\max_uV_2(f(x,u))\Big|\le\gamma\max_u|V_1(f(x,u))-V_2(f(x,u))|\le\gamma\|V_1-V_2\|_\infty ,$$ so $\|\mathcal B[V_1]-\mathcal B[V_2]\|_\infty\le\gamma\|V_1-V_2\|_\infty$. The $(1-\gamma)l$ term cancels in the difference; its role is to make the fixed point a convex combination of "current margin" and "future margin" so that the whole operator, not only the $\max$, is scaled by $\gamma$. Exercise 10.5 iterates this by hand and shows the non-uniqueness that discounting removes.

Caveat — conservativeness of the discounted safe set
For $\gamma\lt 1$ the zero superlevel set of the discounted safety-only value is not guaranteed to be a subset of the true safe set (the discount trades a little future margin for present margin). The reach-avoid formulation below is different: Hsu, Rubies-Royo, Tomlin & Fisac, RSS 2021 prove that their discounted set is always an under-approximation. Neither statement transfers to a neural approximation of the value, whose errors are uncontrolled (DeepReach values and latent filters are not certified).

Reach-avoid. Hsu et al. (RSS 2021) add liveness: with $l(s)\le 0\iff s\in\mathcal T$ (target) and $g(s)>0\iff s\in\mathcal F$ (failure), the reach-avoid set $RA=\{V\le 0\}$ is characterized by the reach-avoid Bellman equation (their eq. 10) $$V(s)=\max\Big\{g(s),\ \min\big\{l(s),\ \min_{u}V(s^u_+)\big\}\Big\},$$ and its discounted version (eq. 15) $$V_\gamma(s)=\gamma\max\Big\{\min\big\{\min_uV_\gamma(s^u_+),\,l(s)\big\},\,g(s)\Big\}+(1-\gamma)\max\{l(s),g(s)\}$$ is a sup-norm contraction for every $\gamma\in[0,1)$ (Prop. 1), tabular Q-learning on a finite discretization converges to it with probability 1 (Prop. 2, via the standard Q-learning conditions), its fixed point converges to that of the undiscounted equation as $\gamma\to 1$ (Prop. 3), and (Thm. 1) $RA_{\gamma_1}\subseteq RA_{\gamma_2}\subseteq RA$ for $0\le\gamma_1\le\gamma_2\lt 1$, with $RA_\gamma\to RA$ in Hausdorff distance as $\gamma\to 1$ provided $RA$ has non-empty interior and $V$ is nowhere locally constant on its zero level set. The deep-RL solution is then used as an untrusted oracle inside a supervisory filter that keeps the zero-violation guarantee.

Background — Hausdorff distance

For nonempty compact sets, $d_H(A,B)=\max\{\sup_{a\in A}\operatorname{dist}(a,B),\sup_{b\in B}\operatorname{dist}(b,A)\}$. A small Hausdorff distance means every point of either set is close to the other set. Convergence of values alone need not make their zero level sets converge: a value that is identically zero on a region can change sign there under an arbitrarily small perturbation. The stated non-flatness assumption excludes that obstruction.

For intervals $A=[0,1]$ and $B=[0.2,1.2]$, $d_H(A,B)=0.2$.

Neural PDE solvers. DeepReach (Bansal & Tomlin, ICRA 2021) trains a sine-activation network $V_\theta(x,t)$ self-supervised on the variational inequality itself, $$\mathcal L=\big\|V_\theta(x_i,t_i)-l(x_i)\big\|\,\mathbb 1(t_i=T)+\lambda\,\Big\|\min\{D_tV_\theta+H(x_i,t_i),\ l(x_i)-V_\theta(x_i,t_i)\}\Big\|,\qquad H=\max_u\min_d\langle\nabla V_\theta,f\rangle,$$ where the indicator $\mathbb 1(t_i=T)$ is 1 for terminal-time samples and 0 otherwise (see Primer C), with a weight $\lambda\gt 0$ and a curriculum that grows the horizon backward from $t=T$, so the cost scales with the complexity of $V$ rather than with a grid (9-D multi-vehicle and 10-D narrow-passage examples). It is a physics-informed approximation with no formal guarantee. The connection to Module 7 is exact: $\{V\ge 0\}$ is the viability (discriminating) kernel, and the safe value functions of Massiani et al. are the penalty route to the same set.

7. Predictive Safety Filters (Wabersich & Zeilinger)

A CBF-QP looks one derivative ahead and needs an explicit invariant set $C$. A predictive safety filter looks $N$ steps ahead (see Primer D) with a model and needs only a small terminal safe set: the invariant set it enforces is implicit, namely the set of states from which a feasible backup plan exists. Wabersich & Zeilinger, Automatica 2021 formulate it for discrete-time $x(k+1)=f(x(k),u(k);\theta_R)$ with constraints $X$, $U$, an RL input $u_L(k)=\pi_L(k,x(k))$ and the filtered input $u(k)=\pi_S(k,x(k),u_L(k))$. The filter turns the constrained system into the unconstrained "safe system" $f_S(k,x,u_L):=f(x,\pi_S(k,x,u_L))$ on which any RL algorithm may run. An input $u_L(\bar k)$ is certified (Def. 3.1) if $\pi_S(\bar k,x(\bar k),u_L(\bar k))=u_L(\bar k)$ and continuing with the filter keeps the system safe forever.

Key equation — Nominal predictive safety filter (Wabersich & Zeilinger 2021, problem (5), Assumption 4.2)
$$\begin{aligned} \min_{\{u_{i|k}\}}\ &\|u_L(k)-u_{0|k}\| \\ \text{s.t.}\ \ &x_{i+1|k}=f(x_{i|k},u_{i|k};\bar\theta),\quad x_{i|k}\in X,\quad u_{i|k}\in U,\quad (x_{i|k},u_{i|k})\in Z_c\qquad i=0,\dots,N-1,\\ &x_{N|k}\in S^t,\qquad x_{0|k}=x(k). \end{aligned}$$ Notation. $x_{i|k}$ is the state predicted $i$ steps ahead from the information at time $k$ (not a conditional expectation) and $u_{i|k}$ the planned input; $\bar\theta$ is the nominal model parameter used for planning ($\theta_R$ is the real one); the superscript $t$ in $S^t$ means terminal, and for vector-valued $a_S$ the inequality $a_S(x)\le\mathbf 1$ holds componentwise. $Z_c$ is the region where the model is trusted (Assumption 4.1). Assumption 4.2 (terminal safe set): there is a set $S^t=\{x: a_S(x)\le\mathbf 1\}\subseteq X$ with Lipschitz $a_S$ and a terminal safety filter $\pi_S^t$ such that if $x(\bar k)\in S^t$, applying $u(k)=\pi_S^t(k,x(k),u_L(k))$ gives $x(k)\in X$ and $u(k)\in U$ for all $k>\bar k$ (the paper suggests a terminal set of nonlinear robust MPC, a region around a stable steady state, or expert knowledge; a set kept invariant by a discrete-time CBF controller with admissible inputs would also qualify).
Algorithm 2: Nominal predictive safety filter $\pi_S(k,x(k),u_L(k))$ (Wabersich & Zeilinger 2021, Alg. 1)
  1. If problem (5) is feasible with horizon $N$: set $\bar k:=k$ and return $u^*_{0|k,N}$. // the RL input is certified iff $u^*_{0|k}=u_L(k)$
  2. Else if $k\lt N+\bar k$: solve (5) with the shrunk horizon $N-(k-\bar k)$ and return $u^*_{0|k,N-(k-\bar k)}$. // follow the last backup plan towards $S^t$
  3. Else: return $\pi_S^t(x(k))$. // inside the terminal safe set
Derivation — Recursive feasibility implies safety for all time

Assume (5) is feasible at $k=0$ and the model is exact on $Z_c$. Let $\bar k$ be the last time the full-horizon problem was feasible, with optimal plan $u^*_{0|\bar k},\dots,u^*_{N-1|\bar k}$ and predicted states $x^*_{1|\bar k},\dots,x^*_{N|\bar k}\in X$ with $x^*_{N|\bar k}\in S^t$.

Induction step. Suppose that at time $\bar k+j-1$ ($1\le j\le N-1$) the filter solved (5) with horizon $N-(j-1)$ and applied the first input of the plan it found (for $j=1$ this is the full-horizon plan above). Because the model is exact on $Z_c$, the next state $x(\bar k+j)$ is that plan's first predicted state, and the plan's tail is a feasible solution of (5) at time $\bar k+j$ with horizon $N-j$: its states and inputs satisfy $X$, $U$, $Z_c$, and its last state is the same point of $S^t$. Hence line 2 of the algorithm always has a solution. It need not return that tail, because it re-optimizes, but whatever it returns is again a feasible plan that reaches $S^t$ at the fixed deadline $\bar k+N$, so the induction continues with the most recent plan; the applied inputs need not coincide with those of the plan computed at $\bar k$. Every such plan keeps $x(\bar k+j)\in X$ and $u(\bar k+j)\in U$. At time $\bar k+N$ the state is the terminal state of the last (horizon-1) plan, hence in $S^t$, and Assumption 4.2 guarantees constraint satisfaction under $\pi_S^t$ from then on. If at any time the full-horizon problem becomes feasible again, line 1 resets $\bar k$ and the argument restarts. By induction every applied input is either the first element of a feasible backup plan or a terminal-filter input, so $x(k)\in X$, $u(k)\in U$ for all $k$.

The classical variant. If additionally $S^t$ is control invariant under $\pi_S^t$ (the terminal law keeps the state inside $S^t$) and the model is trusted there, $(x,\pi_S^t(x))\in Z_c$ for $x\in S^t$, one can append the terminal input at the plan's last state to the shifted tail and obtain a feasible candidate of full length $N$ at every step, the standard recursive-feasibility argument of MPC. Then line 1 is always feasible and the feasible set of (5) is itself invariant. This is the "safe candidate" of Hose et al. 2025 (Module 11). The paper's uncertain-case proof keeps the shrinking-horizon structure instead: its Lemma A.4 uses the tracking policy of Assumption 4.3 to turn a feasible plan of horizon $N$ at time $k$ into a feasible plan of horizon $N-1$ for the tightened problem (6) at time $k+1$. What fails without a terminal set: after $N$ steps of a plan that merely satisfies constraints there is no reason a new plan exists, and the filter can become stuck at a state with no feasible continuation (Exercise 10.6).

Uncertain models. Beyond $Z_c$ the paper replaces $f(\cdot;\bar\theta)$ by the mean model of a Bayesian parametric belief $p(\theta|\mathcal D)$ (see Primer C), predicts nominal states $\mu_{i|k}$, and tightens the constraints along the horizon: $\mu_{i|k}\in\bar X_i$, $v_{i|k}\in\bar U_i$, $\mu_{N|k}\in\bar S^t_N$, plus a model-confidence constraint $\mathcal E_{p_S}(\mu_{i|k},v_{i|k})\subseteq\bar{\mathcal E}^\gamma_i$ (problem (6)). Here $\mathcal E_{p_S}$ (Def. 4.4) is a set-valued map (see Primer 0) with $\Pr(\forall k: e(k)\in\mathcal E_{p_S}(x(k),u(k)))\ge p_S$ for the one-step prediction error $e$, obtained from a confidence region of the parameter posterior; $\gamma$ scales the admissible error set. Under a tracking assumption (Assumption 4.3: a policy $\pi$ and an incremental Lyapunov function $V_{\mathrm{inc}}$ (their $V$) with $c_l\|x-\mu\|^2\le V_{\mathrm{inc}}(x,\mu,v)\le c_u\|x-\mu\|^2$ that contracts at rate $\rho\in(0,1)$, $V_{\mathrm{inc}}^+\le\rho V_{\mathrm{inc}}$, in a neighbourhood of the nominal plan; under this nominal tracking assumption with no fresh disturbance, the deviation therefore decays like $\|x_i-\mu_i\|\le\sqrt{c_u/c_l}\,\rho^{i/2}\|x_0-\mu_0\|$, which is why the increments of the constraint tightening (their eq. 10) are $\epsilon\sqrt{\rho}^{\,i}$ for the tightening factor $\epsilon$ below) and Lipschitz continuity of $\mathcal E_{p_S}$ (Assumption 4.5), together with the terminal safe set of Assumption 4.2, Theorem 4.6 states: for a tightening factor $\epsilon>0$ and a sufficiently small Lipschitz constant $L_{\mathcal E_{p_S}}$ one can pick $\gamma>0$ such that initial feasibility of (6) implies $$\Pr\big(\forall k\in\mathbb I_{[0,\bar N]}:\ x(k)\in X,\ u(k)\in U\big)\ \ge\ p_S .$$ The mechanism is the one of tube MPC (Mayne, Seron & Raković, Automatica 2005; see Primer D): the tightening pays for the accumulated prediction error, and the confidence constraint forces backup plans to enter poorly modelled regions only "carefully". The whole guarantee is conditional on the Bayesian error model being calibrated; the GP versions of this statement (Koller et al. 2018) inherit the RKHS-norm caveats of Module 3.

Derivation — Where the decay $\sqrt{c_u/c_l}\,\rho^{i/2}$ comes from

Write $\delta_i=x_i-\mu_i$ for the deviation from the plan and $V_i=V_{\mathrm{inc}}(x_i,\mu_i,v_i)$. The two quadratic bounds and the contraction give $c_l\|\delta_i\|^2\le V_i\le\rho^iV_0\le\rho^ic_u\|\delta_0\|^2$, i.e. $\|\delta_i\|\le\sqrt{c_u/c_l}\,\rho^{i/2}\|\delta_0\|$. This compares trajectories under the tracking assumption alone, with no fresh error at each step; with continuing prediction errors each new error adds to the tube, which is why the tightening accumulates the increments $\epsilon\sqrt\rho^{\,i}$ instead of assuming that the actual error decays to zero.

Background — Set-valued uncertainty

A set-valued map returns a set of possible errors at each state-input pair. For compact error sets, a common Lipschitz convention is $d_H(\mathcal E(z),\mathcal E(z'))\le L_{\mathcal E}\|z-z'\|$. The barred sets $\bar X_i,\bar U_i,\bar S_N^t$ are tightened nominal constraints: the omitted margin accommodates the predicted error tube. Here $\mathbb I_{[0,\bar N]}=\{0,1,\ldots,\bar N\}$ is the time range of the probability statement; its guarantee should not be silently read as an infinite-horizon claim.

For example, $\mathcal E(z)=[-r(z),r(z)]$ has Hausdorff change $|r(z)-r(z')|$; a Lipschitz radius therefore gives a Lipschitz error-set map.

CBF-QP filterPredictive safety filter
Look-aheadone derivative ($\dot h$)$N$ steps with a model
Invariant setexplicit $C=\{h\ge 0\}$, must be designedimplicit: states with a backup plan into $S^t$; the feasible set of (5) is where certification starts but is itself invariant only if $S^t$ is control invariant; only $S^t$ is designed
Model needed online$f,g,\nabla h$ at the current statefull predictive model (and its uncertainty)
Online costclosed form or tiny QPnonlinear program every step
Input constraintsmay make the QP infeasiblehandled by construction
Fallbacknone stored (needs $\alpha$, $h$ to be valid)the stored backup plan plus $\pi_S^t$
After a violation$C$ asymptotically stable (Section 2)predictive CBF (below)

Seen through this table, the CBF-QP is a predictive filter with $N=1$ whose terminal set is $C$ itself and whose one-step invariance test has been relaxed to $\dot h\ge-\alpha(h)$. The price of the horizon is the online NLP and the model; the reward is that the safe set is defined implicitly by feasibility, so input constraints, state constraints and model confidence all enter uniformly. Wabersich & Zeilinger, TAC 2023 close the remaining gap with predictive CBFs. An auxiliary soft-constrained problem with slacks $\xi_i\ge 0$ on tightened state constraints and a terminal CBF $h_f$, $h_{PB}(x)=\min_{u,\xi}\ \alpha_f\xi_N+\sum_{i\lt N}\|\xi_i\|$ subject to the dynamics and the slackened constraints (their (9), written out below), is feasible for every state. For $\alpha_f$ large enough, under the assumptions of the theorem below (their Thm. III.6), its optimal value is a discrete-time CBF in their sign convention ($h\le 0$ safe) on the domain $D_{PB}=\{x: h_{PB}(x)\le\alpha_f\gamma_f\}$, where the level $\gamma_f$ comes from the terminal CBF's domain: $\inf_{u\in U}h_{PB}(f(x,u))-h_{PB}(x)\le-\Delta h_{PB}(x)$ with a continuous $\Delta h_{PB}>0$ outside $S_{PB}=\{h_{PB}=0\}$. The recovery filter therefore renders $S_{PB}$ asymptotically stable with region of attraction $D_{PB}$; because of the tightening, $S_{PB}$ is only a subset of the original filter's feasible set. After a model error or disturbance that leaves the state inside $D_{PB}$, the system returns to safety instead of stalling. The learning-based MPC lineage behind all this, from the LBMPC of Aswani et al., Automatica 2013 (robust nominal tube for safety, learned oracle only in the cost) through the GP-ellipsoid safe MPC of Koller et al., CDC 2018 to the review of Hewing et al., Annu. Rev. 2020, is the subject of Module 11; the backup-policy idea of GoSafe (Module 6) is the same principle in parameter space.

Derivation — The full soft-constrained problem behind $h_{PB}$

Write the state constraints as $c(x)\le 0$ componentwise, with $c$ continuous and vector-valued, and fix tightening levels $0=\Delta_0\lt\Delta_1\lt\cdots\lt\Delta_{N-1}$. Problem (9) of the paper is

$$\begin{aligned}h_{PB}(x)=\min_{x_i,u_i,\xi_i}\;&\alpha_f\xi_N+\sum_{i=0}^{N-1}\|\xi_i\|\\ \text{s.t.}\;&x_0=x,\quad x_{i+1}=f(x_i,u_i),\quad u_i\in U,\\ &c(x_i)\le-\Delta_i\mathbf1+\xi_i,\quad \xi_i\ge0\quad(0\le i\lt N),\\ &h_f(x_N)\le\xi_N,\quad \xi_N\ge0.\end{aligned}$$

The terminal slack $\xi_N$ is a scalar; each stage slack $\xi_i$ has one entry per state constraint, and $X_i(\xi):=\{x:\ c(x)\le-\Delta_i\mathbf 1+\xi\}$ is the slackened, tightened constraint set. Without these constraints the minimum would trivially be 0. Cost 0 forces every slack to vanish, i.e. a tightened, constraint-satisfying path into $S_f=\{h_f\le 0\}$ exists. Shifting the plan by one step moves old stage $i+1$ to new stage $i$, whose constraint is looser by $\Delta_{i+1}-\Delta_i\gt 0$, so the slacks can shrink: this is what makes $h_{PB}$ decrease.

Theorem — Predictive CBF (Wabersich & Zeilinger, TAC 2023, Thm. III.6 with Def. III.1 and Thm. III.4)
Assume $U$ is compact and $X_0(\xi)=\{x:\ c(x)\le\xi\}$ is compact for every $0\le\xi\lt\infty$. Assume the terminal function $h_f$ is continuous on $\mathbb R^n$ and is a discrete-time CBF in the sense of their Def. III.1 (Assumption 1): its safe set $S_f=\{h_f\le 0\}$ and its domain $D_f\supset S_f$ are nonempty and compact, and a continuous $\Delta h_f$, positive on $D_f\setminus S_f$, satisfies $\inf_{u\in U}h_f(f(x,u))-h_f(x)\le-\Delta h_f(x)$ on $D_f\setminus S_f$ and $\inf_{u\in U}h_f(f(x,u))\le 0$ on $S_f$. Let $S_f\subset X_{N-1}(0)$. Then the minimum in (9) exists, and for a large enough finite $\alpha_f$ the value $h_{PB}$ is a discrete-time CBF in the same sense, with domain $D_{PB}=\{x:\ h_{PB}(x)\le\alpha_f\gamma_f\}$ (where $\gamma_f>0$ is chosen so that $\{h_f\le\gamma_f\}\subseteq D_f$) and safe set $S_{PB}=\{h_{PB}=0\}$. Choosing at every step an input from the corresponding safe-input set (decrease outside $S_{PB}$, stay in $S_{PB}$ inside it; their Algorithm 1) renders $S_{PB}$ asymptotically stable in $D_{PB}$ (Thm. III.4).

In words: the soft-constrained value is zero exactly where a tightened, constraint-satisfying plan into $S_f$ exists, and elsewhere it can be driven down step by step, so the recovery filter steers any state of $D_{PB}$ back to that set. Why the assumptions: compactness of $U$ and of the slackened constraint sets keeps minimizing sequences from escaping (existence and continuity of $h_{PB}$); the terminal CBF pays for the input appended at the end of the shifted plan; the tightening makes the shifted slacks strictly smaller; a large $\alpha_f$ makes terminal violations dominate the cost. The guarantee uses the exact model $f$ from the perturbed state on, and asymptotic stability does not promise entry into $S_{PB}$ in finite time.

8. Shields and the Unified Safety-Filter View

The formal-methods community arrived at the same architecture from discrete specifications. Alshiekh et al., AAAI 2018 define safe RL as learning an optimal policy while a temporal-logic safety specification $\varphi_s$ holds during learning and execution (their Def. 1), and enforce it with a shield, a reactive system synthesized by solving a safety game.

Background — Safety specifications and automata

A safety specification forbids finite histories that already demonstrate failure. A deterministic safety automaton stores the relevant history in a finite state $q\in Q$: $q_0$ is its initial state, $\Sigma$ its alphabet, $\delta$ its transition rule, and $F$ the states in which no violation has occurred. For example, 'never issue move while the door is open' can be checked from door labels and actions. A product state $(q,q_M)$ records both the specification state and the environment-model state. An environment conforms to the abstraction when all its observed transitions are allowed by that model.

Algorithm idea — Shield synthesis (Alshiekh et al. 2018, Sec. 6)
Inputs: the specification as a deterministic safety automaton $\varphi_s=(Q,q_0,\Sigma,\delta,F)$ over $\Sigma=L\times A$ (labels $L$ of an observer $f:S\to L$ on the MDP, actions $A$), and a finite abstraction $\varphi_M=(Q_M,q_{0,M},A\times L,\delta_M,F_M)$ of the environment.
  1. Build the product safety game $\mathcal G=(Q\times Q_M,\ g_0,\ \Sigma_I=L,\ \Sigma_O=A,\ \delta,\ F^g)$ with safe states $F^g=(F\times Q_M)\cup(Q\times(Q_M\setminus F_M))$: the play is safe if the specification is satisfied or the environment left its abstraction (the shield is only responsible for environments that conform to the model).
  2. Compute the winning region $W\subseteq F^g$ by standard safety-game solving (the greatest fixed point of "safe now and able to stay in the set next step whatever the environment does").
  3. Preemptive shield: before the agent acts, output the safe action set $\lambda_S(g,l)=\{a\in A:\ \delta(g,l,a)\in W\}$; the agent chooses from it. Post-posed shield: let the agent choose $a^1_t$, forward it if $\delta(g,l,a^1_t)\in W$, otherwise substitute a winning action (the agent may supply a ranking $\mathrm{rank}_t$ and the shield picks the first safe entry).
The shield is correct (the specification is never violated in any conforming environment) and minimally interfering (it changes an action only when it must). In the post-posed setting the paper discusses two ways to reward the overridden action, punishing it or crediting it with the executed action's reward, and gives conditions under which the learner's convergence guarantees are preserved; in both cases the shield must remain active after learning.
Background — Safety games and fixed points

Start with $W_0=F^g$. For the move order used here, repeatedly compute $W_{j+1}=\{g\in W_j:\forall l\in L\ \exists a\in A,\ \delta(g,l,a)\in W_j\}$. The environment reveals $l$ before the shield chooses $a$, which explains the order $\forall l\exists a$. Each iteration deletes states from which one more safe round cannot be guaranteed. On a finite game this process stops; its final set is $W$, the greatest fixed point. Certification also requires the initial product state $g_0\in W$.

A state with an environment label for which every action reaches failure is deleted on the first pass; its predecessors may be deleted next. Since the game has finitely many states, at most that many strict deletions can occur. A controller that acts before seeing the label instead needs $\exists a\,\forall l$, a stronger condition.

Read against Sections 3–7, the winning region $W$ is the maximal safe set of the abstraction (a discrete discriminating kernel), the preemptive shield is the exact analogue of $K_{\mathrm{cbf}}(x)$, and the post-posed shield is a least-restrictive filter whose "projection" is a ranking rather than a Euclidean distance. The abstraction plays the role of the model, and the guarantee is exactly as good as the abstraction. The survey and benchmark of Krasowski, Thumm, Müller, Schäfer, Wang & Althoff, TMLR 2023 sorts provably safe RL by how the action is adapted: action replacement (post-posed shields, switching filters), action projection (CBF-QPs, predictive filters) and action masking (preemptive shields). On their inverted-pendulum and quadrotor tasks replacement performed best, and a reward penalty whenever the safety verification intervenes improved training.

The universal safety filter theorem

Hsu, Hu & Fisac, Annu. Rev. 2024 distil every filter into three components acting on an information state $\eta\in\mathcal H$ (the state $x$ when it is fully observed): a fallback policy $\pi^{\mathrm{fb}}$, a safety monitor $\Delta^{\mathrm{fb}}$ and an intervention scheme $\phi$. Their Prop. 1 first records the ideal: with the maximal safe set $\Omega^*$ there exists a perfect (least-restrictive) filter that alters an action only if it would leave $\Omega^*$ in one step, and the safe decision problem becomes an unconstrained one on the filtered dynamics $u_k=\phi(x_k,\pi^{\mathrm{task}}(x_k))$. Everything else approximates it.

Background — Information states

With full observation, take $\eta=x$, $f^\eta=f$, and let $\mathcal F^\eta$ be the ordinary failure set. With partial observation, $\eta$ must summarize the observation history sufficiently to update the possible current states; it might be a set of states compatible with the measurements. Then $f^\eta$ is the update of that information, and $\eta\in\mathcal F^\eta$ means at least one compatible physical state is already a failure. The monitor must cover every state and disturbance compatible with this information.

For example, a position sensor reporting $2\pm0.1$ gives the compatible set $[1.9,2.1]$. Propagate every point through the model, then intersect with the next measurement set to update the information state.

Theorem — Safety filter (Hsu, Hu & Fisac 2024, Defs. 1–2, Thm. 1)
Definition 1 (safety monitor). Given the fallback policy $\pi^{\mathrm{fb}}:\mathcal H\to U$, a function $\Delta^{\mathrm{fb}}:\mathcal H\times U\to\mathbb R$ is a safety monitor if $$\Delta^{\mathrm{fb}}(\eta,u)\ge 0\ \Longrightarrow\ \eta\notin\mathcal F^\eta\ \wedge\ f^\eta(\eta,u,d)\in\Omega^{\mathrm{fb}}\ \ \forall d\in\mathcal D,$$ where $\mathcal F^\eta$ are information states compatible with a current failure and $\Omega^{\mathrm{fb}}$ those from which $\pi^{\mathrm{fb}}$ enforces all-time safety. Definition 2 (safety filter). $(\pi^{\mathrm{fb}},\Delta^{\mathrm{fb}},\phi)$ is a (robust) safety filter if $$\Delta^{\mathrm{fb}}\big(\eta,\pi^{\mathrm{fb}}(\eta)\big)\ge 0\ \Longrightarrow\ \Delta^{\mathrm{fb}}\big(\eta,\phi(\eta,u)\big)\ge 0\quad\forall u\in U.$$ Theorem 1. If the system starts at $\eta_0$ with $\Delta^{\mathrm{fb}}(\eta_0,\pi^{\mathrm{fb}}(\eta_0))\ge 0$, then the filtered dynamics $f^\phi(x,u,d):=f(x,\phi(\eta,u),d)$ satisfy the safety requirement for all time, for every task policy $\pi^{\mathrm{task}}$. The induction behind it also needs the fallback to pass the monitor wherever it is certified to work, $\Delta^{\mathrm{fb}}(\eta,\pi^{\mathrm{fb}}(\eta))\ge 0$ for all $\eta\in\Omega^{\mathrm{fb}}$; the paper's abbreviated statement leaves this implicit, and each of its corollaries verifies it for the concrete monitor. Without it the conclusion can fail: let the fallback move a safe state $A$ to a safe state $B$ and keep it there, and let the monitor pass only the fallback action at $A$. Both definitions hold, yet at $B$ the premise of Def. 2 is false, so the filter may pass an action that leads to failure.

Proof idea. Induction. At $\eta_k$ the fallback passes the monitor, so by Def. 2 the filtered action passes it too; by Def. 1 the current state is not a failure and the next state lies in $\Omega^{\mathrm{fb}}$, where (by the added condition above, which each concrete corollary checks) the fallback again passes the monitor. The filter may never apply the fallback: it only preserves the option to do so. Why each piece matters: without a fallback the monitor has nothing to certify; without the monitor's one-way implication the filter could pass actions that are safe now but doom the future; without Def. 2 the intervention could itself fail the check.

FilterSafety monitor $\Delta^{\mathrm{fb}}(x,u)$Fallback $\pi^{\mathrm{fb}}$Intervention $\phi$Corollary / section
HJ least-restrictive (discrete time)$\min\{l(x),\ \min_{d\in\mathcal D}V(f(x,u,d))\}$$\pi^*=\operatorname{arg\,max}_u\min_dV(f(x,u,d))$pass $u$ iff monitor $\ge 0$, else $\pi^*$Cor. 1.1, Section 6
CBF-QP$\min\{h(x),\ \dot h(x,u)+\alpha(h(x))\}$, with $\alpha(r)\lt r/\Delta t$ for $r\gt 0$ (a first-order argument, Section 3)any $u\in K_{\mathrm{cbf}}(x)\cap U$, e.g. $\operatorname{arg\,max}_{u\in U}\dot h(x,u)$ for compact $U$ (implicit)projection onto $K_{\mathrm{cbf}}(x)$Cor. 1.2, Section 3
Model-predictive shielding$\mathbb 1\{\hat X_\tau\cap\mathcal F=\emptyset\ \forall\tau\le H\ \wedge\ \hat X_H\subseteq\Omega\}-\tfrac12$ (rollout of $\pi^{\mathrm{fb}}$ after $u$)given $\pi^{\mathrm{fb}}$ with invariant $\Omega$switch to $\pi^{\mathrm{fb}}$Cor. 1.3
Predictive safety filteradmissible $u$ whose successor has a certified tail to the stored deadline, or a terminal certificateshifted backup plan, then $\pi_S^t$closest feasible first inputSection 7
Shield$\delta(g,l,u)\in W$any winning actionrestrict set / substituteAlshiekh et al.
Latent filter$V(\hat z_{t+1})-\epsilon$$\pi^{\mathrm{fb}}_{\mathrm{latent}}$switchSection 9

Two entries deviate from the paper's wording. The HJ row is the discrete-time filter of Hsu et al.'s eqs. 9–11, so its fallback maximizes the next value, $\pi^*=\operatorname{arg\,max}_u\min_dV(f(x,u,d))$ (their eq. 10). The gradient law $\kappa^*$ of Section 6 belongs to the continuous-time formulation and can leave the safe set in one discrete step: for $x^+=u$, $U=[-2,2]$ and $V(x)=1-x^2$ (the exact safety value for $l=V$), at $x=0.5$ it picks $u=-2$ and $V(x^+)=-3$, whereas $\pi^*$ picks $u=0$. The paper's monitor is $\min_dV(f(x,u,d))$ alone; the extra $l(x)$ makes Def. 1's "no current failure" clause hold at every state, not only along trajectories that start in $\Omega^*$. In the CBF-QP row, Hsu et al.'s implicit fallback $\operatorname{arg\,max}_u\dot h(x,u)$ exists only for compact $U$: with the module's $U=\mathbb R^m$ and $L_gh\neq 0$ the affine objective is unbounded. The proof of Cor. 1.2 needs only some admissible input satisfying the CBF inequality, e.g. the min-norm element of $K_{\mathrm{cbf}}(x)$ (the CBF-QP solution for $k\equiv 0$).

Derivation — What the predictive-filter monitor must remember

For the shrinking-horizon predictive filter, include the stored feasible plan and its deadline in the information state. The monitor checks that the current input is admissible and that its successor retains a certified tail reaching $S^t$ by that deadline, or already admits the terminal filter. A new full-horizon feasible plan is sufficient but is not required at every step.

The survey of Wabersich, Taylor, Choi, Sreenath, Tomlin, Ames & Zeilinger, IEEE CSM 2023 takes the complementary, control-theoretic view: it defines the ideal filter, an optimal-control problem over whole input signals $v(\cdot)$ (see Primer D), $$u(\cdot)=\operatorname*{arg\,min}_{v(\cdot)}\int_0^\infty\|v(t)-u_{\mathrm{des}}(t)\|\,dt\quad\text{s.t.}\quad\dot x=f(x,v),\ x(0)=x_0,\ v(t)\in U,\ x(t)\in X\ \forall t\ge 0,$$ which is intractable because $u_{\mathrm{des}}(\cdot)$ is only revealed online and the problem is infinite-dimensional, and then develops HJ, CBF and predictive filters side by side as approximations of it, each with its data-driven variant (learned disturbance bounds for HJ as in Fisac et al., a learned $\dot h$ residual as in Taylor et al., a Bayesian model inside the PSF as in Section 7), a common design example, and hardware case studies. It is the single best reference for this module.

9. Learned and Uncertainty-Aware Filters (incl. UPSi)

The frontier is systems where neither $h$, nor $V$, nor even a state-space model is available in closed form. Four ideas from 2024–2026 cover it: learn a CBF by evaluating a policy, learn a game value by self-play, run reachability in a world model's latent space, and run a predictive filter on an ensemble of neural dynamics models.

Theorem — The policy value function is a CBF (So et al., ICRA 2024, eqs. 11–14, Thms. 1–2)
Let the avoid set be $\{x: h(x)>0\}$, let $f,g$ be locally Lipschitz, and let $\pi$ be an admissible policy ($\pi(x)\in U$) whose closed-loop trajectories exist for all $t\ge 0$ and are unique. The maximum-over-time constraint value (assumed finite) $$V^{h,\pi}(x_0):=\sup_{t\ge 0}h(x^\pi_t)$$ satisfies the dynamic-programming identity $V^{h,\pi}(x_0)=\max\{\sup_{0\le s\le t}h(x_s),\ V^{h,\pi}(x_t)\}$, hence $V^{h,\pi}\ge h$ and $V^{h,\pi}$ is non-increasing along trajectories of $\pi$; in particular $\{V^{h,\pi}\le 0\}$ is forward invariant under $\pi$ and lies inside the safe set $\{h\le 0\}$. The paper states the corresponding HJ equation $\max\{h-V^{h,\pi},\ \nabla V^{h,\pi\top}(f+g\pi)\}=0$ (eq. 12) in the viscosity sense and reads off $\nabla V^{h,\pi\top}(f+g\pi)\le 0$, which holds classically wherever $V^{h,\pi}$ is differentiable. Theorem 1: if $V^{h,\pi}$ is continuously differentiable (their CBF definition requires this, and the paper takes it for granted), then $V^{h,\pi}$ is a CBF with safe set $\{V^{h,\pi}\le 0\}$ (note the sign convention) for every extended class-$\mathcal K$ function $\alpha$ (the paper writes "any $\alpha>0$"): on $\{V^{h,\pi}\le 0\}$ we have $\nabla V^{h,\pi\top}(f+g\pi)\le 0\le-\alpha(V^{h,\pi})$, so $\pi$ itself is a feasible input. A max-over-time value can have kinks, where the classical CBF-QP argument needs a nonsmooth replacement, and a learned approximation $V_\theta$ inherits none of this automatically. Theorem 2: the CBF-QP built from $V^{h,\pi}$ with any new nominal policy has a forward-invariant set at least as large as $\{V^{h,\pi}\le 0\}$, the one under $\pi$ (for the invariance theorem of Section 2 the filtered feedback must again be locally Lipschitz); iterating (new nominal policy := the filtered one) is policy iteration for the max-over-time cost.

So et al., ICRA 2024 (PNCBF) thereby sidestep the two failure modes of neural-CBF training, the unknown safe set and input constraints: the value is learned by regression on rollouts (loss (15): $\|V_\theta(x_t)-\max\{\max_{t\le s\le T}h(x_s),V_\theta(x_T)\}\|^2$), and because $\pi$ respects the actuator limits the resulting CBF-QP is feasible where the policy was. In practice the discounted variant $V_\lambda^{h,\pi}$ (their eq. 16) is used to make the fixed point unique, mirroring Section 6. Demonstrated up to a 16-D F-16 model and on two quadcopters. With $\pi=\pi^*$ the policy value is the HJ value, so PNCBFs sit between hand-designed CBFs and full reachability. GCBF+ (Zhang, So, Garg & Fan, T-RO 2025) extends learned CBFs to multi-agent systems: one graph-neural certificate $h_\theta$ on local neighbourhood graphs, trained with hinge losses on the CBF conditions in the spirit of Robey et al., is shared by all agents and scales to arbitrarily many of them (up to 20% better than the best hand-crafted CBF method with up to 256 agents and up to 40% better than leading RL methods at 1024, plus hardware experiments on a drone swarm).

Background — Graph neural networks

The graph has one node per agent and edges joining agents whose interaction must be considered. A graph neural network combines each agent's features with messages from neighbouring nodes, using the same learned weights at every node. For three agents in a line, the middle node receives two neighbouring messages and each end node receives one. Sharing $h_\theta$ therefore permits evaluation on different numbers of agents; it does not by itself prove safety for an arbitrary swarm size.

Adversarial imagination. Gameplay filters (Nguyen, Hsu, Yu, Tan & Fisac, CoRL 2024) learn a zero-sum reach–avoid game by adversarial RL in simulation: a safety policy $\pi^{\mathrm{safe}}$ plays against a virtual adversary $\pi^{\mathrm{adv}}$ that represents disturbances and sim-to-real error. As a sufficient finite-time condition for all-time safety, the robot must reach a known controlled-invariant target set $\mathcal T$ (for example a stable stance, which a fixed policy $\pi^{\mathcal T}$ then holds) within $H$ steps without entering the failure set $\mathcal F$. With margins $g(x)\lt 0\iff x\in\mathcal F$ and $\ell(x)\ge 0\iff x\in\mathcal T$, the game value satisfies the reach–avoid Isaacs recursion (their eq. 5) $$V_k(x)=\min\Big\{g(x),\ \max\big\{\ell(x),\ \max_u\min_dV_{k+1}(f(x,u,d))\big\}\Big\},\qquad V_H(x)=\min\{\ell(x),g(x)\},$$ and the offline learning approximates a time-discounted infinite-horizon version of it. The filter is model-predictive shielding with an adversary: accept $u^{\mathrm{task}}$ at $x$ iff the imagined game (first $u^{\mathrm{task}}$, then the learned fallback, all under the learned adversary) reaches $\mathcal T$ within $H$ steps without failing (their eq. 7), else apply the fallback. Their ablation shows why the target matters: an avoid-only criterion that merely asks the imagined rollout not to fail is overly optimistic and violates safety when the horizon is short. It is a full-order filter for 36-D quadruped dynamics that transferred zero-shot to two platforms.

Latent-space reachability. Nakamura, Peters & Bajcsy, RSS 2025 run the discounted safety Bellman equation inside a generative world model trained on RGB observations (encoder $z_t\sim E_\psi(z_t|\hat z_t,o_t)$, transition $\hat z_{t+1}\sim p_\phi(\cdot|z_t,a_t)$), with the margin $\ell_\mu(z)$ given by a failure classifier over latents (so "do not spill the bag" needs no signed distance function): $$V_{\mathrm{latent}}(z)=(1-\gamma)\,\ell_\mu(z)+\gamma\min\Big\{\ell_\mu(z),\ \max_{a\in A}\mathbb E_{\hat z'\sim p_\phi(\cdot|z,a)}\big[V_{\mathrm{latent}}(\hat z')\big]\Big\},\qquad\gamma\in[0,1),$$ and filter (their eq. 7) $a^{\mathrm{exec}}_t=\pi^{\mathrm{task}}(z_t)$ if $V(\hat z_{t+1})>\epsilon$, else $\pi^{\mathrm{fb}}_{\mathrm{latent}}(z_t)$, where $\hat z_{t+1}$ is the world model's prediction under the task action and $\epsilon>0$ absorbs numerical error and latency ($\epsilon=0.4$ in simulation, $0.3$ on the Franka hardware). Nothing here is certified: the value is only as good as the world model and the classifier.

Background — Latent states

$o_t$ is the current image observation. The encoder combines it with the prior prediction $\hat z_t$ to produce a compact internal state $z_t$. The learned transition model predicts the next internal state $\hat z_{t+1}$ under an action. For example, two images taken from different viewpoints may encode the same hidden “cup is tilted” feature. These latents need not have physical coordinates such as position or velocity. Consequently, safety in the learned latent model becomes physical safety only if the encoder, transition, and failure classifier are sufficiently accurate.

Generative policies. Filtering a diffusion policy raises a distribution-shift problem: a corrected action chunk is off the policy's data manifold. SafeDiffuser (Xiao et al., ICLR 2025) treats the denoising process itself as a controlled dynamical system and enforces CBF-type constraints by a QP at every denoising step (robust, relaxed and time-varying variants), whose finite-time diffusion invariance conclusion requires the denoising dynamics and feasibility/regularity hypotheses stated below; the time-varying version certifies final waypoint values $b\ge0$. PACS (Römer et al., ICRA 2026) instead never touches the geometric path: it only rescales time along the generated trajectory ($q(s)$ with $\dot s\ge 0$, a reparametrization of time; see Primer B), brakes as the fail-safe, and verifies a chunk by set-based reachability analysis of the robot along the path plus its braking manoeuvre against the (dynamic) obstacles, so the executed motion stays close to the training distribution while carrying a formal guarantee (three real-world human-robot interaction tasks, up to 68% higher task success than reactive CBF-type filtering; formulas schematic).

Background — Diffusion policies and denoising time

A diffusion policy generates a chunk of waypoints $y_0,\dots,y_H$ by starting from Gaussian noise and repeatedly denoising it. The denoising index is an internal generation time, distinct from the robot's physical time. SafeDiffuser treats the denoising update as a controlled system $\frac{d}{d\tau}y_k=v_k$ in generation time and constrains $v_k$ by a CBF-type QP, so its guarantee concerns the generated waypoints, not the motion that executes them.

Theorem — Time-varying diffusion invariance (Xiao et al. 2025, Thm. 4)

Use increasing generation time $\tau\in[0,T_d]$ (the paper’s reverse index decreases). Waypoint $y_k$ follows the controlled denoising interpolation $dy_k/d\tau=v_k$. Assume $b\in C^1$, continuously differentiable schedules $r_k$ (the paper's $\gamma_k$) with $r_k(0)\le b(y_k(0))$ and $r_k(T_d)=0$, and extended class-$\mathcal K$ $\alpha$. Require feasible controls, absolutely continuous trajectories through $T_d$, and enforcement almost everywhere of

$$\nabla b(y_k)^\top v_k-r_k'(\tau)+\alpha\big(b(y_k)-r_k(\tau)\big)\ge0.$$

Then $b(y_k(\tau))\ge r_k(\tau)$, hence every final waypoint satisfies $b(y_k(T_d))\ge0$. This is their Theorem 4 (proved as Theorem 3.4 in the appendix), written in increasing generation time.

Apply scalar comparison to $b-r_k$, initially nonnegative. The moving threshold accommodates unsafe initial noise and ends at the desired constraint. Finite denoising updates need a discrete inequality or verified integration-error margin. This statement alone does not certify physical motion between waypoints or robot tracking.

UPSi: a predictive safety filter on a probabilistic ensemble

The predictive filter of Section 7 needs a model with rigorous error bounds. Frauenknecht, Kesper, Mayfrank, Hose & Trimpe, RLC 2026 supply them for the probabilistic ensembles (PE) used in Dyna-style model-based RL: $E$ Gaussian networks $\mathcal N(\mu_{\theta_e}(s,a),\Sigma_{\theta_e}(s,a))$ (see Primer C) as estimators of an environment $s_{t+1}=\mu(s_t,a_t)+L(s_t,a_t)w_t$ whose zero-mean process noise is bounded, $\|w_t\|_2^2\le\epsilon$, with diagonal covariance $\Sigma=LL^\top$ (here $\mu$ is the nominal dynamics, not the QP multiplier).

Definition — Aleatoric/epistemic split, certain set and the UPSi problem (Frauenknecht et al. 2026, Sec. 5, eqs. 5, 10, 11)
$$\bar\Sigma=\Big(\tfrac1E\sum_{e=1}^E\Sigma_{\theta_e}^{-1}\Big)^{-1}\ \ (\text{aleatoric}),\qquad \bar\mu=\bar\Sigma\Big(\tfrac1E\sum_e\Sigma_{\theta_e}^{-1}\mu_{\theta_e}\Big),\qquad \hat\Sigma=\tfrac1E\sum_e(\mu_{\theta_e}-\bar\mu)(\mu_{\theta_e}-\bar\mu)^\top\ \ (\text{epistemic}),$$ a sensor-fusion combination in which only the aleatoric part is propagated. With the Kalman gain $G=\bar\Sigma(\bar\Sigma+\hat\Sigma)^{-1}$, the ratio of aleatoric to total variance, the sufficiently certain set is $$\mathcal C:=\Big\{(s,a)\in S\times A:\ \tfrac{1}{n_S}\operatorname{tr}G(s,a)\ \ge\ \xi\Big\}\qquad(\tfrac{1}{n_S}\operatorname{tr}G\in[0,1]\text{, near 1 when ensemble disagreement is negligible}).$$ Here $\operatorname{tr}$ is the trace, the sum of the diagonal entries (see Primer A). Set notation. $A\oplus B=\{a+b:\ a\in A,\ b\in B\}$ is the Minkowski sum and $A\ominus B=\{x:\ x+B\subseteq A\}$ the Pontryagin difference, so asking the nominal point to lie in $S\ominus B$ keeps the whole tube $\{\text{point}\}\oplus B$ inside $S$ (constraint tightening, as in tube MPC); a set is robustly positively invariant under a controller if no admissible disturbance can drive the state out of it. Assumptions. (1) An initial controller $\kappa$ induces a robustly positively invariant terminal set $\mathcal T_0$ and an initial certain set $\mathcal C_0\supseteq\mathcal T_0\times A_0$; (2) consistency: $\Sigma_{\theta_e}(s,a)\succeq\Sigma(s,a)$ on $\mathcal C_j$ (Loewner order, see Primer A); (3) unbiasedness: $\mathbb E[\hat S_{t+1}|s,a]=\mathbb E[S_{t+1}|s,a]$ on $\mathcal C_j$; (4) monotonic improvement: $\Sigma_{\theta_e^j}\succeq\Sigma_{\theta_e^{j+1}}\succeq\Sigma$ and $\mathcal C_j\subseteq\mathcal C_{j+1}$ across episodes; (5) regularity: $\mu$ is twice continuously differentiable with Lipschitz Jacobian $\nabla\mu$ (constant $\ell_{\nabla\mu}$, which bounds the linearization error of the tube), and $L$ and the certainty measure $g(s,a)=\tfrac1{n_S}\operatorname{tr}G(s,a)$ are Lipschitz (constants $\ell_L$, $\ell_G$). Theorem 1: under (2), (3), (5) the ellipsoidal tube $\mathcal P_{n|t}=z_{n|t}\oplus M_{n|t}^\top\mathcal Q_S$ ($\mathcal Q_S$ the unit ball, $M_{n|t}^\top M_{n|t}=P_{n|t}\succeq 0$; for $P_{n|t}\succ 0$ this is $\{s:(s-z_{n|t})^\top P_{n|t}^{-1}(s-z_{n|t})\le 1\}$, and $P_{0|t}=0$ gives the single point $s_t$), propagated along the nominal trajectory $z_{n+1|t}=\bar\mu(z_{n|t},u_{n|t})$ with the shape update $\Phi$ of their eq. (8), over-approximates the robust reachable set: $\mathcal R_{n|t}\subseteq\mathcal P_{n|t}$. Because (2)–(3) hold only inside $\mathcal C_j$, the whole tube must stay certain, which (10) enforces by tightening: $(z_{n|t},u_{n|t})\oplus g_{n|t}\mathcal Q_{S\times A}\subseteq\mathcal C_j$ with $g_{n|t}=\ell_G\sqrt{\lambda_{\max}(P_{n|t})+\lambda_{\max}(K_{n|t}P_{n|t}K_{n|t}^\top)}$ ($\lambda_{\max}$ is the largest eigenvalue, see Primer A). (Caveat: as printed, (10) and its Lemma 10 scale the geometric tube radius $R_{n|t}=\sqrt{\lambda_{\max}(P_{n|t})+\lambda_{\max}(K_{n|t}P_{n|t}K_{n|t}^\top)}$ by $\ell_G$, which mixes a distance with a certainty value. The Lipschitz bound in the lemma's proof supports the scalar tightening $g(z_{n|t},u_{n|t})\ge\xi+\ell_GR_{n|t}$ of the certainty measure, or the inclusion $(z_{n|t},u_{n|t})\oplus R_{n|t}\mathcal Q_{S\times A}\subseteq\mathcal C_j$. The printed condition can fail: in one dimension, $g(s)=0.5+0.1s$, $\xi=0.5$, $z=0.5$ and $R=1$ pass it, although the tube $[-0.5,1.5]$ leaves $\mathcal C=\{s\ge 0\}$.) The UPSi problem, using that scalar certainty correction, is then $$\begin{aligned} \min_{u_{0:N-1|t}}\ &\|a_t-u_{0|t}\|_2^2\\ \text{s.t.}\ \ &z_{0|t}=s_t,\ P_{0|t}=0,\quad z_{n+1|t}=\bar\mu(z_{n|t},u_{n|t}),\quad P_{n+1|t}=\Phi(P_{n|t},K_{n|t},z_{n|t},u_{n|t}),\\ &z_{n|t}\in S\ominus M_{n|t}^\top\mathcal Q_S,\quad u_{n|t}\in A\ominus K_{n|t}M_{n|t}^\top\mathcal Q_S,\quad z_{N|t}\in\mathcal T^j\ominus M_{N|t}^\top\mathcal Q_S,\quad g(z_{n|t},u_{n|t})\ge\xi+g_{n|t}, \end{aligned}$$ i.e. problem (5) of Section 7 with tube-tightened constraints and one extra constraint, certainty, that prevents the filter from exploiting the model where it is wrong.
Derivation — Why $\tfrac1{n_S}\operatorname{tr}G$ lies in $[0,1]$

Assume the covariances are positive definite, so the inverses exist. In one dimension $G=\bar\Sigma/(\bar\Sigma+\hat\Sigma)$: no ensemble disagreement ($\hat\Sigma=0$) gives 1, large disagreement pushes $G$ towards 0. In several dimensions put $S:=\bar\Sigma+\hat\Sigma\succ 0$. Then $S^{-1/2}GS^{1/2}=S^{-1/2}\bar\Sigma S^{-1/2}$, so $G$ is similar to a symmetric matrix and has the same real eigenvalues. Since $\hat\Sigma\succeq 0$ we have $0\preceq\bar\Sigma\preceq S$, and multiplying on both sides by $S^{-1/2}$ preserves these inequalities: $0\preceq S^{-1/2}\bar\Sigma S^{-1/2}\preceq I$. Hence every eigenvalue of $G$ lies in $[0,1]$, and so does their average $\tfrac1{n_S}\operatorname{tr}G$ ($n_S$ is the state dimension).

Background — The ancillary feedback $K$ and the shape update $\Phi$

Along the tube the applied input is $a=u_{n|t}+K_{n|t}(s-z_{n|t})$: the ancillary feedback $K_{n|t}$ pushes a deviating state $s$ back towards the nominal $z_{n|t}$, which is why the input constraint is tightened by $K_{n|t}M_{n|t}^\top\mathcal Q_S$. $\Phi$ is the paper's eq. (8), an outer-ellipsoid update that adds the linearization-error and process-noise ellipsoids to the propagated tube; their Lemma 8 proves the property Theorem 1 needs: every state of the current tube, under this feedback and any admissible noise, lands in the next tube. A plain covariance update, as in the paper's practical simplifications, has no such guarantee.

Derivation — The tube radius and the certainty tightening

A tube point is $s=z+e$ with $e=M^\top q$, $\|q\|\le 1$. Then $\|e\|^2=q^\top MM^\top q\le\lambda_{\max}(MM^\top)=\lambda_{\max}(M^\top M)=\lambda_{\max}(P)$ ($MM^\top$ and $M^\top M$ have the same nonzero eigenvalues), and likewise $\|Ke\|^2\le\lambda_{\max}(KM^\top MK^\top)=\lambda_{\max}(KPK^\top)$. So the state-action deviation $(e,Ke)$ has norm at most $R=\sqrt{\lambda_{\max}(P)+\lambda_{\max}(KPK^\top)}$. Because $g$ is $\ell_G$-Lipschitz, every tube point has certainty at least $g(z,u)-\ell_GR$, so $g(z,u)\ge\xi+\ell_GR$ keeps the whole tube certain; the alternative is the geometric inclusion $(z,u)\oplus R\,\mathcal Q_{S\times A}\subseteq\mathcal C_j$. The printed condition mixes the two: $\ell_GR$ is a change in certainty, not a distance.

The terminal set grows between episodes by the sampled $N$-step controllable set of the previous one (their eq. 12), so the filter becomes less conservative as data accumulates, while the guarantee (persistent feasibility of the tube-constrained problem) is inherited from robust MPC. Two honest caveats, both from the paper: the guarantees hold only under the assumptions of Theorem 1 and of the persistent-feasibility theorem below, and the benchmark evaluation uses "practical simplifications" (a naive Gaussian tube, $\ell_G=0$, no ancillary controller) that, in the authors' words, break the formal guarantees.

Theorem — Persistent feasibility of UPSi (Frauenknecht et al. 2026, supplement, Thm. 11 with Assumptions 6–7)
Let assumptions (1)–(5) above hold, and in addition: (6) contractive terminal set: there are a robust terminal controller $\kappa$, a robustly positively invariant $\mathcal T^j\subseteq S$ and a bound $\bar\lambda$ such that every tube $z\oplus M^\top\mathcal Q_S\subseteq\mathcal T^j$ with $\lambda_{\max}(P)\le\bar\lambda$ satisfies the input constraints under $a=\kappa(z)+K(s-z)$ and, propagated one step with this input, stays in $\mathcal T^j$ with $\lambda_{\max}\le\bar\lambda$; (7) shape dominance: the candidate built at time $t+1$ by shifting the previous plan, re-centring it at the measured state $s_{t+1}$ (with $P_{0|t+1}=0$) and appending $\kappa$ has shapes $P_{n|t+1}\preceq P_{n+1|t}$ for all $n$. Extend the UPSi problem by the terminal constraint $\lambda_{\max}(P_{N|t})\le\bar\lambda$. If the problem is feasible at $t=0$, the extended problem is feasible at every $t>0$ when $u_{0|t}$ is applied in closed loop; in particular $s_t\in S$ and $a_t\in A$ for all $t$.

In words: the standard MPC argument. The shifted plan plus the terminal controller is a feasible candidate at the next step, because Theorem 1 puts the measured successor inside the first tube, the terminal controller keeps the end of the tube in $\mathcal T^j$ (Assumption 6), and the new tubes should fit inside the old ones (Assumption 7), so every tightened constraint that held before still holds. Caveat: the proof passes from $P_{n|t+1}\preceq P_{n+1|t}$ to the inclusion $\mathcal P_{n|t+1}\subseteq\mathcal P_{n+1|t}$, but the re-centred tubes have different centres, and an ellipsoid with a smaller shape matrix need not fit inside a larger one centred elsewhere; an implementation should check these inclusions directly. The guarantee also presupposes the certified shape update $\Phi$ and the certainty tightening, both of which the benchmark simplifications drop.

The companion work Dyna-SAuR (Eisele, Frauenknecht, Solowjow & Trimpe, 2026) learns the filter instead of solving it: with the certain set $\mathcal E=\{(s,a): H(\hat S_{t+1})\le\lambda_1\}$ (predictive entropy of the ensemble; see Primer C) it defines the finite-horizon certain viability kernel $$S_V(\mathcal E)=\Big\{s:\ \exists\pi\ \ \mathbb P^\pi\big[\forall t\le T,\ (\hat S_t,A_t)\in S_S(\mathcal E)\ \big|\ S_0=s\big]\ge 1-\delta\Big\},$$ and a filter policy $\mu$ that outputs a state-dependent hyperplane, $a_t=\operatorname{arg\,min}_{a\in A}\|a-\pi(s_t)\|^2$ s.t. $w_t^\top a\ge b_t$ with $(w_t,b_t)=h(\mu(s_t))$: one affine constraint, so the closed form of Section 3 applies verbatim with $b=w_t$ and $a=-b_t$ (box constraints aside). Failures during training drop by at least two orders of magnitude against the baselines on goal-reaching CartPole and MuJoCo Walker. This is viability theory (Module 7) meeting the safety-filter architecture of Section 8.

Background — Reading the certain viability kernel

Let $S_{\mathrm{safe}}$ be the nonfailure state set and define $S_S(\mathcal E)=(S_{\mathrm{safe}}\times A)\cap\mathcal E$. The probability is over predicted trajectories and any policy randomness conditional on $S_0=s$. In $(w_t,b_t)=h(\mu(s_t))$, $h$ is a parameter-decoding map for a learned hyperplane, not the barrier function used earlier. This learned constraint is certified only if a separate argument shows that passing it preserves the required viability property.

Limitations and open problems
  • Guarantees are conditional on the model. CBFs need $f,g$ (or a bounded residual), HJ needs $\hat{\mathcal D}$, PSFs need calibrated error sets, UPSi needs Assumptions 2, 3 and 5 for its tubes (1–7 for persistent feasibility). Learned monitors (DeepReach, PNCBF, latent, gameplay) have no certificate at all; the honest framing is Hsu–Hu–Fisac's: they are untrusted oracles unless wrapped by a certified fallback.
  • Input constraints and relative degree remain the practical bottleneck of CBF filters; the value-function route (CBVF, PNCBF) or the predictive route is the answer, at the price of computation.
  • Conservatism versus performance. Every filter distorts the learner's data distribution; shields and PACS make this explicit, and the learned-policy view of Cheng et al. (feed corrections back) is one remedy.
  • Sampled data, estimation and partial observation are handled by the information-state $\eta$ in the unified theorem but rarely in implementations; the $\alpha(r)\lt r/\Delta t$ condition is a reminder that continuous-time proofs do not survive discretization for free.

Walkthrough: From the CBF Condition to the Filtered Input

The central computation of this module: solve the CBF-QP in closed form. Every step uses only the KKT conditions of Module 2. The result is what the explorer below evaluates thousands of times per run.

Interactive: CBF-QP Safety Filter on a Robot

Run the robot simulation and compare its nominal path with the filtered path around the obstacle. Toggle actuator saturation or increase the drift to see when the desired correction cannot be applied. Read the minimum barrier value alongside the plot; the full model and safety argument are below.

Background — Robot model, actuator limits and discrete safety argument

A planar robot with single-integrator dynamics and a constant drift, $\dot x=w+u$ with $w=(w_x,0)$ (a current or wind along $+x$) and a commanded velocity $\|u\|\le u_{\max}$; a go-to-goal controller $u_{\mathrm{nom}}=-k(x-x_{\mathrm{goal}})$; and a circular obstacle with barrier $h(x)=\|x-x_o\|^2-r^2$. In the notation of Section 3, $f(x)=w$, $g(x)=I$, so $b=L_gh^\top=2(x-x_o)$, $L_fh=b^\top w$ and $a=b^\top w+\alpha_0h$. At every step the explorer evaluates the closed form $u^*=u_{\mathrm{nom}}+\max\{0,-\psi/(b^\top b)\}\,b$ with $\psi=a+b^\top u_{\mathrm{nom}}$, then (optionally) saturates the norm to $u_{\max}$ and integrates with an Euler step of $\Delta t=0.005$. Because this $h$ is convex, the Euler update satisfies $h_{k+1}=h_k+\Delta t\,b^\top(w+u)+\Delta t^2\|w+u\|^2\ge(1-\alpha_0\Delta t)h_k$ exactly, so without saturation the discrete trajectory is provably safe whenever $\alpha_0\Delta t\lt 1$. With $w_x=0$ saturation cannot break this (Section 3: $u=0$ is admissible and scaling a feasible $u$ down keeps $b^\top u\ge-\alpha_0h$), which is why the drift is there: approaching the obstacle head-on with $w_x>u_{\max}$, the filter asks for an outward velocity it cannot deliver, $K_{\mathrm{cbf}}(x)\cap U=\emptyset$, the saturated input violates the constraint and the readouts show $\min_k h(x_k)\lt 0$. Clipping can also fail when $K_{\mathrm{cbf}}(x)\cap U\neq\emptyset$ at every state of $C$ the robot visits, because rescaling the projected input shrinks its radial part too; the note below the readouts tells the two cases apart by checking $a+u_{\max}\|b\|\ge 0$ at the sampled states in $C$ along the run ($u_{\max}\|b\|$ is the largest value of $b^\top u$ over the ball, so this is exactly $K_{\mathrm{cbf}}(x)\cap U\neq\emptyset$), and reports separately if the intersection also became empty inside the obstacle, after the violation.

Derivation — Why each held step is safe, and what the readouts measure

Held steps. With the input held, the robot moves on the straight segment $x(t_k+\tau)=x_k+\tau(w+u_k)$, $0\le\tau\le\Delta t$. Expanding the squared-distance barrier along it gives $h(t_k+\tau)=h_k+\tau\,b_k^\top(w+u_k)+\tau^2\|w+u_k\|^2\ge(1-\alpha_0\tau)h_k$ whenever the applied input satisfies the CBF constraint $b_k^\top(w+u_k)\ge-\alpha_0h_k$. So if $h_k\ge 0$ and $\alpha_0\Delta t\le 1$, the whole held segment stays safe, not only the sampled points. This calculation is special to this barrier and these dynamics, and it says nothing about a clipped input that violates the constraint.

Readouts. The simulation updates $x_{k+1}=x_k+\Delta t(w+u_k)$. Reported minima are over these sampled states, and total intervention is the sum $\Delta t\sum_k\|u_{\mathrm{applied},k}-u_{\mathrm{nom},k}\|$ over the executed steps, where $u_{\mathrm{applied}}$ is the projected input after the optional clipping; the plotted input norms use $u_{\mathrm{applied}}$ too. Solving with the exact bound $\|u\|_2\le u_{\max}$ instead of clipping is a convex problem with one linear and one norm-ball constraint (a second-order cone program); polyhedral input bounds would give a standard QP.

CBF-QP safety filter: single-integrator robot and a circular obstacle
Plane: red disk = obstacle ($h\lt 0$), blue = filtered trajectory (orange where the filter is active, $\mu>0$), grey dashed = unfiltered nominal controller, green = start, cross = goal, teal arrow = drift $w$.
Left: $h(t)$ for the filtered (blue) and unfiltered (grey) robot; the red line is $h=0$. Right: intervention $\|u_{\mathrm{applied}}-u_{\mathrm{nom}}\|(t)$ (orange) and $\|u_{\mathrm{applied}}\|$ (blue) with $u_{\max}$ dashed.
Filtered: $\min_k h(x_k)$ = –, closest approach to the obstacle surface = –, goal reached at $t$ = –
Unfiltered: $\min_k h(x_k)$ = –
Filter active – of sampled instants; total intervention $\Delta t\sum_k\|u_{\mathrm{applied},k}-u_{\mathrm{nom},k}\|$ = –; saturation active – of sampled instants
At closest approach: $h$ = –, $\psi=a+b^\top u_{\mathrm{nom}}$ = –, multiplier $\mu$ = –
Worst CBF margin along the run, $\min_k\,[a_k+b_k^\top u_k]$ = – (zero when the constraint is active, negative only when saturation clipped a needed correction)
What to try
(1) Slide $\alpha_0$ from 0.3 to 5: small values make the robot turn away early and keep $h$ large (conservative), large values let it graze the obstacle ($\min h\to 0$). (2) Set $y_0=0$: the nominal direction is anti-parallel to $\nabla h$, the correction along $b$ can only decelerate, and the robot parks on the boundary, the undesirable equilibrium of Section 2 (nudge $y_0$ to 0.05 to escape). (3) Keep $y_0=0$ and set the drift $w_x=1.2$ with $u_{\max}=1.5$: the filter now has to fight the current, the input norm at the boundary settles at $\|u_{\mathrm{applied}}\|=w_x$ (right panel), and the robot is still held safely. Raise $w_x$ to 1.6, above $u_{\max}$: the required outward velocity exceeds what saturation allows, the worst CBF margin turns negative, $\min h$ goes below zero and the current carries the robot straight through the obstacle. This is the input-constraint infeasibility of Section 3, and the threshold is exactly $w_x=u_{\max}$ for a head-on approach (at $w_x=1.5$ the robot is still held on the boundary with $\|u_{\mathrm{applied}}\|=u_{\max}$). (4) Untick saturation in the same setting: $\min h\ge 0$ again, at the price of $\|u_{\mathrm{applied}}\|>u_{\max}$. (5) With $w_x=0$ confirm that saturation never breaks safety, whatever $k$, $\alpha_0$ and $u_{\max}$, and explain why from the closed form. (6) Start off-axis ($y_0=0.3$) with a strong current ($w_x=1.6$): the robot escapes sideways because the constraint only asks for a radial velocity component, and the projection never removes the tangential part of $u_{\mathrm{nom}}$ (Step 3 of the walkthrough; saturation only rescales it). The worst CBF margin is negative here, so clipping did violate the constraint, but the lateral clearance is large enough that no collision follows. (7) Saturation can break safety even when a safe admissible input exists at every state: set $\alpha_0=5$, $r=1.5$, $w_x=1.2$ (still $w_x\lt u_{\max}=1.5$; other sliders at their defaults). Then $\min h\approx-0.09$, and the note confirms that $K_{\mathrm{cbf}}(x)\cap U$ was never empty. Rescaling the projected input to $\|u\|=u_{\max}$ shrank its radial component; solving the convex norm-ball constrained problem over $K_{\mathrm{cbf}}(x)\cap U$ instead keeps $h\ge 0$ in this run, which is the point of Algorithm 1, step 5.

From the mathematics to a real decision

What you will be able to do
  • Turn a measured clearance and its error bound into an admissible action interval.
  • Check safety throughout a held-input interval rather than only at its endpoints in a simulation.
  • Recognize an infeasible filter and account for sensor age as well as measurement noise.

A robot approaching a marked boundary

Imagine a robot moving along one axis near a boundary. Its clearance $d$ is measured in metres; the safe set is $d\ge0$. The input $u$ is a commanded clearance velocity in metres per second, positive away from the boundary. We use the simplified model $\dot d=u+w(t)$, where an unmodeled contribution satisfies $|w(t)|\le0.1$ metres per second. A sensor reports $y$ with $|y-d|\le0.05$ metres at the measurement instant. The actuator allows $u\in[-0.8,0.8]$ and holds its command for $\Delta=0.5$ seconds.

These are hypothetical bounds, not properties of a particular robot. The model assumes that commanded velocity takes effect without an acceleration transient. An actual vehicle with acceleration limits would need a different state and a stopping-distance calculation. Here the purpose is to make measurement uncertainty, disturbance, actuator feasibility and sampling appear in the same decision.

Worked decision: derive the filter from the interval model

At $y=0.35$, the smallest possible current clearance is $d_{\min}=0.35-0.05=0.30$. For held $u$ and every allowed disturbance signal, integrating the velocity gives $d(t)\ge d_{\min}+(u-0.1)t$ for $0\le t\le\Delta$. This lower bound is affine in time. If its slope is negative, its minimum is at the end; if its slope is nonnegative, its minimum is at the beginning. Since $d_{\min}\ge0$, it suffices to require

$$d_{\min}+\Delta(u-0.1)\ge0,\qquad u\ge0.1-\frac{d_{\min}}{\Delta}=-0.5.$$

Suppose the learned planner requests $u_{\rm nom}=-0.8$. The safety filter minimizes $\tfrac12(u-u_{\rm nom})^2$ over the intersection of the safety interval and actuator interval. The intersection is $[-0.5,0.8]$, so its nearest point to $-0.8$ is $u^\star=-0.5$. The correction is $0.3$ metres per second and the objective is $0.045$ in squared-velocity units. This is a projection, with a concrete physical interpretation: approach more slowly.

The worst modeled initial clearance and disturbance yield $d(t)=0.30-0.60t$, reaching zero at $t=0.5$. Thus the computed action uses the entire robust clearance margin. If the designer instead reserves a terminal clearance of 0.025 metres, the same reasoning requires $u\ge-0.45$. That is a distinct design requirement and a larger change from the nominal command.

The conclusion covers every time in this one holding interval. Repeating the argument gives invariance only if a new valid measurement is available at each update, the bound continues to hold, and a feasible command is applied on time. One successful quadratic-program solve is not a proof that future solves remain feasible.

Worked audit: a continuous-time argument has a clock

For exact current state feedback and rate $\kappa=2$ per second, a robust barrier condition is $u-0.1+2d\ge0$. The continuously updated choice $u=0.1-2d$ makes the worst modeled derivative $\dot d=-2d$, whose solution is $d(t)=d(0)e^{-2t}\ge0$. At $d(0)=0.30$, however, the initial command is $-0.5$. Holding that command gives the linear worst-case trajectory above, not the exponential one.

If the controller accidentally waits one second before updating, the clearance lower bound becomes $0.30-0.60=-0.30$. To cover a full second from this measurement, the interval calculation instead requires $u\ge0.1-0.30/1=-0.20$. The numerical equality of the barrier and holding bounds at $\Delta=1/\kappa$ in this example should not be mistaken for a general sampled-data theorem.

Do not clip after solving a different problem

If a filter ignores actuator limits and then clips its result, the clipped command may lose the certified property. Include actuator constraints in the same feasible set. When the set is empty, a solver status is an engineering event requiring a defined fallback; it is not an action that somehow satisfies the inequalities.

Application exercises

Exercise 10.B1 — Medium: Reserve space for a noisier sensor

The current reading remains 0.35 metres, but the measurement error bound grows to 0.08 metres. Keep the half-second hold and nominal command $-0.8$. Derive the filtered command and correction, and check the worst modeled terminal clearance.

Show hint

Recompute the lower clearance before using the held-input inequality.

Show solution

The lower clearance is $0.35-0.08=0.27$. The bound becomes $u\ge0.1-0.27/0.5=-0.44$, within the actuator interval. Projection gives $u^\star=-0.44$, a correction of 0.36 metres per second. The terminal lower bound is $0.27+0.5(-0.44-0.1)=0$. Reusing $-0.5$ would instead give $-0.03$ and would not certify safety with the new error bound.

Exercise 10.B2 — Hard: A safe set can demand an unavailable actuator

Suppose a failed drive can only command $u\in[-0.8,0]$. For half-second holds, find the smallest lower clearance at which the robust action set is nonempty. What happens at zero clearance? Explain why merely calling the filter more often does not fix the zero-clearance case.

Show hint

The largest available command is zero; compare it with $0.1-d_{\min}/0.5$.

Show solution

Feasibility requires $0.1-2d_{\min}\le0$, so $d_{\min}\ge0.05$ metres. At 0.05, only $u=0$ at the upper actuator endpoint can satisfy the lower safety bound. At zero clearance the requirement is $u\ge0.1$, which is impossible. For any positive hold length, the worst disturbance immediately moves the state across the boundary when $u\le0$. A genuinely different backup capability is needed for indefinite operation. Any finite initial clearance eventually runs out under the constant worst disturbance when $u\le0$; reducing the operating region does not fix that. A finite-horizon operation could instead stop before its clearance is exhausted. A faster clock cannot create a missing control direction.

Exercise 10.B3 — Hard: Add the age of a measurement to its error budget

The reading 0.35 metres is now 0.1 seconds old. During that delay, the magnitude of actual clearance velocity is bounded by 0.9 metres per second. The sensor’s instantaneous error remains 0.05 metres. Find a valid present error bound, a safe half-second command nearest to $-0.8$, and the worst terminal lower bound if the old $-0.5$ command were reused.

Show hint

Integrate the speed bound during the delay, then add its possible distance error to the sensor error.

Show solution

Movement can change clearance by at most $0.9(0.1)=0.09$ metres, so the total present error bound is 0.14. The lower current clearance is $0.35-0.14=0.21$, giving $u\ge0.1-0.21/0.5=-0.32$. The nearest command is $-0.32$. Reusing $-0.5$ gives terminal lower bound $0.21+0.5(-0.6)=-0.09$. The delay calculation itself requires a valid speed bound throughout the delay; the current measurement cannot retroactively justify that assumption.

Explain the certificate as an engineering statement

State the model, initial-state information, disturbance set, actuator set and holding time before stating the safe command. Change each of these five ingredients in turn and explain which line of the derivation changes. Module 11 then asks for more than remaining inside a set: can the controller approach a target, and what changes when a learned approximation introduces persistent error?

Exercises

Graded practice

Each level has four problems. Write your steps before opening the answer; use the hint when you need a first move. Close the answer and retry after checking it.

Easy practice

Exercise 10.P1 — Easy: Read a barrier-defined safe set

Let $h(x)=1-x^2$ and $C=\{x:h(x)\ge0\}$. Find $C$ and assess the points $x=1/2,1,2$. Which point is on its boundary?

Review this topic · Revisit the prerequisite

Show hint
Solve $x^2\le1$ and evaluate the three barrier values.
Show answer

The safe set is $[-1,1]$, since $x^2\le1$ is equivalent to $|x|\le1$. The barrier values are $h(1/2)=3/4$, $h(1)=0$, and $h(2)=-3$. Thus $1/2$ is inside, $1$ is on the boundary and included, and $2$ is outside. The sign convention matters: this module uses nonnegative barrier values for safety.

Exercise 10.P2 — Easy: Turn a barrier rate into an input bound

For $\dot x=u$, take $h(x)=x$, $C=[0,\infty)$ and $\alpha(h)=2h$. Write the CBF inequality and find allowed inputs at $x=1/2$.

Review this topic · Revisit the prerequisite

Show hint
Here $\dot h=\dot x=u$, so require $u+2x\ge0$.
Show answer

The condition is $\dot h+\alpha(h)=u+2x\ge0$, equivalently $u\ge-2x$. At $x=1/2$ this gives $u\ge-1$. The condition permits some negative velocity inside the safe set, but its allowed magnitude shrinks as $x$ approaches the boundary; at $x=0$ it requires $u\ge0$.

Exercise 10.P3 — Easy: Repair a scalar nominal input

Minimize $\tfrac12(u+3)^2$ subject to $u\ge-1$. Find the filtered input, its change from the nominal input and the objective value.

Review this topic · Revisit the prerequisite

Show hint
The unconstrained minimizer is $-3$. Move it to the nearest feasible point.
Show answer

The feasible interval begins at $-1$, so the nearest feasible input to $-3$ is $u^\ast=-1$. The correction is $(-1)-(-3)=2$. Its objective is $\tfrac12(2)^2=2$. Any larger feasible input is farther from $-3$ and has a larger squared deviation. This is the simplest CBF-QP projection.

Exercise 10.P4 — Easy: Check an inward-pointing vector field

Consider $\dot x=1-x$ on $C=[0,2]$. Check the direction at both boundary points and verify invariance using $x(t)=1+(x_0-1)e^{-t}$.

Review this topic · Revisit the prerequisite

Show hint
At the left endpoint, a nonnegative velocity points inward; at the right, a nonpositive velocity does.
Show answer

At $0$, the velocity is $1\gt0$; at $2$, it is $-1\lt0$. Both point into the interval. In the explicit solution, $0\lt e^{-t}\le1$, so $x(t)=e^{-t}x_0+(1-e^{-t})1$ is a convex combination of the initial point and $1$. Both lie in $[0,2]$, hence the whole trajectory stays there. The smooth vector field also satisfies the regularity needed for the boundary criterion.

Medium practice

Exercise 10.P5 — Medium: Project onto a two-input half-space

Minimize $\tfrac12(u_1^2+u_2^2)$ subject to $u_1+u_2\ge1$. Find the optimizer and the nonnegative KKT multiplier for $1-u_1-u_2\le0$.

Review this topic · Revisit the prerequisite

Show hint
Stationarity makes both input coordinates equal to the multiplier.
Show answer

The Lagrangian is $\tfrac12(u_1^2+u_2^2)+\mu(1-u_1-u_2)$ with $\mu\ge0$. Stationarity gives $u_1=u_2=\mu$. The zero input is infeasible, so the constraint is active: $2\mu=1$. Thus $\mu=1/2$, $u^\ast=(1/2,1/2)$ and objective $\tfrac12(1/4+1/4)=1/4$. Feasibility and complementary slackness hold; strict convexity makes this the unique optimum.

Exercise 10.P6 — Medium: Check feasibility with actuator limits

Let $\dot x=-1+u$, $h(x)=x$, $\alpha(h)=h$ and $u\in[-0.2,0.2]$. Find CBF-feasible input sets at $x=0.1$ and $x=2$. Can $h$ be a CBF on all of $C=[0,\infty)$ with these input limits?

Review this topic · Revisit the prerequisite

Show hint
The condition is $-1+u+x\ge0$. Intersect its half-line with the actuator interval.
Show answer

We need $u\ge1-x$. At $x=0.1$ this requires $u\ge0.9$, incompatible with $u\le0.2$: the feasible set is empty. At $x=2$, it requires $u\ge-1$, so every input in $[-0.2,0.2]$ passes.

The point $0.1$ is inside $C$ but has no admissible barrier input. Therefore this $h$ does not meet the CBF feasibility condition on all of $C$. Being inside the proposed safe set alone does not make the filter feasible; the controller needs sufficient input authority.

Exercise 10.P7 — Medium: Include the worst-case disturbance

For $\dot x=u+w$, $|w|\le0.3$, $h(x)=x$ and $\alpha(h)=h$, require the barrier condition for every disturbance. At $x=0.2$, find the lowest permitted $u$ and compare with the disturbance-free condition.

Review this topic · Revisit the prerequisite

Show hint
The smallest barrier rate occurs at $w=-0.3$.
Show answer

The worst-case condition is $u-0.3+x\ge0$, so $u\ge0.3-x$. At $x=0.2$, it requires $u\ge0.1$. Without the disturbance, the bound is only $u\ge-0.2$. Choosing $u=0.1$ at the worst disturbance gives $\dot h=-0.2=-h$, exactly the allowed lower rate. The robust correction accounts for the full adverse disturbance, rather than its mean.

Exercise 10.P8 — Medium: Compute a high-order barrier condition

Let $\dot p=v$, $\dot v=u$, with $h=p$ and linear gains $1$. Define $\psi_1=\dot h+h$ and $\psi_2=\dot\psi_1+\psi_1$. Compute both. At $(p,v)=(1,-0.4)$ find the input inequality. Why does $(0.1,-1)$ need a separate initial-set check?

Review this topic · Revisit the prerequisite

Show hint
Differentiate $v+p$ using both state equations.
Show answer

$\psi_1=v+p$ and $\psi_2=u+v+(v+p)=u+2v+p$. At $(1,-0.4)$, $\psi_1=0.6\ge0$ and $\psi_2=u+0.2$, so the condition is $u\ge-0.2$.

At $(0.1,-1)$, $h=0.1\ge0$ but $\psi_1=-0.9\lt0$. A high-order certificate requires starting in the intersection of the auxiliary nonnegative sets, not only in $\{p\ge0\}$. Enforcing the final input inequality does not remove that initial assumption.

Hard practice

Exercise 10.P9 — Hard: Audit a zero-gradient boundary test

Take $h(x)=x^3$, $C=\{h\ge0\}=[0,\infty)$ and $\dot x=-1$. At $x=0$, the derivative test $\nabla h\,f\ge0$ gives $0\ge0$. Is $C$ invariant? Locate the missing hypothesis in treating this test as a boundary characterization.

Review this topic · Revisit the prerequisite

Show hint
Compute the trajectory from the boundary itself. Also compute $h^\prime(0)$.
Show answer

Starting at $x_0=0$ gives $x(t)=-t$, which is outside $C$ for every $t\gt0$. Therefore $C$ is not invariant. Yet $h^\prime(x)=3x^2$ vanishes at the boundary, so $h^\prime(0)f(0)=0$ hides the outward motion.

The usual regular defining-function version of the boundary test assumes a nonzero gradient on the boundary. It fails here. Using the regular defining function $\widetilde h=x$ exposes the correct outward derivative $-1\lt0$. A vanishing gradient must not be treated as a safety certificate.

Exercise 10.P10 — Hard: Compare continuous feedback with a held input

For $\dot x=u$, $C=[0,\infty)$, continuous feedback is $u=-x$. Start at $x_0=1$. Compare the exact continuous trajectory with a sampled controller holding $u=-x_0=-1$ for $\Delta=1.5$. For which nonnegative holding times does this first held interval remain safe?

Review this topic · Revisit the prerequisite

Show hint
The continuous loop solves $\dot x=-x$; a constant held input gives a straight-line trajectory.
Show answer

Continuous feedback gives $x(t)=e^{-t}\gt0$. The held input instead gives $x(t)=1-t$ during the first interval, so $x(1.5)=-0.5$ and it crosses the boundary at $t=1$.

The first held interval remains safe exactly when $0\le\Delta\le1$: the straight line is decreasing and its endpoint is nonnegative precisely under that condition. A continuous-time feedback proof does not automatically certify its sampled-and-held implementation; a sampling margin or discrete-time condition is needed.

Exercise 10.P11 — Hard: Shift a feasible predictive backup plan

Let $x^+=x+u$, $|x|\le1$, $|u|\le1/2$, terminal set $X_f=[-1/4,1/4]$ and terminal controller $\kappa(x)=-x$. From $x_0=1$, verify the two-step plan $u_0=-1/2,u_1=-1/4$. Construct a feasible shifted plan after the first input.

Review this topic · Revisit the prerequisite

Show hint
Keep the unused second input, then append the terminal controller evaluated at its resulting terminal state.
Show answer

The original states are $x_1=1-1/2=1/2$ and $x_2=1/2-1/4=1/4\in X_f$. Every state and input satisfies its bound. From $x_1$, use the shifted inputs $-1/4$ and $\kappa(1/4)=-1/4$. They produce $1/4$ and $0$, with the final point in $X_f$.

For every $x\in X_f$, $|\kappa(x)|\le1/4\le1/2$ and $x+\kappa(x)=0\in X_f$. This terminal invariance is what makes appending the controller valid. The argument assumes the predicted and realized first successor agree, or that model error is covered by robust constraints.

Exercise 10.P12 — Hard: Compute a shield and change the disturbance quantifier

Safe states are $a,b$; $f$ is failure. Inputs $L,R$ give $a:L\to b,R\to f$ and $b:L\to a,R\to b$. Find the safe state set and allowed shield inputs. Then suppose $b,R$ can lead to either $b$ or $f$ under an adverse disturbance. Which input must the robust shield remove?

Review this topic · Revisit the prerequisite

Show hint
A robust safe input must have every possible successor in the safe set.
Show answer

The winning safe set is $\{a,b\}$: from $a$, $L$ stays in it; from $b$, both original inputs stay in it. The shield therefore permits only $L$ at $a$, and $L,R$ at $b$. It rejects $R$ at $a$ because that directly enters $f$.

With the additional possible successor $f$ from $(b,R)$, the robust shield must remove $R$ at $b$ too. Although one successor is safe, the condition is “there exists an input such that every disturbance successor is safe”. Existence of a favorable disturbance is insufficient.

Original longer exercises

Exercise 10.1 — Forward invariance via the comparison lemma (proof)

Let $\dot x=f(x)+g(x)u$ with $f,g$ locally Lipschitz, $h$ a CBF on $D\supseteq C$ with $\alpha(r)=\alpha_0 r$ ($\alpha_0>0$), and $u(x)$ a locally Lipschitz controller with $u(x)\in K_{\mathrm{cbf}}(x)$. (a) Prove $h(x(t))\ge h(x_0)e^{-\alpha_0 t}$ for all $t\in I(x_0)$ without invoking the comparison lemma, by an integrating factor. (b) Explain why the same argument does not work for a general extended class-$\mathcal K$ $\alpha$, and where the comparison lemma enters. (c) What breaks if $u(x)$ is merely measurable?

Show answer

(a) Along the closed-loop solution set $\eta(t)=h(x(t))$; the CBF condition gives $\dot\eta\ge-\alpha_0\eta$. Multiply by $e^{\alpha_0 t}>0$: $\frac{d}{dt}\big(e^{\alpha_0 t}\eta(t)\big)=e^{\alpha_0 t}(\dot\eta+\alpha_0\eta)\ge 0$, so $e^{\alpha_0 t}\eta(t)\ge\eta(0)$, i.e. $h(x(t))\ge h(x_0)e^{-\alpha_0 t}$. If $x_0\in C$, then $h(x_0)\ge0$, so this lower bound is nonnegative and proves invariance. Every step is an equality or a multiplication by a positive factor, so no uniqueness argument is needed.

(b) For a general nonlinear $\alpha$, the same time-only exponential integrating factor does not cancel $\alpha(\eta)$: $\dot\eta\ge-\alpha(\eta)$ is a differential inequality whose "solution" is the comparison system $\dot y=-\alpha(y)$, $y(0)=\eta(0)$. The comparison lemma says $\eta(t)\ge y(t)$, but it needs unique solutions of the comparison ODE; $-\alpha$ is only continuous, and uniqueness comes from monotonicity ($-\alpha$ is non-increasing, a one-sided Lipschitz condition), which is the point Ames et al. 2017 make with the monotonicity uniqueness argument. Then $y(t)\ge 0$ because $y\equiv 0$ is a solution that cannot be crossed.

(c) Existence and uniqueness of solutions, not the inequality argument. With a discontinuous $u(x)$ the right-hand side of $\dot x=f+g\,u(x)$ may be discontinuous in $x$, so Carathéodory solutions need not exist (for $\dot x=-\operatorname{sgn}(x)$ with $\operatorname{sgn}(0):=1$ none starts at $0$) and need not be unique. Every solution that does exist is absolutely continuous, however, so $\eta=h\circ x$ is absolutely continuous ($h$ is $C^1$), the chain rule gives $\dot\eta=L_fh+L_gh\,u(x)\ge-\alpha_0\eta$ almost everywhere, and $e^{\alpha_0t}\eta$, being absolutely continuous with an a.e. nonnegative derivative, is non-decreasing. So the proof of (a) goes through for every such solution, and non-uniqueness is harmless because each solution satisfies the inequality. What is lost is the guarantee that the closed loop has a solution from every initial state, and a unique one that depends continuously on it. When $u$ is locally bounded, switching to Filippov solutions restores local existence but needs its own check that the barrier inequality holds for the convexified velocity set (here it does when $u$ is locally bounded: the inequality $\nabla h^\top\dot x\ge-\alpha_0h$ is affine in $\dot x$ and continuous in $x$, so it survives the limits and convex combinations of Filippov's construction). This is why the theorem assumes Lipschitz controllers and why Section 3 checks Lipschitz continuity of the QP solution. (Carathéodory and Filippov solutions, absolute continuity and "almost everywhere" are explained in the background note of Section 6.)

Exercise 10.2 — Closed form of a weighted CBF-QP (derivation)

Derive the solution of $\min_u\tfrac12(u-u_{\mathrm{nom}})^\top H(u-u_{\mathrm{nom}})$ s.t. $a+b^\top u\ge 0$ with $H\succ 0$ and $b\neq 0$. Interpret the result geometrically and show it reduces to the walkthrough for $H=I$. Then compute $u^*$ for $H=\operatorname{diag}(1,4)$, $u_{\mathrm{nom}}=(1,1)$, $a=-3$, $b=(1,1)$.

Show answer

Lagrangian $\mathcal L=\tfrac12(u-u_{\mathrm{nom}})^\top H(u-u_{\mathrm{nom}})-\mu(a+b^\top u)$, $\mu\ge 0$. Stationarity: $H(u-u_{\mathrm{nom}})-\mu b=0\Rightarrow u=u_{\mathrm{nom}}+\mu H^{-1}b$. Complementary slackness: if $\psi:=a+b^\top u_{\mathrm{nom}}\ge 0$ then $\mu=0$; otherwise the constraint is active, $a+b^\top u_{\mathrm{nom}}+\mu\,b^\top H^{-1}b=0$, so $\mu=-\psi/(b^\top H^{-1}b)>0$ (positive since $H^{-1}\succ 0$ and $b\neq 0$). Hence $$u^*=u_{\mathrm{nom}}+\max\Big\{0,\ \frac{-\psi}{b^\top H^{-1}b}\Big\}H^{-1}b .$$ Geometrically this is the projection of $u_{\mathrm{nom}}$ onto the half-space in the metric $\|v\|_H=\sqrt{v^\top Hv}$: the correction is along $H^{-1}b$, the steepest ascent of $b^\top u$ in that metric, not along $b$. $H=I$ recovers $\mu=-\psi/(b^\top b)$ and the correction $\mu b$. The problem is a strictly convex QP with one affine constraint, so KKT is necessary and sufficient and this is the unique solution.

Numbers: $\psi=-3+1+1=-1$; $H^{-1}b=(1,\tfrac14)$; $b^\top H^{-1}b=1+\tfrac14=\tfrac54$; $\mu=1/(5/4)=0.8$; $u^*=(1,1)+0.8\,(1,\tfrac14)=(1.8,\,1.2)$. Check: $a+b^\top u^*=-3+1.8+1.2=0$, active as expected. With $H=I$ one would get $\mu=0.5$ and $u^*=(1.5,1.5)$: the weighting moved more of the correction into the cheap coordinate.

Exercise 10.3 — An exponential CBF for the double integrator

For $\dot p=v$, $\dot v=u$ and $h=p_{\max}-p$ with $p_{\max}=1$, write $\eta_b$, $F$, $G$, the ECBF constraint with $K_\alpha=[\kappa_1\ \kappa_2]$, and the conditions on $K_\alpha$ from Theorem 8 of Ames et al. 2019 for the initial state $p_0=0$, $v_0=1$. Give one admissible $K_\alpha$ and the resulting affine constraint on $u$.

Show answer

$r=2$: $\dot h=-v$ contains no $u$, $\ddot h=-u$. So $\eta_b=[h,\ \dot h]^\top=[1-p,\ -v]^\top$, $\dot\eta_b=F\eta_b+G\mu$ with $F=\begin{pmatrix}0&1\\0&0\end{pmatrix}$, $G=\begin{pmatrix}0\\1\end{pmatrix}$, $\mu=\ddot h=-u$. The ECBF condition $\ddot h\ge-K_\alpha\eta_b$ reads $-u\ge-\kappa_1(1-p)-\kappa_2(-v)$, i.e. $$u\ \le\ \kappa_1(1-p)-\kappa_2 v .$$ $F-GK_\alpha=\begin{pmatrix}0&1\\-\kappa_1&-\kappa_2\end{pmatrix}$ has characteristic polynomial $\lambda^2+\kappa_2\lambda+\kappa_1$. Theorem 8 requires real negative eigenvalues $-p_1,-p_2$ (so $\kappa_1=p_1p_2$, $\kappa_2=p_1+p_2$, $\kappa_2^2\ge 4\kappa_1$) and the initial-condition conditions $\nu_i(x_0)=\dot\nu_{i-1}(x_0)+p_i\nu_{i-1}(x_0)\ge 0$. When $\nu_{i-1}(x_0)\gt0$, this is equivalent to $p_i\ge-\dot\nu_{i-1}(x_0)/\nu_{i-1}(x_0)$; when $\nu_{i-1}(x_0)=0$, it instead requires $\dot\nu_{i-1}(x_0)\ge0$, independently of $p_i$. Here $\nu_0=h$, $\nu_0(x_0)=1$, $\dot\nu_0(x_0)=-v_0=-1$, so the condition is $p_1\ge-\dot\nu_0(x_0)/\nu_0(x_0)=1$, i.e. $\nu_1(x_0)=\dot\nu_0(x_0)+p_1\nu_0(x_0)=-1+p_1\ge 0$. (Had we used the eigenvalue $\lambda_1=-p_1$ as printed in Theorem 8 we would get $-p_1\ge 1$, impossible for a stable pole, which is how one sees that the printed condition has the sign of the derivation flipped.) Then $\nu_1=-v+p_1(1-p)$ and $\dot\nu_1=-u-p_1v$; the second condition $\nu_2(x_0)\ge 0$ involves $u(x_0)$ and is what the constraint itself enforces (it is the set $C_2$ that must contain $x_0$, which holds when the constraint is feasible at $x_0$). An admissible choice is $p_1=p_2=2$: $K_\alpha=[4\ \ 4]$, constraint $u\le 4(1-p)-4v$, and $\nu_1(x_0)=-1+2=1\ge 0$. Comparing with the HOCBF example of Section 4, $\kappa_1=k_1k_2$ and $\kappa_2=k_1+k_2$ with $k_1=k_2=2$: the same constraint, obtained by nested linear class-$\mathcal K$ functions.

Exercise 10.4 — Input-to-state safety for a bounded disturbance (proof)

Consider Kolathaya & Ames's Example 1: $\dot x=-x+x^2u$, $h(x)=2-x$, $C=\{x\le 2\}$. (a) Show that $k(x)\equiv 0$ is safeguarding, find a bounded $d$ that drives $x$ to infinity from $x_0=2$, and decide whether $k\equiv 0$ nevertheless satisfies the (local) ISSf definition for a small enough $\bar d$. (b) With $k(x)=L_gh(x)=-x^2$ and $u=k(x)+d(t)$, derive $\dot h\ge x-\|d\|_\infty^2/4$ and the invariant set $C_d$. (c) Identify $\alpha$, $\iota$, $\gamma$ in the ISSf theorem.

Show answer

(a) $L_fh=\nabla h\cdot f=(-1)(-x)=x$ and $L_gh=\nabla h\cdot g=-x^2$. With $u=0$: $\dot h=x\ge x-2=-h$, so $\dot h\ge-\alpha(h)$ with $\alpha(r)=r$ and $C$ is invariant. With $u=d(t)=1$ and $x_0=2$: $\dot x=-x+x^2$, and with $y=1/x$ one gets $\dot y=-\dot x/x^2=y-1$, $y(0)=\tfrac12$, so $y(t)=1-\tfrac12e^t$ and $x(t)=1/\big(1-\tfrac12e^t\big)\to\infty$ as $t\uparrow\log 2$, a finite-time escape: a disturbance of size 1 destroys safety completely, since $C$ has no margin against the $x^2$ gain. The ISSf definition is local, though. Take $\gamma(r)=r$ and $\bar d=\tfrac14$: on $\partial C_d$ we have $x=2+r$ with $r=\|d\|_\infty\le\tfrac14$, so $\dot x=-x+x^2d(t)\le x(-1+xr)\le(2+r)\big(-1+\tfrac94\cdot\tfrac14\big)\lt 0$, $C_d$ is invariant, and $k\equiv 0$ is ISSf with this $\bar d$. Any $\bar d\lt\tfrac12$ works with a small enough $\gamma$, while for $\bar d\ge\tfrac12$ the constant disturbance $d\equiv\bar d$ pushes every $x>2$ outward. The example therefore separates tolerance of small disturbances, which $k\equiv 0$ has, from tolerance of every bounded disturbance, which part (b) delivers.

(b) With $u=-x^2+d$: $\dot x=-x-x^4+x^2d$, so $\dot h=x+x^4-x^2d$. Complete the square in $x^2$: $x^4-x^2d=(x^2-\tfrac d2)^2-\tfrac{d^2}4\ge-\tfrac{d^2}{4}$, hence $\dot h\ge x-\tfrac14\|d\|_\infty^2=(2-h)-\tfrac14\|d\|_\infty^2\ge-h-\tfrac14\|d\|_\infty^2$, i.e. $\dot h\ge-\alpha(h)-\iota(\|d\|_\infty)$ with $\alpha(r)=r$ and $\iota(r)=r^2/4$. The inflated set is $C_d=\{h+\gamma(\|d\|_\infty)\ge 0\}$ with $\gamma=\beta^{-1}\circ\iota$, $\beta(r)=-\alpha(-r)=r$, so $\gamma(r)=r^2/4$ and $$C_d=\Big\{x:\ 2-x+\tfrac14\|d\|_\infty^2\ge 0\Big\},$$ which is the paper's eq. (25) with $\lambda=1$. On $\partial C_d$, $h=-\|d\|^2/4$ and $\dot h\ge\|d\|^2/4-\|d\|^2/4=0$: Nagumo applies.

(c) $\alpha(r)=r$ (extended class-$\mathcal K$ on $\mathbb R$), $\iota(r)=r^2/4$, $\gamma(r)=\beta^{-1}(\iota(r))=r^2/4$. The state overshoots $C$ by at most $\|d\|_\infty^2/4$; the certified inflation tends to zero as the chosen disturbance bound tends to zero. Unlike $k\equiv 0$ in (a), this holds for every disturbance level ($\gamma\in\mathcal K_\infty$ and $\inf_xh=-\infty$, the paper's global case); the controller $k=L_gh^\top$ is exactly the constructive one of Theorem 2, whose $-L_ghL_gh^\top=-x^4$ term produced the stabilizing $-x^4$ in $\dot x$. (This compares the invariant sets for different bounds; it does not say that a disturbed trajectory returns to $C$ once the disturbance stops, which needs a fresh undisturbed analysis from that time on, since $\|d\|_\infty$ over the whole signal does not shrink retroactively.)

Exercise 10.5 — Discounted safety Bellman equation on three states

States $A,B,F$ with margins $l(A)=2$, $l(B)=1$, $l(F)=-1$. Actions: from $A$ stay at $A$ or move to $B$; from $B$ move to $A$ or to $F$; $F$ is absorbing. (a) Write the undiscounted equation $V=\min\{l,\max_uV(x^+)\}$ and show its fixed point is not unique. (b) Write the discounted equation with $\gamma=\tfrac12$ and run value iteration from $V\equiv 0$ for four sweeps. (c) Give the fixed point and the safe set, and explain the convergence rate you observe.

Show answer

(a) $V(F)=\min\{-1,V(F)\}$, $V(B)=\min\{1,\max\{V(A),V(F)\}\}$, $V(A)=\min\{2,\max\{V(A),V(B)\}\}$. Take $V(F)=-1$. Then any $c\in[-1,2]$ with $V(A)=c$, $V(B)=\min\{1,c\}$ is a fixed point: the $B$-equation gives $\min\{1,\max\{c,-1\}\}=\min\{1,c\}$ because $c\ge-1$, and the $A$-equation gives $\min\{2,\max\{c,\min\{1,c\}\}\}=\min\{2,c\}=c$. (For $c\lt-1$ the $B$-equation would force $V(B)=-1\neq c$.) The equation does not pin down $V(A)$ (and even $V(F)=-5$ works), which is the non-contraction problem: value iteration from $V\equiv 0$ stops immediately at $V(A)=0$, wrongly suggesting $A$ has no margin.

(b) $V(x)=\tfrac12 l(x)+\tfrac12\min\{l(x),\max_uV(x^+)\}$. From $V_0\equiv 0$:
sweep 1: $V_1(A)=1+\tfrac12\min\{2,0\}=1$; $V_1(B)=\tfrac12+\tfrac12\min\{1,0\}=\tfrac12$; $V_1(F)=-\tfrac12+\tfrac12\min\{-1,0\}=-1$.
sweep 2: $V_2(A)=1+\tfrac12\min\{2,\max\{1,\tfrac12\}\}=1.5$; $V_2(B)=\tfrac12+\tfrac12\min\{1,\max\{1,-1\}\}=1$; $V_2(F)=-\tfrac12+\tfrac12(-1)=-1$.
sweep 3: $V_3(A)=1+\tfrac12\min\{2,1.5\}=1.75$; $V_3(B)=1$; $V_3(F)=-1$.
sweep 4: $V_4(A)=1+\tfrac12\cdot 1.75=1.875$; $V_4(B)=1$; $V_4(F)=-1$.

(c) Fixed point: $V(A)=2$ (check: $1+\tfrac12\min\{2,\max\{2,1\}\}=2$), $V(B)=1$, $V(F)=-1$; it is unique by the contraction, and the safe set is $\{V\ge 0\}=\{A,B\}$ with the safe policy "stay at $A$" / "go to $A$". The error $2-V_k(A)$ is $1,\ \tfrac12,\ \tfrac14,\ \tfrac18$: it halves each sweep, the contraction factor $\gamma=\tfrac12$. Note $V(A)=2=l(A)$: discounting did not shrink the value here because the safest action keeps the margin constant; in general $V_\gamma$ interpolates between the current and the future margin.

Exercise 10.6 — Recursive feasibility of the predictive safety filter

(a) Take $x_{k+1}=x_k+u_k$ (scalar), $X=[-1,1]$, $U=[-0.5,0.5]$, $N=2$, and the terminal set $S^t=\{0\}$ with $\pi_S^t\equiv 0$. Show that Assumption 4.2 holds, determine the set of states from which problem (5) is feasible, and verify the recursive-feasibility argument from $x(0)=1$ with $u_L\equiv 0.5$. (b) First show that dropping the terminal constraint cannot cause loss of recursive feasibility for the system in (a), because $u=0$ keeps every state of $X$ in $X$. Then change the dynamics to $x_{k+1}=x_k+u_k+0.6$, with the same input and state bounds. From $x(0)=0.5$, construct a feasible two-step plan and show why it cannot be continued safely forever. (c) Why does the sampled-data CBF condition $\alpha(r)\lt r/\Delta t$ of Hsu, Hu & Fisac play the role of the terminal set?

Show answer

(a) With $x=0$ and $u=0$ the state stays at 0 forever, inside $X$ with an admissible input, so $S^t=\{0\}$ and $\pi_S^t\equiv 0$ satisfy Assumption 4.2 (here $S^t$ is even control invariant). Problem (5) needs $x_{2|k}=x(k)+u_0+u_1=0$ with $|u_i|\le 0.5$ and $x_{1|k}\in X$: feasible iff $|x(k)|\le 1$, i.e. the feasible set is all of $X$. From $x(0)=1$: the only feasible plan is $u_0=u_1=-0.5$, so the RL input $0.5$ is not certified and $u(0)=-0.5$, $x(1)=0.5$. At $k=1$ the full problem is feasible again (for instance the shifted tail $-0.5$ followed by the terminal input $0$), so line 1 applies and resets $\bar k=1$. Its minimizer is not that candidate: minimizing $|0.5-u_0|$ subject to $u_0+u_1=-0.5$ and $|u_i|\le 0.5$ allows $u_0\in[-0.5,0]$, hence $u_0=0$, $u_1=-0.5$. So $u(1)=0$, $x(2)=0.5$, and the same problem is solved at every later step: the closed loop is $x(0)=1$ and $x(k)=0.5$ for all $k\ge 1$. Every applied input lies in $U$ and every state in $X$, as the induction predicts, but the state never reaches $S^t$. A planned arrival in the terminal set certifies that the system could get there; it is not a commitment, because replanning at every step keeps choosing the first input closest to $u_L$, which at $x=0.5$ is $0$.

(b) Without the terminal constraint, from $x(0)=0.5$ with $u_L\equiv 0.5$ the plan $u_0=0.5,u_1=0$ is feasible ($x_1=1,x_2=1\in X$), so the RL input passes the filter and $x(1)=1$. At $x=1$ the feasible first inputs are $u_0\le 0$, so the filter returns $u=0$ and the state stays on the boundary: safe so far. The filter did not fail in this example because the dynamics are so simple that $X$ itself is control invariant. Now add a drift: $x_{k+1}=x_k+u_k+0.6$ with the same $U=[-0.5,0.5]$, $X=[-1,1]$, $N=2$, no terminal set, $u_L\equiv 0.5$. From $x(0)=0.5$ a first input $u_0$ is feasible iff $x_1=1.1+u_0\le 1$ and some $u_1\ge-0.5$ gives $x_2=x_1+u_1+0.6\le 1$, i.e. iff $u_0\in[-0.5,-0.2]$; the filter picks the one closest to $u_L$, $u_0=-0.2$, and $x(1)=0.9$. There the two-step problem is infeasible ($x_1\ge 1.0$ forces $u_1\le-0.6$), so line 2 applies the shifted tail $u_1=-0.5$: $x(2)=1.0\in X$, still safe. At $k=2=N+\bar k$ line 3 hands over to a terminal policy, but none exists: every input gives $x(3)\ge 1.1\notin X$. So the filter "certified" a plan whose feasibility could not be continued, exactly what the terminal-set assumption prevents. The honest diagnosis is that no nonempty terminal safe set exists (the drift $0.6$ beats the actuator authority $0.5$, so no nonempty subset of $X$ is control invariant), and the filter's own feasibility at $k=0$ was a false promise.

(c) The CBF-QP is a horizon-1 filter whose terminal set is $C$. Its "terminal controller" is the fallback: any admissible input satisfying the CBF condition, such as $\operatorname{arg\,max}_{u\in U}\dot h$ when $U$ is compact (for $U=\mathbb R^m$ that maximum does not exist when $L_gh(x)\ne0$; when $L_gh(x)=0$ every input maximizes the constant objective. The min-norm element of the nonempty closed convex set $K_{\mathrm{cbf}}(x)$ serves in either case). To first order, neglecting the integration error between samples as Hsu et al.'s footnote 8 does, the condition $\alpha(r)\lt r/\Delta t$ for $r\gt 0$ makes one held step from a state that passes the monitor land in $C$ again: $h(x')\ge h-\alpha(h)\Delta t\ge 0$, strictly positive if $h\gt 0$. Because $h$ is a CBF, the one-step problem is then feasible again at the next sample: recursive feasibility in disguise. An exact sampled-data statement needs a bound on the inter-sample error of $h$, or a discrete-time CBF as in Cheng et al.

Key Papers

PaperVenueContributionWhy read it
Ames, Xu, Grizzle & Tabuada — Control Barrier Function Based Quadratic Programs for Safety Critical SystemsIEEE TAC 62(8), 2017Reciprocal and zeroing CBFs, invariance and asymptotic stability, the CLF-CBF QP and its Lipschitz continuity.The foundational paper; every CBF filter follows its template.
Ames, Coogan, Egerstedt, Notomista, Sreenath & Tabuada — Control Barrier Functions: Theory and ApplicationsECC 2019Tutorial: Nagumo, CBF theorem with regularity condition, necessity, CBF-QP, ECBFs, robotics applications.The standard entry point and the source of the definitions used here.
Wabersich, Taylor, Choi, Sreenath, Tomlin, Ames & Zeilinger — Data-Driven Safety Filters: Hamilton-Jacobi Reachability, Control Barrier Functions, and Predictive Methods for Uncertain SystemsIEEE CSM 43(5), 2023HJ, CBF and predictive filters as approximations of one ideal filter, with data-driven variants and hardware studies.The most complete single reference for this module.
Hsu, Hu & Fisac — The Safety Filter: A Unified View of Safety-Critical Control in Autonomous SystemsAnnu. Rev. Control Robot. Auton. Syst. 7, 2024Fallback + monitor + intervention; the universal safety filter theorem with HJ, CBF and shielding as corollaries.The organizing theory of Section 8.
Wabersich & Zeilinger — A predictive safety filter for learning-based control of constrained nonlinear dynamical systemsAutomatica 129, 2021The predictive safety filter, its shrinking-horizon algorithm and a probabilistic guarantee for learned models.Defines the MPC branch of safety filters.
Mitchell, Bayen & Tomlin — A time-dependent Hamilton-Jacobi formulation of reachable sets for continuous dynamic gamesIEEE TAC 50(7), 2005Backward reachable tubes as zero sublevel sets of the viscosity solution of an HJI PDE with the $\min[0,H]$ term.The formulation behind every HJ toolbox and filter.
Bansal, Chen, Herbert & Tomlin — Hamilton-Jacobi Reachability: A Brief Overview and Recent AdvancesCDC 2017Tutorial on BRS/BRT, max–min roles, numerical tools and decompositions.Read before touching a level-set toolbox.
Fisac, Akametalu, Zeilinger, Kaynama, Gillula & Tomlin — A General Safety Framework for Learning-Based Control in Uncertain Robotic SystemsIEEE TAC 64(7), 2019HJ safety supervisor around an arbitrary learner with GP disturbance bounds and a Bayesian intervention trigger.The reference least-restrictive filter with online validation.
Fisac, Lugovoy, Rubies-Royo, Ghosh & Tomlin — Bridging Hamilton-Jacobi Safety Analysis and Reinforcement LearningICRA 2019The discounted safety Bellman equation is a contraction; RL approximates HJ safe sets.Started the RL-for-reachability line (reach-avoid, latent, gameplay filters).
Hsu, Rubies-Royo, Tomlin & Fisac — Safety and Liveness Guarantees through Reach-Avoid Reinforcement LearningRSS 2021Discounted reach-avoid Bellman equation: contraction, convergence, conservative under-approximation.The standard formulation for safety plus liveness.
Kolathaya & Ames — Input-to-State Safety With Control Barrier FunctionsIEEE L-CSS 3(1), 2019ISSf: invariance of an inflated set under bounded input disturbances; constructive ISSf-CBF and QP.The standard robustness notion for CBF filters.
Xiao & Belta — High-Order Control Barrier FunctionsIEEE TAC 67(7), 2022Nested class-$\mathcal K$ constructions for constraints of any relative degree; feasibility via penalties.The standard tool for position constraints under force inputs.
Cheng, Orosz, Murray & Burdick — End-to-End Safe Reinforcement Learning through Barrier Functions for Safety-Critical Continuous Control TasksAAAI 2019RL policy + GP-model CBF compensator; corrections fed back to guide exploration.The canonical CBF-based safe RL paper.
Alshiekh, Bloem, Ehlers, Könighofer, Niekum & Topcu — Safe Reinforcement Learning via ShieldingAAAI 2018Shields synthesized from safety games on an abstraction; preemptive and post-posed placement.The founding paper of shielding.
Frauenknecht, Kesper, Mayfrank, Hose & Trimpe — Uncertainty-Aware Predictive Safety Filters for Probabilistic Neural Network DynamicsRLC 2026UPSi: predictive filter over a probabilistic ensemble with aleatoric/epistemic split, reachable tubes and a certainty constraint.A 2026 predictive filter with rigorous reachable tubes for neural ensemble models (Trimpe group).

Also cited above: Blanchini, Automatica 1999; Prajna & Jadbabaie, HSCC 2004; Xu, Tabuada, Grizzle & Ames, IFAC ADHS 2015; Ames, Grizzle & Tabuada, CDC 2014; Nguyen & Sreenath, ACC 2016; Reis, Aguiar & Tabuada, L-CSS 2021; Dalal et al., 2018; Taylor et al., L4DC 2020; Robey et al., CDC 2020; Choi et al., CDC 2021; DeepReach, ICRA 2021; Wabersich & Zeilinger, TAC 2023; So et al., ICRA 2024; GCBF+, T-RO 2025; Gameplay Filters, CoRL 2024; Latent Safety Filters, RSS 2025; SafeDiffuser, ICLR 2025; PACS, ICRA 2026; Dyna-SAuR, 2026; Krasowski et al., TMLR 2023; Mayne, Seron & Raković, Automatica 2005; Aswani et al., Automatica 2013; Koller et al., CDC 2018; Hewing et al., Annu. Rev. 2020.

Flashcards