Theorem: Int.nneg_mul_add_sq_of_abs_le_one
File: Mathlib/Algebra/Order/Ring/Cast.lean

tactic: have hnx : 0 < n → 0 ≤ x + n := fun hn => by
  have := _root_.add_le_add (neg_le_of_abs_le hx) (cast_one_le_of_pos hn)
  rwa [add_left_neg] at this
state_before: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
⊢ 0 ≤ ↑n * x + ↑n * ↑n
state_after: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
⊢ 0 ≤ ↑n * x + ↑n * ↑n

tactic: have hnx' : n < 0 → x + n ≤ 0 := fun hn => by
  have := _root_.add_le_add (le_of_abs_le hx) (cast_le_neg_one_of_neg hn)
  rwa [add_right_neg] at this
state_before: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
⊢ 0 ≤ ↑n * x + ↑n * ↑n
state_after: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
hnx' : n < 0 → x + ↑n ≤ 0
⊢ 0 ≤ ↑n * x + ↑n * ↑n

tactic: rw [← mul_add, mul_nonneg_iff]
state_before: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
hnx' : n < 0 → x + ↑n ≤ 0
⊢ 0 ≤ ↑n * x + ↑n * ↑n
state_after: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
hnx' : n < 0 → x + ↑n ≤ 0
⊢ 0 ≤ ↑n ∧ 0 ≤ x + ↑n ∨ ↑n ≤ 0 ∧ x + ↑n ≤ 0

tactic: rcases lt_trichotomy n 0 with (h | rfl | h)
state_before: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
hnx' : n < 0 → x + ↑n ≤ 0
⊢ 0 ≤ ↑n ∧ 0 ≤ x + ↑n ∨ ↑n ≤ 0 ∧ x + ↑n ≤ 0
state_after: case inl
R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
hnx' : n < 0 → x + ↑n ≤ 0
h : n < 0
⊢ 0 ≤ ↑n ∧ 0 ≤ x + ↑n ∨ ↑n ≤ 0 ∧ x + ↑n ≤ 0

case inr.inl
R : Type u_1
inst✝ : LinearOrderedRing R
a b n : ℤ
x : R
hx : |x| ≤ 1
hnx : 0 < 0 → 0 ≤ x + ↑0
hnx' : 0 < 0 → x + ↑0 ≤ 0
⊢ 0 ≤ ↑0 ∧ 0 ≤ x + ↑0 ∨ ↑0 ≤ 0 ∧ x + ↑0 ≤ 0

case inr.inr
R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
hnx' : n < 0 → x + ↑n ≤ 0
h : 0 < n
⊢ 0 ≤ ↑n ∧ 0 ≤ x + ↑n ∨ ↑n ≤ 0 ∧ x + ↑n ≤ 0

tactic: have := _root_.add_le_add (neg_le_of_abs_le hx) (cast_one_le_of_pos hn)
state_before: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hn : 0 < n
⊢ 0 ≤ x + ↑n
state_after: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hn : 0 < n
this : -1 + 1 ≤ x + ↑n
⊢ 0 ≤ x + ↑n

tactic: rwa [add_left_neg] at this
state_before: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hn : 0 < n
this : -1 + 1 ≤ x + ↑n
⊢ 0 ≤ x + ↑n
state_after: no goals

tactic: have := _root_.add_le_add (le_of_abs_le hx) (cast_le_neg_one_of_neg hn)
state_before: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
hn : n < 0
⊢ x + ↑n ≤ 0
state_after: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
hn : n < 0
this : x + ↑n ≤ 1 + -1
⊢ x + ↑n ≤ 0

tactic: rwa [add_right_neg] at this
state_before: R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
hn : n < 0
this : x + ↑n ≤ 1 + -1
⊢ x + ↑n ≤ 0
state_after: no goals

tactic: exact Or.inr ⟨mod_cast h.le, hnx' h⟩
state_before: case inl
R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
hnx' : n < 0 → x + ↑n ≤ 0
h : n < 0
⊢ 0 ≤ ↑n ∧ 0 ≤ x + ↑n ∨ ↑n ≤ 0 ∧ x + ↑n ≤ 0
state_after: no goals

tactic: simp [le_total 0 x]
state_before: case inr.inl
R : Type u_1
inst✝ : LinearOrderedRing R
a b n : ℤ
x : R
hx : |x| ≤ 1
hnx : 0 < 0 → 0 ≤ x + ↑0
hnx' : 0 < 0 → x + ↑0 ≤ 0
⊢ 0 ≤ ↑0 ∧ 0 ≤ x + ↑0 ∨ ↑0 ≤ 0 ∧ x + ↑0 ≤ 0
state_after: no goals

tactic: exact Or.inl ⟨mod_cast h.le, hnx h⟩
state_before: case inr.inr
R : Type u_1
inst✝ : LinearOrderedRing R
a b n✝ : ℤ
x : R
n : ℤ
hx : |x| ≤ 1
hnx : 0 < n → 0 ≤ x + ↑n
hnx' : n < 0 → x + ↑n ≤ 0
h : 0 < n
⊢ 0 ≤ ↑n ∧ 0 ≤ x + ↑n ∨ ↑n ≤ 0 ∧ x + ↑n ≤ 0
state_after: no goals