File size: 5,053 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 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 | import OAI.Combinatorics.GraphThreshold.Thresholds
import Mathlib.Data.Nat.Choose.Bounds
import Mathlib.Analysis.SpecialFunctions.Log.Base
namespace OAI
/-!
# Explicit constants in the threshold conclusion
The tree argument first gives a logarithm of an edge capacity. These elementary
bounds turn that quantity into the two constants stated for graphs.
-/
noncomputable section
namespace LeanBlast.SecondKahnKalai
theorem logTwo_eq_logb (x : β) : logTwo x = Real.logb 2 x := rfl
theorem logTwo_nonneg {x : β} (hx : 1 β€ x) : 0 β€ logTwo x := by
unfold logTwo
exact div_nonneg (Real.log_nonneg hx) (Real.log_pos (by norm_num)).le
theorem logTwo_mono {x y : β} (hx : 0 < x) (hxy : x β€ y) :
logTwo x β€ logTwo y := by
unfold logTwo
exact div_le_div_of_nonneg_right (Real.log_le_log hx hxy)
(Real.log_pos (by norm_num)).le
theorem edgeCount_le_sq {V : Type*} [Fintype V]
(n : β) (H : SimpleGraph V) (hcard : Fintype.card V β€ n) :
edgeCount H β€ n ^ 2 := by
classical
rw [edgeCount_eq_card_edgeFinset]
calc
H.edgeFinset.card β€ (Fintype.card V).choose 2 :=
SimpleGraph.card_edgeFinset_le_card_choose_two
_ β€ (Fintype.card V) ^ 2 := Nat.choose_le_pow _ _
_ β€ n ^ 2 := Nat.pow_le_pow_left hcard 2
theorem one_add_logTwo_le_three_logTwo (n h : β)
(hn : 2 β€ n) (hh : 1 β€ h) (hhn : h β€ n ^ 2) :
1 + logTwo (h : β) β€ 3 * logTwo (n : β) := by
have hn' : (2 : β) β€ n := by exact_mod_cast hn
have hh' : (1 : β) β€ h := by exact_mod_cast hh
have hhn' : (h : β) β€ (n : β) ^ 2 := by exact_mod_cast hhn
have hlog2 : 0 < Real.log 2 := Real.log_pos (by norm_num)
have hlogn : Real.log 2 β€ Real.log (n : β) :=
Real.log_le_log (by norm_num) hn'
have hone : 1 β€ logTwo (n : β) := by
unfold logTwo
exact (le_div_iffβ hlog2).mpr (by simpa using hlogn)
have hlogh : Real.log (h : β) β€ 2 * Real.log (n : β) := by
calc
Real.log (h : β) β€ Real.log ((n : β) ^ 2) :=
Real.log_le_log (by linarith) hhn'
_ = 2 * Real.log (n : β) := by rw [Real.log_pow]; norm_num
have htwo : logTwo (h : β) β€ 2 * logTwo (n : β) := by
unfold logTwo
simpa only [mul_div_assoc] using
div_le_div_of_nonneg_right hlogh hlog2.le
linarith
theorem graph_one_add_logTwo_le_three_logTwo {V : Type*} [Fintype V]
(n : β) (H : SimpleGraph V) (hn : 2 β€ n)
(hcard : Fintype.card V β€ n) (hedge : 1 β€ edgeCount H) :
1 + logTwo (edgeCount H : β) β€ 3 * logTwo (n : β) :=
one_add_logTwo_le_three_logTwo n (edgeCount H) hn hedge
(edgeCount_le_sq n H hcard)
theorem graphThresholdParameter_mem_unitInterval (q : β) (h : β)
(hq : 0 β€ q) (hh : 1 β€ h) :
min 1 (2048 * Real.exp 50 * q * (1 + logTwo (h : β))) β Set.Icc 0 1 := by
have hlog : 0 β€ logTwo (h : β) := logTwo_nonneg (by exact_mod_cast hh)
constructor
Β· exact le_min (by norm_num) (mul_nonneg
(mul_nonneg (mul_nonneg (by norm_num) (Real.exp_pos 50).le) hq) (by linarith))
Β· exact min_le_left _ _
theorem treeSamplingParameter_mem_unitInterval (q : β) (m : β)
(hq : 0 β€ q) (hm : 0 < m) :
min 1 (16 * Real.exp 50 * (128 * q) *
(1 + Real.logb 2 (m : β))) β Set.Icc 0 1 := by
have hfactor : 16 * Real.exp 50 * (128 * q) = 2048 * Real.exp 50 * q := by ring
rw [hfactor, β logTwo_eq_logb]
exact graphThresholdParameter_mem_unitInterval q m hq hm
theorem treeSamplingParameter_le_graphParameter (q : β) (m h : β)
(hq : 0 β€ q) (hm : 0 < m) (hmh : m β€ h) :
min 1 (16 * Real.exp 50 * (128 * q) * (1 + Real.logb 2 (m : β))) β€
min 1 (2048 * Real.exp 50 * q * (1 + logTwo (h : β))) := by
apply min_le_min_left
have hlog : logTwo (m : β) β€ logTwo (h : β) :=
logTwo_mono (by exact_mod_cast hm) (by exact_mod_cast hmh)
calc
16 * Real.exp 50 * (128 * q) * (1 + Real.logb 2 (m : β)) =
2048 * Real.exp 50 * q * (1 + logTwo (m : β)) := by
rw [logTwo_eq_logb]
ring
_ β€ 2048 * Real.exp 50 * q * (1 + logTwo (h : β)) :=
mul_le_mul_of_nonneg_left (by linarith)
(mul_nonneg (mul_nonneg (by norm_num) (Real.exp_pos 50).le) hq)
theorem graphThresholdParameter_le_vertexBound {V : Type*} [Fintype V]
(n : β) (H : SimpleGraph V) (q : β) (hn : 2 β€ n)
(hcard : Fintype.card V β€ n) (hedge : 1 β€ edgeCount H) (hq : 0 β€ q) :
min 1 (2048 * Real.exp 50 * q * (1 + logTwo (edgeCount H : β))) β€
6144 * Real.exp 50 * q * logTwo (n : β) := by
calc
min 1 (2048 * Real.exp 50 * q * (1 + logTwo (edgeCount H : β))) β€
2048 * Real.exp 50 * q * (1 + logTwo (edgeCount H : β)) := min_le_right _ _
_ β€ 2048 * Real.exp 50 * q * (3 * logTwo (n : β)) := by
exact mul_le_mul_of_nonneg_left
(graph_one_add_logTwo_le_three_logTwo n H hn hcard hedge)
(mul_nonneg (mul_nonneg (by norm_num) (Real.exp_pos 50).le) hq)
_ = 6144 * Real.exp 50 * q * logTwo (n : β) := by ring
end LeanBlast.SecondKahnKalai
end
end OAI
|