Theorem: Ordinal.cof_eq_one_iff_is_succ
File: Mathlib/SetTheory/Cardinal/Cofinality.lean

tactic: skip
state_before: α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
⊢ ∃ a, type r = succ a

tactic: rcases cof_eq r with ⟨S, hl, e⟩
state_before: α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
⊢ ∃ a, type r = succ a

tactic: rw [z] at e
state_before: case intro.intro
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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

tactic: cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
state_before: case intro.intro
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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

tactic: refine'
  ⟨typein r a,
    Eq.symm <|
      Quotient.sound
        ⟨RelIso.ofSurjective (RelEmbedding.ofMonotone _ fun x y => _) fun x => _⟩⟩
state_before: case intro.intro.intro
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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

tactic: rw [e]
state_before: α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : (#↑S) = 1
⊢ (#?m.47037) ≠ 0

tactic: exact one_ne_zero
state_before: α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : (#↑S) = 1
⊢ 1 ≠ 0

tactic: apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
state_before: case intro.intro.intro.refine'_1
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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 → α

tactic: rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> rcases y with (y | ⟨⟨⟨⟩⟩⟩) <;>
  simp [Subrel, Order.Preimage, EmptyRelation]
state_before: case intro.intro.intro.refine'_2
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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
⊢ 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)

tactic: exact x.2
state_before: case intro.intro.intro.refine'_2.inl.inr.unit
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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

tactic: suffices : r x a ∨ ∃ _ : PUnit.{u}, ↑a = x
state_before: case intro.intro.intro.refine'_3
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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),
                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

tactic: . convert this
  dsimp [RelEmbedding.ofMonotone]; simp
state_before: case intro.intro.intro.refine'_3
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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),
                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

case this
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : (#↑S) = 1
a : ↑S
x : α
⊢ r x ↑a ∨ ∃ x_1, ↑a = x

tactic: rcases trichotomous_of r x a with (h | h | h)
state_before: case this
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : (#↑S) = 1
a : ↑S
x : α
⊢ r x ↑a ∨ ∃ x_1, ↑a = x

tactic: convert this
state_before: case intro.intro.intro.refine'_3
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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),
                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

tactic: dsimp [RelEmbedding.ofMonotone]
state_before: case a
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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),
                  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

tactic: simp
state_before: case a
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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, Sum.rec Subtype.val (fun x => ↑a) a_1 = x) ↔ r x ↑a ∨ ∃ x_1, ↑a = x

tactic: exact Or.inl h
state_before: case this.inl
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : (#↑S) = 1
a : ↑S
x : α
h : r x ↑a
⊢ r x ↑a ∨ ∃ x_1, ↑a = x

tactic: exact Or.inr ⟨PUnit.unit, h.symm⟩
state_before: case this.inr.inl
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : (#↑S) = 1
a : ↑S
x : α
h : x = ↑a
⊢ r x ↑a ∨ ∃ x_1, ↑a = x

tactic: rcases hl x with ⟨a', aS, hn⟩
state_before: case this.inr.inr
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : (#↑S) = 1
a : ↑S
x : α
h : r (↑a) x
⊢ r x ↑a ∨ ∃ x_1, ↑a = x

tactic: rw [(_ : ↑a = a')] at h
state_before: case this.inr.inr.intro.intro
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : (#↑S) = 1
a : ↑S
x : α
h : r (↑a) x
a' : α
aS : a' ∈ S
hn : ¬r a' x
⊢ r x ↑a ∨ ∃ x_1, ↑a = x

tactic: refine' congr_arg Subtype.val (_ : a = ⟨a', aS⟩)
state_before: α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : (#↑S) = 1
a : ↑S
x : α
h : r (↑a) x
a' : α
aS : a' ∈ S
hn : ¬r a' x
⊢ ↑a = a'

tactic: haveI := le_one_iff_subsingleton.1 (le_of_eq e)
state_before: α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : (#↑S) = 1
a : ↑S
x : α
h : r (↑a) x
a' : α
aS : a' ∈ S
hn : ¬r a' x
⊢ a = { val := a', property := aS }

tactic: apply Subsingleton.elim
state_before: α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : Type u
r : α → α → Prop
x✝ : IsWellOrder α r
z : cof (type r) = 1
S : Set α
hl : Unbounded r S
e : (#↑S) = 1
a : ↑S
x : α
h : r (↑a) x
a' : α
aS : a' ∈ S
hn : ¬r a' x
this : Subsingleton ↑S
⊢ a = { val := a', property := aS }

tactic: exact absurd h hn
state_before: case this.inr.inr.intro.intro
α✝ : Type ?u.46575
r✝ : α✝ → α✝ → Prop
o : Ordinal
α : 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' : α
h : r a' x
aS : a' ∈ S
hn : ¬r a' x
⊢ r x ↑a ∨ ∃ x_1, ↑a = x

tactic: simp [e]
state_before: α : Type ?u.46575
r : α → α → Prop
o : Ordinal
x✝ : ∃ a, o = succ a
a : Ordinal
e : o = succ a
⊢ cof o = 1