  Providing non-trivial certificates of safety for non-linear stochastic
systems is an important open problem that limits the wider adoption of
autonomous systems in safety-critical applications. One promising solution to
address this problem is barrier functions. The composition of a barrier
function with a stochastic system forms a supermartingale, thus enabling the
computation of the probability that the system stays in a safe set over a
finite time horizon via martingale inequalities. However, existing approaches
to find barrier functions for stochastic systems generally rely on convex
optimization programs that restrict the search of a barrier to a small class of
functions such as low degree SoS polynomials and can be computationally
expensive. In this paper, we parameterize a barrier function as a neural
network and show that techniques for robust training of neural networks can be
successfully employed to find neural barrier functions. Specifically, we
leverage bound propagation techniques to certify that a neural network
satisfies the conditions to be a barrier function via linear programming and
then employ the resulting bounds at training time to enforce the satisfaction
of these conditions. We also present a branch-and-bound scheme that makes the
certification framework scalable. We show that our approach outperforms
existing methods in several case studies and often returns certificates of
safety that are orders of magnitude larger.
