l3lab/ntp-mathlib huggingface dataset:
theorem Even.tsub [CanonicallyLinearOrderedAddCommMonoid α] [Sub α] [OrderedSub α]
    [ContravariantClass α α (· + ·) (· ≤ ·)] {m n : α} (hm : Even m) (hn : Even n) :
    Even (m - n) := by
  obtain ⟨a, rfl⟩ := hm
  

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝³ : CanonicallyLinearOrderedAddCommMonoid α
inst✝² : Sub α
inst✝¹ : OrderedSub α
inst✝ : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
n : α
hn : Even n
a : α
⊢ Even (a + a - n)

Next tactic:
obtain ⟨b, rfl⟩ := hn
theorem Even.tsub [CanonicallyLinearOrderedAddCommMonoid α] [Sub α] [OrderedSub α]
    [ContravariantClass α α (· + ·) (· ≤ ·)] {m n : α} (hm : Even m) (hn : Even n) :
    Even (m - n) := by
  obtain ⟨a, rfl⟩ := hm
  obtain ⟨b, rfl⟩ := hn
  

Proof state:
case intro.intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝³ : CanonicallyLinearOrderedAddCommMonoid α
inst✝² : Sub α
inst✝¹ : OrderedSub α
inst✝ : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ Even (a + a - (b + b))

Next tactic:
refine' ⟨a - b, _⟩
theorem Even.tsub [CanonicallyLinearOrderedAddCommMonoid α] [Sub α] [OrderedSub α]
    [ContravariantClass α α (· + ·) (· ≤ ·)] {m n : α} (hm : Even m) (hn : Even n) :
    Even (m - n) := by
  obtain ⟨a, rfl⟩ := hm
  obtain ⟨b, rfl⟩ := hn
  refine' ⟨a - b, _⟩
  

Proof state:
case intro.intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝³ : CanonicallyLinearOrderedAddCommMonoid α
inst✝² : Sub α
inst✝¹ : OrderedSub α
inst✝ : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ a + a - (b + b) = a - b + (a - b)

Next tactic:
obtain h | h := le_total a b
theorem Even.tsub [CanonicallyLinearOrderedAddCommMonoid α] [Sub α] [OrderedSub α]
    [ContravariantClass α α (· + ·) (· ≤ ·)] {m n : α} (hm : Even m) (hn : Even n) :
    Even (m - n) := by
  obtain ⟨a, rfl⟩ := hm
  obtain ⟨b, rfl⟩ := hn
  refine' ⟨a - b, _⟩
  obtain h | h := le_total a b
  · 

Proof state:
case intro.intro.inl
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝³ : CanonicallyLinearOrderedAddCommMonoid α
inst✝² : Sub α
inst✝¹ : OrderedSub α
inst✝ : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
a b : α
h : a ≤ b
⊢ a + a - (b + b) = a - b + (a - b)

Next tactic:
rw [tsub_eq_zero_of_le h, tsub_eq_zero_of_le (add_le_add h h), add_zero]
theorem Even.tsub [CanonicallyLinearOrderedAddCommMonoid α] [Sub α] [OrderedSub α]
    [ContravariantClass α α (· + ·) (· ≤ ·)] {m n : α} (hm : Even m) (hn : Even n) :
    Even (m - n) := by
  obtain ⟨a, rfl⟩ := hm
  obtain ⟨b, rfl⟩ := hn
  refine' ⟨a - b, _⟩
  obtain h | h := le_total a b
  · rw [tsub_eq_zero_of_le h, tsub_eq_zero_of_le (add_le_add h h), add_zero]
  · 

Proof state:
case intro.intro.inr
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝³ : CanonicallyLinearOrderedAddCommMonoid α
inst✝² : Sub α
inst✝¹ : OrderedSub α
inst✝ : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
a b : α
h : b ≤ a
⊢ a + a - (b + b) = a - b + (a - b)

Next tactic:
exact (tsub_add_tsub_comm h h).symm
theorem even_iff_exists_two_mul (m : α) : Even m ↔ ∃ c, m = 2 * c := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m✝ n m : α
⊢ Even m ↔ ∃ c, m = 2 * c

Next tactic:
simp [even_iff_exists_two_nsmul]
theorem even_iff_two_dvd {a : α} : Even a ↔ 2 ∣ a := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n a : α
⊢ Even a ↔ 2 ∣ a

Next tactic:
simp [Even, Dvd.dvd, two_mul]
@[simp]
theorem range_two_mul (α) [Semiring α] : (Set.range fun x : α => 2 * x) = { a | Even a } := by
  

Proof state:
F : Type u_1
α✝ : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α✝
inst✝¹ : Semiring β
m n : α✝
α : Type u_5
inst✝ : Semiring α
⊢ (Set.range fun x => 2 * x) = {a | Even a}

Next tactic:
ext x
@[simp]
theorem range_two_mul (α) [Semiring α] : (Set.range fun x : α => 2 * x) = { a | Even a } := by
  ext x
  

Proof state:
case h
F : Type u_1
α✝ : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α✝
inst✝¹ : Semiring β
m n : α✝
α : Type u_5
inst✝ : Semiring α
x : α
⊢ (x ∈ Set.range fun x => 2 * x) ↔ x ∈ {a | Even a}

Next tactic:
simp [eq_comm, two_mul, Even]
@[simp]
theorem even_two : Even (2 : α) :=
  ⟨1, by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ 2 = 1 + 1

Next tactic:
rw[one_add_one_eq_two]
theorem Even.pow_of_ne_zero (hm : Even m) : ∀ {a : ℕ}, a ≠ 0 → Even (m ^ a)
  | 0, a0 => (a0 rfl).elim
  | a + 1, _ => by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
hm : Even m
a : ℕ
x✝ : a + 1 ≠ 0
⊢ Even (m ^ (a + 1))

Next tactic:
rw [pow_succ]
theorem Even.pow_of_ne_zero (hm : Even m) : ∀ {a : ℕ}, a ≠ 0 → Even (m ^ a)
  | 0, a0 => (a0 rfl).elim
  | a + 1, _ => by
    rw [pow_succ]
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
hm : Even m
a : ℕ
x✝ : a + 1 ≠ 0
⊢ Even (m * m ^ a)

Next tactic:
exact hm.mul_right _
set_option linter.deprecated false in
theorem odd_iff_exists_bit1 {a : α} : Odd a ↔ ∃ b, a = bit1 b :=
  exists_congr fun b => by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n a b : α
⊢ a = 2 * b + 1 ↔ a = bit1 b

Next tactic:
rw [two_mul]
set_option linter.deprecated false in
theorem odd_iff_exists_bit1 {a : α} : Odd a ↔ ∃ b, a = bit1 b :=
  exists_congr fun b => by
    rw [two_mul]
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n a b : α
⊢ a = b + b + 1 ↔ a = bit1 b

Next tactic:
rfl
@[simp]
theorem range_two_mul_add_one (α : Type*) [Semiring α] :
    (Set.range fun x : α => 2 * x + 1) = { a | Odd a } := by
  

Proof state:
F : Type u_1
α✝ : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α✝
inst✝¹ : Semiring β
m n : α✝
α : Type u_5
inst✝ : Semiring α
⊢ (Set.range fun x => 2 * x + 1) = {a | Odd a}

Next tactic:
ext x
@[simp]
theorem range_two_mul_add_one (α : Type*) [Semiring α] :
    (Set.range fun x : α => 2 * x + 1) = { a | Odd a } := by
  ext x
  

Proof state:
case h
F : Type u_1
α✝ : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α✝
inst✝¹ : Semiring β
m n : α✝
α : Type u_5
inst✝ : Semiring α
x : α
⊢ (x ∈ Set.range fun x => 2 * x + 1) ↔ x ∈ {a | Odd a}

Next tactic:
simp [Odd, eq_comm]
theorem Even.add_odd : Even m → Odd n → Odd (m + n) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ Even m → Odd n → Odd (m + n)

Next tactic:
rintro ⟨m, rfl⟩ ⟨n, rfl⟩
theorem Even.add_odd : Even m → Odd n → Odd (m + n) := by
  rintro ⟨m, rfl⟩ ⟨n, rfl⟩
  

Proof state:
case intro.intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ Odd (m + m + (2 * n + 1))

Next tactic:
exact ⟨m + n, by rw [mul_add, ← two_mul, add_assoc]⟩
theorem Even.add_odd : Even m → Odd n → Odd (m + n) := by
  rintro ⟨m, rfl⟩ ⟨n, rfl⟩
  exact ⟨m + n, by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ m + m + (2 * n + 1) = 2 * (m + n) + 1

Next tactic:
rw [mul_add, ← two_mul, add_assoc]
theorem Even.odd_add : Even m → Odd n → Odd (n + m) :=
  fun he ho ↦ by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
he : Even m
ho : Odd n
⊢ Odd (n + m)

Next tactic:
simp only [he.add_odd ho, add_comm n m]
theorem Odd.add_even (hm : Odd m) (hn : Even n) : Odd (m + n) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
hm : Odd m
hn : Even n
⊢ Odd (m + n)

Next tactic:
rw [add_comm]
theorem Odd.add_even (hm : Odd m) (hn : Even n) : Odd (m + n) := by
  rw [add_comm]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
hm : Odd m
hn : Even n
⊢ Odd (n + m)

Next tactic:
exact hn.add_odd hm
theorem Odd.add_odd : Odd m → Odd n → Even (m + n) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ Odd m → Odd n → Even (m + n)

Next tactic:
rintro ⟨m, rfl⟩ ⟨n, rfl⟩
theorem Odd.add_odd : Odd m → Odd n → Even (m + n) := by
  rintro ⟨m, rfl⟩ ⟨n, rfl⟩
  

Proof state:
case intro.intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ Even (2 * m + 1 + (2 * n + 1))

Next tactic:
refine' ⟨n + m + 1, _⟩
theorem Odd.add_odd : Odd m → Odd n → Even (m + n) := by
  rintro ⟨m, rfl⟩ ⟨n, rfl⟩
  refine' ⟨n + m + 1, _⟩
  

Proof state:
case intro.intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ 2 * m + 1 + (2 * n + 1) = n + m + 1 + (n + m + 1)

Next tactic:
rw [two_mul, two_mul]
theorem Odd.add_odd : Odd m → Odd n → Even (m + n) := by
  rintro ⟨m, rfl⟩ ⟨n, rfl⟩
  refine' ⟨n + m + 1, _⟩
  rw [two_mul, two_mul]
  

Proof state:
case intro.intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ m + m + 1 + (n + n + 1) = n + m + 1 + (n + m + 1)

Next tactic:
ac_rfl
@[simp] lemma odd_add_self_one' : Odd (m + (m + 1)) := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ Odd (m + (m + 1))

Next tactic:
simp [← add_assoc]
@[simp] lemma odd_add_one_self : Odd (m + 1 + m) := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ Odd (m + 1 + m)

Next tactic:
simp [add_comm _ m]
@[simp] lemma odd_add_one_self' : Odd (m + (1 + m)) := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ Odd (m + (1 + m))

Next tactic:
simp [add_comm 1 m]
@[simp] lemma one_add_self_self : Odd (1 + m + m) := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ Odd (1 + m + m)

Next tactic:
simp [add_comm 1 m]
theorem Odd.map [RingHomClass F α β] (f : F) : Odd m → Odd (f m) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
m n : α
inst✝ : RingHomClass F α β
f : F
⊢ Odd m → Odd (f m)

Next tactic:
rintro ⟨m, rfl⟩
theorem Odd.map [RingHomClass F α β] (f : F) : Odd m → Odd (f m) := by
  rintro ⟨m, rfl⟩
  

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
n : α
inst✝ : RingHomClass F α β
f : F
m : α
⊢ Odd (f (2 * m + 1))

Next tactic:
exact ⟨f m, by simp [two_mul]⟩
theorem Odd.map [RingHomClass F α β] (f : F) : Odd m → Odd (f m) := by
  rintro ⟨m, rfl⟩
  exact ⟨f m, by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝² : Semiring α
inst✝¹ : Semiring β
n : α
inst✝ : RingHomClass F α β
f : F
m : α
⊢ f (2 * m + 1) = 2 * f m + 1

Next tactic:
simp [two_mul]
@[simp]
theorem Odd.mul : Odd m → Odd n → Odd (m * n) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ Odd m → Odd n → Odd (m * n)

Next tactic:
rintro ⟨m, rfl⟩ ⟨n, rfl⟩
@[simp]
theorem Odd.mul : Odd m → Odd n → Odd (m * n) := by
  rintro ⟨m, rfl⟩ ⟨n, rfl⟩
  

Proof state:
case intro.intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ Odd ((2 * m + 1) * (2 * n + 1))

Next tactic:
refine' ⟨2 * m * n + n + m, _⟩
@[simp]
theorem Odd.mul : Odd m → Odd n → Odd (m * n) := by
  rintro ⟨m, rfl⟩ ⟨n, rfl⟩
  refine' ⟨2 * m * n + n + m, _⟩
  

Proof state:
case intro.intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
⊢ (2 * m + 1) * (2 * n + 1) = 2 * (2 * m * n + n + m) + 1

Next tactic:
rw [mul_add, add_mul, mul_one, ← add_assoc, one_mul, mul_assoc, ← mul_add, ← mul_add, ← mul_assoc,
    ← Nat.cast_two, ← Nat.cast_comm]
theorem Odd.pow (hm : Odd m) : ∀ {a : ℕ}, Odd (m ^ a)
  | 0 => by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
hm : Odd m
⊢ Odd (m ^ 0)

Next tactic:
rw [pow_zero]
theorem Odd.pow (hm : Odd m) : ∀ {a : ℕ}, Odd (m ^ a)
  | 0 => by
    rw [pow_zero]
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
hm : Odd m
⊢ Odd 1

Next tactic:
exact odd_one
theorem Odd.pow (hm : Odd m) : ∀ {a : ℕ}, Odd (m ^ a)
  | 0 => by
    rw [pow_zero]
    exact odd_one
  | a + 1 => by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
hm : Odd m
a : ℕ
⊢ Odd (m ^ (a + 1))

Next tactic:
rw [pow_succ]
theorem Odd.pow (hm : Odd m) : ∀ {a : ℕ}, Odd (m ^ a)
  | 0 => by
    rw [pow_zero]
    exact odd_one
  | a + 1 => by
    rw [pow_succ]
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Semiring α
inst✝ : Semiring β
m n : α
hm : Odd m
a : ℕ
⊢ Odd (m * m ^ a)

Next tactic:
exact hm.mul <| Odd.pow hm
theorem Odd.neg_pow : Odd n → ∀ a : α, (-a) ^ n = -a ^ n := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Monoid α
inst✝ : HasDistribNeg α
a : α
n : ℕ
⊢ Odd n → ∀ (a : α), (-a) ^ n = -a ^ n

Next tactic:
rintro ⟨c, rfl⟩ a
theorem Odd.neg_pow : Odd n → ∀ a : α, (-a) ^ n = -a ^ n := by
  rintro ⟨c, rfl⟩ a
  

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Monoid α
inst✝ : HasDistribNeg α
a✝ : α
c : ℕ
a : α
⊢ (-a) ^ (2 * c + 1) = -a ^ (2 * c + 1)

Next tactic:
simp_rw [pow_add, pow_mul, neg_sq, pow_one, mul_neg]
@[simp]
theorem Odd.neg_one_pow (h : Odd n) : (-1 : α) ^ n = -1 := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Monoid α
inst✝ : HasDistribNeg α
a : α
n : ℕ
h : Odd n
⊢ (-1) ^ n = -1

Next tactic:
rw [h.neg_pow, one_pow]
theorem Odd.pos [Nontrivial α] {n : α} (hn : Odd n) : 0 < n := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : CanonicallyOrderedCommSemiring α
inst✝ : Nontrivial α
n : α
hn : Odd n
⊢ 0 < n

Next tactic:
obtain ⟨k, rfl⟩ := hn
theorem Odd.pos [Nontrivial α] {n : α} (hn : Odd n) : 0 < n := by
  obtain ⟨k, rfl⟩ := hn
  

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : CanonicallyOrderedCommSemiring α
inst✝ : Nontrivial α
k : α
⊢ 0 < 2 * k + 1

Next tactic:
rw [pos_iff_ne_zero, Ne.def, add_eq_zero_iff, not_and']
theorem Odd.pos [Nontrivial α] {n : α} (hn : Odd n) : 0 < n := by
  obtain ⟨k, rfl⟩ := hn
  rw [pos_iff_ne_zero, Ne.def, add_eq_zero_iff, not_and']
  

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : CanonicallyOrderedCommSemiring α
inst✝ : Nontrivial α
k : α
⊢ 1 = 0 → ¬2 * k = 0

Next tactic:
exact fun h => (one_ne_zero h).elim
theorem even_neg_two : Even (-2 : α) := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : Ring α
a b : α
n : ℕ
⊢ Even (-2)

Next tactic:
simp only [even_neg, even_two]
theorem Odd.neg (hp : Odd a) : Odd (-a) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : Ring α
a b : α
n : ℕ
hp : Odd a
⊢ Odd (-a)

Next tactic:
obtain ⟨k, hk⟩ := hp
theorem Odd.neg (hp : Odd a) : Odd (-a) := by
  obtain ⟨k, hk⟩ := hp
  

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : Ring α
a b : α
n : ℕ
k : α
hk : a = 2 * k + 1
⊢ Odd (-a)

Next tactic:
use -(k + 1)
theorem Odd.neg (hp : Odd a) : Odd (-a) := by
  obtain ⟨k, hk⟩ := hp
  use -(k + 1)
  

Proof state:
case h
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : Ring α
a b : α
n : ℕ
k : α
hk : a = 2 * k + 1
⊢ -a = 2 * -(k + 1) + 1

Next tactic:
rw [mul_neg, mul_add, neg_add, add_assoc, two_mul (1 : α), neg_add, neg_add_cancel_right, ←
    neg_add, hk]
theorem odd_neg_one : Odd (-1 : α) := by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : Ring α
a b : α
n : ℕ
⊢ Odd (-1)

Next tactic:
simp
theorem Odd.sub_even (ha : Odd a) (hb : Even b) : Odd (a - b) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : Ring α
a b : α
n : ℕ
ha : Odd a
hb : Even b
⊢ Odd (a - b)

Next tactic:
rw [sub_eq_add_neg]
theorem Odd.sub_even (ha : Odd a) (hb : Even b) : Odd (a - b) := by
  rw [sub_eq_add_neg]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : Ring α
a b : α
n : ℕ
ha : Odd a
hb : Even b
⊢ Odd (a + -b)

Next tactic:
exact ha.add_even hb.neg
theorem Even.sub_odd (ha : Even a) (hb : Odd b) : Odd (a - b) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : Ring α
a b : α
n : ℕ
ha : Even a
hb : Odd b
⊢ Odd (a - b)

Next tactic:
rw [sub_eq_add_neg]
theorem Even.sub_odd (ha : Even a) (hb : Odd b) : Odd (a - b) := by
  rw [sub_eq_add_neg]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : Ring α
a b : α
n : ℕ
ha : Even a
hb : Odd b
⊢ Odd (a + -b)

Next tactic:
exact ha.add_odd hb.neg
theorem Odd.sub_odd (ha : Odd a) (hb : Odd b) : Even (a - b) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : Ring α
a b : α
n : ℕ
ha : Odd a
hb : Odd b
⊢ Even (a - b)

Next tactic:
rw [sub_eq_add_neg]
theorem Odd.sub_odd (ha : Odd a) (hb : Odd b) : Even (a - b) := by
  rw [sub_eq_add_neg]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : Ring α
a b : α
n : ℕ
ha : Odd a
hb : Odd b
⊢ Even (a + -b)

Next tactic:
exact ha.add_odd hb.neg
theorem odd_abs [LinearOrder α] : Odd (abs a) ↔ Odd a := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Ring α
a b : α
n : ℕ
inst✝ : LinearOrder α
⊢ Odd |a| ↔ Odd a

Next tactic:
cases' abs_choice a with h h
theorem odd_abs [LinearOrder α] : Odd (abs a) ↔ Odd a := by
  cases' abs_choice a with h h <;> 

Proof state:
case inl
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Ring α
a b : α
n : ℕ
inst✝ : LinearOrder α
h : |a| = a
⊢ Odd |a| ↔ Odd a

Next tactic:
simp only [h, odd_neg]
theorem odd_abs [LinearOrder α] : Odd (abs a) ↔ Odd a := by
  cases' abs_choice a with h h <;> 

Proof state:
case inr
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝¹ : Ring α
a b : α
n : ℕ
inst✝ : LinearOrder α
h : |a| = -a
⊢ Odd |a| ↔ Odd a

Next tactic:
simp only [h, odd_neg]
theorem Even.pow_nonneg (hn : Even n) (a : R) : 0 ≤ a ^ n := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a✝ : R
n : ℕ
hn : Even n
a : R
⊢ 0 ≤ a ^ n

Next tactic:
cases' hn with k hk
theorem Even.pow_nonneg (hn : Even n) (a : R) : 0 ≤ a ^ n := by
  cases' hn with k hk; 

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a✝ : R
n : ℕ
a : R
k : ℕ
hk : n = k + k
⊢ 0 ≤ a ^ n

Next tactic:
simpa only [hk, two_mul] using pow_bit0_nonneg a k
theorem Even.pow_pos (hn : Even n) (ha : a ≠ 0) : 0 < a ^ n := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a : R
n : ℕ
hn : Even n
ha : a ≠ 0
⊢ 0 < a ^ n

Next tactic:
cases' hn with k hk
theorem Even.pow_pos (hn : Even n) (ha : a ≠ 0) : 0 < a ^ n := by
  cases' hn with k hk; 

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a : R
n : ℕ
ha : a ≠ 0
k : ℕ
hk : n = k + k
⊢ 0 < a ^ n

Next tactic:
simpa only [hk, two_mul] using pow_bit0_pos ha k
theorem Odd.pow_nonpos (hn : Odd n) (ha : a ≤ 0) : a ^ n ≤ 0 := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a : R
n : ℕ
hn : Odd n
ha : a ≤ 0
⊢ a ^ n ≤ 0

Next tactic:
cases' hn with k hk
theorem Odd.pow_nonpos (hn : Odd n) (ha : a ≤ 0) : a ^ n ≤ 0 := by
  cases' hn with k hk; 

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a : R
n : ℕ
ha : a ≤ 0
k : ℕ
hk : n = 2 * k + 1
⊢ a ^ n ≤ 0

Next tactic:
simpa only [hk, two_mul] using pow_bit1_nonpos_iff.mpr ha
theorem Odd.pow_neg (hn : Odd n) (ha : a < 0) : a ^ n < 0 := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a : R
n : ℕ
hn : Odd n
ha : a < 0
⊢ a ^ n < 0

Next tactic:
cases' hn with k hk
theorem Odd.pow_neg (hn : Odd n) (ha : a < 0) : a ^ n < 0 := by
  cases' hn with k hk; 

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a : R
n : ℕ
ha : a < 0
k : ℕ
hk : n = 2 * k + 1
⊢ a ^ n < 0

Next tactic:
simpa only [hk, two_mul] using pow_bit1_neg_iff.mpr ha
theorem Even.pow_pos_iff (hn : Even n) (h₀ : 0 < n) : 0 < a ^ n ↔ a ≠ 0 :=
  ⟨fun h ha => by
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a : R
n : ℕ
hn : Even n
h₀ : 0 < n
h : 0 < a ^ n
ha : a = 0
⊢ False

Next tactic:
rw [ha, zero_pow h₀] at h
theorem Even.pow_pos_iff (hn : Even n) (h₀ : 0 < n) : 0 < a ^ n ↔ a ≠ 0 :=
  ⟨fun h ha => by
    rw [ha, zero_pow h₀] at h
    

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a : R
n : ℕ
hn : Even n
h₀ : 0 < n
h : 0 < 0
ha : a = 0
⊢ False

Next tactic:
exact lt_irrefl 0 h
theorem Even.pow_abs {p : ℕ} (hp : Even p) (a : R) : |a| ^ p = a ^ p := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a✝ : R
n p : ℕ
hp : Even p
a : R
⊢ |a| ^ p = a ^ p

Next tactic:
rw [← abs_pow, abs_eq_self]
theorem Even.pow_abs {p : ℕ} (hp : Even p) (a : R) : |a| ^ p = a ^ p := by
  rw [← abs_pow, abs_eq_self]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a✝ : R
n p : ℕ
hp : Even p
a : R
⊢ 0 ≤ a ^ p

Next tactic:
exact hp.pow_nonneg _
theorem Odd.strictMono_pow (hn : Odd n) : StrictMono fun a : R => a ^ n := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a : R
n : ℕ
hn : Odd n
⊢ StrictMono fun a => a ^ n

Next tactic:
cases' hn with k hk
theorem Odd.strictMono_pow (hn : Odd n) : StrictMono fun a : R => a ^ n := by
  cases' hn with k hk; 

Proof state:
case intro
F : Type u_1
α : Type u_2
β : Type u_3
R : Type u_4
inst✝ : LinearOrderedRing R
a : R
n k : ℕ
hk : n = 2 * k + 1
⊢ StrictMono fun a => a ^ n

Next tactic:
simpa only [hk, two_mul] using strictMono_pow_bit1 _
/-- A local instance that enables using "the actual value" as a priority estimator,
for simple use cases. -/
local instance instOrderBotEq : OrderBot { x : α // x = a } where
  bot := ⟨a, rfl⟩
  bot_le := by 

Proof state:
m : Type ?u.74037 → Type ?u.74036
α : Type ?u.74048
inst✝² : Monad m
inst✝¹ : Alternative m
inst✝ : LinearOrder α
a : α
⊢ ∀ (a_1 : { x // x = a }), ⊥ ≤ a_1

Next tactic:
aesop
@[simp]
theorem log_eq_zero_iff {b n : ℕ} : log b n = 0 ↔ n < b ∨ b ≤ 1 := by
  

Proof state:
b n : ℕ
⊢ log b n = 0 ↔ n < b ∨ b ≤ 1

Next tactic:
rw [log, dite_eq_right_iff]
@[simp]
theorem log_eq_zero_iff {b n : ℕ} : log b n = 0 ↔ n < b ∨ b ≤ 1 := by
  rw [log, dite_eq_right_iff]
  

Proof state:
b n : ℕ
⊢ (∀ (h : b ≤ n ∧ 1 < b),
      (let_fun this := (_ : n / b < n);
        log b (n / b) + 1) =
        0) ↔
    n < b ∨ b ≤ 1

Next tactic:
simp only [Nat.succ_ne_zero, imp_false, not_and_or, not_le, not_lt]
@[simp]
theorem log_pos_iff {b n : ℕ} : 0 < log b n ↔ b ≤ n ∧ 1 < b := by
  

Proof state:
b n : ℕ
⊢ 0 < log b n ↔ b ≤ n ∧ 1 < b

Next tactic:
rw [pos_iff_ne_zero, Ne.def, log_eq_zero_iff, not_or, not_lt, not_le]
theorem log_of_one_lt_of_le {b n : ℕ} (h : 1 < b) (hn : b ≤ n) : log b n = log b (n / b) + 1 := by
  

Proof state:
b n : ℕ
h : 1 < b
hn : b ≤ n
⊢ log b n = log b (n / b) + 1

Next tactic:
rw [log]
theorem log_of_one_lt_of_le {b n : ℕ} (h : 1 < b) (hn : b ≤ n) : log b n = log b (n / b) + 1 := by
  rw [log]
  

Proof state:
b n : ℕ
h : 1 < b
hn : b ≤ n
⊢ (if h : b ≤ n ∧ 1 < b then
      let_fun this := (_ : n / b < n);
      log b (n / b) + 1
    else 0) =
    log b (n / b) + 1

Next tactic:
exact if_pos ⟨hn, h⟩