Compfiles/Usa2009P2.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
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
- abbrev
Usa2009P2.IsGoodA set of integers is called good if it does not contain three elementsa,b,c(not necessarily distinct) satisfyinga + b + c = 0line 31 sourceSource documentation
A set of integers is called good if it does not contain three elements
a,b,c(not necessarily distinct) satisfyinga + b + c = 0.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,IntProof uses:
Membership.mem,Ne,HAdd.hAdd,OfNat.ofNat5 instances, coercions and auxiliary constants left out.
abbrev IsGood (A : Finset ℤ) : Prop := …
- determine
Usa2009P2.answerline 34 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
NatProof uses:
ite,Even,HAdd.hAdd,OfNat.ofNat4 instances, coercions and auxiliary constants left out.
- lemma
Usa2009P2.injOn_min_subThe pairing mapx ↦ min x (c - x)is injective on any set containing no two elements summing toc: equality of the images forcesx = yorx + y = cline 40 sourceSource documentation
The pairing map
x ↦ min x (c - x)is injective on any set containing no two elements summing toc: equality of the images forcesx = yorx + 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.hSubProof uses:
Set,Eq,Or,min_choice,Eq.mp,congrArg,absurd26 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 … - lemma
Usa2009P2.card_le_of_pairPairing counting lemma line 55 sourceSource documentation
Pairing counting lemma. If
B ⊆ [lo, hi]contains no two elements (not necessarily distinct) summing toc = lo + hi, then pairingxwithc - xshows thatBhas 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.ofNatProof 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_rightand 4 more42 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 … - lemma
Usa2009P2.card_le_case2Case (ii) of the induction step: if both2mand-(2m)lie inA(withm ≥ 1), thenAhas at most2melements line 76 sourceSource documentation
Case (ii) of the induction step: if both
2mand-(2m)lie inA(withm ≥ 1), thenAhas at most2melements.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.cardProof 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,congrArgand 71 more94 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
- lemma
Usa2009P2.card_le_case3Case (iii) of the induction step: if2m,2m-1and-(2m-1)lie inAbut-(2m)does not (withm ≥ 1), thenAhas at most2melements line 144 sourceSource documentation
Case (iii) of the induction step: if
2m,2m-1and-(2m-1)lie inAbut-(2m)does not (withm ≥ 1), thenAhas at most2melements.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.cardProof 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.transand 76 more105 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
- lemma
Usa2009P2.card_le_evenThe upper bound for evenn: any good subset of[-2m, 2m]has at most2melements, by strong induction onmline 226 sourceSource documentation
The upper bound for even
n: any good subset of[-2m, 2m]has at most2melements, by strong induction onm.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.cardProof 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_trueand 52 more99 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
- problem
Usa2009P2.usa2009_p2line 360 sourcestandard 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.answerProof 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,Disjointand 47 more92 instances, coercions and auxiliary constants left out.
Tactic trace: 69 steps
Open to load the checked before-and-after goal states.