Compfiles/Usa2007P1.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
16 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2007, Problem 1
Let n be a positive integer. Define a sequence by setting a₁ = n and, for each k > 1, letting aₖ be the unique integer in the range 0 ≤ aₖ ≤ k - 1 for which a₁ + a₂ + ··· + aₖ is divisible by k. (For instance, when n = 9 the obtained sequence is 9, 1, 2, 0, 3, 3, 3, ....) Prove that for any n the sequence a₁, a₂, ... eventually becomes constant.
Imports (6)
Imported by 1 file
- def
Usa2007P1.sThe partial sums `s n k = a n 0 + a n 1 + line 35 sourceSource documentation
The partial sums
s n k = a n 0 + a n 1 + ... + a n kof the sequence of the problem, defined directly:s n 0 = n, ands n (k + 1)is the smallest multiple ofk + 2which is≥ s n k.no axioms what this means
Statement uses:
Nat2 instances, coercions and auxiliary constants left out.
def s (n : ℕ) : ℕ → ℕ | 0 => n | (k + 1) => s n k + (k + 2 - s n k % (k + 2)) % (k + 2) /-- The sequence of the problem, with indices shifted by one so that `a n 0 = n`: for `k ≥ 1`, `a n k` is the unique integer in `[0, k]` for which `k + 1` divides `s n k = a n 0 + ... + a n k`. -/
Mentions: Usa2007P1.a
- def
Usa2007P1.aThe sequence of the problem, with indices shifted by one so thata n 0 = n: fork ≥ 1,a n kis the unique integer in[0, k]for whichk + 1divides `s n k = a n 0 + line 42 sourceSource documentation
The sequence of the problem, with indices shifted by one so that
a n 0 = n: fork ≥ 1,a n kis the unique integer in[0, k]for whichk + 1dividess n k = a n 0 + ... + a n k.no axioms what this means
Statement uses:
NatProof uses:
Usa2007P1.s.match_1,Unit,HSub.hSub, Usa2007P1.s,HAdd.hAdd,OfNat.ofNat5 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
def a (n : ℕ) : ℕ → ℕ | 0 => n | (k + 1) => s n (k + 1) - s n k snip begin -- sanity check against the example given in the problem statement
Mentions: Usa2007P1.s
- example
Usa2007P1.(example at line 49)line 49 sourceSource comment
sanity check against the example given in the problem statementexample : a 9 0 = 9 ∧ a 9 1 = 1 ∧ a 9 2 = 2 ∧ a 9 3 = 0 ∧ a 9 4 = 3 ∧ a 9 5 = 3 ∧ a 9 6 = 3 := by …Mentions: Usa2007P1.a
- lemma
Usa2007P1.s_succline 53 sourceno axioms what this means
Statement uses:
Nat,Eq, Usa2007P1.s,HAdd.hAdd,OfNat.ofNat,HMod.hMod,HSub.hSubProof uses:
rfl10 instances, coercions and auxiliary constants left out.
- lemma
Usa2007P1.a_succline 56 sourcestandard axioms: propext what this means
Statement uses:
Nat,Eq, Usa2007P1.a,HAdd.hAdd,OfNat.ofNat,HMod.hMod,HSub.hSub, Usa2007P1.sProof uses:
Nat.add_sub_cancel_left14 instances, coercions and auxiliary constants left out.
- lemma
Usa2007P1.s_succ_eq_add_aline 60 sourcestandard axioms: propext what this means
Statement uses:
Nat,Eq, Usa2007P1.s,HAdd.hAdd,OfNat.ofNat, Usa2007P1.aProof uses:
Eq.mpr,HMod.hMod,HSub.hSub,id,congrArg, Usa2007P1.a_succ, Usa2007P1.s_succ,Eq.refl10 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2007P1.a_succ_ltline 63 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt, Usa2007P1.a,HAdd.hAdd,OfNat.ofNatProof uses:
Eq.mpr,HMod.hMod,HSub.hSub, Usa2007P1.s,id,Eq,congrArg, Usa2007P1.a_succ,Nat.mod_lt13 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2007P1.dvd_sline 67 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Dvd.dvd,HAdd.hAdd,OfNat.ofNat, Usa2007P1.sProof uses:
Nat.recAux,one_dvd,Eq.mpr,Eq,HMod.hMod,id,congrArg,propext,Nat.dvd_iff_mod_eq_zero,HSub.hSub, Usa2007P1.s_succ,Nat.add_mod,Nat.mod_mod,LT.lt,Eq.symm,Eq.refl,Nat.mod_lt,GT.gt,Or,Nat.eq_zero_or_posand 9 more23 instances, coercions and auxiliary constants left out.
Tactic trace: 17 steps
Open to load the checked before-and-after goal states.
- def
Usa2007P1.bThe average `b n k = (a n 0 + line 82 sourceSource documentation
The average
b n k = (a n 0 + ... + a n k) / (k + 1), a nonnegative integer.no axioms what this means
Statement uses:
NatProof uses:
HDiv.hDiv, Usa2007P1.s,HAdd.hAdd,OfNat.ofNat5 instances, coercions and auxiliary constants left out.
def b (n k : ℕ) : ℕ := s n k / (k + 1)
Mentions: Usa2007P1.s
- lemma
Usa2007P1.s_eqline 84 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq, Usa2007P1.s,HMul.hMul,HAdd.hAdd,OfNat.ofNat, Usa2007P1.bProof uses:
id,Eq.mpr,HDiv.hDiv,congrArg,mul_comm,Nat.div_mul_cancel, Usa2007P1.dvd_s,Eq.refl17 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2007P1.b_succ_leline 88 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le, Usa2007P1.b,HAdd.hAdd,OfNat.ofNatProof uses:
Eq, Usa2007P1.s, Usa2007P1.a, Usa2007P1.s_succ_eq_add_a,LT.lt, Usa2007P1.a_succ_lt,HMul.hMul, Usa2007P1.s_eq,Decidable.byContradiction,Not,Iff.mp,not_le,Nat.mul_le_mul_left,Eq.mp,congrArg,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,HPow.hPow,Mathlib.Tactic.Ring.Common.mul_congr,Mathlib.Tactic.Ring.Common.add_congrand 24 more34 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2007P1.b_eventually_constline 100 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Exists,GE.ge,Eq, Usa2007P1.bProof uses:
Antitone,antitone_nat_of_succ_le, Usa2007P1.b_succ_le,InfSet.sInf,Set.range,Membership.mem,Set,Nat.sInf_mem,Set.range_nonempty,Exists.intro,le_antisymm,Eq.mpr,LE.le,id,congrArg,Nat.sInf_le,rfl11 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2007P1.sum_aThe partial sums ofa nare indeed given bys nline 108 sourceSource documentation
The partial sums of
a nare indeed given bys n.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Finset.sum,Finset.range,HAdd.hAdd,OfNat.ofNat, Usa2007P1.a, Usa2007P1.sProof uses:
Nat.recAux,Eq.mpr,id,congrArg,Finset.sum_range_one,Eq.refl,Finset.sum_range_succ, Usa2007P1.s_succ_eq_add_a12 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
lemma sum_a (n k : ℕ) : ∑ i ∈ Finset.range (k + 1), a n i = s n k := by …
Mentions: Usa2007P1.a, Usa2007P1.s
- lemma
Usa2007P1.dvd_sum_aa nsatisfies the divisibility requirement of the problem statement line 115 sourceSource documentation
a nsatisfies the divisibility requirement of the problem statement.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Dvd.dvd,HAdd.hAdd,OfNat.ofNat,Finset.sum,Finset.range, Usa2007P1.aProof uses:
Eq.mpr, Usa2007P1.s,id,Eq,congrArg, Usa2007P1.sum_a, Usa2007P1.dvd_s10 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
lemma dvd_sum_a (n k : ℕ) : (k + 1) ∣ ∑ i ∈ Finset.range (k + 1), a n i := by …
Mentions: Usa2007P1.a
- lemma
Usa2007P1.a_lea nsatisfies the range requirement of the problem statement line 120 sourceSource documentation
a nsatisfies the range requirement of the problem statement.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat, Usa2007P1.aProof uses:
Eq,Nat.succ,Exists,Nat.exists_eq_succ_of_ne_zero,Ne,Iff.mp,LT.lt,Nat.lt_succ_iff, Usa2007P1.a_succ_lt,Eq.symm8 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
lemma a_le (n : ℕ) {k : ℕ} (hk : 1 ≤ k) : a n k ≤ k := by …Mentions: Usa2007P1.a
- problem
Usa2007P1.usa2007_p1line 126 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Exists,GE.ge,Eq, Usa2007P1.aProof uses: Usa2007P1.b, Usa2007P1.b_eventually_const,
Exists.intro,HAdd.hAdd,Nat.succ,Nat.exists_eq_succ_of_ne_zero,Ne, Usa2007P1.s,HMul.hMul,Eq.mpr,id,congrArg, Usa2007P1.s_eq,Eq.refl,Trans.trans,HSub.hSub,rfl,Mathlib.Tactic.Ring.of_eq,HPow.hPow,Nat.rawCastand 22 more35 instances, coercions and auxiliary constants left out.
Tactic trace: 15 steps
Open to load the checked before-and-after goal states.