|
import Mathlib |
|
|
|
open Real |
|
set_option linter.unusedVariables.analyzeTactics true |
|
|
|
|
|
lemma sin_mul_cos |
|
(x y : β) : |
|
Real.sin x * Real.cos y = (sin (x + y) + sin (x - y)) / 2 := by |
|
rw [sin_add, sin_sub] |
|
simp |
|
|
|
theorem imo_1963_p5 : |
|
Real.cos (Ο / 7) - Real.cos (2 * Ο / 7) + Real.cos (3 * Ο / 7) = 1 / 2 := by |
|
let S:β := Real.cos (Ο / 7) - Real.cos (2 * Ο / 7) + Real.cos (3 * Ο / 7) |
|
have hβ: Real.sin (Ο / 7) * (S * 2) = Real.sin (Ο / 7) := by |
|
ring_nf |
|
have hββ: sin (Ο * (1 / 7)) * cos (Ο * (1 / 7)) * 2 = sin (2 * (Ο * (1 / 7))) := by |
|
rw [Real.sin_two_mul] |
|
exact (mul_rotate 2 (sin (Ο * (1 / 7))) (cos (Ο * (1 / 7)))).symm |
|
rw [hββ, sin_mul_cos, sin_mul_cos] |
|
rw [β mul_add, β mul_sub, β mul_add, β mul_sub] |
|
norm_num |
|
ring_nf |
|
have hββ: -sin (Ο * (3 / 7)) + sin (Ο * (4 / 7)) = 0 := by |
|
rw [add_comm] |
|
refine add_neg_eq_of_eq_add ?_ |
|
simp |
|
refine sin_eq_sin_iff.mpr ?_ |
|
use 0 |
|
right |
|
ring |
|
linarith |
|
have hβ: S = 1 / 2 := by |
|
refine eq_div_of_mul_eq (by norm_num) ?_ |
|
nth_rewrite 2 [β mul_one (sin (Ο / 7))] at hβ |
|
refine (mul_right_inj' ?_).mp hβ |
|
refine sin_ne_zero_iff.mpr ?_ |
|
intro n |
|
ring_nf |
|
rw [mul_comm] |
|
simp |
|
push_neg |
|
constructor |
|
. by_contra! hcβ |
|
have hcβ: 7 * (βn:β) = 1 := by |
|
rw [mul_comm] |
|
exact (mul_eq_one_iff_eq_invβ (by norm_num)).mpr hcβ |
|
norm_cast at hcβ |
|
have gβ: 0 < n := by linarith |
|
linarith |
|
. exact pi_ne_zero |
|
exact hβ |
|
|