l3lab/ntp-mathlib huggingface dataset:
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  

Proof state:
X : Type u
inst✝⁵ : TopologicalSpace X
A D E : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
⊢ ∃ E, CompactSpace ↑E ∧ π '' E = univ ∧ ∀ (E₀ : Set ↑E), E₀ ≠ univ → IsClosed E₀ → restrict E π '' E₀ ≠ univ

Next tactic:
suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
    refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
    intro E₀ E₀_min E₀_closed
    contrapose! E₀_min
    exact eq_univ_of_image_val_eq <|
      E_min E₀ ⟨E₀_closed.trans E_closed, image_image_val_eq_restrict_image ▸ E₀_min⟩
        image_val_subset
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    

Proof state:
X : Type u
inst✝⁵ : TopologicalSpace X
A D E : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
this : ∀ C ⊆ S, IsChain (fun x x_1 => x ⊆ x_1) C → ∃ s ∈ S, ∀ c ∈ C, s ⊆ c
⊢ ∃ E, CompactSpace ↑E ∧ π '' E = univ ∧ ∀ (E₀ : Set ↑E), E₀ ≠ univ → IsClosed E₀ → restrict E π '' E₀ ≠ univ

Next tactic:
rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
    

Proof state:
case intro.intro.intro
X : Type u
inst✝⁵ : TopologicalSpace X
A D E✝ : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E✝
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
this : ∀ C ⊆ S, IsChain (fun x x_1 => x ⊆ x_1) C → ∃ s ∈ S, ∀ c ∈ C, s ⊆ c
E : Set D
E_min : ∀ a ∈ S, a ⊆ E → a = E
E_closed : IsClosed E
E_surj : π '' E = univ
⊢ ∃ E, CompactSpace ↑E ∧ π '' E = univ ∧ ∀ (E₀ : Set ↑E), E₀ ≠ univ → IsClosed E₀ → restrict E π '' E₀ ≠ univ

Next tactic:
refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
    refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
    

Proof state:
case intro.intro.intro
X : Type u
inst✝⁵ : TopologicalSpace X
A D E✝ : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E✝
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
this : ∀ C ⊆ S, IsChain (fun x x_1 => x ⊆ x_1) C → ∃ s ∈ S, ∀ c ∈ C, s ⊆ c
E : Set D
E_min : ∀ a ∈ S, a ⊆ E → a = E
E_closed : IsClosed E
E_surj : π '' E = univ
⊢ ∀ (E₀ : Set ↑E), E₀ ≠ univ → IsClosed E₀ → restrict E π '' E₀ ≠ univ

Next tactic:
intro E₀ E₀_min E₀_closed
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
    refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
    intro E₀ E₀_min E₀_closed
    

Proof state:
case intro.intro.intro
X : Type u
inst✝⁵ : TopologicalSpace X
A D E✝ : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E✝
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
this : ∀ C ⊆ S, IsChain (fun x x_1 => x ⊆ x_1) C → ∃ s ∈ S, ∀ c ∈ C, s ⊆ c
E : Set D
E_min : ∀ a ∈ S, a ⊆ E → a = E
E_closed : IsClosed E
E_surj : π '' E = univ
E₀ : Set ↑E
E₀_min : E₀ ≠ univ
E₀_closed : IsClosed E₀
⊢ restrict E π '' E₀ ≠ univ

Next tactic:
contrapose! E₀_min
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
    refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
    intro E₀ E₀_min E₀_closed
    contrapose! E₀_min
    

Proof state:
case intro.intro.intro
X : Type u
inst✝⁵ : TopologicalSpace X
A D E✝ : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E✝
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
this : ∀ C ⊆ S, IsChain (fun x x_1 => x ⊆ x_1) C → ∃ s ∈ S, ∀ c ∈ C, s ⊆ c
E : Set D
E_min : ∀ a ∈ S, a ⊆ E → a = E
E_closed : IsClosed E
E_surj : π '' E = univ
E₀ : Set ↑E
E₀_closed : IsClosed E₀
E₀_min : restrict E π '' E₀ = univ
⊢ E₀ = univ

Next tactic:
exact eq_univ_of_image_val_eq <|
      E_min E₀ ⟨E₀_closed.trans E_closed, image_image_val_eq_restrict_image ▸ E₀_min⟩
        image_val_subset
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
    refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
    intro E₀ E₀_min E₀_closed
    contrapose! E₀_min
    exact eq_univ_of_image_val_eq <|
      E_min E₀ ⟨E₀_closed.trans E_closed, image_image_val_eq_restrict_image ▸ E₀_min⟩
        image_val_subset
  -- suffices to prove intersection of chain is minimal
  

Proof state:
X : Type u
inst✝⁵ : TopologicalSpace X
A D E : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
⊢ ∀ C ⊆ S, IsChain (fun x x_1 => x ⊆ x_1) C → ∃ s ∈ S, ∀ c ∈ C, s ⊆ c

Next tactic:
intro C C_sub C_chain
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
    refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
    intro E₀ E₀_min E₀_closed
    contrapose! E₀_min
    exact eq_univ_of_image_val_eq <|
      E_min E₀ ⟨E₀_closed.trans E_closed, image_image_val_eq_restrict_image ▸ E₀_min⟩
        image_val_subset
  -- suffices to prove intersection of chain is minimal
  intro C C_sub C_chain
  -- prove intersection of chain is closed
  

Proof state:
X : Type u
inst✝⁵ : TopologicalSpace X
A D E : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
C : Set (Set D)
C_sub : C ⊆ S
C_chain : IsChain (fun x x_1 => x ⊆ x_1) C
⊢ ∃ s ∈ S, ∀ c ∈ C, s ⊆ c

Next tactic:
refine ⟨iInter (fun c : C => c), ⟨isClosed_iInter fun ⟨_, h⟩ => (C_sub h).left, ?_⟩,
    fun c hc _ h => mem_iInter.mp h ⟨c, hc⟩⟩
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
    refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
    intro E₀ E₀_min E₀_closed
    contrapose! E₀_min
    exact eq_univ_of_image_val_eq <|
      E_min E₀ ⟨E₀_closed.trans E_closed, image_image_val_eq_restrict_image ▸ E₀_min⟩
        image_val_subset
  -- suffices to prove intersection of chain is minimal
  intro C C_sub C_chain
  -- prove intersection of chain is closed
  refine ⟨iInter (fun c : C => c), ⟨isClosed_iInter fun ⟨_, h⟩ => (C_sub h).left, ?_⟩,
    fun c hc _ h => mem_iInter.mp h ⟨c, hc⟩⟩
  -- prove intersection of chain is mapped onto $A$
  

Proof state:
X : Type u
inst✝⁵ : TopologicalSpace X
A D E : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
C : Set (Set D)
C_sub : C ⊆ S
C_chain : IsChain (fun x x_1 => x ⊆ x_1) C
⊢ π '' ⋂ c, ↑c = univ

Next tactic:
by_cases hC : Nonempty C
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
    refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
    intro E₀ E₀_min E₀_closed
    contrapose! E₀_min
    exact eq_univ_of_image_val_eq <|
      E_min E₀ ⟨E₀_closed.trans E_closed, image_image_val_eq_restrict_image ▸ E₀_min⟩
        image_val_subset
  -- suffices to prove intersection of chain is minimal
  intro C C_sub C_chain
  -- prove intersection of chain is closed
  refine ⟨iInter (fun c : C => c), ⟨isClosed_iInter fun ⟨_, h⟩ => (C_sub h).left, ?_⟩,
    fun c hc _ h => mem_iInter.mp h ⟨c, hc⟩⟩
  -- prove intersection of chain is mapped onto $A$
  by_cases hC : Nonempty C
  · 

Proof state:
case pos
X : Type u
inst✝⁵ : TopologicalSpace X
A D E : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
C : Set (Set D)
C_sub : C ⊆ S
C_chain : IsChain (fun x x_1 => x ⊆ x_1) C
hC : Nonempty ↑C
⊢ π '' ⋂ c, ↑c = univ

Next tactic:
refine eq_univ_of_forall fun a => inter_nonempty_iff_exists_left.mp ?_
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
    refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
    intro E₀ E₀_min E₀_closed
    contrapose! E₀_min
    exact eq_univ_of_image_val_eq <|
      E_min E₀ ⟨E₀_closed.trans E_closed, image_image_val_eq_restrict_image ▸ E₀_min⟩
        image_val_subset
  -- suffices to prove intersection of chain is minimal
  intro C C_sub C_chain
  -- prove intersection of chain is closed
  refine ⟨iInter (fun c : C => c), ⟨isClosed_iInter fun ⟨_, h⟩ => (C_sub h).left, ?_⟩,
    fun c hc _ h => mem_iInter.mp h ⟨c, hc⟩⟩
  -- prove intersection of chain is mapped onto $A$
  by_cases hC : Nonempty C
  · refine eq_univ_of_forall fun a => inter_nonempty_iff_exists_left.mp ?_
    -- apply Cantor's intersection theorem
    

Proof state:
case pos
X : Type u
inst✝⁵ : TopologicalSpace X
A D E : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
C : Set (Set D)
C_sub : C ⊆ S
C_chain : IsChain (fun x x_1 => x ⊆ x_1) C
hC : Nonempty ↑C
a : A
⊢ Set.Nonempty ((⋂ c, ↑c) ∩ fun a_1 => π a_1 = a)

Next tactic:
refine iInter_inter (ι := C) (π ⁻¹' {a}) _ ▸
      IsCompact.nonempty_iInter_of_directed_nonempty_compact_closed _
      ?_ (fun c => ?_) (fun c => IsClosed.isCompact ?_) (fun c => ?_)
/-- Lemma 2.4 in [Gleason, *Projective topological spaces*][gleason1958]:
a continuous surjection $\pi$ from a compact space $D$ to a Fréchet space $A$ restricts to
a compact subset $E$ of $D$, such that $\pi$ maps $E$ onto $A$ and satisfies the
"Zorn subset condition", where $\pi(E_0) \ne A$ for any proper closed subset $E_0 \subsetneq E$. -/
lemma exists_compact_surjective_zorn_subset [T1Space A] [CompactSpace D] {π : D → A}
    (π_cont : Continuous π) (π_surj : π.Surjective) : ∃ E : Set D, CompactSpace E ∧ π '' E = univ ∧
    ∀ E₀ : Set E, E₀ ≠ univ → IsClosed E₀ → E.restrict π '' E₀ ≠ univ := by
  -- suffices to apply Zorn's lemma on the subsets of $D$ that are closed and mapped onto $A$
  let S : Set <| Set D := {E : Set D | IsClosed E ∧ π '' E = univ}
  suffices ∀ (C : Set <| Set D) (_ : C ⊆ S) (_ : IsChain (· ⊆ ·) C), ∃ s ∈ S, ∀ c ∈ C, s ⊆ c by
    rcases zorn_superset S this with ⟨E, ⟨E_closed, E_surj⟩, E_min⟩
    refine ⟨E, isCompact_iff_compactSpace.mp E_closed.isCompact, E_surj, ?_⟩
    intro E₀ E₀_min E₀_closed
    contrapose! E₀_min
    exact eq_univ_of_image_val_eq <|
      E_min E₀ ⟨E₀_closed.trans E_closed, image_image_val_eq_restrict_image ▸ E₀_min⟩
        image_val_subset
  -- suffices to prove intersection of chain is minimal
  intro C C_sub C_chain
  -- prove intersection of chain is closed
  refine ⟨iInter (fun c : C => c), ⟨isClosed_iInter fun ⟨_, h⟩ => (C_sub h).left, ?_⟩,
    fun c hc _ h => mem_iInter.mp h ⟨c, hc⟩⟩
  -- prove intersection of chain is mapped onto $A$
  by_cases hC : Nonempty C
  · refine eq_univ_of_forall fun a => inter_nonempty_iff_exists_left.mp ?_
    -- apply Cantor's intersection theorem
    refine iInter_inter (ι := C) (π ⁻¹' {a}) _ ▸
      IsCompact.nonempty_iInter_of_directed_nonempty_compact_closed _
      ?_ (fun c => ?_) (fun c => IsClosed.isCompact ?_) (fun c => ?_)
    · 

Proof state:
case pos.refine_1
X : Type u
inst✝⁵ : TopologicalSpace X
A D E : Type u
inst✝⁴ : TopologicalSpace A
inst✝³ : TopologicalSpace D
inst✝² : TopologicalSpace E
inst✝¹ : T1Space A
inst✝ : CompactSpace D
π : D → A
π_cont : Continuous π
π_surj : Surjective π
S : Set (Set D) := {E | IsClosed E ∧ π '' E = univ}
C : Set (Set D)
C_sub : C ⊆ S
C_chain : IsChain (fun x x_1 => x ⊆ x_1) C
hC : Nonempty ↑C
a : A
⊢ Directed (fun x x_1 => x ⊇ x_1) fun i => ↑i ∩ π ⁻¹' {a}

Next tactic:
replace C_chain : IsChain (· ⊇ ·) C := C_chain.symm