Lyapunov’s Direct Method for Autonomous Flows

At a glance

This module states and proves, in Lean, the classical theorem that an energy-like function certifies stability without ever solving the equations of motion: if a smooth function is positive away from the origin, vanishes at it, and never increases along the motion, then the origin is Lyapunov stable — orbits that start near it stay near it. Strengthening “never increases” to “strictly decreases off the origin” upgrades this to asymptotic stability (orbits actually return to the origin), and adding radial unboundedness of makes the attraction global. All four results are checked end to end by Lean’s kernel on the three standard foundational axioms (propext, Classical.choice, Quot.sound) — no sorry anywhere. The one standing modeling premise, shared with every dynamical module in this library, is that the flow is given and solves the field (IsSolutionTo); no existence-and-uniqueness theory for the differential equation is developed here.
Links: module index · assumptions ledger · attraction engine LaSalle’s invariance principle · sibling wiring page the Khalil comparison layer · source khalil2002nonlinear

Motivation

Suppose you are handed a nonlinear control system — say the closed loop of a free-flying manipulator — and asked a deceptively simple question: will small disturbances stay small? The honest but useless answer is “solve the equations and look.” For anything nonlinear the closed-form solution does not exist, and numerical integration only ever tells you about the finitely many initial conditions you happened to try.

Lyapunov’s insight, from his 1892 thesis, was to sidestep the solution entirely. Find a scalar “energy” that is positive everywhere except at the equilibrium, where it bottoms out at zero, and check a single inequality: that never grows as the state evolves. If you can do that, the equilibrium is stable — and you never integrated a single trajectory. This is the direct method, and it is the workhorse of nonlinear control. Every controller in this project’s guidance stack is ultimately certified by exhibiting such a .

The purpose of this module is to make that certificate machine-checkable. Mathlib — Lean’s mathematics library — has an extensive theory of ordinary differential equations and dynamical systems, but as of this writing it has no Lyapunov-stability layer at all: the classical theorem simply is not there. So this module builds it, stating the theorem in Khalil’s own form and proving it against the flow-and-energy primitives the library already owns.

The objects

We work over a real normed vector space , which the theorems specialize to a finite-dimensional space when the argument needs compactness. The dynamics are carried by a flow — a Mathlib Flow ℝ E, meaning a jointly continuous map with and the group law . We write for the state reached at time from the start . The link to a vector field is the standing hypothesis IsSolutionTo ϕ f: for every start and time , the orbit has derivative . The flow is given to satisfy the differential equation ; we do not construct it.

The energy is a function , assumed differentiable (hVdiff). Two conditions make it a candidate Lyapunov function. It is positive definite: it vanishes at the origin, (hV0), and is strictly positive everywhere else, for (hVpos). And it does not increase along the motion. The rate of change of along the flow is, by the chain rule, the directional derivative of in the direction of the field — written in Lean as fderiv ℝ V y (f y), the Fréchet derivative of at applied to the field vector , and in Khalil’s notation as . The non-increase hypothesis is

Now, what does “stable” mean precisely? The intuition is that staying near the origin is a promise you can keep to any tolerance if you are allowed to start close enough. The formal predicate (LyapStable) makes the two quantifiers explicit: for every tolerance there is a starting radius such that no orbit begun inside the -ball ever leaves the -ball in forward time,

Asymptotic stability (AsympStable) asks for more than confinement — it asks that nearby orbits actually converge to the origin, on top of being stable:

These predicates are new to the library. The only stability notion present before was the set-relative StableSet of the reduction campaign (the Theorem-6 finish), which certifies stability of an entire invariant set and carries the heavier machinery that generality demands. The point-stability predicates here are the lighter, more Khalil-faithful objects, and they do not collide with the set-relative ones.

The origin is Lyapunov stable (lyapunov_stable)

This is Khalil’s Theorem 4.1, stability half — and the analytically hardest result in the module. It says exactly: a positive-definite with forces the origin to be Lyapunov stable.

Strategy

Work backward from the goal. We are handed a tolerance and must manufacture a starting radius . The obstruction to overcome is that an orbit might drift outward to the sphere of radius . We have one lever against drift: never increases along the motion. The plan, then, is to trap the orbit inside a sublevel set of that sits strictly inside the -ball — because an orbit that starts in can never reach a place where , the value being non-increasing.

The technical question is how to choose the threshold . The sphere is where we must not let the orbit go. On that sphere is strictly positive (it is off the origin), and — this is where finite-dimensionality enters — the sphere is compact, so attains a genuine minimum there. Any threshold then does the job: the sublevel set cannot touch the sphere, where . Take . Finally, because is continuous and , a whole ball around the origin lies inside — that ball’s radius is our .

The technique is direct construction of , with the confinement itself proved by contradiction: assume the orbit does reach the sphere and derive an impossibility via the intermediate value theorem.

Proof

Assume is finite-dimensional, that solves (), and that is differentiable, positive definite, and non-increasing along as above. We must show LyapStable ϕ.

First dispose of a degenerate case. If the state space is a single point, then every point equals , so always, its norm is for any , and any (the proof takes ) witnesses stability. This is not a mathematical subtlety — it is Lean insisting we handle the trivial vector space, where “the sphere” would be empty and the minimum argument would have nothing to attain. Assume henceforth that is nontrivial.

Fix a tolerance . The sphere is compact, because a closed and bounded set in a finite-dimensional normed space is compact (isCompact_sphere), and it is nonempty precisely because is nontrivial and (NormedSpace.sphere_nonempty). Since is continuous and is compact and nonempty, attains a minimum on at some point (IsCompact.exists_isMinOn). Because lies on the sphere its norm is , so , and positive definiteness gives

Set the threshold at half the sphere-minimum,

Now consider the open set , the intersection of the preimage of under the continuous with the open -ball. The origin belongs to : on the one hand , and on the other . Since is open and contains , it contains an entire ball around ; let be its radius, so that (Metric.isOpen_iff). This is our witness.

It remains to verify confinement. Let satisfy and let be any forward time. Membership gives us two facts to carry forward: and . Along the orbit, define . By the chain rule for the composition of with the orbit map — which is exactly the derivative bookkeeping the LaSalle engine already packages as IsSolutionTo.hasDerivAt_comp — the function is differentiable with by the non-increase hypothesis. A function with non-positive derivative is non-increasing (antitone_of_deriv_nonpos), so is antitone: for all .

Suppose, for contradiction, that the orbit does escape — that . The map is continuous on (the orbit is continuous, and so is the norm). At the left endpoint its value is , and at the right endpoint it is . By the intermediate value theorem (intermediate_value_Icc) there is a time at which the orbit lands exactly on the sphere, , so . Two estimates now collide:

The left inequality holds because minimizes over the sphere and lies on it; the middle inequality is antitonicity of from time to time ; the last is the fact we carried from membership in . But is impossible for . Hence the orbit never reaches the sphere: for every , which is what stability demands.

What this shows

The moral is the whole point of the direct method, made concrete: a single pointwise inequality on replaces knowledge of every trajectory. We never solved ; we only ever used that decreases along it, together with two facts about the geometry of (it is positive on the sphere and continuous at the origin). Notice which hypothesis did which job — compactness of the sphere bought the strictly positive minimum , continuity of bought the ball , and the non-increase of bought the confinement. Remove any one and the argument collapses, which is exactly why each appears in the statement.

Strict decrease gives asymptotic stability (lyapunov_asymptotically_stable)

Khalil’s Theorem 4.1 continues: “Moreover, if in , then the origin is asymptotically stable.” Confinement is no longer the whole story — we now want nearby orbits to return to the origin.

Strategy

Stability itself is free: strict decrease off the origin certainly implies the non-strict decrease everywhere that the previous theorem needs (at the origin, makes ). So the real work is attraction, and here the tool is not a new hand-built argument but LaSalle’s invariance principle, already proved in this library.

The idea: near the origin, stability traps the forward orbit inside a bounded ball, and in finite dimensions a bounded forward orbit has compact closure — it is forward-precompact. LaSalle’s principle then says the orbit converges to the largest invariant set on which ; more precisely, its $\omega$-limit set is nonempty, invariant, and sits inside . But strict decrease means is zero only at the origin. So the -limit set can only be , and an orbit whose -limit set is converges to .

The technique is construction (produce the attraction radius ) resting on LaSalle as a black box.

Proof

Add to the previous hypotheses that (hf0) and that the decrease is strict off the origin, for (hdecStrict).

We first recover the non-strict decrease needed to invoke the stability theorem. For strict decrease gives , hence ; and at , since , the directional derivative . So for every (hdec), and lyapunov_stable delivers Lyapunov stability. It remains to produce a radius of attraction.

Apply stability at tolerance to obtain a radius such that every orbit starting inside stays inside the unit ball for all forward time. We claim this same is a radius of attraction. Fix with . The forward orbit lies inside , hence is bounded (Metric.isBounded_ball), and a bounded set in a finite-dimensional space has compact closure, so the orbit is forward-precompact (forwardPrecompact_of_isBounded).

Now feed this to LaSalle (lasalle): with solving , differentiable and non-increasing, and the forward orbit of precompact, the principle returns an -limit set that is nonempty and invariant, on which is constant, and — the piece we use — on which the derivative vanishes, for every . We show . Let and suppose . Then LaSalle gives , while strict decrease gives — a contradiction. So every point of is the origin.

Finally, an orbit whose -limit set is contained in converges to . Concretely, fix ; since and the ball is open, the library lemma eventually_mem_of_omegaLimit_subset says the orbit is eventually inside — there is a time beyond which . As was arbitrary, as . Together with the stability already established, this is AsympStable ϕ.

What this shows

Strict decrease converts a confinement certificate into a convergence one, and it does so through a clean division of labor: the stability half traps the orbit so that compactness is available, and LaSalle then squeezes the trapped orbit onto the zero-set of , which strictness has pinched down to the origin alone. This is also the first place the module reuses rather than builds — the entire attraction argument is LaSalle plus one contradiction, a reminder that the invariance principle is precisely the machine for turning ” with equality only at the target” into asymptotic convergence.

Radial unboundedness makes every sublevel set bounded (sublevel_isBounded_of_tendsto_cobounded)

Before the global theorem we isolate one small, purely topological fact — the technical heart of what “radially unbounded” buys. It is stated for a general normed space (finite-dimensionality is not needed here).

Statement. If as , then for every level the sublevel set is bounded.

The phrase ” as ” is rendered in Mathlib’s filter language as Tendsto V (Bornology.cobounded E) atTop: along the cobounded filter — the filter of complements of bounded sets, i.e. “as escapes to infinity” — the value tends to .

Proof. The claim is the contrapositive of the definition of that limit, unwound. Because tends to along the cobounded filter, for the threshold the value eventually exceeds it: the set belongs to the cobounded filter (hV.eventually applied to eventually_gt_atTop). Now observe that this set is exactly the complement of the sublevel set,

A set whose complement is a member of the cobounded filter is, by the very definition of “cobounded,” bounded. Hence is bounded.

What this shows. Radial unboundedness is precisely the hypothesis that turns “low energy” into “bounded position.” Its role in the global theorem is to supply, for any start , a bounded region — the sublevel set at level — that the orbit can never leave, exactly as the unit ball did locally in the previous proof.

Global asymptotic stability — the Barbashin–Krasovskii theorem (lyapunov_globally_asymptotically_stable)

Khalil’s Theorem 4.2 removes the word “near.” With radial unboundedness added, every orbit — no matter how far from the origin it starts — converges to it, and the origin is Lyapunov stable. This is the theorem of Barbashin and Krasovskii.

Strategy

The local proof attracted only orbits starting inside a radius , and the reason was purely that we needed a bounded region to get compactness. Radial unboundedness removes that restriction wholesale: the sublevel set is bounded for any (the lemma just proved), and the orbit of can never leave it because is non-increasing along the motion. So the same LaSalle endgame that handled near-origin orbits now runs verbatim from an arbitrary start. Stability is unchanged from the local theorem.

Proof

Assume, in addition to positive definiteness and strict decrease off the origin, that is radially unbounded (hRadUnbdd: along the cobounded filter). As before, strict decrease plus yields the non-strict everywhere, so lyapunov_stable gives Lyapunov stability. Fix an arbitrary start ; we show .

Along the orbit set . Exactly as in the first proof, the chain rule and the non-increase hypothesis make antitone, so for every . Therefore the entire forward orbit lies in the sublevel set , which the preceding lemma shows is bounded (radial unboundedness at level ). A bounded forward orbit in finite dimensions is forward-precompact (forwardPrecompact_of_isBounded).

From here the argument is identical to the local case. LaSalle (lasalle) returns a nonempty invariant -limit set on which ; strict decrease off the origin forces , since a nonzero point of the -limit set would have both (LaSalle) and (strictness). Finally, for each the containment and eventually_mem_of_omegaLimit_subset place the orbit eventually inside , so . Since was arbitrary, every orbit converges to the origin.

What this shows

The single hypothesis of radial unboundedness is what separates local from global. Its entire contribution is the bounded sublevel set of the small lemma above — replace the local unit-ball trap with a sublevel-set trap that exists at every energy level, and the local proof becomes global without a new idea. This is the globally asymptotically stable certificate the cascade lemmas downstream ultimately want: a Lyapunov function that is positive definite, radially unbounded, and strictly decreasing pins the whole state space onto the origin.

Assumptions taken as given

Every theorem in this module carries one named hypothesis: IsSolutionTo ϕ f, the statement that the flow exists and solves orbitwise. Assuming it is honest for two reasons. First, it is exactly where the direct method’s power lies — Lyapunov’s argument never constructs solutions, it only reasons about whatever solutions there are, so the flow’s existence is genuinely an input, not a gap in the proof. Second, it is the library’s standing modeling premise, shared with the LaSalle module and the entire reduction campaign, recorded once in the assumptions ledger; discharging it (packaging Picard–Lindelöf into a Mathlib flow) is its own open task on that ledger, not a debt of this module.

Scope and limitations

What is proved here is the direct method for an autonomous flow on a finite-dimensional space, with the equilibrium at the origin and the domain global (). Several deliberate boundaries are worth stating plainly, so a reader knows exactly what the kernel did and did not verify.

  • The flow is taken as given — the named hypothesis above; no existence-and-uniqueness theory (Picard–Lindelöf, completeness of the field, forward versus two-sided time) is developed.
  • Autonomous only. The field and the energy do not depend on time. Khalil’s time-varying Theorems 4.8–4.9, with a Lyapunov function sandwiched between class- bounds, need machinery for time-varying flows that the library does not yet have; the autonomous sandwich core is captured separately in the comparison layer.
  • Finite-dimensional. Compactness of spheres and sublevel sets — the source of the attained minimum and of forward-precompactness — is used throughout and holds because closed bounded sets are compact in finite dimensions. The results are stated for that setting.
  • No convergence rate. These theorems certify convergence, not its speed. A class- decay estimate is a strictly stronger statement, requiring the comparison-function solution and left out here by design.

Provenance

The theorems and their proofs follow Khalil, Nonlinear Systems, 3rd edition (2002), khalil2002nonlinear:

  • Theorem 4.1 — Lyapunov stability, with the asymptotic strengthening under strict decrease — is the source of lyapunov_stable and lyapunov_asymptotically_stable. The proof given here is Khalil’s own sublevel-set trapping argument, with the sphere-minimum , the threshold , and the intermediate-value crossing onto the sphere.
  • Theorem 4.2 — global asymptotic stability under radial unboundedness — is the source of lyapunov_globally_asymptotically_stable. Khalil attributes this result to Barbashin and Krasovskii; the mechanism is that radial unboundedness makes sublevel sets bounded, which sublevel_isBounded_of_tendsto_cobounded isolates.

The attraction half of both asymptotic theorems is carried by LaSalle’s invariance principle as formalized in this library’s LaSalle module, which supplies the nonempty invariant -limit set inside and the “-limit in every ball” translation to convergence. Mathlib was verified to contain no Lyapunov-stability layer at the time of writing, which is why the theorem is built here rather than imported.

Machine verification (#print axioms)

Lean’s kernel checks each theorem against the standard foundational axioms; the #print axioms command reports the complete list every declaration transitively depends on. For all four public results the list is the standard trio and nothing more — propext (propositional extensionality), Classical.choice (the axiom of choice), and Quot.sound (soundness of quotients) — with no sorryAx, so nothing is left unproved. The output, verbatim from the build:

Ctrllib/KhalilStability.lean:237:0: 'Ctrllib.lyapunov_stable' depends on axioms: [propext, Classical.choice, Quot.sound]
Ctrllib/KhalilStability.lean:238:0: 'Ctrllib.lyapunov_asymptotically_stable' depends on axioms: [propext, Classical.choice, Quot.sound]
Ctrllib/KhalilStability.lean:239:0: 'Ctrllib.sublevel_isBounded_of_tendsto_cobounded' depends on axioms: [propext, Classical.choice, Quot.sound]
Ctrllib/KhalilStability.lean:240:0: 'Ctrllib.lyapunov_globally_asymptotically_stable' depends on axioms: [propext, Classical.choice, Quot.sound]

The tracked source is [(~/Code/vault/lean/KhalilStability.lean)], mirrored byte-for-byte to the lake build copy at ~/lean/ctrllib/Ctrllib/KhalilStability.lean.