Theorem: MeasureTheory.restrict_map_withDensity_abs_det_fderiv_eq_addHaar
File: Mathlib/MeasureTheory/Function/Jacobian.lean

tactic: obtain ⟨u, u_meas, uf⟩ : ∃ u, Measurable u ∧ EqOn u f s := by
  classical
  refine' ⟨piecewise s f 0, _, piecewise_eqOn _ _ _⟩
  refine' ContinuousOn.measurable_piecewise _ continuous_zero.continuousOn hs
  have : DifferentiableOn ℝ f s := fun x hx => (hf' x hx).differentiableWithinAt
  exact this.continuousOn
state_before: E : Type u_1
F : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
⊢ Measure.map (Set.restrict s f)
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (f '' s)

tactic: have u' : ∀ x ∈ s, HasFDerivWithinAt u (f' x) s x := fun x hx =>
  (hf' x hx).congr (fun y hy => uf hy) (uf hx)
state_before: case intro.intro
E : Type u_1
F : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
u : E → E
u_meas : Measurable u
uf : EqOn u f s
⊢ Measure.map (Set.restrict s f)
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (f '' s)

tactic: set F : s → E := u ∘ (↑) with hF
state_before: case intro.intro
E : Type u_1
F : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
u : E → E
u_meas : Measurable u
uf : EqOn u f s
u' : ∀ (x : E), x ∈ s → HasFDerivWithinAt u (f' x) s x
⊢ Measure.map (Set.restrict s f)
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (f '' s)

tactic: have A :
  Measure.map F (comap (↑) (μ.withDensity fun x => ENNReal.ofReal (|(f' x).det|))) =
    μ.restrict (u '' s) := by
  rw [hF, ← Measure.map_map u_meas measurable_subtype_coe, map_comap_subtype_coe hs,
    restrict_withDensity hs]
  exact map_withDensity_abs_det_fderiv_eq_addHaar μ hs u' (hf.congr uf.symm) u_meas
state_before: case intro.intro
E : Type u_1
F✝ : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedSpace ℝ F✝
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
u : E → E
u_meas : Measurable u
uf : EqOn u f s
u' : ∀ (x : E), x ∈ s → HasFDerivWithinAt u (f' x) s x
F : ↑s → E := u ∘ Subtype.val
hF : F = u ∘ Subtype.val
⊢ Measure.map (Set.restrict s f)
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (f '' s)

tactic: rw [uf.image_eq] at A
state_before: case intro.intro
E : Type u_1
F✝ : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedSpace ℝ F✝
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
u : E → E
u_meas : Measurable u
uf : EqOn u f s
u' : ∀ (x : E), x ∈ s → HasFDerivWithinAt u (f' x) s x
F : ↑s → E := u ∘ Subtype.val
hF : F = u ∘ Subtype.val
A :
  Measure.map F
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (u '' s)
⊢ Measure.map (Set.restrict s f)
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (f '' s)

tactic: have : F = s.restrict f := by
  ext x
  exact uf x.2
state_before: case intro.intro
E : Type u_1
F✝ : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedSpace ℝ F✝
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
u : E → E
u_meas : Measurable u
uf : EqOn u f s
u' : ∀ (x : E), x ∈ s → HasFDerivWithinAt u (f' x) s x
F : ↑s → E := u ∘ Subtype.val
hF : F = u ∘ Subtype.val
A :
  Measure.map F
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (f '' s)
⊢ Measure.map (Set.restrict s f)
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (f '' s)

tactic: rwa [this] at A
state_before: case intro.intro
E : Type u_1
F✝ : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedSpace ℝ F✝
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
u : E → E
u_meas : Measurable u
uf : EqOn u f s
u' : ∀ (x : E), x ∈ s → HasFDerivWithinAt u (f' x) s x
F : ↑s → E := u ∘ Subtype.val
hF : F = u ∘ Subtype.val
A :
  Measure.map F
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (f '' s)
this : F = Set.restrict s f
⊢ Measure.map (Set.restrict s f)
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (f '' s)

tactic: classical
refine' ⟨piecewise s f 0, _, piecewise_eqOn _ _ _⟩
refine' ContinuousOn.measurable_piecewise _ continuous_zero.continuousOn hs
have : DifferentiableOn ℝ f s := fun x hx => (hf' x hx).differentiableWithinAt
exact this.continuousOn
state_before: E : Type u_1
F : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
⊢ ∃ u, Measurable u ∧ EqOn u f s

tactic: refine' ⟨piecewise s f 0, _, piecewise_eqOn _ _ _⟩
state_before: E : Type u_1
F : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
⊢ ∃ u, Measurable u ∧ EqOn u f s

tactic: refine' ContinuousOn.measurable_piecewise _ continuous_zero.continuousOn hs
state_before: E : Type u_1
F : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
⊢ Measurable (piecewise s f 0)

tactic: have : DifferentiableOn ℝ f s := fun x hx => (hf' x hx).differentiableWithinAt
state_before: E : Type u_1
F : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
⊢ ContinuousOn f s

tactic: exact this.continuousOn
state_before: E : Type u_1
F : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace ℝ F
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
this : DifferentiableOn ℝ f s
⊢ ContinuousOn f s

tactic: rw [hF, ← Measure.map_map u_meas measurable_subtype_coe, map_comap_subtype_coe hs,
  restrict_withDensity hs]
state_before: E : Type u_1
F✝ : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedSpace ℝ F✝
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
u : E → E
u_meas : Measurable u
uf : EqOn u f s
u' : ∀ (x : E), x ∈ s → HasFDerivWithinAt u (f' x) s x
F : ↑s → E := u ∘ Subtype.val
hF : F = u ∘ Subtype.val
⊢ Measure.map F
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (u '' s)

tactic: exact map_withDensity_abs_det_fderiv_eq_addHaar μ hs u' (hf.congr uf.symm) u_meas
state_before: E : Type u_1
F✝ : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedSpace ℝ F✝
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
u : E → E
u_meas : Measurable u
uf : EqOn u f s
u' : ∀ (x : E), x ∈ s → HasFDerivWithinAt u (f' x) s x
F : ↑s → E := u ∘ Subtype.val
hF : F = u ∘ Subtype.val
⊢ Measure.map u (withDensity (Measure.restrict μ s) fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x)))) =
    Measure.restrict μ (u '' s)

tactic: ext x
state_before: E : Type u_1
F✝ : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedSpace ℝ F✝
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
u : E → E
u_meas : Measurable u
uf : EqOn u f s
u' : ∀ (x : E), x ∈ s → HasFDerivWithinAt u (f' x) s x
F : ↑s → E := u ∘ Subtype.val
hF : F = u ∘ Subtype.val
A :
  Measure.map F
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (f '' s)
⊢ F = Set.restrict s f

tactic: exact uf x.2
state_before: case h
E : Type u_1
F✝ : Type ?u.850332
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : FiniteDimensional ℝ E
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedSpace ℝ F✝
s : Set E
f : E → E
f' : E → E →L[ℝ] E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : MeasurableSet s
hf' : ∀ (x : E), x ∈ s → HasFDerivWithinAt f (f' x) s x
hf : InjOn f s
u : E → E
u_meas : Measurable u
uf : EqOn u f s
u' : ∀ (x : E), x ∈ s → HasFDerivWithinAt u (f' x) s x
F : ↑s → E := u ∘ Subtype.val
hF : F = u ∘ Subtype.val
A :
  Measure.map F
      (Measure.comap Subtype.val (withDensity μ fun x => ENNReal.ofReal (abs (ContinuousLinearMap.det (f' x))))) =
    Measure.restrict μ (f '' s)
x : ↑s
⊢ F x = Set.restrict s f x