TorchLean API

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

Shared proofs for native normal operand pairs #

Several one-word kernels begin with the same operation: reject zero, subnormal, and exceptional operands, then expose two normalized significands and their biased exponents. The executable decoder remains in Small.Core.Runtime; this module proves its common contract once.

View records the exact generic decoder results together with the bounds needed by fixed-word rounders. Multiplication and division can therefore focus on their different arithmetic without repeating storage-field and exceptional-value arguments. No executable definition depends on this proof layer.

Proof-facing view 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 : BoolUInt64UInt64UInt64UInt64Option α) (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

    Extract the shared proof view from a successful native normal-pair callback.

    The callback itself remains fully generic. Its caller receives the exact fields passed at runtime, their normalized bounds, and decoder equalities suitable for any binary operation.

    theorem FloatLib.Floats.Formats.BinaryInterchange.Model.NativeNormalPair.mul_refines {fmt : FloatFormat} (hieee : fmt.isIEEE = true) (hwidth : fmt.bitWidth 64) (kernel : BoolUInt64UInt64UInt64UInt64Option (Model fmt)) (kernel_refines : ∀ (sign : Bool) (xExponent yExponent xMantissa yMantissa : UInt64) (result : Model fmt), 0 < xExponent.toNat xExponent.toNat < 2 ^ fmt.expWidth0 < yExponent.toNat yExponent.toNat < 2 ^ fmt.expWidth2 ^ 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 resultresult = 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) :

    Lift a certified normal-product callback to the generic finite multiplication kernel.

    The shared view handles native decoding. The callback hypothesis is responsible only for the product representation and its final rounding.