AFTD Auto-Formalizing Theoretical Domains

finite_field_shear_red_difference_obstruction

theoremverified

For a prime congruent to three modulo four, suppose a coloring pulled back through the scalar function x+y+x squared contains no false unit triple. If r is false and u is a nonzero coordinate of a unit vector, then r+2u squared is true.

Statement

theorem finite_field_shear_red_difference_obstruction (p : ℕ) [Fact p.Prime] (hp : p % 4 = 3)
    (c : ZMod p → Bool)
    (hred : ∀ x v : Fin 2 → ZMod p, (∑ i : Fin 2, (v i)^2) = 1 →
      ¬ ∀ k : Fin 3, c ((x 0 + (k.val : ZMod p) * v 0) +
        (x 1 + (k.val : ZMod p) * v 1) +
        (x 0 + (k.val : ZMod p) * v 0)^2) = false)
    (u v r : ZMod p) (hu : u ≠ 0) (hv : u^2 + v^2 = 1)
    (hr : c r = false) : c (r + 2 * u^2) = true
Source
OP-1482; red-difference condition for the finite-field shear route
Verified
17 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

We prove $c(r + 2u^2) = \mathrm{true}$ by contradiction: assuming $c(r + 2u^2) = \mathrm{false}$, we construct a monochromatic false unit triple along the direction $V = (u, v)$ to contradict `hred`. Since $p \equiv 3 \pmod 4$ ensures $2 \ne 0$, we can choose the scalar $a = (-u^2 - u - v)/(2u)$ so that evaluating the quadratic form $x + y + x^2$ along the affine line $(a, r - a - a^2) + k(u, v)$ yields $r + u^2(k^2 - k)$. For $k \in \{0, 1, 2\}$, this polynomial produces the values $r$, $r$, and $r + 2u^2$, all of which are colored $\mathrm{false}$, contradicting the hypothesis that no unit vector carries three consecutive $\mathrm{false}$ points.

  1. The element $2$ is nonzero in $\mathbb{Z}/p\mathbb{Z}$.

    Under classical logic, assume for contradiction that $2 = 0$ in $\mathbb{Z}/p\mathbb{Z}$. By `ZMod.natCast_eq_zero_iff`, this implies that $p$ divides $2$. Because $2 > 0$, `Nat.le_of_dvd` implies $p \le 2$. But the prime satisfies $p \equiv 3 \pmod 4$, which implies $p \ge 3$, yielding a linear arithmetic contradiction (`omega`).

    lines 9–14

    uses ZMod.natCast_eq_zero_iff, Nat.le_of_dvd

      classical
      have h2 : (2 : ZMod p) ≠ 0 := by
        intro h
        have hd : p ∣ 2 := (ZMod.natCast_eq_zero_iff 2 p).mp h
        have hle : p ≤ 2 := Nat.le_of_dvd (by decide) hd
        omega
  2. The scalar $a = (-u^2 - u - v) / (2u)$ satisfies the relation $2au = -u^2 - u - v$ in $\mathbb{Z}/p\mathbb{Z}$.

    Because $u \ne 0$ and $2 \ne 0$, the denominator $2u$ is invertible. Clearing the denominator via `field_simp` and rearranging ring terms via `ring` confirms the equality.

    lines 15–19

      let a : ZMod p := (-u^2-u-v) / (2*u)
      have ha : 2*a*u = -u^2-u-v := by
        dsimp [a]
        field_simp
        <;> ring
  3. The vector $V = (u, v)$ is a unit vector in $(\mathbb{Z}/p\mathbb{Z})^2$, satisfying $\sum_{i} (V i)^2 = 1$.

    We define the starting point $X = (a, r - a - a^2)$ and direction vector $V = (u, v)$. Unfolding the definition of $V$ and expanding the sum over the two coordinates using `Fin.sum_univ_two` reduces the claim to $u^2 + v^2 = 1$, which is given by hypothesis $hv$.

    lines 20–22

    uses Fin.sum_univ_two

      let X : Fin 2 → ZMod p := ![a, r-a-a^2]
      let V : Fin 2 → ZMod p := ![u,v]
      have hV : (∑ i : Fin 2, (V i)^2) = 1 := by simpa [V, Fin.sum_univ_two] using hv
  4. Along the affine line $X + k V$, the quadratic function $(X_0 + k V_0) + (X_1 + k V_1) + (X_0 + k V_0)^2$ simplifies to $r + u^2(k^2 - k)$ for all $k \in \mathbb{Z}/p\mathbb{Z}$.

    Evaluating the components of $X$ and $V$ at indices 0 and 1 via `Matrix.cons_val_zero` and `Matrix.cons_val_one` gives $(a + ku) + (r - a - a^2 + kv) + (a + ku)^2$. Substituting $k$ times the relation $ha$ ($2au = -u^2 - u - v$) via `linear_combination` cancels out the intermediate terms, leaving $r + u^2(k^2 - k)$.

    lines 23–27

    uses Matrix.cons_val_zero, Matrix.cons_val_one

      have hpoly (k : ZMod p) :
          (X 0 + k * V 0) + (X 1 + k * V 1) + (X 0 + k * V 0)^2 =
            r + u^2 * (k^2-k) := by
        simp only [X, V, Matrix.cons_val_zero, Matrix.cons_val_one]
        linear_combination k * ha
  5. Assuming $c(r + 2u^2) = \mathrm{false}$ yields a monochromatic false unit triple along $V$, contradicting the hypothesis `hred`.

    To show $c(r + 2u^2) = \mathrm{true}$, by `Bool.eq_true_of_not_eq_false` it suffices to show it cannot be $\mathrm{false}$. Assuming for contradiction that $c(r + 2u^2) = \mathrm{false}$, we apply the hypothesis `hred` with the point $X$ and unit vector $V$. This requires showing that all three points $k \in \{0, 1, 2\}$ color to $\mathrm{false}$. By the polynomial formula, at $k = 0$ and $k = 1$ the evaluated argument is $r$, which has color $\mathrm{false}$ by hypothesis $hr$. At $k = 2$, the argument is $r + u^2(2^2 - 2) = r + 2u^2$, which has color $\mathrm{false}$ by our contradiction hypothesis. This provides the forbidden monochromatic false unit triple and completes the proof.

    lines 28–36

    uses Bool.eq_true_of_not_eq_false

      apply Bool.eq_true_of_not_eq_false
      intro hfalse
      apply hred X V hV
      intro k
      rw [hpoly (k.val : ZMod p)]
      fin_cases k
      · simpa using hr
      · simpa using hr
      · convert hfalse using 1 <;> simp <;> ring
ZMod.natCast_eq_zero_iff
In $\mathbb{Z}/b\mathbb{Z}$, the natural number $a$ casts to $0$ if and only if $b$ divides $a$.
Nat.le_of_dvd
If a positive natural number $n$ is divisible by $m$, then $m \le n$.
Fin.sum_univ_two
The sum of a function over the two-element index set $\mathrm{Fin}\; 2$ equals $f(0) + f(1)$.
Matrix.cons_val_zero
The first element (at index $0$) of a vector formed by prepending a head to a tail vector is that head element.
Matrix.cons_val_one
The second element (at index $1$) of a vector formed by prepending a head to a tail vector is the first element of the tail vector.
Bool.eq_true_of_not_eq_false
A boolean value that is not equal to $\mathrm{false}$ must equal $\mathrm{true}$.

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

theorem finite_field_shear_red_difference_obstruction (p : ℕ) [Fact p.Prime] (hp : p % 4 = 3)    (c : ZMod p → Bool)    (hred : ∀ x v : Fin 2 → ZMod p, (∑ i : Fin 2, (v i)^2) = 1 →      ¬ ∀ k : Fin 3, c ((x 0 + (k.val : ZMod p) * v 0) +        (x 1 + (k.val : ZMod p) * v 1) +        (x 0 + (k.val : ZMod p) * v 0)^2) = false)    (u v r : ZMod p) (hu : u ≠ 0) (hv : u^2 + v^2 = 1)    (hr : c r = false) : c (r + 2 * u^2) = true := by  classical  have h2 : (2 : ZMod p) ≠ 0 := by    intro h    have hd : p ∣ 2 := (ZMod.natCast_eq_zero_iff 2 p).mp h    have hle : p ≤ 2 := Nat.le_of_dvd (by decide) hd    omega  let a : ZMod p := (-u^2-u-v) / (2*u)  have ha : 2*a*u = -u^2-u-v := by    dsimp [a]    field_simp    <;> ring  let X : Fin 2 → ZMod p := ![a, r-a-a^2]  let V : Fin 2 → ZMod p := ![u,v]  have hV : (∑ i : Fin 2, (V i)^2) = 1 := by simpa [V, Fin.sum_univ_two] using hv  have hpoly (k : ZMod p) :      (X 0 + k * V 0) + (X 1 + k * V 1) + (X 0 + k * V 0)^2 =        r + u^2 * (k^2-k) := by    simp only [X, V, Matrix.cons_val_zero, Matrix.cons_val_one]    linear_combination k * ha  apply Bool.eq_true_of_not_eq_false  intro hfalse  apply hred X V hV  intro k  rw [hpoly (k.val : ZMod p)]  fin_cases k  · simpa using hr  · simpa using hr  · convert hfalse using 1 <;> simp <;> ring
See it in the graphDiscuss this resultChallenge it