l3lab/ntp-mathlib huggingface dataset:
/--
A morphism in `Stonean` is an epi iff it is surjective.

TODO: prove that `forget Stonean` preserves pushouts (in fact it preserves all finite colimits)
and deduce this from general lemmas about concrete categories.
-/
lemma epi_iff_surjective {X Y : Stonean} (f : X ⟶ Y) :
    Epi f ↔ Function.Surjective f := by
  refine ⟨?_, ConcreteCategory.epi_of_surjective _⟩
  dsimp [Function.Surjective]
  intro h y
  by_contra! hy
  let C := Set.range f
  have hC : IsClosed C := (isCompact_range f.continuous).isClosed
  let U := Cᶜ
  have hUy : U ∈ nhds y := by
    simp only [Set.mem_range, hy, exists_false, not_false_eq_true, hC.compl_mem_nhds]
  obtain ⟨V, hV, hyV, hVU⟩ := isTopologicalBasis_isClopen.mem_nhds_iff.mp hUy
  classical
  let g : Y ⟶ mkFinite (ULift (Fin 2)) :=
    ⟨(LocallyConstant.ofIsClopen hV).map ULift.up, LocallyConstant.continuous _⟩
  let h : Y ⟶ mkFinite (ULift (Fin 2)) := ⟨fun _ => ⟨1⟩, continuous_const⟩
  have H : h = g := by
    rw [← cancel_epi f]
    ext x
    apply ULift.ext -- why is `ext` not doing this automatically?
    change 1 = ite _ _ _ -- why is `dsimp` not getting me here?
    rw [if_neg]
    refine mt (hVU ·) ?_ -- what would be an idiomatic tactic for this step?
    simpa only [Set.mem_compl_iff, Set.mem_range, not_exists, not_forall, not_not]
      using exists_apply_eq_apply f x
  apply_fun fun e => (e y).down at H
  change 1 = ite _ _ _ at H -- why is `dsimp at H` not getting me here?
  

Proof state:
case intro.intro.intro
X Y : Stonean
f : X ⟶ Y
h✝ : Epi f
y : CoeSort.coe Y
hy : ∀ (a : CoeSort.coe X), f a ≠ y
C : Set (CoeSort.coe Y) := Set.range ⇑f
hC : IsClosed C
U : Set (CoeSort.coe Y) := Cᶜ
hUy : U ∈ nhds y
V : Set (CoeSort.coe Y)
hV : V ∈ {s | IsClopen s}
hyV : y ∈ V
hVU : V ⊆ U
g : Y ⟶ mkFinite (ULift.{u_1, 0} (Fin 2)) :=
  ContinuousMap.mk ⇑(LocallyConstant.map ULift.up (LocallyConstant.ofIsClopen hV))
h : Y ⟶ mkFinite (ULift.{u_1, 0} (Fin 2)) := ContinuousMap.mk fun x => { down := 1 }
H : 1 = if y ∈ V then 0 else 1
⊢ False

Next tactic:
rw [if_pos hyV] at H
/--
A morphism in `Stonean` is an epi iff it is surjective.

TODO: prove that `forget Stonean` preserves pushouts (in fact it preserves all finite colimits)
and deduce this from general lemmas about concrete categories.
-/
lemma epi_iff_surjective {X Y : Stonean} (f : X ⟶ Y) :
    Epi f ↔ Function.Surjective f := by
  refine ⟨?_, ConcreteCategory.epi_of_surjective _⟩
  dsimp [Function.Surjective]
  intro h y
  by_contra! hy
  let C := Set.range f
  have hC : IsClosed C := (isCompact_range f.continuous).isClosed
  let U := Cᶜ
  have hUy : U ∈ nhds y := by
    simp only [Set.mem_range, hy, exists_false, not_false_eq_true, hC.compl_mem_nhds]
  obtain ⟨V, hV, hyV, hVU⟩ := isTopologicalBasis_isClopen.mem_nhds_iff.mp hUy
  classical
  let g : Y ⟶ mkFinite (ULift (Fin 2)) :=
    ⟨(LocallyConstant.ofIsClopen hV).map ULift.up, LocallyConstant.continuous _⟩
  let h : Y ⟶ mkFinite (ULift (Fin 2)) := ⟨fun _ => ⟨1⟩, continuous_const⟩
  have H : h = g := by
    rw [← cancel_epi f]
    ext x
    apply ULift.ext -- why is `ext` not doing this automatically?
    change 1 = ite _ _ _ -- why is `dsimp` not getting me here?
    rw [if_neg]
    refine mt (hVU ·) ?_ -- what would be an idiomatic tactic for this step?
    simpa only [Set.mem_compl_iff, Set.mem_range, not_exists, not_forall, not_not]
      using exists_apply_eq_apply f x
  apply_fun fun e => (e y).down at H
  change 1 = ite _ _ _ at H -- why is `dsimp at H` not getting me here?
  rw [if_pos hyV] at H
  

Proof state:
case intro.intro.intro
X Y : Stonean
f : X ⟶ Y
h✝ : Epi f
y : CoeSort.coe Y
hy : ∀ (a : CoeSort.coe X), f a ≠ y
C : Set (CoeSort.coe Y) := Set.range ⇑f
hC : IsClosed C
U : Set (CoeSort.coe Y) := Cᶜ
hUy : U ∈ nhds y
V : Set (CoeSort.coe Y)
hV : V ∈ {s | IsClopen s}
hyV : y ∈ V
hVU : V ⊆ U
g : Y ⟶ mkFinite (ULift.{u_1, 0} (Fin 2)) :=
  ContinuousMap.mk ⇑(LocallyConstant.map ULift.up (LocallyConstant.ofIsClopen hV))
h : Y ⟶ mkFinite (ULift.{u_1, 0} (Fin 2)) := ContinuousMap.mk fun x => { down := 1 }
H : 1 = 0
⊢ False

Next tactic:
exact one_ne_zero H
instance {X Y : Stonean} (f : X ⟶ Y) [Epi f] : @Epi CompHaus _ _ _ f := by
  

Proof state:
X Y : Stonean
f : X ⟶ Y
inst✝ : Epi f
⊢ Epi f

Next tactic:
rw [CompHaus.epi_iff_surjective]
instance {X Y : Stonean} (f : X ⟶ Y) [Epi f] : @Epi CompHaus _ _ _ f := by
  rw [CompHaus.epi_iff_surjective]
  

Proof state:
X Y : Stonean
f : X ⟶ Y
inst✝ : Epi f
⊢ Function.Surjective ⇑f

Next tactic:
rwa [Stonean.epi_iff_surjective] at *
instance {X Y : Stonean} (f : X ⟶ Y) [@Epi CompHaus _ _ _ f] : Epi f := by
  

Proof state:
X Y : Stonean
f : X ⟶ Y
inst✝ : Epi f
⊢ Epi f

Next tactic:
rw [Stonean.epi_iff_surjective]
instance {X Y : Stonean} (f : X ⟶ Y) [@Epi CompHaus _ _ _ f] : Epi f := by
  rw [Stonean.epi_iff_surjective]
  

Proof state:
X Y : Stonean
f : X ⟶ Y
inst✝ : Epi f
⊢ Function.Surjective ⇑f

Next tactic:
rwa [CompHaus.epi_iff_surjective] at *
/-- Every Stonean space is projective in `CompHaus` -/
instance (X : Stonean) : Projective X.compHaus where
  factors := by
    

Proof state:
X : Stonean
⊢ ∀ {E X_1 : CompHaus} (f : X.compHaus ⟶ X_1) (e : E ⟶ X_1) [inst : Epi e], ∃ f', f' ≫ e = f

Next tactic:
intro B C φ f _
/-- Every Stonean space is projective in `CompHaus` -/
instance (X : Stonean) : Projective X.compHaus where
  factors := by
    intro B C φ f _
    

Proof state:
X : Stonean
B C : CompHaus
φ : X.compHaus ⟶ C
f : B ⟶ C
inst✝ : Epi f
⊢ ∃ f', f' ≫ f = φ

Next tactic:
haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
/-- Every Stonean space is projective in `CompHaus` -/
instance (X : Stonean) : Projective X.compHaus where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    

Proof state:
X : Stonean
B C : CompHaus
φ : X.compHaus ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
⊢ ∃ f', f' ≫ f = φ

Next tactic:
have hf : Function.Surjective f := by rwa [← CompHaus.epi_iff_surjective]
/-- Every Stonean space is projective in `CompHaus` -/
instance (X : Stonean) : Projective X.compHaus where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    have hf : Function.Surjective f := by 

Proof state:
X : Stonean
B C : CompHaus
φ : X.compHaus ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
⊢ Function.Surjective ⇑f

Next tactic:
rwa [← CompHaus.epi_iff_surjective]
/-- Every Stonean space is projective in `CompHaus` -/
instance (X : Stonean) : Projective X.compHaus where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    have hf : Function.Surjective f := by rwa [← CompHaus.epi_iff_surjective]
    

Proof state:
X : Stonean
B C : CompHaus
φ : X.compHaus ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
hf : Function.Surjective ⇑f
⊢ ∃ f', f' ≫ f = φ

Next tactic:
obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
/-- Every Stonean space is projective in `CompHaus` -/
instance (X : Stonean) : Projective X.compHaus where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    have hf : Function.Surjective f := by rwa [← CompHaus.epi_iff_surjective]
    obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
    

Proof state:
case intro
X : Stonean
B C : CompHaus
φ : X.compHaus ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
hf : Function.Surjective ⇑f
f' : ↑X.compHaus.toTop → ↑B.toTop
h : Continuous f' ∧ ⇑f ∘ f' = ⇑φ
⊢ ∃ f', f' ≫ f = φ

Next tactic:
use ⟨f', h.left⟩
/-- Every Stonean space is projective in `CompHaus` -/
instance (X : Stonean) : Projective X.compHaus where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    have hf : Function.Surjective f := by rwa [← CompHaus.epi_iff_surjective]
    obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
    use ⟨f', h.left⟩
    

Proof state:
case h
X : Stonean
B C : CompHaus
φ : X.compHaus ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
hf : Function.Surjective ⇑f
f' : ↑X.compHaus.toTop → ↑B.toTop
h : Continuous f' ∧ ⇑f ∘ f' = ⇑φ
⊢ ContinuousMap.mk f' ≫ f = φ

Next tactic:
ext
/-- Every Stonean space is projective in `CompHaus` -/
instance (X : Stonean) : Projective X.compHaus where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    have hf : Function.Surjective f := by rwa [← CompHaus.epi_iff_surjective]
    obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
    use ⟨f', h.left⟩
    ext
    

Proof state:
case h.w
X : Stonean
B C : CompHaus
φ : X.compHaus ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
hf : Function.Surjective ⇑f
f' : ↑X.compHaus.toTop → ↑B.toTop
h : Continuous f' ∧ ⇑f ∘ f' = ⇑φ
x✝ : (forget CompHaus).obj X.compHaus
⊢ (ContinuousMap.mk f' ≫ f) x✝ = φ x✝

Next tactic:
exact congr_fun h.right _
/-- Every Stonean space is projective in `Profinite` -/
instance (X : Stonean) : Projective (toProfinite.obj X) where
  factors := by
    

Proof state:
X : Stonean
⊢ ∀ {E X_1 : Profinite} (f : toProfinite.obj X ⟶ X_1) (e : E ⟶ X_1) [inst : Epi e], ∃ f', f' ≫ e = f

Next tactic:
intro B C φ f _
/-- Every Stonean space is projective in `Profinite` -/
instance (X : Stonean) : Projective (toProfinite.obj X) where
  factors := by
    intro B C φ f _
    

Proof state:
X : Stonean
B C : Profinite
φ : toProfinite.obj X ⟶ C
f : B ⟶ C
inst✝ : Epi f
⊢ ∃ f', f' ≫ f = φ

Next tactic:
haveI : ExtremallyDisconnected (toProfinite.obj X) := X.extrDisc
/-- Every Stonean space is projective in `Profinite` -/
instance (X : Stonean) : Projective (toProfinite.obj X) where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected (toProfinite.obj X) := X.extrDisc
    

Proof state:
X : Stonean
B C : Profinite
φ : toProfinite.obj X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑(toProfinite.obj X).toCompHaus.toTop
⊢ ∃ f', f' ≫ f = φ

Next tactic:
have hf : Function.Surjective f := by rwa [← Profinite.epi_iff_surjective]
/-- Every Stonean space is projective in `Profinite` -/
instance (X : Stonean) : Projective (toProfinite.obj X) where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected (toProfinite.obj X) := X.extrDisc
    have hf : Function.Surjective f := by 

Proof state:
X : Stonean
B C : Profinite
φ : toProfinite.obj X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑(toProfinite.obj X).toCompHaus.toTop
⊢ Function.Surjective ⇑f

Next tactic:
rwa [← Profinite.epi_iff_surjective]
/-- Every Stonean space is projective in `Profinite` -/
instance (X : Stonean) : Projective (toProfinite.obj X) where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected (toProfinite.obj X) := X.extrDisc
    have hf : Function.Surjective f := by rwa [← Profinite.epi_iff_surjective]
    

Proof state:
X : Stonean
B C : Profinite
φ : toProfinite.obj X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑(toProfinite.obj X).toCompHaus.toTop
hf : Function.Surjective ⇑f
⊢ ∃ f', f' ≫ f = φ

Next tactic:
obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
/-- Every Stonean space is projective in `Profinite` -/
instance (X : Stonean) : Projective (toProfinite.obj X) where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected (toProfinite.obj X) := X.extrDisc
    have hf : Function.Surjective f := by rwa [← Profinite.epi_iff_surjective]
    obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
    

Proof state:
case intro
X : Stonean
B C : Profinite
φ : toProfinite.obj X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑(toProfinite.obj X).toCompHaus.toTop
hf : Function.Surjective ⇑f
f' : ↑(toProfinite.obj X).toCompHaus.toTop → ↑B.toCompHaus.toTop
h : Continuous f' ∧ ⇑f ∘ f' = ⇑φ
⊢ ∃ f', f' ≫ f = φ

Next tactic:
use ⟨f', h.left⟩
/-- Every Stonean space is projective in `Profinite` -/
instance (X : Stonean) : Projective (toProfinite.obj X) where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected (toProfinite.obj X) := X.extrDisc
    have hf : Function.Surjective f := by rwa [← Profinite.epi_iff_surjective]
    obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
    use ⟨f', h.left⟩
    

Proof state:
case h
X : Stonean
B C : Profinite
φ : toProfinite.obj X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑(toProfinite.obj X).toCompHaus.toTop
hf : Function.Surjective ⇑f
f' : ↑(toProfinite.obj X).toCompHaus.toTop → ↑B.toCompHaus.toTop
h : Continuous f' ∧ ⇑f ∘ f' = ⇑φ
⊢ ContinuousMap.mk f' ≫ f = φ

Next tactic:
ext
/-- Every Stonean space is projective in `Profinite` -/
instance (X : Stonean) : Projective (toProfinite.obj X) where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected (toProfinite.obj X) := X.extrDisc
    have hf : Function.Surjective f := by rwa [← Profinite.epi_iff_surjective]
    obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
    use ⟨f', h.left⟩
    ext
    

Proof state:
case h.w
X : Stonean
B C : Profinite
φ : toProfinite.obj X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑(toProfinite.obj X).toCompHaus.toTop
hf : Function.Surjective ⇑f
f' : ↑(toProfinite.obj X).toCompHaus.toTop → ↑B.toCompHaus.toTop
h : Continuous f' ∧ ⇑f ∘ f' = ⇑φ
x✝ : (forget Profinite).obj (toProfinite.obj X)
⊢ (ContinuousMap.mk f' ≫ f) x✝ = φ x✝

Next tactic:
exact congr_fun h.right _
/-- Every Stonean space is projective in `Stonean`. -/
instance (X : Stonean) : Projective X where
  factors := by
    

Proof state:
X : Stonean
⊢ ∀ {E X_1 : Stonean} (f : X ⟶ X_1) (e : E ⟶ X_1) [inst : Epi e], ∃ f', f' ≫ e = f

Next tactic:
intro B C φ f _
/-- Every Stonean space is projective in `Stonean`. -/
instance (X : Stonean) : Projective X where
  factors := by
    intro B C φ f _
    

Proof state:
X B C : Stonean
φ : X ⟶ C
f : B ⟶ C
inst✝ : Epi f
⊢ ∃ f', f' ≫ f = φ

Next tactic:
haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
/-- Every Stonean space is projective in `Stonean`. -/
instance (X : Stonean) : Projective X where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    

Proof state:
X B C : Stonean
φ : X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
⊢ ∃ f', f' ≫ f = φ

Next tactic:
have hf : Function.Surjective f := by rwa [← Stonean.epi_iff_surjective]
/-- Every Stonean space is projective in `Stonean`. -/
instance (X : Stonean) : Projective X where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    have hf : Function.Surjective f := by 

Proof state:
X B C : Stonean
φ : X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
⊢ Function.Surjective ⇑f

Next tactic:
rwa [← Stonean.epi_iff_surjective]
/-- Every Stonean space is projective in `Stonean`. -/
instance (X : Stonean) : Projective X where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    have hf : Function.Surjective f := by rwa [← Stonean.epi_iff_surjective]
    

Proof state:
X B C : Stonean
φ : X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
hf : Function.Surjective ⇑f
⊢ ∃ f', f' ≫ f = φ

Next tactic:
obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
/-- Every Stonean space is projective in `Stonean`. -/
instance (X : Stonean) : Projective X where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    have hf : Function.Surjective f := by rwa [← Stonean.epi_iff_surjective]
    obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
    

Proof state:
case intro
X B C : Stonean
φ : X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
hf : Function.Surjective ⇑f
f' : ↑((fun x => x.compHaus) X).toTop → ↑((fun x => x.compHaus) B).toTop
h : Continuous f' ∧ ⇑f ∘ f' = ⇑φ
⊢ ∃ f', f' ≫ f = φ

Next tactic:
use ⟨f', h.left⟩
/-- Every Stonean space is projective in `Stonean`. -/
instance (X : Stonean) : Projective X where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    have hf : Function.Surjective f := by rwa [← Stonean.epi_iff_surjective]
    obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
    use ⟨f', h.left⟩
    

Proof state:
case h
X B C : Stonean
φ : X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
hf : Function.Surjective ⇑f
f' : ↑((fun x => x.compHaus) X).toTop → ↑((fun x => x.compHaus) B).toTop
h : Continuous f' ∧ ⇑f ∘ f' = ⇑φ
⊢ ContinuousMap.mk f' ≫ f = φ

Next tactic:
ext
/-- Every Stonean space is projective in `Stonean`. -/
instance (X : Stonean) : Projective X where
  factors := by
    intro B C φ f _
    haveI : ExtremallyDisconnected X.compHaus.toTop := X.extrDisc
    have hf : Function.Surjective f := by rwa [← Stonean.epi_iff_surjective]
    obtain ⟨f', h⟩ := CompactT2.ExtremallyDisconnected.projective φ.continuous f.continuous hf
    use ⟨f', h.left⟩
    ext
    

Proof state:
case h.w
X B C : Stonean
φ : X ⟶ C
f : B ⟶ C
inst✝ : Epi f
this : ExtremallyDisconnected ↑X.compHaus.toTop
hf : Function.Surjective ⇑f
f' : ↑((fun x => x.compHaus) X).toTop → ↑((fun x => x.compHaus) B).toTop
h : Continuous f' ∧ ⇑f ∘ f' = ⇑φ
x✝ : (forget Stonean).obj X
⊢ (ContinuousMap.mk f' ≫ f) x✝ = φ x✝

Next tactic:
exact congr_fun h.right _
/-- If `X` is compact Hausdorff, `presentation X` is a Stonean space equipped with an epimorphism
  down to `X` (see `CompHaus.presentation.π` and `CompHaus.presentation.epi_π`). It is a
  "constructive" witness to the fact that `CompHaus` has enough projectives. -/
noncomputable
def presentation (X : CompHaus) : Stonean where
  compHaus := (projectivePresentation X).p
  extrDisc := by
    

Proof state:
X : CompHaus
⊢ ExtremallyDisconnected ↑(projectivePresentation X).p.toTop

Next tactic:
refine' CompactT2.Projective.extremallyDisconnected
      (@fun Y Z _ _ _ _ _ _ f g hfcont hgcont hgsurj => _)
/-- If `X` is compact Hausdorff, `presentation X` is a Stonean space equipped with an epimorphism
  down to `X` (see `CompHaus.presentation.π` and `CompHaus.presentation.epi_π`). It is a
  "constructive" witness to the fact that `CompHaus` has enough projectives. -/
noncomputable
def presentation (X : CompHaus) : Stonean where
  compHaus := (projectivePresentation X).p
  extrDisc := by
    refine' CompactT2.Projective.extremallyDisconnected
      (@fun Y Z _ _ _ _ _ _ f g hfcont hgcont hgsurj => _)
    

Proof state:
X : CompHaus
Y Z : Type ?u.35059
x✝⁵ : TopologicalSpace Y
x✝⁴ : TopologicalSpace Z
x✝³ : CompactSpace Y
x✝² : T2Space Y
x✝¹ : CompactSpace Z
x✝ : T2Space Z
f : ↑(projectivePresentation X).p.toTop → Z
g : Y → Z
hfcont : Continuous f
hgcont : Continuous g
hgsurj : Function.Surjective g
⊢ ∃ h, Continuous h ∧ g ∘ h = f

Next tactic:
let g₁ : (CompHaus.of Y) ⟶ (CompHaus.of Z) := ⟨g, hgcont⟩
/-- If `X` is compact Hausdorff, `presentation X` is a Stonean space equipped with an epimorphism
  down to `X` (see `CompHaus.presentation.π` and `CompHaus.presentation.epi_π`). It is a
  "constructive" witness to the fact that `CompHaus` has enough projectives. -/
noncomputable
def presentation (X : CompHaus) : Stonean where
  compHaus := (projectivePresentation X).p
  extrDisc := by
    refine' CompactT2.Projective.extremallyDisconnected
      (@fun Y Z _ _ _ _ _ _ f g hfcont hgcont hgsurj => _)
    let g₁ : (CompHaus.of Y) ⟶ (CompHaus.of Z) := ⟨g, hgcont⟩
    

Proof state:
X : CompHaus
Y Z : Type ?u.35333
x✝⁵ : TopologicalSpace Y
x✝⁴ : TopologicalSpace Z
x✝³ : CompactSpace Y
x✝² : T2Space Y
x✝¹ : CompactSpace Z
x✝ : T2Space Z
f : ↑(projectivePresentation X).p.toTop → Z
g : Y → Z
hfcont : Continuous f
hgcont : Continuous g
hgsurj : Function.Surjective g
g₁ : of Y ⟶ of Z := ContinuousMap.mk g
⊢ ∃ h, Continuous h ∧ g ∘ h = f

Next tactic:
let f₁ : (projectivePresentation X).p ⟶ (CompHaus.of Z) := ⟨f, hfcont⟩
/-- If `X` is compact Hausdorff, `presentation X` is a Stonean space equipped with an epimorphism
  down to `X` (see `CompHaus.presentation.π` and `CompHaus.presentation.epi_π`). It is a
  "constructive" witness to the fact that `CompHaus` has enough projectives. -/
noncomputable
def presentation (X : CompHaus) : Stonean where
  compHaus := (projectivePresentation X).p
  extrDisc := by
    refine' CompactT2.Projective.extremallyDisconnected
      (@fun Y Z _ _ _ _ _ _ f g hfcont hgcont hgsurj => _)
    let g₁ : (CompHaus.of Y) ⟶ (CompHaus.of Z) := ⟨g, hgcont⟩
    let f₁ : (projectivePresentation X).p ⟶ (CompHaus.of Z) := ⟨f, hfcont⟩
    

Proof state:
X : CompHaus
Y Z : Type ?u.35564
x✝⁵ : TopologicalSpace Y
x✝⁴ : TopologicalSpace Z
x✝³ : CompactSpace Y
x✝² : T2Space Y
x✝¹ : CompactSpace Z
x✝ : T2Space Z
f : ↑(projectivePresentation X).p.toTop → Z
g : Y → Z
hfcont : Continuous f
hgcont : Continuous g
hgsurj : Function.Surjective g
g₁ : of Y ⟶ of Z := ContinuousMap.mk g
f₁ : (projectivePresentation X).p ⟶ of Z := ContinuousMap.mk f
⊢ ∃ h, Continuous h ∧ g ∘ h = f

Next tactic:
have hg₁ : Epi g₁ := (epi_iff_surjective _).2 hgsurj
/-- If `X` is compact Hausdorff, `presentation X` is a Stonean space equipped with an epimorphism
  down to `X` (see `CompHaus.presentation.π` and `CompHaus.presentation.epi_π`). It is a
  "constructive" witness to the fact that `CompHaus` has enough projectives. -/
noncomputable
def presentation (X : CompHaus) : Stonean where
  compHaus := (projectivePresentation X).p
  extrDisc := by
    refine' CompactT2.Projective.extremallyDisconnected
      (@fun Y Z _ _ _ _ _ _ f g hfcont hgcont hgsurj => _)
    let g₁ : (CompHaus.of Y) ⟶ (CompHaus.of Z) := ⟨g, hgcont⟩
    let f₁ : (projectivePresentation X).p ⟶ (CompHaus.of Z) := ⟨f, hfcont⟩
    have hg₁ : Epi g₁ := (epi_iff_surjective _).2 hgsurj
    

Proof state:
X : CompHaus
Y Z : Type ?u.35564
x✝⁵ : TopologicalSpace Y
x✝⁴ : TopologicalSpace Z
x✝³ : CompactSpace Y
x✝² : T2Space Y
x✝¹ : CompactSpace Z
x✝ : T2Space Z
f : ↑(projectivePresentation X).p.toTop → Z
g : Y → Z
hfcont : Continuous f
hgcont : Continuous g
hgsurj : Function.Surjective g
g₁ : of Y ⟶ of Z := ContinuousMap.mk g
f₁ : (projectivePresentation X).p ⟶ of Z := ContinuousMap.mk f
hg₁ : Epi g₁
⊢ ∃ h, Continuous h ∧ g ∘ h = f

Next tactic:
refine' ⟨Projective.factorThru f₁ g₁, (Projective.factorThru f₁ g₁).2, funext (fun _ => _)⟩
/-- If `X` is compact Hausdorff, `presentation X` is a Stonean space equipped with an epimorphism
  down to `X` (see `CompHaus.presentation.π` and `CompHaus.presentation.epi_π`). It is a
  "constructive" witness to the fact that `CompHaus` has enough projectives. -/
noncomputable
def presentation (X : CompHaus) : Stonean where
  compHaus := (projectivePresentation X).p
  extrDisc := by
    refine' CompactT2.Projective.extremallyDisconnected
      (@fun Y Z _ _ _ _ _ _ f g hfcont hgcont hgsurj => _)
    let g₁ : (CompHaus.of Y) ⟶ (CompHaus.of Z) := ⟨g, hgcont⟩
    let f₁ : (projectivePresentation X).p ⟶ (CompHaus.of Z) := ⟨f, hfcont⟩
    have hg₁ : Epi g₁ := (epi_iff_surjective _).2 hgsurj
    refine' ⟨Projective.factorThru f₁ g₁, (Projective.factorThru f₁ g₁).2, funext (fun _ => _)⟩
    

Proof state:
X : CompHaus
Y Z : Type ?u.35564
x✝⁶ : TopologicalSpace Y
x✝⁵ : TopologicalSpace Z
x✝⁴ : CompactSpace Y
x✝³ : T2Space Y
x✝² : CompactSpace Z
x✝¹ : T2Space Z
f : ↑(projectivePresentation X).p.toTop → Z
g : Y → Z
hfcont : Continuous f
hgcont : Continuous g
hgsurj : Function.Surjective g
g₁ : of Y ⟶ of Z := ContinuousMap.mk g
f₁ : (projectivePresentation X).p ⟶ of Z := ContinuousMap.mk f
hg₁ : Epi g₁
x✝ : ↑(projectivePresentation X).p.toTop
⊢ (g ∘ ⇑(Projective.factorThru f₁ g₁)) x✝ = f x✝

Next tactic:
change (Projective.factorThru f₁ g₁ ≫ g₁) _ = f _