File size: 3,013 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
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