l3lab/ntp-mathlib huggingface dataset:
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      

Proof state:
case h
x y : PartENat
h : ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : x.Dom
hy : y.Dom
⊢ Part.get x hx < Part.get y hy

Next tactic:
specialize H hy
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      specialize H hy
      

Proof state:
case h
x y : PartENat
h : ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
hyx : y.Dom → x.Dom
hx : x.Dom
hy : y.Dom
H : Part.get x (_ : x.Dom) ≤ Part.get y hy
⊢ Part.get x hx < Part.get y hy

Next tactic:
specialize h fun _ => hy
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      specialize H hy
      specialize h fun _ => hy
      

Proof state:
case h
x y : PartENat
hyx : y.Dom → x.Dom
hx : x.Dom
hy : y.Dom
H : Part.get x (_ : x.Dom) ≤ Part.get y hy
h : ¬∀ (hy_1 : x.Dom), Part.get y hy ≤ Part.get x hy_1
⊢ Part.get x hx < Part.get y hy

Next tactic:
rw [not_forall] at h
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      specialize H hy
      specialize h fun _ => hy
      rw [not_forall] at h
      

Proof state:
case h
x y : PartENat
hyx : y.Dom → x.Dom
hx : x.Dom
hy : y.Dom
H : Part.get x (_ : x.Dom) ≤ Part.get y hy
h : ∃ (x_1 : x.Dom), ¬Part.get y hy ≤ Part.get x x_1
⊢ Part.get x hx < Part.get y hy

Next tactic:
cases' h with hx' h
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      specialize H hy
      specialize h fun _ => hy
      rw [not_forall] at h
      cases' h with hx' h
      

Proof state:
case h.intro
x y : PartENat
hyx : y.Dom → x.Dom
hx : x.Dom
hy : y.Dom
H : Part.get x (_ : x.Dom) ≤ Part.get y hy
hx' : x.Dom
h : ¬Part.get y hy ≤ Part.get x hx'
⊢ Part.get x hx < Part.get y hy

Next tactic:
rw [not_le] at h
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      specialize H hy
      specialize h fun _ => hy
      rw [not_forall] at h
      cases' h with hx' h
      rw [not_le] at h
      

Proof state:
case h.intro
x y : PartENat
hyx : y.Dom → x.Dom
hx : x.Dom
hy : y.Dom
H : Part.get x (_ : x.Dom) ≤ Part.get y hy
hx' : x.Dom
h : Part.get x hx' < Part.get y hy
⊢ Part.get x hx < Part.get y hy

Next tactic:
exact h
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      specialize H hy
      specialize h fun _ => hy
      rw [not_forall] at h
      cases' h with hx' h
      rw [not_le] at h
      exact h
    · 

Proof state:
case neg
x y : PartENat
h : ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : ¬x.Dom
⊢ ∃ (hx : x.Dom), ∀ (hy : y.Dom), Part.get x hx < Part.get y hy

Next tactic:
specialize h fun hx' => (hx hx').elim
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      specialize H hy
      specialize h fun _ => hy
      rw [not_forall] at h
      cases' h with hx' h
      rw [not_le] at h
      exact h
    · specialize h fun hx' => (hx hx').elim
      

Proof state:
case neg
x y : PartENat
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : ¬x.Dom
h : ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
⊢ ∃ (hx : x.Dom), ∀ (hy : y.Dom), Part.get x hx < Part.get y hy

Next tactic:
rw [not_forall] at h
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      specialize H hy
      specialize h fun _ => hy
      rw [not_forall] at h
      cases' h with hx' h
      rw [not_le] at h
      exact h
    · specialize h fun hx' => (hx hx').elim
      rw [not_forall] at h
      

Proof state:
case neg
x y : PartENat
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : ¬x.Dom
h : ∃ (x_1 : x.Dom), ¬Part.get y (_ : y.Dom) ≤ Part.get x x_1
⊢ ∃ (hx : x.Dom), ∀ (hy : y.Dom), Part.get x hx < Part.get y hy

Next tactic:
cases' h with hx' h
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      specialize H hy
      specialize h fun _ => hy
      rw [not_forall] at h
      cases' h with hx' h
      rw [not_le] at h
      exact h
    · specialize h fun hx' => (hx hx').elim
      rw [not_forall] at h
      cases' h with hx' h
      

Proof state:
case neg.intro
x y : PartENat
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : ¬x.Dom
hx' : x.Dom
h : ¬Part.get y (_ : y.Dom) ≤ Part.get x hx'
⊢ ∃ (hx : x.Dom), ∀ (hy : y.Dom), Part.get x hx < Part.get y hy

Next tactic:
exact (hx hx').elim
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      specialize H hy
      specialize h fun _ => hy
      rw [not_forall] at h
      cases' h with hx' h
      rw [not_le] at h
      exact h
    · specialize h fun hx' => (hx hx').elim
      rw [not_forall] at h
      cases' h with hx' h
      exact (hx hx').elim
  · 

Proof state:
case mpr
x y : PartENat
⊢ (∃ (hx : x.Dom), ∀ (hy : y.Dom), Part.get x hx < Part.get y hy) →
    (∃ (h : y.Dom → x.Dom), ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy) ∧
      ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy

Next tactic:
rintro ⟨hx, H⟩
theorem lt_def (x y : PartENat) : x < y ↔ ∃ hx : x.Dom, ∀ hy : y.Dom, x.get hx < y.get hy := by
  rw [lt_iff_le_not_le, le_def, le_def, not_exists]
  constructor
  · rintro ⟨⟨hyx, H⟩, h⟩
    by_cases hx : x.Dom
    · use hx
      intro hy
      specialize H hy
      specialize h fun _ => hy
      rw [not_forall] at h
      cases' h with hx' h
      rw [not_le] at h
      exact h
    · specialize h fun hx' => (hx hx').elim
      rw [not_forall] at h
      cases' h with hx' h
      exact (hx hx').elim
  · rintro ⟨hx, H⟩
    

Proof state:
case mpr.intro
x y : PartENat
hx : x.Dom
H : ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
⊢ (∃ (h : y.Dom → x.Dom), ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy) ∧
    ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy

Next tactic:
exact ⟨⟨fun _ => hx, fun hy => (H hy).le⟩, fun hxy h => not_lt_of_le (h _) (H _)⟩
noncomputable instance orderedAddCommMonoid : OrderedAddCommMonoid PartENat :=
  { PartENat.partialOrder, PartENat.addCommMonoid with
    add_le_add_left := fun a b ⟨h₁, h₂⟩ c =>
      PartENat.casesOn c (by 

Proof state:
src✝¹ : PartialOrder PartENat := partialOrder
src✝ : AddCommMonoid PartENat := addCommMonoid
a b : PartENat
x✝ : a ≤ b
c : PartENat
h₁ : b.Dom → a.Dom
h₂ : ∀ (hy : b.Dom), Part.get a (_ : a.Dom) ≤ Part.get b hy
⊢ ⊤ + a ≤ ⊤ + b

Next tactic:
simp [top_add]
noncomputable instance orderedAddCommMonoid : OrderedAddCommMonoid PartENat :=
  { PartENat.partialOrder, PartENat.addCommMonoid with
    add_le_add_left := fun a b ⟨h₁, h₂⟩ c =>
      PartENat.casesOn c (by simp [top_add]) fun c =>
        ⟨fun h => And.intro (dom_natCast _) (h₁ h.2), fun h => by
          

Proof state:
src✝¹ : PartialOrder PartENat := partialOrder
src✝ : AddCommMonoid PartENat := addCommMonoid
a b : PartENat
x✝ : a ≤ b
c✝ : PartENat
h₁ : b.Dom → a.Dom
h₂ : ∀ (hy : b.Dom), Part.get a (_ : a.Dom) ≤ Part.get b hy
c : ℕ
h : (↑c + b).Dom
⊢ Part.get (↑c + a) (_ : (↑c).Dom ∧ a.Dom) ≤ Part.get (↑c + b) h

Next tactic:
simpa only [coe_add_get] using add_le_add_left (h₂ _) c
@[simp]
theorem get_le_get {x y : PartENat} {hx : x.Dom} {hy : y.Dom} : x.get hx ≤ y.get hy ↔ x ≤ y := by
  

Proof state:
x y : PartENat
hx : x.Dom
hy : y.Dom
⊢ Part.get x hx ≤ Part.get y hy ↔ x ≤ y

Next tactic:
conv =>
    lhs
    rw [← coe_le_coe, natCast_get, natCast_get]
@[simp]
theorem get_le_get {x y : PartENat} {hx : x.Dom} {hy : y.Dom} : x.get hx ≤ y.get hy ↔ x ≤ y := by
  conv =>
    

Proof state:
x y : PartENat
hx : x.Dom
hy : y.Dom
| Part.get x hx ≤ Part.get y hy ↔ x ≤ y

Next tactic:
lhs
    rw [← coe_le_coe, natCast_get, natCast_get]
@[simp]
theorem get_le_get {x y : PartENat} {hx : x.Dom} {hy : y.Dom} : x.get hx ≤ y.get hy ↔ x ≤ y := by
  conv =>
    

Proof state:
x y : PartENat
hx : x.Dom
hy : y.Dom
| Part.get x hx ≤ Part.get y hy ↔ x ≤ y

Next tactic:
lhs
@[simp]
theorem get_le_get {x y : PartENat} {hx : x.Dom} {hy : y.Dom} : x.get hx ≤ y.get hy ↔ x ≤ y := by
  conv =>
    lhs
    

Proof state:
x y : PartENat
hx : x.Dom
hy : y.Dom
| Part.get x hx ≤ Part.get y hy

Next tactic:
rw [← coe_le_coe, natCast_get, natCast_get]
theorem le_coe_iff (x : PartENat) (n : ℕ) : x ≤ n ↔ ∃ h : x.Dom, x.get h ≤ n := by
  

Proof state:
x : PartENat
n : ℕ
⊢ x ≤ ↑n ↔ ∃ (h : x.Dom), Part.get x h ≤ n

Next tactic:
show (∃ h : True → x.Dom, _) ↔ ∃ h : x.Dom, x.get h ≤ n
theorem le_coe_iff (x : PartENat) (n : ℕ) : x ≤ n ↔ ∃ h : x.Dom, x.get h ≤ n := by
  show (∃ h : True → x.Dom, _) ↔ ∃ h : x.Dom, x.get h ≤ n
  

Proof state:
x : PartENat
n : ℕ
⊢ (∃ (h : True → x.Dom), ∀ (hy : (↑n).Dom), Part.get x (_ : x.Dom) ≤ Part.get (↑n) hy) ↔ ∃ (h : x.Dom), Part.get x h ≤ n

Next tactic:
simp only [forall_prop_of_true, dom_natCast, get_natCast']
theorem lt_coe_iff (x : PartENat) (n : ℕ) : x < n ↔ ∃ h : x.Dom, x.get h < n := by
  

Proof state:
x : PartENat
n : ℕ
⊢ x < ↑n ↔ ∃ (h : x.Dom), Part.get x h < n

Next tactic:
simp only [lt_def, forall_prop_of_true, get_natCast', dom_natCast]
theorem coe_le_iff (n : ℕ) (x : PartENat) : (n : PartENat) ≤ x ↔ ∀ h : x.Dom, n ≤ x.get h := by
  

Proof state:
n : ℕ
x : PartENat
⊢ ↑n ≤ x ↔ ∀ (h : x.Dom), n ≤ Part.get x h

Next tactic:
rw [← some_eq_natCast]
theorem coe_le_iff (n : ℕ) (x : PartENat) : (n : PartENat) ≤ x ↔ ∀ h : x.Dom, n ≤ x.get h := by
  rw [← some_eq_natCast]
  

Proof state:
n : ℕ
x : PartENat
⊢ ↑n ≤ x ↔ ∀ (h : x.Dom), n ≤ Part.get x h

Next tactic:
simp only [le_def, exists_prop_of_true, dom_some, forall_true_iff]
theorem coe_le_iff (n : ℕ) (x : PartENat) : (n : PartENat) ≤ x ↔ ∀ h : x.Dom, n ≤ x.get h := by
  rw [← some_eq_natCast]
  simp only [le_def, exists_prop_of_true, dom_some, forall_true_iff]
  

Proof state:
n : ℕ
x : PartENat
⊢ (∀ (hy : x.Dom), Part.get ↑n (_ : (↑n).Dom) ≤ Part.get x hy) ↔ ∀ (h : x.Dom), n ≤ Part.get x h

Next tactic:
rfl
theorem coe_lt_iff (n : ℕ) (x : PartENat) : (n : PartENat) < x ↔ ∀ h : x.Dom, n < x.get h := by
  

Proof state:
n : ℕ
x : PartENat
⊢ ↑n < x ↔ ∀ (h : x.Dom), n < Part.get x h

Next tactic:
rw [← some_eq_natCast]
theorem coe_lt_iff (n : ℕ) (x : PartENat) : (n : PartENat) < x ↔ ∀ h : x.Dom, n < x.get h := by
  rw [← some_eq_natCast]
  

Proof state:
n : ℕ
x : PartENat
⊢ ↑n < x ↔ ∀ (h : x.Dom), n < Part.get x h

Next tactic:
simp only [lt_def, exists_prop_of_true, dom_some, forall_true_iff]
theorem coe_lt_iff (n : ℕ) (x : PartENat) : (n : PartENat) < x ↔ ∀ h : x.Dom, n < x.get h := by
  rw [← some_eq_natCast]
  simp only [lt_def, exists_prop_of_true, dom_some, forall_true_iff]
  

Proof state:
n : ℕ
x : PartENat
⊢ (∀ (hy : x.Dom), Part.get ↑n (_ : (↑n).Dom) < Part.get x hy) ↔ ∀ (h : x.Dom), n < Part.get x h

Next tactic:
rfl
@[simp]
theorem natCast_lt_top (x : ℕ) : (x : PartENat) < ⊤ :=
  Ne.lt_top fun h => absurd (congr_arg Dom h) <| by 

Proof state:
x : ℕ
h : ↑x = ⊤
⊢ ¬(↑x).Dom = ⊤.Dom

Next tactic:
simp only [dom_natCast]
@[simp]
theorem natCast_lt_top (x : ℕ) : (x : PartENat) < ⊤ :=
  Ne.lt_top fun h => absurd (congr_arg Dom h) <| by simp only [dom_natCast]; 

Proof state:
x : ℕ
h : ↑x = ⊤
⊢ ¬True = ⊤.Dom

Next tactic:
exact true_ne_false
theorem ne_top_iff {x : PartENat} : x ≠ ⊤ ↔ ∃ n : ℕ, x = n := by
  

Proof state:
x : PartENat
⊢ x ≠ ⊤ ↔ ∃ n, x = ↑n

Next tactic:
simpa only [← some_eq_natCast] using Part.ne_none_iff
theorem ne_top_iff_dom {x : PartENat} : x ≠ ⊤ ↔ x.Dom := by
  

Proof state:
x : PartENat
⊢ x ≠ ⊤ ↔ x.Dom

Next tactic:
classical exact not_iff_comm.1 Part.eq_none_iff'.symm
theorem ne_top_iff_dom {x : PartENat} : x ≠ ⊤ ↔ x.Dom := by
  classical 

Proof state:
x : PartENat
⊢ x ≠ ⊤ ↔ x.Dom

Next tactic:
exact not_iff_comm.1 Part.eq_none_iff'.symm
theorem eq_top_iff_forall_lt (x : PartENat) : x = ⊤ ↔ ∀ n : ℕ, (n : PartENat) < x := by
  

Proof state:
x : PartENat
⊢ x = ⊤ ↔ ∀ (n : ℕ), ↑n < x

Next tactic:
constructor
theorem eq_top_iff_forall_lt (x : PartENat) : x = ⊤ ↔ ∀ n : ℕ, (n : PartENat) < x := by
  constructor
  · 

Proof state:
case mp
x : PartENat
⊢ x = ⊤ → ∀ (n : ℕ), ↑n < x

Next tactic:
rintro rfl n
theorem eq_top_iff_forall_lt (x : PartENat) : x = ⊤ ↔ ∀ n : ℕ, (n : PartENat) < x := by
  constructor
  · rintro rfl n
    

Proof state:
case mp
n : ℕ
⊢ ↑n < ⊤

Next tactic:
exact natCast_lt_top _
theorem eq_top_iff_forall_lt (x : PartENat) : x = ⊤ ↔ ∀ n : ℕ, (n : PartENat) < x := by
  constructor
  · rintro rfl n
    exact natCast_lt_top _
  · 

Proof state:
case mpr
x : PartENat
⊢ (∀ (n : ℕ), ↑n < x) → x = ⊤

Next tactic:
contrapose!
theorem eq_top_iff_forall_lt (x : PartENat) : x = ⊤ ↔ ∀ n : ℕ, (n : PartENat) < x := by
  constructor
  · rintro rfl n
    exact natCast_lt_top _
  · contrapose!
    

Proof state:
case mpr
x : PartENat
⊢ x ≠ ⊤ → ∃ n, ¬↑n < x

Next tactic:
rw [ne_top_iff]
theorem eq_top_iff_forall_lt (x : PartENat) : x = ⊤ ↔ ∀ n : ℕ, (n : PartENat) < x := by
  constructor
  · rintro rfl n
    exact natCast_lt_top _
  · contrapose!
    rw [ne_top_iff]
    

Proof state:
case mpr
x : PartENat
⊢ (∃ n, x = ↑n) → ∃ n, ¬↑n < x

Next tactic:
rintro ⟨n, rfl⟩
theorem eq_top_iff_forall_lt (x : PartENat) : x = ⊤ ↔ ∀ n : ℕ, (n : PartENat) < x := by
  constructor
  · rintro rfl n
    exact natCast_lt_top _
  · contrapose!
    rw [ne_top_iff]
    rintro ⟨n, rfl⟩
    

Proof state:
case mpr.intro
n : ℕ
⊢ ∃ n_1, ¬↑n_1 < ↑n

Next tactic:
exact ⟨n, irrefl _⟩
theorem pos_iff_one_le {x : PartENat} : 0 < x ↔ 1 ≤ x :=
  PartENat.casesOn x
    (by 

Proof state:
x : PartENat
⊢ 0 < ⊤ ↔ 1 ≤ ⊤

Next tactic:
simp only [iff_true_iff, le_top, natCast_lt_top, ← @Nat.cast_zero PartENat]
theorem pos_iff_one_le {x : PartENat} : 0 < x ↔ 1 ≤ x :=
  PartENat.casesOn x
    (by simp only [iff_true_iff, le_top, natCast_lt_top, ← @Nat.cast_zero PartENat])
    fun n => by
      

Proof state:
x : PartENat
n : ℕ
⊢ 0 < ↑n ↔ 1 ≤ ↑n

Next tactic:
rw [← Nat.cast_zero, ← Nat.cast_one, PartENat.coe_lt_coe, PartENat.coe_le_coe]
theorem pos_iff_one_le {x : PartENat} : 0 < x ↔ 1 ≤ x :=
  PartENat.casesOn x
    (by simp only [iff_true_iff, le_top, natCast_lt_top, ← @Nat.cast_zero PartENat])
    fun n => by
      rw [← Nat.cast_zero, ← Nat.cast_one, PartENat.coe_lt_coe, PartENat.coe_le_coe]
      

Proof state:
x : PartENat
n : ℕ
⊢ 0 < n ↔ 1 ≤ n

Next tactic:
rfl
noncomputable instance linearOrder : LinearOrder PartENat :=
  { PartENat.partialOrder with
    le_total := IsTotal.total
    decidableLE := Classical.decRel _
    max := (· ⊔ ·)
    -- Porting note: was `max_def := @sup_eq_maxDefault _ _ (id _) _ }`
    max_def := fun a b => by
      

Proof state:
src✝ : PartialOrder PartENat := partialOrder
a b : PartENat
⊢ max a b = if a ≤ b then b else a

Next tactic:
change (fun a b => a ⊔ b) a b = _
noncomputable instance linearOrder : LinearOrder PartENat :=
  { PartENat.partialOrder with
    le_total := IsTotal.total
    decidableLE := Classical.decRel _
    max := (· ⊔ ·)
    -- Porting note: was `max_def := @sup_eq_maxDefault _ _ (id _) _ }`
    max_def := fun a b => by
      change (fun a b => a ⊔ b) a b = _
      

Proof state:
src✝ : PartialOrder PartENat := partialOrder
a b : PartENat
⊢ (fun a b => a ⊔ b) a b = if a ≤ b then b else a

Next tactic:
rw [@sup_eq_maxDefault PartENat _ (id _) _]
noncomputable instance linearOrder : LinearOrder PartENat :=
  { PartENat.partialOrder with
    le_total := IsTotal.total
    decidableLE := Classical.decRel _
    max := (· ⊔ ·)
    -- Porting note: was `max_def := @sup_eq_maxDefault _ _ (id _) _ }`
    max_def := fun a b => by
      change (fun a b => a ⊔ b) a b = _
      rw [@sup_eq_maxDefault PartENat _ (id _) _]
      

Proof state:
src✝ : PartialOrder PartENat := partialOrder
a b : PartENat
⊢ maxDefault a b = if a ≤ b then b else a
src✝ : PartialOrder PartENat := partialOrder a b : PartENat ⊢ DecidableRel fun x x_1 => x ≤ x_1

Next tactic:
rfl
noncomputable instance : CanonicallyOrderedAddCommMonoid PartENat :=
  { PartENat.semilatticeSup, PartENat.orderBot,
    PartENat.orderedAddCommMonoid with
    le_self_add := fun a b =>
      PartENat.casesOn b (le_top.trans_eq (add_top _).symm) fun b =>
        PartENat.casesOn a (top_add _).ge fun a =>
          (coe_le_coe.2 le_self_add).trans_eq (Nat.cast_add _ _)
    exists_add_of_le := fun {a b} =>
      PartENat.casesOn b (fun _ => ⟨⊤, (add_top _).symm⟩) fun b =>
        PartENat.casesOn a (fun h => ((natCast_lt_top _).not_le h).elim) fun a h =>
          ⟨(b - a : ℕ), by
            

Proof state:
src✝² : SemilatticeSup PartENat := semilatticeSup
src✝¹ : OrderBot PartENat := orderBot
src✝ : OrderedAddCommMonoid PartENat := orderedAddCommMonoid
a✝ b✝ : PartENat
b a : ℕ
h : ↑a ≤ ↑b
⊢ ↑b = ↑a + ↑(b - a)

Next tactic:
rw [← Nat.cast_add, natCast_inj, add_comm, tsub_add_cancel_of_le (coe_le_coe.1 h)]
theorem eq_natCast_sub_of_add_eq_natCast {x y : PartENat} {n : ℕ} (h : x + y = n) :
    x = ↑(n - y.get (dom_of_le_natCast ((le_add_left le_rfl).trans_eq h))) := by
  

Proof state:
x y : PartENat
n : ℕ
h : x + y = ↑n
⊢ x = ↑(n - Part.get y (_ : y.Dom))

Next tactic:
lift x to ℕ using dom_of_le_natCast ((le_add_right le_rfl).trans_eq h)
theorem eq_natCast_sub_of_add_eq_natCast {x y : PartENat} {n : ℕ} (h : x + y = n) :
    x = ↑(n - y.get (dom_of_le_natCast ((le_add_left le_rfl).trans_eq h))) := by
  lift x to ℕ using dom_of_le_natCast ((le_add_right le_rfl).trans_eq h)
  

Proof state:
case intro
y : PartENat
n x : ℕ
h : ↑x + y = ↑n
⊢ ↑x = ↑(n - Part.get y (_ : y.Dom))

Next tactic:
lift y to ℕ using dom_of_le_natCast ((le_add_left le_rfl).trans_eq h)
theorem eq_natCast_sub_of_add_eq_natCast {x y : PartENat} {n : ℕ} (h : x + y = n) :
    x = ↑(n - y.get (dom_of_le_natCast ((le_add_left le_rfl).trans_eq h))) := by
  lift x to ℕ using dom_of_le_natCast ((le_add_right le_rfl).trans_eq h)
  lift y to ℕ using dom_of_le_natCast ((le_add_left le_rfl).trans_eq h)
  

Proof state:
case intro.intro
n x y : ℕ
h : ↑x + ↑y = ↑n
⊢ ↑x = ↑(n - Part.get ↑y (_ : (↑y).Dom))

Next tactic:
rw [← Nat.cast_add, natCast_inj] at h
theorem eq_natCast_sub_of_add_eq_natCast {x y : PartENat} {n : ℕ} (h : x + y = n) :
    x = ↑(n - y.get (dom_of_le_natCast ((le_add_left le_rfl).trans_eq h))) := by
  lift x to ℕ using dom_of_le_natCast ((le_add_right le_rfl).trans_eq h)
  lift y to ℕ using dom_of_le_natCast ((le_add_left le_rfl).trans_eq h)
  rw [← Nat.cast_add, natCast_inj] at h
  

Proof state:
case intro.intro
n x y : ℕ
h✝ : ↑x + ↑y = ↑n
h : x + y = n
⊢ ↑x = ↑(n - Part.get ↑y (_ : (↑y).Dom))

Next tactic:
rw [get_natCast, natCast_inj, eq_tsub_of_add_eq h]
protected theorem add_lt_add_right {x y z : PartENat} (h : x < y) (hz : z ≠ ⊤) : x + z < y + z := by
  

Proof state:
x y z : PartENat
h : x < y
hz : z ≠ ⊤
⊢ x + z < y + z

Next tactic:
rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
protected theorem add_lt_add_right {x y z : PartENat} (h : x < y) (hz : z ≠ ⊤) : x + z < y + z := by
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  

Proof state:
case intro
y z : PartENat
hz : z ≠ ⊤
m : ℕ
h : ↑m < y
⊢ ↑m + z < y + z

Next tactic:
rcases ne_top_iff.mp hz with ⟨k, rfl⟩
protected theorem add_lt_add_right {x y z : PartENat} (h : x < y) (hz : z ≠ ⊤) : x + z < y + z := by
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  rcases ne_top_iff.mp hz with ⟨k, rfl⟩
  

Proof state:
case intro.intro
y : PartENat
m : ℕ
h : ↑m < y
k : ℕ
hz : ↑k ≠ ⊤
⊢ ↑m + ↑k < y + ↑k

Next tactic:
induction' y using PartENat.casesOn with n
protected theorem add_lt_add_right {x y z : PartENat} (h : x < y) (hz : z ≠ ⊤) : x + z < y + z := by
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  rcases ne_top_iff.mp hz with ⟨k, rfl⟩
  induction' y using PartENat.casesOn with n
  · 

Proof state:
case intro.intro.a
m k : ℕ
hz : ↑k ≠ ⊤
h : ↑m < ⊤
⊢ ↑m + ↑k < ⊤ + ↑k

Next tactic:
rw [top_add]
protected theorem add_lt_add_right {x y z : PartENat} (h : x < y) (hz : z ≠ ⊤) : x + z < y + z := by
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  rcases ne_top_iff.mp hz with ⟨k, rfl⟩
  induction' y using PartENat.casesOn with n
  · rw [top_add]
    -- Porting note: was apply_mod_cast natCast_lt_top
    

Proof state:
case intro.intro.a
m k : ℕ
hz : ↑k ≠ ⊤
h : ↑m < ⊤
⊢ ↑m + ↑k < ⊤

Next tactic:
norm_cast
protected theorem add_lt_add_right {x y z : PartENat} (h : x < y) (hz : z ≠ ⊤) : x + z < y + z := by
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  rcases ne_top_iff.mp hz with ⟨k, rfl⟩
  induction' y using PartENat.casesOn with n
  · rw [top_add]
    -- Porting note: was apply_mod_cast natCast_lt_top
    norm_cast; 

Proof state:
case intro.intro.a
m k : ℕ
hz : ↑k ≠ ⊤
h : ↑m < ⊤
⊢ ↑(m + k) < ⊤

Next tactic:
apply natCast_lt_top
protected theorem add_lt_add_right {x y z : PartENat} (h : x < y) (hz : z ≠ ⊤) : x + z < y + z := by
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  rcases ne_top_iff.mp hz with ⟨k, rfl⟩
  induction' y using PartENat.casesOn with n
  · rw [top_add]
    -- Porting note: was apply_mod_cast natCast_lt_top
    norm_cast; apply natCast_lt_top
  

Proof state:
case intro.intro.a
m k : ℕ
hz : ↑k ≠ ⊤
n : ℕ
h : ↑m < ↑n
⊢ ↑m + ↑k < ↑n + ↑k

Next tactic:
norm_cast at h
protected theorem add_lt_add_right {x y z : PartENat} (h : x < y) (hz : z ≠ ⊤) : x + z < y + z := by
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  rcases ne_top_iff.mp hz with ⟨k, rfl⟩
  induction' y using PartENat.casesOn with n
  · rw [top_add]
    -- Porting note: was apply_mod_cast natCast_lt_top
    norm_cast; apply natCast_lt_top
  norm_cast at h
  -- Porting note: was `apply_mod_cast add_lt_add_right h`
  

Proof state:
case intro.intro.a
m k : ℕ
hz : ↑k ≠ ⊤
n : ℕ
h : m < n
⊢ ↑m + ↑k < ↑n + ↑k

Next tactic:
norm_cast
protected theorem add_lt_add_right {x y z : PartENat} (h : x < y) (hz : z ≠ ⊤) : x + z < y + z := by
  rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
  rcases ne_top_iff.mp hz with ⟨k, rfl⟩
  induction' y using PartENat.casesOn with n
  · rw [top_add]
    -- Porting note: was apply_mod_cast natCast_lt_top
    norm_cast; apply natCast_lt_top
  norm_cast at h
  -- Porting note: was `apply_mod_cast add_lt_add_right h`
  norm_cast; 

Proof state:
case intro.intro.a
m k : ℕ
hz : ↑k ≠ ⊤
n : ℕ
h : m < n
⊢ m + k < n + k

Next tactic:
apply add_lt_add_right h
protected theorem add_lt_add_iff_left {x y z : PartENat} (hz : z ≠ ⊤) : z + x < z + y ↔ x < y := by
  

Proof state:
x y z : PartENat
hz : z ≠ ⊤
⊢ z + x < z + y ↔ x < y

Next tactic:
rw [add_comm z, add_comm z, PartENat.add_lt_add_iff_right hz]