TorchLean API

NN.Verification.Monotonicity

Exact monotonicity certificates #

A certificate records linear and ReLU modules using exact rational parameters. Its interpretation uses the existing Spec.Module.Chain semantics over the reals. Checking nonnegative weights is a sufficient, incomplete test for global componentwise monotonicity. Biases are unrestricted.

This checks a universal real-valued hyperproperty, not a floating-point deployment guarantee or a CROWN certificate. It does not enumerate activation regions.

Componentwise order preservation for a tensor map.

Instances For

    Serializable evidence for a composition of existing linear and ReLU modules.

    Instances For

      Interpret exact rational layer parameters as real numbers.

      Instances For

        The certificate's model is an ordinary TorchLean mathematical module chain.

        Instances For

          Execute the same recorded linear/ReLU model using exact rational arithmetic.

          Instances For

            Exact executable nonnegativity check for a weight matrix.

            Instances For

              Accept only certificates whose linear modules have nonnegative weights.

              Instances For
                theorem NN.Verification.Monotonicity.checkWeights_sound {n m : } {weights : TorchLean.Tensor [m, n]} (h : checkWeights weights = true) (i : Fin m) (j : Fin n) :
                0 Spec.get2 (TorchLean.Tensor.map (fun (q : ) => q) weights) i j

                A successful exact weight check supplies nonnegativity over the real interpretation.

                theorem NN.Verification.Monotonicity.linear_preserves_order {α : Type} [TorchLean.Storage α] [CommRing α] [LinearOrder α] [IsStrictOrderedRing α] {n m : } (layer : Spec.LinearSpec α n m) (hw : ∀ (i : Fin m) (j : Fin n), 0 Spec.get2 layer.weights i j) :

                A linear module with nonnegative weights preserves componentwise real order.

                ReLU preserves componentwise order at every tensor rank.

                Acceptance proves global monotonicity of the recorded TorchLean model over real inputs.

                Acceptance also proves order preservation for the exact rational execution semantics.