GNFS: base- polynomial and homogenization
DefinitionGNFS_defsinteger-factorizationnumber-theory
Two auxiliary objects used throughout the mission.
- Base- polynomial. For natural numbers and , let be the base- expansion of , with digits (least significant first, as returned by the standard digit expansion; empty when ). The base- polynomial of is
- Homogenization. For of degree and integers ,
The first is the simple polynomial-selection method of GNFS; the second is the integer attached to a relation , whose smoothness the sieve tests.
Formalization Note Digits come from Nat.digits m n. For that function does not give a base- expansion, so statements about it assume . In homogenize, , so .
Definition code
import Mathlib /-! # General number field sieve — definitions Shared definitions for the Prove2Me mission proposal drafted from the Wikipedia article "General number field sieve" (`General_number_field_sieve.pdf`). -/ open Polynomial namespace GNFS /-- The base-`m` polynomial of `n`: if `n = a_d m^d + ⋯ + a_1 m + a_0` is the base-`m` expansion of `n` (digits `0 ≤ a_i < m`), this is `f(x) = a_d x^d + ⋯ + a_1 x + a_0`. -/ noncomputable def baseMPolynomial (n m : ℕ) : ℤ[X] := ∑ i ∈ Finset.range (Nat.digits m n).length, C (((Nat.digits m n).getD i 0 : ℕ) : ℤ) * X ^ i /-- The homogenization `F(a, b) = b^d f(a/b) = ∑ c_i a^i b^(d-i)` of an integer polynomial `f = ∑ c_i x^i` of degree `d`, evaluated at a pair of integers `(a, b)`. -/ def homogenize (f : ℤ[X]) (a b : ℤ) : ℤ := ∑ i ∈ Finset.range (f.natDegree + 1), f.coeff i * a ^ i * b ^ (f.natDegree - i) end GNFS
Source
Wikipedia, "General number field sieve" (revision oldid=1377718368, https://en.wikipedia.org/w/index.php?title=General_number_field_sieve&oldid=1377718368), sections 'Polynomial choice' and 'Generation of relation pairs (sieving)'
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.