l3lab/ntp-mathlib huggingface dataset:
/-- If `C` is a preadditive category and `X` is an augmented simplicial object
in `C` that has an extra degeneracy, then the augmentation on the alternating
face map complex of `X` is a homotopy equivalence. -/
noncomputable def homotopyEquiv {C : Type*} [Category C] [Preadditive C] [HasZeroObject C]
    {X : SimplicialObject.Augmented C} (ed : ExtraDegeneracy X) :
    HomotopyEquiv (AlgebraicTopology.AlternatingFaceMapComplex.obj (drop.obj X))
      ((ChainComplex.single₀ C).obj (point.obj X)) where
  hom := AlternatingFaceMapComplex.ε.app X
  inv := (ChainComplex.fromSingle₀Equiv _ _).symm (by exact ed.s')
  homotopyInvHomId := Homotopy.ofEq (by
    ext
    dsimp
    erw [AlternatingFaceMapComplex.ε_app_f_zero,
      ChainComplex.fromSingle₀Equiv_symm_apply_f_zero, s'_comp_ε]
    rfl)
  homotopyHomInvId :=
    { hom := fun i j => by
        by_cases i + 1 = j
        · exact (-ed.s i) ≫ eqToHom (by congr)
        · exact 0
      zero := fun i j hij => by
        dsimp
        split_ifs with h
        · exfalso
          exact hij h
        · simp only [eq_self_iff_true]
      comm := fun i => by
        rcases i with _|i
        · rw [Homotopy.prevD_chainComplex, Homotopy.dNext_zero_chainComplex, zero_add]
          dsimp
          erw [ChainComplex.fromSingle₀Equiv_symm_apply_f_zero]
          simp only [comp_id, ite_true, zero_add, ComplexShape.down_Rel, not_true,
            AlternatingFaceMapComplex.obj_d_eq, Preadditive.neg_comp]
          rw [Fin.sum_univ_two]
          simp only [Fin.val_zero, pow_zero, one_smul, Fin.val_one, pow_one, neg_smul,
            Preadditive.comp_add, s_comp_δ₀, drop_obj, Preadditive.comp_neg, neg_add_rev,
            neg_neg, neg_add_cancel_right, s₀_comp_δ₁,
            AlternatingFaceMapComplex.ε_app_f_zero]
        · 

Proof state:
case succ
C : Type u_1
inst✝² : Category.{?u.354777, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasZeroObject C
X : SimplicialObject.Augmented C
ed : ExtraDegeneracy X
i : ℕ
⊢ HomologicalComplex.Hom.f
      (AlternatingFaceMapComplex.ε.app X ≫
        (ChainComplex.fromSingle₀Equiv (AlternatingFaceMapComplex.obj (drop.obj X)) (point.obj X)).symm ed.s')
      (Nat.succ i) =
    (((dNext (Nat.succ i)) fun i j =>
          if h : i + 1 = j then (-s ed i) ≫ eqToHom (_ : (drop.obj X).obj (op [i + 1]) = (drop.obj X).obj (op [j]))
          else 0) +
        (prevD (Nat.succ i)) fun i j =>
          if h : i + 1 = j then (-s ed i) ≫ eqToHom (_ : (drop.obj X).obj (op [i + 1]) = (drop.obj X).obj (op [j]))
          else 0) +
      HomologicalComplex.Hom.f (𝟙 (AlternatingFaceMapComplex.obj (drop.obj X))) (Nat.succ i)

Next tactic:
rw [Homotopy.prevD_chainComplex, Homotopy.dNext_succ_chainComplex]
/-- If `C` is a preadditive category and `X` is an augmented simplicial object
in `C` that has an extra degeneracy, then the augmentation on the alternating
face map complex of `X` is a homotopy equivalence. -/
noncomputable def homotopyEquiv {C : Type*} [Category C] [Preadditive C] [HasZeroObject C]
    {X : SimplicialObject.Augmented C} (ed : ExtraDegeneracy X) :
    HomotopyEquiv (AlgebraicTopology.AlternatingFaceMapComplex.obj (drop.obj X))
      ((ChainComplex.single₀ C).obj (point.obj X)) where
  hom := AlternatingFaceMapComplex.ε.app X
  inv := (ChainComplex.fromSingle₀Equiv _ _).symm (by exact ed.s')
  homotopyInvHomId := Homotopy.ofEq (by
    ext
    dsimp
    erw [AlternatingFaceMapComplex.ε_app_f_zero,
      ChainComplex.fromSingle₀Equiv_symm_apply_f_zero, s'_comp_ε]
    rfl)
  homotopyHomInvId :=
    { hom := fun i j => by
        by_cases i + 1 = j
        · exact (-ed.s i) ≫ eqToHom (by congr)
        · exact 0
      zero := fun i j hij => by
        dsimp
        split_ifs with h
        · exfalso
          exact hij h
        · simp only [eq_self_iff_true]
      comm := fun i => by
        rcases i with _|i
        · rw [Homotopy.prevD_chainComplex, Homotopy.dNext_zero_chainComplex, zero_add]
          dsimp
          erw [ChainComplex.fromSingle₀Equiv_symm_apply_f_zero]
          simp only [comp_id, ite_true, zero_add, ComplexShape.down_Rel, not_true,
            AlternatingFaceMapComplex.obj_d_eq, Preadditive.neg_comp]
          rw [Fin.sum_univ_two]
          simp only [Fin.val_zero, pow_zero, one_smul, Fin.val_one, pow_one, neg_smul,
            Preadditive.comp_add, s_comp_δ₀, drop_obj, Preadditive.comp_neg, neg_add_rev,
            neg_neg, neg_add_cancel_right, s₀_comp_δ₁,
            AlternatingFaceMapComplex.ε_app_f_zero]
        · rw [Homotopy.prevD_chainComplex, Homotopy.dNext_succ_chainComplex]
          

Proof state:
case succ
C : Type u_1
inst✝² : Category.{?u.354777, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasZeroObject C
X : SimplicialObject.Augmented C
ed : ExtraDegeneracy X
i : ℕ
⊢ HomologicalComplex.Hom.f
      (AlternatingFaceMapComplex.ε.app X ≫
        (ChainComplex.fromSingle₀Equiv (AlternatingFaceMapComplex.obj (drop.obj X)) (point.obj X)).symm ed.s')
      (Nat.succ i) =
    (HomologicalComplex.d (AlternatingFaceMapComplex.obj (drop.obj X)) (i + 1) i ≫
          if h : i + 1 = i + 1 then
            (-s ed i) ≫ eqToHom (_ : (drop.obj X).obj (op [i + 1]) = (drop.obj X).obj (op [i + 1]))
          else 0) +
        (if h : Nat.succ i + 1 = Nat.succ i + 1 then
            (-s ed (Nat.succ i)) ≫
              eqToHom (_ : (drop.obj X).obj (op [Nat.succ i + 1]) = (drop.obj X).obj (op [Nat.succ i + 1]))
          else 0) ≫
          HomologicalComplex.d (AlternatingFaceMapComplex.obj (drop.obj X)) (Nat.succ i + 1) (Nat.succ i) +
      HomologicalComplex.Hom.f (𝟙 (AlternatingFaceMapComplex.obj (drop.obj X))) (Nat.succ i)

Next tactic:
dsimp
/-- If `C` is a preadditive category and `X` is an augmented simplicial object
in `C` that has an extra degeneracy, then the augmentation on the alternating
face map complex of `X` is a homotopy equivalence. -/
noncomputable def homotopyEquiv {C : Type*} [Category C] [Preadditive C] [HasZeroObject C]
    {X : SimplicialObject.Augmented C} (ed : ExtraDegeneracy X) :
    HomotopyEquiv (AlgebraicTopology.AlternatingFaceMapComplex.obj (drop.obj X))
      ((ChainComplex.single₀ C).obj (point.obj X)) where
  hom := AlternatingFaceMapComplex.ε.app X
  inv := (ChainComplex.fromSingle₀Equiv _ _).symm (by exact ed.s')
  homotopyInvHomId := Homotopy.ofEq (by
    ext
    dsimp
    erw [AlternatingFaceMapComplex.ε_app_f_zero,
      ChainComplex.fromSingle₀Equiv_symm_apply_f_zero, s'_comp_ε]
    rfl)
  homotopyHomInvId :=
    { hom := fun i j => by
        by_cases i + 1 = j
        · exact (-ed.s i) ≫ eqToHom (by congr)
        · exact 0
      zero := fun i j hij => by
        dsimp
        split_ifs with h
        · exfalso
          exact hij h
        · simp only [eq_self_iff_true]
      comm := fun i => by
        rcases i with _|i
        · rw [Homotopy.prevD_chainComplex, Homotopy.dNext_zero_chainComplex, zero_add]
          dsimp
          erw [ChainComplex.fromSingle₀Equiv_symm_apply_f_zero]
          simp only [comp_id, ite_true, zero_add, ComplexShape.down_Rel, not_true,
            AlternatingFaceMapComplex.obj_d_eq, Preadditive.neg_comp]
          rw [Fin.sum_univ_two]
          simp only [Fin.val_zero, pow_zero, one_smul, Fin.val_one, pow_one, neg_smul,
            Preadditive.comp_add, s_comp_δ₀, drop_obj, Preadditive.comp_neg, neg_add_rev,
            neg_neg, neg_add_cancel_right, s₀_comp_δ₁,
            AlternatingFaceMapComplex.ε_app_f_zero]
        · rw [Homotopy.prevD_chainComplex, Homotopy.dNext_succ_chainComplex]
          dsimp
          

Proof state:
case succ
C : Type u_1
inst✝² : Category.{?u.354777, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasZeroObject C
X : SimplicialObject.Augmented C
ed : ExtraDegeneracy X
i : ℕ
⊢ 0 ≫
      HomologicalComplex.Hom.f
        ((ChainComplex.fromSingle₀Equiv (AlternatingFaceMapComplex.obj X.left) X.right).symm ed.s') (Nat.succ i) =
    (HomologicalComplex.d (AlternatingFaceMapComplex.obj X.left) (i + 1) i ≫
          if i + 1 = i + 1 then (-s ed i) ≫ 𝟙 (X.left.obj (op [i + 1])) else 0) +
        (if Nat.succ i + 1 = Nat.succ i + 1 then (-s ed (Nat.succ i)) ≫ 𝟙 (X.left.obj (op [Nat.succ i + 1])) else 0) ≫
          HomologicalComplex.d (AlternatingFaceMapComplex.obj X.left) (Nat.succ i + 1) (Nat.succ i) +
      𝟙 (X.left.obj (op [Nat.succ i]))

Next tactic:
simp only [Preadditive.neg_comp,
            AlternatingFaceMapComplex.obj_d_eq, comp_id, ite_true, Preadditive.comp_neg,
            @Fin.sum_univ_succ _ _ (i + 2), Fin.val_zero, pow_zero, one_smul, Fin.val_succ,
            Preadditive.comp_add, drop_obj, s_comp_δ₀, Preadditive.sum_comp,
            Preadditive.zsmul_comp, Preadditive.comp_sum, Preadditive.comp_zsmul,
            zsmul_neg, s_comp_δ, pow_add, pow_one, mul_neg, mul_one, neg_zsmul, neg_neg,
            neg_add_cancel_comm_assoc, add_left_neg, zero_comp]
/-- If `C` is a preadditive category and `X` is an augmented simplicial object
in `C` that has an extra degeneracy, then the augmentation on the alternating
face map complex of `X` is a homotopy equivalence. -/
noncomputable def homotopyEquiv {C : Type*} [Category C] [Preadditive C] [HasZeroObject C]
    {X : SimplicialObject.Augmented C} (ed : ExtraDegeneracy X) :
    HomotopyEquiv (AlgebraicTopology.AlternatingFaceMapComplex.obj (drop.obj X))
      ((ChainComplex.single₀ C).obj (point.obj X)) where
  hom := AlternatingFaceMapComplex.ε.app X
  inv := (ChainComplex.fromSingle₀Equiv _ _).symm (by exact ed.s')
  homotopyInvHomId := Homotopy.ofEq (by
    

Proof state:
C : Type u_1
inst✝² : Category.{?u.354777, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasZeroObject C
X : SimplicialObject.Augmented C
ed : ExtraDegeneracy X
⊢ (ChainComplex.fromSingle₀Equiv (AlternatingFaceMapComplex.obj (drop.obj X)) (point.obj X)).symm ed.s' ≫
      AlternatingFaceMapComplex.ε.app X =
    𝟙 ((ChainComplex.single₀ C).obj (point.obj X))

Next tactic:
ext
/-- If `C` is a preadditive category and `X` is an augmented simplicial object
in `C` that has an extra degeneracy, then the augmentation on the alternating
face map complex of `X` is a homotopy equivalence. -/
noncomputable def homotopyEquiv {C : Type*} [Category C] [Preadditive C] [HasZeroObject C]
    {X : SimplicialObject.Augmented C} (ed : ExtraDegeneracy X) :
    HomotopyEquiv (AlgebraicTopology.AlternatingFaceMapComplex.obj (drop.obj X))
      ((ChainComplex.single₀ C).obj (point.obj X)) where
  hom := AlternatingFaceMapComplex.ε.app X
  inv := (ChainComplex.fromSingle₀Equiv _ _).symm (by exact ed.s')
  homotopyInvHomId := Homotopy.ofEq (by
    ext
    

Proof state:
case hfg
C : Type u_1
inst✝² : Category.{?u.354777, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasZeroObject C
X : SimplicialObject.Augmented C
ed : ExtraDegeneracy X
⊢ HomologicalComplex.Hom.f
      ((ChainComplex.fromSingle₀Equiv (AlternatingFaceMapComplex.obj (drop.obj X)) (point.obj X)).symm ed.s' ≫
        AlternatingFaceMapComplex.ε.app X)
      0 =
    HomologicalComplex.Hom.f (𝟙 ((ChainComplex.single₀ C).obj (point.obj X))) 0

Next tactic:
dsimp
/-- If `C` is a preadditive category and `X` is an augmented simplicial object
in `C` that has an extra degeneracy, then the augmentation on the alternating
face map complex of `X` is a homotopy equivalence. -/
noncomputable def homotopyEquiv {C : Type*} [Category C] [Preadditive C] [HasZeroObject C]
    {X : SimplicialObject.Augmented C} (ed : ExtraDegeneracy X) :
    HomotopyEquiv (AlgebraicTopology.AlternatingFaceMapComplex.obj (drop.obj X))
      ((ChainComplex.single₀ C).obj (point.obj X)) where
  hom := AlternatingFaceMapComplex.ε.app X
  inv := (ChainComplex.fromSingle₀Equiv _ _).symm (by exact ed.s')
  homotopyInvHomId := Homotopy.ofEq (by
    ext
    dsimp
    

Proof state:
case hfg
C : Type u_1
inst✝² : Category.{?u.354777, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasZeroObject C
X : SimplicialObject.Augmented C
ed : ExtraDegeneracy X
⊢ HomologicalComplex.Hom.f ((ChainComplex.fromSingle₀Equiv (AlternatingFaceMapComplex.obj X.left) X.right).symm ed.s')
        0 ≫
      HomologicalComplex.Hom.f (AlternatingFaceMapComplex.ε.app X) 0 =
    𝟙 X.right

Next tactic:
erw [AlternatingFaceMapComplex.ε_app_f_zero,
      ChainComplex.fromSingle₀Equiv_symm_apply_f_zero, s'_comp_ε]
/-- If `C` is a preadditive category and `X` is an augmented simplicial object
in `C` that has an extra degeneracy, then the augmentation on the alternating
face map complex of `X` is a homotopy equivalence. -/
noncomputable def homotopyEquiv {C : Type*} [Category C] [Preadditive C] [HasZeroObject C]
    {X : SimplicialObject.Augmented C} (ed : ExtraDegeneracy X) :
    HomotopyEquiv (AlgebraicTopology.AlternatingFaceMapComplex.obj (drop.obj X))
      ((ChainComplex.single₀ C).obj (point.obj X)) where
  hom := AlternatingFaceMapComplex.ε.app X
  inv := (ChainComplex.fromSingle₀Equiv _ _).symm (by exact ed.s')
  homotopyInvHomId := Homotopy.ofEq (by
    ext
    dsimp
    erw [AlternatingFaceMapComplex.ε_app_f_zero,
      ChainComplex.fromSingle₀Equiv_symm_apply_f_zero, s'_comp_ε]
    

Proof state:
case hfg
C : Type u_1
inst✝² : Category.{?u.354777, u_1} C
inst✝¹ : Preadditive C
inst✝ : HasZeroObject C
X : SimplicialObject.Augmented C
ed : ExtraDegeneracy X
⊢ 𝟙 (point.obj X) = 𝟙 X.right

Next tactic:
rfl
theorem find_mem {c : Set (PartialRefinement u s)} (i : ι) (ne : c.Nonempty) : find c ne i ∈ c := by
  

Proof state:
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
i : ι
ne : Set.Nonempty c
⊢ find c ne i ∈ c

Next tactic:
rw [find]
theorem find_mem {c : Set (PartialRefinement u s)} (i : ι) (ne : c.Nonempty) : find c ne i ∈ c := by
  rw [find]
  

Proof state:
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
i : ι
ne : Set.Nonempty c
⊢ (if hi : ∃ v ∈ c, i ∈ v.carrier then Exists.choose hi else Set.Nonempty.some ne) ∈ c

Next tactic:
split_ifs with h
theorem find_mem {c : Set (PartialRefinement u s)} (i : ι) (ne : c.Nonempty) : find c ne i ∈ c := by
  rw [find]
  split_ifs with h
  

Proof state:
case pos
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
i : ι
ne : Set.Nonempty c
h : ∃ v ∈ c, i ∈ v.carrier
⊢ Exists.choose h ∈ c
case neg
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
i : ι
ne : Set.Nonempty c
h : ¬∃ v ∈ c, i ∈ v.carrier
⊢ Set.Nonempty.some ne ∈ c

Next tactic:
exacts [h.choose_spec.1, ne.some_mem]
theorem mem_find_carrier_iff {c : Set (PartialRefinement u s)} {i : ι} (ne : c.Nonempty) :
    i ∈ (find c ne i).carrier ↔ i ∈ chainSupCarrier c := by
  

Proof state:
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
i : ι
ne : Set.Nonempty c
⊢ i ∈ (find c ne i).carrier ↔ i ∈ chainSupCarrier c

Next tactic:
rw [find]
theorem mem_find_carrier_iff {c : Set (PartialRefinement u s)} {i : ι} (ne : c.Nonempty) :
    i ∈ (find c ne i).carrier ↔ i ∈ chainSupCarrier c := by
  rw [find]
  

Proof state:
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
i : ι
ne : Set.Nonempty c
⊢ i ∈ (if hi : ∃ v ∈ c, i ∈ v.carrier then Exists.choose hi else Set.Nonempty.some ne).carrier ↔ i ∈ chainSupCarrier c

Next tactic:
split_ifs with h
theorem mem_find_carrier_iff {c : Set (PartialRefinement u s)} {i : ι} (ne : c.Nonempty) :
    i ∈ (find c ne i).carrier ↔ i ∈ chainSupCarrier c := by
  rw [find]
  split_ifs with h
  · 

Proof state:
case pos
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
i : ι
ne : Set.Nonempty c
h : ∃ v ∈ c, i ∈ v.carrier
⊢ i ∈ (Exists.choose h).carrier ↔ i ∈ chainSupCarrier c

Next tactic:
have := h.choose_spec
theorem mem_find_carrier_iff {c : Set (PartialRefinement u s)} {i : ι} (ne : c.Nonempty) :
    i ∈ (find c ne i).carrier ↔ i ∈ chainSupCarrier c := by
  rw [find]
  split_ifs with h
  · have := h.choose_spec
    

Proof state:
case pos
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
i : ι
ne : Set.Nonempty c
h : ∃ v ∈ c, i ∈ v.carrier
this : Exists.choose h ∈ c ∧ i ∈ (Exists.choose h).carrier
⊢ i ∈ (Exists.choose h).carrier ↔ i ∈ chainSupCarrier c

Next tactic:
exact iff_of_true this.2 (mem_iUnion₂.2 ⟨_, this.1, this.2⟩)
theorem mem_find_carrier_iff {c : Set (PartialRefinement u s)} {i : ι} (ne : c.Nonempty) :
    i ∈ (find c ne i).carrier ↔ i ∈ chainSupCarrier c := by
  rw [find]
  split_ifs with h
  · have := h.choose_spec
    exact iff_of_true this.2 (mem_iUnion₂.2 ⟨_, this.1, this.2⟩)
  · 

Proof state:
case neg
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
i : ι
ne : Set.Nonempty c
h : ¬∃ v ∈ c, i ∈ v.carrier
⊢ i ∈ (Set.Nonempty.some ne).carrier ↔ i ∈ chainSupCarrier c

Next tactic:
push_neg at h
theorem mem_find_carrier_iff {c : Set (PartialRefinement u s)} {i : ι} (ne : c.Nonempty) :
    i ∈ (find c ne i).carrier ↔ i ∈ chainSupCarrier c := by
  rw [find]
  split_ifs with h
  · have := h.choose_spec
    exact iff_of_true this.2 (mem_iUnion₂.2 ⟨_, this.1, this.2⟩)
  · push_neg at h
    

Proof state:
case neg
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
i : ι
ne : Set.Nonempty c
h : ∀ v ∈ c, i ∉ v.carrier
⊢ i ∈ (Set.Nonempty.some ne).carrier ↔ i ∈ chainSupCarrier c

Next tactic:
refine iff_of_false (h _ ne.some_mem) ?_
theorem mem_find_carrier_iff {c : Set (PartialRefinement u s)} {i : ι} (ne : c.Nonempty) :
    i ∈ (find c ne i).carrier ↔ i ∈ chainSupCarrier c := by
  rw [find]
  split_ifs with h
  · have := h.choose_spec
    exact iff_of_true this.2 (mem_iUnion₂.2 ⟨_, this.1, this.2⟩)
  · push_neg at h
    refine iff_of_false (h _ ne.some_mem) ?_
    

Proof state:
case neg
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
i : ι
ne : Set.Nonempty c
h : ∀ v ∈ c, i ∉ v.carrier
⊢ i ∉ chainSupCarrier c

Next tactic:
simpa only [chainSupCarrier, mem_iUnion₂, not_exists]
/-- Least upper bound of a nonempty chain of partial refinements. -/
def chainSup (c : Set (PartialRefinement u s)) (hc : IsChain (· ≤ ·) c) (ne : c.Nonempty)
    (hfin : ∀ x ∈ s, { i | x ∈ u i }.Finite) (hU : s ⊆ ⋃ i, u i) : PartialRefinement u s where
  toFun i := find c ne i i
  carrier := chainSupCarrier c
  isOpen i := (find _ _ _).isOpen i
  subset_iUnion x hxs := mem_iUnion.2 <| by
    

Proof state:
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
hc : IsChain (fun x x_1 => x ≤ x_1) c
ne : Set.Nonempty c
hfin : ∀ x ∈ s, Set.Finite {i | x ∈ u i}
hU : s ⊆ ⋃ i, u i
x : X
hxs : x ∈ s
⊢ ∃ i, x ∈ (fun i => toFun (find c ne i) i) i

Next tactic:
rcases em (∃ i, i ∉ chainSupCarrier c ∧ x ∈ u i) with (⟨i, hi, hxi⟩ | hx)
/-- Least upper bound of a nonempty chain of partial refinements. -/
def chainSup (c : Set (PartialRefinement u s)) (hc : IsChain (· ≤ ·) c) (ne : c.Nonempty)
    (hfin : ∀ x ∈ s, { i | x ∈ u i }.Finite) (hU : s ⊆ ⋃ i, u i) : PartialRefinement u s where
  toFun i := find c ne i i
  carrier := chainSupCarrier c
  isOpen i := (find _ _ _).isOpen i
  subset_iUnion x hxs := mem_iUnion.2 <| by
    rcases em (∃ i, i ∉ chainSupCarrier c ∧ x ∈ u i) with (⟨i, hi, hxi⟩ | hx)
    · 

Proof state:
case inl.intro.intro
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
hc : IsChain (fun x x_1 => x ≤ x_1) c
ne : Set.Nonempty c
hfin : ∀ x ∈ s, Set.Finite {i | x ∈ u i}
hU : s ⊆ ⋃ i, u i
x : X
hxs : x ∈ s
i : ι
hi : i ∉ chainSupCarrier c
hxi : x ∈ u i
⊢ ∃ i, x ∈ (fun i => toFun (find c ne i) i) i

Next tactic:
use i
/-- Least upper bound of a nonempty chain of partial refinements. -/
def chainSup (c : Set (PartialRefinement u s)) (hc : IsChain (· ≤ ·) c) (ne : c.Nonempty)
    (hfin : ∀ x ∈ s, { i | x ∈ u i }.Finite) (hU : s ⊆ ⋃ i, u i) : PartialRefinement u s where
  toFun i := find c ne i i
  carrier := chainSupCarrier c
  isOpen i := (find _ _ _).isOpen i
  subset_iUnion x hxs := mem_iUnion.2 <| by
    rcases em (∃ i, i ∉ chainSupCarrier c ∧ x ∈ u i) with (⟨i, hi, hxi⟩ | hx)
    · use i
      

Proof state:
case h
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
hc : IsChain (fun x x_1 => x ≤ x_1) c
ne : Set.Nonempty c
hfin : ∀ x ∈ s, Set.Finite {i | x ∈ u i}
hU : s ⊆ ⋃ i, u i
x : X
hxs : x ∈ s
i : ι
hi : i ∉ chainSupCarrier c
hxi : x ∈ u i
⊢ x ∈ (fun i => toFun (find c ne i) i) i

Next tactic:
simpa only [(find c ne i).apply_eq (mt (mem_find_carrier_iff _).1 hi)]
/-- Least upper bound of a nonempty chain of partial refinements. -/
def chainSup (c : Set (PartialRefinement u s)) (hc : IsChain (· ≤ ·) c) (ne : c.Nonempty)
    (hfin : ∀ x ∈ s, { i | x ∈ u i }.Finite) (hU : s ⊆ ⋃ i, u i) : PartialRefinement u s where
  toFun i := find c ne i i
  carrier := chainSupCarrier c
  isOpen i := (find _ _ _).isOpen i
  subset_iUnion x hxs := mem_iUnion.2 <| by
    rcases em (∃ i, i ∉ chainSupCarrier c ∧ x ∈ u i) with (⟨i, hi, hxi⟩ | hx)
    · use i
      simpa only [(find c ne i).apply_eq (mt (mem_find_carrier_iff _).1 hi)]
    · 

Proof state:
case inr
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
hc : IsChain (fun x x_1 => x ≤ x_1) c
ne : Set.Nonempty c
hfin : ∀ x ∈ s, Set.Finite {i | x ∈ u i}
hU : s ⊆ ⋃ i, u i
x : X
hxs : x ∈ s
hx : ¬∃ i ∉ chainSupCarrier c, x ∈ u i
⊢ ∃ i, x ∈ (fun i => toFun (find c ne i) i) i

Next tactic:
simp_rw [not_exists, not_and, not_imp_not, chainSupCarrier, mem_iUnion₂] at hx
/-- Least upper bound of a nonempty chain of partial refinements. -/
def chainSup (c : Set (PartialRefinement u s)) (hc : IsChain (· ≤ ·) c) (ne : c.Nonempty)
    (hfin : ∀ x ∈ s, { i | x ∈ u i }.Finite) (hU : s ⊆ ⋃ i, u i) : PartialRefinement u s where
  toFun i := find c ne i i
  carrier := chainSupCarrier c
  isOpen i := (find _ _ _).isOpen i
  subset_iUnion x hxs := mem_iUnion.2 <| by
    rcases em (∃ i, i ∉ chainSupCarrier c ∧ x ∈ u i) with (⟨i, hi, hxi⟩ | hx)
    · use i
      simpa only [(find c ne i).apply_eq (mt (mem_find_carrier_iff _).1 hi)]
    · simp_rw [not_exists, not_and, not_imp_not, chainSupCarrier, mem_iUnion₂] at hx
      

Proof state:
case inr
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
hc : IsChain (fun x x_1 => x ≤ x_1) c
ne : Set.Nonempty c
hfin : ∀ x ∈ s, Set.Finite {i | x ∈ u i}
hU : s ⊆ ⋃ i, u i
x : X
hxs : x ∈ s
hx : ∀ (x_1 : ι), x ∈ u x_1 → ∃ i, ∃ (_ : i ∈ c), x_1 ∈ i.carrier
⊢ ∃ i, x ∈ (fun i => toFun (find c ne i) i) i

Next tactic:
haveI : Nonempty (PartialRefinement u s) := ⟨ne.some⟩
/-- Least upper bound of a nonempty chain of partial refinements. -/
def chainSup (c : Set (PartialRefinement u s)) (hc : IsChain (· ≤ ·) c) (ne : c.Nonempty)
    (hfin : ∀ x ∈ s, { i | x ∈ u i }.Finite) (hU : s ⊆ ⋃ i, u i) : PartialRefinement u s where
  toFun i := find c ne i i
  carrier := chainSupCarrier c
  isOpen i := (find _ _ _).isOpen i
  subset_iUnion x hxs := mem_iUnion.2 <| by
    rcases em (∃ i, i ∉ chainSupCarrier c ∧ x ∈ u i) with (⟨i, hi, hxi⟩ | hx)
    · use i
      simpa only [(find c ne i).apply_eq (mt (mem_find_carrier_iff _).1 hi)]
    · simp_rw [not_exists, not_and, not_imp_not, chainSupCarrier, mem_iUnion₂] at hx
      haveI : Nonempty (PartialRefinement u s) := ⟨ne.some⟩
      

Proof state:
case inr
ι : Type u_1
X : Type u_2
inst✝¹ : TopologicalSpace X
inst✝ : NormalSpace X
u : ι → Set X
s : Set X
c : Set (PartialRefinement u s)
hc : IsChain (fun x x_1 => x ≤ x_1) c
ne : Set.Nonempty c
hfin : ∀ x ∈ s, Set.Finite {i | x ∈ u i}
hU : s ⊆ ⋃ i, u i
x : X
hxs : x ∈ s
hx : ∀ (x_1 : ι), x ∈ u x_1 → ∃ i, ∃ (_ : i ∈ c), x_1 ∈ i.carrier
this : Nonempty (PartialRefinement u s)
⊢ ∃ i, x ∈ (fun i => toFun (find c ne i) i) i

Next tactic:
choose! v hvc hiv using hx