AFTD Auto-Formalizing Theoretical Domains

good_slopes_product_dense_row_level_lines

theoremverified

For a pq-point subset of the product of two finite-field planes, if at least (q+1)/2 second-coordinate directions are good in a fixed row, the first-coordinate form has p levels of q points and each level projects to a line in the second-coordinate plane, assuming the stated q-point direction classification.

Statement

theorem good_slopes_product_dense_row_level_lines
    (K L : Type*) [Field K] [Field L] [Fintype K] [Fintype L] [DecidableEq K] [DecidableEq L]
    (p q : ℕ) (hp : Fintype.card K = p) (hq : Fintype.card L = q)
    (hdirL : ∀ T : Finset (L × L), T.card = q →
      (∃ G : Finset L, (q+1)/2 ≤ G.card ∧ ∀ b ∈ G, Set.InjOn (fun z : L × L => z.2 + b*z.1) T) →
      (∃ x : L, ∀ z ∈ T, z.1 = x) ∨ (∃ b t : L, ∀ z ∈ T, z.2 + b*z.1 = t))
    (S : Finset ((K × L) × (K × L))) (hcard : S.card = p*q) (a : K)
    (hdense : (q+1)/2 ≤ ((Finset.univ : Finset L).filter fun b => b ≠ 0 ∧
      Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) S).card) :
    ∀ t : K, (S.filter fun z => z.2.1 + a*z.1.1 = t).card = q ∧
      ((∃ x : L, ∀ z ∈ S, z.2.1 + a*z.1.1 = t → z.1.2 = x) ∨
       (∃ b v : L, ∀ z ∈ S, z.2.1 + a*z.1.1 = t → z.2.2 + b*z.1.2 = v))
Source
Dense-row fiber classification for OP-1027.
Verified
19 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
Used by 4

The proof, explained

Because at least (q+1)/2 second-coordinate slopes are good for S in the given row, the set of good slopes G is nonempty, providing an explicit slope b₀ ∈ G. Applying fiber product saturation to the product form with slope b₀ shows that every level set A = {z ∈ S | z.2.1 + a*z.1.1 = t} contains exactly q points. The projection π onto the second-coordinate plane L × L is injective on A, producing a q-point set T = π(A) on which every direction in G remains good. The direction classification hypothesis hdirL then guarantees that T is a line in L × L, which pulls back directly to the collinearity of the level set in S.

  1. The set G of good second-coordinate slopes is nonempty, yielding at least one good slope b₀ ∈ G.

    We define G as the set of nonzero slopes b ∈ L for which the mapping z ↦ (z.2.1 + a * z.1.1, z.2.2 + b * z.1.2) is injective on S. Because L is a field, it is nontrivial, so q = |L| > 1 by Fintype.one_lt_card, which implies (q + 1) / 2 > 0 by Nat.div_pos. Since |G| ≥ (q + 1) / 2 by the density hypothesis hdense, |G| > 0 by lt_of_lt_of_le, so G is nonempty by Finset.card_pos.mp. We can therefore choose a witness b₀ ∈ G, which satisfies the injectivity property on S by Finset.mem_filter.mp.

    lines 16–23

    uses Fintype.one_lt_card, Nat.div_pos, lt_of_lt_of_le, Finset.card_pos.mp, Finset.mem_filter.mp

      classical
      let G : Finset L := Finset.univ.filter fun b => b ≠ 0 ∧
          Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) S
      have hqpos : 1 < q := by rw [← hq]; exact Fintype.one_lt_card
      have hn : 0 < (q+1)/2 := Nat.div_pos (by omega) (by decide)
      have hGpos : 0 < G.card := lt_of_lt_of_le hn hdense
      obtain ⟨b0,hb0⟩ := Finset.card_pos.mp hGpos
      have hb0good := (Finset.mem_filter.mp hb0).2.2
  2. The fibers of F(z) = z.2.1 + a * z.1.1 in S have size q and saturate all values under H(z) = z.2.2 + b₀ * z.1.2.

    Define F(z) = z.2.1 + a * z.1.1 and H(z) = z.2.2 + b₀ * z.1.2. The set S has cardinality |S| = p * q = |K| * |L|, and the combined map (F, H) is injective on S because b₀ ∈ G. Applying the fiber product saturation lemma good_slopes_fiber_product_saturation, every level set {z ∈ S | F(z) = i} has size |L| = q and maps surjectively to L under H.

    lines 24–27

    uses good_slopes_fiber_product_saturation

      let F (z : ((K × L) × (K × L))) := z.2.1 + a*z.1.1
      let H (z : ((K × L) × (K × L))) := z.2.2 + b0*z.1.2
      have hS : S.card = Fintype.card K * Fintype.card L := by simpa [hp,hq] using hcard
      have hsat := good_slopes_fiber_product_saturation S F H hS hb0good
  3. For any t ∈ K, the fiber A = {z ∈ S | F(z) = t} has cardinality q.

    Fix an arbitrary target level t ∈ K and let A ⊆ S be the fiber {z ∈ S | F(z) = t}. From the fiber saturation result hsat evaluated at t, the cardinality of A is |L| = q. This resolves the first conjunction of the goal, leaving the classification of the fiber A.

    lines 28–31

      intro t
      let A := S.filter fun z => F z = t
      have hA : A.card = q := by simpa [A,hq] using (hsat t).1
      refine ⟨hA, ?_⟩
  4. The projection π onto the second-coordinate plane L × L is injective on A.

    Define π(z) = (z.1.2, z.2.2), projecting each point z ∈ (K × L) × (K × L) to its L-coordinates. Given u, v ∈ A with π(u) = π(v), taking the first and second components via congrArg Prod.fst and congrArg Prod.snd gives u.1.2 = v.1.2 and u.2.2 = v.2.2. Therefore H(u) = u.2.2 + b₀ * u.1.2 = v.2.2 + b₀ * v.1.2 = H(v). Furthermore, since u, v ∈ A, F(u) = t = F(v) by Finset.mem_filter.mp. By Prod.ext, (F(u), H(u)) = (F(v), H(v)), and since (F, H) is injective on S, we conclude u = v.

    lines 32–44

    uses Finset.mem_filter.mp, Prod.ext, congrArg, Prod.fst, Prod.snd

      let π (z : ((K × L) × (K × L))) : L × L := (z.1.2,z.2.2)
      have hπ : Set.InjOn π A := by
        intro u hu v hv heq
        have huA := Finset.mem_filter.mp hu
        have hvA := Finset.mem_filter.mp hv
        apply hb0good huA.1 hvA.1
        apply Prod.ext
        · exact huA.2.trans hvA.2.symm
        · have hx := congrArg Prod.fst heq
          have hy := congrArg Prod.snd heq
          dsimp [π] at hx hy
          dsimp [H]
          rw [hx,hy]
  5. The projected set T = π(A) ⊆ L × L has cardinality q.

    Let T = π(A) be the image of A under the projection π. Because π is injective on A, Finset.card_image_of_injOn establishes that |T| = |A| = q.

    lines 45–48

    uses Finset.card_image_of_injOn

      let T : Finset (L × L) := A.image π
      have hT : T.card = q := by
        dsimp [T]
        rw [Finset.card_image_of_injOn hπ, hA]
  6. Every slope b ∈ G defines an injective linear form on T.

    Let b ∈ G and consider two points u', v' ∈ T satisfying u'.2 + b * u'.1 = v'.2 + b * v'.1. Writing u' = π(u) and v' = π(v) for u, v ∈ A via Finset.mem_image.mp, the points u and v also satisfy u.2.1 + a * u.1.1 = t = v.2.1 + a * v.1.1 by Finset.mem_filter.mp. Combining the two coordinate equalities via Prod.ext gives (u.2.1 + a * u.1.1, u.2.2 + b * u.1.2) = (v.2.1 + a * v.1.1, v.2.2 + b * v.1.2). By Finset.mem_filter.mp, b is a good slope on S, so u = v. Applying congrArg π yields u' = v', establishing injectivity on T.

    lines 49–60

    uses Finset.mem_filter.mp, Finset.mem_image.mp, congrArg, Prod.ext

      have hgood : ∀ b ∈ G, Set.InjOn (fun z : L × L => z.2+b*z.1) T := by
        intro b hb u hu v hv heq
        have hbGood := (Finset.mem_filter.mp hb).2.2
        obtain ⟨u,hu0,rfl⟩ := Finset.mem_image.mp hu
        obtain ⟨v,hv0,rfl⟩ := Finset.mem_image.mp hv
        apply congrArg π
        have huA := Finset.mem_filter.mp hu0
        have hvA := Finset.mem_filter.mp hv0
        apply hbGood huA.1 hvA.1
        apply Prod.ext
        · exact huA.2.trans hvA.2.symm
        · exact heq
  7. The set T is contained in a line in L × L, either vertical or affine.

    The set T ⊆ L × L has cardinality q, and the set G of directions injective on T has size at least (q + 1) / 2. By the direction classification hypothesis hdirL applied to T and G, T must be a line: either vertical (there is x ∈ L such that z.1 = x for all z ∈ T) or affine (there are b, t ∈ L such that z.2 + b * z.1 = t for all z ∈ T).

    line 61

      have hh := hdirL T hT ⟨G,hdense,hgood⟩
  8. The points in S on the level set F(z) = t satisfy the corresponding line equation in their L-coordinates.

    We branch on whether T is vertical or affine. Any point z ∈ S with z.2.1 + a * z.1.1 = t belongs to the fiber A by Finset.mem_filter.mpr, so its projection π(z) belongs to T by Finset.mem_image.mpr. If T is vertical with first coordinate x, then π(z).1 = z.1.2 = x. If T is an affine line with parameters b and v, then π(z).2 + b * π(z).1 = z.2.2 + b * z.1.2 = v. Both cases match the required disjunction.

    lines 62–72

    uses Finset.mem_image.mpr, Finset.mem_filter.mpr

      rcases hh with ⟨x,hx⟩ | ⟨b,v,hv⟩
      · left
        refine ⟨x, ?_⟩
        intro z hz ht
        have hmem : π z ∈ T := Finset.mem_image.mpr ⟨z,Finset.mem_filter.mpr ⟨hz,ht⟩,rfl⟩
        exact hx _ hmem
      · right
        refine ⟨b,v, ?_⟩
        intro z hz ht
        have hmem : π z ∈ T := Finset.mem_image.mpr ⟨z,Finset.mem_filter.mpr ⟨hz,ht⟩,rfl⟩
        exact hv _ hmem
Fintype.one_lt_card
A finite nontrivial type has cardinality strictly greater than 1.
Nat.div_pos
In natural division, if the divisor is positive and at most the dividend, the quotient is positive.
lt_of_lt_of_le
If a < b and b ≤ c, then a < c in a preorder.
Finset.card_pos.mp
If a finite set has strictly positive cardinality, then it is nonempty.
Finset.mem_filter.mp
An element in Finset.filter p s belongs to s and satisfies the predicate p.
good_slopes_fiber_product_saturation
For a subset S of size |ι| * |κ| where (f, g) : S → ι × κ is injective, each fiber f⁻¹(i) has size |κ| and surjects onto κ via g.
Prod.ext
Two ordered pairs are equal if their first coordinates agree and their second coordinates agree.
congrArg
Applying a function to equal arguments yields equal results: if a₁ = a₂, then f(a₁) = f(a₂).
Prod.fst
The first projection function (x, y) ↦ x for ordered pairs.
Prod.snd
The second projection function (x, y) ↦ y for ordered pairs.
Finset.card_image_of_injOn
If a function f is injective on a finite set s, then the image f(s) has the same cardinality as s.
Finset.mem_image.mp
If an element belongs to the image f(s), then it equals f(a) for some a ∈ s.
Finset.mem_image.mpr
If there exists an element a ∈ s with f(a) = b, then b belongs to the image f(s).
Finset.mem_filter.mpr
If an element belongs to s and satisfies the predicate p, then it belongs to Finset.filter p s.

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_product_dense_row_level_lines    (K L : Type*) [Field K] [Field L] [Fintype K] [Fintype L] [DecidableEq K] [DecidableEq L]    (p q : ℕ) (hp : Fintype.card K = p) (hq : Fintype.card L = q)    (hdirL : ∀ T : Finset (L × L), T.card = q →      (∃ G : Finset L, (q+1)/2 ≤ G.card ∧ ∀ b ∈ G, Set.InjOn (fun z : L × L => z.2 + b*z.1) T) →      (∃ x : L, ∀ z ∈ T, z.1 = x) ∨ (∃ b t : L, ∀ z ∈ T, z.2 + b*z.1 = t))    (S : Finset ((K × L) × (K × L))) (hcard : S.card = p*q) (a : K)    (hdense : (q+1)/2 ≤ ((Finset.univ : Finset L).filter fun b => b ≠ 0 ∧      Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) S).card) :    ∀ t : K, (S.filter fun z => z.2.1 + a*z.1.1 = t).card = q ∧      ((∃ x : L, ∀ z ∈ S, z.2.1 + a*z.1.1 = t → z.1.2 = x) ∨       (∃ b v : L, ∀ z ∈ S, z.2.1 + a*z.1.1 = t → z.2.2 + b*z.1.2 = v)) := by  classical  let G : Finset L := Finset.univ.filter fun b => b ≠ 0 ∧      Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) S  have hqpos : 1 < q := by rw [← hq]; exact Fintype.one_lt_card  have hn : 0 < (q+1)/2 := Nat.div_pos (by omega) (by decide)  have hGpos : 0 < G.card := lt_of_lt_of_le hn hdense  obtain ⟨b0,hb0⟩ := Finset.card_pos.mp hGpos  have hb0good := (Finset.mem_filter.mp hb0).2.2  let F (z : ((K × L) × (K × L))) := z.2.1 + a*z.1.1  let H (z : ((K × L) × (K × L))) := z.2.2 + b0*z.1.2  have hS : S.card = Fintype.card K * Fintype.card L := by simpa [hp,hq] using hcard  have hsat := good_slopes_fiber_product_saturation S F H hS hb0good  intro t  let A := S.filter fun z => F z = t  have hA : A.card = q := by simpa [A,hq] using (hsat t).1  refine ⟨hA, ?_⟩  let π (z : ((K × L) × (K × L))) : L × L := (z.1.2,z.2.2)  have hπ : Set.InjOn π A := by    intro u hu v hv heq    have huA := Finset.mem_filter.mp hu    have hvA := Finset.mem_filter.mp hv    apply hb0good huA.1 hvA.1    apply Prod.ext    · exact huA.2.trans hvA.2.symm    · have hx := congrArg Prod.fst heq      have hy := congrArg Prod.snd heq      dsimp [π] at hx hy      dsimp [H]      rw [hx,hy]  let T : Finset (L × L) := A.image π  have hT : T.card = q := by    dsimp [T]    rw [Finset.card_image_of_injOn hπ, hA]  have hgood : ∀ b ∈ G, Set.InjOn (fun z : L × L => z.2+b*z.1) T := by    intro b hb u hu v hv heq    have hbGood := (Finset.mem_filter.mp hb).2.2    obtain ⟨u,hu0,rfl⟩ := Finset.mem_image.mp hu    obtain ⟨v,hv0,rfl⟩ := Finset.mem_image.mp hv    apply congrArg π    have huA := Finset.mem_filter.mp hu0    have hvA := Finset.mem_filter.mp hv0    apply hbGood huA.1 hvA.1    apply Prod.ext    · exact huA.2.trans hvA.2.symm    · exact heq  have hh := hdirL T hT ⟨G,hdense,hgood⟩  rcases hh with ⟨x,hx⟩ | ⟨b,v,hv⟩  · left    refine ⟨x, ?_⟩    intro z hz ht    have hmem : π z ∈ T := Finset.mem_image.mpr ⟨z,Finset.mem_filter.mpr ⟨hz,ht⟩,rfl⟩    exact hx _ hmem  · right    refine ⟨b,v, ?_⟩    intro z hz ht    have hmem : π z ∈ T := Finset.mem_image.mpr ⟨z,Finset.mem_filter.mpr ⟨hz,ht⟩,rfl⟩    exact hv _ hmem
See it in the graphDiscuss this resultChallenge it