l3lab/ntp-mathlib huggingface dataset:
/-- Characterization of multiplicative inverse -/
theorem inv_spec [Nonempty N] {i} {p : Ω^ N X x} : ((⟦p⟧)⁻¹ : HomotopyGroup N X x) = ⟦symmAt i p⟧ :=
  by rw [symmAt_indep _ p, ← fromLoop_symm_toLoop]; apply Quotient.sound; 

Proof state:
case a
N : Type u_1
X : Type u_2
inst✝² : TopologicalSpace X
x : X
inst✝¹ : DecidableEq N
inst✝ : Nonempty N
i : N
p : ↑(Ω^ N X x)
⊢ (loopHomeo (Classical.arbitrary N)).symm (Path.symm ((loopHomeo (Classical.arbitrary N)).toEquiv p)) ≈
    fromLoop ?m.905414 (Path.symm (toLoop ?m.905414 p))
N : Type u_1
X : Type u_2
inst✝² : TopologicalSpace X
x : X
inst✝¹ : DecidableEq N
inst✝ : Nonempty N
i : N
p : ↑(Ω^ N X x)
⊢ N

Next tactic:
rfl
/-- Multiplication on `HomotopyGroup N X x` is commutative for nontrivial `N`.
  In particular, multiplication on `π_(n+2)` is commutative. -/
instance commGroup [Nontrivial N] : CommGroup (HomotopyGroup N X x) :=
  let h := exists_ne (Classical.arbitrary N)
  @EckmannHilton.commGroup (HomotopyGroup N X x) _ 1 (isUnital_auxGroup <| Classical.choose h) _
    (by
      

Proof state:
N : Type u_1
X : Type u_2
inst✝² : TopologicalSpace X
x : X
inst✝¹ : DecidableEq N
inst✝ : Nontrivial N
h : ∃ y, y ≠ Classical.arbitrary N := exists_ne (Classical.arbitrary N)
⊢ ∀ (a b c d : HomotopyGroup N X x), Mul.mul (a * b) (c * d) = Mul.mul a c * Mul.mul b d

Next tactic:
rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ ⟨d⟩
/-- Multiplication on `HomotopyGroup N X x` is commutative for nontrivial `N`.
  In particular, multiplication on `π_(n+2)` is commutative. -/
instance commGroup [Nontrivial N] : CommGroup (HomotopyGroup N X x) :=
  let h := exists_ne (Classical.arbitrary N)
  @EckmannHilton.commGroup (HomotopyGroup N X x) _ 1 (isUnital_auxGroup <| Classical.choose h) _
    (by
      rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ ⟨d⟩
      

Proof state:
case mk.mk.mk.mk
N : Type u_1
X : Type u_2
inst✝² : TopologicalSpace X
x : X
inst✝¹ : DecidableEq N
inst✝ : Nontrivial N
h : ∃ y, y ≠ Classical.arbitrary N := exists_ne (Classical.arbitrary N)
a✝ : HomotopyGroup N X x
a : ↑(Ω^ N X x)
b✝ : HomotopyGroup N X x
b : ↑(Ω^ N X x)
c✝ : HomotopyGroup N X x
c : ↑(Ω^ N X x)
d✝ : HomotopyGroup N X x
d : ↑(Ω^ N X x)
⊢ Mul.mul (Quot.mk Setoid.r a * Quot.mk Setoid.r b) (Quot.mk Setoid.r c * Quot.mk Setoid.r d) =
    Mul.mul (Quot.mk Setoid.r a) (Quot.mk Setoid.r c) * Mul.mul (Quot.mk Setoid.r b) (Quot.mk Setoid.r d)

Next tactic:
apply congr_arg Quotient.mk'
/-- Multiplication on `HomotopyGroup N X x` is commutative for nontrivial `N`.
  In particular, multiplication on `π_(n+2)` is commutative. -/
instance commGroup [Nontrivial N] : CommGroup (HomotopyGroup N X x) :=
  let h := exists_ne (Classical.arbitrary N)
  @EckmannHilton.commGroup (HomotopyGroup N X x) _ 1 (isUnital_auxGroup <| Classical.choose h) _
    (by
      rintro ⟨a⟩ ⟨b⟩ ⟨c⟩ ⟨d⟩
      apply congr_arg Quotient.mk'
      

Proof state:
case mk.mk.mk.mk
N : Type u_1
X : Type u_2
inst✝² : TopologicalSpace X
x : X
inst✝¹ : DecidableEq N
inst✝ : Nontrivial N
h : ∃ y, y ≠ Classical.arbitrary N := exists_ne (Classical.arbitrary N)
a✝ : HomotopyGroup N X x
a : ↑(Ω^ N X x)
b✝ : HomotopyGroup N X x
b : ↑(Ω^ N X x)
c✝ : HomotopyGroup N X x
c : ↑(Ω^ N X x)
d✝ : HomotopyGroup N X x
d : ↑(Ω^ N X x)
⊢ (loopHomeo (Classical.choose h)).symm
      (Path.trans
        ((loopHomeo (Classical.choose h)).toEquiv
          ((loopHomeo (Classical.arbitrary N)).symm
            (Path.trans ((loopHomeo (Classical.arbitrary N)).toEquiv d)
              ((loopHomeo (Classical.arbitrary N)).toEquiv c))))
        ((loopHomeo (Classical.choose h)).toEquiv
          ((loopHomeo (Classical.arbitrary N)).symm
            (Path.trans ((loopHomeo (Classical.arbitrary N)).toEquiv b)
              ((loopHomeo (Classical.arbitrary N)).toEquiv a))))) =
    (loopHomeo (Classical.arbitrary N)).symm
      (Path.trans
        ((loopHomeo (Classical.arbitrary N)).toEquiv
          ((loopHomeo (Classical.choose h)).symm
            (Path.trans ((loopHomeo (Classical.choose h)).toEquiv d) ((loopHomeo (Classical.choose h)).toEquiv b))))
        ((loopHomeo (Classical.arbitrary N)).toEquiv
          ((loopHomeo (Classical.choose h)).symm
            (Path.trans ((loopHomeo (Classical.choose h)).toEquiv c) ((loopHomeo (Classical.choose h)).toEquiv a)))))

Next tactic:
simp only [fromLoop_trans_toLoop, transAt_distrib <| Classical.choose_spec h, coe_toEquiv,
        loopHomeo_apply, coe_symm_toEquiv, loopHomeo_symm_apply]
@[continuity]
theorem continuous_sin : Continuous sin := by
  

Proof state:
⊢ Continuous sin

Next tactic:
change Continuous fun z => (exp (-z * I) - exp (z * I)) * I / 2
@[continuity]
theorem continuous_sin : Continuous sin := by
  change Continuous fun z => (exp (-z * I) - exp (z * I)) * I / 2
  

Proof state:
⊢ Continuous fun z => (cexp (-z * I) - cexp (z * I)) * I / 2

Next tactic:
continuity
@[continuity]
theorem continuous_cos : Continuous cos := by
  

Proof state:
⊢ Continuous cos

Next tactic:
change Continuous fun z => (exp (z * I) + exp (-z * I)) / 2
@[continuity]
theorem continuous_cos : Continuous cos := by
  change Continuous fun z => (exp (z * I) + exp (-z * I)) / 2
  

Proof state:
⊢ Continuous fun z => (cexp (z * I) + cexp (-z * I)) / 2

Next tactic:
continuity
@[continuity]
theorem continuous_sinh : Continuous sinh := by
  

Proof state:
⊢ Continuous sinh

Next tactic:
change Continuous fun z => (exp z - exp (-z)) / 2
@[continuity]
theorem continuous_sinh : Continuous sinh := by
  change Continuous fun z => (exp z - exp (-z)) / 2
  

Proof state:
⊢ Continuous fun z => (cexp z - cexp (-z)) / 2

Next tactic:
continuity
@[continuity]
theorem continuous_cosh : Continuous cosh := by
  

Proof state:
⊢ Continuous cosh

Next tactic:
change Continuous fun z => (exp z + exp (-z)) / 2
@[continuity]
theorem continuous_cosh : Continuous cosh := by
  change Continuous fun z => (exp z + exp (-z)) / 2
  

Proof state:
⊢ Continuous fun z => (cexp z + cexp (-z)) / 2

Next tactic:
continuity
theorem exists_cos_eq_zero : 0 ∈ cos '' Icc (1 : ℝ) 2 :=
  intermediate_value_Icc' (by 

Proof state:
⊢ 1 ≤ 2

Next tactic:
norm_num
@[simp]
theorem cos_pi_div_two : cos (π / 2) = 0 := by
  

Proof state:
⊢ cos (π / 2) = 0

Next tactic:
rw [Real.pi, mul_div_cancel_left _ (two_ne_zero' ℝ)]
@[simp]
theorem cos_pi_div_two : cos (π / 2) = 0 := by
  rw [Real.pi, mul_div_cancel_left _ (two_ne_zero' ℝ)]
  

Proof state:
⊢ cos (choose exists_cos_eq_zero) = 0

Next tactic:
exact (Classical.choose_spec exists_cos_eq_zero).2
theorem one_le_pi_div_two : (1 : ℝ) ≤ π / 2 := by
  

Proof state:
⊢ 1 ≤ π / 2

Next tactic:
rw [Real.pi, mul_div_cancel_left _ (two_ne_zero' ℝ)]
theorem one_le_pi_div_two : (1 : ℝ) ≤ π / 2 := by
  rw [Real.pi, mul_div_cancel_left _ (two_ne_zero' ℝ)]
  

Proof state:
⊢ 1 ≤ choose exists_cos_eq_zero

Next tactic:
exact (Classical.choose_spec exists_cos_eq_zero).1.1
theorem pi_div_two_le_two : π / 2 ≤ 2 := by
  

Proof state:
⊢ π / 2 ≤ 2

Next tactic:
rw [Real.pi, mul_div_cancel_left _ (two_ne_zero' ℝ)]
theorem pi_div_two_le_two : π / 2 ≤ 2 := by
  rw [Real.pi, mul_div_cancel_left _ (two_ne_zero' ℝ)]
  

Proof state:
⊢ choose exists_cos_eq_zero ≤ 2

Next tactic:
exact (Classical.choose_spec exists_cos_eq_zero).1.2
theorem two_le_pi : (2 : ℝ) ≤ π :=
  (div_le_div_right (show (0 : ℝ) < 2 by 

Proof state:
⊢ 0 < 2

Next tactic:
norm_num
theorem two_le_pi : (2 : ℝ) ≤ π :=
  (div_le_div_right (show (0 : ℝ) < 2 by norm_num)).1
    (by 

Proof state:
⊢ 2 / 2 ≤ π / 2

Next tactic:
rw [div_self (two_ne_zero' ℝ)]
theorem two_le_pi : (2 : ℝ) ≤ π :=
  (div_le_div_right (show (0 : ℝ) < 2 by norm_num)).1
    (by rw [div_self (two_ne_zero' ℝ)]; 

Proof state:
⊢ 1 ≤ π / 2

Next tactic:
exact one_le_pi_div_two
theorem pi_le_four : π ≤ 4 :=
  (div_le_div_right (show (0 : ℝ) < 2 by 

Proof state:
⊢ 0 < 2

Next tactic:
norm_num
theorem pi_le_four : π ≤ 4 :=
  (div_le_div_right (show (0 : ℝ) < 2 by norm_num)).1
    (calc
      π / 2 ≤ 2 := pi_div_two_le_two
      _ = 4 / 2 := by 

Proof state:
⊢ 2 = 4 / 2

Next tactic:
norm_num
theorem pi_pos : 0 < π :=
  lt_of_lt_of_le (by 

Proof state:
⊢ 0 < 2

Next tactic:
norm_num
theorem two_pi_pos : 0 < 2 * π := by 

Proof state:
⊢ 0 < 2 * π

Next tactic:
linarith [pi_pos]
@[simp]
theorem sin_pi : sin π = 0 := by
  

Proof state:
⊢ sin π = 0

Next tactic:
rw [← mul_div_cancel_left π (two_ne_zero' ℝ), two_mul, add_div, sin_add, cos_pi_div_two]
@[simp]
theorem sin_pi : sin π = 0 := by
  rw [← mul_div_cancel_left π (two_ne_zero' ℝ), two_mul, add_div, sin_add, cos_pi_div_two]; 

Proof state:
⊢ sin (π / 2) * 0 + 0 * sin (π / 2) = 0

Next tactic:
simp
@[simp]
theorem cos_pi : cos π = -1 := by
  

Proof state:
⊢ cos π = -1

Next tactic:
rw [← mul_div_cancel_left π (two_ne_zero' ℝ), mul_div_assoc, cos_two_mul, cos_pi_div_two]
@[simp]
theorem cos_pi : cos π = -1 := by
  rw [← mul_div_cancel_left π (two_ne_zero' ℝ), mul_div_assoc, cos_two_mul, cos_pi_div_two]
  

Proof state:
⊢ 2 * 0 ^ 2 - 1 = -1

Next tactic:
norm_num
@[simp]
theorem sin_two_pi : sin (2 * π) = 0 := by 

Proof state:
⊢ sin (2 * π) = 0

Next tactic:
simp [two_mul, sin_add]
@[simp]
theorem cos_two_pi : cos (2 * π) = 1 := by 

Proof state:
⊢ cos (2 * π) = 1

Next tactic:
simp [two_mul, cos_add]
theorem sin_antiperiodic : Function.Antiperiodic sin π := by 

Proof state:
⊢ Function.Antiperiodic sin π

Next tactic:
simp [sin_add]
theorem cos_antiperiodic : Function.Antiperiodic cos π := by 

Proof state:
⊢ Function.Antiperiodic cos π

Next tactic:
simp [cos_add]
theorem cos_nat_mul_two_pi_add_pi (n : ℕ) : cos (n * (2 * π) + π) = -1 := by
  

Proof state:
n : ℕ
⊢ cos (↑n * (2 * π) + π) = -1

Next tactic:
simpa only [cos_zero] using (cos_periodic.nat_mul n).add_antiperiod_eq cos_antiperiodic
theorem cos_int_mul_two_pi_add_pi (n : ℤ) : cos (n * (2 * π) + π) = -1 := by
  

Proof state:
n : ℤ
⊢ cos (↑n * (2 * π) + π) = -1

Next tactic:
simpa only [cos_zero] using (cos_periodic.int_mul n).add_antiperiod_eq cos_antiperiodic
theorem cos_nat_mul_two_pi_sub_pi (n : ℕ) : cos (n * (2 * π) - π) = -1 := by
  

Proof state:
n : ℕ
⊢ cos (↑n * (2 * π) - π) = -1

Next tactic:
simpa only [cos_zero] using (cos_periodic.nat_mul n).sub_antiperiod_eq cos_antiperiodic
theorem cos_int_mul_two_pi_sub_pi (n : ℤ) : cos (n * (2 * π) - π) = -1 := by
  

Proof state:
n : ℤ
⊢ cos (↑n * (2 * π) - π) = -1

Next tactic:
simpa only [cos_zero] using (cos_periodic.int_mul n).sub_antiperiod_eq cos_antiperiodic
theorem sin_pos_of_pos_of_lt_pi {x : ℝ} (h0x : 0 < x) (hxp : x < π) : 0 < sin x :=
  if hx2 : x ≤ 2 then sin_pos_of_pos_of_le_two h0x hx2
  else
    have : (2 : ℝ) + 2 = 4 := by 

Proof state:
x : ℝ
h0x : 0 < x
hxp : x < π
hx2 : ¬x ≤ 2
⊢ 2 + 2 = 4

Next tactic:
norm_num
theorem sin_nonneg_of_mem_Icc {x : ℝ} (hx : x ∈ Icc 0 π) : 0 ≤ sin x := by
  

Proof state:
x : ℝ
hx : x ∈ Icc 0 π
⊢ 0 ≤ sin x

Next tactic:
rw [← closure_Ioo pi_ne_zero.symm] at hx
theorem sin_nonneg_of_mem_Icc {x : ℝ} (hx : x ∈ Icc 0 π) : 0 ≤ sin x := by
  rw [← closure_Ioo pi_ne_zero.symm] at hx
  

Proof state:
x : ℝ
hx : x ∈ closure (Ioo 0 π)
⊢ 0 ≤ sin x

Next tactic:
exact
    closure_lt_subset_le continuous_const continuous_sin
      (closure_mono (fun y => sin_pos_of_mem_Ioo) hx)
@[simp]
theorem sin_pi_div_two : sin (π / 2) = 1 :=
  have : sin (π / 2) = 1 ∨ sin (π / 2) = -1 := by
    

Proof state:
⊢ sin (π / 2) = 1 ∨ sin (π / 2) = -1

Next tactic:
simpa [sq, mul_self_eq_one_iff] using sin_sq_add_cos_sq (π / 2)
@[simp]
theorem sin_pi_div_two : sin (π / 2) = 1 :=
  have : sin (π / 2) = 1 ∨ sin (π / 2) = -1 := by
    simpa [sq, mul_self_eq_one_iff] using sin_sq_add_cos_sq (π / 2)
  this.resolve_right fun h =>
    show ¬(0 : ℝ) < -1 by 

Proof state:
this : sin (π / 2) = 1 ∨ sin (π / 2) = -1
h : sin (π / 2) = -1
⊢ ¬0 < -1

Next tactic:
norm_num
theorem sin_add_pi_div_two (x : ℝ) : sin (x + π / 2) = cos x := by 

Proof state:
x : ℝ
⊢ sin (x + π / 2) = cos x

Next tactic:
simp [sin_add]
theorem sin_sub_pi_div_two (x : ℝ) : sin (x - π / 2) = -cos x := by 

Proof state:
x : ℝ
⊢ sin (x - π / 2) = -cos x

Next tactic:
simp [sub_eq_add_neg, sin_add]
theorem sin_pi_div_two_sub (x : ℝ) : sin (π / 2 - x) = cos x := by 

Proof state:
x : ℝ
⊢ sin (π / 2 - x) = cos x

Next tactic:
simp [sub_eq_add_neg, sin_add]
theorem cos_add_pi_div_two (x : ℝ) : cos (x + π / 2) = -sin x := by 

Proof state:
x : ℝ
⊢ cos (x + π / 2) = -sin x

Next tactic:
simp [cos_add]
theorem cos_sub_pi_div_two (x : ℝ) : cos (x - π / 2) = sin x := by 

Proof state:
x : ℝ
⊢ cos (x - π / 2) = sin x

Next tactic:
simp [sub_eq_add_neg, cos_add]
theorem cos_pi_div_two_sub (x : ℝ) : cos (π / 2 - x) = sin x := by
  

Proof state:
x : ℝ
⊢ cos (π / 2 - x) = sin x

Next tactic:
rw [← cos_neg, neg_sub, cos_sub_pi_div_two]
theorem cos_pos_of_mem_Ioo {x : ℝ} (hx : x ∈ Ioo (-(π / 2)) (π / 2)) : 0 < cos x :=
  sin_add_pi_div_two x ▸ sin_pos_of_mem_Ioo ⟨by 

Proof state:
x : ℝ
hx : x ∈ Ioo (-(π / 2)) (π / 2)
⊢ 0 < x + π / 2

Next tactic:
linarith [hx.1]
theorem cos_pos_of_mem_Ioo {x : ℝ} (hx : x ∈ Ioo (-(π / 2)) (π / 2)) : 0 < cos x :=
  sin_add_pi_div_two x ▸ sin_pos_of_mem_Ioo ⟨by linarith [hx.1], by 

Proof state:
x : ℝ
hx : x ∈ Ioo (-(π / 2)) (π / 2)
⊢ x + π / 2 < π

Next tactic:
linarith [hx.2]
theorem cos_nonneg_of_mem_Icc {x : ℝ} (hx : x ∈ Icc (-(π / 2)) (π / 2)) : 0 ≤ cos x :=
  sin_add_pi_div_two x ▸ sin_nonneg_of_mem_Icc ⟨by 

Proof state:
x : ℝ
hx : x ∈ Icc (-(π / 2)) (π / 2)
⊢ 0 ≤ x + π / 2

Next tactic:
linarith [hx.1]
theorem cos_nonneg_of_mem_Icc {x : ℝ} (hx : x ∈ Icc (-(π / 2)) (π / 2)) : 0 ≤ cos x :=
  sin_add_pi_div_two x ▸ sin_nonneg_of_mem_Icc ⟨by linarith [hx.1], by 

Proof state:
x : ℝ
hx : x ∈ Icc (-(π / 2)) (π / 2)
⊢ x + π / 2 ≤ π

Next tactic:
linarith [hx.2]
theorem cos_neg_of_pi_div_two_lt_of_lt {x : ℝ} (hx₁ : π / 2 < x) (hx₂ : x < π + π / 2) :
    cos x < 0 :=
  neg_pos.1 <| cos_pi_sub x ▸ cos_pos_of_mem_Ioo ⟨by 

Proof state:
x : ℝ
hx₁ : π / 2 < x
hx₂ : x < π + π / 2
⊢ -(π / 2) < π - x

Next tactic:
linarith
theorem cos_neg_of_pi_div_two_lt_of_lt {x : ℝ} (hx₁ : π / 2 < x) (hx₂ : x < π + π / 2) :
    cos x < 0 :=
  neg_pos.1 <| cos_pi_sub x ▸ cos_pos_of_mem_Ioo ⟨by linarith, by 

Proof state:
x : ℝ
hx₁ : π / 2 < x
hx₂ : x < π + π / 2
⊢ π - x < π / 2

Next tactic:
linarith
theorem cos_nonpos_of_pi_div_two_le_of_le {x : ℝ} (hx₁ : π / 2 ≤ x) (hx₂ : x ≤ π + π / 2) :
    cos x ≤ 0 :=
  neg_nonneg.1 <| cos_pi_sub x ▸ cos_nonneg_of_mem_Icc ⟨by 

Proof state:
x : ℝ
hx₁ : π / 2 ≤ x
hx₂ : x ≤ π + π / 2
⊢ -(π / 2) ≤ π - x

Next tactic:
linarith
theorem cos_nonpos_of_pi_div_two_le_of_le {x : ℝ} (hx₁ : π / 2 ≤ x) (hx₂ : x ≤ π + π / 2) :
    cos x ≤ 0 :=
  neg_nonneg.1 <| cos_pi_sub x ▸ cos_nonneg_of_mem_Icc ⟨by linarith, by 

Proof state:
x : ℝ
hx₁ : π / 2 ≤ x
hx₂ : x ≤ π + π / 2
⊢ π - x ≤ π / 2

Next tactic:
linarith
theorem sin_eq_sqrt_one_sub_cos_sq {x : ℝ} (hl : 0 ≤ x) (hu : x ≤ π) :
    sin x = sqrt (1 - cos x ^ 2) := by
  

Proof state:
x : ℝ
hl : 0 ≤ x
hu : x ≤ π
⊢ sin x = sqrt (1 - cos x ^ 2)

Next tactic:
rw [← abs_sin_eq_sqrt_one_sub_cos_sq, abs_of_nonneg (sin_nonneg_of_nonneg_of_le_pi hl hu)]
theorem cos_eq_sqrt_one_sub_sin_sq {x : ℝ} (hl : -(π / 2) ≤ x) (hu : x ≤ π / 2) :
    cos x = sqrt (1 - sin x ^ 2) := by
  

Proof state:
x : ℝ
hl : -(π / 2) ≤ x
hu : x ≤ π / 2
⊢ cos x = sqrt (1 - sin x ^ 2)

Next tactic:
rw [← abs_cos_eq_sqrt_one_sub_sin_sq, abs_of_nonneg (cos_nonneg_of_mem_Icc ⟨hl, hu⟩)]
lemma cos_half {x : ℝ} (hl : -π ≤ x) (hr : x ≤ π) : cos (x / 2) = sqrt ((1 + cos x) / 2) := by
  

Proof state:
x : ℝ
hl : -π ≤ x
hr : x ≤ π
⊢ cos (x / 2) = sqrt ((1 + cos x) / 2)

Next tactic:
have : 0 ≤ cos (x / 2) := cos_nonneg_of_mem_Icc <| by constructor <;> linarith
lemma cos_half {x : ℝ} (hl : -π ≤ x) (hr : x ≤ π) : cos (x / 2) = sqrt ((1 + cos x) / 2) := by
  have : 0 ≤ cos (x / 2) := cos_nonneg_of_mem_Icc <| by 

Proof state:
x : ℝ
hl : -π ≤ x
hr : x ≤ π
⊢ x / 2 ∈ Icc (-(π / 2)) (π / 2)

Next tactic:
constructor
lemma cos_half {x : ℝ} (hl : -π ≤ x) (hr : x ≤ π) : cos (x / 2) = sqrt ((1 + cos x) / 2) := by
  have : 0 ≤ cos (x / 2) := cos_nonneg_of_mem_Icc <| by constructor <;> 

Proof state:
case left
x : ℝ
hl : -π ≤ x
hr : x ≤ π
⊢ -(π / 2) ≤ x / 2

Next tactic:
linarith
lemma cos_half {x : ℝ} (hl : -π ≤ x) (hr : x ≤ π) : cos (x / 2) = sqrt ((1 + cos x) / 2) := by
  have : 0 ≤ cos (x / 2) := cos_nonneg_of_mem_Icc <| by constructor <;> 

Proof state:
case right
x : ℝ
hl : -π ≤ x
hr : x ≤ π
⊢ x / 2 ≤ π / 2

Next tactic:
linarith
lemma cos_half {x : ℝ} (hl : -π ≤ x) (hr : x ≤ π) : cos (x / 2) = sqrt ((1 + cos x) / 2) := by
  have : 0 ≤ cos (x / 2) := cos_nonneg_of_mem_Icc <| by constructor <;> linarith
  

Proof state:
x : ℝ
hl : -π ≤ x
hr : x ≤ π
this : 0 ≤ cos (x / 2)
⊢ cos (x / 2) = sqrt ((1 + cos x) / 2)

Next tactic:
rw [← sqrt_sq this, cos_sq, add_div, two_mul, add_halves]
lemma abs_sin_half (x : ℝ) : |sin (x / 2)| = sqrt ((1 - cos x) / 2) := by
  

Proof state:
x : ℝ
⊢ |sin (x / 2)| = sqrt ((1 - cos x) / 2)

Next tactic:
rw [← sqrt_sq_eq_abs, sin_sq_eq_half_sub, two_mul, add_halves, sub_div]
lemma sin_half_eq_sqrt {x : ℝ} (hl : 0 ≤ x) (hr : x ≤ 2 * π) :
    sin (x / 2) = sqrt ((1 - cos x) / 2) := by
  

Proof state:
x : ℝ
hl : 0 ≤ x
hr : x ≤ 2 * π
⊢ sin (x / 2) = sqrt ((1 - cos x) / 2)

Next tactic:
rw [← abs_sin_half, abs_of_nonneg]
lemma sin_half_eq_sqrt {x : ℝ} (hl : 0 ≤ x) (hr : x ≤ 2 * π) :
    sin (x / 2) = sqrt ((1 - cos x) / 2) := by
  rw [← abs_sin_half, abs_of_nonneg]
  

Proof state:
x : ℝ
hl : 0 ≤ x
hr : x ≤ 2 * π
⊢ 0 ≤ sin (x / 2)

Next tactic:
apply sin_nonneg_of_nonneg_of_le_pi
lemma sin_half_eq_sqrt {x : ℝ} (hl : 0 ≤ x) (hr : x ≤ 2 * π) :
    sin (x / 2) = sqrt ((1 - cos x) / 2) := by
  rw [← abs_sin_half, abs_of_nonneg]
  apply sin_nonneg_of_nonneg_of_le_pi <;> 

Proof state:
case h0x
x : ℝ
hl : 0 ≤ x
hr : x ≤ 2 * π
⊢ 0 ≤ x / 2

Next tactic:
linarith
lemma sin_half_eq_sqrt {x : ℝ} (hl : 0 ≤ x) (hr : x ≤ 2 * π) :
    sin (x / 2) = sqrt ((1 - cos x) / 2) := by
  rw [← abs_sin_half, abs_of_nonneg]
  apply sin_nonneg_of_nonneg_of_le_pi <;> 

Proof state:
case hxp
x : ℝ
hl : 0 ≤ x
hr : x ≤ 2 * π
⊢ x / 2 ≤ π

Next tactic:
linarith
lemma sin_half_eq_neg_sqrt {x : ℝ} (hl : -(2 * π) ≤ x) (hr : x ≤ 0) :
    sin (x / 2) = -sqrt ((1 - cos x) / 2) := by
  

Proof state:
x : ℝ
hl : -(2 * π) ≤ x
hr : x ≤ 0
⊢ sin (x / 2) = -sqrt ((1 - cos x) / 2)

Next tactic:
rw [← abs_sin_half, abs_of_nonpos, neg_neg]
lemma sin_half_eq_neg_sqrt {x : ℝ} (hl : -(2 * π) ≤ x) (hr : x ≤ 0) :
    sin (x / 2) = -sqrt ((1 - cos x) / 2) := by
  rw [← abs_sin_half, abs_of_nonpos, neg_neg]
  

Proof state:
x : ℝ
hl : -(2 * π) ≤ x
hr : x ≤ 0
⊢ sin (x / 2) ≤ 0

Next tactic:
apply sin_nonpos_of_nonnpos_of_neg_pi_le
lemma sin_half_eq_neg_sqrt {x : ℝ} (hl : -(2 * π) ≤ x) (hr : x ≤ 0) :
    sin (x / 2) = -sqrt ((1 - cos x) / 2) := by
  rw [← abs_sin_half, abs_of_nonpos, neg_neg]
  apply sin_nonpos_of_nonnpos_of_neg_pi_le <;> 

Proof state:
case hx0
x : ℝ
hl : -(2 * π) ≤ x
hr : x ≤ 0
⊢ x / 2 ≤ 0

Next tactic:
linarith
lemma sin_half_eq_neg_sqrt {x : ℝ} (hl : -(2 * π) ≤ x) (hr : x ≤ 0) :
    sin (x / 2) = -sqrt ((1 - cos x) / 2) := by
  rw [← abs_sin_half, abs_of_nonpos, neg_neg]
  apply sin_nonpos_of_nonnpos_of_neg_pi_le <;> 

Proof state:
case hpx
x : ℝ
hl : -(2 * π) ≤ x
hr : x ≤ 0
⊢ -π ≤ x / 2

Next tactic:
linarith
theorem sin_eq_zero_iff_of_lt_of_lt {x : ℝ} (hx₁ : -π < x) (hx₂ : x < π) : sin x = 0 ↔ x = 0 :=
  ⟨fun h => by
    

Proof state:
x : ℝ
hx₁ : -π < x
hx₂ : x < π
h : sin x = 0
⊢ x = 0

Next tactic:
contrapose! h
theorem sin_eq_zero_iff_of_lt_of_lt {x : ℝ} (hx₁ : -π < x) (hx₂ : x < π) : sin x = 0 ↔ x = 0 :=
  ⟨fun h => by
    contrapose! h
    

Proof state:
x : ℝ
hx₁ : -π < x
hx₂ : x < π
h : x ≠ 0
⊢ sin x ≠ 0

Next tactic:
cases h.lt_or_lt with
    | inl h0 => exact (sin_neg_of_neg_of_neg_pi_lt h0 hx₁).ne
    | inr h0 => exact (sin_pos_of_pos_of_lt_pi h0 hx₂).ne'
theorem sin_eq_zero_iff_of_lt_of_lt {x : ℝ} (hx₁ : -π < x) (hx₂ : x < π) : sin x = 0 ↔ x = 0 :=
  ⟨fun h => by
    contrapose! h
    

Proof state:
x : ℝ
hx₁ : -π < x
hx₂ : x < π
h : x ≠ 0
x✝ : x < 0 ∨ 0 < x
⊢ sin x ≠ 0

Next tactic:
cases h.lt_or_lt with
    | inl h0 => exact (sin_neg_of_neg_of_neg_pi_lt h0 hx₁).ne
    | inr h0 => exact (sin_pos_of_pos_of_lt_pi h0 hx₂).ne'
theorem sin_eq_zero_iff_of_lt_of_lt {x : ℝ} (hx₁ : -π < x) (hx₂ : x < π) : sin x = 0 ↔ x = 0 :=
  ⟨fun h => by
    contrapose! h
    cases h.lt_or_lt with
    

Proof state:
case inl
x : ℝ
hx₁ : -π < x
hx₂ : x < π
h : x ≠ 0
h0 : x < 0
⊢ sin x ≠ 0

Next tactic:
| inl h0 => exact (sin_neg_of_neg_of_neg_pi_lt h0 hx₁).ne
theorem sin_eq_zero_iff_of_lt_of_lt {x : ℝ} (hx₁ : -π < x) (hx₂ : x < π) : sin x = 0 ↔ x = 0 :=
  ⟨fun h => by
    contrapose! h
    cases h.lt_or_lt with
    | inl h0 => 

Proof state:
case inl
x : ℝ
hx₁ : -π < x
hx₂ : x < π
h : x ≠ 0
h0 : x < 0
⊢ sin x ≠ 0

Next tactic:
exact (sin_neg_of_neg_of_neg_pi_lt h0 hx₁).ne
theorem sin_eq_zero_iff_of_lt_of_lt {x : ℝ} (hx₁ : -π < x) (hx₂ : x < π) : sin x = 0 ↔ x = 0 :=
  ⟨fun h => by
    contrapose! h
    cases h.lt_or_lt with
    | inl h0 => exact (sin_neg_of_neg_of_neg_pi_lt h0 hx₁).ne
    

Proof state:
case inr
x : ℝ
hx₁ : -π < x
hx₂ : x < π
h : x ≠ 0
h0 : 0 < x
⊢ sin x ≠ 0

Next tactic:
| inr h0 => exact (sin_pos_of_pos_of_lt_pi h0 hx₂).ne'
theorem sin_eq_zero_iff_of_lt_of_lt {x : ℝ} (hx₁ : -π < x) (hx₂ : x < π) : sin x = 0 ↔ x = 0 :=
  ⟨fun h => by
    contrapose! h
    cases h.lt_or_lt with
    | inl h0 => exact (sin_neg_of_neg_of_neg_pi_lt h0 hx₁).ne
    | inr h0 => 

Proof state:
case inr
x : ℝ
hx₁ : -π < x
hx₂ : x < π
h : x ≠ 0
h0 : 0 < x
⊢ sin x ≠ 0

Next tactic:
exact (sin_pos_of_pos_of_lt_pi h0 hx₂).ne'
theorem sin_eq_zero_iff_of_lt_of_lt {x : ℝ} (hx₁ : -π < x) (hx₂ : x < π) : sin x = 0 ↔ x = 0 :=
  ⟨fun h => by
    contrapose! h
    cases h.lt_or_lt with
    | inl h0 => exact (sin_neg_of_neg_of_neg_pi_lt h0 hx₁).ne
    | inr h0 => exact (sin_pos_of_pos_of_lt_pi h0 hx₂).ne',
  fun h => by 

Proof state:
x : ℝ
hx₁ : -π < x
hx₂ : x < π
h : x = 0
⊢ sin x = 0

Next tactic:
simp [h]
theorem sin_eq_zero_iff {x : ℝ} : sin x = 0 ↔ ∃ n : ℤ, (n : ℝ) * π = x :=
  ⟨fun h =>
    ⟨⌊x / π⌋,
      le_antisymm (sub_nonneg.1 (Int.sub_floor_div_mul_nonneg _ pi_pos))
        (sub_nonpos.1 <|
          le_of_not_gt fun h₃ =>
            (sin_pos_of_pos_of_lt_pi h₃ (Int.sub_floor_div_mul_lt _ pi_pos)).ne
              (by 

Proof state:
x : ℝ
h : sin x = 0
h₃ : x - ↑⌊x / π⌋ * π > 0
⊢ 0 = sin (x - ↑⌊x / π⌋ * π)

Next tactic:
simp [sub_eq_add_neg, sin_add, h, sin_int_mul_pi]
theorem sin_ne_zero_iff {x : ℝ} : sin x ≠ 0 ↔ ∀ n : ℤ, (n : ℝ) * π ≠ x := by
  

Proof state:
x : ℝ
⊢ sin x ≠ 0 ↔ ∀ (n : ℤ), ↑n * π ≠ x

Next tactic:
rw [← not_exists, not_iff_not, sin_eq_zero_iff]
theorem sin_eq_zero_iff_cos_eq {x : ℝ} : sin x = 0 ↔ cos x = 1 ∨ cos x = -1 := by
  

Proof state:
x : ℝ
⊢ sin x = 0 ↔ cos x = 1 ∨ cos x = -1

Next tactic:
rw [← mul_self_eq_one_iff, ← sin_sq_add_cos_sq x, sq, sq, ← sub_eq_iff_eq_add, sub_self]
theorem sin_eq_zero_iff_cos_eq {x : ℝ} : sin x = 0 ↔ cos x = 1 ∨ cos x = -1 := by
  rw [← mul_self_eq_one_iff, ← sin_sq_add_cos_sq x, sq, sq, ← sub_eq_iff_eq_add, sub_self]
  

Proof state:
x : ℝ
⊢ sin x = 0 ↔ 0 = sin x * sin x

Next tactic:
exact ⟨fun h => by rw [h, mul_zero], eq_zero_of_mul_self_eq_zero ∘ Eq.symm⟩
theorem sin_eq_zero_iff_cos_eq {x : ℝ} : sin x = 0 ↔ cos x = 1 ∨ cos x = -1 := by
  rw [← mul_self_eq_one_iff, ← sin_sq_add_cos_sq x, sq, sq, ← sub_eq_iff_eq_add, sub_self]
  exact ⟨fun h => by 

Proof state:
x : ℝ
h : sin x = 0
⊢ 0 = sin x * sin x

Next tactic:
rw [h, mul_zero]
theorem cos_eq_one_iff (x : ℝ) : cos x = 1 ↔ ∃ n : ℤ, (n : ℝ) * (2 * π) = x :=
  ⟨fun h =>
    let ⟨n, hn⟩ := sin_eq_zero_iff.1 (sin_eq_zero_iff_cos_eq.2 (Or.inl h))
    ⟨n / 2,
      (Int.emod_two_eq_zero_or_one n).elim
        (fun hn0 => by
          

Proof state:
x : ℝ
h : cos x = 1
n : ℤ
hn : ↑n * π = x
hn0 : n % 2 = 0
⊢ ↑(n / 2) * (2 * π) = x

Next tactic:
rwa [← mul_assoc, ← @Int.cast_two ℝ, ← Int.cast_mul,
            Int.ediv_mul_cancel ((Int.dvd_iff_emod_eq_zero _ _).2 hn0)]