File size: 4,128 Bytes
d4317d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import OAI.MeasureTheory.Falconer.DistanceSet
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.FinCases
import Mathlib.Analysis.Normed.Lp.MeasurableSpace

namespace OAI

namespace PlanarFalconer
open Set Metric

structure DyadicSquare where
  x : ℝ
  y : ℝ
  side : ℝ

def DyadicSquare.carrier (Q : DyadicSquare) : Set Plane :=
  {z | Q.x ≤ z 0 ∧ z 0 < Q.x + Q.side ∧
       Q.y ≤ z 1 ∧ z 1 < Q.y + Q.side}

noncomputable def DyadicSquare.child (Q : DyadicSquare) (i j : Bool) : DyadicSquare :=
  ⟨Q.x + (if i then Q.side / 2 else 0),
   Q.y + (if j then Q.side / 2 else 0), Q.side / 2⟩

theorem DyadicSquare.child_side_pos (Q : DyadicSquare) (hQ : 0 < Q.side)
    (i j : Bool) : 0 < (Q.child i j).side := by
  dsimp [child]
  positivity

theorem DyadicSquare.measurable (Q : DyadicSquare) : MeasurableSet Q.carrier := by
  have h0 : Continuous (fun z : Plane => z 0) := (EuclideanSpace.proj 0).continuous
  have h1 : Continuous (fun z : Plane => z 1) := (EuclideanSpace.proj 1).continuous
  exact (isClosed_le continuous_const h0).measurableSet.inter
    ((isOpen_lt h0 continuous_const).measurableSet.inter
    ((isClosed_le continuous_const h1).measurableSet.inter
    (isOpen_lt h1 continuous_const).measurableSet))

theorem DyadicSquare.child_subset (Q : DyadicSquare) (hQ : 0 ≤ Q.side)
    (i j : Bool) : (Q.child i j).carrier ⊆ Q.carrier := by
  have halfSide_nonneg : 0 ≤ Q.side / 2 := div_nonneg hQ (by norm_num)
  intro z hz
  cases i <;> cases j <;>
    simp only [carrier, child, Bool.false_eq_true, ↓reduceIte,
      add_zero, mem_ofPred_eq] at * <;>
    refine ⟨by linarith [halfSide_nonneg], by linarith [halfSide_nonneg],
      by linarith [halfSide_nonneg], by linarith [halfSide_nonneg]⟩

theorem DyadicSquare.cover_children (Q : DyadicSquare) :
    Q.carrier = ((Q.child false false).carrier ∪ (Q.child false true).carrier) ∪
      ((Q.child true false).carrier ∪ (Q.child true true).carrier) := by
  ext z
  simp only [carrier, child, Bool.false_eq_true, ↓reduceIte,
    add_zero, mem_ofPred_eq, mem_union]
  constructor
  · intro hz
    by_cases hx : z 0 < Q.x + Q.side / 2 <;>
      by_cases hy : z 1 < Q.y + Q.side / 2
    · exact Or.inl (Or.inl ⟨hz.1,hx,hz.2.2.1,hy⟩)
    · exact Or.inl (Or.inr ⟨hz.1,hx,by linarith,by linarith [hz.2.2.2]⟩)
    · exact Or.inr (Or.inl ⟨by linarith,by linarith [hz.2.1],hz.2.2.1,hy⟩)
    · exact Or.inr (Or.inr ⟨by linarith,by linarith [hz.2.1],
        by linarith,by linarith [hz.2.2.2]⟩)
  · intro hz
    rcases hz with (hz | hz) | (hz | hz) <;>
      refine ⟨by linarith [hz.1,hz.2.1], by linarith [hz.1,hz.2.1],
        by linarith [hz.2.2.1,hz.2.2.2], by linarith [hz.2.2.1,hz.2.2.2]⟩

theorem DyadicSquare.children_disjoint (Q : DyadicSquare)
    {i j i' j' : Bool} (h : (i,j) ≠ (i',j')) :
    Disjoint (Q.child i j).carrier (Q.child i' j').carrier := by
  apply Set.disjoint_left.mpr
  intro z hz hz'
  cases i <;> cases j <;> cases i' <;> cases j' <;>
    simp_all only [carrier, child, Bool.false_eq_true, ↓reduceIte,
      add_zero, mem_ofPred_eq, ne_eq, not_true_eq_false] <;> linarith

theorem DyadicSquare.dist_le (Q : DyadicSquare) (hQ : 0 ≤ Q.side)
    {z w : Plane} (hz : z ∈ Q.carrier) (hw : w ∈ Q.carrier) :
    dist z w ≤ 2 * Q.side := by
  have h0 : |z 0 - w 0| ≤ Q.side := by
    apply abs_le.mpr; constructor <;> linarith [hz.1,hz.2.1,hw.1,hw.2.1]
  have h1 : |z 1 - w 1| ≤ Q.side := by
    apply abs_le.mpr; constructor <;>
      linarith [hz.2.2.1,hz.2.2.2,hw.2.2.1,hw.2.2.2]
  have hs := EuclideanSpace.dist_sq_eq z w
  simp only [Fin.sum_univ_two, Real.dist_eq, sq_abs] at hs
  have hs0 := sq_le_sq₀ (abs_nonneg _) hQ |>.mpr h0
  have hs1 := sq_le_sq₀ (abs_nonneg _) hQ |>.mpr h1
  rw [sq_abs] at hs0 hs1
  nlinarith [dist_nonneg (x := z) (y := w)]

theorem DyadicSquare.ediam_le (Q : DyadicSquare) (hQ : 0 ≤ Q.side) :
    ediam Q.carrier ≤ ENNReal.ofReal (2 * Q.side) := by
  apply Metric.ediam_le
  intro z hz w hw
  rw [edist_dist]
  exact ENNReal.ofReal_le_ofReal (Q.dist_le hQ hz hw)

end PlanarFalconer

end OAI