Download data/lean/OAI/Combinatorics/ExpectationThreshold/SelectorGroupCost.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.88 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ExpectationThreshold/SelectorGroupCost.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/ExpectationThreshold/SelectorGroupCost.lean
-
curl -L -o SelectorGroupCost.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ExpectationThreshold/SelectorGroupCost.lean
5.88 kB
| import OAI.Combinatorics.ExpectationThreshold.SelectorCountingEncodingBound | |
| import OAI.Combinatorics.ExpectationThreshold.SelectorCommonWitness | |
| import OAI.Combinatorics.ExpectationThreshold.SelectorProfile | |
| import OAI.Combinatorics.ExpectationThreshold.SelectorEntropy | |
| import OAI.Combinatorics.ExpectationThreshold.ProbabilityLikelihood | |
| import OAI.Combinatorics.ExpectationThreshold.ColorArithmetic | |
| import Mathlib.Tactic.Positivity | |
| namespace OAI | |
| /-! | |
| # The actual contribution of one full selector profile | |
| The common heavy sets are obtained separately for each occurring profile. | |
| The entropy estimate removes their sizes before profiles are summed, so no | |
| uniform choice of heavy sets across distinct profiles is required. | |
| -/ | |
| noncomputable section | |
| open scoped BigOperators | |
| namespace TalagrandThreshold.Selector | |
| variable {Ξ± : Type*} [Fintype Ξ±] [DecidableEq Ξ±] | |
| /-- A finite group with a fixed final coloring and full profile has the | |
| claimed weighted contribution whenever its rows fit the actual heavy sets. -/ | |
| theorem profile_group_cost_le (p : β) (s : β) (hp : 0 < p) | |
| (hs : p * scaleSum s β€ 1 / 2) | |
| (G : Finset (Coloring Ξ± s)) (z : Coloring Ξ± s) (n : Profile s) | |
| (R : Fin s β Finset Ξ±) | |
| (hEarlier : β a β G, Earlier a z) | |
| (hprofile : β a β G, profile a z = n) | |
| (hrows : β a β G, β i, movedRow a z i β R i) | |
| (hR : β i, (R i).card β€ 2 ^ (i.val + 1) * profileSize n) : | |
| (β a β G, colorMass p s a * p ^ (changes a z).card) β€ | |
| colorMass p s z * | |
| (β i : Fin s, (3 / (64 : β) ^ (i.val + 1)) ^ (rowCount n i)) * | |
| (β i : Fin s, ((wordCount (rowCount n i) (n i) : β) * | |
| β h : Color s, colorProb p s h ^ (n i h))) := by | |
| classical | |
| let C : β := β i : Fin s, ((R i).card.choose (rowCount n i) : β) | |
| let W : β := β i : Fin s, (wordCount (rowCount n i) (n i) : β) | |
| let L : β := β i : Fin s, (p / colorProb p s i.castSucc) ^ (rowCount n i) | |
| let Q : β := β i : Fin s, β h : Color s, colorProb p s h ^ (n i h) | |
| let E : β := β i : Fin s, (3 * 4 ^ (i.val + 1) : β) ^ (rowCount n i) | |
| let K : β := β i : Fin s, (3 / (64 : β) ^ (i.val + 1)) ^ (rowCount n i) | |
| have hW : 0 β€ W := Finset.prod_nonneg fun i _ => Nat.cast_nonneg _ | |
| have hL : 0 β€ L := Finset.prod_nonneg fun i _ => | |
| pow_nonneg (div_nonneg hp.le (colorProb_nonneg p s hp hs _)) _ | |
| have hQ : 0 β€ Q := Finset.prod_nonneg fun i _ => | |
| Finset.prod_nonneg fun h _ => pow_nonneg (colorProb_nonneg p s hp hs h) _ | |
| have hP : 0 β€ colorMass p s z := colorMass_nonneg p s hp hs z | |
| have hcard : (G.card : β) β€ C * W := by | |
| have h := card_le_profile_encoding G z n R hEarlier hprofile hrows | |
| have hcast : (G.card : β) β€ | |
| β i : Fin s, ((R i).card.choose (rowCount n i) : β) * | |
| (wordCount (rowCount n i) (n i) : β) := by | |
| exact_mod_cast h | |
| simpa only [Finset.prod_mul_distrib] using hcast | |
| have hentropy : C β€ E := | |
| selector_entropy_bound s (fun i => (R i).card) (rowCount n) hR | |
| have hnormalize : E * L = K := by | |
| dsimp [E, L, K] | |
| rw [β Finset.prod_mul_distrib] | |
| apply Finset.prod_congr rfl | |
| intro i _ | |
| exact profile_coefficient_pow_eq hp s i (rowCount n i) | |
| have hterm (a : Coloring Ξ± s) (ha : a β G) : | |
| colorMass p s a * p ^ (changes a z).card = colorMass p s z * L * Q := by | |
| have h := colorMass_profile_likelihood p s hp hs a z (hEarlier a ha) | |
| rw [hprofile a ha] at h | |
| have hsize : (changes a z).card = profileSize n := by | |
| rw [β profileSize_profile, hprofile a ha] | |
| rw [hsize, mul_comm] | |
| simpa only [Finset.prod_mul_distrib, mul_assoc] using h | |
| calc | |
| (β a β G, colorMass p s a * p ^ (changes a z).card) = | |
| (G.card : β) * (colorMass p s z * L * Q) := by | |
| simp only [Finset.sum_congr rfl hterm, Finset.sum_const, nsmul_eq_mul] | |
| _ β€ (C * W) * (colorMass p s z * L * Q) := | |
| mul_le_mul_of_nonneg_right hcard (mul_nonneg (mul_nonneg hP hL) hQ) | |
| _ = C * (W * (colorMass p s z * L * Q)) := by ring | |
| _ β€ E * (W * (colorMass p s z * L * Q)) := | |
| mul_le_mul_of_nonneg_right hentropy | |
| (mul_nonneg hW (mul_nonneg (mul_nonneg hP hL) hQ)) | |
| _ = colorMass p s z * (E * L) * (W * Q) := by ring | |
| _ = colorMass p s z * K * (W * Q) := by rw [hnormalize] | |
| _ = _ := by | |
| dsimp [K, W, Q] | |
| rw [β Finset.prod_mul_distrib] | |
| /-- The contribution of an actual selected profile. All reconstruction and | |
| counting premises are discharged by the concrete selector construction. -/ | |
| theorem group_cost_le {F : Family Ξ±} (mu : MassFamily F) | |
| (p : β) (s : β) (hp : 0 < p) (hs : p * scaleSum s β€ 1 / 2) | |
| (z : Coloring Ξ± s) (n : Profile s) : | |
| (β a β groupOriginals mu z n, colorMass p s a * p ^ (changes a z).card) β€ | |
| colorMass p s z * | |
| (β i : Fin s, (3 / (64 : β) ^ (i.val + 1)) ^ (rowCount n i)) * | |
| (β i : Fin s, ((wordCount (rowCount n i) (n i) : β) * | |
| β h : Color s, colorProb p s h ^ (n i h))) := by | |
| classical | |
| by_cases hne : (groupOriginals mu z n).Nonempty | |
| Β· obtain β¨R, hR, hrowsβ© := exists_common_heavy_sets mu z n hne | |
| apply profile_group_cost_le p s hp hs (groupOriginals mu z n) z n R | |
| Β· intro a ha | |
| have h := (Finset.mem_filter.mp ha).2 | |
| obtain β¨Hβ, hminβ© := h.2.1 | |
| exact hmin.1.1.1 | |
| Β· intro a ha | |
| exact (Finset.mem_filter.mp ha).2.2.2 | |
| Β· exact hrows | |
| Β· exact hR | |
| Β· have hempty : groupOriginals mu z n = β := Finset.not_nonempty_iff_eq_empty.mp hne | |
| rw [hempty, Finset.sum_empty] | |
| exact mul_nonneg | |
| (mul_nonneg (colorMass_nonneg p s hp hs z) | |
| (Finset.prod_nonneg fun i _ => pow_nonneg (by positivity) _)) | |
| (Finset.prod_nonneg fun i _ => mul_nonneg (Nat.cast_nonneg _) | |
| (Finset.prod_nonneg fun h _ => pow_nonneg (colorProb_nonneg p s hp hs h) _)) | |
| end TalagrandThreshold.Selector | |
| end | |
| end OAI | |