File size: 3,284 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
import Mathlib
import OAI.Probability.CriticalPercolation.Exploration.QueryBand
import OAI.Probability.CriticalPercolation.Exploration.Score
import OAI.Probability.CriticalPercolation.Criticality.DyadicBound

namespace OAI

section
section
noncomputable section
namespace CriticalPercolation.SearchTree
open scoped Classical
open FiniteProduct

variable {E R : Type*} [Fintype E] [DecidableEq E]

lemma normalized_centered_bound (t : SearchTree E R) (used : Finset E) (ht : t.Valid used)
    (p : ℝ) (hp : p ∈ Set.Icc 0 1) (w : E β†’ Prop β†’ ℝ)
    (hw : βˆ€ e, βˆ‘ b, w e b = 1) (hn : βˆ€ e b, 0≀w e b)
    (hf : LazyDFS.Fresh w p used) (K : β„•) :
    expect w (fun Ο‰ => |t.centeredSum p Ο‰| *
      min (1/(4:ℝ)^K) (1/(t.queryCount Ο‰ : ℝ))) ≀ 6/(2:ℝ)^K := by
  let N := Fintype.card E + 1
  let a (k : β„•) := min (1/(4:ℝ)^K) (1/(4:ℝ)^k)
  let b (k : β„•) (Ο‰ : E β†’ Prop) :=
    if 4^k ≀ t.queryCount Ο‰ ∧ t.queryCount Ο‰ < 4^(k+1)
      then |t.centeredSum p Ο‰| else 0
  have ha (k : β„•) : 0≀a k := by dsimp [a]; positivity
  have hb (k : β„•) (Ο‰ : E β†’ Prop) : 0≀b k Ο‰ := by
    dsimp [b]; split_ifs <;> positivity
  have hpoint (Ο‰ : E β†’ Prop) : |t.centeredSum p Ο‰| *
      min (1/(4:ℝ)^K) (1/(t.queryCount Ο‰ : ℝ)) ≀
        βˆ‘ k ∈ Finset.range N, b k Ο‰ * a k := by
    by_cases hT : t.queryCount Ο‰ = 0
    Β· rw [t.centeredSum_eq_zero_of_count Ο‰ hT p,abs_zero,zero_mul]
      exact Finset.sum_nonneg (fun k _ => mul_nonneg (hb k Ο‰) (ha k))
    Β· let k := Nat.log 4 (t.queryCount Ο‰)
      have hklo : 4^k ≀ t.queryCount Ο‰ := Nat.pow_log_le_self 4 hT
      have hkhi : t.queryCount Ο‰ < 4^(k+1) := Nat.lt_pow_succ_log_self (by omega) _
      have hkN : k ∈ Finset.range N := by
        apply Finset.mem_range.mpr
        have h1 := Nat.log_le_self 4 (t.queryCount Ο‰)
        have h2 := t.queryCount_le_card used ht Ο‰
        dsimp [k,N]
        omega
      calc
        _ ≀ b k Ο‰ * a k := by
          have hband : 4^k ≀ t.queryCount Ο‰ ∧ t.queryCount Ο‰ < 4^(k+1) := ⟨hklo,hkhi⟩
          simp only [b,ite_eq_left hband]
          apply mul_le_mul_of_nonneg_left _ (abs_nonneg _)
          apply min_le_min le_rfl
          apply one_div_le_one_div_of_le (by positivity : (0:ℝ)<(4:ℝ)^k)
          exact_mod_cast hklo
        _ ≀ _ := Finset.single_le_sum (fun j _ => mul_nonneg (hb j Ο‰) (ha j)) hkN
  calc
    _ ≀ expect w (fun Ο‰ => βˆ‘ k ∈ Finset.range N, b k Ο‰ * a k) := expect_mono hn hpoint
    _ = βˆ‘ k ∈ Finset.range N, expect w (b k) * a k := by
      simp only [expect,Finset.mul_sum]
      rw [Finset.sum_comm]
      apply Finset.sum_congr rfl
      intro k _
      rw [Finset.sum_mul]
      apply Finset.sum_congr rfl
      intro Ο‰ _
      ring
    _ ≀ βˆ‘ k ∈ Finset.range N, (2:ℝ)^(k+1)*a k := by
      apply Finset.sum_le_sum
      intro k _
      exact mul_le_mul_of_nonneg_right (t.band_centered_bound used ht p hp w hw hn hf k) (ha k)
    _ = βˆ‘ k ∈ Finset.range N,
        min ((2:ℝ)^(k+1)/4^K) ((2:ℝ)^(k+1)/4^k) := by
      apply Finset.sum_congr rfl
      intro k _
      dsimp [a]
      rw [mul_min_of_nonneg _ _ (by positivity)]
      simp only [mul_one_div]
    _ ≀ _ := dyadic_sum_bound N K

end CriticalPercolation.SearchTree
end
end
end

end OAI