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_1
r : α → α → Prop
o : Ordinal.{u}
⊢ o.cof = sInf {a | ∃ ι f, lsub f = o ∧ #ι = a}
state_after: case refine_1
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
⊢ ∀ b ∈ {a | ∃ ι f, lsub f = o ∧ #ι = a}, o.cof ≤ b

case refine_2
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
⊢ o.cof ∈ {a | ∃ ι f, lsub f = o ∧ #ι = a}

tactic: rintro a ⟨ι, f, hf, rfl⟩
state_before: case refine_1
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
⊢ ∀ b ∈ {a | ∃ ι f, lsub f = o ∧ #ι = a}, o.cof ≤ b
state_after: case refine_1.intro.intro.intro
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
⊢ o.cof ≤ #ι

tactic: rw [← type_lt o]
state_before: case refine_1.intro.intro.intro
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
⊢ o.cof ≤ #ι
state_after: case refine_1.intro.intro.intro
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
⊢ (type fun x x_1 => x < x_1).cof ≤ #ι

tactic: have := typein_lt_self a
state_before: case refine_1.intro.intro.intro
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
a : (Quotient.out o).α
⊢ ∃ b ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f, ¬b < a
state_after: case refine_1.intro.intro.intro
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
a : (Quotient.out o).α
this : typein (fun x x_1 => x < x_1) a < o
⊢ ∃ 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_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
a : (Quotient.out o).α
this : typein (fun x x_1 => x < x_1) a < o
⊢ ∃ b ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f, ¬b < a
state_after: case refine_1.intro.intro.intro
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
a : (Quotient.out o).α
this : ∃ i, typein (fun x x_1 => x < x_1) a ≤ f i
⊢ ∃ 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_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
a : (Quotient.out o).α
this : ∃ i, typein (fun x x_1 => x < x_1) a ≤ f i
⊢ ∃ b ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f, ¬b < a
state_after: case refine_1.intro.intro.intro.intro
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
a : (Quotient.out o).α
i : ι
hi : typein (fun x x_1 => x < x_1) a ≤ f i
⊢ ∃ b ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f, ¬b < a

tactic: let H := congr_arg f hst
state_before: α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
s t : ↑((typein fun x x_1 => x < x_1) ⁻¹' range f)
hst : (fun s => Classical.choose ⋯) s = (fun s => Classical.choose ⋯) t
⊢ s = t
state_after: α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
s t : ↑((typein fun x x_1 => x < x_1) ⁻¹' range f)
hst : (fun s => Classical.choose ⋯) s = (fun s => Classical.choose ⋯) t
H : f ((fun s => Classical.choose ⋯) s) = f ((fun s => Classical.choose ⋯) t) := congr_arg f hst
⊢ 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_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = o
s t : ↑((typein fun x x_1 => x < x_1) ⁻¹' range f)
hst : (fun s => Classical.choose ⋯) s = (fun s => Classical.choose ⋯) t
H : f ((fun s => Classical.choose ⋯) s) = f ((fun s => Classical.choose ⋯) t) := congr_arg f hst
⊢ s = t
state_after: no goals

tactic: rw [type_lt, ← hf]
state_before: case refine_1.intro.intro.intro.intro.refine_1
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
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
state_after: case refine_1.intro.intro.intro.intro.refine_1
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
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: apply lt_lsub
state_before: case refine_1.intro.intro.intro.intro.refine_1
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
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
state_after: no goals

tactic: rw [mem_preimage, typein_enum]
state_before: case refine_1.intro.intro.intro.intro.refine_2
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
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) ⋯ ∈ (typein fun x x_1 => x < x_1) ⁻¹' range f
state_after: case refine_1.intro.intro.intro.intro.refine_2
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
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: exact mem_range_self i
state_before: case refine_1.intro.intro.intro.intro.refine_2
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
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
state_after: no goals

tactic: rwa [← typein_le_typein, typein_enum]
state_before: case refine_1.intro.intro.intro.intro.refine_3
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
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) ⋯ < a
state_after: no goals

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

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

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

tactic: rw [← typein_le_typein, typein_enum] at hb'
state_before: case refine_2.intro.intro.intro.intro
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
S : Set (Quotient.out o).α
hS : Unbounded (fun x x_1 => x < x_1) S
hS' : #↑S = (type fun x x_1 => x < x_1).cof
f : ↑S → Ordinal.{u} := fun s => typein LT.lt ↑s
a : Ordinal.{u}
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
state_after: case refine_2.intro.intro.intro.intro
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
S : Set (Quotient.out o).α
hS : Unbounded (fun x x_1 => x < x_1) S
hS' : #↑S = (type fun x x_1 => x < x_1).cof
f : ↑S → Ordinal.{u} := fun s => typein LT.lt ↑s
a : Ordinal.{u}
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: exact hb'.trans_lt (lt_lsub.{u, u} f ⟨b, hb⟩)
state_before: case refine_2.intro.intro.intro.intro
α : Type u_1
r : α → α → Prop
o : Ordinal.{u}
S : Set (Quotient.out o).α
hS : Unbounded (fun x x_1 => x < x_1) S
hS' : #↑S = (type fun x x_1 => x < x_1).cof
f : ↑S → Ordinal.{u} := fun s => typein LT.lt ↑s
a : Ordinal.{u}
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
state_after: no goals

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