|
import Mathlib |
|
set_option linter.unusedVariables.analyzeTactics true |
|
|
|
open Real |
|
|
|
|
|
theorem imo_1968_p5_1 |
|
(a : β) |
|
(f : β β β) |
|
(hβ : 0 < a) |
|
(hβ : β x, f (x + a) = 1 / 2 + Real.sqrt (f x - (f x)^2)) |
|
(hβ : β x, 1 / 2 β€ f x β§ f x β€ 1) : |
|
β b > 0, β x, f (x + b) = f x := by |
|
use (2 * a) |
|
constructor |
|
. refine mul_pos (by norm_num) hβ |
|
. intro x |
|
have hβ: f (x + a) = 1 / 2 + Real.sqrt (f x - (f x)^2) := by |
|
exact hβ x |
|
have hβ: f (x + 2 * a) = 1 / 2 + Real.sqrt (f (x + a) - (f (x + a)^2)) := by |
|
rw [two_mul, β add_assoc] |
|
exact hβ (x + a) |
|
have hβ
: f (x + a) - (f (x + a) ^ 2) = (f x - 1 / 2) ^ 2 := by |
|
have hβ
β: 0 β€ f x - (f x)^2 := by |
|
refine sub_nonneg_of_le ?_ |
|
rw [pow_two] |
|
nth_rw 3 [β mul_one (f x)] |
|
refine (mul_le_mul_left ?_).mpr ?_ |
|
. linarith [hβ x] |
|
. exact (hβ x).2 |
|
rw [hβ, add_sq, sub_sq, sq_sqrt hβ
β] |
|
ring_nf |
|
rw [hβ
, sqrt_sq ?_] at hβ |
|
. linarith |
|
. have hβ: 1 / 2 β€ f x := by |
|
exact (hβ x).1 |
|
linarith [hβ] |
|
|