l3lab/ntp-mathlib huggingface dataset:
protected theorem lt_add_iff_pos_right {x y : PartENat} (hx : x ≠ ⊤) : x < x + y ↔ 0 < y := by
  

Proof state:
x y : PartENat
hx : x ≠ ⊤
⊢ x < x + y ↔ 0 < y

Next tactic:
conv_rhs => rw [← PartENat.add_lt_add_iff_left hx]
protected theorem lt_add_iff_pos_right {x y : PartENat} (hx : x ≠ ⊤) : x < x + y ↔ 0 < y := by
  conv_rhs => 

Proof state:
x y : PartENat
hx : x ≠ ⊤
| 0 < y

Next tactic:
rw [← PartENat.add_lt_add_iff_left hx]
protected theorem lt_add_iff_pos_right {x y : PartENat} (hx : x ≠ ⊤) : x < x + y ↔ 0 < y := by
  conv_rhs => rw [← PartENat.add_lt_add_iff_left hx]
  

Proof state:
x y : PartENat
hx : x ≠ ⊤
⊢ x < x + y ↔ x + 0 < x + y

Next tactic:
rw [add_zero]
theorem lt_add_one {x : PartENat} (hx : x ≠ ⊤) : x < x + 1 := by
  

Proof state:
x : PartENat
hx : x ≠ ⊤
⊢ x < x + 1

Next tactic:
rw [PartENat.lt_add_iff_pos_right hx]
theorem lt_add_one {x : PartENat} (hx : x ≠ ⊤) : x < x + 1 := by
  rw [PartENat.lt_add_iff_pos_right hx]
  

Proof state:
x : PartENat
hx : x ≠ ⊤
⊢ 0 < 1

Next tactic:
norm_cast
theorem le_of_lt_add_one {x y : PartENat} (h : x < y + 1) : x ≤ y := by
  

Proof state:
x y : PartENat
h : x < y + 1
⊢ x ≤ y

Next tactic:
induction' y using PartENat.casesOn with n
theorem le_of_lt_add_one {x y : PartENat} (h : x < y + 1) : x ≤ y := by
  induction' y using PartENat.casesOn with n
  · 

Proof state:
case a
x : PartENat
h : x < ⊤ + 1
⊢ x ≤ ⊤

Next tactic:
apply le_top
theorem le_of_lt_add_one {x y : PartENat} (h : x < y + 1) : x ≤ y := by
  induction' y using PartENat.casesOn with n
  · apply le_top
  

Proof state:
case a
x : PartENat
n : ℕ
h : x < ↑n + 1
⊢ x ≤ ↑n

Next tactic:
rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
theorem le_of_lt_add_one {x y : PartENat} (h : x < y + 1) : x ≤ y := by
  induction' y using PartENat.casesOn with n
  · apply le_top
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  -- Porting note: was `apply_mod_cast Nat.le_of_lt_succ; apply_mod_cast h`
  

Proof state:
case a.intro
n m : ℕ
h : ↑m < ↑n + 1
⊢ ↑m ≤ ↑n

Next tactic:
norm_cast
theorem le_of_lt_add_one {x y : PartENat} (h : x < y + 1) : x ≤ y := by
  induction' y using PartENat.casesOn with n
  · apply le_top
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  -- Porting note: was `apply_mod_cast Nat.le_of_lt_succ; apply_mod_cast h`
  norm_cast; 

Proof state:
case a.intro
n m : ℕ
h : ↑m < ↑n + 1
⊢ m ≤ n

Next tactic:
apply Nat.le_of_lt_succ
theorem le_of_lt_add_one {x y : PartENat} (h : x < y + 1) : x ≤ y := by
  induction' y using PartENat.casesOn with n
  · apply le_top
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  -- Porting note: was `apply_mod_cast Nat.le_of_lt_succ; apply_mod_cast h`
  norm_cast; apply Nat.le_of_lt_succ; 

Proof state:
case a.intro.a
n m : ℕ
h : ↑m < ↑n + 1
⊢ m < Nat.succ n

Next tactic:
norm_cast at h
theorem add_one_le_of_lt {x y : PartENat} (h : x < y) : x + 1 ≤ y := by
  

Proof state:
x y : PartENat
h : x < y
⊢ x + 1 ≤ y

Next tactic:
induction' y using PartENat.casesOn with n
theorem add_one_le_of_lt {x y : PartENat} (h : x < y) : x + 1 ≤ y := by
  induction' y using PartENat.casesOn with n
  · 

Proof state:
case a
x : PartENat
h : x < ⊤
⊢ x + 1 ≤ ⊤

Next tactic:
apply le_top
theorem add_one_le_of_lt {x y : PartENat} (h : x < y) : x + 1 ≤ y := by
  induction' y using PartENat.casesOn with n
  · apply le_top
  

Proof state:
case a
x : PartENat
n : ℕ
h : x < ↑n
⊢ x + 1 ≤ ↑n

Next tactic:
rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
theorem add_one_le_of_lt {x y : PartENat} (h : x < y) : x + 1 ≤ y := by
  induction' y using PartENat.casesOn with n
  · apply le_top
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  -- Porting note: was `apply_mod_cast Nat.succ_le_of_lt; apply_mod_cast h`
  

Proof state:
case a.intro
n m : ℕ
h : ↑m < ↑n
⊢ ↑m + 1 ≤ ↑n

Next tactic:
norm_cast
theorem add_one_le_of_lt {x y : PartENat} (h : x < y) : x + 1 ≤ y := by
  induction' y using PartENat.casesOn with n
  · apply le_top
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  -- Porting note: was `apply_mod_cast Nat.succ_le_of_lt; apply_mod_cast h`
  norm_cast; 

Proof state:
case a.intro
n m : ℕ
h : ↑m < ↑n
⊢ m + 1 ≤ n

Next tactic:
apply Nat.succ_le_of_lt
theorem add_one_le_of_lt {x y : PartENat} (h : x < y) : x + 1 ≤ y := by
  induction' y using PartENat.casesOn with n
  · apply le_top
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  -- Porting note: was `apply_mod_cast Nat.succ_le_of_lt; apply_mod_cast h`
  norm_cast; apply Nat.succ_le_of_lt; 

Proof state:
case a.intro.h
n m : ℕ
h : ↑m < ↑n
⊢ m < n

Next tactic:
norm_cast at h
theorem add_one_le_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x + 1 ≤ y ↔ x < y := by
  

Proof state:
x y : PartENat
hx : x ≠ ⊤
⊢ x + 1 ≤ y ↔ x < y

Next tactic:
refine ⟨fun h => ?_, add_one_le_of_lt⟩
theorem add_one_le_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x + 1 ≤ y ↔ x < y := by
  refine ⟨fun h => ?_, add_one_le_of_lt⟩
  

Proof state:
x y : PartENat
hx : x ≠ ⊤
h : x + 1 ≤ y
⊢ x < y

Next tactic:
rcases ne_top_iff.mp hx with ⟨m, rfl⟩
theorem add_one_le_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x + 1 ≤ y ↔ x < y := by
  refine ⟨fun h => ?_, add_one_le_of_lt⟩
  rcases ne_top_iff.mp hx with ⟨m, rfl⟩
  

Proof state:
case intro
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h : ↑m + 1 ≤ y
⊢ ↑m < y

Next tactic:
induction' y using PartENat.casesOn with n
theorem add_one_le_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x + 1 ≤ y ↔ x < y := by
  refine ⟨fun h => ?_, add_one_le_of_lt⟩
  rcases ne_top_iff.mp hx with ⟨m, rfl⟩
  induction' y using PartENat.casesOn with n
  · 

Proof state:
case intro.a
m : ℕ
hx : ↑m ≠ ⊤
h : ↑m + 1 ≤ ⊤
⊢ ↑m < ⊤

Next tactic:
apply natCast_lt_top
theorem add_one_le_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x + 1 ≤ y ↔ x < y := by
  refine ⟨fun h => ?_, add_one_le_of_lt⟩
  rcases ne_top_iff.mp hx with ⟨m, rfl⟩
  induction' y using PartENat.casesOn with n
  · apply natCast_lt_top
  -- Porting note: was `apply_mod_cast Nat.lt_of_succ_le; apply_mod_cast h`
  

Proof state:
case intro.a
m : ℕ
hx : ↑m ≠ ⊤
n : ℕ
h : ↑m + 1 ≤ ↑n
⊢ ↑m < ↑n

Next tactic:
norm_cast
theorem add_one_le_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x + 1 ≤ y ↔ x < y := by
  refine ⟨fun h => ?_, add_one_le_of_lt⟩
  rcases ne_top_iff.mp hx with ⟨m, rfl⟩
  induction' y using PartENat.casesOn with n
  · apply natCast_lt_top
  -- Porting note: was `apply_mod_cast Nat.lt_of_succ_le; apply_mod_cast h`
  norm_cast; 

Proof state:
case intro.a
m : ℕ
hx : ↑m ≠ ⊤
n : ℕ
h : ↑m + 1 ≤ ↑n
⊢ m < n

Next tactic:
apply Nat.lt_of_succ_le
theorem add_one_le_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x + 1 ≤ y ↔ x < y := by
  refine ⟨fun h => ?_, add_one_le_of_lt⟩
  rcases ne_top_iff.mp hx with ⟨m, rfl⟩
  induction' y using PartENat.casesOn with n
  · apply natCast_lt_top
  -- Porting note: was `apply_mod_cast Nat.lt_of_succ_le; apply_mod_cast h`
  norm_cast; apply Nat.lt_of_succ_le; 

Proof state:
case intro.a.h
m : ℕ
hx : ↑m ≠ ⊤
n : ℕ
h : ↑m + 1 ≤ ↑n
⊢ Nat.succ m ≤ n

Next tactic:
norm_cast at h
theorem coe_succ_le_iff {n : ℕ} {e : PartENat} : ↑n.succ ≤ e ↔ ↑n < e := by
  

Proof state:
n : ℕ
e : PartENat
⊢ ↑(Nat.succ n) ≤ e ↔ ↑n < e

Next tactic:
rw [Nat.succ_eq_add_one n, Nat.cast_add, Nat.cast_one, add_one_le_iff_lt (natCast_ne_top n)]
theorem lt_add_one_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x < y + 1 ↔ x ≤ y := by
  

Proof state:
x y : PartENat
hx : x ≠ ⊤
⊢ x < y + 1 ↔ x ≤ y

Next tactic:
refine ⟨le_of_lt_add_one, fun h => ?_⟩
theorem lt_add_one_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x < y + 1 ↔ x ≤ y := by
  refine ⟨le_of_lt_add_one, fun h => ?_⟩
  

Proof state:
x y : PartENat
hx : x ≠ ⊤
h : x ≤ y
⊢ x < y + 1

Next tactic:
rcases ne_top_iff.mp hx with ⟨m, rfl⟩
theorem lt_add_one_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x < y + 1 ↔ x ≤ y := by
  refine ⟨le_of_lt_add_one, fun h => ?_⟩
  rcases ne_top_iff.mp hx with ⟨m, rfl⟩
  

Proof state:
case intro
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h : ↑m ≤ y
⊢ ↑m < y + 1

Next tactic:
induction' y using PartENat.casesOn with n
theorem lt_add_one_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x < y + 1 ↔ x ≤ y := by
  refine ⟨le_of_lt_add_one, fun h => ?_⟩
  rcases ne_top_iff.mp hx with ⟨m, rfl⟩
  induction' y using PartENat.casesOn with n
  · 

Proof state:
case intro.a
m : ℕ
hx : ↑m ≠ ⊤
h : ↑m ≤ ⊤
⊢ ↑m < ⊤ + 1

Next tactic:
rw [top_add]
theorem lt_add_one_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x < y + 1 ↔ x ≤ y := by
  refine ⟨le_of_lt_add_one, fun h => ?_⟩
  rcases ne_top_iff.mp hx with ⟨m, rfl⟩
  induction' y using PartENat.casesOn with n
  · rw [top_add]
    

Proof state:
case intro.a
m : ℕ
hx : ↑m ≠ ⊤
h : ↑m ≤ ⊤
⊢ ↑m < ⊤

Next tactic:
apply natCast_lt_top
theorem lt_add_one_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x < y + 1 ↔ x ≤ y := by
  refine ⟨le_of_lt_add_one, fun h => ?_⟩
  rcases ne_top_iff.mp hx with ⟨m, rfl⟩
  induction' y using PartENat.casesOn with n
  · rw [top_add]
    apply natCast_lt_top
  -- Porting note: was `apply_mod_cast Nat.lt_succ_of_le; apply_mod_cast h`
  

Proof state:
case intro.a
m : ℕ
hx : ↑m ≠ ⊤
n : ℕ
h : ↑m ≤ ↑n
⊢ ↑m < ↑n + 1

Next tactic:
norm_cast
theorem lt_add_one_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x < y + 1 ↔ x ≤ y := by
  refine ⟨le_of_lt_add_one, fun h => ?_⟩
  rcases ne_top_iff.mp hx with ⟨m, rfl⟩
  induction' y using PartENat.casesOn with n
  · rw [top_add]
    apply natCast_lt_top
  -- Porting note: was `apply_mod_cast Nat.lt_succ_of_le; apply_mod_cast h`
  norm_cast; 

Proof state:
case intro.a
m : ℕ
hx : ↑m ≠ ⊤
n : ℕ
h : ↑m ≤ ↑n
⊢ m < n + 1

Next tactic:
apply Nat.lt_succ_of_le
theorem lt_add_one_iff_lt {x y : PartENat} (hx : x ≠ ⊤) : x < y + 1 ↔ x ≤ y := by
  refine ⟨le_of_lt_add_one, fun h => ?_⟩
  rcases ne_top_iff.mp hx with ⟨m, rfl⟩
  induction' y using PartENat.casesOn with n
  · rw [top_add]
    apply natCast_lt_top
  -- Porting note: was `apply_mod_cast Nat.lt_succ_of_le; apply_mod_cast h`
  norm_cast; apply Nat.lt_succ_of_le; 

Proof state:
case intro.a.a
m : ℕ
hx : ↑m ≠ ⊤
n : ℕ
h : ↑m ≤ ↑n
⊢ m ≤ n

Next tactic:
norm_cast at h
lemma lt_coe_succ_iff_le {x : PartENat} {n : ℕ} (hx : x ≠ ⊤) : x < n.succ ↔ x ≤ n := by
  

Proof state:
x : PartENat
n : ℕ
hx : x ≠ ⊤
⊢ x < ↑(Nat.succ n) ↔ x ≤ ↑n

Next tactic:
rw [Nat.succ_eq_add_one n, Nat.cast_add, Nat.cast_one, lt_add_one_iff_lt hx]
theorem add_eq_top_iff {a b : PartENat} : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by
  

Proof state:
a b : PartENat
⊢ a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤

Next tactic:
refine PartENat.casesOn a ?_ ?_
theorem add_eq_top_iff {a b : PartENat} : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by
  refine PartENat.casesOn a ?_ ?_
  <;> 

Proof state:
case refine_1
a b : PartENat
⊢ ⊤ + b = ⊤ ↔ ⊤ = ⊤ ∨ b = ⊤

Next tactic:
refine PartENat.casesOn b ?_ ?_
theorem add_eq_top_iff {a b : PartENat} : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by
  refine PartENat.casesOn a ?_ ?_
  <;> 

Proof state:
case refine_2
a b : PartENat
⊢ ∀ (n : ℕ), ↑n + b = ⊤ ↔ ↑n = ⊤ ∨ b = ⊤

Next tactic:
refine PartENat.casesOn b ?_ ?_
theorem add_eq_top_iff {a b : PartENat} : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by
  refine PartENat.casesOn a ?_ ?_
  <;> refine PartENat.casesOn b ?_ ?_
  <;> 

Proof state:
case refine_1.refine_1
a b : PartENat
⊢ ⊤ + ⊤ = ⊤ ↔ ⊤ = ⊤ ∨ ⊤ = ⊤

Next tactic:
simp [top_add, add_top]
theorem add_eq_top_iff {a b : PartENat} : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by
  refine PartENat.casesOn a ?_ ?_
  <;> refine PartENat.casesOn b ?_ ?_
  <;> 

Proof state:
case refine_1.refine_2
a b : PartENat
⊢ ∀ (n : ℕ), ⊤ + ↑n = ⊤ ↔ ⊤ = ⊤ ∨ ↑n = ⊤

Next tactic:
simp [top_add, add_top]
theorem add_eq_top_iff {a b : PartENat} : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by
  refine PartENat.casesOn a ?_ ?_
  <;> refine PartENat.casesOn b ?_ ?_
  <;> 

Proof state:
case refine_2.refine_1
a b : PartENat
⊢ ∀ (n : ℕ), ↑n + ⊤ = ⊤ ↔ ↑n = ⊤ ∨ ⊤ = ⊤

Next tactic:
simp [top_add, add_top]
theorem add_eq_top_iff {a b : PartENat} : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by
  refine PartENat.casesOn a ?_ ?_
  <;> refine PartENat.casesOn b ?_ ?_
  <;> 

Proof state:
case refine_2.refine_2
a b : PartENat
⊢ ∀ (n n_1 : ℕ), ↑n_1 + ↑n = ⊤ ↔ ↑n_1 = ⊤ ∨ ↑n = ⊤

Next tactic:
simp [top_add, add_top]
theorem add_eq_top_iff {a b : PartENat} : a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤ := by
  refine PartENat.casesOn a ?_ ?_
  <;> refine PartENat.casesOn b ?_ ?_
  <;> simp [top_add, add_top]
  

Proof state:
case refine_2.refine_2
a b : PartENat
⊢ ∀ (n n_1 : ℕ), ¬↑n_1 + ↑n = ⊤

Next tactic:
simp only [← Nat.cast_add, PartENat.natCast_ne_top, forall_const, not_false_eq_true]
protected theorem add_right_cancel_iff {a b c : PartENat} (hc : c ≠ ⊤) : a + c = b + c ↔ a = b := by
  

Proof state:
a b c : PartENat
hc : c ≠ ⊤
⊢ a + c = b + c ↔ a = b

Next tactic:
rcases ne_top_iff.1 hc with ⟨c, rfl⟩
protected theorem add_right_cancel_iff {a b c : PartENat} (hc : c ≠ ⊤) : a + c = b + c ↔ a = b := by
  rcases ne_top_iff.1 hc with ⟨c, rfl⟩
  

Proof state:
case intro
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ a + ↑c = b + ↑c ↔ a = b

Next tactic:
refine PartENat.casesOn a ?_ ?_
protected theorem add_right_cancel_iff {a b c : PartENat} (hc : c ≠ ⊤) : a + c = b + c ↔ a = b := by
  rcases ne_top_iff.1 hc with ⟨c, rfl⟩
  refine PartENat.casesOn a ?_ ?_
  <;> 

Proof state:
case intro.refine_1
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ⊤ + ↑c = b + ↑c ↔ ⊤ = b

Next tactic:
refine PartENat.casesOn b ?_ ?_
protected theorem add_right_cancel_iff {a b c : PartENat} (hc : c ≠ ⊤) : a + c = b + c ↔ a = b := by
  rcases ne_top_iff.1 hc with ⟨c, rfl⟩
  refine PartENat.casesOn a ?_ ?_
  <;> 

Proof state:
case intro.refine_2
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ∀ (n : ℕ), ↑n + ↑c = b + ↑c ↔ ↑n = b

Next tactic:
refine PartENat.casesOn b ?_ ?_
protected theorem add_right_cancel_iff {a b c : PartENat} (hc : c ≠ ⊤) : a + c = b + c ↔ a = b := by
  rcases ne_top_iff.1 hc with ⟨c, rfl⟩
  refine PartENat.casesOn a ?_ ?_
  <;> refine PartENat.casesOn b ?_ ?_
  <;> 

Proof state:
case intro.refine_1.refine_1
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ⊤ + ↑c = ⊤ + ↑c ↔ ⊤ = ⊤

Next tactic:
simp [add_eq_top_iff, natCast_ne_top, @eq_comm _ (⊤ : PartENat), top_add]
protected theorem add_right_cancel_iff {a b c : PartENat} (hc : c ≠ ⊤) : a + c = b + c ↔ a = b := by
  rcases ne_top_iff.1 hc with ⟨c, rfl⟩
  refine PartENat.casesOn a ?_ ?_
  <;> refine PartENat.casesOn b ?_ ?_
  <;> 

Proof state:
case intro.refine_1.refine_2
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ∀ (n : ℕ), ⊤ + ↑c = ↑n + ↑c ↔ ⊤ = ↑n

Next tactic:
simp [add_eq_top_iff, natCast_ne_top, @eq_comm _ (⊤ : PartENat), top_add]
protected theorem add_right_cancel_iff {a b c : PartENat} (hc : c ≠ ⊤) : a + c = b + c ↔ a = b := by
  rcases ne_top_iff.1 hc with ⟨c, rfl⟩
  refine PartENat.casesOn a ?_ ?_
  <;> refine PartENat.casesOn b ?_ ?_
  <;> 

Proof state:
case intro.refine_2.refine_1
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ∀ (n : ℕ), ↑n + ↑c = ⊤ + ↑c ↔ ↑n = ⊤

Next tactic:
simp [add_eq_top_iff, natCast_ne_top, @eq_comm _ (⊤ : PartENat), top_add]
protected theorem add_right_cancel_iff {a b c : PartENat} (hc : c ≠ ⊤) : a + c = b + c ↔ a = b := by
  rcases ne_top_iff.1 hc with ⟨c, rfl⟩
  refine PartENat.casesOn a ?_ ?_
  <;> refine PartENat.casesOn b ?_ ?_
  <;> 

Proof state:
case intro.refine_2.refine_2
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ∀ (n n_1 : ℕ), ↑n_1 + ↑c = ↑n + ↑c ↔ ↑n_1 = ↑n

Next tactic:
simp [add_eq_top_iff, natCast_ne_top, @eq_comm _ (⊤ : PartENat), top_add]
protected theorem add_right_cancel_iff {a b c : PartENat} (hc : c ≠ ⊤) : a + c = b + c ↔ a = b := by
  rcases ne_top_iff.1 hc with ⟨c, rfl⟩
  refine PartENat.casesOn a ?_ ?_
  <;> refine PartENat.casesOn b ?_ ?_
  <;> simp [add_eq_top_iff, natCast_ne_top, @eq_comm _ (⊤ : PartENat), top_add]
  

Proof state:
case intro.refine_2.refine_2
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ∀ (n n_1 : ℕ), ↑n_1 + ↑c = ↑n + ↑c ↔ n_1 = n

Next tactic:
simp only [← Nat.cast_add, add_left_cancel_iff, PartENat.natCast_inj, add_comm, forall_const]
protected theorem add_left_cancel_iff {a b c : PartENat} (ha : a ≠ ⊤) : a + b = a + c ↔ b = c := by
  

Proof state:
a b c : PartENat
ha : a ≠ ⊤
⊢ a + b = a + c ↔ b = c

Next tactic:
rw [add_comm a, add_comm a, PartENat.add_right_cancel_iff ha]
@[simp]
theorem toWithTop_top' {h : Decidable (⊤ : PartENat).Dom} : toWithTop ⊤ = ⊤ := by
  

Proof state:
h : Decidable ⊤.Dom
⊢ toWithTop ⊤ = ⊤

Next tactic:
convert toWithTop_top
@[simp]
theorem toWithTop_zero' {h : Decidable (0 : PartENat).Dom} : toWithTop 0 = 0 := by
  

Proof state:
h : Decidable 0.Dom
⊢ toWithTop 0 = 0

Next tactic:
convert toWithTop_zero
@[simp]
theorem toWithTop_one' {h : Decidable (1 : PartENat).Dom} : toWithTop 1 = 1 := by
  

Proof state:
h : Decidable 1.Dom
⊢ toWithTop 1 = 1

Next tactic:
convert toWithTop_one
theorem toWithTop_natCast (n : ℕ) {_ : Decidable (n : PartENat).Dom} : toWithTop n = n := by
  

Proof state:
n : ℕ
x✝ : Decidable (↑n).Dom
⊢ toWithTop ↑n = ↑n

Next tactic:
simp only [← toWithTop_some]
theorem toWithTop_natCast (n : ℕ) {_ : Decidable (n : PartENat).Dom} : toWithTop n = n := by
  simp only [← toWithTop_some]
  

Proof state:
n : ℕ
x✝ : Decidable (↑n).Dom
⊢ toWithTop ↑n = toWithTop ↑n

Next tactic:
congr
@[simp]
theorem toWithTop_natCast' (n : ℕ) {_ : Decidable (n : PartENat).Dom} :
    toWithTop (n : PartENat) = n := by
  

Proof state:
n : ℕ
x✝ : Decidable (↑n).Dom
⊢ toWithTop ↑n = ↑n

Next tactic:
rw [toWithTop_natCast n]
@[simp]
theorem toWithTop_le {x y : PartENat} [hx : Decidable x.Dom] [hy : Decidable y.Dom] :
    toWithTop x ≤ toWithTop y ↔ x ≤ y := by
  

Proof state:
x y : PartENat
hx : Decidable x.Dom
hy : Decidable y.Dom
⊢ toWithTop x ≤ toWithTop y ↔ x ≤ y

Next tactic:
induction y using PartENat.casesOn generalizing hy
@[simp]
theorem toWithTop_le {x y : PartENat} [hx : Decidable x.Dom] [hy : Decidable y.Dom] :
    toWithTop x ≤ toWithTop y ↔ x ≤ y := by
  induction y using PartENat.casesOn generalizing hy
  · 

Proof state:
case a
x : PartENat
hx : Decidable x.Dom
hy : Decidable ⊤.Dom
⊢ toWithTop x ≤ toWithTop ⊤ ↔ x ≤ ⊤

Next tactic:
simp
@[simp]
theorem toWithTop_le {x y : PartENat} [hx : Decidable x.Dom] [hy : Decidable y.Dom] :
    toWithTop x ≤ toWithTop y ↔ x ≤ y := by
  induction y using PartENat.casesOn generalizing hy
  · simp
  

Proof state:
case a
x : PartENat
hx : Decidable x.Dom
n✝ : ℕ
hy : Decidable (↑n✝).Dom
⊢ toWithTop x ≤ toWithTop ↑n✝ ↔ x ≤ ↑n✝

Next tactic:
induction x using PartENat.casesOn generalizing hx
@[simp]
theorem toWithTop_le {x y : PartENat} [hx : Decidable x.Dom] [hy : Decidable y.Dom] :
    toWithTop x ≤ toWithTop y ↔ x ≤ y := by
  induction y using PartENat.casesOn generalizing hy
  · simp
  induction x using PartENat.casesOn generalizing hx
  · 

Proof state:
case a.a
n✝ : ℕ
hy : Decidable (↑n✝).Dom
hx : Decidable ⊤.Dom
⊢ toWithTop ⊤ ≤ toWithTop ↑n✝ ↔ ⊤ ≤ ↑n✝

Next tactic:
simp
@[simp]
theorem toWithTop_le {x y : PartENat} [hx : Decidable x.Dom] [hy : Decidable y.Dom] :
    toWithTop x ≤ toWithTop y ↔ x ≤ y := by
  induction y using PartENat.casesOn generalizing hy
  · simp
  induction x using PartENat.casesOn generalizing hx
  · simp
  · 

Proof state:
case a.a
n✝¹ : ℕ
hy : Decidable (↑n✝¹).Dom
n✝ : ℕ
hx : Decidable (↑n✝).Dom
⊢ toWithTop ↑n✝ ≤ toWithTop ↑n✝¹ ↔ ↑n✝ ≤ ↑n✝¹

Next tactic:
simp
@[simp, norm_cast]
theorem toWithTop_ofENat (n : ℕ∞) {_ : Decidable (n : PartENat).Dom} : toWithTop (↑n) = n := by
  

Proof state:
n : ℕ∞
x✝ : Decidable (↑n).Dom
⊢ toWithTop ↑n = n

Next tactic:
induction n with
  | none => simp; rfl
  | some n =>
    simp only [toWithTop_natCast', ofENat_some]
    rfl
@[simp, norm_cast]
theorem toWithTop_ofENat (n : ℕ∞) {_ : Decidable (n : PartENat).Dom} : toWithTop (↑n) = n := by
  induction n with
  

Proof state:
case none
x✝ : Decidable (↑Option.none).Dom
⊢ toWithTop ↑Option.none = Option.none

Next tactic:
| none => simp; rfl
@[simp, norm_cast]
theorem toWithTop_ofENat (n : ℕ∞) {_ : Decidable (n : PartENat).Dom} : toWithTop (↑n) = n := by
  induction n with
  | none => 

Proof state:
case none
x✝ : Decidable (↑Option.none).Dom
⊢ toWithTop ↑Option.none = Option.none

Next tactic:
simp
@[simp, norm_cast]
theorem toWithTop_ofENat (n : ℕ∞) {_ : Decidable (n : PartENat).Dom} : toWithTop (↑n) = n := by
  induction n with
  | none => simp; 

Proof state:
case none
x✝ : Decidable (↑Option.none).Dom
⊢ ⊤ = Option.none

Next tactic:
rfl
@[simp, norm_cast]
theorem toWithTop_ofENat (n : ℕ∞) {_ : Decidable (n : PartENat).Dom} : toWithTop (↑n) = n := by
  induction n with
  | none => simp; rfl
  

Proof state:
case some
n : ℕ
x✝ : Decidable (↑(Option.some n)).Dom
⊢ toWithTop ↑(Option.some n) = Option.some n

Next tactic:
| some n =>
    simp only [toWithTop_natCast', ofENat_some]
    rfl
@[simp, norm_cast]
theorem toWithTop_ofENat (n : ℕ∞) {_ : Decidable (n : PartENat).Dom} : toWithTop (↑n) = n := by
  induction n with
  | none => simp; rfl
  | some n =>
    

Proof state:
case some
n : ℕ
x✝ : Decidable (↑(Option.some n)).Dom
⊢ toWithTop ↑(Option.some n) = Option.some n

Next tactic:
simp only [toWithTop_natCast', ofENat_some]
@[simp, norm_cast]
theorem toWithTop_ofENat (n : ℕ∞) {_ : Decidable (n : PartENat).Dom} : toWithTop (↑n) = n := by
  induction n with
  | none => simp; rfl
  | some n =>
    simp only [toWithTop_natCast', ofENat_some]
    

Proof state:
case some
n : ℕ
x✝ : Decidable (↑(Option.some n)).Dom
⊢ ↑n = Option.some n

Next tactic:
rfl
@[simp]
theorem toWithTop_add {x y : PartENat} : toWithTop (x + y) = toWithTop x + toWithTop y := by
  

Proof state:
x y : PartENat
⊢ toWithTop (x + y) = toWithTop x + toWithTop y

Next tactic:
refine PartENat.casesOn y ?_ ?_
@[simp]
theorem toWithTop_add {x y : PartENat} : toWithTop (x + y) = toWithTop x + toWithTop y := by
  refine PartENat.casesOn y ?_ ?_ <;> 

Proof state:
case refine_1
x y : PartENat
⊢ toWithTop (x + ⊤) = toWithTop x + toWithTop ⊤

Next tactic:
refine PartENat.casesOn x ?_ ?_
@[simp]
theorem toWithTop_add {x y : PartENat} : toWithTop (x + y) = toWithTop x + toWithTop y := by
  refine PartENat.casesOn y ?_ ?_ <;> 

Proof state:
case refine_2
x y : PartENat
⊢ ∀ (n : ℕ), toWithTop (x + ↑n) = toWithTop x + toWithTop ↑n

Next tactic:
refine PartENat.casesOn x ?_ ?_
@[simp]
theorem toWithTop_add {x y : PartENat} : toWithTop (x + y) = toWithTop x + toWithTop y := by
  refine PartENat.casesOn y ?_ ?_ <;> refine PartENat.casesOn x ?_ ?_
  --Porting note: was `simp [← Nat.cast_add, ← ENat.coe_add]`
  · 

Proof state:
case refine_1.refine_1
x y : PartENat
⊢ toWithTop (⊤ + ⊤) = toWithTop ⊤ + toWithTop ⊤

Next tactic:
simp only [add_top, toWithTop_top', _root_.add_top]
@[simp]
theorem toWithTop_add {x y : PartENat} : toWithTop (x + y) = toWithTop x + toWithTop y := by
  refine PartENat.casesOn y ?_ ?_ <;> refine PartENat.casesOn x ?_ ?_
  --Porting note: was `simp [← Nat.cast_add, ← ENat.coe_add]`
  · simp only [add_top, toWithTop_top', _root_.add_top]
  · 

Proof state:
case refine_1.refine_2
x y : PartENat
⊢ ∀ (n : ℕ), toWithTop (↑n + ⊤) = toWithTop ↑n + toWithTop ⊤

Next tactic:
simp only [add_top, toWithTop_top', toWithTop_natCast', _root_.add_top, forall_const]
@[simp]
theorem toWithTop_add {x y : PartENat} : toWithTop (x + y) = toWithTop x + toWithTop y := by
  refine PartENat.casesOn y ?_ ?_ <;> refine PartENat.casesOn x ?_ ?_
  --Porting note: was `simp [← Nat.cast_add, ← ENat.coe_add]`
  · simp only [add_top, toWithTop_top', _root_.add_top]
  · simp only [add_top, toWithTop_top', toWithTop_natCast', _root_.add_top, forall_const]
  · 

Proof state:
case refine_2.refine_1
x y : PartENat
⊢ ∀ (n : ℕ), toWithTop (⊤ + ↑n) = toWithTop ⊤ + toWithTop ↑n

Next tactic:
simp only [top_add, toWithTop_top', toWithTop_natCast', _root_.top_add, forall_const]
@[simp]
theorem toWithTop_add {x y : PartENat} : toWithTop (x + y) = toWithTop x + toWithTop y := by
  refine PartENat.casesOn y ?_ ?_ <;> refine PartENat.casesOn x ?_ ?_
  --Porting note: was `simp [← Nat.cast_add, ← ENat.coe_add]`
  · simp only [add_top, toWithTop_top', _root_.add_top]
  · simp only [add_top, toWithTop_top', toWithTop_natCast', _root_.add_top, forall_const]
  · simp only [top_add, toWithTop_top', toWithTop_natCast', _root_.top_add, forall_const]
  · 

Proof state:
case refine_2.refine_2
x y : PartENat
⊢ ∀ (n n_1 : ℕ), toWithTop (↑n + ↑n_1) = toWithTop ↑n + toWithTop ↑n_1

Next tactic:
simp_rw [toWithTop_natCast', ← Nat.cast_add, toWithTop_natCast', forall_const]
/-- `Equiv` between `PartENat` and `ℕ∞` (for the order isomorphism see
`withTopOrderIso`). -/
noncomputable def withTopEquiv : PartENat ≃ ℕ∞ where
  toFun x := toWithTop x
  invFun x := ↑x
  left_inv x := by
    

Proof state:
x : PartENat
⊢ (fun x => ↑x) ((fun x => toWithTop x) x) = x

Next tactic:
induction x using PartENat.casesOn