TorchLean API

FloatLib.Floats.ExecFloat.Backends.Generic.Sqrt.Runtime

Executable compact finite square root #

The compiled path consumes the sign, significand, and exponent from FiniteKernel.Components, avoiding a second storage decode. Conventional IEEE descriptors use the unpacked-model kernel; other descriptors use an arbitrary-precision integer square root. Correctness proofs live in Sqrt.Proof.

@[inline]

Destination dyadic exponent for the rounded square root of a positive exact dyadic.

Instances For
    @[inline]

    Round an integer square-root approximation after discarding shift low root bits.

    remainder records the positive irrational tail: zero means the scaled radicand was a perfect square. At an exact half-way discarded-bit pattern, any nonzero square-root remainder moves the exact result above the tie.

    Instances For
      @[inline]

      Descriptor-aware positive square root for formats not represented by Lean's conventional IEEE model.

      The radicand and root use natural-number arithmetic; exponents use Int. IntegerSquareRoot.sqrtNat uses the proved UInt64 kernel when the scaled radicand fits and Nat.sqrt for larger inputs.

      Instances For
        @[inline]

        Positive finite square root from an exact dyadic.

        The IEEE branch deliberately retains the established logical model and native replacement theorem. The non-IEEE branch follows the complete descriptor and never converts through Float.Model.

        Instances For
          @[inline]

          Square root of already-decoded positive finite components.

          Instances For
            @[inline]

            Square root of a positive finite nonzero value from compact decoded fields.

            none means that the input is exceptional, negative, or zero.

            Instances For
              @[inline]

              Square root directly from scalar finite fields.

              Instances For
                @[inline]

                Compiled positive square root with scalar field decoding.

                Instances For
                  @[inline]

                  Square root of a value already classified as positive, finite, and nonzero.

                  The evidence is erased. IEEE descriptors decode the storage word once; other descriptors use their policy-aware fields. Both paths call sqrtPositiveDyadic, which selects the conventional IEEE model or the descriptor-aware integer square-root kernel.

                  Instances For