good_slopes_gap_three_primes_conditional
For primes 5≤p and q≥2p−1 with 3(p+1)<2q, the conjectured gap for a nonextremal permutation modulo 3pq follows from the two finite-field direction classifications and the unit-cover normalization.
Statement
theorem good_slopes_gap_three_primes_conditional (p q : ℕ) [Fact (Nat.Prime p)] [Fact (Nat.Prime q)] (hp : 5 ≤ p) (hsep : 2*p-1 ≤ q) (hsize : (p+1)*3 < 2*q) (hdirP : (∀ T : Finset (ZMod p × ZMod p), T.card = p → (∃ G : Finset (ZMod p), (p+1)/2 ≤ G.card ∧ ∀ a ∈ G, Set.InjOn (fun z : ZMod p × ZMod p => z.2 + a*z.1) T) → (∃ x : ZMod p, ∀ z ∈ T, z.1 = x) ∨ (∃ a t : ZMod p, ∀ z ∈ T, z.2 + a*z.1 = t))) (hdirQ : (∀ T : Finset (ZMod q × ZMod q), T.card = q → (∃ G : Finset (ZMod q), (q+1)/2 ≤ G.card ∧ ∀ a ∈ G, Set.InjOn (fun z : ZMod q × ZMod q => z.2 + a*z.1) T) → (∃ x : ZMod q, ∀ z ∈ T, z.1 = x) ∨ (∃ a t : ZMod q, ∀ z ∈ T, z.2 + a*z.1 = t))) (f : Equiv.Perm (ZMod (3*(p*q)))) (hf : ¬ is_extremal_perm (3*(p*q)) f) (hcover : ∃ c : ZMod (3*(p*q)), ∀ m ∈ good_slopes (3*(p*q)) f, IsUnit (m+c)) : (good_slopes (3*(p*q)) f).card ≤ 2*(p-1)*(q-2)
- Source
- Conditional general reduction for OP-1027. Compare the already-covered large-q range in arXiv:2611.04551 Theorem 9.3.
- Verified
- 19 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 8
- good_slopesGiven a natural number n with n ≠ 0 (via [NeZero n]) and a permutation f of ℤ/nℤ, good_slopes n f is the finite set (Finset) of elements m…
- is_extremal_permGiven n with [NeZero n], a permutation f of ℤ/nℤ is extremal if the number of its good slopes (the cardinality of good_slopes n f) equals…
- good_slopes_gap_three_coprime_from_fiber_boundsLet k be a nonzero natural number coprime to 3 and let f be a non-extremal permutation modulo 3k. Suppose there are L units modulo k and 0…
- good_slopes_product_uncolored_gap_conditionalFor finite fields of odd sizes 5≤p and q≥2p−1, assuming the q-point finite-field direction theorem, a pq-point set with a bad…
- good_slopes_product_three_color_gap_conditionalFor finite fields of odd sizes 5≤p and q≥2p−1 with 3(p+1)<2q, assume both finite-field direction classifications. A three-colored pq-point…
- good_slopes_uncolored_product_gap_crt_conditionalUnder the stated prime, size and finite-field direction hypotheses, a set of pq points modulo pq with a bad unit direction has at most…
- good_slopes_colored_product_gap_crt_conditionalUnder the stated prime, size and finite-field direction hypotheses, a three-colored set of pq points modulo pq with a bad unit direction…
- good_slopes_point_directionsThe unit directions a for which the linear form y + a x is injective on a finite set of points over the residues modulo n.
- Used by 1
- good_slopes_gap_three_primes_field_conditionalLet p and q be primes with p at least 5, q at least 2p−1, and 3(p+1)<2q. Suppose for each r in {p,q} that every set of r points over the…
The proof, explained
The proof establishes the conjectured gap for good slopes modulo 3pq by reducing the problem to fiber bounds modulo pq and invoking the finite-field direction classifications over ℤ/pℤ and ℤ/qℤ. Using the master lifting theorem good_slopes_gap_three_coprime_from_fiber_bounds with parameters k = pq, L = (p - 1)(q - 1), and d = p - 1, the required uncolored and 3-colored direction bounds on fibers are provided by the CRT product theorems good_slopes_uncolored_product_gap_crt_conditional and good_slopes_colored_product_gap_crt_conditional. This bounds the number of good slopes by 2(p - 1)(q - 1) - 2(p - 1), which simplifies via elementary algebra to 2(p - 1)(q - 2).
For any positive integer n, the number of units in ℤ/nℤ equals Euler's totient φ(n).
Euler's totient is identified with the cardinality of the unit group (ℤ/nℤ)ˣ via ZMod.card_units_eq_totient. By ZMod.unitsEquivCoprime, the unit group is equivalent to elements whose representative is coprime to n, which by ZMod.isUnit_iff_coprime and ZMod.natCast_zmod_val matches the subtype of units. Transporting cardinality along this equivalence using Fintype.card_congr and converting the subtype cardinality to the size of the filtered finset with Fintype.card_subtype establishes the identity.
uses
ZMod.card_units_eq_totient,ZMod.unitsEquivCoprime,Equiv.subtypeEquivRight,ZMod.isUnit_iff_coprime,ZMod.natCast_zmod_val,Fintype.card_congr,Fintype.card_subtypeclassical rw [← ZMod.card_units_eq_totient] have e1 := ZMod.unitsEquivCoprime (n := n) have e2 : { x : ZMod n // Nat.Coprime x.val n } ≃ { x : ZMod n // IsUnit x } := by refine Equiv.subtypeEquivRight (fun x => ?_) have h := ZMod.isUnit_iff_coprime x.val n rw [ZMod.natCast_zmod_val] at h exact h.symm rw [Fintype.card_congr (e1.trans e2)] exact (Fintype.card_subtype (fun b : ZMod n => IsUnit b)).symm
The primes p and q satisfy p < q, are both odd, and are coprime to each other and to 3, so gcd(3, pq) = 1.
From 5 ≤ p and 2p - 1 ≤ q, linear arithmetic yields p < q. Since p and q are prime (Fact.out) and p ≥ 5, neither prime is 2, so both are odd. Because they are distinct primes, Nat.coprime_primes shows they are coprime. Since 3 is prime and distinct from both p and q, 3 is coprime to p and to q, and therefore coprime to their product pq.
uses
Fact.out,Nat.coprime_primesclassical have hppr : Nat.Prime p := Fact.out have hqpr : Nat.Prime q := Fact.out have hpq : p < q := by omega have hpodd : p % 2 = 1 := hppr.eq_two_or_odd.resolve_left (by omega) have hqodd : q % 2 = 1 := hqpr.eq_two_or_odd.resolve_left (by omega) have hcop : Nat.Coprime p q := (Nat.coprime_primes hppr hqpr).mpr (by omega) have hcop3p : Nat.Coprime 3 p := (Nat.coprime_primes (by decide) hppr).mpr (by omega) have hcop3q : Nat.Coprime 3 q := (Nat.coprime_primes (by decide) hqpr).mpr (by omega) have hcop3 : Nat.Coprime 3 (p*q) := hcop3p.mul_right hcop3q
The number of units in the ring ℤ/pqℤ is (p - 1)(q - 1).
By the helper lemma in962_units_totient, the unit count in ℤ/pqℤ is φ(pq). Since p and q are coprime, Nat.totient_mul gives φ(pq) = φ(p)φ(q), and Nat.totient_prime computes this as (p - 1)(q - 1).
uses
in962_units_totient,Nat.totient_mul,Nat.totient_primehave hL : ((Finset.univ : Finset (ZMod (p*q))).filter fun b => IsUnit b).card = (p-1)*(q-1) := by rw [in962_units_totient,Nat.totient_mul hcop,Nat.totient_prime hppr,Nat.totient_prime hqpr]
The defect parameter d = p - 1 is strictly positive and satisfies 2(p - 1) < (p - 1)(q - 1).
Since 5 ≤ p and q ≥ 2p - 1 ≥ 9, we have p - 1 > 0 and q - 1 > 2. Multiplying 2 < q - 1 by p - 1 > 0 using Nat.mul_lt_mul_of_pos_left shows that 2(p - 1) < (p - 1)(q - 1).
uses
Nat.mul_lt_mul_of_pos_lefthave hp1 : 0 < p-1 := by omega have hq3 : 2 < q-1 := by omega have hLd : 2*(p-1) < (p-1)*(q-1) := by have h := Nat.mul_lt_mul_of_pos_left hq3 hp1 omega
The number of good slopes of f in ℤ/3pqℤ is at most 2(p - 1)(q - 1) - 2(p - 1).
The master lifting theorem good_slopes_gap_three_coprime_from_fiber_bounds bounds the number of good slopes by 2L - 2d with k = pq, L = (p - 1)(q - 1), and d = p - 1. Its two fiber hypotheses on directions in (ℤ/pqℤ)² are discharged: the uncolored bound is supplied by good_slopes_uncolored_product_gap_crt_conditional (using the direction classification hdirQ), and the 3-colored bound is supplied by good_slopes_colored_product_gap_crt_conditional (using both hdirP and hdirQ).
uses
good_slopes_gap_three_coprime_from_fiber_bounds,good_slopes_uncolored_product_gap_crt_conditional,good_slopes_colored_product_gap_crt_conditionalhave h := good_slopes_gap_three_coprime_from_fiber_bounds (p*q) ((p-1)*(q-1)) (p-1) hcop3 f hf hcover hL hp1 hLd (by intro S hs hb exact good_slopes_uncolored_product_gap_crt_conditional p q hcop hp hpodd hqodd hsep hdirQ S hs hb) (by intro S color hs hx hc hb exact good_slopes_colored_product_gap_crt_conditional p q hcop hp hpodd hqodd hsep hsize hdirP hdirQ S color hs hx hc hb)
The upper bound 2(p - 1)(q - 1) - 2(p - 1) simplifies to 2(p - 1)(q - 2), completing the proof.
Writing q - 1 = (q - 2) + 1, the product (p - 1)(q - 1) expands to (p - 1)(q - 2) + (p - 1). Doubling and subtracting 2(p - 1) algebraically simplifies 2(p - 1)(q - 1) - 2(p - 1) to 2(p - 1)(q - 2). Rewriting the bound on good slopes with this identity completes the proof.
have hqsub : q-1=(q-2)+1 := by omega have hmul : (p-1)*(q-1) = (p-1)*(q-2)+(p-1) := by calc _ = (p-1)*((q-2)+1) := by rw [hqsub] _ = _ := by ring have heq : 2*((p-1)*(q-1))-2*(p-1) = 2*(p-1)*(q-2) := by have hr : 2*((p-1)*(q-1)) = 2*((p-1)*(q-2))+2*(p-1) := by rw [hmul]; ring have hright : 2*((p-1)*(q-2)) = 2*(p-1)*(q-2) := by ring omega rw [heq] at h exact h
ZMod.card_units_eq_totient- The number of units in the ring ℤ/nℤ equals Euler's totient φ(n).
ZMod.unitsEquivCoprime- The unit group (ℤ/nℤ)ˣ is equivalent to the subtype of elements whose canonical integer representative is coprime to n.
Equiv.subtypeEquivRight- Two subtypes of the same type are equivalent if their defining predicates are logically equivalent for every element.
ZMod.isUnit_iff_coprime- The reduction of a natural number m modulo n is a unit in ℤ/nℤ if and only if m and n are coprime.
ZMod.natCast_zmod_val- Casting the integer value of an element of ℤ/nℤ back into ℤ/nℤ yields the original element.
Fintype.card_congr- Equivalent finite types have the same cardinality.
Fintype.card_subtype- The cardinality of a subtype equals the number of elements of the ambient finite type satisfying the predicate.
Fact.out- Extracts the underlying fact from a Fact typeclass instance.
Nat.coprime_primes- Two prime numbers are coprime if and only if they are distinct.
in962_units_totient- The number of units in the finite ring ℤ/nℤ equals Euler's totient φ(n).
Nat.totient_mul- Euler's totient function is multiplicative on coprime integers: φ(m * n) = φ(m) * φ(n).
Nat.totient_prime- For any prime p, Euler's totient is φ(p) = p - 1.
Nat.mul_lt_mul_of_pos_left- Multiplying a strict inequality n < m by a strictly positive integer k preserves the strict inequality: k * n < k * m.
good_slopes_gap_three_coprime_from_fiber_bounds- For a permutation on ℤ/3kℤ with gcd(3, k) = 1 whose good slopes admit a unit cover and which is non-extremal, if uncolored point directions in (ℤ/kℤ)² achieve at most L - d slopes and 3-colored point directions achieve at most L - 2d slopes, then the permutation has at most 2L - 2d good slopes.
good_slopes_uncolored_product_gap_crt_conditional- Under the direction classification over ℤ/qℤ, any set of size pq in (ℤ/pqℤ)² missing at least one unit direction achieves at most (p-1)*(q-1) - (p-1) point directions.
good_slopes_colored_product_gap_crt_conditional- Under the direction classifications over ℤ/pℤ and ℤ/qℤ, any 3-colored set of size pq in (ℤ/pqℤ)² satisfying color-separated injectivity and missing at least one unit direction achieves at most (p-1)*(q-1) - 2*(p-1) point directions.
- The theorem is conditional on two finite-field direction classifications (hdirP over ℤ/pℤ and hdirQ over ℤ/qℤ), which state that any set of size p (or q) having at least (p+1)/2 (or (q+1)/2) directions of injectivity must be a line.
- The result assumes that the set of good slopes of f can be shifted into units by a single constant (hcover).
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option maxRecDepth 10000set_option maxHeartbeats 5000000private lemma in962_units_totient (n : ℕ) [NeZero n] : ((Finset.univ : Finset (ZMod n)).filter fun b => IsUnit b).card = Nat.totient n := by classical rw [← ZMod.card_units_eq_totient] have e1 := ZMod.unitsEquivCoprime (n := n) have e2 : { x : ZMod n // Nat.Coprime x.val n } ≃ { x : ZMod n // IsUnit x } := by refine Equiv.subtypeEquivRight (fun x => ?_) have h := ZMod.isUnit_iff_coprime x.val n rw [ZMod.natCast_zmod_val] at h exact h.symm rw [Fintype.card_congr (e1.trans e2)] exact (Fintype.card_subtype (fun b : ZMod n => IsUnit b)).symmtheorem good_slopes_gap_three_primes_conditional (p q : ℕ) [Fact (Nat.Prime p)] [Fact (Nat.Prime q)] (hp : 5 ≤ p) (hsep : 2*p-1 ≤ q) (hsize : (p+1)*3 < 2*q) (hdirP : (∀ T : Finset (ZMod p × ZMod p), T.card = p → (∃ G : Finset (ZMod p), (p+1)/2 ≤ G.card ∧ ∀ a ∈ G, Set.InjOn (fun z : ZMod p × ZMod p => z.2 + a*z.1) T) → (∃ x : ZMod p, ∀ z ∈ T, z.1 = x) ∨ (∃ a t : ZMod p, ∀ z ∈ T, z.2 + a*z.1 = t))) (hdirQ : (∀ T : Finset (ZMod q × ZMod q), T.card = q → (∃ G : Finset (ZMod q), (q+1)/2 ≤ G.card ∧ ∀ a ∈ G, Set.InjOn (fun z : ZMod q × ZMod q => z.2 + a*z.1) T) → (∃ x : ZMod q, ∀ z ∈ T, z.1 = x) ∨ (∃ a t : ZMod q, ∀ z ∈ T, z.2 + a*z.1 = t))) (f : Equiv.Perm (ZMod (3*(p*q)))) (hf : ¬ is_extremal_perm (3*(p*q)) f) (hcover : ∃ c : ZMod (3*(p*q)), ∀ m ∈ good_slopes (3*(p*q)) f, IsUnit (m+c)) : (good_slopes (3*(p*q)) f).card ≤ 2*(p-1)*(q-2) := by classical have hppr : Nat.Prime p := Fact.out have hqpr : Nat.Prime q := Fact.out have hpq : p < q := by omega have hpodd : p % 2 = 1 := hppr.eq_two_or_odd.resolve_left (by omega) have hqodd : q % 2 = 1 := hqpr.eq_two_or_odd.resolve_left (by omega) have hcop : Nat.Coprime p q := (Nat.coprime_primes hppr hqpr).mpr (by omega) have hcop3p : Nat.Coprime 3 p := (Nat.coprime_primes (by decide) hppr).mpr (by omega) have hcop3q : Nat.Coprime 3 q := (Nat.coprime_primes (by decide) hqpr).mpr (by omega) have hcop3 : Nat.Coprime 3 (p*q) := hcop3p.mul_right hcop3q have hL : ((Finset.univ : Finset (ZMod (p*q))).filter fun b => IsUnit b).card = (p-1)*(q-1) := by rw [in962_units_totient,Nat.totient_mul hcop,Nat.totient_prime hppr,Nat.totient_prime hqpr] have hp1 : 0 < p-1 := by omega have hq3 : 2 < q-1 := by omega have hLd : 2*(p-1) < (p-1)*(q-1) := by have h := Nat.mul_lt_mul_of_pos_left hq3 hp1 omega have h := good_slopes_gap_three_coprime_from_fiber_bounds (p*q) ((p-1)*(q-1)) (p-1) hcop3 f hf hcover hL hp1 hLd (by intro S hs hb exact good_slopes_uncolored_product_gap_crt_conditional p q hcop hp hpodd hqodd hsep hdirQ S hs hb) (by intro S color hs hx hc hb exact good_slopes_colored_product_gap_crt_conditional p q hcop hp hpodd hqodd hsep hsize hdirP hdirQ S color hs hx hc hb) have hqsub : q-1=(q-2)+1 := by omega have hmul : (p-1)*(q-1) = (p-1)*(q-2)+(p-1) := by calc _ = (p-1)*((q-2)+1) := by rw [hqsub] _ = _ := by ring have heq : 2*((p-1)*(q-1))-2*(p-1) = 2*(p-1)*(q-2) := by have hr : 2*((p-1)*(q-1)) = 2*((p-1)*(q-2))+2*(p-1) := by rw [hmul]; ring have hright : 2*((p-1)*(q-2)) = 2*(p-1)*(q-2) := by ring omega rw [heq] at h exact h