Compfiles/Usa1979P3.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
13 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 1979, Problem 3
$a_1, a_2, \dots, a_n$ is an arbitrary sequence of positive integers. A member of the sequence is picked at random. Its value is $a$. Another member is picked at random, independently of the first. Its value is $b$. Then a third, value $c$. Show that the probability that $a + b + c$ is divisible by $3$ is at least $1 / 4$.
Imports (9)
Imported by 1 file
- def
Usa1979P3.resThe residue ofa imodulo3line 37 sourceSource documentation
The residue of
a imodulo3.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,ZMod,OfNat.ofNat10 instances, coercions and auxiliary constants left out.
def res {n : ℕ} (a : Fin n → ℕ) (i : Fin n) : ZMod 3 := (a i : ZMod 3) - def
Usa1979P3.cntThe number of entries ofahaving residuexmodulo3line 40 sourceSource documentation
The number of entries of
ahaving residuexmodulo3.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,ZMod,OfNat.ofNatProof uses:
Finset.card,Finset.filter,Eq, Usa1979P3.res,Finset.univ4 instances, coercions and auxiliary constants left out.
def cnt {n : ℕ} (a : Fin n → ℕ) (x : ZMod 3) : ℕ := … - def
Usa1979P3.patternsThe "good" residue patterns: triples of residues that sum to0line 44 sourceSource documentation
The "good" residue patterns: triples of residues that sum to
0.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Fin,OfNat.ofNat,Nat,ZModProof uses:
Finset.filter,Eq,HAdd.hAdd,Finset.univ20 instances, coercions and auxiliary constants left out.
def patterns : Finset (Fin 3 → ZMod 3) := univ.filter fun u ↦ u 0 + u 1 + u 2 = 0 …
- lemma
Usa1979P3.dvd_iff_resDivisibility by3in terms of residues inZMod 3line 49 sourceSource documentation
Divisibility by
3in terms of residues inZMod 3.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Iff,Dvd.dvd,OfNat.ofNat,HAdd.hAdd,Eq,ZModProof uses:
Eq.mpr,id,congrArg,Eq.symm,propext,ZMod.natCast_eq_zero_iff,Nat.cast_add,Iff.rfl46 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
lemma dvd_iff_res {x y z : ℕ} : 3 ∣ x + y + z ↔ (x : ZMod 3) + (y : ZMod 3) + (z : ZMod 3) = 0 := by … - lemma
Usa1979P3.sum_univ_zmod3Summing overZMod 3gives three terms line 54 sourceSource documentation
Summing over
ZMod 3gives three terms.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
ZMod,OfNat.ofNat,Nat,Eq,Finset.sum,Finset.univ,HAdd.hAddProof uses:
Fin.sum_univ_three25 instances, coercions and auxiliary constants left out.
lemma sum_univ_zmod3 (f : ZMod 3 → ℕ) : ∑ x : ZMod 3, f x = f 0 + f 1 + f 2 := …
Mentions: f
- lemma
Usa1979P3.cnt_sumThe residues splitFin ninto the three fibers ofres aline 58 sourceSource documentation
The residues split
Fin ninto the three fibers ofres a.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Eq,HAdd.hAdd, Usa1979P3.cnt,OfNat.ofNat,ZModProof uses:
Finset.card,Finset.univ,Finset.sum,Finset.filter, Usa1979P3.res,Finset.card_eq_sum_card_fiberwise,Membership.mem,Set,Finset,Finset.mem_univ,Eq.symm,Eq.mp,Fintype.card,congrArg,Fintype.card_fin,Finset.card_univ, Usa1979P3.sum_univ_zmod349 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
lemma cnt_sum {n : ℕ} (a : Fin n → ℕ) : cnt a 0 + cnt a 1 + cnt a 2 = n := by …Mentions: Usa1979P3.cnt
- lemma
Usa1979P3.fiber_cardThe fiber of triples with prescribed residues is a product of fibers line 67 sourceSource documentation
The fiber of triples with prescribed residues is a product of fibers.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,OfNat.ofNat,ZMod,Eq,Finset.card,Finset.filter, Usa1979P3.res,Finset.univ,Finset.prod, Usa1979P3.cntProof uses:
Finset,Fintype.piFinset,Finset.ext,of_eq_true,Iff,Membership.mem,Eq.trans,True,congr,congrArg,And,congrFun',true_and,forall_congr,iff_self,Eq.mpr,id,Fintype.card_piFinset,Eq.refl19 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
lemma fiber_card {n : ℕ} (a : Fin n → ℕ) (u : Fin 3 → ZMod 3) : (univ.filter fun t : Fin 3 → Fin n ↦ ∀ j, res a (t j) = u j).card = ∏ j, cnt a (u j) := by …Mentions: Usa1979P3.res, Usa1979P3.cnt
- lemma
Usa1979P3.good_cardThe number of good triples, grouped by their residue pattern line 78 sourceSource documentation
The number of good triples, grouped by their residue pattern.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Eq,Fintype.card,Subtype,OfNat.ofNat,Dvd.dvd,HAdd.hAdd,Finset.sum,ZMod, Usa1979P3.patterns,Finset.prod,Finset.univ, Usa1979P3.cntProof uses:
Membership.mem,Finset,Finset.filter, Usa1979P3.res,id,Eq.mpr,congrArg,Eq.symm,propext, Usa1979P3.dvd_iff_res,Eq.mp,Eq.trans,And,True,congrFun',true_and,of_eq_true,congr,eq_self,and_selfand 16 more54 instances, coercions and auxiliary constants left out.
Tactic trace: 27 steps
Open to load the checked before-and-after goal states.
lemma good_card {n : ℕ} (a : Fin n → ℕ) : Fintype.card {t : Fin 3 → Fin n // 3 ∣ a (t 0) + a (t 1) + a (t 2)} = ∑ u ∈ patterns, ∏ j, cnt a (u j) := by …Mentions: Usa1979P3.patterns, Usa1979P3.cnt
- lemma
Usa1979P3.sum_over_patternsSumming over the good patterns by reindexing with the first two entries line 111 sourceSource documentation
Summing over the good patterns by reindexing with the first two entries.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fin,OfNat.ofNat,Nat,ZMod,Eq,Finset.sum, Usa1979P3.patterns,Prod,Finset.univ,Matrix.vecCons,Prod.fst,Prod.snd,Neg.neg,HAdd.hAdd,Matrix.vecEmptyProof uses:
Finset.sum_bij,Membership.mem,Finset,Prod.mk,Finset.mem_univ,funext,And.right,Iff.mp,Finset.filter,And,Finset.mem_filter,congrArg,List,List.Mem,List.finRange,HEq,Fintype.elems,Fintype.complete,List.cons,List.Mem.headand 71 more93 instances, coercions and auxiliary constants left out.
Tactic trace: 47 steps
Open to load the checked before-and-after goal states.
lemma sum_over_patterns (F : (Fin 3 → ZMod 3) → ℕ) : ∑ u ∈ patterns, F u = ∑ p : ZMod 3 × ZMod 3, F ![p.1, p.2, -(p.1 + p.2)] := by …Mentions: Usa1979P3.patterns
- lemma
Usa1979P3.pattern_sumThe good triple count in terms of the residue counts line 150 sourceSource documentation
The good triple count in terms of the residue counts.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
ZMod,OfNat.ofNat,Nat,Eq,Finset.sum,Fin, Usa1979P3.patterns,Finset.prod,Finset.univ,HAdd.hAdd,HPow.hPow,HMul.hMulProof uses:
Eq.mpr,Prod,Matrix.vecCons,Prod.fst,Prod.snd,Neg.neg,Matrix.vecEmpty,id,congrArg, Usa1979P3.sum_over_patterns,Prod.mk,Fintype.sum_prod_type,congrFun',Finset.sum_congr,Eq.refl,Finset,Membership.mem,Eq.trans,Finset.prod_congr,Fin.prod_univ_threeand 43 more85 instances, coercions and auxiliary constants left out.
Tactic trace: 24 steps
Open to load the checked before-and-after goal states.
lemma pattern_sum (c : ZMod 3 → ℕ) : ∑ u ∈ patterns, ∏ j, c (u j) = c 0 ^ 3 + c 1 ^ 3 + c 2 ^ 3 + 6 * (c 0 * c 1 * c 2) := by …Mentions: Usa1979P3.patterns
- lemma
Usa1979P3.ineq_maxThe key inequality in the case wherexis a maximum ofx, y, zline 171 sourceSource documentation
The key inequality in the case where
xis a maximum ofx, y, z.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Real,LE.le,OfNat.ofNat,HPow.hPow,Nat,HAdd.hAdd,HMul.hMulProof uses:
add_nonneg,HSub.hSub,le_of_not_gt,LT.lt,Mathlib.Tactic.Linarith.lt_irrefl,Eq.mp,congrArg,Mathlib.Tactic.Ring.of_eq,Mathlib.Tactic.Ring.Common.add_congr,Nat.rawCast,Int.rawCast,inferInstance,Ring,Int.negOfNat,Mathlib.Meta.NormNum.instAddMonoidWithOne,Mathlib.Tactic.Ring.Common.sub_congr,Mathlib.Tactic.Ring.Common.atom_pf,rfl,Eq.mpr,Eqand 87 more112 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
lemma ineq_max {x y z : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) (hz : 0 ≤ z) (hyx : y ≤ x) (hzx : z ≤ x) : (x + y + z) ^ 3 ≤ 4 * (x ^ 3 + y ^ 3 + z ^ 3 + 6 * (x * y * z)) := by … - lemma
Usa1979P3.ineq3The key inequality:4 * (p³ + q³ + r³ + 6pqr) ≥ (p + q + r)³forp q r ≥ 0line 180 sourceSource documentation
The key inequality:
4 * (p³ + q³ + r³ + 6pqr) ≥ (p + q + r)³forp q r ≥ 0.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Real,LE.le,OfNat.ofNat,HPow.hPow,Nat,HAdd.hAdd,HMul.hMulProof uses:
Or,le_total, Usa1979P3.ineq_max,le_of_not_gt,LT.lt,Mathlib.Tactic.Linarith.lt_irrefl,Eq.mp,HSub.hSub,congrArg,Mathlib.Tactic.Ring.of_eq,Mathlib.Tactic.Ring.Common.add_congr,Nat.rawCast,Int.rawCast,inferInstance,Ring,Int.negOfNat,Mathlib.Tactic.Ring.Common.sub_congr,Mathlib.Tactic.Ring.Common.atom_pf,rfl,Eq.mprand 62 more78 instances, coercions and auxiliary constants left out.
Tactic trace: 23 steps
Open to load the checked before-and-after goal states.
lemma ineq3 {x y z : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) (hz : 0 ≤ z) : (x + y + z) ^ 3 ≤ 4 * (x ^ 3 + y ^ 3 + z ^ 3 + 6 * (x * y * z)) := by … - problem
Usa1979P3.usa1979_p3line 195 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,NeZero,Fin,LT.lt,OfNat.ofNat,LE.le,ENNReal,HDiv.hDiv,MeasureTheory.OuterMeasure,Set,PMF.toOuterMeasure,PMF.uniformOfFintype,Set.ofPred,Dvd.dvd,HAdd.hAddProof uses: Usa1979P3.cnt,
ZMod,Eq,rfl,HPow.hPow,HMul.hMul,Fintype.card,of_eq_true,Eq.trans,True,congrFun',congrArg,Finset.prod,Finset.univ,Fintype.card_pi,Finset.card,Finset.prod_congr,Eq.refl,Finset,Membership.memand 47 more162 instances, coercions and auxiliary constants left out.
Tactic trace: 31 steps
Open to load the checked before-and-after goal states.