@@ -67,6 +67,53 @@ theorem eval_le_zero_of_roots_le_of_leadingCoeff_nonpos
6767 · rwa [IsRoot, ← neg_zero, ← neg_eq_iff_eq_neg, ← eval_neg]
6868 · rwa [leadingCoeff_neg, neg_nonneg]
6969
70+ theorem zero_lt_negOnePow_mul_eval_of_lt_roots_of_leadingCoeff_nonneg
71+ (hroots : ∀ y, P.IsRoot y → x < y) (hlc : 0 ≤ P.leadingCoeff) :
72+ 0 < Int.negOnePow P.natDegree * P.eval x := by
73+ have hroots' y (hy : (P.comp (-X)).IsRoot y) : y < -x := by
74+ grind [show P.IsRoot (-y) by rwa [IsRoot.def, eval_comp, eval_neg, eval_X, ← IsRoot.def] at hy]
75+ have hlc' : 0 ≤ Int.negOnePow (P.comp (-X)).natDegree * (P.comp (-X)).leadingCoeff := by
76+ simpa [natDegree_comp, Int.negOnePow_def, ← mul_assoc]
77+ cases P.natDegree.even_or_odd
78+ case inl h =>
79+ rw [Int.negOnePow_even] at hlc' ⊢
80+ · push_cast at hlc' ⊢; rw [one_mul] at hlc' ⊢
81+ have := zero_lt_eval_of_roots_lt_of_leadingCoeff_nonneg hroots' hlc'
82+ simpa using this
83+ · simpa
84+ · simpa [natDegree_comp]
85+ case inr h =>
86+ rw [Int.negOnePow_odd] at hlc' ⊢
87+ · push_cast at hlc' ⊢; rw [neg_one_mul] at hlc' ⊢
88+ have := eval_lt_zero_of_roots_lt_of_leadingCoeff_nonpos hroots' (nonpos_of_neg_nonneg hlc')
89+ exact neg_pos.mpr (by simpa using this)
90+ · simpa
91+ · simpa [natDegree_comp]
92+
93+ theorem zero_le_negOnePow_mul_eval_of_le_roots_of_leadingCoeff_nonneg
94+ (hroots : ∀ y, P.IsRoot y → x ≤ y) (hlc : 0 ≤ P.leadingCoeff) :
95+ 0 ≤ Int.negOnePow P.natDegree * P.eval x := by
96+ by_cases! hroots' : ∃ y, P.IsRoot y ∧ y ≤ x
97+ · obtain ⟨y, hroot, hle⟩ := hroots'
98+ rw [eq_of_ge_of_le hle (hroots y hroot), hroot, mul_zero]
99+ · exact (zero_lt_negOnePow_mul_eval_of_lt_roots_of_leadingCoeff_nonneg hroots' hlc).le
100+
101+ theorem negOnePow_mul_eval_lt_zero_of_lt_roots_of_leadingCoeff_nonpos
102+ (hroots : ∀ y, P.IsRoot y → x < y) (hlc : P.leadingCoeff ≤ 0 ) :
103+ Int.negOnePow P.natDegree * P.eval x < 0 := by
104+ suffices 0 < Int.negOnePow (-P).natDegree * (-P).eval x by apply neg_pos.mp; simpa
105+ refine zero_lt_negOnePow_mul_eval_of_lt_roots_of_leadingCoeff_nonneg (fun y hy => hroots y ?_) ?_
106+ · rwa [IsRoot, ← neg_zero, ← neg_eq_iff_eq_neg, ← eval_neg]
107+ · rwa [leadingCoeff_neg, le_neg, neg_zero]
108+
109+ theorem negOnePow_mul_eval_le_zero_of_le_roots_of_leadingCoeff_nonpos
110+ (hroots : ∀ y, P.IsRoot y → x ≤ y) (hlc : P.leadingCoeff ≤ 0 ) :
111+ Int.negOnePow P.natDegree * P.eval x ≤ 0 := by
112+ suffices 0 ≤ Int.negOnePow (-P).natDegree * (-P).eval x by apply neg_nonneg.mp; simpa
113+ refine zero_le_negOnePow_mul_eval_of_le_roots_of_leadingCoeff_nonneg (fun y hy => hroots y ?_) ?_
114+ · rwa [IsRoot, ← neg_zero, ← neg_eq_iff_eq_neg, ← eval_neg]
115+ · rwa [leadingCoeff_neg, neg_nonneg]
116+
70117end PolynomialSign
71118
72119end Polynomial
0 commit comments