Compfiles/Usa2005P4.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
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
- determine
Usa2005P4.solutionline 33 sourcestandard axioms: propext what this means
Statement uses:
NatProof uses:
HDiv.hDiv,HMul.hMul,HAdd.hAdd,OfNat.ofNat,HPow.hPow11 instances, coercions and auxiliary constants left out.
- def
Usa2005P4.tuplesThe admissible 4-tuples, as aFinsetline 52 sourceSource documentation
The admissible 4-tuples, as a
Finset.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset,ProdProof uses:
Finset.filter,Eq,HAdd.hAdd,Prod.fst,Prod.snd,SProd.sprod,Finset.range,OfNat.ofNat5 instances, coercions and auxiliary constants left out.
def tuples (n : ℕ) : Finset (ℕ × ℕ × ℕ × ℕ) := …
- def
Usa2005P4.pairCountpairCount n rcounts pairs(a, b)of natural numbers witha, b ≤ nanda + b = rline 58 sourceSource documentation
pairCount n rcounts pairs(a, b)of natural numbers witha, b ≤ nanda + b = r.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
NatProof uses:
Finset.card,Prod,Finset.filter,Eq,HAdd.hAdd,Prod.fst,Prod.snd,SProd.sprod,Finset,Finset.range,OfNat.ofNat5 instances, coercions and auxiliary constants left out.
def pairCount (n r : ℕ) : ℕ := …
- lemma
Usa2005P4.pairCount_eq_of_leForr ≤ n, the constrainta, b ≤ nis automatic froma + b = rline 62 sourceSource documentation
For
r ≤ n, the constrainta, b ≤ nis automatic froma + b = r.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,Eq, Usa2005P4.pairCount,HAdd.hAdd,OfNat.ofNatProof 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.mkand 5 more20 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
- lemma
Usa2005P4.pairCount_symmThe symmetry(a, b) ↦ (n - a, n - b)showspairCount n r = pairCount n (2 * n - r)line 72 sourceSource documentation
The symmetry
(a, b) ↦ (n - a, n - b)showspairCount 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.hSubProof 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.mpand 2 more29 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
- lemma
Usa2005P4.tuples_card_eq_sumThe number of admissible 4-tuples is∑ r, (pairCount n r)^2: group the 4-tuples according to the common valuerofk₁ + k₃ = k₂ + k₄line 94 sourceSource documentation
The number of admissible 4-tuples is
∑ r, (pairCount n r)^2: group the 4-tuples according to the common valuerofk₁ + 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.pairCountProof 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,rfland 11 more41 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
- lemma
Usa2005P4.sum_pairCount_sqEvaluating the sum: the values ofpairCount n rforr = 0, …, 2nare1, 2, …, n, n + 1, n, …, 1line 144 sourceSource documentation
Evaluating the sum: the values of
pairCount n rforr = 0, …, 2nare1, 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.pairCountProof 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.hSuband 49 more61 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
- lemma
Usa2005P4.key_arithThree times the count equals(n + 1) * (2 * n ^ 2 + 4 * n + 3)line 174 sourceSource 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.hPowProof 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_emptyand 49 more43 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 … - problem
Usa2005P4.usa2005_p4line 189 sourcestandard 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.solutionProof 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_finsetand 7 more28 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.