-- Mathlib/Topology/MetricSpace/Polish.lean
theorem IsClopenable.iUnion [t : TopologicalSpace α] [PolishSpace α] {s : ℕ → Set α}
    (hs : ∀ n, IsClopenable (s n)) : IsClopenable (⋃ n, s n)

Proof state:
case h
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
n : ℕ
⊢ IsOpen (s n)

Tactic:
apply t'm n

Result:
case h.a
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
n : ℕ
⊢ IsOpen (s n)

Proof state:
case intro.intro.intro.intro.intro.intro.intro
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
A : IsOpen (⋃ n, s n)
t'' : TopologicalSpace α
t''_le : t'' ≤ t'
t''_polish : PolishSpace α
h1 : IsClosed (⋃ n, s n)
h2 : IsOpen (⋃ n, s n)
⊢ IsClopenable (⋃ n, s n)

Tactic:
exact ⟨t'', t''_le.trans ((t'm 0).trans (mt 0)), t''_polish, h1, h2⟩

Result:
no goals

Proof state:
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
hs : ∀ (n : ℕ), IsClopenable (s n)
⊢ IsClopenable (⋃ n, s n)

Tactic:
choose m mt m_polish _ m_open using hs

Result:
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
⊢ IsClopenable (⋃ n, s n)

Proof state:
case intro.intro.intro
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
A : IsOpen (⋃ n, s n)
⊢ IsClopenable (⋃ n, s n)

Tactic:
obtain ⟨t'', t''_le, t''_polish, h1, h2⟩ : ∃ t'' : TopologicalSpace α,
    t'' ≤ t' ∧ @PolishSpace α t'' ∧ IsClosed[t''] (⋃ n, s n) ∧ IsOpen[t''] (⋃ n, s n) :=
  @IsOpen.isClopenable α t' t'_polish _ A

Result:
case intro.intro.intro.intro.intro.intro.intro
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
A : IsOpen (⋃ n, s n)
t'' : TopologicalSpace α
t''_le : t'' ≤ t'
t''_polish : PolishSpace α
h1 : IsClosed (⋃ n, s n)
h2 : IsOpen (⋃ n, s n)
⊢ IsClopenable (⋃ n, s n)

Proof state:
case h
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
⊢ ∀ (i : ℕ), IsOpen (s i)

Tactic:
intro n

Result:
case h
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
n : ℕ
⊢ IsOpen (s n)

Proof state:
case h.a
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
n : ℕ
⊢ IsOpen (s n)

Tactic:
exact m_open n

Result:
no goals

Proof state:
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
⊢ IsOpen (⋃ n, s n)

Tactic:
apply isOpen_iUnion

Result:
case h
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
⊢ ∀ (i : ℕ), IsOpen (s i)

Proof state:
case intro.intro.intro
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
⊢ IsClopenable (⋃ n, s n)

Tactic:
have A : IsOpen[t'] (⋃ n, s n) := by
  apply isOpen_iUnion
  intro n
  apply t'm n
  exact m_open n

Result:
case intro.intro.intro
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
A : IsOpen (⋃ n, s n)
⊢ IsClopenable (⋃ n, s n)

Proof state:
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
⊢ IsClopenable (⋃ n, s n)

Tactic:
obtain ⟨t', t'm, -, t'_polish⟩ :
    ∃ t' : TopologicalSpace α, (∀ n : ℕ, t' ≤ m n) ∧ t' ≤ t ∧ @PolishSpace α t' :=
  exists_polishSpace_forall_le m mt m_polish

Result:
case intro.intro.intro
α : Type u_1
t : TopologicalSpace α
inst✝ : PolishSpace α
s : ℕ → Set α
m : ℕ → TopologicalSpace α
mt : ∀ (n : ℕ), m n ≤ t
m_polish : ∀ (n : ℕ), PolishSpace α
h✝ : ∀ (n : ℕ), IsClosed (s n)
m_open : ∀ (n : ℕ), IsOpen (s n)
t' : TopologicalSpace α
t'm : ∀ (n : ℕ), t' ≤ m n
t'_polish : PolishSpace α
⊢ IsClopenable (⋃ n, s n)