-- Mathlib/Topology/Compactness/Lindelof.lean
theorem isLindelof_open_iff_eq_countable_iUnion_of_isTopologicalBasis (b : ι → Set X)
    (hb : IsTopologicalBasis (Set.range b)) (hb' : ∀ i, IsLindelof (b i)) (U : Set X) :
    IsLindelof U ∧ IsOpen U ↔ ∃ s : Set ι, s.Countable ∧ U = ⋃ i ∈ s, b i

Proof state:
case mp.intro.intro.intro.intro.intro.refine_2.h
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f' : Y → ι
h₁ : IsLindelof (⋃ i, (b ∘ f') i)
h₂ : IsOpen (⋃ i, (b ∘ f') i)
hf' : ∀ (i : Y), b (f' i) = (b ∘ f') i
t : Set Y
ht : t.Countable ∧ ⋃ i, (b ∘ f') i ⊆ ⋃ i ∈ t, (b ∘ f') i
⊢ ∀ i ∈ f' '' t, b i ⊆ ⋃ i, (b ∘ f') i

Tactic:
rintro i hi

Result:
case mp.intro.intro.intro.intro.intro.refine_2.h
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f' : Y → ι
h₁ : IsLindelof (⋃ i, (b ∘ f') i)
h₂ : IsOpen (⋃ i, (b ∘ f') i)
hf' : ∀ (i : Y), b (f' i) = (b ∘ f') i
t : Set Y
ht : t.Countable ∧ ⋃ i, (b ∘ f') i ⊆ ⋃ i ∈ t, (b ∘ f') i
i : ι
hi : i ∈ f' '' t
⊢ b i ⊆ ⋃ i, (b ∘ f') i

Proof state:
case mp.intro.intro.intro.intro.intro
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f' : Y → ι
h₁ : IsLindelof (⋃ i, (b ∘ f') i)
h₂ : IsOpen (⋃ i, (b ∘ f') i)
hf' : ∀ (i : Y), b (f' i) = (b ∘ f') i
t : Set Y
ht : t.Countable ∧ ⋃ i, (b ∘ f') i ⊆ ⋃ i ∈ t, (b ∘ f') i
⊢ ∃ s, s.Countable ∧ ⋃ i, (b ∘ f') i = ⋃ i ∈ s, b i

Tactic:
refine ⟨t.image f', Countable.image (ht.1) f', le_antisymm ?_ ?_⟩

Result:
case mp.intro.intro.intro.intro.intro.refine_1
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f' : Y → ι
h₁ : IsLindelof (⋃ i, (b ∘ f') i)
h₂ : IsOpen (⋃ i, (b ∘ f') i)
hf' : ∀ (i : Y), b (f' i) = (b ∘ f') i
t : Set Y
ht : t.Countable ∧ ⋃ i, (b ∘ f') i ⊆ ⋃ i ∈ t, (b ∘ f') i
⊢ ⋃ i, (b ∘ f') i ≤ ⋃ i ∈ f' '' t, b i

case mp.intro.intro.intro.intro.intro.refine_2
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f' : Y → ι
h₁ : IsLindelof (⋃ i, (b ∘ f') i)
h₂ : IsOpen (⋃ i, (b ∘ f') i)
hf' : ∀ (i : Y), b (f' i) = (b ∘ f') i
t : Set Y
ht : t.Countable ∧ ⋃ i, (b ∘ f') i ⊆ ⋃ i ∈ t, (b ∘ f') i
⊢ ⋃ i ∈ f' '' t, b i ≤ ⋃ i, (b ∘ f') i

Proof state:
case mpr.intro.intro.left
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
s : Set ι
hs : s.Countable
⊢ IsLindelof (⋃ i ∈ s, b i)

Tactic:
exact hs.isLindelof_biUnion fun i _ => hb' i

Result:
no goals

Proof state:
case mpr.intro.intro.right
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
s : Set ι
hs : s.Countable
⊢ IsOpen (⋃ i ∈ s, b i)

Tactic:
exact isOpen_biUnion fun i _ => hb.isOpen (Set.mem_range_self _)

Result:
no goals

Proof state:
case mp.intro.intro.intro.intro.intro.refine_2.h
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f' : Y → ι
h₁ : IsLindelof (⋃ i, (b ∘ f') i)
h₂ : IsOpen (⋃ i, (b ∘ f') i)
hf' : ∀ (i : Y), b (f' i) = (b ∘ f') i
t : Set Y
ht : t.Countable ∧ ⋃ i, (b ∘ f') i ⊆ ⋃ i ∈ t, (b ∘ f') i
i : ι
hi : i ∈ f' '' t
⊢ b i ⊆ ⋃ i, (b ∘ f') i

Tactic:
obtain ⟨j, -, rfl⟩ := (mem_image ..).mp hi

Result:
case mp.intro.intro.intro.intro.intro.refine_2.h.intro.intro
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f' : Y → ι
h₁ : IsLindelof (⋃ i, (b ∘ f') i)
h₂ : IsOpen (⋃ i, (b ∘ f') i)
hf' : ∀ (i : Y), b (f' i) = (b ∘ f') i
t : Set Y
ht : t.Countable ∧ ⋃ i, (b ∘ f') i ⊆ ⋃ i ∈ t, (b ∘ f') i
j : Y
hi : f' j ∈ f' '' t
⊢ b (f' j) ⊆ ⋃ i, (b ∘ f') i

Proof state:
case mp.intro
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
U : Set X
h₁ : IsLindelof U
h₂ : IsOpen U
⊢ ∃ s, s.Countable ∧ U = ⋃ i ∈ s, b i

Tactic:
obtain ⟨Y, f, rfl, hf⟩ := hb.open_eq_iUnion h₂

Result:
case mp.intro.intro.intro.intro
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f : Y → Set X
hf : ∀ (i : Y), f i ∈ range b
h₁ : IsLindelof (⋃ i, f i)
h₂ : IsOpen (⋃ i, f i)
⊢ ∃ s, s.Countable ∧ ⋃ i, f i = ⋃ i ∈ s, b i

Proof state:
case mpr
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
U : Set X
⊢ (∃ s, s.Countable ∧ U = ⋃ i ∈ s, b i) → IsLindelof U ∧ IsOpen U

Tactic:
rintro ⟨s, hs, rfl⟩

Result:
case mpr.intro.intro
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
s : Set ι
hs : s.Countable
⊢ IsLindelof (⋃ i ∈ s, b i) ∧ IsOpen (⋃ i ∈ s, b i)

Proof state:
case mp.intro.intro.intro.intro.intro.refine_2.h.intro.intro
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f' : Y → ι
h₁ : IsLindelof (⋃ i, (b ∘ f') i)
h₂ : IsOpen (⋃ i, (b ∘ f') i)
hf' : ∀ (i : Y), b (f' i) = (b ∘ f') i
t : Set Y
ht : t.Countable ∧ ⋃ i, (b ∘ f') i ⊆ ⋃ i ∈ t, (b ∘ f') i
j : Y
hi : f' j ∈ f' '' t
⊢ b (f' j) ⊆ ⋃ i, (b ∘ f') i

Tactic:
exact Set.subset_iUnion (b ∘ f') j

Result:
no goals

Proof state:
case mp.intro.intro.intro.intro
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f : Y → Set X
h₁ : IsLindelof (⋃ i, f i)
h₂ : IsOpen (⋃ i, f i)
f' : Y → ι
hf' : ∀ (i : Y), b (f' i) = f i
⊢ ∃ s, s.Countable ∧ ⋃ i, f i = ⋃ i ∈ s, b i

Tactic:
have : b ∘ f' = f := funext hf'

Result:
case mp.intro.intro.intro.intro
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f : Y → Set X
h₁ : IsLindelof (⋃ i, f i)
h₂ : IsOpen (⋃ i, f i)
f' : Y → ι
hf' : ∀ (i : Y), b (f' i) = f i
this : b ∘ f' = f
⊢ ∃ s, s.Countable ∧ ⋃ i, f i = ⋃ i ∈ s, b i

Proof state:
case mp.intro.intro.intro.intro.intro.refine_1
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f' : Y → ι
h₁ : IsLindelof (⋃ i, (b ∘ f') i)
h₂ : IsOpen (⋃ i, (b ∘ f') i)
hf' : ∀ (i : Y), b (f' i) = (b ∘ f') i
t : Set Y
ht : t.Countable ∧ ⋃ i, (b ∘ f') i ⊆ ⋃ i ∈ t, (b ∘ f') i
⊢ ⋃ i ∈ t, (b ∘ f') i ⊆ ⋃ i ∈ f' '' t, b i

Tactic:
simp only [Set.iUnion_subset_iff]

Result:
case mp.intro.intro.intro.intro.intro.refine_1
X : Type u
ι : Type u_1
inst✝ : TopologicalSpace X
b : ι → Set X
hb : IsTopologicalBasis (range b)
hb' : ∀ (i : ι), IsLindelof (b i)
Y : Type u
f' : Y → ι
h₁ : IsLindelof (⋃ i, (b ∘ f') i)
h₂ : IsOpen (⋃ i, (b ∘ f') i)
hf' : ∀ (i : Y), b (f' i) = (b ∘ f') i
t : Set Y
ht : t.Countable ∧ ⋃ i, (b ∘ f') i ⊆ ⋃ i ∈ t, (b ∘ f') i
⊢ ∀ i ∈ t, (b ∘ f') i ⊆ ⋃ i ∈ f' '' t, b i