Compfiles/Usa2013P5.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
7 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2013, Problem 5
Given positive integers m and n, prove that there is a positive integer c such that the numbers cm and cn have the same number of occurrences of each non-zero digit when written in base ten.
Imports (9)
Imported by 1 file
- def
Usa2013P5.digitCountDocumented declaration: digitCount line 38 sourceSource documentation
digitCount t x dcounts the occurrences of the digitdamong the firsttdecimal digits ofx(least significant first), i.e. the digits ofxpadded with leading zeros to lengtht.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
NatProof uses:
Finset.sum,Finset.range,ite,Eq,HMod.hMod,HDiv.hDiv,HPow.hPow,OfNat.ofNat11 instances, coercions and auxiliary constants left out.
def digitCount (t x d : ℕ) : ℕ := …
- lemma
Usa2013P5.mod_pow_div_modThej-th decimal digit ofxonly depends onx % 10^(j+1), hence takingxmodulo a higher power of10does not change that digit line 43 sourceSource documentation
The
j-th decimal digit ofxonly depends onx % 10^(j+1), hence takingxmodulo a higher power of10does not change that digit.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,HAdd.hAdd,OfNat.ofNat,Eq,HMod.hMod,HDiv.hDiv,HPow.hPowProof uses:
Eq.mpr,HMul.hMul,id,congrArg,pow_succ,Eq.symm,Nat.mod_mul_right_div_self,Nat.mod_mod_of_dvd,pow_dvd_pow,Eq.refl29 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
lemma mod_pow_div_mod (x j k : ℕ) (h : j + 1 ≤ k) : (x % 10^k) / 10^j % 10 = (x / 10^j) % 10 := by …Mentions: h
- lemma
Usa2013P5.digitCount_mul_ten_modMultiplication by10modulo10^t - 1rotates the (padded)t-digit representation ofxby one place, so it preserves all digit counts line 53 sourceSource documentation
Multiplication by
10modulo10^t - 1rotates the (padded)t-digit representation ofxby one place, so it preserves all digit counts.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,HSub.hSub,HPow.hPow,Eq, Usa2013P5.digitCount,HMod.hMod,HMul.hMulProof uses:
HAdd.hAdd,Exists,Exists.intro,Eq.symm,Nat.succ,Nat.sub_add_cancel,rfl,pow_pos,Mathlib.Meta.NormNum.isNat_lt_true,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Bool,Bool.false,Eq.mpr,id,congrArg,pow_succ,HDiv.hDiv,Nat.div_add_mod',LE.leand 55 more86 instances, coercions and auxiliary constants left out.
Tactic trace: 69 steps
Open to load the checked before-and-after goal states.
lemma digitCount_mul_ten_mod (t x d : ℕ) (ht : 0 < t) (hx : x < 10^t - 1) : digitCount t ((10 * x) % (10^t - 1)) d = digitCount t x d := by …Mentions: Usa2013P5.digitCount
- lemma
Usa2013P5.digitCount_pow_ten_mul_modIterating the one-place rotation: multiplication by10^emodulo10^t - 1preserves all digit counts line 116 sourceSource documentation
Iterating the one-place rotation: multiplication by
10^emodulo10^t - 1preserves all digit counts.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,HSub.hSub,HPow.hPow,Eq, Usa2013P5.digitCount,HMod.hMod,HMul.hMulProof uses:
Nat.sub_pos_of_lt,Nat.one_lt_pow,Iff.mp,Ne,Nat.pos_iff_ne_zero,Mathlib.Meta.NormNum.isNat_lt_true,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Bool,Bool.false,Nat.recAux,of_eq_true,Eq.trans,True,congrFun',congrArg,pow_zero,one_mul,Nat.mod_eq_of_lt,eq_selfand 29 more51 instances, coercions and auxiliary constants left out.
Tactic trace: 11 steps
Open to load the checked before-and-after goal states.
lemma digitCount_pow_ten_mul_mod (t : ℕ) (ht : 0 < t) (x e d : ℕ) (hx : x < 10^t - 1) : digitCount t ((10^e * x) % (10^t - 1)) d = digitCount t x d := by …Mentions: Usa2013P5.digitCount
- lemma
Usa2013P5.count_digits_eq_digitCountFor a nonzero digitd, the number of occurrences ofdin the decimal representation ofxequalsdigitCount t x dwhenevertis large enough line 132 sourceSource documentation
For a nonzero digit
d, the number of occurrences ofdin the decimal representation ofxequalsdigitCount t x dwhenevertis large enough.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Ne,OfNat.ofNat,LT.lt,HPow.hPow,Eq,List.count,Nat.digits, Usa2013P5.digitCountProof uses:
Nat.recAux,Eq.mp,Eq.trans,congrArg,pow_zero,of_eq_true,True,congr,List,List.nil,Nat.digits_zero,Finset.sum,EmptyCollection.emptyCollection,Finset,ite,HMod.hMod,HDiv.hDiv,funext,ite_congr,congrFun'and 48 more62 instances, coercions and auxiliary constants left out.
Tactic trace: 28 steps
Open to load the checked before-and-after goal states.
lemma count_digits_eq_digitCount (x t d : ℕ) (hd : d ≠ 0) (hx : x < 10^t) : (Nat.digits 10 x).count d = digitCount t x d := by …Mentions: Usa2013P5.digitCount
- lemma
Usa2013P5.two_pow_ge_add_oneline 162 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,HAdd.hAdd,OfNat.ofNat,HPow.hPowProof uses:
Nat.recAux,Mathlib.Meta.NormNum.isNat_le_true,Mathlib.Meta.NormNum.isNat_add,Eq.refl,Mathlib.Meta.NormNum.isNat_ofNat,Mathlib.Meta.NormNum.isNat_pow,Mathlib.Meta.NormNum.natPow_zero,Bool,Bool.true,Nat.one_le_pow,Mathlib.Meta.NormNum.isNat_lt_true,Bool.false,Eq.mpr,HMul.hMul,id,Eq,congrArg,pow_succ32 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
- problem
Usa2013P5.usa2013_p5line 172 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Exists,And,Membership.mem,Finset,Finset.Icc,Eq,List.count,Nat.digits,HMul.hMulProof uses:
Finsupp,Nat.factorization,rfl,Ne,Nat.ne_of_gt,Dvd.dvd,HPow.hPow,Iff.mpr,LE.le,Nat.Prime.pow_dvd_iff_le_factorization,Nat.prime_two,le_rfl,Mathlib.Meta.NormNum.isNat_prime_2,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Bool,Bool.true,Mathlib.Meta.NormNum.isNat_minFac_4,Mathlib.Meta.NormNum.IsNat.raw_refl,Mathlib.Meta.NormNum.minFacHelper_0and 123 more107 instances, coercions and auxiliary constants left out.
Tactic trace: 162 steps
Open to load the checked before-and-after goal states.