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.
- sign : Bool
XOR of the operand signs, as supplied to multiplicative kernels.
- xExponent : UInt64
Biased exponent of the left operand.
- yExponent : UInt64
Biased exponent of the right operand.
- xMantissa : UInt64
Normalized significand of the left operand.
- yMantissa : UInt64
Normalized significand of the right operand.
The native sign calculation agrees with the model fields.
- xDecode : FiniteKernel.decode? x = some { sign := x.signBit, exponent := self.xExponent.toNat, mantissa := self.xMantissa.toNat }
The generic finite decoder sees the same left operand fields.
- yDecode : FiniteKernel.decode? y = some { sign := y.signBit, exponent := self.yExponent.toNat, mantissa := self.yMantissa.toNat }
The generic finite decoder sees the same right operand fields.
The left biased exponent is a nonzero stored exponent.
The right biased exponent is a nonzero stored exponent.
- xMantissaBounds : 2 ^ fmt.fracWidth ≤ self.xMantissa.toNat ∧ self.xMantissa.toNat < 2 ^ (fmt.fracWidth + 1)
The left significand has its implicit leading bit.
- yMantissaBounds : 2 ^ fmt.fracWidth ≤ self.yMantissa.toNat ∧ self.yMantissa.toNat < 2 ^ (fmt.fracWidth + 1)
The right significand has its implicit leading bit.
Instances For
A native normal field decode agrees with the generic finite decoder.
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.
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.