Download data/lean/OAI/Combinatorics/ExpectationThreshold/RoundingLowerBound.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.31 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ExpectationThreshold/RoundingLowerBound.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/ExpectationThreshold/RoundingLowerBound.lean
-
curl -L -o RoundingLowerBound.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/ExpectationThreshold/RoundingLowerBound.lean
5.31 kB
| import OAI.Combinatorics.ExpectationThreshold.RoundingMasses | |
| import OAI.Combinatorics.ExpectationThreshold.RoundingColorProducts | |
| import OAI.Combinatorics.ExpectationThreshold.RoundingExpectation | |
| import Mathlib.Tactic.Linarith | |
| import Mathlib.Tactic.NormNum | |
| namespace OAI | |
| /-! | |
| # The deterministic lower bound for rounding | |
| A weighted average at most two places at least half the mass on subsets with | |
| average at most four. On those subsets the quotient-of-powers product is at | |
| least one, yielding the lower bound one quarter for the full product score. | |
| This statement is pointwise in the coloring and needs no independence premise. | |
| -/ | |
| open scoped BigOperators | |
| namespace TalagrandThreshold | |
| /-- Finite weighted Markov inequality in the form used by rounding. -/ | |
| theorem half_mass_of_weighted_average_le {Ξ² : Type*} (T : Finset Ξ²) | |
| (w v : Ξ² β β) (hw : β i β T, 0 β€ w i) (hv : β i β T, 0 β€ v i) | |
| (hmean : (β i β T, w i * v i) β€ 2 * (β i β T, w i)) : | |
| (β i β T, w i) / 2 β€ β i β T.filter (fun i => v i β€ 4), w i := by | |
| classical | |
| have hpoint (i : Ξ²) (hi : i β T) : | |
| 4 * w i β€ w i * v i + 4 * (if v i β€ 4 then w i else 0) := by | |
| by_cases hgood : v i β€ 4 | |
| Β· simp only [ite_eq_left hgood] | |
| have hnonneg := mul_nonneg (hw i hi) (hv i hi) | |
| linarith | |
| Β· simp only [ite_eq_right hgood, mul_zero, add_zero] | |
| calc | |
| 4 * w i = w i * 4 := mul_comm _ _ | |
| _ β€ w i * v i := | |
| mul_le_mul_of_nonneg_left (le_of_lt (lt_of_not_ge hgood)) (hw i hi) | |
| have hsum : 4 * (β i β T, w i) β€ | |
| (β i β T, w i * v i) + 4 * (β i β T.filter (fun i => v i β€ 4), w i) := by | |
| calc | |
| _ = β i β T, 4 * w i := Finset.mul_sum _ _ _ | |
| _ β€ β i β T, (w i * v i + 4 * (if v i β€ 4 then w i else 0)) := | |
| Finset.sum_le_sum hpoint | |
| _ = _ := by | |
| simp only [Finset.sum_add_distrib, Finset.mul_sum, Finset.sum_filter, | |
| mul_ite, mul_zero] | |
| linarith | |
| variable {Ξ± : Type*} [Fintype Ξ±] [DecidableEq Ξ±] | |
| omit [Fintype Ξ±] [DecidableEq Ξ±] in | |
| theorem subsetAverage_nat_nonneg (a : Ξ± β β) (S : Finset Ξ±) : | |
| 0 β€ subsetAverage (fun x => (a x : β)) S := by | |
| unfold subsetAverage | |
| exact div_nonneg (Finset.sum_nonneg (fun x _ => Nat.cast_nonneg (a x))) | |
| (Nat.cast_nonneg S.card) | |
| omit [Fintype Ξ±] [DecidableEq Ξ±] in | |
| theorem sum_le_four_card_of_subsetAverage_le (a : Ξ± β β) {S : Finset Ξ±} | |
| (hS : S.Nonempty) (haverage : subsetAverage (fun x => (a x : β)) S β€ 4) : | |
| (β x β S, a x) β€ 4 * S.card := by | |
| have hcard : (0 : β) < S.card := Nat.cast_pos.mpr (Finset.card_pos.mpr hS) | |
| have hreal : (β x β S, (a x : β)) β€ 4 * (S.card : β) := | |
| (div_le_iffβ hcard).mp haverage | |
| exact_mod_cast hreal | |
| /-- The fractional member mass and its mean color force a product-score lower | |
| bound. Natural colors can include zero; the actual selector uses `val + 1`. -/ | |
| theorem productScore_lower_of_mean (g : Finset Ξ± β β) (H : Finset Ξ±) | |
| (a : Ξ± β β) (hg : β S, 0 β€ g S) (hMH : (1 / 2 : β) β€ memberMass g H) | |
| (hmean : (β x : Ξ±, (a x : β) * roundingMass g H x) β€ 2) : | |
| (1 / 4 : β) β€ productScore g (fun x => (512 : β) ^ 4 / (512 : β) ^ a x) := by | |
| classical | |
| have hMpos : 0 < memberMass g H := by linarith | |
| have hweighted : | |
| (β S β nonemptySubsets H, g S * subsetAverage (fun x => (a x : β)) S) β€ | |
| 2 * memberMass g H := by | |
| apply (div_le_iffβ hMpos).mp | |
| rw [β roundingMass_mean g H (fun x => (a x : β))] | |
| exact hmean | |
| let G := (nonemptySubsets H).filter | |
| (fun S => subsetAverage (fun x => (a x : β)) S β€ 4) | |
| have hgood : memberMass g H / 2 β€ β S β G, g S := by | |
| simpa only [G, memberMass] using | |
| half_mass_of_weighted_average_le (nonemptySubsets H) g | |
| (fun S => subsetAverage (fun x => (a x : β)) S) | |
| (fun S _ => hg S) (fun S _ => subsetAverage_nat_nonneg a S) hweighted | |
| have hsub : G β (Finset.univ.erase β : Finset (Finset Ξ±)) := by | |
| intro S hS | |
| have hS' : S β nonemptySubsets H := (Finset.mem_filter.mp hS).1 | |
| have hSne : S β β := (mem_nonemptySubsets.mp hS').1 | |
| exact Finset.mem_erase.mpr β¨hSne, Finset.mem_univ Sβ© | |
| have hproduct (S : Finset Ξ±) (hS : S β G) : | |
| 1 β€ β x β S, (512 : β) ^ 4 / (512 : β) ^ a x := by | |
| have hS' := Finset.mem_filter.mp hS | |
| have hSne : S β β := (mem_nonemptySubsets.mp hS'.1).1 | |
| exact one_le_colorProduct_of_sum_le S a | |
| (sum_le_four_card_of_subsetAverage_le a | |
| (Finset.nonempty_iff_ne_empty.mpr hSne) hS'.2) | |
| have hY (x : Ξ±) : 0 β€ (512 : β) ^ 4 / (512 : β) ^ a x := | |
| div_nonneg (pow_nonneg (by norm_num) _) (pow_nonneg (by norm_num) _) | |
| calc | |
| (1 / 4 : β) β€ memberMass g H / 2 := by linarith | |
| _ β€ β S β G, g S := hgood | |
| _ β€ β S β G, g S * β x β S, (512 : β) ^ 4 / (512 : β) ^ a x := by | |
| apply Finset.sum_le_sum | |
| intro S hS | |
| simpa only [mul_one] using mul_le_mul_of_nonneg_left (hproduct S hS) (hg S) | |
| _ β€ productScore g (fun x => (512 : β) ^ 4 / (512 : β) ^ a x) := by | |
| unfold productScore | |
| exact Finset.sum_le_sum_of_subset_of_nonneg hsub | |
| (fun S _ _ => mul_nonneg (hg S) (Finset.prod_nonneg (fun x _ => hY x))) | |
| end TalagrandThreshold | |
| end OAI | |