l3lab/ntp-mathlib huggingface dataset:
theorem smaller_mono {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂) : smaller C o₁ ⊆ smaller C o₂ := by
  rintro f ⟨g, hg, rfl⟩
  simp only [smaller, Set.mem_image]
  use πs' C h g
  obtain ⟨⟨l, gl⟩, rfl⟩ := hg
  refine ⟨?_, ?_⟩
  · use ⟨l, Products.isGood_mono C h gl⟩
    ext x
    rw [eval, ← Products.eval_πs' _ h (Products.prop_of_isGood  C _ gl), eval]
  · 

Proof state:
case h.intro.mk.refine_2
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o₁ o₂ : Ordinal.{u}
h : o₁ ≤ o₂
l : Products I
gl : Products.isGood (π C fun x => ord I x < o₁) l
⊢ (πs C o₂) ((πs' C h) (eval (π C fun x => ord I x < o₁) { val := l, property := gl })) =
    (πs C o₁) (eval (π C fun x => ord I x < o₁) { val := l, property := gl })

Next tactic:
rw [← LocallyConstant.coe_inj, coe_πs C o₂, ← LocallyConstant.toFun_eq_coe, coe_πs',
      Function.comp.assoc, projRestricts_comp_projRestrict C _, coe_πs]
theorem smaller_mono {o₁ o₂ : Ordinal} (h : o₁ ≤ o₂) : smaller C o₁ ⊆ smaller C o₂ := by
  rintro f ⟨g, hg, rfl⟩
  simp only [smaller, Set.mem_image]
  use πs' C h g
  obtain ⟨⟨l, gl⟩, rfl⟩ := hg
  refine ⟨?_, ?_⟩
  · use ⟨l, Products.isGood_mono C h gl⟩
    ext x
    rw [eval, ← Products.eval_πs' _ h (Products.prop_of_isGood  C _ gl), eval]
  · rw [← LocallyConstant.coe_inj, coe_πs C o₂, ← LocallyConstant.toFun_eq_coe, coe_πs',
      Function.comp.assoc, projRestricts_comp_projRestrict C _, coe_πs]
    

Proof state:
case h.intro.mk.refine_2
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o₁ o₂ : Ordinal.{u}
h : o₁ ≤ o₂
l : Products I
gl : Products.isGood (π C fun x => ord I x < o₁) l
⊢ ((eval (π C fun x => ord I x < o₁) { val := l, property := gl }).toFun ∘ ProjRestrict C fun x => ord I x < o₁) =
    ⇑(eval (π C fun x => ord I x < o₁) { val := l, property := gl }) ∘ ProjRestrict C fun x => ord I x < o₁

Next tactic:
rfl
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  

Proof state:
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
⊢ isGood (π C fun x => ord I x < o) l ↔ ∃ o' < o, isGood (π C fun x => ord I x < o') l

Next tactic:
refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  

Proof state:
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
⊢ ∃ o' < o, isGood (π C fun x => ord I x < o') l

Next tactic:
use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  

Proof state:
case h
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
⊢ (Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) < o ∧
    isGood (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) l

Next tactic:
have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  have ha : ⊥ < o := by 

Proof state:
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
⊢ ⊥ < o

Next tactic:
rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; 

Proof state:
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
⊢ o ≠ 0

Next tactic:
exact ho.1
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
  

Proof state:
case h
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
ha : ⊥ < o
⊢ (Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) < o ∧
    isGood (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) l

Next tactic:
have hslt : Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) < o
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
  have hslt : Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) < o
  · 

Proof state:
case hslt
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
ha : ⊥ < o
⊢ (Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) < o

Next tactic:
simp only [Finset.sup_lt_iff ha, List.mem_toFinset]
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
  have hslt : Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) < o
  · simp only [Finset.sup_lt_iff ha, List.mem_toFinset]
    

Proof state:
case hslt
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
ha : ⊥ < o
⊢ ∀ b ∈ ↑l, Order.succ (ord I b) < o

Next tactic:
exact fun b hb ↦ ho.2 _ (prop_of_isGood C (ord I · < o) h b hb)
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
  have hslt : Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) < o
  · simp only [Finset.sup_lt_iff ha, List.mem_toFinset]
    exact fun b hb ↦ ho.2 _ (prop_of_isGood C (ord I · < o) h b hb)
  

Proof state:
case h
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
ha : ⊥ < o
hslt : (Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) < o
⊢ (Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) < o ∧
    isGood (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) l

Next tactic:
refine ⟨hslt, fun he ↦ h ?_⟩
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
  have hslt : Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) < o
  · simp only [Finset.sup_lt_iff ha, List.mem_toFinset]
    exact fun b hb ↦ ho.2 _ (prop_of_isGood C (ord I · < o) h b hb)
  refine ⟨hslt, fun he ↦ h ?_⟩
  

Proof state:
case h
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
ha : ⊥ < o
hslt : (Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) < o
he :
  eval (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) l ∈
    Submodule.span ℤ
      (eval (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) '' {m | m < l})
⊢ eval (π C fun x => ord I x < o) l ∈ Submodule.span ℤ (eval (π C fun x => ord I x < o) '' {m | m < l})

Next tactic:
have hlt : ∀ i ∈ l.val, ord I i < Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
  have hslt : Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) < o
  · simp only [Finset.sup_lt_iff ha, List.mem_toFinset]
    exact fun b hb ↦ ho.2 _ (prop_of_isGood C (ord I · < o) h b hb)
  refine ⟨hslt, fun he ↦ h ?_⟩
  have hlt : ∀ i ∈ l.val, ord I i < Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  · 

Proof state:
case hlt
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
ha : ⊥ < o
hslt : (Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) < o
he :
  eval (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) l ∈
    Submodule.span ℤ
      (eval (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) '' {m | m < l})
⊢ ∀ i ∈ ↑l, ord I i < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)

Next tactic:
intro i hi
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
  have hslt : Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) < o
  · simp only [Finset.sup_lt_iff ha, List.mem_toFinset]
    exact fun b hb ↦ ho.2 _ (prop_of_isGood C (ord I · < o) h b hb)
  refine ⟨hslt, fun he ↦ h ?_⟩
  have hlt : ∀ i ∈ l.val, ord I i < Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  · intro i hi
    

Proof state:
case hlt
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
ha : ⊥ < o
hslt : (Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) < o
he :
  eval (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) l ∈
    Submodule.span ℤ
      (eval (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) '' {m | m < l})
i : I
hi : i ∈ ↑l
⊢ ord I i < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)

Next tactic:
simp only [Finset.lt_sup_iff, List.mem_toFinset, Order.lt_succ_iff]
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
  have hslt : Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) < o
  · simp only [Finset.sup_lt_iff ha, List.mem_toFinset]
    exact fun b hb ↦ ho.2 _ (prop_of_isGood C (ord I · < o) h b hb)
  refine ⟨hslt, fun he ↦ h ?_⟩
  have hlt : ∀ i ∈ l.val, ord I i < Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  · intro i hi
    simp only [Finset.lt_sup_iff, List.mem_toFinset, Order.lt_succ_iff]
    

Proof state:
case hlt
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
ha : ⊥ < o
hslt : (Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) < o
he :
  eval (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) l ∈
    Submodule.span ℤ
      (eval (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) '' {m | m < l})
i : I
hi : i ∈ ↑l
⊢ ∃ b ∈ ↑l, ord I i ≤ ord I b

Next tactic:
exact ⟨i, hi, le_rfl⟩
theorem Products.limitOrdinal (l : Products I) : l.isGood (π C (ord I · < o)) ↔
    ∃ (o' : Ordinal), o' < o ∧ l.isGood (π C (ord I · < o')) := by
  refine ⟨fun h ↦ ?_, fun ⟨o', ⟨ho', hl⟩⟩ ↦ isGood_mono C (le_of_lt ho') hl⟩
  use Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  have ha : ⊥ < o := by rw [Ordinal.bot_eq_zero, Ordinal.pos_iff_ne_zero]; exact ho.1
  have hslt : Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a)) < o
  · simp only [Finset.sup_lt_iff ha, List.mem_toFinset]
    exact fun b hb ↦ ho.2 _ (prop_of_isGood C (ord I · < o) h b hb)
  refine ⟨hslt, fun he ↦ h ?_⟩
  have hlt : ∀ i ∈ l.val, ord I i < Finset.sup l.val.toFinset (fun a ↦ Order.succ (ord I a))
  · intro i hi
    simp only [Finset.lt_sup_iff, List.mem_toFinset, Order.lt_succ_iff]
    exact ⟨i, hi, le_rfl⟩
  

Proof state:
case h
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
h : isGood (π C fun x => ord I x < o) l
ha : ⊥ < o
hslt : (Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) < o
he :
  eval (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) l ∈
    Submodule.span ℤ
      (eval (π C fun x => ord I x < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)) '' {m | m < l})
hlt : ∀ i ∈ ↑l, ord I i < Finset.sup (List.toFinset ↑l) fun a => Order.succ (ord I a)
⊢ eval (π C fun x => ord I x < o) l ∈ Submodule.span ℤ (eval (π C fun x => ord I x < o) '' {m | m < l})

Next tactic:
rwa [eval_πs_image' C (le_of_lt hslt) hlt, ← eval_πs' C (le_of_lt hslt) hlt,
    Submodule.apply_mem_span_image_iff_mem_span (injective_πs' C _)]
theorem GoodProducts.union : range C = ⋃ (e : {o' // o' < o}), (smaller C e.val) := by
  

Proof state:
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
⊢ range C = ⋃ e, smaller C ↑e

Next tactic:
ext p
theorem GoodProducts.union : range C = ⋃ (e : {o' // o' < o}), (smaller C e.val) := by
  ext p
  

Proof state:
case h
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
p : LocallyConstant ↑C ℤ
⊢ p ∈ range C ↔ p ∈ ⋃ e, smaller C ↑e

Next tactic:
simp only [smaller, range, Set.mem_iUnion, Set.mem_image, Set.mem_range, Subtype.exists]
theorem GoodProducts.union : range C = ⋃ (e : {o' // o' < o}), (smaller C e.val) := by
  ext p
  simp only [smaller, range, Set.mem_iUnion, Set.mem_image, Set.mem_range, Subtype.exists]
  

Proof state:
case h
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
p : LocallyConstant ↑C ℤ
⊢ (∃ a, ∃ (b : Products.isGood C a), eval C { val := a, property := b } = p) ↔
    ∃ a,
      ∃ (h : a < o),
        ∃ x,
          (∃ a_1,
              ∃ (h_1 : Products.isGood (π C fun x => ord I x < a) a_1),
                eval (π C fun x => ord I x < a)
                    { val := a_1,
                      property :=
                        (_ : Products.isGood (π C fun x => ord I x < ↑{ val := a, property := (_ : a < o) }) a_1) } =
                  x) ∧
            (πs C a) x = p

Next tactic:
refine ⟨fun hp ↦ ?_, fun hp ↦ ?_⟩
theorem GoodProducts.union : range C = ⋃ (e : {o' // o' < o}), (smaller C e.val) := by
  ext p
  simp only [smaller, range, Set.mem_iUnion, Set.mem_image, Set.mem_range, Subtype.exists]
  refine ⟨fun hp ↦ ?_, fun hp ↦ ?_⟩
  · 

Proof state:
case h.refine_1
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
p : LocallyConstant ↑C ℤ
hp : ∃ a, ∃ (b : Products.isGood C a), eval C { val := a, property := b } = p
⊢ ∃ a,
    ∃ (h : a < o),
      ∃ x,
        (∃ a_1,
            ∃ (h_1 : Products.isGood (π C fun x => ord I x < a) a_1),
              eval (π C fun x => ord I x < a)
                  { val := a_1,
                    property :=
                      (_ : Products.isGood (π C fun x => ord I x < ↑{ val := a, property := (_ : a < o) }) a_1) } =
                x) ∧
          (πs C a) x = p

Next tactic:
obtain ⟨l, hl, rfl⟩ := hp
theorem GoodProducts.union : range C = ⋃ (e : {o' // o' < o}), (smaller C e.val) := by
  ext p
  simp only [smaller, range, Set.mem_iUnion, Set.mem_image, Set.mem_range, Subtype.exists]
  refine ⟨fun hp ↦ ?_, fun hp ↦ ?_⟩
  · obtain ⟨l, hl, rfl⟩ := hp
    

Proof state:
case h.refine_1.intro.intro
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
hl : Products.isGood C l
⊢ ∃ a,
    ∃ (h : a < o),
      ∃ x,
        (∃ a_1,
            ∃ (h_1 : Products.isGood (π C fun x => ord I x < a) a_1),
              eval (π C fun x => ord I x < a)
                  { val := a_1,
                    property :=
                      (_ : Products.isGood (π C fun x => ord I x < ↑{ val := a, property := (_ : a < o) }) a_1) } =
                x) ∧
          (πs C a) x = eval C { val := l, property := hl }

Next tactic:
rw [contained_eq_proj C o hsC, Products.limitOrdinal C ho] at hl
theorem GoodProducts.union : range C = ⋃ (e : {o' // o' < o}), (smaller C e.val) := by
  ext p
  simp only [smaller, range, Set.mem_iUnion, Set.mem_image, Set.mem_range, Subtype.exists]
  refine ⟨fun hp ↦ ?_, fun hp ↦ ?_⟩
  · obtain ⟨l, hl, rfl⟩ := hp
    rw [contained_eq_proj C o hsC, Products.limitOrdinal C ho] at hl
    

Proof state:
case h.refine_1.intro.intro
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
hl✝ : Products.isGood C l
hl : ∃ o' < o, Products.isGood (π C fun x => ord I x < o') l
⊢ ∃ a,
    ∃ (h : a < o),
      ∃ x,
        (∃ a_1,
            ∃ (h_1 : Products.isGood (π C fun x => ord I x < a) a_1),
              eval (π C fun x => ord I x < a)
                  { val := a_1,
                    property :=
                      (_ : Products.isGood (π C fun x => ord I x < ↑{ val := a, property := (_ : a < o) }) a_1) } =
                x) ∧
          (πs C a) x = eval C { val := l, property := hl✝ }

Next tactic:
obtain ⟨o', ho'⟩ := hl
theorem GoodProducts.union : range C = ⋃ (e : {o' // o' < o}), (smaller C e.val) := by
  ext p
  simp only [smaller, range, Set.mem_iUnion, Set.mem_image, Set.mem_range, Subtype.exists]
  refine ⟨fun hp ↦ ?_, fun hp ↦ ?_⟩
  · obtain ⟨l, hl, rfl⟩ := hp
    rw [contained_eq_proj C o hsC, Products.limitOrdinal C ho] at hl
    obtain ⟨o', ho'⟩ := hl
    

Proof state:
case h.refine_1.intro.intro.intro
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
hl : Products.isGood C l
o' : Ordinal.{u}
ho' : o' < o ∧ Products.isGood (π C fun x => ord I x < o') l
⊢ ∃ a,
    ∃ (h : a < o),
      ∃ x,
        (∃ a_1,
            ∃ (h_1 : Products.isGood (π C fun x => ord I x < a) a_1),
              eval (π C fun x => ord I x < a)
                  { val := a_1,
                    property :=
                      (_ : Products.isGood (π C fun x => ord I x < ↑{ val := a, property := (_ : a < o) }) a_1) } =
                x) ∧
          (πs C a) x = eval C { val := l, property := hl }

Next tactic:
refine ⟨o', ho'.1, eval (π C (ord I · < o')) ⟨l, ho'.2⟩, ⟨l, ho'.2, rfl⟩, ?_⟩
theorem GoodProducts.union : range C = ⋃ (e : {o' // o' < o}), (smaller C e.val) := by
  ext p
  simp only [smaller, range, Set.mem_iUnion, Set.mem_image, Set.mem_range, Subtype.exists]
  refine ⟨fun hp ↦ ?_, fun hp ↦ ?_⟩
  · obtain ⟨l, hl, rfl⟩ := hp
    rw [contained_eq_proj C o hsC, Products.limitOrdinal C ho] at hl
    obtain ⟨o', ho'⟩ := hl
    refine ⟨o', ho'.1, eval (π C (ord I · < o')) ⟨l, ho'.2⟩, ⟨l, ho'.2, rfl⟩, ?_⟩
    

Proof state:
case h.refine_1.intro.intro.intro
I : Type u
inst✝² : Inhabited I
inst✝¹ : LinearOrder I
inst✝ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
o : Ordinal.{u}
ho : Ordinal.IsLimit o
hsC : contained C o
l : Products I
hl : Products.isGood C l
o' : Ordinal.{u}
ho' : o' < o ∧ Products.isGood (π C fun x => ord I x < o') l
⊢ (πs C o')
      (eval (π C fun x => ord I x < o') { val := l, property := (_ : Products.isGood (π C fun x => ord I x < o') l) }) =
    eval C { val := l, property := hl }

Next tactic:
exact Products.eval_πs C (Products.prop_of_isGood  C _ ho'.2)