Download data/lean/OAI/Combinatorics/BalancedRyser/Selection/LineOccupancyConcentration.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 8.34 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/BalancedRyser/Selection/LineOccupancyConcentration.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/BalancedRyser/Selection/LineOccupancyConcentration.lean
-
curl -L -o LineOccupancyConcentration.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/BalancedRyser/Selection/LineOccupancyConcentration.lean
8.34 kB
| import OAI.Combinatorics.BalancedRyser.Probability.FiniteUniformConcentration | |
| import OAI.Combinatorics.BalancedRyser.Probability.UniformRestriction | |
| import OAI.Combinatorics.BalancedRyser.Selection.LineOccupancy | |
| import OAI.Combinatorics.BalancedRyser.Selection.LineOccupancyAsymptotics | |
| namespace OAI | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory Filter Topology | |
| open scoped Classical | |
| namespace Balanced.LineOccupancy | |
| variable {F : Type*} [Field F] [Fintype F] [DecidableEq F] | |
| theorem offsetLaw_map_transverse (l : Line F) : | |
| (offsetLaw F).map (transverseOffsets l) = | |
| PMF.uniformOfFintype (TransverseDirections l β F) := by | |
| have ho : offsetLaw F = PMF.uniformOfFintype (MergedPairs F) := by | |
| unfold offsetLaw | |
| congr 1 | |
| exact Subsingleton.elim _ _ | |
| rw [ho] | |
| let e : TransverseDirections l βͺ Direction F Γ Bool := | |
| β¨fun d => (d.val, true), fun a b h => Subtype.ext (congrArg Prod.fst h)β© | |
| let c : MergedPairs F β (Direction F Γ Bool β F) := Equiv.curry _ _ _ |>.symm | |
| have hc := TupleAlignment.uniform_map_equiv c | |
| calc | |
| _ = ((PMF.uniformOfFintype (MergedPairs F)).map c).map | |
| (fun o i => o (e i)) := by | |
| rw [PMF.map_comp] | |
| rfl | |
| _ = _ := by | |
| rw [hc] | |
| exact TupleAlignment.uniform_map_restrict e | |
| theorem transverse_failure_le (l : Line F) | |
| (hgap : (Fintype.card F : β) / 20 β€ | |
| (Fintype.card F : β) * (1 - 1 / (Fintype.card F : β)) ^ Fintype.card F - | |
| (Fintype.card F : β) / 5) : | |
| ((PMF.uniformOfFintype (TransverseDirections l β F)).toOuterMeasure | |
| {a | (unhitCount l a : β) < (Fintype.card F : β) / 5}).toReal β€ | |
| 2 * Real.exp (-(Fintype.card F : β) / 3200) := by | |
| let : MeasurableSpace F := β€ | |
| let : MeasurableSingletonClass F := β¨fun _ => trivialβ© | |
| have hq : 0 < Fintype.card F := Fintype.card_pos | |
| have hqR : (0 : β) < Fintype.card F := Nat.cast_pos.mpr hq | |
| have ht := FiniteUniform.bounded_differences | |
| (fun a : TransverseDirections l β F => (unhitCount l a : β)) (fun _ => 1) | |
| (fun _ => by norm_num) | |
| (fun i a b h => abs_unhitCount_sub_le_one l a b i h) | |
| (L := 1) (u := (Fintype.card F : β) / 20) | |
| (by rw [card_transverseDirections]; exact Nat.succ_le_iff.mpr hq) (by norm_num) (fun _ => le_rfl) (by positivity) | |
| rw [integral_unhitCount (F := F) l, card_transverseDirections, occupancy_exponent _ hq] at ht | |
| have hsub : {a : TransverseDirections l β F | | |
| (unhitCount l a : β) < (Fintype.card F : β) / 5} β | |
| {a | (Fintype.card F : β) / 20 β€ | |
| |(unhitCount l a : β) - | |
| (Fintype.card F : β) * (1 - 1 / (Fintype.card F : β)) ^ Fintype.card F|} := by | |
| intro a ha | |
| change (unhitCount l a : β) < (Fintype.card F : β) / 5 at ha | |
| change (Fintype.card F : β) / 20 β€ | |
| |(unhitCount l a : β) - | |
| (Fintype.card F : β) * (1 - 1 / (Fintype.card F : β)) ^ Fintype.card F| | |
| have habs := neg_le_abs ((unhitCount l a : β) - | |
| (Fintype.card F : β) * (1 - 1 / (Fintype.card F : β)) ^ Fintype.card F) | |
| linarith | |
| calc | |
| _ = (PMF.uniformOfFintype (TransverseDirections l β F)).toMeasure.real | |
| {a | (unhitCount l a : β) < (Fintype.card F : β) / 5} := by | |
| rw [Measure.real, PMF.toMeasure_apply_eq_toOuterMeasure_apply] | |
| exact (Set.toFinite _).measurableSet | |
| _ β€ _ := measureReal_mono hsub | |
| _ β€ _ := ht | |
| theorem offset_failure_le (l : Line F) | |
| (hgap : (Fintype.card F : β) / 20 β€ | |
| (Fintype.card F : β) * (1 - 1 / (Fintype.card F : β)) ^ Fintype.card F - | |
| (Fintype.card F : β) / 5) : | |
| offsetEventProbability (F := F) | |
| {M | (unhitCount l (transverseOffsets l M) : β) < (Fintype.card F : β) / 5} β€ | |
| 2 * Real.exp (-(Fintype.card F : β) / 3200) := by | |
| have h := transverse_failure_le l hgap | |
| rw [β offsetLaw_map_transverse l, PMF.toOuterMeasure_map_apply] at h | |
| exact h | |
| omit [DecidableEq F] in | |
| theorem offsetEventProbability_eq_real [MeasurableSpace (MergedPairs F)] | |
| [MeasurableSingletonClass (MergedPairs F)] (s : Set (MergedPairs F)) : | |
| offsetEventProbability s = (offsetLaw F).toMeasure.real s := by | |
| rw [offsetEventProbability, Measure.real, | |
| (offsetLaw F).toMeasure_apply_eq_toOuterMeasure_apply ((Set.toFinite s).measurableSet)] | |
| theorem initial_failure_probability_le | |
| (hgap : (Fintype.card F : β) / 20 β€ | |
| (Fintype.card F : β) * (1 - 1 / (Fintype.card F : β)) ^ Fintype.card F - | |
| (Fintype.card F : β) / 5) : | |
| offsetEventProbability (F := F) | |
| {M | β l, l β initialDeletedLines M β§ | |
| ((linePoints l β© initiallyRetained M).card : β) < (Fintype.card F : β) / 5} β€ | |
| (Fintype.card F : β) * ((Fintype.card F : β) + 1) * | |
| (2 * Real.exp (-(Fintype.card F : β) / 3200)) := by | |
| let : MeasurableSpace (MergedPairs F) := β€ | |
| let : MeasurableSingletonClass (MergedPairs F) := β¨fun _ => trivialβ© | |
| let B (l : Line F) : Set (MergedPairs F) := | |
| {M | (unhitCount l (transverseOffsets l M) : β) < (Fintype.card F : β) / 5} | |
| have hsub : {M : MergedPairs F | β l, l β initialDeletedLines M β§ | |
| ((linePoints l β© initiallyRetained M).card : β) < (Fintype.card F : β) / 5} β | |
| β l, B l := by | |
| rintro M β¨l, hl, hbadβ© | |
| apply Set.mem_iUnion.mpr | |
| refine β¨l, ?_β© | |
| change (unhitCount l (transverseOffsets l M) : β) < _ | |
| rw [unhitCount_eq_initiallyRetained l M hl] | |
| exact hbad | |
| rw [offsetEventProbability_eq_real] | |
| calc | |
| _ β€ (offsetLaw F).toMeasure.real (β l, B l) := measureReal_mono hsub | |
| _ β€ β l, (offsetLaw F).toMeasure.real (B l) := measureReal_iUnion_fintype_le B | |
| _ β€ β _l : Line F, (2 * Real.exp (-(Fintype.card F : β) / 3200)) := by | |
| apply Finset.sum_le_sum | |
| intro l _ | |
| rw [β offsetEventProbability_eq_real] | |
| exact offset_failure_le l hgap | |
| _ = _ := by simp [Line, Direction, mul_comm] | |
| theorem tendsto_initial_failure (F : β β Type*) | |
| [β n, Field (F n)] [β n, Fintype (F n)] [β n, DecidableEq (F n)] | |
| (hq : Tendsto (fun n => Fintype.card (F n)) atTop atTop) : | |
| Tendsto (fun n => offsetEventProbability (F := F n) | |
| {M | β l, l β initialDeletedLines M β§ | |
| ((linePoints l β© initiallyRetained M).card : β) < (Fintype.card (F n) : β) / 5}) | |
| atTop (π 0) := by | |
| apply squeeze_zero' (Eventually.of_forall (fun _ => ENNReal.toReal_nonneg)) | |
| Β· filter_upwards [hq.eventually eventually_mean_gap] with n hn | |
| exact initial_failure_probability_le hn | |
| Β· exact tendsto_line_union_bound.comp hq | |
| theorem initial_good_probability_eq_one_sub : | |
| offsetEventProbability (F := F) | |
| {M | β l, l β initialDeletedLines M β | |
| (Fintype.card F : β) / 5 β€ ((linePoints l β© initiallyRetained M).card : β)} = | |
| 1 - offsetEventProbability (F := F) | |
| {M | β l, l β initialDeletedLines M β§ | |
| ((linePoints l β© initiallyRetained M).card : β) < (Fintype.card F : β) / 5} := by | |
| let : MeasurableSpace (MergedPairs F) := β€ | |
| let : MeasurableSingletonClass (MergedPairs F) := β¨fun _ => trivialβ© | |
| have heq : {M : MergedPairs F | β l, l β initialDeletedLines M β | |
| (Fintype.card F : β) / 5 β€ ((linePoints l β© initiallyRetained M).card : β)} = | |
| {M | β l, l β initialDeletedLines M β§ | |
| ((linePoints l β© initiallyRetained M).card : β) < (Fintype.card F : β) / 5}αΆ := by | |
| ext M | |
| simp only [Set.mem_ofPred_eq, Set.mem_compl_iff, not_exists, not_and, not_lt] | |
| rw [heq, offsetEventProbability_eq_real, | |
| probReal_compl_eq_one_sub ((Set.toFinite _).measurableSet), | |
| β offsetEventProbability_eq_real] | |
| theorem tendsto_initial_occupancy (F : β β Type*) | |
| [β n, Field (F n)] [β n, Fintype (F n)] [β n, DecidableEq (F n)] | |
| (hq : Tendsto (fun n => Fintype.card (F n)) atTop atTop) : | |
| Tendsto (fun n => offsetEventProbability (F := F n) | |
| {M | β l, l β initialDeletedLines M β | |
| (1 / 5 : β) * (Fintype.card (F n) : β) β€ | |
| ((linePoints l β© initiallyRetained M).card : β)}) atTop (π 1) := by | |
| have h := (tendsto_const_nhds (x := (1 : β))).sub (tendsto_initial_failure F hq) | |
| simpa only [one_div, mul_comm (5 : β)β»ΒΉ, β div_eq_mul_inv, | |
| initial_good_probability_eq_one_sub, sub_zero] using h | |
| end Balanced.LineOccupancy | |
| end | |
| end OAI | |