l3lab/ntp-mathlib huggingface dataset:
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  

Proof state:
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
⊢ ∃ᶠ (x : ↥(Lp E p)) in 𝓝 f, x ∈ ↑(boundedContinuousFunction E p μ)

Next tactic:
rw [Metric.nhds_basis_closedBall.frequently_iff]
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  

Proof state:
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
⊢ ∀ (i : ℝ), 0 < i → ∃ x ∈ Metric.closedBall f i, x ∈ ↑(boundedContinuousFunction E p μ)

Next tactic:
intro ε hε
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  intro ε hε
  

Proof state:
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
ε : ℝ
hε : 0 < ε
⊢ ∃ x ∈ Metric.closedBall f ε, x ∈ ↑(boundedContinuousFunction E p μ)

Next tactic:
have A : ENNReal.ofReal ε ≠ 0 := by simp only [Ne.def, ENNReal.ofReal_eq_zero, not_le, hε]
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  intro ε hε
  have A : ENNReal.ofReal ε ≠ 0 := by 

Proof state:
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
ε : ℝ
hε : 0 < ε
⊢ ENNReal.ofReal ε ≠ 0

Next tactic:
simp only [Ne.def, ENNReal.ofReal_eq_zero, not_le, hε]
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  intro ε hε
  have A : ENNReal.ofReal ε ≠ 0 := by simp only [Ne.def, ENNReal.ofReal_eq_zero, not_le, hε]
  

Proof state:
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
ε : ℝ
hε : 0 < ε
A : ENNReal.ofReal ε ≠ 0
⊢ ∃ x ∈ Metric.closedBall f ε, x ∈ ↑(boundedContinuousFunction E p μ)

Next tactic:
obtain ⟨g, hg, g_mem⟩ :
      ∃ g : α →ᵇ E, snorm ((f : α → E) - (g : α → E)) p μ ≤ ENNReal.ofReal ε ∧ Memℒp g p μ :=
    (Lp.memℒp f).exists_boundedContinuous_snorm_sub_le hp A
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  intro ε hε
  have A : ENNReal.ofReal ε ≠ 0 := by simp only [Ne.def, ENNReal.ofReal_eq_zero, not_le, hε]
  obtain ⟨g, hg, g_mem⟩ :
      ∃ g : α →ᵇ E, snorm ((f : α → E) - (g : α → E)) p μ ≤ ENNReal.ofReal ε ∧ Memℒp g p μ :=
    (Lp.memℒp f).exists_boundedContinuous_snorm_sub_le hp A
  

Proof state:
case intro.intro
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
ε : ℝ
hε : 0 < ε
A : ENNReal.ofReal ε ≠ 0
g : α →ᵇ E
hg : snorm (↑↑f - ⇑g) p μ ≤ ENNReal.ofReal ε
g_mem : Memℒp (⇑g) p
⊢ ∃ x ∈ Metric.closedBall f ε, x ∈ ↑(boundedContinuousFunction E p μ)

Next tactic:
refine' ⟨g_mem.toLp _, _, ⟨g, rfl⟩⟩
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  intro ε hε
  have A : ENNReal.ofReal ε ≠ 0 := by simp only [Ne.def, ENNReal.ofReal_eq_zero, not_le, hε]
  obtain ⟨g, hg, g_mem⟩ :
      ∃ g : α →ᵇ E, snorm ((f : α → E) - (g : α → E)) p μ ≤ ENNReal.ofReal ε ∧ Memℒp g p μ :=
    (Lp.memℒp f).exists_boundedContinuous_snorm_sub_le hp A
  refine' ⟨g_mem.toLp _, _, ⟨g, rfl⟩⟩
  

Proof state:
case intro.intro
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
ε : ℝ
hε : 0 < ε
A : ENNReal.ofReal ε ≠ 0
g : α →ᵇ E
hg : snorm (↑↑f - ⇑g) p μ ≤ ENNReal.ofReal ε
g_mem : Memℒp (⇑g) p
⊢ Memℒp.toLp (⇑g) g_mem ∈ Metric.closedBall f ε

Next tactic:
simp only [dist_eq_norm, Metric.mem_closedBall']
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  intro ε hε
  have A : ENNReal.ofReal ε ≠ 0 := by simp only [Ne.def, ENNReal.ofReal_eq_zero, not_le, hε]
  obtain ⟨g, hg, g_mem⟩ :
      ∃ g : α →ᵇ E, snorm ((f : α → E) - (g : α → E)) p μ ≤ ENNReal.ofReal ε ∧ Memℒp g p μ :=
    (Lp.memℒp f).exists_boundedContinuous_snorm_sub_le hp A
  refine' ⟨g_mem.toLp _, _, ⟨g, rfl⟩⟩
  simp only [dist_eq_norm, Metric.mem_closedBall']
  

Proof state:
case intro.intro
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
ε : ℝ
hε : 0 < ε
A : ENNReal.ofReal ε ≠ 0
g : α →ᵇ E
hg : snorm (↑↑f - ⇑g) p μ ≤ ENNReal.ofReal ε
g_mem : Memℒp (⇑g) p
⊢ ‖f - Memℒp.toLp (⇑g) g_mem‖ ≤ ε

Next tactic:
rw [Lp.norm_def]
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  intro ε hε
  have A : ENNReal.ofReal ε ≠ 0 := by simp only [Ne.def, ENNReal.ofReal_eq_zero, not_le, hε]
  obtain ⟨g, hg, g_mem⟩ :
      ∃ g : α →ᵇ E, snorm ((f : α → E) - (g : α → E)) p μ ≤ ENNReal.ofReal ε ∧ Memℒp g p μ :=
    (Lp.memℒp f).exists_boundedContinuous_snorm_sub_le hp A
  refine' ⟨g_mem.toLp _, _, ⟨g, rfl⟩⟩
  simp only [dist_eq_norm, Metric.mem_closedBall']
  rw [Lp.norm_def]
  -- porting note: original proof started with:
  -- convert ENNReal.toReal_le_of_le_ofReal hε.le hg using 2
  -- the `convert` was completely borked and timed out
  

Proof state:
case intro.intro
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
ε : ℝ
hε : 0 < ε
A : ENNReal.ofReal ε ≠ 0
g : α →ᵇ E
hg : snorm (↑↑f - ⇑g) p μ ≤ ENNReal.ofReal ε
g_mem : Memℒp (⇑g) p
⊢ ENNReal.toReal (snorm (↑↑(f - Memℒp.toLp (⇑g) g_mem)) p μ) ≤ ε

Next tactic:
have key : snorm ((f : α → E) - (g : α → E)) p μ = snorm (f - Memℒp.toLp (↑g) g_mem) p μ := by
    apply snorm_congr_ae
    filter_upwards [coeFn_sub f (g_mem.toLp g), g_mem.coeFn_toLp] with x hx h'x
    simp only [hx, Pi.sub_apply, sub_right_inj, h'x]
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  intro ε hε
  have A : ENNReal.ofReal ε ≠ 0 := by simp only [Ne.def, ENNReal.ofReal_eq_zero, not_le, hε]
  obtain ⟨g, hg, g_mem⟩ :
      ∃ g : α →ᵇ E, snorm ((f : α → E) - (g : α → E)) p μ ≤ ENNReal.ofReal ε ∧ Memℒp g p μ :=
    (Lp.memℒp f).exists_boundedContinuous_snorm_sub_le hp A
  refine' ⟨g_mem.toLp _, _, ⟨g, rfl⟩⟩
  simp only [dist_eq_norm, Metric.mem_closedBall']
  rw [Lp.norm_def]
  -- porting note: original proof started with:
  -- convert ENNReal.toReal_le_of_le_ofReal hε.le hg using 2
  -- the `convert` was completely borked and timed out
  have key : snorm ((f : α → E) - (g : α → E)) p μ = snorm (f - Memℒp.toLp (↑g) g_mem) p μ := by
    

Proof state:
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
ε : ℝ
hε : 0 < ε
A : ENNReal.ofReal ε ≠ 0
g : α →ᵇ E
hg : snorm (↑↑f - ⇑g) p μ ≤ ENNReal.ofReal ε
g_mem : Memℒp (⇑g) p
⊢ snorm (↑↑f - ⇑g) p μ = snorm (↑↑(f - Memℒp.toLp (⇑g) g_mem)) p μ

Next tactic:
apply snorm_congr_ae
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  intro ε hε
  have A : ENNReal.ofReal ε ≠ 0 := by simp only [Ne.def, ENNReal.ofReal_eq_zero, not_le, hε]
  obtain ⟨g, hg, g_mem⟩ :
      ∃ g : α →ᵇ E, snorm ((f : α → E) - (g : α → E)) p μ ≤ ENNReal.ofReal ε ∧ Memℒp g p μ :=
    (Lp.memℒp f).exists_boundedContinuous_snorm_sub_le hp A
  refine' ⟨g_mem.toLp _, _, ⟨g, rfl⟩⟩
  simp only [dist_eq_norm, Metric.mem_closedBall']
  rw [Lp.norm_def]
  -- porting note: original proof started with:
  -- convert ENNReal.toReal_le_of_le_ofReal hε.le hg using 2
  -- the `convert` was completely borked and timed out
  have key : snorm ((f : α → E) - (g : α → E)) p μ = snorm (f - Memℒp.toLp (↑g) g_mem) p μ := by
    apply snorm_congr_ae
    

Proof state:
case hfg
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
ε : ℝ
hε : 0 < ε
A : ENNReal.ofReal ε ≠ 0
g : α →ᵇ E
hg : snorm (↑↑f - ⇑g) p μ ≤ ENNReal.ofReal ε
g_mem : Memℒp (⇑g) p
⊢ ↑↑f - ⇑g =ᵐ[μ] ↑↑(f - Memℒp.toLp (⇑g) g_mem)

Next tactic:
filter_upwards [coeFn_sub f (g_mem.toLp g), g_mem.coeFn_toLp] with x hx h'x
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  intro ε hε
  have A : ENNReal.ofReal ε ≠ 0 := by simp only [Ne.def, ENNReal.ofReal_eq_zero, not_le, hε]
  obtain ⟨g, hg, g_mem⟩ :
      ∃ g : α →ᵇ E, snorm ((f : α → E) - (g : α → E)) p μ ≤ ENNReal.ofReal ε ∧ Memℒp g p μ :=
    (Lp.memℒp f).exists_boundedContinuous_snorm_sub_le hp A
  refine' ⟨g_mem.toLp _, _, ⟨g, rfl⟩⟩
  simp only [dist_eq_norm, Metric.mem_closedBall']
  rw [Lp.norm_def]
  -- porting note: original proof started with:
  -- convert ENNReal.toReal_le_of_le_ofReal hε.le hg using 2
  -- the `convert` was completely borked and timed out
  have key : snorm ((f : α → E) - (g : α → E)) p μ = snorm (f - Memℒp.toLp (↑g) g_mem) p μ := by
    apply snorm_congr_ae
    filter_upwards [coeFn_sub f (g_mem.toLp g), g_mem.coeFn_toLp] with x hx h'x
    

Proof state:
case h
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
ε : ℝ
hε : 0 < ε
A : ENNReal.ofReal ε ≠ 0
g : α →ᵇ E
hg : snorm (↑↑f - ⇑g) p μ ≤ ENNReal.ofReal ε
g_mem : Memℒp (⇑g) p
x : α
hx : ↑↑(f - Memℒp.toLp (⇑g) g_mem) x = (↑↑f - ↑↑(Memℒp.toLp (⇑g) g_mem)) x
h'x : ↑↑(Memℒp.toLp (⇑g) g_mem) x = g x
⊢ (↑↑f - ⇑g) x = ↑↑(f - Memℒp.toLp (⇑g) g_mem) x

Next tactic:
simp only [hx, Pi.sub_apply, sub_right_inj, h'x]
/-- A function in `Lp` can be approximated in `Lp` by continuous functions. -/
theorem boundedContinuousFunction_dense [SecondCountableTopologyEither α E] [_i : Fact (1 ≤ p)]
    (hp : p ≠ ∞) [μ.WeaklyRegular] : (boundedContinuousFunction E p μ).topologicalClosure = ⊤ := by
  rw [AddSubgroup.eq_top_iff']
  intro f
  refine' mem_closure_iff_frequently.mpr _
  rw [Metric.nhds_basis_closedBall.frequently_iff]
  intro ε hε
  have A : ENNReal.ofReal ε ≠ 0 := by simp only [Ne.def, ENNReal.ofReal_eq_zero, not_le, hε]
  obtain ⟨g, hg, g_mem⟩ :
      ∃ g : α →ᵇ E, snorm ((f : α → E) - (g : α → E)) p μ ≤ ENNReal.ofReal ε ∧ Memℒp g p μ :=
    (Lp.memℒp f).exists_boundedContinuous_snorm_sub_le hp A
  refine' ⟨g_mem.toLp _, _, ⟨g, rfl⟩⟩
  simp only [dist_eq_norm, Metric.mem_closedBall']
  rw [Lp.norm_def]
  -- porting note: original proof started with:
  -- convert ENNReal.toReal_le_of_le_ofReal hε.le hg using 2
  -- the `convert` was completely borked and timed out
  have key : snorm ((f : α → E) - (g : α → E)) p μ = snorm (f - Memℒp.toLp (↑g) g_mem) p μ := by
    apply snorm_congr_ae
    filter_upwards [coeFn_sub f (g_mem.toLp g), g_mem.coeFn_toLp] with x hx h'x
    simp only [hx, Pi.sub_apply, sub_right_inj, h'x]
  

Proof state:
case intro.intro
α : Type u_1
inst✝⁷ : MeasurableSpace α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : T4Space α
inst✝⁴ : BorelSpace α
E : Type u_2
inst✝³ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝² : NormedSpace ℝ E
inst✝¹ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
inst✝ : Measure.WeaklyRegular μ
f : ↥(Lp E p)
ε : ℝ
hε : 0 < ε
A : ENNReal.ofReal ε ≠ 0
g : α →ᵇ E
hg : snorm (↑↑f - ⇑g) p μ ≤ ENNReal.ofReal ε
g_mem : Memℒp (⇑g) p
key : snorm (↑↑f - ⇑g) p μ = snorm (↑↑(f - Memℒp.toLp (⇑g) g_mem)) p μ
⊢ ENNReal.toReal (snorm (↑↑(f - Memℒp.toLp (⇑g) g_mem)) p μ) ≤ ε

Next tactic:
simpa only [key] using ENNReal.toReal_le_of_le_ofReal hε.le hg
theorem toLp_denseRange [μ.WeaklyRegular] [IsFiniteMeasure μ] :
    DenseRange (toLp p μ 𝕜 : (α →ᵇ E) →L[𝕜] Lp E p μ) := by
  

Proof state:
α : Type u_1
inst✝¹⁰ : MeasurableSpace α
inst✝⁹ : TopologicalSpace α
inst✝⁸ : T4Space α
inst✝⁷ : BorelSpace α
E : Type u_2
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝⁵ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
𝕜 : Type u_3
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAlgebra ℝ 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : Measure.WeaklyRegular μ
inst✝ : IsFiniteMeasure μ
⊢ DenseRange ⇑(toLp p μ 𝕜)

Next tactic:
haveI : NormedSpace ℝ E := RestrictScalars.normedSpace ℝ 𝕜 E
theorem toLp_denseRange [μ.WeaklyRegular] [IsFiniteMeasure μ] :
    DenseRange (toLp p μ 𝕜 : (α →ᵇ E) →L[𝕜] Lp E p μ) := by
  haveI : NormedSpace ℝ E := RestrictScalars.normedSpace ℝ 𝕜 E
  

Proof state:
α : Type u_1
inst✝¹⁰ : MeasurableSpace α
inst✝⁹ : TopologicalSpace α
inst✝⁸ : T4Space α
inst✝⁷ : BorelSpace α
E : Type u_2
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝⁵ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
𝕜 : Type u_3
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAlgebra ℝ 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : Measure.WeaklyRegular μ
inst✝ : IsFiniteMeasure μ
this : NormedSpace ℝ E
⊢ DenseRange ⇑(toLp p μ 𝕜)

Next tactic:
rw [denseRange_iff_closure_range]
theorem toLp_denseRange [μ.WeaklyRegular] [IsFiniteMeasure μ] :
    DenseRange (toLp p μ 𝕜 : (α →ᵇ E) →L[𝕜] Lp E p μ) := by
  haveI : NormedSpace ℝ E := RestrictScalars.normedSpace ℝ 𝕜 E
  rw [denseRange_iff_closure_range]
  

Proof state:
α : Type u_1
inst✝¹⁰ : MeasurableSpace α
inst✝⁹ : TopologicalSpace α
inst✝⁸ : T4Space α
inst✝⁷ : BorelSpace α
E : Type u_2
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝⁵ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
𝕜 : Type u_3
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAlgebra ℝ 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : Measure.WeaklyRegular μ
inst✝ : IsFiniteMeasure μ
this : NormedSpace ℝ E
⊢ closure (range ⇑(toLp p μ 𝕜)) = univ

Next tactic:
suffices (LinearMap.range (toLp p μ 𝕜 : _ →L[𝕜] Lp E p μ)).toAddSubgroup.topologicalClosure = ⊤
    by exact congr_arg ((↑) : AddSubgroup (Lp E p μ) → Set (Lp E p μ)) this
theorem toLp_denseRange [μ.WeaklyRegular] [IsFiniteMeasure μ] :
    DenseRange (toLp p μ 𝕜 : (α →ᵇ E) →L[𝕜] Lp E p μ) := by
  haveI : NormedSpace ℝ E := RestrictScalars.normedSpace ℝ 𝕜 E
  rw [denseRange_iff_closure_range]
  suffices (LinearMap.range (toLp p μ 𝕜 : _ →L[𝕜] Lp E p μ)).toAddSubgroup.topologicalClosure = ⊤
    by 

Proof state:
α : Type u_1
inst✝¹⁰ : MeasurableSpace α
inst✝⁹ : TopologicalSpace α
inst✝⁸ : T4Space α
inst✝⁷ : BorelSpace α
E : Type u_2
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝⁵ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
𝕜 : Type u_3
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAlgebra ℝ 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : Measure.WeaklyRegular μ
inst✝ : IsFiniteMeasure μ
this✝ : NormedSpace ℝ E
this : AddSubgroup.topologicalClosure (Submodule.toAddSubgroup (LinearMap.range (toLp p μ 𝕜))) = ⊤
⊢ closure (range ⇑(toLp p μ 𝕜)) = univ

Next tactic:
exact congr_arg ((↑) : AddSubgroup (Lp E p μ) → Set (Lp E p μ)) this
theorem toLp_denseRange [μ.WeaklyRegular] [IsFiniteMeasure μ] :
    DenseRange (toLp p μ 𝕜 : (α →ᵇ E) →L[𝕜] Lp E p μ) := by
  haveI : NormedSpace ℝ E := RestrictScalars.normedSpace ℝ 𝕜 E
  rw [denseRange_iff_closure_range]
  suffices (LinearMap.range (toLp p μ 𝕜 : _ →L[𝕜] Lp E p μ)).toAddSubgroup.topologicalClosure = ⊤
    by exact congr_arg ((↑) : AddSubgroup (Lp E p μ) → Set (Lp E p μ)) this
  

Proof state:
α : Type u_1
inst✝¹⁰ : MeasurableSpace α
inst✝⁹ : TopologicalSpace α
inst✝⁸ : T4Space α
inst✝⁷ : BorelSpace α
E : Type u_2
inst✝⁶ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝⁵ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
𝕜 : Type u_3
inst✝⁴ : NormedField 𝕜
inst✝³ : NormedAlgebra ℝ 𝕜
inst✝² : NormedSpace 𝕜 E
inst✝¹ : Measure.WeaklyRegular μ
inst✝ : IsFiniteMeasure μ
this : NormedSpace ℝ E
⊢ AddSubgroup.topologicalClosure (Submodule.toAddSubgroup (LinearMap.range (toLp p μ 𝕜))) = ⊤

Next tactic:
simpa [range_toLp p μ] using MeasureTheory.Lp.boundedContinuousFunction_dense E hp
/-- Continuous functions are dense in `MeasureTheory.Lp`, `1 ≤ p < ∞`. This theorem assumes that
the domain is a compact space because otherwise `ContinuousMap.toLp` is undefined. Use
`BoundedContinuousFunction.toLp_denseRange` if the domain is not a compact space.  -/
theorem toLp_denseRange [CompactSpace α] [μ.WeaklyRegular] [IsFiniteMeasure μ] :
    DenseRange (toLp p μ 𝕜 : C(α, E) →L[𝕜] Lp E p μ) := by
  

Proof state:
α : Type u_1
inst✝¹¹ : MeasurableSpace α
inst✝¹⁰ : TopologicalSpace α
inst✝⁹ : T4Space α
inst✝⁸ : BorelSpace α
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝⁶ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
𝕜 : Type u_3
inst✝⁵ : NormedField 𝕜
inst✝⁴ : NormedAlgebra ℝ 𝕜
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompactSpace α
inst✝¹ : Measure.WeaklyRegular μ
inst✝ : IsFiniteMeasure μ
⊢ DenseRange ⇑(toLp p μ 𝕜)

Next tactic:
refine (BoundedContinuousFunction.toLp_denseRange _ _ hp 𝕜).mono ?_
/-- Continuous functions are dense in `MeasureTheory.Lp`, `1 ≤ p < ∞`. This theorem assumes that
the domain is a compact space because otherwise `ContinuousMap.toLp` is undefined. Use
`BoundedContinuousFunction.toLp_denseRange` if the domain is not a compact space.  -/
theorem toLp_denseRange [CompactSpace α] [μ.WeaklyRegular] [IsFiniteMeasure μ] :
    DenseRange (toLp p μ 𝕜 : C(α, E) →L[𝕜] Lp E p μ) := by
  refine (BoundedContinuousFunction.toLp_denseRange _ _ hp 𝕜).mono ?_
  

Proof state:
α : Type u_1
inst✝¹¹ : MeasurableSpace α
inst✝¹⁰ : TopologicalSpace α
inst✝⁹ : T4Space α
inst✝⁸ : BorelSpace α
E : Type u_2
inst✝⁷ : NormedAddCommGroup E
μ : Measure α
p : ℝ≥0∞
inst✝⁶ : SecondCountableTopologyEither α E
_i : Fact (1 ≤ p)
hp : p ≠ ⊤
𝕜 : Type u_3
inst✝⁵ : NormedField 𝕜
inst✝⁴ : NormedAlgebra ℝ 𝕜
inst✝³ : NormedSpace 𝕜 E
inst✝² : CompactSpace α
inst✝¹ : Measure.WeaklyRegular μ
inst✝ : IsFiniteMeasure μ
⊢ range ⇑(BoundedContinuousFunction.toLp p μ 𝕜) ⊆ range ⇑(toLp p μ 𝕜)

Next tactic:
refine range_subset_iff.2 fun f ↦ ?_