Add lean source and binary files (part 58)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevHorizontal03.leanAdded+354
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevTail01.leanAdded+369
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevTail02.leanAdded+337
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevTail03.leanAdded+273
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevWeighted01.leanAdded+290
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevWeighted02.leanAdded+273
- lean/OAI/Combinatorics/SumProduct/Alignment/MenuLiteral01.leanAdded+172
- lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellFibers01.leanAdded+263
- lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellHarmonic01.leanAdded+282
- lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellSaturation01.leanAdded+400
- lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellScale01.leanAdded+334
- lean/OAI/Combinatorics/SumProduct/Alignment/NearLattice01.leanAdded+314
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail01.leanAdded+316
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail02.leanAdded+279
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail03.leanAdded+271
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail04.leanAdded+302
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail05.leanAdded+342
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail06.leanAdded+369
- lean/OAI/Combinatorics/SumProduct/Alignment/ParametricSmooth01.leanAdded+408
- lean/OAI/Combinatorics/SumProduct/Alignment/PhysicalDecay01.leanAdded+332
- lean/OAI/Combinatorics/SumProduct/Alignment/PivotExtension01.leanAdded+312
- lean/OAI/Combinatorics/SumProduct/Alignment/PivotExtension02.leanAdded+368
- lean/OAI/Combinatorics/SumProduct/Alignment/PivotPaths01.leanAdded+276
- lean/OAI/Combinatorics/SumProduct/Alignment/PivotPaths02.leanAdded+406
- lean/OAI/Combinatorics/SumProduct/Alignment/PivotPaths03.leanAdded+416
- lean/OAI/Combinatorics/SumProduct/Alignment/PointLaw01.leanAdded+289
- lean/OAI/Combinatorics/SumProduct/Alignment/PointLaw02.leanAdded+255
- lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialArray01.leanAdded+279
- lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialCharacter01.leanAdded+342
- lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialDephasing01.leanAdded+477
- lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialLine01.leanAdded+360
- lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialWeyl01.leanAdded+618
- lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure01.leanAdded+275
- lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure02.leanAdded+369
- lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure03.leanAdded+266
- lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure04.leanAdded+297
- lean/OAI/Combinatorics/SumProduct/Alignment/ProgressionPartition01.leanAdded+259
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalEchelon01.leanAdded+321
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalEchelon02.leanAdded+361
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalFactor01.leanAdded+308
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice01.leanAdded+257
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice02.leanAdded+291
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice03.leanAdded+308
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice04.leanAdded+367
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice05.leanAdded+443
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice06.leanAdded+309
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice07.leanAdded+289
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice08.leanAdded+414
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice09.leanAdded+267
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice10.leanAdded+269
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.CharacterFactorization01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionopen scoped BigOperators commutatorElementopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionendend
sectionopen scoped BigOperators commutatorElementnoncomputable sectionnamespace RealCharactersvariable {G : Type*} [Group G]def scaledFamily (Ξ : Finset (G →* Multiplicative ℝ)) (R : ℕ) : Finset (G →* Multiplicative ℝ) := by classical exact Ξ.biUnion (fun χ => (Finset.Icc (-(R:ℤ)) (R:ℤ)).image (intScale χ))lemma mem_scaledFamily {Ξ : Finset (G →* Multiplicative ℝ)} {R : ℕ} {χ : G →* Multiplicative ℝ} {q : ℤ} (hχ : χ∈Ξ) (hq : |q| ≤ R) : intScale χ q∈scaledFamily Ξ R := by classical exact Finset.mem_biUnion.mpr ⟨χ,hχ,Finset.mem_image.mpr ⟨q,Finset.mem_Icc.mpr (abs_le.mp hq),rfl⟩⟩lemma scaledFamily_continuous [TopologicalSpace G] (Ξ : Finset (G →* Multiplicative ℝ)) (R : ℕ) (hχ : ∀ χ∈Ξ, Continuous χ) : ∀ χ∈scaledFamily Ξ R, Continuous χ := by classical intro χ hm obtain ⟨ψ,hψ,hm⟩ := Finset.mem_biUnion.mp hm obtain ⟨q,hq,rfl⟩ := Finset.mem_image.mp hm exact intScale_continuous ψ q (hχ ψ hψ)lemma scaledFamily_integral (Ξ : Finset (G →* Multiplicative ℝ)) (R : ℕ) (Γ : Subgroup G) (hχ : ∀ χ∈Ξ, ∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z) : ∀ χ∈scaledFamily Ξ R, ∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z := by classical intro χ hm obtain ⟨ψ,hψ,hm⟩ := Finset.mem_biUnion.mp hm obtain ⟨q,hq,rfl⟩ := Finset.mem_image.mp hm exact intScale_integral ψ q Γ (hχ ψ hψ)end RealCharactersnamespace MalcevHorizontalopen RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n d : ℕ} (c : RealCoordinates G n) (hd : d ≤ n)variable (hlin : ∀ i : Fin d, c.correction (Fin.castLE hd i)=0)def boundedCharacters (R : ℕ) : Finset (G →* Multiplicative ℝ) := by classical exact (Fintype.piFinset (fun _ : Fin d => Finset.Icc (-(R:ℤ)) (R:ℤ))).image (character c hd hlin)omit [IsTopologicalGroup G] inlemma mem_boundedCharacters (R : ℕ) (k : Fin d → ℤ) (hk : ∀ i, |k i| ≤ R) : character c hd hlin k∈boundedCharacters c hd hlin R := by classical exact Finset.mem_image.mpr ⟨k,Fintype.mem_piFinset.mpr (fun i => Finset.mem_Icc.mpr (abs_le.mp (hk i))),rfl⟩omit [IsTopologicalGroup G] inlemma boundedCharacters_continuous (R : ℕ) : ∀ χ∈boundedCharacters c hd hlin R, Continuous χ := by classical intro χ hm obtain ⟨k,hk,rfl⟩ := Finset.mem_image.mp hm exact character_continuous c hd hlin komit [IsTopologicalGroup G] inlemma boundedCharacters_integral (R : ℕ) (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z) : ∀ χ∈boundedCharacters c hd hlin R, ∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z := by classical intro χ hm obtain ⟨k,hk,rfl⟩ := Finset.mem_image.mp hm exact fun _ hg => character_integer c hd hlin Γ hΓ k hgend MalcevHorizontalendend
sectionnoncomputable sectionopen scoped BigOperators commutatorElementopen _root_.Polynomial _root_.OAI.Polynomialnamespace MalcevHorizontalopen RationalLattice CubeFaces LeibmanSquare SquareHorizontalCharacteropen RealCharacters CharacterFactorization MalcevCharactersvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] [T2Space G]variable {n d m : ℕ} (c : RealCoordinates G n) (hd : d ≤ n)variable (hlin : ∀ i : Fin d, c.correction (Fin.castLE hd i)=0)variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)variable [∀ i, (H.level i).Normal]variable (hlevel : ∀ g : G, g∈H.level 2 ↔ horizontal c hd g=0)variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)variable (c₂ : RealCoordinates (H.level 2) m) (hsk₂ : SecondKind c₂)variable (hΓ₂ : ∀ x : H.level 2, x.val∈Γ ↔ ∀ i, ∃ z : ℤ, c₂.coord x i=z)
include hlin hlevel hΓ hsk₂ hΓ₂ in
theorem uniform_character_or_proper_factorization (s : ℕ) (hs2 : 2 ≤ s) (hs : H.level (s+1)=⊥) (r : Fin (s+1) → ℕ) (hlevel₂ : ∀ i (x : H.level 2), x.val∈H.level (i.val+2) ↔ ∀ u : Fin m, u.val<r i → c₂.coord x u=0) (Ξ : Finset (level H h0 1 →* Multiplicative ℝ)) (hΞc : ∀ ξ∈Ξ, Continuous ξ) (hΞΓ : ∀ ξ∈Ξ, ∀ x : level H h0 1, x.val∈Γ.prod Γ → ∃ z : ℤ, (ξ x).toAdd=z) (δ A E : ℝ) (hδ : 0<δ) (hA : 0 ≤ A) : ∃ U : Finset (G →* Multiplicative ℝ), ∃ V : Finset (H.level 2 →* Multiplicative ℝ), ∃ C : ℝ, 0<C ∧ ∃ B : ℝ, 0<B ∧ ∃ Tmax : ℕ, 0<Tmax ∧ ∃ N₀ : ℕ, 0<N₀ ∧ ∀ N : ℕ, N₀ ≤ N → ∀ ξ∈Ξ, ξ≠1 → ∀ (f : ℤ → G) (hf : Polynomial H 0 f) (hf0 : f 0=1), ‖horizontal c hd (f 1)‖ ≤ 1 → ∀ v : ℕ → G, (∀ h, ‖horizontal c hd (v h)‖ ≤ 1) → (∀ h, (v h)⁻¹*f 1^h∈Γ) → ∀ S : Finset ℕ, S⊆Finset.range N → δ*N ≤ (S.card:ℝ) → (∀ h∈S, ∃ W : ℝ[X], (∀ z : ℤ, W.eval (z:ℝ)= (ξ (linearNormalizedPair H h0 h1 hf (linearRemainder H h0 hf hf0 h) h (v h) z)).toAdd) ∧ ∀ j : ℕ, 0<j → j ≤ s → ∃ z : ℤ, |W.coeff j-z| ≤ A/(N:ℝ)^j) → (∃ χ∈U, χ≠1 ∧ Continuous χ ∧ (∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z) ∧ ∃ P : ℝ[X], P.natDegree ≤ s ∧ (∀ z : ℤ, P.eval (z:ℝ)=(χ (f z)).toAdd) ∧ ∀ j : ℕ, 0<j → ∃ z : ℤ, |P.coeff j-z| ≤ C/(N:ℝ)^j) ∨ (∃ χ∈V, χ≠1 ∧ Continuous χ ∧ (∀ x : H.level 2, x.val∈Γ → ∃ z : ℤ, (χ x).toAdd=z) ∧ ∃ hc : ∀ a b : G, ⁅a,b⁆∈χ.ker.map (H.level 2).subtype, χ.ker.map (H.level 2).subtype < H.level 2 ∧ ∃ T : ℕ, 0<T ∧ T ≤ Tmax ∧ SmoothFactorizationAt H Γ c₂ χ hc E B N T f) := by classical obtain ⟨R,hR,C,hC,N₀,hN₀,hdesc⟩ := geometric_scalar_descent c hd hlin H h0 h1 hlevel Γ hΓ s hs2 hs Ξ δ A hδ hA let U := boundedCharacters c hd hlin R ∪ scaledFamily (Ξ.image (fun ξ => ξ.comp (diagonal H h0 h1))) R let V := scaledFamily (Ξ.image (fun ξ => ξ.comp (lower H h0))) R have hVc : ∀ χ∈V, Continuous χ := by apply scaledFamily_continuous intro χ hm obtain ⟨ξ,hξ,rfl⟩ := Finset.mem_image.mp hm exact (hΞc ξ hξ).comp (lower_continuous H h0) have hVΓ : ∀ χ∈V, ∀ x : H.level 2, x.val∈Γ → ∃ z : ℤ, (χ x).toAdd=z := by apply scaledFamily_integral _ _ (Γ.comap (H.level 2).subtype) intro χ hm obtain ⟨ξ,hξ,rfl⟩ := Finset.mem_image.mp hm exact lower_integral H h0 ξ Γ (hΞΓ ξ hξ) obtain ⟨B,hB,Tmax,hTmax,hfactor⟩ := finite_lower_factorizations H Γ c₂ h0 hsk₂ hΓ₂ hs r hlevel₂ V hVc hVΓ s E C hC.le refine ⟨U,V,C,hC,B,hB,Tmax,hTmax,N₀,hN₀,?_⟩ intro N hNN ξ hξ hξ0 f hf hf0 hf1 v hv hvΓ S hSN hS hsmall have hN : 1 ≤ (N:ℝ) := by exact_mod_cast (Nat.succ_le_iff.mpr (hN₀.trans_le hNN)) rcases hdesc N hNN ξ hξ (hΞc ξ hξ) (hΞΓ ξ hξ) f hf hf0 hf1 v hv hvΓ S hSN hS hsmall with hob | hzero · left obtain ⟨k,hk,hkR,χ,hχeq,hχ0,hχc,hχΓ,P,hP,hPe,hPc⟩ := hob refine ⟨χ,?_,hχ0,hχc,hχΓ,P,hP.trans (by omega),hPe,hPc⟩ exact Finset.mem_union_left _ (hχeq ▸ mem_boundedCharacters c hd hlin R k hkR) · obtain ⟨hp,q,hq,hqR,P,Q,hP,hQ,hQ0,hQ1,hPe,hQe,hPc,hQc⟩ := hzero by_cases hd0 : ξ.comp (diagonal H h0 h1)=1 · right let χ := intScale (ξ.comp (lower H h0)) q have hχV : χ∈V := mem_scaledFamily (Finset.mem_image.mpr ⟨ξ,hξ,rfl⟩) hqR have hχ0 : χ≠1 := intScale_ne_one _ hq (lower_ne_one_of_diagonal H h0 h1 ξ hξ0 hd0) have hc : ∀ a b : G, ⁅a,b⁆∈χ.ker.map (H.level 2).subtype := zero_pairing_kernel H h0 h1 ξ q hp refine ⟨χ,hχV,hχ0,hVc χ hχV,hVΓ χ hχV,hc,lower_kernel_lt H χ hχ0,?_⟩ apply hfactor χ hχV hc (N:ℝ) hN f hf hf0 (by rw [h1]; trivial) (Polynomial.C (q:ℝ)*Q) · exact (natDegree_C_mul_le _ _).trans hQ · intro z simp only [eval_mul,eval_C,hQe,intScale_apply,χ] · intro j hj simpa only [coeff_C_mul] using hQc j hj · left let χ := intScale (ξ.comp (diagonal H h0 h1)) q have hχU : χ∈U := Finset.mem_union_right _ (mem_scaledFamily (Finset.mem_image.mpr ⟨ξ,hξ,rfl⟩) hqR) refine ⟨χ,hχU,intScale_ne_one _ hq hd0, intScale_continuous _ q ((hΞc ξ hξ).comp (diagonal_continuous H h0 h1)), intScale_integral _ q Γ (diagonal_integral H h0 h1 ξ Γ (hΞΓ ξ hξ)), Polynomial.C (q:ℝ)*P,(natDegree_C_mul_le _ _).trans hP,?_,?_⟩ · intro z simp only [eval_mul,eval_C,hPe,intScale_apply,χ] · intro j hj simpa only [coeff_C_mul] using hPc j hj
end MalcevHorizontalendend
sectionnoncomputable sectionopen scoped commutatorElementnamespace LeibmanSquareopen CubeFaces CubePolynomials RationalLatticevariable {G : Type*} [Group G]variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
include h1 in
lemma lattice_linear_normalization (Γ : Subgroup G) {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (v γ : G) (hγ : γ∈Γ) (hav : f 1=v*γ) : let g:=fun n : ℤ => f n*(γ^n)⁻¹ Polynomial H 0 g ∧ g 0=1 ∧ g 1=v ∧ ∀ n, QuotientGroup.mk (g n)=(QuotientGroup.mk (f n):G⧸Γ) := by dsimp only have hlin : (fun n : ℤ => γ^n)∈polynomials H 0 := by simpa using NilpotentTaylor.binomial_mem (H:=H) 1 0 γ (by rw [Nat.add_zero,h1]; trivial) refine ⟨polynomial_of_cube_mem _ ((polynomials H 0).mul_mem (cube_mem_of_polynomial _ hf) ((polynomials H 0).inv_mem hlin)),?_,?_,?_⟩ · simp [hf0] · simp [hav,mul_assoc] · intro n exact QuotientGroup.mk_mul_of_mem _ (Γ.inv_mem (Γ.zpow_mem hγ n))
include h0 inlemma polynomial_conjugate {f : ℤ → G} (hf : Polynomial H 0 f) (a : G) : Polynomial H 0 (fun n => a*f n*a⁻¹) := by apply polynomial_of_cube_mem apply (polynomials H 0).mul_mem · exact (polynomials H 0).mul_mem (const_mem (by rw [h0]; trivial)) (cube_mem_of_polynomial _ hf) · exact const_mem (by rw [h0]; trivial)
include h0 in
lemma constant_normalization (Γ : Subgroup G) {f : ℤ → G} (hf : Polynomial H 0 f) (v γ : G) (hγ : γ∈Γ) (hav : f 0=v*γ) : let g:=fun n => γ*(f 0)⁻¹*f n*γ⁻¹ Polynomial H 0 g ∧ g 0=1 ∧ ∀ n, QuotientGroup.mk (v*g n)=(QuotientGroup.mk (f n):G⧸Γ) := by dsimp only have hp : Polynomial H 0 (fun n => γ*(f 0)⁻¹*f n*γ⁻¹) := by apply polynomial_of_cube_mem exact (polynomials H 0).mul_mem ((polynomials H 0).mul_mem (const_mem (by rw [h0]; trivial)) (cube_mem_of_polynomial _ hf)) (const_mem (by rw [h0]; trivial)) refine ⟨hp,by group,?_⟩ intro n have he : v*(γ*(f 0)⁻¹*f n*γ⁻¹)=f n*γ⁻¹ := by rw [hav]; group rw [he,QuotientGroup.mk_mul_of_mem _ (Γ.inv_mem hγ)]
end LeibmanSquareendend
sectionnoncomputable sectionopen scoped ComplexConjugatenamespace SquareInductionopen CubeFaces CubePolynomials LeibmanSquare PolynomialWeyl MeasureTheory UniformSquareObservable CompactFamilyDescentvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
theorem uniform_dense_linear_square_descent (H : Filtration G) (h0 : H.level 0 = ⊤) (h1 : H.level 1 = ⊤) (Γ : Subgroup G) (s : ℕ) (hs2 : 2 ≤ s) (hs : H.level (s+1) = ⊥) [TopologicalSpace.MetrizableSpace (ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs)] [CompactSpace (ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs)] (F : C(G ⧸ Γ,ℂ)) (hF : ∀ x, ‖F x‖ ≤ 1) (χ : G → ℂ) (hχ : ∀ n ∈ H.level s, ‖χ n‖ = 1) (hw : ∀ n ∈ H.level s, ∀ x : G, F (QuotientGroup.mk (x*n)) = χ n * F (QuotientGroup.mk x)) (z : G) (hz : z ∈ H.level s) (hχz : χ z ≠ 1) (C : Set G) (hCc : IsCompact C) (hC : ∀ g : G, ∃ c ∈ C, c⁻¹*g ∈ Γ) (δ : ℝ) (hδ : 0 < δ) : let R := restricted H h0 letI := last_normal H h0 (by omega : 1 ≤ s) hs let π := QuotientGroup.mk' (R.level s) let Q := mapFiltration R π let X := ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs letI := TopologicalSpace.metrizableSpaceMetric X letI : MeasurableSpace X := borel X ∃ tests : Finset {Ψ : C(X,ℂ) // Ψ ∈ lipschitzMaps (Y := X)}, ∃ η : ℝ, 0 < η ∧ ∀ μ : Measure X, IsProbabilityMeasure μ → SMulInvariantMeasure ((level H h0 1) ⧸ R.level s) X μ → ∀ (f : ℤ → G) (hf : Polynomial H 0 f) (hf0 : f 0=1), ∀ N T : ℕ, 0 < N → 0 < T → δ ≤ ‖mean N (fun n => F (QuotientGroup.mk (f n)))‖ → 4 * (T : ℝ) / N ≤ δ^2/4 → ∃ A : Finset ℕ, (∀ h ∈ A, h < T) ∧ δ^2/8*T ≤ (A.card : ℝ) ∧ ∀ h ∈ A, ∃ Ψ ∈ tests, ∃ v ∈ C, ∃ γ ∈ Γ, f 1^(h:ℤ) = v*γ ∧ let p := fun n => π (linearNormalizedPair H h0 h1 hf (linearRemainder H h0 hf hf0 h) h v n) Polynomial Q 0 p ∧ (∀ ts : List ℤ, s ≤ ts.length → ∀ n, iterDiff ts p n = 1) ∧ η ≤ ‖mean N (fun n => Ψ.val (QuotientGroup.mk (p n))) - ∫ x, Ψ.val x ∂μ‖ := by classical let R := restricted H h0 let := last_normal H h0 (by omega : 1 ≤ s) hs let π := QuotientGroup.mk' (R.level s) let X := ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs let := TopologicalSpace.metrizableSpaceMetric X let : MeasurableSpace X := borel X let : BorelSpace X := ⟨rfl⟩ obtain ⟨tests,η,hη,htests⟩ := finite_square_tests H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs F χ hχ hw (insert 1 C) (hCc.insert 1) (δ^2/8) 2 (by positivity) (by norm_num) refine ⟨tests,η,hη,?_⟩ intro μ hprob hinv f hf hf0 N T hN hT hlarge hboundary let := hprob obtain ⟨A,hAT,hAc,hAd⟩ := SquareDifferences.exists_dense_one_sided hN hT (fun n => F (QuotientGroup.mk (f n))) (fun n => hF _) δ hδ hlarge hboundary refine ⟨A,hAT,hAc,?_⟩ intro h ha obtain ⟨v,hv,hvΓ⟩ := hC (f 1^(h:ℤ)) let γ:=v⁻¹*f 1^(h:ℤ) have hav : f 1^(h:ℤ)=v*γ := by dsimp [γ]; group let u:=linearRemainder H h0 hf hf0 (h:ℤ) let q:=linearNormalizedPair H h0 h1 hf u (h:ℤ) v let p:=fun n => π (q n) let Φ:=observable H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs F χ hχ hw (1,v) have hΦ : ∀ x : level H h0 1, Φ (QuotientGroup.mk (π x))=balanced H h0 Γ F 1 v x := fun _ => rfl have hzero : (∫ x, Φ x ∂μ)=0 := reduced_observable_mean_zero H h0 h1 Γ F 1 v s hs2 hs χ hw z hz hχz μ hinv Φ hΦ have heval (n : ℤ) : Φ (QuotientGroup.mk (p n))= F (QuotientGroup.mk (f n))*conj (F (QuotientGroup.mk (f (n+h)))) := by rw [hΦ] exact balanced_linearNormalizedPair H h0 h1 Γ F hf hf0 (f 1) u h v γ hvΓ hav (linearRemainder_mul H h0 hf hf0 h) n have hcorr : δ^2/8 ≤ ‖mean N (fun n => Φ (QuotientGroup.mk (p n)))‖ := by have hc := hAd h ha rw [SquareDifferences.norm_mean_derivative_swap N h 0] at hc convert hc using 1 congr 1 apply congrArg (mean N) funext n rw [heval] simp only [PolynomialWeyl.derivative,Nat.add_zero,Nat.cast_add] let L : C(X,ℂ) →ₗ[ℂ] ℂ := discrepancy μ N (fun n => QuotientGroup.mk (p n)) have hL : ∀ Ψ, ‖L Ψ‖ ≤ 2 * ‖Ψ‖ := discrepancy_bound μ N hN _ have hcorr' : δ^2/8 ≤ ‖L Φ‖ := by change δ^2/8 ≤ ‖mean N (fun n => Φ (QuotientGroup.mk (p n))) - ∫ x, Φ x ∂μ‖ simpa only [hzero,sub_zero] using hcorr obtain ⟨Ψ,hΨ,hΨcorr⟩ := htests L hL ⟨1,Set.mem_insert _ _,v,Set.mem_insert_of_mem _ hv,hcorr'⟩ obtain ⟨hp,hptop⟩ := linearNormalizedPair_reduced H h0 h1 hf u (h:ℤ) v (le_trans (by decide : 1 ≤ 2) hs2) hs exact ⟨Ψ,hΨ,v,hv,γ,hvΓ,hav,hp,hptop,hΨcorr⟩
end SquareInduction
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.LeibmanSquare05import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionopen scoped commutatorElement BigOperatorsendend
sectionnoncomputable sectionopen scoped BigOperatorsnamespace MalcevHorizontalopen CubeFaces LeibmanSquare RationalLattice _root_.Polynomial _root_.OAI.Polynomialvariable {G : Type*} [Group G] [TopologicalSpace G]variable {n d : ℕ} (c : RealCoordinates G n) (hd : d ≤ n)variable (hlin : ∀ i : Fin d, c.correction (Fin.castLE hd i)=0)variable (H : Filtration G) (h0 : H.level 0=⊤)variable (hlevel : ∀ g : G, g∈H.level 2 ↔ horizontal c hd g=0)
include hlevel inlemma character_lower_trivial (k : Fin d → ℤ) (u : H.level 2) : character c hd hlin k u=1 := by change Multiplicative.ofAdd (∑ i,(k i:ℝ)*horizontal c hd u i)=1 rw [(hlevel u).mp u.property] simp
include h0 hlevel inlemma original_horizontal_linear {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (k : Fin d → ℤ) (z : ℤ) : (character c hd hlin k (f z)).toAdd=(z:ℝ)*∑ i,(k i:ℝ)*horizontal c hd (f 1) i := by have he := congrArg (character c hd hlin k) (linearRemainder_mul H h0 hf hf0 z) rw [map_mul,character_lower_trivial c hd hlin H hlevel,map_zpow,one_mul] at he have hh:=congrArg Multiplicative.toAdd he simpa only [toAdd_zpow,zsmul_eq_mul,character,MonoidHom.coe_mk,OneHom.coe_mk,toAdd_ofAdd] using hh
include h0 hlevel in
theorem original_horizontal_obstruction (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z) {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (R N : ℕ) (A : ℝ) (hA : 0 ≤ A) (k : Fin d → ℤ) (hk : k≠0) (hkR : ∀ i, |k i| ≤ R) (m : ℤ) (hm : |(∑ i,(k i:ℝ)*horizontal c hd (f 1) i)-m| ≤ A/N) : ∃ χ : G →* Multiplicative ℝ, χ≠1 ∧ Continuous χ ∧ (∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z) ∧ (∃ k' : Fin d → ℤ, (∀ i, |k' i| ≤ R) ∧ χ=character c hd hlin k') ∧ ∃ P : ℝ[X], P.natDegree ≤ 1 ∧ (∀ z : ℤ, P.eval (z:ℝ)=(χ (f z)).toAdd) ∧ ∀ j : ℕ, 0<j → ∃ z : ℤ, |P.coeff j-z| ≤ A/(N:ℝ)^j := by let α:=∑ i,(k i:ℝ)*horizontal c hd (f 1) i refine ⟨character c hd hlin k,character_ne_one c hd hlin hk,character_continuous c hd hlin k, fun g hg => character_integer c hd hlin Γ hΓ k hg,⟨k,hkR,rfl⟩,C α*X,?_,?_,?_⟩ · exact (natDegree_mul_le.trans (by simp [natDegree_C,natDegree_X])) · intro z rw [eval_mul,eval_C,eval_X,original_horizontal_linear c hd hlin H h0 hlevel hf hf0 k z] change α*(z:ℝ)=(z:ℝ)*α ring · intro j hj by_cases hj1 : j=1 · subst j exact ⟨m,by simpa [coeff_C_mul,α] using hm⟩ · refine ⟨0,?_⟩ simp only [coeff_C_mul,coeff_X,ite_eq_right (Ne.symm hj1),mul_zero,Int.cast_zero,sub_zero,abs_zero] positivity
end MalcevHorizontalendend
sectionnoncomputable sectionnamespace MalcevHorizontalopen RationalLattice CubeFaces LeibmanSquare BracketHyperplanesvariable {G : Type*} [Group G] [TopologicalSpace G]variable {n d : ℕ} (c : RealCoordinates G n) (hd : d ≤ n)variable (hlin : ∀ i : Fin d, c.correction (Fin.castLE hd i)=0)
include hlin inlemma horizontal_pow (a : G) (h : ℕ) : horizontal c hd (a^h)=fun i => (h:ℝ)*horizontal c hd a i := by have he := congrArg Multiplicative.toAdd (map_pow (quotientHom c hd hlin) a h) rw [toAdd_pow] at he change horizontal c hd (a^h)=h • horizontal c hd a at he funext i simpa only [Pi.smul_apply,nsmul_eq_mul] using congrFun he i
variable (Γ : Subgroup G)variable (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
include hlin hΓ in
lemma representative_torus (a : G) (v : ℕ → G) (hv : ∀ h, (v h)⁻¹*a^h∈Γ) (h : ℕ) : BracketHyperplanes.torusMap (horizontal c hd (v h))= BracketHyperplanes.torusMap (fun i => horizontal c hd a i*(h:ℝ)+(0:Fin d → ℝ) i) := by funext i obtain ⟨z,hz⟩ := (hΓ ((v h)⁻¹*a^h)).mp (hv h) (Fin.castLE hd i) change horizontal c hd ((v h)⁻¹*a^h) i=(z:ℝ) at hz rw [horizontal_mul c hd hlin,horizontal_inv c hd hlin,horizontal_pow c hd hlin] at hz change -horizontal c hd (v h) i+(h:ℝ)*horizontal c hd a i=(z:ℝ) at hz have he : horizontal c hd a i*(h:ℝ)=horizontal c hd (v h) i+(z:ℝ) := by linarith change (horizontal c hd (v h) i:UnitAddCircle)= ((horizontal c hd a i*(h:ℝ)+0:ℝ):UnitAddCircle) rw [he] simp
lemma reduced_horizontal_bound (a : G) : ‖horizontal c hd (reduceCoordinates c a n)‖ ≤ 1 := by apply (pi_norm_le_iff_of_nonneg (by norm_num : (0:ℝ)≤1)).mpr intro i have hi := reduceCoordinates_bounds c a n (Fin.castLE hd i) (Fin.castLE hd i).isLt change |c.coord (reduceCoordinates c a n) (Fin.castLE hd i)| ≤ 1 rw [abs_of_nonneg hi.1] exact hi.2.le
include hlin hΓ in
lemma canonical_representative_orbit (a : G) : let v:=fun h : ℕ => reduceCoordinates c (a^h) n (∀ h, ‖horizontal c hd (v h)‖≤1) ∧ (∀ h, (v h)⁻¹*a^h∈Γ) ∧ ∀ h,BracketHyperplanes.torusMap (horizontal c hd (v h))= BracketHyperplanes.torusMap (fun i => horizontal c hd a i*(h:ℝ)+(0:Fin d → ℝ) i) := by dsimp only have hv (h : ℕ) := reduceCoordinates_coset c Γ hΓ (a^h) n exact ⟨fun h => reduced_horizontal_bound c hd _,hv, representative_torus c hd hlin Γ hΓ a _ hv⟩
end MalcevHorizontalendend
sectionnoncomputable sectionopen scoped BigOperators commutatorElementnamespace MalcevHorizontalopen RationalLattice CubeFaces LeibmanSquare SquareHorizontalCharacter _root_.Polynomial _root_.OAI.Polynomial BracketDriftvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n d : ℕ} (c : RealCoordinates G n) (hd : d ≤ n)variable (hlin : ∀ i : Fin d, c.correction (Fin.castLE hd i)=0)variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)variable [∀ i, (H.level i).Normal]variable (hlevel : ∀ g : G, g∈H.level 2 ↔ horizontal c hd g=0)variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
include hlin hlevel hΓ in
theorem geometric_scalar_descent (s : ℕ) (hs2 : 2 ≤ s) (hs : H.level (s+1)=⊥) (Ξ : Finset (level H h0 1 →* Multiplicative ℝ)) (δ A : ℝ) (hδ : 0<δ) (hA : 0≤A) : ∃ R : ℕ, 0<R ∧ ∃ C : ℝ, 0<C ∧ ∃ N₀ : ℕ, 0<N₀ ∧ ∀ N : ℕ, N₀≤N → ∀ ξ∈Ξ, Continuous ξ → (∀ x : level H h0 1, x.val∈Γ.prod Γ → ∃ z : ℤ, (ξ x).toAdd=z) → ∀ (f : ℤ → G) (hf : Polynomial H 0 f) (hf0 : f 0=1), ‖horizontal c hd (f 1)‖≤1 → ∀ v : ℕ → G, (∀ h, ‖horizontal c hd (v h)‖≤1) → (∀ h, (v h)⁻¹*f 1^h∈Γ) → ∀ S : Finset ℕ, S⊆Finset.range N → δ*N≤(S.card:ℝ) → (∀ h∈S, ∃ W : ℝ[X], (∀ z : ℤ, W.eval (z:ℝ)= (ξ (linearNormalizedPair H h0 h1 hf (linearRemainder H h0 hf hf0 h) h (v h) z)).toAdd) ∧ ∀ j : ℕ, 0<j → j≤ s → ∃ m : ℤ, |W.coeff j-m|≤A/(N:ℝ)^j) → (∃ k : Fin d → ℤ, k≠0 ∧ (∀ i, |k i|≤R) ∧ ∃ χ : G →* Multiplicative ℝ, χ=character c hd hlin k ∧ χ≠1 ∧ Continuous χ ∧ (∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z) ∧ ∃ P : ℝ[X], P.natDegree ≤ 1 ∧ (∀ z : ℤ, P.eval (z:ℝ)=(χ (f z)).toAdd) ∧ ∀ j : ℕ, 0<j → ∃ m : ℤ, |P.coeff j-m|≤C/(N:ℝ)^j) ∨ ((∀ a b : G, pairing H h0 h1 ξ a b=1) ∧ ∃ q : ℤ, q≠0 ∧ |q|≤R ∧ ∃ P Q : ℝ[X], P.natDegree ≤ s ∧ Q.natDegree ≤ s ∧ Q.eval 0=0 ∧ Q.eval 1=0 ∧ (∀ z : ℤ, P.eval (z:ℝ)=((ξ.comp (diagonal H h0 h1)) (f z)).toAdd) ∧ (∀ z : ℤ, Q.eval (z:ℝ)=((ξ.comp (lower H h0)) (linearRemainder H h0 hf hf0 z)).toAdd) ∧ (∀ j : ℕ, 0<j → ∃ m : ℤ, |(q:ℝ)*P.coeff j-m|≤C/(N:ℝ)^j) ∧ (∀ j : ℕ, 1<j → ∃ m : ℤ, |(q:ℝ)*Q.coeff j-m|≤C/(N:ℝ)^j)) := by classical let B:=⌈squareMatrixBound c hd H h0 h1 Ξ⌉₊ obtain ⟨R,hR,C,hC,N₀,hN₀,hdesc⟩ := NonabelianCharacterDescent.scalar_descent d s B hs2 δ A hδ hA refine ⟨R,hR,C,hC,N₀,hN₀,?_⟩ intro N hNN ξ hξ hξc hξΓ f hf hf0 hf1 v hv hvΓ S hSN hS hsmall obtain ⟨M,hdiag,halt,hM⟩ := square_integer_matrix c hd hlin H h0 h1 hlevel ξ Γ hΓ hξc hξΓ have hMb (i j : Fin d) : |M i j|≤B := by have hb : |(M i j:ℝ)|≤(B:ℝ) := (matrix_bound c hd H h0 h1 ξ M hM Ξ hξ i j).trans (Nat.le_ceil _) exact_mod_cast hb obtain ⟨P,Q,hP,hQ,hQ0,hQ1,hPe,hQe,hPQ⟩ := exists_actual_square_polynomials H h0 h1 ξ s hs hf hf0 have hm (h : ℕ) : (pairing H h0 h1 ξ (f 1) (v h)).toAdd= ∑ i,matrixContraction M (horizontal c hd (f 1)) i*horizontal c hd (v h) i := by rw [hM] simp only [matrixContraction,Finset.sum_mul] rw [Finset.sum_comm] have hsmall' (h : ℕ) (hh : h∈S) (j : ℕ) (hj : 0<j) (hjs : j≤ s) : ∃ m : ℤ, |(P+taylor (h:ℝ) Q-Q).coeff j+ (if j=1 then ∑ i,matrixContraction M (horizontal c hd (f 1)) i*horizontal c hd (v h) i else 0)-m| ≤ A/(N:ℝ)^j := by obtain ⟨W,hWe,hWc⟩ := hsmall h hh have he : W=P+taylor (h:ℝ) Q-Q+Polynomial.C ((pairing H h0 h1 ξ (f 1) (v h)).toAdd)*X := by apply Polynomial.eq_of_eval_nat_eq intro z simpa only [Int.cast_natCast] using (hWe (z:ℤ)).trans (hPQ (h:ℤ) (z:ℤ) (v h)).symm obtain ⟨m,hmc⟩ := hWc j hj hjs refine ⟨m,?_⟩ rw [he,coeff_add,coeff_C_mul,coeff_X,hm] at hmc by_cases hj1 : j=1 · simpa only [hj1,ite_true,mul_one] using hmc · simpa only [ite_eq_right hj1,ite_eq_right (Ne.symm hj1),mul_zero,add_zero] using hmc rcases hdesc N hNN M hMb (horizontal c hd (f 1)) 0 hf1 (fun h => horizontal c hd (v h)) hv (representative_torus c hd hlin Γ hΓ (f 1) v hvΓ) P Q hP hQ S hSN hS hsmall' with hfirst | hzero · left obtain ⟨k,hk,hkR,m,hm⟩ := hfirst obtain ⟨χ,hχ0,hχc,hχΓ,hχk,P',hP',hPe',hPc'⟩ := original_horizontal_obstruction c hd hlin H h0 hlevel Γ hΓ hf hf0 R N C hC.le k hk hkR m hm obtain ⟨k',hk'R,hχeq⟩ := hχk refine ⟨k',?_,hk'R,χ,hχeq,hχ0,hχc,hχΓ,P',hP',hPe',hPc'⟩ intro hz apply hχ0 rw [hχeq,hz] ext x simp [character] · right obtain ⟨hMz,q,hq,hqR,hPc,hQc⟩ := hzero exact ⟨(matrix_zero_iff c hd H h0 h1 ξ M hM).mp hMz, q,hq,hqR,P,Q,hP,hQ,hQ0,hQ1,hPe,hQe,hPc,hQc⟩
end MalcevHorizontalendend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace MalcevTailSectionopen RationalLattice MalcevCharacters IntegerHyperplanevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n) (hsk : SecondKind c)
def axisHom (i : Fin n) : Multiplicative ℝ →* G where toFun t := axis c i t.toAdd map_one' := axis_zero c i map_mul' s t := hsk.axis_add i s.toAdd t.toAdd
def HasPivot (k : Fin n → ℤ) (r : ℕ) : Prop := ∃ p : Fin n, r ≤ p.val ∧ k p ≠ 0
def tailSection (k : Fin n → ℤ) (r : ℕ) (t : ℝ) : G := by classical exact if h : HasPivot k r then axis c h.choose (t/(k h.choose:ℝ)) else 1
lemma section_zero (k : Fin n → ℤ) (r : ℕ) : tailSection c k r 0 = 1 := by classical unfold tailSection split_ifs <;> simpinclude hsk inlemma section_add (k : Fin n → ℤ) (r : ℕ) (s t : ℝ) : tailSection c k r (s+t) = tailSection c k r s * tailSection c k r t := by classical unfold tailSection split_ifs <;> simp [add_div,hsk.axis_add]
def flow (k : Fin n → ℤ) (r : ℕ) : Multiplicative ℝ →* G where toFun t := tailSection c k r t.toAdd map_one' := section_zero c k r map_mul' s t := section_add c hsk k r s.toAdd t.toAdd
include hsk inlemma section_zpow (k : Fin n → ℤ) (r : ℕ) (t : ℝ) (z : ℤ) : tailSection c k r (z*t) = tailSection c k r t ^ z := by have h := (flow c hsk k r).map_zpow (Multiplicative.ofAdd t) z simpa [flow,zsmul_eq_mul] using h
lemma section_continuous (k : Fin n → ℤ) (r : ℕ) : Continuous (tailSection c k r) := by classical unfold tailSection split_ifs · exact (axis_continuous c _).comp (continuous_id.div_const _) · exact continuous_const
lemma section_tail (k : Fin n → ℤ) (r : ℕ) (t : ℝ) (i : Fin n) (hi : i.val < r) : c.coord (tailSection c k r t) i = 0 := by classical unfold tailSection split_ifs with h · rw [coord_axis] apply Pi.single_eq_of_ne intro he have := h.choose_spec.1 subst i omega · exact c.one_coord i
lemma section_rational (k : Fin n → ℤ) (r : ℕ) (t : ℚ) : IsRational c (tailSection c k r t) := by classical intro i unfold tailSection split_ifs with h · refine ⟨if i=h.choose then t/(k h.choose:ℚ) else 0,?_⟩ rw [coord_axis] simp only [Pi.single_apply] split_ifs <;> push_cast <;> rfl · exact ⟨0,by simpa using (c.one_coord i).symm⟩
lemma section_bound (k : Fin n → ℤ) (r : ℕ) (t : ℝ) (i : Fin n) : |c.coord (tailSection c k r t) i| ≤ |t| := by classical unfold tailSection split_ifs with h · rw [coord_axis] by_cases hi : i=h.choose · subst i rw [Pi.single_eq_same,abs_div] have hk : (1:ℝ) ≤ |(k h.choose:ℝ)| := by exact_mod_cast (Int.one_le_abs h.choose_spec.2) exact div_le_self (abs_nonneg t) hk · simp [Pi.single_eq_of_ne hi,abs_nonneg] · simp [c.one_coord,abs_nonneg]
lemma form_zero_of_no_pivot (k : Fin n → ℤ) (r : ℕ) (hk : ¬ HasPivot k r) (x : Fin n → ℝ) (hx : ∀ i, i.val < r → x i = 0) : form k x = 0 := by change (∑ i, (k i:ℝ)*x i) = 0 apply Finset.sum_eq_zero intro i _ by_cases hir : i.val < r · rw [hx i hir,mul_zero] · have hi : k i = 0 := by by_contra he; exact hk ⟨i,by omega,he⟩ simp [hi]
variable (χ : G →* Multiplicative ℝ) (k : Fin n → ℤ)variable (hχ : ∀ g, (χ g).toAdd = form k (c.coord g))include hχ inlemma character_section (r : ℕ) (t : ℝ) (ht : ¬ HasPivot k r → t=0) : (χ (tailSection c k r t)).toAdd = t := by classical unfold tailSection split_ifs with h · rw [hχ,coord_axis] change (∑ i, (k i:ℝ)*(Pi.single h.choose (t/(k h.choose:ℝ)) : Fin n → ℝ) i) = t simp only [Pi.single_apply,mul_ite,mul_zero,Finset.sum_ite_eq',Finset.mem_univ,ite_true] exact mul_div_cancel₀ t (by exact_mod_cast h.choose_spec.2) · rw [ht h] simp
end MalcevTailSection
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.MalcevTail01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionopen scoped BigOperatorsnoncomputable sectionendend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace MalcevTailFactoropen RationalLattice MalcevCharacters MalcevTailSection IntegerHyperplaneopen CubeFaces CubePolynomials RationalFactorPeriodsvariable {G : Type*} [Group G] [TopologicalSpace G] {n l : ℕ}variable (c : RealCoordinates G n) (hsk : SecondKind c)variable (χ : G →* Multiplicative ℝ) (k : Fin n → ℤ)variable (hχ : ∀ g, (χ g).toAdd = form k (c.coord g))variable (r : Fin l → ℕ) (a : Fin l → G)
def beta (i : Fin l) : ℝ := (χ (a i)).toAdd
def numerator (i : Fin l) : ℤ := round (beta χ a i)
def error (i : Fin l) : ℝ := beta χ a i - (numerator χ a i : ℝ)
def smallCoeff (i : Fin l) : G := tailSection c k (r i) (error χ a i)
def rationalGenerator (i : Fin l) : G := tailSection c k (r i) 1
def rationalCoeff (i : Fin l) : G := rationalGenerator c k r i ^ numerator χ a i
variable (ha : ∀ i, ∀ u : Fin n, u.val < r i → c.coord (a i) u = 0)include hχ ha inlemma beta_zero (i : Fin l) (h : ¬ HasPivot k (r i)) : beta χ a i = 0 := by rw [beta,hχ] exact form_zero_of_no_pivot k (r i) h _ (ha i)
include hχ ha inlemma error_zero (i : Fin l) (h : ¬ HasPivot k (r i)) : error χ a i = 0 := by simp [error,numerator,beta_zero c χ k hχ r a ha i h]
include hsk inlemma rationalCoeff_eq (i : Fin l) : rationalCoeff c χ k r a i = tailSection c k (r i) (numerator χ a i) := by simpa [rationalCoeff,rationalGenerator] using (section_zpow c hsk k (r i) 1 (numerator χ a i)).symm
include hχ ha inlemma small_character (i : Fin l) : (χ (smallCoeff c χ k r a i)).toAdd = error χ a i := by exact character_section c χ k hχ (r i) (error χ a i) (error_zero c χ k hχ r a ha i)
include hsk hχ ha inlemma rational_character (i : Fin l) : (χ (rationalCoeff c χ k r a i)).toAdd = numerator χ a i := by rw [rationalCoeff_eq c hsk χ k r a i] apply character_section c χ k hχ intro h simp [numerator,beta_zero c χ k hχ r a ha i h]
lemma generator_rational (i : Fin l) : IsRational c (rationalGenerator c k r i) := by simpa [rationalGenerator] using section_rational c k (r i) 1
lemma small_bound (i : Fin l) (u : Fin n) : |c.coord (smallCoeff c χ k r a i) u| ≤ ‖(beta χ a i : UnitAddCircle)‖ := by rw [UnitAddCircle.norm_eq] exact section_bound c k (r i) (error χ a i) u
variable (j : Fin l → ℕ)include hsk hχ ha inlemma word_character_split (b : ℤ) : (χ (orderedWord a j b)).toAdd = (χ (orderedWord (smallCoeff c χ k r a) j b)).toAdd + (χ (orderedWord (rationalCoeff c χ k r a) j b)).toAdd := by simp only [orderedWord_character,small_character c χ k hχ r a ha, rational_character c hsk χ k hχ r a ha,←Finset.sum_add_distrib] apply Finset.sum_congr rfl intro i _ change ((Ring.choose b (j i) : ℤ) : ℝ)*beta χ a i = _ simp [error,mul_sub]
include hsk hχ ha inlemma residual_kernel (b : ℤ) : (orderedWord (smallCoeff c χ k r a) j b)⁻¹ * orderedWord a j b * (orderedWord (rationalCoeff c χ k r a) j b)⁻¹ ∈ χ.ker := by change χ _ = 1 apply Multiplicative.toAdd.injective simp only [map_mul,map_inv,toAdd_mul,toAdd_inv, toAdd_one] linarith [word_character_split c hsk χ k hχ r a ha j b]
variable (H : Filtration G) (q : ℕ)variable (hlevel : ∀ i g, g ∈ H.level (j i+q) ↔ ∀ u : Fin n, u.val < r i → c.coord g u = 0)include hlevel inlemma small_polynomial : orderedWord (smallCoeff c χ k r a) j ∈ polynomials H q := by apply orderedWord_mem intro i rw [hlevel] exact section_tail c k (r i) _
include hsk hlevel inlemma rational_polynomial : orderedWord (rationalCoeff c χ k r a) j ∈ polynomials H q := by apply orderedWord_mem intro i rw [rationalCoeff_eq c hsk χ k r a i,hlevel] exact section_tail c k (r i) _
end MalcevTailFactorendend
sectionopen scoped commutatorElementnoncomputable sectionnamespace CubePolynomialsopen CubeFacesvariable {G A : Type*} [Group G] [Group A]
theorem residual_refinement (H : Filtration G) (s : ℕ) (hbot : H.level s = ⊥) (φ : A →* G) (χ : A →* Multiplicative ℝ) (hcomm : ∀ a b : G, ⁅a,b⁆ ∈ χ.ker.map φ) (g : ℤ → G) (hg : g ∈ polynomials H 0) (a : G) (ha : a ∈ H.level 1) (q e v : ℤ → A) (he : (fun n => φ (e n)) ∈ polynomials H 0) (hv : (fun n => φ (v n)) ∈ polynomials H 0) (hgq : ∀ n, g n = φ (q n) * a^n) (hker : ∀ n, (e n)⁻¹ * q n * (v n)⁻¹ ∈ χ.ker) : (fun n => (φ (e n))⁻¹ * g n * (φ (v n))⁻¹) ∈ polynomials (H.refine (χ.ker.map φ) hcomm) 0 := by let K := χ.ker.map φ have hf : (fun n => (φ (e n))⁻¹ * g n * (φ (v n))⁻¹) ∈ polynomials H 0 := (polynomials H 0).mul_mem ((polynomials H 0).mul_mem ((polynomials H 0).inv_mem he) hg) ((polynomials H 0).inv_mem hv) apply refine_of_linear_coset H _ hcomm s hbot _ hf a ha intro n have hrow : (φ (e n))⁻¹ * φ (q n) * (φ (v n))⁻¹ ∈ K := by have hm : φ ((e n)⁻¹ * q n * (v n)⁻¹) ∈ K := Subgroup.mem_map_of_mem φ (hker n) simpa only [map_mul,map_inv] using hm have hc := hcomm (φ (v n)) (a^n) have hprod := K.mul_mem hrow hc convert hprod using 1 rw [hgq] simp only [commutatorElement_def] group
end CubePolynomialsendend
sectionnoncomputable sectionnamespace RationalFactorPeriodsvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable [PreconnectedSpace G] [LocallyCompactSpace G] [T2Space G] {n l : ℕ}
theorem uniform_rational_word_period (c : RationalLattice.RealCoordinates G n) (Γ : Subgroup G) [DiscreteTopology Γ] (hΓrat : Γ ≤ RationalLattice.rationalSubgroup c) (C : Set G) (hC : IsCompact C) (hreps : ∀ g : G, ∃ x ∈ C, x⁻¹*g ∈ Γ) (v : Fin l → G) (hv : ∀ i, RationalLattice.IsRational c (v i)) (j : Fin l → ℕ) (s : ℕ) (hj : ∀ i, j i ≤ s) : ∃ T : ℕ, 0 < T ∧ ∀ m : Fin l → ℤ, Function.Periodic (fun b => (QuotientGroup.mk (orderedWord (fun i => v i ^ m i) j b) : G ⧸ Γ)) (T : ℤ) := by classical let S := Finset.univ.image v have hSrat : ∀ g ∈ S, RationalLattice.IsRational c g := by intro g hg obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp hg exact hv i obtain ⟨H,hΓH,hSH,hHrat,hHd,hHi⟩ := RationalLattice.finite_rational_extension c Γ hΓrat C hC hreps S hSrat let : (Γ.subgroupOf H).FiniteIndex := hHi let : Fintype (H ⧸ Γ.subgroupOf H) := Fintype.ofFinite _ let K := Equiv.Perm (H ⧸ Γ.subgroupOf H) let φ : H →* K := MulAction.toPermHom H (H ⧸ Γ.subgroupOf H) have hvH (i : Fin l) : v i ∈ H := hSH (Finset.mem_image.mpr ⟨i,Finset.mem_univ _,rfl⟩) refine ⟨Fintype.card K * s.factorial,Nat.mul_pos Fintype.card_pos s.factorial_pos,?_⟩ intro m b let a : Fin l → H := fun i => ⟨v i ^ m i,H.zpow_mem (hvH i) _⟩ have he := congrArg (fun e : K => e (QuotientGroup.mk (1:H))) (finite_image_periodic φ a j s hj b) have hquot : (QuotientGroup.mk (orderedWord a j (b+(Fintype.card K*s.factorial:ℕ))) : H ⧸ Γ.subgroupOf H) = QuotientGroup.mk (orderedWord a j b) := by simpa [φ,K,MulAction.toPermHom] using he have hmem := QuotientGroup.eq.mp hquot have heG : (QuotientGroup.mk ((orderedWord a j (b+(Fintype.card K*s.factorial:ℕ)) : H):G) : G ⧸ Γ) = QuotientGroup.mk ((orderedWord a j b : H):G) := QuotientGroup.eq.mpr hmem have hmap (b : ℤ) : ((orderedWord a j b : H):G) = orderedWord (fun i => v i ^ m i) j b := orderedWord_map H.subtype a j b simpa only [hmap] using heG
end RationalFactorPeriodsendend
sectionopen scoped commutatorElement BigOperatorsnoncomputable sectionnamespace CharacterFactorizationopen CubeFaces CubePolynomials RationalFactorPeriods RationalLattice MalcevCharacters MalcevTailFactorvariable {G : Type*} [Group G] [TopologicalSpace G]variable (H : Filtration G) {n s : ℕ} (c : RealCoordinates (H.level 2) n) (hsk : SecondKind c)variable (χ : H.level 2 →* Multiplicative ℝ) (k : Fin n → ℤ)variable (hχ : ∀ x, (χ x).toAdd = IntegerHyperplane.form k (c.coord x))variable (r : Fin s → ℕ)variable (hlevel : ∀ i (x : H.level 2), x.val ∈ H.level (i.val+2) ↔ ∀ u : Fin n, u.val < r i → c.coord x u = 0)variable (hcomm : ∀ a b : G, ⁅a,b⁆ ∈ χ.ker.map (H.level 2).subtype)
def epsilon (a : Fin s → H.level 2) (z : ℤ) : G := (orderedWord (smallCoeff c χ k r a) (fun i => i.val+2) z).val
def gamma (a : Fin s → H.level 2) (z : ℤ) : G := (orderedWord (rationalCoeff c χ k r a) (fun i => i.val+2) z).val
def residual (g : ℤ → G) (a : Fin s → H.level 2) (z : ℤ) : G := (epsilon H c χ k r a z)⁻¹ * g z * (gamma H c χ k r a z)⁻¹
lemma factorization_identity (g : ℤ → G) (a : Fin s → H.level 2) (z : ℤ) : g z = epsilon H c χ k r a z * residual H c χ k r g a z * gamma H c χ k r a z := by unfold residual group
include hlevel inlemma epsilon_polynomial (a : Fin s → H.level 2) : epsilon H c χ k r a ∈ polynomials H 0 := by have he : epsilon H c χ k r a = orderedWord (fun i => (smallCoeff c χ k r a i).val) (fun i => i.val+2) := funext (fun z => orderedWord_map (H.level 2).subtype _ _ z) rw [he] apply orderedWord_mem intro i simp only [add_zero] rw [hlevel] exact MalcevTailSection.section_tail c k (r i) _
include hsk hlevel inlemma gamma_polynomial (a : Fin s → H.level 2) : gamma H c χ k r a ∈ polynomials H 0 := by have he : gamma H c χ k r a = orderedWord (fun i => (rationalCoeff c χ k r a i).val) (fun i => i.val+2) := funext (fun z => orderedWord_map (H.level 2).subtype _ _ z) rw [he] apply orderedWord_mem intro i simp only [add_zero] rw [hlevel,rationalCoeff_eq c hsk χ k r a i] exact MalcevTailSection.section_tail c k (r i) _
lemma epsilon_zero (a : Fin s → H.level 2) : epsilon H c χ k r a 0 = 1 := by have he : ∀ i : Fin s, smallCoeff c χ k r a i ^ Ring.choose (0:ℤ) (i.val+2) = 1 := by intro i rw [Ring.choose_zero_pos ℤ (by omega),zpow_zero] simp [epsilon,orderedWord]
include hsk hχ hlevel inlemma residual_polynomial (hbot : H.level s = ⊥) (g : ℤ → G) (hg : g ∈ polynomials H 0) (h1 : g 1 ∈ H.level 1) (a : Fin s → H.level 2) (ha : ∀ i, (a i).val ∈ H.level (i.val+2)) (he : ∀ z, g z = (orderedWord a (fun i => i.val+2) z).val * g 1 ^ z) : residual H c χ k r g a ∈ polynomials (H.refine (χ.ker.map (H.level 2).subtype) hcomm) 0 := by apply residual_refinement H s hbot (H.level 2).subtype χ hcomm g hg (g 1) h1 (orderedWord a (fun i => i.val+2)) (orderedWord (smallCoeff c χ k r a) (fun i => i.val+2)) (orderedWord (rationalCoeff c χ k r a) (fun i => i.val+2)) (epsilon_polynomial H c χ k r hlevel a) (gamma_polynomial H c hsk χ k r hlevel a) he exact MalcevTailFactor.residual_kernel c hsk χ k hχ r a (fun i => (hlevel i (a i)).mp (ha i)) (fun i => i.val+2)
include hsk hχ hlevel in
theorem normalized_factorization (hbot : H.level s = ⊥) (g : ℤ → G) (hg : g ∈ polynomials H 0) (h0 : g 0=1) (h1 : g 1 ∈ H.level 1) : ∃ a : Fin s → H.level 2, (∀ i, (a i).val ∈ H.level (i.val+2)) ∧ (∀ z, g z = (orderedWord a (fun i => i.val+2) z).val * g 1 ^ z) ∧ epsilon H c χ k r a ∈ polynomials H 0 ∧ gamma H c χ k r a ∈ polynomials H 0 ∧ residual H c χ k r g a ∈ polynomials (H.refine (χ.ker.map (H.level 2).subtype) hcomm) 0 := by obtain ⟨a,ha,he⟩ := NilpotentTaylor.normalized_subgroup_taylor H s hbot g hg h0 h1 exact ⟨a,ha,he,epsilon_polynomial H c χ k r hlevel a, gamma_polynomial H c hsk χ k r hlevel a, residual_polynomial H c hsk χ k hχ r hlevel hcomm hbot g hg h1 a ha he⟩
variable [IsTopologicalGroup G] [T2Space G]
theorem uniform_gamma_period (Γ : Subgroup G) (hΓ : ∀ x : H.level 2, x.val ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord x i = z) : ∃ T : ℕ, 0 < T ∧ ∀ a : Fin s → H.level 2, Function.Periodic (fun z => (QuotientGroup.mk (gamma H c χ k r a z) : G ⧸ Γ)) (T:ℤ) := by let L := Γ.comap (H.level 2).subtype have hL : ∀ x : H.level 2, x ∈ L ↔ ∀ i, ∃ z : ℤ, c.coord x i = z := hΓ let : DiscreteTopology L := integerCoordinates_discrete c L hL let : ConnectedSpace (H.level 2) := c.coord.symm.surjective.connectedSpace c.coord.symm.continuous let : LocallyCompactSpace (H.level 2) := c.coord.locallyCompactSpace_iff.mpr inferInstance obtain ⟨C,hC,hrep⟩ := compact_reps_of_integerCoordinates c L hL obtain ⟨T,hT,hper⟩ := uniform_rational_word_period c L (integerCoordinates_rational c L hL) C hC hrep (rationalGenerator c k r) (generator_rational c k r) (fun i => i.val+2) (s+2) (fun i => by omega) refine ⟨T,hT,fun a z => ?_⟩ have hp := hper (numerator χ a) z have hm := QuotientGroup.eq.mp hp exact QuotientGroup.eq.mpr hm
end CharacterFactorization
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.MalcevTail02import OAI.Combinatorics.SumProduct.Alignment.SmoothBinomial01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionend
sectionnoncomputable sectionnamespace SmoothBinomialopen Set
theorem smooth_binomial_increment (j : ℕ) (A C : ℝ) (hC : 0 ≤ C) : ∃ B > 0, ∀ L lam : ℝ, 1 ≤ L → |L^j*lam| ≤ C → (∀ x : ℝ, |x| ≤ A*L → |lam*Ring.choose x j| ≤ B) ∧ (∀ x y : ℝ, |x| ≤ A*L → |y| ≤ A*L → |lam*Ring.choose x j - lam*Ring.choose y j| ≤ (B/L)*|x-y|) := by obtain ⟨B0,hB0,hv⟩ := smooth_binomial_bounds j 0 A C hC obtain ⟨B1,hB1,hd⟩ := smooth_binomial_bounds j 1 A C hC refine ⟨B0+B1,by positivity,?_⟩ intro L lam hL hlam have hLp : 0 < L := lt_of_lt_of_le zero_lt_one hL have hdiff : Differentiable ℝ (fun x : ℝ => lam*Ring.choose x j) := by simp only [choose_eq_product] fun_prop constructor · intro x hx have he := hv L lam hL hlam x hx simp only [iteratedDeriv_zero,pow_zero,div_one] at he linarith · intro x y hx hy have hbound : ∀ z ∈ Icc (- (A*L)) (A*L), ‖deriv (fun w : ℝ => lam*Ring.choose w j) z‖ ≤ B1/L := by intro z hz simpa using hd L lam hL hlam z (abs_le.mpr hz) have he := Convex.norm_image_sub_le_of_norm_deriv_le (fun z _ => hdiff z) hbound (convex_Icc (- (A*L)) (A*L)) (abs_le.mp hy) (abs_le.mp hx) change |lam*Ring.choose x j - lam*Ring.choose y j| ≤ (B1/L)*|x-y| at he exact he.trans (mul_le_mul_of_nonneg_right (div_le_div_of_nonneg_right (by linarith) hLp.le) (abs_nonneg _))
end SmoothBinomialendend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace MalcevTailSectionopen RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] {n l : ℕ}variable (c : RealCoordinates G n) (k : Fin n → ℤ) (r : Fin l → ℕ) (j : Fin l → ℕ)
lemma binomial_parameters_bounds (A C : ℝ) (hC : 0 ≤ C) : ∃ U > 0, ∀ L : ℝ, ∀ lam : Fin l → ℝ, 1 ≤ L → (∀ i, |L^(j i)*lam i| ≤ C) → (∀ x : ℝ, |x| ≤ A*L → ‖fun i => lam i*Ring.choose x (j i)‖ ≤ U) ∧ (∀ x y : ℝ, |x| ≤ A*L → |y| ≤ A*L → ‖(fun i => lam i*Ring.choose x (j i))-(fun i => lam i*Ring.choose y (j i))‖ ≤ (U/L)*|x-y|) := by classical choose b hb hh using (fun i => SmoothBinomial.smooth_binomial_increment (j i) A C hC) let U := (∑ i, b i)+1 have hU : 0 < U := by have he : 0 ≤ ∑ i, b i := Finset.sum_nonneg (fun i _ => (hb i).le) dsimp [U] linarith have hbU (i : Fin l) : b i ≤ U := by have he := Finset.single_le_sum (fun t (_ : t ∈ (Finset.univ : Finset (Fin l))) => (hb t).le) (Finset.mem_univ i) dsimp [U] linarith refine ⟨U,hU,?_⟩ intro L lam hL hlam have hLp : 0 < L := lt_of_lt_of_le zero_lt_one hL constructor · intro x hx apply (pi_norm_le_iff_of_nonneg hU.le).mpr intro i exact ((hh i L (lam i) hL (hlam i)).1 x hx).trans (hbU i) · intro x y hx hy apply (pi_norm_le_iff_of_nonneg (by positivity)).mpr intro i exact ((hh i L (lam i) hL (hlam i)).2 x y hx hy).trans (mul_le_mul_of_nonneg_right (div_le_div_of_nonneg_right (hbU i) hLp.le) (abs_nonneg _))
omit [IsTopologicalGroup G] intheorem smooth_word_bounds (A C : ℝ) (hC : 0 ≤ C) : ∃ B > 0, ∀ L : ℝ, ∀ lam : Fin l → ℝ, 1 ≤ L → (∀ i, |L^(j i)*lam i| ≤ C) → (∀ x : ℝ, |x| ≤ A*L → ‖c.coord (flowWord c k r (fun i => lam i*Ring.choose x (j i)))‖ ≤ B) ∧ (∀ x y : ℝ, |x| ≤ A*L → |y| ≤ A*L → ‖c.coord (flowWord c k r (fun i => lam i*Ring.choose x (j i))) - c.coord (flowWord c k r (fun i => lam i*Ring.choose y (j i)))‖ ≤ (B/L)*|x-y|) := by obtain ⟨U,hU,hu⟩ := binomial_parameters_bounds j A C hC obtain ⟨M,hM,hm,hd⟩ := flowWord_bounds c k r U refine ⟨M*(U+1),by positivity,?_⟩ intro L lam hL hlam obtain ⟨hv,he⟩ := hu L lam hL hlam have hLp : 0 < L := lt_of_lt_of_le zero_lt_one hL constructor · intro x hx exact (hm _ (hv x hx)).trans (by nlinarith) · intro x y hx hy have h1 := hd _ _ (hv x hx) (hv y hy) have h2 := mul_le_mul_of_nonneg_left (he x y hx hy) hM.le apply h1.trans (h2.trans _) have h3 : M*U ≤ M*(U+1) := by nlinarith have h4 := mul_le_mul_of_nonneg_right (div_le_div_of_nonneg_right h3 hLp.le) (abs_nonneg (x-y)) convert h4 using 1; ring
end MalcevTailSectionendend
sectionnoncomputable sectionnamespace MalcevTailSectionopen RationalLattice RationalPolynomialMapvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] {n l : ℕ}variable (c : RealCoordinates G n) (k : Fin n → ℤ) (r : Fin l → ℕ)
def flowDifference (t : (Fin l ⊕ Fin l) → ℝ) : G := flowWord c k r (fun i => t (Sum.inl i)) * (flowWord c k r (fun i => t (Sum.inr i)))⁻¹
omit [IsTopologicalGroup G] inlemma polynomialMap_flowDifference : IsPolynomialMap c (flowDifference c k r) := by apply polynomialMap_mul · exact polynomialMap_comp c (polynomialMap_flowWord c k r) (fun i => RationalPolynomialMap.coordinate (Sum.inl i)) · apply polynomialMap_inv exact polynomialMap_comp c (polynomialMap_flowWord c k r) (fun i => RationalPolynomialMap.coordinate (Sum.inr i))
omit [IsTopologicalGroup G] inlemma flowDifference_contDiff : ContDiff ℝ (⊤ : ℕ∞) (fun x => c.coord (flowDifference c k r x)) := by apply contDiff_pi.mpr intro i exact RationalPolynomialMap.contDiff (polynomialMap_flowDifference c k r i)
omit [IsTopologicalGroup G] intheorem flow_displacement_bounds (R : ℝ) : ∃ M > 0, ∀ x y : Fin l → ℝ, ‖x‖ ≤ R → ‖y‖ ≤ R → ‖c.coord (flowWord c k r x * (flowWord c k r y)⁻¹)‖ ≤ M*‖x-y‖ := by have hd := flowDifference_contDiff c k r obtain ⟨D,hD⟩ := (isCompact_closedBall (0 : (Fin l ⊕ Fin l) → ℝ) R).exists_bound_of_continuousOn (hd.continuous_fderiv (by simp)).continuousOn refine ⟨max D 0+1,by positivity,?_⟩ intro x y hx hy have hR : 0 ≤ R := (norm_nonneg x).trans hx have hb (u v : Fin l → ℝ) (hu : ‖u‖ ≤ R) (hv : ‖v‖ ≤ R) : ‖Sum.elim u v‖ ≤ R := by apply (pi_norm_le_iff_of_nonneg hR).mpr intro i cases i with | inl i => exact (norm_le_pi_norm u i).trans hu | inr i => exact (norm_le_pi_norm v i).trans hv have hdiff : ‖Sum.elim x y - Sum.elim y y‖ ≤ ‖x-y‖ := by apply (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr intro i cases i with | inl i => exact norm_le_pi_norm (x-y) i | inr i => simp have hid : c.coord (flowDifference c k r (Sum.elim y y)) = 0 := by funext i simp only [flowDifference,Sum.elim_inl,Sum.elim_inr,mul_inv_cancel,c.one_coord,Pi.zero_apply] have he := Convex.norm_image_sub_le_of_norm_fderiv_le (fun x (_ : x ∈ Metric.closedBall (0 : (Fin l ⊕ Fin l) → ℝ) R) => hd.differentiable (by simp) x) (fun x hx => (hD x hx).trans (show D ≤ max D 0+1 by grind)) (convex_closedBall (0 : (Fin l ⊕ Fin l) → ℝ) R) (by simpa using hb y y hy hy) (by simpa using hb x y hx hy) rw [hid,sub_zero] at he exact he.trans (mul_le_mul_of_nonneg_left hdiff (by positivity))
end MalcevTailSectionendend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace MalcevTailSectionopen RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] {n l : ℕ}variable (c : RealCoordinates G n) (k : Fin n → ℤ) (r : Fin l → ℕ) (j : Fin l → ℕ)
omit [IsTopologicalGroup G] intheorem smooth_word_displacement (A C : ℝ) (hC : 0 ≤ C) : ∃ B > 0, ∀ L : ℝ, ∀ lam : Fin l → ℝ, 1 ≤ L → (∀ i, |L^(j i)*lam i| ≤ C) → ∀ x y : ℝ, |x| ≤ A*L → |y| ≤ A*L → ‖c.coord (flowWord c k r (fun i => lam i*Ring.choose x (j i)) * (flowWord c k r (fun i => lam i*Ring.choose y (j i)))⁻¹)‖ ≤ (B/L)*|x-y| := by obtain ⟨U,hU,hu⟩ := binomial_parameters_bounds j A C hC obtain ⟨M,hM,hm⟩ := flow_displacement_bounds c k r U refine ⟨M*U,by positivity,?_⟩ intro L lam hL hlam x y hx hy obtain ⟨hv,he⟩ := hu L lam hL hlam have h1 := hm _ _ (hv x hx) (hv y hy) have h2 := mul_le_mul_of_nonneg_left (he x y hx hy) hM.le apply h1.trans convert h2 using 1; ring
end MalcevTailSection
namespace MalcevTailFactoropen RationalLattice RationalFactorPeriods MalcevCharacters MalcevTailSectionvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] {n l : ℕ}variable (c : RealCoordinates G n) (hsk : SecondKind c)variable (χ : G →* Multiplicative ℝ) (k : Fin n → ℤ) (r : Fin l → ℕ) (j : Fin l → ℕ)
omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma error_abs (a : Fin l → G) (i : Fin l) : |error χ a i| = ‖(beta χ a i : UnitAddCircle)‖ := by rw [UnitAddCircle.norm_eq] rfl
include hsk in
omit [IsTopologicalGroup G] intheorem small_word_smooth (A C : ℝ) (hC : 0 ≤ C) : ∃ B > 0, ∀ L : ℝ, ∀ a : Fin l → G, 1 ≤ L → (∀ i, L^(j i)*‖(beta χ a i : UnitAddCircle)‖ ≤ C) → (∀ z : ℤ, |(z:ℝ)| ≤ A*L → ‖c.coord (orderedWord (smallCoeff c χ k r a) j z)‖ ≤ B) ∧ (∀ z w : ℤ, |(z:ℝ)| ≤ A*L → |(w:ℝ)| ≤ A*L → ‖c.coord (orderedWord (smallCoeff c χ k r a) j z * (orderedWord (smallCoeff c χ k r a) j w)⁻¹)‖ ≤ (B/L)*|(z:ℝ)-(w:ℝ)|) := by obtain ⟨B,hB,hb⟩ := smooth_word_bounds c k r j A C hC obtain ⟨D,hD,hd⟩ := smooth_word_displacement c k r j A C hC refine ⟨B+D,by positivity,?_⟩ intro L a hL ha have hLp : 0 < L := lt_of_lt_of_le zero_lt_one hL have he : ∀ i, |L^(j i)*error χ a i| ≤ C := by intro i rw [abs_mul,abs_of_nonneg (pow_nonneg hLp.le _),error_abs] exact ha i have hv (z : ℤ) : flowWord c k r (fun i => error χ a i*Ring.choose (z:ℝ) (j i)) = orderedWord (smallCoeff c χ k r a) j z := flowWord_integer c k r hsk _ j z constructor · intro z hz rw [← hv z] exact ((hb L _ hL he).1 z hz).trans (by linarith) · intro z w hz hw rw [← hv z,← hv w] exact (hd L _ hL he z w hz hw).trans (mul_le_mul_of_nonneg_right (div_le_div_of_nonneg_right (by linarith) hLp.le) (abs_nonneg _))
end MalcevTailFactor
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.LeibmanSquare02import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionendend
sectionnoncomputable sectionnamespace MalcevSubspaceQuotientopen RationalLattice MalcevCharacters
lemma prod_map_mul_of_central {A M : Type*} [Monoid M] (f g : A → M) (hg : ∀ a, g a ∈ Submonoid.center M) (l : List A) : (l.map (fun a => f a*g a)).prod=(l.map f).prod*(l.map g).prod := by induction l with | nil => simp | cons a l ih => simp only [List.map_cons,List.prod_cons,ih] have hc : g a * (l.map f).prod=(l.map f).prod*g a := (Submonoid.mem_center_iff.mp (hg a) _).symm calc _ = f a*(g a*(l.map f).prod)*(l.map g).prod := by simp [mul_assoc] _ = _ := by rw [hc]; simp [mul_assoc]
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c)variable (N : Subgroup G) [N.Normal]
include hsk inomit [IsTopologicalGroup G] inlemma mk_coordinates_add_central (x y : Fin n → ℝ) (hy : ∀ i, (QuotientGroup.mk (axis c i (y i)) : G ⧸ N) ∈ Subgroup.center (G ⧸ N)) : (QuotientGroup.mk (c.coord.symm (x+y)) : G ⧸ N) = QuotientGroup.mk (c.coord.symm x)*QuotientGroup.mk (c.coord.symm y) := by rw [mk_coordinates c hsk N,mk_coordinates c hsk N,mk_coordinates c hsk N] simp only [Pi.add_apply,hsk.axis_add,QuotientGroup.mk_mul,List.ofFn_eq_map] apply prod_map_mul_of_central exact hy
include hsk inomit [IsTopologicalGroup G] inlemma mk_coordinates_central (y : Fin n → ℝ) (hy : ∀ i, (QuotientGroup.mk (axis c i (y i)) : G ⧸ N) ∈ Subgroup.center (G ⧸ N)) : (QuotientGroup.mk (c.coord.symm y) : G ⧸ N) ∈ Subgroup.center (G ⧸ N) := by rw [mk_coordinates c hsk N] apply Subgroup.list_prod_mem intro a ha obtain ⟨i,rfl⟩ := List.mem_ofFn.mp ha exact hy i
variable (J : Set (Fin n))variable (hJ : ∀ j∈J, ∀ t : ℝ, (QuotientGroup.mk (axis c j t) : G ⧸ N) ∈ Subgroup.center (G ⧸ N))
include hJ inomit [IsTopologicalGroup G] inlemma mask_central (x : Fin n → ℝ) (i : Fin n) : (QuotientGroup.mk (axis c i (mask J x i)) : G ⧸ N) ∈ Subgroup.center (G ⧸ N) := by classical by_cases hi : i∈J · simpa only [mask,ite_eq_left hi] using hJ i hi (x i) · simp [mask,hi]
lemma mask_compl_add_mask (x : Fin n → ℝ) : mask Jᶜ x+mask J x=x := by classical funext i by_cases hi : i∈J <;> simp [mask,hi]
variable (I : Set (Fin n))variable (hN : ∀ g : G, g ∈ N ↔ ∀ i∈I, c.coord g i=0)
include hsk hN hJ in
omit [IsTopologicalGroup G] intheorem coord_mul_cut (g h : G) (i : Fin n) (hi : i∈I) (hij : i∈J) : c.coord (g*h) i=c.coord g i+c.coord h i+ c.coord (strip c Jᶜ g*strip c Jᶜ h) i := by classical let x:=c.coord g let y:=c.coord h let a:=strip c Jᶜ g let b:=strip c Jᶜ h let u:=c.coord.symm (mask J x) let v:=c.coord.symm (mask J y) let q:=QuotientGroup.mk' N have hx : q g=q a*q u := by have he := mk_coordinates_add_central c hsk N (mask Jᶜ x) (mask J x) (mask_central c N J hJ x) rw [mask_compl_add_mask] at he simpa only [x,a,u,q,strip,QuotientGroup.mk'_apply,Homeomorph.symm_apply_apply] using he have hy : q h=q b*q v := by have he := mk_coordinates_add_central c hsk N (mask Jᶜ y) (mask J y) (mask_central c N J hJ y) rw [mask_compl_add_mask] at he simpa only [y,b,v,q,strip,QuotientGroup.mk'_apply,Homeomorph.symm_apply_apply] using he have hu : q u ∈ Subgroup.center (G ⧸ N) := mk_coordinates_central c hsk N (mask J x) (mask_central c N J hJ x) have hcenter (j : Fin n) : (QuotientGroup.mk (axis c j ((mask J x+mask J y) j)) : G ⧸ N) ∈ Subgroup.center (G ⧸ N) := by by_cases hj : j∈J · exact hJ j hj _ · simp [mask,hj] have he₁ := mk_coordinates_add_central c hsk N (c.coord (a*b)) (mask J x+mask J y) hcenter have he₂ := mk_coordinates_add_central c hsk N (mask J x) (mask J y) (mask_central c N J hJ y) have he : (QuotientGroup.mk (g*h) : G ⧸ N) = QuotientGroup.mk (c.coord.symm (c.coord (a*b)+(mask J x+mask J y))) := by rw [he₁,he₂,Homeomorph.symm_apply_apply] change q (g*h)=q (a*b)*(q u*q v) rw [map_mul,hx,hy,map_mul] have hc := Subgroup.mem_center_iff.mp hu (q b) calc _ = q a*(q u*q b)*q v := by simp [mul_assoc] _ = _ := by rw [← hc]; simp [mul_assoc] have he' := (eq_coset_iff c hsk N I hN _ _).mp he i hi simp only [Homeomorph.apply_symm_apply,Pi.add_apply,mask,ite_eq_left hij] at he' change c.coord (g*h) i=c.coord g i+c.coord h i+c.coord (a*b) i dsimp [x,y] at he' linarith only [he']
end MalcevSubspaceQuotientendend
sectionnoncomputable sectionopen scoped commutatorElementnamespace MalcevWeightedCoordinatesopen RationalLattice MalcevCharacters CubeFaces MalcevSubspaceQuotientvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c)variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)variable (w : Fin n → ℕ)variable (hH : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin n, w i<k → c.coord g i=0)
include hH inomit [IsTopologicalGroup G] inlemma axis_mem_level (i : Fin n) (t : ℝ) : axis c i t∈H.level (w i) := by apply (hH _ _).mpr intro j hj have hji : j≠i := by intro he; subst j; exact (lt_irrefl _ hj) simp [hji]
include h1 hH inomit [IsTopologicalGroup G] inlemma axis_central_mod_next (k : ℕ) [(H.level (k+1)).Normal] (j : Fin n) (hj : k≤w j) (t : ℝ) : (QuotientGroup.mk (axis c j t) : G ⧸ H.level (k+1))∈Subgroup.center (G ⧸ H.level (k+1)) := by apply Subgroup.mem_center_iff.mpr intro a induction a using Quotient.inductionOn with | h a => apply commutatorElement_eq_one_iff_mul_comm.mp change ⁅(QuotientGroup.mk' (H.level (k+1))) a, (QuotientGroup.mk' (H.level (k+1))) (axis c j t)⁆ = 1 rw [← map_commutatorElement (QuotientGroup.mk' (H.level (k+1)))] apply (QuotientGroup.eq_one_iff _).mpr have ha : a∈H.level 1 := by rw [h1]; trivial have hb : axis c j t∈H.level k := H.antitone hj (axis_mem_level c H w hH j t) have hc := H.commutator_le 1 k (Subgroup.commutator_mem_commutator ha hb) simpa only [Nat.add_comm] using hc
include hsk h0 h1 hH in
omit [IsTopologicalGroup G] intheorem weighted_mul (g h : G) (i : Fin n) : c.coord (g*h) i=c.coord g i+c.coord h i+ c.coord (strip c {j | w i≤w j}ᶜ g*strip c {j | w i≤w j}ᶜ h) i := by let := LeibmanSquare.level_normal H h0 (w i+1) apply coord_mul_cut c hsk (H.level (w i+1)) {j | w i≤w j} (fun j hj t => axis_central_mod_next c H h1 w hH (w i) j hj t) {j | w j<w i+1} (hH (w i+1)) g h i (by simp) (by simp)
end MalcevWeightedCoordinatesendend
sectionnoncomputable sectionnamespace MalcevWeightedCoordinatesopen RationalLattice MalcevCharacters CubeFaces MalcevSubspaceQuotientvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n : ℕ} (c : RealCoordinates G n)variable (w : Fin n → ℕ) (p : Equiv.Perm (Fin n)) (hp : Monotone (w ∘ p))
def reorderHomeomorph : G ≃ₜ (Fin n → ℝ) where toFun g i := c.coord g (p i) invFun x := c.coord.symm (fun j => x (p.symm j)) left_inv g := by change c.coord.symm (fun j => c.coord g (p (p.symm j)))=g simp right_inv x := by funext i change c.coord (c.coord.symm (fun j => x (p.symm j))) (p i)=x i simp continuous_toFun := continuous_pi (fun i => (continuous_apply (p i)).comp c.coord.continuous) continuous_invFun := c.coord.symm.continuous.comp (continuous_pi (fun j => continuous_apply (p.symm j)))
include hp inlemma lower_index {a i : Fin n} (ha : w a < w (p i)) : (p.symm a).val < i.val := by by_contra hn have he : i ≤ p.symm a := Nat.le_of_not_gt hn have hw := hp he have hw' : w (p i) ≤ w a := by simpa only [Function.comp_apply,Equiv.apply_symm_apply] using hw exact (not_lt_of_ge hw') ha
def lowerVector (i : Fin n) (x : Fin i.val → ℝ) (a : Fin n) : ℝ := if ha : w a < w (p i) then x ⟨(p.symm a).val,lower_index w p hp ha⟩ else 0
omit [IsTopologicalGroup G] inlemma lowerVector_coordinates (i : Fin n) (g : G) : lowerVector w p hp i (fun j => c.coord g (p ⟨j.val,lt_trans j.isLt i.isLt⟩)) = mask {j | w (p i) ≤ w j}ᶜ (c.coord g) := by funext a unfold lowerVector mask by_cases ha : w a < w (p i) · have hn : ¬ w (p i) ≤ w a := not_le_of_gt ha simp only [dite_eq_left ha,Set.mem_compl_iff,Set.mem_ofPred_eq,ite_eq_left hn] exact congrArg (c.coord g) (p.apply_symm_apply a) · have hn : w (p i) ≤ w a := le_of_not_gt ha simp [ha,hn]
omit [IsTopologicalGroup G] inlemma lower_correction_exists (i : Fin n) : ∃ P : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ, ∀ v : (Fin i.val ⊕ Fin i.val) → ℝ, c.coord (c.coord.symm (lowerVector w p hp i (fun j => v (Sum.inl j))) * c.coord.symm (lowerVector w p hp i (fun j => v (Sum.inr j)))) (p i) = MvPolynomial.eval₂ (algebraMap ℚ ℝ) v P := by apply polynomialMap_mul c all_goals intro a simp only [Homeomorph.apply_symm_apply] unfold lowerVector split_ifs with ha · exact RationalPolynomialMap.coordinate _ · exact RationalPolynomialMap.zero
def sortedCorrection (i : Fin n) : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ := (lower_correction_exists c w p hp i).choose
variable (hsk : SecondKind c) (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)variable (hH : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin n, w i < k → c.coord g i=0)
include hsk h0 h1 hH inomit [IsTopologicalGroup G] inlemma sorted_mul (g h : G) (i : Fin n) : c.coord (g*h) (p i)=c.coord g (p i)+c.coord h (p i)+ MvPolynomial.eval₂ (algebraMap ℚ ℝ) (Sum.elim (fun j => c.coord g (p ⟨j.val,lt_trans j.isLt i.isLt⟩)) (fun j => c.coord h (p ⟨j.val,lt_trans j.isLt i.isLt⟩))) (sortedCorrection c w p hp i) := by rw [weighted_mul c hsk H h0 h1 w hH g h (p i)] congr 1 have he := (lower_correction_exists c w p hp i).choose_spec (Sum.elim (fun j => c.coord g (p ⟨j.val,lt_trans j.isLt i.isLt⟩)) (fun j => c.coord h (p ⟨j.val,lt_trans j.isLt i.isLt⟩))) simpa only [Sum.elim_inl,Sum.elim_inr,lowerVector_coordinates,strip,sortedCorrection] using he
def sortedCoordinates : RealCoordinates G n where coord := reorderHomeomorph c p one_coord i := c.one_coord (p i) correction := sortedCorrection c w p hp mul_coord := sorted_mul c w p hp hsk H h0 h1 hH
end MalcevWeightedCoordinates
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.MalcevWeighted01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionendend
sectionnoncomputable sectionnamespace MalcevWeightedCoordinates
lemma exists_sorting_permutation {n : ℕ} (w : Fin n → ℕ) : ∃ p : Equiv.Perm (Fin n), Monotone (w ∘ p) := by classical let l := (List.finRange n).mergeSort (fun i j => decide (w i ≤ w j)) have hl : l.Perm (List.finRange n) := List.mergeSort_perm _ _ have hlen : l.length=n := by simpa using hl.length_eq have hnd : l.Nodup := hl.nodup_iff.mpr (List.nodup_finRange n) have hall : ∀ i : Fin n, i∈l := fun i => hl.mem_iff.mpr (List.mem_finRange i) let e := List.Nodup.getEquivOfForallMemList l hnd hall let p := (Fin.castOrderIso hlen.symm).toEquiv.trans e refine ⟨p,?_⟩ have hs : l.Pairwise (fun i j => w i ≤ w j) := by have hh := List.pairwise_mergeSort (le := fun i j : Fin n => decide (w i ≤ w j)) (fun a b c hab hbc => by simpa using le_trans (of_decide_eq_true hab) (of_decide_eq_true hbc)) (fun a b => by simpa using le_total (w a) (w b)) (List.finRange n) simpa only [decide_eq_true_eq] using hh intro i j hij change w (l.get (Fin.cast hlen.symm i)) ≤ w (l.get (Fin.cast hlen.symm j)) rcases eq_or_lt_of_le hij with he|he · simp [he] · exact hs.rel_get_of_lt he
lemma exists_weight_cutoff {n : ℕ} (w : Fin n → ℕ) (hw : Monotone w) (k : ℕ) : ∃ r : ℕ, r ≤ n ∧ ∀ i : Fin n, w i < k ↔ i.val < r := by classical let P : ℕ → Prop := fun r => ∀ i : Fin n, r ≤ i.val → k ≤ w i have hex : ∃ r, P r := ⟨n,by intro i hi; omega⟩ refine ⟨Nat.find hex,Nat.find_min' hex (show P n from by intro i hi; omega),?_⟩ intro i constructor · intro hi by_contra hn exact (not_le_of_gt hi) (Nat.find_spec hex i (Nat.le_of_not_gt hn)) · intro hi by_contra hn have hki : k ≤ w i := Nat.le_of_not_gt hn have hp : P i.val := by intro j hj exact hki.trans (hw hj) have hh := Nat.find_min' hex hp omega
end MalcevWeightedCoordinatesendend
sectionnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)variable (H : Subgroup G) (I : Set (Fin n))variable (hH : ∀ g : G, g ∈ H ↔ ∀ i ∈ I, c.coord g i = 0)
include hH inlemma basisFlow_mem_subspace {i : Fin n} (hi : i ∉ I) (t : ℝ) : basisFlow c i t ∈ H := by apply realPower_mem_of_coordinates c H I hH apply (hH _).mpr intro j hj have hji : j ≠ i := by intro he; exact hi (he ▸ hj) simp [basisElement,hji]
include hH inlemma peel_mem_subspace {g : G} (hg : g ∈ H) (k : ℕ) : peel c g k ∈ H := by classical induction k with | zero => exact hg | succ k ih => unfold peel split_ifs with hk · apply H.mul_mem _ ih by_cases hi : (⟨k,hk⟩ : Fin n) ∈ I · rw [(hH _).mp ih _ hi,neg_zero,basisFlow_zero] exact H.one_mem · exact basisFlow_mem_subspace c H I hH hi _ · exact ih
include hH inlemma expCoordinates_subspace (g : G) : g ∈ H ↔ ∀ i ∈ I, expCoordinates c g i = 0 := by classical constructor · intro hg i hi exact (hH _).mp (peel_mem_subspace c H I hH hg i.val) i hi · intro hg rw [← expProduct_expCoordinates c g] apply H.list_prod_mem intro x hx obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hx by_cases hi : i ∈ I · rw [hg i hi,basisFlow_zero] exact H.one_mem · exact basisFlow_mem_subspace c H I hH hi _
include hH in
theorem secondCoordinates_subspace [IsTopologicalGroup G] (g : G) : g ∈ H ↔ ∀ i ∈ I, (secondCoordinates c).coord g i = 0 := expCoordinates_subspace c H I hH g
end RationalLatticeendend
sectionnoncomputable sectionnamespace MalcevWeightedCoordinatesopen RationalLattice MalcevCharacters CubeFacesvariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n) (H : Filtration G)variable (s : ℕ) (hs : H.level (s+1)=⊥)
include hs inlemma exists_axis_out (i : Fin n) : ∃ k, axis c i 1∉H.level k := by refine ⟨s+1,?_⟩ rw [hs,Subgroup.mem_bot] intro he have hf := congrArg (fun g => c.coord g i) he simp [axis,c.one_coord] at hf
def subspaceWeight (i : Fin n) : ℕ := by classical exact Nat.find (exists_axis_out c H s hs i)-1
variable (h0 : H.level 0=⊤)include h0 hs inlemma weight_lt_iff_out (i : Fin n) (k : ℕ) : subspaceWeight c H s hs i < k ↔ axis c i 1∉H.level k := by classical have hz : 0 < Nat.find (exists_axis_out c H s hs i) := by by_contra hn have he : Nat.find (exists_axis_out c H s hs i)=0 := by omega have hnot := Nat.find_spec (exists_axis_out c H s hs i) rw [he,h0] at hnot exact hnot (Subgroup.mem_top _) constructor · intro hk hm have hle : Nat.find (exists_axis_out c H s hs i) ≤ k := by change Nat.find (exists_axis_out c H s hs i)-1 < k at hk omega exact Nat.find_spec (exists_axis_out c H s hs i) (H.antitone hle hm) · intro hm have hle := Nat.find_min' (exists_axis_out c H s hs i) hm unfold subspaceWeight omega
lemma axis_mem_subspace_iff (A : Subgroup G) (I : Set (Fin n)) (hA : ∀ g : G, g∈A ↔ ∀ i∈I, c.coord g i=0) (i : Fin n) : axis c i 1∈A ↔ i∉I := by classical constructor · intro hm hi have hz := (hA _).mp hm i hi simp [axis] at hz · intro hi apply (hA _).mpr intro j hj have hji : j≠i := by intro he; subst j; exact hi hj simp [axis,hji]
variable (hH : ∀ k : ℕ, ∃ I : Set (Fin n), ∀ g : G, g∈H.level k ↔ ∀ i∈I, c.coord g i=0)include h0 hH hs in
theorem subspaceWeight_level (k : ℕ) (g : G) : g∈H.level k ↔ ∀ i : Fin n, subspaceWeight c H s hs i < k → c.coord g i=0 := by classical obtain ⟨I,hI⟩ := hH k have hi (i : Fin n) : subspaceWeight c H s hs i < k ↔ i∈I := by rw [weight_lt_iff_out c H s hs h0,axis_mem_subspace_iff c (H.level k) I hI] simp rw [hI] simp only [hi]
end MalcevWeightedCoordinatesendend
sectionnoncomputable sectionnamespace MalcevWeightedCoordinatesopen RationalLattice MalcevCharacters CubeFacesvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n : ℕ} (c : RealCoordinates G n)variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)variable (s : ℕ) (hs : H.level (s+1)=⊥)variable (hH : ∀ k : ℕ, ∃ I : Set (Fin n), ∀ g : G, g∈H.level k ↔ ∀ i∈I, c.coord g i=0)variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)include h0 h1 hs hH hΓ in
theorem exists_adapted_secondKind_coordinates : ∃ c' : RealCoordinates G n, SecondKind c' ∧ (∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c'.coord g i=z) ∧ ∀ k : ℕ, ∃ r : ℕ, r ≤ n ∧ ∀ g : G, g∈H.level k ↔ ∀ i : Fin n, i.val < r → c'.coord g i=0 := by classical let c₁ := secondCoordinates c have hk₁ : SecondKind c₁ := secondCoordinates_secondKind c have hH₁ : ∀ k : ℕ, ∃ I : Set (Fin n), ∀ g : G, g∈H.level k ↔ ∀ i∈I, c₁.coord g i=0 := by intro k obtain ⟨I,hI⟩ := hH k exact ⟨I,secondCoordinates_subspace c (H.level k) I hI⟩ have hΓ₁ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c₁.coord g i=z := expCoordinates_lattice c Γ hΓ let w:=subspaceWeight c₁ H s hs have hw : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin n, w i < k → c₁.coord g i=0 := subspaceWeight_level c₁ H s hs h0 hH₁ obtain ⟨p,hp⟩ := exists_sorting_permutation w let c₂ := sortedCoordinates c₁ w p hp hk₁ H h0 h1 hw have hcoord (g : G) (i : Fin n) : c₂.coord g i=c₁.coord g (p i) := rfl have hΓ₂ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c₂.coord g i=z := by intro g rw [hΓ₁] constructor · intro hg i exact hg (p i) · intro hg i simpa only [hcoord,Equiv.apply_symm_apply] using hg (p.symm i) refine ⟨secondCoordinates c₂,secondCoordinates_secondKind c₂, expCoordinates_lattice c₂ Γ hΓ₂,?_⟩ intro k obtain ⟨r,hr,hrk⟩ := exists_weight_cutoff (w ∘ p) hp k refine ⟨r,hr,?_⟩ apply secondCoordinates_adapted c₂ (H.level k) r intro g rw [hw] constructor · intro hg i hi exact hg (p i) ((hrk i).mpr hi) · intro hg i hi have hpi : (w ∘ p) (p.symm i) < k := by simpa using hi simpa only [hcoord,Equiv.apply_symm_apply] using hg (p.symm i) ((hrk _).mp hpi)
end MalcevWeightedCoordinates
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.Blocks02import OAI.Geometry.NilpotentCharts.Main
namespace OAI
open scoped BigOperatorssectionnoncomputable sectionopen Filter MeasureTheoryopen scoped BigOperators ENNReal Topologynoncomputable sectionopen scoped BigOperators Topology BoundedContinuousFunctionnoncomputable sectionopen scoped BigOperatorsopen MeasureTheory Filter Functionnoncomputable sectionopen scoped BigOperatorsnoncomputable sectionopen Filter MeasureTheoryopen scoped Topology BoundedContinuousFunction NNRealnoncomputable sectionopen scoped Topology BigOperatorsnoncomputable sectionopen scoped Topology BigOperators commutatorElementnoncomputable sectionopen scoped Topology BoundedContinuousFunction NNRealnoncomputable sectionopen scoped BigOperatorsnoncomputable sectionopen Filter MeasureTheoryopen scoped Topology BigOperators BoundedContinuousFunction NNRealnoncomputable sectionopen Filter MeasureTheoryopen scoped Topology BigOperatorsnoncomputable sectionopen Filter MeasureTheoryopen scoped Topology BigOperators BoundedContinuousFunction NNRealnoncomputable sectionopen scoped Topology BigOperatorsnoncomputable sectionopen scoped Topology BoundedContinuousFunction NNReal BigOperatorsnoncomputable sectionopen Filter MeasureTheoryopen scoped Topology BigOperators BoundedContinuousFunction NNRealnoncomputable sectionopen Filter MeasureTheoryopen scoped Topology BigOperators BoundedContinuousFunction NNRealnamespace SourceMenuLiteralopen SourceProductChart SourceChartedMenu SourceFiniteMenuModelsopen SourceAdmissible SourceBlocks SourceMenuAlignment SourcePivotPathsopen ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScalesvariable {a s r s' : ℕ}
structure CosetPiece (F : Menu s) (K : ℝ≥0) where index : Fin F.size g : F.G index x : F.G index ⧸ F.Γ index obs : (F.G index ⧸ F.Γ index) →ᵇ ℝ lip : letI : MetricSpace (F.G index ⧸ F.Γ index) := (F.metric index).replaceTopology (F.compatible index) LipschitzWith K obs range : ∀ z, obs z ∈ Set.Icc (0:ℝ) 1
variable {F : Menu s} {K : ℝ≥0}def CosetPiece.eval (P : CosetPiece F K) (k : ℤ) : ℝ := P.obs (P.g^k • P.x)
def CosetPiece.lift (P : CosetPiece F K) : Piece F K where index := P.index g := P.g x := P.x.out obs := P.obs lip := P.lip range := P.range
lemma CosetPiece.lift_eval (P : CosetPiece F K) (k : ℤ) : P.lift.eval k = P.eval k := by change P.obs (P.g^k • (QuotientGroup.mk P.x.out : F.G P.index ⧸ F.Γ P.index)) = _ rw [show (QuotientGroup.mk P.x.out : F.G P.index ⧸ F.Γ P.index)=P.x from Quotient.out_eq P.x] rfl
def raiseChart {G : Type} [Group G] [TopologicalSpace G] {Γ : Subgroup G} (C : Chart s G Γ) (h : s ≤ s') : Chart s' G Γ := { C with step := by refine le_antisymm ?_ bot_le calc C.filtration.level (s'+1) ≤ C.filtration.level (s+1) := C.filtration.antitone (Nat.add_le_add_right h 1) _ = ⊥ := C.step }
def raiseMenu (F : Menu s) (h : s ≤ s') : Menu s' := { F with chart := fun i => raiseChart (F.chart i) h }
def CosetPiece.raise (P : CosetPiece F K) (h : s ≤ s') : CosetPiece (raiseMenu F h) K := { P with }
structure ModelsSystem (A : Parameters a) (vs : Finset ℚ) (r : ℕ) (F : Menu s) where model : ℕ → Models a r K : ℝ≥0 piece : ℕ → Block a → ∀ (v : ℚ), v ∈ vs → Fin r → ℤ → ℤ → CosetPiece F K represents : ∀ N B v hv c k, model N B v c k = (piece N B v hv c (k/(A.H N B.1 : ℤ)) (k%(A.M N : ℤ))).eval ((k-k%(A.M N : ℤ))/(A.M N : ℤ))
variable {A : Parameters a} {vs : Finset ℚ} (S : ModelsSystem A vs r F)
def ModelsSystem.lift : System A vs r F where model := S.model K := S.K piece N B v hv c j l := (S.piece N B v hv c j l).lift represents := by intro N B v hv c k rw [CosetPiece.lift_eval] exact S.represents N B v hv c k
def ModelsSystem.raise (h : s ≤ s') : ModelsSystem A vs r (raiseMenu F h) where model := S.model K := S.K piece N B v hv c j l := (S.piece N B v hv c j l).raise h represents := S.represents
theorem charted_finite_menu_alignment (a r s : ℕ) : ∃ (bs : Finset (Scale a)) (vs : Finset ℚ) (δ : ℝ), 0 < δ ∧ (∀ b ∈ bs, ∀ j, 0 < b j) ∧ (∀ v ∈ vs, 0 < v) ∧ (∀ b ∈ bs, ∀ B : Block a, blockProduct b B.set ∈ vs) ∧ ∀ (A : Parameters a) (F : Menu s) (S : ModelsSystem A vs r F) (μ : ℕ → Measure (Fin a → ℕ)), (∀ N (hX : ∀ i, 4*primorial (N+1) ≤ A.X N i), μ N = A.law N hX) → ∀ τ : ℝ, 0 < τ → δ ≤ Filter.liminf (fun N => (μ N).real (event bs (S.model N) (A.ht N) τ)) atTop := by let t := max 1 s have ht : 1 ≤ t := le_max_left _ _ have hs : s ≤ t := le_max_right _ _ refine ⟨tuples t r ht,values t r ht,delta t r ht (pivots a), delta_pos t r ht _,tuples_pos t r ht,values_pos t r ht,closure t r ht,?_⟩ intro A F S μ hμ τ hτ exact menu_alignment_liminf t r ht A (raiseMenu F hs) (S.raise hs).lift μ hμ τ hτ
end SourceMenuLiteral
endendendendendendendendendendendendendendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.RawHarmonic01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsection RawSuccessInlineScope11noncomputable sectionopen Filter Topology MeasureTheoryopen scoped BigOperatorsendend RawSuccessInlineScope11
section RawSuccessInlineScope12noncomputable sectionopen MeasureTheory Filter Topologyopen scoped BigOperatorsnamespace MicrocellConditionalopen Finset RawHarmonicProbabilityattribute [local instance] Classical.propDecidable
def eventMass (C:Finset ℕ) (A:Set ℕ) : ℝ := ∑ p∈C,if p∈A then (p:ℝ)⁻¹ else 0
lemma law_apply_units (X W:ℕ) (hw:0<W) (hx:4*W≤X) (A:Set ℕ) : (law X W hw hx:Measure ℕ).real A = eventMass (units X W) A/DyadicHarmonicBoundary.mass X (X^2) W := by unfold eventMass rw [law_apply,units,sum_filter] congr 1 apply sum_congr rfl intro p hp split_ifs <;> simp_all
lemma subset_event_sum (X W:ℕ) (C:Finset ℕ) (hC:C⊆units X W) (A:Set ℕ) : eventMass (units X W) (A∩(C:Set ℕ))=eventMass C A := by unfold eventMass symm calc _ = ∑ p∈C,if p∈A∩(C:Set ℕ) then (p:ℝ)⁻¹ else 0 := by apply sum_congr rfl intro p hp simp [hp] _ = ∑ p∈units X W,if p∈A∩(C:Set ℕ) then (p:ℝ)⁻¹ else 0 := sum_subset hC (fun p hp hnot=>by simp [hnot]) _ = _ := by apply sum_congr rfl intro p hp split_ifs <;> rfl
theorem conditional_ratio (X W:ℕ) (hw:0<W) (hx:4*W≤X) (C:Finset ℕ) (hC:C⊆units X W) (A:Set ℕ) : (law X W hw hx:Measure ℕ).real (A∩(C:Set ℕ)) / (law X W hw hx:Measure ℕ).real (C:Set ℕ) = eventMass C A/(∑ p∈C,(p:ℝ)⁻¹) := by rw [law_apply_units,law_apply_units,subset_event_sum X W C hC A] have hd:eventMass (units X W) (C:Set ℕ)=∑ p∈C,(p:ℝ)⁻¹ := by have hh:=subset_event_sum X W C hC Set.univ rw [Set.univ_inter] at hh exact hh.trans (by simp [eventMass]) rw [hd,div_div_div_cancel_right₀ (mass_pos X W hw hx).ne']
lemma cell_real_law (C:Finset ℕ) (hC:C.Nonempty) (hpos:∀ p∈C,0<p) (A:Set ℕ) : letI : Nonempty C:=hC.coe_sort (MicrocellProbability.weightedLaw (fun p:C=>(p.1:ℝ)⁻¹) (fun p=>inv_pos.mpr (by exact_mod_cast hpos p.1 p.2)) Subtype.val : Measure ℕ).real A = eventMass C A/(∑ p∈C,(p:ℝ)⁻¹) := by classical let : Nonempty C:=hC.coe_sort rw [MicrocellProbability.weightedLaw_apply _ _ _ _ MeasurableSet.of_discrete] simp only [MicrocellHarmonic.weight] rw [sum_coe_sort C (fun p:ℕ=>(p:ℝ)⁻¹)] rw [sum_coe_sort C (fun p:ℕ=>(p:ℝ)⁻¹/(∑ q∈C,(q:ℝ)⁻¹)*(if p∈A then 1 else 0))] unfold eventMass rw [sum_div] apply sum_congr rfl intro p hp split_ifs <;> simp_all
theorem conditional_event_error (X W:ℕ) (hw:0<W) (hx:4*W≤X) (C:Finset ℕ) (hC:C.Nonempty) (hsub:C⊆units X W) (x₀ R:ℝ) (hbase:(X:ℝ)≤x₀) (hR:0≤R) (hwindow:∀ p∈C,x₀≤(p:ℝ) ∧ (p:ℝ)≤x₀+R) (A:Set ℕ) : letI : Nonempty C:=hC.coe_sort |(law X W hw hx:Measure ℕ).real (A∩(C:Set ℕ)) / (law X W hw hx:Measure ℕ).real (C:Set ℕ) - (MicrocellProbability.uniformLaw (Subtype.val:C→ℕ):Measure ℕ).real A| ≤ R/X := by let : Nonempty C:=hC.coe_sort have hxp:(0:ℝ)<X:=by exact_mod_cast (show 0<X by omega) have hx₀:0<x₀:=hxp.trans_le hbase have hpos:∀ p∈C,0<p:=by intro p hp have hh:=hx₀.trans_le (hwindow p hp).1 exact_mod_cast hh rw [conditional_ratio X W hw hx C hsub A,←cell_real_law C hC hpos A] have hh:=MicrocellProbability.harmonic_event_error (fun p:C=>(p.1:ℝ)) x₀ R hx₀ hR (fun p=>hwindow p.1 p.2) (Subtype.val:C→ℕ) A MeasurableSet.of_discrete exact hh.trans (div_le_div_of_nonneg_left hR hxp hbase)
theorem conditional_success (X W:ℕ) (hw:0<W) (hx:4*W≤X) (C:Finset ℕ) (hC:C.Nonempty) (hsub:C⊆units X W) (x₀ R c:ℝ) (hbase:(X:ℝ)≤x₀) (hR:0≤R) (hwindow:∀ p∈C,x₀≤(p:ℝ) ∧ (p:ℝ)≤x₀+R) (A:Set ℕ) (herr:R/X≤c/6) (hs:letI : Nonempty C:=hC.coe_sort c/2<(MicrocellProbability.uniformLaw (Subtype.val:C→ℕ):Measure ℕ).real A) : c/3<(law X W hw hx:Measure ℕ).real (A∩(C:Set ℕ)) / (law X W hw hx:Measure ℕ).real (C:Set ℕ) := by have hh:=conditional_event_error X W hw hx C hC hsub x₀ R hbase hR hwindow A have hh':=(abs_le.mp hh).1 linarith
end MicrocellConditionalendend RawSuccessInlineScope12
section RawSuccessInlineScope13
noncomputable sectionopen MeasureTheoryopen scoped BigOperatorsnamespace MicrocellFibersattribute [local instance] Classical.propDecidableopen Finset RawHarmonicProbability MicrocellConditional
def fiber (M N k r:ℕ) : Finset ℕ := (Ico (M*k) (M*(k+N))).filter (fun p=>p%M=r)
def point (M k r b:ℕ) : ℕ := M*k+r+M*b
lemma point_mem (M N k r:ℕ) (_:0<M) (hr:r<M) (b:Fin N) : point M k r b∈fiber M N k r := by apply mem_filter.mpr constructor · apply mem_Ico.mpr constructor · unfold point; omega · unfold point have hb:M*(b.val+1)≤M*N:=Nat.mul_le_mul_left M (by omega) nlinarith · simp [point,Nat.add_mod,Nat.mod_eq_of_lt hr]
lemma point_injective (M k r:ℕ) (hM:0<M) : Function.Injective (point M k r) := by intro a b hab unfold point at hab exact Nat.eq_of_mul_eq_mul_left hM (Nat.add_left_cancel hab)
lemma represent (M N k r p:ℕ) (hM:0<M) (hp:p∈fiber M N k r) : ∃ b:Fin N,point M k r b=p := by obtain ⟨hpI,hpr⟩:=mem_filter.mp hp obtain ⟨hlo,hhi⟩:=mem_Ico.mp hpI have hqlo:k≤p/M:=(Nat.le_div_iff_mul_le hM).mpr (by simpa [Nat.mul_comm] using hlo) have hqhi:p/M<k+N:=(Nat.div_lt_iff_lt_mul hM).mpr (by simpa [Nat.mul_comm] using hhi) refine ⟨⟨p/M-k,by omega⟩,?_⟩ have hq:k+(p/M-k)=p/M:=Nat.add_sub_of_le hqlo dsimp [point] calc M*k+r+M*(p/M-k)=M*(k+(p/M-k))+r:=by ring _ = M*(p/M)+p%M:=by rw [hq,hpr] _ = p:=Nat.div_add_mod p M
def parametrization (M N k r:ℕ) (hM:0<M) (hr:r<M) : Fin N ≃ fiber M N k r := Equiv.ofBijective (fun b=>⟨point M k r b,point_mem M N k r hM hr b⟩) (by constructor · intro a b hab apply Fin.ext exact point_injective M k r hM (congrArg Subtype.val hab) · intro p obtain ⟨b,hb⟩:=represent M N k r p hM p.2 exact ⟨b,Subtype.ext hb⟩)
lemma fiber_card (M N k r:ℕ) (hM:0<M) (hr:r<M) : (fiber M N k r).card=N := by simpa only [Fintype.card_coe,Fintype.card_fin] using (Fintype.card_congr (parametrization M N k r hM hr)).symm
lemma fiber_nonempty (M N k r:ℕ) (hM:0<M) (hN:0<N) (hr:r<M) : (fiber M N k r).Nonempty := by rw [←card_pos,fiber_card M N k r hM hr] exact hN
lemma fiber_subset_units (X W M N k r:ℕ) (hWM:W∣M) (hr:W.Coprime r) (hlo:X≤M*k) (hhi:M*(k+N)≤X^2) : fiber M N k r⊆units X W := by intro p hp obtain ⟨hpI,hpr⟩:=mem_filter.mp hp obtain ⟨hp₀,hp₁⟩:=mem_Ico.mp hpI apply mem_filter.mpr refine ⟨mem_Ico.mpr ⟨hlo.trans hp₀,hp₁.trans_le hhi⟩,?_⟩ have hm:W.Coprime (p%M):=hpr.symm ▸ hr have hmod:(p%M)%W=p%W:=Nat.mod_mod_of_dvd p hWM have hw:W.Coprime (p%W):=by rw [←hmod] exact (UnitIntervalCounts.coprime_mod W (p%M)).mpr hm exact (UnitIntervalCounts.coprime_mod W p).mp hw
lemma uniform_fiber (M N k r:ℕ) (hM:0<M) (hN:0<N) (hr:r<M) (A:Set ℕ) : letI : Nonempty (fiber M N k r):=(fiber_nonempty M N k r hM hN hr).coe_sort letI : Nonempty (Fin N):=Fin.pos_iff_nonempty.mp hN (MicrocellProbability.uniformLaw (Subtype.val : fiber M N k r→ℕ):Measure ℕ).real A = (MicrocellProbability.uniformLaw (fun b:Fin N=>point M k r b):Measure ℕ).real A := by let : Nonempty (fiber M N k r):=(fiber_nonempty M N k r hM hN hr).coe_sort let : Nonempty (Fin N):=Fin.pos_iff_nonempty.mp hN rw [MicrocellProbability.uniformLaw_apply _ _ MeasurableSet.of_discrete, MicrocellProbability.uniformLaw_apply _ _ MeasurableSet.of_discrete] unfold MicrocellHarmonic.uniform simp only [Fintype.card_coe,Fintype.card_fin,fiber_card M N k r hM hr] exact (Equiv.sum_comp (parametrization M N k r hM hr) (fun p:fiber M N k r=>(N:ℝ)⁻¹*(if p.1∈A then 1 else 0))).symm
theorem raw_fiber_success (X W M N k r:ℕ) (hW:0<W) (hX:4*W≤X) (hM:0<M) (hN:0<N) (hr:r<M) (hWR:W.Coprime r) (hWM:W∣M) (hlo:X≤M*k) (hhi:M*(k+N)≤X^2) (c:ℝ) (A:Set ℕ) (herr:((M*N:ℕ):ℝ)/X≤c/6) (hm:letI : Nonempty (Fin N):=Fin.pos_iff_nonempty.mp hN c/2<(MicrocellProbability.uniformLaw (fun b:Fin N=>point M k r b):Measure ℕ).real A) : c/3<(law X W hW hX:Measure ℕ).real (A∩(fiber M N k r:Set ℕ)) / (law X W hW hX:Measure ℕ).real (fiber M N k r:Set ℕ) := by refine conditional_success X W hW hX (fiber M N k r) (fiber_nonempty M N k r hM hN hr) (fiber_subset_units X W M N k r hWM hWR hlo hhi) (M*k) (M*N) c (by exact_mod_cast hlo) (by positivity) ?_ A (by simpa only [Nat.cast_mul] using herr) ?_ · intro p hp obtain ⟨hp₀,hp₁⟩:=mem_Ico.mp (mem_filter.mp hp).1 constructor · exact_mod_cast hp₀ · have hp':p≤M*k+M*N:=by nlinarith exact_mod_cast hp' · rw [uniform_fiber M N k r hM hN hr A] exact hm
end MicrocellFibersendend RawSuccessInlineScope13
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.HarmonicExposure02import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionnoncomputable sectionendend
sectionnoncomputable sectionnamespace RoughFaceShiftopen RationalLattice MalcevCharacters RealPolynomialDegree RoughScales Filteropen RoughSamplingWeights FinitePieceAverages RoughSourceExceptional RoughProductRemovalopen scoped BigOperators Topologyvariable {G : Type} [Group G] [TopologicalSpace G] {dim : ℕ}variable (Γ : Subgroup G) [MetricSpace (G⧸Γ)]variable [IsTopologicalGroup G] (c : RealCoordinates G dim)
theorem raw_conditional_face_uniform (hsk : SecondKind c) (hΓ : ∀ g : G,g∈Γ ↔ ∀ i,∃ z : ℤ,c.coord g i=z) (htop : (inferInstance : MetricSpace (G⧸Γ)).toUniformSpace.toTopologicalSpace = QuotientGroup.instTopologicalSpace Γ) (m v D d : ℕ) (hd : 0<d) (c₀ C₀ : ℝ) (B K : NNReal) (η : ℝ) (hc₀ : 0<c₀) (hC₀ : 0<C₀) (hB : 0<B) (hη : 0<η) (w M : ℕ→ℕ) (U V : ℕ → Fin m → ℝ) (Z0 H : ℕ→ℝ) (L : ℕ→ℤ) (hw : Tendsto w atTop atTop) (hU : ∀ j,Tendsto (fun n=>U n j) atTop atTop) (hUV : ∀ n j,U n j≤V n j) (hZ : ∀ a : ℝ,0<a →Tendsto (fun n=>Z0 n/(1+∑ j,V n j)^a) atTop atTop) (hH : ∀ n,0≤H n) (hHZ : Tendsto (fun n=>H n/Z0 n) atTop (𝓝 0)) (hM : ∀ n,0<M n) (hMs : ∀ n,Smooth (w n) (M n:ℤ)) (hL : ∀ n,0<L n) (hsm : ∀ n,Smooth (w n) (L n)) (hWL : ∀ n,(primorial (w n):ℤ)∣L n) (hUL : ∀ j,Tendsto (fun n=>U n j/(L n:ℝ)) atTop atTop) : ∀ ε : ℝ,0<ε →∀ᶠ n in atTop, ∀ b : Exposure m,b.Legal (U n) (V n) (Z0 n) (w n) (M n) → ∀ X W : ℕ,(W:ℤ)∣(M n:ℤ) → b.a.natAbs.Coprime W → (∀ t∈productTimes b.S b.r (L n),(X:ℝ)≤b.Q/(∏ j,(t j:ℝ))) → (∀ t∈productTimes b.S b.r (L n),(b.Q+b.Δ)/(∏ j,(t j:ℝ))≤(X:ℝ)^2) → ∀ (A : Fin v → ℤ) (P : (Fin (m+v)→ℝ)→G), (∀ i,HasDegree (fun y=>canonicalLog c (P y) i) D) → ∀ (σ : (G⧸Γ) → (G⧸Γ)),LipschitzWith K σ → ∀ h : (Fin m → ℤ) → Fin v → ℤ, (∀ t∈productTimes b.S b.r (L n),∀ i,(d:ℤ)∣h t i ∧ |(h t i:ℝ)|≤H n) → (∀ t∈productTimes b.S b.r (L n),∀ x : Fin v → ℤ, σ (QuotientGroup.mk (P (Fin.append (fun j=>(t j:ℝ)) (fun i=>(x i:ℝ)))))= QuotientGroup.mk (P (Fin.append (fun j=>(t j:ℝ)) (fun i=>((x i+h t i:ℤ):ℝ))))) → HarmonicExposure.rawFiberMass (exceptionalFace Γ m v c₀ C₀ B η b.Z d (M n) A P σ b.S b.r (L n)) X W b.Q b.Δ b.a (M n) / HarmonicExposure.rawFiberMass (productTimes b.S b.r (L n)) X W b.Q b.Δ b.a (M n)<ε := by classical intro ε hε have hu := conditional_face_uniform (Γ:=Γ) (c:=c) hsk hΓ htop m v D d hd c₀ C₀ B K η hc₀ hC₀ hB hη w M U V Z0 H L hw hU hUV hZ hH hHZ hM hMs hL hsm hWL hUL ε hε have hup : ∀ᶠ n in atTop,∀ j,0<U n j := eventually_all.mpr (fun j=>(hU j).eventually (eventually_gt_atTop 0)) filter_upwards [hu,hup] with n hn hUn intro b hb X W hWM ha hlo hhi A P hP σ hσ h hh hid have hτ : ∀ t∈productTimes b.S b.r (L n),0<∏ j,(t j:ℝ) := by intro t ht apply Finset.prod_pos intro j hj have htj := Fintype.mem_piFinset.mp ht j have htpos := (mem_times (b.S j) (b.r j) (L n) (t j) (hL n)).mp htj exact (hUn j).trans_le (((hb.1 j).1).trans htpos.1) have he (T : Finset (Fin m→ℤ)) (hT : T⊆productTimes b.S b.r (L n)) := HarmonicExposure.rawFiberMass_eq_exposed T X W b.Q b.Δ b.a (M n) (by exact_mod_cast hM n) hWM ha (fun t ht=>hτ t (hT ht)) (fun t ht=>hlo t (hT ht)) (fun t ht=>hhi t (hT ht)) have hsub : exceptionalFace Γ m v c₀ C₀ B η b.Z d (M n) A P σ b.S b.r (L n) ⊆ productTimes b.S b.r (L n) := Finset.filter_subset _ _ rw [he _ hsub,he _ (Finset.Subset.refl _)] exact hn b hb A P hP σ hσ h hh hid
end RoughFaceShiftendend
sectionnoncomputable sectionnamespace HarmonicExposureopen RoughSamplingWeights RoughSourceExceptional RoughProductRemoval Finsetopen scoped BigOperatorsattribute [local instance] Classical.propDecidable
def rawTailFiber {m : ℕ} (X : Fin m→ℕ) (W : ℕ) (S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) : Finset (Fin m→ℕ) := by classical exact Fintype.piFinset (fun j=>(Ico (X j) ((X j)^2)).filter (fun t=> W.Coprime t ∧ S j≤(t:ℝ) ∧ (t:ℝ)<2*S j ∧ L∣(t:ℤ)-r j))
def literalFiberMass {m : ℕ} (E : Set (Fin m→ℤ)) (X : Fin m→ℕ) (Xp W : ℕ) (S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (Q Δ : ℝ) (a M : ℤ) : ℝ := by classical exact ∑ t∈(rawTailFiber X W S r L).filter (fun t=>(fun j=>(t j:ℤ))∈E), (∏ j,(t j:ℝ)⁻¹)*∑ p∈pivotFiber Xp Q Δ (∏ j,(t j:ℝ)) a M, if W.Coprime p then (p:ℝ)⁻¹ else 0
lemma rawTail_cast_mem {m : ℕ} (X : Fin m→ℕ) (W : ℕ) (S : Fin m→��) (r : Fin m→ℤ) (L : ℤ) (hL : 0<L) (t : Fin m→ℕ) (ht : t∈rawTailFiber X W S r L) : (fun j=>(t j:ℤ))∈productTimes S r L := by classical apply Fintype.mem_piFinset.mpr intro j have hj := mem_filter.mp (Fintype.mem_piFinset.mp ht j) apply (mem_times (S j) (r j) L (t j) hL).mpr obtain ⟨z,hz⟩ := hj.2.2.2.2 exact ⟨by simpa using hj.2.2.1,by simpa using hj.2.2.2.1,z,by linarith⟩
lemma times_nonneg {m : ℕ} (X : Fin m→ℕ) (S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (hL : 0<L) (hlo : ∀ j,(X j:ℝ)≤S j) (t : Fin m→ℤ) (ht : t∈productTimes S r L) (j : Fin m) : 0≤t j := by have hj := (mem_times (S j) (r j) L (t j) hL).mp (Fintype.mem_piFinset.mp ht j) have hn : (0:ℝ)≤(t j:ℝ) := (Nat.cast_nonneg (X j)).trans ((hlo j).trans hj.1) exact_mod_cast hn
lemma times_nat_mem {m : ℕ} (X : Fin m→ℕ) (W : ℕ) (S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (hL : 0<L) (hWL : (W:ℤ)∣L) (hr : ∀ j,(r j).natAbs.Coprime W) (hlo : ∀ j,(X j:ℝ)≤S j) (hhi : ∀ j,2*S j≤(X j:ℝ)^2) (t : Fin m→ℤ) (ht : t∈productTimes S r L) : (fun j=>(t j).toNat)∈rawTailFiber X W S r L := by classical apply Fintype.mem_piFinset.mpr intro j have hj := (mem_times (S j) (r j) L (t j) hL).mp (Fintype.mem_piFinset.mp ht j) have hn : ((t j).toNat:ℤ)=t j := Int.toNat_of_nonneg (times_nonneg X S r L hL hlo t ht j) have hnr : ((t j).toNat:ℝ)=(t j:ℝ) := by exact_mod_cast hn obtain ⟨z,hz⟩ := hj.2.2 have hcong : L∣((t j).toNat:ℤ)-r j := ⟨z,by rw [hn,hz]; ring⟩ apply mem_filter.mpr refine ⟨mem_Ico.mpr ⟨?_,?_⟩,residue_unit W (t j).toNat (r j) L hWL (hr j) hcong, ?_,?_,hcong⟩ · have hh := (hlo j).trans hj.1 rw [←hnr] at hh exact_mod_cast hh · have hh := hj.2.1.trans_le (hhi j) rw [←hnr] at hh exact_mod_cast hh · rw [hnr] exact hj.1 · rw [hnr] exact hj.2.1
theorem literal_mass_eq {m : ℕ} (E : Set (Fin m→ℤ)) (X : Fin m→ℕ) (Xp W : ℕ) (S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (Q Δ : ℝ) (a M : ℤ) (hL : 0<L) (hWL : (W:ℤ)∣L) (hr : ∀ j,(r j).natAbs.Coprime W) (hlo : ∀ j,(X j:ℝ)≤S j) (hhi : ∀ j,2*S j≤(X j:ℝ)^2) : literalFiberMass E X Xp W S r L Q Δ a M = rawFiberMass ((productTimes S r L).filter (fun t=>t∈E)) Xp W Q Δ a M := by classical unfold literalFiberMass rawFiberMass apply sum_bij (fun t _=>fun j=>(t j:ℤ)) · intro t ht obtain ⟨ht,hE⟩ := mem_filter.mp ht exact mem_filter.mpr ⟨rawTail_cast_mem X W S r L hL t ht,hE⟩ · intro t ht u hu he funext j exact_mod_cast congrFun he j · intro t ht obtain ⟨ht,hE⟩ := mem_filter.mp ht have hh : (fun j=>((t j).toNat:ℤ))=t := funext (fun j=> Int.toNat_of_nonneg (times_nonneg X S r L hL hlo t ht j)) refine ⟨fun j=>(t j).toNat,mem_filter.mpr ⟨times_nat_mem X W S r L hL hWL hr hlo hhi t ht,?_⟩,hh⟩ rwa [hh] · intro t ht simp only [Int.cast_natCast]
end HarmonicExposureendend
section
section RawSuccessInlineScope0noncomputable sectionopen MeasureTheory Filter Topologyopen scoped BigOperatorsnamespace MicrocellHarmonicvariable {I : Type*} [Fintype I] [Nonempty I]
def weight (w : I → ℝ) (i : I) : ℝ := w i / ∑ j,w j
def uniform (_i : I) : ℝ := (Fintype.card I : ℝ)⁻¹
lemma total_pos (w : I → ℝ) (hw : ∀ i,0<w i) : 0 < ∑ i,w i := Finset.sum_pos (fun i _=>hw i) Finset.univ_nonempty
lemma sum_weight (w : I → ℝ) (hw : ∀ i,0<w i) : ∑ i,weight w i=1 := by simp only [weight,←Finset.sum_div] exact div_self (total_pos w hw).ne'
theorem normalized_error (w : I → ℝ) (hw : ∀ i,0<w i) (ε : ℝ) (he : ∀ i j, |w i-w j| ≤ ε*w j) (i : I) : |weight w i-uniform i| ≤ ε/(Fintype.card I : ℝ) := by have hc : (0:ℝ)<Fintype.card I := by exact_mod_cast Fintype.card_pos have hW := total_pos w hw have hn : |∑ j,(w i-w j)| ≤ ε*∑ j,w j := by calc _ ≤ ∑ j,|w i-w j| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ j,ε*w j := Finset.sum_le_sum (fun j _=>he i j) _ = _ := by rw [Finset.mul_sum] have heq : weight w i-uniform i = (∑ j,(w i-w j))/((Fintype.card I : ℝ)*(∑ j,w j)) := by simp only [weight,uniform,Finset.sum_sub_distrib,Finset.sum_const,Finset.card_univ,nsmul_eq_mul] field_simp rw [heq,abs_div,abs_of_pos (mul_pos hc hW)] calc _ ≤ (ε*∑ j,w j)/((Fintype.card I : ℝ)*(∑ j,w j)) := div_le_div_of_nonneg_right hn (mul_pos hc hW).le _ = _ := by field_simp
theorem l1_error (w : I → ℝ) (hw : ∀ i,0<w i) (ε : ℝ) (he : ∀ i j, |w i-w j| ≤ ε*w j) : (∑ i,|weight w i-uniform i|) ≤ ε := by have hc : (Fintype.card I : ℝ)≠0 := by exact_mod_cast Fintype.card_ne_zero calc _ ≤ ∑ i,ε/(Fintype.card I : ℝ) := Finset.sum_le_sum (fun i _=>normalized_error w hw ε he i) _ = ε := by simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul]; field_simp
theorem test_error (w : I → ℝ) (hw : ∀ i,0<w i) (ε B : ℝ) (hB : 0 ≤ B) (he : ∀ i j, |w i-w j| ≤ ε*w j) (f : I → ℝ) (hf : ∀ i,|f i|≤B) : |(∑ i,weight w i*f i)-(∑ i,uniform i*f i)| ≤ B*ε := by rw [←Finset.sum_sub_distrib] calc _ = |∑ i,(weight w i-uniform i)*f i| := by congr 1; apply Finset.sum_congr rfl; intro i _; ring _ ≤ ∑ i,|(weight w i-uniform i)*f i| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ i,B*|weight w i-uniform i| := Finset.sum_le_sum (by intro i _; rw [abs_mul,mul_comm B]; exact mul_le_mul_of_nonneg_left (hf i) (abs_nonneg _)) _ = B*∑ i,|weight w i-uniform i| := (Finset.mul_sum _ _ _).symm _ ≤ B*ε := mul_le_mul_of_nonneg_left (l1_error w hw ε he) hB
lemma reciprocal_oscillation {X R x y : ℝ} (hX : 0<X) (hR : 0≤R) (hx : X≤x) (hx' : x≤X+R) (hy : X≤y) (hy' : y≤X+R) : |x⁻¹-y⁻¹| ≤ (R/X)*y⁻¹ := by have hx0 : 0<x := hX.trans_le hx have hy0 : 0<y := hX.trans_le hy have heq : x⁻¹-y⁻¹=(y-x)/(x*y) := by field_simp have hdiff : |y-x|≤R := (abs_le.mpr ⟨by linarith,by linarith⟩) rw [heq,abs_div,abs_of_pos (mul_pos hx0 hy0)] calc _ ≤ R/(x*y) := div_le_div_of_nonneg_right hdiff (mul_pos hx0 hy0).le _ ≤ R/(X*y) := div_le_div_of_nonneg_left hR (mul_pos hX hy0) (mul_le_mul_of_nonneg_right hx hy0.le) _ = _ := by ring
theorem harmonic_test_error (p : I → ℝ) (X R : ℝ) (hX : 0<X) (hR : 0≤R) (hp : ∀ i,X≤p i ∧ p i≤X+R) (f : I → ℝ) (hf : ∀ i,|f i|≤1) : |(∑ i,weight (fun j=>(p j)⁻¹) i*f i)-(∑ i,uniform i*f i)| ≤ R/X := by simpa only [one_mul] using test_error (fun j=>(p j)⁻¹) (fun j=>inv_pos.mpr (hX.trans_le (hp j).1)) (R/X) 1 zero_le_one (fun i j=>reciprocal_oscillation hX hR (hp i).1 (hp i).2 (hp j).1 (hp j).2) f hf
end MicrocellHarmonic
endend RawSuccessInlineScope0end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.MicrocellFibers01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsection RawSuccessInlineScope14
noncomputable sectionopen MeasureTheory Filter Topologyopen scoped BigOperatorsnamespace RawSmallCellsattribute [local instance] Classical.propDecidableopen Finset RawHarmonicProbability MicrocellConditional DyadicHarmonicBoundary
lemma finite_event (X W:ℕ) (hW:0<W) (hX:4*W≤X) (E:Finset ℕ) (hE:E⊆RawHarmonicProbability.units X W) : (law X W hW hX:Measure ℕ).real (E:Set ℕ)= (∑ p∈E,(p:ℝ)⁻¹)/mass X (X^2) W := by rw [law_apply_units] congr 1 have hh:=subset_event_sum X W E hE Set.univ simpa [eventMass] using hh
theorem cover_cost {J:Type*} [DecidableEq J] (X W R:ℕ) (hW:0<W) (hX:4*W≤X) (T:Finset J) (a:J→ℕ) (E:Finset ℕ) (hE:E⊆RawHarmonicProbability.units X W) (hcover:∀ p∈E,∃ j∈T,p∈UnitIntervalCounts.units (a j) R W) : (law X W hW hX:Measure ℕ).real (E:Set ℕ) ≤ 4*T.card*((R:ℝ)+2*W)/X := by have hxN:0<X:=by omega have hx:(0:ℝ)<X:=by exact_mod_cast hxN have hw:(0:ℝ)<W:=by exact_mod_cast hW have ht:(0:ℝ)<W.totient:=by exact_mod_cast Nat.totient_pos.mpr hW have hxx:X+X≤X^2:=by have : 2≤X:=by omega nlinarith have hm:(W.totient:ℝ)/(4*W)≤ mass X (X^2) W:= (dyadic_lower X W hW hX).trans (mass_mono hxx) have hc:=UnitNeighborhoodCost.cover_count T a R W hW E (fun p hp=>mem_biUnion.mpr (hcover p hp)) rw [finite_event X W hW hX E hE] calc _ ≤ ((E.card:ℝ)/X)/(mass X (X^2) W) := by apply div_le_div_of_nonneg_right ?_ (mass_nonneg _ _ _) calc _ ≤ ∑ _p∈E,(X:ℝ)⁻¹ := sum_le_sum (by intro p hp apply inv_anti₀ hx exact_mod_cast (mem_Ico.mp (mem_filter.mp (hE hp)).1).1) _ = _:=by simp;ring _ ≤ ((T.card:ℝ)*W.totient*((R:ℝ)/W+2)/X)/((W.totient:ℝ)/(4*W)) := by apply div_le_div₀ (by positivity) (div_le_div_of_nonneg_right hc hx.le) (by positivity) hm _ = _:=by field_simp
def partialCells (X W R:ℕ) : Finset ℕ := (RawHarmonicProbability.units X W).filter (fun p=>¬(X≤R*(p/R) ∧ R*(p/R+1)≤X^2))
lemma partial_cover (X W R p:ℕ) (hR:0<R) (hp:p∈partialCells X W R) : p∈UnitIntervalCounts.units X R W ∨ p∈UnitIntervalCounts.units (X^2-R) R W := by obtain ⟨hpU,hbad⟩:=mem_filter.mp hp obtain ⟨hpI,hcop⟩:=mem_filter.mp hpU obtain ⟨hlo,hhi⟩:=mem_Ico.mp hpI have hdiv:=Nat.div_add_mod p R have hmod:=Nat.mod_lt p hR by_cases hb:X≤R*(p/R) · right have hend:X^2<R*(p/R+1):=by omega apply mem_filter.mpr refine ⟨mem_Ico.mpr ⟨?_,?_⟩,hcop⟩ · have hmul:R*(p/R+1)=R*(p/R)+R:=by ring omega · omega · left apply mem_filter.mpr refine ⟨mem_Ico.mpr ⟨hlo,?_⟩,hcop⟩ omega
theorem partial_cost (X W R:ℕ) (hW:0<W) (hX:4*W≤X) (hR:0<R) : (law X W hW hX:Measure ℕ).real (partialCells X W R:Set ℕ) ≤ 8*((R:ℝ)+2*W)/X := by have hh:=cover_cost X W R hW hX (univ:Finset (Fin 2)) (fun i=>if i=0 then X else X^2-R) (partialCells X W R) (filter_subset _ _) (by intro p hp rcases partial_cover X W R p hR hp with h|h · exact ⟨0,mem_univ _,by simpa using h⟩ · exact ⟨1,mem_univ _,by simpa using h⟩) norm_num at hh ⊢ exact hh
lemma partial_cost_simple (X W R:ℕ) (hW:0<W) (hX:4*W≤X) (hWR:W≤R) : (law X W hW hX:Measure ℕ).real (partialCells X W R:Set ℕ) ≤24*(R:ℝ)/X := by apply (partial_cost X W R hW hX (hW.trans_le hWR)).trans apply div_le_div_of_nonneg_right _ (by positivity) have hh:(W:ℝ)≤R:=by exact_mod_cast hWR linarith
theorem eventually_partial {X W R:ℕ→ℕ} (hbase:∀ᶠ n in atTop,0<W n ∧ 4*W n≤X n ∧ W n≤R n) (hr:Tendsto (fun n=>(R n:ℝ)/X n) atTop (𝓝 0)) : ∃ ε:ℕ→ℝ,Tendsto ε atTop (𝓝 0) ∧ ∀ᶠ n in atTop, ∀ (hw:0<W n) (hx:4*W n≤X n), (law (X n) (W n) hw hx:Measure ℕ).real (partialCells (X n) (W n) (R n):Set ℕ)≤ε n := by refine ⟨fun n=>24*((R n:ℝ)/X n),by simpa using hr.const_mul 24,?_⟩ filter_upwards [hbase] with n hn hw hx simpa [mul_div_assoc] using partial_cost_simple (X n) (W n) (R n) hw hx hn.2.2
end RawSmallCellsendend RawSuccessInlineScope14
section RawSuccessInlineScope15noncomputable sectionopen scoped BigOperatorsopen Finset MeasureTheorynamespace RawPartitionSuccessattribute [local instance] Classical.propDecidable
theorem finite_partition {α ι : Type*} [DecidableEq α] [DecidableEq ι] (S : Finset α) (w : α → ℝ) (hw : ∀ x∈S,0≤w x) (π : α → ι) (G : Set ι) (A : Set α) (a ε : ℝ) (ha : 0≤a) (hZ : 0 < ∑ x∈S,w x) (hbad : (∑ x∈S.filter (fun x => π x∉G),w x) ≤ ε*(∑ x∈S,w x)) (hs : ∀ i∈S.image π,i∈G → a*(∑ x∈S.filter (fun x => π x=i),w x) ≤ ∑ x∈S.filter (fun x => π x=i),if x∈A then w x else 0) : a*(1-ε) ≤ (∑ x∈S,if x∈A then w x else 0)/(∑ x∈S,w x) := by classical let T := (S.image π).filter (·∈G) have hb : (∑ x∈S.filter (fun x => π x∈G),w x) + (∑ x∈S.filter (fun x => π x∉G),w x) = ∑ x∈S,w x := by exact sum_filter_add_sum_filter_not S (fun x => π x∈G) w have hf : S.filter (fun x => π x∈T)=S.filter (fun x => π x∈G) := by ext x simp only [mem_filter,T] constructor · rintro ⟨hx,hxT⟩;exact ⟨hx,hxT.2⟩ · rintro ⟨hx,hxG⟩;exact ⟨hx,mem_image_of_mem π hx,hxG⟩ have hsum : a*(∑ x∈S.filter (fun x => π x∈G),w x) ≤ ∑ x∈S,if x∈A then w x else 0 := by calc _ = ∑ i∈T,a*(∑ x∈S.filter (fun x => π x=i),w x) := by rw [←mul_sum,sum_fiberwise_eq_sum_filter,hf] _ ≤ ∑ i∈T,∑ x∈S.filter (fun x => π x=i),if x∈A then w x else 0 := sum_le_sum (fun i hi => hs i (mem_filter.mp hi).1 (mem_filter.mp hi).2) _ = ∑ x∈S.filter (fun x => π x∈G),if x∈A then w x else 0 := by rw [sum_fiberwise_eq_sum_filter,hf] _ ≤ ∑ x∈S,if x∈A then w x else 0 := by apply sum_le_sum_of_subset_of_nonneg (filter_subset _ _) intro x hx hnot split_ifs <;> simp_all apply (le_div_iff₀ hZ).mpr have hlo : (1-ε)*(∑ x∈S,w x) ≤ ∑ x∈S.filter (fun x => π x∈G),w x := by linarith have hh := mul_le_mul_of_nonneg_left hlo ha nlinarith
open RawHarmonicProbability MicrocellConditional
theorem raw_partition {ι : Type*} [DecidableEq ι] (X W : ℕ) (hW : 0<W) (hX : 4*W≤X) (π : ℕ→ι) (G : Set ι) (A : Set ℕ) (a ε : ℝ) (ha : 0≤a) (hbad : (law X W hW hX : Measure ℕ).real {p | π p∉G} ≤ ε) (hs : ∀ i∈(units X W).image π,i∈G → a ≤ (law X W hW hX : Measure ℕ).real (A∩((units X W).filter (fun p => π p=i):Set ℕ)) / (law X W hW hX : Measure ℕ).real ((units X W).filter (fun p => π p=i):Set ℕ)) : a*(1-ε) ≤ (law X W hW hX : Measure ℕ).real A := by have hZ := mass_pos X W hW hX rw [mass_units] at hZ rw [law_apply_units] at hbad ⊢ rw [mass_units] at hbad ⊢ apply finite_partition (units X W) (fun p => (p:ℝ)⁻¹) (fun p hp => by positivity) π G A a ε ha hZ · have hh := (div_le_iff₀ hZ).mp hbad have he : eventMass (units X W) {p | π p∉G} = ∑ p∈(units X W).filter (fun p=>π p∉G),(p:ℝ)⁻¹ := by unfold eventMass rw [sum_filter] apply sum_congr rfl intro p hp split_ifs <;> simp_all rw [he] at hh exact hh · intro i hi hG have hcond := hs i hi hG rw [conditional_ratio X W hW hX _ (filter_subset _ _) A] at hcond have hCi : ((units X W).filter (fun p => π p=i)).Nonempty := by obtain ⟨p,hp,rfl⟩ := mem_image.mp hi exact ⟨p,mem_filter.mpr ⟨hp,rfl⟩⟩ have hCpos : 0 < ∑ p∈(units X W).filter (fun p => π p=i),(p:ℝ)⁻¹ := by apply sum_pos _ hCi intro p hp apply inv_pos.mpr exact units_pos (by omega) ⟨p,(mem_filter.mp hp).1⟩ exact (le_div_iff₀ hCpos).mp hcond
end RawPartitionSuccessendend RawSuccessInlineScope15
section RawSuccessInlineScope16noncomputable sectionopen scoped BigOperatorsopen Finset MeasureTheorynamespace MicrocellSaturationopen RawHarmonicProbability RawSmallCells RawPartitionSuccess MicrocellFibersattribute [local instance] Classical.propDecidable
def good {J : Type*} (X R H : ℕ) (t : J→ℕ) (i : ℕ×ℕ) : Prop := X≤R*i.1 ∧ R*(i.1+1)≤X^2 ∧ ∀ j,t j*(R*i.1-R)/H=t j*(R*(i.1+1)+R)/H
def label (R M p : ℕ) : ℕ×ℕ := (p/R,p%M)
lemma quotient_window (R p : ℕ) (hR : 0<R) : R*(p/R)≤p ∧ p<R*(p/R+1) := by constructor · exact Nat.mul_div_le p R · exact Nat.lt_mul_div_succ p hR
lemma saturated {J : Type*} (X W R H M : ℕ) (t : J→ℕ) (hR : 0<R) (p : ℕ) (hp : p∈units X W) (hpartial : p∉partialCells X W R) (hstable : ∀ j,t j*(p-2*R)/H=t j*(p+2*R)/H) : good X R H t (label R M p) := by have hc : X≤R*(p/R) ∧ R*(p/R+1)≤X^2 := by simpa only [partialCells,mem_filter,hp,true_and,not_not] using hpartial refine ⟨hc.1,hc.2,?_⟩ intro j have hw := quotient_window R p hR have hmul : R*(p/R+1) = R*(p/R)+R := by ring have hl : p-2*R≤R*(p/R)-R := by omega have hh : R*(p/R+1)+R≤p+2*R := by omega have hmid : R*(p/R)-R≤R*(p/R+1)+R := by omega have hl' := Nat.div_le_div_right (c:=H) (Nat.mul_le_mul_left (t j) hl) have hh' := Nat.div_le_div_right (c:=H) (Nat.mul_le_mul_left (t j) hh) have hm' := Nat.div_le_div_right (c:=H) (Nat.mul_le_mul_left (t j) hmid) have he := hstable j change t j*(R*(p/R)-R)/H=t j*(R*(p/R+1)+R)/H omega
lemma enlarged_cell_stable {J : Type*} {X R H : ℕ} {t : J→ℕ} {i : ℕ×ℕ} (hg : good X R H t i) (j : J) (z : ℕ) (hz : t j*(R*i.1-R)≤z ∧ z≤t j*(R*(i.1+1)+R)) : z/H=t j*(R*i.1)/H := by have he := hg.2.2 j have hlo := Nat.div_le_div_right (c:=H) hz.1 have hhi := Nat.div_le_div_right (c:=H) hz.2 have hl := Nat.div_le_div_right (c:=H) (Nat.mul_le_mul_left (t j) (Nat.sub_le (R*i.1) R)) have hu := Nat.div_le_div_right (c:=H) (Nat.mul_le_mul_left (t j) (show R*i.1≤R*(i.1+1)+R by nlinarith)) omega
lemma law_restrict_units (X W : ℕ) (hW : 0<W) (hX : 4*W≤X) (A : Set ℕ) : (law X W hW hX : Measure ℕ).real (A∩(units X W:Set ℕ)) = (law X W hW hX : Measure ℕ).real A := by rw [MicrocellConditional.law_apply_units,MicrocellConditional.law_apply_units] congr 1 unfold MicrocellConditional.eventMass apply sum_congr rfl intro p hp simp [hp]
theorem bad_conditioning_bound {J : Type*} [Fintype J] (X W R H M : ℕ) (hW : 0<W) (hX : 4*W≤X) (hR : 0<R) (t : J→ℕ) (ε : ℝ) (hb : ∀ j,DyadicHarmonicBoundary.badMass X (X^2) W (t j) H (2*R) / DyadicHarmonicBoundary.mass X (X^2) W≤ε) : (law X W hW hX : Measure ℕ).real {p | ¬good X R H t (label R M p)} ≤ 8*((R:ℝ)+2*W)/X + Fintype.card J*ε := by rw [←law_restrict_units X W hW hX] have hsub : {p | ¬good X R H t (label R M p)}∩(units X W:Set ℕ) ⊆ (partialCells X W R:Set ℕ) ∪ ⋃ j,{p | t j*(p-2*R)/H≠t j*(p+2*R)/H} := by intro p hp by_cases hc : p∈partialCells X W R · exact Or.inl hc · right by_contra hnot have hst : ∀ j,t j*(p-2*R)/H=t j*(p+2*R)/H := by simpa using hnot exact hp.1 (saturated X W R H M t hR p hp.2 hc hst) calc _ ≤ (law X W hW hX : Measure ℕ).real ((partialCells X W R:Set ℕ) ∪ ⋃ j,{p | t j*(p-2*R)/H≠t j*(p+2*R)/H}) := measureReal_mono hsub _ ≤ (law X W hW hX : Measure ℕ).real (partialCells X W R:Set ℕ) + (law X W hW hX : Measure ℕ).real (⋃ j,{p | t j*(p-2*R)/H≠t j*(p+2*R)/H}) := measureReal_union_le _ _ _ ≤ _ := add_le_add (partial_cost X W R hW hX hR) (finite_boundary_bound X W H (2*R) hW hX t ε hb)
lemma conditioned_fiber (X W M N q r : ℕ) (hM : 0<M) (hN : 0<N) (_ : r<M) (hWR : W.Coprime r) (hWM : W∣M) (hlo : X≤(M*N)*q) (hhi : (M*N)*(q+1)≤X^2) : (units X W).filter (fun p => label (M*N) M p=(q,r)) = fiber M N (N*q) r := by have hlo' : X≤M*(N*q) := by simpa only [mul_assoc] using hlo have hhi' : M*(N*q+N)≤X^2 := by nlinarith have hR : 0<M*N := Nat.mul_pos hM hN ext p constructor · intro hp obtain ⟨hp,hlabel⟩ := mem_filter.mp hp have hq : p/(M*N)=q := congrArg Prod.fst hlabel have hr' : p%M=r := congrArg Prod.snd hlabel have hw := quotient_window (M*N) p hR rw [hq] at hw apply mem_filter.mpr refine ⟨mem_Ico.mpr ⟨?_,?_⟩,hr'⟩ <;> nlinarith · intro hp have hpU := fiber_subset_units X W M N (N*q) r hWM hWR hlo' hhi' hp obtain ⟨hpI,hpr⟩ := mem_filter.mp hp obtain ⟨hpl,hph⟩ := mem_Ico.mp hpI apply mem_filter.mpr refine ⟨hpU,Prod.ext ?_ hpr⟩ exact Nat.div_eq_of_lt_le (by nlinarith) (by nlinarith)
lemma label_unit (X W M R : ℕ) (hM : 0<M) (hWM : W∣M) (i : ℕ×ℕ) (hi : i∈(units X W).image (label R M)) : i.2<M ∧ W.Coprime i.2 := by obtain ⟨p,hp,rfl⟩ := mem_image.mp hi have hcop := (mem_filter.mp hp).2 refine ⟨Nat.mod_lt p hM,?_⟩ apply (UnitIntervalCounts.coprime_mod W (p%M)).mp rw [Nat.mod_mod_of_dvd p hWM] exact (UnitIntervalCounts.coprime_mod W p).mpr hcop
theorem global_success {J : Type*} [Fintype J] (X W M N H : ℕ) (hW : 0<W) (hX : 4*W≤X) (hM : 0<M) (hN : 0<N) (hWM : W∣M) (t : J→ℕ) (c ε : ℝ) (hc : 0≤c) (A : Set ℕ) (herr : ((M*N:ℕ):ℝ)/X≤c/6) (hb : ∀ j,DyadicHarmonicBoundary.badMass X (X^2) W (t j) H (2*(M*N)) / DyadicHarmonicBoundary.mass X (X^2) W≤ε) (hs : ∀ i∈(units X W).image (label (M*N) M),good X (M*N) H t i → letI : Nonempty (Fin N) := Fin.pos_iff_nonempty.mp hN c/2<(MicrocellProbability.uniformLaw (fun b:Fin N => point M (N*i.1) i.2 b):Measure ℕ).real A) : (c/3)*(1-(8*((M*N:ℕ):ℝ)+16*W)/X-Fintype.card J*ε) ≤ (law X W hW hX : Measure ℕ).real A := by have hbad := bad_conditioning_bound X W (M*N) H M hW hX (Nat.mul_pos hM hN) t ε hb have hp := raw_partition X W hW hX (label (M*N) M) {i | good X (M*N) H t i} A (c/3) (8*(((M*N:ℕ):ℝ)+2*W)/X+Fintype.card J*ε) (by positivity) hbad have hcond : ∀ i∈(units X W).image (label (M*N) M),good X (M*N) H t i → c/3 ≤ (law X W hW hX : Measure ℕ).real (A∩((units X W).filter (fun p => label (M*N) M p=i):Set ℕ)) / (law X W hW hX : Measure ℕ).real ((units X W).filter (fun p => label (M*N) M p=i):Set ℕ) := by intro i hi hg obtain ⟨hr,hWr⟩ := label_unit X W M (M*N) hM hWM i hi rw [show i=(i.1,i.2) from rfl, conditioned_fiber X W M N i.1 i.2 hM hN hr hWr hWM hg.1 hg.2.1] apply le_of_lt apply raw_fiber_success X W M N (N*i.1) i.2 hW hX hM hN hr hWr hWM (by simpa only [mul_assoc] using hg.1) (by nlinarith [hg.2.1]) c A herr exact hs i hi hg have hh := hp hcond convert hh using 1 ring
end MicrocellSaturation
endend RawSuccessInlineScope16end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.MicrocellHarmonic01import OAI.Combinatorics.SumProduct.Alignment.PointLaw02import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsection RawSuccessInlineScope1open scoped Topology BigOperatorsopen Filter MeasureTheory Setopen scoped Topology BigOperatorsopen Filter MeasureTheory Setopen scoped Topology BigOperators BoundedContinuousFunction ENNRealopen MeasureTheory Set Filternamespace SourcePointLawnoncomputable sectionopen scoped Topology BigOperators BoundedContinuousFunction ENNRealopen MeasureTheory Set Filter
variable {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] [TopologicalSpace Y] [OpensMeasurableSpace Y]variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [SecondCountableTopology E] [MeasurableSpace E] [BorelSpace E]
theorem beta_integrand_continuous (μ : ProbabilityMeasure X) (T : ℝ × X → Y) (hT : Measurable T) (hc : ∀ x, Continuous (fun β => T (β, x))) (F : Y →ᵇ E) : Continuous (fun β => ∫ x, F (T (β, x)) ∂(μ : Measure X)) := by apply continuous_of_dominated (bound := fun _ => ‖F‖) · intro β exact (F.continuous.measurable.comp (hT.comp (measurable_const.prodMk measurable_id))).aestronglyMeasurable · intro β exact Eventually.of_forall (fun x => F.norm_coe_le_norm _) · exact integrable_const _ · exact Eventually.of_forall (fun x => F.continuous.comp (hc x))
def empiricalLaw (p : ℕ → Y) (N : ℕ) : ProbabilityMeasure Y := if h : 0 < N then letI : NeZero N := ⟨h.ne'⟩ uniformMixture (fun i : Fin N => (⟨Measure.dirac (p i.val), inferInstance⟩ : ProbabilityMeasure Y)) else ⟨Measure.dirac (p 0), inferInstance⟩
lemma integral_empiricalLaw [CompleteSpace E] (p : ℕ → Y) (N : ℕ) (hN : 0 < N) (F : Y →ᵇ E) : ∫ y, F y ∂(empiricalLaw p N : Measure Y) = (N : ℝ)⁻¹ • ∑ n ∈ Finset.range N, F (p n) := by let : NeZero N := ⟨hN.ne'⟩ have he : empiricalLaw p N = uniformMixture (fun i : Fin N => (⟨Measure.dirac (p i.val), inferInstance⟩ : ProbabilityMeasure Y)) := by exact dite_eq_left hN rw [he] trans (Fintype.card (Fin N) : ℝ)⁻¹ • ∑ i : Fin N, ∫ y, F y ∂(Measure.dirac (p i.val)) · exact integral_uniformMixture (fun i : Fin N => (⟨Measure.dirac (p i.val), inferInstance⟩ : ProbabilityMeasure Y)) F simp only [Fintype.card_fin, integral_dirac' F _ F.continuous.measurable.stronglyMeasurable, Finset.sum_range]
endend SourcePointLaw
namespace SourcePointLawnoncomputable sectionopen scoped Topology BigOperators BoundedContinuousFunction ENNReal NNRealopen MeasureTheory Set Filter
theorem empirical_tendsto_betaMixture {Y : Type*} [PseudoMetricSpace Y] [MeasurableSpace Y] [OpensMeasurableSpace Y] (P : ℕ → ℤ → Y) (d : ℕ) [NeZero d] (X : Fin d → Type*) [∀ r, MeasurableSpace (X r)] (μ : ∀ r, ProbabilityMeasure (X r)) (T : ∀ r, ℝ × X r → Y) (hT : ∀ r, Measurable (T r)) (hc : ∀ r x, Continuous (fun β => T r (β, x))) (hloc : ∀ r (F : Y →ᵇ ℝ) (L : ℝ≥0), LipschitzWith L F → ∀ x ∈ Icc (0 : ℝ) 1, ∀ ε > 0, ∀ᶠ α : ℝ in 𝓝[>] 0, ∀ᶠ N : ℕ in atTop, ∀ a b : ℝ, 0 ≤ a → a ≤ x → x ≤ b → b ≤ 1 → b - a = α → ‖(𝔼 n ∈ residueInterval d r.val (a * N) (b * N), F (P N n)) - ∫ y, F (T r (x, y)) ∂(μ r : Measure (X r))‖ < ε) : Tendsto (fun N : ℕ => empiricalLaw (fun n => P N n) N) atTop (𝓝 (uniformMixture (fun r => betaImage (μ r) (T r) (hT r)))) := by apply MeasureTheory.tendsto_iff_forall_lipschitz_integral_tendsto.mpr intro f hb hl obtain ⟨L, hL⟩ := hl let F : Y →ᵇ ℝ := ⟨⟨f, hL.continuous⟩, hb⟩ change Tendsto (fun N : ℕ => ∫ y, F y ∂(empiricalLaw (fun n => P N n) N : Measure Y)) atTop (𝓝 (∫ y, F y ∂(uniformMixture (fun r => betaImage (μ r) (T r) (hT r)) : Measure Y))) rw [integral_uniformMixture] simp only [Fintype.card_fin, integral_betaImage] have hlim := global_point_law_fin (fun N n => F (P N n)) d (Nat.pos_of_ne_zero (NeZero.ne d)) (fun r β => ∫ y, F (T r (β, y)) ∂(μ r : Measure (X r))) (fun r => (beta_integrand_continuous (μ r) (T r) (hT r) (hc r) F).continuousOn) (fun r => hloc r F L hL) apply hlim.congr' filter_upwards [Filter.eventually_ge_atTop (1 : ℕ)] with N hN exact (integral_empiricalLaw (fun n => P N n) N (by omega) F).symm
endend SourcePointLaw
end RawSuccessInlineScope1
section RawSuccessInlineScope2
noncomputable sectionopen MeasureTheory Filter Topologyopen scoped BigOperators ENNRealnamespace MicrocellProbabilityvariable {I Y : Type*} [Fintype I] [Nonempty I] [MeasurableSpace Y]open MicrocellHarmonicattribute [local instance] Classical.propDecidable
lemma weight_pos (w:I→ℝ) (hw:∀ i,0<w i) (i:I) : 0<weight w i := div_pos (hw i) (total_pos w hw)
def weightedLaw (w:I→ℝ) (hw:∀ i,0<w i) (p:I→Y) : ProbabilityMeasure Y := ⟨∑ i,ENNReal.ofReal (weight w i) • Measure.dirac (p i), by constructor simp only [Measure.finsetSum_apply,Measure.smul_apply,measure_univ,smul_eq_mul,mul_one] rw [←ENNReal.ofReal_sum_of_nonneg (fun i _=>(weight_pos w hw i).le),sum_weight w hw] norm_num⟩
def uniformLaw (p:I→Y) : ProbabilityMeasure Y := SourcePointLaw.uniformMixture (fun i=>⟨Measure.dirac (p i),inferInstance⟩)
lemma weightedLaw_apply (w:I→ℝ) (hw:∀ i,0<w i) (p:I→Y) (S:Set Y) (hS:MeasurableSet S) : (weightedLaw w hw p:Measure Y).real S = ∑ i,weight w i*(if p i∈S then 1 else 0) := by classical change ( (∑ i,ENNReal.ofReal (weight w i) • Measure.dirac (p i):Measure Y) S).toReal=_ simp only [Measure.finsetSum_apply,Measure.smul_apply,smul_eq_mul,Measure.dirac_apply' _ hS] rw [ENNReal.toReal_sum] · apply Finset.sum_congr rfl intro i _ by_cases hi:p i∈S <;> simp [Set.indicator,hi,ENNReal.toReal_ofReal (weight_pos w hw i).le] · intro i _ by_cases hi:p i∈S <;> simp [Set.indicator,hi]
lemma uniformLaw_apply (p:I→Y) (S:Set Y) (hS:MeasurableSet S) : (uniformLaw p:Measure Y).real S = ∑ i,uniform i*(if p i∈S then 1 else 0) := by classical change (((Fintype.card I : ℝ≥0∞)⁻¹ • (∑ i,Measure.dirac (p i)) : Measure Y) S).toReal = _ simp only [Measure.smul_apply,Measure.finsetSum_apply,smul_eq_mul, ENNReal.toReal_mul,ENNReal.toReal_inv,ENNReal.toReal_natCast,Measure.dirac_apply' _ hS] rw [ENNReal.toReal_sum] · rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i _ by_cases hi:p i∈S <;> simp [uniform,Set.indicator,hi] · intro i _ by_cases hi:p i∈S <;> simp [Set.indicator,hi]
theorem harmonic_event_error (x:I→ℝ) (X R:ℝ) (hX:0<X) (hR:0≤R) (hx:∀ i,X≤x i ∧ x i≤X+R) (p:I→Y) (S:Set Y) (hS:MeasurableSet S) : |(weightedLaw (fun i=>(x i)⁻¹) (fun i=>inv_pos.mpr (hX.trans_le (hx i).1)) p:Measure Y).real S - (uniformLaw p:Measure Y).real S| ≤ R/X := by rw [weightedLaw_apply _ _ _ _ hS,uniformLaw_apply _ _ hS] apply harmonic_test_error x X R hX hR hx intro i split_ifs <;> norm_num
theorem harmonic_success (x:I→ℝ) (X R c:ℝ) (hX:0<X) (hR:0≤R) (hx:∀ i,X≤x i ∧ x i≤X+R) (p:I→Y) (S:Set Y) (hS:MeasurableSet S) (hcell:R/X≤c/6) (hm:c/2<(uniformLaw p:Measure Y).real S) : c/3<(weightedLaw (fun i=>(x i)⁻¹) (fun i=>inv_pos.mpr (hX.trans_le (hx i).1)) p:Measure Y).real S := by have he:=harmonic_event_error x X R hX hR hx p S hS have he':= (abs_le.mp he).1 linarith
lemma empiricalLaw_eq (p:ℕ→Y) (N:ℕ) (hN:0<N) : SourcePointLaw.empiricalLaw p N = @uniformLaw (Fin N) Y inferInstance (Fin.pos_iff_nonempty.mp hN) inferInstance (fun i=>p i) := by exact dite_eq_left hN
end MicrocellProbabilityendend RawSuccessInlineScope2
section RawSuccessInlineScope3noncomputable sectionopen Filter Topologynamespace MicrocellScale
def radius (M H:ℕ) : ℕ := M*⌊Real.sqrt (H:ℝ)/(M:ℝ)⌋₊def length (M H:ℕ) : ℕ := radius M H/M
lemma modulus_dvd (M H:ℕ) : M∣radius M H := dvd_mul_right _ _lemma length_eq (M H:ℕ) (hM:0<M) : length M H=⌊Real.sqrt (H:ℝ)/(M:ℝ)⌋₊ := Nat.mul_div_cancel_left _ hM
lemma radius_le (M H:ℕ) (hM:0<M) : (radius M H:ℝ) ≤ Real.sqrt (H:ℝ) := by have hm:(0:ℝ)<M:=by exact_mod_cast hM have hh:=Nat.floor_le (show 0≤Real.sqrt (H:ℝ)/(M:ℝ) by positivity) have hh':=mul_le_mul_of_nonneg_left hh hm.le simpa [radius,mul_div_cancel₀ _ hm.ne'] using hh'
lemma radius_gt (M H:ℕ) (hM:0<M) : Real.sqrt (H:ℝ)-(M:ℝ)<(radius M H:ℝ) := by have hm:(0:ℝ)<M:=by exact_mod_cast hM have hh:=Nat.lt_floor_add_one (Real.sqrt (H:ℝ)/(M:ℝ)) have hh':=mul_lt_mul_of_pos_left hh hm have he:(M:ℝ)*(Real.sqrt (H:ℝ)/(M:ℝ))=Real.sqrt (H:ℝ):=mul_div_cancel₀ _ hm.ne' rw [he] at hh' simp only [radius,Nat.cast_mul] nlinarith
lemma radius_half_sqrt (M H:ℕ) (hM:0<M) (hH:4*(M:ℝ)^2≤H) : Real.sqrt (H:ℝ)/2 ≤ (radius M H:ℝ) := by have hs:(2:ℝ)*M≤Real.sqrt (H:ℝ):=(Real.le_sqrt (by positivity) (by positivity)).mpr (by nlinarith) have hh:=radius_gt M H hM linarith
lemma sqrt_ratio (H S C:ℝ) (hH:0≤H) (hS:0<S) : Real.sqrt (H/S^(2*C))=Real.sqrt H/S^C := by rw [Real.sqrt_div hH] congr 1 have he:S^(2*C)=(S^C)^2 := by rw [two_mul,Real.rpow_add hS]; ring rw [he,Real.sqrt_sq (Real.rpow_nonneg hS.le C)]
def Dominates (A S:ℕ→ℝ) : Prop := ∀ C:ℝ,0<C → Tendsto (fun n=>A n/(S n)^C) atTop atTop
lemma sqrt_dominates {H:ℕ→ℕ} {S:ℕ→ℝ} (hS:∀ᶠ n in atTop,1≤S n) (hd: Dominates (fun n=>(H n:ℝ)) S) (C:ℝ) (hC:0<C) : Tendsto (fun n=>Real.sqrt (H n:ℝ)/(S n)^C) atTop atTop := by have hh:=Real.tendsto_sqrt_atTop.comp (hd (2*C) (by positivity)) apply hh.congr' filter_upwards [hS] with n hn exact sqrt_ratio (H n) (S n) C (by positivity) (by linarith)
theorem radius_dominates {M H:ℕ→ℕ} {S:ℕ→ℝ} (hM:∀ᶠ n in atTop,0<M n ∧ (M n:ℝ)≤S n) (hS:∀ᶠ n in atTop,1≤S n) (hd:Dominates (fun n=>(H n:ℝ)) S) : Dominates (fun n=>(radius (M n) (H n):ℝ)) S := by intro C hC have hsmall:∀ᶠ n in atTop,4*(M n:ℝ)^2≤H n := by filter_upwards [hM,hS,(hd 2 (by norm_num)).eventually_ge_atTop 4] with n hm hs hh have hs0:0<S n:=by linarith rw [Real.rpow_two] at hh have hh':4*(S n)^2≤H n := (le_div_iff₀ (sq_pos_of_pos hs0)).mp hh have hm0:(0:ℝ)≤M n:=by positivity nlinarith have hc:=sqrt_dominates hS hd C hC have hh:Tendsto (fun n=>(Real.sqrt (H n:ℝ)/(S n)^C)/2) atTop atTop := hc.atTop_div_const (by norm_num) apply tendsto_atTop_mono' atTop _ hh filter_upwards [hS,hM,hsmall] with n hs hm hn have hh:=radius_half_sqrt (M n) (H n) hm.1 hn have hp:0<(S n)^C:=Real.rpow_pos_of_pos (by linarith) C convert div_le_div_of_nonneg_right hh hp.le using 1 ring
theorem boundary_rate {M H t:ℕ→ℕ} {S:ℕ→ℝ} (hM:∀ᶠ n in atTop,0<M n) (hS:∀ᶠ n in atTop,1≤S n) (ht:∀ᶠ n in atTop,(t n:ℝ)≤(S n)^2) (hd:Dominates (fun n=>(H n:ℝ)) S) : Tendsto (fun n=>(t n:ℝ)*radius (M n) (H n)/H n) atTop (𝓝 0) := by have hh:Tendsto (fun n=>(S n)^2/Real.sqrt (H n:ℝ)) atTop (𝓝 0) := by simpa only [Function.comp_def,inv_div,Real.rpow_two] using tendsto_inv_atTop_zero.comp (sqrt_dominates hS hd 2 (by norm_num)) have hp:∀ᶠ n in atTop,0<(H n:ℝ) := by filter_upwards [hS,(hd 1 (by norm_num)).eventually_ge_atTop 1] with n hs hn rw [Real.rpow_one] at hn have hpos:0<S n:=by linarith have hpn:1*S n≤H n:=(le_div_iff₀ hpos).mp hn linarith apply squeeze_zero' (Filter.Eventually.of_forall (fun n=>by positivity)) ?_ hh filter_upwards [hM,ht,hp] with n hm ht hn have hs:0<Real.sqrt (H n:ℝ):=Real.sqrt_pos_of_pos hn calc _ ≤ (S n)^2*Real.sqrt (H n:ℝ)/H n := by apply div_le_div_of_nonneg_right _ hn.le exact mul_le_mul ht (radius_le _ _ hm) (by positivity) (sq_nonneg _) _ = _ := by have he:=Real.sq_sqrt hn.le field_simp nlinarith
theorem endpoint_rate {M H X:ℕ→ℕ} (hM:∀ᶠ n in atTop,0<M n) (hH:∀ᶠ n in atTop,0<H n) (hd:Tendsto (fun n=>Real.log (X n:ℝ)/(H n:ℝ)) atTop atTop) : Tendsto (fun n=>(radius (M n) (H n):ℝ)/X n) atTop (𝓝 0) := by have hh:Tendsto (fun n=>(X n:ℝ)/(H n:ℝ)) atTop atTop := by apply tendsto_atTop_mono' atTop _ hd exact Filter.Eventually.of_forall (fun n=>div_le_div_of_nonneg_right (Real.log_le_self (by positivity)) (by positivity)) have hz:Tendsto (fun n=>(H n:ℝ)/(X n:ℝ)) atTop (𝓝 0) := by simpa only [Function.comp_def,inv_div] using tendsto_inv_atTop_zero.comp hh apply squeeze_zero' (Filter.Eventually.of_forall (fun n=>by positivity)) ?_ hz filter_upwards [hM,hH] with n hm hn apply div_le_div_of_nonneg_right _ (by positivity) apply (radius_le _ _ hm).trans apply Real.sqrt_le_iff.mpr have hn':(1:ℝ)≤H n:=by exact_mod_cast hn constructor <;> nlinarith
end MicrocellScale
endend RawSuccessInlineScope3end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314import Mathlibimport OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnamespace NearLatticeopen scoped BigOperatorsnoncomputable section
theorem card_int_interval_le (a b : ℝ) (hab : a ≤ b) : ((Finset.Icc ⌈a⌉ ⌊b⌋).card : ℝ) ≤ b - a + 1 := by by_cases h : ⌈a⌉ ≤ ⌊b⌋ + 1 · have he : ((Finset.Icc ⌈a⌉ ⌊b⌋).card : ℝ) = (⌊b⌋ : ℝ) + 1 - (⌈a⌉ : ℝ) := by exact_mod_cast Int.card_Icc_of_le ⌈a⌉ ⌊b⌋ h rw [he] linarith [Int.floor_le b, Int.le_ceil a] · have he : Finset.Icc ⌈a⌉ ⌊b⌋ = ∅ := Finset.Icc_eq_empty (by omega) simp only [he, Finset.card_empty, Nat.cast_zero] linarith
theorem card_int_subset_interval_le (S : Finset ℤ) (a b : ℝ) (hab : a ≤ b) (hS : ∀ n ∈ S, a ≤ (n : ℝ) ∧ (n : ℝ) ≤ b) : (S.card : ℝ) ≤ b - a + 1 := by have hs : S ⊆ Finset.Icc ⌈a⌉ ⌊b⌋ := by intro n hn exact Finset.mem_Icc.mpr ⟨Int.ceil_le.mpr (hS n hn).1, Int.le_floor.mpr (hS n hn).2⟩ exact (show (S.card : ℝ) ≤ (Finset.Icc ⌈a⌉ ⌊b⌋).card from Nat.cast_le.mpr (Finset.card_le_card hs)).trans (card_int_interval_le a b hab)
theorem card_nat_subset_interval_le (S : Finset ℕ) (a b : ℝ) (hab : a ≤ b) (hS : ∀ n ∈ S, a ≤ (n : ℝ) ∧ (n : ℝ) ≤ b) : (S.card : ℝ) ≤ b - a + 1 := by have hinj : Function.Injective (fun n : ℕ => (n : ℤ)) := Int.ofNat_injective have hc : (S.image (fun n : ℕ => (n : ℤ))).card = S.card := Finset.card_image_of_injective S hinj rw [← hc] apply card_int_subset_interval_le _ a b hab intro n hn obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp hn simpa only [Int.cast_natCast] using hS i hi
theorem card_affine_near_le (S : Finset ℕ) (L : ℕ) (γ β ε : ℝ) (hβ : 0 < β) (hε : 0 ≤ ε) (hSL : ∀ n ∈ S, n < L) (hgood : ∀ n ∈ S, ∃ m : ℤ, |γ + β * n - m| ≤ ε) : (S.card : ℝ) ≤ (β * L + 2 * ε + 1) * (2 * ε / β + 1) := by classical let m (n : ℕ) : ℤ := if hn : n ∈ S then (hgood n hn).choose else 0 have hm (n : ℕ) (hn : n ∈ S) : |γ + β * n - m n| ≤ ε := by simp only [m, dite_eq_left hn] exact (hgood n hn).choose_spec let T := S.image m have hT : (T.card : ℝ) ≤ β * L + 2 * ε + 1 := by have he := card_int_subset_interval_le T (γ - ε) (γ + β * L + ε) (by have : 0 ≤ β * (L : ℝ) := mul_nonneg hβ.le (Nat.cast_nonneg _); linarith) ?_ · linarith · intro z hz obtain ⟨n, hn, rfl⟩ := Finset.mem_image.mp hz have h := abs_le.mp (hm n hn) have hn₀ : 0 ≤ (n : ℝ) := Nat.cast_nonneg _ have hn₁ : (n : ℝ) ≤ L := by exact_mod_cast (hSL n hn).le constructor <;> nlinarith have hfiber (z : ℤ) : ((S.filter (fun n => m n = z)).card : ℝ) ≤ 2 * ε / β + 1 := by have he := card_nat_subset_interval_le (S.filter (fun n => m n = z)) (((z : ℝ) - ε - γ) / β) (((z : ℝ) + ε - γ) / β) (div_le_div_of_nonneg_right (by linarith) hβ.le) ?_ · have hr : ((z : ℝ) + ε - γ) / β - ((z : ℝ) - ε - γ) / β = 2 * ε / β := by ring rwa [hr] at he · intro n hn obtain ⟨hn, he⟩ := Finset.mem_filter.mp hn have h := abs_le.mp (hm n hn) rw [he] at h constructor · apply (div_le_iff₀ hβ).mpr nlinarith · apply (le_div_iff₀ hβ).mpr nlinarith have hmT : Set.MapsTo m S T := by intro n hn exact Finset.mem_image.mpr ⟨n, hn, rfl⟩ have hc : (S.card : ℝ) = ∑ z ∈ T, ((S.filter (fun n => m n = z)).card : ℝ) := by exact_mod_cast Finset.card_eq_sum_card_fiberwise hmT calc _ = ∑ z ∈ T, ((S.filter (fun n => m n = z)).card : ℝ) := hc _ ≤ ∑ _z ∈ T, (2 * ε / β + 1) := Finset.sum_le_sum (fun z _ => hfiber z) _ = (T.card : ℝ) * (2 * ε / β + 1) := by simp only [Finset.sum_const, nsmul_eq_mul] _ ≤ _ := mul_le_mul_of_nonneg_right hT (by positivity)
theorem card_affine_near_abs_le (S : Finset ℕ) (L : ℕ) (γ β ε : ℝ) (hβ : β ≠ 0) (hε : 0 ≤ ε) (hSL : ∀ n ∈ S, n < L) (hgood : ∀ n ∈ S, ∃ m : ℤ, |γ + β * n - m| ≤ ε) : (S.card : ℝ) ≤ (|β| * L + 2 * ε + 1) * (2 * ε / |β| + 1) := by rcases lt_or_gt_of_ne hβ with hβ | hβ · have hh : ∀ n ∈ S, ∃ m : ℤ, |-γ + (-β) * n - m| ≤ ε := by intro n hn obtain ⟨m, hm⟩ := hgood n hn refine ⟨-m, ?_⟩ have he : -γ + (-β) * (n : ℝ) - ((-m : ℤ) : ℝ) = -(γ + β * n - m) := by push_cast ring rwa [he, abs_neg] simpa only [abs_of_neg hβ] using card_affine_near_le S L (-γ) (-β) ε (neg_pos.mpr hβ) hε hSL hh · simpa only [abs_of_pos hβ] using card_affine_near_le S L γ β ε hβ hε hSL hgood
theorem card_near_of_approx (S : Finset ℕ) (N q : ℕ) (hq : 0 < q) (α γ β ε : ℝ) (m : ℤ) (happrox : α * q = m + β) (hβ : β ≠ 0) (hβsmall : |β| ≤ 2 * ε) (hε : 0 ≤ ε) (hεsmall : ε ≤ 1 / 4) (hSN : ∀ n ∈ S, n < N) (hgood : ∀ n ∈ S, ∃ z : ℤ, |α * n + γ - z| ≤ ε) : (S.card : ℝ) ≤ 4 * ε * N + 3 * q + 4 * q * ε / |β| := by classical let L := N / q + 1 let B := (|β| * L + 2 * ε + 1) * (2 * ε / |β| + 1) have hfiber (r : ℕ) : ((S.filter (fun n => n % q = r)).card : ℝ) ≤ B := by let Sᵣ := S.filter (fun n => n % q = r) let T := Sᵣ.image (fun n => n / q) have hc : T.card = Sᵣ.card := by apply Finset.card_image_iff.mpr intro x hx y hy he change x / q = y / q at he have hx' := (Finset.mem_filter.mp hx).2 have hy' := (Finset.mem_filter.mp hy).2 have h₁ := Nat.mod_add_div x q have h₂ := Nat.mod_add_div y q rw [hx', he] at h₁ rw [hy'] at h₂ omega have hTL : ∀ k ∈ T, k < L := by intro k hk obtain ⟨n, hn, rfl⟩ := Finset.mem_image.mp hk have h := Nat.div_le_div_right (c := q) (hSN n (Finset.mem_filter.mp hn).1).le exact Nat.lt_succ_of_le h have hTgood : ∀ k ∈ T, ∃ z : ℤ, |(α * r + γ) + β * k - z| ≤ ε := by intro k hk obtain ⟨n, hn, rfl⟩ := Finset.mem_image.mp hk obtain ⟨hn, hr⟩ := Finset.mem_filter.mp hn obtain ⟨z, hz⟩ := hgood n hn refine ⟨z - m * (n / q : ℕ), ?_⟩ have he : (n : ℝ) = (r : ℝ) + (q : ℝ) * (n / q : ℕ) := by have ht := Nat.mod_add_div n q rw [hr] at ht exact_mod_cast ht.symm have heq : (α * r + γ) + β * (n / q : ℕ) - ((z - m * (n / q : ℕ) : ℤ) : ℝ) = α * n + γ - z := by simp only [Int.cast_sub, Int.cast_mul, Int.cast_natCast] rw [he] linear_combination -(n / q : ℕ) * happrox rwa [heq] have h := card_affine_near_abs_le T L (α * r + γ) β ε hβ hε hTL hTgood rwa [hc] at h have hm : Set.MapsTo (fun n => n % q) S (Finset.range q) := by intro n _ exact Finset.mem_range.mpr (Nat.mod_lt _ hq) have hc : (S.card : ℝ) = ∑ r ∈ Finset.range q, ((S.filter (fun n => n % q = r)).card : ℝ) := by exact_mod_cast Finset.card_eq_sum_card_fiberwise hm have hb : (S.card : ℝ) ≤ (q : ℝ) * B := by rw [hc] calc _ ≤ ∑ _r ∈ Finset.range q, B := Finset.sum_le_sum (fun r _ => hfiber r) _ = _ := by simp only [Finset.sum_const, Finset.card_range, nsmul_eq_mul] have hbpos : 0 < |β| := abs_pos.mpr hβ have hL : (q : ℝ) * L ≤ N + q := by have h := Nat.div_mul_le_self N q dsimp [L] push_cast have h' : (q : ℝ) * (N / q : ℕ) ≤ N := by exact_mod_cast (by simpa [Nat.mul_comm] using h) nlinarith have hq₀ : 0 ≤ (q : ℝ) := Nat.cast_nonneg _ have hqL₀ : 0 ≤ (q : ℝ) * L := by positivity have hB : (q : ℝ) * B ≤ 4 * ε * N + 3 * q + 4 * q * ε / |β| := by have hc₀ : 0 ≤ 2 * ε / |β| + 1 := by positivity have hc₁ : 2 * ε + 1 ≤ 2 := by linarith have hstep : (q : ℝ) * B ≤ q * ((|β| * L + 2) * (2 * ε / |β| + 1)) := by apply mul_le_mul_of_nonneg_left _ hq₀ exact mul_le_mul_of_nonneg_right (by linarith) hc₀ have heq : (q : ℝ) * ((|β| * L + 2) * (2 * ε / |β| + 1)) = q * L * (2 * ε + |β|) + 4 * q * ε / |β| + 2 * q := by field_simp ring have hi₁ := mul_le_mul_of_nonneg_left hβsmall hqL₀ have hi₂ := mul_le_mul_of_nonneg_left hL (show 0 ≤ 4 * ε by positivity) have hi₃ := mul_le_mul_of_nonneg_right hεsmall hq₀ rw [heq] at hstep nlinarith exact hb.trans hB
theorem exists_small_denominator (S : Finset ℕ) (N Q : ℕ) (hQ : 0 < Q) (α γ ε : ℝ) (hSN : ∀ n ∈ S, n < N) (hcard : N / Q + 1 < S.card) (hgood : ∀ n ∈ S, ∃ z : ℤ, |α * n + γ - z| ≤ ε) : ∃ q : ℕ, 0 < q ∧ q < Q ∧ ∃ m : ℤ, |α * q - m| ≤ 2 * ε := by classical have hh : Set.MapsTo (fun n => n / Q) S (Finset.range (N / Q + 1)) := by intro n hn apply Finset.mem_range.mpr exact Nat.lt_succ_of_le (Nat.div_le_div_right (hSN n hn).le) have hcard' : (Finset.range (N / Q + 1)).card < S.card := by simpa using hcard obtain ⟨x, hx, y, hy, hxy, he⟩ := Finset.exists_ne_map_eq_of_card_lt_of_maps_to hcard' hh change x / Q = y / Q at he have hp (x y : ℕ) (hx : x ∈ S) (hy : y ∈ S) (hlt : x < y) (he : x / Q = y / Q) : ∃ q : ℕ, 0 < q ∧ q < Q ∧ ∃ m : ℤ, |α * q - m| ≤ 2 * ε := by obtain ⟨a, ha⟩ := hgood x hx obtain ⟨b, hb⟩ := hgood y hy refine ⟨y - x, Nat.sub_pos_of_lt hlt, ?_, b - a, ?_⟩ · have hx' := Nat.mod_add_div x Q have hy' := Nat.mod_add_div y Q have hymod := Nat.mod_lt y hQ rw [he] at hx' omega · have heq : α * (y - x : ℕ) - ((b - a : ℤ) : ℝ) = (α * y + γ - b) - (α * x + γ - a) := by rw [Nat.cast_sub hlt.le, Int.cast_sub] ring rw [heq] exact (abs_sub _ _).trans (by linarith) rcases lt_or_gt_of_ne hxy with hxy | hxy · exact hp x y hx hy hxy he · exact hp y x hy hx hxy he.symm
theorem vinogradov_inverse (S : Finset ℕ) (N K : ℕ) (hK : 0 < K) (hN : 32 * K ^ 2 ≤ N) (α γ ε : ℝ) (hε : 0 ≤ ε) (hεsmall : ε ≤ 1 / (16 * (K : ℝ))) (hSN : ∀ n ∈ S, n < N) (hdensity : (N : ℝ) / K ≤ S.card) (hgood : ∀ n ∈ S, ∃ z : ℤ, |α * n + γ - z| ≤ ε) : ∃ q : ℕ, 0 < q ∧ q ≤ 2 * K ∧ ∃ m : ℤ, |α * q - m| ≤ 16 * (K : ℝ) ^ 2 * ε / N := by have hK₀ : 0 < (K : ℝ) := Nat.cast_pos.mpr hK have hK₁ : 1 ≤ (K : ℝ) := by exact_mod_cast hK have hN₀ : 0 < (N : ℝ) := by have h : 32 * (K : ℝ) ^ 2 ≤ N := by exact_mod_cast hN nlinarith have hN' : 32 * (K : ℝ) ^ 2 ≤ N := by exact_mod_cast hN have hcard : N / (2 * K) + 1 < S.card := by have hdiv : ((N / (2 * K) : ℕ) : ℝ) ≤ (N : ℝ) / (2 * K) := by simpa only [Nat.cast_mul, Nat.cast_ofNat] using (Nat.cast_div_le (m := N) (n := 2 * K) (α := ℝ)) have he : (N : ℝ) / (2 * K) + 1 < (N : ℝ) / K := by apply (lt_div_iff₀ hK₀).mpr have heq : ((N : ℝ) / (2 * K) + 1) * K = N / 2 + K := by field_simp rw [heq] nlinarith have : ((N / (2 * K) : ℕ) : ℝ) + 1 < S.card := lt_of_lt_of_le (by linarith) hdensity exact_mod_cast this obtain ⟨q, hq₀, hq₁, m, hm⟩ := exists_small_denominator S N (2 * K) (by omega) α γ ε hSN hcard hgood refine ⟨q, hq₀, hq₁.le, m, ?_⟩ let β := α * q - m have heps : ε ≤ 1 / 4 := by have ht := (le_div_iff₀ (show 0 < 16 * (K : ℝ) by positivity)).mp hεsmall nlinarith by_cases hβ : β = 0 · change |β| ≤ _ rw [hβ, abs_zero] positivity · have hβpos : 0 < |β| := abs_pos.mpr hβ have hq : (q : ℝ) ≤ 2 * K := by exact_mod_cast hq₁.le have hq₀' : 0 ≤ (q : ℝ) := Nat.cast_nonneg _ have hc := card_near_of_approx S N q hq₀ α γ β ε m (by dsimp [β]; ring) hβ hm hε heps hSN hgood have hepsmul : 16 * (K : ℝ) * ε ≤ 1 := by have h := (le_div_iff₀ (show 0 < 16 * (K : ℝ) by positivity)).mp hεsmall nlinarith have hb₁ : 4 * ε * N ≤ (N : ℝ) / (4 * K) := by apply (le_div_iff₀ (show 0 < 4 * (K : ℝ) by positivity)).mpr have h := mul_le_mul_of_nonneg_right hepsmul hN₀.le nlinarith have hb₂ : 3 * (q : ℝ) ≤ (N : ℝ) / (4 * K) := by apply (le_div_iff₀ (show 0 < 4 * (K : ℝ) by positivity)).mpr have h := mul_le_mul_of_nonneg_right hq hK₀.le nlinarith have hr : (N : ℝ) / (2 * K) ≤ 4 * q * ε / |β| := by have he₁ : (N : ℝ) / K = 2 * ((N : ℝ) / (2 * K)) := by ring have he₂ : (N : ℝ) / (4 * K) = ((N : ℝ) / (2 * K)) / 2 := by ring rw [he₁] at hdensity rw [he₂] at hb₁ hb₂ linarith have hr' := (le_div_iff₀ hβpos).mp hr have ht := mul_le_mul_of_nonneg_right hr' (show 0 ≤ 2 * (K : ℝ) by positivity) have heq : ((N : ℝ) / (2 * K) * |β|) * (2 * K) = N * |β| := by field_simp rw [heq] at ht have hqε := mul_le_mul_of_nonneg_right hq (show 0 ≤ 8 * (K : ℝ) * ε by positivity) change |β| ≤ _ apply (le_div_iff₀ hN₀).mpr nlinarith
endend NearLattice
endendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.RationalLattice04import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionendend
sectionnoncomputable sectionnamespace MalcevPrefixQuotientopen RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n r : ℕ}variable (c : RealCoordinates G n) (hr : r ≤ n)variable (N : Subgroup G) [N.Normal]variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin n, i.val < r → c.coord g i = 0)
omit [N.Normal] inlemma represent_coordinates (x : G ⧸ N) (i : Fin n) : c.coord (represent c (coordinates c hr N hN x)) i = if h : i.val < r then coordinates c hr N hN x ⟨i.val,h⟩ else 0 := by simp [represent,lift]
lemma quotient_coordinates_mk (g : G) (i : Fin r) : (quotientChart c hr N hN).coord (QuotientGroup.mk g) i = c.coord g (embed hr i) := rfl
theorem quotient_lattice (Γ : Subgroup G) (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z) (x : G ⧸ N) : x ∈ Γ.map (QuotientGroup.mk' N) ↔ ∀ i, ∃ z : ℤ, (quotientChart c hr N hN).coord x i = z := by constructor · rintro ⟨g,hg,rfl⟩ i exact (hΓ g).mp hg (embed hr i) · intro hx refine ⟨represent c (coordinates c hr N hN x),?_,rebuild_coordinates c hr N hN x⟩ apply (hΓ _).mpr intro i rw [represent_coordinates] split_ifs with hi · exact hx ⟨i.val,hi⟩ · exact ⟨0,by simp⟩
theorem quotient_adapted (K : Subgroup G) (s : ℕ) (hK : ∀ g : G, g ∈ K ↔ ∀ i : Fin n, i.val < s → c.coord g i = 0) (x : G ⧸ N) : x ∈ K.map (QuotientGroup.mk' N) ↔ ∀ i : Fin r, i.val < s → (quotientChart c hr N hN).coord x i = 0 := by constructor · rintro ⟨g,hg,rfl⟩ i hi exact (hK g).mp hg (embed hr i) hi · intro hx refine ⟨represent c (coordinates c hr N hN x),?_,rebuild_coordinates c hr N hN x⟩ apply (hK _).mpr intro i hi rw [represent_coordinates] split_ifs with hir · exact hx ⟨i.val,hir⟩ hi · rfl
theorem quotient_rational (x : G ⧸ N) : IsRational (quotientChart c hr N hN) x ↔ ∃ g : G, IsRational c g ∧ (QuotientGroup.mk g : G ⧸ N) = x := by constructor · intro hx refine ⟨represent c (coordinates c hr N hN x),?_,rebuild_coordinates c hr N hN x⟩ intro i rw [represent_coordinates] split_ifs with hi · exact hx ⟨i.val,hi⟩ · exact ⟨0,by simp⟩ · rintro ⟨g,hg,rfl⟩ i exact hg (embed hr i)
end MalcevPrefixQuotientendend
sectionnoncomputable sectionnamespace PairTailvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable (K : Subgroup G) [K.Normal]
def square : Subgroup (G × G) where carrier := {x | x.1⁻¹*x.2 ∈ K} one_mem' := by simp mul_mem' := by intro a b ha hb have hh := K.mul_mem ((inferInstance : K.Normal).conj_mem _ ha b.1⁻¹) hb simpa [mul_assoc] using hh inv_mem' := by intro a ha have hh := (inferInstance : K.Normal).conj_mem _ (K.inv_mem ha) a.1 simpa [mul_assoc] using hh
def first : square K →* G := (MonoidHom.fst G G).comp (square K).subtype
def difference (x : square K) : K := ⟨x.val.1⁻¹*x.val.2,x.property⟩
def pair (g : G) (u : K) : square K := ⟨(g,g*u),by change g⁻¹*(g*u) ∈ K; simp⟩
omit [TopologicalSpace G] [IsTopologicalGroup G] in@[simp] lemma first_pair (g : G) (u : K) : first K (pair K g u) = g := rflomit [TopologicalSpace G] [IsTopologicalGroup G] in@[simp] lemma difference_pair (g : G) (u : K) : difference K (pair K g u) = u := by apply Subtype.ext simp [difference,pair]omit [TopologicalSpace G] [IsTopologicalGroup G] in@[simp] lemma pair_first_difference (x : square K) : pair K (first K x) (difference K x) = x := by apply Subtype.ext ext <;> simp [pair,first,difference]omit [IsTopologicalGroup G] inlemma first_continuous : Continuous (first K) := continuous_fst.comp continuous_subtype_vallemma difference_continuous : Continuous (difference K) := by apply Continuous.subtype_mk exact ((continuous_fst.comp continuous_subtype_val).inv).mul (continuous_snd.comp continuous_subtype_val)lemma pair_continuous : Continuous (fun x : G × K => pair K x.1 x.2) := by apply Continuous.subtype_mk exact continuous_fst.prodMk (continuous_fst.mul (continuous_subtype_val.comp continuous_snd))
def squareHomeomorph : square K ≃ₜ G × K where toFun x := (first K x,difference K x) invFun x := pair K x.1 x.2 left_inv := pair_first_difference K right_inv x := by simp continuous_toFun := (first_continuous K).prodMk (difference_continuous K) continuous_invFun := pair_continuous K
variable (N : Subgroup G) def diagonal : Subgroup (square K) where carrier := {x | x.val.1 ∈ N ∧ x.val.2 = x.val.1} one_mem' := ⟨N.one_mem,rfl⟩ mul_mem' := by rintro a b ⟨ha,hea⟩ ⟨hb,heb⟩ exact ⟨N.mul_mem ha hb,by change a.val.2*b.val.2 = a.val.1*b.val.1; rw [hea,heb]⟩ inv_mem' := by rintro a ⟨ha,he⟩ exact ⟨N.inv_mem ha,by change a.val.2⁻¹ = a.val.1⁻¹; rw [he]⟩
variable (hcent : N ≤ Subgroup.center G)include hcent inomit [TopologicalSpace G] [IsTopologicalGroup G] inlemma diagonal_normal : (diagonal K N).Normal where conj_mem x hx y := by rcases hx with ⟨hx,he⟩ have hc := Subgroup.mem_center_iff.mp (hcent hx) have h1 : y.val.1*x.val.1*y.val.1⁻¹ = x.val.1 := by rw [hc y.val.1]; simp [mul_assoc] have h2 : y.val.2*x.val.2*y.val.2⁻¹ = x.val.1 := by rw [he,hc y.val.2]; simp [mul_assoc] exact ⟨by change y.val.1*x.val.1*y.val.1⁻¹ ∈ N; rw [h1]; exact hx, by change y.val.2*x.val.2*y.val.2⁻¹ = y.val.1*x.val.1*y.val.1⁻¹; rw [h1,h2]⟩
include hcent inomit [TopologicalSpace G] [IsTopologicalGroup G] inlemma eq_coset_iff (x y : square K) : (QuotientGroup.mk x : square K ⧸ diagonal K N) = QuotientGroup.mk y ↔ (QuotientGroup.mk (first K x) : G ⧸ N) = QuotientGroup.mk (first K y) ∧ difference K x = difference K y := by rw [QuotientGroup.eq,QuotientGroup.eq] change (x.val.1⁻¹*y.val.1 ∈ N ∧ x.val.2⁻¹*y.val.2 = x.val.1⁻¹*y.val.1) ↔ _ change _ ↔ x.val.1⁻¹*y.val.1 ∈ N ∧ difference K x = difference K y constructor · rintro ⟨hn,he⟩ refine ⟨hn,Subtype.ext ?_⟩ change x.val.1⁻¹*x.val.2 = y.val.1⁻¹*y.val.2 have hc := Subgroup.mem_center_iff.mp (hcent hn) have hy : y.val.2 = x.val.2*(x.val.1⁻¹*y.val.1) := by rw [← he]; simp rw [hy] symm calc y.val.1⁻¹*(x.val.2*(x.val.1⁻¹*y.val.1)) = (y.val.1⁻¹*x.val.2)*(x.val.1⁻¹*y.val.1) := by group _ = (x.val.1⁻¹*y.val.1)*(y.val.1⁻¹*x.val.2) := hc _ _ = _ := by group · rintro ⟨hn,hd⟩ refine ⟨hn,?_⟩ have hd' := congrArg Subtype.val hd change x.val.1⁻¹*x.val.2 = y.val.1⁻¹*y.val.2 at hd' have hy : y.val.2 = y.val.1*(x.val.1⁻¹*x.val.2) := by rw [hd']; simp have hc := Subgroup.mem_center_iff.mp (hcent hn) rw [hy] calc x.val.2⁻¹*(y.val.1*(x.val.1⁻¹*x.val.2)) = x.val.2⁻¹*x.val.1*(x.val.1⁻¹*y.val.1)*(x.val.1⁻¹*x.val.2) := by group _ = (x.val.1⁻¹*y.val.1)*(x.val.2⁻¹*x.val.1)*(x.val.1⁻¹*x.val.2) := by rw [hc (x.val.2⁻¹*x.val.1)] _ = x.val.1⁻¹*y.val.1 := by group
def quotientCoordinates (x : square K ⧸ diagonal K N) : (G ⧸ N) × K := Quotient.lift (fun x : square K => (QuotientGroup.mk (first K x),difference K x)) (by intro x y he have h := (eq_coset_iff K N hcent x y).mp (Quotient.sound he) exact Prod.ext h.1 h.2) x
omit [TopologicalSpace G] [IsTopologicalGroup G] in@[simp] lemma quotientCoordinates_mk (x : square K) : quotientCoordinates K N hcent (QuotientGroup.mk x) = (QuotientGroup.mk (first K x),difference K x) := rfllemma quotientCoordinates_continuous : Continuous (quotientCoordinates K N hcent) := by rw [(QuotientGroup.isQuotientMap_mk (diagonal K N)).continuous_iff] exact (QuotientGroup.continuous_mk.comp (first_continuous K)).prodMk (difference_continuous K)
variable (s : G ⧸ N → G) (hs : ∀ x, (QuotientGroup.mk (s x) : G ⧸ N) = x)variable (hsc : Continuous s)def quotientRebuild (x : (G ⧸ N) × K) : square K ⧸ diagonal K N := QuotientGroup.mk (pair K (s x.1) x.2)include hs inomit [TopologicalSpace G] [IsTopologicalGroup G] inlemma quotientCoordinates_rebuild (x : (G ⧸ N) × K) : quotientCoordinates K N hcent (quotientRebuild K N s x) = x := by simp [quotientRebuild,hs]include hs inomit [TopologicalSpace G] [IsTopologicalGroup G] inlemma quotientRebuild_coordinates (x : square K ⧸ diagonal K N) : quotientRebuild K N s (quotientCoordinates K N hcent x) = x := by induction x using Quotient.inductionOn with | h x => apply (eq_coset_iff K N hcent _ _).mpr simp [quotientCoordinates_mk,hs]include hsc inlemma quotientRebuild_continuous : Continuous (quotientRebuild K N s) := by exact QuotientGroup.continuous_mk.comp ((pair_continuous K).comp ((hsc.comp continuous_fst).prodMk continuous_snd))
def quotientHomeomorph : (square K ⧸ diagonal K N) ≃ₜ (G ⧸ N) × K where toFun := quotientCoordinates K N hcent invFun := quotientRebuild K N s left_inv := quotientRebuild_coordinates K N hcent s hs right_inv := quotientCoordinates_rebuild K N hcent s hs continuous_toFun := quotientCoordinates_continuous K N hcent continuous_invFun := quotientRebuild_continuous K N s hsc
end PairTailendend
sectionopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionnamespace RationalPolynomialMapvariable {σ τ : Type*}
def IsPolynomial (f : (σ → ℝ) → ℝ) : Prop := ∃ P : MvPolynomial σ ℚ, ∀ x, f x = MvPolynomial.eval₂ (algebraMap ℚ ℝ) x P
lemma const (q : ℚ) : IsPolynomial (fun _ : σ → ℝ => (q:ℝ)) := ⟨MvPolynomial.C q,by simp⟩lemma zero : IsPolynomial (fun _ : σ → ℝ => (0:ℝ)) := by simpa using const (σ:=σ) 0lemma one : IsPolynomial (fun _ : σ → ℝ => (1:ℝ)) := by simpa using const (σ:=σ) 1lemma coordinate (i : σ) : IsPolynomial (fun x : σ → ℝ => x i) := ⟨MvPolynomial.X i,by simp⟩lemma add {f g : (σ → ℝ) → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) : IsPolynomial (fun x => f x+g x) := by obtain ⟨p,hp⟩ := hf obtain ⟨q,hq⟩ := hg exact ⟨p+q,by simp [hp,hq]⟩lemma mul {f g : (σ → ℝ) → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) : IsPolynomial (fun x => f x*g x) := by obtain ⟨p,hp⟩ := hf obtain ⟨q,hq⟩ := hg exact ⟨p*q,by simp [hp,hq]⟩lemma neg {f : (σ → ℝ) → ℝ} (hf : IsPolynomial f) : IsPolynomial (fun x => -f x) := by obtain ⟨p,hp⟩ := hf exact ⟨-p,by simp [hp]⟩lemma sub {f g : (σ → ℝ) → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) : IsPolynomial (fun x => f x-g x) := by simpa [sub_eq_add_neg] using add hf (neg hg)
lemma eval {f : τ → (σ → ℝ) → ℝ} (hf : ∀ i, IsPolynomial (f i)) (P : MvPolynomial τ ℚ) : IsPolynomial (fun x => MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun i => f i x) P) := by induction P using MvPolynomial.induction_on with | C q => simpa using const (σ:=σ) q | add p q hp hq => simpa using add hp hq | mul_X p i hp => simpa using mul hp (hf i)
lemma comp {f : (τ → ℝ) → ℝ} (hf : IsPolynomial f) {g : (σ → ℝ) → (τ → ℝ)} (hg : ∀ i, IsPolynomial (fun x => g x i)) : IsPolynomial (fun x => f (g x)) := by obtain ⟨p,hp⟩ := hf simpa only [hp] using eval hg p
lemma polynomial_eval (P : ℚ[X]) {f : (σ → ℝ) → ℝ} (hf : IsPolynomial f) : IsPolynomial (fun x => P.eval₂ (algebraMap ℚ ℝ) (f x)) := by induction P using Polynomial.induction_on' with | add p q hp hq => simpa using add hp hq | monomial i a => have hi : IsPolynomial (fun x => (f x)^i) := by induction i with | zero => simpa using one (σ:=σ) | succ i ih => simpa only [pow_succ] using mul ih hf simpa using mul (const a) hiend RationalPolynomialMap
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.RationalLattice07import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionendend
sectionnoncomputable sectionnamespace PairTailopen RationalLattice RationalPolynomialMapvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {t d r : ℕ} (c : RealCoordinates G (t+d))
def lowerArgs (i : Fin (r+d)) (X Y : Fin (r+d) → ℝ) : (Fin i.val ⊕ Fin i.val) → ℝ := Sum.elim (fun j => X ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j => Y ⟨j.val,lt_trans j.isLt i.isLt⟩)
def baseInput (j : Fin d) (v : (Fin (r+j.val) ⊕ Fin (r+j.val)) → ℝ) : G := c.coord.symm (fun a => if h : a.val < r then v (.inr ⟨a.val,by omega⟩) else 0)
def tailInput (j : Fin d) (v : Fin (r+j.val) → ℝ) : Fin (t+j.val) → ℝ := fun a => if h : t ≤ a.val then v ⟨r+(a.val-t),by have := a.isLt; omega⟩ else 0
omit [IsTopologicalGroup G] inlemma baseInput_polynomial (j : Fin d) : IsPolynomialMap c (baseInput c (r:=r) j) := by intro a simp only [baseInput,Homeomorph.apply_symm_apply] split_ifs · exact coordinate _ · exact zero
omit [IsTopologicalGroup G] inlemma tailCorrection_exists (j : Fin d) : ∃ P : MvPolynomial (Fin (r+j.val) ⊕ Fin (r+j.val)) ℚ, ∀ v : (Fin (r+j.val) ⊕ Fin (r+j.val)) → ℝ, c.coord ((baseInput c j v)⁻¹ * truncate c (RationalTailCoordinates.embed t j) (tailInput j (fun a => v (.inl a))) * baseInput c j v * truncate c (RationalTailCoordinates.embed t j) (tailInput j (fun a => v (.inr a)))) (RationalTailCoordinates.embed t j) = MvPolynomial.eval₂ (algebraMap ℚ ℝ) v P := by have hu : IsPolynomialMap c (fun v : (Fin (r+j.val) ⊕ Fin (r+j.val)) → ℝ => truncate c (RationalTailCoordinates.embed t j) (tailInput j (fun a => v (.inl a)))) := by apply polynomialMap_truncate intro a unfold tailInput split_ifs · exact coordinate _ · exact zero have hv : IsPolynomialMap c (fun v : (Fin (r+j.val) ⊕ Fin (r+j.val)) → ℝ => truncate c (RationalTailCoordinates.embed t j) (tailInput j (fun a => v (.inr a)))) := by apply polynomialMap_truncate intro a unfold tailInput split_ifs · exact coordinate _ · exact zero exact polynomialMap_mul c (polynomialMap_mul c (polynomialMap_mul c (polynomialMap_inv c (baseInput_polynomial c j)) hu) (baseInput_polynomial c j)) hv (RationalTailCoordinates.embed t j)
def tailCorrection (j : Fin d) : MvPolynomial (Fin (r+j.val) ⊕ Fin (r+j.val)) ℚ := (tailCorrection_exists c j).choose
omit [IsTopologicalGroup G] inlemma baseInput_args (j : Fin d) (X Y : Fin (r+d) → ℝ) : baseInput c j (lowerArgs (j.natAdd r) X Y) = MalcevPrefixQuotient.represent c (fun a : Fin r => Y (a.castAdd d)) := by apply c.coord.injective funext a simp only [baseInput,MalcevPrefixQuotient.represent,Homeomorph.apply_symm_apply, MalcevPrefixQuotient.lift] split_ifs <;> rfl
variable (K : Subgroup G) [K.Normal]variable (hK : ∀ g : G, g ∈ K ↔ ∀ i : Fin (t+d), i.val < t → c.coord g i = 0)
omit [IsTopologicalGroup G] [K.Normal] inlemma tailInput_args (j : Fin d) (X : Fin (r+d) → ℝ) (a : Fin (t+j.val)) : tailInput j (fun u : Fin (r+j.val) => X ⟨u.val,by have := u.isLt; have := j.isLt; omega⟩) a = c.coord (RationalTailCoordinates.rebuild c K hK (fun u : Fin d => X (u.natAdd r))).val ⟨a.val,by have := a.isLt; have := j.isLt; omega⟩ := by simp only [tailInput,RationalTailCoordinates.rebuild,Homeomorph.apply_symm_apply, RationalTailCoordinates.lift] split_ifs <;> rfl
omit [IsTopologicalGroup G] [K.Normal] inlemma tailCorrection_args (j : Fin d) (X Y : Fin (r+d) → ℝ) : MvPolynomial.eval₂ (algebraMap ℚ ℝ) (lowerArgs (j.natAdd r) X Y) (tailCorrection c j) = c.coord ( (MalcevPrefixQuotient.represent c (fun a : Fin r => Y (a.castAdd d)))⁻¹ * truncate c (RationalTailCoordinates.embed t j) (fun a => c.coord (RationalTailCoordinates.rebuild c K hK (fun u : Fin d => X (u.natAdd r))).val ⟨a.val,lt_trans a.isLt (RationalTailCoordinates.embed t j).isLt⟩) * MalcevPrefixQuotient.represent c (fun a : Fin r => Y (a.castAdd d)) * truncate c (RationalTailCoordinates.embed t j) (fun a => c.coord (RationalTailCoordinates.rebuild c K hK (fun u : Fin d => Y (u.natAdd r))).val ⟨a.val,lt_trans a.isLt (RationalTailCoordinates.embed t j).isLt⟩)) (RationalTailCoordinates.embed t j) := by unfold tailCorrection rw [← (tailCorrection_exists c j).choose_spec,baseInput_args] have hx : tailInput j (fun a => lowerArgs (j.natAdd r) X Y (.inl a)) = (fun a : Fin (t+j.val) => c.coord (RationalTailCoordinates.rebuild c K hK (fun u : Fin d => X (u.natAdd r))).val ⟨a.val,by have := a.isLt; have := j.isLt; omega⟩) := by funext a exact tailInput_args c K hK j X a have hy : tailInput j (fun a => lowerArgs (j.natAdd r) X Y (.inr a)) = (fun a : Fin (t+j.val) => c.coord (RationalTailCoordinates.rebuild c K hK (fun u : Fin d => Y (u.natAdd r))).val ⟨a.val,by have := a.isLt; have := j.isLt; omega⟩) := by funext a exact tailInput_args c K hK j Y a rw [hx,hy] rfl
variable (hr : r ≤ t+d) (N : Subgroup G) [N.Normal]variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin (t+d), i.val < r → c.coord g i = 0)variable (hcent : N ≤ Subgroup.center G)variable [(diagonal K N).Normal]
def correction (i : Fin (r+d)) : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ := Fin.addCases (motive := fun i : Fin (r+d) => MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ) (fun j : Fin r => c.correction (MalcevPrefixQuotient.embed hr j)) (fun j : Fin d => tailCorrection c j) i
omit [IsTopologicalGroup G] in@[simp] lemma correction_base (j : Fin r) : correction c hr (j.castAdd d) = c.correction (MalcevPrefixQuotient.embed hr j) := by exact Fin.addCases_left (motive := fun i : Fin (r+d) => MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ) jomit [IsTopologicalGroup G] in@[simp] lemma correction_tail (j : Fin d) : correction c hr (j.natAdd r) = tailCorrection c j := by exact Fin.addCases_right (motive := fun i : Fin (r+d) => MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ) j
omit [N.Normal] inlemma coordinate_mul (x y : square K ⧸ diagonal K N) (i : Fin (r+d)) : chartHomeomorph c K hK hr N hN hcent (x*y) i = chartHomeomorph c K hK hr N hN hcent x i + chartHomeomorph c K hK hr N hN hcent y i + MvPolynomial.eval₂ (algebraMap ℚ ℝ) (lowerArgs i (chartHomeomorph c K hK hr N hN hcent x) (chartHomeomorph c K hK hr N hN hcent y)) (correction c hr i) := by obtain ⟨X,rfl⟩ := (chartHomeomorph c K hK hr N hN hcent).symm.surjective x obtain ⟨Y,rfl⟩ := (chartHomeomorph c K hK hr N hN hcent).symm.surjective y simp only [Homeomorph.apply_symm_apply] rw [chart_rebuild_base,chart_rebuild_base,← QuotientGroup.mk_mul] refine Fin.addCases (fun j => ?_) (fun j => ?_) i · rw [chart_base,correction_base] change c.coord (_ * _) _ = _ rw [c.mul_coord] simp only [pair,MalcevPrefixQuotient.represent,Homeomorph.apply_symm_apply] congr 1 · simp [MalcevPrefixQuotient.lift,MalcevPrefixQuotient.embed] · congr 1 funext a cases a with | inl a => change (if h : a.val < r then X ⟨a.val,by omega⟩ else 0) = X ⟨a.val,by have ha : a.val < j.val := a.isLt; have := j.isLt; omega⟩ rw [dite_eq_left (lt_trans a.isLt j.isLt)] | inr a => change (if h : a.val < r then Y ⟨a.val,by omega⟩ else 0) = Y ⟨a.val,by have ha : a.val < j.val := a.isLt; have := j.isLt; omega⟩ rw [dite_eq_left (lt_trans a.isLt j.isLt)] · rw [chart_tail,correction_tail,tailCorrection_args c K hK] let a := MalcevPrefixQuotient.represent c (fun i : Fin r => X (i.castAdd d)) let b := MalcevPrefixQuotient.represent c (fun i : Fin r => Y (i.castAdd d)) let u := (RationalTailCoordinates.rebuild c K hK (fun i : Fin d => X (i.natAdd r))).val let v := (RationalTailCoordinates.rebuild c K hK (fun i : Fin d => Y (i.natAdd r))).val change c.coord ((a*b)⁻¹*((a*u)*(b*v))) _ = _ rw [show (a*b)⁻¹*((a*u)*(b*v)) = b⁻¹*u*b*v from by group] rw [conj_mul_truncated] congr 2 · simp [u,RationalTailCoordinates.rebuild] · simp [v,RationalTailCoordinates.rebuild]
def reducedCoordinates : RealCoordinates (square K ⧸ diagonal K N) (r+d) where coord := chartHomeomorph c K hK hr N hN hcent one_coord i := congrFun (chart_one c K hK hr N hN hcent) i correction := correction c hr mul_coord := coordinate_mul c K hK hr N hN hcent
end PairTailendend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
def reduceCoordinates (g : G) : ℕ → G | 0 => g | k+1 => if h : k < n then reduceCoordinates g k * basisFlow c ⟨k,h⟩ (-(⌊c.coord (reduceCoordinates g k) ⟨k,h⟩⌋:ℝ)) else reduceCoordinates g k
lemma reduceCoordinates_bounds (g : G) (k : ℕ) : ∀ i : Fin n, i.val < k → c.coord (reduceCoordinates c g k) i ∈ Set.Ico (0:ℝ) 1 := by induction k with | zero => intro i hi; omega | succ k ih => intro i hi by_cases hk : k < n · rw [reduceCoordinates,dite_eq_left hk] rw [coord_mul_of_right_zero c _ _ i (by intro j hj rw [basisFlow_coord c _ j (show j.val ≤ k from by change j.val < i.val at hj; omega)] simp [show j ≠ (⟨k,hk⟩:Fin n) from fun h => by have := congrArg Fin.val h; change j.val < i.val at hj; dsimp at this; omega])] by_cases hik : i.val < k · rw [basisFlow_coord c _ i (show i.val ≤ k from by omega)] simp only [ite_eq_right (show i ≠ (⟨k,hk⟩:Fin n) from fun h => by have := congrArg Fin.val h; dsimp at this; omega),add_zero] exact ih i hik · have he : i = (⟨k,hk⟩:Fin n) := Fin.ext (show i.val = k from by omega) subst i rw [basisFlow_coord c _ _ le_rfl,ite_eq_left rfl] constructor · have h := Int.floor_le (c.coord (reduceCoordinates c g k) ⟨k,hk⟩); linarith · have h := Int.lt_floor_add_one (c.coord (reduceCoordinates c g k) ⟨k,hk⟩); linarith · rw [reduceCoordinates,dite_eq_right hk] exact ih i (by omega)
variable (Γ : Subgroup G)variable (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z)include hΓ inlemma reduceCoordinates_coset (g : G) (k : ℕ) : (reduceCoordinates c g k)⁻¹*g ∈ Γ := by induction k with | zero => simp [reduceCoordinates] | succ k ih => simp only [reduceCoordinates] split_ifs with hk · rw [mul_inv_rev,mul_assoc] apply Γ.mul_mem _ ih apply Γ.inv_mem rw [← Int.cast_neg] exact basisFlow_int_mem c Γ hΓ _ _ · exact ih
include hΓ in
theorem compact_reps_of_integerCoordinates : ∃ C : Set G, IsCompact C ∧ ∀ g : G, ∃ a ∈ C, a⁻¹*g ∈ Γ := by let B : Set (Fin n → ℝ) := Set.pi Set.univ (fun _ => Set.Icc (0:ℝ) 1) have hB : IsCompact B := isCompact_univ_pi (fun _ => isCompact_Icc) refine ⟨c.coord.symm '' B,hB.image c.coord.symm.continuous,fun g => ?_⟩ refine ⟨reduceCoordinates c g n,?_,reduceCoordinates_coset c Γ hΓ g n⟩ refine ⟨c.coord (reduceCoordinates c g n),?_,c.coord.symm_apply_apply _⟩ intro i _ exact ⟨(reduceCoordinates_bounds c g n i i.isLt).1, (reduceCoordinates_bounds c g n i i.isLt).2.le⟩
end RationalLattice
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.CoordinateSubspace01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionendend
sectionnoncomputable sectionnamespace PairTailopen RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {t d r : ℕ} (c : RealCoordinates G (t+d))variable (K : Subgroup G) [K.Normal]variable (hK : ∀ g : G, g ∈ K ↔ ∀ i : Fin (t+d), i.val < t → c.coord g i = 0)variable (hr : r ≤ t+d) (N : Subgroup G) [N.Normal]variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin (t+d), i.val < r → c.coord g i = 0)variable (hcent : N ≤ Subgroup.center G) [(diagonal K N).Normal]
def pairLevel (A B : Subgroup G) [B.Normal] : Subgroup (square K) := (A.comap (first K)) ⊓ (square B).comap (square K).subtype
def reducedLevel (A B : Subgroup G) [B.Normal] : Subgroup (square K ⧸ diagonal K N) := (pairLevel K A B).map (QuotientGroup.mk' (diagonal K N))
omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma mem_pairLevel (A B : Subgroup G) [B.Normal] (x : square K) : x ∈ pairLevel K A B ↔ x.val.1 ∈ A ∧ x.val.1⁻¹*x.val.2 ∈ B := Iff.rfl
variable {a b : ℕ} (ha : a ≤ r)variable (A B : Subgroup G) [B.Normal]variable (hA : ∀ g : G, g ∈ A ↔ ∀ i : Fin (t+d), i.val < a → c.coord g i = 0)variable (hB : ∀ g : G, g ∈ B ↔ ∀ i : Fin (t+d), i.val < b → c.coord g i = 0)
include ha hA hB in
omit [N.Normal] intheorem reducedLevel_coordinates (x : square K ⧸ diagonal K N) : x ∈ reducedLevel K N A B ↔ (∀ i : Fin r, i.val < a → (reducedCoordinates c K hK hr N hN hcent).coord x (i.castAdd d) = 0) ∧ (∀ j : Fin d, t+j.val < b → (reducedCoordinates c K hK hr N hN hcent).coord x (j.natAdd r) = 0) := by constructor · rintro ⟨y,hy,rfl⟩ change y.val.1 ∈ A ∧ y.val.1⁻¹*y.val.2 ∈ B at hy constructor · intro i hi change chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk y) _ = 0 rw [chart_base] exact (hA y.val.1).mp hy.1 _ hi · intro j hj change chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk y) _ = 0 rw [chart_tail] exact (hB _).mp hy.2 _ hj · induction x using Quotient.inductionOn with | h x => intro hx refine ⟨x,?_,rfl⟩ change x.val.1 ∈ A ∧ x.val.1⁻¹*x.val.2 ∈ B constructor · apply (hA _).mpr intro i hi have hir : i.val < r := lt_of_lt_of_le hi ha have he := hx.1 ⟨i.val,hir⟩ hi change chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk x) _ = 0 at he rw [chart_base] at he exact he · apply (hB _).mpr intro i hi by_cases hit : i.val < t · exact (hK _).mp x.property i hit · have hid : i.val-t < d := by have := i.isLt; omega have he := hx.2 ⟨i.val-t,hid⟩ (by dsimp; omega) change chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk x) _ = 0 at he rw [chart_tail] at he have hiEq : RationalTailCoordinates.embed t (⟨i.val-t,hid⟩ : Fin d) = i := Fin.ext (by dsimp [RationalTailCoordinates.embed]; omega) simpa only [hiEq] using he
def levelIndices (r d t a b : ℕ) : Finset (Fin (r+d)) := Finset.univ.filter (fun i => (i.val < r → a ≤ i.val) ∧ (r ≤ i.val → b ≤ t+(i.val-r)))
def levelEmbedding (r d t a b : ℕ) : Fin (levelIndices r d t a b).card ↪o Fin (r+d) := (levelIndices r d t a b).orderEmbOfFin rfl
lemma mem_range_levelEmbedding (i : Fin (r+d)) : i ∈ Set.range (levelEmbedding r d t a b) ↔ (i.val < r → a ≤ i.val) ∧ (r ≤ i.val → b ≤ t+(i.val-r)) := by rw [levelEmbedding,Finset.range_orderEmbOfFin] simp only [Finset.mem_coe,levelIndices,Finset.mem_filter,Finset.mem_univ,true_and]
include ha hA hB inomit [N.Normal] inlemma reducedLevel_subspace (x : square K ⧸ diagonal K N) : x ∈ reducedLevel K N A B ↔ ∀ i, i ∉ Set.range (levelEmbedding r d t a b) → (reducedCoordinates c K hK hr N hN hcent).coord x i = 0 := by rw [reducedLevel_coordinates c K hK hr N hN hcent ha A B hA hB] constructor · rintro ⟨hbase,htail⟩ i hi rw [mem_range_levelEmbedding] at hi by_cases hir : i.val < r · have hia : i.val < a := by omega exact hbase ⟨i.val,hir⟩ hia · have hid : i.val-r < d := by have := i.isLt; omega have hib : t+(i.val-r) < b := by omega have hiEq : Fin.natAdd r (⟨i.val-r,hid⟩ : Fin d) = i := Fin.ext (by dsimp; omega) simpa only [hiEq] using htail ⟨i.val-r,hid⟩ hib · intro hx constructor · intro i hi apply hx rw [mem_range_levelEmbedding] simp only [Fin.val_castAdd] omega · intro j hj apply hx rw [mem_range_levelEmbedding] simp only [Fin.val_natAdd] omega
def reducedLevelCoordinates : RealCoordinates (reducedLevel K N A B) (levelIndices r d t a b).card := CoordinateSubspace.restrictedCoordinates (reducedCoordinates c K hK hr N hN hcent) (levelEmbedding r d t a b) (reducedLevel K N A B) (reducedLevel_subspace c K hK hr N hN hcent ha A B hA hB)
omit [N.Normal] inlemma reducedLevel_lattice (Γ : Subgroup G) (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z) (x : reducedLevel K N A B) : x ∈ (reducedLattice K N Γ).comap (reducedLevel K N A B).subtype ↔ ∀ i, ∃ z : ℤ, (reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB).coord x i = z := CoordinateSubspace.restricted_lattice _ _ _ _ (reducedLattice K N Γ) (reducedLattice_iff c K hK hr N hN hcent Γ hΓ) x
end PairTailendend
sectionnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
include c inlemma coordinates_connected : ConnectedSpace G := c.coord.connectedSpace_iff.mpr inferInstance
include c inlemma coordinates_simplyConnected : SimplyConnectedSpace G := c.coord.toHomotopyEquiv.simplyConnectedSpace_iff.mpr inferInstance
include c inlemma coordinates_locallyCompact : LocallyCompactSpace G := c.coord.locallyCompactSpace_iff.mpr inferInstance
include c inlemma coordinates_secondCountable : SecondCountableTopology G := c.coord.secondCountableTopology
end RationalLattice
namespace PairTailopen RationalLattice MeasureTheoryvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {t d r : ℕ} (c : RealCoordinates G (t+d))variable (K : Subgroup G) [K.Normal]variable (hK : ∀ g : G, g ∈ K ↔ ∀ i : Fin (t+d), i.val < t → c.coord g i = 0)variable (hr : r ≤ t+d) (N : Subgroup G) [N.Normal]variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin (t+d), i.val < r → c.coord g i = 0)variable (hcent : N ≤ Subgroup.center G) [(diagonal K N).Normal]variable {a b : ℕ} (ha : a ≤ r)variable (A B : Subgroup G) [B.Normal]variable (hA : ∀ g : G, g ∈ A ↔ ∀ i : Fin (t+d), i.val < a → c.coord g i = 0)variable (hB : ∀ g : G, g ∈ B ↔ ∀ i : Fin (t+d), i.val < b → c.coord g i = 0)
include ha hA hB hK hN hcent hr inomit [N.Normal] inlemma reducedLevel_connected : ConnectedSpace (reducedLevel K N A B) := coordinates_connected (reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB)
include ha hA hB hK hN hcent hr inomit [N.Normal] inlemma reducedLevel_simplyConnected : SimplyConnectedSpace (reducedLevel K N A B) := coordinates_simplyConnected (reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB)
variable (Γ : Subgroup G)variable (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z)
include ha hA hB hK hN hcent hr hΓ inomit [N.Normal] inlemma reducedLevel_compact_reps : ∃ C : Set (reducedLevel K N A B), IsCompact C ∧ ∀ g : reducedLevel K N A B, ∃ x ∈ C, x⁻¹*g ∈ (reducedLattice K N Γ).comap (reducedLevel K N A B).subtype := compact_reps_of_integerCoordinates (reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB) ((reducedLattice K N Γ).comap (reducedLevel K N A B).subtype) (reducedLevel_lattice c K hK hr N hN hcent ha A B hA hB Γ hΓ)
include ha hA hB hK hN hcent hr hΓ inomit [N.Normal] inlemma reducedLevel_discrete : DiscreteTopology ((reducedLattice K N Γ).comap (reducedLevel K N A B).subtype) := integerCoordinates_discrete (reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB) ((reducedLattice K N Γ).comap (reducedLevel K N A B).subtype) (reducedLevel_lattice c K hK hr N hN hcent ha A B hA hB Γ hΓ)
include ha hA hB hK hN hcent hr hΓ in
omit [N.Normal] inlemma reducedLevelHaar_existsUnique [MeasurableSpace ((reducedLevel K N A B) ⧸ (reducedLattice K N Γ).comap (reducedLevel K N A B).subtype)] [BorelSpace ((reducedLevel K N A B) ⧸ (reducedLattice K N Γ).comap (reducedLevel K N A B).subtype)] : ∃! μ : ProbabilityMeasure ((reducedLevel K N A B) ⧸ (reducedLattice K N Γ).comap (reducedLevel K N A B).subtype), SMulInvariantMeasure (reducedLevel K N A B) ((reducedLevel K N A B) ⧸ (reducedLattice K N Γ).comap (reducedLevel K N A B).subtype) (μ : Measure ((reducedLevel K N A B) ⧸ (reducedLattice K N Γ).comap (reducedLevel K N A B).subtype)) := existsUnique_coordinateHaar (reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB) ((reducedLattice K N Γ).comap (reducedLevel K N A B).subtype) (reducedLevel_lattice c K hK hr N hN hcent ha A B hA hB Γ hΓ)
end PairTailendend
section
open scoped commutatorElement
namespace CubeFaces
end CubeFaces
endendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.MalcevWeighted02import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionendend
sectionnoncomputable sectionopen scoped commutatorElementnamespace PairTailopen RationalLattice CubeFacesvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)variable [∀ k : ℕ, (H.level k).Normal]
def squareFiltration : Filtration (square (H.level 2)) where level k := (LeibmanSquare.level H h0 (max 1 k)).comap (square (H.level 2)).subtype antitone := by intro i j hij exact Subgroup.comap_mono (LeibmanSquare.level_antitone H h0 (max_le_max_left 1 hij)) commutator_le i j := by apply Subgroup.commutator_le.mpr intro x hx y hy change (↑⁅x,y⁆ : G × G)∈LeibmanSquare.level H h0 (max 1 (i+j)) have hc := LeibmanSquare.commutator_mem_level H h0 (max 1 i) (max 1 j) hx hy exact LeibmanSquare.level_antitone H h0 (by omega) hc
include h1 inomit [TopologicalSpace G] [IsTopologicalGroup G] inlemma squareFiltration_zero : (squareFiltration H h0).level 0=⊤ := by ext x change (x.val.1∈H.level 1 ∧ x.val.2∈H.level 1 ∧ x.val.1⁻¹*x.val.2∈H.level 2) ↔ True simp only [h1,Subgroup.mem_top,true_and,iff_true] exact x.property
include h1 inomit [TopologicalSpace G] [IsTopologicalGroup G] inlemma squareFiltration_one : (squareFiltration H h0).level 1=⊤ := by change (squareFiltration H h0).level 0=⊤ exact squareFiltration_zero H h0 h1
omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma squareFiltration_eq_pairLevel (k : ℕ) : (squareFiltration H h0).level k= pairLevel (H.level 2) (H.level (max 1 k)) (H.level (max 1 k+1)) := by ext x change (x.val.1∈H.level (max 1 k) ∧ x.val.2∈H.level (max 1 k) ∧ x.val.1⁻¹*x.val.2∈H.level (max 1 k+1)) ↔ (x.val.1∈H.level (max 1 k) ∧ x.val.1⁻¹*x.val.2∈H.level (max 1 k+1)) constructor · exact fun hx => ⟨hx.1,hx.2.2⟩ · rintro ⟨hx,hd⟩ refine ⟨hx,?_,hd⟩ have hh := (H.level (max 1 k)).mul_mem hx (H.antitone (by omega : max 1 k ≤ max 1 k+1) hd) simpa using hh
variable (s : ℕ) (hs1 : 1 ≤ s) (hs : H.level (s+1)=⊥)include hs1 hs inomit [TopologicalSpace G] [IsTopologicalGroup G] inlemma squareFiltration_last : (squareFiltration H h0).level s=diagonal (H.level 2) (H.level s) := by ext x change x.val∈LeibmanSquare.level H h0 (max 1 s) ↔ _ rw [max_eq_right hs1,LeibmanSquare.last_level H h0 s hs] change (x.val.1∈H.level s ∧ x.val.1=x.val.2) ↔ (x.val.1∈H.level s ∧ x.val.2=x.val.1) exact and_congr_right fun _ => eq_comm
include h1 hs inomit [TopologicalSpace G] [IsTopologicalGroup G] [∀ levelIndex : ℕ, (H.level levelIndex).Normal] inlemma level_last_central : H.level s ≤ Subgroup.center G := by intro x hx apply Subgroup.mem_center_iff.mpr intro y apply commutatorElement_eq_one_iff_mul_comm.mp have hy : y∈H.level 1 := by rw [h1]; trivial have hh := H.commutator_le 1 s (Subgroup.commutator_mem_commutator hy hx) rw [Nat.add_comm,hs] at hh exact hh
variable [(diagonal (H.level 2) (H.level s)).Normal]
def reducedSquareFiltration : Filtration (square (H.level 2) ⧸ diagonal (H.level 2) (H.level s)) := LeibmanSquare.mapFiltration (squareFiltration H h0) (QuotientGroup.mk' (diagonal (H.level 2) (H.level s)))
include h1 inomit [TopologicalSpace G] [IsTopologicalGroup G] inlemma reducedSquareFiltration_zero : (reducedSquareFiltration H h0 s).level 0=⊤ := by change ((squareFiltration H h0).level 0).map _=⊤ rw [squareFiltration_zero H h0 h1,Subgroup.map_top_of_surjective _ (QuotientGroup.mk'_surjective _)]
include h1 inomit [TopologicalSpace G] [IsTopologicalGroup G] inlemma reducedSquareFiltration_one : (reducedSquareFiltration H h0 s).level 1=⊤ := by change ((squareFiltration H h0).level 1).map _=⊤ rw [squareFiltration_one H h0 h1,Subgroup.map_top_of_surjective _ (QuotientGroup.mk'_surjective _)]
include hs1 hs inomit [TopologicalSpace G] [IsTopologicalGroup G] inlemma reducedSquareFiltration_last : (reducedSquareFiltration H h0 s).level s=⊥ := by change ((squareFiltration H h0).level s).map _=⊥ rw [squareFiltration_last H h0 s hs1 hs,Subgroup.map_eq_bot_iff,QuotientGroup.ker_mk']
omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma reducedSquareFiltration_level (k : ℕ) : (reducedSquareFiltration H h0 s).level k= reducedLevel (H.level 2) (H.level s) (H.level (max 1 k)) (H.level (max 1 k+1)) := by change ((squareFiltration H h0).level k).map _=_ rw [squareFiltration_eq_pairLevel] rfl
end PairTailendend
sectionnoncomputable sectionnamespace PairTailopen RationalLattice MalcevCharacters MalcevWeightedCoordinates CubeFacesvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
omit [IsTopologicalGroup G] inlemma filtration_cutoff_monotone {n : ℕ} (c : RealCoordinates G n) (H : Filtration G) (q : ℕ → ℕ) (hqbound : ∀ k, q k ≤ n) (hq : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin n, i.val < q k → c.coord g i=0) : Monotone q := by classical intro a b hab by_contra hn have hba : q b < q a := Nat.lt_of_not_ge hn let i : Fin n := ⟨q b,lt_of_lt_of_le hba (hqbound a)⟩ have hm : axis c i 1∈H.level b := by apply (hq b _).mpr intro j hj have hji : j≠i := by intro he; subst j; exact (lt_irrefl _ hj) simp [hji] have hz := (hq a _).mp (H.antitone hab hm) i hba simp at hz
variable {t d : ℕ} (c : RealCoordinates G (t+d))variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)variable [∀ k : ℕ, (H.level k).Normal]variable (s : ℕ) (hs1 : 1 ≤ s) (hs : H.level (s+1)=⊥)variable [(diagonal (H.level 2) (H.level s)).Normal]variable (q : ℕ → ℕ) (hqbound : ∀ k, q k ≤ t+d) (hq2 : q 2=t)variable (hq : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin (t+d), i.val < q k → c.coord g i=0)
include hq hq2 inomit [IsTopologicalGroup G] [∀ levelIndex : ℕ, (H.level levelIndex).Normal] inlemma square_tail_equation (g : G) : g∈H.level 2 ↔ ∀ i : Fin (t+d), i.val < t → c.coord g i=0 := by rw [hq,hq2]
include h1 hs1 hs hqbound hq2 hq in
theorem exists_adapted_reducedCoordinates (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z) : ∃ c' : RealCoordinates (square (H.level 2) ⧸ diagonal (H.level 2) (H.level s)) (q s+d), SecondKind c' ∧ (∀ g, g∈reducedLattice (H.level 2) (H.level s) Γ ↔ ∀ i, ∃ z : ℤ, c'.coord g i=z) ∧ ∀ k : ℕ, ∃ r : ℕ, r ≤ q s+d ∧ ∀ g, g∈(reducedSquareFiltration H h0 s).level k ↔ ∀ i : Fin (q s+d), i.val < r → c'.coord g i=0 := by classical have hK := square_tail_equation c H q hq2 hq have hcent := level_last_central H h1 s hs let cR := reducedCoordinates c (H.level 2) hK (hqbound s) (H.level s) (hq s) hcent let Q:=reducedSquareFiltration H h0 s have hQ0 : Q.level 0=⊤ := reducedSquareFiltration_zero H h0 h1 s have hQ1 : Q.level 1=⊤ := reducedSquareFiltration_one H h0 h1 s have hQs : Q.level s=⊥ := reducedSquareFiltration_last H h0 s hs1 hs have hQdeg : Q.level (s+1)=⊥ := le_antisymm (by rw [← hQs] exact Q.antitone (by omega)) bot_le have hsub : ∀ k : ℕ, ∃ I : Set (Fin (q s+d)), ∀ x, x∈Q.level k ↔ ∀ i∈I, cR.coord x i=0 := by intro k by_cases hk : k < s · have hks : max 1 k ≤ s := by omega have ha : q (max 1 k) ≤ q s := filtration_cutoff_monotone c H q hqbound hq hks refine ⟨(Set.range (levelEmbedding (q s) d t (q (max 1 k)) (q (max 1 k+1))))ᶜ,?_⟩ intro x change x∈(reducedSquareFiltration H h0 s).level k ↔ _ rw [reducedSquareFiltration_level] exact reducedLevel_subspace c (H.level 2) hK (hqbound s) (H.level s) (hq s) hcent ha (H.level (max 1 k)) (H.level (max 1 k+1)) (hq (max 1 k)) (hq (max 1 k+1)) x · have hbot : Q.level k=⊥ := le_antisymm (by rw [← hQs] exact Q.antitone (by omega)) bot_le refine ⟨Set.univ,?_⟩ intro x rw [hbot,Subgroup.mem_bot] constructor · intro hx i _ rw [hx] exact cR.one_coord i · intro hx apply cR.coord.injective funext i rw [hx i (Set.mem_univ i),cR.one_coord] apply exists_adapted_secondKind_coordinates cR Q hQ0 hQ1 s hQdeg hsub exact reducedLattice_iff c (H.level 2) hK (hqbound s) (H.level s) (hq s) hcent Γ hΓ
end PairTailendend
sectionnoncomputable sectionnamespace RationalLatticeopen MalcevCharactersvariable {G K : Type*} [Group G] [Group K] [TopologicalSpace G] [TopologicalSpace K] [IsTopologicalGroup G] [IsTopologicalGroup K] {n : ℕ}variable (c : RealCoordinates K n) (e : G ≃* K) (hc : Continuous e) (hci : Continuous e.symm)
omit [IsTopologicalGroup G] [IsTopologicalGroup K] in@[simp] lemma pullCoordinates_axis (i : Fin n) (t : ℝ) : e (axis (pullCoordinates c e hc hci) i t)=axis c i t := by change e (e.symm (c.coord.symm (Pi.single i t)))=c.coord.symm (Pi.single i t) exact e.apply_symm_apply _
omit [IsTopologicalGroup G] [IsTopologicalGroup K] inlemma pullCoordinates_secondKind (hsk : SecondKind c) : SecondKind (pullCoordinates c e hc hci) where axis_add i s t := by apply e.injective simp only [map_mul,pullCoordinates_axis,hsk.axis_add] ordered g := by apply e.injective rw [map_list_prod,List.map_ofFn] simp only [Function.comp_def,pullCoordinates_axis] exact hsk.ordered (e g)end RationalLattice
namespace LeibmanSquareopen CubeFaces RationalLattice MalcevCharacters PairTailvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)variable [∀ i, (H.level i).Normal]variable (s : ℕ) (hs0 : 1 ≤ s) (hs : H.level (s+1)=⊥)variable [((restricted H h0).level s).Normal]variable [(PairTail.diagonal (H.level 2) (H.level s)).Normal]variable {t d : ℕ} (c : RealCoordinates G (t+d))variable (q : ℕ → ℕ) (hqbound : ∀ k, q k ≤ t+d) (hq2 : q 2=t)variable (hq : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin (t+d), i.val < q k → c.coord g i=0)
include h1 hs0 hs hqbound hq2 hq in
theorem exists_adapted_sourceReducedCoordinates (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z) : ∃ c' : RealCoordinates ((level H h0 1) ⧸ (restricted H h0).level s) (q s+d), SecondKind c' ∧ (∀ g, g∈((Γ.prod Γ).comap (level H h0 1).subtype).map (QuotientGroup.mk' ((restricted H h0).level s)) ↔ ∀ i, ∃ z : ℤ, c'.coord g i=z) ∧ ∀ k : ℕ, ∃ r : ℕ, r ≤ q s+d ∧ ∀ g, g∈(mapFiltration (restricted H h0) (QuotientGroup.mk' ((restricted H h0).level s))).level k ↔ ∀ i : Fin (q s+d), i.val < r → c'.coord g i=0 := by obtain ⟨cR,hsk,hRL,hRF⟩ := exists_adapted_reducedCoordinates c H h0 h1 s hs0 hs q hqbound hq2 hq Γ hΓ let e:=reducedPairEquiv H h0 h1 s hs0 hs have hc : Continuous e := reducedPairEquiv_continuous H h0 h1 s hs0 hs have hci : Continuous e.symm := reducedPairEquiv_symm_continuous H h0 h1 s hs0 hs refine ⟨pullCoordinates cR e hc hci,pullCoordinates_secondKind cR e hc hci hsk,?_,?_⟩ · intro g change g∈_ ↔ ∀ i, ∃ z : ℤ, cR.coord (e g) i=z rw [← hRL,← reducedLattice_map H h0 h1 s hs0 hs Γ] simp only [Subgroup.mem_map_equiv,e,MulEquiv.symm_apply_apply] · intro k obtain ⟨r,hr,hrg⟩ := hRF k refine ⟨r,hr,fun g => ?_⟩ change g∈((restricted H h0).level k).map _ ↔ ∀ i : Fin (q s+d), i.val < r → cR.coord (e g) i=0 rw [← hrg,PairTail.reducedSquareFiltration_level,← reducedLevel_map H h0 h1 s hs0 hs k] simp only [Subgroup.mem_map_equiv,e,MulEquiv.symm_apply_apply]
end LeibmanSquare
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.CompactFamily01import OAI.Combinatorics.SumProduct.Alignment.CoordinateSubspace01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionopen scoped commutatorElement Pointwisenamespace SquareInductionopen MeasureTheoryopen scoped BigOperatorsnoncomputable sectionsection Probabilityvariable {X : Type*} [TopologicalSpace X] [CompactSpace X] [MeasurableSpace X] [BorelSpace X] (μ : Measure X) [IsProbabilityMeasure μ]
def discrepancy (N : ℕ) (x : ℕ → X) : C(X, ℂ) →ₗ[ℂ] ℂ where toFun f := (𝔼 n ∈ Finset.range N, f (x n)) - ∫ t, f t ∂μ map_add' f g := by change (𝔼 n ∈ Finset.range N, (f (x n) + g (x n))) - ∫ t, f t + g t ∂μ = _ rw [Finset.expect_add_distrib, integral_add (f.continuous.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace f)) (g.continuous.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace g))] ring map_smul' z f := by change (𝔼 n ∈ Finset.range N, z • f (x n)) - ∫ t, z • f t ∂μ = _ rw [← Finset.smul_expect, integral_smul] simp only [RingHom.id_apply, smul_sub]
theorem discrepancy_bound (N : ℕ) (hN : 0 < N) (x : ℕ → X) (f : C(X, ℂ)) : ‖discrepancy μ N x f‖ ≤ 2 * ‖f‖ := by have hm : ‖𝔼 n ∈ Finset.range N, f (x n)‖ ≤ ‖f‖ := (RCLike.norm_expect_le (K := ℂ)).trans (Finset.expect_le (Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hN)) (fun n _ => f.norm_coe_le_norm _)) have hi : ‖∫ t, f t ∂μ‖ ≤ ‖f‖ := by simpa only [probReal_univ, mul_one] using norm_integral_le_of_norm_le_const (μ := μ) (Filter.Eventually.of_forall (f.norm_coe_le_norm)) exact (norm_sub_le _ _).trans (by linarith only [hm, hi])
theorem discrepancy_const (N : ℕ) (hN : 0 < N) (x : ℕ → X) (z : ℂ) : discrepancy μ N x (ContinuousMap.const _ z) = 0 := by simp only [discrepancy, LinearMap.coe_mk, AddHom.coe_mk, ContinuousMap.const_apply, Finset.expect_const (Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hN)), integral_const, probReal_univ, one_smul, sub_self]end Probabilityendend SquareInduction
namespace SquareInductionopen CubeFaces LeibmanSquare PolynomialWeyl UniformSquareObservableopen CompactFamilyDescent MeasureTheory Topologyopen scoped BigOperators ComplexConjugatenoncomputable sectionvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
theorem uniform_dense_square_descent_tracked (H : Filtration G) (h0 : H.level 0 = ⊤) (h1 : H.level 1 = ⊤) (Γ : Subgroup G) (s : ℕ) (hs2 : 2 ≤ s) (hs : H.level (s+1) = ⊥) [TopologicalSpace.MetrizableSpace (ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs)] [CompactSpace (ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs)] (F : C(G ⧸ Γ,ℂ)) (hF : ∀ x, ‖F x‖ ≤ 1) (χ : G → ℂ) (hχ : ∀ n ∈ H.level s, ‖χ n‖ = 1) (hw : ∀ n ∈ H.level s, ∀ x : G, F (QuotientGroup.mk (x*n)) = χ n * F (QuotientGroup.mk x)) (z : G) (hz : z ∈ H.level s) (hχz : χ z ≠ 1) (C : Set G) (hCc : IsCompact C) (hC : ∀ g : G, ∃ c ∈ C, c⁻¹*g ∈ Γ) (δ : ℝ) (hδ : 0 < δ) : let R := restricted H h0 letI := last_normal H h0 (by omega : 1 ≤ s) hs let π := QuotientGroup.mk' (R.level s) let Q := mapFiltration R π let X := ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs letI := TopologicalSpace.metrizableSpaceMetric X letI : MeasurableSpace X := borel X ∃ tests : Finset {Ψ : C(X,ℂ) // Ψ ∈ lipschitzMaps (Y := X)}, ∃ η : ℝ, 0 < η ∧ ∀ μ : Measure X, IsProbabilityMeasure μ → SMulInvariantMeasure ((level H h0 1) ⧸ R.level s) X μ → ∀ (f : ℤ → G), Polynomial H 0 f → ∀ N T : ℕ, 0 < N → 0 < T → δ ≤ ‖mean N (fun n => F (QuotientGroup.mk (f n)))‖ → 4 * (T : ℝ) / N ≤ δ^2/2 → ∃ b ∈ Finset.range T, ∃ A : Finset ℕ, (∀ a ∈ A, a < T) ∧ δ^2/4*T ≤ (A.card : ℝ) ∧ ∀ a ∈ A, ∃ Ψ ∈ tests, ∃ p : ℤ → (level H h0 1) ⧸ R.level s, ∃ u ∈ C, ∃ v ∈ C, ∃ γ ∈ Γ, ∃ ε ∈ Γ, f a = u*γ ∧ f b = v*ε ∧ (∀ n : ℤ, ∃ x : level H h0 1, p n = π x ∧ x.val = (u⁻¹*f (n+a)*γ⁻¹, v⁻¹*f (n+b)*ε⁻¹)) ∧ Polynomial Q 0 p ∧ (∀ ts : List ℤ, s ≤ ts.length → ∀ n, iterDiff ts p n = 1) ∧ η ≤ ‖mean N (fun n => Ψ.val (QuotientGroup.mk (p n))) - ∫ x, Ψ.val x ∂μ‖ := by classical let R := restricted H h0 let := last_normal H h0 (by omega : 1 ≤ s) hs let π := QuotientGroup.mk' (R.level s) let X := ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs let := TopologicalSpace.metrizableSpaceMetric X let : MeasurableSpace X := borel X let : BorelSpace X := ⟨rfl⟩ obtain ⟨tests,η,hη,htests⟩ := finite_square_tests H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs F χ hχ hw C hCc (δ^2/4) 2 (by positivity) (by norm_num) refine ⟨tests,η,hη,?_⟩ intro μ hprob hinv f hf N T hN hT hlarge hboundary let := hprob obtain ⟨b,hb,A,hAT,hAc,hAd⟩ := dense_reduced_square_orbits_tracked H h0 h1 Γ F hF s hs2 hs χ hχ hw C hC f hf N T hN hT δ hδ hlarge hboundary refine ⟨b,hb,A,hAT,hAc,?_⟩ intro a ha obtain ⟨u,hu,v,hv,Φ,p,γ,hγ,ε,hε,hfa,hfb,hlift,hΦbound,hΦ,hp,hptop,heval,hcorr⟩ := hAd a ha have heq : Φ = observable H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs F χ hχ hw (u,v) := by ext x induction x using Quotient.inductionOn with | h y => induction y using Quotient.inductionOn with | h w => exact hΦ w have hzero : (∫ x, Φ x ∂μ) = 0 := reduced_observable_mean_zero H h0 h1 Γ F u v s hs2 hs χ hw z hz hχz μ hinv Φ hΦ let L : C(X,ℂ) →ₗ[ℂ] ℂ := discrepancy μ N (fun n => QuotientGroup.mk (p n)) have hL : ∀ Ψ, ‖L Ψ‖ ≤ 2 * ‖Ψ‖ := discrepancy_bound μ N hN _ have hcorr' : δ^2/4 ≤ ‖L (observable H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs F χ hχ hw (u,v))‖ := by rw [← heq] change δ^2/4 ≤ ‖mean N (fun n => Φ (QuotientGroup.mk (p n))) - ∫ x, Φ x ∂μ‖ simpa only [hzero,sub_zero] using hcorr obtain ⟨Ψ,hΨ,hΨcorr⟩ := htests L hL ⟨u,hu,v,hv,hcorr'⟩ exact ⟨Ψ,hΨ,p,u,hu,v,hv,γ,hγ,ε,hε,hfa,hfb,hlift,hp,hptop,hΨcorr⟩
endend SquareInduction
end
sectionnoncomputable sectionopen scoped BigOperators ComplexConjugatenamespace SquareDifferencesopen PolynomialWeyl
lemma norm_mean_derivative_swap (N a b : ℕ) (f : ℕ → ℂ) : ‖mean N (derivative a b f)‖=‖mean N (derivative b a f)‖ := by have he : mean N (derivative a b f)=conj (mean N (derivative b a f)) := by simp only [mean,derivative,map_expect (starRingEnd ℂ),map_mul,starRingEnd_self_apply] apply Finset.expect_congr rfl intro n _ ring rw [he,RCLike.norm_conj]
lemma derivative_shift_error {N : ℕ} (hN : 0<N) (a b : ℕ) (hab : b≤a) (f : ℕ → ℂ) (hf : ∀ n, ‖f n‖≤1) : ‖mean N (derivative a b f)‖ ≤ ‖mean N (derivative (a-b) 0 f)‖+2*(b:ℝ)/N := by have he : derivative a b f = fun n => derivative (a-b) 0 f (n+b) := by funext n simp only [derivative,Nat.add_zero] congr 2 omega have ht := norm_mean_shift_sub_le hN b (derivative (a-b) 0 f) (norm_derivative_le_one (a-b) 0 f hf) rw [←he] at ht have hn := norm_sub_norm_le (mean N (derivative a b f)) (mean N (derivative (a-b) 0 f)) linarith
lemma nat_dist_image_card (S : Finset ℕ) (b : ℕ) : S.card ≤ 2*(S.image (fun a => Nat.dist a b)).card := by classical let A := S.image (fun a => Nat.dist a b) have hc := Finset.card_le_card_of_injOn (s:=S) (t:=A.product (Finset.univ : Finset Bool)) (fun a => (Nat.dist a b,decide (b≤a))) (by intro a ha exact Finset.mem_product.mpr ⟨Finset.mem_image.mpr ⟨a,ha,rfl⟩,Finset.mem_univ _⟩) (by intro a ha c hc he have h1 := congrArg Prod.fst he have h2 := congrArg Prod.snd he have h3 : (b≤a) ↔ b≤c := by simpa only [Prod.snd,decide_eq_decide] using h2 simp only [Nat.dist] at h1 omega) simpa only [Finset.product_eq_sprod,Finset.card_product,Finset.card_univ,Fintype.card_bool,Nat.mul_comm,A] using hc
theorem exists_dense_one_sided {N T : ℕ} (hN : 0<N) (hT : 0<T) (f : ℕ → ℂ) (hf : ∀ n, ‖f n‖≤1) (δ : ℝ) (hδ : 0<δ) (hlarge : δ≤‖mean N f‖) (hboundary : 4*(T:ℝ)/N≤δ^2/4) : ∃ A : Finset ℕ, (∀ h∈A, h<T) ∧ δ^2/8*T≤(A.card:ℝ) ∧ ∀ h∈A, δ^2/8≤‖mean N (derivative h 0 f)‖ := by classical obtain ⟨b,hb,S,hST,hSc,hcorr⟩ := exists_dense_derivatives hN hT f hf δ hδ hlarge (by nlinarith [sq_nonneg δ]) have hbT := Finset.mem_range.mp hb refine ⟨S.image (fun a => Nat.dist a b),?_,?_,?_⟩ · intro h hh obtain ⟨a,ha,rfl⟩ := Finset.mem_image.mp hh have haT := hST a ha simp only [Nat.dist] omega · have hc := nat_dist_image_card S b have hc' : (S.card:ℝ)≤2*((S.image (fun a => Nat.dist a b)).card:ℝ) := by exact_mod_cast hc linarith · intro h hh obtain ⟨a,ha,rfl⟩ := Finset.mem_image.mp hh have hsmall : ∀ k : ℕ, k<T → 2*(k:ℝ)/N≤δ^2/8 := by intro k hk have hk' : (k:ℝ)≤T := by exact_mod_cast hk.le have he : 2*(k:ℝ)/N≤2*(T:ℝ)/N := div_le_div_of_nonneg_right (by linarith) (Nat.cast_nonneg N) apply he.trans calc 2*(T:ℝ)/N=(4*(T:ℝ)/N)/2 := by ring _ ≤ (δ^2/4)/2 := div_le_div_of_nonneg_right hboundary (by norm_num) _ = δ^2/8 := by ring have hc := hcorr a ha by_cases hab : b≤a · rw [Nat.dist_eq_sub_of_le_right hab] have he := derivative_shift_error hN a b hab f hf have hs := hsmall b hbT linarith · have hab' : a≤b := le_of_not_ge hab rw [Nat.dist_eq_sub_of_le hab'] rw [norm_mean_derivative_swap N a b f] at hc have he := derivative_shift_error hN b a hab' f hf have hs := hsmall a (hST a ha) linarith
end SquareDifferencesendend
sectionopen scoped commutatorElementnoncomputable sectionnamespace PairTailvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable (K : Subgroup G) [K.Normal]
def diagonalEmbedding : G →* square K where toFun g := pair K g 1 map_one' := by apply Subtype.ext; ext <;> simp [pair] map_mul' g h := by apply Subtype.ext; ext <;> simp [pair]def lowerEmbedding : K →* square K where toFun u := pair K 1 u map_one' := by apply Subtype.ext; ext <;> simp [pair] map_mul' g h := by apply Subtype.ext; ext <;> simp [pair]lemma diagonalEmbedding_continuous : Continuous (diagonalEmbedding K) := (pair_continuous K).comp (continuous_id.prodMk continuous_const)lemma lowerEmbedding_continuous : Continuous (lowerEmbedding K) := (pair_continuous K).comp (continuous_const.prodMk continuous_id)omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma pair_decompose [TopologicalSpace G] [IsTopologicalGroup G] (g : G) (u : K) : pair K g u = diagonalEmbedding K g * lowerEmbedding K u := by apply Subtype.ext ext <;> simp [pair,diagonalEmbedding,lowerEmbedding]
variable (η : square K →* Multiplicative ℝ)def baseCharacter : G →* Multiplicative ℝ := η.comp (diagonalEmbedding K)def lowerCharacter : K →* Multiplicative ℝ := η.comp (lowerEmbedding K)lemma baseCharacter_continuous (hη : Continuous η) : Continuous (baseCharacter K η) := hη.comp (diagonalEmbedding_continuous K)lemma lowerCharacter_continuous (hη : Continuous η) : Continuous (lowerCharacter K η) := hη.comp (lowerEmbedding_continuous K)
lemma character_split (x : square K) : Multiplicative.toAdd (η x) = Multiplicative.toAdd (baseCharacter K η x.val.1) + Multiplicative.toAdd (lowerCharacter K η (difference K x)) := by conv_lhs => rw [← pair_first_difference K x,pair_decompose,map_mul] rfl
lemma character_nonzero (hη : η ≠ 1) : baseCharacter K η ≠ 1 ∨ lowerCharacter K η ≠ 1 := by by_contra h push Not at h apply hη ext x apply Multiplicative.toAdd.injective rw [character_split,h.1,h.2] simp
omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma lowerCharacter_conj [TopologicalSpace G] [IsTopologicalGroup G] (g : G) (u : K) : lowerCharacter K η ⟨g*u*g⁻¹,(inferInstance : K.Normal).conj_mem _ u.property g⟩ = lowerCharacter K η u := by have he : lowerEmbedding K ⟨g*u*g⁻¹,(inferInstance : K.Normal).conj_mem _ u.property g⟩ = diagonalEmbedding K g * lowerEmbedding K u * (diagonalEmbedding K g)⁻¹ := by apply Subtype.ext ext <;> simp [pair,diagonalEmbedding,lowerEmbedding,mul_assoc] change η _ = η _ rw [he,map_mul,map_mul,map_inv] simp [mul_assoc]
omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma lower_commutator_mem [TopologicalSpace G] [IsTopologicalGroup G] (g : G) (u : K) : ⁅g,u.val⁆ ∈ K := K.mul_mem ((inferInstance : K.Normal).conj_mem _ u.property g) (K.inv_mem u.property)
lemma lowerCharacter_commutator (g : G) (u : K) : lowerCharacter K η ⟨⁅g,u.val⁆,lower_commutator_mem K g u⟩ = 1 := by let v : K := ⟨g*u*g⁻¹,(inferInstance : K.Normal).conj_mem _ u.property g⟩ have he : (⟨⁅g,u.val⁆,lower_commutator_mem K g u⟩ : K) = v*u⁻¹ := by apply Subtype.ext rfl rw [he,map_mul,map_inv,lowerCharacter_conj] exact mul_inv_cancel _
variable (Γ : Subgroup G)omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma baseCharacter_integral [TopologicalSpace G] [IsTopologicalGroup G] (hη : ∀ x ∈ squareLattice K Γ, ∃ z : ℤ, Multiplicative.toAdd (η x) = z) : ∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (baseCharacter K η g) = z := by intro g hg apply hη (diagonalEmbedding K g) simpa [diagonalEmbedding,pair] using And.intro hg hgomit [TopologicalSpace G] [IsTopologicalGroup G] inlemma lowerCharacter_integral [TopologicalSpace G] [IsTopologicalGroup G] (hη : ∀ x ∈ squareLattice K Γ, ∃ z : ℤ, Multiplicative.toAdd (η x) = z) : ∀ u : K, u.val ∈ Γ → ∃ z : ℤ, Multiplicative.toAdd (lowerCharacter K η u) = z := by intro u hu apply hη (lowerEmbedding K u) simpa [lowerEmbedding,pair] using And.intro Γ.one_mem hu
end PairTail
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.LeibmanSquare02import OAI.Combinatorics.SumProduct.Alignment.LeibmanSquare03import OAI.Combinatorics.SumProduct.Alignment.PairTail05import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionopen scoped commutatorElementnoncomputable sectionendend
sectionopen scoped commutatorElement BigOperatorsnoncomputable sectionnamespace PairTailopen RationalLattice MalcevCharactersvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable (K : Subgroup G) [K.Normal]variable (η : square K →* Multiplicative ℝ)variable (hcomm : ∀ a b : G, ⁅a,b⁆ ∈ K)
def bracket (a b : G) : K := ⟨⁅a,b⁆,hcomm a b⟩
def bracketCharacter (a : G) : G →* Multiplicative ℝ where toFun b := lowerCharacter K η (bracket K hcomm a b) map_one' := by have he : bracket K hcomm a 1 = 1 := by apply Subtype.ext; simp [bracket] rw [he,map_one] map_mul' b c := by have he : bracket K hcomm a (b*c) = bracket K hcomm a b * ⟨b*(bracket K hcomm a c).val*b⁻¹, (inferInstance : K.Normal).conj_mem _ (bracket K hcomm a c).property b⟩ := by apply Subtype.ext change ⁅a,b*c⁆ = ⁅a,b⁆ * (b*⁅a,c⁆*b⁻¹) rw [commutatorElement_mul_right_eq_mul_conj] group rw [he,map_mul,lowerCharacter_conj]
lemma bracketCharacter_continuous (hη : Continuous η) (a : G) : Continuous (bracketCharacter K η hcomm a) := by apply (lowerCharacter_continuous K η hη).comp apply Continuous.subtype_mk exact ((continuous_const.mul continuous_id).mul continuous_const).mul continuous_inv
omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma bracket_skew (a b : G) : lowerCharacter K η (bracket K hcomm b a) = (lowerCharacter K η (bracket K hcomm a b))⁻¹ := by have he : bracket K hcomm b a = (bracket K hcomm a b)⁻¹ := by apply Subtype.ext exact (commutatorElement_inv a b).symm rw [he,map_inv]
def leftBracketCharacter (b : G) : G →* Multiplicative ℝ := (bracketCharacter K η hcomm b)⁻¹lemma leftBracketCharacter_apply (a b : G) : leftBracketCharacter K η hcomm b a = lowerCharacter K η (bracket K hcomm a b) := (bracket_skew K η hcomm b a).symmlemma leftBracketCharacter_continuous (hη : Continuous η) (b : G) : Continuous (leftBracketCharacter K η hcomm b) := (bracketCharacter_continuous K η hcomm hη b).inv
variable {n : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c)
def bracketMatrix (i j : Fin n) : ℝ := Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm (axis c i 1) (axis c j 1)))
include hsk in
lemma bracket_coordinates (hη : Continuous η) (a b : G) : Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a b)) = ∑ i, ∑ j, c.coord a i * c.coord b j * bracketMatrix K η hcomm c i j := by have hright := character_coordinates c hsk (bracketCharacter K η hcomm a) (bracketCharacter_continuous K η hcomm hη a) b change Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a b)) = _ at hright rw [hright] have hleft (j : Fin n) : Multiplicative.toAdd (bracketCharacter K η hcomm a (axis c j 1)) = ∑ i, c.coord a i * bracketMatrix K η hcomm c i j := by have he := character_coordinates c hsk (leftBracketCharacter K η hcomm (axis c j 1)) (leftBracketCharacter_continuous K η hcomm hη (axis c j 1)) a simpa only [leftBracketCharacter_apply,bracketMatrix,bracketCharacter,MonoidHom.coe_mk,OneHom.coe_mk] using he simp_rw [hleft,Finset.mul_sum] rw [Finset.sum_comm] apply Finset.sum_congr rfl intro i _ apply Finset.sum_congr rfl intro j _ ring
omit [IsTopologicalGroup G] inlemma bracketMatrix_skew (i j : Fin n) : bracketMatrix K η hcomm c j i = - bracketMatrix K η hcomm c i j := by unfold bracketMatrix rw [bracket_skew] rflomit [IsTopologicalGroup G] inlemma bracketMatrix_diagonal (i : Fin n) : bracketMatrix K η hcomm c i i = 0 := by have he := bracketMatrix_skew K η hcomm c i i linarith
variable (Γ : Subgroup G)include hsk in
theorem integer_commutator_matrix (hη : Continuous η) (hletters : ∀ i : Fin n, axis c i 1 ∈ Γ) (hz : ∀ x ∈ squareLattice K Γ, ∃ z : ℤ, Multiplicative.toAdd (η x) = z) : ∃ M : Fin n → Fin n → ℤ, (∀ i j, (M i j : ℝ) = bracketMatrix K η hcomm c i j) ∧ (∀ a b : G, Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a b)) = ∑ i, ∑ j, c.coord a i * c.coord b j * (M i j : ℝ)) ∧ (∀ i j, M j i = -M i j) ∧ (∀ i, M i i = 0) := by have hi (i j : Fin n) : ∃ z : ℤ, bracketMatrix K η hcomm c i j = z := by apply lowerCharacter_integral K η Γ hz (bracket K hcomm (axis c i 1) (axis c j 1)) exact Γ.mul_mem (Γ.mul_mem (Γ.mul_mem (hletters i) (hletters j)) (Γ.inv_mem (hletters i))) (Γ.inv_mem (hletters j)) choose M hM using hi refine ⟨M,fun i j => (hM i j).symm,?_,?_,?_⟩ · intro a b simpa only [hM] using bracket_coordinates K η hcomm c hsk hη a b · intro i j have he := bracketMatrix_skew K η hcomm c i j rw [hM,hM] at he exact_mod_cast he · intro i have he := bracketMatrix_diagonal K η hcomm c i rw [hM] at he exact_mod_cast he
end PairTailendend
sectionnoncomputable sectionopen scoped commutatorElementnamespace PairTailvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable (K : Subgroup G) [K.Normal]variable (η : square K →* Multiplicative ℝ)variable (hcomm : ∀ a b : G, ⁅a,b⁆ ∈ K)
def insideConj (a : G) (u : K) : K := ⟨a*u*a⁻¹,(inferInstance : K.Normal).conj_mem _ u.property a⟩
lemma lower_insideConj (a : G) (u : K) : lowerCharacter K η (insideConj K a u) = lowerCharacter K η u := lowerCharacter_conj K η a u
lemma bracket_inv_inv (a b : G) : lowerCharacter K η (bracket K hcomm a⁻¹ b⁻¹) = lowerCharacter K η (bracket K hcomm a b) := by change bracketCharacter K η hcomm a⁻¹ b⁻¹ = _ rw [map_inv] change (lowerCharacter K η (bracket K hcomm a⁻¹ b))⁻¹ = _ rw [← leftBracketCharacter_apply, map_inv, leftBracketCharacter_apply, inv_inv]
def normalizedTail (u w : K) (a v : G) : K := insideConj K a⁻¹ u⁻¹ * insideConj K (a⁻¹*v⁻¹) w * bracket K hcomm a⁻¹ v⁻¹
omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma normalizedTail_val (u w : K) (a v : G) : (normalizedTail K hcomm u w a v).val = (u.val*a)⁻¹*(v⁻¹*w.val*a*v) := by change (a⁻¹*u.val⁻¹*(a⁻¹)⁻¹)*((a⁻¹*v⁻¹)*w.val*(a⁻¹*v⁻¹)⁻¹)* ⁅a⁻¹,v⁻¹⁆ = _ simp only [commutatorElement_def] group
lemma lower_normalizedTail (u w : K) (a v : G) : lowerCharacter K η (normalizedTail K hcomm u w a v) = (lowerCharacter K η u)⁻¹ * lowerCharacter K η w * lowerCharacter K η (bracket K hcomm a v) := by rw [normalizedTail,map_mul,map_mul,lower_insideConj,lower_insideConj,map_inv, bracket_inv_inv]
def normalizedPair (u w : K) (a v : G) : square K := pair K (u.val*a) (normalizedTail K hcomm u w a v)
omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma normalizedPair_val (u w : K) (a v : G) : (normalizedPair K hcomm u w a v).val = (u.val*a,v⁻¹*w.val*a*v) := by ext · rfl · change (u.val*a)*(normalizedTail K hcomm u w a v).val = _ rw [normalizedTail_val,mul_inv_cancel_left]
lemma normalizedPair_character (u w : K) (a v : G) : Multiplicative.toAdd (η (normalizedPair K hcomm u w a v)) = Multiplicative.toAdd (baseCharacter K η (u.val*a)) + Multiplicative.toAdd (lowerCharacter K η w) - Multiplicative.toAdd (lowerCharacter K η u) + Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a v)) := by rw [character_split] change Multiplicative.toAdd (baseCharacter K η (u.val*a)) + Multiplicative.toAdd (lowerCharacter K η (difference K (pair K (u.val*a) (normalizedTail K hcomm u w a v)))) = _ rw [difference_pair,lower_normalizedTail] simp only [toAdd_mul,toAdd_inv] ring
lemma bracket_zpow (a v : G) (n : ℤ) : Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm (a^n) v)) = (n:ℝ)*Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a v)) := by rw [← leftBracketCharacter_apply,map_zpow,leftBracketCharacter_apply] simp only [toAdd_zpow,zsmul_eq_mul]
theorem square_orbit_identity (a v : G) (u : ℤ → K) (h n : ℤ) : Multiplicative.toAdd (η (normalizedPair K hcomm (u n) (u (n+h)) (a^n) v)) = Multiplicative.toAdd (baseCharacter K η ((u n).val*a^n)) + (Multiplicative.toAdd (lowerCharacter K η (u (n+h))) - Multiplicative.toAdd (lowerCharacter K η (u n))) + (n:ℝ)*Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a v)) := by rw [normalizedPair_character,bracket_zpow] ring
end PairTailendend
sectionnoncomputable sectionopen scoped commutatorElement ComplexConjugatenamespace LeibmanSquareopen CubeFaces CubePolynomialsvariable {G : Type*} [Group G]variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
include h0 in
lemma linear_remainder_mem {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (n : ℤ) : f n*(f 1^n)⁻¹∈H.level 2 := by let := level_normal H h0 2 let π:=QuotientGroup.mk' (H.level 2) have hadd (a b : ℤ) : π (f (a+b))=π (f a)*π (f b) := by have hm := hf [b,a] 0 have hz : π (iterDiff [b,a] f 0)=1 := (QuotientGroup.eq_one_iff _).mpr hm simp only [iterDiff,diff,zero_add,hf0,inv_one,one_mul,map_mul,map_inv] at hz have he := congrArg (fun x => π (f a)*π (f b)*x) hz convert he using 1 <;> group let φ : Multiplicative ℤ →* G ⧸ H.level 2 := { toFun z := π (f z.toAdd) map_one' := by change π (f 0)=1; rw [hf0,map_one] map_mul' a b := hadd a.toAdd b.toAdd } have he : (Multiplicative.ofAdd (1:ℤ))^n=Multiplicative.ofAdd n := by apply Multiplicative.toAdd.injective simp have hn : π (f n)=π (f 1)^n := by simpa [φ] using map_zpow φ (Multiplicative.ofAdd (1:ℤ)) n apply (QuotientGroup.eq_one_iff _).mp change π (f n*(f 1^n)⁻¹)=1 rw [map_mul,map_inv,map_zpow,hn,mul_inv_cancel]
def linearRemainder {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (n : ℤ) : H.level 2 := ⟨f n*(f 1^n)⁻¹,linear_remainder_mem H h0 hf hf0 n⟩
lemma linearRemainder_mul {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (n : ℤ) : f n=(linearRemainder H h0 hf hf0 n).val*f 1^n := by simp [linearRemainder,mul_assoc]
def tailSquare (u : H.level 2) : level H h0 1 := ⟨(1,u.val),by refine ⟨(H.level 1).one_mem,?_,?_⟩ · rw [h1]; trivial · simp⟩
def linearNormalizedPair {f : ℤ → G} (hf : Polynomial H 0 f) (u : H.level 2) (h : ℤ) (v : G) : ℤ → level H h0 1 := fun n => restrictedConj H h0 h1 1 v⁻¹ (restrictedConj H h0 h1 1 (f h) (normalizedPair H h0 hf h n) * tailSquare H h0 h1 u)
lemma linearNormalizedPair_polynomial {f : ℤ → G} (hf : Polynomial H 0 f) (u : H.level 2) (h : ℤ) (v : G) : Polynomial (restricted H h0) 0 (linearNormalizedPair H h0 h1 hf u h v) := by apply polynomial_filtered_map _ _ _ (restrictedConj_filtered H h0 h1 1 v⁻¹) apply polynomial_of_cube_mem exact (polynomials (restricted H h0) 0).mul_mem (cube_mem_of_polynomial _ (normalized_conjugate_polynomial H h0 h1 hf h 1 (f h))) (const_mem (by rw [restricted_zero]; trivial))
lemma linearNormalizedPair_val {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (a : G) (u : H.level 2) (h : ℤ) (v : G) (huh : f h=u.val*a^h) (n : ℤ) : (linearNormalizedPair H h0 h1 hf u h v n).val = (f n,v⁻¹*f (n+h)*(a^h)⁻¹*v) := by change (1*(1*((f 0)⁻¹*f n)*1⁻¹*1)*1⁻¹, v⁻¹*((f h*((f h)⁻¹*f (n+h))*(f h)⁻¹)*u.val)*(v⁻¹)⁻¹)=_ simp only [hf0,inv_one,one_mul,mul_one,inv_inv,huh,mul_inv_rev] congr 1 group
lemma linearNormalizedPair_reduced {f : ℤ → G} (hf : Polynomial H 0 f) (u : H.level 2) (h : ℤ) (v : G) {s : ℕ} (hs0 : 1 ≤ s) (hs : H.level (s+1) = ⊥) : letI := last_normal H h0 hs0 hs let π:=QuotientGroup.mk' ((restricted H h0).level s) let Q:=mapFiltration (restricted H h0) π let p:=fun n => π (linearNormalizedPair H h0 h1 hf u h v n) Polynomial Q 0 p ∧ ∀ ts : List ℤ, s≤ts.length → ∀ n, iterDiff ts p n=1 := by dsimp only let := last_normal H h0 hs0 hs have hp:=polynomial_map _ (QuotientGroup.mk' ((restricted H h0).level s)) (linearNormalizedPair_polynomial H h0 h1 hf u h v) refine ⟨hp,?_⟩ intro ts hts n have hm := (mapFiltration (restricted H h0) (QuotientGroup.mk' ((restricted H h0).level s))).antitone (by omega : s≤0+ts.length) (hp ts n) simpa only [(quotient_lowers_degree H h0 hs0 hs).2.2,Subgroup.mem_bot] using hm
variable [TopologicalSpace G] [IsTopologicalGroup G]
omit [IsTopologicalGroup G] inlemma balanced_linearNormalizedPair (Γ : Subgroup G) (F : C(G ⧸ Γ,ℂ)) {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (a : G) (u : H.level 2) (h : ℤ) (v γ : G) (hγ : γ∈Γ) (hav : a^h=v*γ) (huh : f h=u.val*a^h) (n : ℤ) : balanced H h0 Γ F 1 v (linearNormalizedPair H h0 h1 hf u h v n)= F (QuotientGroup.mk (f n))*conj (F (QuotientGroup.mk (f (n+h)))) := by unfold balanced rw [linearNormalizedPair_val H h0 h1 hf hf0 a u h v huh n] simp only [one_mul] have he : v*(v⁻¹*f (n+h)*(a^h)⁻¹*v)=f (n+h)*γ⁻¹ := by rw [hav]; group rw [he,QuotientGroup.mk_mul_of_mem _ (Γ.inv_mem hγ)]
variable [∀ i, (H.level i).Normal]
omit [TopologicalSpace G] [IsTopologicalGroup G] inlemma linearNormalizedPair_eq_pairTail {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (a : G) (u : ℤ → H.level 2) (hu : ∀ n, f n=(u n).val*a^n) (hcomm : ∀ a b : G, ⁅a,b⁆∈H.level 2) (h n : ℤ) (v : G) : firstPairEquiv H h0 h1 (linearNormalizedPair H h0 h1 hf (u h) h v n)= PairTail.normalizedPair (H.level 2) hcomm (u n) (u (n+h)) (a^n) v := by apply Subtype.ext rw [firstPairEquiv_val,linearNormalizedPair_val H h0 h1 hf hf0 a (u h) h v (hu h) n, PairTail.normalizedPair_val,hu n,hu (n+h),zpow_add] congr 1 group
end LeibmanSquare
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.AllLevel04import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionnoncomputable sectionopen scoped BigOperators Topology commutatorElementopen Filterend end
section
noncomputable sectionopen scoped BigOperators Topology commutatorElementopen Filteropen Topologyuniverse unamespace AllLevelStatesopen RationalLattice CubeFaces CubePolynomials NilpotentTaylor AllLevelFactorizationopen AllLevelDomains AllLevelRemovals CubeHorizontalIrrationalityvariable {G : Type u} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n : ℕ} {c : RealCoordinates G n} {Γ : Subgroup G} {s : ℕ}variable {K : Filtration G} {P : ℕ → ℤ → G} {L : ℕ → ℝ}namespace State
theorem descend_of_not_irrational (S : State c Γ s K P L) (hL : ∀ N,0<L N) (hbad : ¬ S.Irrational) : ∃ T : State c Γ s K P L,T.domain.rank<S.domain.rank := by classical unfold Irrational at hbad push Not at hbad obtain ⟨j,hj,hjs,χ,hne,hcont,hrat,hnext,hbr,hbad⟩:=hbad obtain ⟨d,hd,hz⟩:=hrat let χ':=scaleCharacter (d:ℝ) χ have hne' : χ'≠1:=scaleCharacter_ne (by exact_mod_cast (Nat.ne_of_gt hd)) hne have hcont' : Continuous χ':= continuous_ofAdd.comp (continuous_const.mul (continuous_toAdd.comp hcont)) have hnext' (x : S.domain.filtration.level j) (hx : x.val∈S.domain.filtration.level (j+1)) : χ' x=1 := by change Multiplicative.ofAdd ((d:ℝ)*(χ x).toAdd)=1 rw [hnext x hx] simp have hbr' (a b : ℕ) (ha : 0<a) (hb : 0<b) (hab : a+b=j) (x : S.domain.Carrier) (hx : x∈S.domain.filtration.level a) (y : S.domain.Carrier) (hy : y∈S.domain.filtration.level b) (hc : ⁅x,y⁆∈S.domain.filtration.level j) : χ' ⟨⁅x,y⁆,hc⟩=1 := by change Multiplicative.ofAdd ((d:ℝ)*(χ ⟨⁅x,y⁆,hc⟩).toAdd)=1 rw [hbr a b ha hb hab x hx y hy hc] simp exact S.descend_integral hL j hj hjs χ' hne' hcont' hz hnext' hbr' (LevelCharacterSubsequence.nondivergence_integer_mul (L∘S.subseq) (fun N=>(χ (S.coeff N j)).toAdd) j d hd hbad)
theorem exists_irrational_state (S₀ : State c Γ s K P L) (hL : ∀ N,0<L N) : ∃ S : State c Γ s K P L,S.Irrational := by classical have hex : ∃ r : ℕ,∃ S : State c Γ s K P L,S.domain.rank=r:= ⟨S₀.domain.rank,S₀,rfl⟩ obtain ⟨S,hS⟩:=Nat.find_spec hex refine ⟨S,?_⟩ by_contra hn obtain ⟨T,hT⟩:=S.descend_of_not_irrational hL hn have hmin:=Nat.find_min' hex (show ∃ U : State c Γ s K P L, U.domain.rank=T.domain.rank from ⟨T,rfl⟩) rw [← hS] at hmin exact (not_lt_of_ge hmin) hT
end State
def initialState (hsk : MalcevCharacters.SecondKind c) (hΓ : ∀ x : G,x∈Γ ↔ ∀ i,∃ z : ℤ,c.coord x i=z) (hK0 : K.level 0=⊤) (hK1 : K.level 1=⊤) (hKs : K.level (s+1)=⊥) (r : ℕ → ℕ) (hr : ∀ k,r k≤n) (hadapt : ∀ k (x : G),x∈K.level k ↔ ∀ i : Fin n,i.val<r k → c.coord x i=0) (a : ℕ → ∀ k : ℕ,K.level k) (ha0 : ∀ N,(a N 0).val=1) : State c Γ s K (fun N=>word (fun k=>(a N k).val) (s+1)) L where domain := { Carrier := G embed := MonoidHom.id G injective := Function.injective_id continuous := continuous_id closedEmbedding := IsClosedEmbedding.id dim := n chart := c secondKind := hsk lattice := Γ integer_lattice := hΓ lattice_image := fun _ h=>h rational_image := fun _ h=>h filtration := K zero_top := hK0 one_top := hK1 terminal := hKs cutoff := r cutoff_le := hr adapted := hadapt } subseq := id strictmono := strictMono_id coeff := a zero := ha0 level_image := fun _ _ h=>h removals := [] realization := by intro N z; simp [leftWord,rightWord]
theorem normalized_factorization_exists (hsk : MalcevCharacters.SecondKind c) (hΓ : ∀ x : G,x∈Γ ↔ ∀ i,∃ z : ℤ,c.coord x i=z) (hK0 : K.level 0=⊤) (hK1 : K.level 1=⊤) (hKs : K.level (s+1)=⊥) (r : ℕ → ℕ) (hr : ∀ k,r k≤n) (hadapt : ∀ k (x : G),x∈K.level k ↔ ∀ i : Fin n,i.val<r k → c.coord x i=0) (hP : ∀ N,P N∈polynomials K 0) (hP0 : ∀ N,P N 0=1) (hL : ∀ N,0<L N) : ∃ S : State c Γ s K P L,S.Irrational := by classical have hb (N : ℕ) : ∃ b : ℕ → G, (∀ i<s+1,b i∈K.level i) ∧ P N=word b (s+1) := by simpa using exists_taylor (H:=K) (k:=0) (d:=s+1) (by simpa using hKs) (hP N) choose b hb hword using hb let a : ℕ → ∀ k : ℕ,K.level k:=fun N k=> if hk : k<s+1 then ⟨b N k,hb N k hk⟩ else 1 have haword (N : ℕ) : word (fun k=>(a N k).val) (s+1)=P N := by rw [hword] apply word_congr intro k hk dsimp only [a] rw [dite_eq_left hk] have ha0 (N : ℕ) : (a N 0).val=1 := by rw [← word_zero (fun k=>(a N k).val) s,haword,hP0] obtain ⟨S,hirr⟩:=(initialState (L:=L) hsk hΓ hK0 hK1 hKs r hr hadapt a ha0).exists_irrational_state hL have he : (fun N=>word (fun k=>(a N k).val) (s+1))=P:=funext haword exact he ▸ ⟨S,hirr⟩
end AllLevelStatesend end
section
noncomputable sectionopen scoped Topologyopen Filteruniverse unamespace AllLevelRemovalsopen RationalLattice RationalFactorPeriodsvariable {G : Type u} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n s : ℕ} {c : RealCoordinates G n} {L : ℕ → ℝ}
omit [IsTopologicalGroup G] inlemma rightWord_ordered [IsTopologicalGroup G] (W : List (Removal c L s)) (N : ℕ) (z : ℤ) : rightWord W N z=orderedWord (fun i : Fin W.reverse.length => (W.reverse.get i).flow (Multiplicative.ofAdd 1) ^ (W.reverse.get i).integer N) (fun i=>(W.reverse.get i).degree) z := by unfold rightWord orderedWord simp only [← zpow_mul] have hl:=List.map_get_finRange W.reverse conv_lhs => rw [← hl, List.map_map] rfl
theorem rightWord_residues [PreconnectedSpace G] [LocallyCompactSpace G] [T2Space G] (Γ : Subgroup G) [DiscreteTopology Γ] (hΓrat : Γ≤rationalSubgroup c) (C : Set G) (hC : IsCompact C) (hreps : ∀ g : G,∃ x∈C,x⁻¹*g∈Γ) (W : List (Removal c L s)) : ∃ (φ : ℕ → ℕ) (T : ℕ) (σ : Fin T → G),StrictMono φ ∧ 0<T ∧ (∀ r,IsRational c (σ r)) ∧ ∀ N z,∃ r : Fin T, (r.val:ℤ)=z%(T:ℤ) ∧ (QuotientGroup.mk (rightWord W (φ N) z) : G⧸Γ)=QuotientGroup.mk (σ r) := by obtain ⟨φ,T,σ,hφ,hT,hσ,he⟩:=rational_right_factors c Γ hΓrat C hC hreps (fun i : Fin W.reverse.length=>(W.reverse.get i).flow (Multiplicative.ofAdd 1)) (fun i=>(W.reverse.get i).rational_unit) (fun N i=>(W.reverse.get i).integer N) (fun i=>(W.reverse.get i).degree) s (fun i=>(W.reverse.get i).degree_le) refine ⟨φ,T,σ,hφ,hT,hσ,?_⟩ intro N z rw [rightWord_ordered] exact he N z
end AllLevelRemovalsnamespace AllLevelStatesopen RationalLattice AllLevelDomains AllLevelRemovals CubeFaces NilpotentTaylorvariable {G : Type u} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n s : ℕ} {c : RealCoordinates G n} {Γ : Subgroup G}variable {K : Filtration G} {P : ℕ → ℤ → G} {L : ℕ → ℝ}namespace State
def reindex (S : State c Γ s K P L) (φ : ℕ → ℕ) (hφ : StrictMono φ) : State c Γ s K P L where domain := S.domain subseq := S.subseq∘φ strictmono := S.strictmono.comp hφ coeff := fun N=>S.coeff (φ N) zero := fun N=>S.zero (φ N) level_image := S.level_image removals := S.removals.map (fun w=>w.reindex φ hφ) realization := by intro N z rw [leftWord_reindex,rightWord_reindex] exact S.realization (φ N) z
lemma irrational_reindex (S : State c Γ s K P L) (hirr : S.Irrational) (φ : ℕ → ℕ) (hφ : StrictMono φ) : (S.reindex φ hφ).Irrational := by intro j hj hjs χ hne hcont hrat hnext hbr exact (hirr j hj hjs χ hne hcont hrat hnext hbr).comp hφ.tendsto_atTop
theorem exists_irrational_fixed_residues [PreconnectedSpace G] [LocallyCompactSpace G] [T2Space G] [DiscreteTopology Γ] (hΓrat : Γ≤rationalSubgroup c) (C : Set G) (hC : IsCompact C) (hreps : ∀ g : G,∃ x∈C,x⁻¹*g∈Γ) (S : State c Γ s K P L) (hirr : S.Irrational) : ∃ (T : State c Γ s K P L) (d : ℕ) (σ : Fin d → G), T.Irrational ∧ 0<d ∧ (∀ r,IsRational c (σ r)) ∧ ∀ N z,∃ r : Fin d,(r.val:ℤ)=z%(d:ℤ) ∧ (QuotientGroup.mk (rightWord T.removals N z) : G⧸Γ)=QuotientGroup.mk (σ r) := by obtain ⟨φ,d,σ,hφ,hd,hσ,he⟩:=rightWord_residues Γ hΓrat C hC hreps S.removals refine ⟨S.reindex φ hφ,d,σ,S.irrational_reindex hirr φ hφ,hd,hσ,?_⟩ intro N z change ∃ r : Fin d,(r.val:ℤ)=z%(d:ℤ) ∧ (QuotientGroup.mk (rightWord (S.removals.map (fun w=>w.reindex φ hφ)) N z) : G⧸Γ)= QuotientGroup.mk (σ r) rw [rightWord_reindex] exact he N z
end Stateend AllLevelStatesend end
section
noncomputable sectionopen scoped BigOperators Topologyopen Filternamespace ParametricSmoothopen _root_.Polynomial _root_.OAI.Polynomialvariable {σ : Type*}
def family (p : Polynomial (MvPolynomial σ ℝ)) (t : σ → ℝ) : Polynomial ℝ := p.map (MvPolynomial.eval t)
def IsPolynomial (f : (σ → ℝ) → ℝ → ℝ) : Prop := ∃ p : Polynomial (MvPolynomial σ ℝ),∀ t x,(family p t).eval x=f t x
lemma constant (a : ℝ) : IsPolynomial (fun (_ : σ → ℝ) _=>a) := ⟨C (MvPolynomial.C a),by intro t x; simp [family]⟩lemma coordinate : IsPolynomial (fun (_ : σ → ℝ) x=>x) := ⟨X,by intro t x; simp [family]⟩lemma parameter (i : σ) : IsPolynomial (fun (t : σ → ℝ) _=>t i) := ⟨C (MvPolynomial.X i),by intro t x; simp [family]⟩lemma add {f g : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) : IsPolynomial (fun t x=>f t x+g t x) := by obtain ⟨p,hp⟩:=hf obtain ⟨q,hq⟩:=hg refine ⟨p+q,?_⟩ intro t x change ((p+q).map _).eval x=_ rw [Polynomial.map_add,eval_add] exact congrArg₂ (·+·) (hp t x) (hq t x)lemma mul {f g : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) : IsPolynomial (fun t x=>f t x*g t x) := by obtain ⟨p,hp⟩:=hf obtain ⟨q,hq⟩:=hg refine ⟨p*q,?_⟩ intro t x change ((p*q).map _).eval x=_ rw [Polynomial.map_mul,eval_mul] exact congrArg₂ (·*·) (hp t x) (hq t x)lemma neg {f : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) : IsPolynomial (fun t x=>-f t x) := by simpa using mul (constant (-1)) hflemma sub {f g : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) : IsPolynomial (fun t x=>f t x-g t x) := by simpa [sub_eq_add_neg] using add hf (neg hg)lemma pow {f : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) (k : ℕ) : IsPolynomial (fun t x=>(f t x)^k) := by induction k with | zero => simpa using constant (σ:=σ) 1 | succ k ih => simpa [pow_succ] using mul ih hflemma finite_sum {ι : Type*} (S : Finset ι) {f : ι → (σ → ℝ) → ℝ → ℝ} (hf : ∀ i∈S,IsPolynomial (f i)) : IsPolynomial (fun t x=>∑ i∈S,f i t x) := by classical induction S using Finset.induction_on with | empty => simpa using constant (σ:=σ) 0 | @insert i S hi ih => simpa [Finset.sum_insert hi] using add (hf i (by simp)) (ih (fun j hj=>hf j (by simp [hj])))lemma finite_prod {ι : Type*} (S : Finset ι) {f : ι → (σ → ℝ) → ℝ → ℝ} (hf : ∀ i∈S,IsPolynomial (f i)) : IsPolynomial (fun t x=>∏ i∈S,f i t x) := by classical induction S using Finset.induction_on with | empty => simpa using constant (σ:=σ) 1 | @insert i S hi ih => simpa [Finset.prod_insert hi] using mul (hf i (by simp)) (ih (fun j hj=>hf j (by simp [hj])))lemma polynomial_eval (p : Polynomial ℝ) {f : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) : IsPolynomial (fun t x=>p.eval (f t x)) := by simp only [Polynomial.eval_eq_sum_range] exact finite_sum _ (fun i _=>mul (constant _) (pow hf i))lemma mvpolynomial_eval {ι : Type*} (p : MvPolynomial ι ℚ) {f : ι → (σ → ℝ) → ℝ → ℝ} (hf : ∀ i,IsPolynomial (f i)) : IsPolynomial (fun t x=>MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun i=>f i t x) p) := by induction p using MvPolynomial.induction_on with | C a => simpa using constant (σ:=σ) (a:ℝ) | add p q hp hq => simpa using add hp hq | mul_X p i hp => simpa using mul hp (hf i)
lemma rename_parameters {τ : Type*} {f : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) (e : σ → τ) : IsPolynomial (fun t x=>f (t∘e) x) := by obtain ⟨p,hp⟩:=hf refine ⟨p.map (MvPolynomial.rename e).toRingHom,?_⟩ intro t x have he : (MvPolynomial.eval t).comp (MvPolynomial.rename e).toRingHom= MvPolynomial.eval (t∘e) := by apply RingHom.ext intro P exact MvPolynomial.eval_rename e t P simp only [family,Polynomial.map_map,he] exact hp (t∘e) x
lemma continuous_eval (p : Polynomial (MvPolynomial σ ℝ)) : Continuous (fun z : (σ → ℝ) × ℝ=>(family p z.1).eval z.2) := by simp only [family,eval_map,eval₂_eq_sum_range] apply continuous_finsetSum intro i _ exact ((MvPolynomial.continuous_eval (p.coeff i)).comp continuous_fst).mul (continuous_snd.pow i)
lemma derivative_family (p : Polynomial (MvPolynomial σ ℝ)) (t : σ → ℝ) (k : ℕ) : derivative^[k] (family p t)=family (derivative^[k] p) t := by induction k generalizing p with | zero => rfl | succ k ih => rw [Function.iterate_succ_apply,Function.iterate_succ_apply] rw [show derivative (family p t)=family p.derivative t from derivative_map p _] exact ih p.derivative
theorem compact_derivative_limit [Fintype σ] {ι : Type*} {l : Filter ι} {f : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) {a : ι → σ → ℝ} {a₀ : σ → ℝ} (ha : Tendsto a l (𝓝 a₀)) (k : ℕ) (K : Set ℝ) (hK : IsCompact K) : TendstoUniformlyOn (fun N=>iteratedDeriv k (f (a N))) (iteratedDeriv k (f a₀)) l K := by obtain ⟨p,hp⟩:=hf have he (t : σ → ℝ) : f t=fun x=>(family p t).eval x:=funext (fun x=>(hp t x).symm) simp_rw [he,SmoothBinomial.iteratedDeriv_eval,derivative_family] let : CompactSpace K:=isCompact_iff_compactSpace.mp hK let F : (σ → ℝ) → K → ℝ:=fun t x=>(family (derivative^[k] p) t).eval x.val have hF : Continuous (Function.uncurry F):= (continuous_eval (derivative^[k] p)).comp (continuous_fst.prodMk (continuous_subtype_val.comp continuous_snd)) have hu:=hF.tendstoUniformly F a₀ rw [tendstoUniformlyOn_iff_tendstoUniformly_comp_coe] intro u hu' exact ha.eventually (hu u hu')
theorem compact_derivative_bound {f : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) {a : ℕ → σ → ℝ} {a₀ : σ → ℝ} (ha : Tendsto a atTop (𝓝 a₀)) (k : ℕ) (K : Set ℝ) (hK : IsCompact K) : ∃ B>0,∀ N x,x∈K → |iteratedDeriv k (f (a N)) x|≤B := by obtain ⟨p,hp⟩:=hf have he (t : σ → ℝ) : f t=fun x=>(family p t).eval x:=funext (fun x=>(hp t x).symm) obtain ⟨M,hM⟩:=(ha.isCompact_insert_range.prod hK).exists_bound_of_continuousOn (continuous_eval (derivative^[k] p)).continuousOn refine ⟨max M 0+1,by positivity,?_⟩ intro N x hx rw [he,SmoothBinomial.iteratedDeriv_eval,derivative_family] have hb:=hM (a N,x) ⟨Set.mem_insert_of_mem _ (Set.mem_range_self N),hx⟩ have hb' : |(family (derivative^[k] p) (a N)).eval x|≤M:=by simpa only [Real.norm_eq_abs] using hb exact hb'.trans (by linarith [le_max_left M 0])
end ParametricSmooth
endendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.AllLevel09import OAI.Geometry.NilpotentCharts.Main
namespace OAI
open scoped BigOperatorssectionnoncomputable sectionopen MeasureTheory Topologyend end
noncomputable sectionopen Filteropen scoped Topology BigOperatorsnamespace SourcePhysicalDecayopen RoughSamplingWeights FinitePieceAveragesvariable {Y : Type} [TopologicalSpace Y] {v : ℕ}
def AllBoxes (Z : ℕ→ℝ) (state : ℕ→(Fin v→ℤ)→Y) (S : C(Y,Y)) : Prop := ∀ (d : ℕ),0<d → ∀ (c C : ℝ),0<c →0<C → ∀ (lo hi : ℕ→Fin v→ℝ) (res : ℕ→Fin v→ℤ), (∀ᶠ N in atTop,(∀ i,c*Z N≤hi N i-lo N i) ∧ (∀ i,-C*Z N≤lo N i ∧ hi N i≤C*Z N)) → ∀ f : C(Y,ℂ),Tendsto (fun N=>mean (physicalResidueBox (lo N) (hi N) (res N) d) (fun b=>f (S (state N b)))-mean (physicalResidueBox (lo N) (hi N) (res N) d) (fun b=>f (state N b))) atTop (𝓝 0)
theorem allBoxes_subsequence (Z : ℕ→ℝ) (hZ : ∀ N,0≤Z N) (state : ℕ→(Fin v→ℤ)→Y) (S : C(Y,Y)) (h : AllBoxes Z state S) (ψ : ℕ→ℕ) (hψ : StrictMono ψ) : AllBoxes (Z∘ψ) (state∘ψ) S := by classical intro d hd c C hc hC lo hi res hb f let lo' := Function.extend ψ lo (fun N (_ : Fin v)=>-(c+C)*Z N) let hi' := Function.extend ψ hi (fun N (_ : Fin v)=>(c+C)*Z N) let res' := Function.extend ψ res (fun _ (_ : Fin v)=>0) have hlo (k : ℕ) : lo' (ψ k)=lo k := hψ.injective.extend_apply _ _ _ have hhi (k : ℕ) : hi' (ψ k)=hi k := hψ.injective.extend_apply _ _ _ have hres (k : ℕ) : res' (ψ k)=res k := hψ.injective.extend_apply _ _ _ have hb' : ∀ᶠ N in atTop,(∀ i,c*Z N≤hi' N i-lo' N i) ∧ (∀ i,-(c+C)*Z N≤lo' N i ∧ hi' N i≤(c+C)*Z N) := by obtain ⟨N₀,hN₀⟩ := eventually_atTop.mp hb apply eventually_atTop.mpr refine ⟨ψ N₀,fun N hN=>?_⟩ by_cases hn : ∃ k,ψ k=N · obtain ⟨k,rfl⟩:=hn have hk:=hN₀ k (hψ.le_iff_le.mp hN) rw [hlo,hhi] refine ⟨hk.1,fun i=>?_⟩ have hz:=hZ (ψ k) have hcz:=mul_nonneg hc.le hz constructor <;> dsimp only [Function.comp_apply] at hk · nlinarith [(hk.2 i).1] · nlinarith [(hk.2 i).2] · have hl : lo' N=(fun _ : Fin v=>-(c+C)*Z N) := Function.extend_apply' _ _ _ hn have hr : hi' N=(fun _ : Fin v=>(c+C)*Z N) := Function.extend_apply' _ _ _ hn rw [hl,hr] refine ⟨fun _=>?_,fun _=>⟨le_rfl,le_rfl⟩⟩ have hz:=hZ N have hc':=mul_nonneg hc.le hz have hC':=mul_nonneg hC.le hz nlinarith have hh:=(h d hd c (c+C) hc (add_pos hc hC) lo' hi' res' hb' f).comp hψ.tendsto_atTop simpa only [Function.comp_def,hlo,hhi,hres] using hh
end SourcePhysicalDecayend
noncomputable sectionopen MeasureTheory Filteropen scoped Topology BigOperatorsnamespace SourcePhysicalDecayattribute [local instance] Classical.propDecidableopen RoughSamplingWeights FinitePieceAverages CubeLocalHaarlemma physical_box_eq_rectangle {v : ℕ} (lo hi : Fin v→ℝ) (a : Fin v→ℤ) (d : ℕ) (ha : ∀ i,0≤a i ∧ a i<(d:ℤ)) : physicalResidueBox lo hi a d=physicalResidueRectangle lo hi a d := by classical ext b simp only [physicalResidueBox,Finset.mem_filter,mem_boxIndices _ _ _ _ zero_lt_one, physicalResidueRectangle_mem,zero_add,one_mul,Int.ModEq,Int.emod_eq_of_lt (ha _).1 (ha _).2]
lemma mean_eq_expect {α : Type*} (s : Finset α) (f : α→ℂ) : mean s f=𝔼 x∈s,f x := by rw [mean,Finset.expect_eq_sum_div_card,div_eq_mul_inv,mul_comm]
lemma mean_ofReal {α : Type*} (s : Finset α) (f : α→ℝ) : mean s (fun x=>(f x:ℂ))=((𝔼 x∈s,f x : ℝ):ℂ) := by rw [mean_eq_expect] exact (map_expect (Complex.ofRealCLM.toLinearMap.restrictScalars ℚ≥0) f s).symmend SourcePhysicalDecayendnoncomputable sectionopen MeasureTheory Filteropen scoped Topology BigOperatorsnamespace SourcePhysicalDecayopen RationalLattice CubeFaces CubeTaylorExpansion CubeLocalHaar RoughSamplingWeights FinitePieceAveragesopen AllLevelFactorization AllLevelFactorization.Factorization AllLevelFactorization.Factorization.ResidueCovervariable {G ι : Type} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable [Fintype ι] [DecidableEq ι]variable {n s : ℕ} {c : RealCoordinates G n} {Γ : Subgroup G}variable {K : Filtration G} {P : ℕ→ℤ→G} {L : ℕ→ℝ}variable {F : Factorization c Γ s K P L} {r : Fin F.period} (C : F.ResidueCover r)variable [MeasurableSpace (C.CubeSpace (ι:=ι))] [BorelSpace (C.CubeSpace (ι:=ι))]variable [CompactSpace (G⧸Γ)] [MeasurableSpace (G⧸Γ)] [BorelSpace (G⧸Γ)]variable [SecondCountableTopology (G⧸Γ)]variable {Y : Type} [TopologicalSpace Y] [MeasurableSpace Y] [BorelSpace Y]variable [CompactSpace Y] [HasOuterApproxClosed Y]
omit [CompactSpace (G⧸Γ)] [CompactSpace Y] intheorem haar_invariant_of_allBoxes (hL : ∀ N,0<L N) (ht : Tendsto L atTop atTop) {v : ℕ} (e : Option ι≃Fin v) (π : C((Finset ι→G⧸Γ),Y)) (S : C(Y,Y)) (h : AllBoxes L (fun N b=>π (fun w=>QuotientGroup.mk (P N (vertex (fun i=>b (e i)) w)))) S) (d : ℕ) (hd : 0<d) (a : Fin v→ℤ) (ha : ∀ i,0≤a i ∧ a i<(d:ℤ)) (hdp : F.period∣d) (ha0 : a (e none)%(F.period:ℤ)=(r.val:ℤ)) (hai : ∀ i,a (e (some i))%(F.period:ℤ)=0) (lo hi : ℝ→ℕ→Fin v→ℝ) (hb : ∀ α : ℝ,0<α →∃ c₀ C₀ : ℝ,0<c₀ ∧ 0<C₀ ∧ ∀ᶠ N in atTop, (∀ i,c₀*L (F.state.subseq N)≤hi α N i-lo α N i) ∧ (∀ i,-C₀*L (F.state.subseq N)≤lo α N i ∧ hi α N i≤C₀*L (F.state.subseq N))) (β B : ℝ) (hgeo : ∀ α : ℝ,0<α →∀ᶠ N in atTop, ∀ b∈physicalResidueRectangle (lo α N) (hi α N) a d,∀ w : Finset ι, dist ((vertex (fun i=>b (e i)) w:ℝ)/L (F.state.subseq N)) β≤B*α) : Measure.map S (C.marginalCubeHaar β π : Measure Y)=(C.marginalCubeHaar β π : Measure Y) := by apply C.marginal_haar_invariant hL ht e d hd a ha hdp ha0 hai lo hi hb β B hgeo π S intro α hα f obtain ⟨c₀,C₀,hc₀,hC₀,hbα⟩ := hb α hα let ff : C(Y,ℂ):=⟨fun y=>(f y:ℂ),Complex.continuous_ofReal.comp f.continuous⟩ have hh:=(allBoxes_subsequence L (fun N=>(hL N).le) _ S h F.state.subseq F.state.strictmono) d hd c₀ C₀ hc₀ hC₀ (lo α) (hi α) (fun _=>a) hbα ff have he (N : ℕ) : (mean (physicalResidueBox (lo α N) (hi α N) a d) (fun b=>ff (S (π (fun w=>QuotientGroup.mk (P (F.state.subseq N) (vertex (fun i=>b (e i)) w))))))- mean (physicalResidueBox (lo α N) (hi α N) a d) (fun b=>ff (π (fun w=>QuotientGroup.mk (P (F.state.subseq N) (vertex (fun i=>b (e i)) w))))))= ((marginalBoxAverage (F:=F) e d a lo hi π α N (f.comp S)- marginalBoxAverage (F:=F) e d a lo hi π α N f:ℝ):ℂ) := by rw [physical_box_eq_rectangle _ _ _ _ ha] dsimp only [ff,ContinuousMap.coe_mk] rw [mean_ofReal,mean_ofReal,←Complex.ofReal_sub] rfl have hn:=hh.norm simpa only [Function.comp_apply,he,norm_zero,Complex.norm_real,Real.norm_eq_abs] using hn
end SourcePhysicalDecayend
noncomputable sectionopen MeasureTheory Filteropen scoped Topology BigOperatorsnamespace SourcePhysicalDecayopen RationalLattice AllLevelFactorization AllLevelFactorization.Factorizationopen CubeFaces CubeLocalHaar PhysicalCubeMaps SourceIntegerArraysattribute [local instance] Classical.propDecidablevariable {Y : Type} [TopologicalSpace Y]
def AllCompatibleHaar (L : ℕ→ℝ) (state : ℕ→ℤ→Y) (v : ℕ) (j : Fin v) (S : C(Y,Y)) : Prop := letI : MeasurableSpace (Finset (Fin v)→Y):=borel _ letI : BorelSpace (Finset (Fin v)→Y):=⟨rfl⟩ ∀ (H : Type) [Group H] [TopologicalSpace H] [IsTopologicalGroup H], ∀ (n s : ℕ) (c : RealCoordinates H n) (Λ : Subgroup H) [CompactSpace (H⧸Λ)] [SecondCountableTopology (H⧸Λ)], letI : MeasurableSpace (H⧸Λ):=borel _ letI : BorelSpace (H⧸Λ):=⟨rfl⟩ ∀ (K : Filtration H) (P : ℕ→ℤ→H) (F : Factorization c Λ s K P L) (p : C(H⧸Λ,Y)), (∀ N b,p (QuotientGroup.mk (P N b))=state N b) → ∀ (r : Fin F.period) (C : F.ResidueCover r), letI : MeasurableSpace (C.CubeSpace (ι:=Fin v)):=borel _ letI : BorelSpace (C.CubeSpace (ι:=Fin v)):=⟨rfl⟩ ∀ (d : ℕ),0<d → ∀ (a : Fin (v+1)→ℤ), (∀ i,0≤a i ∧ a i<(d:ℤ)) → F.period∣d → a 0%(F.period:ℤ)=(r.val:ℤ) → (∀ i : Fin v,a i.succ%(F.period:ℤ)=0) → ∀ (lo hi : ℝ→ℕ→Fin (v+1)→ℝ), (∀ α : ℝ,0<α →∃ c₀ C₀ : ℝ,0<c₀ ∧ 0<C₀ ∧ ∀ᶠ N in atTop, (∀ i,c₀*L (F.state.subseq N)≤hi α N i-lo α N i) ∧ (∀ i,-C₀*L (F.state.subseq N)≤lo α N i ∧ hi α N i≤C₀*L (F.state.subseq N))) → ∀ (β B : ℝ), (∀ α : ℝ,0<α →∀ᶠ N in atTop, ∀ b∈physicalResidueRectangle (lo α N) (hi α N) a d,∀ w : Finset (Fin v), dist ((cubeVertex v b w:ℝ)/L (F.state.subseq N)) β≤B*α) → Measure.map (upperFace j S) (C.marginalCubeHaar (ι:=Fin v) β (vertices (ι:=Fin v) p) : Measure (Finset (Fin v)→Y))= (C.marginalCubeHaar (ι:=Fin v) β (vertices (ι:=Fin v) p) : Measure (Finset (Fin v)→Y))
theorem compatible_haar_of_allBoxes [CompactSpace Y] [TopologicalSpace.MetrizableSpace Y] (L : ℕ→ℝ) (hL : ∀ N,0<L N) (hLt : Tendsto L atTop atTop) (state : ℕ→ℤ→Y) (v : ℕ) (j : Fin v) (S : C(Y,Y)) (h : AllBoxes L (fun N b w=>state N (cubeVertex v b w)) (upperFace j S)) : AllCompatibleHaar L state v j S := by classical intro H _ _ _ n s c Λ _ _ let : MeasurableSpace (H⧸Λ):=borel _ let : BorelSpace (H⧸Λ):=⟨rfl⟩ intro K P F p hp r C let : MeasurableSpace (Finset (Fin v)→Y):=borel _ let : BorelSpace (Finset (Fin v)→Y):=⟨rfl⟩ let : MeasurableSpace (C.CubeSpace (ι:=Fin v)):=borel _ let : BorelSpace (C.CubeSpace (ι:=Fin v)):=⟨rfl⟩ intro d hd a ha hdp ha0 hai lo hi hb β B hgeo let e : Option (Fin v)≃Fin (v+1):=(finSuccEquiv v).symm have he (b : Fin (v+1)→ℤ) (w : Finset (Fin v)) : vertex (fun i=>b (e i)) w=cubeVertex v b w := by simp [vertex,cubeVertex,e] have hh : AllBoxes L (fun N b=>vertices p (fun w=>QuotientGroup.mk (P N (vertex (fun i=>b (e i)) w)))) (upperFace j S) := by have heq : (fun N b=>vertices p (fun w=>QuotientGroup.mk (P N (vertex (fun i=>b (e i)) w))))=(fun N b w=>state N (cubeVertex v b w)) := by funext N b w simp only [vertices_apply,he,hp] rw [heq] exact h apply haar_invariant_of_allBoxes C hL hLt e (vertices p) (upperFace j S) hh d hd a ha hdp (by simpa [e] using ha0) (by simpa [e] using hai) lo hi hb β B simpa only [he] using hgeo
end SourcePhysicalDecayend
noncomputable sectionnamespace SourceIntegerArraysopen RoughArrayFaceopen RationalLattice MalcevCharacters RoughFaceShift RoughTopologicalFace RoughArrayCoordinates SourceResidueAlignmentopen RoughScales RoughSamplingWeights FinitePieceAverages RoughSourceExceptional RoughProductRemovalopen ProductExposureLabels ProductExposureLaw ProductExposureCutoff MeasureTheory Filteropen scoped BigOperators Topology ENNRealattribute [local instance] Classical.propDecidablevariable {τ : Type} [Fintype τ] {ι : τ→Type} [∀ t,Fintype (ι t)]variable (G : ∀ t,ι t→Type) [∀ t i,Group (G t i)]variable [∀ t i,TopologicalSpace (G t i)] [∀ t i,IsTopologicalGroup (G t i)]variable (n : ∀ t,ι t→ℕ) (q : τ→ℕ) (c : ∀ t i,RealCoordinates (G t i) (n t i))variable (hsk : ∀ t i,SecondKind (c t i)) (A : ∀ t i,CubeFaces.Filtration (G t i))variable (w : ∀ t i,Fin (n t i)→ℕ)variable (hA : ∀ t i k (g : G t i),g∈(A t i).level k ↔ ∀ j,w t i j<k → (c t i).coord g j=0)variable (hw : ∀ t i j,0<w t i j) (Γ : ∀ t i,Subgroup (G t i))
theorem source_global_literal_haar (hΓ : ∀ t i g,g∈Γ t i ↔ ∀ j,∃ z : ℤ,(c t i).coord g j=z) (a : ℕ) (m h v : τ→ℕ) (perm : ∀ t,Fin (m t+h t)≃Fin a) (w0 M Xp : ℕ→ℕ) (X : ℕ→Fin a→ℕ) (R Q : ℕ→ℝ) (L : ℕ→ℤ) (hw0 : Tendsto w0 atTop atTop) (hX : ∀ N j,4*primorial (w0 N)≤X N j) (hXp : ∀ N,4*primorial (w0 N)≤Xp N) (hXt : ∀ j,Tendsto (fun N=>X N j) atTop atTop) (hXpt : Tendsto Xp atTop atTop) (hR : ∀ N,0<R N) (hRX : Tendsto (fun N=>R N/(Xp N:ℝ)) atTop (𝓝 0)) (hZ : ∀ t (u : ℝ),0<u →Tendsto (fun N=>(R N/(M N:ℝ))/ (1+∑ j : Fin (m t),(X N (perm t (j.castAdd (h t))):ℝ)^2)^u) atTop atTop) (hQ0 : ∀ N,0≤Q N) (hSize : ∀ t,Tendsto (fun N=>(Q N+(∏ l : Fin (m t),(X N (perm t (l.castAdd (h t))):ℝ)^2)*(L N:ℝ))/R N) atTop (𝓝 0)) (hWM : ∀ N,(primorial (w0 N):ℤ)∣(M N:ℤ)) (hM : ∀ N,0<M N) (hMs : ∀ N,Smooth (w0 N) (M N:ℤ)) (hL : ∀ N,0<L N) (hsm : ∀ N,Smooth (w0 N) (L N)) (hWL : ∀ N,(primorial (w0 N):ℤ)∣L N) (hML : ∀ N,(M N:ℤ)∣L N) (hLexact : ∀ N,L N=(M N:ℤ)*(primorial (w0 N):ℤ)^(w0 N)) (hXL : ∀ t (j : Fin (m t)),Tendsto (fun N=>(X N (perm t (j.castAdd (h t))):ℝ)/(L N:ℝ)) atTop atTop) (g x : ∀ t,ℕ→(Fin (h t)→ℕ)→Label (m t)→∀ i,G t i) (slot : ∀ t,ℕ→(Fin (h t)→ℕ)→Label (m t)→ι t→ℤ) (qval : ∀ t,ℕ→(Fin (h t)→ℕ)→Label (m t)→Fin (q t)→ℤ) (hQ : ∀ t N y,y∈outsideDomain (fun l : Fin (h t)=>X N (perm t (l.natAdd (m t)))) (primorial (w0 N)) → ∀ b,b∈(fullDomain (fun l : Fin (m t)=>X N (perm t (l.castAdd (h t)))) (Xp N) (primorial (w0 N))).image (expose (L N) (M N:ℤ) (R N)) →∀ k,|(qval t N y b k:ℝ)|≤Q N) (E : ℕ→Set ((Fin a→ℕ)×ℕ)) (ε : ℝ≥0∞) (hε : 0<ε) (hE : ∀ N,ε≤(jointLaw (X N) (Xp N) (primorial (w0 N)) (primorial_pos _) (hX N) (hXp N)) (E N)) : ∃ φ : ℕ→ℕ,StrictMono φ ∧ ∃ z : ℕ→(Fin a→ℕ)×ℕ, (∀ k,z k∈E (φ k) ∧ z k∈fullDomain (X (φ k)) (Xp (φ k)) (primorial (w0 (φ k)))) ∧ ∀ t, let zout := fun k l=>(z k).1 (perm t (l.natAdd (m t))) let zin := fun k=>((fun l=>(z k).1 (perm t (l.castAdd (h t)))),(z k).2) let label := fun k=>expose (L (φ k)) (M (φ k):ℤ) (R (φ k)) (zin k) let Z := fun k=>R (φ k)/(M (φ k):ℝ) ∀ (e : Fin (q t)) (j : Fin (v t)) (pstar : ℕ→ℤ), (∀ k,(M (φ k):ℤ)∣pstar k-((z k).2:ℤ)) → (∀ k,|(pstar k:ℝ)-((z k).2:ℝ)|≤R (φ k)) → let state := fun k b=>QuotientGroup.mk (literalState (G t) (n t) (q t) (c t) (hsk t) (A t) (w t) (hA t) (hw t) (M (φ k)) (L (φ k)) (label k) (fun l=>((zin k).1 l:ℤ)) (pstar k) (fun _ (_ : Fin 1)=>1) (g t (φ k) (zout k) (label k)) (x t (φ k) (zout k) (label k)) (slot t (φ k) (zout k) (label k)) (qval t (φ k) (zout k) (label k)) (fun _=>b)) SourcePhysicalDecay.AllCompatibleHaar Z state (v t) j (faceAction (G t) (n t) (q t) (c t) (hsk t) (A t) (w t) (hA t) (Γ t) (fun _ (_ : Fin 1)=>1) e 0) := by classical obtain ⟨φ,hφ,z,hz,hgood⟩:=source_global_literal_cube_faces G n q c hsk A w hA hw Γ hΓ a m h v perm w0 M Xp X R Q L hw0 hX hXp hXt hXpt hR hRX hZ hQ0 hSize hWM hM hMs hL hsm hWL hML hLexact hXL g x slot qval hQ E ε hε hE refine ⟨φ,hφ,z,hz,?_⟩ intro t dsimp only intro e j pstar hpstar hpclose let Y := (Carrier (G t) (n t) (q t) (c t) (hsk t) (A t) (w t) (hA t))⧸ lattice (G t) (n t) (q t) (c t) (hsk t) (A t) (w t) (hA t) (Γ t) have htop:=joint_array_topology (G t) (n t) (q t) (c t) (hsk t) (A t) (w t) (hA t) (hw t) (Γ t) (hΓ t) let : CompactSpace Y:=htop.2.2.1 let : TopologicalSpace.MetrizableSpace Y:=htop.2.2.2 have hZpos (N : ℕ) : 0<R N/(M N:ℝ):=div_pos (hR N) (by exact_mod_cast hM N) have hZT : Tendsto (fun N=>R N/(M N:ℝ)) atTop atTop := by have ht : Tendsto (fun N=>(R N/(M N:ℝ))/ (1+∑ j : Fin (m t),(X N (perm t (j.castAdd (h t))):ℝ)^2)) atTop atTop := by simpa only [Real.rpow_one] using hZ t 1 zero_lt_one apply tendsto_atTop.mpr intro B filter_upwards [ht.eventually (eventually_ge_atTop B)] with N hN apply hN.trans apply div_le_self (hZpos N).le have hn : 0≤∑ j : Fin (m t),(X N (perm t (j.castAdd (h t))):ℝ)^2:= Finset.sum_nonneg (fun _ _=>sq_nonneg _) linarith apply SourcePhysicalDecay.compatible_haar_of_allBoxes _ (fun k=>hZpos (φ k)) (hZT.comp hφ.tendsto_atTop) intro d hd c₀ C₀ hc₀ hC₀ lo hi res hbox F exact hgood t e j d hd pstar hpstar hpclose c₀ C₀ hc₀ hC₀ lo hi res hbox F
end SourceIntegerArrays
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.HarmonicTranslation01import OAI.Combinatorics.SumProduct.Alignment.ProductExposure04import OAI.Geometry.NilpotentCharts.Main
namespace OAI
open scoped BigOperatorssection
noncomputable sectionnamespace SourceJointShiftopen MeasureTheory Filter Topology ProductExposureLaw RawHarmonicProbabilityopen scoped BigOperators ENNRealattribute [local instance] Classical.propDecidable
private lemma raw_eval_nat (X W : ℕ) (f : ℤ→ℝ) : HarmonicTranslation.eval (HarmonicTranslation.raw X W) f = ∑ n∈Finset.Ico X (X^2),if W.Coprime n then (n:ℝ)⁻¹*f (n:ℤ) else 0 := by have hs : (HarmonicTranslation.raw X W).support ⊆ Finset.Ico (X:ℤ) ((X:ℤ)^2) := by intro n hn have hh:=Finsupp.mem_support_iff.mp hn rw [HarmonicTranslation.raw_apply] at hh split_ifs at hh with h · exact Finset.mem_Ico.mpr ⟨h.1,h.2.1⟩ · exact (hh rfl).elim rw [HarmonicTranslation.eval,(HarmonicTranslation.raw X W).sum_of_support_subset hs (fun n a=>a*f n) (by simp)] symm apply Finset.sum_bij (fun (n:ℕ) _=>(n:ℤ)) · intro n hn rcases Finset.mem_Ico.mp hn with ⟨hn1,hn2⟩ exact Finset.mem_Ico.mpr ⟨by exact_mod_cast hn1,by exact_mod_cast hn2⟩ · intro n hn k hk he exact_mod_cast he · intro z hz rcases Finset.mem_Ico.mp hz with ⟨hz1,hz2⟩ have hz0 : 0≤z := (Int.natCast_nonneg X).trans hz1 refine ⟨z.toNat,Finset.mem_Ico.mpr ⟨?_,?_⟩,Int.toNat_of_nonneg hz0⟩ · have ht : (X:ℤ)≤(z.toNat:ℤ) := by rwa [Int.toNat_of_nonneg hz0] exact_mod_cast ht · apply (Int.toNat_lt hz0).mpr exact_mod_cast hz2 · intro n hn rcases Finset.mem_Ico.mp hn with ⟨hn1,hn2⟩ have h1 : (X:ℤ)≤n := by exact_mod_cast hn1 have h2 : (n:ℤ)<(X:ℤ)^2 := by exact_mod_cast hn2 simp only [HarmonicTranslation.raw_apply,h1,h2,true_and,Int.isCoprime_iff_nat_coprime, Int.natAbs_natCast,Int.cast_natCast,Nat.coprime_comm (n:=n) (m:=W)] split_ifs <;> simp
private lemma raw_mass_nat (X W : ℕ) : HarmonicTranslation.mass (HarmonicTranslation.raw X W)= DyadicHarmonicBoundary.mass X (X^2) W := by have hh:=raw_eval_nat X W (fun _=>1) simpa [HarmonicTranslation.eval,HarmonicTranslation.mass,DyadicHarmonicBoundary.mass] using hh
private lemma law_eval_nat (X W : ℕ) (hW : 0<W) (hX : 4*W≤X) (A : Set ℤ) : HarmonicTranslation.eval (HarmonicTranslation.law X W) (fun n=>if n∈A then 1 else 0)= (law X W hW hX:Measure ℕ).real {p | (p:ℤ)∈A} := by rw [law_apply,HarmonicTranslation.law,HarmonicTranslation.eval,Finsupp.sum_smul_index (by simp)] have he : (HarmonicTranslation.raw X W).sum (fun n a=>(HarmonicTranslation.mass (HarmonicTranslation.raw X W))⁻¹ * a * (if n∈A then 1 else 0)) = (HarmonicTranslation.mass (HarmonicTranslation.raw X W))⁻¹ * HarmonicTranslation.eval (HarmonicTranslation.raw X W) (fun n=>if n∈A then 1 else 0) := by simp only [HarmonicTranslation.eval,Finsupp.sum,mul_assoc,Finset.mul_sum] rw [he,raw_eval_nat,raw_mass_nat,←div_eq_inv_mul] congr 1 apply Finset.sum_congr rfl intro p hp simp only [Set.mem_ofPred_eq] split_ifs <;> simp_all
private lemma law_shift_event (X W : ℕ) (hW : 0<W) (hX : 4*W≤X) (h : ℤ) (hh : (W:ℤ)∣h) (A : Set ℤ) : |(law X W hW hX:Measure ℕ).real {p | (p:ℤ)+h∈A}- (law X W hW hX:Measure ℕ).real {p | (p:ℤ)∈A}| ≤4*(W:ℝ)*|(h:ℝ)|/X := by have hfirst:=law_eval_nat X W hW hX {n | n+h∈A} simp only [Set.mem_ofPred_eq] at hfirst rw [←hfirst,←law_eval_nat X W hW hX A] change |HarmonicTranslation.eval (HarmonicTranslation.law X W) (fun n=>if n+h∈A then 1 else 0)- HarmonicTranslation.eval (HarmonicTranslation.law X W) (fun n=>if n∈A then 1 else 0)|≤_ rw [←HarmonicTranslation.eval_shift h (HarmonicTranslation.law X W) (fun n=>if n∈A then 1 else 0), ←HarmonicTranslation.eval_sub] have hb:=HarmonicTranslation.eval_bound (HarmonicTranslation.shift h (HarmonicTranslation.law X W)-HarmonicTranslation.law X W) (fun n=>if n∈A then 1 else 0) (B:=1) (by intro n; split_ifs <;> norm_num) rw [mul_one] at hb exact hb.trans (HarmonicTranslation.law_translation hW (by omega) hh)
private lemma joint_pivot_disintegration {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (E : Set ((Fin m→ℕ)×ℕ)) : (jointLaw X Xp W hW hX hXp).real E= ∑ y∈outsideDomain X W,(outsideLaw X W hW hX).real {y} * (law Xp W hW hXp:Measure ℕ).real {p | (y,p)∈E} := by change ((outsideLaw X W hW hX).prod (law Xp W hW hXp:Measure ℕ)).real E=_ rw [measureReal_def,Measure.prod_apply MeasurableSet.of_discrete] conv_lhs => rw [←Measure.restrict_eq_self_of_ae_mem (outside_ae_domain X W hW hX)] rw [lintegral_finset,ENNReal.toReal_sum] · apply Finset.sum_congr rfl intro y hy rw [ENNReal.toReal_mul,mul_comm] rfl · intro y hy exact ENNReal.mul_ne_top (by finiteness) (by finiteness)
theorem raw_joint_shift {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (E : Set (Fin m→ℕ)) (A : (Fin m→ℕ)→Set ℤ) (slot : (Fin m→ℕ)→ℤ) (B : ℝ) (hB : 0≤B) (hslot : ∀ y∈outsideDomain X W,(W:ℤ)∣slot y ∧ |(slot y:ℝ)|≤B) : |(jointLaw X Xp W hW hX hXp).real {z | z.1∈E ∧ (z.2:ℤ)+slot z.1∈A z.1} - (jointLaw X Xp W hW hX hXp).real {z | z.1∈E ∧ (z.2:ℤ)∈A z.1}| ≤ 4*(W:ℝ)*B/Xp := by rw [joint_pivot_disintegration,joint_pivot_disintegration,←Finset.sum_sub_distrib] calc _ ≤ ∑ y∈outsideDomain X W,|(outsideLaw X W hW hX).real {y} * (law Xp W hW hXp:Measure ℕ).real {p | y∈E ∧ (p:ℤ)+slot y∈A y}- (outsideLaw X W hW hX).real {y} * (law Xp W hW hXp:Measure ℕ).real {p | y∈E ∧ (p:ℤ)∈A y}| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ y∈outsideDomain X W,(outsideLaw X W hW hX).real {y} * (4*(W:ℝ)*B/Xp) := by apply Finset.sum_le_sum intro y hy rw [←mul_sub,abs_mul,abs_of_nonneg measureReal_nonneg] apply mul_le_mul_of_nonneg_left _ measureReal_nonneg by_cases hey : y∈E · simp only [hey,true_and] apply (law_shift_event Xp W hW hXp (slot y) (hslot y hy).1 (A y)).trans exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (hslot y hy).2 (by positivity)) (by positivity) · simp only [hey,false_and,Set.ofPred_false,measureReal_empty,sub_self,abs_zero] positivity _ = _ := by rw [←Finset.sum_mul,outside_weights_sum,one_mul]
end SourceJointShiftend
noncomputable sectionnamespace SourcePivotExtensionopen MeasureTheory ProductExposureLaw ProductExposureLabels RoughFaceShift RawHarmonicProbabilityopen scoped BigOperatorsattribute [local instance] Classical.propDecidable def conditioningLabel {m : ℕ} (M J : ℕ) (z : (Fin m→ℕ)×ℕ) := (z.1,(z.2/(M*J),z.2%M))def conditioningCell {m : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ) (z : (Fin m→ℕ)×ℕ) : Finset ((Fin m→ℕ)×ℕ) := (fullDomain X Xp W).filter (fun u=>conditioningLabel M J u=conditioningLabel M J z)def slotEvent {m V : ℕ} (slot : Fin V→(Fin m→ℕ)→ℤ) (A : (Fin m→ℕ)→Set ℤ) : Set ((Fin m→ℕ)×ℕ) := {z | ∃ v,(z.2:ℤ)+slot v z.1∈A z.1}
def conditionalSlotMass {m V : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (slot : Fin V→(Fin m→ℕ)→ℤ) (A : (Fin m→ℕ)→Set ℤ) (z : (Fin m→ℕ)×ℕ) : ℝ := (jointLaw X Xp W hW hX hXp).real (slotEvent slot A ∩ (conditioningCell X Xp W M J z:Set _)) / (jointLaw X Xp W hW hX hXp).real (conditioningCell X Xp W M J z:Set _)
private lemma finite_real {α : Type*} [MeasurableSpace α] [MeasurableSingletonClass α] (μ : Measure α) [IsFiniteMeasure μ] (S : Finset α) (A : Set α) : μ.real (A∩(S:Set α))=∑ x∈S,if x∈A then μ.real {x} else 0 := by classical have he : A∩(S:Set α)=(S.filter (fun x=>x∈A):Set α) := by ext x; simp [and_comm] rw [he,←sum_measureReal_singleton,Finset.sum_filter]
private lemma finite_ratio_bound {α β : Type*} [DecidableEq α] [DecidableEq β] (S : Finset α) (w : α→ℝ) (hw : ∀ x∈S,0≤w x) (π : α→β) (E : Set β) (A : Set α) (c : ℝ) (hc : 0≤c) : c*((∑ x∈S,if π x∈E then w x else 0)- ∑ x∈S,if (∑ y∈S.filter (fun y=>π y=π x),if y∈A then w y else 0)/ (∑ y∈S.filter (fun y=>π y=π x),w y)≤c then w x else 0) ≤ ∑ x∈S,if π x∈E ∧ x∈A then w x else 0 := by classical let d (i : β) := ∑ y∈S.filter (fun y=>π y=i),w y let n (i : β) := ∑ y∈S.filter (fun y=>π y=i),if y∈A then w y else 0 let G : Set β := {i | i∈E ∧ c<n i/d i} let T := (S.image π).filter (·∈G) have hf : S.filter (fun x=>π x∈T)=S.filter (fun x=>π x∈G) := by ext x simp only [Finset.mem_filter,T] constructor · exact fun h=>⟨h.1,h.2.2⟩ · exact fun h=>⟨h.1,Finset.mem_image_of_mem π h.1,h.2⟩ have hs : c*(∑ x∈S.filter (fun x=>π x∈G),w x) ≤ ∑ x∈S,if π x∈E ∧ x∈A then w x else 0 := by calc _ = ∑ i∈T,c*d i := by rw [←Finset.mul_sum,Finset.sum_fiberwise_eq_sum_filter,hf] _ ≤ ∑ i∈T,∑ x∈S.filter (fun x=>π x=i),if π x∈E ∧ x∈A then w x else 0 := by apply Finset.sum_le_sum intro i hi have hg : i∈E ∧ c<n i/d i := (Finset.mem_filter.mp hi).2 have hd : 0≤d i := Finset.sum_nonneg (fun y hy=>hw y (Finset.mem_filter.mp hy).1) have hn : 0≤n i := Finset.sum_nonneg (by intro y hy; split_ifs; exact hw y (Finset.mem_filter.mp hy).1; rfl) have hh : c*d i≤n i := by rcases eq_or_lt_of_le hd with h0|h0 · rw [←h0,mul_zero]; exact hn · exact le_of_lt ((lt_div_iff₀ h0).mp hg.2) apply hh.trans_eq apply Finset.sum_congr rfl intro x hx simp only [(Finset.mem_filter.mp hx).2,hg.1,true_and] _ = ∑ x∈S.filter (fun x=>π x∈G),if π x∈E ∧ x∈A then w x else 0 := by rw [Finset.sum_fiberwise_eq_sum_filter,hf] _ ≤ _ := by apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _) intro x hx _ split_ifs · exact hw x hx · rfl apply le_trans ?_ hs apply mul_le_mul_of_nonneg_left _ hc rw [Finset.sum_filter,←Finset.sum_sub_distrib] apply Finset.sum_le_sum intro x hx change (if π x∈E then w x else 0)-(if n (π x)/d (π x)≤c then w x else 0) ≤ if π x∈G then w x else 0 by_cases he : π x∈E <;> by_cases hb : n (π x)/d (π x)≤c · simp [he,hb,G,not_lt.mpr hb] · simp [he,hb,G,lt_of_not_ge hb] · simp [he,hb,G,hw x hx] · simp [he,hb,G]
private lemma support_ae {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) : ∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z∈fullDomain X Xp W := by have ho : ∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z.1∈outsideDomain X W := (measurePreserving_fst (μ:=outsideLaw X W hW hX) (ν:=(law Xp W hW hXp:Measure ℕ))).quasiMeasurePreserving.ae (outside_ae_domain X W hW hX) have hp : ∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z.2∈units Xp W := (measurePreserving_snd (μ:=outsideLaw X W hW hX) (ν:=(law Xp W hW hXp:Measure ℕ))).quasiMeasurePreserving.ae (law_ae_units Xp W hW hXp) filter_upwards [ho,hp] with z ho hp exact Finset.mem_filter.mpr ⟨Finset.mem_product.mpr ⟨ho,(Finset.mem_filter.mp hp).1⟩,(Finset.mem_filter.mp hp).2⟩
private lemma joint_real {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (A : Set ((Fin m→ℕ)×ℕ)) : (jointLaw X Xp W hW hX hXp).real A= ∑ z∈fullDomain X Xp W,if z∈A then (jointLaw X Xp W hW hX hXp).real {z} else 0 := by rw [←finite_real] apply measureReal_congr filter_upwards [support_ae X Xp W hW hX hXp] with z hz exact propext ⟨fun h=>⟨h,hz⟩,fun h=>h.1⟩
private lemma conditional_mass_sum {m V : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (slot : Fin V→(Fin m→ℕ)→ℤ) (A : (Fin m→ℕ)→Set ℤ) (z : (Fin m→ℕ)×ℕ) : conditionalSlotMass X Xp W M J hW hX hXp slot A z= (∑ y∈(fullDomain X Xp W).filter (fun y=>conditioningLabel M J y=conditioningLabel M J z), if y∈slotEvent slot A then (jointLaw X Xp W hW hX hXp).real {y} else 0)/ (∑ y∈(fullDomain X Xp W).filter (fun y=>conditioningLabel M J y=conditioningLabel M J z), (jointLaw X Xp W hW hX hXp).real {y}) := by unfold conditionalSlotMass rw [finite_real,←sum_measureReal_singleton] rfl
private lemma conditional_extension {m V : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (E : Set (Fin m→ℕ)) (A : (Fin m→ℕ)→Set ℤ) (slot : Fin V→(Fin m→ℕ)→ℤ) (c : ℝ) (hc : 0≤c) : c*((jointLaw X Xp W hW hX hXp).real {z | z.1∈E} - (jointLaw X Xp W hW hX hXp).real {z | conditionalSlotMass X Xp W M J hW hX hXp slot A z≤c}) ≤ (jointLaw X Xp W hW hX hXp).real {z | z.1∈E ∧ z∈slotEvent slot A} := by have hh:=finite_ratio_bound (fullDomain X Xp W) (fun z=>(jointLaw X Xp W hW hX hXp).real {z}) (fun _ _=>measureReal_nonneg) (conditioningLabel M J) {i | i.1∈E} (slotEvent slot A) c hc rw [joint_real X Xp W hW hX hXp,joint_real X Xp W hW hX hXp, joint_real X Xp W hW hX hXp] simp only [Set.mem_ofPred_eq,conditional_mass_sum] simp only [Set.mem_ofPred_eq,conditioningLabel] at hh apply hh.trans_eq apply Finset.sum_congr rfl intro point _ exact (ite_eq_ite _ _ _).mpr trivial
theorem raw_pivot_extension {m V : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (E : Set (Fin m→ℕ)) (A : (Fin m→ℕ)→Set ℤ) (slot : Fin V→(Fin m→ℕ)→ℤ) (B c : ℝ) (hB : 0≤B) (hc : 0≤c) (hslot : ∀ v y,y∈outsideDomain X W → (W:ℤ)∣slot v y ∧ |(slot v y:ℝ)|≤B) : c*((jointLaw X Xp W hW hX hXp).real {z | z.1∈E} - (jointLaw X Xp W hW hX hXp).real {z | conditionalSlotMass X Xp W M J hW hX hXp slot A z≤c}) ≤ (V:ℝ)*((jointLaw X Xp W hW hX hXp).real {z | z.1∈E ∧ (z.2:ℤ)∈A z.1}+ 4*(W:ℝ)*B/Xp) := by have hh:=conditional_extension X Xp W M J hW hX hXp E A slot c hc apply hh.trans let F : Fin V→Set ((Fin m→ℕ)×ℕ) := fun v=>{z | z.1∈E ∧ (z.2:ℤ)+slot v z.1∈A z.1} have he : {z : (Fin m→ℕ)×ℕ | z.1∈E ∧ z∈slotEvent slot A}=⋃ v,F v := by ext z simp only [Set.mem_ofPred_eq,slotEvent,Set.mem_iUnion,F] aesop rw [he] calc _ ≤ ∑ v,(jointLaw X Xp W hW hX hXp).real (F v) := measureReal_iUnion_fintype_le F _ ≤ ∑ _v : Fin V,((jointLaw X Xp W hW hX hXp).real {z | z.1∈E ∧ (z.2:ℤ)∈A z.1}+4*(W:ℝ)*B/Xp) := by apply Finset.sum_le_sum intro v hv have h:=(abs_le.mp (SourceJointShift.raw_joint_shift X Xp W hW hX hXp E A (slot v) B hB (hslot v))).2 change (jointLaw X Xp W hW hX hXp).real {z | z.1∈E ∧ (z.2:ℤ)+slot v z.1∈A z.1}≤_ linarith _ = _ := by simp; ring
end SourcePivotExtension
endend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.IntegerArrays14import OAI.Combinatorics.SumProduct.Alignment.PivotExtension01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
open scoped BigOperatorssectionnoncomputable sectionend
noncomputable sectionnamespace SourcePivotExtensionopen MeasureTheory ProductExposureLaw ProductExposureLabels RoughFaceShift RawHarmonicProbabilityopen SourceIntegerArraysopen scoped BigOperatorsattribute [local instance] Classical.propDecidable
private lemma unit_atom_pos (X W : ℕ) (hW : 0<W) (hX : 4*W≤X) (p : ℕ) (hp : p∈units X W) : 0<(law X W hW hX:Measure ℕ).real {p} := by have hp0 : 0<p := by have ht:=(Finset.mem_Ico.mp (Finset.mem_filter.mp hp).1).1 omega rw [MicrocellConditional.law_apply_units] have he : MicrocellConditional.eventMass (units X W) {p}=(p:ℝ)⁻¹ := by simp [MicrocellConditional.eventMass,hp] rw [he] exact div_pos (inv_pos.mpr (by exact_mod_cast hp0)) (mass_pos X W hW hX)
private lemma outside_atom_pos {m : ℕ} (X : Fin m→ℕ) (W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (y : Fin m→ℕ) (hy : y∈outsideDomain X W) : 0<(outsideLaw X W hW hX).real {y} := by simp only [outsideLaw,measureReal_def,Measure.pi_singleton,ENNReal.toReal_prod] apply Finset.prod_pos intro j hj exact unit_atom_pos (X j) W hW (hX j) (y j) (Fintype.mem_piFinset.mp hy j)
private lemma label_source_cell (M J p q : ℕ) (hM : 0<M) (hJ : 0<J) : q∈sourceCell M J p ↔ q/(M*J)=p/(M*J) ∧ q%M=p%M := by unfold sourceCell MicrocellFibers.fiber simp only [Finset.mem_filter,Finset.mem_Ico] have hw:=MicrocellSaturation.quotient_window (M*J) q (Nat.mul_pos hM hJ) constructor · rintro ⟨⟨hlo,hhi⟩,hr⟩ exact ⟨Nat.div_eq_of_lt_le (by nlinarith) (by nlinarith),hr⟩ · rintro ⟨hq,hr⟩ rw [hq] at hw exact ⟨⟨by nlinarith [hw.1],by nlinarith [hw.2]⟩,hr⟩
private lemma full_support_mem {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (u : (Fin m→ℕ)×ℕ) : u∈fullDomain X Xp W ↔ u.1∈outsideDomain X W ∧ u.2∈units Xp W := by rcases u with ⟨y,p⟩ simp only [fullDomain,rawDomain,outsideDomain,units,Finset.mem_filter,Finset.product_eq_sprod,Finset.mem_product] tauto
private lemma raw_cell_product {m : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ) (z : (Fin m→ℕ)×ℕ) (hz : z.1∈outsideDomain X W) : (conditioningCell X Xp W M J z:Set _)={z.1} ×ˢ (((units Xp W).filter (fun p=>p/(M*J)=z.2/(M*J) ∧ p%M=z.2%M)):Set ℕ) := by ext u simp only [Finset.mem_coe,conditioningCell,Finset.mem_filter] rw [full_support_mem] simp only [conditioningLabel,Prod.mk.injEq,Set.mem_prod,Set.mem_singleton_iff, Finset.mem_coe,Finset.mem_filter] constructor · rintro ⟨⟨hu,hp⟩,hy,hq,hr⟩ exact ⟨hy,hp,hq,hr⟩ · rintro ⟨hy,hp,hq,hr⟩ exact ⟨⟨hy.symm ▸ hz,hp⟩,hy,hq,hr⟩
private lemma joint_rectangle_real {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (y : Fin m→ℕ) (S : Set ℕ) : (jointLaw X Xp W hW hX hXp).real ({y}×ˢS)= (outsideLaw X W hW hX).real {y}*(law Xp W hW hXp:Measure ℕ).real S := by change ((outsideLaw X W hW hX).prod (law Xp W hW hXp:Measure ℕ)).real ({y}×ˢS)=_ rw [measureReal_def,Measure.prod_prod,ENNReal.toReal_mul] rfl
theorem conditional_slot_source_ratio {m V : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (hM : 0<M) (hJ : 0<J) (z : (Fin m→ℕ)×ℕ) (hz : z.1∈outsideDomain X W) (slot : Fin V→(Fin m→ℕ)→ℤ) (A : (Fin m→ℕ)→Set ℤ) : conditionalSlotMass X Xp W M J hW hX hXp slot A z= cellRatio Xp W M J z.2 hW hXp {k | (z.1,MicrocellFibers.point M (J*(z.2/(M*J))) (z.2%M) k)∈slotEvent slot A} := by let F : Finset ℕ := (units Xp W).filter (fun p=>p/(M*J)=z.2/(M*J) ∧ p%M=z.2%M) let C : Set ℕ := {p | (z.1,p)∈slotEvent slot A} let ν : Measure ℕ := (law Xp W hW hXp:Measure ℕ) have heC : (conditioningCell X Xp W M J z:Set _)={z.1}×ˢ(F:Set ℕ) := raw_cell_product X Xp W M J z hz have heN : slotEvent slot A ∩ (conditioningCell X Xp W M J z:Set _) = {z.1}×ˢ(C∩(F:Set ℕ)) := by rw [heC] ext u simp only [Set.mem_inter_iff,Set.mem_prod,Set.mem_singleton_iff] constructor · rintro ⟨hu,hy,hp⟩ have he : u=(z.1,u.2):=Prod.ext hy rfl exact ⟨hy,(congrArg (fun t=>t∈slotEvent slot A) he).mp hu,hp⟩ · rintro ⟨hy,hu,hp⟩ have he : u=(z.1,u.2):=Prod.ext hy rfl exact ⟨(congrArg (fun t=>t∈slotEvent slot A) he).mpr hu,hy,hp⟩ have hr : conditionalSlotMass X Xp W M J hW hX hXp slot A z= ν.real (C∩(F:Set ℕ))/ν.real (F:Set ℕ) := by unfold conditionalSlotMass rw [heN,heC,joint_rectangle_real,joint_rectangle_real] exact mul_div_mul_left _ _ (outside_atom_pos X W hW hX z.1 hz).ne' have hF : (F:Set ℕ)=(units Xp W:Set ℕ)∩(sourceCell M J z.2:Set ℕ) := by ext p simp only [F,Finset.mem_coe,Finset.mem_filter,Set.mem_inter_iff, label_source_cell M J z.2 p hM hJ] have hf : ν.real (F:Set ℕ)=ν.real (sourceCell M J z.2:Set ℕ) := by rw [hF] apply measureReal_congr filter_upwards [law_ae_units Xp W hW hXp] with p hp exact propext ⟨fun h=>h.2,fun h=>⟨hp,h⟩⟩ have hn : ν.real (C∩(F:Set ℕ))=ν.real (C∩(sourceCell M J z.2:Set ℕ)) := by rw [hF] apply measureReal_congr filter_upwards [law_ae_units Xp W hW hXp] with p hp exact propext ⟨fun h=>⟨h.1,h.2.2⟩,fun h=>⟨h.1,hp,h.2⟩⟩ have himage : (MicrocellFibers.point M (J*(z.2/(M*J))) (z.2%M) '' {k | (z.1,MicrocellFibers.point M (J*(z.2/(M*J))) (z.2%M) k)∈slotEvent slot A}) ∩ (sourceCell M J z.2:Set ℕ) = C∩(sourceCell M J z.2:Set ℕ) := by ext p constructor · rintro ⟨⟨k,hk,rfl⟩,hp⟩ exact ⟨hk,hp⟩ · rintro ⟨hp,hC⟩ obtain ⟨k,hk⟩:=MicrocellFibers.represent M J (J*(z.2/(M*J))) (z.2%M) p hM hC refine ⟨⟨k.val,?_,hk⟩,hC⟩ change (z.1,MicrocellFibers.point M (J*(z.2/(M*J))) (z.2%M) k.val)∈slotEvent slot A rw [hk] exact hp rw [hr,hf,hn] unfold cellRatio rw [himage]
end SourcePivotExtensionend
noncomputable sectionnamespace SourceIntegerArrays.GlobalJoint.SourceFrozenFamilyopen ProductExposureLabels SourceExposureSlots SourceResidueAlignment ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmeticopen ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScales ConstructedWordPlan.RationalPivotPlanopen scoped BigOperators BoundedContinuousFunctionattribute [local instance] Classical.propDecidablevariable {a : ℕ} (D : Pivot a)variable (s r : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (q₀ : ℕ) (b₀ : Scale a)local notation "I" => FiniteModelSlots.Index D s r hs Fs q₀ b₀variable (G₀ : Fin D.targets→ℚ→Fin r→Type)variable [∀ t v c,Group (G₀ t v c)] [∀ t v c,TopologicalSpace (G₀ t v c)]variable (Γ₀ : ∀ t v c,Subgroup (G₀ t v c))variable (M J R H : ℕ→ℕ) (L : ℕ→ℤ) (C : ℕ→Fin D.pairs→ℤ)variable (g₀ x₀ : ∀ t,ℕ→(Fin (h D t)→ℕ)→∀ v c,ℤ→ℤ→G₀ t v c)variable (obs₀ : ∀ t,ℕ→(Fin (h D t)→ℕ)→∀ v c,ℤ→ℤ→((G₀ t v c)⧸Γ₀ t v c) →ᵇ ℝ)variable (ht : ℕ→Fin a→ℤ)open MeasureTheory SourcePivotExtension RawHarmonicProbability ProductExposureLawabbrev slotCount := Fintype.card {v : Slots D // v∈slots D s r hs Fs q₀ b₀}def rawSlot (N : ℕ) (v : Fin (slotCount D s r hs Fs q₀ b₀)) (u : Fin a→ℕ) : ℤ := slotValue D (L N) (heightCoeff D q₀ ht N) (fun j=>(u j:ℤ)) ((Fintype.equivFin {v : Slots D // v∈slots D s r hs Fs q₀ b₀}).symm v).valdef pivotSet (N : ℕ) (τ : ℝ) (u : Fin a→ℕ) : Set ℤ := {x | 0<x ∧ pivotProperty D s r hs Fs b₀ G₀ Γ₀ M H g₀ x₀ obs₀ ht N u x.toNat τ}
theorem source_posterior_domination (N w : ℕ) (z : (Fin a→ℕ)×ℕ) (X : Fin a→ℕ) (Xp : ℕ) (hW : 0<primorial w) (hX : ∀ j,4*primorial w≤X j) (hXp : 4*primorial w≤Xp) (hz : z.1∈outsideDomain X (primorial w)) (hM : 0<M N) (hJ : 0<J N) (hq₀ : 0<q₀) (hQq : terminalDenom D s r hs Fs b₀∣q₀) (hw : q₀+1≤w) (hL : 0<L N) (hWL : (primorial w:ℤ)∣L N) (hML : (M N:ℤ)∣L N) (hu : ∀ j,IsCoprime (z.1 j:ℤ) (L N)) (hd : ∀ e,Disjoint (D.added e) (D.tail (D.owner e))) (hb₀ : ∀ j,0<b₀ j) (hFs : ∀ b∈Fs,∀ j,0<b j) (hht : ∀ j,0<ht N j) (hratio : ∀ e,∃ d : ℤ,height (ht N) (D.added e)= height (ht N) (block D.index D.tail (D.owner e))*((primorial w:ℤ)^w*d)) (hlarge : ∀ v∈slots D s r hs Fs q₀ b₀,(∑ e,|v e|)*L N<(Xp:ℤ)) (τ : ℝ) : let C:=heightCoeff D q₀ ht let d:=family D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L C g₀ x₀ obs₀ cellRatio Xp (primorial w) (M N) (J N) z.2 hW hXp {k | ((d.atTime N).localModel z).modelSuccess (coord D) (k:ℤ) s r hs (FiniteModelSlots.formula D s r hs Fs q₀ b₀) Fs q₀ b₀ τ} ≤ conditionalSlotMass X Xp (primorial w) (M N) (J N) hW hX hXp (rawSlot D s r hs Fs q₀ b₀ L ht N) (pivotSet D s r hs Fs b₀ G₀ Γ₀ M H g₀ x₀ obs₀ ht N τ) z := by dsimp only let d:=family D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L (heightCoeff D q₀ ht) g₀ x₀ obs₀ let S : Set ℕ:={k | ((d.atTime N).localModel z).modelSuccess (coord D) (k:ℤ) s r hs (FiniteModelSlots.formula D s r hs Fs q₀ b₀) Fs q₀ b₀ τ} let slot:=rawSlot D s r hs Fs q₀ b₀ L ht N let A:=pivotSet D s r hs Fs b₀ G₀ Γ₀ M H g₀ x₀ obs₀ ht N τ let f:=MicrocellFibers.point (M N) (J N*(z.2/(M N*J N))) (z.2%M N) let ν:Measure ℕ:=(law Xp (primorial w) hW hXp:Measure ℕ) change cellRatio Xp (primorial w) (M N) (J N) z.2 hW hXp S ≤ conditionalSlotMass X Xp (primorial w) (M N) (J N) hW hX hXp slot A z rw [conditional_slot_source_ratio X Xp (primorial w) (M N) (J N) hW hX hXp hM hJ z hz slot A] unfold cellRatio apply div_le_div_of_nonneg_right _ measureReal_nonneg change ν.real ((f '' S)∩(sourceCell (M N) (J N) z.2:Set ℕ)) ≤ ν.real ((f '' {k | (z.1,f k)∈slotEvent slot A})∩(sourceCell (M N) (J N) z.2:Set ℕ)) have he : ν.real ((f '' S)∩(sourceCell (M N) (J N) z.2:Set ℕ))= ν.real (((f '' S)∩(sourceCell (M N) (J N) z.2:Set ℕ))∩(units Xp (primorial w):Set ℕ)) := by apply measureReal_congr filter_upwards [law_ae_units Xp (primorial w) hW hXp] with p hp exact propext ⟨fun h=>⟨h,hp⟩,fun h=>h.1⟩ rw [he] refine measureReal_mono ?_ (by finiteness) rintro p ⟨⟨⟨k,hk,hkp⟩,hcell⟩,hpunit⟩ refine ⟨⟨k,?_,hkp⟩,hcell⟩ have hpge : (Xp:ℤ)≤(p:ℤ) := by exact_mod_cast (Finset.mem_Ico.mp (Finset.mem_filter.mp hpunit).1).1 have hpform : (p:ℤ)=firstPivot (M N) (J N) z.2+(M N:ℤ)*(k:ℤ) := by rw [←hkp,firstPivot_eq_point] simp only [f,MicrocellFibers.point,Nat.cast_add,Nat.cast_mul,mul_zero,add_zero] have hread:=source_pivot_reading D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L g₀ x₀ obs₀ ht N w z k p hq₀ hQq hw hL hWL hML hu hd hb₀ hFs hht hratio hpform (fun v hv=>(hlarge v hv).trans_le hpge) τ obtain ⟨v,hv,hpos,hprop⟩:=hread hk let vv : {v : Slots D // v∈slots D s r hs Fs q₀ b₀}:=⟨v,hv⟩ change ∃ j,(f k:ℤ)+slot j z.1∈A z.1 refine ⟨(Fintype.equivFin _ ) vv,?_⟩ dsimp only [slot,rawSlot] rw [Equiv.symm_apply_apply,hkp] exact ⟨hpos,hprop⟩
end SourceIntegerArrays.GlobalJoint.SourceFrozenFamilyend
noncomputable sectionnamespace SourceIntegerArrays.GlobalJoint.SourceFrozenFamilyopen ProductExposureLabels SourceExposureSlots SourceResidueAlignment ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmeticopen ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScales ConstructedWordPlan.RationalPivotPlanopen scoped BigOperators BoundedContinuousFunctionattribute [local instance] Classical.propDecidablevariable {a : ℕ} (D : Pivot a)variable (s r : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (q₀ : ℕ) (b₀ : Scale a)local notation "I" => FiniteModelSlots.Index D s r hs Fs q₀ b₀variable (G₀ : Fin D.targets→ℚ→Fin r→Type)variable [∀ t v c,Group (G₀ t v c)] [∀ t v c,TopologicalSpace (G₀ t v c)]variable (Γ₀ : ∀ t v c,Subgroup (G₀ t v c))variable (M J R H : ℕ→ℕ) (L : ℕ→ℤ) (C : ℕ→Fin D.pairs→ℤ)variable (g₀ x₀ : ∀ t,ℕ→(Fin (h D t)→ℕ)→∀ v c,ℤ→ℤ→G₀ t v c)variable (obs₀ : ∀ t,ℕ→(Fin (h D t)→ℕ)→∀ v c,ℤ→ℤ→((G₀ t v c)⧸Γ₀ t v c) →ᵇ ℝ)variable (ht : ℕ→Fin a→ℤ)open MeasureTheory SourcePivotExtension RawHarmonicProbability ProductExposureLaw
def slotBudget : ℤ := ∑ v∈slots D s r hs Fs q₀ b₀,∑ e,|v e|
theorem source_actual_extension (N w : ℕ) (X : Fin a→ℕ) (Xp : ℕ) (hW : 0<primorial w) (hX : ∀ j,4*primorial w≤X j) (hXp : 4*primorial w≤Xp) (hM : 0<M N) (hJ : 0<J N) (hq₀ : 0<q₀) (hQq : terminalDenom D s r hs Fs b₀∣q₀) (hw : q₀+1≤w) (hL : 0<L N) (hsm : RoughScales.Smooth w (L N)) (hWL : (primorial w:ℤ)∣L N) (hML : (M N:ℤ)∣L N) (hd : ∀ e,Disjoint (D.added e) (D.tail (D.owner e))) (hb₀ : ∀ j,0<b₀ j) (hFs : ∀ b∈Fs,∀ j,0<b j) (hht : ∀ j,0<ht N j) (hratio : ∀ e,∃ d : ℤ,height (ht N) (D.added e)= height (ht N) (block D.index D.tail (D.owner e))*((primorial w:ℤ)^w*d)) (hlarge : slotBudget D s r hs Fs q₀ b₀*L N<(Xp:ℤ)) (τ c : ℝ) (hc : 0≤c) (E : Set (Fin a→ℕ)) : let C:=heightCoeff D q₀ ht let d:=family D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L C g₀ x₀ obs₀ let μ:=jointLaw X Xp (primorial w) hW hX hXp c*(μ.real {z | z.1∈E}-μ.real {z | cellRatio Xp (primorial w) (M N) (J N) z.2 hW hXp {k | ((d.atTime N).localModel z).modelSuccess (coord D) (k:ℤ) s r hs (FiniteModelSlots.formula D s r hs Fs q₀ b₀) Fs q₀ b₀ τ}≤c}) ≤ (slotCount D s r hs Fs q₀ b₀:ℝ)* (μ.real {z | z.1∈E ∧ pivotProperty D s r hs Fs b₀ G₀ Γ₀ M H g₀ x₀ obs₀ ht N z.1 z.2 τ}+ 4*(primorial w:ℝ)*(slotBudget D s r hs Fs q₀ b₀:ℝ)*(L N:ℝ)/Xp) := by dsimp only let d:=family D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L (heightCoeff D q₀ ht) g₀ x₀ obs₀ let μ:=jointLaw X Xp (primorial w) hW hX hXp let slot:=rawSlot D s r hs Fs q₀ b₀ L ht N let A:=pivotSet D s r hs Fs b₀ G₀ Γ₀ M H g₀ x₀ obs₀ ht N τ let B:ℝ:=(slotBudget D s r hs Fs q₀ b₀:ℝ)*(L N:ℝ) let bad : Set ((Fin a→ℕ)×ℕ):={z | cellRatio Xp (primorial w) (M N) (J N) z.2 hW hXp {k | ((d.atTime N).localModel z).modelSuccess (coord D) (k:ℤ) s r hs (FiniteModelSlots.formula D s r hs Fs q₀ b₀) Fs q₀ b��� τ}≤c} have hbudget0 : 0 ≤ slotBudget D s r hs Fs q₀ b₀:= Finset.sum_nonneg (fun v hv=>Finset.sum_nonneg (fun e he=>abs_nonneg _)) have hbudget (v : Slots D) (hv : v∈slots D s r hs Fs q₀ b₀) : (∑ e,|v e|) ≤ slotBudget D s r hs Fs q₀ b₀:= by unfold slotBudget exact Finset.single_le_sum (f:=fun v : Slots D=>∑ e,|v e|) (fun v hv=>Finset.sum_nonneg (fun e he=>abs_nonneg (v e))) hv have hB : 0≤B:=mul_nonneg (by exact_mod_cast hbudget0) (by exact_mod_cast hL.le) have hunits (y : Fin a→ℕ) (hy : y∈outsideDomain X (primorial w)) (j : Fin a) : IsCoprime (y j:ℤ) (L N) := by have hj:=(Finset.mem_filter.mp (Fintype.mem_piFinset.mp hy j)).2 apply (RoughScales.coprime_smooth_rough hsm _).symm apply (RoughScales.rough_iff_coprime w (y j:ℤ)).mpr simpa only [Int.natAbs_natCast] using hj.symm have ht₁:=(source_terminal_arithmetic D (outcomeScales D s r hs Fs b₀)).choose_spec.2 q₀ hq₀ hQq w hw 1 (by simp [outcomeScales]) (by intro j;exact zero_lt_one) (ht N) (fun _=>1) hht hratio have hcoeff : ∀ e,(primorial w:ℤ)∣heightCoeff D q₀ ht N e := by intro e simpa [heightCoeff,coefficient,height] using ht₁.1 e have hslot : ∀ v y,y∈outsideDomain X (primorial w) → (primorial w:ℤ)∣slot v y ∧ |(slot v y:ℝ)|≤B := by intro i y hy let v:=((Fintype.equivFin {v : Slots D // v∈slots D s r hs Fs q₀ b₀}).symm i).val have hv : v∈slots D s r hs Fs q₀ b₀:=((Fintype.equivFin _).symm i).property change (primorial w:ℤ)∣slotValue D (L N) (heightCoeff D q₀ ht N) (fun j=>(y j:ℤ)) v ∧ _ by_cases hn : Nonempty (Fin D.targets) · let t:=Classical.choice hn have hh:=(source_exposure_slots D (L N) (primorial w:ℤ) hL hWL (heightCoeff D q₀ ht N) hcoeff (fun j=>(y j:ℤ)) (fun j=>(y j:ℤ)) (hunits y hy) t (fun j hj=>Int.ModEq.refl _) (fun j hj=>rfl) hd).2.2 v refine ⟨hh.2.1,?_⟩ have hbi:=hh.2.2.trans (mul_le_mul_of_nonneg_right (hbudget v hv) hL.le) change |(slotValue D (L N) (heightCoeff D q₀ ht N) (fun j=>(y j:ℤ)) v:ℝ)|≤_ dsimp only [B] exact_mod_cast hbi · let : IsEmpty (Fin D.pairs):=⟨fun e=>hn ⟨D.owner e⟩⟩ simp only [slotValue,Finset.univ_eq_empty,Finset.sum_empty,dvd_zero,true_and] change |((∑ e,v e*rValue D (L N) (heightCoeff D q₀ ht N) (fun j=>(y j:ℤ)) e:ℤ):ℝ)|≤B simpa using hB have ho : ∀ᵐ z ∂μ,z.1∈outsideDomain X (primorial w) := (measurePreserving_fst (μ:=outsideLaw X (primorial w) hW hX) (ν:=(law Xp (primorial w) hW hXp:Measure ℕ))).quasiMeasurePreserving.ae (outside_ae_domain X (primorial w) hW hX) have hbad : μ.real {z | conditionalSlotMass X Xp (primorial w) (M N) (J N) hW hX hXp slot A z≤c}≤μ.real bad := by apply ENNReal.toReal_mono (by finiteness) apply measure_mono_ae filter_upwards [ho] with z hz intro hpost have hh:=source_posterior_domination D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L g₀ x₀ obs₀ ht N w z X Xp hW hX hXp hz hM hJ hq₀ hQq hw hL hWL hML (hunits z.1 hz) hd hb₀ hFs hht hratio (fun v hv=>(mul_le_mul_of_nonneg_right (hbudget v hv) hL.le).trans_lt hlarge) τ exact hh.trans hpost have hh:=raw_pivot_extension X Xp (primorial w) (M N) (J N) hW hX hXp E A slot B c hB hc hslot change c*(μ.real {z | z.1∈E}-μ.real bad)≤_ apply le_trans (mul_le_mul_of_nonneg_left (sub_le_sub_left hbad _) hc) apply hh.trans apply mul_le_mul_of_nonneg_left _ (by positivity) have hp : μ.real {z | z.1∈E ∧ (z.2:ℤ)∈A z.1}≤ μ.real {z | z.1∈E ∧ pivotProperty D s r hs Fs b₀ G₀ Γ₀ M H g₀ x₀ obs₀ ht N z.1 z.2 τ} := by refine measureReal_mono ?_ (by finiteness) rintro z ⟨hz,hp⟩ exact ⟨hz,hp.2⟩ have he : 4*(primorial w:ℝ)*B/Xp=4*(primorial w:ℝ)*(slotBudget D s r hs Fs q₀ b₀:ℝ)*(L N:ℝ)/Xp := by dsimp [B] ring rw [he] exact add_le_add hp le_rfl
end SourceIntegerArrays.GlobalJoint.SourceFrozenFamily
endend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.IntegerArrays14import OAI.Geometry.NilpotentCharts.Main
namespace OAI
open scoped BigOperatorssectionnoncomputable sectionopen scoped BigOperators BoundedContinuousFunction Topology NNReal ENNRealend
noncomputable sectionopen Filter MeasureTheoryopen scoped BigOperators ENNReal Topologynamespace SourceRawPrefixvariable {n : ℕ}
def Earlier (i : Fin n) (E : Set (Fin n → ℕ)) : Prop := ∀ u v, (∀ j, j < i → u j = v j) → (u ∈ E ↔ v ∈ E)
def Through (i : Fin n) (E : Set (Fin n → ℕ)) : Prop := ∀ u v, (∀ j, j ≤ i → u j = v j) → (u ∈ E ↔ v ∈ E)
lemma Earlier.update_iff {i : Fin n} {E : Set (Fin n → ℕ)} (hE : Earlier i E) (u : Fin n → ℕ) (x : ℕ) : Function.update u i x ∈ E ↔ u ∈ E := by apply hE intro j hj exact Function.update_of_ne (ne_of_lt hj) _ _
lemma Through.earlier {i j : Fin n} {E : Set (Fin n → ℕ)} (hE : Through i E) (hij : i < j) : Earlier j E := by intro u v huv apply hE intro k hk exact huv k (hk.trans_lt hij)
lemma earlier_univ (i : Fin n) : Earlier i Set.univ := by intro u v h simp
lemma through_inter {i : Fin n} {E F : Set (Fin n → ℕ)} (hE : Through i E) (hF : Through i F) : Through i (E ∩ F) := by intro u v h exact and_congr (hE u v h) (hF u v h)
theorem resample_preserves (ν : Fin n → Measure ℕ) [∀ i, IsProbabilityMeasure (ν i)] (i : Fin n) : MeasurePreserving (fun z : (Fin n → ℕ) × ℕ => Function.update z.1 i z.2) ((Measure.pi ν).prod (ν i)) (Measure.pi ν) := by refine ⟨measurable_of_countable _, ?_⟩ apply Measure.ext_of_singleton intro u rw [Measure.map_apply (measurable_of_countable _) (measurableSet_singleton _)] have he : (fun z : (Fin n → ℕ) × ℕ => Function.update z.1 i z.2) ⁻¹' {u} = (Set.univ.pi (Function.update (fun j => {u j}) i Set.univ)) ×ˢ {u i} := by ext z simp only [Set.mem_preimage, Set.mem_singleton_iff, Set.mem_prod, Set.mem_pi, Set.mem_univ, forall_true_left] constructor · intro hz constructor · intro j by_cases hji : j = i · subst j; simp · simpa [Function.update_of_ne hji] using congrFun hz j · simpa using congrFun hz i · rintro ⟨hy,hx⟩ ext j by_cases hji : j = i · subst j; simpa using hx · simpa [Function.update_of_ne hji] using hy j rw [he, Measure.prod_prod, Measure.pi_pi, Measure.pi_singleton] have hf : (fun j => ν j (Function.update (fun k : Fin n => ({u k} : Set ℕ)) i (Set.univ : Set ℕ) j)) = Function.update (fun j => ν j {u j}) i 1 := by funext j by_cases hji : j = i · subst j; simp · simp [hji] rw [hf, Finset.prod_update_of_mem (Finset.mem_univ i)] simp only [one_mul] simpa only [Finset.sdiff_singleton_eq_erase] using Finset.prod_erase_mul Finset.univ (fun j => ν j {u j}) (Finset.mem_univ i)
open RawHarmonicProbability ProductExposureLaw
lemma raw_resample (X : Fin n → ℕ) (W : ℕ) (hW : 0 < W) (hX : ∀ j, 4*W ≤ X j) (i : Fin n) : MeasurePreserving (fun z : (Fin n → ℕ) × ℕ => Function.update z.1 i z.2) (jointLaw X (X i) W hW hX (hX i)) (outsideLaw X W hW hX) := resample_preserves (fun j => (law (X j) W hW (hX j) : Measure ℕ)) i
lemma raw_resample_real (X : Fin n → ℕ) (W : ℕ) (hW : 0 < W) (hX : ∀ j, 4*W ≤ X j) (i : Fin n) (E : Set (Fin n → ℕ)) : (jointLaw X (X i) W hW hX (hX i)).real {z | Function.update z.1 i z.2 ∈ E} = (outsideLaw X W hW hX).real E := by apply congrArg ENNReal.toReal exact (raw_resample X W hW hX i).measure_preimage (Set.to_countable E).measurableSet.nullMeasurableSet
end SourceRawPrefix
noncomputable sectionopen scoped BigOperators Topology BoundedContinuousFunctionnamespace SourcePivotPathsopen ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScalesopen ConstructedWordPlan.RationalPivotPlanopen ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmeticopen SourceIntegerArrays.GlobalJoint.SourceFrozenFamilyopen SourceRawPrefixattribute [local instance] Classical.propDecidablevariable {a : ℕ} (D : Pivot a) (r : ℕ)
abbrev ScalarModels := Fin D.targets → ℚ → Fin r → ℤ → ℝ
def comparison (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (u : Fin a → ℕ) (x : ℕ) (τ : ℝ) : Prop := ∀ (t : Fin D.targets) (U : OwnSubset D t) (c : Fin r), let av := blockProduct b (block D.index D.tail t) ∃ Δ : ℤ, (Δ : ℚ) = ∑ e ∈ U.val, ((height ht (D.added e) : ℚ)*blockProduct b (D.added e)/ ((height ht (block D.index D.tail (D.owner e)) : ℚ)* blockProduct b (block D.index D.tail (D.owner e))))* (height (fun j => (u j : ℤ)) (D.added e) : ℚ) ∧ (2*τ < S t av c (height (fun j => (u j : ℤ)) (D.tail t)*(x : ��)) → τ < S t av c (height (fun j => (u j : ℤ)) (D.tail t)*(x : ℤ)+Δ))
def outcome (Fs : Finset (Scale a)) (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (p : Path D) (u : Fin a → ℕ) (x : ℕ) (τ : ℝ) : Prop := ∀ d ∈ Fs, comparison D r S ht (scaleRun D 0 p b*d) u x τ
def success (s : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (u : Fin a → ℕ) (x : ℕ) (τ : ℝ) : Prop := ∃ p ∈ pivotOptions s r hs D Fs, outcome D r Fs S ht b p u x τ
lemma comparison_congr (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (u v : Fin a → ℕ) (huv : ∀ j, j < D.index → u j = v j) (x : ℕ) (τ : ℝ) : comparison D r S ht b u x τ ↔ comparison D r S ht b v x τ := by have ha (e) : height (fun j => (u j : ℤ)) (D.added e) = height (fun j => (v j : ℤ)) (D.added e) := by apply Finset.prod_congr rfl intro j hj exact congrArg (fun m : ℕ => (m : ℤ)) (huv j (D.added_lt e j hj)) have ht' (t) : height (fun j => (u j : ℤ)) (D.tail t) = height (fun j => (v j : ℤ)) (D.tail t) := by apply Finset.prod_congr rfl intro j hj exact congrArg (fun m : ℕ => (m : ℤ)) (huv j (D.tail_lt t j hj)) simp only [comparison, ha, ht']
lemma comparison_through (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (τ : ℝ) : Through D.index {u | comparison D r S ht b u (u D.index) τ} := by intro u v huv change comparison D r S ht b u (u D.index) τ ↔ comparison D r S ht b v (v D.index) τ rw [huv D.index le_rfl] exact comparison_congr D r S ht b u v (fun j hj => huv j hj.le) _ τ
lemma outcome_through (Fs : Finset (Scale a)) (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (p : Path D) (τ : ℝ) : Through D.index {u | outcome D r Fs S ht b p u (u D.index) τ} := by intro u v huv simp only [Set.mem_ofPred_eq, outcome] apply forall_congr' intro d apply forall_congr' intro hd exact comparison_through D r S ht _ τ u v huv
lemma success_through (s : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (τ : ℝ) : Through D.index {u | success D r s hs Fs S ht b u (u D.index) τ} := by intro u v huv simp only [Set.mem_ofPred_eq, success] apply exists_congr intro p apply and_congr_right intro hp exact outcome_through D r Fs S ht b p τ u v huv
lemma success_update_iff (s : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (u : Fin a → ℕ) (x : ℕ) (τ : ℝ) : success D r s hs Fs S ht b (Function.update u D.index x) x τ ↔ success D r s hs Fs S ht b u x τ := by simp only [success, outcome] apply exists_congr intro p apply and_congr_right intro hp apply forall_congr' intro d apply forall_congr' intro hd apply comparison_congr intro j hj exact Function.update_of_ne (ne_of_lt hj) _ _
section OriginalModelsvariable (s : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (b : Scale a)variable (G : Fin D.targets → ℚ → Fin r → Type) [∀ t v c, Group (G t v c)] [∀ t v c, TopologicalSpace (G t v c)] (Γ : ∀ t v c, Subgroup (G t v c)) (M H : ℕ → ℕ) (ht : ℕ → Fin a → ℤ) (g x : ∀ t, ℕ → ∀ v c, ℤ → ℤ → G t v c) (F : ∀ t, ℕ → ∀ v c, ℤ → ℤ → ((G t v c) ⧸ Γ t v c) →ᵇ ℝ)
def scalarModels (N : ℕ) : ScalarModels D r := fun t v c k => SourceIntegerArrays.pieceModel (Γ t v c) (M N) (H N) (g t N v c) (x t N v c) (fun b r => F t N v c b r) k
lemma original_success (N : ℕ) (u : Fin a → ℕ) (xp : ℕ) (τ : ℝ) : pivotProperty D s r hs Fs b G Γ M H (fun t N _ => g t N) (fun t N _ => x t N) (fun t N _ => F t N) ht N u xp τ ↔ success D r s hs Fs (scalarModels D r G Γ M H g x F N) (ht N) b u xp τ := by simp only [pivotProperty, success] apply exists_congr intro p apply and_congr_right intro hp constructor · intro h d hd t U c exact h (⟨d,hd⟩,⟨t,U⟩,c) · intro h i exact h i.1.val i.1.property i.2.1.1 i.2.1.2 i.2.2end OriginalModels
open MeasureTheory ProductExposureLaw RawHarmonicProbability
theorem success_mass_resample (s : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (τ : ℝ) (X : Fin a → ℕ) (W : ℕ) (hW : 0 < W) (hX : ∀ j, 4*W ≤ X j) (E : Set (Fin a → ℕ)) (hE : Earlier D.index E) : (jointLaw X (X D.index) W hW hX (hX D.index)).real {z | z.1 ∈ E ∧ success D r s hs Fs S ht b z.1 z.2 τ} = (outsideLaw X W hW hX).real {u | u ∈ E ∧ success D r s hs Fs S ht b u (u D.index) τ} := by rw [← raw_resample_real X W hW hX D.index] congr 1 ext z simp only [Set.mem_ofPred_eq, Function.update_self, hE.update_iff, success_update_iff]
end SourcePivotPaths
endendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.HierarchyRates01import OAI.Combinatorics.SumProduct.Alignment.PivotPaths01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
open scoped BigOperatorssectionnoncomputable sectionopen Filter MeasureTheoryopen scoped BigOperators ENNReal Topologynoncomputable sectionopen scoped BigOperators Topology BoundedContinuousFunctionnoncomputable sectionopen scoped BigOperators BoundedContinuousFunction Topology NNReal ENNRealnamespace SourceIntegerArrays.GlobalJoint.SourceFrozenFamilyopen ProductExposureLabels ProductExposureLaw SourceExposureSlots SourceResidueAlignmentopen ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScalesopen ConstructedWordPlan.RationalPivotPlanopen ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmeticopen RawHarmonicProbabilityattribute [local instance] Classical.propDecidablevariable {a : ℕ} (D : Pivot a)
variable (s r : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (q₀ : ℕ) (b₀ : Scale a)local notation "I" => FiniteModelSlots.Index D s r hs Fs q₀ b₀
open Filter MeasureTheory RationalLattice MalcevCharactersopen MicrocellScale AdmissibleMicrocellBoundary RoughScales IntegerAlignmentopen RoughSamplingWeights SourceMacroSelection
section Harmonicvariable (G₀ : Fin D.targets → ℚ → Fin r → Type)variable [∀ t v c, Group (G₀ t v c)] [∀ t v c, TopologicalSpace (G₀ t v c)]variable [∀ t v c, IsTopologicalGroup (G₀ t v c)]variable (Γ₀ : ∀ t v c, Subgroup (G₀ t v c))variable (n₀ : Fin D.targets → ℚ → Fin r → ℕ)variable (c₀ : ∀ t v c, RealCoordinates (G₀ t v c) (n₀ t v c))variable (hsk : ∀ t v c, SecondKind (c₀ t v c))variable (A₀ : ∀ t v c, CubeFaces.Filtration (G₀ t v c))variable (weight : ∀ t v c, Fin (n₀ t v c) → ℕ)variable (hA : ∀ t v c k (g : G₀ t v c), g ∈ (A₀ t v c).level k ↔ ∀ j, weight t v c j < k → (c₀ t v c).coord g j = 0)variable (hw : ∀ t v c j, 0 < weight t v c j)include hsk hA hwopen SourcePivotPaths SourceRawPrefix
theorem source_uniform_prefix_extension (hΓ : ∀ t v c g, g ∈ Γ₀ t v c ↔ ∀ j, ∃ z : ℤ, (c₀ t v c).coord g j = z) (hmono : ∀ t v c, Monotone (weight t v c)) (h0 : ∀ t v c, (A₀ t v c).level 0 = ⊤) (h1 : ∀ t v c, (A₀ t v c).level 1 = ⊤) (hstep : ∀ t v c, (A₀ t v c).level (s+1) = ⊥) (M J R H : ℕ → ℕ) (L : ℕ → ℤ) (ht : ℕ → Fin a → ℤ) (g₀ x₀ : ∀ t, ℕ → ∀ v c, ℤ → ℤ → G₀ t v c) (obs₀ : ∀ t, ℕ → ∀ v c, ℤ → ℤ → ((G₀ t v c) ⧸ Γ₀ t v c) →ᵇ ℝ) (w0 : ℕ → ℕ) (X : ℕ → Fin a → ℕ) (hw0 : Tendsto w0 atTop atTop) (hX : ∀ N j, 4*primorial (w0 N) ≤ X N j) (hXt : ∀ j, Tendsto (fun N => X N j) atTop atTop) (hWM : ∀ N, (primorial (w0 N) : ℤ) ∣ (M N : ℤ)) (hM : ∀ N, 0 < M N) (hMs : ∀ N, RoughScales.Smooth (w0 N) (M N : ℤ)) (hJ : ∀ N, 0 < J N) (hRJ : ∀ N, R N = M N*J N) (hL : ∀ N, 0 < L N) (hsm : ∀ N, RoughScales.Smooth (w0 N) (L N)) (hWL : ∀ N, (primorial (w0 N) : ℤ) ∣ L N) (hML : ∀ N, (M N : ℤ) ∣ L N) (hLexact : ∀ N, L N = (M N : ℤ)*(primorial (w0 N) : ℤ)^(w0 N)) (hXL : ∀ t (j : Fin (m D t)), Tendsto (fun N => (X N (perm D t (j.castAdd (h D t))) : ℝ)/(L N : ℝ)) atTop atTop) (hH : ∀ N, 0 < H N) (hRrad : ∀ N, R N = radius (M N) (H N)) (hdom : Dominates (fun N => (H N : ℝ)) (earlierScale M (fun N => previousProduct D (X N)))) (hxdom : Dominates (fun N => Real.log (X N D.index : ℝ)) (fun N => (H N : ℝ))) (hpowWM : ∀ N, primorial (w0 N)^(w0 N) ∣ M N) (hq₀ : 0 < q₀) (hht : ∀ N j, 0 < ht N j) (hheight : ∀ N e, height (ht N) (D.added e) ≤ M N) (hd : ∀ e, Disjoint (D.added e) (D.tail (D.owner e))) (hQq : terminalDenom D s r hs Fs b₀ ∣ q₀) (hb₀ : ∀ j, 0 < b₀ j) (hFs : ∀ b ∈ Fs, ∀ j, 0 < b j) (hratio : ∀ N e, ∃ d : ℤ, height (ht N) (D.added e) = height (ht N) (block D.index D.tail (D.owner e)) * ((primorial (w0 N) : ℤ)^(w0 N) * d)) (metric : ∀ t v c, MetricSpace ((G₀ t v c) ⧸ Γ₀ t v c)) (hmetric : ∀ t v c, QuotientGroup.instTopologicalSpace (Γ₀ t v c) = (metric t v c).toUniformSpace.toTopologicalSpace) : letI : ∀ t v c, MetricSpace ((G₀ t v c) ⧸ Γ₀ t v c) := fun t v c => (metric t v c).replaceTopology (hmetric t v c) ∀ (Kobs : ℝ≥0) (Bobs : ℝ), (∀ t N v c b r', LipschitzWith Kobs (obs₀ t N v c b r')) → (∀ t N v c b r' z, |obs₀ t N v c b r' z| ≤ Bobs) → ∀ (Bs : Finset (Scale a)), b₀ ∈ Bs → pivotModulus s r hs D Fs Bs ∣ q₀ → ∀ (τ : ℝ), 0 < τ → ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ E : Set (Fin a → ℕ), Earlier D.index E → let μ := outsideLaw (X N) (primorial (w0 N)) (primorial_pos _) (hX N) let Q : ℝ := (pivotOptions s r hs D Fs).card (Q⁻¹/3/Q)*μ.real E ≤ μ.real {u | u ∈ E ∧ success D r s hs Fs (scalarModels D r G₀ Γ₀ M H g₀ x₀ obs₀ N) (ht N) b₀ u (u D.index) τ} + ε := by let : ∀ t v c, MetricSpace ((G₀ t v c) ⧸ Γ₀ t v c) := fun t v c => (metric t v c).replaceTopology (hmetric t v c) intro Kobs Bobs hLip hBound Bs hb hq τ hτ ε hε let Q : ℝ := (pivotOptions s r hs D Fs).card have hQ : 0 < Q := by dsimp only [Q] exact_mod_cast Finset.card_pos.mpr (pivotOptions_nonempty s r hs D Fs) have hV : (slotCount D s r hs Fs q₀ b₀ : ℝ) ≤ Q := by have hh : slotCount D s r hs Fs q₀ b₀ ≤ (pivotOptions s r hs D Fs).card := by dsimp only [slotCount] rw [Fintype.card_coe (slots D s r hs Fs q₀ b₀)] unfold slots exact Finset.card_image_le dsimp only [Q] exact_mod_cast hh have hExt := source_uniform_extension D s r hs Fs q₀ b₀ G₀ Γ₀ n₀ c₀ hsk A₀ weight hA hw hΓ hmono h0 h1 hstep M J R H L ht (fun t N _ => g₀ t N) (fun t N _ => x₀ t N) (fun t N _ => obs₀ t N) w0 (fun N => X N D.index) X hw0 hX (fun N => hX N D.index) hXt (hXt D.index) hWM hM hMs hJ hRJ hL hsm hWL hML hLexact hXL hH hRrad hdom hxdom hpowWM hq₀ hht hheight hd hQq hb₀ hFs hratio metric hmetric Kobs Bobs (fun t N _ v c b r' => hLip t N v c b r') (fun t N _ v c b r' z => hBound t N v c b r' z) Bs hb hq τ hτ (ε*Q) (mul_pos hε hQ) filter_upwards [hExt] with N hN intro E hE let μ := outsideLaw (X N) (primorial (w0 N)) (primorial_pos _) (hX N) let ν := jointLaw (X N) (X N D.index) (primorial (w0 N)) (primorial_pos _) (hX N) (hX N D.index) let S := scalarModels D r G₀ Γ₀ M H g₀ x₀ obs₀ N have hEarly : ν.real {z | z.1 ∈ E} = μ.real E := by apply congrArg ENNReal.toReal exact (measurePreserving_fst (μ := μ) (ν := (law (X N D.index) (primorial (w0 N)) (primorial_pos _) (hX N D.index) : Measure ℕ))).measure_preimage (Set.to_countable E).measurableSet.nullMeasurableSet have he := hN E simp_rw [original_success] at he change (Q⁻¹/3)*ν.real {z | z.1 ∈ E} ≤ (slotCount D s r hs Fs q₀ b₀ : ℝ)* ν.real {z | z.1 ∈ E ∧ success D r s hs Fs S (ht N) b₀ z.1 z.2 τ}+ε*Q at he rw [hEarly, success_mass_resample D r s hs Fs S (ht N) b₀ τ (X N) (primorial (w0 N)) (primorial_pos _) (hX N) E hE] at he have hem := mul_le_mul_of_nonneg_right hV (show 0 ≤ μ.real {u | u ∈ E ∧ success D r s hs Fs S (ht N) b₀ u (u D.index) τ} from measureReal_nonneg) change (Q⁻¹/3/Q)*μ.real E ≤ μ.real {u | u ∈ E ∧ success D r s hs Fs S (ht N) b₀ u (u D.index) τ}+ε apply (mul_le_mul_iff_right₀ hQ).mp calc _ = (Q⁻¹/3)*μ.real E := by field_simp _ ≤ Q*μ.real {u | u ∈ E ∧ success D r s hs Fs S (ht N) b₀ u (u D.index) τ}+ε*Q := he.trans (add_le_add hem le_rfl) _ = _ := by ring
end Harmonicend SourceIntegerArrays.GlobalJoint.SourceFrozenFamilyend
noncomputable sectionopen scoped BigOperatorsopen MeasureTheory Filter Functionnamespace SourcePivotPathsopen ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScalesopen ConstructedWordPlan.RationalPivotPlanopen SourceRawPrefixattribute [local instance] Classical.propDecidablevariable {a : ℕ} (s r : ℕ) (hs : 1 ≤ s)
def sourcePlan : (Ds : List (Pivot a)) → Plan Ds | [] => () | D :: Ds => (pivotOptions s r hs D (multipliers (sourcePlan Ds)), sourcePlan Ds)
def gain (D : Pivot a) (Fs : Finset (Scale a)) : ℝ := ((pivotOptions s r hs D Fs).card : ℝ)⁻¹/3/(pivotOptions s r hs D Fs).card
lemma gain_pos (D : Pivot a) (Fs : Finset (Scale a)) : 0 < gain s r hs D Fs := by have hp : 0 < ((pivotOptions s r hs D Fs).card : ℝ) := by exact_mod_cast Finset.card_pos.mpr (pivotOptions_nonempty s r hs D Fs) exact div_pos (div_pos (inv_pos.mpr hp) (by norm_num)) hp
lemma gain_le_one (D : Pivot a) (Fs : Finset (Scale a)) : gain s r hs D Fs ≤ 1 := by have hp : 1 ≤ ((pivotOptions s r hs D Fs).card : ℝ) := by exact_mod_cast Finset.card_pos.mpr (pivotOptions_nonempty s r hs D Fs) have hi : ((pivotOptions s r hs D Fs).card : ℝ)⁻¹ ≤ 1 := inv_le_one_of_one_le₀ hp unfold gain apply div_le_one_of_le₀ _ (by linarith) exact (div_le_self (inv_nonneg.mpr (by linarith)) (by norm_num : (1 : ℝ) ≤ 3)).trans (hi.trans hp)
def delta : List (Pivot a) → ℝ | [] => 1 | D :: Ds => gain s r hs D (multipliers (sourcePlan s r hs Ds)) * delta Ds
def errorCost : List (Pivot a) → ℕ | [] => 0 | D :: Ds => 1 + (pivotOptions s r hs D (multipliers (sourcePlan s r hs Ds))).card * errorCost Ds
lemma delta_pos (Ds : List (Pivot a)) : 0 < delta s r hs Ds := by induction Ds with | nil => exact zero_lt_one | cons D Ds ih => exact mul_pos (gain_pos s r hs D _) ih
lemma delta_le_one (Ds : List (Pivot a)) : delta s r hs Ds ≤ 1 := by induction Ds with | nil => exact le_rfl | cons D Ds ih => exact (mul_le_mul_of_nonneg_left ih (gain_pos s r hs D _).le).trans (by simpa using gain_le_one s r hs D (multipliers (sourcePlan s r hs Ds)))
variable (S : (D : Pivot a) → ScalarModels D r) (ht : Fin a → ℤ) (τ : ℝ)
def runSuccess : List (Pivot a) → Scale a → (Fin a → ℕ) → Prop | [], _, _ => True | D :: Ds, b, u => ∃ p ∈ (sourcePlan s r hs (D :: Ds)).1, outcome D r (multipliers (sourcePlan s r hs Ds)) (S D) ht b p u (u D.index) τ ∧ runSuccess Ds (scaleRun D 0 p b) u
theorem runSuccess_final (Ds : List (Pivot a)) (b : Scale a) (u : Fin a → ℕ) (h : runSuccess s r hs S ht τ Ds b u) : ∃ p : ChoicePath Ds, Admitted (sourcePlan s r hs Ds) p ∧ ∀ D ∈ Ds, comparison D r (S D) ht (b * pathMultiplier p) u (u D.index) τ := by induction Ds generalizing b with | nil => exact ⟨(), True.intro, by simp⟩ | cons D Ds ih => obtain ⟨p,hp,hhead,htail⟩ := h obtain ⟨q,hq,hfinal⟩ := ih (scaleRun D 0 p b) htail refine ⟨(p,q), ⟨hp,hq⟩, ?_⟩ have he : b * pathMultiplier (Ds := D :: Ds) (p,q) = scaleRun D 0 p b * pathMultiplier q := by change b * (scaleRun D 0 p 1 * pathMultiplier q) = _ rw [scaleRun_eq_mul D p 0 b, mul_assoc] intro E hE rw [he] rcases List.mem_cons.mp hE with rfl | hE · exact hhead (pathMultiplier q) (pathMultiplier_mem _ _ hq) · exact hfinal E hE
variable (μ : Measure (Fin a → ℕ)) [IsProbabilityMeasure μ]
def stepBounds (η : ℝ) : List (Pivot a) → Scale a → Prop | [], _ => True | D :: Ds, b => (∀ E : Set (Fin a → ℕ), Earlier D.index E → gain s r hs D (multipliers (sourcePlan s r hs Ds)) * μ.real E ≤ μ.real {u | u ∈ E ∧ success D r s hs (multipliers (sourcePlan s r hs Ds)) (S D) ht b u (u D.index) τ} + η) ∧ ∀ p ∈ (sourcePlan s r hs (D :: Ds)).1, stepBounds η Ds (scaleRun D 0 p b)
private lemma through_disjointed {i : Fin a} {v : ℕ} (f : Fin v → Set (Fin a → ℕ)) (h : ∀ j, Through i (f j)) (j : Fin v) : Through i (disjointed f j) := by intro u w huw simp only [disjointed_eq_inter_compl, Set.mem_inter_iff, Set.mem_iInter, Set.mem_compl_iff] exact and_congr (h j u w huw) (forall_congr' (fun k => forall_congr' (fun _ => not_congr (h k u w huw))))
theorem iterate_mass (Ds : List (Pivot a)) (b : Scale a) (horder : Ds.Pairwise (fun D E => D.index < E.index)) (η : ℝ) (hη : 0 ≤ η) (hsteps : stepBounds s r hs S ht τ μ η Ds b) (E : Set (Fin a → ℕ)) (hE : ∀ D ∈ Ds, Earlier D.index E) : delta s r hs Ds * μ.real E ≤ μ.real {u | u ∈ E ∧ runSuccess s r hs S ht τ Ds b u} + errorCost s r hs Ds * η := by induction Ds generalizing b E with | nil => simp [delta, runSuccess, errorCost] | cons D Ds ih => let P := pivotOptions s r hs D (multipliers (sourcePlan s r hs Ds)) let f : Fin P.card → Path D := fun j => ((Finset.equivFin P).symm j).val have hf (j : Fin P.card) : f j ∈ P := ((Finset.equivFin P).symm j).property let A (j : Fin P.card) : Set (Fin a → ℕ) := {u | u ∈ E ∧ outcome D r (multipliers (sourcePlan s r hs Ds)) (S D) ht b (f j) u (u D.index) τ} let C := disjointed A have hEh : Earlier D.index E := hE D (by simp) have hEth : Through D.index E := fun u v hv => hEh u v (fun j hj => hv j hj.le) have hCth (j : Fin P.card) : Through D.index (C j) := through_disjointed A (fun j => through_inter hEth (outcome_through D r _ (S D) ht b (f j) τ)) j have hlist := List.pairwise_cons.mp horder let T (j : Fin P.card) : Set (Fin a → ℕ) := {u | u ∈ C j ∧ runSuccess s r hs S ht τ Ds (scaleRun D 0 (f j) b) u} have htail (j : Fin P.card) : delta s r hs Ds * μ.real (C j) ≤ μ.real (T j) + errorCost s r hs Ds * η := ih (scaleRun D 0 (f j) b) hlist.2 (hsteps.2 (f j) (hf j)) (C j) (fun D' hD' => (hCth j).earlier (hlist.1 D' hD')) have hCu : (⋃ j, C j) = {u | u ∈ E ∧ success D r s hs (multipliers (sourcePlan s r hs Ds)) (S D) ht b u (u D.index) τ} := by rw [show (⋃ j, C j) = ⋃ j, A j from iUnion_disjointed] ext u simp only [Set.mem_iUnion, A, Set.mem_ofPred_eq, success] constructor · rintro ⟨j,hu,hj⟩ exact ⟨hu,f j,hf j,hj⟩ · rintro ⟨hu,p,hp,hp'⟩ refine ⟨Finset.equivFin P ⟨p,hp⟩,hu,?_⟩ simpa only [f, Equiv.symm_apply_apply] using hp' have hCeq : μ.real (⋃ j, C j) = ∑ j, μ.real (C j) := measureReal_iUnion_fintype (disjoint_disjointed A) (fun j => (Set.to_countable _).measurableSet) have hTdisj : Pairwise (Disjoint on T) := by intro i j hij exact (disjoint_disjointed A hij).mono Set.inter_subset_left Set.inter_subset_left have hTeq : μ.real (⋃ j, T j) = ∑ j, μ.real (T j) := measureReal_iUnion_fintype hTdisj (fun j => (Set.to_countable _).measurableSet) have hTu : (⋃ j, T j) ⊆ {u | u ∈ E ∧ runSuccess s r hs S ht τ (D :: Ds) b u} := by apply Set.iUnion_subset intro j u hu have hA : u ∈ A j := disjointed_subset A j hu.1 exact ⟨hA.1,f j,hf j,hA.2,hu.2⟩ have hsum := Finset.sum_le_sum (s := Finset.univ) (fun j _ => htail j) rw [Finset.sum_add_distrib, ← Finset.mul_sum] at hsum simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] at hsum rw [← hCeq, ← hTeq, hCu] at hsum have hh := mul_le_mul_of_nonneg_left (hsteps.1 E hEh) (delta_pos s r hs Ds).le have hde : delta s r hs Ds * η ≤ η := mul_le_of_le_one_left hη (delta_le_one s r hs Ds) have hmono := measureReal_mono (μ := μ) hTu change (gain s r hs D (multipliers (sourcePlan s r hs Ds)) * delta s r hs Ds) * μ.real E ≤ _ simp only [errorCost, Nat.cast_add, Nat.cast_one, Nat.cast_mul] dsimp only [P] at hsum nlinarith
def localEstimates (μs : ℕ → Measure (Fin a → ℕ)) (Ss : ℕ → (D : Pivot a) → ScalarModels D r) (hts : ℕ → Fin a → ℤ) : List (Pivot a) → Scale a → Prop | [], _ => True | D :: Ds, b => (∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ E : Set (Fin a → ℕ), Earlier D.index E → gain s r hs D (multipliers (sourcePlan s r hs Ds)) * (μs N).real E ≤ (μs N).real {u | u ∈ E ∧ success D r s hs (multipliers (sourcePlan s r hs Ds)) (Ss N D) (hts N) b u (u D.index) τ} + ε) ∧ ∀ p ∈ (sourcePlan s r hs (D :: Ds)).1, localEstimates μs Ss hts Ds (scaleRun D 0 p b)
lemma eventually_stepBounds (μs : ℕ → Measure (Fin a → ℕ)) (Ss : ℕ → (D : Pivot a) → ScalarModels D r) (hts : ℕ → Fin a → ℤ) (Ds : List (Pivot a)) (b : Scale a) (h : localEstimates s r hs τ μs Ss hts Ds b) (ε : ℝ) (hε : 0 < ε) : ∀ᶠ N in atTop, stepBounds s r hs (Ss N) (hts N) τ (μs N) ε Ds b := by induction Ds generalizing b with | nil => exact Eventually.of_forall (fun _ => True.intro) | cons D Ds ih => let P := (sourcePlan s r hs (D :: Ds)).1 have ht : ∀ p : P, ∀ᶠ N in atTop, stepBounds s r hs (Ss N) (hts N) τ (μs N) ε Ds (scaleRun D 0 p.val b) := fun p => ih _ (h.2 p.val p.property) filter_upwards [h.1 ε hε, eventually_all.mpr ht] with N hN hT exact ⟨hN, fun p hp => hT ⟨p,hp⟩⟩
theorem iterate_eventually (μs : ℕ → Measure (Fin a → ℕ)) [∀ N, IsProbabilityMeasure (μs N)] (Ss : ℕ → (D : Pivot a) → ScalarModels D r) (hts : ℕ → Fin a → ℤ) (Ds : List (Pivot a)) (b : Scale a) (horder : Ds.Pairwise (fun D E => D.index < E.index)) (h : localEstimates s r hs τ μs Ss hts Ds b) (ε : ℝ) (hε : 0 < ε) : ∀ᶠ N in atTop, ∀ E : Set (Fin a → ℕ), (∀ D ∈ Ds, Earlier D.index E) → delta s r hs Ds * (μs N).real E ≤ (μs N).real {u | u ∈ E ∧ runSuccess s r hs (Ss N) (hts N) τ Ds b u} + ε := by let η := ε / (errorCost s r hs Ds + 1) have hc : (0 : ℝ) < errorCost s r hs Ds + 1 := by positivity have hη : 0 < η := div_pos hε hc have hcost : (errorCost s r hs Ds : ℝ) * η ≤ ε := by have he : η * (errorCost s r hs Ds + 1) = ε := div_mul_cancel₀ _ hc.ne' have heta : 0 ≤ η := hη.le nlinarith filter_upwards [eventually_stepBounds s r hs τ μs Ss hts Ds b h η hη] with N hN intro E hE exact (iterate_mass s r hs (Ss N) (hts N) τ (μs N) Ds b horder η hη.le hN E hE).trans (add_le_add le_rfl hcost)
theorem eventual_final_alignment (μs : ℕ → Measure (Fin a → ℕ)) [∀ N, IsProbabilityMeasure (μs N)] (Ss : ℕ → (D : Pivot a) → ScalarModels D r) (hts : ℕ → Fin a → ℤ) (Ds : List (Pivot a)) (horder : Ds.Pairwise (fun D E => D.index < E.index)) (h : localEstimates s r hs τ μs Ss hts Ds 1) (ε : ℝ) (hε : 0 < ε) : ∀ᶠ N in atTop, delta s r hs Ds ≤ (μs N).real {u | ∃ b ∈ multipliers (sourcePlan s r hs Ds), ∀ D ∈ Ds, comparison D r (Ss N D) (hts N) b u (u D.index) τ} + ε := by filter_upwards [iterate_eventually s r hs τ μs Ss hts Ds 1 horder h ε hε] with N hN have hm := hN Set.univ (fun D _ => earlier_univ D.index) have hsub : {u | u ∈ Set.univ ∧ runSuccess s r hs (Ss N) (hts N) τ Ds 1 u} ⊆ {u | ∃ b ∈ multipliers (sourcePlan s r hs Ds), ∀ D ∈ Ds, comparison D r (Ss N D) (hts N) b u (u D.index) τ} := by intro u hu obtain ⟨p,hp,hfinal⟩ := runSuccess_final s r hs (Ss N) (hts N) τ Ds 1 u hu.2 exact ⟨pathMultiplier p, pathMultiplier_mem _ _ hp, by simpa only [one_mul] using hfinal⟩ simpa only [probReal_univ, mul_one] using hm.trans (add_le_add (measureReal_mono hsub) le_rfl)
end SourcePivotPaths
endendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.PivotPaths02import OAI.Geometry.NilpotentCharts.Main
namespace OAI
open scoped BigOperatorssectionnoncomputable sectionopen Filter MeasureTheoryopen scoped BigOperators ENNReal Topologynoncomputable sectionopen scoped BigOperators Topology BoundedContinuousFunctionnoncomputable sectionopen scoped BigOperatorsopen MeasureTheory Filter Functionnoncomputable sectionopen scoped BigOperatorsnamespace SourcePivotPathsopen ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScalesopen ConstructedWordPlan.RationalPivotPlanopen ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmeticopen SourceIntegerArrays.GlobalJoint.SourceFrozenFamilyattribute [local instance] Classical.propDecidablevariable {a : ℕ} (s r : ℕ) (hs : 1 ≤ s)
lemma scaleRun_pos (D : Pivot a) (p : Path D) (hp : ∀ o ∈ p, 0 < o.1) (j : ℕ) (b : Scale a) (hb : ∀ l, 0 < b l) : ∀ l, 0 < scaleRun D j p b l := by induction p generalizing j b with | nil => exact hb | cons o p ih => apply ih (fun o ho => hp o (List.mem_cons_of_mem _ ho)) intro l exact mul_pos (hb l) (multiplier_pos D.index (tailAt D.tail j) (by exact_mod_cast hp o List.mem_cons_self) l)
lemma sourcePlan_positive (Ds : List (Pivot a)) : positivePlan (sourcePlan s r hs Ds) := by induction Ds with | nil => trivial | cons D Ds ih => exact ⟨pivotOptions_paths s r hs D _, ih⟩
lemma source_multipliers_pos (Ds : List (Pivot a)) : ∀ b ∈ multipliers (sourcePlan s r hs Ds), ∀ l, 0 < b l := by induction Ds with | nil => intro b hb simp only [multipliers, Finset.mem_singleton] at hb subst b simp | cons D Ds ih => intro b hb obtain ⟨p,hp,hb⟩ := Finset.mem_biUnion.mp hb obtain ⟨d,hd,rfl⟩ := Finset.mem_image.mp hb exact fun l => mul_pos (scaleRun_pos D p (pivotOptions_paths s r hs D _ p hp).2 0 1 (by simp) l) (ih d hd l)
def nextScales (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a)) : Finset (Scale a) := B.biUnion (fun b => (pivotOptions s r hs D (multipliers (sourcePlan s r hs Ds))).image (fun p => scaleRun D 0 p b))
lemma mem_nextScales (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a)) (b : Scale a) (hb : b ∈ B) (p : Path D) (hp : p ∈ pivotOptions s r hs D (multipliers (sourcePlan s r hs Ds))) : scaleRun D 0 p b ∈ nextScales s r hs D Ds B := Finset.mem_biUnion.mpr ⟨b,hb,Finset.mem_image.mpr ⟨p,hp,rfl⟩⟩
lemma nextScales_pos (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a)) (hB : ∀ b ∈ B, ∀ l, 0 < b l) : ∀ b ∈ nextScales s r hs D Ds B, ∀ l, 0 < b l := by intro b hb obtain ⟨b₀,hb₀,hb⟩ := Finset.mem_biUnion.mp hb obtain ⟨p,hp,rfl⟩ := Finset.mem_image.mp hb exact scaleRun_pos D p (pivotOptions_paths s r hs D _ p hp).2 0 b₀ (hB b₀ hb₀)
def planModulus : List (Pivot a) → Finset (Scale a) → ℕ | [], _ => 1 | D :: Ds, B => (pivotModulus s r hs D (multipliers (sourcePlan s r hs Ds)) B * ∏ b ∈ B, terminalDenom D s r hs (multipliers (sourcePlan s r hs Ds)) b) * planModulus Ds (nextScales s r hs D Ds B)
lemma terminalDenom_pos (D : Pivot a) (Fs : Finset (Scale a)) (b : Scale a) : 0 < terminalDenom D s r hs Fs b := (source_terminal_arithmetic D (outcomeScales D s r hs Fs b)).choose_spec.1
lemma planModulus_pos (Ds : List (Pivot a)) (B : Finset (Scale a)) : 0 < planModulus s r hs Ds B := by induction Ds generalizing B with | nil => exact Nat.zero_lt_one | cons D Ds ih => exact Nat.mul_pos (Nat.mul_pos (pivotModulus_pos s r hs D _ B) (Finset.prod_pos fun b _ => terminalDenom_pos s r hs D _ b)) (ih _)
lemma planModulus_head (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a)) : pivotModulus s r hs D (multipliers (sourcePlan s r hs Ds)) B ∣ planModulus s r hs (D :: Ds) B := dvd_trans (dvd_mul_right _ _) (dvd_mul_right _ _)
lemma planModulus_terminal (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a)) (b : Scale a) (hb : b ∈ B) : terminalDenom D s r hs (multipliers (sourcePlan s r hs Ds)) b ∣ planModulus s r hs (D :: Ds) B := dvd_trans (Finset.dvd_prod_of_mem _ hb) (dvd_trans (dvd_mul_left _ _) (dvd_mul_right _ _))
lemma planModulus_tail (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a)) : planModulus s r hs Ds (nextScales s r hs D Ds B) ∣ planModulus s r hs (D :: Ds) B := dvd_mul_left _ _
end SourcePivotPaths
noncomputable sectionopen Filter MeasureTheoryopen scoped Topology BoundedContinuousFunction NNRealnamespace SourceChartedAlignmentopen RationalLattice MalcevCharacters CubeFacesopen MicrocellScale AdmissibleMicrocellBoundary RoughScalesopen ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScalesopen SourceIntegerArraysopen ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmeticopen SourceIntegerArrays.GlobalJoint.SourceFrozenFamilyopen SourceIntegerArrays.GlobalJoint.SourceExposureSlots ProductExposureLaw SourceResidueAlignmentopen ConstructedWordPlan.RationalPivotPlan
structure CommonScales (a : ℕ) where w : ℕ → ℕ M : ℕ → ℕ X : ℕ → Fin a → ℕ ht : ℕ → Fin a → ℤ L : ℕ → ℤ hw : Tendsto w atTop atTop hX : ∀ N j, 4 * primorial (w N) ≤ X N j hXt : ∀ j, Tendsto (fun N => X N j) atTop atTop hWM : ∀ N, (primorial (w N) : ℤ) ∣ (M N : ℤ) hM : ∀ N, 0 < M N hMs : ∀ N, RoughScales.Smooth (w N) (M N : ℤ) hL : ∀ N, 0 < L N hLs : ∀ N, RoughScales.Smooth (w N) (L N) hWL : ∀ N, (primorial (w N) : ℤ) ∣ L N hML : ∀ N, (M N : ℤ) ∣ L N hLexact : ∀ N, L N = (M N : ℤ) * (primorial (w N) : ℤ) ^ w N hpowWM : ∀ N, primorial (w N) ^ w N ∣ M N hht : ∀ N j, 0 < ht N j hXL : ∀ j, Tendsto (fun N => (X N j : ℝ) / (L N : ℝ)) atTop atTop
structure PivotScales {a : ℕ} (C : CommonScales a) (D : Pivot a) where H : ℕ → ℕ J : ℕ → ℕ R : ℕ → ℕ hJ : ∀ N, 0 < J N hRJ : ∀ N, R N = C.M N * J N hH : ∀ N, 0 < H N hRrad : ∀ N, R N = radius (C.M N) (H N) hdom : Dominates (fun N => (H N : ℝ)) (earlierScale C.M (fun N => previousProduct D (C.X N))) hxdom : Dominates (fun N => Real.log (C.X N D.index : ℝ)) (fun N => (H N : ℝ)) hheight : ∀ N e, height (C.ht N) (D.added e) ≤ C.M N hdisj : ∀ e, Disjoint (D.added e) (D.tail (D.owner e)) hratio : ∀ N e, ∃ d : ℤ, height (C.ht N) (D.added e) = height (C.ht N) (block D.index D.tail (D.owner e)) * ((primorial (C.w N) : ℤ) ^ C.w N * d)
structure ChartedModels {a : ℕ} (s r : ℕ) (D : Pivot a) where G : Fin D.targets → ℚ → Fin r → Type [group : ∀ t v c, Group (G t v c)] [topology : ∀ t v c, TopologicalSpace (G t v c)] [topGroup : ∀ t v c, IsTopologicalGroup (G t v c)] Γ : ∀ t v c, Subgroup (G t v c) dim : Fin D.targets → ℚ → Fin r → ℕ coords : ∀ t v c, RealCoordinates (G t v c) (dim t v c) second : ∀ t v c, SecondKind (coords t v c) filtration : ∀ t v c, CubeFaces.Filtration (G t v c) weight : ∀ t v c, Fin (dim t v c) → ℕ level_iff : ∀ t v c k (g : G t v c), g ∈ (filtration t v c).level k ↔ ∀ j, weight t v c j < k → (coords t v c).coord g j = 0 weight_pos : ∀ t v c j, 0 < weight t v c j lattice_iff : ∀ t v c g, g ∈ Γ t v c ↔ ∀ j, ∃ z : ℤ, (coords t v c).coord g j = z weight_mono : ∀ t v c, Monotone (weight t v c) level0 : ∀ t v c, (filtration t v c).level 0 = ⊤ level1 : ∀ t v c, (filtration t v c).level 1 = ⊤ step : ∀ t v c, (filtration t v c).level (s+1) = ⊥ g : ∀ t, ℕ → ∀ v c, ℤ → ℤ → G t v c x : ∀ t, ℕ → ∀ v c, ℤ → ℤ → G t v c obs : ∀ t, ℕ → ∀ v c, ℤ → ℤ → ((G t v c) ⧸ Γ t v c) →ᵇ ℝ metric : ∀ t v c, MetricSpace ((G t v c) ⧸ Γ t v c) compatible : ∀ t v c, QuotientGroup.instTopologicalSpace (Γ t v c) = (metric t v c).toUniformSpace.toTopologicalSpace K : ℝ≥0 B : ℝ lip : letI : ∀ t v c, MetricSpace ((G t v c) ⧸ Γ t v c) := fun t v c => (metric t v c).replaceTopology (compatible t v c) ∀ t N v c b r', LipschitzWith K (obs t N v c b r') bound : ∀ t N v c b r' z, |obs t N v c b r' z| ≤ B
attribute [instance] ChartedModels.group ChartedModels.topology ChartedModels.topGroup
variable {a : ℕ}def CommonScales.law (C : CommonScales a) (N : ℕ) : Measure (Fin a → ℕ) := outsideLaw (C.X N) (primorial (C.w N)) (primorial_pos _) (C.hX N)
instance (C : CommonScales a) (N : ℕ) : IsProbabilityMeasure (C.law N) := by unfold CommonScales.law infer_instance
def ChartedModels.scalar {s r : ℕ} {D : Pivot a} (C : CommonScales a) (P : PivotScales C D) (F : ChartedModels s r D) (N : ℕ) : SourcePivotPaths.ScalarModels D r := SourcePivotPaths.scalarModels D r F.G F.Γ C.M P.H F.g F.x F.obs N
end SourceChartedAlignment
noncomputable sectionopen scoped Topology BigOperatorsnamespace SourceProductCoordinatesopen RationalLattice MalcevCharactersattribute [local instance] Classical.propDecidablevariable {d N : ℕ} (n : Fin d → ℕ) (G : Fin d → Type) [∀ i, Group (G i)] [∀ i, TopologicalSpace (G i)] (c : ∀ i, RealCoordinates (G i) (n i)) (e : Fin N ≃ Σ i, Fin (n i)) (he : ∀ i, StrictMono (fun j : Fin (n i) => e.symm ⟨i,j⟩))
def homeomorph : (∀ i, G i) ≃ₜ (Fin N → ℝ) where toFun g k := (c (e k).1).coord (g (e k).1) (e k).2 invFun v i := (c i).coord.symm (fun j => v (e.symm ⟨i,j⟩)) left_inv g := by funext i apply (c i).coord.injective ext j simp only [Homeomorph.apply_symm_apply] exact congrArg (fun z : Σ i, Fin (n i) => (c z.1).coord (g z.1) z.2) (e.apply_symm_apply ⟨i,j⟩) right_inv v := by funext k simp continuous_toFun := continuous_pi fun k => (continuous_apply (e k).2).comp ((c (e k).1).coord.continuous.comp (continuous_apply (e k).1)) continuous_invFun := continuous_pi fun i => (c i).coord.symm.continuous.comp (continuous_pi fun j => continuous_apply (e.symm ⟨i,j⟩))
def lower (k : Fin N) (j : Fin (e k).2.val) : Fin k.val := ⟨(e.symm ⟨(e k).1,⟨j.val,lt_trans j.isLt (e k).2.isLt⟩⟩).val, by have h := he (e k).1 (show (⟨j.val,lt_trans j.isLt (e k).2.isLt⟩ : Fin (n (e k).1)) < (e k).2 from j.isLt) simpa only [Sigma.eta, Equiv.symm_apply_apply, Fin.lt_def] using h⟩
lemma homeomorph_lower (g : ∀ i, G i) (k : Fin N) (j : Fin (e k).2.val) : homeomorph n G c e g ⟨(lower n e he k j).val,lt_trans (lower n e he k j).isLt k.isLt⟩ = (c (e k).1).coord (g (e k).1) ⟨j.val,lt_trans j.isLt (e k).2.isLt⟩ := by change (c (e (e.symm _)).1).coord (g (e (e.symm _)).1) (e (e.symm _)).2 = _ exact congrArg (fun z : Σ i, Fin (n i) => (c z.1).coord (g z.1) z.2) (e.apply_symm_apply _)
def coordinates : RealCoordinates (∀ i, G i) N where coord := homeomorph n G c e one_coord k := (c (e k).1).one_coord (e k).2 correction k := MvPolynomial.rename (Sum.map (lower n e he k) (lower n e he k)) ((c (e k).1).correction (e k).2) mul_coord g h k := by change (c (e k).1).coord (g (e k).1 * h (e k).1) (e k).2 = _ rw [(c (e k).1).mul_coord] congr 1 rw [MvPolynomial.eval₂_rename] congr 1 funext j cases j with | inl j => exact (homeomorph_lower n G c e he g k j).symm | inr j => exact (homeomorph_lower n G c e he h k j).symm
def select (i : Fin d) (k : Fin N) : Option (Fin (n i)) := if h : (e k).1 = i then some (h ▸ (e k).2) else none
lemma select_some_iff (i : Fin d) (k : Fin N) (j : Fin (n i)) : select n e i k = some j ↔ e k = ⟨i,j⟩ := by unfold select split_ifs with h · subst i simp only [Option.some.injEq] constructor · intro h cases h rfl · intro h exact eq_of_heq (Sigma.mk.inj h).2 · constructor · intro h' cases h' · intro h' exact False.elim (h (congrArg Sigma.fst h'))
include he inlemma select_enumeration (i : Fin d) : (List.ofFn (fun k : Fin N => k)).filterMap (select n e i) = List.ofFn (fun j : Fin (n i) => j) := by apply List.Pairwise.eq_of_mem_iff (r := (· < ·)) · apply List.pairwise_filterMap.mpr apply List.pairwise_ofFn.mpr intro k l hkl j hj j' hj' have hk : e.symm ⟨i,j⟩ = k := e.symm_apply_eq.mpr ((select_some_iff n e i k j).mp hj).symm have hl : e.symm ⟨i,j'⟩ = l := e.symm_apply_eq.mpr ((select_some_iff n e i l j').mp hj').symm exact (he i).lt_iff_lt.mp (by simpa only [hk,hl] using hkl) · exact List.pairwise_ofFn.mpr (fun _ _ h => h) · intro j simp only [List.mem_filterMap, List.mem_ofFn] constructor · intro h exact ⟨j,rfl⟩ · intro h refine ⟨e.symm ⟨i,j⟩,⟨e.symm ⟨i,j⟩,rfl⟩,?_⟩ exact (select_some_iff n e i _ j).mpr (e.apply_symm_apply _)
lemma axis_selected (k : Fin N) (t : ℝ) (i : Fin d) (j : Fin (n i)) (hk : e k = ⟨i,j⟩) : axis (coordinates n G c e he) k t i = axis (c i) j t := by apply (c i).coord.injective ext v change (c i).coord ((c i).coord.symm (fun v => (Pi.single k t : Fin N → ℝ) (e.symm ⟨i,v⟩))) v = _ rw [(c i).coord.apply_symm_apply] simp only [axis, Homeomorph.apply_symm_apply] have hkv : e.symm ⟨i,v⟩ = k ↔ v=j := by rw [e.symm_apply_eq, hk] constructor · intro h exact eq_of_heq (Sigma.mk.inj h).2 · rintro rfl rfl simp only [Pi.single_apply, hkv]
lemma axis_other (k : Fin N) (t : ℝ) (i : Fin d) (hk : (e k).1 ≠ i) : axis (coordinates n G c e he) k t i = 1 := by apply (c i).coord.injective ext v change (c i).coord ((c i).coord.symm (fun v => (Pi.single k t : Fin N → ℝ) (e.symm ⟨i,v⟩))) v = _ rw [(c i).coord.apply_symm_apply, (c i).one_coord] apply Pi.single_eq_of_ne intro h have h' := e.symm_apply_eq.mp h exact hk (congrArg Sigma.fst h').symm
lemma prod_select {α β M : Type*} [Monoid M] (l : List α) (f : α → Option β) (g : β → M) (h : α → M) (hh : ∀ x, h x = (f x).elim 1 g) : (l.map h).prod = ((l.filterMap f).map g).prod := by induction l with | nil => rfl | cons x xs ih => cases hf : f x with | none => simpa [hh x, hf] using ih | some y => simpa [hh x, hf] using congrArg (fun z => g y*z) ih
theorem secondKind (hs : ∀ i, SecondKind (c i)) : SecondKind (coordinates n G c e he) where axis_add k s t := by funext i by_cases hi : (e k).1 = i · subst i rw [axis_selected n G c e he k (s+t) (e k).1 (e k).2 rfl, Pi.mul_apply, axis_selected n G c e he k s (e k).1 (e k).2 rfl, axis_selected n G c e he k t (e k).1 (e k).2 rfl] exact (hs _).axis_add _ _ _ · rw [axis_other n G c e he k (s+t) i hi, Pi.mul_apply, axis_other n G c e he k s i hi, axis_other n G c e he k t i hi, one_mul] ordered g := by funext i change g i = (Pi.evalMonoidHom G i) (List.ofFn (fun k => axis (coordinates n G c e he) k ((coordinates n G c e he).coord g k))).prod rw [map_list_prod, List.map_ofFn] change g i = (List.ofFn (fun k : Fin N => axis (coordinates n G c e he) k ((coordinates n G c e he).coord g k) i)).prod have hprod := prod_select (List.ofFn (fun k : Fin N => k)) (select n e i) (fun j => axis (c i) j ((c i).coord (g i) j)) (fun k => axis (coordinates n G c e he) k ((coordinates n G c e he).coord g k) i) (by intro k by_cases hi : (e k).1 = i · have hk : e k = ⟨i,hi ▸ (e k).2⟩ := by cases hi; rfl rw [select, dite_eq_left hi, Option.elim_some, axis_selected n G c e he _ _ _ _ hk] congr 1 change (c (e k).1).coord (g (e k).1) (e k).2 = _ exact congrArg (fun z : Σ i, Fin (n i) => (c z.1).coord (g z.1) z.2) hk · rw [select, dite_eq_right hi, Option.elim_none, axis_other n G c e he _ _ _ hi]) rw [List.map_ofFn, select_enumeration n e he i, List.map_ofFn] at hprod exact ((hs i).ordered (g i)).trans hprod.symm
end SourceProductCoordinates
endendendendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289import Mathlibimport OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsection RawSuccessInlineScope0noncomputable sectionopen MeasureTheory Filter Topologyopen scoped BigOperatorsendend RawSuccessInlineScope0
section RawSuccessInlineScope1
open scoped Topology BigOperatorsopen Filter MeasureTheory Set
namespace SourcePointLaw
noncomputable section
theorem interval_induction (p : ℝ → ℝ → Prop) (hjoin : ∀ a b : ℝ, 0 ≤ a → a < b → b ≤ 1 → p a ((a + b) / 2) → p ((a + b) / 2) b → p a b) (hlocal : ∀ x ∈ Icc (0 : ℝ) 1, ∃ δ > 0, ∀ a b : ℝ, 0 ≤ a → a < b → b ≤ 1 → a ≤ x → x ≤ b → b - a < δ → p a b) : p 0 1 := by let I : BoxIntegral.Box Unit := ⟨fun _ => 0, fun _ => 1, fun _ => by norm_num⟩ change p (I.lower ()) (I.upper ()) apply I.subbox_induction_on' (p := fun J => p (J.lower ()) (J.upper ())) · intro J hJ hs have hlo : 0 ≤ J.lower () := (BoxIntegral.Box.le_iff_bounds.mp hJ).1 () have hup : J.upper () ≤ 1 := (BoxIntegral.Box.le_iff_bounds.mp hJ).2 () have h₁ := hs (∅ : Set Unit) have h₂ := hs (univ : Set Unit) simp [BoxIntegral.Box.splitCenterBox] at h₁ h₂ exact hjoin _ _ hlo (J.lower_lt_upper ()) hup h₁ h₂ · intro z hz have hz' : z () ∈ Icc (0 : ℝ) 1 := ⟨hz.1 (), hz.2 ()⟩ obtain ⟨δ, hδ, hδp⟩ := hlocal (z ()) hz' refine ⟨{y : Unit → ℝ | |y () - z ()| < δ / 3}, ?_, ?_⟩ · apply mem_nhdsWithin_of_mem_nhds have hh : Continuous (fun y : Unit → ℝ => |y () - z ()|) := ((continuous_apply ()).sub continuous_const).abs exact IsOpen.mem_nhds (isOpen_lt hh continuous_const) (by simp only [Set.mem_ofPred_eq, sub_self, abs_zero]; positivity) · intro J hJ m hzJ hsub _ have hlo : 0 ≤ J.lower () := (BoxIntegral.Box.le_iff_bounds.mp hJ).1 () have hup : J.upper () ≤ 1 := (BoxIntegral.Box.le_iff_bounds.mp hJ).2 () have hl := hsub J.lower_mem_Icc have hu := hsub J.upper_mem_Icc change |J.lower () - z ()| < δ / 3 at hl change |J.upper () - z ()| < δ / 3 at hu apply hδp _ _ hlo (J.lower_lt_upper ()) hup (hzJ.1 ()) (hzJ.2 ()) have hl' := (abs_lt.mp hl).1 have hu' := (abs_lt.mp hu).2 linarith
theorem tendsto_of_local_interval_law {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] {ι : Type*} (l : Filter ι) (A : ι → ℝ → ℝ → E) (f : ℝ → E) (hadd : ∀ N a b c, 0 ≤ a → a ≤ b → b ≤ c → c ≤ 1 → A N a c = A N a b + A N b c) (hf : ContinuousOn f (Icc (0 : ℝ) 1)) (hlocal : ∀ x ∈ Icc (0 : ℝ) 1, ∀ ε > 0, ∃ δ > 0, ∀ a b : ℝ, 0 ≤ a → a < b → b ≤ 1 → a ≤ x → x ≤ b → b - a < δ → ∀ᶠ N : ι in l, ‖A N a b - (b - a) • f x‖ ≤ ε * (b - a)) : Tendsto (fun N => A N 0 1) l (𝓝 (∫ x in (0 : ℝ)..1, f x)) := by have hint (a b : ℝ) (ha : 0 ≤ a) (hab : a ≤ b) (hb : b ≤ 1) : IntervalIntegrable f volume a b := ContinuousOn.intervalIntegrable_of_Icc hab (hf.mono (Icc_subset_Icc ha hb)) apply Metric.tendsto_nhds.mpr intro ε hε have hε4 : 0 < ε / 4 := by positivity have hevent : ∀ᶠ N : ι in l, ‖A N 0 1 - ∫ x in (0 : ℝ)..1, f x‖ ≤ ε / 2 * (1 - 0) := by apply interval_induction (fun a b => ∀ᶠ N : ι in l, ‖A N a b - ∫ x in a..b, f x‖ ≤ ε / 2 * (b - a)) · intro a b ha hab hb hl hr let c := (a + b) / 2 have hac : a ≤ c := by dsimp [c]; linarith have hcb : c ≤ b := by dsimp [c]; linarith have hic := hint a c ha hac (hcb.trans hb) have hci := hint c b (ha.trans hac) hcb hb filter_upwards [hl, hr] with N hNl hNr rw [hadd N a c b ha hac hcb hb, ← intervalIntegral.integral_add_adjacent_intervals hic hci] calc ‖A N a c + A N c b - ((∫ x in a..c, f x) + ∫ x in c..b, f x)‖ = ‖(A N a c - ∫ x in a..c, f x) + (A N c b - ∫ x in c..b, f x)‖ := congrArg norm (by abel) _ ≤ ‖A N a c - ∫ x in a..c, f x‖ + ‖A N c b - ∫ x in c..b, f x‖ := norm_add_le _ _ _ ≤ ε / 2 * (b - a) := by dsimp [c] at *; linarith · intro x hx obtain ⟨δ₁, hδ₁, hδ₁p⟩ := hlocal x hx (ε / 4) hε4 obtain ⟨δ₂, hδ₂, hδ₂p⟩ := Metric.continuousWithinAt_iff.mp (hf x hx) (ε / 4) hε4 refine ⟨min δ₁ δ₂, lt_min hδ₁ hδ₂, ?_⟩ intro a b ha hab hb hax hxb hδ have hδa : b - a < δ₁ := hδ.trans_le (min_le_left _ _) have hδb : b - a < δ₂ := hδ.trans_le (min_le_right _ _) have hi := hint a b ha hab.le hb have herr : ‖(b - a) • f x - ∫ y in a..b, f y‖ ≤ ε / 4 * (b - a) := by rw [← intervalIntegral.integral_const, ← intervalIntegral.integral_sub intervalIntegrable_const hi] have hbound : ∀ y ∈ uIoc a b, ‖f x - f y‖ ≤ ε / 4 := by intro y hy rw [uIoc_of_le hab.le] at hy have hy' : y ∈ Icc (0 : ℝ) 1 := ⟨ha.trans hy.1.le, hy.2.trans hb⟩ have hdist : dist y x ≤ b - a := by rw [Real.dist_eq, abs_le] constructor <;> linarith [hy.1, hy.2] have hc := (hδ₂p hy' (hdist.trans_lt hδb)).le simpa only [dist_eq_norm, norm_sub_rev] using hc simpa only [abs_of_pos (sub_pos.mpr hab)] using intervalIntegral.norm_integral_le_of_norm_le_const hbound filter_upwards [hδ₁p a b ha hab hb hax hxb hδa] with N hN calc ‖A N a b - ∫ y in a..b, f y‖ ≤ ‖A N a b - (b - a) • f x‖ + ‖(b - a) • f x - ∫ y in a..b, f y‖ := by simpa only [dist_eq_norm] using dist_triangle (A N a b) ((b - a) • f x) (∫ y in a..b, f y) _ ≤ ε / 2 * (b - a) := by linarith filter_upwards [hevent] with N hN rw [dist_eq_norm] have : ε / 2 < ε := by linarith exact hN.trans_lt (by simpa using this)
endend SourcePointLaw
open scoped Topology BigOperatorsopen Filter MeasureTheory Set
namespace SourcePointLawnoncomputable section
def residueInterval (d : ℕ) (r : ℤ) (a b : ℝ) : Finset ℤ := (Finset.Ico ⌈a⌉ ⌈b⌉).filter (fun n => n % (d : ℤ) = r)
lemma mem_residueInterval (d : ℕ) (r n : ℤ) (a b : ℝ) : n ∈ residueInterval d r a b ↔ (a ≤ (n : ℝ) ∧ (n : ℝ) < b) ∧ n % (d : ℤ) = r := by simp only [residueInterval, Finset.mem_filter, Finset.mem_Ico, Int.ceil_le, Int.lt_ceil]
lemma residueInterval_affine (d : ℕ) (hd : 0 < d) (r : ℤ) (hr : 0 ≤ r ∧ r < (d : ℤ)) (a b : ℝ) : residueInterval d r a b = (Finset.Ico ⌈(a - (r : ℝ)) / (d : ℝ)⌉ ⌈(b - (r : ℝ)) / (d : ℝ)⌉).map ⟨fun k => r + (d : ℤ) * k, by intro x y h have hd' : (d : ℤ) ≠ 0 := by exact_mod_cast hd.ne' exact mul_left_cancel₀ hd' (add_left_cancel h)⟩ := by have hdR : (0 : ℝ) < d := by exact_mod_cast hd have hmem (k : ℤ) : k ∈ Finset.Ico ⌈(a - (r : ℝ)) / (d : ℝ)⌉ ⌈(b - (r : ℝ)) / (d : ℝ)⌉ ↔ a ≤ ((r + (d : ℤ) * k : ℤ) : ℝ) ∧ ((r + (d : ℤ) * k : ℤ) : ℝ) < b := by simp only [Finset.mem_Ico, Int.ceil_le, Int.lt_ceil, Int.cast_add, Int.cast_mul, Int.cast_natCast, div_le_iff₀ hdR, lt_div_iff₀ hdR] constructor <;> intro h <;> constructor <;> nlinarith [h.1, h.2] ext n rw [mem_residueInterval, Finset.mem_map] constructor · rintro ⟨hn, hmod⟩ have he : r + (d : ℤ) * (n / (d : ℤ)) = n := by rw [← hmod] exact Int.emod_add_mul_ediv n d refine ⟨n / (d : ℤ), hmem _ |>.mpr ?_, he⟩ simpa only [he] using hn · rintro ⟨k, hk, rfl⟩ refine ⟨(hmem k).mp hk, ?_⟩ change (r + (d : ℤ) * k) % (d : ℤ) = r rw [Int.add_mul_emod_self_left] exact Int.emod_eq_of_lt hr.1 hr.2
theorem residueInterval_card_error (d : ℕ) (hd : 0 < d) (r : ℤ) (hr : 0 ≤ r ∧ r < (d : ℤ)) (a b : ℝ) (hab : a ≤ b) : |((residueInterval d r a b).card : ℝ) - (b - a) / (d : ℝ)| < 1 := by have hdR : (0 : ℝ) < d := by exact_mod_cast hd let u := (a - (r : ℝ)) / (d : ℝ) let v := (b - (r : ℝ)) / (d : ℝ) have huv : u ≤ v := div_le_div_of_nonneg_right (sub_le_sub_right hab _) hdR.le have hceil : ⌈u⌉ ≤ ⌈v⌉ := Int.ceil_mono huv have hcard : ((residueInterval d r a b).card : ℤ) = ⌈v⌉ - ⌈u⌉ := by rw [residueInterval_affine d hd r hr, Finset.card_map, Int.card_Ico] exact Int.toNat_of_nonneg (sub_nonneg.mpr hceil) have hcardR : ((residueInterval d r a b).card : ℝ) = (⌈v⌉ : ℝ) - (⌈u⌉ : ℝ) := by exact_mod_cast hcard have hvu : v - u = (b - a) / (d : ℝ) := by dsimp [v, u]; ring rw [hcardR, ← hvu, abs_lt] constructor <;> linarith [Int.le_ceil u, Int.ceil_lt_add_one u, Int.le_ceil v, Int.ceil_lt_add_one v]
theorem residueInterval_card_scaled_error (d : ℕ) (hd : 0 < d) (r : ℤ) (hr : 0 ≤ r ∧ r < (d : ℤ)) (a b : ℝ) (hab : a ≤ b) (N : ℕ) (hN : 0 < N) : |((residueInterval d r (a * N) (b * N)).card : ℝ) / N - (b - a) / (d : ℝ)| < 1 / (N : ℝ) := by have hNR : (0 : ℝ) < N := by exact_mod_cast hN have he := residueInterval_card_error d hd r hr (a * N) (b * N) (mul_le_mul_of_nonneg_right hab hNR.le) have hi : ((residueInterval d r (a * N) (b * N)).card : ℝ) / N - (b - a) / (d : ℝ) = (((residueInterval d r (a * N) (b * N)).card : ℝ) - (b * N - a * N) / (d : ℝ)) / N := by field_simp rw [hi, abs_div, abs_of_pos hNR] exact (div_lt_div_iff_of_pos_right hNR).mpr he
theorem residueInterval_card_tendsto (d : ℕ) (hd : 0 < d) (r : ℤ) (hr : 0 ≤ r ∧ r < (d : ℤ)) (a b : ℝ) (hab : a ≤ b) : Tendsto (fun N : ℕ => ((residueInterval d r (a * N) (b * N)).card : ℝ) / N) atTop (𝓝 ((b - a) / (d : ℝ))) := by apply tendsto_iff_norm_sub_tendsto_zero.mpr apply squeeze_zero' (Filter.Eventually.of_forall (fun _ => norm_nonneg _)) · filter_upwards [Filter.eventually_ge_atTop (1 : ℕ)] with N hN simpa only [Real.norm_eq_abs] using (residueInterval_card_scaled_error d hd r hr a b hab N (by omega)).le · exact tendsto_const_div_atTop_nhds_zero_nat (1 : ℝ)
lemma residueInterval_union (d : ℕ) (r : ℤ) (a b c : ℝ) (hab : a ≤ b) (hbc : b ≤ c) : residueInterval d r a c = residueInterval d r a b ∪ residueInterval d r b c := by ext n simp only [mem_residueInterval, Finset.mem_union] constructor · rintro ⟨⟨hna, hnc⟩, hnmod⟩ by_cases hnb : (n : ℝ) < b · exact Or.inl ⟨⟨hna, hnb⟩, hnmod⟩ · exact Or.inr ⟨⟨le_of_not_gt hnb, hnc⟩, hnmod⟩ · rintro (⟨⟨hna, hnb⟩, hnmod⟩ | ⟨⟨hnb, hnc⟩, hnmod⟩) · exact ⟨⟨hna, hnb.trans_le hbc⟩, hnmod⟩ · exact ⟨⟨hab.trans hnb, hnc⟩, hnmod⟩
lemma residueInterval_disjoint (d : ℕ) (r : ℤ) (a b c : ℝ) : Disjoint (residueInterval d r a b) (residueInterval d r b c) := by apply Finset.disjoint_left.mpr intro n hn hm rw [mem_residueInterval] at hn hm exact (not_lt_of_ge hm.1.1) hn.1.2
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
def windowSum (P : ℕ → ℤ → E) (d : ℕ) (r : ℤ) (N : ℕ) (a b : ℝ) : E := (N : ℝ)⁻¹ • ∑ n ∈ residueInterval d r (a * N) (b * N), P N n
lemma windowSum_add (P : ℕ → ℤ → E) (d : ℕ) (r : ℤ) (N : ℕ) (a b c : ℝ) (hab : a ≤ b) (hbc : b ≤ c) : windowSum P d r N a c = windowSum P d r N a b + windowSum P d r N b c := by have hN : (0 : ℝ) ≤ N := Nat.cast_nonneg _ simp only [windowSum, residueInterval_union d r _ _ _ (mul_le_mul_of_nonneg_right hab hN) (mul_le_mul_of_nonneg_right hbc hN), Finset.sum_union (residueInterval_disjoint d r _ _ _), smul_add]
lemma windowSum_eq [Module ℚ≥0 E] (P : ℕ → ℤ → E) (d : ℕ) (r : ℤ) (N : ℕ) (a b : ℝ) : windowSum P d r N a b = (((residueInterval d r (a * N) (b * N)).card : ℝ) / N) • (𝔼 n ∈ residueInterval d r (a * N) (b * N), P N n) := by rw [windowSum, ← Finset.card_smul_expect] rw [← Nat.cast_smul_eq_nsmul ℝ, smul_smul] congr 1 ring
endend SourcePointLaw
end RawSuccessInlineScope1end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.PointLaw01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsection RawSuccessInlineScope1open scoped Topology BigOperatorsopen Filter MeasureTheory Setopen scoped Topology BigOperatorsopen Filter MeasureTheory Setnamespace SourcePointLawnoncomputable sectionopen scoped Topology BigOperatorsopen Filter MeasureTheory Set
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] [Module ℚ≥0 E]
theorem residue_point_law (P : ℕ → ℤ → E) (d : ℕ) (hd : 0 < d) (r : ℤ) (hr : 0 ≤ r ∧ r < (d : ℤ)) (f : ℝ → E) (hf : ContinuousOn f (Icc (0 : ℝ) 1)) (hloc : ∀ x ∈ Icc (0 : ℝ) 1, ∀ ε > 0, ∀ᶠ α : ℝ in 𝓝[>] 0, ∀ᶠ N : ℕ in atTop, ∀ a b : ℝ, 0 ≤ a → a ≤ x → x ≤ b → b ≤ 1 → b - a = α → ‖(𝔼 n ∈ residueInterval d r (a * N) (b * N), P N n) - f x‖ < ε) : Tendsto (fun N => windowSum P d r N 0 1) atTop (𝓝 ((d : ℝ)⁻¹ • ∫ x in (0 : ℝ)..1, f x)) := by have hdR : (0 : ℝ) < d := by exact_mod_cast hd rw [← intervalIntegral.integral_smul] apply tendsto_of_local_interval_law atTop (windowSum P d r) (fun x => (d : ℝ)⁻¹ • f x) · intro N a b c _ hab hbc _ exact windowSum_add P d r N a b c hab hbc · exact hf.const_smul _ · intro x hx ε hε have hη : 0 < ε * (d : ℝ) / 4 := by positivity obtain ⟨δ, hδ, hδp⟩ := mem_nhdsGT_iff_exists_Ioo_subset.mp (hloc x hx _ hη) refine ⟨δ, hδ, ?_⟩ intro a b ha hab hb hax hxb hlen have hlocal := hδp ⟨sub_pos.mpr hab, hlen⟩ have hm := residueInterval_card_tendsto d hd r hr a b hab.le have hup : ∀ᶠ N : ℕ in atTop, ((residueInterval d r (a * N) (b * N)).card : ℝ) / N < 2 * (b - a) / (d : ℝ) := (tendsto_order.mp hm).2 _ (by rw [mul_div_assoc]; have : 0 < (b-a)/(d:ℝ) := div_pos (sub_pos.mpr hab) hdR; linarith) have hsm := hm.smul (tendsto_const_nhds (x := f x)) have heps : 0 < ε * (b - a) / 2 := by positivity have herr := (Metric.tendsto_nhds.mp hsm) _ heps filter_upwards [hlocal, hup, herr] with N hN hupper herror have hmass : 0 ≤ ((residueInterval d r (a * N) (b * N)).card : ℝ) / N := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) have havg := hN a b ha hax hxb hb rfl rw [windowSum_eq] have hscale : (b - a) • ((d : ℝ)⁻¹ • f x) = ((b - a)/(d : ℝ)) • f x := by simp only [smul_smul, div_eq_mul_inv] rw [hscale] calc _ ≤ ‖(((residueInterval d r (a * N) (b * N)).card : ℝ) / N) • ((𝔼 n ∈ residueInterval d r (a * N) (b * N), P N n) - f x)‖ + ‖(((residueInterval d r (a * N) (b * N)).card : ℝ) / N) • f x - ((b - a)/(d : ℝ)) • f x‖ := by rw [smul_sub] exact (show _ from norm_add_le _ _).trans_eq' (congrArg norm (by abel)) _ ≤ (2 * (b - a) / (d : ℝ)) * (ε * (d : ℝ) / 4) + ε * (b - a) / 2 := by apply add_le_add · rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hmass] exact mul_le_mul hupper.le havg.le (norm_nonneg _) (by positivity) · simpa only [dist_eq_norm] using herror.le _ = ε * (b - a) := by field_simp; ring
endend SourcePointLaw
namespace SourcePointLawnoncomputable sectionopen scoped Topology BigOperatorsopen Filter MeasureTheory Setvariable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
omit [NormedSpace ℝ E] inlemma residueInterval_sum (d : ℕ) (hd : 0 < d) (a b : ℝ) (F : ℤ → E) : ∑ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), ∑ n ∈ residueInterval d r a b, F n = ∑ n ∈ Finset.Ico ⌈a⌉ ⌈b⌉, F n := by apply Finset.sum_fiberwise_of_maps_to intro n hn have hd' : (0 : ℤ) < d := by exact_mod_cast hd exact Finset.mem_Ico.mpr ⟨Int.emod_nonneg n hd'.ne', Int.emod_lt_of_pos n hd'⟩
omit [NormedSpace ℝ E] inlemma sum_int_Ico_zero_nat (N : ℕ) (F : ℤ → E) : ∑ n ∈ Finset.Ico (0 : ℤ) (N : ℤ), F n = ∑ n ∈ Finset.range N, F n := by symm apply Finset.sum_bij (fun (n : ℕ) _ => (n : ℤ)) · intro n hn simp only [Finset.mem_range] at hn exact Finset.mem_Ico.mpr ⟨Int.natCast_nonneg _, by exact_mod_cast hn⟩ · intro a ha b hb hab exact_mod_cast hab · intro n hn obtain ⟨hn0, hnN⟩ := Finset.mem_Ico.mp hn refine ⟨n.toNat, ?_, Int.toNat_of_nonneg hn0⟩ simp only [Finset.mem_range] have : (n.toNat : ℤ) < (N : ℤ) := by simpa only [Int.toNat_of_nonneg hn0] using hnN exact_mod_cast this · intro n hn rfl
lemma sum_windowSum (P : ℕ → ℤ → E) (d : ℕ) (hd : 0 < d) (N : ℕ) : ∑ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), windowSum P d r N 0 1 = (N : ℝ)⁻¹ • ∑ n ∈ Finset.range N, P N n := by simp only [windowSum, ← Finset.smul_sum] rw [residueInterval_sum d hd] simp only [zero_mul, one_mul, Int.ceil_zero, Int.ceil_natCast] rw [sum_int_Ico_zero_nat]
theorem global_point_law [CompleteSpace E] [Module ℚ≥0 E] (P : ℕ → ℤ → E) (d : ℕ) (hd : 0 < d) (f : ℤ → ℝ → E) (hf : ∀ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), ContinuousOn (f r) (Icc (0 : ℝ) 1)) (hloc : ∀ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), ∀ x ∈ Icc (0 : ℝ) 1, ∀ ε > 0, ∀ᶠ α : ℝ in 𝓝[>] 0, ∀ᶠ N : ℕ in atTop, ∀ a b : ℝ, 0 ≤ a → a ≤ x → x ≤ b → b ≤ 1 → b - a = α → ‖(𝔼 n ∈ residueInterval d r (a * N) (b * N), P N n) - f r x‖ < ε) : Tendsto (fun N : ℕ => (N : ℝ)⁻¹ • ∑ n ∈ Finset.range N, P N n) atTop (𝓝 ((d : ℝ)⁻¹ • ∑ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), ∫ x in (0 : ℝ)..1, f r x)) := by simpa only [sum_windowSum P d hd, Finset.smul_sum] using tendsto_finsetSum (Finset.Ico (0 : ℤ) (d : ℤ)) (fun r hr => residue_point_law P d hd r (Finset.mem_Ico.mp hr) (f r) (hf r hr) (hloc r hr))
endend SourcePointLaw
namespace SourcePointLawnoncomputable sectionopen scoped Topology BigOperatorsopen Filter MeasureTheory Setvariable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
lemma sum_windowSum_fin (P : ℕ → ℤ → E) (d : ℕ) (hd : 0 < d) (N : ℕ) : ∑ r : Fin d, windowSum P d r.val N 0 1 = (N : ℝ)⁻¹ • ∑ n ∈ Finset.range N, P N n := by calc _ = ∑ r ∈ Finset.range d, windowSum P d r N 0 1 := (Finset.sum_range _).symm _ = ∑ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), windowSum P d r N 0 1 := (sum_int_Ico_zero_nat d (fun r => windowSum P d r N 0 1)).symm _ = _ := sum_windowSum P d hd N
theorem global_point_law_fin [CompleteSpace E] [Module ℚ≥0 E] (P : ℕ → ℤ → E) (d : ℕ) (hd : 0 < d) (f : Fin d → ℝ → E) (hf : ∀ r, ContinuousOn (f r) (Icc (0 : ℝ) 1)) (hloc : ∀ r, ∀ x ∈ Icc (0 : ℝ) 1, ∀ ε > 0, ∀ᶠ α : ℝ in 𝓝[>] 0, ∀ᶠ N : ℕ in atTop, ∀ a b : ℝ, 0 ≤ a → a ≤ x → x ≤ b → b ≤ 1 → b - a = α → ‖(𝔼 n ∈ residueInterval d r.val (a * N) (b * N), P N n) - f r x‖ < ε) : Tendsto (fun N : ℕ => (N : ℝ)⁻¹ • ∑ n ∈ Finset.range N, P N n) atTop (𝓝 ((d : ℝ)⁻¹ • ∑ r : Fin d, ∫ x in (0 : ℝ)..1, f r x)) := by have hres (r : Fin d) := residue_point_law P d hd r.val (show 0 ≤ (r.val : ℤ) ∧ (r.val : ℤ) < (d : ℤ) from ⟨Int.natCast_nonneg _, by exact_mod_cast r.isLt⟩) (f r) (hf r) (hloc r) simpa only [sum_windowSum_fin P d hd, Finset.smul_sum] using tendsto_finsetSum Finset.univ (fun r _ => hres r)
endend SourcePointLaw
open scoped Topology BigOperators BoundedContinuousFunction ENNRealopen MeasureTheory Set Filter
namespace SourcePointLawnoncomputable section
def betaMeasure : Measure ℝ := volume.restrict (Icc (0 : ℝ) 1)
instance betaMeasure_probability : IsProbabilityMeasure betaMeasure where measure_univ := by simp [betaMeasure]
variable {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y]
def betaImage (μ : ProbabilityMeasure X) (T : ℝ × X → Y) (hT : Measurable T) : ProbabilityMeasure Y := ⟨Measure.map T (betaMeasure.prod (μ : Measure X)), (Measure.isProbabilityMeasure_map_iff hT.aemeasurable).mpr inferInstance⟩
variable [TopologicalSpace Y] [OpensMeasurableSpace Y]variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [SecondCountableTopology E] [MeasurableSpace E] [BorelSpace E]
theorem integral_betaImage (μ : ProbabilityMeasure X) (T : ℝ × X → Y) (hT : Measurable T) (F : Y →ᵇ E) : ∫ y, F y ∂(betaImage μ T hT : Measure Y) = ∫ β in (0 : ℝ)..1, ∫ x, F (T (β, x)) ∂(μ : Measure X) := by change (∫ y, F y ∂Measure.map T (betaMeasure.prod (μ : Measure X))) = _ rw [integral_map hT.aemeasurable F.continuous.measurable.aestronglyMeasurable] have hi : Integrable (fun z : ℝ × X => F (T z)) (betaMeasure.prod (μ : Measure X)) := (integrable_const ‖F‖).mono' (F.continuous.measurable.comp hT).aestronglyMeasurable (Eventually.of_forall (fun z => F.norm_coe_le_norm (T z))) rw [integral_prod _ hi] rw [intervalIntegral.integral_of_le (by norm_num : (0 : ℝ) ≤ 1)] exact integral_Icc_eq_integral_Ioc
endend SourcePointLaw
namespace SourcePointLawnoncomputable sectionopen scoped Topology BigOperators BoundedContinuousFunction ENNRealopen MeasureTheory Set Filter
variable {I Y : Type*} [Fintype I] [Nonempty I] [MeasurableSpace Y]
def uniformMixture (μ : I → ProbabilityMeasure Y) : ProbabilityMeasure Y := ⟨(Fintype.card I : ℝ≥0∞)⁻¹ • ∑ i, (μ i : Measure Y), by constructor simp [Measure.smul_apply, Finset.sum_apply, ENNReal.inv_mul_cancel, Fintype.card_ne_zero]⟩
variable [TopologicalSpace Y] [OpensMeasurableSpace Y]variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [SecondCountableTopology E] [MeasurableSpace E] [BorelSpace E]
lemma integral_uniformMixture (μ : I → ProbabilityMeasure Y) (F : Y →ᵇ E) : ∫ y, F y ∂(uniformMixture μ : Measure Y) = (Fintype.card I : ℝ)⁻¹ • ∑ i, ∫ y, F y ∂(μ i : Measure Y) := by change (∫ y, F y ∂((Fintype.card I : ℝ≥0∞)⁻¹ • ∑ i, (μ i : Measure Y))) = _ rw [integral_smul_measure, integral_finsetSum_measure] · simp only [ENNReal.toReal_inv, ENNReal.toReal_natCast] · intro i hi exact F.integrable _
endend SourcePointLaw
end RawSuccessInlineScope1end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.RationalLattice15import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionend
section
noncomputable sectionopen scoped BigOperatorsnamespace PolynomialArrayInterpolationopen CorrectedBoxLeibman MvPolynomial WeightedPolynomialopen IntegerGridInterpolation (tensorWeight tensor_orthogonality)abbrev Grid := IntegerGridInterpolation.Grid
lemma bounded_totalDegree {q d : ℕ} {p : MvPolynomial (Fin q) ℝ} (hp : Bounded (fun _ : Fin q=>1) d p) : p.totalDegree≤d := by rw [MvPolynomial.totalDegree] apply Finset.sup_le intro e he have hh:=hp e (MvPolynomial.mem_support_iff.mp he) simpa only [Finsupp.weight_apply,smul_eq_mul,mul_one] using hh
lemma real_orthogonality (q d : ℕ) (e f : Grid q d) : ∑ v : Grid q d,(tensorWeight q d e v:ℝ)*∏ i,((v i).val:ℝ)^(f i).val= if e=f then 1 else 0 := by have hh:=congrArg (fun x : ℚ => (x:ℝ)) (tensor_orthogonality q d e f) push_cast at hh split_ifs at hh ⊢ <;> simpa only [Rat.cast_one,Rat.cast_zero] using hh
lemma reconstruction (q d : ℕ) (a : Grid q d → ℝ) (e : Grid q d) : ∑ v : Grid q d,(tensorWeight q d e v:ℝ)* (∑ f : Grid q d,a f*∏ i,((v i).val:ℝ)^(f i).val)=a e := by classical simp_rw [Finset.mul_sum] rw [Finset.sum_comm] simp_rw [mul_left_comm (tensorWeight q d e _:ℝ) (a _)] simp_rw [← Finset.mul_sum,real_orthogonality] simp
def coefficients {q d : ℕ} (f : (Fin q → ℝ) → ℝ) (e : Grid q d) : ℝ:= ∑ v : Grid q d,(tensorWeight q d e v:ℝ)*f (fun i=>((v i).val:ℝ))
lemma coefficients_eval {q d : ℕ} (p : MvPolynomial (Fin q) ℝ) (hp : p.totalDegree≤d) (e : Grid q d) : coefficients (fun x=>eval x p) e=polynomialGrid p e := by unfold coefficients simp_rw [← gridEval_polynomial p hp] exact reconstruction q d (polynomialGrid p) e
lemma reconstruction_function {q d : ℕ} {f : (Fin q → ℝ) → ℝ} (hf : IsWeighted (fun _ : Fin q=>1) d f) (x : Fin q → ℝ) : gridEval (coefficients f : Grid q d → ℝ) x=f x := by obtain ⟨p,hp,he⟩:=hf have htd:=bounded_totalDegree hp have hf : f=fun x=>eval x p:=funext he rw [hf] have hc : (coefficients (fun x=>eval x p) : Grid q d → ℝ)=polynomialGrid p := funext (coefficients_eval p htd) rw [hc] exact gridEval_polynomial p htd x
lemma coefficients_zero_high {q d : ℕ} {f : (Fin q → ℝ) → ℝ} {k : ℕ} (hf : IsWeighted (fun _ : Fin q=>1) k f) (hkd : k≤d) (e : Grid q d) (he : k<PolynomialLineCoefficients.totalDegree e) : coefficients f e=0 := by obtain ⟨p,hp,hf⟩:=hf have htd:=bounded_totalDegree hp have hfun : f=fun x=>eval x p:=funext hf rw [hfun,coefficients_eval p (htd.trans hkd)] change p.coeff (gridExponent e)=0 by_contra hn have hh:=hp (gridExponent e) hn have hd : Finsupp.weight (fun _ : Fin q=>1) (gridExponent e)=PolynomialLineCoefficients.totalDegree e := by rw [Finsupp.weight_apply] simpa only [smul_eq_mul,mul_one] using gridExponent_degree e rw [hd] at hh omega
lemma coefficients_continuous {q d : ℕ} (e : Grid q d) : Continuous (fun f : ((Fin q → ℝ) → ℝ)=>coefficients f e) := by apply continuous_finsetSum intro v hv exact continuous_const.mul (continuous_apply _)
lemma gridEval_weighted {q d k : ℕ} (a : Grid q d → ℝ) (ha : ∀ e,k<PolynomialLineCoefficients.totalDegree e → a e=0) : IsWeighted (fun _ : Fin q=>1) k (gridEval a) := by classical refine ⟨∑ e : Grid q d,monomial (gridExponent e) (a e),?_,?_⟩ · apply bounded_sum intro e he m hm have hme : gridExponent e=m := by by_contra h simp only [coeff_monomial,h,ite_false] at hm exact hm rfl subst m have hae : a e≠0 := by simpa only [coeff_monomial,ite_true] using hm have hd : Finsupp.weight (fun _ : Fin q=>1) (gridExponent e)= PolynomialLineCoefficients.totalDegree e := by rw [Finsupp.weight_apply] simpa only [smul_eq_mul,mul_one] using gridExponent_degree e rw [hd] by_contra h exact hae (ha e (Nat.lt_of_not_ge h)) · intro x simp only [gridEval,map_sum,eval_monomial] apply Finset.sum_congr rfl intro e he congr 1 rw [Finsupp.prod_fintype _ _ (by intro i; simp)] rfl
lemma coefficients_gridEval {q d : ℕ} (a : Grid q d → ℝ) (e : Grid q d) : coefficients (gridEval a) e=a e := reconstruction q d a e
lemma grid_injective {q d : ℕ} {f g : (Fin q → ℝ) → ℝ} (hf : IsWeighted (fun _ : Fin q=>1) d f) (hg : IsWeighted (fun _ : Fin q=>1) d g) (hfg : ∀ v : Grid q d,f (fun i=>((v i).val:ℝ))=g (fun i=>((v i).val:ℝ))) : f=g := by have hc : (coefficients f : Grid q d → ℝ)=coefficients g := by funext e simp only [coefficients,hfg] funext x rw [← reconstruction_function hf x,← reconstruction_function hg x,hc]
end PolynomialArrayInterpolationend end
section
noncomputable sectionnamespace SortedFiniteWeightsvariable {σ : Type*} [Fintype σ]lemma exists_ordered (w : σ → ℕ) : ∃ e : Fin (Fintype.card σ) ≃ σ,Monotone (fun i=>w (e i)) := by classical let f (i : σ) : ℕ ×ₗ Fin (Fintype.card σ):=toLex (w i,Fintype.equivFin σ i) have hf : Function.Injective f := by intro i j h apply (Fintype.equivFin σ).injective exact congrArg (fun x=> (ofLex x).2) h let : LinearOrder σ:=LinearOrder.lift' f hf let e:=Fintype.orderIsoFinOfCardEq σ rfl refine ⟨e.toEquiv,?_⟩ intro i j hij have hh : f (e i) ≤ f (e j):=e.monotone hij rcases Prod.Lex.le_iff.mp hh with h|h · exact Nat.le_of_lt h · exact le_of_eq h.1
def indexing (w : σ → ℕ) : Fin (Fintype.card σ) ≃ σ:=(exists_ordered w).chooselemma indexing_monotone (w : σ → ℕ) : Monotone (fun i=>w (indexing w i)) := (exists_ordered w).choose_spec
end SortedFiniteWeightsend end
section
noncomputable sectionopen scoped BigOperatorsnamespace RationalLattice.PolynomialArraysopen PolynomialArrayInterpolation WeightedPolynomial MalcevCharactersopen CorrectedBoxLeibman (gridEval)variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n q : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c)variable (A : CubeFaces.Filtration G) (w : Fin n → ℕ)variable (hA : ∀ k (g : G),g∈A.level k ↔ ∀ i : Fin n,w i<k → c.coord g i=0)
abbrev Index (w : Fin n → ℕ) (q : ℕ) := Σ i : Fin n,{e : Grid q (w i) // PolynomialLineCoefficients.totalDegree e≤w i}
def fullCoeff (x : Index w q → ℝ) (i : Fin n) (e : Grid q (w i)) : ℝ := if he : PolynomialLineCoefficients.totalDegree e≤w i then x ⟨i,⟨e,he⟩⟩ else 0
def toLog (x : Index w q → ℝ) (u : Fin q → ℝ) (i : Fin n) : ℝ := gridEval (fullCoeff w x i) u
omit [IsTopologicalGroup G] inlemma toLog_array (x : Index w q → ℝ) : IsArray c w (fun u=>canonicalExp c (toLog w x u)) := by intro i simp only [canonicalLog_exp] apply gridEval_weighted intro e he simp only [fullCoeff,dite_eq_right (not_le.mpr he)]
def coefficients (f : group (q:=q) c hsk A w hA) (a : Index w q) : ℝ := PolynomialArrayInterpolation.coefficients (fun u=>canonicalLog c (f.val u) a.1) a.2.val
lemma fullCoeff_coefficients (f : group (q:=q) c hsk A w hA) (i : Fin n) : fullCoeff w (coefficients c hsk A w hA f) i= PolynomialArrayInterpolation.coefficients (fun u=>canonicalLog c (f.val u) i) := by funext e dsimp only [fullCoeff] split_ifs with he · rfl · exact (coefficients_zero_high (f.property i) le_rfl e (Nat.lt_of_not_ge he)).symm
lemma toLog_coefficients (f : group (q:=q) c hsk A w hA) (u : Fin q → ℝ) : toLog w (coefficients c hsk A w hA f) u=canonicalLog c (f.val u) := by funext i rw [toLog,fullCoeff_coefficients] exact reconstruction_function (f.property i) u
lemma coefficients_toLog (x : Index w q → ℝ) (a : Index w q) : PolynomialArrayInterpolation.coefficients (fun u=>toLog w x u a.1) a.2.val=x a := by rw [show (fun u=>toLog w x u a.1)=gridEval (fullCoeff w x a.1) from rfl, coefficients_gridEval] simp only [fullCoeff,dite_eq_left a.2.property]
lemma toLog_continuous (u : Fin q → ℝ) : Continuous (fun x : Index w q → ℝ=>toLog w x u) := by apply continuous_pi intro i apply continuous_finsetSum intro e he apply Continuous.mul _ continuous_const unfold fullCoeff split_ifs · exact continuous_apply _ · exact continuous_const
lemma coefficients_continuous : Continuous (coefficients (q:=q) c hsk A w hA) := by apply continuous_pi intro a apply (PolynomialArrayInterpolation.coefficients_continuous a.2.val).comp apply continuous_pi intro u exact (continuous_apply a.1).comp ((canonicalLog_continuous c).comp ((continuous_apply u).comp continuous_subtype_val))
def coefficientHomeomorph : group (q:=q) c hsk A w hA ≃ₜ (Index w q → ℝ) where toFun:=coefficients c hsk A w hA invFun x:=⟨fun u=>canonicalExp c (toLog w x u),toLog_array c w x⟩ left_inv f:=by apply Subtype.ext funext u change canonicalExp c (toLog w (coefficients c hsk A w hA f) u)=f.val u rw [toLog_coefficients,canonicalExp_log] right_inv x:=by funext a change PolynomialArrayInterpolation.coefficients (fun u=>canonicalLog c (canonicalExp c (toLog w x u)) a.1) a.2.val=x a simp only [canonicalLog_exp] exact coefficients_toLog w x a continuous_toFun:=coefficients_continuous c hsk A w hA continuous_invFun:=by apply Continuous.subtype_mk apply continuous_pi intro u exact (logHomeomorph c).symm.continuous.comp (toLog_continuous w u)
lemma coefficientHomeomorph_one : coefficientHomeomorph (q:=q) c hsk A w hA 1=0 := by funext a change PolynomialArrayInterpolation.coefficients (fun u=>canonicalLog c (1:G) a.1) a.2.val=0 simp [PolynomialArrayInterpolation.coefficients,canonicalLog_one]
end RationalLattice.PolynomialArrays
endendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.MalcevHorizontal02import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionopen _root_.Polynomial _root_.OAI.Polynomial Finsetopen scoped BigOperatorsendend
sectionnoncomputable sectionopen _root_.Polynomial _root_.OAI.Polynomial Finsetopen scoped BigOperatorsnamespace PolynomialCharacterDescent
lemma derivative_bound (d N : ℕ) (hN : 0 < N) (C : ℝ) (hC : 0 ≤ C) (p : ℝ[X]) (hp : p.natDegree ≤ d) (hc : ∀ j : ℕ, 0 < j → j ≤ d → |p.coeff j| ≤ C/(N:ℝ)^j) (x : ℝ) (hx : x ∈ Set.Icc 0 (N:ℝ)) : |p.derivative.eval x| ≤ ((d+1):ℝ)*d*C/N := by have hNr : (0:ℝ)<N := Nat.cast_pos.mpr hN have hterm (j : ℕ) (hj : j ∈ range (d+1)) : |p.coeff j*(j:ℝ)*x^(j-1)| ≤ (d:ℝ)*C/N := by have hd : j ≤ d := Nat.le_of_lt_succ (mem_range.mp hj) by_cases hz : j=0 · subst j; simp only [Nat.cast_zero,mul_zero,zero_mul,abs_zero]; positivity have hjpos : 0 < j := Nat.pos_of_ne_zero hz have hpow : (N:ℝ)^j = (N:ℝ)^(j-1)*N := by rw [← pow_succ]; congr 1; omega have hh := (le_div_iff₀ (pow_pos hNr j)).mp (hc j hjpos hd) have hjr : (j:ℝ) ≤ d := by exact_mod_cast hd simp only [abs_mul,abs_of_nonneg (Nat.cast_nonneg j : (0:ℝ) ≤ j),abs_of_nonneg (pow_nonneg hx.1 _)] apply (le_div_iff₀ hNr).mpr have hxpow := pow_le_pow_left₀ hx.1 hx.2 (j-1) have hh' : |p.coeff j| *x^(j-1)*N ≤ C := by calc _ ≤ |p.coeff j| *(N:ℝ)^(j-1)*N := by gcongr _ = |p.coeff j| *(N:ℝ)^j := by rw [hpow]; ring _ ≤ C := hh nlinarith [mul_le_mul_of_nonneg_left hh' (Nat.cast_nonneg j), mul_le_mul_of_nonneg_right hjr hC] rw [derivative_eval, sum_over_range' _ _ (d+1) (Nat.lt_succ_of_le hp)] · calc _ ≤ ∑ j ∈ range (d+1), |p.coeff j*(j:ℝ)*x^(j-1)| := abs_sum_le_sum_abs _ _ _ ≤ ∑ _j ∈ range (d+1), (d:ℝ)*C/N := sum_le_sum hterm _ = _ := by simp only [sum_const,card_range,nsmul_eq_mul]; push_cast; ring · intro i; simp
lemma linear_residual (d N : ℕ) (hd : 2 ≤ d) (hN : 0 < N) (Q : ℝ[X]) (hQ : Q.natDegree ≤ d) (q : ℤ) (C : ℝ) (hC : 0 ≤ C) (m : ℕ → ℤ) (hm : ∀ j : ℕ, 2 < j → j ≤ d → |(q:ℝ)*Q.coeff j-m j| ≤ C/(N:ℝ)^j) : ∀ h : ℕ, h < N → ∃ z : ℤ, |(q:ℝ)*((taylor (h:ℝ) Q-Q).coeff 1)-2*(q:ℝ)*Q.coeff 2*h-z| ≤ ((d+1):ℝ)*d*C/N := by let u := PolynomialIntegralResidual.integerPart d (fun j => if 2<j then m j else 0) let low : ℝ[X] := Polynomial.C (q:ℝ)*Polynomial.C (Q.coeff 0) + Polynomial.C ((q:ℝ)*Q.coeff 1)*X + Polynomial.C ((q:ℝ)*Q.coeff 2)*X^2 let p : ℝ[X] := Polynomial.C (q:ℝ)*Q-low-u.map (Int.castRingHom ℝ) have hu (j : ℕ) (hj : j ≤ d) : u.coeff j = if 2<j then m j else 0 := PolynomialIntegralResidual.integerPart_coeff _ _ _ hj have hl (j : ℕ) : low.coeff j = (if j=0 then (q:ℝ)*Q.coeff 0 else 0)+ (if j=1 then (q:ℝ)*Q.coeff 1 else 0)+ (if j=2 then (q:ℝ)*Q.coeff 2 else 0) := by simp only [low,coeff_add,coeff_C_mul,coeff_C,coeff_X,coeff_X_pow,mul_ite,mul_one,mul_zero] simp only [eq_comm] have hpd : p.natDegree ≤ d := by apply (natDegree_sub_le _ _).trans apply max_le · apply (natDegree_sub_le _ _).trans apply max_le · exact (natDegree_C_mul_le _ _).trans hQ · apply natDegree_add_le_of_degree_le · apply natDegree_add_le_of_degree_le · exact (natDegree_C_mul_le _ _).trans (by simpa only [natDegree_C] using (Nat.zero_le d)) · exact (natDegree_C_mul_le _ _).trans (by simpa using (show 1 ≤ d by omega)) · exact (natDegree_C_mul_le _ _).trans (by simpa using hd) · exact natDegree_map_le.trans (PolynomialIntegralResidual.integerPart_degree _ _) have hpc (j : ℕ) (hj : 0 < j) (hjd : j ≤ d) : |p.coeff j| ≤ C/(N:ℝ)^j := by dsimp [p] rw [coeff_sub,coeff_sub,coeff_C_mul,coeff_map,hu j hjd,hl] by_cases hj2 : 2<j · simpa [ne_of_gt hj,show j≠1 by omega,show j≠2 by omega,hj2] using hm j hj2 hjd · have he : j=1 ∨ j=2 := by omega rcases he with rfl | rfl <;> norm_num <;> positivity intro h hh have hbound := derivative_bound d N hN C hC p hpd hpc h ⟨Nat.cast_nonneg _,by exact_mod_cast hh.le⟩ have huval : (u.map (Int.castRingHom ℝ)).derivative.eval (h:ℝ) = ((u.derivative.eval (h:ℤ):ℤ):ℝ) := by rw [derivative_map,eval_map] exact eval₂_at_apply (Int.castRingHom ℝ) (h:ℤ) refine ⟨u.derivative.eval h,?_⟩ convert hbound using 2 simp only [p,derivative_sub,derivative_C_mul,eval_sub,eval_mul,eval_C,huval, coeff_sub,taylor_coeff_one] simp only [low,derivative_add,derivative_mul,derivative_C,zero_mul,derivative_X, mul_one,derivative_pow,eval_add,eval_mul,eval_C] norm_num ring
theorem polynomial_descent (d : ���) (hd : 2 ≤ d) (δ A : ℝ) (hδ : 0 < δ) (hA : 0 ≤ A) : ∃ B : ℕ, 0 < B ∧ ∃ C : ℝ, 0 < C ∧ ∃ N₀ : ℕ, 0 < N₀ ∧ ∀ N : ℕ, N₀ ≤ N → ∀ P Q : ℝ[X], Q.natDegree ≤ d → ∀ σ : ℕ → ℝ, ∀ S : Finset ℕ, S ⊆ range N → δ*N ≤ (S.card:ℝ) → (∀ h ∈ S, ∃ z : ℤ, |(P+taylor (h:ℝ) Q-Q).coeff 2-z| ≤ A/(N:ℝ)^2) → (∀ h ∈ S, ∃ z : ℤ, |(P+taylor (h:ℝ) Q-Q).coeff 1+σ h-z| ≤ A/N) → ∃ q : ℤ, q ≠ 0 ∧ |q| ≤ B ∧ (∀ j : ℕ, 2 < j → j ≤ d → ∃ m : ℤ, |(q:ℝ)*Q.coeff j-m| ≤ C/(N:ℝ)^j) ∧ (∀ h ∈ S, ∃ z : ℤ, |(q:ℝ)*P.coeff 1+2*(q:ℝ)*Q.coeff 2*h+(q:ℝ)*σ h-z| ≤ C/N) := by classical obtain ⟨B,hB,C,hC,L,hL,hdesc⟩ := high_coefficients d δ A hδ hA let C' := max C ((B:ℝ)*A+((d+1):ℝ)*d*C) have hCC : C ≤ C' := le_max_left _ _ have hsum : (B:ℝ)*A+((d+1):ℝ)*d*C ≤ C' := le_max_right _ _ refine ⟨B,hB,C',hC.trans_le hCC,L,hL,?_⟩ intro N hLN P Q hQ σ S hSN hS hsecond hfirst have hN : 0<N := hL.trans_le hLN have hNr : (0:ℝ)<N := Nat.cast_pos.mpr hN obtain ⟨q,hq,hqB,hcoeff⟩ := hdesc N hLN P Q hQ S hSN hS hsecond have hex (j : ℕ) : ∃ m : ℤ, 2<j → j≤d → |(q:ℝ)*Q.coeff j-m| ≤ C/(N:ℝ)^j := by by_cases hj : 2<j ∧ j≤d · obtain ⟨m,hm⟩ := hcoeff j hj.1 hj.2; exact ⟨m,fun _ _ => hm⟩ · exact ⟨0,fun h₁ h₂ => False.elim (hj ⟨h₁,h₂⟩)⟩ choose m hm using hex refine ⟨q,hq,hqB,?_,?_⟩ · intro j hj hjd exact ⟨m j,(hm j hj hjd).trans (div_le_div_of_nonneg_right hCC (by positivity))⟩ · intro h hh obtain ⟨z,hz⟩ := linear_residual d N hd hN Q hQ q C hC.le m hm h (mem_range.mp (hSN hh)) obtain ⟨k,hk⟩ := hfirst h hh have hqR : |(q:ℝ)| ≤ B := by exact_mod_cast hqB refine ⟨q*k-z,?_⟩ calc _ = |(q:ℝ)*((P+taylor (h:ℝ) Q-Q).coeff 1+σ h-k)- ((q:ℝ)*(taylor (h:ℝ) Q-Q).coeff 1-2*(q:ℝ)*Q.coeff 2*h-z)| := by push_cast congr 1 simp only [coeff_sub,coeff_add] ring _ ≤ |(q:ℝ)*((P+taylor (h:ℝ) Q-Q).coeff 1+σ h-k)|+ |(q:ℝ)*(taylor (h:ℝ) Q-Q).coeff 1-2*(q:ℝ)*Q.coeff 2*h-z| := abs_sub _ _ _ ≤ (B:ℝ)*(A/N)+((d+1):ℝ)*d*C/N := by apply add_le_add _ hz rw [abs_mul] exact mul_le_mul hqR hk (abs_nonneg _) (Nat.cast_nonneg B) _ = ((B:ℝ)*A+((d+1):ℝ)*d*C)/N := by ring _ ≤ C'/N := div_le_div_of_nonneg_right hsum hNr.le
end PolynomialCharacterDescentendend
sectionnoncomputable sectionopen _root_.Polynomial _root_.OAI.Polynomial Finsetopen scoped BigOperatorsnamespace PolynomialCharacterDescent
lemma taylor_coefficient_bound (d N : ℕ) (hN : 0<N) (C : ℝ) (hC : 0≤C) (p : ℝ[X]) (hp : p.natDegree≤d) (hc : ∀ j : ℕ, 0<j → j≤d → |p.coeff j|≤C/(N:ℝ)^j) (j : ℕ) (hj : 0<j) (x : ℝ) (hx : x∈Set.Icc 0 (N:ℝ)) : |(taylor x p).coeff j|≤((d+1):ℝ)*(2:ℝ)^d*C/(N:ℝ)^j := by have hNr : (0:ℝ)<N := Nat.cast_pos.mpr hN have hdeg : (hasseDeriv j p).natDegree≤d := (natDegree_hasseDeriv_le p j).trans ((Nat.sub_le _ _).trans hp) rw [taylor_coeff,eval_eq_sum_range' (Nat.lt_succ_of_le hdeg)] have hterm (k : ℕ) (hk : k∈range (d+1)) : |((hasseDeriv j p).coeff k)*x^k|≤(2:ℝ)^d*C/(N:ℝ)^j := by rw [hasseDeriv_coeff] by_cases hkj : k+j≤d · have hcoef := (le_div_iff₀ (pow_pos hNr (k+j))).mp (hc (k+j) (by omega) hkj) have hchoose : ((k+j).choose j:ℝ)≤(2:ℝ)^d := by have hh := Nat.choose_le_two_pow (k+j) j exact_mod_cast hh.trans (Nat.pow_le_pow_right (by norm_num) hkj) have hsmall : |p.coeff (k+j)| * x^k*(N:ℝ)^j≤C := by calc _ ≤ |p.coeff (k+j)| * (N:ℝ)^k*(N:ℝ)^j := by gcongr <;> first | exact hx.1 | exact hx.2 _ = |p.coeff (k+j)| * (N:ℝ)^(k+j) := by rw [pow_add]; ring _ ≤ C := hcoef rw [abs_mul,abs_mul,abs_of_nonneg (Nat.cast_nonneg _),abs_of_nonneg (pow_nonneg hx.1 _)] apply (le_div_iff₀ (pow_pos hNr j)).mpr calc _ = ((k+j).choose j:ℝ)*(|p.coeff (k+j)| * x^k*(N:ℝ)^j) := by ring _ ≤ ((k+j).choose j:ℝ)*C := mul_le_mul_of_nonneg_left hsmall (Nat.cast_nonneg _) _ ≤ _ := mul_le_mul_of_nonneg_right hchoose hC · rw [coeff_eq_zero_of_natDegree_lt (by omega),mul_zero,zero_mul,abs_zero] positivity calc _ ≤ ∑ k∈range (d+1),|((hasseDeriv j p).coeff k)*x^k| := abs_sum_le_sum_abs _ _ _ ≤ ∑ _k∈range (d+1),(2:ℝ)^d*C/(N:ℝ)^j := sum_le_sum hterm _ = _ := by simp only [sum_const,card_range,nsmul_eq_mul]; push_cast; ring
lemma nonlinear_shift_residual (d N : ℕ) (hd : 1≤d) (hN : 0<N) (Q : ℝ[X]) (hQ : Q.natDegree≤d) (q : ℤ) (C : ℝ) (hC : 0≤C) (m : ℕ → ℤ) (hm : ∀ j : ℕ, 1<j → j≤d → |(q:ℝ)*Q.coeff j-m j|≤C/(N:ℝ)^j) : ∀ h : ℕ, h<N → �� j : ℕ, 0<j → j≤d → ∃ z : ℤ, |(q:ℝ)*((taylor (h:ℝ) Q-Q).coeff j)-z| ≤ (((d+1):ℝ)*(2:ℝ)^d+1)*C/(N:ℝ)^j := by let u := PolynomialIntegralResidual.integerPart d (fun j => if 1<j then m j else 0) let low : ℝ[X] := Polynomial.C ((q:ℝ)*Q.coeff 0) + Polynomial.C ((q:ℝ)*Q.coeff 1)*X let p : ℝ[X] := Polynomial.C (q:ℝ)*Q-low-u.map (Int.castRingHom ℝ) have hu (j : ℕ) (hj : j≤d) : u.coeff j = if 1<j then m j else 0 := PolynomialIntegralResidual.integerPart_coeff _ _ _ hj have hl (j : ℕ) : low.coeff j = (if j=0 then (q:ℝ)*Q.coeff 0 else 0)+(if j=1 then (q:ℝ)*Q.coeff 1 else 0) := by simp only [low,coeff_add,coeff_C_mul,coeff_C,coeff_X,mul_ite,mul_one,mul_zero] simp only [eq_comm] have hpd : p.natDegree≤d := by apply (natDegree_sub_le _ _).trans apply max_le · apply (natDegree_sub_le _ _).trans apply max_le · exact (natDegree_C_mul_le _ _).trans hQ · apply natDegree_add_le_of_degree_le · exact (natDegree_C _).trans_le (Nat.zero_le d) · exact (natDegree_C_mul_le _ _).trans (by simpa using hd) · exact natDegree_map_le.trans (PolynomialIntegralResidual.integerPart_degree _ _) have hpc (j : ℕ) (hj : 0<j) (hjd : j≤d) : |p.coeff j|≤C/(N:ℝ)^j := by dsimp [p] rw [coeff_sub,coeff_sub,coeff_C_mul,coeff_map,hu j hjd,hl] by_cases hj1 : 1<j · simpa [ne_of_gt hj,show j≠1 by omega,hj1] using hm j hj1 hjd · have he : j=1 := by omega subst j; norm_num; positivity intro h hh j hj hjd have hbound := taylor_coefficient_bound d N hN C hC p hpd hpc j hj h ⟨Nat.cast_nonneg _,by exact_mod_cast hh.le⟩ have hdiff : |(taylor (h:ℝ) p-p).coeff j|≤(((d+1):ℝ)*(2:ℝ)^d+1)*C/(N:ℝ)^j := by rw [coeff_sub] calc _ ≤ |(taylor (h:ℝ) p).coeff j|+|p.coeff j| := abs_sub _ _ _ ≤ ((d+1):ℝ)*(2:ℝ)^d*C/(N:ℝ)^j+C/(N:ℝ)^j := add_le_add hbound (hpc j hj hjd) _ = _ := by ring have he : taylor (h:ℝ) p-p = Polynomial.C (q:ℝ)*(taylor (h:ℝ) Q-Q) - (taylor (h:ℤ) u-u).map (Int.castRingHom ℝ) - Polynomial.C ((q:ℝ)*Q.coeff 1*h) := by simp only [p,low,taylor_apply,sub_comp,add_comp,C_mul_comp,C_comp,X_comp, Polynomial.map_sub,map_comp,Polynomial.map_add,map_X,map_C,Int.coe_castRingHom,Int.cast_natCast] simp only [map_mul] ring refine ⟨(taylor (h:ℤ) u-u).coeff j,?_⟩ simpa only [he,coeff_sub,coeff_C_mul,coeff_map,coeff_C,ite_eq_right (ne_of_gt hj),sub_zero, Int.coe_castRingHom] using hdiff
theorem zero_commutator_descent (d : ℕ) (hd : 1≤d) (δ A : ℝ) (hδ : 0<δ) (hA : 0≤A) : ∃ B : ℕ, 0<B ∧ ∃ C : ℝ, 0<C ∧ ∃ N₀ : ℕ, 0<N₀ ∧ ∀ N : ℕ, N₀≤N → ∀ P Q : ℝ[X], P.natDegree≤d → Q.natDegree≤d → ∀ S : Finset ℕ, S⊆range N → δ*N≤(S.card:ℝ) → (∀ h∈S, ∀ j : ℕ, 0<j → j≤d → ∃ z : ℤ, |(P+taylor (h:ℝ) Q-Q).coeff j-z|≤A/(N:ℝ)^j) → ∃ q : ℤ, q≠0 ∧ |q|≤B ∧ (∀ j : ℕ, 0<j → ∃ m : ℤ, |(q:ℝ)*P.coeff j-m|≤C/(N:ℝ)^j) ∧ (∀ j : ℕ, 1<j → ∃ m : ℤ, |(q:ℝ)*Q.coeff j-m|≤C/(N:ℝ)^j) := by classical obtain ⟨B,hB,C,hC,L,hL,hdesc⟩ := shift_coefficients d 1 (by decide) δ A hδ hA let D := (((d+1):ℝ)*(2:ℝ)^d+1)*C let C' := max C ((B:ℝ)*A+D) have hCC : C≤C' := le_max_left _ _ have hsum : (B:ℝ)*A+D≤C' := le_max_right _ _ refine ⟨B,hB,C',hC.trans_le hCC,L,hL,?_⟩ intro N hLN P Q hP hQ S hSN hS hsmall have hN : 0<N := hL.trans_le hLN have hNr : (0:ℝ)<N := Nat.cast_pos.mpr hN obtain ⟨q,hq,hqB,hcoeff⟩ := hdesc N hLN P Q hQ S hSN hS (fun h hh => hsmall h hh 1 (by decide) hd) have hex (j : ℕ) : ∃ m : ℤ, 1<j → j≤d → |(q:ℝ)*Q.coeff j-m|≤C/(N:ℝ)^j := by by_cases hj : 1<j ∧ j≤d · obtain ⟨m,hm⟩ := hcoeff j hj.1 hj.2 exact ⟨m,fun _ _ => hm⟩ · exact ⟨0,fun h1 h2 => (hj ⟨h1,h2⟩).elim⟩ choose m hm using hex have hres := nonlinear_shift_residual d N hd hN Q hQ q C hC.le m hm have hqBr : |(q:ℝ)|≤B := by exact_mod_cast hqB refine ⟨q,hq,hqB,?_,?_⟩ · intro j hj by_cases hjd : j≤d · have hpos : (0:ℝ)<S.card := (mul_pos hδ hNr).trans_le hS obtain ⟨h,hh⟩ := card_pos.mp (by exact_mod_cast hpos) obtain ⟨z,hz⟩ := hsmall h hh j hj hjd obtain ⟨w,hw⟩ := hres h (mem_range.mp (hSN hh)) j hj hjd refine ⟨q*z-w,?_⟩ have hz' : |(q:ℝ)*((P+taylor (h:ℝ) Q-Q).coeff j-z)|≤(B:ℝ)*A/(N:ℝ)^j := by rw [abs_mul] calc _ ≤ (B:ℝ)*(A/(N:ℝ)^j) := mul_le_mul hqBr hz (abs_nonneg _) (Nat.cast_nonneg _) _ = _ := by ring have he : (q:ℝ)*P.coeff j-((q*z-w:ℤ):ℝ) = (q:ℝ)*((P+taylor (h:ℝ) Q-Q).coeff j-z)- ((q:ℝ)*((taylor (h:ℝ) Q-Q).coeff j)-w) := by simp only [coeff_sub,coeff_add,Int.cast_sub,Int.cast_mul] ring rw [he] calc _ ≤ |(q:ℝ)*((P+taylor (h:ℝ) Q-Q).coeff j-z)|+ |(q:ℝ)*((taylor (h:ℝ) Q-Q).coeff j)-w| := abs_sub _ _ _ ≤ (B:ℝ)*A/(N:ℝ)^j+D/(N:ℝ)^j := add_le_add hz' hw _ = ((B:ℝ)*A+D)/(N:ℝ)^j := by ring _ ≤ _ := div_le_div_of_nonneg_right hsum (pow_nonneg hNr.le _) · refine ⟨0,?_⟩ rw [coeff_eq_zero_of_natDegree_lt (by omega)] simp only [mul_zero,Int.cast_zero,sub_zero,abs_zero] exact div_nonneg (hC.le.trans hCC) (pow_nonneg hNr.le _) · intro j hj by_cases hjd : j≤d · exact ⟨m j,(hm j hj hjd).trans (div_le_div_of_nonneg_right hCC (pow_nonneg hNr.le _))⟩ · refine ⟨0,?_⟩ rw [coeff_eq_zero_of_natDegree_lt (by omega)] simp only [mul_zero,Int.cast_zero,sub_zero,abs_zero] exact div_nonneg (hC.le.trans hCC) (pow_nonneg hNr.le _)
end PolynomialCharacterDescent
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.WeylInverse01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnamespace PolynomialDephasingopen scoped BigOperators ComplexConjugateopen PolynomialWeylnoncomputable section
theorem norm_phase_sub_one_le (t : ℝ) : ‖phase t - 1‖ ≤ 2 * Real.pi * |t| := by unfold phase rw [mul_comm _ Complex.I, Complex.norm_exp_I_mul_ofReal_sub_one] have he : 2 * Real.pi * t / 2 = Real.pi * t := by ring rw [he, Real.norm_eq_abs, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] have h : |Real.sin (Real.pi * t)| ≤ |Real.pi * t| := Real.abs_sin_le_abs rw [abs_mul, abs_of_pos Real.pi_pos] at h nlinarith only [h]
theorem norm_phase_sub_le (x y : ℝ) : ‖phase x - phase y‖ ≤ 2 * Real.pi * |x - y| := by have he : phase x - phase y = (phase (x - y) - 1) * phase y := by rw [sub_mul, one_mul, ← phase_add] congr 2 ring rw [he, norm_mul, norm_phase, mul_one] exact norm_phase_sub_one_le _
theorem monomial_phase_variation (N d : ℕ) (ε : ℝ) : ∑ n ∈ Finset.range (N - 1), ‖phase (ε * ((n + 1 : ℕ) : ℝ) ^ d) - phase (ε * (n : ℝ) ^ d)‖ ≤ 2 * Real.pi * |ε| * (N : ℝ) ^ d := by calc _ ≤ ∑ n ∈ Finset.range (N - 1), 2 * Real.pi * |ε| * (((n + 1 : ℕ) : ℝ) ^ d - (n : ℝ) ^ d) := by apply Finset.sum_le_sum intro n _ have h := norm_phase_sub_le (ε * ((n + 1 : ℕ) : ℝ) ^ d) (ε * (n : ℝ) ^ d) have hpow : (0 : ℝ) ≤ ((n + 1 : ℕ) : ℝ) ^ d - (n : ℝ) ^ d := sub_nonneg.mpr (pow_le_pow_left₀ (Nat.cast_nonneg n) (by exact_mod_cast Nat.le_succ n) d) rw [← mul_sub, abs_mul, abs_of_nonneg hpow] at h nlinarith only [h] _ = 2 * Real.pi * |ε| * (((N - 1 : ℕ) : ℝ) ^ d - (0 : ℝ) ^ d) := by rw [← Finset.mul_sum] congr 1 simpa only [Nat.cast_zero] using Finset.sum_range_sub (fun n : ℕ => (n : ℝ) ^ d) (N - 1) _ ≤ _ := by apply mul_le_mul_of_nonneg_left _ (by positivity) have h := pow_le_pow_left₀ (by positivity : (0 : ℝ) ≤ ((N - 1 : ℕ) : ℝ)) (show ((N - 1 : ℕ) : ℝ) ≤ N by exact_mod_cast Nat.sub_le N 1) d linarith [pow_nonneg (show (0 : ℝ) ≤ 0 by rfl) d]
theorem weighted_mean_large_prefix (N : ℕ) (hN : 0 < N) (f w : ℕ → ℂ) (hf : ∀ n, ‖f n‖ ≤ 1) (hw : ∀ n, ‖w n‖ ≤ 1) (V δ : ℝ) (hV : 0 ≤ V) (hδ : 0 < δ) (hvar : ∑ n ∈ Finset.range (N - 1), ‖w (n + 1) - w n‖ ≤ V) (hlarge : δ ≤ ‖mean N (fun n => w n * f n)‖) : ∃ M : ℕ, 0 < M ∧ M ≤ N ∧ δ * N / (1 + V) ≤ M ∧ δ / (1 + V) ≤ ‖mean M f‖ := by classical let F : ℕ → ℂ := fun M => ∑ n ∈ Finset.range M, f n obtain ⟨M, hM, hmax⟩ := (Finset.Icc 1 N).exists_max_image (fun M => ‖F M‖) ⟨1, Finset.mem_Icc.mpr ⟨le_rfl, hN⟩⟩ have hM₀ : 0 < M := (Finset.mem_Icc.mp hM).1 have hMN : M ≤ N := (Finset.mem_Icc.mp hM).2 have hbound : ‖∑ n ∈ Finset.range N, w n * f n‖ ≤ (1 + V) * ‖F M‖ := by have he := Finset.sum_range_by_parts w f N simp only [smul_eq_mul] at he rw [he] calc _ ≤ ‖w (N - 1) * F N‖ + ‖∑ n ∈ Finset.range (N - 1), (w (n + 1) - w n) * F (n + 1)‖ := norm_sub_le _ _ _ ≤ 1 * ‖F M‖ + ∑ n ∈ Finset.range (N - 1), ‖w (n + 1) - w n‖ * ‖F M‖ := by apply add_le_add · rw [norm_mul] exact mul_le_mul (hw _) (hmax N (Finset.mem_Icc.mpr ⟨hN, le_rfl⟩)) (norm_nonneg _) (by norm_num) · apply (norm_sum_le _ _).trans apply Finset.sum_le_sum intro n hn rw [norm_mul] apply mul_le_mul_of_nonneg_left _ (norm_nonneg _) exact hmax (n + 1) (Finset.mem_Icc.mpr ⟨by omega, by have := Finset.mem_range.mp hn; omega⟩) _ ≤ (1 + V) * ‖F M‖ := by rw [← Finset.sum_mul] nlinarith only [mul_le_mul_of_nonneg_right hvar (norm_nonneg (F M))] have hsum : δ * N ≤ (1 + V) * ‖F M‖ := by have he : ‖mean N (fun n => w n * f n)‖ = ‖∑ n ∈ Finset.range N, w n * f n‖ / N := by simp [mean, Finset.expect_eq_sum_div_card ] rw [he] at hlarge exact ((le_div_iff₀ (Nat.cast_pos.mpr hN)).mp hlarge).trans hbound have hF : ‖F M‖ ≤ M := by apply (norm_sum_le _ _).trans calc (∑ n ∈ Finset.range M, ‖f n‖) ≤ ∑ n ∈ Finset.range M, (1 : ℝ) := Finset.sum_le_sum (fun n _ => hf n) _ = M := by simp have hVM : 0 < 1 + V := by linarith refine ⟨M, hM₀, hMN, ?_, ?_⟩ · apply (div_le_iff₀ hVM).mpr nlinarith only [hsum, hF, mul_le_mul_of_nonneg_left hF hVM.le] · have he : ‖mean M f‖ = ‖F M‖ / M := by simp [mean, F, Finset.expect_eq_sum_div_card ] rw [he] apply (div_le_div_iff₀ hVM (Nat.cast_pos.mpr hM₀)).mpr have hMN' : (M : ℝ) ≤ N := by exact_mod_cast hMN nlinarith only [hsum, mul_le_mul_of_nonneg_left hMN' hδ.le]
def fourierCoefficient {q : ℕ} [NeZero q] (F : ZMod q → ℂ) (k : ZMod q) : ℂ := (q : ℂ)⁻¹ * ZMod.dft F k
theorem norm_fourierCoefficient_le_one {q : ℕ} [NeZero q] (F : ZMod q → ℂ) (hF : ∀ x, ‖F x‖ ≤ 1) (k : ZMod q) : ‖fourierCoefficient F k‖ ≤ 1 := by have he : fourierCoefficient F k = 𝔼 j : ZMod q, ZMod.stdAddChar (-(j * k)) * F j := by simp [fourierCoefficient, ZMod.dft_apply, Finset.expect_eq_sum_div_card, div_eq_mul_inv, mul_comm] rw [he] apply (RCLike.norm_expect_le (K := ℂ)).trans apply Finset.expect_le Finset.univ_nonempty intro j _ simpa only [norm_mul, ZMod.stdAddChar_apply, Circle.norm_coe, one_mul] using hF j
theorem fourier_expansion {q : ℕ} [NeZero q] (F : ZMod q → ℂ) (x : ZMod q) : F x = ∑ k : ZMod q, fourierCoefficient F k * ZMod.stdAddChar (k * x) := by have h := congrFun (ZMod.dft.symm_apply_apply F) x rw [ZMod.invDFT_apply] at h rw [← h] simp only [smul_eq_mul, Finset.mul_sum, fourierCoefficient] apply Finset.sum_congr rfl intro k _ ring
theorem stdAddChar_int_phase {q : ℕ} [NeZero q] (z : ℤ) : ZMod.stdAddChar (z : ZMod q) = phase ((z : ℝ) / q) := by rw [ZMod.stdAddChar_coe, phase] congr 1 push_cast ring
theorem stdAddChar_mul_nat_phase {q : ℕ} [NeZero q] (k : ZMod q) (n : ℕ) : ZMod.stdAddChar (k * (n : ZMod q)) = phase ((k.val : ℝ) / q * n) := by have he : (((k.val : ℤ) * n : ℤ) : ZMod q) = k * (n : ZMod q) := by simp rw [← he, stdAddChar_int_phase] congr 1 push_cast ring
theorem rational_monomial_phase {q : ℕ} [NeZero q] (m : ℤ) (d n : ℕ) : phase ((m : ℝ) / q * (n : ℝ) ^ d) = ZMod.stdAddChar ((m : ZMod q) * (n : ZMod q) ^ d) := by have he : ((m * (n : ℤ) ^ d : ℤ) : ZMod q) = (m : ZMod q) * (n : ZMod q) ^ d := by push_cast; rfl rw [← he, stdAddChar_int_phase] congr 1 push_cast ring
theorem periodic_weight_large_frequency {q : ℕ} [NeZero q] (F : ZMod q → ℂ) (hF : ∀ x, ‖F x‖ ≤ 1) (f : ℕ → ℂ) (N : ℕ) (δ : ℝ) (hlarge : δ ≤ ‖mean N (fun n => F (n : ZMod q) * f n)‖) : ∃ k : ZMod q, δ / q ≤ ‖mean N (fun n => ZMod.stdAddChar (k * (n : ZMod q)) * f n)‖ := by classical let G := fun k : ZMod q => mean N (fun n => ZMod.stdAddChar (k * (n : ZMod q)) * f n) have he : mean N (fun n => F (n : ZMod q) * f n) = ∑ k : ZMod q, fourierCoefficient F k * G k := by unfold mean conv_lhs => arg 2; ext n; dsimp only; rw [fourier_expansion F (n : ZMod q)] simp_rw [Finset.sum_mul, mul_assoc] rw [Finset.expect_sum_comm] simp_rw [← Finset.mul_expect] rfl obtain ⟨k, _, hmax⟩ := Finset.univ.exists_max_image (fun k : ZMod q => ‖G k‖) Finset.univ_nonempty refine ⟨k, ?_⟩ have hbound : δ ≤ (q : ℝ) * ‖G k‖ := by apply hlarge.trans rw [he] apply (norm_sum_le _ _).trans calc (∑ j : ZMod q, ‖fourierCoefficient F j * G j‖) ≤ ∑ _j : ZMod q, ‖G k‖ := by apply Finset.sum_le_sum intro j _ rw [norm_mul] exact (mul_le_mul (norm_fourierCoefficient_le_one F hF j) (hmax j (Finset.mem_univ j)) (norm_nonneg _) (by norm_num)).trans_eq (one_mul _) _ = (q : ℝ) * ‖G k‖ := by simp apply (div_le_iff₀ (show 0 < (q : ℝ) by exact_mod_cast Nat.pos_of_ne_zero (NeZero.ne q))).mpr nlinarith only [hbound]
theorem remove_rational_monomial (q B N d : ℕ) (hq : 0 < q) (hqB : q ≤ B) (hN : 0 < N) (m : ℤ) (ε A δ : ℝ) (hA : 0 ≤ A) (hδ : 0 < δ) (hε : |ε| * (N : ℝ) ^ d ≤ A) (f : ℕ → ℂ) (hf : ∀ n, ‖f n‖ ≤ 1) (hlarge : δ ≤ ‖mean N (fun n => phase ((m : ℝ) / q * (n : ℝ) ^ d) * phase (ε * (n : ℝ) ^ d) * f n)‖) : ∃ l : ℕ, l < q ∧ ∃ M : ℕ, 0 < M ∧ M ≤ N ∧ δ / ((B : ℝ) * (1 + 2 * Real.pi * A)) * N ≤ M ∧ δ / ((B : ℝ) * (1 + 2 * Real.pi * A)) ≤ ‖mean M (fun n => phase ((l : ℝ) / q * n) * f n)‖ := by let : NeZero q := ⟨Nat.ne_of_gt hq⟩ let F : ZMod q → ℂ := fun x => ZMod.stdAddChar ((m : ZMod q) * x ^ d) have hlarge' : δ ≤ ‖mean N (fun n => F (n : ZMod q) * (phase (ε * (n : ℝ) ^ d) * f n))‖ := by simpa only [F, ← rational_monomial_phase, mul_assoc] using hlarge obtain ⟨k, hk⟩ := periodic_weight_large_frequency F (fun x => by simp [F, ZMod.stdAddChar_apply, Circle.norm_coe]) (fun n => phase (ε * (n : ℝ) ^ d) * f n) N δ hlarge' have hk' : δ / q ≤ ‖mean N (fun n => phase (ε * (n : ℝ) ^ d) * (phase ((k.val : ℝ) / q * n) * f n))‖ := by simpa only [stdAddChar_mul_nat_phase, mul_left_comm] using hk obtain ⟨M, hM, hMN, hlength, hmean⟩ := weighted_mean_large_prefix N hN (fun n => phase ((k.val : ℝ) / q * n) * f n) (fun n => phase (ε * (n : ℝ) ^ d)) (fun n => by simpa only [norm_mul, norm_phase, one_mul] using hf n) (fun n => by simp) (2 * Real.pi * A) (δ / q) (by positivity) (by positivity) (by apply (monomial_phase_variation N d ε).trans have h := mul_le_mul_of_nonneg_left hε (by positivity : 0 ≤ 2 * Real.pi) nlinarith only [h]) hk' have hq₀ : 0 < (q : ℝ) := Nat.cast_pos.mpr hq have hB₀ : 0 < (B : ℝ) := Nat.cast_pos.mpr (hq.trans_le hqB) have hden : 0 < 1 + 2 * Real.pi * A := by positivity have hweak : δ / ((B : ℝ) * (1 + 2 * Real.pi * A)) ≤ (δ / q) / (1 + 2 * Real.pi * A) := by rw [div_div] apply div_le_div_of_nonneg_left hδ.le (by positivity) exact mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hqB) hden.le refine ⟨k.val, ZMod.val_lt k, M, hM, hMN, ?_, hweak.trans hmean⟩ have he : (δ / q) * N / (1 + 2 * Real.pi * A) = ((δ / q) / (1 + 2 * Real.pi * A)) * N := by ring rw [he] at hlength exact (mul_le_mul_of_nonneg_right hweak (Nat.cast_nonneg N)).trans hlength
endend PolynomialDephasing
namespace WeylCoefficientsopen scoped BigOperators ComplexConjugateopen PolynomialWeyl PolynomialDephasing WeylInversenoncomputable section
def lowerWithFrequency (p : Polynomial ℝ) (d l q : ℕ) : Polynomial ℝ := p.erase (d + 1) + Polynomial.monomial 1 ((l : ℝ) / q)
theorem lowerWithFrequency_degree (p : Polynomial ℝ) (d l q : ℕ) (hd : 0 < d) (hp : p.natDegree ≤ d + 1) : (lowerWithFrequency p d l q).natDegree ≤ d := by apply Polynomial.natDegree_add_le_of_degree_le · rw [Polynomial.natDegree_le_iff_coeff_eq_zero] intro j hj by_cases he : j = d + 1 · simp [he] · rw [Polynomial.erase_ne p he] exact Polynomial.coeff_eq_zero_of_natDegree_lt (by omega) · exact (Polynomial.natDegree_monomial_le _).trans hd
theorem lowerWithFrequency_coeff (p : Polynomial ℝ) (d l q j : ℕ) (hj : j ≤ d) : (lowerWithFrequency p d l q).coeff j = p.coeff j + if j = 1 then (l : ℝ) / q else 0 := by simp only [lowerWithFrequency, Polynomial.coeff_add, Polynomial.erase_ne p (show j ≠ d + 1 by omega), Polynomial.coeff_monomial] by_cases he : j = 1 <;> simp [he, eq_comm]
theorem remove_leading_coefficient (d A N q : ℕ) (_hA : 0 < A) (hN : 0 < N) (hq : 0 < q) (hqA : q ≤ A) (p : Polynomial ℝ) (m : ℤ) (δ : ℝ) (hδ : 0 < δ) (hm : |(q : ℝ) * p.coeff (d + 1) - m| ≤ (A : ℝ) / (N : ℝ) ^ (d + 1)) (hlarge : δ ≤ ‖mean N (polynomialPhase p)‖) : ∃ l : ℕ, l < q ∧ ∃ M : ℕ, 0 < M ∧ M ≤ N ∧ δ / ((A : ℝ) * (1 + 2 * Real.pi * A)) * N ≤ M ∧ δ / ((A : ℝ) * (1 + 2 * Real.pi * A)) ≤ ‖mean M (polynomialPhase (lowerWithFrequency p d l q))‖ := by let ε := p.coeff (d + 1) - (m : ℝ) / q have hq₀ : 0 < (q : ℝ) := Nat.cast_pos.mpr hq have hq₁ : 1 ≤ (q : ℝ) := by exact_mod_cast hq have hεeq : (q : ℝ) * ε = (q : ℝ) * p.coeff (d + 1) - m := by dsimp [ε] field_simp have hε : |ε| * (N : ℝ) ^ (d + 1) ≤ A := by apply (le_div_iff₀ (pow_pos (Nat.cast_pos.mpr hN) _)).mp apply le_trans _ hm rw [← hεeq, abs_mul, abs_of_pos hq₀] have h := mul_le_mul_of_nonneg_right hq₁ (abs_nonneg ε) simpa only [one_mul] using h have he (n : ℕ) : p.eval (n : ℝ) = (m : ℝ) / q * (n : ℝ) ^ (d + 1) + ε * (n : ℝ) ^ (d + 1) + (p.erase (d + 1)).eval (n : ℝ) := by have h := congrArg (fun u : Polynomial ℝ => u.eval (n : ℝ)) (p.monomial_add_erase (d + 1)) simp only [Polynomial.eval_add, Polynomial.eval_monomial] at h dsimp [ε] linarith only [h] obtain ⟨l, hl, M, hM, hMN, hlength, hmean⟩ := remove_rational_monomial q A N (d + 1) hq hqA hN m ε A δ (Nat.cast_nonneg _) hδ hε (polynomialPhase (p.erase (d + 1))) (fun n => by simp [polynomialPhase]) (by change δ ≤ ‖mean N (fun n => phase (p.eval (n : ℝ)))‖ at hlarge simp_rw [he, phase_add] at hlarge exact hlarge) refine ⟨l, hl, M, hM, hMN, hlength, ?_⟩ have hfun : polynomialPhase (lowerWithFrequency p d l q) = (fun n : ℕ => phase ((l : ℝ) / q * (n : ℝ)) * polynomialPhase (p.erase (d + 1)) n) := by funext n simp [polynomialPhase, lowerWithFrequency, Polynomial.eval_add, Polynomial.eval_monomial, phase_add, mul_comm] rw [hfun] exact hmean
theorem prefix_error_transfer (N M T d j : ℕ) (hN : 0 < N) (hM : 0 < M) (hT : 1 ≤ T) (hj : j ≤ d) (hNM : (N : ℝ) ≤ (T : ℝ) * M) (C : ℝ) (hC : 0 ≤ C) : C / (M : ℝ) ^ j ≤ C * (T : ℝ) ^ d / (N : ℝ) ^ j := by apply (div_le_div_iff₀ (pow_pos (Nat.cast_pos.mpr hM) _) (pow_pos (Nat.cast_pos.mpr hN) _)).mpr have hpow : (N : ℝ) ^ j ≤ (T : ℝ) ^ d * (M : ℝ) ^ j := by calc _ ≤ ((T : ℝ) * M) ^ j := pow_le_pow_left₀ (Nat.cast_nonneg _) hNM _ _ = (T : ℝ) ^ j * (M : ℝ) ^ j := mul_pow .. _ ≤ _ := mul_le_mul_of_nonneg_right (pow_le_pow_right₀ (by exact_mod_cast hT) hj) (by positivity) have h := mul_le_mul_of_nonneg_left hpow hC nlinarith only [h]
def CoefficientInverse (d : ℕ) : Prop := ∀ δ : ℝ, 0 < δ → ∃ A : ℕ, 0 < A ∧ ∀ N : ℕ, 0 < N → ∀ p : Polynomial ℝ, p.natDegree ≤ d → δ ≤ ‖mean N (polynomialPhase p)‖ → ∃ q : ℕ, 0 < q ∧ q ≤ A ∧ ∃ m : ℕ → ℤ, ∀ j : ℕ, 0 < j → j ≤ d → |(q : ℝ) * p.coeff j - m j| ≤ (A : ℝ) / (N : ℝ) ^ j
theorem coefficient_inverse_zero : CoefficientInverse 0 := by intro δ _ refine ⟨1, by omega, ?_⟩ intro N _ p _ _ exact ⟨1, by omega, le_rfl, fun _ => 0, fun j hj hj' => by omega⟩
theorem coefficient_inverse_one : CoefficientInverse 1 := by intro δ hδ obtain ⟨A, hA, hinv⟩ := leading_inverse_one δ hδ refine ⟨A, hA, ?_⟩ intro N hN p hp hlarge obtain ⟨q, hq, hqA, m, hm⟩ := hinv N hN p hp hlarge refine ⟨q, hq, hqA, fun _ => m, ?_⟩ intro j hj hj' have : j = 1 := by omega subst j exact hm
theorem coefficient_inverse_succ (d : ℕ) (hd : 0 < d) (ih : CoefficientInverse d) : CoefficientInverse (d + 1) := by intro δ hδ obtain ⟨A, hA, hlead⟩ := leading_inverse (d + 1) (by omega) δ hδ let τ := δ / ((A : ℝ) * (1 + 2 * Real.pi * A)) have hτ : 0 < τ := by dsimp [τ]; positivity obtain ⟨A', hA', hlower⟩ := ih τ hτ obtain ⟨T, hT⟩ := exists_nat_gt (max (1 : ℝ) (1 / τ)) have hT₁ : 1 ≤ (T : ℝ) := (le_max_left _ _).trans hT.le have hTnat : 1 ≤ T := by exact_mod_cast hT₁ have hTτ : 1 ≤ (T : ℝ) * τ := (div_le_iff₀ hτ).mp ((le_max_right _ _).trans hT.le) let C := A * A' let B := C * T ^ d + C + 1 have hB : 0 < B := by dsimp [B]; omega have hCB : C ≤ B := by dsimp [B]; omega have hCTB : C * T ^ d ≤ B := by dsimp [B]; omega refine ⟨B, hB, ?_⟩ intro N hN p hp hlarge obtain ⟨q, hq, hqA, m, hm⟩ := hlead N hN p hp hlarge obtain ⟨l, _, M, hM, _, hlength, hmean⟩ := remove_leading_coefficient d A N q hA hN hq hqA p m δ hδ hm hlarge obtain ⟨b, hb, hbA', z, hz⟩ := hlower M hM (lowerWithFrequency p d l q) (lowerWithFrequency_degree p d l q hd hp) hmean have hNM : (N : ℝ) ≤ (T : ℝ) * M := by change τ * N ≤ (M : ℝ) at hlength have h₁ := mul_le_mul_of_nonneg_right hTτ (Nat.cast_nonneg N) have h₂ := mul_le_mul_of_nonneg_left hlength (Nat.cast_nonneg T) nlinarith only [h₁, h₂] let z' : ℕ → ℤ := fun j => if j = d + 1 then (b : ℤ) * m else (q : ℤ) * z j - if j = 1 then (b : ℤ) * l else 0 refine ⟨q * b, by positivity, (Nat.mul_le_mul hqA hbA').trans hCB, z', ?_⟩ intro j hj hjd have hN₀ : 0 < (N : ℝ) := Nat.cast_pos.mpr hN have hM₀ : 0 < (M : ℝ) := Nat.cast_pos.mpr hM have hq₀ : 0 < (q : ℝ) := Nat.cast_pos.mpr hq have hb₀ : 0 < (b : ℝ) := Nat.cast_pos.mpr hb have hCB' : (C : ℝ) ≤ B := by exact_mod_cast hCB by_cases hjtop : j = d + 1 · subst j have he : ((q * b : ℕ) : ℝ) * p.coeff (d + 1) - (z' (d + 1) : ℝ) = (b : ℝ) * ((q : ℝ) * p.coeff (d + 1) - m) := by simp only [z', ite_eq_left rfl, Int.cast_mul, Int.cast_natCast, Nat.cast_mul] ring rw [he, abs_mul, abs_of_pos hb₀] calc _ ≤ (b : ℝ) * ((A : ℝ) / (N : ℝ) ^ (d + 1)) := mul_le_mul_of_nonneg_left hm hb₀.le _ ≤ (C : ℝ) / (N : ℝ) ^ (d + 1) := by rw [← mul_div_assoc] apply div_le_div_of_nonneg_right _ (by positivity) have h := mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hbA' : (b : ℝ) ≤ A') (Nat.cast_nonneg A) simp only [C, Nat.cast_mul] nlinarith only [h] _ ≤ _ := div_le_div_of_nonneg_right hCB' (by positivity) · have hjd' : j ≤ d := by omega have he : ((q * b : ℕ) : ℝ) * p.coeff j - (z' j : ℝ) = (q : ℝ) * ((b : ℝ) * (lowerWithFrequency p d l q).coeff j - z j) := by rw [lowerWithFrequency_coeff p d l q j hjd'] by_cases hjone : j = 1 · simp only [z', ite_eq_right hjtop, ite_eq_left hjone, Int.cast_sub, Int.cast_mul, Int.cast_natCast, Nat.cast_mul] field_simp ring · simp only [z', ite_eq_right hjtop, ite_eq_right hjone, Int.cast_mul, Int.cast_natCast, Nat.cast_mul, sub_zero, add_zero] ring rw [he, abs_mul, abs_of_pos hq₀] calc _ ≤ (q : ℝ) * ((A' : ℝ) / (M : ℝ) ^ j) := mul_le_mul_of_nonneg_left (hz j hj hjd') hq₀.le _ ≤ (C : ℝ) / (M : ℝ) ^ j := by rw [← mul_div_assoc] apply div_le_div_of_nonneg_right _ (by positivity) have h := mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hqA : (q : ℝ) ≤ A) (Nat.cast_nonneg A') simpa only [C, Nat.cast_mul] using h _ ≤ (C : ℝ) * (T : ℝ) ^ d / (N : ℝ) ^ j := prefix_error_transfer N M T d j hN hM hTnat hjd' hNM C (Nat.cast_nonneg _) _ ≤ _ := by apply div_le_div_of_nonneg_right _ (by positivity) exact_mod_cast hCTB
theorem coefficient_inverse (d : ℕ) : CoefficientInverse d := by induction d with | zero => exact coefficient_inverse_zero | succ d ih => by_cases hd : d = 0 · subst d exact coefficient_inverse_one · exact coefficient_inverse_succ d (Nat.pos_of_ne_zero hd) ih
endend WeylCoefficients
endendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.SquareInduction14import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionopen _root_.Polynomial _root_.OAI.Polynomialopen scoped BigOperatorsendend
sectionnoncomputable sectionopen _root_.Polynomial _root_.OAI.Polynomialopen scoped BigOperatorsnamespace SquareInductionopen CubeFaces CubePolynomials LeibmanSquare RationalLattice MalcevCharactersopen MeasureTheory PolynomialWeyl AbelianMalcevTorus RationalTailCoordinates UnitAddTorusvariable {G : Type} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {t d : ℕ} (c : RealCoordinates G (t+d)) (hsk : SecondKind c)variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)variable [∀ i, (H.level i).Normal]variable (s : ℕ) (hs : H.level (s+1)=⊥)variable (q : ℕ→ℕ) (hqbound : ∀ k, q k ≤ t+d) (hq2 : q 2=t)variable (hq : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin (t+d), i.val<q k → c.coord g i=0)variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)variable [MeasurableSpace (G⧸Γ)] [hBorel : @BorelSpace (G⧸Γ) (QuotientGroup.instTopologicalSpace Γ) inferInstance]variable [mtr : MetricSpace (G⧸Γ)]variable (htop : mtr.toUniformSpace.toTopologicalSpace=QuotientGroup.instTopologicalSpace Γ)
local instance polynomialLine01BinomialTopology : TopologicalSpace (G⧸Γ) := mtr.toUniformSpace.toTopologicalSpace
include hsk h0 h1 hs hqbound hq hΓ htop in
theorem degree_general_leibman_binomial (μ : Measure (G⧸Γ)) [IsProbabilityMeasure μ] [SMulInvariantMeasure G (G⧸Γ) μ] (δ : ℝ) (hδ : 0<δ) : letI : CompactSpace (G⧸Γ) := metric_compact c Γ hΓ mtr htop letI : BorelSpace (G⧸Γ) := metric_borelSpace Γ mtr htop ∃ U : Finset (G→*Multiplicative ℝ), ∃ A : ℝ, 0<A ∧ ∀ N : ℕ, 0<N → ∀ f : ℤ→G, LeibmanSquare.Polynomial H 0 f → (∃ F : C(G⧸Γ,ℂ), LipschitzWith 1 F ∧ ‖F‖≤1 ∧ δ ≤ ‖FourierObstruction.discrepancy μ N (fun k => QuotientGroup.mk (f k)) F‖) → ∃ ξ∈U, ξ≠1 ∧ Continuous ξ ∧ (∀ g∈Γ, ∃ z : ℤ, (ξ g).toAdd=z) ∧ ∃ b : Fin (t+d)→ℤ, b≠0 ∧ (∀ i, |(b i:ℝ)|≤A) ∧ (∀ a b : G, ξ (a*b*a⁻¹*b⁻¹)=1) ∧ (∀ g : G, (ξ g).toAdd=∑ i, c.coord g i*(b i:ℝ)) ∧ ∃ α : ℕ→ℝ, (∀ j : ℕ, s<j → α j=0) ∧ (∀ z : ℤ, (ξ (f z)).toAdd=∑ j : Fin (s+1), α j.val*(Ring.choose z j.val:ℤ)) ∧ ∀ j : ℕ, 0<j → (N:ℝ)^j*‖(α j : UnitAddCircle)‖≤A := by classical let : CompactSpace (G⧸Γ) := metric_compact c Γ hΓ mtr htop let : BorelSpace (G⧸Γ) := metric_borelSpace Γ mtr htop obtain ⟨U,C,hC,hprod⟩ := degree_general_metric_producer c hsk H h0 h1 s hs q hqbound hq Γ hΓ htop μ δ hδ let S : ℝ := ∑ ξ∈U, ∑ i, |(ξ (axis c i 1)).toAdd| have hS : 0≤S := Finset.sum_nonneg (fun ξ _ => Finset.sum_nonneg (fun i _ => abs_nonneg _)) let A : ℝ := 1+S+BinomialDifference.conversionBound s*C have hconv : 0<BinomialDifference.conversionBound s*C := mul_pos (BinomialDifference.conversionBound_pos s) hC have hA : 0<A := by dsimp [A]; linarith refine ⟨U,A,hA,?_⟩ intro N hN f hf hdisc obtain ⟨ξ,hξ,hξ0,hξc,hξΓ,P,hP,hPe,hPc⟩ := hprod N hN f hf hdisc obtain ⟨b,hb⟩ := integer_character_coordinates c hsk ξ Γ hΓ hξc hξΓ have hbi (i : Fin (t+d)) : (b i:ℝ)=(ξ (axis c i 1)).toAdd := by rw [hb] simp [coord_axis,Pi.single_apply] refine ⟨ξ,hξ,hξ0,hξc,hξΓ,b,?_,?_,?_,hb, fun j => BinomialDifference.coefficient ℝ j P,?_,?_,?_⟩ · intro hb0 apply hξ0 ext g apply Multiplicative.toAdd.injective change (ξ g).toAdd=0 rw [hb,hb0] simp · intro i have h1 : |(ξ (axis c i 1)).toAdd| ≤ ∑ j, |(ξ (axis c j 1)).toAdd| := Finset.single_le_sum (f := fun j : Fin (t+d) => |(ξ (axis c j 1)).toAdd|) (fun j _ => abs_nonneg _) (Finset.mem_univ i) have h2 : (∑ j, |(ξ (axis c j 1)).toAdd|)≤S := Finset.single_le_sum (f := fun χ : G→*Multiplicative ℝ => ∑ j, |(χ (axis c j 1)).toAdd|) (fun χ _ => Finset.sum_nonneg (fun j _ => abs_nonneg _)) hξ rw [hbi] dsimp [A] linarith · intro a b apply Multiplicative.toAdd.injective simp only [map_mul,map_inv,toAdd_mul,toAdd_inv] change (ξ a).toAdd+(ξ b).toAdd+(-(ξ a).toAdd)+(-(ξ b).toAdd)=0 ring · intro j hj exact BinomialDifference.coefficient_eq_zero ℝ j P (hP.trans_lt hj) · exact character_binomial_expansion H s hs hf ξ P hPe · intro j hj have hNr : 1≤(N:ℝ) := by exact_mod_cast hN have hbnd := BinomialDifference.coefficient_bound s 1 P hP (N:ℝ) C hNr hC.le (fun i hi => hPc i hi) j hj apply hbnd.trans dsimp [A] linarith
end SquareInductionendend
section namespace IntegerGridInterpolationopen scoped BigOperatorsopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable section
abbrev Grid (n d : ℕ) := Fin n → Fin (d + 1)
def weight (d : ℕ) (j t : Fin (d + 1)) : ℚ := (Lagrange.basis Finset.univ (fun t : Fin (d + 1) => (t.val : ℚ)) t).coeff j.val
theorem one_dimensional (d : ℕ) (j k : Fin (d + 1)) : ∑ t : Fin (d + 1), weight d j t * (t.val : ℚ) ^ k.val = if j = k then 1 else 0 := by classical have hinj : Set.InjOn (fun t : Fin (d + 1) => (t.val : ℚ)) (↑(Finset.univ : Finset (Fin (d + 1))) : Set (Fin (d + 1))) := by intro a _ b _ hab apply Fin.ext exact_mod_cast (show (a.val : ℚ) = b.val from hab) have hp : (X ^ k.val : ℚ[X]).degree < (Finset.univ : Finset (Fin (d + 1))).card := by simp only [degree_X_pow, Finset.card_univ, Fintype.card_fin, Nat.cast_lt] exact_mod_cast k.isLt have h := congrArg (fun p : ℚ[X] => p.coeff j.val) (Lagrange.eq_interpolate (v := fun t : Fin (d + 1) => (t.val : ℚ)) hinj hp : (X ^ k.val : ℚ[X]) = _) simp only [Lagrange.interpolate_apply, finsetSum_coeff, eval_pow, eval_X, coeff_C_mul, coeff_X_pow] at h simpa only [weight, mul_comm, Fin.ext_iff] using h.symm
def tensorWeight (n d : ℕ) (e v : Grid n d) : ℚ := ∏ i, weight d (e i) (v i)
theorem tensor_orthogonality (n d : ℕ) (e f : Grid n d) : ∑ v : Grid n d, tensorWeight n d e v * (∏ i, ((v i).val : ℚ) ^ (f i).val) = if e = f then 1 else 0 := by classical simp only [tensorWeight, ← Finset.prod_mul_distrib] rw [← Fintype.prod_sum (fun i (t : Fin (d + 1)) => weight d (e i) t * (t.val : ℚ) ^ (f i).val)] simp_rw [one_dimensional] by_cases h : e = f · subst f; simp · rw [ite_eq_right h] obtain ⟨i, hi⟩ := Function.ne_iff.mp h exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi)
theorem reconstruction (n d : ℕ) (a : Grid n d → ℚ) (e : Grid n d) : ∑ v : Grid n d, tensorWeight n d e v * (∑ f : Grid n d, a f * ∏ i, ((v i).val : ℚ) ^ (f i).val) = a e := by classical simp_rw [Finset.mul_sum] rw [Finset.sum_comm] simp_rw [mul_left_comm (tensorWeight n d e _) (a _)] simp_rw [← Finset.mul_sum] change (∑ f : Grid n d, a f * (∑ v : Grid n d, tensorWeight n d e v * ∏ i, ((v i).val : ℚ) ^ (f i).val)) = a e simp_rw [tensor_orthogonality] simp
theorem clear_denominators {ι : Type*} [Fintype ι] (f : ι → ℚ) : ∃ (B : ℕ), 0 < B ∧ ∃ w : ι → ℤ, ∀ i, (B : ℚ) * f i = w i := by classical let B := ∏ i, (f i).den have hB : 0 < B := Finset.prod_pos (fun i _ => (f i).den_pos) refine ⟨B, hB, (fun i => (B / (f i).den : ℕ) * (f i).num), ?_⟩ intro i have hd : (f i).den ∣ B := Finset.dvd_prod_of_mem (fun i => (f i).den) (Finset.mem_univ i) have he : (B : ℚ) = ((B / (f i).den : ℕ) : ℚ) * (f i).den := by exact_mod_cast (Nat.div_mul_cancel hd).symm have hq : ((f i).den : ℚ) * f i = (f i).num := by rw [mul_comm] exact (eq_div_iff (by exact_mod_cast (f i).den_ne_zero)).mp (f i).num_div_den.symm rw [he, mul_assoc, hq] push_cast rfl
theorem exists_integer_weights (n d : ℕ) : ∃ B : ℕ, 0 < B ∧ ∃ w : Grid n d → Grid n d → ℤ, ∀ e f : Grid n d, ∑ v : Grid n d, (w e v : ℝ) * ∏ i, ((v i).val : ℝ) ^ (f i).val = if e = f then (B : ℝ) else 0 := by classical obtain ⟨B, hB, w, hw⟩ := clear_denominators (fun p : Grid n d × Grid n d => tensorWeight n d p.1 p.2) refine ⟨B, hB, (fun e v => w (e, v)), ?_⟩ intro e f have hh : ∀ v, (w (e,v) : ℝ) = (B : ℝ) * (tensorWeight n d e v : ℝ) := by intro v exact_mod_cast (hw (e,v)).symm simp_rw [hh, mul_assoc] rw [← Finset.mul_sum] have hid : (∑ v : Grid n d, (tensorWeight n d e v : ℝ) * ∏ i, ((v i).val : ℝ) ^ (f i).val) = if e = f then 1 else 0 := by have h := congrArg (fun q : ℚ => (q : ℝ)) (tensor_orthogonality n d e f) push_cast at h split_ifs at h ⊢ <;> simpa only [Rat.cast_one, Rat.cast_zero] using h rw [hid] split_ifs <;> simp
theorem real_reconstruction {n d B : ℕ} (w : Grid n d → Grid n d → ℤ) (hw : ∀ e f : Grid n d, ∑ v : Grid n d, (w e v : ℝ) * ∏ i, ((v i).val : ℝ) ^ (f i).val = if e = f then (B : ℝ) else 0) (a : Grid n d → ℝ) (e : Grid n d) : ∑ v : Grid n d, (w e v : ℝ) * (∑ f : Grid n d, a f * ∏ i, ((v i).val : ℝ) ^ (f i).val) = B * a e := by classical simp_rw [Finset.mul_sum] rw [Finset.sum_comm] simp_rw [mul_left_comm (w e _ : ℝ) (a _)] simp_rw [← Finset.mul_sum, hw] simp [mul_comm]
endend IntegerGridInterpolation
namespace PolynomialLineCoefficientsopen scoped BigOperatorsopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable section
abbrev Grid (n d : ℕ) := Fin n → Fin (d + 1)def totalDegree {n d : ℕ} (e : Grid n d) : ℕ := ∑ i, (e i).val
def natLine {n d : ℕ} (e : Grid n d) (x v : Fin n → ℕ) : ℕ[X] := ∏ i, (C (x i) + C (v i) * X) ^ (e i).val
theorem linear_degree (x v : ℕ) : (C x + C v * X : ℕ[X]).natDegree ≤ 1 := by apply natDegree_add_le_of_degree_le · simp · exact (natDegree_C_mul_le _ _).trans natDegree_X_le
theorem prod_degree {ι : Type*} [DecidableEq ι] (s : Finset ι) (f : ι → ℕ[X]) (d : ι → ℕ) (hd : ∀ i ∈ s, (f i).natDegree ≤ d i) : (∏ i ∈ s, f i).natDegree ≤ ∑ i ∈ s, d i := (natDegree_prod_le s f).trans (Finset.sum_le_sum hd)
theorem prod_top_coeff {ι : Type*} [DecidableEq ι] (s : Finset ι) (f : ι → ℕ[X]) (d : ι → ℕ) (hd : ∀ i ∈ s, (f i).natDegree ≤ d i) : (∏ i ∈ s, f i).coeff (∑ i ∈ s, d i) = ∏ i ∈ s, (f i).coeff (d i) := by induction s using Finset.induction_on with | empty => simp | @insert i s hi ih => rw [Finset.prod_insert hi, Finset.sum_insert hi, Finset.prod_insert hi] rw [coeff_mul_add_eq_of_natDegree_le (hd i (Finset.mem_insert_self _ _)) (prod_degree s f d (fun j hj => hd j (Finset.mem_insert_of_mem hj)))] rw [ih (fun j hj => hd j (Finset.mem_insert_of_mem hj))]
theorem natLine_degree {n d : ℕ} (e : Grid n d) (x v : Fin n → ℕ) : (natLine e x v).natDegree ≤ totalDegree e := by apply prod_degree intro i _ simpa using natDegree_pow_le_of_le (e i).val (linear_degree (x i) (v i))
theorem natLine_coeff_zero {n d j : ℕ} (e : Grid n d) (x v : Fin n → ℕ) (hj : totalDegree e < j) : (natLine e x v).coeff j = 0 := coeff_eq_zero_of_natDegree_lt ((natLine_degree e x v).trans_lt hj)
theorem natLine_top_coeff {n d : ℕ} (e : Grid n d) (x v : Fin n → ℕ) : (natLine e x v).coeff (totalDegree e) = ∏ i, v i ^ (e i).val := by rw [natLine, totalDegree, prod_top_coeff] · apply Finset.prod_congr rfl intro i _ have hh := coeff_pow_of_natDegree_le (m := (e i).val) (linear_degree (x i) (v i)) simpa using hh · intro i _ simpa using natDegree_pow_le_of_le (e i).val (linear_degree (x i) (v i))
theorem coeff_times_pow_le_eval (p : ℕ[X]) (j N : ℕ) : p.coeff j * N ^ j ≤ p.eval N := by classical rw [eval_eq_sum, Polynomial.sum] by_cases hj : j ∈ p.support · exact Finset.single_le_sum (f := fun i => p.coeff i * N ^ i) (fun i _ => Nat.zero_le _) hj · have hh : p.coeff j = 0 := notMem_support_iff.mp hj simp [hh]
theorem totalDegree_le {n d : ℕ} (e : Grid n d) : totalDegree e ≤ n * d := by calc _ ≤ ∑ _i : Fin n, d := Finset.sum_le_sum (fun i _ => Nat.le_of_lt_succ (e i).isLt) _ = _ := by simp
theorem natLine_eval_bound {n d N : ℕ} (e : Grid n d) (x v : Fin n → ℕ) (hx : ∀ i, x i ≤ N) (hv : ∀ i, v i ≤ d) : (natLine e x v).eval N ≤ ((d + 1) * N) ^ totalDegree e := by simp only [natLine, eval_prod, eval_pow, eval_add, eval_C, eval_mul, eval_X] rw [totalDegree, ← Finset.prod_pow_eq_pow_sum] apply Finset.prod_le_prod₀ (fun i _ => Nat.zero_le _) intro i _ apply Nat.pow_le_pow_left nlinarith [hx i, hv i]
theorem natLine_coeff_bound {n d N j : ℕ} (hN : 0 < N) (e : Grid n d) (x v : Fin n → ℕ) (hx : ∀ i, x i ≤ N) (hv : ∀ i, v i ≤ d) (hj : j ≤ totalDegree e) : ((natLine e x v).coeff j : ℝ) ≤ (d + 1 : ℝ) ^ (n * d) * (N : ℝ) ^ (totalDegree e - j) := by have h := (coeff_times_pow_le_eval (natLine e x v) j N).trans (natLine_eval_bound e x v hx hv) have h' : ((natLine e x v).coeff j : ℝ) * (N : ℝ) ^ j ≤ ((d + 1 : ℝ) * N) ^ totalDegree e := by exact_mod_cast h have hp : 0 < (N : ℝ) ^ j := pow_pos (Nat.cast_pos.mpr hN) _ apply (mul_le_mul_iff_left₀ hp).mp have he : (N : ℝ) ^ (totalDegree e - j) * N ^ j = N ^ totalDegree e := by rw [← pow_add, Nat.sub_add_cancel hj] calc _ ≤ ((d + 1 : ℝ) * N) ^ totalDegree e := h' _ ≤ (d + 1 : ℝ) ^ (n * d) * (N : ℝ) ^ totalDegree e := by rw [mul_pow] exact mul_le_mul_of_nonneg_right (pow_le_pow_right₀ (by have := Nat.cast_nonneg (α := ℝ) d; linarith : (1 : ℝ) ≤ d + 1) (totalDegree_le e)) (pow_nonneg (Nat.cast_nonneg N) _) _ = _ := by rw [mul_assoc, he]
def line {n d : ℕ} (a : Grid n d → ℝ) (x v : Fin n → ℕ) : ℝ[X] := ∑ e : Grid n d, C (a e) * (natLine e x v).map (Nat.castRingHom ℝ)
theorem line_coeff {n d : ℕ} (a : Grid n d → ℝ) (x v : Fin n → ℕ) (j : ℕ) : (line a x v).coeff j = ∑ e : Grid n d, a e * ((natLine e x v).coeff j : ℝ) := by simp [line, finsetSum_coeff]
theorem line_eval {n d : ℕ} (a : Grid n d → ℝ) (x v : Fin n → ℕ) (t : ℕ) : (line a x v).eval (t : ℝ) = ∑ e : Grid n d, a e * ∏ i, ((x i + t * v i : ℕ) : ℝ) ^ (e i).val := by simp only [line, eval_finsetSum, eval_mul, eval_C, eval_map, eval₂_at_natCast, natLine, eval_prod, eval_pow, eval_add, eval_C, eval_mul, eval_X] push_cast simp only [mul_comm (v _ : ℝ) (t : ℝ)]
theorem line_degree {n d : ℕ} (a : Grid n d → ℝ) (x v : Fin n → ℕ) : (line a x v).natDegree ≤ n * d := by apply natDegree_sum_le_of_forall_le intro e _ exact (natDegree_C_mul_le _ _).trans (natDegree_map_le.trans ((natLine_degree e x v).trans (totalDegree_le e)))
endend PolynomialLineCoefficients
endendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.RationalFactor01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace RationalFactorPeriodsopen CubeFaces CubePolynomialsvariable {G : Type*} [Group G]
lemma orderedWord_mem {H : Filtration G} {k l : ℕ} (a : Fin l → G) (j : Fin l → ℕ) (ha : ∀ i, a i ∈ H.level (j i+k)) : orderedWord a j ∈ polynomials H k := by have hs : ((List.finRange l).map (fun i => (fun n : ℤ => a i ^ Ring.choose n (j i)))).prod ∈ polynomials H k := by apply Subgroup.list_prod_mem intro f hf obtain ⟨i,_,rfl⟩ := List.mem_map.mp hf exact NilpotentTaylor.binomial_mem (j i) k (a i) (ha i) convert hs using 1 funext n simp [orderedWord,Pi.list_prod_apply,List.map_map,Function.comp_def]
lemma orderedWord_character (χ : G →* Multiplicative ℝ) {l : ℕ} (a : Fin l → G) (j : Fin l → ℕ) (n : ℤ) : (χ (orderedWord a j n)).toAdd = ∑ i, ((Ring.choose n (j i) : ℤ) : ℝ) * (χ (a i)).toAdd := by rw [orderedWord_map] simp only [orderedWord,toAdd_list_sum,List.map_map,Function.comp_def,toAdd_zpow,zsmul_eq_mul] exact (Fin.sum_univ_def (fun i : Fin l => ((Ring.choose n (j i) : ℤ) : ℝ) * (χ (a i)).toAdd)).symm
lemma List.prod_finRange_castSucc {d : ℕ} (f : Fin (d+1) → G) : ((List.finRange (d+1)).map f).prod = ((List.finRange d).map (fun i => f i.castSucc)).prod * f (Fin.last d) := by rw [List.finRange_succ_last,List.map_append,List.prod_append] simp [List.map_map,Function.comp_def]
lemma word_eq_orderedWord (a : ℕ → G) (d : ℕ) : NilpotentTaylor.word a d = orderedWord (fun i : Fin d => a i.val) (fun i => i.val) := by induction d with | zero => funext n; simp [NilpotentTaylor.word,orderedWord] | succ d ih => funext n simp only [NilpotentTaylor.word,Pi.mul_apply,ih,orderedWord,List.prod_finRange_castSucc] rfl
end RationalFactorPeriodsendend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace NilpotentTayloropen CubeFaces CubePolynomials RationalFactorPeriodsvariable {G : Type*} [Group G]
lemma word_zero (a : ℕ → G) (d : ℕ) : word a (d+1) 0 = a 0 := by induction d with | zero => simp [word] | succ d ih => simpa [word,Ring.choose_zero_succ] using ih
lemma choose_one_high {d : ℕ} (hd : 2 ≤ d) : Ring.choose (1:ℤ) d = 0 := by rw [← Int.natCast_one,Ring.choose_natCast,Nat.choose_eq_zero_of_lt (by omega : 1 < d),Nat.cast_zero]
lemma word_one (a : ℕ → G) (d : ℕ) : word a (d+2) 1 = a 0 * a 1 := by induction d with | zero => simp [word] | succ d ih => change word a (d+2) 1 * a (d+2) ^ Ring.choose (1:ℤ) (d+2) = _ rw [choose_one_high (by omega),zpow_zero,mul_one,ih]
lemma word_tail_two (a : ℕ → G) (d : ℕ) (h0 : a 0=1) (h1 : a 1=1) : word a (d+2) = orderedWord (fun i : Fin d => a (i.val+2)) (fun i => i.val+2) := by induction d with | zero => funext n; simp [word,orderedWord,h0,h1] | succ d ih => funext n change word a (d+2) n * a (d+2) ^ Ring.choose n (d+2) = _ rw [ih] simp only [orderedWord,RationalFactorPeriods.List.prod_finRange_castSucc] rfl
theorem normalized_taylor (H : Filtration G) (s : ℕ) (hbot : H.level s = ⊥) (g : ℤ → G) (hg : g ∈ polynomials H 0) (h0 : g 0=1) (h1 : g 1=1) : ∃ a : Fin s → G, (∀ i, a i ∈ H.level (i.val+2)) ∧ g = orderedWord a (fun i => i.val+2) := by have hb : H.level ((s+2)+0) = ⊥ := by apply le_bot_iff.mp simpa [hbot] using H.antitone (show s ≤ (s+2)+0 by omega) obtain ⟨a,ha,he⟩ := exists_taylor hb hg have ha0 : a 0=1 := by have hx := congrFun he 0 rw [h0,show s+2=(s+1)+1 by omega,word_zero] at hx exact hx.symm have ha1 : a 1=1 := by have hx := congrFun he 1 rw [h1,word_one,ha0,one_mul] at hx exact hx.symm refine ⟨fun i => a (i.val+2),fun i => ?_,?_⟩ · simpa using ha (i.val+2) (by omega) · exact he.trans (word_tail_two a s ha0 ha1)
theorem normalized_subgroup_taylor (H : Filtration G) (s : ℕ) (hbot : H.level s = ⊥) (g : ℤ → G) (hg : g ∈ polynomials H 0) (h0 : g 0=1) (h1 : g 1 ∈ H.level 1) : ∃ a : Fin s → H.level 2, (∀ i, (a i).val ∈ H.level (i.val+2)) ∧ ∀ z, g z = (orderedWord a (fun i => i.val+2) z).val * g 1 ^ z := by let lin : ℤ → G := fun z => g 1 ^ z have hlin : lin ∈ polynomials H 0 := by simpa [lin] using binomial_mem (H:=H) 1 0 (g 1) h1 let f : ℤ → G := g * lin⁻¹ have hf : f ∈ polynomials H 0 := (polynomials H 0).mul_mem hg ((polynomials H 0).inv_mem hlin) have hf0 : f 0=1 := by simp [f,lin,h0] have hf1 : f 1=1 := by simp [f,lin] obtain ⟨a,ha,he⟩ := normalized_taylor H s hbot f hf hf0 hf1 let a' : Fin s → H.level 2 := fun i => ⟨a i,H.antitone (by omega : 2 ≤ i.val+2) (ha i)⟩ refine ⟨a',ha,fun z => ?_⟩ have hz := congrFun he z change g z * (g 1 ^ z)⁻¹ = orderedWord a (fun i => i.val+2) z at hz have hm := orderedWord_map (H.level 2).subtype a' (fun i => i.val+2) z change ((orderedWord a' (fun i => i.val+2) z : H.level 2):G) = orderedWord a _ z at hm rw [hm,←hz] group
end NilpotentTaylorendend
section
namespace PolynomialWeylopen scoped BigOperators ComplexConjugatenoncomputable section
def mean (N : ℕ) (f : ℕ → ℂ) : ℂ := 𝔼 x ∈ Finset.range N, f x
def derivative (a b : ℕ) (f : ℕ → ℂ) (x : ℕ) : ℂ := f (x + a) * conj (f (x + b))
theorem norm_mean_le_one {N : ℕ} (f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) : ‖mean N f‖ ≤ 1 := by by_cases hN : N = 0 · simp [mean, hN] · exact (RCLike.norm_expect_le (K := ℂ)).trans (Finset.expect_le (Finset.nonempty_range_iff.mpr hN) (fun x _ => hf x))
theorem norm_derivative_le_one (a b : ℕ) (f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) : ∀ x, ‖derivative a b f x‖ ≤ 1 := by intro x simp only [derivative, norm_mul, RCLike.norm_conj] calc _ ≤ 1 * 1 := mul_le_mul (hf (x + a)) (hf (x + b)) (norm_nonneg _) (by norm_num) _ = 1 := by norm_num
theorem norm_mean_shift_sub_le {N : ℕ} (hN : 0 < N) (h : ℕ) (f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) : ‖mean N (fun x => f (x + h)) - mean N f‖ ≤ 2 * (h : ℝ) / N := by have hs : (∑ x ∈ Finset.range N, f (x + h)) - (∑ x ∈ Finset.range N, f x) = (∑ x ∈ Finset.range h, f (x + N)) - (∑ x ∈ Finset.range h, f x) := by have h₁ := Finset.sum_range_add f N h have h₂ := Finset.sum_range_add f h N rw [Nat.add_comm h N] at h₂ have e₁ : (∑ x ∈ Finset.range h, f (N + x)) = ∑ x ∈ Finset.range h, f (x + N) := by apply Finset.sum_congr rfl intro x _ rw [Nat.add_comm N x] have e₂ : (∑ x ∈ Finset.range N, f (h + x)) = ∑ x ∈ Finset.range N, f (x + h) := by apply Finset.sum_congr rfl intro x _ rw [Nat.add_comm h x] rw [e₁] at h₁ rw [e₂] at h₂ linear_combination h₁ - h₂ have hb (k : ℕ) : ‖∑ x ∈ Finset.range h, f (x + k)‖ ≤ (h : ℝ) := by calc _ ≤ ∑ x ∈ Finset.range h, ‖f (x + k)‖ := norm_sum_le _ _ _ ≤ ∑ x ∈ Finset.range h, (1 : ℝ) := Finset.sum_le_sum (fun x _ => hf (x + k)) _ = _ := by simp have hb₀ : ‖∑ x ∈ Finset.range h, f x‖ ≤ (h : ℝ) := by simpa using hb 0 rw [mean, mean, Finset.expect_eq_sum_div_card, Finset.expect_eq_sum_div_card] simp only [Finset.card_range, ← sub_div, hs, norm_div, Complex.norm_natCast] apply div_le_div_of_nonneg_right _ (Nat.cast_pos.mpr hN).le calc _ ≤ ‖∑ x ∈ Finset.range h, f (x + N)‖ + ‖∑ x ∈ Finset.range h, f x‖ := norm_sub_le _ _ _ ≤ 2 * (h : ℝ) := by linarith [hb N]
theorem norm_expect_sq_le {ι : Type*} (s : Finset ι) (f : ι → ℂ) : ‖𝔼 i ∈ s, f i‖ ^ 2 ≤ 𝔼 i ∈ s, ‖f i‖ ^ 2 := by classical by_cases hs : s.Nonempty · have h₁ := RCLike.norm_expect_le (K := ℂ) (s := s) (f := f) have h₂ := Finset.expect_mul_sq_le_sq_mul_sq s (fun i => ‖f i‖) (fun _ => (1 : ℝ)) simp only [mul_one, one_pow, Finset.expect_const hs] at h₂ nlinarith [norm_nonneg (𝔼 i ∈ s, f i)] · simp [Finset.not_nonempty_iff_eq_empty.mp hs]
theorem shift_average_error {N H : ℕ} (hN : 0 < N) (hH : 0 < H) (f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) : ‖(𝔼 x ∈ Finset.range N, 𝔼 h ∈ Finset.range H, f (x + h)) - mean N f‖ ≤ 2 * (H : ℝ) / N := by rw [Finset.expect_comm] conv_lhs => rhs; rw [← Finset.expect_const (Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hH)) (mean N f)] rw [← Finset.expect_sub_distrib] apply (RCLike.norm_expect_le (K := ℂ)).trans apply Finset.expect_le (Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hH)) intro h hh apply (norm_mean_shift_sub_le hN h f hf).trans apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg N) have : (h : ℝ) ≤ H := by exact_mod_cast (Finset.mem_range.mp hh).le linarith
theorem norm_expect_sq_eq {ι : Type*} (s : Finset ι) (f : ι → ℂ) : ‖𝔼 i ∈ s, f i‖ ^ 2 = (𝔼 a ∈ s, 𝔼 b ∈ s, f a * conj (f b)).re := by simp_rw [← Finset.mul_expect, ← map_expect (starRingEnd ℂ)] rw [← Finset.expect_mul, Complex.mul_conj] rw [Complex.ofReal_re, Complex.normSq_eq_norm_sq]
theorem van_der_corput {N H : ℕ} (hN : 0 < N) (hH : 0 < H) (f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) : ‖mean N f‖ ^ 2 ≤ (𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H, ‖mean N (derivative a b f)‖) + 4 * (H : ℝ) / N := by let z := 𝔼 x ∈ Finset.range N, 𝔼 h ∈ Finset.range H, f (x + h) have hz : ‖z‖ ≤ 1 := by apply (RCLike.norm_expect_le (K := ℂ)).trans apply Finset.expect_le (Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hN)) intro x _ apply (RCLike.norm_expect_le (K := ℂ)).trans exact Finset.expect_le (Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hH)) (fun h _ => hf (x + h)) have hm := norm_mean_le_one f hf (N := N) have he := shift_average_error hN hH f hf have ht : ‖mean N f‖ - ‖z‖ ≤ 2 * (H : ℝ) / N := by have ht := norm_sub_norm_le (mean N f) z rw [norm_sub_rev] at ht exact ht.trans he have hs : ‖mean N f‖ ^ 2 ≤ ‖z‖ ^ 2 + 4 * (H : ℝ) / N := by have he₀ : 0 ≤ 2 * (H : ℝ) / N := by positivity have he₁ := mul_le_mul_of_nonneg_right ht (show 0 ≤ ‖mean N f‖ + ‖z‖ by positivity) have he₂ := mul_le_mul_of_nonneg_left (show ‖mean N f‖ + ‖z‖ ≤ 2 by linarith) he₀ have hr : 2 * (H : ℝ) / N * 2 = 4 * H / N := by ring rw [hr] at he₂ nlinarith apply hs.trans apply add_le_add _ le_rfl calc ‖z‖ ^ 2 ≤ 𝔼 x ∈ Finset.range N, ‖𝔼 h ∈ Finset.range H, f (x + h)‖ ^ 2 := norm_expect_sq_le _ _ _ = (𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H, mean N (derivative a b f)).re := by simp only [norm_expect_sq_eq, ← Complex.re_expect] congr 1 rw [Finset.expect_comm] apply Finset.expect_congr rfl intro a _ rw [Finset.expect_comm] rfl _ ≤ _ := by rw [Complex.re_expect] apply Finset.expect_le_expect intro a _ rw [Complex.re_expect] exact Finset.expect_le_expect (fun b _ => Complex.re_le_norm _)
theorem pow_le_pow_add_error {x y e : ℝ} (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) (hy₀ : 0 ≤ y) (hy₁ : y ≤ 1) (he : 0 ≤ e) (hxy : x ≤ y + e) (n : ℕ) : x ^ n ≤ y ^ n + n * e := by induction n with | zero => simp | succ n ih => have hy := pow_le_one₀ hy₀ hy₁ (n := n) have hp := pow_nonneg hy₀ n have hn : 0 ≤ (n : ℝ) * e := mul_nonneg (Nat.cast_nonneg _) he have h₁ := mul_le_mul_of_nonneg_right ih hx₀ have h₂ := mul_le_mul_of_nonneg_left hxy hp have h₃ := mul_le_mul_of_nonneg_right hy he have h₄ := mul_le_mul_of_nonneg_left hx₁ hn rw [pow_succ, pow_succ, Nat.cast_add, Nat.cast_one] nlinarith
theorem expect_pow_two_pow_le {ι : Type*} (s : Finset ι) (hs : s.Nonempty) (f : ι → ℝ) (k : ℕ) : (𝔼 i ∈ s, f i) ^ (2 ^ k) ≤ 𝔼 i ∈ s, (f i) ^ (2 ^ k) := by induction k generalizing f with | zero => simp | succ k ih => have hcs := Finset.expect_mul_sq_le_sq_mul_sq s f (fun _ => (1 : ℝ)) simp only [mul_one, one_pow, Finset.expect_const hs] at hcs calc _ = ((𝔼 i ∈ s, f i) ^ 2) ^ (2 ^ k) := by rw [← pow_mul]; congr 1; omega _ ≤ (𝔼 i ∈ s, (f i) ^ 2) ^ (2 ^ k) := pow_le_pow_left₀ (sq_nonneg _) hcs _ _ ≤ 𝔼 i ∈ s, ((f i) ^ 2) ^ (2 ^ k) := ih _ _ = _ := by apply Finset.expect_congr rfl intro i _ rw [← pow_mul] congr 1 omega
def differencedMean (N H : ℕ) : ℕ → (ℕ → ℂ) → ℝ | 0, f => ‖mean N f‖ | k + 1, f => 𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H, differencedMean N H k (derivative a b f)
theorem differencedMean_nonneg (N H k : ℕ) (f : ℕ → ℂ) : 0 ≤ differencedMean N H k f := by induction k generalizing f with | zero => exact norm_nonneg _ | succ k ih => exact Finset.expect_nonneg (fun a _ => Finset.expect_nonneg (fun b _ => ih _))
theorem differencedMean_le_one (N H k : ℕ) (f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) : differencedMean N H k f ≤ 1 := by induction k generalizing f with | zero => exact norm_mean_le_one f hf | succ k ih => by_cases hH : H = 0 · simp [differencedMean, hH] · exact Finset.expect_le (Finset.nonempty_range_iff.mpr hH) (fun a _ => Finset.expect_le (Finset.nonempty_range_iff.mpr hH) (fun b _ => ih _ (norm_derivative_le_one a b f hf)))
theorem iterated_van_der_corput {N H : ℕ} (hN : 0 < N) (hH : 0 < H) (k : ℕ) (f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) : ‖mean N f‖ ^ (2 ^ k) ≤ differencedMean N H k f + ((2 : ℝ) ^ k - 1) * (4 * H / N) := by induction k generalizing f with | zero => simp [differencedMean] | succ k ih => let u (a b : ℕ) := ‖mean N (derivative a b f)‖ let v := 𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H, u a b have hs := Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hH) have hv₀ : 0 ≤ v := Finset.expect_nonneg (fun a _ => Finset.expect_nonneg (fun b _ => norm_nonneg _)) have hv₁ : v ≤ 1 := Finset.expect_le hs (fun a _ => Finset.expect_le hs (fun b _ => norm_mean_le_one _ (norm_derivative_le_one a b f hf))) have hf₁ := norm_mean_le_one f hf (N := N) have hf₀ := norm_nonneg (mean N f) have hn : (‖mean N f‖ ^ 2) ≤ 1 := by nlinarith have he : 0 ≤ 4 * (H : ℝ) / N := by positivity have hpow := pow_le_pow_add_error (sq_nonneg _) hn hv₀ hv₁ he (van_der_corput hN hH f hf) (2 ^ k) calc _ = (‖mean N f‖ ^ 2) ^ (2 ^ k) := by rw [← pow_mul]; congr 1; omega _ ≤ v ^ (2 ^ k) + (2 ^ k : ℕ) * (4 * (H : ℝ) / N) := hpow _ ≤ (𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H, (u a b) ^ (2 ^ k)) + (2 ^ k : ℕ) * (4 * (H : ℝ) / N) := by apply add_le_add _ le_rfl exact (expect_pow_two_pow_le _ hs _ k).trans (Finset.expect_le_expect (fun a _ => expect_pow_two_pow_le _ hs _ k)) _ ≤ (𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H, (differencedMean N H k (derivative a b f) + ((2 : ℝ) ^ k - 1) * (4 * H / N))) + (2 ^ k : ℕ) * (4 * (H : ℝ) / N) := by apply add_le_add _ le_rfl exact Finset.expect_le_expect (fun a _ => Finset.expect_le_expect (fun b _ => ih _ (norm_derivative_le_one a b f hf))) _ = _ := by simp only [Finset.expect_add_distrib, Finset.expect_const hs, differencedMean, Nat.cast_pow, Nat.cast_ofNat, pow_succ] ring
def phase (t : ℝ) : ℂ := Complex.exp ((2 * Real.pi * t : ℝ) * Complex.I)
@[simp] theorem norm_phase (t : ℝ) : ‖phase t‖ = 1 := Complex.norm_exp_ofReal_mul_I _
@[simp] theorem phase_add (x y : ℝ) : phase (x + y) = phase x * phase y := by simp only [phase, mul_add, Complex.ofReal_add, Complex.exp_add, add_mul]
@[simp] theorem phase_neg (x : ℝ) : phase (-x) = conj (phase x) := by rw [phase, phase, ← Complex.exp_conj] congr 1 simp only [map_mul, Complex.conj_ofReal, Complex.conj_I, mul_neg, Complex.ofReal_neg] ring
@[simp] theorem phase_sub (x y : ℝ) : phase (x - y) = phase x * conj (phase y) := by rw [sub_eq_add_neg, phase_add, phase_neg]
@[simp] theorem phase_nat_mul (x : ℝ) (n : ℕ) : phase ((n : ℝ) * x) = (phase x) ^ n := by rw [phase, phase, ← Complex.exp_nat_mul] congr 1 push_cast ring
def polynomialPhase (p : Polynomial ℝ) (x : ℕ) : ℂ := phase (p.eval (x : ℝ))
def polynomialDifference (a b : ℕ) (p : Polynomial ℝ) : Polynomial ℝ := Polynomial.taylor (a : ℝ) p - Polynomial.taylor (b : ℝ) p
@[simp] theorem polynomialPhase_difference (a b : ℕ) (p : Polynomial ℝ) : polynomialPhase (polynomialDifference a b p) = derivative a b (polynomialPhase p) := by funext x simp [polynomialPhase, polynomialDifference, derivative, Polynomial.taylor_eval, Nat.cast_add]
theorem taylor_coeff_top (p : Polynomial ℝ) (d : ℕ) (hp : p.natDegree ≤ d) (a : ℝ) : (Polynomial.taylor a p).coeff d = p.coeff d := by by_cases hd : p.natDegree = d · subst d exact Polynomial.coeff_taylor_natDegree a p · have hl : p.natDegree < d := lt_of_le_of_ne hp hd rw [Polynomial.coeff_eq_zero_of_natDegree_lt hl, Polynomial.coeff_eq_zero_of_natDegree_lt] rwa [Polynomial.natDegree_taylor]
theorem polynomialDifference_degree (a b : ℕ) (p : Polynomial ℝ) (d : ℕ) (hp : p.natDegree ≤ d + 1) : (polynomialDifference a b p).natDegree ≤ d := by rw [Polynomial.natDegree_le_iff_coeff_eq_zero] intro n hn simp only [polynomialDifference, Polynomial.coeff_sub] by_cases he : n = d + 1 · subst n rw [taylor_coeff_top p _ hp, taylor_coeff_top p _ hp, sub_self] · have hlt : p.natDegree < n := by omega have h₁ : (Polynomial.taylor (a : ℝ) p).natDegree < n := by rwa [Polynomial.natDegree_taylor] have h₂ : (Polynomial.taylor (b : ℝ) p).natDegree < n := by rwa [Polynomial.natDegree_taylor] rw [Polynomial.coeff_eq_zero_of_natDegree_lt h₁, Polynomial.coeff_eq_zero_of_natDegree_lt h₂, sub_self]
theorem taylor_coeff_below_top (p : Polynomial ℝ) (d : ℕ) (hp : p.natDegree ≤ d + 1) (a : ℝ) : (Polynomial.taylor a p).coeff d = p.coeff d + (d + 1 : ℕ) * p.coeff (d + 1) * a := by rw [Polynomial.taylor_coeff] have hdeg : ((Polynomial.hasseDeriv d) p).natDegree < 2 := by have h := Polynomial.natDegree_hasseDeriv_le p d omega rw [Polynomial.eval_eq_sum_range' hdeg] simp only [Finset.sum_range_succ, Finset.sum_range_zero, zero_add, Polynomial.hasseDeriv_coeff, Nat.choose_self, Nat.cast_one, one_mul, pow_zero, mul_one, pow_one] rw [Nat.add_comm 1 d, Nat.choose_succ_self_right]
theorem polynomialDifference_coeff (a b : ℕ) (p : Polynomial ℝ) (d : ℕ) (hp : p.natDegree ≤ d + 1) : (polynomialDifference a b p).coeff d = (d + 1 : ℕ) * p.coeff (d + 1) * ((a : ℝ) - b) := by simp only [polynomialDifference, Polynomial.coeff_sub, taylor_coeff_below_top p d hp] ring
def linearBound (N : ℕ) (α : ℝ) : ℝ := if phase α = 1 then 1 else min 1 (2 / ((N : ℝ) * ‖phase α - 1‖))
theorem norm_linear_mean_le {N : ℕ} (hN : 0 < N) (α β : ℝ) : ‖mean N (fun x => phase (α * x + β))‖ ≤ linearBound N α := by have hunit : ∀ x : ℕ, ‖phase (α * x + β)‖ ≤ 1 := by simp have h₁ := norm_mean_le_one _ hunit (N := N) unfold linearBound split_ifs with hα · exact h₁ · apply le_min h₁ have heq : mean N (fun x => phase (α * x + β)) = phase β * (∑ x ∈ Finset.range N, (phase α) ^ x) / (N : ℂ) := by simp only [mean, Finset.expect_eq_sum_div_card, Finset.card_range] congr 1 rw [Finset.mul_sum] apply Finset.sum_congr rfl intro x _ rw [phase_add, mul_comm α, phase_nat_mul, mul_comm] rw [heq, norm_div, norm_mul, norm_phase, one_mul, Complex.norm_natCast, geom_sum_eq hα, norm_div] have hb : ‖(phase α) ^ N - 1‖ ≤ 2 := by calc _ ≤ ‖(phase α) ^ N‖ + ‖(1 : ℂ)‖ := norm_sub_le _ _ _ = 2 := by simp only [norm_pow, norm_phase, one_pow, norm_one]; norm_num calc _ ≤ (2 / ‖phase α - 1‖) / N := div_le_div_of_nonneg_right (div_le_div_of_nonneg_right hb (norm_nonneg _)) (Nat.cast_pos.mpr hN).le _ = _ := by ring
def weylBound (N H : ℕ) : ℕ → ℝ → ℝ | 0, α => linearBound N α | d + 1, α => 𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H, weylBound N H d ((d + 2 : ℕ) * α * ((a : ℝ) - b))
theorem differencedMean_polynomial_le {N : ℕ} (hN : 0 < N) (H d : ℕ) (p : Polynomial ℝ) (hp : p.natDegree ≤ d + 1) : differencedMean N H d (polynomialPhase p) ≤ weylBound N H d (p.coeff (d + 1)) := by induction d generalizing p with | zero => have he (x : ℕ) : p.eval (x : ℝ) = p.coeff 1 * x + p.coeff 0 := by rw [Polynomial.eval_eq_sum_range' (show p.natDegree < 2 by omega)] simp only [Finset.sum_range_succ, Finset.sum_range_zero, zero_add, pow_zero, mul_one, pow_one] ring change ‖mean N (fun x => phase (p.eval (x : ℝ)))‖ ≤ linearBound N (p.coeff 1) simp_rw [he] exact norm_linear_mean_le hN (p.coeff 1) (p.coeff 0) | succ d ih => apply Finset.expect_le_expect intro a _ apply Finset.expect_le_expect intro b _ have h := ih (polynomialDifference a b p) (polynomialDifference_degree a b p (d + 1) hp) rwa [polynomialPhase_difference, polynomialDifference_coeff a b p (d + 1) hp] at h
theorem polynomial_weyl_inequality {N H : ℕ} (hN : 0 < N) (hH : 0 < H) (d : ℕ) (p : Polynomial ℝ) (hp : p.natDegree ≤ d + 1) : ‖mean N (polynomialPhase p)‖ ^ (2 ^ d) ≤ weylBound N H d (p.coeff (d + 1)) + ((2 : ℝ) ^ d - 1) * (4 * H / N) := by apply (iterated_van_der_corput hN hH d (polynomialPhase p) (fun x => by simp [polynomialPhase])).trans exact add_le_add (differencedMean_polynomial_le hN H d p hp) le_rfl
@[simp] theorem phase_int (m : ℤ) : phase (m : ℝ) = 1 := by unfold phase convert Complex.exp_int_mul_two_pi_mul_I m using 1 congr 1 push_cast ring
theorem exists_int_close_of_phase (α : ℝ) : ∃ m : ℤ, |α - m| ≤ ‖phase α - 1‖ / 4 := by let m : ℤ := ⌊α + 1 / 2⌋ let t : ℝ := α - m have ht : |t| ≤ 1 / 2 := by apply abs_le.mpr have h₁ := Int.floor_le (α + 1 / 2) have h₂ := Int.lt_floor_add_one (α + 1 / 2) dsimp [t, m] constructor <;> linarith have he : phase t = phase α := by simp [t] have hnorm : ‖phase t - 1‖ = 2 * |Real.sin (Real.pi * t)| := by unfold phase rw [mul_comm _ Complex.I, Complex.norm_exp_I_mul_ofReal_sub_one] have harg : 2 * Real.pi * t / 2 = Real.pi * t := by ring rw [harg, Real.norm_eq_abs, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] have hbound : |Real.pi * t| ≤ Real.pi / 2 := by rw [abs_mul, abs_of_pos Real.pi_pos] nlinarith [Real.pi_pos] have hs := Real.mul_abs_le_abs_sin hbound rw [abs_mul, abs_of_pos Real.pi_pos] at hs have hsim : 2 / Real.pi * (Real.pi * |t|) = 2 * |t| := by field_simp rw [hsim] at hs refine ⟨m, ?_⟩ change |t| ≤ _ rw [← he, hnorm] linarith
theorem linear_inverse {N : ℕ} (hN : 0 < N) (α β δ : ℝ) (hδ : 0 < δ) (hlarge : δ ≤ ‖mean N (fun x => phase (α * x + β))‖) : ∃ m : ℤ, |α - m| ≤ 1 / (δ * N) := by obtain ⟨m, hm⟩ := exists_int_close_of_phase α refine ⟨m, hm.trans ?_⟩ have hNp : 0 < (N : ℝ) := Nat.cast_pos.mpr hN by_cases hα : phase α = 1 · simp only [hα, sub_self, norm_zero, zero_div] positivity · have hnorm : 0 < ‖phase α - 1‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hα) have hl := norm_linear_mean_le hN α β simp only [linearBound, ite_eq_right hα] at hl have hd : δ ≤ 2 / ((N : ℝ) * ‖phase α - 1‖) := hlarge.trans (hl.trans (min_le_right _ _)) have hd' := (le_div_iff₀ (mul_pos hNp hnorm)).mp hd apply (le_div_iff₀ (mul_pos hδ hNp)).mpr nlinarith
endend PolynomialWeyl
endendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.MicrocellSaturation01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsection RawSuccessInlineScope16noncomputable sectionopen scoped BigOperatorsopen Finset MeasureTheoryendend RawSuccessInlineScope16
section RawSuccessInlineScope17noncomputable sectionopen Filter Topologynamespace MicrocellEarlierScaleopen MicrocellScale AdmissibleMicrocellBoundary
theorem radius_dominates_square {M P H:ℕ→ℕ} (hM:∀ᶠ n in atTop,0<M n) (hd:Dominates (fun n=>(H n:ℝ)) (earlierScale M P)) : Dominates (fun n=>(radius (M n) (H n):ℝ)) (fun n=>(M n:ℝ)+(P n:ℝ)^2) := by have hm:∀ᶠ n in atTop,0<M n ∧ (M n:ℝ)≤earlierScale M P n := by filter_upwards [hM] with n hn refine ⟨hn,?_⟩ unfold earlierScale linarith [Nat.cast_nonneg (α:=ℝ) (P n)] have hr:=radius_dominates hm (Filter.Eventually.of_forall (scale_one M P)) hd intro C hC have hh: Tendsto (fun n=>((radius (M n) (H n):ℝ)/(earlierScale M P n)^(2*C))/2^C) atTop atTop := (hr (2*C) (by positivity)).atTop_div_const (Real.rpow_pos_of_pos (by norm_num) C) apply tendsto_atTop_mono' atTop _ hh filter_upwards [hM] with n hn let S:=earlierScale M P n let T:ℝ:=(M n:ℝ)+(P n:ℝ)^2 have hS:1≤S:=scale_one M P n have hs:0<S:=by linarith have hm0:(0:ℝ)<M n:=by exact_mod_cast hn have ht:0<T:=by dsimp [T]; positivity have hp:(P n:ℝ)≤S:=by dsimp [S,earlierScale]; linarith [Nat.cast_nonneg (α:=ℝ) (M n)] have hm':(M n:ℝ)≤S:=by dsimp [S,earlierScale]; linarith [Nat.cast_nonneg (α:=ℝ) (P n)] have hT:T≤2*S^2 := by have hp2:(P n:ℝ)^2≤S^2:=pow_le_pow_left₀ (by positivity) hp 2 dsimp [T] nlinarith have hpow:T^C≤(2:ℝ)^C*S^(2*C) := by calc _ ≤ (2*S^2)^C := Real.rpow_le_rpow ht.le hT hC.le _ = _ := by rw [Real.mul_rpow (by norm_num) (sq_nonneg S),Real.rpow_mul hs.le 2 C,Real.rpow_two] change ((radius (M n) (H n):ℝ)/S^(2*C))/2^C ≤ (radius (M n) (H n):ℝ)/T^C calc _ = (radius (M n) (H n):ℝ)/(2^C*S^(2*C)) := by ring _ ≤ _ := div_le_div_of_nonneg_left (by positivity) (Real.rpow_pos_of_pos ht C) hpow
lemma length_cast (M H:ℕ) : (length M H:ℝ)=(radius M H:ℝ)/(M:ℝ) := by exact Nat.cast_div_charZero (modulus_dvd M H)
theorem length_tendsto {M P H:ℕ→ℕ} (hM:∀ᶠ n in atTop,0<M n) (hd:Dominates (fun n=>(H n:ℝ)) (earlierScale M P)) : Tendsto (fun n=>length (M n) (H n)) atTop atTop := by have hm:∀ᶠ n in atTop,0<M n ∧ (M n:ℝ)≤earlierScale M P n := by filter_upwards [hM] with n hn refine ⟨hn,?_⟩ unfold earlierScale linarith [Nat.cast_nonneg (α:=ℝ) (P n)] have hr:=radius_dominates hm (Filter.Eventually.of_forall (scale_one M P)) hd 1 (by norm_num) have hr':Tendsto (fun n=>(radius (M n) (H n):ℝ)/earlierScale M P n) atTop atTop := by simpa only [Real.rpow_one] using hr apply (tendsto_natCast_atTop_iff (R:=ℝ)).mp apply tendsto_atTop_mono' atTop _ hr' filter_upwards [hm] with n hn rw [length_cast] apply div_le_div_of_nonneg_left (by positivity) (by exact_mod_cast hn.1) hn.2
end MicrocellEarlierScaleendend RawSuccessInlineScope17
section RawSuccessInlineScope18noncomputable sectionopen scoped BigOperatorsopen Finset MeasureTheory Filter Topologynamespace AdmissibleRawSuccessopen MicrocellScale AdmissibleMicrocellBoundary MicrocellSaturation RawHarmonicProbabilityattribute [local instance] Classical.propDecidable
theorem eventually_global {J : Type*} [Fintype J] {M P H X W : ℕ→ℕ} (c : ℝ) (hc : 0<c) (hbase : ∀ᶠ n in atTop,0<W n ∧ 0<M n ∧ W n∣M n ∧ 0<H n ∧ 0<X n) (hd : Dominates (fun n=>(H n:ℝ)) (earlierScale M P)) (hx : Dominates (fun n=>Real.log (X n:ℝ)) (fun n=>(H n:ℝ))) : ∀ᶠ n in atTop,∃ (hw : 0<W n) (hX : 4*W n≤X n) (hN : 0<length (M n) (H n)),∀ (t:J→ℕ) (A:Set ℕ), (∀ j,0<t j ∧ t j≤(P n)^2) → (∀ i∈(units (X n) (W n)).image (label (radius (M n) (H n)) (M n)), good (X n) (radius (M n) (H n)) (H n) t i → letI : Nonempty (Fin (length (M n) (H n))) := Fin.pos_iff_nonempty.mp hN c/2<(MicrocellProbability.uniformLaw (fun b:Fin (length (M n) (H n)) => MicrocellFibers.point (M n) (length (M n) (H n)*i.1) i.2 b):Measure ℕ).real A) → c/4 ≤ (law (X n) (W n) hw hX : Measure ℕ).real A := by have hbase' : ∀ᶠ n in atTop,0<W n ∧ 0<M n ∧ W n≤M n ∧ 0<H n ∧ 0<X n := by filter_upwards [hbase] with n hn exact ⟨hn.1,hn.2.1,Nat.le_of_dvd hn.2.1 hn.2.2.1,hn.2.2.2⟩ have hM := hbase.mono (fun _ hn=>hn.2.1) have hH := hbase.mono (fun _ hn=>hn.2.2.2.1) obtain ⟨ε,hε,hbd⟩ := uniform_raw_boundary 2 (by decide) hbase' hd hx have hfour := radius_four_modulus (P:=P) (hbase'.mono (fun _ hn=>⟨hn.2.1,hn.2.2.1⟩)) hd have hR := endpoint_rate hM hH (by simpa only [Real.rpow_one] using hx 1 (by norm_num)) have hL := MicrocellEarlierScale.length_tendsto hM hd have herror : Tendsto (fun n=>24*((radius (M n) (H n):ℝ)/X n)+ (Fintype.card J:ℝ)*ε n) atTop (𝓝 0) := by simpa using (hR.const_mul 24).add (hε.const_mul (Fintype.card J:ℝ)) filter_upwards [hbase,hfour,hbd,hL.eventually_ge_atTop 1, hR.eventually_lt_const (show (0:ℝ)<1 by norm_num), hR.eventually_le_const (show (0:ℝ)<c/6 by positivity), herror.eventually_le_const (show (0:ℝ)<1/4 by norm_num)] with n hn hfour hbd hL hRX hsmall herr have hxp : (0:ℝ)<X n := by exact_mod_cast hn.2.2.2.2 have hRX' : radius (M n) (H n)≤X n := by have hh : (radius (M n) (H n):ℝ)<X n := by simpa only [one_mul] using (div_lt_iff₀ hxp).mp hRX exact_mod_cast hh.le have hX : 4*W n≤X n := hfour.trans hRX' have hN : 0<length (M n) (H n) := by omega have hlen : M n*length (M n) (H n)=radius (M n) (H n) := Nat.mul_div_cancel' (modulus_dvd _ _) refine ⟨hn.1,hX,hN,?_⟩ intro t A ht hs have hp := global_success (X n) (W n) (M n) (length (M n) (H n)) (H n) hn.1 hX hn.2.1 hN hn.2.2.1 t c (ε n) hc.le A (by simpa only [hlen] using hsmall) (by simpa only [hlen] using (fun j=>hbd (t j) (ht j).1 (ht j).2)) (by simpa only [hlen] using hs) rw [hlen] at hp have hWR : (W n:ℝ)≤radius (M n) (H n) := by exact_mod_cast (show W n≤radius (M n) (H n) by omega) have hcost : (8*(radius (M n) (H n):ℝ)+16*W n)/X n ≤ 24*((radius (M n) (H n):ℝ)/X n) := by rw [←mul_div_assoc] apply div_le_div_of_nonneg_right _ hxp.le linarith have hlo : (3/4:ℝ)≤1-(8*(radius (M n) (H n):ℝ)+16*W n)/X n- (Fintype.card J:ℝ)*ε n := by linarith have hh := mul_le_mul_of_nonneg_left hlo (show 0≤c/3 by positivity) linarith
end AdmissibleRawSuccessendend RawSuccessInlineScope18
end
sectionnoncomputable sectionnamespace ProductExposureLawopen MeasureTheory Filter Topologyopen scoped BigOperatorsopen HarmonicExposure RawHarmonicProbability DyadicHarmonicBoundaryattribute [local instance] Classical.propDecidable
def jointLaw {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) : Measure ((Fin m→ℕ)×ℕ) := (Measure.pi (fun j=>(law (X j) W hW (hX j):Measure ℕ))).prod (law Xp W hW hXp:Measure ℕ)
instance jointLaw_probability {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) : IsProbabilityMeasure (jointLaw X Xp W hW hX hXp) := by unfold jointLaw infer_instance
def jointFiber {m : ℕ} (E : Set (Fin m→ℤ)) (X : Fin m→ℕ) (Xp W : ℕ) (S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (Q Δ : ℝ) (a M : ℤ) : Finset ((Fin m→ℕ)×ℕ) := ((rawTailFiber X W S r L).product (Finset.Ico Xp (Xp^2))).filter (fun z=> (fun j=>(z.1 j:ℤ))∈E ∧ M∣(z.2:ℤ)-a ∧ Q≤(∏ j,(z.1 j:ℝ))*(z.2:ℝ) ∧ (∏ j,(z.1 j:ℝ))*(z.2:ℝ)<Q+Δ)
lemma law_singleton (X W : ℕ) (hW : 0<W) (hX : 4*W≤X) (p : ℕ) : (law X W hW hX:Measure ℕ).real {p} = (if p∈RawHarmonicProbability.units X W then (p:ℝ)⁻¹ else 0)/mass X (X^2) W := by rw [MicrocellConditional.law_apply_units] simp [MicrocellConditional.eventMass]
lemma joint_singleton_mem {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (t : Fin m→ℕ) (p : ℕ) (ht : t∈rawTailFiber X W S r L) (hp : p∈Finset.Ico Xp (Xp^2)) : (jointLaw X Xp W hW hX hXp).real {(t,p)} = ((∏ j,(t j:ℝ)⁻¹)*(if W.Coprime p then (p:ℝ)⁻¹ else 0)) / ((∏ j,mass (X j) ((X j)^2) W)*mass Xp (Xp^2) W) := by have hj (j : Fin m) : (law (X j) W hW (hX j):Measure ℕ).real {t j}=(t j:ℝ)⁻¹/mass (X j) ((X j)^2) W := by rw [law_singleton,ite_eq_left] obtain ⟨hi,hc,hs⟩ := Finset.mem_filter.mp (Fintype.mem_piFinset.mp ht j) exact Finset.mem_filter.mpr ⟨hi,hc⟩ have hpp : (law Xp W hW hXp:Measure ℕ).real {p}= (if W.Coprime p then (p:ℝ)⁻¹ else 0)/mass Xp (Xp^2) W := by rw [law_singleton] simp only [RawHarmonicProbability.units,Finset.mem_filter,hp,true_and] have hpi : (Measure.pi (fun j=>(law (X j) W hW (hX j):Measure ℕ))).real {t} = ∏ j,(law (X j) W hW (hX j):Measure ℕ).real {t j} := by simp only [measureReal_def,Measure.pi_singleton,ENNReal.toReal_prod] rw [jointLaw,←Set.singleton_prod_singleton,measureReal_prod_prod,hpi,hpp] simp_rw [hj] rw [Finset.prod_div_distrib] ring
lemma joint_fiber_mass {m : ℕ} (E : Set (Fin m→ℤ)) (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (Q Δ : ℝ) (a M : ℤ) : (jointLaw X Xp W hW hX hXp).real (jointFiber E X Xp W S r L Q Δ a M : Set _) = literalFiberMass E X Xp W S r L Q Δ a M / ((∏ j,mass (X j) ((X j)^2) W)*mass Xp (Xp^2) W) := by rw [←sum_measureReal_singleton] unfold jointFiber literalFiberMass pivotFiber simp only [Finset.sum_filter,Finset.product_eq_sprod,Finset.sum_product, Finset.sum_div,Finset.mul_sum] apply Finset.sum_congr rfl intro t ht by_cases hE : (fun j=>(t j:ℤ))∈E · simp only [hE,true_and,ite_true] rw [Finset.sum_div] apply Finset.sum_congr rfl intro p hp by_cases hb : M∣(p:ℤ)-a ∧ Q≤(∏ j,(t j:ℝ))*(p:ℝ) ∧ (∏ j,(t j:ℝ))*(p:ℝ)<Q+Δ · simp only [hb] exact joint_singleton_mem X Xp W hW hX hXp S r L t p ht hp · simp [hb] · simp [hE]
theorem conditional_exact {m : ℕ} (E : Set (Fin m→ℤ)) (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (Q Δ : ℝ) (a M : ℤ) : (jointLaw X Xp W hW hX hXp).real (jointFiber E X Xp W S r L Q Δ a M : Set _) / (jointLaw X Xp W hW hX hXp).real (jointFiber Set.univ X Xp W S r L Q Δ a M : Set _) = literalFiberMass E X Xp W S r L Q Δ a M / literalFiberMass Set.univ X Xp W S r L Q Δ a M := by rw [joint_fiber_mass,joint_fiber_mass] have hN : (∏ j,mass (X j) ((X j)^2) W)*mass Xp (Xp^2) W≠0 := by apply mul_ne_zero · exact Finset.prod_ne_zero_iff.mpr (fun j _=>(mass_pos (X j) W hW (hX j)).ne') · exact (mass_pos Xp W hW hXp).ne' exact div_div_div_cancel_right₀ hN _ _
end ProductExposureLaw
endend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.ProductExposure01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionnoncomputable sectionendend
sectionnoncomputable sectionnamespace RoughFaceShiftopen RationalLattice MalcevCharacters RealPolynomialDegree RoughScales Filteropen RoughSamplingWeights FinitePieceAverages RoughSourceExceptional RoughProductRemovalopen scoped BigOperators Topologyvariable {G : Type} [Group G] [TopologicalSpace G] {dim : ℕ}variable (Γ : Subgroup G) [MetricSpace (G⧸Γ)]variable [IsTopologicalGroup G] (c : RealCoordinates G dim)
theorem source_raw_joint_face_uniform (hsk : SecondKind c) (hΓ : ∀ g : G,g∈Γ ↔ ∀ i,∃ z : ℤ,c.coord g i=z) (htop : (inferInstance : MetricSpace (G⧸Γ)).toUniformSpace.toTopologicalSpace = QuotientGroup.instTopologicalSpace Γ) (m v D d : ℕ) (hd : 0<d) (c₀ C₀ : ℝ) (B K : NNReal) (η : ℝ) (hc₀ : 0<c₀) (hC₀ : 0<C₀) (hB : 0<B) (hη : 0<η) (w M : ℕ→ℕ) (U V : ℕ → Fin m → ℝ) (Z0 H : ℕ→ℝ) (L : ℕ→ℤ) (hw : Tendsto w atTop atTop) (hU : ∀ j,Tendsto (fun n=>U n j) atTop atTop) (hUV : ∀ n j,U n j≤V n j) (hZ : ∀ a : ℝ,0<a →Tendsto (fun n=>Z0 n/(1+∑ j,V n j)^a) atTop atTop) (hH : ∀ n,0≤H n) (hHZ : Tendsto (fun n=>H n/Z0 n) atTop (𝓝 0)) (hWM : ∀ n,(primorial (w n):ℤ)∣(M n:ℤ)) (hM : ∀ n,0<M n) (hMs : ∀ n,Smooth (w n) (M n:ℤ)) (hL : ∀ n,0<L n) (hsm : ∀ n,Smooth (w n) (L n)) (hWL : ∀ n,(primorial (w n):ℤ)∣L n) (hUL : ∀ j,Tendsto (fun n=>U n j/(L n:ℝ)) atTop atTop) : ∀ ε : ℝ,0<ε →∀ᶠ n in atTop, ∀ b : Exposure m,b.Legal (U n) (V n) (Z0 n) (w n) (M n) → ∀ (X : Fin m→ℕ) (Xp : ℕ) (hX : ∀ j,4*primorial (w n)≤X j) (hXp : 4*primorial (w n)≤Xp),b.a.natAbs.Coprime (primorial (w n)) → (∀ j,(X j:ℝ)≤b.S j) → (∀ j,2*b.S j≤(X j:ℝ)^2) → (∀ t∈productTimes b.S b.r (L n),(Xp:ℝ)≤b.Q/(∏ j,(t j:ℝ))) → (∀ t∈productTimes b.S b.r (L n),(b.Q+b.Δ)/(∏ j,(t j:ℝ))≤(Xp:ℝ)^2) → ∀ (A : Fin v → ℤ) (P : (Fin (m+v)→ℝ)→G), (∀ i,HasDegree (fun y=>canonicalLog c (P y) i) D) → ∀ (σ : (G⧸Γ) → (G⧸Γ)),LipschitzWith K σ → ∀ h : (Fin m → ℤ) → Fin v → ℤ, (∀ t∈productTimes b.S b.r (L n),∀ i,(d:ℤ)∣h t i ∧ |(h t i:ℝ)|≤H n) → (∀ t∈productTimes b.S b.r (L n),∀ x : Fin v → ℤ, σ (QuotientGroup.mk (P (Fin.append (fun j=>(t j:ℝ)) (fun i=>(x i:ℝ)))))= QuotientGroup.mk (P (Fin.append (fun j=>(t j:ℝ)) (fun i=>((x i+h t i:ℤ):ℝ))))) → (ProductExposureLaw.jointLaw X Xp (primorial (w n)) (primorial_pos _) hX hXp).real (ProductExposureLaw.jointFiber {t | badFace Γ m v c₀ C₀ B η b.Z d (M n) A P σ t} X Xp (primorial (w n)) b.S b.r (L n) b.Q b.Δ b.a (M n) : Set _) / (ProductExposureLaw.jointLaw X Xp (primorial (w n)) (primorial_pos _) hX hXp).real (ProductExposureLaw.jointFiber Set.univ X Xp (primorial (w n)) b.S b.r (L n) b.Q b.Δ b.a (M n) : Set _) < ε := by classical intro ε hε have hu := raw_conditional_face_uniform (Γ:=Γ) (c:=c) hsk hΓ htop m v D d hd c₀ C₀ B K η hc₀ hC₀ hB hη w M U V Z0 H L hw hU hUV hZ hH hHZ hM hMs hL hsm hWL hUL ε hε filter_upwards [hu] with n hn intro b hb X Xp hX hXp ha hloD hhiD hloP hhiP A P hP σ hσ h hh hid rw [ProductExposureLaw.conditional_exact, HarmonicExposure.literal_mass_eq _ X Xp _ b.S b.r (L n) b.Q b.Δ b.a (M n) (hL n) (hWL n) hb.2.2.1 hloD hhiD, HarmonicExposure.literal_mass_eq Set.univ X Xp _ b.S b.r (L n) b.Q b.Δ b.a (M n) (hL n) (hWL n) hb.2.2.1 hloD hhiD] simpa only [exceptionalFace,Set.mem_ofPred_eq,Set.mem_univ,Finset.filter_true_of_mem (fun _ _=>True.intro)] using hn b hb Xp (primorial (w n)) (hWM n) ha hloP hhiP A P hP σ hσ h hh hid
end RoughFaceShiftendend
sectionnoncomputable sectionnamespace ProductExposureLabelsopen scoped BigOperatorsopen HarmonicExposure ProductExposureLawattribute [local instance] Classical.propDecidable
structure Label (m : ℕ) where dyadic : Fin m → ℕ residue : Fin m → ℤ pivotResidue : ℤ bin : ℤ
def Label.scales {m : ℕ} (b : Label m) (j : Fin m) : ℝ := 2 ^ b.dyadic j
def Label.width {m : ℕ} (b : Label m) (R : ℝ) : ℝ := (∏ j,b.scales j)*R
def Label.left {m : ℕ} (b : Label m) (R : ℝ) : ℝ := b.bin*b.width R
def expose {m : ℕ} (L M : ℤ) (R : ℝ) (z : (Fin m→ℕ)×ℕ) : Label m where dyadic := fun j=>(z.1 j).log2 residue := fun j=>(z.1 j:ℤ)%L pivotResidue := (z.2:ℤ)%M bin := ⌊(∏ j,(z.1 j:ℝ))*(z.2:ℝ) / ((∏ j,(2:ℝ)^(z.1 j).log2)*R)⌋
def rawDomain {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) : Finset ((Fin m→ℕ)×ℕ) := (Fintype.piFinset (fun j=>RawHarmonicProbability.units (X j) W)).product (Finset.Ico Xp (Xp^2))
@[ext] lemma Label.ext {m : ℕ} {a b : Label m} (h₁ : a.dyadic=b.dyadic) (h₂ : a.residue=b.residue) (h₃ : a.pivotResidue=b.pivotResidue) (h₄ : a.bin=b.bin) : a=b := by cases a; cases b; simp_all
lemma dyadic_iff (t k : ℕ) (ht : 0<t) : t.log2=k ↔ (2:ℝ)^k≤(t:ℝ) ∧ (t:ℝ)<2*(2:ℝ)^k := by rw [Nat.log2_eq_iff (by omega)] constructor <;> intro h · constructor · exact_mod_cast h.1 · have hh : (t:ℝ)<(2:ℝ)^(k+1) := by exact_mod_cast h.2 simpa [pow_succ,mul_comm] using hh · constructor · exact_mod_cast h.1 · have hh : (t:ℝ)<(2:ℝ)^(k+1) := by simpa [pow_succ,mul_comm] using h.2 exact_mod_cast hh
lemma residue_iff (t L r : ℤ) (hr : 0≤r ∧ r<L) : t%L=r ↔ L∣t-r := by rw [Int.dvd_iff_emod_eq_zero, ←Int.emod_eq_emod_iff_emod_sub_eq_zero, Int.emod_eq_of_lt hr.1 hr.2]
lemma floor_bin_iff (x Δ : ℝ) (k : ℤ) (hΔ : 0<Δ) : ⌊x/Δ⌋=k ↔ (k:ℝ)*Δ≤x ∧ x<(k:ℝ)*Δ+Δ := by rw [Int.floor_eq_iff,le_div_iff₀ hΔ,div_lt_iff₀ hΔ] ring_nf
lemma Label.width_pos {m : ℕ} (b : Label m) (R : ℝ) (hR : 0<R) : 0<b.width R := by unfold Label.width Label.scales exact mul_pos (Finset.prod_pos (fun _ _=>pow_pos (by norm_num) _)) hR
lemma expose_eq_iff {m : ℕ} (L M : ℤ) (R : ℝ) (hR : 0<R) (z : (Fin m→ℕ)×ℕ) (ht : ∀ j,0<z.1 j) (b : Label m) (hr : ∀ j,0≤b.residue j ∧ b.residue j<L) (ha : 0≤b.pivotResidue ∧ b.pivotResidue<M) : expose L M R z=b ↔ (∀ j,b.scales j≤(z.1 j:ℝ) ∧ (z.1 j:ℝ)<2*b.scales j) ∧ (∀ j,L∣(z.1 j:ℤ)-b.residue j) ∧ M∣(z.2:ℤ)-b.pivotResidue ∧ b.left R≤(∏ j,(z.1 j:ℝ))*(z.2:ℝ) ∧ (∏ j,(z.1 j:ℝ))*(z.2:ℝ)<b.left R+b.width R := by have hw (hd : (fun j=>(z.1 j).log2)=b.dyadic) : ((∏ j,(2:ℝ)^(z.1 j).log2)*R)=b.width R := by unfold Label.width Label.scales congr 1 apply Finset.prod_congr rfl intro j hj rw [congrFun hd j] constructor · intro heq have hd : (fun j=>(z.1 j).log2)=b.dyadic := congrArg Label.dyadic heq have hre : (fun j=>(z.1 j:ℤ)%L)=b.residue := congrArg Label.residue heq have hap : (z.2:ℤ)%M=b.pivotResidue := congrArg Label.pivotResidue heq have hb : ⌊(∏ j,(z.1 j:ℝ))*(z.2:ℝ)/((∏ j,(2:ℝ)^(z.1 j).log2)*R)⌋=b.bin := congrArg Label.bin heq rw [hw hd] at hb exact ⟨fun j=>(dyadic_iff _ _ (ht j)).mp (congrFun hd j), fun j=>(residue_iff _ _ _ (hr j)).mp (congrFun hre j), (residue_iff _ _ _ ha).mp hap, (floor_bin_iff _ _ _ (b.width_pos R hR)).mp hb⟩ · rintro ⟨hd,hrd,had,hb⟩ have hde : (fun j=>(z.1 j).log2)=b.dyadic := funext (fun j=>(dyadic_iff _ _ (ht j)).mpr (hd j)) apply Label.ext hde · exact funext (fun j=>(residue_iff _ _ _ (hr j)).mpr (hrd j)) · exact (residue_iff _ _ _ ha).mpr had · change ⌊(∏ j,(z.1 j:ℝ))*(z.2:ℝ)/((∏ j,(2:ℝ)^(z.1 j).log2)*R)⌋=b.bin rw [hw hde] exact (floor_bin_iff _ _ _ (b.width_pos R hR)).mpr hb
theorem fiber_eq {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hX : ∀ j,0<X j) (L M : ℤ) (R : ℝ) (_ : 0<L) (_ : 0<M) (hR : 0<R) (b : Label m) (hr : ∀ j,0≤b.residue j ∧ b.residue j<L) (ha : 0≤b.pivotResidue ∧ b.pivotResidue<M) : (rawDomain X Xp W).filter (fun z=>expose L M R z=b) = jointFiber Set.univ X Xp W b.scales b.residue L (b.left R) (b.width R) b.pivotResidue M := by classical apply Finset.ext rintro ⟨t,p⟩ simp only [rawDomain,Finset.product_eq_sprod,Finset.mem_filter,Finset.mem_product,Fintype.mem_piFinset, RawHarmonicProbability.units,Finset.mem_filter,jointFiber,rawTailFiber,Finset.product_eq_sprod, Set.mem_univ,true_and] constructor · rintro ⟨⟨ht,hp⟩,he⟩ have htpos : ∀ j,0<t j := fun j=>(hX j).trans_le (Finset.mem_Ico.mp (ht j).1).1 obtain ⟨hd,hrd,ha,hb⟩ := (expose_eq_iff L M R hR (t,p) htpos b hr ha).mp he exact ⟨⟨fun j=>⟨(ht j).1,(ht j).2,(hd j).1,(hd j).2,hrd j⟩,hp⟩,ha,hb⟩ · rintro ⟨⟨ht,hp⟩,had,hb⟩ have htpos : ∀ j,0<t j := fun j=>(hX j).trans_le (Finset.mem_Ico.mp (ht j).1).1 refine ⟨⟨fun j=>⟨(ht j).1,(ht j).2.1⟩,hp⟩,?_⟩ exact (expose_eq_iff L M R hR (t,p) htpos b hr ha).mpr ⟨fun j=>⟨(ht j).2.2.1,(ht j).2.2.2.1⟩,fun j=>(ht j).2.2.2.2,had,hb⟩
end ProductExposureLabelsendend
sectionnoncomputable sectionnamespace ProductExposureCutoffopen DyadicHarmonicBoundary RawHarmonicProbability Finset Filter MeasureTheoryopen scoped Topology BigOperators
def cutoff (X C : ℕ) : Set ℕ := {p | p ≤ 2^C*X ∨ X^2 ≤ 2^C*p}
lemma mass_mono_interval {A B C D W : ℕ} (hCA : C≤A) (hBD : B≤D) : mass A B W≤ mass C D W := sum_le_sum_of_subset_of_nonneg (Ico_subset_Ico hCA hBD) (by intros; positivity)
lemma many_dyadic_lower (X W K : ℕ) (hW : 0<W) (hX : 4*W≤X) : (K:ℝ)*((W.totient:ℝ)/(4*W))≤ mass X (X*2^K) W := by rw [mass,←dyadic_sum] calc _ = ∑ _k∈range K, (W.totient:ℝ)/(4*W) := by simp _ ≤ _ := by apply sum_le_sum intro k hk have hpow := Nat.one_le_pow k 2 (by omega) have hxk : 4*W≤X*2^k := by nlinarith have h := dyadic_lower (X*2^k) W hW hxk have hend : X*2^(k+1)=X*2^k+X*2^k := by rw [pow_succ]; ring simpa only [hend,mass] using h
lemma dyadic_upper_simple (Y W : ℕ) (hW : 0<W) (hY : 4*W≤Y) : mass Y (Y+Y) W≤ (3/2:ℝ)*((W.totient:ℝ)/W) := by have hw : (0:ℝ)<W := by exact_mod_cast hW have hy : (0:ℝ)<Y := by exact_mod_cast (show 0<Y by omega) have hY' : (4:ℝ)*W≤Y := by exact_mod_cast hY have hu := dyadic_upper Y W hW (by omega) have hd : 2*(W.totient:ℝ)/Y≤2*(W.totient:ℝ)/(4*W) := div_le_div_of_nonneg_left (by positivity) (by positivity) hY' calc _ ≤ (W.totient:ℝ)/W+2*W.totient/Y := hu _ ≤ (W.totient:ℝ)/W+2*W.totient/(4*W) := add_le_add_right hd _ _ = _ := by ring
lemma many_dyadic_upper (X W K : ℕ) (hW : 0<W) (hX : 4*W≤X) : mass X (X*2^K) W≤(K:ℝ)*(3/2)*((W.totient:ℝ)/W) := by rw [mass,←dyadic_sum] calc _ ≤ ∑ _k∈range K, (3/2:ℝ)*((W.totient:ℝ)/W) := by apply sum_le_sum intro k hk have hpow := Nat.one_le_pow k 2 (by omega) have hxk : 4*W≤X*2^k := by nlinarith have h := dyadic_upper_simple (X*2^k) W hW hxk have hend : X*2^(k+1)=X*2^k+X*2^k := by rw [pow_succ]; ring simpa only [hend,mass] using h _ = _ := by simp; ring
lemma cutoff_mass_bound (X W C : ℕ) (hW : 0<W) (hX : 4*W≤X) (hCX : 2^C≤X) : MicrocellConditional.eventMass (units X W) (cutoff X C) ≤ 3*((C:ℝ)+1)*((W.totient:ℝ)/W) := by classical let A := X^2/2^C have hpow0 : 0<2^C := by positivity have hx : 0<X := by omega have hAx : X≤A := by dsimp [A] apply (Nat.le_div_iff_mul_le hpow0).mpr nlinarith have hA : 0<A := hx.trans_le hAx have hupper : X^2<A*2^(C+1) := by have hh := Nat.lt_div_mul_add (a:=X^2) hpow0 change X^2<A*2^C+2^C at hh rw [pow_succ 2 C] nlinarith have hlower : 2^C*X<X*2^(C+1) := by rw [pow_succ 2 C]; nlinarith let E := (units X W).filter (·∈cutoff X C) have hE : MicrocellConditional.eventMass (units X W) (cutoff X C)= ∑ p∈E,(p:ℝ)⁻¹ := by simp [MicrocellConditional.eventMass,E,sum_filter] have hs₁ : E.filter (fun p=>p≤2^C*X) ⊆ (Ico X (X*2^(C+1))).filter W.Coprime := by intro p hp have hp₁ := mem_filter.mp hp have hp₂ := mem_filter.mp hp₁.1 have hp₃ := mem_filter.mp hp₂.1 have hlo := hp₁.2 have hc := hp₂.2 have hwp := hp₃.2 obtain ⟨hxp,hpx⟩ := mem_Ico.mp hp₃.1 exact mem_filter.mpr ⟨mem_Ico.mpr ⟨hxp,hlo.trans_lt hlower⟩,hwp⟩ have hs₂ : E.filter (fun p=>¬p≤2^C*X) ⊆ (Ico A (A*2^(C+1))).filter W.Coprime := by intro p hp have hp₁ := mem_filter.mp hp have hp₂ := mem_filter.mp hp₁.1 have hp₃ := mem_filter.mp hp₂.1 have hlo := hp₁.2 have hc := hp₂.2 have hwp := hp₃.2 obtain ⟨hxp,hpx⟩ := mem_Ico.mp hp₃.1 have hc' : X^2≤2^C*p := (show p≤2^C*X ∨ X^2≤2^C*p from hc).resolve_left hlo have hap : A≤p := by dsimp [A] apply (Nat.div_le_iff_le_mul hpow0).mpr have hh : X^2≤p*2^C := by simpa only [mul_comm] using hc' omega exact mem_filter.mpr ⟨mem_Ico.mpr ⟨hap,hpx.trans hupper⟩,hwp⟩ have hb₁ : (∑ p∈E.filter (fun p=>p≤2^C*X),(p:ℝ)⁻¹) ≤ mass X (X*2^(C+1)) W := by have h := sum_le_sum_of_subset_of_nonneg hs₁ (fun _ _ _=>by positivity : ∀ i∈(Ico X (X*2^(C+1))).filter W.Coprime, i∉E.filter (fun p=>p≤2^C*X) → 0≤(i:ℝ)⁻¹) simpa only [sum_filter,mass] using h have hb₂ : (∑ p∈E.filter (fun p=>¬p≤2^C*X),(p:ℝ)⁻¹) ≤ mass A (A*2^(C+1)) W := by have h := sum_le_sum_of_subset_of_nonneg hs₂ (fun _ _ _=>by positivity : ∀ i∈(Ico A (A*2^(C+1))).filter W.Coprime, i∉E.filter (fun p=>¬p≤2^C*X) → 0≤(i:ℝ)⁻¹) simpa only [sum_filter,mass] using h rw [hE,←sum_filter_add_sum_filter_not E (fun p=>p≤2^C*X)] have h₁ := many_dyadic_upper X W (C+1) hW hX have h₂ := many_dyadic_upper A W (C+1) hW (hX.trans hAx) push_cast at h₁ h₂ linarith
theorem raw_cutoff_bound (X W C K : ℕ) (hW : 0<W) (hX : 4*W≤X) (hK : 0<K) (hKX : 2^K≤X) (hCX : 2^C≤X) : (law X W hW hX : Measure ℕ).real (cutoff X C) ≤ 12*((C:ℝ)+1)/K := by have ht : (0:ℝ)<W.totient := by exact_mod_cast Nat.totient_pos.mpr hW have hw : (0:ℝ)<W := by exact_mod_cast hW have hk : (0:ℝ)<K := by exact_mod_cast hK have hm := mass_pos X W hW hX have hl := (many_dyadic_lower X W K hW hX).trans (mass_mono (show X*2^K≤X^2 by nlinarith)) rw [MicrocellConditional.law_apply_units] apply (div_le_iff₀ hm).mpr have hu := cutoff_mass_bound X W C hW hX hCX have hratio : 0≤12*((C:ℝ)+1)/K := by positivity have hh := mul_le_mul_of_nonneg_left hl hratio have he : (12*((C:ℝ)+1)/K)*((K:ℝ)*((W.totient:ℝ)/(4*W))) = 3*((C:ℝ)+1)*((W.totient:ℝ)/W) := by field_simp; ring rw [he] at hh exact hu.trans hh
theorem raw_cutoff_decay (X W : ℕ→ℕ) (C : ℕ) (hW : ∀ n,0<W n) (hX : ∀ n,4*W n≤X n) (hXt : Tendsto X atTop atTop) : Tendsto (fun n=>(law (X n) (W n) (hW n) (hX n) : Measure ℕ).real (cutoff (X n) C)) atTop (𝓝 0) := by apply tendsto_order.mpr constructor · intro a ha exact Filter.Eventually.of_forall (fun n=>ha.trans_le (measureReal_nonneg)) · intro ε hε obtain ⟨K,hK⟩ := exists_nat_gt (12*((C:ℝ)+1)/ε) have hk : (0:ℝ)<K := lt_trans (by positivity) hK have hkN : 0<K := by exact_mod_cast hk have he : 12*((C:ℝ)+1)/K<ε := by have hh := (div_lt_iff₀ hε).mp hK exact (div_lt_iff₀ hk).mpr (by nlinarith) filter_upwards [hXt.eventually (eventually_ge_atTop (2^K)), hXt.eventually (eventually_ge_atTop (2^C))] with n hkn hcn exact (raw_cutoff_bound (X n) (W n) C K (hW n) (hX n) hkN hkn hcn).trans_lt he
end ProductExposureCutoff
endend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.ProductExposure02import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionnoncomputable sectionendend
sectionnoncomputable sectionnamespace ProductExposureCutoffopen RawHarmonicProbability Finset Filter MeasureTheoryopen scoped Topology BigOperators
def badBin (X : ℕ) (R : ℝ) (m : ℕ) (tlo τ : ℝ) : Set ℕ := {p | ∃ Q : ℝ, Q≤τ*p ∧ τ*p<Q+tlo*R ∧ ∃ τ' : ℝ, tlo≤τ' ∧ τ'≤2^m*tlo ∧ (Q/τ'<X+2*R ∨ (X:ℝ)^2-2*R<(Q+tlo*R)/τ')}
lemma bad_bin_geometry (X R B tlo τ τ' Q p : ℝ) (hX : 4≤X) (hRX : R≤X) (hR : 0≤R) (hB : 1≤B) (htlo : 0<tlo) (ht : tlo≤τ) (ht' : τ≤B*tlo) (hu : tlo≤τ') (hu' : τ'≤B*tlo) (hp : X≤p) (hQ : Q≤τ*p) (hQ' : τ*p<Q+tlo*R) (hbad : Q/τ'<X+2*R ∨ X^2-2*R<(Q+tlo*R)/τ') : p≤4*B*X ∨ X^2≤4*B*p := by have hp0 : 0≤p := by linarith have hu0 : 0<τ' := htlo.trans_le hu have hB0 : 0≤B := by linarith have hX0 : 0≤X := by linarith have hUX : 0≤X+2*R := by positivity have hVX : 0≤X^2-2*R := by nlinarith rcases hbad with hbad | hbad · left have hbad' := (div_lt_iff₀ hu0).mp hbad have hmu := mul_le_mul_of_nonneg_right hu' hUX have hmt := mul_le_mul_of_nonneg_right ht hp0 have hbr := mul_le_mul_of_nonneg_left hRX hB0 have hbx := mul_le_mul_of_nonneg_right hB hX0 have hsmall : p<B*(X+2*R)+R := by apply (mul_lt_mul_iff_left₀ htlo).mp nlinarith nlinarith · right have hbad' := (lt_div_iff₀ hu0).mp hbad have hmu := mul_le_mul_of_nonneg_right hu hVX have hmt := mul_le_mul_of_nonneg_right ht' hp0 have hlarge : X^2-3*R<B*p := by apply (mul_lt_mul_iff_left₀ htlo).mp nlinarith nlinarith
lemma bad_bin_subset_cutoff (X : ℕ) (R : ℝ) (m : ℕ) (tlo τ : ℝ) (hX : 4≤X) (hR : 0≤R) (hRX : R≤X) (htlo : 0<tlo) (ht : tlo≤τ) (ht' : τ≤2^m*tlo) : badBin X R m tlo τ ∩ {p | X≤p} ⊆ cutoff X (m+2) := by rintro p ⟨⟨Q,hQ,hQ',τ',hu,hu',hbad⟩,hp⟩ have hh := bad_bin_geometry (X:ℝ) R (2^m) tlo τ τ' Q p (by exact_mod_cast hX) hRX hR (one_le_pow₀ (by norm_num)) htlo ht ht' hu hu' (by exact_mod_cast hp) hQ hQ' hbad have he : (2:ℝ)^(m+2)=4*2^m := by rw [pow_add]; norm_num; ring change p≤2^(m+2)*X ∨ X^2≤2^(m+2)*p rw [←he] at hh exact_mod_cast hh
lemma raw_bad_bin_le_cutoff (X W : ℕ) (m : ℕ) (hW : 0<W) (hX : 4*W≤X) (R tlo τ : ℝ) (hR : 0≤R) (hRX : R≤X) (htlo : 0<tlo) (ht : tlo≤τ) (ht' : τ≤2^m*tlo) : (law X W hW hX : Measure ℕ).real (badBin X R m tlo τ) ≤ (law X W hW hX : Measure ℕ).real (cutoff X (m+2)) := by classical rw [law_apply,law_apply] apply div_le_div_of_nonneg_right _ (mass_pos X W hW hX).le apply sum_le_sum intro p hp obtain ⟨hxp,hpx⟩ := mem_Ico.mp hp have hs := bad_bin_subset_cutoff X R m tlo τ (by omega) hR hRX htlo ht ht' split_ifs with h₁ h₂ h₂ · rfl · exact False.elim (h₂ ⟨h₁.1,hs ⟨h₁.2,hxp⟩⟩) · positivity · rfl
theorem raw_bad_bin_decay (X W : ℕ→ℕ) (m : ℕ) (hW : ∀ n,0<W n) (hX : ∀ n,4*W n≤X n) (hXt : Tendsto X atTop atTop) : ∀ ε : ℝ,0<ε → ∀ᶠ n in atTop, ∀ (R tlo τ : ℝ), 0≤R → R≤X n → 0<tlo → tlo≤τ → τ≤2^m*tlo → (law (X n) (W n) (hW n) (hX n) : Measure ℕ).real (badBin (X n) R m tlo τ)<ε := by intro ε hε have hh := (raw_cutoff_decay X W (m+2) hW hX hXt).eventually_lt_const hε filter_upwards [hh] with n hn intro R tlo τ hR hRX htlo ht ht' exact (raw_bad_bin_le_cutoff (X n) (W n) m (hW n) (hX n) R tlo τ hR hRX htlo ht ht').trans_lt hn
end ProductExposureCutoffendend
sectionnoncomputable sectionnamespace ProductExposureLabelsopen scoped BigOperators Topologyopen MeasureTheory Filter RawHarmonicProbability ProductExposureLaw ProductExposureCutoffattribute [local instance] Classical.propDecidable
def Good {m : ℕ} (X : Fin m→ℕ) (Xp : ℕ) (R : ℝ) (b : Label m) : Prop := (∀ j,(X j:ℝ)≤b.scales j ∧ 2*b.scales j≤(X j:ℝ)^2) ∧ ∀ τ : ℝ,(∏ j,b.scales j)≤τ →τ≤2^m*(∏ j,b.scales j) → Xp+2*R≤b.left R/τ ∧ (b.left R+b.width R)/τ≤(Xp:ℝ)^2-2*R
lemma tail_marginal {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (j : Fin m) (A : Set ℕ) : (jointLaw X Xp W hW hX hXp).real {z | z.1 j∈A} = (law (X j) W hW (hX j):Measure ℕ).real A := by have hf : MeasurePreserving (fun z : (Fin m→ℕ)×ℕ=>z.1 j) (jointLaw X Xp W hW hX hXp) (law (X j) W hW (hX j):Measure ℕ) := (measurePreserving_eval (fun i=>(law (X i) W hW (hX i):Measure ℕ)) j).comp measurePreserving_fst exact hf.measureReal_preimage MeasurableSet.of_discrete.nullMeasurableSet
lemma pivot_marginal {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (A : Set ℕ) : (jointLaw X Xp W hW hX hXp).real {z | z.2∈A} = (law Xp W hW hXp:Measure ℕ).real A := by exact (measurePreserving_snd (μ:=Measure.pi (fun j=>(law (X j) W hW (hX j):Measure ℕ))) (ν:=(law Xp W hW hXp:Measure ℕ))).measureReal_preimage MeasurableSet.of_discrete.nullMeasurableSet
lemma law_ae_units (X W : ℕ) (hW : 0<W) (hX : 4*W≤X) : ∀ᵐ t ∂(law X W hW hX:Measure ℕ),t∈units X W := by rw [ae_iff,←measureReal_eq_zero_iff] have hh := MicrocellSaturation.law_restrict_units X W hW hX ((units X W:Set ℕ)ᶜ) change (law X W hW hX:Measure ℕ).real ((units X W:Set ℕ)ᶜ)=0 simpa only [Set.compl_inter_self,measureReal_empty] using hh.symm
lemma joint_ae_domain {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) : ∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z∈rawDomain X Xp W := by have ht : ∀ j,∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z.1 j∈units (X j) W := by intro j rw [ae_iff,←measureReal_eq_zero_iff] change (jointLaw X Xp W hW hX hXp).real {z | z.1 j∈(units (X j) W:Set ℕ)ᶜ}=0 rw [tail_marginal] exact (measureReal_eq_zero_iff (by finiteness)).mpr (ae_iff.mp (law_ae_units (X j) W hW (hX j))) have hp : ∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z.2∈units Xp W := by rw [ae_iff,←measureReal_eq_zero_iff] change (jointLaw X Xp W hW hX hXp).real {z | z.2∈(units Xp W:Set ℕ)ᶜ}=0 rw [pivot_marginal] exact (measureReal_eq_zero_iff (by finiteness)).mpr (ae_iff.mp (law_ae_units Xp W hW hXp)) filter_upwards [ae_all_iff.mpr ht,hp] with z hz hp simpa only [rawDomain,Finset.product_eq_sprod,Finset.mem_product,Fintype.mem_piFinset] using And.intro hz (Finset.mem_filter.mp hp).1
lemma joint_restrict_domain {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (A : Set ((Fin m→ℕ)×ℕ)) : (jointLaw X Xp W hW hX hXp).real (A∩(rawDomain X Xp W:Set _)) = (jointLaw X Xp W hW hX hXp).real A := by apply measureReal_congr filter_upwards [joint_ae_domain X Xp W hW hX hXp] with z hz change (z∈A ∧ z∈rawDomain X Xp W) = (z∈A) exact propext ⟨And.left,fun ha=>⟨ha,hz⟩⟩
lemma expose_bounds {m : ℕ} (L M : ℤ) (R : ℝ) (hR : 0<R) (z : (Fin m→ℕ)×ℕ) (ht : ∀ j,0<z.1 j) : (∀ j,(expose L M R z).scales j≤(z.1 j:ℝ) ∧ (z.1 j:ℝ)<2*(expose L M R z).scales j) ∧ (expose L M R z).left R≤(∏ j,(z.1 j:ℝ))*(z.2:ℝ) ∧ (∏ j,(z.1 j:ℝ))*(z.2:ℝ)<(expose L M R z).left R+(expose L M R z).width R := by refine ⟨fun j=>(dyadic_iff _ _ (ht j)).mp rfl,?_⟩ exact (floor_bin_iff _ _ _ ((expose L M R z).width_pos R hR)).mp rfl
lemma product_dyadic_bounds {m : ℕ} (b : Label m) (t : Fin m→ℕ) (ht : ∀ j,b.scales j≤(t j:ℝ) ∧ (t j:ℝ)<2*b.scales j) : (∏ j,b.scales j)≤(∏ j,(t j:ℝ)) ∧ (∏ j,(t j:ℝ))≤2^m*(∏ j,b.scales j) := by constructor · exact Finset.prod_le_prod₀ (fun j _=>by unfold Label.scales; positivity) (fun j _=>(ht j).1) · calc _ ≤ ∏ j,2*b.scales j := Finset.prod_le_prod₀ (fun _ _=>by positivity) (fun j _=>(ht j).2.le) _ = _ := by rw [Finset.prod_mul_distrib]; simp
lemma good_of_not_cutoff {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hX : ∀ j,0<X j) (hXp : 4≤Xp) (L M : ℤ) (R : ℝ) (hR : 0<R) (hRX : R≤Xp) (z : (Fin m→ℕ)×ℕ) (hz : z∈rawDomain X Xp W) (htc : ∀ j,z.1 j∉cutoff (X j) 1) (hpc : z.2∉cutoff Xp (m+2)) : Good X Xp R (expose L M R z) := by obtain ⟨hzT,hzP⟩ : (∀ j,z.1 j∈units (X j) W) ∧ z.2∈Finset.Ico Xp (Xp^2) := by simpa [rawDomain,Finset.product_eq_sprod] using hz have htpos : ∀ j,0<z.1 j := fun j=>(hX j).trans_le (Finset.mem_Ico.mp (Finset.mem_filter.mp (hzT j)).1).1 obtain ⟨hdy,hq,hq'⟩ := expose_bounds L M R hR z htpos obtain ⟨hprod,hprod'⟩ := product_dyadic_bounds (expose L M R z) z.1 hdy have hspos : 0<∏ j,(expose L M R z).scales j := Finset.prod_pos (fun j _=>pow_pos (by norm_num) _) constructor · intro j have hcut : ¬(z.1 j≤2*X j ∨(X j)^2≤2*z.1 j) := by simpa [cutoff] using htc j push Not at hcut have hl : (2:ℝ)*X j<(z.1 j:ℝ) := by exact_mod_cast hcut.1 have hu : (2:ℝ)*(z.1 j:ℝ)<(X j:ℝ)^2 := by exact_mod_cast hcut.2 constructor <;> nlinarith [(hdy j).1,(hdy j).2] · intro τ hτ hτ' by_contra hn have hbad : (expose L M R z).left R/τ<Xp+2*R ∨ (Xp:ℝ)^2-2*R<((expose L M R z).left R+(expose L M R z).width R)/τ := by rcases not_and_or.mp hn with hn | hn · exact Or.inl (lt_of_not_ge hn) · exact Or.inr (lt_of_not_ge hn) have hh := bad_bin_geometry (Xp:ℝ) R (2^m) (∏ j,(expose L M R z).scales j) (∏ j,(z.1 j:ℝ)) τ ((expose L M R z).left R) z.2 (by exact_mod_cast hXp) hRX hR.le (one_le_pow₀ (by norm_num)) hspos hprod hprod' hτ hτ' (by exact_mod_cast (Finset.mem_Ico.mp hzP).1) hq hq' hbad have he : (2:ℝ)^(m+2)=4*2^m := by rw [pow_add]; norm_num; ring apply hpc change z.2≤2^(m+2)*Xp ∨ Xp^2≤2^(m+2)*z.2 rw [←he] at hh exact_mod_cast hh
lemma bad_good_bound {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (L M : ℤ) (R : ℝ) (hR : 0<R) (hRX : R≤Xp) : (jointLaw X Xp W hW hX hXp).real {z | ¬Good X Xp R (expose L M R z)} ≤ (∑ j,(law (X j) W hW (hX j):Measure ℕ).real (cutoff (X j) 1)) + (law Xp W hW hXp:Measure ℕ).real (cutoff Xp (m+2)) := by rw [←joint_restrict_domain] have hsub : {z | ¬Good X Xp R (expose L M R z)}∩(rawDomain X Xp W:Set _) ⊆ (⋃ j,{z | z.1 j∈cutoff (X j) 1})∪{z | z.2∈cutoff Xp (m+2)} := by intro z hz by_contra hn have hp : z.2∉cutoff Xp (m+2) := fun h=>hn (Or.inr h) have ht : ∀ j,z.1 j∉cutoff (X j) 1 := fun j h=>hn (Or.inl (Set.mem_iUnion.mpr ⟨j,h⟩)) exact hz.1 (good_of_not_cutoff X Xp W (fun j=>by have:=hX j; omega) (by omega) L M R hR hRX z hz.2 ht hp) calc _ ≤ _ := measureReal_mono hsub _ ≤ _ := measureReal_union_le _ _ _ ≤ (∑ j,(jointLaw X Xp W hW hX hXp).real {z | z.1 j∈cutoff (X j) 1})+ (jointLaw X Xp W hW hX hXp).real {z | z.2∈cutoff Xp (m+2)} := add_le_add (measureReal_iUnion_fintype_le _) le_rfl _ = _ := by simp only [tail_marginal,pivot_marginal]
theorem raw_good_decay {m : ℕ} (X : ℕ→Fin m→ℕ) (Xp W : ℕ→ℕ) (L M : ℕ→ℤ) (R : ℕ→ℝ) (hW : ∀ n,0<W n) (hX : ∀ n j,4*W n≤X n j) (hXp : ∀ n,4*W n≤Xp n) (hXt : ∀ j,Tendsto (fun n=>X n j) atTop atTop) (hXpt : Tendsto Xp atTop atTop) (hR : ∀ n,0<R n) (hRX : ∀ n,R n≤Xp n) : Tendsto (fun n=>(jointLaw (X n) (Xp n) (W n) (hW n) (hX n) (hXp n)).real {z | ¬Good (X n) (Xp n) (R n) (expose (L n) (M n) (R n) z)}) atTop (𝓝 0) := by apply squeeze_zero (fun _=>measureReal_nonneg) (fun n=> bad_good_bound (X n) (Xp n) (W n) (hW n) (hX n) (hXp n) (L n) (M n) (R n) (hR n) (hRX n)) have htail := tendsto_finsetSum Finset.univ (fun j _=> raw_cutoff_decay (fun n=>X n j) W 1 hW (fun n=>hX n j) (hXt j)) have hp := raw_cutoff_decay Xp W (m+2) hW hXp hXpt simpa using htail.add hp
end ProductExposureLabels
endend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.ResidueAlignment01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
open scoped BigOperatorsnoncomputable sectionend
noncomputable sectionnamespace ProductExposureLawopen MeasureTheory ProductExposureLabels RawHarmonicProbabilityopen scoped BigOperators ENNRealattribute [local instance] Classical.propDecidable
def outsideDomain {h : ℕ} (X : Fin h→ℕ) (W : ℕ) : Finset (Fin h→ℕ) := Fintype.piFinset (fun j=>units (X j) W)
def outsideLaw {h : ℕ} (X : Fin h→ℕ) (W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) : Measure (Fin h→ℕ) := Measure.pi (fun j=>(law (X j) W hW (hX j):Measure ℕ))
instance outsideLaw_probability {h : ℕ} (X : Fin h→ℕ) (W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) : IsProbabilityMeasure (outsideLaw X W hW hX) := by unfold outsideLaw infer_instance
def reassemble {m h n : ℕ} (e : Fin (m+h)≃Fin n) (y : Fin h→ℕ) (z : (Fin m→ℕ)×ℕ) : (Fin n→ℕ)×ℕ := (fun j=>Fin.append z.1 y (e.symm j),z.2)lemma outside_ae_domain {h : ℕ} (X : Fin h→ℕ) (W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) : ∀ᵐ y ∂outsideLaw X W hW hX,y∈outsideDomain X W := by have hh (j : Fin h) : ∀ᵐ y ∂outsideLaw X W hW hX,y j∈units (X j) W := (measurePreserving_eval (fun j=>(law (X j) W hW (hX j):Measure ℕ)) j).quasiMeasurePreserving.ae (law_ae_units (X j) W hW (hX j)) filter_upwards [ae_all_iff.mpr hh] with y hy exact Fintype.mem_piFinset.mpr hy
lemma outside_weights_sum {h : ℕ} (X : Fin h→ℕ) (W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) : ∑ y∈outsideDomain X W,(outsideLaw X W hW hX).real {y}=1 := by rw [sum_measureReal_singleton] have hh : (outsideLaw X W hW hX).real (outsideDomain X W:Set _) = (outsideLaw X W hW hX).real Set.univ := by apply measureReal_congr filter_upwards [outside_ae_domain X W hW hX] with y hy change (y∈outsideDomain X W)=(y∈(Set.univ : Set (Fin h→ℕ))) exact propext ⟨fun _=>Set.mem_univ _,fun _=>hy⟩ simpa using hh
lemma joint_reassemble {m h n : ℕ} (e : Fin (m+h)≃Fin n) (X : Fin n→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) : Measure.map (fun yz=>reassemble e yz.1 yz.2) ((outsideLaw (fun j : Fin h=>X (e (j.natAdd m))) W hW (fun _=>hX _)).prod (jointLaw (fun j : Fin m=>X (e (j.castAdd h))) Xp W hW (fun _=>hX _) hXp)) = jointLaw X Xp W hW hX hXp := by apply Measure.ext_of_singleton intro z rw [Measure.map_apply (measurable_of_countable _) (measurableSet_singleton _)] have he : (fun yz=>reassemble e yz.1 yz.2) ⁻¹' {z} = {fun j : Fin h=>z.1 (e (j.natAdd m))} ×ˢ {(fun j : Fin m=>z.1 (e (j.castAdd h)),z.2)} := by ext yz constructor · intro hy change reassemble e yz.1 yz.2=z at hy have h1 := congrArg Prod.fst hy have h2 := congrArg Prod.snd hy refine ⟨?_,?_⟩ · apply funext intro j have hh := congrFun h1 (e (j.natAdd m)) simpa [reassemble] using hh · apply Prod.ext · apply funext intro j have hh := congrFun h1 (e (j.castAdd h)) simpa [reassemble] using hh · exact h2 · rintro ⟨hy,hz⟩ change yz.1=(fun j : Fin h=>z.1 (e (j.natAdd m))) at hy change yz.2=(fun j : Fin m=>z.1 (e (j.castAdd h)),z.2) at hz change reassemble e yz.1 yz.2=z rw [hy,hz] apply Prod.ext · funext j rcases e.surjective j with ⟨i,rfl⟩ refine Fin.addCases ?_ ?_ i · intro a simp [reassemble] · intro a simp [reassemble] · rfl rw [he,Measure.prod_prod] change _ = (jointLaw X Xp W hW hX hXp) {(z.1,z.2)} simp only [outsideLaw,jointLaw,←Set.singleton_prod_singleton,Measure.prod_prod,Measure.pi_singleton] rw [mul_left_comm,←mul_assoc] congr 1 calc _ = ∏ i : Fin (m+h),(law (X (e i)) W hW (hX (e i)):Measure ℕ) {z.1 (e i)} := by simpa using (Fin.prod_univ_add (fun i : Fin (m+h)=> (law (X (e i)) W hW (hX (e i)):Measure ℕ) {z.1 (e i)})).symm _ = _ := e.prod_comp (fun j=>(law (X j) W hW (hX j):Measure ℕ) {z.1 j})
theorem joint_outside_disintegration {m h n : ℕ} (e : Fin (m+h)≃Fin n) (X : Fin n→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (E : Set ((Fin n→ℕ)×ℕ)) : let Xi := fun j : Fin m=>X (e (j.castAdd h)) let Xo := fun j : Fin h=>X (e (j.natAdd m)) (jointLaw X Xp W hW hX hXp).real E = ∑ y∈outsideDomain Xo W,(outsideLaw Xo W hW (fun _=>hX _)).real {y} * (jointLaw Xi Xp W hW (fun _=>hX _) hXp).real {z | reassemble e y z∈E} := by classical dsimp only have hm := joint_reassemble e X Xp W hW hX hXp rw [←hm,measureReal_def,Measure.map_apply (measurable_of_countable _) MeasurableSet.of_discrete, Measure.prod_apply MeasurableSet.of_discrete] conv_lhs => rw [←Measure.restrict_eq_self_of_ae_mem (outside_ae_domain (fun j : Fin h=>X (e (j.natAdd m))) W hW (fun j=>hX _))] rw [lintegral_finset,ENNReal.toReal_sum] · apply Finset.sum_congr rfl intro y hy rw [ENNReal.toReal_mul,mul_comm] rfl · intro y hy exact ENNReal.mul_ne_top (by finiteness) (by finiteness)
end ProductExposureLawend
noncomputable sectionnamespace RoughArrayFaceopen RationalLattice MalcevCharacters RoughFaceShift RoughTopologicalFace RoughArrayCoordinates SourceResidueAlignmentopen RoughScales RoughSamplingWeights FinitePieceAverages RoughSourceExceptional RoughProductRemovalopen ProductExposureLabels ProductExposureLaw ProductExposureCutoff MeasureTheory Filteropen scoped BigOperators Topologyattribute [local instance] Classical.propDecidablevariable {ι : Type} [Fintype ι] (G : ι→Type) [∀ i,Group (G i)]variable [∀ i,TopologicalSpace (G i)] [∀ i,IsTopologicalGroup (G i)]variable (n : ι→ℕ) (q : ℕ) (c : ∀ i,RealCoordinates (G i) (n i))variable (hsk : ∀ i,SecondKind (c i)) (A : ∀ i,CubeFaces.Filtration (G i))variable (w : ∀ i,Fin (n i)→ℕ)variable (hA : ∀ i k (g : G i),g∈(A i).level k ↔ ∀ j,w i j<k → (c i).coord g j=0)variable (hw : ∀ i j,0<w i j) (Γ : ∀ i,Subgroup (G i))
theorem source_full_earlier_face_decay (hΓ : ∀ i g,g∈Γ i ↔ ∀ j,∃ z : ℤ,(c i).coord g j=z) [MetricSpace ((Carrier G n q c hsk A w hA)⧸lattice G n q c hsk A w hA Γ)] (htop : (inferInstance : MetricSpace ((Carrier G n q c hsk A w hA)⧸lattice G n q c hsk A w hA Γ)).toUniformSpace.toTopologicalSpace = QuotientGroup.instTopologicalSpace (lattice G n q c hsk A w hA Γ)) (m h a v d : ℕ) (perm : Fin (m+h)≃Fin a) (hd : 0<d) (c₀ C₀ : ℝ) (B : NNReal) (η : ℝ) (hc₀ : 0<c₀) (hC₀ : 0<C₀) (hB : 0<B) (hη : 0<η) (w0 M Xp : ℕ→ℕ) (X : ℕ→Fin a→ℕ) (R Q : ℕ→ℝ) (L : ℕ→ℤ) (hw0 : Tendsto w0 atTop atTop) (hX : ∀ N j,4*primorial (w0 N)≤X N j) (hXp : ∀ N,4*primorial (w0 N)≤Xp N) (hXt : ∀ j,Tendsto (fun N=>X N j) atTop atTop) (hXpt : Tendsto Xp atTop atTop) (hR : ∀ N,0<R N) (hRX : Tendsto (fun N=>R N/(Xp N:ℝ)) atTop (𝓝 0)) (hZ : ∀ a : ℝ,0<a →Tendsto (fun N=>(R N/(M N:ℝ))/ (1+∑ j : Fin m,(X N (perm (j.castAdd h)):ℝ)^2)^a) atTop atTop) (hQ0 : ∀ N,0≤Q N) (hSize : Tendsto (fun N=>(Q N+(∏ l : Fin m,(X N (perm (l.castAdd h)):ℝ)^2)*(L N:ℝ))/R N) atTop (𝓝 0)) (hWM : ∀ N,(primorial (w0 N):ℤ)∣(M N:ℤ)) (hM : ∀ N,0<M N) (hMs : ∀ N,Smooth (w0 N) (M N:ℤ)) (hL : ∀ N,0<L N) (hsm : ∀ N,Smooth (w0 N) (L N)) (hWL : ∀ N,(primorial (w0 N):ℤ)∣L N) (hML : ∀ N,(M N:ℤ)∣L N) (hLexact : ∀ N,L N=(M N:ℤ)*(primorial (w0 N):ℤ)^(w0 N)) (hXL : ∀ j : Fin m,Tendsto (fun N=>(X N (perm (j.castAdd h)):ℝ)/(L N:ℝ)) atTop atTop) (pattern : ι→Fin (v+1)→ℤ) (e : Fin q) (j : Fin (v+1)) (g x : ℕ→(Fin h→ℕ)→Label m→∀ i,G i) (b0 b1 : ℕ→(Fin h→ℕ)→Label m→ι→ℝ) (qval : ℕ→(Fin h→ℕ)→Label m→Fin q→ℤ) (hQ : ∀ N y,y∈outsideDomain (fun l : Fin h=>X N (perm (l.natAdd m))) (primorial (w0 N)) → ∀ b,b∈(fullDomain (fun l : Fin m=>X N (perm (l.castAdd h))) (Xp N) (primorial (w0 N))).image (expose (L N) (M N:ℤ) (R N)) →∀ k,|(qval N y b k:ℝ)|≤Q N) : Tendsto (fun N=>(jointLaw (X N) (Xp N) (primorial (w0 N)) (primorial_pos _) (hX N) (hXp N)).real {z | let y := fun l : Fin h=>z.1 (perm (l.natAdd m)) (fun l : Fin m=>z.1 (perm (l.castAdd h)),z.2)∈ rawPhysicalEvent (lattice G n q c hsk A w hA Γ) m v c₀ C₀ B η (R N) d (M N) (L N) (fun b=>actualData G n q c hsk A w hA hw Γ pattern (g N y b) (x N y b) (b0 N y b) (b1 N y b) (fun k=>(qval N y b k:ℝ)/(M N:ℝ)) (fun k=>-(residueData (L N) (qval N y b k) b:ℝ)/(M N:ℝ)) e j (coarseOrigin v (M N) (R N) b) (shift (M N) (L N) (qval N y b e) b))}) atTop (𝓝 0) := by classical let Xo (N : ℕ) (l : Fin h) := X N (perm (l.natAdd m)) let Xi (N : ℕ) (l : Fin m) := X N (perm (l.castAdd h)) let κ (N : ℕ) := ↥(outsideDomain (Xo N) (primorial (w0 N))) let p (N : ℕ) (y : κ N) := (outsideLaw (Xo N) (primorial (w0 N)) (primorial_pos _) (fun l=>hX N _)).real {y.val} have hsum (N : ℕ) (f : (Fin h→ℕ)→ℝ) : ∑ y : κ N,f y.val = ∑ y∈outsideDomain (Xo N) (primorial (w0 N)),f y := by exact (Finset.sum_subtype _ (fun _=>Iff.rfl) f).symm have hp (N : ℕ) (y : κ N) : 0≤p N y := measureReal_nonneg have hmass (N : ℕ) : ∑ y,p N y=1 := by dsimp only [p] exact (hsum N (fun y=>(outsideLaw (Xo N) (primorial (w0 N)) (primorial_pos _) (fun l=>hX N _)).real {y})).trans (outside_weights_sum (Xo N) (primorial (w0 N)) (primorial_pos _) (fun l=>hX N _)) have hh := source_outside_conditioning_face_decay G n q c hsk A w hA hw Γ hΓ htop m v d hd c₀ C₀ B η hc₀ hC₀ hB hη w0 M Xp Xi R Q L hw0 (fun N l=>hX N _) hXp (fun l=>hXt _) hXpt hR hRX hZ hQ0 hSize hWM hM hMs hL hsm hWL hML hLexact hXL pattern e j κ p hp hmass (fun N y=>g N y.val) (fun N y=>x N y.val) (fun N y=>b0 N y.val) (fun N y=>b1 N y.val) (fun N y=>qval N y.val) (fun N y=>hQ N y.val y.property) apply hh.congr' (Eventually.of_forall (fun N=>?_)) rw [joint_outside_disintegration perm] dsimp only [p] rw [hsum N (fun y=>(outsideLaw (Xo N) (primorial (w0 N)) (primorial_pos _) (fun l=>hX N _)).real {y} * (jointLaw (Xi N) (Xp N) (primorial (w0 N)) (primorial_pos _) (fun l=>hX N _) (hXp N)).real (rawPhysicalEvent (lattice G n q c hsk A w hA Γ) m v c₀ C₀ B η (R N) d (M N) (L N) (fun b=>actualData G n q c hsk A w hA hw Γ pattern (g N y b) (x N y b) (b0 N y b) (b1 N y b) (fun k=>(qval N y b k:ℝ)/(M N:ℝ)) (fun k=>-(residueData (L N) (qval N y b k) b:ℝ)/(M N:ℝ)) e j (coarseOrigin v (M N) (R N) b) (shift (M N) (L N) (qval N y b e) b))))] apply Finset.sum_congr rfl intro y hy congr 2 ext z simp only [Set.mem_ofPred_eq,reassemble,Equiv.symm_apply_apply,Fin.append_left,Fin.append_right]
end RoughArrayFaceend
noncomputable sectionopen MeasureTheory Filter Topologyopen scoped ENNReal BigOperatorsnamespace ConditionalDiagonalvariable (Ω : ℕ → Type) [∀ N,MeasurableSpace (Ω N)]variable (μ : ∀ N,Measure (Ω N)) (A : ∀ N,Set (Ω N))variable (E : ∀ N,ℕ → Ω N → ℝ) (ε : ℝ≥0∞) (hε : 0<ε)variable (hA : ∀ N,ε≤μ N (A N))variable (hE : ∀ i δ,0<δ → Tendsto (fun N=>μ N {x | δ≤|E N i x|}) atTop (𝓝 0))
include hε hA hE in
theorem select : ∃ φ : ℕ → ℕ,StrictMono φ ∧ ∃ x : ∀ k,Ω (φ k), (∀ k,x k∈A (φ k)) ∧ ∀ i,Tendsto (fun k=>E (φ k) i (x k)) atTop (𝓝 0) := by classical have hev (k : ℕ) : ∀ᶠ N in atTop,∃ x∈A N,∀ i≤k,|E N i x|<1/((k:ℝ)+1) := by let δ : ℝ:=1/((k:ℝ)+1) have hδ : 0<δ := by dsimp [δ]; positivity have ht : Tendsto (fun N=>∑ i∈Finset.range (k+1),μ N {x | δ≤|E N i x|}) atTop (𝓝 0) := by simpa only [Finset.sum_const_zero] using (tendsto_finsetSum (Finset.range (k+1)) (fun i _=>hE i δ hδ)) filter_upwards [ht.eventually (gt_mem_nhds hε)] with N hN let Bad : Set (Ω N):=⋃ i∈Finset.range (k+1),{x | δ≤|E N i x|} have hm : μ N Bad<μ N (A N) := (measure_biUnion_finset_le (Finset.range (k+1)) _).trans_lt (hN.trans_le (hA N)) have hn : ¬A N⊆Bad := fun h=>not_lt_of_ge (measure_mono h) hm obtain ⟨x,hx,hxb⟩:=Set.not_subset.mp hn refine ⟨x,hx,?_⟩ intro i hi by_contra! h exact hxb (Set.mem_iUnion.mpr ⟨i,Set.mem_iUnion.mpr ⟨Finset.mem_range.mpr (by omega),h⟩⟩) have hth (k : ℕ) : ∃ T : ℕ,∀ N≥T,∃ x∈A N,∀ i≤k,|E N i x|<1/((k:ℝ)+1) := Filter.eventually_atTop.mp (hev k) choose T hT using hth let φ (k : ℕ):=k+∑ j∈Finset.range (k+1),T j have hφ : StrictMono φ := by apply strictMono_nat_of_lt_succ intro k simp only [φ,Finset.sum_range_succ] omega have hφT (k : ℕ) : T k≤φ k := by have hsum : T k≤∑ j∈Finset.range (k+1),T j := Finset.single_le_sum (fun _ _=>Nat.zero_le _) (Finset.mem_range.mpr (Nat.lt_succ_self k)) exact hsum.trans (Nat.le_add_left _ _) choose x hx hxe using (fun k=>hT k (φ k) (hφT k)) refine ⟨φ,hφ,x,hx,?_⟩ intro i apply Metric.tendsto_atTop.mpr intro δ hδ have ht : ∀ᶠ k : ℕ in atTop,1/((k:ℝ)+1)<δ := (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜:=ℝ)).eventually (gt_mem_nhds hδ) obtain ⟨N,hN⟩:=Filter.eventually_atTop.mp ht refine ⟨max N i,?_⟩ intro k hk simpa only [Real.dist_eq,sub_zero] using (hxe k i ((le_max_right N i).trans hk)).trans (hN k ((le_max_left N i).trans hk))
end ConditionalDiagonal
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.CubePolynomials01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionopen scoped ComplexConjugateendend
sectionnoncomputable sectionopen scoped BigOperatorsnamespace FactorProgressionopen CubeFaces CubePolynomialsvariable {G : Type*} [Group G]
lemma affine_polynomial (H : Filtration G) {k : ℕ} {f : ℤ → G} (hf : f∈polynomials H k) (a b : ℤ) : (fun z => f (a*z+b))∈polynomials H k := by rw [mem_polynomials] at hf ⊢ intro I h n convert hf I (fun i => a*h i) (a*n+b) using 1 ext v change f (a*(n+∑ i∈v∩I,h i)+b)=f (a*n+b+∑ i∈v∩I,a*h i) rw [← Finset.mul_sum] congr 1 ring
lemma conjugate_polynomial (H : Filtration G) (h0 : H.level 0=⊤) {f : ℤ → G} (hf : f∈polynomials H 0) (v : G) : (fun z => v⁻¹*f z*v)∈polynomials H 0 := by have hv : (fun _ : ℤ => v)∈polynomials H 0 := const_mem (by rw [h0]; trivial) exact (polynomials H 0).mul_mem ((polynomials H 0).mul_mem ((polynomials H 0).inv_mem hv) hf) hv
lemma affine_conjugate_polynomial (H : Filtration G) (h0 : H.level 0=⊤) {f : ℤ → G} (hf : f∈polynomials H 0) (a b : ℤ) (v : G) : (fun z => v⁻¹*f (a*z+b)*v)∈polynomials H 0 := conjugate_polynomial H h0 (affine_polynomial H hf a b) v
lemma factor_coset (Γ : Subgroup G) (e f b v : G) (hv : (QuotientGroup.mk b : G⧸Γ)=QuotientGroup.mk v) : (QuotientGroup.mk (e*f*b) : G⧸Γ) = (e*v) • QuotientGroup.mk (v⁻¹*f*v) := by calc _ = (e*f) • (QuotientGroup.mk b : G⧸Γ) := rfl _ = (e*f) • QuotientGroup.mk v := by rw [hv] _ = QuotientGroup.mk ((e*f)*v) := rfl _ = QuotientGroup.mk ((e*v)*(v⁻¹*f*v)) := by congr 1; group _ = _ := rfl
theorem periodic_factor_coset (Γ : Subgroup G) (f e f' b : ℤ → G) (he : ∀ z, f z=e z*f' z*b z) (T : ℤ) (hper : Function.Periodic (fun z => (QuotientGroup.mk (b z) : G⧸Γ)) T) (r : ℤ) (v : G) (hv : (QuotientGroup.mk (b r) : G⧸Γ)=QuotientGroup.mk v) (z : ℤ) : (QuotientGroup.mk (f (T*z+r)) : G⧸Γ) = (e (T*z+r)*v) • QuotientGroup.mk (v⁻¹*f' (T*z+r)*v) := by rw [he] apply factor_coset have hh := (hper.int_mul z) r have hi : T*z+r=r+z*T := by ring rw [hi] have hh' : (QuotientGroup.mk (b (r+z*T)) : G⧸Γ)=QuotientGroup.mk (b r) := by simpa using hh exact hh'.trans hv
end FactorProgressionendend
sectionnoncomputable sectionopen scoped Topologynamespace CompactActionFreezevariable {G V X : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] [NormedAddCommGroup V] [MetricSpace X] [CompactSpace X] [MulAction G X] [ContinuousSMul G X]
omit [IsTopologicalGroup G] intheorem small_displacement [IsTopologicalGroup G] (c : G ≃ₜ V) (hc : c 1=0) (ε : ℝ) (hε : 0<ε) : ∃ u : ℝ, 0<u ∧ ∀ g : G, ‖c g‖ ≤ u → ∀ x : X, dist (g • x) x ≤ ε := by let F : C(V × X,ℝ) := ⟨fun p => dist (c.symm p.1 • p.2) p.2,by fun_prop⟩ let A : C(V,C(X,ℝ)) := F.curry have hA0 : A 0=0 := by ext x have he : c.symm 0=1 := by rw [← hc,c.symm_apply_apply] simp [A,F,ContinuousMap.curry_apply,he] obtain ⟨u,hu,hs⟩ := Metric.continuousAt_iff.mp A.continuous.continuousAt ε hε refine ⟨u/2,by positivity,fun g hg x => ?_⟩ have hd : dist (c g) 0<u := by simpa only [dist_zero_right] using (show ‖c g‖<u by linarith) have hh := hs hd rw [hA0,dist_zero_right] at hh have hx := (A (c g)).norm_coe_le_norm x have hv : (A (c g)) x=dist (g • x) x := by simp [A,F,ContinuousMap.curry_apply] rw [hv,Real.norm_eq_abs,abs_of_nonneg dist_nonneg] at hx exact (hx.trans_lt hh).le
end CompactActionFreezeendend
sectionnoncomputable sectionopen scoped BigOperatorsnamespace ProgressionPartitionlemma sum_blocks {M : Type*} [AddCommMonoid M] (f : ℕ → M) (A B : ℕ) : (∑ i ∈ Finset.range (A*B), f i) = ∑ a ∈ Finset.range A, ∑ b ∈ Finset.range B, f (a*B+b) := by induction A with | zero => simp | succ A ih => rw [Nat.succ_mul,Finset.sum_range_add,ih,Finset.sum_range_succ]
lemma sum_progressions {M : Type*} [AddCommMonoid M] (f : ℕ → M) (J K T : ℕ) : (∑ i ∈ Finset.range (J*K*T), f i) = ∑ a ∈ Finset.range J, ∑ r ∈ Finset.range T, ∑ n ∈ Finset.range K, f ((a*K+n)*T+r) := by rw [sum_blocks f (J*K) T,sum_blocks (fun i => ∑ r ∈ Finset.range T, f (i*T+r)) J K] apply Finset.sum_congr rfl intro a ha exact Finset.sum_comm
lemma residual_bound (f : ℕ → ℂ) (μ : ℂ) (hf : ∀ i, ‖f i‖ ≤ 1) (hμ : ‖μ‖ ≤ 1) (A B : ℕ) : ‖∑ i ∈ Finset.range (A+B), (f i-μ)‖ ≤ ‖∑ i ∈ Finset.range A, (f i-μ)‖+2*B := by rw [Finset.sum_range_add] refine (norm_add_le _ _).trans (add_le_add le_rfl ?_) calc _ ≤ ∑ i ∈ Finset.range B, ‖f (A+i)-μ‖ := norm_sum_le _ _ _ ≤ ∑ _i ∈ Finset.range B, (2:ℝ) := Finset.sum_le_sum (fun i _ => (norm_sub_le _ _).trans (by linarith [hf (A+i)])) _ = _ := by simp; ring
theorem obstruction (f : ℕ → ℂ) (g : ℕ → ℕ → ℕ → ℂ) (μ : ℂ) (J K T N : ℕ) (δ : ℝ) (hδ : 0<δ) (hN : 0<N) (hM : J*K*T ≤ N) (hf : ∀ i, ‖f i‖ ≤ 1) (hμ : ‖μ‖ ≤ 1) (htail : 2*((N-J*K*T:ℕ):ℝ) ≤ δ*N/4) (hfreeze : ∀ a<J, ∀ r<T, ∀ n<K, ‖f ((a*K+n)*T+r)-g a r n‖ ≤ δ/4) (hlarge : δ*N ≤ ‖∑ i ∈ Finset.range N, (f i-μ)‖) : ∃ a<J, ∃ r<T, δ/4*K ≤ ‖∑ n ∈ Finset.range K, (g a r n-μ)‖ := by by_contra hno push Not at hno have hcell (a : ℕ) (ha : a<J) (r : ℕ) (hr : r<T) : ‖∑ n ∈ Finset.range K, (f ((a*K+n)*T+r)-μ)‖ ≤ δ/2*K := by have he : (∑ n ∈ Finset.range K, (f ((a*K+n)*T+r)-μ)) = (∑ n ∈ Finset.range K, (f ((a*K+n)*T+r)-g a r n))+ ∑ n ∈ Finset.range K, (g a r n-μ) := by rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro n hn ring rw [he] calc _ ≤ ‖∑ n ∈ Finset.range K, (f ((a*K+n)*T+r)-g a r n)‖+ ‖∑ n ∈ Finset.range K, (g a r n-μ)‖ := norm_add_le _ _ _ ≤ (∑ n ∈ Finset.range K, δ/4)+δ/4*K := by apply add_le_add · exact (norm_sum_le _ _).trans (Finset.sum_le_sum (fun n hn => hfreeze a ha r hr n (Finset.mem_range.mp hn))) · exact (hno a ha r hr).le _ = _ := by simp; ring have hblock : ‖∑ i ∈ Finset.range (J*K*T), (f i-μ)‖ ≤ δ/2*(J*K*T:ℕ) := by rw [sum_progressions] calc _ ≤ ∑ a ∈ Finset.range J, ‖∑ r ∈ Finset.range T, ∑ n ∈ Finset.range K, (f ((a*K+n)*T+r)-μ)‖ := norm_sum_le _ _ _ ≤ ∑ a ∈ Finset.range J, ∑ r ∈ Finset.range T, δ/2*K := by apply Finset.sum_le_sum intro a ha exact (norm_sum_le _ _).trans (Finset.sum_le_sum (fun r hr => hcell a (Finset.mem_range.mp ha) r (Finset.mem_range.mp hr))) _ = _ := by simp; ring have hres := residual_bound f μ hf hμ (J*K*T) (N-J*K*T) rw [Nat.add_sub_of_le hM] at hres have hm : (J*K*T:ℕ) ≤ (N:ℝ) := by exact_mod_cast hM have hn : (0:ℝ)<N := by exact_mod_cast hN have hmδ := mul_le_mul_of_nonneg_left hm (show 0 ≤ δ/2 by positivity) have hp : 0<δ*(N:ℝ) := mul_pos hδ hn linarith
end ProgressionPartitionendend
sectionnoncomputable sectionnamespace ProgressionPartitionlemma radix_lt {a A b B : ℕ} (ha : a<A) (hb : b<B) : a*B+b<A*B := by calc _ < a*B+B := Nat.add_lt_add_left hb _ _ = (a+1)*B := by ring _ ≤ A*B := Nat.mul_le_mul_right B (by omega)
lemma cell_lt {J K T a n r : ℕ} (ha : a<J) (hn : n<K) (hr : r<T) : (a*K+n)*T+r<J*K*T := radix_lt (radix_lt ha hn) hr
theorem uniform_scales (J Tmax : ℕ) (hJ : 0<J) (hTmax : 0<Tmax) (δ : ℝ) (hδ : 0<δ) : ∃ N₀ : ℕ, 0<N₀ ∧ ∀ N : ℕ, N₀ ≤ N → ∀ T : ℕ, 0<T → T ≤ Tmax → let K := N/(J*T) 0<K ∧ J*K*T ≤ N ∧ N ≤ 2*J*Tmax*K ∧ 2*((N-J*K*T:ℕ):ℝ) ≤ δ*N/4 := by obtain ⟨N₀,hN₀⟩ := exists_nat_gt (max ((J*Tmax:ℕ):ℝ) (8*(J*Tmax:ℕ)/δ)) have h₀ : (J*Tmax:ℕ)<(N₀:ℝ) := lt_of_le_of_lt (le_max_left _ _) hN₀ have h₁ : 8*(J*Tmax:ℕ)/δ<(N₀:ℝ) := lt_of_le_of_lt (le_max_right _ _) hN₀ have hn₀ : 0<N₀ := by exact_mod_cast (lt_of_le_of_lt (by positivity : (0:ℝ) ≤ (J*Tmax:ℕ)) h₀) refine ⟨N₀,hn₀,fun N hN T hT hTT => ?_⟩ dsimp only have hd : 0<J*T := Nat.mul_pos hJ hT have hJN : J*T ≤ N := by have hJNm : J*Tmax<N₀ := by exact_mod_cast h₀ exact (Nat.mul_le_mul_left J hTT).trans (Nat.le_of_lt hJNm |>.trans hN) have hK : 0<N/(J*T) := Nat.div_pos hJN hd have hM : J*(N/(J*T))*T ≤ N := by simpa only [Nat.mul_assoc,Nat.mul_left_comm (N/(J*T)),Nat.mul_comm T] using Nat.div_mul_le_self N (J*T) have hmod := Nat.mod_lt N hd have hid := Nat.mod_add_div N (J*T) have hremainder : N-J*(N/(J*T))*T < J*T := by have he : J*(N/(J*T))*T=(J*T)*(N/(J*T)) := by ring rw [he] omega refine ⟨hK,hM,?_,?_⟩ · have hsmall : J*T ≤ J*T*(N/(J*T)) := Nat.le_mul_of_pos_right _ hK have hstep : N ≤ 2*J*T*(N/(J*T)) := by nlinarith only [hid,hmod,hsmall] exact hstep.trans (Nat.mul_le_mul_right _ (Nat.mul_le_mul_left (2*J) hTT)) · have he : 8*(J*Tmax:ℕ)/δ ≤ (N:ℝ) := h₁.le.trans (by exact_mod_cast hN) have hh : 8*(J*Tmax:ℕ) ≤ (N:ℝ)*δ := (div_le_iff₀ hδ).mp he have hr : ((N-J*(N/(J*T))*T:ℕ):ℝ) ≤ (J*Tmax:ℕ) := by exact_mod_cast (hremainder.le.trans (Nat.mul_le_mul_left J hTT)) linarith
end ProgressionPartitionend
endendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.WordPlan03import OAI.Geometry.NilpotentCharts.Main
namespace OAI
open scoped BigOperatorssectionsection
noncomputable sectionopen MeasureTheory Filter Topologyopen scoped NNReal ENNRealnamespace AllLevelFactorization.Factorizationopen RationalLattice CubeFaces ResidueCoveropen ConstructedWordPlan.GlobalWordPlanopen ConstructedWordPlan.AlignmentScales ConstructedWordPlan.RationalPivotPlanvariable {G : Type} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {k s : ℕ} {c : RealCoordinates G k} {Γ : Subgroup G}variable {K : Filtration G} {P : ℕ → ℤ → G} {L : ℕ → ℝ}variable (E : Factorization c Γ s K P L)variable (C : (r : Fin E.period) → E.ResidueCover r)variable [∀ r,MeasurableSpace ((C r).CubeSpace (ι:=Empty))]variable [∀ r,BorelSpace ((C r).CubeSpace (ι:=Empty))]variable [MeasurableSpace (G⧸Γ)] [BorelSpace (G⧸Γ)]variable [CompactSpace (G⧸Γ)] [SecondCountableTopology (G⧸Γ)]variable [HasOuterApproxClosed (G⧸Γ)] [MeasurableSingletonClass (G⧸Γ)]variable {n r : ℕ} (hs : 1 ≤ s) (D : Pivot n)variable (F B : Finset (Scale n))variable (q₀ : ℕ) (hq₀ : pivotModulus s r hs D F B∣q₀)variable (b : Scale n) (hb : b∈B) {τ : ℝ} (hτ : 0<τ)variable (Y : Fin D.targets → Type) [∀ j,TopologicalSpace (Y j)]variable [∀ j,MulAction (Shifts D) (Y j)]variable (π : (j : Fin D.targets) → (G⧸Γ) → Y j)variable (Read : (j : Fin D.targets) → ℚ → Y j × Slots D → Fin r → ℝ)variable (hπ : ∀ j,Continuous (π j))variable (hRead : ∀ j a t,Continuous (fun y=>Read j a y t))variable (hS : ∀ j (a : Shifts D),Continuous (fun y : Y j=>a • y))variable (M : ∀ a : Fin E.period,∀ β : ℝ, PhysicalMarginalFaceData D (C a).pivotChart.chart (C a).pointFiltration (C a).pointLattice π ((C a).pivotImage β) s)
include hπ hRead hS M hq₀ hb hτ in
theorem physical_pivot_empirical_success_mass (hL : ∀ N,0<L N) (ht : Tendsto L atTop atTop) (ReadN : ℕ → (j : Fin D.targets) → ℚ → Y j × Slots D → Fin r → ℝ) (he : ∀ᶠ N in atTop,∀ p∈pivotOptions s r hs D F,∀ i x, |centerReading D Y π (ReadN N) F q₀ b p i x-centerReading D Y π Read F q₀ b p i x| ≤ τ/4 ∧ |translatedReading D Y π (ReadN N) F q₀ b p i x-translatedReading D Y π Read F q₀ b p i x| ≤ τ/4) : ∀ᶠ N in atTop,(((((pivotOptions s r hs D F).card : ℝ≥0)⁻¹/2) : ℝ≥0) : ℝ≥0∞) < (E.empiricalPointLaw N : Measure (G⧸Γ)) (⋃ p∈pivotOptions s r hs D F,AlignmentMass.Success τ (centerReading D Y π (ReadN N) F q₀ b p) (translatedReading D Y π (ReadN N) F q₀ b p)) := by classical let O:=↥(pivotOptions s r hs D F) let : Nonempty O:=⟨⟨(pivotOptions_nonempty s r hs D F).choose, (pivotOptions_nonempty s r hs D F).choose_spec⟩⟩ let A (p : O):=centerReading D Y π Read F q₀ b p.val let T (p : O):=translatedReading D Y π Read F q₀ b p.val let AN (N : ℕ) (p : O):=centerReading D Y π (ReadN N) F q₀ b p.val let TN (N : ℕ) (p : O):=translatedReading D Y π (ReadN N) F q₀ b p.val have hq : 0<((pivotOptions s r hs D F).card : ℝ≥0) := by exact_mod_cast Finset.card_pos.mpr (pivotOptions_nonempty s r hs D F) have hhalf : (((((pivotOptions s r hs D F).card : ℝ≥0)⁻¹/2) : ℝ≥0) : ℝ≥0∞) < (((pivotOptions s r hs D F).card : ℝ≥0)⁻¹ : ℝ≥0∞) := by simpa only [ENNReal.coe_inv (ne_of_gt hq)] using (ENNReal.coe_lt_coe.mpr (half_lt_self (inv_pos.mpr hq))) have hm:=E.physical_pivot_mixture_mass C hs D F B q₀ hq₀ b hb τ Y π Read hπ hRead hS M have hm' : (((pivotOptions s r hs D F).card : ℝ≥0)⁻¹ : ℝ≥0∞) ≤ (E.pointMixture C : Measure (G⧸Γ)) (⋃ p : O,AlignmentMass.ClosedGood τ (A p) (T p)) := by simpa only [O,A,T,Set.iUnion_subtype,closedOption] using hm have he' : ∀ᶠ N in atTop,∀ (p : O) i x, |AN N p i x-A p i x| ≤ τ/4 ∧ |TN N p i x-T p i x| ≤ τ/4 := by filter_upwards [he] with N hN p i x exact hN p.val p.property i x have hh:=AlignmentMass.eventually_success_mass (E.pointMixture C) E.empiricalPointLaw (E.weak_point_law C hL ht) hτ A T AN TN (fun p=>centerReading_continuous D π Read hπ hRead F q₀ b p.val) (fun p=>translatedReading_continuous D π Read hπ hRead hS F q₀ b p.val) he' hhalf hm' simpa only [O,AN,TN,Set.iUnion_subtype] using hh
end AllLevelFactorization.Factorizationend end
section
noncomputable sectionnamespace CubeFacesvariable {G H ι : Type*} [Group G] [Group H] [DecidableEq ι]variable (p : G →* H)
def vertexMap : (Finset ι → G) →* (Finset ι → H) where toFun f w:=p (f w) map_one' := by ext w; exact p.map_one map_mul' f g:=by ext w; exact p.map_mul _ _
omit [DecidableEq ι] in@[simp] lemma vertexMap_apply (f : Finset ι → G) (w : Finset ι) : vertexMap p f w=p (f w) := rfl
lemma vertexMap_face (D : Finset ι) : (vertexMap p).comp (face D)=(face D).comp p := by ext g w simp only [MonoidHom.comp_apply,vertexMap_apply,face_apply] split_ifs <;> simp
lemma map_cube (K : Filtration G) (L : Filtration H) (honto : ∀ j,(K.level j).map p=L.level j) (I : Finset ι) (l : ℕ) : (cube K I l).map (vertexMap p)=cube L I l := by simp only [cube,Subgroup.map_iSup,Subgroup.map_map,vertexMap_face] simp only [←Subgroup.map_map,honto]
lemma exists_cube_lift (K : Filtration G) (L : Filtration H) (honto : ∀ j,(K.level j).map p=L.level j) (I : Finset ι) (l : ℕ) (f : Finset ι → H) (hf : f∈cube L I l) : ∃ g∈cube K I l,∀ w,p (g w)=f w := by rw [←map_cube p K L honto I l] at hf obtain ⟨g,hg,he⟩:=hf exact ⟨g,hg,fun w=>congrFun he w⟩
end CubeFacesend end
section
noncomputable sectionopen scoped BigOperatorsnamespace RationalEchelon
variable {K : Type*} [Field K]
structure Chart {n : ℕ} (W : Submodule K (Fin n → K)) where dim : ℕ pivot : Fin dim → Fin n mono : StrictMono pivot embed : (Fin dim → K) →ₗ[K] (Fin n → K) mem : ∀ x,embed x∈W onto : ∀ v∈W,∃ x,embed x=v at_pivot : ∀ x i,embed x (pivot i)=x i prefix_eq : ∀ j x y,(∀ i,pivot i ≤ j → x i=y i) → embed x j=embed y j
def dropLast (n : ℕ) : (Fin (n+1) → K) →ₗ[K] (Fin n → K) where toFun x i:=x i.castSucc map_add' _ _:=rfl map_smul' _ _:=rfl
def snocZero (n : ℕ) : (Fin n → K) →ₗ[K] (Fin (n+1) → K) where toFun x:=Fin.snoc x 0 map_add' x y:=by ext i; refine Fin.lastCases ?_ (fun i=>?_) i <;> simp map_smul' a x:=by ext i; refine Fin.lastCases ?_ (fun i=>?_) i <;> simp
lemma expansion {n : ℕ} (x : Fin n → K) : x=∑ i : Fin n,x i • Pi.single i 1 := by ext j simp [Finset.sum_apply,Pi.smul_apply,Pi.single_apply]
lemma lift {n d : ℕ} (W : Submodule K (Fin (n+1) → K)) (e : (Fin d → K) →ₗ[K] (Fin n → K)) (he : ∀ x,e x∈W.map (dropLast n)) : ∃ f : (Fin d → K) →ₗ[K] (Fin (n+1) → K), (∀ x,f x∈W) ∧ ∀ x,dropLast n (f x)=e x := by have hex (i : Fin d) : ∃ b∈W,dropLast n b=e (Pi.single i 1) := Submodule.mem_map.mp (he _) choose b hb hpb using hex let f : (Fin d → K) →ₗ[K] (Fin (n+1) → K):= ∑ i : Fin d,(LinearMap.proj i).smulRight (b i) have hf (x) : f x=∑ i : Fin d,x i • b i := by simp [f,LinearMap.sum_apply] refine ⟨f,?_,?_⟩ · intro x rw [hf] exact W.sum_mem (fun i _=>W.smul_mem _ (hb i)) · intro x rw [hf,map_sum] simp only [map_smul,hpb] conv_rhs=>rw [expansion x,map_sum] simp
theorem chart_exists {n : ℕ} (W : Submodule K (Fin n → K)) : Nonempty (Chart W) := by induction n with | zero => exact ⟨{ dim:=0 pivot:=Fin.elim0 mono:=by intro i; exact Fin.elim0 i embed:=0 mem:=by intro x; exact W.zero_mem onto:=by intro v hv; exact ⟨Fin.elim0,Subsingleton.elim _ _⟩ at_pivot:=by intro x i; exact Fin.elim0 i prefix_eq:=by intro j; exact Fin.elim0 j }⟩ | succ n ih => let V:=W.map (dropLast n) obtain ⟨E⟩:=ih V obtain ⟨f,hf,hpf⟩:=lift W E.embed E.mem by_cases hker : ∀ v∈W,dropLast n v=0 → v=0 · have hinj : ∀ u∈W,∀ v∈W,dropLast n u=dropLast n v → u=v := by intro u hu v hv huv apply sub_eq_zero.mp apply hker (u-v) (W.sub_mem hu hv) rw [map_sub,huv,sub_self] refine ⟨{ dim:=E.dim pivot:=fun i=>(E.pivot i).castSucc mono:=by intro i j hij; exact E.mono hij embed:=f mem:=hf onto:=?_ at_pivot:=?_ prefix_eq:=?_ }⟩ · intro v hv obtain ⟨x,hx⟩:=E.onto (dropLast n v) (Submodule.mem_map.mpr ⟨v,hv,rfl⟩) exact ⟨x,hinj _ (hf _) _ hv ((hpf x).trans hx)⟩ · intro x i exact (congrFun (hpf x) (E.pivot i)).trans (E.at_pivot x i) · intro j x y hxy revert hxy refine Fin.lastCases ?_ (fun j=>?_) j <;> intro hxy · have he : x=y:=funext fun i=>hxy i (Fin.le_last _) rw [he] · exact (congrFun (hpf x) j).trans ((E.prefix_eq j x y (fun i hi=>hxy i hi)).trans (congrFun (hpf y) j).symm) · push Not at hker obtain ⟨v,hv,hpv,hv0⟩:=hker have hvl : v (Fin.last n)≠0 := by intro hh apply hv0 ext i refine Fin.lastCases hh (fun i=>?_) i exact congrFun hpv i have haxis : Pi.single (Fin.last n) (1:K)∈W := by have he : (v (Fin.last n))⁻¹ • v=Pi.single (Fin.last n) 1 := by ext i refine Fin.lastCases ?_ (fun i=>?_) i · simp [hvl] · have hz : v i.castSucc=0:=congrFun hpv i simp [hz,Fin.castSucc_ne_last] rw [← he] exact W.smul_mem _ hv have hzero (x : Fin E.dim → K) : snocZero n (E.embed x)∈W := by have hx:=hf x have he : snocZero n (E.embed x)=f x-f x (Fin.last n) • Pi.single (Fin.last n) 1 := by ext i refine Fin.lastCases ?_ (fun i=>?_) i · simp [snocZero] · have hh:=congrFun (hpf x) i simpa [snocZero,dropLast,Fin.castSucc_ne_last] using hh.symm rw [he] exact W.sub_mem hx (W.smul_mem _ haxis) let e : (Fin (E.dim+1) → K) →ₗ[K] (Fin (n+1) → K) := (snocZero n).comp (E.embed.comp (dropLast E.dim)) + (LinearMap.proj (Fin.last E.dim)).smulRight (Pi.single (Fin.last n) 1) have he (x : Fin (E.dim+1) → K) : e x=Fin.snoc (E.embed (dropLast E.dim x)) (x (Fin.last E.dim)) := by ext i refine Fin.lastCases ?_ (fun i=>?_) i <;> simp [e,snocZero,Fin.castSucc_ne_last] let p : Fin (E.dim+1) → Fin (n+1):=Fin.snoc (fun i=>(E.pivot i).castSucc) (Fin.last n) refine ⟨{ dim:=E.dim+1 pivot:=p mono:=?_ embed:=e mem:=?_ onto:=?_ at_pivot:=?_ prefix_eq:=?_ }⟩ · intro i j hij revert hij refine Fin.lastCases ?_ (fun j=>?_) j <;> intro hij · have hi : i≠Fin.last E.dim:=ne_of_lt hij obtain ⟨i,rfl⟩:=Fin.eq_castSucc_of_ne_last hi simp [p] · revert hij refine Fin.lastCases ?_ (fun i=>?_) i <;> intro hij · exact False.elim (not_lt_of_ge (Fin.le_last _) hij) · simpa [p] using E.mono hij · intro x exact W.add_mem (hzero _) (W.smul_mem _ haxis) · intro y hy obtain ⟨x,hx⟩:=E.onto (dropLast n y) (Submodule.mem_map.mpr ⟨y,hy,rfl⟩) refine ⟨Fin.snoc x (y (Fin.last n)),?_⟩ rw [he] have hd : dropLast E.dim (Fin.snoc x (y (Fin.last n)))=x:=by ext i; simp [dropLast] rw [hd,hx] ext i refine Fin.lastCases ?_ (fun i=>?_) i <;> simp [dropLast] · intro x i refine Fin.lastCases ?_ (fun i=>?_) i · simp [he,p] · simpa [he,p,dropLast] using E.at_pivot (dropLast E.dim x) i · intro j x y hxy revert hxy refine Fin.lastCases ?_ (fun j=>?_) j <;> intro hxy · simp only [he,Fin.snoc_last] exact hxy (Fin.last E.dim) (by simp [p]) · simp only [he,Fin.snoc_castSucc] apply E.prefix_eq intro i hi exact hxy i.castSucc (by simpa [p] using hi)
end RationalEchelon
endendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.RationalEchelon01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
open scoped BigOperatorssectionsectionnoncomputable sectionopen scoped BigOperatorsend end
section
noncomputable sectionopen scoped BigOperatorsnamespace RationalMatrixvariable {n m k : ℕ}
def real (f : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) : (Fin n → ℝ) →ₗ[ℝ] (Fin m → ℝ) := ∑ i : Fin n,(LinearMap.proj i).smulRight (fun j=>(f (Pi.single i 1) j:ℝ))
lemma real_apply (f : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) (x : Fin n → ℝ) (j : Fin m) : real f x j=∑ i : Fin n,x i*(f (Pi.single i 1) j:ℝ) := by simp [real,LinearMap.sum_apply,Finset.sum_apply,Pi.smul_apply,smul_eq_mul]
lemma real_single (f : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) (i : Fin n) : real f (Pi.single i 1)=fun j=>(f (Pi.single i 1) j:ℝ) := by ext j simp [real_apply,Pi.single_apply]
lemma real_rat (f : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) (x : Fin n → ℚ) : real f (fun i=>(x i:ℝ))=fun j=>(f x j:ℝ) := by ext j rw [real_apply] conv_rhs=>rw [RationalEchelon.expansion x,map_sum] simp [map_smul,Finset.sum_apply,Pi.smul_apply,smul_eq_mul]
lemma real_comp (f : (Fin m → ℚ) →ₗ[ℚ] (Fin k → ℚ)) (g : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) : real (f.comp g)=(real f).comp (real g) := by apply (Pi.basisFun ℝ (Fin n)).ext intro i simp only [Pi.basisFun_apply,real_single,LinearMap.comp_apply] exact (real_rat f (g (Pi.single i 1))).symm
lemma real_id : real (LinearMap.id : (Fin n → ℚ) →ₗ[ℚ] (Fin n → ℚ))=LinearMap.id := by apply (Pi.basisFun ℝ (Fin n)).ext intro i ext j simp [real_single,Pi.basisFun_apply,Pi.single_apply,apply_ite]
lemma real_sub (f g : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) : real (f-g)=real f-real g := by ext x j simp [real_apply,mul_sub,Finset.sum_sub_distrib]
lemma real_injective : Function.Injective (@real n m) := by intro f g h apply (Pi.basisFun ℚ (Fin n)).ext intro i ext j have hh:=congrArg (fun p=>(p (Pi.single i 1)) j) h simpa only [real_single,Pi.basisFun_apply,Rat.cast_inj] using hh
lemma real_injective_of_injective (f : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) (hf : Function.Injective f) : Function.Injective (real f) := by obtain ⟨g,hg⟩:=f.exists_leftInverse_of_injective (LinearMap.ker_eq_bot.mpr hf) have hh:=congrArg real hg rw [real_comp,real_id] at hh exact Function.LeftInverse.injective (fun x=>LinearMap.congr_fun hh x)
end RationalMatrix
namespace RationalEchelon.Chartvariable {n : ℕ} {W : Submodule ℚ (Fin n → ℚ)} (E : Chart W)
def coords : (Fin n → ℚ) →ₗ[ℚ] (Fin E.dim → ℚ) where toFun x i:=x (E.pivot i) map_add' _ _:=rfl map_smul' _ _:=rfl
lemma coords_embed (x : Fin E.dim → ℚ) : E.coords (E.embed x)=x := by ext i exact E.at_pivot x i
lemma embed_coords {x : Fin n → ℚ} (hx : x∈W) : E.embed (E.coords x)=x := by obtain ⟨y,rfl⟩:=E.onto x hx rw [coords_embed]
lemma real_coords (x : Fin n → ℝ) (i : Fin E.dim) : RationalMatrix.real E.coords x i=x (E.pivot i) := by simp [RationalMatrix.real_apply,coords,Pi.single_apply,apply_ite]
lemma real_at_pivot (x : Fin E.dim → ℝ) (i : Fin E.dim) : RationalMatrix.real E.embed x (E.pivot i)=x i := by simp [RationalMatrix.real_apply,E.at_pivot,Pi.single_apply,apply_ite]
lemma coeff_zero (j : Fin n) (i : Fin E.dim) (hji : j<E.pivot i) : E.embed (Pi.single i 1) j=0 := by have hh:=E.prefix_eq j (Pi.single i 1) 0 (by intro l hl have hli : l≠i:=by intro he; subst l; exact (not_le_of_gt hji hl) simp [hli]) simpa using hh
lemma real_prefix (j : Fin n) (x y : Fin E.dim → ℝ) (hxy : ∀ i,E.pivot i ≤ j → x i=y i) : RationalMatrix.real E.embed x j=RationalMatrix.real E.embed y j := by simp only [RationalMatrix.real_apply] apply Finset.sum_congr rfl intro i hi by_cases hij : E.pivot i≤j · rw [hxy i hij] · rw [E.coeff_zero j i (lt_of_not_ge hij),Rat.cast_zero,mul_zero,mul_zero]
def normal : (Fin n → ℚ) →ₗ[ℚ] (Fin n → ℚ) := LinearMap.id-E.embed.comp E.coords
lemma normal_apply (x : Fin n → ℚ) : E.normal x=x-E.embed (E.coords x) := rfl
lemma normal_pivot (x : Fin n → ℚ) (i : Fin E.dim) : E.normal x (E.pivot i)=0 := by simp [normal,coords,E.at_pivot]
lemma normal_sub (x : Fin n → ℚ) : x-E.normal x∈W := by simpa [normal] using E.mem (E.coords x)
lemma normal_eq_zero_iff (x : Fin n → ℚ) : E.normal x=0 ↔ x∈W := by constructor · intro h simpa [h] using E.normal_sub x · intro hx rw [normal_apply,E.embed_coords hx,sub_self]
lemma real_normal (x : Fin n → ℝ) : RationalMatrix.real E.normal x=x-RationalMatrix.real E.embed (fun i=>x (E.pivot i)) := by rw [normal,RationalMatrix.real_sub,RationalMatrix.real_id,RationalMatrix.real_comp] have hh : RationalMatrix.real E.coords x=(fun i=>x (E.pivot i)):=funext (E.real_coords x) change x-RationalMatrix.real E.embed (RationalMatrix.real E.coords x)=_ rw [hh]
lemma real_normal_pivot (x : Fin n → ℝ) (i : Fin E.dim) : RationalMatrix.real E.normal x (E.pivot i)=0 := by rw [E.real_normal] simp [E.real_at_pivot]
lemma real_normal_tail (q : ℕ) (x : Fin n → ℝ) (hx : ∀ j : Fin n,j.val<q → x j=0) : ∀ j : Fin n,j.val<q → RationalMatrix.real E.normal x j=0 := by intro j hj rw [E.real_normal] change x j-RationalMatrix.real E.embed (fun i=>x (E.pivot i)) j=0 rw [hx j hj] have he:=E.real_prefix j (fun i=>x (E.pivot i)) 0 (by intro i hi exact hx _ (lt_of_le_of_lt hi hj)) simpa using congrArg Neg.neg he
end RationalEchelon.Chartend end
section
noncomputable sectionopen scoped BigOperatorsnamespace RationalMatrixvariable {a b : ℕ}def select (u : Fin a → Fin b) : (Fin b → ℚ) →ₗ[ℚ] (Fin a → ℚ) where toFun x i:=x (u i) map_add' _ _:=rfl map_smul' _ _:=rfllemma real_select (u : Fin a → Fin b) (x : Fin b → ℝ) (i : Fin a) : real (select u) x i=x (u i) := by simp [real_apply,select,Pi.single_apply,apply_ite]end RationalMatrix
namespace RationalEchelon.Chartvariable {n : ℕ} {W : Submodule ℚ (Fin n → ℚ)} (E : Chart W)
def freeSet : Finset (Fin n):=Finset.univ.filter (fun j=>j∉Set.range E.pivot)def free : Fin E.freeSet.card ↪o Fin n:=E.freeSet.orderEmbOfFin rfl
lemma free_ne_pivot (i : Fin E.freeSet.card) (j : Fin E.dim) : E.free i≠E.pivot j := by have hh:=(Finset.mem_filter.mp (E.freeSet.orderEmbOfFin_mem rfl i)).2 exact fun he=>hh ⟨j,he.symm⟩
lemma pivot_or_free (j : Fin n) : (∃ i : Fin E.dim,E.pivot i=j) ∨ ∃ i : Fin E.freeSet.card,E.free i=j := by by_cases h : j∈Set.range E.pivot · exact Or.inl h · right have hh : j∈E.freeSet:=Finset.mem_filter.mpr ⟨Finset.mem_univ _,h⟩ have he:=E.freeSet.range_orderEmbOfFin rfl change j∈Set.range E.free rw [show Set.range E.free=E.freeSet from he] exact hh
def sectionMap : (Fin E.freeSet.card → ℚ) →ₗ[ℚ] (Fin n → ℚ):= ∑ i : Fin E.freeSet.card,(LinearMap.proj i).smulRight (Pi.single (E.free i) 1)
def quotientMap : (Fin n → ℚ) →ₗ[ℚ] (Fin E.freeSet.card → ℚ):= (RationalMatrix.select E.free).comp E.normal
lemma section_apply (x : Fin E.freeSet.card → ℚ) (j : Fin n) : E.sectionMap x j=∑ i : Fin E.freeSet.card,x i*(Pi.single (E.free i) 1 : Fin n → ℚ) j := by simp [sectionMap,LinearMap.sum_apply,Finset.sum_apply,Pi.smul_apply,smul_eq_mul]
lemma section_free (x : Fin E.freeSet.card → ℚ) (i : Fin E.freeSet.card) : E.sectionMap x (E.free i)=x i := by simp [E.section_apply,Pi.single_apply,E.free.injective.eq_iff]
lemma section_pivot (x : Fin E.freeSet.card → ℚ) (j : Fin E.dim) : E.sectionMap x (E.pivot j)=0 := by rw [E.section_apply] apply Finset.sum_eq_zero intro i hi simp [(E.free_ne_pivot i j).symm]
lemma normal_section (x : Fin E.freeSet.card → ℚ) : E.normal (E.sectionMap x)=E.sectionMap x := by have he : E.coords (E.sectionMap x)=0:=funext (E.section_pivot x) rw [normal_apply,he,map_zero,sub_zero]
lemma quotient_section (x : Fin E.freeSet.card → ℚ) : E.quotientMap (E.sectionMap x)=x := by change (RationalMatrix.select E.free) (E.normal (E.sectionMap x))=x rw [E.normal_section] ext i exact E.section_free x i
lemma section_quotient (x : Fin n → ℚ) : E.sectionMap (E.quotientMap x)=E.normal x := by ext j rcases E.pivot_or_free j with ⟨i,rfl⟩|⟨i,rfl⟩ · rw [E.section_pivot,E.normal_pivot] · rw [E.section_free] rfl
lemma quotient_eq_zero_iff (x : Fin n → ℚ) : E.quotientMap x=0 ↔ x∈W := by rw [← E.normal_eq_zero_iff,← E.section_quotient] constructor · intro h rw [h,map_zero] · intro hx have hh:=congrArg E.quotientMap hx simpa only [E.quotient_section,map_zero] using hh
lemma remainder_mem (x : Fin n → ℚ) : x-E.sectionMap (E.quotientMap x)∈W := by rw [E.section_quotient] exact E.normal_sub x
lemma real_quotient (x : Fin n → ℝ) (i : Fin E.freeSet.card) : RationalMatrix.real E.quotientMap x i=RationalMatrix.real E.normal x (E.free i) := by rw [quotientMap,RationalMatrix.real_comp] exact RationalMatrix.real_select E.free _ i
lemma real_section_free (x : Fin E.freeSet.card → ℝ) (i : Fin E.freeSet.card) : RationalMatrix.real E.sectionMap x (E.free i)=x i := by simp [RationalMatrix.real_apply,E.section_free,Pi.single_apply,apply_ite]
lemma real_section_pivot (x : Fin E.freeSet.card → ℝ) (j : Fin E.dim) : RationalMatrix.real E.sectionMap x (E.pivot j)=0 := by simp [RationalMatrix.real_apply,E.section_pivot]
lemma real_quotient_section (x : Fin E.freeSet.card → ℝ) : RationalMatrix.real E.quotientMap (RationalMatrix.real E.sectionMap x)=x := by have he : E.quotientMap.comp E.sectionMap=LinearMap.id:=LinearMap.ext E.quotient_section have hh:=congrArg RationalMatrix.real he rw [RationalMatrix.real_comp,RationalMatrix.real_id] at hh exact LinearMap.congr_fun hh x
lemma real_section_quotient (x : Fin n → ℝ) : RationalMatrix.real E.sectionMap (RationalMatrix.real E.quotientMap x)=RationalMatrix.real E.normal x := by have he : E.sectionMap.comp E.quotientMap=E.normal:=LinearMap.ext E.section_quotient have hh:=congrArg RationalMatrix.real he rw [RationalMatrix.real_comp] at hh exact LinearMap.congr_fun hh x
lemma real_normal_level (w : Fin n → ℕ) (hw : Monotone w) (l : ℕ) (x : Fin n → ℝ) (hx : ∀ j,w j<l → x j=0) : ∀ j,w j<l → RationalMatrix.real E.normal x j=0 := by intro j hj rw [E.real_normal] change x j-RationalMatrix.real E.embed (fun i=>x (E.pivot i)) j=0 rw [hx j hj] have he:=E.real_prefix j (fun i=>x (E.pivot i)) 0 (by intro i hi exact hx _ (lt_of_le_of_lt (hw hi) hj)) simpa using congrArg Neg.neg he
lemma real_quotient_level (w : Fin n → ℕ) (hw : Monotone w) (l : ℕ) (x : Fin n → ℝ) (hx : ∀ j,w j<l → x j=0) : ∀ i,w (E.free i)<l → RationalMatrix.real E.quotientMap x i=0 := by intro i hi rw [E.real_quotient] exact E.real_normal_level w hw l x hx (E.free i) hi
lemma real_section_level (w : Fin n → ℕ) (l : ℕ) (x : Fin E.freeSet.card → ℝ) (hx : ∀ i,w (E.free i)<l → x i=0) : ∀ j,w j<l → RationalMatrix.real E.sectionMap x j=0 := by intro j hj rcases E.pivot_or_free j with ⟨i,rfl⟩|⟨i,rfl⟩ · exact E.real_section_pivot x i · rw [E.real_section_free] exact hx i hj
variable {m : ℕ} (p : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) (hW : W=LinearMap.ker p)include hW inlemma section_map_injective : Function.Injective (p.comp E.sectionMap) := by have hmem (z : Fin n → ℚ) : z∈W ↔ p z=0 := by rw [hW]; rfl intro x y hxy have hh : E.sectionMap (x-y)∈W := by rw [hmem,map_sub,map_sub,sub_eq_zero] exact hxy have hz:=(E.quotient_eq_zero_iff _).mpr hh rw [E.quotient_section] at hz exact sub_eq_zero.mp hz
include hW inlemma map_section_quotient (x : Fin n → ℚ) : p (E.sectionMap (E.quotientMap x))=p x := by have hmem (z : Fin n → ℚ) : z∈W ↔ p z=0 := by rw [hW]; rfl have hh:=E.remainder_mem x rw [hmem,map_sub,sub_eq_zero] at hh exact hh.symm
include hW inlemma real_map_section_quotient (x : Fin n → ℝ) : RationalMatrix.real p (RationalMatrix.real E.sectionMap (RationalMatrix.real E.quotientMap x))= RationalMatrix.real p x := by have he : (p.comp E.sectionMap).comp E.quotientMap=p:=LinearMap.ext (E.map_section_quotient p hW) have hh:=congrArg RationalMatrix.real he rw [RationalMatrix.real_comp,RationalMatrix.real_comp] at hh exact LinearMap.congr_fun hh x
include hW inlemma real_kernel_iff (x : Fin n → ℝ) : RationalMatrix.real p x=0 ↔ RationalMatrix.real E.quotientMap x=0 := by have hi:=RationalMatrix.real_injective_of_injective _ (E.section_map_injective p hW) rw [RationalMatrix.real_comp] at hi constructor · intro hx apply hi simpa only [LinearMap.comp_apply,map_zero,E.real_map_section_quotient p hW] using hx · intro hx rw [← E.real_map_section_quotient p hW x,hx,map_zero,map_zero]
end RationalEchelon.Chart
endendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.CubePolynomials01import OAI.Combinatorics.SumProduct.Alignment.RationalLattice01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionopen scoped commutatorElementend
sectionopen scoped commutatorElementnoncomputable sectionnamespace CubeFacesvariable {G A : Type*} [Group G] [Group A]
def Filtration.pullback (H : Filtration G) (φ : A →* G) : Filtration A where level i := (H.level i).comap φ antitone i j hij := Subgroup.comap_mono (H.antitone hij) commutator_le i j := by apply Subgroup.commutator_le.mpr intro a ha b hb change φ ⁅a,b⁆ ∈ H.level (i+j) rw [map_commutatorElement] exact H.commutator_le i j (Subgroup.commutator_mem_commutator ha hb)
def Filtration.refine (H : Filtration G) (K : Subgroup G) (hcomm : ∀ a b : G, ⁅a,b⁆ ∈ K) : Filtration G where level i := if i < 2 then H.level i else H.level i ⊓ K antitone := by intro i j hij by_cases hi : i < 2 · simp only [hi,ite_true] split_ifs · exact H.antitone hij · exact inf_le_left.trans (H.antitone hij) · have hj : ¬ j < 2 := by omega simp only [hi,hj,ite_false] exact inf_le_inf (H.antitone hij) le_rfl commutator_le := by intro i j apply Subgroup.commutator_le.mpr intro a ha b hb have hia : a ∈ H.level i := by split_ifs at ha <;> aesop have hjb : b ∈ H.level j := by split_ifs at hb <;> aesop have hc := H.commutator_le i j (Subgroup.commutator_mem_commutator hia hjb) split_ifs · exact hc · exact ⟨hc,hcomm a b⟩end CubeFaces
namespace CubePolynomialsopen CubeFacesvariable {G A : Type*} [Group G] [Group A]
theorem pullback_mem (H : Filtration G) (φ : A →* G) (hφ : Function.Injective φ) (q k : ℕ) (hbot : H.level (k+q) = ⊥) (f : ℤ → A) (hf : (fun n => φ (f n)) ∈ polynomials H k) : f ∈ polynomials (H.pullback φ) k := by induction q generalizing k f with | zero => have he : f = 1 := by funext n apply hφ have hv := eval_mem hf n have hb : H.level k = ⊥ := by simpa using hbot simpa [hb] using hv rw [he] exact (polynomials _ _).one_mem | succ q ih => apply mem_of_derivatives · intro n exact eval_mem hf n · intro t apply ih (k+1) (by convert hbot using 1; congr 1; omega) convert derivative_mem hf t using 1 ext n simp [shift,map_mul,map_inv]
theorem refine_mem (H : Filtration G) (K : Subgroup G) (hcomm : ∀ a b : G, ⁅a,b⁆ ∈ K) (q k : ℕ) (hbot : H.level (k+q) = ⊥) (f : ℤ → G) (hf : f ∈ polynomials H k) (hK : ∀ n, f n ∈ K) : f ∈ polynomials (H.refine K hcomm) k := by induction q generalizing k f with | zero => have he : f = 1 := by funext n have hv := eval_mem hf n have hb : H.level k = ⊥ := by simpa using hbot simpa [hb] using hv rw [he] exact (polynomials _ _).one_mem | succ q ih => apply mem_of_derivatives · intro n change f n ∈ (if k < 2 then H.level k else H.level k ⊓ K) split_ifs · exact eval_mem hf n · exact ⟨eval_mem hf n,hK n⟩ · intro t apply ih (k+1) (by convert hbot using 1; congr 1; omega) _ (derivative_mem hf t) intro n exact K.mul_mem (K.inv_mem (hK n)) (hK (n+t))
theorem refine_of_linear_coset (H : Filtration G) (K : Subgroup G) (hcomm : ∀ a b : G, ⁅a,b⁆ ∈ K) (s : ℕ) (hbot : H.level s = ⊥) (f : ℤ → G) (hf : f ∈ polynomials H 0) (a : G) (ha : a ∈ H.level 1) (hK : ∀ n, f n * (a^n)⁻¹ ∈ K) : f ∈ polynomials (H.refine K hcomm) 0 := by have hl : (fun n : ℤ => a^n) ∈ polynomials H 0 := by simpa using NilpotentTaylor.binomial_mem (H:=H) 1 0 a ha have hl' : (fun n : ℤ => a^n) ∈ polynomials (H.refine K hcomm) 0 := by apply (by simpa using NilpotentTaylor.binomial_mem (H:=H.refine K hcomm) 1 0 a ha) have hr := refine_mem H K hcomm s 0 (by simpa using hbot) (f*(fun n : ℤ => a^n)⁻¹) ((polynomials H 0).mul_mem hf ((polynomials H 0).inv_mem hl)) hK have he : (f*(fun n : ℤ => a^n)⁻¹) * (fun n : ℤ => a^n) = f := by group rw [← he] exact (polynomials _ _).mul_mem hr hl'
end CubePolynomialsendend
sectionnamespace RationalFactorPeriodsnoncomputable sectionlemma eval_desc (n : ℤ) (j : ℕ) : (descPochhammer ℤ j).eval n = (j.factorial : ℤ) * Ring.choose n j := by have h := Ring.descPochhammer_eq_factorial_smul_choose n j rw [← Polynomial.aeval_eq_smeval] at h simpa using h
lemma choose_period_dvd (m : ℕ) {j d : ℕ} (hj : j ≤ d) (n : ℤ) : (m : ℤ) ∣ Ring.choose (n + (m * d.factorial : ℕ)) j - Ring.choose n j := by have h := Polynomial.sub_dvd_eval_sub (n + (m*d.factorial : ℕ)) n (descPochhammer ℤ j) rw [add_sub_cancel_left,eval_desc,eval_desc,← mul_sub] at h have hfac : (j.factorial : ℤ) ∣ (d.factorial : ℤ) := Int.natCast_dvd_natCast.mpr (Nat.factorial_dvd_factorial hj) have hdiv : (j.factorial : ℤ) * m ∣ (m*d.factorial : ℕ) := by rw [Nat.cast_mul,mul_comm (j.factorial : ℤ)] exact mul_dvd_mul_left (m : ℤ) hfac exact (Int.mul_dvd_mul_iff_left (by exact_mod_cast j.factorial_ne_zero)).mp (hdiv.trans h)
variable {G : Type*} [Group G]lemma zpow_eq_of_sub_dvd {a : G} {m : ℕ} (ha : a^m = 1) {u v : ℤ} (h : (m : ℤ) ∣ u-v) : a^u = a^v := by obtain ⟨z,hz⟩ := h have he : u = (m : ℤ)*z+v := by omega rw [he,zpow_add,zpow_mul,zpow_natCast,ha,one_zpow,one_mul]
def orderedWord {k : ℕ} (a : Fin k → G) (j : Fin k → ℕ) (b : ℤ) : G := ((List.finRange k).map (fun i => a i ^ Ring.choose b (j i))).prod
lemma orderedWord_map {K : Type*} [Group K] (φ : G →* K) {k : ℕ} (a : Fin k → G) (j : Fin k → ℕ) (b : ℤ) : φ (orderedWord a j b) = orderedWord (fun i => φ (a i)) j b := by simp [orderedWord,map_list_prod,List.map_map,Function.comp_def]
lemma orderedWord_congr {k : ℕ} {a a' : Fin k → G} (ha : ∀ i, a i = a' i) (j : Fin k → ℕ) (b : ℤ) : orderedWord a j b = orderedWord a' j b := by have h : a = a' := funext ha rw [h]
lemma orderedWord_periodic {k : ℕ} (a : Fin k → G) (j : Fin k → ℕ) (m s : ℕ) (ha : ∀ i, a i ^ m = 1) (hj : ∀ i, j i ≤ s) : Function.Periodic (orderedWord a j) (m * s.factorial : ℕ) := by intro b unfold orderedWord congr 1 apply List.map_congr_left intro i _ exact zpow_eq_of_sub_dvd (ha i) (choose_period_dvd m (hj i) b)
lemma finite_image_periodic {K : Type*} [Group K] [Fintype K] (φ : G →* K) {k : ℕ} (a : Fin k → G) (j : Fin k → ℕ) (s : ℕ) (hj : ∀ i, j i ≤ s) : Function.Periodic (fun b => φ (orderedWord a j b)) (Fintype.card K * s.factorial : ℕ) := by intro b simp only [orderedWord_map] exact orderedWord_periodic (fun i => φ (a i)) j (Fintype.card K) s (fun _ => pow_card_eq_one) hj b
lemma finite_image_stabilizes {K : Type*} [Group K] [Finite K] (φ : G →* K) {k : ℕ} (a : ℕ → Fin k → G) (j : Fin k → ℕ) : ∃ u : ℕ → ℕ, StrictMono u ∧ ∀ l b, φ (orderedWord (a (u l)) j b) = φ (orderedWord (a (u 0)) j b) := by classical let F : ℕ → (Fin k → K) := fun l i => φ (a l i) obtain ⟨v,hv⟩ := Finite.exists_infinite_fiber F have hi : (Set.ofPred (fun l => F l = v)).Infinite := Set.infinite_coe_iff.mp hv refine ⟨Nat.nth (fun l => F l = v),Nat.nth_strictMono hi,?_⟩ intro l b simp only [orderedWord_map] apply orderedWord_congr intro i have hl := congrFun (Nat.nth_mem_of_infinite hi l) i have hz := congrFun (Nat.nth_mem_of_infinite hi 0) i exact hl.trans hz.symm
lemma coset_pattern_stabilizes (Γ : Subgroup G) [Γ.FiniteIndex] {k : ℕ} (a : ℕ → Fin k → G) (j : Fin k → ℕ) (s : ℕ) (hj : ∀ i, j i ≤ s) : ∃ (u : ℕ → ℕ) (T : ℕ), StrictMono u ∧ 0 < T ∧ (∀ l b, (QuotientGroup.mk (orderedWord (a (u l)) j b) : G ⧸ Γ) = QuotientGroup.mk (orderedWord (a (u 0)) j b)) ∧ Function.Periodic (fun b => (QuotientGroup.mk (orderedWord (a (u 0)) j b) : G ⧸ Γ)) (T : ℤ) := by classical let : Fintype (G ⧸ Γ) := Fintype.ofFinite _ let K := Equiv.Perm (G ⧸ Γ) let φ : G →* K := MulAction.toPermHom G (G ⧸ Γ) obtain ⟨u,hu,he⟩ := finite_image_stabilizes φ a j refine ⟨u,Fintype.card K * s.factorial,hu, Nat.mul_pos Fintype.card_pos s.factorial_pos,?_,?_⟩ · intro l b have h := congrArg (fun e : K => e (QuotientGroup.mk (1:G))) (he l b) simpa [φ,K,MulAction.toPermHom] using h · intro b have h := congrArg (fun e : K => e (QuotientGroup.mk (1:G))) (finite_image_periodic φ (a (u 0)) j s hj b) simpa [φ,K,MulAction.toPermHom] using h
lemma periodic_mod {α : Type*} {f : ℤ → α} {T : ℤ} (hf : Function.Periodic f T) (b : ℤ) : f (b % T) = f b := by have h := hf.sub_int_mul_eq (x := b) (b / T) simpa [Int.emod_def,mul_comm] using h
theorem rational_right_factors [TopologicalSpace G] [IsTopologicalGroup G] [PreconnectedSpace G] [LocallyCompactSpace G] [T2Space G] {n k : ℕ} (c : RationalLattice.RealCoordinates G n) (Γ : Subgroup G) [DiscreteTopology Γ] (hΓrat : Γ ≤ RationalLattice.rationalSubgroup c) (C : Set G) (hC : IsCompact C) (hreps : ∀ g : G, ∃ x ∈ C, x⁻¹*g ∈ Γ) (v : Fin k → G) (hv : ∀ i, RationalLattice.IsRational c (v i)) (m : ℕ → Fin k → ℤ) (j : Fin k → ℕ) (s : ℕ) (hj : ∀ i, j i ≤ s) : ∃ (u : ℕ → ℕ) (T : ℕ) (σ : Fin T → G), StrictMono u ∧ 0 < T ∧ (∀ r, RationalLattice.IsRational c (σ r)) ∧ ∀ l b, ∃ r : Fin T, (r.val : ℤ) = b % (T : ℤ) ∧ (QuotientGroup.mk (orderedWord (fun i => v i ^ m (u l) i) j b) : G ⧸ Γ) = QuotientGroup.mk (σ r) := by classical let S := Finset.univ.image v have hSrat : ∀ g ∈ S, RationalLattice.IsRational c g := by intro g hg obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp hg exact hv i obtain ⟨H,hΓH,hSH,hHrat,hHd,hHi⟩ := RationalLattice.finite_rational_extension c Γ hΓrat C hC hreps S hSrat let : (Γ.subgroupOf H).FiniteIndex := hHi have hvH (i : Fin k) : v i ∈ H := hSH (Finset.mem_image.mpr ⟨i,Finset.mem_univ _,rfl⟩) let a : ℕ → Fin k → H := fun l i => ⟨v i ^ m l i,H.zpow_mem (hvH i) _⟩ obtain ⟨u,T,hu,hT,hfix,hper⟩ := coset_pattern_stabilizes (Γ.subgroupOf H) a j s hj let σ : Fin T → G := fun r => (orderedWord (a (u 0)) j (r.val : ℤ) : H) refine ⟨u,T,σ,hu,hT,?_,?_⟩ · intro r exact hHrat (orderedWord (a (u 0)) j (r.val : ℤ)).property · intro l b have hnonneg : 0 ≤ b % (T : ℤ) := Int.emod_nonneg _ (by omega) have hlt : b % (T : ℤ) < T := Int.emod_lt_of_pos _ (by omega) let r : Fin T := ⟨(b % (T : ℤ)).toNat,by omega⟩ have hr : (r.val : ℤ) = b % (T : ℤ) := Int.toNat_of_nonneg hnonneg refine ⟨r,hr,?_⟩ have he : (QuotientGroup.mk (orderedWord (a (u l)) j b) : H ⧸ Γ.subgroupOf H) = QuotientGroup.mk (orderedWord (a (u 0)) j (r.val : ℤ)) := by rw [hr] exact (hfix l b).trans (periodic_mod hper b).symm have hmem := QuotientGroup.eq.mp he have hquot : (QuotientGroup.mk ((orderedWord (a (u l)) j b : H) : G) : G ⧸ Γ) = QuotientGroup.mk (σ r) := QuotientGroup.eq.mpr hmem have hmap : ((orderedWord (a (u l)) j b : H) : G) = orderedWord (fun i => v i ^ m (u l) i) j b := orderedWord_map H.subtype (a (u l)) j b rw [hmap] at hquot exact hquot
endend RationalFactorPeriods
endendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.TriangularDenominators01import OAI.Geometry.NilpotentCharts.Coordinatesimport OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnamespace RationalLatticenoncomputable sectionvariable {G : Type*} [Group G] [TopologicalSpace G]variable {n : ℕ}
def IsRational (c : RealCoordinates G n) (g : G) : Prop := ∀ i, ∃ x : ℚ, (x : ℝ) = c.coord g i
lemma eval_rational {ι : Type*} (P : MvPolynomial ι ℚ) (x : ι → ℝ) (hx : ∀ i, ∃ q : ℚ, (q : ℝ) = x i) : ∃ q : ℚ, (q : ℝ) = MvPolynomial.eval₂ (algebraMap ℚ ℝ) x P := by classical let q : ι → ℚ := fun i => Classical.choose (hx i) have hq : (algebraMap ℚ ℝ) ∘ q = x := funext (fun i => Classical.choose_spec (hx i)) refine ⟨MvPolynomial.eval q P,?_⟩ simpa [hq] using (MvPolynomial.eval₂_comp (algebraMap ℚ ℝ) q P)
lemma rational_one (c : RealCoordinates G n) : IsRational c 1 := by intro i exact ⟨0,by simp [c.one_coord]⟩
lemma rational_mul (c : RealCoordinates G n) {g h : G} (hg : IsRational c g) (hh : IsRational c h) : IsRational c (g*h) := by intro i obtain ⟨a,ha⟩ := hg i obtain ⟨b,hb⟩ := hh i obtain ⟨e,he⟩ := eval_rational (c.correction i) (Sum.elim (fun j => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) (by intro k; cases k with | inl j => exact hg _ | inr j => exact hh _) exact ⟨a+b+e,by rw [Rat.cast_add,Rat.cast_add,ha,hb,he,c.mul_coord]⟩
lemma rational_inv (c : RealCoordinates G n) {g : G} (hg : IsRational c g) : IsRational c g⁻¹ := by intro i have hpartial : ∀ j (hj : j < n), ∃ q : ℚ, (q : ℝ) = c.coord g⁻¹ ⟨j,hj⟩ := by intro j induction j using Nat.strong_induction_on with | h j ih => intro hj let i : Fin n := ⟨j,hj⟩ obtain ⟨a,ha⟩ := hg i obtain ⟨e,he⟩ := eval_rational (c.correction i) (Sum.elim (fun k => c.coord g ⟨k.val,lt_trans k.isLt i.isLt⟩) (fun k => c.coord g⁻¹ ⟨k.val,lt_trans k.isLt i.isLt⟩)) (by intro k cases k with | inl k => exact hg _ | inr k => exact ih k.val k.isLt _) refine ⟨-(a+e),?_⟩ have hmul := c.mul_coord g g⁻¹ i rw [mul_inv_cancel,c.one_coord,← ha,← he] at hmul rw [Rat.cast_neg,Rat.cast_add] change -((a : ℝ)+e) = c.coord g⁻¹ i linarith exact hpartial i.val i.isLt
def rationalSubgroup (c : RealCoordinates G n) : Subgroup G where carrier := IsRational c one_mem' := rational_one c mul_mem' := rational_mul c inv_mem' := rational_inv c
def qcoord (c : RealCoordinates G n) (g : rationalSubgroup c) (i : Fin n) : ℚ := Classical.choose (g.property i)
lemma qcoord_spec (c : RealCoordinates G n) (g : rationalSubgroup c) (i : Fin n) : (qcoord c g i : ℝ) = c.coord g i := Classical.choose_spec (g.property i)
lemma qcoord_injective (c : RealCoordinates G n) : Function.Injective (qcoord c) := by intro g h heq apply Subtype.ext apply c.coord.injective funext i rw [← qcoord_spec c g i,← qcoord_spec c h i,heq]
lemma qcoord_continuous (c : RealCoordinates G n) (i : Fin n) : Continuous (fun g => qcoord c g i) := by apply Rat.isEmbedding_coe_real.isInducing.continuous_iff.mpr change Continuous (fun g : rationalSubgroup c => (qcoord c g i : ℝ)) simp_rw [qcoord_spec] exact (continuous_apply i).comp (c.coord.continuous.comp continuous_subtype_val)
def rationalCoordinates (c : RealCoordinates G n) : TriangularDenominators.Coordinates (rationalSubgroup c) n where coord := qcoord c one_coord i := by apply Rat.cast_injective (α := ℝ) rw [qcoord_spec] exact (c.one_coord i).trans Rat.cast_zero.symm correction := c.correction mul_coord g h i := by apply Rat.cast_injective (α := ℝ) rw [Rat.cast_add,Rat.cast_add,qcoord_spec,qcoord_spec,qcoord_spec] have hp := MvPolynomial.eval₂_comp (algebraMap ℚ ℝ) (Sum.elim (fun j => qcoord c g ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j => qcoord c h ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i) have hcast (q : ℚ) : (algebraMap ℚ ℝ) q = (q : ℝ) := by simp simp only [hcast] at hp rw [hp] change c.coord ((g:G)*(h:G)) i = _ rw [c.mul_coord] congr 2 funext k cases k with | inl j => exact (qcoord_spec c g _).symm | inr j => exact (qcoord_spec c h _).symm
theorem rational_fg_discrete [IsTopologicalGroup G] (c : RealCoordinates G n) (H : Subgroup (rationalSubgroup c)) (hH : H.FG) : DiscreteTopology H := by obtain ⟨S,hS⟩ := hH rw [← hS] exact TriangularDenominators.closure_discrete (rationalCoordinates c) (qcoord_injective c) (qcoord_continuous c) S
endend RationalLattice
namespace RationalLatticenoncomputable sectionvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] [PreconnectedSpace G] [LocallyCompactSpace G] [T2Space G] {n : ℕ}
theorem finite_rational_extension (c : RealCoordinates G n) (Γ : Subgroup G) [DiscreteTopology Γ] (hΓrat : Γ ≤ rationalSubgroup c) (C : Set G) (hC : IsCompact C) (hreps : ∀ g : G, ∃ x ∈ C, x⁻¹*g ∈ Γ) (S : Finset G) (hSrat : ∀ g ∈ S, IsRational c g) : ∃ H : Subgroup G, Γ ≤ H ∧ (S : Set G) ⊆ H ∧ H ≤ rationalSubgroup c ∧ DiscreteTopology H ∧ (Γ.subgroupOf H).FiniteIndex := by let H := Γ ⊔ Subgroup.closure (S : Set G) have hHrat : H ≤ rationalSubgroup c := by apply sup_le hΓrat rw [Subgroup.closure_le] exact hSrat have hH : H.FG := (CocompactLattice.fg_of_compact_reps Γ C hC hreps).sup ⟨S,rfl⟩ let : Group.FG H := (Group.fg_iff_subgroup_fg H).mpr hH let e := Subgroup.subgroupOfContinuousMulEquivOfLe hHrat have hqG : Group.FG (H.subgroupOf (rationalSubgroup c)) := Group.fg_of_surjective (f := e.symm.toMonoidHom) e.symm.surjective have hq : (H.subgroupOf (rationalSubgroup c)).FG := (Group.fg_iff_subgroup_fg _).mp hqG have hdq := rational_fg_discrete c _ hq have hd : DiscreteTopology H := e.discreteTopology_iff.mp hdq let : DiscreteTopology H := hd refine ⟨H,le_sup_left,?_,hHrat,hd,?_⟩ · exact fun _ hg => Subgroup.mem_sup_right (Subgroup.subset_closure hg) · exact TriangularDenominators.finiteIndex_of_compact_reps Γ H le_sup_left C hC hreps
endend RationalLatticeend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace Polynomialopen scoped _root_.Polynomialvariable {K : Type*} [Field K] [CharZero K]
lemma exists_antidifference_monomial (i : ℕ) (a : K) : ∃ q : K[X], q.comp (1+_root_.Polynomial.X) - q = _root_.Polynomial.C a * _root_.Polynomial.X^i := by let b : K[X] := (_root_.Polynomial.bernoulli (i+1)).map (algebraMap ℚ K) have hb : b.comp (1+_root_.Polynomial.X) = b + _root_.Polynomial.C (i+1 : K) * _root_.Polynomial.X^i := by have h := congrArg (Polynomial.map (algebraMap ℚ K)) (_root_.Polynomial.bernoulli_comp_one_add_X (i+1)) simpa [b, _root_.Polynomial.map_comp, nsmul_eq_mul] using h refine ⟨_root_.Polynomial.C (a / (i+1 : K)) * b,?_⟩ rw [_root_.Polynomial.mul_comp,_root_.Polynomial.C_comp,hb] have hi : (i+1 : K) ≠ 0 := by exact_mod_cast Nat.succ_ne_zero i calc _root_.Polynomial.C (a / (i+1 : K)) * (b + _root_.Polynomial.C (i+1 : K) * _root_.Polynomial.X^i) - _root_.Polynomial.C (a / (i+1 : K)) * b = (_root_.Polynomial.C (a / (i+1 : K)) * _root_.Polynomial.C (i+1 : K)) * _root_.Polynomial.X^i := by ring _ = _root_.Polynomial.C a * _root_.Polynomial.X^i := by rw [← _root_.Polynomial.C_mul,div_mul_cancel₀ _ hi]
theorem exists_antidifference (p : K[X]) : ∃ q : K[X], q.eval 0 = 0 ∧ q.comp (1+_root_.Polynomial.X) - q = p := by have hex : ∃ q : K[X], q.comp (1+_root_.Polynomial.X) - q = p := by induction p using Polynomial.induction_on' with | add p r hp hr => obtain ⟨q,hq⟩ := hp obtain ⟨s,hs⟩ := hr refine ⟨q+s,?_⟩ rw [_root_.Polynomial.add_comp] linear_combination hq+hs | monomial i a => simpa only [_root_.Polynomial.C_mul_X_pow_eq_monomial] using exists_antidifference_monomial i a obtain ⟨q,hq⟩ := hex exact ⟨q-_root_.Polynomial.C (q.eval 0),by simp,by simpa [_root_.Polynomial.sub_comp] using hq⟩
end Polynomial
namespace Polynomialopen scoped _root_.Polynomialvariable {A : Type*} [CommRing A] [Algebra ℚ A]
lemma exists_antidifference_monomial_algebra (i : ℕ) (a : A) : ∃ q : A[X], q.comp (1+_root_.Polynomial.X) - q = _root_.Polynomial.C a * _root_.Polynomial.X^i := by let b : A[X] := (_root_.Polynomial.bernoulli (i+1)).map (algebraMap ℚ A) have hb : b.comp (1+_root_.Polynomial.X) = b + _root_.Polynomial.C (i+1 : A) * _root_.Polynomial.X^i := by have h := congrArg (Polynomial.map (algebraMap ℚ A)) (_root_.Polynomial.bernoulli_comp_one_add_X (i+1)) simpa [b,_root_.Polynomial.map_comp,nsmul_eq_mul] using h let u : A := (algebraMap ℚ A) ((i+1:ℚ)⁻¹) have hui : u*(i+1:A) = 1 := by have hi : (i+1:ℚ) ≠ 0 := by positivity have h := congrArg (algebraMap ℚ A) (inv_mul_cancel₀ hi) simpa [u] using h refine ⟨_root_.Polynomial.C (a*u)*b,?_⟩ rw [_root_.Polynomial.mul_comp,_root_.Polynomial.C_comp,hb] calc _root_.Polynomial.C (a*u) * (b + _root_.Polynomial.C (i+1:A) * _root_.Polynomial.X^i) - _root_.Polynomial.C (a*u)*b = (_root_.Polynomial.C (a*u)*_root_.Polynomial.C (i+1:A))*_root_.Polynomial.X^i := by ring _ = _root_.Polynomial.C a*_root_.Polynomial.X^i := by rw [← _root_.Polynomial.C_mul,mul_assoc,hui,mul_one]
theorem exists_antidifference_algebra (p : A[X]) : ∃ q : A[X], q.eval 0 = 0 ∧ q.comp (1+_root_.Polynomial.X) - q = p := by have hex : ∃ q : A[X], q.comp (1+_root_.Polynomial.X) - q = p := by induction p using Polynomial.induction_on' with | add p r hp hr => obtain ⟨q,hq⟩ := hp obtain ⟨s,hs⟩ := hr refine ⟨q+s,?_⟩ rw [_root_.Polynomial.add_comp] linear_combination hq+hs | monomial i a => simpa only [_root_.Polynomial.C_mul_X_pow_eq_monomial] using exists_antidifference_monomial_algebra i a obtain ⟨q,hq⟩ := hex exact ⟨q-_root_.Polynomial.C (q.eval 0),by simp,by simpa [_root_.Polynomial.sub_comp] using hq⟩
end Polynomial
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.RationalLattice01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionopen scoped BigOperatorsnoncomputable sectionendend
sectionopen scoped BigOperatorsopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionnamespace Polynomialopen scoped _root_.Polynomialvariable {K : Type*} [Field K] [CharZero K]lemma eq_of_eval_nat_eq {p q : K[X]} (h : ∀ m : ℕ, p.eval (m : K) = q.eval (m : K)) : p = q := by apply _root_.Polynomial.eq_of_infinite_eval_eq apply (Set.infinite_range_of_injective (Nat.cast_injective (R := K))).mono rintro x ⟨m,rfl⟩ exact h mend Polynomialnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
lemma polynomial_substitute_eval {ι : Type*} (P : MvPolynomial ι ℚ) (p : ι → ℝ[X]) (t : ℝ) : (MvPolynomial.eval₂ (Polynomial.C.comp (algebraMap ℚ ℝ)) p P).eval t = MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun i => (p i).eval t) P := by have h := MvPolynomial.eval₂_comp_left (Polynomial.evalRingHom t) (Polynomial.C.comp (algebraMap ℚ ℝ)) p P have hc : (Polynomial.evalRingHom t).comp (Polynomial.C.comp (algebraMap ℚ ℝ)) = algebraMap ℚ ℝ := by ext q simp rw [hc] at h exact h
theorem natpow_polynomial (g : G) (i : Fin n) : ∃ p : ℝ[X], ∀ m : ℕ, p.eval (m : ℝ) = c.coord (g^m) i := by have aux : ∀ l : ℕ, ∀ hl : l<n, ∃ p : ℝ[X], ∀ m : ℕ, p.eval (m : ℝ) = c.coord (g^m) ⟨l,hl⟩ := by intro l induction l using Nat.strong_induction_on with | h l ih => intro hl choose p hp using (fun j : Fin l => ih j.val j.isLt (lt_trans j.isLt hl)) let x : (Fin l ⊕ Fin l) → ℝ[X] := Sum.elim p (fun j => Polynomial.C (c.coord g ⟨j.val,lt_trans j.isLt hl⟩)) let Q : ℝ[X] := Polynomial.C (c.coord g ⟨l,hl⟩) + MvPolynomial.eval₂ (Polynomial.C.comp (algebraMap ℚ ℝ)) x (c.correction ⟨l,hl⟩) obtain ⟨P,hP0,hP⟩ := Polynomial.exists_antidifference Q refine ⟨P,?_⟩ intro m induction m with | zero => simpa [c.one_coord] using hP0 | succ m hm => have he := congrArg (Polynomial.eval (m : ℝ)) hP simp only [Polynomial.eval_sub,Polynomial.eval_comp,Polynomial.eval_add, Polynomial.eval_one,Polynomial.eval_X] at he have hx : (fun a => (x a).eval (m : ℝ)) = Sum.elim (fun j => c.coord (g^m) ⟨j.val,lt_trans j.isLt hl⟩) (fun j => c.coord g ⟨j.val,lt_trans j.isLt hl⟩) := by funext j cases j with | inl j => exact hp j m | inr j => simp [x] simp only [Q,Polynomial.eval_add,Polynomial.eval_C,polynomial_substitute_eval,hx] at he rw [pow_succ,c.mul_coord] rw [Nat.cast_succ,add_comm (m:ℝ) 1] linarith exact aux i.val i.isLt
def powerPolynomial (g : G) (i : Fin n) : ℝ[X] := (natpow_polynomial c g i).chooselemma powerPolynomial_nat (g : G) (i : Fin n) (m : ℕ) : (powerPolynomial c g i).eval (m : ℝ) = c.coord (g^m) i := (natpow_polynomial c g i).choose_spec m
def realPower (g : G) (t : ℝ) : G := c.coord.symm (fun i => (powerPolynomial c g i).eval t)
lemma realPower_coord (g : G) (t : ℝ) (i : Fin n) : c.coord (realPower c g t) i = (powerPolynomial c g i).eval t := by simp [realPower]
lemma realPower_nat (g : G) (m : ℕ) : realPower c g m = g^m := by apply c.coord.injective funext i rw [realPower_coord,powerPolynomial_nat]
@[simp] lemma realPower_zero (g : G) : realPower c g 0 = 1 := by simpa using realPower_nat c g 0@[simp] lemma realPower_one (g : G) : realPower c g 1 = g := by simpa using realPower_nat c g 1
lemma realPower_continuous (g : G) : Continuous (realPower c g) := c.coord.symm.continuous.comp (continuous_pi fun i => (powerPolynomial c g i).continuous)
end RationalLattice
namespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
def evalPath (p : Fin n → ℝ[X]) (t : ℝ) : G := c.coord.symm (fun i => (p i).eval t)def pathMul (p q : Fin n → ℝ[X]) (i : Fin n) : ℝ[X] := p i + q i + MvPolynomial.eval₂ (C.comp (algebraMap ℚ ℝ)) (Sum.elim (fun j => p ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j => q ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i)
lemma evalPath_coord (p : Fin n → ℝ[X]) (t : ℝ) (i : Fin n) : c.coord (evalPath c p t) i = (p i).eval t := by simp [evalPath]lemma evalPath_C (g : G) (t : ℝ) : evalPath c (fun i => C (c.coord g i)) t = g := by simp [evalPath]lemma evalPath_comp (p : Fin n → ℝ[X]) (q : ℝ[X]) (t : ℝ) : evalPath c (fun i => (p i).comp q) t = evalPath c p (q.eval t) := by simp [evalPath,Polynomial.eval_comp]lemma evalPath_mul (p q : Fin n → ℝ[X]) (t : ℝ) : evalPath c (pathMul c p q) t = evalPath c p t * evalPath c q t := by apply c.coord.injective funext i rw [evalPath_coord,c.mul_coord] simp only [pathMul,Polynomial.eval_add,polynomial_substitute_eval,evalPath_coord] congr 2 funext a cases a <;> rfl
lemma evalPath_ext_nat {p q : Fin n → ℝ[X]} (h : ∀ m : ℕ, evalPath c p (m:ℝ) = evalPath c q (m:ℝ)) : ∀ t : ℝ, evalPath c p t = evalPath c q t := by have hpq : p=q := by funext i apply Polynomial.eq_of_eval_nat_eq intro m have h' := congrArg (fun g => c.coord g i) (h m) simpa [evalPath] using h' rw [hpq] exact fun _ => rfl
lemma realPower_add_nat (g : G) (t : ℝ) (m : ℕ) : realPower c g (t+m) = realPower c g t * g^m := by let p := powerPolynomial c g let q : Fin n → ℝ[X] := fun i => (p i).comp (X+C (m:ℝ)) let r := pathMul c p (fun i => C (c.coord (g^m) i)) have hq (s : ℝ) : evalPath c q s = realPower c g (s+m) := by simp [q,realPower,evalPath,p] have hr (s : ℝ) : evalPath c r s = realPower c g s * g^m := by rw [evalPath_mul,evalPath_C] rfl have he : ∀ k : ℕ, evalPath c q k = evalPath c r k := by intro k rw [hq,hr,← Nat.cast_add,realPower_nat,realPower_nat,pow_add] simpa only [hq,hr] using evalPath_ext_nat c he t
theorem realPower_add (g : G) (s t : ℝ) : realPower c g (s+t) = realPower c g s * realPower c g t := by let p := powerPolynomial c g let q : Fin n → ℝ[X] := fun i => (p i).comp (C s+X) let r := pathMul c (fun i => C (c.coord (realPower c g s) i)) p have hq (v : ℝ) : evalPath c q v = realPower c g (s+v) := by simp [q,realPower,evalPath,p] have hr (v : ℝ) : evalPath c r v = realPower c g s * realPower c g v := by rw [evalPath_mul,evalPath_C] rfl have he : ∀ k : ℕ, evalPath c q k = evalPath c r k := by intro k rw [hq,hr,realPower_nat] exact realPower_add_nat c g s k simpa only [hq,hr] using evalPath_ext_nat c he t
lemma realPower_neg (g : G) (s : ℝ) : realPower c g (-s) = (realPower c g s)⁻¹ := by symm apply inv_eq_of_mul_eq_one_right rw [← realPower_add,add_neg_cancel,realPower_zero]
end RationalLatticeendend
sectionopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
abbrev ParamPoly (n : ℕ) := Polynomial (MvPolynomial (Fin n) ℚ)
def parameterEval (x : Fin n → ℝ) : MvPolynomial (Fin n) ℚ →+* ℝ := MvPolynomial.eval₂Hom (algebraMap ℚ ℝ) x
@[simp] lemma parameterEval_X (x : Fin n → ℝ) (i : Fin n) : parameterEval x (MvPolynomial.X i) = x i := by simp [parameterEval]
lemma universal_substitute_eval {ι : Type*} (P : MvPolynomial ι ℚ) (p : ι → ParamPoly n) (x : Fin n → ℝ) (t : ℝ) : (MvPolynomial.eval₂ (C.comp MvPolynomial.C) p P).eval₂ (parameterEval x) t = MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun i => (p i).eval₂ (parameterEval x) t) P := by have h := MvPolynomial.eval₂_comp_left (Polynomial.eval₂RingHom (parameterEval x) t) (C.comp MvPolynomial.C) p P have hc : (Polynomial.eval₂RingHom (parameterEval x) t).comp (C.comp MvPolynomial.C) = algebraMap ℚ ℝ := by ext q simp [parameterEval] rw [hc] at h exact h
theorem universal_natpow_polynomial (i : Fin n) : ∃ P : ParamPoly n, ∀ (g : G) (m : ℕ), P.eval₂ (parameterEval (c.coord g)) (m:ℝ) = c.coord (g^m) i := by have aux : ∀ l : ℕ, ∀ hl : l<n, ∃ P : ParamPoly n, ∀ (g:G) (m:ℕ), P.eval₂ (parameterEval (c.coord g)) (m:ℝ) = c.coord (g^m) ⟨l,hl⟩ := by intro l induction l using Nat.strong_induction_on with | h l ih => intro hl choose p hp using (fun j : Fin l => ih j.val j.isLt (lt_trans j.isLt hl)) let x : (Fin l ⊕ Fin l) → ParamPoly n := Sum.elim p (fun j => C (MvPolynomial.X ⟨j.val,lt_trans j.isLt hl⟩)) let Q : ParamPoly n := C (MvPolynomial.X ⟨l,hl⟩) + MvPolynomial.eval₂ (C.comp MvPolynomial.C) x (c.correction ⟨l,hl⟩) obtain ⟨P,hP0,hP⟩ := Polynomial.exists_antidifference_algebra Q refine ⟨P,?_⟩ intro g m induction m with | zero => have he := congrArg (parameterEval (c.coord g)) hP0 simpa [Polynomial.eval₂_at_apply,← Polynomial.eval₂_at_apply, c.one_coord] using he | succ m hm => have he := congrArg (Polynomial.eval₂ (parameterEval (c.coord g)) (m:ℝ)) hP simp only [Polynomial.eval₂_sub,Polynomial.eval₂_comp,Polynomial.eval₂_add, Polynomial.eval₂_one,Polynomial.eval₂_X] at he have hx : (fun a => (x a).eval₂ (parameterEval (c.coord g)) (m:ℝ)) = Sum.elim (fun j => c.coord (g^m) ⟨j.val,lt_trans j.isLt hl⟩) (fun j => c.coord g ⟨j.val,lt_trans j.isLt hl⟩) := by funext j cases j with | inl j => exact hp j g m | inr j => simp [x,parameterEval] simp only [Q,Polynomial.eval₂_add,Polynomial.eval₂_C,universal_substitute_eval,hx] at he simp only [parameterEval_X] at he rw [pow_succ,c.mul_coord] rw [Nat.cast_succ,add_comm (m:ℝ) 1] linarith exact aux i.val i.isLt
def universalPowerPolynomial (i : Fin n) : ParamPoly n := (universal_natpow_polynomial c i).chooselemma universalPowerPolynomial_nat (g : G) (i : Fin n) (m : ℕ) : (universalPowerPolynomial c i).eval₂ (parameterEval (c.coord g)) (m:ℝ) = c.coord (g^m) i := (universal_natpow_polynomial c i).choose_spec g m
theorem powerPolynomial_eq_universal (g : G) (i : Fin n) : powerPolynomial c g i = (universalPowerPolynomial c i).map (parameterEval (c.coord g)) := by apply Polynomial.eq_of_eval_nat_eq intro m rw [powerPolynomial_nat,Polynomial.eval_map,universalPowerPolynomial_nat]
lemma realPower_coord_universal (g : G) (t : ℝ) (i : Fin n) : c.coord (realPower c g t) i = (universalPowerPolynomial c i).eval₂ (parameterEval (c.coord g)) t := by rw [realPower_coord,powerPolynomial_eq_universal,Polynomial.eval_map]
end RationalLattice
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.RationalLattice02import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionendend
sectionopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
lemma realPower_mem_of_coordinates (H : Subgroup G) (I : Set (Fin n)) (hH : ∀ g : G, g ∈ H ↔ ∀ i ∈ I, c.coord g i = 0) {g : G} (hg : g ∈ H) (t : ℝ) : realPower c g t ∈ H := by apply (hH _).mpr intro i hi rw [realPower_coord] have hp : powerPolynomial c g i = 0 := by apply Polynomial.eq_of_eval_nat_eq intro m rw [powerPolynomial_nat,Polynomial.eval_zero] exact (hH (g^m)).mp (H.pow_mem hg m) i hi simp [hp]
def characterPower (χ : G →* Multiplicative ℝ) (g : G) : ℝ →+ ℝ where toFun t := Multiplicative.toAdd (χ (realPower c g t)) map_zero' := by simp map_add' s t := by rw [realPower_add,map_mul]; rfl
lemma character_realPower (χ : G →* Multiplicative ℝ) (hχ : Continuous χ) (g : G) (t : ℝ) : Multiplicative.toAdd (χ (realPower c g t)) = t * Multiplicative.toAdd (χ g) := by have hc : Continuous (characterPower c χ g) := hχ.comp (realPower_continuous c g) have h := map_real_smul (characterPower c χ g) hc t 1 simpa [characterPower] using h
include c in
theorem character_kernel_pathConnected (χ : G →* Multiplicative ℝ) (hχ : Continuous χ) : IsPathConnected (χ.ker : Set G) := by refine ⟨1,χ.ker.one_mem,?_⟩ intro g hg let p : Path (1:G) g := { toFun := fun t => realPower c g t continuous_toFun := (realPower_continuous c g).comp continuous_subtype_val source' := by simp target' := by simp } refine ⟨p,?_⟩ intro t change χ (realPower c g t) = 1 apply Multiplicative.toAdd.injective rw [character_realPower c χ hχ] change χ g = 1 at hg simp [hg]
theorem character_kernel_inter_pathConnected (χ : G →* Multiplicative ℝ) (hχ : Continuous χ) (H : Subgroup G) (I : Set (Fin n)) (hH : ∀ g : G, g ∈ H ↔ ∀ i ∈ I, c.coord g i = 0) : IsPathConnected ((H ⊓ χ.ker : Subgroup G) : Set G) := by refine ⟨1,(H ⊓ χ.ker).one_mem,?_⟩ intro g hg let p : Path (1:G) g := { toFun := fun t => realPower c g t continuous_toFun := (realPower_continuous c g).comp continuous_subtype_val source' := by simp target' := by simp } refine ⟨p,?_⟩ intro t refine ⟨realPower_mem_of_coordinates c H I hH hg.1 t,?_⟩ change χ (realPower c g t) = 1 apply Multiplicative.toAdd.injective rw [character_realPower c χ hχ] have hg' : χ g = 1 := hg.2 simp [hg']
end RationalLatticeendend
sectionopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
lemma parameterEval_continuous (P : MvPolynomial (Fin n) ℚ) : Continuous (fun x : Fin n → ℝ => parameterEval x P) := by simpa only [parameterEval,MvPolynomial.coe_eval₂Hom,MvPolynomial.eval₂_eq_eval_map] using (MvPolynomial.continuous_eval (P.map (algebraMap ℚ ℝ)))
lemma paramPoly_continuous (P : ParamPoly n) : Continuous (fun v : (Fin n → ℝ) × ℝ => P.eval₂ (parameterEval v.1) v.2) := by induction P using Polynomial.induction_on' with | add p q hp hq => simpa only [Polynomial.eval₂_add,Pi.add_apply] using hp.fun_add hq | monomial i a => simpa only [Polynomial.eval₂_monomial,Pi.mul_apply,Pi.pow_apply,Function.comp_apply] using ((parameterEval_continuous a).comp continuous_fst).fun_mul (continuous_snd.fun_pow i)
theorem realPower_joint_continuous : Continuous (fun v : G × ℝ => realPower c v.1 v.2) := by have h (v : G × ℝ) : realPower c v.1 v.2 = c.coord.symm (fun i => (universalPowerPolynomial c i).eval₂ (parameterEval (c.coord v.1)) v.2) := by apply c.coord.injective funext i simp [realPower_coord_universal] simp_rw [h] apply c.coord.symm.continuous.comp apply continuous_pi intro i exact (paramPoly_continuous _).comp ((c.coord.continuous.comp continuous_fst).prodMk continuous_snd)
include c in
theorem contractible_of_realPower_closed (S : Set G) (h1 : (1:G) ∈ S) (hS : ∀ g ∈ S, ∀ t : ℝ, realPower c g t ∈ S) : ContractibleSpace S := by apply (contractible_iff_id_nullhomotopic S).mpr refine ⟨⟨1,h1⟩,⟨?_⟩⟩ refine { toFun := fun v => ⟨realPower c v.2.val (1-(v.1:ℝ)),hS _ v.2.property _⟩ continuous_toFun := ?_ map_zero_left := ?_ map_one_left := ?_ } · apply Continuous.subtype_mk exact (realPower_joint_continuous c).comp ((continuous_subtype_val.comp continuous_snd).prodMk (continuous_const.sub (continuous_subtype_val.comp continuous_fst))) · intro g apply Subtype.ext simp · intro g apply Subtype.ext simp
include c in theorem character_kernel_contractible (χ : G →* Multiplicative ℝ) (hχ : Continuous χ) : ContractibleSpace χ.ker := by apply contractible_of_realPower_closed c (χ.ker:Set G) χ.ker.one_mem intro g hg t change χ (realPower c g t) = 1 apply Multiplicative.toAdd.injective rw [character_realPower c χ hχ] change χ g = 1 at hg simp [hg]
theorem character_kernel_inter_contractible (χ : G →* Multiplicative ℝ) (hχ : Continuous χ) (H : Subgroup G) (I : Set (Fin n)) (hH : ∀ g : G, g ∈ H ↔ ∀ i ∈ I, c.coord g i = 0) : ContractibleSpace ↥(H ⊓ χ.ker) := by apply contractible_of_realPower_closed c ((H ⊓ χ.ker : Subgroup G):Set G) (H ⊓ χ.ker).one_mem intro g hg t refine ⟨realPower_mem_of_coordinates c H I hH hg.1 t,?_⟩ change χ (realPower c g t) = 1 apply Multiplicative.toAdd.injective rw [character_realPower c χ hχ] have hg' : χ g = 1 := hg.2 simp [hg']
end RationalLattice
namespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n) (H : Subgroup G) (I : Set (Fin n))variable (hH : ∀ g : G, g ∈ H ↔ ∀ i ∈ I, c.coord g i = 0)
def subgroupRealPower (g : H) (t : ℝ) : H := ⟨realPower c g t,realPower_mem_of_coordinates c H I hH g.property t⟩
lemma subgroupRealPower_continuous (g : H) : Continuous (subgroupRealPower c H I hH g) := (realPower_continuous c g).subtype_mk _
lemma subgroupRealPower_zero (g : H) : subgroupRealPower c H I hH g 0 = 1 := by apply Subtype.ext exact realPower_zero c glemma subgroupRealPower_one (g : H) : subgroupRealPower c H I hH g 1 = g := by apply Subtype.ext exact realPower_one c glemma subgroupRealPower_add (g : H) (s t : ℝ) : subgroupRealPower c H I hH g (s+t) = subgroupRealPower c H I hH g s * subgroupRealPower c H I hH g t := by apply Subtype.ext exact realPower_add c g s t
def subgroupCharacterPower (χ : H →* Multiplicative ℝ) (g : H) : ℝ →+ ℝ where toFun t := Multiplicative.toAdd (χ (subgroupRealPower c H I hH g t)) map_zero' := by rw [subgroupRealPower_zero,map_one]; rfl map_add' s t := by rw [subgroupRealPower_add,map_mul]; rfl
lemma character_subgroupRealPower (χ : H →* Multiplicative ℝ) (hχ : Continuous χ) (g : H) (t : ℝ) : Multiplicative.toAdd (χ (subgroupRealPower c H I hH g t)) = t * Multiplicative.toAdd (χ g) := by have hc : Continuous (subgroupCharacterPower c H I hH χ g) := hχ.comp (subgroupRealPower_continuous c H I hH g) have he := map_real_smul (subgroupCharacterPower c H I hH χ g) hc t 1 simpa [subgroupCharacterPower,subgroupRealPower_one] using he
include hH inlemma realPower_mem_mapped_kernel (χ : H →* Multiplicative ℝ) (hχ : Continuous χ) {g : G} (hg : g ∈ χ.ker.map H.subtype) (t : ℝ) : realPower c g t ∈ χ.ker.map H.subtype := by obtain ⟨u,hu,rfl⟩ := hg refine ⟨subgroupRealPower c H I hH u t,?_,rfl⟩ change χ (subgroupRealPower c H I hH u t) = 1 apply Multiplicative.toAdd.injective rw [character_subgroupRealPower c H I hH χ hχ] change χ u = 1 at hu simp [hu]
include hH in
theorem lower_kernel_inter_contractible (χ : H →* Multiplicative ℝ) (hχ : Continuous χ) (K : Subgroup G) (J : Set (Fin n)) (hK : ∀ g : G, g ∈ K ↔ ∀ i ∈ J, c.coord g i = 0) : ContractibleSpace ↥(K ⊓ χ.ker.map H.subtype) := by apply contractible_of_realPower_closed c ((K ⊓ χ.ker.map H.subtype : Subgroup G):Set G) (K ⊓ χ.ker.map H.subtype).one_mem intro g hg t exact ⟨realPower_mem_of_coordinates c K J hK hg.1 t, realPower_mem_mapped_kernel c H I hH χ hχ hg.2 t⟩
end RationalLatticeendend
sectionopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionnamespace TriangularDenominatorsvariable {G : Type*} [Group G] {n : ℕ}lemma substitute_eval {ι : Type*} (P : MvPolynomial ι ℚ) (p : ι → ℚ[X]) (t : ℚ) : (MvPolynomial.eval₂ C p P).eval t = MvPolynomial.eval (fun i => (p i).eval t) P := by have h := MvPolynomial.eval₂_comp_left (Polynomial.evalRingHom t) C p P have hc : (Polynomial.evalRingHom t).comp C = RingHom.id ℚ := by ext; simp rw [hc] at h exact h
theorem natpow_polynomial (c : Coordinates G n) (g : G) (i : Fin n) : ∃ p : ℚ[X], ∀ m : ℕ, p.eval (m:ℚ) = c.coord (g^m) i := by have aux : ∀ l : ℕ, ∀ hl : l<n, ∃ p : ℚ[X], ∀ m : ℕ, p.eval (m:ℚ) = c.coord (g^m) ⟨l,hl⟩ := by intro l induction l using Nat.strong_induction_on with | h l ih => intro hl choose p hp using (fun j : Fin l => ih j.val j.isLt (lt_trans j.isLt hl)) let x : (Fin l ⊕ Fin l) → ℚ[X] := Sum.elim p (fun j => C (c.coord g ⟨j.val,lt_trans j.isLt hl⟩)) let Q : ℚ[X] := C (c.coord g ⟨l,hl⟩) + MvPolynomial.eval₂ C x (c.correction ⟨l,hl⟩) obtain ⟨P,hP0,hP⟩ := Polynomial.exists_antidifference Q refine ⟨P,?_⟩ intro m induction m with | zero => simpa [c.one_coord] using hP0 | succ m hm => have he := congrArg (Polynomial.eval (m : ℚ)) hP simp only [Polynomial.eval_sub,Polynomial.eval_comp,Polynomial.eval_add, Polynomial.eval_one,Polynomial.eval_X] at he have hx : (fun a => (x a).eval (m : ℚ)) = Sum.elim (fun j => c.coord (g^m) ⟨j.val,lt_trans j.isLt hl⟩) (fun j => c.coord g ⟨j.val,lt_trans j.isLt hl⟩) := by funext j cases j with | inl j => exact hp j m | inr j => simp [x] simp only [Q,Polynomial.eval_add,Polynomial.eval_C,substitute_eval,hx] at he rw [pow_succ,c.mul_coord] rw [Nat.cast_succ,add_comm (m:ℚ) 1] linarith exact aux i.val i.isLtend TriangularDenominators
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.RationalLattice03import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
theorem powerPolynomial_rational {g : G} (hg : IsRational c g) (i : Fin n) : ∃ p : ℚ[X], powerPolynomial c g i = p.map (algebraMap ℚ ℝ) := by let h : rationalSubgroup c := ⟨g,hg⟩ obtain ⟨p,hp⟩ := TriangularDenominators.natpow_polynomial (rationalCoordinates c) h i refine ⟨p,Polynomial.eq_of_eval_nat_eq ?_⟩ intro m rw [powerPolynomial_nat] have he := congrArg (fun q : ℚ => (q:ℝ)) (hp m) change ((p.eval (m:ℚ) : ℚ) : ℝ) = (qcoord c (h^m) i : ℝ) at he rw [qcoord_spec] at he change ((p.eval (m:ℚ) : ℚ) : ℝ) = c.coord (g^m) i at he rw [← he] simpa using (Polynomial.eval_map_apply (p:=p) (algebraMap ℚ ℝ) (m:ℚ)).symm
theorem realPower_rational {g : G} (hg : IsRational c g) (t : ℚ) : IsRational c (realPower c g t) := by intro i obtain ⟨p,hp⟩ := powerPolynomial_rational c hg i refine ⟨p.eval t,?_⟩ rw [realPower_coord,hp] exact (Polynomial.eval_map_apply (p:=p) (algebraMap ℚ ℝ) t).symm
end RationalLatticeendend
sectionopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
lemma coord_mul_of_left_zero (g h : G) (i : Fin n) (hg : ∀ j : Fin n, j < i → c.coord g j = 0) : c.coord (g*h) i = c.coord g i + c.coord h i := by have he : (Sum.elim (fun j : Fin i.val => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j : Fin i.val => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) = (Sum.elim (fun j : Fin i.val => c.coord 1 ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j : Fin i.val => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) := by funext a cases a with | inl j => simp only [Sum.elim_inl]; rw [hg _ j.isLt,c.one_coord] | inr j => rfl have hm := c.mul_coord 1 h i rw [one_mul,c.one_coord,zero_add] at hm rw [c.mul_coord,he] linarith
lemma coord_mul_of_right_zero (g h : G) (i : Fin n) (hh : ∀ j : Fin n, j < i → c.coord h j = 0) : c.coord (g*h) i = c.coord g i + c.coord h i := by have he : (Sum.elim (fun j : Fin i.val => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j : Fin i.val => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) = (Sum.elim (fun j : Fin i.val => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j : Fin i.val => c.coord 1 ⟨j.val,lt_trans j.isLt i.isLt⟩)) := by funext a cases a with | inl j => rfl | inr j => simp only [Sum.elim_inr]; rw [hh _ j.isLt,c.one_coord] have hm := c.mul_coord g 1 i rw [mul_one,c.one_coord,add_zero] at hm rw [c.mul_coord,he] linarith
lemma realPower_coord_of_lower_zero (g : G) (i : Fin n) (hg : ∀ j : Fin n, j < i → c.coord g j = 0) (t : ℝ) : c.coord (realPower c g t) i = t * c.coord g i := by have hp : powerPolynomial c g i = X * C (c.coord g i) := by apply Polynomial.eq_of_eval_nat_eq intro m rw [powerPolynomial_nat] simp only [Polynomial.eval_mul,Polynomial.eval_X,Polynomial.eval_C] induction m with | zero => simp [c.one_coord] | succ m ih => rw [pow_succ,coord_mul_of_right_zero c _ _ i hg,ih]; push_cast; ring rw [realPower_coord,hp] simp only [Polynomial.eval_mul,Polynomial.eval_X,Polynomial.eval_C]
def basisElement (i : Fin n) : G := c.coord.symm (Pi.single i 1)def basisFlow (i : Fin n) (t : ℝ) : G := realPower c (basisElement c i) t
lemma basisFlow_continuous (i : Fin n) : Continuous (basisFlow c i) := realPower_continuous c _@[simp] lemma basisFlow_zero (i : Fin n) : basisFlow c i 0 = 1 := realPower_zero c _lemma basisFlow_add (i : Fin n) (s t : ℝ) : basisFlow c i (s+t) = basisFlow c i s * basisFlow c i t := realPower_add c _ _ _lemma basisFlow_neg (i : Fin n) (t : ℝ) : basisFlow c i (-t) = (basisFlow c i t)⁻¹ := realPower_neg c _ _
lemma basisFlow_coord (i j : Fin n) (hji : j ≤ i) (t : ℝ) : c.coord (basisFlow c i t) j = if j=i then t else 0 := by classical have hzero (k : Fin n) (hk : k < j) : c.coord (basisElement c i) k = 0 := by have hki : k ≠ i := ne_of_lt (lt_of_lt_of_le hk hji) simp [basisElement,hki] change c.coord (realPower c (basisElement c i) t) j = _ rw [realPower_coord_of_lower_zero c _ j hzero] simp only [basisElement,Homeomorph.apply_symm_apply,Pi.single_apply] split_ifs <;> simp_all
def peel (g : G) : ℕ → G | 0 => g | k+1 => if h : k<n then basisFlow c ⟨k,h⟩ (-c.coord (peel g k) ⟨k,h⟩) * peel g k else peel g k
lemma peel_continuous [IsTopologicalGroup G] (k : ℕ) : Continuous (fun g => peel c g k) := by induction k with | zero => exact continuous_id | succ k ih => simp only [peel] split_ifs with h · exact ((basisFlow_continuous c _).comp ((continuous_apply _).comp (c.coord.continuous.comp ih)).neg).mul ih · exact ih
lemma peel_zero_coordinates (g : G) (k : ℕ) : ∀ i : Fin n, i.val < k → c.coord (peel c g k) i = 0 := by induction k with | zero => intro i hi; omega | succ k ih => intro i hi by_cases hk : k<n · rw [peel,dite_eq_left hk] rw [coord_mul_of_left_zero c _ _ i (by intro j hj rw [basisFlow_coord c _ j (show j.val ≤ k from by change j.val < i.val at hj; omega)] simp [show j ≠ (⟨k,hk⟩:Fin n) from fun h => by have := congrArg Fin.val h; change j.val < i.val at hj; dsimp at this; omega])] by_cases hik : i.val < k · rw [ih i hik,basisFlow_coord c _ i (show i.val ≤ k from by omega)] simp [show i ≠ (⟨k,hk⟩:Fin n) from fun h => by have := congrArg Fin.val h; dsimp at this; omega] · have he : i = (⟨k,hk⟩:Fin n) := Fin.ext (show i.val = k from by omega) subst i rw [basisFlow_coord c _ _ le_rfl] simp · rw [peel,dite_eq_right hk] exact ih i (by omega)
lemma peel_dimension (g : G) : peel c g n = 1 := by apply c.coord.injective funext i rw [peel_zero_coordinates c g n i i.isLt,c.one_coord]
def expCoordinates (g : G) (i : Fin n) : ℝ := c.coord (peel c g i.val) i
def tailProduct (x : Fin n → ℝ) (k : ℕ) : G := ((List.ofFn (fun i => basisFlow c i (x i))).drop k).prod
def expProduct (x : Fin n → ℝ) : G := tailProduct c x 0
lemma tailProduct_dimension (x : Fin n → ℝ) : tailProduct c x n = 1 := by have h := List.drop_length (l := List.ofFn (fun i => basisFlow c i (x i))) simp only [List.length_ofFn] at h simp only [tailProduct,h,List.prod_nil]
lemma tailProduct_step (x : Fin n → ℝ) (k : ℕ) (hk : k<n) : tailProduct c x k = basisFlow c ⟨k,hk⟩ (x ⟨k,hk⟩) * tailProduct c x (k+1) := by unfold tailProduct rw [List.drop_eq_getElem_cons (by simpa using hk),List.prod_cons,List.getElem_ofFn]
lemma tailProduct_lower (x : Fin n → ℝ) (k : ℕ) (hk : k ≤ n) : ∀ i : Fin n, i.val < k → c.coord (tailProduct c x k) i = 0 := by induction hk using Nat.decreasingInduction with | self => intro i hi; rw [tailProduct_dimension,c.one_coord] | of_succ k hk ih => intro i hi rw [tailProduct_step c x k hk,coord_mul_of_left_zero c _ _ i (by intro j hj rw [basisFlow_coord c _ j (show j.val ≤ k from by change j.val < i.val at hj; omega)] rw [ite_eq_right (fun h => by have := congrArg Fin.val h; change j.val < i.val at hj; dsimp at this; omega)])] rw [basisFlow_coord c _ i (show i.val ≤ k from by omega),ih i (by omega)] rw [ite_eq_right (fun h => by have := congrArg Fin.val h; dsimp at this; omega),zero_add]
lemma tailProduct_coord (x : Fin n → ℝ) (i : Fin n) : c.coord (tailProduct c x i.val) i = x i := by rw [tailProduct_step c x i.val i.isLt,coord_mul_of_left_zero c _ _ i (by intro j hj rw [basisFlow_coord c i j (le_of_lt hj),ite_eq_right (ne_of_lt hj)])] rw [basisFlow_coord c i i le_rfl,ite_eq_left rfl, tailProduct_lower c x (i.val+1) i.isLt i (Nat.lt_succ_self _),add_zero]
lemma peel_expProduct (x : Fin n → ℝ) (k : ℕ) (hk : k ≤ n) : peel c (expProduct c x) k = tailProduct c x k := by induction k with | zero => rfl | succ k ih => have hkn : k<n := by omega rw [peel,dite_eq_left hkn,ih (by omega)] rw [tailProduct_coord c x ⟨k,hkn⟩,tailProduct_step c x k hkn,basisFlow_neg] exact inv_mul_cancel_left _ _
lemma expCoordinates_expProduct (x : Fin n → ℝ) : expCoordinates c (expProduct c x) = x := by funext i rw [expCoordinates,peel_expProduct c x i.val (Nat.le_of_lt i.isLt),tailProduct_coord]
lemma tailProduct_expCoordinates (g : G) (k : ℕ) (hk : k ≤ n) : tailProduct c (expCoordinates c g) k = peel c g k := by induction hk using Nat.decreasingInduction with | self => rw [tailProduct_dimension,peel_dimension] | of_succ k hk ih => rw [tailProduct_step c _ k hk,ih,expCoordinates,peel,dite_eq_left hk,basisFlow_neg] exact mul_inv_cancel_left _ _
lemma expProduct_expCoordinates (g : G) : expProduct c (expCoordinates c g) = g := by simpa only [expProduct,peel] using tailProduct_expCoordinates c g 0 (Nat.zero_le n)
lemma expCoordinates_continuous [IsTopologicalGroup G] : Continuous (expCoordinates c) := by apply continuous_pi intro i exact (continuous_apply i).comp (c.coord.continuous.comp (peel_continuous c i.val))
lemma expProduct_continuous [IsTopologicalGroup G] : Continuous (expProduct c) := by change Continuous (fun x : Fin n → ℝ => (List.ofFn (fun i => basisFlow c i (x i))).prod) simp only [List.ofFn_eq_map] exact continuous_list_prod _ (fun i _ => (basisFlow_continuous c i).comp (continuous_apply i))
def secondKindHomeomorph [IsTopologicalGroup G] : G ��ₜ (Fin n → ℝ) where toFun := expCoordinates c invFun := expProduct c left_inv := expProduct_expCoordinates c right_inv := expCoordinates_expProduct c continuous_toFun := expCoordinates_continuous c continuous_invFun := expProduct_continuous c
end RationalLatticeendend
sectionnoncomputable sectionnamespace MalcevPrefixQuotientopen RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n r : ℕ}variable (c : RealCoordinates G n) (hr : r ≤ n)
include hr in
lemma prefix_eq_iff (g h : G) : (∀ i : Fin n, i.val < r → c.coord g i = c.coord h i) ↔ (∀ i : Fin n, i.val < r → c.coord (g⁻¹*h) i = 0) := by constructor · intro he i hi have haux : ∀ m : ℕ, ∀ hm : m < r, c.coord (g⁻¹*h) ⟨m,lt_of_lt_of_le hm hr⟩ = 0 := by intro m induction m using Nat.strong_induction_on with | h m ih => intro hm let j : Fin n := ⟨m,lt_of_lt_of_le hm hr⟩ have hd : ∀ u : Fin n, u < j → c.coord (g⁻¹*h) u = 0 := by intro u hu exact ih u.val hu (lt_trans hu hm) have hc := coord_mul_of_right_zero c g (g⁻¹*h) j hd rw [mul_inv_cancel_left] at hc have he' := he j hm linarith exact haux i.val hi · intro hd i hi have hc := coord_mul_of_right_zero c g (g⁻¹*h) i (fun u hu => hd u (lt_trans hu hi)) rw [mul_inv_cancel_left,hd i hi,add_zero] at hc exact hc.symm
variable (N : Subgroup G)variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin n, i.val < r → c.coord g i = 0)include hr hN inlemma eq_coset_iff (g h : G) : (QuotientGroup.mk g : G ⧸ N) = QuotientGroup.mk h ↔ ∀ i : Fin n, i.val < r → c.coord g i = c.coord h i := by rw [QuotientGroup.eq,hN] exact (prefix_eq_iff c hr g h).symm
def embed (i : Fin r) : Fin n := ⟨i.val,lt_of_lt_of_le i.isLt hr⟩def lift (x : Fin r → ℝ) (i : Fin n) : ℝ := if h : i.val < r then x ⟨i.val,h⟩ else 0@[simp] lemma lift_embed (x : Fin r → ℝ) (i : Fin r) : lift x (embed hr i) = x i := by simp [lift,embed,i.isLt]lemma lift_continuous : Continuous (lift (n:=n) (r:=r)) := by apply continuous_pi intro i unfold lift split_ifs · exact continuous_apply _ · exact continuous_const
def coordinates (x : G ⧸ N) (i : Fin r) : ℝ := Quotient.lift (fun g : G => c.coord g (embed hr i)) (by intro g h he exact ((prefix_eq_iff c hr g h).mpr ((hN _).mp (QuotientGroup.leftRel_apply.mp he))) (embed hr i) i.isLt) x
@[simp] lemma coordinates_mk (g : G) (i : Fin r) : coordinates c hr N hN (QuotientGroup.mk g) i = c.coord g (embed hr i) := rfl
def represent (x : Fin r → ℝ) : G := c.coord.symm (lift x)def rebuild (x : Fin r → ℝ) : G ⧸ N := QuotientGroup.mk (represent c x)
lemma coordinates_rebuild (x : Fin r → ℝ) : coordinates c hr N hN (rebuild c N x) = x := by funext i simp [rebuild,represent,coordinates_mk]lemma rebuild_coordinates (x : G ⧸ N) : rebuild c N (coordinates c hr N hN x) = x := by induction x using Quotient.inductionOn with | h g => apply (eq_coset_iff c hr N hN _ _).mpr intro i hi simp [represent,lift,hi,embed]lemma coordinates_continuous : Continuous (coordinates c hr N hN) := by rw [(QuotientGroup.isQuotientMap_mk N).continuous_iff] apply continuous_pi intro i change Continuous (fun g : G => c.coord g (embed hr i)) exact (continuous_apply (embed hr i)).comp c.coord.continuouslemma rebuild_continuous : Continuous (rebuild c (r:=r) N) := QuotientGroup.continuous_mk.comp (c.coord.symm.continuous.comp lift_continuous)
def homeomorph : (G ⧸ N) ≃ₜ (Fin r → ℝ) where toFun := coordinates c hr N hN invFun := rebuild c N left_inv := rebuild_coordinates c hr N hN right_inv := coordinates_rebuild c hr N hN continuous_toFun := coordinates_continuous c hr N hN continuous_invFun := rebuild_continuous c N
variable [N.Normal]
def quotientChart : RealCoordinates (G ⧸ N) r where coord := homeomorph c hr N hN one_coord i := c.one_coord _ correction i := c.correction (embed hr i) mul_coord g h i := by induction g using Quotient.inductionOn with | h g => induction h using Quotient.inductionOn with | h h => exact c.mul_coord g h (embed hr i)
end MalcevPrefixQuotient
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.PairTail01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionnamespace RationalLatticeopen RationalPolynomialMapvariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n) {σ : Type*}
def IsPolynomialMap (f : (σ → ℝ) → G) : Prop := ∀ i, RationalPolynomialMap.IsPolynomial (fun x => c.coord (f x) i)
lemma polynomialMap_const {g : G} (hg : IsRational c g) : IsPolynomialMap c (fun _ : σ → ℝ => g) := by intro i obtain ⟨q,hq⟩ := hg i simpa only [← hq] using RationalPolynomialMap.const (σ:=σ) q
lemma polynomialMap_one : IsPolynomialMap c (fun _ : σ → ℝ => (1:G)) := polynomialMap_const c (rational_one c)
lemma polynomialMap_mul {f g : (σ → ℝ) → G} (hf : IsPolynomialMap c f) (hg : IsPolynomialMap c g) : IsPolynomialMap c (fun x => f x*g x) := by intro i have hc : IsPolynomial (fun x => MvPolynomial.eval₂ (algebraMap ℚ ℝ) (Sum.elim (fun j : Fin i.val => c.coord (f x) ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j : Fin i.val => c.coord (g x) ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i)) := by apply RationalPolynomialMap.eval intro j cases j with | inl j => exact hf _ | inr j => exact hg _ simpa only [c.mul_coord] using RationalPolynomialMap.add (RationalPolynomialMap.add (hf i) (hg i)) hc
lemma polynomialMap_basisFlow (i : Fin n) {f : (σ → ℝ) → ℝ} (hf : IsPolynomial f) : IsPolynomialMap c (fun x => basisFlow c i (f x)) := by intro j obtain ⟨p,hp⟩ := powerPolynomial_rational c (g := basisElement c i) (by intro k classical refine ⟨if k=i then 1 else 0,?_⟩ simp only [basisElement,Homeomorph.apply_symm_apply,Pi.single_apply] split_ifs <;> simp) j change IsPolynomial (fun x => c.coord (realPower c (basisElement c i) (f x)) j) simpa only [realPower_coord,hp,Polynomial.eval_map] using polynomial_eval p hf
lemma polynomialMap_peel {f : (σ → ℝ) → G} (hf : IsPolynomialMap c f) (k : ℕ) : IsPolynomialMap c (fun x => peel c (f x) k) := by induction k with | zero => exact hf | succ k ih => simp only [peel] split_ifs with hk · exact polynomialMap_mul c (polynomialMap_basisFlow c ⟨k,hk⟩ (RationalPolynomialMap.neg (ih _))) ih · exact ih
lemma polynomial_expCoordinates {f : (σ → ℝ) → G} (hf : IsPolynomialMap c f) (i : Fin n) : IsPolynomial (fun x => expCoordinates c (f x) i) := polynomialMap_peel c hf i.val i
lemma polynomialMap_expProduct {f : (σ → ℝ) → (Fin n → ℝ)} (hf : ∀ i, IsPolynomial (fun x => f x i)) : IsPolynomialMap c (fun x => expProduct c (f x)) := by change IsPolynomialMap c (fun x => (List.ofFn (fun i => basisFlow c i (f x i))).prod) simp only [List.ofFn_eq_map] generalize List.finRange n = l induction l with | nil => exact polynomialMap_one c | cons i l ih => simp only [List.map_cons,List.prod_cons] exact polynomialMap_mul c (polynomialMap_basisFlow c i (hf i)) ih
end RationalLatticeendend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace MalcevCharactersopen RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n : ℕ} (c : RealCoordinates G n)
omit [IsTopologicalGroup G] in@[simp] lemma coord_axis (i : Fin n) (t : ℝ) : c.coord (axis c i t) = Pi.single i t := c.coord.apply_symm_apply _
omit [IsTopologicalGroup G] in@[simp] lemma axis_zero (i : Fin n) : axis c i 0 = 1 := by apply c.coord.injective ext j simp [c.one_coord]
omit [IsTopologicalGroup G] inlemma axis_continuous (i : Fin n) : Continuous (axis c i) := by apply c.coord.symm.continuous.comp exact continuous_pi (fun j => by by_cases h : j = i · subst j change Continuous (fun t : ℝ => (Pi.single i t : Fin n → ℝ) i) simp only [Pi.single_eq_same] exact continuous_id · simpa [Pi.single_apply,h] using (continuous_const : Continuous (fun _ : ℝ => (0 : ℝ))))
variable (hsk : SecondKind c) (χ : G →* Multiplicative ℝ)include hsk
def axisCharacter (i : Fin n) : ℝ →+ ℝ where toFun t := Multiplicative.toAdd (χ (axis c i t)) map_zero' := by simp map_add' s t := by change Multiplicative.toAdd (χ (axis c i (s+t))) = _ rw [hsk.axis_add, map_mul] rfl
omit [IsTopologicalGroup G] inlemma axisCharacter_continuous (hχ : Continuous χ) (i : Fin n) : Continuous (axisCharacter c hsk χ i) := hχ.comp (axis_continuous c i)
omit [IsTopologicalGroup G] inlemma character_axis (hχ : Continuous χ) (i : Fin n) (t : ℝ) : Multiplicative.toAdd (χ (axis c i t)) = t * Multiplicative.toAdd (χ (axis c i 1)) := by change axisCharacter c hsk χ i t = t * axisCharacter c hsk χ i 1 have h := map_real_smul (axisCharacter c hsk χ i) (axisCharacter_continuous c hsk χ hχ i) t 1 simpa using h
omit [IsTopologicalGroup G] intheorem character_coordinates (hχ : Continuous χ) (g : G) : Multiplicative.toAdd (χ g) = ∑ i, c.coord g i * Multiplicative.toAdd (χ (axis c i 1)) := by conv_lhs => rw [hsk.ordered g] rw [map_list_prod, List.map_ofFn] change Multiplicative.toAdd ((List.ofFn fun i => χ (axis c i (c.coord g i))).prod) = _ simp only [toAdd_list_sum, List.map_ofFn, List.sum_ofFn] apply Finset.sum_congr rfl intro i _ exact character_axis c hsk χ hχ i _
variable (Γ : Subgroup G)variable (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z)
omit hsk [IsTopologicalGroup G] ininclude hΓ inlemma axis_one_mem (i : Fin n) : axis c i 1 ∈ Γ := by classical apply (hΓ _).mpr intro j by_cases h : j = i · subst j exact ⟨1,by simp⟩ · exact ⟨0,by simp [h]⟩
include hΓ in omit [IsTopologicalGroup G] intheorem integer_character_coordinates (hχ : Continuous χ) (hz : ∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (χ g) = z) : ∃ k : Fin n → ℤ, ∀ g : G, Multiplicative.toAdd (χ g) = ∑ i, c.coord g i * (k i : ℝ) := by choose k hk using (fun i => hz _ (axis_one_mem c Γ hΓ i)) refine ⟨k,fun g => ?_⟩ rw [character_coordinates c hsk χ hχ g] simp_rw [hk]
def coordinateForm (a : Fin n → ℝ) : (Fin n → ℝ) →ₗ[ℝ] ℝ where toFun x := ∑ i, x i * a i map_add' x y := by simp [add_mul,Finset.sum_add_distrib] map_smul' r x := by simp [Finset.mul_sum,mul_assoc]
omit [IsTopologicalGroup G] inlemma kernel_eq_image (hχ : Continuous χ) : (χ.ker : Set G) = c.coord.symm '' ((coordinateForm (fun i => Multiplicative.toAdd (χ (axis c i 1)))).ker : Set (Fin n → ℝ)) := by ext g constructor · intro hg refine ⟨c.coord g,?_,c.coord.symm_apply_apply g⟩ change (∑ i, c.coord g i * Multiplicative.toAdd (χ (axis c i 1))) = 0 rw [← character_coordinates c hsk χ hχ g] change χ g = 1 at hg rw [hg] rfl · rintro ⟨x,hx,rfl⟩ change χ (c.coord.symm x) = 1 apply Multiplicative.toAdd.injective rw [character_coordinates c hsk χ hχ] simpa [coordinateForm] using hx
omit [IsTopologicalGroup G] intheorem kernel_connected (hχ : Continuous χ) : IsConnected (χ.ker : Set G) := by rw [kernel_eq_image c hsk χ hχ] exact ((coordinateForm (fun i => Multiplicative.toAdd (χ (axis c i 1)))).ker.convex.isConnected ⟨0,by simp⟩).image _ c.coord.symm.continuous.continuousOn
end MalcevCharactersendend
sectionopen _root_.Polynomial _root_.OAI.Polynomialnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
def prefixProduct (x : Fin n → ℝ) (k : ℕ) : G := ((List.ofFn (fun i => basisFlow c i (x i))).take k).prod
lemma prefix_mul_tail (x : Fin n → ℝ) (k : ℕ) : prefixProduct c x k * tailProduct c x k = expProduct c x := List.prod_take_mul_prod_drop _ _
lemma expProduct_coord (x : Fin n → ℝ) (i : Fin n) : c.coord (expProduct c x) i = c.coord (prefixProduct c x i.val) i + x i := by rw [← prefix_mul_tail c x i.val] rw [coord_mul_of_right_zero c _ _ i (fun j hj => tailProduct_lower c x i.val (Nat.le_of_lt i.isLt) j hj),tailProduct_coord]
lemma prefixProduct_eq (x y : Fin n → ℝ) (k : ℕ) (h : ∀ i : Fin n, i.val < k → x i = y i) : prefixProduct c x k = prefixProduct c y k := by apply congrArg List.prod apply List.ext_getElem · simp only [List.length_take,List.length_ofFn] · intro i h1 h2 simp only [List.getElem_take,List.getElem_ofFn] congr 1 apply h simp only [List.length_take,List.length_ofFn] at h1 exact lt_of_lt_of_le h1 (min_le_left _ _)
lemma expProduct_coord_sub (x y : Fin n → ℝ) (i : Fin n) (h : ∀ j : Fin n, j < i → x j = y j) : c.coord (expProduct c x) i - c.coord (expProduct c y) i = x i-y i := by rw [expProduct_coord,expProduct_coord,prefixProduct_eq c x y i.val h] ring
lemma expProduct_coord_eq (x y : Fin n → ℝ) (i : Fin n) (h : ∀ j : Fin n, j ≤ i → x j = y j) : c.coord (expProduct c x) i = c.coord (expProduct c y) i := by have he := expProduct_coord_sub c x y i (fun j hj => h j (le_of_lt hj)) rw [h i le_rfl,sub_self] at he linarith
lemma expCoordinates_prefix_eq (g h : G) (i : Fin n) (he : ∀ j : Fin n, j ≤ i → c.coord g j = c.coord h j) : expCoordinates c g i = expCoordinates c h i := by have aux : ∀ k : ℕ, ∀ hk : k<n, (∀ j : Fin n, j.val ≤ k → c.coord g j = c.coord h j) → expCoordinates c g ⟨k,hk⟩ = expCoordinates c h ⟨k,hk⟩ := by intro k induction k using Nat.strong_induction_on with | h k ih => intro hk he have hl : ∀ j : Fin n, j < (⟨k,hk⟩:Fin n) → expCoordinates c g j = expCoordinates c h j := by intro j hj apply ih j.val hj j.isLt intro a ha exact he a (by change j.val < k at hj; omega) have hs := expProduct_coord_sub c (expCoordinates c g) (expCoordinates c h) ⟨k,hk⟩ hl rw [expProduct_expCoordinates,expProduct_expCoordinates,he _ le_rfl,sub_self] at hs linarith exact aux i.val i.isLt he
lemma expCoordinates_coord_sub (g h : G) (i : Fin n) (he : ∀ j : Fin n, j < i → c.coord g j = c.coord h j) : expCoordinates c g i - expCoordinates c h i = c.coord g i - c.coord h i := by have hl : ∀ j : Fin n, j < i → expCoordinates c g j = expCoordinates c h j := by intro j hj exact expCoordinates_prefix_eq c g h j (fun a ha => he a (lt_of_le_of_lt ha hj)) have hs := expProduct_coord_sub c (expCoordinates c g) (expCoordinates c h) i hl rw [expProduct_expCoordinates,expProduct_expCoordinates] at hs exact hs.symm
def lowerExtend (i : Fin n) (x : Fin i.val → ℝ) (j : Fin n) : ℝ := if h : j.val< i.val then x ⟨j.val,h⟩ else 0
lemma expCoordinates_mul_difference (x y : Fin n → ℝ) (i : Fin n) : expCoordinates c (expProduct c x * expProduct c y) i = x i + y i + expCoordinates c (expProduct c (lowerExtend i (fun j => x ⟨j.val,lt_trans j.isLt i.isLt⟩)) * expProduct c (lowerExtend i (fun j => y ⟨j.val,lt_trans j.isLt i.isLt⟩))) i := by let x0 := lowerExtend i (fun j => x ⟨j.val,lt_trans j.isLt i.isLt⟩) let y0 := lowerExtend i (fun j => y ⟨j.val,lt_trans j.isLt i.isLt⟩) have hx : ∀ j : Fin n, j< i → x j = x0 j := by intro j hj; simp [x0,lowerExtend,hj] have hy : ∀ j : Fin n, j< i → y j = y0 j := by intro j hj; simp [y0,lowerExtend,hj] have cx : ∀ j : Fin n, j< i → c.coord (expProduct c x) j = c.coord (expProduct c x0) j := by intro j hj exact expProduct_coord_eq c x x0 j (fun a ha => hx a (lt_of_le_of_lt ha hj)) have cy : ∀ j : Fin n, j< i → c.coord (expProduct c y) j = c.coord (expProduct c y0) j := by intro j hj exact expProduct_coord_eq c y y0 j (fun a ha => hy a (lt_of_le_of_lt ha hj)) have cm : ∀ j : Fin n, j< i → c.coord (expProduct c x * expProduct c y) j = c.coord (expProduct c x0 * expProduct c y0) j := by intro j hj rw [c.mul_coord,c.mul_coord,cx j hj,cy j hj] congr 2 funext a cases a with | inl a => exact cx _ (lt_trans a.isLt hj) | inr a => exact cy _ (lt_trans a.isLt hj) have hcorr : MvPolynomial.eval₂ (algebraMap ℚ ℝ) (Sum.elim (fun j : Fin i.val => c.coord (expProduct c x) ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j : Fin i.val => c.coord (expProduct c y) ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i) = MvPolynomial.eval₂ (algebraMap ℚ ℝ) (Sum.elim (fun j : Fin i.val => c.coord (expProduct c x0) ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j : Fin i.val => c.coord (expProduct c y0) ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i) := by congr 1 funext a cases a with | inl a => exact cx _ a.isLt | inr a => exact cy _ a.isLt have hs := expCoordinates_coord_sub c _ _ i cm rw [c.mul_coord,c.mul_coord,hcorr] at hs have hdx := expProduct_coord_sub c x x0 i hx have hdy := expProduct_coord_sub c y y0 i hy have hx0 : x0 i = 0 := by simp [x0,lowerExtend] have hy0 : y0 i = 0 := by simp [y0,lowerExtend] rw [hx0] at hdx rw [hy0] at hdy change expCoordinates c (expProduct c x * expProduct c y) i = x i+y i+ expCoordinates c (expProduct c x0 * expProduct c y0) i linarith
lemma exists_second_correction (i : Fin n) : ∃ P : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ, ∀ v : (Fin i.val ⊕ Fin i.val) → ℝ, expCoordinates c (expProduct c (lowerExtend i (fun j => v (Sum.inl j))) * expProduct c (lowerExtend i (fun j => v (Sum.inr j)))) i = MvPolynomial.eval₂ (algebraMap ℚ ℝ) v P := by apply polynomial_expCoordinates c apply polynomialMap_mul c <;> apply polynomialMap_expProduct c <;> intro j all_goals unfold lowerExtend split_ifs with hj · exact RationalPolynomialMap.coordinate _ · exact RationalPolynomialMap.zero
lemma expProduct_zero : expProduct c 0 = 1 := by change (List.ofFn (fun i => basisFlow c i 0)).prod = 1 apply List.prod_eq_one intro x hx obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hx exact basisFlow_zero c i
lemma expCoordinates_one : expCoordinates c 1 = 0 := by rw [← expProduct_zero c,expCoordinates_expProduct]
def secondCorrection (i : Fin n) : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ := (exists_second_correction c i).choose
lemma second_mul_coord (g h : G) (i : Fin n) : expCoordinates c (g*h) i = expCoordinates c g i + expCoordinates c h i + MvPolynomial.eval₂ (algebraMap ℚ ℝ) (Sum.elim (fun j => expCoordinates c g ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j => expCoordinates c h ⟨j.val,lt_trans j.isLt i.isLt⟩)) (secondCorrection c i) := by have hm := expCoordinates_mul_difference c (expCoordinates c g) (expCoordinates c h) i rw [expProduct_expCoordinates,expProduct_expCoordinates] at hm rw [hm] congr 1 exact (exists_second_correction c i).choose_spec (Sum.elim (fun j => expCoordinates c g ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j => expCoordinates c h ⟨j.val,lt_trans j.isLt i.isLt⟩))
def secondCoordinates [IsTopologicalGroup G] : RealCoordinates G n where coord := secondKindHomeomorph c one_coord i := congrFun (expCoordinates_one c) i correction := secondCorrection c mul_coord := second_mul_coord c
lemma expProduct_single (i : Fin n) (t : ℝ) : expProduct c (Pi.single i t) = basisFlow c i t := by classical change (List.ofFn (fun j => basisFlow c j ((Pi.single i t : Fin n → ℝ) j))).prod = _ rw [List.ofFn_eq_map,List.prod_map_eq_pow_single i] · simp · intro j hji hj simp [hji]
lemma second_axis [IsTopologicalGroup G] (i : Fin n) (t : ℝ) : MalcevCharacters.axis (secondCoordinates c) i t = basisFlow c i t := expProduct_single c i t
theorem secondCoordinates_secondKind [IsTopologicalGroup G] : MalcevCharacters.SecondKind (secondCoordinates c) where axis_add i s t := by simp only [second_axis]; exact basisFlow_add c i s t ordered g := by simp only [second_axis] exact (expProduct_expCoordinates c g).symm
lemma coordinates_prefix_zeros_iff (g : G) (k : ℕ) : (∀ i : Fin n, i.val < k → expCoordinates c g i = 0) ↔ (∀ i : Fin n, i.val < k → c.coord g i = 0) := by constructor · intro hg i hi have he := expProduct_coord_eq c (expCoordinates c g) 0 i (fun j hj => hg j (by change j.val ≤ i.val at hj; omega)) rw [expProduct_expCoordinates,expProduct_zero,c.one_coord] at he exact he · intro hg i hi have he := expCoordinates_prefix_eq c g 1 i (by intro j hj rw [c.one_coord] apply hg change j.val ≤ i.val at hj omega) rw [expCoordinates_one] at he exact he
theorem secondCoordinates_adapted [IsTopologicalGroup G] (H : Subgroup G) (k : ℕ) (hH : ∀ g : G, g ∈ H ↔ ∀ i : Fin n, i.val < k → c.coord g i = 0) (g : G) : g ∈ H ↔ ∀ i : Fin n, i.val < k → (secondCoordinates c).coord g i = 0 := by exact (hH g).trans (coordinates_prefix_zeros_iff c g k).symm
end RationalLattice
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.IntegerHyperplane01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionopen scoped BigOperatorsnoncomputable sectionendend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
lemma realPower_int (g : G) (z : ℤ) : realPower c g z = g^z := by cases z with | ofNat m => simpa using realPower_nat c g m | negSucc m => rw [Int.cast_negSucc,realPower_neg] simp only [realPower_nat,zpow_negSucc]
lemma basisElement_rational (i : Fin n) : IsRational c (basisElement c i) := by classical intro j refine ⟨if j=i then 1 else 0,?_⟩ simp only [basisElement,Homeomorph.apply_symm_apply,Pi.single_apply] split_ifs <;> simp
lemma basisFlow_rational (i : Fin n) (t : ℚ) : IsRational c (basisFlow c i t) := realPower_rational c (basisElement_rational c i) t
variable (Γ : Subgroup G)variable (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z)include hΓ
lemma basisElement_mem (i : Fin n) : basisElement c i ∈ Γ := by classical apply (hΓ _).mpr intro j refine ⟨if j=i then 1 else 0,?_⟩ simp only [basisElement,Homeomorph.apply_symm_apply,Pi.single_apply] split_ifs <;> simp
lemma basisFlow_int_mem (i : Fin n) (t : ℤ) : basisFlow c i t ∈ Γ := by change realPower c (basisElement c i) t ∈ Γ rw [realPower_int] exact Γ.zpow_mem (basisElement_mem c Γ hΓ i) _
lemma peel_mem_lattice {g : G} (hg : g ∈ Γ) (k : ℕ) : peel c g k ∈ Γ := by induction k with | zero => exact hg | succ k ih => simp only [peel] split_ifs with hk · obtain ⟨z,hz⟩ := (hΓ _).mp ih ⟨k,hk⟩ rw [hz,← Int.cast_neg] exact Γ.mul_mem (basisFlow_int_mem c Γ hΓ _ _) ih · exact ih
theorem expCoordinates_lattice (g : G) : g ∈ Γ ↔ ∀ i, ∃ z : ℤ, expCoordinates c g i = z := by constructor · intro hg i exact (hΓ _).mp (peel_mem_lattice c Γ hΓ hg i.val) i · intro hg rw [← expProduct_expCoordinates c g] change (List.ofFn (fun i => basisFlow c i (expCoordinates c g i))).prod ∈ Γ apply list_prod_mem intro x hx obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hx obtain ⟨z,hz⟩ := hg i rw [hz] exact basisFlow_int_mem c Γ hΓ i z
omit hΓ in
theorem character_expCoordinates (χ : G →* Multiplicative ℝ) (hχ : Continuous χ) (g : G) : Multiplicative.toAdd (χ g) = ∑ i, expCoordinates c g i * Multiplicative.toAdd (χ (basisElement c i)) := by conv_lhs => rw [← expProduct_expCoordinates c g] change Multiplicative.toAdd (χ ((List.ofFn (fun i => basisFlow c i (expCoordinates c g i))).prod)) = _ rw [map_list_prod,List.map_ofFn] simp only [toAdd_list_sum,List.map_ofFn,List.sum_ofFn] apply Finset.sum_congr rfl intro i _ exact character_realPower c χ hχ _ _
theorem integer_character_expCoordinates (χ : G →* Multiplicative ℝ) (hχ : Continuous χ) (hz : ∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (χ g) = z) : ∃ k : Fin n → ℤ, ∀ g : G, Multiplicative.toAdd (χ g) = ∑ i, expCoordinates c g i * (k i : ℝ) := by choose k hk using (fun i => hz _ (basisElement_mem c Γ hΓ i)) refine ⟨k,fun g => ?_⟩ rw [character_expCoordinates c χ hχ] simp_rw [hk]
end RationalLatticeendend
sectionopen Set Topologynoncomputable sectionnamespace CharacterKernelLatticevariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable (χ : G →* Multiplicative ℝ) (hχ : Continuous χ)variable (Γ : Subgroup G) (C : Set G) (hC : IsCompact C)variable (hreps : ∀ g : G, ∃ c ∈ C, c⁻¹*g ∈ Γ)variable (hZ : ∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (χ g) = z)include hχ hC hreps hZ
theorem compact_kernel_representatives : ∃ D : Set G, IsCompact D ∧ D ⊆ χ.ker ∧ ∀ g ∈ χ.ker, ∃ d ∈ D, d⁻¹*g ∈ Γ := by classical let p : G → ℝ := fun g => Multiplicative.toAdd (χ g) have hp : Continuous p := hχ let J : Set ℤ := {z | (z : ℝ) ∈ p '' C ∧ ∃ γ ∈ Γ, p γ = z} have hJ : J.Finite := by apply Set.Finite.subset ((Int.isClosedEmbedding_coe_real.isCompact_preimage (hC.image hp)).finite ⟨inferInstance⟩) exact fun z hz => hz.1 have hex (z : J) : ∃ γ ∈ Γ, p γ = (z.val : ℝ) := z.property.2 choose δ hδΓ hδp using hex let D : Set G := ⋃ z : J, (fun c => c * (δ z)⁻¹) '' (C ∩ {c | p c = (z.val : ℝ)}) refine ⟨D,?_,?_,?_⟩ · have : Finite J := hJ.to_subtype exact isCompact_iUnion fun z => (hC.inter_right (isClosed_eq hp continuous_const)).image (continuous_id.mul continuous_const) · intro d hd obtain ⟨z,c,hc,rfl⟩ := Set.mem_iUnion.mp hd change χ (c*(δ z)⁻¹) = 1 apply Multiplicative.toAdd.injective change p (c*(δ z)⁻¹) = 0 change Multiplicative.toAdd (χ (c*(δ z)⁻¹)) = 0 rw [map_mul,map_inv] change p c - p (δ z) = 0 rw [hc.2,hδp] exact sub_self _ · intro g hg obtain ⟨c,hc,hcg⟩ := hreps g obtain ⟨z,hz⟩ := hZ (c⁻¹*g) hcg have hp0 : p g = 0 := hg have hpc : p c = (-z : ℤ) := by have hh : p (c⁻¹*g) = -p c + p g := by dsimp [p]; rw [map_mul,map_inv]; rfl change p (c⁻¹*g) = (z : ℝ) at hz rw [hh,hp0,add_zero] at hz push_cast linarith have hzJ : (-z) ∈ J := by refine ⟨⟨c,hc,hpc⟩, (c⁻¹*g)⁻¹,Γ.inv_mem hcg,?_⟩ change Multiplicative.toAdd (χ ((c⁻¹*g)⁻¹)) = _ rw [map_inv] change -Multiplicative.toAdd (χ (c⁻¹*g)) = _ rw [hz] simp let j : J := ⟨-z,hzJ⟩ refine ⟨c*(δ j)⁻¹,Set.mem_iUnion.mpr ⟨j,c,⟨hc,hpc⟩,rfl⟩,?_⟩ have he : (c*(δ j)⁻¹)⁻¹*g = δ j*(c⁻¹*g) := by group rw [he] exact Γ.mul_mem (hδΓ j) hcg
theorem compact_kernel_representatives_inter : ∃ D : Set G, IsCompact D ∧ D ⊆ χ.ker ∧ ∀ g ∈ χ.ker, ∃ d ∈ D, d⁻¹*g ∈ Γ ⊓ χ.ker := by obtain ⟨D,hD,hDK,hrep⟩ := compact_kernel_representatives χ hχ Γ C hC hreps hZ refine ⟨D,hD,hDK,fun g hg => ?_⟩ obtain ⟨d,hd,hdg⟩ := hrep g hg exact ⟨d,hd,hdg,χ.ker.mul_mem (χ.ker.inv_mem (hDK hd)) hg⟩
end CharacterKernelLatticeendend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace MalcevCharactersopen RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c)
include hsk inomit [IsTopologicalGroup G] inlemma character_ext_coordinates {χ ψ : G →* Multiplicative ℝ} (hχ : Continuous χ) (hψ : Continuous ψ) (he : ∀ i, χ (axis c i 1) = ψ (axis c i 1)) : χ = ψ := by ext g apply Multiplicative.toAdd.injective rw [character_coordinates c hsk χ hχ,character_coordinates c hsk ψ hψ] simp_rw [he]
include hsk in
omit [IsTopologicalGroup G] intheorem bounded_integral_characters_finite (Γ : Subgroup G) (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z) (A : ℝ) : {χ : G →* Multiplicative ℝ | Continuous χ ∧ (∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (χ g) = z) ∧ ∀ i, |Multiplicative.toAdd (χ (axis c i 1))| ≤ A}.Finite := by classical let S : Set ℝ := (Int.cast : ℤ → ℝ) '' {z : ℤ | |(z : ℝ)| ≤ A} have hs : S.Finite := by apply Set.Finite.image have hc := Int.isClosedEmbedding_coe_real.isCompact_preimage (isCompact_closedBall (0 : ℝ) A) have hf := hc.finite (show IsDiscrete ((Int.cast : ℤ → ℝ) ⁻¹' Metric.closedBall 0 A) from ⟨inferInstance⟩) simpa only [Set.preimage_ofPred_eq, Metric.closedBall, dist_zero_right,Real.norm_eq_abs] using hf let f (χ : G →* Multiplicative ℝ) (i : Fin n) := Multiplicative.toAdd (χ (axis c i 1)) apply Set.Finite.of_finite_image (f := f) · apply (Set.Finite.pi' (fun _ : Fin n => hs)).subset rintro y ⟨χ,hχ,rfl⟩ i obtain ⟨z,hz⟩ := hχ.2.1 _ (axis_one_mem c Γ hΓ i) exact ⟨z,by simpa [← hz] using hχ.2.2 i,hz.symm⟩ · intro χ hχ ψ hψ he apply character_ext_coordinates c hsk hχ.1 hψ.1 intro i exact Multiplicative.toAdd.injective (congrFun he i)
variable (χ : G →* Multiplicative ℝ) (hχ : Continuous χ)include hsk hχ
omit [IsTopologicalGroup G] intheorem kernel_inter_connected (H : Subgroup G) (V : Submodule ℝ (Fin n → ℝ)) (hV : ∀ g : G, g ∈ H ↔ c.coord g ∈ V) : IsConnected (↑H ∩ (χ.ker : Set G)) := by let W := V ⊓ (coordinateForm (fun i => Multiplicative.toAdd (χ (axis c i 1)))).ker have he : (↑H ∩ (χ.ker : Set G)) = c.coord.symm '' (W : Set (Fin n → ℝ)) := by ext g constructor · intro hg refine ⟨c.coord g,⟨(hV g).mp hg.1,?_⟩,c.coord.symm_apply_apply g⟩ change (∑ i, c.coord g i * Multiplicative.toAdd (χ (axis c i 1))) = 0 rw [← character_coordinates c hsk χ hχ g] exact congrArg Multiplicative.toAdd hg.2 · rintro ⟨x,hx,rfl⟩ refine ⟨(hV _).mpr (by simpa using hx.1),?_⟩ apply Multiplicative.toAdd.injective rw [character_coordinates c hsk χ hχ] simpa [coordinateForm] using hx.2 rw [he] exact (W.convex.isConnected ⟨0,by simp⟩).image _ c.coord.symm.continuous.continuousOn
omit [IsTopologicalGroup G] intheorem nontrivial_kernel_geometry (Γ : Subgroup G) (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z) (hz : ∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (χ g) = z) (hne : χ ≠ 1) : ∃ k : Fin n → ℤ, k ≠ 0 ∧ (∀ g, Multiplicative.toAdd (χ g) = ∑ i, c.coord g i * (k i : ℝ)) ∧ (χ.ker : Set G) = c.coord.symm '' ((IntegerHyperplane.form k).ker : Set (Fin n → ℝ)) ∧ Module.finrank ℝ (IntegerHyperplane.form k).ker = n-1 := by obtain ⟨k,hk⟩ := integer_character_coordinates c hsk χ Γ hΓ hχ hz have hk0 : k ≠ 0 := by intro he apply hne ext g apply Multiplicative.toAdd.injective rw [hk,he] simp refine ⟨k,hk0,hk,?_,IntegerHyperplane.kernel_finrank k hk0⟩ ext g constructor · intro hg refine ⟨c.coord g,?_,c.coord.symm_apply_apply g⟩ change (∑ i, (k i : ℝ) * c.coord g i) = 0 rw [Finset.sum_congr rfl (fun i _ => mul_comm _ _), ← hk] exact congrArg Multiplicative.toAdd hg · rintro ⟨x,hx,rfl⟩ apply Multiplicative.toAdd.injective rw [hk] simpa [IntegerHyperplane.form,mul_comm] using hx
end MalcevCharacters
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.RationalTail01import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionopen scoped BigOperatorsnoncomputable sectionendend
sectionnoncomputable sectionnamespace RationalPolynomialMapvariable {σ : Type*} [Fintype σ]lemma contDiff {f : (σ → ℝ) → ℝ} (hf : IsPolynomial f) : ContDiff ℝ (⊤ : ℕ∞) f := by obtain ⟨p,hp⟩ := hf have he : f = fun x => MvPolynomial.eval₂ (algebraMap ℚ ℝ) x p := funext hp rw [he] clear hp he f induction p using MvPolynomial.induction_on with | C q => simpa using (contDiff_const : ContDiff ℝ (⊤ : ℕ∞) (fun _ : σ → ℝ => (q:ℝ))) | add p q hp hq => simpa using hp.add hq | mul_X p i hp => simpa using hp.mul (by fun_prop)
lemma bounded_lipschitz {f : (σ → ℝ) → ℝ} (hf : IsPolynomial f) (B : ℝ) : ∃ M > 0, (∀ x, ‖x‖ ≤ B → |f x| ≤ M) ∧ (∀ x y, ‖x‖ ≤ B → ‖y‖ ≤ B → |f x-f y| ≤ M*‖x-y‖) := by have hd := contDiff hf obtain ⟨M,hM⟩ := (isCompact_closedBall (0 : σ → ℝ) B).exists_bound_of_continuousOn hd.continuous.continuousOn obtain ⟨D,hD⟩ := (isCompact_closedBall (0 : σ → ℝ) B).exists_bound_of_continuousOn (hd.continuous_fderiv (by simp)).continuousOn refine ⟨max (max M D) 0 + 1,by positivity,?_,?_⟩ · intro x hx have he := hM x (by simpa using hx) change |f x| ≤ M at he exact he.trans (by grind) · intro x y hx hy have he := Convex.norm_image_sub_le_of_norm_fderiv_le (fun x (_ : x ∈ Metric.closedBall (0 : σ → ℝ) B) => hd.differentiable (by simp) x) hD (convex_closedBall (0 : σ → ℝ) B) (by simpa using hy) (by simpa using hx) change |f x-f y| ≤ D * ‖x-y‖ at he exact he.trans (mul_le_mul_of_nonneg_right (by grind) (norm_nonneg _))
end RationalPolynomialMapendend
sectionnoncomputable sectionnamespace RationalLatticeopen RationalPolynomialMapvariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n) {σ τ : Type*}
lemma polynomialMap_comp {f : (τ → ℝ) → G} (hf : IsPolynomialMap c f) {g : (σ → ℝ) → (τ → ℝ)} (hg : ∀ i, IsPolynomial (fun x => g x i)) : IsPolynomialMap c (fun x => f (g x)) := fun i => RationalPolynomialMap.comp (hf i) hg
lemma polynomialMap_inv {f : (σ → ℝ) → G} (hf : IsPolynomialMap c f) : IsPolynomialMap c (fun x => (f x)⁻¹) := by have h : ∀ m : ℕ, ∀ hm : m < n, IsPolynomial (fun x => c.coord ((f x)⁻¹) ⟨m,hm⟩) := by intro m induction m using Nat.strong_induction_on with | h m ih => intro hm let i : Fin n := ⟨m,hm⟩ have he (x : σ → ℝ) : c.coord ((f x)⁻¹) i = -c.coord (f x) i - MvPolynomial.eval₂ (algebraMap ℚ ℝ) (Sum.elim (fun j : Fin i.val => c.coord (f x) ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j : Fin i.val => c.coord ((f x)⁻¹) ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i) := by have he := c.mul_coord (f x) ((f x)⁻¹) i rw [mul_inv_cancel,c.one_coord] at he linarith simp_rw [show (⟨m,hm⟩ : Fin n)=i from rfl,he] apply RationalPolynomialMap.sub (RationalPolynomialMap.neg (hf i)) apply RationalPolynomialMap.eval intro j cases j with | inl j => exact hf _ | inr j => exact ih j.val j.isLt (lt_trans j.isLt hm) intro i exact h i.val i.isLt
end RationalLatticeendend
sectionnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
lemma correction_eq_of_lower_eq (i : Fin n) {g g' h h' : G} (hg : ∀ j : Fin n, j < i → c.coord g j = c.coord g' j) (hh : ∀ j : Fin n, j < i → c.coord h j = c.coord h' j) : c.coord (g*h) i - c.coord g i - c.coord h i = c.coord (g'*h') i - c.coord g' i - c.coord h' i := by rw [c.mul_coord g h,c.mul_coord g' h'] have he : (Sum.elim (fun j : Fin i.val => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j : Fin i.val => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) = (Sum.elim (fun j : Fin i.val => c.coord g' ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j : Fin i.val => c.coord h' ⟨j.val,lt_trans j.isLt i.isLt⟩)) := by funext j cases j with | inl j => exact hg _ j.isLt | inr j => exact hh _ j.isLt rw [he] ring
lemma mul_lower_congr (i : Fin n) {g g' h h' : G} (hg : ∀ j : Fin n, j < i → c.coord g j = c.coord g' j) (hh : ∀ j : Fin n, j < i → c.coord h j = c.coord h' j) : ∀ j : Fin n, j < i → c.coord (g*h) j = c.coord (g'*h') j := by intro j hj have he := correction_eq_of_lower_eq c j (fun k hk => hg k (lt_trans hk hj)) (fun k hk => hh k (lt_trans hk hj)) rw [hg j hj,hh j hj] at he linarith
lemma conj_lower_congr (a : G) (i : Fin n) {u v : G} (huv : ∀ j : Fin n, j < i → c.coord u j = c.coord v j) : ∀ j : Fin n, j < i → c.coord (a⁻¹*u*a) j = c.coord (a⁻¹*v*a) j := by exact mul_lower_congr c i (mul_lower_congr c i (fun _ _ => rfl) huv) (fun _ _ => rfl)
lemma conj_coord_difference (a : G) (i : Fin n) {u v : G} (huv : ∀ j : Fin n, j < i → c.coord u j = c.coord v j) : c.coord (a⁻¹*u*a) i - c.coord (a⁻¹*v*a) i = c.coord u i - c.coord v i := by have h1 := correction_eq_of_lower_eq c i (g:=a⁻¹) (g':=a⁻¹) (fun _ _ => rfl) huv have h2 := correction_eq_of_lower_eq c i (mul_lower_congr c i (g:=a⁻¹) (g':=a⁻¹) (fun _ _ => rfl) huv) (h:=a) (h':=a) (fun _ _ => rfl) linarith
lemma conj_mul_coord_difference (a : G) (i : Fin n) {u u' v v' : G} (hu : ∀ j : Fin n, j < i → c.coord u j = c.coord u' j) (hv : ∀ j : Fin n, j < i → c.coord v j = c.coord v' j) : c.coord (a⁻¹*u*a*v) i - c.coord (a⁻¹*u'*a*v') i = c.coord u i - c.coord u' i + c.coord v i - c.coord v' i := by have h1 := conj_coord_difference c a i hu have h2 := correction_eq_of_lower_eq c i (conj_lower_congr c a i hu) hv linarith
def truncate (i : Fin n) (v : Fin i.val → ℝ) : G := c.coord.symm (fun j => if h : j < i then v ⟨j.val,h⟩ else 0)@[simp] lemma truncate_coord_self (i : Fin n) (v : Fin i.val → ℝ) : c.coord (truncate c i v) i = 0 := by simp [truncate]lemma truncate_coord_lower (i : Fin n) (v : Fin i.val → ℝ) (j : Fin n) (hj : j < i) : c.coord (truncate c i v) j = v ⟨j.val,hj⟩ := by simp [truncate,hj]
lemma conj_mul_truncated (a u v : G) (i : Fin n) : c.coord (a⁻¹*u*a*v) i = c.coord u i + c.coord v i + c.coord (a⁻¹*truncate c i (fun j => c.coord u ⟨j.val,lt_trans j.isLt i.isLt⟩)*a* truncate c i (fun j => c.coord v ⟨j.val,lt_trans j.isLt i.isLt⟩)) i := by have hu : ∀ j : Fin n, j < i → c.coord u j = c.coord (truncate c i (fun j => c.coord u ⟨j.val,lt_trans j.isLt i.isLt⟩)) j := by intro j hj rw [truncate_coord_lower c i _ j hj] have hv : ∀ j : Fin n, j < i → c.coord v j = c.coord (truncate c i (fun j => c.coord v ⟨j.val,lt_trans j.isLt i.isLt⟩)) j := by intro j hj rw [truncate_coord_lower c i _ j hj] have he := conj_mul_coord_difference c a i hu hv rw [truncate_coord_self,truncate_coord_self] at he linarith
lemma polynomialMap_truncate {σ : Type*} (i : Fin n) {f : (σ → ℝ) → (Fin i.val → ℝ)} (hf : ∀ j, RationalPolynomialMap.IsPolynomial (fun x => f x j)) : IsPolynomialMap c (fun x => truncate c i (f x)) := by intro j simp only [truncate,Homeomorph.apply_symm_apply] split_ifs · exact hf _ · exact RationalPolynomialMap.zero
end RationalLatticeendend
sectionnoncomputable sectionnamespace PairTailopen RationalLattice
def joinHomeomorph (r d : ℕ) : ((Fin r → ℝ) × (Fin d → ℝ)) ≃ₜ (Fin (r+d) → ℝ) where toFun x := Fin.append x.1 x.2 invFun x := (fun i => x (i.castAdd d),fun j => x (j.natAdd r)) left_inv x := by simp right_inv x := by funext i; exact Fin.addCases (fun _ => by simp) (fun _ => by simp) i continuous_toFun := by apply continuous_pi intro i refine Fin.addCases (fun j => ?_) (fun j => ?_) i · simp only [Fin.append_left] exact (continuous_apply j).comp continuous_fst · simp only [Fin.append_right] exact (continuous_apply j).comp continuous_snd continuous_invFun := (continuous_pi (fun _ => continuous_apply _)).prodMk (continuous_pi (fun _ => continuous_apply _))
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {t d r : ℕ} (c : RealCoordinates G (t+d))variable (K : Subgroup G) [K.Normal]variable (hK : ∀ g : G, g ∈ K ↔ ∀ i : Fin (t+d), i.val < t → c.coord g i = 0)variable (hr : r ≤ t+d) (N : Subgroup G) [N.Normal]variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin (t+d), i.val < r → c.coord g i = 0)variable (hcent : N ≤ Subgroup.center G)
def baseSection (x : G ⧸ N) : G := MalcevPrefixQuotient.represent c (MalcevPrefixQuotient.coordinates c hr N hN x)omit [IsTopologicalGroup G] [N.Normal] inlemma section_spec (x : G ⧸ N) : (QuotientGroup.mk (baseSection c hr N hN x) : G ⧸ N) = x := MalcevPrefixQuotient.rebuild_coordinates c hr N hN xomit [IsTopologicalGroup G] [N.Normal] inlemma section_continuous : Continuous (baseSection c hr N hN) := c.coord.symm.continuous.comp (MalcevPrefixQuotient.lift_continuous.comp (MalcevPrefixQuotient.coordinates_continuous c hr N hN))
def chartHomeomorph : (square K ⧸ diagonal K N) ≃ₜ (Fin (r+d) → ℝ) := (quotientHomeomorph K N hcent (baseSection c hr N hN) (section_spec c hr N hN) (section_continuous c hr N hN)).trans (((MalcevPrefixQuotient.homeomorph c hr N hN).prodCongr (RationalTailCoordinates.tailHomeomorph c K hK)).trans (joinHomeomorph r d))
omit [N.Normal] in@[simp] lemma chart_base (x : square K) (i : Fin r) : chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk x) (i.castAdd d) = c.coord x.val.1 (MalcevPrefixQuotient.embed hr i) := by change Fin.append _ _ (i.castAdd d) = _ rw [Fin.append_left] rflomit [N.Normal] in@[simp] lemma chart_tail (x : square K) (j : Fin d) : chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk x) (j.natAdd r) = c.coord (x.val.1⁻¹*x.val.2) (RationalTailCoordinates.embed t j) := by change Fin.append _ _ (j.natAdd r) = _ rw [Fin.append_right] rfl
omit [N.Normal] inlemma chart_one : chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk (1:square K)) = 0 := by funext i refine Fin.addCases (fun j => ?_) (fun j => ?_) i · simpa using c.one_coord (MalcevPrefixQuotient.embed hr j) · simpa using c.one_coord (RationalTailCoordinates.embed t j)
omit [N.Normal] inlemma chart_rebuild_base (x : Fin (r+d) → ℝ) : (chartHomeomorph c K hK hr N hN hcent).symm x = QuotientGroup.mk (pair K (MalcevPrefixQuotient.represent c (fun i : Fin r => x (i.castAdd d))) (RationalTailCoordinates.rebuild c K hK (fun i : Fin d => x (i.natAdd r)))) := by apply (chartHomeomorph c K hK hr N hN hcent).injective rw [Homeomorph.apply_symm_apply] funext i refine Fin.addCases (fun j => ?_) (fun j => ?_) i · rw [chart_base] simp [pair,MalcevPrefixQuotient.represent] · rw [chart_tail] simp [pair,RationalTailCoordinates.rebuild]
end PairTail
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.IntegerHyperplane02import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionopen scoped BigOperatorsendend
sectionnoncomputable sectionopen scoped BigOperatorsnamespace RationalCharacterFirstopen RationalLattice IntegerHyperplane RationalPolynomialMapvariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G (n+1)) (χ : G →* Multiplicative ℝ)variable (k : Fin (n+1) → ℤ) (p : Fin (n+1)) (hp : k p ≠ 0)variable (hχ : ∀ g : G, Multiplicative.toAdd (χ g) = form k (c.coord g))variable (hlast : ∀ j : Fin (n+1), p < j → k j = 0)
def coordinates (g : G) : Fin (n+1) → ℝ := splitCoordinates k p (c.coord g)
lemma exists_correction (i : Fin n) : ∃ P : MvPolynomial (Fin (i.val+1) ⊕ Fin (i.val+1)) ℚ, ∀ v : (Fin (i.val+1) ⊕ Fin (i.val+1)) → ℝ, MvPolynomial.eval₂ (algebraMap ℚ ℝ) (Sum.elim (fun a => splitLift k p (lowerExtend i.succ (fun j => v (Sum.inl j))) ⟨a.val,lt_trans a.isLt (p.succAbove i).isLt⟩) (fun a => splitLift k p (lowerExtend i.succ (fun j => v (Sum.inr j))) ⟨a.val,lt_trans a.isLt (p.succAbove i).isLt⟩)) (c.correction (p.succAbove i)) = MvPolynomial.eval₂ (algebraMap ℚ ℝ) v P := by apply RationalPolynomialMap.eval intro a cases a with | inl a => apply RationalPolynomialMap.comp (splitLift_polynomial k p _) intro j unfold lowerExtend split_ifs · exact RationalPolynomialMap.coordinate _ · exact RationalPolynomialMap.zero | inr a => apply RationalPolynomialMap.comp (splitLift_polynomial k p _) intro j unfold lowerExtend split_ifs · exact RationalPolynomialMap.coordinate _ · exact RationalPolynomialMap.zero
def tailCorrection (i : Fin n) : MvPolynomial (Fin (i.val+1) ⊕ Fin (i.val+1)) ℚ := (exists_correction c k p i).choose
include hp hlast inlemma tail_mul_coord (g h : G) (i : Fin n) : coordinates c k p (g*h) i.succ = coordinates c k p g i.succ + coordinates c k p h i.succ + MvPolynomial.eval₂ (algebraMap ℚ ℝ) (Sum.elim (fun j => coordinates c k p g ⟨j.val,lt_trans j.isLt i.succ.isLt⟩) (fun j => coordinates c k p h ⟨j.val,lt_trans j.isLt i.succ.isLt⟩)) (tailCorrection c k p i) := by change c.coord (g*h) (p.succAbove i) = _ rw [c.mul_coord] change coordinates c k p g i.succ + coordinates c k p h i.succ + _ = _ congr 1 let v : (Fin (i.val+1) ⊕ Fin (i.val+1)) → ℝ := Sum.elim (fun j => coordinates c k p g ⟨j.val,lt_trans j.isLt i.succ.isLt⟩) (fun j => coordinates c k p h ⟨j.val,lt_trans j.isLt i.succ.isLt⟩) unfold tailCorrection rw [← (exists_correction c k p i).choose_spec v] congr 1 funext a have hl (u : G) (a : Fin (p.succAbove i).val) : c.coord u ⟨a.val,lt_trans a.isLt (p.succAbove i).isLt⟩ = splitLift k p (lowerExtend i.succ (fun j => coordinates c k p u ⟨j.val,lt_trans j.isLt i.succ.isLt⟩)) ⟨a.val,lt_trans a.isLt (p.succAbove i).isLt⟩ := by conv_lhs => rw [← splitLift_splitCoordinates k p hp (c.coord u)] apply splitLift_lower_dep k p hlast i · intro j hj have hj' : j.val < i.succ.val := hj simp only [lowerExtend,hj',dite_eq_left,coordinates] · exact a.isLt cases a with | inl a => exact hl g a | inr a => exact hl h a
include hχ inlemma head_mul_coord (g h : G) : coordinates c k p (g*h) 0 = coordinates c k p g 0+coordinates c k p h 0 := by change form k (c.coord (g*h))/(k p:ℝ) = form k (c.coord g)/(k p:ℝ)+form k (c.coord h)/(k p:ℝ) rw [← hχ,← hχ,← hχ,map_mul] exact add_div _ _ _
def characterFirstCoordinates : RealCoordinates G (n+1) where coord := c.coord.trans (splitHomeomorph k p hp) one_coord i := by refine Fin.cases ?_ (fun j => ?_) i · change form k (c.coord 1)/(k p:ℝ) = 0 simp [form,c.one_coord] · exact c.one_coord _ correction := Fin.cases 0 (tailCorrection c k p) mul_coord g h i := by refine Fin.cases ?_ (fun j => ?_) i · change coordinates c k p (g*h) 0 = coordinates c k p g 0+coordinates c k p h 0+ MvPolynomial.eval₂ _ _ 0 rw [MvPolynomial.eval₂_zero,add_zero] exact head_mul_coord c χ k p hχ g h · exact tail_mul_coord c k p hp hlast g h j
lemma inclusion_polynomial (i : Fin (n+1)) : RationalPolynomialMap.IsPolynomial (fun x : Fin (n+1) → ℝ => c.coord ((characterFirstCoordinates c χ k p hp hχ hlast).coord.symm x) i) := by change RationalPolynomialMap.IsPolynomial (fun x => c.coord (c.coord.symm (splitLift k p x)) i) simp only [Homeomorph.apply_symm_apply] exact splitLift_polynomial k p i
include hp hχ hlast inlemma characterFirst_adapted (H : Subgroup G) (r : ℕ) (hH : ∀ g : G, g ∈ H ↔ ∀ i : Fin (n+1), i.val < r �� c.coord g i = 0) (g : G) : g ∈ H ⊓ χ.ker ↔ ∀ i : Fin (n+1), i.val < deletedCutoff p r+1 → (characterFirstCoordinates c χ k p hp hχ hlast).coord g i = 0 := by have hpR : (k p:ℝ) ≠ 0 := by exact_mod_cast hp have hhead : (characterFirstCoordinates c χ k p hp hχ hlast).coord g 0 = 0 ↔ g ∈ χ.ker := by change form k (c.coord g)/(k p:ℝ) = 0 ↔ χ g=1 rw [← hχ,div_eq_zero_iff] simp only [hpR,or_false] constructor · intro h exact Multiplicative.toAdd.injective h · intro h rw [h] rfl constructor · rintro ⟨hg,hker⟩ i refine Fin.cases ?_ (fun j => ?_) i · intro _; exact hhead.mpr hker · intro hi have ha := (RationalCharacterKernel.kernelCoordinates_adapted c χ k p hp hχ hlast H r hH ⟨g,hker⟩).mp hg exact ha j (by change j.val+1 < deletedCutoff p r+1 at hi; omega) · intro hg have hker := hhead.mp (hg 0 (by change 0 < deletedCutoff p r+1; omega)) refine ⟨?_,hker⟩ apply (RationalCharacterKernel.kernelCoordinates_adapted c χ k p hp hχ hlast H r hH ⟨g,hker⟩).mpr intro j hj exact hg j.succ (by change j.val+1 < deletedCutoff p r+1; omega)
end RationalCharacterFirstendend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace TriangularDenominators
theorem polynomial_origin_grid {ι : Type*} (P : MvPolynomial ι ℚ) : ∃ D : ℕ, 0 < D ∧ ∀ T : ℕ, ∀ x : ι → ℤ, ∃ z : ℤ, MvPolynomial.eval (fun j => (D:ℚ)*(T:ℚ)*(x j:ℚ)) P - MvPolynomial.eval (fun _ => 0) P = (T:ℚ)*(z:ℚ) := by induction P using MvPolynomial.induction_on with | C a => exact ⟨1,by norm_num,fun T x => ⟨0,by simp⟩⟩ | add P Q hP hQ => obtain ⟨D,hD,hP⟩ := hP obtain ⟨E,hE,hQ⟩ := hQ refine ⟨D*E,Nat.mul_pos hD hE,?_⟩ intro T x obtain ⟨a,ha⟩ := hP T (fun j => (E:ℤ)*x j) obtain ⟨b,hb⟩ := hQ T (fun j => (D:ℤ)*x j) have hDE : (fun j => (D:ℚ)*(T:ℚ)*(((E:ℤ)*x j):ℚ)) = (fun j => ((D*E:ℕ):ℚ)*(T:ℚ)*(x j:ℚ)) := by funext j; push_cast; ring have hED : (fun j => (E:ℚ)*(T:ℚ)*(((D:ℤ)*x j):ℚ)) = (fun j => ((D*E:ℕ):ℚ)*(T:ℚ)*(x j:ℚ)) := by funext j; push_cast; ring simp only [Int.cast_mul] at ha hb rw [hDE] at ha rw [hED] at hb refine ⟨a+b,?_⟩ simp only [map_add,Int.cast_add] linarith | mul_X P i hP => obtain ⟨D,hD,hgrid⟩ := polynomial_grid P 1 (by norm_num) refine ⟨D,hD,?_⟩ intro T x obtain ⟨a,ha⟩ := hgrid (fun j => (D:ℚ)*(T:ℚ)*(x j:ℚ)) (by intro j refine ⟨(D:ℤ)*(T:ℤ)*x j,?_⟩ simp) refine ⟨a*x i,?_⟩ simp only [map_mul,MvPolynomial.eval_X,mul_zero,sub_zero,Int.cast_mul] calc _ = (T:ℚ)*((D:ℚ)*MvPolynomial.eval (fun j => (D:ℚ)*(T:ℚ)*(x j:ℚ)) P)*(x i:ℚ) := by ring _ = _ := by rw [ha]; ring
theorem polynomial_origin_grid_real {ι : Type*} (P : MvPolynomial ι ℚ) : ∃ D : ℕ, 0 < D ∧ ∀ T : ℕ, ∀ x : ι → ℝ, (∀ j, ∃ z : ℤ, x j = ((D*T:ℕ):ℝ)*(z:ℝ)) → ∃ z : ℤ, MvPolynomial.eval₂ (algebraMap ℚ ℝ) x P - MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun _ => 0) P = (T:ℝ)*(z:ℝ) := by obtain ⟨D,hD,hgrid⟩ := polynomial_origin_grid P refine ⟨D,hD,?_⟩ intro T x hx choose z hz using hx obtain ⟨a,ha⟩ := hgrid T z refine ⟨a,?_⟩ have he : ∀ v : ι → ℚ, ((MvPolynomial.eval v P : ℚ):ℝ) = MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun i => (v i:ℝ)) P := by intro v exact MvPolynomial.eval₂_comp_left (algebraMap ℚ ℝ) (RingHom.id ℚ) v P have hh := congrArg (fun q : ℚ => (q:ℝ)) ha simp only [Rat.cast_sub,Rat.cast_mul,Rat.cast_natCast,Rat.cast_intCast] at hh rw [he,he] at hh simp only [Rat.cast_zero] at hh convert hh using 1 · congr 1 congr 1 funext j simpa only [Rat.cast_mul,Rat.cast_natCast,Rat.cast_intCast,Nat.cast_mul] using hz jend TriangularDenominators
endend
sectionopen scoped BigOperatorsnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}variable (c : RealCoordinates G n)
def correctionDenom (i : Fin n) : ℕ := (TriangularDenominators.polynomial_origin_grid_real (c.correction i)).choose
lemma correctionDenom_pos (i : Fin n) : 0 < correctionDenom c i := (TriangularDenominators.polynomial_origin_grid_real (c.correction i)).choose_spec.1
lemma correction_at_zero (i : Fin n) : MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun _ => 0) (c.correction i) = 0 := by have h := c.mul_coord 1 1 i simp only [mul_one,c.one_coord,zero_add] at h have he : (Sum.elim (fun _ : Fin i.val => (0:ℝ)) (fun _ : Fin i.val => (0:ℝ))) = (fun _ => (0:ℝ)) := by funext j; cases j <;> rfl rw [he] at h exact h.symm
variable (w : Fin n → ℕ)variable (hw : ∀ i : Fin n, ∀ j : Fin n, j < i → correctionDenom c i * w i ∣ w j)
def OnGrid (g : G) : Prop := ∀ i, ∃ z : ℤ, c.coord g i = (w i:ℝ)*(z:ℝ)
include hw inlemma correction_on_grid (g h : G) (i : Fin n) (hg : ∀ j : Fin n, j < i → ∃ z : ℤ, c.coord g j = (w j:ℝ)*(z:ℝ)) (hh : ∀ j : Fin n, j < i → ∃ z : ℤ, c.coord h j = (w j:ℝ)*(z:ℝ)) : ∃ z : ℤ, MvPolynomial.eval₂ (algebraMap ℚ ℝ) (Sum.elim (fun j => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i) = (w i:ℝ)*(z:ℝ) := by have hl (a : G) (ha : ∀ j : Fin n, j < i → ∃ z : ℤ, c.coord a j = (w j:ℝ)*(z:ℝ)) (j : Fin i.val) : ∃ z : ℤ, c.coord a ⟨j.val,lt_trans j.isLt i.isLt⟩ = ((correctionDenom c i*w i:ℕ):ℝ)*(z:ℝ) := by let k : Fin n := ⟨j.val,lt_trans j.isLt i.isLt⟩ obtain ⟨z,hz⟩ := ha k j.isLt obtain ⟨b,hb⟩ := hw i k j.isLt refine ⟨(b:ℤ)*z,?_⟩ change c.coord a k = _ rw [hz,hb] push_cast ring have he := (TriangularDenominators.polynomial_origin_grid_real (c.correction i)).choose_spec.2 (w i) (Sum.elim (fun j => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩) (fun j => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) (by intro j cases j with | inl j => exact hl g hg j | inr j => exact hl h hh j) simpa only [correction_at_zero,sub_zero] using he
include hw inlemma onGrid_mul {g h : G} (hg : OnGrid c w g) (hh : OnGrid c w h) : OnGrid c w (g*h) := by intro i obtain ⟨a,ha⟩ := hg i obtain ⟨b,hb⟩ := hh i obtain ⟨d,hd⟩ := correction_on_grid c w hw g h i (fun j _ => hg j) (fun j _ => hh j) refine ⟨a+b+d,?_⟩ rw [c.mul_coord,ha,hb,hd] push_cast ring
include hw inlemma onGrid_inv {g : G} (hg : OnGrid c w g) : OnGrid c w g⁻¹ := by have hi : ∀ a : ℕ, ∀ ha : a < n, ∃ z : ℤ, c.coord g⁻¹ ⟨a,ha⟩ = (w ⟨a,ha⟩:ℝ)*(z:ℝ) := by intro a induction a using Nat.strong_induction_on with | h a ih => intro ha let i : Fin n := ⟨a,ha⟩ obtain ⟨b,hb⟩ := hg i obtain ⟨d,hd⟩ := correction_on_grid c w hw g g⁻¹ i (fun j _ => hg j) (fun j hj => ih j.val hj j.isLt) have he := c.mul_coord g g⁻¹ i rw [mul_inv_cancel,c.one_coord,hb,hd] at he refine ⟨-b-d,?_⟩ change c.coord g⁻¹ i = _ push_cast linarith exact fun i => hi i.val i.isLt
def weightedLattice : Subgroup G where carrier := OnGrid c w one_mem' := fun i => ⟨0,by simp [c.one_coord]⟩ mul_mem' := onGrid_mul c w hw inv_mem' := onGrid_inv c w hw
theorem exists_lattice_weights (E : ℕ) (hE : 0 < E) : ∃ w : Fin n → ℕ, (∀ i, 0 < w i) ∧ (∀ i, E ∣ w i) ∧ ∀ i : Fin n, ∀ j : Fin n, j < i → correctionDenom c i*w i ∣ w j := by let D : ℕ := E * ∏ i, correctionDenom c i have hD : 0 < D := Nat.mul_pos hE (Finset.prod_pos (fun i _ => correctionDenom_pos c i)) refine ⟨fun i => D^(n-i.val),fun i => pow_pos hD _,?_,?_⟩ · intro i exact (dvd_mul_right E _).trans (dvd_pow_self D (by omega)) · intro i j hji have hc : correctionDenom c i ∣ D := (Finset.dvd_prod_of_mem (fun i => correctionDenom c i) (Finset.mem_univ i)).trans (dvd_mul_left _ _) have he : correctionDenom c i*D^(n-i.val) ∣ D^(n-i.val+1) := by rw [pow_succ] rw [mul_comm (D^(n-i.val)) D] exact mul_dvd_mul_right hc _ exact he.trans (pow_dvd_pow D (by change j.val < i.val at hji; omega))
variable (hpos : ∀ i, 0 < w i)
def divideCoordinates : (Fin n → ℝ) ≃ₜ (Fin n → ℝ) where toFun x i := x i/(w i:ℝ) invFun x i := (w i:ℝ)*x i left_inv x := by funext i; exact mul_div_cancel₀ (x i) (by exact_mod_cast (hpos i).ne') right_inv x := by funext i; exact mul_div_cancel_left₀ (x i) (by exact_mod_cast (hpos i).ne') continuous_toFun := continuous_pi (fun i => (continuous_apply i).div_const _) continuous_invFun := continuous_pi (fun i => continuous_const.mul (continuous_apply i))
lemma exists_scaled_correction (i : Fin n) : ∃ P : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ, ∀ x : (Fin i.val ⊕ Fin i.val) → ℝ, MvPolynomial.eval₂ (algebraMap ℚ ℝ) (Sum.elim (fun j => (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ)*x (Sum.inl j)) (fun j => (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ)*x (Sum.inr j))) (c.correction i) / (w i:ℝ) = MvPolynomial.eval₂ (algebraMap ℚ ℝ) x P := by have he : RationalPolynomialMap.IsPolynomial (fun x : (Fin i.val ⊕ Fin i.val) → ℝ => MvPolynomial.eval₂ (algebraMap ℚ ℝ) (Sum.elim (fun j => (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ)*x (Sum.inl j)) (fun j => (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ)*x (Sum.inr j))) (c.correction i)) := by apply RationalPolynomialMap.eval intro j cases j with | inl j => simpa using RationalPolynomialMap.mul (RationalPolynomialMap.const (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℚ)) (RationalPolynomialMap.coordinate (Sum.inl j)) | inr j => simpa using RationalPolynomialMap.mul (RationalPolynomialMap.const (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℚ)) (RationalPolynomialMap.coordinate (Sum.inr j)) have hm := RationalPolynomialMap.mul he (RationalPolynomialMap.const (w i:ℚ)⁻¹) simpa only [RationalPolynomialMap.IsPolynomial,div_eq_mul_inv,Rat.cast_inv,Rat.cast_natCast] using hm
def scaledCorrection (i : Fin n) : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ := (exists_scaled_correction c w i).choose
def scaledCoordinates : RealCoordinates G n where coord := c.coord.trans (divideCoordinates w hpos) one_coord i := by change c.coord 1 i / (w i:ℝ) = 0; rw [c.one_coord,zero_div] correction := scaledCorrection c w mul_coord g h i := by change c.coord (g*h) i/(w i:ℝ) = _ have he := (exists_scaled_correction c w i).choose_spec (Sum.elim (fun j => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩/(w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ)) (fun j => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩/(w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ))) have hc (v : ℝ) (j : Fin n) : (w j:ℝ)*(v/(w j:ℝ)) = v := mul_div_cancel₀ _ (by exact_mod_cast (hpos j).ne') simp only [Sum.elim_inl,Sum.elim_inr,hc] at he change c.coord (g*h) i/(w i:ℝ) = c.coord g i/(w i:ℝ)+c.coord h i/(w i:ℝ)+_ dsimp [scaledCorrection,divideCoordinates] rw [← he,c.mul_coord] ring
lemma weightedLattice_iff (g : G) : g ∈ weightedLattice c w hw ↔ ∀ i, ∃ z : ℤ, (scaledCoordinates c w hpos).coord g i = z := by constructor <;> intro hg i <;> obtain ⟨z,hz⟩ := hg i <;> refine ⟨z,?_⟩ · change c.coord g i/(w i:ℝ) = z rw [hz] exact mul_div_cancel_left₀ _ (by exact_mod_cast (hpos i).ne') · change c.coord g i/(w i:ℝ) = z at hz exact (div_eq_iff (by exact_mod_cast (hpos i).ne')).mp hz |>.trans (mul_comm _ _)
end RationalLattice
endendendendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.MalcevCentral01import OAI.Combinatorics.SumProduct.Alignment.SquareInduction02import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionopen _root_.Polynomial _root_.OAI.Polynomialopen scoped BigOperatorsendend
sectionnoncomputable sectionnamespace RationalLatticevariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n : ℕ} (c : RealCoordinates G n)variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
include hΓ in lemma coordinate_quotient_t2 : T2Space (G⧸Γ) := by let : T2Space G := c.coord.symm.t2Space let : DiscreteTopology Γ := integerCoordinates_discrete c Γ hΓ have hc : IsClosed (Γ : Set G) := Γ.isClosed_of_discreteTopology apply (t2Space_iff_of_isOpenQuotientMap (QuotientGroup.isOpenQuotientMap_mk (N:=Γ))).mpr have he : {p : G×G | (QuotientGroup.mk p.1 : G⧸Γ)=QuotientGroup.mk p.2}= (fun p : G×G => p.1⁻¹*p.2) ⁻¹' (Γ:Set G) := by ext p exact QuotientGroup.eq rw [he] exact hc.preimage (continuous_fst.inv.mul continuous_snd)
include hΓ inlemma coordinate_quotient_metrizable : TopologicalSpace.MetrizableSpace (G⧸Γ) := by let : T2Space (G⧸Γ) := coordinate_quotient_t2 c Γ hΓ let : CompactSpace (G⧸Γ) := AbelianMalcevTorus.quotient_compact c Γ hΓ let : SecondCountableTopology G := c.coord.secondCountableTopology infer_instance
abbrev coordinateQuotientMetric : MetricSpace (G⧸Γ) := letI := coordinate_quotient_metrizable c Γ hΓ TopologicalSpace.metrizableSpaceMetric (G⧸Γ)
lemma coordinateQuotientMetric_topology : (coordinateQuotientMetric c Γ hΓ).toUniformSpace.toTopologicalSpace= QuotientGroup.instTopologicalSpace Γ := rfl
end RationalLatticeendend
sectionnoncomputable sectionopen _root_.Polynomial _root_.OAI.Polynomialnamespace AbelianMalcevTorusopen RationalLattice MalcevCharacters CubeFaces LeibmanSquare MeasureTheory RationalQuotientFunctionsvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {n r : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c) (hr : r ≤ n)variable (N Γ : Subgroup G) [N.Normal] (hcomm : _root_.commutator G ≤ N)variable (hN : ∀ g : G, g∈N ↔ ∀ i : Fin n, i.val<r → c.coord g i=0)variable (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)variable [MeasurableSpace (G⧸Γ)] [BorelSpace (G⧸Γ)]
include hsk hr hcomm hN hΓ in
theorem quantitative_abelian_quotient_observable (H : Filtration G) (s : ℕ) (hs : H.level (s+1)=⊥) (μ : Measure (G⧸Γ)) [IsProbabilityMeasure μ] [SMulInvariantMeasure G (G⧸Γ) μ] (F : C(G⧸Γ,ℂ)) (hF : ∀ g a, a∈N → F (QuotientGroup.mk (g*a))=F (QuotientGroup.mk g)) (δ : ℝ) (hδ : 0<δ) : letI : CompactSpace (G⧸Γ) := quotient_compact c Γ hΓ ∃ U : Finset (G→*Multiplicative ℝ), (∀ χ∈U, Continuous χ ∧ (∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z)) ∧ ∃ A : ℝ, 0<A ∧ ∀ L : ℕ, 0<L → ∀ f : ℤ→G, Polynomial H 0 f → δ ≤ ‖FourierObstruction.discrepancy μ L (fun k => QuotientGroup.mk (f k)) F‖ → ∃ χ∈U, χ≠1 ∧ ∃ P : ℝ[X], P.natDegree ≤ s ∧ (∀ z : ℤ, P.eval (z:ℝ)=(χ (f z)).toAdd) ∧ ∀ j : ℕ, 0<j → ∃ z : ℤ, |P.coeff j-z| ≤ A/(L:ℝ)^j := by classical let : CompactSpace (G⧸Γ) := quotient_compact c Γ hΓ let cQ := MalcevPrefixQuotient.quotientChart c hr N hN let ΓQ := Γ.map (QuotientGroup.mk' N) have hΓQ : ∀ g : G⧸N, g∈ΓQ ↔ ∀ i, ∃ z : ℤ, cQ.coord g i=z := MalcevPrefixQuotient.quotient_lattice c hr N hN Γ hΓ have hadd : ∀ g h : G⧸N, ∀ i, cQ.coord (g*h) i=cQ.coord g i+cQ.coord h i := by intro g h i induction g using Quotient.inductionOn with | h g => induction h using Quotient.inductionOn with | h h => exact prefix_coord_mul c hsk N r hcomm (fun a ha => (hN a).mp ha) (MalcevPrefixQuotient.embed hr i) i.isLt g h let : MetricSpace ((G⧸N)⧸ΓQ) := coordinateQuotientMetric cQ ΓQ hΓQ let : CompactSpace ((G⧸N)⧸ΓQ) := quotient_compact cQ ΓQ hΓQ let : MeasurableSpace ((G⧸N)⧸ΓQ) := borel _ let : BorelSpace ((G⧸N)⧸ΓQ) := ⟨rfl⟩ let Q := quotientMap N Γ have hQ : Continuous Q := continuous_quotientMap N Γ let ν := Measure.map Q μ let : IsProbabilityMeasure ν := (Measure.isProbabilityMeasure_map_iff hQ.measurable.aemeasurable).mpr inferInstance let : SMulInvariantMeasure (G⧸N) ((G⧸N)⧸ΓQ) ν := CentralQuotientAction.invariant_quotientMap N Γ μ obtain ⟨FQ,hFQ,_⟩ := existsUnique_normalDescend N Γ (⟨fun g => F (QuotientGroup.mk g),F.continuous.comp QuotientGroup.continuous_mk⟩ : C(G,ℂ)) hF (fun g a ha => congrArg F (QuotientGroup.mk_mul_of_mem g ha)) have hFQall : ∀ x : G⧸Γ, FQ (Q x)=F x := by intro x induction x using Quotient.inductionOn with | h g => exact hFQ g let HQ := mapFiltration H (QuotientGroup.mk' N) have hsQ : HQ.level (s+1)=⊥ := by change (H.level (s+1)).map (QuotientGroup.mk' N)=⊥ rw [hs,Subgroup.map_bot] obtain ⟨U,hU,A,hA,hprod⟩ := quantitative_abelian_compact_producer cQ hadd ΓQ hΓQ rfl HQ s hsQ ν {FQ} (isCompact_singleton) δ hδ let liftχ : (G⧸N →* Multiplicative ℝ) → (G→*Multiplicative ℝ) := fun χ => χ.comp (QuotientGroup.mk' N) refine ⟨U.image liftχ,?_,A,hA,?_⟩ · intro χ hχ obtain ⟨ξ,hξ,rfl⟩ := Finset.mem_image.mp hχ refine ⟨(hU ξ hξ).1.comp QuotientGroup.continuous_mk,?_⟩ intro g hg exact (hU ξ hξ).2 _ ⟨g,hg,rfl⟩ · intro L hL f hf hdisc have hint : (∫ x, FQ x ∂ν)=(∫ x,F x ∂μ) := by rw [show ν=Measure.map Q μ from rfl,integral_map hQ.measurable.aemeasurable FQ.continuous.aestronglyMeasurable] apply integral_congr_ae exact Filter.Eventually.of_forall hFQall have hdiscQ : δ ≤ ‖FourierObstruction.discrepancy ν L (fun k => QuotientGroup.mk (QuotientGroup.mk' N (f k))) FQ‖ := by change δ ≤ ‖PolynomialWeyl.mean L (fun k => FQ (QuotientGroup.mk (QuotientGroup.mk' N (f k))))-(∫ x,FQ x ∂ν)‖ simp only [hFQ,hint] exact hdisc obtain ⟨χ,hχ,hχ0,P,hP,hPe,hPc⟩ := hprod L hL (fun z => QuotientGroup.mk' N (f z)) (polynomial_map H (QuotientGroup.mk' N) hf) ⟨FQ,Set.mem_singleton FQ,hdiscQ⟩ refine ⟨liftχ χ,Finset.mem_image.mpr ⟨χ,hχ,rfl⟩,?_,P,hP,hPe,hPc⟩ intro he apply hχ0 apply MonoidHom.ext intro x obtain ⟨g,rfl⟩ := QuotientGroup.mk_surjective x exact congrArg (fun ψ : G→*Multiplicative ℝ => ψ g) he
end AbelianMalcevTorusendend
sectionnoncomputable sectionopen _root_.Polynomial _root_.OAI.Polynomialnamespace SquareInductionopen CubeFaces CubePolynomials LeibmanSquare RationalLattice MalcevCharactersopen MeasureTheory PolynomialWeyl AbelianMalcevTorus MalcevCentralTorus RationalTailCoordinates UnitAddTorusvariable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]variable {t d : ℕ} (c : RealCoordinates G (t+d)) (hsk : SecondKind c)variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)variable [∀ i, (H.level i).Normal]variable (hs : H.level 3=⊥) (hcomm : H.level 2=_root_.commutator G)variable (q : ℕ→ℕ) (hqbound : ∀ k, q k ≤ t+d) (hq2 : q 2=t)variable (hq : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin (t+d), i.val<q k → c.coord g i=0)variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)variable [MeasurableSpace (G⧸Γ)] [BorelSpace (G⧸Γ)]
include hsk h0 h1 hs hcomm hqbound hq2 hq hΓ in
theorem quadratic_eigenfunction_observable (μ : Measure (G⧸Γ)) [IsProbabilityMeasure μ] [SMulInvariantMeasure G (G⧸Γ) μ] (δ : ℝ) (hδ : 0<δ) : letI : MetricSpace (G⧸Γ) := coordinateQuotientMetric c Γ hΓ letI : CompactSpace (G⧸Γ) := quotient_compact c Γ hΓ let htail : ∀ g : G, g∈H.level 2 ↔ ∀ i : Fin (t+d), i.val<t → c.coord g i=0 := fun g => by simpa only [hq2] using hq 2 g letI := tailAction c hsk (H.level 2) Γ (last_central_ambient H h1 2 hs) htail hΓ ∀ (F : C(G⧸Γ,ℂ)) (k : Fin d→ℤ), TorusVerticalFourier.HasWeight k F → ∃ U : Finset (G→*Multiplicative ℝ), ∃ A : ℝ, 0<A ∧ ∃ N₀ : ℕ, 0<N₀ ∧ ∀ N : ℕ, N₀ ≤ N → ∀ f : ℤ→G, LeibmanSquare.Polynomial H 0 f → f 0=1 → δ ≤ ‖FourierObstruction.discrepancy μ N (fun k => QuotientGroup.mk (f k)) F‖ → ∃ ξ∈U, ξ≠1 ∧ Continuous ξ ∧ (∀ g∈Γ, ∃ z : ℤ, (ξ g).toAdd=z) ∧ ∃ P : ℝ[X], P.natDegree ≤ 2 ∧ (∀ z : ℤ, P.eval (z:ℝ)=(ξ (f z)).toAdd) ∧ ∀ j : ℕ, 0<j → ∃ z : ℤ, |P.coeff j-z| ≤ A/(N:ℝ)^j := by classical let : MetricSpace (G⧸Γ) := coordinateQuotientMetric c Γ hΓ let : CompactSpace (G⧸Γ) := quotient_compact c Γ hΓ let htail : ∀ g : G, g∈H.level 2 ↔ ∀ i : Fin (t+d), i.val<t → c.coord g i=0 := fun g => by simpa only [hq2] using hq 2 g let hcent := last_central_ambient H h1 2 hs let := tailAction c hsk (H.level 2) Γ hcent htail hΓ let := continuous_tailAction c hsk (H.level 2) Γ hcent htail hΓ let := invariant_tailAction c hsk (H.level 2) Γ hcent htail hΓ μ dsimp only intro F k hw by_cases hk : k=0 · have hF : ∀ g a, a∈H.level 2 → F (QuotientGroup.mk (g*a))=F (QuotientGroup.mk g) := by intro g a ha have he := hw (torusProjection (tailCoordinates c (H.level 2) htail) ⟨a,ha⟩) (QuotientGroup.mk g) rw [tailProjection_vadd c hsk (H.level 2) Γ hcent htail hΓ] at he simpa only [hk,mFourier_zero,ContinuousMap.one_apply,one_mul] using he obtain ⟨U,hU,A,hA,hprod⟩ := quantitative_abelian_quotient_observable c hsk (Nat.le_add_right t d) (H.level 2) Γ hcomm.ge htail hΓ H 2 hs μ F hF δ hδ refine ⟨U,A,hA,1,by decide,?_⟩ intro N hN f hf _ hdisc obtain ⟨ξ,hξ,hξ0,P,hP,hPe,hPc⟩ := hprod N hN f hf hdisc exact ⟨ξ,hξ,hξ0,(hU ξ hξ).1,(hU ξ hξ).2,P,hP,hPe,hPc⟩ · let D : ℝ := 1+‖F‖ have hD : 0<D := by dsimp [D]; positivity let F' : C(G⧸Γ,ℂ) := (D:ℂ)⁻¹ • F have hw' : TorusVerticalFourier.HasWeight k F' := hw.smul _ have hF' : ∀ x, ‖F' x‖ ≤ 1 := by intro x change ‖(D:ℂ)⁻¹ * F x‖ ≤ 1 rw [norm_mul,norm_inv,Complex.norm_real,Real.norm_eq_abs,abs_of_pos hD] have hFx := F.norm_coe_le_norm x apply (inv_mul_le_iff₀ hD).mpr dsimp [D] linarith let χ : G→ℂ := fun g => if hg : g∈H.level 2 then mFourier k (torusProjection (tailCoordinates c (H.level 2) htail) ⟨g,hg⟩) else 1 have hχ : ∀ g∈H.level 2, ‖χ g‖=1 := by intro g hg simp only [χ,dite_eq_left hg] exact TorusVerticalFourier.character_norm _ _ have hright : ∀ a∈H.level 2, ∀ g : G, F' (QuotientGroup.mk (g*a))=χ a*F' (QuotientGroup.mk g) := by intro a ha g have he := hw' (torusProjection (tailCoordinates c (H.level 2) htail) ⟨a,ha⟩) (QuotientGroup.mk g) rw [tailProjection_vadd c hsk (H.level 2) Γ hcent htail hΓ] at he simpa only [χ,dite_eq_left ha] using he obtain ⟨s,hs⟩ := TorusVerticalFourier.character_nontrivial hk obtain ⟨a,ha⟩ := torusProjection_surjective (tailCoordinates c (H.level 2) htail) s have hχa : χ a.val≠1 := by simpa only [χ,dite_eq_left a.property,ha] using hs obtain ⟨U,A,hA,N₀,hN₀,hprod⟩ := quadratic_source_vertical_correlation c hsk H h0 h1 (show H.level 3=⊥ from ‹H.level 3=⊥›) hcomm q hqbound hq2 hq Γ hΓ F' hF' χ hχ hright a.val a.property hχa (δ/D) (div_pos hδ hD) refine ⟨U,A,hA,N₀,hN₀,?_⟩ intro N hN f hf hf0 hdisc apply hprod N hN f hf hf0 have hzero := TorusVerticalFourier.integral_hasWeight_eq_zero μ F' hk hw' have hdisc' : δ/D ≤ ‖FourierObstruction.discrepancy μ N (fun k => QuotientGroup.mk (f k)) F'‖ := by change δ/D ≤ ‖FourierObstruction.discrepancy μ N _ ((D:ℂ)⁻¹ • F)‖ rw [map_smul,norm_smul,norm_inv,Complex.norm_real,Real.norm_eq_abs,abs_of_pos hD,div_eq_inv_mul] exact mul_le_mul_of_nonneg_left hdisc (inv_nonneg.mpr hD.le) change δ/D ≤ ‖mean N (fun n => F' (QuotientGroup.mk (f n)))-(∫ x,F' x ∂μ)‖ at hdisc' simpa only [hzero,sub_zero] using hdisc'
end SquareInductionendend
endendend
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269import Mathlibimport OAI.Combinatorics.SumProduct.Alignment.CubeLocal09import OAI.Geometry.NilpotentCharts.Main
namespace OAI
sectionsectionsectionsectionnoncomputable sectionopen scoped BigOperatorsendend
sectionnoncomputable sectionopen scoped BigOperators Topology commutatorElement NNRealnamespace CubeLocalHaaropen CubeFaces LeibmanSquare CubeTaylorExpansion CubeHorizontalIrrationalityopen RationalLattice MeasureTheory Filter ComparableBoxLeibman MalcevCharacters AbelianMalcevTorusvariable {G ι : Type} [Group G] [PseudoMetricSpace G] [IsTopologicalGroup G]variable [Fintype ι] [DecidableEq ι]variable {n t d v : ℕ} (c : RealCoordinates G n) (H : Filtration G)variable (S : ℕ→Set (Fin n))variable (hH : ∀ k (g : G),g∈H.level k ↔ ∀ i∈S k,c.coord g i=0)variable (Λ : Subgroup G) (σ : G) (h01 : H.level 0=H.level 1)variable (s : ℕ) (hs : H.level (s+1)=⊥) (e : Option ι≃Fin v)variable (cc : RealCoordinates (cube H (Finset.univ : Finset ι) 0) (t+d))variable (hsk : SecondKind cc)variable (q : ℕ→ℕ) (hqbound : ∀ k,q k ≤ t+d)variable (hq : ∀ k (g : cube H (Finset.univ : Finset ι) 0), g∈(CubeMaxFiltration.filtration H Finset.univ).level k ↔ ∀ i : Fin (t+d),i.val < q k → cc.coord g i=0)variable (hΓ : ∀ g : cube H (Finset.univ : Finset ι) 0, g∈cubeLattice H (conjugateLattice Λ σ) ↔ ∀ i,∃ z : ℤ,cc.coord g i=z)variable [MeasurableSpace ((cube H (Finset.univ : Finset ι) 0)⧸cubeLattice H (conjugateLattice Λ σ))]variable [hBorel : @BorelSpace ((cube H (Finset.univ : Finset ι) 0)⧸cubeLattice H (conjugateLattice Λ σ)) (QuotientGroup.instTopologicalSpace (cubeLattice H (conjugateLattice Λ σ))) inferInstance]variable (mtr : MetricSpace ((cube H (Finset.univ : Finset ι) 0)⧸cubeLattice H (conjugateLattice Λ σ)))variable (htop : mtr.toUniformSpace.toTopologicalSpace=QuotientGroup.instTopologicalSpace (cubeLattice H (conjugateLattice Λ σ)))
variable [MeasurableSpace (G⧸Λ)] [BorelSpace (G⧸Λ)]variable [SecondCountableTopology (G⧸Λ)]
variable [CompactSpace (G⧸Λ)]variable (qmtr : MetricSpace (G⧸Λ))variable (hqtop : qmtr.toUniformSpace.toTopologicalSpace=QuotientGroup.instTopologicalSpace Λ)
include S hH h01 hs hsk hqbound hq hΓ htop hqtop in
theorem source_comparable_physical_cube_haar (μ : Measure ((cube H (Finset.univ : Finset ι) 0)⧸cubeLattice H (conjugateLattice Λ σ))) [IsProbabilityMeasure μ] [SMulInvariantMeasure (cube H (Finset.univ : Finset ι) 0) _ μ] (a : ℕ→∀ k : ℕ,H.level k) (hirr : ∀ j : ℕ,0 < j → j ≤ s → ∀ ξ : H.level j→*Multiplicative ℝ, ξ≠1 → Continuous ξ → RationalCharacter (conjugateLattice Λ σ) ξ → (∀ x (hx : x∈H.level (j+1)),ξ ⟨x,H.antitone (Nat.le_succ _) hx⟩=1) → (∀ i k : ℕ,0 < i → 0 < k → ∀ h : i+k=j, ∀ x (hx : x∈H.level i) y (hy : y∈H.level k), ξ ⟨⁅x,y⁆,by rw [←h]; exact H.commutator_le i k (Subgroup.commutator_mem_commutator hx hy)⟩=1) → Tendsto (fun N : ℕ => ‖((ξ (a N j)).toAdd:UnitAddCircle)‖*(N:ℝ)^j) atTop atTop)
(d₀ r₀ : ℕ) (hd₀ : 0<d₀) (hr₀ : r₀<d₀) (β : ℝ) (hβ : β∈Set.Icc (0:ℝ) 1) (cBox CBox C : ℝ) (hcBox : 0<cBox) (hCBox : 0<CBox) (hC : 0≤C) (g : ℕ→ℝ→G) (h : ℝ→G) (hh : ContinuousAt h β) (ρ : ℝ) (hρ : 0<ρ) (hg : ∀ ε : ℝ,0<ε → ∀ᶠ N : ℕ in atTop, ∀ t : ℝ,dist t β<ρ → dist (g N t) (h t)<ε)
(P γ : ℕ→ℤ→G) (hfactor : ∀ N : ℕ,∀ b : ℤ, QuotientGroup.mk (P N b) = (QuotientGroup.mk (g N ((b:ℝ)/(N:ℝ))*taylorPolynomial c H (a N) s (b:ℝ)*γ N b) : G⧸Λ)) (hperiod : ∀ N : ℕ,∀ b : ℤ,b%(d₀:ℤ)=(r₀:ℤ) → QuotientGroup.mk (γ N b)=(QuotientGroup.mk σ:G⧸Λ))
(L : ℝ≥0) (B : ℝ) : letI : MetricSpace (G⧸Λ) := MetricSpace.replaceTopology qmtr hqtop.symm let m : ProbabilityMeasure (Finset ι→G⧸Λ) := imageProbability H Λ σ ⟨μ,inferInstance⟩ (fun _ => h β) ∀ ε : ℝ,0<ε → ∀ᶠ α : ℝ in 𝓝[>] 0,∀ᶠ N : ℕ in atTop, ∀ lo hi : Fin v→ℝ, (∀ i,(cBox*α)*(N:ℝ)≤hi i-lo i) → (∀ i,-CBox*(N:ℝ)≤lo i ∧ hi i≤CBox*(N:ℝ)) → (∀ b∈physicalResidueRectangle lo hi (sourceResidue e r₀) d₀, |((b (e none):ℝ)/(N:ℝ))-β|≤C*α ∧ ∀ i : ι,|((b (e (some i)):ℝ)/(N:ℝ))|≤C*α) → ∀ F : C((Finset ι→G⧸Λ),ℂ), LipschitzWith L F → ‖F‖≤B → ‖(𝔼 b∈physicalResidueRectangle lo hi (sourceResidue e r₀) d₀, F (fun w : Finset ι => QuotientGroup.mk (P N (b (e none)+∑ i∈w,b (e (some i))))))- (∫ y,F y ∂(m:Measure (Finset ι→G⧸Λ)))‖<ε := by let : MetricSpace (G⧸Λ) := MetricSpace.replaceTopology qmtr hqtop.symm intro m have hd : 0<(d₀:ℝ) := by exact_mod_cast hd₀ have hr : ∀ i : Fin v,0 ≤ sourceResidue e r₀ i ∧ sourceResidue e r₀ i<(d₀:ℤ) := by intro i have hd' : (0:ℤ)<d₀ := by exact_mod_cast hd₀ have hr' : (r₀:ℤ)<d₀ := by exact_mod_cast hr₀ unfold sourceResidue split_ifs · exact ⟨by positivity,hr'⟩ · exact ⟨le_refl 0,hd'⟩ let C' : ℝ := (CBox+(d₀:ℝ))/(d₀:ℝ) have hC' : 0<C' := div_pos (add_pos hCBox hd) hd have he := source_comparable_boxes_cube_haar c H S hH Λ σ h01 s hs e cc hsk q hqbound hq hΓ mtr htop qmtr hqtop μ a hirr d₀ r₀ hd₀ hr₀ β hβ (cBox/(d₀:ℝ)) C' C (div_pos hcBox hd) hC' hC g h hh ρ hρ hg P γ hfactor hperiod L B have hv (z : Fin v→ℤ) (w : Finset ι) : sourceResidue e r₀ (e none)+(d₀:ℤ)*z (e none)+ ∑ i∈w,(sourceResidue e r₀ (e (some i))+(d₀:ℤ)*z (e (some i))) = sourceVertex e d₀ r₀ z w := by simp [sourceResidue,sourceVertex,mul_add,Finset.mul_sum,add_assoc] intro ε hε filter_upwards [he ε hε] with α hα filter_upwards [hα,Filter.eventually_ge_atTop (1:ℕ)] with N hN hN1 intro lo hi hside habs hlocal F hL hB let lo' : Fin v→ℝ := fun i => (lo i-(sourceResidue e r₀ i:ℝ))/(d₀:ℝ) let hi' : Fin v→ℝ := fun i => (hi i-(sourceResidue e r₀ i:ℝ))/(d₀:ℝ) have hs' : ∀ i,((cBox/(d₀:ℝ))*α)*(N:ℝ)≤hi' i-lo' i := by intro i have hh := div_le_div_of_nonneg_right (hside i) hd.le dsimp only [hi',lo'] have h₁ : ((cBox/(d₀:ℝ))*α)*(N:ℝ)=((cBox*α)*(N:ℝ))/(d₀:ℝ) := by ring have h₂ : (hi i-(sourceResidue e r₀ i:ℝ))/(d₀:ℝ)- (lo i-(sourceResidue e r₀ i:ℝ))/(d₀:ℝ)=(hi i-lo i)/(d₀:ℝ) := by ring rw [h₁,h₂] exact hh have ha' : ∀ i,-C'*(N:ℝ)≤lo' i ∧ hi' i≤C'*(N:ℝ) := by intro i have hn : (1:ℝ)≤N := by exact_mod_cast hN1 have hr0 : (0:ℝ)≤(sourceResidue e r₀ i:ℝ) := by exact_mod_cast (hr i).1 have hrd : (sourceResidue e r₀ i:ℝ)<(d₀:ℝ) := by exact_mod_cast (hr i).2 dsimp only [lo',hi',C'] rw [le_div_iff₀ hd,div_le_iff₀ hd] have hx : -((CBox+(d₀:ℝ))/(d₀:ℝ))*(N:ℝ)*(d₀:ℝ)= -(CBox+(d₀:ℝ))*(N:ℝ) := by field_simp have hy : ((CBox+(d₀:ℝ))/(d₀:ℝ))*(N:ℝ)*(d₀:ℝ)= (CBox+(d₀:ℝ))*(N:ℝ) := by field_simp rw [hx,hy] constructor <;> nlinarith [(habs i).1,(habs i).2] have hl' : ∀ z∈halfOpenBox v lo' hi', |(((sourceResidue e r₀ (e none)+(d₀:ℤ)*z (e none):ℤ):ℝ)/(N:ℝ))-β|≤C*α ∧ ∀ i : ι,|(((sourceResidue e r₀ (e (some i))+(d₀:ℤ)*z (e (some i)):ℤ):ℝ)/(N:ℝ))|≤C*α := by intro z hz exact hlocal _ ((physicalResidueRectangle_affine lo hi (sourceResidue e r₀) d₀ hd₀ hr z).mpr hz) rw [physicalResidueRectangle_expect lo hi (sourceResidue e r₀) d₀ hd₀ hr] simp_rw [hv] exact hN lo' hi' hs' ha' hl' F hL hB
end CubeLocalHaarendend end
section
noncomputable sectionnamespace RationalLatticevariable {G K : Type*} [Group G] [Group K] [TopologicalSpace G] [TopologicalSpace K]variable {m n : ℕ}
lemma scaledCoordinates_rational (d : RealCoordinates K n) (w : Fin n → ℕ) (hpos : ∀ i,0<w i) (g : K) : IsRational (scaledCoordinates d w hpos) g ↔ IsRational d g := by constructor · intro hg i obtain ⟨q,hq⟩:=hg i refine ⟨(w i:ℚ)*q,?_⟩ push_cast change (w i:ℝ)*q=d.coord g i change (q:ℝ)=d.coord g i/(w i:ℝ) at hq rw [hq] exact mul_div_cancel₀ _ (by exact_mod_cast (hpos i).ne') · intro hg i obtain ⟨q,hq⟩:=hg i refine ⟨q/(w i:ℚ),?_⟩ push_cast change (q:ℝ)/(w i:ℝ)=d.coord g i/(w i:ℝ) rw [hq]
lemma secondCoordinates_rational [IsTopologicalGroup K] (d : RealCoordinates K n) (g : K) : IsRational (secondCoordinates d) g ↔ IsRational d g := by constructor · intro h have he:=expProduct_rational d h change IsRational d (expProduct d (expCoordinates d g)) at he rwa [expProduct_expCoordinates] at he · exact expCoordinates_rational d
variable (c : RealCoordinates G m) (d : RealCoordinates K n)variable (F : K →* G)variable (hpoly : ∀ i,RationalPolynomialMap.IsPolynomial (fun x : Fin n → ℝ => c.coord (F (d.coord.symm x)) i))
include hpoly inlemma rationalHom_rational {g : K} (hg : IsRational d g) : IsRational c (F g) := by intro i obtain ⟨P,hP⟩:=hpoly i obtain ⟨q,hq⟩:=eval_rational P (d.coord g) hg refine ⟨q,?_⟩ rw [hq,←hP] simp
variable [IsTopologicalGroup G] [IsTopologicalGroup K]variable (Γ : Subgroup G)variable (hΓ : ∀ g : G,g∈Γ ↔ ∀ i,∃ z : ℤ,c.coord g i=z)variable (hc : Continuous F) (hinj : Function.Injective F)include hpoly hΓ hc hinj in
theorem exists_integer_sublattice_rational : ∃ Λ : Subgroup K,∃ e : RealCoordinates K n, (∀ g : K,g∈Λ ↔ ∀ i,∃ z : ℤ,e.coord g i=z) ∧ Λ≤Γ.comap F ∧ (Λ.subgroupOf (Γ.comap F)).FiniteIndex ∧ (∀ g : K,∀ i,e.coord g i=0 ↔ d.coord g i=0) ∧ (∀ g : K,IsRational e g ↔ IsRational d g) := by classical obtain ⟨E,hE,hgrid⟩:=rationalHom_origin_grid c d F hpoly obtain ⟨w,hpos,hEw,hw⟩:=exists_lattice_weights d E hE let Λ:=weightedLattice d w hw let e:=scaledCoordinates d w hpos have hΛ : ∀ g : K,g∈Λ ↔ ∀ i,∃ z : ℤ,e.coord g i=z := weightedLattice_iff d w hw hpos have hle : Λ≤Γ.comap F := by intro g hg apply (hΓ (F g)).mpr have hx : ∀ j,∃ z : ℤ,d.coord g j=(E:ℝ)*(z:ℝ) := by intro j obtain ⟨a,ha⟩:=hg j obtain ⟨b,hb⟩:=hEw j refine ⟨(b:ℤ)*a,?_⟩ rw [ha,hb] push_cast ring simpa using hgrid (d.coord g) hx let : T2Space K:=d.coord.symm.t2Space let : DiscreteTopology Γ:=integerCoordinates_discrete c Γ hΓ let : DiscreteTopology (Γ.comap F):= DiscreteTopology.preimage_of_continuous_injective (Γ:Set G) hc hinj obtain ⟨C,hC,hrep⟩:=compact_reps_of_integerCoordinates e Λ hΛ have hi:=TriangularDenominators.finiteIndex_of_compact_reps Λ (Γ.comap F) hle C hC hrep refine ⟨Λ,e,hΛ,hle,hi,?_,scaledCoordinates_rational d w hpos⟩ intro g i change d.coord g i/(w i:ℝ)=0 ↔ d.coord g i=0 rw [div_eq_zero_iff] have hn : (w i:ℝ)≠0 := by exact_mod_cast (hpos i).ne' simp [hn]
end RationalLattice
endendendend
end OAIlean/OAI/Combinatorics/SumProduct/Alignment/MalcevHorizontal03.leanAdded+354
lean/OAI/Combinatorics/SumProduct/Alignment/MalcevTail01.leanAdded+369
lean/OAI/Combinatorics/SumProduct/Alignment/MalcevTail02.leanAdded+337
lean/OAI/Combinatorics/SumProduct/Alignment/MalcevTail03.leanAdded+273
lean/OAI/Combinatorics/SumProduct/Alignment/MalcevWeighted01.leanAdded+290
lean/OAI/Combinatorics/SumProduct/Alignment/MalcevWeighted02.leanAdded+273
lean/OAI/Combinatorics/SumProduct/Alignment/MenuLiteral01.leanAdded+172
lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellFibers01.leanAdded+263
lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellHarmonic01.leanAdded+282
lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellSaturation01.leanAdded+400
lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellScale01.leanAdded+334
lean/OAI/Combinatorics/SumProduct/Alignment/NearLattice01.leanAdded+314
lean/OAI/Combinatorics/SumProduct/Alignment/PairTail01.leanAdded+316
lean/OAI/Combinatorics/SumProduct/Alignment/PairTail02.leanAdded+279
lean/OAI/Combinatorics/SumProduct/Alignment/PairTail03.leanAdded+271
lean/OAI/Combinatorics/SumProduct/Alignment/PairTail04.leanAdded+302
lean/OAI/Combinatorics/SumProduct/Alignment/PairTail05.leanAdded+342
lean/OAI/Combinatorics/SumProduct/Alignment/PairTail06.leanAdded+369
lean/OAI/Combinatorics/SumProduct/Alignment/ParametricSmooth01.leanAdded+408
lean/OAI/Combinatorics/SumProduct/Alignment/PhysicalDecay01.leanAdded+332
lean/OAI/Combinatorics/SumProduct/Alignment/PivotExtension01.leanAdded+312
lean/OAI/Combinatorics/SumProduct/Alignment/PivotExtension02.leanAdded+368
lean/OAI/Combinatorics/SumProduct/Alignment/PivotPaths01.leanAdded+276
lean/OAI/Combinatorics/SumProduct/Alignment/PivotPaths02.leanAdded+406
lean/OAI/Combinatorics/SumProduct/Alignment/PivotPaths03.leanAdded+416
lean/OAI/Combinatorics/SumProduct/Alignment/PointLaw01.leanAdded+289
lean/OAI/Combinatorics/SumProduct/Alignment/PointLaw02.leanAdded+255
lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialArray01.leanAdded+279
lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialCharacter01.leanAdded+342
lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialDephasing01.leanAdded+477
lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialLine01.leanAdded+360
lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialWeyl01.leanAdded+618
lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure01.leanAdded+275
lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure02.leanAdded+369
lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure03.leanAdded+266
lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure04.leanAdded+297
lean/OAI/Combinatorics/SumProduct/Alignment/ProgressionPartition01.leanAdded+259
lean/OAI/Combinatorics/SumProduct/Alignment/RationalEchelon01.leanAdded+321
lean/OAI/Combinatorics/SumProduct/Alignment/RationalEchelon02.leanAdded+361
lean/OAI/Combinatorics/SumProduct/Alignment/RationalFactor01.leanAdded+308
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice01.leanAdded+257
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice02.leanAdded+291
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice03.leanAdded+308
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice04.leanAdded+367
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice05.leanAdded+443
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice06.leanAdded+309
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice07.leanAdded+289
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice08.leanAdded+414
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice09.leanAdded+267
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice10.leanAdded+269