TorchLean API

NN.Core.Numeric

Foundational Numeric Interfaces #

This module contains the small scalar interfaces shared by TorchLean's floating-point library and its tensor specifications. It deliberately knows nothing about tensors, models, runtimes, or verification.

MathFunctions names the transcendental operations used by numerical code. Numbers collects the few non-integral constants needed by scalar-polymorphic model definitions. The broader neural-model interface, Context, lives in NN.Spec.Core.Context and extends these foundations.

class MathFunctions (α : Type) :

Scalar transcendental functions shared by numerical and model code.

  • exp : αα
  • tanh : αα
  • cosh : αα
  • sqrt : αα
  • abs : αα
  • log : αα
  • pi : α
  • cos : αα
  • sin : αα
  • sinh : αα
Instances
    class Numbers (α : Type) :

    Common scalar constants used by scalar-polymorphic model definitions.

    • neg_point_five : α

      Backend representation of -0.5.

    • neg_one : α

      Backend representation of -1.

    • pointone : α

      Backend representation of 0.1.

    • pointfive : α

      Backend representation of 0.5.

    • one : α
    • zero : α
    • two : α

      Backend representation of 2.

    • three : α

      Backend representation of 3.

    • four : α

      Backend representation of 4.

    • five : α

      Backend representation of 5.

    • ten : α

      Backend representation of 10.

    • log10 : α

      Backend representation of the natural logarithm of 10.

    • log10000 : α

      Backend representation of the natural logarithm of 10000.

    • epsilon : α

      Backend-supplied tolerance for numerically guarded formulas.

    Instances
      @[implicit_reducible]

      Host implementations of the scalar transcendental interface.

      @[implicit_reducible]
      noncomputable instance instMathFunctionsReal :

      Exact-real interpretations of the scalar transcendental interface.

      @[implicit_reducible]

      Constants for Lean's host Float.

      @[implicit_reducible]
      noncomputable instance instNumbersReal :

      Constants for exact-real specifications.

      @[implicit_reducible]

      Coerce naturals into Lean's host Float.

      @[implicit_reducible]

      Coerce naturals into .

      @[implicit_reducible]

      Coerce naturals into .