l3lab/ntp-mathlib huggingface dataset:
theorem IsNormal.eq_iff_zero_and_succ {f g : Ordinal.{u} → Ordinal.{u}} (hf : IsNormal f)
    (hg : IsNormal g) : f = g ↔ f 0 = g 0 ∧ ∀ a, f a = g a → f (succ a) = g (succ a) :=
  ⟨fun h => by simp [h], fun ⟨h₁, h₂⟩ =>
    funext fun a => by
      induction' a using limitRecOn with _ _ _ ho H
      any_goals solve_by_elim
      

Proof state:
case H₃
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
f g : Ordinal.{u} → Ordinal.{u}
hf : IsNormal f
hg : IsNormal g
x✝ : f 0 = g 0 ∧ ∀ (a : Ordinal.{u}), f a = g a → f (succ a) = g (succ a)
h₁ : f 0 = g 0
h₂ : ∀ (a : Ordinal.{u}), f a = g a → f (succ a) = g (succ a)
o✝ : Ordinal.{u}
ho : IsLimit o✝
H : ∀ o' < o✝, f o' = g o'
⊢ f o✝ = g o✝

Next tactic:
rw [← IsNormal.bsup_eq.{u, u} hf ho, ← IsNormal.bsup_eq.{u, u} hg ho]
theorem IsNormal.eq_iff_zero_and_succ {f g : Ordinal.{u} → Ordinal.{u}} (hf : IsNormal f)
    (hg : IsNormal g) : f = g ↔ f 0 = g 0 ∧ ∀ a, f a = g a → f (succ a) = g (succ a) :=
  ⟨fun h => by simp [h], fun ⟨h₁, h₂⟩ =>
    funext fun a => by
      induction' a using limitRecOn with _ _ _ ho H
      any_goals solve_by_elim
      rw [← IsNormal.bsup_eq.{u, u} hf ho, ← IsNormal.bsup_eq.{u, u} hg ho]
      

Proof state:
case H₃
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
f g : Ordinal.{u} → Ordinal.{u}
hf : IsNormal f
hg : IsNormal g
x✝ : f 0 = g 0 ∧ ∀ (a : Ordinal.{u}), f a = g a → f (succ a) = g (succ a)
h₁ : f 0 = g 0
h₂ : ∀ (a : Ordinal.{u}), f a = g a → f (succ a) = g (succ a)
o✝ : Ordinal.{u}
ho : IsLimit o✝
H : ∀ o' < o✝, f o' = g o'
⊢ (Ordinal.bsup o✝ fun x x_1 => f x) = Ordinal.bsup o✝ fun x x_1 => g x

Next tactic:
congr
theorem IsNormal.eq_iff_zero_and_succ {f g : Ordinal.{u} → Ordinal.{u}} (hf : IsNormal f)
    (hg : IsNormal g) : f = g ↔ f 0 = g 0 ∧ ∀ a, f a = g a → f (succ a) = g (succ a) :=
  ⟨fun h => by simp [h], fun ⟨h₁, h₂⟩ =>
    funext fun a => by
      induction' a using limitRecOn with _ _ _ ho H
      any_goals solve_by_elim
      rw [← IsNormal.bsup_eq.{u, u} hf ho, ← IsNormal.bsup_eq.{u, u} hg ho]
      congr
      

Proof state:
case H₃.e_f
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
f g : Ordinal.{u} → Ordinal.{u}
hf : IsNormal f
hg : IsNormal g
x✝ : f 0 = g 0 ∧ ∀ (a : Ordinal.{u}), f a = g a → f (succ a) = g (succ a)
h₁ : f 0 = g 0
h₂ : ∀ (a : Ordinal.{u}), f a = g a → f (succ a) = g (succ a)
o✝ : Ordinal.{u}
ho : IsLimit o✝
H : ∀ o' < o✝, f o' = g o'
⊢ (fun x x_1 => f x) = fun x x_1 => g x

Next tactic:
ext b hb
theorem IsNormal.eq_iff_zero_and_succ {f g : Ordinal.{u} → Ordinal.{u}} (hf : IsNormal f)
    (hg : IsNormal g) : f = g ↔ f 0 = g 0 ∧ ∀ a, f a = g a → f (succ a) = g (succ a) :=
  ⟨fun h => by simp [h], fun ⟨h₁, h₂⟩ =>
    funext fun a => by
      induction' a using limitRecOn with _ _ _ ho H
      any_goals solve_by_elim
      rw [← IsNormal.bsup_eq.{u, u} hf ho, ← IsNormal.bsup_eq.{u, u} hg ho]
      congr
      ext b hb
      

Proof state:
case H₃.e_f.h.h
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
f g : Ordinal.{u} → Ordinal.{u}
hf : IsNormal f
hg : IsNormal g
x✝ : f 0 = g 0 ∧ ∀ (a : Ordinal.{u}), f a = g a → f (succ a) = g (succ a)
h₁ : f 0 = g 0
h₂ : ∀ (a : Ordinal.{u}), f a = g a → f (succ a) = g (succ a)
o✝ : Ordinal.{u}
ho : IsLimit o✝
H : ∀ o' < o✝, f o' = g o'
b : Ordinal.{u}
hb : b < o✝
⊢ f b = g b

Next tactic:
exact H b hb
theorem lt_blsub₂ {o₁ o₂ : Ordinal}
    (op : {a : Ordinal} → (a < o₁) → {b : Ordinal} → (b < o₂) → Ordinal) {a b : Ordinal}
    (ha : a < o₁) (hb : b < o₂) : op ha hb < blsub₂ o₁ o₂ op := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o₁ : Ordinal.{u_4}
o₂ : Ordinal.{u_5}
op : {a : Ordinal.{u_4}} → a < o₁ → {b : Ordinal.{u_5}} → b < o₂ → Ordinal.{max (max u_4 u_5) u_6}
a : Ordinal.{u_4}
b : Ordinal.{u_5}
ha : a < o₁
hb : b < o₂
⊢ op ha hb < blsub₂ o₁ o₂ fun {a} => op

Next tactic:
convert lt_lsub _ (Prod.mk (enum (· < · ) a (by rwa [type_lt]))
    (enum (· < · ) b (by rwa [type_lt])))
theorem lt_blsub₂ {o₁ o₂ : Ordinal}
    (op : {a : Ordinal} → (a < o₁) → {b : Ordinal} → (b < o₂) → Ordinal) {a b : Ordinal}
    (ha : a < o₁) (hb : b < o₂) : op ha hb < blsub₂ o₁ o₂ op := by
  convert lt_lsub _ (Prod.mk (enum (· < · ) a (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o₁ : Ordinal.{u_4}
o₂ : Ordinal.{u_5}
op : {a : Ordinal.{u_4}} → a < o₁ → {b : Ordinal.{u_5}} → b < o₂ → Ordinal.{max (max u_4 u_5) u_6}
a : Ordinal.{u_4}
b : Ordinal.{u_5}
ha : a < o₁
hb : b < o₂
⊢ a < type fun x x_1 => x < x_1

Next tactic:
rwa [type_lt]
theorem lt_blsub₂ {o₁ o₂ : Ordinal}
    (op : {a : Ordinal} → (a < o₁) → {b : Ordinal} → (b < o₂) → Ordinal) {a b : Ordinal}
    (ha : a < o₁) (hb : b < o₂) : op ha hb < blsub₂ o₁ o₂ op := by
  convert lt_lsub _ (Prod.mk (enum (· < · ) a (by rwa [type_lt]))
    (enum (· < · ) b (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o₁ : Ordinal.{u_4}
o₂ : Ordinal.{u_5}
op : {a : Ordinal.{u_4}} → a < o₁ → {b : Ordinal.{u_5}} → b < o₂ → Ordinal.{max (max u_4 u_5) u_6}
a : Ordinal.{u_4}
b : Ordinal.{u_5}
ha : a < o₁
hb : b < o₂
⊢ b < type fun x x_1 => x < x_1

Next tactic:
rwa [type_lt]
theorem lt_blsub₂ {o₁ o₂ : Ordinal}
    (op : {a : Ordinal} → (a < o₁) → {b : Ordinal} → (b < o₂) → Ordinal) {a b : Ordinal}
    (ha : a < o₁) (hb : b < o₂) : op ha hb < blsub₂ o₁ o₂ op := by
  convert lt_lsub _ (Prod.mk (enum (· < · ) a (by rwa [type_lt]))
    (enum (· < · ) b (by rwa [type_lt])))
  

Proof state:
case h.e'_3
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o₁ : Ordinal.{u_4}
o₂ : Ordinal.{u_5}
op : {a : Ordinal.{u_4}} → a < o₁ → {b : Ordinal.{u_5}} → b < o₂ → Ordinal.{max (max u_4 u_5) u_6}
a : Ordinal.{u_4}
b : Ordinal.{u_5}
ha : a < o₁
hb : b < o₂
⊢ op ha hb =
    (fun {a} => op)
      (_ :
        typein (fun x x_1 => x < x_1)
            (enum (fun x x_1 => x < x_1) a (_ : a < type fun x x_1 => x < x_1),
                enum (fun x x_1 => x < x_1) b (_ : b < type fun x x_1 => x < x_1)).1 <
          o₁)
      (_ :
        typein (fun x x_1 => x < x_1)
            (enum (fun x x_1 => x < x_1) a (_ : a < type fun x x_1 => x < x_1),
                enum (fun x x_1 => x < x_1) b (_ : b < type fun x x_1 => x < x_1)).2 <
          o₂)

Next tactic:
simp only [typein_enum]
theorem le_mex_of_forall {ι : Type u} {f : ι → Ordinal.{max u v}} {a : Ordinal}
    (H : ∀ b < a, ∃ i, f i = b) : a ≤ mex.{_, v} f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{max u v}
a : Ordinal.{max u v}
H : ∀ b < a, ∃ i, f i = b
⊢ a ≤ mex f

Next tactic:
by_contra! h
theorem le_mex_of_forall {ι : Type u} {f : ι → Ordinal.{max u v}} {a : Ordinal}
    (H : ∀ b < a, ∃ i, f i = b) : a ≤ mex.{_, v} f := by
  by_contra! h
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{max u v}
a : Ordinal.{max u v}
H : ∀ b < a, ∃ i, f i = b
h : mex f < a
⊢ False

Next tactic:
exact mex_not_mem_range f (H _ h)
theorem ne_mex {ι : Type u} (f : ι → Ordinal.{max u v}) : ∀ i, f i ≠ mex.{_, v} f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{max u v}
⊢ ∀ (i : ι), f i ≠ mex f

Next tactic:
simpa using mex_not_mem_range.{_, v} f
theorem mex_le_of_ne {ι} {f : ι → Ordinal} {a} (ha : ∀ i, f i ≠ a) : mex f ≤ a :=
  csInf_le' (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u_4
f : ι → Ordinal.{max u_5 u_4}
a : Ordinal.{max u_5 u_4}
ha : ∀ (i : ι), f i ≠ a
⊢ a ∈ (range f)ᶜ

Next tactic:
simp [ha]
theorem exists_of_lt_mex {ι} {f : ι → Ordinal} {a} (ha : a < mex f) : ∃ i, f i = a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u_4
f : ι → Ordinal.{max u_5 u_4}
a : Ordinal.{max u_4 u_5}
ha : a < mex f
⊢ ∃ i, f i = a

Next tactic:
by_contra! ha'
theorem exists_of_lt_mex {ι} {f : ι → Ordinal} {a} (ha : a < mex f) : ∃ i, f i = a := by
  by_contra! ha'
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u_4
f : ι → Ordinal.{max u_5 u_4}
a : Ordinal.{max u_4 u_5}
ha : a < mex f
ha' : ∀ (i : ι), f i ≠ a
⊢ False

Next tactic:
exact ha.not_le (mex_le_of_ne ha')
theorem mex_monotone {α β : Type u} {f : α → Ordinal.{max u v}} {g : β → Ordinal.{max u v}}
    (h : Set.range f ⊆ Set.range g) : mex.{_, v} f ≤ mex.{_, v} g := by
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
r : α✝ → α✝ → Prop
s : β✝ → β✝ → Prop
t : γ → γ → Prop
α β : Type u
f : α → Ordinal.{max u v}
g : β → Ordinal.{max u v}
h : range f ⊆ range g
⊢ mex f ≤ mex g

Next tactic:
refine' mex_le_of_ne fun i hi => _
theorem mex_monotone {α β : Type u} {f : α → Ordinal.{max u v}} {g : β → Ordinal.{max u v}}
    (h : Set.range f ⊆ Set.range g) : mex.{_, v} f ≤ mex.{_, v} g := by
  refine' mex_le_of_ne fun i hi => _
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
r : α✝ → α✝ → Prop
s : β✝ → β✝ → Prop
t : γ → γ → Prop
α β : Type u
f : α → Ordinal.{max u v}
g : β → Ordinal.{max u v}
h : range f ⊆ range g
i : α
hi : f i = mex g
⊢ False

Next tactic:
cases' h ⟨i, rfl⟩ with j hj
theorem mex_monotone {α β : Type u} {f : α → Ordinal.{max u v}} {g : β → Ordinal.{max u v}}
    (h : Set.range f ⊆ Set.range g) : mex.{_, v} f ≤ mex.{_, v} g := by
  refine' mex_le_of_ne fun i hi => _
  cases' h ⟨i, rfl⟩ with j hj
  

Proof state:
case intro
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
r : α✝ → α✝ → Prop
s : β✝ → β✝ → Prop
t : γ → γ → Prop
α β : Type u
f : α → Ordinal.{max u v}
g : β → Ordinal.{max u v}
h : range f ⊆ range g
i : α
hi : f i = mex g
j : β
hj : g j = f i
⊢ False

Next tactic:
rw [← hj] at hi
theorem mex_monotone {α β : Type u} {f : α → Ordinal.{max u v}} {g : β → Ordinal.{max u v}}
    (h : Set.range f ⊆ Set.range g) : mex.{_, v} f ≤ mex.{_, v} g := by
  refine' mex_le_of_ne fun i hi => _
  cases' h ⟨i, rfl⟩ with j hj
  rw [← hj] at hi
  

Proof state:
case intro
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
r : α✝ → α✝ → Prop
s : β✝ → β✝ → Prop
t : γ → γ → Prop
α β : Type u
f : α → Ordinal.{max u v}
g : β → Ordinal.{max u v}
h : range f ⊆ range g
i : α
j : β
hi : g j = mex g
hj : g j = f i
⊢ False

Next tactic:
exact ne_mex g j hi
theorem mex_lt_ord_succ_mk {ι : Type u} (f : ι → Ordinal.{u}) :
    mex.{_, u} f < (succ #ι).ord := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{u}
⊢ mex f < ord (succ #ι)

Next tactic:
by_contra! h
theorem mex_lt_ord_succ_mk {ι : Type u} (f : ι → Ordinal.{u}) :
    mex.{_, u} f < (succ #ι).ord := by
  by_contra! h
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{u}
h : ord (succ #ι) ≤ mex f
⊢ False

Next tactic:
apply (lt_succ #ι).not_le
theorem mex_lt_ord_succ_mk {ι : Type u} (f : ι → Ordinal.{u}) :
    mex.{_, u} f < (succ #ι).ord := by
  by_contra! h
  apply (lt_succ #ι).not_le
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{u}
h : ord (succ #ι) ≤ mex f
⊢ succ #ι ≤ #ι

Next tactic:
have H := fun a => exists_of_lt_mex ((typein_lt_self a).trans_le h)
theorem mex_lt_ord_succ_mk {ι : Type u} (f : ι → Ordinal.{u}) :
    mex.{_, u} f < (succ #ι).ord := by
  by_contra! h
  apply (lt_succ #ι).not_le
  have H := fun a => exists_of_lt_mex ((typein_lt_self a).trans_le h)
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{u}
h : ord (succ #ι) ≤ mex f
H : ∀ (a : (Quotient.out (ord (succ #ι))).α), ∃ i, f i = typein (fun x x_1 => x < x_1) a
⊢ succ #ι ≤ #ι

Next tactic:
let g : (succ #ι).ord.out.α → ι := fun a => Classical.choose (H a)
theorem mex_lt_ord_succ_mk {ι : Type u} (f : ι → Ordinal.{u}) :
    mex.{_, u} f < (succ #ι).ord := by
  by_contra! h
  apply (lt_succ #ι).not_le
  have H := fun a => exists_of_lt_mex ((typein_lt_self a).trans_le h)
  let g : (succ #ι).ord.out.α → ι := fun a => Classical.choose (H a)
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{u}
h : ord (succ #ι) ≤ mex f
H : ∀ (a : (Quotient.out (ord (succ #ι))).α), ∃ i, f i = typein (fun x x_1 => x < x_1) a
g : (Quotient.out (ord (succ #ι))).α → ι := fun a => choose (_ : ∃ i, f i = typein (fun x x_1 => x < x_1) a)
⊢ succ #ι ≤ #ι

Next tactic:
have hg : Injective g := fun a b h' => by
    have Hf : ∀ x, f (g x) =
        typein ((· < ·) : (succ #ι).ord.out.α → (succ #ι).ord.out.α → Prop) x :=
      fun a => Classical.choose_spec (H a)
    apply_fun f at h'
    rwa [Hf, Hf, typein_inj] at h'
theorem mex_lt_ord_succ_mk {ι : Type u} (f : ι → Ordinal.{u}) :
    mex.{_, u} f < (succ #ι).ord := by
  by_contra! h
  apply (lt_succ #ι).not_le
  have H := fun a => exists_of_lt_mex ((typein_lt_self a).trans_le h)
  let g : (succ #ι).ord.out.α → ι := fun a => Classical.choose (H a)
  have hg : Injective g := fun a b h' => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{u}
h : ord (succ #ι) ≤ mex f
H : ∀ (a : (Quotient.out (ord (succ #ι))).α), ∃ i, f i = typein (fun x x_1 => x < x_1) a
g : (Quotient.out (ord (succ #ι))).α → ι := fun a => choose (_ : ∃ i, f i = typein (fun x x_1 => x < x_1) a)
a b : (Quotient.out (ord (succ #ι))).α
h' : g a = g b
⊢ a = b

Next tactic:
have Hf : ∀ x, f (g x) =
        typein ((· < ·) : (succ #ι).ord.out.α → (succ #ι).ord.out.α → Prop) x :=
      fun a => Classical.choose_spec (H a)
theorem mex_lt_ord_succ_mk {ι : Type u} (f : ι → Ordinal.{u}) :
    mex.{_, u} f < (succ #ι).ord := by
  by_contra! h
  apply (lt_succ #ι).not_le
  have H := fun a => exists_of_lt_mex ((typein_lt_self a).trans_le h)
  let g : (succ #ι).ord.out.α → ι := fun a => Classical.choose (H a)
  have hg : Injective g := fun a b h' => by
    have Hf : ∀ x, f (g x) =
        typein ((· < ·) : (succ #ι).ord.out.α → (succ #ι).ord.out.α → Prop) x :=
      fun a => Classical.choose_spec (H a)
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{u}
h : ord (succ #ι) ≤ mex f
H : ∀ (a : (Quotient.out (ord (succ #ι))).α), ∃ i, f i = typein (fun x x_1 => x < x_1) a
g : (Quotient.out (ord (succ #ι))).α → ι := fun a => choose (_ : ∃ i, f i = typein (fun x x_1 => x < x_1) a)
a b : (Quotient.out (ord (succ #ι))).α
h' : g a = g b
Hf : ∀ (x : (Quotient.out (ord (succ #ι))).α), f (g x) = typein (fun x x_1 => x < x_1) x
⊢ a = b

Next tactic:
apply_fun f at h'
theorem mex_lt_ord_succ_mk {ι : Type u} (f : ι → Ordinal.{u}) :
    mex.{_, u} f < (succ #ι).ord := by
  by_contra! h
  apply (lt_succ #ι).not_le
  have H := fun a => exists_of_lt_mex ((typein_lt_self a).trans_le h)
  let g : (succ #ι).ord.out.α → ι := fun a => Classical.choose (H a)
  have hg : Injective g := fun a b h' => by
    have Hf : ∀ x, f (g x) =
        typein ((· < ·) : (succ #ι).ord.out.α → (succ #ι).ord.out.α → Prop) x :=
      fun a => Classical.choose_spec (H a)
    apply_fun f at h'
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{u}
h : ord (succ #ι) ≤ mex f
H : ∀ (a : (Quotient.out (ord (succ #ι))).α), ∃ i, f i = typein (fun x x_1 => x < x_1) a
g : (Quotient.out (ord (succ #ι))).α → ι := fun a => choose (_ : ∃ i, f i = typein (fun x x_1 => x < x_1) a)
a b : (Quotient.out (ord (succ #ι))).α
Hf : ∀ (x : (Quotient.out (ord (succ #ι))).α), f (g x) = typein (fun x x_1 => x < x_1) x
h' : f (g a) = f (g b)
⊢ a = b

Next tactic:
rwa [Hf, Hf, typein_inj] at h'
theorem mex_lt_ord_succ_mk {ι : Type u} (f : ι → Ordinal.{u}) :
    mex.{_, u} f < (succ #ι).ord := by
  by_contra! h
  apply (lt_succ #ι).not_le
  have H := fun a => exists_of_lt_mex ((typein_lt_self a).trans_le h)
  let g : (succ #ι).ord.out.α → ι := fun a => Classical.choose (H a)
  have hg : Injective g := fun a b h' => by
    have Hf : ∀ x, f (g x) =
        typein ((· < ·) : (succ #ι).ord.out.α → (succ #ι).ord.out.α → Prop) x :=
      fun a => Classical.choose_spec (H a)
    apply_fun f at h'
    rwa [Hf, Hf, typein_inj] at h'
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{u}
h : ord (succ #ι) ≤ mex f
H : ∀ (a : (Quotient.out (ord (succ #ι))).α), ∃ i, f i = typein (fun x x_1 => x < x_1) a
g : (Quotient.out (ord (succ #ι))).α → ι := fun a => choose (_ : ∃ i, f i = typein (fun x x_1 => x < x_1) a)
hg : Injective g
⊢ succ #ι ≤ #ι

Next tactic:
convert Cardinal.mk_le_of_injective hg
theorem mex_lt_ord_succ_mk {ι : Type u} (f : ι → Ordinal.{u}) :
    mex.{_, u} f < (succ #ι).ord := by
  by_contra! h
  apply (lt_succ #ι).not_le
  have H := fun a => exists_of_lt_mex ((typein_lt_self a).trans_le h)
  let g : (succ #ι).ord.out.α → ι := fun a => Classical.choose (H a)
  have hg : Injective g := fun a b h' => by
    have Hf : ∀ x, f (g x) =
        typein ((· < ·) : (succ #ι).ord.out.α → (succ #ι).ord.out.α → Prop) x :=
      fun a => Classical.choose_spec (H a)
    apply_fun f at h'
    rwa [Hf, Hf, typein_inj] at h'
  convert Cardinal.mk_le_of_injective hg
  

Proof state:
case h.e'_3
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
ι : Type u
f : ι → Ordinal.{u}
h : ord (succ #ι) ≤ mex f
H : ∀ (a : (Quotient.out (ord (succ #ι))).α), ∃ i, f i = typein (fun x x_1 => x < x_1) a
g : (Quotient.out (ord (succ #ι))).α → ι := fun a => choose (_ : ∃ i, f i = typein (fun x x_1 => x < x_1) a)
hg : Injective g
⊢ succ #ι = #(Quotient.out (ord (succ #ι))).α

Next tactic:
rw [Cardinal.mk_ord_out (succ #ι)]
theorem bmex_not_mem_brange {o : Ordinal} (f : ∀ a < o, Ordinal) : bmex o f ∉ brange o f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_4}
f : (a : Ordinal.{u_4}) → a < o → Ordinal.{max u_4 u_5}
⊢ bmex o f ∉ brange o f

Next tactic:
rw [← range_familyOfBFamily]
theorem bmex_not_mem_brange {o : Ordinal} (f : ∀ a < o, Ordinal) : bmex o f ∉ brange o f := by
  rw [← range_familyOfBFamily]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_4}
f : (a : Ordinal.{u_4}) → a < o → Ordinal.{max u_4 u_5}
⊢ bmex o f ∉ range (familyOfBFamily o f)

Next tactic:
apply mex_not_mem_range
theorem le_bmex_of_forall {o : Ordinal} (f : ∀ a < o, Ordinal) {a : Ordinal}
    (H : ∀ b < a, ∃ i hi, f i hi = b) : a ≤ bmex o f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_4}
f : (a : Ordinal.{u_4}) → a < o → Ordinal.{max u_4 u_5}
a : Ordinal.{max u_4 u_5}
H : ∀ b < a, ∃ i, ∃ (hi : i < o), f i hi = b
⊢ a ≤ bmex o f

Next tactic:
by_contra! h
theorem le_bmex_of_forall {o : Ordinal} (f : ∀ a < o, Ordinal) {a : Ordinal}
    (H : ∀ b < a, ∃ i hi, f i hi = b) : a ≤ bmex o f := by
  by_contra! h
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_4}
f : (a : Ordinal.{u_4}) → a < o → Ordinal.{max u_4 u_5}
a : Ordinal.{max u_4 u_5}
H : ∀ b < a, ∃ i, ∃ (hi : i < o), f i hi = b
h : bmex o f < a
⊢ False

Next tactic:
exact bmex_not_mem_brange f (H _ h)
theorem ne_bmex {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) {i} (hi) :
    f i hi ≠ bmex.{_, v} o f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u}
f : (a : Ordinal.{u}) → a < o → Ordinal.{max u v}
i : Ordinal.{u}
hi : i < o
⊢ f i hi ≠ bmex o f

Next tactic:
convert (config := {transparency := .default})
    ne_mex.{_, v} (familyOfBFamily o f) (enum (· < ·) i (by rwa [type_lt])) using 2
theorem ne_bmex {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) {i} (hi) :
    f i hi ≠ bmex.{_, v} o f := by
  convert (config := {transparency := .default})
    ne_mex.{_, v} (familyOfBFamily o f) (enum (· < ·) i (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u}
f : (a : Ordinal.{u}) → a < o → Ordinal.{max u v}
i : Ordinal.{u}
hi : i < o
⊢ i < type fun x x_1 => x < x_1

Next tactic:
rwa [type_lt]
theorem ne_bmex {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) {i} (hi) :
    f i hi ≠ bmex.{_, v} o f := by
  convert (config := {transparency := .default})
    ne_mex.{_, v} (familyOfBFamily o f) (enum (· < ·) i (by rwa [type_lt])) using 2
  -- Porting note: `familyOfBFamily_enum` → `typein_enum`
  

Proof state:
case h.e'_2.h.e'_1
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u}
f : (a : Ordinal.{u}) → a < o → Ordinal.{max u v}
i : Ordinal.{u}
hi : i < o
⊢ i = typein (fun x x_1 => x < x_1) (enum (fun x x_1 => x < x_1) i (_ : i < type fun x x_1 => x < x_1))

Next tactic:
rw [typein_enum]
theorem exists_of_lt_bmex {o : Ordinal} {f : ∀ a < o, Ordinal} {a} (ha : a < bmex o f) :
    ∃ i hi, f i hi = a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_4}
f : (a : Ordinal.{u_4}) → a < o → Ordinal.{max u_4 u_5}
a : Ordinal.{max u_5 u_4}
ha : a < bmex o f
⊢ ∃ i, ∃ (hi : i < o), f i hi = a

Next tactic:
cases' exists_of_lt_mex ha with i hi
theorem exists_of_lt_bmex {o : Ordinal} {f : ∀ a < o, Ordinal} {a} (ha : a < bmex o f) :
    ∃ i hi, f i hi = a := by
  cases' exists_of_lt_mex ha with i hi
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u_4}
f : (a : Ordinal.{u_4}) → a < o → Ordinal.{max u_4 u_5}
a : Ordinal.{max u_5 u_4}
ha : a < bmex o f
i : (Quotient.out o).α
hi : familyOfBFamily o f i = a
⊢ ∃ i, ∃ (hi : i < o), f i hi = a

Next tactic:
exact ⟨_, typein_lt_self i, hi⟩
theorem bmex_monotone {o o' : Ordinal.{u}}
    {f : ∀ a < o, Ordinal.{max u v}} {g : ∀ a < o', Ordinal.{max u v}}
    (h : brange o f ⊆ brange o' g) : bmex.{_, v} o f ≤ bmex.{_, v} o' g :=
  mex_monotone (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o o' : Ordinal.{u}
f : (a : Ordinal.{u}) → a < o → Ordinal.{max u v}
g : (a : Ordinal.{u}) → a < o' → Ordinal.{max u v}
h : brange o f ⊆ brange o' g
⊢ range (familyOfBFamily o f) ⊆ range (familyOfBFamily o' g)

Next tactic:
rwa [range_familyOfBFamily, range_familyOfBFamily]
theorem bmex_lt_ord_succ_card {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{u}) :
    bmex.{_, u} o f < (succ o.card).ord := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u}
f : (a : Ordinal.{u}) → a < o → Ordinal.{u}
⊢ bmex o f < ord (succ (card o))

Next tactic:
rw [← mk_ordinal_out]
theorem bmex_lt_ord_succ_card {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{u}) :
    bmex.{_, u} o f < (succ o.card).ord := by
  rw [← mk_ordinal_out]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
r : α → α → Prop
s : β → β → Prop
t : γ → γ → Prop
o : Ordinal.{u}
f : (a : Ordinal.{u}) → a < o → Ordinal.{u}
⊢ bmex o f < ord (succ #(Quotient.out o).α)

Next tactic:
exact mex_lt_ord_succ_mk (familyOfBFamily o f)
private theorem enumOrd_mem_aux (hS : Unbounded (· < ·) S) (o) :
    enumOrd S o ∈ S ∩ Set.Ici (blsub.{u, u} o fun c _ => enumOrd S c) := by
  

Proof state:
S : Set Ordinal.{u}
hS : Unbounded (fun x x_1 => x < x_1) S
o : Ordinal.{u}
⊢ enumOrd S o ∈ S ∩ Ici (blsub o fun c x => enumOrd S c)

Next tactic:
rw [enumOrd_def']