Documentation

Epidemics.CobraCoverNumerics

Real estimates for the BIPS phases (EPI-4) #

Scalar inequalities used by Lemmas 2 to 4: the logarithm bound on [0, 1/2], the comparisons that turn one round of relative growth into a uniform multiplicative factor, and the end-phase tail at ⌈8 log n / c⌉₊.

theorem Epidemics.hasDerivAt_logGap (t : ℝ) (ht : -1 < t) :
HasDerivAt (fun (s : ℝ) => s - s ^ 2 / 3 - Real.log (1 + s)) (1 - 2 * t / 3 - (1 + t)⁻¹) t

Derivative of t - t²/3 - log(1 + t).

theorem Epidemics.log_one_add_le_sub_sq_div_three {x : ℝ} (hx0 : 0 ≤ x) (hx12 : x ≤ 1 / 2) :
Real.log (1 + x) ≤ x - x ^ 2 / 3

log(1 + x) ≤ x - x²/3 for 0 ≤ x ≤ 1/2. The paper uses the weaker log(1 + x) ≤ x - x²/2 + x³/3; the quadratic gap is enough for the constant 13.

theorem Epidemics.small_phase_exponent {m T c x φ : ℝ} {n : ℕ} {C : ℝ} (hm : 0 ≤ m) (hT0 : 0 ≤ T) (hc : 0 < c) (hc1 : c ≤ 1) (hx : x = c / 2) (hφ : φ = Real.log (1 + x)) (hC : 0 ≤ C) (hn : 1 ≤ n) (hbound : 13 * m / c + 24 * C * Real.log ↑n / c ^ 2 ≤ T) :
φ * m + T * (φ - x) ≤ -C * Real.log ↑n

The exponent of Lemma 2. With x = c/2 and φ = log(1 + x), the threshold T ≥ 13 m/c + 24 C log n/c² gives m φ + T (φ - x) ≤ -C log n for C ≥ 0.

theorem Epidemics.log_one_add_ge_div {z : ℝ} (hz : 0 ≤ z) :
z / (1 + z) ≤ Real.log (1 + z)

log(1 + z) ≥ z/(1 + z) for z ≥ 0, from log t ≤ t - 1 at t = 1/(1 + z).

theorem Epidemics.one_step_factor_23 {c : ℝ} (hc0 : 0 ≤ c) (hc1 : c ≤ 1) :
1 + c / 23 ≤ (1 - c / 20) * (1 + c / 10)

(1 - c/20)(1 + c/10) ≥ 1 + c/23 for 0 ≤ c ≤ 1.

End phase (9n/10 to the whole graph) #

Scalar bounds for Lemma 4: the size gap n ≥ 32769, the one-round stay factor, and the contracted tail at ⌈8 log n / c⌉₊.

theorem Epidemics.dyadic_end_gap (k : ℕ) (hk1 : 1 ≤ k) (hk14 : k ≤ 14) :
9 / 10 * 2 ^ (k + 1) < 4000 * ↑k * 0.6931471803
theorem Epidemics.nine_tenth_lt_log {n : ℕ} (hn2 : 2 ≤ n) (hn : n ≤ 32768) :
9 / 10 * ↑n < 4000 * Real.log ↑n

On 2 ≤ n ≤ 32768, (9/10) n < 4000 log n, so the end-phase hypothesis forces n larger.

theorem Epidemics.end_n_ge {c : ℝ} {n : ℕ} (hc0 : 0 < c) (hc1 : c ≤ 1) (hn : 2 ≤ n) (h : 4000 * Real.log ↑n / c ^ 2 ≤ 9 / 10 * ↑n) :
32769 ≤ n

The hypothesis 4000 log n/c² ≤ (9/10) n forces n ≥ 32769 when 2 ≤ n and 0 < c ≤ 1.

theorem Epidemics.stay_factor {c n : ℝ} (hc0 : 0 ≤ c) (hc1 : c ≤ 1) (hn : 32769 ≤ n) :
1 ≤ (1 - 8 / 125 * c) * (1 + c * (1 / 10 - 1 / n))

(1 - (8/125) c) (1 + c (1/10 - 1/n)) ≥ 1 for 0 ≤ c ≤ 1 and n ≥ 32769.

theorem Epidemics.eps_le_eight {c s logn : ℝ} (hc0 : 0 < c) (hlog : 0 < logn) (hs : 4000 * logn / c ^ 2 ≤ s) :
√(16 * logn / s) ≤ 8 / 125 * c

√(16 log n / s) ≤ (8/125) c once s ≥ 4000 log n / c².

theorem Epidemics.eight_log_le {c : ℝ} {n : ℕ} (hc0 : 0 < c) (hn : 2 ≤ n) (h : 4000 * Real.log ↑n / c ^ 2 ≤ 9 / 10 * ↑n) :
8 * Real.log ↑n / c ≤ 3 / 25 * ↑n

8 log n / c ≤ (3/25) n under the end-phase size hypothesis.

theorem Epidemics.end_tail_small {c : ℝ} {n T : ℕ} (hc0 : 0 < c) (hc1 : c ≤ 1) (hn : 2 ≤ n) (hgap : 4000 * Real.log ↑n / c ^ 2 ≤ 9 / 10 * ↑n) (hT : T = ⌈8 * Real.log ↑n / c⌉₊) :
(1 - 9 / 10 * c) ^ T * (↑n / 10) + ↑T ^ 2 * ↑n ^ (-7) ≤ 1 / ↑n ^ 5

At T = ⌈8 log n / c⌉₊, the end-phase tail is at most n^{-5}.

Phase lengths for the infection time #

128 √(log n / n) ≤ 1 already forces n ≥ 16385, which is the room used to turn 4000 log n / y² ≤ n/4 into the concrete thresholds of Lemmas 2 to 4.

theorem Epidemics.dyadic_gap_card (k : ℕ) (hk1 : 1 ≤ k) (hk14 : k ≤ 14) :
2 ^ (k + 1) < 16384 * ↑k * 0.6931471803

For 1 ≤ k ≤ 14, 2^{k+1} < 16384 k * 0.6931471803.

theorem Epidemics.gap_card_ge {n : ℕ} (hn : 2 ≤ n) (h : Real.log ↑n ≤ ↑n / 16384) :
16385 ≤ n

log n ≤ n/16384 and n ≥ 2 force n ≥ 16385.