TorchLean API

FloatLib.Numerics.Enclosure.Expression.Basic

Interval expressions and endpoint backends #

An expression records the numerical operations independently of its endpoint representation. Backend supplies executable enclosures; its real-containment contract is stated in Real. The same expression can therefore run with exact rational endpoints, an integer binary grid, or a format-specific outward rounder.

Evaluation returns none when an input is missing or a backend cannot enclose an operation. In particular, a backend may reject division across zero or an interval outside a function's domain. Success is related to real evaluation by Expr.containsReal_eval?.

Accuracy controls shared by built-in operations and user enclosures.

  • precision : ℕ

    Fractional endpoint bits, also used for square-root approximations.

  • degree : ℕ

    Approximation degree for elementary functions.

Instances For

    An executable rational enclosure for an operation with a fixed number of real arguments. Constants have arity zero. Extension.Sound supplies its separate containment contract.

    Instances For

      Adapt a constant enclosure to the common argument-list interface.

      Instances For

        Adapt a unary enclosure to the common argument-list interface.

        Instances For

          Adapt a binary enclosure to the common argument-list interface.

          Instances For

            Unary operations supported by the common interval expression language.

            Instances For

              Binary operations supported by the common interval expression language.

              Instances For

                Three-input operations supported by the common interval expression language.

                Instances For

                  A real expression with rational constants, numbered variables, and registered calls.

                  Instances For

                    Structural Boolean comparison, including registered argument lists.

                    Instances For

                      Structural comparison of the argument lists of registered calls.

                      Instances For

                        Boolean expression comparison is exact.

                        @[instance_reducible]

                        Build an addition expression; evaluation uses the selected backend.

                        @[instance_reducible]

                        Build a multiplication expression; evaluation uses the selected backend.

                        structure FloatLib.Numerics.Interval.Backend (α : Type u_1) :
                        Type u_1

                        Executable interval operations for an endpoint representation.

                        The decoder identifies the exact rational value of each usable endpoint. Operations may work directly on the representation without decoding intermediate results. Backend.Sound is the separate proof contract required to use an evaluation in a theorem.

                        Instances For
                          def FloatLib.Numerics.Interval.Expr.eval? {α : Type u_1} (e : Expr) (B : Backend α) (env : ℕ → Option (Interval α)) :

                          Evaluate an expression with the selected backend and variable intervals.

                          The environment may be partial. Missing variables and failed operations propagate as none; no default numerical value is substituted.

                          Instances For
                            def FloatLib.Numerics.Interval.Expr.evalArgs? {α : Type u_1} (args : List Expr) (B : Backend α) (env : ℕ → Option (Interval α)) :

                            Evaluate all arguments of a registered call, preserving failure and argument order.

                            Instances For