TorchLean API

NN.MLTheory.LearningTheory.Stability.Dynamics.Runtime

NN.MLTheory.Stability.Runtime #

Executable Float-specialized diagnostics for the stability specifications in Spec.Dynamics (NN.Spec.Dynamics.System).

Stability runtime utilities (Float) #

This module provides executable, Float-specialized helpers for exploring stability properties of discrete-time systems ($x_{t+1}=f(x_t)$).

All routines in this file are runtime diagnostics:

They are factually correct as computations: “this inequality held on these sampled points for this many steps.” The corresponding theorem statements live in the Prop definitions in Spec.Dynamics.

In other words:

Apply steps transitions of a discrete-time system $x_{t+1}=f(x_t)$, starting at $x_0$.

The returned array has steps + 1 states, including the initial state $x_0$.

Instances For

    Empirical Lyapunov stability test:

    For each initial point x₀ in initialPoints, generate maxIterations + 1 states and check that every state stays within tolerance (in L2 distance) of equilibrium.

    This is a bounded-time and finite-set check; it does not certify Lyapunov stability.

    Instances For
      def NN.MLTheory.Stability.Runtime.testAsymptoticStability {s : Spec.Shape} (f : TorchLean.Tensor Float s → TorchLean.Tensor Float s) (equilibrium : TorchLean.Tensor Float s) (initialPoints : Array (TorchLean.Tensor Float s)) (maxIterations : ℕ) (convergenceThreshold : Float) :

      Empirical asymptotic stability test (finite-horizon):

      For each x₀ in initialPoints, simulate maxIterations steps and check that the final state is within convergenceThreshold of equilibrium (in L2 distance).

      This is a very coarse check: it only inspects the last iterate and does not quantify a rate.

      Instances For

        Empirical contractivity test on a finite list of input pairs.

        Checks the inequality

        $$ \frac{\lVert f(x)-f(y)\rVert_2}{\lVert x-y\rVert_2} \leq \mathrm{expected\_contraction\_factor} $$

        for each pair (x,y). Zero-distance pairs are ignored, but at least one positive-distance pair is required.

        Instances For
          def NN.MLTheory.Stability.Runtime.testBiboStability {s₁ s₂ : Spec.Shape} (f : TorchLean.Tensor Float s₁ → TorchLean.Tensor Float s₂) (testInputs : Array (TorchLean.Tensor Float s₁)) (inputBound outputBound : Float) :

          Empirical BIBO stability test on a finite list of inputs.

          For each test input $x$, if $\lVert x\rVert_2\leq\mathrm{input\_bound}$ then we check $\lVert f(x)\rVert_2\leq\mathrm{output\_bound}$.

          Instances For

            Empirical estimate of a Lyapunov-style stability margin.

            For each candidate radius r, normalize cosine directions and sample inside its L2 ball around equilibrium, then check a bounded-horizon Lyapunov test. If boundary rounding places a point outside the ball, use an interior point on the same ray (or the center if it still rounds outside). The result is some maximum radius when at least one radius passes, and none when valid evidence was collected but every radius failed. Empty or non-finite radius sets are errors.

            Instances For

              Results of a small battery of empirical stability diagnostics.

              Instances For

                Run a small collection of empirical stability diagnostics and summarize the results.

                Instances For