l3lab/ntp-mathlib huggingface dataset:
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  

Proof state:
case intro
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
⊢ generateFrom {t | ∃ s i, (∀ a ∈ i, s a ∈ g a) ∧ t = Set.pi (↑i) s} =
    generateFrom {t | ∃ s, (∀ (a : ι), s a ∈ g a) ∧ t = Set.pi univ s}

Next tactic:
refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · 

Proof state:
case intro.refine'_1
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
⊢ {t | ∃ s, (∀ (a : ι), s a ∈ g a) ∧ t = Set.pi univ s} ⊆ {t | ∃ s i, (∀ a ∈ i, s a ∈ g a) ∧ t = Set.pi (↑i) s}

Next tactic:
exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by simp [ht, Eq]⟩
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by 

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
s : Set ((i : ι) → π i)
x✝ : s ∈ {t | ∃ s, (∀ (a : ι), s a ∈ g a) ∧ t = Set.pi univ s}
t : (a : ι) → Set (π a)
ht : ∀ (a : ι), t a ∈ g a
Eq : s = Set.pi univ t
⊢ (∀ a ∈ Finset.univ, t a ∈ g a) ∧ s = Set.pi (↑Finset.univ) t

Next tactic:
simp [ht, Eq]
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by simp [ht, Eq]⟩
  · 

Proof state:
case intro.refine'_2
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
⊢ ∀ s ∈ {t | ∃ s i, (∀ a ∈ i, s a ∈ g a) ∧ t = Set.pi (↑i) s}, IsOpen s

Next tactic:
rintro s ⟨t, i, ht, rfl⟩
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by simp [ht, Eq]⟩
  · rintro s ⟨t, i, ht, rfl⟩
    

Proof state:
case intro.refine'_2.intro.intro.intro
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
t : (a : ι) → Set (π a)
i : Finset ι
ht : ∀ a ∈ i, t a ∈ g a
⊢ IsOpen (Set.pi (↑i) t)

Next tactic:
letI := generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s }
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by simp [ht, Eq]⟩
  · rintro s ⟨t, i, ht, rfl⟩
    letI := generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s }
    

Proof state:
case intro.refine'_2.intro.intro.intro
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
t : (a : ι) → Set (π a)
i : Finset ι
ht : ∀ a ∈ i, t a ∈ g a
this : TopologicalSpace ((i : ι) → π i) := generateFrom {t | ∃ s, (∀ (a : ι), s a ∈ g a) ∧ t = Set.pi univ s}
⊢ IsOpen (Set.pi (↑i) t)

Next tactic:
refine isOpen_iff_forall_mem_open.2 fun f hf => ?_
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by simp [ht, Eq]⟩
  · rintro s ⟨t, i, ht, rfl⟩
    letI := generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s }
    refine isOpen_iff_forall_mem_open.2 fun f hf => ?_
    

Proof state:
case intro.refine'_2.intro.intro.intro
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f✝ : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
t : (a : ι) → Set (π a)
i : Finset ι
ht : ∀ a ∈ i, t a ∈ g a
this : TopologicalSpace ((i : ι) → π i) := generateFrom {t | ∃ s, (∀ (a : ι), s a ∈ g a) ∧ t = Set.pi univ s}
f : (i : ι) → π i
hf : f ∈ Set.pi (↑i) t
⊢ ∃ t_1 ⊆ Set.pi (↑i) t, IsOpen t_1 ∧ f ∈ t_1

Next tactic:
choose c hcg hfc using fun a => sUnion_eq_univ_iff.1 (hg a) (f a)
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by simp [ht, Eq]⟩
  · rintro s ⟨t, i, ht, rfl⟩
    letI := generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s }
    refine isOpen_iff_forall_mem_open.2 fun f hf => ?_
    choose c hcg hfc using fun a => sUnion_eq_univ_iff.1 (hg a) (f a)
    

Proof state:
case intro.refine'_2.intro.intro.intro
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f✝ : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
t : (a : ι) → Set (π a)
i : Finset ι
ht : ∀ a ∈ i, t a ∈ g a
this : TopologicalSpace ((i : ι) → π i) := generateFrom {t | ∃ s, (∀ (a : ι), s a ∈ g a) ∧ t = Set.pi univ s}
f : (i : ι) → π i
hf : f ∈ Set.pi (↑i) t
c : (a : ι) → Set (π a)
hcg : ∀ (a : ι), c a ∈ g a
hfc : ∀ (a : ι), f a ∈ c a
⊢ ∃ t_1 ⊆ Set.pi (↑i) t, IsOpen t_1 ∧ f ∈ t_1

Next tactic:
refine ⟨pi i t ∩ pi ((↑i)ᶜ : Set ι) c, inter_subset_left _ _, ?_, ⟨hf, fun a _ => hfc a⟩⟩
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by simp [ht, Eq]⟩
  · rintro s ⟨t, i, ht, rfl⟩
    letI := generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s }
    refine isOpen_iff_forall_mem_open.2 fun f hf => ?_
    choose c hcg hfc using fun a => sUnion_eq_univ_iff.1 (hg a) (f a)
    refine ⟨pi i t ∩ pi ((↑i)ᶜ : Set ι) c, inter_subset_left _ _, ?_, ⟨hf, fun a _ => hfc a⟩⟩
    

Proof state:
case intro.refine'_2.intro.intro.intro
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f✝ : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
t : (a : ι) → Set (π a)
i : Finset ι
ht : ∀ a ∈ i, t a ∈ g a
this : TopologicalSpace ((i : ι) → π i) := generateFrom {t | ∃ s, (∀ (a : ι), s a ∈ g a) ∧ t = Set.pi univ s}
f : (i : ι) → π i
hf : f ∈ Set.pi (↑i) t
c : (a : ι) → Set (π a)
hcg : ∀ (a : ι), c a ∈ g a
hfc : ∀ (a : ι), f a ∈ c a
⊢ IsOpen (Set.pi (↑i) t ∩ Set.pi (↑i)ᶜ c)

Next tactic:
rw [← univ_pi_piecewise]
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by simp [ht, Eq]⟩
  · rintro s ⟨t, i, ht, rfl⟩
    letI := generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s }
    refine isOpen_iff_forall_mem_open.2 fun f hf => ?_
    choose c hcg hfc using fun a => sUnion_eq_univ_iff.1 (hg a) (f a)
    refine ⟨pi i t ∩ pi ((↑i)ᶜ : Set ι) c, inter_subset_left _ _, ?_, ⟨hf, fun a _ => hfc a⟩⟩
    rw [← univ_pi_piecewise]
    

Proof state:
case intro.refine'_2.intro.intro.intro
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f✝ : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
t : (a : ι) → Set (π a)
i : Finset ι
ht : ∀ a ∈ i, t a ∈ g a
this : TopologicalSpace ((i : ι) → π i) := generateFrom {t | ∃ s, (∀ (a : ι), s a ∈ g a) ∧ t = Set.pi univ s}
f : (i : ι) → π i
hf : f ∈ Set.pi (↑i) t
c : (a : ι) → Set (π a)
hcg : ∀ (a : ι), c a ∈ g a
hfc : ∀ (a : ι), f a ∈ c a
⊢ IsOpen (Set.pi univ (piecewise (↑i) t c))

Next tactic:
refine GenerateOpen.basic _ ⟨_, fun a => ?_, rfl⟩
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by simp [ht, Eq]⟩
  · rintro s ⟨t, i, ht, rfl⟩
    letI := generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s }
    refine isOpen_iff_forall_mem_open.2 fun f hf => ?_
    choose c hcg hfc using fun a => sUnion_eq_univ_iff.1 (hg a) (f a)
    refine ⟨pi i t ∩ pi ((↑i)ᶜ : Set ι) c, inter_subset_left _ _, ?_, ⟨hf, fun a _ => hfc a⟩⟩
    rw [← univ_pi_piecewise]
    refine GenerateOpen.basic _ ⟨_, fun a => ?_, rfl⟩
    

Proof state:
case intro.refine'_2.intro.intro.intro
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f✝ : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
t : (a : ι) → Set (π a)
i : Finset ι
ht : ∀ a ∈ i, t a ∈ g a
this : TopologicalSpace ((i : ι) → π i) := generateFrom {t | ∃ s, (∀ (a : ι), s a ∈ g a) ∧ t = Set.pi univ s}
f : (i : ι) → π i
hf : f ∈ Set.pi (↑i) t
c : (a : ι) → Set (π a)
hcg : ∀ (a : ι), c a ∈ g a
hfc : ∀ (a : ι), f a ∈ c a
a : ι
⊢ piecewise (↑i) t c a ∈ g a

Next tactic:
by_cases a ∈ i
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by simp [ht, Eq]⟩
  · rintro s ⟨t, i, ht, rfl⟩
    letI := generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s }
    refine isOpen_iff_forall_mem_open.2 fun f hf => ?_
    choose c hcg hfc using fun a => sUnion_eq_univ_iff.1 (hg a) (f a)
    refine ⟨pi i t ∩ pi ((↑i)ᶜ : Set ι) c, inter_subset_left _ _, ?_, ⟨hf, fun a _ => hfc a⟩⟩
    rw [← univ_pi_piecewise]
    refine GenerateOpen.basic _ ⟨_, fun a => ?_, rfl⟩
    by_cases a ∈ i <;> 

Proof state:
case pos
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f✝ : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
t : (a : ι) → Set (π a)
i : Finset ι
ht : ∀ a ∈ i, t a ∈ g a
this : TopologicalSpace ((i : ι) → π i) := generateFrom {t | ∃ s, (∀ (a : ι), s a ∈ g a) ∧ t = Set.pi univ s}
f : (i : ι) → π i
hf : f ∈ Set.pi (↑i) t
c : (a : ι) → Set (π a)
hcg : ∀ (a : ι), c a ∈ g a
hfc : ∀ (a : ι), f a ∈ c a
a : ι
h✝ : a ∈ i
⊢ piecewise (↑i) t c a ∈ g a

Next tactic:
simp [*]
theorem pi_generateFrom_eq_finite {π : ι → Type*} {g : ∀ a, Set (Set (π a))} [Finite ι]
    (hg : ∀ a, ⋃₀ g a = univ) :
    (@Pi.topologicalSpace ι π fun a => generateFrom (g a)) =
      generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s } := by
  cases nonempty_fintype ι
  rw [pi_generateFrom_eq]
  refine' le_antisymm (generateFrom_anti _) (le_generateFrom _)
  · exact fun s ⟨t, ht, Eq⟩ => ⟨t, Finset.univ, by simp [ht, Eq]⟩
  · rintro s ⟨t, i, ht, rfl⟩
    letI := generateFrom { t | ∃ s : ∀ a, Set (π a), (∀ a, s a ∈ g a) ∧ t = pi univ s }
    refine isOpen_iff_forall_mem_open.2 fun f hf => ?_
    choose c hcg hfc using fun a => sUnion_eq_univ_iff.1 (hg a) (f a)
    refine ⟨pi i t ∩ pi ((↑i)ᶜ : Set ι) c, inter_subset_left _ _, ?_, ⟨hf, fun a _ => hfc a⟩⟩
    rw [← univ_pi_piecewise]
    refine GenerateOpen.basic _ ⟨_, fun a => ?_, rfl⟩
    by_cases a ∈ i <;> 

Proof state:
case neg
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π✝ : ι → Type u_6
κ : Type u_7
inst✝¹ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π✝ i)
f✝ : α → (i : ι) → π✝ i
π : ι → Type u_8
g : (a : ι) → Set (Set (π a))
inst✝ : Finite ι
hg : ∀ (a : ι), ⋃₀ g a = univ
val✝ : Fintype ι
t : (a : ι) → Set (π a)
i : Finset ι
ht : ∀ a ∈ i, t a ∈ g a
this : TopologicalSpace ((i : ι) → π i) := generateFrom {t | ∃ s, (∀ (a : ι), s a ∈ g a) ∧ t = Set.pi univ s}
f : (i : ι) → π i
hf : f ∈ Set.pi (↑i) t
c : (a : ι) → Set (π a)
hcg : ∀ (a : ι), c a ∈ g a
hfc : ∀ (a : ι), f a ∈ c a
a : ι
h✝ : a ∉ i
⊢ piecewise (↑i) t c a ∈ g a

Next tactic:
simp [*]
theorem induced_to_pi {X : Type*} (f : X → ∀ i, π i) :
    induced f Pi.topologicalSpace = ⨅ i, induced (f · i) inferInstance := by
  

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π : ι → Type u_6
κ : Type u_7
inst✝ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π i)
f✝ : α → (i : ι) → π i
X : Type u_8
f : X → (i : ι) → π i
⊢ induced f Pi.topologicalSpace = ⨅ i, induced (fun x => f x i) inferInstance

Next tactic:
erw [induced_iInf]
theorem induced_to_pi {X : Type*} (f : X → ∀ i, π i) :
    induced f Pi.topologicalSpace = ⨅ i, induced (f · i) inferInstance := by
  erw [induced_iInf]
  

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π : ι → Type u_6
κ : Type u_7
inst✝ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π i)
f✝ : α → (i : ι) → π i
X : Type u_8
f : X → (i : ι) → π i
⊢ ⨅ i, induced f (induced (fun f => f i) ((fun a => T a) i)) = ⨅ i, induced (fun x => f x i) inferInstance

Next tactic:
simp only [induced_compose]
theorem induced_to_pi {X : Type*} (f : X → ∀ i, π i) :
    induced f Pi.topologicalSpace = ⨅ i, induced (f · i) inferInstance := by
  erw [induced_iInf]
  simp only [induced_compose]
  

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π : ι → Type u_6
κ : Type u_7
inst✝ : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π i)
f✝ : α → (i : ι) → π i
X : Type u_8
f : X → (i : ι) → π i
⊢ ⨅ i, induced ((fun f => f i) ∘ f) (T i) = ⨅ i, induced (fun x => f x i) inferInstance

Next tactic:
rfl
/-- A finite product of discrete spaces is discrete. -/
instance Pi.discreteTopology : DiscreteTopology (∀ i, π i) :=
  singletons_open_iff_discrete.mp fun x => by
    

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π : ι → Type u_6
κ : Type u_7
inst✝² : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π i)
f : α → (i : ι) → π i
inst✝¹ : Finite ι
inst✝ : ∀ (i : ι), DiscreteTopology (π i)
x : (i : ι) → π i
⊢ IsOpen {x}

Next tactic:
rw [← univ_pi_singleton]
/-- A finite product of discrete spaces is discrete. -/
instance Pi.discreteTopology : DiscreteTopology (∀ i, π i) :=
  singletons_open_iff_discrete.mp fun x => by
    rw [← univ_pi_singleton]
    

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
π : ι → Type u_6
κ : Type u_7
inst✝² : TopologicalSpace α
T : (i : ι) → TopologicalSpace (π i)
f : α → (i : ι) → π i
inst✝¹ : Finite ι
inst✝ : ∀ (i : ι), DiscreteTopology (π i)
x : (i : ι) → π i
⊢ IsOpen (Set.pi univ fun i => {x i})

Next tactic:
exact isOpen_set_pi finite_univ fun i _ => (isOpen_discrete {x i})
theorem isOpen_sigma_iff {s : Set (Sigma σ)} : IsOpen s ↔ ∀ i, IsOpen (Sigma.mk i ⁻¹' s) := by
  

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
κ : Type u_6
σ : ι → Type u_7
τ : κ → Type u_8
inst✝² : (i : ι) → TopologicalSpace (σ i)
inst✝¹ : (k : κ) → TopologicalSpace (τ k)
inst✝ : TopologicalSpace α
s : Set (Sigma σ)
⊢ IsOpen s ↔ ∀ (i : ι), IsOpen (Sigma.mk i ⁻¹' s)

Next tactic:
delta instTopologicalSpaceSigma
theorem isOpen_sigma_iff {s : Set (Sigma σ)} : IsOpen s ↔ ∀ i, IsOpen (Sigma.mk i ⁻¹' s) := by
  delta instTopologicalSpaceSigma
  

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
κ : Type u_6
σ : ι → Type u_7
τ : κ → Type u_8
inst✝² : (i : ι) → TopologicalSpace (σ i)
inst✝¹ : (k : κ) → TopologicalSpace (τ k)
inst✝ : TopologicalSpace α
s : Set (Sigma σ)
⊢ IsOpen s ↔ ∀ (i : ι), IsOpen (Sigma.mk i ⁻¹' s)

Next tactic:
rw [isOpen_iSup_iff]
theorem isOpen_sigma_iff {s : Set (Sigma σ)} : IsOpen s ↔ ∀ i, IsOpen (Sigma.mk i ⁻¹' s) := by
  delta instTopologicalSpaceSigma
  rw [isOpen_iSup_iff]
  

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
κ : Type u_6
σ : ι → Type u_7
τ : κ → Type u_8
inst✝² : (i : ι) → TopologicalSpace (σ i)
inst✝¹ : (k : κ) → TopologicalSpace (τ k)
inst✝ : TopologicalSpace α
s : Set (Sigma σ)
⊢ (∀ (i : ι), IsOpen s) ↔ ∀ (i : ι), IsOpen (Sigma.mk i ⁻¹' s)

Next tactic:
rfl
theorem isClosed_sigma_iff {s : Set (Sigma σ)} : IsClosed s ↔ ∀ i, IsClosed (Sigma.mk i ⁻¹' s) := by
  

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
κ : Type u_6
σ : ι → Type u_7
τ : κ → Type u_8
inst✝² : (i : ι) → TopologicalSpace (σ i)
inst✝¹ : (k : κ) → TopologicalSpace (τ k)
inst✝ : TopologicalSpace α
s : Set (Sigma σ)
⊢ IsClosed s ↔ ∀ (i : ι), IsClosed (Sigma.mk i ⁻¹' s)

Next tactic:
simp only [← isOpen_compl_iff, isOpen_sigma_iff, preimage_compl]
theorem isOpenMap_sigmaMk {i : ι} : IsOpenMap (@Sigma.mk ι σ i) := by
  

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
κ : Type u_6
σ : ι → Type u_7
τ : κ → Type u_8
inst✝² : (i : ι) → TopologicalSpace (σ i)
inst✝¹ : (k : κ) → TopologicalSpace (τ k)
inst✝ : TopologicalSpace α
i : ι
⊢ IsOpenMap (Sigma.mk i)

Next tactic:
intro s hs
theorem isOpenMap_sigmaMk {i : ι} : IsOpenMap (@Sigma.mk ι σ i) := by
  intro s hs
  

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
κ : Type u_6
σ : ι → Type u_7
τ : κ → Type u_8
inst✝² : (i : ι) → TopologicalSpace (σ i)
inst✝¹ : (k : κ) → TopologicalSpace (τ k)
inst✝ : TopologicalSpace α
i : ι
s : Set (σ i)
hs : IsOpen s
⊢ IsOpen (Sigma.mk i '' s)

Next tactic:
rw [isOpen_sigma_iff]
theorem isOpenMap_sigmaMk {i : ι} : IsOpenMap (@Sigma.mk ι σ i) := by
  intro s hs
  rw [isOpen_sigma_iff]
  

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
κ : Type u_6
σ : ι → Type u_7
τ : κ → Type u_8
inst✝² : (i : ι) → TopologicalSpace (σ i)
inst✝¹ : (k : κ) → TopologicalSpace (τ k)
inst✝ : TopologicalSpace α
i : ι
s : Set (σ i)
hs : IsOpen s
⊢ ∀ (i_1 : ι), IsOpen (Sigma.mk i_1 ⁻¹' (Sigma.mk i '' s))

Next tactic:
intro j
theorem isOpenMap_sigmaMk {i : ι} : IsOpenMap (@Sigma.mk ι σ i) := by
  intro s hs
  rw [isOpen_sigma_iff]
  intro j
  

Proof state:
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
κ : Type u_6
σ : ι → Type u_7
τ : κ → Type u_8
inst✝² : (i : ι) → TopologicalSpace (σ i)
inst✝¹ : (k : κ) → TopologicalSpace (τ k)
inst✝ : TopologicalSpace α
i : ι
s : Set (σ i)
hs : IsOpen s
j : ι
⊢ IsOpen (Sigma.mk j ⁻¹' (Sigma.mk i '' s))

Next tactic:
rcases eq_or_ne j i with (rfl | hne)
theorem isOpenMap_sigmaMk {i : ι} : IsOpenMap (@Sigma.mk ι σ i) := by
  intro s hs
  rw [isOpen_sigma_iff]
  intro j
  rcases eq_or_ne j i with (rfl | hne)
  · 

Proof state:
case inl
α : Type u
β : Type v
γ : Type u_1
δ : Type u_2
ε : Type u_3
ζ : Type u_4
ι : Type u_5
κ : Type u_6
σ : ι → Type u_7
τ : κ → Type u_8
inst✝² : (i : ι) → TopologicalSpace (σ i)
inst✝¹ : (k : κ) → TopologicalSpace (τ k)
inst✝ : TopologicalSpace α
j : ι
s : Set (σ j)
hs : IsOpen s
⊢ IsOpen (Sigma.mk j ⁻¹' (Sigma.mk j '' s))

Next tactic:
rwa [Set.preimage_image_eq _ sigma_mk_injective]