l3lab/ntp-mathlib huggingface dataset:
/-- Main induction principle of ordinals: if one can prove a property by
  induction at successor ordinals and at limit ordinals, then it holds for all ordinals. -/
@[elab_as_elim]
def limitRecOn {C : Ordinal → Sort*} (o : Ordinal) (H₁ : C 0) (H₂ : ∀ o, C o → C (succ o))
    (H₃ : ∀ o, IsLimit o → (∀ o' < o, C o') → C o) : C o :=
  lt_wf.fix
    (fun o IH =>
      if o0 : o = 0 then by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{?u.99036} → Sort u_4
o✝ : Ordinal.{?u.99036}
H₁ : C 0
H₂ : (o : Ordinal.{?u.99036}) → C o → C (succ o)
H₃ : (o : Ordinal.{?u.99036}) → IsLimit o → ((o' : Ordinal.{?u.99036}) → o' < o → C o') → C o
o : Ordinal.{?u.99036}
IH : (y : Ordinal.{?u.99036}) → y < o → C y
o0 : o = 0
⊢ C o

Next tactic:
rw [o0]
/-- Main induction principle of ordinals: if one can prove a property by
  induction at successor ordinals and at limit ordinals, then it holds for all ordinals. -/
@[elab_as_elim]
def limitRecOn {C : Ordinal → Sort*} (o : Ordinal) (H₁ : C 0) (H₂ : ∀ o, C o → C (succ o))
    (H₃ : ∀ o, IsLimit o → (∀ o' < o, C o') → C o) : C o :=
  lt_wf.fix
    (fun o IH =>
      if o0 : o = 0 then by rw [o0]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{?u.99036} → Sort u_4
o✝ : Ordinal.{?u.99036}
H₁ : C 0
H₂ : (o : Ordinal.{?u.99036}) → C o → C (succ o)
H₃ : (o : Ordinal.{?u.99036}) → IsLimit o → ((o' : Ordinal.{?u.99036}) → o' < o → C o') → C o
o : Ordinal.{?u.99036}
IH : (y : Ordinal.{?u.99036}) → y < o → C y
o0 : o = 0
⊢ C 0

Next tactic:
exact H₁
/-- Main induction principle of ordinals: if one can prove a property by
  induction at successor ordinals and at limit ordinals, then it holds for all ordinals. -/
@[elab_as_elim]
def limitRecOn {C : Ordinal → Sort*} (o : Ordinal) (H₁ : C 0) (H₂ : ∀ o, C o → C (succ o))
    (H₃ : ∀ o, IsLimit o → (∀ o' < o, C o') → C o) : C o :=
  lt_wf.fix
    (fun o IH =>
      if o0 : o = 0 then by rw [o0]; exact H₁
      else
        if h : ∃ a, o = succ a then by
          

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{?u.99036} → Sort u_4
o✝ : Ordinal.{?u.99036}
H₁ : C 0
H₂ : (o : Ordinal.{?u.99036}) → C o → C (succ o)
H₃ : (o : Ordinal.{?u.99036}) → IsLimit o → ((o' : Ordinal.{?u.99036}) → o' < o → C o') → C o
o : Ordinal.{?u.99036}
IH : (y : Ordinal.{?u.99036}) → y < o → C y
o0 : ¬o = 0
h : ∃ a, o = succ a
⊢ C o

Next tactic:
rw [← succ_pred_iff_is_succ.2 h]
/-- Main induction principle of ordinals: if one can prove a property by
  induction at successor ordinals and at limit ordinals, then it holds for all ordinals. -/
@[elab_as_elim]
def limitRecOn {C : Ordinal → Sort*} (o : Ordinal) (H₁ : C 0) (H₂ : ∀ o, C o → C (succ o))
    (H₃ : ∀ o, IsLimit o → (∀ o' < o, C o') → C o) : C o :=
  lt_wf.fix
    (fun o IH =>
      if o0 : o = 0 then by rw [o0]; exact H₁
      else
        if h : ∃ a, o = succ a then by
          rw [← succ_pred_iff_is_succ.2 h]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{?u.99036} → Sort u_4
o✝ : Ordinal.{?u.99036}
H₁ : C 0
H₂ : (o : Ordinal.{?u.99036}) → C o → C (succ o)
H₃ : (o : Ordinal.{?u.99036}) → IsLimit o → ((o' : Ordinal.{?u.99036}) → o' < o → C o') → C o
o : Ordinal.{?u.99036}
IH : (y : Ordinal.{?u.99036}) → y < o → C y
o0 : ¬o = 0
h : ∃ a, o = succ a
⊢ C (succ (pred o))

Next tactic:
exact H₂ _ (IH _ <| pred_lt_iff_is_succ.2 h)
@[simp]
theorem limitRecOn_zero {C} (H₁ H₂ H₃) : @limitRecOn C 0 H₁ H₂ H₃ = H₁ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
⊢ limitRecOn 0 H₁ H₂ H₃ = H₁

Next tactic:
rw [limitRecOn, lt_wf.fix_eq, dif_pos rfl]
@[simp]
theorem limitRecOn_zero {C} (H₁ H₂ H₃) : @limitRecOn C 0 H₁ H₂ H₃ = H₁ := by
  rw [limitRecOn, lt_wf.fix_eq, dif_pos rfl]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
⊢ Eq.mpr (_ : C 0 = C 0) H₁ = H₁

Next tactic:
rfl
@[simp]
theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
    @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
⊢ limitRecOn (succ o) H₁ H₂ H₃ = H₂ o (limitRecOn o H₁ H₂ H₃)

Next tactic:
have h : ∃ a, succ o = succ a := ⟨_, rfl⟩
@[simp]
theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
    @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by
  have h : ∃ a, succ o = succ a := ⟨_, rfl⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
h : ∃ a, succ o = succ a
⊢ limitRecOn (succ o) H₁ H₂ H₃ = H₂ o (limitRecOn o H₁ H₂ H₃)

Next tactic:
rw [limitRecOn, lt_wf.fix_eq, dif_neg (succ_ne_zero o), dif_pos h]
@[simp]
theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
    @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by
  have h : ∃ a, succ o = succ a := ⟨_, rfl⟩
  rw [limitRecOn, lt_wf.fix_eq, dif_neg (succ_ne_zero o), dif_pos h]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
h : ∃ a, succ o = succ a
⊢ Eq.mpr (_ : C (succ o) = C (succ (pred (succ o))))
      (H₂ (pred (succ o))
        ((fun y x =>
            WellFounded.fix lt_wf
              (fun o IH =>
                if o0 : o = 0 then Eq.mpr (_ : C o = C 0) H₁
                else
                  if h : ∃ a, o = succ a then
                    Eq.mpr (_ : C o = C (succ (pred o))) (H₂ (pred o) (IH (pred o) (_ : pred o < o)))
                  else H₃ o (_ : o ≠ 0 ∧ ∀ a < o, succ a < o) IH)
              y)
          (pred (succ o)) (_ : pred (succ o) < succ o))) =
    H₂ o (limitRecOn o H₁ H₂ H₃)

Next tactic:
generalize limitRecOn.proof_2 (succ o) h = h₂
@[simp]
theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
    @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by
  have h : ∃ a, succ o = succ a := ⟨_, rfl⟩
  rw [limitRecOn, lt_wf.fix_eq, dif_neg (succ_ne_zero o), dif_pos h]
  generalize limitRecOn.proof_2 (succ o) h = h₂
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
h : ∃ a, succ o = succ a
h₂ : C (succ o) = C (succ (pred (succ o)))
⊢ Eq.mpr h₂
      (H₂ (pred (succ o))
        ((fun y x =>
            WellFounded.fix lt_wf
              (fun o IH =>
                if o0 : o = 0 then Eq.mpr (_ : C o = C 0) H₁
                else
                  if h : ∃ a, o = succ a then
                    Eq.mpr (_ : C o = C (succ (pred o))) (H₂ (pred o) (IH (pred o) (_ : pred o < o)))
                  else H₃ o (_ : o ≠ 0 ∧ ∀ a < o, succ a < o) IH)
              y)
          (pred (succ o)) (_ : pred (succ o) < succ o))) =
    H₂ o (limitRecOn o H₁ H₂ H₃)

Next tactic:
generalize limitRecOn.proof_3 (succ o) h = h₃
@[simp]
theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
    @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by
  have h : ∃ a, succ o = succ a := ⟨_, rfl⟩
  rw [limitRecOn, lt_wf.fix_eq, dif_neg (succ_ne_zero o), dif_pos h]
  generalize limitRecOn.proof_2 (succ o) h = h₂
  generalize limitRecOn.proof_3 (succ o) h = h₃
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
h : ∃ a, succ o = succ a
h₂ : C (succ o) = C (succ (pred (succ o)))
h₃ : pred (succ o) < succ o
⊢ Eq.mpr h₂
      (H₂ (pred (succ o))
        ((fun y x =>
            WellFounded.fix lt_wf
              (fun o IH =>
                if o0 : o = 0 then Eq.mpr (_ : C o = C 0) H₁
                else
                  if h : ∃ a, o = succ a then
                    Eq.mpr (_ : C o = C (succ (pred o))) (H₂ (pred o) (IH (pred o) (_ : pred o < o)))
                  else H₃ o (_ : o ≠ 0 ∧ ∀ a < o, succ a < o) IH)
              y)
          (pred (succ o)) h₃)) =
    H₂ o (limitRecOn o H₁ H₂ H₃)

Next tactic:
revert h₂ h₃
@[simp]
theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
    @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by
  have h : ∃ a, succ o = succ a := ⟨_, rfl⟩
  rw [limitRecOn, lt_wf.fix_eq, dif_neg (succ_ne_zero o), dif_pos h]
  generalize limitRecOn.proof_2 (succ o) h = h₂
  generalize limitRecOn.proof_3 (succ o) h = h₃
  revert h₂ h₃; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
h : ∃ a, succ o = succ a
⊢ ∀ (h₂ : C (succ o) = C (succ (pred (succ o)))) (h₃ : pred (succ o) < succ o),
    Eq.mpr h₂
        (H₂ (pred (succ o))
          ((fun y x =>
              WellFounded.fix lt_wf
                (fun o IH =>
                  if o0 : o = 0 then Eq.mpr (_ : C o = C 0) H₁
                  else
                    if h : ∃ a, o = succ a then
                      Eq.mpr (_ : C o = C (succ (pred o))) (H₂ (pred o) (IH (pred o) (_ : pred o < o)))
                    else H₃ o (_ : o ≠ 0 ∧ ∀ a < o, succ a < o) IH)
                y)
            (pred (succ o)) h₃)) =
      H₂ o (limitRecOn o H₁ H₂ H₃)

Next tactic:
generalize e : pred (succ o) = o'
@[simp]
theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
    @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by
  have h : ∃ a, succ o = succ a := ⟨_, rfl⟩
  rw [limitRecOn, lt_wf.fix_eq, dif_neg (succ_ne_zero o), dif_pos h]
  generalize limitRecOn.proof_2 (succ o) h = h₂
  generalize limitRecOn.proof_3 (succ o) h = h₃
  revert h₂ h₃; generalize e : pred (succ o) = o'; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
h : ∃ a, succ o = succ a
o' : Ordinal.{u_4}
e : pred (succ o) = o'
⊢ ∀ (h₂ : C (succ o) = C (succ o')) (h₃ : o' < succ o),
    Eq.mpr h₂
        (H₂ o'
          ((fun y x =>
              WellFounded.fix lt_wf
                (fun o IH =>
                  if o0 : o = 0 then Eq.mpr (_ : C o = C 0) H₁
                  else
                    if h : ∃ a, o = succ a then
                      Eq.mpr (_ : C o = C (succ (pred o))) (H₂ (pred o) (IH (pred o) (_ : pred o < o)))
                    else H₃ o (_ : o ≠ 0 ∧ ∀ a < o, succ a < o) IH)
                y)
            o' h₃)) =
      H₂ o (limitRecOn o H₁ H₂ H₃)

Next tactic:
intros
@[simp]
theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
    @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by
  have h : ∃ a, succ o = succ a := ⟨_, rfl⟩
  rw [limitRecOn, lt_wf.fix_eq, dif_neg (succ_ne_zero o), dif_pos h]
  generalize limitRecOn.proof_2 (succ o) h = h₂
  generalize limitRecOn.proof_3 (succ o) h = h₃
  revert h₂ h₃; generalize e : pred (succ o) = o'; intros
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
h : ∃ a, succ o = succ a
o' : Ordinal.{u_4}
e : pred (succ o) = o'
h₂✝ : C (succ o) = C (succ o')
h₃✝ : o' < succ o
⊢ Eq.mpr h₂✝
      (H₂ o'
        ((fun y x =>
            WellFounded.fix lt_wf
              (fun o IH =>
                if o0 : o = 0 then Eq.mpr (_ : C o = C 0) H₁
                else
                  if h : ∃ a, o = succ a then
                    Eq.mpr (_ : C o = C (succ (pred o))) (H₂ (pred o) (IH (pred o) (_ : pred o < o)))
                  else H₃ o (_ : o ≠ 0 ∧ ∀ a < o, succ a < o) IH)
              y)
          o' h₃✝)) =
    H₂ o (limitRecOn o H₁ H₂ H₃)

Next tactic:
rw [pred_succ] at e
@[simp]
theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
    @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by
  have h : ∃ a, succ o = succ a := ⟨_, rfl⟩
  rw [limitRecOn, lt_wf.fix_eq, dif_neg (succ_ne_zero o), dif_pos h]
  generalize limitRecOn.proof_2 (succ o) h = h₂
  generalize limitRecOn.proof_3 (succ o) h = h₃
  revert h₂ h₃; generalize e : pred (succ o) = o'; intros
  rw [pred_succ] at e; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
h : ∃ a, succ o = succ a
o' : Ordinal.{u_4}
e : o = o'
h₂✝ : C (succ o) = C (succ o')
h₃✝ : o' < succ o
⊢ Eq.mpr h₂✝
      (H₂ o'
        ((fun y x =>
            WellFounded.fix lt_wf
              (fun o IH =>
                if o0 : o = 0 then Eq.mpr (_ : C o = C 0) H₁
                else
                  if h : ∃ a, o = succ a then
                    Eq.mpr (_ : C o = C (succ (pred o))) (H₂ (pred o) (IH (pred o) (_ : pred o < o)))
                  else H₃ o (_ : o ≠ 0 ∧ ∀ a < o, succ a < o) IH)
              y)
          o' h₃✝)) =
    H₂ o (limitRecOn o H₁ H₂ H₃)

Next tactic:
subst o'
@[simp]
theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
    @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by
  have h : ∃ a, succ o = succ a := ⟨_, rfl⟩
  rw [limitRecOn, lt_wf.fix_eq, dif_neg (succ_ne_zero o), dif_pos h]
  generalize limitRecOn.proof_2 (succ o) h = h₂
  generalize limitRecOn.proof_3 (succ o) h = h₃
  revert h₂ h₃; generalize e : pred (succ o) = o'; intros
  rw [pred_succ] at e; subst o'; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
h : ∃ a, succ o = succ a
h₂✝ : C (succ o) = C (succ o)
h₃✝ : o < succ o
⊢ Eq.mpr h₂✝
      (H₂ o
        ((fun y x =>
            WellFounded.fix lt_wf
              (fun o IH =>
                if o0 : o = 0 then Eq.mpr (_ : C o = C 0) H₁
                else
                  if h : ∃ a, o = succ a then
                    Eq.mpr (_ : C o = C (succ (pred o))) (H₂ (pred o) (IH (pred o) (_ : pred o < o)))
                  else H₃ o (_ : o ≠ 0 ∧ ∀ a < o, succ a < o) IH)
              y)
          o h₃✝)) =
    H₂ o (limitRecOn o H₁ H₂ H₃)

Next tactic:
rfl
@[simp]
theorem limitRecOn_limit {C} (o H₁ H₂ H₃ h) :
    @limitRecOn C o H₁ H₂ H₃ = H₃ o h fun x _h => @limitRecOn C x H₁ H₂ H₃ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
h : IsLimit o
⊢ limitRecOn o H₁ H₂ H₃ = H₃ o h fun x _h => limitRecOn x H₁ H₂ H₃

Next tactic:
rw [limitRecOn, lt_wf.fix_eq, dif_neg h.1, dif_neg (not_succ_of_isLimit h)]
@[simp]
theorem limitRecOn_limit {C} (o H₁ H₂ H₃ h) :
    @limitRecOn C o H₁ H₂ H₃ = H₃ o h fun x _h => @limitRecOn C x H₁ H₂ H₃ := by
  rw [limitRecOn, lt_wf.fix_eq, dif_neg h.1, dif_neg (not_succ_of_isLimit h)]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
C : Ordinal.{u_4} → Sort u_5
o : Ordinal.{u_4}
H₁ : C 0
H₂ : (o : Ordinal.{u_4}) → C o → C (succ o)
H₃ : (o : Ordinal.{u_4}) → IsLimit o → ((o' : Ordinal.{u_4}) → o' < o → C o') → C o
h : IsLimit o
⊢ (H₃ o (_ : o ≠ 0 ∧ ∀ a < o, succ a < o) fun y x =>
      WellFounded.fix lt_wf
        (fun o IH =>
          if o0 : o = 0 then Eq.mpr (_ : C o = C 0) H₁
          else
            if h : ∃ a, o = succ a then
              Eq.mpr (_ : C o = C (succ (pred o))) (H₂ (pred o) (IH (pred o) (_ : pred o < o)))
            else H₃ o (_ : o ≠ 0 ∧ ∀ a < o, succ a < o) IH)
        y) =
    H₃ o h fun x _h => limitRecOn x H₁ H₂ H₃

Next tactic:
rfl
theorem enum_succ_eq_top {o : Ordinal} :
    enum (· < ·) o
        (by
          

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{?u.103508}
⊢ o < type fun x x_1 => x < x_1

Next tactic:
rw [type_lt]
theorem enum_succ_eq_top {o : Ordinal} :
    enum (· < ·) o
        (by
          rw [type_lt]
          

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{?u.103508}
⊢ o < succ o

Next tactic:
exact lt_succ o
theorem has_succ_of_type_succ_lt {α} {r : α → α → Prop} [wo : IsWellOrder α r]
    (h : ∀ a < type r, succ a < type r) (x : α) : ∃ y, r x y := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
t : γ → γ → Prop
α : Type u_4
r : α → α → Prop
wo : IsWellOrder α r
h : ∀ a < type r, succ a < type r
x : α
⊢ ∃ y, r x y

Next tactic:
use enum r (succ (typein r x)) (h _ (typein_lt_type r x))
theorem has_succ_of_type_succ_lt {α} {r : α → α → Prop} [wo : IsWellOrder α r]
    (h : ∀ a < type r, succ a < type r) (x : α) : ∃ y, r x y := by
  use enum r (succ (typein r x)) (h _ (typein_lt_type r x))
  

Proof state:
case h
α✝ : Type u_1
β : Type u_2
γ : Type u_3
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
t : γ → γ → Prop
α : Type u_4
r : α → α → Prop
wo : IsWellOrder α r
h : ∀ a < type r, succ a < type r
x : α
⊢ r x (enum r (succ (typein r x)) (_ : succ (typein r x) < type r))

Next tactic:
convert (enum_lt_enum (typein_lt_type r x)
    (h _ (typein_lt_type r x))).mpr (lt_succ _)
theorem has_succ_of_type_succ_lt {α} {r : α → α → Prop} [wo : IsWellOrder α r]
    (h : ∀ a < type r, succ a < type r) (x : α) : ∃ y, r x y := by
  use enum r (succ (typein r x)) (h _ (typein_lt_type r x))
  convert (enum_lt_enum (typein_lt_type r x)
    (h _ (typein_lt_type r x))).mpr (lt_succ _); 

Proof state:
case h.e'_1
α✝ : Type u_1
β : Type u_2
γ : Type u_3
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
t : γ → γ → Prop
α : Type u_4
r : α → α → Prop
wo : IsWellOrder α r
h : ∀ a < type r, succ a < type r
x : α
⊢ x = enum r (typein r x) (_ : typein r x < type r)

Next tactic:
rw [enum_typein]
theorem out_no_max_of_succ_lt {o : Ordinal} (ho : ∀ a < o, succ a < o) : NoMaxOrder o.out.α :=
  ⟨has_succ_of_type_succ_lt (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_4}
ho : ∀ a < o, succ a < o
⊢ ∀ a < type fun a b => a < b, succ a < type fun a b => a < b

Next tactic:
rwa [type_lt]
theorem bounded_singleton {r : α → α → Prop} [IsWellOrder α r] (hr : (type r).IsLimit) (x) :
    Bounded r {x} := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
hr : IsLimit (type r)
x : α
⊢ Bounded r {x}

Next tactic:
refine' ⟨enum r (succ (typein r x)) (hr.2 _ (typein_lt_type r x)), _⟩
theorem bounded_singleton {r : α → α → Prop} [IsWellOrder α r] (hr : (type r).IsLimit) (x) :
    Bounded r {x} := by
  refine' ⟨enum r (succ (typein r x)) (hr.2 _ (typein_lt_type r x)), _⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
hr : IsLimit (type r)
x : α
⊢ ∀ b ∈ {x}, r b (enum r (succ (typein r x)) (_ : succ (typein r x) < type r))

Next tactic:
intro b hb
theorem bounded_singleton {r : α → α → Prop} [IsWellOrder α r] (hr : (type r).IsLimit) (x) :
    Bounded r {x} := by
  refine' ⟨enum r (succ (typein r x)) (hr.2 _ (typein_lt_type r x)), _⟩
  intro b hb
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
hr : IsLimit (type r)
x b : α
hb : b ∈ {x}
⊢ r b (enum r (succ (typein r x)) (_ : succ (typein r x) < type r))

Next tactic:
rw [mem_singleton_iff.1 hb]
theorem bounded_singleton {r : α → α → Prop} [IsWellOrder α r] (hr : (type r).IsLimit) (x) :
    Bounded r {x} := by
  refine' ⟨enum r (succ (typein r x)) (hr.2 _ (typein_lt_type r x)), _⟩
  intro b hb
  rw [mem_singleton_iff.1 hb]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
hr : IsLimit (type r)
x b : α
hb : b ∈ {x}
⊢ r x (enum r (succ (typein r x)) (_ : succ (typein r x) < type r))

Next tactic:
nth_rw 1 [← enum_typein r x]
theorem bounded_singleton {r : α → α → Prop} [IsWellOrder α r] (hr : (type r).IsLimit) (x) :
    Bounded r {x} := by
  refine' ⟨enum r (succ (typein r x)) (hr.2 _ (typein_lt_type r x)), _⟩
  intro b hb
  rw [mem_singleton_iff.1 hb]
  nth_rw 1 [← enum_typein r x]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
hr : IsLimit (type r)
x b : α
hb : b ∈ {x}
⊢ r (enum r (typein r x) (_ : typein r x < type r)) (enum r (succ (typein r x)) (_ : succ (typein r x) < type r))

Next tactic:
rw [@enum_lt_enum _ r]
theorem bounded_singleton {r : α → α → Prop} [IsWellOrder α r] (hr : (type r).IsLimit) (x) :
    Bounded r {x} := by
  refine' ⟨enum r (succ (typein r x)) (hr.2 _ (typein_lt_type r x)), _⟩
  intro b hb
  rw [mem_singleton_iff.1 hb]
  nth_rw 1 [← enum_typein r x]
  rw [@enum_lt_enum _ r]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
hr : IsLimit (type r)
x b : α
hb : b ∈ {x}
⊢ typein r x < succ (typein r x)

Next tactic:
apply lt_succ
theorem type_subrel_lt (o : Ordinal.{u}) :
    type (Subrel ((· < ·) : Ordinal → Ordinal → Prop) { o' : Ordinal | o' < o })
      = Ordinal.lift.{u + 1} o := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u}
⊢ type (Subrel (fun x x_1 => x < x_1) {o' | o' < o}) = lift.{u + 1, u} o

Next tactic:
refine' Quotient.inductionOn o _
theorem type_subrel_lt (o : Ordinal.{u}) :
    type (Subrel ((· < ·) : Ordinal → Ordinal → Prop) { o' : Ordinal | o' < o })
      = Ordinal.lift.{u + 1} o := by
  refine' Quotient.inductionOn o _
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u}
⊢ ∀ (a : WellOrder), type (Subrel (fun x x_1 => x < x_1) {o' | o' < ⟦a⟧}) = lift.{u + 1, u} ⟦a⟧

Next tactic:
rintro ⟨α, r, wo⟩
theorem type_subrel_lt (o : Ordinal.{u}) :
    type (Subrel ((· < ·) : Ordinal → Ordinal → Prop) { o' : Ordinal | o' < o })
      = Ordinal.lift.{u + 1} o := by
  refine' Quotient.inductionOn o _
  rintro ⟨α, r, wo⟩; 

Proof state:
case mk
α✝ : Type u_1
β : Type u_2
γ : Type u_3
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
wo : IsWellOrder α r
⊢ type (Subrel (fun x x_1 => x < x_1) {o' | o' < ⟦{ α := α, r := r, wo := wo }⟧}) =
    lift.{u + 1, u} ⟦{ α := α, r := r, wo := wo }⟧

Next tactic:
skip