Download data/lean/OAI/Geometry/PinnedDistances/ArithmeticVariance.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 8.49 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/PinnedDistances/ArithmeticVariance.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Geometry/PinnedDistances/ArithmeticVariance.lean
-
curl -L -o ArithmeticVariance.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/PinnedDistances/ArithmeticVariance.lean
8.49 kB
| import OAI.Geometry.PinnedDistances.Variance | |
| namespace OAI | |
| universe u1 u2 u3 u4 u5 u6 u7 | |
| section | |
| noncomputable section | |
| open NumberField | |
| open scoped BigOperators | |
| noncomputable section | |
| open MeasureTheory | |
| open scoped Topology | |
| noncomputable section | |
| open MeasureTheory | |
| open scoped Topology ENNReal | |
| noncomputable section | |
| open MeasureTheory NumberField | |
| open scoped BigOperators | |
| noncomputable section | |
| open scoped BigOperators | |
| open MeasureTheory | |
| namespace WeakPinned.Global | |
| open Hierarchy | |
| variable {P : Type u1} [Fintype P] [DecidableEq P] | |
| variable {K : Type u2} [Field K] [NumberField K] | |
| variable (Z : P β K) (hZ : Function.Injective Z) | |
| def cellMass (C : Finset P) : β := | |
| (β v : InfinitePlace K, Arithmetic.archWeight v * β« Ο, (arch Z v Ο).mass C βGrid.fullLaw) + | |
| (Module.finrank β K : β)β»ΒΉ * β v β badPlaces Z hZ, (finite Z hZ v).mass C | |
| lemma cellMass_nonneg (C : Finset P) : 0 β€ cellMass Z hZ C := by | |
| exact add_nonneg | |
| (Finset.sum_nonneg (fun v _ => mul_nonneg (Arithmetic.archWeight_nonneg v) | |
| (integral_nonneg (fun Ο => (arch Z v Ο).mass_nonneg C)))) | |
| (mul_nonneg (by positivity) (Finset.sum_nonneg (fun v _ => (finite Z hZ v).mass_nonneg C))) | |
| lemma cellMass_singleton (C : Finset P) (hC : C.card β€ 1) : cellMass Z hZ C = 0 := by | |
| simp only [cellMass, Depth.mass_singleton _ C hC, integral_zero, mul_zero, Finset.sum_const_zero, add_zero] | |
| lemma cellMass_overlap (hn : 2 β€ Fintype.card P) (x y : P) (hxy : x β y) : | |
| (β C, cellMass Z hZ C * (if x β C β§ y β C then (1 : β) else 0)) = L Z hZ x y hxy := by | |
| simp only [cellMass, add_mul, Finset.sum_add_distrib, Finset.sum_mul, | |
| mul_assoc, L] | |
| rw [β Finset.mul_sum] | |
| congr 1 | |
| Β· rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro v _ | |
| rw [β Finset.mul_sum, Depth.averaged_mass_overlap (arch Z v) (arch_measurable Z hZ v) | |
| (arch_integrable Z hZ v) hn x y hxy] | |
| Β· congr 1 | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro v _ | |
| exact (finite Z hZ v).mass_overlap hn x y hxy | |
| end WeakPinned.Global | |
| namespace WeakPinned.Variance | |
| variable {P : Type u3} [Fintype P] [DecidableEq P] | |
| /-- Finite linear model of the actual occurrence integral on expressions | |
| vanishing on singleton and empty cells. Multiplicities are in m. -/ | |
| def weightedIntegral (m : Finset P β β) (f : Finset P β β) : β := β C, m C * f C | |
| def weightedOverlap (m : Finset P β β) (x y : P) : β := | |
| weightedIntegral m (fun C => if x β C β§ y β C then 1 else 0) | |
| lemma weighted_cancel (m : Finset P β β) (b : β) (S : P β β) | |
| (hL : β x y, x β y β weightedOverlap m x y = b+S x+S y) | |
| (B : Finset P) (hB : 2 β€ B.card) : weightedIntegral m (signedCell B) = 0 := by | |
| have he : weightedIntegral m (signedCell B) = | |
| β x, β y, signedPair B x y * weightedOverlap m x y := by | |
| simp only [weightedIntegral, signedCell_eq] | |
| have hc (C : Finset P) : (β x β C, β y β C, signedPair B x y) = | |
| β x, β y, signedPair B x y * (if x β C β§ y β C then (1:β) else 0) := by | |
| simp only [mul_ite, mul_one, mul_zero, ite_and] | |
| simp only [Finset.sum_ite_irrel, Finset.sum_const_zero] | |
| simp | |
| simp_rw [hc, Finset.mul_sum] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro y _ | |
| simp only [weightedOverlap, weightedIntegral, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro C _ | |
| ring | |
| rw [he] | |
| exact variance_cancel B hB _ b S hL | |
| lemma weighted_variance {I : Type u4} [Fintype I] | |
| (m : Finset P β β) (hm : β C, 0 β€ m C) (b : β) (S : P β β) | |
| (hL : β x y, x β y β weightedOverlap m x y = b+S x+S y) | |
| (w : I β β) (B : I β Finset P) (T M Ξ΅ Ο : β) | |
| (hw : β i, 0 β€ w i) (hW : (β i, w i) β€ 1) | |
| (hT : 1 β€ T) (hM : 0 β€ M) (hΞ΅ : 0 β€ Ξ΅) (hΟ : 0 < Ο) | |
| (hscale : Ο * Fintype.card P β€ T) | |
| (hB : β i, 2 β€ (B i).card) | |
| (hk : β i, 1 / (((B i).card : β)-1) β€ Ξ΅) | |
| (hn : 1 / ((Fintype.card P : β)-1) β€ Ξ΅) | |
| (hdom : β x, (β i, w i * prob (B i) x) β€ M * prob Finset.univ x) : | |
| weightedIntegral m (varianceCell w B T) β€ | |
| (2*Ξ΅*(M+1)/Ο)*weightedIntegral m (pairCell Finset.univ) + | |
| 4*M*weightedIntegral m (fun C => if (C.card : β) β€ T then pairCell Finset.univ C else 0) := by | |
| have hh := Finset.sum_le_sum (s := Finset.univ) (fun C _ => | |
| mul_le_mul_of_nonneg_left | |
| (varianceCell_bound w B T M Ξ΅ Ο hw hW hT hM hΞ΅ hΟ hscale hB hk hn hdom C) (hm C)) | |
| simp only [mul_add, Finset.sum_add_distrib] at hh | |
| have hz : (β C, m C * β i, w i * signedCell (B i) C) = 0 := by | |
| simp_rw [Finset.mul_sum] | |
| rw [Finset.sum_comm] | |
| have hi (i : I) : (β C, m C * (w i * signedCell (B i) C)) = 0 := by | |
| calc | |
| _ = w i * weightedIntegral m (signedCell (B i)) := by | |
| simp only [weightedIntegral, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro C _ | |
| ring | |
| _ = 0 := by rw [weighted_cancel m b S hL _ (hB i),mul_zero] | |
| simp_rw [hi] | |
| exact Finset.sum_const_zero | |
| rw [hz,zero_add] at hh | |
| simp only [β mul_add] at hh | |
| change weightedIntegral m (varianceCell w B T) β€ _ at hh | |
| have heβ : (β C, m C * (2*Ξ΅*(M+1)/Ο * pairCell Finset.univ C)) = | |
| (2*Ξ΅*(M+1)/Ο)*weightedIntegral m (pairCell Finset.univ) := by | |
| simp only [weightedIntegral, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro C _ | |
| ring | |
| have heβ : (β C, m C * (4*M*(if (C.card : β) β€ T then pairCell Finset.univ C else 0))) = | |
| 4*M*weightedIntegral m (fun C => if (C.card : β) β€ T then pairCell Finset.univ C else 0) := by | |
| simp only [weightedIntegral, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro C _ | |
| ring | |
| rwa [heβ,heβ] at hh | |
| end WeakPinned.Variance | |
| namespace WeakPinned.Global | |
| open Hierarchy Variance | |
| variable {P : Type u5} [Fintype P] [DecidableEq P] | |
| variable {K : Type u6} [Field K] [NumberField K] | |
| variable (Zβ Zβ : P β K) (hβ : Function.Injective Zβ) (hβ : Function.Injective Zβ) | |
| def totalMass (C : Finset P) : β := cellMass Zβ hβ C + cellMass Zβ hβ C | |
| def totalPotential (x : P) : β := S Zβ hβ x + S Zβ hβ x | |
| def baseConstant : β := 2*Grid.kappa - M Zβ hβ - M Zβ hβ | |
| lemma totalMass_nonneg (C : Finset P) : 0 β€ totalMass Zβ Zβ hβ hβ C := | |
| add_nonneg (cellMass_nonneg Zβ hβ C) (cellMass_nonneg Zβ hβ C) | |
| lemma totalPotential_nonneg (x : P) : 0 β€ totalPotential Zβ Zβ hβ hβ x := | |
| add_nonneg (S_nonneg Zβ hβ x) (S_nonneg Zβ hβ x) | |
| lemma totalMass_overlap (hn : 2 β€ Fintype.card P) (x y : P) (hxy : x β y) : | |
| weightedOverlap (totalMass Zβ Zβ hβ hβ) x y = | |
| baseConstant Zβ Zβ hβ hβ + totalPotential Zβ Zβ hβ hβ x + totalPotential Zβ Zβ hβ hβ y := by | |
| simp only [weightedOverlap,weightedIntegral,totalMass,add_mul,Finset.sum_add_distrib] | |
| rw [cellMass_overlap Zβ hβ hn x y hxy,cellMass_overlap Zβ hβ hn x y hxy, | |
| coordinate_overlap_identity Zβ hβ hn x y hxy,coordinate_overlap_identity Zβ hβ hn x y hxy] | |
| simp only [baseConstant,totalPotential] | |
| ring | |
| /-- Unconditional arithmetic-hierarchy instance of the quantitative variance | |
| bound. The overlap identity follows from the product formula, and the | |
| family hypotheses are exactly finite sampling data. -/ | |
| theorem arithmetic_variance {I : Type u7} [Fintype I] | |
| (hnP : 2 β€ Fintype.card P) | |
| (w : I β β) (B : I β Finset P) (T Mβ Ξ΅ Ο : β) | |
| (hw : β i, 0 β€ w i) (hW : (β i, w i) β€ 1) | |
| (hT : 1 β€ T) (hM : 0 β€ Mβ) (hΞ΅ : 0 β€ Ξ΅) (hΟ : 0 < Ο) | |
| (hscale : Ο * Fintype.card P β€ T) | |
| (hB : β i, 2 β€ (B i).card) | |
| (hk : β i, 1 / (((B i).card : β)-1) β€ Ξ΅) | |
| (hn : 1 / ((Fintype.card P : β)-1) β€ Ξ΅) | |
| (hdom : β x, (β i, w i * prob (B i) x) β€ Mβ * prob Finset.univ x) : | |
| weightedIntegral (totalMass Zβ Zβ hβ hβ) (varianceCell w B T) β€ | |
| (2*Ξ΅*(Mβ+1)/Ο)*weightedIntegral (totalMass Zβ Zβ hβ hβ) (pairCell Finset.univ) + | |
| 4*Mβ*weightedIntegral (totalMass Zβ Zβ hβ hβ) | |
| (fun C => if (C.card : β) β€ T then pairCell Finset.univ C else 0) := | |
| weighted_variance _ (totalMass_nonneg Zβ Zβ hβ hβ) _ _ | |
| (totalMass_overlap Zβ Zβ hβ hβ hnP) w B T Mβ Ξ΅ Ο hw hW hT hM hΞ΅ hΟ hscale hB hk hn hdom | |
| end WeakPinned.Global | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end OAI | |