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
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
import Mathlib
import OAI.Probability.LatticeSurface.Coercivity.SparseAmbient
import OAI.Probability.LatticeSurface.Coercivity.SparseColor
import OAI.Probability.LatticeSurface.Coercivity.SparseEntropy
import OAI.Probability.LatticeSurface.Coercivity.SparseGeodesic
import OAI.Probability.LatticeSurface.Coercivity.SparseGeometry
import OAI.Probability.LatticeSurface.Coercivity.SparseGradients
import OAI.Probability.LatticeSurface.Coercivity.SparseModel
import OAI.Probability.LatticeSurface.Coercivity.SparseParameters
import OAI.Probability.LatticeSurface.Coercivity.SparsePaths
import OAI.Probability.LatticeSurface.Coercivity.SparseProb
import OAI.Probability.LatticeSurface.Coercivity.SparseSeparated
import OAI.Probability.LatticeSurface.Coercivity.SparseWitnessModel
import OAI.Probability.LatticeSurface.Coercivity.ZeroPinnedSparse
import OAI.Probability.LatticeSurface.Convexity.BoundedBase
import OAI.Probability.LatticeSurface.Convexity.BrunnMinkowski
import OAI.Probability.LatticeSurface.Convexity.CubePrekopa
import OAI.Probability.LatticeSurface.Convexity.GradientWindows
import OAI.Probability.LatticeSurface.Convexity.ProductVolume
import OAI.Probability.LatticeSurface.Convexity.QuantileTransport
import OAI.Probability.LatticeSurface.Convexity.RetainedBody
import OAI.Probability.LatticeSurface.Convexity.RetainedCoordinates
import OAI.Probability.LatticeSurface.Convexity.RetainedShell
import OAI.Probability.LatticeSurface.Convexity.WeightedPrekopa
import OAI.Probability.LatticeSurface.Dynamics.DisplacementInequality
import OAI.Probability.LatticeSurface.Geometry.BlockVolume
import OAI.Probability.LatticeSurface.Geometry.CapCentral
import OAI.Probability.LatticeSurface.Geometry.CapCompact
import OAI.Probability.LatticeSurface.Geometry.CapContract
import OAI.Probability.LatticeSurface.Geometry.CapCoordinates
import OAI.Probability.LatticeSurface.Geometry.CapMatching
import OAI.Probability.LatticeSurface.Geometry.CapOrient
import OAI.Probability.LatticeSurface.Geometry.CapReflection
import OAI.Probability.LatticeSurface.Geometry.CapSmall
import OAI.Probability.LatticeSurface.Geometry.CapSplit
import OAI.Probability.LatticeSurface.Geometry.CapUnpin
import OAI.Probability.LatticeSurface.Geometry.CapWeld
import OAI.Probability.LatticeSurface.Geometry.TriangularCover
import OAI.Probability.LatticeSurface.Geometry.TriangularGeometry
import OAI.Probability.LatticeSurface.Moments.ControlledGradients
import OAI.Probability.LatticeSurface.Moments.OrderedGradients

namespace OAI

open Set MeasureTheory Filter

open scoped Topology

noncomputable section

namespace FacetVolume

end FacetVolume

namespace ExtremalEdges

open scoped ENNReal

end ExtremalEdges

noncomputable section

open MeasureTheory Set

open scoped ENNReal

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

end ExtremalEdges

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

variable {V : Type*}

end ExtremalEdges

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

end ExtremalEdges

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

variable {V : Type*}

end ExtremalEdges

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

variable {V : Type*}

end ExtremalEdges

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

variable {V : Type*}

end ExtremalEdges

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

variable {V : Type*}

end ExtremalEdges

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

variable {V : Type*}

end ExtremalEdges

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

variable {V : Type*}

end ExtremalEdges

noncomputable section

namespace ExtremalEdges

open Finset

variable {V I : Type*} [Fintype V] [Fintype I]

attribute [local instance] Classical.propDecidable
attribute [local instance_reducible, local instance] Classical.typeDecidableEq

end ExtremalEdges

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable
attribute [local instance_reducible, local instance] Classical.typeDecidableEq

variable {V I : Type*} [Fintype V] [Fintype I]

end ExtremalEdges

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

end ExtremalEdges

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

variable {V : Type*} [Fintype V]

end ExtremalEdges

open MeasureTheory

open scoped ENNReal

noncomputable section

namespace TriangularLipschitz

end TriangularLipschitz

namespace SparseBlocks

attribute [local instance] Classical.propDecidable

end SparseBlocks

namespace SparseBlocks

attribute [local instance] Classical.propDecidable

end SparseBlocks

namespace SparseBlocks

attribute [local instance] Classical.propDecidable

end SparseBlocks

namespace ExtremalEdges

attribute [local instance] Classical.propDecidable

end ExtremalEdges

namespace SparseBlocks

attribute [local instance] Classical.propDecidable

end SparseBlocks

namespace SparseBlocks

attribute [local instance] Classical.propDecidable
attribute [local instance_reducible, local instance] Classical.typeDecidableEq

end SparseBlocks

noncomputable section

open scoped BigOperators

namespace SparsePaths

attribute [local instance] Classical.propDecidable
attribute [local instance_reducible, local instance] Classical.typeDecidableEq

end SparsePaths

noncomputable section

open scoped BigOperators

namespace SparseWitness

attribute [local instance] Classical.propDecidable
attribute [local instance_reducible, local instance] Classical.typeDecidableEq

end SparseWitness

noncomputable section

open Set MeasureTheory

open scoped BigOperators

namespace SparseWitness

attribute [local instance] Classical.propDecidable
attribute [local instance_reducible, local instance] Classical.typeDecidableEq

end SparseWitness

namespace SparseBlocks

attribute [local instance] Classical.propDecidable
attribute [local instance_reducible, local instance] Classical.typeDecidableEq

end SparseBlocks

namespace SparseBlocks

attribute [local instance] Classical.propDecidable
attribute [local instance_reducible, local instance] Classical.typeDecidableEq

end SparseBlocks

namespace SparseBlocks

open Filter

open scoped Topology

end SparseBlocks

namespace SparseBlocks

attribute [local instance] Classical.propDecidable
attribute [local instance_reducible, local instance] Classical.typeDecidableEq

end SparseBlocks

namespace SparseBlocks

attribute [local instance] Classical.propDecidable
attribute [local instance_reducible, local instance] Classical.typeDecidableEq

end SparseBlocks

namespace SparseBlocks

attribute [local instance] Classical.propDecidable
attribute [local instance_reducible, local instance] Classical.typeDecidableEq

end SparseBlocks

namespace RetainedShell

open TriangularLipschitz

attribute [local instance] Classical.propDecidable

end RetainedShell

namespace RetainedShell

open TriangularLipschitz

attribute [local instance] Classical.propDecidable

end RetainedShell

namespace RetainedShell

open TriangularLipschitz

end RetainedShell

namespace ProductVolume

universe u v

variable {ι : Type u} [Fintype ι] {J : ι → Type v} [∀ i, Fintype (J i)]

end ProductVolume

namespace RetainedShell

open TriangularLipschitz

attribute [local instance] Classical.propDecidable

end RetainedShell

namespace SparseBlocks

end SparseBlocks

namespace RetainedShell

open TriangularLipschitz

attribute [local instance] Classical.propDecidable

end RetainedShell

namespace RetainedShell

open TriangularLipschitz

attribute [local instance] Classical.propDecidable

noncomputable def ordinary (p : SparseBlocks.Parameters) (V : Finset Vertex) : Finset Vertex :=
  (V.image (fun x => (x.1/(p.L:ℤ),x.2/(p.L:ℤ)))).filter (fun z => SparseBlocks.enlarged p z ⊆ (V:Set Vertex))

end RetainedShell

namespace TriangularLipschitz

lemma global_lipschitz (h : Vertex → ℝ) (he : ∀ x y,Adj x y → |h x-h y|≤1)
    (x y : Vertex) : |h x-h y|≤latticeDist x y := by
  suffices ∀ n x y,(intDist x y).toNat=n → |h x-h y|≤latticeDist x y from this _ x y rfl
  intro n
  induction n using Nat.strong_induction_on with
  | h n ih =>
    intro x y hn
    by_cases hxy : x=y
    · subst y;simp [latticeDist]
    obtain ⟨z,hxz,hz1,hz2,hd⟩ := geodesic_step hxy
    have hlt : (intDist z y).toNat<n := by
      have := intDist_nonneg z y
      have := intDist_nonneg x y
      omega
    have hz := ih _ hlt z y rfl
    have hr : latticeDist z y+1=latticeDist x y := by
      simp only [← intDist_cast]
      exact_mod_cast hd
    calc
      |h x-h y|≤|h x-h z|+|h z-h y| := abs_sub_le _ _ _
      _ ≤ 1+latticeDist z y := add_le_add (he x z hxz) hz
      _ = latticeDist x y := by linarith

lemma latticeDist_add_left (a x y : Vertex) : latticeDist (a+x) (a+y)=latticeDist x y := by
  simp only [latticeDist,Prod.fst_add,Prod.snd_add,Int.cast_add]
  congr 2 <;> ring_nf

end TriangularLipschitz

namespace RetainedShell

open TriangularLipschitz

attribute [local instance] Classical.propDecidable

lemma base_enlarged (p : SparseBlocks.Parameters) (z : Vertex) : base p.L z∈SparseBlocks.enlarged p z := by
  have hL : (0:ℤ)≤p.L := Int.natCast_nonneg _
  simp only [SparseBlocks.enlarged,Set.mem_ofPred_eq,base]
  refine ⟨?_,?_,?_,?_⟩ <;> nlinarith

lemma mem_ordinary (p : SparseBlocks.Parameters) (V : Finset Vertex) (z : Vertex) :
    z∈ordinary p V ↔ SparseBlocks.enlarged p z⊆(V:Set Vertex) := by
  classical
  constructor
  · intro hz;exact (Finset.mem_filter.mp hz).2
  · intro hz
    have hL : (p.L:ℤ)≠0 := by exact_mod_cast (SparseBlocks.L_pos p).ne'
    apply Finset.mem_filter.mpr
    refine ⟨Finset.mem_image.mpr ⟨base p.L z,hz (base_enlarged p z),?_⟩,hz⟩
    simp [base,Int.mul_ediv_cancel_left _ hL]

lemma block_enlarged (p : SparseBlocks.Parameters) (z : Vertex) {x : Vertex} (hx : x∈box p.L) :
    base p.L z+x∈SparseBlocks.enlarged p z := by
  have hL : (0:ℤ)≤p.L := Int.natCast_nonneg _
  have hx := mem_box.mp hx
  simp only [SparseBlocks.enlarged,Set.mem_ofPred_eq,base,Prod.fst_add,Prod.snd_add]
  refine ⟨?_,?_,?_,?_⟩ <;> nlinarith

lemma block_translate (p : SparseBlocks.Parameters) (z : Vertex) {x : Vertex} (hx : x∈box p.L) :
    base p.L z+x∈SparseBlocks.block p z := by
  have hx := mem_box.mp hx
  simp only [SparseBlocks.block,Set.mem_ofPred_eq,base,Prod.fst_add,Prod.snd_add]
  refine ⟨?_,?_,?_,?_⟩ <;> nlinarith

lemma ordinary_free (p : SparseBlocks.Parameters) (V : Finset Vertex) :
    ∀ z∈ordinary p V,∀ x∈box p.L,base p.L z+x∈V := by
  intro z hz x hx
  exact (mem_ordinary p V z).mp hz (block_enlarged p z hx)

lemma face_source (p : SparseBlocks.Parameters) (z : Vertex) (i : Fin 4) :
    base p.L z+faceCenter p.L i=SparseBlocks.face p z i := by
  fin_cases i <;> simp [base,faceCenter,SparseBlocks.face,Int.natCast_ediv]

lemma neighbor_source (p : SparseBlocks.Parameters) (z : Vertex) (i : Fin 4) :
    base p.L z+compressedNeighbor p.L i=SparseBlocks.neighbor p z i := by
  fin_cases i <;> simp [base,compressedNeighbor,SparseBlocks.neighbor,SparseBlocks.face,Int.natCast_ediv] <;> ring

lemma face_in_box (L : ℕ) (i : Fin 4) : faceCenter L i∈box L := by
  have he : L/2≤L := Nat.div_le_self _ _
  fin_cases i <;> simp [faceCenter,mem_box] <;> omega

end RetainedShell

namespace RetainedShell

open TriangularLipschitz

theorem pin_block_faces (p : SparseBlocks.Parameters) (V : Finset Vertex) (χ : Vertex → ℝ)
    (hlip : ∀ x y,Adj x y → |χ x-χ y|≤1)
    (hzero : ∀ x,x∉V → χ x=0) (z : Vertex) (hz : z∉ordinary p V) :
    ∀ i : Fin 4,|χ (base p.L z+faceCenter p.L i)|≤4*(p.L:ℝ) := by
  classical
  have hn : ¬ SparseBlocks.enlarged p z⊆(V:Set Vertex) := by
    exact fun h => hz ((mem_ordinary p V z).mpr h)
  obtain ⟨x,hxe,hxV⟩ := Set.not_subset.mp hn
  intro i
  have hd := global_lipschitz χ hlip (base p.L z+faceCenter p.L i) x
  rw [hzero x hxV,sub_zero] at hd
  apply hd.trans
  have hfb := mem_box.mp (face_in_box p.L i)
  have hxe : (p.L:ℤ)*(z.1-1)≤x.1 ∧ x.1≤(p.L:ℤ)*(z.1+2) ∧
      (p.L:ℤ)*(z.2-1)≤x.2 ∧ x.2≤(p.L:ℤ)*(z.2+2) := hxe
  have h1 : |((base p.L z+faceCenter p.L i).1:ℝ)-x.1|≤2*(p.L:ℝ) := by
    have hh : |(base p.L z+faceCenter p.L i).1-x.1|≤2*(p.L:ℤ) := by
      simp only [Prod.fst_add,base]
      rw [abs_le]
      constructor <;> nlinarith [hfb.1.1,hfb.1.2,hxe.1,hxe.2.1]
    exact_mod_cast hh
  have h2 : |((base p.L z+faceCenter p.L i).2:ℝ)-x.2|≤2*(p.L:ℝ) := by
    have hh : |(base p.L z+faceCenter p.L i).2-x.2|≤2*(p.L:ℤ) := by
      simp only [Prod.snd_add,base]
      rw [abs_le]
      constructor <;> nlinarith [hfb.2.1,hfb.2.2,hxe.2.2.1,hxe.2.2.2]
    exact_mod_cast hh
  apply max_le
  · exact max_le (by linarith) (by linarith)
  · exact (abs_add_le _ _).trans (by linarith)

theorem ordinary_good (p : SparseBlocks.Parameters) (V : Finset Vertex) (h : V → ℝ)
    (z : Vertex) (hz : z∈ordinary p V) (hb : ¬ SparseBlocks.bad p V h z) :
    ConvexGood p.L p.k₀ p.δ p.δ₀ p.s₀ (fun x => SparseBlocks.height V h (base p.L z+x)) := by
  have hf := (mem_ordinary p V z).mp hz
  refine ⟨?_,?_,?_⟩
  · intro x hx y hy hxy
    apply le_of_not_gt
    intro he
    apply hb
    exact ⟨hf,Or.inl ⟨base p.L z+x,block_translate p z hx,
      base p.L z+y,block_translate p z hy,(adj_translate p.L z x y).mpr hxy,he⟩⟩
  · intro x hx y hy hdist
    apply le_of_not_gt
    intro he
    apply hb
    refine ⟨hf,Or.inr (Or.inl ⟨base p.L z+x,block_enlarged p z hx,
      base p.L z+y,block_enlarged p z hy,?_,?_⟩)⟩
    · change (p.k₀:ℝ)≤TriangularLipschitz.latticeDist (base p.L z+x) (base p.L z+y)
      rwa [latticeDist_add_left]
    · change (1-p.δ₀)*TriangularLipschitz.latticeDist (base p.L z+x) (base p.L z+y)<_
      rwa [latticeDist_add_left]
  · intro i
    change p.s₀≤|SparseBlocks.height V h (base p.L z+compressedNeighbor p.L i)-
      SparseBlocks.height V h (base p.L z+faceCenter p.L i)|
    rw [face_source,neighbor_source]
    apply le_of_not_gt
    intro he
    exact hb ⟨hf,Or.inr (Or.inr ⟨i,he⟩)⟩

end RetainedShell

end
end
end
end
end
end
end

end OAI