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
... | /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... | /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... | /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).s... | /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 <;> contrad... | /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 ^... | /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 sho... | /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)) =
... | /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)... | /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)
β€ _ *... | /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' ... | /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 * Ξ±
cal... | /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
f... | /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; sim... | /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 ... | /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 [β... | /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 ?_ ?_... | /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... | /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 lin... | /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) (l... | /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... | /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 (β... | /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... | /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... | /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... | /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... | /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)",
... | [
{
"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 linari... | /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 ... | /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... | /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... | /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 h... | /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β©... | /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... | /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 < (... | /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 ... | /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
... | /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' := ... | /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... | /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... | /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) :=... | /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 ... | /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 [β th... | /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).sqr... | /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... | /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 ... | /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 {... | /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... | /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
... | /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 i... | /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) ... | /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 -... | /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 =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.