File size: 4,350 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import OAI.Combinatorics.ExpectationThreshold.Basic
import OAI.Combinatorics.ExpectationThreshold.ProbabilityColors
import OAI.Combinatorics.ExpectationThreshold.SelectorTruncationDefinitions
import Mathlib.Data.Fintype.Pi
import Mathlib.Data.Finset.Lattice.Fold

namespace OAI

/-!
# Actual moves and profiles for the simultaneous selector

We retain all colorings of minimum total movement for at least one original
family member. This avoids an arbitrary tie-breaking order; each retained
coloring still has the member-specific minimality used in reconstruction.
-/

noncomputable section

open scoped BigOperators

namespace TalagrandThreshold.Selector

variable {Ξ± : Type*} [Fintype Ξ±] [DecidableEq Ξ±]

/-- A probability mass for each actual member of the family. -/
structure MassFamily (F : Family Ξ±) where
  weight : β†₯F β†’ Ξ± β†’ ℝ
  nonneg : βˆ€ H x, 0 ≀ weight H x
  total : βˆ€ H, βˆ‘ x, weight H x = 1
  supported : βˆ€ H x, x βˆ‰ H.val β†’ weight H x = 0

/-- Colors have zero-based indices; the actual color level is one larger. -/
def prefixSet {s : β„•} (z : Coloring Ξ± s) (i : Fin s) : Finset Ξ± :=
  Finset.univ.filter fun x => (z x).val ≀ i.val

def dscale {s : β„•} (i : Fin s) : ℝ := ((2 : ℝ) ^ (i.val + 1))⁻¹

/-- `Earlier a z` means that the move from `a` to `z` only lowers colors. -/
def Earlier {s : β„•} (a z : Coloring Ξ± s) : Prop := βˆ€ x, z x ≀ a x

def changes {s : β„•} (a z : Coloring Ξ± s) : Finset Ξ± :=
  Finset.univ.filter fun x => z x < a x

def crossings {s : β„•} (a z : Coloring Ξ± s) (i : Fin s) : β„• :=
  (prefixSet z i \ prefixSet a i).card

def movement {s : β„•} (a z : Coloring Ξ± s) : β„• :=
  βˆ‘ x, ((a x).val - (z x).val)

def movedRow {s : β„•} (a z : Coloring Ξ± s) (i : Fin s) : Finset Ξ± :=
  Finset.univ.filter fun x => (z x).val = i.val ∧ (z x).val < (a x).val

/-- The full profile retains both final and original colors. -/
abbrev Profile (s : β„•) := Fin s β†’ Color s β†’ β„•

def profile {s : β„•} (a z : Coloring Ξ± s) : Profile s :=
  fun i h => (Finset.univ.filter fun x =>
    (z x).val = i.val ∧ a x = h ∧ i.val < h.val).card

def rowCount {s : β„•} (n : Profile s) (i : Fin s) : β„• := βˆ‘ h, n i h

def profileSize {s : β„•} (n : Profile s) : β„• := βˆ‘ i, rowCount n i

def profileCrossings {s : β„•} (n : Profile s) (i : Fin s) : β„• :=
  βˆ‘ j : Fin s, βˆ‘ h : Color s,
    if j.val ≀ i.val ∧ i.val < h.val then n j h else 0

def FeasibleFor {F : Family Ξ±} (mu : MassFamily F) {s : β„•}
    (a z : Coloring Ξ± s) (H : β†₯F) : Prop :=
  βˆ€ i : Fin s, βˆƒ Ξ΅ : ℝ,
    Admissible (mu.weight H) (prefixSet z i) (crossings a z i : ℝ) (dscale i) Ξ΅

def Feasible {F : Family Ξ±} (mu : MassFamily F) {s : β„•}
    (a z : Coloring Ξ± s) : Prop :=
  Earlier a z ∧ βˆƒ H : β†₯F, FeasibleFor mu a z H

def BoundedFeasible {F : Family Ξ±} (mu : MassFamily F) {s : β„•}
    (a : Coloring Ξ± s) (Hβ‚€ : β†₯F) (z : Coloring Ξ± s) : Prop :=
  Feasible mu a z ∧ changes a z βŠ† Hβ‚€.val

def IsMinimalMove {F : Family Ξ±} (mu : MassFamily F) {s : β„•}
    (a : Coloring Ξ± s) (Hβ‚€ : β†₯F) (z : Coloring Ξ± s) : Prop :=
  BoundedFeasible mu a Hβ‚€ z ∧
    βˆ€ w, BoundedFeasible mu a Hβ‚€ w β†’ movement a z ≀ movement a w

def Selected {F : Family Ξ±} (mu : MassFamily F) {s : β„•}
    (a z : Coloring Ξ± s) : Prop := βˆƒ Hβ‚€ : β†₯F, IsMinimalMove mu a Hβ‚€ z

def selectedMoves {F : Family Ξ±} (mu : MassFamily F) {s : β„•}
    (a : Coloring Ξ± s) : Finset (Coloring Ξ± s) := by
  classical
  exact Finset.univ.filter (Selected mu a)

/-- An actual bad original coloring, its selected endpoint, and its full profile. -/
def Captured {F : Family Ξ±} (mu : MassFamily F) {s : β„•}
    (a : Coloring Ξ± s) : Prop :=
  βˆƒ H : β†₯F, βˆ€ i : Fin s,
    1 - dscale i ≀ βˆ‘ x ∈ prefixSet a i, mu.weight H x

def Bad {F : Family Ξ±} (mu : MassFamily F) {s : β„•}
    (a : Coloring Ξ± s) : Prop := Β¬ Captured mu a

def groupOriginals {F : Family Ξ±} (mu : MassFamily F) {s : β„•}
    (z : Coloring Ξ± s) (n : Profile s) : Finset (Coloring Ξ± s) := by
  classical
  exact Finset.univ.filter fun a => Bad mu a ∧ Selected mu a z ∧ profile a z = n

def meanColor {F : Family Ξ±} (mu : MassFamily F) {s : β„•}
    (H : β†₯F) (a : Coloring Ξ± s) : ℝ :=
  βˆ‘ x, ((a x).val + 1 : ℝ) * mu.weight H x

end TalagrandThreshold.Selector

end

end OAI