@@ -886,6 +886,44 @@ theorem sign_two_zsmul_eq_sign_iff {θ : Angle} :
886886 ((2 : ℤ) • θ).sign = θ.sign ↔ θ = π ∨ |θ.toReal| < π / 2 := by
887887 rw [two_zsmul, ← two_nsmul, sign_two_nsmul_eq_sign_iff]
888888
889+ lemma abs_toReal_add_abs_toReal_eq_pi_of_two_nsmul_add_eq_zero_of_sign_eq {θ ψ : Angle}
890+ (h : (2 : ℕ) • (θ + ψ) = 0 ) (hs : θ.sign = ψ.sign) (h0 : θ.sign ≠ 0 ) :
891+ |θ.toReal| + |ψ.toReal| = π := by
892+ rcases two_nsmul_eq_zero_iff.mp h with h | h
893+ · simp_all [add_eq_zero_iff_eq_neg.mp h]
894+ rw [← coe_toReal θ, ← coe_toReal ψ, ← coe_add] at h
895+ suffices |θ.toReal + ψ.toReal| = π by
896+ rw [← this, eq_comm, abs_add_eq_add_abs_iff]
897+ have hθ := sign_toReal (sign_ne_zero_iff.1 h0).2
898+ have hψ := sign_toReal (sign_ne_zero_iff.1 (hs ▸ h0)).2
899+ obtain hθs | hθs : θ.sign = -1 ∨ θ.sign = 1 := by simpa [h0] using θ.sign.trichotomy
900+ · rw [hθs, eq_comm, ← toReal_neg_iff_sign_neg] at hs
901+ exact .inr ⟨(toReal_neg_iff_sign_neg.mpr hθs).le, hs.le⟩
902+ · simp [toReal_nonneg_iff_sign_nonneg, hs.symm, hθs]
903+ rw [abs_eq pi_nonneg]
904+ rcases angle_eq_iff_two_pi_dvd_sub.mp h with ⟨k, hk⟩
905+ rw [sub_eq_iff_eq_add] at hk
906+ have hu : θ.toReal + ψ.toReal ≤ 2 * π := by linarith [toReal_le_pi θ, toReal_le_pi ψ]
907+ have hn : -2 * π < θ.toReal + ψ.toReal := by linarith [neg_pi_lt_toReal θ, neg_pi_lt_toReal ψ]
908+ rw [hk] at hu hn
909+ have hk0 : k ≤ 0 := by
910+ by_contra hk1
911+ grw [← show 1 ≤ k by cutsat] at hu
912+ simp only [Int.cast_one] at hu
913+ linarith [pi_pos]
914+ have hkn1 : -1 ≤ k := by
915+ by_contra hkn2
916+ grw [show k ≤ -2 by cutsat] at hn
917+ simp only [Int.cast_neg, Int.cast_ofNat] at hn
918+ linarith [pi_pos]
919+ obtain rfl | rfl : k = -1 ∨ k = 0 := (by cutsat) <;> grind
920+
921+ lemma abs_toReal_add_abs_toReal_eq_pi_of_two_zsmul_add_eq_zero_of_sign_eq {θ ψ : Angle}
922+ (h : (2 : ℤ) • (θ + ψ) = 0 ) (hs : θ.sign = ψ.sign) (h0 : θ.sign ≠ 0 ) :
923+ |θ.toReal| + |ψ.toReal| = π := by
924+ rw [two_zsmul, ← two_nsmul] at h
925+ exact abs_toReal_add_abs_toReal_eq_pi_of_two_nsmul_add_eq_zero_of_sign_eq h hs h0
926+
889927theorem continuousAt_sign {θ : Angle} (h0 : θ ≠ 0 ) (hpi : θ ≠ π) : ContinuousAt sign θ :=
890928 (continuousAt_sign_of_ne_zero (sin_ne_zero_iff.2 ⟨h0, hpi⟩)).comp continuous_sin.continuousAt
891929
0 commit comments