Documentation

CompPoly.Univariate.NTTFast.Correctness.Pipeline

NTTFast multiplication correctness #

Plan-level and one-shot correctness theorems for NTTFast multiplication.

A well-formed plan's forward transform computes the bit-reversed forward NTT.

A plan built from a domain has a correct forward transform.

The paired forward transform equals the pair of individual forward transforms.

The paired forward transform computes the two bit-reversed forward NTT outputs.

Plan normalization agrees with NTT.Inverse.normalize for the same domain.

A well-formed plan's inverse transform computes the inverse NTT spec.

The planned raw multiplication implementation computes the raw NTT multiplication spec.

theorem CompPoly.CPolynomial.NTTFast.Plan.Raw.fastMulImpl_trim_eq_mul {R : Type u_1} [Field R] [BEq R] [LawfulBEq R] (P : Plan R) (hP : P.WellFormed) (p q : Raw R) (hfit : P.domain.fits p q) :
(fastMulImpl P p q).trim = p * q

The planned raw multiplication implementation trims to ordinary multiplication.

The planned multiplication implementation computes the NTT multiplication spec.

theorem CompPoly.CPolynomial.NTTFast.Plan.fastMulImpl_eq_mul {R : Type u_1} [Field R] [BEq R] [LawfulBEq R] (P : Plan R) (hP : P.WellFormed) (p q : CPolynomial R) (hfit : P.domain.fits p q) :
P.fastMulImpl p q = p * q

The planned multiplication implementation agrees with ordinary multiplication.

The one-shot raw multiplication implementation computes the raw NTT multiplication spec.

theorem CompPoly.CPolynomial.NTTFast.Raw.fastMulImpl_trim_eq_mul {R : Type u_1} [Field R] [BEq R] [LawfulBEq R] (D : NTT.Domain R) (p q : Raw R) (hfit : D.fits p q) :
(fastMulImpl D p q).trim = p * q

The one-shot raw multiplication implementation trims to ordinary multiplication.

The one-shot multiplication implementation computes the NTT multiplication spec.

theorem CompPoly.CPolynomial.NTTFast.fastMulImpl_eq_mul {R : Type u_1} [Field R] [BEq R] [LawfulBEq R] (D : NTT.Domain R) (p q : CPolynomial R) (hfit : D.fits p q) :
fastMulImpl D p q = p * q

The one-shot multiplication implementation agrees with ordinary multiplication.

theorem CompPoly.CPolynomial.NTTFast.safeFastMul_eq_mul {R : Type u_1} [Field R] [BEq R] [LawfulBEq R] (D : NTT.Domain R) (p q : CPolynomial R) (hfit : D.fits p q) :
safeFastMul D p q hfit = p * q

The safe one-shot wrapper agrees with ordinary multiplication.

theorem CompPoly.CPolynomial.NTTFast.withFallback_eq_mul {R : Type u_1} [Field R] [BEq R] [LawfulBEq R] (bestDomainForLength? : (requiredLen : ) → Option (NTT.FittingDomain R requiredLen)) (p q : CPolynomial R) :
withFallback bestDomainForLength? p q = p * q

withFallback agrees with canonical polynomial multiplication.