TorchLean API

NN.MLTheory.LearningTheory.Stability.Dynamics.Spec

NN.MLTheory.Stability.Spec #

Scalar-polymorphic stability definitions for discrete-time dynamical systems $x_{t+1}=f(x_t)$ over shape-indexed tensors.

Stability specifications (discrete-time dynamical systems) #

This module defines standard stability notions for iterated maps f : Tensor α s → Tensor α s, phrased over TorchLean's shape-indexed tensors:

The definitions are polymorphic in the scalar type α via [TorchLean.Storage α] [Context α]; for noncomputable quantities (e.g. the supremum defining a stability margin on ), we expose the notion via a type class StabilityMarginComputable. TorchLean installs the real supremum instance globally and keeps the conservative 0 lower-bound instance behind an explicit opt-in scope for examples and tests.

References #

These are standard definitions in control theory / dynamical systems. Useful entry points include:

@[reducible, inline]

Iterate f for $n$ steps: $\operatorname{iterate}(f,n,x)=f^{[n]}(x)$.

Instances For

    An interface for a scalar stability-margin calculation. The instance takes the supremum of nonnegative forward-invariant closed-ball radii. It is not necessarily an attained largest radius; the real supremum requires a nonempty, bounded-above radius set for its usual interpretation. The class itself contains no correctness law for other instances.

    TorchLean only installs a real supremum-based instance globally for . Other scalar backends can opt into the conservative lower-bound instance below explicitly; this avoids silently reporting 0 as a semantic stability margin for arbitrary scalar types.

    Instances

      Named opt-in scope for the conservative stability-margin lower bound.

      Use open scoped NN.MLTheory.Stability.Spec.StabilityMarginComputable.ConservativeMargin only in examples/tests that deliberately want a total fallback. Production theorem statements should either use the instance or require an explicit StabilityMarginComputable α hypothesis.

      def NN.MLTheory.Stability.Spec.IsLyapunovStable {α : Type} [TorchLean.Storage α] [Context α] {s : Spec.Shape} (f : TorchLean.Tensor α sTorchLean.Tensor α s) (norm : {s : Spec.Shape} → TorchLean.Tensor α sα) (equilibrium : TorchLean.Tensor α s) :

      Lyapunov stability of equilibrium for the discrete-time system $x_{t+1}=f(x_t)$.

      This is the usual $\varepsilon$/$\delta$ definition using the distance induced by norm.

      Instances For
        def NN.MLTheory.Stability.Spec.IsAsymptoticallyStable {α : Type} [TorchLean.Storage α] [Context α] {s : Spec.Shape} (f : TorchLean.Tensor α sTorchLean.Tensor α s) (norm : {s : Spec.Shape} → TorchLean.Tensor α sα) (equilibrium : TorchLean.Tensor α s) :

        Asymptotic stability: Lyapunov stability plus convergence to equilibrium for nearby initial conditions.

        Instances For
          def NN.MLTheory.Stability.Spec.IsExponentiallyStable {α : Type} [TorchLean.Storage α] [Context α] {s : Spec.Shape} (f : TorchLean.Tensor α sTorchLean.Tensor α s) (norm : {s : Spec.Shape} → TorchLean.Tensor α sα) (equilibrium : TorchLean.Tensor α s) (decayRate M : α) :

          Exponential stability with decay parameters decayRate and M.

          Over real scalars with the usual norm and exponential laws, this expresses quantitative decay. The generic predicate alone does not supply those laws.

          Instances For
            def NN.MLTheory.Stability.Spec.IsGloballyStable {α : Type} [TorchLean.Storage α] [Context α] {s : Spec.Shape} (f : TorchLean.Tensor α sTorchLean.Tensor α s) (norm : {s : Spec.Shape} → TorchLean.Tensor α sα) (equilibrium : TorchLean.Tensor α s) :

            Global attraction: every initial condition converges to equilibrium.

            The established name IsGloballyStable denotes convergence only; it does not also require the Lyapunov-stability predicate.

            This is stated as convergence in the distance induced by norm.

            Instances For
              def NN.MLTheory.Stability.Spec.IsInputToStateStable {α : Type} [TorchLean.Storage α] [Context α] {s₁ s₂ : Spec.Shape} (f : TorchLean.Tensor α s₁TorchLean.Tensor α s₂TorchLean.Tensor α s₁) (norm : {s : Spec.Shape} → TorchLean.Tensor α sα) (β : ααα) (γ : αα) :

              Input-to-state stability (ISS) for an input-driven system $x_{t+1}=f(x_t,u_t)$.

              This is the standard bound

              $$ \lVert x_t\rVert \leq \beta(\lVert x_0\rVert,t) +\gamma\!\left(\max_{k<t}\lVert u_k\rVert\right) $$

              packaged as a Prop. The maximum includes an initial zero and inputs at indices k < t, which are the inputs used to reach state t. This predicate does not require the usual class-KL conditions on β or class-K conditions on γ; those must be supplied separately for standard ISS.

              Instances For
                Instances For
                  def NN.MLTheory.Stability.Spec.IsInputToStateStable.supNormOverTime {α : Type} [TorchLean.Storage α] [Context α] {s₂ : Spec.Shape} (norm : {s : Spec.Shape} → TorchLean.Tensor α sα) (inputSeq : TorchLean.Tensor α s₂) (t : ) :
                  α
                  Instances For
                    def NN.MLTheory.Stability.Spec.IsBiboStable {α : Type} [TorchLean.Storage α] [Context α] {s₁ s₂ : Spec.Shape} (f : TorchLean.Tensor α s₁TorchLean.Tensor α s₂) (norm₁ norm₂ : {s : Spec.Shape} → TorchLean.Tensor α sα) (bound : α) :

                    A fixed-bound input/output implication: inputs of norm at most bound have outputs of norm at most the same bound. This is not the general BIBO quantification over input and output bounds.

                    Instances For
                      def NN.MLTheory.Stability.Spec.IsIncrementallyStable {α : Type} [TorchLean.Storage α] [Context α] {s : Spec.Shape} (f : TorchLean.Tensor α sTorchLean.Tensor α s) (norm : {s : Spec.Shape} → TorchLean.Tensor α sα) (contractionFactor : α) :

                      Incremental stability: distances between trajectories contract by contractionFactor.

                      This is a discrete-time contraction condition phrased using tensorDistance.

                      Instances For

                        Return the configured stability-margin value. The real instance uses a supremum, which need not be attained and requires boundedness for its usual interpretation; custom instances have no correctness law in this interface.

                        Instances For
                          def NN.MLTheory.Stability.Spec.IsFiniteTimeStable {α : Type} [TorchLean.Storage α] {s : Spec.Shape} (f : TorchLean.Tensor α sTorchLean.Tensor α s) (_norm : {s : Spec.Shape} → TorchLean.Tensor α sα) (equilibrium : TorchLean.Tensor α s) (settlingTimeSteps : ) :

                          Finite-time stability: trajectories reach equilibrium exactly within a fixed step budget.

                          Instances For
                            def NN.MLTheory.Stability.Spec.IsPracticallyStable {α : Type} [TorchLean.Storage α] [Context α] {s : Spec.Shape} (f : TorchLean.Tensor α sTorchLean.Tensor α s) (norm : {s : Spec.Shape} → TorchLean.Tensor α sα) (equilibrium : TorchLean.Tensor α s) (ultimateBound : α) :

                            Practical stability: trajectories eventually enter and remain in a fixed ultimateBound ball.

                            Instances For
                              def NN.MLTheory.Stability.Spec.IsTrainingStable {α : Type} [TorchLean.Storage α] [Context α] {s : Spec.Shape} (updateRule : TorchLean.Tensor α sTorchLean.Tensor α s) (loss : TorchLean.Tensor α sα) (parameters : TorchLean.Tensor α s) :

                              One-step monotonicity of a training loss under an update rule.

                              This is the “training stability” predicate used as a spec for decreasing-loss update rules.

                              Instances For
                                def NN.MLTheory.Stability.Spec.IsGeneralizationStable {α : Type} [TorchLean.Storage α] [Context α] {s₁ s₂ : Spec.Shape} (trainingAlgorithm : Array (TorchLean.Tensor α s₁ × TorchLean.Tensor α s₂)TorchLean.Tensor α s₁TorchLean.Tensor α s₂) (norm₁ norm₂ : {s : Spec.Shape} → TorchLean.Tensor α sα) (stabilityConstant : α) :

                                Generalization stability of a learning algorithm: small dataset changes produce small prediction changes.

                                This is a generic stability-style specification; concrete instances typically choose a specific dataset metric and output norm.

                                Instances For
                                  def NN.MLTheory.Stability.Spec.IsGeneralizationStable.datasetDistance {α : Type} [TorchLean.Storage α] [Context α] {s₁ s₂ : Spec.Shape} (norm₁ norm₂ : {s : Spec.Shape} → TorchLean.Tensor α sα) (d₁ d₂ : Array (TorchLean.Tensor α s₁ × TorchLean.Tensor α s₂)) :
                                  α
                                  Instances For