AFTD Auto-Formalizing Theoretical Domains

good_slopes_product_dense_row_bad_column_conditional

theoremverified

Over finite fields with p<q, if a nonzero row has at least (q+1)/2 good nonzero directions and one bad nonzero direction, then every nonzero row is bad in that same column, assuming the q-point direction classification.

Statement

theorem good_slopes_product_dense_row_bad_column_conditional
    (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) (hpq : p < 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) (ha : a ≠ 0)
    (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)
    (b : L) (hb : b ≠ 0)
    (hbad : ¬ Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) S) :
    ∀ a' : K, a' ≠ 0 → ¬ Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a'*z.1.1, z.2.2 + b*z.1.2)) S
Source
One dense row forces a bad column in OP-1027.
Verified
19 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
Used by 1

The proof, explained

To show that any other nonzero direction (a', b) in the same column is bad, we assume for contradiction that it is good (injective on S). The badness of (a, b) yields two distinct colliding points u, v ∈ S, and the existence of a good direction in row a guarantees that their first L-coordinates differ (u.1.2 ≠ v.1.2). By the classification of level sets in a dense row, the fiber Q of points with the same K-component as u has cardinality q and must lie on an affine line in L × L, which the collision of u and v forces to have slope b. This makes the second component under (a', b) constant on all of Q, so injectivity of (a', b) would force the first component to embed Q injectively into K. This would imply q = |Q| ≤ |K| = p, contradicting the hypothesis p < q.

  1. There exist two distinct points u, v ∈ S that collide under the direction (a, b), yielding equalities in both their K- and L-components.

    Because the map for direction (a, b) is not injective on S (hypothesis hbad), unpacking the negation of Set.InjOn using not_forall yields distinct points u, v ∈ S with the same image. Projecting this pair equality with congrArg onto Prod.fst and Prod.snd gives the coordinate-wise equations u.2.1 + a*u.1.1 = v.2.1 + a*v.1.1 in K (hK) and u.2.2 + b*u.1.2 = v.2.2 + b*v.1.2 in L (hL).

    lines 17–26

    uses Set.InjOn, not_forall, congrArg, Prod.fst, Prod.snd

      classical
      obtain ⟨u,hu,v,hv,heq,hne⟩ : ∃ u ∈ S, ∃ v ∈ S,
          (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) ∧ u ≠ v := by
        simp only [Set.InjOn, not_forall] at hbad
        obtain ⟨u,hu,v,hv,he,hne⟩ := hbad
        exact ⟨u,hu,v,hv,he,hne⟩
      have hK := congrArg Prod.fst heq
      have hL := congrArg Prod.snd heq
      change u.2.1+a*u.1.1 = v.2.1+a*v.1.1 at hK
      change u.2.2+b*u.1.2 = v.2.2+b*v.1.2 at hL
  2. There exists at least one nonzero direction c ∈ L such that (a, c) is good (injective on S).

    Let G be the set of nonzero good directions in row a. Since L is a nontrivial finite field, its cardinality satisfies 1 < q by Fintype.one_lt_card, which implies (q+1)/2 > 0 via Nat.div_pos. Since |G| ≥ (q+1)/2 by the density assumption hdense, we have |G| > 0 by lt_of_lt_of_le. By Finset.card_pos.mp, G is nonempty, so there exists some c ∈ G whose injectivity on S (hgood) is unpacked with Finset.mem_filter.mp.

    lines 27–33

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

      let G : Finset L := Finset.univ.filter fun c => c ≠ 0 ∧
          Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1+a*z.1.1,z.2.2+c*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 ⟨c,hc⟩ := Finset.card_pos.mp hGpos
      have hgood := (Finset.mem_filter.mp hc).2.2
  3. The colliding points have distinct first L-coordinates: u.1.2 ≠ v.1.2.

    If u.1.2 = v.1.2, then subtracting b*(u.1.2 - v.1.2) = 0 from hL shows that u.2.2 = v.2.2. Under the good direction (a, c), the images of u and v would then match in both K (by hK) and L (since u.2.2 + c*u.1.2 = v.2.2 + c*v.1.2). By Prod.ext, the two images are equal, so injectivity of (a, c) forces u = v, contradicting u ≠ v.

    lines 34–42

    uses Prod.ext

      have hdx : u.1.2 ≠ v.1.2 := by
        intro hx
        have hy : u.2.2 = v.2.2 := by linear_combination hL - b*hx
        apply hne
        apply hgood hu hv
        apply Prod.ext
        · exact hK
        · change u.2.2+c*u.1.2 = v.2.2+c*v.1.2
          rw [hx,hy]
  4. The level set Q = {z ∈ S | z.2.1 + a*z.1.1 = u.2.1 + a*u.1.1} contains u and v, has size q, and forms a line in L × L.

    Setting t = u.2.1 + a*u.1.1, both u and v belong to the fiber Q by Finset.mem_filter.mpr (using hK for v). By the level line classification theorem good_slopes_product_dense_row_level_lines, |Q| = q and Q is either a vertical line (z.1.2 is constant) or an affine line (z.2.2 + d*z.1.2 = w) in L × L.

    lines 43–48

    uses Finset.mem_filter.mpr, good_slopes_product_dense_row_level_lines

      let t : K := u.2.1+a*u.1.1
      let Q := S.filter fun z => z.2.1+a*z.1.1=t
      have huQ : u ∈ Q := Finset.mem_filter.mpr ⟨hu,rfl⟩
      have hvQ : v ∈ Q := Finset.mem_filter.mpr ⟨hv,hK.symm⟩
      have hl := good_slopes_product_dense_row_level_lines K L p q hp hq hdirL S hcard a hdense t
      have hQ : Q.card = q := hl.1
  5. On all of Q, the affine combination z.2.2 + b*z.1.2 is constant and equals u.2.2 + b*u.1.2.

    If Q were a vertical line, then u.1.2 and v.1.2 would both equal that constant, contradicting u.1.2 ≠ v.1.2; this eliminates the vertical case via False.elim. Thus Q is an affine line z.2.2 + d*z.1.2 = w. Evaluating at u and v and subtracting gives (d - b)*(u.1.2 - v.1.2) = 0 by hL. Since u.1.2 - v.1.2 ≠ 0 by sub_ne_zero.mpr, right-cancellation via mul_right_inj' proves d = b. Using Finset.mem_filter.mp, every z ∈ Q therefore satisfies z.2.2 + b*z.1.2 = w = u.2.2 + b*u.1.2.

    lines 49–63

    uses False.elim, mul_right_inj', sub_ne_zero.mpr, Finset.mem_filter.mp

      have hline : ∀ z ∈ Q, z.2.2+b*z.1.2 = u.2.2+b*u.1.2 := by
        rcases hl.2 with ⟨x,hx⟩ | ⟨d,w,hw⟩
        · have hu' := hx u hu rfl
          have hv' := hx v hv hK.symm
          exact False.elim (hdx (hu'.trans hv'.symm))
        · have hu' := hw u hu rfl
          have hv' := hw v hv hK.symm
          have hdb : d = b := by
            apply (mul_right_inj' (sub_ne_zero.mpr hdx)).mp
            linear_combination hu' - hv' - hL
          intro z hz
          have hz' := Finset.mem_filter.mp hz
          have hzw := hw z hz'.1 hz'.2
          rw [hdb] at hu' hzw
          exact hzw.trans hu'.symm
  6. For any nonzero a' ∈ K, the direction (a', b) is not injective on S.

    Suppose for contradiction that (a', b) were injective on S. Consider the map f(z) = z.2.1 + a'*z.1.1 on Q. If f(z) = f(z') for z, z' ∈ Q, then the K-components match; since z.2.2 + b*z.1.2 is constant on Q (hline), the L-components also match, so Prod.ext and injectivity of (a', b) on S force z = z'. Thus f is injective on Q. By Finset.card_image_of_injOn and Finset.card_le_univ, q = |Q| = |f(Q)| ≤ |K| = p. Finally, omega detects the contradiction between q ≤ p and p < q.

    lines 64–78

    uses Finset.mem_filter.mp, Prod.ext, Finset.card_image_of_injOn, Finset.card_le_univ

      intro a' ha' hgood'
      let f (z : ((K × L) × (K × L))) := z.2.1 + a'*z.1.1
      have hf : Set.InjOn f Q := by
        intro z hz z' hz' he
        have hzS := (Finset.mem_filter.mp hz).1
        have hz'S := (Finset.mem_filter.mp hz').1
        apply hgood' hzS hz'S
        apply Prod.ext
        · exact he
        · exact (hline z hz).trans (hline z' hz').symm
      have hle : Q.card ≤ Fintype.card K := by
        calc
          Q.card = (Q.image f).card := (Finset.card_image_of_injOn hf).symm
          _ ≤ Fintype.card K := Finset.card_le_univ _
      omega
Set.InjOn
a function f is injective on a set s if f(x) = f(y) implies x = y for all x, y ∈ s
not_forall
the negation ¬(∀ x, P x) is equivalent to ∃ x, ¬P x
congrArg
if a = b, then f(a) = f(b) for any function f
Prod.fst
the projection function extracting the first component of a pair
Prod.snd
the projection function extracting the second component of a pair
Fintype.one_lt_card
every nontrivial finite type has cardinality strictly greater than 1
Nat.div_pos
for natural numbers with b ≤ a and 0 < b, the quotient a / b is strictly positive
lt_of_lt_of_le
if a < b and b ≤ c, then a < c
Finset.card_pos.mp
a finite set has positive cardinality if and only if it is nonempty
Finset.mem_filter.mp
an element in a filtered set Finset.filter P s belongs to s and satisfies the predicate P
Prod.ext
two pairs are equal if their first components are equal and their second components are equal
Finset.mem_filter.mpr
an element belonging to s and satisfying P belongs to Finset.filter P s
good_slopes_product_dense_row_level_lines
if a nonzero row has at least (q+1)/2 good directions, each fiber of the first coordinate map on S has cardinality q and forms either a vertical line or an affine line in L × L
False.elim
from False, any proposition can be derived
mul_right_inj'
multiplication on the right by a nonzero element is injective in a structure without zero-divisors
sub_ne_zero.mpr
if x ≠ y, then x - y ≠ 0
Finset.card_image_of_injOn
if a function is injective on a finite set, the image has the same cardinality as the set
Finset.card_le_univ
the cardinality of any finset is at most the cardinality of the full finite type

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_bad_column_conditional    (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) (hpq : p < 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) (ha : a ≠ 0)    (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)    (b : L) (hb : b ≠ 0)    (hbad : ¬ Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) S) :    ∀ a' : K, a' ≠ 0 → ¬ Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a'*z.1.1, z.2.2 + b*z.1.2)) S := by  classical  obtain ⟨u,hu,v,hv,heq,hne⟩ : ∃ u ∈ S, ∃ v ∈ S,      (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) ∧ u ≠ v := by    simp only [Set.InjOn, not_forall] at hbad    obtain ⟨u,hu,v,hv,he,hne⟩ := hbad    exact ⟨u,hu,v,hv,he,hne⟩  have hK := congrArg Prod.fst heq  have hL := congrArg Prod.snd heq  change u.2.1+a*u.1.1 = v.2.1+a*v.1.1 at hK  change u.2.2+b*u.1.2 = v.2.2+b*v.1.2 at hL  let G : Finset L := Finset.univ.filter fun c => c ≠ 0 ∧      Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1+a*z.1.1,z.2.2+c*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 ⟨c,hc⟩ := Finset.card_pos.mp hGpos  have hgood := (Finset.mem_filter.mp hc).2.2  have hdx : u.1.2 ≠ v.1.2 := by    intro hx    have hy : u.2.2 = v.2.2 := by linear_combination hL - b*hx    apply hne    apply hgood hu hv    apply Prod.ext    · exact hK    · change u.2.2+c*u.1.2 = v.2.2+c*v.1.2      rw [hx,hy]  let t : K := u.2.1+a*u.1.1  let Q := S.filter fun z => z.2.1+a*z.1.1=t  have huQ : u ∈ Q := Finset.mem_filter.mpr ⟨hu,rfl⟩  have hvQ : v ∈ Q := Finset.mem_filter.mpr ⟨hv,hK.symm⟩  have hl := good_slopes_product_dense_row_level_lines K L p q hp hq hdirL S hcard a hdense t  have hQ : Q.card = q := hl.1  have hline : ∀ z ∈ Q, z.2.2+b*z.1.2 = u.2.2+b*u.1.2 := by    rcases hl.2 with ⟨x,hx⟩ | ⟨d,w,hw⟩    · have hu' := hx u hu rfl      have hv' := hx v hv hK.symm      exact False.elim (hdx (hu'.trans hv'.symm))    · have hu' := hw u hu rfl      have hv' := hw v hv hK.symm      have hdb : d = b := by        apply (mul_right_inj' (sub_ne_zero.mpr hdx)).mp        linear_combination hu' - hv' - hL      intro z hz      have hz' := Finset.mem_filter.mp hz      have hzw := hw z hz'.1 hz'.2      rw [hdb] at hu' hzw      exact hzw.trans hu'.symm  intro a' ha' hgood'  let f (z : ((K × L) × (K × L))) := z.2.1 + a'*z.1.1  have hf : Set.InjOn f Q := by    intro z hz z' hz' he    have hzS := (Finset.mem_filter.mp hz).1    have hz'S := (Finset.mem_filter.mp hz').1    apply hgood' hzS hz'S    apply Prod.ext    · exact he    · exact (hline z hz).trans (hline z' hz').symm  have hle : Q.card ≤ Fintype.card K := by    calc      Q.card = (Q.image f).card := (Finset.card_image_of_injOn hf).symm      _ ≤ Fintype.card K := Finset.card_le_univ _  omega
See it in the graphDiscuss this resultChallenge it