File size: 1,822 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 | import OAI.Combinatorics.ContingencyTables.Dense.DenseScales
import Mathlib.Analysis.SpecialFunctions.Pow.Real
namespace OAI
/-! # Numerical interpolation parameters of the dense bin chain -/
namespace ContingencyTables.GridBoundary
noncomputable def denseInterpolation (d K : β) : β := 1 / (4 * (d : β) * K)
theorem denseInterpolation_bounds (d K q : β) (hd : 14 β€ d) (hK : 1 β€ K) (hq : q β€ d) :
0 < denseInterpolation d K β§ denseInterpolation d K < 1 β§
denseInterpolation d K * K β€ 1 / 4 β§
(q - 1 : β) * (2 * (denseInterpolation d K * K)) β€ (1 / 2 : β) := by
have hdβ : (0 : β) < d := by exact_mod_cast (show 0 < d by omega)
have hdβ : (1 : β) β€ d := by exact_mod_cast (show 1 β€ d by omega)
have hKβ : (0 : β) < K := by exact_mod_cast (show 0 < K by omega)
have hKβ : (1 : β) β€ K := by exact_mod_cast hK
have heq : denseInterpolation d K * K = 1 / (4 * (d : β)) := by
unfold denseInterpolation
field_simp
refine β¨by unfold denseInterpolation; positivity, ?_, ?_, ?_β©
Β· unfold denseInterpolation
apply (div_lt_one (by positivity)).mpr
nlinarith
Β· rw [heq]
apply (div_le_iffβ (by positivity)).mpr
linarith
Β· rw [heq]
have hqd : ((q - 1 : β) : β) β€ d := by exact_mod_cast (Nat.sub_le q 1).trans hq
calc
_ β€ (d : β) * (2 * (1 / (4 * (d : β)))) := by gcongr
_ = 1 / 2 := by field_simp; ring
theorem two_rpow_gain (t : β) (ht : 0 β€ t) : t / 2 β€ (2 : β) ^ t - 1 := by
have hl := Real.one_sub_inv_le_log_of_pos (show (0 : β) < 2 by norm_num)
norm_num at hl
have he := Real.add_one_le_exp (Real.log 2 * t)
rw [Real.rpow_def_of_pos (by norm_num : (0 : β) < 2)]
nlinarith [mul_le_mul_of_nonneg_right hl ht]
end ContingencyTables.GridBoundary
end OAI
|