Documentation

CslibFrontier.Foundations.NumberTheory.Primality.RabinMonier

The Rabin–Monier bound #

Modulo an odd composite n ≠ 9, at most a quarter of the units are strong liars for the Miller–Rabin test (ZMod.IsStrongLiar). Rabin Rabin and Monier Monier proved this independently. Crandall and Pomerance Crandall and Pomerance state it as Theorem 3.5.4 for odd composite n > 9; this locator comes from secondary sources and has not been checked against the book. The modulus 9 is a genuine exception: its strong liars are ±1, two of the φ(9) = 6 units.

The proof here is group-theoretic and avoids Monier's exact count. By ZMod.exists_pow_eq_neg_one_forall_isStrongLiar, there is an m with 2 m ∣ n - 1 and a unit b with b ^ m = -1 such that every strong liar lies in K = {a : a ^ m = ±1}. It remains to show that K has index at least 4.

Main results #

References #

theorem ZMod.four_mul_card_powEqOneOrNegOne_le {n m : ℕ} [NeZero n] (hodd : Odd n) (h1 : 1 < n) (hn : ¬Nat.Prime n) (h9 : n ≠ 9) (hm : 2 * m ∣ n - 1) {b : (ZMod n)ˣ} (hb : b ^ m = -1) :

The index bound behind the Rabin–Monier theorem. Modulo an odd composite n ≠ 9, for m with 2 m ∣ n - 1 and a unit b with b ^ m = -1 (as provided by exists_pow_eq_neg_one_forall_isStrongLiar), the subgroup powEqOneOrNegOne n m of units whose m-th power is ±1 has at most a quarter of the units.

theorem ZMod.four_mul_card_isStrongLiar_le {n : ℕ} [NeZero n] (hodd : Odd n) (h1 : 1 < n) (hn : ¬Nat.Prime n) (h9 : n ≠ 9) :

The Rabin–Monier bound Rabin Monier: modulo an odd composite n ≠ 9, at most a quarter of the units are strong liars. For n = 9 the strong liars are ±1, and 4 · 2 > φ(9) = 6.