obtain ⟨R,hR⟩:=hc.isBounded.subset_ball (0:E)
obtain ⟨K,hK⟩:=hl.locallyLipschitzOn.exists_lipschitzOnWith_of_compact
(isCompact_closedBall (0:E) (R+1))
obtain ⟨M,hM⟩:=hc.exists_bound_of_continuousOn hl.continuous.continuousOn
letC:ℝ≥0:=⟨max (K:ℝ) (max M0),le_max_of_le_right (le_max_right _ _)⟩
havehKC:(K:ℝ)≤C:=le_max_left _ _
havehMC:M≤(C:ℝ):=(le_max_left M0).trans (le_max_right _ _)
have hbound (x y:E) (hx:x∈tsupport F) (hy:y∉Metric.closedBall (0:E) (R+1)):
dist (F x) (F y)≤(C:ℝ)*dist x y :=byhavehFx:dist x 0<R:=hR hx
havehFy:R+1<dist y 0:=by simpa only [Metric.mem_closedBall,not_le] using hy
havehdy:1≤dist x y:=byhave hh:=dist_triangle y x 0; rw [dist_comm y x] at hh; linarith
havehyS:y∉tsupport F:=by
intro hys
have hyR:=hR hys
change dist y 0<R at hyR
linarith
rw [image_eq_zero_of_notMem_tsupport hyS,dist_zero_right]
exact (hM x hx).trans (hMC.trans (le_mul_of_one_le_right C.2 hdy))
refine ⟨C,LipschitzWith.of_dist_le_mul fun x y=>?_⟩
by_cases hx:x∈tsupport F
· by_cases hy:y∈Metric.closedBall (0:E) (R+1)
· havehxB:x∈Metric.closedBall (0:E) (R+1):=byhave hh:=hR hx
change dist x 0<R at hh
change dist x 0≤R+1
linarith
exact (hK.dist_le_mul x hxB y hy).trans (mul_le_mul_of_nonneg_right hKC dist_nonneg)
· exact hbound x y hx hy
· by_cases hy:y∈tsupport F
· by_cases hxB:x∈Metric.closedBall (0:E) (R+1)
· havehyB:y∈Metric.closedBall (0:E) (R+1):=byhave hh:=hR hy
change dist y 0<R at hh
change dist y 0≤R+1
linarith
exact (hK.dist_le_mul x hxB y hyB).trans (mul_le_mul_of_nonneg_right hKC dist_nonneg)
· simpa only [dist_comm] using hbound y x hy hxB
· rw [image_eq_zero_of_notMem_tsupport hx,image_eq_zero_of_notMem_tsupport hy,dist_self]
positivity
let e:=stdOrthonormalBasis ℝ (Space d)
let f:=fun i x=>inner ℝ (e i) (F x)
havehf i:LipschitzWith (‖innerSL ℝ (e i)‖₊*K) (f i):=
(innerSL ℝ (e i)).lipschitzWith.comp hF
havehfc i:HasCompactSupport (f i):=by
apply HasCompactSupport.intro hc
intro x hx
simp only [f,image_eq_zero_of_notMem_tsupport hx,inner_zero_right]
havehe:divergence F =ᵐ[volume] (fun x=>∑i,fderiv ℝ (f i) x (e i)):=by
filter_upwards [hF.ae_differentiableAt] with x hx
unfold divergence
apply Finset.sum_congr rfl
intro i hi
havehd:HasFDerivAt (f i) ((innerSL ℝ (e i)) ∘L fderiv ℝF x) x:=
(innerSL ℝ (e i)).hasFDerivAt.comp x hx.hasFDerivAt
rw [hd.fderiv]
rfl
exact (integrable_finsetSum _ (fun i hi=>integrable_directional_compact (hf i) (hfc i) (e i))).congr he.symm
let e:=stdOrthonormalBasis ℝ (Space d)
let f:=fun i x=>inner ℝ (e i) (F x)
havehf i:LipschitzWith (‖innerSL ℝ (e i)‖₊*K) (f i):=
(innerSL ℝ (e i)).lipschitzWith.comp hF
havehfc i:HasCompactSupport (f i):=by
apply HasCompactSupport.intro hc
intro x hx
simp only [f,image_eq_zero_of_notMem_tsupport hx,inner_zero_right]
havehe:divergence F =ᵐ[volume] (fun x=>∑i,fderiv ℝ (f i) x (e i)):=by
filter_upwards [hF.ae_differentiableAt] with x hx
unfold divergence
apply Finset.sum_congr rfl
intro i hi
havehd:HasFDerivAt (f i) ((innerSL ℝ (e i)) ∘L fderiv ℝF x) x:=
(innerSL ℝ (e i)).hasFDerivAt.comp x hx.hasFDerivAt
rw [hd.fderiv]
rfl
rw [integral_congr_ae he,integral_finsetSum _ (fun i hi=>integrable_directional_compact (hf i) (hfc i) (e i))]
simp only [integral_directional_compact (hf _) (hfc _),Finset.sum_const_zero]