Compfiles/Usa2018P3.lean

GitHub source file

Explanation legend Lean4 Domain Explanation Language (L4DEL)

L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.

L4DEL
Lean4 Domain Explanation Language

Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.

Project sources: Pinned compfiles documentation, Pinned compfiles corpus index

19 declarations, 0 contain sorry, 0 declared as axioms

USA Mathematical Olympiad 2018, Problem 3

Let n ≥ 2 be an integer, and let {a₁, ..., aₘ} denote the m = φ(n) integers less than n and relatively prime to n. Assume that every prime divisor of m also divides n. Prove that m divides a₁ᵏ + ⋯ + aₘᵏ for every positive integer k.

Imports (5)
Imported by 1 file
  1. def Usa2018P3.coprimeSet The set of integers in [0, n) that are coprime to n line 33 source

    Source documentation

    The set of integers in [0, n) that are coprime to n. For n ≥ 2 this is the set {a₁, ..., aₘ} of the problem statement.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Finset

    Proof uses: Finset.filter, Nat.Coprime, Finset.range

    1 instances, coercions and auxiliary constants left out.

    def coprimeSet (n : ℕ) : Finset ℕ := (Finset.range n).filter (Nat.Coprime n)
  2. def Usa2018P3.powSum The sum of the k-th powers of the elements of coprimeSet n line 36 source

    Source documentation

    The sum of the k-th powers of the elements of coprimeSet n.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat

    Proof uses: Finset.sum, Usa2018P3.coprimeSet, HPow.hPow

    5 instances, coercions and auxiliary constants left out.

    def powSum (n k : ℕ) : ℕ := ∑ a ∈ coprimeSet n, a ^ k

    Mentions: Usa2018P3.coprimeSet

  3. lemma Usa2018P3.mem_coprimeSet line 38 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Iff, Membership.mem, Finset, Usa2018P3.coprimeSet, And, LT.lt, Nat.Coprime

    Proof uses: of_eq_true, Eq.trans, True, congrFun', congrArg, Finset.filter, Finset.range, iff_self

    9 instances, coercions and auxiliary constants left out.

    Tactic trace: 1 steps

    Open to load the checked before-and-after goal states.

  4. lemma Usa2018P3.coprimeSet_card line 41 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Eq, Finset.card, Usa2018P3.coprimeSet, Nat.totient

    Proof uses: Eq.symm, Finset.filter, Nat.Coprime, Finset.range, Nat.totient_eq_card_coprime

    1 instances, coercions and auxiliary constants left out.

  5. lemma Usa2018P3.one_mem_coprimeSet line 44 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LE.le, OfNat.ofNat, Membership.mem, Finset, Usa2018P3.coprimeSet

    Proof uses: Eq.mpr, And, LT.lt, Nat.Coprime, id, Eq, congrArg, propext, Usa2018P3.mem_coprimeSet, And.intro, Nat.coprime_one_right

    10 instances, coercions and auxiliary constants left out.

    Tactic trace: 3 steps

    Open to load the checked before-and-after goal states.

  6. lemma Usa2018P3.powSum_pos line 48 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LE.le, OfNat.ofNat, LT.lt, Usa2018P3.powSum

    Proof uses: Membership.mem, Finset, Usa2018P3.coprimeSet, Usa2018P3.one_mem_coprimeSet, Trans.trans, HPow.hPow, of_eq_true, Eq.trans, Eq, True, congrArg, one_pow, eq_self, Finset.single_le_sum, Nat.zero_le

    33 instances, coercions and auxiliary constants left out.

    Tactic trace: 3 steps

    Open to load the checked before-and-after goal states.

  7. lemma Usa2018P3.powSum_zero line 53 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Eq, Usa2018P3.powSum, OfNat.ofNat, Nat.totient

    Proof uses: Finset.sum, Usa2018P3.coprimeSet, HPow.hPow, Finset.sum_congr, rfl, Finset, Membership.mem, pow_zero, Eq.mpr, id, congrArg, Usa2018P3.powSum.eq_1, HSMul.hSMul, Finset.card, Finset.sum_const, HMul.hMul, smul_eq_mul, mul_one, Usa2018P3.coprimeSet_card, Eq.refl

    21 instances, coercions and auxiliary constants left out.

    Tactic trace: 2 steps

    Open to load the checked before-and-after goal states.

  8. lemma Usa2018P3.coprime_mod_left' Coprimality is preserved when taking a value modulo the left argument line 59 source

    Source documentation

    Coprimality is preserved when taking a value modulo the left argument.

    standard axioms: Quot.sound, propext what this means

    Statement uses: Nat, Nat.Coprime, HMod.hMod

    Proof uses: Eq, HAdd.hAdd, HMul.hMul, HDiv.hDiv, Nat.mod_add_div, Iff.mp, Nat.coprime_add_mul_left_right, Eq.mp, congrArg, Eq.symm

    10 instances, coercions and auxiliary constants left out.

    Tactic trace: 3 steps

    Open to load the checked before-and-after goal states.

    lemma coprime_mod_left' {m x : ℕ} (h : Nat.Coprime m x) : Nat.Coprime m (x % m) := by
    …

    Mentions: h

  9. lemma Usa2018P3.add_mul_inj The map (a, h) ↦ a + n * h is injective when a, a' < n line 65 source

    Source documentation

    The map (a, h) ↦ a + n * h is injective when a, a' < n.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LT.lt, Eq, HAdd.hAdd, HMul.hMul, And

    Proof uses: HMod.hMod, congrArg, OfNat.ofNat, Eq.mp, Nat.mod_eq_of_lt, Nat.add_mul_mod_self_left, And.intro, Nat.eq_of_mul_eq_mul_left

    15 instances, coercions and auxiliary constants left out.

    Tactic trace: 7 steps

    Open to load the checked before-and-after goal states.

    lemma add_mul_inj {n a h a' h' : ℕ} (ha : a < n) (ha' : a' < n)
        (heq : a + n * h = a' + n * h') : a = a' ∧ h = h' := by
    …

    Mentions: h

  10. lemma Usa2018P3.powSum_mul_prime_of_dvd Key identity, case q ∣ n: the reduced residues mod n*q are exactly {a + n*h | a ∈ coprimeSet n, h < q} line 76 source

    Source documentation

    Key identity, case q ∣ n: the reduced residues mod n*q are exactly {a + n*h | a ∈ coprimeSet n, h < q}.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LE.le, OfNat.ofNat, Nat.Prime, Dvd.dvd, Eq, Usa2018P3.powSum, HMul.hMul, Finset.sum, Usa2018P3.coprimeSet, Finset.range, HPow.hPow, HAdd.hAdd

    Proof uses: LT.lt, Nat.Prime.pos, Finset, Finset.image, Prod, Prod.fst, Prod.snd, SProd.sprod, Finset.ext, Iff.intro, Membership.mem, Nat.Coprime, And, Eq.mp, congrArg, propext, Usa2018P3.mem_coprimeSet, Eq.mpr, Exists, id and 49 more

    54 instances, coercions and auxiliary constants left out.

    Tactic trace: 43 steps

    Open to load the checked before-and-after goal states.

    lemma powSum_mul_prime_of_dvd {n q : ℕ} (hn : 2 ≤ n) (hq : q.Prime) (hqd : q ∣ n) (k : ℕ) :
        powSum (n * q) k = ∑ a ∈ coprimeSet n, ∑ h ∈ Finset.range q, (a + n * h) ^ k := by
    …

    Mentions: Usa2018P3.powSum, Usa2018P3.coprimeSet, h

  11. lemma Usa2018P3.powSum_mul_prime_of_not_dvd Key identity, case q ∤ n: the reduced residues mod n*q are {a + n*h | a ∈ coprimeSet n, h < q} with the multiples q * a removed line 127 source

    Source documentation

    Key identity, case q ∤ n: the reduced residues mod n*q are {a + n*h | a ∈ coprimeSet n, h < q} with the multiples q * a removed.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LE.le, OfNat.ofNat, Nat.Prime, Not, Dvd.dvd, Eq, HAdd.hAdd, Usa2018P3.powSum, HMul.hMul, HPow.hPow, Finset.sum, Usa2018P3.coprimeSet, Finset.range

    Proof uses: LT.lt, Nat.Prime.pos, Nat.Coprime, Iff.mp, Nat.coprime_comm, Iff.mpr, Nat.Prime.coprime_iff_not_dvd, Finset, Finset.image, Prod, Prod.fst, Prod.snd, SProd.sprod, Union.union, Finset.ext, Iff.intro, Membership.mem, And, Exists, Eq.mp and 80 more

    75 instances, coercions and auxiliary constants left out.

    Tactic trace: 86 steps

    Open to load the checked before-and-after goal states.

    lemma powSum_mul_prime_of_not_dvd {n q : ℕ} (hn : 2 ≤ n) (hq : q.Prime) (hqd : ¬ q ∣ n) (k : ℕ) :
        powSum (n * q) k + q ^ k * powSum n k =
          ∑ a ∈ coprimeSet n, ∑ h ∈ Finset.range q, (a + n * h) ^ k := by
    …

    Mentions: Usa2018P3.powSum, Usa2018P3.coprimeSet, h

  12. lemma Usa2018P3.sum_add_pow_eq Binomial expansion of the double sum line 223 source

    Source documentation

    Binomial expansion of the double sum.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Eq, Finset.sum, Usa2018P3.coprimeSet, Finset.range, HPow.hPow, HAdd.hAdd, HMul.hMul, Usa2018P3.powSum, Nat.choose, OfNat.ofNat, HSub.hSub

    Proof uses: Eq.mpr, id, congrArg, add_comm, add_pow, Finset.sum_congr, rfl, Finset, Membership.mem, Nat.cast_id, Eq.refl, Finset.mul_sum, mul_pow, Mathlib.Tactic.Ring.of_eq, Nat.rawCast, Mathlib.Tactic.Ring.Common.mul_congr, Mathlib.Tactic.Ring.Common.pow_congr, Mathlib.Tactic.Ring.Common.atom_pf, Eq.symm, Mathlib.Tactic.Ring.Common.pow_add and 38 more

    65 instances, coercions and auxiliary constants left out.

    Tactic trace: 25 steps

    Open to load the checked before-and-after goal states.

    lemma sum_add_pow_eq (n q k : ℕ) :
        ∑ a ∈ coprimeSet n, ∑ h ∈ Finset.range q, (a + n * h) ^ k =
          q * powSum n k + ∑ j ∈ Finset.range k,
            (k.choose (j + 1)) * (n ^ (j + 1) * powSum n (k - (j + 1)) *
              ∑ h ∈ Finset.range q, h ^ (j + 1)) := by
    …

    Mentions: Usa2018P3.coprimeSet, h, Usa2018P3.powSum

  13. lemma Usa2018P3.pow_pred_dvd_powSum_prime_pow The prime power case: p^(e-1) ∣ powSum (p^e) k line 286 source

    Source documentation

    The prime power case: p^(e-1) ∣ powSum (p^e) k.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Nat.Prime, LE.le, OfNat.ofNat, Dvd.dvd, HPow.hPow, HSub.hSub, Usa2018P3.powSum

    Proof uses: Nat.le_induction, one_dvd, le_trans, Nat.Prime.two_le, Nat.le_self_pow, dvd_pow_self, Eq, HMul.hMul, Finset.sum, Usa2018P3.coprimeSet, Finset.range, HAdd.hAdd, Usa2018P3.powSum_mul_prime_of_dvd, Eq.mpr, id, congrArg, pow_succ, Nat.choose, Eq.mp, Usa2018P3.sum_add_pow_eq and 16 more

    41 instances, coercions and auxiliary constants left out.

    Tactic trace: 29 steps

    Open to load the checked before-and-after goal states.

    lemma pow_pred_dvd_powSum_prime_pow {p : ℕ} (hp : p.Prime) :
        ∀ e : ℕ, 1 ≤ e → ∀ k : ℕ, p ^ (e - 1) ∣ powSum (p ^ e) k := by
    …

    Mentions: Usa2018P3.powSum

  14. lemma Usa2018P3.sum_range_pow_eq_sum_Icc Helper: ∑ h ∈ range q, h^(j+1) = ∑ h ∈ Icc 1 (q-1), h^(j+1) line 319 source

    Source documentation

    Helper: ∑ h ∈ range q, h^(j+1) = ∑ h ∈ Icc 1 (q-1), h^(j+1).

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Eq, Finset.sum, Finset.range, HPow.hPow, HAdd.hAdd, OfNat.ofNat, Finset.Icc, HSub.hSub

    Proof uses: GT.gt, Or, Nat.eq_zero_or_pos, of_eq_true, Eq.trans, True, congrArg, Finset.sum_congr, EmptyCollection.emptyCollection, Finset, zero_tsub, Finset.Icc_eq_empty_of_lt, LT.lt, eq_self, Membership.mem, Eq.refl, Eq.symm, Nat.succ, Exists, Nat.exists_eq_succ_of_ne_zero and 14 more

    71 instances, coercions and auxiliary constants left out.

    Tactic trace: 15 steps

    Open to load the checked before-and-after goal states.

    lemma sum_range_pow_eq_sum_Icc (q j : ℕ) :
        ∑ h ∈ Finset.range q, h ^ (j + 1) = ∑ h ∈ Finset.Icc 1 (q - 1), h ^ (j + 1) := by
    …

    Mentions: h

  15. lemma Usa2018P3.pow_pred_dvd_sum_pow_Icc Corollary: p^(c-1) ∣ 1^j + ⋯ + t^j when p^c ∣ t, c ≥ 1, j ≥ 1 line 334 source

    Source documentation

    Corollary: p^(c-1) ∣ 1^j + ⋯ + t^j when p^c ∣ t, c ≥ 1, j ≥ 1.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Nat.Prime, LE.le, OfNat.ofNat, Dvd.dvd, HPow.hPow, HSub.hSub, Finset.sum, Finset.Icc

    Proof uses: Nat.le_induction, one_dvd, HAdd.hAdd, Eq.mpr, id, Eq, congrArg, Nat.add_sub_cancel, LT.lt, Nat.Prime.pos, rfl, Eq.rec, pow_pos, Eq.symm, HDiv.hDiv, HMul.hMul, Nat.mul_div_cancel', Eq.mp, Finset.filter, Not and 133 more

    126 instances, coercions and auxiliary constants left out.

    Tactic trace: 184 steps

    Open to load the checked before-and-after goal states.

    lemma pow_pred_dvd_sum_pow_Icc {p : ℕ} (hp : p.Prime) :
        ∀ c : ℕ, 1 ≤ c → ∀ t : ℕ, p ^ c ∣ t → ∀ j : ℕ, 1 ≤ j →
          p ^ (c - 1) ∣ ∑ h ∈ Finset.Icc 1 t, h ^ j := by
    …

    Mentions: h

  16. lemma Usa2018P3.padicValNat_totient_mul_prime_of_dvd line 512 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Nat.Prime, Ne, OfNat.ofNat, Dvd.dvd, Eq, padicValNat, Nat.totient, HMul.hMul

    Proof uses: Fact, Fact.mk, rfl, LE.le, one_le_padicValNat_of_dvd, HPow.hPow, pow_padicValNat_dvd, HDiv.hDiv, Eq.symm, Nat.mul_div_cancel', Eq.mp, congrArg, MulZeroClass.mul_zero, Not, HAdd.hAdd, Eq.mpr, id, pow_succ, mul_dvd_mul_left, pow_succ_padicValNat_not_dvd and 41 more

    54 instances, coercions and auxiliary constants left out.

    Tactic trace: 41 steps

    Open to load the checked before-and-after goal states.

  17. lemma Usa2018P3.padicValNat_totient_mul_prime_of_not_dvd line 559 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Nat.Prime, Ne, OfNat.ofNat, Not, Dvd.dvd, Eq, padicValNat, Nat.totient, HMul.hMul, HAdd.hAdd, HSub.hSub

    Proof uses: Fact, Fact.mk, Nat.Coprime, Nat.Coprime.symm, Iff.mpr, Nat.Prime.coprime_iff_not_dvd, LE.le, Nat.Prime.two_le, Eq.mpr, id, congrArg, Nat.totient_mul, Nat.totient_prime, padicValNat.mul, LT.lt.ne', LT.lt, Nat.totient_pos, Nat.pos_of_ne_zero, Eq.refl

    20 instances, coercions and auxiliary constants left out.

    Tactic trace: 6 steps

    Open to load the checked before-and-after goal states.

  18. lemma Usa2018P3.pow_padicValNat_totient_dvd_powSum The main claim: for p prime with p ∣ n, p ^ ν_p (φ n) ∣ powSum n k line 572 source

    Source documentation

    The main claim: for p prime with p ∣ n, p ^ ν_p (φ n) ∣ powSum n k.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Nat.Prime, LE.le, OfNat.ofNat, Dvd.dvd, HPow.hPow, padicValNat, Nat.totient, Usa2018P3.powSum

    Proof uses: Fact, Fact.mk, Nat.strong_induction_on, LT.lt, Nat.casesAuxOn, Eq.mpr, id, Eq, congrArg, Usa2018P3.powSum_zero, pow_padicValNat_dvd, Ne, rfl, one_le_padicValNat_of_dvd, HDiv.hDiv, HMul.hMul, Eq.symm, Nat.mul_div_cancel', Decidable.byContradiction, Not and 118 more

    106 instances, coercions and auxiliary constants left out.

    Tactic trace: 155 steps

    Open to load the checked before-and-after goal states.

    lemma pow_padicValNat_totient_dvd_powSum {p : ℕ} (hp : p.Prime) :
        ∀ n : ℕ, 2 ≤ n → p ∣ n → ∀ k : ℕ, p ^ padicValNat p (Nat.totient n) ∣ powSum n k := by
    …

    Mentions: Usa2018P3.powSum

  19. problem Usa2018P3.usa2018_p3 line 732 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LE.le, OfNat.ofNat, Nat.Prime, Dvd.dvd, Nat.totient, Finset.sum, Finset.filter, Nat.Coprime, Finset.range, HPow.hPow

    Proof uses: Ne, LT.lt.ne', Iff.mpr, LT.lt, Nat.totient_pos, Usa2018P3.powSum, Usa2018P3.powSum_pos, id, Eq.mpr, Finsupp, Nat.factorization, Eq, congrArg, Eq.symm, propext, Nat.factorization_prime_le_iff_dvd, Fact, Fact.mk, padicValNat, Nat.factorization_def and 9 more

    26 instances, coercions and auxiliary constants left out.

    Tactic trace: 16 steps

    Open to load the checked before-and-after goal states.