TorchLean API

FloatLib.Numerics.Operation.Proof

Proof-indexed application of numerical operations #

These helpers apply existing executable functions to proof-indexed inputs. Runtime data remains the concrete code returned by those functions; representation proofs are propositions erased by the compiler.

The imports collect total, finite, checked, and quantizer proof helpers. The composition laws below combine refinement facts directly, without wrapping the executable functions. Import a Proof.* submodule when only one proof-indexed contract family is needed.

Composition of executable refinements #

theorem FloatLib.Numerics.Operation.total1_comp {A : NumericalSystem} {B : NumericalSystem} {C : NumericalSystem} {run₁ : A.CodeB.Code} {run₂ : B.CodeC.Code} {spec₁ : NumericalValue A.ScalarNumericalValue B.Scalar} {spec₂ : NumericalValue B.ScalarNumericalValue C.Scalar} (h₁ : Total1 A B run₁ spec₁) (h₂ : Total1 B C run₂ spec₂) :
Total1 A C (run₂ run₁) (spec₂ spec₁)

Total unary refinement is closed under composition.

theorem FloatLib.Numerics.Operation.finite1_comp {A : NumericalSystem} {B : NumericalSystem} {C : NumericalSystem} {run₁ : A.CodeB.Code} {run₂ : B.CodeC.Code} {spec₁ : A.ScalarB.Scalar} {spec₂ : B.ScalarC.Scalar} (h₁ : Finite1 A B run₁ spec₁) (h₂ : Finite1 B C run₂ spec₂) :
Finite1 A C (run₂ run₁) (spec₂ spec₁)

Finite unary refinement is closed under composition.

theorem FloatLib.Numerics.Operation.castFiniteOn_comp {A : NumericalSystem} {B : NumericalSystem} {C : NumericalSystem} {run₁ : A.CodeB.Code} {run₂ : B.CodeC.Code} {embed₁ : A.ScalarB.Scalar} {embed₂ : B.ScalarC.Scalar} {pre₁ : A.ScalarProp} {pre₂ : B.ScalarProp} (h₁ : CastFiniteOn A B run₁ embed₁ pre₁) (h₂ : CastFiniteOn B C run₂ embed₂ pre₂) :
CastFiniteOn A C (run₂ run₁) (embed₂ embed₁) fun (x : A.Scalar) => pre₁ x pre₂ (embed₁ x)

Casts implement the composed scalar maps when the intermediate value meets its precondition.

theorem FloatLib.Numerics.Operation.quantizer_exactOn {S : NumericalSystem} {quantize : S.ScalarS.Code} {round : S.ScalarS.Scalar} {pre fixed : S.ScalarProp} (hrefines : QuantizerOn S quantize round pre) (hfixed : ∀ (x : S.Scalar), fixed xround x = x) (x : S.Scalar) :
pre xfixed xS.Represents (quantize x) x

A refining quantizer is exact wherever its mathematical rounding map fixes the input.