l3lab/ntp-mathlib huggingface dataset:
theorem succ_log_def {b x : Ordinal} (hb : 1 < b) (hx : x ≠ 0) :
    succ (log b x) = sInf { o : Ordinal | x < b ^ o } := by
  let t := sInf { o : Ordinal | x < b ^ o }
  have : x < (b^t) := csInf_mem (log_nonempty hb)
  rcases zero_or_succ_or_limit t with (h | h | h)
  · refine' ((one_le_iff_ne_zero.2 hx).not_lt _).elim
    

Proof state:
case inl
b x : Ordinal.{u_1}
hb : 1 < b
hx : x ≠ 0
t : Ordinal.{u_1} := sInf {o | x < b ^ o}
this : x < b ^ t
h : t = 0
⊢ x < 1

Next tactic:
simpa only [h, opow_zero] using this
theorem succ_log_def {b x : Ordinal} (hb : 1 < b) (hx : x ≠ 0) :
    succ (log b x) = sInf { o : Ordinal | x < b ^ o } := by
  let t := sInf { o : Ordinal | x < b ^ o }
  have : x < (b^t) := csInf_mem (log_nonempty hb)
  rcases zero_or_succ_or_limit t with (h | h | h)
  · refine' ((one_le_iff_ne_zero.2 hx).not_lt _).elim
    simpa only [h, opow_zero] using this
  · 

Proof state:
case inr.inl
b x : Ordinal.{u_1}
hb : 1 < b
hx : x ≠ 0
t : Ordinal.{u_1} := sInf {o | x < b ^ o}
this : x < b ^ t
h : ∃ a, t = succ a
⊢ succ (log b x) = sInf {o | x < b ^ o}

Next tactic:
rw [show log b x = pred t from log_def hb x, succ_pred_iff_is_succ.2 h]
theorem succ_log_def {b x : Ordinal} (hb : 1 < b) (hx : x ≠ 0) :
    succ (log b x) = sInf { o : Ordinal | x < b ^ o } := by
  let t := sInf { o : Ordinal | x < b ^ o }
  have : x < (b^t) := csInf_mem (log_nonempty hb)
  rcases zero_or_succ_or_limit t with (h | h | h)
  · refine' ((one_le_iff_ne_zero.2 hx).not_lt _).elim
    simpa only [h, opow_zero] using this
  · rw [show log b x = pred t from log_def hb x, succ_pred_iff_is_succ.2 h]
  · 

Proof state:
case inr.inr
b x : Ordinal.{u_1}
hb : 1 < b
hx : x ≠ 0
t : Ordinal.{u_1} := sInf {o | x < b ^ o}
this : x < b ^ t
h : IsLimit t
⊢ succ (log b x) = sInf {o | x < b ^ o}

Next tactic:
rcases (lt_opow_of_limit (zero_lt_one.trans hb).ne' h).1 this with ⟨a, h₁, h₂⟩
theorem succ_log_def {b x : Ordinal} (hb : 1 < b) (hx : x ≠ 0) :
    succ (log b x) = sInf { o : Ordinal | x < b ^ o } := by
  let t := sInf { o : Ordinal | x < b ^ o }
  have : x < (b^t) := csInf_mem (log_nonempty hb)
  rcases zero_or_succ_or_limit t with (h | h | h)
  · refine' ((one_le_iff_ne_zero.2 hx).not_lt _).elim
    simpa only [h, opow_zero] using this
  · rw [show log b x = pred t from log_def hb x, succ_pred_iff_is_succ.2 h]
  · rcases (lt_opow_of_limit (zero_lt_one.trans hb).ne' h).1 this with ⟨a, h₁, h₂⟩
    

Proof state:
case inr.inr.intro.intro
b x : Ordinal.{u_1}
hb : 1 < b
hx : x ≠ 0
t : Ordinal.{u_1} := sInf {o | x < b ^ o}
this : x < b ^ t
h : IsLimit t
a : Ordinal.{u_1}
h₁ : a < t
h₂ : x < b ^ a
⊢ succ (log b x) = sInf {o | x < b ^ o}

Next tactic:
exact h₁.not_le.elim ((le_csInf_iff'' (log_nonempty hb)).1 le_rfl a h₂)
theorem lt_opow_succ_log_self {b : Ordinal} (hb : 1 < b) (x : Ordinal) :
    x < b ^ succ (log b x) := by
  

Proof state:
b : Ordinal.{u_1}
hb : 1 < b
x : Ordinal.{u_1}
⊢ x < b ^ succ (log b x)

Next tactic:
rcases eq_or_ne x 0 with (rfl | hx)
theorem lt_opow_succ_log_self {b : Ordinal} (hb : 1 < b) (x : Ordinal) :
    x < b ^ succ (log b x) := by
  rcases eq_or_ne x 0 with (rfl | hx)
  · 

Proof state:
case inl
b : Ordinal.{u_1}
hb : 1 < b
⊢ 0 < b ^ succ (log b 0)

Next tactic:
apply opow_pos _ (zero_lt_one.trans hb)
theorem lt_opow_succ_log_self {b : Ordinal} (hb : 1 < b) (x : Ordinal) :
    x < b ^ succ (log b x) := by
  rcases eq_or_ne x 0 with (rfl | hx)
  · apply opow_pos _ (zero_lt_one.trans hb)
  · 

Proof state:
case inr
b : Ordinal.{u_1}
hb : 1 < b
x : Ordinal.{u_1}
hx : x ≠ 0
⊢ x < b ^ succ (log b x)

Next tactic:
rw [succ_log_def hb hx]
theorem lt_opow_succ_log_self {b : Ordinal} (hb : 1 < b) (x : Ordinal) :
    x < b ^ succ (log b x) := by
  rcases eq_or_ne x 0 with (rfl | hx)
  · apply opow_pos _ (zero_lt_one.trans hb)
  · rw [succ_log_def hb hx]
    

Proof state:
case inr
b : Ordinal.{u_1}
hb : 1 < b
x : Ordinal.{u_1}
hx : x ≠ 0
⊢ x < b ^ sInf {o | x < b ^ o}

Next tactic:
exact csInf_mem (log_nonempty hb)
theorem opow_log_le_self (b : Ordinal) {x : Ordinal} (hx : x ≠ 0) : b ^ log b x ≤ x := by
  

Proof state:
b x : Ordinal.{u_1}
hx : x ≠ 0
⊢ b ^ log b x ≤ x

Next tactic:
rcases eq_or_ne b 0 with (rfl | b0)
theorem opow_log_le_self (b : Ordinal) {x : Ordinal} (hx : x ≠ 0) : b ^ log b x ≤ x := by
  rcases eq_or_ne b 0 with (rfl | b0)
  · 

Proof state:
case inl
x : Ordinal.{u_1}
hx : x ≠ 0
⊢ 0 ^ log 0 x ≤ x

Next tactic:
rw [zero_opow']
theorem opow_log_le_self (b : Ordinal) {x : Ordinal} (hx : x ≠ 0) : b ^ log b x ≤ x := by
  rcases eq_or_ne b 0 with (rfl | b0)
  · rw [zero_opow']
    

Proof state:
case inl
x : Ordinal.{u_1}
hx : x ≠ 0
⊢ 1 - log 0 x ≤ x

Next tactic:
refine' (sub_le_self _ _).trans (one_le_iff_ne_zero.2 hx)
theorem opow_log_le_self (b : Ordinal) {x : Ordinal} (hx : x ≠ 0) : b ^ log b x ≤ x := by
  rcases eq_or_ne b 0 with (rfl | b0)
  · rw [zero_opow']
    refine' (sub_le_self _ _).trans (one_le_iff_ne_zero.2 hx)
  

Proof state:
case inr
b x : Ordinal.{u_1}
hx : x ≠ 0
b0 : b ≠ 0
⊢ b ^ log b x ≤ x

Next tactic:
rcases lt_or_eq_of_le (one_le_iff_ne_zero.2 b0) with (hb | rfl)
theorem opow_log_le_self (b : Ordinal) {x : Ordinal} (hx : x ≠ 0) : b ^ log b x ≤ x := by
  rcases eq_or_ne b 0 with (rfl | b0)
  · rw [zero_opow']
    refine' (sub_le_self _ _).trans (one_le_iff_ne_zero.2 hx)
  rcases lt_or_eq_of_le (one_le_iff_ne_zero.2 b0) with (hb | rfl)
  · 

Proof state:
case inr.inl
b x : Ordinal.{u_1}
hx : x ≠ 0
b0 : b ≠ 0
hb : 1 < b
⊢ b ^ log b x ≤ x

Next tactic:
refine' le_of_not_lt fun h => (lt_succ (log b x)).not_le _
theorem opow_log_le_self (b : Ordinal) {x : Ordinal} (hx : x ≠ 0) : b ^ log b x ≤ x := by
  rcases eq_or_ne b 0 with (rfl | b0)
  · rw [zero_opow']
    refine' (sub_le_self _ _).trans (one_le_iff_ne_zero.2 hx)
  rcases lt_or_eq_of_le (one_le_iff_ne_zero.2 b0) with (hb | rfl)
  · refine' le_of_not_lt fun h => (lt_succ (log b x)).not_le _
    

Proof state:
case inr.inl
b x : Ordinal.{u_1}
hx : x ≠ 0
b0 : b ≠ 0
hb : 1 < b
h : x < b ^ log b x
⊢ succ (log b x) ≤ log b x

Next tactic:
have := @csInf_le' _ _ { o | x < b ^ o } _ h
theorem opow_log_le_self (b : Ordinal) {x : Ordinal} (hx : x ≠ 0) : b ^ log b x ≤ x := by
  rcases eq_or_ne b 0 with (rfl | b0)
  · rw [zero_opow']
    refine' (sub_le_self _ _).trans (one_le_iff_ne_zero.2 hx)
  rcases lt_or_eq_of_le (one_le_iff_ne_zero.2 b0) with (hb | rfl)
  · refine' le_of_not_lt fun h => (lt_succ (log b x)).not_le _
    have := @csInf_le' _ _ { o | x < b ^ o } _ h
    

Proof state:
case inr.inl
b x : Ordinal.{u_1}
hx : x ≠ 0
b0 : b ≠ 0
hb : 1 < b
h : x < b ^ log b x
this : sInf {o | x < b ^ o} ≤ log b x
⊢ succ (log b x) ≤ log b x

Next tactic:
rwa [← succ_log_def hb hx] at this
theorem opow_log_le_self (b : Ordinal) {x : Ordinal} (hx : x ≠ 0) : b ^ log b x ≤ x := by
  rcases eq_or_ne b 0 with (rfl | b0)
  · rw [zero_opow']
    refine' (sub_le_self _ _).trans (one_le_iff_ne_zero.2 hx)
  rcases lt_or_eq_of_le (one_le_iff_ne_zero.2 b0) with (hb | rfl)
  · refine' le_of_not_lt fun h => (lt_succ (log b x)).not_le _
    have := @csInf_le' _ _ { o | x < b ^ o } _ h
    rwa [← succ_log_def hb hx] at this
  · 

Proof state:
case inr.inr
x : Ordinal.{u_1}
hx : x ≠ 0
b0 : 1 ≠ 0
⊢ 1 ^ log 1 x ≤ x

Next tactic:
rwa [one_opow, one_le_iff_ne_zero]
theorem log_pos {b o : Ordinal} (hb : 1 < b) (ho : o ≠ 0) (hbo : b ≤ o) : 0 < log b o := by
  

Proof state:
b o : Ordinal.{u_1}
hb : 1 < b
ho : o ≠ 0
hbo : b ≤ o
⊢ 0 < log b o

Next tactic:
rwa [← succ_le_iff, succ_zero, ← opow_le_iff_le_log hb ho, opow_one]
theorem log_eq_zero {b o : Ordinal} (hbo : o < b) : log b o = 0 := by
  

Proof state:
b o : Ordinal.{u_1}
hbo : o < b
⊢ log b o = 0

Next tactic:
rcases eq_or_ne o 0 with (rfl | ho)
theorem log_eq_zero {b o : Ordinal} (hbo : o < b) : log b o = 0 := by
  rcases eq_or_ne o 0 with (rfl | ho)
  · 

Proof state:
case inl
b : Ordinal.{u_1}
hbo : 0 < b
⊢ log b 0 = 0

Next tactic:
exact log_zero_right b
theorem log_eq_zero {b o : Ordinal} (hbo : o < b) : log b o = 0 := by
  rcases eq_or_ne o 0 with (rfl | ho)
  · exact log_zero_right b
  

Proof state:
case inr
b o : Ordinal.{u_1}
hbo : o < b
ho : o ≠ 0
⊢ log b o = 0

Next tactic:
rcases le_or_lt b 1 with hb | hb
theorem log_eq_zero {b o : Ordinal} (hbo : o < b) : log b o = 0 := by
  rcases eq_or_ne o 0 with (rfl | ho)
  · exact log_zero_right b
  rcases le_or_lt b 1 with hb | hb
  · 

Proof state:
case inr.inl
b o : Ordinal.{u_1}
hbo : o < b
ho : o ≠ 0
hb : b ≤ 1
⊢ log b o = 0

Next tactic:
rcases le_one_iff.1 hb with (rfl | rfl)
theorem log_eq_zero {b o : Ordinal} (hbo : o < b) : log b o = 0 := by
  rcases eq_or_ne o 0 with (rfl | ho)
  · exact log_zero_right b
  rcases le_or_lt b 1 with hb | hb
  · rcases le_one_iff.1 hb with (rfl | rfl)
    · 

Proof state:
case inr.inl.inl
o : Ordinal.{u_1}
ho : o ≠ 0
hbo : o < 0
hb : 0 ≤ 1
⊢ log 0 o = 0

Next tactic:
exact log_zero_left o
theorem log_eq_zero {b o : Ordinal} (hbo : o < b) : log b o = 0 := by
  rcases eq_or_ne o 0 with (rfl | ho)
  · exact log_zero_right b
  rcases le_or_lt b 1 with hb | hb
  · rcases le_one_iff.1 hb with (rfl | rfl)
    · exact log_zero_left o
    · 

Proof state:
case inr.inl.inr
o : Ordinal.{u_1}
ho : o ≠ 0
hbo : o < 1
hb : 1 ≤ 1
⊢ log 1 o = 0

Next tactic:
exact log_one_left o
theorem log_eq_zero {b o : Ordinal} (hbo : o < b) : log b o = 0 := by
  rcases eq_or_ne o 0 with (rfl | ho)
  · exact log_zero_right b
  rcases le_or_lt b 1 with hb | hb
  · rcases le_one_iff.1 hb with (rfl | rfl)
    · exact log_zero_left o
    · exact log_one_left o
  · 

Proof state:
case inr.inr
b o : Ordinal.{u_1}
hbo : o < b
ho : o ≠ 0
hb : 1 < b
⊢ log b o = 0

Next tactic:
rwa [← Ordinal.le_zero, ← lt_succ_iff, succ_zero, ← lt_opow_iff_log_lt hb ho, opow_one]
@[mono]
theorem log_mono_right (b : Ordinal) {x y : Ordinal} (xy : x ≤ y) : log b x ≤ log b y :=
  if hx : x = 0 then by 

Proof state:
b x y : Ordinal.{u_1}
xy : x ≤ y
hx : x = 0
⊢ log b x ≤ log b y

Next tactic:
simp only [hx, log_zero_right, Ordinal.zero_le]
@[mono]
theorem log_mono_right (b : Ordinal) {x y : Ordinal} (xy : x ≤ y) : log b x ≤ log b y :=
  if hx : x = 0 then by simp only [hx, log_zero_right, Ordinal.zero_le]
  else
    if hb : 1 < b then
      (opow_le_iff_le_log hb (lt_of_lt_of_le (Ordinal.pos_iff_ne_zero.2 hx) xy).ne').1 <|
        (opow_log_le_self _ hx).trans xy
    else by 

Proof state:
b x y : Ordinal.{u_1}
xy : x ≤ y
hx : ¬x = 0
hb : ¬1 < b
⊢ log b x ≤ log b y

Next tactic:
simp only [log_of_not_one_lt_left hb, Ordinal.zero_le]
theorem log_le_self (b x : Ordinal) : log b x ≤ x :=
  if hx : x = 0 then by 

Proof state:
b x : Ordinal.{u_1}
hx : x = 0
⊢ log b x ≤ x

Next tactic:
simp only [hx, log_zero_right, Ordinal.zero_le]
theorem log_le_self (b x : Ordinal) : log b x ≤ x :=
  if hx : x = 0 then by simp only [hx, log_zero_right, Ordinal.zero_le]
  else
    if hb : 1 < b then (right_le_opow _ hb).trans (opow_log_le_self b hx)
    else by 

Proof state:
b x : Ordinal.{u_1}
hx : ¬x = 0
hb : ¬1 < b
⊢ log b x ≤ x

Next tactic:
simp only [log_of_not_one_lt_left hb, Ordinal.zero_le]
theorem mod_opow_log_lt_self (b : Ordinal) {o : Ordinal} (ho : o ≠ 0) : o % (b ^ log b o) < o := by
  

Proof state:
b o : Ordinal.{u_1}
ho : o ≠ 0
⊢ o % b ^ log b o < o

Next tactic:
rcases eq_or_ne b 0 with (rfl | hb)
theorem mod_opow_log_lt_self (b : Ordinal) {o : Ordinal} (ho : o ≠ 0) : o % (b ^ log b o) < o := by
  rcases eq_or_ne b 0 with (rfl | hb)
  · 

Proof state:
case inl
o : Ordinal.{u_1}
ho : o ≠ 0
⊢ o % 0 ^ log 0 o < o

Next tactic:
simpa using Ordinal.pos_iff_ne_zero.2 ho
theorem mod_opow_log_lt_self (b : Ordinal) {o : Ordinal} (ho : o ≠ 0) : o % (b ^ log b o) < o := by
  rcases eq_or_ne b 0 with (rfl | hb)
  · simpa using Ordinal.pos_iff_ne_zero.2 ho
  · 

Proof state:
case inr
b o : Ordinal.{u_1}
ho : o ≠ 0
hb : b ≠ 0
⊢ o % b ^ log b o < o

Next tactic:
exact (mod_lt _ <| opow_ne_zero _ hb).trans_le (opow_log_le_self _ ho)
theorem log_mod_opow_log_lt_log_self {b o : Ordinal} (hb : 1 < b) (ho : o ≠ 0) (hbo : b ≤ o) :
    log b (o % (b ^ log b o)) < log b o := by
  

Proof state:
b o : Ordinal.{u_1}
hb : 1 < b
ho : o ≠ 0
hbo : b ≤ o
⊢ log b (o % b ^ log b o) < log b o

Next tactic:
rcases eq_or_ne (o % (b ^ log b o)) 0 with h | h
theorem log_mod_opow_log_lt_log_self {b o : Ordinal} (hb : 1 < b) (ho : o ≠ 0) (hbo : b ≤ o) :
    log b (o % (b ^ log b o)) < log b o := by
  rcases eq_or_ne (o % (b ^ log b o)) 0 with h | h
  · 

Proof state:
case inl
b o : Ordinal.{u_1}
hb : 1 < b
ho : o ≠ 0
hbo : b ≤ o
h : o % b ^ log b o = 0
⊢ log b (o % b ^ log b o) < log b o

Next tactic:
rw [h, log_zero_right]
theorem log_mod_opow_log_lt_log_self {b o : Ordinal} (hb : 1 < b) (ho : o ≠ 0) (hbo : b ≤ o) :
    log b (o % (b ^ log b o)) < log b o := by
  rcases eq_or_ne (o % (b ^ log b o)) 0 with h | h
  · rw [h, log_zero_right]
    

Proof state:
case inl
b o : Ordinal.{u_1}
hb : 1 < b
ho : o ≠ 0
hbo : b ≤ o
h : o % b ^ log b o = 0
⊢ 0 < log b o

Next tactic:
apply log_pos hb ho hbo
theorem log_mod_opow_log_lt_log_self {b o : Ordinal} (hb : 1 < b) (ho : o ≠ 0) (hbo : b ≤ o) :
    log b (o % (b ^ log b o)) < log b o := by
  rcases eq_or_ne (o % (b ^ log b o)) 0 with h | h
  · rw [h, log_zero_right]
    apply log_pos hb ho hbo
  · 

Proof state:
case inr
b o : Ordinal.{u_1}
hb : 1 < b
ho : o ≠ 0
hbo : b ≤ o
h : o % b ^ log b o ≠ 0
⊢ log b (o % b ^ log b o) < log b o

Next tactic:
rw [← succ_le_iff, succ_log_def hb h]
theorem log_mod_opow_log_lt_log_self {b o : Ordinal} (hb : 1 < b) (ho : o ≠ 0) (hbo : b ≤ o) :
    log b (o % (b ^ log b o)) < log b o := by
  rcases eq_or_ne (o % (b ^ log b o)) 0 with h | h
  · rw [h, log_zero_right]
    apply log_pos hb ho hbo
  · rw [← succ_le_iff, succ_log_def hb h]
    

Proof state:
case inr
b o : Ordinal.{u_1}
hb : 1 < b
ho : o ≠ 0
hbo : b ≤ o
h : o % b ^ log b o ≠ 0
⊢ sInf {o_1 | o % b ^ log b o < b ^ o_1} ≤ log b o

Next tactic:
apply csInf_le'
theorem log_mod_opow_log_lt_log_self {b o : Ordinal} (hb : 1 < b) (ho : o ≠ 0) (hbo : b ≤ o) :
    log b (o % (b ^ log b o)) < log b o := by
  rcases eq_or_ne (o % (b ^ log b o)) 0 with h | h
  · rw [h, log_zero_right]
    apply log_pos hb ho hbo
  · rw [← succ_le_iff, succ_log_def hb h]
    apply csInf_le'
    

Proof state:
case inr.h
b o : Ordinal.{u_1}
hb : 1 < b
ho : o ≠ 0
hbo : b ≤ o
h : o % b ^ log b o ≠ 0
⊢ log b o ∈ {o_1 | o % b ^ log b o < b ^ o_1}

Next tactic:
apply mod_lt
theorem log_mod_opow_log_lt_log_self {b o : Ordinal} (hb : 1 < b) (ho : o ≠ 0) (hbo : b ≤ o) :
    log b (o % (b ^ log b o)) < log b o := by
  rcases eq_or_ne (o % (b ^ log b o)) 0 with h | h
  · rw [h, log_zero_right]
    apply log_pos hb ho hbo
  · rw [← succ_le_iff, succ_log_def hb h]
    apply csInf_le'
    apply mod_lt
    

Proof state:
case inr.h.h
b o : Ordinal.{u_1}
hb : 1 < b
ho : o ≠ 0
hbo : b ≤ o
h : o % b ^ log b o ≠ 0
⊢ b ^ log b o ≠ 0

Next tactic:
rw [← Ordinal.pos_iff_ne_zero]
theorem log_mod_opow_log_lt_log_self {b o : Ordinal} (hb : 1 < b) (ho : o ≠ 0) (hbo : b ≤ o) :
    log b (o % (b ^ log b o)) < log b o := by
  rcases eq_or_ne (o % (b ^ log b o)) 0 with h | h
  · rw [h, log_zero_right]
    apply log_pos hb ho hbo
  · rw [← succ_le_iff, succ_log_def hb h]
    apply csInf_le'
    apply mod_lt
    rw [← Ordinal.pos_iff_ne_zero]
    

Proof state:
case inr.h.h
b o : Ordinal.{u_1}
hb : 1 < b
ho : o ≠ 0
hbo : b ≤ o
h : o % b ^ log b o ≠ 0
⊢ 0 < b ^ log b o

Next tactic:
exact opow_pos _ (zero_lt_one.trans hb)
theorem opow_mul_add_lt_opow_mul_succ {b u w : Ordinal} (v : Ordinal) (hw : w < b ^ u) :
    b ^ u * v + w < b ^ u * succ v := by 

Proof state:
b u w v : Ordinal.{u_1}
hw : w < b ^ u
⊢ b ^ u * v + w < b ^ u * succ v

Next tactic:
rwa [mul_succ, add_lt_add_iff_left]
theorem opow_mul_add_lt_opow_succ {b u v w : Ordinal} (hvb : v < b) (hw : w < b ^ u) :
    b ^ u * v + w < b ^ succ u := by
  

Proof state:
b u v w : Ordinal.{u_1}
hvb : v < b
hw : w < b ^ u
⊢ b ^ u * v + w < b ^ succ u

Next tactic:
convert (opow_mul_add_lt_opow_mul_succ v hw).trans_le (mul_le_mul_left' (succ_le_of_lt hvb) _)
    using 1
theorem opow_mul_add_lt_opow_succ {b u v w : Ordinal} (hvb : v < b) (hw : w < b ^ u) :
    b ^ u * v + w < b ^ succ u := by
  convert (opow_mul_add_lt_opow_mul_succ v hw).trans_le (mul_le_mul_left' (succ_le_of_lt hvb) _)
    using 1
  

Proof state:
case h.e'_4
b u v w : Ordinal.{u_1}
hvb : v < b
hw : w < b ^ u
⊢ b ^ succ u = b ^ u * b

Next tactic:
exact opow_succ b u
theorem log_opow_mul_add {b u v w : Ordinal} (hb : 1 < b) (hv : v ≠ 0) (hvb : v < b)
    (hw : w < b ^ u) : log b (b ^ u * v + w) = u := by
  

Proof state:
b u v w : Ordinal.{u_1}
hb : 1 < b
hv : v ≠ 0
hvb : v < b
hw : w < b ^ u
⊢ log b (b ^ u * v + w) = u

Next tactic:
have hne' := (opow_mul_add_pos (zero_lt_one.trans hb).ne' u hv w).ne'
theorem log_opow_mul_add {b u v w : Ordinal} (hb : 1 < b) (hv : v ≠ 0) (hvb : v < b)
    (hw : w < b ^ u) : log b (b ^ u * v + w) = u := by
  have hne' := (opow_mul_add_pos (zero_lt_one.trans hb).ne' u hv w).ne'
  

Proof state:
b u v w : Ordinal.{u_1}
hb : 1 < b
hv : v ≠ 0
hvb : v < b
hw : w < b ^ u
hne' : b ^ u * v + w ≠ 0
⊢ log b (b ^ u * v + w) = u

Next tactic:
by_contra! hne
theorem log_opow_mul_add {b u v w : Ordinal} (hb : 1 < b) (hv : v ≠ 0) (hvb : v < b)
    (hw : w < b ^ u) : log b (b ^ u * v + w) = u := by
  have hne' := (opow_mul_add_pos (zero_lt_one.trans hb).ne' u hv w).ne'
  by_contra! hne
  

Proof state:
b u v w : Ordinal.{u_1}
hb : 1 < b
hv : v ≠ 0
hvb : v < b
hw : w < b ^ u
hne' : b ^ u * v + w ≠ 0
hne : log b (b ^ u * v + w) ≠ u
⊢ False

Next tactic:
cases' lt_or_gt_of_ne hne with h h
theorem log_opow_mul_add {b u v w : Ordinal} (hb : 1 < b) (hv : v ≠ 0) (hvb : v < b)
    (hw : w < b ^ u) : log b (b ^ u * v + w) = u := by
  have hne' := (opow_mul_add_pos (zero_lt_one.trans hb).ne' u hv w).ne'
  by_contra! hne
  cases' lt_or_gt_of_ne hne with h h
  · 

Proof state:
case inl
b u v w : Ordinal.{u_1}
hb : 1 < b
hv : v ≠ 0
hvb : v < b
hw : w < b ^ u
hne' : b ^ u * v + w ≠ 0
hne : log b (b ^ u * v + w) ≠ u
h : log b (b ^ u * v + w) < u
⊢ False

Next tactic:
rw [← lt_opow_iff_log_lt hb hne'] at h
theorem log_opow_mul_add {b u v w : Ordinal} (hb : 1 < b) (hv : v ≠ 0) (hvb : v < b)
    (hw : w < b ^ u) : log b (b ^ u * v + w) = u := by
  have hne' := (opow_mul_add_pos (zero_lt_one.trans hb).ne' u hv w).ne'
  by_contra! hne
  cases' lt_or_gt_of_ne hne with h h
  · rw [← lt_opow_iff_log_lt hb hne'] at h
    

Proof state:
case inl
b u v w : Ordinal.{u_1}
hb : 1 < b
hv : v ≠ 0
hvb : v < b
hw : w < b ^ u
hne' : b ^ u * v + w ≠ 0
hne : log b (b ^ u * v + w) ≠ u
h : b ^ u * v + w < b ^ u
⊢ False

Next tactic:
exact h.not_le ((le_mul_left _ (Ordinal.pos_iff_ne_zero.2 hv)).trans (le_add_right _ _))
theorem log_opow_mul_add {b u v w : Ordinal} (hb : 1 < b) (hv : v ≠ 0) (hvb : v < b)
    (hw : w < b ^ u) : log b (b ^ u * v + w) = u := by
  have hne' := (opow_mul_add_pos (zero_lt_one.trans hb).ne' u hv w).ne'
  by_contra! hne
  cases' lt_or_gt_of_ne hne with h h
  · rw [← lt_opow_iff_log_lt hb hne'] at h
    exact h.not_le ((le_mul_left _ (Ordinal.pos_iff_ne_zero.2 hv)).trans (le_add_right _ _))
  · 

Proof state:
case inr
b u v w : Ordinal.{u_1}
hb : 1 < b
hv : v ≠ 0
hvb : v < b
hw : w < b ^ u
hne' : b ^ u * v + w ≠ 0
hne : log b (b ^ u * v + w) ≠ u
h : log b (b ^ u * v + w) > u
⊢ False

Next tactic:
conv at h => change u < log b (b ^ u * v + w)
theorem log_opow_mul_add {b u v w : Ordinal} (hb : 1 < b) (hv : v ≠ 0) (hvb : v < b)
    (hw : w < b ^ u) : log b (b ^ u * v + w) = u := by
  have hne' := (opow_mul_add_pos (zero_lt_one.trans hb).ne' u hv w).ne'
  by_contra! hne
  cases' lt_or_gt_of_ne hne with h h
  · rw [← lt_opow_iff_log_lt hb hne'] at h
    exact h.not_le ((le_mul_left _ (Ordinal.pos_iff_ne_zero.2 hv)).trans (le_add_right _ _))
  · conv at h => 

Proof state:
b u v w : Ordinal.{u_1}
hb : 1 < b
hv : v ≠ 0
hvb : v < b
hw : w < b ^ u
hne' : b ^ u * v + w ≠ 0
hne : log b (b ^ u * v + w) ≠ u
h : log b (b ^ u * v + w) > u
| log b (b ^ u * v + w) > u

Next tactic:
change u < log b (b ^ u * v + w)
theorem log_opow_mul_add {b u v w : Ordinal} (hb : 1 < b) (hv : v ≠ 0) (hvb : v < b)
    (hw : w < b ^ u) : log b (b ^ u * v + w) = u := by
  have hne' := (opow_mul_add_pos (zero_lt_one.trans hb).ne' u hv w).ne'
  by_contra! hne
  cases' lt_or_gt_of_ne hne with h h
  · rw [← lt_opow_iff_log_lt hb hne'] at h
    exact h.not_le ((le_mul_left _ (Ordinal.pos_iff_ne_zero.2 hv)).trans (le_add_right _ _))
  · conv at h => change u < log b (b ^ u * v + w)
    

Proof state:
case inr
b u v w : Ordinal.{u_1}
hb : 1 < b
hv : v ≠ 0
hvb : v < b
hw : w < b ^ u
hne' : b ^ u * v + w ≠ 0
hne : log b (b ^ u * v + w) ≠ u
h : u < log b (b ^ u * v + w)
⊢ False

Next tactic:
rw [← succ_le_iff, ← opow_le_iff_le_log hb hne'] at h
theorem log_opow_mul_add {b u v w : Ordinal} (hb : 1 < b) (hv : v ≠ 0) (hvb : v < b)
    (hw : w < b ^ u) : log b (b ^ u * v + w) = u := by
  have hne' := (opow_mul_add_pos (zero_lt_one.trans hb).ne' u hv w).ne'
  by_contra! hne
  cases' lt_or_gt_of_ne hne with h h
  · rw [← lt_opow_iff_log_lt hb hne'] at h
    exact h.not_le ((le_mul_left _ (Ordinal.pos_iff_ne_zero.2 hv)).trans (le_add_right _ _))
  · conv at h => change u < log b (b ^ u * v + w)
    rw [← succ_le_iff, ← opow_le_iff_le_log hb hne'] at h
    

Proof state:
case inr
b u v w : Ordinal.{u_1}
hb : 1 < b
hv : v ≠ 0
hvb : v < b
hw : w < b ^ u
hne' : b ^ u * v + w ≠ 0
hne : log b (b ^ u * v + w) ≠ u
h : b ^ succ u ≤ b ^ u * v + w
⊢ False

Next tactic:
exact (not_lt_of_le h) (opow_mul_add_lt_opow_succ hvb hw)
theorem log_opow {b : Ordinal} (hb : 1 < b) (x : Ordinal) : log b (b ^ x) = x := by
  

Proof state:
b : Ordinal.{u_1}
hb : 1 < b
x : Ordinal.{u_1}
⊢ log b (b ^ x) = x

Next tactic:
convert log_opow_mul_add hb zero_ne_one.symm hb (opow_pos x (zero_lt_one.trans hb))
    using 1
theorem log_opow {b : Ordinal} (hb : 1 < b) (x : Ordinal) : log b (b ^ x) = x := by
  convert log_opow_mul_add hb zero_ne_one.symm hb (opow_pos x (zero_lt_one.trans hb))
    using 1
  

Proof state:
case h.e'_2
b : Ordinal.{u_1}
hb : 1 < b
x : Ordinal.{u_1}
⊢ log b (b ^ x) = log b (b ^ x * 1 + 0)

Next tactic:
rw [add_zero, mul_one]
theorem div_opow_log_pos (b : Ordinal) {o : Ordinal} (ho : o ≠ 0) : 0 < o / (b ^ log b o) := by
  

Proof state:
b o : Ordinal.{u_1}
ho : o ≠ 0
⊢ 0 < o / b ^ log b o

Next tactic:
rcases eq_zero_or_pos b with (rfl | hb)
theorem div_opow_log_pos (b : Ordinal) {o : Ordinal} (ho : o ≠ 0) : 0 < o / (b ^ log b o) := by
  rcases eq_zero_or_pos b with (rfl | hb)
  · 

Proof state:
case inl
o : Ordinal.{u_1}
ho : o ≠ 0
⊢ 0 < o / 0 ^ log 0 o

Next tactic:
simpa using Ordinal.pos_iff_ne_zero.2 ho
theorem div_opow_log_pos (b : Ordinal) {o : Ordinal} (ho : o ≠ 0) : 0 < o / (b ^ log b o) := by
  rcases eq_zero_or_pos b with (rfl | hb)
  · simpa using Ordinal.pos_iff_ne_zero.2 ho
  · 

Proof state:
case inr
b o : Ordinal.{u_1}
ho : o ≠ 0
hb : 0 < b
⊢ 0 < o / b ^ log b o

Next tactic:
rw [div_pos (opow_ne_zero _ hb.ne')]
theorem div_opow_log_pos (b : Ordinal) {o : Ordinal} (ho : o ≠ 0) : 0 < o / (b ^ log b o) := by
  rcases eq_zero_or_pos b with (rfl | hb)
  · simpa using Ordinal.pos_iff_ne_zero.2 ho
  · rw [div_pos (opow_ne_zero _ hb.ne')]
    

Proof state:
case inr
b o : Ordinal.{u_1}
ho : o ≠ 0
hb : 0 < b
⊢ b ^ log b o ≤ o

Next tactic:
exact opow_log_le_self b ho
theorem div_opow_log_lt {b : Ordinal} (o : Ordinal) (hb : 1 < b) : o / (b ^ log b o) < b := by
  

Proof state:
b o : Ordinal.{u_1}
hb : 1 < b
⊢ o / b ^ log b o < b

Next tactic:
rw [div_lt (opow_pos _ (zero_lt_one.trans hb)).ne', ← opow_succ]
theorem div_opow_log_lt {b : Ordinal} (o : Ordinal) (hb : 1 < b) : o / (b ^ log b o) < b := by
  rw [div_lt (opow_pos _ (zero_lt_one.trans hb)).ne', ← opow_succ]
  

Proof state:
b o : Ordinal.{u_1}
hb : 1 < b
⊢ o < b ^ succ (log b o)

Next tactic:
exact lt_opow_succ_log_self hb o
theorem add_log_le_log_mul {x y : Ordinal} (b : Ordinal) (hx : x ≠ 0) (hy : y ≠ 0) :
    log b x + log b y ≤ log b (x * y) := by
  

Proof state:
x y b : Ordinal.{u_1}
hx : x ≠ 0
hy : y ≠ 0
⊢ log b x + log b y ≤ log b (x * y)

Next tactic:
by_cases hb : 1 < b
theorem add_log_le_log_mul {x y : Ordinal} (b : Ordinal) (hx : x ≠ 0) (hy : y ≠ 0) :
    log b x + log b y ≤ log b (x * y) := by
  by_cases hb : 1 < b
  · 

Proof state:
case pos
x y b : Ordinal.{u_1}
hx : x ≠ 0
hy : y ≠ 0
hb : 1 < b
⊢ log b x + log b y ≤ log b (x * y)

Next tactic:
rw [← opow_le_iff_le_log hb (mul_ne_zero hx hy), opow_add]