l3lab/ntp-mathlib huggingface dataset:
theorem LinearMap.hasBasis_weakBilin (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) :
    (𝓝 (0 : WeakBilin B)).HasBasis B.toSeminormFamily.basisSets _root_.id := by
  let p := B.toSeminormFamily
  rw [nhds_induced, nhds_pi]
  simp only [map_zero, LinearMap.zero_apply]
  have h := @Metric.nhds_basis_ball 𝕜 _ 0
  have h' := Filter.hasBasis_pi fun _ : F => h
  have h'' := Filter.HasBasis.comap (fun x y => B x y) h'
  refine' h''.to_hasBasis _ _
  · rintro (U : Set F × (F → ℝ)) hU
    cases' hU with hU₁ hU₂
    simp only [id.def]
    let U' := hU₁.toFinset
    by_cases hU₃ : U.fst.Nonempty
    · have hU₃' : U'.Nonempty := hU₁.toFinset_nonempty.mpr hU₃
      refine' ⟨(U'.sup p).ball 0 <| U'.inf' hU₃' U.snd, p.basisSets_mem _ <|
        (Finset.lt_inf'_iff _).2 fun y hy => hU₂ y <| hU₁.mem_toFinset.mp hy, fun x hx y hy => _⟩
      simp only [Set.mem_preimage, Set.mem_pi, mem_ball_zero_iff]
      rw [Seminorm.mem_ball_zero] at hx
      rw [← LinearMap.toSeminormFamily_apply]
      have hyU' : y ∈ U' := (Set.Finite.mem_toFinset hU₁).mpr hy
      have hp : p y ≤ U'.sup p := Finset.le_sup hyU'
      refine' lt_of_le_of_lt (hp x) (lt_of_lt_of_le hx _)
      exact Finset.inf'_le _ hyU'
    rw [Set.not_nonempty_iff_eq_empty.mp hU₃]
    simp only [Set.empty_pi, Set.preimage_univ, Set.subset_univ, and_true_iff]
    

Proof state:
case neg
𝕜 : Type u_1
E : Type u_2
F : Type u_3
ι : Type u_4
inst✝⁵ : NormedField 𝕜
inst✝⁴ : AddCommGroup E
inst✝³ : Module 𝕜 E
inst✝² : AddCommGroup F
inst✝¹ : Module 𝕜 F
inst✝ : Nonempty ι
B✝ B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜
p : SeminormFamily 𝕜 E F := toSeminormFamily B
h : Filter.HasBasis (𝓝 0) (fun x => 0 < x) (Metric.ball 0)
h' :
  Filter.HasBasis (Filter.pi fun x => 𝓝 0) (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun If =>
    Set.pi If.1 fun i => Metric.ball 0 (If.2 i)
h'' :
  Filter.HasBasis (Filter.comap (fun x y => (B x) y) (Filter.pi fun x => 𝓝 0))
    (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun i =>
    (fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)
U : Set F × (F → ℝ)
hU₁ : Set.Finite U.1
hU₂ : ∀ i ∈ U.1, 0 < U.2 i
U' : Finset F := Set.Finite.toFinset hU₁
hU₃ : ¬Set.Nonempty U.1
⊢ ∃ i', SeminormFamily.basisSets (toSeminormFamily B) i'

Next tactic:
exact Exists.intro ((p 0).ball 0 1) (p.basisSets_singleton_mem 0 one_pos)
theorem LinearMap.hasBasis_weakBilin (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) :
    (𝓝 (0 : WeakBilin B)).HasBasis B.toSeminormFamily.basisSets _root_.id := by
  let p := B.toSeminormFamily
  rw [nhds_induced, nhds_pi]
  simp only [map_zero, LinearMap.zero_apply]
  have h := @Metric.nhds_basis_ball 𝕜 _ 0
  have h' := Filter.hasBasis_pi fun _ : F => h
  have h'' := Filter.HasBasis.comap (fun x y => B x y) h'
  refine' h''.to_hasBasis _ _
  · rintro (U : Set F × (F → ℝ)) hU
    cases' hU with hU₁ hU₂
    simp only [id.def]
    let U' := hU₁.toFinset
    by_cases hU₃ : U.fst.Nonempty
    · have hU₃' : U'.Nonempty := hU₁.toFinset_nonempty.mpr hU₃
      refine' ⟨(U'.sup p).ball 0 <| U'.inf' hU₃' U.snd, p.basisSets_mem _ <|
        (Finset.lt_inf'_iff _).2 fun y hy => hU₂ y <| hU₁.mem_toFinset.mp hy, fun x hx y hy => _⟩
      simp only [Set.mem_preimage, Set.mem_pi, mem_ball_zero_iff]
      rw [Seminorm.mem_ball_zero] at hx
      rw [← LinearMap.toSeminormFamily_apply]
      have hyU' : y ∈ U' := (Set.Finite.mem_toFinset hU₁).mpr hy
      have hp : p y ≤ U'.sup p := Finset.le_sup hyU'
      refine' lt_of_le_of_lt (hp x) (lt_of_lt_of_le hx _)
      exact Finset.inf'_le _ hyU'
    rw [Set.not_nonempty_iff_eq_empty.mp hU₃]
    simp only [Set.empty_pi, Set.preimage_univ, Set.subset_univ, and_true_iff]
    exact Exists.intro ((p 0).ball 0 1) (p.basisSets_singleton_mem 0 one_pos)
  

Proof state:
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
ι : Type u_4
inst✝⁵ : NormedField 𝕜
inst✝⁴ : AddCommGroup E
inst✝³ : Module 𝕜 E
inst✝² : AddCommGroup F
inst✝¹ : Module 𝕜 F
inst✝ : Nonempty ι
B✝ B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜
p : SeminormFamily 𝕜 E F := toSeminormFamily B
h : Filter.HasBasis (𝓝 0) (fun x => 0 < x) (Metric.ball 0)
h' :
  Filter.HasBasis (Filter.pi fun x => 𝓝 0) (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun If =>
    Set.pi If.1 fun i => Metric.ball 0 (If.2 i)
h'' :
  Filter.HasBasis (Filter.comap (fun x y => (B x) y) (Filter.pi fun x => 𝓝 0))
    (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun i =>
    (fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)
⊢ ∀ (i' : Set E),
    SeminormFamily.basisSets (toSeminormFamily B) i' →
      ∃ i,
        (Set.Finite i.1 ∧ ∀ i_1 ∈ i.1, 0 < i.2 i_1) ∧
          ((fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)) ⊆ _root_.id i'

Next tactic:
rintro U (hU : U ∈ p.basisSets)
theorem LinearMap.hasBasis_weakBilin (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) :
    (𝓝 (0 : WeakBilin B)).HasBasis B.toSeminormFamily.basisSets _root_.id := by
  let p := B.toSeminormFamily
  rw [nhds_induced, nhds_pi]
  simp only [map_zero, LinearMap.zero_apply]
  have h := @Metric.nhds_basis_ball 𝕜 _ 0
  have h' := Filter.hasBasis_pi fun _ : F => h
  have h'' := Filter.HasBasis.comap (fun x y => B x y) h'
  refine' h''.to_hasBasis _ _
  · rintro (U : Set F × (F → ℝ)) hU
    cases' hU with hU₁ hU₂
    simp only [id.def]
    let U' := hU₁.toFinset
    by_cases hU₃ : U.fst.Nonempty
    · have hU₃' : U'.Nonempty := hU₁.toFinset_nonempty.mpr hU₃
      refine' ⟨(U'.sup p).ball 0 <| U'.inf' hU₃' U.snd, p.basisSets_mem _ <|
        (Finset.lt_inf'_iff _).2 fun y hy => hU₂ y <| hU₁.mem_toFinset.mp hy, fun x hx y hy => _⟩
      simp only [Set.mem_preimage, Set.mem_pi, mem_ball_zero_iff]
      rw [Seminorm.mem_ball_zero] at hx
      rw [← LinearMap.toSeminormFamily_apply]
      have hyU' : y ∈ U' := (Set.Finite.mem_toFinset hU₁).mpr hy
      have hp : p y ≤ U'.sup p := Finset.le_sup hyU'
      refine' lt_of_le_of_lt (hp x) (lt_of_lt_of_le hx _)
      exact Finset.inf'_le _ hyU'
    rw [Set.not_nonempty_iff_eq_empty.mp hU₃]
    simp only [Set.empty_pi, Set.preimage_univ, Set.subset_univ, and_true_iff]
    exact Exists.intro ((p 0).ball 0 1) (p.basisSets_singleton_mem 0 one_pos)
  rintro U (hU : U ∈ p.basisSets)
  

Proof state:
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
ι : Type u_4
inst✝⁵ : NormedField 𝕜
inst✝⁴ : AddCommGroup E
inst✝³ : Module 𝕜 E
inst✝² : AddCommGroup F
inst✝¹ : Module 𝕜 F
inst✝ : Nonempty ι
B✝ B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜
p : SeminormFamily 𝕜 E F := toSeminormFamily B
h : Filter.HasBasis (𝓝 0) (fun x => 0 < x) (Metric.ball 0)
h' :
  Filter.HasBasis (Filter.pi fun x => 𝓝 0) (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun If =>
    Set.pi If.1 fun i => Metric.ball 0 (If.2 i)
h'' :
  Filter.HasBasis (Filter.comap (fun x y => (B x) y) (Filter.pi fun x => 𝓝 0))
    (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun i =>
    (fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)
U : Set E
hU : U ∈ SeminormFamily.basisSets p
⊢ ∃ i,
    (Set.Finite i.1 ∧ ∀ i_1 ∈ i.1, 0 < i.2 i_1) ∧
      ((fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)) ⊆ _root_.id U

Next tactic:
rw [SeminormFamily.basisSets_iff] at hU
theorem LinearMap.hasBasis_weakBilin (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) :
    (𝓝 (0 : WeakBilin B)).HasBasis B.toSeminormFamily.basisSets _root_.id := by
  let p := B.toSeminormFamily
  rw [nhds_induced, nhds_pi]
  simp only [map_zero, LinearMap.zero_apply]
  have h := @Metric.nhds_basis_ball 𝕜 _ 0
  have h' := Filter.hasBasis_pi fun _ : F => h
  have h'' := Filter.HasBasis.comap (fun x y => B x y) h'
  refine' h''.to_hasBasis _ _
  · rintro (U : Set F × (F → ℝ)) hU
    cases' hU with hU₁ hU₂
    simp only [id.def]
    let U' := hU₁.toFinset
    by_cases hU₃ : U.fst.Nonempty
    · have hU₃' : U'.Nonempty := hU₁.toFinset_nonempty.mpr hU₃
      refine' ⟨(U'.sup p).ball 0 <| U'.inf' hU₃' U.snd, p.basisSets_mem _ <|
        (Finset.lt_inf'_iff _).2 fun y hy => hU₂ y <| hU₁.mem_toFinset.mp hy, fun x hx y hy => _⟩
      simp only [Set.mem_preimage, Set.mem_pi, mem_ball_zero_iff]
      rw [Seminorm.mem_ball_zero] at hx
      rw [← LinearMap.toSeminormFamily_apply]
      have hyU' : y ∈ U' := (Set.Finite.mem_toFinset hU₁).mpr hy
      have hp : p y ≤ U'.sup p := Finset.le_sup hyU'
      refine' lt_of_le_of_lt (hp x) (lt_of_lt_of_le hx _)
      exact Finset.inf'_le _ hyU'
    rw [Set.not_nonempty_iff_eq_empty.mp hU₃]
    simp only [Set.empty_pi, Set.preimage_univ, Set.subset_univ, and_true_iff]
    exact Exists.intro ((p 0).ball 0 1) (p.basisSets_singleton_mem 0 one_pos)
  rintro U (hU : U ∈ p.basisSets)
  rw [SeminormFamily.basisSets_iff] at hU
  

Proof state:
case refine'_2
𝕜 : Type u_1
E : Type u_2
F : Type u_3
ι : Type u_4
inst✝⁵ : NormedField 𝕜
inst✝⁴ : AddCommGroup E
inst✝³ : Module 𝕜 E
inst✝² : AddCommGroup F
inst✝¹ : Module 𝕜 F
inst✝ : Nonempty ι
B✝ B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜
p : SeminormFamily 𝕜 E F := toSeminormFamily B
h : Filter.HasBasis (𝓝 0) (fun x => 0 < x) (Metric.ball 0)
h' :
  Filter.HasBasis (Filter.pi fun x => 𝓝 0) (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun If =>
    Set.pi If.1 fun i => Metric.ball 0 (If.2 i)
h'' :
  Filter.HasBasis (Filter.comap (fun x y => (B x) y) (Filter.pi fun x => 𝓝 0))
    (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun i =>
    (fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)
U : Set E
hU : ∃ i r, 0 < r ∧ U = Seminorm.ball (Finset.sup i p) 0 r
⊢ ∃ i,
    (Set.Finite i.1 ∧ ∀ i_1 ∈ i.1, 0 < i.2 i_1) ∧
      ((fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)) ⊆ _root_.id U

Next tactic:
rcases hU with ⟨s, r, hr, hU⟩
theorem LinearMap.hasBasis_weakBilin (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) :
    (𝓝 (0 : WeakBilin B)).HasBasis B.toSeminormFamily.basisSets _root_.id := by
  let p := B.toSeminormFamily
  rw [nhds_induced, nhds_pi]
  simp only [map_zero, LinearMap.zero_apply]
  have h := @Metric.nhds_basis_ball 𝕜 _ 0
  have h' := Filter.hasBasis_pi fun _ : F => h
  have h'' := Filter.HasBasis.comap (fun x y => B x y) h'
  refine' h''.to_hasBasis _ _
  · rintro (U : Set F × (F → ℝ)) hU
    cases' hU with hU₁ hU₂
    simp only [id.def]
    let U' := hU₁.toFinset
    by_cases hU₃ : U.fst.Nonempty
    · have hU₃' : U'.Nonempty := hU₁.toFinset_nonempty.mpr hU₃
      refine' ⟨(U'.sup p).ball 0 <| U'.inf' hU₃' U.snd, p.basisSets_mem _ <|
        (Finset.lt_inf'_iff _).2 fun y hy => hU₂ y <| hU₁.mem_toFinset.mp hy, fun x hx y hy => _⟩
      simp only [Set.mem_preimage, Set.mem_pi, mem_ball_zero_iff]
      rw [Seminorm.mem_ball_zero] at hx
      rw [← LinearMap.toSeminormFamily_apply]
      have hyU' : y ∈ U' := (Set.Finite.mem_toFinset hU₁).mpr hy
      have hp : p y ≤ U'.sup p := Finset.le_sup hyU'
      refine' lt_of_le_of_lt (hp x) (lt_of_lt_of_le hx _)
      exact Finset.inf'_le _ hyU'
    rw [Set.not_nonempty_iff_eq_empty.mp hU₃]
    simp only [Set.empty_pi, Set.preimage_univ, Set.subset_univ, and_true_iff]
    exact Exists.intro ((p 0).ball 0 1) (p.basisSets_singleton_mem 0 one_pos)
  rintro U (hU : U ∈ p.basisSets)
  rw [SeminormFamily.basisSets_iff] at hU
  rcases hU with ⟨s, r, hr, hU⟩
  

Proof state:
case refine'_2.intro.intro.intro
𝕜 : Type u_1
E : Type u_2
F : Type u_3
ι : Type u_4
inst✝⁵ : NormedField 𝕜
inst✝⁴ : AddCommGroup E
inst✝³ : Module 𝕜 E
inst✝² : AddCommGroup F
inst✝¹ : Module 𝕜 F
inst✝ : Nonempty ι
B✝ B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜
p : SeminormFamily 𝕜 E F := toSeminormFamily B
h : Filter.HasBasis (𝓝 0) (fun x => 0 < x) (Metric.ball 0)
h' :
  Filter.HasBasis (Filter.pi fun x => 𝓝 0) (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun If =>
    Set.pi If.1 fun i => Metric.ball 0 (If.2 i)
h'' :
  Filter.HasBasis (Filter.comap (fun x y => (B x) y) (Filter.pi fun x => 𝓝 0))
    (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun i =>
    (fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)
U : Set E
s : Finset F
r : ℝ
hr : 0 < r
hU : U = Seminorm.ball (Finset.sup s p) 0 r
⊢ ∃ i,
    (Set.Finite i.1 ∧ ∀ i_1 ∈ i.1, 0 < i.2 i_1) ∧
      ((fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)) ⊆ _root_.id U

Next tactic:
rw [hU]
theorem LinearMap.hasBasis_weakBilin (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) :
    (𝓝 (0 : WeakBilin B)).HasBasis B.toSeminormFamily.basisSets _root_.id := by
  let p := B.toSeminormFamily
  rw [nhds_induced, nhds_pi]
  simp only [map_zero, LinearMap.zero_apply]
  have h := @Metric.nhds_basis_ball 𝕜 _ 0
  have h' := Filter.hasBasis_pi fun _ : F => h
  have h'' := Filter.HasBasis.comap (fun x y => B x y) h'
  refine' h''.to_hasBasis _ _
  · rintro (U : Set F × (F → ℝ)) hU
    cases' hU with hU₁ hU₂
    simp only [id.def]
    let U' := hU₁.toFinset
    by_cases hU₃ : U.fst.Nonempty
    · have hU₃' : U'.Nonempty := hU₁.toFinset_nonempty.mpr hU₃
      refine' ⟨(U'.sup p).ball 0 <| U'.inf' hU₃' U.snd, p.basisSets_mem _ <|
        (Finset.lt_inf'_iff _).2 fun y hy => hU₂ y <| hU₁.mem_toFinset.mp hy, fun x hx y hy => _⟩
      simp only [Set.mem_preimage, Set.mem_pi, mem_ball_zero_iff]
      rw [Seminorm.mem_ball_zero] at hx
      rw [← LinearMap.toSeminormFamily_apply]
      have hyU' : y ∈ U' := (Set.Finite.mem_toFinset hU₁).mpr hy
      have hp : p y ≤ U'.sup p := Finset.le_sup hyU'
      refine' lt_of_le_of_lt (hp x) (lt_of_lt_of_le hx _)
      exact Finset.inf'_le _ hyU'
    rw [Set.not_nonempty_iff_eq_empty.mp hU₃]
    simp only [Set.empty_pi, Set.preimage_univ, Set.subset_univ, and_true_iff]
    exact Exists.intro ((p 0).ball 0 1) (p.basisSets_singleton_mem 0 one_pos)
  rintro U (hU : U ∈ p.basisSets)
  rw [SeminormFamily.basisSets_iff] at hU
  rcases hU with ⟨s, r, hr, hU⟩
  rw [hU]
  

Proof state:
case refine'_2.intro.intro.intro
𝕜 : Type u_1
E : Type u_2
F : Type u_3
ι : Type u_4
inst✝⁵ : NormedField 𝕜
inst✝⁴ : AddCommGroup E
inst✝³ : Module 𝕜 E
inst✝² : AddCommGroup F
inst✝¹ : Module 𝕜 F
inst✝ : Nonempty ι
B✝ B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜
p : SeminormFamily 𝕜 E F := toSeminormFamily B
h : Filter.HasBasis (𝓝 0) (fun x => 0 < x) (Metric.ball 0)
h' :
  Filter.HasBasis (Filter.pi fun x => 𝓝 0) (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun If =>
    Set.pi If.1 fun i => Metric.ball 0 (If.2 i)
h'' :
  Filter.HasBasis (Filter.comap (fun x y => (B x) y) (Filter.pi fun x => 𝓝 0))
    (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun i =>
    (fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)
U : Set E
s : Finset F
r : ℝ
hr : 0 < r
hU : U = Seminorm.ball (Finset.sup s p) 0 r
⊢ ∃ i,
    (Set.Finite i.1 ∧ ∀ i_1 ∈ i.1, 0 < i.2 i_1) ∧
      ((fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)) ⊆
        _root_.id (Seminorm.ball (Finset.sup s p) 0 r)

Next tactic:
refine' ⟨(s, fun _ => r), ⟨by simp only [s.finite_toSet], fun y _ => hr⟩, fun x hx => _⟩
theorem LinearMap.hasBasis_weakBilin (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) :
    (𝓝 (0 : WeakBilin B)).HasBasis B.toSeminormFamily.basisSets _root_.id := by
  let p := B.toSeminormFamily
  rw [nhds_induced, nhds_pi]
  simp only [map_zero, LinearMap.zero_apply]
  have h := @Metric.nhds_basis_ball 𝕜 _ 0
  have h' := Filter.hasBasis_pi fun _ : F => h
  have h'' := Filter.HasBasis.comap (fun x y => B x y) h'
  refine' h''.to_hasBasis _ _
  · rintro (U : Set F × (F → ℝ)) hU
    cases' hU with hU₁ hU₂
    simp only [id.def]
    let U' := hU₁.toFinset
    by_cases hU₃ : U.fst.Nonempty
    · have hU₃' : U'.Nonempty := hU₁.toFinset_nonempty.mpr hU₃
      refine' ⟨(U'.sup p).ball 0 <| U'.inf' hU₃' U.snd, p.basisSets_mem _ <|
        (Finset.lt_inf'_iff _).2 fun y hy => hU₂ y <| hU₁.mem_toFinset.mp hy, fun x hx y hy => _⟩
      simp only [Set.mem_preimage, Set.mem_pi, mem_ball_zero_iff]
      rw [Seminorm.mem_ball_zero] at hx
      rw [← LinearMap.toSeminormFamily_apply]
      have hyU' : y ∈ U' := (Set.Finite.mem_toFinset hU₁).mpr hy
      have hp : p y ≤ U'.sup p := Finset.le_sup hyU'
      refine' lt_of_le_of_lt (hp x) (lt_of_lt_of_le hx _)
      exact Finset.inf'_le _ hyU'
    rw [Set.not_nonempty_iff_eq_empty.mp hU₃]
    simp only [Set.empty_pi, Set.preimage_univ, Set.subset_univ, and_true_iff]
    exact Exists.intro ((p 0).ball 0 1) (p.basisSets_singleton_mem 0 one_pos)
  rintro U (hU : U ∈ p.basisSets)
  rw [SeminormFamily.basisSets_iff] at hU
  rcases hU with ⟨s, r, hr, hU⟩
  rw [hU]
  refine' ⟨(s, fun _ => r), ⟨by 

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
ι : Type u_4
inst✝⁵ : NormedField 𝕜
inst✝⁴ : AddCommGroup E
inst✝³ : Module 𝕜 E
inst✝² : AddCommGroup F
inst✝¹ : Module 𝕜 F
inst✝ : Nonempty ι
B✝ B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜
p : SeminormFamily 𝕜 E F := toSeminormFamily B
h : Filter.HasBasis (𝓝 0) (fun x => 0 < x) (Metric.ball 0)
h' :
  Filter.HasBasis (Filter.pi fun x => 𝓝 0) (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun If =>
    Set.pi If.1 fun i => Metric.ball 0 (If.2 i)
h'' :
  Filter.HasBasis (Filter.comap (fun x y => (B x) y) (Filter.pi fun x => 𝓝 0))
    (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun i =>
    (fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)
U : Set E
s : Finset F
r : ℝ
hr : 0 < r
hU : U = Seminorm.ball (Finset.sup s p) 0 r
⊢ Set.Finite (↑s, fun x => r).1

Next tactic:
simp only [s.finite_toSet]
theorem LinearMap.hasBasis_weakBilin (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) :
    (𝓝 (0 : WeakBilin B)).HasBasis B.toSeminormFamily.basisSets _root_.id := by
  let p := B.toSeminormFamily
  rw [nhds_induced, nhds_pi]
  simp only [map_zero, LinearMap.zero_apply]
  have h := @Metric.nhds_basis_ball 𝕜 _ 0
  have h' := Filter.hasBasis_pi fun _ : F => h
  have h'' := Filter.HasBasis.comap (fun x y => B x y) h'
  refine' h''.to_hasBasis _ _
  · rintro (U : Set F × (F → ℝ)) hU
    cases' hU with hU₁ hU₂
    simp only [id.def]
    let U' := hU₁.toFinset
    by_cases hU₃ : U.fst.Nonempty
    · have hU₃' : U'.Nonempty := hU₁.toFinset_nonempty.mpr hU₃
      refine' ⟨(U'.sup p).ball 0 <| U'.inf' hU₃' U.snd, p.basisSets_mem _ <|
        (Finset.lt_inf'_iff _).2 fun y hy => hU₂ y <| hU₁.mem_toFinset.mp hy, fun x hx y hy => _⟩
      simp only [Set.mem_preimage, Set.mem_pi, mem_ball_zero_iff]
      rw [Seminorm.mem_ball_zero] at hx
      rw [← LinearMap.toSeminormFamily_apply]
      have hyU' : y ∈ U' := (Set.Finite.mem_toFinset hU₁).mpr hy
      have hp : p y ≤ U'.sup p := Finset.le_sup hyU'
      refine' lt_of_le_of_lt (hp x) (lt_of_lt_of_le hx _)
      exact Finset.inf'_le _ hyU'
    rw [Set.not_nonempty_iff_eq_empty.mp hU₃]
    simp only [Set.empty_pi, Set.preimage_univ, Set.subset_univ, and_true_iff]
    exact Exists.intro ((p 0).ball 0 1) (p.basisSets_singleton_mem 0 one_pos)
  rintro U (hU : U ∈ p.basisSets)
  rw [SeminormFamily.basisSets_iff] at hU
  rcases hU with ⟨s, r, hr, hU⟩
  rw [hU]
  refine' ⟨(s, fun _ => r), ⟨by simp only [s.finite_toSet], fun y _ => hr⟩, fun x hx => _⟩
  

Proof state:
case refine'_2.intro.intro.intro
𝕜 : Type u_1
E : Type u_2
F : Type u_3
ι : Type u_4
inst✝⁵ : NormedField 𝕜
inst✝⁴ : AddCommGroup E
inst✝³ : Module 𝕜 E
inst✝² : AddCommGroup F
inst✝¹ : Module 𝕜 F
inst✝ : Nonempty ι
B✝ B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜
p : SeminormFamily 𝕜 E F := toSeminormFamily B
h : Filter.HasBasis (𝓝 0) (fun x => 0 < x) (Metric.ball 0)
h' :
  Filter.HasBasis (Filter.pi fun x => 𝓝 0) (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun If =>
    Set.pi If.1 fun i => Metric.ball 0 (If.2 i)
h'' :
  Filter.HasBasis (Filter.comap (fun x y => (B x) y) (Filter.pi fun x => 𝓝 0))
    (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun i =>
    (fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)
U : Set E
s : Finset F
r : ℝ
hr : 0 < r
hU : U = Seminorm.ball (Finset.sup s p) 0 r
x : E
hx : x ∈ (fun x y => (B x) y) ⁻¹' Set.pi (↑s, fun x => r).1 fun i => Metric.ball 0 ((↑s, fun x => r).2 i)
⊢ x ∈ _root_.id (Seminorm.ball (Finset.sup s p) 0 r)

Next tactic:
simp only [Set.mem_preimage, Set.mem_pi, Finset.mem_coe, mem_ball_zero_iff] at hx
theorem LinearMap.hasBasis_weakBilin (B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜) :
    (𝓝 (0 : WeakBilin B)).HasBasis B.toSeminormFamily.basisSets _root_.id := by
  let p := B.toSeminormFamily
  rw [nhds_induced, nhds_pi]
  simp only [map_zero, LinearMap.zero_apply]
  have h := @Metric.nhds_basis_ball 𝕜 _ 0
  have h' := Filter.hasBasis_pi fun _ : F => h
  have h'' := Filter.HasBasis.comap (fun x y => B x y) h'
  refine' h''.to_hasBasis _ _
  · rintro (U : Set F × (F → ℝ)) hU
    cases' hU with hU₁ hU₂
    simp only [id.def]
    let U' := hU₁.toFinset
    by_cases hU₃ : U.fst.Nonempty
    · have hU₃' : U'.Nonempty := hU₁.toFinset_nonempty.mpr hU₃
      refine' ⟨(U'.sup p).ball 0 <| U'.inf' hU₃' U.snd, p.basisSets_mem _ <|
        (Finset.lt_inf'_iff _).2 fun y hy => hU₂ y <| hU₁.mem_toFinset.mp hy, fun x hx y hy => _⟩
      simp only [Set.mem_preimage, Set.mem_pi, mem_ball_zero_iff]
      rw [Seminorm.mem_ball_zero] at hx
      rw [← LinearMap.toSeminormFamily_apply]
      have hyU' : y ∈ U' := (Set.Finite.mem_toFinset hU₁).mpr hy
      have hp : p y ≤ U'.sup p := Finset.le_sup hyU'
      refine' lt_of_le_of_lt (hp x) (lt_of_lt_of_le hx _)
      exact Finset.inf'_le _ hyU'
    rw [Set.not_nonempty_iff_eq_empty.mp hU₃]
    simp only [Set.empty_pi, Set.preimage_univ, Set.subset_univ, and_true_iff]
    exact Exists.intro ((p 0).ball 0 1) (p.basisSets_singleton_mem 0 one_pos)
  rintro U (hU : U ∈ p.basisSets)
  rw [SeminormFamily.basisSets_iff] at hU
  rcases hU with ⟨s, r, hr, hU⟩
  rw [hU]
  refine' ⟨(s, fun _ => r), ⟨by simp only [s.finite_toSet], fun y _ => hr⟩, fun x hx => _⟩
  simp only [Set.mem_preimage, Set.mem_pi, Finset.mem_coe, mem_ball_zero_iff] at hx
  

Proof state:
case refine'_2.intro.intro.intro
𝕜 : Type u_1
E : Type u_2
F : Type u_3
ι : Type u_4
inst✝⁵ : NormedField 𝕜
inst✝⁴ : AddCommGroup E
inst✝³ : Module 𝕜 E
inst✝² : AddCommGroup F
inst✝¹ : Module 𝕜 F
inst✝ : Nonempty ι
B✝ B : E →ₗ[𝕜] F →ₗ[𝕜] 𝕜
p : SeminormFamily 𝕜 E F := toSeminormFamily B
h : Filter.HasBasis (𝓝 0) (fun x => 0 < x) (Metric.ball 0)
h' :
  Filter.HasBasis (Filter.pi fun x => 𝓝 0) (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun If =>
    Set.pi If.1 fun i => Metric.ball 0 (If.2 i)
h'' :
  Filter.HasBasis (Filter.comap (fun x y => (B x) y) (Filter.pi fun x => 𝓝 0))
    (fun If => Set.Finite If.1 ∧ ∀ i ∈ If.1, 0 < If.2 i) fun i =>
    (fun x y => (B x) y) ⁻¹' Set.pi i.1 fun i_1 => Metric.ball 0 (i.2 i_1)
U : Set E
s : Finset F
r : ℝ
hr : 0 < r
hU : U = Seminorm.ball (Finset.sup s p) 0 r
x : E
hx : ∀ i ∈ s, ‖(B x) i‖ < r
⊢ x ∈ _root_.id (Seminorm.ball (Finset.sup s p) 0 r)

Next tactic:
simp only [id.def, Seminorm.mem_ball, sub_zero]