l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem cof_eq_zero {o} : cof o = 0 ↔ o = 0 :=
  ⟨inductionOn o fun α r _ z =>
      let ⟨S, hl, e⟩ := cof_eq r
      type_eq_zero_iff_isEmpty.2 <|
        ⟨fun a =>
          let ⟨b, h, _⟩ := hl a
          (mk_eq_zero_iff.1 (e.trans z)).elim' ⟨_, h⟩⟩,
    fun e => by 

Proof state:
α : Type u_1
r : α → α → Prop
o : Ordinal.{u_2}
e : o = 0
⊢ cof o = 0

Next tactic:
simp [e]
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  

Proof state:
α : Type u_1
r : α → α → Prop
o : Ordinal.{u_2}
⊢ cof (succ o) = 1

Next tactic:
apply le_antisymm
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · 

Proof state:
case a
α : Type u_1
r : α → α → Prop
o : Ordinal.{u_2}
⊢ cof (succ o) ≤ 1

Next tactic:
refine' inductionOn o fun α r _ => _
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · refine' inductionOn o fun α r _ => _
    

Proof state:
case a
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u_2}
α : Type u_2
r : α → α → Prop
x✝ : IsWellOrder α r
⊢ cof (succ (type r)) ≤ 1

Next tactic:
change cof (type _) ≤ _
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · refine' inductionOn o fun α r _ => _
    change cof (type _) ≤ _
    

Proof state:
case a
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u_2}
α : Type u_2
r : α → α → Prop
x✝ : IsWellOrder α r
⊢ cof (type (Sum.Lex r EmptyRelation)) ≤ 1

Next tactic:
rw [← (_ : #_ = 1)]
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · refine' inductionOn o fun α r _ => _
    change cof (type _) ≤ _
    rw [← (_ : #_ = 1)]
    

Proof state:
case a
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u_2}
α : Type u_2
r : α → α → Prop
x✝ : IsWellOrder α r
⊢ cof (type (Sum.Lex r EmptyRelation)) ≤ #?m.41556
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u_2}
α : Type u_2
r : α → α → Prop
x✝ : IsWellOrder α r
⊢ Type u_2
α✝ : Type u_1 r✝ : α✝ → α✝ → Prop o : Ordinal.{u_2} α : Type u_2 r : α → α → Prop x✝ : IsWellOrder α r ⊢ #?m.41556 = 1

Next tactic:
apply cof_type_le
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · refine' inductionOn o fun α r _ => _
    change cof (type _) ≤ _
    rw [← (_ : #_ = 1)]
    apply cof_type_le
    · 

Proof state:
case a.h
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u_2}
α : Type u_2
r : α → α → Prop
x✝ : IsWellOrder α r
⊢ Unbounded (Sum.Lex r EmptyRelation) ?a.S✝

Next tactic:
refine' fun a => ⟨Sum.inr PUnit.unit, Set.mem_singleton _, _⟩
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · refine' inductionOn o fun α r _ => _
    change cof (type _) ≤ _
    rw [← (_ : #_ = 1)]
    apply cof_type_le
    · refine' fun a => ⟨Sum.inr PUnit.unit, Set.mem_singleton _, _⟩
      

Proof state:
case a.h
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u_2}
α : Type u_2
r : α → α → Prop
x✝ : IsWellOrder α r
a : α ⊕ PUnit.{u_2 + 1}
⊢ ¬Sum.Lex r EmptyRelation (Sum.inr PUnit.unit) a

Next tactic:
rcases a with (a | ⟨⟨⟨⟩⟩⟩)
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · refine' inductionOn o fun α r _ => _
    change cof (type _) ≤ _
    rw [← (_ : #_ = 1)]
    apply cof_type_le
    · refine' fun a => ⟨Sum.inr PUnit.unit, Set.mem_singleton _, _⟩
      rcases a with (a | ⟨⟨⟨⟩⟩⟩) <;> 

Proof state:
case a.h.inl
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u_2}
α : Type u_2
r : α → α → Prop
x✝ : IsWellOrder α r
a : α
⊢ ¬Sum.Lex r EmptyRelation (Sum.inr PUnit.unit) (Sum.inl a)

Next tactic:
simp [EmptyRelation]
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · refine' inductionOn o fun α r _ => _
    change cof (type _) ≤ _
    rw [← (_ : #_ = 1)]
    apply cof_type_le
    · refine' fun a => ⟨Sum.inr PUnit.unit, Set.mem_singleton _, _⟩
      rcases a with (a | ⟨⟨⟨⟩⟩⟩) <;> 

Proof state:
case a.h.inr.unit
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u_2}
α : Type u_2
r : α → α → Prop
x✝ : IsWellOrder α r
⊢ ¬Sum.Lex r EmptyRelation (Sum.inr PUnit.unit) (Sum.inr PUnit.unit)

Next tactic:
simp [EmptyRelation]
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · refine' inductionOn o fun α r _ => _
    change cof (type _) ≤ _
    rw [← (_ : #_ = 1)]
    apply cof_type_le
    · refine' fun a => ⟨Sum.inr PUnit.unit, Set.mem_singleton _, _⟩
      rcases a with (a | ⟨⟨⟨⟩⟩⟩) <;> simp [EmptyRelation]
    · 

Proof state:
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u_2}
α : Type u_2
r : α → α → Prop
x✝ : IsWellOrder α r
⊢ #↑{Sum.inr PUnit.unit} = 1

Next tactic:
rw [Cardinal.mk_fintype, Set.card_singleton]
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · refine' inductionOn o fun α r _ => _
    change cof (type _) ≤ _
    rw [← (_ : #_ = 1)]
    apply cof_type_le
    · refine' fun a => ⟨Sum.inr PUnit.unit, Set.mem_singleton _, _⟩
      rcases a with (a | ⟨⟨⟨⟩⟩⟩) <;> simp [EmptyRelation]
    · rw [Cardinal.mk_fintype, Set.card_singleton]
      

Proof state:
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u_2}
α : Type u_2
r : α → α → Prop
x✝ : IsWellOrder α r
⊢ ↑1 = 1

Next tactic:
simp
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · refine' inductionOn o fun α r _ => _
    change cof (type _) ≤ _
    rw [← (_ : #_ = 1)]
    apply cof_type_le
    · refine' fun a => ⟨Sum.inr PUnit.unit, Set.mem_singleton _, _⟩
      rcases a with (a | ⟨⟨⟨⟩⟩⟩) <;> simp [EmptyRelation]
    · rw [Cardinal.mk_fintype, Set.card_singleton]
      simp
  · 

Proof state:
case a
α : Type u_1
r : α → α → Prop
o : Ordinal.{u_2}
⊢ 1 ≤ cof (succ o)

Next tactic:
rw [← Cardinal.succ_zero, succ_le_iff]
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
  apply le_antisymm
  · refine' inductionOn o fun α r _ => _
    change cof (type _) ≤ _
    rw [← (_ : #_ = 1)]
    apply cof_type_le
    · refine' fun a => ⟨Sum.inr PUnit.unit, Set.mem_singleton _, _⟩
      rcases a with (a | ⟨⟨⟨⟩⟩⟩) <;> simp [EmptyRelation]
    · rw [Cardinal.mk_fintype, Set.card_singleton]
      simp
  · rw [← Cardinal.succ_zero, succ_le_iff]
    

Proof state:
case a
α : Type u_1
r : α → α → Prop
o : Ordinal.{u_2}
⊢ 0 < cof (succ o)

Next tactic:
simpa [lt_iff_le_and_ne, Cardinal.zero_le] using fun h =>
      succ_ne_zero o (cof_eq_zero.1 (Eq.symm h))
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      

Proof state:
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
⊢ ∃ a, type r = succ a

Next tactic:
skip
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      

Proof state:
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
⊢ ∃ a, type r = succ a

Next tactic:
rcases cof_eq r with ⟨S, hl, e⟩
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; 

Proof state:
case intro.intro
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = cof (type r)
⊢ ∃ a, type r = succ a

Next tactic:
rw [z] at e
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      

Proof state:
case intro.intro
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
⊢ ∃ a, type r = succ a

Next tactic:
cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by 

Proof state:
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
⊢ #?m.44174 ≠ 0

Next tactic:
rw [e]
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; 

Proof state:
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
⊢ 1 ≠ 0

Next tactic:
exact one_ne_zero
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      

Proof state:
case intro.intro.intro
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
⊢ ∃ a, type r = succ a

Next tactic:
refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · 

Proof state:
case intro.intro.intro.refine'_1
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
⊢ ↑{b | r b ↑a} ⊕ PUnit.{u + 1} → α

Next tactic:
apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · 

Proof state:
case intro.intro.intro.refine'_1
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
⊢ ↑{b | r b ↑a} ⊕ PUnit.{u + 1} → α

Next tactic:
apply Sum.rec
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [

Proof state:
case intro.intro.intro.refine'_1.inl
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
⊢ ↑{b | r b ↑a} → α

Next tactic:
exact Subtype.val
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; 

Proof state:
case intro.intro.intro.refine'_1.inr
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
⊢ PUnit.{u + 1} → α

Next tactic:
exact fun _ => a
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
      · 

Proof state:
case intro.intro.intro.refine'_2
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
x y : ↑{b | r b ↑a} ⊕ PUnit.{u + 1}
⊢ Sum.Lex (Subrel r {b | r b ↑a}) EmptyRelation x y →
    r (Sum.rec Subtype.val (fun x => ↑a) x) (Sum.rec Subtype.val (fun x => ↑a) y)

Next tactic:
rcases x with (x | ⟨⟨⟨⟩⟩⟩)
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
      · rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> 

Proof state:
case intro.intro.intro.refine'_2.inl
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
y : ↑{b | r b ↑a} ⊕ PUnit.{u + 1}
x : ↑{b | r b ↑a}
⊢ Sum.Lex (Subrel r {b | r b ↑a}) EmptyRelation (Sum.inl x) y →
    r (Sum.rec Subtype.val (fun x => ↑a) (Sum.inl x)) (Sum.rec Subtype.val (fun x => ↑a) y)

Next tactic:
rcases y with (y | ⟨⟨⟨⟩⟩⟩)
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
      · rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> 

Proof state:
case intro.intro.intro.refine'_2.inr.unit
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
y : ↑{b | r b ↑a} ⊕ PUnit.{u + 1}
⊢ Sum.Lex (Subrel r {b | r b ↑a}) EmptyRelation (Sum.inr PUnit.unit) y →
    r (Sum.rec Subtype.val (fun x => ↑a) (Sum.inr PUnit.unit)) (Sum.rec Subtype.val (fun x => ↑a) y)

Next tactic:
rcases y with (y | ⟨⟨⟨⟩⟩⟩)
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
      · rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> rcases y with (y | ⟨⟨⟨⟩⟩⟩) <;>
          

Proof state:
case intro.intro.intro.refine'_2.inl.inl
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
x y : ↑{b | r b ↑a}
⊢ Sum.Lex (Subrel r {b | r b ↑a}) EmptyRelation (Sum.inl x) (Sum.inl y) →
    r (Sum.rec Subtype.val (fun x => ↑a) (Sum.inl x)) (Sum.rec Subtype.val (fun x => ↑a) (Sum.inl y))

Next tactic:
simp [Subrel, Order.Preimage, EmptyRelation]
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
      · rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> rcases y with (y | ⟨⟨⟨⟩⟩⟩) <;>
          

Proof state:
case intro.intro.intro.refine'_2.inl.inr.unit
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
x : ↑{b | r b ↑a}
⊢ Sum.Lex (Subrel r {b | r b ↑a}) EmptyRelation (Sum.inl x) (Sum.inr PUnit.unit) →
    r (Sum.rec Subtype.val (fun x => ↑a) (Sum.inl x)) (Sum.rec Subtype.val (fun x => ↑a) (Sum.inr PUnit.unit))

Next tactic:
simp [Subrel, Order.Preimage, EmptyRelation]
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
      · rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> rcases y with (y | ⟨⟨⟨⟩⟩⟩) <;>
          

Proof state:
case intro.intro.intro.refine'_2.inr.unit.inl
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
y : ↑{b | r b ↑a}
⊢ Sum.Lex (Subrel r {b | r b ↑a}) EmptyRelation (Sum.inr PUnit.unit) (Sum.inl y) →
    r (Sum.rec Subtype.val (fun x => ↑a) (Sum.inr PUnit.unit)) (Sum.rec Subtype.val (fun x => ↑a) (Sum.inl y))

Next tactic:
simp [Subrel, Order.Preimage, EmptyRelation]
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
      · rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> rcases y with (y | ⟨⟨⟨⟩⟩⟩) <;>
          

Proof state:
case intro.intro.intro.refine'_2.inr.unit.inr.unit
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
⊢ Sum.Lex (Subrel r {b | r b ↑a}) EmptyRelation (Sum.inr PUnit.unit) (Sum.inr PUnit.unit) →
    r (Sum.rec Subtype.val (fun x => ↑a) (Sum.inr PUnit.unit)) (Sum.rec Subtype.val (fun x => ↑a) (Sum.inr PUnit.unit))

Next tactic:
simp [Subrel, Order.Preimage, EmptyRelation]
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
      · rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> rcases y with (y | ⟨⟨⟨⟩⟩⟩) <;>
          simp [Subrel, Order.Preimage, EmptyRelation]
        

Proof state:
case intro.intro.intro.refine'_2.inl.inr.unit
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
x : ↑{b | r b ↑a}
⊢ r ↑x ↑a

Next tactic:
exact x.2
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
      · rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> rcases y with (y | ⟨⟨⟨⟩⟩⟩) <;>
          simp [Subrel, Order.Preimage, EmptyRelation]
        exact x.2
      · 

Proof state:
case intro.intro.intro.refine'_3
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
x : α
⊢ ∃ a_1,
    (RelEmbedding.ofMonotone (Sum.rec Subtype.val fun x => ↑a)
          (_ :
            ∀ (x y : ↑{b | r b ↑a} ⊕ PUnit.{u + 1}),
              Sum.Lex (Subrel r {b | r b ↑a}) EmptyRelation x y →
                r (Sum.rec Subtype.val (fun x => ↑a) x) (Sum.rec Subtype.val (fun x => ↑a) y)))
        a_1 =
      x

Next tactic:
suffices : r x a ∨ ∃ _ : PUnit.{u}, ↑a = x
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
      · rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> rcases y with (y | ⟨⟨⟨⟩⟩⟩) <;>
          simp [Subrel, Order.Preimage, EmptyRelation]
        exact x.2
      · suffices : r x a ∨ ∃ _ : PUnit.{u}, ↑a = x
        · 

Proof state:
case intro.intro.intro.refine'_3
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
x : α
this : r x ↑a ∨ ∃ x_1, ↑a = x
⊢ ∃ a_1,
    (RelEmbedding.ofMonotone (Sum.rec Subtype.val fun x => ↑a)
          (_ :
            ∀ (x y : ↑{b | r b ↑a} ⊕ PUnit.{u + 1}),
              Sum.Lex (Subrel r {b | r b ↑a}) EmptyRelation x y →
                r (Sum.rec Subtype.val (fun x => ↑a) x) (Sum.rec Subtype.val (fun x => ↑a) y)))
        a_1 =
      x

Next tactic:
convert this
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
  ⟨inductionOn o fun α r _ z => by
      skip
      rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
      cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
      refine'
        ⟨typein r a,
          Eq.symm <|
            Quotient.sound
              ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
      · apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
      · rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> rcases y with (y | ⟨⟨⟨⟩⟩⟩) <;>
          simp [Subrel, Order.Preimage, EmptyRelation]
        exact x.2
      · suffices : r x a ∨ ∃ _ : PUnit.{u}, ↑a = x
        · convert this
          

Proof state:
case a
α✝ : Type u_1
r✝ : α✝ → α✝ → Prop
o : Ordinal.{u}
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : #↑S = 1
a : ↑S
x : α
this : r x ↑a ∨ ∃ x_1, ↑a = x
⊢ (∃ a_1,
      (RelEmbedding.ofMonotone (Sum.rec Subtype.val fun x => ↑a)
            (_ :
              ∀ (x y : ↑{b | r b ↑a} ⊕ PUnit.{u + 1}),
                Sum.Lex (Subrel r {b | r b ↑a}) EmptyRelation x y →
                  r (Sum.rec Subtype.val (fun x => ↑a) x) (Sum.rec Subtype.val (fun x => ↑a) y)))
          a_1 =
        x) ↔
    r x ↑a ∨ ∃ x_1, ↑a = x

Next tactic:
dsimp [RelEmbedding.ofMonotone]