Compfiles/Usa2025P5.lean
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
10 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2025, Problem 5
Find all positive integers $k$ such that: for every positive integer $n$, the sum $$\binom{n}{0}^k + \binom{n}{1}^k + \cdots + \binom{n}{n}^k$$ is divisible by $n + 1$.
Imports (7)
Imported by 1 file
- determine
Usa2025P5.solution_setline 34 sourceno axioms what this means
Statement uses:
Set,NatProof uses:
Set.ofPred,Even1 instances, coercions and auxiliary constants left out.
- lemma
Usa2025P5.sum_range_mulSplit a sum overrange (p * M)intoMblocks ofpconsecutive terms line 53 sourceSource documentation
Split a sum over
range (p * M)intoMblocks ofpconsecutive terms.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
AddCommMonoid,Nat,Eq,Finset.sum,Finset.range,HMul.hMul,HAdd.hAddProof uses:
Nat.recAux,of_eq_true,OfNat.ofNat,Eq.trans,True,congrFun',congrArg,EmptyCollection.emptyCollection,Finset,MulZeroClass.mul_zero,eq_self,Eq.mpr,id,Nat.succ,Nat.mul_succ,Finset.sum_range_add,Finset.sum_range_succ,Eq.refl18 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
lemma sum_range_mul {M' : Type*} [AddCommMonoid M'] (f : ℕ → M') (p M : ℕ) : ∑ i ∈ range (p * M), f i = ∑ m ∈ range M, ∑ r ∈ range p, f (p * m + r) := by …Mentions: f
- lemma
Usa2025P5.filter_dvd_succ_rangeThe elementsjofrange iwithp ∣ j + 1are exactly the numbersp * (ℓ + 1) - 1withℓ ∈ range (i / p)line 61 sourceSource documentation
The elements
jofrange iwithp ∣ j + 1are exactly the numbersp * (ℓ + 1) - 1withℓ ∈ range (i / p).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,Finset,Finset.filter,Dvd.dvd,HAdd.hAdd,Finset.range,Finset.image,HSub.hSub,HMul.hMul,HDiv.hDivProof uses:
Finset.ext,Eq.mpr,Iff,Membership.mem,And,Exists,id,congr,congrArg,Eq.trans,congrFun',funext,Iff.intro,LE.le,GT.gt,Or,Nat.eq_zero_or_pos,absurd,Eq.mp,MulZeroClass.mul_zeroand 17 more54 instances, coercions and auxiliary constants left out.
Tactic trace: 36 steps
Open to load the checked before-and-after goal states.
lemma filter_dvd_succ_range (p i : ℕ) (hp : 0 < p) : (range i).filter (fun j => p ∣ j + 1) = (range (i / p)).image (fun ℓ => p * (ℓ + 1) - 1) := by … - lemma
Usa2025P5.injOn_mul_succ_sub_oneThe mapℓ ↦ p * (ℓ + 1) - 1is injective onrange Mline 93 sourceSource documentation
The map
ℓ ↦ p * (ℓ + 1) - 1is injective onrange M.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Set.InjOn,HSub.hSub,HMul.hMul,HAdd.hAdd,Finset,Finset.rangeProof uses:
Membership.mem,Set,Eq,Nat.mul_pos,Nat.succ_pos,Nat.mul_left_cancel23 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
lemma injOn_mul_succ_sub_one (p M : ℕ) (hp : 0 < p) : Set.InjOn (fun ℓ => p * (ℓ + 1) - 1) ↑(range M) := by … - lemma
Usa2025P5.choose_mul_prod_filter_eqSplitting `n.choose i * (i)! line 107 sourceSource documentation
Splitting
n.choose i * (i)! = ∏ j ∈ range i, (n - j)into the factors withp ∣ j + 1and those withp ∤ j + 1, and cancelling the common factorp ^ (i / p) * (i / p)!, givesn.choose i * P = (M - 1).choose (i / p) * R, whereP = ∏ j, (j + 1)andR = ∏ j, (n - j)are the products over thej < iwithp ∤ j + 1.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,HMul.hMul,HAdd.hAdd,LE.le,Nat.choose,Finset.prod,Finset.filter,Not,Dvd.dvd,Finset.range,HSub.hSub,HDiv.hDivProof uses:
Eq.mpr,Finset.image,id,congrArg,Finset, Usa2025P5.filter_dvd_succ_range,Finset.prod_image, Usa2025P5.injOn_mul_succ_sub_one,Eq.refl,Nat.factorial,Nat.descFactorial,Nat.descFactorial_eq_factorial_mul_choose,Eq.mp,Nat.descFactorial_eq_prod_range,mul_comm,Nat.factorial_eq_prod_range_add_one,Finset.prod_filter_mul_prod_filter_not,HPow.hPow,Trans.simple,Finset.prod_congrand 47 more70 instances, coercions and auxiliary constants left out.
Tactic trace: 45 steps
Open to load the checked before-and-after goal states.
lemma choose_mul_prod_filter_eq {p n M i : ℕ} (hp : 0 < p) (hM : p * M = n + 1) (hi : i ≤ n) : n.choose i * ∏ j ∈ (range i).filter (fun j => ¬ p ∣ j + 1), (j + 1) = (M - 1).choose (i / p) * ∏ j ∈ (range i).filter (fun j => ¬ p ∣ j + 1), (n - j) := by … - lemma
Usa2025P5.choose_cast_zmodThe key congruence: if the prime powerp ^ edividesn + 1andp * M = n + 1, thenn.choose i ≡ (-1) ^ (i - i / p) * (M - 1).choose (i / p)modulop ^ eline 169 sourceSource documentation
The key congruence: if the prime power
p ^ edividesn + 1andp * M = n + 1, thenn.choose i ≡ (-1) ^ (i - i / p) * (M - 1).choose (i / p)modulop ^ e.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Nat.Prime,LE.le,OfNat.ofNat,Dvd.dvd,HPow.hPow,HAdd.hAdd,Eq,HMul.hMul,ZMod,Nat.choose,Neg.neg,HSub.hSub,HDiv.hDivProof uses:
Iff.mpr,ZMod.natCast_eq_zero_iff,Finset.prod,Finset.filter,Not,Finset.range, Usa2025P5.choose_mul_prod_filter_eq,Nat.Prime.pos,Finset.card,Finset.card_filter_add_card_filter_not,Eq.mp,congrArg,Nat.card_multiples,Finset.card_range,Membership.mem,Finset,le_trans,Nat.le_of_lt,Iff.mp,LT.ltand 79 more113 instances, coercions and auxiliary constants left out.
Tactic trace: 32 steps
Open to load the checked before-and-after goal states.
lemma choose_cast_zmod {p e n M i : ℕ} (hp : p.Prime) (he : 1 ≤ e) (hdvd : p ^ e ∣ n + 1) (hM : p * M = n + 1) (hi : i ≤ n) : ((n.choose i : ℕ) : ZMod (p ^ e)) = (-1) ^ (i - i / p) * (((M - 1).choose (i / p) : ℕ) : ZMod (p ^ e)) := by … - lemma
Usa2025P5.sum_modEqDocumented declaration: sum_modEq line 221 sourceSource documentation
Summing the key congruence over blocks of
pconsecutive indices: ifkis even,p ^ e ∣ n + 1andp * M = n + 1, then∑ i, (n.choose i) ^ k ≡ p * ∑ m, ((M - 1).choose m) ^ kmodulop ^ e.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Nat.Prime,LE.le,OfNat.ofNat,Dvd.dvd,HPow.hPow,HAdd.hAdd,Even,Eq,HMul.hMul,Nat.ModEq,Finset.sum,Finset.range,Nat.choose,HSub.hSubProof uses:
Eq.mpr,ZMod,id,congrArg,Eq.symm,propext,ZMod.natCast_eq_natCast_iff,congr,Eq.trans,Nat.cast_sum,Finset.sum_congr,Eq.refl,Finset,Membership.mem,Nat.cast_pow,Nat.cast_mul,Trans.trans, Usa2025P5.sum_range_mul,rfl,mul_le_mul_rightand 24 more93 instances, coercions and auxiliary constants left out.
Tactic trace: 25 steps
Open to load the checked before-and-after goal states.
lemma sum_modEq {p e n M k : ℕ} (hp : p.Prime) (he : 1 ≤ e) (hdvd : p ^ e ∣ n + 1) (hk : Even k) (hM : p * M = n + 1) : (∑ i ∈ range (n + 1), (n.choose i) ^ k) ≡ p * (∑ m ∈ range M, ((M - 1).choose m) ^ k) [MOD p ^ e] := by … - lemma
Usa2025P5.dvd_sum_of_evenSufficiency: for evenk,n + 1divides∑ i ∈ range (n + 1), (n.choose i) ^ kfor every positivenline 266 sourceSource documentation
Sufficiency: for even
k,n + 1divides∑ i ∈ range (n + 1), (n.choose i) ^ kfor every positiven. Proof by strong induction onn: for each primepwithp ^ eexactly dividingn + 1,sum_modEqreduces the claim modulop ^ eto the induction hypothesis atM - 1, wherep * M = n + 1.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Even,LT.lt,OfNat.ofNat,Dvd.dvd,HAdd.hAdd,Finset.sum,Finset.range,HPow.hPow,Nat.chooseProof uses:
Nat.strong_induction_on,Ne,Eq,Eq.mpr,id,congrArg,Nat.choose_zero_right,one_pow,Eq.refl,LE.le,Finset.single_le_sum,Membership.mem,Finset,Nat.zero_le,Iff.mpr,Finset.mem_range,Finsupp,Nat.factorization,Eq.symm,propextand 41 more64 instances, coercions and auxiliary constants left out.
Tactic trace: 68 steps
Open to load the checked before-and-after goal states.
lemma dvd_sum_of_even {k : ℕ} (hk : Even k) (n : ℕ) : 0 < n → (n + 1) ∣ ∑ i ∈ range (n + 1), (n.choose i) ^ k := by … - lemma
Usa2025P5.even_of_dvdNecessity: takingn = 2, the divisibility3 ∣ 2 + 2 ^ kforceskto be even line 325 sourceSource documentation
Necessity: taking
n = 2, the divisibility3 ∣ 2 + 2 ^ kforceskto be even.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Dvd.dvd,HAdd.hAdd,Finset.sum,Finset.range,HPow.hPow,Nat.choose,EvenProof uses:
Decidable.byContradiction,Not,Eq,Finset.sum_range_zero,Finset.sum_range_one,Eq.mpr,id,congrArg,rfl,Finset.sum_range_succ,Eq.refl,Nat.choose_zero_right,Nat.choose_one_right,Nat.choose_self,one_pow,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,HMul.hMul,Mathlib.Tactic.Ring.Common.add_congr,Mathlib.Tactic.Ring.cast_posand 39 more82 instances, coercions and auxiliary constants left out.
Tactic trace: 20 steps
Open to load the checked before-and-after goal states.
lemma even_of_dvd {k : ℕ} (h : ∀ n : ℕ, 0 < n → (n + 1) ∣ ∑ i ∈ range (n + 1), (n.choose i) ^ k) : Even k := by …Mentions: h
- problem
Usa2025P5.usa2025_p5line 351 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Iff,Membership.mem,Set, Usa2025P5.solution_set,Dvd.dvd,HAdd.hAdd,Finset.sum,Finset.range,HPow.hPow,Nat.chooseProof uses:
Iff.intro, Usa2025P5.dvd_sum_of_even, Usa2025P5.even_of_dvd22 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.