Assessing the Finite-Time Stability of Nonlinear Systems by means of
  Physics-Informed Neural Networks
In this paper, the problem of assessing the Finite-Time Stability (FTS)
property for general nonlinear systems is considered. First, some necessary and
sufficient conditions that guarantee the FTS of general nonlinear systems are
provided; such conditions are expressed in terms of the existence of a suitable
Lyapunov-like function. Connections of the main theoretical result of given in
this article with the typical conditions based on Linear Matrix Inequalities
(LMI) that are used for Linear Time-Varying (LTV) systems are discussed. An
extension to the case of discrete time systems is also provided. Then, we
propose a method to verify the obtained conditions for a very broad class of
nonlinear systems. The proposed technique leverages the capability of neural
networks to serve as universal function approximators to obtain the
Lyapunov-like function. The network training data are generated by enforcing
the conditions defining such function in a (large) set of collocation points,
as in the case of Physics-Informed Neural Networks. To illustrate the
effectiveness of the proposed approach, some numerical examples are proposed
and discussed. The technique proposed in this paper allows to obtain the
required Lyapunov-like function in closed form. This has the twofold advantage
of a) providing a practical way to verify the considered FTS property for a
very general class of systems, with an unprecedented flexibility in the FTS
context, and b) paving the way to control applications based on Lyapunov
methods in the framework of Finite-Time Stability and Control.
Adriano Mele, Alfredo Pironti
Assessing the Finite-Time Stability of Nonlinear Systems by means of Physics-Informed Neural Networks

###### Abstract

In this paper, the problem of assessing the Finite-Time Stability (FTS) property for general nonlinear systems is considered. First, some necessary and sufficient conditions that guarantee the FTS of general nonlinear systems are provided; such conditions are expressed in terms of the existence of a suitable Lyapunov-like function. Connections of the main theoretical result of given in this article with the typical conditions based on Linear Matrix Inequalities (LMI) that are used for Linear Time-Varying (LTV) systems are discussed. An extension to the case of discrete time systems is also provided. Then, we propose a method to verify the obtained conditions for a very broad class of nonlinear systems. The proposed technique leverages the capability of neural networks to serve as universal function approximators to obtain the Lyapunov-like function. The network training data are generated by enforcing the conditions defining such function in a (large) set of collocation points, as in the case of Physics-Informed Neural Networks. To illustrate the effectiveness of the proposed approach, some numerical examples are proposed and discussed. The technique proposed in this paper allows to obtain the required Lyapunov-like function in closed form. This has the twofold advantage of a) providing a practical way to verify the considered FTS property for a very general class of systems, with an unprecedented flexibility in the FTS context, and b) paving the way to control applications based on Lyapunov methods in the framework of Finite-Time Stability and Control.

keywords: Finite-Time stability, neural networks, universal approximation, Lyapunov methods

## 1 Introduction

The concept of Finite-Time Stability (FTS), sometimes also referred to as _practical stability_, was originally introduced in the Russian literature in the '50s [1; 2; 3]; during the next decade, studies on this topic were carried out by the western scientific community as well [4; 5; 6]. Roughly speaking, a dynamical system is said to be FTS with respect to a given time-horizon \(T\), an initial time instant \(t_{0}\), an _initial set_\(\Omega_{0}\) and a (possibly time-varying over the time interval \([t_{0},t_{0}+T]\)) _trajectory set_\(\Omega_{t}\) if, whenever the initial point of the state trajectory is contained in \(\Omega_{0}\), the trajectory is confined inside \(\Omega_{t}\) for all \(t\in[t_{0}\,,t_{0}+T]\).1 (see fig. 1).

Footnote 1: Note that the concept of FTS used in this paper is not to be confused with another notion of finite-time stability that exists in the literature, namely the fact that a stable equilibrium is reached in a finite time interval [7].

FTS is a concept linked to, but independent from, Lyapunov stability, as it is intrinsically concerned with _quantitative_ results, substantially shifting the focus from the steady-state to the transient behaviour of the considered system. However, in many cases Lyapunov-like functions can be employed to assess the FTS of a dynamical system2; necessary and sufficient conditions for the FTS of nonlinear systems based on Lyapunov functions can be found, for instance, in the pioneering work by Bernfeld and Lakshmikantham [8]. Along the same line of research, the main aim of this work is to exploit conditions similar to the ones in [8] in order to derive a practical way to assess the considered FTS property for a very broad class of nonlinear systems.

Footnote 2: For brevity, we will refer to these functions as Lyapunov functions as well, even though the conditions that they are required to satisfy are slightly different from the case of standard Lyapunov stability.

In some cases, Lyapunov-like conditions for FTS can be efficiently solved by recasting them in terms of algebraic (LMI) and Differential (DLMI) Linear Matrix Inequalities. This fact, together with the availability of efficient tools for solving (D)LMIs, sparked a renewed interest in the topic in recent years. This is the case, for example, of Linear Time-Varying (LTV) systems over ellipsoidal, polytopic and piecewise-quadratic domains, for which techniques based on time-varying quadratic or piecewise-quadratic Lyapunov functions have been proposed (see the book [9] and the references therein for an overview). Moreover, similar techniques can be exploited to find finite-time stabilizing controllers for the same classes of systems. Several results appeared in the technical literature that extended the FTS framework to uncertain [10; 11], hybrid [12; 13], stochastic [14; 15] and

Figure 1: Graphical representation of the FTS property for a 2D system.
time-delay systems [16], sometimes considering the case of annular domains [17; 18; 19; 20], where both an upper and lower bound on the state variables are assigned. An approach based on the Extremum Seeking algorithm for the Finite-Time stabilization of LTV systems with unknown control direction has been recently proposed in [21]. Some attempts have also been made in order to extend similar techniques to nonlinear systems; for example, in [22] DLMI-based sufficient conditions are given for the special class of nonlinear quadratic systems. However, for nonlinear systems, solutions in terms of (D)LMI feasibility problems are usually not available, and different techniques must be considered. In this view, we aim at proposing a general approach to assess the considered FTS property for the case of nonlinear systems, which, to the best of our knowledge, is lacking in the technical literature. The main problem tackled in this article can be divided in the two following points:

* find necessary and sufficient conditions for the FTS of general nonlinear, non-autonomous systems;
* find a practical way to assess such conditions (at least for a reasonably large class of nonlinear systems for which standard LMI-based results do not apply).

To this aim, we first restate, in a slightly simplified form, the necessary and sufficient conditions for the FTS of continuous-time nonlinear systems originally given in [8]. Then, we discuss how these conditions are a generalization of the ones given in [9] for linear systems over ellipsoidal domains. Furthermore, this theoretical result is also extended to the discrete-time case.

Since the proposed conditions are given in terms of the existence of a suitable Lyapunov-like function, we then turn our attention to the problem of finding an expression for such function. A possible method, discussed in this work, is to design a dedicated procedure to train a suitable Neural Network (NN) in order to serve as the desired Lyapunov function. The use of NNs to represent Lyapunov functions is not new in the control literature, thanks to the capability of Neural Networks (NN) to serve as universal function approximators [23]. Some applications include autonomous NL systems [24] and robotics [25]; in the latter paper, a learner-falsifier training procedure is proposed to speed up the training process. A similar training architecture is also used in [26], where NNs are used to estimate the region of attraction of a given controller in the case of discrete time polynomial systems. In both [26] and [27], multi-output NNs are used in combination with quadratic expressions to enforce the positive-definiteness of the Lyapunov functions. Even though NN-based function approximations are known to suffer from the so-called curse of dimensionality, in [28] it is discussed how systems that benefit from a small-gain property have compositional Lyapunov functions which can be estimated with a number of neurons that only grows polynomially with the state dimension. Interestingly, the training procedures used to obtain Lyapunov functions with NNs are usually aimed at enforcing the desired conditions on both the network's output and its derivatives with respect to the input parameters. As deep NNs are used to satisfy conditions involving partial derivatives by exploiting the knowledge of the equations governing a physical process, these techniques are naturally related to the framework of Physics-Informed Neural Networks (PINN) [29].

In this work, we draw ideas from these recent techniques and combine them with the general conditions for the FTS of nonlinear, non-autonomous systems with the aim to provide a flexible procedure that is capable of testing the FTS property for a broad class of dynamical systems over domains of a generic shape. To this end, we propose an approach to train a NN so that it serves as a Lyapunov function. The procedure relies on the standard Adam algorithm [30] to optimize a cost function designed to enforce the required conditions in a large set of collocation points. It is implemented by using off-the-shelf algorithms and can be run on GPU-enabled computers. To the best of our knowledge, this is the first time that a practical algorithm aimed at testing the FTS property for such a broad class of systems is proposed and implemented.

The rest of the paper is organized as follows: in Section 2, an overview of the notation used throughout the article and some preliminary results are given. Section 3 presents the main results of the paper. In particular, in section 3.1 the main results, i.e. the necessary and sufficient conditions for the FTS of continuous-time, nonlinear, non-autonomous systems are presented; these conditions are extended to the discrete-time case in section 3.2. In section 3.3, the connection between the results of section 3.1 and existing results for continuous-time linear systems are discussed. In section 3.4, a numerical procedure, based on NNs, to obtain a Lyapunov function that satisfies the properties required by the main result in section 3.1 is described. In section 4 some numerical examples are provided to show the effectiveness of the proposed procedure. Finally, in section 5, the obtained results are discussed and some concluding remarks are given.

## 2 Notation and Preliminaries

Given a vector \(x\in\mathbb{R}^{n}\), \(||x||\) indicates its standard euclidean norm. \(\bar{\Omega}\) denotes the closure of a set \(\Omega\), \(|\Omega|\) its measure and \(\partial\Omega\) its boundary; \(f(\Omega)\) is the image of the set \(\Omega\) through the function \(f(\cdot)\). \(M\prec 0\) indicates that the matrix \(M\) is negative-definite, \(M\succ 0\) that it is positive definite, \(I\) denotes the identity matrix (whose dimensions will be clear from the context).

Throughout the article, we will consider systems in the form

\[\dot{x}(t)=f(t,x),\qquad x(t_{0})=x_{0}\,, \tag{1}\]

where \(f(t,x):J\times\mathbb{R}^{n}\to\mathbb{R}^{n}\), and \(J=[t_{0},T]\). The evolution function of (1) is denoted by \(\varphi(t,t_{0},x_{0})\), while \(\phi(t,t_{0})\) indicates the state-transition matrix of a LTV system, for which

\[\phi(t,t_{0})x_{0}=\varphi(t,t_{0},x_{0})\,.\]

Throughout the paper, we will consider Lyapunov functions \(V(t,x)\) that are continuous, scalar and satisfy a local Lipschitz condition with respect to \(x\). We denote the orbital derivative of such a function along the trajectories of (1) as (see [31, Chap. 1])

\[\begin{split}\dot{V}(t,x)=&\,\,\,\,\,\,\,\,\,\,\,\,\, \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,
\(D^{+}v(t)\); however, to clearly differentiate between derivatives with respect to the \(t\) and \(x\) variables, we choose to adopt the more common dot notation \(\hat{v}(t)\). When differentiable functions are considered (as in the numerical procedure described in sec. 3.4), the standard and upper Dini derivatives coincide.

Finally, we adopt the following notation for compactness

\[\inf_{\begin{subarray}{c}i\in J\\ x\in\Omega_{t}\end{subarray}}g(t,x)=\inf_{t\in J}\inf_{x\in\Omega_{t}}g(t,x)\,,\]

where the set \(\Omega_{t}\) depends on the value of \(t\).

**Assumption 1**.: _The map \(f(t,x)\) in equation (1) is continuous in \(t\) and for each compact set \(\mathcal{A}\subset\mathbb{R}^{n}\) it satisfies the Lipschitz condition_

\[||f(t,x)-f(t,y)||\leq\lambda_{\mathcal{A}}(t)||x-y||\qquad\forall x,y\in \mathcal{A}\,, \tag{3}\]

_where \(\lambda_{\mathcal{A}}(t)\) is a non-negative continuous function defined in \(J\)._

For each \((t^{*},x^{*})\in J\times\mathbb{R}^{n}\), assumption 1 guarantees the existence and uniqueness of the evolution function \(\varphi(t,t^{*},x^{*})\) for all \(t\) in a suitable neighborhood of \(t^{*}\) (see for example Theorem 3.1 in [32]).

Given an _initial set_\(\Omega_{0}\), a (possibly time-varying) _trajectory set_\(\Omega_{t}\) and two scalars \(t_{0}\) and \(T\), system (1) is said to be Finite-Time Stable (FTS) with respect to \((t_{0},T,\Omega_{0},\Omega_{t})\) if and only if

\[x_{0}\in\Omega_{0}\implies x(t)\in\Omega_{t}\quad\forall t\in[t_{0},t_{0}+T]\,, \tag{4}\]

where \(\Omega_{0}\) is a closed set, \(\Omega_{t}\) is open and both are connected and bounded \(\forall t\in J\). Note that, for the definition to be well-posed, it is required that \(\Omega_{t}\supset\Omega_{0}\) at \(t=t_{0}\).

## 3 Main results

In this section, the main results of this work are presented. First, necessary and sufficient conditions for the FTS of nonlinear, non-autonomous systems in the form (1) under assumption 1 are provided in thm. 1. Then, these conditions are extended to the case of discrete-time systems in thm. 2. The connections with the usual LMI-based conditions used for LTV systems (reported for ease of reference as thm. 3) are discussed in sec. 3.3. Finally, a numerical procedure to find a closed-form expression for the required Lyapunov function, based on Neural Networks, is proposed in sec. 3.4.

### Necessary and sufficient conditions for FTS

The following theorem provides necessary and sufficient conditions for the FTS of system (1) 3.

Footnote 3: The proof closely follows the arguments in [8, Thm. 3.1].

**Theorem 1**.: _System (1) is FTS wrt \((t_{0},T,\Omega_{0},\Omega_{t})\) if and only if there exists a continuous function \(V:J\times\mathbb{R}^{n}\to\mathbb{R}\), locally Lipschitz in \(x\), such that the following conditions hold_

\[\dot{V}(t,x)\leq 0\quad\forall t\in J,x\in\bar{\Omega}_{t} \tag{5}\] \[\sup_{x\in\Omega_{0}}V(t_{0},x)<\inf_{\begin{subarray}{c}t\in J\\ x\in\Omega_{t}\end{subarray}}V(t,x) \tag{6}\]

_Proof._ We start by proving sufficiency. Assume that \(\exists V:J\times\mathbb{R}^{n}\to\mathbb{R}\) that satisfies conditions (5-6). Moreover, by contradiction, assume that, for some initial point \(x_{0}\), \(\exists t^{*}\in J\) such that \(x(t^{*})\in\partial\Omega_{t^{*}}\) and \(x(t)\in\Omega_{t}\)\(\forall t\in[t_{0},t^{*})\). By the definition of infimum

\[V\left(t^{*},x(t^{*})\right)\geq\inf_{\begin{subarray}{c}t\in J\\ x\in\partial\Omega_{t}\end{subarray}}V(t,x)\,.\]

On the other hand, eq. (5) yields

\[V\left(t^{*},x(t^{*})\right)\leq V(t_{0},x_{0})\leq\sup_{\xi\in\Omega_{0}}V(t_ {0},\xi)\,.\]

which contradicts (6). Sufficiency is proven.

To prove necessity, assume that the system (1) is FTS wrt \((t_{0},T,\Omega_{0},\Omega_{t})\). We look for a continuous, locally Lipschitz function \(V(t,x)\) that satisfies conditions (5-6). To this end consider the system

\[\dot{x}(t)=F(t,x)\,, \tag{7}\]

where \(F\) is bounded in \(J\times\mathbb{R}^{n}\), satisfies the global Lipschitz condition

\[||F(t,x)-F(t,y)||\leq\lambda(t)||x-y||\quad\forall x,y\in\mathbb{R}^{n}\,, \tag{8}\]

\(\lambda(t)\) being a continuous non-negative scalar function, and finally

\[F(t,x)=f(t,x)\,,\,\forall(t,x)\in J\times D\,, \tag{9}\]

where \(D\) is a compact set such that \(D\supseteq\bar{\Omega}_{t}\) for all \(t\in J\). The existence of such a \(F(t,x)\) is guaranteed by Assumption 1. Moreover the main result in [33] allows to conclude that the evolution function \(\varphi_{F}(t_{1},t_{2},\dot{x})\) of equation (9) is defined, unique, and continuous in \(J\times J\times\mathbb{R}^{n}\). Consider

\[V(t,x):=\inf_{\xi\in\Omega_{0}}||\varphi_{F}(t_{0},t,x)-\xi|| \tag{10}\]

Note that \(\varphi_{F}(t_{0},t,x)\) is the initial point obtained by following the trajectory of (7) backwards from \((t,x)\) to \(t_{0}\); the function \(V(t,x)\) associates to \((t,x)\) the distance of the initial point of the trajectory from the initial set \(\Omega_{0}\). The function \(V\) is continuous and bounded on each compact subset of \(\mathbb{R}^{n}\); we will now show that \(V(t,x)\) is also Lipschitz in \(x\). First of all note that, by the Gronwall inequality, we have that

\[||\varphi_{F}(t,s,x)-\varphi_{F}(t,s,y)||\leq\exp\left(\int_{J}\lambda(\tau) \,d\tau\right)||x-y||\,. \tag{11}\]

Now consider

\[V(t,x)\leq||\varphi_{F}(t_{0},t,x)-\xi||\quad\forall\xi\in\Omega_{0}\,.\]

By applying the triangular inequality we obtain

\[V(t,x) \leq||\varphi_{F}(t_{0},t,x)-\varphi_{F}(t_{0},t,y)||+||\varphi_{F} (t_{0},t,y)-\xi||\] \[\forall\xi\in\Omega_{0}\,,\]

and this yields

\[V(t,x)\leq\] \[||\varphi_{F}(t_{0},t,x)-\varphi_{F}(t_{0},t,y)||+\inf_{\xi\in \Omega_{0}}||\varphi_{F}(t_{0},t,y)-\xi||=\] \[||\varphi_{F}(t_{0},t,x)-\varphi_{F}(t_{0},t,y)||+V(t,y)\]

Similarly we have

\[V(t,y)\leq||\varphi_{F}(t_{0},t,x)-\varphi_{F}(t_{0},t,y)||+V(t,x)\]
and hence

\[|V(t,x)-V(t,y)|\leq||\varphi_{F}(t_{0},t,x)-\varphi_{F}(t_{0},t,y)||\,. \tag{12}\]

Now, considering equation (11), we obtain

\[|V(t,x)-V(t,y)|\leq\exp\left(\int_{J}\lambda(\tau)\,d\tau\right)||x-y||\,. \tag{13}\]

Equation (13) guarantees the existence of the orbital derivative of \(V(t,x)\) as defined in (2). It is then trivial to verify that such derivative along the trajectories of system (7) is identically zero, as the initial point does not change. Now, considering equation (9) and the fact that system (1) satisfies the FTS property, we have

\[V(t,\varphi(t,t_{0},x_{0}))=V(t,\varphi_{F}(t,t_{0},x_{0}))\,,\forall(t,x_{0}) \in J\times\Omega_{0}\,,\]

hence, (5) holds (with the equality sign). To prove that \(V(t,x)\) satisfies (6), observe that \(\sup_{x\in\Omega_{0}}V(t_{0},x)=0\), since every point \(x\in\Omega_{0}\) has zero distance from the set \(\Omega_{0}\). Now consider a grain in generic point \(x^{*}\in\partial\Omega_{t^{*}}\), \(t^{*}\in J\), and assume that \(\exists x^{*}_{0}\) s.t. \(x^{*}=\varphi(t^{*},t_{0},x^{*}_{0})\). Since system (1) was assumed to be FTS, the initial point \(x^{*}_{0}\) cannot be in the set \(\Omega_{0}\). Hence, \(V(t^{*},x^{*}(t^{*}))>0\). Since this condition holds for all possible choices of \(x^{*}\in\partial\Omega_{t^{*}}\) and for all \(t^{*}\in J\), and considering that \(V(t,x)\) is continuous in \(x\) and \(\partial\Omega_{t}\) is closed and bounded, it follows that

\[\inf_{\begin{subarray}{c}t\in J\\ x\in\partial\Omega_{t}\end{subarray}}V(t,x)>0=\sup_{x\in\Omega_{0}}V(t_{0},x )\,,\]

i.e. \(V(t,x)\) satisfies (6). This completes the proof.

**Remark 1**.: _When a finite-dimensional state space is considered, \(\partial\Omega_{t},\Omega_{0}\) will in general be compact sets, and the \(\inf\) and \(\sup\) in eq. (6) can be replaced with \(\min\) and \(\max\) respectively._

**Remark 2**.: _Notice that, differently from classic Lyapunov stability, in the FTS framework it is not explicitly required that \(V(t,x)\) is positive-definite._

**Remark 3**.: _In [8, Thm. 3.1], a less restrictive version of (5) appears, which requires that \(\hat{V}(t,x)\leq g(t,V(t,x))\) for \((t,x)\in J\times\hat{\Omega}_{t}\), with \(g:\mathbb{R}\times\mathbb{R}\rightarrow\mathbb{R}^{+}\). With this choice, the orbital derivative of \(V\) is allowed to take positive values, but the price for this increased freedom is that condition (6) must be complicated by resorting to the comparison lemma [34, Lemma 3.4]. However, there is no indication on how to choose the function \(g(t,V(t,x))\) a priori, and even the necessity proof in [8, Thm. 3.1] eventually assumes \(g\equiv 0\). For these reasons, we set \(g\equiv 0\) from the beginning; this choice also simplifies the training procedure of sec. 3.4. Moreover, with respect to [8, Thm. 3.1], the formulation of them. 1 automatically takes into account the possibility that the trajectory domain \(\Omega_{t}\) is time-varying. This, in turn, makes condition (0-ii) in [8, Thm. 3.1] unnecessary._

In view of the numerical implementation of the conditions in thm. 1, it is useful to state the following corollary.

**Corollary 1**.: _System (1) is FTS wrt \((t_{0},T,\Omega_{0},\Omega_{t})\) if and only if there exists a continuous function \(V:J\times\mathbb{R}^{n}\rightarrow\mathbb{R}\) such that condition (5) holds and condition (6) is replaced by_

\[\inf_{\begin{subarray}{c}t\in J\\ x\in\partial\Omega_{t}\end{subarray}}V(t,x)-\sup_{x\in\Omega_{0}}V(t_{0},x)>\alpha \tag{14}\]

_for some fixed value of \(\alpha>0\)._

Proof.: Suppose that (6) holds with

\[\inf_{\begin{subarray}{c}t\in J\\ x\in\partial\Omega_{t}\end{subarray}}V(t,x)-\sup_{x\in\Omega_{0}}V(t_{0},x)>\varepsilon\]

for some \(V(t,x)\) and \(\varepsilon>0\). The function \(\tilde{V}(t,x):=\beta V(t,x)\), with \(\beta>0\) satisfies condition (5), since \(\hat{V}(t,x)=\beta\hat{V}(t,x)\leq 0\). Choosing \(\beta=\alpha/\varepsilon\), it is now easy to verify that \(\tilde{V}(t,x)\) satisfies condition (14) as well.

The proof of this corollary is trivial, and it stems from the observation that a Lyapunov function can be rescaled by an arbitrary constant. However, the usefulness of this result is in the fact that it allows to freely choose the parameter \(\alpha\), which becomes a tuning parameter for the numerical algorithm described in sec. 3.4. Moreover, it can be used to draw connections between well-assessed results on the FTS of LTV systems and thm. 1; this is done in sec. 3.3.

### Extension to discrete-time systems

Consider a system in the form

\[x(k+1)=f(k,x(k))\,. \tag{15}\]

System (15) is said to be FTS with respect to \((\Omega_{0},\Omega_{k},N)\) if and only if, by definition, \(x(0)\in\Omega_{0}\implies x(k)\in\Omega_{k}\) for \(k=0,1,...,N\) (notice that there is no loss of generality in assuming that the index \(k\) starts from \(0\)). As for the continuous time case, we assume \(\Omega_{0}\) closed and \(\Omega_{k}\) open. Moreover, we define the set

\[\Omega_{k}^{fwd}:=[f(k,\bar{\Omega}_{k})\setminus\Omega_{k+1}]\cup\partial f( k,\bar{\Omega}_{k})\]

and

\[dV(k,x):=V(k+1,f(k,x))-V(k,x)\,.\]

The following theorem provides necessary and sufficient conditions for the FTS of (15).

**Theorem 2**.: _System (15) is FTS wrt \((\Omega_{0},\Omega_{k},N)\) if there exists a function \(V(k,x)\) continuous in \(x\), \(V:\{0,...,N\}\times\mathbb{R}^{n}\rightarrow\mathbb{R}\) such that the following conditions hold_

\[dV(k,x)\leq 0\,,\quad x\in\Omega_{k}\quad k=0,...,N-1 \tag{16}\] \[\sup_{x\in\Omega_{0}}V(0,x)<\inf_{\begin{subarray}{c}0\leq k<N\\ x\in\Omega_{k}^{fwd}\end{subarray}}V(k+1,x)\,. \tag{17}\]

_Moreover, if \(f(k,x)\) is continuous with respect to \(x\) and it admits an inverse \(f^{-1}(k,x)\) for \(k\in\{0,...,N\}\), then conditions (16-17) are also necessary._

Proof.: To prove sufficiency, assume that \(\exists V:\{0,...,N\}\times\mathbb{R}^{n}\rightarrow\mathbb{R}\) that satisfies conditions (16-17). Moreover, assume that, for some initial point \(x_{0}\), \(\exists k^{*}\in\{0,...,N-1\}\) such that \(x(k^{*})\in\Omega_{k^{*}}\) and \(x(k^{*}+1)\notin\Omega_{k^{*}+1}\). Since \(x(k^{*}+1)\in f(k,\Omega_{k})\subset f(k,\bar{\Omega}_{k})\), it follows that \(x(k^{*}+1)\in\Omega_{k}^{fwd}\). By definition, we have that

\[V\left(k^{*}+1,x(k^{*}+1)\right)\leq\inf_{\begin{subarray}{c}0\leq k<N\\ x\in\Omega_{k}^{fwd}\end{subarray}}V(k+1,x)\,. \tag{18}\]

On the other hand, condition (16) ensures that

\[V\left(k^{*}+1,x(k^{*}+1)\right)\leq V(0,x_{0})\leq\sup_{x\in\Omega_{0}}V(0,x)\,,\]
which contradicts condition (17).

To prove necessity, arguments similar to those used in thm. 1 can be used. In particular, it can be shown that the candidate Lyapunov function

\[V(k,x)=\inf_{\xi\in\Omega_{0}}||\varphi(0,k,x)-\xi||\]

satisfies the conditions of the theorem if the considered system is FTS. However, for \(V(k,x)\) to be well-defined, we need the function \(f(k,x)\) to be invertible for all \(k\). 

### Connection with continuous-time LTV systems over ellipsoidal domains

The definition of FTS can be recast in terms of ellipsoidal initial and trajectory domains by substituting equation (4) with

\[x_{0}^{T}Rx_{0}\leq 1\implies x(t)^{T}\Gamma(t)x(t)<1\quad\forall t\in J \tag{19}\]

where \(R\) is a positive-definite, symmetric matrix and \(\Gamma(t)\) is a positive-definite, symmetric, matrix-valued function. The well-posedness condition becomes \(R\succ\Gamma(t_{0})\). For the FTS of LTV systems, several equivalent necessary and sufficient conditions are given in [9, Thm. 2.1]. In particular, the following theorem is proven.

**Theorem 3**.: _[_9_, Thm. 2.1]_ _Consider the LTV system_

\[\dot{x}(t)=A(t)x(t),\quad x(t_{0})=x_{0} \tag{20}\]

_with the initial domain \(\Omega_{0}=\{x|x^{T}Rx\leq 1\}\) and the trajectory domain \(\Omega_{t}:=\{x|x^{T}\Gamma(t)x<1\}\), where \(\Gamma(t_{0})\prec R\). System (20) is FTS wrt \((t_{0},T,\Omega_{0},\Omega_{t})\) if and only if there exists a positive-definite matrix-valued function \(P(\cdot)\) that satisfies the following DLMI conditions_

\[\dot{P}(t)+P(t)A^{T}(t)+A(t)P(t)\prec 0,t\in J \tag{21a}\] \[P(t)\succ\Gamma(t),t\in J\] (21b) \[P(t_{0})\prec R \tag{21c}\]

This theorem can be shown to be a particular case of thm. 1 in sec. 3.1. Let us start by choosing \(V(t,x)=x(t)^{T}P(t)x(t)\) (the validity of this choice will be discussed at the end of this section). Then, if a strict inequality is considered4, property (5) reduces to (21a), while condition (6) can be recovered by observing that (21b-21c) yield:

Footnote 4: The equality case can be linked to the DLE condition (2.3a) in [9]. This point is not discussed here for brevity.

\[V(t,x)>x(t)^{T}\Gamma(t)x(t) \implies \inf_{\begin{subarray}{c}t\in J\\ x\in\partial\Omega_{t}\end{subarray}}V(t,x)>1 \tag{22a}\] \[V(t_{0},x)<x(t_{0})^{T}Rx(t_{0}) \implies \sup_{x\in\Omega_{0}}V(t_{0},x)<1 \tag{22b}\]

Hence, conditions (22a-22b) imply (6). On the other hand, once we fix \(V(t,x)=x^{T}P(t)x\) the inverse implication is also true. To show this, first of all observe that \(V(t,x)\) can always be scaled up in such a way that

\[\inf_{\begin{subarray}{c}t\in J\\ x\in\partial\Omega_{t}\end{subarray}}x^{T}P(t)x>1>\sup_{x\in\Omega_{0}}x^{T} P(t_{0})x\,,\]

without affecting the condition \(\dot{V}\leq 0\) (cf. cor. 1), i.e. conditions (22a-22b) hold. The first inequality can be rewritten as

\[x^{T}P(t)x>x^{T}\Gamma(t)x\qquad\forall x:x^{T}\Gamma(t)x=1\,.\]

But since \(\Gamma\succ 0\), for any other choice of \(x\in\mathbb{R}^{n}\) there exists a scalar \(c\) such that \(x^{T}\Gamma(t)x=c^{2}\). This means that the point \(\frac{x}{c}\) lies on \(\partial\Omega_{t}\), and hence

\[\frac{1}{c^{2}}x^{T}\Gamma(t)x=1<\frac{1}{c^{2}}x^{T}P(t)x\implies x^{T} \Gamma(t)x<x^{T}P(t)x\]

i.e. \(P(t)\succ\Gamma(t)\). With a similar argument it can be shown that \(P(t_{0})\prec R\), since

\[\sup_{x\in\Omega_{0}}V(t_{0},x)<1\implies\sup_{x\in\partial\Omega_{0}}V(t_{0},x)<1\,.\]

To conclude this section, we discuss how the choice \(V(t,x)=x^{T}(t)P(t)x(t)\) derives from the same arguments in the necessity part of the proof of thm. 1. In thm. 1 we considered a function \(V(t,x)\) as in (10), i.e. the distance between the initial point of the trajectory and the set \(\Omega_{0}\). We observed that, whenever \(x(t)\in\partial\Omega_{t}\), such distance must be strictly positive if the system is FTS. In the case of ellipsoidal domains, this is equivalent to

\[x^{T}(t)\Gamma(t)x(t)=1\implies x_{0}^{T}Rx_{0}>1\,. \tag{23}\]

Using the state-transition matrix \(\phi(t,t_{0})\) of (20), we have

\[x^{T}(t)\Gamma(t)x(t)=x_{0}^{T}\phi(t,t_{0})^{T}\Gamma(t)\phi(t,t_{0})x_{0}(t)\,,\]

and hence (23) reduces to

\[\phi(t,t_{0})^{T}\Gamma(t)\phi(t,t_{0})\prec R\,.\]

Moreover, since \(\phi(t,t_{0})^{-1}=\phi(t_{0},t)\)

\[Q(t):=\phi(t_{0},t)^{T}R\phi(t_{0},t)\succ\Gamma(t)\,, \tag{24}\]

which closely resembles (21b). Since \(\phi(t_{0},t_{0})=I\), we immediately find that

\[Q(t_{0})=R\]

(compare these conditions with [9, Thm. 2.1 (ii-iii)]). Finally, by continuity we can choose an arbitrarily small \(\varepsilon>0\) such that conditions (21b)-(21c) hold for

\[P(t):=Q(t)(1-\varepsilon)\,.\]

Observe that, at its core, this choice of \(Q(t)\) again reduces to following the trajectories of (20) backwards and evaluating the distance of the initial point \((t_{0},x_{0})\) from the initial set through the quadratic forms associated to \(Q(t)\) and \(R\).

### Lyapunov function approximation through Physics-Informed Neural Networks

In this section, we propose a method to train a NN so that its output provides a Lyapunov function for continuous time systems which are FTS. Consider the following cost functional

\[L(\dot{V},V,\delta_{2})=L_{1}(\dot{V})+L_{2}(V,\delta_{2})\,, \tag{25}\]

where

\[L_{1}=\frac{1}{T}\int_{J}\frac{1}{|\Omega_{t}|}\int_{\Omega_{t}}\Big{(}\max\{ \dot{V}(\tau,x),0\}\Big{)}^{2}\,dxd\tau \tag{26a}\] \[L_{2}=\frac{1}{T}\int_{J}\frac{1}{|\partial\Omega_{t}|}\int_{\partial\Omega_{t}}( \max\{\delta V_{\dot{b}}(\tau,x)+\delta_{2},0\})^{2}\,dxd\tau\,. \tag{26b}\]
In (26b), the parameter \(\delta_{2}>0\) is introduced to enforce the strict inequality in (6) (see discussion below). The term \(\delta V_{b}\) appearing in (26b) is defined as

\[\delta V_{b}(t,x)=\sup_{\xi\in\Omega_{0}}\{V(t_{0},\xi)\}-V(t,x)\,,\]

and is evaluated on \(\partial\Omega_{t}\). The following result shows that the problem of finding a Lyapunov function for a system in the form (1) is equivalent to finding a \(V(t,x)\) such that \(L(\dot{V},V,\delta_{2})=0\) for some (arbitrary) value of \(\delta_{2}\).

**Proposition 1**.: _A continuous function \(V(t,x)\) satisfies the conditions of thm. 1 if and only if \(L(\dot{V},V,\delta_{2})=0\) for some value of \(\delta_{2}>0\)._

_Proof._ If condition (5) holds, then \(\dot{V}(t,x)\leq 0\) for every \(t\in J\) and for every \(x\in\Omega_{t}\). Hence, \(\max\{\dot{V}(\tau,x),0\}=0\) and \(L_{1}(\dot{V})=0\). On the other and, since \(L_{1}(V)\) is defined as the integral of a non-negative quantity, \(L_{1}(V)=0\) implies that its argument is equal to zero for all \(t\in J\) and \(x\in\Omega_{t}\), i.e. that \(V\leq 0\). Similarly, \(L_{2}(V,\delta_{2})=0\) if and only if \(\delta V_{b}(t,x,\delta_{2})\leq 0\) for every \(t\in J\) and for every \(x\in\partial\Omega_{t}\). But this is equivalent to requiring that

\[\begin{split} 0&\geq\sup_{\begin{subarray}{c}t\in J\\ x\in\partial\Omega_{t}\end{subarray}}\delta V_{b}(t,x)+\delta_{2}\\ &=\sup_{\begin{subarray}{c}t\in J\\ x\in\partial\Omega_{t}\end{subarray}}\left\{\sup_{\xi\in\Omega_{t}}\{V(t_{0}, \xi)\}-V(t,x)\right\}+\delta_{2}\\ &=\sup_{\xi\in\Omega_{0}}\{V(t_{0},\xi)\}-\inf_{\begin{subarray}{ c}t\in J\\ x\in\partial\Omega_{t}\end{subarray}}\{V(t,x)\}+\delta_{2}\,.\end{split} \tag{27}\]

In view of corollary 1, if this condition is satisfied for some value of \(\delta_{2}>0\), then also condition (6) holds. The proof is completed by observing that \(L\;=\;0\) is equivalent to \(L_{1}=0\;\wedge\;L_{2}\;=\;0\), since \(L_{1,2}\geq 0\) by definition.

In practice, we restrict our attention to functions \(V(t,x)\) of class \(C^{1}\) by choosing continuously differentiable activation functions. The universal approximation property of NNs ensures that, even if \(C^{1}\) activation functions are chosen, any continuous function can be approximated with arbitrary precision by the network, provided that a sufficiently large number of nodes is employed. It is worth to notice that it is usually required that the function approximated by the NN is evaluated on compact subsets of \(\mathbb{R}^{n}\), which is precisely the case in FTS, where the conditions on \(V(t,x)\) must be satisfied only on the (compact) domains of interest. For \(V(t,x)\in C^{1}\), the orbital derivative (2) can be evaluated as

\[\dot{V}(t,x)=\frac{\partial V}{\partial t}+\mathcal{L}_{f}V=\frac{\partial V}{ \partial t}+\frac{\partial V}{\partial x}f(t,x)\,, \tag{28}\]

where \(\mathcal{L}_{f}V\) denotes the Lie derivative of \(V(t,x)\) along \(f(t,x)\). The partial derivatives of \(V\) with respect to \(x\) and \(t\) can be computed analytically via automatic differentiation [35]. To train the network, we sample the cost function \(L(\dot{V},V)\) in a (large) set of collocation points. Let us define

\[\hat{L}_{1}(\dot{V},\delta_{1})=\frac{1}{N_{c}}\sum_{i=1}^{N_{c}}\left(\max\{ \dot{V}(x_{i},t_{i})+\delta_{1},0\}\right)^{2},, \tag{29}\]

where \(N_{c}\) is the total number of considered collocation points in \(t\in J,x\in\Omega_{t}\), and

\[\begin{split}&\hat{L}_{2}(V,\delta_{2})=\frac{1}{N_{b}}\sum_{i=1}^ {N_{b}}\left(\max\left\{\delta\tilde{V}_{b}(t_{i},x_{i})+\delta_{2},0\right\} \right)^{2}\\ &\delta\tilde{V}_{b}(t_{i},x_{i})=\max_{j\in[1,N_{0}]}\{V(t_{0}, \xi_{j})\}-V(t_{i},x_{i})\,,\end{split} \tag{30}\]

where \(N_{b}\) and \(N_{0}\) are the numbers of points taken in \(t\in J,x\in\partial\Omega_{t}\) and in \(\Omega_{0}\) respectively. The \(N_{c}\) internal collocation points are obtained by random sampling in both time and space, while the \(N_{b}\) boundary points are computed by discretizing the time interval in \(N_{t}\) discrete instants and then taking \(n_{b}=N_{b}/N_{t}\) points for each time instant. The \(N_{0}\) points are uniformly distributed in the initial domain \(\Omega_{0}\). In eq. (29) we introduced a tolerance parameter \(\delta_{1}\) to penalize the points where \(\dot{V}\) in \(\hat{L}_{1}\) is exactly equal to or slightly smaller than zero, similarly to the \(\delta_{2}\) parameter in eqns. (26b)-(30). Moreover, in view of remark 1, we used the maximum in place of the supremum in the definition of \(\hat{L}_{2}\). The resulting (approximate) loss function is

\[\hat{L}(\dot{V},V,\delta_{1},\delta_{2})=\alpha_{1}\hat{L}_{1}(\dot{V},\delta_{ 1})+\alpha_{2}\hat{L}_{2}(V,\delta_{2})\,, \tag{31}\]

where the weights \(\alpha_{1,2}>0\) have been introduced as additional tuning parameters in the algorithm.

The network is trained by using the matlab implementation of the standard Adam algorithm [30]. The default parameters have been used, i.e. a global learning rate of \(0.001\), a gradient decay factor of \(0.9\) and a squared gradient decay factor of \(0.999\). This choice proved to be enough to obtain good convergence properties in the considered examples. To compute \(\hat{L}_{1}\), the \(N_{c}\) internal collocation points are divided into mini-batches, while all the \(N_{b}+N_{0}\) points on \(\partial\Omega_{t}\) and in the initial domain \(\Omega_{0}\) are used at each training iteration to compute \(\hat{L}_{2}\). This choice reflects the fact that (6) only requires that the infimum of \(V(t,x)\) over all the boundary points is larger than the supremum of \(V(t_{0},x)\) over the initial domain. However, in the definition of \(\hat{L}_{2}\) we considered all the collocation points on \(\partial\Omega_{t}\) to obtain a well-behaved estimate of the cost function gradients with respect to the network parameters. The training procedure terminates when \(\dot{V}(t,x)\leq 0\) over all the \(N_{c}\) internal collocation points and \(\delta\tilde{V}_{b}(t,x)<0\) over all the \(N_{b}\) boundary collocation points. Finally, since we are resorting to an approximate version of the cost function \(L(\dot{V},V,\delta_{2})\), after a solution is found we verify that the theorem conditions are satisfied over a set of test points different from the collocation points used in the training procedure.

Before concluding this section, it is worth to observe that the numerical implementation of the conditions of theorem 1 makes them only necessary in practice. If the considered system is not FTS, then the procedure will usually not converge to a feasible solution; however, it may happen that the algorithm does not converge even if the system is FTS, for instance when the number of nodes in the NN is not large enough to correctly represent the desired Lyapunov function.

## 4 Numerical examples

In this section we illustrate the proposed approach through some numerical examples.
It is worth to observe that the conditions in thm. 1 are based on the orbital derivative of the function \(V(t,x)\), which can be evaluated by means of automatic differentiation techniques when \(V\) is expressed through a neural network. On the other hand, the conditions in thm. 2 are based on recursive equations, and require the computation of the set \(\Omega_{t}^{fwd}\) at each time step. In the following, we will exploit the availability of automatic differentiation routines implemented in Matlab, and only focus on continuous-time systems. Note that, for simplicity, in the proposed examples ellipsoidal domains are considered. However, the algorithms only uses the collocation points placed in such domains and on their boundary, hence the technique can be easily applied to domains of generic shape.

The proposed procedure has been applied to the considered examples as shown in fig. 2. For all the examples, we used a Multi-Layer Perceptron architecture with _softplus_ activation layers (the parameters for each example are reported in table 2). After an initial choice of the collocation point and of the NN and training parameters, the optimization procedure is run. If a solution is found, the required conditions are further tested on a suitable set of test points (e.g. a finely spaced grid over the considered domain). If the test succeeds, the property assessment can be considered to be successful. If the test fails, the training set of collocation points can be enlarged, e.g. by including the points where the test fails, and the procedure can be run again. If the algorithm fails to converge, the NN and training parameters can be modified (e.g. increasing the number of nodes/layers of the NN to make it more expressive, or lowering the learning rates to improve stability) before running the procedure again. If no solution is found with a reasonable set of parameters and/or in a reasonable time, the test is considered to have failed (red box in fig. 2). This could be due to the fact that the system does not satisfy the FTS property or to numerical reasons. It is worth to notice that this characteristic is common to most Lyapunov techniques, which often do not provide a straightforward way to verify that the system is unstable (in the classic or Finite-Time sense).

All the examples in this section have been implemented in matlab and run on a laptop equipped with an Intel Core i7-8750H CPU @2.20GHz processor, 16 GB of RAM and an NVIDIA Geforce GTX 1050 Ti graphic card. The code is available at [https://github.com/AdrianoMele/NeuralNettTS](https://github.com/AdrianoMele/NeuralNettTS).

### Example 1

We start by validating the procedure on a toy example, i.e. a 2D LTI system with fixed ellipsoidal domains. In particular, consider the system

\[\dot{x}(t)=-\begin{bmatrix}0.1&0\\ 0&0.1\end{bmatrix}x(t)\,, \tag{32}\]

with \(t_{0}=0\), \(T=1\) and the domains defined by

\[\begin{split}\Omega_{0}&=\{x\in\mathbb{R}^{2}|x^{T}Rx\leq 1 \},\,R=0.3I\\ \Omega_{t}&=\{x\in\mathbb{R}^{2}|x^{T}\text{T}x\leq 1\},\,\Gamma=0.25I \,.\end{split} \tag{33}\]

Classical FTS results ensure that the solution for this example can be found in terms of a time-invariant quadratic Lyapunov function \(V_{Q}(x)=x^{T}(t)Px(t)\) (also see the discussion in section 3.3). In fact, the system is also Lyapunov-stable, and it can be shown that, in this case, the FTS conditions in thm. 3 can be reduced to the problem of finding a static Lyapunov function that also satisfies conditions (21b-21c). We apply the technique proposed in section 3.4 to the considered system and domains; we expect the algorithm to find a solution \(V(x)\) that is very close to a quadratic function.

The training parameters used in this example are reported in tables 1-2. The algorithm is able to find a solution after only 2 epochs (about 2 s of training). The resulting \(V(x)\) is shown in fig. 3a, while the collocation points and the initial and trajectory domains are shown in fig. 3b. A quadratic best-fit of \(V(x)\) (red dots in fig. 3a) results in the symmetric positive-definite matrix

\[P=\begin{bmatrix}0.3064&-0.0063\\ -0.0063&0.3120\end{bmatrix}\]

Figure 2: Flow diagram describing how the proposed technique has been applied to the examples of sec. 4.
The eigenvalues of \(PA^{T}+AP\) are \([-0.06322,-0.06044]\), i.e. the resulting \(P\) satisfies condition (21a). On the other hand, the eigenvalues of \(P\) are \([0.3022,\,0.3161]\), i.e. condition (21c) does not hold. As discussed in sec. 3.3, a function \(V_{Q}(x)\) that satisfies (21b-21c) can be obtained by a suitable scaling of \(P\).

### Example 2

Consider the following system [36, (1.1.5)]

\[\begin{split}\dot{x_{1}}(t)&=-x_{1}-x_{2}+k(x_{1} -x_{2})(x_{1}^{2}+x_{2}^{2})\\ \dot{x_{2}}(t)&=x_{1}-x_{2}+k(x_{1}+x_{2})(x_{1}^{2} +x_{2}^{2})\end{split} \tag{34}\]

where the constant \(k\) is chosen equal to \(0.1\). This system provides an interesting analytical benchmark for the considered numerical procedure. In fact, in [36] it is shown that, letting \(r^{2}(t)=x_{1}^{2}(t)+x_{2}^{2}(t)\), the solutions of (34) have the property

\[r^{2}(t)=\frac{1}{k\mu}r_{0}^{2}\,,\quad\mu=r_{0}^{2}+\left(\frac{1}{k}-r_{0 }^{2}\right)e^{2(t-t_{0})} \tag{35}\]

We consider the case where \(t_{0}=0\), \(T=1\) and

\[\begin{split}\Omega_{0}&=\{x\in\mathbb{R}^{2}|x^{ T}Rx\leq 1\},\,R=I\\ \Omega_{t}&=\{x\in\mathbb{R}^{2}|x^{T}\Gamma(t)x<1 \},\,\Gamma(t)=0.8k\mu(t)I\,.\end{split} \tag{36}\]

with \(r_{0}=1\). From (35) it can be seen that system (34) is FTS with respect to \((t_{0},T,\Omega_{0},\Omega_{t})\). Some sample trajectories of system (34) are shown in fig. (a)a together with the initial and trajectory domains. With the parameters reported in tables 1-2, a solution is found after 9 training epochs (about 60 s training). The resulting \(V(t,x)\) is shown at different time instants in fig. 7, while the resulting training curve (epochs vs. loss) for the considered parameters is shown in fig. 6.

In order to provide some insight on how the choice of the collocation points affects the algorithm performance, we performed a scan on the parameters \(N_{c},n_{b},N_{t},N_{0}\) of table 1 for this example. In particular, we varied the number of internal collocation points (\(N_{c}=\{5,10,30,50,55,70\}\times 10^{3}\)) while keeping the other parameters fixed (\(N_{0}=700,n_{b}=200\) and a time step equal to \(dt=10^{-1}\), i.e. \(N_{t}=11\); see table 1). Then, we set \(N_{c}=5\times 10^{4}\) and varied the number of collocation points in the initial domain (\(N_{0}=100\)), the number of collocation points on the trajectory domain boundary for each time step (\(n_{b}=\{50,1000\}\)) and the number of time instants \(N_{t}\) (by reducing the time step to \(dt=10^{-2}s\) while keeping \(n_{b}=200\)). The results of this analysis are reported in fig. 4. The algorithm converged in all the considered cases, but for the ones represented by dashed lines (corresponding to cases with very few internal or boundary collocation points) a false positive was obtained, i.e. the resulting neural Lyapunov function violated the required conditions on some points of the test set. The test set for this analysis was generated by considering a different set of internal collocation points, obtained by restricting a \(50\times 50\) equally spaced grid to the initial and trajectory domains, while keeping the same boundary points. The time needed for the algorithm to reach convergence is also reported for completeness; however, notice that no effort has been made to optimize the code performance. Moreover, it is also worth to remark that a certain amount of randomness is implicitly involved in the procedure (in the initialization of the network parameters and in the choice of the collocation points) and that the used platform is not Real-Time. The case reported in fig. 6 corresponds to the red line in 4.

### Example 3

Finally, consider the equations of a damped pendulum

\[\begin{split}\dot{x}_{1}&=x_{2}\\ \dot{x}_{2}&=-\frac{\partial}{l}\sin(x_{1})-\frac{b }{ml^{2}}x_{2}\,,\end{split} \tag{37}\]

which is a widely used benchmark problem in the field of systems and control theory. We set \(g=9.81\) m/s\({}^{2}\), \(m=0.15\) kg, \(l=0.15\) m, \(b=0.1\) kg m\({}^{2}\)/s. We consider the case where \(t_{0}=0\), \(T=2\) s, and

\[\begin{split}\Omega_{0}&=\{x\in\mathbb{R}^{2}|x^{T}Rx \leq 1\},\,R=\frac{4}{\pi^{2}I}\\ \Omega_{t}&=\{x\in\mathbb{R}^{2}|x^{T}\Gamma(t)x<1 \},\,\Gamma(t)=\Theta\tilde{\Gamma}\Theta^{T}\,,\end{split} \tag{38}\]

where

\[\tilde{\Gamma}=\left[\frac{2}{\pi^{2}}e^{0.5t}\begin{array}{c}0\\ 0\end{array}\right] \tag{39}\]

and \(\Theta\) is the rotation matrix given by

\[\Theta=\left[\begin{matrix}\cos(0.2\pi t)&\sin(0.2\pi t)\\ -\sin(0.2\pi t)&\cos(0.2\pi t)\end{matrix}\,.\right] \tag{40}\]

With the parameters reported in tables 1-2, a solution is found after 10 training epochs (approximately 2 m 44 s).

Figure 3: (a) Resulting \(V(t,x)\) and \(\dot{V}(t,x)\) for example #1; the red dots show the quadratic approximant (a constant has been added to \(V(x)\) so that \(V(0)=0\) for graphical reasons). (b) Collocation points for example #1. The green dots show the \(N_{0}\) points in the initial domain, the red dots are the \(N_{c}\) internal points used to enforce (5) and the blue dots are the \(N_{b}=n_{b}N_{t}\) boundary points used to enforce (6).
Figure 4: Training curve for different choices of the parameters reported in table 1 for the case of example #2 (top) and time to converge for each choice (bottom).

Figure 5: Resulting Lyapunov function \(V(t,x)\) and its derivative \(V(t,x)\) for example #2 at different time instants (a constant has been added so that the resulting \(V(t,x)\) is above the \(x_{1}-x_{2}\) plane for graphical reasons).

Figure 6: Training curve for example #2.

Figure 7: Resulting Lyapunov function \(V(t,x)\) and its derivative \(\dot{V}(t,x)\) for example #3 at different time instants.

Figure 8: Training curve for example #3.

Figure 9: Sample trajectories for the systems of examples #2 and #3 (red), together with the considered initial (green) and trajectory (blue) domains.
FTS property. The main idea is to exploit the capability of NN to serve as universal functions approximators in order to find a closed-form expression for the required Lyapunov-like function. The effectiveness of the approach has been illustrated through different numerical examples in the case of continuous-time systems. To the best of our knowledge, this is the first time that a numerical technique allows to practically verify this property for such a large class of systems.

As discussed in the literature review of the introduction, the practical advantages of the FTS notion have been known since long time ago. However, after some pioneering works, the research community that had gathered around this topic remained almost silent until practical (D)LMI-based conditions to assess FTS emerged, at least in the case of linear systems, renewing the research interest in the field. Over the years, such conditions have been extended to uncertain, hybrid, stochastic, time-delay linear systems and to special classes of nonlinear systems. In this article, we proposed an alternative way to assess the FTS property for the case of general nonlinear systems. In this perspective, we expect that the method discussed here can be further refined and extended to more challenging classes of dynamical systems as happened for the linear case.

Of course, the approximate nature of the numerical method employed to verify the conditions of thm. 1 leads to some limitations. First of all, since a discrete set of collocation points is considered, the proposed numerical test is in fact only necessary: the required conditions on the \(V(t,x)\) function may be violated outside the training set of collocation points, but inside the domain of interest. However, this issue is quite standard when neural Lyapunov methods are considered. One possibility to mitigate this issue is to test the conditions on a set of points that is different (possibly also larger) with respect to the considered collocation points; this is the approach adopted in this paper. Furthermore, emerging research lines exist that focus on ways to assess the safety of similar methods in the framework of classic Lyapunov stability (see for example [24]). Another limitation of the proposed method is that there is no way of directly assessing that a system is Finite-Time _unstable_. When this is the case, the training procedure will usually fail, as it cannot find a Lyapunov-like function that satisfies the required conditions. A possible future line of research could be that of extending classical Lyapunov instability theorems to the field of Finite-Time stability analysis.

Finally, the availability of a Lyapunov function in closed-form, whose derivatives with respect to time and state variables can be simply computed through auto-differentiation techniques, paves the way to novel Finite-Time Stabilization and Control techniques based on Lyapunov methods.
