Download data/lean/OAI/Probability/BinarySweep/Trajectories/EndpointOccupancy.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.37 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/Trajectories/EndpointOccupancy.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/BinarySweep/Trajectories/EndpointOccupancy.lean
-
curl -L -o EndpointOccupancy.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/Trajectories/EndpointOccupancy.lean
7.37 kB
| import Mathlib | |
| import OAI.Probability.BinarySweep.Trajectories.EndpointEntryBound | |
| import OAI.Probability.BinarySweep.Trajectories.SparseOccupancy | |
| namespace OAI | |
| noncomputable section | |
| open scoped BigOperators Classical | |
| namespace BinaryCoordinateSweeps | |
| open Sparse | |
| Classical.propDecidable | |
| variable {b h k : β} {bits : Fin b β β} (H : PathFamily bits h) | |
| lemma card_gridOutside_mul (j : Fin b) : | |
| Fintype.card (GridOutside bits j)*2^bits j=gridSize bits := by | |
| have he := Fintype.card_congr (Equiv.piSplitAt j (fun i : Fin b => Slot (bits i))) | |
| simpa only [Fintype.card_prod,card_gridSlot,Slot,Fintype.card_fun,Fintype.card_bool,Fintype.card_fin,Nat.mul_comm] using he.symm | |
| lemma sum_endpointLineCount (e : Fin k β GridSlot bits Γ GridSlot bits) (j : Fin b) : | |
| βy, endpointLineCount Finset.univ e j y=k := by | |
| have he := Fintype.card_congr (Equiv.sigmaFiberEquiv | |
| (fun i : β₯(Finset.univ : Finset (Fin k)) => endpointLine (e i) j)) | |
| simpa only [Fintype.card_sigma,Fintype.card_coe,Finset.card_univ,Fintype.card_fin, | |
| endpointLineCount] using he | |
| lemma heavy_count {L : Type*} [Fintype L] (f : L β β) (Ο : β) : | |
| Ο*(Finset.univ.filter (fun l => Ο<(f l:β))).card β€ βl, (f l:β) := by | |
| let S := Finset.univ.filter (fun l => Ο<(f l:β)) | |
| calc | |
| _ = βlβS, Ο := by simp [S,mul_comm] | |
| _ β€ βlβS, (f l:β) := Finset.sum_le_sum (fun l hl => (Finset.mem_filter.mp hl).2.le) | |
| _ β€ βl, (f l:β) := Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) (by intros; positivity) | |
| def holeHeavyLines (j : Fin b) (Ξ· : β) : Finset (GridOutside bits j) := | |
| Finset.univ.filter (fun l => (2^bits j:β)*Ξ·/2<(lineHoles H j l:β)) | |
| def particleHeavyLines (e : Fin k β GridSlot bits Γ GridSlot bits) (j : Fin b) (Ξ· : β) : | |
| Finset (GridOutside bits j) := | |
| Finset.univ.filter (fun l => (2^bits j:β)*Ξ·/2<(endpointLineCount Finset.univ e j l:β)) | |
| lemma holeHeavy_card (j : Fin b) {Ξ· : β} (hΞ· : 0<Ξ·) : | |
| ((holeHeavyLines H j Ξ·).card:β) β€ 2*h/((2^bits j:β)*Ξ·) := by | |
| have hh := heavy_count (lineHoles H j) ((2^bits j:β)*Ξ·/2) | |
| rw [β Nat.cast_sum,sum_lineHoles] at hh | |
| apply (le_div_iffβ (by positivity)).mpr | |
| change (2^bits j:β)*Ξ·/2*(holeHeavyLines H j Ξ·).cardβ€(h:β) at hh | |
| nlinarith | |
| lemma particleHeavy_card (e : Fin k β GridSlot bits Γ GridSlot bits) (j : Fin b) | |
| {Ξ· : β} (hΞ· : 0<Ξ·) : | |
| (particleHeavyLines e j Ξ·).card β€ β2*(k:β)/((2^bits j:β)*Ξ·)ββ := by | |
| apply Nat.le_floor | |
| have hh := heavy_count (endpointLineCount Finset.univ e j) ((2^bits j:β)*Ξ·/2) | |
| rw [β Nat.cast_sum,sum_endpointLineCount] at hh | |
| apply (le_div_iffβ (by positivity)).mpr | |
| change (2^bits j:β)*Ξ·/2*(particleHeavyLines e j Ξ·).cardβ€(k:β) at hh | |
| nlinarith | |
| lemma endpoint_not_light (e : Fin k β GridSlot bits Γ GridSlot bits) | |
| (j : Fin b) (l : GridOutside bits j) (Ξ· : β) | |
| (hn : Β¬endpointLight H Ξ· e β¨j,lβ©) : | |
| lβholeHeavyLines H j Ξ· β¨ lβparticleHeavyLines e j Ξ· := by | |
| simp only [holeHeavyLines,particleHeavyLines,Finset.mem_filter,Finset.mem_univ,true_and] | |
| change Β¬((lineHoles H j l:β)+endpointLineCount Finset.univ e j lβ€(2^bits j:β)*Ξ·) at hn | |
| push Not at hn | |
| rcases lt_or_ge ((2^bits j:β)*Ξ·/2) (lineHoles H j l:β) with hh | hh | |
| Β· exact Or.inl hh | |
| Β· exact Or.inr (by linarith) | |
| lemma endpoint_line_set_mass (j : Fin b) (S : Finset (GridOutside bits j)) : | |
| finiteProbability uniformWeight (fun z : GridSlot bits Γ GridSlot bits => endpointLine z jβS)= | |
| (S.card:β)*(2^bits j:β)/gridSize bits := by | |
| change finiteProbability uniformWeight (fun z : GridSlot bits Γ GridSlot bits => | |
| (fun i : {i : Fin b // iβ j} => independentPosition z j.castSucc i)βS)=_ | |
| rw [independent_line_set_uniform] | |
| have he : (Fintype.card (GridOutside bits j):β)*(2^bits j:β)=gridSize bits := by | |
| exact_mod_cast card_gridOutside_mul j | |
| have hs : (gridSize bits:β)β 0 := by exact_mod_cast (gridSize_pos bits).ne' | |
| have hm : ((2^bits j:β):β)β 0 := by positivity | |
| rw [β he] | |
| field_simp | |
| lemma holeHeavy_mass (j : Fin b) {Ξ· : β} (hΞ· : 0<Ξ·) : | |
| finiteProbability uniformWeight (fun z : GridSlot bits Γ GridSlot bits => | |
| endpointLine z jβholeHeavyLines H j Ξ·) β€ 2*h/((gridSize bits:β)*Ξ·) := by | |
| rw [endpoint_line_set_mass] | |
| have hh := holeHeavy_card H j hΞ· | |
| have hs : (0:β)<gridSize bits := by exact_mod_cast gridSize_pos bits | |
| have hm : (0:β)<(2^bits j:β) := by positivity | |
| calc | |
| _ β€ (2*h/((2^bits j:β)*Ξ·))*(2^bits j:β)/gridSize bits := by gcongr | |
| _ = _ := by field_simp | |
| lemma small_lines_mass (j : Fin b) {Ξ· : β} (hΞ· : 0<Ξ·) | |
| (S : Finset (GridOutside bits j)) (hS : S.cardβ€β2*(k:β)/((2^bits j:β)*Ξ·)ββ) : | |
| finiteProbability uniformWeight (fun z : GridSlot bits Γ GridSlot bits => endpointLine z jβS) β€ | |
| 2*k/((gridSize bits:β)*Ξ·) := by | |
| rw [endpoint_line_set_mass] | |
| have hnon : 0β€2*(k:β)/((2^bits j:β)*Ξ·) := by positivity | |
| have hh : (S.card:β)β€2*(k:β)/((2^bits j:β)*Ξ·) := | |
| (Nat.cast_le.mpr hS).trans (Nat.floor_le hnon) | |
| have hs : (0:β)<gridSize bits := by exact_mod_cast gridSize_pos bits | |
| have hm : (0:β)<(2^bits j:β) := by positivity | |
| calc | |
| _ β€ (2*k/((2^bits j:β)*Ξ·))*(2^bits j:β)/gridSize bits := by gcongr | |
| _ = _ := by field_simp | |
| lemma holeHeavy_occupancy_bound (j : Fin b) {Ξ· : β} (hΞ· : 0<Ξ·) | |
| (hsmall : 2*h/((gridSize bits:β)*Ξ·)β€1) (w : β) : | |
| productProbability uniformWeight (fun e : Fin k β GridSlot bits Γ GridSlot bits => | |
| w β€ (Finset.univ.filter (fun i => endpointLine (e i) jβholeHeavyLines H j Ξ·)).card) β€ | |
| (2:β)^k*(2*h/((gridSize bits:β)*Ξ·))^w := by | |
| have he := occupancy_probability_le (I:=Fin k) uniformWeight uniformWeight_nonneg uniformWeight_sum | |
| (fun z : GridSlot bits Γ GridSlot bits => endpointLine z jβholeHeavyLines H j Ξ·) _ | |
| (by positivity) hsmall (holeHeavy_mass H j hΞ·) w | |
| simp only [Fintype.card_fin] at he | |
| convert he using 1 | |
| congr 1 | |
| funext e | |
| congr 1 | |
| congr 1 | |
| ext i | |
| simp only [Finset.mem_filter,Finset.mem_univ,true_and] | |
| lemma particleHeavy_occupancy_bound (j : Fin b) {Ξ· : β} (hΞ· : 0<Ξ·) | |
| (hsmall : 2*k/((gridSize bits:β)*Ξ·)β€1) (w : β) : | |
| productProbability uniformWeight (fun e : Fin k β GridSlot bits Γ GridSlot bits => | |
| w β€ (Finset.univ.filter (fun i => endpointLine (e i) jβparticleHeavyLines e j Ξ·)).card) β€ | |
| (Fintype.card (GridOutside bits j)+1:β)^β2*(k:β)/((2^bits j:β)*Ξ·)ββ * | |
| (2:β)^k*(2*k/((gridSize bits:β)*Ξ·))^w := by | |
| have hb := line_sets_occupancy_probability_le (I:=Fin k) uniformWeight uniformWeight_nonneg uniformWeight_sum | |
| (fun z : GridSlot bits Γ GridSlot bits => endpointLine z j) _ w _ (by positivity) | |
| hsmall (small_lines_mass j hΞ·) | |
| apply le_trans (b:=productProbability uniformWeight (fun e : Fin k β GridSlot bits Γ GridSlot bits => | |
| βS : Finset (GridOutside bits j), S.cardβ€β2*(k:β)/((2^bits j:β)*Ξ·)ββ β§ | |
| wβ€(Finset.univ.filter (fun i => endpointLine (e i) jβS)).card)) | |
| Β· exact productProbability_mono uniformWeight_nonneg (fun e he => | |
| β¨particleHeavyLines e j Ξ·,particleHeavy_card e j hΞ·,heβ©) | |
| Β· simpa only [Fintype.card_fin] using hb | |
| end BinaryCoordinateSweeps | |
| end | |
| end OAI | |