TorchLean API

NN.MLTheory.CROWN.BoundOps.Lawful

What directed endpoint arithmetic is supposed to mean #

NN.MLTheory.CROWN.BoundOps says what a scalar backend must compute; this file says what those computations mean, by interpreting an endpoint as a real number and comparing each directed operation with exact real arithmetic. The enclosure predicates and the two Lawful classes are the form in which CROWN theorems ask for that guarantee, and itself is the instance where the guarantee is trivial because no rounding happens.

Naming alongside Real.exp, Real.log, and Real.sqrt costs roughly 1700 mathlib modules, so the split is deliberate: certificate replay, the graph checker, and the trainer only ever run the executable interface and stop at BoundOps, while the soundness proofs continue on to this file.

Real-semantic enclosure laws for BoundOps.

The executable interface above is intentionally available without this class: a backend may be useful for diagnostics before its arithmetic has been connected to a proof. Sound CROWN theorems require LawfulBoundOps in addition to BoundOps. The interpretation toReal says what a scalar endpoint means mathematically, and the laws compare each directed operation with exact arithmetic on those real values. This is stronger than merely surrounding the backend's ordinary rounded operation.

There is a global instance for . There is deliberately no global instance for Lean Float or for all ExecFloat.Binary 8 23 bit patterns. Host Float is a trusted runtime boundary, while IEEE-754 NaNs, infinities, and overflow require finite-path hypotheses; those facts are stated at the IEEE semantics layer rather than hidden in an invalid ordered-ring instance.

Instances
    def NN.MLTheory.CROWN.UnaryEnclosure {α : Type} [TorchLean.Storage α] [Context α] [BoundOps α] [LawfulBoundOps α] (f : ) (transfer : ααOption (α × α)) :

    Soundness predicate for a unary interval transfer.

    Returning none is always permitted. If the transfer returns endpoints, every real input between the interpreted input endpoints must map between the interpreted output endpoints.

    Instances For
      def NN.MLTheory.CROWN.BinaryEnclosure {α : Type} [TorchLean.Storage α] [Context α] [BoundOps α] [LawfulBoundOps α] (f : ) (transfer : ααααOption (α × α)) :

      Soundness predicate for a binary interval transfer.

      Instances For

        Real-semantic enclosure laws for NonlinearBoundOps.

        This class is deliberately separate from the executable transfer table. A backend may implement a transfer for testing before proving it; sound verification entrypoints can require this class and therefore cannot silently promote an unchecked implementation into a theorem.

        Instances

          Exact real arithmetic needs no rounding, so its lower and upper operations coincide.

          @[instance_reducible]
          @[instance_reducible]

          Exact real endpoint arithmetic satisfies the directed-operation enclosure laws.

          @[instance_reducible]

          Exact nonlinear interval transfers over the real numbers.