Coefficients strictly below k.
Equations
- Hex.DensePoly.low k p = Hex.DensePoly.ofList (List.map p.coeff (List.range k))
Instances For
Coefficients at and above k, shifted down by k.
Equations
- Hex.DensePoly.high k p = Hex.DensePoly.ofList (List.map (fun (i : Nat) => p.coeff (k + i)) (List.range (p.size - k)))
Instances For
Splitting at k and shifting the high half back reconstructs the input.
Nested shifts add their offsets.
Shifting distributes over polynomial addition.
A shifted left factor shifts the product.
A shifted right factor shifts the product.
Multiplying two shifted polynomials adds their offsets.
The three-product Karatsuba assembly identity.
Coefficientwise addition without polynomial normalization.
Equations
- Hex.DensePoly.Karatsuba.Raw.add a b = Array.ofFn fun (i : Fin (max a.size b.size)) => a.getD (↑i) 0 + b.getD (↑i) 0
Instances For
Coefficientwise subtraction without polynomial normalization.
Equations
- Hex.DensePoly.Karatsuba.Raw.sub a b = Array.ofFn fun (i : Fin (max a.size b.size)) => a.getD (↑i) 0 - b.getD (↑i) 0
Instances For
The raw coefficient prefix strictly below k.
Equations
- Hex.DensePoly.Karatsuba.Raw.low k a = Array.ofFn fun (i : Fin (min k a.size)) => a.getD (↑i) 0
Instances For
The raw coefficient suffix at k, shifted down.
Equations
- Hex.DensePoly.Karatsuba.Raw.high k a = Array.ofFn fun (i : Fin (a.size - k)) => a.getD (k + ↑i) 0
Instances For
Assemble the three Karatsuba pieces in one output allocation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
One schoolbook convolution diagonal over raw arrays.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Raw schoolbook multiplication with no normalization pass.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fuelled raw-array Karatsuba multiplication.
Equations
- One or more equations did not get rendered due to their size.
- Hex.DensePoly.Karatsuba.Raw.mulAux cutoff 0 x✝¹ x✝ = Hex.DensePoly.Karatsuba.Raw.schoolbook x✝¹ x✝
Instances For
Fuelled raw-array specialized Karatsuba squaring.
Equations
- One or more equations did not get rendered due to their size.
- Hex.DensePoly.Karatsuba.Raw.squareAux cutoff 0 x✝ = Hex.DensePoly.Karatsuba.Raw.schoolbook x✝ x✝
Instances For
Add a raw suffix at an offset in one output allocation.
Equations
Instances For
Accumulate only the shifted block support. The undersized-buffer branch grows the array without dropping coefficients, preserving unrestricted inputs.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fuelled unbalanced block multiplication over raw arrays. For ordinary
block dispatch, each raw product has size at most twice the short length minus
one, including recursive padding. Since every visited offset is below the long
length, this buffer contains every shifted block support. The growing fallback
in addAt also handles unrestricted block sizes and prematurely exhausted fuel.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A clipped raw schoolbook product.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fuelled interval-pruned Karatsuba recursion over raw arrays.
Equations
- One or more equations did not get rendered due to their size.
- Hex.DensePoly.Karatsuba.Raw.sliceAux cutoff 0 x✝³ x✝² x✝¹ x✝ = Hex.DensePoly.Karatsuba.Raw.schoolbookSlice x✝³ x✝² x✝¹ x✝
Instances For
Raw coefficientwise addition represents polynomial addition.
Raw coefficientwise subtraction represents polynomial subtraction.
A raw low split represents the polynomial low split.
A raw high split represents the polynomial shifted-down high split.
A raw diagonal fold represents the corresponding dense diagonal.
Raw convolution diagonals are symmetric in their operands.
Raw schoolbook multiplication represents dense multiplication.
A raw clipped schoolbook product has the planned slice coefficients.
Raw one-allocation assembly represents the Karatsuba shifted sum.
Raw shifted addition represents polynomial shifted addition.
Raw Karatsuba recursion represents dense multiplication for every fuel.
Raw specialized Karatsuba squaring represents dense squaring for every fuel.
Raw block recursion represents dense multiplication for every fuel.
Fuelled three-product Karatsuba recursion. Fuel is separate from the cutoff so cutoff zero remains total; public callers provide at least the larger operand size.
Equations
- One or more equations did not get rendered due to their size.
- Hex.DensePoly.karatsubaAux cutoff 0 x✝¹ x✝ = x✝¹.mulImpl x✝
Instances For
Specialized three-square Karatsuba recursion.
Equations
- One or more equations did not get rendered due to their size.
- Hex.DensePoly.karatsubaSquareAux cutoff 0 x✝ = x✝.mulImpl x✝
Instances For
Every fuelled Karatsuba product agrees with schoolbook multiplication.
Every fuelled Karatsuba square agrees with ordinary squaring.
Runtime Karatsuba recursion over raw coefficient arrays. The sole
normalization pass is the final ofCoeffs.
Equations
- Hex.DensePoly.karatsubaAuxImpl cutoff fuel a b = Hex.DensePoly.ofCoeffs (Hex.DensePoly.Karatsuba.Raw.mulAux cutoff fuel a.toArray b.toArray)
Instances For
The raw-array Karatsuba runtime agrees with the proof-facing recursion.
Compile fuelled Karatsuba through the raw-array recursion.
Runtime specialized Karatsuba squaring over raw coefficient arrays.
Equations
- Hex.DensePoly.karatsubaSquareAuxImpl cutoff fuel a = Hex.DensePoly.ofCoeffs (Hex.DensePoly.Karatsuba.Raw.squareAux cutoff fuel a.toArray)
Instances For
The raw-array square runtime agrees with the proof-facing recursion.
Compile specialized Karatsuba squaring through the raw-array recursion.
Balanced Karatsuba multiplication with an explicit schoolbook cutoff.
Equations
- Hex.DensePoly.mulKaratsubaBalanced cutoff a b = Hex.DensePoly.karatsubaAux cutoff (max a.size b.size) a b
Instances For
Specialized Karatsuba squaring with an explicit schoolbook cutoff.
Equations
- Hex.DensePoly.squareKaratsubaImpl cutoff a = Hex.DensePoly.karatsubaSquareAux cutoff a.size a
Instances For
Balanced Karatsuba multiplication agrees exactly with DensePoly.mul.
Specialized Karatsuba squaring agrees exactly with DensePoly.mul.
Kernel-visible square; compiled code uses the existing Karatsuba square.
Equations
- Hex.DensePoly.squareKaratsuba cutoff a = a * a
Instances For
Planned squaring retains the exact reference product.
Compile the reference square through the existing Karatsuba engine.
Multiply a long operand by blocks of blockSize coefficients. Each block
uses balanced Karatsuba; the shifted block products are accumulated without
padding the short operand to the long size.
Equations
- One or more equations did not get rendered due to their size.
- Hex.DensePoly.karatsubaBlocks cutoff blockSize 0 x✝¹ x✝ = Hex.DensePoly.mulKaratsubaBalanced cutoff x✝¹ x✝
Instances For
Blocked unbalanced multiplication agrees with the ordinary product for every fuel value.
Runtime unbalanced multiplication over raw coefficient arrays.
Equations
- Hex.DensePoly.karatsubaBlocksImpl cutoff blockSize fuel long short = Hex.DensePoly.ofCoeffs (Hex.DensePoly.Karatsuba.Raw.blocks cutoff blockSize fuel long.toArray short.toArray)
Instances For
The raw-array block runtime agrees with the proof-facing recursion.
Compile unbalanced multiplication through the raw-array block recursion.
Full Karatsuba multiplication. Strongly skewed operands are processed in blocks near the shorter size rather than padded to the longer size.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Full balanced-or-blocked Karatsuba multiplication agrees exactly with
DensePoly.mul.
Kernel-visible product; compiled code uses the existing balanced-or-blocked Karatsuba dispatch with the supplied cutoff.
Equations
- Hex.DensePoly.mulKaratsuba cutoff a b = a * b
Instances For
Planned multiplication retains the exact reference product.
Compile the reference product through the existing Karatsuba dispatch.
Extract len coefficients beginning at lo from an already-computed
polynomial, shifting them down to degree zero.
Equations
- Hex.DensePoly.coeffSlice lo len p = Hex.DensePoly.ofList (List.map (fun (i : Nat) => p.coeff (lo + i)) (List.range len))
Instances For
Coefficient law for extracting a polynomial interval.
Fuelled interval-pruned Karatsuba recursion. At a split, each of the
three mathematical subproducts is computed once over the smallest bounding
interval containing all of its shifted contributions to [lo, lo + len).
Branches whose shifted output starts beyond the interval receive length zero.
Equations
- One or more equations did not get rendered due to their size.
- Hex.DensePoly.karatsubaSliceAux cutoff 0 x✝³ x✝² x✝¹ x✝ = Hex.DensePoly.schoolbookSlice x✝³ x✝² x✝¹ x✝
Instances For
Every fuelled interval recursion returns exactly the requested product coefficients.
Raw interval recursion returns exactly the requested dense-product coefficients for every fuel value.
Runtime interval-pruned Karatsuba recursion over raw coefficient arrays.
Equations
- Hex.DensePoly.karatsubaSliceAuxImpl cutoff fuel lo len a b = Hex.DensePoly.ofCoeffs (Hex.DensePoly.Karatsuba.Raw.sliceAux cutoff fuel lo len a.toArray b.toArray)
Instances For
The raw-array clipped runtime agrees with the proof-facing recursion.
Compile clipped Karatsuba through the raw-array interval recursion.
Interval-pruned Karatsuba slicing.
Equations
- Hex.DensePoly.karatsubaSlice cutoff lo len a b = Hex.DensePoly.karatsubaSliceAux cutoff (max a.size b.size) lo len a b
Instances For
Interval-pruned Karatsuba slicing has the exact planned-slice semantics.
A lawful Karatsuba plan.
Equations
- One or more equations did not get rendered due to their size.