Download data/lean/OAI/Combinatorics/IndependentSets/Geometry/RationalSimplexApproximation.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.01 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/IndependentSets/Geometry/RationalSimplexApproximation.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/IndependentSets/Geometry/RationalSimplexApproximation.lean
-
curl -L -o RationalSimplexApproximation.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/IndependentSets/Geometry/RationalSimplexApproximation.lean
3.01 kB
| import Mathlib | |
| namespace OAI | |
| namespace LargeIndependentSets | |
| open scoped BigOperators | |
| theorem rational_simplex_approximation {J : Type*} [Fintype J] [Nonempty J] | |
| (q : J β β) (hq : (β coordinate, 0 β€ q coordinate) β§ β coordinate, q coordinate = 1) | |
| (Ξ΅ : β) (hΞ΅ : 0 < Ξ΅) : | |
| β p : J β β, ((β coordinate, 0 β€ p coordinate) β§ β coordinate, p coordinate = 1) β§ | |
| β b : J β β, (β j, 0 β€ b j β§ b j β€ 1) β | |
| β j, (p j : β) * b j β€ β j, q j * b j + Ξ΅ := by | |
| classical | |
| let t := Ξ΅ / ((Fintype.card J : β) + 1) | |
| have ht : 0 < t := by dsimp [t]; positivity | |
| have ha (j : J) : β a : β, 0 β€ a β§ (a : β) β€ q j β§ q j - a < t := by | |
| by_cases hz : q j = 0 | |
| Β· exact β¨0, le_rfl, by simp [hz], by simpa [hz] using htβ© | |
| Β· have hp : 0 < q j := lt_of_le_of_ne (hq.1 j) (Ne.symm hz) | |
| obtain β¨a, hal, harβ© := exists_rat_btwn (show max 0 (q j - t) < q j from | |
| max_lt hp (sub_lt_self _ ht)) | |
| refine β¨a, ?_, har.le, ?_β© | |
| Β· exact_mod_cast (le_max_left 0 (q j - t)).trans hal.le | |
| Β· have h := (le_max_right 0 (q j - t)).trans_lt hal | |
| linarith | |
| choose a ha0 haq hae using ha | |
| have hsum : β j, (a j : β) β€ 1 := | |
| (Finset.sum_le_sum (fun j _ => haq j)).trans_eq hq.2 | |
| have hsumQ : β j, a j β€ 1 := by exact_mod_cast hsum | |
| let iβ : J := Classical.arbitrary J | |
| let p : J β β := fun j => a j + if j = iβ then 1 - β i, a i else 0 | |
| have hp : (β coordinate, 0 β€ p coordinate) β§ β coordinate, p coordinate = 1 := by | |
| constructor | |
| Β· intro j | |
| apply add_nonneg (ha0 j) | |
| split_ifs <;> linarith | |
| Β· simp [p, Finset.sum_add_distrib] | |
| have hdef : 1 - β j, (a j : β) < Ξ΅ := by | |
| have he := Finset.sum_le_sum (s := Finset.univ) (fun j _ => (hae j).le) | |
| rw [Finset.sum_sub_distrib, hq.2, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] at he | |
| have hden : (0 : β) < (Fintype.card J : β) + 1 := by positivity | |
| have hid : t * ((Fintype.card J : β) + 1) = Ξ΅ := by | |
| exact div_mul_cancelβ Ξ΅ (ne_of_gt hden) | |
| have hlt : (Fintype.card J : β) * t < Ξ΅ := by nlinarith | |
| exact he.trans_lt hlt | |
| refine β¨p, hp, ?_β© | |
| intro b hb | |
| have hmain : β j, (a j : β) * b j β€ β j, q j * b j := | |
| Finset.sum_le_sum (fun j _ => mul_le_mul_of_nonneg_right (haq j) (hb j).1) | |
| have hformula : β j, (p j : β) * b j = | |
| (β j, (a j : β) * b j) + (1 - β j, (a j : β)) * b iβ := by | |
| have he (j : J) : (p j : β) * b j = (a j : β) * b j + | |
| if j = iβ then (1 - β i, (a i : β)) * b iβ else 0 := by | |
| by_cases h : j = iβ | |
| Β· subst j; simp only [p, ite_true, Rat.cast_add, Rat.cast_sub, | |
| Rat.cast_one, Rat.cast_sum]; ring | |
| Β· simp [p, h] | |
| simp_rw [he] | |
| rw [Finset.sum_add_distrib] | |
| simp | |
| rw [hformula] | |
| have hextra := mul_le_mul_of_nonneg_left (hb iβ).2 (sub_nonneg.mpr hsum) | |
| simp only [mul_one] at hextra | |
| linarith | |
| end LargeIndependentSets | |
| end OAI | |