Compfiles/Usa2019P5.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 2019, Problem 5
Let m and n be relatively prime positive integers. The numbers m/n and n/m are written on a blackboard. At any point, Evan may pick two of the numbers x and y written on the board and write either their arithmetic mean (x+y)/2 or their harmonic mean 2xy/(x+y). For which (m, n) can Evan write 1 on the board in finitely many steps?
Imports (9)
Imported by 1 file
- inductive
Usa2019P5.WritableThe rational numbers that Evan can write on the board, starting fromm / nandn / mline 39 sourceSource documentation
The rational numbers that Evan can write on the board, starting from
m / nandn / m.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Ratinductive Writable (m n : ℕ) : ℚ → Prop | base₁ : Writable m n ((m : ℚ) / n) | base₂ : Writable m n ((n : ℚ) / m) | am {x y : ℚ} : Writable m n x → Writable m n y → Writable m n ((x + y) / 2) | hm {x y : ℚ} : Writable m n x → Writable m n y → Writable m n (2 * x * y / (x + y)) /-- If `p ∣ a + b` and `p ∣ c + d`, then `a * d + b * c ≡ -2 * b * d (mod p)`. -/ - theorem
Usa2019P5.sum_dvd_congIfp ∣ a + bandp ∣ c + d, thena * d + b * c ≡ -2 * b * d (mod p)line 46 sourceSource documentation
If
p ∣ a + bandp ∣ c + d, thena * d + b * c ≡ -2 * b * d (mod p).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Dvd.dvd,HAdd.hAdd,Int.ModEq,HMul.hMul,Neg.neg,OfNat.ofNatProof uses:
Eq.mpr,HSub.hSub,id,Eq,congrArg,propext,Int.modEq_iff_dvd,Mathlib.Tactic.Ring.of_eq,HPow.hPow,Nat,Nat.rawCast,Int.rawCast,inferInstance,Ring,Int.negOfNat,Mathlib.Tactic.Ring.Common.sub_congr,Mathlib.Tactic.Ring.Common.neg_congr,Mathlib.Tactic.Ring.Common.atom_pf,rfl,Eq.symmand 44 more63 instances, coercions and auxiliary constants left out.
Tactic trace: 15 steps
Open to load the checked before-and-after goal states.
theorem sum_dvd_cong {p a b c d : ℤ} (hpab : p ∣ a + b) (hpcd : p ∣ c + d) : a * d + b * c ≡ -2 * b * d [ZMOD p] := by … - theorem
Usa2019P5.dvd_two_mul_mul_of_dvdIfp ∣ a * d + b * canda * d + b * c ≡ -2 * b * d (mod p), thenp ∣ 2 * b * dline 64 sourceSource documentation
If
p ∣ a * d + b * canda * d + b * c ≡ -2 * b * d (mod p), thenp ∣ 2 * b * d.standard axioms: Quot.sound, propext what this means
Statement uses:
Int,Dvd.dvd,HAdd.hAdd,HMul.hMul,Int.ModEq,Neg.neg,OfNat.ofNatProof uses:
HSub.hSub,dvd_add,Eq.mp,congrArg,propext,Int.modEq_iff_dvd,Iff.mp,dvd_neg,neg_mul,add_sub_cancel39 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
theorem dvd_two_mul_mul_of_dvd {p a b c d : ℤ} (h : p ∣ a * d + b * c) (hcong : a * d + b * c ≡ -2 * b * d [ZMOD p]) : p ∣ 2 * b * d := by …Mentions: h
- theorem
Usa2019P5.not_dvd_two_mul_mulAn odd prime dividing neitherbnorddoes not divide2 * b * dline 73 sourceSource documentation
An odd prime dividing neither
bnorddoes not divide2 * b * d.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Nat.Prime,Ne,OfNat.ofNat,Int,Not,Dvd.dvd,HMul.hMulProof uses:
Prime,Iff.mp,Nat.prime_iff_prime_int,cast,le_antisymm,Nat.le_of_dvd,two_pos,Nat.Prime.two_le,Or,False,Prime.dvd_mul34 instances, coercions and auxiliary constants left out.
Tactic trace: 16 steps
Open to load the checked before-and-after goal states.
theorem not_dvd_two_mul_mul {p : ℕ} (hp : p.Prime) (hp2 : p ≠ 2) {b d : ℤ} (hpb : ¬(p : ℤ) ∣ b) (hpd : ¬(p : ℤ) ∣ d) : ¬(p : ℤ) ∣ 2 * b * d := by … - theorem
Usa2019P5.Writable.exists_repThe key invariant: if an odd primepdividesm + n, then every number that Evan can write has a representationa / bwithp ∣ a + bandp ∤ bline 90 sourceSource documentation
The key invariant: if an odd prime
pdividesm + n, then every number that Evan can write has a representationa / bwithp ∣ a + bandp ∤ b. (Equivalently, in lowest terms the value is≡ -1 (mod p).)standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Nat.Coprime,Nat.Prime,Ne,Dvd.dvd,HAdd.hAdd,Rat, Usa2019P5.Writable,Exists,Int,And,Eq,HDiv.hDiv,NotProof uses:
Usa2019P5.Writable.rec,Nat.gcd,Exists.intro,And.intro,cast,Eq.symm,Eq.trans,congrArg,Nat.cast_zero,LT.lt.ne',of_eq_true,True,congr,Int.cast_natCast,eq_self,Iff.mp,Nat.dvd_add_left,Eq.mp,propext,Int.natCast_dvd_natCastand 114 more150 instances, coercions and auxiliary constants left out.
Tactic trace: 72 steps
Open to load the checked before-and-after goal states.
theorem Writable.exists_rep {m n : ℕ} (hm : 0 < m) (hn : 0 < n) (hmn : m.Coprime n) {p : ℕ} (hp : p.Prime) (hp2 : p ≠ 2) (hpd : p ∣ m + n) {x : ℚ} (hx : Writable m n x) : ∃ a b : ℤ, b ≠ 0 ∧ x = (a : ℚ) / b ∧ (p : ℤ) ∣ a + b ∧ ¬(p : ℤ) ∣ b := by …Mentions: Usa2019P5.Writable
- theorem
Usa2019P5.exists_odd_prime_dvdAny natural number≥ 2that is not a power of two has an odd prime factor line 159 sourceSource documentation
Any natural number
≥ 2that is not a power of two has an odd prime factor.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Ne,HPow.hPow,Exists,And,Nat.Prime,Odd,Dvd.dvdProof uses:
Eq,HMul.hMul,Nat.exists_eq_two_pow_mul_odd,False,Eq.mp,congrArg,mul_one,Eq.symm,MulZeroClass.mul_zero,Nat.exists_prime_and_dvd,Odd.ne_two_of_dvd_nat,Exists.intro,And.intro,Nat.Prime.odd_of_ne_two,Eq.rec,dvd_mul_of_dvd_right33 instances, coercions and auxiliary constants left out.
Tactic trace: 13 steps
Open to load the checked before-and-after goal states.
theorem exists_odd_prime_dvd {N : ℕ} (hN : 2 ≤ N) (h : ∀ k : ℕ, N ≠ 2 ^ k) : ∃ p : ℕ, p.Prime ∧ Odd p ∧ p ∣ N := by …Mentions: h
- theorem
Usa2019P5.writable_comboAny dyadic weighted average of two writable numbers is writable (using arithmetic means alone) line 176 sourceSource documentation
Any dyadic weighted average of two writable numbers is writable (using arithmetic means alone).
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Rat,Eq,HAdd.hAdd,HPow.hPow,OfNat.ofNat, Usa2019P5.Writable,HDiv.hDiv,HMul.hMulProof uses:
Nat.recAux,Or,And,Eq.mp,congrArg,pow_zero,Eq.mpr,id,Eq.trans,congr,congrFun',CharP.cast_eq_zero,MulZeroClass.zero_mul,Nat.cast_one,one_mul,zero_add,div_one,Eq.symm,add_zero,Neand 97 more135 instances, coercions and auxiliary constants left out.
Tactic trace: 44 steps
Open to load the checked before-and-after goal states.
theorem writable_combo {m n : ℕ} (k : ℕ) : ∀ {a b : ℕ} {x y : ℚ}, a + b = 2 ^ k → Writable m n x → Writable m n y → Writable m n (((a : ℚ) * x + (b : ℚ) * y) / ((2 ^ k : ℕ) : ℚ)) := by …Mentions: Usa2019P5.Writable
- determine
Usa2019P5.solution_setline 219 sourcestandard axioms: propext what this means
Statement uses:
Set,Prod,NatProof uses:
Set.ofPred,Usa2019P5.solution_set.match_1,Exists,Eq,HAdd.hAdd,HPow.hPow,OfNat.ofNat7 instances, coercions and auxiliary constants left out.
- problem
Usa2019P5.usa2019_p5line 221 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Nat.Coprime,Iff,Membership.mem,Prod,Set, Usa2019P5.solution_set,Prod.mk, Usa2019P5.Writable,RatProof uses:
Iff.intro,id,Exists,Eq,HAdd.hAdd,HPow.hPow,HDiv.hDiv,HMul.hMul, Usa2019P5.writable_combo,Usa2019P5.Writable.base₁,Usa2019P5.Writable.base₂,Ne,cast,Not,Eq.symm,Eq.trans,congrArg,Nat.cast_zero,LT.lt.ne',congrFun'and 72 more121 instances, coercions and auxiliary constants left out.
Tactic trace: 49 steps
Open to load the checked before-and-after goal states.