Theorem: geom_sum_alternating_of_le_neg_one
File: Mathlib/Algebra/GeomSum.lean

tactic: have hx0 : x ≤ 0 := (le_add_of_nonneg_right zero_le_one).trans hx
state_before: α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
n : ℕ
⊢ if Even n then ∑ i ∈ range n, x ^ i ≤ 0 else 1 ≤ ∑ i ∈ range n, x ^ i
state_after: α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
n : ℕ
hx0 : x ≤ 0
⊢ if Even n then ∑ i ∈ range n, x ^ i ≤ 0 else 1 ≤ ∑ i ∈ range n, x ^ i

tactic: induction' n with n ih
state_before: α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
n : ℕ
hx0 : x ≤ 0
⊢ if Even n then ∑ i ∈ range n, x ^ i ≤ 0 else 1 ≤ ∑ i ∈ range n, x ^ i
state_after: case zero
α : Type u
β : Type u_1
n : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
⊢ if Even 0 then ∑ i ∈ range 0, x ^ i ≤ 0 else 1 ≤ ∑ i ∈ range 0, x ^ i

case succ
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
ih : if Even n then ∑ i ∈ range n, x ^ i ≤ 0 else 1 ≤ ∑ i ∈ range n, x ^ i
⊢ if Even (n + 1) then ∑ i ∈ range (n + 1), x ^ i ≤ 0 else 1 ≤ ∑ i ∈ range (n + 1), x ^ i

tactic: simp only [Nat.even_add_one, geom_sum_succ]
state_before: case succ
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
ih : if Even n then ∑ i ∈ range n, x ^ i ≤ 0 else 1 ≤ ∑ i ∈ range n, x ^ i
⊢ if Even (n + 1) then ∑ i ∈ range (n + 1), x ^ i ≤ 0 else 1 ≤ ∑ i ∈ range (n + 1), x ^ i
state_after: case succ
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
ih : if Even n then ∑ i ∈ range n, x ^ i ≤ 0 else 1 ≤ ∑ i ∈ range n, x ^ i
⊢ if ¬Even n then x * ∑ i ∈ range n, x ^ i + 1 ≤ 0 else 1 ≤ x * ∑ i ∈ range n, x ^ i + 1

tactic: split_ifs at ih with h
state_before: case succ
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
ih : if Even n then ∑ i ∈ range n, x ^ i ≤ 0 else 1 ≤ ∑ i ∈ range n, x ^ i
⊢ if ¬Even n then x * ∑ i ∈ range n, x ^ i + 1 ≤ 0 else 1 ≤ x * ∑ i ∈ range n, x ^ i + 1
state_after: case pos
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
h : Even n
ih : ∑ i ∈ range n, x ^ i ≤ 0
⊢ if ¬Even n then x * ∑ i ∈ range n, x ^ i + 1 ≤ 0 else 1 ≤ x * ∑ i ∈ range n, x ^ i + 1

case neg
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
h : ¬Even n
ih : 1 ≤ ∑ i ∈ range n, x ^ i
⊢ if ¬Even n then x * ∑ i ∈ range n, x ^ i + 1 ≤ 0 else 1 ≤ x * ∑ i ∈ range n, x ^ i + 1

tactic: simp only [Nat.zero_eq, range_zero, sum_empty, le_refl, ite_true, even_zero]
state_before: case zero
α : Type u
β : Type u_1
n : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
⊢ if Even 0 then ∑ i ∈ range 0, x ^ i ≤ 0 else 1 ≤ ∑ i ∈ range 0, x ^ i
state_after: no goals

tactic: rw [if_neg (not_not_intro h), le_add_iff_nonneg_left]
state_before: case pos
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
h : Even n
ih : ∑ i ∈ range n, x ^ i ≤ 0
⊢ if ¬Even n then x * ∑ i ∈ range n, x ^ i + 1 ≤ 0 else 1 ≤ x * ∑ i ∈ range n, x ^ i + 1
state_after: case pos
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
h : Even n
ih : ∑ i ∈ range n, x ^ i ≤ 0
⊢ 0 ≤ x * ∑ i ∈ range n, x ^ i

tactic: exact mul_nonneg_of_nonpos_of_nonpos hx0 ih
state_before: case pos
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
h : Even n
ih : ∑ i ∈ range n, x ^ i ≤ 0
⊢ 0 ≤ x * ∑ i ∈ range n, x ^ i
state_after: no goals

tactic: rw [if_pos h]
state_before: case neg
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
h : ¬Even n
ih : 1 ≤ ∑ i ∈ range n, x ^ i
⊢ if ¬Even n then x * ∑ i ∈ range n, x ^ i + 1 ≤ 0 else 1 ≤ x * ∑ i ∈ range n, x ^ i + 1
state_after: case neg
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
h : ¬Even n
ih : 1 ≤ ∑ i ∈ range n, x ^ i
⊢ x * ∑ i ∈ range n, x ^ i + 1 ≤ 0

tactic: refine (add_le_add_right ?_ _).trans hx
state_before: case neg
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
h : ¬Even n
ih : 1 ≤ ∑ i ∈ range n, x ^ i
⊢ x * ∑ i ∈ range n, x ^ i + 1 ≤ 0
state_after: case neg
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
h : ¬Even n
ih : 1 ≤ ∑ i ∈ range n, x ^ i
⊢ x * ∑ i ∈ range n, x ^ i ≤ x

tactic: simpa only [mul_one] using mul_le_mul_of_nonpos_left ih hx0
state_before: case neg
α : Type u
β : Type u_1
n✝ : ℕ
x : α
inst✝ : StrictOrderedRing α
hx : x + 1 ≤ 0
hx0 : x ≤ 0
n : ℕ
h : ¬Even n
ih : 1 ≤ ∑ i ∈ range n, x ^ i
⊢ x * ∑ i ∈ range n, x ^ i ≤ x
state_after: no goals