Automated and Sound Synthesis of Lyapunov Functions with SMT Solvers

Daniele Ahmed, Andrea Peruffo, Alessandro Abate

Abstract

Stability is a fundamental property of dynamical systems, ensuring that a system returns to equilibrium rather than diverging. Lyapunov functions are the primary tool for proving this property without solving complex differential equations. However, traditional synthesis methods often suffer from a "soundness gap" due to numerical errors or struggle with high-dimensional and parametric models. This paper presents a framework that leverages Satisfiability Modulo Theory (SMT) solvers within a Counter-Example Guided Inductive Synthesis (CEGIS) loop to automatically and soundly synthesize Lyapunov functions for linear, non-linear, and parametric systems.

Introduction

In the study of dynamical systems—such as robots, chemical plants, or aircraft—stability is the most critical property. Lyapunov functions provide a rigorous mathematical proof of stability. Existing automated methods, such as Sum-of-Squares (SOS) optimization, typically rely on numerical solvers using floating-point arithmetic. This introduces a potential soundness gap where tiny numerical errors might invalidate a stability guarantee. Furthermore, traditional methods often struggle to scale to high-dimensional systems or handle parametric models where system constants are unknown. This work addresses these challenges by providing a sound, automated synthesis framework using SMT solvers.

Methodology

The core of the proposed framework is a Counter-Example Guided Inductive Synthesis (CEGIS) architecture. This creates an iterative loop between two primary components: a Learner and a Verifier.

The Counter-Example Guided Inductive Synthesis (CEGIS) architecture showing the loop between the Learner (L) and the Verifier (Z).
  1. The Learner (L): Proposes a candidate Lyapunov function based on a predefined template (e.g., a quadratic form). The authors evaluated two types of learners:
  2. Numerical (Gurobi): A high-performance optimization tool that is fast but not formally sound.
  3. Sound (Z3): An SMT solver that finds symbolic coefficients, ensuring numerical exactness at the cost of speed.
  4. The Verifier (Z): Acting as an oracle, the Z3 SMT solver checks if the candidate function satisfies stability requirements across the entire state space.
  5. If no violation is found, the function is proven correct.
  6. If a violation exists, a counter-example ($\bar{x}$) is returned to the Learner to refine the next candidate.

A key insight of this work is that the Learner can be "dirty" (approximate) as long as the Verifier is "clean" (sound). This allows the framework to combine the speed of numerical optimizers like Gurobi with the formal guarantees of Z3.

Experimental Evaluation

The methodology was evaluated using several benchmarks:

  • Random Linear Models: 100 systems for each dimension from $n=3$ to $n=10$.
  • Literature Benchmarks: Seven complex non-linear and parametric models from classic stability analysis papers.
  • Comparison Baseline: SOSTOOLS, a standard MATLAB-based toolbox for Lyapunov synthesis.

Results and Discussion

The framework demonstrated significant improvements in robustness, scalability, and interpretability:

  • Performance and Scalability: The Gurobi-CEGIS approach was generally the fastest, handling 10-dimensional systems in an average of ~40 seconds. This demonstrates that SMT-based methods can scale to dimensions relevant for practical control theory.
  • Robustness: The Z3-CEGIS approach successfully solved complex non-linear problems (such as Example 5 in the study) where the industry-standard SOSTOOLS failed. It also identified cases where numerical solvers returned invalid "solutions" due to precision limits (e.g., Example 8).
  • Parametric Success: The framework successfully discovered parametric Lyapunov functions (e.g., $V(x) = (\mu + 2)x^2 + y^2$), providing a symbolic proof of stability that adapts to the system's operating conditions.
  • Interpretability: Unlike the 15-digit floating-point numbers produced by traditional optimizers, SMT-generated functions often result in rational fractions (e.g., $1/3x^2$), which are much easier for humans to interpret and verify.

Conclusion and Future Work

This research bridges the gap between high-performance numerical optimization and formal verification. While currently limited by Z3's handling of non-polynomial terms (like trigonometric functions), the framework provides a robust path forward for automated control synthesis. Future work aims to incorporate Neural Networks as learners to further improve scalability while maintaining the SMT solver as a sound verifier to ensure formal correctness.

Summary updated

BibTeX
@inproceedings{ahmed2020automated,
  author = {Daniele Ahmed and Andrea Peruffo and Alessandro Abate},
  title = {{Automated and Sound Synthesis of Lyapunov Functions with SMT Solvers}},
  booktitle = {TACAS},
  year = {2020},
  doi = {10.1007/978-3-030-45190-5\_6},
}
Figure