Compfiles/Usa1994P5.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
6 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 1994, Problem 5
Let |U|, σ(U) and π(U) denote the number of elements, the sum, and the product, respectively, of a finite set U of positive integers. (If U is the empty set, |U| = 0, σ(U) = 0, π(U) = 1.) Let S be a finite set of positive integers. As usual, we define (n k) = n! / (k! (n-k)!) for 0 ≤ k ≤ n and (n k) = 0 otherwise. Prove that
∑_{U ⊆ S} (-1)^{|U|} (m - σ(U) choose |S|) = π(S)
for all integers m ≥ σ(S).
Imports (11)
- Mathlib.Algebra.BigOperators.Ring.Finset
- Mathlib.Algebra.Order.BigOperators.Group.Finset
- Mathlib.Algebra.Order.Ring.Star
- Mathlib.Data.Int.ConditionallyCompleteOrder
- Mathlib.Data.Int.Star
- Mathlib.Order.ConditionallyCompleteLattice.Basic
- Mathlib.Tactic.Linarith
- Mathlib.Tactic.Linarith.Lemmas
- Mathlib.Tactic.Ring
- Mathlib.Tactic.Ring.Basic
- ProblemExtraction
Imported by 1 file
- def
Usa1994P5.altSumThe alternating sum∑_{U ⊆ s} (-1)^{|U|} (m - σ(U)).choose k, viewed as an integer line 45 sourceSource documentation
The alternating sum
∑_{U ⊆ s} (-1)^{|U|} (m - σ(U)).choose k, viewed as an integer.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Nat,IntProof uses:
Finset.sum,Finset.powerset,HMul.hMul,HPow.hPow,Neg.neg,OfNat.ofNat,Finset.card,Nat.choose,HSub.hSub14 instances, coercions and auxiliary constants left out.
def altSum (s : Finset ℕ) (k m : ℕ) : ℤ := …
- theorem
Usa1994P5.altSum_insertSplitting off the elementx: summing over subsets ofinsert x sseparates the subsets not containingxfrom those containing it line 50 sourceSource documentation
Splitting off the element
x: summing over subsets ofinsert x sseparates the subsets not containingxfrom those containing it.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Nat,Not,Membership.mem,Eq,Int, Usa1994P5.altSum,Insert.insert,HSub.hSubProof uses:
Disjoint,Finset.powerset,Finset.image,Eq.mpr,id,congrArg,propext,Finset.disjoint_left,And,Exists,False,Eq.mp,Finset.mem_image,Eq.rec,Finset.mem_insert_self,Iff.mp,LE.le,Finset.mem_powerset,Finset.erase,Finset.erase_insertand 61 more73 instances, coercions and auxiliary constants left out.
Tactic trace: 22 steps
Open to load the checked before-and-after goal states.
theorem altSum_insert {s : Finset ℕ} {x : ℕ} (hx : x ∉ s) (k m : ℕ) : altSum (insert x s) k m = altSum s k m - altSum s k (m - x) := by …Mentions: Usa1994P5.altSum
- theorem
Usa1994P5.altSum_sub_onePascal's rule applied termwise: the forward difference ofaltSum s (k+1)atmequalsaltSum s k (m-1)line 81 sourceSource documentation
Pascal's rule applied termwise: the forward difference of
altSum s (k+1)atmequalsaltSum s k (m-1).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Nat,LT.lt,Finset.sum,Eq,Int,HSub.hSub, Usa1994P5.altSum,HAdd.hAdd,OfNat.ofNatProof uses:
id,Eq.mpr,Finset.powerset,HMul.hMul,HPow.hPow,Neg.neg,Finset.card,Nat.choose,congrArg,Eq.symm,Finset.sum_sub_distrib,Finset.sum_congr,rfl,Membership.mem,mul_sub,HMul,Eq.rec,Eq.refl,LE.le,Finset.sum_le_sum_of_subsetand 57 more103 instances, coercions and auxiliary constants left out.
Tactic trace: 16 steps
Open to load the checked before-and-after goal states.
theorem altSum_sub_one (s : Finset ℕ) (k m : ℕ) (h : ∑ i ∈ s, i < m) : altSum s (k + 1) m - altSum s (k + 1) (m - 1) = altSum s k (m - 1) := by …Mentions: h, Usa1994P5.altSum
- theorem
Usa1994P5.telescopeTelescoping the forward differences overj ∈ range xline 101 sourceSource documentation
Telescoping the forward differences over
j ∈ range x.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Nat,Eq,Int,HSub.hSub, Usa1994P5.altSum,Finset.sum,Finset.range,OfNat.ofNatProof uses:
HAdd.hAdd,Finset.sum_range_sub',Eq.mpr,id,congrArg,Eq.symm,Finset.sum_congr,rfl,Membership.mem,Nat.sub_sub,Eq.refl19 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
theorem telescope (s : Finset ℕ) (k m x : ℕ) : altSum s k m - altSum s k (m - x) = ∑ j ∈ Finset.range x, (altSum s k (m - j) - altSum s k (m - j - 1)) := by …Mentions: Usa1994P5.altSum
- theorem
Usa1994P5.altSum_cardThe main identity, by induction on the finite setsline 112 sourceSource documentation
The main identity, by induction on the finite set
s.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Nat,LE.le,Finset.sum,Eq,Int, Usa1994P5.altSum,Finset.card,Finset.prodProof uses:
Finset.induction_on,EmptyCollection.emptyCollection,of_eq_true,OfNat.ofNat,Eq.trans,True,congrFun',congrArg,Singleton.singleton,HMul.hMul,HPow.hPow,Neg.neg,Nat.choose,HSub.hSub,funext,Nat.choose_zero_right,Nat.cast_one,mul_one,Finset.sum_singleton,pow_zeroand 26 more63 instances, coercions and auxiliary constants left out.
Tactic trace: 16 steps
Open to load the checked before-and-after goal states.
theorem altSum_card (s : Finset ℕ) : ∀ m : ℕ, ∑ i ∈ s, i ≤ m → altSum s s.card m = ∏ i ∈ s, (i : ℤ) := by …Mentions: Usa1994P5.altSum
- problem
Usa1994P5.usa1994_p5line 132 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Nat,Membership.mem,LT.lt,OfNat.ofNat,LE.le,Finset.sum,Eq,Int,Finset.powerset,HMul.hMul,HPow.hPow,Neg.neg,Finset.card,Nat.choose,HSub.hSub,Finset.prodProof uses:
Eq.mpr,id,congrArg,Nat.cast_prod, Usa1994P5.altSum_card47 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.