-- Mathlib/MeasureTheory/Measure/Lebesgue/Basic.lean
theorem smul_map_diagonal_volume_pi [DecidableEq ι] {D : ι → ℝ} (h : det (diagonal D) ≠ 0) :
    ENNReal.ofReal (abs (det (diagonal D))) • Measure.map (toLin' (diagonal D)) volume =
      volume

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
this : (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) = univ.pi fun i => (fun x => D i * x) ⁻¹' s i
⊢ ∀ (i : ι), ofReal |D i| * volume ((fun x => D i * x) ⁻¹' s i) = volume (s i)

Tactic:
intro i

Result:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
this : (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) = univ.pi fun i => (fun x => D i * x) ⁻¹' s i
i : ι
⊢ ofReal |D i| * volume ((fun x => D i * x) ⁻¹' s i) = volume (s i)

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
⊢ ofReal |∏ i : ι, D i| * volume (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi s) = ∏ x : ι, volume (s x)

ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
⊢ Measurable ⇑(toLin' (Matrix.diagonal D))

Tactic:
swap

Result:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
⊢ Measurable ⇑(toLin' (Matrix.diagonal D))

ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
⊢ ofReal |∏ i : ι, D i| * volume (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi s) = ∏ x : ι, volume (s x)

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
⊢ (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) = univ.pi fun i => (fun x => D i * x) ⁻¹' s i

Tactic:
ext f

Result:
case h
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
f : ι → ℝ
⊢ (f ∈ ⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) ↔ f ∈ univ.pi fun i => (fun x => D i * x) ⁻¹' s i

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
this : (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) = univ.pi fun i => (fun x => D i * x) ⁻¹' s i
i : ι
⊢ D i ≠ 0

Tactic:
simp only [det_diagonal, Ne] at h

Result:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
this : (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) = univ.pi fun i => (fun x => D i * x) ⁻¹' s i
i : ι
h : ¬∏ i : ι, D i = 0
⊢ D i ≠ 0

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
⊢ ofReal |∏ i : ι, D i| * (Measure.map (⇑(toLin' (Matrix.diagonal D))) volume) (univ.pi s) = ∏ x : ι, volume (s x)

Tactic:
rw [Measure.map_apply _ (MeasurableSet.univ_pi hs)]

Result:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
⊢ ofReal |∏ i : ι, D i| * volume (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi s) = ∏ x : ι, volume (s x)

ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
⊢ Measurable ⇑(toLin' (Matrix.diagonal D))

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
this : (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) = univ.pi fun i => (fun x => D i * x) ⁻¹' s i
B : ∀ (i : ι), ofReal |D i| * volume ((fun x => D i * x) ⁻¹' s i) = volume (s i)
⊢ ∏ x : ι, ofReal |D x| * volume ((fun x_1 => D x * x_1) ⁻¹' s x) = ∏ x : ι, volume (s x)

Tactic:
simp only [B]

Result:
no goals

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
this : (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) = univ.pi fun i => (fun x => D i * x) ⁻¹' s i
i : ι
⊢ ofReal |D i| * volume ((fun x => D i * x) ⁻¹' s i) = volume (s i)

Tactic:
have A : D i ≠ 0 := by
  simp only [det_diagonal, Ne] at h
  exact Finset.prod_ne_zero_iff.1 h i (Finset.mem_univ i)

Result:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
this : (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) = univ.pi fun i => (fun x => D i * x) ⁻¹' s i
i : ι
A : D i ≠ 0
⊢ ofReal |D i| * volume ((fun x => D i * x) ⁻¹' s i) = volume (s i)

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
this : (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) = univ.pi fun i => (fun x => D i * x) ⁻¹' s i
B : ∀ (i : ι), ofReal |D i| * volume ((fun x => D i * x) ⁻¹' s i) = volume (s i)
⊢ ofReal |∏ i : ι, D i| * volume (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi s) = ∏ x : ι, volume (s x)

Tactic:
rw [this, volume_pi_pi, Finset.abs_prod,
  ENNReal.ofReal_prod_of_nonneg fun i _ => abs_nonneg (D i), ← Finset.prod_mul_distrib]

Result:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
this : (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) = univ.pi fun i => (fun x => D i * x) ⁻¹' s i
B : ∀ (i : ι), ofReal |D i| * volume ((fun x => D i * x) ⁻¹' s i) = volume (s i)
⊢ ∏ x : ι, ofReal |D x| * volume ((fun x_1 => D x * x_1) ⁻¹' s x) = ∏ x : ι, volume (s x)

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
this : (⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) = univ.pi fun i => (fun x => D i * x) ⁻¹' s i
i : ι
h : ¬∏ i : ι, D i = 0
⊢ D i ≠ 0

Tactic:
exact Finset.prod_ne_zero_iff.1 h i (Finset.mem_univ i)

Result:
no goals

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
⊢ ofReal |(Matrix.diagonal D).det| • Measure.map (⇑(toLin' (Matrix.diagonal D))) volume = volume

Tactic:
refine (Measure.pi_eq fun s hs => ?_).symm

Result:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
⊢ (ofReal |(Matrix.diagonal D).det| • Measure.map (⇑(toLin' (Matrix.diagonal D))) volume) (univ.pi s) =
    ∏ i : ι, volume (s i)

Proof state:
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
⊢ Measurable ⇑(toLin' (Matrix.diagonal D))

Tactic:
exact Continuous.measurable (LinearMap.continuous_on_pi _)

Result:
no goals

Proof state:
case h
ι : Type u_1
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
D : ι → ℝ
h : (Matrix.diagonal D).det ≠ 0
s : ι → Set ℝ
hs : ∀ (i : ι), MeasurableSet (s i)
f : ι → ℝ
⊢ (f ∈ ⇑(toLin' (Matrix.diagonal D)) ⁻¹' univ.pi fun i => s i) ↔ f ∈ univ.pi fun i => (fun x => D i * x) ⁻¹' s i

Tactic:
simp only [LinearMap.coe_proj, Algebra.id.smul_eq_mul, LinearMap.smul_apply, mem_univ_pi,
  mem_preimage, LinearMap.pi_apply, diagonal_toLin']

Result:
no goals