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

tactic: refine' le_antisymm (le_csInf (cof_lsub_def_nonempty o) _) (csInf_le' _)
state_before: α : Type ?u.13677
r : α → α → Prop
o : Ordinal
⊢ cof o = sInf {a | ∃ ι f, lsub f = o ∧ (#ι) = a}

tactic: rintro a ⟨ι, f, hf, rfl⟩
state_before: case refine'_1
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
⊢ ∀ (b : Cardinal), b ∈ {a | ∃ ι f, lsub f = o ∧ (#ι) = a} → cof o ≤ b

tactic: rw [← type_lt o]
state_before: case refine'_1.intro.intro.intro
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
ι : Type u
f : ι → Ordinal
hf : lsub f = o
⊢ cof o ≤ (#ι)

tactic: have := typein_lt_self a
state_before: case refine'_1.intro.intro.intro
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
ι : Type u
f : ι → Ordinal
hf : lsub f = o
a : (Quotient.out o).α
⊢ ∃ b, b ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f ∧ ¬b < a

tactic: simp_rw [← hf, lt_lsub_iff] at this
state_before: case refine'_1.intro.intro.intro
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
ι : Type u
f : ι → Ordinal
hf : lsub f = o
a : (Quotient.out o).α
this : typein (fun x x_1 => x < x_1) a < o
⊢ ∃ b, b ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f ∧ ¬b < a

tactic: cases' this with i hi
state_before: case refine'_1.intro.intro.intro
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
ι : Type u
f : ι → Ordinal
hf : lsub f = o
a : (Quotient.out o).α
this : ∃ i, typein (fun x x_1 => x < x_1) a ≤ f i
⊢ ∃ b, b ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f ∧ ¬b < a

tactic: let H := congr_arg f hst
state_before: α : Type ?u.13677
r : α → α → Prop
o : Ordinal
ι : Type u
f : ι → Ordinal
hf : lsub f = o
s t : ↑((typein fun x x_1 => x < x_1) ⁻¹' range f)
hst :
  (fun s => choose (_ : ↑s ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f)) s =
    (fun s => choose (_ : ↑s ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f)) t
⊢ s = t

tactic: rwa [Classical.choose_spec s.prop, Classical.choose_spec t.prop, typein_inj,
  Subtype.coe_inj] at H
state_before: α : Type ?u.13677
r : α → α → Prop
o : Ordinal
ι : Type u
f : ι → Ordinal
hf : lsub f = o
s t : ↑((typein fun x x_1 => x < x_1) ⁻¹' range f)
hst :
  (fun s => choose (_ : ↑s ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f)) s =
    (fun s => choose (_ : ↑s ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f)) t
H : f ((fun s => choose (_ : ↑s ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f)) s) =
  f ((fun s => choose (_ : ↑s ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f)) t) :=
  congr_arg f hst
⊢ s = t

tactic: rw [type_lt, ← hf]
state_before: case refine'_1.intro.intro.intro.intro.refine'_1
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
ι : Type u
f : ι → Ordinal
hf : lsub f = o
a : (Quotient.out o).α
i : ι
hi : typein (fun x x_1 => x < x_1) a ≤ f i
⊢ f i < type fun x x_1 => x < x_1

tactic: apply lt_lsub
state_before: case refine'_1.intro.intro.intro.intro.refine'_1
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
ι : Type u
f : ι → Ordinal
hf : lsub f = o
a : (Quotient.out o).α
i : ι
hi : typein (fun x x_1 => x < x_1) a ≤ f i
⊢ f i < lsub f

tactic: rw [mem_preimage, typein_enum]
state_before: case refine'_1.intro.intro.intro.intro.refine'_2
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
ι : Type u
f : ι → Ordinal
hf : lsub f = o
a : (Quotient.out o).α
i : ι
hi : typein (fun x x_1 => x < x_1) a ≤ f i
⊢ enum (fun x x_1 => x < x_1) (f i) (_ : f i < type fun x x_1 => x < x_1) ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f

tactic: exact mem_range_self i
state_before: case refine'_1.intro.intro.intro.intro.refine'_2
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
ι : Type u
f : ι → Ordinal
hf : lsub f = o
a : (Quotient.out o).α
i : ι
hi : typein (fun x x_1 => x < x_1) a ≤ f i
⊢ f i ∈ range f

tactic: rwa [← typein_le_typein, typein_enum]
state_before: case refine'_1.intro.intro.intro.intro.refine'_3
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
ι : Type u
f : ι → Ordinal
hf : lsub f = o
a : (Quotient.out o).α
i : ι
hi : typein (fun x x_1 => x < x_1) a ≤ f i
⊢ ¬enum (fun x x_1 => x < x_1) (f i) (_ : f i < type fun x x_1 => x < x_1) < a

tactic: let f : S → Ordinal := fun s => typein LT.lt s.val
state_before: case refine'_2.intro.intro
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
S : Set (Quotient.out o).α
hS : Unbounded (fun x x_1 => x < x_1) S
hS' : (#↑S) = cof (type fun x x_1 => x < x_1)
⊢ cof o ∈ {a | ∃ ι f, lsub f = o ∧ (#ι) = a}

tactic: refine'
  ⟨S, f, le_antisymm (lsub_le fun i => typein_lt_self i) (le_of_forall_lt fun a ha => _), by
    rwa [type_lt o] at hS'⟩
state_before: case refine'_2.intro.intro
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
S : Set (Quotient.out o).α
hS : Unbounded (fun x x_1 => x < x_1) S
hS' : (#↑S) = cof (type fun x x_1 => x < x_1)
f : ↑S → Ordinal := fun s => typein LT.lt ↑s
⊢ cof o ∈ {a | ∃ ι f, lsub f = o ∧ (#ι) = a}

tactic: rw [← type_lt o] at ha
state_before: case refine'_2.intro.intro
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
S : Set (Quotient.out o).α
hS : Unbounded (fun x x_1 => x < x_1) S
hS' : (#↑S) = cof (type fun x x_1 => x < x_1)
f : ↑S → Ordinal := fun s => typein LT.lt ↑s
a : Ordinal
ha : a < o
⊢ a < lsub f

tactic: rw [← typein_le_typein, typein_enum] at hb'
state_before: case refine'_2.intro.intro.intro.intro
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
S : Set (Quotient.out o).α
hS : Unbounded (fun x x_1 => x < x_1) S
hS' : (#↑S) = cof (type fun x x_1 => x < x_1)
f : ↑S → Ordinal := fun s => typein LT.lt ↑s
a : Ordinal
ha : a < type fun x x_1 => x < x_1
b : (Quotient.out o).α
hb : b ∈ S
hb' : ¬(fun x x_1 => x < x_1) b (enum (fun x x_1 => x < x_1) a ha)
⊢ a < lsub f

tactic: exact hb'.trans_lt (lt_lsub.{u, u} f ⟨b, hb⟩)
state_before: case refine'_2.intro.intro.intro.intro
α : Type ?u.13677
r : α → α → Prop
o : Ordinal
S : Set (Quotient.out o).α
hS : Unbounded (fun x x_1 => x < x_1) S
hS' : (#↑S) = cof (type fun x x_1 => x < x_1)
f : ↑S → Ordinal := fun s => typein LT.lt ↑s
a : Ordinal
ha : a < type fun x x_1 => x < x_1
b : (Quotient.out o).α
hb : b ∈ S
hb' : a ≤ typein LT.lt b
⊢ a < lsub f

tactic: rwa [type_lt o] at hS'
state_before: α : Type ?u.13677
r : α → α → Prop
o : Ordinal
S : Set (Quotient.out o).α
hS : Unbounded (fun x x_1 => x < x_1) S
hS' : (#↑S) = cof (type fun x x_1 => x < x_1)
f : ↑S → Ordinal := fun s => typein LT.lt ↑s
⊢ (#↑S) = cof o