l3lab/ntp-mathlib huggingface dataset:
theorem hausdorffMeasure_preimage_le (hf : AntilipschitzWith K f) (hd : 0 ≤ d) (s : Set Y) :
    μH[d] (f ⁻¹' s) ≤ (K : ℝ≥0∞) ^ d * μH[d] s := by
  rcases eq_or_ne K 0 with (rfl | h0)
  · rcases eq_empty_or_nonempty (f ⁻¹' s) with (hs | ⟨x, hx⟩)
    · simp only [hs, measure_empty, zero_le]
    have : f ⁻¹' s = {x} := by
      haveI : Subsingleton X := hf.subsingleton
      have : (f ⁻¹' s).Subsingleton := subsingleton_univ.anti (subset_univ _)
      exact (subsingleton_iff_singleton hx).1 this
    rw [this]
    rcases eq_or_lt_of_le hd with (rfl | h'd)
    · simp only [ENNReal.rpow_zero, one_mul, mul_zero]
      rw [hausdorffMeasure_zero_singleton]
      exact one_le_hausdorffMeasure_zero_of_nonempty ⟨f x, hx⟩
    · haveI := noAtoms_hausdorff X h'd
      simp only [zero_le, measure_singleton]
  have hKd0 : (K : ℝ≥0∞) ^ d ≠ 0 := by simp [h0]
  have hKd : (K : ℝ≥0∞) ^ d ≠ ∞ := by simp [hd]
  simp only [hausdorffMeasure_apply, ENNReal.mul_iSup, ENNReal.mul_iInf_of_ne hKd0 hKd,
    ← ENNReal.tsum_mul_left]
  refine' iSup₂_le fun ε ε0 => _
  refine' le_iSup₂_of_le (ε / K) (by simp [ε0.ne']) _
  refine' le_iInf₂ fun t hst => le_iInf fun htε => _
  replace hst : f ⁻¹' s ⊆ _ := preimage_mono hst; rw [preimage_iUnion] at hst
  refine' iInf₂_le_of_le _ hst (iInf_le_of_le (fun n => _) _)
  · exact (hf.ediam_preimage_le _).trans (ENNReal.mul_le_of_le_div' <| htε n)
  · refine' ENNReal.tsum_le_tsum fun n => iSup_le_iff.2 fun hft => _
    simp only [nonempty_of_nonempty_preimage hft, ciSup_pos]
    rw [← ENNReal.mul_rpow_of_nonneg _ _ hd]
    

Proof state:
case inr.refine'_2
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
f : X → Y
K : ℝ≥0
d : ℝ
hf : AntilipschitzWith K f
hd : 0 ≤ d
s : Set Y
h0 : K ≠ 0
hKd0 : ↑K ^ d ≠ 0
hKd : ↑K ^ d ≠ ⊤
ε : ℝ≥0∞
ε0 : 0 < ε
t : ℕ → Set Y
htε : ∀ (n : ℕ), diam (t n) ≤ ε / ↑K
hst : f ⁻¹' s ⊆ ⋃ i, f ⁻¹' t i
n : ℕ
hft : Set.Nonempty (f ⁻¹' t n)
⊢ diam (f ⁻¹' t n) ^ d ≤ (↑K * diam (t n)) ^ d

Next tactic:
exact ENNReal.rpow_le_rpow (hf.ediam_preimage_le _) hd
theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set X) :
    μH[d] (f '' s) = μH[d] s := by
  

Proof state:
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
f : X → Y
d : ℝ
hf : Isometry f
hd : 0 ≤ d ∨ Surjective f
s : Set X
⊢ ↑↑μH[d] (f '' s) = ↑↑μH[d] s

Next tactic:
simp only [hausdorffMeasure, ← OuterMeasure.coe_mkMetric, ← OuterMeasure.comap_apply]
theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set X) :
    μH[d] (f '' s) = μH[d] s := by
  simp only [hausdorffMeasure, ← OuterMeasure.coe_mkMetric, ← OuterMeasure.comap_apply]
  -- porting note: this proof was slightly nicer before the port
  

Proof state:
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
f : X → Y
d : ℝ
hf : Isometry f
hd : 0 ≤ d ∨ Surjective f
s : Set X
⊢ ↑((OuterMeasure.comap f) ↑(mkMetric fun r => r ^ d)) s = ↑(OuterMeasure.mkMetric fun r => r ^ d) s

Next tactic:
simp only [mkMetric_toOuterMeasure]
theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set X) :
    μH[d] (f '' s) = μH[d] s := by
  simp only [hausdorffMeasure, ← OuterMeasure.coe_mkMetric, ← OuterMeasure.comap_apply]
  -- porting note: this proof was slightly nicer before the port
  simp only [mkMetric_toOuterMeasure]
  

Proof state:
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
f : X → Y
d : ℝ
hf : Isometry f
hd : 0 ≤ d ∨ Surjective f
s : Set X
⊢ ↑((OuterMeasure.comap f) (OuterMeasure.mkMetric fun r => r ^ d)) s = ↑(OuterMeasure.mkMetric fun r => r ^ d) s

Next tactic:
have : 0 ≤ d → Monotone fun r : ℝ≥0∞ ↦ r ^ d := by
    exact fun hd x y hxy => ENNReal.rpow_le_rpow hxy hd
theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set X) :
    μH[d] (f '' s) = μH[d] s := by
  simp only [hausdorffMeasure, ← OuterMeasure.coe_mkMetric, ← OuterMeasure.comap_apply]
  -- porting note: this proof was slightly nicer before the port
  simp only [mkMetric_toOuterMeasure]
  have : 0 ≤ d → Monotone fun r : ℝ≥0∞ ↦ r ^ d := by
    

Proof state:
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
f : X → Y
d : ℝ
hf : Isometry f
hd : 0 ≤ d ∨ Surjective f
s : Set X
⊢ 0 ≤ d → Monotone fun r => r ^ d

Next tactic:
exact fun hd x y hxy => ENNReal.rpow_le_rpow hxy hd
theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set X) :
    μH[d] (f '' s) = μH[d] s := by
  simp only [hausdorffMeasure, ← OuterMeasure.coe_mkMetric, ← OuterMeasure.comap_apply]
  -- porting note: this proof was slightly nicer before the port
  simp only [mkMetric_toOuterMeasure]
  have : 0 ≤ d → Monotone fun r : ℝ≥0∞ ↦ r ^ d := by
    exact fun hd x y hxy => ENNReal.rpow_le_rpow hxy hd
  

Proof state:
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
f : X → Y
d : ℝ
hf : Isometry f
hd : 0 ≤ d ∨ Surjective f
s : Set X
this : 0 ≤ d → Monotone fun r => r ^ d
⊢ ↑((OuterMeasure.comap f) (OuterMeasure.mkMetric fun r => r ^ d)) s = ↑(OuterMeasure.mkMetric fun r => r ^ d) s

Next tactic:
have := OuterMeasure.isometry_comap_mkMetric (fun (r : ℝ≥0∞) => r ^ d) hf (hd.imp_left this)
theorem hausdorffMeasure_image (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set X) :
    μH[d] (f '' s) = μH[d] s := by
  simp only [hausdorffMeasure, ← OuterMeasure.coe_mkMetric, ← OuterMeasure.comap_apply]
  -- porting note: this proof was slightly nicer before the port
  simp only [mkMetric_toOuterMeasure]
  have : 0 ≤ d → Monotone fun r : ℝ≥0∞ ↦ r ^ d := by
    exact fun hd x y hxy => ENNReal.rpow_le_rpow hxy hd
  have := OuterMeasure.isometry_comap_mkMetric (fun (r : ℝ≥0∞) => r ^ d) hf (hd.imp_left this)
  

Proof state:
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
f : X → Y
d : ℝ
hf : Isometry f
hd : 0 ≤ d ∨ Surjective f
s : Set X
this✝ : 0 ≤ d → Monotone fun r => r ^ d
this : (OuterMeasure.comap f) (OuterMeasure.mkMetric fun r => r ^ d) = OuterMeasure.mkMetric fun r => r ^ d
⊢ ↑((OuterMeasure.comap f) (OuterMeasure.mkMetric fun r => r ^ d)) s = ↑(OuterMeasure.mkMetric fun r => r ^ d) s

Next tactic:
congr
theorem hausdorffMeasure_preimage (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) (s : Set Y) :
    μH[d] (f ⁻¹' s) = μH[d] (s ∩ range f) := by
  

Proof state:
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
f : X → Y
d : ℝ
hf : Isometry f
hd : 0 ≤ d ∨ Surjective f
s : Set Y
⊢ ↑↑μH[d] (f ⁻¹' s) = ↑↑μH[d] (s ∩ range f)

Next tactic:
rw [← hf.hausdorffMeasure_image hd, image_preimage_eq_inter_range]
theorem map_hausdorffMeasure (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) :
    Measure.map f μH[d] = μH[d].restrict (range f) := by
  

Proof state:
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
f : X → Y
d : ℝ
hf : Isometry f
hd : 0 ≤ d ∨ Surjective f
⊢ Measure.map f μH[d] = Measure.restrict μH[d] (range f)

Next tactic:
ext1 s hs
theorem map_hausdorffMeasure (hf : Isometry f) (hd : 0 ≤ d ∨ Surjective f) :
    Measure.map f μH[d] = μH[d].restrict (range f) := by
  ext1 s hs
  

Proof state:
case h
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
f : X → Y
d : ℝ
hf : Isometry f
hd : 0 ≤ d ∨ Surjective f
s : Set Y
hs : MeasurableSet s
⊢ ↑↑(Measure.map f μH[d]) s = ↑↑(Measure.restrict μH[d] (range f)) s

Next tactic:
rw [map_apply hf.continuous.measurable hs, Measure.restrict_apply hs,
    hf.hausdorffMeasure_preimage hd]
@[simp]
theorem hausdorffMeasure_preimage (e : X ≃ᵢ Y) (d : ℝ) (s : Set Y) : μH[d] (e ⁻¹' s) = μH[d] s := by
  

Proof state:
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
e : X ≃ᵢ Y
d : ℝ
s : Set Y
⊢ ↑↑μH[d] (⇑e ⁻¹' s) = ↑↑μH[d] s

Next tactic:
rw [← e.image_symm, e.symm.hausdorffMeasure_image]
@[simp]
theorem map_hausdorffMeasure (e : X ≃ᵢ Y) (d : ℝ) : Measure.map e μH[d] = μH[d] := by
  

Proof state:
ι : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁵ : EMetricSpace X
inst✝⁴ : EMetricSpace Y
inst✝³ : MeasurableSpace X
inst✝² : BorelSpace X
inst✝¹ : MeasurableSpace Y
inst✝ : BorelSpace Y
e : X ≃ᵢ Y
d : ℝ
⊢ Measure.map ⇑e μH[d] = μH[d]

Next tactic:
rw [e.isometry.map_hausdorffMeasure (Or.inr e.surjective), e.surjective.range_eq, restrict_univ]
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
⊢ μH[↑(Fintype.card ι)] = volume

Next tactic:
refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
  

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
⊢ ∀ (s : ι → Set ℝ),
    (∀ (i : ι), s i ∈ ⋃ a, ⋃ b, ⋃ (_ : a < b), {Ioo ↑a ↑b}) →
      ↑↑μH[↑(Fintype.card ι)] (Set.pi univ s) = ∏ i : ι, ↑↑volume (s i)

Next tactic:
simp only [mem_iUnion, mem_singleton_iff]
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
  simp only [mem_iUnion, mem_singleton_iff]
  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
  

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
⊢ ∀ (s : ι → Set ℝ),
    (∀ (i : ι), ∃ i_1 i_2, ∃ (_ : i_1 < i_2), s i = Ioo ↑i_1 ↑i_2) →
      ↑↑μH[↑(Fintype.card ι)] (Set.pi univ s) = ∏ i : ι, ↑↑volume (s i)

Next tactic:
intro s hs
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
  simp only [mem_iUnion, mem_singleton_iff]
  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
  intro s hs
  

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
s : ι → Set ℝ
hs : ∀ (i : ι), ∃ i_1 i_2, ∃ (_ : i_1 < i_2), s i = Ioo ↑i_1 ↑i_2
⊢ ↑↑μH[↑(Fintype.card ι)] (Set.pi univ s) = ∏ i : ι, ↑↑volume (s i)

Next tactic:
choose a b H using hs
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
  simp only [mem_iUnion, mem_singleton_iff]
  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
  intro s hs
  choose a b H using hs
  

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
s : ι → Set ℝ
a b : ι → ℚ
H : ∀ (i : ι), ∃ (_ : a i < b i), s i = Ioo ↑(a i) ↑(b i)
⊢ ↑↑μH[↑(Fintype.card ι)] (Set.pi univ s) = ∏ i : ι, ↑↑volume (s i)

Next tactic:
obtain rfl : s = fun i => Ioo (α := ℝ) (a i) (b i)
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
  simp only [mem_iUnion, mem_singleton_iff]
  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
  intro s hs
  choose a b H using hs
  obtain rfl : s = fun i => Ioo (α := ℝ) (a i) (b i)
  

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
s : ι → Set ℝ
a b : ι → ℚ
H : ∀ (i : ι), ∃ (_ : a i < b i), s i = Ioo ↑(a i) ↑(b i)
⊢ s = fun i => Ioo ↑(a i) ↑(b i)
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
a b : ι → ℚ
H : ∀ (i : ι), ∃ (_ : a i < b i), (fun i => Ioo ↑(a i) ↑(b i)) i = Ioo ↑(a i) ↑(b i)
⊢ ↑↑μH[↑(Fintype.card ι)] (Set.pi univ fun i => Ioo ↑(a i) ↑(b i)) = ∏ i : ι, ↑↑volume ((fun i => Ioo ↑(a i) ↑(b i)) i)

Next tactic:
exact funext fun i => (H i).2
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
  simp only [mem_iUnion, mem_singleton_iff]
  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
  intro s hs
  choose a b H using hs
  obtain rfl : s = fun i => Ioo (α := ℝ) (a i) (b i)
  exact funext fun i => (H i).2
  

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
a b : ι → ℚ
H : ∀ (i : ι), ∃ (_ : a i < b i), (fun i => Ioo ↑(a i) ↑(b i)) i = Ioo ↑(a i) ↑(b i)
⊢ ↑↑μH[↑(Fintype.card ι)] (Set.pi univ fun i => Ioo ↑(a i) ↑(b i)) = ∏ i : ι, ↑↑volume ((fun i => Ioo ↑(a i) ↑(b i)) i)

Next tactic:
replace H := fun i => (H i).1
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
  simp only [mem_iUnion, mem_singleton_iff]
  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
  intro s hs
  choose a b H using hs
  obtain rfl : s = fun i => Ioo (α := ℝ) (a i) (b i)
  exact funext fun i => (H i).2
  replace H := fun i => (H i).1
  

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
a b : ι → ℚ
H : ∀ (i : ι), a i < b i
⊢ ↑↑μH[↑(Fintype.card ι)] (Set.pi univ fun i => Ioo ↑(a i) ↑(b i)) = ∏ i : ι, ↑↑volume ((fun i => Ioo ↑(a i) ↑(b i)) i)

Next tactic:
apply le_antisymm _
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
  simp only [mem_iUnion, mem_singleton_iff]
  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
  intro s hs
  choose a b H using hs
  obtain rfl : s = fun i => Ioo (α := ℝ) (a i) (b i)
  exact funext fun i => (H i).2
  replace H := fun i => (H i).1
  apply le_antisymm _
  -- first check that `volume s ≤ μH s`
  · 

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
a b : ι → ℚ
H : ∀ (i : ι), a i < b i
⊢ ∏ i : ι, ↑↑volume ((fun i => Ioo ↑(a i) ↑(b i)) i) ≤ ↑↑μH[↑(Fintype.card ι)] (Set.pi univ fun i => Ioo ↑(a i) ↑(b i))

Next tactic:
have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) := by
      refine' le_hausdorffMeasure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
      rw [ENNReal.rpow_nat_cast]
      exact Real.volume_pi_le_diam_pow s
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
  simp only [mem_iUnion, mem_singleton_iff]
  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
  intro s hs
  choose a b H using hs
  obtain rfl : s = fun i => Ioo (α := ℝ) (a i) (b i)
  exact funext fun i => (H i).2
  replace H := fun i => (H i).1
  apply le_antisymm _
  -- first check that `volume s ≤ μH s`
  · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) := by
      

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
a b : ι → ℚ
H : ∀ (i : ι), a i < b i
⊢ volume ≤ μH[↑(Fintype.card ι)]

Next tactic:
refine' le_hausdorffMeasure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
  simp only [mem_iUnion, mem_singleton_iff]
  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
  intro s hs
  choose a b H using hs
  obtain rfl : s = fun i => Ioo (α := ℝ) (a i) (b i)
  exact funext fun i => (H i).2
  replace H := fun i => (H i).1
  apply le_antisymm _
  -- first check that `volume s ≤ μH s`
  · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) := by
      refine' le_hausdorffMeasure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
      

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
a b : ι → ℚ
H : ∀ (i : ι), a i < b i
s : Set (ι → ℝ)
x✝ : diam s ≤ ⊤
⊢ ↑↑volume s ≤ diam s ^ ↑(Fintype.card ι)

Next tactic:
rw [ENNReal.rpow_nat_cast]
/-- In the space `ι → ℝ`, the Hausdorff measure coincides exactly with the Lebesgue measure. -/
@[simp]
theorem hausdorffMeasure_pi_real {ι : Type*} [Fintype ι] :
    (μH[Fintype.card ι] : Measure (ι → ℝ)) = volume := by
  classical
  -- it suffices to check that the two measures coincide on products of rational intervals
  refine'
    (pi_eq_generateFrom (fun _ => Real.borel_eq_generateFrom_Ioo_rat.symm)
        (fun _ => Real.isPiSystem_Ioo_rat) (fun _ => Real.finiteSpanningSetsInIooRat _) _).symm
  simp only [mem_iUnion, mem_singleton_iff]
  -- fix such a product `s` of rational intervals, of the form `Π (a i, b i)`.
  intro s hs
  choose a b H using hs
  obtain rfl : s = fun i => Ioo (α := ℝ) (a i) (b i)
  exact funext fun i => (H i).2
  replace H := fun i => (H i).1
  apply le_antisymm _
  -- first check that `volume s ≤ μH s`
  · have Hle : volume ≤ (μH[Fintype.card ι] : Measure (ι → ℝ)) := by
      refine' le_hausdorffMeasure _ _ ∞ ENNReal.coe_lt_top fun s _ => _
      rw [ENNReal.rpow_nat_cast]
      

Proof state:
ι✝ : Type u_1
X : Type u_2
Y : Type u_3
inst✝⁶ : EMetricSpace X
inst✝⁵ : EMetricSpace Y
inst✝⁴ : MeasurableSpace X
inst✝³ : BorelSpace X
inst✝² : MeasurableSpace Y
inst✝¹ : BorelSpace Y
ι : Type u_4
inst✝ : Fintype ι
a b : ι → ℚ
H : ∀ (i : ι), a i < b i
s : Set (ι → ℝ)
x✝ : diam s ≤ ⊤
⊢ ↑↑volume s ≤ diam s ^ Fintype.card ι

Next tactic:
exact Real.volume_pi_le_diam_pow s