The CRT residue kills the shifted coordinate modulo p
Provedgpy_crtResidue_addnumber-theory
For a tuple of shifts h and divisor tuples d, e, if p is prime, p divides lcm (d j) (e j) for a coordinate j, and all coordinates whose lcm is divisible by p have congruent shifts modulo p, then the CRT residue at p plus h j is congruent to 0 modulo p. The residue is p - h j0 % p for a coordinate j0 whose lcm is divisible by p, or 0 if there is none. Formalization Note: the CRT residue definition is written out in Mathlib terms in the statement; there is no standalone crtResidue theorem, so no separate crtResidue problem is published.
Preamble
import Mathlib open Classical
Formal statement
theorem gpy_crtResidue_add {k : ℕ} {h d e : Fin k → ℕ} {p : ℕ} {j : Fin k}
(hp : Nat.Prime p) (hj : p ∣ Nat.lcm (d j) (e j))
(hcompat : ∀ j', p ∣ Nat.lcm (d j') (e j') → h j ≡ h j' [MOD p]) :
(if hex : ∃ j, p ∣ Nat.lcm (d j) (e j)
then p - h (Classical.choose hex) % p else 0) + h j ≡ 0 [MOD p] := by sorrySource
GPY good-count local evaluation, formalized from Mathlib (prime factorization of the good-pair condition)