File size: 8,498 Bytes
f61e547
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
import OAI.Probability.FreeIsing.Estimates.EndpointSums

namespace OAI

noncomputable section

namespace Problem367

theorem endpoint_two_term_le {A B u v : ℝ} (hu : 0 ≤ u) (hv : 0 ≤ v) :
    A * u + B * v ≤ max A B * (u + v) := by
  calc
    A * u + B * v ≤ max A B * u + max A B * v :=
      add_le_add (mul_le_mul_of_nonneg_right (le_max_left _ _) hu)
        (mul_le_mul_of_nonneg_right (le_max_right _ _) hv)
    _ = _ := by ring

theorem cutoff_square_le {R K x y : ℝ} (hR0 : 0 ≤ R) (hK : 0 ≤ K)
    (hx : 0 ≤ x) (hy : 0 ≤ y) (hR : R ≤ K * (x + y)) :
    R ^ 2 ≤ 2 * K ^ 2 * (x ^ 2 + y ^ 2) := by
  calc
    R ^ 2 ≤ (K * (x + y)) ^ 2 :=
      (sq_le_sq₀ hR0 (mul_nonneg hK (add_nonneg hx hy))).mpr hR
    _ = K ^ 2 * (x + y) ^ 2 := by ring
    _ ≤ K ^ 2 * (2 * (x ^ 2 + y ^ 2)) := by
      apply mul_le_mul_of_nonneg_left _ (sq_nonneg K)
      nlinarith [sq_nonneg (x - y)]
    _ = _ := by ring

theorem add_mul_sqrt_add_le {x y : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) :
    (x + y) * Real.sqrt (x + y) ≤ 4 * (x * Real.sqrt x + y * Real.sqrt y) := by
  have haux : ∀ u v : ℝ, 0 ≤ u → 0 ≤ v → u ≤ v →
      (u + v) * Real.sqrt (u + v) ≤ 4 * (u * Real.sqrt u + v * Real.sqrt v) := by
    intro u v hu hv huv
    have hsum : u + v ≤ 2 * v := by linarith
    have hsqrt : Real.sqrt (u + v) ≤ 2 * Real.sqrt v := by
      apply Real.sqrt_le_iff.mpr
      constructor
      · positivity
      · rw [mul_pow, Real.sq_sqrt hv]
        nlinarith
    calc
      (u + v) * Real.sqrt (u + v) ≤ (2 * v) * (2 * Real.sqrt v) :=
        mul_le_mul hsum hsqrt (Real.sqrt_nonneg _) (by positivity)
      _ ≤ 4 * (u * Real.sqrt u + v * Real.sqrt v) := by
        nlinarith [mul_nonneg hu (Real.sqrt_nonneg u)]
  rcases le_total x y with h | h
  · exact haux x y hx hy h
  · simpa [add_comm] using haux y x hy hx h

theorem cutoff_mul_sqrt_le {R K x y : ℝ} (_hR0 : 0 ≤ R) (hK : 0 ≤ K)
    (hx : 0 ≤ x) (hy : 0 ≤ y) (hR : R ≤ K * (x + y)) :
    R * Real.sqrt R ≤
      4 * K * Real.sqrt K * (x * Real.sqrt x + y * Real.sqrt y) := by
  calc
    R * Real.sqrt R ≤ (K * (x + y)) * Real.sqrt (K * (x + y)) :=
      mul_le_mul hR (Real.sqrt_le_sqrt hR) (Real.sqrt_nonneg _) (by positivity)
    _ = (K * Real.sqrt K) * ((x + y) * Real.sqrt (x + y)) := by
      rw [Real.sqrt_mul hK]
      ring
    _ ≤ (K * Real.sqrt K) * (4 * (x * Real.sqrt x + y * Real.sqrt y)) :=
      mul_le_mul_of_nonneg_left (add_mul_sqrt_add_le hx hy) (by positivity)
    _ = _ := by ring

theorem quadratic_endpoint_scale {F A B E S V R K x y : ℝ}
    (hA : 0 ≤ A) (hB : 0 ≤ B) (hS : 0 ≤ S)
    (hR0 : 0 ≤ R) (hK : 0 ≤ K) (hx : 0 ≤ x) (hy : 0 ≤ y)
    (hR : R ≤ K * (x + y))
    (hF : F ≤ A * S * R ^ 2 + B * S * x ^ 2 + E * V ^ 2) :
    F ≤ max (2 * A * K ^ 2 + B) E *
      (S * (x ^ 2 + y ^ 2) + V ^ 2) := by
  have hfirst := mul_le_mul_of_nonneg_left (cutoff_square_le hR0 hK hx hy hR)
    (mul_nonneg hA hS)
  have hsecond : B * S * x ^ 2 ≤ B * S * (x ^ 2 + y ^ 2) := by
    apply mul_le_mul_of_nonneg_left _ (mul_nonneg hB hS)
    nlinarith [sq_nonneg y]
  calc
    F ≤ A * S * (2 * K ^ 2 * (x ^ 2 + y ^ 2)) +
        B * S * (x ^ 2 + y ^ 2) + E * V ^ 2 :=
      hF.trans (add_le_add (add_le_add hfirst hsecond) le_rfl)
    _ = (2 * A * K ^ 2 + B) * (S * (x ^ 2 + y ^ 2)) + E * V ^ 2 := by ring
    _ ≤ _ := endpoint_two_term_le (by positivity) (sq_nonneg V)

theorem linear_endpoint_scale {F A B E V R K x y : ℝ}
    (hA : 0 ≤ A) (hB : 0 ≤ B) (hV : 0 ≤ V)
    (hx : 0 ≤ x) (hy : 0 ≤ y) (hR : R ≤ K * (x + y))
    (hF : F ≤ A * V * R + B * V * x + E * V ^ 2) :
    F ≤ max (A * K + B) E * (V * (x + y) + V ^ 2) := by
  have hfirst := mul_le_mul_of_nonneg_left hR (mul_nonneg hA hV)
  have hsecond : B * V * x ≤ B * V * (x + y) := by
    apply mul_le_mul_of_nonneg_left _ (mul_nonneg hB hV)
    linarith
  calc
    F ≤ A * V * (K * (x + y)) + B * V * (x + y) + E * V ^ 2 :=
      hF.trans (add_le_add (add_le_add hfirst hsecond) le_rfl)
    _ = (A * K + B) * (V * (x + y)) + E * V ^ 2 := by ring
    _ ≤ _ := endpoint_two_term_le (by positivity) (sq_nonneg V)

theorem sqrt_endpoint_scale {F A B E S V R K x y : ℝ}
    (hA : 0 ≤ A) (hB : 0 ≤ B) (hV : 0 ≤ V)
    (hR0 : 0 ≤ R) (hK : 0 ≤ K) (hx : 0 ≤ x) (hy : 0 ≤ y)
    (hR : R ≤ K * (x + y))
    (hF : F ≤ A * Real.sqrt S * (R * Real.sqrt R) +
      B * Real.sqrt S * (x * Real.sqrt x) + E * V) :
    F ≤ max (4 * A * K * Real.sqrt K + B) E *
      (Real.sqrt S * (x * Real.sqrt x + y * Real.sqrt y) + V) := by
  have hfirst := mul_le_mul_of_nonneg_left (cutoff_mul_sqrt_le hR0 hK hx hy hR)
    (mul_nonneg hA (Real.sqrt_nonneg S))
  have hsecond : B * Real.sqrt S * (x * Real.sqrt x) ≤
      B * Real.sqrt S * (x * Real.sqrt x + y * Real.sqrt y) := by
    apply mul_le_mul_of_nonneg_left _ (mul_nonneg hB (Real.sqrt_nonneg S))
    nlinarith [mul_nonneg hy (Real.sqrt_nonneg y)]
  calc
    F ≤ A * Real.sqrt S *
        (4 * K * Real.sqrt K * (x * Real.sqrt x + y * Real.sqrt y)) +
        B * Real.sqrt S * (x * Real.sqrt x + y * Real.sqrt y) + E * V :=
      hF.trans (add_le_add (add_le_add hfirst hsecond) le_rfl)
    _ = (4 * A * K * Real.sqrt K + B) *
        (Real.sqrt S * (x * Real.sqrt x + y * Real.sqrt y)) + E * V := by ring
    _ ≤ _ := endpoint_two_term_le (by positivity) hV

theorem tsum_scaled_path_attenuation_le (k : ℕ) {c ω : ℝ}
    (hc : 0 < c) (hω : 0 < ω) (hω1 : ω ≤ 1) :
    (∑' n : ℕ, (n : ℝ) ^ k * Real.exp (-(c * ω) * n)) ≤
      (k.factorial : ℝ) * (2 / min c 1) ^ (k + 1) * (ω⁻¹) ^ (k + 1) := by
  have hm : 0 < min c 1 := lt_min hc zero_lt_one
  have hrate : 0 < min c 1 * ω := mul_pos hm hω
  have hrate1 : min c 1 * ω ≤ 1 :=
    (mul_le_mul_of_nonneg_right (min_le_right c 1) hω.le).trans (by simpa using hω1)
  calc
    _ ≤ ∑' n : ℕ, (n : ℝ) ^ k * Real.exp (-(min c 1 * ω) * n) := by
      apply Summable.tsum_le_tsum _ (summable_path_attenuation k (mul_pos hc hω))
        (summable_path_attenuation k hrate)
      intro n
      apply mul_le_mul_of_nonneg_left _ (by positivity)
      apply Real.exp_le_exp.mpr
      have h := mul_le_mul_of_nonneg_right (min_le_left c 1) hω.le
      have := mul_le_mul_of_nonneg_right h (Nat.cast_nonneg (α := ℝ) n)
      linarith
    _ ≤ (k.factorial : ℝ) * (2 / (min c 1 * ω)) ^ (k + 1) :=
      tsum_path_attenuation_small_le k hrate hrate1
    _ = _ := by simp [div_eq_mul_inv, mul_inv_rev, mul_pow, mul_assoc, mul_comm, mul_left_comm]

theorem tsum_scaled_sqrt_path_attenuation_le {c ω : ℝ}
    (hc : 0 < c) (hω : 0 < ω) (hω1 : ω ≤ 1) :
    (∑' n : ℕ, Real.sqrt n * Real.exp (-(c * ω) * n)) ≤
      (3 / (min c 1 * Real.sqrt (min c 1))) * (ω⁻¹ * Real.sqrt (ω⁻¹)) := by
  have hm : 0 < min c 1 := lt_min hc zero_lt_one
  have hrate : 0 < min c 1 * ω := mul_pos hm hω
  have hrate1 : min c 1 * ω ≤ 1 :=
    (mul_le_mul_of_nonneg_right (min_le_right c 1) hω.le).trans (by simpa using hω1)
  calc
    _ ≤ ∑' n : ℕ, Real.sqrt n * Real.exp (-(min c 1 * ω) * n) := by
      apply Summable.tsum_le_tsum _ (summable_sqrt_path_attenuation (mul_pos hc hω))
        (summable_sqrt_path_attenuation hrate)
      intro n
      apply mul_le_mul_of_nonneg_left _ (Real.sqrt_nonneg _)
      apply Real.exp_le_exp.mpr
      have h := mul_le_mul_of_nonneg_right (min_le_left c 1) hω.le
      have := mul_le_mul_of_nonneg_right h (Nat.cast_nonneg (α := ℝ) n)
      linarith
    _ ≤ 3 / ((min c 1 * ω) * Real.sqrt (min c 1 * ω)) :=
      tsum_sqrt_path_attenuation_le hrate hrate1
    _ = _ := by
      rw [Real.sqrt_mul hm.le, Real.sqrt_inv]
      field_simp

theorem pathCutoff_square_le {C ω I : ℝ}
    (hC : 0 ≤ C) (hω : 0 < ω) (hω1 : ω ≤ 1) (hI : 1 ≤ I) :
    (pathCutoff C ω I : ℝ) ^ 2 ≤
      2 * (C + 1) ^ 2 * ((ω⁻¹) ^ 2 + (Real.log I) ^ 2) := by
  exact cutoff_square_le (Nat.cast_nonneg _) (by positivity) (by positivity)
    (Real.log_nonneg hI) (pathCutoff_le hC hω hω1 hI)

theorem pathCutoff_mul_sqrt_le {C ω I : ℝ}
    (hC : 0 ≤ C) (hω : 0 < ω) (hω1 : ω ≤ 1) (hI : 1 ≤ I) :
    (pathCutoff C ω I : ℝ) * Real.sqrt (pathCutoff C ω I) ≤
      4 * (C + 1) * Real.sqrt (C + 1) *
        (ω⁻¹ * Real.sqrt (ω⁻¹) + Real.log I * Real.sqrt (Real.log I)) := by
  exact cutoff_mul_sqrt_le (Nat.cast_nonneg _) (by positivity) (by positivity)
    (Real.log_nonneg hI) (pathCutoff_le hC hω hω1 hI)

end Problem367

end

end OAI