l3lab/ntp-mathlib huggingface dataset:
@[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]; dsimp only [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
      (match cmp e₁ e₂ with
      | Ordering.lt => 0
      | Ordering.gt => oadd e₁ n₁ a₁
      | Ordering.eq =>
        match ↑n₁ - ↑n₂ with
        | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
        | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁) =
    repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
have ee := @cmp_compares _ _ h₁.fst h₂.fst
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    

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₂
ee : Ordering.Compares (cmp e₁ e₂) e₁ e₂
⊢ repr
      (match cmp e₁ e₂ with
      | Ordering.lt => 0
      | Ordering.gt => oadd e₁ n₁ a₁
      | Ordering.eq =>
        match ↑n₁ - ↑n₂ with
        | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
        | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁) =
    repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
cases h : cmp e₁ e₂
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> 

Proof state:
case lt
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₂
ee : Ordering.Compares (cmp e₁ e₂) e₁ e₂
h : cmp e₁ e₂ = Ordering.lt
⊢ repr
      (match Ordering.lt with
      | Ordering.lt => 0
      | Ordering.gt => oadd e₁ n₁ a₁
      | Ordering.eq =>
        match ↑n₁ - ↑n₂ with
        | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
        | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁) =
    repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
simp only [h] at ee
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> 

Proof state:
case eq
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₂
ee : Ordering.Compares (cmp e₁ e₂) e₁ e₂
h : cmp e₁ e₂ = Ordering.eq
⊢ repr
      (match Ordering.eq with
      | Ordering.lt => 0
      | Ordering.gt => oadd e₁ n₁ a₁
      | Ordering.eq =>
        match ↑n₁ - ↑n₂ with
        | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
        | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁) =
    repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
simp only [h] at ee
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> 

Proof state:
case gt
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₂
ee : Ordering.Compares (cmp e₁ e₂) e₁ e₂
h : cmp e₁ e₂ = Ordering.gt
⊢ repr
      (match Ordering.gt with
      | Ordering.lt => 0
      | Ordering.gt => oadd e₁ n₁ a₁
      | Ordering.eq =>
        match ↑n₁ - ↑n₂ with
        | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
        | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁) =
    repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
simp only [h] at ee
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · 

Proof state:
case lt
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₂
h : cmp e₁ e₂ = Ordering.lt
ee : Ordering.Compares Ordering.lt e₁ e₂
⊢ repr
      (match Ordering.lt with
      | Ordering.lt => 0
      | Ordering.gt => oadd e₁ n₁ a₁
      | Ordering.eq =>
        match ↑n₁ - ↑n₂ with
        | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
        | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁) =
    repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
rw [Ordinal.sub_eq_zero_iff_le.2]
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · 

Proof state:
case lt
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₂
h : cmp e₁ e₂ = Ordering.lt
ee : Ordering.Compares Ordering.lt e₁ e₂
⊢ repr
      (match Ordering.lt with
      | Ordering.lt => 0
      | Ordering.gt => oadd e₁ n₁ a₁
      | Ordering.eq =>
        match ↑n₁ - ↑n₂ with
        | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
        | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁) =
    0

Next tactic:
rfl
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      

Proof state:
case lt
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₂
h : cmp e₁ e₂ = Ordering.lt
ee : Ordering.Compares Ordering.lt e₁ e₂
⊢ repr (oadd e₁ n₁ a₁) ≤ repr (oadd e₂ n₂ a₂)

Next tactic:
exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · 

Proof state:
case eq
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₂
h : cmp e₁ e₂ = Ordering.eq
ee : Ordering.Compares Ordering.eq e₁ e₂
⊢ repr
      (match Ordering.eq with
      | Ordering.lt => 0
      | Ordering.gt => oadd e₁ n₁ a₁
      | Ordering.eq =>
        match ↑n₁ - ↑n₂ with
        | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
        | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁) =
    repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
change e₁ = e₂ at ee
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · change e₁ = e₂ at ee
      

Proof state:
case eq
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₂
h : cmp e₁ e₂ = Ordering.eq
ee : e₁ = e₂
⊢ repr
      (match Ordering.eq with
      | Ordering.lt => 0
      | Ordering.gt => oadd e₁ n₁ a₁
      | Ordering.eq =>
        match ↑n₁ - ↑n₂ with
        | 0 => if n₁ = n₂ then sub a₁ a₂ else 0
        | Nat.succ k => oadd e₁ (Nat.succPNat k) a₁) =
    repr (oadd e₁ n₁ a₁) - repr (oadd e₂ n₂ a₂)

Next tactic:
subst e₂
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · change e₁ = e₂ at ee
      subst e₂
      

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

Next tactic:
dsimp only
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · change e₁ = e₂ at ee
      subst e₂
      dsimp only
      

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

Next tactic:
cases mn : (n₁ : ℕ) - n₂
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · change e₁ = e₂ at ee
      subst e₂
      dsimp only
      cases mn : (n₁ : ℕ) - n₂ <;> 

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

Next tactic:
dsimp only
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · change e₁ = e₂ at ee
      subst e₂
      dsimp only
      cases mn : (n₁ : ℕ) - n₂ <;> 

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

Next tactic:
dsimp only
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · change e₁ = e₂ at ee
      subst e₂
      dsimp only
      cases mn : (n₁ : ℕ) - n₂ <;> dsimp only
      · 

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

Next tactic:
by_cases en : n₁ = n₂
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · change e₁ = e₂ at ee
      subst e₂
      dsimp only
      cases mn : (n₁ : ℕ) - n₂ <;> dsimp only
      · by_cases en : n₁ = n₂
        · 

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

Next tactic:
simpa [en]
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · change e₁ = e₂ at ee
      subst e₂
      dsimp only
      cases mn : (n₁ : ℕ) - n₂ <;> dsimp only
      · by_cases en : n₁ = n₂
        · simpa [en]
        · 

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

Next tactic:
simp only [en, ite_false]
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · change e₁ = e₂ at ee
      subst e₂
      dsimp only
      cases mn : (n₁ : ℕ) - n₂ <;> dsimp only
      · by_cases en : n₁ = n₂
        · simpa [en]
        · simp only [en, ite_false]
          

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

Next tactic:
exact
            (Ordinal.sub_eq_zero_iff_le.2 <|
                le_of_lt <|
                  oadd_lt_oadd_2 h₁ <|
                    lt_of_le_of_ne (tsub_eq_zero_iff_le.1 mn) (mt PNat.eq en)).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
    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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · change e₁ = e₂ at ee
      subst e₂
      dsimp only
      cases mn : (n₁ : ℕ) - n₂ <;> dsimp only
      · by_cases en : n₁ = n₂
        · simpa [en]
        · simp only [en, ite_false]
          exact
            (Ordinal.sub_eq_zero_iff_le.2 <|
                le_of_lt <|
                  oadd_lt_oadd_2 h₁ <|
                    lt_of_le_of_ne (tsub_eq_zero_iff_le.1 mn) (mt PNat.eq en)).symm
      · 

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

Next tactic:
simp [Nat.succPNat, -Nat.cast_succ]
@[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]; dsimp only [sub]
    have ee := @cmp_compares _ _ h₁.fst h₂.fst
    cases h : cmp e₁ e₂ <;> simp only [h] at ee
    · rw [Ordinal.sub_eq_zero_iff_le.2]
      · rfl
      exact le_of_lt (oadd_lt_oadd_1 h₁ ee)
    · change e₁ = e₂ at ee
      subst e₂
      dsimp only
      cases mn : (n₁ : ℕ) - n₂ <;> dsimp only
      · by_cases en : n₁ = n₂
        · simpa [en]
        · simp only [en, ite_false]
          exact
            (Ordinal.sub_eq_zero_iff_le.2 <|
                le_of_lt <|
                  oadd_lt_oadd_2 h₁ <|
                    lt_of_le_of_ne (tsub_eq_zero_iff_le.1 mn) (mt PNat.eq en)).symm
      · simp [Nat.succPNat, -Nat.cast_succ]
        

Proof state:
case eq.succ
e₁ : ONote
n₁ : ℕ+
a₁ : ONote
n₂ : ℕ+
a₂ : ONote
h₁ : NF (oadd e₁ n₁ a₁)
this✝ : NF a₁
this : NF a₂
h' : repr (sub a₁ a₂) = repr a₁ - repr a₂
h₂ : NF (oadd e₁ n₂ a₂)
h : cmp e₁ e₁ = Ordering.eq
n✝ : ℕ
mn : ↑n₁ - ↑n₂ = Nat.succ n✝
⊢ ω ^ repr e₁ * ↑(Nat.succ n✝) + repr a₁ = ω ^ repr e₁ * ↑↑n₁ + repr a₁ - (ω ^ repr e₁ * ↑↑n₂ + repr a₂)

Next tactic:
rw [(tsub_eq_iff_eq_add_of_le <| le_of_lt <| Nat.lt_of_sub_eq_succ mn).1 mn, add_comm,
          Nat.cast_add, mul_add, add_assoc, add_sub_add_cancel]