IMO-Steps / imo_proofs /imo_1963_p5.lean
roozbeh-yz's picture
Upload 42 files
1c3ffd8 verified
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₁