math / data /lean /OAI /Probability /LatticeSurface /Dynamics /ShiftAnalysis.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
19.9 kB
import Mathlib
import OAI.Probability.LatticeSurface.Dynamics.ClusterShift
import OAI.Probability.LatticeSurface.Dynamics.JacobianIdentity
import OAI.Probability.LatticeSurface.Dynamics.LogDet
import OAI.Probability.LatticeSurface.Dynamics.MatrixJacobi
import OAI.Probability.LatticeSurface.Dynamics.ShiftData
namespace OAI
open Set MeasureTheory intervalIntegral
open Matrix Polynomial
open scoped Topology
open Set MeasureTheory Filter
open scoped Topology
namespace TangentialJacobian
variable {V : Type*} [Fintype V] [DecidableEq V]
lemma opNorm_le_of_row_sum (A : (V β†’ ℝ) β†’L[ℝ] (V β†’ ℝ)) (K : ℝ) (hK : 0 ≀ K)
(hrow : βˆ€ i, βˆ‘ j, |asMatrix A i j| ≀ K) : β€–Aβ€– ≀ K := by
apply A.opNorm_le_bound hK
intro v
apply (pi_norm_le_iff_of_nonneg (mul_nonneg hK (norm_nonneg v))).mpr
intro i
have he : A v i = βˆ‘ j, asMatrix A i j * v j := by
exact congrFun (LinearMap.toMatrix'_mulVec A.toLinearMap v).symm i
rw [Real.norm_eq_abs, he]
calc
_ ≀ βˆ‘ j, |asMatrix A i j| * |v j| := by
simpa only [abs_mul] using Finset.abs_sum_le_sum_abs (fun j => asMatrix A i j * v j) Finset.univ
_ ≀ βˆ‘ j, |asMatrix A i j| * β€–vβ€– := by
apply Finset.sum_le_sum; intro j _
exact mul_le_mul_of_nonneg_left (norm_le_pi_norm v j) (abs_nonneg _)
_ = (βˆ‘ j, |asMatrix A i j|) * β€–vβ€– := (Finset.sum_mul _ _ _).symm
_ ≀ K * β€–vβ€– := mul_le_mul_of_nonneg_right (hrow i) (norm_nonneg _)
end TangentialJacobian
namespace FeasibleShift
open TangentialJacobian
variable {V : Type*} [Fintype V] [DecidableEq V]
lemma freeShift_derivative_row (G : SimpleGraph V) (ground pins : Finset V)
(Ξ² f : V β†’ ℝ) (h : FreeSites pins β†’ ℝ)
(sβ‚€ s₁ sβ‚‚ L : ℝ) (D : β„•) (hs : sβ‚€ < s₁) (hss : s₁ < sβ‚‚)
(hL : 0 ≀ L) (hfground : βˆ€ x ∈ ground, f x = 0)
(hfl : βˆ€ x y, G.Adj x y β†’ |f x - f y| ≀ L)
(hD : βˆ€ x, (neighbors G x).card ≀ D)
(A : (FreeSites pins β†’ ℝ) β†’L[ℝ] (FreeSites pins β†’ ℝ))
(hu : HasFDerivAt (freeShift G ground pins Ξ² f sβ‚€ s₁) A h) (x : FreeSites pins) :
βˆ‘ j, |asMatrix A x j| ≀ ((s₁ - sβ‚€)⁻¹ * (4 * D * L)) *
((component (contactGraph G (extendHeight pins Ξ² h) sβ‚‚) x).card : ℝ)^2 := by
classical
have hd : 0 < s₁ - sβ‚€ := sub_pos.mpr hs
let C := component (contactGraph G (extendHeight pins Ξ² h) sβ‚‚) x
let F : Finset (FreeSites pins) := Finset.univ.filter fun j => (j : V) ∈ C
have hFc : F.card ≀ C.card := by
apply Finset.card_le_card_of_injOn (fun j : FreeSites pins => (j : V))
Β· intro j hj; exact (Finset.mem_filter.mp hj).2
Β· intro j hj k hk hjk; exact Subtype.ext hjk
have hsum : βˆ‘ j, |asMatrix A x j| = βˆ‘ j ∈ F, |asMatrix A x j| := by
symm
apply Finset.sum_subset (Finset.subset_univ _)
intro j _ hj
have hj' : (j : V) βˆ‰ C := by simpa [F] using hj
rw [asMatrix_apply, freeShift_derivative_entry_zero G ground pins Ξ² f h sβ‚€ s₁ sβ‚‚ L
hs hss hL hfground hfl A hu x j hj', abs_zero]
rw [hsum]
calc
_ ≀ βˆ‘ j ∈ F, ((s₁ - sβ‚€)⁻¹ * (4 * D * L)) * C.card := by
apply Finset.sum_le_sum; intro j _
exact freeShift_derivative_entry G ground pins Ξ² f h sβ‚€ s₁ sβ‚‚ L D hs hss hL hfground hfl hD A hu x j
_ ≀ C.card * (((s₁ - sβ‚€)⁻¹ * (4 * D * L)) * C.card) := by
simp only [Finset.sum_const, nsmul_eq_mul]
exact mul_le_mul_of_nonneg_right (by exact_mod_cast hFc) (by positivity)
_ = _ := by dsimp [C]; ring
lemma freeShift_derivative_column (G : SimpleGraph V) (ground pins : Finset V)
(Ξ² f : V β†’ ℝ) (h : FreeSites pins β†’ ℝ)
(sβ‚€ s₁ sβ‚‚ L : ℝ) (D : β„•) (hs : sβ‚€ < s₁) (hss : s₁ < sβ‚‚)
(hL : 0 ≀ L) (hfground : βˆ€ x ∈ ground, f x = 0)
(hfl : βˆ€ x y, G.Adj x y β†’ |f x - f y| ≀ L)
(hD : βˆ€ x, (neighbors G x).card ≀ D)
(A : (FreeSites pins β†’ ℝ) β†’L[ℝ] (FreeSites pins β†’ ℝ))
(hu : HasFDerivAt (freeShift G ground pins Ξ² f sβ‚€ s₁) A h) (j : FreeSites pins) :
β€–A (Pi.single j 1)β€– ≀ ((s₁ - sβ‚€)⁻¹ * (4 * D * L)) *
(component (contactGraph G (extendHeight pins Ξ² h) sβ‚‚) j).card := by
have hd : 0 < s₁ - sβ‚€ := sub_pos.mpr hs
apply (pi_norm_le_iff_of_nonneg (by positivity)).mpr
intro x
rw [Real.norm_eq_abs]
by_cases hj : (j : V) ∈ component (contactGraph G (extendHeight pins Ξ² h) sβ‚‚) x
Β· have he := component_eq_of_reachable ((mem_component _ _ _).mp hj)
rw [← he]
exact freeShift_derivative_entry G ground pins Ξ² f h sβ‚€ s₁ sβ‚‚ L D hs hss hL hfground hfl hD A hu x j
Β· rw [freeShift_derivative_entry_zero G ground pins Ξ² f h sβ‚€ s₁ sβ‚‚ L
hs hss hL hfground hfl A hu x j hj, abs_zero]
positivity
lemma freeShift_derivative_cost (G : SimpleGraph V) (ground pins : Finset V)
(Ξ² f : V β†’ ℝ) (h : FreeSites pins β†’ ℝ)
(sβ‚€ s₁ sβ‚‚ L : ℝ) (D : β„•) (hs : sβ‚€ < s₁) (hss : s₁ < sβ‚‚)
(hL : 0 ≀ L) (hfground : βˆ€ x ∈ ground, f x = 0)
(hfl : βˆ€ x y, G.Adj x y β†’ |f x - f y| ≀ L)
(hD : βˆ€ x, (neighbors G x).card ≀ D)
(A : (FreeSites pins β†’ ℝ) β†’L[ℝ] (FreeSites pins β†’ ℝ))
(hu : HasFDerivAt (freeShift G ground pins Ξ² f sβ‚€ s₁) A h) :
jacobianCost A ≀ ((s₁ - sβ‚€)⁻¹ * (4 * D * L)) ^ 2 *
βˆ‘ x : FreeSites pins, if (x : V) ∈ ground then 0 else
((component (contactGraph G (extendHeight pins Ξ² h) sβ‚‚) x).card : ℝ) ^ 3 := by
classical
rw [jacobianCost, Finset.mul_sum]
apply Finset.sum_le_sum
intro x _
have hd : 0 < s₁ - sβ‚€ := sub_pos.mpr hs
by_cases hx : (x : V) ∈ ground
Β· simp only [ite_eq_left hx, mul_zero, asMatrix_apply,
freeShift_derivative_ground G ground pins Ξ² f h sβ‚€ s₁ A hu x _ hx,
abs_zero, Finset.sum_const_zero, zero_mul, le_refl]
rw [ite_eq_right hx]
calc
_ ≀ (((s₁ - sβ‚€)⁻¹ * (4 * D * L)) *
((component (contactGraph G (extendHeight pins Ξ² h) sβ‚‚) x).card : ℝ)^2) *
(((s₁ - sβ‚€)⁻¹ * (4 * D * L)) *
(component (contactGraph G (extendHeight pins Ξ² h) sβ‚‚) x).card) :=
mul_le_mul (freeShift_derivative_row G ground pins Ξ² f h sβ‚€ s₁ sβ‚‚ L D hs hss hL hfground hfl hD A hu x)
(freeShift_derivative_column G ground pins Ξ² f h sβ‚€ s₁ sβ‚‚ L D hs hss hL hfground hfl hD A hu x)
(norm_nonneg _) (by positivity)
_ = _ := by ring
lemma freeShift_derivative_opNorm (G : SimpleGraph V) (ground pins : Finset V)
(Ξ² f : V β†’ ℝ) (h : FreeSites pins β†’ ℝ)
(sβ‚€ s₁ sβ‚‚ L B : ℝ) (D : β„•) (hs : sβ‚€ < s₁) (hss : s₁ < sβ‚‚)
(hL : 0 ≀ L) (hB : 0 ≀ B) (hfground : βˆ€ x ∈ ground, f x = 0)
(hfl : βˆ€ x y, G.Adj x y β†’ |f x - f y| ≀ L)
(hD : βˆ€ x, (neighbors G x).card ≀ D)
(hgood : βˆ€ x, ((component (contactGraph G (extendHeight pins Ξ² h) sβ‚‚) x).card : ℝ) ≀ B)
(A : (FreeSites pins β†’ ℝ) β†’L[ℝ] (FreeSites pins β†’ ℝ))
(hu : HasFDerivAt (freeShift G ground pins Ξ² f sβ‚€ s₁) A h) :
β€–Aβ€– ≀ ((s₁ - sβ‚€)⁻¹ * (4 * D * L)) * B ^ 2 := by
have hd : 0 < s₁ - sβ‚€ := sub_pos.mpr hs
apply opNorm_le_of_row_sum A _ (by positivity)
intro x
exact (freeShift_derivative_row G ground pins Ξ² f h sβ‚€ s₁ sβ‚‚ L D hs hss hL hfground hfl hD A hu x).trans
(mul_le_mul_of_nonneg_left ((sq_le_sqβ‚€ (by positivity) hB).mpr (hgood x)) (by positivity))
end FeasibleShift
namespace FeasibleShift
open TangentialJacobian
variable {V : Type*} [Fintype V] [DecidableEq V]
lemma freeShift_det_identity (Gβ‚€ G : SimpleGraph V) (ground pins walls : Finset V)
(hp : pins βŠ† ground) (hw : walls βŠ† ground)
(hG : βˆ€ x y, Gβ‚€.Adj x y β†’ G.Adj x y ∨ (x ∈ ground ∧ y ∈ ground))
(Ξ² f : V β†’ ℝ) (I : V β†’ Set ℝ) (sβ‚€ s₁ M : ℝ) (hs : sβ‚€ < s₁) (hsβ‚€ : 0 < sβ‚€)
(hM : 0 ≀ M) (hfb : βˆ€ x, |f x| ≀ M)
(hP : MeasurableSet (heightPolytope Gβ‚€ pins walls Ξ² I)) :
βˆƒ Ξ΄ : ℝ, 0 < Ξ΄ ∧ βˆ€ t ∈ Set.Ioo (-Ξ΄) Ξ΄,
∫ h in heightPolytope Gβ‚€ pins walls Ξ² I,
(1 + t β€’ fderiv ℝ (freeShift G ground pins Ξ² f sβ‚€ s₁) h).det =
(volume (heightPolytope Gβ‚€ pins walls Ξ² I)).toReal := by
have hdiff : 0 < s₁ - sβ‚€ := sub_pos.mpr hs
let K : NNReal := ⟨(s₁ - sβ‚€)⁻¹ * (4 * M * Fintype.card (V Γ— V)), by positivity⟩
let Ξ΄ : ℝ := min (sβ‚€ / (2 * M + 1)) (1 / (K + 1))
have hΞ΄ : 0 < Ξ΄ := lt_min (by positivity) (by positivity)
refine ⟨δ, hδ, ?_⟩
intro t ht
have ht' : |t| < Ξ΄ := abs_lt.mpr ht
have htM : |t| * (2 * M) ≀ sβ‚€ := by
have hh := (lt_div_iffβ‚€ (show 0 < 2 * M + 1 by positivity)).mp
(ht'.trans_le (min_le_left _ _))
nlinarith [abs_nonneg t]
have htK : |t| * K < 1 := by
have hh := (lt_div_iffβ‚€ (show 0 < (K : ℝ) + 1 by positivity)).mp
(ht'.trans_le (min_le_right _ _))
nlinarith [abs_nonneg t]
have hu : LipschitzWith K (freeShift G ground pins Ξ² f sβ‚€ s₁) :=
freeShift_lipschitz G ground pins Ξ² f sβ‚€ s₁ M hs hM hfb
exact det_integral_of_invariant _ K hu _ hP t htK
(identity_add_bijective _ K hu t htK).injective.injOn
(freeShift_small_polytope_onto Gβ‚€ G ground pins walls hp hw hG Ξ² f I sβ‚€ s₁ M t
hs hsβ‚€.le hM hfb htM htK)
lemma freeShift_divergence_identities (Gβ‚€ G : SimpleGraph V) (ground pins walls : Finset V)
(hp : pins βŠ† ground) (hw : walls βŠ† ground)
(hG : βˆ€ x y, Gβ‚€.Adj x y β†’ G.Adj x y ∨ (x ∈ ground ∧ y ∈ ground))
(Ξ² f : V β†’ ℝ) (I : V β†’ Set ℝ) (sβ‚€ s₁ M : ℝ) (hs : sβ‚€ < s₁) (hsβ‚€ : 0 < sβ‚€)
(hM : 0 ≀ M) (hfb : βˆ€ x, |f x| ≀ M)
(hP : MeasurableSet (heightPolytope Gβ‚€ pins walls Ξ² I))
(hPfin : volume (heightPolytope Gβ‚€ pins walls Ξ² I) β‰  ⊀) :
(∫ h in heightPolytope Gβ‚€ pins walls Ξ² I,
(asMatrix (fderiv ℝ (freeShift G ground pins Ξ² f sβ‚€ s₁) h)).trace) = 0 ∧
(∫ h in heightPolytope Gβ‚€ pins walls Ξ² I,
(asMatrix (fderiv ℝ (freeShift G ground pins Ξ² f sβ‚€ s₁) h)).trace ^ 2) =
(∫ h in heightPolytope Gβ‚€ pins walls Ξ² I,
(asMatrix (fderiv ℝ (freeShift G ground pins Ξ² f sβ‚€ s₁) h *
fderiv ℝ (freeShift G ground pins Ξ² f sβ‚€ s₁) h)).trace) := by
let P := heightPolytope Gβ‚€ pins walls Ξ² I
let u := freeShift G ground pins Ξ² f sβ‚€ s₁
have hdiff : 0 < s₁ - sβ‚€ := sub_pos.mpr hs
let K : NNReal := ⟨(s₁ - sβ‚€)⁻¹ * (4 * M * Fintype.card (V Γ— V)), by positivity⟩
have hu : LipschitzWith K u := freeShift_lipschitz G ground pins Ξ² f sβ‚€ s₁ M hs hM hfb
let : IsFiniteMeasure (volume.restrict P) := ⟨by simpa [P] using hPfin.lt_top⟩
obtain ⟨δ, hΞ΄, hid⟩ := freeShift_det_identity Gβ‚€ G ground pins walls hp hw hG Ξ² f I sβ‚€ s₁ M
hs hsβ‚€ hM hfb hP
have hid' : βˆ€ t ∈ Set.Ioo (-Ξ΄) Ξ΄, ∫ h, (1 + t β€’ fderiv ℝ u h).det βˆ‚(volume.restrict P) =
((volume.restrict P) Set.univ).toReal := by simpa [P, u] using hid
refine ⟨trace_integral_zero_of_det_identity (volume.restrict P) (fderiv ℝ u)
(measurable_fderiv ℝ u) K (fun h => norm_fderiv_le_of_lipschitz ℝ hu) Ξ΄ hΞ΄ hid',
trace_square_integral_of_det_identity (volume.restrict P) (fderiv ℝ u)
(measurable_fderiv ℝ u) K (fun h => norm_fderiv_le_of_lipschitz ℝ hu) Ξ΄ hΞ΄ hid'⟩
end FeasibleShift
namespace TangentialJacobian
variable {V : Type*} [Fintype V] [DecidableEq V]
lemma continuous_trace : Continuous (fun A : (V β†’ ℝ) β†’L[ℝ] (V β†’ ℝ) => (asMatrix A).trace) := by
simp_rw [← traceCLM_apply]
exact (traceCLM (V := V)).continuous
lemma continuous_jacobianCost : Continuous (jacobianCost : ((V β†’ ℝ) β†’L[ℝ] (V β†’ ℝ)) β†’ ℝ) := by
unfold jacobianCost
apply continuous_finsetSum
intro i _
apply Continuous.mul
Β· apply continuous_finsetSum
intro j _
simp only [asMatrix_apply]
fun_prop
Β· fun_prop
omit [DecidableEq V] in
lemma uniform_image_area (P S : Set (V β†’ ℝ)) (hP : MeasurableSet P) (hS : MeasurableSet S)
(hSP : S βŠ† P) (T : (V β†’ ℝ) β†’ (V β†’ ℝ)) (K : NNReal) (hT : LipschitzWith K T)
(hinj : Set.InjOn T S) (hTP : T '' S βŠ† P) :
(ProbabilityTheory.cond volume P).real (T '' S) =
∫ x in S, |(fderiv ℝ T x).det| βˆ‚(ProbabilityTheory.cond volume P) := by
have harea := lipschitz_area hT hS hinj
have he : P ∩ (T '' S) = T '' S := Set.inter_eq_right.mpr hTP
rw [measureReal_def, ProbabilityTheory.cond_apply hP, he, ENNReal.toReal_mul,
ProbabilityTheory.cond, Measure.restrict_smul, Measure.restrict_restrict hS,
Set.inter_eq_left.mpr hSP, MeasureTheory.integral_smul_measure]
congr 1
symm
calc
_ = (∫⁻ x in S, ENNReal.ofReal |(fderiv ℝ T x).det|).toReal :=
integral_eq_lintegral_of_nonneg_ae (Filter.Eventually.of_forall fun x => abs_nonneg _)
((ContinuousLinearMap.continuous_det.measurable.comp (measurable_fderiv ℝ T)).abs.aestronglyMeasurable)
_ = _ := congrArg ENNReal.toReal harea
omit [DecidableEq V] in
lemma jacobian_integrable {Ξ© : Type*} [MeasurableSpace Ξ©] (ΞΌ : Measure Ξ©) [IsFiniteMeasure ΞΌ]
(B : Ξ© β†’ (V β†’ ℝ) β†’L[ℝ] (V β†’ ℝ)) (hB : Measurable B) (K : ℝ)
(hK : βˆ€ x, β€–B xβ€– ≀ K) : Integrable (fun x => |(B x).det|) ΞΌ :=
continuous_integrable_of_bounded ΞΌ B hB K hK _ (ContinuousLinearMap.continuous_det.abs)
omit [DecidableEq V] in
lemma uniform_image_lower_bound (P S : Set (V β†’ ℝ)) (hP : MeasurableSet P) (hS : MeasurableSet S)
(hSP : S βŠ† P) (hPzero : volume P β‰  0) (hPfin : volume P β‰  ⊀)
(T : (V β†’ ℝ) β†’ (V β†’ ℝ)) (K : NNReal) (hT : LipschitzWith K T)
(hinj : Set.InjOn T S) (hTP : T '' S βŠ† P) (c : ℝ)
(hdet : βˆ€α΅ x βˆ‚(volume.restrict S), c ≀ |(fderiv ℝ T x).det|) :
c * (ProbabilityTheory.cond volume P).real S ≀
(ProbabilityTheory.cond volume P).real (T '' S) := by
let ΞΌ := ProbabilityTheory.cond volume P
let : IsProbabilityMeasure ΞΌ := ProbabilityTheory.cond_isProbabilityMeasure_of_finite hPzero hPfin
rw [uniform_image_area P S hP hS hSP T K hT hinj hTP]
have hdet' : βˆ€α΅ x βˆ‚(ΞΌ.restrict S), c ≀ |(fderiv ℝ T x).det| := by
have hab : ΞΌ.restrict S β‰ͺ volume.restrict S :=
(show ΞΌ β‰ͺ volume from ProbabilityTheory.cond_absolutelyContinuous).restrict S
exact hab.ae_le hdet
have hi := jacobian_integrable ΞΌ (fderiv ℝ T) (measurable_fderiv ℝ T) K
(fun x => norm_fderiv_le_of_lipschitz ℝ hT)
have hh := integral_mono_ae (integrable_const c : Integrable (fun _ : V β†’ ℝ => c) (ΞΌ.restrict S))
hi.integrableOn hdet'
simpa only [MeasureTheory.integral_const, Measure.restrict_apply_univ, smul_eq_mul, mul_comm,
measureReal_def] using hh
end TangentialJacobian
namespace TangentialJacobian
variable {V : Type*} [Fintype V] [DecidableEq V]
lemma markov_real {Ξ© : Type*} [MeasurableSpace Ξ©] (ΞΌ : Measure Ξ©) [IsFiniteMeasure ΞΌ]
(F : Ξ© β†’ ℝ) (hF : Integrable F ΞΌ) (hn : βˆ€ x, 0 ≀ F x) (K : ℝ) (hK : 0 < K) :
ΞΌ.real {x | K < F x} ≀ (∫ x, F x βˆ‚ΞΌ) / K := by
apply (le_div_iffβ‚€ hK).mpr
have hh := mul_meas_ge_le_integral_of_nonneg (Filter.Eventually.of_forall hn) hF K
have hm : ΞΌ.real {x | K < F x} ≀ ΞΌ.real {x | K ≀ F x} :=
measureReal_mono (fun x (hx : K < F x) => le_of_lt hx)
nlinarith
lemma event_volume_of_moments (P G : Set (V β†’ ℝ)) (hP : MeasurableSet P)
(hG : MeasurableSet G) (hPzero : volume P β‰  0) (hPfin : volume P β‰  ⊀)
(u : (V β†’ ℝ) β†’ (V β†’ ℝ)) (Klip : NNReal) (hu : LipschitzWith Klip u)
(hinj : Set.InjOn (fun x => x + u x) G)
(hfeas : βˆ€ x ∈ P ∩ G, x + u x ∈ P)
(hnorm : βˆ€ x ∈ G, β€–fderiv ℝ u xβ€– ≀ 1/2)
(C p K : ℝ) (_hp : 0 < p) (hK : 1 ≀ K)
(hmoment : (∫ x, (asMatrix (fderiv ℝ u x)).trace ^ 2 + jacobianCost (fderiv ℝ u x)
βˆ‚(ProbabilityTheory.cond volume P)) ≀ C)
(hCK : C / K ≀ p/4)
(hbad : (ProbabilityTheory.cond volume P).real Gᢜ ≀ p/4)
(E : Set (V β†’ ℝ)) (hE : MeasurableSet E)
(hEp : p ≀ (ProbabilityTheory.cond volume P).real E) :
βˆƒ S : Set (V β†’ ℝ), MeasurableSet S ∧ S βŠ† E ∩ P ∩ G ∧
p/2 ≀ (ProbabilityTheory.cond volume P).real S ∧
Set.InjOn (fun x => x + u x) S ∧ (fun x => x + u x) '' S βŠ† P ∧
MeasurableSet ((fun x => x + u x) '' S) ∧
Real.exp (-2*K) * p/2 ≀ (ProbabilityTheory.cond volume P).real ((fun x => x + u x) '' S) := by
let ΞΌ := ProbabilityTheory.cond volume P
let : IsProbabilityMeasure ΞΌ := ProbabilityTheory.cond_isProbabilityMeasure_of_finite hPzero hPfin
let A := fderiv ℝ u
let F := fun x => (asMatrix (A x)).trace ^ 2 + jacobianCost (A x)
have hFc : Continuous (fun B : (V β†’ ℝ) β†’L[ℝ] (V β†’ ℝ) => (asMatrix B).trace ^ 2 + jacobianCost B) :=
(continuous_trace.pow 2).add continuous_jacobianCost
have hFm : Measurable F := hFc.measurable.comp (measurable_fderiv ℝ u)
have hFi : Integrable F ΞΌ := continuous_integrable_of_bounded ΞΌ A (measurable_fderiv ℝ u) Klip
(fun x => norm_fderiv_le_of_lipschitz ℝ hu) _ hFc
have hFn (x) : 0 ≀ F x := add_nonneg (sq_nonneg _) (jacobianCost_nonneg _)
let B := Gᢜ βˆͺ {x | K < F x}
have hBm : MeasurableSet B := hG.compl.union (measurableSet_lt measurable_const hFm)
have hBm_bound : ΞΌ.real B ≀ p/2 := by
have hmark := markov_real ΞΌ F hFi hFn K (by linarith)
have hquot : (∫ x, F x βˆ‚ΞΌ) / K ≀ C / K := div_le_div_of_nonneg_right hmoment (by linarith)
have hh := measureReal_union_le (μ := μ) Gᢜ {x | K < F x}
dsimp [B]
linarith
let S := (E ∩ P) \ B
have hSm : MeasurableSet S := (hE.inter hP).diff hBm
have hSsub : S βŠ† E ∩ P ∩ G := by
intro x hx
exact ⟨hx.1, by by_contra hg; exact hx.2 (Or.inl hg)⟩
have hSmass : p/2 ≀ ΞΌ.real S := by
have heq : μ.real (E ∩ P) = μ.real E := by
unfold Measure.real
congr 1
rw [Set.inter_comm, ProbabilityTheory.cond_inter_self hP]
have hh := le_measureReal_sdiff (ΞΌ := ΞΌ) (s₁ := E ∩ P) (sβ‚‚ := B)
rw [heq] at hh
linarith
have hSinj : Set.InjOn (fun x => x + u x) S := hinj.mono (fun x hx => (hSsub hx).2)
have hSP : S βŠ† P := fun x hx => (hSsub hx).1.2
have hSTP : (fun x => x + u x) '' S βŠ† P := by
rintro y ⟨x, hx, rfl⟩
exact hfeas x ⟨hSP hx, (hSsub hx).2⟩
have hSTm : MeasurableSet ((fun x => x + u x) '' S) :=
hSm.image_of_continuousOn_injOn (continuous_id.add hu.continuous).continuousOn hSinj
have hdet : βˆ€α΅ x βˆ‚(volume.restrict S), Real.exp (-2*K) ≀ |(fderiv ℝ (fun x => x + u x) x).det| := by
filter_upwards [ae_restrict_mem hSm, ae_restrict_of_ae (ae_fderiv_id_add_smul hu 1)] with x hx hdx
have hdx' : fderiv ℝ (fun x => x + u x) x = 1 + A x := by simpa [A] using hdx
rw [hdx']
have hAx := hnorm x ((hSsub hx).2)
have hFK : F x ≀ K := le_of_not_gt (fun h => hx.2 (Or.inr h))
have ht : |(asMatrix (A x)).trace| ≀ K := by
have hcost := jacobianCost_nonneg (A x)
have habsq := sq_abs (asMatrix (A x)).trace
have hab := abs_nonneg (asMatrix (A x)).trace
dsimp [F] at hFK
nlinarith
have hc : jacobianCost (A x) ≀ K := by
dsimp [F] at hFK
nlinarith [sq_nonneg (asMatrix (A x)).trace]
have hlog := logdet_lower_bound (A x) hAx
have hpos := det_one_add_pos (A x) (hAx.trans_lt (by norm_num))
rw [abs_of_pos hpos, ← Real.exp_log hpos]
apply Real.exp_le_exp.mpr
have htt := (abs_le.mp ht).1
linarith
have harea := uniform_image_lower_bound P S hP hSm hSP hPzero hPfin
(fun x => x + u x) (1 + Klip) (by simpa using lipschitz_id_add_smul hu 1)
hSinj hSTP (Real.exp (-2*K)) hdet
refine ⟨S, hSm, hSsub, hSmass, hSinj, hSTP, hSTm, ?_⟩
have hexp : 0 ≀ Real.exp (-2*K) := (Real.exp_pos _).le
nlinarith [mul_le_mul_of_nonneg_left hSmass hexp]
end TangentialJacobian
end OAI