Download data/lean/OAI/Probability/CriticalPercolation/Exploration/QueryBand.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.32 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Exploration/QueryBand.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/CriticalPercolation/Exploration/QueryBand.lean
-
curl -L -o QueryBand.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/CriticalPercolation/Exploration/QueryBand.lean
3.32 kB
| import Mathlib | |
| import OAI.Probability.CriticalPercolation.Modular.WeightedCauchy | |
| import OAI.Probability.CriticalPercolation.ProductMeasure.QueryMartingale | |
| namespace OAI | |
| section | |
| section | |
| noncomputable section | |
| namespace CriticalPercolation.FiniteProduct | |
| open scoped Classical | |
| variable {E : Type*} [Fintype E] | |
| lemma expect_abs_sq_le (w : E β Prop β β) (hw : β e, β b, w e b = 1) | |
| (hn : β e b, 0β€w e b) (f : (E β Prop) β β) : | |
| (expect w (fun Ο => |f Ο|))^2 β€ expect w (fun Ο => (f Ο)^2) := by | |
| have h := FiniteEntropy.weighted_cauchy (density w) (fun Ο => |f Ο|) (fun _ => 1) | |
| (fun Ο => density_nonneg hn Ο) | |
| simp only [mul_one,one_pow,sq_abs] at h | |
| have hw1 : β Ο, density w Ο = 1 := by | |
| simpa only [expect,mul_one] using expect_const w hw (1:β) | |
| simpa only [hw1,mul_one,expect] using h | |
| lemma expect_abs_le_of_second_le (w : E β Prop β β) (hw : β e, β b, w e b = 1) | |
| (hn : β e b, 0β€w e b) (f : (E β Prop) β β) {a : β} (ha : 0β€a) | |
| (hf : expect w (fun Ο => (f Ο)^2) β€ a^2) : expect w (fun Ο => |f Ο|) β€ a := by | |
| nlinarith [expect_abs_sq_le w hw hn f] | |
| end CriticalPercolation.FiniteProduct | |
| namespace CriticalPercolation.SearchTree | |
| open scoped Classical | |
| open FiniteProduct | |
| variable {E R : Type*} | |
| lemma queryCount_eq_reads_length (t : SearchTree E R) (Ο : E β Prop) : | |
| t.queryCount Ο = (t.reads (fun e => decide (Ο e))).length := by | |
| induction t with | |
| | done r => rfl | |
| | ask e l r hl hr => | |
| by_cases he : Ο e <;> simp [queryCount,reads,he,hl,hr,Nat.add_comm] | |
| lemma centeredSum_eq_zero_of_count (t : SearchTree E R) (Ο : E β Prop) | |
| (h : t.queryCount Ο = 0) (p : β) : t.centeredSum p Ο = 0 := by | |
| cases t with | |
| | done r => rfl | |
| | ask e l r => simp [queryCount] at h | |
| variable [Fintype E] [DecidableEq E] | |
| lemma queryCount_le_card (t : SearchTree E R) (used : Finset E) (ht : t.Valid used) | |
| (Ο : E β Prop) : t.queryCount Ο β€ Fintype.card E := by | |
| rw [queryCount_eq_reads_length] | |
| exact List.Nodup.length_le_card (t.reads_nodup used ht _) | |
| lemma band_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 Ο => if 4^k β€ t.queryCount Ο β§ t.queryCount Ο < 4^(k+1) | |
| then |t.centeredSum p Ο| else 0) β€ (2:β)^(k+1) := by | |
| calc | |
| _ β€ expect w (fun Ο => |(t.truncate (4^(k+1))).centeredSum p Ο|) := by | |
| apply expect_mono hn | |
| intro Ο | |
| split_ifs with h | |
| Β· rw [t.centeredSum_truncate_eq _ Ο h.2.le p] | |
| Β· exact abs_nonneg _ | |
| _ β€ (2:β)^(k+1) := by | |
| apply expect_abs_le_of_second_le w hw hn _ (by positivity) | |
| have ht' := t.truncated_second_le used ht p hp w hw hn hf (4^(k+1)) | |
| have hpp : p*(1-p) β€ 1 := by nlinarith [hp.2,sq_nonneg p] | |
| have hN : (4^(k+1) : β) = ((2:β)^(k+1))^2 := by | |
| rw [β pow_mul, mul_comm (k+1) 2, pow_mul] | |
| norm_num | |
| calc _ β€ p*(1-p)*(4^(k+1) : β) := ht' | |
| _ β€ (4^(k+1) : β) := by | |
| simpa using mul_le_mul_of_nonneg_right hpp (by positivity : 0β€(4^(k+1):β)) | |
| _ = _ := hN | |
| end CriticalPercolation.SearchTree | |
| end | |
| end | |
| end | |
| end OAI | |