l3lab/ntp-mathlib huggingface dataset:
/-- 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
    

Proof state:
ι : 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 π₂
J : Box ι
hJ : J ∈ π₁.toPrepartition ⊓ π₂.toPrepartition
⊢ ‖(Measure.toBoxAdditive μ) J •
        (f (tag (infPrepartition π₁ π₂.toPrepartition) J) - f (tag (infPrepartition π₂ π₁.toPrepartition) J))‖ ≤
    (Measure.toBoxAdditive μ) J * ε'

Next tactic:
have : 0 ≤ μ.toBoxAdditive J := ENNReal.toReal_nonneg
/-- 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
    

Proof state:
ι : 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 π₂
J : Box ι
hJ : J ∈ π₁.toPrepartition ⊓ π₂.toPrepartition
this : 0 ≤ (Measure.toBoxAdditive μ) J
⊢ ‖(Measure.toBoxAdditive μ) J •
        (f (tag (infPrepartition π₁ π₂.toPrepartition) J) - f (tag (infPrepartition π₂ π₁.toPrepartition) J))‖ ≤
    (Measure.toBoxAdditive μ) J * ε'

Next tactic:
rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg this, ← dist_eq_norm]
/-- 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]
    

Proof state:
ι : 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 π₂
J : Box ι
hJ : J ∈ π₁.toPrepartition ⊓ π₂.toPrepartition
this : 0 ≤ (Measure.toBoxAdditive μ) J
⊢ (Measure.toBoxAdditive μ) J *
      dist (f (tag (infPrepartition π₁ π₂.toPrepartition) J)) (f (tag (infPrepartition π₂ π₁.toPrepartition) J)) ≤
    (Measure.toBoxAdditive μ) J * ε'

Next tactic:
refine' mul_le_mul_of_nonneg_left _ this
/-- 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
    

Proof state:
ι : 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 π₂
J : Box ι
hJ : J ∈ π₁.toPrepartition ⊓ π₂.toPrepartition
this : 0 ≤ (Measure.toBoxAdditive μ) J
⊢ dist (f (tag (infPrepartition π₁ π₂.toPrepartition) J)) (f (tag (infPrepartition π₂ π₁.toPrepartition) J)) ≤ ε'

Next tactic:
refine' Hδ _ (TaggedPrepartition.tag_mem_Icc _ _) _ (TaggedPrepartition.tag_mem_Icc _ _) _
/-- 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 _ _) _
    

Proof state:
ι : 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 π₂
J : Box ι
hJ : J ∈ π₁.toPrepartition ⊓ π₂.toPrepartition
this : 0 ≤ (Measure.toBoxAdditive μ) J
⊢ dist (tag (infPrepartition π₁ π₂.toPrepartition) J) (tag (infPrepartition π₂ π₁.toPrepartition) J) ≤ δ

Next tactic:
rw [← add_halves δ]
/-- 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 δ]
    

Proof state:
ι : 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 π₂
J : Box ι
hJ : J ∈ π₁.toPrepartition ⊓ π₂.toPrepartition
this : 0 ≤ (Measure.toBoxAdditive μ) J
⊢ dist (tag (infPrepartition π₁ π₂.toPrepartition) J) (tag (infPrepartition π₂ π₁.toPrepartition) J) ≤ δ / 2 + δ / 2

Next tactic:
refine' (dist_triangle_left _ _ J.upper).trans (add_le_add (h₁.1 _ _ _) (h₂.1 _ _ _))
/-- 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 _ _ _))
    · 

Proof state:
case refine'_1
ι : 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 π₂
J : Box ι
hJ : J ∈ π₁.toPrepartition ⊓ π₂.toPrepartition
this : 0 ≤ (Measure.toBoxAdditive μ) J
⊢ Prepartition.biUnionIndex π₁.toPrepartition (fun J => Prepartition.restrict π₂.toPrepartition J) J ∈ π₁

Next tactic:
exact Prepartition.biUnionIndex_mem _ hJ
/-- 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
    · 

Proof state:
case refine'_2
ι : 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 π₂
J : Box ι
hJ : J ∈ π₁.toPrepartition ⊓ π₂.toPrepartition
this : 0 ≤ (Measure.toBoxAdditive μ) J
⊢ J.upper ∈ Box.Icc (Prepartition.biUnionIndex π₁.toPrepartition (fun J => Prepartition.restrict π₂.toPrepartition J) J)

Next tactic:
exact Box.le_iff_Icc.1 (Prepartition.le_biUnionIndex _ hJ) J.upper_mem_Icc
/-- 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
    · 

Proof state:
case refine'_3
ι : 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 π₂
J : Box ι
hJ : J ∈ π₁.toPrepartition ⊓ π₂.toPrepartition
this : 0 ≤ (Measure.toBoxAdditive μ) J
⊢ Prepartition.biUnionIndex π₂.toPrepartition (fun J => Prepartition.restrict π₁.toPrepartition J) J ∈ π₂

Next tactic:
rw [_root_.inf_comm] at hJ