File size: 11,829 Bytes
8e4d533
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import Mathlib
import OAI.Geometry.Borsuk.Model

namespace OAI

namespace BorsukNine

open scoped RealInnerProductSpace ContDiff

@[simp] theorem projector_apply (u : Vector4) (i j : Fin 4) :
    projector u (i, j) = u i * u j := rfl

@[simp] theorem projector_neg (u : Vector4) : projector (-u) = projector u := by
  ext ⟨i, j⟩
  simp [projector]

theorem continuous_projector : Continuous projector := by
  apply (PiLp.continuous_toLp 2 _).comp
  apply continuous_pi
  intro ij
  exact (PiLp.continuous_apply 2 _ ij.1).mul (PiLp.continuous_apply 2 _ ij.2)

theorem isCompact_projectorSet : IsCompact projectorSet := by
  have h : {u : Vector4 | ‖u‖ = 1} = Metric.sphere 0 1 := by
    ext u
    simp
  rw [projectorSet, h]
  exact (isCompact_sphere (0 : Vector4) 1).image continuous_projector

theorem projector_inner (u v : Vector4) :
    ⟪projector u, projector v⟫ = ⟪u, v⟫ ^ 2 := by
  simp only [PiLp.inner_apply, RCLike.inner_apply, conj_trivial, projector]
  change (∑ ij : Fin 4 × Fin 4, (v ij.1 * v ij.2) * (u ij.1 * u ij.2)) =
    (∑ i : Fin 4, v i * u i) ^ 2
  rw [Fintype.sum_prod_type]
  simp only [pow_two, Finset.sum_mul_sum]
  apply Finset.sum_congr rfl
  intro i _
  apply Finset.sum_congr rfl
  intro j _
  ring

theorem projector_norm_sq (u : Vector4) : ‖projector u‖ ^ 2 = ‖u‖ ^ 4 := by
  rw [← real_inner_self_eq_norm_sq, projector_inner, real_inner_self_eq_norm_sq]
  ring

theorem projectorSet_subset_traceOneSymmetric : projectorSet ⊆ traceOneSymmetric := by
  rintro _ ⟨u, hu, rfl⟩
  constructor
  · intro i j
    simp [mul_comm]
  · have he : (∑ i : Fin 4, u i * u i) = ‖u‖ ^ 2 := by
      exact (EuclideanSpace.inner_eq_star_dotProduct u u).symm.trans
        (real_inner_self_eq_norm_sq u)
    change ‖u‖ = 1 at hu
    simp only [projector_apply, he, hu, one_pow]

theorem projector_dist_sq (u v : Vector4) (hu : ‖u‖ = 1) (hv : ‖v‖ = 1) :
    dist (projector u) (projector v) ^ 2 = 2 - 2 * ⟪u, v⟫ ^ 2 := by
  rw [dist_eq_norm, norm_sub_sq_real, projector_norm_sq, projector_norm_sq,
    projector_inner, hu, hv]
  ring

theorem projector_dist_le (u v : Vector4) (hu : ‖u‖ = 1) (hv : ‖v‖ = 1) :
    dist (projector u) (projector v) ≤ Real.sqrt 2 := by
  have hd := projector_dist_sq u v hu hv
  have hs := Real.sq_sqrt (show (0 : ℝ) ≤ 2 by norm_num)
  have hp := Real.sqrt_nonneg (2 : ℝ)
  nlinarith [sq_nonneg ⟪u, v⟫, dist_nonneg (x := projector u) (y := projector v)]

theorem projector_dist_eq_sqrt_two_iff (u v : Vector4)
    (hu : ‖u‖ = 1) (hv : ‖v‖ = 1) :
    dist (projector u) (projector v) = Real.sqrt 2 ↔ ⟪u, v⟫ = 0 := by
  have hd := projector_dist_sq u v hu hv
  have hs := Real.sq_sqrt (show (0 : ℝ) ≤ 2 by norm_num)
  constructor
  · intro h
    rw [h] at hd
    nlinarith [sq_nonneg ⟪u, v⟫]
  · intro h
    rw [h] at hd
    have hn := dist_nonneg (x := projector u) (y := projector v)
    have hp := Real.sqrt_nonneg (2 : ℝ)
    nlinarith

theorem diam_projectorSet : Metric.diam projectorSet = Real.sqrt 2 := by
  apply le_antisymm
  · apply Metric.diam_le_of_forall_dist_le (Real.sqrt_nonneg 2)
    rintro _ ⟨u, hu, rfl⟩ _ ⟨v, hv, rfl⟩
    exact projector_dist_le u v hu hv
  · let u : Vector4 := EuclideanSpace.single 0 1
    let v : Vector4 := EuclideanSpace.single 1 1
    have hu : ‖u‖ = 1 := by simp [u]
    have hv : ‖v‖ = 1 := by simp [v]
    have huv : ⟪u, v⟫ = 0 := by simp [u, v, EuclideanSpace.inner_single_left]
    have hd := (projector_dist_eq_sqrt_two_iff u v hu hv).mpr huv
    rw [← hd]
    exact Metric.dist_le_diam_of_mem isCompact_projectorSet.isBounded
      ⟨u, hu, rfl⟩ ⟨v, hv, rfl⟩

structure Admissible {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
    {ι : Type*} [Fintype ι] (f : V → ι → ℝ) : Prop where
  smooth : ∀ i, ContDiff ℝ ∞ (fun u => f u i)
  antipodal : ∀ u i, f (-u) i = f u i
  nonneg : ∀ u, ‖u‖ = 1 → ∀ i, 0 ≤ f u i
  sum_one : ∀ u, ‖u‖ = 1 → ∑ i, f u i = 1
  orthogonal : ∀ u v, ‖u‖ = 1 → ‖v‖ = 1 → ⟪u, v⟫ = 0 →
    ∀ i, ¬ (0 < f u i ∧ 0 < f v i)

theorem contDiff_projector : ContDiff ℝ ∞ projector := by
  apply (contDiff_piLp 2).mpr
  intro ij
  exact (contDiff_piLp_apply (p := 2) (i := ij.1)).mul (contDiff_piLp_apply (p := 2) (i := ij.2))

theorem dist_lt_of_mem_thickening_small {C : Set Matrix4}
    (hC : C ⊆ projectorSet) (hd : Metric.diam C < Real.sqrt 2)
    {P Q : Matrix4}
    (hP : P ∈ Metric.thickening ((Real.sqrt 2 - Metric.diam C) / 4) C)
    (hQ : Q ∈ Metric.thickening ((Real.sqrt 2 - Metric.diam C) / 4) C) :
    dist P Q < Real.sqrt 2 := by
  rcases Metric.mem_thickening_iff.mp hP with ⟨p, hp, hPp⟩
  rcases Metric.mem_thickening_iff.mp hQ with ⟨q, hq, hQq⟩
  have hb := isCompact_projectorSet.isBounded.subset hC
  have hpq := Metric.dist_le_diam_of_mem hb hp hq
  have ht : dist P Q ≤ dist P p + dist p q + dist Q q := by
    calc
      dist P Q ≤ dist P p + dist p Q := dist_triangle P p Q
      _ ≤ dist P p + (dist p q + dist q Q) :=
        add_le_add le_rfl (dist_triangle p q Q)
      _ = dist P p + dist p q + dist Q q := by rw [dist_comm q Q]; ring
  linarith

open scoped Manifold

theorem cover_to_admissible (h : HasTenSmallCover) :
    ∃ f : Vector4 → Fin 10 → ℝ, Admissible f := by
  classical
  rcases h with ⟨C, hCX, hcov, hdiam⟩
  let U : Fin 10 → Set Matrix4 := fun i =>
    Metric.thickening ((Real.sqrt 2 - Metric.diam (C i)) / 4) (C i)
  have hU : ∀ i, IsOpen (U i) := fun _ => Metric.isOpen_thickening
  have hCU : ∀ i, C i ⊆ U i := by
    intro i
    apply Metric.self_subset_thickening
    linarith [hdiam i]
  have hXU : projectorSet ⊆ ⋃ i, U i := by
    intro P hP
    rcases Set.mem_iUnion.mp (hcov hP) with ⟨i, hi⟩
    exact Set.mem_iUnion.mpr ⟨i, hCU i hi⟩
  obtain ⟨ρ, hρ⟩ := SmoothPartitionOfUnity.exists_isSubordinate
    (I := 𝓘(ℝ, Matrix4)) isCompact_projectorSet.isClosed U hU hXU
  refine ⟨fun u i => ρ i (projector u), ?_⟩
  constructor
  · intro i
    exact (contMDiff_iff_contDiff.mp (ρ i).contMDiff).comp contDiff_projector
  · intro u i
    simp
  · intro u _ i
    exact ρ.nonneg i (projector u)
  · intro u hu
    simpa only [finsum_eq_sum_of_fintype] using ρ.sum_eq_one (show projector u ∈ projectorSet
      from ⟨u, hu, rfl⟩)
  · intro u v hu hv huv i ⟨hui, hvi⟩
    have huU : projector u ∈ U i := hρ i (subset_tsupport _ (ne_of_gt hui))
    have hvU : projector v ∈ U i := hρ i (subset_tsupport _ (ne_of_gt hvi))
    have hd := dist_lt_of_mem_thickening_small (hCX i) (hdiam i) huU hvU
    rw [(projector_dist_eq_sqrt_two_iff u v hu hv).mpr huv] at hd
    exact lt_irrefl _ hd

theorem compact_diam_lt {C : Set Matrix4} (hC : IsCompact C) {d : ℝ}
    (hd : 0 < d) (hpair : ∀ x ∈ C, ∀ y ∈ C, dist x y < d) :
    Metric.diam C < d := by
  rcases C.eq_empty_or_nonempty with rfl | hne
  · simpa using hd
  · obtain ⟨⟨x, y⟩, hxy, hmax⟩ := (hC.prod hC).exists_isMaxOn (hne.prod hne)
      (continuous_fst.dist continuous_snd).continuousOn
    have hbound : Metric.diam C ≤ dist x y := by
      apply Metric.diam_le_of_forall_dist_le dist_nonneg
      intro a ha b hb
      exact (isMaxOn_iff.mp hmax) (a, b) ⟨ha, hb⟩
    exact hbound.trans_lt (hpair x hxy.1 y hxy.2)

theorem admissible_to_cover {f : Vector4 → Fin 10 → ℝ} (hf : Admissible f) :
    HasTenSmallCover := by
  classical
  let L : Fin 10 → Set Vector4 := fun i =>
    {u | ‖u‖ = 1} ∩ {u | (1 : ℝ) / 10 ≤ f u i}
  let C : Fin 10 → Set Matrix4 := fun i => projector '' L i
  have hLcompact : ∀ i, IsCompact (L i) := by
    intro i
    have hsphere : IsCompact {u : Vector4 | ‖u‖ = 1} := by
      have he : {u : Vector4 | ‖u‖ = 1} = Metric.sphere 0 1 := by
        ext u
        simp
      rw [he]
      exact isCompact_sphere (0 : Vector4) 1
    exact hsphere.inter_right (isClosed_le continuous_const (hf.smooth i).continuous)
  have hCcompact : ∀ i, IsCompact (C i) := fun i =>
    (hLcompact i).image continuous_projector
  refine ⟨C, ?_, ?_, ?_⟩
  · intro i P hP
    rcases hP with ⟨u, hu, rfl⟩
    exact ⟨u, hu.1, rfl⟩
  · rintro P ⟨u, hu, rfl⟩
    have hsum : (∑ _i : Fin 10, (1 : ℝ) / 10) ≤ ∑ i, f u i := by
      rw [hf.sum_one u hu]
      norm_num
    obtain ⟨i, _, hi⟩ := Finset.exists_le_of_sum_le Finset.univ_nonempty hsum
    exact Set.mem_iUnion.mpr ⟨i, u, ⟨hu, hi⟩, rfl⟩
  · intro i
    apply compact_diam_lt (hCcompact i) (Real.sqrt_pos.mpr (by norm_num))
    rintro _ ⟨u, hu, rfl⟩ _ ⟨v, hv, rfl⟩
    by_contra h
    have heq : dist (projector u) (projector v) = Real.sqrt 2 :=
      le_antisymm (projector_dist_le u v hu.1 hv.1) (le_of_not_gt h)
    have huv := (projector_dist_eq_sqrt_two_iff u v hu.1 hv.1).mp heq
    exact hf.orthogonal u v hu.1 hv.1 huv i
      ⟨lt_of_lt_of_le (by norm_num) hu.2, lt_of_lt_of_le (by norm_num) hv.2⟩

theorem cover_iff_admissible : HasTenSmallCover ↔
    ∃ f : Vector4 → Fin 10 → ℝ, Admissible f :=
  ⟨cover_to_admissible, fun ⟨_, hf⟩ => admissible_to_cover hf⟩

theorem exists_unit_orthogonal {n : ℕ} (hn : n < 4) (v : Fin n → Vector4) :
    ∃ w : Vector4, ‖w‖ = 1 ∧ ∀ i, ⟪v i, w⟫ = 0 := by
  classical
  let W : Submodule ℝ Vector4 := Submodule.span ℝ (Set.range v)
  have hW : W ≠ ⊤ := by
    intro he
    have hh := finrank_le_of_span_eq_top he
    have hd : Module.finrank ℝ Vector4 = 4 := by simp
    rw [hd, Fintype.card_fin] at hh
    omega
  have hO : Wᗮ ≠ ⊥ := by
    intro he
    exact hW (Submodule.orthogonal_eq_bot_iff.mp he)
  obtain ⟨w, hw, hwne⟩ := (Submodule.ne_bot_iff Wᗮ).mp hO
  refine ⟨(‖w‖⁻¹ : ℝ) • w, norm_smul_inv_norm hwne, ?_⟩
  intro i
  rw [inner_smul_right, Submodule.inner_right_of_mem_orthogonal
    (show v i ∈ W from Submodule.subset_span (Set.mem_range_self i)) hw, mul_zero]

noncomputable def positiveSupport {ι : Type*} [Fintype ι]
    {V : Type*} (f : V → ι → ℝ) (u : V) : Finset ι := by
  classical
  exact Finset.univ.filter (fun i => 0 < f u i)

@[simp] theorem mem_positiveSupport {ι : Type*} [Fintype ι]
    {V : Type*} (f : V → ι → ℝ) (u : V) (i : ι) :
    i ∈ positiveSupport f u ↔ 0 < f u i := by
  classical
  simp [positiveSupport]

lemma Admissible.support_nonempty {ι : Type*} [Fintype ι]
    {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
    {f : V → ι → ℝ} (hf : Admissible f) {u : V} (hu : ‖u‖ = 1) :
    (positiveSupport f u).Nonempty := by
  classical
  have hs : 0 < ∑ i, f u i := by rw [hf.sum_one u hu]; norm_num
  obtain ⟨i, _, hi⟩ := (Finset.sum_pos_iff_of_nonneg (fun i _ => hf.nonneg u hu i)).mp hs
  exact ⟨i, (mem_positiveSupport f u i).mpr hi⟩

lemma Admissible.disjoint_supports {ι : Type*} [Fintype ι]
    {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
    {f : V → ι → ℝ} (hf : Admissible f) {u v : V}
    (hu : ‖u‖ = 1) (hv : ‖v‖ = 1) (horth : ⟪u, v⟫ = 0) :
    Disjoint (positiveSupport f u) (positiveSupport f v) := by
  classical
  apply Finset.disjoint_left.mpr
  intro i hi hj
  exact hf.orthogonal u v hu hv horth i
    ⟨(mem_positiveSupport f u i).mp hi, (mem_positiveSupport f v i).mp hj⟩

theorem Admissible.exists_label_absent {ι : Type*} [Fintype ι]
    {f : Vector4 → ι → ℝ} (hf : Admissible f) {n : ℕ} (hn : n < 4)
    (v : Fin n → Vector4) (hv : ∀ j, ‖v j‖ = 1) :
    ∃ i, ∀ j, i ∉ positiveSupport f (v j) := by
  obtain ⟨w, hw, hvw⟩ := exists_unit_orthogonal hn v
  obtain ⟨i, hi⟩ := hf.support_nonempty hw
  refine ⟨i, ?_⟩
  intro j hj
  exact Finset.disjoint_left.mp (hf.disjoint_supports (hv j) hw (hvw j)) hj hi

end BorsukNine

end OAI