l3lab/ntp-mathlib huggingface dataset:
/-- The volume on the real line (as a particular case of the volume on a finite-dimensional
inner product space) coincides with the Stieltjes measure coming from the identity function. -/
theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by
  haveI : IsAddLeftInvariant StieltjesFunction.id.measure :=
    ⟨fun a =>
      Eq.symm <|
        Real.measure_ext_Ioo_rat fun p q => by
          simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo,
            sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim,
            StieltjesFunction.id_apply, id.def, preimage_const_add_Ioo]⟩
  have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by
    change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1
    rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;>
      simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id.def, tsub_zero,
        StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one]
  conv_rhs =>
    

Proof state:
ι : Type u_1
inst✝ : Fintype ι
this : IsAddLeftInvariant (StieltjesFunction.measure StieltjesFunction.id)
A :
  ↑↑(StieltjesFunction.measure StieltjesFunction.id)
      ↑(Basis.parallelepiped (OrthonormalBasis.toBasis (stdOrthonormalBasis ℝ ℝ))) =
    1
| StieltjesFunction.measure StieltjesFunction.id

Next tactic:
rw [addHaarMeasure_unique StieltjesFunction.id.measure
        (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped, A]
/-- The volume on the real line (as a particular case of the volume on a finite-dimensional
inner product space) coincides with the Stieltjes measure coming from the identity function. -/
theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by
  haveI : IsAddLeftInvariant StieltjesFunction.id.measure :=
    ⟨fun a =>
      Eq.symm <|
        Real.measure_ext_Ioo_rat fun p q => by
          simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo,
            sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim,
            StieltjesFunction.id_apply, id.def, preimage_const_add_Ioo]⟩
  have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by
    change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1
    rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;>
      simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id.def, tsub_zero,
        StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one]
  conv_rhs =>
    rw [addHaarMeasure_unique StieltjesFunction.id.measure
        (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped, A]
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
this : IsAddLeftInvariant (StieltjesFunction.measure StieltjesFunction.id)
A :
  ↑↑(StieltjesFunction.measure StieltjesFunction.id)
      ↑(Basis.parallelepiped (OrthonormalBasis.toBasis (stdOrthonormalBasis ℝ ℝ))) =
    1
⊢ volume = 1 • addHaarMeasure (Basis.parallelepiped (OrthonormalBasis.toBasis (stdOrthonormalBasis ℝ ℝ)))

Next tactic:
simp only [volume, Basis.addHaar, one_smul]
theorem volume_val (s) : volume s = StieltjesFunction.id.measure s := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
s : Set ℝ
⊢ ↑↑volume s = ↑↑(StieltjesFunction.measure StieltjesFunction.id) s

Next tactic:
simp [volume_eq_stieltjes_id]
@[simp]
theorem volume_Ico {a b : ℝ} : volume (Ico a b) = ofReal (b - a) := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a b : ℝ
⊢ ↑↑volume (Ico a b) = ofReal (b - a)

Next tactic:
simp [volume_val]
@[simp]
theorem volume_Icc {a b : ℝ} : volume (Icc a b) = ofReal (b - a) := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a b : ℝ
⊢ ↑↑volume (Icc a b) = ofReal (b - a)

Next tactic:
simp [volume_val]
@[simp]
theorem volume_Ioo {a b : ℝ} : volume (Ioo a b) = ofReal (b - a) := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a b : ℝ
⊢ ↑↑volume (Ioo a b) = ofReal (b - a)

Next tactic:
simp [volume_val]
@[simp]
theorem volume_Ioc {a b : ℝ} : volume (Ioc a b) = ofReal (b - a) := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a b : ℝ
⊢ ↑↑volume (Ioc a b) = ofReal (b - a)

Next tactic:
simp [volume_val]
theorem volume_singleton {a : ℝ} : volume ({a} : Set ℝ) = 0 := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
⊢ ↑↑volume {a} = 0

Next tactic:
simp [volume_val]
theorem volume_univ : volume (univ : Set ℝ) = ∞ :=
  ENNReal.eq_top_of_forall_nnreal_le fun r =>
    calc
      (r : ℝ≥0∞) = volume (Icc (0 : ℝ) r) := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
r : ℝ≥0
⊢ ↑r = ↑↑volume (Icc 0 ↑r)

Next tactic:
simp
@[simp]
theorem volume_ball (a r : ℝ) : volume (Metric.ball a r) = ofReal (2 * r) := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a r : ℝ
⊢ ↑↑volume (Metric.ball a r) = ofReal (2 * r)

Next tactic:
rw [ball_eq_Ioo, volume_Ioo, ← sub_add, add_sub_cancel', two_mul]
@[simp]
theorem volume_closedBall (a r : ℝ) : volume (Metric.closedBall a r) = ofReal (2 * r) := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a r : ℝ
⊢ ↑↑volume (Metric.closedBall a r) = ofReal (2 * r)

Next tactic:
rw [closedBall_eq_Icc, volume_Icc, ← sub_add, add_sub_cancel', two_mul]
@[simp]
theorem volume_emetric_ball (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.ball a r) = 2 * r := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
r : ℝ≥0∞
⊢ ↑↑volume (EMetric.ball a r) = 2 * r

Next tactic:
rcases eq_or_ne r ∞ with (rfl | hr)
@[simp]
theorem volume_emetric_ball (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.ball a r) = 2 * r := by
  rcases eq_or_ne r ∞ with (rfl | hr)
  · 

Proof state:
case inl
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
⊢ ↑↑volume (EMetric.ball a ⊤) = 2 * ⊤

Next tactic:
rw [Metric.emetric_ball_top, volume_univ, two_mul, _root_.top_add]
@[simp]
theorem volume_emetric_ball (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.ball a r) = 2 * r := by
  rcases eq_or_ne r ∞ with (rfl | hr)
  · rw [Metric.emetric_ball_top, volume_univ, two_mul, _root_.top_add]
  · 

Proof state:
case inr
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
r : ℝ≥0∞
hr : r ≠ ⊤
⊢ ↑↑volume (EMetric.ball a r) = 2 * r

Next tactic:
lift r to ℝ≥0 using hr
@[simp]
theorem volume_emetric_ball (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.ball a r) = 2 * r := by
  rcases eq_or_ne r ∞ with (rfl | hr)
  · rw [Metric.emetric_ball_top, volume_univ, two_mul, _root_.top_add]
  · lift r to ℝ≥0 using hr
    

Proof state:
case inr.intro
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
r : ℝ≥0
⊢ ↑↑volume (EMetric.ball a ↑r) = 2 * ↑r

Next tactic:
rw [Metric.emetric_ball_nnreal, volume_ball, two_mul, ← NNReal.coe_add,
      ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul]
@[simp]
theorem volume_emetric_closedBall (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.closedBall a r) = 2 * r := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
r : ℝ≥0∞
⊢ ↑↑volume (EMetric.closedBall a r) = 2 * r

Next tactic:
rcases eq_or_ne r ∞ with (rfl | hr)
@[simp]
theorem volume_emetric_closedBall (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.closedBall a r) = 2 * r := by
  rcases eq_or_ne r ∞ with (rfl | hr)
  · 

Proof state:
case inl
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
⊢ ↑↑volume (EMetric.closedBall a ⊤) = 2 * ⊤

Next tactic:
rw [EMetric.closedBall_top, volume_univ, two_mul, _root_.top_add]
@[simp]
theorem volume_emetric_closedBall (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.closedBall a r) = 2 * r := by
  rcases eq_or_ne r ∞ with (rfl | hr)
  · rw [EMetric.closedBall_top, volume_univ, two_mul, _root_.top_add]
  · 

Proof state:
case inr
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
r : ℝ≥0∞
hr : r ≠ ⊤
⊢ ↑↑volume (EMetric.closedBall a r) = 2 * r

Next tactic:
lift r to ℝ≥0 using hr
@[simp]
theorem volume_emetric_closedBall (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.closedBall a r) = 2 * r := by
  rcases eq_or_ne r ∞ with (rfl | hr)
  · rw [EMetric.closedBall_top, volume_univ, two_mul, _root_.top_add]
  · lift r to ℝ≥0 using hr
    

Proof state:
case inr.intro
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
r : ℝ≥0
⊢ ↑↑volume (EMetric.closedBall a ↑r) = 2 * ↑r

Next tactic:
rw [Metric.emetric_closedBall_nnreal, volume_closedBall, two_mul, ← NNReal.coe_add,
      ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul]
@[simp]
theorem volume_interval {a b : ℝ} : volume (uIcc a b) = ofReal |b - a| := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a b : ℝ
⊢ ↑↑volume (uIcc a b) = ofReal |b - a|

Next tactic:
rw [← Icc_min_max, volume_Icc, max_sub_min_eq_abs]
@[simp]
theorem volume_Ioi {a : ℝ} : volume (Ioi a) = ∞ :=
  top_unique <|
    le_of_tendsto' ENNReal.tendsto_nat_nhds_top fun n =>
      calc
        (n : ℝ≥0∞) = volume (Ioo a (a + n)) := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
n : ℕ
⊢ ↑n = ↑↑volume (Ioo a (a + ↑n))

Next tactic:
simp
@[simp]
theorem volume_Ici {a : ℝ} : volume (Ici a) = ∞ := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
⊢ ↑↑volume (Ici a) = ⊤

Next tactic:
rw [← measure_congr Ioi_ae_eq_Ici]
@[simp]
theorem volume_Ici {a : ℝ} : volume (Ici a) = ∞ := by rw [← measure_congr Ioi_ae_eq_Ici]; 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
⊢ ↑↑volume (Ioi a) = ⊤

Next tactic:
simp
@[simp]
theorem volume_Iio {a : ℝ} : volume (Iio a) = ∞ :=
  top_unique <|
    le_of_tendsto' ENNReal.tendsto_nat_nhds_top fun n =>
      calc
        (n : ℝ≥0∞) = volume (Ioo (a - n) a) := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
n : ℕ
⊢ ↑n = ↑↑volume (Ioo (a - ↑n) a)

Next tactic:
simp
@[simp]
theorem volume_Iic {a : ℝ} : volume (Iic a) = ∞ := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
⊢ ↑↑volume (Iic a) = ⊤

Next tactic:
rw [← measure_congr Iio_ae_eq_Iic]
@[simp]
theorem volume_Iic {a : ℝ} : volume (Iic a) = ∞ := by rw [← measure_congr Iio_ae_eq_Iic]; 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
⊢ ↑↑volume (Iio a) = ⊤

Next tactic:
simp
instance locallyFinite_volume : IsLocallyFiniteMeasure (volume : Measure ℝ) :=
  ⟨fun x =>
    ⟨Ioo (x - 1) (x + 1),
      IsOpen.mem_nhds isOpen_Ioo ⟨sub_lt_self _ zero_lt_one, lt_add_of_pos_right _ zero_lt_one⟩, by
      

Proof state:
ι : Type u_1
inst✝ : Fintype ι
x : ℝ
⊢ ↑↑volume (Ioo (x - 1) (x + 1)) < ⊤

Next tactic:
simp only [Real.volume_Ioo, ENNReal.ofReal_lt_top]
instance isFiniteMeasure_restrict_Icc (x y : ℝ) : IsFiniteMeasure (volume.restrict (Icc x y)) :=
  ⟨by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
x y : ℝ
⊢ ↑↑(Measure.restrict volume (Icc x y)) univ < ⊤

Next tactic:
simp
instance isFiniteMeasure_restrict_Ico (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ico x y)) :=
  ⟨by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
x y : ℝ
⊢ ↑↑(Measure.restrict volume (Ico x y)) univ < ⊤

Next tactic:
simp
instance isFiniteMeasure_restrict_Ioc (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ioc x y)) :=
  ⟨by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
x y : ℝ
⊢ ↑↑(Measure.restrict volume (Ioc x y)) univ < ⊤

Next tactic:
simp
instance isFiniteMeasure_restrict_Ioo (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ioo x y)) :=
  ⟨by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
x y : ℝ
⊢ ↑↑(Measure.restrict volume (Ioo x y)) univ < ⊤

Next tactic:
simp
theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
s : Set ℝ
⊢ ↑↑volume s ≤ EMetric.diam s

Next tactic:
by_cases hs : Bornology.IsBounded s
theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s := by
  by_cases hs : Bornology.IsBounded s
  · 

Proof state:
case pos
ι : Type u_1
inst✝ : Fintype ι
s : Set ℝ
hs : Bornology.IsBounded s
⊢ ↑↑volume s ≤ EMetric.diam s

Next tactic:
rw [Real.ediam_eq hs, ← volume_Icc]
theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s := by
  by_cases hs : Bornology.IsBounded s
  · rw [Real.ediam_eq hs, ← volume_Icc]
    

Proof state:
case pos
ι : Type u_1
inst✝ : Fintype ι
s : Set ℝ
hs : Bornology.IsBounded s
⊢ ↑↑volume s ≤ ↑↑volume (Icc (sInf s) (sSup s))

Next tactic:
exact volume.mono (Real.subset_Icc_sInf_sSup_of_isBounded hs)
theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s := by
  by_cases hs : Bornology.IsBounded s
  · rw [Real.ediam_eq hs, ← volume_Icc]
    exact volume.mono (Real.subset_Icc_sInf_sSup_of_isBounded hs)
  · 

Proof state:
case neg
ι : Type u_1
inst✝ : Fintype ι
s : Set ℝ
hs : ¬Bornology.IsBounded s
⊢ ↑↑volume s ≤ EMetric.diam s

Next tactic:
rw [Metric.ediam_of_unbounded hs]
theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s := by
  by_cases hs : Bornology.IsBounded s
  · rw [Real.ediam_eq hs, ← volume_Icc]
    exact volume.mono (Real.subset_Icc_sInf_sSup_of_isBounded hs)
  · rw [Metric.ediam_of_unbounded hs]; 

Proof state:
case neg
ι : Type u_1
inst✝ : Fintype ι
s : Set ℝ
hs : ¬Bornology.IsBounded s
⊢ ↑↑volume s ≤ ⊤

Next tactic:
exact le_top
theorem _root_.Filter.Eventually.volume_pos_of_nhds_real {p : ℝ → Prop} {a : ℝ}
    (h : ∀ᶠ x in 𝓝 a, p x) : (0 : ℝ≥0∞) < volume { x | p x } := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
p : ℝ → Prop
a : ℝ
h : ∀ᶠ (x : ℝ) in 𝓝 a, p x
⊢ 0 < ↑↑volume {x | p x}

Next tactic:
rcases h.exists_Ioo_subset with ⟨l, u, hx, hs⟩
theorem _root_.Filter.Eventually.volume_pos_of_nhds_real {p : ℝ → Prop} {a : ℝ}
    (h : ∀ᶠ x in 𝓝 a, p x) : (0 : ℝ≥0∞) < volume { x | p x } := by
  rcases h.exists_Ioo_subset with ⟨l, u, hx, hs⟩
  

Proof state:
case intro.intro.intro
ι : Type u_1
inst✝ : Fintype ι
p : ℝ → Prop
a : ℝ
h : ∀ᶠ (x : ℝ) in 𝓝 a, p x
l u : ℝ
hx : a ∈ Ioo l u
hs : Ioo l u ⊆ {x | p x}
⊢ 0 < ↑↑volume {x | p x}

Next tactic:
refine' lt_of_lt_of_le _ (measure_mono hs)
theorem _root_.Filter.Eventually.volume_pos_of_nhds_real {p : ℝ → Prop} {a : ℝ}
    (h : ∀ᶠ x in 𝓝 a, p x) : (0 : ℝ≥0∞) < volume { x | p x } := by
  rcases h.exists_Ioo_subset with ⟨l, u, hx, hs⟩
  refine' lt_of_lt_of_le _ (measure_mono hs)
  

Proof state:
case intro.intro.intro
ι : Type u_1
inst✝ : Fintype ι
p : ℝ → Prop
a : ℝ
h : ∀ᶠ (x : ℝ) in 𝓝 a, p x
l u : ℝ
hx : a ∈ Ioo l u
hs : Ioo l u ⊆ {x | p x}
⊢ 0 < ↑↑volume (Ioo l u)

Next tactic:
simpa [-mem_Ioo] using hx.1.trans hx.2
theorem volume_Icc_pi {a b : ι → ℝ} : volume (Icc a b) = ∏ i, ENNReal.ofReal (b i - a i) := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a b : ι → ℝ
⊢ ↑↑volume (Icc a b) = ∏ i : ι, ofReal (b i - a i)

Next tactic:
rw [← pi_univ_Icc, volume_pi_pi]
theorem volume_Icc_pi {a b : ι → ℝ} : volume (Icc a b) = ∏ i, ENNReal.ofReal (b i - a i) := by
  rw [← pi_univ_Icc, volume_pi_pi]
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a b : ι → ℝ
⊢ ∏ i : ι, ↑↑volume (Icc (a i) (b i)) = ∏ i : ι, ofReal (b i - a i)

Next tactic:
simp only [Real.volume_Icc]
@[simp]
theorem volume_Icc_pi_toReal {a b : ι → ℝ} (h : a ≤ b) :
    (volume (Icc a b)).toReal = ∏ i, (b i - a i) := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a b : ι → ℝ
h : a ≤ b
⊢ ENNReal.toReal (↑↑volume (Icc a b)) = ∏ i : ι, (b i - a i)

Next tactic:
simp only [volume_Icc_pi, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
@[simp]
theorem volume_pi_Ioo_toReal {a b : ι → ℝ} (h : a ≤ b) :
    (volume (pi univ fun i => Ioo (a i) (b i))).toReal = ∏ i, (b i - a i) := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a b : ι → ℝ
h : a ≤ b
⊢ ENNReal.toReal (↑↑volume (Set.pi univ fun i => Ioo (a i) (b i))) = ∏ i : ι, (b i - a i)

Next tactic:
simp only [volume_pi_Ioo, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
@[simp]
theorem volume_pi_Ioc_toReal {a b : ι → ℝ} (h : a ≤ b) :
    (volume (pi univ fun i => Ioc (a i) (b i))).toReal = ∏ i, (b i - a i) := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a b : ι → ℝ
h : a ≤ b
⊢ ENNReal.toReal (↑↑volume (Set.pi univ fun i => Ioc (a i) (b i))) = ∏ i : ι, (b i - a i)

Next tactic:
simp only [volume_pi_Ioc, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
@[simp]
theorem volume_pi_Ico_toReal {a b : ι → ℝ} (h : a ≤ b) :
    (volume (pi univ fun i => Ico (a i) (b i))).toReal = ∏ i, (b i - a i) := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a b : ι → ℝ
h : a ≤ b
⊢ ENNReal.toReal (↑↑volume (Set.pi univ fun i => Ico (a i) (b i))) = ∏ i : ι, (b i - a i)

Next tactic:
simp only [volume_pi_Ico, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
@[simp]
nonrec theorem volume_pi_ball (a : ι → ℝ) {r : ℝ} (hr : 0 < r) :
    volume (Metric.ball a r) = ENNReal.ofReal ((2 * r) ^ Fintype.card ι) := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ι → ℝ
r : ℝ
hr : 0 < r
⊢ ↑↑volume (Metric.ball a r) = ofReal ((2 * r) ^ Fintype.card ι)

Next tactic:
simp only [MeasureTheory.volume_pi_ball a hr, volume_ball, Finset.prod_const]
@[simp]
nonrec theorem volume_pi_ball (a : ι → ℝ) {r : ℝ} (hr : 0 < r) :
    volume (Metric.ball a r) = ENNReal.ofReal ((2 * r) ^ Fintype.card ι) := by
  simp only [MeasureTheory.volume_pi_ball a hr, volume_ball, Finset.prod_const]
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ι → ℝ
r : ℝ
hr : 0 < r
⊢ ofReal (2 * r) ^ Finset.card Finset.univ = ofReal ((2 * r) ^ Fintype.card ι)

Next tactic:
exact (ENNReal.ofReal_pow (mul_nonneg zero_le_two hr.le) _).symm
@[simp]
nonrec theorem volume_pi_closedBall (a : ι → ℝ) {r : ℝ} (hr : 0 ≤ r) :
    volume (Metric.closedBall a r) = ENNReal.ofReal ((2 * r) ^ Fintype.card ι) := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ι → ℝ
r : ℝ
hr : 0 ≤ r
⊢ ↑↑volume (Metric.closedBall a r) = ofReal ((2 * r) ^ Fintype.card ι)

Next tactic:
simp only [MeasureTheory.volume_pi_closedBall a hr, volume_closedBall, Finset.prod_const]
@[simp]
nonrec theorem volume_pi_closedBall (a : ι → ℝ) {r : ℝ} (hr : 0 ≤ r) :
    volume (Metric.closedBall a r) = ENNReal.ofReal ((2 * r) ^ Fintype.card ι) := by
  simp only [MeasureTheory.volume_pi_closedBall a hr, volume_closedBall, Finset.prod_const]
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ι → ℝ
r : ℝ
hr : 0 ≤ r
⊢ ofReal (2 * r) ^ Finset.card Finset.univ = ofReal ((2 * r) ^ Fintype.card ι)

Next tactic:
exact (ENNReal.ofReal_pow (mul_nonneg zero_le_two hr) _).symm
theorem volume_pi_le_diam_pow (s : Set (ι → ℝ)) : volume s ≤ EMetric.diam s ^ Fintype.card ι :=
  calc
    volume s ≤ ∏ i : ι, EMetric.diam (Function.eval i '' s) := volume_pi_le_prod_diam s
    _ ≤ ∏ _i : ι, (1 : ℝ≥0) * EMetric.diam s :=
      (Finset.prod_le_prod' fun i _ => (LipschitzWith.eval i).ediam_image_le s)
    _ = EMetric.diam s ^ Fintype.card ι := by
      

Proof state:
ι : Type u_1
inst✝ : Fintype ι
s : Set (ι → ℝ)
⊢ ∏ _i : ι, ↑1 * EMetric.diam s = EMetric.diam s ^ Fintype.card ι

Next tactic:
simp only [ENNReal.coe_one, one_mul, Finset.prod_const, Fintype.card]
theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
    ENNReal.ofReal |a| • Measure.map (a * ·) volume = volume := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h : a ≠ 0
⊢ ofReal |a| • Measure.map (fun x => a * x) volume = volume

Next tactic:
refine' (Real.measure_ext_Ioo_rat fun p q => _).symm
theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
    ENNReal.ofReal |a| • Measure.map (a * ·) volume = volume := by
  refine' (Real.measure_ext_Ioo_rat fun p q => _).symm
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h : a ≠ 0
p q : ℚ
⊢ ↑↑volume (Ioo ↑p ↑q) = ↑↑(ofReal |a| • Measure.map (fun x => a * x) volume) (Ioo ↑p ↑q)

Next tactic:
cases' lt_or_gt_of_ne h with h h
theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
    ENNReal.ofReal |a| • Measure.map (a * ·) volume = volume := by
  refine' (Real.measure_ext_Ioo_rat fun p q => _).symm
  cases' lt_or_gt_of_ne h with h h
  · 

Proof state:
case inl
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h✝ : a ≠ 0
p q : ℚ
h : a < 0
⊢ ↑↑volume (Ioo ↑p ↑q) = ↑↑(ofReal |a| • Measure.map (fun x => a * x) volume) (Ioo ↑p ↑q)

Next tactic:
simp only [Real.volume_Ioo, Measure.smul_apply, ← ENNReal.ofReal_mul (le_of_lt <| neg_pos.2 h),
      Measure.map_apply (measurable_const_mul a) measurableSet_Ioo, neg_sub_neg, neg_mul,
      preimage_const_mul_Ioo_of_neg _ _ h, abs_of_neg h, mul_sub, smul_eq_mul,
      mul_div_cancel' _ (ne_of_lt h)]
theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
    ENNReal.ofReal |a| • Measure.map (a * ·) volume = volume := by
  refine' (Real.measure_ext_Ioo_rat fun p q => _).symm
  cases' lt_or_gt_of_ne h with h h
  · simp only [Real.volume_Ioo, Measure.smul_apply, ← ENNReal.ofReal_mul (le_of_lt <| neg_pos.2 h),
      Measure.map_apply (measurable_const_mul a) measurableSet_Ioo, neg_sub_neg, neg_mul,
      preimage_const_mul_Ioo_of_neg _ _ h, abs_of_neg h, mul_sub, smul_eq_mul,
      mul_div_cancel' _ (ne_of_lt h)]
  · 

Proof state:
case inr
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h✝ : a ≠ 0
p q : ℚ
h : a > 0
⊢ ↑↑volume (Ioo ↑p ↑q) = ↑↑(ofReal |a| • Measure.map (fun x => a * x) volume) (Ioo ↑p ↑q)

Next tactic:
simp only [Real.volume_Ioo, Measure.smul_apply, ← ENNReal.ofReal_mul (le_of_lt h),
      Measure.map_apply (measurable_const_mul a) measurableSet_Ioo, preimage_const_mul_Ioo _ _ h,
      abs_of_pos h, mul_sub, mul_div_cancel' _ (ne_of_gt h), smul_eq_mul]
theorem map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
    Measure.map (a * ·) volume = ENNReal.ofReal |a⁻¹| • volume := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h : a ≠ 0
⊢ Measure.map (fun x => a * x) volume = ofReal |a⁻¹| • volume

Next tactic:
conv_rhs =>
    rw [← Real.smul_map_volume_mul_left h, smul_smul, ← ENNReal.ofReal_mul (abs_nonneg _), ←
      abs_mul, inv_mul_cancel h, abs_one, ENNReal.ofReal_one, one_smul]
theorem map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
    Measure.map (a * ·) volume = ENNReal.ofReal |a⁻¹| • volume := by
  conv_rhs =>
    

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h : a ≠ 0
| ofReal |a⁻¹| • volume

Next tactic:
rw [← Real.smul_map_volume_mul_left h, smul_smul, ← ENNReal.ofReal_mul (abs_nonneg _), ←
      abs_mul, inv_mul_cancel h, abs_one, ENNReal.ofReal_one, one_smul]
@[simp]
theorem volume_preimage_mul_left {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
    volume ((a * ·) ⁻¹' s) = ENNReal.ofReal (abs a⁻¹) * volume s :=
  calc
    volume ((a * ·) ⁻¹' s) = Measure.map (a * ·) volume s :=
      ((Homeomorph.mulLeft₀ a h).toMeasurableEquiv.map_apply s).symm
    _ = ENNReal.ofReal (abs a⁻¹) * volume s := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h : a ≠ 0
s : Set ℝ
⊢ ↑↑(Measure.map (fun x => a * x) volume) s = ofReal |a⁻¹| * ↑↑volume s

Next tactic:
rw [map_volume_mul_left h]
@[simp]
theorem volume_preimage_mul_left {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
    volume ((a * ·) ⁻¹' s) = ENNReal.ofReal (abs a⁻¹) * volume s :=
  calc
    volume ((a * ·) ⁻¹' s) = Measure.map (a * ·) volume s :=
      ((Homeomorph.mulLeft₀ a h).toMeasurableEquiv.map_apply s).symm
    _ = ENNReal.ofReal (abs a⁻¹) * volume s := by rw [map_volume_mul_left h]; 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h : a ≠ 0
s : Set ℝ
⊢ ↑↑(ofReal |a⁻¹| • volume) s = ofReal |a⁻¹| * ↑↑volume s

Next tactic:
rfl
theorem smul_map_volume_mul_right {a : ℝ} (h : a ≠ 0) :
    ENNReal.ofReal |a| • Measure.map (· * a) volume = volume := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h : a ≠ 0
⊢ ofReal |a| • Measure.map (fun x => x * a) volume = volume

Next tactic:
simpa only [mul_comm] using Real.smul_map_volume_mul_left h
theorem map_volume_mul_right {a : ℝ} (h : a ≠ 0) :
    Measure.map (· * a) volume = ENNReal.ofReal |a⁻¹| • volume := by
  

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h : a ≠ 0
⊢ Measure.map (fun x => x * a) volume = ofReal |a⁻¹| • volume

Next tactic:
simpa only [mul_comm] using Real.map_volume_mul_left h
@[simp]
theorem volume_preimage_mul_right {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
    volume ((· * a) ⁻¹' s) = ENNReal.ofReal (abs a⁻¹) * volume s :=
  calc
    volume ((· * a) ⁻¹' s) = Measure.map (· * a) volume s :=
      ((Homeomorph.mulRight₀ a h).toMeasurableEquiv.map_apply s).symm
    _ = ENNReal.ofReal (abs a⁻¹) * volume s := by 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h : a ≠ 0
s : Set ℝ
⊢ ↑↑(Measure.map (fun x => x * a) volume) s = ofReal |a⁻¹| * ↑↑volume s

Next tactic:
rw [map_volume_mul_right h]
@[simp]
theorem volume_preimage_mul_right {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
    volume ((· * a) ⁻¹' s) = ENNReal.ofReal (abs a⁻¹) * volume s :=
  calc
    volume ((· * a) ⁻¹' s) = Measure.map (· * a) volume s :=
      ((Homeomorph.mulRight₀ a h).toMeasurableEquiv.map_apply s).symm
    _ = ENNReal.ofReal (abs a⁻¹) * volume s := by rw [map_volume_mul_right h]; 

Proof state:
ι : Type u_1
inst✝ : Fintype ι
a : ℝ
h : a ≠ 0
s : Set ℝ
⊢ ↑↑(ofReal |a⁻¹| • volume) s = ofReal |a⁻¹| * ↑↑volume s

Next tactic:
rfl