Compfiles/Usa1986P5.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

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
  1. abbrev Usa1986P5.numPartitions The number of partitions of n line 32 source

    Source documentation

    The number of partitions of n.

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

    Statement uses: Nat

    Proof uses: Fintype.card, Nat.Partition

    1 instances, coercions and auxiliary constants left out.

    abbrev numPartitions (n : ℕ) : ℕ := Fintype.card (Nat.Partition n)
  2. lemma Usa1986P5.card_partitions_containing The partitions of n containing m as a part are in bijection with the partitions of n - m (erase one occurrence of m), so there are numPartitions (n - m) of them line 37 source

    Source documentation

    The partitions of n containing m as a part are in bijection with the partitions of n - m (erase one occurrence of m), so there are numPartitions (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.hSub

    Proof uses: Fintype.card_congr, Nat.Partition.partitionWithPartEquiv

    18 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

  3. lemma Usa1986P5.sum_count_one_succ Documented declaration: sum_count_one_succ line 45 source

    Source documentation

    ∑ f(p), where f(p) is the number of 1s in p, satisfies the recurrence F(n + 1) = F(n) + π(n): erasing a 1 is a bijection between the partitions of n + 1 that contain a 1 and the partitions of n, and partitions of n + 1 with no 1 contribute 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.numPartitions

    Proof 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.symm and 21 more

    36 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

  4. lemma Usa1986P5.sum_count_one Summing the number of 1s over all partitions of n gives π(0) + π(1) + ⋯ + π(n - 1) line 78 source

    Source documentation

    Summing the number of 1s over all partitions of n gives π(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.numPartitions

    Proof 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_true and 7 more

    24 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

  5. lemma Usa1986P5.sum_distinct_parts Summing the number of distinct parts over all partitions of n also gives π(0) + π(1) + ⋯ + π(n - 1): count the pairs (p, m) with m ∈ p in two ways line 87 source

    Source documentation

    Summing the number of distinct parts over all partitions of n also gives π(0) + π(1) + ⋯ + π(n - 1): count the pairs (p, m) with m ∈ p in 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.numPartitions

    Proof 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_ite and 29 more

    40 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

  6. problem Usa1986P5.usa1986_p5 line 122 source

    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.card, Multiset.toFinset

    Proof uses: Eq.mpr, Finset.range, Usa1986P5.numPartitions, id, congrArg, Usa1986P5.sum_count_one, Usa1986P5.sum_distinct_parts, Eq.refl

    8 instances, coercions and auxiliary constants left out.

    Tactic trace: 1 steps

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