/-- A continuous function is box-integrable with respect to any locally finite measure.

This is true for any volume with bounded variation. -/
theorem integrable_of_continuousOn [CompleteSpace E] {I : Box ι} {f : ℝⁿ → E}
    (hc : ContinuousOn f (Box.Icc I)) (μ : Measure ℝⁿ) [IsLocallyFiniteMeasure μ] :
    Integrable.{u, v, v} I l f μ.toBoxAdditive.toSMul := by
  have huc := I.isCompact_Icc.uniformContinuousOn_of_continuous hc
  rw [Metric.uniformContinuousOn_iff_le] at huc
  refine' integrable_iff_cauchy_basis.2 fun ε ε0 => _
  rcases exists_pos_mul_lt ε0 (μ.toBoxAdditive I) with ⟨ε', ε0', hε⟩
  rcases huc ε' ε0' with ⟨δ, δ0 : 0 < δ, Hδ⟩
  refine' ⟨fun _ _ => ⟨δ / 2, half_pos δ0⟩, fun _ _ _ => rfl, fun c₁ c₂ π₁ π₂ h₁ h₁p h₂ h₂p => _⟩
  simp only [dist_eq_norm, integralSum_sub_partitions _ _ h₁p h₂p, BoxAdditiveMap.toSMul_apply,
    ← smul_sub]
  have : ∀ J ∈ π₁.toPrepartition ⊓ π₂.toPrepartition,
      ‖μ.toBoxAdditive J • (f ((π₁.infPrepartition π₂.toPrepartition).tag J) -
        f ((π₂.infPrepartition π₁.toPrepartition).tag J))‖ ≤ μ.toBoxAdditive J * ε' := by
    intro J hJ
    have : 0 ≤ μ.toBoxAdditive J := ENNReal.toReal_nonneg
    rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg this, ← dist_eq_norm]
    refine' mul_le_mul_of_nonneg_left _ this
    refine' Hδ _ (TaggedPrepartition.tag_mem_Icc _ _) _ (TaggedPrepartition.tag_mem_Icc _ _) _
    rw [← add_halves δ]
    refine' (dist_triangle_left _ _ J.upper).trans (add_le_add (h₁.1 _ _ _) (h₂.1 _ _ _))
    · exact Prepartition.biUnionIndex_mem _ hJ
    · exact Box.le_iff_Icc.1 (Prepartition.le_biUnionIndex _ hJ) J.upper_mem_Icc
    · rw [_root_.inf_comm] at hJ
      exact Prepartition.biUnionIndex_mem _ hJ
    · rw [_root_.inf_comm] at hJ
      exact Box.le_iff_Icc.1 (Prepartition.le_biUnionIndex _ hJ) J.upper_mem_Icc
  

Proof state:
case intro.intro.intro.intro
ι : Type u
E : Type v
F : Type w
inst✝⁶ : NormedAddCommGroup E
inst✝⁵ : NormedSpace ℝ E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
I✝ J : Box ι
π : TaggedPrepartition I✝
inst✝² : Fintype ι
l : IntegrationParams
f✝ g : (ι → ℝ) → E
vol : ι →ᵇᵃ[⊤] E →L[ℝ] F
y y' : F
inst✝¹ : CompleteSpace E
I : Box ι
f : (ι → ℝ) → E
hc : ContinuousOn f (Box.Icc I)
μ : Measure (ι → ℝ)
inst✝ : IsLocallyFiniteMeasure μ
huc : ∀ ε > 0, ∃ δ > 0, ∀ x ∈ Box.Icc I, ∀ y ∈ Box.Icc I, dist x y ≤ δ → dist (f x) (f y) ≤ ε
ε : ℝ
ε0 : ε > 0
ε' : ℝ
ε0' : 0 < ε'
hε : (Measure.toBoxAdditive μ) I * ε' < ε
δ : ℝ
δ0 : 0 < δ
Hδ : ∀ x ∈ Box.Icc I, ∀ y ∈ Box.Icc I, dist x y ≤ δ → dist (f x) (f y) ≤ ε'
c₁ c₂ : ℝ≥0
π₁ π₂ : TaggedPrepartition I
h₁ : MemBaseSet l I c₁ ((fun x x => { val := δ / 2, property := (_ : 0 < δ / 2) }) c₁) π₁
h₁p : IsPartition π₁
h₂ : MemBaseSet l I c₂ ((fun x x => { val := δ / 2, property := (_ : 0 < δ / 2) }) c₂) π₂
h₂p : IsPartition π₂
this :
  ∀ J ∈ π₁.toPrepartition ⊓ π₂.toPrepartition,
    ‖(Measure.toBoxAdditive μ) J •
          (f (tag (infPrepartition π₁ π₂.toPrepartition) J) - f (tag (infPrepartition π₂ π₁.toPrepartition) J))‖ ≤
      (Measure.toBoxAdditive μ) J * ε'
⊢ ‖∑ x in (π₁.toPrepartition ⊓ π₂.toPrepartition).boxes,
        (Measure.toBoxAdditive μ) x •
          (f (tag (infPrepartition π₁ π₂.toPrepartition) x) - f (tag (infPrepartition π₂ π₁.toPrepartition) x))‖ ≤
    ε

Next tactic:
refine' (norm_sum_le_of_le _ this).trans _