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

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
  1. def Usa1979P3.res The residue of a i modulo 3 line 37 source

    Source documentation

    The residue of a i modulo 3.

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

    Statement uses: Nat, Fin, ZMod, OfNat.ofNat

    10 instances, coercions and auxiliary constants left out.

    def res {n : ℕ} (a : Fin n → ℕ) (i : Fin n) : ZMod 3 := (a i : ZMod 3)
  2. def Usa1979P3.cnt The number of entries of a having residue x modulo 3 line 40 source

    Source documentation

    The number of entries of a having residue x modulo 3.

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

    Statement uses: Nat, Fin, ZMod, OfNat.ofNat

    Proof uses: Finset.card, Finset.filter, Eq, Usa1979P3.res, Finset.univ

    4 instances, coercions and auxiliary constants left out.

    def cnt {n : ℕ} (a : Fin n → ℕ) (x : ZMod 3) : ℕ :=
    …
  3. def Usa1979P3.patterns The "good" residue patterns: triples of residues that sum to 0 line 44 source

    Source 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, ZMod

    Proof uses: Finset.filter, Eq, HAdd.hAdd, Finset.univ

    20 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
    …
  4. lemma Usa1979P3.dvd_iff_res Divisibility by 3 in terms of residues in ZMod 3 line 49 source

    Source documentation

    Divisibility by 3 in terms of residues in ZMod 3.

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

    Statement uses: Nat, Iff, Dvd.dvd, OfNat.ofNat, HAdd.hAdd, Eq, ZMod

    Proof uses: Eq.mpr, id, congrArg, Eq.symm, propext, ZMod.natCast_eq_zero_iff, Nat.cast_add, Iff.rfl

    46 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
    …
  5. lemma Usa1979P3.sum_univ_zmod3 Summing over ZMod 3 gives three terms line 54 source

    Source documentation

    Summing over ZMod 3 gives three terms.

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

    Statement uses: ZMod, OfNat.ofNat, Nat, Eq, Finset.sum, Finset.univ, HAdd.hAdd

    Proof uses: Fin.sum_univ_three

    25 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

  6. lemma Usa1979P3.cnt_sum The residues split Fin n into the three fibers of res a line 58 source

    Source documentation

    The residues split Fin n into the three fibers of res a.

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

    Statement uses: Nat, Fin, Eq, HAdd.hAdd, Usa1979P3.cnt, OfNat.ofNat, ZMod

    Proof 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_zmod3

    49 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

  7. lemma Usa1979P3.fiber_card The fiber of triples with prescribed residues is a product of fibers line 67 source

    Source 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.cnt

    Proof 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.refl

    19 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

  8. lemma Usa1979P3.good_card The number of good triples, grouped by their residue pattern line 78 source

    Source 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.cnt

    Proof 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_self and 16 more

    54 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

  9. lemma Usa1979P3.sum_over_patterns Summing over the good patterns by reindexing with the first two entries line 111 source

    Source 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.vecEmpty

    Proof 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.head and 71 more

    93 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

  10. lemma Usa1979P3.pattern_sum The good triple count in terms of the residue counts line 150 source

    Source 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.hMul

    Proof 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_three and 43 more

    85 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

  11. lemma Usa1979P3.ineq_max The key inequality in the case where x is a maximum of x, y, z line 171 source

    Source documentation

    The key inequality in the case where x is a maximum of x, 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.hMul

    Proof 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, Eq and 87 more

    112 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
    …
  12. lemma Usa1979P3.ineq3 The key inequality: 4 * (p³ + q³ + r³ + 6pqr) ≥ (p + q + r)³ for p q r ≥ 0 line 180 source

    Source documentation

    The key inequality: 4 * (p³ + q³ + r³ + 6pqr) ≥ (p + q + r)³ for p 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.hMul

    Proof 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.mpr and 62 more

    78 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
    …
  13. problem Usa1979P3.usa1979_p3 line 195 source

    standard 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.hAdd

    Proof 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.mem and 47 more

    162 instances, coercions and auxiliary constants left out.

    Tactic trace: 31 steps

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