TorchLean API

FloatLib.Floats.ExecFloat.Backends.Word.NormalPair.Proof

Shared proofs for native normal operand pairs #

Several one-word kernels start the same way: they reject zero, subnormal and exceptional operands, then expose two normalized significands and their biased exponents. Small.Core.Runtime has the executable decoder, and this module proves its common contract once.

View records the generic decoder results together with the bounds the fixed-word rounders need, so the multiplication and division proofs don't repeat the storage-field and exceptional-value arguments. No executable definition depends on this module.

Fields and decoder facts of two successfully decoded normal operands.

Instances For
    theorem FloatLib.Floats.Formats.BinaryInterchange.Model.NativeNormalPair.view_of_success {fmt : FloatFormat} {α : Type} (hieee : fmt.isIEEE = true) (hwidth : fmt.bitWidth ≤ 64) (x y : Model fmt) (kernel : Bool → UInt64 → UInt64 → UInt64 → UInt64 → Option α) (result : α) (hresult : NativeSmallWord.withNormalPair? x y kernel = some result) :
    ∃ (view : View x y), kernel view.sign view.xExponent view.yExponent view.xMantissa view.yMantissa = some result

    A successful withNormalPair? call yields a View whose fields are the ones passed to the kernel.

    Since the kernel stays generic, the view serves any binary operation.

    theorem FloatLib.Floats.Formats.BinaryInterchange.Model.NativeNormalPair.mul_refines {fmt : FloatFormat} (hieee : fmt.isIEEE = true) (hwidth : fmt.bitWidth ≤ 64) (kernel : Bool → UInt64 → UInt64 → UInt64 → UInt64 → Option (Model fmt)) (kernel_refines : ∀ (sign : Bool) (xExponent yExponent xMantissa yMantissa : UInt64) (result : Model fmt), 0 < xExponent.toNat ∧ xExponent.toNat < 2 ^ fmt.expWidth → 0 < yExponent.toNat ∧ yExponent.toNat < 2 ^ fmt.expWidth → 2 ^ fmt.fracWidth ≤ xMantissa.toNat ∧ xMantissa.toNat < 2 ^ (fmt.fracWidth + 1) → 2 ^ fmt.fracWidth ≤ yMantissa.toNat ∧ yMantissa.toNat < 2 ^ (fmt.fracWidth + 1) → kernel sign xExponent yExponent xMantissa yMantissa = some result → result = FiniteProductRound.round fmt sign (xMantissa.toNat * yMantissa.toNat) (xExponent.toNat - 1 + (yExponent.toNat - 1))) (x y result : Model fmt) (hresult : NativeSmallWord.withNormalPair? x y kernel = some result) :

    A normal-pair kernel that rounds like FiniteProductRound.round refines FiniteKernel.mul?.

    Because the shared view handles the native decoding, kernel_refines only covers the product and its rounding.