l3lab/ntp-mathlib huggingface dataset:
/--
A version of Riesz lemma: given a strict closed subspace `F`, one may find an element of norm `≤ R`
which is at distance at least `1` of every element of `F`. Here, `R` is any given constant
strictly larger than the norm of an element of norm `> 1`. For a version without an `R`, see
`riesz_lemma`.

Since we are considering a general nontrivially normed field, there may be a gap in possible norms
(for instance no element of norm in `(1,2)`). Hence, we can not allow `R` arbitrarily close to `1`,
and require `R > ‖c‖` for some `c : 𝕜` with norm `> 1`.
-/
theorem riesz_lemma_of_norm_lt {c : 𝕜} (hc : 1 < ‖c‖) {R : ℝ} (hR : ‖c‖ < R) {F : Subspace 𝕜 E}
    (hFc : IsClosed (F : Set E)) (hF : ∃ x : E, x ∉ F) :
    ∃ x₀ : E, ‖x₀‖ ≤ R ∧ ∀ y ∈ F, 1 ≤ ‖x₀ - y‖ := by
  have Rpos : 0 < R := (norm_nonneg _).trans_lt hR
  have : ‖c‖ / R < 1 := by
    rw [div_lt_iff Rpos]
    simpa using hR
  rcases riesz_lemma hFc hF this with ⟨x, xF, hx⟩
  have x0 : x ≠ 0 := fun H => by simp [H] at xF
  obtain ⟨d, d0, dxlt, ledx, -⟩ :
    ∃ d : 𝕜, d ≠ 0 ∧ ‖d • x‖ < R ∧ R / ‖c‖ ≤ ‖d • x‖ ∧ ‖d‖⁻¹ ≤ R⁻¹ * ‖c‖ * ‖x‖ :=
    rescale_to_shell hc Rpos x0
  refine' ⟨d • x, dxlt.le, fun y hy => _⟩
  set y' := d⁻¹ • y
  have yy' : y = d • y' := by simp [smul_smul, mul_inv_cancel d0]
  calc
    1 = ‖c‖ / R * (R / ‖c‖) := by field_simp [Rpos.ne', (zero_lt_one.trans hc).ne']
    _ ≤ ‖c‖ / R * ‖d • x‖ := by gcongr
    _ = ‖d‖ * (‖c‖ / R * ‖x‖) := by
      simp only [norm_smul]
      ring
    _ ≤ ‖d‖ * ‖x - y'‖ := by gcongr; exact hx y' (by simp [Submodule.smul_mem _ _ hy])
    _ = ‖d • x - y‖ := by 

Proof state:
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F✝ : Type u_3
inst✝¹ : SeminormedAddCommGroup F✝
inst✝ : NormedSpace ℝ F✝
c : 𝕜
hc : 1 < ‖c‖
R : ℝ
hR : ‖c‖ < R
F : Subspace 𝕜 E
hFc : IsClosed ↑F
hF : ∃ x, x ∉ F
Rpos : 0 < R
this : ‖c‖ / R < 1
x : E
xF : x ∉ F
hx : ∀ y ∈ F, ‖c‖ / R * ‖x‖ ≤ ‖x - y‖
x0 : x ≠ 0
d : 𝕜
d0 : d ≠ 0
dxlt : ‖d • x‖ < R
ledx : R / ‖c‖ ≤ ‖d • x‖
y : E
hy : y ∈ F
y' : E := d⁻¹ • y
yy' : y = d • y'
⊢ ‖d‖ * ‖x - y'‖ = ‖d • x - y‖

Next tactic:
rw [yy', ← smul_sub, norm_smul]
theorem Metric.closedBall_infDist_compl_subset_closure {x : F} {s : Set F} (hx : x ∈ s) :
    closedBall x (infDist x sᶜ) ⊆ closure s := by
  

Proof state:
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F : Type u_3
inst✝¹ : SeminormedAddCommGroup F
inst✝ : NormedSpace ℝ F
x : F
s : Set F
hx : x ∈ s
⊢ closedBall x (infDist x sᶜ) ⊆ closure s

Next tactic:
rcases eq_or_ne (infDist x sᶜ) 0 with h₀ | h₀
theorem Metric.closedBall_infDist_compl_subset_closure {x : F} {s : Set F} (hx : x ∈ s) :
    closedBall x (infDist x sᶜ) ⊆ closure s := by
  rcases eq_or_ne (infDist x sᶜ) 0 with h₀ | h₀
  · 

Proof state:
case inl
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F : Type u_3
inst✝¹ : SeminormedAddCommGroup F
inst✝ : NormedSpace ℝ F
x : F
s : Set F
hx : x ∈ s
h₀ : infDist x sᶜ = 0
⊢ closedBall x (infDist x sᶜ) ⊆ closure s

Next tactic:
rw [h₀, closedBall_zero']
theorem Metric.closedBall_infDist_compl_subset_closure {x : F} {s : Set F} (hx : x ∈ s) :
    closedBall x (infDist x sᶜ) ⊆ closure s := by
  rcases eq_or_ne (infDist x sᶜ) 0 with h₀ | h₀
  · rw [h₀, closedBall_zero']
    

Proof state:
case inl
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F : Type u_3
inst✝¹ : SeminormedAddCommGroup F
inst✝ : NormedSpace ℝ F
x : F
s : Set F
hx : x ∈ s
h₀ : infDist x sᶜ = 0
⊢ closure {x} ⊆ closure s

Next tactic:
exact closure_mono (singleton_subset_iff.2 hx)
theorem Metric.closedBall_infDist_compl_subset_closure {x : F} {s : Set F} (hx : x ∈ s) :
    closedBall x (infDist x sᶜ) ⊆ closure s := by
  rcases eq_or_ne (infDist x sᶜ) 0 with h₀ | h₀
  · rw [h₀, closedBall_zero']
    exact closure_mono (singleton_subset_iff.2 hx)
  · 

Proof state:
case inr
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F : Type u_3
inst✝¹ : SeminormedAddCommGroup F
inst✝ : NormedSpace ℝ F
x : F
s : Set F
hx : x ∈ s
h₀ : infDist x sᶜ ≠ 0
⊢ closedBall x (infDist x sᶜ) ⊆ closure s

Next tactic:
rw [← closure_ball x h₀]
theorem Metric.closedBall_infDist_compl_subset_closure {x : F} {s : Set F} (hx : x ∈ s) :
    closedBall x (infDist x sᶜ) ⊆ closure s := by
  rcases eq_or_ne (infDist x sᶜ) 0 with h₀ | h₀
  · rw [h₀, closedBall_zero']
    exact closure_mono (singleton_subset_iff.2 hx)
  · rw [← closure_ball x h₀]
    

Proof state:
case inr
𝕜 : Type u_1
inst✝⁴ : NormedField 𝕜
E : Type u_2
inst✝³ : NormedAddCommGroup E
inst✝² : NormedSpace 𝕜 E
F : Type u_3
inst✝¹ : SeminormedAddCommGroup F
inst✝ : NormedSpace ℝ F
x : F
s : Set F
hx : x ∈ s
h₀ : infDist x sᶜ ≠ 0
⊢ closure (ball x (infDist x sᶜ)) ⊆ closure s

Next tactic:
exact closure_mono ball_infDist_compl_subset
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  

Proof state:
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
⊢ IsTopologicalBasis (insert ∅ s)

Next tactic:
refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by 

Proof state:
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
⊢ ⋃₀ insert ∅ s = univ

Next tactic:
rw [sUnion_insert, empty_union, h.sUnion_eq]
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
  · 

Proof state:
case refine'_1
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
⊢ ∀ t₁ ∈ insert ∅ s, ∀ t₂ ∈ insert ∅ s, ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ insert ∅ s, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂

Next tactic:
rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
  · rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
    · 

Proof state:
case refine'_1.inl.inl.intro
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
x : α
hx₁ hx₂ : x ∈ ∅
⊢ ∃ t₃ ∈ insert ∅ s, x ∈ t₃ ∧ t₃ ⊆ ∅ ∩ ∅

Next tactic:
cases hx₁
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
  · rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
    · cases hx₁
    · 

Proof state:
case refine'_1.inl.inr.intro
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
t₂ : Set α
h₂ : t₂ ∈ s
x : α
hx₁ : x ∈ ∅
hx₂ : x ∈ t₂
⊢ ∃ t₃ ∈ insert ∅ s, x ∈ t₃ ∧ t₃ ⊆ ∅ ∩ t₂

Next tactic:
cases hx₁
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
  · rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
    · cases hx₁
    · cases hx₁
    · 

Proof state:
case refine'_1.inr.inl.intro
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
t₁ : Set α
h₁ : t₁ ∈ s
x : α
hx₁ : x ∈ t₁
hx₂ : x ∈ ∅
⊢ ∃ t₃ ∈ insert ∅ s, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ ∅

Next tactic:
cases hx₂
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
  · rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
    · cases hx₁
    · cases hx₁
    · cases hx₂
    · 

Proof state:
case refine'_1.inr.inr.intro
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
t₁ : Set α
h₁ : t₁ ∈ s
t₂ : Set α
h₂ : t₂ ∈ s
x : α
hx₁ : x ∈ t₁
hx₂ : x ∈ t₂
⊢ ∃ t₃ ∈ insert ∅ s, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂

Next tactic:
obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
  · rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
    · cases hx₁
    · cases hx₁
    · cases hx₂
    · obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
      

Proof state:
case refine'_1.inr.inr.intro.intro.intro
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
t₁ : Set α
h₁ : t₁ ∈ s
t₂ : Set α
h₂ : t₂ ∈ s
x : α
hx₁ : x ∈ t₁
hx₂ : x ∈ t₂
t₃ : Set α
h₃ : t₃ ∈ s
hs : x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂
⊢ ∃ t₃ ∈ insert ∅ s, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂

Next tactic:
exact ⟨t₃, .inr h₃, hs⟩
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
  · rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
    · cases hx₁
    · cases hx₁
    · cases hx₂
    · obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
      exact ⟨t₃, .inr h₃, hs⟩
  · 

Proof state:
case refine'_2
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
⊢ t = generateFrom (insert ∅ s)

Next tactic:
rw [h.eq_generateFrom]
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
  · rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
    · cases hx₁
    · cases hx₁
    · cases hx₂
    · obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
      exact ⟨t₃, .inr h₃, hs⟩
  · rw [h.eq_generateFrom]
    

Proof state:
case refine'_2
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
⊢ generateFrom s = generateFrom (insert ∅ s)

Next tactic:
refine' le_antisymm (le_generateFrom fun t => _) (generateFrom_anti <| subset_insert ∅ s)
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
  · rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
    · cases hx₁
    · cases hx₁
    · cases hx₂
    · obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
      exact ⟨t₃, .inr h₃, hs⟩
  · rw [h.eq_generateFrom]
    refine' le_antisymm (le_generateFrom fun t => _) (generateFrom_anti <| subset_insert ∅ s)
    

Proof state:
case refine'_2
α : Type u
t✝ : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
t : Set α
⊢ t ∈ insert ∅ s → IsOpen t

Next tactic:
rintro (rfl | ht)
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
  · rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
    · cases hx₁
    · cases hx₁
    · cases hx₂
    · obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
      exact ⟨t₃, .inr h₃, hs⟩
  · rw [h.eq_generateFrom]
    refine' le_antisymm (le_generateFrom fun t => _) (generateFrom_anti <| subset_insert ∅ s)
    rintro (rfl | ht)
    · 

Proof state:
case refine'_2.inl
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
⊢ IsOpen ∅

Next tactic:
exact @isOpen_empty _ (generateFrom s)
theorem IsTopologicalBasis.insert_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (insert ∅ s) := by
  refine' ⟨_, by rw [sUnion_insert, empty_union, h.sUnion_eq], _⟩
  · rintro t₁ (rfl | h₁) t₂ (rfl | h₂) x ⟨hx₁, hx₂⟩
    · cases hx₁
    · cases hx₁
    · cases hx₂
    · obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x ⟨hx₁, hx₂⟩
      exact ⟨t₃, .inr h₃, hs⟩
  · rw [h.eq_generateFrom]
    refine' le_antisymm (le_generateFrom fun t => _) (generateFrom_anti <| subset_insert ∅ s)
    rintro (rfl | ht)
    · exact @isOpen_empty _ (generateFrom s)
    · 

Proof state:
case refine'_2.inr
α : Type u
t✝ : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
t : Set α
ht : t ∈ s
⊢ IsOpen t

Next tactic:
exact .basic t ht
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (s \ {∅}) := by
  

Proof state:
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
⊢ IsTopologicalBasis (s \ {∅})

Next tactic:
refine' ⟨_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], _⟩
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (s \ {∅}) := by
  refine' ⟨_, by 

Proof state:
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
⊢ ⋃₀ (s \ {∅}) = univ

Next tactic:
rw [sUnion_diff_singleton_empty, h.sUnion_eq]
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (s \ {∅}) := by
  refine' ⟨_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], _⟩
  · 

Proof state:
case refine'_1
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
⊢ ∀ t₁ ∈ s \ {∅}, ∀ t₂ ∈ s \ {∅}, ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ s \ {∅}, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂

Next tactic:
rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (s \ {∅}) := by
  refine' ⟨_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], _⟩
  · rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
    

Proof state:
case refine'_1.intro.intro
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
t₁ : Set α
h₁ : t₁ ∈ s
t₂ : Set α
h₂ : t₂ ∈ s
x : α
hx : x ∈ t₁ ∩ t₂
⊢ ∃ t₃ ∈ s \ {∅}, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂

Next tactic:
obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x hx
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (s \ {∅}) := by
  refine' ⟨_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], _⟩
  · rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
    obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x hx
    

Proof state:
case refine'_1.intro.intro.intro.intro
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
t₁ : Set α
h₁ : t₁ ∈ s
t₂ : Set α
h₂ : t₂ ∈ s
x : α
hx : x ∈ t₁ ∩ t₂
t₃ : Set α
h₃ : t₃ ∈ s
hs : x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂
⊢ ∃ t₃ ∈ s \ {∅}, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂

Next tactic:
exact ⟨t₃, ⟨h₃, Nonempty.ne_empty ⟨x, hs.1⟩⟩, hs⟩
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (s \ {∅}) := by
  refine' ⟨_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], _⟩
  · rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
    obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x hx
    exact ⟨t₃, ⟨h₃, Nonempty.ne_empty ⟨x, hs.1⟩⟩, hs⟩
  · 

Proof state:
case refine'_2
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
⊢ t = generateFrom (s \ {∅})

Next tactic:
rw [h.eq_generateFrom]
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (s \ {∅}) := by
  refine' ⟨_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], _⟩
  · rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
    obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x hx
    exact ⟨t₃, ⟨h₃, Nonempty.ne_empty ⟨x, hs.1⟩⟩, hs⟩
  · rw [h.eq_generateFrom]
    

Proof state:
case refine'_2
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
⊢ generateFrom s = generateFrom (s \ {∅})

Next tactic:
refine' le_antisymm (generateFrom_anti <| diff_subset s _) (le_generateFrom fun t ht => _)
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (s \ {∅}) := by
  refine' ⟨_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], _⟩
  · rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
    obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x hx
    exact ⟨t₃, ⟨h₃, Nonempty.ne_empty ⟨x, hs.1⟩⟩, hs⟩
  · rw [h.eq_generateFrom]
    refine' le_antisymm (generateFrom_anti <| diff_subset s _) (le_generateFrom fun t ht => _)
    

Proof state:
case refine'_2
α : Type u
t✝ : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
t : Set α
ht : t ∈ s
⊢ IsOpen t

Next tactic:
obtain rfl | he := eq_or_ne t ∅
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (s \ {∅}) := by
  refine' ⟨_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], _⟩
  · rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
    obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x hx
    exact ⟨t₃, ⟨h₃, Nonempty.ne_empty ⟨x, hs.1⟩⟩, hs⟩
  · rw [h.eq_generateFrom]
    refine' le_antisymm (generateFrom_anti <| diff_subset s _) (le_generateFrom fun t ht => _)
    obtain rfl | he := eq_or_ne t ∅
    · 

Proof state:
case refine'_2.inl
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
ht : ∅ ∈ s
⊢ IsOpen ∅

Next tactic:
exact @isOpen_empty _ (generateFrom _)
theorem IsTopologicalBasis.diff_empty {s : Set (Set α)} (h : IsTopologicalBasis s) :
    IsTopologicalBasis (s \ {∅}) := by
  refine' ⟨_, by rw [sUnion_diff_singleton_empty, h.sUnion_eq], _⟩
  · rintro t₁ ⟨h₁, -⟩ t₂ ⟨h₂, -⟩ x hx
    obtain ⟨t₃, h₃, hs⟩ := h.exists_subset_inter _ h₁ _ h₂ x hx
    exact ⟨t₃, ⟨h₃, Nonempty.ne_empty ⟨x, hs.1⟩⟩, hs⟩
  · rw [h.eq_generateFrom]
    refine' le_antisymm (generateFrom_anti <| diff_subset s _) (le_generateFrom fun t ht => _)
    obtain rfl | he := eq_or_ne t ∅
    · exact @isOpen_empty _ (generateFrom _)
    · 

Proof state:
case refine'_2.inr
α : Type u
t✝ : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
h : IsTopologicalBasis s
t : Set α
ht : t ∈ s
he : t ≠ ∅
⊢ IsOpen t

Next tactic:
exact .basic t ⟨ht, he⟩
/-- If a family of sets `s` generates the topology, then intersections of finite
subcollections of `s` form a topological basis. -/
theorem isTopologicalBasis_of_subbasis {s : Set (Set α)} (hs : t = generateFrom s) :
    IsTopologicalBasis ((fun f => ⋂₀ f) '' { f : Set (Set α) | f.Finite ∧ f ⊆ s }) := by
  

Proof state:
α : Type u
t : TopologicalSpace α
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
hs : t = generateFrom s
⊢ IsTopologicalBasis ((fun f => ⋂₀ f) '' {f | Set.Finite f ∧ f ⊆ s})

Next tactic:
subst t
/-- If a family of sets `s` generates the topology, then intersections of finite
subcollections of `s` form a topological basis. -/
theorem isTopologicalBasis_of_subbasis {s : Set (Set α)} (hs : t = generateFrom s) :
    IsTopologicalBasis ((fun f => ⋂₀ f) '' { f : Set (Set α) | f.Finite ∧ f ⊆ s }) := by
  subst t; 

Proof state:
α : Type u
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
⊢ IsTopologicalBasis ((fun f => ⋂₀ f) '' {f | Set.Finite f ∧ f ⊆ s})

Next tactic:
letI := generateFrom s
/-- If a family of sets `s` generates the topology, then intersections of finite
subcollections of `s` form a topological basis. -/
theorem isTopologicalBasis_of_subbasis {s : Set (Set α)} (hs : t = generateFrom s) :
    IsTopologicalBasis ((fun f => ⋂₀ f) '' { f : Set (Set α) | f.Finite ∧ f ⊆ s }) := by
  subst t; letI := generateFrom s
  

Proof state:
α : Type u
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
this : TopologicalSpace α := generateFrom s
⊢ IsTopologicalBasis ((fun f => ⋂₀ f) '' {f | Set.Finite f ∧ f ⊆ s})

Next tactic:
refine' ⟨_, _, le_antisymm (le_generateFrom _) <| generateFrom_anti fun t ht => _⟩
/-- If a family of sets `s` generates the topology, then intersections of finite
subcollections of `s` form a topological basis. -/
theorem isTopologicalBasis_of_subbasis {s : Set (Set α)} (hs : t = generateFrom s) :
    IsTopologicalBasis ((fun f => ⋂₀ f) '' { f : Set (Set α) | f.Finite ∧ f ⊆ s }) := by
  subst t; letI := generateFrom s
  refine' ⟨_, _, le_antisymm (le_generateFrom _) <| generateFrom_anti fun t ht => _⟩
  · 

Proof state:
case refine'_1
α : Type u
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
this : TopologicalSpace α := generateFrom s
⊢ ∀ t₁ ∈ (fun f => ⋂₀ f) '' {f | Set.Finite f ∧ f ⊆ s},
    ∀ t₂ ∈ (fun f => ⋂₀ f) '' {f | Set.Finite f ∧ f ⊆ s},
      ∀ x ∈ t₁ ∩ t₂, ∃ t₃ ∈ (fun f => ⋂₀ f) '' {f | Set.Finite f ∧ f ⊆ s}, x ∈ t₃ ∧ t₃ ⊆ t₁ ∩ t₂

Next tactic:
rintro _ ⟨t₁, ⟨hft₁, ht₁b⟩, rfl⟩ _ ⟨t₂, ⟨hft₂, ht₂b⟩, rfl⟩ x h
/-- If a family of sets `s` generates the topology, then intersections of finite
subcollections of `s` form a topological basis. -/
theorem isTopologicalBasis_of_subbasis {s : Set (Set α)} (hs : t = generateFrom s) :
    IsTopologicalBasis ((fun f => ⋂₀ f) '' { f : Set (Set α) | f.Finite ∧ f ⊆ s }) := by
  subst t; letI := generateFrom s
  refine' ⟨_, _, le_antisymm (le_generateFrom _) <| generateFrom_anti fun t ht => _⟩
  · rintro _ ⟨t₁, ⟨hft₁, ht₁b⟩, rfl⟩ _ ⟨t₂, ⟨hft₂, ht₂b⟩, rfl⟩ x h
    

Proof state:
case refine'_1.intro.intro.intro.intro.intro.intro
α : Type u
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
this : TopologicalSpace α := generateFrom s
t₁ : Set (Set α)
hft₁ : Set.Finite t₁
ht₁b : t₁ ⊆ s
t₂ : Set (Set α)
hft₂ : Set.Finite t₂
ht₂b : t₂ ⊆ s
x : α
h : x ∈ (fun f => ⋂₀ f) t₁ ∩ (fun f => ⋂₀ f) t₂
⊢ ∃ t₃ ∈ (fun f => ⋂₀ f) '' {f | Set.Finite f ∧ f ⊆ s}, x ∈ t₃ ∧ t₃ ⊆ (fun f => ⋂₀ f) t₁ ∩ (fun f => ⋂₀ f) t₂

Next tactic:
exact ⟨_, ⟨_, ⟨hft₁.union hft₂, union_subset ht₁b ht₂b⟩, sInter_union t₁ t₂⟩, h, Subset.rfl⟩
/-- If a family of sets `s` generates the topology, then intersections of finite
subcollections of `s` form a topological basis. -/
theorem isTopologicalBasis_of_subbasis {s : Set (Set α)} (hs : t = generateFrom s) :
    IsTopologicalBasis ((fun f => ⋂₀ f) '' { f : Set (Set α) | f.Finite ∧ f ⊆ s }) := by
  subst t; letI := generateFrom s
  refine' ⟨_, _, le_antisymm (le_generateFrom _) <| generateFrom_anti fun t ht => _⟩
  · rintro _ ⟨t₁, ⟨hft₁, ht₁b⟩, rfl⟩ _ ⟨t₂, ⟨hft₂, ht₂b⟩, rfl⟩ x h
    exact ⟨_, ⟨_, ⟨hft₁.union hft₂, union_subset ht₁b ht₂b⟩, sInter_union t₁ t₂⟩, h, Subset.rfl⟩
  · 

Proof state:
case refine'_2
α : Type u
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
this : TopologicalSpace α := generateFrom s
⊢ ⋃₀ ((fun f => ⋂₀ f) '' {f | Set.Finite f ∧ f ⊆ s}) = univ

Next tactic:
rw [sUnion_image, iUnion₂_eq_univ_iff]
/-- If a family of sets `s` generates the topology, then intersections of finite
subcollections of `s` form a topological basis. -/
theorem isTopologicalBasis_of_subbasis {s : Set (Set α)} (hs : t = generateFrom s) :
    IsTopologicalBasis ((fun f => ⋂₀ f) '' { f : Set (Set α) | f.Finite ∧ f ⊆ s }) := by
  subst t; letI := generateFrom s
  refine' ⟨_, _, le_antisymm (le_generateFrom _) <| generateFrom_anti fun t ht => _⟩
  · rintro _ ⟨t₁, ⟨hft₁, ht₁b⟩, rfl⟩ _ ⟨t₂, ⟨hft₂, ht₂b⟩, rfl⟩ x h
    exact ⟨_, ⟨_, ⟨hft₁.union hft₂, union_subset ht₁b ht₂b⟩, sInter_union t₁ t₂⟩, h, Subset.rfl⟩
  · rw [sUnion_image, iUnion₂_eq_univ_iff]
    

Proof state:
case refine'_2
α : Type u
B : Set (Set α)
s✝ : Set α
s : Set (Set α)
this : TopologicalSpace α := generateFrom s
⊢ ∀ (a : α), ∃ i, ∃ (_ : i ∈ {f | Set.Finite f ∧ f ⊆ s}), a ∈ ⋂₀ i

Next tactic:
exact fun x => ⟨∅, ⟨finite_empty, empty_subset _⟩, sInter_empty.substr <| mem_univ x⟩