AFTD Auto-Formalizing Theoretical Domains

good_slopes_gap_mod_165

theoremverifiedoriginal

Every non-extremal permutation of the residue ring modulo 165 has at most 72 good slopes.

Statement

theorem good_slopes_gap_mod_165 (f : Equiv.Perm (ZMod 165)) (hf : ¬ is_extremal_perm 165 f) : (good_slopes 165 f).card ≤ 72
Related work
arXiv:2611.04551 Question 10.2, the unsettled modulus 165.
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_unit_cover_mod165For every permutation modulo 165, a unit c exists such that adding c to each good slope yields a unit modulo 165.
  • good_slopes_fiber55_unit_gapFor any 55 points over Z/55Z, if at least one unit direction fails to be injective, then at most 36 of the 40 unit directions are injective.
  • good_slopes_fiber55_colored_gap_structuralA three-colored 55-point set over Z/55 with any bad unit direction has at most 32 good unit directions.
  • good_slopes_fiber55_nonunit_collision_gapLet S be any finite set of points over Z/55Z. If a unit direction has a collision between distinct points whose first-coordinate…
  • 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.

Read back from the Lean

For every permutation $f$ of $\mathbb{Z}/165\mathbb{Z}$, if $f$ is not an extremal permutation modulo $165$ (¬ is_extremal_perm 165 f), then the number of good slopes of $f$ modulo $165$ ((good_slopes 165 f).card) is at most $72$.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

To show that any non-extremal permutation f of ℤ/165ℤ has at most 72 good slopes, the proof uses a fiber reduction theorem for 165 = 3 * 55 with gcd(3, 55) = 1. First, a covering lemma ensures that all good slopes of f can be simultaneously shifted by some c into the unit group. The lifting theorem `good_slopes_gap_three_coprime_from_fiber_bounds` is then instantiated with k = 55, unit count L = 40, and defect d = 4, using known fiber bounds for configurations in ℤ/55ℤ × ℤ/55ℤ to yield the upper bound 2 * 40 - 2 * 4 = 72.

  1. There exists an element c ∈ ℤ/165ℤ such that m + c is a unit for every good slope m of f.

    Applying `good_slopes_unit_cover_mod165` to the permutation f provides an element c such that every good slope m of f has the property that m + c is invertible in ℤ/165ℤ.

    line 5

    uses good_slopes_unit_cover_mod165

      obtain ⟨c, _, hc⟩ := good_slopes_unit_cover_mod165 f
  2. The number of good slopes of f modulo 3 * 55 is at most 2 * 40 - 2 * 4.

    We apply the fiber reduction theorem `good_slopes_gap_three_coprime_from_fiber_bounds` with fiber modulus k = 55, unit count L = 40, and defect d = 4. The numerical conditions gcd(3, 55) = 1, 0 < 4, and 2 * 4 < 40 are verified by computation (`decide`). The assumption that f is non-extremal is hf, and the unit cover shift c is supplied from the previous step. The number of units in ℤ/55ℤ is 40 by `good_slopes_fiber55_nonunit_collision_gap_card_units`. The uncolored and colored fiber direction bounds (at most 40 - 4 = 36 and at most 40 - 2 * 4 = 32 directions, respectively) are supplied by `good_slopes_fiber55_unit_gap` and `good_slopes_fiber55_colored_gap_structural`.

    lines 6–13

    uses good_slopes_gap_three_coprime_from_fiber_bounds, good_slopes_fiber55_nonunit_collision_gap_card_units, good_slopes_fiber55_unit_gap, good_slopes_fiber55_colored_gap_structural

      have h := good_slopes_gap_three_coprime_from_fiber_bounds 55 40 4 (by decide) f hf
        ⟨c,hc⟩ good_slopes_fiber55_nonunit_collision_gap_card_units (by decide) (by decide)
        (by
          intro S hs hb
          exact good_slopes_fiber55_unit_gap S hs hb)
        (by
          intro S color hs hx hc hb
          exact good_slopes_fiber55_colored_gap_structural S color hs hx hc hb)
  3. The permutation f has at most 72 good slopes modulo 165.

    The hypothesis h establishes |good_slopes(3 * 55, f)| ≤ 2 * 40 - 2 * 4. Since 3 * 55 = 165 and 2 * 40 - 2 * 4 = 72, this bound matches the goal definitionally and finishes the proof.

    line 14

      exact h
good_slopes_unit_cover_mod165
For any permutation f of ℤ/165ℤ, there exists an invertible element c ∈ ℤ/165ℤ such that m + c is invertible for every good slope m of f.
good_slopes_gap_three_coprime_from_fiber_bounds
For n = 3k with gcd(3, k) = 1, if ℤ/kℤ has L units, and fiber configurations missing a unit direction satisfy defect bounds L - d (uncolored) and L - 2d (3-colored under separation conditions), then any non-extremal permutation of ℤ/(3k)ℤ whose good slopes can be shifted into units has at most 2L - 2d good slopes.
good_slopes_fiber55_nonunit_collision_gap_card_units
The ring ℤ/55ℤ has exactly 40 units (invertible elements).
good_slopes_fiber55_unit_gap
Any 55-element subset S of ℤ/55ℤ × ℤ/55ℤ whose good slope directions omit at least one unit direction has at most 36 good slope directions.
good_slopes_fiber55_colored_gap_structural
Any 55-element subset S of ℤ/55ℤ × ℤ/55ℤ equipped with a 3-coloring that separates points along the axes and unit directions, and whose directions omit at least one unit, has at most 32 good slope directions.

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

set_option maxRecDepth 10000set_option maxHeartbeats 5000000theorem good_slopes_gap_mod_165 (f : Equiv.Perm (ZMod 165)) (hf : ¬ is_extremal_perm 165 f) : (good_slopes 165 f).card ≤ 72 := by  obtain ⟨c, _, hc⟩ := good_slopes_unit_cover_mod165 f  have h := good_slopes_gap_three_coprime_from_fiber_bounds 55 40 4 (by decide) f hf    ⟨c,hc⟩ good_slopes_fiber55_nonunit_collision_gap_card_units (by decide) (by decide)    (by      intro S hs hb      exact good_slopes_fiber55_unit_gap S hs hb)    (by      intro S color hs hx hc hb      exact good_slopes_fiber55_colored_gap_structural S color hs hx hc hb)  exact h
See it in the graphDiscuss this resultChallenge it