Documentation

LeanPool.DeadEnds.CRT

LeanPool.DeadEnds.CRT #

The modulus M = ∏_{p ∈ S} p²

Equations
Instances For

    Valid residues mod M: residues r such that for all p ∈ S, r mod p² is valid

    Equations
    Instances For

      The product of local density factors L = ∏_{p ∈ S} localDensityFactor p b T

      Equations
      Instances For

        The local valid residues for a single prime p: residues r in [0, p²) such that p² ∤ r and for all d ∈ T, p² ∤ (b * r + d).

        Equations
        Instances For
          theorem LeanPool.DeadEnds.prime_sq_coprime (p q : Nat.Primes) (hne : p ≠ q) :
          (↑p ^ 2).Coprime (↑q ^ 2)

          The list S.toList satisfies pairwise coprimality for the map p ↦ p². Uses pairwise_coprime_prime_squares and transfers the set pairwise property to the list. Mathlib's List.pairwise_of_reflexive_of_forall_ne handles this for symmetric reflexive relations, but coprimality is not reflexive (unless p² = 1). Instead we use the fact that S.toList.Nodup and the set pairwise property directly imply the list pairwise property. Specifically, uses List.Nodup.pairwise_of_set_pairwise : l.Nodup → {x | x ∈ l}.Pairwise r → List.Pairwise r l together with Finset.nodup_toList : ∀ (s : Finset α), s.toList.Nodup and Finset.coe_toList : ↑s.toList = ↑s (as sets).

          theorem LeanPool.DeadEnds.modEq_primeSquareProduct_of_forall_modEq (S : Finset Nat.Primes) (r₁ r₂ : ℕ) (h : ∀ p ∈ S, r₁ ≡ r₂ [MOD ↑p ^ 2]) :

          Congruence modulo each prime-square factor implies congruence modulo their product.

          theorem LeanPool.DeadEnds.crtMap_injective_on_range (S : Finset Nat.Primes) :
          Set.InjOn (fun (r : ℕ) (p : Nat.Primes) (_hp : p ∈ S) => r % ↑p ^ 2) {r : ℕ | r < primeSquareProduct S}

          The CRT remainder map is injective on residues below the product modulus.

          theorem LeanPool.DeadEnds.dvd_iff_mod_dvd (p : ℕ) (_hp : 0 < p ^ 2) (r : ℕ) :
          p ^ 2 ∣ r ↔ r % p ^ 2 = 0
          theorem LeanPool.DeadEnds.shifted_dvd_iff_mod (p b d r : ℕ) (_hp : 0 < p ^ 2) :
          p ^ 2 ∣ b * r + d ↔ p ^ 2 ∣ b * (r % p ^ 2) + d
          theorem LeanPool.DeadEnds.valid_iff_locally_valid (b : ℕ) (T : Finset ℕ) (S : Finset Nat.Primes) (r : ℕ) :
          (∀ p ∈ S, ¬↑p ^ 2 ∣ r ∧ ∀ d ∈ T, ¬↑p ^ 2 ∣ b * r + d) ↔ ∀ p ∈ S, ¬↑p ^ 2 ∣ r % ↑p ^ 2 ∧ ∀ d ∈ T, ¬↑p ^ 2 ∣ b * (r % ↑p ^ 2) + d

          For any prime p, p² ≠ 0. This is needed to apply Nat.chineseRemainderOfFinset. Uses Nat.Prime.pos : ∀ {p : ℕ}, Nat.Prime p → 0 < p and pow_ne_zero : ∀ {M₀ : Type u_1} [inst : MonoidWithZero M₀] {a : M₀} [NoZeroDivisors M₀] (n : ℕ), a ≠ 0 → a ^ n ≠ 0.

          theorem LeanPool.DeadEnds.crt_surjective (S : Finset Nat.Primes) (t : (p : Nat.Primes) → p ∈ S → ℕ) (ht : ∀ (p : Nat.Primes) (hp : p ∈ S), t p hp < ↑p ^ 2) :
          ∃ r < primeSquareProduct S, ∀ (p : Nat.Primes) (hp : p ∈ S), r % ↑p ^ 2 = t p hp
          theorem LeanPool.DeadEnds.crtMap_mapsTo_pi (b : ℕ) (T : Finset ℕ) (S : Finset Nat.Primes) (r : ℕ) (hr : r ∈ validResiduesMod b T S) (p : Nat.Primes) (hp : p ∈ S) :
          r % ↑p ^ 2 ∈ localValidResidues (↑p) b T
          theorem LeanPool.DeadEnds.not_dvd_of_mod_eq_not_dvd (p r f : ℕ) (_hp : 0 < p ^ 2) (hr_eq : r % p ^ 2 = f) (hf_ndiv : ¬p ^ 2 ∣ f) :
          ¬p ^ 2 ∣ r
          theorem LeanPool.DeadEnds.not_dvd_shift_of_mod_eq (p b r f d : ℕ) (_hp : 0 < p ^ 2) (hr_eq : r % p ^ 2 = f) (hf_shift : ¬p ^ 2 ∣ b * f + d) :
          ¬p ^ 2 ∣ b * r + d
          theorem LeanPool.DeadEnds.crt_inverse_mapsTo (b : ℕ) (T : Finset ℕ) (S : Finset Nat.Primes) (f : (p : Nat.Primes) → p ∈ S → ℕ) (hf : ∀ (p : Nat.Primes) (hp : p ∈ S), f p hp ∈ localValidResidues (↑p) b T) :
          ∃ r ∈ validResiduesMod b T S, ∀ (p : Nat.Primes) (hp : p ∈ S), r % ↑p ^ 2 = f p hp

          Valid residue counts factor as the product of local valid residue counts.

          A finite product of local density factors is at most one.

          theorem LeanPool.DeadEnds.dvd_iff_of_mod_eq_primeSquareProduct (S : Finset Nat.Primes) (p : Nat.Primes) (hp : p ∈ S) (N₁ N₂ : ℕ) (hmod : N₁ % primeSquareProduct S = N₂ % primeSquareProduct S) :
          ↑p ^ 2 ∣ N₁ ↔ ↑p ^ 2 ∣ N₂
          theorem LeanPool.DeadEnds.shifted_dvd_iff_of_mod_eq_primeSquareProduct (b d : ℕ) (S : Finset Nat.Primes) (p : Nat.Primes) (hp : p ∈ S) (N₁ N₂ : ℕ) (hmod : N₁ % primeSquareProduct S = N₂ % primeSquareProduct S) :
          ↑p ^ 2 ∣ b * N₁ + d ↔ ↑p ^ 2 ∣ b * N₂ + d
          theorem LeanPool.DeadEnds.condition_mod_invariant (b : ℕ) (T : Finset ℕ) (S : Finset Nat.Primes) (N₁ N₂ : ℕ) (hmod : N₁ % primeSquareProduct S = N₂ % primeSquareProduct S) :
          (∀ p ∈ S, ¬↑p ^ 2 ∣ N₁ ∧ ∀ d ∈ T, ¬↑p ^ 2 ∣ b * N₁ + d) ↔ ∀ p ∈ S, ¬↑p ^ 2 ∣ N₂ ∧ ∀ d ∈ T, ¬↑p ^ 2 ∣ b * N₂ + d