Theorem: TopologicalSpace.nhds_generateFrom
File: Mathlib/Topology/Order.lean

tactic: letI := generateFrom g
state_before: α : Type u
g : Set (Set α)
a : α
⊢ 𝓝 a = ⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s

tactic: rw [nhds_def]
state_before: α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
⊢ 𝓝 a = ⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s

tactic: refine le_antisymm (biInf_mono fun s ⟨as, sg⟩ => ⟨as, .basic _ sg⟩) ?_
state_before: α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ IsOpen s}), 𝓟 s) = ⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s

tactic: refine le_iInf₂ fun s ⟨ha, hs⟩ => ?_
state_before: α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ ⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ IsOpen s}), 𝓟 s

tactic: clear ‹s ∈ { s | a ∈ s ∧ IsOpen s }›
state_before: α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s : Set α
x✝ : s ∈ {s | a ∈ s ∧ IsOpen s}
ha : a ∈ s
hs : IsOpen s
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s

tactic: induction hs
state_before: α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s : Set α
ha : a ∈ s
hs : IsOpen s
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s

tactic: case basic hs => exact iInf₂_le _ ⟨ha, hs⟩
state_before: case basic
α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s s✝ : Set α
a✝ : s✝ ∈ g
ha : a ∈ s✝
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s✝

case univ
α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s : Set α
ha : a ∈ univ
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 univ

case inter
α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s s✝ t✝ : Set α
a✝¹ : GenerateOpen g s✝
a✝ : GenerateOpen g t✝
a_ih✝¹ : a ∈ s✝ → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s✝
a_ih✝ : a ∈ t✝ → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 t✝
ha : a ∈ s✝ ∩ t✝
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 (s✝ ∩ t✝)

case sUnion
α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s : Set α
S✝ : Set (Set α)
a✝ : ∀ (s : Set α), s ∈ S✝ → GenerateOpen g s
a_ih✝ : ∀ (s : Set α), s ∈ S✝ → a ∈ s → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s
ha : a ∈ ⋃₀ S✝
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 (⋃₀ S✝)

tactic: case univ => exact le_top.trans_eq principal_univ.symm
state_before: case univ
α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s : Set α
ha : a ∈ univ
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 univ

case inter
α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s s✝ t✝ : Set α
a✝¹ : GenerateOpen g s✝
a✝ : GenerateOpen g t✝
a_ih✝¹ : a ∈ s✝ → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s✝
a_ih✝ : a ∈ t✝ → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 t✝
ha : a ∈ s✝ ∩ t✝
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 (s✝ ∩ t✝)

case sUnion
α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s : Set α
S✝ : Set (Set α)
a✝ : ∀ (s : Set α), s ∈ S✝ → GenerateOpen g s
a_ih✝ : ∀ (s : Set α), s ∈ S✝ → a ∈ s → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s
ha : a ∈ ⋃₀ S✝
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 (⋃₀ S✝)

tactic: case inter hs ht => exact (le_inf (hs ha.1) (ht ha.2)).trans_eq inf_principal
state_before: case inter
α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s s✝ t✝ : Set α
a✝¹ : GenerateOpen g s✝
a✝ : GenerateOpen g t✝
a_ih✝¹ : a ∈ s✝ → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s✝
a_ih✝ : a ∈ t✝ → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 t✝
ha : a ∈ s✝ ∩ t✝
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 (s✝ ∩ t✝)

case sUnion
α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s : Set α
S✝ : Set (Set α)
a✝ : ∀ (s : Set α), s ∈ S✝ → GenerateOpen g s
a_ih✝ : ∀ (s : Set α), s ∈ S✝ → a ∈ s → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s
ha : a ∈ ⋃₀ S✝
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 (⋃₀ S✝)

tactic: case sUnion _S hS =>
  let ⟨t, htS, hat⟩ := ha
  exact (hS t htS hat).trans (principal_mono.2 <| subset_sUnion_of_mem htS)
state_before: case sUnion
α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s : Set α
S✝ : Set (Set α)
a✝ : ∀ (s : Set α), s ∈ S✝ → GenerateOpen g s
a_ih✝ : ∀ (s : Set α), s ∈ S✝ → a ∈ s → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s
ha : a ∈ ⋃₀ S✝
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 (⋃₀ S✝)

tactic: exact iInf₂_le _ ⟨ha, hs⟩
state_before: α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s s✝ : Set α
hs : s✝ ∈ g
ha : a ∈ s✝
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s✝

tactic: exact le_top.trans_eq principal_univ.symm
state_before: α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s : Set α
ha : a ∈ univ
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 univ

tactic: exact (le_inf (hs ha.1) (ht ha.2)).trans_eq inf_principal
state_before: α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s s✝ t✝ : Set α
a✝¹ : GenerateOpen g s✝
a✝ : GenerateOpen g t✝
hs : a ∈ s✝ → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s✝
ht : a ∈ t✝ → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 t✝
ha : a ∈ s✝ ∩ t✝
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 (s✝ ∩ t✝)

tactic: let ⟨t, htS, hat⟩ := ha
state_before: α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s : Set α
S✝ : Set (Set α)
_S : ∀ (s : Set α), s ∈ S✝ → GenerateOpen g s
hS : ∀ (s : Set α), s ∈ S✝ → a ∈ s → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s
ha : a ∈ ⋃₀ S✝
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 (⋃₀ S✝)

tactic: exact (hS t htS hat).trans (principal_mono.2 <| subset_sUnion_of_mem htS)
state_before: α : Type u
g : Set (Set α)
a : α
this : TopologicalSpace α := generateFrom g
s : Set α
S✝ : Set (Set α)
_S : ∀ (s : Set α), s ∈ S✝ → GenerateOpen g s
hS : ∀ (s : Set α), s ∈ S✝ → a ∈ s → (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 s
ha : a ∈ ⋃₀ S✝
t : Set α
htS : t ∈ S✝
hat : a ∈ t
⊢ (⨅ (s : Set α) (_ : s ∈ {s | a ∈ s ∧ s ∈ g}), 𝓟 s) ≤ 𝓟 (⋃₀ S✝)