AFTD Auto-Formalizing Theoretical Domains

good_slopes_composite_many_good_not_line

theoremverified

There is a set of 33 points over the residues modulo 33 with more than ten good unit directions, although it is neither vertical nor contained in any affine line y+ax=t.

Statement

theorem good_slopes_composite_many_good_not_line :
    ∃ S : Finset (ZMod 33 × ZMod 33), S.card = 33 ∧
      10 < (good_slopes_point_directions 33 S).card ∧
      ¬ ((∃ x : ZMod 33, ∀ p ∈ S, p.1=x) ∨
        (∃ a t : ZMod 33, ∀ p ∈ S, p.2+a*p.1=t))
Source
Computed obstruction to extending the prime-field direction classification in OP-1027; experiment 32044.
Verified
19 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • 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.

The proof, explained

The theorem is proved by constructing an explicit set S of 33 points as the graph of a piecewise linear function f(x) over ℤ/33ℤ (equal to 2x when x ≡ 0 mod 3, and 12x otherwise). By testing an explicit 11-element set of unit slopes, each gives an injective projection on S, guaranteeing at least 11 good directions. Finally, evaluating the coordinates of three specific points in S—(0, 0), (1, 12), and (3, 6)—rules out the possibility that S lies on any vertical or affine line.

  1. The precomputed direction set G33 contains 11 elements, and f33 satisfies f33(0) = 0, f33(1) = 12, and f33(3) = 6. automation

    These basic evaluations and set size assertions over the finite ring ℤ/33ℤ are verified by decision procedures via decide.

    lines 5–8

    private theorem in962_G33_card : in962_G33.card = 11 := by decide
    private theorem in962_f33_0 : in962_f33 0 = 0 := by decide
    private theorem in962_f33_1 : in962_f33 1 = 12 := by decide
    private theorem in962_f33_3 : in962_f33 3 = 6 := by decide
  2. Every slope in G33 is a unit and induces an injective projection x ↦ f33(x) + ax. automation

    For each of the 11 elements of G33, Lean's decide tactic verifies by exhaustive computation over ℤ/33ℤ that a is invertible and that x ↦ f33(x) + ax is injective.

    lines 9–11

    private theorem in962_G33_good : ∀ a : ZMod 33, a ∈ in962_G33 →
        (∃ b : ZMod 33, a*b=1) ∧ Function.Injective (fun x : ZMod 33 => in962_f33 x + a*x) := by
      decide
  3. The candidate point set S is defined as the graph of f33, and it has cardinality 33.

    We define F(x) = (x, f33(x)) and let S be its image over the entire residue ring ℤ/33ℤ. The mapping F is injective because the first projection Prod.fst immediately recovers x. Since F is injective, the cardinality of S equals the cardinality of the domain ℤ/33ℤ, which is 33.

    lines 18–26

    uses congrArg, Finset.card_image_of_injective, Finset.card_univ, ZMod.card

      classical
      let F (x : ZMod 33) : ZMod 33 × ZMod 33 := (x,in962_f33 x)
      let S := Finset.univ.image F
      have hF : Function.Injective F := by
        intro x y h
        exact congrArg Prod.fst h
      have hcard : S.card = 33 := by
        dsimp [S]
        rw [Finset.card_image_of_injective _ hF,Finset.card_univ,ZMod.card]
  4. Every direction in the 11-element set G33 is a good direction for S.

    By the auxiliary lemma in962_G33_good, each a ∈ G33 is a unit and x ↦ f33(x) + ax is injective. A unit a is a good slope for S if p ↦ p.2 + a * p.1 is injective on S. For any two points p = F(x) and q = F(y) in S, the condition p.2 + a * p.1 = q.2 + a * q.1 translates to f33(x) + ax = f33(y) + ay. By injectivity of that function, x = y, which implies p = q.

    lines 27–38

    uses in962_G33_good, Finset.mem_filter, Finset.mem_univ, true_and, isUnit_iff_exists_inv.mpr, Finset.mem_image.mp, congrArg

      have hG : in962_G33 ⊆ good_slopes_point_directions 33 S := by
        intro a ha
        have hc := in962_G33_good a ha
        unfold good_slopes_point_directions
        simp only [Finset.mem_filter,Finset.mem_univ,true_and]
        refine ⟨isUnit_iff_exists_inv.mpr hc.1, ?_⟩
        intro p hp q hq he
        obtain ⟨x,hx0,rfl⟩ := Finset.mem_image.mp hp
        obtain ⟨y,hy0,rfl⟩ := Finset.mem_image.mp hq
        apply congrArg F
        apply hc.2
        exact he
  5. The number of good directions of S is strictly greater than 10.

    Since G33 is a subset of the good directions of S, the number of good directions is at least |G33|. Because |G33| = 11, it is strictly greater than 10.

    lines 39–42

    uses Finset.card_le_card, in962_G33_card

      have hcount : 10 < (good_slopes_point_directions 33 S).card := by
        have h := Finset.card_le_card hG
        rw [in962_G33_card] at h
        omega
  6. The points (0, 0), (1, 12), and (3, 6) belong to S.

    Evaluating F(x) at x = 0, 1, 3 and using the precomputed values f33(0) = 0, f33(1) = 12, and f33(3) = 6 shows that (0, 0), (1, 12), and (3, 6) are all in S.

    lines 43–54

    uses Finset.mem_image.mpr, Finset.mem_univ, in962_f33_0, in962_f33_1, in962_f33_3

      have h0 : ((0 : ZMod 33),0) ∈ S := by
        apply Finset.mem_image.mpr
        refine ⟨0,Finset.mem_univ _, ?_⟩
        simp [F,in962_f33_0]
      have h1 : ((1 : ZMod 33),12) ∈ S := by
        apply Finset.mem_image.mpr
        refine ⟨1,Finset.mem_univ _, ?_⟩
        simp [F,in962_f33_1]
      have h3 : ((3 : ZMod 33),6) ∈ S := by
        apply Finset.mem_image.mpr
        refine ⟨3,Finset.mem_univ _, ?_⟩
        simp [F,in962_f33_3]
  7. S is not contained in any vertical line x = c.

    We instantiate the existential statement with S, its cardinality 33, and the slope count > 10. We then split into cases to refute that S is a line. If all points of S were contained in a vertical line x = c, then both (0, 0) and (1, 12) in S would have their first coordinates equal to c, forcing 0 = 1 in ℤ/33ℤ, an immediate contradiction.

    lines 55–58

      refine ⟨S,hcard,hcount, ?_⟩
      rintro (⟨x,hx⟩ | ⟨a,t,ht⟩)
      · have h01 : (0 : ZMod 33) = 1 := (hx _ h0).trans (hx _ h1).symm
        exact (by decide : (0 : ZMod 33) ≠ 1) h01
  8. S is not contained in any affine line y + ax = t, completing the proof. automation

    If all points in S satisfied y + ax = t, then evaluating at (0, 0), (1, 12), and (3, 6) gives 0 = t, 12 + a = t, and 6 + 3a = t. Forming the linear combination (6 + 3a - t) - 3(12 + a - t) + 2(0 - t) + 33 = 3 eliminates a and t and yields 3 = 0 in ℤ/33ℤ. Since 3 ≠ 0 in ℤ/33ℤ by computation, this is a contradiction.

    lines 59–64

    uses ZMod.natCast_self

      · have q0 := ht _ h0
        have q1 := ht _ h1
        have q3 := ht _ h3
        have h33 : (33 : ZMod 33) = 0 := ZMod.natCast_self 33
        have hh : (3 : ZMod 33) = 0 := by linear_combination q3-3*q1+2*q0+h33
        exact (by decide : (3 : ZMod 33) ≠ 0) hh
congrArg
Applying a function to both sides of an equality yields equal values.
Finset.card_image_of_injective
The image of a finite set under an injective function has the same cardinality as the original set.
Finset.card_univ
The cardinality of the universal finset of a finite type equals the cardinality of the type.
ZMod.card
The cardinality of the residue ring ℤ/nℤ is n.
in962_G33_good
For every element a in the set G33, a is invertible in ℤ/33ℤ and the function x ↦ f33(x) + ax is injective.
Finset.mem_filter
An element belongs to a filtered finset if and only if it belongs to the finset and satisfies the predicate.
Finset.mem_univ
Every element of a finite type belongs to its universal finset.
true_and
Conjunction with True is equivalent to the proposition itself.
isUnit_iff_exists_inv.mpr
An element with a multiplicative inverse is a unit.
Finset.mem_image.mp
An element in the image of a finset under a function comes from some element in the domain.
Finset.card_le_card
If one finset is a subset of another, its cardinality is at most the other finset's cardinality.
in962_G33_card
The precomputed set G33 contains exactly 11 elements.
Finset.mem_image.mpr
If an element is the image of a member of a finset, it belongs to the image finset.
in962_f33_0
The function f33 evaluated at 0 equals 0.
in962_f33_1
The function f33 evaluated at 1 equals 12.
in962_f33_3
The function f33 evaluated at 3 equals 6.
ZMod.natCast_self
In ℤ/nℤ, the canonical image of n is 0.

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 5000000private def in962_f33 (x : ZMod 33) : ZMod 33 := if x.val % 3 = 0 then 2*x else 12*xprivate def in962_G33 : Finset (ZMod 33) := {1,2,4,5,7,8,13,14,16,17,19}private theorem in962_G33_card : in962_G33.card = 11 := by decideprivate theorem in962_f33_0 : in962_f33 0 = 0 := by decideprivate theorem in962_f33_1 : in962_f33 1 = 12 := by decideprivate theorem in962_f33_3 : in962_f33 3 = 6 := by decideprivate theorem in962_G33_good : ∀ a : ZMod 33, a ∈ in962_G33 →    (∃ b : ZMod 33, a*b=1) ∧ Function.Injective (fun x : ZMod 33 => in962_f33 x + a*x) := by  decidetheorem good_slopes_composite_many_good_not_line :    ∃ S : Finset (ZMod 33 × ZMod 33), S.card = 33 ∧      10 < (good_slopes_point_directions 33 S).card ∧      ¬ ((∃ x : ZMod 33, ∀ p ∈ S, p.1=x) ∨        (∃ a t : ZMod 33, ∀ p ∈ S, p.2+a*p.1=t)) := by  classical  let F (x : ZMod 33) : ZMod 33 × ZMod 33 := (x,in962_f33 x)  let S := Finset.univ.image F  have hF : Function.Injective F := by    intro x y h    exact congrArg Prod.fst h  have hcard : S.card = 33 := by    dsimp [S]    rw [Finset.card_image_of_injective _ hF,Finset.card_univ,ZMod.card]  have hG : in962_G33 ⊆ good_slopes_point_directions 33 S := by    intro a ha    have hc := in962_G33_good a ha    unfold good_slopes_point_directions    simp only [Finset.mem_filter,Finset.mem_univ,true_and]    refine ⟨isUnit_iff_exists_inv.mpr hc.1, ?_⟩    intro p hp q hq he    obtain ⟨x,hx0,rfl⟩ := Finset.mem_image.mp hp    obtain ⟨y,hy0,rfl⟩ := Finset.mem_image.mp hq    apply congrArg F    apply hc.2    exact he  have hcount : 10 < (good_slopes_point_directions 33 S).card := by    have h := Finset.card_le_card hG    rw [in962_G33_card] at h    omega  have h0 : ((0 : ZMod 33),0) ∈ S := by    apply Finset.mem_image.mpr    refine ⟨0,Finset.mem_univ _, ?_⟩    simp [F,in962_f33_0]  have h1 : ((1 : ZMod 33),12) ∈ S := by    apply Finset.mem_image.mpr    refine ⟨1,Finset.mem_univ _, ?_⟩    simp [F,in962_f33_1]  have h3 : ((3 : ZMod 33),6) ∈ S := by    apply Finset.mem_image.mpr    refine ⟨3,Finset.mem_univ _, ?_⟩    simp [F,in962_f33_3]  refine ⟨S,hcard,hcount, ?_⟩  rintro (⟨x,hx⟩ | ⟨a,t,ht⟩)  · have h01 : (0 : ZMod 33) = 1 := (hx _ h0).trans (hx _ h1).symm    exact (by decide : (0 : ZMod 33) ≠ 1) h01  · have q0 := ht _ h0    have q1 := ht _ h1    have q3 := ht _ h3    have h33 : (33 : ZMod 33) = 0 := ZMod.natCast_self 33    have hh : (3 : ZMod 33) = 0 := by linear_combination q3-3*q1+2*q0+h33    exact (by decide : (3 : ZMod 33) ≠ 0) hh
See it in the graphDiscuss this resultChallenge it