Compfiles/Usa1997P1.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
9 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 1997, Problem 1
Let p₁, p₂, p₃, ... be the prime numbers listed in increasing order, and let x₀ be a real number between 0 and 1. For positive integer k, define
xₖ = 0, if xₖ₋₁ = 0, xₖ = {pₖ / xₖ₋₁}, if xₖ₋₁ ≠ 0,
where {x} denotes the fractional part of x. (The fractional part of x is given by x - ⌊x⌋, where ⌊x⌋ is the greatest integer less than or equal to x.)
Find, with proof, all x₀ satisfying 0 < x₀ < 1 for which the sequence x₀, x₁, x₂, ... eventually becomes 0.
Imports (8)
Imported by 1 file
- def
Usa1997P1.seqThe recursion from the problem, parametrized by the sequencep : ℕ → ℕof positive integers used as numerators, wherep kis used at stepk + 1line 44 sourceSource documentation
The recursion from the problem, parametrized by the sequence
p : ℕ → ℕof positive integers used as numerators, wherep kis used at stepk + 1. The problem instantiatesptoNat.nth Nat.Prime, the increasing enumeration of the primes, so thatp kis the(k + 1)-th prime.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Real2 instances, coercions and auxiliary constants left out.
noncomputable def seq (p : ℕ → ℕ) (x₀ : ℝ) : ℕ → ℝ | 0 => x₀ | k + 1 => if seq p x₀ k = 0 then 0 else Int.fract ((p k : ℝ) / seq p x₀ k) /-- The answer to the problem: the sequence eventually becomes zero exactly for the rational numbers in the open interval (0, 1). -/
Mentions: answer
- determine
Usa1997P1.solution_setThe answer to the problem: the sequence eventually becomes zero exactly for the rational numbers in the open interval (0, 1) line 50 sourceSource documentation
The answer to the problem: the sequence eventually becomes zero exactly for the rational numbers in the open interval (0, 1).
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Set,RealProof uses:
Inter.inter,Set.Ioo,OfNat.ofNat,Set.range,Rat8 instances, coercions and auxiliary constants left out.
determine solution_set : Set ℝ := Set.Ioo 0 1 ∩ Set.range ((↑) : ℚ → ℝ) …
- lemma
Usa1997P1.seq_zeroline 54 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Real,Eq, Usa1997P1.seq,OfNat.ofNatProof uses:
rfl2 instances, coercions and auxiliary constants left out.
- lemma
Usa1997P1.seq_succline 56 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Real,Eq, Usa1997P1.seq,HAdd.hAdd,OfNat.ofNat,ite,Int.fract,HDiv.hDivProof uses:
rfl17 instances, coercions and auxiliary constants left out.
- lemma
Usa1997P1.seq_shiftShifting the starting value by one step is the same as shifting the sequence of numerators line 62 sourceSource documentation
Shifting the starting value by one step is the same as shifting the sequence of numerators.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Real,Eq, Usa1997P1.seq,HAdd.hAdd,OfNat.ofNat8 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
lemma seq_shift (p : ℕ → ℕ) (x₀ : ℝ) : ∀ k : ℕ, seq (fun n ↦ p (n + 1)) (seq p x₀ 1) k = seq p x₀ (k + 1) | 0 => rfl | k + 1 => by rw [seq_succ (fun n ↦ p (n + 1)) (seq p x₀ 1) k, seq_shift p x₀ k, seq_succ p x₀ (k + 1)] /-- First direction: starting from a positive rational `a / b`, the sequence reaches zero, because the numerator strictly decreases at each nonzero step. (The values `p k` only need to be positive integers; primality is irrelevant for this direction.) -/Mentions: Usa1997P1.seq, Usa1997P1.seq_succ
- lemma
Usa1997P1.terminates_of_ratFirst direction: starting from a positive rationala / b, the sequence reaches zero, because the numerator strictly decreases at each nonzero step line 73 sourceSource documentation
First direction: starting from a positive rational
a / b, the sequence reaches zero, because the numerator strictly decreases at each nonzero step. (The valuesp konly need to be positive integers; primality is irrelevant for this direction.)standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Exists,Eq,Real, Usa1997P1.seq,HDiv.hDivProof uses:
Nat.strong_induction_on,Ne,Iff.mpr,Nat.cast_ne_zero,LT.lt.ne',div_ne_zero,HMod.hMod,HMul.hMul,Eq.mpr,ite,Int.fract,id,congrArg,HAdd.hAdd, Usa1997P1.seq_succ, Usa1997P1.seq_zero,ite_eq_right,Nat.cast_mul,of_eq_true,Eq.transand 48 more76 instances, coercions and auxiliary constants left out.
Tactic trace: 25 steps
Open to load the checked before-and-after goal states.
lemma terminates_of_rat : ∀ a : ℕ, 0 < a → ∀ p : ℕ → ℕ, (∀ k, 0 < p k) → ∀ b : ℕ, 0 < b → ∃ k, seq p ((a : ℝ) / b) k = 0 := by …Mentions: Usa1997P1.seq
- lemma
Usa1997P1.rat_cast_of_seq_succSecond direction: if the term at stepk + 1is rational, then so is the term at stepkline 102 sourceSource documentation
Second direction: if the term at step
k + 1is rational, then so is the term at stepk.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Real,Exists,Rat,Eq, Usa1997P1.seq,HAdd.hAddProof uses:
dite,Exists.intro,of_eq_true,Eq.trans,True,congr,congrArg,Rat.cast_zero,eq_self,Not,Ne,Iff.mpr,Nat.cast_ne_zero,LT.lt.ne',HDiv.hDiv,div_ne_zero,Int.floor,Eq.mpr,Int.fract,idand 69 more95 instances, coercions and auxiliary constants left out.
Tactic trace: 25 steps
Open to load the checked before-and-after goal states.
lemma rat_cast_of_seq_succ (p : ℕ → ℕ) (hp : ∀ k, 0 < p k) (x₀ : ℝ) (k : ℕ) (h : ∃ q : ℚ, seq p x₀ (k + 1) = (q : ℝ)) : ∃ q : ℚ, seq p x₀ k = (q : ℝ) := by …Mentions: h, Usa1997P1.seq
- lemma
Usa1997P1.rat_cast_of_seqIf some term of the sequence is rational, then the starting value is rational (by downward induction) line 131 sourceSource documentation
If some term of the sequence is rational, then the starting value is rational (by downward induction).
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Real,Exists,Rat,Eq, Usa1997P1.seq10 instances, coercions and auxiliary constants left out.
lemma rat_cast_of_seq (p : ℕ → ℕ) (hp : ∀ k, 0 < p k) (x₀ : ℝ) : ∀ k : ℕ, (∃ q : ℚ, seq p x₀ k = (q : ℝ)) → ∃ q : ℚ, x₀ = (q : ℝ) | 0, h => h | k + 1, h => rat_cast_of_seq p hp x₀ k (rat_cast_of_seq_succ p hp x₀ k h) snip endMentions: Usa1997P1.seq, h, Usa1997P1.rat_cast_of_seq_succ
- problem
Usa1997P1.usa1997_p1line 138 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Real,Membership.mem,Set,Set.Ioo,OfNat.ofNat,Iff,Exists,Nat,Eq, Usa1997P1.seq,Nat.nth,Nat.Prime, Usa1997P1.solution_setProof uses:
LT.lt,Nat.Prime.pos,Nat.nth_mem_of_infinite,Nat.infinite_setOfPred_prime,Iff.intro,And.intro,Set.range,Rat, Usa1997P1.rat_cast_of_seq,Exists.intro,of_eq_true,Eq.trans,True,congr,congrArg,Rat.cast_zero,eq_self,Eq.symm,Iff.mp,Rat.cast_posand 19 more66 instances, coercions and auxiliary constants left out.
Tactic trace: 23 steps
Open to load the checked before-and-after goal states.