Documentation

LeanCert.ML.Symbolic.Sigmoid

Verified DeepPoly Sigmoid Relaxation #

This module implements linear relaxations for the sigmoid activation function, enabling Symbolic Interval Propagation for networks using sigmoid/logistic units.

The Sigmoid Function #

σ(x) = 1 / (1 + exp(-x))

Key properties:

Relaxation Strategy #

Unlike ReLU (piecewise linear), sigmoid requires careful handling:

  1. Monotonicity bounds: Since σ is increasing, σ(l) ≤ σ(x) ≤ σ(u) for x ∈ [l, u]

  2. Secant line: The chord from (l, σ(l)) to (u, σ(u))

Main Results #

Real Linear Bounds (for transcendental functions) #

A linear bound with real coefficients: y = slope · x + bias

Instances For

    Evaluate real linear bound at x

    Equations
    Instances For

      Real symbolic bound for transcendental activations

      Instances For

        Sigmoid Definition and Basic Properties #

        noncomputable def LeanCert.ML.Symbolic.sigmoid (x : ) :

        The sigmoid (logistic) function: σ(x) = 1 / (1 + exp(-x))

        Equations
        Instances For

          Sigmoid is always positive

          Sigmoid is always less than 1

          Sigmoid is bounded in (0, 1)

          Sigmoid is bounded in [0, 1]

          Sigmoid at 0 equals 1/2

          1 - σ(x) = σ(-x)

          Monotonicity #

          The denominator 1 + exp(-x) is always positive

          Sigmoid is strictly monotone increasing

          Sigmoid is monotone increasing

          Key monotonicity lemma for relaxation

          Relaxation Bounds #

          Compute sigmoid relaxation using monotonicity bounds.

          For x ∈ [l, u], we use:

          • Lower bound: constant σ(l)
          • Upper bound: constant σ(u)

          This gives tight bounds while being simple to verify.

          Equations
          Instances For

            The constant lower bound is sound

            The constant upper bound is sound

            Main soundness theorem for sigmoid relaxation.

            For any x in [l, u], the sigmoid value is bounded: σ(l) ≤ σ(x) ≤ σ(u)

            Computable Rational Approximations #

            Rational lower bound approximation for sigmoid. These are conservative (provably ≤ actual sigmoid).

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Rational upper bound approximation for sigmoid. These are conservative (provably ≥ actual sigmoid).

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Computable sigmoid relaxation for interval propagation

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Secant Line (for future tighter bounds) #

                  noncomputable def LeanCert.ML.Symbolic.sigmoidSecantEval (l u x : ) :

                  The secant line through (l, σ(l)) and (u, σ(u)). y = σ(l) + λ · (x - l) where λ = (σ(u) - σ(l)) / (u - l)

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    The secant passes through (l, σ(l))

                    The secant passes through (u, σ(u)) when l < u

                    Derivative #

                    The derivative of sigmoid: σ'(x) = σ(x) · (1 - σ(x))

                    This is a key identity. The derivative is always positive and achieves maximum 1/4 at x = 0.

                    The derivative is always in (0, 1/4]

                    Maximum derivative at x = 0: σ'(0) = 1/4