AFTD Auto-Formalizing Theoretical Domains

good_slopes_point_directions_crt_transfer

theoremverified

For coprime primes, a unit good direction on a point set over the product residue ring is equivalent under the Chinese-remainder map to nonzero component directions whose pair of affine forms is injective on the transported point set.

Statement

theorem good_slopes_point_directions_crt_transfer
    (p q : ℕ) [Fact (Nat.Prime p)] [Fact (Nat.Prime q)] (hcop : Nat.Coprime p q)
    (S : Finset (ZMod (p*q) × ZMod (p*q))) (c : ZMod (p*q)) :
    let e := ZMod.chineseRemainder hcop
    let E := Equiv.prodCongr e.toEquiv e.toEquiv
    c ∈ good_slopes_point_directions (p*q) S ↔
      (e c).1 ≠ 0 ∧ (e c).2 ≠ 0 ∧
      Set.InjOn (fun z : ((ZMod p × ZMod q) × (ZMod p × ZMod q)) =>
        (z.2.1+(e c).1*z.1.1,z.2.2+(e c).2*z.1.2)) (S.image E)
Source
CRT direction transfer for OP-1027.
Verified
19 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • good_slopes_point_directionsThe unit directions a for which the linear form y + a x is injective on a finite set of points over the residues modulo n.
Used by 3

The proof, explained

A slope c in ℤ/(pq)ℤ is defined to be a good direction on a point set S if c is invertible and the affine projection z ↦ z_2 + c z_1 is injective on S. Under the Chinese Remainder ring isomorphism e : ℤ/(pq)ℤ ≃+* ℤ/pℤ × ℤ/qℤ, invertibility of c is equivalent to both CRT components being non-zero in their respective prime fields. Furthermore, e intertwines the original affine combination with the componentwise form F, so the bijection E = e × e transfers injectivity on S directly to injectivity of F on E(S).

  1. The goal is reformulated in terms of the Chinese Remainder isomorphism e, the product bijection E = e × e, and the componentwise affine evaluation F.

    We introduce the Chinese Remainder ring isomorphism e : ℤ/(pq)ℤ ≃+* ℤ/pℤ × ℤ/qℤ and the induced product bijection E = e × e on point pairs. We define F on pairs of residues by F(z) = (z_{2,1} + (e(c))_1 z_{1,1}, z_{2,2} + (e(c))_2 z_{1,2}) and rewrite the target statement using F and the transported point set E(S).

    lines 13–19

      classical
      let e := ZMod.chineseRemainder hcop
      let E := Equiv.prodCongr e.toEquiv e.toEquiv
      let F (z : ((ZMod p × ZMod q) × (ZMod p × ZMod q))) :=
        (z.2.1+(e c).1*z.1.1,z.2.2+(e c).2*z.1.2)
      change c ∈ good_slopes_point_directions (p*q) S ↔
        (e c).1 ≠ 0 ∧ (e c).2 ≠ 0 ∧ Set.InjOn F (S.image E)
  2. An element c ∈ ℤ/(pq)ℤ is a unit if and only if both of its CRT components (e(c))_1 ∈ ℤ/pℤ and (e(c))_2 ∈ ℤ/qℤ are non-zero.

    Because e is a multiplicative equivalence (MulEquiv.isUnit_map), c is invertible if and only if e(c) is invertible in the product ring. In a product monoid, an element is invertible if and only if each component is invertible (Prod.isUnit_iff). Since p and q are prime, the quotient rings ℤ/pℤ and ℤ/qℤ are fields, where being invertible is equivalent to being non-zero (isUnit_iff_ne_zero).

    lines 20–22

    uses MulEquiv.isUnit_map, Prod.isUnit_iff, isUnit_iff_ne_zero

      have hunit : IsUnit c ↔ (e c).1 ≠ 0 ∧ (e c).2 ≠ 0 := by
        rw [← MulEquiv.isUnit_map e, Prod.isUnit_iff]
        simp only [isUnit_iff_ne_zero]
  3. For every point z, the componentwise affine form evaluated at the transported point E(z) equals the CRT image of the original affine combination: F(E(z)) = e(z_2 + c z_1).

    Unfolding the definitions, F(E(z)) is ((e(z_2))_1 + (e(c))_1 (e(z_1))_1, (e(z_2))_2 + (e(c))_2 (e(z_1))_2), which represents e(z_2) + e(c) e(z_1) in the product ring. Because e is a ring isomorphism preserving addition (map_add) and multiplication (map_mul), this equals e(z_2 + c z_1).

    lines 23–26

    uses map_add, map_mul

      have hform (z : ZMod (p*q) × ZMod (p*q)) : F (E z) = e (z.2+c*z.1) := by
        change ((e z.2).1+(e c).1*(e z.1).1,(e z.2).2+(e c).2*(e z.1).2) = e (z.2+c*z.1)
        rw [map_add,map_mul]
        rfl
  4. The affine projection z ↦ z_2 + c z_1 is injective on S if and only if F is injective on the transported point set E(S).

    We establish the equivalence in two directions: Forward: Suppose the original projection is injective on S. Let u, v ∈ E(S) satisfy F(u) = F(v). By Finset.mem_image.mp, u = E(x) and v = E(y) for points x, y ∈ S. The intertwining identity gives e(x_2 + c x_1) = e(y_2 + c y_1). Injectivity of e yields x_2 + c x_1 = y_2 + c y_1, so by injectivity on S, x = y. Applying E (congrArg) gives u = E(x) = E(y) = v. Reverse: Suppose F is injective on E(S). Let x, y ∈ S satisfy x_2 + c x_1 = y_2 + c y_1. Applying the intertwining identity gives F(E(x)) = e(x_2 + c x_1) = e(y_2 + c y_1) = F(E(y)). Since E(x), E(y) ∈ E(S) (Finset.mem_image_of_mem), injectivity of F gives E(x) = E(y), and injectivity of E concludes x = y.

    lines 27–41

    uses Finset.mem_image.mp, congrArg, Finset.mem_image_of_mem

      have hproj : Set.InjOn (fun z : ZMod (p*q) × ZMod (p*q) => z.2+c*z.1) S ↔ Set.InjOn F (S.image E) := by
        constructor
        · intro hinj u hu v hv he
          obtain ⟨x,hx,rfl⟩ := Finset.mem_image.mp hu
          obtain ⟨y,hy,rfl⟩ := Finset.mem_image.mp hv
          apply congrArg E
          apply hinj hx hy
          apply e.injective
          rw [←hform x,←hform y]
          exact he
        · intro hinj x hx y hy he
          apply E.injective
          apply hinj (Finset.mem_image_of_mem _ hx) (Finset.mem_image_of_mem _ hy)
          change x.2+c*x.1 = y.2+c*y.1 at he
          rw [hform,hform,he]
  5. A direction c is a good direction on S if and only if (e(c))_1 ≠ 0, (e(c))_2 ≠ 0, and F is injective on E(S).

    Unfolding good_slopes_point_directions and simplifying membership in the filtered universe (Finset.mem_filter, Finset.mem_univ, true_and) decomposes membership into the condition that c is a unit and the projection z ↦ z_2 + c z_1 is injective on S. Combining the unit criterion and the injectivity transfer proved above yields the bi-implication.

    lines 42–48

    uses Finset.mem_filter, Finset.mem_univ, true_and

      unfold good_slopes_point_directions
      simp only [Finset.mem_filter, Finset.mem_univ, true_and]
      constructor
      · rintro ⟨hu,hi⟩
        exact ⟨(hunit.mp hu).1,(hunit.mp hu).2,hproj.mp hi⟩
      · rintro ⟨hu,hv,hi⟩
        exact ⟨hunit.mpr ⟨hu,hv⟩,hproj.mpr hi⟩
MulEquiv.isUnit_map
An element is a unit if and only if its image under a multiplicative equivalence is a unit.
Prod.isUnit_iff
An element of a direct product monoid is a unit if and only if each of its components is a unit.
isUnit_iff_ne_zero
In a field (or group with zero), an element is a unit if and only if it is non-zero.
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).
Finset.mem_image.mp
If an element belongs to the image of a finite set under f, it is the image f(x) of some element x in that set.
congrArg
A function applied to equal arguments yields equal values: if a = b, then f(a) = f(b).
Finset.mem_image_of_mem
If an element x belongs to a finite set s, then f(x) belongs to the image Finset.image f s.
Finset.mem_filter
An element belongs to a filtered finite set if and only if it belongs to the ambient set and satisfies the predicate.
Finset.mem_univ
Every element of a finite type belongs to the universal finite set Finset.univ.
true_and
The conjunction of True with any proposition P simplifies to P.

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_point_directions_crt_transfer    (p q : ℕ) [Fact (Nat.Prime p)] [Fact (Nat.Prime q)] (hcop : Nat.Coprime p q)    (S : Finset (ZMod (p*q) × ZMod (p*q))) (c : ZMod (p*q)) :    let e := ZMod.chineseRemainder hcop    let E := Equiv.prodCongr e.toEquiv e.toEquiv    c ∈ good_slopes_point_directions (p*q) S ↔      (e c).1 ≠ 0 ∧ (e c).2 ≠ 0 ∧      Set.InjOn (fun z : ((ZMod p × ZMod q) × (ZMod p × ZMod q)) =>        (z.2.1+(e c).1*z.1.1,z.2.2+(e c).2*z.1.2)) (S.image E) := by  classical  let e := ZMod.chineseRemainder hcop  let E := Equiv.prodCongr e.toEquiv e.toEquiv  let F (z : ((ZMod p × ZMod q) × (ZMod p × ZMod q))) :=    (z.2.1+(e c).1*z.1.1,z.2.2+(e c).2*z.1.2)  change c ∈ good_slopes_point_directions (p*q) S ↔    (e c).1 ≠ 0 ∧ (e c).2 ≠ 0 ∧ Set.InjOn F (S.image E)  have hunit : IsUnit c ↔ (e c).1 ≠ 0 ∧ (e c).2 ≠ 0 := by    rw [← MulEquiv.isUnit_map e, Prod.isUnit_iff]    simp only [isUnit_iff_ne_zero]  have hform (z : ZMod (p*q) × ZMod (p*q)) : F (E z) = e (z.2+c*z.1) := by    change ((e z.2).1+(e c).1*(e z.1).1,(e z.2).2+(e c).2*(e z.1).2) = e (z.2+c*z.1)    rw [map_add,map_mul]    rfl  have hproj : Set.InjOn (fun z : ZMod (p*q) × ZMod (p*q) => z.2+c*z.1) S ↔ Set.InjOn F (S.image E) := by    constructor    · intro hinj u hu v hv he      obtain ⟨x,hx,rfl⟩ := Finset.mem_image.mp hu      obtain ⟨y,hy,rfl⟩ := Finset.mem_image.mp hv      apply congrArg E      apply hinj hx hy      apply e.injective      rw [←hform x,←hform y]      exact he    · intro hinj x hx y hy he      apply E.injective      apply hinj (Finset.mem_image_of_mem _ hx) (Finset.mem_image_of_mem _ hy)      change x.2+c*x.1 = y.2+c*y.1 at he      rw [hform,hform,he]  unfold good_slopes_point_directions  simp only [Finset.mem_filter, Finset.mem_univ, true_and]  constructor  · rintro ⟨hu,hi⟩    exact ⟨(hunit.mp hu).1,(hunit.mp hu).2,hproj.mp hi⟩  · rintro ⟨hu,hv,hi⟩    exact ⟨hunit.mpr ⟨hu,hv⟩,hproj.mpr hi⟩
See it in the graphDiscuss this resultChallenge it