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

8 declarations, 0 contain sorry, 0 declared as axioms

USA Mathematical Olympiad 2009, Problem 2

Let n be a positive integer. Determine the size of the largest subset of {−n, −n+1, ..., n−1, n} which does not contain three elements a, b, c (not necessarily distinct) satisfying a + b + c = 0.

Imports (5)
Imported by 1 file
  1. abbrev Usa2009P2.IsGood A set of integers is called good if it does not contain three elements a, b, c (not necessarily distinct) satisfying a + b + c = 0 line 31 source

    Source documentation

    A set of integers is called good if it does not contain three elements a, b, c (not necessarily distinct) satisfying a + b + c = 0.

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

    Statement uses: Finset, Int

    Proof uses: Membership.mem, Ne, HAdd.hAdd, OfNat.ofNat

    5 instances, coercions and auxiliary constants left out.

    abbrev IsGood (A : Finset ℤ) : Prop :=
    …
  2. determine Usa2009P2.answer line 34 source

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

    Statement uses: Nat

    Proof uses: ite, Even, HAdd.hAdd, OfNat.ofNat

    4 instances, coercions and auxiliary constants left out.

  3. lemma Usa2009P2.injOn_min_sub The pairing map x ↦ min x (c - x) is injective on any set containing no two elements summing to c: equality of the images forces x = y or x + y = c line 40 source

    Source documentation

    The pairing map x ↦ min x (c - x) is injective on any set containing no two elements summing to c: equality of the images forces x = y or x + y = c.

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

    Statement uses: Finset, Int, Membership.mem, Ne, HAdd.hAdd, Set.InjOn, Min.min, HSub.hSub

    Proof uses: Set, Eq, Or, min_choice, Eq.mp, congrArg, absurd

    26 instances, coercions and auxiliary constants left out.

    Tactic trace: 15 steps

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

    lemma injOn_min_sub {B : Finset ℤ} {c : ℤ} (hB : ∀ x ∈ B, ∀ y ∈ B, x + y ≠ c) :
        Set.InjOn (fun x ↦ min x (c - x)) B := by
    …
  4. lemma Usa2009P2.card_le_of_pair Pairing counting lemma line 55 source

    Source documentation

    Pairing counting lemma. If B ⊆ [lo, hi] contains no two elements (not necessarily distinct) summing to c = lo + hi, then pairing x with c - x shows that B has at most as many elements as the interval [lo, (c-1)/2].

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

    Statement uses: Finset, Int, LE.le, Finset.Icc, Eq, HAdd.hAdd, Membership.mem, Ne, Nat, Finset.card, Int.toNat, HSub.hSub, HDiv.hDiv, OfNat.ofNat

    Proof uses: Min.min, And.left, Iff.mp, And, Finset.mem_Icc, And.right, Eq.mpr, id, congrArg, propext, And.intro, Iff.mpr, le_min_iff, Decidable.byContradiction, Not, LT.lt, lt_of_lt_of_le, Eq.mp, min_le_left, min_le_right and 4 more

    42 instances, coercions and auxiliary constants left out.

    Tactic trace: 14 steps

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

    lemma card_le_of_pair {B : Finset ℤ} {lo hi c : ℤ} (hsub : B ⊆ Finset.Icc lo hi)
        (hc : c = lo + hi) (hB : ∀ x ∈ B, ∀ y ∈ B, x + y ≠ c) :
        B.card ≤ ((c - 1) / 2 + 1 - lo).toNat := by
    …
  5. lemma Usa2009P2.card_le_case2 Case (ii) of the induction step: if both 2m and -(2m) lie in A (with m ≥ 1), then A has at most 2m elements line 76 source

    Source documentation

    Case (ii) of the induction step: if both 2m and -(2m) lie in A (with m ≥ 1), then A has at most 2m elements.

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

    Statement uses: Nat, LE.le, OfNat.ofNat, Finset, Int, Finset.Icc, Neg.neg, HMul.hMul, Usa2009P2.IsGood, Membership.mem, Finset.card

    Proof uses: Not, Mathlib.Tactic.Ring.of_eq, HAdd.hAdd, Mathlib.Tactic.Ring.Common.add_congr, HPow.hPow, Nat.rawCast, Int.rawCast, inferInstance, Ring, Int.negOfNat, Mathlib.Tactic.Ring.Common.mul_congr, Mathlib.Tactic.Ring.cast_pos, Mathlib.Meta.NormNum.isNat_ofNat, Eq.refl, Mathlib.Tactic.Ring.Common.atom_pf, rfl, Eq.mpr, Eq, id, congrArg and 71 more

    94 instances, coercions and auxiliary constants left out.

    Tactic trace: 59 steps

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

    lemma card_le_case2 {m : ℕ} (hm : 1 ≤ m) {A : Finset ℤ}
        (hsub : A ⊆ Finset.Icc (-(2 * (m : ℤ))) (2 * (m : ℤ))) (hgood : IsGood A)
        (hN : (2 * (m : ℤ)) ∈ A) (hnegN : -(2 * (m : ℤ)) ∈ A) :
        A.card ≤ 2 * m := by
    …

    Mentions: Usa2009P2.IsGood

  6. lemma Usa2009P2.card_le_case3 Case (iii) of the induction step: if 2m, 2m-1 and -(2m-1) lie in A but -(2m) does not (with m ≥ 1), then A has at most 2m elements line 144 source

    Source documentation

    Case (iii) of the induction step: if 2m, 2m-1 and -(2m-1) lie in A but -(2m) does not (with m ≥ 1), then A has at most 2m elements.

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

    Statement uses: Nat, LE.le, OfNat.ofNat, Finset, Int, Finset.Icc, Neg.neg, HMul.hMul, Usa2009P2.IsGood, Membership.mem, HSub.hSub, Not, Finset.card

    Proof uses: dite, Eq, False.elim, Eq.mp, congrArg, Mathlib.Meta.NormNum.IsNat.to_eq, Mathlib.Meta.NormNum.isNat_mul, Eq.refl, Mathlib.Meta.NormNum.isNat_ofNat, Mathlib.Meta.NormNum.isNat_natCast, Mathlib.Meta.NormNum.IsInt.neg_to_eq, Mathlib.Meta.NormNum.isInt_neg, Int.ofNat, Int.negOfNat, Mathlib.Meta.NormNum.IsNat.to_isInt, Mathlib.Meta.NormNum.IsInt.to_isNat, Mathlib.Meta.NormNum.isInt_sub, of_eq_true, HAdd.hAdd, Eq.trans and 76 more

    105 instances, coercions and auxiliary constants left out.

    Tactic trace: 78 steps

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

    lemma card_le_case3 {m : ℕ} (hm : 1 ≤ m) {A : Finset ℤ}
        (hsub : A ⊆ Finset.Icc (-(2 * (m : ℤ))) (2 * (m : ℤ))) (hgood : IsGood A)
        (hN : (2 * (m : ℤ)) ∈ A) (hN1 : (2 * (m : ℤ)) - 1 ∈ A)
        (hnegN1 : -((2 * (m : ℤ)) - 1) ∈ A) (hnegN : -(2 * (m : ℤ)) ∉ A) :
        A.card ≤ 2 * m := by
    …

    Mentions: Usa2009P2.IsGood

  7. lemma Usa2009P2.card_le_even The upper bound for even n: any good subset of [-2m, 2m] has at most 2m elements, by strong induction on m line 226 source

    Source documentation

    The upper bound for even n: any good subset of [-2m, 2m] has at most 2m elements, by strong induction on m.

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

    Statement uses: Nat, Finset, Int, LE.le, Finset.Icc, Neg.neg, HMul.hMul, OfNat.ofNat, Usa2009P2.IsGood, Finset.card

    Proof uses: Nat.strong_induction_on, LT.lt, Eq, GT.gt, Or, Nat.eq_zero_or_pos, Not, Membership.mem, of_eq_true, HAdd.hAdd, Eq.trans, True, congrFun', congrArg, Mathlib.Meta.NormNum.IsNat.to_eq, Mathlib.Meta.NormNum.isNat_add, Eq.refl, Mathlib.Meta.NormNum.isNat_ofNat, eq_self, eq_true and 52 more

    99 instances, coercions and auxiliary constants left out.

    Tactic trace: 141 steps

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

    lemma card_le_even (m : ℕ) (A : Finset ℤ) :
        A ⊆ Finset.Icc (-(2 * (m : ℤ))) (2 * (m : ℤ)) → IsGood A → A.card ≤ 2 * m := by
    …

    Mentions: Usa2009P2.IsGood

  8. problem Usa2009P2.usa2009_p2 line 360 source

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

    Statement uses: Nat, LT.lt, OfNat.ofNat, IsGreatest, Set.ofPred, Exists, Finset, Int, And, LE.le, Finset.Icc, Neg.neg, Usa2009P2.IsGood, Eq, Finset.card, Usa2009P2.answer

    Proof uses: And.intro, Membership.mem, Set, upperBounds, Exists.intro, Union.union, HAdd.hAdd, HDiv.hDiv, Or, Eq.mp, congrArg, propext, Finset.mem_union, Eq.mpr, id, Finset.mem_Icc, GE.ge, HMul.hMul, False, Disjoint and 47 more

    92 instances, coercions and auxiliary constants left out.

    Tactic trace: 69 steps

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