Theorem: discrim_le_zero
File: Mathlib/Algebra/QuadraticDiscriminant.lean

tactic: rw [discrim, sq]
state_before: K : Type u_1
inst✝ : LinearOrderedField K
a b c : K
h : ∀ (x : K), 0 ≤ a * x * x + b * x + c
⊢ discrim a b c ≤ 0

tactic: obtain ha | rfl | ha : a < 0 ∨ a = 0 ∨ 0 < a := lt_trichotomy a 0
state_before: K : Type u_1
inst✝ : LinearOrderedField K
a b c : K
h : ∀ (x : K), 0 ≤ a * x * x + b * x + c
⊢ b * b - 4 * a * c ≤ 0

tactic: have : Tendsto (fun x => (a * x + b) * x + c) atTop atBot :=
  tendsto_atBot_add_const_right _ c
    ((tendsto_atBot_add_const_right _ b (tendsto_id.neg_const_mul_atTop ha)).atBot_mul_atTop
      tendsto_id)
state_before: case inl
K : Type u_1
inst✝ : LinearOrderedField K
a b c : K
h : ∀ (x : K), 0 ≤ a * x * x + b * x + c
ha : a < 0
⊢ b * b - 4 * a * c ≤ 0

tactic: rcases(this.eventually (eventually_lt_atBot 0)).exists with ⟨x, hx⟩
state_before: case inl
K : Type u_1
inst✝ : LinearOrderedField K
a b c : K
h : ∀ (x : K), 0 ≤ a * x * x + b * x + c
ha : a < 0
this : Tendsto (fun x => (a * x + b) * x + c) atTop atBot
⊢ b * b - 4 * a * c ≤ 0

tactic: exact False.elim ((h x).not_lt <| by rwa [← add_mul])
state_before: case inl.intro
K : Type u_1
inst✝ : LinearOrderedField K
a b c : K
h : ∀ (x : K), 0 ≤ a * x * x + b * x + c
ha : a < 0
this : Tendsto (fun x => (a * x + b) * x + c) atTop atBot
x : K
hx : (a * x + b) * x + c < 0
⊢ b * b - 4 * a * c ≤ 0

tactic: rwa [← add_mul]
state_before: K : Type u_1
inst✝ : LinearOrderedField K
a b c : K
h : ∀ (x : K), 0 ≤ a * x * x + b * x + c
ha : a < 0
this : Tendsto (fun x => (a * x + b) * x + c) atTop atBot
x : K
hx : (a * x + b) * x + c < 0
⊢ a * x * x + b * x + c < 0

tactic: rcases eq_or_ne b 0 with (rfl | hb)
state_before: case inr.inl
K : Type u_1
inst✝ : LinearOrderedField K
b c : K
h : ∀ (x : K), 0 ≤ 0 * x * x + b * x + c
⊢ b * b - 4 * 0 * c ≤ 0

tactic: simp
state_before: case inr.inl.inl
K : Type u_1
inst✝ : LinearOrderedField K
c : K
h : ∀ (x : K), 0 ≤ 0 * x * x + 0 * x + c
⊢ 0 * 0 - 4 * 0 * c ≤ 0

tactic: have := h ((-c - 1) / b)
state_before: case inr.inl.inr
K : Type u_1
inst✝ : LinearOrderedField K
b c : K
h : ∀ (x : K), 0 ≤ 0 * x * x + b * x + c
hb : b ≠ 0
⊢ b * b - 4 * 0 * c ≤ 0

tactic: rw [mul_div_cancel' _ hb] at this
state_before: case inr.inl.inr
K : Type u_1
inst✝ : LinearOrderedField K
b c : K
h : ∀ (x : K), 0 ≤ 0 * x * x + b * x + c
hb : b ≠ 0
this : 0 ≤ 0 * ((-c - 1) / b) * ((-c - 1) / b) + b * ((-c - 1) / b) + c
⊢ b * b - 4 * 0 * c ≤ 0

tactic: linarith
state_before: case inr.inl.inr
K : Type u_1
inst✝ : LinearOrderedField K
b c : K
h : ∀ (x : K), 0 ≤ 0 * x * x + b * x + c
hb : b ≠ 0
this : 0 ≤ 0 * ((-c - 1) / b) * ((-c - 1) / b) + (-c - 1) + c
⊢ b * b - 4 * 0 * c ≤ 0

tactic: have ha' : 0 ≤ 4 * a := mul_nonneg zero_le_four ha.le
state_before: case inr.inr
K : Type u_1
inst✝ : LinearOrderedField K
a b c : K
h : ∀ (x : K), 0 ≤ a * x * x + b * x + c
ha : 0 < a
⊢ b * b - 4 * a * c ≤ 0

tactic: convert neg_nonpos.2 (mul_nonneg ha' (h (-b / (2 * a)))) using 1
state_before: case inr.inr
K : Type u_1
inst✝ : LinearOrderedField K
a b c : K
h : ∀ (x : K), 0 ≤ a * x * x + b * x + c
ha : 0 < a
ha' : 0 ≤ 4 * a
⊢ b * b - 4 * a * c ≤ 0

tactic: field_simp [ha.ne']
state_before: case h.e'_3
K : Type u_1
inst✝ : LinearOrderedField K
a b c : K
h : ∀ (x : K), 0 ≤ a * x * x + b * x + c
ha : 0 < a
ha' : 0 ≤ 4 * a
⊢ b * b - 4 * a * c = -(4 * a * (a * (-b / (2 * a)) * (-b / (2 * a)) + b * (-b / (2 * a)) + c))

tactic: ring
state_before: case h.e'_3
K : Type u_1
inst✝ : LinearOrderedField K
a b c : K
h : ∀ (x : K), 0 ≤ a * x * x + b * x + c
ha : 0 < a
ha' : 0 ≤ 4 * a
⊢ (b * b - 4 * a * c) * (2 * a * (2 * a) * (2 * a)) =
    -(4 * a * (a * b * b * (2 * a) + -(b * b * (2 * a * (2 * a))) + c * (2 * a * (2 * a) * (2 * a))))