Representing Differential Inclusions as Monads: A Framework for Compositional Controller Synthesis
Sequential composition of safety-certified controllers for hybrid and non-smooth robotic systems is well studied piecewise. Yet no existing framework reduces this question to a single algebraic condition.
From the abstract. Our summary is in progress.
Full paper
Representing Differential Inclusions as Monads: A Framework for Compositional Controller Synthesis
Published under CC BY 4.0. Reproduced with attribution; original at arXiv:2611.19469 (PDF).
Abstract
Sequential composition of safety-certified controllers for hybrid and non-smooth robotic systems is well studied piecewise. Yet no existing framework reduces this question to a single algebraic condition. We construct a trajectory monad for Filippov-regular differential inclusions. Its Kleisli category treats controllers as morphisms and sequential execution as trajectory concatenation. Control Barrier Function (CBF) certification, a guarantee of forward invariance, corresponds to a sub-monad of this category. Joint safety of composed controllers then follows from one algebraic condition. All controllers must land in a common sub-monad, which is closed under the monad multiplication.
The sub-monad condition recasts recasts existing CBF composition practice categorically. It explains why a smooth intersection of multiple barriers supports safe composition, while enforcing barriers phase by phase does not. For the phase-by-phase case, we derive a closed-form Bernoulli model of the failure rate. We validate it over a randomized sweep of 3,000 instances. The same sweep shows that the standard baseline degrades under constraint conflict as the barrier count grows. This baseline enforces all barriers simultaneously as constraints in a single quadratic program (QP). We instantiate the framework on a four-mode piecewise-affine system and on a unicycle reduced-order model over heterogeneous terrain.
I Introduction
Compositional controller design is a fundamental challenge in hybrid robotics, including legged locomotion, manipulation with contacts, and variable-structure control. Given controllers certified to be individually safe, does their sequential execution produce a jointly safe trajectory? Existing approaches answer this piecewise, each under its own composition regime. No unifying account explains why some composition strategies preserve safety certificates while others provably fail.
Several mature lines of work address pieces of this problem. Boolean and smooth CBF compositions [1, 2, 3, 4] prove forward invariance for min/max, smooth AND/OR, and nested Boolean combinations of barriers. They are compositional within a fixed operating mode. A separate line of work asks when several CBFs can be enforced jointly without emptying the input-constrained feasible set [5, 6]. We observe this QP infeasibility empirically for the simultaneous-constraint baseline in §VI. Outside the CBF literature, sequential composition has a long history in robotics through funnels built from Lyapunov sublevel sets [7]. Sum-of-squares funnel libraries later made this approach robust to disturbances [8]. Assume-guarantee contracts [9] provide cascade and feedback composition theorems for continuous-time invariance, with extensions to hybrid systems [10]. Monadic and categorical systems theory [11, 12, 13, 14] has used Kleisli categories for dynamical-system composition since the work in [14]. The hybrid monad of [12] is the closest predecessor to our construction.
None of these frameworks gives a unified categorical formulation in which CBF certificates lift as sub-monadic structure with provably closed Kleisli composition. The Boolean nonsmooth compositions of [1] are mode-local and do not address sequential phase transitions. Funnel-based sequential composition [7, 8] checks compatibility funnel by funnel rather than through a single algebraic condition. It also targets Lyapunov sublevel sets rather than CBF-certified safe sets. The input-constrained compatibility conditions of [5, 6] guarantee feasibility of the composed QP. Like the Boolean compositions, however, they are stated mode-locally rather than across sequential handoffs. The hybrid monad [12, 13] handles hybrid trajectory composition but does not embed safety certificates. Assume-guarantee contracts [9] give sufficient conditions for composition in a contract-based formalism rather than an algebraic one. Within that framework, the question of why composition fails has no algebraic answer.
Contribution. We develop a trajectory monad that fills this gap. It is a mathematical structure on Filippov-regular differential inclusions. Its Kleisli category is a formal language for composing safety-certified controllers. Its sub-monad structure gives a sufficient condition for compositional safety and a precise account of why naive composition fails. The sub-monad account also has analytical consequences. It identifies the failure mode as a local mismatch of sub-monad membership at each Kleisli handoff. This locality lets us model the failure probability as a sequence of independent trials, one per handoff (§VI).
Specifically, the contributions of this work are:
1. Construction of the trajectory monad for Filippov-regular differential inclusions on diffeological spaces, with the monad laws holding exactly (§III). 2. Formalization of sequential controller design in the resulting Kleisli category, which encodes mode switching as Kleisli composition (§IV). 3. Lifting of CBF certificates to sub-monads, a characterization of when Kleisli composition fails, and a sufficient condition for compositional safety. The condition is a common sub-monad, realized by a smooth intersection CBF with an explicit margin (§V). 4. A closed-form Bernoulli model for the naive failure rate, which treats each Kleisli handoff as an independent trial. The sub-monad mismatch structure of §V motivates this decomposition. We validate the model over 3,000 randomized instances with phase counts n\in\{2,\dots,6\} and barrier counts k\in\{2,\dots,5\}. The same sweep shows the standard simultaneous-constraint QP baseline degrading under constraint conflict as k grows (§VI). 5. Numerical instantiation on two use cases, a four-mode piecewise-affine (PWA) system and a unicycle reduced-order model on heterogeneous terrain (§VII).
Related work. The categorical treatment of open dynamical systems via polynomial functors and lenses is developed in [11]. Section 2.3 of that work uses Kleisli composition explicitly as a systems-composition language. We specialize to Filippov systems and add safety-certificate lifting, which does not appear there. The hybrid monad of [12, 13] uses the same Moore-path construction for strictly associative hybrid composition. Its authors use it to define the meaning of loops in hybrid programs. They do not address safety certificates or controller design (see Remark III.1). The sheaf-theoretic formulation of [15] offers a complementary account of dynamical-system composition. The smooth Boolean CBF compositions of [16, 3] and the softmin barrier analysis of [17] are the engineering tools we embed into the monadic framework. We recover their safety guarantee from sub-monad closure (Theorem V.4).
II Preliminaries
II-A System Model and Filippov Regularity
Let M be a smooth manifold of dimension d representing the state space. Consider the control-affine system
\dot{x}=f(x)+B(x)\,u,\quad u\in\mathbf{U}\subset\mathbb{R}^{m},where f:M\to TM and B(x):\mathbb{R}^{m}\to T_{x}M, with TM the tangent bundle of M. We assume f and B are locally bounded and measurable, and locally Lipschitz away from finitely many switching surfaces. The input set \mathbf{U} is compact and convex. The dynamics may switch discontinuously, e.g., at contact events or in variable-structure control. The right-hand side of (1) then need not admit a classical solution. We instead model such behavior via the Filippov differential inclusion [18, 19]
\displaystyle\dot{x}\in \\ \displaystyle F(x):=\bigcap_{\rho>0}\, \\ \displaystyle\bigcap_{\mathrm{Leb}(\mathcal{N})=0}\overline{\mathrm{co}}\bigl\{f(y)+B(y)u\mid y\in\mathcal{B}_{\rho}(x)\setminus\mathcal{N},\ u\in\mathbf{U}\bigr\}.Here \overline{\mathrm{co}}\{\cdot\} denotes the closed convex hull, and \mathcal{B}_{\rho}(x) is the ball of radius \rho about x in local coordinates. The inner intersection ranges over all Lebesgue-null sets \mathcal{N}. Where f and B are continuous, F(x) reduces to the set of control-reachable velocities \overline{\mathrm{co}}\{f(x)+B(x)u\mid u\in\mathbf{U}\}. On a switching surface, it also convexifies the velocities of the adjacent modes. This is what admits absolutely continuous solutions across the switch.
Assumption II.1 (Filippov regularity [18])
The set-valued map F:M\rightrightarrows TM is upper-semicontinuous with nonempty compact convex values everywhere on M.
Assumption II.1 holds for (2) whenever f and B are locally bounded and measurable and \mathbf{U} is compact and convex [19]. It therefore holds for all PWA systems with box input sets. Under Assumption II.1, Filippov’s theorem guarantees that a solution exists on some [0,r] from every x_{0}\in M. The solution need not be unique.
II-B Control Barrier Functions
Let h:M\to\mathbb{R} be a continuously differentiable function and let \mathfrak{C}=\{x\in M:h(x)\geq 0\} be the corresponding safe set.
Definition II.1 (Control Barrier Function [20])
A function h is a Control Barrier Function (CBF) for system (1) if some extended class-\mathcal{K} function \alpha satisfies
\sup_{u\in\mathbf{U}}\,\bigl[\nabla h(x)^{\top}\bigl(f(x)+B(x)\,u\bigr)\bigr]\;\geq\;-\alpha\bigl(h(x)\bigr)for all x\in M. An extended class-\mathcal{K} function is continuous and strictly increasing on all of \mathbb{R}, with \alpha(0)=0.
If h is a CBF, the CBF-QP safety filter
\displaystyle u^{*}(x)=\argmin_{u\in\mathbf{U}}\,\|u-u_{\mathrm{nom}}(x)\|^{2} \\ \displaystyle\text{s.t.}\quad\nabla h(x)^{\top}\bigl(f(x)+B(x)\,u\bigr)\geq-\alpha\,h(x)renders \mathfrak{C} forward-invariant [20]. That is, x(0)\in\mathfrak{C} implies x(t)\in\mathfrak{C} for all t\geq 0. Here u_{\mathrm{nom}}:M\to\mathbf{U} is a nominal (task-level) controller. Throughout, we take the linear choice \alpha(h)=\alpha h with scalar gain \alpha>0, as in (3). This choice only fixes the implemented constraint. Our results in §III–§V use only forward invariance and hold for any extended class-\mathcal{K} function.
II-C Categorical Preliminaries
We recall the minimal diffeology background used in §III, together with monads and Kleisli categories. See [21] and [11] for the general theories. Throughout, \circ denotes composition of functors, natural transformations, or morphisms in an arbitrary category \mathcal{C}, as determined by context.
Definition II.2 (Diffeology)
A diffeology on a set X plays the role for an arbitrary set that a smooth atlas plays for a manifold. It specifies which maps into X, from open Euclidean domains, count as smooth. Formally, a diffeology assigns to every open O\subset\mathbb{R}^{p} (any p\geq 0) a set of maps O\to X, called plots, with three properties.
1. Every constant map O\to X is a plot. 2. (Locality) If O=\bigcup_{i}O_{i} is an open cover and the restriction of \lambda:O\to X to each O_{i} is a plot, then \lambda itself is a plot. 3. (Smooth reparametrization) If \lambda:O\to X is a plot and g:O^{\prime}\to O is smooth in the ordinary sense for open O^{\prime}\subset\mathbb{R}^{p^{\prime}}, then \lambda\circ g is a plot.
A set together with a diffeology is a diffeological space.
Definition II.3 (Smooth maps)
A map q:X\to Y between diffeological spaces is smooth if q\circ\lambda is a plot of Y for every plot \lambda of X. Let D\subset\mathbb{R}^{p} be a subset that is not open. A map defined on D is smooth if, around every point of D, it extends to a smooth map on an open neighborhood in \mathbb{R}^{p}. We write \mathbf{Diff} for the category of diffeological spaces with smooth maps as morphisms.
Every smooth manifold carries a canonical diffeology whose plots are the smooth maps in the usual sense. This assignment is a full and faithful embedding \mathbf{Man}\hookrightarrow\mathbf{Diff} [21]. We use it to regard M as an object of \mathbf{Diff} without altering its manifold structure. Unlike \mathbf{Man}, the category of smooth manifolds, \mathbf{Diff} is complete, cocomplete, and cartesian closed [21]. Section III uses these properties.
The following definitions are standard and are stated for a generic monad (T,\eta,\mu) on an arbitrary category \mathcal{C}; §III specializes \mathcal{C}=\mathbf{Diff} and constructs the specific trajectory monad (\mathcal{T},\eta,\mu).
Definition II.4 (Monad)
A monad on a category \mathcal{C} is a triple (T,\eta,\mu). Here T:\mathcal{C}\to\mathcal{C} is an endofunctor, \eta:\mathrm{Id}_{\mathcal{C}}\Rightarrow T is a natural transformation called the unit, and \mu:T\circ T\Rightarrow T is a natural transformation called the multiplication. They satisfy the left unit law \mu\circ\eta_{T}=\mathrm{id}_{T}, the right unit law \mu\circ T(\eta)=\mathrm{id}_{T}, and the associativity law \mu\circ\mu_{T}=\mu\circ T(\mu). The functor \mathrm{Id}_{\mathcal{C}} is the identity on \mathcal{C}, and \mathrm{id}_{T} is the identity natural transformation on T, with components (\mathrm{id}_{T})_{A}=\mathrm{id}_{T(A)}.
Definition II.5 (Kleisli category)
The Kleisli category \mathbf{Kl}(T) of a monad (T,\eta,\mu) on \mathcal{C} has the same objects as \mathcal{C}. A Kleisli morphism \varphi:X\to Y in \mathbf{Kl}(T) is a morphism \varphi:X\to T(Y) in \mathcal{C}. Two such morphisms \varphi:X\to T(Y) and \chi:Y\to T(Z) compose as
\chi\circ_{K}\varphi\;:=\;\mu_{Z}\circ T(\chi)\circ\varphi\;:\;X\to T(Z),where \circ_{K} denotes Kleisli composition.
Definition II.6 (Sub-monad)
A sub-monad of (T,\eta,\mu) is a monad (T^{\prime},\eta^{\prime},\mu^{\prime}) together with a monad morphism \iota:T^{\prime}\hookrightarrow T, which is a natural transformation commuting with units and multiplications. We say T^{\prime} is a sub-monad of T and write T^{\prime}\subset T.
II-D Running Examples
We consider two systems as use cases throughout the paper. Both satisfy Assumption II.1, so the trajectory monad construction of §III applies to each.
Use Case I (four-mode PWA system). Let x=(x_{1},x_{2})^{\top}\in\mathbb{R}^{2} be the state. The system is \dot{x}=A_{\ell(x)}x+c_{\ell(x)}+u with u\in\mathbf{U}=[-1,1]^{2}. The mode index \ell(x)\in\{1,2,3,4\} is the quadrant of x [22]. Each mode combines a contraction with a rotation, and the rotation direction alternates between adjacent quadrants. We use A_{1}=A_{3}=\begin{bmatrix}-0.4&1.5\\ -1.5&-0.4\end{bmatrix} and A_{2}=A_{4}=A_{1}^{\top}. The offsets are c_{1}=(0.2,0.2)^{\top}, c_{2}=(-0.2,0.2)^{\top}, c_{3}=-c_{1}, and c_{4}=-c_{2}, so each offset points away from the origin into its own quadrant. This corresponds to f(x)=A_{\ell(x)}x+c_{\ell(x)} and B(x)=I_{2} in (1). In the interior of each quadrant, the map (2) is F(x)=A_{\ell(x)}x+c_{\ell(x)}+[-1,1]^{2}. On the coordinate axes, it is the convex hull of the adjacent modes’ velocity sets. In both cases F(x) is a compact convex polytope.
Use Case II (modal unicycle reduced-order model). Let \xi=(p_{x},p_{y},\psi)^{\top}\in M:=\mathbb{R}^{2}\times S^{1}, where (p_{x},p_{y}) is the planar position and \psi is the heading angle. The control input is u=(v,\omega)^{\top}, with forward speed v and yaw rate \omega. The unicycle reduced-order model (ROM) [23] has input matrix G(\xi)=\begin{bmatrix}\cos\psi&0\\ \sin\psi&0\\ 0&1\end{bmatrix}. We add terrain modes that make the plant a genuine Filippov system. The mode \ell(\xi)=\arg\min_{i}h_{i}(\xi)\in\{1,2,3\} indexes the most binding of the three barriers of §VII, which represent flat ground, stepping stones, and a slope edge. The dynamics are \dot{\xi}=f_{\ell(\xi)}+G(\xi)\,u with u\in\mathbf{U}_{\ell(\xi)}=[0,v_{\max,\ell}]\times[-\omega_{\max,\ell},\omega_{\max,\ell}]. The limits (v_{\max,\ell},\omega_{\max,\ell}) are (0.45,1.50), (0.25,0.90), and (0.35,1.10) for \ell=1,2,3, in m/s and rad/s. Only the stepping stones carry drift, f_{2}=(0.015,0,0)^{\top} m/s, while f_{1}=f_{3}=0. This corresponds to f=f_{\ell(\xi)} and B=G in (1).
The modes switch on the surfaces \{h_{i}=h_{j}\}, where both the input set and the drift jump. The drift f_{2} lies outside the span of G(\xi) unless the robot heads along the p_{x}-axis. The velocity sets of mode 2 and its neighbors are then disjoint, so (2) convexifies across a genuine discontinuity. Assumption II.1 holds because the drift is bounded and each \mathbf{U}_{\ell} is compact and convex. Cohen et al. [23] show that the unicycle ROM captures the safety-relevant navigation behavior of an 18-DOF quadruped.
III The Trajectory Monad
Definition II.5 presupposes a monad on the systems of interest. Before asking whether CBF certificates are preserved under sequential composition, we construct one. We write (\mathcal{T},\eta,\mu) for this specific trajectory monad, to distinguish it from the generic monad (T,\eta,\mu) of Definitions II.4–II.6. The endofunctor \mathcal{T} sends each state to the trajectories it can generate. The unit \eta regards a state as the trivial trajectory at that state. The multiplication \mu flattens a trajectory of trajectories. It follows the initial points of the inner trajectories and then appends the last inner trajectory.
We construct \mathcal{T}(M) in \mathbf{Diff}, the category of diffeological spaces [21]. The space of all admissible trajectories of (2) is infinite-dimensional and not itself a manifold. The category \mathbf{Diff}, by contrast, is complete, cocomplete, and cartesian closed, and it contains every smooth manifold as a full subcategory [21]. The state space M therefore remains the finite-dimensional manifold of §II-A. Only \mathcal{T}(M) needs the added generality.
The one genuine difficulty is associativity of concatenation. Suppose trajectories are parametrized on a fixed interval such as [0,1]. Concatenating two of them then requires rescaling each by a factor of two. Concatenating a third depends on which pair is rescaled first. Associativity then holds only up to a reparametrizing homeomorphism, not as literal equality of functions. Moore trajectories keep their true duration instead of being rescaled onto a fixed interval. They give strict, on-the-nose associativity (§III-A).
Throughout, \mathcal{T} denotes this specific trajectory monad and \mathbf{Kl}(\mathcal{T}) its Kleisli category. Strictly speaking, \mathcal{T} acts on pairs (M,F_{M}), since \mathcal{T}(M) contains only trajectories admissible for F_{M}. It acts on smooth maps q:M\to N that send admissible trajectories of F_{M} to admissible trajectories of F_{N} [24]. We suppress F from the notation.
III-A Moore Trajectories and Strict Associativity
Definition III.1 (Moore trajectory space)
A Moore trajectory of duration r\geq 0 in M is a pair (\gamma,r), where \gamma:[0,r]\to M is absolutely continuous. That is, \gamma is differentiable almost everywhere, its derivative \dot{\gamma} lies in L^{1}([0,r]), the space of Lebesgue-integrable functions on [0,r], and \gamma(t)=\gamma(0)+\int_{0}^{t}\dot{\gamma}(s)\,ds. The trajectory monad object is the disjoint union over all durations
\mathcal{T}(M)=\bigsqcup_{r\geq 0}\bigl\{(\gamma,r)\mid\gamma:[0,r]\to M,\;\dot{\gamma}(t)\in F(\gamma(t))\text{ a.e.}\bigr\}.The endpoint map is \mathrm{end}(\gamma,r)=\gamma(r). We equip \mathcal{T}(M) with the functional diffeology. A map \lambda:O\to\mathcal{T}(M), with O\subset\mathbb{R}^{p} open and \lambda(z)=(\gamma_{z},r(z)), is a plot iff the duration map z\mapsto r(z) is smooth and the evaluation map (z,t)\mapsto\gamma_{z}(t) is smooth in the sense of Definition II.3.
Consider two Moore trajectories (\gamma_{1},r_{1}) and (\gamma_{2},r_{2}) with \gamma_{1}(r_{1})=\gamma_{2}(0). Their concatenation is defined by
(\gamma_{1}\cdot\gamma_{2})(t):=\begin{cases}\gamma_{1}(t)&0\leq t<r_{1},\\
\gamma_{2}(t-r_{1})&r_{1}\leq t\leq r_{1}+r_{2}.\end{cases}The concatenation has duration |\gamma_{1}\cdot\gamma_{2}|=r_{1}+r_{2}. Durations are real numbers, so (\gamma_{1}\cdot\gamma_{2})\cdot\gamma_{3}=\gamma_{1}\cdot(\gamma_{2}\cdot\gamma_{3}) holds strictly as functions. Both sides have duration r_{1}+r_{2}+r_{3} and agree on every sub-interval.
Remark III.1 (Relation to the hybrid monad)
The hybrid monad of [12, 13] pairs a duration with a path in a similar way, and our multiplication follows theirs. They use it for strictly associative iteration semantics of hybrid computation, in a deterministic setting. Our construction transfers it to Filippov-admissible trajectories on diffeological spaces. It also lifts safety certificates as sub-monadic structure (§V), which neither prior work does.
III-B Unit and Multiplication
Definition II.4 requires a unit \eta and a multiplication \mu in addition to the endofunctor. Having constructed \mathcal{T}, we define these two pieces next.
Definition III.2 (Unit)
The unit \eta_{M}:M\to\mathcal{T}(M) maps each state to the duration-zero constant trajectory at that state,
\eta_{M}(x_{0})=(\mathrm{const}_{x_{0}},\,0),where \mathrm{const}_{x_{0}}:[0,0]\to M is the trivial path.
Definition III.3 (Multiplication)
Let \mathrm{head}(\gamma,r):=\gamma(0) denote the initial point of a Moore trajectory. An element of \mathcal{T}(\mathcal{T}(M)) is an outer Moore trajectory \Gamma:[0,R]\to\mathcal{T}(M) whose head path \theta\mapsto\mathrm{head}(\Gamma(\theta)) is admissible for F. The multiplication follows the head path up to time R and then appends the last inner trajectory,
\mu_{M}(\Gamma):=\bigl(\mathrm{head}\circ\Gamma,\,R\bigr)\cdot\Gamma(R).The concatenation is well defined because the head path ends at \mathrm{head}(\Gamma(R)). This is the multiplication of the hybrid monad of [12], transferred to Filippov-admissible trajectories.
III-C Monad Laws
Having fixed \mathcal{T}, \eta, and \mu, it remains to check the monad laws, including naturality of \eta and \mu. For set-valued F, naturality holds only under a regularity condition on F. Filippov regularity (Assumption II.1) supplies this condition.
For a map q as above, define \mathcal{T}(q)(\gamma,r)=(q\circ\gamma,r). By the chain rule for absolutely continuous curves, \mathcal{T}(q) maps admissible trajectories of F_{M} to admissible trajectories of F_{N}.
Naturality of \eta and \mu means that such a map q commutes with the unit (“doing nothing”) and with concatenation, as in (6). It certifies that the monad structure does not depend on the choice of coordinates.
{\lx@inpgf@ignorespaces M} \\ {\lx@inpgf@ignorespaces N} \\ {\lx@inpgf@ignorespaces\mathcal{T}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}(N)} \\ \scriptstyle{\lx@inpgf@ignorespaces q} \\ \scriptstyle{\lx@inpgf@ignorespaces\eta_{M}} \\ \scriptstyle{\lx@inpgf@ignorespaces\eta_{N}} \\ \scriptstyle{\lx@inpgf@ignorespaces\mathcal{T}(q)} \\ {\lx@inpgf@ignorespaces\mathcal{T}^{2}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}^{2}(N)} \\ {\lx@inpgf@ignorespaces\mathcal{T}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}(N)} \\ \scriptstyle{\lx@inpgf@ignorespaces\mathcal{T}^{2}(q)} \\ \scriptstyle{\lx@inpgf@ignorespaces\mu_{M}} \\ \scriptstyle{\lx@inpgf@ignorespaces\mu_{N}} \\ \scriptstyle{\lx@inpgf@ignorespaces\mathcal{T}(q)}Theorem III.4 (Monad laws)
Under Assumption II.1, (\mathcal{T},\eta,\mu) is a monad on \mathbf{Diff}, and the following diagrams commute on the nose.
{\lx@inpgf@ignorespaces\mathcal{T}^{3}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}^{2}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}^{2}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}(M)} \\ \scriptstyle{\lx@inpgf@ignorespaces\mathcal{T}(\mu)} \\ \scriptstyle{\lx@inpgf@ignorespaces\mu_{\mathcal{T}}} \\ \scriptstyle{\lx@inpgf@ignorespaces\mu} \\ \scriptstyle{\lx@inpgf@ignorespaces\mu} \\ {\lx@inpgf@ignorespaces\mathcal{T}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}^{2}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}(M)} \\ \scriptstyle{\lx@inpgf@ignorespaces\eta_{\mathcal{T}}} \\ \scriptstyle{\lx@inpgf@ignorespaces\mathrm{id}} \\ \scriptstyle{\lx@inpgf@ignorespaces\mu}Proof:
Unit laws. For \Gamma=\eta_{\mathcal{T}(M)}(\gamma,r), the head path has duration zero and \mu_{M} returns (\gamma,r). For \Gamma=\mathcal{T}(\eta_{M})(\gamma,r), the head path is \gamma itself and the appended trajectory has duration zero. Associativity. For \Gamma\in\mathcal{T}^{3}(M), both paths around the left square in (7) produce the same three segments in the same order. These are the heads of the heads of \Gamma, the head path of \Gamma(R), and the last inner trajectory of \Gamma(R). Moore concatenation is strictly associative, so the two results agree as functions. Naturality. The map \mathcal{T}(q) acts pointwise on paths, preserves durations, and commutes with \mathrm{head}. It therefore commutes with \eta and \mu, which is exactly (6). \square ∎
IV The Kleisli Category as Controller Language
We now use the Kleisli category of (\mathcal{T},\eta,\mu) to model controllers as morphisms and sequential execution as their composition. This gives the language in which §V states and proves compositional safety.
Apply Definition II.5 to the trajectory monad (\mathcal{T},\eta,\mu), with M,N,Z in the role of the generic objects X,Y,Z. A Kleisli morphism \varphi:M\to\mathcal{T}(N) assigns to each initial state one admissible Moore trajectory. We call a Kleisli morphism \varphi:M\to\mathcal{T}(M) a controller when it is rooted, i.e., \mathrm{head}(\varphi(x))=x, so that its trajectory starts where it is invoked. Every closed-loop system generates a rooted morphism, and the unit \eta_{M} is rooted. For controllers \varphi and \chi, Definition III.3 gives
(\chi\circ_{K}\varphi)(x)=\varphi(x)\cdot\chi\bigl(\mathrm{end}(\varphi(x))\bigr).Indeed, since \chi is rooted, the head path of \mathcal{T}(\chi)(\varphi(x)) is \varphi(x) itself, and the appended trajectory is \chi run from the endpoint. Kleisli composition is therefore sequential execution. We run \varphi, then run \chi from where \varphi stopped. The composite is again rooted, and by Theorem III.4, \circ_{K} is associative on the nose.
Diagram (8) shows Kleisli composition in \mathbf{Kl}(\mathcal{T}).
{\lx@inpgf@ignorespaces M} \\ {\lx@inpgf@ignorespaces\mathcal{T}(N)} \\ {\lx@inpgf@ignorespaces\mathcal{T}^{2}(Z)} \\ {\lx@inpgf@ignorespaces\mathcal{T}(Z)} \\ \scriptstyle{\lx@inpgf@ignorespaces\varphi} \\ \scriptstyle{\lx@inpgf@ignorespaces\chi\circ_{K}\varphi} \\ \scriptstyle{\lx@inpgf@ignorespaces\mathcal{T}(\chi)} \\ \scriptstyle{\lx@inpgf@ignorespaces\mu_{Z}}Remark IV.1 (Prior uses of Kleisli composition for systems)
Kleisli categories for dynamical systems appear in [14] and in Section 2.3 of [11]. What is new here is that the morphisms carry CBF safety certificates. A morphism \varphi:M\to\mathcal{T}_{\!\mathfrak{C}}(N), with \mathcal{T}_{\!\mathfrak{C}} the CBF sub-monad of §V, is a controller with a proven invariance guarantee. The sub-monad structure of §V is what makes these certificates composable.
V CBF Sub-Monads and Compositional Safety
Kleisli composition models sequential execution, but it does not by itself preserve safety certificates. We now identify which Kleisli morphisms carry a safety guarantee. We then ask when composing two such morphisms preserves it.
V-A Lifting CBF Certificates to Sub-Monads
Let h:M\to\mathbb{R} be a CBF with safe set \mathfrak{C}=\{x:h(x)\geq 0\} as in §II-B.
Definition V.1 (CBF sub-monad)
The CBF sub-monad associated to h is
\mathcal{T}_{\!\mathfrak{C}}(M)=\{(\gamma,r)\in\mathcal{T}(M)\mid h(\gamma(t))\geq 0,\ \forall t\in[0,r]\}.It collects the admissible Moore trajectories that never leave \mathfrak{C}. Its unit is \eta_{M} restricted to \mathfrak{C}.
Proposition V.2 (Sub-monad closure)
The unit and multiplication of \mathcal{T} preserve \mathcal{T}_{\!\mathfrak{C}}. That is, \eta_{M}(\mathfrak{C})\subseteq\mathcal{T}_{\!\mathfrak{C}}(M), and \mu_{M} maps \mathcal{T}_{\!\mathfrak{C}}^{2}(M) into \mathcal{T}_{\!\mathfrak{C}}(M). Hence \mathcal{T}_{\!\mathfrak{C}} is a sub-monad of \mathcal{T}, and the inclusion \iota:\mathcal{T}_{\!\mathfrak{C}}\hookrightarrow\mathcal{T} is a monad morphism. Diagram (9) expresses the compatibility with multiplication.
{\lx@inpgf@ignorespaces\mathcal{T}_{\!\mathfrak{C}}^{2}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}_{\!\mathfrak{C}}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}^{2}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}(M)} \\ \scriptstyle{\lx@inpgf@ignorespaces\mu^{\mathfrak{C}}_{M}} \\ \scriptstyle{\lx@inpgf@ignorespaces\iota\circ\mathcal{T}(\iota)} \\ \scriptstyle{\lx@inpgf@ignorespaces\iota} \\ \scriptstyle{\lx@inpgf@ignorespaces\mu_{M}}Proof:
For x_{0}\in\mathfrak{C}, the unit \eta_{M}(x_{0})=(\mathrm{const}_{x_{0}},0) never leaves \mathfrak{C}. Now let \Gamma\in\mathcal{T}_{\!\mathfrak{C}}^{2}(M). Each \Gamma(\theta) lies in \mathcal{T}_{\!\mathfrak{C}}(M), so its head lies in \mathfrak{C} and the head path never leaves \mathfrak{C}. The appended trajectory \Gamma(R) also stays in \mathfrak{C}. By the piecewise definition of concatenation, \mu_{M}(\Gamma) stays in \mathfrak{C} throughout. Diagram (9) commutes by construction. \square ∎
Closure uses only the definition of \mathcal{T}_{\!\mathfrak{C}}, not the CBF property. The CBF property enters in Theorem V.4. There it guarantees that the CBF-QP controller (3) generates a trajectory in \mathcal{T}_{\!\mathfrak{C}}(M) from every x_{0}\in\mathfrak{C}. This is the viability of \mathfrak{C} under (2) in the sense of [25].
V-B Failure of Naive Composition
Proposition V.3 (Naive composition fails)
Let \varphi:M\to\mathcal{T}_{\!\mathfrak{C}_{1}}(M) and \chi:M\to\mathcal{T}_{\!\mathfrak{C}_{2}}(M) be controllers certified for different safe sets \mathfrak{C}_{1}\neq\mathfrak{C}_{2}. The Kleisli composite (\chi\circ_{K}\varphi)(x) need not lie in \mathcal{T}_{\!\mathfrak{C}_{1}\cap\mathfrak{C}_{2}}(M). Diagram (10) shows why. The two controllers reach \mathcal{T}(M) through two different inclusions, and no common sub-monad need contain the image.
{\lx@inpgf@ignorespaces\mathcal{T}_{\!\mathfrak{C}_{1}}} \\ {\lx@inpgf@ignorespaces M} \\ {\lx@inpgf@ignorespaces\mathcal{T}(M)} \\ {\lx@inpgf@ignorespaces\mathcal{T}_{\!\mathfrak{C}_{2}}} \\ \scriptstyle{\lx@inpgf@ignorespaces\iota_{1}} \\ \scriptstyle{\lx@inpgf@ignorespaces\varphi} \\ \scriptstyle{\lx@inpgf@ignorespaces\chi} \\ \scriptstyle{\lx@inpgf@ignorespaces\iota_{2}}Proof:
Take M=\mathbb{R} with \dot{x}=u and \mathbf{U}=[-1,1]. Let h_{1}(x)=x and h_{2}(x)=1-x. Let \varphi be the CBF-QP (3) for h_{1} with u_{\mathrm{nom}}\equiv 1 and duration 2. From x_{0}=0.5\in\mathfrak{C}_{1}\cap\mathfrak{C}_{2}, the constraint u\geq-\alpha x never binds. The trajectory \varphi(x_{0}) therefore reaches x=2.5\notin\mathfrak{C}_{2} while remaining in \mathfrak{C}_{1}. Any composite \chi\circ_{K}\varphi contains this segment and leaves \mathfrak{C}_{1}\cap\mathfrak{C}_{2}. \square ∎
V-C Compositional Safety via a Shared Sub-Monad
Proposition V.3 is avoided if all phase controllers map into the same sub-monad. We achieve this with a smooth intersection of the individual CBFs, a known construction [16, 17, 3]. We add an explicit margin to it.
Let h_{1},\ldots,h_{k} be CBFs with safe sets \mathfrak{C}_{1},\ldots,\mathfrak{C}_{k}\subset M. For a smoothing parameter \varepsilon>0, the smooth minimum (softmin) of the barriers is h_{\cap}(x):=-\varepsilon\ln\sum_{i=1}^{k}e^{-h_{i}(x)/\varepsilon}. The shifted intersection CBF is \tilde{h}_{\cap}(x)=h_{\cap}(x)-\delta, with margin \delta:=\varepsilon\ln k.
Remark V.1 (The margin and its role)
The classical log-sum-exp bound [17] gives \min_{i}h_{i}(x)-\varepsilon\ln k\leq h_{\cap}(x)\leq\min_{i}h_{i}(x). The upper bound yields \{h_{\cap}\geq 0\}\subseteq\mathfrak{C}_{1}\cap\cdots\cap\mathfrak{C}_{k}. In continuous time, every controller certified by h_{\cap} thus lands in a sub-monad of \mathcal{T}_{\!\bigcap_{i}\mathfrak{C}_{i}}. The margin strengthens this to \min_{i}h_{i}(x)\geq\delta on \{\tilde{h}_{\cap}\geq 0\}. By the lower bound, \min_{i}h_{i}(x)\leq 2\varepsilon\ln k on the boundary \{\tilde{h}_{\cap}=0\}, so the choice \delta=\varepsilon\ln k at most doubles the inherent softmin gap. The margin matters in implementation. Our controllers are sampled-data with zero-order hold, and the continuous-time CBF guarantee does not transfer exactly to this setting [26]. The margin \delta absorbs this inter-sample drift at our step sizes. Deriving \delta from a sampled-data bound as in [26] would make this rigorous.
Theorem V.4 (Compositional safety)
Let \varphi_{1},\ldots,\varphi_{n}:M\to\mathcal{T}(M) be CBF-QP controllers (3) designed with the shifted intersection CBF \tilde{h}_{\cap}. Their nominal controllers may differ. Assume \tilde{h}_{\cap} is a CBF for (1) (Definition II.1). Then every x_{0} with \tilde{h}_{\cap}(x_{0})\geq 0 satisfies
(\varphi_{n}\circ_{K}\cdots\circ_{K}\varphi_{1})(x_{0})\in\mathcal{T}_{\!\,\mathfrak{C}_{1}\cap\cdots\cap\mathfrak{C}_{k}}(M).Diagram (11) shows the composition chain.
{\lx@inpgf@ignorespaces M} \\ {\lx@inpgf@ignorespaces\mathcal{T}_{\!\{\tilde{h}_{\cap}\geq 0\}}} \\ {\lx@inpgf@ignorespaces\cdots} \\ {\lx@inpgf@ignorespaces\mathcal{T}_{\!\{\tilde{h}_{\cap}\geq 0\}}} \\ {\lx@inpgf@ignorespaces\mathcal{T}_{\!\bigcap_{i}\mathfrak{C}_{i}}} \\ \scriptstyle{\lx@inpgf@ignorespaces\varphi_{1}} \\ \scriptstyle{\lx@inpgf@ignorespaces\varphi_{2}\circ_{K}} \\ \scriptstyle{\lx@inpgf@ignorespaces\varphi_{n}\circ_{K}} \\ \scriptstyle{\lx@inpgf@ignorespaces\iota}Proof:
Since \tilde{h}_{\cap} is a CBF, each \varphi_{j} keeps trajectories inside \{\tilde{h}_{\cap}\geq 0\} when started there [20]. Each such trajectory is an element of \mathcal{T}_{\!\{\tilde{h}_{\cap}\geq 0\}}(M). Every handoff state is the endpoint of such a trajectory, so it also lies in \{\tilde{h}_{\cap}\geq 0\}. Each phase therefore starts where its certificate applies. By Proposition V.2, \mathcal{T}_{\!\{\tilde{h}_{\cap}\geq 0\}} is closed under \mu_{M}. The Kleisli composite thus lands in \mathcal{T}_{\!\{\tilde{h}_{\cap}\geq 0\}}(M), as in diagram (11). Finally, Remark V.1 gives \{\tilde{h}_{\cap}\geq 0\}\subseteq\bigcap_{i}\mathfrak{C}_{i}, and the inclusion \mathcal{T}_{\!\{\tilde{h}_{\cap}\geq 0\}}\hookrightarrow\mathcal{T}_{\!\bigcap_{i}\mathfrak{C}_{i}} completes the proof. \square
∎
Theorem V.4 gives a sufficient condition. Controllers in different sub-monads may still compose safely from particular initial states, as the nonzero Naive safety rates in §VI show. The hypothesis that \tilde{h}_{\cap} is a CBF is not automatic under input bounds [17, 5]. We monitor it empirically through QP feasibility.
Remark V.2 (Automatic activation)
At state x, the CBF-QP constraint imposed by \tilde{h}_{\cap} is \sum_{i=1}^{k}w_{i}(x)\,\nabla h_{i}(x)^{\top}\bigl(f(x)+B(x)\,u\bigr)\geq-\alpha\,\tilde{h}_{\cap}(x). The softmin weights are w_{i}(x)=e^{-h_{i}(x)/\varepsilon}/\!\sum_{j}e^{-h_{j}(x)/\varepsilon}. Let i^{*}(x)\in\arg\min_{i}h_{i}(x) index the most binding barrier at x. When h_{j}(x)\gg 0 for all j\neq i^{*}, the weight w_{i^{*}}(x) approaches 1. The constraint then concentrates on the most binding barrier without any scheduling logic. This lazy activation, observed in [3, 17], is a property of the softmin gradient. The sub-monad view adds that it needs no coordination across phases, since every phase controller enforces the same constraint.
VI Statistical Validation
We compare three strategies. Naive has phase j enforce only h_{\sigma(j)}, with \sigma(j):=((j-1)\bmod k)+1, so successive controllers land in different sub-monads (Proposition V.3). Global enforces all k barriers as hard constraints in one QP [20, 5] and lands in \mathcal{T}_{\!\bigcap_{i}\mathfrak{C}_{i}} whenever that QP is feasible. Monadic enforces the single constraint \tilde{h}_{\cap}\geq 0 and lands in \mathcal{T}_{\!\{\tilde{h}_{\cap}\geq 0\}} (Theorem V.4). Inputs are two-dimensional, so we solve each QP exactly by enumerating its candidate minimizers. If none is feasible, the saturated nominal input is applied, which is what exposes Global to violations. Proposition V.3 shows that Naive composition can fail, and Theorem V.4 shows that Monadic composition cannot. Neither result says how often Naive fails. We now quantify this failure probability (§VI-A) and validate all three strategies over a randomized sweep (§VI-B).
VI-A Bernoulli Failure Model
Under Naive, phase j enforces only h_{\sigma(j)}. By forward invariance, the trajectory stays in \mathfrak{C}_{\sigma(j)} throughout phase j. Nothing constrains the other k-1 barriers. At time \tau_{j}, the handoff passes a state certified only for \mathfrak{C}_{\sigma(j)} to a controller certified only for \mathfrak{C}_{\sigma(j+1)}. Proposition V.3 identifies these handoffs as the source of the sub-monad mismatch. This motivates modeling each handoff as a separate trial.
Lemma VI.1 (Bernoulli failure model)
For j=1,\ldots,n-1, let E_{j} be the event that the Naive trajectory leaves \bigcap_{i}\mathfrak{C}_{i} during phase j+1, i.e., after handoff j. Assume that phase 1, which starts from x_{0}\in\bigcap_{i}\mathfrak{C}_{i}, is jointly safe. The Naive trajectory is then jointly safe iff \bigcap_{j=1}^{n-1}E_{j}^{c} occurs. Suppose E_{1},\ldots,E_{n-1} are mutually independent with common probability p_{0}=P(E_{j})\in[0,1). Then
P_{\mathrm{safe}}^{\mathrm{Naive}}(n)\;=\;(1-p_{0})^{n-1}.This has two consequences.
1. If p_{0}>0, then P_{\mathrm{safe}}^{\mathrm{Naive}}(n)\to 0 geometrically in n. 2. The index of the first failing handoff has mean 1/p_{0}. The expected number of safe handoffs before the first failure is therefore (1-p_{0})/p_{0}.
Proof:
By independence, P\bigl(\bigcap_{j=1}^{n-1}E_{j}^{c}\bigr)=\prod_{j=1}^{n-1}(1-p_{0})=(1-p_{0})^{n-1}. This gives (12) and claim 1. The index of the first failing handoff is geometric with success probability p_{0}, so its mean is 1/p_{0}. Excluding the failing handoff itself gives claim 2. \square ∎
Remark VI.1 (Geometric interpretation of p_{0})
Independence and a common p_{0} are modeling assumptions that we impose and then test empirically. They are plausible when each phase nearly converges to its CLF target before the handoff, which decorrelates successive handoff states. They are also plausible when barriers are drawn i.i.d., as in the sweep below. We test them empirically in §VI-B, where any residual phase-1 failures are absorbed into the fitted p_{0}. Suppose further that the handoff state is roughly uniform on \mathfrak{C}_{\sigma(j)}. A first-order estimate is then p_{0}\approx 1-\mathrm{Vol}(\bigcap_{i}\mathfrak{C}_{i})/\mathrm{Vol}(\mathfrak{C}_{\sigma(j)}). This is the fraction of the active safe set that lies outside the joint safe set. Adding a barrier can only shrink \bigcap_{i}\mathfrak{C}_{i}, so the estimate is nondecreasing in k. This agrees with the fits reported below.
VI-B Randomized Sweep
Setup. We sweep (n,k)\in\{2,\ldots,6\}\times\{2,\ldots,5\} with N_{s}{=}150 instances per cell, 3{,}000 in total, on the modal ROM of Use Case II. Each instance draws k random ellipses, corridors, or half-planes, an initial state with \tilde{h}_{\cap}(\xi_{0})>0.015, and n waypoints inside \bigcap_{i}\mathfrak{C}_{i}. Phases last 2 s, and the final phase lasts 4 s. We use \alpha{=}2.0, \varepsilon{=}0.05, and \Delta t{=}0.02 s. A run is safe if \min_{i}h_{i}\geq-10^{-3} throughout. We fit p_{0}(k) by nonlinear least squares.
Results. Figure 1 summarizes the sweep. The fitted values p_{0}=0.54,0.70,0.84,0.90 for k=2,\dots,5 increase monotonically with k (Remark VI.1). Naive drops to single digits by n{=}6 for every k. Monadic achieves 100\% on every cell, as Theorem V.4 guarantees.
Panel (C) shows a failure mode that our framework does not capture. Global degrades as k and n grow, reaching 58\% at k{=}5, n{=}6. When the k constraint normals conflict in the two-dimensional input space, the QP becomes infeasible and Global falls back to the nominal input. This does not contradict Theorem V.4. Sub-monad membership presupposes that a certified controller exists, and Global lands in \mathcal{T}_{\!\bigcap_{i}\mathfrak{C}_{i}} only while its QP is feasible. Input-constrained compatibility conditions [5, 6] address exactly this existence question. Softmin composition does not guarantee Monadic feasibility in general [17], yet Monadic remained safe in all 3{,}000 instances. Building feasibility into the sub-monad condition itself is an open question.
N_{s}{=}150 random CBF geometries per cell, with \varepsilon{=}0.05 and \alpha{=}2.0. (A) Naive safety rate versus phase count n for each barrier count k. Dashed curves show the fitted Bernoulli model P_{\mathrm{safe}}^{\mathrm{Naive}}(n){=}(1-p_{0})^{n-1}, and shaded regions show p_{0}\pm 2 standard errors. The fitted p_{0} increases monotonically with k (Remark VI.1). (B)–(D) Safety rate over the full (n,k) grid for Naive, Global, and Monadic. Naive collapses exponentially with n. Global degrades under constraint conflict as k grows, despite being the exact simultaneous-QP baseline. Monadic achieves 100\% on all 20 cells, as Theorem V.4 guarantees.VII Use Cases
We have established the categorical account and quantified how reliably it avoids the failure mode of naive composition. We now demonstrate the three strategies of §VI on two concrete robotic systems.
Both use cases compare three composition strategies. Naive has each phase controller f_{i} enforce only the single barrier h_{i}, placing controllers in different sub-monads (Proposition V.3). Global [1] enforces all k barriers as separate hard QP constraints at every step, giving a shared sub-monad \mathcal{T}_{\!\bigcap_{i}\mathfrak{C}_{i}} at the cost of k constraints per step. Monadic uses a single \tilde{h}_{\cap} constraint, giving the shared sub-monad \mathcal{T}_{\!\{\tilde{h}_{\cap}\geq 0\}}\subseteq\mathcal{T}_{\!\bigcap_{i}\mathfrak{C}_{i}} of Theorem V.4 with one constraint per step. All CBF-QPs are solved with Gurobi at 50 Hz.
VII-A Use Case I: Four-Mode PWA System
Setup. We use three safe sets, the ellipse h_{1}=1-x_{1}^{2}/0.92^{2}-x_{2}^{2}/0.78^{2}, the corridor h_{2}=0.72^{2}-x_{1}^{2}, and the half-plane h_{3}=x_{2}+0.36. Four phases of (3.0,2.0,2.5,8.0) s take the state from x_{0}=(-0.50,0.55)^{\top} in mode 2 to the goal (0.35,-0.20)^{\top} in mode 4 under a saturated proportional nominal law. We use \varepsilon{=}0.04, \alpha{=}1.5, forward Euler with \Delta t{=}0.015 s, and N_{s}{=}50 runs with initial states perturbed by \mathcal{U}([-0.06,0.06]^{2}).
Failure mechanism. The phase-1 target (-0.65,0.25)^{\top} lies near the left corridor wall, where the mode-2 drift points left. Naive enforces only h_{1} in phase 1, so the drift carries x_{1} past -0.72 before the first handoff. A controller in \mathcal{T}_{\!\mathfrak{C}_{1}} thus need not lie in \mathcal{T}_{\!\mathfrak{C}_{1}\cap\mathfrak{C}_{2}}.
Results. Naive violates safety in 78% of runs. Monadic matches the 100% safety of Global with one constraint per step instead of three. It also keeps a larger margin, \min h_{1}=+0.09 versus +0.04, consistent with \delta=\varepsilon\ln 3=0.044. Figure 2 shows a representative rollout.
VII-B Use Case II: Unicycle ROM on Heterogeneous Terrain
Setup. The ROM of Use Case II crosses a Rocky Terrain Traverse in four phases of (2.0,2.5,2.5,5.0) s. It must respect the ellipsoidal margin h_{1}=1-p_{x}^{2}/1.20^{2}-p_{y}^{2}/0.88^{2}, the stepping-stone corridor h_{2}=0.55^{2}-p_{x}^{2}, and the cliff h_{3}=p_{y}+0.28. A proportional nominal controller drives to phase targets inside \bigcap_{i}\mathfrak{C}_{i}, at constant speed in phases 1 to 3. We use \varepsilon{=}0.05, \alpha{=}2.0, \Delta t{=}0.02 s, and N_{s}=50 runs.
Failure mechanism. The heading \psi carries across each handoff. Naive enforces h_{1}, h_{2}, h_{3}, and h_{1} in turn, so nothing constrains the cliff in phases 2 and 4. Near \tau_{2} and \tau_{3}, the inherited heading carries the robot across h_{3}=0 (Fig. 3). The composite lands in \mathcal{T}(M) but not in \mathcal{T}_{\!\bigcap_{i}\mathfrak{C}_{i}}.
Results. Naive is never safe, with \min h_{3}=-0.343. Monadic matches the 100% safety of Global with one constraint per step. Its margins, \min h_{2}=+0.077 and \min h_{3}=+0.070, exceed \delta=\varepsilon\ln 3=0.055. Global’s margins are only +0.002 and +0.001.
\mathfrak{C}_{1}\cap\mathfrak{C}_{2}\cap\mathfrak{C}_{3} near the mode-2/mode-3 transition. Global (green) and Monadic (blue) remain safe throughout. Line style shows the plant mode \ell(x), which switches as the trajectory crosses quadrants. Distances are for this single rollout, not the N_{s}{=}50 Monte Carlo averages.\ell{=}3 near the handoffs \tau_{2} and \tau_{3} and crosses the cliff boundary h_{3}{=}0. Global (green) and Monadic (blue) remain within \mathfrak{C}_{1}\cap\mathfrak{C}_{2}\cap\mathfrak{C}_{3} and reach the goal. Distances are for this single rollout, not the N_{s}{=}50 Monte Carlo averages.Results. Naive achieves 0% safety, with \min h_{3}=-0.343. This is a structural, not marginal, violation, confirming Proposition V.3. Monadic matches Global safety at 100% with one QP constraint per step. The Monadic minimum margins, \min h_{2}=+0.077 and \min h_{3}=+0.070, are both tightly consistent with the theoretical lower bound 2\varepsilon\ln 2=0.069. This validates that the controller is conservative by exactly the shift of Remark V.1, no more and no less. Global, by contrast, attains margins only marginally above zero, +0.002 and +0.001. Monadic therefore achieves the same safety guarantee with quantified, structural conservatism rather than incidental margin.
VIII Conclusion
We constructed the trajectory monad (\mathcal{T},\eta,\mu) for Filippov-regular differential inclusions. We showed that CBF certificates lift to sub-monads, so controllers that land in a common sub-monad compose safely. Naive phase-by-phase composition fails because successive controllers land in different sub-monads. This mismatch is localized at each Kleisli handoff. It motivates a closed-form Bernoulli failure model, which we validated over 3{,}000 randomized instances. A smooth intersection CBF with an explicit margin places all phase controllers in one shared sub-monad, with one QP constraint per step. It achieved 100\% safety in the sweep and on both use cases. The standard simultaneous-constraint baseline, in contrast, degraded under constraint conflict as the barrier count grew. Future work includes incorporating QP feasibility into the sub-monad condition, a sampled-data derivation of the margin, and Eilenberg–Moore algebras of \mathcal{T}, which we conjecture to be Lyapunov certificates. We also plan hardware validation on a Unitree Go2 quadruped.