Abstract
Formal verification of stochastic systems—ranging from randomized algorithms to autonomous robotic controllers—traditionally involves a restrictive trade-off: achieving precise results for simple models or settling for loose, conservative bounds for complex ones. This paper presents a novel data-driven framework that leverages the expressive power of neural networks to synthesize "supermartingale certificates." By integrating deep learning for certificate synthesis with SMT solvers for formal verification within a Counterexample-Guided Inductive Synthesis (CEGIS) loop, the authors demonstrate the ability to compute significantly tighter, sound probability bounds for systems previously beyond the reach of symbolic methods.
Introduction
In the domain of quantitative verification, the primary objective is to determine the probability that a stochastic process—such as a probabilistic program or a dynamical model—reaches a specific target state, such as a system crash or a safety violation. While symbolic methods have long been the standard for providing formal guarantees, they often rely on rigid templates (e.g., linear or polynomial functions) that fail to capture the complex, non-linear behaviors of modern stochastic systems. This limitation frequently results in probability bounds that are too loose to be practically useful. This research addresses these challenges by employing neural networks as universal approximators to find more precise certificates of safety.
The Supermartingale Framework
The core mathematical tool used in this work is the supermartingale. In the context of reachability analysis, a supermartingale acts as a "ranking function" for probabilities. To prove an upper bound on the probability of reaching a target set, one must find a function $V$ that satisfies two primary conditions:
- Boundary Condition: $V$ must be at least 1 for all states within the target (danger) zone.
- Supermartingale Property: The expected value of $V$ at the next time step must be less than or equal to its current value for all states outside the target zone.
If such a function is found, the value of $V$ at the system's starting point provides a guaranteed, formal upper bound on the probability of failure. The difficulty lies in synthesizing these functions for complex state spaces.
Methodology: The CEGIS Loop
The authors propose a Counterexample-Guided Inductive Synthesis (CEGIS) framework to automate the discovery of neural supermartingales. The process involves two main components: a Learner and a Verifier.
1. The Learner
The Learner uses a neural network (typically with ReLU or Softplus activations) to represent the candidate supermartingale $V$. The network is optimized using a custom loss function designed to satisfy the formal requirements:
- Indicating Loss: Penalizes the network if $V < 1$ in the target set.
- Non-increasing Loss: Penalizes the network if the expected value increases over a transition.
- Minimization Loss: Encourages the network to find the smallest possible valid bound at the initial state.
Training can be conducted in two modes: Program-aware, which uses symbolic inference (via the PSI tool) to calculate exact expectations, and Program-agnostic, which uses Monte Carlo sampling. The latter allows the method to be applied to "black-box" models where the underlying transition logic is not symbolically accessible.
2. The Verifier
Once the Learner proposes a candidate network, it is passed to the Z3 SMT solver. The solver formally checks whether the supermartingale conditions hold across the entire continuous state space. If the solver finds a point where the conditions are violated, that point is returned to the Learner as a counterexample to refine the network in the next iteration. This ensures that the final result is not just a statistical estimate, but a mathematically sound proof.
Experimental Evaluation
The framework was evaluated against a diverse suite of benchmarks, including:
- Unreliable Hardware: Programs like
faulty_loopandfaulty_marblesthat simulate execution on hardware prone to probabilistic faults. - Robot Motion: Models such as
cliff_crossingandrepulse100, where agents navigate environments with noisy controls and must avoid hazardous regions.
The neural approach was compared against the state-of-the-art Farkas’ Lemma method, which is used to synthesize linear supermartingales.
Key Results and Insights
The experimental results highlight several advantages of the neural approach:
- Superior Precision: In the
cliff_crossingbenchmark, the neural approach produced a bound of approximately 0.055, whereas the symbolic Farkas' Lemma could only prove a much looser bound of 0.454. This demonstrates that neural networks can "bend" to follow the actual probability contours of a system. - Expanded Reach: The method succeeded on complex benchmarks like
persist_2dandfaulty_marbleswhere traditional symbolic methods failed to find any valid certificate. - Decoupling Synthesis from Verification: By using deep learning to "guess" the certificate and SMT to "check" it, the framework combines the optimization efficiency of stochastic gradient descent with the absolute certainty of formal logic.
- Reduced Manual Effort: Unlike many symbolic methods, the neural approach does not require users to manually provide inductive invariants, as the architecture naturally handles non-negativity and other constraints.
Limitations and Future Directions
Despite its success, the approach faces a significant bottleneck in the verification phase. As neural networks become deeper or the system constraints more non-linear, the computational cost for the SMT solver to verify the certificate increases substantially. Future research will likely focus on scaling verification to deeper architectures and extending the framework beyond reachability to other quantitative properties, such as expected total costs or complex temporal logic specifications.
Conclusion
This work demonstrates that neural networks are not only powerful tools for pattern recognition but can also be integrated into rigorous formal verification pipelines. By providing a flexible and automated way to synthesize supermartingale certificates, this data-driven approach significantly narrows the gap between the theoretical verification of stochastic systems and their real-world complexity.
Summary updated