AFTD Auto-Formalizing Theoretical Domains

finite_field_ternary_match_seven_avoids_three_seven

theoremverified

Two three-state coordinate functions color the plane over the field with seven elements by matching states, without a matching unit triple or a nonmatching unit seven-term progression.

Statement

theorem finite_field_ternary_match_seven_avoids_three_seven :
    ∃ f g : ZMod 7 → Fin 3,
      (∀ x v : Fin 2 → ZMod 7, (∑ i : Fin 2, (v i)^2) = 1 →
        ¬ ∀ k : Fin 3, f (x 0 + (k.val : ZMod 7)*v 0) =
          g (x 1 + (k.val : ZMod 7)*v 1)) ∧
      (∀ x v : Fin 2 → ZMod 7, (∑ i : Fin 2, (v i)^2) = 1 →
        ¬ ∀ k : Fin 7, f (x 0 + (k.val : ZMod 7)*v 0) ≠
          g (x 1 + (k.val : ZMod 7)*v 1))
Source
OP-1482 finite-field route; sharp boundary beyond binary separability
Verified
17 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

The theorem asserts the existence of two coordinate coloring functions $f, g: \mathbb{Z}/7\mathbb{Z} \to \{0, 1, 2\}$ such that no unit progression of length 3 satisfies $f(x_0 + k v_0) = g(x_1 + k v_1)$ for all $k \in \{0, 1, 2\}$, while every unit progression of length 7 contains at least one match $f(x_0 + k v_0) = g(x_1 + k v_1)$. The proof provides explicit tables of values for $f$ and $g$ on $\mathbb{Z}/7\mathbb{Z}$ as $(0, 1, 2, 2, 0, 2, 1)$ and $(0, 2, 1, 1, 2, 0, 1)$. Both conditions quantify over the finite configuration space of points and unit directions in $(\mathbb{Z}/7\mathbb{Z})^2$, and are verified by exhaustive computational decision procedures (`decide`).

  1. Specify explicit candidate functions $f, g: \mathbb{Z}/7\mathbb{Z} \to \{0, 1, 2\}$.

    We instantiate the existential quantifiers with explicit coordinate functions. Using `ZMod.val_lt` to view each element of $\mathbb{Z}/7\mathbb{Z}$ as an index in $\{0, \dots, 6\}$, $f$ is defined by the values $(0, 1, 2, 2, 0, 2, 1)$ and $g$ is defined by $(0, 2, 1, 1, 2, 0, 1)$. This reduces the theorem to two subgoals: verifying that no unit triple matches everywhere, and that no unit line avoids matching everywhere.

    lines 9–10

    uses ZMod.val_lt

      refine ⟨fun x => ![0,1,2,2,0,2,1] ⟨x.val, ZMod.val_lt x⟩,
        fun x => ![0,2,1,1,2,0,1] ⟨x.val, ZMod.val_lt x⟩, ?_, ?_⟩
  2. No 3-term unit progression matches under $f$ and $g$. automation

    For every point $x \in (\mathbb{Z}/7\mathbb{Z})^2$ and every unit vector $v \in (\mathbb{Z}/7\mathbb{Z})^2$ (meaning $v_0^2 + v_1^2 = 1$), there exists $k \in \{0, 1, 2\}$ such that $f(x_0 + k v_0) \neq g(x_1 + k v_1)$. Because the space of pairs $(x, v)$ is finite, this universal statement is verified by exhaustive computation via `decide`, with increased recursion depth and heartbeat limits.

    lines 11–13

      · set_option maxRecDepth 32768 in
          set_option maxHeartbeats 5000000 in
            decide
  3. Every 7-term unit progression contains at least one matching value under $f$ and $g$. automation

    For every point $x \in (\mathbb{Z}/7\mathbb{Z})^2$ and every unit vector $v$, it is false that $f(x_0 + k v_0) \neq g(x_1 + k v_1)$ for all $k \in \{0, \dots, 6\}$; that is, every affine unit line has at least one match. This finite combinatorial condition is again verified by exhaustive search using `decide`.

    lines 14–16

      · set_option maxRecDepth 32768 in
          set_option maxHeartbeats 5000000 in
            decide
ZMod.val_lt
For any non-zero natural number $n$ and any $a \in \mathbb{Z}/n\mathbb{Z}$, the canonical integer representative $a.\mathrm{val}$ satisfies $a.\mathrm{val} < n$.

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_ternary_match_seven_avoids_three_seven :    ∃ f g : ZMod 7 → Fin 3,      (∀ x v : Fin 2 → ZMod 7, (∑ i : Fin 2, (v i)^2) = 1 →        ¬ ∀ k : Fin 3, f (x 0 + (k.val : ZMod 7)*v 0) =          g (x 1 + (k.val : ZMod 7)*v 1)) ∧      (∀ x v : Fin 2 → ZMod 7, (∑ i : Fin 2, (v i)^2) = 1 →        ¬ ∀ k : Fin 7, f (x 0 + (k.val : ZMod 7)*v 0) ≠          g (x 1 + (k.val : ZMod 7)*v 1)) := by  refine ⟨fun x => ![0,1,2,2,0,2,1] ⟨x.val, ZMod.val_lt x⟩,    fun x => ![0,2,1,1,2,0,1] ⟨x.val, ZMod.val_lt x⟩, ?_, ?_⟩  · set_option maxRecDepth 32768 in      set_option maxHeartbeats 5000000 in        decide  · set_option maxRecDepth 32768 in      set_option maxHeartbeats 5000000 in        decide
See it in the graphDiscuss this resultChallenge it