Compfiles/Usa2005P6.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
21 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2005, Problem 6
For a positive integer m, let s(m) denote the sum of the decimal digits of m. A set S of positive integers is k-stable if s(∑_{x∈X} x) = k for any nonempty subset X ⊆ S. For each integer n ≥ 2 let f(n) be the minimal k for which there exists a k-stable set with n integers. Prove that there are constants 0 < C₁ < C₂ with C₁ log₁₀ n ≤ f(n) ≤ C₂ log₁₀ n.
Imports (5)
Imported by 1 file
- def
Usa2005P6.sThe sum of the decimal digits ofmline 32 sourceSource documentation
The sum of the decimal digits of
m.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
NatProof uses:
List.sum,Nat.digits,OfNat.ofNat4 instances, coercions and auxiliary constants left out.
def s (m : ℕ) : ℕ := (Nat.digits 10 m).sum
- def
Usa2005P6.IsStableA setSof positive integers isk-stable if the sum of the elements of any nonempty subsetX ⊆ Shas digit sum equal tokline 36 sourceSource documentation
A set
Sof positive integers isk-stable if the sum of the elements of any nonempty subsetX ⊆ Shas digit sum equal tok.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,FinsetProof uses:
And,Membership.mem,LT.lt,OfNat.ofNat,Finset.powerset,Finset.Nonempty,Eq, Usa2005P6.s,Finset.sum5 instances, coercions and auxiliary constants left out.
def IsStable (k : ℕ) (S : Finset ℕ) : Prop := …
Mentions: S
- def
Usa2005P6.ff nis the minimalkfor which there exists ak-stable set withnintegers line 41 sourceSource documentation
f nis the minimalkfor which there exists ak-stable set withnintegers. (That the defining set is nonempty is proved instable_exists.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
NatProof uses:
InfSet.sInf,Set.ofPred,Exists,Finset,And, Usa2005P6.IsStable,Eq,Finset.card1 instances, coercions and auxiliary constants left out.
noncomputable def f (n : ℕ) : ℕ := sInf {k | ∃ S : Finset ℕ, IsStable k S ∧ S.card = n} …Mentions: S, Usa2005P6.IsStable
- lemma
Usa2005P6.s_zeroline 68 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Eq,Nat, Usa2005P6.s,OfNat.ofNatProof uses:
rfl2 instances, coercions and auxiliary constants left out.
- lemma
Usa2005P6.s_eqThe defining recurrence of the digit sum, valid for allmline 71 sourceSource documentation
The defining recurrence of the digit sum, valid for all
m.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq, Usa2005P6.s,HAdd.hAdd,HMod.hMod,OfNat.ofNat,HDiv.hDivProof uses:
Ne,Or,eq_or_ne,of_eq_true,Eq.trans,True,congr,congrArg,List,Nat.digits,List.nil,List.sum,Nat.digits_zero,Nat.zero_div,add_zero,eq_self,Eq.symm,Eq.mpr,id,Usa2005P6.s.eq_1and 9 more28 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma s_eq (m : ℕ) : s m = m % 10 + s (m / 10) := by …
Mentions: Usa2005P6.s
- lemma
Usa2005P6.s_concatThe digits of a concatenation are the concatenation of the digits: ifc < 10 ^ ethens (10 ^ e * a + c) = s a + s cline 78 sourceSource documentation
The digits of a concatenation are the concatenation of the digits: if
c < 10 ^ ethens (10 ^ e * a + c) = s a + s c.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,HPow.hPow,OfNat.ofNat,Eq, Usa2005P6.s,HAdd.hAdd,HMul.hMulProof uses:
Nat.recAux,of_eq_true,Eq.trans,True,congr,congrArg,congrFun',pow_zero,one_mul,add_zero,eq_self,Eq.symm,le_antisymm,Nat.ge_of_not_lt,Mathlib.Tactic.IntervalCases.of_lt_right,Nat.rawCast,Eq.mp,Mathlib.Meta.NormNum.IsNat.to_raw_eq,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refland 42 more63 instances, coercions and auxiliary constants left out.
Tactic trace: 32 steps
Open to load the checked before-and-after goal states.
lemma s_concat (e a c : ℕ) (hc : c < 10 ^ e) : s (10 ^ e * a + c) = s a + s c := by …
Mentions: Usa2005P6.s
- lemma
Usa2005P6.s_complementIfa + b = 10 ^ e - 1then the digits ofaandbare complementary, sos a + s b = 9 * eline 103 sourceSource documentation
If
a + b = 10 ^ e - 1then the digits ofaandbare complementary, sos a + s b = 9 * e.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,HAdd.hAdd,HSub.hSub,HPow.hPow,OfNat.ofNat, Usa2005P6.s,HMul.hMulProof uses:
Nat.recAux,of_eq_true,Eq.trans,True,congr,congrArg,add_zero,MulZeroClass.mul_zero,eq_self,Eq.symm,Eq.mp,congrFun',pow_zero,Nat.sub_self,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,Mathlib.Tactic.Ring.Common.pow_congr,Mathlib.Tactic.Ring.cast_pos,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refland 31 more59 instances, coercions and auxiliary constants left out.
Tactic trace: 18 steps
Open to load the checked before-and-after goal states.
lemma s_complement (e a b : ℕ) (h : a + b = 10 ^ e - 1) : s a + s b = 9 * e := by …
Mentions: h, Usa2005P6.s
- lemma
Usa2005P6.s_pow_ten_sub_oneline 119 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq, Usa2005P6.s,HSub.hSub,HPow.hPow,OfNat.ofNat,HMul.hMulProof uses:
HAdd.hAdd, Usa2005P6.s_complement,Eq.mpr,id,congrArg,add_zero,Eq.refl,Eq.mp,congrFun'26 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2005P6.s_add_leSubadditivity of the digit sum line 124 sourceSource documentation
Subadditivity of the digit sum.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le, Usa2005P6.s,HAdd.hAddProof uses:
Nat.recAux,OfNat.ofNat,of_eq_true,Eq.trans,True,congr,congrArg,add_zero,Eq.symm,Eq,Ne,Or,eq_or_ne,zero_add,Eq.mpr,HMod.hMod,HDiv.hDiv,id, Usa2005P6.s_eq,diteand 13 more34 instances, coercions and auxiliary constants left out.
Tactic trace: 41 steps
Open to load the checked before-and-after goal states.
lemma s_add_le (a b : ℕ) : s (a + b) ≤ s a + s b := by …
Mentions: Usa2005P6.s
- lemma
Usa2005P6.s_pos_of_posThe digit sum of a positive integer is positive line 157 sourceSource documentation
The digit sum of a positive integer is positive.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,LE.le, Usa2005P6.sProof uses:
Ne,List,Nat.digits,List.nil,Iff.mpr,Nat.digits_ne_nil_iff_ne_zero,ne_of_gt,List.getLast,Nat.getLast_digit_ne_zero,Eq.mpr,id,Eq,congrArg,propext,Nat.one_le_iff_ne_zero,Eq.mp,List.sum,Membership.mem,List.sum_eq_zero_iff_forall_eq_nat,Usa2005P6.s.eq_1and 1 more12 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma s_pos_of_pos (m : ℕ) (hm : 0 < m) : 1 ≤ s m := by …
Mentions: Usa2005P6.s
- lemma
Usa2005P6.nine_le_s_of_dvdEvery positive multiple of10 ^ e - 1has digit sum at least9 * eline 168 sourceSource documentation
Every positive multiple of
10 ^ e - 1has digit sum at least9 * e. The proof repeatedly replacesmbym % 10 ^ e + m / 10 ^ e, which preserves divisibility by10 ^ e - 1and does not increase the digit sum.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,LT.lt,Dvd.dvd,HSub.hSub,HPow.hPow,HMul.hMul, Usa2005P6.sProof uses:
Nat.strong_induction_on,Nat.one_le_pow,Mathlib.Meta.NormNum.isNat_lt_true,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Bool,Bool.false,Trans.trans,Mathlib.Meta.NormNum.isNat_le_true,Mathlib.Meta.NormNum.isNat_pow,Mathlib.Meta.NormNum.natPow_one,Bool.true,Nat.pow_le_pow_right,dite,Eq,Nat.casesAuxOn,False.elim,Eq.mp,False,Eq.transand 25 more68 instances, coercions and auxiliary constants left out.
Tactic trace: 50 steps
Open to load the checked before-and-after goal states.
lemma nine_le_s_of_dvd (e : ℕ) (he : 1 ≤ e) : ∀ m : ℕ, 0 < m → (10 ^ e - 1) ∣ m → 9 * e ≤ s m := by …Mentions: Usa2005P6.s
- lemma
Usa2005P6.sum_Icc_idThe Gauss sum `1 + 2 + line 215 sourceSource documentation
The Gauss sum
1 + 2 + ... + n.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Finset.sum,Finset.Icc,OfNat.ofNat,HDiv.hDiv,HMul.hMul,HAdd.hAddProof uses:
Nat.recAux,of_eq_true,Eq.trans,True,congr,congrArg,congrFun',Finset.sum_congr,EmptyCollection.emptyCollection,Finset,Finset.Icc_eq_empty_of_lt,LT.lt,eq_self,Membership.mem,Eq.refl,MulZeroClass.zero_mul,zero_add,mul_one,Insert.insert,Finset.extand 40 more95 instances, coercions and auxiliary constants left out.
Tactic trace: 11 steps
Open to load the checked before-and-after goal states.
lemma sum_Icc_id (n : ℕ) : ∑ i ∈ Finset.Icc 1 n, i = n * (n + 1) / 2 := by …
- lemma
Usa2005P6.constructionUpper bound (construction).* Ifn * (n + 1) / 2 < 10 ^ ethen{10^e - 1, 2 * (10^e - 1), ..., n * (10^e - 1)}is a9 * e-stable set ofnpositive integers line 231 sourceSource documentation
Upper bound (construction). If
n * (n + 1) / 2 < 10 ^ ethen{10^e - 1, 2 * (10^e - 1), ..., n * (10^e - 1)}is a9 * e-stable set ofnpositive integers.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,LT.lt,HDiv.hDiv,HMul.hMul,HAdd.hAdd,HPow.hPow,And, Usa2005P6.IsStable,Finset.image,HSub.hSub,Finset.Icc,Eq,Finset.cardProof uses:
Nat.one_le_pow,Mathlib.Meta.NormNum.isNat_lt_true,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Bool,Bool.false,Trans.trans,Mathlib.Meta.NormNum.isNat_eq_true,Mathlib.Meta.NormNum.isNat_pow,Mathlib.Meta.NormNum.natPow_one,Nat.pow_le_pow_right,Function.Injective,Nat.mul_right_cancel,And.intro,Membership.mem,Finset,Finset.powerset,Finset.Nonempty, Usa2005P6.s,Finset.sumand 37 more83 instances, coercions and auxiliary constants left out.
Tactic trace: 53 steps
Open to load the checked before-and-after goal states.
lemma construction (n e : ℕ) (he : 1 ≤ e) (h : n * (n + 1) / 2 < 10 ^ e) : IsStable (9 * e) ((Finset.Icc 1 n).image (· * (10 ^ e - 1))) ∧ ((Finset.Icc 1 n).image (· * (10 ^ e - 1))).card = n := by …Mentions: h, Usa2005P6.IsStable
- lemma
Usa2005P6.stable_lowerDocumented declaration: stable_lower line 287 sourceSource documentation
Lower bound. If
Sisk-stable and10 ^ e ≤ S.card + 1, then9 * e ≤ k: among theS.card + 1 ≥ 10 ^ eprefix sums of an arbitrary ordering ofS, two agree modulo10 ^ e - 1, and their difference is a nonempty subset sum that is a positive multiple of10 ^ e - 1.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Finset, Usa2005P6.IsStable,HPow.hPow,HAdd.hAdd,Finset.card,HMul.hMulProof uses:
Membership.mem,LT.lt,Finset.powerset,Finset.Nonempty,Eq, Usa2005P6.s,Finset.sum,Nat.one_le_pow,Mathlib.Meta.NormNum.isNat_lt_true,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Bool,Bool.false,HSub.hSub,Trans.trans,Mathlib.Meta.NormNum.isNat_eq_true,Mathlib.Meta.NormNum.isNat_pow,Mathlib.Meta.NormNum.natPow_one,Nat.pow_le_pow_right,Listand 63 more79 instances, coercions and auxiliary constants left out.
Tactic trace: 76 steps
Open to load the checked before-and-after goal states.
lemma stable_lower (k e : ℕ) (he : 1 ≤ e) (S : Finset ℕ) (hS : IsStable k S) (hn : 10 ^ e ≤ S.card + 1) : 9 * e ≤ k := by …Mentions: S, Usa2005P6.IsStable
- lemma
Usa2005P6.stable_existsThe set definingf nis nonempty: the construction withe = Nat.log 10 (n * (n + 1) / 2) + 1works line 366 sourceSource documentation
The set defining
f nis nonempty: the construction withe = Nat.log 10 (n * (n + 1) / 2) + 1works.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Exists,Finset,And, Usa2005P6.IsStable,HMul.hMul,OfNat.ofNat,HAdd.hAdd,Nat.log,HDiv.hDiv,Eq,Finset.cardProof uses:
Exists.intro,Finset.image,HSub.hSub,HPow.hPow,Finset.Icc, Usa2005P6.construction,LT.lt,Nat.succ,Nat.lt_pow_succ_log_self,Mathlib.Meta.NormNum.isNat_lt_true,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Bool,Bool.false,Eq.mp,congrArg,Nat.succ_eq_add_one35 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
lemma stable_exists (n : ℕ) : ∃ S : Finset ℕ, IsStable (9 * (Nat.log 10 (n * (n + 1) / 2) + 1)) S ∧ S.card = n := by …Mentions: S, Usa2005P6.IsStable
- lemma
Usa2005P6.f_specline 372 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Exists,Finset,And, Usa2005P6.IsStable, Usa2005P6.f,Eq,Finset.cardProof uses:
Membership.mem,Set,Set.ofPred,InfSet.sInf,Nat.sInf_mem,Exists.intro,HMul.hMul,OfNat.ofNat,HAdd.hAdd,Nat.log,HDiv.hDiv, Usa2005P6.stable_exists9 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2005P6.f_leline 378 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Exists,Finset,And, Usa2005P6.IsStable,Eq,Finset.card,LE.le, Usa2005P6.fProof uses:
Nat.sInf_le,Set.ofPred1 instances, coercions and auxiliary constants left out.
- lemma
Usa2005P6.one_le_fEvery stable set has stability constant at least1, hence1 ≤ f nline 382 sourceSource documentation
Every stable set has stability constant at least
1, hence1 ≤ f n.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat, Usa2005P6.fProof uses:
Finset,And, Usa2005P6.IsStable,Eq,Finset.card,Exists, Usa2005P6.f_spec,Membership.mem,LT.lt,Finset.powerset,Finset.Nonempty, Usa2005P6.s,Finset.sum,Eq.mpr,id,congrArg,Eq.symm,propext,Finset.card_pos,Iff.mprand 4 more27 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
lemma one_le_f (n : ℕ) (hn : 1 ≤ n) : 1 ≤ f n := by …
Mentions: Usa2005P6.f
- lemma
Usa2005P6.f_lowerThe lower bound forf ncoming from the pigeonhole argument line 393 sourceSource documentation
The lower bound for
f ncoming from the pigeonhole argument.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,HPow.hPow,HAdd.hAdd,HMul.hMul, Usa2005P6.fProof uses:
Finset,And, Usa2005P6.IsStable,Eq,Finset.card,Exists, Usa2005P6.f_spec, Usa2005P6.stable_lower,Eq.mpr,id,congrArg22 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
lemma f_lower (n e : ℕ) (he : 1 ≤ e) (hn : 10 ^ e ≤ n + 1) : 9 * e ≤ f n := by …
Mentions: Usa2005P6.f
- lemma
Usa2005P6.f_upperThe upper bound forf ncoming from the explicit construction line 398 sourceSource documentation
The upper bound for
f ncoming from the explicit construction.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le, Usa2005P6.f,HMul.hMul,OfNat.ofNat,HAdd.hAdd,Nat.log,HDiv.hDivProof uses:
Nat.sInf_le,Set.ofPred,Exists,Finset,And, Usa2005P6.IsStable,Eq,Finset.card, Usa2005P6.stable_exists15 instances, coercions and auxiliary constants left out.
lemma f_upper (n : ℕ) : f n ≤ 9 * (Nat.log 10 (n * (n + 1) / 2) + 1) := …
Mentions: Usa2005P6.f
- problem
Usa2005P6.usa2005_p6line 403 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Exists,Real,And,LT.lt,OfNat.ofNat,Nat,LE.le,HMul.hMul,Real.logb, Usa2005P6.fProof uses:
HDiv.hDiv,Eq.mpr,HPow.hPow,id,Eq,congrArg,propext,Real.le_logb_iff_rpow_le,Mathlib.Meta.NormNum.isNat_lt_true,Mathlib.Meta.NormNum.isNat_ofNat,Nat.cast_one,Eq.refl,Mathlib.Meta.NormNum.instAtLeastTwo,Bool,Bool.false,Nat.cast_zero,Decidable.byContradiction,Not,pow_lt_pow_left₀,Eq.mpand 155 more176 instances, coercions and auxiliary constants left out.
Tactic trace: 113 steps
Open to load the checked before-and-after goal states.