l3lab/ntp-mathlib huggingface dataset:
theorem trans {a o o' : Ordinal.{u}} {f : ∀ b < o, Ordinal.{u}} (hf : IsFundamentalSequence a o f)
    {g : ∀ b < o', Ordinal.{u}} (hg : IsFundamentalSequence o o' g) :
    IsFundamentalSequence a o' fun i hi =>
      f (g i hi) (by rw [← hg.2.2]; apply lt_blsub) := by
  refine' ⟨_, @fun i j _ _ h => hf.2.1 _ _ (hg.2.1 _ _ h), _⟩
  · rw [hf.cof_eq]
    exact hg.1.trans (ord_cof_le o)
  · rw [@blsub_comp.{u, u, u} o _ f (@IsFundamentalSequence.monotone _ _ f hf)]
    

Proof state:
case refine'_2
α : Type u_1
r : α → α → Prop
a✝ o✝ : Ordinal.{u}
f✝ : (b : Ordinal.{u}) → b < o✝ → Ordinal.{u}
a o o' : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{u}
hf : IsFundamentalSequence a o f
g : (b : Ordinal.{u}) → b < o' → Ordinal.{u}
hg : IsFundamentalSequence o o' g
⊢ blsub o f = a
case refine'_2.hg
α : Type u_1
r : α → α → Prop
a✝ o✝ : Ordinal.{u}
f✝ : (b : Ordinal.{u}) → b < o✝ → Ordinal.{u}
a o o' : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{u}
hf : IsFundamentalSequence a o f
g : (b : Ordinal.{u}) → b < o' → Ordinal.{u}
hg : IsFundamentalSequence o o' g
⊢ (blsub o' fun i hi => g i hi) = o

Next tactic:
exact hf.2.2
theorem trans {a o o' : Ordinal.{u}} {f : ∀ b < o, Ordinal.{u}} (hf : IsFundamentalSequence a o f)
    {g : ∀ b < o', Ordinal.{u}} (hg : IsFundamentalSequence o o' g) :
    IsFundamentalSequence a o' fun i hi =>
      f (g i hi) (by rw [← hg.2.2]; apply lt_blsub) := by
  refine' ⟨_, @fun i j _ _ h => hf.2.1 _ _ (hg.2.1 _ _ h), _⟩
  · rw [hf.cof_eq]
    exact hg.1.trans (ord_cof_le o)
  · rw [@blsub_comp.{u, u, u} o _ f (@IsFundamentalSequence.monotone _ _ f hf)]
    exact hf.2.2
    

Proof state:
case refine'_2.hg
α : Type u_1
r : α → α → Prop
a✝ o✝ : Ordinal.{u}
f✝ : (b : Ordinal.{u}) → b < o✝ → Ordinal.{u}
a o o' : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{u}
hf : IsFundamentalSequence a o f
g : (b : Ordinal.{u}) → b < o' → Ordinal.{u}
hg : IsFundamentalSequence o o' g
⊢ (blsub o' fun i hi => g i hi) = o

Next tactic:
exact hg.2.2
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  

Proof state:
α : Type u_1
r : α → α → Prop
a : Ordinal.{u}
⊢ ∃ f, IsFundamentalSequence a (ord (cof a)) f

Next tactic:
suffices h : ∃ o f, IsFundamentalSequence a o f
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · 

Proof state:
α : Type u_1
r : α → α → Prop
a : Ordinal.{u}
h : ∃ o f, IsFundamentalSequence a o f
⊢ ∃ f, IsFundamentalSequence a (ord (cof a)) f

Next tactic:
rcases h with ⟨o, f, hf⟩
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    

Proof state:
case intro.intro
α : Type u_1
r : α → α → Prop
a o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{u}
hf : IsFundamentalSequence a o f
⊢ ∃ f, IsFundamentalSequence a (ord (cof a)) f

Next tactic:
exact ⟨_, hf.ord_cof⟩
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  

Proof state:
case h
α : Type u_1
r : α → α → Prop
a : Ordinal.{u}
⊢ ∃ o f, IsFundamentalSequence a o f

Next tactic:
rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  

Proof state:
case h.intro.intro.intro
α : Type u_1
r : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
⊢ ∃ o f, IsFundamentalSequence a o f

Next tactic:
rcases ord_eq ι with ⟨r, wo, hr⟩
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  

Proof state:
case h.intro.intro.intro.intro.intro
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
⊢ ∃ o f, IsFundamentalSequence a o f

Next tactic:
haveI := wo
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  

Proof state:
case h.intro.intro.intro.intro.intro
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this : IsWellOrder ι r
⊢ ∃ o f, IsFundamentalSequence a o f

Next tactic:
let r' := Subrel r { i | ∀ j, r j i → f j < f i }
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  

Proof state:
case h.intro.intro.intro.intro.intro
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
⊢ ∃ o f, IsFundamentalSequence a o f

Next tactic:
let hrr' : r' ↪r r := Subrel.relEmbedding _ _
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  

Proof state:
case h.intro.intro.intro.intro.intro
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
⊢ ∃ o f, IsFundamentalSequence a o f

Next tactic:
haveI := hrr'.isWellOrder
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  haveI := hrr'.isWellOrder
  

Proof state:
case h.intro.intro.intro.intro.intro
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this✝ : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
this : IsWellOrder (↑{i | ∀ (j : ι), r j i → f j < f i}) r'
⊢ ∃ o f, IsFundamentalSequence a o f

Next tactic:
refine'
    ⟨_, _, hrr'.ordinal_type_le.trans _, @fun i j _ h _ => (enum r' j h).prop _ _,
      le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) _⟩
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  haveI := hrr'.isWellOrder
  refine'
    ⟨_, _, hrr'.ordinal_type_le.trans _, @fun i j _ h _ => (enum r' j h).prop _ _,
      le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) _⟩
  · 

Proof state:
case h.intro.intro.intro.intro.intro.refine'_1
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this✝ : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
this : IsWellOrder (↑{i | ∀ (j : ι), r j i → f j < f i}) r'
⊢ type r ≤ ord (cof a)

Next tactic:
rw [← hι, hr]
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  haveI := hrr'.isWellOrder
  refine'
    ⟨_, _, hrr'.ordinal_type_le.trans _, @fun i j _ h _ => (enum r' j h).prop _ _,
      le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) _⟩
  · rw [← hι, hr]
  · 

Proof state:
case h.intro.intro.intro.intro.intro.refine'_2
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this✝ : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
this : IsWellOrder (↑{i | ∀ (j : ι), r j i → f j < f i}) r'
i j : Ordinal.{u}
x✝¹ : i < type r'
h : j < type r'
x✝ : i < j
⊢ r ↑(enum r' i x✝¹) ↑(enum r' j h)

Next tactic:
change r (hrr'.1 _) (hrr'.1 _)
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  haveI := hrr'.isWellOrder
  refine'
    ⟨_, _, hrr'.ordinal_type_le.trans _, @fun i j _ h _ => (enum r' j h).prop _ _,
      le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) _⟩
  · rw [← hι, hr]
  · change r (hrr'.1 _) (hrr'.1 _)
    

Proof state:
case h.intro.intro.intro.intro.intro.refine'_2
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this✝ : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
this : IsWellOrder (↑{i | ∀ (j : ι), r j i → f j < f i}) r'
i j : Ordinal.{u}
x✝¹ : i < type r'
h : j < type r'
x✝ : i < j
⊢ r (hrr'.toEmbedding (enum r' i x✝¹)) (hrr'.toEmbedding (enum r' j h))

Next tactic:
rwa [hrr'.2, @enum_lt_enum _ r']
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  haveI := hrr'.isWellOrder
  refine'
    ⟨_, _, hrr'.ordinal_type_le.trans _, @fun i j _ h _ => (enum r' j h).prop _ _,
      le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) _⟩
  · rw [← hι, hr]
  · change r (hrr'.1 _) (hrr'.1 _)
    rwa [hrr'.2, @enum_lt_enum _ r']
  · 

Proof state:
case h.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this✝ : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
this : IsWellOrder (↑{i | ∀ (j : ι), r j i → f j < f i}) r'
⊢ a ≤ blsub (type r') fun j h => f ↑(enum r' j h)

Next tactic:
rw [← hf, lsub_le_iff]
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  haveI := hrr'.isWellOrder
  refine'
    ⟨_, _, hrr'.ordinal_type_le.trans _, @fun i j _ h _ => (enum r' j h).prop _ _,
      le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) _⟩
  · rw [← hι, hr]
  · change r (hrr'.1 _) (hrr'.1 _)
    rwa [hrr'.2, @enum_lt_enum _ r']
  · rw [← hf, lsub_le_iff]
    

Proof state:
case h.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this✝ : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
this : IsWellOrder (↑{i | ∀ (j : ι), r j i → f j < f i}) r'
⊢ ∀ (i : ι), f i < blsub (type r') fun j h => f ↑(enum r' j h)

Next tactic:
intro i
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  haveI := hrr'.isWellOrder
  refine'
    ⟨_, _, hrr'.ordinal_type_le.trans _, @fun i j _ h _ => (enum r' j h).prop _ _,
      le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) _⟩
  · rw [← hι, hr]
  · change r (hrr'.1 _) (hrr'.1 _)
    rwa [hrr'.2, @enum_lt_enum _ r']
  · rw [← hf, lsub_le_iff]
    intro i
    

Proof state:
case h.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this✝ : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
this : IsWellOrder (↑{i | ∀ (j : ι), r j i → f j < f i}) r'
i : ι
⊢ f i < blsub (type r') fun j h => f ↑(enum r' j h)

Next tactic:
suffices h : ∃ i' hi', f i ≤ bfamilyOfFamily' r' (fun i => f i) i' hi'
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  haveI := hrr'.isWellOrder
  refine'
    ⟨_, _, hrr'.ordinal_type_le.trans _, @fun i j _ h _ => (enum r' j h).prop _ _,
      le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) _⟩
  · rw [← hι, hr]
  · change r (hrr'.1 _) (hrr'.1 _)
    rwa [hrr'.2, @enum_lt_enum _ r']
  · rw [← hf, lsub_le_iff]
    intro i
    suffices h : ∃ i' hi', f i ≤ bfamilyOfFamily' r' (fun i => f i) i' hi'
    · 

Proof state:
case h.intro.intro.intro.intro.intro.refine'_3
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this✝ : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
this : IsWellOrder (↑{i | ∀ (j : ι), r j i → f j < f i}) r'
i : ι
h : ∃ i', ∃ (hi' : i' < type r'), f i ≤ bfamilyOfFamily' r' (fun i => f ↑i) i' hi'
⊢ f i < blsub (type r') fun j h => f ↑(enum r' j h)

Next tactic:
rcases h with ⟨i', hi', hfg⟩
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  haveI := hrr'.isWellOrder
  refine'
    ⟨_, _, hrr'.ordinal_type_le.trans _, @fun i j _ h _ => (enum r' j h).prop _ _,
      le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) _⟩
  · rw [← hι, hr]
  · change r (hrr'.1 _) (hrr'.1 _)
    rwa [hrr'.2, @enum_lt_enum _ r']
  · rw [← hf, lsub_le_iff]
    intro i
    suffices h : ∃ i' hi', f i ≤ bfamilyOfFamily' r' (fun i => f i) i' hi'
    · rcases h with ⟨i', hi', hfg⟩
      

Proof state:
case h.intro.intro.intro.intro.intro.refine'_3.intro.intro
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this✝ : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
this : IsWellOrder (↑{i | ∀ (j : ι), r j i → f j < f i}) r'
i : ι
i' : Ordinal.{u}
hi' : i' < type r'
hfg : f i ≤ bfamilyOfFamily' r' (fun i => f ↑i) i' hi'
⊢ f i < blsub (type r') fun j h => f ↑(enum r' j h)

Next tactic:
exact hfg.trans_lt (lt_blsub _ _ _)
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  haveI := hrr'.isWellOrder
  refine'
    ⟨_, _, hrr'.ordinal_type_le.trans _, @fun i j _ h _ => (enum r' j h).prop _ _,
      le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) _⟩
  · rw [← hι, hr]
  · change r (hrr'.1 _) (hrr'.1 _)
    rwa [hrr'.2, @enum_lt_enum _ r']
  · rw [← hf, lsub_le_iff]
    intro i
    suffices h : ∃ i' hi', f i ≤ bfamilyOfFamily' r' (fun i => f i) i' hi'
    · rcases h with ⟨i', hi', hfg⟩
      exact hfg.trans_lt (lt_blsub _ _ _)
    

Proof state:
case h
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this✝ : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
this : IsWellOrder (↑{i | ∀ (j : ι), r j i → f j < f i}) r'
i : ι
⊢ ∃ i', ∃ (hi' : i' < type r'), f i ≤ bfamilyOfFamily' r' (fun i => f ↑i) i' hi'

Next tactic:
by_cases h : ∀ j, r j i → f j < f i
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
    ∃ f, IsFundamentalSequence a a.cof.ord f := by
  suffices h : ∃ o f, IsFundamentalSequence a o f
  · rcases h with ⟨o, f, hf⟩
    exact ⟨_, hf.ord_cof⟩
  rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
  rcases ord_eq ι with ⟨r, wo, hr⟩
  haveI := wo
  let r' := Subrel r { i | ∀ j, r j i → f j < f i }
  let hrr' : r' ↪r r := Subrel.relEmbedding _ _
  haveI := hrr'.isWellOrder
  refine'
    ⟨_, _, hrr'.ordinal_type_le.trans _, @fun i j _ h _ => (enum r' j h).prop _ _,
      le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) _⟩
  · rw [← hι, hr]
  · change r (hrr'.1 _) (hrr'.1 _)
    rwa [hrr'.2, @enum_lt_enum _ r']
  · rw [← hf, lsub_le_iff]
    intro i
    suffices h : ∃ i' hi', f i ≤ bfamilyOfFamily' r' (fun i => f i) i' hi'
    · rcases h with ⟨i', hi', hfg⟩
      exact hfg.trans_lt (lt_blsub _ _ _)
    by_cases h : ∀ j, r j i → f j < f i
    · 

Proof state:
case pos
α : Type u_1
r✝ : α → α → Prop
a : Ordinal.{u}
ι : Type u
f : ι → Ordinal.{u}
hf : lsub f = a
hι : #ι = cof a
r : ι → ι → Prop
wo : IsWellOrder ι r
hr : ord #ι = type r
this✝ : IsWellOrder ι r
r' : ↑{i | ∀ (j : ι), r j i → f j < f i} → ↑{i | ∀ (j : ι), r j i → f j < f i} → Prop :=
  Subrel r {i | ∀ (j : ι), r j i → f j < f i}
hrr' : r' ↪r r := Subrel.relEmbedding r {i | ∀ (j : ι), r j i → f j < f i}
this : IsWellOrder (↑{i | ∀ (j : ι), r j i → f j < f i}) r'
i : ι
h : ∀ (j : ι), r j i → f j < f i
⊢ ∃ i', ∃ (hi' : i' < type r'), f i ≤ bfamilyOfFamily' r' (fun i => f ↑i) i' hi'

Next tactic:
refine' ⟨typein r' ⟨i, h⟩, typein_lt_type _ _, _⟩