Preprint
Article

This version is not peer-reviewed.

Anytime-Valid Runtime Monitoring of Learned Barrier Certificates

Submitted:

20 October 2026

Posted:

21 October 2026

You are already at the latest version

Abstract
Learned barrier certificates provide a principled mechanism for establishing safety of stochastic systems, but their validity may deteriorate during deployment when the underlying dynamics differ from those used for training. We propose an anytime-valid runtime monitor that audits a learned barrier certificate using observed closed-loop trajectories. The monitor is intended to detect loss of statistical support for the deployed barrier condition; it does not by itself guarantee detection before unsafe entry or safety of a subsequent intervention. Specifically, the conditional barrier-drift condition is formulated as an episode-wise sequential hypothesis test, and observed barrier increments are transformed into a nonnegative test supermartingale, yielding finite-sample false-alarm control under arbitrary stopping times. Inspired by finite-horizon safety verification, we further introduce a deterministic temporal shaping of the monitoring boundary, making the monitor more conservative early in a prescribed deployment horizon while preserving anytime-validity. The monitor is designed to detect statistical evidence that the safety certificate is no longer consistent with the observed dynamics, rather than to predict unsafe entry. To assess the monitor empirically, we evaluate empirical alarm behavior under valid and invalid certificates. Code and data are available at https://github.com/FormalCert-AI/runtime-barrier-monitor.
Keywords: 
;  ;  ;  ;  

1. Introduction

Safety is a critical requirement for learning-enabled autonomous systems operating in uncertain and evolving environments. In robotics, autonomous driving, and cyber-physical infrastructure, even rare failures can be catastrophic, making purely data-driven validation insufficient for deployment [1,2]. Consider an autonomous drone navigating a cluttered warehouse whose floor plan changes over time. A barrier trained in simulation may provide a probabilistic safety guarantee under the assumed system dynamics and disturbance model, but unmodeled disturbances or environmental changes may invalidate the deployed safety certificate. This motivates runtime monitoring mechanisms that continuously assess whether the assumptions supporting a deployed safety certificate remain consistent with observed system behavior and, when necessary, trigger appropriate safety interventions.
Barrier certificates [3,4] certify safety through a scalar function B ( x ) whose expected value does not increase along trajectories, offering a scalable alternative to reachability analysis. In practice, however, the barrier B is learned from data, which introduces a fundamental verification gap: finite datasets provide incomplete coverage, simulation-to-reality mismatch induces distribution shift, and black-box models resist formal verification. In stochastic environments, iterative test-then-train refinement on counterexamples also cannot guarantee global validity of the updated certificate.
Rather than pursuing complete verification, we shift the focus to runtime monitoring and alarm-triggered intervention. The key idea is to continuously audit the deployed barrier using observed closed-loop trajectories and detect statistical evidence that the certificate is no longer consistent with the underlying dynamics. When sufficient evidence accumulates, the monitor can trigger a predefined intervention or fallback mechanism, thereby providing a practical mechanism for responding to potential loss of certificate validity during deployment. It is worth noting that the monitor is not designed to predict the exact time of unsafe entry, nor does it guarantee detection before every safety violation. Its purpose is to identify statistically significant evidence that the validity of the safety certificate is in question.
To realize this, we formulate runtime barrier auditing as an anytime-valid sequential hypothesis test based on e-processes (test supermartingales) and predictable plug-in betting strategies [5,6,7,8,9]. Observed barrier-value increments are converted into betting factors whose product forms a nonnegative test supermartingale. Consequently, the monitor retains finite-sample false-alarm control under arbitrary stopping times within an episode, allowing evidence to be assessed continuously without sacrificing the prescribed statistical validity. A finite deployment horizon also provides useful temporal structure for monitoring. Inspired by finite-horizon safety verification [10], we introduce a deterministic time-varying scaling of the monitoring boundary that makes the monitor more conservative at early time steps and gradually approaches the standard anytime-valid threshold as the prescribed horizon is reached. The resulting framework combines anytime-valid runtime monitoring with a finite-horizon temporal boundary tailored to the deployment horizon.
The formal guarantee concerns the statistical validity of the barrier-condition monitor: when the learned barrier satisfies its conditional supermartingale condition, the probability of an alarm within an episode is controlled at the prescribed level. The theory does not guarantee detection of every barrier violation, detection before unsafe entry, or safety of the intervention taken after an alarm. These properties are therefore evaluated empirically and distinguished from the statistical false-alarm guarantee.
The contributions of this work are summarized as follows.
1.
Anytime-valid barrier auditing: We formulate the conditional drift condition underlying a stochastic barrier certificate as an episode-wise sequential hypothesis test and construct an e-process from observed barrier increments. The monitor provides finite-sample level- α false-alarm control under arbitrary within-episode stopping times.
2.
Finite-horizon boundary shaping: Motivated by finite-horizon safety verification results [10], we introduce a deterministic time-varying scaling of the monitoring boundary to tailor the monitor to a prescribed finite deployment horizon. The resulting exponential boundary profile is more conservative at early time steps and gradually approaches the standard anytime-valid threshold as the deployment horizon is reached.

Related Work

1). Runtime Verification and Statistical Monitoring. Runtime Verification (RV) monitors executions against formal specifications such as linear temporal logic (LTL) or signal temporal logic (STL) [11], but struggles in stochastic environments where deviations may arise from transient noise. Statistical Model Checking (SMC) [12] addresses stochastic systems through fixed-horizon sampling, but lacks time-uniform guarantees and support for arbitrary stopping times. Recent predictive RV approaches combine conformal prediction with STL specifications [13,14,15] and adaptive conformal inference [16] to maintain coverage under distribution shifts. However, these methods provide only marginal or asymptotic guarantees and cannot ensure anytime-valid false-alarm control. Several works incorporate runtime monitoring into safety assurance. The adaptive shielding approach of [17] refines verified safe control envelopes online, but requires an expert-specified dynamics model and a verified fallback policy. Similarly, the shielding methods of [18,19] assume a known system model (deterministic or MDP) for offline safety verification. Relatedly, [20] develops runtime monitors for detecting or predicting violations of learned certificates in deterministic continuous-time systems and uses the collected data for offline repair. In contrast, our framework targets stochastic systems, where barrier conditions are defined through conditional expectations, and formulates runtime monitoring as an anytime-valid sequential hypothesis test based on e-processes [5,6,7]. The method is model-free, relying only on online observed trajectories, and provides evidence-triggered runtime intervention with uniform false-alarm control under arbitrary stopping times within each episode.
2). Barrier Certificates and Synthesis. Barrier certificates have been widely studied for safety verification and controller synthesis [3,10,21,22,23,24,25,26,27,28,29]. Existing data-driven methods [30,31,32,33,34] focus on synthesizing barrier certificates under assumptions such as known dynamics. In contrast, our work does not synthesize barrier certificates; rather, it provides an anytime-valid runtime monitor for auditing deployed barrier certificates and detecting statistical evidence that their underlying drift conditions may no longer be consistent with the observed dynamics, particularly under distribution shifts. The resulting alarm-triggered trajectories can be reused as counterexamples for subsequent certificate updating using existing synthesis methods. This creates a complementary relationship with CEGIS [35,36,37]: whereas CEGIS focuses on iterative certificate synthesis and refinement, our framework focuses on deployment-time monitoring of a learned certificate.

Paper organization.

The remainder of the paper is organized as follows. Section 2 presents the problem formulation. Section 3 develops the proposed anytime-valid runtime monitoring framework, including the e-process construction, adaptive betting strategy, and finite-horizon boundary shaping. Section 4 evaluates the monitor on stochastic benchmark systems under both valid and invalid barrier certificates. Section 5 concludes the paper and discusses future directions.

2. Preliminaries

This section introduces the mathematical setting underlying our framework. We first review e-processes and anytime-valid inference, and then formalize the stochastic control system and the runtime safety monitoring problem.

2.1. E-Processes and Anytime-Valid Inference

We work on a probability space ( Ω , F , P ) , where Ω is the sample space, F is a σ -algebra, and P is a probability measure. Random variables are measurable functions defined on this probability space.
Definition 1 
(Filtration). A filtration is an increasing sequence of sub-σ-algebras { F t } t ≥ 0 of F such that F s ⊆ F t for all s ≤ t .
A filtration models the information available at each time t; F t contains exactly what is known up to that point.
Definition 2 
(Martingale and supermartingale). Let ( M t ) t ≥ 0 be a sequence of random variables adapted to ( F t ) t ≥ 0 . We say that ( M t ) t ≥ 0 is amartingaleif
1.
M t is F t -measurable for all t ≥ 0 ,
2.
E [ | M t | ] < ∞ for all t ≥ 0 ,
3.
E [ M t + 1 ∣ F t ] = M t almost surely for all t ≥ 0 .
If the equality E [ M t + 1 ∣ F t ] = M t is weakened to E [ M t + 1 ∣ F t ] ≤ M t , then ( M t ) is called asupermartingale. In this case the process drifts downward in conditional expectation. Every martingale is a supermartingale.
When the filtration is understood, we simply refer to ( M t ) t ≥ 0 as a martingale or supermartingale.
Definition 3 
(E-process and test supermartingale). A nonnegative adapted process ( M t ) t ≥ 0 is called ane-processunder a null hypothesis H 0 if E H 0 [ M τ ] ≤ 1 for every bounded stopping time τ. Atest supermartingaleis an e-process that is also a supermartingale with M 0 = 1 . Every test supermartingale is an e-process, but the converse is not true.
The power of these objects comes from a time-uniform tail bound. While Markov’s inequality controls a single nonnegative random variable, Ville’s inequality extends the control to the whole trajectory of a test supermartingale.
Proposition 1 
(Ville’s inequality [38]). Let ( M t ) t ≥ 0 be a nonnegative test supermartingale under H 0 . Then for any α ∈ ( 0 , 1 ) , P H 0 sup t ≥ 0 M t ≥ 1 α ≤ α .
If the process ever crosses the threshold 1 / α , we may reject H 0 with a false-alarm probability at most α .
A standard method to construct a test supermartingale is through e-variables. Let ( E t ) t ≥ 1 be a sequence of nonnegative random variables such that E t is F t -measurable and E H 0 [ E t ∣ F t − 1 ] ≤ 1 . Then the product process M t : = ∏ k = 1 t E k with M 0 : = 1 is a nonnegative supermartingale and hence an e-process. Each factor E k can be seen as a local bet against the null; the product aggregates this evidence multiplicatively. Persistent small violations of the null accumulate steadily, while isolated fluctuations have little long-term effect. By Ville’s inequality, the test that stops and rejects H 0 the first time M t ≥ 1 / α controls the type-I error at level α , uniformly over all stopping times.

2.2. Problem Formulation

We consider a discrete-time stochastic dynamical system
x k + 1 = f ( x k , u k , ω k ) ,
where x k ∈ R n is the state, u k ∈ U is the control input, and ω k denotes an independent and identically distributed (i.i.d.) stochastic disturbance. Throughout this paper, both the system dynamics f and the disturbance distribution are assumed to be unknown. The system is operated under a feedback policy π : R n → U , yielding the closed-loop dynamics u k = π ( x k ) . Let ( F k ) k ≥ 0 denote the natural filtration generated by the trajectory.

Safety objective.

Let S ⊆ R n denotes a safe set, X 0 ⊂ S denotes the initial set. The safety objective is to ensure that trajectories starting from an initial state x 0 ∈ X 0 remain within S with high probability, i.e., P x k ∈ S , ∀ k ≥ 0 .
A standard approach to certifying such properties is through barrier certificates. To formalize the analysis, it is convenient to introduce the stopped (or frozen) system
x ^ k + 1 = f ( x ^ k , π ( x ^ k ) , ω k ) , if x ^ k ∈ S , x ^ k , otherwise .
This construction ensures that once the trajectory exits S , it remains outside. The probability that the original system stays within S coincides with the probability that the stopped system never leaves S [39].

Barrier certificate condition [39,40].

Assume that the barrier function B : R n → R ≥ 0 is integrable such that the following conditional expectation is well-defined. The function B is called a barrier certificate if it satisfies
B ( x ) ≥ 0 , ∀ x ∈ R n ,
B ( x ) ≥ 1 , ∀ x ∉ S ,
E B ( x ^ k + 1 ) ∣ x ^ k = x ≤ B ( x ) , ∀ x ∈ R n .
The last condition states that B behaves as a supermartingale along the stopped system. If such a function exists, then for any x 0 ∈ X 0 , P x k ∈ S , ∀ k ≥ 0 ≥ 1 − B ( x 0 ) .
Remark 1. 
In this paper, we consider the barrier condition of the form (2c) for safety verification. Nevertheless, the proposed method is not restricted to this specific formulation and can be extended to more general barrier conditions, such as E B ( x ^ k + 1 ) ∣ x ^ k = x ≤ a B ( x ) + b , ∀ x ∈ R n , which is widely used in finite-time and infinite-time safety verification, as well as reach-avoid analysis [10,29].

Problem of interest.

We consider the setting where both the barrier certificate B and the controller π are learned from data, so condition (2c) may fail globally despite appearing sound on the training data. Rather than assuming the correctness of these learned components, our goal is to continuously audit their validity from realized trajectories while maintaining a time-uniform false-alarm probability bounded by a prescribed level α . The resulting monitor can serve as a component of a runtime detection mechanism, providing statistical evidence that the learned barrier certificate is no longer supported by the observed dynamics.

3. Anytime-Valid Runtime Monitoring of Learned Barrier Certificates

In this section, we introduce our anytime-valid sequential monitoring framework for runtime auditing of learned barrier certificates (Figure 1). Instead of requiring offline validation of a deployed barrier certificate, we continuously audit its consistency with observed closed-loop trajectories. By formulating barrier-condition monitoring as a sequential hypothesis test and constructing an e-process that accumulates evidence online, we obtain an anytime-valid monitor with finite-sample false-alarm control under arbitrary stopping times within an episode. The resulting evidence can be used to trigger predefined runtime interventions when the validity of the deployed safety certificate is called into question.

3.1. Anytime-Valid Monitoring

Trajectories and Barrier Consistency Hypothesis.

We first formalize the observed closed-loop trajectories and the barrier consistency hypothesis that the monitor will audit throughout deployment. A single run of the closed-loop system under the learned controller π produces a trajectory
ξ { x ^ 0 , x ^ 1 , x ^ 2 , … } ,
with natural filtration F t σ ( x ^ 0 , … , x ^ t ) , which captures all information available up to time t within that specific episode, where x ^ k + 1 = f ( x ^ k , π ( x ^ k ) , w k ) , k = 0 , 1 , 2 , … .
The first two conditions of the barrier certificate B can be constructed alone. Our task is to test whether the conditional supermartingale condition (2c) remains valid under the deployed dynamics. The monitor uses one realized trajectory to accumulate statistical evidence against this conditional null. The null hypothesis is therefore
H 0 : E B ( x ^ t + 1 ) ∣ F t ≤ B ( x ^ t ) ,
for all t ≥ 0 . Equivalently, defining the one-step increment
δ t + 1 B ( x ^ t + 1 ) − B ( x ^ t ) ,
we test whether E [ δ t + 1 ∣ F t ] ≤ 0 . Under the null the barrier should not drift upward in expectation and any systematic tendency to increase signals a potential safety violation.

Local Evidence.

We now convert each observed increment into an evidence factor that behaves like a fair bet against the null. Define
E t + 1 1 + λ t δ t + 1 ,
where the betting fraction  λ t ≥ 0 is chosen at time t using only information available up to that point in the same episode ( F t -measurable). Intuitively, if the barrier increases ( δ t + 1 > 0 ), the factor exceeds 1, signalling a surprise. If the barrier decreases, the factor is ≤ 1 , consistent with H 0 .
Proposition 2 
(One-step validity). Under H 0 , if λ t ≥ 0 , then E H 0 E t + 1 ∣ F t ≤ 1 .
Proof. 
By definition, E H 0 E t + 1 ∣ F t = 1 + λ t E H 0 δ t + 1 ∣ F t . Under H 0 the conditional expectation of δ t + 1 is non-positive, and λ t ≥ 0 , we have the conclusion.    □
Thus, under the null, each factor E t + 1 has conditional expectation at most 1 – it is a “fair bet” in the sense that we cannot expect to accumulate evidence against a true null. The betting fraction λ t controls the sensitivity of the monitor: larger values react more strongly to positive increments but require a tighter bound to preserve non-negativity.

Evidence Accumulation.

Local bets are combined multiplicatively into a single cumulative score that reflects the total evidence against the null accumulated during the episode. The trajectory-level evidence process is
M t ∏ s = 1 t E s , M 0 1 .
Because each factor E s has conditional expectation ≤ 1 , the product is a non-negative supermartingale under H 0 , a fact we record as a lemma if every factor E s satisfies E s ≥ 0 .
Lemma 1. 
Under H 0 and E s ≥ 0 , ∀ s ∈ N , ( M t ) t ≥ 0 is a test supermartingale.
Proof. 
Non-negativity is obvious. The process is adapted, and E H 0 [ M t + 1 ∣ F t ] = M t E H 0 [ E t + 1 ∣ F t ] ≤ M t , where we used that M t is F t -measurable and the one-step bound from Proposition 2.    □
The product form of the e-process enables sustained evidence against the barrier condition to accumulate multiplicatively over time. When the observed barrier increments consistently provide evidence against H 0 , the corresponding betting factors can compound the evidence substantially, whereas transient fluctuations whose effects do not persist have less lasting influence on the accumulated score. This allows the monitor to respond to systematic departures from the learned barrier condition without treating every stochastic fluctuation as a certificate violation.
Because { M t } t ≥ 0 is a test supermartingale, Ville’s inequality applied to the stopping rule τ inf { t ≥ 1 : M t ≥ 1 / α } bounds the false-alarm probability of any episode by α: if the evidence process crosses the threshold, we reject H 0 , and under H 0 this occurs with probability at most α. The threshold crossing should therefore be interpreted as evidence that the deployed barrier condition has lost statistical support, rather than as a direct prediction of unsafe entry. The following subsection exploits a prescribed finite deployment horizon to introduce a time-varying monitoring boundary.

3.2. Data-Driven Adaptive Betting on λ t (DAB)

Even if the above theory is established, we still encounter the following two difficulties: 1. How to choose a suitable λ t that can satisfy the nonnegativity constraint on E s in Lemma 1; 2. Even if the constraints are met, how to adapt these bets to the observed barrier increments? Below we will introduce the design method of λ t based on data-driven and using discounted empirical moments inspired by Adam.
Building on the Kelly betting principle in [8,9], we use an exponentially weighted version of the empirical first and second moments, inspired by the moment estimates in Adam [41]. The unweighted case is recovered when γ = 1 . Specifically, we choose λ t based only on barrier increments observed up to time t, δ s = B ( x ^ s ) − B ( x ^ s − 1 ) by setting S t = γ S t − 1 + δ t , Q t = γ Q t − 1 + δ t 2 , and
λ t K = max S t Q t + ε , 0 , ε > 0
where γ ∈ ( 0 , 1 ] is a fixed memory parameter. Both moments contain only increments observed by time t, before observing δ t + 1 . We set S 0 = Q 0 = λ 0 = 0 , and ε = 1 × 10 − 12 , and then use
λ t = min λ t K , U , − 1 δ ̲ t ≥ 0 .
Here, U > 0 prevents excessively large bets and δ ̲ t = − B ( x ^ t ) . Then δ t + 1 = B ( x ^ t + 1 ) − B ( x ^ t ) ≥ − B ( x ^ t ) = δ ̲ t , leading to the conservative cap λ t ≤ 1 / B ( x ^ t ) . Under this choice, E t + 1 = 1 + λ t δ t + 1 ≥ 1 − 1 ≥ 0 .
The intuition follows a growth-rate and Kelly-type principle. When the observed barrier increments fluctuate around zero, the estimated conditional drift remains small, resulting in a conservative betting fraction. In contrast, when the observed increments provide sustained evidence of a positive barrier drift, the estimated drift increases λ t , allowing the e-process to accumulate evidence more rapidly. Thus, the adaptive betting rule places greater weight on persistent departures from the learned barrier condition while remaining conservative when the observed dynamics provide little evidence against it.
We introduce γ to address a specific cancellation effect in barrier increments: without forgetting ( γ = 1 ), S t = ∑ s = 1 t δ s = B ( x ^ t ) − B ( x ^ 0 ) , so a sustained recent increase can remain masked by an earlier decrease, whereas γ < 1 discounts stale increments and allows the betting fraction to respond to increases relative to a recent barrier baseline. In the appendix, we provide a detailed demonstration of the scenarios in which the γ = 1 case fails.

3.3. Shaping the Abort Time via Deterministic Scaling

While the constant-threshold rule remains valid under arbitrary stopping times, it does not exploit the finite deployment horizon K max that often arises from practical constraints such as physical timeouts, fuel limits, or fixed simulation lengths. A finite horizon allows the monitoring boundary to be shaped so that early alarms require stronger evidence, reducing sensitivity to transient fluctuations, while the threshold gradually approaches the standard anytime-valid level as the horizon is reached. We therefore introduce a deterministic temporal scaling of the boundary that adjusts the monitor’s conservatism over the episode while preserving the false-alarm guarantee α .
We can achieve this temporal preference by scaling the supermartingale with a deterministic time factor, effectively shaping the abort boundary without altering the underlying evidence factor E s :
M t a = a t M t , a ≥ 1 .
Under H 0 , because E H 0 [ M t + 1 ∣ F t ] ≤ M t , the conditional expectation of the scaled process satisfies:
E H 0 [ M t + 1 a ∣ F t ] = a t + 1 E H 0 [ M t + 1 ∣ F t ] ≤ a t + 1 M t = a M t a .
Thus, the expected value of M t + 1 a grows by at most a factor of a. Following the finite-horizon martingale properties established in Theorem 1 in [10] (with M 0 a = 1 ), the probability of crossing the terminal threshold is bounded by α . We can formalize this by defining the sequential stopping rule as the first moment the scaled monitor crosses a K max α :
τ : = inf t ≤ K max : M t a ≥ a K max α ,
which guarantees that P H 0 ( τ ≤ K max ) ≤ α . Using M t a = a t M t , the stopping rule can be equivalently written as:
τ : = inf t ≤ K max : M t ≥ a K max − t α .
Therefore, the time-varying threshold preserves the desired false-alarm control while allowing earlier detection to be emphasized through the parameter a. For a = 1 , the rule reduces to the constant-threshold baseline. If τ ≤ K max , the trajectory is stored as a counterexample and used to update the barrier function and the policy when necessary.
Theorem 1 
(Anytime-valid falsification guarantee). Let H 0 be as in (3). Suppose that ( M t ) t ≥ 0 is a nonnegative test supermartingale under H 0 . Define the rejection event R { τ ≤ K max } . Then P H 0 ( R ) ≤ α .
Proof. 
Define the scaled process
V t : = α a K max M t a .
Since ( M t ) t ≥ 0 is a nonnegative test supermartingale under H 0 ,
E H 0 [ V t + 1 ∣ F t ] = α a K max a t + 1 E H 0 [ M t + 1 ∣ F t ] ≤ α a K max a t + 1 M t = a V t .
Thus, V t satisfies the finite-horizon growth condition
E H 0 [ V t + 1 ∣ F t ] ≤ V t α ¯ + β ¯
from Theorem 1 in [10], with
α ¯ = 1 a ∈ ( 0 , 1 ] , β ¯ = 0 .
Moreover,
V 0 = α a K max , γ ¯ = β ¯ α ¯ − ( α ¯ − 1 ) = 1 − 1 a ∈ [ 0 , 1 ] .
Therefore, the case α ¯ ∈ ( 0 , 1 ] and γ ¯ ∈ [ 0 , 1 ] of Theorem 1 in [10] gives
P H 0 sup 0 ≤ t ≤ K max V t ≥ 1 ≤ V 0 α ¯ − K max = α a K max a K max = α .
Finally,
V t ≥ 1 ⟺ M t a ≥ a K max α ⟺ M t ≥ a K max − t α .
Hence,
sup 0 ≤ t ≤ K max V t ≥ 1 = { τ ≤ K max } ,
and therefore
P H 0 τ ≤ K max ≤ α .
This completes the proof.    □
Ultimately, this deterministic scaling mechanism has profound consequences for the temporal dynamics of the abort time.
  • Case a = 1 : M t a = M t is a test supermartingale; the rejection threshold is 1 / α and the test is valid for any stopping time (no bias toward early or late abort). While theoretically clean, it ignores the finite horizon and treats all time steps equally, which can be wasteful when resources are limited or early decisions are preferred.
  • Case a > 1 (patient test): a K max − t decreases exponentially over time, making the rejection threshold a K max − t α highest initially and lowest near the deadline. Thus, early alarms require stronger evidence, while the test approaches the classical anytime-valid rule as t → K max . This design is preferable when false alarms are costly or transient effects are common. For example, a drone may experience short-lived oscillations after takeoff. A patient monitor avoids unnecessary aborts by requiring sustained evidence before intervention. Larger values of a improve robustness against transient fluctuations and spurious alarms, while values closer to 1 recover the standard monitor. This conservatism, however, reduces sensitivity to brief or rapidly developing safety violations.
By framing a as a patience parameter, the safety engineer can deliberately prioritize robustness against early noise or rapid detection and resource efficiency, choosing the mode that best aligns with the system’s physical characteristics and the cost of data collection.

3.4. Comparison with Direct Barrier Monitoring

Since the barrier value B ( x ^ t ) is a supermartingale under H 0 , one may ask whether directly monitoring the normalized barrier process B ( x ^ t ) / B ( x ^ 0 ) is sufficient, making the proposed DAB mechanism unnecessary. Indeed, Ville’s inequality guarantees episode-wise false-alarm control at level α by raising an alarm whenever
B ( x ^ t ) B ( x ^ 0 ) ≥ 1 α .
Thus, direct barrier monitoring is statistically valid under H 0 . Moreover, as shown in Remark 2, it is a special case of the proposed multiplicative e-process. The key distinction is that direct monitoring fixes the betting strategy, whereas DAB allows the betting strategy to adapt to the observed barrier increments.
1.
Dependence on the initial barrier value. Both direct monitoring and DAB use the nominal alarm threshold 1 / α when their evidence processes are normalized to start at 1. However, direct monitoring is based on the relative barrier value B ( x ^ t ) / B ( x ^ 0 ) , so its equivalent threshold in terms of the unnormalized barrier is B ( x ^ 0 ) / α . Consequently, the response of the normalized barrier process to a given absolute barrier change depends on the initial barrier value. DAB, in contrast, provides greater flexibility in how barrier increments contribute to the monitoring statistic through its adaptive betting strategy.
2.
Adaptive evidence accumulation. Direct monitoring corresponds to the particular betting strategy λ t = 1 / B ( x ^ t ) , for which the multiplicative e-process reduces to M t = B ( x ^ t ) / B ( x ^ 0 ) . DAB allows alternative adaptive betting strategies that respond to recent barrier increments. In our implementation, DAB refrains from betting when the discounted sum S t of recent increments is negative, avoiding evidence losses during these periods and preserving evidence for subsequent barrier increases. As demonstrated in our experiments, this flexibility can improve detection across a broader range of initial states. Such improvements are empirical, however, and do not imply that DAB always detects certificate degradation earlier than direct monitoring.
Remark 2. 
Direct barrier monitoring is recovered by choosing λ t = 1 / B ( x ^ t ) , provided B ( x ^ t ) > 0 . Specifically, with δ t + 1 = B ( x ^ t + 1 ) − B ( x ^ t ) , E t + 1 = 1 + λ t δ t + 1 = B ( x ^ t + 1 ) B ( x ^ t ) . Consequently,
M t = ∏ s = 1 t E s = B ( x ^ t ) B ( x ^ 0 ) , M 0 = 1 .
Thus, direct barrier monitoring is a special case of the proposed multiplicative e-process. The potential benefit of DAB comes from its more flexible betting strategy and the resulting evidence accumulation, rather than from a stronger false-alarm guarantee.

3.5. Runtime Monitoring

The preceding subsections establish the statistical foundations of the proposed anytime-valid monitor. We now instantiate these results as a deployment-time runtime monitoring procedure.
In each deployment episode, the learned barrier B ϕ and policy π θ are fixed, and the monitor updates the e-process online using the observed closed-loop trajectory. The episode is terminated when the evidence process crosses the time-varying decision boundary. Under the null hypothesis that the deployed barrier satisfies the conditional drift condition, the probability of such an alarm within an episode is controlled at the prescribed level α , regardless of the stopping time. The monitoring procedure is independent of how the barrier is constructed and can therefore be applied to analytical, optimization-based, or learned barrier certificates, provided that the assumptions required by the monitor are satisfied. The collected trajectories can optionally be stored as counterexamples and used for subsequent barrier or policy refinement between episodes; such updates do not occur within an episode and are therefore separate from the anytime-valid monitoring procedure. The complete deployment procedure is summarized in Algorithm 1.
Algorithm 1:Anytime-Valid Runtime Monitoring
Require: 
Initial barrier B ( x ^ 0 ) , policy π 0 , buffer size N batch , significance level α , maximum horizon K max , and patience factor a ≥ 1
Ensure: 
Runtime monitoring
1:
Initialize B ϕ ← B 0 , π θ ← π 0 , B ← ∅
2:
for deployment episode r = 1 , 2 , …  do
3:
   Observe x ^ 0 ; initialize M 0 ← 1 and ξ ← ( x ^ 0 )
4:
   for  t = 0 , 1 , … , K max − 1  do
5:
     Choose λ t ≥ 0 as in Eq. (4)
6:
     Set u t ← π θ ( x ^ t ) and observe x ^ t + 1
7:
     Append ( x ^ t , u t , x ^ t + 1 ) to ξ
8:
     Compute δ t + 1 ← B ϕ ( x ^ t + 1 ) − B ϕ ( x ^ t )
9:
     Update M t + 1 ← M t ( 1 + λ t δ t + 1 )
10:
     if  M t + 1 ≥ a K max − ( t + 1 ) / α  then
11:
        Exit the episode; break
12:
     end if
13:
     if  x ^ t + 1 ∉ S  then
14:
        Exit the episode; break
15:
     end if
16:
   end for
17:
    B ← B ∪ { ξ }
18:
   if  | B | ≥ N batch  then
19:
     Optional: Update B ϕ , π θ using B ; set B ← ∅
20:
   end if
21:
end for
Remark 3. 
The monitoring procedure is intended to operate while the system remains in the safe set S . By construction, the stopped process follows the original system’s dynamics whenever it is in the safe set S and remains frozen after exiting S . Consequently, the global supermartingale condition
E B ( x ^ k + 1 ) ∣ x ^ k = x ≤ B ( x ) , ∀ x ∈ R n ,
is equivalent to the barrier-drift condition for the original system restricted to the safe set:
E B ( x k + 1 ) ∣ x k = x ≤ B ( x ) , ∀ x ∈ S .
Indeed, outside S , the stopped process remains at its current state, so the supermartingale condition holds automatically with equality. Thus, the safe set S is precisely the region in which the barrier-drift condition needs to be monitored. Accordingly, each trajectory is terminated upon its first exit from S or upon reaching the prescribed horizon K max , whichever occurs first. Thus, once a trajectory exits the safe set, there is no need to simulate its subsequent evolution.
Remark 4. 
The monitor is designed to detect statistical evidence against the learned barrier condition, rather than to predict unsafe entry. At the same time, the monitor can serve as a component of a runtime safety-shielding mechanism by triggering a predefined conservative intervention when sufficient evidence indicates that the learned certificate is no longer consistent with the observed dynamics. Thus, a trajectory may move toward the unsafe region without triggering the monitor, provided that the monitored barrier condition remains statistically consistent with the observed dynamics. Such a situation does not constitute a failure of the proposed detection objective, since the monitor is intended to identify when the statistical support for the safety certificate has become questionable, rather than to predict every impending safety violation. Once sufficient evidence against the barrier condition accumulates, the deployed certificate is treated as unsupported for continued operation, and the predefined intervention can be activated to reduce the risk of subsequent unsafe behavior.
Alg. 1 resets the e-process at the start of each episode, yielding false-alarm control at level α r = α within each episode. The per-episode guarantee is appropriate when episodes are treated as separate operational units, as in episodic RL or session-based monitoring. If error control is instead required across N ep deployment episodes, the episode-wise error budget can be allocated such that ∑ r = 1 N ep α r ≤ α , for example, using α r = α N ep or a summable sequence such as α r = α 2 r . By the union bound, the probability of at least one false alarm over all N ep episodes is then at most α . More elaborate cross-episode e-process constructions may also be considered when their required measurability and null conditions are satisfied. Such global error control involves a sensitivity trade-off: decreasing α r across episodes increases the rejection threshold 1 α r and may reduce detection power in later episodes. We therefore use per-episode error control in our experiments and leave cross-episode error allocation as an application-dependent extension.

4. Experiments

We evaluate the proposed anytime-valid runtime monitoring framework on four benchmark systems. The experiments address three questions:
1.
RQ1: whether the monitor preserves the prescribed false-alarm guarantee when the barrier certificate is valid;
2.
RQ2: Can we detect environmental changes and invalid barrier certificates using our monitor?
3.
RQ3: How does temporal boundary shaping trade fewer false alarms under valid certificates for delayed or missed detection under invalid certificates?
The default setting is K max = 400 , K max ln a = 4 , γ = 0.92 , and U = 100 , using the same runs. Table 1 also reports the standard anytime-valid rule K max ln a = 0 ( a = 1 ) . SubSection 4.1 answers RQ1, SubSection 4.2 answers RQ2. SubSection 4.3 answers RQ3. Detailed benchmark descriptions, implementation details, proofs of validity or counterexamples establishing invalidity for the candidate barriers are provided in Appendix A. The sensitivity of K max and λ t is provided in Appendix B .
The formal objective of the proposed framework is runtime monitoring of the learned barrier condition. Theorem 1 provides a statistical guarantee for this objective: under H 0 , the probability of falsely rejecting the barrier-drift condition within an episode is at most α . This guarantee does not imply a lower bound on detection power or guarantee that an alarm occurs before an unsafe transition. Nevertheless, the monitor can serve as a component of a runtime safety-shielding mechanism: when sufficient evidence is accumulated against the deployed barrier, a predefined intervention can be triggered rather than continuing to rely on an unsupported barrier. We therefore evaluate unsafe-rollout detection as a downstream operational detection measure of this monitoring mechanism in Subsection 4.4.
Why do we use K max ln a ? Since a enters the alarm threshold exponentially over the horizon, varying a directly makes it difficult to interpret the strength of threshold shaping. We therefore parameterize a in terms of K max ln a , which directly determines the logarithm of the threshold inflation factor at the beginning of the horizon relative to the terminal threshold. With this parameterization, the alarm threshold at step k is
ln M k ≥ ln ( 1 / α ) + K max ln a 1 − k K max .
Thus, at k = 0 , the threshold lies K max ln a above ln ( 1 / α ) , and it decreases linearly in k to ln ( 1 / α ) at k = K max . The threshold a K max − k / α on M k starts at e K max ln a / α and decreases exponentially to 1 / α .

4.1. Runtime Monitoring Under Valid Certificates

Under a valid certificate, Theorem 1 guarantees that the probability of an alarm within the horizon K max is at most α for the system starting from the state in the initial set X 0 . To empirically assess the consistency of the observed alarm behavior within this theoretical guarantee, we sample N initial states x 0 ( 1 ) , … , x 0 ( N ) and simulate R independent trajectories from each initial state. Let τ ( i , j ) be the alarm time of the monitor on the j-th trajectory from x 0 ( i ) . Let T ( i , j ) be the first exit step of this trajectory from S ( T ( i , j ) = ∞ if it stays in S ). Following Remark 3, monitoring stops at min ( T ( i , j ) , K max ) , and the empirical alarm rate for x 0 ( i ) is
p ^ i = 1 R ∑ j = 1 R I τ ( i , j ) ≤ min ( T ( i , j ) , K max ) .
as well as the worst-case empirical alarm rate,
p ^ max = max i p ^ i .
To summarize the empirical alarm across the sampled initial states, we call x 0 ( i ) empirically abnormal if p ^ i > α and report the fraction of empirically abnormal initial states,
ρ α = 1 N ∑ i = 1 N I p ^ i > α ,
Under a valid certificate, we expect ρ α to be close to zero and p ^ max to remain close to or below α , providing empirical support for the theoretical guarantee. Conversely, it is worth noting that observing empirical alarm rates below α does not, by itself, establish the validity of the certificate which will be discussed in detail in the Appendix B.2.
Results.We evaluate the monitor on two benchmark systems, for which globally valid barrier certificates satisfying (Section 2.2.0.3) are available. We also compare two betting strategies: DAB and Direct ( λ t = 1 B ( x ^ t ) ). As shown in Table 1, both monitors achieve p ^ max < α under both rules, which is consistent with the conclusion of P H 0 ( R ) ≤ α in Theorem 1. However, the rates for the direct betting remain slightly higher than those for the DAB. As shown in Figure A3, System 1 has lower values in the initial points B ( x 0 ) , thereby increasing the probability of an alarm when B ( x ^ t ) / B ( x ^ 0 ) > 1 / α . In contrast, our method is far less sensitive to the initial value and is therefore much less affected by this issue. Overall, these observations are both consistent with the anytime-valid false-alarm guarantee under a valid certificate.

4.2. Runtime Monitoring Under Invalid Certificates

In this subsection, we will answer RQ2 by investigating scenarios involving invalid barriers. The remaining systems in Table 1 have invalid barrier certificates. We consider two scenarios: (1) initially, we obtain a valid barrier function for System 2 in RQ1. However, environmental changes are inevitable in real-world scenarios. To simulate such a scenario, we actively injected noise b k into state x 2 from step k = 100 onward:
x 2 , k + 1 = x 2 , k + 0.01 ( ( 0.8 + ξ k ) x 1 , k + 10 ( x 1 , k 2 − 0.21 ) x 2 , k + b k )
where b k ∼ U [ 0 , 0.45 ] and the equation of x 1 is unchanged. Although the true environmental dynamics can be unknown in our monitor, we test the original valid function against the modified dynamical system and discovered counterexamples. Consequently, the original barrier function proved to be invalid in the changed environment. (2) The environment has not changed, but due to the sample-based training, the barrier function for system 3 is invalid from the start. We also find a counterexample establishing that this candidate is invalid.
Results. When K max ln a = 4 , under invalid certificates, both methods detect substantial deviations from the prescribed alarm behavior, but their performance differs across the two systems. In System 2-input attack, direct betting has a worst-case alarm rate of 100 % , compared with 81.5 % for DAB. However, DAB identifies a much larger fraction of abnormal initial states, with ρ α = 79.9 % compared with 17.9 % for direct betting. In System 3, DAB performs better in terms of both metrics: its ρ α reaches 78.40 % , compared with 23.80 % for direct betting, while its worst-case alarm rate is 95.10 % , compared with 63.60 % for direct betting. These results highlight the complementary roles of the two metrics. A high worst-case alarm rate p ^ max indicates that the monitor frequently raises alarms for at least one sampled initial state, suggesting that the deployed barrier condition may no longer be trustworthy. Meanwhile, ρ α quantifies the fraction of sampled initial states for which the empirical alarm rate exceeds α , revealing how widely this evidence of potential barrier invalidity occurs across the initial states.

4.3. The Patience Parameter a

We introduce a as a deployment-time design parameter for the monitoring boundary. For fixed α , K max , and betting strategy, changing a leaves the underlying evidence process M k unchanged and modifies only the decision rule applied to that evidence. Its choice expresses the trade-off between avoiding unnecessary intervention and detecting certificate invalidity promptly. A larger a is appropriate when unnecessary early interventions are costly and the application can tolerate delayed detection.
The experimental results in SubSection 4.1 and Section 4.2, reported in Table 1 and Figure A3, show that increasing a cannot increase the number of alarms and cannot advance the first alarm time. This observation is consistent with the theoretical analysis: a larger a raises the rejection threshold at early time steps, making the monitor more conservative. To illustrate how this affects monitoring under valid and invalid certificates, we consider Systems 1, System 2+input and System 3. In System 1, where the barrier certificate is valid, the DAB evidence process exhibits a transient increase that triggers an alarm when a = 1 , but then drops rapidly (we give an example trajectory in Figure 2). Since the certificate is valid in this scenario, the threshold crossing is a false alarm caused by a temporary fluctuation, with no sustained evidence against the barrier condition. Increasing the temporal scaling to K max ln a = 4 raises the early-time rejection threshold, preventing the evidence process from triggering an alarm. In this case, the more conservative threshold helps avoid an unnecessary alarm. In contrast, in System 2+input and System 3, where the barrier certificate is invalid, increasing the temporal scaling to K max ln a = 4 delays the alarm compared with the case a = 1 , but the evidence eventually becomes sufficient to cross the rejection threshold. Thus, the monitor still detects evidence against the barrier condition, albeit later. These examples illustrate the trade-off controlled by a: a more conservative threshold can suppress alarms caused by transient fluctuations under a valid certificate, but may also delay the detection of an invalid certificate.
In practice, before deployment, we do not know whether this barrier is valid. Thus, a should be selected according to the desired level of confidence in the deployed certificate and the trade-off between avoiding unnecessary alarms and detecting degradation promptly. When the certificate is considered highly trustworthy and avoiding unnecessary alarms is the priority, a larger a can be used to make the monitor more conservative. In contrast, when the validity of the certificate is uncertain or degradation is suspected, setting a = 1 is preferable because it allows earlier detection. In particular, we recommend a = 1 when prompt detection of potential certificate invalidity is the primary objective. When there is some disturbance in the early stages of the system, we recommend choosing a > 1 .

4.4. Practical Applications of Algorithm 1

In this subsection, we empirically investigate two potential downstream applications of our runtime monitoring method: improving the adaptability of learned barrier certificates through retraining and detecting unsafe rollouts before the first safety violation. The latter evaluates the monitor’s potential to serve as a component of a runtime safety-shielding mechanism. These experiments provide empirical evidence of the potential benefits of monitoring-guided retraining and early detection, but do not establish formal guarantees for either capability.
Following Algorithm 1, we will update the barrier using data collected from the environment: for System 2 under the input attack we retrain only the barrier function, and for System 3 we retrain both the barrier function and the policy. We then check whether the alarm rates return below α .
Results. (1) For System 2 under the input attack, retraining the barrier function reduces the worst-case alarm rate p ^ max over the sampled initial states from 100.00 % to 0.00 % for the direct rule and from 81.50 % to 0.00 % for DAB. For System 3, p ^ max decreases from 63.60 % to 0.00 % for the direct rule and from 95.10 % to 0.00 % for DAB. After retraining, neither monitor raises an alarm in any run of either system, so ρ α = 0 . (2) With the accumulation of evidence M k , we find that our method could terminate the trajectory in advance, before the state leaves the safe set S . Before retraining, 42.88% of the evaluated System 3 trajectories exited the safe set S within the evaluation horizon. Among these exiting trajectories, DAB raised an alarm strictly before the first exit in 47.09% of cases under the default setting K max ln a = 4 , compared with 11.88% for Direct. With a = 1 , the corresponding rates were 51.81% and 22.56%, respectively. These pre-exit alarms provide an opportunity for intervention before unsafe entry.

5. Conclusions and Future Work

We introduced an anytime-valid framework for runtime monitoring of learned barrier certificates in stochastic systems. By continuously auditing observed barrier-value increments with an e-process, the proposed monitor provides finite-sample false-alarm control under arbitrary stopping times within each deployment episode. Motivated by finite-horizon safety verification, we further introduced a temporal boundary-shaping mechanism that adjusts the conservatism of the monitor over a prescribed deployment horizon. Experiments under valid certificates, certificate degradation, and distribution shifts demonstrate the practical utility of the framework for detecting statistical evidence against the barrier condition and supporting conservative runtime intervention.
Several directions remain for future work. First, extending the framework to safe RL, continuous-time dynamics, and partially observable systems would broaden its applicability. Second, validation on real robotic platforms under non-stationary environments would further demonstrate its practical value. Third, the relationship between barrier-condition violations and detection power, detection delay, and pre-violation detection warrants further theoretical and empirical study. Moreover, the finite-horizon factor a can be further studied as a time-varying parameter to adapt the monitoring strategy.

Appendix A. Benchmark Details

A function B is a barrier certificate if it satisfies the three conditions (2a), (2b), and (2c). For a state x ∈ S , let x + denote its next state. For x ∉ S , the stopped system stays at x, so (2c) holds with equality there, and it only has to be checked on S . To show that a candidate is valid, all three conditions must hold everywhere. To show that it is invalid, we can just find a single counterexample x ∈ S suffices: E [ B ( x + ) ∣ x ] > B ( x ) .

System1: stochastic polynomial system (1D).

Dynamics. The state x ∈ R evolves according to
x k + 1 = ( 0.5 + 1.5 ξ k ) x k ( 1 − x k 2 ) , ξ k ∼ U [ − 1 , 1 ] .
The disturbances are independent across time.
Sets and sampling.
X 0 = [ − 0.4 , 0.4 ] , S = ( − 1 , 1 ) .
Initial states are sampled uniformly from X 0 , independently of the disturbance sequence.

System 1: valid.

We choose the candidate B ( x ) = x 2 . It satisfies (2a), and (2b) holds since | x | ≥ 1 implies x 2 ≥ 1 . For (2c), x + = ( 0.5 + 1.5 ξ ) x ( 1 − x 2 ) with ξ ∼ U [ − 1 , 1 ] , and E [ ( 0.5 + 1.5 ξ ) 2 ] = 0.25 + 1.5 E [ ξ ] + 2.25 E [ ξ 2 ] = 0.25 + 0 + 0.75 = 1 . Hence, for every x ∈ S ,
E [ B ( x + ) ∣ x ] − B ( x ) = x 2 ( 1 − x 2 ) 2 − x 2 = − x 4 ( 2 − x 2 ) ≤ 0 .

System2: Van der Pol oscillator (2D) [42].

Dynamics. The state x = ( x 1 , x 2 ) ∈ R 2 evolves:
x 1 , k + 1 = x 1 , k + 0.01 ( − 2 x 2 , k ) , x 2 , k + 1 = x 2 , k + 0.01 ( ( 0.8 + ξ k ) x 1 , k + 10 ( x 1 , k 2 − 0.21 ) x 2 , k ) ,
where ξ k ∼ U [ − 0.1 , 0.1 ] . The disturbances are independent across time.
Sets and sampling.
X 0 = { x : x 1 2 + x 2 2 < 0.01 } , S = { x : x 1 2 + x 2 2 ≤ 1 } .
Initial states are sampled uniformly from X 0 , independently of the disturbance sequence.

System 2: valid.

The candidate is a polynomial B of degree 10, computed together with SOS multipliers s 0 , s 1 , s 2 of degree 10 by the SOS program using the method proposed in [42]:
min B , s 0 , s 1 , s 2 , γ γ s . t . B , s 0 , s 1 , s 2 are SOS , B − 1 − s 2 ( ∥ x ∥ 2 − 1 ) is SOS , B − E [ B ( x + ) ∣ x ] + s 1 ( ∥ x ∥ 2 − 1 ) is SOS , γ − B + s 0 ( ∥ x ∥ 2 − 0.01 ) is SOS .
Each constraint implies one condition. A sum of squares is nonnegative, so B ≥ 0 , which is (2a). For x ∉ S , ∥ x ∥ 2 − 1 > 0 and s 2 ≥ 0 , so B ( x ) − 1 ≥ s 2 ( x ) ( ∥ x ∥ 2 − 1 ) ≥ 0 , which is (2b). For x ∈ S , ∥ x ∥ 2 − 1 ≤ 0 and s 1 ≥ 0 , so B ( x ) − E [ B ( x + ) ∣ x ] ≥ s 1 ( x ) ( 1 − ∥ x ∥ 2 ) ≥ 0 , which is (2c). We solve the program with YALMIP and MOSEK.
To simulate the changed environments in reality, we actively injected noise b into state x 2 from step k = 100 onward:
x 2 , k + 1 = x 2 , k + 0.01 ( ( 0.8 + ξ k ) x 1 , k + 10 ( x 1 , k 2 − 0.21 ) x 2 , k + b k )
where b k ∼ U [ 0 , 0.45 ] and the equation of x 1 is unchanged.

System 2+input: invalid.

The candidate of system 2+input is the certificate of System 2. Since both the system and the candidate barrier function are polynomial, we can directly compute the function value at a given point, as well as the E B ( x + ) . At x = ( − 0.07 , 0.30 ) , we obtain E [ B ( x + ) ∣ x ] = 0.203196 and B ( x ) = 0.198623 , so x is a counterexample. Then the candidate in system 2 before is invalid in system 2+input.

System3: polynomial oscillator (2D) [35,43].

Dynamics. We applied Euler discretization to the continuous system from the original text. With x = ( x 1 , x 2 ) and Δ t = 0.1 , the system is
x k + 1 = x k + Δ t x 2 , k x 1 , k 3 / 3 − x 1 , k − x 2 , k + u k + σ w k , w k ∼ U ( [ − 1 , 1 ] 2 ) .
The disturbances are independent across time and σ = 0.01 . In the refinement stage, we train the policy and barrier function using neural networks with | u | ≤ 1.5 .
Sets and sampling. Let
X 0 = B ( ( 1.5 , 0 ) , 0.5 ) ∪ [ − 1.8 , − 1.4 ] × [ − 0.1 , 0.1 ] ∪ [ − 1.4 , − 1.2 ] × [ − 0.5 , 0.1 ] , X = [ − 3.5 , 2 ] × [ − 2 , 1 ] , D = B ( ( − 1 , − 1 ) , 0.4 ) ∪ ( [ 0.4 , 0.6 ] × [ 0.1 , 0.5 ] ) ∪ ( [ 0.4 , 0.8 ] × [ 0.1 , 0.3 ] ) .
We define the safe set by S = X ∖ D .

System 3: invalid.

The policy u ( x ) = 1.5 tanh ( N π ( x ) ) and the barrier B ( x ) = softplus ( N B ( x ) ) are neural networks trained from samples. Finding a valid certificate for such a stochastic system is difficult, and it is not needed here. The closed-loop dynamics are x + = m ( x ) + 0.01 w with w ∼ U ( [ − 1 , 1 ] 2 ) , where
m ( x ) = x 1 + 0.1 x 2 , x 2 + 0.1 ( x 1 3 / 3 − x 1 − x 2 + u ( x ) )
is the next state without noise. Since B is a neural network, it’s hard to provide the closed form for E [ B ( x + ) ∣ x ] . So we bound it by partitioning the noise, as in [22], and by interval bound propagation through N B [44]. We split [ − 1 , 1 ] 2 into 20 × 20 cells C j of probability 1 / 400 each. For w ∈ C j , the successor lies in the box Z j = m ( x ) + 0.01 C j , and interval bound propagation through N B gives a lower bound B ̲ j ≤ min z ∈ Z j B ( z ) . Hence
E [ B ( x + ) ∣ x ] ≥ 1 400 ∑ j = 1 400 B ̲ j .
The upper bound is obtained in the same way. At x = ( 0.79 , − 0.32 ) , we obtain E [ B ( x + ) ∣ x ] ∈ [ 0.132798 , 0.136322 ] and B ( x ) ≤ 0.126608 . The lower bound of the expectation exceeds B ( x ) , so x is a counterexample and the candidate barrier function is invalid.

Computing environment.

All experiments were run on an Apple M4 Pro machine (12 CPU cores, 24 GB of memory) with Python 3.12 (NumPy 2.4, SciPy 1.16, and PyTorch 2.5 for training). The SOS program for System 2 was solved with MATLAB R2025a, YALMIP and MOSEK 11.1.
Figure A1. Distribution of the alarm rate p ^ i over the N = 10 3 initial states, Direct (left half) against DAB (right half), with the standard rule K max ln a = 0 (top row) and the default K max ln a = 4 (bottom row); the row below each axis holds the share of initial states with p ^ i = 0 .
Figure A1. Distribution of the alarm rate p ^ i over the N = 10 3 initial states, Direct (left half) against DAB (right half), with the standard rule K max ln a = 0 (top row) and the default K max ln a = 4 (bottom row); the row below each axis holds the share of initial states with p ^ i = 0 .
Preprints 239339 g0a1

Appendix B. Further Analysis

Appendix B.1. Additional Analysis of the Main Experiments

Why does a change in a have different effects on system 2 +input versus system 3?Figure A2(a, b) shows the distribution of DAB’s alarm rates over the sweep K max ln a ∈ { 0 , 1 , 2 , 4 , 8 } : ρ α stays within 2.2 points on both systems, while p ^ max falls from 92.0 % to 81.0 % on System 2-input and only from 96.3 % to 92.2 % on System 3. Figure A2(c, d) shows why. Every threshold equals ln ( 1 / α ) at k = K max , so a run whose evidence is still above ln ( 1 / α ) at the horizon raises an alarm for every a. A larger a can only remove the alarm of a run that crosses ln ( 1 / α ) before K max and stays below the tilted thresholds. On System 2+input the evidence settles just above ln ( 1 / α ) from about k = 300 on, so many runs cross 1 / α late and only marginally, and the tilted thresholds remove part of them. On System 3 the evidence keeps rising until K max , so almost every run that crosses 1 / α also crosses the tilted thresholds.
Figure A2. Effect of the patience parameter a on the DAB alarm rates and evidence for the invalid certificates.
Figure A2. Effect of the patience parameter a on the DAB alarm rates and evidence for the invalid certificates.
Preprints 239339 g0a2
Why do the two betting strategies differ on the invalid systems?Figure A3 helps explain the different behaviors of the two betting strategies through the distribution of the initial barrier values B ( x 0 ) . For direct betting, the evidence process satisfies M k = B ( x ^ k ) / B ( x 0 ) , so the alarm condition for a = 1 is equivalent to
B ( x ^ k ) ≥ B ( x 0 ) α .
Thus, a smaller initial barrier value yields a lower alarm threshold, making an alarm easier to trigger. System 2-input attack contains many initial states with small B ( x 0 ) , and direct betting reaches a 100 % empirical alarm rate for initial states with B ( x 0 ) = 0.001 . However, this behavior is concentrated among a subset of the sampled initial states, as reflected by ρ α = 17.90 % (Table 1, K max ln a = 4 ; 18.10 % with a = 1 ). The same logic applies to the case where a > 1 , since the threshold a K max − k B ( x 0 ) / α is still proportional to B ( x 0 ) .
Figure A3. Initial barrier value B ( x 0 ) and alarm rate: solid lines and filled markers for the standard rule K max ln a = 0 , dashed lines and hollow markers for the default K max ln a = 4 .
Figure A3. Initial barrier value B ( x 0 ) and alarm rate: solid lines and filled markers for the standard rule K max ln a = 0 , dashed lines and hollow markers for the default K max ln a = 4 .
Preprints 239339 g0a3
In contrast, the initial barrier values in System 3 are generally larger, resulting in higher alarm thresholds for direct betting. Accordingly, Figure A3(b)–(d) shows that its empirical alarm rate decreases rapidly as B ( x 0 ) increases. DAB, however, adapts its betting fraction based on the observed barrier increments and exhibits nonzero empirical alarm rate over a broad range of initial barrier values. This helps explain why DAB achieves a higher fraction of empirically abnormal initial states and a higher worst-case empirical alarm rate than direct betting in System 3.

Appendix B.2. Sensitivity Analysis

Next, we study how the horizon K max , and the betting rule λ t affect the alarm rates. In these analyses, we vary only one parameter while keeping the others constant.
Valid certificates. No choice of these parameters can raise the false-alarm probability above α . Under H 0 , E [ δ t + 1 ∣ F t ] ≤ 0 . The barrier can still increase at single steps, but for every λ t chosen from past observations, E t + 1 ≥ 0 and E [ E t + 1 ∣ F t ] = 1 + λ t E [ δ t + 1 ∣ F t ] ≤ 1 . Hence M k is a test supermartingale for every γ and U, and Theorem 1 holds for every K max and every a ≥ 1 . The first two rows of Figure A5 confirm that the alarm rates of System 1 and System 2 stay below α in all settings.
Invalid certificates. In scenarios where certificates are invalid, various parameters will influence the corresponding alarm rates, we will also provide specific recommendations for parameter selection in practical deployment.

1. The horizon factor K max

We vary K max ∈ { 100 , 200 , … , 800 } with a = 1 , i.e., with the constant threshold 1 / α . We choose a = 1 here not because it is the best value of a, but to isolate the effect of the horizon on the alarms: with K max ln a fixed, a = e K max ln a / K max and the threshold at every step k would change together with K max , so the effect of the horizon could not be separated from that of the threshold shaping, which is studied separately in Figure A2.
Results.Figure A5(a,d) shows that the alarm rates for the valid systems remain unchanged as K max varies. With a = 1 and a fixed K max , the share of runs that have raised an alarm by step k is non-decreasing in k: as the monitored trajectory approaches K max , it can only increase or stay constant. The observed rates remain below or equal to α , consistent with the anytime-valid guarantee. For System 2+input, the attack starts at k = 100 . Thus, when K max = 100 , the monitored trajectory contains no attacked step, and no alarms are raised (Figure A5(g)). For System 3, the barrier function is invalid from the start, but the evidence ln M k needs about 300 steps to reach ln ( 1 / α ) . At K max = 100 , the evidence ln M k remains well below the alarm threshold ln ( 1 / α ) (Figure A2(d)), so no alarms are raised (Figure A5(j)). From K max = 300 onward, DAB achieves higher ρ α than Direct betting, indicating that DAB is more effective at detecting the loss of validity of the barrier certificates over these horizons.
In practice, the choice of K max involves a trade-off between the monitoring horizon and the desired level of confidence in the barrier certificate. A shorter horizon limits the time over which evidence against the certificate can accumulate, whereas a longer horizon provides more opportunities to detect a loss of validity. Since the validity of the barrier certificate is generally unknown a priori, K max should be selected according to the practical monitoring requirements and the desired level of trust in the certificate. In particular, a shorter horizon may be appropriate when the certificate is considered highly trustworthy and limiting alarms is a priority, whereas a longer horizon may be preferred when more extensive monitoring is needed to detect potential invalidity.

2. Betting rule λ t .

Direct uses λ t = 1 / B ( x ^ t ) and has no tunable parameters. Therefore, its alarm rates remain unchanged across the parameter setting in the second and third column of the Figure A5. In contrast, DAB uses
λ t = min ( λ t K , U , 1 / B ( x ^ t ) ) ,
where λ t K depends on the discounted sums S t and Q t of past increments, with the discount factor γ . When γ = 1 , earlier decreases in the barrier can offset subsequent increases in S t . As shown in Figure A5(h,k), both invalid systems consequently exhibit substantially fewer alarms. Lowering γ from 1 raises detection on both systems. Below 0.9, System 3 is flat while System 2+input declines, indicating that the effectiveness of the discount factor depends on the system.
The cap U mainly limits the betting factor when the Kelly-based factor is not the active constraint. Figure A5(i, l) shows that DAB produces alarm rates above α for System 2+input only for U ≥ 100 , whereas the alarm rates for System 3 change little once U ≥ 13 . These results suggest that the value of U needed to achieve effective detection depends on the system. In practice, U can be selected through a sensitivity analysis, choosing a value beyond which increasing the cap yields little additional improvement in detection performance. Increasing U does not compromise the anytime-valid guarantee, because the constraint λ t ≤ 1 / B ( x ^ t ) remains in force. Consistent with this guarantee, the alarm rates for the valid systems remain below α , even when U = 1000 .
We also try other betting strategies. We compare our adaptive betting rule with fixed betting rules computed from the same barrier increments. For any betting sequence with 0 ≤ λ t ≤ 1 / B t , define M t ( λ ) = ∏ s = 1 t ( 1 + λ s − 1 δ s ) . Monitors use the threshold a K max − t / α of the main experiments ( K max ln a = 4 ) for their own betting sequences, and they use the average of the M s ( λ ) values for multiple fixed parameter values when they have the same weights. For Direct, M t = B t / B 0 . The fraction mixture uses λ t ( c ) = c / B t , c ∈ C = { 0.2 , 0.5 , 0.75 , 1 } . The absolute mixture uses the fixed absolute bet λ t ( β ) for β ∈ A with A 1 = { 1 , 10 , 20 , 100 } , and A 2 = { 10 , 30 , 60 , 100 } . In each episode, each component of the absolute mixture keeps c and β fixed. In DAB, S t and Q t are γ -discounted sums of past δ s and δ s 2 (Eq. (4)).
What do these methods guarantee? For betting components under H 0 , their equal-weight mixtures are also nonnegative supermartingales. So Theorem 1 can be applied to all betting rules in Table A1.
Table A1. Compared betting rules, all driven by the increments δ t = B t − B t − 1 . Guar.: P H 0 ( τ ≤ K max ∣ x 0 ) ≤ α for every x 0 (Theorem 1).
Table A1. Compared betting rules, all driven by the increments δ t = B t − B t − 1 . Guar.: P H 0 ( τ ≤ K max ∣ x 0 ) ≤ α for every x 0 (Theorem 1).
Betting rules Bet λ t Alarm Guar.
Direct 1 / B t M t ≥ a K max − t α
Fraction mix. c / B t , c ∈ C M ¯ t ≥ a K max − t α
Absolute mix. min { β , 1 / B t } , β ∈ A j M ¯ t ≥ a K max − t α
DAB Eq. 4 M t ≥ a K max − t α
Results.Table A2 and Figure A4 show that all monitors keep the alarm rates of the valid systems below α , with p ^ max ≤ 0.50 % on System 1 and no alarm on System 2.
On the invalid systems, DAB raises alarm rates above α for 79.90 % of the initial states of System 2-input attack and 78.40 % of those of System 3. For Direct, these shares are only 17.90 % and 23.80 % , and for the mixtures they are at most 22.40 % . This is because a fixed bet is also placed while the barrier decreases, which multiplies the evidence by a factor below one. For example, the barrier of System 2-input attack decreases for many steps before the attack, and the fixed bets lose evidence during this period. DAB does not bet when the discounted sum S t of recent increments is negative, and thus keeps its evidence for the steps where the barrier rises. Moreover, the mixture methods may be less effective because they average the evidence processes of their components. Consequently, strong evidence accumulated by a single component may be diluted by the others, preventing the mixture from reaching the alarm threshold.
Table A2. Comparison with other monitors on the runs of Table 1. N = 10 3 initial states, R = 10 3 trajectories per initial state, K max = 400 , K max ln a = 4 , α = 0.05 . All values are percentages.
Table A2. Comparison with other monitors on the runs of Table 1. N = 10 3 initial states, R = 10 3 trajectories per initial state, K max = 400 , K max ln a = 4 , α = 0.05 . All values are percentages.
Direct Fraction mix. Absolute mix. A 1 Absolute mix. A 2 DAB
System ρ α p ^ max ρ α p ^ max ρ α p ^ max ρ α p ^ max ρ α p ^ max
Valid certificates
System 1 0.00 0.20 0.00 0.50 0.00 0.00 0.00 0.00 0.00 0.10
System 2 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Invalid certificates
System 2-input attack 17.90 100.00 11.30 100.00 0.00 0.00 0.00 1.20 79.90 81.50
System 3 23.80 63.60 0.00 0.00 9.30 29.50 22.40 58.80 78.40 95.10
Figure A4. Distribution of the alarm rates p ^ i over the initial states for all monitors ( K max ln a = 4 ).
Figure A4. Distribution of the alarm rates p ^ i over the initial states for all monitors ( K max ln a = 4 ).
Preprints 239339 g0a4
Figure A5. Sensitivity to the horizon K max , DAB memory γ and DAB cap U.
Figure A5. Sensitivity to the horizon K max , DAB memory γ and DAB cap U.
Preprints 239339 g0a5

Appendix C. Training Details

We train the neural barrier B ϕ (with a softplus output layer so that B ϕ ≥ 0 structurally) by minimizing soft penalties on the barrier conditions. Given a batch of constraint states { x i } i = 1 N sampled from the safe region, we simulate M independent successor states x i , j ′ ∼ P ( · ∣ x i , π θ ( x i ) ) for each x i and estimate the conditional expectation by E ^ [ B ϕ ( x ′ ) ∣ x i ] = 1 M ∑ j = 1 M B ϕ ( x i , j ′ ) . The supermartingale decrease condition is enforced by
L dec = 1 N ∑ i = 1 N ReLU E ^ [ B ϕ ( x ′ ) ∣ x i ] − B ϕ ( x i ) ,
while the initial and unsafe conditions are enforced on sampled sets { x 0 ( i ) } i = 1 N 0 ⊂ X 0 and { x u ( i ) } i = 1 N u ⊂ X u by
L init = 1 N 0 ∑ i = 1 N 0 ReLU B ϕ ( x 0 ( i ) ) − b , L unsafe = 1 N u ∑ i = 1 N u ReLU 1 − B ϕ ( x u ( i ) ) ,
where b > 0 is an upper bound on the initial barrier value. The total loss is
L ( ϕ ) = w 1 L dec + w 2 L unsafe + w 3 L init ,
where w 1 , w 2 , w 3 > 0 are weighting parameters. All terms are optimized with Adam. In this paper, we mainly focus on online training, where collecting multiple independent successors from the same state may be impractical. We therefore set M = 1 . Although the resulting single-sample Monte Carlo estimate is unbiased for E [ B ϕ ( x ′ ) ∣ x i ] , it has higher variance. Moreover, applying the nonlinear ReLU penalty to a single-sample estimate does not provide an unbiased estimate of the ideal expected decrease loss. Consequently, the learned barrier is not necessarily a valid certificate. Nevertheless, the runtime monitor can detect potential violations and intervene against unsafe behavior. The neural network output B ϕ uses a Softplus activation, which ensures that B ϕ ( x ) ≥ 0 . We then define the deployed barrier function by the piecewise extension
B ¯ ϕ ( x ) = B ϕ ( x ) , x ∈ S , 1 , x ∉ S .
Therefore, the nonnegativity condition and the unsafe-set condition B ¯ ϕ ( x ) ≥ 1 for all x ∉ S are satisfied structurally. During deployment, the runtime monitor evaluates B ¯ ϕ and computes the barrier increments as
δ t + 1 = B ¯ ϕ ( x ^ t + 1 ) − B ¯ ϕ ( x ^ t ) .
The sampled unsafe-set loss is retained as an auxiliary training term to encourage the neural-network output to approach the prescribed unsafe value near the boundary of the safe set.

References

  1. Chougule, A.; Chamola, V.; Sam, A.; Yu, F.R.; Sikdar, B. A comprehensive review on limitations of autonomous driving and its impact on accidents and collisions. IEEE Open J. Veh. Technol. 2023, 5, 142–161. [Google Scholar] [CrossRef]
  2. Uesato, J.; Kumar, A.; Szepesvari, C.; Erez, T.; Ruderman, A.; Anderson, K.; Heess, N.; Kohli, P.; et al. Rigorous agent evaluation: An adversarial approach to uncover catastrophic failures. arXiv 2018, arXiv:1812.01647. [Google Scholar]
  3. Prajna, S.; Jadbabaie, A. Safety verification of hybrid systems using barrier certificates. In Proceedings of the International workshop on hybrid systems: Computation and control, 2004; Springer; pp. 477–492. [Google Scholar]
  4. Prajna, S.; Jadbabaie, A.; Pappas, G.J. A Framework for Worst-Case and Stochastic Safety Verification Using Barrier Certificates. IEEE Trans. Autom. Control 2007, 52, 1415–1428. [Google Scholar] [CrossRef]
  5. Ramdas, A.; Grünwald, P.; Vovk, V.; Shafer, G. Game-theoretic statistics and safe anytime-valid inference. Stat. Sci. 2023, 38, 576–601. [Google Scholar] [CrossRef]
  6. Shafer, G.; Shen, A.; Vereshchagin, N.; Vovk, V. Test martingales, Bayes factors and p-values. Stat. Sci. 2011, 84–101. [Google Scholar] [CrossRef]
  7. Vovk, V.; Wang, R. E-values: Calibration, combination and applications. Ann. Stat. 2021, 49, 1736–1754. [Google Scholar] [CrossRef]
  8. Shafer, G. Testing by Betting: A Strategy for Statistical and Scientific Communication. J. R. Stat. Soc. Ser. A Stat. Soc. 2021, 184, 407–431. [Google Scholar] [CrossRef]
  9. Waudby-Smith, I.; Ramdas, A. Estimating means of bounded random variables by betting, 2022. arXiv arXiv:math.
  10. Xue, B. Finite-time safety and reach-avoid verification of stochastic discrete-time systems. Inf. Comput. 2025, 105368. [Google Scholar] [CrossRef]
  11. Bauer, A.; Leucker, M.; Schallhart, C. Runtime verification for LTL and TLTL. ACM Trans. Softw. Eng. Methodol. (TOSEM) 2011, 20, 1–64. [Google Scholar] [CrossRef]
  12. Clarke, E.M.; Zuliani, P. Statistical model checking for cyber-physical systems. In Proceedings of the International symposium on automated technology for verification and analysis, 2011; Springer; pp. 1–12. [Google Scholar]
  13. Lindemann, L.; Qin, X.; Deshmukh, J.V.; Pappas, G.J. Conformal prediction for stl runtime verification. In Proceedings of the Proceedings of the ACM/IEEE 14th International Conference on Cyber-Physical Systems (with CPS-IoT Week 2023), 2023; pp. 142–153. [Google Scholar]
  14. Zhao, Y.; Hoxha, B.; Fainekos, G.; Deshmukh, J.V.; Lindemann, L. Robust conformal prediction for STL runtime verification under distribution shift. In Proceedings of the 2024 ACM/IEEE 15th International Conference on Cyber-Physical Systems (ICCPS); IEEE, 2024; pp. 169–179. [Google Scholar]
  15. Cairoli, F.; Paoletti, N.; Bortolussi, L. Conformal Quantitative Predictive Monitoring of STL Requirements for Stochastic Processes. In Proceedings of the Proceedings of the 26th ACM International Conference on Hybrid Systems: Computation and Control (HSCC), 2023; pp. 1–11. [Google Scholar] [CrossRef]
  16. Gibbs, I.; Candès, E.J. Adaptive Conformal Inference Under Distribution Shift. J. Mach. Learn. Res. 2021, 22, 1–59. [Google Scholar]
  17. Feng, Y.; Zhu, J.; Platzer, A.; Laurent, J. Adaptive shielding via parametric safety proofs. Proc. ACM Program. Lang. 2025, 9, 816–843. [Google Scholar] [CrossRef]
  18. Alshiekh, M.; Bloem, R.; Ehlers, R.; Könighofer, B.; Niekum, S.; Topcu, U. Safe reinforcement learning via shielding. In Proceedings of the Proceedings of the AAAI conference on artificial intelligence, 2018; Vol. 32. [Google Scholar]
  19. Jansen, N.; Könighofer, B.; Junges, S.; Serban, A.; Bloem, R. Safe reinforcement learning using probabilistic shields. In Proceedings of the 31st International Conference on Concurrency Theory (CONCUR 2020), 2020; Schloss Dagstuhl–Leibniz-Zentrum für Informatik; pp. 3–1. [Google Scholar]
  20. Yu, E.; Žikelić, Đ.; Henzinger, T.A. Neural control and certificate repair via runtime monitoring. Proc. Proc. AAAI Conf. Artif. Intell. 2025, Vol. 39, 26409–26417. [Google Scholar] [CrossRef]
  21. Jagtap, P.; Soudjani, S.; Zamani, M. Temporal logic verification of stochastic systems using barrier certificates. In Proceedings of the International Symposium on Automated Technology for Verification and Analysis, 2018; Springer; pp. 177–193. [Google Scholar]
  22. Cao, Z.; Wang, P.; Ong, L.; Žikelić, Đ.; Wagner, D.; Xue, B. Comparative Analysis of Barrier-like Function Methods for Reach-Avoid Verification in Stochastic Discrete-Time Systems. arXiv 2025, arXiv:2512.05348. [Google Scholar]
  23. Ames, A.D.; Coogan, S.; Egerstedt, M.; Notomista, G.; Sreenath, K.; Tabuada, P. Control barrier functions: Theory and applications. In Proceedings of the 2019 18th European control conference (ECC); Ieee, 2019; pp. 3420–3431. [Google Scholar]
  24. Žikelić, Đ.; Lechner, M.; Henzinger, T.A.; Chatterjee, K. Learning control policies for stochastic systems with reach-avoid guarantees. Proc. Proc. AAAI Conf. Artif. Intell. 2023, Vol. 37, 11926–11935. [Google Scholar] [CrossRef]
  25. Zhi, D.; Wang, P.; Liu, S.; Ong, C.H.L.; Zhang, M. Unifying qualitative and quantitative safety verification of dnn-controlled systems. In Proceedings of the International Conference on Computer Aided Verification, 2024; Springer; pp. 401–426. [Google Scholar]
  26. Abate, A.; Giacobbe, M.; Roy, D. Stochastic omega-regular verification and control with supermartingales. In Proceedings of the International Conference on Computer Aided Verification, 2024; Springer; pp. 395–419. [Google Scholar]
  27. Xue, B. Reach-avoid controllers synthesis for safety critical systems. IEEE Trans. Autom. Control 2024, 69, 8892–8899. [Google Scholar] [CrossRef]
  28. Henzinger, T.A.; Mallik, K.; Sadeghi, P.; Žikelić, Đ. Supermartingale certificates for quantitative omega-regular verification and control. In Proceedings of the International Conference on Computer Aided Verification, 2025; Springer; pp. 29–55. [Google Scholar]
  29. Xue, B. Sufficient and necessary barrier-like conditions for safety and reach-avoid verification of stochastic discrete-time systems. Automatica 2026, 187, 112919. [Google Scholar] [CrossRef]
  30. Mathiesen, F.B.; Romao, L.; Calvert, S.C.; Abate, A.; Laurenti, L. Inner approximations of stochastic programs for data-driven stochastic barrier function design. In Proceedings of the 2023 62nd IEEE Conference on Decision and Control (CDC); IEEE, 2023; pp. 3073–3080. [Google Scholar]
  31. Nejati, A.; Zamani, M. Data-driven synthesis of safety controllers via multiple control barrier certificates. IEEE Control Syst. Lett. 2023, 7, 2497–2502. [Google Scholar] [CrossRef]
  32. Salamati, A.; Lavaei, A.; Soudjani, S.; Zamani, M. Data-driven verification and synthesis of stochastic systems via barrier certificates. Automatica 2024, 159, 111323. [Google Scholar] [CrossRef]
  33. Wu, T.; Wagner, D.; Ong, C.H.L.; Xue, B. PAC Finite-Time Safety Guarantees for Stochastic Systems with Unknown Disturbance Distributions. In Proceedings of the Proceedings of the 29th ACM International Conference on Hybrid Systems: Computation and Control (HSCC ’26), 2026; Association for Computing Machinery (ACM). [Google Scholar]
  34. Mathiesen, F.B.; Romao, L.; Calvert, S.C.; Laurenti, L.; Abate, A. A data-driven approach for safety quantification of non-linear stochastic systems with unknown additive noise distribution. Automatica 2026, 193, 113187. [Google Scholar] [CrossRef]
  35. Abate, A.; Ahmed, D.; Edwards, A.; Giacobbe, M.; Peruffo, A. FOSSIL: a software tool for the formal synthesis of lyapunov functions and barrier certificates using neural networks. In Proceedings of the Proceedings of the 24th international conference on hybrid systems: computation and control, 2021; pp. 1–11. [Google Scholar]
  36. Zhao, H.; Qi, N.; Dehbi, L.; Zeng, X.; Yang, Z. Formal synthesis of neural barrier certificates for continuous systems via counterexample guided learning. ACM Trans. Embed. Comput. Syst. 2023, 22, 1–21. [Google Scholar] [CrossRef]
  37. Chatterjee, K.; Henzinger, T.A.; Lechner, M.; Žikelić, Đ. A learner-verifier framework for neural network controllers and certificates of stochastic systems. In Proceedings of the International Conference on Tools and Algorithms for the Construction and Analysis of Systems, 2023; Springer; pp. 3–25. [Google Scholar]
  38. Ville, J. Etude critique de la notion de collectif; Gauthier-Villars Paris, 1939; Vol. 3. [Google Scholar]
  39. Yu, Y.; Wu, T.; Xia, B.; Wang, J.; Xue, B. Safe probabilistic invariance verification for stochastic discrete-time dynamical systems. In Proceedings of the 2023 62nd IEEE Conference on Decision and Control (CDC); IEEE, 2023; pp. 5804–5811. [Google Scholar]
  40. Kushner, H.J. Stochastic stability and control.; Academic Press, Inc., 1967. [Google Scholar]
  41. Kingma, D.P.; Ba, J. Adam: A method for stochastic optimization. arXiv 2014, arXiv:1412.6980. [Google Scholar]
  42. Wu, T.; Yu, Y.; Xia, B.; Wang, J.; Xue, B. A framework for safe probabilistic invariance verification of stochastic dynamical systems. arXiv 2024, arXiv:2404.09007. [Google Scholar]
  43. Vertovec, N.; Mathiesen, F.B.; Badings, T.; Laurenti, L.; Abate, A. Scalable verification of neural control barrier functions using linear bound propagation. arXiv 2025, arXiv:2511.06341. [Google Scholar]
  44. Gowal, S.; Dvijotham, K.; Stanforth, R.; Bunel, R.; Qin, C.; Uesato, J.; Arandjelovic, R.; Mann, T.; Kohli, P. On the Effectiveness of Interval Bound Propagation for Training Verifiably Robust Models, 2019, [arXiv:cs.LG/1810.12715].
Figure 1. Overview of the proposed framework for anytime-valid monitoring of learned barrier certificates.
Figure 1. Overview of the proposed framework for anytime-valid monitoring of learned barrier certificates.
Preprints 239339 g001
Figure 2. The trade-off between avoiding unnecessary alarms and detecting degradation promptly.
Figure 2. The trade-off between avoiding unnecessary alarms and detecting degradation promptly.
Preprints 239339 g002
Table 1. Runtime monitoring under valid and invalid certificates with K max ln a = 0 and the default setting K max ln a = 4 on the same runs. ρ α is the fraction of initial states with p ^ i > α and p ^ max = max i p ^ i is the worst-case alarm rate. N = 10 3 initial states, R = 10 3 trajectories per initial state, K max = 400 , α = 0.05 . All values are percentages. Figure A1 shows the full distribution of p ^ .
Table 1. Runtime monitoring under valid and invalid certificates with K max ln a = 0 and the default setting K max ln a = 4 on the same runs. ρ α is the fraction of initial states with p ^ i > α and p ^ max = max i p ^ i is the worst-case alarm rate. N = 10 3 initial states, R = 10 3 trajectories per initial state, K max = 400 , α = 0.05 . All values are percentages. Figure A1 shows the full distribution of p ^ .
Direct DAB
System K max ln a ρ α p ^ max ρ α p ^ max
Valid certificates
System 1 0 0.00 4.80 0.00 0.90
4 0.00 0.20 0.00 0.10
System 2 0 0.00 0.00 0.00 0.00
4 0.00 0.00 0.00 0.00
Invalid certificates
System 2-input 0 18.10 100.00 82.10 92.00
4 17.90 100.00 79.90 81.50
System 3 0 24.00 69.40 79.00 96.30
4 23.80 63.60 78.40 95.10
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.