l3lab/ntp-mathlib huggingface dataset:
theorem pow_add_pow_le (hx : 0 ≤ x) (hy : 0 ≤ y) (hn : n ≠ 0) : x ^ n + y ^ n ≤ (x + y) ^ n := by
  rcases Nat.exists_eq_succ_of_ne_zero hn with ⟨k, rfl⟩
  induction' k with k ih;
  · have eqn : Nat.succ Nat.zero = 1 := rfl
    rw [eqn]
    simp only [pow_one, le_refl]
  · 

Proof state:
case intro.succ
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
m : ℕ
hx : 0 ≤ x
hy : 0 ≤ y
k : ℕ
ih : Nat.succ k ≠ 0 → x ^ Nat.succ k + y ^ Nat.succ k ≤ (x + y) ^ Nat.succ k
hn : Nat.succ (Nat.succ k) ≠ 0
⊢ x ^ Nat.succ (Nat.succ k) + y ^ Nat.succ (Nat.succ k) ≤ (x + y) ^ Nat.succ (Nat.succ k)

Next tactic:
let n := k.succ
theorem pow_add_pow_le (hx : 0 ≤ x) (hy : 0 ≤ y) (hn : n ≠ 0) : x ^ n + y ^ n ≤ (x + y) ^ n := by
  rcases Nat.exists_eq_succ_of_ne_zero hn with ⟨k, rfl⟩
  induction' k with k ih;
  · have eqn : Nat.succ Nat.zero = 1 := rfl
    rw [eqn]
    simp only [pow_one, le_refl]
  · let n := k.succ
    

Proof state:
case intro.succ
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
m : ℕ
hx : 0 ≤ x
hy : 0 ≤ y
k : ℕ
ih : Nat.succ k ≠ 0 → x ^ Nat.succ k + y ^ Nat.succ k ≤ (x + y) ^ Nat.succ k
hn : Nat.succ (Nat.succ k) ≠ 0
n : ℕ := Nat.succ k
⊢ x ^ Nat.succ (Nat.succ k) + y ^ Nat.succ (Nat.succ k) ≤ (x + y) ^ Nat.succ (Nat.succ k)

Next tactic:
have h1 := add_nonneg (mul_nonneg hx (pow_nonneg hy n)) (mul_nonneg hy (pow_nonneg hx n))
theorem pow_add_pow_le (hx : 0 ≤ x) (hy : 0 ≤ y) (hn : n ≠ 0) : x ^ n + y ^ n ≤ (x + y) ^ n := by
  rcases Nat.exists_eq_succ_of_ne_zero hn with ⟨k, rfl⟩
  induction' k with k ih;
  · have eqn : Nat.succ Nat.zero = 1 := rfl
    rw [eqn]
    simp only [pow_one, le_refl]
  · let n := k.succ
    have h1 := add_nonneg (mul_nonneg hx (pow_nonneg hy n)) (mul_nonneg hy (pow_nonneg hx n))
    

Proof state:
case intro.succ
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
m : ℕ
hx : 0 ≤ x
hy : 0 ≤ y
k : ℕ
ih : Nat.succ k ≠ 0 → x ^ Nat.succ k + y ^ Nat.succ k ≤ (x + y) ^ Nat.succ k
hn : Nat.succ (Nat.succ k) ≠ 0
n : ℕ := Nat.succ k
h1 : 0 ≤ x * y ^ n + y * x ^ n
⊢ x ^ Nat.succ (Nat.succ k) + y ^ Nat.succ (Nat.succ k) ≤ (x + y) ^ Nat.succ (Nat.succ k)

Next tactic:
have h2 := add_nonneg hx hy
theorem pow_add_pow_le (hx : 0 ≤ x) (hy : 0 ≤ y) (hn : n ≠ 0) : x ^ n + y ^ n ≤ (x + y) ^ n := by
  rcases Nat.exists_eq_succ_of_ne_zero hn with ⟨k, rfl⟩
  induction' k with k ih;
  · have eqn : Nat.succ Nat.zero = 1 := rfl
    rw [eqn]
    simp only [pow_one, le_refl]
  · let n := k.succ
    have h1 := add_nonneg (mul_nonneg hx (pow_nonneg hy n)) (mul_nonneg hy (pow_nonneg hx n))
    have h2 := add_nonneg hx hy
    

Proof state:
case intro.succ
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
m : ℕ
hx : 0 ≤ x
hy : 0 ≤ y
k : ℕ
ih : Nat.succ k ≠ 0 → x ^ Nat.succ k + y ^ Nat.succ k ≤ (x + y) ^ Nat.succ k
hn : Nat.succ (Nat.succ k) ≠ 0
n : ℕ := Nat.succ k
h1 : 0 ≤ x * y ^ n + y * x ^ n
h2 : 0 ≤ x + y
⊢ x ^ Nat.succ (Nat.succ k) + y ^ Nat.succ (Nat.succ k) ≤ (x + y) ^ Nat.succ (Nat.succ k)

Next tactic:
calc
      x ^ n.succ + y ^ n.succ ≤ x * x ^ n + y * y ^ n + (x * y ^ n + y * x ^ n) := by
        rw [pow_succ _ n, pow_succ _ n]
        exact le_add_of_nonneg_right h1
      _ = (x + y) * (x ^ n + y ^ n) := by
        rw [add_mul, mul_add, mul_add, add_comm (y * x ^ n), ← add_assoc, ← add_assoc,
          add_assoc (x * x ^ n) (x * y ^ n), add_comm (x * y ^ n) (y * y ^ n), ← add_assoc]
      _ ≤ (x + y) ^ n.succ := by
        rw [pow_succ _ n]
        exact mul_le_mul_of_nonneg_left (ih (Nat.succ_ne_zero k)) h2
theorem pow_add_pow_le (hx : 0 ≤ x) (hy : 0 ≤ y) (hn : n ≠ 0) : x ^ n + y ^ n ≤ (x + y) ^ n := by
  rcases Nat.exists_eq_succ_of_ne_zero hn with ⟨k, rfl⟩
  induction' k with k ih;
  · have eqn : Nat.succ Nat.zero = 1 := rfl
    rw [eqn]
    simp only [pow_one, le_refl]
  · let n := k.succ
    have h1 := add_nonneg (mul_nonneg hx (pow_nonneg hy n)) (mul_nonneg hy (pow_nonneg hx n))
    have h2 := add_nonneg hx hy
    calc
      x ^ n.succ + y ^ n.succ ≤ x * x ^ n + y * y ^ n + (x * y ^ n + y * x ^ n) := by
        

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
m : ℕ
hx : 0 ≤ x
hy : 0 ≤ y
k : ℕ
ih : Nat.succ k ≠ 0 → x ^ Nat.succ k + y ^ Nat.succ k ≤ (x + y) ^ Nat.succ k
hn : Nat.succ (Nat.succ k) ≠ 0
n : ℕ := Nat.succ k
h1 : 0 ≤ x * y ^ n + y * x ^ n
h2 : 0 ≤ x + y
⊢ x ^ Nat.succ n + y ^ Nat.succ n ≤ x * x ^ n + y * y ^ n + (x * y ^ n + y * x ^ n)

Next tactic:
rw [pow_succ _ n, pow_succ _ n]
theorem pow_add_pow_le (hx : 0 ≤ x) (hy : 0 ≤ y) (hn : n ≠ 0) : x ^ n + y ^ n ≤ (x + y) ^ n := by
  rcases Nat.exists_eq_succ_of_ne_zero hn with ⟨k, rfl⟩
  induction' k with k ih;
  · have eqn : Nat.succ Nat.zero = 1 := rfl
    rw [eqn]
    simp only [pow_one, le_refl]
  · let n := k.succ
    have h1 := add_nonneg (mul_nonneg hx (pow_nonneg hy n)) (mul_nonneg hy (pow_nonneg hx n))
    have h2 := add_nonneg hx hy
    calc
      x ^ n.succ + y ^ n.succ ≤ x * x ^ n + y * y ^ n + (x * y ^ n + y * x ^ n) := by
        rw [pow_succ _ n, pow_succ _ n]
        

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
m : ℕ
hx : 0 ≤ x
hy : 0 ≤ y
k : ℕ
ih : Nat.succ k ≠ 0 → x ^ Nat.succ k + y ^ Nat.succ k ≤ (x + y) ^ Nat.succ k
hn : Nat.succ (Nat.succ k) ≠ 0
n : ℕ := Nat.succ k
h1 : 0 ≤ x * y ^ n + y * x ^ n
h2 : 0 ≤ x + y
⊢ x * x ^ n + y * y ^ n ≤ x * x ^ n + y * y ^ n + (x * y ^ n + y * x ^ n)

Next tactic:
exact le_add_of_nonneg_right h1
theorem pow_add_pow_le (hx : 0 ≤ x) (hy : 0 ≤ y) (hn : n ≠ 0) : x ^ n + y ^ n ≤ (x + y) ^ n := by
  rcases Nat.exists_eq_succ_of_ne_zero hn with ⟨k, rfl⟩
  induction' k with k ih;
  · have eqn : Nat.succ Nat.zero = 1 := rfl
    rw [eqn]
    simp only [pow_one, le_refl]
  · let n := k.succ
    have h1 := add_nonneg (mul_nonneg hx (pow_nonneg hy n)) (mul_nonneg hy (pow_nonneg hx n))
    have h2 := add_nonneg hx hy
    calc
      x ^ n.succ + y ^ n.succ ≤ x * x ^ n + y * y ^ n + (x * y ^ n + y * x ^ n) := by
        rw [pow_succ _ n, pow_succ _ n]
        exact le_add_of_nonneg_right h1
      _ = (x + y) * (x ^ n + y ^ n) := by
        

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
m : ℕ
hx : 0 ≤ x
hy : 0 ≤ y
k : ℕ
ih : Nat.succ k ≠ 0 → x ^ Nat.succ k + y ^ Nat.succ k ≤ (x + y) ^ Nat.succ k
hn : Nat.succ (Nat.succ k) ≠ 0
n : ℕ := Nat.succ k
h1 : 0 ≤ x * y ^ n + y * x ^ n
h2 : 0 ≤ x + y
⊢ x * x ^ n + y * y ^ n + (x * y ^ n + y * x ^ n) = (x + y) * (x ^ n + y ^ n)

Next tactic:
rw [add_mul, mul_add, mul_add, add_comm (y * x ^ n), ← add_assoc, ← add_assoc,
          add_assoc (x * x ^ n) (x * y ^ n), add_comm (x * y ^ n) (y * y ^ n), ← add_assoc]
theorem pow_add_pow_le (hx : 0 ≤ x) (hy : 0 ≤ y) (hn : n ≠ 0) : x ^ n + y ^ n ≤ (x + y) ^ n := by
  rcases Nat.exists_eq_succ_of_ne_zero hn with ⟨k, rfl⟩
  induction' k with k ih;
  · have eqn : Nat.succ Nat.zero = 1 := rfl
    rw [eqn]
    simp only [pow_one, le_refl]
  · let n := k.succ
    have h1 := add_nonneg (mul_nonneg hx (pow_nonneg hy n)) (mul_nonneg hy (pow_nonneg hx n))
    have h2 := add_nonneg hx hy
    calc
      x ^ n.succ + y ^ n.succ ≤ x * x ^ n + y * y ^ n + (x * y ^ n + y * x ^ n) := by
        rw [pow_succ _ n, pow_succ _ n]
        exact le_add_of_nonneg_right h1
      _ = (x + y) * (x ^ n + y ^ n) := by
        rw [add_mul, mul_add, mul_add, add_comm (y * x ^ n), ← add_assoc, ← add_assoc,
          add_assoc (x * x ^ n) (x * y ^ n), add_comm (x * y ^ n) (y * y ^ n), ← add_assoc]
      _ ≤ (x + y) ^ n.succ := by
        

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
m : ℕ
hx : 0 ≤ x
hy : 0 ≤ y
k : ℕ
ih : Nat.succ k ≠ 0 → x ^ Nat.succ k + y ^ Nat.succ k ≤ (x + y) ^ Nat.succ k
hn : Nat.succ (Nat.succ k) ≠ 0
n : ℕ := Nat.succ k
h1 : 0 ≤ x * y ^ n + y * x ^ n
h2 : 0 ≤ x + y
⊢ (x + y) * (x ^ n + y ^ n) ≤ (x + y) ^ Nat.succ n

Next tactic:
rw [pow_succ _ n]
theorem pow_add_pow_le (hx : 0 ≤ x) (hy : 0 ≤ y) (hn : n ≠ 0) : x ^ n + y ^ n ≤ (x + y) ^ n := by
  rcases Nat.exists_eq_succ_of_ne_zero hn with ⟨k, rfl⟩
  induction' k with k ih;
  · have eqn : Nat.succ Nat.zero = 1 := rfl
    rw [eqn]
    simp only [pow_one, le_refl]
  · let n := k.succ
    have h1 := add_nonneg (mul_nonneg hx (pow_nonneg hy n)) (mul_nonneg hy (pow_nonneg hx n))
    have h2 := add_nonneg hx hy
    calc
      x ^ n.succ + y ^ n.succ ≤ x * x ^ n + y * y ^ n + (x * y ^ n + y * x ^ n) := by
        rw [pow_succ _ n, pow_succ _ n]
        exact le_add_of_nonneg_right h1
      _ = (x + y) * (x ^ n + y ^ n) := by
        rw [add_mul, mul_add, mul_add, add_comm (y * x ^ n), ← add_assoc, ← add_assoc,
          add_assoc (x * x ^ n) (x * y ^ n), add_comm (x * y ^ n) (y * y ^ n), ← add_assoc]
      _ ≤ (x + y) ^ n.succ := by
        rw [pow_succ _ n]
        

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
m : ℕ
hx : 0 ≤ x
hy : 0 ≤ y
k : ℕ
ih : Nat.succ k ≠ 0 → x ^ Nat.succ k + y ^ Nat.succ k ≤ (x + y) ^ Nat.succ k
hn : Nat.succ (Nat.succ k) ≠ 0
n : ℕ := Nat.succ k
h1 : 0 ≤ x * y ^ n + y * x ^ n
h2 : 0 ≤ x + y
⊢ (x + y) * (x ^ n + y ^ n) ≤ (x + y) * (x + y) ^ n

Next tactic:
exact mul_le_mul_of_nonneg_left (ih (Nat.succ_ne_zero k)) h2
theorem pow_lt_one (h₀ : 0 ≤ a) (h₁ : a < 1) : ∀ {n : ℕ}, n ≠ 0 → a ^ n < 1
  | 0, h => (h rfl).elim
  | n + 1, _ => by
    

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
n✝ m : ℕ
h₀ : 0 ≤ a
h₁ : a < 1
n : ℕ
x✝ : n + 1 ≠ 0
⊢ a ^ (n + 1) < 1

Next tactic:
rw [pow_succ]
theorem pow_lt_one (h₀ : 0 ≤ a) (h₁ : a < 1) : ∀ {n : ℕ}, n ≠ 0 → a ^ n < 1
  | 0, h => (h rfl).elim
  | n + 1, _ => by
    rw [pow_succ]
    

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
n✝ m : ℕ
h₀ : 0 ≤ a
h₁ : a < 1
n : ℕ
x✝ : n + 1 ≠ 0
⊢ a * a ^ n < 1

Next tactic:
exact mul_lt_one_of_nonneg_of_lt_one_left h₀ h₁ (pow_le_one _ h₀ h₁.le)
theorem one_le_pow_of_one_le (H : 1 ≤ a) : ∀ n : ℕ, 1 ≤ a ^ n
  | 0 => by 

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
n m : ℕ
H : 1 ≤ a
⊢ 1 ≤ a ^ 0

Next tactic:
rw [pow_zero]
theorem one_le_pow_of_one_le (H : 1 ≤ a) : ∀ n : ℕ, 1 ≤ a ^ n
  | 0 => by rw [pow_zero]
  | n + 1 => by
    

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
n✝ m : ℕ
H : 1 ≤ a
n : ℕ
⊢ 1 ≤ a ^ (n + 1)

Next tactic:
rw [pow_succ]
theorem one_le_pow_of_one_le (H : 1 ≤ a) : ∀ n : ℕ, 1 ≤ a ^ n
  | 0 => by rw [pow_zero]
  | n + 1 => by
    rw [pow_succ]
    

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
n✝ m : ℕ
H : 1 ≤ a
n : ℕ
⊢ 1 ≤ a * a ^ n

Next tactic:
simpa only [mul_one] using
      mul_le_mul H (one_le_pow_of_one_le H n) zero_le_one (le_trans zero_le_one H)
theorem pow_right_mono (h : 1 ≤ a) : Monotone (a ^ ·) :=
  monotone_nat_of_le_succ fun n => by
    

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
n✝ m : ℕ
h : 1 ≤ a
n : ℕ
⊢ a ^ n ≤ a ^ (n + 1)

Next tactic:
rw [pow_succ]
theorem pow_right_mono (h : 1 ≤ a) : Monotone (a ^ ·) :=
  monotone_nat_of_le_succ fun n => by
    rw [pow_succ]
    

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
n✝ m : ℕ
h : 1 ≤ a
n : ℕ
⊢ a ^ n ≤ a * a ^ n

Next tactic:
exact le_mul_of_one_le_left (pow_nonneg (zero_le_one.trans h) _) h
theorem le_self_pow (ha : 1 ≤ a) (h : m ≠ 0) : a ≤ a ^ m := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
n m : ℕ
ha : 1 ≤ a
h : m ≠ 0
⊢ a ≤ a ^ m

Next tactic:
simpa only [pow_one] using pow_le_pow_right ha <| pos_iff_ne_zero.2 h
@[mono]
theorem pow_le_pow_left {a b : R} (ha : 0 ≤ a) (hab : a ≤ b) : ∀ n, a ^ n ≤ b ^ n
  | 0 => by 

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a✝ x y : R
n m : ℕ
a b : R
ha : 0 ≤ a
hab : a ≤ b
⊢ a ^ 0 ≤ b ^ 0

Next tactic:
simp
@[mono]
theorem pow_le_pow_left {a b : R} (ha : 0 ≤ a) (hab : a ≤ b) : ∀ n, a ^ n ≤ b ^ n
  | 0 => by simp
  | n + 1 => by 

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a✝ x y : R
n✝ m : ℕ
a b : R
ha : 0 ≤ a
hab : a ≤ b
n : ℕ
⊢ a ^ (n + 1) ≤ b ^ (n + 1)

Next tactic:
simpa only [pow_succ]
      using mul_le_mul hab (pow_le_pow_left ha hab _) (pow_nonneg ha _) (ha.trans hab)
theorem one_lt_pow (ha : 1 < a) : ∀ {n : ℕ} (_ : n ≠ 0), 1 < a ^ n
  | 0, h => (h rfl).elim
  | n + 1, _ => by
    

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
n✝ m : ℕ
ha : 1 < a
n : ℕ
x✝ : n + 1 ≠ 0
⊢ 1 < a ^ (n + 1)

Next tactic:
rw [pow_succ]
theorem one_lt_pow (ha : 1 < a) : ∀ {n : ℕ} (_ : n ≠ 0), 1 < a ^ n
  | 0, h => (h rfl).elim
  | n + 1, _ => by
    rw [pow_succ]
    

Proof state:
M : Type u_1
R : Type u_2
inst✝ : OrderedSemiring R
a x y : R
n✝ m : ℕ
ha : 1 < a
n : ℕ
x✝ : n + 1 ≠ 0
⊢ 1 < a * a ^ n

Next tactic:
exact one_lt_mul_of_lt_of_le ha (one_le_pow_of_one_le ha.le _)
theorem pow_lt_pow_left (h : x < y) (hx : 0 ≤ x) : ∀ {n : ℕ}, n ≠ 0 → x ^ n < y ^ n
  | 0, hn => by 

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedSemiring R
a x y : R
n m : ℕ
h : x < y
hx : 0 ≤ x
hn : 0 ≠ 0
⊢ x ^ 0 < y ^ 0

Next tactic:
contradiction
theorem pow_lt_pow_left (h : x < y) (hx : 0 ≤ x) : ∀ {n : ℕ}, n ≠ 0 → x ^ n < y ^ n
  | 0, hn => by contradiction
  | n + 1, _ => by
    

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedSemiring R
a x y : R
n✝ m : ℕ
h : x < y
hx : 0 ≤ x
n : ℕ
x✝ : n + 1 ≠ 0
⊢ x ^ (n + 1) < y ^ (n + 1)

Next tactic:
simpa only [pow_succ'] using
      mul_lt_mul_of_le_of_le' (pow_le_pow_left hx h.le _) h (pow_pos (hx.trans_lt h) _) hx
/-- See also `pow_right_strictMono'`. -/
lemma pow_right_strictMono (h : 1 < a) : StrictMono (a ^ ·) :=
  have : 0 < a := zero_le_one.trans_lt h
  strictMono_nat_of_lt_succ fun n => by
    

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedSemiring R
a x y : R
n✝ m : ℕ
h : 1 < a
this : 0 < a
n : ℕ
⊢ a ^ n < a ^ (n + 1)

Next tactic:
simpa only [one_mul, pow_succ] using mul_lt_mul h (le_refl (a ^ n)) (pow_pos this _) this.le
theorem lt_self_pow (h : 1 < a) (hm : 1 < m) : a < a ^ m := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedSemiring R
a x y : R
n m : ℕ
h : 1 < a
hm : 1 < m
⊢ a < a ^ m

Next tactic:
simpa only [pow_one] using pow_lt_pow_right h hm
theorem pow_right_strictAnti (h₀ : 0 < a) (h₁ : a < 1) : StrictAnti (a ^ ·) :=
  strictAnti_nat_of_succ_lt fun n => by
    

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedSemiring R
a x y : R
n✝ m : ℕ
h₀ : 0 < a
h₁ : a < 1
n : ℕ
⊢ a ^ (n + 1) < a ^ n

Next tactic:
simpa only [pow_succ, one_mul] using mul_lt_mul h₁ le_rfl (pow_pos h₀ n) zero_le_one
theorem pow_lt_self_of_lt_one (h₀ : 0 < a) (h₁ : a < 1) (hn : 1 < n) : a ^ n < a := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedSemiring R
a x y : R
n m : ℕ
h₀ : 0 < a
h₁ : a < 1
hn : 1 < n
⊢ a ^ n < a

Next tactic:
simpa only [pow_one] using pow_lt_pow_right_of_lt_one h₀ h₁ hn
theorem sq_pos_of_pos (ha : 0 < a) : 0 < a ^ 2 := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedSemiring R
a x y : R
n m : ℕ
ha : 0 < a
⊢ 0 < a ^ 2

Next tactic:
rw [sq]
theorem sq_pos_of_pos (ha : 0 < a) : 0 < a ^ 2 := by
  rw [sq]
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedSemiring R
a x y : R
n m : ℕ
ha : 0 < a
⊢ 0 < a * a

Next tactic:
exact mul_pos ha ha
theorem pow_bit0_pos_of_neg (ha : a < 0) (n : ℕ) : 0 < a ^ bit0 n := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedRing R
a : R
ha : a < 0
n : ℕ
⊢ 0 < a ^ bit0 n

Next tactic:
rw [pow_bit0']
theorem pow_bit0_pos_of_neg (ha : a < 0) (n : ℕ) : 0 < a ^ bit0 n := by
  rw [pow_bit0']
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedRing R
a : R
ha : a < 0
n : ℕ
⊢ 0 < (a * a) ^ n

Next tactic:
exact pow_pos (mul_pos_of_neg_of_neg ha ha) _
theorem pow_bit1_neg (ha : a < 0) (n : ℕ) : a ^ bit1 n < 0 := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedRing R
a : R
ha : a < 0
n : ℕ
⊢ a ^ bit1 n < 0

Next tactic:
rw [bit1, pow_succ]
theorem pow_bit1_neg (ha : a < 0) (n : ℕ) : a ^ bit1 n < 0 := by
  rw [bit1, pow_succ]
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : StrictOrderedRing R
a : R
ha : a < 0
n : ℕ
⊢ a * a ^ bit0 n < 0

Next tactic:
exact mul_neg_of_neg_of_pos ha (pow_bit0_pos_of_neg ha n)
lemma pow_right_injective (ha₀ : 0 < a) (ha₁ : a ≠ 1) : Injective (a ^ ·) := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedSemiring R
a b : R
m n : ℕ
ha₀ : 0 < a
ha₁ : a ≠ 1
⊢ Injective fun x => a ^ x

Next tactic:
obtain ha₁ | ha₁ := ha₁.lt_or_lt
lemma pow_right_injective (ha₀ : 0 < a) (ha₁ : a ≠ 1) : Injective (a ^ ·) := by
  obtain ha₁ | ha₁ := ha₁.lt_or_lt
  · 

Proof state:
case inl
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedSemiring R
a b : R
m n : ℕ
ha₀ : 0 < a
ha₁✝ : a ≠ 1
ha₁ : a < 1
⊢ Injective fun x => a ^ x

Next tactic:
exact (pow_right_strictAnti ha₀ ha₁).injective
lemma pow_right_injective (ha₀ : 0 < a) (ha₁ : a ≠ 1) : Injective (a ^ ·) := by
  obtain ha₁ | ha₁ := ha₁.lt_or_lt
  · exact (pow_right_strictAnti ha₀ ha₁).injective
  · 

Proof state:
case inr
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedSemiring R
a b : R
m n : ℕ
ha₀ : 0 < a
ha₁✝ : a ≠ 1
ha₁ : 1 < a
⊢ Injective fun x => a ^ x

Next tactic:
exact (pow_right_strictMono ha₁).injective
theorem pow_le_one_iff_of_nonneg (ha : 0 ≤ a) (hn : n ≠ 0) : a ^ n ≤ 1 ↔ a ≤ 1 := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedSemiring R
a b : R
m n : ℕ
ha : 0 ≤ a
hn : n ≠ 0
⊢ a ^ n ≤ 1 ↔ a ≤ 1

Next tactic:
simpa only [one_pow] using pow_le_pow_iff_left ha zero_le_one hn
theorem one_le_pow_iff_of_nonneg (ha : 0 ≤ a) (hn : n ≠ 0) : 1 ≤ a ^ n ↔ 1 ≤ a := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedSemiring R
a b : R
m n : ℕ
ha : 0 ≤ a
hn : n ≠ 0
⊢ 1 ≤ a ^ n ↔ 1 ≤ a

Next tactic:
simpa only [one_pow] using pow_le_pow_iff_left (zero_le_one' R) ha hn
theorem one_lt_pow_iff_of_nonneg (ha : 0 ≤ a) (hn : n ≠ 0) : 1 < a ^ n ↔ 1 < a := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedSemiring R
a b : R
m n : ℕ
ha : 0 ≤ a
hn : n ≠ 0
⊢ 1 < a ^ n ↔ 1 < a

Next tactic:
simpa only [one_pow] using pow_lt_pow_iff_left (zero_le_one' R) ha hn
lemma pow_eq_one_iff_of_nonneg (ha : 0 ≤ a) (hn : n ≠ 0) : a ^ n = 1 ↔ a = 1 := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedSemiring R
a b : R
m n : ℕ
ha : 0 ≤ a
hn : n ≠ 0
⊢ a ^ n = 1 ↔ a = 1

Next tactic:
simpa only [one_pow] using pow_left_inj ha zero_le_one hn
@[simp]
theorem sq_eq_sq {a b : R} (ha : 0 ≤ a) (hb : 0 ≤ b) : a ^ 2 = b ^ 2 ↔ a = b :=
  pow_left_inj ha hb (by 

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedSemiring R
a✝ b✝ : R
m n : ℕ
a b : R
ha : 0 ≤ a
hb : 0 ≤ b
⊢ 2 ≠ 0

Next tactic:
decide
theorem lt_of_mul_self_lt_mul_self (hb : 0 ≤ b) : a * a < b * b → a < b := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedSemiring R
a b : R
m n : ℕ
hb : 0 ≤ b
⊢ a * a < b * b → a < b

Next tactic:
simp_rw [← sq]
theorem lt_of_mul_self_lt_mul_self (hb : 0 ≤ b) : a * a < b * b → a < b := by
  simp_rw [← sq]
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedSemiring R
a b : R
m n : ℕ
hb : 0 ≤ b
⊢ a ^ 2 < b ^ 2 → a < b

Next tactic:
exact lt_of_pow_lt_pow_left _ hb
theorem abs_neg_one_pow (n : ℕ) : |(-1 : R) ^ n| = 1 := by 

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
n : ℕ
⊢ |(-1) ^ n| = 1

Next tactic:
rw [← pow_abs, abs_neg, abs_one, one_pow]
theorem abs_pow_eq_one (a : R) {n : ℕ} (h : n ≠ 0) : |a ^ n| = 1 ↔ |a| = 1 := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
a : R
n : ℕ
h : n ≠ 0
⊢ |a ^ n| = 1 ↔ |a| = 1

Next tactic:
convert pow_left_inj (abs_nonneg a) zero_le_one h
theorem abs_pow_eq_one (a : R) {n : ℕ} (h : n ≠ 0) : |a ^ n| = 1 ↔ |a| = 1 := by
  convert pow_left_inj (abs_nonneg a) zero_le_one h
  

Proof state:
case h.e'_1.h.e'_2
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
a : R
n : ℕ
h : n ≠ 0
⊢ |a ^ n| = |a| ^ n
case h.e'_1.h.e'_3 M : Type u_1 R : Type u_2 inst✝ : LinearOrderedRing R a : R n : ℕ h : n ≠ 0 ⊢ 1 = 1 ^ n

Next tactic:
exacts [(pow_abs _ _).symm, (one_pow _).symm]
theorem pow_bit0_nonneg (a : R) (n : ℕ) : 0 ≤ a ^ bit0 n := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
a : R
n : ℕ
⊢ 0 ≤ a ^ bit0 n

Next tactic:
rw [pow_bit0]
theorem pow_bit0_nonneg (a : R) (n : ℕ) : 0 ≤ a ^ bit0 n := by
  rw [pow_bit0]
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
a : R
n : ℕ
⊢ 0 ≤ a ^ n * a ^ n

Next tactic:
exact mul_self_nonneg _
theorem pow_bit0_pos_iff (a : R) {n : ℕ} (hn : n ≠ 0) : 0 < a ^ bit0 n ↔ a ≠ 0 := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
a : R
n : ℕ
hn : n ≠ 0
⊢ 0 < a ^ bit0 n ↔ a ≠ 0

Next tactic:
refine' ⟨fun h => _, fun h => pow_bit0_pos h n⟩
theorem pow_bit0_pos_iff (a : R) {n : ℕ} (hn : n ≠ 0) : 0 < a ^ bit0 n ↔ a ≠ 0 := by
  refine' ⟨fun h => _, fun h => pow_bit0_pos h n⟩
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
a : R
n : ℕ
hn : n ≠ 0
h : 0 < a ^ bit0 n
⊢ a ≠ 0

Next tactic:
rintro rfl
theorem pow_bit0_pos_iff (a : R) {n : ℕ} (hn : n ≠ 0) : 0 < a ^ bit0 n ↔ a ≠ 0 := by
  refine' ⟨fun h => _, fun h => pow_bit0_pos h n⟩
  rintro rfl
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
n : ℕ
hn : n ≠ 0
h : 0 < 0 ^ bit0 n
⊢ False

Next tactic:
rw [zero_pow (Nat.zero_lt_bit0 hn)] at h
theorem pow_bit0_pos_iff (a : R) {n : ℕ} (hn : n ≠ 0) : 0 < a ^ bit0 n ↔ a ≠ 0 := by
  refine' ⟨fun h => _, fun h => pow_bit0_pos h n⟩
  rintro rfl
  rw [zero_pow (Nat.zero_lt_bit0 hn)] at h
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
n : ℕ
hn : n ≠ 0
h : 0 < 0
⊢ False

Next tactic:
exact lt_irrefl _ h
@[simp]
theorem sq_abs (x : R) : |x| ^ 2 = x ^ 2 := by 

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
x✝ y x : R
⊢ |x| ^ 2 = x ^ 2

Next tactic:
simpa only [sq] using abs_mul_abs_self x
theorem abs_sq (x : R) : |x ^ 2| = x ^ 2 := by 

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
x✝ y x : R
⊢ |x ^ 2| = x ^ 2

Next tactic:
simpa only [sq] using abs_mul_self x
theorem sq_lt_sq : x ^ 2 < y ^ 2 ↔ |x| < |y| := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
x y : R
⊢ x ^ 2 < y ^ 2 ↔ |x| < |y|

Next tactic:
simpa only [sq_abs] using
    (pow_left_strictMonoOn two_ne_zero).lt_iff_lt (abs_nonneg x) (abs_nonneg y)
theorem sq_le_sq : x ^ 2 ≤ y ^ 2 ↔ |x| ≤ |y| := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
x y : R
⊢ x ^ 2 ≤ y ^ 2 ↔ |x| ≤ |y|

Next tactic:
simpa only [sq_abs] using
    (pow_left_strictMonoOn two_ne_zero).le_iff_le (abs_nonneg x) (abs_nonneg y)
theorem abs_lt_of_sq_lt_sq (h : x ^ 2 < y ^ 2) (hy : 0 ≤ y) : |x| < y := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
x y : R
h : x ^ 2 < y ^ 2
hy : 0 ≤ y
⊢ |x| < y

Next tactic:
rwa [← abs_of_nonneg hy, ← sq_lt_sq]
theorem abs_le_of_sq_le_sq (h : x ^ 2 ≤ y ^ 2) (hy : 0 ≤ y) : |x| ≤ y := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
x y : R
h : x ^ 2 ≤ y ^ 2
hy : 0 ≤ y
⊢ |x| ≤ y

Next tactic:
rwa [← abs_of_nonneg hy, ← sq_le_sq]
theorem sq_eq_sq_iff_abs_eq_abs (x y : R) : x ^ 2 = y ^ 2 ↔ |x| = |y| := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
x✝ y✝ x y : R
⊢ x ^ 2 = y ^ 2 ↔ |x| = |y|

Next tactic:
simp only [le_antisymm_iff, sq_le_sq]
@[simp]
theorem sq_le_one_iff_abs_le_one (x : R) : x ^ 2 ≤ 1 ↔ |x| ≤ 1 := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
x✝ y x : R
⊢ x ^ 2 ≤ 1 ↔ |x| ≤ 1

Next tactic:
simpa only [one_pow, abs_one] using @sq_le_sq _ _ x 1
@[simp]
theorem sq_lt_one_iff_abs_lt_one (x : R) : x ^ 2 < 1 ↔ |x| < 1 := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
x✝ y x : R
⊢ x ^ 2 < 1 ↔ |x| < 1

Next tactic:
simpa only [one_pow, abs_one] using @sq_lt_sq _ _ x 1
@[simp]
theorem one_le_sq_iff_one_le_abs (x : R) : 1 ≤ x ^ 2 ↔ 1 ≤ |x| := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
x✝ y x : R
⊢ 1 ≤ x ^ 2 ↔ 1 ≤ |x|

Next tactic:
simpa only [one_pow, abs_one] using @sq_le_sq _ _ 1 x
@[simp]
theorem one_lt_sq_iff_one_lt_abs (x : R) : 1 < x ^ 2 ↔ 1 < |x| := by
  

Proof state:
M : Type u_1
R : Type u_2
inst✝ : LinearOrderedRing R
x✝ y x : R
⊢ 1 < x ^ 2 ↔ 1 < |x|

Next tactic:
simpa only [one_pow, abs_one] using @sq_lt_sq _ _ 1 x