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.

The real-analysis dependencies belong to the soundness proofs. Certificate replay, the graph checker, and the trainer use the executable BoundOps interface without importing this file.

Real-semantic enclosure laws for BoundOps.

The executable interface BoundOps 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

    The backend minimum denotes the real minimum.

    This supplements LawfulBoundOps for transfers that use the context's min operation. The comparison-based BoundOps.min2 needs no additional law. Ordinary negation and absolute value may round on a backend, so their exactness is deliberately not assumed here.

    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.

            The exact real backend preserves minimum.

            Over ℝ, the comparison-based BoundOps.min2 is min.

            Over ℝ, the comparison-based BoundOps.max2 is max.

            @[instance_reducible]

            Exact nonlinear interval transfers over the real numbers.