AFTD Auto-Formalizing Theoretical Domains

finite_residue_planar_coloring_lifts

theoremverified

Let K be a field with a subring A, a ring homomorphism from A to ZMod p, and the property that every unit vector in the coordinate plane over K has coordinates in A. If the coordinate plane over ZMod p has a coloring avoiding false unit r-progressions and true unit m-progressions, then the coordinate plane over K has such a coloring.

Statement

theorem finite_residue_planar_coloring_lifts (K : Type*) [Field K] (A : Subring K) (p r m : ℕ) (φ : A →+* ZMod p) (hunit : ∀ v : Fin 2 → K, (∑ i : Fin 2, (v i)^2) = 1 → ∀ i, v i ∈ A) (c₀ : (Fin 2 → ZMod p) → Bool) (hred : ∀ x v : Fin 2 → ZMod p, (∑ i : Fin 2, (v i)^2) = 1 → ¬ ∀ k : Fin r, c₀ (fun i => x i + (k.val : ZMod p) * v i) = false) (hblue : ∀ x v : Fin 2 → ZMod p, (∑ i : Fin 2, (v i)^2) = 1 → ¬ ∀ k : Fin m, c₀ (fun i => x i + (k.val : ZMod p) * v i) = true) : ∃ c : (Fin 2 → K) → Bool, (∀ x v : Fin 2 → K, (∑ i : Fin 2, (v i)^2) = 1 → ¬ ∀ k : Fin r, c (fun i => x i + (k.val : K) * v i) = false) ∧ (∀ x v : Fin 2 → K, (∑ i : Fin 2, (v i)^2) = 1 → ¬ ∀ k : Fin m, c (fun i => x i + (k.val : K) * v i) = true)
Source
OP-1482; local-to-global finite-residue coloring reduction
Verified
17 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

The strategy is to lift the coloring from (ZMod p)² to K² by partitioning the plane K² into cosets of the additive subgroup H = A². Choosing a representative for each coset allows any point x ∈ K² to be projected to its difference read(x) = x - repr([x]) in A², which is then mapped to (ZMod p)² via the ring homomorphism φ. The key observation is that every unit vector v ∈ K² has coordinates in A, so integer translations along v preserve the coset modulo H and shift read(x) by k v. Consequently, any unit arithmetic progression in K² transfers directly to a unit arithmetic progression in (ZMod p)², so avoiding monochromatic progressions in the base coloring prevents them in the lifted coloring.

  1. Let V = K² and define H to be the additive subgroup of V consisting of vectors with coordinates in A.

    We set V = K² and define H as the subset of V whose coordinates lie in A. We verify that H is an additive subgroup by showing it contains 0 and is closed under addition and negation, which follows directly from A being a subring of K.

    lines 2–9

      classical
      let V := Fin 2 → K
      let H : AddSubgroup V := {
        carrier := {x | ∀ i, x i ∈ A}
        zero_mem' := by intro i; exact A.zero_mem
        add_mem' := by intro x y hx hy i; exact A.add_mem (hx i) (hy i)
        neg_mem' := by intro x hx i; exact A.neg_mem (hx i)
      }
  2. Choose a representative for each coset in V / H, define read(x) = x - repr([x]) ∈ A², and define the lifted coloring c(x) = c₀(φ(read(x))).

    The quotient projection proj : V → V / H is surjective by QuotientAddGroup.mk'_surjective. By the axiom of choice, Classical.choose fixes a representative repr(q) for each coset q satisfying proj(repr(q)) = q via Classical.choose_spec. By QuotientAddGroup.eq_iff_sub_mem.mp, the difference x - repr(proj(x)) lies in H for every x, meaning its coordinates belong to A; this vector is designated read(x) ∈ A². The coloring c : V → Bool is then defined by applying φ coordinatewise to read(x) and evaluating c₀.

    lines 10–19

    uses QuotientAddGroup.mk'_surjective, Classical.choose_spec, QuotientAddGroup.eq_iff_sub_mem.mp

      let Q := V ⧸ H
      let proj : V → Q := QuotientAddGroup.mk' H
      have hsurj : Function.Surjective proj := QuotientAddGroup.mk'_surjective H
      let repr : Q → V := fun q => Classical.choose (hsurj q)
      have hrepr (q : Q) : proj (repr q) = q := Classical.choose_spec (hsurj q)
      have hdiff (x : V) : x - repr (proj x) ∈ H := by
        apply QuotientAddGroup.eq_iff_sub_mem.mp
        exact (hrepr (proj x)).symm
      let read (x : V) (i : Fin 2) : A := ⟨x i - repr (proj x) i, hdiff x i⟩
      let c : V → Bool := fun x => c₀ (fun i => φ (read x i))
  3. For any point x, unit vector v ∈ K², and k ∈ ℕ, the lifted coloring satisfies c(x + k v) = c₀(φ(read(x)) + k · φ(v)).

    Because v is a unit vector, its coordinates belong to A by hypothesis hunit, so the scalar multiple k v has coordinates in A and thus belongs to H. Since (x + k v) - x = k v ∈ H, QuotientAddGroup.eq_iff_sub_mem.mpr guarantees that proj(x + k v) = proj(x), so x + k v and x share the exact same coset representative. Consequently, read(x + k v) = read(x) + k v in A², which is verified in coordinates using Subtype.ext, Subring.coe_add, Subring.coe_mul, and Subring.coe_natCast. Applying the ring homomorphism φ and distributing it across operations using map_add, map_mul, and map_natCast shows that φ(read(x + k v)) = φ(read(x)) + k · φ(v), which yields the desired transfer formula upon evaluating c₀.

    lines 20–42

    uses QuotientAddGroup.eq_iff_sub_mem.mpr, Subtype.ext, Subring.coe_add, Subring.coe_mul, Subring.coe_natCast, map_add, map_mul, map_natCast

      have transfer (x v : V) (hv : (∑ i : Fin 2, (v i)^2) = 1) (k : ℕ) :
          c (fun i => x i + (k : K) * v i) =
            c₀ (fun i => φ (read x i) + (k : ZMod p) * φ (⟨v i, hunit v hv i⟩ : A)) := by
        have hk : (fun i : Fin 2 => (k : K) * v i) ∈ H := by
          intro i
          exact A.mul_mem (show ((k : A) : K) ∈ A from (k : A).property) (hunit v hv i)
        have heq : proj (fun i => x i + (k : K) * v i) = proj x := by
          apply QuotientAddGroup.eq_iff_sub_mem.mpr
          have hh : (fun i => x i + (k : K) * v i) - x = (fun i => (k : K) * v i) := by
            funext i
            change x i + (k : K) * v i - x i = (k : K) * v i
            ring
          rw [hh]
          exact hk
        dsimp only [c]
        congr 1
        funext i
        have hid : read (fun i => x i + (k : K) * v i) i =
            read x i + (k : A) * (⟨v i, hunit v hv i⟩ : A) := by
          apply Subtype.ext
          simp only [read, heq, Subring.coe_add, Subring.coe_mul, Subring.coe_natCast]
          ring
        rw [hid, map_add, map_mul, map_natCast]
  4. The coordinatewise image φ(v) of any unit vector v ∈ K² is a unit vector in (ZMod p)².

    Since ∑ᵢ vᵢ² = 1 in K and each vᵢ belongs to A, the sum of squares of the corresponding elements in A also equals 1 by Subtype.ext. Because φ is a ring homomorphism, we push φ through the sum using map_sum and through the squares using map_pow, yielding ∑ᵢ φ(vᵢ)² = φ(∑ᵢ vᵢ²) = φ(1) = 1 via map_one.

    lines 43–52

    uses Subtype.ext, map_sum, map_pow, map_one

      have mapped_unit (v : V) (hv : (∑ i : Fin 2, (v i)^2) = 1) :
          (∑ i : Fin 2, (φ (⟨v i, hunit v hv i⟩ : A))^2) = 1 := by
        have hA : (∑ i : Fin 2, ((⟨v i, hunit v hv i⟩ : A))^2) = 1 := by
          apply Subtype.ext
          simpa using hv
        calc
          _ = φ (∑ i : Fin 2, ((⟨v i, hunit v hv i⟩ : A))^2) := by
            rw [map_sum]
            simp only [map_pow]
          _ = 1 := by rw [hA, map_one]
  5. The coloring c avoids monochromatic false unit r-progressions.

    We provide c as the witness. Suppose for contradiction that there exist x, v ∈ K² with ∑ᵢ vᵢ² = 1 such that c(x + k v) = false for all k < r. By the mapped_unit lemma, φ(v) is a unit vector in (ZMod p)². By the transfer lemma, c₀(φ(read(x)) + k · φ(v)) = false for all k < r, which directly contradicts the hypothesis hred that c₀ contains no monochromatic false unit r-progressions.

    lines 53–59

      refine ⟨c, ?_, ?_⟩
      · intro x v hv hh
        apply hred (fun i => φ (read x i)) (fun i => φ (⟨v i, hunit v hv i⟩ : A)) (mapped_unit v hv)
        intro k
        have hk := hh k
        rw [transfer x v hv k.val] at hk
        exact hk
  6. The coloring c avoids monochromatic true unit m-progressions, completing the proof.

    Similarly, if an all-true unit m-progression c(x + k v) = true for all k < m existed in K², the transfer lemma and mapped_unit lemma would produce an all-true unit m-progression under c₀ in (ZMod p)², contradicting the hypothesis hblue.

    lines 60–65

      · intro x v hv hh
        apply hblue (fun i => φ (read x i)) (fun i => φ (⟨v i, hunit v hv i⟩ : A)) (mapped_unit v hv)
        intro k
        have hk := hh k
        rw [transfer x v hv k.val] at hk
        exact hk
QuotientAddGroup.mk'_surjective
The canonical quotient projection from an additive group to its quotient by a normal subgroup is surjective.
Classical.choose_spec
The witness chosen by Classical.choose satisfies the given predicate.
QuotientAddGroup.eq_iff_sub_mem.mp
Two elements project to the same quotient class only if their difference belongs to the subgroup.
QuotientAddGroup.eq_iff_sub_mem.mpr
Two elements project to the same quotient class if their difference belongs to the subgroup.
Subtype.ext
Two elements of a subtype are equal if their underlying values in the ambient type are equal.
Subring.coe_add
The coercion of a sum in a subring equals the sum of the coerced elements in the ambient ring.
Subring.coe_mul
The coercion of a product in a subring equals the product of the coerced elements in the ambient ring.
Subring.coe_natCast
The coercion of a natural number cast in a subring equals the natural number cast in the ambient ring.
map_add
A homomorphism respects addition: f(x + y) = f(x) + f(y).
map_mul
A homomorphism respects multiplication: f(x * y) = f(x) * f(y).
map_natCast
A ring homomorphism preserves natural number casts: f(n) = n.
map_sum
An additive monoid homomorphism commutes with finite sums.
map_pow
A monoid homomorphism commutes with natural number powers: f(a^n) = f(a)^n.
map_one
A monoid homomorphism maps 1 to 1.

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_residue_planar_coloring_lifts (K : Type*) [Field K] (A : Subring K) (p r m : ℕ) (φ : A →+* ZMod p) (hunit : ∀ v : Fin 2 → K, (∑ i : Fin 2, (v i)^2) = 1 → ∀ i, v i ∈ A) (c₀ : (Fin 2 → ZMod p) → Bool) (hred : ∀ x v : Fin 2 → ZMod p, (∑ i : Fin 2, (v i)^2) = 1 → ¬ ∀ k : Fin r, c₀ (fun i => x i + (k.val : ZMod p) * v i) = false) (hblue : ∀ x v : Fin 2 → ZMod p, (∑ i : Fin 2, (v i)^2) = 1 → ¬ ∀ k : Fin m, c₀ (fun i => x i + (k.val : ZMod p) * v i) = true) : ∃ c : (Fin 2 → K) → Bool, (∀ x v : Fin 2 → K, (∑ i : Fin 2, (v i)^2) = 1 → ¬ ∀ k : Fin r, c (fun i => x i + (k.val : K) * v i) = false) ∧ (∀ x v : Fin 2 → K, (∑ i : Fin 2, (v i)^2) = 1 → ¬ ∀ k : Fin m, c (fun i => x i + (k.val : K) * v i) = true) := by  classical  let V := Fin 2 → K  let H : AddSubgroup V := {    carrier := {x | ∀ i, x i ∈ A}    zero_mem' := by intro i; exact A.zero_mem    add_mem' := by intro x y hx hy i; exact A.add_mem (hx i) (hy i)    neg_mem' := by intro x hx i; exact A.neg_mem (hx i)  }  let Q := V ⧸ H  let proj : V → Q := QuotientAddGroup.mk' H  have hsurj : Function.Surjective proj := QuotientAddGroup.mk'_surjective H  let repr : Q → V := fun q => Classical.choose (hsurj q)  have hrepr (q : Q) : proj (repr q) = q := Classical.choose_spec (hsurj q)  have hdiff (x : V) : x - repr (proj x) ∈ H := by    apply QuotientAddGroup.eq_iff_sub_mem.mp    exact (hrepr (proj x)).symm  let read (x : V) (i : Fin 2) : A := ⟨x i - repr (proj x) i, hdiff x i⟩  let c : V → Bool := fun x => c₀ (fun i => φ (read x i))  have transfer (x v : V) (hv : (∑ i : Fin 2, (v i)^2) = 1) (k : ℕ) :      c (fun i => x i + (k : K) * v i) =        c₀ (fun i => φ (read x i) + (k : ZMod p) * φ (⟨v i, hunit v hv i⟩ : A)) := by    have hk : (fun i : Fin 2 => (k : K) * v i) ∈ H := by      intro i      exact A.mul_mem (show ((k : A) : K) ∈ A from (k : A).property) (hunit v hv i)    have heq : proj (fun i => x i + (k : K) * v i) = proj x := by      apply QuotientAddGroup.eq_iff_sub_mem.mpr      have hh : (fun i => x i + (k : K) * v i) - x = (fun i => (k : K) * v i) := by        funext i        change x i + (k : K) * v i - x i = (k : K) * v i        ring      rw [hh]      exact hk    dsimp only [c]    congr 1    funext i    have hid : read (fun i => x i + (k : K) * v i) i =        read x i + (k : A) * (⟨v i, hunit v hv i⟩ : A) := by      apply Subtype.ext      simp only [read, heq, Subring.coe_add, Subring.coe_mul, Subring.coe_natCast]      ring    rw [hid, map_add, map_mul, map_natCast]  have mapped_unit (v : V) (hv : (∑ i : Fin 2, (v i)^2) = 1) :      (∑ i : Fin 2, (φ (⟨v i, hunit v hv i⟩ : A))^2) = 1 := by    have hA : (∑ i : Fin 2, ((⟨v i, hunit v hv i⟩ : A))^2) = 1 := by      apply Subtype.ext      simpa using hv    calc      _ = φ (∑ i : Fin 2, ((⟨v i, hunit v hv i⟩ : A))^2) := by        rw [map_sum]        simp only [map_pow]      _ = 1 := by rw [hA, map_one]  refine ⟨c, ?_, ?_⟩  · intro x v hv hh    apply hred (fun i => φ (read x i)) (fun i => φ (⟨v i, hunit v hv i⟩ : A)) (mapped_unit v hv)    intro k    have hk := hh k    rw [transfer x v hv k.val] at hk    exact hk  · intro x v hv hh    apply hblue (fun i => φ (read x i)) (fun i => φ (⟨v i, hunit v hv i⟩ : A)) (mapped_unit v hv)    intro k    have hk := hh k    rw [transfer x v hv k.val] at hk    exact hk
See it in the graphDiscuss this resultChallenge it