l3lab/ntp-mathlib huggingface dataset:
private theorem succ_le_iff' {a b : Ordinal} : a + 1 ≤ b ↔ a < b :=
  ⟨lt_of_lt_of_le
      (inductionOn a fun α r _ =>
        ⟨⟨⟨⟨fun x => Sum.inl x, fun _ _ => Sum.inl.inj⟩, Sum.lex_inl_inl⟩,
            Sum.inr PUnit.unit, fun b =>
            Sum.recOn b (fun x => ⟨fun _ => ⟨x, rfl⟩, fun _ => Sum.Lex.sep _ _⟩) fun x =>
              Sum.lex_inr_inr.trans ⟨False.elim, fun ⟨x, H⟩ => Sum.inl_ne_inr H⟩⟩⟩),
    inductionOn a fun α r hr =>
      inductionOn b fun β s hs ⟨⟨f, t, hf⟩⟩ => by
        haveI := hs
        refine' ⟨⟨RelEmbedding.ofMonotone (Sum.rec f fun _ => t) (fun a b ↦ _), fun a b ↦ _⟩⟩
        · rcases a with (a | _) <;> rcases b with (b | _)
          · simpa only [Sum.lex_inl_inl] using f.map_rel_iff.2
          · intro
            rw [hf]
            exact ⟨_, rfl⟩
          · exact False.elim ∘ Sum.lex_inr_inl
          · exact False.elim ∘ Sum.lex_inr_inr.1
        · 

Proof state:
case refine'_2
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t✝ : γ → γ → Prop
a✝ b✝ : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
hr : IsWellOrder α r
β : Type u_3
s : β → β → Prop
hs : IsWellOrder β s
x✝ : type r < type s
f : r ↪r s
t : β
hf : ∀ (b : β), s b t ↔ ∃ a, f a = b
this : IsWellOrder β s
a : α ⊕ PUnit.{u_3 + 1}
b : β
⊢ s b
      ((RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
          (_ :
            ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
              Sum.Lex r EmptyRelation a b →
                s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
        a) →
    ∃ a',
      (RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
            (_ :
              ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
                Sum.Lex r EmptyRelation a b →
                  s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
          a' =
        b

Next tactic:
rcases a with (a | _)
private theorem succ_le_iff' {a b : Ordinal} : a + 1 ≤ b ↔ a < b :=
  ⟨lt_of_lt_of_le
      (inductionOn a fun α r _ =>
        ⟨⟨⟨⟨fun x => Sum.inl x, fun _ _ => Sum.inl.inj⟩, Sum.lex_inl_inl⟩,
            Sum.inr PUnit.unit, fun b =>
            Sum.recOn b (fun x => ⟨fun _ => ⟨x, rfl⟩, fun _ => Sum.Lex.sep _ _⟩) fun x =>
              Sum.lex_inr_inr.trans ⟨False.elim, fun ⟨x, H⟩ => Sum.inl_ne_inr H⟩⟩⟩),
    inductionOn a fun α r hr =>
      inductionOn b fun β s hs ⟨⟨f, t, hf⟩⟩ => by
        haveI := hs
        refine' ⟨⟨RelEmbedding.ofMonotone (Sum.rec f fun _ => t) (fun a b ↦ _), fun a b ↦ _⟩⟩
        · rcases a with (a | _) <;> rcases b with (b | _)
          · simpa only [Sum.lex_inl_inl] using f.map_rel_iff.2
          · intro
            rw [hf]
            exact ⟨_, rfl⟩
          · exact False.elim ∘ Sum.lex_inr_inl
          · exact False.elim ∘ Sum.lex_inr_inr.1
        · rcases a with (a | _)
          · 

Proof state:
case refine'_2.inl
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t✝ : γ → γ → Prop
a✝ b✝ : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
hr : IsWellOrder α r
β : Type u_3
s : β → β → Prop
hs : IsWellOrder β s
x✝ : type r < type s
f : r ↪r s
t : β
hf : ∀ (b : β), s b t ↔ ∃ a, f a = b
this : IsWellOrder β s
b : β
a : α
⊢ s b
      ((RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
          (_ :
            ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
              Sum.Lex r EmptyRelation a b →
                s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
        (Sum.inl a)) →
    ∃ a',
      (RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
            (_ :
              ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
                Sum.Lex r EmptyRelation a b →
                  s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
          a' =
        b

Next tactic:
intro h
private theorem succ_le_iff' {a b : Ordinal} : a + 1 ≤ b ↔ a < b :=
  ⟨lt_of_lt_of_le
      (inductionOn a fun α r _ =>
        ⟨⟨⟨⟨fun x => Sum.inl x, fun _ _ => Sum.inl.inj⟩, Sum.lex_inl_inl⟩,
            Sum.inr PUnit.unit, fun b =>
            Sum.recOn b (fun x => ⟨fun _ => ⟨x, rfl⟩, fun _ => Sum.Lex.sep _ _⟩) fun x =>
              Sum.lex_inr_inr.trans ⟨False.elim, fun ⟨x, H⟩ => Sum.inl_ne_inr H⟩⟩⟩),
    inductionOn a fun α r hr =>
      inductionOn b fun β s hs ⟨⟨f, t, hf⟩⟩ => by
        haveI := hs
        refine' ⟨⟨RelEmbedding.ofMonotone (Sum.rec f fun _ => t) (fun a b ↦ _), fun a b ↦ _⟩⟩
        · rcases a with (a | _) <;> rcases b with (b | _)
          · simpa only [Sum.lex_inl_inl] using f.map_rel_iff.2
          · intro
            rw [hf]
            exact ⟨_, rfl⟩
          · exact False.elim ∘ Sum.lex_inr_inl
          · exact False.elim ∘ Sum.lex_inr_inr.1
        · rcases a with (a | _)
          · intro h
            

Proof state:
case refine'_2.inl
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t✝ : γ → γ → Prop
a✝ b✝ : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
hr : IsWellOrder α r
β : Type u_3
s : β → β → Prop
hs : IsWellOrder β s
x✝ : type r < type s
f : r ↪r s
t : β
hf : ∀ (b : β), s b t ↔ ∃ a, f a = b
this : IsWellOrder β s
b : β
a : α
h :
  s b
    ((RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
        (_ :
          ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
            Sum.Lex r EmptyRelation a b →
              s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
      (Sum.inl a))
⊢ ∃ a',
    (RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
          (_ :
            ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
              Sum.Lex r EmptyRelation a b →
                s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
        a' =
      b

Next tactic:
have := @PrincipalSeg.init _ _ _ _ _ ⟨f, t, hf⟩ _ _ h
private theorem succ_le_iff' {a b : Ordinal} : a + 1 ≤ b ↔ a < b :=
  ⟨lt_of_lt_of_le
      (inductionOn a fun α r _ =>
        ⟨⟨⟨⟨fun x => Sum.inl x, fun _ _ => Sum.inl.inj⟩, Sum.lex_inl_inl⟩,
            Sum.inr PUnit.unit, fun b =>
            Sum.recOn b (fun x => ⟨fun _ => ⟨x, rfl⟩, fun _ => Sum.Lex.sep _ _⟩) fun x =>
              Sum.lex_inr_inr.trans ⟨False.elim, fun ⟨x, H⟩ => Sum.inl_ne_inr H⟩⟩⟩),
    inductionOn a fun α r hr =>
      inductionOn b fun β s hs ⟨⟨f, t, hf⟩⟩ => by
        haveI := hs
        refine' ⟨⟨RelEmbedding.ofMonotone (Sum.rec f fun _ => t) (fun a b ↦ _), fun a b ↦ _⟩⟩
        · rcases a with (a | _) <;> rcases b with (b | _)
          · simpa only [Sum.lex_inl_inl] using f.map_rel_iff.2
          · intro
            rw [hf]
            exact ⟨_, rfl⟩
          · exact False.elim ∘ Sum.lex_inr_inl
          · exact False.elim ∘ Sum.lex_inr_inr.1
        · rcases a with (a | _)
          · intro h
            have := @PrincipalSeg.init _ _ _ _ _ ⟨f, t, hf⟩ _ _ h
            

Proof state:
case refine'_2.inl
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t✝ : γ → γ → Prop
a✝ b✝ : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
hr : IsWellOrder α r
β : Type u_3
s : β → β → Prop
hs : IsWellOrder β s
x✝ : type r < type s
f : r ↪r s
t : β
hf : ∀ (b : β), s b t ↔ ∃ a, f a = b
this✝ : IsWellOrder β s
b : β
a : α
h :
  s b
    ((RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
        (_ :
          ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
            Sum.Lex r EmptyRelation a b →
              s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
      (Sum.inl a))
this : ∃ a', { toRelEmbedding := f, top := t, down' := hf }.toRelEmbedding a' = b
⊢ ∃ a',
    (RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
          (_ :
            ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
              Sum.Lex r EmptyRelation a b →
                s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
        a' =
      b

Next tactic:
cases' this with w h
private theorem succ_le_iff' {a b : Ordinal} : a + 1 ≤ b ↔ a < b :=
  ⟨lt_of_lt_of_le
      (inductionOn a fun α r _ =>
        ⟨⟨⟨⟨fun x => Sum.inl x, fun _ _ => Sum.inl.inj⟩, Sum.lex_inl_inl⟩,
            Sum.inr PUnit.unit, fun b =>
            Sum.recOn b (fun x => ⟨fun _ => ⟨x, rfl⟩, fun _ => Sum.Lex.sep _ _⟩) fun x =>
              Sum.lex_inr_inr.trans ⟨False.elim, fun ⟨x, H⟩ => Sum.inl_ne_inr H⟩⟩⟩),
    inductionOn a fun α r hr =>
      inductionOn b fun β s hs ⟨⟨f, t, hf⟩⟩ => by
        haveI := hs
        refine' ⟨⟨RelEmbedding.ofMonotone (Sum.rec f fun _ => t) (fun a b ↦ _), fun a b ↦ _⟩⟩
        · rcases a with (a | _) <;> rcases b with (b | _)
          · simpa only [Sum.lex_inl_inl] using f.map_rel_iff.2
          · intro
            rw [hf]
            exact ⟨_, rfl⟩
          · exact False.elim ∘ Sum.lex_inr_inl
          · exact False.elim ∘ Sum.lex_inr_inr.1
        · rcases a with (a | _)
          · intro h
            have := @PrincipalSeg.init _ _ _ _ _ ⟨f, t, hf⟩ _ _ h
            cases' this with w h
            

Proof state:
case refine'_2.inl.intro
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t✝ : γ → γ → Prop
a✝ b✝ : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
hr : IsWellOrder α r
β : Type u_3
s : β → β → Prop
hs : IsWellOrder β s
x✝ : type r < type s
f : r ↪r s
t : β
hf : ∀ (b : β), s b t ↔ ∃ a, f a = b
this : IsWellOrder β s
b : β
a : α
h✝ :
  s b
    ((RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
        (_ :
          ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
            Sum.Lex r EmptyRelation a b →
              s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
      (Sum.inl a))
w : α
h : { toRelEmbedding := f, top := t, down' := hf }.toRelEmbedding w = b
⊢ ∃ a',
    (RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
          (_ :
            ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
              Sum.Lex r EmptyRelation a b →
                s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
        a' =
      b

Next tactic:
exact ⟨Sum.inl w, h⟩
private theorem succ_le_iff' {a b : Ordinal} : a + 1 ≤ b ↔ a < b :=
  ⟨lt_of_lt_of_le
      (inductionOn a fun α r _ =>
        ⟨⟨⟨⟨fun x => Sum.inl x, fun _ _ => Sum.inl.inj⟩, Sum.lex_inl_inl⟩,
            Sum.inr PUnit.unit, fun b =>
            Sum.recOn b (fun x => ⟨fun _ => ⟨x, rfl⟩, fun _ => Sum.Lex.sep _ _⟩) fun x =>
              Sum.lex_inr_inr.trans ⟨False.elim, fun ⟨x, H⟩ => Sum.inl_ne_inr H⟩⟩⟩),
    inductionOn a fun α r hr =>
      inductionOn b fun β s hs ⟨⟨f, t, hf⟩⟩ => by
        haveI := hs
        refine' ⟨⟨RelEmbedding.ofMonotone (Sum.rec f fun _ => t) (fun a b ↦ _), fun a b ↦ _⟩⟩
        · rcases a with (a | _) <;> rcases b with (b | _)
          · simpa only [Sum.lex_inl_inl] using f.map_rel_iff.2
          · intro
            rw [hf]
            exact ⟨_, rfl⟩
          · exact False.elim ∘ Sum.lex_inr_inl
          · exact False.elim ∘ Sum.lex_inr_inr.1
        · rcases a with (a | _)
          · intro h
            have := @PrincipalSeg.init _ _ _ _ _ ⟨f, t, hf⟩ _ _ h
            cases' this with w h
            exact ⟨Sum.inl w, h⟩
          · 

Proof state:
case refine'_2.inr
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t✝ : γ → γ → Prop
a b✝ : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
hr : IsWellOrder α r
β : Type u_3
s : β → β → Prop
hs : IsWellOrder β s
x✝ : type r < type s
f : r ↪r s
t : β
hf : ∀ (b : β), s b t ↔ ∃ a, f a = b
this : IsWellOrder β s
b : β
val✝ : PUnit.{u_3 + 1}
⊢ s b
      ((RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
          (_ :
            ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
              Sum.Lex r EmptyRelation a b →
                s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
        (Sum.inr val✝)) →
    ∃ a',
      (RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
            (_ :
              ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
                Sum.Lex r EmptyRelation a b →
                  s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
          a' =
        b

Next tactic:
intro h
private theorem succ_le_iff' {a b : Ordinal} : a + 1 ≤ b ↔ a < b :=
  ⟨lt_of_lt_of_le
      (inductionOn a fun α r _ =>
        ⟨⟨⟨⟨fun x => Sum.inl x, fun _ _ => Sum.inl.inj⟩, Sum.lex_inl_inl⟩,
            Sum.inr PUnit.unit, fun b =>
            Sum.recOn b (fun x => ⟨fun _ => ⟨x, rfl⟩, fun _ => Sum.Lex.sep _ _⟩) fun x =>
              Sum.lex_inr_inr.trans ⟨False.elim, fun ⟨x, H⟩ => Sum.inl_ne_inr H⟩⟩⟩),
    inductionOn a fun α r hr =>
      inductionOn b fun β s hs ⟨⟨f, t, hf⟩⟩ => by
        haveI := hs
        refine' ⟨⟨RelEmbedding.ofMonotone (Sum.rec f fun _ => t) (fun a b ↦ _), fun a b ↦ _⟩⟩
        · rcases a with (a | _) <;> rcases b with (b | _)
          · simpa only [Sum.lex_inl_inl] using f.map_rel_iff.2
          · intro
            rw [hf]
            exact ⟨_, rfl⟩
          · exact False.elim ∘ Sum.lex_inr_inl
          · exact False.elim ∘ Sum.lex_inr_inr.1
        · rcases a with (a | _)
          · intro h
            have := @PrincipalSeg.init _ _ _ _ _ ⟨f, t, hf⟩ _ _ h
            cases' this with w h
            exact ⟨Sum.inl w, h⟩
          · intro h
            

Proof state:
case refine'_2.inr
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t✝ : γ → γ → Prop
a b✝ : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
hr : IsWellOrder α r
β : Type u_3
s : β → β → Prop
hs : IsWellOrder β s
x✝ : type r < type s
f : r ↪r s
t : β
hf : ∀ (b : β), s b t ↔ ∃ a, f a = b
this : IsWellOrder β s
b : β
val✝ : PUnit.{u_3 + 1}
h :
  s b
    ((RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
        (_ :
          ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
            Sum.Lex r EmptyRelation a b →
              s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
      (Sum.inr val✝))
⊢ ∃ a',
    (RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
          (_ :
            ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
              Sum.Lex r EmptyRelation a b →
                s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
        a' =
      b

Next tactic:
cases' (hf b).1 h with w h
private theorem succ_le_iff' {a b : Ordinal} : a + 1 ≤ b ↔ a < b :=
  ⟨lt_of_lt_of_le
      (inductionOn a fun α r _ =>
        ⟨⟨⟨⟨fun x => Sum.inl x, fun _ _ => Sum.inl.inj⟩, Sum.lex_inl_inl⟩,
            Sum.inr PUnit.unit, fun b =>
            Sum.recOn b (fun x => ⟨fun _ => ⟨x, rfl⟩, fun _ => Sum.Lex.sep _ _⟩) fun x =>
              Sum.lex_inr_inr.trans ⟨False.elim, fun ⟨x, H⟩ => Sum.inl_ne_inr H⟩⟩⟩),
    inductionOn a fun α r hr =>
      inductionOn b fun β s hs ⟨⟨f, t, hf⟩⟩ => by
        haveI := hs
        refine' ⟨⟨RelEmbedding.ofMonotone (Sum.rec f fun _ => t) (fun a b ↦ _), fun a b ↦ _⟩⟩
        · rcases a with (a | _) <;> rcases b with (b | _)
          · simpa only [Sum.lex_inl_inl] using f.map_rel_iff.2
          · intro
            rw [hf]
            exact ⟨_, rfl⟩
          · exact False.elim ∘ Sum.lex_inr_inl
          · exact False.elim ∘ Sum.lex_inr_inr.1
        · rcases a with (a | _)
          · intro h
            have := @PrincipalSeg.init _ _ _ _ _ ⟨f, t, hf⟩ _ _ h
            cases' this with w h
            exact ⟨Sum.inl w, h⟩
          · intro h
            cases' (hf b).1 h with w h
            

Proof state:
case refine'_2.inr.intro
α✝ : Type u
β✝ : Type u_1
γ : Type u_2
r✝ : α✝ → α✝ → Prop
s✝ : β✝ → β✝ → Prop
t✝ : γ → γ → Prop
a b✝ : Ordinal.{u_3}
α : Type u_3
r : α → α → Prop
hr : IsWellOrder α r
β : Type u_3
s : β → β → Prop
hs : IsWellOrder β s
x✝ : type r < type s
f : r ↪r s
t : β
hf : ∀ (b : β), s b t ↔ ∃ a, f a = b
this : IsWellOrder β s
b : β
val✝ : PUnit.{u_3 + 1}
h✝ :
  s b
    ((RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
        (_ :
          ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
            Sum.Lex r EmptyRelation a b →
              s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
      (Sum.inr val✝))
w : α
h : f w = b
⊢ ∃ a',
    (RelEmbedding.ofMonotone (fun t_1 => Sum.rec (⇑f) (fun x => t) t_1)
          (_ :
            ∀ (a b : α ⊕ PUnit.{u_3 + 1}),
              Sum.Lex r EmptyRelation a b →
                s ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) a) ((fun t_1 => Sum.rec (⇑f) (fun x => t) t_1) b)))
        a' =
      b

Next tactic:
exact ⟨Sum.inl w, h⟩
@[simp]
theorem succ_one : succ (1 : Ordinal) = 2 := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
⊢ succ 1 = 2

Next tactic:
unfold instOfNat OfNat.ofNat
@[simp]
theorem succ_one : succ (1 : Ordinal) = 2 := by
  unfold instOfNat OfNat.ofNat
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
⊢ succ One.toOfNat1.1 = { ofNat := ↑2 }.1

Next tactic:
simpa using by rfl
@[simp]
theorem succ_one : succ (1 : Ordinal) = 2 := by
  unfold instOfNat OfNat.ofNat
  simpa using by 

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
⊢ One.toOfNat1.1 = 1

Next tactic:
rfl
theorem one_le_iff_pos {o : Ordinal} : 1 ≤ o ↔ 0 < o := by 

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_3}
⊢ 1 ≤ o ↔ 0 < o

Next tactic:
rw [← succ_zero, succ_le_iff]
theorem one_le_iff_ne_zero {o : Ordinal} : 1 ≤ o ↔ o ≠ 0 := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_3}
⊢ 1 ≤ o ↔ o ≠ 0

Next tactic:
rw [one_le_iff_pos, Ordinal.pos_iff_ne_zero]
theorem lt_one_iff_zero {a : Ordinal} : a < 1 ↔ a = 0 := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
a : Ordinal.{u_3}
⊢ a < 1 ↔ a = 0

Next tactic:
simpa using @lt_succ_bot_iff _ _ _ a _ _
theorem le_one_iff {a : Ordinal} : a ≤ 1 ↔ a = 0 ∨ a = 1 := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
a : Ordinal.{u_3}
⊢ a ≤ 1 ↔ a = 0 ∨ a = 1

Next tactic:
simpa using @le_succ_bot_iff _ _ _ a _
@[simp]
theorem card_succ (o : Ordinal) : card (succ o) = card o + 1 := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_3}
⊢ card (succ o) = card o + 1

Next tactic:
simp only [← add_one_eq_succ, card_add, card_one]
instance uniqueIioOne : Unique (Iio (1 : Ordinal))
    where
  default := ⟨0, by 

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
⊢ 0 ∈ Iio 1

Next tactic:
simp
instance uniqueOutOne : Unique (1 : Ordinal).out.α
    where
  default := enum (· < ·) 0 (by 

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
⊢ 0 < type fun x x_1 => x < x_1

Next tactic:
simp
instance uniqueOutOne : Unique (1 : Ordinal).out.α
    where
  default := enum (· < ·) 0 (by simp)
  uniq a := by
    

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
a : (Quotient.out 1).α
⊢ a = default

Next tactic:
unfold default
instance uniqueOutOne : Unique (1 : Ordinal).out.α
    where
  default := enum (· < ·) 0 (by simp)
  uniq a := by
    unfold default
    

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
a : (Quotient.out 1).α
⊢ a = { default := enum (fun x x_1 => x < x_1) 0 (_ : 0 < type fun x x_1 => x < x_1) }.1

Next tactic:
rw [← @enum_typein _ (· < ·) (isWellOrder_out_lt _) a]
instance uniqueOutOne : Unique (1 : Ordinal).out.α
    where
  default := enum (· < ·) 0 (by simp)
  uniq a := by
    unfold default
    rw [← @enum_typein _ (· < ·) (isWellOrder_out_lt _) a]
    

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
a : (Quotient.out 1).α
⊢ enum (fun x x_1 => x < x_1) (typein (fun x x_1 => x < x_1) a)
      (_ : typein (fun x x_1 => x < x_1) a < type fun x x_1 => x < x_1) =
    { default := enum (fun x x_1 => x < x_1) 0 (_ : 0 < type fun x x_1 => x < x_1) }.1

Next tactic:
congr
instance uniqueOutOne : Unique (1 : Ordinal).out.α
    where
  default := enum (· < ·) 0 (by simp)
  uniq a := by
    unfold default
    rw [← @enum_typein _ (· < ·) (isWellOrder_out_lt _) a]
    congr
    

Proof state:
case e_o
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
a : (Quotient.out 1).α
⊢ typein (fun x x_1 => x < x_1) a = 0

Next tactic:
rw [← lt_one_iff_zero]
instance uniqueOutOne : Unique (1 : Ordinal).out.α
    where
  default := enum (· < ·) 0 (by simp)
  uniq a := by
    unfold default
    rw [← @enum_typein _ (· < ·) (isWellOrder_out_lt _) a]
    congr
    rw [← lt_one_iff_zero]
    

Proof state:
case e_o
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
a : (Quotient.out 1).α
⊢ typein (fun x x_1 => x < x_1) a < 1

Next tactic:
apply typein_lt_self
theorem one_out_eq (x : (1 : Ordinal).out.α) : x = enum (· < ·) 0 (by 

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
x : (Quotient.out 1).α
⊢ 0 < type fun x x_1 => x < x_1

Next tactic:
simp
@[simp]
theorem typein_one_out (x : (1 : Ordinal).out.α) :
    @typein _ (· < ·) (isWellOrder_out_lt _) x = 0 := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
x : (Quotient.out 1).α
⊢ typein (fun x x_1 => x < x_1) x = 0

Next tactic:
rw [one_out_eq x, typein_enum]
@[simp]
theorem typein_le_typein (r : α → α → Prop) [IsWellOrder α r] {x x' : α} :
    typein r x ≤ typein r x' ↔ ¬r x' x := by 

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
x x' : α
⊢ typein r x ≤ typein r x' ↔ ¬r x' x

Next tactic:
rw [← not_lt, typein_lt_typein]
theorem typein_le_typein' (o : Ordinal) {x x' : o.out.α} :
    @typein _ (· < ·) (isWellOrder_out_lt _) x ≤ @typein _ (· < ·) (isWellOrder_out_lt _) x'
      ↔ x ≤ x' := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_3}
x x' : (Quotient.out o).α
⊢ typein (fun x x_1 => x < x_1) x ≤ typein (fun x x_1 => x < x_1) x' ↔ x ≤ x'

Next tactic:
rw [typein_le_typein]
theorem typein_le_typein' (o : Ordinal) {x x' : o.out.α} :
    @typein _ (· < ·) (isWellOrder_out_lt _) x ≤ @typein _ (· < ·) (isWellOrder_out_lt _) x'
      ↔ x ≤ x' := by
  rw [typein_le_typein]
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_3}
x x' : (Quotient.out o).α
⊢ ¬x' < x ↔ x ≤ x'

Next tactic:
exact not_lt
@[simp, nolint simpNF]
theorem enum_le_enum (r : α → α → Prop) [IsWellOrder α r] {o o' : Ordinal} (ho : o < type r)
    (ho' : o' < type r) : ¬r (enum r o' ho') (enum r o ho) ↔ o ≤ o' := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r✝ : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
r : α → α → Prop
inst✝ : IsWellOrder α r
o o' : Ordinal.{u}
ho : o < type r
ho' : o' < type r
⊢ ¬r (enum r o' ho') (enum r o ho) ↔ o ≤ o'

Next tactic:
rw [← @not_lt _ _ o' o, enum_lt_enum ho']
@[simp]
theorem enum_le_enum' (a : Ordinal) {o o' : Ordinal} (ho : o < type (· < ·))
    (ho' : o' < type (· < ·)) : enum (· < ·) o ho ≤ @enum a.out.α (· < ·) _ o' ho' ↔ o ≤ o' := by
  

Proof state:
α : Type u
β : Type u_1
γ : Type u_2
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
a o o' : Ordinal.{u_3}
ho : o < type fun x x_1 => x < x_1
ho' : o' < type fun x x_1 => x < x_1
⊢ enum (fun x x_1 => x < x_1) o ho ≤ enum (fun x x_1 => x < x_1) o' ho' ↔ o ≤ o'

Next tactic:
rw [← @enum_le_enum _ (· < ·) (isWellOrder_out_lt _), ← not_lt]