File size: 5,213 Bytes
92416a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import Mathlib
import OAI.Computability.VertexCover.Reduction.HighVectorsSeparated

namespace OAI

section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
namespace VertexCover.LabelCover

theorem norm_sum_le (Φ : LabelCover) {d : ℕ} {ι : Type*}
    (T : Finset ι) (f : ι → Φ.Coordinate d → ℝ) :
    Φ.compatibilityNorm (∑ i ∈ T, f i) ≤ ∑ i ∈ T, Φ.compatibilityNorm (f i) := by
  classical
  induction T using Finset.induction_on with
  | empty =>
    simp only [Finset.sum_empty]
    exact (Φ.norm_zero d).le
  | @insert i T hi ih =>
    simp only [Finset.sum_insert hi]
    exact (Φ.norm_add_le _ _).trans (add_le_add_right ih _)

theorem increment_sub (Φ : LabelCover) {d : ℕ} (i : Φ.Query d)
    (s t : Fin (Φ.WeightDimension d) → ℝ) :
    Φ.increment i (s-t) = Φ.increment i s - Φ.increment i t := by
  have hn : Φ.increment i (-t) = -Φ.increment i t := by
    ext p
    change Φ.increment i (fun k => -t k) p = -Φ.increment i t p
    have h := congrFun (Φ.increment_mul i (-1) t) p
    simpa only [neg_one_mul] using h
  rw [sub_eq_add_neg, Φ.increment_add, hn, sub_eq_add_neg]

noncomputable def continuousSum (Φ : LabelCover) {d : ℕ} (seed : Φ.Seeds d)
    (s : Fin d → Fin (Φ.WeightDimension d) → ℝ) : Φ.Coordinate d → ℝ :=
  ∑ j, Φ.increment (Φ.query seed j) (s j)

theorem sumVector_eq_continuousSum (Φ : LabelCover) {d : ℕ} (v : Φ.Vertex d) :
    Φ.sumVector v = Φ.continuousSum v.1 (fun j k => (gridRational d (v.2 j k) : ℝ)) := rfl

theorem continuousSum_neg (Φ : LabelCover) {d : ℕ} (seed : Φ.Seeds d)
    (s : Fin d → Fin (Φ.WeightDimension d) → ℝ) :
    Φ.continuousSum seed (-s) = -Φ.continuousSum seed s := by
  unfold continuousSum
  rw [← Finset.sum_neg_distrib]
  apply Finset.sum_congr rfl
  intro j _
  ext p
  change Φ.increment (Φ.query seed j) (fun k => -s j k) p =
    -Φ.increment (Φ.query seed j) (s j) p
  have h := congrFun (Φ.increment_mul (Φ.query seed j) (-1) (s j)) p
  simpa only [neg_one_mul] using h

theorem continuousSum_sub_same_seed (Φ : LabelCover) {d : ℕ} (seed : Φ.Seeds d)
    (s t : Fin d → Fin (Φ.WeightDimension d) → ℝ) :
    Φ.continuousSum seed s - Φ.continuousSum seed t = Φ.continuousSum seed (s-t) := by
  simp only [continuousSum, ← Finset.sum_sub_distrib, Pi.sub_apply, increment_sub]

theorem continuousSum_close (Φ : LabelCover) {d : ℕ} (seed : Φ.Seeds d)
    (s t : Fin d → Fin (Φ.WeightDimension d) → ℝ) {b : ℝ} (hb : 0 ≤ b)
    (hclose : ∀ j k, |s j k - t j k| ≤ b) :
    Φ.compatibilityNorm (Φ.continuousSum seed s - Φ.continuousSum seed t) ≤ d*b := by
  rw [Φ.continuousSum_sub_same_seed]
  apply (Φ.norm_sum_le _ _).trans
  calc
    (∑ j, Φ.compatibilityNorm (Φ.increment (Φ.query seed j) ((s-t) j))) ≤
        ∑ _j : Fin d, b := by
      apply Finset.sum_le_sum
      intro j _
      exact Φ.increment_norm_le _ _ hb (hclose j)
    _ = d*b := by simp

def InWeightCube (Φ : LabelCover) {d : ℕ}
    (s : Fin d → Fin (Φ.WeightDimension d) → ℝ) : Prop :=
  ∀ j k, |s j k| ≤ 1

theorem continuousSum_change_blocks (Φ : LabelCover) {d : ℕ}
    (seed seed' : Φ.Seeds d) (s t : Fin d → Fin (Φ.WeightDimension d) → ℝ)
    (hs : Φ.InWeightCube s) (ht : Φ.InWeightCube t) (B : Finset (Fin d))
    (heq : ∀ j ∉ B, Φ.query seed j = Φ.query seed' j ∧ s j = t j) :
    Φ.compatibilityNorm (Φ.continuousSum seed s - Φ.continuousSum seed' t) ≤ 2*B.card := by
  classical
  unfold continuousSum
  rw [← Finset.sum_sub_distrib]
  apply (Φ.norm_sum_le _ _).trans
  calc
    (∑ j, Φ.compatibilityNorm
        (Φ.increment (Φ.query seed j) (s j) - Φ.increment (Φ.query seed' j) (t j))) ≤
        ∑ j : Fin d, if j ∈ B then (2 : ℝ) else 0 := by
      apply Finset.sum_le_sum
      intro j _
      by_cases hj : j ∈ B
      · rw [ite_eq_left hj]
        have hb := Φ.norm_sub_triangle (Φ.increment (Φ.query seed j) (s j)) 0
          (Φ.increment (Φ.query seed' j) (t j))
        have hh1 := Φ.increment_norm_le (Φ.query seed j) (s j) (by norm_num : (0:ℝ) ≤ 1) (hs j)
        have hh2 := Φ.increment_norm_le (Φ.query seed' j) (t j) (by norm_num : (0:ℝ) ≤ 1) (ht j)
        simp only [sub_zero, zero_sub, Φ.norm_neg] at hb
        linarith
      · obtain ⟨hq, hw⟩ := heq j hj
        rw [hq, hw, sub_self, ite_eq_right hj]
        exact (Φ.norm_zero d).le
    _ = 2*B.card := by simp [Finset.sum_ite_mem, mul_comm]

theorem separator_continuousSum_odd (Φ : LabelCover) {d : ℕ}
    (A : Finset (Φ.Coordinate d → ℝ)) (hA : A.Nonempty) (seed : Φ.Seeds d)
    (s : Fin d → Fin (Φ.WeightDimension d) → ℝ) :
    Φ.separator A hA (Φ.continuousSum seed (-s)) =
      -Φ.separator A hA (Φ.continuousSum seed s) := by
  rw [Φ.continuousSum_neg, Φ.separator_odd]

end VertexCover.LabelCover

end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end

end OAI