l3lab/ntp-mathlib huggingface dataset:
theorem derivBFamily_fp {i hi} (H : IsNormal (f i hi)) (a : Ordinal) :
    f i hi (derivBFamily.{u, v} o f a) = derivBFamily.{u, v} o f a := by
  rw [← familyOfBFamily_enum o f]
  apply derivFamily_fp
  

Proof state:
case H
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
i : Ordinal.{u}
hi : i < o
H : IsNormal (f i hi)
a : Ordinal.{max u v}
⊢ IsNormal (familyOfBFamily o f (enum (fun x x_1 => x < x_1) i (_ : i < type fun x x_1 => x < x_1)))

Next tactic:
rw [familyOfBFamily_enum]
theorem derivBFamily_fp {i hi} (H : IsNormal (f i hi)) (a : Ordinal) :
    f i hi (derivBFamily.{u, v} o f a) = derivBFamily.{u, v} o f a := by
  rw [← familyOfBFamily_enum o f]
  apply derivFamily_fp
  rw [familyOfBFamily_enum]
  

Proof state:
case H
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
i : Ordinal.{u}
hi : i < o
H : IsNormal (f i hi)
a : Ordinal.{max u v}
⊢ IsNormal (f i ?H.hi)
case H.hi
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
i : Ordinal.{u}
hi : i < o
H : IsNormal (f i hi)
a : Ordinal.{max u v}
⊢ i < o

Next tactic:
exact H
theorem le_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} :
    (∀ i hi, f i hi a ≤ a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by
  

Proof state:
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
⊢ (∀ (i : Ordinal.{u}) (hi : i < o), f i hi a ≤ a) ↔ ∃ b, derivBFamily o f b = a

Next tactic:
unfold derivBFamily
theorem le_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} :
    (∀ i hi, f i hi a ≤ a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by
  unfold derivBFamily
  

Proof state:
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
⊢ (∀ (i : Ordinal.{u}) (hi : i < o), f i hi a ≤ a) ↔ ∃ b, derivFamily (familyOfBFamily o f) b = a

Next tactic:
rw [← le_iff_derivFamily]
theorem le_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} :
    (∀ i hi, f i hi a ≤ a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by
  unfold derivBFamily
  rw [← le_iff_derivFamily]
  · 

Proof state:
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
⊢ (∀ (i : Ordinal.{u}) (hi : i < o), f i hi a ≤ a) ↔ ∀ (i : (Quotient.out o).α), familyOfBFamily o f i a ≤ a

Next tactic:
refine' ⟨fun h i => h _ _, fun h i hi => _⟩
theorem le_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} :
    (∀ i hi, f i hi a ≤ a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by
  unfold derivBFamily
  rw [← le_iff_derivFamily]
  · refine' ⟨fun h i => h _ _, fun h i hi => _⟩
    

Proof state:
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
h : ∀ (i : (Quotient.out o).α), familyOfBFamily o f i a ≤ a
i : Ordinal.{u}
hi : i < o
⊢ f i hi a ≤ a

Next tactic:
rw [← familyOfBFamily_enum o f]
theorem le_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} :
    (∀ i hi, f i hi a ≤ a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by
  unfold derivBFamily
  rw [← le_iff_derivFamily]
  · refine' ⟨fun h i => h _ _, fun h i hi => _⟩
    rw [← familyOfBFamily_enum o f]
    

Proof state:
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
h : ∀ (i : (Quotient.out o).α), familyOfBFamily o f i a ≤ a
i : Ordinal.{u}
hi : i < o
⊢ familyOfBFamily o f (enum (fun x x_1 => x < x_1) i (_ : i < type fun x x_1 => x < x_1)) a ≤ a

Next tactic:
apply h
theorem le_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} :
    (∀ i hi, f i hi a ≤ a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by
  unfold derivBFamily
  rw [← le_iff_derivFamily]
  · refine' ⟨fun h i => h _ _, fun h i hi => _⟩
    rw [← familyOfBFamily_enum o f]
    apply h
  · 

Proof state:
case H
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
⊢ ∀ (i : (Quotient.out o).α), IsNormal (familyOfBFamily o f i)

Next tactic:
exact fun _ => H _ _
theorem fp_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} :
    (∀ i hi, f i hi a = a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by
  

Proof state:
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
⊢ (∀ (i : Ordinal.{u}) (hi : i < o), f i hi a = a) ↔ ∃ b, derivBFamily o f b = a

Next tactic:
rw [← le_iff_derivBFamily H]
theorem fp_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} :
    (∀ i hi, f i hi a = a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by
  rw [← le_iff_derivBFamily H]
  

Proof state:
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
⊢ (∀ (i : Ordinal.{u}) (hi : i < o), f i hi a = a) ↔ ∀ (i : Ordinal.{u}) (hi : i < o), f i hi a ≤ a

Next tactic:
refine' ⟨fun h i hi => le_of_eq (h i hi), fun h i hi => _⟩
theorem fp_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} :
    (∀ i hi, f i hi a = a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by
  rw [← le_iff_derivBFamily H]
  refine' ⟨fun h i hi => le_of_eq (h i hi), fun h i hi => _⟩
  

Proof state:
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
h : ∀ (i : Ordinal.{u}) (hi : i < o), f i hi a ≤ a
i : Ordinal.{u}
hi : i < o
⊢ f i hi a = a

Next tactic:
rw [← (H i hi).le_iff_eq]
theorem fp_iff_derivBFamily (H : ∀ i hi, IsNormal (f i hi)) {a} :
    (∀ i hi, f i hi a = a) ↔ ∃ b, derivBFamily.{u, v} o f b = a := by
  rw [← le_iff_derivBFamily H]
  refine' ⟨fun h i hi => le_of_eq (h i hi), fun h i hi => _⟩
  rw [← (H i hi).le_iff_eq]
  

Proof state:
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
h : ∀ (i : Ordinal.{u}) (hi : i < o), f i hi a ≤ a
i : Ordinal.{u}
hi : i < o
⊢ f i hi a ≤ a

Next tactic:
exact h i hi
/-- For a family of normal functions, `Ordinal.derivBFamily` enumerates the common fixed points. -/
theorem derivBFamily_eq_enumOrd (H : ∀ i hi, IsNormal (f i hi)) :
    derivBFamily.{u, v} o f = enumOrd (⋂ (i) (hi), Function.fixedPoints (f i hi)) := by
  

Proof state:
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
⊢ derivBFamily o f = enumOrd (⋂ i, ⋂ (hi : i < o), fixedPoints (f i hi))

Next tactic:
rw [← eq_enumOrd _ (fp_bfamily_unbounded.{u, v} H)]
/-- For a family of normal functions, `Ordinal.derivBFamily` enumerates the common fixed points. -/
theorem derivBFamily_eq_enumOrd (H : ∀ i hi, IsNormal (f i hi)) :
    derivBFamily.{u, v} o f = enumOrd (⋂ (i) (hi), Function.fixedPoints (f i hi)) := by
  rw [← eq_enumOrd _ (fp_bfamily_unbounded.{u, v} H)]
  

Proof state:
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
⊢ StrictMono (derivBFamily o f) ∧ Set.range (derivBFamily o f) = ⋂ i, ⋂ (hi : i < o), fixedPoints (f i hi)

Next tactic:
use (derivBFamily_isNormal f).strictMono
/-- For a family of normal functions, `Ordinal.derivBFamily` enumerates the common fixed points. -/
theorem derivBFamily_eq_enumOrd (H : ∀ i hi, IsNormal (f i hi)) :
    derivBFamily.{u, v} o f = enumOrd (⋂ (i) (hi), Function.fixedPoints (f i hi)) := by
  rw [← eq_enumOrd _ (fp_bfamily_unbounded.{u, v} H)]
  use (derivBFamily_isNormal f).strictMono
  

Proof state:
case right
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
⊢ Set.range (derivBFamily o f) = ⋂ i, ⋂ (hi : i < o), fixedPoints (f i hi)

Next tactic:
rw [Set.range_eq_iff]
/-- For a family of normal functions, `Ordinal.derivBFamily` enumerates the common fixed points. -/
theorem derivBFamily_eq_enumOrd (H : ∀ i hi, IsNormal (f i hi)) :
    derivBFamily.{u, v} o f = enumOrd (⋂ (i) (hi), Function.fixedPoints (f i hi)) := by
  rw [← eq_enumOrd _ (fp_bfamily_unbounded.{u, v} H)]
  use (derivBFamily_isNormal f).strictMono
  rw [Set.range_eq_iff]
  

Proof state:
case right
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
⊢ (∀ (a : Ordinal.{max u v}), derivBFamily o f a ∈ ⋂ i, ⋂ (hi : i < o), fixedPoints (f i hi)) ∧
    ∀ b ∈ ⋂ i, ⋂ (hi : i < o), fixedPoints (f i hi), ∃ a, derivBFamily o f a = b

Next tactic:
refine' ⟨fun a => Set.mem_iInter₂.2 fun i hi => derivBFamily_fp (H i hi) a, fun a ha => _⟩
/-- For a family of normal functions, `Ordinal.derivBFamily` enumerates the common fixed points. -/
theorem derivBFamily_eq_enumOrd (H : ∀ i hi, IsNormal (f i hi)) :
    derivBFamily.{u, v} o f = enumOrd (⋂ (i) (hi), Function.fixedPoints (f i hi)) := by
  rw [← eq_enumOrd _ (fp_bfamily_unbounded.{u, v} H)]
  use (derivBFamily_isNormal f).strictMono
  rw [Set.range_eq_iff]
  refine' ⟨fun a => Set.mem_iInter₂.2 fun i hi => derivBFamily_fp (H i hi) a, fun a ha => _⟩
  

Proof state:
case right
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
ha : a ∈ ⋂ i, ⋂ (hi : i < o), fixedPoints (f i hi)
⊢ ∃ a_1, derivBFamily o f a_1 = a

Next tactic:
rw [Set.mem_iInter₂] at ha
/-- For a family of normal functions, `Ordinal.derivBFamily` enumerates the common fixed points. -/
theorem derivBFamily_eq_enumOrd (H : ∀ i hi, IsNormal (f i hi)) :
    derivBFamily.{u, v} o f = enumOrd (⋂ (i) (hi), Function.fixedPoints (f i hi)) := by
  rw [← eq_enumOrd _ (fp_bfamily_unbounded.{u, v} H)]
  use (derivBFamily_isNormal f).strictMono
  rw [Set.range_eq_iff]
  refine' ⟨fun a => Set.mem_iInter₂.2 fun i hi => derivBFamily_fp (H i hi) a, fun a ha => _⟩
  rw [Set.mem_iInter₂] at ha
  

Proof state:
case right
o : Ordinal.{u}
f : (b : Ordinal.{u}) → b < o → Ordinal.{max u v} → Ordinal.{max u v}
H : ∀ (i : Ordinal.{u}) (hi : i < o), IsNormal (f i hi)
a : Ordinal.{max u v}
ha : ∀ (i : Ordinal.{u}) (j : i < o), a ∈ fixedPoints (f i j)
⊢ ∃ a_1, derivBFamily o f a_1 = a

Next tactic:
rwa [← fp_iff_derivBFamily H]
@[simp]
theorem sup_iterate_eq_nfp (f : Ordinal.{u} → Ordinal.{u}) :
    (fun a => sup fun n : ℕ => f^[n] a) = nfp f := by
  

Proof state:
f✝ f : Ordinal.{u} → Ordinal.{u}
⊢ (fun a => sup fun n => f^[n] a) = nfp f

Next tactic:
refine' funext fun a => le_antisymm _ (sup_le fun l => _)
@[simp]
theorem sup_iterate_eq_nfp (f : Ordinal.{u} → Ordinal.{u}) :
    (fun a => sup fun n : ℕ => f^[n] a) = nfp f := by
  refine' funext fun a => le_antisymm _ (sup_le fun l => _)
  · 

Proof state:
case refine'_1
f✝ f : Ordinal.{u} → Ordinal.{u}
a : Ordinal.{u}
⊢ (sup fun n => f^[n] a) ≤ nfp f a

Next tactic:
rw [sup_le_iff]
@[simp]
theorem sup_iterate_eq_nfp (f : Ordinal.{u} → Ordinal.{u}) :
    (fun a => sup fun n : ℕ => f^[n] a) = nfp f := by
  refine' funext fun a => le_antisymm _ (sup_le fun l => _)
  · rw [sup_le_iff]
    

Proof state:
case refine'_1
f✝ f : Ordinal.{u} → Ordinal.{u}
a : Ordinal.{u}
⊢ ∀ (i : ℕ), f^[i] a ≤ nfp f a

Next tactic:
intro n
@[simp]
theorem sup_iterate_eq_nfp (f : Ordinal.{u} → Ordinal.{u}) :
    (fun a => sup fun n : ℕ => f^[n] a) = nfp f := by
  refine' funext fun a => le_antisymm _ (sup_le fun l => _)
  · rw [sup_le_iff]
    intro n
    

Proof state:
case refine'_1
f✝ f : Ordinal.{u} → Ordinal.{u}
a : Ordinal.{u}
n : ℕ
⊢ f^[n] a ≤ nfp f a

Next tactic:
rw [← List.length_replicate n Unit.unit, ← List.foldr_const f a]
@[simp]
theorem sup_iterate_eq_nfp (f : Ordinal.{u} → Ordinal.{u}) :
    (fun a => sup fun n : ℕ => f^[n] a) = nfp f := by
  refine' funext fun a => le_antisymm _ (sup_le fun l => _)
  · rw [sup_le_iff]
    intro n
    rw [← List.length_replicate n Unit.unit, ← List.foldr_const f a]
    

Proof state:
case refine'_1
f✝ f : Ordinal.{u} → Ordinal.{u}
a : Ordinal.{u}
n : ℕ
⊢ List.foldr (fun x => f) a (List.replicate n ()) ≤ nfp f a

Next tactic:
apply le_sup
@[simp]
theorem sup_iterate_eq_nfp (f : Ordinal.{u} → Ordinal.{u}) :
    (fun a => sup fun n : ℕ => f^[n] a) = nfp f := by
  refine' funext fun a => le_antisymm _ (sup_le fun l => _)
  · rw [sup_le_iff]
    intro n
    rw [← List.length_replicate n Unit.unit, ← List.foldr_const f a]
    apply le_sup
  · 

Proof state:
case refine'_2
f✝ f : Ordinal.{u} → Ordinal.{u}
a : Ordinal.{u}
l : List Unit
⊢ List.foldr (fun x => f) a l ≤ sup fun n => f^[n] a

Next tactic:
rw [List.foldr_const f a l]
@[simp]
theorem sup_iterate_eq_nfp (f : Ordinal.{u} → Ordinal.{u}) :
    (fun a => sup fun n : ℕ => f^[n] a) = nfp f := by
  refine' funext fun a => le_antisymm _ (sup_le fun l => _)
  · rw [sup_le_iff]
    intro n
    rw [← List.length_replicate n Unit.unit, ← List.foldr_const f a]
    apply le_sup
  · rw [List.foldr_const f a l]
    

Proof state:
case refine'_2
f✝ f : Ordinal.{u} → Ordinal.{u}
a : Ordinal.{u}
l : List Unit
⊢ f^[List.length l] a ≤ sup fun n => f^[n] a

Next tactic:
exact le_sup _ _
theorem iterate_le_nfp (f a n) : f^[n] a ≤ nfp f a := by
  

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
a : Ordinal.{u_1}
n : ℕ
⊢ f^[n] a ≤ nfp f a

Next tactic:
rw [← sup_iterate_eq_nfp]
theorem iterate_le_nfp (f a n) : f^[n] a ≤ nfp f a := by
  rw [← sup_iterate_eq_nfp]
  

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
a : Ordinal.{u_1}
n : ℕ
⊢ f^[n] a ≤ (fun a => sup fun n => f^[n] a) a

Next tactic:
exact le_sup _ n
theorem lt_nfp {a b} : a < nfp f b ↔ ∃ n, a < f^[n] b := by
  

Proof state:
f : Ordinal.{u} → Ordinal.{u}
a b : Ordinal.{u}
⊢ a < nfp f b ↔ ∃ n, a < f^[n] b

Next tactic:
rw [← sup_iterate_eq_nfp]
theorem lt_nfp {a b} : a < nfp f b ↔ ∃ n, a < f^[n] b := by
  rw [← sup_iterate_eq_nfp]
  

Proof state:
f : Ordinal.{u} → Ordinal.{u}
a b : Ordinal.{u}
⊢ a < (fun a => sup fun n => f^[n] a) b ↔ ∃ n, a < f^[n] b

Next tactic:
exact lt_sup
theorem nfp_le_iff {a b} : nfp f a ≤ b ↔ ∀ n, f^[n] a ≤ b := by
  

Proof state:
f : Ordinal.{u} → Ordinal.{u}
a b : Ordinal.{u}
⊢ nfp f a ≤ b ↔ ∀ (n : ℕ), f^[n] a ≤ b

Next tactic:
rw [← sup_iterate_eq_nfp]
theorem nfp_le_iff {a b} : nfp f a ≤ b ↔ ∀ n, f^[n] a ≤ b := by
  rw [← sup_iterate_eq_nfp]
  

Proof state:
f : Ordinal.{u} → Ordinal.{u}
a b : Ordinal.{u}
⊢ (fun a => sup fun n => f^[n] a) a ≤ b ↔ ∀ (n : ℕ), f^[n] a ≤ b

Next tactic:
exact sup_le_iff
@[simp]
theorem nfp_id : nfp id = id :=
  funext fun a => by
    

Proof state:
f : Ordinal.{u} → Ordinal.{u}
a : Ordinal.{u_1}
⊢ nfp id a = id a

Next tactic:
simp_rw [← sup_iterate_eq_nfp, iterate_id]
@[simp]
theorem nfp_id : nfp id = id :=
  funext fun a => by
    simp_rw [← sup_iterate_eq_nfp, iterate_id]
    

Proof state:
f : Ordinal.{u} → Ordinal.{u}
a : Ordinal.{u_1}
⊢ (sup fun n => id a) = id a

Next tactic:
exact sup_const a
theorem IsNormal.apply_lt_nfp {f} (H : IsNormal f) {a b} : f b < nfp f a ↔ b < nfp f a := by
  

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
H : IsNormal f
a b : Ordinal.{u_1}
⊢ f b < nfp f a ↔ b < nfp f a

Next tactic:
unfold nfp
theorem IsNormal.apply_lt_nfp {f} (H : IsNormal f) {a b} : f b < nfp f a ↔ b < nfp f a := by
  unfold nfp
  

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
H : IsNormal f
a b : Ordinal.{u_1}
⊢ f b < nfpFamily (fun x => f) a ↔ b < nfpFamily (fun x => f) a

Next tactic:
rw [← @apply_lt_nfpFamily_iff Unit (fun _ => f) _ (fun _ => H) a b]
theorem IsNormal.apply_lt_nfp {f} (H : IsNormal f) {a b} : f b < nfp f a ↔ b < nfp f a := by
  unfold nfp
  rw [← @apply_lt_nfpFamily_iff Unit (fun _ => f) _ (fun _ => H) a b]
  

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
H : IsNormal f
a b : Ordinal.{u_1}
⊢ f b < nfpFamily (fun x => f) a ↔ Unit → f b < nfpFamily (fun x => f) a

Next tactic:
exact ⟨fun h _ => h, fun h => h Unit.unit⟩
theorem IsNormal.apply_le_nfp {f} (H : IsNormal f) {a b} : f b ≤ nfp f a ↔ b ≤ nfp f a :=
  ⟨le_trans (H.self_le _), fun h => by 

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
H : IsNormal f
a b : Ordinal.{u_1}
h : b ≤ nfp f a
⊢ f b ≤ nfp f a

Next tactic:
simpa only [H.nfp_fp] using H.le_iff.2 h
/-- The fixed point lemma for normal functions: any normal function has an unbounded set of
fixed points. -/
theorem fp_unbounded (H : IsNormal f) : (Function.fixedPoints f).Unbounded (· < ·) := by
  

Proof state:
f : Ordinal.{u} → Ordinal.{u}
H : IsNormal f
⊢ Set.Unbounded (fun x x_1 => x < x_1) (fixedPoints f)

Next tactic:
convert fp_family_unbounded fun _ : Unit => H
/-- The fixed point lemma for normal functions: any normal function has an unbounded set of
fixed points. -/
theorem fp_unbounded (H : IsNormal f) : (Function.fixedPoints f).Unbounded (· < ·) := by
  convert fp_family_unbounded fun _ : Unit => H
  

Proof state:
case h.e'_3
f : Ordinal.{u} → Ordinal.{u}
H : IsNormal f
⊢ fixedPoints f = ⋂ i, fixedPoints f

Next tactic:
exact (Set.iInter_const _).symm
theorem deriv_id_of_nfp_id {f : Ordinal → Ordinal} (h : nfp f = id) : deriv f = id :=
  ((deriv_isNormal _).eq_iff_zero_and_succ IsNormal.refl).2 (by 

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
h : nfp f = id
⊢ deriv f 0 = id 0 ∧ ∀ (a : Ordinal.{u_1}), deriv f a = id a → deriv f (succ a) = id (succ a)

Next tactic:
simp [h]
theorem IsNormal.le_iff_deriv {f} (H : IsNormal f) {a} : f a ≤ a ↔ ∃ o, deriv f o = a := by
  

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
H : IsNormal f
a : Ordinal.{u_1}
⊢ f a ≤ a ↔ ∃ o, deriv f o = a

Next tactic:
unfold deriv
theorem IsNormal.le_iff_deriv {f} (H : IsNormal f) {a} : f a ≤ a ↔ ∃ o, deriv f o = a := by
  unfold deriv
  

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
H : IsNormal f
a : Ordinal.{u_1}
⊢ f a ≤ a ↔ ∃ o, derivFamily (fun x => f) o = a

Next tactic:
rw [← le_iff_derivFamily fun _ : Unit => H]
theorem IsNormal.le_iff_deriv {f} (H : IsNormal f) {a} : f a ≤ a ↔ ∃ o, deriv f o = a := by
  unfold deriv
  rw [← le_iff_derivFamily fun _ : Unit => H]
  

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
H : IsNormal f
a : Ordinal.{u_1}
⊢ f a ≤ a ↔ Unit → f a ≤ a

Next tactic:
exact ⟨fun h _ => h, fun h => h Unit.unit⟩
theorem IsNormal.fp_iff_deriv {f} (H : IsNormal f) {a} : f a = a ↔ ∃ o, deriv f o = a := by
  

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
H : IsNormal f
a : Ordinal.{u_1}
⊢ f a = a ↔ ∃ o, deriv f o = a

Next tactic:
rw [← H.le_iff_eq, H.le_iff_deriv]
/-- `Ordinal.deriv` enumerates the fixed points of a normal function. -/
theorem deriv_eq_enumOrd (H : IsNormal f) : deriv f = enumOrd (Function.fixedPoints f) := by
  

Proof state:
f : Ordinal.{u} → Ordinal.{u}
H : IsNormal f
⊢ deriv f = enumOrd (fixedPoints f)

Next tactic:
convert derivFamily_eq_enumOrd fun _ : Unit => H
/-- `Ordinal.deriv` enumerates the fixed points of a normal function. -/
theorem deriv_eq_enumOrd (H : IsNormal f) : deriv f = enumOrd (Function.fixedPoints f) := by
  convert derivFamily_eq_enumOrd fun _ : Unit => H
  

Proof state:
case h.e'_3.h.e'_1
f : Ordinal.{u} → Ordinal.{u}
H : IsNormal f
⊢ fixedPoints f = ⋂ i, fixedPoints f

Next tactic:
exact (Set.iInter_const _).symm
theorem deriv_eq_id_of_nfp_eq_id {f : Ordinal → Ordinal} (h : nfp f = id) : deriv f = id :=
  (IsNormal.eq_iff_zero_and_succ (deriv_isNormal _) IsNormal.refl).2 <| by 

Proof state:
f✝ : Ordinal.{u} → Ordinal.{u}
f : Ordinal.{u_1} → Ordinal.{u_1}
h : nfp f = id
⊢ deriv f 0 = id 0 ∧ ∀ (a : Ordinal.{u_1}), deriv f a = id a → deriv f (succ a) = id (succ a)

Next tactic:
simp [h]
@[simp]
theorem nfp_add_zero (a) : nfp (a + ·) 0 = a * omega := by
  

Proof state:
a : Ordinal.{u_1}
⊢ nfp (fun x => a + x) 0 = a * ω

Next tactic:
simp_rw [← sup_iterate_eq_nfp, ← sup_mul_nat]
@[simp]
theorem nfp_add_zero (a) : nfp (a + ·) 0 = a * omega := by
  simp_rw [← sup_iterate_eq_nfp, ← sup_mul_nat]
  

Proof state:
a : Ordinal.{u_1}
⊢ (sup fun n => (fun x => a + x)^[n] 0) = sup fun n => a * ↑n

Next tactic:
congr
@[simp]
theorem nfp_add_zero (a) : nfp (a + ·) 0 = a * omega := by
  simp_rw [← sup_iterate_eq_nfp, ← sup_mul_nat]
  congr; 

Proof state:
case e_f
a : Ordinal.{u_1}
⊢ (fun n => (fun x => a + x)^[n] 0) = fun n => a * ↑n

Next tactic:
funext n
@[simp]
theorem nfp_add_zero (a) : nfp (a + ·) 0 = a * omega := by
  simp_rw [← sup_iterate_eq_nfp, ← sup_mul_nat]
  congr; funext n
  

Proof state:
case e_f.h
a : Ordinal.{u_1}
n : ℕ
⊢ (fun x => a + x)^[n] 0 = a * ↑n

Next tactic:
induction' n with n hn
@[simp]
theorem nfp_add_zero (a) : nfp (a + ·) 0 = a * omega := by
  simp_rw [← sup_iterate_eq_nfp, ← sup_mul_nat]
  congr; funext n
  induction' n with n hn
  · 

Proof state:
case e_f.h.zero
a : Ordinal.{u_1}
⊢ (fun x => a + x)^[Nat.zero] 0 = a * ↑Nat.zero

Next tactic:
rw [Nat.cast_zero, mul_zero, iterate_zero_apply]
@[simp]
theorem nfp_add_zero (a) : nfp (a + ·) 0 = a * omega := by
  simp_rw [← sup_iterate_eq_nfp, ← sup_mul_nat]
  congr; funext n
  induction' n with n hn
  · rw [Nat.cast_zero, mul_zero, iterate_zero_apply]
  · 

Proof state:
case e_f.h.succ
a : Ordinal.{u_1}
n : ℕ
hn : (fun x => a + x)^[n] 0 = a * ↑n
⊢ (fun x => a + x)^[Nat.succ n] 0 = a * ↑(Nat.succ n)

Next tactic:
nth_rw 2 [Nat.succ_eq_one_add]
@[simp]
theorem nfp_add_zero (a) : nfp (a + ·) 0 = a * omega := by
  simp_rw [← sup_iterate_eq_nfp, ← sup_mul_nat]
  congr; funext n
  induction' n with n hn
  · rw [Nat.cast_zero, mul_zero, iterate_zero_apply]
  · nth_rw 2 [Nat.succ_eq_one_add]
    

Proof state:
case e_f.h.succ
a : Ordinal.{u_1}
n : ℕ
hn : (fun x => a + x)^[n] 0 = a * ↑n
⊢ (fun x => a + x)^[Nat.succ n] 0 = a * ↑(1 + n)

Next tactic:
rw [Nat.cast_add, Nat.cast_one, mul_one_add, iterate_succ_apply', hn]
theorem nfp_add_eq_mul_omega {a b} (hba : b ≤ a * omega) : nfp (a + ·) b = a * omega := by
  

Proof state:
a b : Ordinal.{u_1}
hba : b ≤ a * ω
⊢ nfp (fun x => a + x) b = a * ω

Next tactic:
apply le_antisymm (nfp_le_fp (add_isNormal a).monotone hba _)
theorem nfp_add_eq_mul_omega {a b} (hba : b ≤ a * omega) : nfp (a + ·) b = a * omega := by
  apply le_antisymm (nfp_le_fp (add_isNormal a).monotone hba _)
  · 

Proof state:
a b : Ordinal.{u_1}
hba : b ≤ a * ω
⊢ a * ω ≤ nfp (fun x => a + x) b

Next tactic:
rw [← nfp_add_zero]
theorem nfp_add_eq_mul_omega {a b} (hba : b ≤ a * omega) : nfp (a + ·) b = a * omega := by
  apply le_antisymm (nfp_le_fp (add_isNormal a).monotone hba _)
  · rw [← nfp_add_zero]
    

Proof state:
a b : Ordinal.{u_1}
hba : b ≤ a * ω
⊢ nfp (fun x => a + x) 0 ≤ nfp (fun x => a + x) b

Next tactic:
exact nfp_monotone (add_isNormal a).monotone (Ordinal.zero_le b)
theorem nfp_add_eq_mul_omega {a b} (hba : b ≤ a * omega) : nfp (a + ·) b = a * omega := by
  apply le_antisymm (nfp_le_fp (add_isNormal a).monotone hba _)
  · rw [← nfp_add_zero]
    exact nfp_monotone (add_isNormal a).monotone (Ordinal.zero_le b)
  · 

Proof state:
a b : Ordinal.{u_1}
hba : b ≤ a * ω
⊢ a + a * ω ≤ a * ω

Next tactic:
dsimp
theorem nfp_add_eq_mul_omega {a b} (hba : b ≤ a * omega) : nfp (a + ·) b = a * omega := by
  apply le_antisymm (nfp_le_fp (add_isNormal a).monotone hba _)
  · rw [← nfp_add_zero]
    exact nfp_monotone (add_isNormal a).monotone (Ordinal.zero_le b)
  · dsimp; 

Proof state:
a b : Ordinal.{u_1}
hba : b ≤ a * ω
⊢ a + a * ω ≤ a * ω

Next tactic:
rw [← mul_one_add, one_add_omega]
theorem add_eq_right_iff_mul_omega_le {a b : Ordinal} : a + b = b ↔ a * omega ≤ b := by
  

Proof state:
a b : Ordinal.{u_1}
⊢ a + b = b ↔ a * ω ≤ b

Next tactic:
refine' ⟨fun h => _, fun h => _⟩
theorem add_eq_right_iff_mul_omega_le {a b : Ordinal} : a + b = b ↔ a * omega ≤ b := by
  refine' ⟨fun h => _, fun h => _⟩
  · 

Proof state:
case refine'_1
a b : Ordinal.{u_1}
h : a + b = b
⊢ a * ω ≤ b

Next tactic:
rw [← nfp_add_zero a, ← deriv_zero]