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

9 declarations, 0 contain sorry, 0 declared as axioms

USA Mathematical Olympiad 2005, Problem 4

Legs L₁, L₂, L₃, L₄ of a square table each have length n, where n is a positive integer. For how many ordered 4-tuples (k₁, k₂, k₃, k₄) of nonnegative integers can we cut a piece of length kᵢ from the end of leg Lᵢ (i = 1, 2, 3, 4) and still have a stable table? (The table is stable if it can be placed so that all four of the leg ends touch the floor. Note that a cut leg of length 0 is permitted.)

Imports (6)
Imported by 1 file
  1. determine Usa2005P4.solution line 33 source

    standard axioms: propext what this means

    Statement uses: Nat

    Proof uses: HDiv.hDiv, HMul.hMul, HAdd.hAdd, OfNat.ofNat, HPow.hPow

    11 instances, coercions and auxiliary constants left out.

  2. def Usa2005P4.tuples The admissible 4-tuples, as a Finset line 52 source

    Source documentation

    The admissible 4-tuples, as a Finset.

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

    Statement uses: Nat, Finset, Prod

    Proof uses: Finset.filter, Eq, HAdd.hAdd, Prod.fst, Prod.snd, SProd.sprod, Finset.range, OfNat.ofNat

    5 instances, coercions and auxiliary constants left out.

    def tuples (n : ℕ) : Finset (ℕ × ℕ × ℕ × ℕ) :=
    …
  3. def Usa2005P4.pairCount pairCount n r counts pairs (a, b) of natural numbers with a, b ≤ n and a + b = r line 58 source

    Source documentation

    pairCount n r counts pairs (a, b) of natural numbers with a, b ≤ n and a + b = r.

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

    Statement uses: Nat

    Proof uses: Finset.card, Prod, Finset.filter, Eq, HAdd.hAdd, Prod.fst, Prod.snd, SProd.sprod, Finset, Finset.range, OfNat.ofNat

    5 instances, coercions and auxiliary constants left out.

    def pairCount (n r : ℕ) : ℕ :=
    …
  4. lemma Usa2005P4.pairCount_eq_of_le For r ≤ n, the constraint a, b ≤ n is automatic from a + b = r line 62 source

    Source documentation

    For r ≤ n, the constraint a, b ≤ n is automatic from a + b = r.

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

    Statement uses: Nat, LE.le, Eq, Usa2005P4.pairCount, HAdd.hAdd, OfNat.ofNat

    Proof uses: id, Eq.mpr, Finset.card, Prod, Finset.filter, Prod.fst, Prod.snd, SProd.sprod, Finset, Finset.range, Finset.HasAntidiagonal.antidiagonal, congrArg, Eq.symm, Finset.Nat.card_antidiagonal, Eq.rec, Eq.refl, Finset.ext, Iff, Membership.mem, Prod.mk and 5 more

    20 instances, coercions and auxiliary constants left out.

    Tactic trace: 6 steps

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

    lemma pairCount_eq_of_le {n r : ℕ} (hr : r ≤ n) : pairCount n r = r + 1 := by
    …

    Mentions: Usa2005P4.pairCount

  5. lemma Usa2005P4.pairCount_symm The symmetry (a, b) ↦ (n - a, n - b) shows pairCount n r = pairCount n (2 * n - r) line 72 source

    Source documentation

    The symmetry (a, b) ↦ (n - a, n - b) shows pairCount n r = pairCount n (2 * n - r).

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

    Statement uses: Nat, LE.le, HMul.hMul, OfNat.ofNat, Eq, Usa2005P4.pairCount, HSub.hSub

    Proof uses: id, Finset.card_bij', Prod, Finset.filter, HAdd.hAdd, Prod.fst, Prod.snd, SProd.sprod, Finset, Finset.range, Membership.mem, Prod.mk, Eq.mpr, And, LT.lt, Eq.trans, congrFun', congrArg, congr, Eq.mp and 2 more

    29 instances, coercions and auxiliary constants left out.

    Tactic trace: 26 steps

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

    lemma pairCount_symm {n r : ℕ} (hr : r ≤ 2 * n) : pairCount n r = pairCount n (2 * n - r) := by
    …

    Mentions: Usa2005P4.pairCount

  6. lemma Usa2005P4.tuples_card_eq_sum The number of admissible 4-tuples is ∑ r, (pairCount n r)^2: group the 4-tuples according to the common value r of k₁ + k₃ = k₂ + k₄ line 94 source

    Source documentation

    The number of admissible 4-tuples is ∑ r, (pairCount n r)^2: group the 4-tuples according to the common value r of k₁ + k₃ = k₂ + k₄.

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

    Statement uses: Nat, Eq, Finset.card, Prod, Usa2005P4.tuples, Finset.sum, Finset.range, HAdd.hAdd, HMul.hMul, OfNat.ofNat, HPow.hPow, Usa2005P4.pairCount

    Proof uses: Finset.filter, Prod.fst, Prod.snd, SProd.sprod, Finset, Finset.card_bij', Membership.mem, Prod.mk, Eq.mpr, And, LT.lt, id, Eq.trans, congrFun', congrArg, congr, Eq.mp, And.intro, Eq.refl, rfl and 11 more

    41 instances, coercions and auxiliary constants left out.

    Tactic trace: 32 steps

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

    lemma tuples_card_eq_sum (n : ℕ) :
        (tuples n).card = ∑ r ∈ Finset.range (2 * n + 1), (pairCount n r) ^ 2 := by
    …

    Mentions: Usa2005P4.tuples, Usa2005P4.pairCount

  7. lemma Usa2005P4.sum_pairCount_sq Evaluating the sum: the values of pairCount n r for r = 0, …, 2n are 1, 2, …, n, n + 1, n, …, 1 line 144 source

    Source documentation

    Evaluating the sum: the values of pairCount n r for r = 0, …, 2n are 1, 2, …, n, n + 1, n, …, 1.

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

    Statement uses: Nat, Eq, Finset.sum, Finset.range, HAdd.hAdd, HMul.hMul, OfNat.ofNat, HPow.hPow, Usa2005P4.pairCount

    Proof uses: Finset.Ico, Eq.mpr, id, congrArg, Eq.symm, Finset.sum_range_add_sum_Ico, LE.le, Eq.refl, Finset.sum_Ico_consecutive, Singleton.singleton, Finset, Nat.Ico_succ_singleton, Finset.sum_singleton, Finset.sum_congr, rfl, Membership.mem, Usa2005P4.pairCount_eq_of_le, Eq.mp, LT.lt, HSub.hSub and 49 more

    61 instances, coercions and auxiliary constants left out.

    Tactic trace: 24 steps

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

    lemma sum_pairCount_sq (n : ℕ) :
        ∑ r ∈ Finset.range (2 * n + 1), (pairCount n r) ^ 2 =
          2 * (∑ i ∈ Finset.range (n + 1), i ^ 2) + (n + 1) ^ 2 := by
    …

    Mentions: Usa2005P4.pairCount

  8. lemma Usa2005P4.key_arith Three times the count equals (n + 1) * (2 * n ^ 2 + 4 * n + 3) line 174 source

    Source documentation

    Three times the count equals (n + 1) * (2 * n ^ 2 + 4 * n + 3).

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

    Statement uses: Nat, Eq, HMul.hMul, OfNat.ofNat, HAdd.hAdd, Finset.sum, Finset.range, HPow.hPow

    Proof uses: Nat.recAux, of_eq_true, Eq.trans, True, congr, congrArg, Mathlib.Meta.NormNum.IsNat.to_eq, Mathlib.Meta.NormNum.isNat_mul, Eq.refl, Mathlib.Meta.NormNum.isNat_ofNat, Mathlib.Meta.NormNum.isNat_add, Eq.rec, Finset.cons, Finset.notMem_range_self, Mathlib.Meta.NormNum.IsNat, Mathlib.Meta.NormNum.isNat_pow, Mathlib.Meta.NormNum.IsNat.raw_refl, Mathlib.Meta.NormNum.zero_natPow, Finset.empty, Mathlib.Meta.NormNum.Finset.sum_empty and 49 more

    43 instances, coercions and auxiliary constants left out.

    Tactic trace: 7 steps

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

    lemma key_arith (n : ℕ) :
        3 * (2 * (∑ i ∈ Finset.range (n + 1), i ^ 2) + (n + 1) ^ 2) =
          (n + 1) * (2 * n ^ 2 + 4 * n + 3) := by
    …
  9. problem Usa2005P4.usa2005_p4 line 189 source

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

    Statement uses: Nat, Eq, Set.ncard, Prod, Set.ofPred, And, LE.le, Prod.fst, Prod.snd, HAdd.hAdd, Usa2005P4.solution

    Proof uses: Set, Finset, Usa2005P4.tuples, Set.ext, Iff, Membership.mem, Prod.mk, Eq.mpr, LT.lt, OfNat.ofNat, id, congrArg, Eq.trans, Finset.filter, SProd.sprod, Finset.range, congrFun', congr, Finset.card, Set.ncard_coe_finset and 7 more

    28 instances, coercions and auxiliary constants left out.

    Tactic trace: 8 steps

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