File size: 5,328 Bytes
e320e82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import OAI.Combinatorics.ExpectationThreshold.SelectorDefinitions
import Lean.Elab.Tactic.Omega

namespace OAI

/-!
# Delaying one moved coordinate by one color

When a moved coordinate has final color `i`, replacing it by `i.succ` removes
exactly that coordinate from the prefixSet at cut `i`. Every other cut stays
unchanged, and total movement decreases by one.
-/

noncomputable section

open scoped BigOperators

namespace TalagrandThreshold.Selector

variable {α : Type*} [Fintype α] [DecidableEq α] {s : ℕ}

/-- Raise the final color of `x` to the color immediately after cut `i`. -/
def delayColor (z : Coloring α s) (x : α) (i : Fin s) : Coloring α s :=
  Function.update z x i.succ

omit [Fintype α] in
@[simp] theorem delayColor_apply_self (z : Coloring α s) (x : α) (i : Fin s) :
    delayColor z x i x = i.succ := by
  simp [delayColor]

omit [Fintype α] in
theorem delayColor_apply_of_ne (z : Coloring α s) (x : α) (i : Fin s)
    (y : α) (hy : y ≠ x) : delayColor z x i y = z y := by
  simp [delayColor, hy]

omit [Fintype α] in
theorem earlier_delayColor (a z : Coloring α s) (x : α) (i : Fin s)
    (hx : (z x).val = i.val) (hmove : (z x).val < (a x).val)
    (hearlier : Earlier a z) : Earlier a (delayColor z x i) := by
  intro y
  by_cases hy : y = x
  · subst y
    rw [delayColor_apply_self]
    change i.val + 1 ≤ (a x).val
    omega
  · rw [delayColor_apply_of_ne z x i y hy]
    exact hearlier y

/-- Delaying a coordinate cannot introduce a newly moved vertex. -/
theorem changes_delayColor_subset (a z : Coloring α s) (x : α) (i : Fin s)
    (hx : (z x).val = i.val) : changes a (delayColor z x i) ⊆ changes a z := by
  intro y hy
  have hlt : delayColor z x i y < a y := (Finset.mem_filter.mp hy).2
  apply Finset.mem_filter.mpr
  refine ⟨Finset.mem_univ y, ?_⟩
  by_cases hyx : y = x
  · subst y
    rw [delayColor_apply_self] at hlt
    change i.val + 1 < (a x).val at hlt
    change (z x).val < (a x).val
    omega
  · rw [delayColor_apply_of_ne z x i y hyx] at hlt
    exact hlt

theorem prefix_delayColor_self (z : Coloring α s) (x : α) (i : Fin s)
    (_hx : (z x).val = i.val) :
    prefixSet (delayColor z x i) i = (prefixSet z i).erase x := by
  ext y
  by_cases hy : y = x
  · subst y
    simp only [prefixSet, Finset.mem_filter, Finset.mem_univ, true_and,
      Finset.mem_erase, delayColor_apply_self]
    simp
  · constructor
    · intro hnew
      have hle : (delayColor z x i y).val ≤ i.val :=
        (Finset.mem_filter.mp hnew).2
      rw [delayColor_apply_of_ne z x i y hy] at hle
      exact Finset.mem_erase.mpr
        ⟨hy, Finset.mem_filter.mpr ⟨Finset.mem_univ y, hle⟩⟩
    · intro hold
      have hmem : y ∈ prefixSet z i := (Finset.mem_erase.mp hold).2
      have hle : (z y).val ≤ i.val := (Finset.mem_filter.mp hmem).2
      apply Finset.mem_filter.mpr
      refine ⟨Finset.mem_univ y, ?_⟩
      rw [delayColor_apply_of_ne z x i y hy]
      exact hle

theorem prefix_delayColor_of_ne (z : Coloring α s) (x : α) (i j : Fin s)
    (hx : (z x).val = i.val) (hji : j ≠ i) :
    prefixSet (delayColor z x i) j = prefixSet z j := by
  ext y
  by_cases hy : y = x
  · subst y
    have hvals : j.val ≠ i.val := fun h => hji (Fin.ext h)
    simp only [prefixSet, Finset.mem_filter, Finset.mem_univ, true_and,
      delayColor_apply_self]
    change i.val + 1 ≤ j.val ↔ (z x).val ≤ j.val
    omega
  · simp only [prefixSet, Finset.mem_filter, Finset.mem_univ, true_and]
    rw [delayColor_apply_of_ne z x i y hy]

/-- Exactly one crossing disappears at the affected cut. -/
theorem crossings_delayColor_self (a z : Coloring α s) (x : α) (i : Fin s)
    (hx : (z x).val = i.val) (hmove : (z x).val < (a x).val) :
    crossings a (delayColor z x i) i + 1 = crossings a z i := by
  unfold crossings
  rw [prefix_delayColor_self z x i hx, Finset.erase_sdiff_comm]
  apply Finset.card_erase_add_one
  simp only [Finset.mem_sdiff, prefixSet, Finset.mem_filter, Finset.mem_univ, true_and]
  constructor <;> omega

theorem crossings_delayColor_of_ne (a z : Coloring α s) (x : α) (i j : Fin s)
    (hx : (z x).val = i.val) (hji : j ≠ i) :
    crossings a (delayColor z x i) j = crossings a z j := by
  unfold crossings
  rw [prefix_delayColor_of_ne z x i j hx hji]

/-- The delay removes precisely one unit of total movement. -/
theorem movement_delayColor_add_one (a z : Coloring α s) (x : α) (i : Fin s)
    (hx : (z x).val = i.val) (hmove : (z x).val < (a x).val) :
    movement a (delayColor z x i) + 1 = movement a z := by
  let f : α → ℕ := fun y => (a y).val - (z y).val
  let g : α → ℕ := fun y => (a y).val - (delayColor z x i y).val
  have hrest : (∑ y ∈ Finset.univ.erase x, g y) =
      ∑ y ∈ Finset.univ.erase x, f y := by
    apply Finset.sum_congr rfl
    intro y hy
    have hne : y ≠ x := (Finset.mem_erase.mp hy).1
    dsimp only [g, f]
    rw [delayColor_apply_of_ne z x i y hne]
  have hpoint : g x + 1 = f x := by
    dsimp only [g, f]
    rw [delayColor_apply_self]
    change (a x).val - (i.val + 1) + 1 = (a x).val - (z x).val
    omega
  change (∑ y, g y) + 1 = ∑ y, f y
  rw [← Finset.sum_erase_add Finset.univ g (Finset.mem_univ x),
    ← Finset.sum_erase_add Finset.univ f (Finset.mem_univ x), hrest]
  omega

end TalagrandThreshold.Selector

end

end OAI