File size: 8,815 Bytes
1c3ffd8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
import Mathlib
set_option linter.unusedVariables.analyzeTactics true
theorem imo_2022_p2_simple
(g: β β β)
(hβ: β x, 0 < x β β y:β , (0 < y β§ g (x) + g (y) β€ 2 * x * y
β§ (β z:β, (0 < z β§ z β y) β Β¬ g (x) + g (z) β€ 2 * x * z) )) :
(β x:β , 0 < x β g x = x^2) := by
have hβ: β x y:β , 0 < x β§ 0 < y β g x + g y β€ 2 * x * y β x = y := by
intros x y hp hβ
by_contra! hc
have gβ: 2 * x * x < g x + g x := by
let β¨p,hβββ© := hβ x hp.1
cases' hββ with hββ hββ
cases' hββ with hββ hββ
by_cases hxp: x β p
. have hββ: Β¬ g x + g x β€ 2 * x * x := by
refine hββ x ?_
constructor
. exact hp.1
. exact hxp
exact not_le.mp hββ
. push_neg at hxp
exfalso
have hpy: y β p := by exact Ne.trans_eq (id (Ne.symm hc)) hxp
have hcy: Β¬g x + g y β€ 2 * x * y := by
refine hββ y ?_
constructor
. exact hp.2
. exact hpy
linarith
have gβ: 2 * y * y < g y + g y := by
let β¨p,hβββ© := hβ y hp.2
cases' hββ with hββ hββ
cases' hββ with hββ hββ
by_cases hyp: y β p
. have hββ: Β¬ g y + g y β€ 2 * y * y := by
refine hββ y ?_
constructor
. exact hp.2
. exact hyp
exact not_le.mp hββ
. push_neg at hyp
exfalso
have hpx: x β p := by exact Ne.trans_eq hc hyp
have hcy: Β¬g x + g y β€ 2 * x * y := by
rw [add_comm, mul_right_comm]
refine hββ x ?_
constructor
. exact hp.1
. exact hpx
linarith
ring_nf at gβ gβ
simp at gβ gβ
have gβ: x ^ 2 + y ^ 2 < g x + g y := by exact add_lt_add gβ gβ
have gβ: x ^ 2 + y ^ 2 < 2 * x * y := by exact LT.lt.trans_le gβ hβ
have gβ
: (x - y) ^ 2 < 0 := by
rw [sub_sq, sub_add_eq_add_sub]
exact sub_neg.mpr gβ
have gβ: (x - y) β 0 := by exact sub_ne_zero.mpr hc
have gβ: 0 < (x - y) ^ 2 := by exact (sq_pos_iff).mpr gβ
have gβ: (0:β) β 0 := by
refine ne_of_lt ?_
exact lt_trans gβ gβ
refine false_of_ne gβ
have hβ: β x:β , 0 < x β g x β€ x ^ 2 := by
intros x hxp
let β¨y,hβββ© := hβ x hxp
cases' hββ with hββ hββ
cases' hββ with hββ hββ
have hxy: x = y := by
apply hβ x y
. exact { left := hxp, right := hββ }
. exact hββ
rw [β hxy] at hββ
linarith
have hβ: β x:β , 0 < x β Β¬ g x < x ^ 2 := by
simp
by_contra! hc
let β¨x,hxpβ© := hc
cases' hxp with hxp hβ
let dβ:β := x ^ 2 - g x
have hdβ : g x = x ^ 2 - dβ := by exact (sub_sub_self (x ^ 2) (g x)).symm
let z:β := x + Real.sqrt dβ
have hz: z = x + Real.sqrt dβ := by exact rfl
have hzp: 0 < z := by
refine add_pos hxp ?_
refine Real.sqrt_pos_of_pos ?_
exact sub_pos.mpr hβ
have hxz: z β x := by
rw [hz]
simp
push_neg
refine Real.sqrt_ne_zero'.mpr ?_
exact sub_pos.mpr hβ
have hβ
: g x + g z β€ 2 * x * z := by
rw [hdβ]
have hβ
β: - dβ + Real.sqrt (x ^ 2 - (x ^ 2 - dβ)) ^ 2 β€ 0 := by
simp
rw [Real.sq_sqrt]
exact sub_nonneg_of_le (hβ x hxp)
have hβ
β: x ^ 2 - dβ + z ^ 2 β€ 2 * x * z := by
rw [hz, mul_add, add_sq]
ring_nf
repeat rw [add_assoc]
refine add_le_add_left ?_ (x * Real.sqrt (x ^ 2 - g x) * 2)
rw [hdβ]
linarith
exact add_le_of_add_le_left hβ
β (hβ z hzp)
let β¨y,hypβ© := hβ x hxp
cases' hyp with hyp hβ
cases' hβ with hβ hβ
have hxy: x = y := by
apply hβ
. exact { left := hxp, right := hyp }
. exact hβ
have hβ: Β¬g x + g z β€ 2 * x * z := by
refine hβ z ?_
constructor
. exact hzp
. exact Ne.trans_eq hxz hxy
linarith[hβ
,hβ]
intros x hxp
have gβ: g x β€ x ^ 2 := by exact hβ x hxp
have gβ: Β¬ g x < x ^ 2 := by exact hβ x hxp
linarith
theorem imo_2022_p2
(f: β β β)
(hfp: β x:β, 0 < x β 0 < f x)
(hβ: β x:β , 0 < x β β! y:β , 0 < y β§ (x * f (y) + y * f (x) β€ 2) ):
β x:β , 0 < x β f (x) = 1 / x := by
have hβ: β x y:β , (0 < x β§ 0 < y) β (x * f (y) + y * f (x) β€ 2) β x = y := by
intros x y hp hβ
by_contra! hc
have hββ: x * f x + x * f x > 2 := by
let β¨z,hβββ© := hβ x hp.1
cases' hββ with hββ hββ
have hββ: y = z := by
apply hββ y
constructor
. exact hp.2
. exact hβ
have hxz: Β¬ x = z := by exact Ne.trans_eq hc hββ
have hββ: Β¬ (fun y => 0 < y β§ x * f y + y * f x β€ 2) x := by
exact mt (hββ x) hxz
have hββ: Β¬ (0 < x β§ x * f x + x * f x β€ 2) := by exact hββ
push_neg at hββ
exact hββ hp.1
have hββ: y * f y + y * f y > 2 := by
let β¨z,hβββ© := hβ y hp.2
cases' hββ with hββ hββ
have hββ: x = z := by
apply hββ x
constructor
. exact hp.1
. rw [add_comm]
exact hβ
have hxz: Β¬ y = z := by exact Ne.trans_eq (id (Ne.symm hc)) hββ
have hββ: Β¬ (fun y_2 => 0 < y_2 β§ y * f y_2 + y_2 * f y β€ 2) y := by
exact mt (hββ y) hxz
have hββ: Β¬ (0 < y β§ y * f y + y * f y β€ 2) := by exact hββ
push_neg at hββ
exact hββ hp.2
ring_nf at hββ hββ
simp at hββ hββ
have hββ
: 1 / x < f x := by exact (div_lt_iffβ' hp.1).mpr (hββ)
have hββ: 1 / y < f y := by exact (div_lt_iffβ' hp.2).mpr (hββ)
have hββ: x / y + y / x < 2 := by
refine lt_of_le_of_lt' hβ ?_
refine add_lt_add ?_ ?_
. rw [β mul_one_div]
exact (mul_lt_mul_left hp.1).mpr hββ
. rw [β mul_one_div]
exact (mul_lt_mul_left hp.2).mpr hββ
have hββ: 2 < x / y + y / x := by
refine lt_of_mul_lt_mul_right ?_ (le_of_lt hp.1)
refine lt_of_mul_lt_mul_right ?_ (le_of_lt hp.2)
repeat rw [add_mul, mul_assoc]
rw [mul_comm x y, β mul_assoc (x/y)]
rw [div_mul_comm x y y, div_mul_comm y x x, div_self, div_self]
. ring_nf
refine lt_of_sub_pos ?_
rw [mul_comm _ 2, β mul_assoc]
rw [β sub_sq']
refine sq_pos_of_ne_zero ?_
exact sub_ne_zero.mpr hc.symm
. exact ne_of_gt hp.1
. exact ne_of_gt hp.2
linarith
have hβ: β x:β , 0 < x β x * f x β€ 1 := by
intros x hxp
let β¨y,hβββ© := hβ x hxp
cases' hββ with hββ hββ
have hxy: x = y := by
apply hβ x y
. constructor
. exact hxp
. exact hββ.1
. exact hββ.2
rw [β hxy] at hββ
linarith
have hβ: β x:β , 0 < x β Β¬ x * f x < 1 := by
by_contra! hc
let β¨x,hxpβ© := hc
cases' hxp with hxp hβ
let dβ:β := 1 - x * f x
have hdβ : x * f x = 1 - dβ := by exact (sub_sub_self 1 (x * f x)).symm
let z:β := x + dβ / f x
have hz: z = x + dβ / f x := by exact rfl
have hzp: 0 < z := by
refine add_pos hxp ?_
refine div_pos ?_ ?_
. exact sub_pos.mpr hβ
. exact hfp x hxp
have hxz: Β¬ x = z := by
by_contra! hczβ
rw [β hczβ] at hz
have hczβ: 0 < dβ / f x := by
refine div_pos ?_ (hfp x hxp)
exact sub_pos.mpr hβ
linarith
have hβ: Β¬ (x * f z + z * f x β€ 2) := by
have hββ: x * f z + z * f x β€ 2 β x = z := by
exact hβ x z { left := hxp, right := hzp }
exact mt hββ hxz
have hβ
: x * f z < 1 := by
suffices hβ
β: z * f z β€ 1 by
refine lt_of_lt_of_le ?_ hβ
β
refine (mul_lt_mul_right (hfp z hzp)).mpr ?_
rw [hz]
refine lt_add_of_pos_right x ?_
refine div_pos ?_ (hfp x hxp)
exact sub_pos.mpr hβ
exact hβ z hzp
have hβ: x * f z + z * f x < 2 := by
suffices hβ: z * f x β€ 1 by
linarith
rw [hz, add_mul, hdβ]
rw [div_mul_comm dβ (f x) (f x)]
rw [div_self]
. rw [one_mul, sub_add_cancel]
. exact Ne.symm (ne_of_lt (hfp x hxp))
linarith
intros x hxp
have hβ: x * f x β€ 1 := by exact hβ x hxp
have hβ
: Β¬ x * f x < 1 := by exact hβ x hxp
refine eq_div_of_mul_eq ?_ ?_
. exact ne_of_gt hxp
. push_neg at hβ
linarith
|