declaration
stringlengths
27
11.3k
file
stringlengths
52
114
context
dict
tactic_states
listlengths
1
1.24k
theorem Nat.Prime.sq_add_sq' {p : β„•} [h : Fact p.Prime] (hp : p % 4 = 1) : βˆƒ a b : β„•, a ^ 2 + b ^ 2 = p := by rw [← div_add_mod p 4] at h ⊒ rw [hp] at h ⊒ let k := p / 4 apply sq_add_sq_of_nonempty_fixedPoints have key := (Equiv.Perm.card_fixedPoints_modEq (p := 2) (n := 1) (obvInvo_sq k)).symm.trans (Equiv.Perm.card_fixedPoints_modEq (p := 2) (n := 1) (complexInvo_sq k)) contrapose key rw [Set.not_nonempty_iff_eq_empty] at key simp_rw [k, key, Fintype.card_eq_zero, card_fixedPoints_eq_one] decide
/root/DuelModelResearch/mathlib4/Archive/ZagierTwoSquares.lean
{ "open": [ "Set", "Function", "Zagier" ], "variables": [ "(k : β„•) [hk : Fact (4 * k + 1).Prime]", "(k : β„•)", "[hk : Fact (4 * k + 1).Prime]" ] }
[ { "line": "rw [← div_add_mod p 4] at h ⊒", "before_state": "p : β„•\nh : Fact (Prime p)\nhp : p % 4 = 1\n⊒ βˆƒ a b, a ^ 2 + b ^ 2 = p", "after_state": "p : β„•\nh : Fact (Prime (4 * (p / 4) + p % 4))\nhp : p % 4 = 1\n⊒ βˆƒ a b, a ^ 2 + b ^ 2 = 4 * (p / 4) + p % 4" }, { "line": "rewrite [← div_add_mod p ...
example : Β¬ LucasLehmerTest 2 := by norm_num
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ ¬LucasLehmerTest 2", "after_state": "No Goals!" } ]
example : (mersenne 2).Prime := by decide
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "decide", "before_state": "⊒ Nat.Prime (mersenne 2)", "after_state": "No Goals!" } ]
example : (mersenne 3).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 3", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 3", "after_state": "No Goals!" } ]
example : (mersenne 5).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 5", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 5", "after_state": "No Goals!" } ]
example : (mersenne 7).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 7", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 7", "after_state": "No Goals!" } ]
example : (mersenne 13).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 13", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 13", "after_state": "No Goals!" } ]
example : (mersenne 17).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 17", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 17", "after_state": "No Goals!" } ]
example : (mersenne 19).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 19", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 19", "after_state": "No Goals!" } ]
example : (mersenne 31).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 31", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 31", "after_state": "No Goals!" } ]
example : (mersenne 61).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 61", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 61", "after_state": "No Goals!" } ]
example : (mersenne 89).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 89", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 89", "after_state": "No Goals!" } ]
example : (mersenne 107).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 107", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 107", "after_state": "No Goals!" } ]
example : (mersenne 127).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 127", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 127", "after_state": "No Goals!" } ]
example : (mersenne 521).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 521", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 521", "after_state": "No Goals!" } ]
example : (mersenne 607).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 607", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 607", "after_state": "No Goals!" } ]
example : (mersenne 1279).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 1279", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 1279", "after_state": "No Goals!" } ]
example : (mersenne 2203).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 2203", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 2203", "after_state": "No Goals!" } ]
example : (mersenne 2281).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 2281", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 2281", "after_state": "No Goals!" } ]
example : (mersenne 3217).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 3217", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 3217", "after_state": "No Goals!" } ]
example : (mersenne 4253).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 4253", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 4253", "after_state": "No Goals!" } ]
example : (mersenne 4423).Prime := lucas_lehmer_sufficiency _ (by norm_num) (by norm_num)
/root/DuelModelResearch/mathlib4/Archive/Examples/MersennePrimes.lean
{ "open": [], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 1 < 4423", "after_state": "No Goals!" }, { "line": "norm_num", "before_state": "⊒ LucasLehmerTest 4423", "after_state": "No Goals!" } ]
theorem calculation (n k : β„•) (h1 : k ∣ 21 * n + 4) (h2 : k ∣ 14 * n + 3) : k ∣ 1 := have h3 : k ∣ 2 * (21 * n + 4) := h1.mul_left 2 have h4 : k ∣ 3 * (14 * n + 3) := h2.mul_left 3 have h5 : 3 * (14 * n + 3) = 2 * (21 * n + 4) + 1 := by ring (Nat.dvd_add_right h3).mp (h5 β–Έ h4)
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1959Q1.lean
{ "open": [ "Nat" ], "variables": [] }
[ { "line": "ring", "before_state": "n k : β„•\nh1 : k ∣ 21 * n + 4\nh2 : k ∣ 14 * n + 3\nh3 : k ∣ 2 * (21 * n + 4)\nh4 : k ∣ 3 * (14 * n + 3)\n⊒ 3 * (14 * n + 3) = 2 * (21 * n + 4) + 1", "after_state": "No Goals!" }, { "line": "first\n| ring1\n|\n try_this ring_nf\"\\n\\nThe `ring` tactic failed t...
theorem Imo1961Q3 {n : β„•} {x : ℝ} (hβ‚€ : n β‰  0) : (cos x) ^ n - (sin x) ^ n = 1 ↔ (βˆƒ k : β„€, k * Ο€ = x) ∧ Even n ∨ (βˆƒ k : β„€, k * (2 * Ο€) = x) ∧ Odd n ∨ (βˆƒ k : β„€, -(Ο€ / 2) + k * (2 * Ο€) = x) ∧ Odd n := by constructor Β· intro h rcases eq_or_ne (sin x) 0 with hsinx | hsinx Β· rw [hsinx, zero_pow hβ‚€, sub_zero, pow_eq_one_iff_of_ne_zero hβ‚€, cos_eq_one_iff, cos_eq_neg_one_iff] at h rcases h with ⟨k, rfl⟩ | ⟨⟨k, rfl⟩, hn⟩ Β· cases n.even_or_odd with | inl hn => refine .inl ⟨⟨k * 2, ?_⟩, hn⟩; simp [mul_assoc] | inr hn => exact .inr <| .inl ⟨⟨_, rfl⟩, hn⟩ Β· exact .inl ⟨⟨2 * k + 1, by push_cast; ring⟩, hn⟩ Β· rcases eq_or_ne (cos x) 0 with hcosx | hcosx Β· right; right rw [hcosx] at h rw [zero_pow hβ‚€] at h rw [zero_sub] at h rw [← neg_inj] at h rw [neg_neg] at h rw [pow_eq_neg_one_iff] at h rw [sin_eq_neg_one_iff] at h simpa only [eq_comm] using h Β· have hcos1 : |cos x| < 1 := by rw [abs_cos_eq_sqrt_one_sub_sin_sq] rw [sqrt_lt' one_pos] simp [sq_pos_of_ne_zero hsinx] have hsin1 : |sin x| < 1 := by rw [abs_sin_eq_sqrt_one_sub_cos_sq] rw [sqrt_lt' one_pos] simp [sq_pos_of_ne_zero hcosx] match n with | 1 => rw [pow_one] at h rw [pow_one] at h rw [sub_eq_iff_eq_add] at h have : 2 * sin x * cos x = 0 := by simpa [h, add_sq, add_assoc, ← two_mul, mul_add, mul_assoc, ← sq] using cos_sq_add_sin_sq x simp [hsinx, hcosx] at this | 2 => rw [← cos_sq_add_sin_sq x] at h rw [sub_eq_add_neg] at h rw [add_right_inj] at h rw [neg_eq_self ℝ] at h exact absurd (pow_eq_zero h) hsinx | (n + 1 + 2) => set m := n + 1 refine absurd ?_ h.not_lt calc (cos x) ^ (m + 2) - (sin x) ^ (m + 2) ≀ |cos x| ^ (m + 2) + |sin x| ^ (m + 2) := by simp only [← abs_pow] simp only [sub_eq_add_neg] gcongr exacts [le_abs_self _, neg_le_abs _] _ = |cos x| ^ m * cos x ^ 2 + |sin x| ^ m * sin x ^ 2 := by simp [pow_add] _ < 1 ^ m * cos x ^ 2 + 1 ^ m * sin x ^ 2 := by gcongr _ = 1 := by simp Β· rintro (⟨⟨k, rfl⟩, hn⟩ | ⟨⟨k, rfl⟩, -⟩ | ⟨⟨k, rfl⟩, hn⟩) Β· rw [sin_int_mul_pi, zero_pow hβ‚€, sub_zero, ← hn.pow_abs, abs_cos_int_mul_pi, one_pow] Β· have : sin (k * (2 * Ο€)) = 0 := by simpa [mul_assoc] using sin_int_mul_pi (k * 2) simp [hβ‚€, this] Β· simp [hn.neg_pow, hβ‚€]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1961Q3.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "constructor", "before_state": "n : β„•\nx : ℝ\nhβ‚€ : n β‰  0\n⊒ cos x ^ n - sin x ^ n = 1 ↔\n (βˆƒ k, ↑k * Ο€ = x) ∧ Even n ∨ (βˆƒ k, ↑k * (2 * Ο€) = x) ∧ Odd n ∨ (βˆƒ k, -(Ο€ / 2) + ↑k * (2 * Ο€) = x) ∧ Odd n", "after_state": "case mp\nn : β„•\nx : ℝ\nhβ‚€ : n β‰  0\n⊒ cos x ^ n - sin x ^ n = 1 β†’\n (βˆƒ k, ↑...
theorem solve_cos2_half {x : ℝ} : cos x ^ 2 = 1 / 2 ↔ βˆƒ k : β„€, x = (2 * ↑k + 1) * Ο€ / 4 := by rw [cos_sq] simp only [add_eq_left] simp only [div_eq_zero_iff] norm_num rw [cos_eq_zero_iff] constructor <;> Β· rintro ⟨k, h⟩ use k linarith
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1962Q4.lean
{ "open": [ "Real", "scoped Real" ], "variables": [] }
[ { "line": "rw [cos_sq]", "before_state": "x : ℝ\n⊒ cos x ^ 2 = 1 / 2 ↔ βˆƒ k, x = (2 * ↑k + 1) * Ο€ / 4", "after_state": "x : ℝ\n⊒ 1 / 2 + cos (2 * x) / 2 = 1 / 2 ↔ βˆƒ k, x = (2 * ↑k + 1) * Ο€ / 4" }, { "line": "rewrite [cos_sq]", "before_state": "x : ℝ\n⊒ cos x ^ 2 = 1 / 2 ↔ βˆƒ k, x = (2 * ↑k + 1...
theorem solve_cos3x_0 {x : ℝ} : cos (3 * x) = 0 ↔ βˆƒ k : β„€, x = (2 * ↑k + 1) * Ο€ / 6 := by rw [cos_eq_zero_iff] refine exists_congr fun k => ?_ constructor <;> intro <;> linarith
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1962Q4.lean
{ "open": [ "Real", "scoped Real" ], "variables": [] }
[ { "line": "rw [cos_eq_zero_iff]", "before_state": "x : ℝ\n⊒ cos (3 * x) = 0 ↔ βˆƒ k, x = (2 * ↑k + 1) * Ο€ / 6", "after_state": "x : ℝ\n⊒ (βˆƒ k, 3 * x = (2 * ↑k + 1) * Ο€ / 2) ↔ βˆƒ k, x = (2 * ↑k + 1) * Ο€ / 6" }, { "line": "rewrite [cos_eq_zero_iff]", "before_state": "x : ℝ\n⊒ cos (3 * x) = 0 ↔ βˆƒ ...
theorem formula {R : Type*} [CommRing R] [IsDomain R] [CharZero R] (a : R) : a ^ 2 + ((2 : R) * a ^ 2 - (1 : R)) ^ 2 + ((4 : R) * a ^ 3 - 3 * a) ^ 2 = 1 ↔ ((2 : R) * a ^ 2 - (1 : R)) * ((4 : R) * a ^ 3 - 3 * a) = 0 := by constructor <;> intro h Β· apply pow_eq_zero (n := 2) apply mul_left_injectiveβ‚€ (b := 2) (by norm_num) linear_combination (8 * a ^ 4 - 10 * a ^ 2 + 3) * h Β· linear_combination 2 * a * h
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1962Q4.lean
{ "open": [ "Real", "scoped Real", "Imo1962Q4" ], "variables": [] }
[ { "line": "focus\n constructor\n with_annotate_state\"<;>\" skip\n all_goals intro h", "before_state": "R : Type u_1\ninst✝² : CommRing R\ninst✝¹ : IsDomain R\ninst✝ : CharZero R\na : R\n⊒ a ^ 2 + (2 * a ^ 2 - 1) ^ 2 + (4 * a ^ 3 - 3 * a) ^ 2 = 1 ↔ (2 * a ^ 2 - 1) * (4 * a ^ 3 - 3 * a) = 0", "after_s...
theorem solve_cos2x_0 {x : ℝ} : cos (2 * x) = 0 ↔ βˆƒ k : β„€, x = (2 * ↑k + 1) * Ο€ / 4 := by rw [cos_eq_zero_iff] refine exists_congr fun k => ?_ constructor <;> intro <;> linarith
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1962Q4.lean
{ "open": [ "Real", "scoped Real", "Imo1962Q4" ], "variables": [] }
[ { "line": "rw [cos_eq_zero_iff]", "before_state": "x : ℝ\n⊒ cos (2 * x) = 0 ↔ βˆƒ k, x = (2 * ↑k + 1) * Ο€ / 4", "after_state": "x : ℝ\n⊒ (βˆƒ k, 2 * x = (2 * ↑k + 1) * Ο€ / 2) ↔ βˆƒ k, x = (2 * ↑k + 1) * Ο€ / 4" }, { "line": "rewrite [cos_eq_zero_iff]", "before_state": "x : ℝ\n⊒ cos (2 * x) = 0 ↔ βˆƒ ...
lemma two_sin_pi_div_seven_ne_zero : 2 * sin (Ο€ / 7) β‰  0 := by apply mul_ne_zero two_ne_zero (Real.sin_pos_of_pos_of_lt_pi _ _).ne' <;> linarith [pi_pos]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1963Q5.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "focus\n apply mul_ne_zero two_ne_zero (Real.sin_pos_of_pos_of_lt_pi _ _).ne'\n with_annotate_state\"<;>\" skip\n all_goals linarith [pi_pos]", "before_state": "⊒ 2 * sin (Ο€ / 7) β‰  0", "after_state": "No Goals!" }, { "line": "apply mul_ne_zero two_ne_zero (Real.sin_pos_of_pos_of_lt_...
lemma sin_pi_mul_neg_div (a b : ℝ) : sin (Ο€ * (- a / b)) = - sin (Ο€ * (a / b)) := by ring_nf exact sin_neg _
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1963Q5.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "ring_nf", "before_state": "a b : ℝ\n⊒ sin (Ο€ * (-a / b)) = -sin (Ο€ * (a / b))", "after_state": "a b : ℝ\n⊒ sin (-(Ο€ * a * b⁻¹)) = -sin (Ο€ * a * b⁻¹)" }, { "line": "exact sin_neg _", "before_state": "a b : ℝ\n⊒ sin (-(Ο€ * a * b⁻¹)) = -sin (Ο€ * a * b⁻¹)", "after_state": "No Goal...
theorem two_pow_mod_seven (n : β„•) : 2 ^ n ≑ 2 ^ (n % 3) [MOD 7] := let t := n % 3 calc 2 ^ n = 2 ^ (3 * (n / 3) + t) := by rw [Nat.div_add_mod] _ = (2 ^ 3) ^ (n / 3) * 2 ^ t := by rw [pow_add, pow_mul] _ ≑ 1 ^ (n / 3) * 2 ^ t [MOD 7] := by gcongr; decide _ = 2 ^ t := by ring
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1964Q1.lean
{ "open": [ "Nat" ], "variables": [] }
[ { "line": "rw [Nat.div_add_mod]", "before_state": "n : β„•\nt : β„• := n % 3\n⊒ 2 ^ n = 2 ^ (3 * (n / 3) + t)", "after_state": "No Goals!" }, { "line": "rewrite [Nat.div_add_mod]", "before_state": "n : β„•\nt : β„• := n % 3\n⊒ 2 ^ n = 2 ^ (3 * (n / 3) + t)", "after_state": "n : β„•\nt : β„• := n % 3...
theorem imo1964_q1a (n : β„•) (_ : 0 < n) : 7 ∣ 2 ^ n - 1 ↔ 3 ∣ n := by let t := n % 3 have : t < 3 := Nat.mod_lt _ (by decide) calc 7 ∣ 2 ^ n - 1 ↔ 2 ^ n ≑ 1 [MOD 7] := by rw [Nat.ModEq.comm] rw [Nat.modEq_iff_dvd'] apply Nat.one_le_pow' _ ↔ 2 ^ t ≑ 1 [MOD 7] := ⟨(two_pow_mod_seven n).symm.trans, (two_pow_mod_seven n).trans⟩ _ ↔ t = 0 := by interval_cases t <;> decide _ ↔ 3 ∣ n := by rw [dvd_iff_mod_eq_zero]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1964Q1.lean
{ "open": [ "Nat", "Imo1964Q1" ], "variables": [] }
[ { "line": "let t := n % 3", "before_state": "n : β„•\nx✝ : 0 < n\n⊒ 7 ∣ 2 ^ n - 1 ↔ 3 ∣ n", "after_state": "n : β„•\nx✝ : 0 < n\nt : β„• := n % 3\n⊒ 7 ∣ 2 ^ n - 1 ↔ 3 ∣ n" }, { "line": "refine_lift\n let t := n % 3;\n ?_", "before_state": "n : β„•\nx✝ : 0 < n\n⊒ 7 ∣ 2 ^ n - 1 ↔ 3 ∣ n", "after_...
theorem imo1964_q1b (n : β„•) : Β¬7 ∣ 2 ^ n + 1 := by intro h let t := n % 3 have : t < 3 := Nat.mod_lt _ (by decide) have H : 2 ^ t + 1 ≑ 0 [MOD 7] := calc 2 ^ t + 1 ≑ 2 ^ n + 1 [MOD 7] := by gcongr ?_ + 1; exact (two_pow_mod_seven n).symm _ ≑ 0 [MOD 7] := h.modEq_zero_nat interval_cases t <;> contradiction
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1964Q1.lean
{ "open": [ "Nat", "Imo1964Q1" ], "variables": [] }
[ { "line": "intro h", "before_state": "n : β„•\n⊒ Β¬7 ∣ 2 ^ n + 1", "after_state": "n : β„•\nh : 7 ∣ 2 ^ n + 1\n⊒ False" }, { "line": "let t := n % 3", "before_state": "n : β„•\nh : 7 ∣ 2 ^ n + 1\n⊒ False", "after_state": "n : β„•\nh : 7 ∣ 2 ^ n + 1\nt : β„• := n % 3\n⊒ False" }, { "line": "...
theorem left_factor_large {m : β„€} (n : β„€) (h : 1 < m) : 1 < (n - m) ^ 2 + m ^ 2 := by nlinarith
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1969Q1.lean
{ "open": [ "Int Nat" ], "variables": [] }
[ { "line": "nlinarith", "before_state": "m n : β„€\nh : 1 < m\n⊒ 1 < (n - m) ^ 2 + m ^ 2", "after_state": "No Goals!" }, { "line": "ring1", "before_state": "m n : β„€\nh : 1 < m\na✝ : 1 β‰₯ (n - m) ^ 2 + m ^ 2\n⊒ 3 * -1 + (0 - (n - m) ^ 2) + 4 * (1 + 1 - m) + ((n - m) ^ 2 + m ^ 2 - 1) + (0 - (1 + 1...
theorem right_factor_large {m : β„€} (n : β„€) (h : 1 < m) : 1 < (n + m) ^ 2 + m ^ 2 := by nlinarith
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1969Q1.lean
{ "open": [ "Int Nat" ], "variables": [] }
[ { "line": "nlinarith", "before_state": "m n : β„€\nh : 1 < m\n⊒ 1 < (n + m) ^ 2 + m ^ 2", "after_state": "No Goals!" }, { "line": "ring1", "before_state": "m n : β„€\nh : 1 < m\na✝ : 1 β‰₯ (n + m) ^ 2 + m ^ 2\n⊒ 3 * -1 + (0 - (n + m) ^ 2) + 4 * (1 + 1 - m) + ((n + m) ^ 2 + m ^ 2 - 1) + (0 - (1 + 1...
theorem int_large {m : β„€} (h : 1 < m) : 1 < m.natAbs := by exact_mod_cast lt_of_lt_of_le h le_natAbs
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1969Q1.lean
{ "open": [ "Int Nat" ], "variables": [] }
[ { "line": "exact_mod_cast lt_of_lt_of_le h le_natAbs", "before_state": "m : β„€\nh : 1 < m\n⊒ 1 < m.natAbs", "after_state": "No Goals!" }, { "line": "exact mod_cast (lt_of_lt_of_le h le_natAbs : _)", "before_state": "m : β„€\nh : 1 < m\n⊒ 1 < m.natAbs", "after_state": "No Goals!" } ]
theorem polynomial_not_prime {m : β„•} (h1 : 1 < m) (n : β„•) : Β¬Nat.Prime (n ^ 4 + 4 * m ^ 4) := by have h2 : 1 < (m : β„€) := Int.ofNat_lt.mpr h1 refine not_prime_of_int_mul' (left_factor_large (n : β„€) h2) (right_factor_large (n : β„€) h2) ?_ apply factorization
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1969Q1.lean
{ "open": [ "Int Nat" ], "variables": [] }
[ { "line": "have h2 : 1 < (m : β„€) := Int.ofNat_lt.mpr h1", "before_state": "m : β„•\nh1 : 1 < m\nn : β„•\n⊒ Β¬Nat.Prime (n ^ 4 + 4 * m ^ 4)", "after_state": "m : β„•\nh1 : 1 < m\nn : β„•\nh2 : 1 < ↑m\n⊒ Β¬Nat.Prime (n ^ 4 + 4 * m ^ 4)" }, { "line": "refine_lift\n have h2 : 1 < (m : β„€) := Int.ofNat_lt.mpr ...
theorem bound (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : a ^ 4 / (a ^ 4 + b ^ 4 + c ^ 4) ≀ a ^ 3 / sqrt ((a ^ 3) ^ 2 + ↑8 * b ^ 3 * c ^ 3) := by rw [div_le_div_iffβ‚€ (by positivity) (by positivity)] calc a ^ 4 * sqrt ((a ^ 3) ^ 2 + (8:ℝ) * b ^ 3 * c ^ 3) = a ^ 3 * (a * sqrt ((a ^ 3) ^ 2 + (8:ℝ) * b ^ 3 * c ^ 3)) := by ring _ ≀ a ^ 3 * (a ^ 4 + b ^ 4 + c ^ 4) := ?_ gcongr apply le_of_pow_le_pow_leftβ‚€ two_ne_zero (by positivity) rw [mul_pow] rw [sq_sqrt (by positivity)] rw [← sub_nonneg] calc (a ^ 4 + b ^ 4 + c ^ 4) ^ 2 - a ^ 2 * ((a ^ 3) ^ 2 + 8 * b ^ 3 * c ^ 3) = 2 * (a ^ 2 * (b ^ 2 - c ^ 2)) ^ 2 + (b ^ 4 - c ^ 4) ^ 2 + (2 * (a ^ 2 * b * c - b ^ 2 * c ^ 2)) ^ 2 := by ring _ β‰₯ 0 := by positivity
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2001Q2.lean
{ "open": [ "Real" ], "variables": [ "{a b c : ℝ}" ] }
[ { "line": "rw [div_le_div_iffβ‚€ (by positivity) (by positivity)]", "before_state": "a b c : ℝ\nha : 0 < a\nhb : 0 < b\nhc : 0 < c\n⊒ a ^ 4 / (a ^ 4 + b ^ 4 + c ^ 4) ≀ a ^ 3 / √((a ^ 3) ^ 2 + 8 * b ^ 3 * c ^ 3)", "after_state": "a b c : ℝ\nha : 0 < a\nhb : 0 < b\nhc : 0 < c\n⊒ a ^ 4 * √((a ^ 3) ^ 2 + 8 * ...
theorem imo2001_q6 (hd : 0 < d) (hdc : d < c) (hcb : c < b) (hba : b < a) (h : a * c + b * d = (a + b - c + d) * (-a + b + c + d)) : Β¬Prime (a * b + c * d) := by intro (h0 : Prime (a * b + c * d)) have ha : 0 < a := by omega have hb : 0 < b := by omega have hc : 0 < c := by omega -- the key step is to show that `a*c + b*d` divides the product `(a*b + c*d) * (a*d + b*c)` have dvd_mul : a * c + b * d ∣ (a * b + c * d) * (a * d + b * c) := by use b ^ 2 + b * d + d ^ 2 linear_combination b * d * h -- since `a*b + c*d` is prime (by assumption), it must divide `a*c + b*d` or `a*d + b*c` obtain (h1 : a * b + c * d ∣ a * c + b * d) | (h2 : a * c + b * d ∣ a * d + b * c) := h0.left_dvd_or_dvd_right_of_dvd_mul dvd_mul -- in both cases, we derive a contradiction Β· have aux : 0 < a * c + b * d := by nlinarith only [ha, hb, hc, hd] have : a * b + c * d ≀ a * c + b * d := Int.le_of_dvd aux h1 nlinarith only [hba, hcb, hdc, h, this] Β· have aux : 0 < a * d + b * c := by nlinarith only [ha, hb, hc, hd] have : a * c + b * d ≀ a * d + b * c := Int.le_of_dvd aux h2 nlinarith only [hba, hdc, h, this]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2001Q6.lean
{ "open": [], "variables": [ "{a b c d : β„€}" ] }
[ { "line": "intro (h0 : Prime (a * b + c * d))", "before_state": "a b c d : β„€\nhd : 0 < d\nhdc : d < c\nhcb : c < b\nhba : b < a\nh : a * c + b * d = (a + b - c + d) * (-a + b + c + d)\n⊒ Β¬Prime (a * b + c * d)", "after_state": "a b c d : β„€\nhd : 0 < d\nhdc : d < c\nhcb : c < b\nhba : b < a\nh : a * c + ...
theorem key_insight (x y z : ℝ) (hx : x > 0) (hy : y > 0) (hz : z > 0) (h : x * y * z β‰₯ 1) : (x ^ 5 - x ^ 2) / (x ^ 5 + y ^ 2 + z ^ 2) β‰₯ (x ^ 2 - y * z) / (x ^ 2 + y ^ 2 + z ^ 2) := by have key : (x ^ 5 - x ^ 2) / (x ^ 5 + y ^ 2 + z ^ 2) - (x ^ 5 - x ^ 2 * 1) / (x ^ 3 * (x ^ 2 + y ^ 2 + z ^ 2)) = (x ^ 3 - 1) ^ 2 * x ^ 2 * (y ^ 2 + z ^ 2) / ((x ^ 5 + y ^ 2 + z ^ 2) * (x ^ 3 * (x ^ 2 + y ^ 2 + z ^ 2))) := by field_simp ring have hβ‚… : (x ^ 3 - 1) ^ 2 * x ^ 2 * (y ^ 2 + z ^ 2) / ((x ^ 5 + y ^ 2 + z ^ 2) * (x ^ 3 * (x ^ 2 + y ^ 2 + z ^ 2))) β‰₯ 0 := by positivity calc (x ^ 5 - x ^ 2) / (x ^ 5 + y ^ 2 + z ^ 2) β‰₯ (x ^ 5 - x ^ 2 * 1) / (x ^ 3 * (x ^ 2 + y ^ 2 + z ^ 2)) := by linarith only [key, hβ‚…] _ β‰₯ (x ^ 5 - x ^ 2 * (x * y * z)) / (x ^ 3 * (x ^ 2 + y ^ 2 + z ^ 2)) := by gcongr _ = (x ^ 2 - y * z) / (x ^ 2 + y ^ 2 + z ^ 2) := by field_simp; ring
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2005Q3.lean
{ "open": [], "variables": [] }
[ { "line": "have key :\n (x ^ 5 - x ^ 2) / (x ^ 5 + y ^ 2 + z ^ 2) - (x ^ 5 - x ^ 2 * 1) / (x ^ 3 * (x ^ 2 + y ^ 2 + z ^ 2)) =\n (x ^ 3 - 1) ^ 2 * x ^ 2 * (y ^ 2 + z ^ 2) / ((x ^ 5 + y ^ 2 + z ^ 2) * (x ^ 3 * (x ^ 2 + y ^ 2 + z ^ 2))) :=\n by\n field_simp\n ring", "before_state": "x y z : ℝ\nhx : x > ...
theorem imo2005_q3 (x y z : ℝ) (hx : x > 0) (hy : y > 0) (hz : z > 0) (h : x * y * z β‰₯ 1) : (x ^ 5 - x ^ 2) / (x ^ 5 + y ^ 2 + z ^ 2) + (y ^ 5 - y ^ 2) / (y ^ 5 + z ^ 2 + x ^ 2) + (z ^ 5 - z ^ 2) / (z ^ 5 + x ^ 2 + y ^ 2) β‰₯ 0 := by calc (x ^ 5 - x ^ 2) / (x ^ 5 + y ^ 2 + z ^ 2) + (y ^ 5 - y ^ 2) / (y ^ 5 + z ^ 2 + x ^ 2) + (z ^ 5 - z ^ 2) / (z ^ 5 + x ^ 2 + y ^ 2) β‰₯ (x ^ 2 - y * z) / (x ^ 2 + y ^ 2 + z ^ 2) + (y ^ 2 - z * x) / (y ^ 2 + z ^ 2 + x ^ 2) + (z ^ 2 - x * y) / (z ^ 2 + x ^ 2 + y ^ 2) := by gcongr ?_ + ?_ + ?_ <;> apply key_insight <;> linarith _ = 1 / 2 * ((x - y) ^ 2 + (y - z) ^ 2 + (z - x) ^ 2) / (x ^ 2 + y ^ 2 + z ^ 2) := by ring _ β‰₯ 0 := by positivity
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2005Q3.lean
{ "open": [ "Imo2005Q3" ], "variables": [] }
[ { "line": "calc\n (x ^ 5 - x ^ 2) / (x ^ 5 + y ^ 2 + z ^ 2) + (y ^ 5 - y ^ 2) / (y ^ 5 + z ^ 2 + x ^ 2) +\n (z ^ 5 - z ^ 2) / (z ^ 5 + x ^ 2 + y ^ 2) β‰₯\n (x ^ 2 - y * z) / (x ^ 2 + y ^ 2 + z ^ 2) + (y ^ 2 - z * x) / (y ^ 2 + z ^ 2 + x ^ 2) +\n (z ^ 2 - x * y) / (z ^ 2 + x ^ 2 + y ^ 2) :=\n ...
theorem lhs_ineq {x y : ℝ} (hxy : 0 ≀ x * y) : 16 * x ^ 2 * y ^ 2 * (x + y) ^ 2 ≀ ((x + y) ^ 2) ^ 3 := by have : (x - y) ^ 2 * ((x + y) ^ 2 + 4 * (x * y)) β‰₯ 0 := by positivity calc 16 * x ^ 2 * y ^ 2 * (x + y) ^ 2 ≀ ((x + y) ^ 2) ^ 2 * (x + y) ^ 2 := by gcongr; linarith _ = ((x + y) ^ 2) ^ 3 := by ring
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2006Q3.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "have : (x - y) ^ 2 * ((x + y) ^ 2 + 4 * (x * y)) β‰₯ 0 := by positivity", "before_state": "x y : ℝ\nhxy : 0 ≀ x * y\n⊒ 16 * x ^ 2 * y ^ 2 * (x + y) ^ 2 ≀ ((x + y) ^ 2) ^ 3", "after_state": "x y : ℝ\nhxy : 0 ≀ x * y\nthis : (x - y) ^ 2 * ((x + y) ^ 2 + 4 * (x * y)) β‰₯ 0\n⊒ 16 * x ^ 2 * y ^ 2 * (x...
theorem four_pow_four_pos : (0 : ℝ) < 4 ^ 4 := by norm_num
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2006Q3.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 0 < 4 ^ 4", "after_state": "No Goals!" } ]
theorem rhs_ineq {x y : ℝ} : 3 * (x + y) ^ 2 ≀ 2 * (x ^ 2 + y ^ 2 + (x + y) ^ 2) := by have : 0 ≀ (x - y) ^ 2 := by positivity linarith
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2006Q3.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "have : 0 ≀ (x - y) ^ 2 := by positivity", "before_state": "x y : ℝ\n⊒ 3 * (x + y) ^ 2 ≀ 2 * (x ^ 2 + y ^ 2 + (x + y) ^ 2)", "after_state": "x y : ℝ\nthis : 0 ≀ (x - y) ^ 2\n⊒ 3 * (x + y) ^ 2 ≀ 2 * (x ^ 2 + y ^ 2 + (x + y) ^ 2)" }, { "line": "focus\n refine\n no_implicit_lambda%\n ...
theorem zero_lt_32 : (0 : ℝ) < 32 := by norm_num
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2006Q3.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "norm_num", "before_state": "⊒ 0 < 32", "after_state": "No Goals!" } ]
theorem subst_wlog {x y z s : ℝ} (hxy : 0 ≀ x * y) (hxyz : x + y + z = 0) : 32 * |x * y * z * s| ≀ sqrt 2 * (x ^ 2 + y ^ 2 + z ^ 2 + s ^ 2) ^ 2 := by have hz : (x + y) ^ 2 = z ^ 2 := by linear_combination (x + y - z) * hxyz have this := calc 2 * s ^ 2 * (16 * x ^ 2 * y ^ 2 * (x + y) ^ 2) ≀ _ * _ ^ 3 := by gcongr; exact lhs_ineq hxy _ ≀ (3 * (x + y) ^ 2 + 2 * s ^ 2) ^ 4 / 4 ^ 4 := mid_ineq _ ≀ (2 * (x ^ 2 + y ^ 2 + (x + y) ^ 2) + 2 * s ^ 2) ^ 4 / 4 ^ 4 := by gcongr (?_ + _) ^ 4 / _ apply rhs_ineq refine le_of_pow_le_pow_leftβ‚€ two_ne_zero (by positivity) ?_ calc (32 * |x * y * z * s|) ^ 2 = 32 * (2 * s ^ 2 * (16 * x ^ 2 * y ^ 2 * (x + y) ^ 2)) := by rw [mul_pow]; ring rw [sq_abs]; ring rw [hz]; ring _ ≀ 32 * ((2 * (x ^ 2 + y ^ 2 + (x + y) ^ 2) + 2 * s ^ 2) ^ 4 / 4 ^ 4) := by gcongr _ = (sqrt 2 * (x ^ 2 + y ^ 2 + z ^ 2 + s ^ 2) ^ 2) ^ 2 := by field_simp rw [mul_pow] rw [sq_sqrt zero_le_two] rw [hz] ring
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2006Q3.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "have hz : (x + y) ^ 2 = z ^ 2 := by linear_combination (x + y - z) * hxyz", "before_state": "x y z s : ℝ\nhxy : 0 ≀ x * y\nhxyz : x + y + z = 0\n⊒ 32 * |x * y * z * s| ≀ √2 * (x ^ 2 + y ^ 2 + z ^ 2 + s ^ 2) ^ 2", "after_state": "x y z s : ℝ\nhxy : 0 ≀ x * y\nhxyz : x + y + z = 0\nhz : (x + y)...
theorem subst_proof₁ (x y z s : ℝ) (hxyz : x + y + z = 0) : |x * y * z * s| ≀ sqrt 2 / 32 * (x ^ 2 + y ^ 2 + z ^ 2 + s ^ 2) ^ 2 := by wlog h' : 0 ≀ x * y generalizing x y z; swap Β· rw [div_mul_eq_mul_div, le_div_iffβ‚€' zero_lt_32] exact subst_wlog h' hxyz rcases (mul_nonneg_of_three x y z).resolve_left h' with h | h Β· convert this y z x _ h using 2 <;> linarith Β· convert this z x y _ h using 2 <;> linarith
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2006Q3.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "wlog h' : 0 ≀ x * y generalizing x y z", "before_state": "x y z s : ℝ\nhxyz : x + y + z = 0\n⊒ |x * y * z * s| ≀ √2 / 32 * (x ^ 2 + y ^ 2 + z ^ 2 + s ^ 2) ^ 2", "after_state": "case inr\nx y z s : ℝ\nhxyz : x + y + z = 0\nthis : βˆ€ (x y z : ℝ), x + y + z = 0 β†’ 0 ≀ x * y β†’ |x * y * z * s| ≀ √2 ...
theorem proofβ‚‚ (M : ℝ) (h : βˆ€ a b c : ℝ, |a * b * (a ^ 2 - b ^ 2) + b * c * (b ^ 2 - c ^ 2) + c * a * (c ^ 2 - a ^ 2)| ≀ M * (a ^ 2 + b ^ 2 + c ^ 2) ^ 2) : 9 * sqrt 2 / 32 ≀ M := by set Ξ± := sqrt (2:ℝ) have hΞ± : Ξ± ^ 2 = 2 := sq_sqrt (by norm_num) let a := 2 - 3 * Ξ± let c := 2 + 3 * Ξ± calc _ = 18 ^ 2 * 2 * Ξ± / 48 ^ 2 := by ring _ ≀ M := ?_ rw [div_le_iffβ‚€ (by positivity)] calc 18 ^ 2 * 2 * Ξ± = 18 ^ 2 * Ξ± ^ 2 * Ξ± := by linear_combination -324 * Ξ± * hΞ± _ = abs (-(18 ^ 2 * Ξ± ^ 2 * Ξ±)) := by rw [abs_neg, abs_of_nonneg]; positivity _ = |a * 2 * (a ^ 2 - 2 ^ 2) + 2 * c * (2 ^ 2 - c ^ 2) + c * a * (c ^ 2 - a ^ 2)| := by ring_nf! _ ≀ M * (a ^ 2 + 2 ^ 2 + c ^ 2) ^ 2 := by apply h _ = M * 48 ^ 2 := by linear_combination (324 * Ξ± ^ 2 + 1080) * M * hΞ±
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2006Q3.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "set Ξ± := sqrt (2 : ℝ)", "before_state": "M : ℝ\nh :\n βˆ€ (a b c : ℝ),\n |a * b * (a ^ 2 - b ^ 2) + b * c * (b ^ 2 - c ^ 2) + c * a * (c ^ 2 - a ^ 2)| ≀ M * (a ^ 2 + b ^ 2 + c ^ 2) ^ 2\n⊒ 9 * √2 / 32 ≀ M", "after_state": "M : ℝ\nh :\n βˆ€ (a b c : ℝ),\n |a * b * (a ^ 2 - b ^ 2) + b * c * ...
theorem subst_abc {x y z : ℝ} (h : x * y * z = 1) : βˆƒ a b c : ℝ, a β‰  0 ∧ b β‰  0 ∧ c β‰  0 ∧ x = a / b ∧ y = b / c ∧ z = c / a := by use x, 1, 1 / y obtain ⟨⟨hx, hy⟩, _⟩ : (x β‰  0 ∧ y β‰  0) ∧ z β‰  0 := by have := h.symm β–Έ one_ne_zero simpa [not_or] using this have : z * (y * x) = 1 := by rw [← h]; ac_rfl field_simp [*]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2008Q2.lean
{ "open": [], "variables": [] }
[ { "line": "use x, 1, 1 / y", "before_state": "x y z : ℝ\nh : x * y * z = 1\n⊒ βˆƒ a b c, a β‰  0 ∧ b β‰  0 ∧ c β‰  0 ∧ x = a / b ∧ y = b / c ∧ z = c / a", "after_state": "case h\nx y z : ℝ\nh : x * y * z = 1\n⊒ x β‰  0 ∧ 1 β‰  0 ∧ 1 / y β‰  0 ∧ x = x / 1 ∧ y = 1 / (1 / y) ∧ z = 1 / y / x" }, { "line": "refine...
theorem imo2008_q2a (x y z : ℝ) (h : x * y * z = 1) (hx : x β‰  1) (hy : y β‰  1) (hz : z β‰  1) : x ^ 2 / (x - 1) ^ 2 + y ^ 2 / (y - 1) ^ 2 + z ^ 2 / (z - 1) ^ 2 β‰₯ 1 := by obtain ⟨a, b, c, ha, hb, hc, rfl, rfl, rfl⟩ := subst_abc h obtain ⟨m, n, rfl, rfl⟩ : βˆƒ m n, b = c - m ∧ a = c - m - n := by use c - b, b - a; simp have hm_ne_zero : m β‰  0 := by contrapose! hy; field_simp; assumption have hn_ne_zero : n β‰  0 := by contrapose! hx; field_simp; assumption have hmn_ne_zero : m + n β‰  0 := by contrapose! hz; field_simp; linarith have hc_sub_sub : c - (c - m - n) = m + n := by abel rw [ge_iff_le] rw [← sub_nonneg] convert sq_nonneg ((c * (m ^ 2 + n ^ 2 + m * n) - m * (m + n) ^ 2) / (m * n * (m + n))) field_simp [hc_sub_sub]; ring
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2008Q2.lean
{ "open": [], "variables": [] }
[ { "line": "obtain ⟨a, b, c, ha, hb, hc, rfl, rfl, rfl⟩ := subst_abc h", "before_state": "x y z : ℝ\nh : x * y * z = 1\nhx : x β‰  1\nhy : y β‰  1\nhz : z β‰  1\n⊒ x ^ 2 / (x - 1) ^ 2 + y ^ 2 / (y - 1) ^ 2 + z ^ 2 / (z - 1) ^ 2 β‰₯ 1", "after_state": "No Goals!" } ]
theorem abs_eq_one_of_pow_eq_one (x : ℝ) (n : β„•) (hn : n β‰  0) (h : x ^ n = 1) : |x| = 1 := by rw [← pow_left_injβ‚€ (abs_nonneg x) zero_le_one hn] rw [one_pow] rw [pow_abs] rw [h] rw [abs_one]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2008Q4.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "rw [← pow_left_injβ‚€ (abs_nonneg x) zero_le_one hn]", "before_state": "x : ℝ\nn : β„•\nhn : n β‰  0\nh : x ^ n = 1\n⊒ |x| = 1", "after_state": "x : ℝ\nn : β„•\nhn : n β‰  0\nh : x ^ n = 1\n⊒ |x| ^ n = 1 ^ n" }, { "line": "rewrite [← pow_left_injβ‚€ (abs_nonneg x) zero_le_one hn]", "before_st...
theorem imo2011_q3 (f : ℝ β†’ ℝ) (hf : βˆ€ x y, f (x + y) ≀ y * f x + f (f x)) : βˆ€ x ≀ 0, f x = 0 := by -- reparameterize have hxt : βˆ€ x t, f t ≀ t * f x - x * f x + f (f x) := fun x t => calc f t = f (x + (t - x)) := by rw [add_eq_of_eq_sub' rfl] _ ≀ (t - x) * f x + f (f x) := hf x (t - x) _ = t * f x - x * f x + f (f x) := by rw [sub_mul] have h_ab_combined : βˆ€ a b, a * f a + b * f b ≀ 2 * f a * f b := fun a b => by linarith [hxt b (f a), hxt a (f b)] have h_f_nonneg_of_pos : βˆ€ a < 0, 0 ≀ f a := fun a han => suffices a * f a ≀ 0 from nonneg_of_mul_nonpos_right this han add_le_iff_nonpos_left.mp (h_ab_combined a (2 * f a)) have h_f_nonpos : βˆ€ x, f x ≀ 0 := fun x => by by_contra h_suppose_not -- If we choose a small enough argument for f, then we get a contradiction. let s := (x * f x - f (f x)) / f x have hm : min 0 s - 1 < s := (sub_one_lt _).trans_le (min_le_right 0 s) have hml : min 0 s - 1 < 0 := (sub_one_lt _).trans_le (min_le_left 0 s) suffices f (min 0 s - 1) < 0 from not_le.mpr this (h_f_nonneg_of_pos (min 0 s - 1) hml) have hp : 0 < f x := not_le.mp h_suppose_not calc f (min 0 s - 1) ≀ (min 0 s - 1) * f x - x * f x + f (f x) := hxt x (min 0 s - 1) _ < s * f x - x * f x + f (f x) := by linarith [(mul_lt_mul_right hp).mpr hm] _ = 0 := by rw [(eq_div_iff hp.ne.symm).mp rfl]; linarith have h_fx_zero_of_neg : βˆ€ x < 0, f x = 0 := fun x hxz => (h_f_nonpos x).antisymm (h_f_nonneg_of_pos x hxz) intro x hx obtain (h_x_neg : x < 0) | (rfl : x = 0) := hx.lt_or_eq Β· exact h_fx_zero_of_neg _ h_x_neg Β· suffices 0 ≀ f 0 from le_antisymm (h_f_nonpos 0) this have hno : f (-1) = 0 := h_fx_zero_of_neg (-1) neg_one_lt_zero have hp := hxt (-1) (-1) rw [hno] at hp linarith
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2011Q3.lean
{ "open": [], "variables": [] }
[ { "line": "have hxt : βˆ€ x t, f t ≀ t * f x - x * f x + f (f x) := fun x t =>\n calc\n f t = f (x + (t - x)) := by rw [add_eq_of_eq_sub' rfl]\n _ ≀ (t - x) * f x + f (f x) := (hf x (t - x))\n _ = t * f x - x * f x + f (f x) := by rw [sub_mul]", "before_state": "f : ℝ β†’ ℝ\nhf : βˆ€ (x y : ℝ), f (x + y...
theorem imo2011_q5 (f : β„€ β†’ β„€) (hpos : βˆ€ n : β„€, 0 < f n) (hdvd : βˆ€ m n : β„€, f (m - n) ∣ f m - f n) : βˆ€ m n : β„€, f m ≀ f n β†’ f m ∣ f n := by intro m n h_fm_le_fn rcases lt_or_eq_of_le h_fm_le_fn with h_fm_lt_fn | h_fm_eq_fn Β· -- m < n let d := f m - f (m - n) have h_fn_dvd_d : f n ∣ d := by rw [← sub_sub_self m n] exact hdvd m (m - n) have h_d_lt_fn : d < f n := calc d < f m := sub_lt_self _ (hpos (m - n)) _ < f n := h_fm_lt_fn have h_neg_d_lt_fn : -d < f n := by calc -d = f (m - n) - f m := neg_sub _ _ _ < f (m - n) := sub_lt_self _ (hpos m) _ ≀ f n - f m := le_of_dvd (sub_pos.mpr h_fm_lt_fn) ?_ _ < f n := sub_lt_self _ (hpos m) -- ⊒ f (m - n) ∣ f n - f m rw [← Int.dvd_neg] rw [neg_sub] exact hdvd m n have h_d_eq_zero : d = 0 := by obtain hd | hd | hd : d > 0 ∨ d = 0 ∨ d < 0 := trichotomous d 0 Β· -- d > 0 have h₁ : f n ≀ d := le_of_dvd hd h_fn_dvd_d have hβ‚‚ : Β¬f n ≀ d := not_le.mpr h_d_lt_fn contradiction Β· -- d = 0 exact hd Β· -- d < 0 have h₁ : f n ≀ -d := le_of_dvd (neg_pos.mpr hd) h_fn_dvd_d.neg_right have hβ‚‚ : Β¬f n ≀ -d := not_le.mpr h_neg_d_lt_fn contradiction have h₁ : f m = f (m - n) := sub_eq_zero.mp h_d_eq_zero have hβ‚‚ : f (m - n) ∣ f m - f n := hdvd m n rw [← h₁] at hβ‚‚ exact (dvd_iff_dvd_of_dvd_sub hβ‚‚).mp dvd_rfl Β· -- m = n rw [h_fm_eq_fn]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2011Q5.lean
{ "open": [ "Int" ], "variables": [] }
[ { "line": "intro m n h_fm_le_fn", "before_state": "f : β„€ β†’ β„€\nhpos : βˆ€ (n : β„€), 0 < f n\nhdvd : βˆ€ (m n : β„€), f (m - n) ∣ f m - f n\n⊒ βˆ€ (m n : β„€), f m ≀ f n β†’ f m ∣ f n", "after_state": "f : β„€ β†’ β„€\nhpos : βˆ€ (n : β„€), 0 < f n\nhdvd : βˆ€ (m n : β„€), f (m - n) ∣ f m - f n\nm n : β„€\nh_fm_le_fn : f m ≀ f n\n⊒ f...
theorem imo2020_q2 (a b c d : ℝ) (hd0 : 0 < d) (hdc : d ≀ c) (hcb : c ≀ b) (hba : b ≀ a) (h1 : a + b + c + d = 1) : (a + 2 * b + 3 * c + 4 * d) * a ^ a * b ^ b * c ^ c * d ^ d < 1 := by have hp : a ^ a * b ^ b * c ^ c * d ^ d ≀ a * a + b * b + c * c + d * d := by refine geom_mean_le_arith_mean4_weighted ?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_ h1 <;> linarith calc (a + 2 * b + 3 * c + 4 * d) * a ^ a * b ^ b * c ^ c * d ^ d = (a + 2 * b + 3 * c + 4 * d) * (a ^ a * b ^ b * c ^ c * d ^ d) := by ac_rfl _ ≀ (a + 2 * b + 3 * c + 4 * d) * (a * a + b * b + c * c + d * d) := by gcongr; linarith _ = (a + 2 * b + 3 * c + 4 * d) * a ^ 2 + (a + 2 * b + 3 * c + 4 * d) * b ^ 2 + (a + 2 * b + 3 * c + 4 * d) * c ^ 2 + (a + 2 * b + 3 * c + 4 * d) * d ^ 2 := by ring _ ≀ (a + 3 * b + 3 * c + 3 * d) * a ^ 2 + (3 * a + b + 3 * c + 3 * d) * b ^ 2 + (3 * a + 3 * b + c + 3 * d) * c ^ 2 + (3 * a + 3 * b + 3 * c + d) * d ^ 2 := by gcongr ?_ * _ + ?_ * _ + ?_ * _ + ?_ * _ <;> linarith _ < (a + 3 * b + 3 * c + 3 * d) * a ^ 2 + (3 * a + b + 3 * c + 3 * d) * b ^ 2 + (3 * a + 3 * b + c + 3 * d) * c ^ 2 + (3 * a + 3 * b + 3 * c + d) * d ^ 2 + (6 * a * b * c + 6 * a * b * d + 6 * a * c * d + 6 * b * c * d) := (lt_add_of_pos_right _ (by apply_rules [add_pos, mul_pos, zero_lt_one] <;> linarith)) _ = (a + b + c + d) ^ 3 := by ring _ = 1 := by simp [h1]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2020Q2.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "have hp : a ^ a * b ^ b * c ^ c * d ^ d ≀ a * a + b * b + c * c + d * d := by\n refine geom_mean_le_arith_mean4_weighted ?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_ h1 <;> linarith", "before_state": "a b c d : ℝ\nhd0 : 0 < d\nhdc : d ≀ c\nhcb : c ≀ b\nhba : b ≀ a\nh1 : a + b + c + d = 1\n⊒ (a + 2 * b + 3 * c + 4 * ...
theorem sqrt_two_mul_sub_one_le_one : sqrt (2 * x - 1) ≀ 1 ↔ x ≀ 1 := by simp [sqrt_le_iff, ← two_mul]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1959Q2.lean
{ "open": [ "Set Real" ], "variables": [ "{x A : ℝ}" ] }
[ { "line": "simp [sqrt_le_iff, ← two_mul]", "before_state": "x : ℝ\n⊒ √(2 * x - 1) ≀ 1 ↔ x ≀ 1", "after_state": "No Goals!" } ]
private lemma helper_5_digits {c : β„€} (hc : 6 * 10 ^ 5 + c = 4 * (10 * c + 6)) : c = 15384 := by omega
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1962Q1.lean
{ "open": [ "Nat" ], "variables": [] }
[ { "line": "omega", "before_state": "c : β„€\nhc : 6 * 10 ^ 5 + c = 4 * (10 * c + 6)\n⊒ c = 15384", "after_state": "No Goals!" } ]
theorem imo1972_q5 (f g : ℝ β†’ ℝ) (hf1 : βˆ€ x, βˆ€ y, f (x + y) + f (x - y) = 2 * f x * g y) (hf2 : βˆ€ y, β€–f yβ€– ≀ 1) (hf3 : βˆƒ x, f x β‰  0) (y : ℝ) : β€–g yβ€– ≀ 1 := by -- Suppose the conclusion does not hold. by_contra! hneg set S := Set.range fun x => β€–f xβ€– -- Introduce `k`, the supremum of `f`. let k : ℝ := sSup S -- Show that `β€–f xβ€– ≀ k`. have hk₁ : βˆ€ x, β€–f xβ€– ≀ k := by have h : BddAbove S := ⟨1, Set.forall_mem_range.mpr hf2⟩ intro x exact le_csSup h (Set.mem_range_self x) -- Show that `2 * (β€–f xβ€– * β€–g yβ€–) ≀ 2 * k`. have hkβ‚‚ : βˆ€ x, 2 * (β€–f xβ€– * β€–g yβ€–) ≀ 2 * k := fun x ↦ calc 2 * (β€–f xβ€– * β€–g yβ€–) = β€–2 * f x * g yβ€– := by simp [abs_mul, mul_assoc] _ = β€–f (x + y) + f (x - y)β€– := by rw [hf1] _ ≀ β€–f (x + y)β€– + β€–f (x - y)β€– := norm_add_le _ _ _ ≀ k + k := add_le_add (hk₁ _) (hk₁ _) _ = 2 * k := (two_mul _).symm set k' := k / β€–g yβ€– -- Demonstrate that `k' < k` using `hneg`. have H₁ : k' < k := by have h₁ : 0 < k := by obtain ⟨x, hx⟩ := hf3 calc 0 < β€–f xβ€– := norm_pos_iff.mpr hx _ ≀ k := hk₁ x rw [div_lt_iffβ‚€] Β· apply lt_mul_of_one_lt_right h₁ hneg Β· exact zero_lt_one.trans hneg -- Demonstrate that `k ≀ k'` using `hkβ‚‚`. have Hβ‚‚ : k ≀ k' := by have h₁ : βˆƒ x : ℝ, x ∈ S := by use β€–f 0β€–; exact Set.mem_range_self 0 have hβ‚‚ : βˆ€ x, β€–f xβ€– ≀ k' := by intro x rw [le_div_iffβ‚€] Β· apply (mul_le_mul_left zero_lt_two).mp (hkβ‚‚ x) Β· exact zero_lt_one.trans hneg apply csSup_le h₁ rintro y' ⟨yy, rfl⟩ exact hβ‚‚ yy -- Conclude by obtaining a contradiction, `k' < k'`. apply lt_irrefl k' calc k' < k := H₁ _ ≀ k' := Hβ‚‚
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1972Q5.lean
{ "open": [], "variables": [] }
[ { "line": "by_contra! hneg", "before_state": "f g : ℝ β†’ ℝ\nhf1 : βˆ€ (x y : ℝ), f (x + y) + f (x - y) = 2 * f x * g y\nhf2 : βˆ€ (y : ℝ), β€–f yβ€– ≀ 1\nhf3 : βˆƒ x, f x β‰  0\ny : ℝ\n⊒ β€–g yβ€– ≀ 1", "after_state": "f g : ℝ β†’ ℝ\nhf1 : βˆ€ (x y : ℝ), f (x + y) + f (x - y) = 2 * f x * g y\nhf2 : βˆ€ (y : ℝ), β€–f yβ€– ≀ 1\nhf3...
theorem imo1972_q5' (f g : ℝ β†’ ℝ) (hf1 : βˆ€ x, βˆ€ y, f (x + y) + f (x - y) = 2 * f x * g y) (hf2 : BddAbove (Set.range fun x => β€–f xβ€–)) (hf3 : βˆƒ x, f x β‰  0) (y : ℝ) : β€–g yβ€– ≀ 1 := by obtain ⟨x, hx⟩ := hf3 set k := ⨆ x, β€–f xβ€– have h : βˆ€ x, β€–f xβ€– ≀ k := le_ciSup hf2 by_contra! H have hgy : 0 < β€–g yβ€– := by linarith have k_pos : 0 < k := lt_of_lt_of_le (norm_pos_iff.mpr hx) (h x) have : k / β€–g yβ€– < k := (div_lt_iffβ‚€ hgy).mpr (lt_mul_of_one_lt_right k_pos H) have : k ≀ k / β€–g yβ€– := by suffices βˆ€ x, β€–f xβ€– ≀ k / β€–g yβ€– from ciSup_le this intro x suffices 2 * (β€–f xβ€– * β€–g yβ€–) ≀ 2 * k by rwa [le_div_iffβ‚€ hgy, ← mul_le_mul_left (zero_lt_two : (0 : ℝ) < 2)] calc 2 * (β€–f xβ€– * β€–g yβ€–) = β€–2 * f x * g yβ€– := by simp [abs_mul, mul_assoc] _ = β€–f (x + y) + f (x - y)β€– := by rw [hf1] _ ≀ β€–f (x + y)β€– + β€–f (x - y)β€– := abs_add _ _ _ ≀ 2 * k := by linarith [h (x + y), h (x - y)] linarith
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1972Q5.lean
{ "open": [], "variables": [] }
[ { "line": "obtain ⟨x, hx⟩ := hf3", "before_state": "f g : ℝ β†’ ℝ\nhf1 : βˆ€ (x y : ℝ), f (x + y) + f (x - y) = 2 * f x * g y\nhf2 : BddAbove (Set.range fun x => β€–f xβ€–)\nhf3 : βˆƒ x, f x β‰  0\ny : ℝ\n⊒ β€–g yβ€– ≀ 1", "after_state": "case intro\nf g : ℝ β†’ ℝ\nhf1 : βˆ€ (x y : ℝ), f (x + y) + f (x - y) = 2 * f x * g y...
theorem imo1977_q6_nat (f : β„• β†’ β„•) (h : βˆ€ n, f (f n) < f (n + 1)) : βˆ€ n, f n = n := by have h' : βˆ€ k n : β„•, k ≀ n β†’ k ≀ f n := by intro k induction' k with k h_ind Β· intros; exact Nat.zero_le _ Β· intro n hk apply Nat.succ_le_of_lt calc k ≀ f (f (n - 1)) := h_ind _ (h_ind (n - 1) (le_tsub_of_add_le_right hk)) _ < f n := tsub_add_cancel_of_le (le_trans (Nat.succ_le_succ (Nat.zero_le _)) hk) β–Έ h _ have hf : βˆ€ n, n ≀ f n := fun n => h' n n rfl.le have hf_mono : StrictMono f := strictMono_nat_of_lt_succ fun _ => lt_of_le_of_lt (hf _) (h _) intro exact Nat.eq_of_le_of_lt_succ (hf _) (hf_mono.lt_iff_lt.mp (h _))
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1977Q6.lean
{ "open": [], "variables": [] }
[ { "line": "have h' : βˆ€ k n : β„•, k ≀ n β†’ k ≀ f n := by\n intro k\n induction' k with k h_ind\n Β· intros; exact Nat.zero_le _\n Β· intro n hk\n apply Nat.succ_le_of_lt\n calc\n k ≀ f (f (n - 1)) := h_ind _ (h_ind (n - 1) (le_tsub_of_add_le_right hk))\n _ < f n := tsub_add_cancel_of_le (le_trans...
lemma le_avg : βˆ‘ k ∈ range (n + 1), x k ≀ (βˆ‘ k ∈ range n, x k) * (1 + 1 / n) := by rw [sum_range_succ] rw [mul_one_add] rw [add_le_add_iff_left] rw [mul_one_div] rw [le_div_iffβ‚€ (mod_cast hn.bot_lt)] rw [mul_comm] rw [← nsmul_eq_mul] conv_lhs => rw [← card_range n, ← sum_const] refine sum_le_sum fun k hk ↦ hx (le_of_lt ?_) simpa using hk
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1982Q3.lean
{ "open": [ "Finset NNReal" ], "variables": [ "{x : β„• β†’ ℝ} {n : β„•} (hn : n β‰  0) (hx : Antitone x)" ] }
[ { "line": "rw [sum_range_succ]", "before_state": "x : β„• β†’ ℝ\nn : β„•\n⊒ βˆ‘ k ∈ range (n + 1), x k ≀ (βˆ‘ k ∈ range n, x k) * (1 + 1 / ↑n)", "after_state": "x : β„• β†’ ℝ\nn : β„•\n⊒ βˆ‘ x_1 ∈ range n, x x_1 + x n ≀ (βˆ‘ k ∈ range n, x k) * (1 + 1 / ↑n)" }, { "line": "rewrite [sum_range_succ]", "before_stat...
lemma ineq (h0 : x 0 = 1) (hp : βˆ€ k, 0 < x k) : 4 * n / (n + 1) ≀ βˆ‘ k ∈ range (n + 1), x k ^ 2 / x (k + 1) := by calc -- We first use AM-GM. _ ≀ (βˆ‘ k ∈ range n, x (k + 1) + 1) ^ 2 / (βˆ‘ k ∈ range n, x (k + 1)) * n / (n + 1) := by gcongr rw [le_div_iffβ‚€] Β· simpa using four_mul_le_sq_add (βˆ‘ k ∈ range n, x (k + 1)) 1 Β· exact sum_pos (fun k _ ↦ hp _) (nonempty_range_iff.2 hn) -- We move the fraction into the denominator. _ = (βˆ‘ k ∈ range n, x (k + 1) + 1) ^ 2 / ((βˆ‘ k ∈ range n, x (k + 1)) * (1 + 1 / n)) := by field_simp -- We make use of the `le_avg` lemma. _ ≀ (βˆ‘ k ∈ range (n + 1), x k) ^ 2 / βˆ‘ k ∈ range (n + 1), x (k + 1) := by gcongr Β· exact sum_pos (fun k _ ↦ hp _) nonempty_range_succ Β· exact add_nonneg (sum_nonneg fun k _ ↦ (hp _).le) zero_le_one Β· rw [sum_range_succ', h0] Β· exact le_avg hn (hx.comp_monotone @Nat.succ_le_succ) -- We conclude by Sedrakyan. _ ≀ _ := sq_sum_div_le_sum_sq_div _ x fun k _ ↦ hp (k + 1)
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1982Q3.lean
{ "open": [ "Finset NNReal" ], "variables": [ "{x : β„• β†’ ℝ} {n : β„•} (hn : n β‰  0) (hx : Antitone x)" ] }
[ { "line": "calc\n -- We first use AM-GM.\n _ ≀ (βˆ‘ k ∈ range n, x (k + 1) + 1) ^ 2 / (βˆ‘ k ∈ range n, x (k + 1)) * n / (n + 1) :=\n by\n gcongr\n rw [le_div_iffβ‚€]\n Β· simpa using four_mul_le_sq_add (βˆ‘ k ∈ range n, x (k + 1)) 1\n Β·\n exact\n sum_pos (fun k _ ↦ hp _)\n (nonempt...
theorem imo1982_q3a (hx : Antitone x) (h0 : x 0 = 1) (hp : βˆ€ k, 0 < x k) : βˆƒ n : β„•, 3.999 ≀ βˆ‘ k ∈ range n, (x k) ^ 2 / x (k + 1) := by use 4000 convert Imo1982Q3.ineq (Nat.succ_ne_zero 3998) hx h0 hp norm_num
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1982Q3.lean
{ "open": [ "Finset NNReal" ], "variables": [ "{x : β„• β†’ ℝ} {n : β„•} (hn : n β‰  0) (hx : Antitone x)" ] }
[ { "line": "use 4000", "before_state": "x : β„• β†’ ℝ\nhx : Antitone x\nh0 : x 0 = 1\nhp : βˆ€ (k : β„•), 0 < x k\n⊒ βˆƒ n, 3.999 ≀ βˆ‘ k ∈ range n, x k ^ 2 / x (k + 1)", "after_state": "case h\nx : β„• β†’ ℝ\nhx : Antitone x\nh0 : x 0 = 1\nhp : βˆ€ (k : β„•), 0 < x k\n⊒ 3.999 ≀ βˆ‘ k ∈ range 4000, x k ^ 2 / x (k + 1)" }, ...
theorem imo1982_q3b : βˆƒ x : β„• β†’ ℝ, Antitone x ∧ x 0 = 1 ∧ (βˆ€ k, 0 < x k) ∧ βˆ€ n, βˆ‘ k ∈ range n, x k ^ 2 / x (k + 1) < 4 := by refine ⟨fun k ↦ 2⁻¹ ^ k, ?_, pow_zero _, ?_, fun n ↦ ?_⟩ Β· apply (pow_right_strictAntiβ‚€ _ _).antitone <;> norm_num Β· simp Β· have {k : β„•} : (2 : ℝ)⁻¹ ^ (k * 2) * ((2 : ℝ)⁻¹ ^ k)⁻¹ = (2 : ℝ)⁻¹ ^ k := by rw [← pow_subβ‚€] <;> simp [mul_two] simp_rw [← pow_mul, pow_succ, ← div_eq_mul_inv, div_div_eq_mul_div, mul_comm, mul_div_assoc, ← mul_sum, div_eq_mul_inv, this, ← two_add_two_eq_four, ← mul_two, mul_lt_mul_iff_of_pos_left two_pos] convert NNReal.coe_lt_coe.2 <| geom_sum_lt (inv_ne_zero two_ne_zero) two_inv_lt_one n Β· simp Β· norm_num
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1982Q3.lean
{ "open": [ "Finset NNReal" ], "variables": [ "{x : β„• β†’ ℝ} {n : β„•} (hn : n β‰  0) (hx : Antitone x)" ] }
[ { "line": "refine ⟨fun k ↦ 2⁻¹ ^ k, ?_, pow_zero _, ?_, fun n ↦ ?_⟩", "before_state": "⊒ βˆƒ x, Antitone x ∧ x 0 = 1 ∧ (βˆ€ (k : β„•), 0 < x k) ∧ βˆ€ (n : β„•), βˆ‘ k ∈ range n, x k ^ 2 / x (k + 1) < 4", "after_state": "case refine_1\n⊒ Antitone fun k => 2⁻¹ ^ k\n---\ncase refine_2\n⊒ βˆ€ (k : β„•), 0 < (fun k => 2⁻¹ ^...
theorem imo1988_q6 {a b : β„•} (h : a * b + 1 ∣ a ^ 2 + b ^ 2) : βˆƒ d, d ^ 2 = (a ^ 2 + b ^ 2) / (a * b + 1) := by rcases h with ⟨k, hk⟩ rw [hk] rw [Nat.mul_div_cancel_left _ (Nat.succ_pos (a * b))] simp only [sq] at hk apply constant_descent_vieta_jumping a b (H := fun a b => a * a + b * b = (a * b + 1) * k) hk (fun x => k * x) (fun x => x * x - k) fun _ _ => False <;> clear hk a b Β· -- We will now show that the fibers of the solution set are described by a quadratic equation. intro x y rw [← Int.natCast_inj] rw [← sub_eq_zero] apply eq_iff_eq_cancel_right.2 simp; ring Β· -- Show that the solution set is symmetric in a and b. intro x y simp [add_comm (x * x), mul_comm x] Β· -- Show that the claim is true if b = 0. suffices βˆ€ a, a * a = k β†’ βˆƒ d, d * d = k by simpa rintro x rfl; use x Β· -- Show that the claim is true if a = b. intro x hx suffices k ≀ 1 by rw [Nat.le_add_one_iff] at this rw [Nat.le_zero] at this rcases this with (rfl | rfl) Β· use 0; simp Β· use 1; simp contrapose! hx with k_lt_one apply ne_of_lt calc x * x + x * x = x * x * 2 := by rw [mul_two] _ ≀ x * x * k := Nat.mul_le_mul_left (x * x) k_lt_one _ < (x * x + 1) * k := by linarith Β· -- Show the descent step. intro x y hx x_lt_y _ _ z h_root _ hVβ‚€ constructor Β· have hpos : z * z + x * x > 0 := by apply add_pos_of_nonneg_of_pos Β· apply mul_self_nonneg Β· apply mul_pos <;> exact mod_cast hx have hzx : z * z + x * x = (z * x + 1) * k := by rw [← sub_eq_zero] rw [← h_root] ring rw [hzx] at hpos replace hpos : z * x + 1 > 0 := pos_of_mul_pos_left hpos (Int.ofNat_zero_le k) replace hpos : z * x β‰₯ 0 := Int.le_of_lt_add_one hpos apply nonneg_of_mul_nonneg_left hpos (mod_cast hx) Β· contrapose! hVβ‚€ with x_lt_z apply ne_of_gt calc z * y > x * x := by apply mul_lt_mul' <;> omega _ β‰₯ x * x - k := sub_le_self _ (Int.ofNat_zero_le k) Β· -- There is no base case in this application of Vieta jumping. simp
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1988Q6.lean
{ "open": [ "Imo1988Q6" ], "variables": [] }
[ { "line": "rcases h with ⟨k, hk⟩", "before_state": "a b : β„•\nh : a * b + 1 ∣ a ^ 2 + b ^ 2\n⊒ βˆƒ d, d ^ 2 = (a ^ 2 + b ^ 2) / (a * b + 1)", "after_state": "case intro\na b k : β„•\nhk : a ^ 2 + b ^ 2 = (a * b + 1) * k\n⊒ βˆƒ d, d ^ 2 = (a ^ 2 + b ^ 2) / (a * b + 1)" }, { "line": "rw [hk]", "befor...
example {a b : β„•} (h : a * b ∣ a ^ 2 + b ^ 2 + 1) : 3 * a * b = a ^ 2 + b ^ 2 + 1 := by rcases h with ⟨k, hk⟩ suffices k = 3 by simp_all; ring simp only [sq] at hk apply constant_descent_vieta_jumping a b (H := fun a b => a * a + b * b + 1 = a * b * k) hk (fun x => k * x) (fun x => x * x + 1) fun x _ => x ≀ 1 <;> clear hk a b Β· -- We will now show that the fibers of the solution set are described by a quadratic equation. intro x y rw [← Int.natCast_inj] rw [← sub_eq_zero] apply eq_iff_eq_cancel_right.2 simp; ring Β· -- Show that the solution set is symmetric in a and b. intro x y; ring_nf Β· -- Show that the claim is true if b = 0. simp Β· -- Show that the claim is true if a = b. intro x hx have x_sq_dvd : x * x ∣ x * x * k := dvd_mul_right (x * x) k rw [← hx] at x_sq_dvd obtain ⟨y, hy⟩ : x * x ∣ 1 := by simpa only [Nat.dvd_add_self_left, add_assoc] using x_sq_dvd obtain ⟨rfl, rfl⟩ : x = 1 ∧ y = 1 := by simpa [mul_eq_one] using hy.symm simpa using hx.symm Β· -- Show the descent step. intro x y _ hx h_base _ z _ _ hVβ‚€ constructor Β· have zy_pos : z * y β‰₯ 0 := by rw [hVβ‚€]; exact mod_cast Nat.zero_le _ apply nonneg_of_mul_nonneg_left zy_pos omega Β· contrapose! hVβ‚€ with x_lt_z apply ne_of_gt push_neg at h_base calc z * y > x * y := by apply mul_lt_mul_of_pos_right <;> omega _ β‰₯ x * (x + 1) := by apply mul_le_mul <;> omega _ > x * x + 1 := by rw [mul_add] omega Β· -- Show the base case. intro x y h h_base obtain rfl | rfl : x = 0 ∨ x = 1 := by rwa [Nat.le_add_one_iff, Nat.le_zero] at h_base Β· simp at h Β· rw [mul_one, one_mul, add_right_comm] at h have y_dvd : y ∣ y * k := dvd_mul_right y k rw [← h] at y_dvd rw [Nat.dvd_add_left (dvd_mul_left y y)] at y_dvd obtain rfl | rfl := (Nat.dvd_prime Nat.prime_two).mp y_dvd <;> apply mul_left_cancelβ‚€ exacts [one_ne_zero, h.symm, two_ne_zero, h.symm]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1988Q6.lean
{ "open": [ "Imo1988Q6" ], "variables": [] }
[ { "line": "rcases h with ⟨k, hk⟩", "before_state": "a b : β„•\nh : a * b ∣ a ^ 2 + b ^ 2 + 1\n⊒ 3 * a * b = a ^ 2 + b ^ 2 + 1", "after_state": "case intro\na b k : β„•\nhk : a ^ 2 + b ^ 2 + 1 = a * b * k\n⊒ 3 * a * b = a ^ 2 + b ^ 2 + 1" }, { "line": "suffices k = 3 by simp_all; ring", "before_s...
theorem tedious (m : β„•) (k : Fin (m + 1)) : m - ((m + 1 - ↑k) + m) % (m + 1) = ↑k := by obtain ⟨k, hk⟩ := k rw [Nat.lt_succ_iff] at hk rw [le_iff_exists_add] at hk rcases hk with ⟨c, rfl⟩ have : (k + c + 1 - k) + (k + c) = c + (k + c + 1) := by omega rw [Fin.val_mk] rw [this] rw [Nat.add_mod_right] rw [Nat.mod_eq_of_lt] rw [Nat.add_sub_cancel] omega
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1994Q1.lean
{ "open": [ "Finset" ], "variables": [] }
[ { "line": "obtain ⟨k, hk⟩ := k", "before_state": "m : β„•\nk : Fin (m + 1)\n⊒ m - (m + 1 - ↑k + m) % (m + 1) = ↑k", "after_state": "case mk\nm k : β„•\nhk : k < m + 1\n⊒ m - (m + 1 - β†‘βŸ¨k, hk⟩ + m) % (m + 1) = β†‘βŸ¨k, hk⟩" }, { "line": "rw [Nat.lt_succ_iff] at hk", "before_state": "case mk\nm k : β„•\...
theorem add_sq_add_sq_sub {Ξ± : Type*} [Ring Ξ±] (x y : Ξ±) : (x + y) * (x + y) + (x - y) * (x - y) = 2 * x * x + 2 * y * y := by noncomm_ring
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1998Q2.lean
{ "open": [ "scoped Classical in", "scoped Classical in", "scoped Classical in", "scoped Classical in", "scoped Classical in", "scoped Classical in", "scoped Classical in" ], "variables": [ "{C J : Type*} (r : C β†’ J β†’ Prop)", "[Fintype J] [Fintype C]" ] }
[ { "line": "noncomm_ring", "before_state": "α : Type u_1\ninst✝ : Ring α\nx y : α\n⊒ (x + y) * (x + y) + (x - y) * (x - y) = 2 * x * x + 2 * y * y", "after_state": "No Goals!" }, { "line": "focus\n (first\n |\n simp only [add_mul✝, mul_add✝, sub_eq_add_neg✝, mul_assoc✝, pow_one✝, pow_zer...
theorem clear_denominators {a b k : β„•} (ha : 0 < a) (hb : 0 < b) : (b - 1 : β„š) / (2 * b) ≀ k / a ↔ ((b : β„•) - 1) * a ≀ k * (2 * b) := by rw [div_le_div_iffβ‚€] on_goal 1 => convert Nat.cast_le (Ξ± := β„š) all_goals simp [ha, hb]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo1998Q2.lean
{ "open": [ "scoped Classical in", "scoped Classical in", "scoped Classical in", "scoped Classical in", "scoped Classical in", "scoped Classical in", "scoped Classical in", "scoped Classical in", "scoped Classical in" ], "variables": [ "{C J : Type*} (r : C β†’ J β†’ Prop)", "[Fintype J] [Fintype C]", "[Fintype J]" ] }
[ { "line": "rw [div_le_div_iffβ‚€]", "before_state": "a b k : β„•\nha : 0 < a\nhb : 0 < b\n⊒ (↑b - 1) / (2 * ↑b) ≀ ↑k / ↑a ↔ (b - 1) * a ≀ k * (2 * b)", "after_state": "a b k : β„•\nha : 0 < a\nhb : 0 < b\n⊒ (↑b - 1) * ↑a ≀ ↑k * (2 * ↑b) ↔ (b - 1) * a ≀ k * (2 * b)\n---\ncase hb\na b k : β„•\nha : 0 < a\nhb : 0 ...
theorem Int.natAbs_eq_of_chain_dvd {l : Cycle β„€} {x y : β„€} (hl : l.Chain (Β· ∣ Β·)) (hx : x ∈ l) (hy : y ∈ l) : x.natAbs = y.natAbs := by rw [Cycle.chain_iff_pairwise] at hl exact Int.natAbs_eq_of_dvd_dvd (hl x hx y hy) (hl y hy x hx)
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2006Q5.lean
{ "open": [ "Function Polynomial" ], "variables": [] }
[ { "line": "rw [Cycle.chain_iff_pairwise] at hl", "before_state": "l : Cycle β„€\nx y : β„€\nhl : Cycle.Chain (fun x1 x2 => x1 ∣ x2) l\nhx : x ∈ l\nhy : y ∈ l\n⊒ x.natAbs = y.natAbs", "after_state": "l : Cycle β„€\nx y : β„€\nhl : βˆ€ a ∈ l, βˆ€ b ∈ l, a ∣ b\nhx : x ∈ l\nhy : y ∈ l\n⊒ x.natAbs = y.natAbs" }, { ...
theorem Int.add_eq_add_of_natAbs_eq_of_natAbs_eq {a b c d : β„€} (hne : a β‰  b) (h₁ : (c - a).natAbs = (d - b).natAbs) (hβ‚‚ : (c - b).natAbs = (d - a).natAbs) : a + b = c + d := by rcases Int.natAbs_eq_natAbs_iff.1 h₁ with h₁ | h₁ Β· rcases Int.natAbs_eq_natAbs_iff.1 hβ‚‚ with hβ‚‚ | hβ‚‚ Β· exact (hne <| by linarith).elim Β· linarith Β· linarith
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2006Q5.lean
{ "open": [ "Function Polynomial" ], "variables": [] }
[ { "line": "rcases Int.natAbs_eq_natAbs_iff.1 h₁ with h₁ | h₁", "before_state": "a b c d : β„€\nhne : a β‰  b\nh₁ : (c - a).natAbs = (d - b).natAbs\nhβ‚‚ : (c - b).natAbs = (d - a).natAbs\n⊒ a + b = c + d", "after_state": "case inl\na b c d : β„€\nhne : a β‰  b\nhβ‚βœ : (c - a).natAbs = (d - b).natAbs\nhβ‚‚ : (c - b)....
theorem Polynomial.isPeriodicPt_eval_two {P : Polynomial β„€} {t : β„€} (ht : t ∈ periodicPts fun x => P.eval x) : IsPeriodicPt (fun x => P.eval x) 2 t := by -- The cycle [P(t) - t, P(P(t)) - P(t), ...] let C : Cycle β„€ := (periodicOrbit (fun x => P.eval x) t).map fun x => P.eval x - x have HC : βˆ€ {n : β„•}, (fun x => P.eval x)^[n + 1] t - (fun x => P.eval x)^[n] t ∈ C := by intro n rw [Cycle.mem_map] rw [Function.iterate_succ_apply'] exact ⟨_, iterate_mem_periodicOrbit ht n, rfl⟩ -- Elements in C are all divisible by one another. have Hdvd : C.Chain (Β· ∣ Β·) := by rw [Cycle.chain_map] rw [periodicOrbit_chain' _ ht] intro n convert sub_dvd_eval_sub ((fun x => P.eval x)^[n + 1] t) ((fun x => P.eval x)^[n] t) P <;> rw [Function.iterate_succ_apply'] -- Any two entries in C have the same absolute value. have Habs : βˆ€ m n : β„•, ((fun x => P.eval x)^[m + 1] t - (fun x => P.eval x)^[m] t).natAbs = ((fun x => P.eval x)^[n + 1] t - (fun x => P.eval x)^[n] t).natAbs := fun m n => Int.natAbs_eq_of_chain_dvd Hdvd HC HC -- We case on whether the elements on C are pairwise equal. by_cases HC' : C.Chain (Β· = Β·) Β· -- Any two entries in C are equal. have Heq : βˆ€ m n : β„•, (fun x => P.eval x)^[m + 1] t - (fun x => P.eval x)^[m] t = (fun x => P.eval x)^[n + 1] t - (fun x => P.eval x)^[n] t := fun m n => Cycle.chain_iff_pairwise.1 HC' _ HC _ HC -- The sign of P^n(t) - t is the same as P(t) - t for positive n. Proven by induction on n. have IH : βˆ€ n : β„•, ((fun x => P.eval x)^[n + 1] t - t).sign = (P.eval t - t).sign := by intro n induction' n with n IH Β· rfl Β· apply Eq.trans _ (Int.sign_add_eq_of_sign_eq IH) have H := Heq n.succ 0 dsimp at H ⊒ rw [← H] rw [sub_add_sub_cancel'] -- This implies that the sign of P(t) - t is the same as the sign of P^k(t) - t, which is 0. -- Hence P(t) = t and P(P(t)) = P(t). rcases ht with ⟨_ | k, hk, hk'⟩ Β· exact (irrefl 0 hk).elim Β· have H := IH k rw [hk'.isFixedPt.eq] at H rw [sub_self] at H rw [Int.sign_zero] at H rw [eq_comm] at H rw [Int.sign_eq_zero_iff_zero] at H rw [sub_eq_zero] at H simp [IsPeriodicPt, IsFixedPt, H] Β· -- We take two nonequal consecutive entries. rw [Cycle.chain_map] at HC' rw [periodicOrbit_chain' _ ht] at HC' push_neg at HC' obtain ⟨n, hn⟩ := HC' -- They must have opposite sign, so that P^{k + 1}(t) - P^k(t) = P^{k + 2}(t) - P^{k + 1}(t). rcases Int.natAbs_eq_natAbs_iff.1 (Habs n n.succ) with hn' | hn' Β· apply (hn _).elim convert hn' <;> simp only [Function.iterate_succ_apply'] -- We deduce P^{k + 2}(t) = P^k(t) and hence P(P(t)) = t. Β· rw [neg_sub, sub_right_inj] at hn' simp only [Function.iterate_succ_apply'] at hn' exact isPeriodicPt_of_mem_periodicPts_of_isPeriodicPt_iterate ht hn'.symm
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2006Q5.lean
{ "open": [ "Function Polynomial" ], "variables": [] }
[ { "line": "let C : Cycle β„€ := (periodicOrbit (fun x => P.eval x) t).map fun x => P.eval x - x", "before_state": "P : β„€[X]\nt : β„€\nht : t ∈ periodicPts fun x => eval x P\n⊒ IsPeriodicPt (fun x => eval x P) 2 t", "after_state": "P : β„€[X]\nt : β„€\nht : t ∈ periodicPts fun x => eval x P\nC : Cycle β„€ := Cycle...
theorem Polynomial.iterate_comp_sub_X_ne {P : Polynomial β„€} (hP : 1 < P.natDegree) {k : β„•} (hk : 0 < k) : P.comp^[k] X - X β‰  0 := by rw [sub_ne_zero] apply_fun natDegree simpa using (one_lt_powβ‚€ hP hk.ne').ne'
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2006Q5.lean
{ "open": [ "Function Polynomial" ], "variables": [] }
[ { "line": "rw [sub_ne_zero]", "before_state": "P : β„€[X]\nhP : 1 < P.natDegree\nk : β„•\nhk : 0 < k\n⊒ P.comp^[k] X - X β‰  0", "after_state": "P : β„€[X]\nhP : 1 < P.natDegree\nk : β„•\nhk : 0 < k\n⊒ P.comp^[k] X β‰  X" }, { "line": "rewrite [sub_ne_zero]", "before_state": "P : β„€[X]\nhP : 1 < P.natDeg...
theorem p_lemma (p : β„•) (hpp : Nat.Prime p) (hp_mod_4_eq_1 : p ≑ 1 [MOD 4]) (hp_gt_20 : p > 20) : βˆƒ n : β„•, p ∣ n ^ 2 + 1 ∧ (p : ℝ) > 2 * n + sqrt (2 * n) := by haveI := Fact.mk hpp have hp_mod_4_ne_3 : p % 4 β‰  3 := by linarith [show p % 4 = 1 from hp_mod_4_eq_1] obtain ⟨y, hy⟩ := ZMod.exists_sq_eq_neg_one_iff.mpr hp_mod_4_ne_3 let m := ZMod.valMinAbs y let n := Int.natAbs m have hnat₁ : p ∣ n ^ 2 + 1 := by refine Int.natCast_dvd_natCast.mp ?_ simp only [n] simp only [Int.natAbs_sq] simp only [Int.natCast_pow] simp only [Int.natCast_succ] simp only [Int.natCast_dvd_natCast.mp] refine (ZMod.intCast_zmod_eq_zero_iff_dvd (m ^ 2 + 1) p).mp ?_ simp only [m] simp only [Int.cast_pow] simp only [Int.cast_add] simp only [Int.cast_one] simp only [ZMod.coe_valMinAbs] rw [pow_two]; exact neg_add_cancel 1 rw [← hy]; exact neg_add_cancel 1 have hnatβ‚‚ : n ≀ p / 2 := ZMod.natAbs_valMinAbs_le y have hnat₃ : p β‰₯ 2 * n := by omega set k : β„• := p - 2 * n with hnatβ‚„ have hnatβ‚… : p ∣ k ^ 2 + 4 := by obtain ⟨x, hx⟩ := hnat₁ have : (p : β„€) ∣ (k : β„€) ^ 2 + 4 := by use (p : β„€) - 4 * n + 4 * x have hcast₁ : (k : β„€) = p - 2 * n := by assumption_mod_cast have hcastβ‚‚ : (n : β„€) ^ 2 + 1 = p * x := by assumption_mod_cast linear_combination ((k : β„€) + p - 2 * n) * hcast₁ + 4 * hcastβ‚‚ assumption_mod_cast have hnat₆ : k ^ 2 + 4 β‰₯ p := Nat.le_of_dvd (k ^ 2 + 3).succ_pos hnatβ‚… have hreal₁ : (k : ℝ) = p - 2 * n := by assumption_mod_cast have hrealβ‚‚ : (p : ℝ) > 20 := by assumption_mod_cast have hreal₃ : (k : ℝ) ^ 2 + 4 β‰₯ p := by assumption_mod_cast have hrealβ‚… : (k : ℝ) > 4 := by refine lt_of_pow_lt_pow_leftβ‚€ 2 k.cast_nonneg ?_ linarith only [hrealβ‚‚, hreal₃] have hreal₆ : (k : ℝ) > sqrt (2 * n) := by refine lt_of_pow_lt_pow_leftβ‚€ 2 k.cast_nonneg ?_ rw [sq_sqrt (mul_nonneg zero_le_two n.cast_nonneg)] linarith only [hreal₁, hreal₃, hrealβ‚…] exact ⟨n, hnat₁, by linarith only [hreal₆, hreal₁]⟩
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2008Q3.lean
{ "open": [ "Real" ], "variables": [] }
[ { "line": "haveI := Fact.mk hpp", "before_state": "p : β„•\nhpp : Nat.Prime p\nhp_mod_4_eq_1 : p ≑ 1 [MOD 4]\nhp_gt_20 : p > 20\n⊒ βˆƒ n, p ∣ n ^ 2 + 1 ∧ ↑p > 2 * ↑n + √(2 * ↑n)", "after_state": "p : β„•\nhpp : Nat.Prime p\nhp_mod_4_eq_1 : p ≑ 1 [MOD 4]\nhp_gt_20 : p > 20\nthis : Fact (Nat.Prime p)\n⊒ βˆƒ n, p ...
theorem imo2008_q3 : βˆ€ N : β„•, βˆƒ n : β„•, n β‰₯ N ∧ βˆƒ p : β„•, Nat.Prime p ∧ p ∣ n ^ 2 + 1 ∧ (p : ℝ) > 2 * n + sqrt (2 * n) := by intro N obtain ⟨p, hpp, hineq₁, hpmod4⟩ := Nat.exists_prime_gt_modEq_one (N ^ 2 + 20) four_ne_zero obtain ⟨n, hnat, hreal⟩ := p_lemma p hpp hpmod4 (by linarith [hineq₁, Nat.zero_le (N ^ 2)]) have hineqβ‚‚ : n ^ 2 + 1 β‰₯ p := Nat.le_of_dvd (n ^ 2).succ_pos hnat have hineq₃ : n * n β‰₯ N * N := by linarith [hineq₁, hineqβ‚‚] have hn_ge_N : n β‰₯ N := Nat.mul_self_le_mul_self_iff.1 hineq₃ exact ⟨n, hn_ge_N, p, hpp, hnat, hreal⟩
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2008Q3.lean
{ "open": [ "Real", "Imo2008Q3" ], "variables": [] }
[ { "line": "intro N", "before_state": "⊒ βˆ€ (N : β„•), βˆƒ n β‰₯ N, βˆƒ p, Nat.Prime p ∧ p ∣ n ^ 2 + 1 ∧ ↑p > 2 * ↑n + √(2 * ↑n)", "after_state": "N : β„•\n⊒ βˆƒ n β‰₯ N, βˆƒ p, Nat.Prime p ∧ p ∣ n ^ 2 + 1 ∧ ↑p > 2 * ↑n + √(2 * ↑n)" }, { "line": "obtain ⟨p, hpp, hineq₁, hpmod4⟩ := Nat.exists_prime_gt_modEq_one (N...
theorem arith_lemma (k n : β„•) : 0 < 2 * n + 2 ^ k.succ := by positivity
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2013Q1.lean
{ "open": [], "variables": [] }
[ { "line": "positivity", "before_state": "k n : β„•\n⊒ 0 < 2 * n + 2 ^ k.succ", "after_state": "No Goals!" } ]
theorem prod_lemma (m : β„• β†’ β„•+) (k : β„•) (nm : β„•+) : ∏ i ∈ Finset.range k, ((1 : β„š) + 1 / ↑(if i < k then m i else nm)) = ∏ i ∈ Finset.range k, (1 + 1 / (m i : β„š)) := by suffices βˆ€ i, i ∈ Finset.range k β†’ (1 : β„š) + 1 / ↑(if i < k then m i else nm) = 1 + 1 / m i from Finset.prod_congr rfl this intro i hi simp [Finset.mem_range.mp hi]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2013Q1.lean
{ "open": [], "variables": [] }
[ { "line": "suffices βˆ€ i, i ∈ Finset.range k β†’ (1 : β„š) + 1 / ↑(if i < k then m i else nm) = 1 + 1 / m i from\n Finset.prod_congr rfl this", "before_state": "m : β„• β†’ β„•+\nk : β„•\nnm : β„•+\n⊒ ∏ i ∈ Finset.range k, (1 + 1 / ↑↑(if i < k then m i else nm)) = ∏ i ∈ Finset.range k, (1 + 1 / ↑↑(m i))", "after_stat...
theorem imo2013_q1 (n : β„•+) (k : β„•) : βˆƒ m : β„• β†’ β„•+, (1 : β„š) + (2 ^ k - 1) / n = ∏ i ∈ Finset.range k, (1 + 1 / (m i : β„š)) := by revert n induction' k with pk hpk Β· intro n; use fun (_ : β„•) => (1 : β„•+); simp -- For the base case, any m works. intro n obtain ⟨t, ht : ↑n = t + t⟩ | ⟨t, ht : ↑n = 2 * t + 1⟩ := (n : β„•).even_or_odd Β· -- even case rw [← two_mul] at ht rcases t with - | t -- Eliminate the zero case to simplify later calculations. Β· exfalso; rw [Nat.mul_zero] at ht; exact PNat.ne_zero n ht -- Now we have ht : ↑n = 2 * (t + 1). let t_succ : β„•+ := ⟨t + 1, t.succ_pos⟩ obtain ⟨pm, hpm⟩ := hpk t_succ let m i := if i < pk then pm i else ⟨2 * t + 2 ^ pk.succ, arith_lemma pk t⟩ use m have hmpk : (m pk : β„š) = 2 * t + 2 ^ pk.succ := by have : m pk = ⟨2 * t + 2 ^ pk.succ, _⟩ := if_neg (irrefl pk); simp [this] calc ((1 : β„š) + (2 ^ pk.succ - 1) / (n : β„š) : β„š)= 1 + (2 * 2 ^ pk - 1) / (2 * (t + 1) : β„•) := by rw [ht] rw [pow_succ'] _ = (1 + 1 / (2 * t + 2 * 2 ^ pk)) * (1 + (2 ^ pk - 1) / (↑t + 1)) := by field_simp ring _ = (1 + 1 / (2 * t + 2 ^ pk.succ)) * (1 + (2 ^ pk - 1) / t_succ) := by simp [pow_succ', PNat.mk_coe, t_succ] _ = (∏ i ∈ Finset.range pk, (1 + 1 / (m i : β„š))) * (1 + 1 / m pk) := by rw [prod_lemma] rw [hpm] rw [← hmpk] rw [mul_comm] _ = ∏ i ∈ Finset.range pk.succ, (1 + 1 / (m i : β„š)) := by rw [← Finset.prod_range_succ _ pk] Β· -- odd case let t_succ : β„•+ := ⟨t + 1, t.succ_pos⟩ obtain ⟨pm, hpm⟩ := hpk t_succ let m i := if i < pk then pm i else ⟨2 * t + 1, Nat.succ_pos _⟩ use m have hmpk : (m pk : β„š) = 2 * t + 1 := by have : m pk = ⟨2 * t + 1, _⟩ := if_neg (irrefl pk) simp [this] calc ((1 : β„š) + (2 ^ pk.succ - 1) / ↑n : β„š) = 1 + (2 * 2 ^ pk - 1) / (2 * t + 1 : β„•) := by rw [ht] rw [pow_succ'] _ = (1 + 1 / (2 * t + 1)) * (1 + (2 ^ pk - 1) / (t + 1)) := by field_simp ring _ = (1 + 1 / (2 * t + 1)) * (1 + (2 ^ pk - 1) / t_succ) := by norm_cast _ = (∏ i ∈ Finset.range pk, (1 + 1 / (m i : β„š))) * (1 + 1 / ↑(m pk)) := by rw [prod_lemma] rw [hpm] rw [← hmpk] rw [mul_comm] _ = ∏ i ∈ Finset.range pk.succ, (1 + 1 / (m i : β„š)) := by rw [← Finset.prod_range_succ _ pk]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2013Q1.lean
{ "open": [ "Imo2013Q1" ], "variables": [] }
[ { "line": "revert n", "before_state": "n : β„•+\nk : β„•\n⊒ βˆƒ m, 1 + (2 ^ k - 1) / ↑↑n = ∏ i ∈ Finset.range k, (1 + 1 / ↑↑(m i))", "after_state": "k : β„•\n⊒ βˆ€ (n : β„•+), βˆƒ m, 1 + (2 ^ k - 1) / ↑↑n = ∏ i ∈ Finset.range k, (1 + 1 / ↑↑(m i))" }, { "line": "induction' k with pk hpk", "before_state": "...
theorem le_of_all_pow_lt_succ {x y : ℝ} (hx : 1 < x) (hy : 1 < y) (h : βˆ€ n : β„•, 0 < n β†’ x ^ n - 1 < y ^ n) : x ≀ y := by by_contra! hxy have hxmy : 0 < x - y := sub_pos.mpr hxy have hn : βˆ€ n : β„•, 0 < n β†’ (x - y) * (n : ℝ) ≀ x ^ n - y ^ n := by intro n _ have hterm : βˆ€ i : β„•, i ∈ Finset.range n β†’ 1 ≀ x ^ i * y ^ (n - 1 - i) := by intro i _ calc 1 ≀ x ^ i := one_le_powβ‚€ hx.le _ = x ^ i * 1 := by ring _ ≀ x ^ i * y ^ (n - 1 - i) := by gcongr; apply one_le_powβ‚€ hy.le calc (x - y) * (n : ℝ) = (n : ℝ) * (x - y) := by ring _ = (βˆ‘ _i ∈ Finset.range n, (1 : ℝ)) * (x - y) := by simp only [mul_one] simp only [Finset.sum_const] simp only [nsmul_eq_mul] simp only [Finset.card_range] _ ≀ (βˆ‘ i ∈ Finset.range n, x ^ i * y ^ (n - 1 - i)) * (x - y) := by gcongr with i hi; apply hterm i hi _ = x ^ n - y ^ n := geom_sumβ‚‚_mul x y n -- Choose n larger than 1 / (x - y). obtain ⟨N, hN⟩ := exists_nat_gt (1 / (x - y)) have hNp : 0 < N := mod_cast (one_div_pos.mpr hxmy).trans hN have := calc 1 = (x - y) * (1 / (x - y)) := by field_simp _ < (x - y) * N := by gcongr _ ≀ x ^ N - y ^ N := hn N hNp linarith [h N hNp]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2013Q5.lean
{ "open": [], "variables": [] }
[ { "line": "by_contra! hxy", "before_state": "x y : ℝ\nhx : 1 < x\nhy : 1 < y\nh : βˆ€ (n : β„•), 0 < n β†’ x ^ n - 1 < y ^ n\n⊒ x ≀ y", "after_state": "x y : ℝ\nhx : 1 < x\nhy : 1 < y\nh : βˆ€ (n : β„•), 0 < n β†’ x ^ n - 1 < y ^ n\nhxy : y < x\n⊒ False" }, { "line": "by_contra hxy", "before_state": "x ...
theorem le_of_all_pow_lt_succ' {x y : ℝ} (hx : 1 < x) (hy : 0 < y) (h : βˆ€ n : β„•, 0 < n β†’ x ^ n - 1 < y ^ n) : x ≀ y := by refine le_of_all_pow_lt_succ hx ?_ h by_contra! hy'' : y ≀ 1 -- Then there exists y' such that 0 < y ≀ 1 < y' < x. have h_y'_lt_x : (x + 1) / 2 < x := by linarith have h1_lt_y' : 1 < (x + 1) / 2 := by linarith set y' := (x + 1) / 2 have h_y_lt_y' : y < y' := by linarith have hh : βˆ€ n, 0 < n β†’ x ^ n - 1 < y' ^ n := by intro n hn calc x ^ n - 1 < y ^ n := h n hn _ ≀ y' ^ n := by gcongr exact h_y'_lt_x.not_le (le_of_all_pow_lt_succ hx h1_lt_y' hh)
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2013Q5.lean
{ "open": [], "variables": [] }
[ { "line": "refine le_of_all_pow_lt_succ hx ?_ h", "before_state": "x y : ℝ\nhx : 1 < x\nhy : 0 < y\nh : βˆ€ (n : β„•), 0 < n β†’ x ^ n - 1 < y ^ n\n⊒ x ≀ y", "after_state": "No Goals!" } ]
theorem f_pos_of_pos {f : β„š β†’ ℝ} {q : β„š} (hq : 0 < q) (H1 : βˆ€ x y, 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y) (H4 : βˆ€ n : β„•, 0 < n β†’ (n : ℝ) ≀ f n) : 0 < f q := by have num_pos : 0 < q.num := Rat.num_pos.mpr hq have hmul_pos := calc (0 : ℝ) < q.num := Int.cast_pos.mpr num_pos _ = ((q.num.natAbs : β„€) : ℝ) := congr_arg Int.cast (Int.natAbs_of_nonneg num_pos.le).symm _ ≀ f q.num.natAbs := (H4 q.num.natAbs ((@Int.natAbs_pos q.num).mpr num_pos.ne.symm)) _ = f q.num := by rw [Nat.cast_natAbs, abs_of_nonneg num_pos.le] _ = f (q * q.den) := by rw [← Rat.mul_den_eq_num] _ ≀ f q * f q.den := H1 q q.den hq (Nat.cast_pos.mpr q.pos) have h_f_denom_pos := calc (0 : ℝ) < q.den := Nat.cast_pos.mpr q.pos _ ≀ f q.den := H4 q.den q.pos exact pos_of_mul_pos_left hmul_pos h_f_denom_pos.le
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2013Q5.lean
{ "open": [], "variables": [] }
[ { "line": "have num_pos : 0 < q.num := Rat.num_pos.mpr hq", "before_state": "f : β„š β†’ ℝ\nq : β„š\nhq : 0 < q\nH1 : βˆ€ (x y : β„š), 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y\nH4 : βˆ€ (n : β„•), 0 < n β†’ ↑n ≀ f ↑n\n⊒ 0 < f q", "after_state": "f : β„š β†’ ℝ\nq : β„š\nhq : 0 < q\nH1 : βˆ€ (x y : β„š), 0 < x β†’ 0 < y β†’ f (x * y) ≀ f...
theorem fx_gt_xm1 {f : β„š β†’ ℝ} {x : β„š} (hx : 1 ≀ x) (H1 : βˆ€ x y, 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y) (H2 : βˆ€ x y, 0 < x β†’ 0 < y β†’ f x + f y ≀ f (x + y)) (H4 : βˆ€ n : β„•, 0 < n β†’ (n : ℝ) ≀ f n) : (x - 1 : ℝ) < f x := by have hx0 := calc (x - 1 : ℝ) < ⌊xβŒ‹β‚Š := mod_cast Nat.sub_one_lt_floor x _ ≀ f ⌊xβŒ‹β‚Š := H4 _ (Nat.floor_pos.2 hx) obtain h_eq | h_lt := (Nat.floor_le <| zero_le_one.trans hx).eq_or_lt Β· rwa [h_eq] at hx0 calc (x - 1 : ℝ) < f ⌊xβŒ‹β‚Š := hx0 _ < f (x - ⌊xβŒ‹β‚Š) + f ⌊xβŒ‹β‚Š := (lt_add_of_pos_left _ (f_pos_of_pos (sub_pos.mpr h_lt) H1 H4)) _ ≀ f (x - ⌊xβŒ‹β‚Š + ⌊xβŒ‹β‚Š) := (H2 _ _ (sub_pos.mpr h_lt) (Nat.cast_pos.2 (Nat.floor_pos.2 hx))) _ = f x := by ring_nf
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2013Q5.lean
{ "open": [], "variables": [] }
[ { "line": "have hx0 :=\n calc\n (x - 1 : ℝ) < ⌊xβŒ‹β‚Š := mod_cast Nat.sub_one_lt_floor x\n _ ≀ f ⌊xβŒ‹β‚Š := H4 _ (Nat.floor_pos.2 hx)", "before_state": "f : β„š β†’ ℝ\nx : β„š\nhx : 1 ≀ x\nH1 : βˆ€ (x y : β„š), 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y\nH2 : βˆ€ (x y : β„š), 0 < x β†’ 0 < y β†’ f x + f y ≀ f (x + y)\nH4 : βˆ€ (n ...
theorem pow_f_le_f_pow {f : β„š β†’ ℝ} {n : β„•} (hn : 0 < n) {x : β„š} (hx : 1 < x) (H1 : βˆ€ x y, 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y) (H4 : βˆ€ n : β„•, 0 < n β†’ (n : ℝ) ≀ f n) : f (x ^ n) ≀ f x ^ n := by induction' n with pn hpn Β· exfalso; exact Nat.lt_asymm hn hn rcases pn with - | pn Β· norm_num have hpn' := hpn pn.succ_pos rw [pow_succ x (pn + 1)] rw [pow_succ (f x) (pn + 1)] have hxp : 0 < x := by positivity calc f (x ^ (pn + 1) * x) ≀ f (x ^ (pn + 1)) * f x := H1 (x ^ (pn + 1)) x (pow_pos hxp (pn + 1)) hxp _ ≀ f x ^ (pn + 1) * f x := by gcongr; exact (f_pos_of_pos hxp H1 H4).le
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2013Q5.lean
{ "open": [], "variables": [] }
[ { "line": "induction' n with pn hpn", "before_state": "f : β„š β†’ ℝ\nn : β„•\nhn : 0 < n\nx : β„š\nhx : 1 < x\nH1 : βˆ€ (x y : β„š), 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y\nH4 : βˆ€ (n : β„•), 0 < n β†’ ↑n ≀ f ↑n\n⊒ f (x ^ n) ≀ f x ^ n", "after_state": "case zero\nf : β„š β†’ ℝ\nx : β„š\nhx : 1 < x\nH1 : βˆ€ (x y : β„š), 0 < x β†’ 0...
theorem fixed_point_of_pos_nat_pow {f : β„š β†’ ℝ} {n : β„•} (hn : 0 < n) (H1 : βˆ€ x y, 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y) (H4 : βˆ€ n : β„•, 0 < n β†’ (n : ℝ) ≀ f n) (H5 : βˆ€ x : β„š, 1 < x β†’ (x : ℝ) ≀ f x) {a : β„š} (ha1 : 1 < a) (hae : f a = a) : f (a ^ n) = a ^ n := by have hh0 : (a : ℝ) ^ n ≀ f (a ^ n) := mod_cast H5 (a ^ n) (one_lt_powβ‚€ ha1 hn.ne') have hh1 := calc f (a ^ n) ≀ f a ^ n := pow_f_le_f_pow hn ha1 H1 H4 _ = (a : ℝ) ^ n := by rw [← hae] exact mod_cast hh1.antisymm hh0
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2013Q5.lean
{ "open": [], "variables": [] }
[ { "line": "have hh0 : (a : ℝ) ^ n ≀ f (a ^ n) := mod_cast H5 (a ^ n) (one_lt_powβ‚€ ha1 hn.ne')", "before_state": "f : β„š β†’ ℝ\nn : β„•\nhn : 0 < n\nH1 : βˆ€ (x y : β„š), 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y\nH4 : βˆ€ (n : β„•), 0 < n β†’ ↑n ≀ f ↑n\nH5 : βˆ€ (x : β„š), 1 < x β†’ ↑x ≀ f x\na : β„š\nha1 : 1 < a\nhae : f a = ↑a\n⊒ f...
theorem fixed_point_of_gt_1 {f : β„š β†’ ℝ} {x : β„š} (hx : 1 < x) (H1 : βˆ€ x y, 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y) (H2 : βˆ€ x y, 0 < x β†’ 0 < y β†’ f x + f y ≀ f (x + y)) (H4 : βˆ€ n : β„•, 0 < n β†’ (n : ℝ) ≀ f n) (H5 : βˆ€ x : β„š, 1 < x β†’ (x : ℝ) ≀ f x) {a : β„š} (ha1 : 1 < a) (hae : f a = a) : f x = x := by -- Choose n such that 1 + x < a^n. obtain ⟨N, hN⟩ := pow_unbounded_of_one_lt (1 + x) ha1 have h_big_enough : (1 : β„š) < a ^ N - x := lt_sub_iff_add_lt.mpr hN have h1 := calc (x : ℝ) + (a ^ N - x : β„š) ≀ f x + (a ^ N - x : β„š) := by gcongr; exact H5 x hx _ ≀ f x + f (a ^ N - x) := by gcongr; exact H5 _ h_big_enough have hxp : 0 < x := by positivity have hNp : 0 < N := by by_contra! H; rw [Nat.le_zero.mp H] at hN; linarith have h2 := calc f x + f (a ^ N - x) ≀ f (x + (a ^ N - x)) := H2 x (a ^ N - x) hxp (by positivity) _ = f (a ^ N) := by ring_nf _ = a ^ N := fixed_point_of_pos_nat_pow hNp H1 H4 H5 ha1 hae _ = x + (a ^ N - x) := by ring have heq := h1.antisymm (mod_cast h2) linarith [H5 x hx, H5 _ h_big_enough]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2013Q5.lean
{ "open": [], "variables": [] }
[ { "line": "obtain ⟨N, hN⟩ := pow_unbounded_of_one_lt (1 + x) ha1", "before_state": "f : β„š β†’ ℝ\nx : β„š\nhx : 1 < x\nH1 : βˆ€ (x y : β„š), 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y\nH2 : βˆ€ (x y : β„š), 0 < x β†’ 0 < y β†’ f x + f y ≀ f (x + y)\nH4 : βˆ€ (n : β„•), 0 < n β†’ ↑n ≀ f ↑n\nH5 : βˆ€ (x : β„š), 1 < x β†’ ↑x ≀ f x\na : β„š\nha1 ...
theorem imo2013_q5 (f : β„š β†’ ℝ) (H1 : βˆ€ x y, 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y) (H2 : βˆ€ x y, 0 < x β†’ 0 < y β†’ f x + f y ≀ f (x + y)) (H_fixed_point : βˆƒ a, 1 < a ∧ f a = a) : βˆ€ x, 0 < x β†’ f x = x := by obtain ⟨a, ha1, hae⟩ := H_fixed_point have H3 : βˆ€ x : β„š, 0 < x β†’ βˆ€ n : β„•, 0 < n β†’ ↑n * f x ≀ f (n * x) := by intro x hx n hn rcases n with - | n Β· exact (lt_irrefl 0 hn).elim induction' n with pn hpn Β· norm_num calc ↑(pn + 2) * f x = (↑pn + 1 + 1) * f x := by norm_cast _ = (↑pn + 1) * f x + f x := by ring _ ≀ f (↑pn.succ * x) + f x := mod_cast add_le_add_right (hpn pn.succ_pos) (f x) _ ≀ f ((↑pn + 1) * x + x) := by exact_mod_cast H2 _ _ (mul_pos pn.cast_add_one_pos hx) hx _ = f ((↑pn + 1 + 1) * x) := by ring_nf _ = f (↑(pn + 2) * x) := by norm_cast have H4 : βˆ€ n : β„•, 0 < n β†’ (n : ℝ) ≀ f n := by intro n hn have hf1 : 1 ≀ f 1 := by have a_pos : (0 : ℝ) < a := Rat.cast_pos.mpr (zero_lt_one.trans ha1) suffices ↑a * 1 ≀ ↑a * f 1 by rwa [← mul_le_mul_left a_pos] calc ↑a * 1 = ↑a := mul_one (a : ℝ) _ = f a := hae.symm _ = f (a * 1) := by rw [mul_one] _ ≀ f a * f 1 := (H1 a 1) (zero_lt_one.trans ha1) zero_lt_one _ = ↑a * f 1 := by rw [hae] calc (n : ℝ) = (n : ℝ) * 1 := (mul_one _).symm _ ≀ (n : ℝ) * f 1 := by gcongr _ ≀ f (n * 1) := H3 1 zero_lt_one n hn _ = f n := by rw [mul_one] have H5 : βˆ€ x : β„š, 1 < x β†’ (x : ℝ) ≀ f x := by intro x hx have hxnm1 : βˆ€ n : β„•, 0 < n β†’ (x : ℝ) ^ n - 1 < f x ^ n := by intro n hn calc (x : ℝ) ^ n - 1 < f (x ^ n) := mod_cast fx_gt_xm1 (one_le_powβ‚€ hx.le) H1 H2 H4 _ ≀ f x ^ n := pow_f_le_f_pow hn hx H1 H4 have hx' : 1 < (x : ℝ) := mod_cast hx have hxp : 0 < x := by positivity exact le_of_all_pow_lt_succ' hx' (f_pos_of_pos hxp H1 H4) hxnm1 have h_f_commutes_with_pos_nat_mul : βˆ€ n : β„•, 0 < n β†’ βˆ€ x : β„š, 0 < x β†’ f (n * x) = n * f x := by intro n hn x hx have h2 : f (n * x) ≀ n * f x := by rcases n with - | n Β· exfalso; exact Nat.lt_asymm hn hn rcases n with - | n Β· norm_num have hfneq : f n.succ.succ = n.succ.succ := by have := fixed_point_of_gt_1 (Nat.one_lt_cast.mpr (Nat.succ_lt_succ n.succ_pos)) H1 H2 H4 H5 ha1 hae rwa [Rat.cast_natCast n.succ.succ] at this rw [← hfneq] exact H1 (n.succ.succ : β„š) x (Nat.cast_pos.mpr hn) hx exact h2.antisymm (H3 x hx n hn) -- For the final calculation, we expand x as (2 * x.num) / (2 * x.den), because -- we need the top of the fraction to be strictly greater than 1 in order -- to apply `fixed_point_of_gt_1`. intro x hx have Hβ‚€ : x * x.den = x.num := x.mul_den_eq_num have H : x * (↑(2 * x.den) : β„š) = (↑(2 * x.num) : β„š) := by push_cast; linear_combination 2 * Hβ‚€ set x2denom := 2 * x.den set x2num := 2 * x.num have hx2pos : 0 < 2 * x.den := by positivity have hx2cnezr : (x2denom : ℝ) β‰  (0 : ℝ) := by positivity have : 0 < x.num := by rwa [Rat.num_pos] have hx2num_gt_one : (1 : β„š) < (2 * x.num : β„€) := by norm_cast; linarith apply mul_left_cancelβ‚€ hx2cnezr calc x2denom * f x = f (x2denom * x) := (h_f_commutes_with_pos_nat_mul x2denom hx2pos x hx).symm _ = f x2num := by congr; linear_combination H _ = x2num := fixed_point_of_gt_1 hx2num_gt_one H1 H2 H4 H5 ha1 hae _ = ((x2num : β„š) : ℝ) := by norm_cast _ = (↑(x2denom * x) : ℝ) := by congr; linear_combination -H _ = x2denom * x := by push_cast; rfl
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2013Q5.lean
{ "open": [ "Imo2013Q5" ], "variables": [] }
[ { "line": "obtain ⟨a, ha1, hae⟩ := H_fixed_point", "before_state": "f : β„š β†’ ℝ\nH1 : βˆ€ (x y : β„š), 0 < x β†’ 0 < y β†’ f (x * y) ≀ f x * f y\nH2 : βˆ€ (x y : β„š), 0 < x β†’ 0 < y β†’ f x + f y ≀ f (x + y)\nH_fixed_point : βˆƒ a, 1 < a ∧ f a = ↑a\n⊒ βˆ€ (x : β„š), 0 < x β†’ f x = ↑x", "after_state": "case intro.intro\nf : β„š ...
theorem imo2019_q1 (f : β„€ β†’ β„€) : (βˆ€ a b : β„€, f (2 * a) + 2 * f b = f (f (a + b))) ↔ f = 0 ∨ βˆƒ c, f = fun x => 2 * x + c := by constructor; swap -- easy way: f(x)=0 and f(x)=2x+c work. Β· rintro (rfl | ⟨c, rfl⟩) <;> intros <;> norm_num; ring -- hard way. intro hf -- functional equation -- Using `h` for `(0, b)` and `(-1, b + 1)`, we get `f (b + 1) = f b + m` obtain ⟨m, H⟩ : βˆƒ m, βˆ€ b, f (b + 1) = f b + m := by refine ⟨(f 0 - f (-2)) / 2, fun b => ?_⟩ refine sub_eq_iff_eq_add'.1 (Int.eq_ediv_of_mul_eq_right two_ne_zero ?_) have h1 : f 0 + 2 * f b = f (f b) := by simpa using hf 0 b have h2 : f (-2) + 2 * f (b + 1) = f (f b) := by simpa using hf (-1) (b + 1) linarith -- Hence, `f` is an affine map, `f b = f 0 + m * b` obtain ⟨c, H⟩ : βˆƒ c, βˆ€ b, f b = c + m * b := by refine ⟨f 0, fun b => ?_⟩ induction' b with b ihb b ihb Β· simp Β· simp [H, ihb, mul_add, add_assoc] Β· rw [← sub_eq_of_eq_add (H _)] simp [ihb]; ring -- Now use `hf 0 0` and `hf 0 1` to show that `m ∈ {0, 2}` have H3 : 2 * c = m * c := by simpa [H, mul_add] using hf 0 0 obtain rfl | rfl : 2 = m ∨ m = 0 := by simpa [H, mul_add, H3] using hf 0 1 Β· right; use c; ext b; simp [H, add_comm] Β· left; ext b; simpa [H, two_ne_zero] using H3
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2019Q1.lean
{ "open": [], "variables": [] }
[ { "line": "constructor", "before_state": "f : β„€ β†’ β„€\n⊒ (βˆ€ (a b : β„€), f (2 * a) + 2 * f b = f (f (a + b))) ↔ f = 0 ∨ βˆƒ c, f = fun x => 2 * x + c", "after_state": "case mp\nf : β„€ β†’ β„€\n⊒ (βˆ€ (a b : β„€), f (2 * a) + 2 * f b = f (f (a + b))) β†’ f = 0 ∨ βˆƒ c, f = fun x => 2 * x + c\n---\ncase mpr\nf : β„€ β†’ β„€\n⊒ (f...
theorem upper_bound {k n : β„•} (hk : k > 0) (h : (k ! : β„€) = ∏ i ∈ range n, ((2 : β„€) ^ n - (2 : β„€) ^ i)) : n < 6 := by have h2 : βˆ‘ i ∈ range n, i < k := by suffices emultiplicity 2 (k ! : β„€) = ↑(βˆ‘ i ∈ range n, i : β„•) by rw [← Nat.cast_lt (Ξ± := β„•βˆž)]; change emultiplicity ((2 : β„•) : β„€) _ < _ rw [← this]; change emultiplicity ((2 : β„•) : β„€) _ < _ simp_rw [Int.natCast_emultiplicity, emultiplicity_two_factorial_lt hk.lt.ne.symm] rw [h] rw [Finset.emultiplicity_prod Int.prime_two] rw [Nat.cast_sum] apply sum_congr rfl; intro i hi rw [emultiplicity_sub_of_gt] rw [emultiplicity_pow_self_of_prime Int.prime_two] rwa [emultiplicity_pow_self_of_prime Int.prime_two, emultiplicity_pow_self_of_prime Int.prime_two, Nat.cast_lt, ← mem_range] rw [← not_le]; intro hn apply _root_.ne_of_gt _ h calc ∏ i ∈ range n, ((2:β„€) ^ n - (2:β„€) ^ i) ≀ ∏ __ ∈ range n, (2:β„€) ^ n := ?_ _ < ↑ k ! := ?_ Β· gcongr Β· intro i hi simp only [mem_range] at hi have : (2:β„€) ^ i ≀ (2:β„€) ^ n := by gcongr; norm_num linarith Β· apply sub_le_self positivity norm_cast calc ∏ __ ∈ range n, 2 ^ n = 2 ^ (n * n) := by rw [prod_const, card_range, ← pow_mul] _ < (βˆ‘ i ∈ range n, i)! := ?_ _ ≀ k ! := by gcongr clear h h2 induction' n, hn using Nat.le_induction with n' hn' IH Β· decide let A := βˆ‘ i ∈ range n', i have le_sum : βˆ‘ i ∈ range 6, i ≀ A := by apply sum_le_sum_of_subset simpa using hn' calc 2 ^ ((n' + 1) * (n' + 1)) ≀ 2 ^ (n' * n' + 4 * n') := by gcongr <;> linarith _ = 2 ^ (n' * n') * (2 ^ 4) ^ n' := by rw [← pow_mul, ← pow_add] _ < A ! * (2 ^ 4) ^ n' := by gcongr _ = A ! * (15 + 1) ^ n' := rfl _ ≀ A ! * (A + 1) ^ n' := by gcongr; exact le_sum _ ≀ (A + n')! := factorial_mul_pow_le_factorial _ = (βˆ‘ i ∈ range (n' + 1), i)! := by rw [sum_range_succ]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2019Q4.lean
{ "open": [ "scoped Nat", "Nat hiding zero_le Prime", "Finset" ], "variables": [] }
[ { "line": "have h2 : βˆ‘ i ∈ range n, i < k :=\n by\n suffices emultiplicity 2 (k ! : β„€) = ↑(βˆ‘ i ∈ range n, i : β„•)\n by\n rw [← Nat.cast_lt (Ξ± := β„•βˆž)]; change emultiplicity ((2 : β„•) : β„€) _ < _\n rw [← this]; change emultiplicity ((2 : β„•) : β„€) _ < _\n simp_rw [Int.natCast_emultiplicity, emultiplicity...
lemma exists_numbers_in_interval {n : β„•} (hn : 100 ≀ n) : βˆƒ l : β„•, n + 4 * l ≀ 2 * l ^ 2 ∧ 2 * l ^ 2 + 4 * l ≀ 2 * n := by have hn' : 1 ≀ Nat.sqrt (n + 1) := by rw [Nat.le_sqrt] apply Nat.le_add_left have h₁ := Nat.sqrt_le' (n + 1) have hβ‚‚ := Nat.succ_le_succ_sqrt' (n + 1) have h₃ : 10 ≀ (n + 1).sqrt := by rw [Nat.le_sqrt] omega rw [← Nat.sub_add_cancel hn'] at h₁ hβ‚‚ h₃ set l := (n + 1).sqrt - 1 refine ⟨l, ?_, ?_⟩ Β· calc n + 4 * l ≀ (l ^ 2 + 4 * l + 2) + 4 * l := by linarith only [hβ‚‚] _ ≀ 2 * l ^ 2 := by nlinarith only [h₃] Β· linarith only [h₁]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2021Q1.lean
{ "open": [ "Finset" ], "variables": [] }
[ { "line": "have hn' : 1 ≀ Nat.sqrt (n + 1) := by\n rw [Nat.le_sqrt]\n apply Nat.le_add_left", "before_state": "n : β„•\nhn : 100 ≀ n\n⊒ βˆƒ l, n + 4 * l ≀ 2 * l ^ 2 ∧ 2 * l ^ 2 + 4 * l ≀ 2 * n", "after_state": "n : β„•\nhn : 100 ≀ n\nhn' : 1 ≀ (n + 1).sqrt\n⊒ βˆƒ l, n + 4 * l ≀ 2 * l ^ 2 ∧ 2 * l ^ 2 + 4 * l ≀...
lemma exists_triplet_summing_to_squares {n : β„•} (hn : 100 ≀ n) : βˆƒ a b c : β„•, n ≀ a ∧ a < b ∧ b < c ∧ c ≀ 2 * n ∧ IsSquare (a + b) ∧ IsSquare (c + a) ∧ IsSquare (b + c) := by obtain ⟨l, hl1, hl2⟩ := exists_numbers_in_interval hn have hl : 1 < l := by contrapose! hl1; interval_cases l <;> linarith have h₁ : 4 * l ≀ 2 * l ^ 2 := by omega have hβ‚‚ : 1 ≀ 2 * l := by omega refine ⟨2 * l ^ 2 - 4 * l, 2 * l ^ 2 + 1, 2 * l ^ 2 + 4 * l, ?_, ?_, ?_, ⟨?_, ⟨2 * l - 1, ?_⟩, ⟨2 * l, ?_⟩, 2 * l + 1, ?_⟩⟩ all_goals zify [h₁, hβ‚‚]; linarith
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2021Q1.lean
{ "open": [ "Finset" ], "variables": [] }
[ { "line": "obtain ⟨l, hl1, hl2⟩ := exists_numbers_in_interval hn", "before_state": "n : β„•\nhn : 100 ≀ n\n⊒ βˆƒ a b c, n ≀ a ∧ a < b ∧ b < c ∧ c ≀ 2 * n ∧ IsSquare (a + b) ∧ IsSquare (c + a) ∧ IsSquare (b + c)", "after_state": "No Goals!" } ]
lemma exists_finset_3_le_card_with_pairs_summing_to_squares {n : β„•} (hn : 100 ≀ n) : βˆƒ B : Finset β„•, 2 * 1 + 1 ≀ #B ∧ (βˆ€ a ∈ B, βˆ€ b ∈ B, a β‰  b β†’ IsSquare (a + b)) ∧ βˆ€ c ∈ B, n ≀ c ∧ c ≀ 2 * n := by obtain ⟨a, b, c, hna, hab, hbc, hcn, h₁, hβ‚‚, hβ‚ƒβŸ© := exists_triplet_summing_to_squares hn refine ⟨{a, b, c}, ?_, ?_, ?_⟩ Β· suffices a βˆ‰ {b, c} ∧ b βˆ‰ {c} by rw [Finset.card_insert_of_not_mem this.1] rw [Finset.card_insert_of_not_mem this.2] rw [Finset.card_singleton] rw [Finset.mem_insert] rw [Finset.mem_singleton] rw [Finset.mem_singleton] push_neg exact ⟨⟨hab.ne, (hab.trans hbc).ne⟩, hbc.ne⟩ Β· intro x hx y hy hxy simp only [Finset.mem_insert] at hx hy simp only [Finset.mem_singleton] at hx hy rcases hx with (rfl | rfl | rfl) <;> rcases hy with (rfl | rfl | rfl) all_goals first | contradiction | assumption | simpa only [add_comm x y] Β· simp only [Finset.mem_insert, Finset.mem_singleton] rintro d (rfl | rfl | rfl) <;> constructor <;> linarith only [hna, hab, hbc, hcn]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2021Q1.lean
{ "open": [ "Finset" ], "variables": [] }
[ { "line": "obtain ⟨a, b, c, hna, hab, hbc, hcn, h₁, hβ‚‚, hβ‚ƒβŸ© := exists_triplet_summing_to_squares hn", "before_state": "n : β„•\nhn : 100 ≀ n\n⊒ βˆƒ B, 2 * 1 + 1 ≀ #B ∧ (βˆ€ a ∈ B, βˆ€ b ∈ B, a β‰  b β†’ IsSquare (a + b)) ∧ βˆ€ c ∈ B, n ≀ c ∧ c ≀ 2 * n", "after_state": "No Goals!" } ]
theorem imo2021_q1 : βˆ€ n : β„•, 100 ≀ n β†’ βˆ€ A βŠ† Finset.Icc n (2 * n), (βˆƒ a ∈ A, βˆƒ b ∈ A, a β‰  b ∧ IsSquare (a + b)) ∨ βˆƒ a ∈ Finset.Icc n (2 * n) \ A, βˆƒ b ∈ Finset.Icc n (2 * n) \ A, a β‰  b ∧ IsSquare (a + b) := by intro n hn A hA -- For each n ∈ β„• such that 100 ≀ n, there exists a pairwise unequal triplet {a, b, c} βŠ† [n, 2n] -- such that all pairwise sums are perfect squares. In practice, it will be easier to use -- a finite set B βŠ† [n, 2n] such that all pairwise unequal pairs of B sum to a perfect square -- noting that B has cardinality greater or equal to 3, by the explicit construction of the -- triplet {a, b, c} before. obtain ⟨B, hB, h₁, hβ‚‚βŸ© := exists_finset_3_le_card_with_pairs_summing_to_squares hn have hBsub : B βŠ† Finset.Icc n (2 * n) := by intro c hcB; simpa only [Finset.mem_Icc] using hβ‚‚ c hcB have hB' : 2 * 1 < #(B ∩ (Icc n (2 * n) \ A) βˆͺ B ∩ A) := by rwa [← inter_union_distrib_left, sdiff_union_self_eq_union, union_eq_left.2 hA, inter_eq_left.2 hBsub, ← Nat.succ_le_iff] -- Since B has cardinality greater or equal to 3, there must exist a subset C βŠ† B such that -- for any A βŠ† [n, 2n], either C βŠ† A or C βŠ† [n, 2n] \ A and C has cardinality greater -- or equal to 2. obtain ⟨C, hC, hCA⟩ := Finset.exists_subset_or_subset_of_two_mul_lt_card hB' rw [Finset.one_lt_card] at hC rcases hC with ⟨a, ha, b, hb, hab⟩ simp only [Finset.subset_iff] at hCA simp only [Finset.mem_inter] at hCA -- Now we split into the two cases C βŠ† [n, 2n] \ A and C βŠ† A, which can be dealt with identically. rcases hCA with hCA | hCA <;> [right; left] <;> exact ⟨a, (hCA ha).2, b, (hCA hb).2, hab, h₁ a (hCA ha).1 b (hCA hb).1 hab⟩
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2021Q1.lean
{ "open": [ "Finset", "Imo2021Q1" ], "variables": [] }
[ { "line": "intro n hn A hA", "before_state": "⊒ βˆ€ (n : β„•),\n 100 ≀ n β†’\n βˆ€ A βŠ† Icc n (2 * n),\n (βˆƒ a ∈ A, βˆƒ b ∈ A, a β‰  b ∧ IsSquare (a + b)) ∨\n βˆƒ a ∈ Icc n (2 * n) \\ A, βˆƒ b ∈ Icc n (2 * n) \\ A, a β‰  b ∧ IsSquare (a + b)", "after_state": "n : β„•\nhn : 100 ≀ n\nA : Finset β„•\nhA : ...
lemma dvd_pow_iff_of_dvd_sub {a b d n : β„•} {z : β„€} (ha : a.Coprime d) (hd : (Ο† d : β„€) ∣ (n : β„€) - z) : d ∣ a ^ n + b ↔ (((ZMod.unitOfCoprime _ ha) ^ z : (ZMod d)Λ£) : ZMod d) + b = 0 := by rcases hd with ⟨k, hk⟩ rw [← ZMod.natCast_zmod_eq_zero_iff_dvd] convert Iff.rfl push_cast congr suffices (((ZMod.unitOfCoprime _ ha) ^ z : (ZMod d)Λ£) : ZMod d) = (((ZMod.unitOfCoprime _ ha) ^ (n : β„€) : (ZMod d)Λ£) : ZMod d) by convert this rw [sub_eq_iff_eq_add] at hk rw [hk] rw [zpow_add] rw [zpow_mul] norm_cast rw [ZMod.pow_totient] rw [one_zpow] rw [one_mul]
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2024Q2.lean
{ "open": [ "scoped Nat" ], "variables": [] }
[ { "line": "rcases hd with ⟨k, hk⟩", "before_state": "a b d n : β„•\nz : β„€\nha : a.Coprime d\nhd : ↑(Ο† d) ∣ ↑n - z\n⊒ d ∣ a ^ n + b ↔ ↑(ZMod.unitOfCoprime a ha ^ z) + ↑b = 0", "after_state": "case intro\na b d n : β„•\nz : β„€\nha : a.Coprime d\nk : β„€\nhk : ↑n - z = ↑(Ο† d) * k\n⊒ d ∣ a ^ n + b ↔ ↑(ZMod.unitOfC...
lemma map_add_one_range (p : β„• β†’ Prop) [DecidablePred p] (n : β„•) (h0 : Β¬ p 0) : {x ∈ Finset.range n | p (x + 1)}.map ⟨(Β· + 1), add_left_injective 1⟩ = {x ∈ Finset.range (n + 1) | p x } := by ext x simp only [Finset.mem_map] constructor Β· aesop Β· intro hx use x - 1 cases x <;> simp_all
/root/DuelModelResearch/mathlib4/Archive/Imo/Imo2024Q3.lean
{ "open": [ "scoped Finset" ], "variables": [] }
[ { "line": "ext x", "before_state": "p : β„• β†’ Prop\ninst✝ : DecidablePred p\nn : β„•\nh0 : Β¬p 0\n⊒ Finset.map { toFun := fun x => x + 1, inj' := β‹― } ({x ∈ Finset.range n | p (x + 1)}) =\n {x ∈ Finset.range (n + 1) | p x}", "after_state": "case h\np : β„• β†’ Prop\ninst✝ : DecidablePred p\nn : β„•\nh0 : Β¬p 0\nx...
theorem add_mod2 (a : β„•) : βˆƒ t, a + a % 2 = t * 2 := by simp only [mul_comm _ 2] -- write `t*2` as `2*t` apply dvd_of_mod_eq_zero -- it suffices to prove `(a + a % 2) % 2 = 0` rw [add_mod] rw [mod_mod] rw [← two_mul] rw [mul_mod_right]
/root/DuelModelResearch/mathlib4/Archive/MiuLanguage/DecisionSuf.lean
{ "open": [ "MiuAtom List Nat" ], "variables": [] }
[ { "line": "simp only [mul_comm _ 2]\n -- write `t*2` as `2*t`", "before_state": "a : β„•\n⊒ βˆƒ t, a + a % 2 = t * 2", "after_state": "a : β„•\n⊒ βˆƒ t, a + a % 2 = 2 * t" }, { "line": "apply dvd_of_mod_eq_zero", "before_state": "a : β„•\n⊒ βˆƒ t, a + a % 2 = 2 * t", "after_state": "No Goals!" } ...
private theorem le_pow2_and_pow2_eq_mod3' (c : β„•) (x : β„•) (h : c = 1 ∨ c = 2) : βˆƒ m : β„•, c + 3 * x ≀ 2 ^ m ∧ 2 ^ m % 3 = c % 3 := by induction' x with k hk Β· use c + 1 rcases h with hc | hc <;> Β· rw [hc]; norm_num rcases hk with ⟨g, hkg, hgmod⟩ by_cases hp : c + 3 * (k + 1) ≀ 2 ^ g Β· use g, hp, hgmod refine ⟨g + 2, ?_, ?_⟩ Β· rw [mul_succ, ← add_assoc, pow_add] change c + 3 * k + 3 ≀ 2 ^ g * (1 + 3); rw [mul_add (2 ^ g) 1 3, mul_one] linarith [hkg, @Nat.one_le_two_pow g] Β· rw [pow_add, ← mul_one c] exact ModEq.mul hgmod rfl
/root/DuelModelResearch/mathlib4/Archive/MiuLanguage/DecisionSuf.lean
{ "open": [ "MiuAtom List Nat" ], "variables": [] }
[ { "line": "induction' x with k hk", "before_state": "c x : β„•\nh : c = 1 ∨ c = 2\n⊒ βˆƒ m, c + 3 * x ≀ 2 ^ m ∧ 2 ^ m % 3 = c % 3", "after_state": "case zero\nc : β„•\nh : c = 1 ∨ c = 2\n⊒ βˆƒ m, c + 3 * 0 ≀ 2 ^ m ∧ 2 ^ m % 3 = c % 3\n---\ncase succ\nc : β„•\nh : c = 1 ∨ c = 2\nk : β„•\nhk : βˆƒ m, c + 3 * k ≀ 2 ^ m ...
theorem le_pow2_and_pow2_eq_mod3 (a : β„•) (h : a % 3 = 1 ∨ a % 3 = 2) : βˆƒ m : β„•, a ≀ 2 ^ m ∧ 2 ^ m % 3 = a % 3 := by obtain ⟨m, hm⟩ := le_pow2_and_pow2_eq_mod3' (a % 3) (a / 3) h use m constructor Β· convert hm.1; exact (mod_add_div a 3).symm Β· rw [hm.2, mod_mod _ 3]
/root/DuelModelResearch/mathlib4/Archive/MiuLanguage/DecisionSuf.lean
{ "open": [ "MiuAtom List Nat" ], "variables": [] }
[ { "line": "obtain ⟨m, hm⟩ := le_pow2_and_pow2_eq_mod3' (a % 3) (a / 3) h", "before_state": "a : β„•\nh : a % 3 = 1 ∨ a % 3 = 2\n⊒ βˆƒ m, a ≀ 2 ^ m ∧ 2 ^ m % 3 = a % 3", "after_state": "No Goals!" } ]
theorem OxfordInvariants.Week3P1 (n : β„•) (a : β„• β†’ β„•) (a_pos : βˆ€ i ≀ n, 0 < a i) (ha : βˆ€ i, i + 2 ≀ n β†’ a (i + 1) ∣ a i + a (i + 2)) : βˆƒ b : β„•, (b : Ξ±) = βˆ‘ i ∈ Finset.range n, (a 0 : Ξ±) * a n / (a i * a (i + 1)) := by -- Treat separately `n = 0` and `n β‰₯ 1` rcases n with - | n /- Case `n = 0` The sum is trivially equal to `0` -/ Β· exact ⟨0, by rw [Nat.cast_zero, Finset.sum_range_zero]⟩ -- `⟨Claim it, Prove it⟩` /- Case `n β‰₯ 1`. We replace `n` by `n + 1` everywhere to make this inequality explicit Set up the stronger induction hypothesis -/ rsuffices ⟨b, hb, -⟩ : βˆƒ b : β„•, (b : Ξ±) = βˆ‘ i ∈ Finset.range (n + 1), (a 0 : Ξ±) * a (n + 1) / (a i * a (i + 1)) ∧ a (n + 1) ∣ a n * b - a 0 Β· exact ⟨b, hb⟩ simp_rw [← @Nat.cast_pos Ξ±] at a_pos /- Declare the induction `ih` will be the induction hypothesis -/ induction' n with n ih /- Base case Claim that the sum equals `1` -/ Β· refine ⟨1, ?_, ?_⟩ -- Check that this indeed equals the sum Β· rw [Nat.cast_one, Finset.sum_range_one] norm_num rw [div_self] exact (mul_pos (a_pos 0 (Nat.zero_le _)) (a_pos 1 (Nat.zero_lt_succ _))).ne' -- Check the divisibility condition Β· rw [mul_one, tsub_self] exact dvd_zero _ /- Induction step `b` is the value of the previous sum as a natural, `hb` is the proof that it is indeed the value, and `han` is the divisibility condition -/ obtain ⟨b, hb, han⟩ := ih (fun i hi => ha i <| Nat.le_succ_of_le hi) fun i hi => a_pos i <| Nat.le_succ_of_le hi specialize ha n le_rfl have haβ‚€ : a 0 ≀ a n * b := by -- Needing this is an artifact of `β„•`-subtraction. rw [← @Nat.cast_le Ξ±] rw [Nat.cast_mul] rw [hb] rw [← div_le_iffβ‚€' (a_pos _ <| n.le_succ.trans <| Nat.le_succ _)] rw [← mul_div_mul_right _ _ (a_pos _ <| Nat.le_succ _).ne'] suffices h : βˆ€ i, i ∈ Finset.range (n + 1) β†’ 0 ≀ (a 0 : Ξ±) * a (n + 1) / (a i * a (i + 1)) from Finset.single_le_sum h (Finset.self_mem_range_succ n) refine fun i _ ↦ div_nonneg ?_ ?_ <;> refine mul_nonneg ?_ ?_ <;> exact Nat.cast_nonneg _ -- Claim that the sum equals `(aβ‚™ + aβ‚™β‚Šβ‚‚)/aβ‚™β‚Šβ‚ * b - (aβ‚™ * b - aβ‚€)/aβ‚™β‚Šβ‚` refine ⟨(a n + a (n + 2)) / a (n + 1) * b - (a n * b - a 0) / a (n + 1), ?_, ?_⟩ -- Check that this indeed equals the sum Β· calc (((a n + a (n + 2)) / a (n + 1) * b - (a n * b - a 0) / a (n + 1) : β„•) : Ξ±) = ((a n + a (n + 2)) / a (n + 1) * b - (a n * b - a 0) / a (n + 1) ) := by have :((a (n + 1)) : Ξ±) β‰  0 := ne_of_gt <| a_pos (n + 1) <| Nat.le_succ (n + 1) simp only [← Nat.cast_add] simp only [← Nat.cast_div ha this] simp only [← Nat.cast_mul] simp only [← Nat.cast_sub haβ‚€] simp only [← Nat.cast_div han this] rw [Nat.cast_sub (Nat.div_le_of_le_mul _)] rw [← mul_assoc] rw [Nat.mul_div_cancel' ha] rw [add_mul] exact tsub_le_self.trans (Nat.le_add_right _ _) _ = a (n + 2) / a (n + 1) * b + a 0 * a (n + 2) / (a (n + 1) * a (n + 2)) := by rw [add_div] rw [add_mul] rw [sub_div] rw [mul_div_right_comm] rw [add_sub_sub_cancel] rw [mul_div_mul_right _ _ (a_pos _ le_rfl).ne'] _ = βˆ‘ i ∈ Finset.range (n + 2), (a 0 : Ξ±) * a (n + 2) / (a i * a (i + 1)) := by rw [Finset.sum_range_succ] rw [hb] rw [Finset.mul_sum] congr; ext i rw [← mul_div_assoc] rw [← mul_div_right_comm] rw [mul_div_assoc] rw [mul_div_cancel_rightβ‚€ _ (a_pos _ <| Nat.le_succ _).ne'] rw [mul_comm] -- Check the divisibility condition Β· rw [Nat.mul_sub, ← mul_assoc, Nat.mul_div_cancel' ha, add_mul, Nat.mul_div_cancel' han, add_tsub_tsub_cancel haβ‚€, add_tsub_cancel_right] exact dvd_mul_right _ _
/root/DuelModelResearch/mathlib4/Archive/OxfordInvariants/Summer2021/Week3P1.lean
{ "open": [], "variables": [ "{Ξ± : Type*} [Field Ξ±] [LinearOrder Ξ±] [IsStrictOrderedRing Ξ±]" ] }
[ { "line": "rcases n with - | n", "before_state": "Ξ± : Type u_1\ninst✝² : Field Ξ±\ninst✝¹ : LinearOrder Ξ±\ninst✝ : IsStrictOrderedRing Ξ±\nn : β„•\na : β„• β†’ β„•\na_pos : βˆ€ i ≀ n, 0 < a i\nha : βˆ€ (i : β„•), i + 2 ≀ n β†’ a (i + 1) ∣ a i + a (i + 2)\n⊒ βˆƒ b, ↑b = βˆ‘ i ∈ Finset.range n, ↑(a 0) * ↑(a n) / (↑(a i) * ↑(a (i +...
theorem cube_root_of_unity_sum (hω : IsPrimitiveRoot ω 3) : 1 + ω + ω ^ 2 = 0 := by simpa [cyclotomic_prime, Finset.sum_range_succ] using hω.isRoot_cyclotomic (by decide)
/root/DuelModelResearch/mathlib4/Archive/Wiedijk100Theorems/SolutionOfCubicQuartic.lean
{ "open": [ "Polynomial" ], "variables": [ "{K : Type*} [Field K] (a b c d e : K) {Ο‰ p q r s t u v w x y : K}" ] }
[ { "line": "simpa [cyclotomic_prime, Finset.sum_range_succ] using hΟ‰.isRoot_cyclotomic (by decide)", "before_state": "K : Type u_1\ninst✝ : Field K\nΟ‰ : K\nhΟ‰ : IsPrimitiveRoot Ο‰ 3\n⊒ 1 + Ο‰ + Ο‰ ^ 2 = 0", "after_state": "No Goals!" }, { "line": "decide", "before_state": "K : Type u_1\ninst✝ : ...
theorem cubic_eq_zero_iff_of_p_eq_zero (ha : a β‰  0) (hΟ‰ : IsPrimitiveRoot Ο‰ 3) (hpz : 3 * a * c - b ^ 2 = 0) (hq : q = (9 * a * b * c - 2 * b ^ 3 - 27 * a ^ 2 * d) / (54 * a ^ 3)) (hs3 : s ^ 3 = 2 * q) (x : K) : a * x ^ 3 + b * x ^ 2 + c * x + d = 0 ↔ x = s - b / (3 * a) ∨ x = s * Ο‰ - b / (3 * a) ∨ x = s * Ο‰ ^ 2 - b / (3 * a) := by have h₁ : βˆ€ x a₁ aβ‚‚ a₃ : K, x = a₁ ∨ x = aβ‚‚ ∨ x = a₃ ↔ (x - a₁) * (x - aβ‚‚) * (x - a₃) = 0 := by intros; simp only [mul_eq_zero, sub_eq_zero, or_assoc] have hi2 : (2 : K) β‰  0 := Invertible.ne_zero _ have hi3 : (3 : K) β‰  0 := Invertible.ne_zero _ have h54 : (54 : K) = 2 * 3 ^ 3 := by norm_num have hb2 : b ^ 2 = 3 * a * c := by rw [sub_eq_zero] at hpz; rw [hpz] have hb3 : b ^ 3 = 3 * a * b * c := by rw [pow_succ, hb2]; ring have hβ‚‚ := calc a * x ^ 3 + b * x ^ 2 + c * x + d = a * (x + b / (3 * a)) ^ 3 + (c - b ^ 2 / (3 * a)) * x + (d - b ^ 3 * a / (3 * a) ^ 3) := by field_simp; ring _ = a * (x + b / (3 * a)) ^ 3 + (d - (9 * a * b * c - 2 * b ^ 3) * a / (3 * a) ^ 3) := by simp only [hb2]; field_simp [ha]; ring simp only [hb3]; field_simp [ha]; ring _ = a * ((x + b / (3 * a)) ^ 3 - s ^ 3) := by rw [hs3, hq]; field_simp [h54]; ring have h₃ : βˆ€ x, a * x = 0 ↔ x = 0 := by intro x; simp [ha] have hβ‚„ : βˆ€ x : K, x ^ 3 - s ^ 3 = (x - s) * (x - s * Ο‰) * (x - s * Ο‰ ^ 2) := by intro x calc x ^ 3 - s ^ 3 = (x - s) * (x ^ 2 + x * s + s ^ 2) := by ring _ = (x - s) * (x ^ 2 - (Ο‰ + Ο‰ ^ 2) * x * s + (1 + Ο‰ + Ο‰ ^ 2) * x * s + s ^ 2) := by ring _ = (x - s) * (x ^ 2 - (Ο‰ + Ο‰ ^ 2) * x * s + Ο‰ ^ 3 * s ^ 2) := by rw [hΟ‰.pow_eq_one]; simp rw [cube_root_of_unity_sum hΟ‰]; simp _ = (x - s) * (x - s * Ο‰) * (x - s * Ο‰ ^ 2) := by ring rw [h₁] rw [hβ‚‚] rw [h₃] rw [hβ‚„ (x + b / (3 * a))] ring_nf
/root/DuelModelResearch/mathlib4/Archive/Wiedijk100Theorems/SolutionOfCubicQuartic.lean
{ "open": [ "Polynomial" ], "variables": [ "{K : Type*} [Field K] (a b c d e : K) {Ο‰ p q r s t u v w x y : K}", "[Invertible (2 : K)] [Invertible (3 : K)]" ] }
[ { "line": "have h₁ : βˆ€ x a₁ aβ‚‚ a₃ : K, x = a₁ ∨ x = aβ‚‚ ∨ x = a₃ ↔ (x - a₁) * (x - aβ‚‚) * (x - a₃) = 0 := by intros;\n simp only [mul_eq_zero, sub_eq_zero, or_assoc]", "before_state": "K : Type u_1\ninst✝² : Field K\na b c d Ο‰ q s : K\ninst✝¹ : Invertible 2\ninst✝ : Invertible 3\nha : a β‰  0\nhΟ‰ : IsPrimitive...
theorem quartic_depressed_eq_zero_iff (hq_nonzero : q β‰  0) (hu : u ^ 3 - p * u ^ 2 - 4 * r * u + 4 * p * r - q ^ 2 = 0) (hs : s ^ 2 = u - p) (hv : v ^ 2 = 4 * s ^ 2 - 8 * (u - q / s)) (hw : w ^ 2 = 4 * s ^ 2 - 8 * (u + q / s)) (x : K) : x ^ 4 + p * x ^ 2 + q * x + r = 0 ↔ x = (-2 * s - v) / 4 ∨ x = (-2 * s + v) / 4 ∨ x = (2 * s - w) / 4 ∨ x = (2 * s + w) / 4 := by have hi2 : (2 : K) β‰  0 := Invertible.ne_zero _ have h4 : (4 : K) = 2 ^ 2 := by norm_num have hs_nonzero : s β‰  0 := by contrapose! hq_nonzero with hs0 linear_combination (exp := 2) -hu + (4 * r - u ^ 2) * hs + (u ^ 2 * s - 4 * r * s) * hs0 calc _ ↔ 4 * (x ^ 4 + p * x ^ 2 + q * x + r) = 0 := by simp [h4, hi2] _ ↔ (2 * (x * x) + 2 * s * x + (u - q / s)) * (2 * (x * x) + -(2 * s) * x + (u + q / s)) = 0 := by apply Eq.congr_left field_simp linear_combination -hu + (-x ^ 2 * s ^ 2 - x ^ 2 * p + x ^ 2 * u) * hw + (x ^ 2 * w ^ 2 + 8 * x ^ 2 * u + 8 * x ^ 2 * q / s - u ^ 2 + 4 * r) * hs _ ↔ _ := by have hv' : discrim 2 (2 * s) (u - q / s) = v * v := by rw [discrim]; linear_combination -hv have hw' : discrim 2 (-(2 * s)) (u + q / s) = w * w := by rw [discrim]; linear_combination -hw rw [mul_eq_zero] rw [quadratic_eq_zero_iff hi2 hv'] rw [quadratic_eq_zero_iff hi2 hw'] simp [(by norm_num : (2 : K) * 2 = 4), or_assoc, or_comm]
/root/DuelModelResearch/mathlib4/Archive/Wiedijk100Theorems/SolutionOfCubicQuartic.lean
{ "open": [ "Polynomial" ], "variables": [ "{K : Type*} [Field K] (a b c d e : K) {Ο‰ p q r s t u v w x y : K}", "[Invertible (2 : K)] [Invertible (3 : K)]", "[Invertible (2 : K)]" ] }
[ { "line": "have hi2 : (2 : K) β‰  0 := Invertible.ne_zero _", "before_state": "K : Type u_1\ninst✝³ : Field K\np q r s u v w : K\ninst✝² : Invertible 2\ninst✝¹ : Invertible 3\ninst✝ : Invertible 2\nhq_nonzero : q β‰  0\nhu : u ^ 3 - p * u ^ 2 - 4 * r * u + 4 * p * r - q ^ 2 = 0\nhs : s ^ 2 = u - p\nhv : v ^ 2 =...