math / data /lean /OAI /Probability /LatticeSurface /Geometry /BlockVolume.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
6.45 kB
import Mathlib
import OAI.Probability.LatticeSurface.Geometry.TriangularCover
import OAI.Probability.LatticeSurface.Geometry.TriangularGeometry
namespace OAI
open MeasureTheory
open scoped ENNReal
noncomputable section
namespace TriangularLipschitz
@[simp] lemma mem_interior {L : β„•} {x : Vertex} :
x ∈ interior L ↔ (1 ≀ x.1 ∧ x.1 ≀ (L : β„€) - 1) ∧
(1 ≀ x.2 ∧ x.2 ≀ (L : β„€) - 1) := by
simp [interior]
lemma interior_subset_box (L : β„•) : interior L βŠ† box L := by
intro x hx
simp only [mem_interior, mem_box] at hx ⊒
omega
@[simp] lemma origin_not_interior (L : β„•) : (0,0) βˆ‰ interior L := by
simp [mem_interior]
@[simp] lemma filledHeight_free (L : β„•) (s : Vertex β†’ ℝ) (a : Filling L)
(x : {x : Vertex // x ∈ interior L}) : filledHeight L s a x = a x :=
dite_eq_left x.property
@[simp] lemma filledHeight_fixed (L : β„•) (s : Vertex β†’ ℝ) (a : Filling L)
{x : Vertex} (hx : x βˆ‰ interior L) : filledHeight L s a x = s x :=
dite_eq_right hx
lemma continuous_filledHeight (L : β„•) (s : Vertex β†’ ℝ) (x : Vertex) :
Continuous (fun a : Filling L => filledHeight L s a x) := by
unfold filledHeight
split_ifs with hx
· exact continuous_apply (⟨x,hx⟩ : {x : Vertex // x ∈ interior L})
Β· exact continuous_const
lemma isClosed_fillingPolytope (L : β„•) (s : Vertex β†’ ℝ) :
IsClosed (fillingPolytope L s) := by
simp only [fillingPolytope, Set.ofPred_forall]
exact isClosed_iInter fun x => isClosed_iInter fun _ =>
isClosed_iInter fun y => isClosed_iInter fun _ => isClosed_iInter fun _ =>
isClosed_le ((continuous_filledHeight L s x).sub
(continuous_filledHeight L s y)).abs continuous_const
lemma measurableSet_fillingPolytope (L : β„•) (s : Vertex β†’ ℝ) :
MeasurableSet (fillingPolytope L s) := (isClosed_fillingPolytope L s).measurableSet
def filledHeightAffine (L : β„•) (s : Vertex β†’ ℝ) (x : Vertex) :
Filling L →ᡃ[ℝ] ℝ :=
if hx : x ∈ interior L then (LinearMap.proj ⟨x,hx⟩).toAffineMap
else AffineMap.const ℝ _ (s x)
@[simp] lemma filledHeightAffine_apply (L : β„•) (s : Vertex β†’ ℝ) (x : Vertex)
(a : Filling L) : filledHeightAffine L s x a = filledHeight L s a x := by
unfold filledHeightAffine filledHeight
split_ifs <;> rfl
lemma convex_fillingPolytope (L : β„•) (s : Vertex β†’ ℝ) :
Convex ℝ (fillingPolytope L s) := by
intro a ha b hb Ξ± Ξ² hΞ± hΞ² hsum x hx y hy hxy
let Ο† := filledHeightAffine L s x - filledHeightAffine L s y
have hΟ† : βˆ€ c, Ο† c = filledHeight L s c x - filledHeight L s c y := by
intro c
simp only [Ο†, AffineMap.coe_sub, Pi.sub_apply, filledHeightAffine_apply]
have h := ((convex_Icc (-1 : ℝ) 1).affine_preimage Ο†)
(show Ο† a ∈ Set.Icc (-1) 1 by rw [hΟ†]; exact abs_le.mp (ha x hx y hy hxy))
(show Ο† b ∈ Set.Icc (-1) 1 by rw [hΟ†]; exact abs_le.mp (hb x hx y hy hxy))
hΞ± hΞ² hsum
rw [Set.mem_preimage, hφ] at h
exact abs_le.mpr h
lemma latticeDist_origin_le {L : β„•} {x : Vertex} (hx : x ∈ box L) :
latticeDist x (0,0) ≀ 2 * (L : ℝ) := by
obtain ⟨⟨hx0,hxL⟩,⟨hy0,hyL⟩⟩ := mem_box.mp hx
have hx0' : (0 : ℝ) ≀ x.1 := by exact_mod_cast hx0
have hy0' : (0 : ℝ) ≀ x.2 := by exact_mod_cast hy0
have hxL' : (x.1 : ℝ) ≀ L := by exact_mod_cast hxL
have hyL' : (x.2 : ℝ) ≀ L := by exact_mod_cast hyL
simp only [latticeDist, Int.cast_zero, sub_zero, abs_of_nonneg hx0',
abs_of_nonneg hy0', abs_of_nonneg (add_nonneg hx0' hy0'), max_le_iff]
constructor
Β· constructor <;> linarith
Β· linarith
lemma fillingPolytope_subset_closedBall (L : β„•) (s : Vertex β†’ ℝ) :
fillingPolytope L s βŠ† Metric.closedBall (fun _ => s (0,0) : Filling L) (2*L) := by
intro a ha
rw [Metric.mem_closedBall, dist_pi_le_iff (by positivity : (0 : ℝ) ≀ 2*L)]
intro x
have h := near_global_bound ha (interior_subset_box L x.property)
(show (0,0) ∈ box L by simp)
rw [filledHeight_free, filledHeight_fixed _ _ _ (origin_not_interior L), one_mul] at h
exact h.trans (latticeDist_origin_le (interior_subset_box L x.property))
lemma fillingVolume_lt_top (L : β„•) (s : Vertex β†’ ℝ) : fillingVolume L s < ⊀ :=
(measure_mono (fillingPolytope_subset_closedBall L s)).trans_lt measure_closedBall_lt_top
lemma isCompact_fillingPolytope (L : β„•) (s : Vertex β†’ ℝ) :
IsCompact (fillingPolytope L s) :=
(isCompact_closedBall _ _).of_isClosed_subset (isClosed_fillingPolytope L s)
(fillingPolytope_subset_closedBall L s)
lemma filledHeight_center (L : β„•) (h : Vertex β†’ ℝ) (x : Vertex) :
filledHeight L h (fun x => h x) x = h x := by
unfold filledHeight
split_ifs <;> rfl
lemma filledHeight_perturbation (L : β„•) (h : Vertex β†’ ℝ) (a : Filling L) (x : Vertex) :
|filledHeight L h a x - h x| ≀ β€–a - (fun x => h x : Filling L)β€– := by
by_cases hx : x ∈ interior L
Β· rw [filledHeight, dite_eq_left hx]
exact norm_le_pi_norm (a - (fun x => h x : Filling L)) ⟨x,hx⟩
Β· rw [filledHeight_fixed _ _ _ hx, sub_self, abs_zero]
exact norm_nonneg _
lemma ball_subset_fillingPolytope {L : β„•} {h : Vertex β†’ ℝ} {Ξ΄ : ℝ}
(hne : βˆ€ x ∈ box L, βˆ€ y ∈ box L, Adj x y β†’ |h x-h y| ≀ 1-Ξ΄) :
Metric.ball (fun x => h x : Filling L) (Ξ΄/4) βŠ† fillingPolytope L h := by
intro a ha x hx y hy hxy
have hnorm : β€–a - (fun x => h x : Filling L)β€– < Ξ΄/4 := by
simpa only [Metric.mem_ball, dist_eq_norm] using ha
have hxerr := filledHeight_perturbation L h a x
have hyerr := filledHeight_perturbation L h a y
have hed := hne x hx y hy hxy
have htri : |filledHeight L h a x-filledHeight L h a y| ≀
|filledHeight L h a x-h x| + |h x-h y| + |filledHeight L h a y-h y| := by
calc
_ ≀ |filledHeight L h a x-h x| + |h x-filledHeight L h a y| := abs_sub_le _ _ _
_ ≀ _ := by
have ht := abs_sub_le (h x) (h y) (filledHeight L h a y)
rw [abs_sub_comm (h y)] at ht
linarith
have hn := norm_nonneg (a - (fun x => h x : Filling L))
linarith
lemma fillingVolume_pos_of_strict {L : β„•} {h : Vertex β†’ ℝ} {Ξ΄ : ℝ} (hΞ΄ : 0 < Ξ΄)
(hne : βˆ€ x ∈ box L, βˆ€ y ∈ box L, Adj x y β†’ |h x-h y| ≀ 1-Ξ΄) :
0 < fillingVolume L h :=
(Metric.measure_ball_pos volume _ (by positivity : 0 < Ξ΄/4)).trans_le
(measure_mono (ball_subset_fillingPolytope hne))
end TriangularLipschitz
end
end OAI