File size: 2,152 Bytes
9dbc64e | 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 | import Mathlib.Analysis.SpecialFunctions.Log.NegMulLog
import Mathlib.Analysis.SpecificLimits.Basic
namespace OAI
open Filter
open scoped Topology
namespace DepthThreeLowerBound
noncomputable def binaryEntropy (x : ℝ) : ℝ :=
-(x * Real.log x + (1 - x) * Real.log (1 - x)) / Real.log 2
@[simp] theorem binaryEntropy_zero : binaryEntropy 0 = 0 := by
simp [binaryEntropy]
@[simp] theorem binaryEntropy_one : binaryEntropy 1 = 0 := by
simp [binaryEntropy]
theorem binaryEntropy_mul_log_two (x : ℝ) :
binaryEntropy x * Real.log 2 =
-(x * Real.log x + (1 - x) * Real.log (1 - x)) := by
exact div_mul_cancel₀ _ (ne_of_gt (Real.log_pos one_lt_two))
theorem binaryEntropy_nonneg {x : ℝ} (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) :
0 ≤ binaryEntropy x := by
apply div_nonneg
· exact neg_nonneg.mpr (add_nonpos
(Real.mul_log_nonpos hx₀ hx₁)
(Real.mul_log_nonpos (sub_nonneg.mpr hx₁) (sub_le_self _ hx₀)))
· exact (Real.log_pos one_lt_two).le
theorem continuous_binaryEntropy : Continuous binaryEntropy := by
unfold binaryEntropy
exact ((Real.continuous_mul_log.add
(Real.continuous_mul_log.comp (continuous_const.sub continuous_id))).neg).div_const _
theorem tendsto_binaryEntropy_reciprocal :
Tendsto (fun r : ℕ => binaryEntropy (1 / (r : ℝ))) atTop (𝓝 0) := by
simpa only [binaryEntropy_zero, Function.comp_def] using
(continuous_binaryEntropy.tendsto 0).comp tendsto_one_div_atTop_nhds_zero_nat
theorem exists_integer_entropy_threshold (F : ℕ) {ε : ℝ} (hε : 0 < ε) :
∃ r : ℕ, 2 ≤ r ∧ (F : ℝ) * binaryEntropy (1 / (r : ℝ)) ≤ ε := by
have hlim : Tendsto (fun r : ℕ => (F : ℝ) * binaryEntropy (1 / (r : ℝ)))
atTop (𝓝 0) := by
simpa only [mul_zero] using
(tendsto_const_nhds.mul tendsto_binaryEntropy_reciprocal :
Tendsto (fun r : ℕ => (F : ℝ) * binaryEntropy (1 / (r : ℝ)))
atTop (𝓝 ((F : ℝ) * 0)))
obtain ⟨N, hN⟩ := eventually_atTop.1 (hlim.eventually (eventually_lt_nhds hε))
exact ⟨max N 2, le_max_right _ _, (hN _ (le_max_left _ _)).le⟩
end DepthThreeLowerBound
end OAI
|