Compfiles/Usa1986P5.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 1986, Problem 5
A partition of n is an increasing sequence of integers with sum n. For example, the partitions of 5 are: 1, 1, 1, 1, 1; 1, 1, 1, 2; 1, 1, 3; 1, 4; 5; 1, 2, 2; and 2, 3. If p is a partition, f(p) = the number of 1s in p, and g(p) = the number of distinct integers in the partition. Show that ∑ f(p) = ∑ g(p), where the sum is taken over all partitions of n.
Imports (3)
Imported by 1 file
- abbrev
Usa1986P5.numPartitionsThe number of partitions ofnline 32 sourceSource documentation
The number of partitions of
n.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
NatProof uses:
Fintype.card,Nat.Partition1 instances, coercions and auxiliary constants left out.
abbrev numPartitions (n : ℕ) : ℕ := Fintype.card (Nat.Partition n)
- lemma
Usa1986P5.card_partitions_containingThe partitions ofncontainingmas a part are in bijection with the partitions ofn - m(erase one occurrence ofm), so there arenumPartitions (n - m)of them line 37 sourceSource documentation
The partitions of
ncontainingmas a part are in bijection with the partitions ofn - m(erase one occurrence ofm), so there arenumPartitions (n - m)of them.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Eq,Fintype.card,Subtype,Nat.Partition,Membership.mem,Multiset,Nat.Partition.parts, Usa1986P5.numPartitions,HSub.hSubProof uses:
Fintype.card_congr,Nat.Partition.partitionWithPartEquiv18 instances, coercions and auxiliary constants left out.
lemma card_partitions_containing (n m : ℕ) (h1 : 1 ≤ m) (h2 : m ≤ n) : Fintype.card { p : Nat.Partition n // m ∈ p.parts } = numPartitions (n - m) := …Mentions: Usa1986P5.numPartitions
- lemma
Usa1986P5.sum_count_one_succDocumented declaration: sum_count_one_succ line 45 sourceSource documentation
∑ f(p), wheref(p)is the number of1s inp, satisfies the recurrenceF(n + 1) = F(n) + π(n): erasing a1is a bijection between the partitions ofn + 1that contain a1and the partitions ofn, and partitions ofn + 1with no1contribute nothing to the sum.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Finset.sum,Nat.Partition,HAdd.hAdd,OfNat.ofNat,Finset.univ,Multiset.count,Nat.Partition.parts, Usa1986P5.numPartitionsProof uses:
Subtype,Membership.mem,Multiset,Not,Eq.symm,Fintype.sum_subtype_add_sum_subtype,Finset.sum_eq_zero,Finset,Iff.mpr,Multiset.count_eq_zero,Subtype.property,Eq.mpr,id,congrArg,add_zero,Equiv,Nat.Partition.partitionWithPartEquiv,le_refl,Nat.le_add_left,Equiv.symmand 21 more36 instances, coercions and auxiliary constants left out.
Tactic trace: 14 steps
Open to load the checked before-and-after goal states.
lemma sum_count_one_succ (n : ℕ) : ∑ p : Nat.Partition (n + 1), p.parts.count 1 = ∑ p : Nat.Partition n, p.parts.count 1 + numPartitions n := by …Mentions: Usa1986P5.numPartitions
- lemma
Usa1986P5.sum_count_oneSumming the number of1s over all partitions ofngivesπ(0) + π(1) + ⋯ + π(n - 1)line 78 sourceSource documentation
Summing the number of
1s over all partitions ofngivesπ(0) + π(1) + ⋯ + π(n - 1).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Finset.sum,Nat.Partition,Finset.univ,Multiset.count,OfNat.ofNat,Nat.Partition.parts,Finset.range, Usa1986P5.numPartitionsProof uses:
Nat.recAux,of_eq_true,Eq.trans,True,congrFun',congrArg,Singleton.singleton,Finset,Inhabited.default,Finset.sum_congr,Finset.univ_unique,Membership.mem,Multiset,Multiset.count.congr_simp,Eq.refl,Nat.Partition.partition_zero_parts,Multiset.count_eq_zero_of_notMem,Not,False,not_false_eq_trueand 7 more24 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
lemma sum_count_one (n : ℕ) : ∑ p : Nat.Partition n, p.parts.count 1 = ∑ k ∈ Finset.range n, numPartitions k := by …Mentions: Usa1986P5.numPartitions
- lemma
Usa1986P5.sum_distinct_partsSumming the number of distinct parts over all partitions ofnalso givesπ(0) + π(1) + ⋯ + π(n - 1): count the pairs(p, m)withm ∈ pin two ways line 87 sourceSource documentation
Summing the number of distinct parts over all partitions of
nalso givesπ(0) + π(1) + ⋯ + π(n - 1): count the pairs(p, m)withm ∈ pin two ways.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Finset.sum,Nat.Partition,Finset.univ,Finset.card,Multiset.toFinset,Nat.Partition.parts,Finset.range, Usa1986P5.numPartitionsProof uses:
Finset.Ico,OfNat.ofNat,HAdd.hAdd,ite,Membership.mem,Multiset,LE.le,Finset,Eq.mpr,And,LT.lt,id,congrArg,propext,Finset.mem_Ico,Nat.Partition.parts_pos,Eq.mp,Multiset.mem_toFinset,Nat.Partition.le_of_mem_parts,Finset.card_eq_sum_iteand 29 more40 instances, coercions and auxiliary constants left out.
Tactic trace: 23 steps
Open to load the checked before-and-after goal states.
lemma sum_distinct_parts (n : ℕ) : ∑ p : Nat.Partition n, p.parts.toFinset.card = ∑ k ∈ Finset.range n, numPartitions k := by …Mentions: Usa1986P5.numPartitions
- problem
Usa1986P5.usa1986_p5line 122 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Finset.sum,Nat.Partition,Finset.univ,Multiset.count,OfNat.ofNat,Nat.Partition.parts,Finset.card,Multiset.toFinsetProof uses:
Eq.mpr,Finset.range, Usa1986P5.numPartitions,id,congrArg, Usa1986P5.sum_count_one, Usa1986P5.sum_distinct_parts,Eq.refl8 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.