l3lab/ntp-mathlib huggingface dataset:
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> 

Proof state:
case zero
b : Ordinal.{0}
x✝ : NFBelow 0 b
h₂ : NF zero
⊢ NFBelow (0 - zero) b

Next tactic:
exact NFBelow.zero
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> 

Proof state:
case oadd
b : Ordinal.{0}
x✝ : NFBelow 0 b
a✝² : ONote
a✝¹ : ℕ+
a✝ : ONote
h₂ : NF (oadd a✝² a✝¹ a✝)
⊢ NFBelow (0 - oadd a✝² a✝¹ a✝) b

Next tactic:
exact NFBelow.zero
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h₂ : NF (oadd e₂ n₂ a₂)
⊢ NFBelow (oadd e₁ n₁ a₁ - oadd e₂ n₂ a₂) b

Next tactic:
have h' := sub_nfBelow h₁.snd h₂.snd
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h₂ : NF (oadd e₂ n₂ a₂)
h' : NFBelow (a₁ - a₂) (repr e₁)
⊢ NFBelow (oadd e₁ n₁ a₁ - oadd e₂ n₂ a₂) b

Next tactic:
simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h₂ : NF (oadd e₂ n₂ a₂)
h' : NFBelow (sub a₁ a₂) (repr e₁)
⊢ NFBelow
    (match cmp e₁ e₂ with
    | Ordering.lt => 0
    | Ordering.gt => oadd e₁ n₁ a₁
    | Ordering.eq =>
      match Nat.sub ↑n₁ ↑n₂ with
      | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
      | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁)
    b

Next tactic:
have := @cmp_compares _ _ h₁.fst h₂.fst
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h₂ : NF (oadd e₂ n₂ a₂)
h' : NFBelow (sub a₁ a₂) (repr e₁)
this : Ordering.Compares (cmp e₁ e₂) e₁ e₂
⊢ NFBelow
    (match cmp e₁ e₂ with
    | Ordering.lt => 0
    | Ordering.gt => oadd e₁ n₁ a₁
    | Ordering.eq =>
      match Nat.sub ↑n₁ ↑n₂ with
      | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
      | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁)
    b

Next tactic:
cases h : cmp e₁ e₂
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> 

Proof state:
case lt
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h₂ : NF (oadd e₂ n₂ a₂)
h' : NFBelow (sub a₁ a₂) (repr e₁)
this : Ordering.Compares (cmp e₁ e₂) e₁ e₂
h : cmp e₁ e₂ = Ordering.lt
⊢ NFBelow
    (match Ordering.lt with
    | Ordering.lt => 0
    | Ordering.gt => oadd e₁ n₁ a₁
    | Ordering.eq =>
      match Nat.sub ↑n₁ ↑n₂ with
      | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
      | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁)
    b

Next tactic:
simp [sub]
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> 

Proof state:
case eq
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h₂ : NF (oadd e₂ n₂ a₂)
h' : NFBelow (sub a₁ a₂) (repr e₁)
this : Ordering.Compares (cmp e₁ e₂) e₁ e₂
h : cmp e₁ e₂ = Ordering.eq
⊢ NFBelow
    (match Ordering.eq with
    | Ordering.lt => 0
    | Ordering.gt => oadd e₁ n₁ a₁
    | Ordering.eq =>
      match Nat.sub ↑n₁ ↑n₂ with
      | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
      | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁)
    b

Next tactic:
simp [sub]
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> 

Proof state:
case gt
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h₂ : NF (oadd e₂ n₂ a₂)
h' : NFBelow (sub a₁ a₂) (repr e₁)
this : Ordering.Compares (cmp e₁ e₂) e₁ e₂
h : cmp e₁ e₂ = Ordering.gt
⊢ NFBelow
    (match Ordering.gt with
    | Ordering.lt => 0
    | Ordering.gt => oadd e₁ n₁ a₁
    | Ordering.eq =>
      match Nat.sub ↑n₁ ↑n₂ with
      | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
      | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁)
    b

Next tactic:
simp [sub]
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · 

Proof state:
case lt
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h₂ : NF (oadd e₂ n₂ a₂)
h' : NFBelow (sub a₁ a₂) (repr e₁)
this : Ordering.Compares (cmp e₁ e₂) e₁ e₂
h : cmp e₁ e₂ = Ordering.lt
⊢ NFBelow 0 b

Next tactic:
apply NFBelow.zero
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · 

Proof state:
case eq
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h₂ : NF (oadd e₂ n₂ a₂)
h' : NFBelow (sub a₁ a₂) (repr e₁)
this : Ordering.Compares (cmp e₁ e₂) e₁ e₂
h : cmp e₁ e₂ = Ordering.eq
⊢ NFBelow
    (match ↑n₁ - ↑n₂ with
    | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
    | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁)
    b

Next tactic:
simp only [h, Ordering.compares_eq] at this
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · simp only [h, Ordering.compares_eq] at this
      

Proof state:
case eq
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h₂ : NF (oadd e₂ n₂ a₂)
h' : NFBelow (sub a₁ a₂) (repr e₁)
h : cmp e₁ e₂ = Ordering.eq
this : e₁ = e₂
⊢ NFBelow
    (match ↑n₁ - ↑n₂ with
    | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
    | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁)
    b

Next tactic:
subst e₂
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · simp only [h, Ordering.compares_eq] at this
      subst e₂
      

Proof state:
case eq
e₁ : ONote
n₁ : ℕ+
a₁ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h' : NFBelow (sub a₁ a₂) (repr e₁)
h₂ : NF (oadd e₁ n₂ a₂)
h : cmp e₁ e₁ = Ordering.eq
⊢ NFBelow
    (match ↑n₁ - ↑n₂ with
    | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
    | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁)
    b

Next tactic:
cases mn : (n₁ : ℕ) - n₂
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · simp only [h, Ordering.compares_eq] at this
      subst e₂
      cases mn : (n₁ : ℕ) - n₂ <;> 

Proof state:
case eq.zero
e₁ : ONote
n₁ : ℕ+
a₁ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h' : NFBelow (sub a₁ a₂) (repr e₁)
h₂ : NF (oadd e₁ n₂ a₂)
h : cmp e₁ e₁ = Ordering.eq
mn : ↑n₁ - ↑n₂ = Nat.zero
⊢ NFBelow
    (match Nat.zero with
    | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
    | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁)
    b

Next tactic:
simp [sub]
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · simp only [h, Ordering.compares_eq] at this
      subst e₂
      cases mn : (n₁ : ℕ) - n₂ <;> 

Proof state:
case eq.succ
e₁ : ONote
n₁ : ℕ+
a₁ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h' : NFBelow (sub a₁ a₂) (repr e₁)
h₂ : NF (oadd e₁ n₂ a₂)
h : cmp e₁ e₁ = Ordering.eq
n✝ : ℕ
mn : ↑n₁ - ↑n₂ = Nat.succ n✝
⊢ NFBelow
    (match Nat.succ n✝ with
    | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
    | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁)
    b

Next tactic:
simp [sub]
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · simp only [h, Ordering.compares_eq] at this
      subst e₂
      cases mn : (n₁ : ℕ) - n₂ <;> simp [sub]
      · 

Proof state:
case eq.zero
e₁ : ONote
n₁ : ℕ+
a₁ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h' : NFBelow (sub a₁ a₂) (repr e₁)
h₂ : NF (oadd e₁ n₂ a₂)
h : cmp e₁ e₁ = Ordering.eq
mn : ↑n₁ - ↑n₂ = Nat.zero
⊢ NFBelow (if n₁ = n₂ then sub a₁ a₂ else 0) b

Next tactic:
by_cases en : n₁ = n₂
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · simp only [h, Ordering.compares_eq] at this
      subst e₂
      cases mn : (n₁ : ℕ) - n₂ <;> simp [sub]
      · by_cases en : n₁ = n₂ <;> 

Proof state:
case pos
e₁ : ONote
n₁ : ℕ+
a₁ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h' : NFBelow (sub a₁ a₂) (repr e₁)
h₂ : NF (oadd e₁ n₂ a₂)
h : cmp e₁ e₁ = Ordering.eq
mn : ↑n₁ - ↑n₂ = Nat.zero
en : n₁ = n₂
⊢ NFBelow (if n₁ = n₂ then sub a₁ a₂ else 0) b

Next tactic:
simp [en]
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · simp only [h, Ordering.compares_eq] at this
      subst e₂
      cases mn : (n₁ : ℕ) - n₂ <;> simp [sub]
      · by_cases en : n₁ = n₂ <;> 

Proof state:
case neg
e₁ : ONote
n₁ : ℕ+
a₁ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h' : NFBelow (sub a₁ a₂) (repr e₁)
h₂ : NF (oadd e₁ n₂ a₂)
h : cmp e₁ e₁ = Ordering.eq
mn : ↑n₁ - ↑n₂ = Nat.zero
en : ¬n₁ = n₂
⊢ NFBelow (if n₁ = n₂ then sub a₁ a₂ else 0) b

Next tactic:
simp [en]
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · simp only [h, Ordering.compares_eq] at this
      subst e₂
      cases mn : (n₁ : ℕ) - n₂ <;> simp [sub]
      · by_cases en : n₁ = n₂ <;> simp [en]
        · 

Proof state:
case pos
e₁ : ONote
n₁ : ℕ+
a₁ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h' : NFBelow (sub a₁ a₂) (repr e₁)
h₂ : NF (oadd e₁ n₂ a₂)
h : cmp e₁ e₁ = Ordering.eq
mn : ↑n₁ - ↑n₂ = Nat.zero
en : n₁ = n₂
⊢ NFBelow (sub a₁ a₂) b

Next tactic:
exact h'.mono (le_of_lt h₁.lt)
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · simp only [h, Ordering.compares_eq] at this
      subst e₂
      cases mn : (n₁ : ℕ) - n₂ <;> simp [sub]
      · by_cases en : n₁ = n₂ <;> simp [en]
        · exact h'.mono (le_of_lt h₁.lt)
        · 

Proof state:
case neg
e₁ : ONote
n₁ : ℕ+
a₁ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h' : NFBelow (sub a₁ a₂) (repr e₁)
h₂ : NF (oadd e₁ n₂ a₂)
h : cmp e₁ e₁ = Ordering.eq
mn : ↑n₁ - ↑n₂ = Nat.zero
en : ¬n₁ = n₂
⊢ NFBelow 0 b

Next tactic:
exact NFBelow.zero
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · simp only [h, Ordering.compares_eq] at this
      subst e₂
      cases mn : (n₁ : ℕ) - n₂ <;> simp [sub]
      · by_cases en : n₁ = n₂ <;> simp [en]
        · exact h'.mono (le_of_lt h₁.lt)
        · exact NFBelow.zero
      · 

Proof state:
case eq.succ
e₁ : ONote
n₁ : ℕ+
a₁ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h' : NFBelow (sub a₁ a₂) (repr e₁)
h₂ : NF (oadd e₁ n₂ a₂)
h : cmp e₁ e₁ = Ordering.eq
n✝ : ℕ
mn : ↑n₁ - ↑n₂ = Nat.succ n✝
⊢ NFBelow (oadd e₁ (Nat.succPNat n✝) a₁) b

Next tactic:
exact NFBelow.oadd h₁.fst h₁.snd h₁.lt
theorem sub_nfBelow : ∀ {o₁ o₂ b}, NFBelow o₁ b → NF o₂ → NFBelow (o₁ - o₂) b
  | 0, o, b, _, h₂ => by cases o <;> exact NFBelow.zero
  | oadd _ _ _, 0, _, h₁, _ => h₁
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, b, h₁, h₂ => by
    have h' := sub_nfBelow h₁.snd h₂.snd
    simp only [HSub.hSub, Sub.sub, sub] at h' ⊢
    have := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp [sub]
    · apply NFBelow.zero
    · simp only [h, Ordering.compares_eq] at this
      subst e₂
      cases mn : (n₁ : ℕ) - n₂ <;> simp [sub]
      · by_cases en : n₁ = n₂ <;> simp [en]
        · exact h'.mono (le_of_lt h₁.lt)
        · exact NFBelow.zero
      · exact NFBelow.oadd h₁.fst h₁.snd h₁.lt
    · 

Proof state:
case gt
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
b : Ordinal.{0}
h₁ : NFBelow (oadd e₁ n₁ a₁) b
h₂ : NF (oadd e₂ n₂ a₂)
h' : NFBelow (sub a₁ a₂) (repr e₁)
this : Ordering.Compares (cmp e₁ e₂) e₁ e₂
h : cmp e₁ e₂ = Ordering.gt
⊢ NFBelow (oadd e₁ n₁ a₁) b

Next tactic:
exact h₁
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by 

Proof state:
o : ONote
x✝ : NF 0
h₂ : NF o
⊢ repr (0 - o) = repr 0 - repr o

Next tactic:
cases o
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by cases o <;> 

Proof state:
case zero
x✝ : NF 0
h₂ : NF zero
⊢ repr (0 - zero) = repr 0 - repr zero

Next tactic:
exact (Ordinal.zero_sub _).symm
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by cases o <;> 

Proof state:
case oadd
x✝ : NF 0
a✝² : ONote
a✝¹ : ℕ+
a✝ : ONote
h₂ : NF (oadd a✝² a✝¹ a✝)
⊢ repr (0 - oadd a✝² a✝¹ a✝) = repr 0 - repr (oadd a✝² a✝¹ a✝)

Next tactic:
exact (Ordinal.zero_sub _).symm
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by cases o <;> exact (Ordinal.zero_sub _).symm
  | oadd e n a, 0, _, _ => (Ordinal.sub_zero _).symm
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, h₁, h₂ => by
    

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
h₁ : NF (oadd e₁ n₁ a₁)
h₂ : NF (oadd e₂ n₂ a₂)
⊢ repr (oadd e₁ n₁ a₁ - oadd e₂ n₂ a₂) = repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
haveI := h₁.snd
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by cases o <;> exact (Ordinal.zero_sub _).symm
  | oadd e n a, 0, _, _ => (Ordinal.sub_zero _).symm
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, h₁, h₂ => by
    haveI := h₁.snd; 

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
h₁ : NF (oadd e₁ n₁ a₁)
h₂ : NF (oadd e₂ n₂ a₂)
this : NF a₁
⊢ repr (oadd e₁ n₁ a₁ - oadd e₂ n₂ a₂) = repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
haveI := h₂.snd
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by cases o <;> exact (Ordinal.zero_sub _).symm
  | oadd e n a, 0, _, _ => (Ordinal.sub_zero _).symm
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, h₁, h₂ => by
    haveI := h₁.snd; haveI := h₂.snd; 

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
h₁ : NF (oadd e₁ n₁ a₁)
h₂ : NF (oadd e₂ n₂ a₂)
this✝ : NF a₁
this : NF a₂
⊢ repr (oadd e₁ n₁ a₁ - oadd e₂ n₂ a₂) = repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
have h' := repr_sub a₁ a₂
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by cases o <;> exact (Ordinal.zero_sub _).symm
  | oadd e n a, 0, _, _ => (Ordinal.sub_zero _).symm
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, h₁, h₂ => by
    haveI := h₁.snd; haveI := h₂.snd; have h' := repr_sub a₁ a₂
    

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
h₁ : NF (oadd e₁ n₁ a₁)
h₂ : NF (oadd e₂ n₂ a₂)
this✝ : NF a₁
this : NF a₂
h' : repr (a₁ - a₂) = repr a₁ - repr a₂
⊢ repr (oadd e₁ n₁ a₁ - oadd e₂ n₂ a₂) = repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
conv_lhs at h' => dsimp [HSub.hSub, Sub.sub, sub]
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by cases o <;> exact (Ordinal.zero_sub _).symm
  | oadd e n a, 0, _, _ => (Ordinal.sub_zero _).symm
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, h₁, h₂ => by
    haveI := h₁.snd; haveI := h₂.snd; have h' := repr_sub a₁ a₂
    conv_lhs at h' => 

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
h₁ : NF (oadd e₁ n₁ a₁)
h₂ : NF (oadd e₂ n₂ a₂)
this✝ : NF a₁
this : NF a₂
h' : repr (a₁ - a₂) = repr a₁ - repr a₂
| repr (a₁ - a₂)

Next tactic:
dsimp [HSub.hSub, Sub.sub, sub]
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by cases o <;> exact (Ordinal.zero_sub _).symm
  | oadd e n a, 0, _, _ => (Ordinal.sub_zero _).symm
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, h₁, h₂ => by
    haveI := h₁.snd; haveI := h₂.snd; have h' := repr_sub a₁ a₂
    conv_lhs at h' => dsimp [HSub.hSub, Sub.sub, sub]
    

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
h₁ : NF (oadd e₁ n₁ a₁)
h₂ : NF (oadd e₂ n₂ a₂)
this✝ : NF a₁
this : NF a₂
h' : repr (sub a₁ a₂) = repr a₁ - repr a₂
⊢ repr (oadd e₁ n₁ a₁ - oadd e₂ n₂ a₂) = repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
conv_lhs => dsimp only [HSub.hSub, Sub.sub]; dsimp only [sub]
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by cases o <;> exact (Ordinal.zero_sub _).symm
  | oadd e n a, 0, _, _ => (Ordinal.sub_zero _).symm
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, h₁, h₂ => by
    haveI := h₁.snd; haveI := h₂.snd; have h' := repr_sub a₁ a₂
    conv_lhs at h' => dsimp [HSub.hSub, Sub.sub, sub]
    conv_lhs => 

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
h₁ : NF (oadd e₁ n₁ a₁)
h₂ : NF (oadd e₂ n₂ a₂)
this✝ : NF a₁
this : NF a₂
h' : repr (sub a₁ a₂) = repr a₁ - repr a₂
| repr (oadd e₁ n₁ a₁ - oadd e₂ n₂ a₂)

Next tactic:
dsimp only [HSub.hSub, Sub.sub]; dsimp only [sub]
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by cases o <;> exact (Ordinal.zero_sub _).symm
  | oadd e n a, 0, _, _ => (Ordinal.sub_zero _).symm
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, h₁, h₂ => by
    haveI := h₁.snd; haveI := h₂.snd; have h' := repr_sub a₁ a₂
    conv_lhs at h' => dsimp [HSub.hSub, Sub.sub, sub]
    conv_lhs => 

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
h₁ : NF (oadd e₁ n₁ a₁)
h₂ : NF (oadd e₂ n₂ a₂)
this✝ : NF a₁
this : NF a₂
h' : repr (sub a₁ a₂) = repr a₁ - repr a₂
| repr (oadd e₁ n₁ a₁ - oadd e₂ n₂ a₂)

Next tactic:
dsimp only [HSub.hSub, Sub.sub]
@[simp]
theorem repr_sub : ∀ (o₁ o₂) [NF o₁] [NF o₂], repr (o₁ - o₂) = repr o₁ - repr o₂
  | 0, o, _, h₂ => by cases o <;> exact (Ordinal.zero_sub _).symm
  | oadd e n a, 0, _, _ => (Ordinal.sub_zero _).symm
  | oadd e₁ n₁ a₁, oadd e₂ n₂ a₂, h₁, h₂ => by
    haveI := h₁.snd; haveI := h₂.snd; have h' := repr_sub a₁ a₂
    conv_lhs at h' => dsimp [HSub.hSub, Sub.sub, sub]
    conv_lhs => dsimp only [HSub.hSub, Sub.sub]; 

Proof state:
e₁ : ONote
n₁ : ℕ+
a₁ e₂ : ONote
n₂ : ℕ+
a₂ : ONote
h₁ : NF (oadd e₁ n₁ a₁)
h₂ : NF (oadd e₂ n₂ a₂)
this✝ : NF a₁
this : NF a₂
h' : repr (sub a₁ a₂) = repr a₁ - repr a₂
| repr (sub (oadd e₁ n₁ a₁) (oadd e₂ n₂ a₂))

Next tactic:
dsimp only [sub]