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
|