Download data/lean/OAI/NumberTheory/Jacobsthal/Partitions/CommonCellSum.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 20.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Jacobsthal/Partitions/CommonCellSum.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/Jacobsthal/Partitions/CommonCellSum.lean
-
curl -L -o CommonCellSum.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Jacobsthal/Partitions/CommonCellSum.lean
20.4 kB
| import OAI.NumberTheory.Jacobsthal.Primes.PrimeCompactWeights | |
| import OAI.NumberTheory.Jacobsthal.Probability.ActualCouplingUpdates | |
| namespace OAI | |
| namespace Erdos970 | |
| open scoped _root_.Erdos970 | |
| section | |
| namespace NumberTheoryLean.ContinuousParentBins | |
| open _root_.Set _root_.MeasureTheory | |
| open scoped ENNReal | |
| open FinitePathGeometry PrimeTiltBounds PrimeTiltMonotone ContinuousRatioBins | |
| open HarmonicExponentMeasure WeightGlobalBounds | |
| theorem multiplier_source_ratio {i : Side} {s t : β} (hs : Valid i s) (ht : Valid i t) (u : β) : | |
| multiplier i s u = (weight i t/weight i s)*multiplier i t u := by | |
| by_cases hu : u = 0 | |
| Β· simp [multiplier,hu] | |
| Β· unfold multiplier | |
| field_simp [hu,(weight_pos hs).ne',(weight_pos ht).ne'] | |
| theorem continuous_bin_mass_ratio {i : Side} {s t a b : β} (hs : Valid i s) (ht : Valid i t) | |
| (hsa : minRatio i s β€ a) (hta : minRatio i t β€ a) : | |
| weightedRatioLaw i s (Ico a b) = ENNReal.ofReal (weight i t/weight i s) * weightedRatioLaw i t (Ico a b) := by | |
| have hq : 0 β€ weight i t/weight i s := (div_pos (weight_pos ht) (weight_pos hs)).le | |
| simp only [weightedRatioLaw, withDensity_apply _ measurableSet_Ico] | |
| rw [ratio_restrict_bin hsa, ratio_restrict_bin hta, β lintegral_const_mul' _ _ ENNReal.ofReal_ne_top] | |
| apply lintegral_congr | |
| intro u | |
| rw [multiplier_source_ratio hs ht u, ENNReal.ofReal_mul hq] | |
| theorem continuousBin_parent_ratio {i : Side} {s t a b : β} (hs : Valid i s) (ht : Valid i t) | |
| (hsa : minRatio i s β€ a) (hta : minRatio i t β€ a) : | |
| continuousBin i s a b = (weight i t/weight i s)*continuousBin i t a b := by | |
| unfold continuousBin | |
| rw [continuous_bin_mass_ratio hs ht hsa hta, ENNReal.toReal_mul, | |
| ENNReal.toReal_ofReal (div_pos (weight_pos ht) (weight_pos hs)).le] | |
| theorem positive_ratio_error {a b d : β} (ha : 0 < a) (hb : 0 < b) | |
| (hlog : |Real.log a-Real.log b| β€ d) : |a/b-1| β€ Real.exp d-1 := by | |
| have hq := div_pos ha hb | |
| rw [β Real.log_div ha.ne' hb.ne'] at hlog | |
| have hlo := Real.exp_le_exp.mpr (abs_le.mp hlog).1 | |
| have hup := Real.exp_le_exp.mpr (abs_le.mp hlog).2 | |
| rw [Real.exp_log hq] at hlo hup | |
| have hsum : 2 β€ Real.exp d+Real.exp (-d) := by | |
| linarith [Real.add_one_le_exp d, Real.add_one_le_exp (-d)] | |
| rw [abs_le] | |
| constructor <;> linarith | |
| theorem continuous_parent_bin_error : β C : β, 0 < C β§ β S : β, 3 β€ S β | |
| β i : Side, β s t a b : β, Valid i s β Valid i t β s β€ S β t β€ S β | |
| minRatio i s β€ a β minRatio i t β€ a β | |
| |continuousBin i s a b-continuousBin i t a b| β€ | |
| (Real.exp (C*(1+S)^3*|s-t|)-1)*continuousBin i t a b := by | |
| obtain β¨C,hC,hboundβ© := weights_log_lipschitz | |
| refine β¨C,hC,?_β© | |
| intro S hS i s t a b hs ht hsS htS hsa hta | |
| have hlogs : |Real.log (weight i s)-Real.log (weight i t)| β€ C*(1+S)^3*|s-t| := by | |
| cases i with | |
| | even => exact (hbound S hS).1 s t hs ht hsS htS | |
| | odd => exact (hbound S hS).2 s t hs ht hsS htS | |
| have hr := positive_ratio_error (weight_pos ht) (weight_pos hs) | |
| ((abs_sub_comm _ _).trans_le hlogs) | |
| have hmass : 0 β€ continuousBin i t a b := ENNReal.toReal_nonneg | |
| rw [continuousBin_parent_ratio hs ht hsa hta] | |
| rw [show (weight i t/weight i s)*continuousBin i t a b-continuousBin i t a b = | |
| (weight i t/weight i s-1)*continuousBin i t a b by ring, abs_mul, abs_of_nonneg hmass] | |
| exact mul_le_mul_of_nonneg_right hr hmass | |
| end NumberTheoryLean.ContinuousParentBins | |
| end | |
| section | |
| namespace NumberTheoryLean.NearbyParentFullBins | |
| open _root_.Set _root_.MeasureTheory | |
| open FinitePathGeometry FinitePathMeasures PrimeHistories PrimeKilledChain | |
| open PrimeBinMembership ActualPrimeBins ContinuousKilledBins | |
| open NormalizedPrimeBins ContinuousRatioBins ContinuousParentBins RegeneratingInverseBands | |
| theorem nearby_parent_full_bin_error : β c C D wβ : β, 0 < c β§ 0 < C β§ 0 < D β§ 1 < wβ β§ | |
| β w : β, wβ β€ w β β ell S : β, β start : Node, β h : History w ell S start, | |
| β v : β, β z : CostState, β a b : β, | |
| 1 β€ ell β 3 β€ S β 0 < start.gap β Valid start.side start.ratio β start.ratio β€ S β Consistent start β | |
| stateRatio z.1 β€ S β h.node.side = stateSide z.1 β | |
| minRatio h.node.side h.node.ratio < a β minRatio (stateSide z.1) (stateRatio z.1) < a β | |
| a β€ b β b β€ S β b β€ h.node.gap/ell-1 β b β€ gapValue v z/ell-1 β | |
| |(chain w ell S start (some h) (liveBin a b)).toReal - | |
| (continuousChain v ell S (.inl z) (Sum.inl '' ratioBinSet a b)).toReal| β€ | |
| C*(1+S)^5*((b-a)^2+Real.exp (-c*Real.sqrt ((1/2 : β)*Real.log w))) + | |
| epsilon w*continuousBin h.node.side h.node.ratio a b + | |
| (Real.exp (D*(1+S)^3*|h.node.ratio-stateRatio z.1|)-1)* | |
| continuousBin (stateSide z.1) (stateRatio z.1) a b := by | |
| obtain β¨c,C,wβ,hc,hC,hwβ,hprimeβ© := normalized_bin_error | |
| obtain β¨D,hD,hparentβ© := continuous_parent_bin_error | |
| refine β¨c,C,D,wβ,hc,hC,hD,hwβ,?_β© | |
| intro w hw ell S start h v z a b hell hS hr hs hsS hcons htS hside hma hta hab hbS harrP harrC | |
| have hw1 := hwβ.trans_le hw | |
| have hell0 : 0 < ell := by linarith | |
| have hnvalid := terminal_valid hs h.admissible | |
| have hngap := terminal_gap_positive hell0.le hr hs h.admissible | |
| have hnS := terminal_ratio_le hsS h.admissible | |
| have hncons := history_consistent hell0.le hr hs hcons h | |
| have htvalid : Valid h.node.side (stateRatio z.1) := by rw [hside]; exact stateRatio_valid z.1 | |
| have hta' : minRatio h.node.side (stateRatio z.1) < a := by rwa [hside] | |
| have ha : 0 < a := (PrimeTiltMonotone.minRatio_pos hnvalid).trans hma | |
| have hlow : (1/2 : β) β€ h.node.gap/(b+1) := by | |
| have h : ell β€ h.node.gap/(b+1) := by | |
| apply (le_div_iffβ (by linarith : 0 < b+1)).mpr | |
| have hm := (le_div_iffβ hell0).mp (show b+1 β€ h.node.gap/ell by linarith) | |
| nlinarith | |
| linarith | |
| rw [chain_full_bin_real h hw1 hell0 hngap hnvalid hncons hma hab hbS harrP, | |
| continuousChain_full_bin_real v hell0 z hbS harrC, β hside] | |
| exact (abs_sub_le _ (continuousBin h.node.side h.node.ratio a b) _).trans (add_le_add | |
| (hprime w hw h.node.gap S hngap hS h.node.side h.node.ratio a b hnvalid hnS hma.le hab hbS hlow) | |
| (hparent S hS h.node.side h.node.ratio (stateRatio z.1) a b hnvalid htvalid hnS htS hma.le hta'.le)) | |
| end NumberTheoryLean.NearbyParentFullBins | |
| end | |
| section | |
| namespace NumberTheoryLean.ActualSupportIntervals | |
| open _root_.Set _root_.MeasureTheory ProbabilityTheory | |
| open scoped ENNReal | |
| open FinitePathGeometry FinitePathMeasures PrimeHistories PrimeKilledChain | |
| open PrimeTiltGeometry ActualCouplingUpdates ContinuousKilledBins LowStateHorizon | |
| open ArrivalKernelGeometry RegeneratingInverseBands PairedCostGrouping | |
| noncomputable def upperSupport (S ell r : β) : β := min S (r/ell-1) | |
| theorem prime_child_interval {w ell S : β} {start : Node} (h : History w ell S start) | |
| (hell : 0 < ell) (hr : 0 < h.node.gap) (hs : Valid h.node.side h.node.ratio) | |
| (p : β) (hp : p β nodeChildren w ell S h.node) : | |
| (h.append p hp).node.ratio β Icc (minRatio h.node.side h.node.ratio) (upperSupport S ell h.node.gap) := by | |
| classical | |
| have hp' := (Finset.mem_filter.mp hp).2 | |
| have ht0 := valid_pos (child_valid hs hp) | |
| have hx := hp'.1 | |
| have heq := nextExponent_childRatio hr (child_exponent_positive hell.le hp) | |
| have hu : childRatio w h.node.gap p < h.node.gap/ell-1 := by | |
| rw [β heq] at hx | |
| have hmul := (lt_div_iffβ (by linarith : 0 < childRatio w h.node.gap p+1)).mp hx | |
| have hdiv : childRatio w h.node.gap p+1 < h.node.gap/ell := (lt_div_iffβ hell).mpr (by nlinarith) | |
| linarith | |
| rw [History.append_node] | |
| exact β¨hp'.2.2.1,le_min hp'.2.2.2 hu.leβ© | |
| theorem prime_row_interval {w ell S : β} {start : Node} (h : History w ell S start) | |
| (hell : 0 < ell) (hr : 0 < h.node.gap) (hs : Valid h.node.side h.node.ratio) : | |
| βα΅ k βchain w ell S start (some h), | |
| match k with | |
| | none => True | |
| | some k => k.node.ratio β Icc (minRatio h.node.side h.node.ratio) (upperSupport S ell h.node.gap) := by | |
| filter_upwards [prime_follows h] with k hk | |
| cases k with | |
| | none => trivial | |
| | some k => | |
| obtain β¨p,hp,rflβ© := hk | |
| exact prime_child_interval h hell hr hs p hp | |
| theorem costKernel_lower_support (z : CostState) : | |
| βα΅ y βcostKernel z, minRatio (stateSide z.1) (stateRatio z.1) β€ stateRatio y.1 := by | |
| have hm : Measurable (fun s : State => (s,z.2+cost (stateRatio s))) := | |
| measurable_id.prodMk (measurable_const.add (cost_measurable.comp stateRatio_measurable)) | |
| have hP : MeasurableSet {y : CostState | minRatio (stateSide z.1) (stateRatio z.1) β€ stateRatio y.1} := | |
| measurableSet_le measurable_const (stateRatio_measurable.comp measurable_fst) | |
| rw [costKernel_eq_map] | |
| exact (ae_map_iff hm.aemeasurable hP).mpr (stateKernel_ae_minRatio z.1) | |
| theorem continuous_interval_measurable (v ell S : β) (z : CostState) : | |
| MeasurableSet {y : CostState | stateRatio y.1 β | |
| Icc (minRatio (stateSide z.1) (stateRatio z.1)) (upperSupport S ell (gapValue v z))} := | |
| (stateRatio_measurable.comp measurable_fst) measurableSet_Icc | |
| theorem continuous_low_interval (v S : β) {ell : β} (hell : 0 < ell) (z : CostState) : | |
| βα΅ y βlowKernel costKernel v ell S z, stateRatio y.1 β | |
| Icc (minRatio (stateSide z.1) (stateRatio z.1)) (upperSupport S ell (gapValue v z)) := by | |
| rw [lowKernel,Kernel.restrict_apply] | |
| filter_upwards [ae_restrict_of_ae (costKernel_time_update z),ae_restrict_of_ae (costKernel_lower_support z), | |
| ae_restrict_mem (lowDomain_measurable v ell S)] with y htime hlo hD | |
| have hy : y = (y.1,z.2+cost (stateRatio y.1)) := Prod.ext rfl htime | |
| have hcur : currentExponent v y = nextExponent (gapValue v z) (stateRatio y.1) := by | |
| calc | |
| _ = currentExponent v (y.1,z.2+cost (stateRatio y.1)) := congrArg (currentExponent v) hy | |
| _ = _ := currentExponent_update v z y.1 | |
| have hupper : stateRatio y.1 < gapValue v z/ell-1 := by | |
| have hx : ell < nextExponent (gapValue v z) (stateRatio y.1) := by | |
| rw [β hcur] | |
| exact hD.1 | |
| have ht0 := OccupationBoundaries.stateRatio_pos y.1 | |
| have hmul := (lt_div_iffβ (by linarith : 0 < stateRatio y.1+1)).mp hx | |
| have hdiv : stateRatio y.1+1 < gapValue v z/ell := (lt_div_iffβ hell).mpr (by nlinarith) | |
| linarith | |
| exact β¨hlo,le_min hD.2 hupper.leβ© | |
| theorem continuous_row_interval (v S : β) {ell : β} (hell : 0 < ell) (z : CostState) : | |
| βα΅ y βcontinuousChain v ell S (.inl z), liftPredicate (fun y : CostState => stateRatio y.1 β | |
| Icc (minRatio (stateSide z.1) (stateRatio z.1)) (upperSupport S ell (gapValue v z))) y := | |
| complete_ae _ z (continuous_interval_measurable v ell S z) (continuous_low_interval v S hell z) | |
| end NumberTheoryLean.ActualSupportIntervals | |
| end | |
| section | |
| namespace NumberTheoryLean.ActualMeshBins | |
| open _root_.Set _root_.MeasureTheory ProbabilityTheory | |
| open scoped ENNReal | |
| open FinitePathGeometry FinitePathMeasures PrimeHistories PrimeKilledChain | |
| open ActualProcessCoupling ActualCouplingSupport ActualPrimeBins ContinuousKilledBins | |
| open MeshRatioLabels MeshBoundaryGeometry ActualSupportIntervals PrimeBinMembership | |
| open NearbyParentFullBins ContinuousRatioBins RegeneratingInverseBands | |
| variable {w ell S : β} {start : Node} | |
| theorem prime_label_eq_bin {mesh : β} (hm : 0 < mesh) (hs : Valid start.side start.ratio) | |
| (hsS : start.ratio β€ S) (j : Label S mesh) (hj : j β cemeteryLabel S mesh) : | |
| (primeLabel w ell S mesh start) β»ΒΉ' {j} = liveBin (lowerEdge j) (upperEdge j) := by | |
| ext p | |
| cases p with | |
| | none => | |
| change cemeteryLabel S mesh = j β False | |
| simp [Ne.symm hj] | |
| | some h => | |
| have ht := valid_pos (terminal_valid hs h.admissible) | |
| have hS := terminal_ratio_le hsS h.admissible | |
| exact ratioLabel_eq_iff hm ht.le hS j | |
| theorem continuous_label_mass_eq_bin (v ell S : β) {mesh : β} (hm : 0 < mesh) | |
| (z : CostState) (j : Label S mesh) (hj : j β cemeteryLabel S mesh) : | |
| continuousChain v ell S (.inl z) ((continuousLabel S mesh) β»ΒΉ' {j}) = | |
| continuousChain v ell S (.inl z) (Sum.inl '' ratioBinSet (lowerEdge j) (upperEdge j)) := by | |
| apply measure_congr | |
| filter_upwards [continuous_supported v ell S (.inl z)] with y hy | |
| apply propext | |
| cases y with | |
| | inr u => | |
| change (cemeteryLabel S mesh = j) β β x β ratioBinSet (lowerEdge j) (upperEdge j), (Sum.inl x : CemeteryKernel.Space CostState) = Sum.inr u | |
| simp [Ne.symm hj] | |
| | inl y => | |
| have heq := ratioLabel_eq_iff hm (OccupationBoundaries.stateRatio_pos y.1).le hy j | |
| change (ratioLabel S mesh (stateRatio y.1) = j) β β x β ratioBinSet (lowerEdge j) (upperEdge j), (Sum.inl x : CemeteryKernel.Space CostState) = Sum.inl y | |
| simpa only [Set.mem_image,Sum.inl.injEq,exists_eq_right,ratioBinSet,mem_ofPred_eq,lowerEdge,upperEdge] using heq | |
| theorem cell_below_S_not_cemetery {S mesh : β} (hm : 0 < mesh) (j : Label S mesh) | |
| (hj : upperEdge j β€ S) : j β cemeteryLabel S mesh := by | |
| intro heq | |
| subst j | |
| have hf := Nat.lt_floor_add_one (S/mesh) | |
| have hmul : S < ((βS/meshββ:β)+1)*mesh := (div_lt_iffβ hm).mp hf | |
| change (((binCount S mesh+1:β):β)+1)*mesh β€ S at hj | |
| simp only [Nat.cast_add,Nat.cast_one,binCount] at hj | |
| nlinarith | |
| theorem mesh_cells_disjoint {S mesh : β} (hm : 0 < mesh) : | |
| Pairwise (fun j k : Label S mesh => Disjoint (Ico (lowerEdge j) (upperEdge j)) (Ico (lowerEdge k) (upperEdge k))) := by | |
| intro j k hjk | |
| apply Set.disjoint_left.mpr | |
| intro t htj htk | |
| have hne : j.val β k.val := fun h => hjk (Fin.ext h) | |
| rcases lt_or_gt_of_ne hne with hlt | hgt | |
| Β· have hle : (j.val:β)+1 β€ (k.val:β) := by exact_mod_cast Nat.succ_le_of_lt hlt | |
| have he : upperEdge j β€ lowerEdge k := mul_le_mul_of_nonneg_right hle hm.le | |
| exact (htj.2.trans_le (he.trans htk.1)).false | |
| Β· have hle : (k.val:β)+1 β€ (j.val:β) := by exact_mod_cast Nat.succ_le_of_lt hgt | |
| have he : upperEdge k β€ lowerEdge j := mul_le_mul_of_nonneg_right hle hm.le | |
| exact (htk.2.trans_le (he.trans htj.1)).false | |
| theorem continuous_mesh_sum_le_one {S mesh s : β} {i : Side} (hm : 0 < mesh) (hs : Valid i s) | |
| (I : Finset (Label S mesh)) : | |
| (β j β I,continuousBin i s (lowerEdge j) (upperEdge j)) β€ 1 := by | |
| let := weightedRatioLaw_probability hs | |
| have hUnion := measure_biUnion_finset (ΞΌ:=weightedRatioLaw i s) | |
| (s:=I) (f:=fun j => Ico (lowerEdge j) (upperEdge j)) | |
| (fun _ _ _ _ hne => mesh_cells_disjoint hm hne) (fun _ _ => measurableSet_Ico) | |
| have hmass : (β j β I,weightedRatioLaw i s (Ico (lowerEdge j) (upperEdge j))) β€ 1 := by | |
| rw [β hUnion] | |
| exact (measure_mono (subset_univ _)).trans_eq measure_univ | |
| unfold continuousBin | |
| rw [β ENNReal.toReal_sum (fun j _ => measure_ne_top (weightedRatioLaw i s) (Ico (lowerEdge j) (upperEdge j)))] | |
| simpa only [ENNReal.toReal_one] using ENNReal.toReal_mono ENNReal.one_ne_top hmass | |
| theorem common_cell_error : β c C D wβ : β, 0 < c β§ 0 < C β§ 0 < D β§ 1 < wβ β§ | |
| β w : β, wβ β€ w β β ell S : β, β start : Node, β h : History w ell S start, | |
| β v : β, β z : CostState, β mesh : β, β j : Label S mesh, | |
| 1 β€ ell β 3 β€ S β 0 < start.gap β Valid start.side start.ratio β start.ratio β€ S β Consistent start β | |
| stateRatio z.1 β€ S β h.node.side = stateSide z.1 β 0 < mesh β | |
| fullCell (minRatio h.node.side h.node.ratio) (minRatio (stateSide z.1) (stateRatio z.1)) | |
| (upperSupport S ell h.node.gap) (upperSupport S ell (gapValue v z)) j β | |
| |(chain w ell S start (some h) ((primeLabel w ell S mesh start) β»ΒΉ' {j})).toReal- | |
| (continuousChain v ell S (.inl z) ((continuousLabel S mesh) β»ΒΉ' {j})).toReal| β€ | |
| C*(1+S)^5*(mesh^2+Real.exp (-c*Real.sqrt ((1/2:β)*Real.log w)))+ | |
| epsilon w*continuousBin h.node.side h.node.ratio (lowerEdge j) (upperEdge j)+ | |
| (Real.exp (D*(1+S)^3*|h.node.ratio-stateRatio z.1|)-1)* | |
| continuousBin (stateSide z.1) (stateRatio z.1) (lowerEdge j) (upperEdge j) := by | |
| obtain β¨c,C,D,wβ,hc,hC,hD,hwβ,hboundβ© := nearby_parent_full_bin_error | |
| refine β¨c,C,D,wβ,hc,hC,hD,hwβ,?_β© | |
| intro w hw ell S start h v z mesh j hell hS hr hs hsS hcons hzS hside hm hcell | |
| have hLd := (le_max_left _ _).trans_lt hcell.1 | |
| have hLc := (le_max_right _ _).trans_lt hcell.1 | |
| have hUd := hcell.2.trans (min_le_left _ _) | |
| have hUc := hcell.2.trans (min_le_right _ _) | |
| have hbS := hUd.trans (min_le_left _ _) | |
| have hbp := hUd.trans (min_le_right _ _) | |
| have hbc := hUc.trans (min_le_right _ _) | |
| have hj := cell_below_S_not_cemetery hm j hbS | |
| rw [prime_label_eq_bin hm hs hsS j hj,continuous_label_mass_eq_bin v ell S hm z j hj] | |
| have hab : lowerEdge j β€ upperEdge j := by unfold lowerEdge upperEdge; nlinarith | |
| have he := hbound w hw ell S start h v z (lowerEdge j) (upperEdge j) hell hS hr hs hsS hcons hzS hside hLd hLc hab hbS hbp hbc | |
| have hwidth : upperEdge j-lowerEdge j = mesh := by unfold upperEdge lowerEdge; ring | |
| rwa [hwidth] at he | |
| end NumberTheoryLean.ActualMeshBins | |
| end | |
| section | |
| namespace NumberTheoryLean.CommonCellSum | |
| open _root_.Set _root_.Finset _root_.MeasureTheory ProbabilityTheory | |
| open FinitePathGeometry FinitePathMeasures PrimeHistories PrimeKilledChain | |
| open MeshRatioLabels MeshBoundaryGeometry ActualSupportIntervals ActualMeshBins | |
| open ActualProcessCoupling ContinuousKilledBins PrimeBinMembership | |
| open ContinuousRatioBins RegeneratingInverseBands KernelBinConditioning | |
| theorem common_cell_sum_error : β c C D wβ : β, 0 < c β§ 0 < C β§ 0 < D β§ 1 < wβ β§ | |
| β w : β, wβ β€ w β β ell S : β, β start : Node, β h : History w ell S start, | |
| β v : β, β z : CostState, β mesh : β, β I : Finset (Label S mesh), | |
| 1 β€ ell β 3 β€ S β 0 < start.gap β Valid start.side start.ratio β start.ratio β€ S β Consistent start β | |
| stateRatio z.1 β€ S β h.node.side = stateSide z.1 β 0 < mesh β | |
| (β j β I, fullCell (minRatio h.node.side h.node.ratio) (minRatio (stateSide z.1) (stateRatio z.1)) | |
| (upperSupport S ell h.node.gap) (upperSupport S ell (gapValue v z)) j) β | |
| (β j β I, |labelMass (chain w ell S start) (primeLabel w ell S mesh start) (some h) j- | |
| labelMass (continuousChain v ell S) (continuousLabel S mesh) (.inl z) j|) β€ | |
| (S/mesh+2)*(C*(1+S)^5*(mesh^2+Real.exp (-c*Real.sqrt ((1/2:β)*Real.log w))))+ | |
| epsilon w+(Real.exp (D*(1+S)^3*|h.node.ratio-stateRatio z.1|)-1) := by | |
| obtain β¨c,C,D,wβ,hc,hC,hD,hwβ,hboundβ© := common_cell_error | |
| refine β¨c,C,D,wβ,hc,hC,hD,hwβ,?_β© | |
| intro w hw ell S start h v z mesh I hell hS hr hs hsS hcons hzS hside hm hcells | |
| let A := C*(1+S)^5*(mesh^2+Real.exp (-c*Real.sqrt ((1/2:β)*Real.log w))) | |
| let Q := Real.exp (D*(1+S)^3*|h.node.ratio-stateRatio z.1|)-1 | |
| let P : Label S mesh β β := fun j => continuousBin h.node.side h.node.ratio (lowerEdge j) (upperEdge j) | |
| let R : Label S mesh β β := fun j => continuousBin (stateSide z.1) (stateRatio z.1) (lowerEdge j) (upperEdge j) | |
| have hS1 : 0 β€ 1+S := by linarith | |
| have hA : 0 β€ A := by dsimp [A]; positivity | |
| have hQ : 0 β€ Q := by | |
| apply sub_nonneg.mpr | |
| apply Real.one_le_exp_iff.mpr | |
| positivity | |
| have hPsum : (β j β I,P j) β€ 1 := continuous_mesh_sum_le_one hm (terminal_valid hs h.admissible) I | |
| have hRsum : (β j β I,R j) β€ 1 := continuous_mesh_sum_le_one hm (stateRatio_valid z.1) I | |
| have hcard : (I.card:β) β€ S/mesh+2 := by | |
| have h : (I.card:β) β€ (Fintype.card (Label S mesh):β) := by exact_mod_cast Finset.card_le_univ I | |
| exact h.trans (label_card_le (by linarith) hm) | |
| calc | |
| _ β€ β j β I,(A+epsilon w*P j+Q*R j) := by | |
| apply Finset.sum_le_sum | |
| intro j hj | |
| exact hbound w hw ell S start h v z mesh j hell hS hr hs hsS hcons hzS hside hm (hcells j hj) | |
| _ = (I.card:β)*A+epsilon w*(β j β I,P j)+Q*(β j β I,R j) := by | |
| simp only [Finset.sum_add_distrib,Finset.sum_const,nsmul_eq_mul,β Finset.mul_sum] | |
| _ β€ _ := by | |
| have h1 := mul_le_mul_of_nonneg_right hcard hA | |
| have h2 := mul_le_mul_of_nonneg_left hPsum (epsilon_pos w).le | |
| have h3 := mul_le_mul_of_nonneg_left hRsum hQ | |
| dsimp only [A,Q] at h1 h3 β’ | |
| linarith | |
| end NumberTheoryLean.CommonCellSum | |
| end | |
| end Erdos970 | |
| end OAI | |