l3lab/ntp-mathlib huggingface dataset:
theorem nf_repr_split' : ∀ {o o' m} [NF o], split' o = (o', m) → NF o' ∧ repr o = ω * repr o' + m
  | 0, o', m, _, p => by injection p; substs o' m; simp [NF.zero]
  | oadd e n a, o', m, h, p => by
    by_cases e0 : e = 0 <;> simp [e0, split, split'] at p ⊢
    · rcases p with ⟨rfl, rfl⟩
      simp [h.zero_of_zero e0, NF.zero]
    · revert p
      cases' h' : split' a with a' m'
      haveI := h.fst
      haveI := h.snd
      cases' nf_repr_split' h' with IH₁ IH₂
      simp only [IH₂, and_imp]
      intros
      substs o' m
      have : (ω : Ordinal.{0}) ^ repr e = ω ^ (1 : Ordinal.{0}) * ω ^ (repr e - 1) := by
        have := mt repr_inj.1 e0
        rw [← opow_add, Ordinal.add_sub_cancel_of_le (one_le_iff_ne_zero.2 this)]
      refine' ⟨NF.oadd (by infer_instance) _ _, _⟩
      · simp at this ⊢
        

Proof state:
case neg.mk.intro.refine'_1
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
e0 : ¬e = 0
a' : ONote
m' : ℕ
h' : split' a = (a', m')
this✝¹ : NF e
this✝ : NF a
IH₁ : NF a'
IH₂ : repr a = ω * repr a' + ↑m'
this : ω ^ repr e = ω * ω ^ (repr e - 1)
⊢ NFBelow a' (repr e - 1)

Next tactic:
refine'
          IH₁.below_of_lt'
            ((Ordinal.mul_lt_mul_iff_left omega_pos).1 <| lt_of_le_of_lt (le_add_right _ m') _)
theorem nf_repr_split' : ∀ {o o' m} [NF o], split' o = (o', m) → NF o' ∧ repr o = ω * repr o' + m
  | 0, o', m, _, p => by injection p; substs o' m; simp [NF.zero]
  | oadd e n a, o', m, h, p => by
    by_cases e0 : e = 0 <;> simp [e0, split, split'] at p ⊢
    · rcases p with ⟨rfl, rfl⟩
      simp [h.zero_of_zero e0, NF.zero]
    · revert p
      cases' h' : split' a with a' m'
      haveI := h.fst
      haveI := h.snd
      cases' nf_repr_split' h' with IH₁ IH₂
      simp only [IH₂, and_imp]
      intros
      substs o' m
      have : (ω : Ordinal.{0}) ^ repr e = ω ^ (1 : Ordinal.{0}) * ω ^ (repr e - 1) := by
        have := mt repr_inj.1 e0
        rw [← opow_add, Ordinal.add_sub_cancel_of_le (one_le_iff_ne_zero.2 this)]
      refine' ⟨NF.oadd (by infer_instance) _ _, _⟩
      · simp at this ⊢
        refine'
          IH₁.below_of_lt'
            ((Ordinal.mul_lt_mul_iff_left omega_pos).1 <| lt_of_le_of_lt (le_add_right _ m') _)
        

Proof state:
case neg.mk.intro.refine'_1
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
e0 : ¬e = 0
a' : ONote
m' : ℕ
h' : split' a = (a', m')
this✝¹ : NF e
this✝ : NF a
IH₁ : NF a'
IH₂ : repr a = ω * repr a' + ↑m'
this : ω ^ repr e = ω * ω ^ (repr e - 1)
⊢ ω * repr a' + ↑m' < ω * ω ^ (repr e - 1)

Next tactic:
rw [← this, ← IH₂]
theorem nf_repr_split' : ∀ {o o' m} [NF o], split' o = (o', m) → NF o' ∧ repr o = ω * repr o' + m
  | 0, o', m, _, p => by injection p; substs o' m; simp [NF.zero]
  | oadd e n a, o', m, h, p => by
    by_cases e0 : e = 0 <;> simp [e0, split, split'] at p ⊢
    · rcases p with ⟨rfl, rfl⟩
      simp [h.zero_of_zero e0, NF.zero]
    · revert p
      cases' h' : split' a with a' m'
      haveI := h.fst
      haveI := h.snd
      cases' nf_repr_split' h' with IH₁ IH₂
      simp only [IH₂, and_imp]
      intros
      substs o' m
      have : (ω : Ordinal.{0}) ^ repr e = ω ^ (1 : Ordinal.{0}) * ω ^ (repr e - 1) := by
        have := mt repr_inj.1 e0
        rw [← opow_add, Ordinal.add_sub_cancel_of_le (one_le_iff_ne_zero.2 this)]
      refine' ⟨NF.oadd (by infer_instance) _ _, _⟩
      · simp at this ⊢
        refine'
          IH₁.below_of_lt'
            ((Ordinal.mul_lt_mul_iff_left omega_pos).1 <| lt_of_le_of_lt (le_add_right _ m') _)
        rw [← this, ← IH₂]
        

Proof state:
case neg.mk.intro.refine'_1
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
e0 : ¬e = 0
a' : ONote
m' : ℕ
h' : split' a = (a', m')
this✝¹ : NF e
this✝ : NF a
IH₁ : NF a'
IH₂ : repr a = ω * repr a' + ↑m'
this : ω ^ repr e = ω * ω ^ (repr e - 1)
⊢ repr a < ω ^ repr e

Next tactic:
exact h.snd'.repr_lt
theorem nf_repr_split' : ∀ {o o' m} [NF o], split' o = (o', m) → NF o' ∧ repr o = ω * repr o' + m
  | 0, o', m, _, p => by injection p; substs o' m; simp [NF.zero]
  | oadd e n a, o', m, h, p => by
    by_cases e0 : e = 0 <;> simp [e0, split, split'] at p ⊢
    · rcases p with ⟨rfl, rfl⟩
      simp [h.zero_of_zero e0, NF.zero]
    · revert p
      cases' h' : split' a with a' m'
      haveI := h.fst
      haveI := h.snd
      cases' nf_repr_split' h' with IH₁ IH₂
      simp only [IH₂, and_imp]
      intros
      substs o' m
      have : (ω : Ordinal.{0}) ^ repr e = ω ^ (1 : Ordinal.{0}) * ω ^ (repr e - 1) := by
        have := mt repr_inj.1 e0
        rw [← opow_add, Ordinal.add_sub_cancel_of_le (one_le_iff_ne_zero.2 this)]
      refine' ⟨NF.oadd (by infer_instance) _ _, _⟩
      · simp at this ⊢
        refine'
          IH₁.below_of_lt'
            ((Ordinal.mul_lt_mul_iff_left omega_pos).1 <| lt_of_le_of_lt (le_add_right _ m') _)
        rw [← this, ← IH₂]
        exact h.snd'.repr_lt
      · 

Proof state:
case neg.mk.intro.refine'_2
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
e0 : ¬e = 0
a' : ONote
m' : ℕ
h' : split' a = (a', m')
this✝¹ : NF e
this✝ : NF a
IH₁ : NF a'
IH₂ : repr a = ω * repr a' + ↑m'
this : ω ^ repr e = ω ^ 1 * ω ^ (repr e - 1)
⊢ ω ^ repr e * ↑↑n + (ω * repr a' + ↑m') = ω * repr (oadd (e - 1) n a') + ↑m'

Next tactic:
rw [this]
theorem nf_repr_split' : ∀ {o o' m} [NF o], split' o = (o', m) → NF o' ∧ repr o = ω * repr o' + m
  | 0, o', m, _, p => by injection p; substs o' m; simp [NF.zero]
  | oadd e n a, o', m, h, p => by
    by_cases e0 : e = 0 <;> simp [e0, split, split'] at p ⊢
    · rcases p with ⟨rfl, rfl⟩
      simp [h.zero_of_zero e0, NF.zero]
    · revert p
      cases' h' : split' a with a' m'
      haveI := h.fst
      haveI := h.snd
      cases' nf_repr_split' h' with IH₁ IH₂
      simp only [IH₂, and_imp]
      intros
      substs o' m
      have : (ω : Ordinal.{0}) ^ repr e = ω ^ (1 : Ordinal.{0}) * ω ^ (repr e - 1) := by
        have := mt repr_inj.1 e0
        rw [← opow_add, Ordinal.add_sub_cancel_of_le (one_le_iff_ne_zero.2 this)]
      refine' ⟨NF.oadd (by infer_instance) _ _, _⟩
      · simp at this ⊢
        refine'
          IH₁.below_of_lt'
            ((Ordinal.mul_lt_mul_iff_left omega_pos).1 <| lt_of_le_of_lt (le_add_right _ m') _)
        rw [← this, ← IH₂]
        exact h.snd'.repr_lt
      · rw [this]
        

Proof state:
case neg.mk.intro.refine'_2
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
e0 : ¬e = 0
a' : ONote
m' : ℕ
h' : split' a = (a', m')
this✝¹ : NF e
this✝ : NF a
IH₁ : NF a'
IH₂ : repr a = ω * repr a' + ↑m'
this : ω ^ repr e = ω ^ 1 * ω ^ (repr e - 1)
⊢ ω ^ 1 * ω ^ (repr e - 1) * ↑↑n + (ω * repr a' + ↑m') = ω * repr (oadd (e - 1) n a') + ↑m'

Next tactic:
simp [mul_add, mul_assoc, add_assoc]
theorem scale_eq_mul (x) [NF x] : ∀ (o) [NF o], scale x o = oadd x 1 0 * o
  | 0, _ => rfl
  | oadd e n a, h => by
    

Proof state:
x : ONote
inst✝ : NF x
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
⊢ scale x (oadd e n a) = oadd x 1 0 * oadd e n a

Next tactic:
simp only [HMul.hMul]
theorem scale_eq_mul (x) [NF x] : ∀ (o) [NF o], scale x o = oadd x 1 0 * o
  | 0, _ => rfl
  | oadd e n a, h => by
    simp only [HMul.hMul]; 

Proof state:
x : ONote
inst✝ : NF x
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
⊢ scale x (oadd e n a) = Mul.mul (oadd x 1 0) (oadd e n a)

Next tactic:
simp only [scale]
theorem scale_eq_mul (x) [NF x] : ∀ (o) [NF o], scale x o = oadd x 1 0 * o
  | 0, _ => rfl
  | oadd e n a, h => by
    simp only [HMul.hMul]; simp only [scale]
    

Proof state:
x : ONote
inst✝ : NF x
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
⊢ oadd (x + e) n (scale x a) = Mul.mul (oadd x 1 0) (oadd e n a)

Next tactic:
haveI := h.snd
theorem scale_eq_mul (x) [NF x] : ∀ (o) [NF o], scale x o = oadd x 1 0 * o
  | 0, _ => rfl
  | oadd e n a, h => by
    simp only [HMul.hMul]; simp only [scale]
    haveI := h.snd
    

Proof state:
x : ONote
inst✝ : NF x
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
this : NF a
⊢ oadd (x + e) n (scale x a) = Mul.mul (oadd x 1 0) (oadd e n a)

Next tactic:
by_cases e0 : e = 0
theorem scale_eq_mul (x) [NF x] : ∀ (o) [NF o], scale x o = oadd x 1 0 * o
  | 0, _ => rfl
  | oadd e n a, h => by
    simp only [HMul.hMul]; simp only [scale]
    haveI := h.snd
    by_cases e0 : e = 0
    · 

Proof state:
case pos
x : ONote
inst✝ : NF x
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
this : NF a
e0 : e = 0
⊢ oadd (x + e) n (scale x a) = Mul.mul (oadd x 1 0) (oadd e n a)

Next tactic:
simp_rw [scale_eq_mul]
theorem scale_eq_mul (x) [NF x] : ∀ (o) [NF o], scale x o = oadd x 1 0 * o
  | 0, _ => rfl
  | oadd e n a, h => by
    simp only [HMul.hMul]; simp only [scale]
    haveI := h.snd
    by_cases e0 : e = 0
    · simp_rw [scale_eq_mul]
      

Proof state:
case pos
x : ONote
inst✝ : NF x
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
this : NF a
e0 : e = 0
⊢ oadd (x + e) n (oadd x 1 0 * a) = Mul.mul (oadd x 1 0) (oadd e n a)

Next tactic:
simp [Mul.mul, mul, scale_eq_mul, e0, h.zero_of_zero,
        show x + 0 = x from repr_inj.1 (by simp)]
theorem scale_eq_mul (x) [NF x] : ∀ (o) [NF o], scale x o = oadd x 1 0 * o
  | 0, _ => rfl
  | oadd e n a, h => by
    simp only [HMul.hMul]; simp only [scale]
    haveI := h.snd
    by_cases e0 : e = 0
    · simp_rw [scale_eq_mul]
      simp [Mul.mul, mul, scale_eq_mul, e0, h.zero_of_zero,
        show x + 0 = x from repr_inj.1 (by 

Proof state:
x : ONote
inst✝ : NF x
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
this : NF a
e0 : e = 0
⊢ repr (x + 0) = repr x

Next tactic:
simp
theorem scale_eq_mul (x) [NF x] : ∀ (o) [NF o], scale x o = oadd x 1 0 * o
  | 0, _ => rfl
  | oadd e n a, h => by
    simp only [HMul.hMul]; simp only [scale]
    haveI := h.snd
    by_cases e0 : e = 0
    · simp_rw [scale_eq_mul]
      simp [Mul.mul, mul, scale_eq_mul, e0, h.zero_of_zero,
        show x + 0 = x from repr_inj.1 (by simp)]
    · 

Proof state:
case neg
x : ONote
inst✝ : NF x
e : ONote
n : ℕ+
a : ONote
h : NF (oadd e n a)
this : NF a
e0 : ¬e = 0
⊢ oadd (x + e) n (scale x a) = Mul.mul (oadd x 1 0) (oadd e n a)

Next tactic:
simp [e0, Mul.mul, mul, scale_eq_mul, (· * ·)]
instance nf_scale (x) [NF x] (o) [NF o] : NF (scale x o) := by
  

Proof state:
x : ONote
inst✝¹ : NF x
o : ONote
inst✝ : NF o
⊢ NF (scale x o)

Next tactic:
rw [scale_eq_mul]
instance nf_scale (x) [NF x] (o) [NF o] : NF (scale x o) := by
  rw [scale_eq_mul]
  

Proof state:
x : ONote
inst✝¹ : NF x
o : ONote
inst✝ : NF o
⊢ NF (oadd x 1 0 * o)

Next tactic:
infer_instance
@[simp]
theorem repr_scale (x) [NF x] (o) [NF o] : repr (scale x o) = ω ^ repr x * repr o := by
  

Proof state:
x : ONote
inst✝¹ : NF x
o : ONote
inst✝ : NF o
⊢ repr (scale x o) = ω ^ repr x * repr o

Next tactic:
simp only [scale_eq_mul, repr_mul, repr, PNat.one_coe, Nat.cast_one, mul_one, add_zero]
theorem nf_repr_split {o o' m} [NF o] (h : split o = (o', m)) : NF o' ∧ repr o = repr o' + m := by
  

Proof state:
o o' : ONote
m : ℕ
inst✝ : NF o
h : split o = (o', m)
⊢ NF o' ∧ repr o = repr o' + ↑m

Next tactic:
cases' e : split' o with a n
theorem nf_repr_split {o o' m} [NF o] (h : split o = (o', m)) : NF o' ∧ repr o = repr o' + m := by
  cases' e : split' o with a n
  

Proof state:
case mk
o o' : ONote
m : ℕ
inst✝ : NF o
h : split o = (o', m)
a : ONote
n : ℕ
e : split' o = (a, n)
⊢ NF o' ∧ repr o = repr o' + ↑m

Next tactic:
cases' nf_repr_split' e with s₁ s₂
theorem nf_repr_split {o o' m} [NF o] (h : split o = (o', m)) : NF o' ∧ repr o = repr o' + m := by
  cases' e : split' o with a n
  cases' nf_repr_split' e with s₁ s₂; 

Proof state:
case mk.intro
o o' : ONote
m : ℕ
inst✝ : NF o
h : split o = (o', m)
a : ONote
n : ℕ
e : split' o = (a, n)
s₁ : NF a
s₂ : repr o = ω * repr a + ↑n
⊢ NF o' ∧ repr o = repr o' + ↑m

Next tactic:
skip
theorem nf_repr_split {o o' m} [NF o] (h : split o = (o', m)) : NF o' ∧ repr o = repr o' + m := by
  cases' e : split' o with a n
  cases' nf_repr_split' e with s₁ s₂; skip
  

Proof state:
case mk.intro
o o' : ONote
m : ℕ
inst✝ : NF o
h : split o = (o', m)
a : ONote
n : ℕ
e : split' o = (a, n)
s₁ : NF a
s₂ : repr o = ω * repr a + ↑n
⊢ NF o' ∧ repr o = repr o' + ↑m

Next tactic:
rw [split_eq_scale_split' e] at h
theorem nf_repr_split {o o' m} [NF o] (h : split o = (o', m)) : NF o' ∧ repr o = repr o' + m := by
  cases' e : split' o with a n
  cases' nf_repr_split' e with s₁ s₂; skip
  rw [split_eq_scale_split' e] at h
  

Proof state:
case mk.intro
o o' : ONote
m : ℕ
inst✝ : NF o
a : ONote
n : ℕ
h : (scale 1 a, n) = (o', m)
e : split' o = (a, n)
s₁ : NF a
s₂ : repr o = ω * repr a + ↑n
⊢ NF o' ∧ repr o = repr o' + ↑m

Next tactic:
injection h
theorem nf_repr_split {o o' m} [NF o] (h : split o = (o', m)) : NF o' ∧ repr o = repr o' + m := by
  cases' e : split' o with a n
  cases' nf_repr_split' e with s₁ s₂; skip
  rw [split_eq_scale_split' e] at h
  injection h; 

Proof state:
case mk.intro
o o' : ONote
m : ℕ
inst✝ : NF o
a : ONote
n : ℕ
e : split' o = (a, n)
s₁ : NF a
s₂ : repr o = ω * repr a + ↑n
fst_eq✝ : scale 1 a = o'
snd_eq✝ : n = m
⊢ NF o' ∧ repr o = repr o' + ↑m

Next tactic:
substs o' n
theorem nf_repr_split {o o' m} [NF o] (h : split o = (o', m)) : NF o' ∧ repr o = repr o' + m := by
  cases' e : split' o with a n
  cases' nf_repr_split' e with s₁ s₂; skip
  rw [split_eq_scale_split' e] at h
  injection h; substs o' n
  

Proof state:
case mk.intro
o : ONote
m : ℕ
inst✝ : NF o
a : ONote
s₁ : NF a
e : split' o = (a, m)
s₂ : repr o = ω * repr a + ↑m
⊢ NF (scale 1 a) ∧ repr o = repr (scale 1 a) + ↑m

Next tactic:
simp only [repr_scale, repr, opow_zero, Nat.succPNat_coe, Nat.cast_one, mul_one, add_zero,
    opow_one, s₂.symm, and_true]
theorem nf_repr_split {o o' m} [NF o] (h : split o = (o', m)) : NF o' ∧ repr o = repr o' + m := by
  cases' e : split' o with a n
  cases' nf_repr_split' e with s₁ s₂; skip
  rw [split_eq_scale_split' e] at h
  injection h; substs o' n
  simp only [repr_scale, repr, opow_zero, Nat.succPNat_coe, Nat.cast_one, mul_one, add_zero,
    opow_one, s₂.symm, and_true]
  

Proof state:
case mk.intro
o : ONote
m : ℕ
inst✝ : NF o
a : ONote
s₁ : NF a
e : split' o = (a, m)
s₂ : repr o = ω * repr a + ↑m
⊢ NF (scale 1 a)

Next tactic:
infer_instance
theorem split_dvd {o o' m} [NF o] (h : split o = (o', m)) : ω ∣ repr o' := by
  

Proof state:
o o' : ONote
m : ℕ
inst✝ : NF o
h : split o = (o', m)
⊢ ω ∣ repr o'

Next tactic:
cases' e : split' o with a n
theorem split_dvd {o o' m} [NF o] (h : split o = (o', m)) : ω ∣ repr o' := by
  cases' e : split' o with a n
  

Proof state:
case mk
o o' : ONote
m : ℕ
inst✝ : NF o
h : split o = (o', m)
a : ONote
n : ℕ
e : split' o = (a, n)
⊢ ω ∣ repr o'

Next tactic:
rw [split_eq_scale_split' e] at h
theorem split_dvd {o o' m} [NF o] (h : split o = (o', m)) : ω ∣ repr o' := by
  cases' e : split' o with a n
  rw [split_eq_scale_split' e] at h
  

Proof state:
case mk
o o' : ONote
m : ℕ
inst✝ : NF o
a : ONote
n : ℕ
h : (scale 1 a, n) = (o', m)
e : split' o = (a, n)
⊢ ω ∣ repr o'

Next tactic:
injection h
theorem split_dvd {o o' m} [NF o] (h : split o = (o', m)) : ω ∣ repr o' := by
  cases' e : split' o with a n
  rw [split_eq_scale_split' e] at h
  injection h; 

Proof state:
case mk
o o' : ONote
m : ℕ
inst✝ : NF o
a : ONote
n : ℕ
e : split' o = (a, n)
fst_eq✝ : scale 1 a = o'
snd_eq✝ : n = m
⊢ ω ∣ repr o'

Next tactic:
subst o'
theorem split_dvd {o o' m} [NF o] (h : split o = (o', m)) : ω ∣ repr o' := by
  cases' e : split' o with a n
  rw [split_eq_scale_split' e] at h
  injection h; subst o'
  

Proof state:
case mk
o : ONote
m : ℕ
inst✝ : NF o
a : ONote
n : ℕ
e : split' o = (a, n)
snd_eq✝ : n = m
⊢ ω ∣ repr (scale 1 a)

Next tactic:
cases nf_repr_split' e
theorem split_dvd {o o' m} [NF o] (h : split o = (o', m)) : ω ∣ repr o' := by
  cases' e : split' o with a n
  rw [split_eq_scale_split' e] at h
  injection h; subst o'
  cases nf_repr_split' e; 

Proof state:
case mk.intro
o : ONote
m : ℕ
inst✝ : NF o
a : ONote
n : ℕ
e : split' o = (a, n)
snd_eq✝ : n = m
left✝ : NF a
right✝ : repr o = ω * repr a + ↑n
⊢ ω ∣ repr (scale 1 a)

Next tactic:
skip
theorem split_dvd {o o' m} [NF o] (h : split o = (o', m)) : ω ∣ repr o' := by
  cases' e : split' o with a n
  rw [split_eq_scale_split' e] at h
  injection h; subst o'
  cases nf_repr_split' e; skip; 

Proof state:
case mk.intro
o : ONote
m : ℕ
inst✝ : NF o
a : ONote
n : ℕ
e : split' o = (a, n)
snd_eq✝ : n = m
left✝ : NF a
right✝ : repr o = ω * repr a + ↑n
⊢ ω ∣ repr (scale 1 a)

Next tactic:
simp
theorem split_add_lt {o e n a m} [NF o] (h : split o = (oadd e n a, m)) :
    repr a + m < ω ^ repr e := by
  

Proof state:
o e : ONote
n : ℕ+
a : ONote
m : ℕ
inst✝ : NF o
h : split o = (oadd e n a, m)
⊢ repr a + ↑m < ω ^ repr e

Next tactic:
cases' nf_repr_split h with h₁ h₂
theorem split_add_lt {o e n a m} [NF o] (h : split o = (oadd e n a, m)) :
    repr a + m < ω ^ repr e := by
  cases' nf_repr_split h with h₁ h₂
  

Proof state:
case intro
o e : ONote
n : ℕ+
a : ONote
m : ℕ
inst✝ : NF o
h : split o = (oadd e n a, m)
h₁ : NF (oadd e n a)
h₂ : repr o = repr (oadd e n a) + ↑m
⊢ repr a + ↑m < ω ^ repr e

Next tactic:
cases' h₁.of_dvd_omega (split_dvd h) with e0 d
theorem split_add_lt {o e n a m} [NF o] (h : split o = (oadd e n a, m)) :
    repr a + m < ω ^ repr e := by
  cases' nf_repr_split h with h₁ h₂
  cases' h₁.of_dvd_omega (split_dvd h) with e0 d
  

Proof state:
case intro.intro
o e : ONote
n : ℕ+
a : ONote
m : ℕ
inst✝ : NF o
h : split o = (oadd e n a, m)
h₁ : NF (oadd e n a)
h₂ : repr o = repr (oadd e n a) + ↑m
e0 : repr e ≠ 0
d : ω ∣ repr a
⊢ repr a + ↑m < ω ^ repr e

Next tactic:
apply principal_add_omega_opow _ h₁.snd'.repr_lt (lt_of_lt_of_le (nat_lt_omega _) _)
theorem split_add_lt {o e n a m} [NF o] (h : split o = (oadd e n a, m)) :
    repr a + m < ω ^ repr e := by
  cases' nf_repr_split h with h₁ h₂
  cases' h₁.of_dvd_omega (split_dvd h) with e0 d
  apply principal_add_omega_opow _ h₁.snd'.repr_lt (lt_of_lt_of_le (nat_lt_omega _) _)
  

Proof state:
o e : ONote
n : ℕ+
a : ONote
m : ℕ
inst✝ : NF o
h : split o = (oadd e n a, m)
h₁ : NF (oadd e n a)
h₂ : repr o = repr (oadd e n a) + ↑m
e0 : repr e ≠ 0
d : ω ∣ repr a
⊢ ω ≤ ω ^ repr e

Next tactic:
simpa using opow_le_opow_right omega_pos (one_le_iff_ne_zero.2 e0)
@[simp]
theorem mulNat_eq_mul (n o) : mulNat o n = o * ofNat n := by 

Proof state:
n : ℕ
o : ONote
⊢ mulNat o n = o * ↑n

Next tactic:
cases o
@[simp]
theorem mulNat_eq_mul (n o) : mulNat o n = o * ofNat n := by cases o <;> 

Proof state:
case zero
n : ℕ
⊢ mulNat zero n = zero * ↑n

Next tactic:
cases n
@[simp]
theorem mulNat_eq_mul (n o) : mulNat o n = o * ofNat n := by cases o <;> 

Proof state:
case oadd
n : ℕ
a✝² : ONote
a✝¹ : ℕ+
a✝ : ONote
⊢ mulNat (oadd a✝² a✝¹ a✝) n = oadd a✝² a✝¹ a✝ * ↑n

Next tactic:
cases n
@[simp]
theorem mulNat_eq_mul (n o) : mulNat o n = o * ofNat n := by cases o <;> cases n <;> 

Proof state:
case zero.zero
⊢ mulNat zero Nat.zero = zero * ↑Nat.zero

Next tactic:
rfl
@[simp]
theorem mulNat_eq_mul (n o) : mulNat o n = o * ofNat n := by cases o <;> cases n <;> 

Proof state:
case zero.succ
n✝ : ℕ
⊢ mulNat zero (Nat.succ n✝) = zero * ↑(Nat.succ n✝)

Next tactic:
rfl
@[simp]
theorem mulNat_eq_mul (n o) : mulNat o n = o * ofNat n := by cases o <;> cases n <;> 

Proof state:
case oadd.zero
a✝² : ONote
a✝¹ : ℕ+
a✝ : ONote
⊢ mulNat (oadd a✝² a✝¹ a✝) Nat.zero = oadd a✝² a✝¹ a✝ * ↑Nat.zero

Next tactic:
rfl
@[simp]
theorem mulNat_eq_mul (n o) : mulNat o n = o * ofNat n := by cases o <;> cases n <;> 

Proof state:
case oadd.succ
a✝² : ONote
a✝¹ : ℕ+
a✝ : ONote
n✝ : ℕ
⊢ mulNat (oadd a✝² a✝¹ a✝) (Nat.succ n✝) = oadd a✝² a✝¹ a✝ * ↑(Nat.succ n✝)

Next tactic:
rfl
instance nf_mulNat (o) [NF o] (n) : NF (mulNat o n) := by 

Proof state:
o : ONote
inst✝ : NF o
n : ℕ
⊢ NF (mulNat o n)

Next tactic:
simp
instance nf_mulNat (o) [NF o] (n) : NF (mulNat o n) := by simp; 

Proof state:
o : ONote
inst✝ : NF o
n : ℕ
⊢ NF (o * ↑n)

Next tactic:
exact ONote.mul_nf o (ofNat n)
instance nf_opowAux (e a0 a) [NF e] [NF a0] [NF a] : ∀ k m, NF (opowAux e a0 a k m) := by
  

Proof state:
e a0 a : ONote
inst✝² : NF e
inst✝¹ : NF a0
inst✝ : NF a
⊢ ∀ (k m : ℕ), NF (opowAux e a0 a k m)

Next tactic:
intro k m
instance nf_opowAux (e a0 a) [NF e] [NF a0] [NF a] : ∀ k m, NF (opowAux e a0 a k m) := by
  intro k m
  

Proof state:
e a0 a : ONote
inst✝² : NF e
inst✝¹ : NF a0
inst✝ : NF a
k m : ℕ
⊢ NF (opowAux e a0 a k m)

Next tactic:
unfold opowAux
instance nf_opowAux (e a0 a) [NF e] [NF a0] [NF a] : ∀ k m, NF (opowAux e a0 a k m) := by
  intro k m
  unfold opowAux
  

Proof state:
e a0 a : ONote
inst✝² : NF e
inst✝¹ : NF a0
inst✝ : NF a
k m : ℕ
⊢ NF
    (match k, m with
    | x, 0 => 0
    | 0, Nat.succ m => oadd e (Nat.succPNat m) 0
    | Nat.succ k, m => scale (e + mulNat a0 k) a + opowAux e a0 a k m)

Next tactic:
cases' m with m m
instance nf_opowAux (e a0 a) [NF e] [NF a0] [NF a] : ∀ k m, NF (opowAux e a0 a k m) := by
  intro k m
  unfold opowAux
  cases' m with m m
  · 

Proof state:
case zero
e a0 a : ONote
inst✝² : NF e
inst✝¹ : NF a0
inst✝ : NF a
k : ℕ
⊢ NF
    (match k, Nat.zero with
    | x, 0 => 0
    | 0, Nat.succ m => oadd e (Nat.succPNat m) 0
    | Nat.succ k, m => scale (e + mulNat a0 k) a + opowAux e a0 a k m)

Next tactic:
cases k
instance nf_opowAux (e a0 a) [NF e] [NF a0] [NF a] : ∀ k m, NF (opowAux e a0 a k m) := by
  intro k m
  unfold opowAux
  cases' m with m m
  · cases k <;> 

Proof state:
case zero.zero
e a0 a : ONote
inst✝² : NF e
inst✝¹ : NF a0
inst✝ : NF a
⊢ NF
    (match Nat.zero, Nat.zero with
    | x, 0 => 0
    | 0, Nat.succ m => oadd e (Nat.succPNat m) 0
    | Nat.succ k, m => scale (e + mulNat a0 k) a + opowAux e a0 a k m)

Next tactic:
exact NF.zero
instance nf_opowAux (e a0 a) [NF e] [NF a0] [NF a] : ∀ k m, NF (opowAux e a0 a k m) := by
  intro k m
  unfold opowAux
  cases' m with m m
  · cases k <;> 

Proof state:
case zero.succ
e a0 a : ONote
inst✝² : NF e
inst✝¹ : NF a0
inst✝ : NF a
n✝ : ℕ
⊢ NF
    (match Nat.succ n✝, Nat.zero with
    | x, 0 => 0
    | 0, Nat.succ m => oadd e (Nat.succPNat m) 0
    | Nat.succ k, m => scale (e + mulNat a0 k) a + opowAux e a0 a k m)

Next tactic:
exact NF.zero
instance nf_opowAux (e a0 a) [NF e] [NF a0] [NF a] : ∀ k m, NF (opowAux e a0 a k m) := by
  intro k m
  unfold opowAux
  cases' m with m m
  · cases k <;> exact NF.zero
  

Proof state:
case succ
e a0 a : ONote
inst✝² : NF e
inst✝¹ : NF a0
inst✝ : NF a
k m : ℕ
⊢ NF
    (match k, Nat.succ m with
    | x, 0 => 0
    | 0, Nat.succ m => oadd e (Nat.succPNat m) 0
    | Nat.succ k, m => scale (e + mulNat a0 k) a + opowAux e a0 a k m)

Next tactic:
cases' k with k k
instance nf_opowAux (e a0 a) [NF e] [NF a0] [NF a] : ∀ k m, NF (opowAux e a0 a k m) := by
  intro k m
  unfold opowAux
  cases' m with m m
  · cases k <;> exact NF.zero
  cases' k with k k
  · 

Proof state:
case succ.zero
e a0 a : ONote
inst✝² : NF e
inst✝¹ : NF a0
inst✝ : NF a
m : ℕ
⊢ NF
    (match Nat.zero, Nat.succ m with
    | x, 0 => 0
    | 0, Nat.succ m => oadd e (Nat.succPNat m) 0
    | Nat.succ k, m => scale (e + mulNat a0 k) a + opowAux e a0 a k m)

Next tactic:
exact NF.oadd_zero _ _
instance nf_opowAux (e a0 a) [NF e] [NF a0] [NF a] : ∀ k m, NF (opowAux e a0 a k m) := by
  intro k m
  unfold opowAux
  cases' m with m m
  · cases k <;> exact NF.zero
  cases' k with k k
  · exact NF.oadd_zero _ _
  · 

Proof state:
case succ.succ
e a0 a : ONote
inst✝² : NF e
inst✝¹ : NF a0
inst✝ : NF a
m k : ℕ
⊢ NF
    (match Nat.succ k, Nat.succ m with
    | x, 0 => 0
    | 0, Nat.succ m => oadd e (Nat.succPNat m) 0
    | Nat.succ k, m => scale (e + mulNat a0 k) a + opowAux e a0 a k m)

Next tactic:
haveI := nf_opowAux e a0 a k
instance nf_opowAux (e a0 a) [NF e] [NF a0] [NF a] : ∀ k m, NF (opowAux e a0 a k m) := by
  intro k m
  unfold opowAux
  cases' m with m m
  · cases k <;> exact NF.zero
  cases' k with k k
  · exact NF.oadd_zero _ _
  · haveI := nf_opowAux e a0 a k
    

Proof state:
case succ.succ
e a0 a : ONote
inst✝² : NF e
inst✝¹ : NF a0
inst✝ : NF a
m k : ℕ
this : ∀ (m : ℕ), NF (opowAux e a0 a k m)
⊢ NF
    (match Nat.succ k, Nat.succ m with
    | x, 0 => 0
    | 0, Nat.succ m => oadd e (Nat.succPNat m) 0
    | Nat.succ k, m => scale (e + mulNat a0 k) a + opowAux e a0 a k m)

Next tactic:
simp only [Nat.succ_ne_zero m]