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

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
  1. def Usa2013P5.digitCount Documented declaration: digitCount line 38 source

    Source documentation

    digitCount t x d counts the occurrences of the digit d among the first t decimal digits of x (least significant first), i.e. the digits of x padded with leading zeros to length t.

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

    Statement uses: Nat

    Proof uses: Finset.sum, Finset.range, ite, Eq, HMod.hMod, HDiv.hDiv, HPow.hPow, OfNat.ofNat

    11 instances, coercions and auxiliary constants left out.

    def digitCount (t x d : ℕ) : ℕ :=
    …
  2. lemma Usa2013P5.mod_pow_div_mod The j-th decimal digit of x only depends on x % 10^(j+1), hence taking x modulo a higher power of 10 does not change that digit line 43 source

    Source documentation

    The j-th decimal digit of x only depends on x % 10^(j+1), hence taking x modulo a higher power of 10 does 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.hPow

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

    29 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

  3. lemma Usa2013P5.digitCount_mul_ten_mod Multiplication by 10 modulo 10^t - 1 rotates the (padded) t-digit representation of x by one place, so it preserves all digit counts line 53 source

    Source documentation

    Multiplication by 10 modulo 10^t - 1 rotates the (padded) t-digit representation of x by 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.hMul

    Proof 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.le and 55 more

    86 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

  4. lemma Usa2013P5.digitCount_pow_ten_mul_mod Iterating the one-place rotation: multiplication by 10^e modulo 10^t - 1 preserves all digit counts line 116 source

    Source documentation

    Iterating the one-place rotation: multiplication by 10^e modulo 10^t - 1 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.hMul

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

    51 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

  5. lemma Usa2013P5.count_digits_eq_digitCount For a nonzero digit d, the number of occurrences of d in the decimal representation of x equals digitCount t x d whenever t is large enough line 132 source

    Source documentation

    For a nonzero digit d, the number of occurrences of d in the decimal representation of x equals digitCount t x d whenever t is 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.digitCount

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

    62 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

  6. lemma Usa2013P5.two_pow_ge_add_one line 162 source

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

    Statement uses: Nat, LE.le, HAdd.hAdd, OfNat.ofNat, HPow.hPow

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

    32 instances, coercions and auxiliary constants left out.

    Tactic trace: 6 steps

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

  7. problem Usa2013P5.usa2013_p5 line 172 source

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

    Proof 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_0 and 123 more

    107 instances, coercions and auxiliary constants left out.

    Tactic trace: 162 steps

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