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
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevHorizontal03.lean +354 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevTail01.lean +369 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevTail02.lean +337 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevTail03.lean +273 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevWeighted01.lean +290 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/MalcevWeighted02.lean +273 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/MenuLiteral01.lean +172 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellFibers01.lean +263 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellHarmonic01.lean +282 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellSaturation01.lean +400 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellScale01.lean +334 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/NearLattice01.lean +314 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail01.lean +316 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail02.lean +279 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail03.lean +271 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail04.lean +302 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail05.lean +342 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PairTail06.lean +369 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/ParametricSmooth01.lean +408 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PhysicalDecay01.lean +332 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PivotExtension01.lean +312 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PivotExtension02.lean +368 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PivotPaths01.lean +276 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PivotPaths02.lean +406 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PivotPaths03.lean +416 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PointLaw01.lean +289 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PointLaw02.lean +255 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialArray01.lean +279 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialCharacter01.lean +342 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialDephasing01.lean +477 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialLine01.lean +360 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialWeyl01.lean +618 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure01.lean +275 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure02.lean +369 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure03.lean +266 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure04.lean +297 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/ProgressionPartition01.lean +259 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalEchelon01.lean +321 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalEchelon02.lean +361 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalFactor01.lean +308 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice01.lean +257 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice02.lean +291 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice03.lean +308 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice04.lean +367 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice05.lean +443 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice06.lean +309 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice07.lean +289 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice08.lean +414 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice09.lean +267 -0
- lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice10.lean +269 -0
lean/OAI/Combinatorics/SumProduct/Alignment/MalcevHorizontal03.lean
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.CharacterFactorization01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
open scoped BigOperators commutatorElement
|
| 12 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 13 |
+
noncomputable section
|
| 14 |
+
end
|
| 15 |
+
end
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
section
|
| 20 |
+
open scoped BigOperators commutatorElement
|
| 21 |
+
noncomputable section
|
| 22 |
+
namespace RealCharacters
|
| 23 |
+
variable {G : Type*} [Group G]
|
| 24 |
+
def scaledFamily (Ξ : Finset (G →* Multiplicative ℝ)) (R : ℕ) : Finset (G →* Multiplicative ℝ) := by
|
| 25 |
+
classical
|
| 26 |
+
exact Ξ.biUnion (fun χ => (Finset.Icc (-(R:ℤ)) (R:ℤ)).image (intScale χ))
|
| 27 |
+
lemma mem_scaledFamily {Ξ : Finset (G →* Multiplicative ℝ)} {R : ℕ}
|
| 28 |
+
{χ : G →* Multiplicative ℝ} {q : ℤ} (hχ : χ∈Ξ) (hq : |q| ≤ R) :
|
| 29 |
+
intScale χ q∈scaledFamily Ξ R := by
|
| 30 |
+
classical
|
| 31 |
+
exact Finset.mem_biUnion.mpr ⟨χ,hχ,Finset.mem_image.mpr ⟨q,Finset.mem_Icc.mpr (abs_le.mp hq),rfl⟩⟩
|
| 32 |
+
lemma scaledFamily_continuous [TopologicalSpace G] (Ξ : Finset (G →* Multiplicative ℝ)) (R : ℕ)
|
| 33 |
+
(hχ : ∀ χ∈Ξ, Continuous χ) : ∀ χ∈scaledFamily Ξ R, Continuous χ := by
|
| 34 |
+
classical
|
| 35 |
+
intro χ hm
|
| 36 |
+
obtain ⟨ψ,hψ,hm⟩ := Finset.mem_biUnion.mp hm
|
| 37 |
+
obtain ⟨q,hq,rfl⟩ := Finset.mem_image.mp hm
|
| 38 |
+
exact intScale_continuous ψ q (hχ ψ hψ)
|
| 39 |
+
lemma scaledFamily_integral (Ξ : Finset (G →* Multiplicative ℝ)) (R : ℕ) (Γ : Subgroup G)
|
| 40 |
+
(hχ : ∀ χ∈Ξ, ∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z) :
|
| 41 |
+
∀ χ∈scaledFamily Ξ R, ∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z := by
|
| 42 |
+
classical
|
| 43 |
+
intro χ hm
|
| 44 |
+
obtain ⟨ψ,hψ,hm⟩ := Finset.mem_biUnion.mp hm
|
| 45 |
+
obtain ⟨q,hq,rfl⟩ := Finset.mem_image.mp hm
|
| 46 |
+
exact intScale_integral ψ q Γ (hχ ψ hψ)
|
| 47 |
+
end RealCharacters
|
| 48 |
+
namespace MalcevHorizontal
|
| 49 |
+
open RationalLattice
|
| 50 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 51 |
+
variable {n d : ℕ} (c : RealCoordinates G n) (hd : d ≤ n)
|
| 52 |
+
variable (hlin : ∀ i : Fin d, c.correction (Fin.castLE hd i)=0)
|
| 53 |
+
def boundedCharacters (R : ℕ) : Finset (G →* Multiplicative ℝ) := by
|
| 54 |
+
classical
|
| 55 |
+
exact (Fintype.piFinset (fun _ : Fin d => Finset.Icc (-(R:ℤ)) (R:ℤ))).image (character c hd hlin)
|
| 56 |
+
omit [IsTopologicalGroup G] in
|
| 57 |
+
lemma mem_boundedCharacters (R : ℕ) (k : Fin d → ℤ) (hk : ∀ i, |k i| ≤ R) :
|
| 58 |
+
character c hd hlin k∈boundedCharacters c hd hlin R := by
|
| 59 |
+
classical
|
| 60 |
+
exact Finset.mem_image.mpr ⟨k,Fintype.mem_piFinset.mpr (fun i => Finset.mem_Icc.mpr (abs_le.mp (hk i))),rfl⟩
|
| 61 |
+
omit [IsTopologicalGroup G] in
|
| 62 |
+
lemma boundedCharacters_continuous (R : ℕ) :
|
| 63 |
+
∀ χ∈boundedCharacters c hd hlin R, Continuous χ := by
|
| 64 |
+
classical
|
| 65 |
+
intro χ hm
|
| 66 |
+
obtain ⟨k,hk,rfl⟩ := Finset.mem_image.mp hm
|
| 67 |
+
exact character_continuous c hd hlin k
|
| 68 |
+
omit [IsTopologicalGroup G] in
|
| 69 |
+
lemma boundedCharacters_integral (R : ℕ) (Γ : Subgroup G)
|
| 70 |
+
(hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z) :
|
| 71 |
+
∀ χ∈boundedCharacters c hd hlin R, ∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z := by
|
| 72 |
+
classical
|
| 73 |
+
intro χ hm
|
| 74 |
+
obtain ⟨k,hk,rfl⟩ := Finset.mem_image.mp hm
|
| 75 |
+
exact fun _ hg => character_integer c hd hlin Γ hΓ k hg
|
| 76 |
+
end MalcevHorizontal
|
| 77 |
+
end
|
| 78 |
+
end
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
section
|
| 83 |
+
noncomputable section
|
| 84 |
+
open scoped BigOperators commutatorElement
|
| 85 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 86 |
+
namespace MalcevHorizontal
|
| 87 |
+
open RationalLattice CubeFaces LeibmanSquare SquareHorizontalCharacter
|
| 88 |
+
open RealCharacters CharacterFactorization MalcevCharacters
|
| 89 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] [T2Space G]
|
| 90 |
+
variable {n d m : ℕ} (c : RealCoordinates G n) (hd : d ≤ n)
|
| 91 |
+
variable (hlin : ∀ i : Fin d, c.correction (Fin.castLE hd i)=0)
|
| 92 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 93 |
+
variable [∀ i, (H.level i).Normal]
|
| 94 |
+
variable (hlevel : ∀ g : G, g∈H.level 2 ↔ horizontal c hd g=0)
|
| 95 |
+
variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
|
| 96 |
+
variable (c₂ : RealCoordinates (H.level 2) m) (hsk₂ : SecondKind c₂)
|
| 97 |
+
variable (hΓ₂ : ∀ x : H.level 2, x.val∈Γ ↔ ∀ i, ∃ z : ℤ, c₂.coord x i=z)
|
| 98 |
+
|
| 99 |
+
include hlin hlevel hΓ hsk₂ hΓ₂ in
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
theorem uniform_character_or_proper_factorization (s : ℕ) (hs2 : 2 ≤ s) (hs : H.level (s+1)=⊥)
|
| 103 |
+
(r : Fin (s+1) → ℕ)
|
| 104 |
+
(hlevel₂ : ∀ i (x : H.level 2), x.val∈H.level (i.val+2) ↔
|
| 105 |
+
∀ u : Fin m, u.val<r i → c₂.coord x u=0)
|
| 106 |
+
(Ξ : Finset (level H h0 1 →* Multiplicative ℝ))
|
| 107 |
+
(hΞc : ∀ ξ∈Ξ, Continuous ξ)
|
| 108 |
+
(hΞΓ : ∀ ξ∈Ξ, ∀ x : level H h0 1, x.val∈Γ.prod Γ → ∃ z : ℤ, (ξ x).toAdd=z)
|
| 109 |
+
(δ A E : ℝ) (hδ : 0<δ) (hA : 0 ≤ A) :
|
| 110 |
+
∃ U : Finset (G →* Multiplicative ℝ), ∃ V : Finset (H.level 2 →* Multiplicative ℝ),
|
| 111 |
+
∃ C : ℝ, 0<C ∧ ∃ B : ℝ, 0<B ∧ ∃ Tmax : ℕ, 0<Tmax ∧ ∃ N₀ : ℕ, 0<N₀ ∧
|
| 112 |
+
∀ N : ℕ, N₀ ≤ N → ∀ ξ∈Ξ, ξ≠1 →
|
| 113 |
+
∀ (f : ℤ → G) (hf : Polynomial H 0 f) (hf0 : f 0=1),
|
| 114 |
+
‖horizontal c hd (f 1)‖ ≤ 1 →
|
| 115 |
+
∀ v : ℕ → G, (∀ h, ‖horizontal c hd (v h)‖ ≤ 1) →
|
| 116 |
+
(∀ h, (v h)⁻¹*f 1^h∈Γ) →
|
| 117 |
+
∀ S : Finset ℕ, S⊆Finset.range N → δ*N ≤ (S.card:ℝ) →
|
| 118 |
+
(∀ h∈S, ∃ W : ℝ[X],
|
| 119 |
+
(∀ z : ℤ, W.eval (z:ℝ)=
|
| 120 |
+
(ξ (linearNormalizedPair H h0 h1 hf (linearRemainder H h0 hf hf0 h) h (v h) z)).toAdd) ∧
|
| 121 |
+
∀ j : ℕ, 0<j → j ≤ s → ∃ z : ℤ, |W.coeff j-z| ≤ A/(N:ℝ)^j) →
|
| 122 |
+
(∃ χ∈U, χ≠1 ∧ Continuous χ ∧ (∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z) ∧
|
| 123 |
+
∃ P : ℝ[X], P.natDegree ≤ s ∧ (∀ z : ℤ, P.eval (z:ℝ)=(χ (f z)).toAdd) ∧
|
| 124 |
+
∀ j : ℕ, 0<j → ∃ z : ℤ, |P.coeff j-z| ≤ C/(N:ℝ)^j) ∨
|
| 125 |
+
(∃ χ∈V, χ≠1 ∧ Continuous χ ∧ (∀ x : H.level 2, x.val∈Γ → ∃ z : ℤ, (χ x).toAdd=z) ∧
|
| 126 |
+
∃ hc : ∀ a b : G, ⁅a,b⁆∈χ.ker.map (H.level 2).subtype,
|
| 127 |
+
χ.ker.map (H.level 2).subtype < H.level 2 ∧
|
| 128 |
+
∃ T : ℕ, 0<T ∧ T ≤ Tmax ∧ SmoothFactorizationAt H Γ c₂ χ hc E B N T f) := by
|
| 129 |
+
classical
|
| 130 |
+
obtain ⟨R,hR,C,hC,N₀,hN₀,hdesc⟩ := geometric_scalar_descent c hd hlin H h0 h1 hlevel Γ hΓ
|
| 131 |
+
s hs2 hs Ξ δ A hδ hA
|
| 132 |
+
let U := boundedCharacters c hd hlin R ∪
|
| 133 |
+
scaledFamily (Ξ.image (fun ξ => ξ.comp (diagonal H h0 h1))) R
|
| 134 |
+
let V := scaledFamily (Ξ.image (fun ξ => ξ.comp (lower H h0))) R
|
| 135 |
+
have hVc : ∀ χ∈V, Continuous χ := by
|
| 136 |
+
apply scaledFamily_continuous
|
| 137 |
+
intro χ hm
|
| 138 |
+
obtain ⟨ξ,hξ,rfl⟩ := Finset.mem_image.mp hm
|
| 139 |
+
exact (hΞc ξ hξ).comp (lower_continuous H h0)
|
| 140 |
+
have hVΓ : ∀ χ∈V, ∀ x : H.level 2, x.val∈Γ → ∃ z : ℤ, (χ x).toAdd=z := by
|
| 141 |
+
apply scaledFamily_integral _ _ (Γ.comap (H.level 2).subtype)
|
| 142 |
+
intro χ hm
|
| 143 |
+
obtain ⟨ξ,hξ,rfl⟩ := Finset.mem_image.mp hm
|
| 144 |
+
exact lower_integral H h0 ξ Γ (hΞΓ ξ hξ)
|
| 145 |
+
obtain ⟨B,hB,Tmax,hTmax,hfactor⟩ := finite_lower_factorizations H Γ c₂ h0 hsk₂ hΓ₂ hs r hlevel₂
|
| 146 |
+
V hVc hVΓ s E C hC.le
|
| 147 |
+
refine ⟨U,V,C,hC,B,hB,Tmax,hTmax,N₀,hN₀,?_⟩
|
| 148 |
+
intro N hNN ξ hξ hξ0 f hf hf0 hf1 v hv hvΓ S hSN hS hsmall
|
| 149 |
+
have hN : 1 ≤ (N:ℝ) := by exact_mod_cast (Nat.succ_le_iff.mpr (hN₀.trans_le hNN))
|
| 150 |
+
rcases hdesc N hNN ξ hξ (hΞc ξ hξ) (hΞΓ ξ hξ) f hf hf0 hf1 v hv hvΓ S hSN hS hsmall with hob | hzero
|
| 151 |
+
· left
|
| 152 |
+
obtain ⟨k,hk,hkR,χ,hχeq,hχ0,hχc,hχΓ,P,hP,hPe,hPc⟩ := hob
|
| 153 |
+
refine ⟨χ,?_,hχ0,hχc,hχΓ,P,hP.trans (by omega),hPe,hPc⟩
|
| 154 |
+
exact Finset.mem_union_left _ (hχeq ▸ mem_boundedCharacters c hd hlin R k hkR)
|
| 155 |
+
· obtain ⟨hp,q,hq,hqR,P,Q,hP,hQ,hQ0,hQ1,hPe,hQe,hPc,hQc⟩ := hzero
|
| 156 |
+
by_cases hd0 : ξ.comp (diagonal H h0 h1)=1
|
| 157 |
+
· right
|
| 158 |
+
let χ := intScale (ξ.comp (lower H h0)) q
|
| 159 |
+
have hχV : χ∈V := mem_scaledFamily (Finset.mem_image.mpr ⟨ξ,hξ,rfl⟩) hqR
|
| 160 |
+
have hχ0 : χ≠1 := intScale_ne_one _ hq (lower_ne_one_of_diagonal H h0 h1 ξ hξ0 hd0)
|
| 161 |
+
have hc : ∀ a b : G, ⁅a,b⁆∈χ.ker.map (H.level 2).subtype := zero_pairing_kernel H h0 h1 ξ q hp
|
| 162 |
+
refine ⟨χ,hχV,hχ0,hVc χ hχV,hVΓ χ hχV,hc,lower_kernel_lt H χ hχ0,?_⟩
|
| 163 |
+
apply hfactor χ hχV hc (N:ℝ) hN f hf hf0 (by rw [h1]; trivial) (Polynomial.C (q:ℝ)*Q)
|
| 164 |
+
· exact (natDegree_C_mul_le _ _).trans hQ
|
| 165 |
+
· intro z
|
| 166 |
+
simp only [eval_mul,eval_C,hQe,intScale_apply,χ]
|
| 167 |
+
· intro j hj
|
| 168 |
+
simpa only [coeff_C_mul] using hQc j hj
|
| 169 |
+
· left
|
| 170 |
+
let χ := intScale (ξ.comp (diagonal H h0 h1)) q
|
| 171 |
+
have hχU : χ∈U := Finset.mem_union_right _
|
| 172 |
+
(mem_scaledFamily (Finset.mem_image.mpr ⟨ξ,hξ,rfl⟩) hqR)
|
| 173 |
+
refine ⟨χ,hχU,intScale_ne_one _ hq hd0,
|
| 174 |
+
intScale_continuous _ q ((hΞc ξ hξ).comp (diagonal_continuous H h0 h1)),
|
| 175 |
+
intScale_integral _ q Γ (diagonal_integral H h0 h1 ξ Γ (hΞΓ ξ hξ)),
|
| 176 |
+
Polynomial.C (q:ℝ)*P,(natDegree_C_mul_le _ _).trans hP,?_,?_⟩
|
| 177 |
+
· intro z
|
| 178 |
+
simp only [eval_mul,eval_C,hPe,intScale_apply,χ]
|
| 179 |
+
· intro j hj
|
| 180 |
+
simpa only [coeff_C_mul] using hPc j hj
|
| 181 |
+
|
| 182 |
+
end MalcevHorizontal
|
| 183 |
+
end
|
| 184 |
+
end
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
section
|
| 189 |
+
noncomputable section
|
| 190 |
+
open scoped commutatorElement
|
| 191 |
+
namespace LeibmanSquare
|
| 192 |
+
open CubeFaces CubePolynomials RationalLattice
|
| 193 |
+
variable {G : Type*} [Group G]
|
| 194 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 195 |
+
|
| 196 |
+
include h1 in
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
lemma lattice_linear_normalization (Γ : Subgroup G) {f : ℤ → G}
|
| 200 |
+
(hf : Polynomial H 0 f) (hf0 : f 0=1)
|
| 201 |
+
(v γ : G) (hγ : γ∈Γ) (hav : f 1=v*γ) :
|
| 202 |
+
let g:=fun n : ℤ => f n*(γ^n)⁻¹
|
| 203 |
+
Polynomial H 0 g ∧ g 0=1 ∧ g 1=v ∧
|
| 204 |
+
∀ n, QuotientGroup.mk (g n)=(QuotientGroup.mk (f n):G⧸Γ) := by
|
| 205 |
+
dsimp only
|
| 206 |
+
have hlin : (fun n : ℤ => γ^n)∈polynomials H 0 := by
|
| 207 |
+
simpa using NilpotentTaylor.binomial_mem (H:=H) 1 0 γ (by rw [Nat.add_zero,h1]; trivial)
|
| 208 |
+
refine ⟨polynomial_of_cube_mem _ ((polynomials H 0).mul_mem
|
| 209 |
+
(cube_mem_of_polynomial _ hf) ((polynomials H 0).inv_mem hlin)),?_,?_,?_⟩
|
| 210 |
+
· simp [hf0]
|
| 211 |
+
· simp [hav,mul_assoc]
|
| 212 |
+
· intro n
|
| 213 |
+
exact QuotientGroup.mk_mul_of_mem _ (Γ.inv_mem (Γ.zpow_mem hγ n))
|
| 214 |
+
|
| 215 |
+
include h0 in
|
| 216 |
+
lemma polynomial_conjugate {f : ℤ → G} (hf : Polynomial H 0 f) (a : G) :
|
| 217 |
+
Polynomial H 0 (fun n => a*f n*a⁻¹) := by
|
| 218 |
+
apply polynomial_of_cube_mem
|
| 219 |
+
apply (polynomials H 0).mul_mem
|
| 220 |
+
· exact (polynomials H 0).mul_mem (const_mem (by rw [h0]; trivial))
|
| 221 |
+
(cube_mem_of_polynomial _ hf)
|
| 222 |
+
· exact const_mem (by rw [h0]; trivial)
|
| 223 |
+
|
| 224 |
+
include h0 in
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
lemma constant_normalization (Γ : Subgroup G) {f : ℤ → G}
|
| 228 |
+
(hf : Polynomial H 0 f) (v γ : G) (hγ : γ∈Γ) (hav : f 0=v*γ) :
|
| 229 |
+
let g:=fun n => γ*(f 0)⁻¹*f n*γ⁻¹
|
| 230 |
+
Polynomial H 0 g ∧ g 0=1 ∧
|
| 231 |
+
∀ n, QuotientGroup.mk (v*g n)=(QuotientGroup.mk (f n):G⧸Γ) := by
|
| 232 |
+
dsimp only
|
| 233 |
+
have hp : Polynomial H 0 (fun n => γ*(f 0)⁻¹*f n*γ⁻¹) := by
|
| 234 |
+
apply polynomial_of_cube_mem
|
| 235 |
+
exact (polynomials H 0).mul_mem ((polynomials H 0).mul_mem
|
| 236 |
+
(const_mem (by rw [h0]; trivial)) (cube_mem_of_polynomial _ hf))
|
| 237 |
+
(const_mem (by rw [h0]; trivial))
|
| 238 |
+
refine ⟨hp,by group,?_⟩
|
| 239 |
+
intro n
|
| 240 |
+
have he : v*(γ*(f 0)⁻¹*f n*γ⁻¹)=f n*γ⁻¹ := by rw [hav]; group
|
| 241 |
+
rw [he,QuotientGroup.mk_mul_of_mem _ (Γ.inv_mem hγ)]
|
| 242 |
+
|
| 243 |
+
end LeibmanSquare
|
| 244 |
+
end
|
| 245 |
+
end
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
section
|
| 250 |
+
noncomputable section
|
| 251 |
+
open scoped ComplexConjugate
|
| 252 |
+
namespace SquareInduction
|
| 253 |
+
open CubeFaces CubePolynomials LeibmanSquare PolynomialWeyl MeasureTheory UniformSquareObservable CompactFamilyDescent
|
| 254 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
theorem uniform_dense_linear_square_descent
|
| 259 |
+
(H : Filtration G) (h0 : H.level 0 = ⊤) (h1 : H.level 1 = ⊤)
|
| 260 |
+
(Γ : Subgroup G) (s : ℕ) (hs2 : 2 ≤ s) (hs : H.level (s+1) = ⊥)
|
| 261 |
+
[TopologicalSpace.MetrizableSpace (ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs)]
|
| 262 |
+
[CompactSpace (ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs)]
|
| 263 |
+
(F : C(G ⧸ Γ,ℂ)) (hF : ∀ x, ‖F x‖ ≤ 1) (χ : G → ℂ)
|
| 264 |
+
(hχ : ∀ n ∈ H.level s, ‖χ n‖ = 1)
|
| 265 |
+
(hw : ∀ n ∈ H.level s, ∀ x : G,
|
| 266 |
+
F (QuotientGroup.mk (x*n)) = χ n * F (QuotientGroup.mk x))
|
| 267 |
+
(z : G) (hz : z ∈ H.level s) (hχz : χ z ≠ 1)
|
| 268 |
+
(C : Set G) (hCc : IsCompact C) (hC : ∀ g : G, ∃ c ∈ C, c⁻¹*g ∈ Γ)
|
| 269 |
+
(δ : ℝ) (hδ : 0 < δ) :
|
| 270 |
+
let R := restricted H h0
|
| 271 |
+
letI := last_normal H h0 (by omega : 1 ≤ s) hs
|
| 272 |
+
let π := QuotientGroup.mk' (R.level s)
|
| 273 |
+
let Q := mapFiltration R π
|
| 274 |
+
let X := ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs
|
| 275 |
+
letI := TopologicalSpace.metrizableSpaceMetric X
|
| 276 |
+
letI : MeasurableSpace X := borel X
|
| 277 |
+
∃ tests : Finset {Ψ : C(X,ℂ) // Ψ ∈ lipschitzMaps (Y := X)},
|
| 278 |
+
∃ η : ℝ, 0 < η ∧
|
| 279 |
+
∀ μ : Measure X, IsProbabilityMeasure μ →
|
| 280 |
+
SMulInvariantMeasure ((level H h0 1) ⧸ R.level s) X μ →
|
| 281 |
+
∀ (f : ℤ → G) (hf : Polynomial H 0 f) (hf0 : f 0=1),
|
| 282 |
+
∀ N T : ℕ, 0 < N → 0 < T →
|
| 283 |
+
δ ≤ ‖mean N (fun n => F (QuotientGroup.mk (f n)))‖ →
|
| 284 |
+
4 * (T : ℝ) / N ≤ δ^2/4 →
|
| 285 |
+
∃ A : Finset ℕ,
|
| 286 |
+
(∀ h ∈ A, h < T) ∧ δ^2/8*T ≤ (A.card : ℝ) ∧
|
| 287 |
+
∀ h ∈ A, ∃ Ψ ∈ tests, ∃ v ∈ C, ∃ γ ∈ Γ,
|
| 288 |
+
f 1^(h:ℤ) = v*γ ∧
|
| 289 |
+
let p := fun n => π (linearNormalizedPair H h0 h1 hf
|
| 290 |
+
(linearRemainder H h0 hf hf0 h) h v n)
|
| 291 |
+
Polynomial Q 0 p ∧
|
| 292 |
+
(∀ ts : List ℤ, s ≤ ts.length → ∀ n, iterDiff ts p n = 1) ∧
|
| 293 |
+
η ≤ ‖mean N (fun n => Ψ.val (QuotientGroup.mk (p n))) -
|
| 294 |
+
∫ x, Ψ.val x ∂μ‖ := by
|
| 295 |
+
classical
|
| 296 |
+
let R := restricted H h0
|
| 297 |
+
let := last_normal H h0 (by omega : 1 ≤ s) hs
|
| 298 |
+
let π := QuotientGroup.mk' (R.level s)
|
| 299 |
+
let X := ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs
|
| 300 |
+
let := TopologicalSpace.metrizableSpaceMetric X
|
| 301 |
+
let : MeasurableSpace X := borel X
|
| 302 |
+
let : BorelSpace X := ⟨rfl⟩
|
| 303 |
+
obtain ⟨tests,η,hη,htests⟩ := finite_square_tests H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs F χ hχ hw
|
| 304 |
+
(insert 1 C) (hCc.insert 1) (δ^2/8) 2 (by positivity) (by norm_num)
|
| 305 |
+
refine ⟨tests,η,hη,?_⟩
|
| 306 |
+
intro μ hprob hinv f hf hf0 N T hN hT hlarge hboundary
|
| 307 |
+
let := hprob
|
| 308 |
+
obtain ⟨A,hAT,hAc,hAd⟩ := SquareDifferences.exists_dense_one_sided hN hT
|
| 309 |
+
(fun n => F (QuotientGroup.mk (f n))) (fun n => hF _) δ hδ hlarge hboundary
|
| 310 |
+
refine ⟨A,hAT,hAc,?_⟩
|
| 311 |
+
intro h ha
|
| 312 |
+
obtain ⟨v,hv,hvΓ⟩ := hC (f 1^(h:ℤ))
|
| 313 |
+
let γ:=v⁻¹*f 1^(h:ℤ)
|
| 314 |
+
have hav : f 1^(h:ℤ)=v*γ := by dsimp [γ]; group
|
| 315 |
+
let u:=linearRemainder H h0 hf hf0 (h:ℤ)
|
| 316 |
+
let q:=linearNormalizedPair H h0 h1 hf u (h:ℤ) v
|
| 317 |
+
let p:=fun n => π (q n)
|
| 318 |
+
let Φ:=observable H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs F χ hχ hw (1,v)
|
| 319 |
+
have hΦ : ∀ x : level H h0 1, Φ (QuotientGroup.mk (π x))=balanced H h0 Γ F 1 v x := fun _ => rfl
|
| 320 |
+
have hzero : (∫ x, Φ x ∂μ)=0 :=
|
| 321 |
+
reduced_observable_mean_zero H h0 h1 Γ F 1 v s hs2 hs χ hw z hz hχz μ hinv Φ hΦ
|
| 322 |
+
have heval (n : ℤ) : Φ (QuotientGroup.mk (p n))=
|
| 323 |
+
F (QuotientGroup.mk (f n))*conj (F (QuotientGroup.mk (f (n+h)))) := by
|
| 324 |
+
rw [hΦ]
|
| 325 |
+
exact balanced_linearNormalizedPair H h0 h1 Γ F hf hf0 (f 1) u h v γ hvΓ hav
|
| 326 |
+
(linearRemainder_mul H h0 hf hf0 h) n
|
| 327 |
+
have hcorr : δ^2/8 ≤ ‖mean N (fun n => Φ (QuotientGroup.mk (p n)))‖ := by
|
| 328 |
+
have hc := hAd h ha
|
| 329 |
+
rw [SquareDifferences.norm_mean_derivative_swap N h 0] at hc
|
| 330 |
+
convert hc using 1
|
| 331 |
+
congr 1
|
| 332 |
+
apply congrArg (mean N)
|
| 333 |
+
funext n
|
| 334 |
+
rw [heval]
|
| 335 |
+
simp only [PolynomialWeyl.derivative,Nat.add_zero,Nat.cast_add]
|
| 336 |
+
let L : C(X,ℂ) →ₗ[ℂ] ℂ := discrepancy μ N (fun n => QuotientGroup.mk (p n))
|
| 337 |
+
have hL : ∀ Ψ, ‖L Ψ‖ ≤ 2 * ‖Ψ‖ := discrepancy_bound μ N hN _
|
| 338 |
+
have hcorr' : δ^2/8 ≤ ‖L Φ‖ := by
|
| 339 |
+
change δ^2/8 ≤ ‖mean N (fun n => Φ (QuotientGroup.mk (p n))) - ∫ x, Φ x ∂μ‖
|
| 340 |
+
simpa only [hzero,sub_zero] using hcorr
|
| 341 |
+
obtain ⟨Ψ,hΨ,hΨcorr⟩ := htests L hL ⟨1,Set.mem_insert _ _,v,Set.mem_insert_of_mem _ hv,hcorr'⟩
|
| 342 |
+
obtain ⟨hp,hptop⟩ := linearNormalizedPair_reduced H h0 h1 hf u (h:ℤ) v
|
| 343 |
+
(le_trans (by decide : 1 ≤ 2) hs2) hs
|
| 344 |
+
exact ⟨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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.LeibmanSquare05
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
open scoped commutatorElement BigOperators
|
| 13 |
+
end
|
| 14 |
+
end
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
section
|
| 19 |
+
noncomputable section
|
| 20 |
+
open scoped BigOperators
|
| 21 |
+
namespace MalcevHorizontal
|
| 22 |
+
open CubeFaces LeibmanSquare RationalLattice _root_.Polynomial _root_.OAI.Polynomial
|
| 23 |
+
variable {G : Type*} [Group G] [TopologicalSpace G]
|
| 24 |
+
variable {n d : ℕ} (c : RealCoordinates G n) (hd : d ≤ n)
|
| 25 |
+
variable (hlin : ∀ i : Fin d, c.correction (Fin.castLE hd i)=0)
|
| 26 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤)
|
| 27 |
+
variable (hlevel : ∀ g : G, g∈H.level 2 ↔ horizontal c hd g=0)
|
| 28 |
+
|
| 29 |
+
include hlevel in
|
| 30 |
+
lemma character_lower_trivial (k : Fin d → ℤ) (u : H.level 2) : character c hd hlin k u=1 := by
|
| 31 |
+
change Multiplicative.ofAdd (∑ i,(k i:ℝ)*horizontal c hd u i)=1
|
| 32 |
+
rw [(hlevel u).mp u.property]
|
| 33 |
+
simp
|
| 34 |
+
|
| 35 |
+
include h0 hlevel in
|
| 36 |
+
lemma original_horizontal_linear {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1)
|
| 37 |
+
(k : Fin d → ℤ) (z : ℤ) :
|
| 38 |
+
(character c hd hlin k (f z)).toAdd=(z:ℝ)*∑ i,(k i:ℝ)*horizontal c hd (f 1) i := by
|
| 39 |
+
have he := congrArg (character c hd hlin k) (linearRemainder_mul H h0 hf hf0 z)
|
| 40 |
+
rw [map_mul,character_lower_trivial c hd hlin H hlevel,map_zpow,one_mul] at he
|
| 41 |
+
have hh:=congrArg Multiplicative.toAdd he
|
| 42 |
+
simpa only [toAdd_zpow,zsmul_eq_mul,character,MonoidHom.coe_mk,OneHom.coe_mk,toAdd_ofAdd] using hh
|
| 43 |
+
|
| 44 |
+
include h0 hlevel in
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
theorem original_horizontal_obstruction
|
| 48 |
+
(Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
|
| 49 |
+
{f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1)
|
| 50 |
+
(R N : ℕ) (A : ℝ) (hA : 0 ≤ A)
|
| 51 |
+
(k : Fin d → ℤ) (hk : k≠0) (hkR : ∀ i, |k i| ≤ R)
|
| 52 |
+
(m : ℤ) (hm : |(∑ i,(k i:ℝ)*horizontal c hd (f 1) i)-m| ≤ A/N) :
|
| 53 |
+
∃ χ : G →* Multiplicative ℝ, χ≠1 ∧ Continuous χ ∧
|
| 54 |
+
(∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z) ∧
|
| 55 |
+
(∃ k' : Fin d → ℤ, (∀ i, |k' i| ≤ R) ∧ χ=character c hd hlin k') ∧
|
| 56 |
+
∃ P : ℝ[X], P.natDegree ≤ 1 ∧ (∀ z : ℤ, P.eval (z:ℝ)=(χ (f z)).toAdd) ∧
|
| 57 |
+
∀ j : ℕ, 0<j → ∃ z : ℤ, |P.coeff j-z| ≤ A/(N:ℝ)^j := by
|
| 58 |
+
let α:=∑ i,(k i:ℝ)*horizontal c hd (f 1) i
|
| 59 |
+
refine ⟨character c hd hlin k,character_ne_one c hd hlin hk,character_continuous c hd hlin k,
|
| 60 |
+
fun g hg => character_integer c hd hlin Γ hΓ k hg,⟨k,hkR,rfl⟩,C α*X,?_,?_,?_⟩
|
| 61 |
+
· exact (natDegree_mul_le.trans (by simp [natDegree_C,natDegree_X]))
|
| 62 |
+
· intro z
|
| 63 |
+
rw [eval_mul,eval_C,eval_X,original_horizontal_linear c hd hlin H h0 hlevel hf hf0 k z]
|
| 64 |
+
change α*(z:ℝ)=(z:ℝ)*α
|
| 65 |
+
ring
|
| 66 |
+
· intro j hj
|
| 67 |
+
by_cases hj1 : j=1
|
| 68 |
+
· subst j
|
| 69 |
+
exact ⟨m,by simpa [coeff_C_mul,α] using hm⟩
|
| 70 |
+
· refine ⟨0,?_⟩
|
| 71 |
+
simp only [coeff_C_mul,coeff_X,ite_eq_right (Ne.symm hj1),mul_zero,Int.cast_zero,sub_zero,abs_zero]
|
| 72 |
+
positivity
|
| 73 |
+
|
| 74 |
+
end MalcevHorizontal
|
| 75 |
+
end
|
| 76 |
+
end
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
section
|
| 81 |
+
noncomputable section
|
| 82 |
+
namespace MalcevHorizontal
|
| 83 |
+
open RationalLattice CubeFaces LeibmanSquare BracketHyperplanes
|
| 84 |
+
variable {G : Type*} [Group G] [TopologicalSpace G]
|
| 85 |
+
variable {n d : ℕ} (c : RealCoordinates G n) (hd : d ≤ n)
|
| 86 |
+
variable (hlin : ∀ i : Fin d, c.correction (Fin.castLE hd i)=0)
|
| 87 |
+
|
| 88 |
+
include hlin in
|
| 89 |
+
lemma horizontal_pow (a : G) (h : ℕ) :
|
| 90 |
+
horizontal c hd (a^h)=fun i => (h:ℝ)*horizontal c hd a i := by
|
| 91 |
+
have he := congrArg Multiplicative.toAdd (map_pow (quotientHom c hd hlin) a h)
|
| 92 |
+
rw [toAdd_pow] at he
|
| 93 |
+
change horizontal c hd (a^h)=h • horizontal c hd a at he
|
| 94 |
+
funext i
|
| 95 |
+
simpa only [Pi.smul_apply,nsmul_eq_mul] using congrFun he i
|
| 96 |
+
|
| 97 |
+
variable (Γ : Subgroup G)
|
| 98 |
+
variable (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
|
| 99 |
+
|
| 100 |
+
include hlin hΓ in
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
lemma representative_torus (a : G) (v : ℕ → G)
|
| 104 |
+
(hv : ∀ h, (v h)⁻¹*a^h∈Γ) (h : ℕ) :
|
| 105 |
+
BracketHyperplanes.torusMap (horizontal c hd (v h))=
|
| 106 |
+
BracketHyperplanes.torusMap (fun i => horizontal c hd a i*(h:ℝ)+(0:Fin d → ℝ) i) := by
|
| 107 |
+
funext i
|
| 108 |
+
obtain ⟨z,hz⟩ := (hΓ ((v h)⁻¹*a^h)).mp (hv h) (Fin.castLE hd i)
|
| 109 |
+
change horizontal c hd ((v h)⁻¹*a^h) i=(z:ℝ) at hz
|
| 110 |
+
rw [horizontal_mul c hd hlin,horizontal_inv c hd hlin,horizontal_pow c hd hlin] at hz
|
| 111 |
+
change -horizontal c hd (v h) i+(h:ℝ)*horizontal c hd a i=(z:ℝ) at hz
|
| 112 |
+
have he : horizontal c hd a i*(h:ℝ)=horizontal c hd (v h) i+(z:ℝ) := by linarith
|
| 113 |
+
change (horizontal c hd (v h) i:UnitAddCircle)=
|
| 114 |
+
((horizontal c hd a i*(h:ℝ)+0:ℝ):UnitAddCircle)
|
| 115 |
+
rw [he]
|
| 116 |
+
simp
|
| 117 |
+
|
| 118 |
+
lemma reduced_horizontal_bound (a : G) : ‖horizontal c hd (reduceCoordinates c a n)‖ ≤ 1 := by
|
| 119 |
+
apply (pi_norm_le_iff_of_nonneg (by norm_num : (0:ℝ)≤1)).mpr
|
| 120 |
+
intro i
|
| 121 |
+
have hi := reduceCoordinates_bounds c a n (Fin.castLE hd i) (Fin.castLE hd i).isLt
|
| 122 |
+
change |c.coord (reduceCoordinates c a n) (Fin.castLE hd i)| ≤ 1
|
| 123 |
+
rw [abs_of_nonneg hi.1]
|
| 124 |
+
exact hi.2.le
|
| 125 |
+
|
| 126 |
+
include hlin hΓ in
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
lemma canonical_representative_orbit (a : G) :
|
| 130 |
+
let v:=fun h : ℕ => reduceCoordinates c (a^h) n
|
| 131 |
+
(∀ h, ‖horizontal c hd (v h)‖≤1) ∧
|
| 132 |
+
(∀ h, (v h)⁻¹*a^h∈Γ) ∧
|
| 133 |
+
∀ h,BracketHyperplanes.torusMap (horizontal c hd (v h))=
|
| 134 |
+
BracketHyperplanes.torusMap (fun i => horizontal c hd a i*(h:ℝ)+(0:Fin d → ℝ) i) := by
|
| 135 |
+
dsimp only
|
| 136 |
+
have hv (h : ℕ) := reduceCoordinates_coset c Γ hΓ (a^h) n
|
| 137 |
+
exact ⟨fun h => reduced_horizontal_bound c hd _,hv,
|
| 138 |
+
representative_torus c hd hlin Γ hΓ a _ hv⟩
|
| 139 |
+
|
| 140 |
+
end MalcevHorizontal
|
| 141 |
+
end
|
| 142 |
+
end
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
section
|
| 147 |
+
noncomputable section
|
| 148 |
+
open scoped BigOperators commutatorElement
|
| 149 |
+
namespace MalcevHorizontal
|
| 150 |
+
open RationalLattice CubeFaces LeibmanSquare SquareHorizontalCharacter _root_.Polynomial _root_.OAI.Polynomial BracketDrift
|
| 151 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 152 |
+
variable {n d : ℕ} (c : RealCoordinates G n) (hd : d ≤ n)
|
| 153 |
+
variable (hlin : ∀ i : Fin d, c.correction (Fin.castLE hd i)=0)
|
| 154 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 155 |
+
variable [∀ i, (H.level i).Normal]
|
| 156 |
+
variable (hlevel : ∀ g : G, g∈H.level 2 ↔ horizontal c hd g=0)
|
| 157 |
+
variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
|
| 158 |
+
|
| 159 |
+
include hlin hlevel hΓ in
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
theorem geometric_scalar_descent (s : ℕ) (hs2 : 2 ≤ s) (hs : H.level (s+1)=⊥)
|
| 163 |
+
(Ξ : Finset (level H h0 1 →* Multiplicative ℝ)) (δ A : ℝ) (hδ : 0<δ) (hA : 0≤A) :
|
| 164 |
+
∃ R : ℕ, 0<R ∧ ∃ C : ℝ, 0<C ∧ ∃ N₀ : ℕ, 0<N₀ ∧
|
| 165 |
+
∀ N : ℕ, N₀≤N → ∀ ξ∈Ξ, Continuous ξ →
|
| 166 |
+
(∀ x : level H h0 1, x.val∈Γ.prod Γ → ∃ z : ℤ, (ξ x).toAdd=z) →
|
| 167 |
+
∀ (f : ℤ → G) (hf : Polynomial H 0 f) (hf0 : f 0=1),
|
| 168 |
+
‖horizontal c hd (f 1)‖≤1 →
|
| 169 |
+
∀ v : ℕ → G, (∀ h, ‖horizontal c hd (v h)‖≤1) →
|
| 170 |
+
(∀ h, (v h)⁻¹*f 1^h∈Γ) →
|
| 171 |
+
∀ S : Finset ℕ, S⊆Finset.range N → δ*N≤(S.card:ℝ) →
|
| 172 |
+
(∀ h∈S, ∃ W : ℝ[X],
|
| 173 |
+
(∀ z : ℤ, W.eval (z:ℝ)=
|
| 174 |
+
(ξ (linearNormalizedPair H h0 h1 hf (linearRemainder H h0 hf hf0 h) h (v h) z)).toAdd) ∧
|
| 175 |
+
∀ j : ℕ, 0<j → j≤ s → ∃ m : ℤ, |W.coeff j-m|≤A/(N:ℝ)^j) →
|
| 176 |
+
(∃ k : Fin d → ℤ, k≠0 ∧ (∀ i, |k i|≤R) ∧
|
| 177 |
+
∃ χ : G →* Multiplicative ℝ, χ=character c hd hlin k ∧ χ≠1 ∧ Continuous χ ∧
|
| 178 |
+
(∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z) ∧
|
| 179 |
+
∃ P : ℝ[X], P.natDegree ≤ 1 ∧ (∀ z : ℤ, P.eval (z:ℝ)=(χ (f z)).toAdd) ∧
|
| 180 |
+
∀ j : ℕ, 0<j → ∃ m : ℤ, |P.coeff j-m|≤C/(N:ℝ)^j) ∨
|
| 181 |
+
((∀ a b : G, pairing H h0 h1 ξ a b=1) ∧
|
| 182 |
+
∃ q : ℤ, q≠0 ∧ |q|≤R ∧ ∃ P Q : ℝ[X],
|
| 183 |
+
P.natDegree ≤ s ∧ Q.natDegree ≤ s ∧ Q.eval 0=0 ∧ Q.eval 1=0 ∧
|
| 184 |
+
(∀ z : ℤ, P.eval (z:ℝ)=((ξ.comp (diagonal H h0 h1)) (f z)).toAdd) ∧
|
| 185 |
+
(∀ z : ℤ, Q.eval (z:ℝ)=((ξ.comp (lower H h0)) (linearRemainder H h0 hf hf0 z)).toAdd) ∧
|
| 186 |
+
(∀ j : ℕ, 0<j → ∃ m : ℤ, |(q:ℝ)*P.coeff j-m|≤C/(N:ℝ)^j) ∧
|
| 187 |
+
(∀ j : ℕ, 1<j → ∃ m : ℤ, |(q:ℝ)*Q.coeff j-m|≤C/(N:ℝ)^j)) := by
|
| 188 |
+
classical
|
| 189 |
+
let B:=⌈squareMatrixBound c hd H h0 h1 Ξ⌉₊
|
| 190 |
+
obtain ⟨R,hR,C,hC,N₀,hN₀,hdesc⟩ := NonabelianCharacterDescent.scalar_descent d s B hs2 δ A hδ hA
|
| 191 |
+
refine ⟨R,hR,C,hC,N₀,hN₀,?_⟩
|
| 192 |
+
intro N hNN ξ hξ hξc hξΓ f hf hf0 hf1 v hv hvΓ S hSN hS hsmall
|
| 193 |
+
obtain ⟨M,hdiag,halt,hM⟩ := square_integer_matrix c hd hlin H h0 h1 hlevel ξ Γ hΓ hξc hξΓ
|
| 194 |
+
have hMb (i j : Fin d) : |M i j|≤B := by
|
| 195 |
+
have hb : |(M i j:ℝ)|≤(B:ℝ) :=
|
| 196 |
+
(matrix_bound c hd H h0 h1 ξ M hM Ξ hξ i j).trans (Nat.le_ceil _)
|
| 197 |
+
exact_mod_cast hb
|
| 198 |
+
obtain ⟨P,Q,hP,hQ,hQ0,hQ1,hPe,hQe,hPQ⟩ :=
|
| 199 |
+
exists_actual_square_polynomials H h0 h1 ξ s hs hf hf0
|
| 200 |
+
have hm (h : ℕ) : (pairing H h0 h1 ξ (f 1) (v h)).toAdd=
|
| 201 |
+
∑ i,matrixContraction M (horizontal c hd (f 1)) i*horizontal c hd (v h) i := by
|
| 202 |
+
rw [hM]
|
| 203 |
+
simp only [matrixContraction,Finset.sum_mul]
|
| 204 |
+
rw [Finset.sum_comm]
|
| 205 |
+
have hsmall' (h : ℕ) (hh : h∈S) (j : ℕ) (hj : 0<j) (hjs : j≤ s) :
|
| 206 |
+
∃ m : ℤ, |(P+taylor (h:ℝ) Q-Q).coeff j+
|
| 207 |
+
(if j=1 then ∑ i,matrixContraction M (horizontal c hd (f 1)) i*horizontal c hd (v h) i else 0)-m|
|
| 208 |
+
≤ A/(N:ℝ)^j := by
|
| 209 |
+
obtain ⟨W,hWe,hWc⟩ := hsmall h hh
|
| 210 |
+
have he : W=P+taylor (h:ℝ) Q-Q+Polynomial.C ((pairing H h0 h1 ξ (f 1) (v h)).toAdd)*X := by
|
| 211 |
+
apply Polynomial.eq_of_eval_nat_eq
|
| 212 |
+
intro z
|
| 213 |
+
simpa only [Int.cast_natCast] using (hWe (z:ℤ)).trans (hPQ (h:ℤ) (z:ℤ) (v h)).symm
|
| 214 |
+
obtain ⟨m,hmc⟩ := hWc j hj hjs
|
| 215 |
+
refine ⟨m,?_⟩
|
| 216 |
+
rw [he,coeff_add,coeff_C_mul,coeff_X,hm] at hmc
|
| 217 |
+
by_cases hj1 : j=1
|
| 218 |
+
· simpa only [hj1,ite_true,mul_one] using hmc
|
| 219 |
+
· simpa only [ite_eq_right hj1,ite_eq_right (Ne.symm hj1),mul_zero,add_zero] using hmc
|
| 220 |
+
rcases hdesc N hNN M hMb (horizontal c hd (f 1)) 0 hf1
|
| 221 |
+
(fun h => horizontal c hd (v h)) hv (representative_torus c hd hlin Γ hΓ (f 1) v hvΓ)
|
| 222 |
+
P Q hP hQ S hSN hS hsmall' with hfirst | hzero
|
| 223 |
+
· left
|
| 224 |
+
obtain ⟨k,hk,hkR,m,hm⟩ := hfirst
|
| 225 |
+
obtain ⟨χ,hχ0,hχc,hχΓ,hχk,P',hP',hPe',hPc'⟩ :=
|
| 226 |
+
original_horizontal_obstruction c hd hlin H h0 hlevel Γ hΓ hf hf0 R N C hC.le k hk hkR m hm
|
| 227 |
+
obtain ⟨k',hk'R,hχeq⟩ := hχk
|
| 228 |
+
refine ⟨k',?_,hk'R,χ,hχeq,hχ0,hχc,hχΓ,P',hP',hPe',hPc'⟩
|
| 229 |
+
intro hz
|
| 230 |
+
apply hχ0
|
| 231 |
+
rw [hχeq,hz]
|
| 232 |
+
ext x
|
| 233 |
+
simp [character]
|
| 234 |
+
· right
|
| 235 |
+
obtain ⟨hMz,q,hq,hqR,hPc,hQc⟩ := hzero
|
| 236 |
+
exact ⟨(matrix_zero_iff c hd H h0 h1 ξ M hM).mp hMz,
|
| 237 |
+
q,hq,hqR,P,Q,hP,hQ,hQ0,hQ1,hPe,hQe,hPc,hQc⟩
|
| 238 |
+
|
| 239 |
+
end MalcevHorizontal
|
| 240 |
+
end
|
| 241 |
+
end
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
section
|
| 246 |
+
open scoped BigOperators
|
| 247 |
+
noncomputable section
|
| 248 |
+
namespace MalcevTailSection
|
| 249 |
+
open RationalLattice MalcevCharacters IntegerHyperplane
|
| 250 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 251 |
+
variable (c : RealCoordinates G n) (hsk : SecondKind c)
|
| 252 |
+
|
| 253 |
+
def axisHom (i : Fin n) : Multiplicative ℝ →* G where
|
| 254 |
+
toFun t := axis c i t.toAdd
|
| 255 |
+
map_one' := axis_zero c i
|
| 256 |
+
map_mul' s t := hsk.axis_add i s.toAdd t.toAdd
|
| 257 |
+
|
| 258 |
+
def HasPivot (k : Fin n → ℤ) (r : ℕ) : Prop := ∃ p : Fin n, r ≤ p.val ∧ k p ≠ 0
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
def tailSection (k : Fin n → ℤ) (r : ℕ) (t : ℝ) : G := by
|
| 263 |
+
classical
|
| 264 |
+
exact if h : HasPivot k r then axis c h.choose (t/(k h.choose:ℝ)) else 1
|
| 265 |
+
|
| 266 |
+
lemma section_zero (k : Fin n → ℤ) (r : ℕ) : tailSection c k r 0 = 1 := by
|
| 267 |
+
classical
|
| 268 |
+
unfold tailSection
|
| 269 |
+
split_ifs <;> simp
|
| 270 |
+
include hsk in
|
| 271 |
+
lemma section_add (k : Fin n → ℤ) (r : ℕ) (s t : ℝ) :
|
| 272 |
+
tailSection c k r (s+t) = tailSection c k r s * tailSection c k r t := by
|
| 273 |
+
classical
|
| 274 |
+
unfold tailSection
|
| 275 |
+
split_ifs <;> simp [add_div,hsk.axis_add]
|
| 276 |
+
|
| 277 |
+
def flow (k : Fin n → ℤ) (r : ℕ) : Multiplicative ℝ →* G where
|
| 278 |
+
toFun t := tailSection c k r t.toAdd
|
| 279 |
+
map_one' := section_zero c k r
|
| 280 |
+
map_mul' s t := section_add c hsk k r s.toAdd t.toAdd
|
| 281 |
+
|
| 282 |
+
include hsk in
|
| 283 |
+
lemma section_zpow (k : Fin n → ℤ) (r : ℕ) (t : ℝ) (z : ℤ) :
|
| 284 |
+
tailSection c k r (z*t) = tailSection c k r t ^ z := by
|
| 285 |
+
have h := (flow c hsk k r).map_zpow (Multiplicative.ofAdd t) z
|
| 286 |
+
simpa [flow,zsmul_eq_mul] using h
|
| 287 |
+
|
| 288 |
+
lemma section_continuous (k : Fin n → ℤ) (r : ℕ) : Continuous (tailSection c k r) := by
|
| 289 |
+
classical
|
| 290 |
+
unfold tailSection
|
| 291 |
+
split_ifs
|
| 292 |
+
· exact (axis_continuous c _).comp (continuous_id.div_const _)
|
| 293 |
+
· exact continuous_const
|
| 294 |
+
|
| 295 |
+
lemma section_tail (k : Fin n → ℤ) (r : ℕ) (t : ℝ) (i : Fin n) (hi : i.val < r) :
|
| 296 |
+
c.coord (tailSection c k r t) i = 0 := by
|
| 297 |
+
classical
|
| 298 |
+
unfold tailSection
|
| 299 |
+
split_ifs with h
|
| 300 |
+
· rw [coord_axis]
|
| 301 |
+
apply Pi.single_eq_of_ne
|
| 302 |
+
intro he
|
| 303 |
+
have := h.choose_spec.1
|
| 304 |
+
subst i
|
| 305 |
+
omega
|
| 306 |
+
· exact c.one_coord i
|
| 307 |
+
|
| 308 |
+
lemma section_rational (k : Fin n → ℤ) (r : ℕ) (t : ℚ) :
|
| 309 |
+
IsRational c (tailSection c k r t) := by
|
| 310 |
+
classical
|
| 311 |
+
intro i
|
| 312 |
+
unfold tailSection
|
| 313 |
+
split_ifs with h
|
| 314 |
+
· refine ⟨if i=h.choose then t/(k h.choose:ℚ) else 0,?_⟩
|
| 315 |
+
rw [coord_axis]
|
| 316 |
+
simp only [Pi.single_apply]
|
| 317 |
+
split_ifs <;> push_cast <;> rfl
|
| 318 |
+
· exact ⟨0,by simpa using (c.one_coord i).symm⟩
|
| 319 |
+
|
| 320 |
+
lemma section_bound (k : Fin n → ℤ) (r : ℕ) (t : ℝ) (i : Fin n) :
|
| 321 |
+
|c.coord (tailSection c k r t) i| ≤ |t| := by
|
| 322 |
+
classical
|
| 323 |
+
unfold tailSection
|
| 324 |
+
split_ifs with h
|
| 325 |
+
· rw [coord_axis]
|
| 326 |
+
by_cases hi : i=h.choose
|
| 327 |
+
· subst i
|
| 328 |
+
rw [Pi.single_eq_same,abs_div]
|
| 329 |
+
have hk : (1:ℝ) ≤ |(k h.choose:ℝ)| := by
|
| 330 |
+
exact_mod_cast (Int.one_le_abs h.choose_spec.2)
|
| 331 |
+
exact div_le_self (abs_nonneg t) hk
|
| 332 |
+
· simp [Pi.single_eq_of_ne hi,abs_nonneg]
|
| 333 |
+
· simp [c.one_coord,abs_nonneg]
|
| 334 |
+
|
| 335 |
+
lemma form_zero_of_no_pivot (k : Fin n → ℤ) (r : ℕ)
|
| 336 |
+
(hk : ¬ HasPivot k r) (x : Fin n → ℝ) (hx : ∀ i, i.val < r → x i = 0) :
|
| 337 |
+
form k x = 0 := by
|
| 338 |
+
change (∑ i, (k i:ℝ)*x i) = 0
|
| 339 |
+
apply Finset.sum_eq_zero
|
| 340 |
+
intro i _
|
| 341 |
+
by_cases hir : i.val < r
|
| 342 |
+
· rw [hx i hir,mul_zero]
|
| 343 |
+
· have hi : k i = 0 := by by_contra he; exact hk ⟨i,by omega,he⟩
|
| 344 |
+
simp [hi]
|
| 345 |
+
|
| 346 |
+
variable (χ : G →* Multiplicative ℝ) (k : Fin n → ℤ)
|
| 347 |
+
variable (hχ : ∀ g, (χ g).toAdd = form k (c.coord g))
|
| 348 |
+
include hχ in
|
| 349 |
+
lemma character_section (r : ℕ) (t : ℝ) (ht : ¬ HasPivot k r → t=0) :
|
| 350 |
+
(χ (tailSection c k r t)).toAdd = t := by
|
| 351 |
+
classical
|
| 352 |
+
unfold tailSection
|
| 353 |
+
split_ifs with h
|
| 354 |
+
· rw [hχ,coord_axis]
|
| 355 |
+
change (∑ i, (k i:ℝ)*(Pi.single h.choose (t/(k h.choose:ℝ)) : Fin n → ℝ) i) = t
|
| 356 |
+
simp only [Pi.single_apply,mul_ite,mul_zero,Finset.sum_ite_eq',Finset.mem_univ,ite_true]
|
| 357 |
+
exact mul_div_cancel₀ t (by exact_mod_cast h.choose_spec.2)
|
| 358 |
+
· rw [ht h]
|
| 359 |
+
simp
|
| 360 |
+
|
| 361 |
+
end MalcevTailSection
|
| 362 |
+
|
| 363 |
+
end
|
| 364 |
+
end
|
| 365 |
+
end
|
| 366 |
+
end
|
| 367 |
+
end
|
| 368 |
+
|
| 369 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/MalcevTail02.lean
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.MalcevTail01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
noncomputable section
|
| 13 |
+
end
|
| 14 |
+
end
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
section
|
| 19 |
+
open scoped BigOperators
|
| 20 |
+
noncomputable section
|
| 21 |
+
namespace MalcevTailFactor
|
| 22 |
+
open RationalLattice MalcevCharacters MalcevTailSection IntegerHyperplane
|
| 23 |
+
open CubeFaces CubePolynomials RationalFactorPeriods
|
| 24 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n l : ℕ}
|
| 25 |
+
variable (c : RealCoordinates G n) (hsk : SecondKind c)
|
| 26 |
+
variable (χ : G →* Multiplicative ℝ) (k : Fin n → ℤ)
|
| 27 |
+
variable (hχ : ∀ g, (χ g).toAdd = form k (c.coord g))
|
| 28 |
+
variable (r : Fin l → ℕ) (a : Fin l → G)
|
| 29 |
+
|
| 30 |
+
def beta (i : Fin l) : ℝ := (χ (a i)).toAdd
|
| 31 |
+
|
| 32 |
+
def numerator (i : Fin l) : ℤ := round (beta χ a i)
|
| 33 |
+
|
| 34 |
+
def error (i : Fin l) : ℝ := beta χ a i - (numerator χ a i : ℝ)
|
| 35 |
+
|
| 36 |
+
def smallCoeff (i : Fin l) : G := tailSection c k (r i) (error χ a i)
|
| 37 |
+
|
| 38 |
+
def rationalGenerator (i : Fin l) : G := tailSection c k (r i) 1
|
| 39 |
+
|
| 40 |
+
def rationalCoeff (i : Fin l) : G := rationalGenerator c k r i ^ numerator χ a i
|
| 41 |
+
|
| 42 |
+
variable (ha : ∀ i, ∀ u : Fin n, u.val < r i → c.coord (a i) u = 0)
|
| 43 |
+
include hχ ha in
|
| 44 |
+
lemma beta_zero (i : Fin l) (h : ¬ HasPivot k (r i)) : beta χ a i = 0 := by
|
| 45 |
+
rw [beta,hχ]
|
| 46 |
+
exact form_zero_of_no_pivot k (r i) h _ (ha i)
|
| 47 |
+
|
| 48 |
+
include hχ ha in
|
| 49 |
+
lemma error_zero (i : Fin l) (h : ¬ HasPivot k (r i)) : error χ a i = 0 := by
|
| 50 |
+
simp [error,numerator,beta_zero c χ k hχ r a ha i h]
|
| 51 |
+
|
| 52 |
+
include hsk in
|
| 53 |
+
lemma rationalCoeff_eq (i : Fin l) : rationalCoeff c χ k r a i =
|
| 54 |
+
tailSection c k (r i) (numerator χ a i) := by
|
| 55 |
+
simpa [rationalCoeff,rationalGenerator] using
|
| 56 |
+
(section_zpow c hsk k (r i) 1 (numerator χ a i)).symm
|
| 57 |
+
|
| 58 |
+
include hχ ha in
|
| 59 |
+
lemma small_character (i : Fin l) :
|
| 60 |
+
(χ (smallCoeff c χ k r a i)).toAdd = error χ a i := by
|
| 61 |
+
exact character_section c χ k hχ (r i) (error χ a i)
|
| 62 |
+
(error_zero c χ k hχ r a ha i)
|
| 63 |
+
|
| 64 |
+
include hsk hχ ha in
|
| 65 |
+
lemma rational_character (i : Fin l) :
|
| 66 |
+
(χ (rationalCoeff c χ k r a i)).toAdd = numerator χ a i := by
|
| 67 |
+
rw [rationalCoeff_eq c hsk χ k r a i]
|
| 68 |
+
apply character_section c χ k hχ
|
| 69 |
+
intro h
|
| 70 |
+
simp [numerator,beta_zero c χ k hχ r a ha i h]
|
| 71 |
+
|
| 72 |
+
lemma generator_rational (i : Fin l) : IsRational c (rationalGenerator c k r i) := by
|
| 73 |
+
simpa [rationalGenerator] using section_rational c k (r i) 1
|
| 74 |
+
|
| 75 |
+
lemma small_bound (i : Fin l) (u : Fin n) :
|
| 76 |
+
|c.coord (smallCoeff c χ k r a i) u| ≤ ‖(beta χ a i : UnitAddCircle)‖ := by
|
| 77 |
+
rw [UnitAddCircle.norm_eq]
|
| 78 |
+
exact section_bound c k (r i) (error χ a i) u
|
| 79 |
+
|
| 80 |
+
variable (j : Fin l → ℕ)
|
| 81 |
+
include hsk hχ ha in
|
| 82 |
+
lemma word_character_split (b : ℤ) :
|
| 83 |
+
(χ (orderedWord a j b)).toAdd =
|
| 84 |
+
(χ (orderedWord (smallCoeff c χ k r a) j b)).toAdd +
|
| 85 |
+
(χ (orderedWord (rationalCoeff c χ k r a) j b)).toAdd := by
|
| 86 |
+
simp only [orderedWord_character,small_character c χ k hχ r a ha,
|
| 87 |
+
rational_character c hsk χ k hχ r a ha,←Finset.sum_add_distrib]
|
| 88 |
+
apply Finset.sum_congr rfl
|
| 89 |
+
intro i _
|
| 90 |
+
change ((Ring.choose b (j i) : ℤ) : ℝ)*beta χ a i = _
|
| 91 |
+
simp [error,mul_sub]
|
| 92 |
+
|
| 93 |
+
include hsk hχ ha in
|
| 94 |
+
lemma residual_kernel (b : ℤ) :
|
| 95 |
+
(orderedWord (smallCoeff c χ k r a) j b)⁻¹ * orderedWord a j b *
|
| 96 |
+
(orderedWord (rationalCoeff c χ k r a) j b)⁻¹ ∈ χ.ker := by
|
| 97 |
+
change χ _ = 1
|
| 98 |
+
apply Multiplicative.toAdd.injective
|
| 99 |
+
simp only [map_mul,map_inv,toAdd_mul,toAdd_inv,
|
| 100 |
+
toAdd_one]
|
| 101 |
+
linarith [word_character_split c hsk χ k hχ r a ha j b]
|
| 102 |
+
|
| 103 |
+
variable (H : Filtration G) (q : ℕ)
|
| 104 |
+
variable (hlevel : ∀ i g, g ∈ H.level (j i+q) ↔ ∀ u : Fin n, u.val < r i → c.coord g u = 0)
|
| 105 |
+
include hlevel in
|
| 106 |
+
lemma small_polynomial : orderedWord (smallCoeff c χ k r a) j ∈ polynomials H q := by
|
| 107 |
+
apply orderedWord_mem
|
| 108 |
+
intro i
|
| 109 |
+
rw [hlevel]
|
| 110 |
+
exact section_tail c k (r i) _
|
| 111 |
+
|
| 112 |
+
include hsk hlevel in
|
| 113 |
+
lemma rational_polynomial : orderedWord (rationalCoeff c χ k r a) j ∈ polynomials H q := by
|
| 114 |
+
apply orderedWord_mem
|
| 115 |
+
intro i
|
| 116 |
+
rw [rationalCoeff_eq c hsk χ k r a i,hlevel]
|
| 117 |
+
exact section_tail c k (r i) _
|
| 118 |
+
|
| 119 |
+
end MalcevTailFactor
|
| 120 |
+
end
|
| 121 |
+
end
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
section
|
| 126 |
+
open scoped commutatorElement
|
| 127 |
+
noncomputable section
|
| 128 |
+
namespace CubePolynomials
|
| 129 |
+
open CubeFaces
|
| 130 |
+
variable {G A : Type*} [Group G] [Group A]
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
theorem residual_refinement (H : Filtration G) (s : ℕ) (hbot : H.level s = ⊥)
|
| 135 |
+
(φ : A →* G) (χ : A →* Multiplicative ℝ)
|
| 136 |
+
(hcomm : ∀ a b : G, ⁅a,b⁆ ∈ χ.ker.map φ)
|
| 137 |
+
(g : ℤ → G) (hg : g ∈ polynomials H 0) (a : G) (ha : a ∈ H.level 1)
|
| 138 |
+
(q e v : ℤ → A) (he : (fun n => φ (e n)) ∈ polynomials H 0)
|
| 139 |
+
(hv : (fun n => φ (v n)) ∈ polynomials H 0)
|
| 140 |
+
(hgq : ∀ n, g n = φ (q n) * a^n)
|
| 141 |
+
(hker : ∀ n, (e n)⁻¹ * q n * (v n)⁻¹ ∈ χ.ker) :
|
| 142 |
+
(fun n => (φ (e n))⁻¹ * g n * (φ (v n))⁻¹) ∈
|
| 143 |
+
polynomials (H.refine (χ.ker.map φ) hcomm) 0 := by
|
| 144 |
+
let K := χ.ker.map φ
|
| 145 |
+
have hf : (fun n => (φ (e n))⁻¹ * g n * (φ (v n))⁻¹) ∈ polynomials H 0 :=
|
| 146 |
+
(polynomials H 0).mul_mem ((polynomials H 0).mul_mem
|
| 147 |
+
((polynomials H 0).inv_mem he) hg) ((polynomials H 0).inv_mem hv)
|
| 148 |
+
apply refine_of_linear_coset H _ hcomm s hbot _ hf a ha
|
| 149 |
+
intro n
|
| 150 |
+
have hrow : (φ (e n))⁻¹ * φ (q n) * (φ (v n))⁻¹ ∈ K := by
|
| 151 |
+
have hm : φ ((e n)⁻¹ * q n * (v n)⁻¹) ∈ K :=
|
| 152 |
+
Subgroup.mem_map_of_mem φ (hker n)
|
| 153 |
+
simpa only [map_mul,map_inv] using hm
|
| 154 |
+
have hc := hcomm (φ (v n)) (a^n)
|
| 155 |
+
have hprod := K.mul_mem hrow hc
|
| 156 |
+
convert hprod using 1
|
| 157 |
+
rw [hgq]
|
| 158 |
+
simp only [commutatorElement_def]
|
| 159 |
+
group
|
| 160 |
+
|
| 161 |
+
end CubePolynomials
|
| 162 |
+
end
|
| 163 |
+
end
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
section
|
| 168 |
+
noncomputable section
|
| 169 |
+
namespace RationalFactorPeriods
|
| 170 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 171 |
+
variable [PreconnectedSpace G] [LocallyCompactSpace G] [T2Space G] {n l : ℕ}
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
theorem uniform_rational_word_period
|
| 176 |
+
(c : RationalLattice.RealCoordinates G n) (Γ : Subgroup G) [DiscreteTopology Γ]
|
| 177 |
+
(hΓrat : Γ ≤ RationalLattice.rationalSubgroup c)
|
| 178 |
+
(C : Set G) (hC : IsCompact C) (hreps : ∀ g : G, ∃ x ∈ C, x⁻¹*g ∈ Γ)
|
| 179 |
+
(v : Fin l → G) (hv : ∀ i, RationalLattice.IsRational c (v i))
|
| 180 |
+
(j : Fin l → ℕ) (s : ℕ) (hj : ∀ i, j i ≤ s) :
|
| 181 |
+
∃ T : ℕ, 0 < T ∧ ∀ m : Fin l → ℤ,
|
| 182 |
+
Function.Periodic (fun b => (QuotientGroup.mk
|
| 183 |
+
(orderedWord (fun i => v i ^ m i) j b) : G ⧸ Γ)) (T : ℤ) := by
|
| 184 |
+
classical
|
| 185 |
+
let S := Finset.univ.image v
|
| 186 |
+
have hSrat : ∀ g ∈ S, RationalLattice.IsRational c g := by
|
| 187 |
+
intro g hg
|
| 188 |
+
obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp hg
|
| 189 |
+
exact hv i
|
| 190 |
+
obtain ⟨H,hΓH,hSH,hHrat,hHd,hHi⟩ :=
|
| 191 |
+
RationalLattice.finite_rational_extension c Γ hΓrat C hC hreps S hSrat
|
| 192 |
+
let : (Γ.subgroupOf H).FiniteIndex := hHi
|
| 193 |
+
let : Fintype (H ⧸ Γ.subgroupOf H) := Fintype.ofFinite _
|
| 194 |
+
let K := Equiv.Perm (H ⧸ Γ.subgroupOf H)
|
| 195 |
+
let φ : H →* K := MulAction.toPermHom H (H ⧸ Γ.subgroupOf H)
|
| 196 |
+
have hvH (i : Fin l) : v i ∈ H := hSH (Finset.mem_image.mpr ⟨i,Finset.mem_univ _,rfl⟩)
|
| 197 |
+
refine ⟨Fintype.card K * s.factorial,Nat.mul_pos Fintype.card_pos s.factorial_pos,?_⟩
|
| 198 |
+
intro m b
|
| 199 |
+
let a : Fin l → H := fun i => ⟨v i ^ m i,H.zpow_mem (hvH i) _⟩
|
| 200 |
+
have he := congrArg (fun e : K => e (QuotientGroup.mk (1:H)))
|
| 201 |
+
(finite_image_periodic φ a j s hj b)
|
| 202 |
+
have hquot : (QuotientGroup.mk (orderedWord a j (b+(Fintype.card K*s.factorial:ℕ))) : H ⧸ Γ.subgroupOf H) =
|
| 203 |
+
QuotientGroup.mk (orderedWord a j b) := by
|
| 204 |
+
simpa [φ,K,MulAction.toPermHom] using he
|
| 205 |
+
have hmem := QuotientGroup.eq.mp hquot
|
| 206 |
+
have heG : (QuotientGroup.mk ((orderedWord a j (b+(Fintype.card K*s.factorial:ℕ)) : H):G) : G ⧸ Γ) =
|
| 207 |
+
QuotientGroup.mk ((orderedWord a j b : H):G) := QuotientGroup.eq.mpr hmem
|
| 208 |
+
have hmap (b : ℤ) : ((orderedWord a j b : H):G) =
|
| 209 |
+
orderedWord (fun i => v i ^ m i) j b := orderedWord_map H.subtype a j b
|
| 210 |
+
simpa only [hmap] using heG
|
| 211 |
+
|
| 212 |
+
end RationalFactorPeriods
|
| 213 |
+
end
|
| 214 |
+
end
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
section
|
| 219 |
+
open scoped commutatorElement BigOperators
|
| 220 |
+
noncomputable section
|
| 221 |
+
namespace CharacterFactorization
|
| 222 |
+
open CubeFaces CubePolynomials RationalFactorPeriods RationalLattice MalcevCharacters MalcevTailFactor
|
| 223 |
+
variable {G : Type*} [Group G] [TopologicalSpace G]
|
| 224 |
+
variable (H : Filtration G) {n s : ℕ} (c : RealCoordinates (H.level 2) n) (hsk : SecondKind c)
|
| 225 |
+
variable (χ : H.level 2 →* Multiplicative ℝ) (k : Fin n → ℤ)
|
| 226 |
+
variable (hχ : ∀ x, (χ x).toAdd = IntegerHyperplane.form k (c.coord x))
|
| 227 |
+
variable (r : Fin s → ℕ)
|
| 228 |
+
variable (hlevel : ∀ i (x : H.level 2), x.val ∈ H.level (i.val+2) ↔
|
| 229 |
+
∀ u : Fin n, u.val < r i → c.coord x u = 0)
|
| 230 |
+
variable (hcomm : ∀ a b : G, ⁅a,b⁆ ∈ χ.ker.map (H.level 2).subtype)
|
| 231 |
+
|
| 232 |
+
def epsilon (a : Fin s → H.level 2) (z : ℤ) : G :=
|
| 233 |
+
(orderedWord (smallCoeff c χ k r a) (fun i => i.val+2) z).val
|
| 234 |
+
|
| 235 |
+
def gamma (a : Fin s → H.level 2) (z : ℤ) : G :=
|
| 236 |
+
(orderedWord (rationalCoeff c χ k r a) (fun i => i.val+2) z).val
|
| 237 |
+
|
| 238 |
+
def residual (g : ℤ → G) (a : Fin s → H.level 2) (z : ℤ) : G :=
|
| 239 |
+
(epsilon H c χ k r a z)⁻¹ * g z * (gamma H c χ k r a z)⁻¹
|
| 240 |
+
|
| 241 |
+
lemma factorization_identity (g : ℤ → G) (a : Fin s → H.level 2) (z : ℤ) :
|
| 242 |
+
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
|
| 243 |
+
unfold residual
|
| 244 |
+
group
|
| 245 |
+
|
| 246 |
+
include hlevel in
|
| 247 |
+
lemma epsilon_polynomial (a : Fin s → H.level 2) :
|
| 248 |
+
epsilon H c χ k r a ∈ polynomials H 0 := by
|
| 249 |
+
have he : epsilon H c χ k r a = orderedWord (fun i => (smallCoeff c χ k r a i).val)
|
| 250 |
+
(fun i => i.val+2) := funext (fun z => orderedWord_map (H.level 2).subtype _ _ z)
|
| 251 |
+
rw [he]
|
| 252 |
+
apply orderedWord_mem
|
| 253 |
+
intro i
|
| 254 |
+
simp only [add_zero]
|
| 255 |
+
rw [hlevel]
|
| 256 |
+
exact MalcevTailSection.section_tail c k (r i) _
|
| 257 |
+
|
| 258 |
+
include hsk hlevel in
|
| 259 |
+
lemma gamma_polynomial (a : Fin s → H.level 2) :
|
| 260 |
+
gamma H c χ k r a ∈ polynomials H 0 := by
|
| 261 |
+
have he : gamma H c χ k r a = orderedWord (fun i => (rationalCoeff c χ k r a i).val)
|
| 262 |
+
(fun i => i.val+2) := funext (fun z => orderedWord_map (H.level 2).subtype _ _ z)
|
| 263 |
+
rw [he]
|
| 264 |
+
apply orderedWord_mem
|
| 265 |
+
intro i
|
| 266 |
+
simp only [add_zero]
|
| 267 |
+
rw [hlevel,rationalCoeff_eq c hsk χ k r a i]
|
| 268 |
+
exact MalcevTailSection.section_tail c k (r i) _
|
| 269 |
+
|
| 270 |
+
lemma epsilon_zero (a : Fin s → H.level 2) : epsilon H c χ k r a 0 = 1 := by
|
| 271 |
+
have he : ∀ i : Fin s, smallCoeff c χ k r a i ^ Ring.choose (0:ℤ) (i.val+2) = 1 := by
|
| 272 |
+
intro i
|
| 273 |
+
rw [Ring.choose_zero_pos ℤ (by omega),zpow_zero]
|
| 274 |
+
simp [epsilon,orderedWord]
|
| 275 |
+
|
| 276 |
+
include hsk hχ hlevel in
|
| 277 |
+
lemma residual_polynomial (hbot : H.level s = ⊥)
|
| 278 |
+
(g : ℤ → G) (hg : g ∈ polynomials H 0) (h1 : g 1 ∈ H.level 1)
|
| 279 |
+
(a : Fin s → H.level 2) (ha : ∀ i, (a i).val ∈ H.level (i.val+2))
|
| 280 |
+
(he : ∀ z, g z = (orderedWord a (fun i => i.val+2) z).val * g 1 ^ z) :
|
| 281 |
+
residual H c χ k r g a ∈ polynomials (H.refine (χ.ker.map (H.level 2).subtype) hcomm) 0 := by
|
| 282 |
+
apply residual_refinement H s hbot (H.level 2).subtype χ hcomm g hg (g 1) h1
|
| 283 |
+
(orderedWord a (fun i => i.val+2))
|
| 284 |
+
(orderedWord (smallCoeff c χ k r a) (fun i => i.val+2))
|
| 285 |
+
(orderedWord (rationalCoeff c χ k r a) (fun i => i.val+2))
|
| 286 |
+
(epsilon_polynomial H c χ k r hlevel a)
|
| 287 |
+
(gamma_polynomial H c hsk χ k r hlevel a) he
|
| 288 |
+
exact MalcevTailFactor.residual_kernel c hsk χ k hχ r a
|
| 289 |
+
(fun i => (hlevel i (a i)).mp (ha i)) (fun i => i.val+2)
|
| 290 |
+
|
| 291 |
+
include hsk hχ hlevel in
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
theorem normalized_factorization (hbot : H.level s = ⊥)
|
| 295 |
+
(g : ℤ → G) (hg : g ∈ polynomials H 0) (h0 : g 0=1) (h1 : g 1 ∈ H.level 1) :
|
| 296 |
+
∃ a : Fin s → H.level 2,
|
| 297 |
+
(∀ i, (a i).val ∈ H.level (i.val+2)) ∧
|
| 298 |
+
(∀ z, g z = (orderedWord a (fun i => i.val+2) z).val * g 1 ^ z) ∧
|
| 299 |
+
epsilon H c χ k r a ∈ polynomials H 0 ∧
|
| 300 |
+
gamma H c χ k r a ∈ polynomials H 0 ∧
|
| 301 |
+
residual H c χ k r g a ∈ polynomials (H.refine (χ.ker.map (H.level 2).subtype) hcomm) 0 := by
|
| 302 |
+
obtain ⟨a,ha,he⟩ := NilpotentTaylor.normalized_subgroup_taylor H s hbot g hg h0 h1
|
| 303 |
+
exact ⟨a,ha,he,epsilon_polynomial H c χ k r hlevel a,
|
| 304 |
+
gamma_polynomial H c hsk χ k r hlevel a,
|
| 305 |
+
residual_polynomial H c hsk χ k hχ r hlevel hcomm hbot g hg h1 a ha he⟩
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
variable [IsTopologicalGroup G] [T2Space G]
|
| 310 |
+
|
| 311 |
+
theorem uniform_gamma_period (Γ : Subgroup G)
|
| 312 |
+
(hΓ : ∀ x : H.level 2, x.val ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord x i = z) :
|
| 313 |
+
∃ T : ℕ, 0 < T ∧ ∀ a : Fin s → H.level 2,
|
| 314 |
+
Function.Periodic (fun z => (QuotientGroup.mk (gamma H c χ k r a z) : G ⧸ Γ)) (T:ℤ) := by
|
| 315 |
+
let L := Γ.comap (H.level 2).subtype
|
| 316 |
+
have hL : ∀ x : H.level 2, x ∈ L ↔ ∀ i, ∃ z : ℤ, c.coord x i = z := hΓ
|
| 317 |
+
let : DiscreteTopology L := integerCoordinates_discrete c L hL
|
| 318 |
+
let : ConnectedSpace (H.level 2) := c.coord.symm.surjective.connectedSpace c.coord.symm.continuous
|
| 319 |
+
let : LocallyCompactSpace (H.level 2) := c.coord.locallyCompactSpace_iff.mpr inferInstance
|
| 320 |
+
obtain ⟨C,hC,hrep⟩ := compact_reps_of_integerCoordinates c L hL
|
| 321 |
+
obtain ⟨T,hT,hper⟩ := uniform_rational_word_period c L (integerCoordinates_rational c L hL)
|
| 322 |
+
C hC hrep (rationalGenerator c k r) (generator_rational c k r)
|
| 323 |
+
(fun i => i.val+2) (s+2) (fun i => by omega)
|
| 324 |
+
refine ⟨T,hT,fun a z => ?_⟩
|
| 325 |
+
have hp := hper (numerator χ a) z
|
| 326 |
+
have hm := QuotientGroup.eq.mp hp
|
| 327 |
+
exact QuotientGroup.eq.mpr hm
|
| 328 |
+
|
| 329 |
+
end CharacterFactorization
|
| 330 |
+
|
| 331 |
+
end
|
| 332 |
+
end
|
| 333 |
+
end
|
| 334 |
+
end
|
| 335 |
+
end
|
| 336 |
+
|
| 337 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/MalcevTail03.lean
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.MalcevTail02
|
| 3 |
+
import OAI.Combinatorics.SumProduct.Alignment.SmoothBinomial01
|
| 4 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
section
|
| 12 |
+
end
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
section
|
| 17 |
+
noncomputable section
|
| 18 |
+
namespace SmoothBinomial
|
| 19 |
+
open Set
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
theorem smooth_binomial_increment (j : ℕ) (A C : ℝ) (hC : 0 ≤ C) :
|
| 23 |
+
∃ B > 0, ∀ L lam : ℝ, 1 ≤ L → |L^j*lam| ≤ C →
|
| 24 |
+
(∀ x : ℝ, |x| ≤ A*L → |lam*Ring.choose x j| ≤ B) ∧
|
| 25 |
+
(∀ x y : ℝ, |x| ≤ A*L → |y| ≤ A*L →
|
| 26 |
+
|lam*Ring.choose x j - lam*Ring.choose y j| ≤ (B/L)*|x-y|) := by
|
| 27 |
+
obtain ⟨B0,hB0,hv⟩ := smooth_binomial_bounds j 0 A C hC
|
| 28 |
+
obtain ⟨B1,hB1,hd⟩ := smooth_binomial_bounds j 1 A C hC
|
| 29 |
+
refine ⟨B0+B1,by positivity,?_⟩
|
| 30 |
+
intro L lam hL hlam
|
| 31 |
+
have hLp : 0 < L := lt_of_lt_of_le zero_lt_one hL
|
| 32 |
+
have hdiff : Differentiable ℝ (fun x : ℝ => lam*Ring.choose x j) := by
|
| 33 |
+
simp only [choose_eq_product]
|
| 34 |
+
fun_prop
|
| 35 |
+
constructor
|
| 36 |
+
· intro x hx
|
| 37 |
+
have he := hv L lam hL hlam x hx
|
| 38 |
+
simp only [iteratedDeriv_zero,pow_zero,div_one] at he
|
| 39 |
+
linarith
|
| 40 |
+
· intro x y hx hy
|
| 41 |
+
have hbound : ∀ z ∈ Icc (- (A*L)) (A*L), ‖deriv (fun w : ℝ => lam*Ring.choose w j) z‖ ≤ B1/L := by
|
| 42 |
+
intro z hz
|
| 43 |
+
simpa using hd L lam hL hlam z (abs_le.mpr hz)
|
| 44 |
+
have he := Convex.norm_image_sub_le_of_norm_deriv_le (fun z _ => hdiff z)
|
| 45 |
+
hbound (convex_Icc (- (A*L)) (A*L)) (abs_le.mp hy) (abs_le.mp hx)
|
| 46 |
+
change |lam*Ring.choose x j - lam*Ring.choose y j| ≤ (B1/L)*|x-y| at he
|
| 47 |
+
exact he.trans (mul_le_mul_of_nonneg_right
|
| 48 |
+
(div_le_div_of_nonneg_right (by linarith) hLp.le) (abs_nonneg _))
|
| 49 |
+
|
| 50 |
+
end SmoothBinomial
|
| 51 |
+
end
|
| 52 |
+
end
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
section
|
| 57 |
+
open scoped BigOperators
|
| 58 |
+
noncomputable section
|
| 59 |
+
namespace MalcevTailSection
|
| 60 |
+
open RationalLattice
|
| 61 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] {n l : ℕ}
|
| 62 |
+
variable (c : RealCoordinates G n) (k : Fin n → ℤ) (r : Fin l → ℕ) (j : Fin l → ℕ)
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
lemma binomial_parameters_bounds (A C : ℝ) (hC : 0 ≤ C) :
|
| 67 |
+
∃ U > 0, ∀ L : ℝ, ∀ lam : Fin l → ℝ, 1 ≤ L → (∀ i, |L^(j i)*lam i| ≤ C) →
|
| 68 |
+
(∀ x : ℝ, |x| ≤ A*L → ‖fun i => lam i*Ring.choose x (j i)‖ ≤ U) ∧
|
| 69 |
+
(∀ x y : ℝ, |x| ≤ A*L → |y| ≤ A*L →
|
| 70 |
+
‖(fun i => lam i*Ring.choose x (j i))-(fun i => lam i*Ring.choose y (j i))‖ ≤ (U/L)*|x-y|) := by
|
| 71 |
+
classical
|
| 72 |
+
choose b hb hh using (fun i => SmoothBinomial.smooth_binomial_increment (j i) A C hC)
|
| 73 |
+
let U := (∑ i, b i)+1
|
| 74 |
+
have hU : 0 < U := by
|
| 75 |
+
have he : 0 ≤ ∑ i, b i := Finset.sum_nonneg (fun i _ => (hb i).le)
|
| 76 |
+
dsimp [U]
|
| 77 |
+
linarith
|
| 78 |
+
have hbU (i : Fin l) : b i ≤ U := by
|
| 79 |
+
have he := Finset.single_le_sum (fun t (_ : t ∈ (Finset.univ : Finset (Fin l))) => (hb t).le) (Finset.mem_univ i)
|
| 80 |
+
dsimp [U]
|
| 81 |
+
linarith
|
| 82 |
+
refine ⟨U,hU,?_⟩
|
| 83 |
+
intro L lam hL hlam
|
| 84 |
+
have hLp : 0 < L := lt_of_lt_of_le zero_lt_one hL
|
| 85 |
+
constructor
|
| 86 |
+
· intro x hx
|
| 87 |
+
apply (pi_norm_le_iff_of_nonneg hU.le).mpr
|
| 88 |
+
intro i
|
| 89 |
+
exact ((hh i L (lam i) hL (hlam i)).1 x hx).trans (hbU i)
|
| 90 |
+
· intro x y hx hy
|
| 91 |
+
apply (pi_norm_le_iff_of_nonneg (by positivity)).mpr
|
| 92 |
+
intro i
|
| 93 |
+
exact ((hh i L (lam i) hL (hlam i)).2 x y hx hy).trans
|
| 94 |
+
(mul_le_mul_of_nonneg_right (div_le_div_of_nonneg_right (hbU i) hLp.le) (abs_nonneg _))
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
omit [IsTopologicalGroup G] in
|
| 99 |
+
theorem smooth_word_bounds (A C : ℝ) (hC : 0 ≤ C) :
|
| 100 |
+
∃ B > 0, ∀ L : ℝ, ∀ lam : Fin l → ℝ, 1 ≤ L → (∀ i, |L^(j i)*lam i| ≤ C) →
|
| 101 |
+
(∀ x : ℝ, |x| ≤ A*L →
|
| 102 |
+
‖c.coord (flowWord c k r (fun i => lam i*Ring.choose x (j i)))‖ ≤ B) ∧
|
| 103 |
+
(∀ x y : ℝ, |x| ≤ A*L → |y| ≤ A*L →
|
| 104 |
+
‖c.coord (flowWord c k r (fun i => lam i*Ring.choose x (j i))) -
|
| 105 |
+
c.coord (flowWord c k r (fun i => lam i*Ring.choose y (j i)))‖ ≤ (B/L)*|x-y|) := by
|
| 106 |
+
obtain ⟨U,hU,hu⟩ := binomial_parameters_bounds j A C hC
|
| 107 |
+
obtain ⟨M,hM,hm,hd⟩ := flowWord_bounds c k r U
|
| 108 |
+
refine ⟨M*(U+1),by positivity,?_⟩
|
| 109 |
+
intro L lam hL hlam
|
| 110 |
+
obtain ⟨hv,he⟩ := hu L lam hL hlam
|
| 111 |
+
have hLp : 0 < L := lt_of_lt_of_le zero_lt_one hL
|
| 112 |
+
constructor
|
| 113 |
+
· intro x hx
|
| 114 |
+
exact (hm _ (hv x hx)).trans (by nlinarith)
|
| 115 |
+
· intro x y hx hy
|
| 116 |
+
have h1 := hd _ _ (hv x hx) (hv y hy)
|
| 117 |
+
have h2 := mul_le_mul_of_nonneg_left (he x y hx hy) hM.le
|
| 118 |
+
apply h1.trans (h2.trans _)
|
| 119 |
+
have h3 : M*U ≤ M*(U+1) := by nlinarith
|
| 120 |
+
have h4 := mul_le_mul_of_nonneg_right (div_le_div_of_nonneg_right h3 hLp.le) (abs_nonneg (x-y))
|
| 121 |
+
convert h4 using 1; ring
|
| 122 |
+
|
| 123 |
+
end MalcevTailSection
|
| 124 |
+
end
|
| 125 |
+
end
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
section
|
| 130 |
+
noncomputable section
|
| 131 |
+
namespace MalcevTailSection
|
| 132 |
+
open RationalLattice RationalPolynomialMap
|
| 133 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] {n l : ℕ}
|
| 134 |
+
variable (c : RealCoordinates G n) (k : Fin n → ℤ) (r : Fin l → ℕ)
|
| 135 |
+
|
| 136 |
+
def flowDifference (t : (Fin l ⊕ Fin l) → ℝ) : G :=
|
| 137 |
+
flowWord c k r (fun i => t (Sum.inl i)) * (flowWord c k r (fun i => t (Sum.inr i)))⁻¹
|
| 138 |
+
|
| 139 |
+
omit [IsTopologicalGroup G] in
|
| 140 |
+
lemma polynomialMap_flowDifference : IsPolynomialMap c (flowDifference c k r) := by
|
| 141 |
+
apply polynomialMap_mul
|
| 142 |
+
· exact polynomialMap_comp c (polynomialMap_flowWord c k r) (fun i => RationalPolynomialMap.coordinate (Sum.inl i))
|
| 143 |
+
· apply polynomialMap_inv
|
| 144 |
+
exact polynomialMap_comp c (polynomialMap_flowWord c k r) (fun i => RationalPolynomialMap.coordinate (Sum.inr i))
|
| 145 |
+
|
| 146 |
+
omit [IsTopologicalGroup G] in
|
| 147 |
+
lemma flowDifference_contDiff : ContDiff ℝ (⊤ : ℕ∞) (fun x => c.coord (flowDifference c k r x)) := by
|
| 148 |
+
apply contDiff_pi.mpr
|
| 149 |
+
intro i
|
| 150 |
+
exact RationalPolynomialMap.contDiff (polynomialMap_flowDifference c k r i)
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
omit [IsTopologicalGroup G] in
|
| 155 |
+
theorem flow_displacement_bounds (R : ℝ) :
|
| 156 |
+
∃ M > 0, ∀ x y : Fin l → ℝ, ‖x‖ ≤ R → ‖y‖ ≤ R →
|
| 157 |
+
‖c.coord (flowWord c k r x * (flowWord c k r y)⁻¹)‖ ≤ M*‖x-y‖ := by
|
| 158 |
+
have hd := flowDifference_contDiff c k r
|
| 159 |
+
obtain ⟨D,hD⟩ := (isCompact_closedBall (0 : (Fin l ⊕ Fin l) → ℝ) R).exists_bound_of_continuousOn
|
| 160 |
+
(hd.continuous_fderiv (by simp)).continuousOn
|
| 161 |
+
refine ⟨max D 0+1,by positivity,?_⟩
|
| 162 |
+
intro x y hx hy
|
| 163 |
+
have hR : 0 ≤ R := (norm_nonneg x).trans hx
|
| 164 |
+
have hb (u v : Fin l → ℝ) (hu : ‖u‖ ≤ R) (hv : ‖v‖ ≤ R) : ‖Sum.elim u v‖ ≤ R := by
|
| 165 |
+
apply (pi_norm_le_iff_of_nonneg hR).mpr
|
| 166 |
+
intro i
|
| 167 |
+
cases i with
|
| 168 |
+
| inl i => exact (norm_le_pi_norm u i).trans hu
|
| 169 |
+
| inr i => exact (norm_le_pi_norm v i).trans hv
|
| 170 |
+
have hdiff : ‖Sum.elim x y - Sum.elim y y‖ ≤ ‖x-y‖ := by
|
| 171 |
+
apply (pi_norm_le_iff_of_nonneg (norm_nonneg _)).mpr
|
| 172 |
+
intro i
|
| 173 |
+
cases i with
|
| 174 |
+
| inl i => exact norm_le_pi_norm (x-y) i
|
| 175 |
+
| inr i => simp
|
| 176 |
+
have hid : c.coord (flowDifference c k r (Sum.elim y y)) = 0 := by
|
| 177 |
+
funext i
|
| 178 |
+
simp only [flowDifference,Sum.elim_inl,Sum.elim_inr,mul_inv_cancel,c.one_coord,Pi.zero_apply]
|
| 179 |
+
have he := Convex.norm_image_sub_le_of_norm_fderiv_le
|
| 180 |
+
(fun x (_ : x ∈ Metric.closedBall (0 : (Fin l ⊕ Fin l) → ℝ) R) => hd.differentiable (by simp) x)
|
| 181 |
+
(fun x hx => (hD x hx).trans (show D ≤ max D 0+1 by grind))
|
| 182 |
+
(convex_closedBall (0 : (Fin l ⊕ Fin l) → ℝ) R)
|
| 183 |
+
(by simpa using hb y y hy hy) (by simpa using hb x y hx hy)
|
| 184 |
+
rw [hid,sub_zero] at he
|
| 185 |
+
exact he.trans (mul_le_mul_of_nonneg_left hdiff (by positivity))
|
| 186 |
+
|
| 187 |
+
end MalcevTailSection
|
| 188 |
+
end
|
| 189 |
+
end
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
section
|
| 194 |
+
open scoped BigOperators
|
| 195 |
+
noncomputable section
|
| 196 |
+
namespace MalcevTailSection
|
| 197 |
+
open RationalLattice
|
| 198 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] {n l : ℕ}
|
| 199 |
+
variable (c : RealCoordinates G n) (k : Fin n → ℤ) (r : Fin l → ℕ) (j : Fin l → ℕ)
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
omit [IsTopologicalGroup G] in
|
| 204 |
+
theorem smooth_word_displacement (A C : ℝ) (hC : 0 ≤ C) :
|
| 205 |
+
∃ B > 0, ∀ L : ℝ, ∀ lam : Fin l → ℝ, 1 ≤ L → (∀ i, |L^(j i)*lam i| ≤ C) →
|
| 206 |
+
∀ x y : ℝ, |x| ≤ A*L → |y| ≤ A*L →
|
| 207 |
+
‖c.coord (flowWord c k r (fun i => lam i*Ring.choose x (j i)) *
|
| 208 |
+
(flowWord c k r (fun i => lam i*Ring.choose y (j i)))⁻¹)‖ ≤ (B/L)*|x-y| := by
|
| 209 |
+
obtain ⟨U,hU,hu⟩ := binomial_parameters_bounds j A C hC
|
| 210 |
+
obtain ⟨M,hM,hm⟩ := flow_displacement_bounds c k r U
|
| 211 |
+
refine ⟨M*U,by positivity,?_⟩
|
| 212 |
+
intro L lam hL hlam x y hx hy
|
| 213 |
+
obtain ⟨hv,he⟩ := hu L lam hL hlam
|
| 214 |
+
have h1 := hm _ _ (hv x hx) (hv y hy)
|
| 215 |
+
have h2 := mul_le_mul_of_nonneg_left (he x y hx hy) hM.le
|
| 216 |
+
apply h1.trans
|
| 217 |
+
convert h2 using 1; ring
|
| 218 |
+
|
| 219 |
+
end MalcevTailSection
|
| 220 |
+
|
| 221 |
+
namespace MalcevTailFactor
|
| 222 |
+
open RationalLattice RationalFactorPeriods MalcevCharacters MalcevTailSection
|
| 223 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] {n l : ℕ}
|
| 224 |
+
variable (c : RealCoordinates G n) (hsk : SecondKind c)
|
| 225 |
+
variable (χ : G →* Multiplicative ℝ) (k : Fin n → ℤ) (r : Fin l → ℕ) (j : Fin l → ℕ)
|
| 226 |
+
|
| 227 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 228 |
+
lemma error_abs (a : Fin l → G) (i : Fin l) :
|
| 229 |
+
|error χ a i| = ‖(beta χ a i : UnitAddCircle)‖ := by
|
| 230 |
+
rw [UnitAddCircle.norm_eq]
|
| 231 |
+
rfl
|
| 232 |
+
|
| 233 |
+
include hsk in
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
omit [IsTopologicalGroup G] in
|
| 237 |
+
theorem small_word_smooth (A C : ℝ) (hC : 0 ≤ C) :
|
| 238 |
+
∃ B > 0, ∀ L : ℝ, ∀ a : Fin l → G, 1 ≤ L →
|
| 239 |
+
(∀ i, L^(j i)*‖(beta χ a i : UnitAddCircle)‖ ≤ C) →
|
| 240 |
+
(∀ z : ℤ, |(z:ℝ)| ≤ A*L →
|
| 241 |
+
‖c.coord (orderedWord (smallCoeff c χ k r a) j z)‖ ≤ B) ∧
|
| 242 |
+
(∀ z w : ℤ, |(z:ℝ)| ≤ A*L → |(w:ℝ)| ≤ A*L →
|
| 243 |
+
‖c.coord (orderedWord (smallCoeff c χ k r a) j z *
|
| 244 |
+
(orderedWord (smallCoeff c χ k r a) j w)⁻¹)‖ ≤ (B/L)*|(z:ℝ)-(w:ℝ)|) := by
|
| 245 |
+
obtain ⟨B,hB,hb⟩ := smooth_word_bounds c k r j A C hC
|
| 246 |
+
obtain ⟨D,hD,hd⟩ := smooth_word_displacement c k r j A C hC
|
| 247 |
+
refine ⟨B+D,by positivity,?_⟩
|
| 248 |
+
intro L a hL ha
|
| 249 |
+
have hLp : 0 < L := lt_of_lt_of_le zero_lt_one hL
|
| 250 |
+
have he : ∀ i, |L^(j i)*error χ a i| ≤ C := by
|
| 251 |
+
intro i
|
| 252 |
+
rw [abs_mul,abs_of_nonneg (pow_nonneg hLp.le _),error_abs]
|
| 253 |
+
exact ha i
|
| 254 |
+
have hv (z : ℤ) : flowWord c k r (fun i => error χ a i*Ring.choose (z:ℝ) (j i)) =
|
| 255 |
+
orderedWord (smallCoeff c χ k r a) j z := flowWord_integer c k r hsk _ j z
|
| 256 |
+
constructor
|
| 257 |
+
· intro z hz
|
| 258 |
+
rw [← hv z]
|
| 259 |
+
exact ((hb L _ hL he).1 z hz).trans (by linarith)
|
| 260 |
+
· intro z w hz hw
|
| 261 |
+
rw [← hv z,← hv w]
|
| 262 |
+
exact (hd L _ hL he z w hz hw).trans
|
| 263 |
+
(mul_le_mul_of_nonneg_right (div_le_div_of_nonneg_right (by linarith) hLp.le) (abs_nonneg _))
|
| 264 |
+
|
| 265 |
+
end MalcevTailFactor
|
| 266 |
+
|
| 267 |
+
end
|
| 268 |
+
end
|
| 269 |
+
end
|
| 270 |
+
end
|
| 271 |
+
end
|
| 272 |
+
|
| 273 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/MalcevWeighted01.lean
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.LeibmanSquare02
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
end
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
section
|
| 18 |
+
noncomputable section
|
| 19 |
+
namespace MalcevSubspaceQuotient
|
| 20 |
+
open RationalLattice MalcevCharacters
|
| 21 |
+
|
| 22 |
+
lemma prod_map_mul_of_central {A M : Type*} [Monoid M] (f g : A → M)
|
| 23 |
+
(hg : ∀ a, g a ∈ Submonoid.center M) (l : List A) :
|
| 24 |
+
(l.map (fun a => f a*g a)).prod=(l.map f).prod*(l.map g).prod := by
|
| 25 |
+
induction l with
|
| 26 |
+
| nil => simp
|
| 27 |
+
| cons a l ih =>
|
| 28 |
+
simp only [List.map_cons,List.prod_cons,ih]
|
| 29 |
+
have hc : g a * (l.map f).prod=(l.map f).prod*g a :=
|
| 30 |
+
(Submonoid.mem_center_iff.mp (hg a) _).symm
|
| 31 |
+
calc
|
| 32 |
+
_ = f a*(g a*(l.map f).prod)*(l.map g).prod := by simp [mul_assoc]
|
| 33 |
+
_ = _ := by rw [hc]; simp [mul_assoc]
|
| 34 |
+
|
| 35 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 36 |
+
variable {n : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c)
|
| 37 |
+
variable (N : Subgroup G) [N.Normal]
|
| 38 |
+
|
| 39 |
+
include hsk in
|
| 40 |
+
omit [IsTopologicalGroup G] in
|
| 41 |
+
lemma mk_coordinates_add_central (x y : Fin n → ℝ)
|
| 42 |
+
(hy : ∀ i, (QuotientGroup.mk (axis c i (y i)) : G ⧸ N) ∈ Subgroup.center (G ⧸ N)) :
|
| 43 |
+
(QuotientGroup.mk (c.coord.symm (x+y)) : G ⧸ N) =
|
| 44 |
+
QuotientGroup.mk (c.coord.symm x)*QuotientGroup.mk (c.coord.symm y) := by
|
| 45 |
+
rw [mk_coordinates c hsk N,mk_coordinates c hsk N,mk_coordinates c hsk N]
|
| 46 |
+
simp only [Pi.add_apply,hsk.axis_add,QuotientGroup.mk_mul,List.ofFn_eq_map]
|
| 47 |
+
apply prod_map_mul_of_central
|
| 48 |
+
exact hy
|
| 49 |
+
|
| 50 |
+
include hsk in
|
| 51 |
+
omit [IsTopologicalGroup G] in
|
| 52 |
+
lemma mk_coordinates_central (y : Fin n → ℝ)
|
| 53 |
+
(hy : ∀ i, (QuotientGroup.mk (axis c i (y i)) : G ⧸ N) ∈ Subgroup.center (G ⧸ N)) :
|
| 54 |
+
(QuotientGroup.mk (c.coord.symm y) : G ⧸ N) ∈ Subgroup.center (G ⧸ N) := by
|
| 55 |
+
rw [mk_coordinates c hsk N]
|
| 56 |
+
apply Subgroup.list_prod_mem
|
| 57 |
+
intro a ha
|
| 58 |
+
obtain ⟨i,rfl⟩ := List.mem_ofFn.mp ha
|
| 59 |
+
exact hy i
|
| 60 |
+
|
| 61 |
+
variable (J : Set (Fin n))
|
| 62 |
+
variable (hJ : ∀ j∈J, ∀ t : ℝ,
|
| 63 |
+
(QuotientGroup.mk (axis c j t) : G ⧸ N) ∈ Subgroup.center (G ⧸ N))
|
| 64 |
+
|
| 65 |
+
include hJ in
|
| 66 |
+
omit [IsTopologicalGroup G] in
|
| 67 |
+
lemma mask_central (x : Fin n → ℝ) (i : Fin n) :
|
| 68 |
+
(QuotientGroup.mk (axis c i (mask J x i)) : G ⧸ N) ∈ Subgroup.center (G ⧸ N) := by
|
| 69 |
+
classical
|
| 70 |
+
by_cases hi : i∈J
|
| 71 |
+
· simpa only [mask,ite_eq_left hi] using hJ i hi (x i)
|
| 72 |
+
· simp [mask,hi]
|
| 73 |
+
|
| 74 |
+
lemma mask_compl_add_mask (x : Fin n → ℝ) : mask Jᶜ x+mask J x=x := by
|
| 75 |
+
classical
|
| 76 |
+
funext i
|
| 77 |
+
by_cases hi : i∈J <;> simp [mask,hi]
|
| 78 |
+
|
| 79 |
+
variable (I : Set (Fin n))
|
| 80 |
+
variable (hN : ∀ g : G, g ∈ N ↔ ∀ i∈I, c.coord g i=0)
|
| 81 |
+
|
| 82 |
+
include hsk hN hJ in
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
omit [IsTopologicalGroup G] in
|
| 86 |
+
theorem coord_mul_cut (g h : G) (i : Fin n) (hi : i∈I) (hij : i∈J) :
|
| 87 |
+
c.coord (g*h) i=c.coord g i+c.coord h i+
|
| 88 |
+
c.coord (strip c Jᶜ g*strip c Jᶜ h) i := by
|
| 89 |
+
classical
|
| 90 |
+
let x:=c.coord g
|
| 91 |
+
let y:=c.coord h
|
| 92 |
+
let a:=strip c Jᶜ g
|
| 93 |
+
let b:=strip c Jᶜ h
|
| 94 |
+
let u:=c.coord.symm (mask J x)
|
| 95 |
+
let v:=c.coord.symm (mask J y)
|
| 96 |
+
let q:=QuotientGroup.mk' N
|
| 97 |
+
have hx : q g=q a*q u := by
|
| 98 |
+
have he := mk_coordinates_add_central c hsk N (mask Jᶜ x) (mask J x) (mask_central c N J hJ x)
|
| 99 |
+
rw [mask_compl_add_mask] at he
|
| 100 |
+
simpa only [x,a,u,q,strip,QuotientGroup.mk'_apply,Homeomorph.symm_apply_apply] using he
|
| 101 |
+
have hy : q h=q b*q v := by
|
| 102 |
+
have he := mk_coordinates_add_central c hsk N (mask Jᶜ y) (mask J y) (mask_central c N J hJ y)
|
| 103 |
+
rw [mask_compl_add_mask] at he
|
| 104 |
+
simpa only [y,b,v,q,strip,QuotientGroup.mk'_apply,Homeomorph.symm_apply_apply] using he
|
| 105 |
+
have hu : q u ∈ Subgroup.center (G ⧸ N) :=
|
| 106 |
+
mk_coordinates_central c hsk N (mask J x) (mask_central c N J hJ x)
|
| 107 |
+
have hcenter (j : Fin n) :
|
| 108 |
+
(QuotientGroup.mk (axis c j ((mask J x+mask J y) j)) : G ⧸ N) ∈ Subgroup.center (G ⧸ N) := by
|
| 109 |
+
by_cases hj : j∈J
|
| 110 |
+
· exact hJ j hj _
|
| 111 |
+
· simp [mask,hj]
|
| 112 |
+
have he₁ := mk_coordinates_add_central c hsk N (c.coord (a*b)) (mask J x+mask J y) hcenter
|
| 113 |
+
have he₂ := mk_coordinates_add_central c hsk N (mask J x) (mask J y) (mask_central c N J hJ y)
|
| 114 |
+
have he : (QuotientGroup.mk (g*h) : G ⧸ N) =
|
| 115 |
+
QuotientGroup.mk (c.coord.symm (c.coord (a*b)+(mask J x+mask J y))) := by
|
| 116 |
+
rw [he₁,he₂,Homeomorph.symm_apply_apply]
|
| 117 |
+
change q (g*h)=q (a*b)*(q u*q v)
|
| 118 |
+
rw [map_mul,hx,hy,map_mul]
|
| 119 |
+
have hc := Subgroup.mem_center_iff.mp hu (q b)
|
| 120 |
+
calc
|
| 121 |
+
_ = q a*(q u*q b)*q v := by simp [mul_assoc]
|
| 122 |
+
_ = _ := by rw [← hc]; simp [mul_assoc]
|
| 123 |
+
have he' := (eq_coset_iff c hsk N I hN _ _).mp he i hi
|
| 124 |
+
simp only [Homeomorph.apply_symm_apply,Pi.add_apply,mask,ite_eq_left hij] at he'
|
| 125 |
+
change c.coord (g*h) i=c.coord g i+c.coord h i+c.coord (a*b) i
|
| 126 |
+
dsimp [x,y] at he'
|
| 127 |
+
linarith only [he']
|
| 128 |
+
|
| 129 |
+
end MalcevSubspaceQuotient
|
| 130 |
+
end
|
| 131 |
+
end
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
section
|
| 136 |
+
noncomputable section
|
| 137 |
+
open scoped commutatorElement
|
| 138 |
+
namespace MalcevWeightedCoordinates
|
| 139 |
+
open RationalLattice MalcevCharacters CubeFaces MalcevSubspaceQuotient
|
| 140 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 141 |
+
variable {n : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c)
|
| 142 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 143 |
+
variable (w : Fin n → ℕ)
|
| 144 |
+
variable (hH : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin n, w i<k → c.coord g i=0)
|
| 145 |
+
|
| 146 |
+
include hH in
|
| 147 |
+
omit [IsTopologicalGroup G] in
|
| 148 |
+
lemma axis_mem_level (i : Fin n) (t : ℝ) : axis c i t∈H.level (w i) := by
|
| 149 |
+
apply (hH _ _).mpr
|
| 150 |
+
intro j hj
|
| 151 |
+
have hji : j≠i := by intro he; subst j; exact (lt_irrefl _ hj)
|
| 152 |
+
simp [hji]
|
| 153 |
+
|
| 154 |
+
include h1 hH in
|
| 155 |
+
omit [IsTopologicalGroup G] in
|
| 156 |
+
lemma axis_central_mod_next (k : ℕ) [(H.level (k+1)).Normal]
|
| 157 |
+
(j : Fin n) (hj : k≤w j) (t : ℝ) :
|
| 158 |
+
(QuotientGroup.mk (axis c j t) : G ⧸ H.level (k+1))∈Subgroup.center (G ⧸ H.level (k+1)) := by
|
| 159 |
+
apply Subgroup.mem_center_iff.mpr
|
| 160 |
+
intro a
|
| 161 |
+
induction a using Quotient.inductionOn with | h a =>
|
| 162 |
+
apply commutatorElement_eq_one_iff_mul_comm.mp
|
| 163 |
+
change ⁅(QuotientGroup.mk' (H.level (k+1))) a,
|
| 164 |
+
(QuotientGroup.mk' (H.level (k+1))) (axis c j t)⁆ = 1
|
| 165 |
+
rw [← map_commutatorElement (QuotientGroup.mk' (H.level (k+1)))]
|
| 166 |
+
apply (QuotientGroup.eq_one_iff _).mpr
|
| 167 |
+
have ha : a∈H.level 1 := by rw [h1]; trivial
|
| 168 |
+
have hb : axis c j t∈H.level k := H.antitone hj (axis_mem_level c H w hH j t)
|
| 169 |
+
have hc := H.commutator_le 1 k (Subgroup.commutator_mem_commutator ha hb)
|
| 170 |
+
simpa only [Nat.add_comm] using hc
|
| 171 |
+
|
| 172 |
+
include hsk h0 h1 hH in
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
omit [IsTopologicalGroup G] in
|
| 176 |
+
theorem weighted_mul (g h : G) (i : Fin n) :
|
| 177 |
+
c.coord (g*h) i=c.coord g i+c.coord h i+
|
| 178 |
+
c.coord (strip c {j | w i≤w j}ᶜ g*strip c {j | w i≤w j}ᶜ h) i := by
|
| 179 |
+
let := LeibmanSquare.level_normal H h0 (w i+1)
|
| 180 |
+
apply coord_mul_cut c hsk (H.level (w i+1)) {j | w i≤w j}
|
| 181 |
+
(fun j hj t => axis_central_mod_next c H h1 w hH (w i) j hj t)
|
| 182 |
+
{j | w j<w i+1} (hH (w i+1)) g h i (by simp) (by simp)
|
| 183 |
+
|
| 184 |
+
end MalcevWeightedCoordinates
|
| 185 |
+
end
|
| 186 |
+
end
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
section
|
| 191 |
+
noncomputable section
|
| 192 |
+
namespace MalcevWeightedCoordinates
|
| 193 |
+
open RationalLattice MalcevCharacters CubeFaces MalcevSubspaceQuotient
|
| 194 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 195 |
+
variable {n : ℕ} (c : RealCoordinates G n)
|
| 196 |
+
variable (w : Fin n → ℕ) (p : Equiv.Perm (Fin n)) (hp : Monotone (w ∘ p))
|
| 197 |
+
|
| 198 |
+
def reorderHomeomorph : G ≃ₜ (Fin n → ℝ) where
|
| 199 |
+
toFun g i := c.coord g (p i)
|
| 200 |
+
invFun x := c.coord.symm (fun j => x (p.symm j))
|
| 201 |
+
left_inv g := by
|
| 202 |
+
change c.coord.symm (fun j => c.coord g (p (p.symm j)))=g
|
| 203 |
+
simp
|
| 204 |
+
right_inv x := by
|
| 205 |
+
funext i
|
| 206 |
+
change c.coord (c.coord.symm (fun j => x (p.symm j))) (p i)=x i
|
| 207 |
+
simp
|
| 208 |
+
continuous_toFun := continuous_pi (fun i => (continuous_apply (p i)).comp c.coord.continuous)
|
| 209 |
+
continuous_invFun := c.coord.symm.continuous.comp (continuous_pi (fun j => continuous_apply (p.symm j)))
|
| 210 |
+
|
| 211 |
+
include hp in
|
| 212 |
+
lemma lower_index {a i : Fin n} (ha : w a < w (p i)) : (p.symm a).val < i.val := by
|
| 213 |
+
by_contra hn
|
| 214 |
+
have he : i ≤ p.symm a := Nat.le_of_not_gt hn
|
| 215 |
+
have hw := hp he
|
| 216 |
+
have hw' : w (p i) ≤ w a := by simpa only [Function.comp_apply,Equiv.apply_symm_apply] using hw
|
| 217 |
+
exact (not_lt_of_ge hw') ha
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
def lowerVector (i : Fin n) (x : Fin i.val → ℝ) (a : Fin n) : ℝ :=
|
| 222 |
+
if ha : w a < w (p i) then x ⟨(p.symm a).val,lower_index w p hp ha⟩ else 0
|
| 223 |
+
|
| 224 |
+
omit [IsTopologicalGroup G] in
|
| 225 |
+
lemma lowerVector_coordinates (i : Fin n) (g : G) :
|
| 226 |
+
lowerVector w p hp i (fun j => c.coord g (p ⟨j.val,lt_trans j.isLt i.isLt⟩)) =
|
| 227 |
+
mask {j | w (p i) ≤ w j}ᶜ (c.coord g) := by
|
| 228 |
+
funext a
|
| 229 |
+
unfold lowerVector mask
|
| 230 |
+
by_cases ha : w a < w (p i)
|
| 231 |
+
· have hn : ¬ w (p i) ≤ w a := not_le_of_gt ha
|
| 232 |
+
simp only [dite_eq_left ha,Set.mem_compl_iff,Set.mem_ofPred_eq,ite_eq_left hn]
|
| 233 |
+
exact congrArg (c.coord g) (p.apply_symm_apply a)
|
| 234 |
+
· have hn : w (p i) ≤ w a := le_of_not_gt ha
|
| 235 |
+
simp [ha,hn]
|
| 236 |
+
|
| 237 |
+
omit [IsTopologicalGroup G] in
|
| 238 |
+
lemma lower_correction_exists (i : Fin n) :
|
| 239 |
+
∃ P : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ,
|
| 240 |
+
∀ v : (Fin i.val ⊕ Fin i.val) → ℝ,
|
| 241 |
+
c.coord (c.coord.symm (lowerVector w p hp i (fun j => v (Sum.inl j))) *
|
| 242 |
+
c.coord.symm (lowerVector w p hp i (fun j => v (Sum.inr j)))) (p i) =
|
| 243 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ) v P := by
|
| 244 |
+
apply polynomialMap_mul c
|
| 245 |
+
all_goals
|
| 246 |
+
intro a
|
| 247 |
+
simp only [Homeomorph.apply_symm_apply]
|
| 248 |
+
unfold lowerVector
|
| 249 |
+
split_ifs with ha
|
| 250 |
+
· exact RationalPolynomialMap.coordinate _
|
| 251 |
+
· exact RationalPolynomialMap.zero
|
| 252 |
+
|
| 253 |
+
def sortedCorrection (i : Fin n) : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ :=
|
| 254 |
+
(lower_correction_exists c w p hp i).choose
|
| 255 |
+
|
| 256 |
+
variable (hsk : SecondKind c) (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 257 |
+
variable (hH : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin n, w i < k → c.coord g i=0)
|
| 258 |
+
|
| 259 |
+
include hsk h0 h1 hH in
|
| 260 |
+
omit [IsTopologicalGroup G] in
|
| 261 |
+
lemma sorted_mul (g h : G) (i : Fin n) :
|
| 262 |
+
c.coord (g*h) (p i)=c.coord g (p i)+c.coord h (p i)+
|
| 263 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 264 |
+
(Sum.elim (fun j => c.coord g (p ⟨j.val,lt_trans j.isLt i.isLt⟩))
|
| 265 |
+
(fun j => c.coord h (p ⟨j.val,lt_trans j.isLt i.isLt⟩)))
|
| 266 |
+
(sortedCorrection c w p hp i) := by
|
| 267 |
+
rw [weighted_mul c hsk H h0 h1 w hH g h (p i)]
|
| 268 |
+
congr 1
|
| 269 |
+
have he := (lower_correction_exists c w p hp i).choose_spec
|
| 270 |
+
(Sum.elim (fun j => c.coord g (p ⟨j.val,lt_trans j.isLt i.isLt⟩))
|
| 271 |
+
(fun j => c.coord h (p ⟨j.val,lt_trans j.isLt i.isLt⟩)))
|
| 272 |
+
simpa only [Sum.elim_inl,Sum.elim_inr,lowerVector_coordinates,strip,sortedCorrection] using he
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
def sortedCoordinates : RealCoordinates G n where
|
| 277 |
+
coord := reorderHomeomorph c p
|
| 278 |
+
one_coord i := c.one_coord (p i)
|
| 279 |
+
correction := sortedCorrection c w p hp
|
| 280 |
+
mul_coord := sorted_mul c w p hp hsk H h0 h1 hH
|
| 281 |
+
|
| 282 |
+
end MalcevWeightedCoordinates
|
| 283 |
+
|
| 284 |
+
end
|
| 285 |
+
end
|
| 286 |
+
end
|
| 287 |
+
end
|
| 288 |
+
end
|
| 289 |
+
|
| 290 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/MalcevWeighted02.lean
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.MalcevWeighted01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
end
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
section
|
| 18 |
+
noncomputable section
|
| 19 |
+
namespace MalcevWeightedCoordinates
|
| 20 |
+
|
| 21 |
+
lemma exists_sorting_permutation {n : ℕ} (w : Fin n → ℕ) :
|
| 22 |
+
∃ p : Equiv.Perm (Fin n), Monotone (w ∘ p) := by
|
| 23 |
+
classical
|
| 24 |
+
let l := (List.finRange n).mergeSort (fun i j => decide (w i ≤ w j))
|
| 25 |
+
have hl : l.Perm (List.finRange n) := List.mergeSort_perm _ _
|
| 26 |
+
have hlen : l.length=n := by simpa using hl.length_eq
|
| 27 |
+
have hnd : l.Nodup := hl.nodup_iff.mpr (List.nodup_finRange n)
|
| 28 |
+
have hall : ∀ i : Fin n, i∈l := fun i => hl.mem_iff.mpr (List.mem_finRange i)
|
| 29 |
+
let e := List.Nodup.getEquivOfForallMemList l hnd hall
|
| 30 |
+
let p := (Fin.castOrderIso hlen.symm).toEquiv.trans e
|
| 31 |
+
refine ⟨p,?_⟩
|
| 32 |
+
have hs : l.Pairwise (fun i j => w i ≤ w j) := by
|
| 33 |
+
have hh := List.pairwise_mergeSort (le := fun i j : Fin n => decide (w i ≤ w j))
|
| 34 |
+
(fun a b c hab hbc => by simpa using le_trans (of_decide_eq_true hab) (of_decide_eq_true hbc))
|
| 35 |
+
(fun a b => by simpa using le_total (w a) (w b)) (List.finRange n)
|
| 36 |
+
simpa only [decide_eq_true_eq] using hh
|
| 37 |
+
intro i j hij
|
| 38 |
+
change w (l.get (Fin.cast hlen.symm i)) ≤ w (l.get (Fin.cast hlen.symm j))
|
| 39 |
+
rcases eq_or_lt_of_le hij with he|he
|
| 40 |
+
· simp [he]
|
| 41 |
+
· exact hs.rel_get_of_lt he
|
| 42 |
+
|
| 43 |
+
lemma exists_weight_cutoff {n : ℕ} (w : Fin n → ℕ) (hw : Monotone w) (k : ℕ) :
|
| 44 |
+
∃ r : ℕ, r ≤ n ∧ ∀ i : Fin n, w i < k ↔ i.val < r := by
|
| 45 |
+
classical
|
| 46 |
+
let P : ℕ → Prop := fun r => ∀ i : Fin n, r ≤ i.val → k ≤ w i
|
| 47 |
+
have hex : ∃ r, P r := ⟨n,by intro i hi; omega⟩
|
| 48 |
+
refine ⟨Nat.find hex,Nat.find_min' hex (show P n from by intro i hi; omega),?_⟩
|
| 49 |
+
intro i
|
| 50 |
+
constructor
|
| 51 |
+
· intro hi
|
| 52 |
+
by_contra hn
|
| 53 |
+
exact (not_le_of_gt hi) (Nat.find_spec hex i (Nat.le_of_not_gt hn))
|
| 54 |
+
· intro hi
|
| 55 |
+
by_contra hn
|
| 56 |
+
have hki : k ≤ w i := Nat.le_of_not_gt hn
|
| 57 |
+
have hp : P i.val := by
|
| 58 |
+
intro j hj
|
| 59 |
+
exact hki.trans (hw hj)
|
| 60 |
+
have hh := Nat.find_min' hex hp
|
| 61 |
+
omega
|
| 62 |
+
|
| 63 |
+
end MalcevWeightedCoordinates
|
| 64 |
+
end
|
| 65 |
+
end
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
section
|
| 70 |
+
noncomputable section
|
| 71 |
+
namespace RationalLattice
|
| 72 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 73 |
+
variable (c : RealCoordinates G n)
|
| 74 |
+
variable (H : Subgroup G) (I : Set (Fin n))
|
| 75 |
+
variable (hH : ∀ g : G, g ∈ H ↔ ∀ i ∈ I, c.coord g i = 0)
|
| 76 |
+
|
| 77 |
+
include hH in
|
| 78 |
+
lemma basisFlow_mem_subspace {i : Fin n} (hi : i ∉ I) (t : ℝ) : basisFlow c i t ∈ H := by
|
| 79 |
+
apply realPower_mem_of_coordinates c H I hH
|
| 80 |
+
apply (hH _).mpr
|
| 81 |
+
intro j hj
|
| 82 |
+
have hji : j ≠ i := by intro he; exact hi (he ▸ hj)
|
| 83 |
+
simp [basisElement,hji]
|
| 84 |
+
|
| 85 |
+
include hH in
|
| 86 |
+
lemma peel_mem_subspace {g : G} (hg : g ∈ H) (k : ℕ) : peel c g k ∈ H := by
|
| 87 |
+
classical
|
| 88 |
+
induction k with
|
| 89 |
+
| zero => exact hg
|
| 90 |
+
| succ k ih =>
|
| 91 |
+
unfold peel
|
| 92 |
+
split_ifs with hk
|
| 93 |
+
· apply H.mul_mem _ ih
|
| 94 |
+
by_cases hi : (⟨k,hk⟩ : Fin n) ∈ I
|
| 95 |
+
· rw [(hH _).mp ih _ hi,neg_zero,basisFlow_zero]
|
| 96 |
+
exact H.one_mem
|
| 97 |
+
· exact basisFlow_mem_subspace c H I hH hi _
|
| 98 |
+
· exact ih
|
| 99 |
+
|
| 100 |
+
include hH in
|
| 101 |
+
lemma expCoordinates_subspace (g : G) :
|
| 102 |
+
g ∈ H ↔ ∀ i ∈ I, expCoordinates c g i = 0 := by
|
| 103 |
+
classical
|
| 104 |
+
constructor
|
| 105 |
+
· intro hg i hi
|
| 106 |
+
exact (hH _).mp (peel_mem_subspace c H I hH hg i.val) i hi
|
| 107 |
+
· intro hg
|
| 108 |
+
rw [← expProduct_expCoordinates c g]
|
| 109 |
+
apply H.list_prod_mem
|
| 110 |
+
intro x hx
|
| 111 |
+
obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hx
|
| 112 |
+
by_cases hi : i ∈ I
|
| 113 |
+
· rw [hg i hi,basisFlow_zero]
|
| 114 |
+
exact H.one_mem
|
| 115 |
+
· exact basisFlow_mem_subspace c H I hH hi _
|
| 116 |
+
|
| 117 |
+
include hH in
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
theorem secondCoordinates_subspace [IsTopologicalGroup G] (g : G) :
|
| 121 |
+
g ∈ H ↔ ∀ i ∈ I, (secondCoordinates c).coord g i = 0 :=
|
| 122 |
+
expCoordinates_subspace c H I hH g
|
| 123 |
+
|
| 124 |
+
end RationalLattice
|
| 125 |
+
end
|
| 126 |
+
end
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
section
|
| 131 |
+
noncomputable section
|
| 132 |
+
namespace MalcevWeightedCoordinates
|
| 133 |
+
open RationalLattice MalcevCharacters CubeFaces
|
| 134 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 135 |
+
variable (c : RealCoordinates G n) (H : Filtration G)
|
| 136 |
+
variable (s : ℕ) (hs : H.level (s+1)=⊥)
|
| 137 |
+
|
| 138 |
+
include hs in
|
| 139 |
+
lemma exists_axis_out (i : Fin n) : ∃ k, axis c i 1∉H.level k := by
|
| 140 |
+
refine ⟨s+1,?_⟩
|
| 141 |
+
rw [hs,Subgroup.mem_bot]
|
| 142 |
+
intro he
|
| 143 |
+
have hf := congrArg (fun g => c.coord g i) he
|
| 144 |
+
simp [axis,c.one_coord] at hf
|
| 145 |
+
|
| 146 |
+
def subspaceWeight (i : Fin n) : ℕ := by
|
| 147 |
+
classical
|
| 148 |
+
exact Nat.find (exists_axis_out c H s hs i)-1
|
| 149 |
+
|
| 150 |
+
variable (h0 : H.level 0=⊤)
|
| 151 |
+
include h0 hs in
|
| 152 |
+
lemma weight_lt_iff_out (i : Fin n) (k : ℕ) :
|
| 153 |
+
subspaceWeight c H s hs i < k ↔ axis c i 1∉H.level k := by
|
| 154 |
+
classical
|
| 155 |
+
have hz : 0 < Nat.find (exists_axis_out c H s hs i) := by
|
| 156 |
+
by_contra hn
|
| 157 |
+
have he : Nat.find (exists_axis_out c H s hs i)=0 := by omega
|
| 158 |
+
have hnot := Nat.find_spec (exists_axis_out c H s hs i)
|
| 159 |
+
rw [he,h0] at hnot
|
| 160 |
+
exact hnot (Subgroup.mem_top _)
|
| 161 |
+
constructor
|
| 162 |
+
· intro hk hm
|
| 163 |
+
have hle : Nat.find (exists_axis_out c H s hs i) ≤ k := by
|
| 164 |
+
change Nat.find (exists_axis_out c H s hs i)-1 < k at hk
|
| 165 |
+
omega
|
| 166 |
+
exact Nat.find_spec (exists_axis_out c H s hs i) (H.antitone hle hm)
|
| 167 |
+
· intro hm
|
| 168 |
+
have hle := Nat.find_min' (exists_axis_out c H s hs i) hm
|
| 169 |
+
unfold subspaceWeight
|
| 170 |
+
omega
|
| 171 |
+
|
| 172 |
+
lemma axis_mem_subspace_iff (A : Subgroup G) (I : Set (Fin n))
|
| 173 |
+
(hA : ∀ g : G, g∈A ↔ ∀ i∈I, c.coord g i=0) (i : Fin n) :
|
| 174 |
+
axis c i 1∈A ↔ i∉I := by
|
| 175 |
+
classical
|
| 176 |
+
constructor
|
| 177 |
+
· intro hm hi
|
| 178 |
+
have hz := (hA _).mp hm i hi
|
| 179 |
+
simp [axis] at hz
|
| 180 |
+
· intro hi
|
| 181 |
+
apply (hA _).mpr
|
| 182 |
+
intro j hj
|
| 183 |
+
have hji : j≠i := by intro he; subst j; exact hi hj
|
| 184 |
+
simp [axis,hji]
|
| 185 |
+
|
| 186 |
+
variable (hH : ∀ k : ℕ, ∃ I : Set (Fin n), ∀ g : G,
|
| 187 |
+
g∈H.level k ↔ ∀ i∈I, c.coord g i=0)
|
| 188 |
+
include h0 hH hs in
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
theorem subspaceWeight_level (k : ℕ) (g : G) :
|
| 192 |
+
g∈H.level k ↔ ∀ i : Fin n, subspaceWeight c H s hs i < k → c.coord g i=0 := by
|
| 193 |
+
classical
|
| 194 |
+
obtain ⟨I,hI⟩ := hH k
|
| 195 |
+
have hi (i : Fin n) : subspaceWeight c H s hs i < k ↔ i∈I := by
|
| 196 |
+
rw [weight_lt_iff_out c H s hs h0,axis_mem_subspace_iff c (H.level k) I hI]
|
| 197 |
+
simp
|
| 198 |
+
rw [hI]
|
| 199 |
+
simp only [hi]
|
| 200 |
+
|
| 201 |
+
end MalcevWeightedCoordinates
|
| 202 |
+
end
|
| 203 |
+
end
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
section
|
| 208 |
+
noncomputable section
|
| 209 |
+
namespace MalcevWeightedCoordinates
|
| 210 |
+
open RationalLattice MalcevCharacters CubeFaces
|
| 211 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 212 |
+
variable {n : ℕ} (c : RealCoordinates G n)
|
| 213 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 214 |
+
variable (s : ℕ) (hs : H.level (s+1)=⊥)
|
| 215 |
+
variable (hH : ∀ k : ℕ, ∃ I : Set (Fin n), ∀ g : G,
|
| 216 |
+
g∈H.level k ↔ ∀ i∈I, c.coord g i=0)
|
| 217 |
+
variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
|
| 218 |
+
include h0 h1 hs hH hΓ in
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
theorem exists_adapted_secondKind_coordinates :
|
| 222 |
+
∃ c' : RealCoordinates G n, SecondKind c' ∧
|
| 223 |
+
(∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c'.coord g i=z) ∧
|
| 224 |
+
∀ k : ℕ, ∃ r : ℕ, r ≤ n ∧ ∀ g : G,
|
| 225 |
+
g∈H.level k ↔ ∀ i : Fin n, i.val < r → c'.coord g i=0 := by
|
| 226 |
+
classical
|
| 227 |
+
let c₁ := secondCoordinates c
|
| 228 |
+
have hk₁ : SecondKind c₁ := secondCoordinates_secondKind c
|
| 229 |
+
have hH₁ : ∀ k : ℕ, ∃ I : Set (Fin n), ∀ g : G,
|
| 230 |
+
g∈H.level k ↔ ∀ i∈I, c₁.coord g i=0 := by
|
| 231 |
+
intro k
|
| 232 |
+
obtain ⟨I,hI⟩ := hH k
|
| 233 |
+
exact ⟨I,secondCoordinates_subspace c (H.level k) I hI⟩
|
| 234 |
+
have hΓ₁ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c₁.coord g i=z :=
|
| 235 |
+
expCoordinates_lattice c Γ hΓ
|
| 236 |
+
let w:=subspaceWeight c₁ H s hs
|
| 237 |
+
have hw : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin n, w i < k → c₁.coord g i=0 :=
|
| 238 |
+
subspaceWeight_level c₁ H s hs h0 hH₁
|
| 239 |
+
obtain ⟨p,hp⟩ := exists_sorting_permutation w
|
| 240 |
+
let c₂ := sortedCoordinates c₁ w p hp hk₁ H h0 h1 hw
|
| 241 |
+
have hcoord (g : G) (i : Fin n) : c₂.coord g i=c₁.coord g (p i) := rfl
|
| 242 |
+
have hΓ₂ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c₂.coord g i=z := by
|
| 243 |
+
intro g
|
| 244 |
+
rw [hΓ₁]
|
| 245 |
+
constructor
|
| 246 |
+
· intro hg i
|
| 247 |
+
exact hg (p i)
|
| 248 |
+
· intro hg i
|
| 249 |
+
simpa only [hcoord,Equiv.apply_symm_apply] using hg (p.symm i)
|
| 250 |
+
refine ⟨secondCoordinates c₂,secondCoordinates_secondKind c₂,
|
| 251 |
+
expCoordinates_lattice c₂ Γ hΓ₂,?_⟩
|
| 252 |
+
intro k
|
| 253 |
+
obtain ⟨r,hr,hrk⟩ := exists_weight_cutoff (w ∘ p) hp k
|
| 254 |
+
refine ⟨r,hr,?_⟩
|
| 255 |
+
apply secondCoordinates_adapted c₂ (H.level k) r
|
| 256 |
+
intro g
|
| 257 |
+
rw [hw]
|
| 258 |
+
constructor
|
| 259 |
+
· intro hg i hi
|
| 260 |
+
exact hg (p i) ((hrk i).mpr hi)
|
| 261 |
+
· intro hg i hi
|
| 262 |
+
have hpi : (w ∘ p) (p.symm i) < k := by simpa using hi
|
| 263 |
+
simpa only [hcoord,Equiv.apply_symm_apply] using hg (p.symm i) ((hrk _).mp hpi)
|
| 264 |
+
|
| 265 |
+
end MalcevWeightedCoordinates
|
| 266 |
+
|
| 267 |
+
end
|
| 268 |
+
end
|
| 269 |
+
end
|
| 270 |
+
end
|
| 271 |
+
end
|
| 272 |
+
|
| 273 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/MenuLiteral01.lean
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.Blocks02
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
section
|
| 9 |
+
noncomputable section
|
| 10 |
+
open Filter MeasureTheory
|
| 11 |
+
open scoped BigOperators ENNReal Topology
|
| 12 |
+
noncomputable section
|
| 13 |
+
open scoped BigOperators Topology BoundedContinuousFunction
|
| 14 |
+
noncomputable section
|
| 15 |
+
open scoped BigOperators
|
| 16 |
+
open MeasureTheory Filter Function
|
| 17 |
+
noncomputable section
|
| 18 |
+
open scoped BigOperators
|
| 19 |
+
noncomputable section
|
| 20 |
+
open Filter MeasureTheory
|
| 21 |
+
open scoped Topology BoundedContinuousFunction NNReal
|
| 22 |
+
noncomputable section
|
| 23 |
+
open scoped Topology BigOperators
|
| 24 |
+
noncomputable section
|
| 25 |
+
open scoped Topology BigOperators commutatorElement
|
| 26 |
+
noncomputable section
|
| 27 |
+
open scoped Topology BoundedContinuousFunction NNReal
|
| 28 |
+
noncomputable section
|
| 29 |
+
open scoped BigOperators
|
| 30 |
+
noncomputable section
|
| 31 |
+
open Filter MeasureTheory
|
| 32 |
+
open scoped Topology BigOperators BoundedContinuousFunction NNReal
|
| 33 |
+
noncomputable section
|
| 34 |
+
open Filter MeasureTheory
|
| 35 |
+
open scoped Topology BigOperators
|
| 36 |
+
noncomputable section
|
| 37 |
+
open Filter MeasureTheory
|
| 38 |
+
open scoped Topology BigOperators BoundedContinuousFunction NNReal
|
| 39 |
+
noncomputable section
|
| 40 |
+
open scoped Topology BigOperators
|
| 41 |
+
noncomputable section
|
| 42 |
+
open scoped Topology BoundedContinuousFunction NNReal BigOperators
|
| 43 |
+
noncomputable section
|
| 44 |
+
open Filter MeasureTheory
|
| 45 |
+
open scoped Topology BigOperators BoundedContinuousFunction NNReal
|
| 46 |
+
noncomputable section
|
| 47 |
+
open Filter MeasureTheory
|
| 48 |
+
open scoped Topology BigOperators BoundedContinuousFunction NNReal
|
| 49 |
+
namespace SourceMenuLiteral
|
| 50 |
+
open SourceProductChart SourceChartedMenu SourceFiniteMenuModels
|
| 51 |
+
open SourceAdmissible SourceBlocks SourceMenuAlignment SourcePivotPaths
|
| 52 |
+
open ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScales
|
| 53 |
+
variable {a s r s' : ℕ}
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
structure CosetPiece (F : Menu s) (K : ℝ≥0) where
|
| 57 |
+
index : Fin F.size
|
| 58 |
+
g : F.G index
|
| 59 |
+
x : F.G index ⧸ F.Γ index
|
| 60 |
+
obs : (F.G index ⧸ F.Γ index) →ᵇ ℝ
|
| 61 |
+
lip : letI : MetricSpace (F.G index ⧸ F.Γ index) :=
|
| 62 |
+
(F.metric index).replaceTopology (F.compatible index)
|
| 63 |
+
LipschitzWith K obs
|
| 64 |
+
range : ∀ z, obs z ∈ Set.Icc (0:ℝ) 1
|
| 65 |
+
|
| 66 |
+
variable {F : Menu s} {K : ℝ≥0}
|
| 67 |
+
def CosetPiece.eval (P : CosetPiece F K) (k : ℤ) : ℝ := P.obs (P.g^k • P.x)
|
| 68 |
+
|
| 69 |
+
def CosetPiece.lift (P : CosetPiece F K) : Piece F K where
|
| 70 |
+
index := P.index
|
| 71 |
+
g := P.g
|
| 72 |
+
x := P.x.out
|
| 73 |
+
obs := P.obs
|
| 74 |
+
lip := P.lip
|
| 75 |
+
range := P.range
|
| 76 |
+
|
| 77 |
+
lemma CosetPiece.lift_eval (P : CosetPiece F K) (k : ℤ) : P.lift.eval k = P.eval k := by
|
| 78 |
+
change P.obs (P.g^k • (QuotientGroup.mk P.x.out : F.G P.index ⧸ F.Γ P.index)) = _
|
| 79 |
+
rw [show (QuotientGroup.mk P.x.out : F.G P.index ⧸ F.Γ P.index)=P.x from Quotient.out_eq P.x]
|
| 80 |
+
rfl
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def raiseChart {G : Type} [Group G] [TopologicalSpace G] {Γ : Subgroup G}
|
| 85 |
+
(C : Chart s G Γ) (h : s ≤ s') : Chart s' G Γ :=
|
| 86 |
+
{ C with
|
| 87 |
+
step := by
|
| 88 |
+
refine le_antisymm ?_ bot_le
|
| 89 |
+
calc C.filtration.level (s'+1) ≤ C.filtration.level (s+1) :=
|
| 90 |
+
C.filtration.antitone (Nat.add_le_add_right h 1)
|
| 91 |
+
_ = ⊥ := C.step }
|
| 92 |
+
|
| 93 |
+
def raiseMenu (F : Menu s) (h : s ≤ s') : Menu s' :=
|
| 94 |
+
{ F with chart := fun i => raiseChart (F.chart i) h }
|
| 95 |
+
|
| 96 |
+
def CosetPiece.raise (P : CosetPiece F K) (h : s ≤ s') : CosetPiece (raiseMenu F h) K :=
|
| 97 |
+
{ P with }
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
structure ModelsSystem (A : Parameters a) (vs : Finset ℚ) (r : ℕ) (F : Menu s) where
|
| 102 |
+
model : ℕ → Models a r
|
| 103 |
+
K : ℝ≥0
|
| 104 |
+
piece : ℕ → Block a → ∀ (v : ℚ), v ∈ vs →
|
| 105 |
+
Fin r → ℤ → ℤ → CosetPiece F K
|
| 106 |
+
represents : ∀ N B v hv c k,
|
| 107 |
+
model N B v c k =
|
| 108 |
+
(piece N B v hv c (k/(A.H N B.1 : ℤ)) (k%(A.M N : ℤ))).eval
|
| 109 |
+
((k-k%(A.M N : ℤ))/(A.M N : ℤ))
|
| 110 |
+
|
| 111 |
+
variable {A : Parameters a} {vs : Finset ℚ} (S : ModelsSystem A vs r F)
|
| 112 |
+
|
| 113 |
+
def ModelsSystem.lift : System A vs r F where
|
| 114 |
+
model := S.model
|
| 115 |
+
K := S.K
|
| 116 |
+
piece N B v hv c j l := (S.piece N B v hv c j l).lift
|
| 117 |
+
represents := by
|
| 118 |
+
intro N B v hv c k
|
| 119 |
+
rw [CosetPiece.lift_eval]
|
| 120 |
+
exact S.represents N B v hv c k
|
| 121 |
+
|
| 122 |
+
def ModelsSystem.raise (h : s ≤ s') : ModelsSystem A vs r (raiseMenu F h) where
|
| 123 |
+
model := S.model
|
| 124 |
+
K := S.K
|
| 125 |
+
piece N B v hv c j l := (S.piece N B v hv c j l).raise h
|
| 126 |
+
represents := S.represents
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
theorem charted_finite_menu_alignment (a r s : ℕ) :
|
| 131 |
+
∃ (bs : Finset (Scale a)) (vs : Finset ℚ) (δ : ℝ),
|
| 132 |
+
0 < δ ∧
|
| 133 |
+
(∀ b ∈ bs, ∀ j, 0 < b j) ∧ (∀ v ∈ vs, 0 < v) ∧
|
| 134 |
+
(∀ b ∈ bs, ∀ B : Block a, blockProduct b B.set ∈ vs) ∧
|
| 135 |
+
∀ (A : Parameters a) (F : Menu s) (S : ModelsSystem A vs r F)
|
| 136 |
+
(μ : ℕ → Measure (Fin a → ℕ)),
|
| 137 |
+
(∀ N (hX : ∀ i, 4*primorial (N+1) ≤ A.X N i), μ N = A.law N hX) →
|
| 138 |
+
∀ τ : ℝ, 0 < τ →
|
| 139 |
+
δ ≤ Filter.liminf (fun N => (μ N).real (event bs (S.model N) (A.ht N) τ)) atTop := by
|
| 140 |
+
let t := max 1 s
|
| 141 |
+
have ht : 1 ≤ t := le_max_left _ _
|
| 142 |
+
have hs : s ≤ t := le_max_right _ _
|
| 143 |
+
refine ⟨tuples t r ht,values t r ht,delta t r ht (pivots a),
|
| 144 |
+
delta_pos t r ht _,tuples_pos t r ht,values_pos t r ht,closure t r ht,?_⟩
|
| 145 |
+
intro A F S μ hμ τ hτ
|
| 146 |
+
exact menu_alignment_liminf t r ht A (raiseMenu F hs) (S.raise hs).lift μ hμ τ hτ
|
| 147 |
+
|
| 148 |
+
end SourceMenuLiteral
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
end
|
| 155 |
+
end
|
| 156 |
+
end
|
| 157 |
+
end
|
| 158 |
+
end
|
| 159 |
+
end
|
| 160 |
+
end
|
| 161 |
+
end
|
| 162 |
+
end
|
| 163 |
+
end
|
| 164 |
+
end
|
| 165 |
+
end
|
| 166 |
+
end
|
| 167 |
+
end
|
| 168 |
+
end
|
| 169 |
+
end
|
| 170 |
+
end
|
| 171 |
+
|
| 172 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellFibers01.lean
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.RawHarmonic01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section RawSuccessInlineScope11
|
| 9 |
+
noncomputable section
|
| 10 |
+
open Filter Topology MeasureTheory
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
end
|
| 13 |
+
end RawSuccessInlineScope11
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
section RawSuccessInlineScope12
|
| 20 |
+
noncomputable section
|
| 21 |
+
open MeasureTheory Filter Topology
|
| 22 |
+
open scoped BigOperators
|
| 23 |
+
namespace MicrocellConditional
|
| 24 |
+
open Finset RawHarmonicProbability
|
| 25 |
+
attribute [local instance] Classical.propDecidable
|
| 26 |
+
|
| 27 |
+
def eventMass (C:Finset ℕ) (A:Set ℕ) : ℝ := ∑ p∈C,if p∈A then (p:ℝ)⁻¹ else 0
|
| 28 |
+
|
| 29 |
+
lemma law_apply_units (X W:ℕ) (hw:0<W) (hx:4*W≤X) (A:Set ℕ) :
|
| 30 |
+
(law X W hw hx:Measure ℕ).real A =
|
| 31 |
+
eventMass (units X W) A/DyadicHarmonicBoundary.mass X (X^2) W := by
|
| 32 |
+
unfold eventMass
|
| 33 |
+
rw [law_apply,units,sum_filter]
|
| 34 |
+
congr 1
|
| 35 |
+
apply sum_congr rfl
|
| 36 |
+
intro p hp
|
| 37 |
+
split_ifs <;> simp_all
|
| 38 |
+
|
| 39 |
+
lemma subset_event_sum (X W:ℕ) (C:Finset ℕ) (hC:C⊆units X W) (A:Set ℕ) :
|
| 40 |
+
eventMass (units X W) (A∩(C:Set ℕ))=eventMass C A := by
|
| 41 |
+
unfold eventMass
|
| 42 |
+
symm
|
| 43 |
+
calc
|
| 44 |
+
_ = ∑ p∈C,if p∈A∩(C:Set ℕ) then (p:ℝ)⁻¹ else 0 := by
|
| 45 |
+
apply sum_congr rfl
|
| 46 |
+
intro p hp
|
| 47 |
+
simp [hp]
|
| 48 |
+
_ = ∑ p∈units X W,if p∈A∩(C:Set ℕ) then (p:ℝ)⁻¹ else 0 :=
|
| 49 |
+
sum_subset hC (fun p hp hnot=>by simp [hnot])
|
| 50 |
+
_ = _ := by
|
| 51 |
+
apply sum_congr rfl
|
| 52 |
+
intro p hp
|
| 53 |
+
split_ifs <;> rfl
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
theorem conditional_ratio (X W:ℕ) (hw:0<W) (hx:4*W≤X)
|
| 58 |
+
(C:Finset ℕ) (hC:C⊆units X W) (A:Set ℕ) :
|
| 59 |
+
(law X W hw hx:Measure ℕ).real (A∩(C:Set ℕ)) /
|
| 60 |
+
(law X W hw hx:Measure ℕ).real (C:Set ℕ) =
|
| 61 |
+
eventMass C A/(∑ p∈C,(p:ℝ)⁻¹) := by
|
| 62 |
+
rw [law_apply_units,law_apply_units,subset_event_sum X W C hC A]
|
| 63 |
+
have hd:eventMass (units X W) (C:Set ℕ)=∑ p∈C,(p:ℝ)⁻¹ := by
|
| 64 |
+
have hh:=subset_event_sum X W C hC Set.univ
|
| 65 |
+
rw [Set.univ_inter] at hh
|
| 66 |
+
exact hh.trans (by simp [eventMass])
|
| 67 |
+
rw [hd,div_div_div_cancel_right₀ (mass_pos X W hw hx).ne']
|
| 68 |
+
|
| 69 |
+
lemma cell_real_law (C:Finset ℕ) (hC:C.Nonempty) (hpos:∀ p∈C,0<p) (A:Set ℕ) :
|
| 70 |
+
letI : Nonempty C:=hC.coe_sort
|
| 71 |
+
(MicrocellProbability.weightedLaw (fun p:C=>(p.1:ℝ)⁻¹)
|
| 72 |
+
(fun p=>inv_pos.mpr (by exact_mod_cast hpos p.1 p.2))
|
| 73 |
+
Subtype.val : Measure ℕ).real A =
|
| 74 |
+
eventMass C A/(∑ p∈C,(p:ℝ)⁻¹) := by
|
| 75 |
+
classical
|
| 76 |
+
let : Nonempty C:=hC.coe_sort
|
| 77 |
+
rw [MicrocellProbability.weightedLaw_apply _ _ _ _ MeasurableSet.of_discrete]
|
| 78 |
+
simp only [MicrocellHarmonic.weight]
|
| 79 |
+
rw [sum_coe_sort C (fun p:ℕ=>(p:ℝ)⁻¹)]
|
| 80 |
+
rw [sum_coe_sort C (fun p:ℕ=>(p:ℝ)⁻¹/(∑ q∈C,(q:ℝ)⁻¹)*(if p∈A then 1 else 0))]
|
| 81 |
+
unfold eventMass
|
| 82 |
+
rw [sum_div]
|
| 83 |
+
apply sum_congr rfl
|
| 84 |
+
intro p hp
|
| 85 |
+
split_ifs <;> simp_all
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
theorem conditional_event_error (X W:ℕ) (hw:0<W) (hx:4*W≤X)
|
| 90 |
+
(C:Finset ℕ) (hC:C.Nonempty) (hsub:C⊆units X W)
|
| 91 |
+
(x₀ R:ℝ) (hbase:(X:ℝ)≤x₀) (hR:0≤R)
|
| 92 |
+
(hwindow:∀ p∈C,x₀≤(p:ℝ) ∧ (p:ℝ)≤x₀+R) (A:Set ℕ) :
|
| 93 |
+
letI : Nonempty C:=hC.coe_sort
|
| 94 |
+
|(law X W hw hx:Measure ℕ).real (A∩(C:Set ℕ)) /
|
| 95 |
+
(law X W hw hx:Measure ℕ).real (C:Set ℕ) -
|
| 96 |
+
(MicrocellProbability.uniformLaw (Subtype.val:C→ℕ):Measure ℕ).real A| ≤ R/X := by
|
| 97 |
+
let : Nonempty C:=hC.coe_sort
|
| 98 |
+
have hxp:(0:ℝ)<X:=by exact_mod_cast (show 0<X by omega)
|
| 99 |
+
have hx₀:0<x₀:=hxp.trans_le hbase
|
| 100 |
+
have hpos:∀ p∈C,0<p:=by
|
| 101 |
+
intro p hp
|
| 102 |
+
have hh:=hx₀.trans_le (hwindow p hp).1
|
| 103 |
+
exact_mod_cast hh
|
| 104 |
+
rw [conditional_ratio X W hw hx C hsub A,←cell_real_law C hC hpos A]
|
| 105 |
+
have hh:=MicrocellProbability.harmonic_event_error (fun p:C=>(p.1:ℝ)) x₀ R hx₀ hR
|
| 106 |
+
(fun p=>hwindow p.1 p.2) (Subtype.val:C→ℕ) A MeasurableSet.of_discrete
|
| 107 |
+
exact hh.trans (div_le_div_of_nonneg_left hR hxp hbase)
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
theorem conditional_success (X W:ℕ) (hw:0<W) (hx:4*W≤X)
|
| 112 |
+
(C:Finset ℕ) (hC:C.Nonempty) (hsub:C⊆units X W)
|
| 113 |
+
(x₀ R c:ℝ) (hbase:(X:ℝ)≤x₀) (hR:0≤R)
|
| 114 |
+
(hwindow:∀ p∈C,x₀≤(p:ℝ) ∧ (p:ℝ)≤x₀+R) (A:Set ℕ)
|
| 115 |
+
(herr:R/X≤c/6)
|
| 116 |
+
(hs:letI : Nonempty C:=hC.coe_sort
|
| 117 |
+
c/2<(MicrocellProbability.uniformLaw (Subtype.val:C→ℕ):Measure ℕ).real A) :
|
| 118 |
+
c/3<(law X W hw hx:Measure ℕ).real (A∩(C:Set ℕ)) /
|
| 119 |
+
(law X W hw hx:Measure ℕ).real (C:Set ℕ) := by
|
| 120 |
+
have hh:=conditional_event_error X W hw hx C hC hsub x₀ R hbase hR hwindow A
|
| 121 |
+
have hh':=(abs_le.mp hh).1
|
| 122 |
+
linarith
|
| 123 |
+
|
| 124 |
+
end MicrocellConditional
|
| 125 |
+
end
|
| 126 |
+
end RawSuccessInlineScope12
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
section RawSuccessInlineScope13
|
| 133 |
+
|
| 134 |
+
noncomputable section
|
| 135 |
+
open MeasureTheory
|
| 136 |
+
open scoped BigOperators
|
| 137 |
+
namespace MicrocellFibers
|
| 138 |
+
attribute [local instance] Classical.propDecidable
|
| 139 |
+
open Finset RawHarmonicProbability MicrocellConditional
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
def fiber (M N k r:ℕ) : Finset ℕ :=
|
| 144 |
+
(Ico (M*k) (M*(k+N))).filter (fun p=>p%M=r)
|
| 145 |
+
|
| 146 |
+
def point (M k r b:ℕ) : ℕ := M*k+r+M*b
|
| 147 |
+
|
| 148 |
+
lemma point_mem (M N k r:ℕ) (_:0<M) (hr:r<M) (b:Fin N) :
|
| 149 |
+
point M k r b∈fiber M N k r := by
|
| 150 |
+
apply mem_filter.mpr
|
| 151 |
+
constructor
|
| 152 |
+
· apply mem_Ico.mpr
|
| 153 |
+
constructor
|
| 154 |
+
· unfold point; omega
|
| 155 |
+
· unfold point
|
| 156 |
+
have hb:M*(b.val+1)≤M*N:=Nat.mul_le_mul_left M (by omega)
|
| 157 |
+
nlinarith
|
| 158 |
+
· simp [point,Nat.add_mod,Nat.mod_eq_of_lt hr]
|
| 159 |
+
|
| 160 |
+
lemma point_injective (M k r:ℕ) (hM:0<M) : Function.Injective (point M k r) := by
|
| 161 |
+
intro a b hab
|
| 162 |
+
unfold point at hab
|
| 163 |
+
exact Nat.eq_of_mul_eq_mul_left hM (Nat.add_left_cancel hab)
|
| 164 |
+
|
| 165 |
+
lemma represent (M N k r p:ℕ) (hM:0<M) (hp:p∈fiber M N k r) :
|
| 166 |
+
∃ b:Fin N,point M k r b=p := by
|
| 167 |
+
obtain ⟨hpI,hpr⟩:=mem_filter.mp hp
|
| 168 |
+
obtain ⟨hlo,hhi⟩:=mem_Ico.mp hpI
|
| 169 |
+
have hqlo:k≤p/M:=(Nat.le_div_iff_mul_le hM).mpr (by simpa [Nat.mul_comm] using hlo)
|
| 170 |
+
have hqhi:p/M<k+N:=(Nat.div_lt_iff_lt_mul hM).mpr (by simpa [Nat.mul_comm] using hhi)
|
| 171 |
+
refine ⟨⟨p/M-k,by omega⟩,?_⟩
|
| 172 |
+
have hq:k+(p/M-k)=p/M:=Nat.add_sub_of_le hqlo
|
| 173 |
+
dsimp [point]
|
| 174 |
+
calc
|
| 175 |
+
M*k+r+M*(p/M-k)=M*(k+(p/M-k))+r:=by ring
|
| 176 |
+
_ = M*(p/M)+p%M:=by rw [hq,hpr]
|
| 177 |
+
_ = p:=Nat.div_add_mod p M
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
def parametrization (M N k r:ℕ) (hM:0<M) (hr:r<M) : Fin N ≃ fiber M N k r :=
|
| 181 |
+
Equiv.ofBijective (fun b=>⟨point M k r b,point_mem M N k r hM hr b⟩) (by
|
| 182 |
+
constructor
|
| 183 |
+
· intro a b hab
|
| 184 |
+
apply Fin.ext
|
| 185 |
+
exact point_injective M k r hM (congrArg Subtype.val hab)
|
| 186 |
+
· intro p
|
| 187 |
+
obtain ⟨b,hb⟩:=represent M N k r p hM p.2
|
| 188 |
+
exact ⟨b,Subtype.ext hb⟩)
|
| 189 |
+
|
| 190 |
+
lemma fiber_card (M N k r:ℕ) (hM:0<M) (hr:r<M) :
|
| 191 |
+
(fiber M N k r).card=N := by
|
| 192 |
+
simpa only [Fintype.card_coe,Fintype.card_fin] using
|
| 193 |
+
(Fintype.card_congr (parametrization M N k r hM hr)).symm
|
| 194 |
+
|
| 195 |
+
lemma fiber_nonempty (M N k r:ℕ) (hM:0<M) (hN:0<N) (hr:r<M) :
|
| 196 |
+
(fiber M N k r).Nonempty := by
|
| 197 |
+
rw [←card_pos,fiber_card M N k r hM hr]
|
| 198 |
+
exact hN
|
| 199 |
+
|
| 200 |
+
lemma fiber_subset_units (X W M N k r:ℕ) (hWM:W∣M)
|
| 201 |
+
(hr:W.Coprime r) (hlo:X≤M*k) (hhi:M*(k+N)≤X^2) :
|
| 202 |
+
fiber M N k r⊆units X W := by
|
| 203 |
+
intro p hp
|
| 204 |
+
obtain ⟨hpI,hpr⟩:=mem_filter.mp hp
|
| 205 |
+
obtain ⟨hp₀,hp₁⟩:=mem_Ico.mp hpI
|
| 206 |
+
apply mem_filter.mpr
|
| 207 |
+
refine ⟨mem_Ico.mpr ⟨hlo.trans hp₀,hp₁.trans_le hhi⟩,?_⟩
|
| 208 |
+
have hm:W.Coprime (p%M):=hpr.symm ▸ hr
|
| 209 |
+
have hmod:(p%M)%W=p%W:=Nat.mod_mod_of_dvd p hWM
|
| 210 |
+
have hw:W.Coprime (p%W):=by
|
| 211 |
+
rw [←hmod]
|
| 212 |
+
exact (UnitIntervalCounts.coprime_mod W (p%M)).mpr hm
|
| 213 |
+
exact (UnitIntervalCounts.coprime_mod W p).mp hw
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
lemma uniform_fiber (M N k r:ℕ) (hM:0<M) (hN:0<N) (hr:r<M) (A:Set ℕ) :
|
| 218 |
+
letI : Nonempty (fiber M N k r):=(fiber_nonempty M N k r hM hN hr).coe_sort
|
| 219 |
+
letI : Nonempty (Fin N):=Fin.pos_iff_nonempty.mp hN
|
| 220 |
+
(MicrocellProbability.uniformLaw (Subtype.val : fiber M N k r→ℕ):Measure ℕ).real A =
|
| 221 |
+
(MicrocellProbability.uniformLaw (fun b:Fin N=>point M k r b):Measure ℕ).real A := by
|
| 222 |
+
let : Nonempty (fiber M N k r):=(fiber_nonempty M N k r hM hN hr).coe_sort
|
| 223 |
+
let : Nonempty (Fin N):=Fin.pos_iff_nonempty.mp hN
|
| 224 |
+
rw [MicrocellProbability.uniformLaw_apply _ _ MeasurableSet.of_discrete,
|
| 225 |
+
MicrocellProbability.uniformLaw_apply _ _ MeasurableSet.of_discrete]
|
| 226 |
+
unfold MicrocellHarmonic.uniform
|
| 227 |
+
simp only [Fintype.card_coe,Fintype.card_fin,fiber_card M N k r hM hr]
|
| 228 |
+
exact (Equiv.sum_comp (parametrization M N k r hM hr)
|
| 229 |
+
(fun p:fiber M N k r=>(N:ℝ)⁻¹*(if p.1∈A then 1 else 0))).symm
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
theorem raw_fiber_success (X W M N k r:ℕ) (hW:0<W) (hX:4*W≤X)
|
| 234 |
+
(hM:0<M) (hN:0<N) (hr:r<M) (hWR:W.Coprime r) (hWM:W∣M)
|
| 235 |
+
(hlo:X≤M*k) (hhi:M*(k+N)≤X^2) (c:ℝ) (A:Set ℕ)
|
| 236 |
+
(herr:((M*N:ℕ):ℝ)/X≤c/6)
|
| 237 |
+
(hm:letI : Nonempty (Fin N):=Fin.pos_iff_nonempty.mp hN
|
| 238 |
+
c/2<(MicrocellProbability.uniformLaw (fun b:Fin N=>point M k r b):Measure ℕ).real A) :
|
| 239 |
+
c/3<(law X W hW hX:Measure ℕ).real (A∩(fiber M N k r:Set ℕ)) /
|
| 240 |
+
(law X W hW hX:Measure ℕ).real (fiber M N k r:Set ℕ) := by
|
| 241 |
+
refine conditional_success X W hW hX (fiber M N k r)
|
| 242 |
+
(fiber_nonempty M N k r hM hN hr) (fiber_subset_units X W M N k r hWM hWR hlo hhi)
|
| 243 |
+
(M*k) (M*N) c (by exact_mod_cast hlo) (by positivity) ?_ A (by simpa only [Nat.cast_mul] using herr) ?_
|
| 244 |
+
· intro p hp
|
| 245 |
+
obtain ⟨hp₀,hp₁⟩:=mem_Ico.mp (mem_filter.mp hp).1
|
| 246 |
+
constructor
|
| 247 |
+
· exact_mod_cast hp₀
|
| 248 |
+
· have hp':p≤M*k+M*N:=by nlinarith
|
| 249 |
+
exact_mod_cast hp'
|
| 250 |
+
· rw [uniform_fiber M N k r hM hN hr A]
|
| 251 |
+
exact hm
|
| 252 |
+
|
| 253 |
+
end MicrocellFibers
|
| 254 |
+
end
|
| 255 |
+
end RawSuccessInlineScope13
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
end
|
| 262 |
+
|
| 263 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellHarmonic01.lean
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.HarmonicExposure02
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
noncomputable section
|
| 9 |
+
end
|
| 10 |
+
end
|
| 11 |
+
|
| 12 |
+
section
|
| 13 |
+
noncomputable section
|
| 14 |
+
namespace RoughFaceShift
|
| 15 |
+
open RationalLattice MalcevCharacters RealPolynomialDegree RoughScales Filter
|
| 16 |
+
open RoughSamplingWeights FinitePieceAverages RoughSourceExceptional RoughProductRemoval
|
| 17 |
+
open scoped BigOperators Topology
|
| 18 |
+
variable {G : Type} [Group G] [TopologicalSpace G] {dim : ℕ}
|
| 19 |
+
variable (Γ : Subgroup G) [MetricSpace (G⧸Γ)]
|
| 20 |
+
variable [IsTopologicalGroup G] (c : RealCoordinates G dim)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
theorem raw_conditional_face_uniform (hsk : SecondKind c)
|
| 24 |
+
(hΓ : ∀ g : G,g∈Γ ↔ ∀ i,∃ z : ℤ,c.coord g i=z)
|
| 25 |
+
(htop : (inferInstance : MetricSpace (G⧸Γ)).toUniformSpace.toTopologicalSpace =
|
| 26 |
+
QuotientGroup.instTopologicalSpace Γ)
|
| 27 |
+
(m v D d : ℕ) (hd : 0<d) (c₀ C₀ : ℝ) (B K : NNReal) (η : ℝ)
|
| 28 |
+
(hc₀ : 0<c₀) (hC₀ : 0<C₀) (hB : 0<B) (hη : 0<η)
|
| 29 |
+
(w M : ℕ→ℕ) (U V : ℕ → Fin m → ℝ) (Z0 H : ℕ→ℝ) (L : ℕ→ℤ)
|
| 30 |
+
(hw : Tendsto w atTop atTop) (hU : ∀ j,Tendsto (fun n=>U n j) atTop atTop)
|
| 31 |
+
(hUV : ∀ n j,U n j≤V n j)
|
| 32 |
+
(hZ : ∀ a : ℝ,0<a →Tendsto (fun n=>Z0 n/(1+∑ j,V n j)^a) atTop atTop)
|
| 33 |
+
(hH : ∀ n,0≤H n) (hHZ : Tendsto (fun n=>H n/Z0 n) atTop (𝓝 0))
|
| 34 |
+
(hM : ∀ n,0<M n) (hMs : ∀ n,Smooth (w n) (M n:ℤ))
|
| 35 |
+
(hL : ∀ n,0<L n) (hsm : ∀ n,Smooth (w n) (L n))
|
| 36 |
+
(hWL : ∀ n,(primorial (w n):ℤ)∣L n)
|
| 37 |
+
(hUL : ∀ j,Tendsto (fun n=>U n j/(L n:ℝ)) atTop atTop) :
|
| 38 |
+
∀ ε : ℝ,0<ε →∀ᶠ n in atTop,
|
| 39 |
+
∀ b : Exposure m,b.Legal (U n) (V n) (Z0 n) (w n) (M n) →
|
| 40 |
+
∀ X W : ℕ,(W:ℤ)∣(M n:ℤ) → b.a.natAbs.Coprime W →
|
| 41 |
+
(∀ t∈productTimes b.S b.r (L n),(X:ℝ)≤b.Q/(∏ j,(t j:ℝ))) →
|
| 42 |
+
(∀ t∈productTimes b.S b.r (L n),(b.Q+b.Δ)/(∏ j,(t j:ℝ))≤(X:ℝ)^2) →
|
| 43 |
+
∀ (A : Fin v → ℤ) (P : (Fin (m+v)→ℝ)→G),
|
| 44 |
+
(∀ i,HasDegree (fun y=>canonicalLog c (P y) i) D) →
|
| 45 |
+
∀ (σ : (G⧸Γ) → (G⧸Γ)),LipschitzWith K σ →
|
| 46 |
+
∀ h : (Fin m → ℤ) → Fin v → ℤ,
|
| 47 |
+
(∀ t∈productTimes b.S b.r (L n),∀ i,(d:ℤ)∣h t i ∧ |(h t i:ℝ)|≤H n) →
|
| 48 |
+
(∀ t∈productTimes b.S b.r (L n),∀ x : Fin v → ℤ,
|
| 49 |
+
σ (QuotientGroup.mk (P (Fin.append (fun j=>(t j:ℝ)) (fun i=>(x i:ℝ)))))=
|
| 50 |
+
QuotientGroup.mk (P (Fin.append (fun j=>(t j:ℝ)) (fun i=>((x i+h t i:ℤ):ℝ))))) →
|
| 51 |
+
HarmonicExposure.rawFiberMass
|
| 52 |
+
(exceptionalFace Γ m v c₀ C₀ B η b.Z d (M n) A P σ b.S b.r (L n))
|
| 53 |
+
X W b.Q b.Δ b.a (M n) /
|
| 54 |
+
HarmonicExposure.rawFiberMass (productTimes b.S b.r (L n))
|
| 55 |
+
X W b.Q b.Δ b.a (M n)<ε
|
| 56 |
+
:= by
|
| 57 |
+
classical
|
| 58 |
+
intro ε hε
|
| 59 |
+
have hu := conditional_face_uniform (Γ:=Γ) (c:=c) hsk hΓ htop m v D d hd
|
| 60 |
+
c₀ C₀ B K η hc₀ hC₀ hB hη w M U V Z0 H L hw hU hUV hZ hH hHZ
|
| 61 |
+
hM hMs hL hsm hWL hUL ε hε
|
| 62 |
+
have hup : ∀ᶠ n in atTop,∀ j,0<U n j :=
|
| 63 |
+
eventually_all.mpr (fun j=>(hU j).eventually (eventually_gt_atTop 0))
|
| 64 |
+
filter_upwards [hu,hup] with n hn hUn
|
| 65 |
+
intro b hb X W hWM ha hlo hhi A P hP σ hσ h hh hid
|
| 66 |
+
have hτ : ∀ t∈productTimes b.S b.r (L n),0<∏ j,(t j:ℝ) := by
|
| 67 |
+
intro t ht
|
| 68 |
+
apply Finset.prod_pos
|
| 69 |
+
intro j hj
|
| 70 |
+
have htj := Fintype.mem_piFinset.mp ht j
|
| 71 |
+
have htpos := (mem_times (b.S j) (b.r j) (L n) (t j) (hL n)).mp htj
|
| 72 |
+
exact (hUn j).trans_le (((hb.1 j).1).trans htpos.1)
|
| 73 |
+
have he (T : Finset (Fin m→ℤ)) (hT : T⊆productTimes b.S b.r (L n)) :=
|
| 74 |
+
HarmonicExposure.rawFiberMass_eq_exposed T X W b.Q b.Δ b.a (M n)
|
| 75 |
+
(by exact_mod_cast hM n) hWM ha
|
| 76 |
+
(fun t ht=>hτ t (hT ht)) (fun t ht=>hlo t (hT ht)) (fun t ht=>hhi t (hT ht))
|
| 77 |
+
have hsub : exceptionalFace Γ m v c₀ C₀ B η b.Z d (M n) A P σ b.S b.r (L n) ⊆
|
| 78 |
+
productTimes b.S b.r (L n) := Finset.filter_subset _ _
|
| 79 |
+
rw [he _ hsub,he _ (Finset.Subset.refl _)]
|
| 80 |
+
exact hn b hb A P hP σ hσ h hh hid
|
| 81 |
+
|
| 82 |
+
end RoughFaceShift
|
| 83 |
+
end
|
| 84 |
+
end
|
| 85 |
+
|
| 86 |
+
section
|
| 87 |
+
noncomputable section
|
| 88 |
+
namespace HarmonicExposure
|
| 89 |
+
open RoughSamplingWeights RoughSourceExceptional RoughProductRemoval Finset
|
| 90 |
+
open scoped BigOperators
|
| 91 |
+
attribute [local instance] Classical.propDecidable
|
| 92 |
+
|
| 93 |
+
def rawTailFiber {m : ℕ} (X : Fin m→ℕ) (W : ℕ) (S : Fin m→ℝ)
|
| 94 |
+
(r : Fin m→ℤ) (L : ℤ) : Finset (Fin m→ℕ) := by
|
| 95 |
+
classical
|
| 96 |
+
exact Fintype.piFinset (fun j=>(Ico (X j) ((X j)^2)).filter (fun t=>
|
| 97 |
+
W.Coprime t ∧ S j≤(t:ℝ) ∧ (t:ℝ)<2*S j ∧ L∣(t:ℤ)-r j))
|
| 98 |
+
|
| 99 |
+
def literalFiberMass {m : ℕ} (E : Set (Fin m→ℤ)) (X : Fin m→ℕ) (Xp W : ℕ)
|
| 100 |
+
(S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (Q Δ : ℝ) (a M : ℤ) : ℝ := by
|
| 101 |
+
classical
|
| 102 |
+
exact ∑ t∈(rawTailFiber X W S r L).filter (fun t=>(fun j=>(t j:ℤ))∈E),
|
| 103 |
+
(∏ j,(t j:ℝ)⁻¹)*∑ p∈pivotFiber Xp Q Δ (∏ j,(t j:ℝ)) a M,
|
| 104 |
+
if W.Coprime p then (p:ℝ)⁻¹ else 0
|
| 105 |
+
|
| 106 |
+
lemma rawTail_cast_mem {m : ℕ} (X : Fin m→ℕ) (W : ℕ) (S : Fin m→��)
|
| 107 |
+
(r : Fin m→ℤ) (L : ℤ) (hL : 0<L) (t : Fin m→ℕ)
|
| 108 |
+
(ht : t∈rawTailFiber X W S r L) : (fun j=>(t j:ℤ))∈productTimes S r L := by
|
| 109 |
+
classical
|
| 110 |
+
apply Fintype.mem_piFinset.mpr
|
| 111 |
+
intro j
|
| 112 |
+
have hj := mem_filter.mp (Fintype.mem_piFinset.mp ht j)
|
| 113 |
+
apply (mem_times (S j) (r j) L (t j) hL).mpr
|
| 114 |
+
obtain ⟨z,hz⟩ := hj.2.2.2.2
|
| 115 |
+
exact ⟨by simpa using hj.2.2.1,by simpa using hj.2.2.2.1,z,by linarith⟩
|
| 116 |
+
|
| 117 |
+
lemma times_nonneg {m : ℕ} (X : Fin m→ℕ) (S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ)
|
| 118 |
+
(hL : 0<L) (hlo : ∀ j,(X j:ℝ)≤S j) (t : Fin m→ℤ)
|
| 119 |
+
(ht : t∈productTimes S r L) (j : Fin m) : 0≤t j := by
|
| 120 |
+
have hj := (mem_times (S j) (r j) L (t j) hL).mp (Fintype.mem_piFinset.mp ht j)
|
| 121 |
+
have hn : (0:ℝ)≤(t j:ℝ) := (Nat.cast_nonneg (X j)).trans ((hlo j).trans hj.1)
|
| 122 |
+
exact_mod_cast hn
|
| 123 |
+
|
| 124 |
+
lemma times_nat_mem {m : ℕ} (X : Fin m→ℕ) (W : ℕ) (S : Fin m→ℝ)
|
| 125 |
+
(r : Fin m→ℤ) (L : ℤ) (hL : 0<L) (hWL : (W:ℤ)∣L)
|
| 126 |
+
(hr : ∀ j,(r j).natAbs.Coprime W)
|
| 127 |
+
(hlo : ∀ j,(X j:ℝ)≤S j) (hhi : ∀ j,2*S j≤(X j:ℝ)^2)
|
| 128 |
+
(t : Fin m→ℤ) (ht : t∈productTimes S r L) :
|
| 129 |
+
(fun j=>(t j).toNat)∈rawTailFiber X W S r L := by
|
| 130 |
+
classical
|
| 131 |
+
apply Fintype.mem_piFinset.mpr
|
| 132 |
+
intro j
|
| 133 |
+
have hj := (mem_times (S j) (r j) L (t j) hL).mp (Fintype.mem_piFinset.mp ht j)
|
| 134 |
+
have hn : ((t j).toNat:ℤ)=t j := Int.toNat_of_nonneg (times_nonneg X S r L hL hlo t ht j)
|
| 135 |
+
have hnr : ((t j).toNat:ℝ)=(t j:ℝ) := by exact_mod_cast hn
|
| 136 |
+
obtain ⟨z,hz⟩ := hj.2.2
|
| 137 |
+
have hcong : L∣((t j).toNat:ℤ)-r j := ⟨z,by rw [hn,hz]; ring⟩
|
| 138 |
+
apply mem_filter.mpr
|
| 139 |
+
refine ⟨mem_Ico.mpr ⟨?_,?_⟩,residue_unit W (t j).toNat (r j) L hWL (hr j) hcong,
|
| 140 |
+
?_,?_,hcong⟩
|
| 141 |
+
· have hh := (hlo j).trans hj.1
|
| 142 |
+
rw [←hnr] at hh
|
| 143 |
+
exact_mod_cast hh
|
| 144 |
+
· have hh := hj.2.1.trans_le (hhi j)
|
| 145 |
+
rw [←hnr] at hh
|
| 146 |
+
exact_mod_cast hh
|
| 147 |
+
· rw [hnr]
|
| 148 |
+
exact hj.1
|
| 149 |
+
· rw [hnr]
|
| 150 |
+
exact hj.2.1
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
theorem literal_mass_eq {m : ℕ} (E : Set (Fin m→ℤ)) (X : Fin m→ℕ) (Xp W : ℕ)
|
| 155 |
+
(S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (Q Δ : ℝ) (a M : ℤ)
|
| 156 |
+
(hL : 0<L) (hWL : (W:ℤ)∣L) (hr : ∀ j,(r j).natAbs.Coprime W)
|
| 157 |
+
(hlo : ∀ j,(X j:ℝ)≤S j) (hhi : ∀ j,2*S j≤(X j:ℝ)^2) :
|
| 158 |
+
literalFiberMass E X Xp W S r L Q Δ a M =
|
| 159 |
+
rawFiberMass ((productTimes S r L).filter (fun t=>t∈E)) Xp W Q Δ a M
|
| 160 |
+
:= by
|
| 161 |
+
classical
|
| 162 |
+
unfold literalFiberMass rawFiberMass
|
| 163 |
+
apply sum_bij (fun t _=>fun j=>(t j:ℤ))
|
| 164 |
+
· intro t ht
|
| 165 |
+
obtain ⟨ht,hE⟩ := mem_filter.mp ht
|
| 166 |
+
exact mem_filter.mpr ⟨rawTail_cast_mem X W S r L hL t ht,hE⟩
|
| 167 |
+
· intro t ht u hu he
|
| 168 |
+
funext j
|
| 169 |
+
exact_mod_cast congrFun he j
|
| 170 |
+
· intro t ht
|
| 171 |
+
obtain ⟨ht,hE⟩ := mem_filter.mp ht
|
| 172 |
+
have hh : (fun j=>((t j).toNat:ℤ))=t := funext (fun j=>
|
| 173 |
+
Int.toNat_of_nonneg (times_nonneg X S r L hL hlo t ht j))
|
| 174 |
+
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⟩
|
| 175 |
+
rwa [hh]
|
| 176 |
+
· intro t ht
|
| 177 |
+
simp only [Int.cast_natCast]
|
| 178 |
+
|
| 179 |
+
end HarmonicExposure
|
| 180 |
+
end
|
| 181 |
+
end
|
| 182 |
+
|
| 183 |
+
section
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
section RawSuccessInlineScope0
|
| 190 |
+
noncomputable section
|
| 191 |
+
open MeasureTheory Filter Topology
|
| 192 |
+
open scoped BigOperators
|
| 193 |
+
namespace MicrocellHarmonic
|
| 194 |
+
variable {I : Type*} [Fintype I] [Nonempty I]
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def weight (w : I → ℝ) (i : I) : ℝ := w i / ∑ j,w j
|
| 198 |
+
|
| 199 |
+
def uniform (_i : I) : ℝ := (Fintype.card I : ℝ)⁻¹
|
| 200 |
+
|
| 201 |
+
lemma total_pos (w : I → ℝ) (hw : ∀ i,0<w i) : 0 < ∑ i,w i :=
|
| 202 |
+
Finset.sum_pos (fun i _=>hw i) Finset.univ_nonempty
|
| 203 |
+
|
| 204 |
+
lemma sum_weight (w : I → ℝ) (hw : ∀ i,0<w i) : ∑ i,weight w i=1 := by
|
| 205 |
+
simp only [weight,←Finset.sum_div]
|
| 206 |
+
exact div_self (total_pos w hw).ne'
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
theorem normalized_error (w : I → ℝ) (hw : ∀ i,0<w i) (ε : ℝ)
|
| 211 |
+
(he : ∀ i j, |w i-w j| ≤ ε*w j) (i : I) :
|
| 212 |
+
|weight w i-uniform i| ≤ ε/(Fintype.card I : ℝ) := by
|
| 213 |
+
have hc : (0:ℝ)<Fintype.card I := by exact_mod_cast Fintype.card_pos
|
| 214 |
+
have hW := total_pos w hw
|
| 215 |
+
have hn : |∑ j,(w i-w j)| ≤ ε*∑ j,w j := by
|
| 216 |
+
calc
|
| 217 |
+
_ ≤ ∑ j,|w i-w j| := Finset.abs_sum_le_sum_abs _ _
|
| 218 |
+
_ ≤ ∑ j,ε*w j := Finset.sum_le_sum (fun j _=>he i j)
|
| 219 |
+
_ = _ := by rw [Finset.mul_sum]
|
| 220 |
+
have heq : weight w i-uniform i = (∑ j,(w i-w j))/((Fintype.card I : ℝ)*(∑ j,w j)) := by
|
| 221 |
+
simp only [weight,uniform,Finset.sum_sub_distrib,Finset.sum_const,Finset.card_univ,nsmul_eq_mul]
|
| 222 |
+
field_simp
|
| 223 |
+
rw [heq,abs_div,abs_of_pos (mul_pos hc hW)]
|
| 224 |
+
calc
|
| 225 |
+
_ ≤ (ε*∑ j,w j)/((Fintype.card I : ℝ)*(∑ j,w j)) :=
|
| 226 |
+
div_le_div_of_nonneg_right hn (mul_pos hc hW).le
|
| 227 |
+
_ = _ := by field_simp
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
theorem l1_error (w : I → ℝ) (hw : ∀ i,0<w i) (ε : ℝ)
|
| 232 |
+
(he : ∀ i j, |w i-w j| ≤ ε*w j) :
|
| 233 |
+
(∑ i,|weight w i-uniform i|) ≤ ε := by
|
| 234 |
+
have hc : (Fintype.card I : ℝ)≠0 := by exact_mod_cast Fintype.card_ne_zero
|
| 235 |
+
calc
|
| 236 |
+
_ ≤ ∑ i,ε/(Fintype.card I : ℝ) := Finset.sum_le_sum (fun i _=>normalized_error w hw ε he i)
|
| 237 |
+
_ = ε := by simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul]; field_simp
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
theorem test_error (w : I → ℝ) (hw : ∀ i,0<w i) (ε B : ℝ)
|
| 242 |
+
(hB : 0 ≤ B) (he : ∀ i j, |w i-w j| ≤ ε*w j)
|
| 243 |
+
(f : I → ℝ) (hf : ∀ i,|f i|≤B) :
|
| 244 |
+
|(∑ i,weight w i*f i)-(∑ i,uniform i*f i)| ≤ B*ε := by
|
| 245 |
+
rw [←Finset.sum_sub_distrib]
|
| 246 |
+
calc
|
| 247 |
+
_ = |∑ i,(weight w i-uniform i)*f i| := by congr 1; apply Finset.sum_congr rfl; intro i _; ring
|
| 248 |
+
_ ≤ ∑ i,|(weight w i-uniform i)*f i| := Finset.abs_sum_le_sum_abs _ _
|
| 249 |
+
_ ≤ ∑ i,B*|weight w i-uniform i| := Finset.sum_le_sum (by
|
| 250 |
+
intro i _; rw [abs_mul,mul_comm B]; exact mul_le_mul_of_nonneg_left (hf i) (abs_nonneg _))
|
| 251 |
+
_ = B*∑ i,|weight w i-uniform i| := (Finset.mul_sum _ _ _).symm
|
| 252 |
+
_ ≤ B*ε := mul_le_mul_of_nonneg_left (l1_error w hw ε he) hB
|
| 253 |
+
|
| 254 |
+
lemma reciprocal_oscillation {X R x y : ℝ} (hX : 0<X) (hR : 0≤R)
|
| 255 |
+
(hx : X≤x) (hx' : x≤X+R) (hy : X≤y) (hy' : y≤X+R) :
|
| 256 |
+
|x⁻¹-y⁻¹| ≤ (R/X)*y⁻¹ := by
|
| 257 |
+
have hx0 : 0<x := hX.trans_le hx
|
| 258 |
+
have hy0 : 0<y := hX.trans_le hy
|
| 259 |
+
have heq : x⁻¹-y⁻¹=(y-x)/(x*y) := by field_simp
|
| 260 |
+
have hdiff : |y-x|≤R := (abs_le.mpr ⟨by linarith,by linarith⟩)
|
| 261 |
+
rw [heq,abs_div,abs_of_pos (mul_pos hx0 hy0)]
|
| 262 |
+
calc
|
| 263 |
+
_ ≤ R/(x*y) := div_le_div_of_nonneg_right hdiff (mul_pos hx0 hy0).le
|
| 264 |
+
_ ≤ R/(X*y) := div_le_div_of_nonneg_left hR (mul_pos hX hy0) (mul_le_mul_of_nonneg_right hx hy0.le)
|
| 265 |
+
_ = _ := by ring
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
theorem harmonic_test_error (p : I → ℝ) (X R : ℝ) (hX : 0<X) (hR : 0≤R)
|
| 270 |
+
(hp : ∀ i,X≤p i ∧ p i≤X+R) (f : I → ℝ) (hf : ∀ i,|f i|≤1) :
|
| 271 |
+
|(∑ i,weight (fun j=>(p j)⁻¹) i*f i)-(∑ i,uniform i*f i)| ≤ R/X := by
|
| 272 |
+
simpa only [one_mul] using test_error (fun j=>(p j)⁻¹)
|
| 273 |
+
(fun j=>inv_pos.mpr (hX.trans_le (hp j).1)) (R/X) 1 zero_le_one
|
| 274 |
+
(fun i j=>reciprocal_oscillation hX hR (hp i).1 (hp i).2 (hp j).1 (hp j).2) f hf
|
| 275 |
+
|
| 276 |
+
end MicrocellHarmonic
|
| 277 |
+
|
| 278 |
+
end
|
| 279 |
+
end RawSuccessInlineScope0
|
| 280 |
+
end
|
| 281 |
+
|
| 282 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellSaturation01.lean
ADDED
|
@@ -0,0 +1,400 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.MicrocellFibers01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section RawSuccessInlineScope14
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
open MeasureTheory Filter Topology
|
| 12 |
+
open scoped BigOperators
|
| 13 |
+
namespace RawSmallCells
|
| 14 |
+
attribute [local instance] Classical.propDecidable
|
| 15 |
+
open Finset RawHarmonicProbability MicrocellConditional DyadicHarmonicBoundary
|
| 16 |
+
|
| 17 |
+
lemma finite_event (X W:ℕ) (hW:0<W) (hX:4*W≤X) (E:Finset ℕ)
|
| 18 |
+
(hE:E⊆RawHarmonicProbability.units X W) :
|
| 19 |
+
(law X W hW hX:Measure ℕ).real (E:Set ℕ)=
|
| 20 |
+
(∑ p∈E,(p:ℝ)⁻¹)/mass X (X^2) W := by
|
| 21 |
+
rw [law_apply_units]
|
| 22 |
+
congr 1
|
| 23 |
+
have hh:=subset_event_sum X W E hE Set.univ
|
| 24 |
+
simpa [eventMass] using hh
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
theorem cover_cost {J:Type*} [DecidableEq J] (X W R:ℕ)
|
| 29 |
+
(hW:0<W) (hX:4*W≤X) (T:Finset J) (a:J→ℕ) (E:Finset ℕ)
|
| 30 |
+
(hE:E⊆RawHarmonicProbability.units X W)
|
| 31 |
+
(hcover:∀ p∈E,∃ j∈T,p∈UnitIntervalCounts.units (a j) R W) :
|
| 32 |
+
(law X W hW hX:Measure ℕ).real (E:Set ℕ) ≤
|
| 33 |
+
4*T.card*((R:ℝ)+2*W)/X := by
|
| 34 |
+
have hxN:0<X:=by omega
|
| 35 |
+
have hx:(0:ℝ)<X:=by exact_mod_cast hxN
|
| 36 |
+
have hw:(0:ℝ)<W:=by exact_mod_cast hW
|
| 37 |
+
have ht:(0:ℝ)<W.totient:=by exact_mod_cast Nat.totient_pos.mpr hW
|
| 38 |
+
have hxx:X+X≤X^2:=by
|
| 39 |
+
have : 2≤X:=by omega
|
| 40 |
+
nlinarith
|
| 41 |
+
have hm:(W.totient:ℝ)/(4*W)≤ mass X (X^2) W:=
|
| 42 |
+
(dyadic_lower X W hW hX).trans (mass_mono hxx)
|
| 43 |
+
have hc:=UnitNeighborhoodCost.cover_count T a R W hW E (fun p hp=>mem_biUnion.mpr (hcover p hp))
|
| 44 |
+
rw [finite_event X W hW hX E hE]
|
| 45 |
+
calc
|
| 46 |
+
_ ≤ ((E.card:ℝ)/X)/(mass X (X^2) W) := by
|
| 47 |
+
apply div_le_div_of_nonneg_right ?_ (mass_nonneg _ _ _)
|
| 48 |
+
calc
|
| 49 |
+
_ ≤ ∑ _p∈E,(X:ℝ)⁻¹ := sum_le_sum (by
|
| 50 |
+
intro p hp
|
| 51 |
+
apply inv_anti₀ hx
|
| 52 |
+
exact_mod_cast (mem_Ico.mp (mem_filter.mp (hE hp)).1).1)
|
| 53 |
+
_ = _:=by simp;ring
|
| 54 |
+
_ ≤ ((T.card:ℝ)*W.totient*((R:ℝ)/W+2)/X)/((W.totient:ℝ)/(4*W)) := by
|
| 55 |
+
apply div_le_div₀ (by positivity) (div_le_div_of_nonneg_right hc hx.le) (by positivity) hm
|
| 56 |
+
_ = _:=by field_simp
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def partialCells (X W R:ℕ) : Finset ℕ := (RawHarmonicProbability.units X W).filter
|
| 61 |
+
(fun p=>¬(X≤R*(p/R) ∧ R*(p/R+1)≤X^2))
|
| 62 |
+
|
| 63 |
+
lemma partial_cover (X W R p:ℕ) (hR:0<R) (hp:p∈partialCells X W R) :
|
| 64 |
+
p∈UnitIntervalCounts.units X R W ∨ p∈UnitIntervalCounts.units (X^2-R) R W := by
|
| 65 |
+
obtain ⟨hpU,hbad⟩:=mem_filter.mp hp
|
| 66 |
+
obtain ⟨hpI,hcop⟩:=mem_filter.mp hpU
|
| 67 |
+
obtain ⟨hlo,hhi⟩:=mem_Ico.mp hpI
|
| 68 |
+
have hdiv:=Nat.div_add_mod p R
|
| 69 |
+
have hmod:=Nat.mod_lt p hR
|
| 70 |
+
by_cases hb:X≤R*(p/R)
|
| 71 |
+
· right
|
| 72 |
+
have hend:X^2<R*(p/R+1):=by omega
|
| 73 |
+
apply mem_filter.mpr
|
| 74 |
+
refine ⟨mem_Ico.mpr ⟨?_,?_⟩,hcop⟩
|
| 75 |
+
· have hmul:R*(p/R+1)=R*(p/R)+R:=by ring
|
| 76 |
+
omega
|
| 77 |
+
· omega
|
| 78 |
+
· left
|
| 79 |
+
apply mem_filter.mpr
|
| 80 |
+
refine ⟨mem_Ico.mpr ⟨hlo,?_⟩,hcop⟩
|
| 81 |
+
omega
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
theorem partial_cost (X W R:ℕ) (hW:0<W) (hX:4*W≤X) (hR:0<R) :
|
| 86 |
+
(law X W hW hX:Measure ℕ).real (partialCells X W R:Set ℕ) ≤
|
| 87 |
+
8*((R:ℝ)+2*W)/X := by
|
| 88 |
+
have hh:=cover_cost X W R hW hX (univ:Finset (Fin 2))
|
| 89 |
+
(fun i=>if i=0 then X else X^2-R) (partialCells X W R) (filter_subset _ _) (by
|
| 90 |
+
intro p hp
|
| 91 |
+
rcases partial_cover X W R p hR hp with h|h
|
| 92 |
+
· exact ⟨0,mem_univ _,by simpa using h⟩
|
| 93 |
+
· exact ⟨1,mem_univ _,by simpa using h⟩)
|
| 94 |
+
norm_num at hh ⊢
|
| 95 |
+
exact hh
|
| 96 |
+
|
| 97 |
+
lemma partial_cost_simple (X W R:ℕ) (hW:0<W) (hX:4*W≤X) (hWR:W≤R) :
|
| 98 |
+
(law X W hW hX:Measure ℕ).real (partialCells X W R:Set ℕ) ≤24*(R:ℝ)/X := by
|
| 99 |
+
apply (partial_cost X W R hW hX (hW.trans_le hWR)).trans
|
| 100 |
+
apply div_le_div_of_nonneg_right _ (by positivity)
|
| 101 |
+
have hh:(W:ℝ)≤R:=by exact_mod_cast hWR
|
| 102 |
+
linarith
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
theorem eventually_partial {X W R:ℕ→ℕ}
|
| 107 |
+
(hbase:∀ᶠ n in atTop,0<W n ∧ 4*W n≤X n ∧ W n≤R n)
|
| 108 |
+
(hr:Tendsto (fun n=>(R n:ℝ)/X n) atTop (𝓝 0)) :
|
| 109 |
+
∃ ε:ℕ→ℝ,Tendsto ε atTop (𝓝 0) ∧ ∀ᶠ n in atTop,
|
| 110 |
+
∀ (hw:0<W n) (hx:4*W n≤X n),
|
| 111 |
+
(law (X n) (W n) hw hx:Measure ℕ).real (partialCells (X n) (W n) (R n):Set ℕ)≤ε n := by
|
| 112 |
+
refine ⟨fun n=>24*((R n:ℝ)/X n),by simpa using hr.const_mul 24,?_⟩
|
| 113 |
+
filter_upwards [hbase] with n hn hw hx
|
| 114 |
+
simpa [mul_div_assoc] using partial_cost_simple (X n) (W n) (R n) hw hx hn.2.2
|
| 115 |
+
|
| 116 |
+
end RawSmallCells
|
| 117 |
+
end
|
| 118 |
+
end RawSuccessInlineScope14
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
section RawSuccessInlineScope15
|
| 125 |
+
noncomputable section
|
| 126 |
+
open scoped BigOperators
|
| 127 |
+
open Finset MeasureTheory
|
| 128 |
+
namespace RawPartitionSuccess
|
| 129 |
+
attribute [local instance] Classical.propDecidable
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
theorem finite_partition {α ι : Type*} [DecidableEq α] [DecidableEq ι]
|
| 134 |
+
(S : Finset α) (w : α → ℝ) (hw : ∀ x∈S,0≤w x)
|
| 135 |
+
(π : α → ι) (G : Set ι) (A : Set α) (a ε : ℝ) (ha : 0≤a)
|
| 136 |
+
(hZ : 0 < ∑ x∈S,w x)
|
| 137 |
+
(hbad : (∑ x∈S.filter (fun x => π x∉G),w x) ≤ ε*(∑ x∈S,w x))
|
| 138 |
+
(hs : ∀ i∈S.image π,i∈G →
|
| 139 |
+
a*(∑ x∈S.filter (fun x => π x=i),w x) ≤
|
| 140 |
+
∑ x∈S.filter (fun x => π x=i),if x∈A then w x else 0) :
|
| 141 |
+
a*(1-ε) ≤ (∑ x∈S,if x∈A then w x else 0)/(∑ x∈S,w x) := by
|
| 142 |
+
classical
|
| 143 |
+
let T := (S.image π).filter (·∈G)
|
| 144 |
+
have hb : (∑ x∈S.filter (fun x => π x∈G),w x) +
|
| 145 |
+
(∑ x∈S.filter (fun x => π x∉G),w x) = ∑ x∈S,w x := by
|
| 146 |
+
exact sum_filter_add_sum_filter_not S (fun x => π x∈G) w
|
| 147 |
+
have hf : S.filter (fun x => π x∈T)=S.filter (fun x => π x∈G) := by
|
| 148 |
+
ext x
|
| 149 |
+
simp only [mem_filter,T]
|
| 150 |
+
constructor
|
| 151 |
+
· rintro ⟨hx,hxT⟩;exact ⟨hx,hxT.2⟩
|
| 152 |
+
· rintro ⟨hx,hxG⟩;exact ⟨hx,mem_image_of_mem π hx,hxG⟩
|
| 153 |
+
have hsum : a*(∑ x∈S.filter (fun x => π x∈G),w x) ≤
|
| 154 |
+
∑ x∈S,if x∈A then w x else 0 := by
|
| 155 |
+
calc
|
| 156 |
+
_ = ∑ i∈T,a*(∑ x∈S.filter (fun x => π x=i),w x) := by
|
| 157 |
+
rw [←mul_sum,sum_fiberwise_eq_sum_filter,hf]
|
| 158 |
+
_ ≤ ∑ i∈T,∑ x∈S.filter (fun x => π x=i),if x∈A then w x else 0 :=
|
| 159 |
+
sum_le_sum (fun i hi => hs i (mem_filter.mp hi).1 (mem_filter.mp hi).2)
|
| 160 |
+
_ = ∑ x∈S.filter (fun x => π x∈G),if x∈A then w x else 0 := by
|
| 161 |
+
rw [sum_fiberwise_eq_sum_filter,hf]
|
| 162 |
+
_ ≤ ∑ x∈S,if x∈A then w x else 0 := by
|
| 163 |
+
apply sum_le_sum_of_subset_of_nonneg (filter_subset _ _)
|
| 164 |
+
intro x hx hnot
|
| 165 |
+
split_ifs <;> simp_all
|
| 166 |
+
apply (le_div_iff₀ hZ).mpr
|
| 167 |
+
have hlo : (1-ε)*(∑ x∈S,w x) ≤ ∑ x∈S.filter (fun x => π x∈G),w x := by
|
| 168 |
+
linarith
|
| 169 |
+
have hh := mul_le_mul_of_nonneg_left hlo ha
|
| 170 |
+
nlinarith
|
| 171 |
+
|
| 172 |
+
open RawHarmonicProbability MicrocellConditional
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
theorem raw_partition {ι : Type*} [DecidableEq ι]
|
| 177 |
+
(X W : ℕ) (hW : 0<W) (hX : 4*W≤X) (π : ℕ→ι)
|
| 178 |
+
(G : Set ι) (A : Set ℕ) (a ε : ℝ) (ha : 0≤a)
|
| 179 |
+
(hbad : (law X W hW hX : Measure ℕ).real {p | π p∉G} ≤ ε)
|
| 180 |
+
(hs : ∀ i∈(units X W).image π,i∈G →
|
| 181 |
+
a ≤ (law X W hW hX : Measure ℕ).real
|
| 182 |
+
(A∩((units X W).filter (fun p => π p=i):Set ℕ)) /
|
| 183 |
+
(law X W hW hX : Measure ℕ).real
|
| 184 |
+
((units X W).filter (fun p => π p=i):Set ℕ)) :
|
| 185 |
+
a*(1-ε) ≤ (law X W hW hX : Measure ℕ).real A := by
|
| 186 |
+
have hZ := mass_pos X W hW hX
|
| 187 |
+
rw [mass_units] at hZ
|
| 188 |
+
rw [law_apply_units] at hbad ⊢
|
| 189 |
+
rw [mass_units] at hbad ⊢
|
| 190 |
+
apply finite_partition (units X W) (fun p => (p:ℝ)⁻¹)
|
| 191 |
+
(fun p hp => by positivity) π G A a ε ha hZ
|
| 192 |
+
· have hh := (div_le_iff₀ hZ).mp hbad
|
| 193 |
+
have he : eventMass (units X W) {p | π p∉G} =
|
| 194 |
+
∑ p∈(units X W).filter (fun p=>π p∉G),(p:ℝ)⁻¹ := by
|
| 195 |
+
unfold eventMass
|
| 196 |
+
rw [sum_filter]
|
| 197 |
+
apply sum_congr rfl
|
| 198 |
+
intro p hp
|
| 199 |
+
split_ifs <;> simp_all
|
| 200 |
+
rw [he] at hh
|
| 201 |
+
exact hh
|
| 202 |
+
· intro i hi hG
|
| 203 |
+
have hcond := hs i hi hG
|
| 204 |
+
rw [conditional_ratio X W hW hX _ (filter_subset _ _) A] at hcond
|
| 205 |
+
have hCi : ((units X W).filter (fun p => π p=i)).Nonempty := by
|
| 206 |
+
obtain ⟨p,hp,rfl⟩ := mem_image.mp hi
|
| 207 |
+
exact ⟨p,mem_filter.mpr ⟨hp,rfl⟩⟩
|
| 208 |
+
have hCpos : 0 < ∑ p∈(units X W).filter (fun p => π p=i),(p:ℝ)⁻¹ := by
|
| 209 |
+
apply sum_pos _ hCi
|
| 210 |
+
intro p hp
|
| 211 |
+
apply inv_pos.mpr
|
| 212 |
+
exact units_pos (by omega) ⟨p,(mem_filter.mp hp).1⟩
|
| 213 |
+
exact (le_div_iff₀ hCpos).mp hcond
|
| 214 |
+
|
| 215 |
+
end RawPartitionSuccess
|
| 216 |
+
end
|
| 217 |
+
end RawSuccessInlineScope15
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
section RawSuccessInlineScope16
|
| 224 |
+
noncomputable section
|
| 225 |
+
open scoped BigOperators
|
| 226 |
+
open Finset MeasureTheory
|
| 227 |
+
namespace MicrocellSaturation
|
| 228 |
+
open RawHarmonicProbability RawSmallCells RawPartitionSuccess MicrocellFibers
|
| 229 |
+
attribute [local instance] Classical.propDecidable
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
def good {J : Type*} (X R H : ℕ) (t : J→ℕ) (i : ℕ×ℕ) : Prop :=
|
| 234 |
+
X≤R*i.1 ∧ R*(i.1+1)≤X^2 ∧
|
| 235 |
+
∀ j,t j*(R*i.1-R)/H=t j*(R*(i.1+1)+R)/H
|
| 236 |
+
|
| 237 |
+
def label (R M p : ℕ) : ℕ×ℕ := (p/R,p%M)
|
| 238 |
+
|
| 239 |
+
lemma quotient_window (R p : ℕ) (hR : 0<R) :
|
| 240 |
+
R*(p/R)≤p ∧ p<R*(p/R+1) := by
|
| 241 |
+
constructor
|
| 242 |
+
· exact Nat.mul_div_le p R
|
| 243 |
+
· exact Nat.lt_mul_div_succ p hR
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
lemma saturated {J : Type*} (X W R H M : ℕ) (t : J→ℕ) (hR : 0<R)
|
| 248 |
+
(p : ℕ) (hp : p∈units X W)
|
| 249 |
+
(hpartial : p∉partialCells X W R)
|
| 250 |
+
(hstable : ∀ j,t j*(p-2*R)/H=t j*(p+2*R)/H) :
|
| 251 |
+
good X R H t (label R M p) := by
|
| 252 |
+
have hc : X≤R*(p/R) ∧ R*(p/R+1)≤X^2 := by
|
| 253 |
+
simpa only [partialCells,mem_filter,hp,true_and,not_not] using hpartial
|
| 254 |
+
refine ⟨hc.1,hc.2,?_⟩
|
| 255 |
+
intro j
|
| 256 |
+
have hw := quotient_window R p hR
|
| 257 |
+
have hmul : R*(p/R+1) = R*(p/R)+R := by ring
|
| 258 |
+
have hl : p-2*R≤R*(p/R)-R := by omega
|
| 259 |
+
have hh : R*(p/R+1)+R≤p+2*R := by omega
|
| 260 |
+
have hmid : R*(p/R)-R≤R*(p/R+1)+R := by omega
|
| 261 |
+
have hl' := Nat.div_le_div_right (c:=H) (Nat.mul_le_mul_left (t j) hl)
|
| 262 |
+
have hh' := Nat.div_le_div_right (c:=H) (Nat.mul_le_mul_left (t j) hh)
|
| 263 |
+
have hm' := Nat.div_le_div_right (c:=H) (Nat.mul_le_mul_left (t j) hmid)
|
| 264 |
+
have he := hstable j
|
| 265 |
+
change t j*(R*(p/R)-R)/H=t j*(R*(p/R+1)+R)/H
|
| 266 |
+
omega
|
| 267 |
+
|
| 268 |
+
lemma enlarged_cell_stable {J : Type*} {X R H : ℕ} {t : J→ℕ} {i : ℕ×ℕ}
|
| 269 |
+
(hg : good X R H t i) (j : J) (z : ℕ)
|
| 270 |
+
(hz : t j*(R*i.1-R)≤z ∧ z≤t j*(R*(i.1+1)+R)) :
|
| 271 |
+
z/H=t j*(R*i.1)/H := by
|
| 272 |
+
have he := hg.2.2 j
|
| 273 |
+
have hlo := Nat.div_le_div_right (c:=H) hz.1
|
| 274 |
+
have hhi := Nat.div_le_div_right (c:=H) hz.2
|
| 275 |
+
have hl := Nat.div_le_div_right (c:=H)
|
| 276 |
+
(Nat.mul_le_mul_left (t j) (Nat.sub_le (R*i.1) R))
|
| 277 |
+
have hu := Nat.div_le_div_right (c:=H)
|
| 278 |
+
(Nat.mul_le_mul_left (t j) (show R*i.1≤R*(i.1+1)+R by nlinarith))
|
| 279 |
+
omega
|
| 280 |
+
|
| 281 |
+
lemma law_restrict_units (X W : ℕ) (hW : 0<W) (hX : 4*W≤X) (A : Set ℕ) :
|
| 282 |
+
(law X W hW hX : Measure ℕ).real (A∩(units X W:Set ℕ)) =
|
| 283 |
+
(law X W hW hX : Measure ℕ).real A := by
|
| 284 |
+
rw [MicrocellConditional.law_apply_units,MicrocellConditional.law_apply_units]
|
| 285 |
+
congr 1
|
| 286 |
+
unfold MicrocellConditional.eventMass
|
| 287 |
+
apply sum_congr rfl
|
| 288 |
+
intro p hp
|
| 289 |
+
simp [hp]
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
|
| 293 |
+
theorem bad_conditioning_bound {J : Type*} [Fintype J]
|
| 294 |
+
(X W R H M : ℕ) (hW : 0<W) (hX : 4*W≤X) (hR : 0<R)
|
| 295 |
+
(t : J→ℕ) (ε : ℝ)
|
| 296 |
+
(hb : ∀ j,DyadicHarmonicBoundary.badMass X (X^2) W (t j) H (2*R) /
|
| 297 |
+
DyadicHarmonicBoundary.mass X (X^2) W≤ε) :
|
| 298 |
+
(law X W hW hX : Measure ℕ).real {p | ¬good X R H t (label R M p)} ≤
|
| 299 |
+
8*((R:ℝ)+2*W)/X + Fintype.card J*ε := by
|
| 300 |
+
rw [←law_restrict_units X W hW hX]
|
| 301 |
+
have hsub : {p | ¬good X R H t (label R M p)}∩(units X W:Set ℕ) ⊆
|
| 302 |
+
(partialCells X W R:Set ℕ) ∪ ⋃ j,{p | t j*(p-2*R)/H≠t j*(p+2*R)/H} := by
|
| 303 |
+
intro p hp
|
| 304 |
+
by_cases hc : p∈partialCells X W R
|
| 305 |
+
· exact Or.inl hc
|
| 306 |
+
· right
|
| 307 |
+
by_contra hnot
|
| 308 |
+
have hst : ∀ j,t j*(p-2*R)/H=t j*(p+2*R)/H := by
|
| 309 |
+
simpa using hnot
|
| 310 |
+
exact hp.1 (saturated X W R H M t hR p hp.2 hc hst)
|
| 311 |
+
calc
|
| 312 |
+
_ ≤ (law X W hW hX : Measure ℕ).real
|
| 313 |
+
((partialCells X W R:Set ℕ) ∪ ⋃ j,{p | t j*(p-2*R)/H≠t j*(p+2*R)/H}) :=
|
| 314 |
+
measureReal_mono hsub
|
| 315 |
+
_ ≤ (law X W hW hX : Measure ℕ).real (partialCells X W R:Set ℕ) +
|
| 316 |
+
(law X W hW hX : Measure ℕ).real
|
| 317 |
+
(⋃ j,{p | t j*(p-2*R)/H≠t j*(p+2*R)/H}) := measureReal_union_le _ _
|
| 318 |
+
_ ≤ _ := add_le_add (partial_cost X W R hW hX hR)
|
| 319 |
+
(finite_boundary_bound X W H (2*R) hW hX t ε hb)
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
lemma conditioned_fiber (X W M N q r : ℕ) (hM : 0<M) (hN : 0<N)
|
| 324 |
+
(_ : r<M) (hWR : W.Coprime r) (hWM : W∣M)
|
| 325 |
+
(hlo : X≤(M*N)*q) (hhi : (M*N)*(q+1)≤X^2) :
|
| 326 |
+
(units X W).filter (fun p => label (M*N) M p=(q,r)) =
|
| 327 |
+
fiber M N (N*q) r := by
|
| 328 |
+
have hlo' : X≤M*(N*q) := by simpa only [mul_assoc] using hlo
|
| 329 |
+
have hhi' : M*(N*q+N)≤X^2 := by nlinarith
|
| 330 |
+
have hR : 0<M*N := Nat.mul_pos hM hN
|
| 331 |
+
ext p
|
| 332 |
+
constructor
|
| 333 |
+
· intro hp
|
| 334 |
+
obtain ⟨hp,hlabel⟩ := mem_filter.mp hp
|
| 335 |
+
have hq : p/(M*N)=q := congrArg Prod.fst hlabel
|
| 336 |
+
have hr' : p%M=r := congrArg Prod.snd hlabel
|
| 337 |
+
have hw := quotient_window (M*N) p hR
|
| 338 |
+
rw [hq] at hw
|
| 339 |
+
apply mem_filter.mpr
|
| 340 |
+
refine ⟨mem_Ico.mpr ⟨?_,?_⟩,hr'⟩ <;> nlinarith
|
| 341 |
+
· intro hp
|
| 342 |
+
have hpU := fiber_subset_units X W M N (N*q) r hWM hWR hlo' hhi' hp
|
| 343 |
+
obtain ⟨hpI,hpr⟩ := mem_filter.mp hp
|
| 344 |
+
obtain ⟨hpl,hph⟩ := mem_Ico.mp hpI
|
| 345 |
+
apply mem_filter.mpr
|
| 346 |
+
refine ⟨hpU,Prod.ext ?_ hpr⟩
|
| 347 |
+
exact Nat.div_eq_of_lt_le (by nlinarith) (by nlinarith)
|
| 348 |
+
|
| 349 |
+
lemma label_unit (X W M R : ℕ) (hM : 0<M) (hWM : W∣M) (i : ℕ×ℕ)
|
| 350 |
+
(hi : i∈(units X W).image (label R M)) : i.2<M ∧ W.Coprime i.2 := by
|
| 351 |
+
obtain ⟨p,hp,rfl⟩ := mem_image.mp hi
|
| 352 |
+
have hcop := (mem_filter.mp hp).2
|
| 353 |
+
refine ⟨Nat.mod_lt p hM,?_⟩
|
| 354 |
+
apply (UnitIntervalCounts.coprime_mod W (p%M)).mp
|
| 355 |
+
rw [Nat.mod_mod_of_dvd p hWM]
|
| 356 |
+
exact (UnitIntervalCounts.coprime_mod W p).mpr hcop
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
|
| 360 |
+
theorem global_success {J : Type*} [Fintype J]
|
| 361 |
+
(X W M N H : ℕ) (hW : 0<W) (hX : 4*W≤X)
|
| 362 |
+
(hM : 0<M) (hN : 0<N) (hWM : W∣M) (t : J→ℕ)
|
| 363 |
+
(c ε : ℝ) (hc : 0≤c) (A : Set ℕ)
|
| 364 |
+
(herr : ((M*N:ℕ):ℝ)/X≤c/6)
|
| 365 |
+
(hb : ∀ j,DyadicHarmonicBoundary.badMass X (X^2) W (t j) H (2*(M*N)) /
|
| 366 |
+
DyadicHarmonicBoundary.mass X (X^2) W≤ε)
|
| 367 |
+
(hs : ∀ i∈(units X W).image (label (M*N) M),good X (M*N) H t i →
|
| 368 |
+
letI : Nonempty (Fin N) := Fin.pos_iff_nonempty.mp hN
|
| 369 |
+
c/2<(MicrocellProbability.uniformLaw
|
| 370 |
+
(fun b:Fin N => point M (N*i.1) i.2 b):Measure ℕ).real A) :
|
| 371 |
+
(c/3)*(1-(8*((M*N:ℕ):ℝ)+16*W)/X-Fintype.card J*ε) ≤
|
| 372 |
+
(law X W hW hX : Measure ℕ).real A := by
|
| 373 |
+
have hbad := bad_conditioning_bound X W (M*N) H M hW hX (Nat.mul_pos hM hN) t ε hb
|
| 374 |
+
have hp := raw_partition X W hW hX (label (M*N) M)
|
| 375 |
+
{i | good X (M*N) H t i} A (c/3)
|
| 376 |
+
(8*(((M*N:ℕ):ℝ)+2*W)/X+Fintype.card J*ε) (by positivity) hbad
|
| 377 |
+
have hcond : ∀ i∈(units X W).image (label (M*N) M),good X (M*N) H t i →
|
| 378 |
+
c/3 ≤ (law X W hW hX : Measure ℕ).real
|
| 379 |
+
(A∩((units X W).filter (fun p => label (M*N) M p=i):Set ℕ)) /
|
| 380 |
+
(law X W hW hX : Measure ℕ).real
|
| 381 |
+
((units X W).filter (fun p => label (M*N) M p=i):Set ℕ) := by
|
| 382 |
+
intro i hi hg
|
| 383 |
+
obtain ⟨hr,hWr⟩ := label_unit X W M (M*N) hM hWM i hi
|
| 384 |
+
rw [show i=(i.1,i.2) from rfl,
|
| 385 |
+
conditioned_fiber X W M N i.1 i.2 hM hN hr hWr hWM hg.1 hg.2.1]
|
| 386 |
+
apply le_of_lt
|
| 387 |
+
apply raw_fiber_success X W M N (N*i.1) i.2 hW hX hM hN hr hWr hWM
|
| 388 |
+
(by simpa only [mul_assoc] using hg.1) (by nlinarith [hg.2.1]) c A herr
|
| 389 |
+
exact hs i hi hg
|
| 390 |
+
have hh := hp hcond
|
| 391 |
+
convert hh using 1
|
| 392 |
+
ring
|
| 393 |
+
|
| 394 |
+
end MicrocellSaturation
|
| 395 |
+
|
| 396 |
+
end
|
| 397 |
+
end RawSuccessInlineScope16
|
| 398 |
+
end
|
| 399 |
+
|
| 400 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/MicrocellScale01.lean
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.MicrocellHarmonic01
|
| 3 |
+
import OAI.Combinatorics.SumProduct.Alignment.PointLaw02
|
| 4 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
section RawSuccessInlineScope1
|
| 10 |
+
open scoped Topology BigOperators
|
| 11 |
+
open Filter MeasureTheory Set
|
| 12 |
+
open scoped Topology BigOperators
|
| 13 |
+
open Filter MeasureTheory Set
|
| 14 |
+
open scoped Topology BigOperators BoundedContinuousFunction ENNReal
|
| 15 |
+
open MeasureTheory Set Filter
|
| 16 |
+
namespace SourcePointLaw
|
| 17 |
+
noncomputable section
|
| 18 |
+
open scoped Topology BigOperators BoundedContinuousFunction ENNReal
|
| 19 |
+
open MeasureTheory Set Filter
|
| 20 |
+
|
| 21 |
+
variable {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y]
|
| 22 |
+
[TopologicalSpace Y] [OpensMeasurableSpace Y]
|
| 23 |
+
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
|
| 24 |
+
[SecondCountableTopology E] [MeasurableSpace E] [BorelSpace E]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
theorem beta_integrand_continuous (μ : ProbabilityMeasure X) (T : ℝ × X → Y)
|
| 29 |
+
(hT : Measurable T) (hc : ∀ x, Continuous (fun β => T (β, x))) (F : Y →ᵇ E) :
|
| 30 |
+
Continuous (fun β => ∫ x, F (T (β, x)) ∂(μ : Measure X)) := by
|
| 31 |
+
apply continuous_of_dominated (bound := fun _ => ‖F‖)
|
| 32 |
+
· intro β
|
| 33 |
+
exact (F.continuous.measurable.comp
|
| 34 |
+
(hT.comp (measurable_const.prodMk measurable_id))).aestronglyMeasurable
|
| 35 |
+
· intro β
|
| 36 |
+
exact Eventually.of_forall (fun x => F.norm_coe_le_norm _)
|
| 37 |
+
· exact integrable_const _
|
| 38 |
+
· exact Eventually.of_forall (fun x => F.continuous.comp (hc x))
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def empiricalLaw (p : ℕ → Y) (N : ℕ) : ProbabilityMeasure Y :=
|
| 43 |
+
if h : 0 < N then
|
| 44 |
+
letI : NeZero N := ⟨h.ne'⟩
|
| 45 |
+
uniformMixture (fun i : Fin N => (⟨Measure.dirac (p i.val), inferInstance⟩ : ProbabilityMeasure Y))
|
| 46 |
+
else ⟨Measure.dirac (p 0), inferInstance⟩
|
| 47 |
+
|
| 48 |
+
lemma integral_empiricalLaw [CompleteSpace E] (p : ℕ → Y) (N : ℕ) (hN : 0 < N) (F : Y →ᵇ E) :
|
| 49 |
+
∫ y, F y ∂(empiricalLaw p N : Measure Y) =
|
| 50 |
+
(N : ℝ)⁻¹ • ∑ n ∈ Finset.range N, F (p n) := by
|
| 51 |
+
let : NeZero N := ⟨hN.ne'⟩
|
| 52 |
+
have he : empiricalLaw p N = uniformMixture
|
| 53 |
+
(fun i : Fin N => (⟨Measure.dirac (p i.val), inferInstance⟩ : ProbabilityMeasure Y)) := by
|
| 54 |
+
exact dite_eq_left hN
|
| 55 |
+
rw [he]
|
| 56 |
+
trans (Fintype.card (Fin N) : ℝ)⁻¹ • ∑ i : Fin N,
|
| 57 |
+
∫ y, F y ∂(Measure.dirac (p i.val))
|
| 58 |
+
· exact integral_uniformMixture
|
| 59 |
+
(fun i : Fin N => (⟨Measure.dirac (p i.val), inferInstance⟩ : ProbabilityMeasure Y)) F
|
| 60 |
+
simp only [Fintype.card_fin, integral_dirac' F _ F.continuous.measurable.stronglyMeasurable,
|
| 61 |
+
Finset.sum_range]
|
| 62 |
+
|
| 63 |
+
end
|
| 64 |
+
end SourcePointLaw
|
| 65 |
+
|
| 66 |
+
namespace SourcePointLaw
|
| 67 |
+
noncomputable section
|
| 68 |
+
open scoped Topology BigOperators BoundedContinuousFunction ENNReal NNReal
|
| 69 |
+
open MeasureTheory Set Filter
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
theorem empirical_tendsto_betaMixture
|
| 74 |
+
{Y : Type*} [PseudoMetricSpace Y] [MeasurableSpace Y] [OpensMeasurableSpace Y]
|
| 75 |
+
(P : ℕ → ℤ → Y) (d : ℕ) [NeZero d]
|
| 76 |
+
(X : Fin d → Type*) [∀ r, MeasurableSpace (X r)]
|
| 77 |
+
(μ : ∀ r, ProbabilityMeasure (X r)) (T : ∀ r, ℝ × X r → Y)
|
| 78 |
+
(hT : ∀ r, Measurable (T r))
|
| 79 |
+
(hc : ∀ r x, Continuous (fun β => T r (β, x)))
|
| 80 |
+
(hloc : ∀ r (F : Y →ᵇ ℝ) (L : ℝ≥0), LipschitzWith L F →
|
| 81 |
+
∀ x ∈ Icc (0 : ℝ) 1, ∀ ε > 0,
|
| 82 |
+
∀ᶠ α : ℝ in 𝓝[>] 0, ∀ᶠ N : ℕ in atTop,
|
| 83 |
+
∀ a b : ℝ, 0 ≤ a → a ≤ x → x ≤ b → b ≤ 1 → b - a = α →
|
| 84 |
+
‖(𝔼 n ∈ residueInterval d r.val (a * N) (b * N), F (P N n)) -
|
| 85 |
+
∫ y, F (T r (x, y)) ∂(μ r : Measure (X r))‖ < ε) :
|
| 86 |
+
Tendsto (fun N : ℕ => empiricalLaw (fun n => P N n) N) atTop
|
| 87 |
+
(𝓝 (uniformMixture (fun r => betaImage (μ r) (T r) (hT r)))) := by
|
| 88 |
+
apply MeasureTheory.tendsto_iff_forall_lipschitz_integral_tendsto.mpr
|
| 89 |
+
intro f hb hl
|
| 90 |
+
obtain ⟨L, hL⟩ := hl
|
| 91 |
+
let F : Y →ᵇ ℝ := ⟨⟨f, hL.continuous⟩, hb⟩
|
| 92 |
+
change Tendsto (fun N : ℕ => ∫ y, F y ∂(empiricalLaw (fun n => P N n) N : Measure Y))
|
| 93 |
+
atTop (𝓝 (∫ y, F y ∂(uniformMixture (fun r => betaImage (μ r) (T r) (hT r)) : Measure Y)))
|
| 94 |
+
rw [integral_uniformMixture]
|
| 95 |
+
simp only [Fintype.card_fin, integral_betaImage]
|
| 96 |
+
have hlim := global_point_law_fin (fun N n => F (P N n)) d (Nat.pos_of_ne_zero (NeZero.ne d))
|
| 97 |
+
(fun r β => ∫ y, F (T r (β, y)) ∂(μ r : Measure (X r)))
|
| 98 |
+
(fun r => (beta_integrand_continuous (μ r) (T r) (hT r) (hc r) F).continuousOn)
|
| 99 |
+
(fun r => hloc r F L hL)
|
| 100 |
+
apply hlim.congr'
|
| 101 |
+
filter_upwards [Filter.eventually_ge_atTop (1 : ℕ)] with N hN
|
| 102 |
+
exact (integral_empiricalLaw (fun n => P N n) N (by omega) F).symm
|
| 103 |
+
|
| 104 |
+
end
|
| 105 |
+
end SourcePointLaw
|
| 106 |
+
|
| 107 |
+
end RawSuccessInlineScope1
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
section RawSuccessInlineScope2
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
noncomputable section
|
| 117 |
+
open MeasureTheory Filter Topology
|
| 118 |
+
open scoped BigOperators ENNReal
|
| 119 |
+
namespace MicrocellProbability
|
| 120 |
+
variable {I Y : Type*} [Fintype I] [Nonempty I] [MeasurableSpace Y]
|
| 121 |
+
open MicrocellHarmonic
|
| 122 |
+
attribute [local instance] Classical.propDecidable
|
| 123 |
+
|
| 124 |
+
lemma weight_pos (w:I→ℝ) (hw:∀ i,0<w i) (i:I) : 0<weight w i :=
|
| 125 |
+
div_pos (hw i) (total_pos w hw)
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def weightedLaw (w:I→ℝ) (hw:∀ i,0<w i) (p:I→Y) : ProbabilityMeasure Y :=
|
| 129 |
+
⟨∑ i,ENNReal.ofReal (weight w i) • Measure.dirac (p i), by
|
| 130 |
+
constructor
|
| 131 |
+
simp only [Measure.finsetSum_apply,Measure.smul_apply,measure_univ,smul_eq_mul,mul_one]
|
| 132 |
+
rw [←ENNReal.ofReal_sum_of_nonneg (fun i _=>(weight_pos w hw i).le),sum_weight w hw]
|
| 133 |
+
norm_num⟩
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def uniformLaw (p:I→Y) : ProbabilityMeasure Y :=
|
| 137 |
+
SourcePointLaw.uniformMixture (fun i=>⟨Measure.dirac (p i),inferInstance⟩)
|
| 138 |
+
|
| 139 |
+
lemma weightedLaw_apply (w:I→ℝ) (hw:∀ i,0<w i) (p:I→Y)
|
| 140 |
+
(S:Set Y) (hS:MeasurableSet S) :
|
| 141 |
+
(weightedLaw w hw p:Measure Y).real S =
|
| 142 |
+
∑ i,weight w i*(if p i∈S then 1 else 0) := by
|
| 143 |
+
classical
|
| 144 |
+
change ( (∑ i,ENNReal.ofReal (weight w i) • Measure.dirac (p i):Measure Y) S).toReal=_
|
| 145 |
+
simp only [Measure.finsetSum_apply,Measure.smul_apply,smul_eq_mul,Measure.dirac_apply' _ hS]
|
| 146 |
+
rw [ENNReal.toReal_sum]
|
| 147 |
+
· apply Finset.sum_congr rfl
|
| 148 |
+
intro i _
|
| 149 |
+
by_cases hi:p i∈S <;> simp [Set.indicator,hi,ENNReal.toReal_ofReal (weight_pos w hw i).le]
|
| 150 |
+
· intro i _
|
| 151 |
+
by_cases hi:p i∈S <;> simp [Set.indicator,hi]
|
| 152 |
+
|
| 153 |
+
lemma uniformLaw_apply (p:I→Y) (S:Set Y) (hS:MeasurableSet S) :
|
| 154 |
+
(uniformLaw p:Measure Y).real S = ∑ i,uniform i*(if p i∈S then 1 else 0) := by
|
| 155 |
+
classical
|
| 156 |
+
change (((Fintype.card I : ℝ≥0∞)⁻¹ • (∑ i,Measure.dirac (p i)) : Measure Y) S).toReal = _
|
| 157 |
+
simp only [Measure.smul_apply,Measure.finsetSum_apply,smul_eq_mul,
|
| 158 |
+
ENNReal.toReal_mul,ENNReal.toReal_inv,ENNReal.toReal_natCast,Measure.dirac_apply' _ hS]
|
| 159 |
+
rw [ENNReal.toReal_sum]
|
| 160 |
+
· rw [Finset.mul_sum]
|
| 161 |
+
apply Finset.sum_congr rfl
|
| 162 |
+
intro i _
|
| 163 |
+
by_cases hi:p i∈S <;> simp [uniform,Set.indicator,hi]
|
| 164 |
+
· intro i _
|
| 165 |
+
by_cases hi:p i∈S <;> simp [Set.indicator,hi]
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
theorem harmonic_event_error (x:I→ℝ) (X R:ℝ) (hX:0<X) (hR:0≤R)
|
| 170 |
+
(hx:∀ i,X≤x i ∧ x i≤X+R) (p:I→Y) (S:Set Y) (hS:MeasurableSet S) :
|
| 171 |
+
|(weightedLaw (fun i=>(x i)⁻¹) (fun i=>inv_pos.mpr (hX.trans_le (hx i).1)) p:Measure Y).real S -
|
| 172 |
+
(uniformLaw p:Measure Y).real S| ≤ R/X := by
|
| 173 |
+
rw [weightedLaw_apply _ _ _ _ hS,uniformLaw_apply _ _ hS]
|
| 174 |
+
apply harmonic_test_error x X R hX hR hx
|
| 175 |
+
intro i
|
| 176 |
+
split_ifs <;> norm_num
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
theorem harmonic_success (x:I→ℝ) (X R c:ℝ) (hX:0<X) (hR:0≤R)
|
| 181 |
+
(hx:∀ i,X≤x i ∧ x i≤X+R) (p:I→Y) (S:Set Y) (hS:MeasurableSet S)
|
| 182 |
+
(hcell:R/X≤c/6) (hm:c/2<(uniformLaw p:Measure Y).real S) :
|
| 183 |
+
c/3<(weightedLaw (fun i=>(x i)⁻¹) (fun i=>inv_pos.mpr (hX.trans_le (hx i).1)) p:Measure Y).real S := by
|
| 184 |
+
have he:=harmonic_event_error x X R hX hR hx p S hS
|
| 185 |
+
have he':= (abs_le.mp he).1
|
| 186 |
+
linarith
|
| 187 |
+
|
| 188 |
+
lemma empiricalLaw_eq (p:ℕ→Y) (N:ℕ) (hN:0<N) :
|
| 189 |
+
SourcePointLaw.empiricalLaw p N =
|
| 190 |
+
@uniformLaw (Fin N) Y inferInstance (Fin.pos_iff_nonempty.mp hN) inferInstance (fun i=>p i) := by
|
| 191 |
+
exact dite_eq_left hN
|
| 192 |
+
|
| 193 |
+
end MicrocellProbability
|
| 194 |
+
end
|
| 195 |
+
end RawSuccessInlineScope2
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
section RawSuccessInlineScope3
|
| 202 |
+
noncomputable section
|
| 203 |
+
open Filter Topology
|
| 204 |
+
namespace MicrocellScale
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
def radius (M H:ℕ) : ℕ := M*⌊Real.sqrt (H:ℝ)/(M:ℝ)⌋₊
|
| 208 |
+
def length (M H:ℕ) : ℕ := radius M H/M
|
| 209 |
+
|
| 210 |
+
lemma modulus_dvd (M H:ℕ) : M∣radius M H := dvd_mul_right _ _
|
| 211 |
+
lemma length_eq (M H:ℕ) (hM:0<M) : length M H=⌊Real.sqrt (H:ℝ)/(M:ℝ)⌋₊ :=
|
| 212 |
+
Nat.mul_div_cancel_left _ hM
|
| 213 |
+
|
| 214 |
+
lemma radius_le (M H:ℕ) (hM:0<M) : (radius M H:ℝ) ≤ Real.sqrt (H:ℝ) := by
|
| 215 |
+
have hm:(0:ℝ)<M:=by exact_mod_cast hM
|
| 216 |
+
have hh:=Nat.floor_le (show 0≤Real.sqrt (H:ℝ)/(M:ℝ) by positivity)
|
| 217 |
+
have hh':=mul_le_mul_of_nonneg_left hh hm.le
|
| 218 |
+
simpa [radius,mul_div_cancel₀ _ hm.ne'] using hh'
|
| 219 |
+
|
| 220 |
+
lemma radius_gt (M H:ℕ) (hM:0<M) : Real.sqrt (H:ℝ)-(M:ℝ)<(radius M H:ℝ) := by
|
| 221 |
+
have hm:(0:ℝ)<M:=by exact_mod_cast hM
|
| 222 |
+
have hh:=Nat.lt_floor_add_one (Real.sqrt (H:ℝ)/(M:ℝ))
|
| 223 |
+
have hh':=mul_lt_mul_of_pos_left hh hm
|
| 224 |
+
have he:(M:ℝ)*(Real.sqrt (H:ℝ)/(M:ℝ))=Real.sqrt (H:ℝ):=mul_div_cancel₀ _ hm.ne'
|
| 225 |
+
rw [he] at hh'
|
| 226 |
+
simp only [radius,Nat.cast_mul]
|
| 227 |
+
nlinarith
|
| 228 |
+
|
| 229 |
+
lemma radius_half_sqrt (M H:ℕ) (hM:0<M) (hH:4*(M:ℝ)^2≤H) :
|
| 230 |
+
Real.sqrt (H:ℝ)/2 ≤ (radius M H:ℝ) := by
|
| 231 |
+
have hs:(2:ℝ)*M≤Real.sqrt (H:ℝ):=(Real.le_sqrt (by positivity) (by positivity)).mpr (by nlinarith)
|
| 232 |
+
have hh:=radius_gt M H hM
|
| 233 |
+
linarith
|
| 234 |
+
|
| 235 |
+
lemma sqrt_ratio (H S C:ℝ) (hH:0≤H) (hS:0<S) :
|
| 236 |
+
Real.sqrt (H/S^(2*C))=Real.sqrt H/S^C := by
|
| 237 |
+
rw [Real.sqrt_div hH]
|
| 238 |
+
congr 1
|
| 239 |
+
have he:S^(2*C)=(S^C)^2 := by rw [two_mul,Real.rpow_add hS]; ring
|
| 240 |
+
rw [he,Real.sqrt_sq (Real.rpow_nonneg hS.le C)]
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
def Dominates (A S:ℕ→ℝ) : Prop :=
|
| 244 |
+
∀ C:ℝ,0<C → Tendsto (fun n=>A n/(S n)^C) atTop atTop
|
| 245 |
+
|
| 246 |
+
lemma sqrt_dominates {H:ℕ→ℕ} {S:ℕ→ℝ}
|
| 247 |
+
(hS:∀ᶠ n in atTop,1≤S n) (hd: Dominates (fun n=>(H n:ℝ)) S)
|
| 248 |
+
(C:ℝ) (hC:0<C) :
|
| 249 |
+
Tendsto (fun n=>Real.sqrt (H n:ℝ)/(S n)^C) atTop atTop := by
|
| 250 |
+
have hh:=Real.tendsto_sqrt_atTop.comp (hd (2*C) (by positivity))
|
| 251 |
+
apply hh.congr'
|
| 252 |
+
filter_upwards [hS] with n hn
|
| 253 |
+
exact sqrt_ratio (H n) (S n) C (by positivity) (by linarith)
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
theorem radius_dominates {M H:ℕ→ℕ} {S:ℕ→ℝ}
|
| 258 |
+
(hM:∀ᶠ n in atTop,0<M n ∧ (M n:ℝ)≤S n)
|
| 259 |
+
(hS:∀ᶠ n in atTop,1≤S n) (hd:Dominates (fun n=>(H n:ℝ)) S) :
|
| 260 |
+
Dominates (fun n=>(radius (M n) (H n):ℝ)) S := by
|
| 261 |
+
intro C hC
|
| 262 |
+
have hsmall:∀ᶠ n in atTop,4*(M n:ℝ)^2≤H n := by
|
| 263 |
+
filter_upwards [hM,hS,(hd 2 (by norm_num)).eventually_ge_atTop 4] with n hm hs hh
|
| 264 |
+
have hs0:0<S n:=by linarith
|
| 265 |
+
rw [Real.rpow_two] at hh
|
| 266 |
+
have hh':4*(S n)^2≤H n := (le_div_iff₀ (sq_pos_of_pos hs0)).mp hh
|
| 267 |
+
have hm0:(0:ℝ)≤M n:=by positivity
|
| 268 |
+
nlinarith
|
| 269 |
+
have hc:=sqrt_dominates hS hd C hC
|
| 270 |
+
have hh:Tendsto (fun n=>(Real.sqrt (H n:ℝ)/(S n)^C)/2) atTop atTop :=
|
| 271 |
+
hc.atTop_div_const (by norm_num)
|
| 272 |
+
apply tendsto_atTop_mono' atTop _ hh
|
| 273 |
+
filter_upwards [hS,hM,hsmall] with n hs hm hn
|
| 274 |
+
have hh:=radius_half_sqrt (M n) (H n) hm.1 hn
|
| 275 |
+
have hp:0<(S n)^C:=Real.rpow_pos_of_pos (by linarith) C
|
| 276 |
+
convert div_le_div_of_nonneg_right hh hp.le using 1
|
| 277 |
+
ring
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
theorem boundary_rate {M H t:ℕ→ℕ} {S:ℕ→ℝ}
|
| 282 |
+
(hM:∀ᶠ n in atTop,0<M n)
|
| 283 |
+
(hS:∀ᶠ n in atTop,1≤S n)
|
| 284 |
+
(ht:∀ᶠ n in atTop,(t n:ℝ)≤(S n)^2)
|
| 285 |
+
(hd:Dominates (fun n=>(H n:ℝ)) S) :
|
| 286 |
+
Tendsto (fun n=>(t n:ℝ)*radius (M n) (H n)/H n) atTop (𝓝 0) := by
|
| 287 |
+
have hh:Tendsto (fun n=>(S n)^2/Real.sqrt (H n:ℝ)) atTop (𝓝 0) := by
|
| 288 |
+
simpa only [Function.comp_def,inv_div,Real.rpow_two] using
|
| 289 |
+
tendsto_inv_atTop_zero.comp (sqrt_dominates hS hd 2 (by norm_num))
|
| 290 |
+
have hp:∀ᶠ n in atTop,0<(H n:ℝ) := by
|
| 291 |
+
filter_upwards [hS,(hd 1 (by norm_num)).eventually_ge_atTop 1] with n hs hn
|
| 292 |
+
rw [Real.rpow_one] at hn
|
| 293 |
+
have hpos:0<S n:=by linarith
|
| 294 |
+
have hpn:1*S n≤H n:=(le_div_iff₀ hpos).mp hn
|
| 295 |
+
linarith
|
| 296 |
+
apply squeeze_zero' (Filter.Eventually.of_forall (fun n=>by positivity)) ?_ hh
|
| 297 |
+
filter_upwards [hM,ht,hp] with n hm ht hn
|
| 298 |
+
have hs:0<Real.sqrt (H n:ℝ):=Real.sqrt_pos_of_pos hn
|
| 299 |
+
calc
|
| 300 |
+
_ ≤ (S n)^2*Real.sqrt (H n:ℝ)/H n := by
|
| 301 |
+
apply div_le_div_of_nonneg_right _ hn.le
|
| 302 |
+
exact mul_le_mul ht (radius_le _ _ hm) (by positivity) (sq_nonneg _)
|
| 303 |
+
_ = _ := by
|
| 304 |
+
have he:=Real.sq_sqrt hn.le
|
| 305 |
+
field_simp
|
| 306 |
+
nlinarith
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
theorem endpoint_rate {M H X:ℕ→ℕ}
|
| 310 |
+
(hM:∀ᶠ n in atTop,0<M n)
|
| 311 |
+
(hH:∀ᶠ n in atTop,0<H n)
|
| 312 |
+
(hd:Tendsto (fun n=>Real.log (X n:ℝ)/(H n:ℝ)) atTop atTop) :
|
| 313 |
+
Tendsto (fun n=>(radius (M n) (H n):ℝ)/X n) atTop (𝓝 0) := by
|
| 314 |
+
have hh:Tendsto (fun n=>(X n:ℝ)/(H n:ℝ)) atTop atTop := by
|
| 315 |
+
apply tendsto_atTop_mono' atTop _ hd
|
| 316 |
+
exact Filter.Eventually.of_forall (fun n=>div_le_div_of_nonneg_right
|
| 317 |
+
(Real.log_le_self (by positivity)) (by positivity))
|
| 318 |
+
have hz:Tendsto (fun n=>(H n:ℝ)/(X n:ℝ)) atTop (𝓝 0) := by
|
| 319 |
+
simpa only [Function.comp_def,inv_div] using tendsto_inv_atTop_zero.comp hh
|
| 320 |
+
apply squeeze_zero' (Filter.Eventually.of_forall (fun n=>by positivity)) ?_ hz
|
| 321 |
+
filter_upwards [hM,hH] with n hm hn
|
| 322 |
+
apply div_le_div_of_nonneg_right _ (by positivity)
|
| 323 |
+
apply (radius_le _ _ hm).trans
|
| 324 |
+
apply Real.sqrt_le_iff.mpr
|
| 325 |
+
have hn':(1:ℝ)≤H n:=by exact_mod_cast hn
|
| 326 |
+
constructor <;> nlinarith
|
| 327 |
+
|
| 328 |
+
end MicrocellScale
|
| 329 |
+
|
| 330 |
+
end
|
| 331 |
+
end RawSuccessInlineScope3
|
| 332 |
+
end
|
| 333 |
+
|
| 334 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/NearLattice01.lean
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
namespace NearLattice
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
noncomputable section
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
theorem card_int_interval_le (a b : ℝ) (hab : a ≤ b) :
|
| 16 |
+
((Finset.Icc ⌈a⌉ ⌊b⌋).card : ℝ) ≤ b - a + 1 := by
|
| 17 |
+
by_cases h : ⌈a⌉ ≤ ⌊b⌋ + 1
|
| 18 |
+
· have he : ((Finset.Icc ⌈a⌉ ⌊b⌋).card : ℝ) = (⌊b⌋ : ℝ) + 1 - (⌈a⌉ : ℝ) := by
|
| 19 |
+
exact_mod_cast Int.card_Icc_of_le ⌈a⌉ ⌊b⌋ h
|
| 20 |
+
rw [he]
|
| 21 |
+
linarith [Int.floor_le b, Int.le_ceil a]
|
| 22 |
+
· have he : Finset.Icc ⌈a⌉ ⌊b⌋ = ∅ := Finset.Icc_eq_empty (by omega)
|
| 23 |
+
simp only [he, Finset.card_empty, Nat.cast_zero]
|
| 24 |
+
linarith
|
| 25 |
+
|
| 26 |
+
theorem card_int_subset_interval_le (S : Finset ℤ) (a b : ℝ) (hab : a ≤ b)
|
| 27 |
+
(hS : ∀ n ∈ S, a ≤ (n : ℝ) ∧ (n : ℝ) ≤ b) :
|
| 28 |
+
(S.card : ℝ) ≤ b - a + 1 := by
|
| 29 |
+
have hs : S ⊆ Finset.Icc ⌈a⌉ ⌊b⌋ := by
|
| 30 |
+
intro n hn
|
| 31 |
+
exact Finset.mem_Icc.mpr ⟨Int.ceil_le.mpr (hS n hn).1, Int.le_floor.mpr (hS n hn).2⟩
|
| 32 |
+
exact (show (S.card : ℝ) ≤ (Finset.Icc ⌈a⌉ ⌊b⌋).card from
|
| 33 |
+
Nat.cast_le.mpr (Finset.card_le_card hs)).trans (card_int_interval_le a b hab)
|
| 34 |
+
|
| 35 |
+
theorem card_nat_subset_interval_le (S : Finset ℕ) (a b : ℝ) (hab : a ≤ b)
|
| 36 |
+
(hS : ∀ n ∈ S, a ≤ (n : ℝ) ∧ (n : ℝ) ≤ b) :
|
| 37 |
+
(S.card : ℝ) ≤ b - a + 1 := by
|
| 38 |
+
have hinj : Function.Injective (fun n : ℕ => (n : ℤ)) := Int.ofNat_injective
|
| 39 |
+
have hc : (S.image (fun n : ℕ => (n : ℤ))).card = S.card :=
|
| 40 |
+
Finset.card_image_of_injective S hinj
|
| 41 |
+
rw [← hc]
|
| 42 |
+
apply card_int_subset_interval_le _ a b hab
|
| 43 |
+
intro n hn
|
| 44 |
+
obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp hn
|
| 45 |
+
simpa only [Int.cast_natCast] using hS i hi
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
theorem card_affine_near_le (S : Finset ℕ) (L : ℕ) (γ β ε : ℝ)
|
| 50 |
+
(hβ : 0 < β) (hε : 0 ≤ ε) (hSL : ∀ n ∈ S, n < L)
|
| 51 |
+
(hgood : ∀ n ∈ S, ∃ m : ℤ, |γ + β * n - m| ≤ ε) :
|
| 52 |
+
(S.card : ℝ) ≤ (β * L + 2 * ε + 1) * (2 * ε / β + 1) := by
|
| 53 |
+
classical
|
| 54 |
+
let m (n : ℕ) : ℤ := if hn : n ∈ S then (hgood n hn).choose else 0
|
| 55 |
+
have hm (n : ℕ) (hn : n ∈ S) : |γ + β * n - m n| ≤ ε := by
|
| 56 |
+
simp only [m, dite_eq_left hn]
|
| 57 |
+
exact (hgood n hn).choose_spec
|
| 58 |
+
let T := S.image m
|
| 59 |
+
have hT : (T.card : ℝ) ≤ β * L + 2 * ε + 1 := by
|
| 60 |
+
have he := card_int_subset_interval_le T (γ - ε) (γ + β * L + ε)
|
| 61 |
+
(by have : 0 ≤ β * (L : ℝ) := mul_nonneg hβ.le (Nat.cast_nonneg _); linarith) ?_
|
| 62 |
+
· linarith
|
| 63 |
+
· intro z hz
|
| 64 |
+
obtain ⟨n, hn, rfl⟩ := Finset.mem_image.mp hz
|
| 65 |
+
have h := abs_le.mp (hm n hn)
|
| 66 |
+
have hn₀ : 0 ≤ (n : ℝ) := Nat.cast_nonneg _
|
| 67 |
+
have hn₁ : (n : ℝ) ≤ L := by exact_mod_cast (hSL n hn).le
|
| 68 |
+
constructor <;> nlinarith
|
| 69 |
+
have hfiber (z : ℤ) : ((S.filter (fun n => m n = z)).card : ℝ) ≤ 2 * ε / β + 1 := by
|
| 70 |
+
have he := card_nat_subset_interval_le (S.filter (fun n => m n = z))
|
| 71 |
+
(((z : ℝ) - ε - γ) / β) (((z : ℝ) + ε - γ) / β)
|
| 72 |
+
(div_le_div_of_nonneg_right (by linarith) hβ.le) ?_
|
| 73 |
+
· have hr : ((z : ℝ) + ε - γ) / β - ((z : ℝ) - ε - γ) / β = 2 * ε / β := by ring
|
| 74 |
+
rwa [hr] at he
|
| 75 |
+
· intro n hn
|
| 76 |
+
obtain ⟨hn, he⟩ := Finset.mem_filter.mp hn
|
| 77 |
+
have h := abs_le.mp (hm n hn)
|
| 78 |
+
rw [he] at h
|
| 79 |
+
constructor
|
| 80 |
+
· apply (div_le_iff₀ hβ).mpr
|
| 81 |
+
nlinarith
|
| 82 |
+
· apply (le_div_iff₀ hβ).mpr
|
| 83 |
+
nlinarith
|
| 84 |
+
have hmT : Set.MapsTo m S T := by
|
| 85 |
+
intro n hn
|
| 86 |
+
exact Finset.mem_image.mpr ⟨n, hn, rfl⟩
|
| 87 |
+
have hc : (S.card : ℝ) = ∑ z ∈ T, ((S.filter (fun n => m n = z)).card : ℝ) := by
|
| 88 |
+
exact_mod_cast Finset.card_eq_sum_card_fiberwise hmT
|
| 89 |
+
calc
|
| 90 |
+
_ = ∑ z ∈ T, ((S.filter (fun n => m n = z)).card : ℝ) := hc
|
| 91 |
+
_ ≤ ∑ _z ∈ T, (2 * ε / β + 1) := Finset.sum_le_sum (fun z _ => hfiber z)
|
| 92 |
+
_ = (T.card : ℝ) * (2 * ε / β + 1) := by simp only [Finset.sum_const, nsmul_eq_mul]
|
| 93 |
+
_ ≤ _ := mul_le_mul_of_nonneg_right hT (by positivity)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
theorem card_affine_near_abs_le (S : Finset ℕ) (L : ℕ) (γ β ε : ℝ)
|
| 97 |
+
(hβ : β ≠ 0) (hε : 0 ≤ ε) (hSL : ∀ n ∈ S, n < L)
|
| 98 |
+
(hgood : ∀ n ∈ S, ∃ m : ℤ, |γ + β * n - m| ≤ ε) :
|
| 99 |
+
(S.card : ℝ) ≤ (|β| * L + 2 * ε + 1) * (2 * ε / |β| + 1) := by
|
| 100 |
+
rcases lt_or_gt_of_ne hβ with hβ | hβ
|
| 101 |
+
· have hh : ∀ n ∈ S, ∃ m : ℤ, |-γ + (-β) * n - m| ≤ ε := by
|
| 102 |
+
intro n hn
|
| 103 |
+
obtain ⟨m, hm⟩ := hgood n hn
|
| 104 |
+
refine ⟨-m, ?_⟩
|
| 105 |
+
have he : -γ + (-β) * (n : ℝ) - ((-m : ℤ) : ℝ) = -(γ + β * n - m) := by
|
| 106 |
+
push_cast
|
| 107 |
+
ring
|
| 108 |
+
rwa [he, abs_neg]
|
| 109 |
+
simpa only [abs_of_neg hβ] using
|
| 110 |
+
card_affine_near_le S L (-γ) (-β) ε (neg_pos.mpr hβ) hε hSL hh
|
| 111 |
+
· simpa only [abs_of_pos hβ] using card_affine_near_le S L γ β ε hβ hε hSL hgood
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
theorem card_near_of_approx (S : Finset ℕ) (N q : ℕ) (hq : 0 < q)
|
| 116 |
+
(α γ β ε : ℝ) (m : ℤ) (happrox : α * q = m + β)
|
| 117 |
+
(hβ : β ≠ 0) (hβsmall : |β| ≤ 2 * ε) (hε : 0 ≤ ε) (hεsmall : ε ≤ 1 / 4)
|
| 118 |
+
(hSN : ∀ n ∈ S, n < N)
|
| 119 |
+
(hgood : ∀ n ∈ S, ∃ z : ℤ, |α * n + γ - z| ≤ ε) :
|
| 120 |
+
(S.card : ℝ) ≤ 4 * ε * N + 3 * q + 4 * q * ε / |β| := by
|
| 121 |
+
classical
|
| 122 |
+
let L := N / q + 1
|
| 123 |
+
let B := (|β| * L + 2 * ε + 1) * (2 * ε / |β| + 1)
|
| 124 |
+
have hfiber (r : ℕ) : ((S.filter (fun n => n % q = r)).card : ℝ) ≤ B := by
|
| 125 |
+
let Sᵣ := S.filter (fun n => n % q = r)
|
| 126 |
+
let T := Sᵣ.image (fun n => n / q)
|
| 127 |
+
have hc : T.card = Sᵣ.card := by
|
| 128 |
+
apply Finset.card_image_iff.mpr
|
| 129 |
+
intro x hx y hy he
|
| 130 |
+
change x / q = y / q at he
|
| 131 |
+
have hx' := (Finset.mem_filter.mp hx).2
|
| 132 |
+
have hy' := (Finset.mem_filter.mp hy).2
|
| 133 |
+
have h₁ := Nat.mod_add_div x q
|
| 134 |
+
have h₂ := Nat.mod_add_div y q
|
| 135 |
+
rw [hx', he] at h₁
|
| 136 |
+
rw [hy'] at h₂
|
| 137 |
+
omega
|
| 138 |
+
have hTL : ∀ k ∈ T, k < L := by
|
| 139 |
+
intro k hk
|
| 140 |
+
obtain ⟨n, hn, rfl⟩ := Finset.mem_image.mp hk
|
| 141 |
+
have h := Nat.div_le_div_right (c := q) (hSN n (Finset.mem_filter.mp hn).1).le
|
| 142 |
+
exact Nat.lt_succ_of_le h
|
| 143 |
+
have hTgood : ∀ k ∈ T, ∃ z : ℤ, |(α * r + γ) + β * k - z| ≤ ε := by
|
| 144 |
+
intro k hk
|
| 145 |
+
obtain ⟨n, hn, rfl⟩ := Finset.mem_image.mp hk
|
| 146 |
+
obtain ⟨hn, hr⟩ := Finset.mem_filter.mp hn
|
| 147 |
+
obtain ⟨z, hz⟩ := hgood n hn
|
| 148 |
+
refine ⟨z - m * (n / q : ℕ), ?_⟩
|
| 149 |
+
have he : (n : ℝ) = (r : ℝ) + (q : ℝ) * (n / q : ℕ) := by
|
| 150 |
+
have ht := Nat.mod_add_div n q
|
| 151 |
+
rw [hr] at ht
|
| 152 |
+
exact_mod_cast ht.symm
|
| 153 |
+
have heq : (α * r + γ) + β * (n / q : ℕ) - ((z - m * (n / q : ℕ) : ℤ) : ℝ) =
|
| 154 |
+
α * n + γ - z := by
|
| 155 |
+
simp only [Int.cast_sub, Int.cast_mul, Int.cast_natCast]
|
| 156 |
+
rw [he]
|
| 157 |
+
linear_combination -(n / q : ℕ) * happrox
|
| 158 |
+
rwa [heq]
|
| 159 |
+
have h := card_affine_near_abs_le T L (α * r + γ) β ε hβ hε hTL hTgood
|
| 160 |
+
rwa [hc] at h
|
| 161 |
+
have hm : Set.MapsTo (fun n => n % q) S (Finset.range q) := by
|
| 162 |
+
intro n _
|
| 163 |
+
exact Finset.mem_range.mpr (Nat.mod_lt _ hq)
|
| 164 |
+
have hc : (S.card : ℝ) =
|
| 165 |
+
∑ r ∈ Finset.range q, ((S.filter (fun n => n % q = r)).card : ℝ) := by
|
| 166 |
+
exact_mod_cast Finset.card_eq_sum_card_fiberwise hm
|
| 167 |
+
have hb : (S.card : ℝ) ≤ (q : ℝ) * B := by
|
| 168 |
+
rw [hc]
|
| 169 |
+
calc
|
| 170 |
+
_ ≤ ∑ _r ∈ Finset.range q, B := Finset.sum_le_sum (fun r _ => hfiber r)
|
| 171 |
+
_ = _ := by simp only [Finset.sum_const, Finset.card_range, nsmul_eq_mul]
|
| 172 |
+
have hbpos : 0 < |β| := abs_pos.mpr hβ
|
| 173 |
+
have hL : (q : ℝ) * L ≤ N + q := by
|
| 174 |
+
have h := Nat.div_mul_le_self N q
|
| 175 |
+
dsimp [L]
|
| 176 |
+
push_cast
|
| 177 |
+
have h' : (q : ℝ) * (N / q : ℕ) ≤ N := by exact_mod_cast (by simpa [Nat.mul_comm] using h)
|
| 178 |
+
nlinarith
|
| 179 |
+
have hq₀ : 0 ≤ (q : ℝ) := Nat.cast_nonneg _
|
| 180 |
+
have hqL₀ : 0 ≤ (q : ℝ) * L := by positivity
|
| 181 |
+
have hB : (q : ℝ) * B ≤ 4 * ε * N + 3 * q + 4 * q * ε / |β| := by
|
| 182 |
+
have hc₀ : 0 ≤ 2 * ε / |β| + 1 := by positivity
|
| 183 |
+
have hc₁ : 2 * ε + 1 ≤ 2 := by linarith
|
| 184 |
+
have hstep : (q : ℝ) * B ≤ q * ((|β| * L + 2) * (2 * ε / |β| + 1)) := by
|
| 185 |
+
apply mul_le_mul_of_nonneg_left _ hq₀
|
| 186 |
+
exact mul_le_mul_of_nonneg_right (by linarith) hc₀
|
| 187 |
+
have heq : (q : ℝ) * ((|β| * L + 2) * (2 * ε / |β| + 1)) =
|
| 188 |
+
q * L * (2 * ε + |β|) + 4 * q * ε / |β| + 2 * q := by
|
| 189 |
+
field_simp
|
| 190 |
+
ring
|
| 191 |
+
have hi₁ := mul_le_mul_of_nonneg_left hβsmall hqL₀
|
| 192 |
+
have hi₂ := mul_le_mul_of_nonneg_left hL (show 0 ≤ 4 * ε by positivity)
|
| 193 |
+
have hi₃ := mul_le_mul_of_nonneg_right hεsmall hq₀
|
| 194 |
+
rw [heq] at hstep
|
| 195 |
+
nlinarith
|
| 196 |
+
exact hb.trans hB
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
theorem exists_small_denominator (S : Finset ℕ) (N Q : ℕ) (hQ : 0 < Q)
|
| 201 |
+
(α γ ε : ℝ) (hSN : ∀ n ∈ S, n < N)
|
| 202 |
+
(hcard : N / Q + 1 < S.card)
|
| 203 |
+
(hgood : ∀ n ∈ S, ∃ z : ℤ, |α * n + γ - z| ≤ ε) :
|
| 204 |
+
∃ q : ℕ, 0 < q ∧ q < Q ∧ ∃ m : ℤ, |α * q - m| ≤ 2 * ε := by
|
| 205 |
+
classical
|
| 206 |
+
have hh : Set.MapsTo (fun n => n / Q) S (Finset.range (N / Q + 1)) := by
|
| 207 |
+
intro n hn
|
| 208 |
+
apply Finset.mem_range.mpr
|
| 209 |
+
exact Nat.lt_succ_of_le (Nat.div_le_div_right (hSN n hn).le)
|
| 210 |
+
have hcard' : (Finset.range (N / Q + 1)).card < S.card := by simpa using hcard
|
| 211 |
+
obtain ⟨x, hx, y, hy, hxy, he⟩ := Finset.exists_ne_map_eq_of_card_lt_of_maps_to hcard' hh
|
| 212 |
+
change x / Q = y / Q at he
|
| 213 |
+
have hp (x y : ℕ) (hx : x ∈ S) (hy : y ∈ S) (hlt : x < y) (he : x / Q = y / Q) :
|
| 214 |
+
∃ q : ℕ, 0 < q ∧ q < Q ∧ ∃ m : ℤ, |α * q - m| ≤ 2 * ε := by
|
| 215 |
+
obtain ⟨a, ha⟩ := hgood x hx
|
| 216 |
+
obtain ⟨b, hb⟩ := hgood y hy
|
| 217 |
+
refine ⟨y - x, Nat.sub_pos_of_lt hlt, ?_, b - a, ?_⟩
|
| 218 |
+
· have hx' := Nat.mod_add_div x Q
|
| 219 |
+
have hy' := Nat.mod_add_div y Q
|
| 220 |
+
have hymod := Nat.mod_lt y hQ
|
| 221 |
+
rw [he] at hx'
|
| 222 |
+
omega
|
| 223 |
+
· have heq : α * (y - x : ℕ) - ((b - a : ℤ) : ℝ) =
|
| 224 |
+
(α * y + γ - b) - (α * x + γ - a) := by
|
| 225 |
+
rw [Nat.cast_sub hlt.le, Int.cast_sub]
|
| 226 |
+
ring
|
| 227 |
+
rw [heq]
|
| 228 |
+
exact (abs_sub _ _).trans (by linarith)
|
| 229 |
+
rcases lt_or_gt_of_ne hxy with hxy | hxy
|
| 230 |
+
· exact hp x y hx hy hxy he
|
| 231 |
+
· exact hp y x hy hx hxy he.symm
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
theorem vinogradov_inverse (S : Finset ℕ) (N K : ℕ)
|
| 236 |
+
(hK : 0 < K) (hN : 32 * K ^ 2 ≤ N) (α γ ε : ℝ)
|
| 237 |
+
(hε : 0 ≤ ε) (hεsmall : ε ≤ 1 / (16 * (K : ℝ)))
|
| 238 |
+
(hSN : ∀ n ∈ S, n < N)
|
| 239 |
+
(hdensity : (N : ℝ) / K ≤ S.card)
|
| 240 |
+
(hgood : ∀ n ∈ S, ∃ z : ℤ, |α * n + γ - z| ≤ ε) :
|
| 241 |
+
∃ q : ℕ, 0 < q ∧ q ≤ 2 * K ∧ ∃ m : ℤ,
|
| 242 |
+
|α * q - m| ≤ 16 * (K : ℝ) ^ 2 * ε / N := by
|
| 243 |
+
have hK₀ : 0 < (K : ℝ) := Nat.cast_pos.mpr hK
|
| 244 |
+
have hK₁ : 1 ≤ (K : ℝ) := by exact_mod_cast hK
|
| 245 |
+
have hN₀ : 0 < (N : ℝ) := by
|
| 246 |
+
have h : 32 * (K : ℝ) ^ 2 ≤ N := by exact_mod_cast hN
|
| 247 |
+
nlinarith
|
| 248 |
+
have hN' : 32 * (K : ℝ) ^ 2 ≤ N := by exact_mod_cast hN
|
| 249 |
+
have hcard : N / (2 * K) + 1 < S.card := by
|
| 250 |
+
have hdiv : ((N / (2 * K) : ℕ) : ℝ) ≤ (N : ℝ) / (2 * K) := by
|
| 251 |
+
simpa only [Nat.cast_mul, Nat.cast_ofNat] using
|
| 252 |
+
(Nat.cast_div_le (m := N) (n := 2 * K) (α := ℝ))
|
| 253 |
+
have he : (N : ℝ) / (2 * K) + 1 < (N : ℝ) / K := by
|
| 254 |
+
apply (lt_div_iff₀ hK₀).mpr
|
| 255 |
+
have heq : ((N : ℝ) / (2 * K) + 1) * K = N / 2 + K := by
|
| 256 |
+
field_simp
|
| 257 |
+
rw [heq]
|
| 258 |
+
nlinarith
|
| 259 |
+
have : ((N / (2 * K) : ℕ) : ℝ) + 1 < S.card := lt_of_lt_of_le (by linarith) hdensity
|
| 260 |
+
exact_mod_cast this
|
| 261 |
+
obtain ⟨q, hq₀, hq₁, m, hm⟩ := exists_small_denominator S N (2 * K) (by omega)
|
| 262 |
+
α γ ε hSN hcard hgood
|
| 263 |
+
refine ⟨q, hq₀, hq₁.le, m, ?_⟩
|
| 264 |
+
let β := α * q - m
|
| 265 |
+
have heps : ε ≤ 1 / 4 := by
|
| 266 |
+
have ht := (le_div_iff₀ (show 0 < 16 * (K : ℝ) by positivity)).mp hεsmall
|
| 267 |
+
nlinarith
|
| 268 |
+
by_cases hβ : β = 0
|
| 269 |
+
· change |β| ≤ _
|
| 270 |
+
rw [hβ, abs_zero]
|
| 271 |
+
positivity
|
| 272 |
+
· have hβpos : 0 < |β| := abs_pos.mpr hβ
|
| 273 |
+
have hq : (q : ℝ) ≤ 2 * K := by exact_mod_cast hq₁.le
|
| 274 |
+
have hq₀' : 0 ≤ (q : ℝ) := Nat.cast_nonneg _
|
| 275 |
+
have hc := card_near_of_approx S N q hq₀ α γ β ε m (by dsimp [β]; ring)
|
| 276 |
+
hβ hm hε heps hSN hgood
|
| 277 |
+
have hepsmul : 16 * (K : ℝ) * ε ≤ 1 := by
|
| 278 |
+
have h := (le_div_iff₀ (show 0 < 16 * (K : ℝ) by positivity)).mp hεsmall
|
| 279 |
+
nlinarith
|
| 280 |
+
have hb₁ : 4 * ε * N ≤ (N : ℝ) / (4 * K) := by
|
| 281 |
+
apply (le_div_iff₀ (show 0 < 4 * (K : ℝ) by positivity)).mpr
|
| 282 |
+
have h := mul_le_mul_of_nonneg_right hepsmul hN₀.le
|
| 283 |
+
nlinarith
|
| 284 |
+
have hb₂ : 3 * (q : ℝ) ≤ (N : ℝ) / (4 * K) := by
|
| 285 |
+
apply (le_div_iff₀ (show 0 < 4 * (K : ℝ) by positivity)).mpr
|
| 286 |
+
have h := mul_le_mul_of_nonneg_right hq hK₀.le
|
| 287 |
+
nlinarith
|
| 288 |
+
have hr : (N : ℝ) / (2 * K) ≤ 4 * q * ε / |β| := by
|
| 289 |
+
have he₁ : (N : ℝ) / K = 2 * ((N : ℝ) / (2 * K)) := by ring
|
| 290 |
+
have he₂ : (N : ℝ) / (4 * K) = ((N : ℝ) / (2 * K)) / 2 := by ring
|
| 291 |
+
rw [he₁] at hdensity
|
| 292 |
+
rw [he₂] at hb₁ hb₂
|
| 293 |
+
linarith
|
| 294 |
+
have hr' := (le_div_iff₀ hβpos).mp hr
|
| 295 |
+
have ht := mul_le_mul_of_nonneg_right hr' (show 0 ≤ 2 * (K : ℝ) by positivity)
|
| 296 |
+
have heq : ((N : ℝ) / (2 * K) * |β|) * (2 * K) = N * |β| := by
|
| 297 |
+
field_simp
|
| 298 |
+
rw [heq] at ht
|
| 299 |
+
have hqε := mul_le_mul_of_nonneg_right hq (show 0 ≤ 8 * (K : ℝ) * ε by positivity)
|
| 300 |
+
change |β| ≤ _
|
| 301 |
+
apply (le_div_iff₀ hN₀).mpr
|
| 302 |
+
nlinarith
|
| 303 |
+
|
| 304 |
+
end
|
| 305 |
+
end NearLattice
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
end
|
| 310 |
+
end
|
| 311 |
+
end
|
| 312 |
+
end
|
| 313 |
+
|
| 314 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PairTail01.lean
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.RationalLattice04
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
end
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
section
|
| 18 |
+
noncomputable section
|
| 19 |
+
namespace MalcevPrefixQuotient
|
| 20 |
+
open RationalLattice
|
| 21 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n r : ℕ}
|
| 22 |
+
variable (c : RealCoordinates G n) (hr : r ≤ n)
|
| 23 |
+
variable (N : Subgroup G) [N.Normal]
|
| 24 |
+
variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin n, i.val < r → c.coord g i = 0)
|
| 25 |
+
|
| 26 |
+
omit [N.Normal] in
|
| 27 |
+
lemma represent_coordinates (x : G ⧸ N) (i : Fin n) :
|
| 28 |
+
c.coord (represent c (coordinates c hr N hN x)) i =
|
| 29 |
+
if h : i.val < r then coordinates c hr N hN x ⟨i.val,h⟩ else 0 := by
|
| 30 |
+
simp [represent,lift]
|
| 31 |
+
|
| 32 |
+
lemma quotient_coordinates_mk (g : G) (i : Fin r) :
|
| 33 |
+
(quotientChart c hr N hN).coord (QuotientGroup.mk g) i = c.coord g (embed hr i) := rfl
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
theorem quotient_lattice (Γ : Subgroup G)
|
| 38 |
+
(hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z) (x : G ⧸ N) :
|
| 39 |
+
x ∈ Γ.map (QuotientGroup.mk' N) ↔
|
| 40 |
+
∀ i, ∃ z : ℤ, (quotientChart c hr N hN).coord x i = z := by
|
| 41 |
+
constructor
|
| 42 |
+
· rintro ⟨g,hg,rfl⟩ i
|
| 43 |
+
exact (hΓ g).mp hg (embed hr i)
|
| 44 |
+
· intro hx
|
| 45 |
+
refine ⟨represent c (coordinates c hr N hN x),?_,rebuild_coordinates c hr N hN x⟩
|
| 46 |
+
apply (hΓ _).mpr
|
| 47 |
+
intro i
|
| 48 |
+
rw [represent_coordinates]
|
| 49 |
+
split_ifs with hi
|
| 50 |
+
· exact hx ⟨i.val,hi⟩
|
| 51 |
+
· exact ⟨0,by simp⟩
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
theorem quotient_adapted (K : Subgroup G) (s : ℕ)
|
| 55 |
+
(hK : ∀ g : G, g ∈ K ↔ ∀ i : Fin n, i.val < s → c.coord g i = 0) (x : G ⧸ N) :
|
| 56 |
+
x ∈ K.map (QuotientGroup.mk' N) ↔
|
| 57 |
+
∀ i : Fin r, i.val < s → (quotientChart c hr N hN).coord x i = 0 := by
|
| 58 |
+
constructor
|
| 59 |
+
· rintro ⟨g,hg,rfl⟩ i hi
|
| 60 |
+
exact (hK g).mp hg (embed hr i) hi
|
| 61 |
+
· intro hx
|
| 62 |
+
refine ⟨represent c (coordinates c hr N hN x),?_,rebuild_coordinates c hr N hN x⟩
|
| 63 |
+
apply (hK _).mpr
|
| 64 |
+
intro i hi
|
| 65 |
+
rw [represent_coordinates]
|
| 66 |
+
split_ifs with hir
|
| 67 |
+
· exact hx ⟨i.val,hir⟩ hi
|
| 68 |
+
· rfl
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
theorem quotient_rational (x : G ⧸ N) : IsRational (quotientChart c hr N hN) x ↔
|
| 73 |
+
∃ g : G, IsRational c g ∧ (QuotientGroup.mk g : G ⧸ N) = x := by
|
| 74 |
+
constructor
|
| 75 |
+
· intro hx
|
| 76 |
+
refine ⟨represent c (coordinates c hr N hN x),?_,rebuild_coordinates c hr N hN x⟩
|
| 77 |
+
intro i
|
| 78 |
+
rw [represent_coordinates]
|
| 79 |
+
split_ifs with hi
|
| 80 |
+
· exact hx ⟨i.val,hi⟩
|
| 81 |
+
· exact ⟨0,by simp⟩
|
| 82 |
+
· rintro ⟨g,hg,rfl⟩ i
|
| 83 |
+
exact hg (embed hr i)
|
| 84 |
+
|
| 85 |
+
end MalcevPrefixQuotient
|
| 86 |
+
end
|
| 87 |
+
end
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
section
|
| 92 |
+
noncomputable section
|
| 93 |
+
namespace PairTail
|
| 94 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 95 |
+
variable (K : Subgroup G) [K.Normal]
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def square : Subgroup (G × G) where
|
| 99 |
+
carrier := {x | x.1⁻¹*x.2 ∈ K}
|
| 100 |
+
one_mem' := by simp
|
| 101 |
+
mul_mem' := by
|
| 102 |
+
intro a b ha hb
|
| 103 |
+
have hh := K.mul_mem ((inferInstance : K.Normal).conj_mem _ ha b.1⁻¹) hb
|
| 104 |
+
simpa [mul_assoc] using hh
|
| 105 |
+
inv_mem' := by
|
| 106 |
+
intro a ha
|
| 107 |
+
have hh := (inferInstance : K.Normal).conj_mem _ (K.inv_mem ha) a.1
|
| 108 |
+
simpa [mul_assoc] using hh
|
| 109 |
+
|
| 110 |
+
def first : square K →* G := (MonoidHom.fst G G).comp (square K).subtype
|
| 111 |
+
|
| 112 |
+
def difference (x : square K) : K := ⟨x.val.1⁻¹*x.val.2,x.property⟩
|
| 113 |
+
|
| 114 |
+
def pair (g : G) (u : K) : square K := ⟨(g,g*u),by change g⁻¹*(g*u) ∈ K; simp⟩
|
| 115 |
+
|
| 116 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 117 |
+
@[simp] lemma first_pair (g : G) (u : K) : first K (pair K g u) = g := rfl
|
| 118 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 119 |
+
@[simp] lemma difference_pair (g : G) (u : K) : difference K (pair K g u) = u := by
|
| 120 |
+
apply Subtype.ext
|
| 121 |
+
simp [difference,pair]
|
| 122 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 123 |
+
@[simp] lemma pair_first_difference (x : square K) : pair K (first K x) (difference K x) = x := by
|
| 124 |
+
apply Subtype.ext
|
| 125 |
+
ext <;> simp [pair,first,difference]
|
| 126 |
+
omit [IsTopologicalGroup G] in
|
| 127 |
+
lemma first_continuous : Continuous (first K) := continuous_fst.comp continuous_subtype_val
|
| 128 |
+
lemma difference_continuous : Continuous (difference K) := by
|
| 129 |
+
apply Continuous.subtype_mk
|
| 130 |
+
exact ((continuous_fst.comp continuous_subtype_val).inv).mul
|
| 131 |
+
(continuous_snd.comp continuous_subtype_val)
|
| 132 |
+
lemma pair_continuous : Continuous (fun x : G × K => pair K x.1 x.2) := by
|
| 133 |
+
apply Continuous.subtype_mk
|
| 134 |
+
exact continuous_fst.prodMk (continuous_fst.mul (continuous_subtype_val.comp continuous_snd))
|
| 135 |
+
|
| 136 |
+
def squareHomeomorph : square K ≃ₜ G × K where
|
| 137 |
+
toFun x := (first K x,difference K x)
|
| 138 |
+
invFun x := pair K x.1 x.2
|
| 139 |
+
left_inv := pair_first_difference K
|
| 140 |
+
right_inv x := by simp
|
| 141 |
+
continuous_toFun := (first_continuous K).prodMk (difference_continuous K)
|
| 142 |
+
continuous_invFun := pair_continuous K
|
| 143 |
+
|
| 144 |
+
variable (N : Subgroup G)
|
| 145 |
+
|
| 146 |
+
def diagonal : Subgroup (square K) where
|
| 147 |
+
carrier := {x | x.val.1 ∈ N ∧ x.val.2 = x.val.1}
|
| 148 |
+
one_mem' := ⟨N.one_mem,rfl⟩
|
| 149 |
+
mul_mem' := by
|
| 150 |
+
rintro a b ⟨ha,hea⟩ ⟨hb,heb⟩
|
| 151 |
+
exact ⟨N.mul_mem ha hb,by change a.val.2*b.val.2 = a.val.1*b.val.1; rw [hea,heb]⟩
|
| 152 |
+
inv_mem' := by
|
| 153 |
+
rintro a ⟨ha,he⟩
|
| 154 |
+
exact ⟨N.inv_mem ha,by change a.val.2⁻¹ = a.val.1⁻¹; rw [he]⟩
|
| 155 |
+
|
| 156 |
+
variable (hcent : N ≤ Subgroup.center G)
|
| 157 |
+
include hcent in
|
| 158 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 159 |
+
lemma diagonal_normal : (diagonal K N).Normal where
|
| 160 |
+
conj_mem x hx y := by
|
| 161 |
+
rcases hx with ⟨hx,he⟩
|
| 162 |
+
have hc := Subgroup.mem_center_iff.mp (hcent hx)
|
| 163 |
+
have h1 : y.val.1*x.val.1*y.val.1⁻¹ = x.val.1 := by
|
| 164 |
+
rw [hc y.val.1]; simp [mul_assoc]
|
| 165 |
+
have h2 : y.val.2*x.val.2*y.val.2⁻¹ = x.val.1 := by
|
| 166 |
+
rw [he,hc y.val.2]; simp [mul_assoc]
|
| 167 |
+
exact ⟨by change y.val.1*x.val.1*y.val.1⁻¹ ∈ N; rw [h1]; exact hx,
|
| 168 |
+
by change y.val.2*x.val.2*y.val.2⁻¹ = y.val.1*x.val.1*y.val.1⁻¹; rw [h1,h2]⟩
|
| 169 |
+
|
| 170 |
+
include hcent in
|
| 171 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 172 |
+
lemma eq_coset_iff (x y : square K) :
|
| 173 |
+
(QuotientGroup.mk x : square K ⧸ diagonal K N) = QuotientGroup.mk y ↔
|
| 174 |
+
(QuotientGroup.mk (first K x) : G ⧸ N) = QuotientGroup.mk (first K y) ∧
|
| 175 |
+
difference K x = difference K y := by
|
| 176 |
+
rw [QuotientGroup.eq,QuotientGroup.eq]
|
| 177 |
+
change (x.val.1⁻¹*y.val.1 ∈ N ∧ x.val.2⁻¹*y.val.2 = x.val.1⁻¹*y.val.1) ↔ _
|
| 178 |
+
change _ ↔ x.val.1⁻¹*y.val.1 ∈ N ∧ difference K x = difference K y
|
| 179 |
+
constructor
|
| 180 |
+
· rintro ⟨hn,he⟩
|
| 181 |
+
refine ⟨hn,Subtype.ext ?_⟩
|
| 182 |
+
change x.val.1⁻¹*x.val.2 = y.val.1⁻¹*y.val.2
|
| 183 |
+
have hc := Subgroup.mem_center_iff.mp (hcent hn)
|
| 184 |
+
have hy : y.val.2 = x.val.2*(x.val.1⁻¹*y.val.1) := by rw [← he]; simp
|
| 185 |
+
rw [hy]
|
| 186 |
+
symm
|
| 187 |
+
calc
|
| 188 |
+
y.val.1⁻¹*(x.val.2*(x.val.1⁻¹*y.val.1)) =
|
| 189 |
+
(y.val.1⁻¹*x.val.2)*(x.val.1⁻¹*y.val.1) := by group
|
| 190 |
+
_ = (x.val.1⁻¹*y.val.1)*(y.val.1⁻¹*x.val.2) := hc _
|
| 191 |
+
_ = _ := by group
|
| 192 |
+
· rintro ⟨hn,hd⟩
|
| 193 |
+
refine ⟨hn,?_⟩
|
| 194 |
+
have hd' := congrArg Subtype.val hd
|
| 195 |
+
change x.val.1⁻¹*x.val.2 = y.val.1⁻¹*y.val.2 at hd'
|
| 196 |
+
have hy : y.val.2 = y.val.1*(x.val.1⁻¹*x.val.2) := by rw [hd']; simp
|
| 197 |
+
have hc := Subgroup.mem_center_iff.mp (hcent hn)
|
| 198 |
+
rw [hy]
|
| 199 |
+
calc
|
| 200 |
+
x.val.2⁻¹*(y.val.1*(x.val.1⁻¹*x.val.2)) =
|
| 201 |
+
x.val.2⁻¹*x.val.1*(x.val.1⁻¹*y.val.1)*(x.val.1⁻¹*x.val.2) := by group
|
| 202 |
+
_ = (x.val.1⁻¹*y.val.1)*(x.val.2⁻¹*x.val.1)*(x.val.1⁻¹*x.val.2) := by
|
| 203 |
+
rw [hc (x.val.2⁻¹*x.val.1)]
|
| 204 |
+
_ = x.val.1⁻¹*y.val.1 := by group
|
| 205 |
+
|
| 206 |
+
def quotientCoordinates (x : square K ⧸ diagonal K N) : (G ⧸ N) × K :=
|
| 207 |
+
Quotient.lift (fun x : square K => (QuotientGroup.mk (first K x),difference K x))
|
| 208 |
+
(by
|
| 209 |
+
intro x y he
|
| 210 |
+
have h := (eq_coset_iff K N hcent x y).mp (Quotient.sound he)
|
| 211 |
+
exact Prod.ext h.1 h.2) x
|
| 212 |
+
|
| 213 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 214 |
+
@[simp] lemma quotientCoordinates_mk (x : square K) :
|
| 215 |
+
quotientCoordinates K N hcent (QuotientGroup.mk x) =
|
| 216 |
+
(QuotientGroup.mk (first K x),difference K x) := rfl
|
| 217 |
+
lemma quotientCoordinates_continuous : Continuous (quotientCoordinates K N hcent) := by
|
| 218 |
+
rw [(QuotientGroup.isQuotientMap_mk (diagonal K N)).continuous_iff]
|
| 219 |
+
exact (QuotientGroup.continuous_mk.comp (first_continuous K)).prodMk (difference_continuous K)
|
| 220 |
+
|
| 221 |
+
variable (s : G ⧸ N → G) (hs : ∀ x, (QuotientGroup.mk (s x) : G ⧸ N) = x)
|
| 222 |
+
variable (hsc : Continuous s)
|
| 223 |
+
def quotientRebuild (x : (G ⧸ N) × K) : square K ⧸ diagonal K N :=
|
| 224 |
+
QuotientGroup.mk (pair K (s x.1) x.2)
|
| 225 |
+
include hs in
|
| 226 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 227 |
+
lemma quotientCoordinates_rebuild (x : (G ⧸ N) × K) :
|
| 228 |
+
quotientCoordinates K N hcent (quotientRebuild K N s x) = x := by
|
| 229 |
+
simp [quotientRebuild,hs]
|
| 230 |
+
include hs in
|
| 231 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 232 |
+
lemma quotientRebuild_coordinates (x : square K ⧸ diagonal K N) :
|
| 233 |
+
quotientRebuild K N s (quotientCoordinates K N hcent x) = x := by
|
| 234 |
+
induction x using Quotient.inductionOn with | h x =>
|
| 235 |
+
apply (eq_coset_iff K N hcent _ _).mpr
|
| 236 |
+
simp [quotientCoordinates_mk,hs]
|
| 237 |
+
include hsc in
|
| 238 |
+
lemma quotientRebuild_continuous : Continuous (quotientRebuild K N s) := by
|
| 239 |
+
exact QuotientGroup.continuous_mk.comp ((pair_continuous K).comp
|
| 240 |
+
((hsc.comp continuous_fst).prodMk continuous_snd))
|
| 241 |
+
|
| 242 |
+
def quotientHomeomorph : (square K ⧸ diagonal K N) ≃ₜ (G ⧸ N) × K where
|
| 243 |
+
toFun := quotientCoordinates K N hcent
|
| 244 |
+
invFun := quotientRebuild K N s
|
| 245 |
+
left_inv := quotientRebuild_coordinates K N hcent s hs
|
| 246 |
+
right_inv := quotientCoordinates_rebuild K N hcent s hs
|
| 247 |
+
continuous_toFun := quotientCoordinates_continuous K N hcent
|
| 248 |
+
continuous_invFun := quotientRebuild_continuous K N s hsc
|
| 249 |
+
|
| 250 |
+
end PairTail
|
| 251 |
+
end
|
| 252 |
+
end
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
section
|
| 257 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 258 |
+
noncomputable section
|
| 259 |
+
namespace RationalPolynomialMap
|
| 260 |
+
variable {σ τ : Type*}
|
| 261 |
+
|
| 262 |
+
def IsPolynomial (f : (σ → ℝ) → ℝ) : Prop :=
|
| 263 |
+
∃ P : MvPolynomial σ ℚ, ∀ x, f x = MvPolynomial.eval₂ (algebraMap ℚ ℝ) x P
|
| 264 |
+
|
| 265 |
+
lemma const (q : ℚ) : IsPolynomial (fun _ : σ → ℝ => (q:ℝ)) := ⟨MvPolynomial.C q,by simp⟩
|
| 266 |
+
lemma zero : IsPolynomial (fun _ : σ → ℝ => (0:ℝ)) := by simpa using const (σ:=σ) 0
|
| 267 |
+
lemma one : IsPolynomial (fun _ : σ → ℝ => (1:ℝ)) := by simpa using const (σ:=σ) 1
|
| 268 |
+
lemma coordinate (i : σ) : IsPolynomial (fun x : σ → ℝ => x i) := ⟨MvPolynomial.X i,by simp⟩
|
| 269 |
+
lemma add {f g : (σ → ℝ) → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) :
|
| 270 |
+
IsPolynomial (fun x => f x+g x) := by
|
| 271 |
+
obtain ⟨p,hp⟩ := hf
|
| 272 |
+
obtain ⟨q,hq⟩ := hg
|
| 273 |
+
exact ⟨p+q,by simp [hp,hq]⟩
|
| 274 |
+
lemma mul {f g : (σ → ℝ) → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) :
|
| 275 |
+
IsPolynomial (fun x => f x*g x) := by
|
| 276 |
+
obtain ⟨p,hp⟩ := hf
|
| 277 |
+
obtain ⟨q,hq⟩ := hg
|
| 278 |
+
exact ⟨p*q,by simp [hp,hq]⟩
|
| 279 |
+
lemma neg {f : (σ → ℝ) → ℝ} (hf : IsPolynomial f) : IsPolynomial (fun x => -f x) := by
|
| 280 |
+
obtain ⟨p,hp⟩ := hf
|
| 281 |
+
exact ⟨-p,by simp [hp]⟩
|
| 282 |
+
lemma sub {f g : (σ → ℝ) → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) :
|
| 283 |
+
IsPolynomial (fun x => f x-g x) := by simpa [sub_eq_add_neg] using add hf (neg hg)
|
| 284 |
+
|
| 285 |
+
lemma eval {f : τ → (σ → ℝ) → ℝ} (hf : ∀ i, IsPolynomial (f i))
|
| 286 |
+
(P : MvPolynomial τ ℚ) : IsPolynomial (fun x =>
|
| 287 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun i => f i x) P) := by
|
| 288 |
+
induction P using MvPolynomial.induction_on with
|
| 289 |
+
| C q => simpa using const (σ:=σ) q
|
| 290 |
+
| add p q hp hq => simpa using add hp hq
|
| 291 |
+
| mul_X p i hp => simpa using mul hp (hf i)
|
| 292 |
+
|
| 293 |
+
lemma comp {f : (τ → ℝ) → ℝ} (hf : IsPolynomial f) {g : (σ → ℝ) → (τ → ℝ)}
|
| 294 |
+
(hg : ∀ i, IsPolynomial (fun x => g x i)) : IsPolynomial (fun x => f (g x)) := by
|
| 295 |
+
obtain ⟨p,hp⟩ := hf
|
| 296 |
+
simpa only [hp] using eval hg p
|
| 297 |
+
|
| 298 |
+
lemma polynomial_eval (P : ℚ[X]) {f : (σ → ℝ) → ℝ} (hf : IsPolynomial f) :
|
| 299 |
+
IsPolynomial (fun x => P.eval₂ (algebraMap ℚ ℝ) (f x)) := by
|
| 300 |
+
induction P using Polynomial.induction_on' with
|
| 301 |
+
| add p q hp hq => simpa using add hp hq
|
| 302 |
+
| monomial i a =>
|
| 303 |
+
have hi : IsPolynomial (fun x => (f x)^i) := by
|
| 304 |
+
induction i with
|
| 305 |
+
| zero => simpa using one (σ:=σ)
|
| 306 |
+
| succ i ih => simpa only [pow_succ] using mul ih hf
|
| 307 |
+
simpa using mul (const a) hi
|
| 308 |
+
end RationalPolynomialMap
|
| 309 |
+
|
| 310 |
+
end
|
| 311 |
+
end
|
| 312 |
+
end
|
| 313 |
+
end
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.RationalLattice07
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
end
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
section
|
| 18 |
+
noncomputable section
|
| 19 |
+
namespace PairTail
|
| 20 |
+
open RationalLattice RationalPolynomialMap
|
| 21 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 22 |
+
variable {t d r : ℕ} (c : RealCoordinates G (t+d))
|
| 23 |
+
|
| 24 |
+
def lowerArgs (i : Fin (r+d)) (X Y : Fin (r+d) → ℝ) : (Fin i.val ⊕ Fin i.val) → ℝ :=
|
| 25 |
+
Sum.elim (fun j => X ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 26 |
+
(fun j => Y ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 27 |
+
|
| 28 |
+
def baseInput (j : Fin d) (v : (Fin (r+j.val) ⊕ Fin (r+j.val)) → ℝ) : G :=
|
| 29 |
+
c.coord.symm (fun a => if h : a.val < r then v (.inr ⟨a.val,by omega⟩) else 0)
|
| 30 |
+
|
| 31 |
+
def tailInput (j : Fin d) (v : Fin (r+j.val) → ℝ) : Fin (t+j.val) → ℝ :=
|
| 32 |
+
fun a => if h : t ≤ a.val then v ⟨r+(a.val-t),by have := a.isLt; omega⟩ else 0
|
| 33 |
+
|
| 34 |
+
omit [IsTopologicalGroup G] in
|
| 35 |
+
lemma baseInput_polynomial (j : Fin d) :
|
| 36 |
+
IsPolynomialMap c (baseInput c (r:=r) j) := by
|
| 37 |
+
intro a
|
| 38 |
+
simp only [baseInput,Homeomorph.apply_symm_apply]
|
| 39 |
+
split_ifs
|
| 40 |
+
· exact coordinate _
|
| 41 |
+
· exact zero
|
| 42 |
+
|
| 43 |
+
omit [IsTopologicalGroup G] in
|
| 44 |
+
lemma tailCorrection_exists (j : Fin d) :
|
| 45 |
+
∃ P : MvPolynomial (Fin (r+j.val) ⊕ Fin (r+j.val)) ℚ,
|
| 46 |
+
∀ v : (Fin (r+j.val) ⊕ Fin (r+j.val)) → ℝ,
|
| 47 |
+
c.coord ((baseInput c j v)⁻¹ *
|
| 48 |
+
truncate c (RationalTailCoordinates.embed t j) (tailInput j (fun a => v (.inl a))) *
|
| 49 |
+
baseInput c j v *
|
| 50 |
+
truncate c (RationalTailCoordinates.embed t j) (tailInput j (fun a => v (.inr a))))
|
| 51 |
+
(RationalTailCoordinates.embed t j) = MvPolynomial.eval₂ (algebraMap ℚ ℝ) v P := by
|
| 52 |
+
have hu : IsPolynomialMap c (fun v : (Fin (r+j.val) ⊕ Fin (r+j.val)) → ℝ =>
|
| 53 |
+
truncate c (RationalTailCoordinates.embed t j) (tailInput j (fun a => v (.inl a)))) := by
|
| 54 |
+
apply polynomialMap_truncate
|
| 55 |
+
intro a
|
| 56 |
+
unfold tailInput
|
| 57 |
+
split_ifs
|
| 58 |
+
· exact coordinate _
|
| 59 |
+
· exact zero
|
| 60 |
+
have hv : IsPolynomialMap c (fun v : (Fin (r+j.val) ⊕ Fin (r+j.val)) → ℝ =>
|
| 61 |
+
truncate c (RationalTailCoordinates.embed t j) (tailInput j (fun a => v (.inr a)))) := by
|
| 62 |
+
apply polynomialMap_truncate
|
| 63 |
+
intro a
|
| 64 |
+
unfold tailInput
|
| 65 |
+
split_ifs
|
| 66 |
+
· exact coordinate _
|
| 67 |
+
· exact zero
|
| 68 |
+
exact polynomialMap_mul c (polynomialMap_mul c
|
| 69 |
+
(polynomialMap_mul c (polynomialMap_inv c (baseInput_polynomial c j)) hu)
|
| 70 |
+
(baseInput_polynomial c j)) hv (RationalTailCoordinates.embed t j)
|
| 71 |
+
|
| 72 |
+
def tailCorrection (j : Fin d) : MvPolynomial (Fin (r+j.val) ⊕ Fin (r+j.val)) ℚ :=
|
| 73 |
+
(tailCorrection_exists c j).choose
|
| 74 |
+
|
| 75 |
+
omit [IsTopologicalGroup G] in
|
| 76 |
+
lemma baseInput_args (j : Fin d) (X Y : Fin (r+d) → ℝ) :
|
| 77 |
+
baseInput c j (lowerArgs (j.natAdd r) X Y) =
|
| 78 |
+
MalcevPrefixQuotient.represent c (fun a : Fin r => Y (a.castAdd d)) := by
|
| 79 |
+
apply c.coord.injective
|
| 80 |
+
funext a
|
| 81 |
+
simp only [baseInput,MalcevPrefixQuotient.represent,Homeomorph.apply_symm_apply,
|
| 82 |
+
MalcevPrefixQuotient.lift]
|
| 83 |
+
split_ifs <;> rfl
|
| 84 |
+
|
| 85 |
+
variable (K : Subgroup G) [K.Normal]
|
| 86 |
+
variable (hK : ∀ g : G, g ∈ K ↔ ∀ i : Fin (t+d), i.val < t → c.coord g i = 0)
|
| 87 |
+
|
| 88 |
+
omit [IsTopologicalGroup G] [K.Normal] in
|
| 89 |
+
lemma tailInput_args (j : Fin d) (X : Fin (r+d) → ℝ) (a : Fin (t+j.val)) :
|
| 90 |
+
tailInput j (fun u : Fin (r+j.val) => X ⟨u.val,by have := u.isLt; have := j.isLt; omega⟩) a =
|
| 91 |
+
c.coord (RationalTailCoordinates.rebuild c K hK (fun u : Fin d => X (u.natAdd r))).val
|
| 92 |
+
⟨a.val,by have := a.isLt; have := j.isLt; omega⟩ := by
|
| 93 |
+
simp only [tailInput,RationalTailCoordinates.rebuild,Homeomorph.apply_symm_apply,
|
| 94 |
+
RationalTailCoordinates.lift]
|
| 95 |
+
split_ifs <;> rfl
|
| 96 |
+
|
| 97 |
+
omit [IsTopologicalGroup G] [K.Normal] in
|
| 98 |
+
lemma tailCorrection_args (j : Fin d) (X Y : Fin (r+d) → ℝ) :
|
| 99 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ) (lowerArgs (j.natAdd r) X Y) (tailCorrection c j) =
|
| 100 |
+
c.coord (
|
| 101 |
+
(MalcevPrefixQuotient.represent c (fun a : Fin r => Y (a.castAdd d)))⁻¹ *
|
| 102 |
+
truncate c (RationalTailCoordinates.embed t j) (fun a =>
|
| 103 |
+
c.coord (RationalTailCoordinates.rebuild c K hK (fun u : Fin d => X (u.natAdd r))).val
|
| 104 |
+
⟨a.val,lt_trans a.isLt (RationalTailCoordinates.embed t j).isLt⟩) *
|
| 105 |
+
MalcevPrefixQuotient.represent c (fun a : Fin r => Y (a.castAdd d)) *
|
| 106 |
+
truncate c (RationalTailCoordinates.embed t j) (fun a =>
|
| 107 |
+
c.coord (RationalTailCoordinates.rebuild c K hK (fun u : Fin d => Y (u.natAdd r))).val
|
| 108 |
+
⟨a.val,lt_trans a.isLt (RationalTailCoordinates.embed t j).isLt⟩))
|
| 109 |
+
(RationalTailCoordinates.embed t j) := by
|
| 110 |
+
unfold tailCorrection
|
| 111 |
+
rw [← (tailCorrection_exists c j).choose_spec,baseInput_args]
|
| 112 |
+
have hx : tailInput j (fun a => lowerArgs (j.natAdd r) X Y (.inl a)) =
|
| 113 |
+
(fun a : Fin (t+j.val) => c.coord
|
| 114 |
+
(RationalTailCoordinates.rebuild c K hK (fun u : Fin d => X (u.natAdd r))).val
|
| 115 |
+
⟨a.val,by have := a.isLt; have := j.isLt; omega⟩) := by
|
| 116 |
+
funext a
|
| 117 |
+
exact tailInput_args c K hK j X a
|
| 118 |
+
have hy : tailInput j (fun a => lowerArgs (j.natAdd r) X Y (.inr a)) =
|
| 119 |
+
(fun a : Fin (t+j.val) => c.coord
|
| 120 |
+
(RationalTailCoordinates.rebuild c K hK (fun u : Fin d => Y (u.natAdd r))).val
|
| 121 |
+
⟨a.val,by have := a.isLt; have := j.isLt; omega⟩) := by
|
| 122 |
+
funext a
|
| 123 |
+
exact tailInput_args c K hK j Y a
|
| 124 |
+
rw [hx,hy]
|
| 125 |
+
rfl
|
| 126 |
+
|
| 127 |
+
variable (hr : r ≤ t+d) (N : Subgroup G) [N.Normal]
|
| 128 |
+
variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin (t+d), i.val < r → c.coord g i = 0)
|
| 129 |
+
variable (hcent : N ≤ Subgroup.center G)
|
| 130 |
+
variable [(diagonal K N).Normal]
|
| 131 |
+
|
| 132 |
+
def correction (i : Fin (r+d)) : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ :=
|
| 133 |
+
Fin.addCases (motive := fun i : Fin (r+d) => MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ)
|
| 134 |
+
(fun j : Fin r => c.correction (MalcevPrefixQuotient.embed hr j))
|
| 135 |
+
(fun j : Fin d => tailCorrection c j) i
|
| 136 |
+
|
| 137 |
+
omit [IsTopologicalGroup G] in
|
| 138 |
+
@[simp] lemma correction_base (j : Fin r) : correction c hr (j.castAdd d) =
|
| 139 |
+
c.correction (MalcevPrefixQuotient.embed hr j) := by
|
| 140 |
+
exact Fin.addCases_left (motive := fun i : Fin (r+d) =>
|
| 141 |
+
MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ) j
|
| 142 |
+
omit [IsTopologicalGroup G] in
|
| 143 |
+
@[simp] lemma correction_tail (j : Fin d) : correction c hr (j.natAdd r) = tailCorrection c j := by
|
| 144 |
+
exact Fin.addCases_right (motive := fun i : Fin (r+d) =>
|
| 145 |
+
MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ) j
|
| 146 |
+
|
| 147 |
+
omit [N.Normal] in
|
| 148 |
+
lemma coordinate_mul (x y : square K ⧸ diagonal K N) (i : Fin (r+d)) :
|
| 149 |
+
chartHomeomorph c K hK hr N hN hcent (x*y) i =
|
| 150 |
+
chartHomeomorph c K hK hr N hN hcent x i + chartHomeomorph c K hK hr N hN hcent y i +
|
| 151 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 152 |
+
(lowerArgs i (chartHomeomorph c K hK hr N hN hcent x)
|
| 153 |
+
(chartHomeomorph c K hK hr N hN hcent y)) (correction c hr i) := by
|
| 154 |
+
obtain ⟨X,rfl⟩ := (chartHomeomorph c K hK hr N hN hcent).symm.surjective x
|
| 155 |
+
obtain ⟨Y,rfl⟩ := (chartHomeomorph c K hK hr N hN hcent).symm.surjective y
|
| 156 |
+
simp only [Homeomorph.apply_symm_apply]
|
| 157 |
+
rw [chart_rebuild_base,chart_rebuild_base,← QuotientGroup.mk_mul]
|
| 158 |
+
refine Fin.addCases (fun j => ?_) (fun j => ?_) i
|
| 159 |
+
· rw [chart_base,correction_base]
|
| 160 |
+
change c.coord (_ * _) _ = _
|
| 161 |
+
rw [c.mul_coord]
|
| 162 |
+
simp only [pair,MalcevPrefixQuotient.represent,Homeomorph.apply_symm_apply]
|
| 163 |
+
congr 1
|
| 164 |
+
· simp [MalcevPrefixQuotient.lift,MalcevPrefixQuotient.embed]
|
| 165 |
+
· congr 1
|
| 166 |
+
funext a
|
| 167 |
+
cases a with
|
| 168 |
+
| inl a =>
|
| 169 |
+
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⟩
|
| 170 |
+
rw [dite_eq_left (lt_trans a.isLt j.isLt)]
|
| 171 |
+
| inr a =>
|
| 172 |
+
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⟩
|
| 173 |
+
rw [dite_eq_left (lt_trans a.isLt j.isLt)]
|
| 174 |
+
· rw [chart_tail,correction_tail,tailCorrection_args c K hK]
|
| 175 |
+
let a := MalcevPrefixQuotient.represent c (fun i : Fin r => X (i.castAdd d))
|
| 176 |
+
let b := MalcevPrefixQuotient.represent c (fun i : Fin r => Y (i.castAdd d))
|
| 177 |
+
let u := (RationalTailCoordinates.rebuild c K hK (fun i : Fin d => X (i.natAdd r))).val
|
| 178 |
+
let v := (RationalTailCoordinates.rebuild c K hK (fun i : Fin d => Y (i.natAdd r))).val
|
| 179 |
+
change c.coord ((a*b)⁻¹*((a*u)*(b*v))) _ = _
|
| 180 |
+
rw [show (a*b)⁻¹*((a*u)*(b*v)) = b⁻¹*u*b*v from by group]
|
| 181 |
+
rw [conj_mul_truncated]
|
| 182 |
+
congr 2
|
| 183 |
+
· simp [u,RationalTailCoordinates.rebuild]
|
| 184 |
+
· simp [v,RationalTailCoordinates.rebuild]
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def reducedCoordinates : RealCoordinates (square K ⧸ diagonal K N) (r+d) where
|
| 188 |
+
coord := chartHomeomorph c K hK hr N hN hcent
|
| 189 |
+
one_coord i := congrFun (chart_one c K hK hr N hN hcent) i
|
| 190 |
+
correction := correction c hr
|
| 191 |
+
mul_coord := coordinate_mul c K hK hr N hN hcent
|
| 192 |
+
|
| 193 |
+
end PairTail
|
| 194 |
+
end
|
| 195 |
+
end
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
section
|
| 200 |
+
open scoped BigOperators
|
| 201 |
+
noncomputable section
|
| 202 |
+
namespace RationalLattice
|
| 203 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 204 |
+
variable (c : RealCoordinates G n)
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
def reduceCoordinates (g : G) : ℕ → G
|
| 209 |
+
| 0 => g
|
| 210 |
+
| k+1 => if h : k < n then
|
| 211 |
+
reduceCoordinates g k * basisFlow c ⟨k,h⟩ (-(⌊c.coord (reduceCoordinates g k) ⟨k,h⟩⌋:ℝ))
|
| 212 |
+
else reduceCoordinates g k
|
| 213 |
+
|
| 214 |
+
lemma reduceCoordinates_bounds (g : G) (k : ℕ) :
|
| 215 |
+
∀ i : Fin n, i.val < k → c.coord (reduceCoordinates c g k) i ∈ Set.Ico (0:ℝ) 1 := by
|
| 216 |
+
induction k with
|
| 217 |
+
| zero => intro i hi; omega
|
| 218 |
+
| succ k ih =>
|
| 219 |
+
intro i hi
|
| 220 |
+
by_cases hk : k < n
|
| 221 |
+
· rw [reduceCoordinates,dite_eq_left hk]
|
| 222 |
+
rw [coord_mul_of_right_zero c _ _ i (by
|
| 223 |
+
intro j hj
|
| 224 |
+
rw [basisFlow_coord c _ j (show j.val ≤ k from by change j.val < i.val at hj; omega)]
|
| 225 |
+
simp [show j ≠ (⟨k,hk⟩:Fin n) from fun h => by
|
| 226 |
+
have := congrArg Fin.val h; change j.val < i.val at hj; dsimp at this; omega])]
|
| 227 |
+
by_cases hik : i.val < k
|
| 228 |
+
· rw [basisFlow_coord c _ i (show i.val ≤ k from by omega)]
|
| 229 |
+
simp only [ite_eq_right (show i ≠ (⟨k,hk⟩:Fin n) from fun h => by
|
| 230 |
+
have := congrArg Fin.val h; dsimp at this; omega),add_zero]
|
| 231 |
+
exact ih i hik
|
| 232 |
+
· have he : i = (⟨k,hk⟩:Fin n) := Fin.ext (show i.val = k from by omega)
|
| 233 |
+
subst i
|
| 234 |
+
rw [basisFlow_coord c _ _ le_rfl,ite_eq_left rfl]
|
| 235 |
+
constructor
|
| 236 |
+
· have h := Int.floor_le (c.coord (reduceCoordinates c g k) ⟨k,hk⟩); linarith
|
| 237 |
+
· have h := Int.lt_floor_add_one (c.coord (reduceCoordinates c g k) ⟨k,hk⟩); linarith
|
| 238 |
+
· rw [reduceCoordinates,dite_eq_right hk]
|
| 239 |
+
exact ih i (by omega)
|
| 240 |
+
|
| 241 |
+
variable (Γ : Subgroup G)
|
| 242 |
+
variable (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z)
|
| 243 |
+
include hΓ in
|
| 244 |
+
lemma reduceCoordinates_coset (g : G) (k : ℕ) : (reduceCoordinates c g k)⁻¹*g ∈ Γ := by
|
| 245 |
+
induction k with
|
| 246 |
+
| zero => simp [reduceCoordinates]
|
| 247 |
+
| succ k ih =>
|
| 248 |
+
simp only [reduceCoordinates]
|
| 249 |
+
split_ifs with hk
|
| 250 |
+
· rw [mul_inv_rev,mul_assoc]
|
| 251 |
+
apply Γ.mul_mem _ ih
|
| 252 |
+
apply Γ.inv_mem
|
| 253 |
+
rw [← Int.cast_neg]
|
| 254 |
+
exact basisFlow_int_mem c Γ hΓ _ _
|
| 255 |
+
· exact ih
|
| 256 |
+
|
| 257 |
+
include hΓ in
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
theorem compact_reps_of_integerCoordinates :
|
| 261 |
+
∃ C : Set G, IsCompact C ∧ ∀ g : G, ∃ a ∈ C, a⁻¹*g ∈ Γ := by
|
| 262 |
+
let B : Set (Fin n → ℝ) := Set.pi Set.univ (fun _ => Set.Icc (0:ℝ) 1)
|
| 263 |
+
have hB : IsCompact B := isCompact_univ_pi (fun _ => isCompact_Icc)
|
| 264 |
+
refine ⟨c.coord.symm '' B,hB.image c.coord.symm.continuous,fun g => ?_⟩
|
| 265 |
+
refine ⟨reduceCoordinates c g n,?_,reduceCoordinates_coset c Γ hΓ g n⟩
|
| 266 |
+
refine ⟨c.coord (reduceCoordinates c g n),?_,c.coord.symm_apply_apply _⟩
|
| 267 |
+
intro i _
|
| 268 |
+
exact ⟨(reduceCoordinates_bounds c g n i i.isLt).1,
|
| 269 |
+
(reduceCoordinates_bounds c g n i i.isLt).2.le⟩
|
| 270 |
+
|
| 271 |
+
end RationalLattice
|
| 272 |
+
|
| 273 |
+
end
|
| 274 |
+
end
|
| 275 |
+
end
|
| 276 |
+
end
|
| 277 |
+
end
|
| 278 |
+
|
| 279 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PairTail03.lean
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.CoordinateSubspace01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
end
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
section
|
| 18 |
+
noncomputable section
|
| 19 |
+
namespace PairTail
|
| 20 |
+
open RationalLattice
|
| 21 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 22 |
+
variable {t d r : ℕ} (c : RealCoordinates G (t+d))
|
| 23 |
+
variable (K : Subgroup G) [K.Normal]
|
| 24 |
+
variable (hK : ∀ g : G, g ∈ K ↔ ∀ i : Fin (t+d), i.val < t → c.coord g i = 0)
|
| 25 |
+
variable (hr : r ≤ t+d) (N : Subgroup G) [N.Normal]
|
| 26 |
+
variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin (t+d), i.val < r → c.coord g i = 0)
|
| 27 |
+
variable (hcent : N ≤ Subgroup.center G) [(diagonal K N).Normal]
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def pairLevel (A B : Subgroup G) [B.Normal] : Subgroup (square K) :=
|
| 31 |
+
(A.comap (first K)) ⊓ (square B).comap (square K).subtype
|
| 32 |
+
|
| 33 |
+
def reducedLevel (A B : Subgroup G) [B.Normal] : Subgroup (square K ⧸ diagonal K N) :=
|
| 34 |
+
(pairLevel K A B).map (QuotientGroup.mk' (diagonal K N))
|
| 35 |
+
|
| 36 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 37 |
+
lemma mem_pairLevel (A B : Subgroup G) [B.Normal] (x : square K) :
|
| 38 |
+
x ∈ pairLevel K A B ↔ x.val.1 ∈ A ∧ x.val.1⁻¹*x.val.2 ∈ B := Iff.rfl
|
| 39 |
+
|
| 40 |
+
variable {a b : ℕ} (ha : a ≤ r)
|
| 41 |
+
variable (A B : Subgroup G) [B.Normal]
|
| 42 |
+
variable (hA : ∀ g : G, g ∈ A ↔ ∀ i : Fin (t+d), i.val < a → c.coord g i = 0)
|
| 43 |
+
variable (hB : ∀ g : G, g ∈ B ↔ ∀ i : Fin (t+d), i.val < b → c.coord g i = 0)
|
| 44 |
+
|
| 45 |
+
include ha hA hB in
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
omit [N.Normal] in
|
| 49 |
+
theorem reducedLevel_coordinates (x : square K ⧸ diagonal K N) :
|
| 50 |
+
x ∈ reducedLevel K N A B ↔
|
| 51 |
+
(∀ i : Fin r, i.val < a →
|
| 52 |
+
(reducedCoordinates c K hK hr N hN hcent).coord x (i.castAdd d) = 0) ∧
|
| 53 |
+
(∀ j : Fin d, t+j.val < b →
|
| 54 |
+
(reducedCoordinates c K hK hr N hN hcent).coord x (j.natAdd r) = 0) := by
|
| 55 |
+
constructor
|
| 56 |
+
· rintro ⟨y,hy,rfl⟩
|
| 57 |
+
change y.val.1 ∈ A ∧ y.val.1⁻¹*y.val.2 ∈ B at hy
|
| 58 |
+
constructor
|
| 59 |
+
· intro i hi
|
| 60 |
+
change chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk y) _ = 0
|
| 61 |
+
rw [chart_base]
|
| 62 |
+
exact (hA y.val.1).mp hy.1 _ hi
|
| 63 |
+
· intro j hj
|
| 64 |
+
change chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk y) _ = 0
|
| 65 |
+
rw [chart_tail]
|
| 66 |
+
exact (hB _).mp hy.2 _ hj
|
| 67 |
+
· induction x using Quotient.inductionOn with | h x =>
|
| 68 |
+
intro hx
|
| 69 |
+
refine ⟨x,?_,rfl⟩
|
| 70 |
+
change x.val.1 ∈ A ∧ x.val.1⁻¹*x.val.2 ∈ B
|
| 71 |
+
constructor
|
| 72 |
+
· apply (hA _).mpr
|
| 73 |
+
intro i hi
|
| 74 |
+
have hir : i.val < r := lt_of_lt_of_le hi ha
|
| 75 |
+
have he := hx.1 ⟨i.val,hir⟩ hi
|
| 76 |
+
change chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk x) _ = 0 at he
|
| 77 |
+
rw [chart_base] at he
|
| 78 |
+
exact he
|
| 79 |
+
· apply (hB _).mpr
|
| 80 |
+
intro i hi
|
| 81 |
+
by_cases hit : i.val < t
|
| 82 |
+
· exact (hK _).mp x.property i hit
|
| 83 |
+
· have hid : i.val-t < d := by have := i.isLt; omega
|
| 84 |
+
have he := hx.2 ⟨i.val-t,hid⟩ (by dsimp; omega)
|
| 85 |
+
change chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk x) _ = 0 at he
|
| 86 |
+
rw [chart_tail] at he
|
| 87 |
+
have hiEq : RationalTailCoordinates.embed t (⟨i.val-t,hid⟩ : Fin d) = i :=
|
| 88 |
+
Fin.ext (by dsimp [RationalTailCoordinates.embed]; omega)
|
| 89 |
+
simpa only [hiEq] using he
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
def levelIndices (r d t a b : ℕ) : Finset (Fin (r+d)) :=
|
| 93 |
+
Finset.univ.filter (fun i => (i.val < r → a ≤ i.val) ∧ (r ≤ i.val → b ≤ t+(i.val-r)))
|
| 94 |
+
|
| 95 |
+
def levelEmbedding (r d t a b : ℕ) :
|
| 96 |
+
Fin (levelIndices r d t a b).card ↪o Fin (r+d) :=
|
| 97 |
+
(levelIndices r d t a b).orderEmbOfFin rfl
|
| 98 |
+
|
| 99 |
+
lemma mem_range_levelEmbedding (i : Fin (r+d)) :
|
| 100 |
+
i ∈ Set.range (levelEmbedding r d t a b) ↔
|
| 101 |
+
(i.val < r → a ≤ i.val) ∧ (r ≤ i.val → b ≤ t+(i.val-r)) := by
|
| 102 |
+
rw [levelEmbedding,Finset.range_orderEmbOfFin]
|
| 103 |
+
simp only [Finset.mem_coe,levelIndices,Finset.mem_filter,Finset.mem_univ,true_and]
|
| 104 |
+
|
| 105 |
+
include ha hA hB in
|
| 106 |
+
omit [N.Normal] in
|
| 107 |
+
lemma reducedLevel_subspace (x : square K ⧸ diagonal K N) :
|
| 108 |
+
x ∈ reducedLevel K N A B ↔ ∀ i,
|
| 109 |
+
i ∉ Set.range (levelEmbedding r d t a b) →
|
| 110 |
+
(reducedCoordinates c K hK hr N hN hcent).coord x i = 0 := by
|
| 111 |
+
rw [reducedLevel_coordinates c K hK hr N hN hcent ha A B hA hB]
|
| 112 |
+
constructor
|
| 113 |
+
· rintro ⟨hbase,htail⟩ i hi
|
| 114 |
+
rw [mem_range_levelEmbedding] at hi
|
| 115 |
+
by_cases hir : i.val < r
|
| 116 |
+
· have hia : i.val < a := by omega
|
| 117 |
+
exact hbase ⟨i.val,hir⟩ hia
|
| 118 |
+
· have hid : i.val-r < d := by have := i.isLt; omega
|
| 119 |
+
have hib : t+(i.val-r) < b := by omega
|
| 120 |
+
have hiEq : Fin.natAdd r (⟨i.val-r,hid⟩ : Fin d) = i := Fin.ext (by dsimp; omega)
|
| 121 |
+
simpa only [hiEq] using htail ⟨i.val-r,hid⟩ hib
|
| 122 |
+
· intro hx
|
| 123 |
+
constructor
|
| 124 |
+
· intro i hi
|
| 125 |
+
apply hx
|
| 126 |
+
rw [mem_range_levelEmbedding]
|
| 127 |
+
simp only [Fin.val_castAdd]
|
| 128 |
+
omega
|
| 129 |
+
· intro j hj
|
| 130 |
+
apply hx
|
| 131 |
+
rw [mem_range_levelEmbedding]
|
| 132 |
+
simp only [Fin.val_natAdd]
|
| 133 |
+
omega
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
def reducedLevelCoordinates : RealCoordinates (reducedLevel K N A B)
|
| 138 |
+
(levelIndices r d t a b).card :=
|
| 139 |
+
CoordinateSubspace.restrictedCoordinates
|
| 140 |
+
(reducedCoordinates c K hK hr N hN hcent) (levelEmbedding r d t a b)
|
| 141 |
+
(reducedLevel K N A B) (reducedLevel_subspace c K hK hr N hN hcent ha A B hA hB)
|
| 142 |
+
|
| 143 |
+
omit [N.Normal] in
|
| 144 |
+
lemma reducedLevel_lattice (Γ : Subgroup G)
|
| 145 |
+
(hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z)
|
| 146 |
+
(x : reducedLevel K N A B) :
|
| 147 |
+
x ∈ (reducedLattice K N Γ).comap (reducedLevel K N A B).subtype ↔
|
| 148 |
+
∀ i, ∃ z : ℤ, (reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB).coord x i = z :=
|
| 149 |
+
CoordinateSubspace.restricted_lattice _ _ _ _ (reducedLattice K N Γ)
|
| 150 |
+
(reducedLattice_iff c K hK hr N hN hcent Γ hΓ) x
|
| 151 |
+
|
| 152 |
+
end PairTail
|
| 153 |
+
end
|
| 154 |
+
end
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
section
|
| 159 |
+
noncomputable section
|
| 160 |
+
namespace RationalLattice
|
| 161 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 162 |
+
variable (c : RealCoordinates G n)
|
| 163 |
+
|
| 164 |
+
include c in
|
| 165 |
+
lemma coordinates_connected : ConnectedSpace G :=
|
| 166 |
+
c.coord.connectedSpace_iff.mpr inferInstance
|
| 167 |
+
|
| 168 |
+
include c in
|
| 169 |
+
lemma coordinates_simplyConnected : SimplyConnectedSpace G :=
|
| 170 |
+
c.coord.toHomotopyEquiv.simplyConnectedSpace_iff.mpr inferInstance
|
| 171 |
+
|
| 172 |
+
include c in
|
| 173 |
+
lemma coordinates_locallyCompact : LocallyCompactSpace G :=
|
| 174 |
+
c.coord.locallyCompactSpace_iff.mpr inferInstance
|
| 175 |
+
|
| 176 |
+
include c in
|
| 177 |
+
lemma coordinates_secondCountable : SecondCountableTopology G :=
|
| 178 |
+
c.coord.secondCountableTopology
|
| 179 |
+
|
| 180 |
+
end RationalLattice
|
| 181 |
+
|
| 182 |
+
namespace PairTail
|
| 183 |
+
open RationalLattice MeasureTheory
|
| 184 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 185 |
+
variable {t d r : ℕ} (c : RealCoordinates G (t+d))
|
| 186 |
+
variable (K : Subgroup G) [K.Normal]
|
| 187 |
+
variable (hK : ∀ g : G, g ∈ K ↔ ∀ i : Fin (t+d), i.val < t → c.coord g i = 0)
|
| 188 |
+
variable (hr : r ≤ t+d) (N : Subgroup G) [N.Normal]
|
| 189 |
+
variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin (t+d), i.val < r → c.coord g i = 0)
|
| 190 |
+
variable (hcent : N ≤ Subgroup.center G) [(diagonal K N).Normal]
|
| 191 |
+
variable {a b : ℕ} (ha : a ≤ r)
|
| 192 |
+
variable (A B : Subgroup G) [B.Normal]
|
| 193 |
+
variable (hA : ∀ g : G, g ∈ A ↔ ∀ i : Fin (t+d), i.val < a → c.coord g i = 0)
|
| 194 |
+
variable (hB : ∀ g : G, g ∈ B ↔ ∀ i : Fin (t+d), i.val < b → c.coord g i = 0)
|
| 195 |
+
|
| 196 |
+
include ha hA hB hK hN hcent hr in
|
| 197 |
+
omit [N.Normal] in
|
| 198 |
+
lemma reducedLevel_connected : ConnectedSpace (reducedLevel K N A B) :=
|
| 199 |
+
coordinates_connected (reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB)
|
| 200 |
+
|
| 201 |
+
include ha hA hB hK hN hcent hr in
|
| 202 |
+
omit [N.Normal] in
|
| 203 |
+
lemma reducedLevel_simplyConnected : SimplyConnectedSpace (reducedLevel K N A B) :=
|
| 204 |
+
coordinates_simplyConnected (reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB)
|
| 205 |
+
|
| 206 |
+
variable (Γ : Subgroup G)
|
| 207 |
+
variable (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z)
|
| 208 |
+
|
| 209 |
+
include ha hA hB hK hN hcent hr hΓ in
|
| 210 |
+
omit [N.Normal] in
|
| 211 |
+
lemma reducedLevel_compact_reps :
|
| 212 |
+
∃ C : Set (reducedLevel K N A B), IsCompact C ∧ ∀ g : reducedLevel K N A B,
|
| 213 |
+
∃ x ∈ C, x⁻¹*g ∈ (reducedLattice K N Γ).comap (reducedLevel K N A B).subtype :=
|
| 214 |
+
compact_reps_of_integerCoordinates
|
| 215 |
+
(reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB)
|
| 216 |
+
((reducedLattice K N Γ).comap (reducedLevel K N A B).subtype)
|
| 217 |
+
(reducedLevel_lattice c K hK hr N hN hcent ha A B hA hB Γ hΓ)
|
| 218 |
+
|
| 219 |
+
include ha hA hB hK hN hcent hr hΓ in
|
| 220 |
+
omit [N.Normal] in
|
| 221 |
+
lemma reducedLevel_discrete :
|
| 222 |
+
DiscreteTopology ((reducedLattice K N Γ).comap (reducedLevel K N A B).subtype) :=
|
| 223 |
+
integerCoordinates_discrete
|
| 224 |
+
(reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB)
|
| 225 |
+
((reducedLattice K N Γ).comap (reducedLevel K N A B).subtype)
|
| 226 |
+
(reducedLevel_lattice c K hK hr N hN hcent ha A B hA hB Γ hΓ)
|
| 227 |
+
|
| 228 |
+
include ha hA hB hK hN hcent hr hΓ in
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
omit [N.Normal] in
|
| 232 |
+
lemma reducedLevelHaar_existsUnique
|
| 233 |
+
[MeasurableSpace ((reducedLevel K N A B) ⧸
|
| 234 |
+
(reducedLattice K N Γ).comap (reducedLevel K N A B).subtype)]
|
| 235 |
+
[BorelSpace ((reducedLevel K N A B) ⧸
|
| 236 |
+
(reducedLattice K N Γ).comap (reducedLevel K N A B).subtype)] :
|
| 237 |
+
∃! μ : ProbabilityMeasure ((reducedLevel K N A B) ⧸
|
| 238 |
+
(reducedLattice K N Γ).comap (reducedLevel K N A B).subtype),
|
| 239 |
+
SMulInvariantMeasure (reducedLevel K N A B)
|
| 240 |
+
((reducedLevel K N A B) ⧸
|
| 241 |
+
(reducedLattice K N Γ).comap (reducedLevel K N A B).subtype)
|
| 242 |
+
(μ : Measure ((reducedLevel K N A B) ⧸
|
| 243 |
+
(reducedLattice K N Γ).comap (reducedLevel K N A B).subtype)) :=
|
| 244 |
+
existsUnique_coordinateHaar
|
| 245 |
+
(reducedLevelCoordinates c K hK hr N hN hcent ha A B hA hB)
|
| 246 |
+
((reducedLattice K N Γ).comap (reducedLevel K N A B).subtype)
|
| 247 |
+
(reducedLevel_lattice c K hK hr N hN hcent ha A B hA hB Γ hΓ)
|
| 248 |
+
|
| 249 |
+
end PairTail
|
| 250 |
+
end
|
| 251 |
+
end
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
section
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
open scoped commutatorElement
|
| 260 |
+
|
| 261 |
+
namespace CubeFaces
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
end CubeFaces
|
| 265 |
+
|
| 266 |
+
end
|
| 267 |
+
end
|
| 268 |
+
end
|
| 269 |
+
end
|
| 270 |
+
|
| 271 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PairTail04.lean
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.MalcevWeighted02
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
end
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
section
|
| 18 |
+
noncomputable section
|
| 19 |
+
open scoped commutatorElement
|
| 20 |
+
namespace PairTail
|
| 21 |
+
open RationalLattice CubeFaces
|
| 22 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 23 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 24 |
+
variable [∀ k : ℕ, (H.level k).Normal]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def squareFiltration : Filtration (square (H.level 2)) where
|
| 29 |
+
level k := (LeibmanSquare.level H h0 (max 1 k)).comap (square (H.level 2)).subtype
|
| 30 |
+
antitone := by
|
| 31 |
+
intro i j hij
|
| 32 |
+
exact Subgroup.comap_mono (LeibmanSquare.level_antitone H h0 (max_le_max_left 1 hij))
|
| 33 |
+
commutator_le i j := by
|
| 34 |
+
apply Subgroup.commutator_le.mpr
|
| 35 |
+
intro x hx y hy
|
| 36 |
+
change (↑⁅x,y⁆ : G × G)∈LeibmanSquare.level H h0 (max 1 (i+j))
|
| 37 |
+
have hc := LeibmanSquare.commutator_mem_level H h0 (max 1 i) (max 1 j) hx hy
|
| 38 |
+
exact LeibmanSquare.level_antitone H h0 (by omega) hc
|
| 39 |
+
|
| 40 |
+
include h1 in
|
| 41 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 42 |
+
lemma squareFiltration_zero : (squareFiltration H h0).level 0=⊤ := by
|
| 43 |
+
ext x
|
| 44 |
+
change (x.val.1∈H.level 1 ∧ x.val.2∈H.level 1 ∧
|
| 45 |
+
x.val.1⁻¹*x.val.2∈H.level 2) ↔ True
|
| 46 |
+
simp only [h1,Subgroup.mem_top,true_and,iff_true]
|
| 47 |
+
exact x.property
|
| 48 |
+
|
| 49 |
+
include h1 in
|
| 50 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 51 |
+
lemma squareFiltration_one : (squareFiltration H h0).level 1=⊤ := by
|
| 52 |
+
change (squareFiltration H h0).level 0=⊤
|
| 53 |
+
exact squareFiltration_zero H h0 h1
|
| 54 |
+
|
| 55 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 56 |
+
lemma squareFiltration_eq_pairLevel (k : ℕ) :
|
| 57 |
+
(squareFiltration H h0).level k=
|
| 58 |
+
pairLevel (H.level 2) (H.level (max 1 k)) (H.level (max 1 k+1)) := by
|
| 59 |
+
ext x
|
| 60 |
+
change (x.val.1∈H.level (max 1 k) ∧ x.val.2∈H.level (max 1 k) ∧
|
| 61 |
+
x.val.1⁻¹*x.val.2∈H.level (max 1 k+1)) ↔
|
| 62 |
+
(x.val.1∈H.level (max 1 k) ∧ x.val.1⁻¹*x.val.2∈H.level (max 1 k+1))
|
| 63 |
+
constructor
|
| 64 |
+
· exact fun hx => ⟨hx.1,hx.2.2⟩
|
| 65 |
+
· rintro ⟨hx,hd⟩
|
| 66 |
+
refine ⟨hx,?_,hd⟩
|
| 67 |
+
have hh := (H.level (max 1 k)).mul_mem hx (H.antitone (by omega : max 1 k ≤ max 1 k+1) hd)
|
| 68 |
+
simpa using hh
|
| 69 |
+
|
| 70 |
+
variable (s : ℕ) (hs1 : 1 ≤ s) (hs : H.level (s+1)=⊥)
|
| 71 |
+
include hs1 hs in
|
| 72 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 73 |
+
lemma squareFiltration_last : (squareFiltration H h0).level s=diagonal (H.level 2) (H.level s) := by
|
| 74 |
+
ext x
|
| 75 |
+
change x.val∈LeibmanSquare.level H h0 (max 1 s) ↔ _
|
| 76 |
+
rw [max_eq_right hs1,LeibmanSquare.last_level H h0 s hs]
|
| 77 |
+
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)
|
| 78 |
+
exact and_congr_right fun _ => eq_comm
|
| 79 |
+
|
| 80 |
+
include h1 hs in
|
| 81 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] [∀ levelIndex : ℕ, (H.level levelIndex).Normal] in
|
| 82 |
+
lemma level_last_central : H.level s ≤ Subgroup.center G := by
|
| 83 |
+
intro x hx
|
| 84 |
+
apply Subgroup.mem_center_iff.mpr
|
| 85 |
+
intro y
|
| 86 |
+
apply commutatorElement_eq_one_iff_mul_comm.mp
|
| 87 |
+
have hy : y∈H.level 1 := by rw [h1]; trivial
|
| 88 |
+
have hh := H.commutator_le 1 s (Subgroup.commutator_mem_commutator hy hx)
|
| 89 |
+
rw [Nat.add_comm,hs] at hh
|
| 90 |
+
exact hh
|
| 91 |
+
|
| 92 |
+
variable [(diagonal (H.level 2) (H.level s)).Normal]
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
def reducedSquareFiltration : Filtration (square (H.level 2) ⧸ diagonal (H.level 2) (H.level s)) :=
|
| 96 |
+
LeibmanSquare.mapFiltration (squareFiltration H h0)
|
| 97 |
+
(QuotientGroup.mk' (diagonal (H.level 2) (H.level s)))
|
| 98 |
+
|
| 99 |
+
include h1 in
|
| 100 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 101 |
+
lemma reducedSquareFiltration_zero : (reducedSquareFiltration H h0 s).level 0=⊤ := by
|
| 102 |
+
change ((squareFiltration H h0).level 0).map _=⊤
|
| 103 |
+
rw [squareFiltration_zero H h0 h1,Subgroup.map_top_of_surjective _ (QuotientGroup.mk'_surjective _)]
|
| 104 |
+
|
| 105 |
+
include h1 in
|
| 106 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 107 |
+
lemma reducedSquareFiltration_one : (reducedSquareFiltration H h0 s).level 1=⊤ := by
|
| 108 |
+
change ((squareFiltration H h0).level 1).map _=⊤
|
| 109 |
+
rw [squareFiltration_one H h0 h1,Subgroup.map_top_of_surjective _ (QuotientGroup.mk'_surjective _)]
|
| 110 |
+
|
| 111 |
+
include hs1 hs in
|
| 112 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 113 |
+
lemma reducedSquareFiltration_last : (reducedSquareFiltration H h0 s).level s=⊥ := by
|
| 114 |
+
change ((squareFiltration H h0).level s).map _=⊥
|
| 115 |
+
rw [squareFiltration_last H h0 s hs1 hs,Subgroup.map_eq_bot_iff,QuotientGroup.ker_mk']
|
| 116 |
+
|
| 117 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 118 |
+
lemma reducedSquareFiltration_level (k : ℕ) :
|
| 119 |
+
(reducedSquareFiltration H h0 s).level k=
|
| 120 |
+
reducedLevel (H.level 2) (H.level s) (H.level (max 1 k)) (H.level (max 1 k+1)) := by
|
| 121 |
+
change ((squareFiltration H h0).level k).map _=_
|
| 122 |
+
rw [squareFiltration_eq_pairLevel]
|
| 123 |
+
rfl
|
| 124 |
+
|
| 125 |
+
end PairTail
|
| 126 |
+
end
|
| 127 |
+
end
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
section
|
| 132 |
+
noncomputable section
|
| 133 |
+
namespace PairTail
|
| 134 |
+
open RationalLattice MalcevCharacters MalcevWeightedCoordinates CubeFaces
|
| 135 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 136 |
+
|
| 137 |
+
omit [IsTopologicalGroup G] in
|
| 138 |
+
lemma filtration_cutoff_monotone {n : ℕ} (c : RealCoordinates G n)
|
| 139 |
+
(H : Filtration G) (q : ℕ → ℕ) (hqbound : ∀ k, q k ≤ n)
|
| 140 |
+
(hq : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin n, i.val < q k → c.coord g i=0) :
|
| 141 |
+
Monotone q := by
|
| 142 |
+
classical
|
| 143 |
+
intro a b hab
|
| 144 |
+
by_contra hn
|
| 145 |
+
have hba : q b < q a := Nat.lt_of_not_ge hn
|
| 146 |
+
let i : Fin n := ⟨q b,lt_of_lt_of_le hba (hqbound a)⟩
|
| 147 |
+
have hm : axis c i 1∈H.level b := by
|
| 148 |
+
apply (hq b _).mpr
|
| 149 |
+
intro j hj
|
| 150 |
+
have hji : j≠i := by intro he; subst j; exact (lt_irrefl _ hj)
|
| 151 |
+
simp [hji]
|
| 152 |
+
have hz := (hq a _).mp (H.antitone hab hm) i hba
|
| 153 |
+
simp at hz
|
| 154 |
+
|
| 155 |
+
variable {t d : ℕ} (c : RealCoordinates G (t+d))
|
| 156 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 157 |
+
variable [∀ k : ℕ, (H.level k).Normal]
|
| 158 |
+
variable (s : ℕ) (hs1 : 1 ≤ s) (hs : H.level (s+1)=⊥)
|
| 159 |
+
variable [(diagonal (H.level 2) (H.level s)).Normal]
|
| 160 |
+
variable (q : ℕ → ℕ) (hqbound : ∀ k, q k ≤ t+d) (hq2 : q 2=t)
|
| 161 |
+
variable (hq : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin (t+d), i.val < q k → c.coord g i=0)
|
| 162 |
+
|
| 163 |
+
include hq hq2 in
|
| 164 |
+
omit [IsTopologicalGroup G] [∀ levelIndex : ℕ, (H.level levelIndex).Normal] in
|
| 165 |
+
lemma square_tail_equation (g : G) :
|
| 166 |
+
g∈H.level 2 ↔ ∀ i : Fin (t+d), i.val < t → c.coord g i=0 := by
|
| 167 |
+
rw [hq,hq2]
|
| 168 |
+
|
| 169 |
+
include h1 hs1 hs hqbound hq2 hq in
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
theorem exists_adapted_reducedCoordinates (Γ : Subgroup G)
|
| 173 |
+
(hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z) :
|
| 174 |
+
∃ c' : RealCoordinates (square (H.level 2) ⧸ diagonal (H.level 2) (H.level s)) (q s+d),
|
| 175 |
+
SecondKind c' ∧
|
| 176 |
+
(∀ g, g∈reducedLattice (H.level 2) (H.level s) Γ ↔ ∀ i, ∃ z : ℤ, c'.coord g i=z) ∧
|
| 177 |
+
∀ k : ℕ, ∃ r : ℕ, r ≤ q s+d ∧ ∀ g,
|
| 178 |
+
g∈(reducedSquareFiltration H h0 s).level k ↔
|
| 179 |
+
∀ i : Fin (q s+d), i.val < r → c'.coord g i=0 := by
|
| 180 |
+
classical
|
| 181 |
+
have hK := square_tail_equation c H q hq2 hq
|
| 182 |
+
have hcent := level_last_central H h1 s hs
|
| 183 |
+
let cR := reducedCoordinates c (H.level 2) hK (hqbound s) (H.level s) (hq s) hcent
|
| 184 |
+
let Q:=reducedSquareFiltration H h0 s
|
| 185 |
+
have hQ0 : Q.level 0=⊤ := reducedSquareFiltration_zero H h0 h1 s
|
| 186 |
+
have hQ1 : Q.level 1=⊤ := reducedSquareFiltration_one H h0 h1 s
|
| 187 |
+
have hQs : Q.level s=⊥ := reducedSquareFiltration_last H h0 s hs1 hs
|
| 188 |
+
have hQdeg : Q.level (s+1)=⊥ := le_antisymm (by
|
| 189 |
+
rw [← hQs]
|
| 190 |
+
exact Q.antitone (by omega)) bot_le
|
| 191 |
+
have hsub : ∀ k : ℕ, ∃ I : Set (Fin (q s+d)), ∀ x,
|
| 192 |
+
x∈Q.level k ↔ ∀ i∈I, cR.coord x i=0 := by
|
| 193 |
+
intro k
|
| 194 |
+
by_cases hk : k < s
|
| 195 |
+
· have hks : max 1 k ≤ s := by omega
|
| 196 |
+
have ha : q (max 1 k) ≤ q s := filtration_cutoff_monotone c H q hqbound hq hks
|
| 197 |
+
refine ⟨(Set.range (levelEmbedding (q s) d t (q (max 1 k)) (q (max 1 k+1))))ᶜ,?_⟩
|
| 198 |
+
intro x
|
| 199 |
+
change x∈(reducedSquareFiltration H h0 s).level k ↔ _
|
| 200 |
+
rw [reducedSquareFiltration_level]
|
| 201 |
+
exact reducedLevel_subspace c (H.level 2) hK (hqbound s) (H.level s) (hq s)
|
| 202 |
+
hcent ha (H.level (max 1 k)) (H.level (max 1 k+1)) (hq (max 1 k)) (hq (max 1 k+1)) x
|
| 203 |
+
· have hbot : Q.level k=⊥ := le_antisymm (by
|
| 204 |
+
rw [← hQs]
|
| 205 |
+
exact Q.antitone (by omega)) bot_le
|
| 206 |
+
refine ⟨Set.univ,?_⟩
|
| 207 |
+
intro x
|
| 208 |
+
rw [hbot,Subgroup.mem_bot]
|
| 209 |
+
constructor
|
| 210 |
+
· intro hx i _
|
| 211 |
+
rw [hx]
|
| 212 |
+
exact cR.one_coord i
|
| 213 |
+
· intro hx
|
| 214 |
+
apply cR.coord.injective
|
| 215 |
+
funext i
|
| 216 |
+
rw [hx i (Set.mem_univ i),cR.one_coord]
|
| 217 |
+
apply exists_adapted_secondKind_coordinates cR Q hQ0 hQ1 s hQdeg hsub
|
| 218 |
+
exact reducedLattice_iff c (H.level 2) hK (hqbound s) (H.level s) (hq s) hcent Γ hΓ
|
| 219 |
+
|
| 220 |
+
end PairTail
|
| 221 |
+
end
|
| 222 |
+
end
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
section
|
| 227 |
+
noncomputable section
|
| 228 |
+
namespace RationalLattice
|
| 229 |
+
open MalcevCharacters
|
| 230 |
+
variable {G K : Type*} [Group G] [Group K] [TopologicalSpace G] [TopologicalSpace K]
|
| 231 |
+
[IsTopologicalGroup G] [IsTopologicalGroup K] {n : ℕ}
|
| 232 |
+
variable (c : RealCoordinates K n) (e : G ≃* K)
|
| 233 |
+
(hc : Continuous e) (hci : Continuous e.symm)
|
| 234 |
+
|
| 235 |
+
omit [IsTopologicalGroup G] [IsTopologicalGroup K] in
|
| 236 |
+
@[simp] lemma pullCoordinates_axis (i : Fin n) (t : ℝ) :
|
| 237 |
+
e (axis (pullCoordinates c e hc hci) i t)=axis c i t := by
|
| 238 |
+
change e (e.symm (c.coord.symm (Pi.single i t)))=c.coord.symm (Pi.single i t)
|
| 239 |
+
exact e.apply_symm_apply _
|
| 240 |
+
|
| 241 |
+
omit [IsTopologicalGroup G] [IsTopologicalGroup K] in
|
| 242 |
+
lemma pullCoordinates_secondKind (hsk : SecondKind c) :
|
| 243 |
+
SecondKind (pullCoordinates c e hc hci) where
|
| 244 |
+
axis_add i s t := by
|
| 245 |
+
apply e.injective
|
| 246 |
+
simp only [map_mul,pullCoordinates_axis,hsk.axis_add]
|
| 247 |
+
ordered g := by
|
| 248 |
+
apply e.injective
|
| 249 |
+
rw [map_list_prod,List.map_ofFn]
|
| 250 |
+
simp only [Function.comp_def,pullCoordinates_axis]
|
| 251 |
+
exact hsk.ordered (e g)
|
| 252 |
+
end RationalLattice
|
| 253 |
+
|
| 254 |
+
namespace LeibmanSquare
|
| 255 |
+
open CubeFaces RationalLattice MalcevCharacters PairTail
|
| 256 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 257 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 258 |
+
variable [∀ i, (H.level i).Normal]
|
| 259 |
+
variable (s : ℕ) (hs0 : 1 ≤ s) (hs : H.level (s+1)=⊥)
|
| 260 |
+
variable [((restricted H h0).level s).Normal]
|
| 261 |
+
variable [(PairTail.diagonal (H.level 2) (H.level s)).Normal]
|
| 262 |
+
variable {t d : ℕ} (c : RealCoordinates G (t+d))
|
| 263 |
+
variable (q : ℕ → ℕ) (hqbound : ∀ k, q k ≤ t+d) (hq2 : q 2=t)
|
| 264 |
+
variable (hq : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin (t+d), i.val < q k → c.coord g i=0)
|
| 265 |
+
|
| 266 |
+
include h1 hs0 hs hqbound hq2 hq in
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
theorem exists_adapted_sourceReducedCoordinates (Γ : Subgroup G)
|
| 270 |
+
(hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z) :
|
| 271 |
+
∃ c' : RealCoordinates ((level H h0 1) ⧸ (restricted H h0).level s) (q s+d),
|
| 272 |
+
SecondKind c' ∧
|
| 273 |
+
(∀ g, g∈((Γ.prod Γ).comap (level H h0 1).subtype).map
|
| 274 |
+
(QuotientGroup.mk' ((restricted H h0).level s)) ↔ ∀ i, ∃ z : ℤ, c'.coord g i=z) ∧
|
| 275 |
+
∀ k : ℕ, ∃ r : ℕ, r ≤ q s+d ∧ ∀ g,
|
| 276 |
+
g∈(mapFiltration (restricted H h0) (QuotientGroup.mk' ((restricted H h0).level s))).level k ↔
|
| 277 |
+
∀ i : Fin (q s+d), i.val < r → c'.coord g i=0 := by
|
| 278 |
+
obtain ⟨cR,hsk,hRL,hRF⟩ := exists_adapted_reducedCoordinates c H h0 h1 s hs0 hs q hqbound hq2 hq Γ hΓ
|
| 279 |
+
let e:=reducedPairEquiv H h0 h1 s hs0 hs
|
| 280 |
+
have hc : Continuous e := reducedPairEquiv_continuous H h0 h1 s hs0 hs
|
| 281 |
+
have hci : Continuous e.symm := reducedPairEquiv_symm_continuous H h0 h1 s hs0 hs
|
| 282 |
+
refine ⟨pullCoordinates cR e hc hci,pullCoordinates_secondKind cR e hc hci hsk,?_,?_⟩
|
| 283 |
+
· intro g
|
| 284 |
+
change g∈_ ↔ ∀ i, ∃ z : ℤ, cR.coord (e g) i=z
|
| 285 |
+
rw [← hRL,← reducedLattice_map H h0 h1 s hs0 hs Γ]
|
| 286 |
+
simp only [Subgroup.mem_map_equiv,e,MulEquiv.symm_apply_apply]
|
| 287 |
+
· intro k
|
| 288 |
+
obtain ⟨r,hr,hrg⟩ := hRF k
|
| 289 |
+
refine ⟨r,hr,fun g => ?_⟩
|
| 290 |
+
change g∈((restricted H h0).level k).map _ ↔ ∀ i : Fin (q s+d), i.val < r → cR.coord (e g) i=0
|
| 291 |
+
rw [← hrg,PairTail.reducedSquareFiltration_level,← reducedLevel_map H h0 h1 s hs0 hs k]
|
| 292 |
+
simp only [Subgroup.mem_map_equiv,e,MulEquiv.symm_apply_apply]
|
| 293 |
+
|
| 294 |
+
end LeibmanSquare
|
| 295 |
+
|
| 296 |
+
end
|
| 297 |
+
end
|
| 298 |
+
end
|
| 299 |
+
end
|
| 300 |
+
end
|
| 301 |
+
|
| 302 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PairTail05.lean
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.CompactFamily01
|
| 3 |
+
import OAI.Combinatorics.SumProduct.Alignment.CoordinateSubspace01
|
| 4 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
section
|
| 12 |
+
open scoped commutatorElement Pointwise
|
| 13 |
+
namespace SquareInduction
|
| 14 |
+
open MeasureTheory
|
| 15 |
+
open scoped BigOperators
|
| 16 |
+
noncomputable section
|
| 17 |
+
section Probability
|
| 18 |
+
variable {X : Type*} [TopologicalSpace X] [CompactSpace X]
|
| 19 |
+
[MeasurableSpace X] [BorelSpace X] (μ : Measure X) [IsProbabilityMeasure μ]
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def discrepancy (N : ℕ) (x : ℕ → X) : C(X, ℂ) →ₗ[ℂ] ℂ where
|
| 24 |
+
toFun f := (𝔼 n ∈ Finset.range N, f (x n)) - ∫ t, f t ∂μ
|
| 25 |
+
map_add' f g := by
|
| 26 |
+
change (𝔼 n ∈ Finset.range N, (f (x n) + g (x n))) -
|
| 27 |
+
∫ t, f t + g t ∂μ = _
|
| 28 |
+
rw [Finset.expect_add_distrib, integral_add
|
| 29 |
+
(f.continuous.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace f))
|
| 30 |
+
(g.continuous.integrable_of_hasCompactSupport (HasCompactSupport.of_compactSpace g))]
|
| 31 |
+
ring
|
| 32 |
+
map_smul' z f := by
|
| 33 |
+
change (𝔼 n ∈ Finset.range N, z • f (x n)) - ∫ t, z • f t ∂μ = _
|
| 34 |
+
rw [← Finset.smul_expect, integral_smul]
|
| 35 |
+
simp only [RingHom.id_apply, smul_sub]
|
| 36 |
+
|
| 37 |
+
theorem discrepancy_bound (N : ℕ) (hN : 0 < N) (x : ℕ → X) (f : C(X, ℂ)) :
|
| 38 |
+
‖discrepancy μ N x f‖ ≤ 2 * ‖f‖ := by
|
| 39 |
+
have hm : ‖𝔼 n ∈ Finset.range N, f (x n)‖ ≤ ‖f‖ :=
|
| 40 |
+
(RCLike.norm_expect_le (K := ℂ)).trans (Finset.expect_le
|
| 41 |
+
(Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hN)) (fun n _ => f.norm_coe_le_norm _))
|
| 42 |
+
have hi : ‖∫ t, f t ∂μ‖ ≤ ‖f‖ := by
|
| 43 |
+
simpa only [probReal_univ, mul_one] using norm_integral_le_of_norm_le_const (μ := μ)
|
| 44 |
+
(Filter.Eventually.of_forall (f.norm_coe_le_norm))
|
| 45 |
+
exact (norm_sub_le _ _).trans (by linarith only [hm, hi])
|
| 46 |
+
|
| 47 |
+
theorem discrepancy_const (N : ℕ) (hN : 0 < N) (x : ℕ → X) (z : ℂ) :
|
| 48 |
+
discrepancy μ N x (ContinuousMap.const _ z) = 0 := by
|
| 49 |
+
simp only [discrepancy, LinearMap.coe_mk, AddHom.coe_mk, ContinuousMap.const_apply,
|
| 50 |
+
Finset.expect_const (Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hN)),
|
| 51 |
+
integral_const, probReal_univ, one_smul, sub_self]
|
| 52 |
+
end Probability
|
| 53 |
+
end
|
| 54 |
+
end SquareInduction
|
| 55 |
+
|
| 56 |
+
namespace SquareInduction
|
| 57 |
+
open CubeFaces LeibmanSquare PolynomialWeyl UniformSquareObservable
|
| 58 |
+
open CompactFamilyDescent MeasureTheory Topology
|
| 59 |
+
open scoped BigOperators ComplexConjugate
|
| 60 |
+
noncomputable section
|
| 61 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
theorem uniform_dense_square_descent_tracked
|
| 66 |
+
(H : Filtration G) (h0 : H.level 0 = ⊤) (h1 : H.level 1 = ⊤)
|
| 67 |
+
(Γ : Subgroup G) (s : ℕ) (hs2 : 2 ≤ s) (hs : H.level (s+1) = ⊥)
|
| 68 |
+
[TopologicalSpace.MetrizableSpace (ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs)]
|
| 69 |
+
[CompactSpace (ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs)]
|
| 70 |
+
(F : C(G ⧸ Γ,ℂ)) (hF : ∀ x, ‖F x‖ ≤ 1) (χ : G → ℂ)
|
| 71 |
+
(hχ : ∀ n ∈ H.level s, ‖χ n‖ = 1)
|
| 72 |
+
(hw : ∀ n ∈ H.level s, ∀ x : G,
|
| 73 |
+
F (QuotientGroup.mk (x*n)) = χ n * F (QuotientGroup.mk x))
|
| 74 |
+
(z : G) (hz : z ∈ H.level s) (hχz : χ z ≠ 1)
|
| 75 |
+
(C : Set G) (hCc : IsCompact C) (hC : ∀ g : G, ∃ c ∈ C, c⁻¹*g ∈ Γ)
|
| 76 |
+
(δ : ℝ) (hδ : 0 < δ) :
|
| 77 |
+
let R := restricted H h0
|
| 78 |
+
letI := last_normal H h0 (by omega : 1 ≤ s) hs
|
| 79 |
+
let π := QuotientGroup.mk' (R.level s)
|
| 80 |
+
let Q := mapFiltration R π
|
| 81 |
+
let X := ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs
|
| 82 |
+
letI := TopologicalSpace.metrizableSpaceMetric X
|
| 83 |
+
letI : MeasurableSpace X := borel X
|
| 84 |
+
∃ tests : Finset {Ψ : C(X,ℂ) // Ψ ∈ lipschitzMaps (Y := X)},
|
| 85 |
+
∃ η : ℝ, 0 < η ∧
|
| 86 |
+
∀ μ : Measure X, IsProbabilityMeasure μ →
|
| 87 |
+
SMulInvariantMeasure ((level H h0 1) ⧸ R.level s) X μ →
|
| 88 |
+
∀ (f : ℤ → G), Polynomial H 0 f →
|
| 89 |
+
∀ N T : ℕ, 0 < N → 0 < T →
|
| 90 |
+
δ ≤ ‖mean N (fun n => F (QuotientGroup.mk (f n)))‖ →
|
| 91 |
+
4 * (T : ℝ) / N ≤ δ^2/2 →
|
| 92 |
+
∃ b ∈ Finset.range T, ∃ A : Finset ℕ,
|
| 93 |
+
(∀ a ∈ A, a < T) ∧ δ^2/4*T ≤ (A.card : ℝ) ∧
|
| 94 |
+
∀ a ∈ A, ∃ Ψ ∈ tests, ∃ p : ℤ → (level H h0 1) ⧸ R.level s,
|
| 95 |
+
∃ u ∈ C, ∃ v ∈ C, ∃ γ ∈ Γ, ∃ ε ∈ Γ,
|
| 96 |
+
f a = u*γ ∧ f b = v*ε ∧
|
| 97 |
+
(∀ n : ℤ, ∃ x : level H h0 1, p n = π x ∧
|
| 98 |
+
x.val = (u⁻¹*f (n+a)*γ⁻¹, v⁻¹*f (n+b)*ε⁻¹)) ∧
|
| 99 |
+
Polynomial Q 0 p ∧
|
| 100 |
+
(∀ ts : List ℤ, s ≤ ts.length → ∀ n, iterDiff ts p n = 1) ∧
|
| 101 |
+
η ≤ ‖mean N (fun n => Ψ.val (QuotientGroup.mk (p n))) -
|
| 102 |
+
∫ x, Ψ.val x ∂μ‖ := by
|
| 103 |
+
classical
|
| 104 |
+
let R := restricted H h0
|
| 105 |
+
let := last_normal H h0 (by omega : 1 ≤ s) hs
|
| 106 |
+
let π := QuotientGroup.mk' (R.level s)
|
| 107 |
+
let X := ReducedSpace H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs
|
| 108 |
+
let := TopologicalSpace.metrizableSpaceMetric X
|
| 109 |
+
let : MeasurableSpace X := borel X
|
| 110 |
+
let : BorelSpace X := ⟨rfl⟩
|
| 111 |
+
obtain ⟨tests,η,hη,htests⟩ := finite_square_tests H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs F χ hχ hw
|
| 112 |
+
C hCc (δ^2/4) 2 (by positivity) (by norm_num)
|
| 113 |
+
refine ⟨tests,η,hη,?_⟩
|
| 114 |
+
intro μ hprob hinv f hf N T hN hT hlarge hboundary
|
| 115 |
+
let := hprob
|
| 116 |
+
obtain ⟨b,hb,A,hAT,hAc,hAd⟩ := dense_reduced_square_orbits_tracked H h0 h1 Γ F hF s hs2 hs
|
| 117 |
+
χ hχ hw C hC f hf N T hN hT δ hδ hlarge hboundary
|
| 118 |
+
refine ⟨b,hb,A,hAT,hAc,?_⟩
|
| 119 |
+
intro a ha
|
| 120 |
+
obtain ⟨u,hu,v,hv,Φ,p,γ,hγ,ε,hε,hfa,hfb,hlift,hΦbound,hΦ,hp,hptop,heval,hcorr⟩ := hAd a ha
|
| 121 |
+
have heq : Φ = observable H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs F χ hχ hw (u,v) := by
|
| 122 |
+
ext x
|
| 123 |
+
induction x using Quotient.inductionOn with | h y =>
|
| 124 |
+
induction y using Quotient.inductionOn with | h w =>
|
| 125 |
+
exact hΦ w
|
| 126 |
+
have hzero : (∫ x, Φ x ∂μ) = 0 :=
|
| 127 |
+
reduced_observable_mean_zero H h0 h1 Γ F u v s hs2 hs χ hw z hz hχz μ hinv Φ hΦ
|
| 128 |
+
let L : C(X,ℂ) →ₗ[ℂ] ℂ := discrepancy μ N (fun n => QuotientGroup.mk (p n))
|
| 129 |
+
have hL : ∀ Ψ, ‖L Ψ‖ ≤ 2 * ‖Ψ‖ := discrepancy_bound μ N hN _
|
| 130 |
+
have hcorr' : δ^2/4 ≤ ‖L (observable H h0 Γ s (le_trans (by decide : 1 ≤ 2) hs2) hs F χ hχ hw (u,v))‖ := by
|
| 131 |
+
rw [← heq]
|
| 132 |
+
change δ^2/4 ≤ ‖mean N (fun n => Φ (QuotientGroup.mk (p n))) - ∫ x, Φ x ∂μ‖
|
| 133 |
+
simpa only [hzero,sub_zero] using hcorr
|
| 134 |
+
obtain ⟨Ψ,hΨ,hΨcorr⟩ := htests L hL ⟨u,hu,v,hv,hcorr'⟩
|
| 135 |
+
exact ⟨Ψ,hΨ,p,u,hu,v,hv,γ,hγ,ε,hε,hfa,hfb,hlift,hp,hptop,hΨcorr⟩
|
| 136 |
+
|
| 137 |
+
end
|
| 138 |
+
end SquareInduction
|
| 139 |
+
|
| 140 |
+
end
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
section
|
| 145 |
+
noncomputable section
|
| 146 |
+
open scoped BigOperators ComplexConjugate
|
| 147 |
+
namespace SquareDifferences
|
| 148 |
+
open PolynomialWeyl
|
| 149 |
+
|
| 150 |
+
lemma norm_mean_derivative_swap (N a b : ℕ) (f : ℕ → ℂ) :
|
| 151 |
+
‖mean N (derivative a b f)‖=‖mean N (derivative b a f)‖ := by
|
| 152 |
+
have he : mean N (derivative a b f)=conj (mean N (derivative b a f)) := by
|
| 153 |
+
simp only [mean,derivative,map_expect (starRingEnd ℂ),map_mul,starRingEnd_self_apply]
|
| 154 |
+
apply Finset.expect_congr rfl
|
| 155 |
+
intro n _
|
| 156 |
+
ring
|
| 157 |
+
rw [he,RCLike.norm_conj]
|
| 158 |
+
|
| 159 |
+
lemma derivative_shift_error {N : ℕ} (hN : 0<N) (a b : ℕ) (hab : b≤a)
|
| 160 |
+
(f : ℕ → ℂ) (hf : ∀ n, ‖f n‖≤1) :
|
| 161 |
+
‖mean N (derivative a b f)‖ ≤ ‖mean N (derivative (a-b) 0 f)‖+2*(b:ℝ)/N := by
|
| 162 |
+
have he : derivative a b f = fun n => derivative (a-b) 0 f (n+b) := by
|
| 163 |
+
funext n
|
| 164 |
+
simp only [derivative,Nat.add_zero]
|
| 165 |
+
congr 2
|
| 166 |
+
omega
|
| 167 |
+
have ht := norm_mean_shift_sub_le hN b (derivative (a-b) 0 f)
|
| 168 |
+
(norm_derivative_le_one (a-b) 0 f hf)
|
| 169 |
+
rw [←he] at ht
|
| 170 |
+
have hn := norm_sub_norm_le (mean N (derivative a b f)) (mean N (derivative (a-b) 0 f))
|
| 171 |
+
linarith
|
| 172 |
+
|
| 173 |
+
lemma nat_dist_image_card (S : Finset ℕ) (b : ℕ) :
|
| 174 |
+
S.card ≤ 2*(S.image (fun a => Nat.dist a b)).card := by
|
| 175 |
+
classical
|
| 176 |
+
let A := S.image (fun a => Nat.dist a b)
|
| 177 |
+
have hc := Finset.card_le_card_of_injOn (s:=S) (t:=A.product (Finset.univ : Finset Bool))
|
| 178 |
+
(fun a => (Nat.dist a b,decide (b≤a))) (by
|
| 179 |
+
intro a ha
|
| 180 |
+
exact Finset.mem_product.mpr ⟨Finset.mem_image.mpr ⟨a,ha,rfl⟩,Finset.mem_univ _⟩) (by
|
| 181 |
+
intro a ha c hc he
|
| 182 |
+
have h1 := congrArg Prod.fst he
|
| 183 |
+
have h2 := congrArg Prod.snd he
|
| 184 |
+
have h3 : (b≤a) ↔ b≤c := by simpa only [Prod.snd,decide_eq_decide] using h2
|
| 185 |
+
simp only [Nat.dist] at h1
|
| 186 |
+
omega)
|
| 187 |
+
simpa only [Finset.product_eq_sprod,Finset.card_product,Finset.card_univ,Fintype.card_bool,Nat.mul_comm,A] using hc
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
theorem exists_dense_one_sided {N T : ℕ} (hN : 0<N) (hT : 0<T)
|
| 192 |
+
(f : ℕ → ℂ) (hf : ∀ n, ‖f n‖≤1) (δ : ℝ) (hδ : 0<δ)
|
| 193 |
+
(hlarge : δ≤‖mean N f‖) (hboundary : 4*(T:ℝ)/N≤δ^2/4) :
|
| 194 |
+
∃ A : Finset ℕ, (∀ h∈A, h<T) ∧ δ^2/8*T≤(A.card:ℝ) ∧
|
| 195 |
+
∀ h∈A, δ^2/8≤‖mean N (derivative h 0 f)‖ := by
|
| 196 |
+
classical
|
| 197 |
+
obtain ⟨b,hb,S,hST,hSc,hcorr⟩ := exists_dense_derivatives hN hT f hf δ hδ hlarge
|
| 198 |
+
(by nlinarith [sq_nonneg δ])
|
| 199 |
+
have hbT := Finset.mem_range.mp hb
|
| 200 |
+
refine ⟨S.image (fun a => Nat.dist a b),?_,?_,?_⟩
|
| 201 |
+
· intro h hh
|
| 202 |
+
obtain ⟨a,ha,rfl⟩ := Finset.mem_image.mp hh
|
| 203 |
+
have haT := hST a ha
|
| 204 |
+
simp only [Nat.dist]
|
| 205 |
+
omega
|
| 206 |
+
· have hc := nat_dist_image_card S b
|
| 207 |
+
have hc' : (S.card:ℝ)≤2*((S.image (fun a => Nat.dist a b)).card:ℝ) := by exact_mod_cast hc
|
| 208 |
+
linarith
|
| 209 |
+
· intro h hh
|
| 210 |
+
obtain ⟨a,ha,rfl⟩ := Finset.mem_image.mp hh
|
| 211 |
+
have hsmall : ∀ k : ℕ, k<T → 2*(k:ℝ)/N≤δ^2/8 := by
|
| 212 |
+
intro k hk
|
| 213 |
+
have hk' : (k:ℝ)≤T := by exact_mod_cast hk.le
|
| 214 |
+
have he : 2*(k:ℝ)/N≤2*(T:ℝ)/N :=
|
| 215 |
+
div_le_div_of_nonneg_right (by linarith) (Nat.cast_nonneg N)
|
| 216 |
+
apply he.trans
|
| 217 |
+
calc
|
| 218 |
+
2*(T:ℝ)/N=(4*(T:ℝ)/N)/2 := by ring
|
| 219 |
+
_ ≤ (δ^2/4)/2 := div_le_div_of_nonneg_right hboundary (by norm_num)
|
| 220 |
+
_ = δ^2/8 := by ring
|
| 221 |
+
have hc := hcorr a ha
|
| 222 |
+
by_cases hab : b≤a
|
| 223 |
+
· rw [Nat.dist_eq_sub_of_le_right hab]
|
| 224 |
+
have he := derivative_shift_error hN a b hab f hf
|
| 225 |
+
have hs := hsmall b hbT
|
| 226 |
+
linarith
|
| 227 |
+
· have hab' : a≤b := le_of_not_ge hab
|
| 228 |
+
rw [Nat.dist_eq_sub_of_le hab']
|
| 229 |
+
rw [norm_mean_derivative_swap N a b f] at hc
|
| 230 |
+
have he := derivative_shift_error hN b a hab' f hf
|
| 231 |
+
have hs := hsmall a (hST a ha)
|
| 232 |
+
linarith
|
| 233 |
+
|
| 234 |
+
end SquareDifferences
|
| 235 |
+
end
|
| 236 |
+
end
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
section
|
| 241 |
+
open scoped commutatorElement
|
| 242 |
+
noncomputable section
|
| 243 |
+
namespace PairTail
|
| 244 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 245 |
+
variable (K : Subgroup G) [K.Normal]
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
def diagonalEmbedding : G →* square K where
|
| 249 |
+
toFun g := pair K g 1
|
| 250 |
+
map_one' := by apply Subtype.ext; ext <;> simp [pair]
|
| 251 |
+
map_mul' g h := by apply Subtype.ext; ext <;> simp [pair]
|
| 252 |
+
def lowerEmbedding : K →* square K where
|
| 253 |
+
toFun u := pair K 1 u
|
| 254 |
+
map_one' := by apply Subtype.ext; ext <;> simp [pair]
|
| 255 |
+
map_mul' g h := by apply Subtype.ext; ext <;> simp [pair]
|
| 256 |
+
lemma diagonalEmbedding_continuous : Continuous (diagonalEmbedding K) :=
|
| 257 |
+
(pair_continuous K).comp (continuous_id.prodMk continuous_const)
|
| 258 |
+
lemma lowerEmbedding_continuous : Continuous (lowerEmbedding K) :=
|
| 259 |
+
(pair_continuous K).comp (continuous_const.prodMk continuous_id)
|
| 260 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 261 |
+
lemma pair_decompose [TopologicalSpace G] [IsTopologicalGroup G] (g : G) (u : K) :
|
| 262 |
+
pair K g u = diagonalEmbedding K g * lowerEmbedding K u := by
|
| 263 |
+
apply Subtype.ext
|
| 264 |
+
ext <;> simp [pair,diagonalEmbedding,lowerEmbedding]
|
| 265 |
+
|
| 266 |
+
variable (η : square K →* Multiplicative ℝ)
|
| 267 |
+
def baseCharacter : G →* Multiplicative ℝ := η.comp (diagonalEmbedding K)
|
| 268 |
+
def lowerCharacter : K →* Multiplicative ℝ := η.comp (lowerEmbedding K)
|
| 269 |
+
lemma baseCharacter_continuous (hη : Continuous η) : Continuous (baseCharacter K η) :=
|
| 270 |
+
hη.comp (diagonalEmbedding_continuous K)
|
| 271 |
+
lemma lowerCharacter_continuous (hη : Continuous η) : Continuous (lowerCharacter K η) :=
|
| 272 |
+
hη.comp (lowerEmbedding_continuous K)
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
lemma character_split (x : square K) :
|
| 276 |
+
Multiplicative.toAdd (η x) = Multiplicative.toAdd (baseCharacter K η x.val.1) +
|
| 277 |
+
Multiplicative.toAdd (lowerCharacter K η (difference K x)) := by
|
| 278 |
+
conv_lhs => rw [← pair_first_difference K x,pair_decompose,map_mul]
|
| 279 |
+
rfl
|
| 280 |
+
|
| 281 |
+
lemma character_nonzero (hη : η ≠ 1) : baseCharacter K η ≠ 1 ∨ lowerCharacter K η ≠ 1 := by
|
| 282 |
+
by_contra h
|
| 283 |
+
push Not at h
|
| 284 |
+
apply hη
|
| 285 |
+
ext x
|
| 286 |
+
apply Multiplicative.toAdd.injective
|
| 287 |
+
rw [character_split,h.1,h.2]
|
| 288 |
+
simp
|
| 289 |
+
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 293 |
+
lemma lowerCharacter_conj [TopologicalSpace G] [IsTopologicalGroup G] (g : G) (u : K) :
|
| 294 |
+
lowerCharacter K η ⟨g*u*g⁻¹,(inferInstance : K.Normal).conj_mem _ u.property g⟩ =
|
| 295 |
+
lowerCharacter K η u := by
|
| 296 |
+
have he : lowerEmbedding K ⟨g*u*g⁻¹,(inferInstance : K.Normal).conj_mem _ u.property g⟩ =
|
| 297 |
+
diagonalEmbedding K g * lowerEmbedding K u * (diagonalEmbedding K g)⁻¹ := by
|
| 298 |
+
apply Subtype.ext
|
| 299 |
+
ext <;> simp [pair,diagonalEmbedding,lowerEmbedding,mul_assoc]
|
| 300 |
+
change η _ = η _
|
| 301 |
+
rw [he,map_mul,map_mul,map_inv]
|
| 302 |
+
simp [mul_assoc]
|
| 303 |
+
|
| 304 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 305 |
+
lemma lower_commutator_mem [TopologicalSpace G] [IsTopologicalGroup G]
|
| 306 |
+
(g : G) (u : K) : ⁅g,u.val⁆ ∈ K :=
|
| 307 |
+
K.mul_mem ((inferInstance : K.Normal).conj_mem _ u.property g) (K.inv_mem u.property)
|
| 308 |
+
|
| 309 |
+
lemma lowerCharacter_commutator (g : G) (u : K) :
|
| 310 |
+
lowerCharacter K η ⟨⁅g,u.val⁆,lower_commutator_mem K g u⟩ = 1 := by
|
| 311 |
+
let v : K := ⟨g*u*g⁻¹,(inferInstance : K.Normal).conj_mem _ u.property g⟩
|
| 312 |
+
have he : (⟨⁅g,u.val⁆,lower_commutator_mem K g u⟩ : K) = v*u⁻¹ := by
|
| 313 |
+
apply Subtype.ext
|
| 314 |
+
rfl
|
| 315 |
+
rw [he,map_mul,map_inv,lowerCharacter_conj]
|
| 316 |
+
exact mul_inv_cancel _
|
| 317 |
+
|
| 318 |
+
variable (Γ : Subgroup G)
|
| 319 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 320 |
+
lemma baseCharacter_integral [TopologicalSpace G] [IsTopologicalGroup G]
|
| 321 |
+
(hη : ∀ x ∈ squareLattice K Γ, ∃ z : ℤ, Multiplicative.toAdd (η x) = z) :
|
| 322 |
+
∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (baseCharacter K η g) = z := by
|
| 323 |
+
intro g hg
|
| 324 |
+
apply hη (diagonalEmbedding K g)
|
| 325 |
+
simpa [diagonalEmbedding,pair] using And.intro hg hg
|
| 326 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 327 |
+
lemma lowerCharacter_integral [TopologicalSpace G] [IsTopologicalGroup G]
|
| 328 |
+
(hη : ∀ x ∈ squareLattice K Γ, ∃ z : ℤ, Multiplicative.toAdd (η x) = z) :
|
| 329 |
+
∀ u : K, u.val ∈ Γ → ∃ z : ℤ, Multiplicative.toAdd (lowerCharacter K η u) = z := by
|
| 330 |
+
intro u hu
|
| 331 |
+
apply hη (lowerEmbedding K u)
|
| 332 |
+
simpa [lowerEmbedding,pair] using And.intro Γ.one_mem hu
|
| 333 |
+
|
| 334 |
+
end PairTail
|
| 335 |
+
|
| 336 |
+
end
|
| 337 |
+
end
|
| 338 |
+
end
|
| 339 |
+
end
|
| 340 |
+
end
|
| 341 |
+
|
| 342 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PairTail06.lean
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.LeibmanSquare02
|
| 3 |
+
import OAI.Combinatorics.SumProduct.Alignment.LeibmanSquare03
|
| 4 |
+
import OAI.Combinatorics.SumProduct.Alignment.PairTail05
|
| 5 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 6 |
+
|
| 7 |
+
namespace OAI
|
| 8 |
+
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
section
|
| 12 |
+
section
|
| 13 |
+
open scoped commutatorElement
|
| 14 |
+
noncomputable section
|
| 15 |
+
end
|
| 16 |
+
end
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
section
|
| 21 |
+
open scoped commutatorElement BigOperators
|
| 22 |
+
noncomputable section
|
| 23 |
+
namespace PairTail
|
| 24 |
+
open RationalLattice MalcevCharacters
|
| 25 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 26 |
+
variable (K : Subgroup G) [K.Normal]
|
| 27 |
+
variable (η : square K →* Multiplicative ℝ)
|
| 28 |
+
variable (hcomm : ∀ a b : G, ⁅a,b⁆ ∈ K)
|
| 29 |
+
|
| 30 |
+
def bracket (a b : G) : K := ⟨⁅a,b⁆,hcomm a b⟩
|
| 31 |
+
|
| 32 |
+
def bracketCharacter (a : G) : G →* Multiplicative ℝ where
|
| 33 |
+
toFun b := lowerCharacter K η (bracket K hcomm a b)
|
| 34 |
+
map_one' := by
|
| 35 |
+
have he : bracket K hcomm a 1 = 1 := by apply Subtype.ext; simp [bracket]
|
| 36 |
+
rw [he,map_one]
|
| 37 |
+
map_mul' b c := by
|
| 38 |
+
have he : bracket K hcomm a (b*c) = bracket K hcomm a b *
|
| 39 |
+
⟨b*(bracket K hcomm a c).val*b⁻¹,
|
| 40 |
+
(inferInstance : K.Normal).conj_mem _ (bracket K hcomm a c).property b⟩ := by
|
| 41 |
+
apply Subtype.ext
|
| 42 |
+
change ⁅a,b*c⁆ = ⁅a,b⁆ * (b*⁅a,c⁆*b⁻¹)
|
| 43 |
+
rw [commutatorElement_mul_right_eq_mul_conj]
|
| 44 |
+
group
|
| 45 |
+
rw [he,map_mul,lowerCharacter_conj]
|
| 46 |
+
|
| 47 |
+
lemma bracketCharacter_continuous (hη : Continuous η) (a : G) :
|
| 48 |
+
Continuous (bracketCharacter K η hcomm a) := by
|
| 49 |
+
apply (lowerCharacter_continuous K η hη).comp
|
| 50 |
+
apply Continuous.subtype_mk
|
| 51 |
+
exact ((continuous_const.mul continuous_id).mul continuous_const).mul continuous_inv
|
| 52 |
+
|
| 53 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 54 |
+
lemma bracket_skew (a b : G) :
|
| 55 |
+
lowerCharacter K η (bracket K hcomm b a) =
|
| 56 |
+
(lowerCharacter K η (bracket K hcomm a b))⁻¹ := by
|
| 57 |
+
have he : bracket K hcomm b a = (bracket K hcomm a b)⁻¹ := by
|
| 58 |
+
apply Subtype.ext
|
| 59 |
+
exact (commutatorElement_inv a b).symm
|
| 60 |
+
rw [he,map_inv]
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def leftBracketCharacter (b : G) : G →* Multiplicative ℝ :=
|
| 65 |
+
(bracketCharacter K η hcomm b)⁻¹
|
| 66 |
+
lemma leftBracketCharacter_apply (a b : G) :
|
| 67 |
+
leftBracketCharacter K η hcomm b a = lowerCharacter K η (bracket K hcomm a b) :=
|
| 68 |
+
(bracket_skew K η hcomm b a).symm
|
| 69 |
+
lemma leftBracketCharacter_continuous (hη : Continuous η) (b : G) :
|
| 70 |
+
Continuous (leftBracketCharacter K η hcomm b) :=
|
| 71 |
+
(bracketCharacter_continuous K η hcomm hη b).inv
|
| 72 |
+
|
| 73 |
+
variable {n : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c)
|
| 74 |
+
|
| 75 |
+
def bracketMatrix (i j : Fin n) : ℝ :=
|
| 76 |
+
Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm (axis c i 1) (axis c j 1)))
|
| 77 |
+
|
| 78 |
+
include hsk in
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
lemma bracket_coordinates (hη : Continuous η) (a b : G) :
|
| 82 |
+
Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a b)) =
|
| 83 |
+
∑ i, ∑ j, c.coord a i * c.coord b j * bracketMatrix K η hcomm c i j := by
|
| 84 |
+
have hright := character_coordinates c hsk (bracketCharacter K η hcomm a)
|
| 85 |
+
(bracketCharacter_continuous K η hcomm hη a) b
|
| 86 |
+
change Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a b)) = _ at hright
|
| 87 |
+
rw [hright]
|
| 88 |
+
have hleft (j : Fin n) : Multiplicative.toAdd
|
| 89 |
+
(bracketCharacter K η hcomm a (axis c j 1)) =
|
| 90 |
+
∑ i, c.coord a i * bracketMatrix K η hcomm c i j := by
|
| 91 |
+
have he := character_coordinates c hsk (leftBracketCharacter K η hcomm (axis c j 1))
|
| 92 |
+
(leftBracketCharacter_continuous K η hcomm hη (axis c j 1)) a
|
| 93 |
+
simpa only [leftBracketCharacter_apply,bracketMatrix,bracketCharacter,MonoidHom.coe_mk,OneHom.coe_mk] using he
|
| 94 |
+
simp_rw [hleft,Finset.mul_sum]
|
| 95 |
+
rw [Finset.sum_comm]
|
| 96 |
+
apply Finset.sum_congr rfl
|
| 97 |
+
intro i _
|
| 98 |
+
apply Finset.sum_congr rfl
|
| 99 |
+
intro j _
|
| 100 |
+
ring
|
| 101 |
+
|
| 102 |
+
omit [IsTopologicalGroup G] in
|
| 103 |
+
lemma bracketMatrix_skew (i j : Fin n) :
|
| 104 |
+
bracketMatrix K η hcomm c j i = - bracketMatrix K η hcomm c i j := by
|
| 105 |
+
unfold bracketMatrix
|
| 106 |
+
rw [bracket_skew]
|
| 107 |
+
rfl
|
| 108 |
+
omit [IsTopologicalGroup G] in
|
| 109 |
+
lemma bracketMatrix_diagonal (i : Fin n) : bracketMatrix K η hcomm c i i = 0 := by
|
| 110 |
+
have he := bracketMatrix_skew K η hcomm c i i
|
| 111 |
+
linarith
|
| 112 |
+
|
| 113 |
+
variable (Γ : Subgroup G)
|
| 114 |
+
include hsk in
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
theorem integer_commutator_matrix (hη : Continuous η)
|
| 118 |
+
(hletters : ∀ i : Fin n, axis c i 1 ∈ Γ)
|
| 119 |
+
(hz : ∀ x ∈ squareLattice K Γ, ∃ z : ℤ, Multiplicative.toAdd (η x) = z) :
|
| 120 |
+
∃ M : Fin n → Fin n → ℤ,
|
| 121 |
+
(∀ i j, (M i j : ℝ) = bracketMatrix K η hcomm c i j) ∧
|
| 122 |
+
(∀ a b : G, Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a b)) =
|
| 123 |
+
∑ i, ∑ j, c.coord a i * c.coord b j * (M i j : ℝ)) ∧
|
| 124 |
+
(∀ i j, M j i = -M i j) ∧ (∀ i, M i i = 0) := by
|
| 125 |
+
have hi (i j : Fin n) : ∃ z : ℤ, bracketMatrix K η hcomm c i j = z := by
|
| 126 |
+
apply lowerCharacter_integral K η Γ hz (bracket K hcomm (axis c i 1) (axis c j 1))
|
| 127 |
+
exact Γ.mul_mem (Γ.mul_mem (Γ.mul_mem (hletters i) (hletters j)) (Γ.inv_mem (hletters i)))
|
| 128 |
+
(Γ.inv_mem (hletters j))
|
| 129 |
+
choose M hM using hi
|
| 130 |
+
refine ⟨M,fun i j => (hM i j).symm,?_,?_,?_⟩
|
| 131 |
+
· intro a b
|
| 132 |
+
simpa only [hM] using bracket_coordinates K η hcomm c hsk hη a b
|
| 133 |
+
· intro i j
|
| 134 |
+
have he := bracketMatrix_skew K η hcomm c i j
|
| 135 |
+
rw [hM,hM] at he
|
| 136 |
+
exact_mod_cast he
|
| 137 |
+
· intro i
|
| 138 |
+
have he := bracketMatrix_diagonal K η hcomm c i
|
| 139 |
+
rw [hM] at he
|
| 140 |
+
exact_mod_cast he
|
| 141 |
+
|
| 142 |
+
end PairTail
|
| 143 |
+
end
|
| 144 |
+
end
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
section
|
| 149 |
+
noncomputable section
|
| 150 |
+
open scoped commutatorElement
|
| 151 |
+
namespace PairTail
|
| 152 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 153 |
+
variable (K : Subgroup G) [K.Normal]
|
| 154 |
+
variable (η : square K →* Multiplicative ℝ)
|
| 155 |
+
variable (hcomm : ∀ a b : G, ⁅a,b⁆ ∈ K)
|
| 156 |
+
|
| 157 |
+
def insideConj (a : G) (u : K) : K :=
|
| 158 |
+
⟨a*u*a⁻¹,(inferInstance : K.Normal).conj_mem _ u.property a⟩
|
| 159 |
+
|
| 160 |
+
lemma lower_insideConj (a : G) (u : K) :
|
| 161 |
+
lowerCharacter K η (insideConj K a u) = lowerCharacter K η u :=
|
| 162 |
+
lowerCharacter_conj K η a u
|
| 163 |
+
|
| 164 |
+
lemma bracket_inv_inv (a b : G) :
|
| 165 |
+
lowerCharacter K η (bracket K hcomm a⁻¹ b⁻¹) =
|
| 166 |
+
lowerCharacter K η (bracket K hcomm a b) := by
|
| 167 |
+
change bracketCharacter K η hcomm a⁻¹ b⁻¹ = _
|
| 168 |
+
rw [map_inv]
|
| 169 |
+
change (lowerCharacter K η (bracket K hcomm a⁻¹ b))⁻¹ = _
|
| 170 |
+
rw [← leftBracketCharacter_apply, map_inv, leftBracketCharacter_apply, inv_inv]
|
| 171 |
+
|
| 172 |
+
def normalizedTail (u w : K) (a v : G) : K :=
|
| 173 |
+
insideConj K a⁻¹ u⁻¹ * insideConj K (a⁻¹*v⁻¹) w * bracket K hcomm a⁻¹ v⁻¹
|
| 174 |
+
|
| 175 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 176 |
+
lemma normalizedTail_val (u w : K) (a v : G) :
|
| 177 |
+
(normalizedTail K hcomm u w a v).val = (u.val*a)⁻¹*(v⁻¹*w.val*a*v) := by
|
| 178 |
+
change (a⁻¹*u.val⁻¹*(a⁻¹)⁻¹)*((a⁻¹*v⁻¹)*w.val*(a⁻¹*v⁻¹)⁻¹)*
|
| 179 |
+
⁅a⁻¹,v⁻¹⁆ = _
|
| 180 |
+
simp only [commutatorElement_def]
|
| 181 |
+
group
|
| 182 |
+
|
| 183 |
+
lemma lower_normalizedTail (u w : K) (a v : G) :
|
| 184 |
+
lowerCharacter K η (normalizedTail K hcomm u w a v) =
|
| 185 |
+
(lowerCharacter K η u)⁻¹ * lowerCharacter K η w *
|
| 186 |
+
lowerCharacter K η (bracket K hcomm a v) := by
|
| 187 |
+
rw [normalizedTail,map_mul,map_mul,lower_insideConj,lower_insideConj,map_inv,
|
| 188 |
+
bracket_inv_inv]
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
def normalizedPair (u w : K) (a v : G) : square K :=
|
| 193 |
+
pair K (u.val*a) (normalizedTail K hcomm u w a v)
|
| 194 |
+
|
| 195 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 196 |
+
lemma normalizedPair_val (u w : K) (a v : G) :
|
| 197 |
+
(normalizedPair K hcomm u w a v).val = (u.val*a,v⁻¹*w.val*a*v) := by
|
| 198 |
+
ext
|
| 199 |
+
· rfl
|
| 200 |
+
· change (u.val*a)*(normalizedTail K hcomm u w a v).val = _
|
| 201 |
+
rw [normalizedTail_val,mul_inv_cancel_left]
|
| 202 |
+
|
| 203 |
+
lemma normalizedPair_character (u w : K) (a v : G) :
|
| 204 |
+
Multiplicative.toAdd (η (normalizedPair K hcomm u w a v)) =
|
| 205 |
+
Multiplicative.toAdd (baseCharacter K η (u.val*a)) +
|
| 206 |
+
Multiplicative.toAdd (lowerCharacter K η w) -
|
| 207 |
+
Multiplicative.toAdd (lowerCharacter K η u) +
|
| 208 |
+
Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a v)) := by
|
| 209 |
+
rw [character_split]
|
| 210 |
+
change Multiplicative.toAdd (baseCharacter K η (u.val*a)) +
|
| 211 |
+
Multiplicative.toAdd (lowerCharacter K η (difference K
|
| 212 |
+
(pair K (u.val*a) (normalizedTail K hcomm u w a v)))) = _
|
| 213 |
+
rw [difference_pair,lower_normalizedTail]
|
| 214 |
+
simp only [toAdd_mul,toAdd_inv]
|
| 215 |
+
ring
|
| 216 |
+
|
| 217 |
+
lemma bracket_zpow (a v : G) (n : ℤ) :
|
| 218 |
+
Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm (a^n) v)) =
|
| 219 |
+
(n:ℝ)*Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a v)) := by
|
| 220 |
+
rw [← leftBracketCharacter_apply,map_zpow,leftBracketCharacter_apply]
|
| 221 |
+
simp only [toAdd_zpow,zsmul_eq_mul]
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
theorem square_orbit_identity (a v : G) (u : ℤ → K) (h n : ℤ) :
|
| 226 |
+
Multiplicative.toAdd (η (normalizedPair K hcomm (u n) (u (n+h)) (a^n) v)) =
|
| 227 |
+
Multiplicative.toAdd (baseCharacter K η ((u n).val*a^n)) +
|
| 228 |
+
(Multiplicative.toAdd (lowerCharacter K η (u (n+h))) -
|
| 229 |
+
Multiplicative.toAdd (lowerCharacter K η (u n))) +
|
| 230 |
+
(n:ℝ)*Multiplicative.toAdd (lowerCharacter K η (bracket K hcomm a v)) := by
|
| 231 |
+
rw [normalizedPair_character,bracket_zpow]
|
| 232 |
+
ring
|
| 233 |
+
|
| 234 |
+
end PairTail
|
| 235 |
+
end
|
| 236 |
+
end
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
section
|
| 241 |
+
noncomputable section
|
| 242 |
+
open scoped commutatorElement ComplexConjugate
|
| 243 |
+
namespace LeibmanSquare
|
| 244 |
+
open CubeFaces CubePolynomials
|
| 245 |
+
variable {G : Type*} [Group G]
|
| 246 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 247 |
+
|
| 248 |
+
include h0 in
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
lemma linear_remainder_mem {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (n : ℤ) :
|
| 252 |
+
f n*(f 1^n)⁻¹∈H.level 2 := by
|
| 253 |
+
let := level_normal H h0 2
|
| 254 |
+
let π:=QuotientGroup.mk' (H.level 2)
|
| 255 |
+
have hadd (a b : ℤ) : π (f (a+b))=π (f a)*π (f b) := by
|
| 256 |
+
have hm := hf [b,a] 0
|
| 257 |
+
have hz : π (iterDiff [b,a] f 0)=1 := (QuotientGroup.eq_one_iff _).mpr hm
|
| 258 |
+
simp only [iterDiff,diff,zero_add,hf0,inv_one,one_mul,map_mul,map_inv] at hz
|
| 259 |
+
have he := congrArg (fun x => π (f a)*π (f b)*x) hz
|
| 260 |
+
convert he using 1 <;> group
|
| 261 |
+
let φ : Multiplicative ℤ →* G ⧸ H.level 2 := {
|
| 262 |
+
toFun z := π (f z.toAdd)
|
| 263 |
+
map_one' := by change π (f 0)=1; rw [hf0,map_one]
|
| 264 |
+
map_mul' a b := hadd a.toAdd b.toAdd }
|
| 265 |
+
have he : (Multiplicative.ofAdd (1:ℤ))^n=Multiplicative.ofAdd n := by
|
| 266 |
+
apply Multiplicative.toAdd.injective
|
| 267 |
+
simp
|
| 268 |
+
have hn : π (f n)=π (f 1)^n := by
|
| 269 |
+
simpa [φ] using map_zpow φ (Multiplicative.ofAdd (1:ℤ)) n
|
| 270 |
+
apply (QuotientGroup.eq_one_iff _).mp
|
| 271 |
+
change π (f n*(f 1^n)⁻¹)=1
|
| 272 |
+
rw [map_mul,map_inv,map_zpow,hn,mul_inv_cancel]
|
| 273 |
+
|
| 274 |
+
def linearRemainder {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (n : ℤ) : H.level 2 :=
|
| 275 |
+
⟨f n*(f 1^n)⁻¹,linear_remainder_mem H h0 hf hf0 n⟩
|
| 276 |
+
|
| 277 |
+
lemma linearRemainder_mul {f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (n : ℤ) :
|
| 278 |
+
f n=(linearRemainder H h0 hf hf0 n).val*f 1^n := by
|
| 279 |
+
simp [linearRemainder,mul_assoc]
|
| 280 |
+
|
| 281 |
+
|
| 282 |
+
def tailSquare (u : H.level 2) : level H h0 1 :=
|
| 283 |
+
⟨(1,u.val),by
|
| 284 |
+
refine ⟨(H.level 1).one_mem,?_,?_⟩
|
| 285 |
+
· rw [h1]; trivial
|
| 286 |
+
· simp⟩
|
| 287 |
+
|
| 288 |
+
def linearNormalizedPair {f : ℤ → G} (hf : Polynomial H 0 f)
|
| 289 |
+
(u : H.level 2) (h : ℤ) (v : G) : ℤ → level H h0 1 := fun n =>
|
| 290 |
+
restrictedConj H h0 h1 1 v⁻¹
|
| 291 |
+
(restrictedConj H h0 h1 1 (f h) (normalizedPair H h0 hf h n) * tailSquare H h0 h1 u)
|
| 292 |
+
|
| 293 |
+
lemma linearNormalizedPair_polynomial {f : ℤ → G} (hf : Polynomial H 0 f)
|
| 294 |
+
(u : H.level 2) (h : ℤ) (v : G) :
|
| 295 |
+
Polynomial (restricted H h0) 0 (linearNormalizedPair H h0 h1 hf u h v) := by
|
| 296 |
+
apply polynomial_filtered_map _ _ _ (restrictedConj_filtered H h0 h1 1 v⁻¹)
|
| 297 |
+
apply polynomial_of_cube_mem
|
| 298 |
+
exact (polynomials (restricted H h0) 0).mul_mem
|
| 299 |
+
(cube_mem_of_polynomial _ (normalized_conjugate_polynomial H h0 h1 hf h 1 (f h)))
|
| 300 |
+
(const_mem (by rw [restricted_zero]; trivial))
|
| 301 |
+
|
| 302 |
+
lemma linearNormalizedPair_val {f : ℤ → G} (hf : Polynomial H 0 f)
|
| 303 |
+
(hf0 : f 0=1) (a : G) (u : H.level 2) (h : ℤ) (v : G)
|
| 304 |
+
(huh : f h=u.val*a^h) (n : ℤ) :
|
| 305 |
+
(linearNormalizedPair H h0 h1 hf u h v n).val =
|
| 306 |
+
(f n,v⁻¹*f (n+h)*(a^h)⁻¹*v) := by
|
| 307 |
+
change (1*(1*((f 0)⁻¹*f n)*1⁻¹*1)*1⁻¹,
|
| 308 |
+
v⁻¹*((f h*((f h)⁻¹*f (n+h))*(f h)⁻¹)*u.val)*(v⁻¹)⁻¹)=_
|
| 309 |
+
simp only [hf0,inv_one,one_mul,mul_one,inv_inv,huh,mul_inv_rev]
|
| 310 |
+
congr 1
|
| 311 |
+
group
|
| 312 |
+
|
| 313 |
+
lemma linearNormalizedPair_reduced {f : ℤ → G} (hf : Polynomial H 0 f)
|
| 314 |
+
(u : H.level 2) (h : ℤ) (v : G) {s : ℕ} (hs0 : 1 ≤ s) (hs : H.level (s+1) = ⊥) :
|
| 315 |
+
letI := last_normal H h0 hs0 hs
|
| 316 |
+
let π:=QuotientGroup.mk' ((restricted H h0).level s)
|
| 317 |
+
let Q:=mapFiltration (restricted H h0) π
|
| 318 |
+
let p:=fun n => π (linearNormalizedPair H h0 h1 hf u h v n)
|
| 319 |
+
Polynomial Q 0 p ∧ ∀ ts : List ℤ, s≤ts.length → ∀ n, iterDiff ts p n=1 := by
|
| 320 |
+
dsimp only
|
| 321 |
+
let := last_normal H h0 hs0 hs
|
| 322 |
+
have hp:=polynomial_map _ (QuotientGroup.mk' ((restricted H h0).level s))
|
| 323 |
+
(linearNormalizedPair_polynomial H h0 h1 hf u h v)
|
| 324 |
+
refine ⟨hp,?_⟩
|
| 325 |
+
intro ts hts n
|
| 326 |
+
have hm := (mapFiltration (restricted H h0) (QuotientGroup.mk' ((restricted H h0).level s))).antitone
|
| 327 |
+
(by omega : s≤0+ts.length) (hp ts n)
|
| 328 |
+
simpa only [(quotient_lowers_degree H h0 hs0 hs).2.2,Subgroup.mem_bot] using hm
|
| 329 |
+
|
| 330 |
+
variable [TopologicalSpace G] [IsTopologicalGroup G]
|
| 331 |
+
|
| 332 |
+
omit [IsTopologicalGroup G] in
|
| 333 |
+
lemma balanced_linearNormalizedPair (Γ : Subgroup G) (F : C(G ⧸ Γ,ℂ))
|
| 334 |
+
{f : ℤ → G} (hf : Polynomial H 0 f) (hf0 : f 0=1) (a : G)
|
| 335 |
+
(u : H.level 2) (h : ℤ) (v γ : G) (hγ : γ∈Γ) (hav : a^h=v*γ)
|
| 336 |
+
(huh : f h=u.val*a^h) (n : ℤ) :
|
| 337 |
+
balanced H h0 Γ F 1 v (linearNormalizedPair H h0 h1 hf u h v n)=
|
| 338 |
+
F (QuotientGroup.mk (f n))*conj (F (QuotientGroup.mk (f (n+h)))) := by
|
| 339 |
+
unfold balanced
|
| 340 |
+
rw [linearNormalizedPair_val H h0 h1 hf hf0 a u h v huh n]
|
| 341 |
+
simp only [one_mul]
|
| 342 |
+
have he : v*(v⁻¹*f (n+h)*(a^h)⁻¹*v)=f (n+h)*γ⁻¹ := by rw [hav]; group
|
| 343 |
+
rw [he,QuotientGroup.mk_mul_of_mem _ (Γ.inv_mem hγ)]
|
| 344 |
+
|
| 345 |
+
variable [∀ i, (H.level i).Normal]
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
omit [TopologicalSpace G] [IsTopologicalGroup G] in
|
| 350 |
+
lemma linearNormalizedPair_eq_pairTail {f : ℤ → G} (hf : Polynomial H 0 f)
|
| 351 |
+
(hf0 : f 0=1) (a : G) (u : ℤ → H.level 2) (hu : ∀ n, f n=(u n).val*a^n)
|
| 352 |
+
(hcomm : ∀ a b : G, ⁅a,b⁆∈H.level 2) (h n : ℤ) (v : G) :
|
| 353 |
+
firstPairEquiv H h0 h1 (linearNormalizedPair H h0 h1 hf (u h) h v n)=
|
| 354 |
+
PairTail.normalizedPair (H.level 2) hcomm (u n) (u (n+h)) (a^n) v := by
|
| 355 |
+
apply Subtype.ext
|
| 356 |
+
rw [firstPairEquiv_val,linearNormalizedPair_val H h0 h1 hf hf0 a (u h) h v (hu h) n,
|
| 357 |
+
PairTail.normalizedPair_val,hu n,hu (n+h),zpow_add]
|
| 358 |
+
congr 1
|
| 359 |
+
group
|
| 360 |
+
|
| 361 |
+
end LeibmanSquare
|
| 362 |
+
|
| 363 |
+
end
|
| 364 |
+
end
|
| 365 |
+
end
|
| 366 |
+
end
|
| 367 |
+
end
|
| 368 |
+
|
| 369 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/ParametricSmooth01.lean
ADDED
|
@@ -0,0 +1,408 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.AllLevel04
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
noncomputable section
|
| 11 |
+
open scoped BigOperators Topology commutatorElement
|
| 12 |
+
open Filter
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
end
|
| 16 |
+
|
| 17 |
+
section
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
noncomputable section
|
| 23 |
+
open scoped BigOperators Topology commutatorElement
|
| 24 |
+
open Filter
|
| 25 |
+
open Topology
|
| 26 |
+
universe u
|
| 27 |
+
namespace AllLevelStates
|
| 28 |
+
open RationalLattice CubeFaces CubePolynomials NilpotentTaylor AllLevelFactorization
|
| 29 |
+
open AllLevelDomains AllLevelRemovals CubeHorizontalIrrationality
|
| 30 |
+
variable {G : Type u} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 31 |
+
variable {n : ℕ} {c : RealCoordinates G n} {Γ : Subgroup G} {s : ℕ}
|
| 32 |
+
variable {K : Filtration G} {P : ℕ → ℤ → G} {L : ℕ → ℝ}
|
| 33 |
+
namespace State
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
theorem descend_of_not_irrational (S : State c Γ s K P L)
|
| 38 |
+
(hL : ∀ N,0<L N) (hbad : ¬ S.Irrational) :
|
| 39 |
+
∃ T : State c Γ s K P L,T.domain.rank<S.domain.rank := by
|
| 40 |
+
classical
|
| 41 |
+
unfold Irrational at hbad
|
| 42 |
+
push Not at hbad
|
| 43 |
+
obtain ⟨j,hj,hjs,χ,hne,hcont,hrat,hnext,hbr,hbad⟩:=hbad
|
| 44 |
+
obtain ⟨d,hd,hz⟩:=hrat
|
| 45 |
+
let χ':=scaleCharacter (d:ℝ) χ
|
| 46 |
+
have hne' : χ'≠1:=scaleCharacter_ne (by exact_mod_cast (Nat.ne_of_gt hd)) hne
|
| 47 |
+
have hcont' : Continuous χ':=
|
| 48 |
+
continuous_ofAdd.comp (continuous_const.mul (continuous_toAdd.comp hcont))
|
| 49 |
+
have hnext' (x : S.domain.filtration.level j)
|
| 50 |
+
(hx : x.val∈S.domain.filtration.level (j+1)) : χ' x=1 := by
|
| 51 |
+
change Multiplicative.ofAdd ((d:ℝ)*(χ x).toAdd)=1
|
| 52 |
+
rw [hnext x hx]
|
| 53 |
+
simp
|
| 54 |
+
have hbr' (a b : ℕ) (ha : 0<a) (hb : 0<b) (hab : a+b=j)
|
| 55 |
+
(x : S.domain.Carrier) (hx : x∈S.domain.filtration.level a)
|
| 56 |
+
(y : S.domain.Carrier) (hy : y∈S.domain.filtration.level b)
|
| 57 |
+
(hc : ⁅x,y⁆∈S.domain.filtration.level j) : χ' ⟨⁅x,y⁆,hc⟩=1 := by
|
| 58 |
+
change Multiplicative.ofAdd ((d:ℝ)*(χ ⟨⁅x,y⁆,hc⟩).toAdd)=1
|
| 59 |
+
rw [hbr a b ha hb hab x hx y hy hc]
|
| 60 |
+
simp
|
| 61 |
+
exact S.descend_integral hL j hj hjs χ' hne' hcont' hz hnext' hbr'
|
| 62 |
+
(LevelCharacterSubsequence.nondivergence_integer_mul (L∘S.subseq)
|
| 63 |
+
(fun N=>(χ (S.coeff N j)).toAdd) j d hd hbad)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
theorem exists_irrational_state (S₀ : State c Γ s K P L) (hL : ∀ N,0<L N) :
|
| 68 |
+
∃ S : State c Γ s K P L,S.Irrational := by
|
| 69 |
+
classical
|
| 70 |
+
have hex : ∃ r : ℕ,∃ S : State c Γ s K P L,S.domain.rank=r:=
|
| 71 |
+
⟨S₀.domain.rank,S₀,rfl⟩
|
| 72 |
+
obtain ⟨S,hS⟩:=Nat.find_spec hex
|
| 73 |
+
refine ⟨S,?_⟩
|
| 74 |
+
by_contra hn
|
| 75 |
+
obtain ⟨T,hT⟩:=S.descend_of_not_irrational hL hn
|
| 76 |
+
have hmin:=Nat.find_min' hex (show ∃ U : State c Γ s K P L,
|
| 77 |
+
U.domain.rank=T.domain.rank from ⟨T,rfl⟩)
|
| 78 |
+
rw [← hS] at hmin
|
| 79 |
+
exact (not_lt_of_ge hmin) hT
|
| 80 |
+
|
| 81 |
+
end State
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def initialState (hsk : MalcevCharacters.SecondKind c)
|
| 86 |
+
(hΓ : ∀ x : G,x∈Γ ↔ ∀ i,∃ z : ℤ,c.coord x i=z)
|
| 87 |
+
(hK0 : K.level 0=⊤) (hK1 : K.level 1=⊤) (hKs : K.level (s+1)=⊥)
|
| 88 |
+
(r : ℕ → ℕ) (hr : ∀ k,r k≤n)
|
| 89 |
+
(hadapt : ∀ k (x : G),x∈K.level k ↔ ∀ i : Fin n,i.val<r k → c.coord x i=0)
|
| 90 |
+
(a : ℕ → ∀ k : ℕ,K.level k) (ha0 : ∀ N,(a N 0).val=1) :
|
| 91 |
+
State c Γ s K (fun N=>word (fun k=>(a N k).val) (s+1)) L where
|
| 92 |
+
domain :=
|
| 93 |
+
{ Carrier := G
|
| 94 |
+
embed := MonoidHom.id G
|
| 95 |
+
injective := Function.injective_id
|
| 96 |
+
continuous := continuous_id
|
| 97 |
+
closedEmbedding := IsClosedEmbedding.id
|
| 98 |
+
dim := n
|
| 99 |
+
chart := c
|
| 100 |
+
secondKind := hsk
|
| 101 |
+
lattice := Γ
|
| 102 |
+
integer_lattice := hΓ
|
| 103 |
+
lattice_image := fun _ h=>h
|
| 104 |
+
rational_image := fun _ h=>h
|
| 105 |
+
filtration := K
|
| 106 |
+
zero_top := hK0
|
| 107 |
+
one_top := hK1
|
| 108 |
+
terminal := hKs
|
| 109 |
+
cutoff := r
|
| 110 |
+
cutoff_le := hr
|
| 111 |
+
adapted := hadapt }
|
| 112 |
+
subseq := id
|
| 113 |
+
strictmono := strictMono_id
|
| 114 |
+
coeff := a
|
| 115 |
+
zero := ha0
|
| 116 |
+
level_image := fun _ _ h=>h
|
| 117 |
+
removals := []
|
| 118 |
+
realization := by intro N z; simp [leftWord,rightWord]
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
theorem normalized_factorization_exists (hsk : MalcevCharacters.SecondKind c)
|
| 123 |
+
(hΓ : ∀ x : G,x∈Γ ↔ ∀ i,∃ z : ℤ,c.coord x i=z)
|
| 124 |
+
(hK0 : K.level 0=⊤) (hK1 : K.level 1=⊤) (hKs : K.level (s+1)=⊥)
|
| 125 |
+
(r : ℕ → ℕ) (hr : ∀ k,r k≤n)
|
| 126 |
+
(hadapt : ∀ k (x : G),x∈K.level k ↔ ∀ i : Fin n,i.val<r k → c.coord x i=0)
|
| 127 |
+
(hP : ∀ N,P N∈polynomials K 0) (hP0 : ∀ N,P N 0=1)
|
| 128 |
+
(hL : ∀ N,0<L N) :
|
| 129 |
+
∃ S : State c Γ s K P L,S.Irrational := by
|
| 130 |
+
classical
|
| 131 |
+
have hb (N : ℕ) : ∃ b : ℕ → G,
|
| 132 |
+
(∀ i<s+1,b i∈K.level i) ∧ P N=word b (s+1) := by
|
| 133 |
+
simpa using exists_taylor (H:=K) (k:=0) (d:=s+1) (by simpa using hKs) (hP N)
|
| 134 |
+
choose b hb hword using hb
|
| 135 |
+
let a : ℕ → ∀ k : ℕ,K.level k:=fun N k=>
|
| 136 |
+
if hk : k<s+1 then ⟨b N k,hb N k hk⟩ else 1
|
| 137 |
+
have haword (N : ℕ) : word (fun k=>(a N k).val) (s+1)=P N := by
|
| 138 |
+
rw [hword]
|
| 139 |
+
apply word_congr
|
| 140 |
+
intro k hk
|
| 141 |
+
dsimp only [a]
|
| 142 |
+
rw [dite_eq_left hk]
|
| 143 |
+
have ha0 (N : ℕ) : (a N 0).val=1 := by
|
| 144 |
+
rw [← word_zero (fun k=>(a N k).val) s,haword,hP0]
|
| 145 |
+
obtain ⟨S,hirr⟩:=(initialState (L:=L) hsk hΓ hK0 hK1 hKs r hr hadapt a ha0).exists_irrational_state hL
|
| 146 |
+
have he : (fun N=>word (fun k=>(a N k).val) (s+1))=P:=funext haword
|
| 147 |
+
exact he ▸ ⟨S,hirr⟩
|
| 148 |
+
|
| 149 |
+
end AllLevelStates
|
| 150 |
+
end
|
| 151 |
+
|
| 152 |
+
end
|
| 153 |
+
|
| 154 |
+
section
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
noncomputable section
|
| 160 |
+
open scoped Topology
|
| 161 |
+
open Filter
|
| 162 |
+
universe u
|
| 163 |
+
namespace AllLevelRemovals
|
| 164 |
+
open RationalLattice RationalFactorPeriods
|
| 165 |
+
variable {G : Type u} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 166 |
+
variable {n s : ℕ} {c : RealCoordinates G n} {L : ℕ → ℝ}
|
| 167 |
+
|
| 168 |
+
omit [IsTopologicalGroup G] in
|
| 169 |
+
lemma rightWord_ordered [IsTopologicalGroup G] (W : List (Removal c L s)) (N : ℕ) (z : ℤ) :
|
| 170 |
+
rightWord W N z=orderedWord
|
| 171 |
+
(fun i : Fin W.reverse.length =>
|
| 172 |
+
(W.reverse.get i).flow (Multiplicative.ofAdd 1) ^ (W.reverse.get i).integer N)
|
| 173 |
+
(fun i=>(W.reverse.get i).degree) z := by
|
| 174 |
+
unfold rightWord orderedWord
|
| 175 |
+
simp only [← zpow_mul]
|
| 176 |
+
have hl:=List.map_get_finRange W.reverse
|
| 177 |
+
conv_lhs => rw [← hl, List.map_map]
|
| 178 |
+
rfl
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
theorem rightWord_residues [PreconnectedSpace G] [LocallyCompactSpace G] [T2Space G]
|
| 183 |
+
(Γ : Subgroup G) [DiscreteTopology Γ]
|
| 184 |
+
(hΓrat : Γ≤rationalSubgroup c)
|
| 185 |
+
(C : Set G) (hC : IsCompact C) (hreps : ∀ g : G,∃ x∈C,x⁻¹*g∈Γ)
|
| 186 |
+
(W : List (Removal c L s)) :
|
| 187 |
+
∃ (φ : ℕ → ℕ) (T : ℕ) (σ : Fin T → G),StrictMono φ ∧ 0<T ∧
|
| 188 |
+
(∀ r,IsRational c (σ r)) ∧ ∀ N z,∃ r : Fin T,
|
| 189 |
+
(r.val:ℤ)=z%(T:ℤ) ∧
|
| 190 |
+
(QuotientGroup.mk (rightWord W (φ N) z) : G⧸Γ)=QuotientGroup.mk (σ r) := by
|
| 191 |
+
obtain ⟨φ,T,σ,hφ,hT,hσ,he⟩:=rational_right_factors c Γ hΓrat C hC hreps
|
| 192 |
+
(fun i : Fin W.reverse.length=>(W.reverse.get i).flow (Multiplicative.ofAdd 1))
|
| 193 |
+
(fun i=>(W.reverse.get i).rational_unit)
|
| 194 |
+
(fun N i=>(W.reverse.get i).integer N)
|
| 195 |
+
(fun i=>(W.reverse.get i).degree) s (fun i=>(W.reverse.get i).degree_le)
|
| 196 |
+
refine ⟨φ,T,σ,hφ,hT,hσ,?_⟩
|
| 197 |
+
intro N z
|
| 198 |
+
rw [rightWord_ordered]
|
| 199 |
+
exact he N z
|
| 200 |
+
|
| 201 |
+
end AllLevelRemovals
|
| 202 |
+
namespace AllLevelStates
|
| 203 |
+
open RationalLattice AllLevelDomains AllLevelRemovals CubeFaces NilpotentTaylor
|
| 204 |
+
variable {G : Type u} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 205 |
+
variable {n s : ℕ} {c : RealCoordinates G n} {Γ : Subgroup G}
|
| 206 |
+
variable {K : Filtration G} {P : ℕ → ℤ → G} {L : ℕ → ℝ}
|
| 207 |
+
namespace State
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
def reindex (S : State c Γ s K P L) (φ : ℕ → ℕ) (hφ : StrictMono φ) :
|
| 212 |
+
State c Γ s K P L where
|
| 213 |
+
domain := S.domain
|
| 214 |
+
subseq := S.subseq∘φ
|
| 215 |
+
strictmono := S.strictmono.comp hφ
|
| 216 |
+
coeff := fun N=>S.coeff (φ N)
|
| 217 |
+
zero := fun N=>S.zero (φ N)
|
| 218 |
+
level_image := S.level_image
|
| 219 |
+
removals := S.removals.map (fun w=>w.reindex φ hφ)
|
| 220 |
+
realization := by
|
| 221 |
+
intro N z
|
| 222 |
+
rw [leftWord_reindex,rightWord_reindex]
|
| 223 |
+
exact S.realization (φ N) z
|
| 224 |
+
|
| 225 |
+
lemma irrational_reindex (S : State c Γ s K P L) (hirr : S.Irrational)
|
| 226 |
+
(φ : ℕ → ℕ) (hφ : StrictMono φ) : (S.reindex φ hφ).Irrational := by
|
| 227 |
+
intro j hj hjs χ hne hcont hrat hnext hbr
|
| 228 |
+
exact (hirr j hj hjs χ hne hcont hrat hnext hbr).comp hφ.tendsto_atTop
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
theorem exists_irrational_fixed_residues
|
| 233 |
+
[PreconnectedSpace G] [LocallyCompactSpace G] [T2Space G] [DiscreteTopology Γ]
|
| 234 |
+
(hΓrat : Γ≤rationalSubgroup c)
|
| 235 |
+
(C : Set G) (hC : IsCompact C) (hreps : ∀ g : G,∃ x∈C,x⁻¹*g∈Γ)
|
| 236 |
+
(S : State c Γ s K P L) (hirr : S.Irrational) :
|
| 237 |
+
∃ (T : State c Γ s K P L) (d : ℕ) (σ : Fin d → G),
|
| 238 |
+
T.Irrational ∧ 0<d ∧ (∀ r,IsRational c (σ r)) ∧
|
| 239 |
+
∀ N z,∃ r : Fin d,(r.val:ℤ)=z%(d:ℤ) ∧
|
| 240 |
+
(QuotientGroup.mk (rightWord T.removals N z) : G⧸Γ)=QuotientGroup.mk (σ r) := by
|
| 241 |
+
obtain ⟨φ,d,σ,hφ,hd,hσ,he⟩:=rightWord_residues Γ hΓrat C hC hreps S.removals
|
| 242 |
+
refine ⟨S.reindex φ hφ,d,σ,S.irrational_reindex hirr φ hφ,hd,hσ,?_⟩
|
| 243 |
+
intro N z
|
| 244 |
+
change ∃ r : Fin d,(r.val:ℤ)=z%(d:ℤ) ∧
|
| 245 |
+
(QuotientGroup.mk (rightWord (S.removals.map (fun w=>w.reindex φ hφ)) N z) : G⧸Γ)=
|
| 246 |
+
QuotientGroup.mk (σ r)
|
| 247 |
+
rw [rightWord_reindex]
|
| 248 |
+
exact he N z
|
| 249 |
+
|
| 250 |
+
end State
|
| 251 |
+
end AllLevelStates
|
| 252 |
+
end
|
| 253 |
+
|
| 254 |
+
end
|
| 255 |
+
|
| 256 |
+
section
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
noncomputable section
|
| 262 |
+
open scoped BigOperators Topology
|
| 263 |
+
open Filter
|
| 264 |
+
namespace ParametricSmooth
|
| 265 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 266 |
+
variable {σ : Type*}
|
| 267 |
+
|
| 268 |
+
def family (p : Polynomial (MvPolynomial σ ℝ)) (t : σ → ℝ) : Polynomial ℝ :=
|
| 269 |
+
p.map (MvPolynomial.eval t)
|
| 270 |
+
|
| 271 |
+
def IsPolynomial (f : (σ → ℝ) → ℝ → ℝ) : Prop :=
|
| 272 |
+
∃ p : Polynomial (MvPolynomial σ ℝ),∀ t x,(family p t).eval x=f t x
|
| 273 |
+
|
| 274 |
+
lemma constant (a : ℝ) : IsPolynomial (fun (_ : σ → ℝ) _=>a) :=
|
| 275 |
+
⟨C (MvPolynomial.C a),by intro t x; simp [family]⟩
|
| 276 |
+
lemma coordinate : IsPolynomial (fun (_ : σ → ℝ) x=>x) :=
|
| 277 |
+
⟨X,by intro t x; simp [family]⟩
|
| 278 |
+
lemma parameter (i : σ) : IsPolynomial (fun (t : σ → ℝ) _=>t i) :=
|
| 279 |
+
⟨C (MvPolynomial.X i),by intro t x; simp [family]⟩
|
| 280 |
+
lemma add {f g : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) :
|
| 281 |
+
IsPolynomial (fun t x=>f t x+g t x) := by
|
| 282 |
+
obtain ⟨p,hp⟩:=hf
|
| 283 |
+
obtain ⟨q,hq⟩:=hg
|
| 284 |
+
refine ⟨p+q,?_⟩
|
| 285 |
+
intro t x
|
| 286 |
+
change ((p+q).map _).eval x=_
|
| 287 |
+
rw [Polynomial.map_add,eval_add]
|
| 288 |
+
exact congrArg₂ (·+·) (hp t x) (hq t x)
|
| 289 |
+
lemma mul {f g : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) :
|
| 290 |
+
IsPolynomial (fun t x=>f t x*g t x) := by
|
| 291 |
+
obtain ⟨p,hp⟩:=hf
|
| 292 |
+
obtain ⟨q,hq⟩:=hg
|
| 293 |
+
refine ⟨p*q,?_⟩
|
| 294 |
+
intro t x
|
| 295 |
+
change ((p*q).map _).eval x=_
|
| 296 |
+
rw [Polynomial.map_mul,eval_mul]
|
| 297 |
+
exact congrArg₂ (·*·) (hp t x) (hq t x)
|
| 298 |
+
lemma neg {f : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) :
|
| 299 |
+
IsPolynomial (fun t x=>-f t x) := by
|
| 300 |
+
simpa using mul (constant (-1)) hf
|
| 301 |
+
lemma sub {f g : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) (hg : IsPolynomial g) :
|
| 302 |
+
IsPolynomial (fun t x=>f t x-g t x) := by simpa [sub_eq_add_neg] using add hf (neg hg)
|
| 303 |
+
lemma pow {f : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) (k : ℕ) :
|
| 304 |
+
IsPolynomial (fun t x=>(f t x)^k) := by
|
| 305 |
+
induction k with
|
| 306 |
+
| zero => simpa using constant (σ:=σ) 1
|
| 307 |
+
| succ k ih => simpa [pow_succ] using mul ih hf
|
| 308 |
+
lemma finite_sum {ι : Type*} (S : Finset ι) {f : ι → (σ → ℝ) → ℝ → ℝ}
|
| 309 |
+
(hf : ∀ i∈S,IsPolynomial (f i)) : IsPolynomial (fun t x=>∑ i∈S,f i t x) := by
|
| 310 |
+
classical
|
| 311 |
+
induction S using Finset.induction_on with
|
| 312 |
+
| empty => simpa using constant (σ:=σ) 0
|
| 313 |
+
| @insert i S hi ih =>
|
| 314 |
+
simpa [Finset.sum_insert hi] using add (hf i (by simp)) (ih (fun j hj=>hf j (by simp [hj])))
|
| 315 |
+
lemma finite_prod {ι : Type*} (S : Finset ι) {f : ι → (σ → ℝ) → ℝ → ℝ}
|
| 316 |
+
(hf : ∀ i∈S,IsPolynomial (f i)) : IsPolynomial (fun t x=>∏ i∈S,f i t x) := by
|
| 317 |
+
classical
|
| 318 |
+
induction S using Finset.induction_on with
|
| 319 |
+
| empty => simpa using constant (σ:=σ) 1
|
| 320 |
+
| @insert i S hi ih =>
|
| 321 |
+
simpa [Finset.prod_insert hi] using mul (hf i (by simp)) (ih (fun j hj=>hf j (by simp [hj])))
|
| 322 |
+
lemma polynomial_eval (p : Polynomial ℝ) {f : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f) :
|
| 323 |
+
IsPolynomial (fun t x=>p.eval (f t x)) := by
|
| 324 |
+
simp only [Polynomial.eval_eq_sum_range]
|
| 325 |
+
exact finite_sum _ (fun i _=>mul (constant _) (pow hf i))
|
| 326 |
+
lemma mvpolynomial_eval {ι : Type*} (p : MvPolynomial ι ℚ)
|
| 327 |
+
{f : ι → (σ → ℝ) → ℝ → ℝ} (hf : ∀ i,IsPolynomial (f i)) :
|
| 328 |
+
IsPolynomial (fun t x=>MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun i=>f i t x) p) := by
|
| 329 |
+
induction p using MvPolynomial.induction_on with
|
| 330 |
+
| C a => simpa using constant (σ:=σ) (a:ℝ)
|
| 331 |
+
| add p q hp hq => simpa using add hp hq
|
| 332 |
+
| mul_X p i hp => simpa using mul hp (hf i)
|
| 333 |
+
|
| 334 |
+
lemma rename_parameters {τ : Type*} {f : (σ → ℝ) → ℝ → ℝ}
|
| 335 |
+
(hf : IsPolynomial f) (e : σ → τ) : IsPolynomial (fun t x=>f (t∘e) x) := by
|
| 336 |
+
obtain ⟨p,hp⟩:=hf
|
| 337 |
+
refine ⟨p.map (MvPolynomial.rename e).toRingHom,?_⟩
|
| 338 |
+
intro t x
|
| 339 |
+
have he : (MvPolynomial.eval t).comp (MvPolynomial.rename e).toRingHom=
|
| 340 |
+
MvPolynomial.eval (t∘e) := by
|
| 341 |
+
apply RingHom.ext
|
| 342 |
+
intro P
|
| 343 |
+
exact MvPolynomial.eval_rename e t P
|
| 344 |
+
simp only [family,Polynomial.map_map,he]
|
| 345 |
+
exact hp (t∘e) x
|
| 346 |
+
|
| 347 |
+
lemma continuous_eval (p : Polynomial (MvPolynomial σ ℝ)) :
|
| 348 |
+
Continuous (fun z : (σ → ℝ) × ℝ=>(family p z.1).eval z.2) := by
|
| 349 |
+
simp only [family,eval_map,eval₂_eq_sum_range]
|
| 350 |
+
apply continuous_finsetSum
|
| 351 |
+
intro i _
|
| 352 |
+
exact ((MvPolynomial.continuous_eval (p.coeff i)).comp continuous_fst).mul (continuous_snd.pow i)
|
| 353 |
+
|
| 354 |
+
lemma derivative_family (p : Polynomial (MvPolynomial σ ℝ)) (t : σ → ℝ) (k : ℕ) :
|
| 355 |
+
derivative^[k] (family p t)=family (derivative^[k] p) t := by
|
| 356 |
+
induction k generalizing p with
|
| 357 |
+
| zero => rfl
|
| 358 |
+
| succ k ih =>
|
| 359 |
+
rw [Function.iterate_succ_apply,Function.iterate_succ_apply]
|
| 360 |
+
rw [show derivative (family p t)=family p.derivative t from derivative_map p _]
|
| 361 |
+
exact ih p.derivative
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
|
| 365 |
+
theorem compact_derivative_limit [Fintype σ] {ι : Type*} {l : Filter ι}
|
| 366 |
+
{f : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f)
|
| 367 |
+
{a : ι → σ → ℝ} {a₀ : σ → ℝ} (ha : Tendsto a l (𝓝 a₀))
|
| 368 |
+
(k : ℕ) (K : Set ℝ) (hK : IsCompact K) :
|
| 369 |
+
TendstoUniformlyOn (fun N=>iteratedDeriv k (f (a N))) (iteratedDeriv k (f a₀)) l K := by
|
| 370 |
+
obtain ⟨p,hp⟩:=hf
|
| 371 |
+
have he (t : σ → ℝ) : f t=fun x=>(family p t).eval x:=funext (fun x=>(hp t x).symm)
|
| 372 |
+
simp_rw [he,SmoothBinomial.iteratedDeriv_eval,derivative_family]
|
| 373 |
+
let : CompactSpace K:=isCompact_iff_compactSpace.mp hK
|
| 374 |
+
let F : (σ → ℝ) → K → ℝ:=fun t x=>(family (derivative^[k] p) t).eval x.val
|
| 375 |
+
have hF : Continuous (Function.uncurry F):=
|
| 376 |
+
(continuous_eval (derivative^[k] p)).comp
|
| 377 |
+
(continuous_fst.prodMk (continuous_subtype_val.comp continuous_snd))
|
| 378 |
+
have hu:=hF.tendstoUniformly F a₀
|
| 379 |
+
rw [tendstoUniformlyOn_iff_tendstoUniformly_comp_coe]
|
| 380 |
+
intro u hu'
|
| 381 |
+
exact ha.eventually (hu u hu')
|
| 382 |
+
|
| 383 |
+
|
| 384 |
+
|
| 385 |
+
theorem compact_derivative_bound {f : (σ → ℝ) → ℝ → ℝ} (hf : IsPolynomial f)
|
| 386 |
+
{a : ℕ → σ → ℝ} {a₀ : σ → ℝ} (ha : Tendsto a atTop (𝓝 a₀))
|
| 387 |
+
(k : ℕ) (K : Set ℝ) (hK : IsCompact K) :
|
| 388 |
+
∃ B>0,∀ N x,x∈K → |iteratedDeriv k (f (a N)) x|≤B := by
|
| 389 |
+
obtain ⟨p,hp⟩:=hf
|
| 390 |
+
have he (t : σ → ℝ) : f t=fun x=>(family p t).eval x:=funext (fun x=>(hp t x).symm)
|
| 391 |
+
obtain ⟨M,hM⟩:=(ha.isCompact_insert_range.prod hK).exists_bound_of_continuousOn
|
| 392 |
+
(continuous_eval (derivative^[k] p)).continuousOn
|
| 393 |
+
refine ⟨max M 0+1,by positivity,?_⟩
|
| 394 |
+
intro N x hx
|
| 395 |
+
rw [he,SmoothBinomial.iteratedDeriv_eval,derivative_family]
|
| 396 |
+
have hb:=hM (a N,x) ⟨Set.mem_insert_of_mem _ (Set.mem_range_self N),hx⟩
|
| 397 |
+
have hb' : |(family (derivative^[k] p) (a N)).eval x|≤M:=by
|
| 398 |
+
simpa only [Real.norm_eq_abs] using hb
|
| 399 |
+
exact hb'.trans (by linarith [le_max_left M 0])
|
| 400 |
+
|
| 401 |
+
end ParametricSmooth
|
| 402 |
+
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.AllLevel09
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
section
|
| 9 |
+
noncomputable section
|
| 10 |
+
open MeasureTheory Topology
|
| 11 |
+
end
|
| 12 |
+
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
noncomputable section
|
| 16 |
+
open Filter
|
| 17 |
+
open scoped Topology BigOperators
|
| 18 |
+
namespace SourcePhysicalDecay
|
| 19 |
+
open RoughSamplingWeights FinitePieceAverages
|
| 20 |
+
variable {Y : Type} [TopologicalSpace Y] {v : ℕ}
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def AllBoxes (Z : ℕ→ℝ) (state : ℕ→(Fin v→ℤ)→Y) (S : C(Y,Y)) : Prop :=
|
| 24 |
+
∀ (d : ℕ),0<d → ∀ (c C : ℝ),0<c →0<C →
|
| 25 |
+
∀ (lo hi : ℕ→Fin v→ℝ) (res : ℕ→Fin v→ℤ),
|
| 26 |
+
(∀ᶠ N in atTop,(∀ i,c*Z N≤hi N i-lo N i) ∧
|
| 27 |
+
(∀ i,-C*Z N≤lo N i ∧ hi N i≤C*Z N)) →
|
| 28 |
+
∀ f : C(Y,ℂ),Tendsto (fun N=>mean (physicalResidueBox (lo N) (hi N) (res N) d)
|
| 29 |
+
(fun b=>f (S (state N b)))-mean (physicalResidueBox (lo N) (hi N) (res N) d)
|
| 30 |
+
(fun b=>f (state N b))) atTop (𝓝 0)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
theorem allBoxes_subsequence (Z : ℕ→ℝ) (hZ : ∀ N,0≤Z N)
|
| 35 |
+
(state : ℕ→(Fin v→ℤ)→Y) (S : C(Y,Y))
|
| 36 |
+
(h : AllBoxes Z state S) (ψ : ℕ→ℕ) (hψ : StrictMono ψ) :
|
| 37 |
+
AllBoxes (Z∘ψ) (state∘ψ) S
|
| 38 |
+
:= by
|
| 39 |
+
classical
|
| 40 |
+
intro d hd c C hc hC lo hi res hb f
|
| 41 |
+
let lo' := Function.extend ψ lo (fun N (_ : Fin v)=>-(c+C)*Z N)
|
| 42 |
+
let hi' := Function.extend ψ hi (fun N (_ : Fin v)=>(c+C)*Z N)
|
| 43 |
+
let res' := Function.extend ψ res (fun _ (_ : Fin v)=>0)
|
| 44 |
+
have hlo (k : ℕ) : lo' (ψ k)=lo k := hψ.injective.extend_apply _ _ _
|
| 45 |
+
have hhi (k : ℕ) : hi' (ψ k)=hi k := hψ.injective.extend_apply _ _ _
|
| 46 |
+
have hres (k : ℕ) : res' (ψ k)=res k := hψ.injective.extend_apply _ _ _
|
| 47 |
+
have hb' : ∀ᶠ N in atTop,(∀ i,c*Z N≤hi' N i-lo' N i) ∧
|
| 48 |
+
(∀ i,-(c+C)*Z N≤lo' N i ∧ hi' N i≤(c+C)*Z N) := by
|
| 49 |
+
obtain ⟨N₀,hN₀⟩ := eventually_atTop.mp hb
|
| 50 |
+
apply eventually_atTop.mpr
|
| 51 |
+
refine ⟨ψ N₀,fun N hN=>?_⟩
|
| 52 |
+
by_cases hn : ∃ k,ψ k=N
|
| 53 |
+
· obtain ⟨k,rfl⟩:=hn
|
| 54 |
+
have hk:=hN₀ k (hψ.le_iff_le.mp hN)
|
| 55 |
+
rw [hlo,hhi]
|
| 56 |
+
refine ⟨hk.1,fun i=>?_⟩
|
| 57 |
+
have hz:=hZ (ψ k)
|
| 58 |
+
have hcz:=mul_nonneg hc.le hz
|
| 59 |
+
constructor <;> dsimp only [Function.comp_apply] at hk
|
| 60 |
+
· nlinarith [(hk.2 i).1]
|
| 61 |
+
· nlinarith [(hk.2 i).2]
|
| 62 |
+
· have hl : lo' N=(fun _ : Fin v=>-(c+C)*Z N) := Function.extend_apply' _ _ _ hn
|
| 63 |
+
have hr : hi' N=(fun _ : Fin v=>(c+C)*Z N) := Function.extend_apply' _ _ _ hn
|
| 64 |
+
rw [hl,hr]
|
| 65 |
+
refine ⟨fun _=>?_,fun _=>⟨le_rfl,le_rfl⟩⟩
|
| 66 |
+
have hz:=hZ N
|
| 67 |
+
have hc':=mul_nonneg hc.le hz
|
| 68 |
+
have hC':=mul_nonneg hC.le hz
|
| 69 |
+
nlinarith
|
| 70 |
+
have hh:=(h d hd c (c+C) hc (add_pos hc hC) lo' hi' res' hb' f).comp hψ.tendsto_atTop
|
| 71 |
+
simpa only [Function.comp_def,hlo,hhi,hres] using hh
|
| 72 |
+
|
| 73 |
+
end SourcePhysicalDecay
|
| 74 |
+
end
|
| 75 |
+
|
| 76 |
+
noncomputable section
|
| 77 |
+
open MeasureTheory Filter
|
| 78 |
+
open scoped Topology BigOperators
|
| 79 |
+
namespace SourcePhysicalDecay
|
| 80 |
+
attribute [local instance] Classical.propDecidable
|
| 81 |
+
open RoughSamplingWeights FinitePieceAverages CubeLocalHaar
|
| 82 |
+
lemma physical_box_eq_rectangle {v : ℕ} (lo hi : Fin v→ℝ) (a : Fin v→ℤ) (d : ℕ)
|
| 83 |
+
(ha : ∀ i,0≤a i ∧ a i<(d:ℤ)) :
|
| 84 |
+
physicalResidueBox lo hi a d=physicalResidueRectangle lo hi a d := by
|
| 85 |
+
classical
|
| 86 |
+
ext b
|
| 87 |
+
simp only [physicalResidueBox,Finset.mem_filter,mem_boxIndices _ _ _ _ zero_lt_one,
|
| 88 |
+
physicalResidueRectangle_mem,zero_add,one_mul,Int.ModEq,Int.emod_eq_of_lt (ha _).1 (ha _).2]
|
| 89 |
+
|
| 90 |
+
lemma mean_eq_expect {α : Type*} (s : Finset α) (f : α→ℂ) : mean s f=𝔼 x∈s,f x := by
|
| 91 |
+
rw [mean,Finset.expect_eq_sum_div_card,div_eq_mul_inv,mul_comm]
|
| 92 |
+
|
| 93 |
+
lemma mean_ofReal {α : Type*} (s : Finset α) (f : α→ℝ) :
|
| 94 |
+
mean s (fun x=>(f x:ℂ))=((𝔼 x∈s,f x : ℝ):ℂ) := by
|
| 95 |
+
rw [mean_eq_expect]
|
| 96 |
+
exact (map_expect (Complex.ofRealCLM.toLinearMap.restrictScalars ℚ≥0) f s).symm
|
| 97 |
+
end SourcePhysicalDecay
|
| 98 |
+
end
|
| 99 |
+
noncomputable section
|
| 100 |
+
open MeasureTheory Filter
|
| 101 |
+
open scoped Topology BigOperators
|
| 102 |
+
namespace SourcePhysicalDecay
|
| 103 |
+
open RationalLattice CubeFaces CubeTaylorExpansion CubeLocalHaar RoughSamplingWeights FinitePieceAverages
|
| 104 |
+
open AllLevelFactorization AllLevelFactorization.Factorization AllLevelFactorization.Factorization.ResidueCover
|
| 105 |
+
variable {G ι : Type} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 106 |
+
variable [Fintype ι] [DecidableEq ι]
|
| 107 |
+
variable {n s : ℕ} {c : RealCoordinates G n} {Γ : Subgroup G}
|
| 108 |
+
variable {K : Filtration G} {P : ℕ→ℤ→G} {L : ℕ→ℝ}
|
| 109 |
+
variable {F : Factorization c Γ s K P L} {r : Fin F.period} (C : F.ResidueCover r)
|
| 110 |
+
variable [MeasurableSpace (C.CubeSpace (ι:=ι))] [BorelSpace (C.CubeSpace (ι:=ι))]
|
| 111 |
+
variable [CompactSpace (G⧸Γ)] [MeasurableSpace (G⧸Γ)] [BorelSpace (G⧸Γ)]
|
| 112 |
+
variable [SecondCountableTopology (G⧸Γ)]
|
| 113 |
+
variable {Y : Type} [TopologicalSpace Y] [MeasurableSpace Y] [BorelSpace Y]
|
| 114 |
+
variable [CompactSpace Y] [HasOuterApproxClosed Y]
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
omit [CompactSpace (G⧸Γ)] [CompactSpace Y] in
|
| 118 |
+
theorem haar_invariant_of_allBoxes (hL : ∀ N,0<L N) (ht : Tendsto L atTop atTop)
|
| 119 |
+
{v : ℕ} (e : Option ι≃Fin v) (π : C((Finset ι→G⧸Γ),Y)) (S : C(Y,Y))
|
| 120 |
+
(h : AllBoxes L (fun N b=>π (fun w=>QuotientGroup.mk (P N (vertex (fun i=>b (e i)) w)))) S)
|
| 121 |
+
(d : ℕ) (hd : 0<d) (a : Fin v→ℤ) (ha : ∀ i,0≤a i ∧ a i<(d:ℤ))
|
| 122 |
+
(hdp : F.period∣d) (ha0 : a (e none)%(F.period:ℤ)=(r.val:ℤ))
|
| 123 |
+
(hai : ∀ i,a (e (some i))%(F.period:ℤ)=0)
|
| 124 |
+
(lo hi : ℝ→ℕ→Fin v→ℝ)
|
| 125 |
+
(hb : ∀ α : ℝ,0<α →∃ c₀ C₀ : ℝ,0<c₀ ∧ 0<C₀ ∧ ∀ᶠ N in atTop,
|
| 126 |
+
(∀ i,c₀*L (F.state.subseq N)≤hi α N i-lo α N i) ∧
|
| 127 |
+
(∀ i,-C₀*L (F.state.subseq N)≤lo α N i ∧ hi α N i≤C₀*L (F.state.subseq N)))
|
| 128 |
+
(β B : ℝ)
|
| 129 |
+
(hgeo : ∀ α : ℝ,0<α →∀ᶠ N in atTop,
|
| 130 |
+
∀ b∈physicalResidueRectangle (lo α N) (hi α N) a d,∀ w : Finset ι,
|
| 131 |
+
dist ((vertex (fun i=>b (e i)) w:ℝ)/L (F.state.subseq N)) β≤B*α) :
|
| 132 |
+
Measure.map S (C.marginalCubeHaar β π : Measure Y)=(C.marginalCubeHaar β π : Measure Y)
|
| 133 |
+
:= by
|
| 134 |
+
apply C.marginal_haar_invariant hL ht e d hd a ha hdp ha0 hai lo hi hb β B hgeo π S
|
| 135 |
+
intro α hα f
|
| 136 |
+
obtain ⟨c₀,C₀,hc₀,hC₀,hbα⟩ := hb α hα
|
| 137 |
+
let ff : C(Y,ℂ):=⟨fun y=>(f y:ℂ),Complex.continuous_ofReal.comp f.continuous⟩
|
| 138 |
+
have hh:=(allBoxes_subsequence L (fun N=>(hL N).le) _ S h F.state.subseq F.state.strictmono)
|
| 139 |
+
d hd c₀ C₀ hc₀ hC₀ (lo α) (hi α) (fun _=>a) hbα ff
|
| 140 |
+
have he (N : ℕ) :
|
| 141 |
+
(mean (physicalResidueBox (lo α N) (hi α N) a d)
|
| 142 |
+
(fun b=>ff (S (π (fun w=>QuotientGroup.mk
|
| 143 |
+
(P (F.state.subseq N) (vertex (fun i=>b (e i)) w))))))-
|
| 144 |
+
mean (physicalResidueBox (lo α N) (hi α N) a d)
|
| 145 |
+
(fun b=>ff (π (fun w=>QuotientGroup.mk
|
| 146 |
+
(P (F.state.subseq N) (vertex (fun i=>b (e i)) w))))))=
|
| 147 |
+
((marginalBoxAverage (F:=F) e d a lo hi π α N (f.comp S)-
|
| 148 |
+
marginalBoxAverage (F:=F) e d a lo hi π α N f:ℝ):ℂ) := by
|
| 149 |
+
rw [physical_box_eq_rectangle _ _ _ _ ha]
|
| 150 |
+
dsimp only [ff,ContinuousMap.coe_mk]
|
| 151 |
+
rw [mean_ofReal,mean_ofReal,←Complex.ofReal_sub]
|
| 152 |
+
rfl
|
| 153 |
+
have hn:=hh.norm
|
| 154 |
+
simpa only [Function.comp_apply,he,norm_zero,Complex.norm_real,Real.norm_eq_abs] using hn
|
| 155 |
+
|
| 156 |
+
end SourcePhysicalDecay
|
| 157 |
+
end
|
| 158 |
+
|
| 159 |
+
noncomputable section
|
| 160 |
+
open MeasureTheory Filter
|
| 161 |
+
open scoped Topology BigOperators
|
| 162 |
+
namespace SourcePhysicalDecay
|
| 163 |
+
open RationalLattice AllLevelFactorization AllLevelFactorization.Factorization
|
| 164 |
+
open CubeFaces CubeLocalHaar PhysicalCubeMaps SourceIntegerArrays
|
| 165 |
+
attribute [local instance] Classical.propDecidable
|
| 166 |
+
variable {Y : Type} [TopologicalSpace Y]
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
def AllCompatibleHaar (L : ℕ→ℝ) (state : ℕ→ℤ→Y) (v : ℕ) (j : Fin v) (S : C(Y,Y)) : Prop :=
|
| 170 |
+
letI : MeasurableSpace (Finset (Fin v)→Y):=borel _
|
| 171 |
+
letI : BorelSpace (Finset (Fin v)→Y):=⟨rfl⟩
|
| 172 |
+
∀ (H : Type) [Group H] [TopologicalSpace H] [IsTopologicalGroup H],
|
| 173 |
+
∀ (n s : ℕ) (c : RealCoordinates H n) (Λ : Subgroup H)
|
| 174 |
+
[CompactSpace (H⧸Λ)] [SecondCountableTopology (H⧸Λ)],
|
| 175 |
+
letI : MeasurableSpace (H⧸Λ):=borel _
|
| 176 |
+
letI : BorelSpace (H⧸Λ):=⟨rfl⟩
|
| 177 |
+
∀ (K : Filtration H) (P : ℕ→ℤ→H) (F : Factorization c Λ s K P L)
|
| 178 |
+
(p : C(H⧸Λ,Y)), (∀ N b,p (QuotientGroup.mk (P N b))=state N b) →
|
| 179 |
+
∀ (r : Fin F.period) (C : F.ResidueCover r),
|
| 180 |
+
letI : MeasurableSpace (C.CubeSpace (ι:=Fin v)):=borel _
|
| 181 |
+
letI : BorelSpace (C.CubeSpace (ι:=Fin v)):=⟨rfl⟩
|
| 182 |
+
∀ (d : ℕ),0<d → ∀ (a : Fin (v+1)→ℤ),
|
| 183 |
+
(∀ i,0≤a i ∧ a i<(d:ℤ)) → F.period∣d → a 0%(F.period:ℤ)=(r.val:ℤ) →
|
| 184 |
+
(∀ i : Fin v,a i.succ%(F.period:ℤ)=0) →
|
| 185 |
+
∀ (lo hi : ℝ→ℕ→Fin (v+1)→ℝ),
|
| 186 |
+
(∀ α : ℝ,0<α →∃ c₀ C₀ : ℝ,0<c₀ ∧ 0<C₀ ∧ ∀ᶠ N in atTop,
|
| 187 |
+
(∀ i,c₀*L (F.state.subseq N)≤hi α N i-lo α N i) ∧
|
| 188 |
+
(∀ i,-C₀*L (F.state.subseq N)≤lo α N i ∧ hi α N i≤C₀*L (F.state.subseq N))) →
|
| 189 |
+
∀ (β B : ℝ),
|
| 190 |
+
(∀ α : ℝ,0<α →∀ᶠ N in atTop,
|
| 191 |
+
∀ b∈physicalResidueRectangle (lo α N) (hi α N) a d,∀ w : Finset (Fin v),
|
| 192 |
+
dist ((cubeVertex v b w:ℝ)/L (F.state.subseq N)) β≤B*α) →
|
| 193 |
+
Measure.map (upperFace j S) (C.marginalCubeHaar (ι:=Fin v) β (vertices (ι:=Fin v) p) : Measure (Finset (Fin v)→Y))=
|
| 194 |
+
(C.marginalCubeHaar (ι:=Fin v) β (vertices (ι:=Fin v) p) : Measure (Finset (Fin v)→Y))
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
theorem compatible_haar_of_allBoxes [CompactSpace Y] [TopologicalSpace.MetrizableSpace Y]
|
| 199 |
+
(L : ℕ→ℝ) (hL : ∀ N,0<L N) (hLt : Tendsto L atTop atTop)
|
| 200 |
+
(state : ℕ→ℤ→Y) (v : ℕ) (j : Fin v) (S : C(Y,Y))
|
| 201 |
+
(h : AllBoxes L (fun N b w=>state N (cubeVertex v b w)) (upperFace j S)) :
|
| 202 |
+
AllCompatibleHaar L state v j S
|
| 203 |
+
:= by
|
| 204 |
+
classical
|
| 205 |
+
intro H _ _ _ n s c Λ _ _
|
| 206 |
+
let : MeasurableSpace (H⧸Λ):=borel _
|
| 207 |
+
let : BorelSpace (H⧸Λ):=⟨rfl⟩
|
| 208 |
+
intro K P F p hp r C
|
| 209 |
+
let : MeasurableSpace (Finset (Fin v)→Y):=borel _
|
| 210 |
+
let : BorelSpace (Finset (Fin v)→Y):=⟨rfl⟩
|
| 211 |
+
let : MeasurableSpace (C.CubeSpace (ι:=Fin v)):=borel _
|
| 212 |
+
let : BorelSpace (C.CubeSpace (ι:=Fin v)):=⟨rfl⟩
|
| 213 |
+
intro d hd a ha hdp ha0 hai lo hi hb β B hgeo
|
| 214 |
+
let e : Option (Fin v)≃Fin (v+1):=(finSuccEquiv v).symm
|
| 215 |
+
have he (b : Fin (v+1)→ℤ) (w : Finset (Fin v)) :
|
| 216 |
+
vertex (fun i=>b (e i)) w=cubeVertex v b w := by simp [vertex,cubeVertex,e]
|
| 217 |
+
have hh : AllBoxes L (fun N b=>vertices p
|
| 218 |
+
(fun w=>QuotientGroup.mk (P N (vertex (fun i=>b (e i)) w)))) (upperFace j S) := by
|
| 219 |
+
have heq : (fun N b=>vertices p (fun w=>QuotientGroup.mk
|
| 220 |
+
(P N (vertex (fun i=>b (e i)) w))))=(fun N b w=>state N (cubeVertex v b w)) := by
|
| 221 |
+
funext N b w
|
| 222 |
+
simp only [vertices_apply,he,hp]
|
| 223 |
+
rw [heq]
|
| 224 |
+
exact h
|
| 225 |
+
apply haar_invariant_of_allBoxes C hL hLt e (vertices p) (upperFace j S) hh d hd a ha hdp
|
| 226 |
+
(by simpa [e] using ha0) (by simpa [e] using hai) lo hi hb β B
|
| 227 |
+
simpa only [he] using hgeo
|
| 228 |
+
|
| 229 |
+
end SourcePhysicalDecay
|
| 230 |
+
end
|
| 231 |
+
|
| 232 |
+
noncomputable section
|
| 233 |
+
namespace SourceIntegerArrays
|
| 234 |
+
open RoughArrayFace
|
| 235 |
+
open RationalLattice MalcevCharacters RoughFaceShift RoughTopologicalFace RoughArrayCoordinates SourceResidueAlignment
|
| 236 |
+
open RoughScales RoughSamplingWeights FinitePieceAverages RoughSourceExceptional RoughProductRemoval
|
| 237 |
+
open ProductExposureLabels ProductExposureLaw ProductExposureCutoff MeasureTheory Filter
|
| 238 |
+
open scoped BigOperators Topology ENNReal
|
| 239 |
+
attribute [local instance] Classical.propDecidable
|
| 240 |
+
variable {τ : Type} [Fintype τ] {ι : τ→Type} [∀ t,Fintype (ι t)]
|
| 241 |
+
variable (G : ∀ t,ι t→Type) [∀ t i,Group (G t i)]
|
| 242 |
+
variable [∀ t i,TopologicalSpace (G t i)] [∀ t i,IsTopologicalGroup (G t i)]
|
| 243 |
+
variable (n : ∀ t,ι t→ℕ) (q : τ→ℕ) (c : ∀ t i,RealCoordinates (G t i) (n t i))
|
| 244 |
+
variable (hsk : ∀ t i,SecondKind (c t i)) (A : ∀ t i,CubeFaces.Filtration (G t i))
|
| 245 |
+
variable (w : ∀ t i,Fin (n t i)→ℕ)
|
| 246 |
+
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)
|
| 247 |
+
variable (hw : ∀ t i j,0<w t i j) (Γ : ∀ t i,Subgroup (G t i))
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
theorem source_global_literal_haar
|
| 251 |
+
(hΓ : ∀ t i g,g∈Γ t i ↔ ∀ j,∃ z : ℤ,(c t i).coord g j=z)
|
| 252 |
+
(a : ℕ) (m h v : τ→ℕ) (perm : ∀ t,Fin (m t+h t)≃Fin a)
|
| 253 |
+
(w0 M Xp : ℕ→ℕ) (X : ℕ→Fin a→ℕ) (R Q : ℕ→ℝ) (L : ℕ→ℤ)
|
| 254 |
+
(hw0 : Tendsto w0 atTop atTop)
|
| 255 |
+
(hX : ∀ N j,4*primorial (w0 N)≤X N j) (hXp : ∀ N,4*primorial (w0 N)≤Xp N)
|
| 256 |
+
(hXt : ∀ j,Tendsto (fun N=>X N j) atTop atTop) (hXpt : Tendsto Xp atTop atTop)
|
| 257 |
+
(hR : ∀ N,0<R N) (hRX : Tendsto (fun N=>R N/(Xp N:ℝ)) atTop (𝓝 0))
|
| 258 |
+
(hZ : ∀ t (u : ℝ),0<u →Tendsto (fun N=>(R N/(M N:ℝ))/
|
| 259 |
+
(1+∑ j : Fin (m t),(X N (perm t (j.castAdd (h t))):ℝ)^2)^u) atTop atTop)
|
| 260 |
+
(hQ0 : ∀ N,0≤Q N)
|
| 261 |
+
(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))
|
| 262 |
+
(hWM : ∀ N,(primorial (w0 N):ℤ)∣(M N:ℤ))
|
| 263 |
+
(hM : ∀ N,0<M N) (hMs : ∀ N,Smooth (w0 N) (M N:ℤ))
|
| 264 |
+
(hL : ∀ N,0<L N) (hsm : ∀ N,Smooth (w0 N) (L N))
|
| 265 |
+
(hWL : ∀ N,(primorial (w0 N):ℤ)∣L N) (hML : ∀ N,(M N:ℤ)∣L N)
|
| 266 |
+
(hLexact : ∀ N,L N=(M N:ℤ)*(primorial (w0 N):ℤ)^(w0 N))
|
| 267 |
+
(hXL : ∀ t (j : Fin (m t)),Tendsto (fun N=>(X N (perm t (j.castAdd (h t))):ℝ)/(L N:ℝ)) atTop atTop)
|
| 268 |
+
(g x : ∀ t,ℕ→(Fin (h t)→ℕ)→Label (m t)→∀ i,G t i)
|
| 269 |
+
(slot : ∀ t,ℕ→(Fin (h t)→ℕ)→Label (m t)→ι t→ℤ)
|
| 270 |
+
(qval : ∀ t,ℕ→(Fin (h t)→ℕ)→Label (m t)→Fin (q t)→ℤ)
|
| 271 |
+
(hQ : ∀ t N y,y∈outsideDomain (fun l : Fin (h t)=>X N (perm t (l.natAdd (m t)))) (primorial (w0 N)) →
|
| 272 |
+
∀ b,b∈(fullDomain (fun l : Fin (m t)=>X N (perm t (l.castAdd (h t)))) (Xp N) (primorial (w0 N))).image
|
| 273 |
+
(expose (L N) (M N:ℤ) (R N)) →∀ k,|(qval t N y b k:ℝ)|≤Q N)
|
| 274 |
+
(E : ℕ→Set ((Fin a→ℕ)×ℕ)) (ε : ℝ≥0∞) (hε : 0<ε)
|
| 275 |
+
(hE : ∀ N,ε≤(jointLaw (X N) (Xp N) (primorial (w0 N)) (primorial_pos _)
|
| 276 |
+
(hX N) (hXp N)) (E N)) :
|
| 277 |
+
∃ φ : ℕ→ℕ,StrictMono φ ∧ ∃ z : ℕ→(Fin a→ℕ)×ℕ,
|
| 278 |
+
(∀ k,z k∈E (φ k) ∧ z k∈fullDomain (X (φ k)) (Xp (φ k)) (primorial (w0 (φ k)))) ∧
|
| 279 |
+
∀ t,
|
| 280 |
+
let zout := fun k l=>(z k).1 (perm t (l.natAdd (m t)))
|
| 281 |
+
let zin := fun k=>((fun l=>(z k).1 (perm t (l.castAdd (h t)))),(z k).2)
|
| 282 |
+
let label := fun k=>expose (L (φ k)) (M (φ k):ℤ) (R (φ k)) (zin k)
|
| 283 |
+
let Z := fun k=>R (φ k)/(M (φ k):ℝ)
|
| 284 |
+
∀ (e : Fin (q t)) (j : Fin (v t)) (pstar : ℕ→ℤ),
|
| 285 |
+
(∀ k,(M (φ k):ℤ)∣pstar k-((z k).2:ℤ)) →
|
| 286 |
+
(∀ k,|(pstar k:ℝ)-((z k).2:ℝ)|≤R (φ k)) →
|
| 287 |
+
let state := fun k b=>QuotientGroup.mk
|
| 288 |
+
(literalState (G t) (n t) (q t) (c t) (hsk t) (A t) (w t) (hA t) (hw t)
|
| 289 |
+
(M (φ k)) (L (φ k)) (label k) (fun l=>((zin k).1 l:ℤ)) (pstar k)
|
| 290 |
+
(fun _ (_ : Fin 1)=>1)
|
| 291 |
+
(g t (φ k) (zout k) (label k)) (x t (φ k) (zout k) (label k))
|
| 292 |
+
(slot t (φ k) (zout k) (label k)) (qval t (φ k) (zout k) (label k)) (fun _=>b))
|
| 293 |
+
SourcePhysicalDecay.AllCompatibleHaar Z state (v t) j
|
| 294 |
+
(faceAction (G t) (n t) (q t) (c t) (hsk t) (A t) (w t) (hA t) (Γ t)
|
| 295 |
+
(fun _ (_ : Fin 1)=>1) e 0)
|
| 296 |
+
:= by
|
| 297 |
+
classical
|
| 298 |
+
obtain ⟨φ,hφ,z,hz,hgood⟩:=source_global_literal_cube_faces G n q c hsk A w hA hw Γ hΓ
|
| 299 |
+
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
|
| 300 |
+
hL hsm hWL hML hLexact hXL g x slot qval hQ E ε hε hE
|
| 301 |
+
refine ⟨φ,hφ,z,hz,?_⟩
|
| 302 |
+
intro t
|
| 303 |
+
dsimp only
|
| 304 |
+
intro e j pstar hpstar hpclose
|
| 305 |
+
let Y := (Carrier (G t) (n t) (q t) (c t) (hsk t) (A t) (w t) (hA t))⧸
|
| 306 |
+
lattice (G t) (n t) (q t) (c t) (hsk t) (A t) (w t) (hA t) (Γ t)
|
| 307 |
+
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)
|
| 308 |
+
let : CompactSpace Y:=htop.2.2.1
|
| 309 |
+
let : TopologicalSpace.MetrizableSpace Y:=htop.2.2.2
|
| 310 |
+
have hZpos (N : ℕ) : 0<R N/(M N:ℝ):=div_pos (hR N) (by exact_mod_cast hM N)
|
| 311 |
+
have hZT : Tendsto (fun N=>R N/(M N:ℝ)) atTop atTop := by
|
| 312 |
+
have ht : Tendsto (fun N=>(R N/(M N:ℝ))/
|
| 313 |
+
(1+∑ j : Fin (m t),(X N (perm t (j.castAdd (h t))):ℝ)^2)) atTop atTop := by
|
| 314 |
+
simpa only [Real.rpow_one] using hZ t 1 zero_lt_one
|
| 315 |
+
apply tendsto_atTop.mpr
|
| 316 |
+
intro B
|
| 317 |
+
filter_upwards [ht.eventually (eventually_ge_atTop B)] with N hN
|
| 318 |
+
apply hN.trans
|
| 319 |
+
apply div_le_self (hZpos N).le
|
| 320 |
+
have hn : 0≤∑ j : Fin (m t),(X N (perm t (j.castAdd (h t))):ℝ)^2:=
|
| 321 |
+
Finset.sum_nonneg (fun _ _=>sq_nonneg _)
|
| 322 |
+
linarith
|
| 323 |
+
apply SourcePhysicalDecay.compatible_haar_of_allBoxes _ (fun k=>hZpos (φ k))
|
| 324 |
+
(hZT.comp hφ.tendsto_atTop)
|
| 325 |
+
intro d hd c₀ C₀ hc₀ hC₀ lo hi res hbox F
|
| 326 |
+
exact hgood t e j d hd pstar hpstar hpclose c₀ C₀ hc₀ hC₀ lo hi res hbox F
|
| 327 |
+
|
| 328 |
+
end SourceIntegerArrays
|
| 329 |
+
|
| 330 |
+
end
|
| 331 |
+
|
| 332 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PivotExtension01.lean
ADDED
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+
namespace OAI
|
| 7 |
+
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
section
|
| 10 |
+
|
| 11 |
+
noncomputable section
|
| 12 |
+
namespace SourceJointShift
|
| 13 |
+
open MeasureTheory Filter Topology ProductExposureLaw RawHarmonicProbability
|
| 14 |
+
open scoped BigOperators ENNReal
|
| 15 |
+
attribute [local instance] Classical.propDecidable
|
| 16 |
+
|
| 17 |
+
private lemma raw_eval_nat (X W : ℕ) (f : ℤ→ℝ) :
|
| 18 |
+
HarmonicTranslation.eval (HarmonicTranslation.raw X W) f =
|
| 19 |
+
∑ n∈Finset.Ico X (X^2),if W.Coprime n then (n:ℝ)⁻¹*f (n:ℤ) else 0 := by
|
| 20 |
+
have hs : (HarmonicTranslation.raw X W).support ⊆ Finset.Ico (X:ℤ) ((X:ℤ)^2) := by
|
| 21 |
+
intro n hn
|
| 22 |
+
have hh:=Finsupp.mem_support_iff.mp hn
|
| 23 |
+
rw [HarmonicTranslation.raw_apply] at hh
|
| 24 |
+
split_ifs at hh with h
|
| 25 |
+
· exact Finset.mem_Ico.mpr ⟨h.1,h.2.1⟩
|
| 26 |
+
· exact (hh rfl).elim
|
| 27 |
+
rw [HarmonicTranslation.eval,(HarmonicTranslation.raw X W).sum_of_support_subset hs
|
| 28 |
+
(fun n a=>a*f n) (by simp)]
|
| 29 |
+
symm
|
| 30 |
+
apply Finset.sum_bij (fun (n:ℕ) _=>(n:ℤ))
|
| 31 |
+
· intro n hn
|
| 32 |
+
rcases Finset.mem_Ico.mp hn with ⟨hn1,hn2⟩
|
| 33 |
+
exact Finset.mem_Ico.mpr ⟨by exact_mod_cast hn1,by exact_mod_cast hn2⟩
|
| 34 |
+
· intro n hn k hk he
|
| 35 |
+
exact_mod_cast he
|
| 36 |
+
· intro z hz
|
| 37 |
+
rcases Finset.mem_Ico.mp hz with ⟨hz1,hz2⟩
|
| 38 |
+
have hz0 : 0≤z := (Int.natCast_nonneg X).trans hz1
|
| 39 |
+
refine ⟨z.toNat,Finset.mem_Ico.mpr ⟨?_,?_⟩,Int.toNat_of_nonneg hz0⟩
|
| 40 |
+
· have ht : (X:ℤ)≤(z.toNat:ℤ) := by rwa [Int.toNat_of_nonneg hz0]
|
| 41 |
+
exact_mod_cast ht
|
| 42 |
+
· apply (Int.toNat_lt hz0).mpr
|
| 43 |
+
exact_mod_cast hz2
|
| 44 |
+
· intro n hn
|
| 45 |
+
rcases Finset.mem_Ico.mp hn with ⟨hn1,hn2⟩
|
| 46 |
+
have h1 : (X:ℤ)≤n := by exact_mod_cast hn1
|
| 47 |
+
have h2 : (n:ℤ)<(X:ℤ)^2 := by exact_mod_cast hn2
|
| 48 |
+
simp only [HarmonicTranslation.raw_apply,h1,h2,true_and,Int.isCoprime_iff_nat_coprime,
|
| 49 |
+
Int.natAbs_natCast,Int.cast_natCast,Nat.coprime_comm (n:=n) (m:=W)]
|
| 50 |
+
split_ifs <;> simp
|
| 51 |
+
|
| 52 |
+
private lemma raw_mass_nat (X W : ℕ) :
|
| 53 |
+
HarmonicTranslation.mass (HarmonicTranslation.raw X W)=
|
| 54 |
+
DyadicHarmonicBoundary.mass X (X^2) W := by
|
| 55 |
+
have hh:=raw_eval_nat X W (fun _=>1)
|
| 56 |
+
simpa [HarmonicTranslation.eval,HarmonicTranslation.mass,DyadicHarmonicBoundary.mass] using hh
|
| 57 |
+
|
| 58 |
+
private lemma law_eval_nat (X W : ℕ) (hW : 0<W) (hX : 4*W≤X) (A : Set ℤ) :
|
| 59 |
+
HarmonicTranslation.eval (HarmonicTranslation.law X W) (fun n=>if n∈A then 1 else 0)=
|
| 60 |
+
(law X W hW hX:Measure ℕ).real {p | (p:ℤ)∈A} := by
|
| 61 |
+
rw [law_apply,HarmonicTranslation.law,HarmonicTranslation.eval,Finsupp.sum_smul_index (by simp)]
|
| 62 |
+
have he : (HarmonicTranslation.raw X W).sum
|
| 63 |
+
(fun n a=>(HarmonicTranslation.mass (HarmonicTranslation.raw X W))⁻¹ * a * (if n∈A then 1 else 0)) =
|
| 64 |
+
(HarmonicTranslation.mass (HarmonicTranslation.raw X W))⁻¹ *
|
| 65 |
+
HarmonicTranslation.eval (HarmonicTranslation.raw X W) (fun n=>if n∈A then 1 else 0) := by
|
| 66 |
+
simp only [HarmonicTranslation.eval,Finsupp.sum,mul_assoc,Finset.mul_sum]
|
| 67 |
+
rw [he,raw_eval_nat,raw_mass_nat,←div_eq_inv_mul]
|
| 68 |
+
congr 1
|
| 69 |
+
apply Finset.sum_congr rfl
|
| 70 |
+
intro p hp
|
| 71 |
+
simp only [Set.mem_ofPred_eq]
|
| 72 |
+
split_ifs <;> simp_all
|
| 73 |
+
|
| 74 |
+
private lemma law_shift_event (X W : ℕ) (hW : 0<W) (hX : 4*W≤X)
|
| 75 |
+
(h : ℤ) (hh : (W:ℤ)∣h) (A : Set ℤ) :
|
| 76 |
+
|(law X W hW hX:Measure ℕ).real {p | (p:ℤ)+h∈A}-
|
| 77 |
+
(law X W hW hX:Measure ℕ).real {p | (p:ℤ)∈A}| ≤4*(W:ℝ)*|(h:ℝ)|/X := by
|
| 78 |
+
have hfirst:=law_eval_nat X W hW hX {n | n+h∈A}
|
| 79 |
+
simp only [Set.mem_ofPred_eq] at hfirst
|
| 80 |
+
rw [←hfirst,←law_eval_nat X W hW hX A]
|
| 81 |
+
change |HarmonicTranslation.eval (HarmonicTranslation.law X W) (fun n=>if n+h∈A then 1 else 0)-
|
| 82 |
+
HarmonicTranslation.eval (HarmonicTranslation.law X W) (fun n=>if n∈A then 1 else 0)|≤_
|
| 83 |
+
rw [←HarmonicTranslation.eval_shift h (HarmonicTranslation.law X W) (fun n=>if n∈A then 1 else 0),
|
| 84 |
+
←HarmonicTranslation.eval_sub]
|
| 85 |
+
have hb:=HarmonicTranslation.eval_bound
|
| 86 |
+
(HarmonicTranslation.shift h (HarmonicTranslation.law X W)-HarmonicTranslation.law X W)
|
| 87 |
+
(fun n=>if n∈A then 1 else 0) (B:=1) (by intro n; split_ifs <;> norm_num)
|
| 88 |
+
rw [mul_one] at hb
|
| 89 |
+
exact hb.trans (HarmonicTranslation.law_translation hW (by omega) hh)
|
| 90 |
+
|
| 91 |
+
private lemma joint_pivot_disintegration {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ)
|
| 92 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (E : Set ((Fin m→ℕ)×ℕ)) :
|
| 93 |
+
(jointLaw X Xp W hW hX hXp).real E=
|
| 94 |
+
∑ y∈outsideDomain X W,(outsideLaw X W hW hX).real {y} *
|
| 95 |
+
(law Xp W hW hXp:Measure ℕ).real {p | (y,p)∈E} := by
|
| 96 |
+
change ((outsideLaw X W hW hX).prod (law Xp W hW hXp:Measure ℕ)).real E=_
|
| 97 |
+
rw [measureReal_def,Measure.prod_apply MeasurableSet.of_discrete]
|
| 98 |
+
conv_lhs => rw [←Measure.restrict_eq_self_of_ae_mem (outside_ae_domain X W hW hX)]
|
| 99 |
+
rw [lintegral_finset,ENNReal.toReal_sum]
|
| 100 |
+
· apply Finset.sum_congr rfl
|
| 101 |
+
intro y hy
|
| 102 |
+
rw [ENNReal.toReal_mul,mul_comm]
|
| 103 |
+
rfl
|
| 104 |
+
· intro y hy
|
| 105 |
+
exact ENNReal.mul_ne_top (by finiteness) (by finiteness)
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
theorem raw_joint_shift {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ)
|
| 109 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp)
|
| 110 |
+
(E : Set (Fin m→ℕ)) (A : (Fin m→ℕ)→Set ℤ) (slot : (Fin m→ℕ)→ℤ)
|
| 111 |
+
(B : ℝ) (hB : 0≤B)
|
| 112 |
+
(hslot : ∀ y∈outsideDomain X W,(W:ℤ)∣slot y ∧ |(slot y:ℝ)|≤B) :
|
| 113 |
+
|(jointLaw X Xp W hW hX hXp).real {z | z.1∈E ∧ (z.2:ℤ)+slot z.1∈A z.1} -
|
| 114 |
+
(jointLaw X Xp W hW hX hXp).real {z | z.1∈E ∧ (z.2:ℤ)∈A z.1}| ≤
|
| 115 |
+
4*(W:ℝ)*B/Xp
|
| 116 |
+
:= by
|
| 117 |
+
rw [joint_pivot_disintegration,joint_pivot_disintegration,←Finset.sum_sub_distrib]
|
| 118 |
+
calc
|
| 119 |
+
_ ≤ ∑ y∈outsideDomain X W,|(outsideLaw X W hW hX).real {y} *
|
| 120 |
+
(law Xp W hW hXp:Measure ℕ).real {p | y∈E ∧ (p:ℤ)+slot y∈A y}-
|
| 121 |
+
(outsideLaw X W hW hX).real {y} *
|
| 122 |
+
(law Xp W hW hXp:Measure ℕ).real {p | y∈E ∧ (p:ℤ)∈A y}| :=
|
| 123 |
+
Finset.abs_sum_le_sum_abs _ _
|
| 124 |
+
_ ≤ ∑ y∈outsideDomain X W,(outsideLaw X W hW hX).real {y} * (4*(W:ℝ)*B/Xp) := by
|
| 125 |
+
apply Finset.sum_le_sum
|
| 126 |
+
intro y hy
|
| 127 |
+
rw [←mul_sub,abs_mul,abs_of_nonneg measureReal_nonneg]
|
| 128 |
+
apply mul_le_mul_of_nonneg_left _ measureReal_nonneg
|
| 129 |
+
by_cases hey : y∈E
|
| 130 |
+
· simp only [hey,true_and]
|
| 131 |
+
apply (law_shift_event Xp W hW hXp (slot y) (hslot y hy).1 (A y)).trans
|
| 132 |
+
exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (hslot y hy).2 (by positivity)) (by positivity)
|
| 133 |
+
· simp only [hey,false_and,Set.ofPred_false,measureReal_empty,sub_self,abs_zero]
|
| 134 |
+
positivity
|
| 135 |
+
_ = _ := by rw [←Finset.sum_mul,outside_weights_sum,one_mul]
|
| 136 |
+
|
| 137 |
+
end SourceJointShift
|
| 138 |
+
end
|
| 139 |
+
|
| 140 |
+
noncomputable section
|
| 141 |
+
namespace SourcePivotExtension
|
| 142 |
+
open MeasureTheory ProductExposureLaw ProductExposureLabels RoughFaceShift RawHarmonicProbability
|
| 143 |
+
open scoped BigOperators
|
| 144 |
+
attribute [local instance] Classical.propDecidable
|
| 145 |
+
|
| 146 |
+
def conditioningLabel {m : ℕ} (M J : ℕ) (z : (Fin m→ℕ)×ℕ) :=
|
| 147 |
+
(z.1,(z.2/(M*J),z.2%M))
|
| 148 |
+
def conditioningCell {m : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ) (z : (Fin m→ℕ)×ℕ) : Finset ((Fin m→ℕ)×ℕ) :=
|
| 149 |
+
(fullDomain X Xp W).filter (fun u=>conditioningLabel M J u=conditioningLabel M J z)
|
| 150 |
+
def slotEvent {m V : ℕ} (slot : Fin V→(Fin m→ℕ)→ℤ) (A : (Fin m→ℕ)→Set ℤ) : Set ((Fin m→ℕ)×ℕ) :=
|
| 151 |
+
{z | ∃ v,(z.2:ℤ)+slot v z.1∈A z.1}
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def conditionalSlotMass {m V : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ)
|
| 155 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp)
|
| 156 |
+
(slot : Fin V→(Fin m→ℕ)→ℤ) (A : (Fin m→ℕ)→Set ℤ) (z : (Fin m→ℕ)×ℕ) : ℝ :=
|
| 157 |
+
(jointLaw X Xp W hW hX hXp).real (slotEvent slot A ∩ (conditioningCell X Xp W M J z:Set _)) /
|
| 158 |
+
(jointLaw X Xp W hW hX hXp).real (conditioningCell X Xp W M J z:Set _)
|
| 159 |
+
|
| 160 |
+
private lemma finite_real {α : Type*} [MeasurableSpace α] [MeasurableSingletonClass α]
|
| 161 |
+
(μ : Measure α) [IsFiniteMeasure μ] (S : Finset α) (A : Set α) :
|
| 162 |
+
μ.real (A∩(S:Set α))=∑ x∈S,if x∈A then μ.real {x} else 0 := by
|
| 163 |
+
classical
|
| 164 |
+
have he : A∩(S:Set α)=(S.filter (fun x=>x∈A):Set α) := by ext x; simp [and_comm]
|
| 165 |
+
rw [he,←sum_measureReal_singleton,Finset.sum_filter]
|
| 166 |
+
|
| 167 |
+
private lemma finite_ratio_bound {α β : Type*} [DecidableEq α] [DecidableEq β]
|
| 168 |
+
(S : Finset α) (w : α→ℝ) (hw : ∀ x∈S,0≤w x) (π : α→β)
|
| 169 |
+
(E : Set β) (A : Set α) (c : ℝ) (hc : 0≤c) :
|
| 170 |
+
c*((∑ x∈S,if π x∈E then w x else 0)-
|
| 171 |
+
∑ x∈S,if (∑ y∈S.filter (fun y=>π y=π x),if y∈A then w y else 0)/
|
| 172 |
+
(∑ y∈S.filter (fun y=>π y=π x),w y)≤c then w x else 0) ≤
|
| 173 |
+
∑ x∈S,if π x∈E ∧ x∈A then w x else 0 := by
|
| 174 |
+
classical
|
| 175 |
+
let d (i : β) := ∑ y∈S.filter (fun y=>π y=i),w y
|
| 176 |
+
let n (i : β) := ∑ y∈S.filter (fun y=>π y=i),if y∈A then w y else 0
|
| 177 |
+
let G : Set β := {i | i∈E ∧ c<n i/d i}
|
| 178 |
+
let T := (S.image π).filter (·∈G)
|
| 179 |
+
have hf : S.filter (fun x=>π x∈T)=S.filter (fun x=>π x∈G) := by
|
| 180 |
+
ext x
|
| 181 |
+
simp only [Finset.mem_filter,T]
|
| 182 |
+
constructor
|
| 183 |
+
· exact fun h=>⟨h.1,h.2.2⟩
|
| 184 |
+
· exact fun h=>⟨h.1,Finset.mem_image_of_mem π h.1,h.2⟩
|
| 185 |
+
have hs : c*(∑ x∈S.filter (fun x=>π x∈G),w x) ≤
|
| 186 |
+
∑ x∈S,if π x∈E ∧ x∈A then w x else 0 := by
|
| 187 |
+
calc
|
| 188 |
+
_ = ∑ i∈T,c*d i := by rw [←Finset.mul_sum,Finset.sum_fiberwise_eq_sum_filter,hf]
|
| 189 |
+
_ ≤ ∑ i∈T,∑ x∈S.filter (fun x=>π x=i),if π x∈E ∧ x∈A then w x else 0 := by
|
| 190 |
+
apply Finset.sum_le_sum
|
| 191 |
+
intro i hi
|
| 192 |
+
have hg : i∈E ∧ c<n i/d i := (Finset.mem_filter.mp hi).2
|
| 193 |
+
have hd : 0≤d i := Finset.sum_nonneg (fun y hy=>hw y (Finset.mem_filter.mp hy).1)
|
| 194 |
+
have hn : 0≤n i := Finset.sum_nonneg (by intro y hy; split_ifs; exact hw y (Finset.mem_filter.mp hy).1; rfl)
|
| 195 |
+
have hh : c*d i≤n i := by
|
| 196 |
+
rcases eq_or_lt_of_le hd with h0|h0
|
| 197 |
+
· rw [←h0,mul_zero]; exact hn
|
| 198 |
+
· exact le_of_lt ((lt_div_iff₀ h0).mp hg.2)
|
| 199 |
+
apply hh.trans_eq
|
| 200 |
+
apply Finset.sum_congr rfl
|
| 201 |
+
intro x hx
|
| 202 |
+
simp only [(Finset.mem_filter.mp hx).2,hg.1,true_and]
|
| 203 |
+
_ = ∑ x∈S.filter (fun x=>π x∈G),if π x∈E ∧ x∈A then w x else 0 := by
|
| 204 |
+
rw [Finset.sum_fiberwise_eq_sum_filter,hf]
|
| 205 |
+
_ ≤ _ := by
|
| 206 |
+
apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _)
|
| 207 |
+
intro x hx _
|
| 208 |
+
split_ifs
|
| 209 |
+
· exact hw x hx
|
| 210 |
+
· rfl
|
| 211 |
+
apply le_trans ?_ hs
|
| 212 |
+
apply mul_le_mul_of_nonneg_left _ hc
|
| 213 |
+
rw [Finset.sum_filter,←Finset.sum_sub_distrib]
|
| 214 |
+
apply Finset.sum_le_sum
|
| 215 |
+
intro x hx
|
| 216 |
+
change (if π x∈E then w x else 0)-(if n (π x)/d (π x)≤c then w x else 0) ≤
|
| 217 |
+
if π x∈G then w x else 0
|
| 218 |
+
by_cases he : π x∈E <;> by_cases hb : n (π x)/d (π x)≤c
|
| 219 |
+
· simp [he,hb,G,not_lt.mpr hb]
|
| 220 |
+
· simp [he,hb,G,lt_of_not_ge hb]
|
| 221 |
+
· simp [he,hb,G,hw x hx]
|
| 222 |
+
· simp [he,hb,G]
|
| 223 |
+
|
| 224 |
+
private lemma support_ae {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ)
|
| 225 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) :
|
| 226 |
+
∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z∈fullDomain X Xp W := by
|
| 227 |
+
have ho : ∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z.1∈outsideDomain X W :=
|
| 228 |
+
(measurePreserving_fst (μ:=outsideLaw X W hW hX) (ν:=(law Xp W hW hXp:Measure ℕ))).quasiMeasurePreserving.ae
|
| 229 |
+
(outside_ae_domain X W hW hX)
|
| 230 |
+
have hp : ∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z.2∈units Xp W :=
|
| 231 |
+
(measurePreserving_snd (μ:=outsideLaw X W hW hX) (ν:=(law Xp W hW hXp:Measure ℕ))).quasiMeasurePreserving.ae
|
| 232 |
+
(law_ae_units Xp W hW hXp)
|
| 233 |
+
filter_upwards [ho,hp] with z ho hp
|
| 234 |
+
exact Finset.mem_filter.mpr ⟨Finset.mem_product.mpr ⟨ho,(Finset.mem_filter.mp hp).1⟩,(Finset.mem_filter.mp hp).2⟩
|
| 235 |
+
|
| 236 |
+
private lemma joint_real {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ)
|
| 237 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (A : Set ((Fin m→ℕ)×ℕ)) :
|
| 238 |
+
(jointLaw X Xp W hW hX hXp).real A=
|
| 239 |
+
∑ z∈fullDomain X Xp W,if z∈A then (jointLaw X Xp W hW hX hXp).real {z} else 0 := by
|
| 240 |
+
rw [←finite_real]
|
| 241 |
+
apply measureReal_congr
|
| 242 |
+
filter_upwards [support_ae X Xp W hW hX hXp] with z hz
|
| 243 |
+
exact propext ⟨fun h=>⟨h,hz⟩,fun h=>h.1⟩
|
| 244 |
+
|
| 245 |
+
private lemma conditional_mass_sum {m V : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ)
|
| 246 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp)
|
| 247 |
+
(slot : Fin V→(Fin m→ℕ)→ℤ) (A : (Fin m→ℕ)→Set ℤ) (z : (Fin m→ℕ)×ℕ) :
|
| 248 |
+
conditionalSlotMass X Xp W M J hW hX hXp slot A z=
|
| 249 |
+
(∑ y∈(fullDomain X Xp W).filter (fun y=>conditioningLabel M J y=conditioningLabel M J z),
|
| 250 |
+
if y∈slotEvent slot A then (jointLaw X Xp W hW hX hXp).real {y} else 0)/
|
| 251 |
+
(∑ y∈(fullDomain X Xp W).filter (fun y=>conditioningLabel M J y=conditioningLabel M J z),
|
| 252 |
+
(jointLaw X Xp W hW hX hXp).real {y}) := by
|
| 253 |
+
unfold conditionalSlotMass
|
| 254 |
+
rw [finite_real,←sum_measureReal_singleton]
|
| 255 |
+
rfl
|
| 256 |
+
|
| 257 |
+
private lemma conditional_extension {m V : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ)
|
| 258 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp)
|
| 259 |
+
(E : Set (Fin m→ℕ)) (A : (Fin m→ℕ)→Set ℤ)
|
| 260 |
+
(slot : Fin V→(Fin m→ℕ)→ℤ) (c : ℝ) (hc : 0≤c) :
|
| 261 |
+
c*((jointLaw X Xp W hW hX hXp).real {z | z.1∈E} -
|
| 262 |
+
(jointLaw X Xp W hW hX hXp).real {z | conditionalSlotMass X Xp W M J hW hX hXp slot A z≤c}) ≤
|
| 263 |
+
(jointLaw X Xp W hW hX hXp).real {z | z.1∈E ∧ z∈slotEvent slot A} := by
|
| 264 |
+
have hh:=finite_ratio_bound (fullDomain X Xp W)
|
| 265 |
+
(fun z=>(jointLaw X Xp W hW hX hXp).real {z}) (fun _ _=>measureReal_nonneg)
|
| 266 |
+
(conditioningLabel M J) {i | i.1∈E} (slotEvent slot A) c hc
|
| 267 |
+
rw [joint_real X Xp W hW hX hXp,joint_real X Xp W hW hX hXp,
|
| 268 |
+
joint_real X Xp W hW hX hXp]
|
| 269 |
+
simp only [Set.mem_ofPred_eq,conditional_mass_sum]
|
| 270 |
+
simp only [Set.mem_ofPred_eq,conditioningLabel] at hh
|
| 271 |
+
apply hh.trans_eq
|
| 272 |
+
apply Finset.sum_congr rfl
|
| 273 |
+
intro point _
|
| 274 |
+
exact (ite_eq_ite _ _ _).mpr trivial
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
|
| 278 |
+
theorem raw_pivot_extension {m V : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ)
|
| 279 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp)
|
| 280 |
+
(E : Set (Fin m→ℕ)) (A : (Fin m→ℕ)→Set ℤ)
|
| 281 |
+
(slot : Fin V→(Fin m→ℕ)→ℤ) (B c : ℝ) (hB : 0≤B) (hc : 0≤c)
|
| 282 |
+
(hslot : ∀ v y,y∈outsideDomain X W → (W:ℤ)∣slot v y ∧ |(slot v y:ℝ)|≤B) :
|
| 283 |
+
c*((jointLaw X Xp W hW hX hXp).real {z | z.1∈E} -
|
| 284 |
+
(jointLaw X Xp W hW hX hXp).real {z | conditionalSlotMass X Xp W M J hW hX hXp slot A z≤c}) ≤
|
| 285 |
+
(V:ℝ)*((jointLaw X Xp W hW hX hXp).real {z | z.1∈E ∧ (z.2:ℤ)∈A z.1}+
|
| 286 |
+
4*(W:ℝ)*B/Xp)
|
| 287 |
+
:= by
|
| 288 |
+
have hh:=conditional_extension X Xp W M J hW hX hXp E A slot c hc
|
| 289 |
+
apply hh.trans
|
| 290 |
+
let F : Fin V→Set ((Fin m→ℕ)×ℕ) := fun v=>{z | z.1∈E ∧ (z.2:ℤ)+slot v z.1∈A z.1}
|
| 291 |
+
have he : {z : (Fin m→ℕ)×ℕ | z.1∈E ∧ z∈slotEvent slot A}=⋃ v,F v := by
|
| 292 |
+
ext z
|
| 293 |
+
simp only [Set.mem_ofPred_eq,slotEvent,Set.mem_iUnion,F]
|
| 294 |
+
aesop
|
| 295 |
+
rw [he]
|
| 296 |
+
calc
|
| 297 |
+
_ ≤ ∑ v,(jointLaw X Xp W hW hX hXp).real (F v) := measureReal_iUnion_fintype_le F
|
| 298 |
+
_ ≤ ∑ _v : Fin V,((jointLaw X Xp W hW hX hXp).real
|
| 299 |
+
{z | z.1∈E ∧ (z.2:ℤ)∈A z.1}+4*(W:ℝ)*B/Xp) := by
|
| 300 |
+
apply Finset.sum_le_sum
|
| 301 |
+
intro v hv
|
| 302 |
+
have h:=(abs_le.mp (SourceJointShift.raw_joint_shift X Xp W hW hX hXp E A (slot v) B hB (hslot v))).2
|
| 303 |
+
change (jointLaw X Xp W hW hX hXp).real {z | z.1∈E ∧ (z.2:ℤ)+slot v z.1∈A z.1}≤_
|
| 304 |
+
linarith
|
| 305 |
+
_ = _ := by simp; ring
|
| 306 |
+
|
| 307 |
+
end SourcePivotExtension
|
| 308 |
+
|
| 309 |
+
end
|
| 310 |
+
end
|
| 311 |
+
|
| 312 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PivotExtension02.lean
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.IntegerArrays14
|
| 3 |
+
import OAI.Combinatorics.SumProduct.Alignment.PivotExtension01
|
| 4 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
section
|
| 10 |
+
noncomputable section
|
| 11 |
+
end
|
| 12 |
+
|
| 13 |
+
noncomputable section
|
| 14 |
+
namespace SourcePivotExtension
|
| 15 |
+
open MeasureTheory ProductExposureLaw ProductExposureLabels RoughFaceShift RawHarmonicProbability
|
| 16 |
+
open SourceIntegerArrays
|
| 17 |
+
open scoped BigOperators
|
| 18 |
+
attribute [local instance] Classical.propDecidable
|
| 19 |
+
|
| 20 |
+
private lemma unit_atom_pos (X W : ℕ) (hW : 0<W) (hX : 4*W≤X)
|
| 21 |
+
(p : ℕ) (hp : p∈units X W) : 0<(law X W hW hX:Measure ℕ).real {p} := by
|
| 22 |
+
have hp0 : 0<p := by
|
| 23 |
+
have ht:=(Finset.mem_Ico.mp (Finset.mem_filter.mp hp).1).1
|
| 24 |
+
omega
|
| 25 |
+
rw [MicrocellConditional.law_apply_units]
|
| 26 |
+
have he : MicrocellConditional.eventMass (units X W) {p}=(p:ℝ)⁻¹ := by
|
| 27 |
+
simp [MicrocellConditional.eventMass,hp]
|
| 28 |
+
rw [he]
|
| 29 |
+
exact div_pos (inv_pos.mpr (by exact_mod_cast hp0)) (mass_pos X W hW hX)
|
| 30 |
+
|
| 31 |
+
private lemma outside_atom_pos {m : ℕ} (X : Fin m→ℕ) (W : ℕ)
|
| 32 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (y : Fin m→ℕ) (hy : y∈outsideDomain X W) :
|
| 33 |
+
0<(outsideLaw X W hW hX).real {y} := by
|
| 34 |
+
simp only [outsideLaw,measureReal_def,Measure.pi_singleton,ENNReal.toReal_prod]
|
| 35 |
+
apply Finset.prod_pos
|
| 36 |
+
intro j hj
|
| 37 |
+
exact unit_atom_pos (X j) W hW (hX j) (y j) (Fintype.mem_piFinset.mp hy j)
|
| 38 |
+
|
| 39 |
+
private lemma label_source_cell (M J p q : ℕ) (hM : 0<M) (hJ : 0<J) :
|
| 40 |
+
q∈sourceCell M J p ↔ q/(M*J)=p/(M*J) ∧ q%M=p%M := by
|
| 41 |
+
unfold sourceCell MicrocellFibers.fiber
|
| 42 |
+
simp only [Finset.mem_filter,Finset.mem_Ico]
|
| 43 |
+
have hw:=MicrocellSaturation.quotient_window (M*J) q (Nat.mul_pos hM hJ)
|
| 44 |
+
constructor
|
| 45 |
+
· rintro ⟨⟨hlo,hhi⟩,hr⟩
|
| 46 |
+
exact ⟨Nat.div_eq_of_lt_le (by nlinarith) (by nlinarith),hr⟩
|
| 47 |
+
· rintro ⟨hq,hr⟩
|
| 48 |
+
rw [hq] at hw
|
| 49 |
+
exact ⟨⟨by nlinarith [hw.1],by nlinarith [hw.2]⟩,hr⟩
|
| 50 |
+
|
| 51 |
+
private lemma full_support_mem {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ)
|
| 52 |
+
(u : (Fin m→ℕ)×ℕ) :
|
| 53 |
+
u∈fullDomain X Xp W ↔ u.1∈outsideDomain X W ∧ u.2∈units Xp W := by
|
| 54 |
+
rcases u with ⟨y,p⟩
|
| 55 |
+
simp only [fullDomain,rawDomain,outsideDomain,units,Finset.mem_filter,Finset.product_eq_sprod,Finset.mem_product]
|
| 56 |
+
tauto
|
| 57 |
+
|
| 58 |
+
private lemma raw_cell_product {m : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ)
|
| 59 |
+
(z : (Fin m→ℕ)×ℕ) (hz : z.1∈outsideDomain X W) :
|
| 60 |
+
(conditioningCell X Xp W M J z:Set _)={z.1} ×ˢ
|
| 61 |
+
(((units Xp W).filter (fun p=>p/(M*J)=z.2/(M*J) ∧ p%M=z.2%M)):Set ℕ) := by
|
| 62 |
+
ext u
|
| 63 |
+
simp only [Finset.mem_coe,conditioningCell,Finset.mem_filter]
|
| 64 |
+
rw [full_support_mem]
|
| 65 |
+
simp only [conditioningLabel,Prod.mk.injEq,Set.mem_prod,Set.mem_singleton_iff,
|
| 66 |
+
Finset.mem_coe,Finset.mem_filter]
|
| 67 |
+
constructor
|
| 68 |
+
· rintro ⟨⟨hu,hp⟩,hy,hq,hr⟩
|
| 69 |
+
exact ⟨hy,hp,hq,hr⟩
|
| 70 |
+
· rintro ⟨hy,hp,hq,hr⟩
|
| 71 |
+
exact ⟨⟨hy.symm ▸ hz,hp⟩,hy,hq,hr⟩
|
| 72 |
+
|
| 73 |
+
private lemma joint_rectangle_real {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ)
|
| 74 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp)
|
| 75 |
+
(y : Fin m→ℕ) (S : Set ℕ) :
|
| 76 |
+
(jointLaw X Xp W hW hX hXp).real ({y}×ˢS)=
|
| 77 |
+
(outsideLaw X W hW hX).real {y}*(law Xp W hW hXp:Measure ℕ).real S := by
|
| 78 |
+
change ((outsideLaw X W hW hX).prod (law Xp W hW hXp:Measure ℕ)).real ({y}×ˢS)=_
|
| 79 |
+
rw [measureReal_def,Measure.prod_prod,ENNReal.toReal_mul]
|
| 80 |
+
rfl
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
theorem conditional_slot_source_ratio {m V : ℕ} (X : Fin m→ℕ) (Xp W M J : ℕ)
|
| 85 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp)
|
| 86 |
+
(hM : 0<M) (hJ : 0<J) (z : (Fin m→ℕ)×ℕ) (hz : z.1∈outsideDomain X W)
|
| 87 |
+
(slot : Fin V→(Fin m→ℕ)→ℤ) (A : (Fin m→ℕ)→Set ℤ) :
|
| 88 |
+
conditionalSlotMass X Xp W M J hW hX hXp slot A z=
|
| 89 |
+
cellRatio Xp W M J z.2 hW hXp
|
| 90 |
+
{k | (z.1,MicrocellFibers.point M (J*(z.2/(M*J))) (z.2%M) k)∈slotEvent slot A}
|
| 91 |
+
:= by
|
| 92 |
+
let F : Finset ℕ := (units Xp W).filter (fun p=>p/(M*J)=z.2/(M*J) ∧ p%M=z.2%M)
|
| 93 |
+
let C : Set ℕ := {p | (z.1,p)∈slotEvent slot A}
|
| 94 |
+
let ν : Measure ℕ := (law Xp W hW hXp:Measure ℕ)
|
| 95 |
+
have heC : (conditioningCell X Xp W M J z:Set _)={z.1}×ˢ(F:Set ℕ) :=
|
| 96 |
+
raw_cell_product X Xp W M J z hz
|
| 97 |
+
have heN : slotEvent slot A ∩ (conditioningCell X Xp W M J z:Set _) =
|
| 98 |
+
{z.1}×ˢ(C∩(F:Set ℕ)) := by
|
| 99 |
+
rw [heC]
|
| 100 |
+
ext u
|
| 101 |
+
simp only [Set.mem_inter_iff,Set.mem_prod,Set.mem_singleton_iff]
|
| 102 |
+
constructor
|
| 103 |
+
· rintro ⟨hu,hy,hp⟩
|
| 104 |
+
have he : u=(z.1,u.2):=Prod.ext hy rfl
|
| 105 |
+
exact ⟨hy,(congrArg (fun t=>t∈slotEvent slot A) he).mp hu,hp⟩
|
| 106 |
+
· rintro ⟨hy,hu,hp⟩
|
| 107 |
+
have he : u=(z.1,u.2):=Prod.ext hy rfl
|
| 108 |
+
exact ⟨(congrArg (fun t=>t∈slotEvent slot A) he).mpr hu,hy,hp⟩
|
| 109 |
+
have hr : conditionalSlotMass X Xp W M J hW hX hXp slot A z=
|
| 110 |
+
ν.real (C∩(F:Set ℕ))/ν.real (F:Set ℕ) := by
|
| 111 |
+
unfold conditionalSlotMass
|
| 112 |
+
rw [heN,heC,joint_rectangle_real,joint_rectangle_real]
|
| 113 |
+
exact mul_div_mul_left _ _ (outside_atom_pos X W hW hX z.1 hz).ne'
|
| 114 |
+
have hF : (F:Set ℕ)=(units Xp W:Set ℕ)∩(sourceCell M J z.2:Set ℕ) := by
|
| 115 |
+
ext p
|
| 116 |
+
simp only [F,Finset.mem_coe,Finset.mem_filter,Set.mem_inter_iff,
|
| 117 |
+
label_source_cell M J z.2 p hM hJ]
|
| 118 |
+
have hf : ν.real (F:Set ℕ)=ν.real (sourceCell M J z.2:Set ℕ) := by
|
| 119 |
+
rw [hF]
|
| 120 |
+
apply measureReal_congr
|
| 121 |
+
filter_upwards [law_ae_units Xp W hW hXp] with p hp
|
| 122 |
+
exact propext ⟨fun h=>h.2,fun h=>⟨hp,h⟩⟩
|
| 123 |
+
have hn : ν.real (C∩(F:Set ℕ))=ν.real (C∩(sourceCell M J z.2:Set ℕ)) := by
|
| 124 |
+
rw [hF]
|
| 125 |
+
apply measureReal_congr
|
| 126 |
+
filter_upwards [law_ae_units Xp W hW hXp] with p hp
|
| 127 |
+
exact propext ⟨fun h=>⟨h.1,h.2.2⟩,fun h=>⟨h.1,hp,h.2⟩⟩
|
| 128 |
+
have himage : (MicrocellFibers.point M (J*(z.2/(M*J))) (z.2%M) ''
|
| 129 |
+
{k | (z.1,MicrocellFibers.point M (J*(z.2/(M*J))) (z.2%M) k)∈slotEvent slot A}) ∩
|
| 130 |
+
(sourceCell M J z.2:Set ℕ) = C∩(sourceCell M J z.2:Set ℕ) := by
|
| 131 |
+
ext p
|
| 132 |
+
constructor
|
| 133 |
+
· rintro ⟨⟨k,hk,rfl⟩,hp⟩
|
| 134 |
+
exact ⟨hk,hp⟩
|
| 135 |
+
· rintro ⟨hp,hC⟩
|
| 136 |
+
obtain ⟨k,hk⟩:=MicrocellFibers.represent M J (J*(z.2/(M*J))) (z.2%M) p hM hC
|
| 137 |
+
refine ⟨⟨k.val,?_,hk⟩,hC⟩
|
| 138 |
+
change (z.1,MicrocellFibers.point M (J*(z.2/(M*J))) (z.2%M) k.val)∈slotEvent slot A
|
| 139 |
+
rw [hk]
|
| 140 |
+
exact hp
|
| 141 |
+
rw [hr,hf,hn]
|
| 142 |
+
unfold cellRatio
|
| 143 |
+
rw [himage]
|
| 144 |
+
|
| 145 |
+
end SourcePivotExtension
|
| 146 |
+
end
|
| 147 |
+
|
| 148 |
+
noncomputable section
|
| 149 |
+
namespace SourceIntegerArrays.GlobalJoint.SourceFrozenFamily
|
| 150 |
+
open ProductExposureLabels SourceExposureSlots SourceResidueAlignment ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmetic
|
| 151 |
+
open ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScales ConstructedWordPlan.RationalPivotPlan
|
| 152 |
+
open scoped BigOperators BoundedContinuousFunction
|
| 153 |
+
attribute [local instance] Classical.propDecidable
|
| 154 |
+
variable {a : ℕ} (D : Pivot a)
|
| 155 |
+
variable (s r : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (q₀ : ℕ) (b₀ : Scale a)
|
| 156 |
+
local notation "I" => FiniteModelSlots.Index D s r hs Fs q₀ b₀
|
| 157 |
+
variable (G₀ : Fin D.targets→ℚ→Fin r→Type)
|
| 158 |
+
variable [∀ t v c,Group (G₀ t v c)] [∀ t v c,TopologicalSpace (G₀ t v c)]
|
| 159 |
+
variable (Γ₀ : ∀ t v c,Subgroup (G₀ t v c))
|
| 160 |
+
variable (M J R H : ℕ→ℕ) (L : ℕ→ℤ) (C : ℕ→Fin D.pairs→ℤ)
|
| 161 |
+
variable (g₀ x₀ : ∀ t,ℕ→(Fin (h D t)→ℕ)→∀ v c,ℤ→ℤ→G₀ t v c)
|
| 162 |
+
variable (obs₀ : ∀ t,ℕ→(Fin (h D t)→ℕ)→∀ v c,ℤ→ℤ→((G₀ t v c)⧸Γ₀ t v c) →ᵇ ℝ)
|
| 163 |
+
variable (ht : ℕ→Fin a→ℤ)
|
| 164 |
+
open MeasureTheory SourcePivotExtension RawHarmonicProbability ProductExposureLaw
|
| 165 |
+
abbrev slotCount := Fintype.card {v : Slots D // v∈slots D s r hs Fs q₀ b₀}
|
| 166 |
+
def rawSlot (N : ℕ) (v : Fin (slotCount D s r hs Fs q₀ b₀)) (u : Fin a→ℕ) : ℤ :=
|
| 167 |
+
slotValue D (L N) (heightCoeff D q₀ ht N) (fun j=>(u j:ℤ))
|
| 168 |
+
((Fintype.equivFin {v : Slots D // v∈slots D s r hs Fs q₀ b₀}).symm v).val
|
| 169 |
+
def pivotSet (N : ℕ) (τ : ℝ) (u : Fin a→ℕ) : Set ℤ :=
|
| 170 |
+
{x | 0<x ∧ pivotProperty D s r hs Fs b₀ G₀ Γ₀ M H g₀ x₀ obs₀ ht N u x.toNat τ}
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
theorem source_posterior_domination (N w : ℕ) (z : (Fin a→ℕ)×ℕ)
|
| 174 |
+
(X : Fin a→ℕ) (Xp : ℕ)
|
| 175 |
+
(hW : 0<primorial w) (hX : ∀ j,4*primorial w≤X j) (hXp : 4*primorial w≤Xp)
|
| 176 |
+
(hz : z.1∈outsideDomain X (primorial w)) (hM : 0<M N) (hJ : 0<J N)
|
| 177 |
+
(hq₀ : 0<q₀) (hQq : terminalDenom D s r hs Fs b₀∣q₀) (hw : q₀+1≤w)
|
| 178 |
+
(hL : 0<L N) (hWL : (primorial w:ℤ)∣L N) (hML : (M N:ℤ)∣L N)
|
| 179 |
+
(hu : ∀ j,IsCoprime (z.1 j:ℤ) (L N))
|
| 180 |
+
(hd : ∀ e,Disjoint (D.added e) (D.tail (D.owner e)))
|
| 181 |
+
(hb₀ : ∀ j,0<b₀ j) (hFs : ∀ b∈Fs,∀ j,0<b j)
|
| 182 |
+
(hht : ∀ j,0<ht N j)
|
| 183 |
+
(hratio : ∀ e,∃ d : ℤ,height (ht N) (D.added e)=
|
| 184 |
+
height (ht N) (block D.index D.tail (D.owner e))*((primorial w:ℤ)^w*d))
|
| 185 |
+
(hlarge : ∀ v∈slots D s r hs Fs q₀ b₀,(∑ e,|v e|)*L N<(Xp:ℤ)) (τ : ℝ) :
|
| 186 |
+
let C:=heightCoeff D q₀ ht
|
| 187 |
+
let d:=family D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L C g₀ x₀ obs₀
|
| 188 |
+
cellRatio Xp (primorial w) (M N) (J N) z.2 hW hXp
|
| 189 |
+
{k | ((d.atTime N).localModel z).modelSuccess (coord D) (k:ℤ) s r hs
|
| 190 |
+
(FiniteModelSlots.formula D s r hs Fs q₀ b₀) Fs q₀ b₀ τ} ≤
|
| 191 |
+
conditionalSlotMass X Xp (primorial w) (M N) (J N) hW hX hXp
|
| 192 |
+
(rawSlot D s r hs Fs q₀ b₀ L ht N)
|
| 193 |
+
(pivotSet D s r hs Fs b₀ G₀ Γ₀ M H g₀ x₀ obs₀ ht N τ) z
|
| 194 |
+
:= by
|
| 195 |
+
dsimp only
|
| 196 |
+
let d:=family D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L (heightCoeff D q₀ ht) g₀ x₀ obs₀
|
| 197 |
+
let S : Set ℕ:={k | ((d.atTime N).localModel z).modelSuccess (coord D) (k:ℤ) s r hs
|
| 198 |
+
(FiniteModelSlots.formula D s r hs Fs q₀ b₀) Fs q₀ b₀ τ}
|
| 199 |
+
let slot:=rawSlot D s r hs Fs q₀ b₀ L ht N
|
| 200 |
+
let A:=pivotSet D s r hs Fs b₀ G₀ Γ₀ M H g₀ x₀ obs₀ ht N τ
|
| 201 |
+
let f:=MicrocellFibers.point (M N) (J N*(z.2/(M N*J N))) (z.2%M N)
|
| 202 |
+
let ν:Measure ℕ:=(law Xp (primorial w) hW hXp:Measure ℕ)
|
| 203 |
+
change cellRatio Xp (primorial w) (M N) (J N) z.2 hW hXp S ≤
|
| 204 |
+
conditionalSlotMass X Xp (primorial w) (M N) (J N) hW hX hXp slot A z
|
| 205 |
+
rw [conditional_slot_source_ratio X Xp (primorial w) (M N) (J N) hW hX hXp hM hJ z hz slot A]
|
| 206 |
+
unfold cellRatio
|
| 207 |
+
apply div_le_div_of_nonneg_right _ measureReal_nonneg
|
| 208 |
+
change ν.real ((f '' S)∩(sourceCell (M N) (J N) z.2:Set ℕ)) ≤
|
| 209 |
+
ν.real ((f '' {k | (z.1,f k)∈slotEvent slot A})∩(sourceCell (M N) (J N) z.2:Set ℕ))
|
| 210 |
+
have he : ν.real ((f '' S)∩(sourceCell (M N) (J N) z.2:Set ℕ))=
|
| 211 |
+
ν.real (((f '' S)∩(sourceCell (M N) (J N) z.2:Set ℕ))∩(units Xp (primorial w):Set ℕ)) := by
|
| 212 |
+
apply measureReal_congr
|
| 213 |
+
filter_upwards [law_ae_units Xp (primorial w) hW hXp] with p hp
|
| 214 |
+
exact propext ⟨fun h=>⟨h,hp⟩,fun h=>h.1⟩
|
| 215 |
+
rw [he]
|
| 216 |
+
refine measureReal_mono ?_ (by finiteness)
|
| 217 |
+
rintro p ⟨⟨⟨k,hk,hkp⟩,hcell⟩,hpunit⟩
|
| 218 |
+
refine ⟨⟨k,?_,hkp⟩,hcell⟩
|
| 219 |
+
have hpge : (Xp:ℤ)≤(p:ℤ) := by
|
| 220 |
+
exact_mod_cast (Finset.mem_Ico.mp (Finset.mem_filter.mp hpunit).1).1
|
| 221 |
+
have hpform : (p:ℤ)=firstPivot (M N) (J N) z.2+(M N:ℤ)*(k:ℤ) := by
|
| 222 |
+
rw [←hkp,firstPivot_eq_point]
|
| 223 |
+
simp only [f,MicrocellFibers.point,Nat.cast_add,Nat.cast_mul,mul_zero,add_zero]
|
| 224 |
+
have hread:=source_pivot_reading D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L g₀ x₀ obs₀ ht
|
| 225 |
+
N w z k p hq₀ hQq hw hL hWL hML hu hd hb₀ hFs hht hratio hpform
|
| 226 |
+
(fun v hv=>(hlarge v hv).trans_le hpge) τ
|
| 227 |
+
obtain ⟨v,hv,hpos,hprop⟩:=hread hk
|
| 228 |
+
let vv : {v : Slots D // v∈slots D s r hs Fs q₀ b₀}:=⟨v,hv⟩
|
| 229 |
+
change ∃ j,(f k:ℤ)+slot j z.1∈A z.1
|
| 230 |
+
refine ⟨(Fintype.equivFin _ ) vv,?_⟩
|
| 231 |
+
dsimp only [slot,rawSlot]
|
| 232 |
+
rw [Equiv.symm_apply_apply,hkp]
|
| 233 |
+
exact ⟨hpos,hprop⟩
|
| 234 |
+
|
| 235 |
+
end SourceIntegerArrays.GlobalJoint.SourceFrozenFamily
|
| 236 |
+
end
|
| 237 |
+
|
| 238 |
+
noncomputable section
|
| 239 |
+
namespace SourceIntegerArrays.GlobalJoint.SourceFrozenFamily
|
| 240 |
+
open ProductExposureLabels SourceExposureSlots SourceResidueAlignment ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmetic
|
| 241 |
+
open ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScales ConstructedWordPlan.RationalPivotPlan
|
| 242 |
+
open scoped BigOperators BoundedContinuousFunction
|
| 243 |
+
attribute [local instance] Classical.propDecidable
|
| 244 |
+
variable {a : ℕ} (D : Pivot a)
|
| 245 |
+
variable (s r : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (q₀ : ℕ) (b₀ : Scale a)
|
| 246 |
+
local notation "I" => FiniteModelSlots.Index D s r hs Fs q₀ b₀
|
| 247 |
+
variable (G₀ : Fin D.targets→ℚ→Fin r→Type)
|
| 248 |
+
variable [∀ t v c,Group (G₀ t v c)] [∀ t v c,TopologicalSpace (G₀ t v c)]
|
| 249 |
+
variable (Γ₀ : ∀ t v c,Subgroup (G₀ t v c))
|
| 250 |
+
variable (M J R H : ℕ→ℕ) (L : ℕ→ℤ) (C : ℕ→Fin D.pairs→ℤ)
|
| 251 |
+
variable (g₀ x₀ : ∀ t,ℕ→(Fin (h D t)→ℕ)→∀ v c,ℤ→ℤ→G₀ t v c)
|
| 252 |
+
variable (obs₀ : ∀ t,ℕ→(Fin (h D t)→ℕ)→∀ v c,ℤ→ℤ→((G₀ t v c)⧸Γ₀ t v c) →ᵇ ℝ)
|
| 253 |
+
variable (ht : ℕ→Fin a→ℤ)
|
| 254 |
+
open MeasureTheory SourcePivotExtension RawHarmonicProbability ProductExposureLaw
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
def slotBudget : ℤ := ∑ v∈slots D s r hs Fs q₀ b₀,∑ e,|v e|
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
theorem source_actual_extension (N w : ℕ) (X : Fin a→ℕ) (Xp : ℕ)
|
| 261 |
+
(hW : 0<primorial w) (hX : ∀ j,4*primorial w≤X j) (hXp : 4*primorial w≤Xp)
|
| 262 |
+
(hM : 0<M N) (hJ : 0<J N)
|
| 263 |
+
(hq₀ : 0<q₀) (hQq : terminalDenom D s r hs Fs b₀∣q₀) (hw : q₀+1≤w)
|
| 264 |
+
(hL : 0<L N) (hsm : RoughScales.Smooth w (L N))
|
| 265 |
+
(hWL : (primorial w:ℤ)∣L N) (hML : (M N:ℤ)∣L N)
|
| 266 |
+
(hd : ∀ e,Disjoint (D.added e) (D.tail (D.owner e)))
|
| 267 |
+
(hb₀ : ∀ j,0<b₀ j) (hFs : ∀ b∈Fs,∀ j,0<b j)
|
| 268 |
+
(hht : ∀ j,0<ht N j)
|
| 269 |
+
(hratio : ∀ e,∃ d : ℤ,height (ht N) (D.added e)=
|
| 270 |
+
height (ht N) (block D.index D.tail (D.owner e))*((primorial w:ℤ)^w*d))
|
| 271 |
+
(hlarge : slotBudget D s r hs Fs q₀ b₀*L N<(Xp:ℤ))
|
| 272 |
+
(τ c : ℝ) (hc : 0≤c) (E : Set (Fin a→ℕ)) :
|
| 273 |
+
let C:=heightCoeff D q₀ ht
|
| 274 |
+
let d:=family D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L C g₀ x₀ obs₀
|
| 275 |
+
let μ:=jointLaw X Xp (primorial w) hW hX hXp
|
| 276 |
+
c*(μ.real {z | z.1∈E}-μ.real {z |
|
| 277 |
+
cellRatio Xp (primorial w) (M N) (J N) z.2 hW hXp
|
| 278 |
+
{k | ((d.atTime N).localModel z).modelSuccess (coord D) (k:ℤ) s r hs
|
| 279 |
+
(FiniteModelSlots.formula D s r hs Fs q₀ b₀) Fs q₀ b₀ τ}≤c}) ≤
|
| 280 |
+
(slotCount D s r hs Fs q₀ b₀:ℝ)*
|
| 281 |
+
(μ.real {z | z.1∈E ∧ pivotProperty D s r hs Fs b₀ G₀ Γ₀ M H g₀ x₀ obs₀ ht N z.1 z.2 τ}+
|
| 282 |
+
4*(primorial w:ℝ)*(slotBudget D s r hs Fs q₀ b₀:ℝ)*(L N:ℝ)/Xp)
|
| 283 |
+
:= by
|
| 284 |
+
dsimp only
|
| 285 |
+
let d:=family D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L (heightCoeff D q₀ ht) g₀ x₀ obs₀
|
| 286 |
+
let μ:=jointLaw X Xp (primorial w) hW hX hXp
|
| 287 |
+
let slot:=rawSlot D s r hs Fs q₀ b₀ L ht N
|
| 288 |
+
let A:=pivotSet D s r hs Fs b₀ G₀ Γ₀ M H g₀ x₀ obs₀ ht N τ
|
| 289 |
+
let B:ℝ:=(slotBudget D s r hs Fs q₀ b₀:ℝ)*(L N:ℝ)
|
| 290 |
+
let bad : Set ((Fin a→ℕ)×ℕ):={z |
|
| 291 |
+
cellRatio Xp (primorial w) (M N) (J N) z.2 hW hXp
|
| 292 |
+
{k | ((d.atTime N).localModel z).modelSuccess (coord D) (k:ℤ) s r hs
|
| 293 |
+
(FiniteModelSlots.formula D s r hs Fs q₀ b₀) Fs q₀ b��� τ}≤c}
|
| 294 |
+
have hbudget0 : 0 ≤ slotBudget D s r hs Fs q₀ b₀:=
|
| 295 |
+
Finset.sum_nonneg (fun v hv=>Finset.sum_nonneg (fun e he=>abs_nonneg _))
|
| 296 |
+
have hbudget (v : Slots D) (hv : v∈slots D s r hs Fs q₀ b₀) :
|
| 297 |
+
(∑ e,|v e|) ≤ slotBudget D s r hs Fs q₀ b₀:= by
|
| 298 |
+
unfold slotBudget
|
| 299 |
+
exact Finset.single_le_sum (f:=fun v : Slots D=>∑ e,|v e|)
|
| 300 |
+
(fun v hv=>Finset.sum_nonneg (fun e he=>abs_nonneg (v e))) hv
|
| 301 |
+
have hB : 0≤B:=mul_nonneg (by exact_mod_cast hbudget0) (by exact_mod_cast hL.le)
|
| 302 |
+
have hunits (y : Fin a→ℕ) (hy : y∈outsideDomain X (primorial w)) (j : Fin a) :
|
| 303 |
+
IsCoprime (y j:ℤ) (L N) := by
|
| 304 |
+
have hj:=(Finset.mem_filter.mp (Fintype.mem_piFinset.mp hy j)).2
|
| 305 |
+
apply (RoughScales.coprime_smooth_rough hsm _).symm
|
| 306 |
+
apply (RoughScales.rough_iff_coprime w (y j:ℤ)).mpr
|
| 307 |
+
simpa only [Int.natAbs_natCast] using hj.symm
|
| 308 |
+
have ht₁:=(source_terminal_arithmetic D (outcomeScales D s r hs Fs b₀)).choose_spec.2
|
| 309 |
+
q₀ hq₀ hQq w hw 1 (by simp [outcomeScales]) (by intro j;exact zero_lt_one)
|
| 310 |
+
(ht N) (fun _=>1) hht hratio
|
| 311 |
+
have hcoeff : ∀ e,(primorial w:ℤ)∣heightCoeff D q₀ ht N e := by
|
| 312 |
+
intro e
|
| 313 |
+
simpa [heightCoeff,coefficient,height] using ht₁.1 e
|
| 314 |
+
have hslot : ∀ v y,y∈outsideDomain X (primorial w) →
|
| 315 |
+
(primorial w:ℤ)∣slot v y ∧ |(slot v y:ℝ)|≤B := by
|
| 316 |
+
intro i y hy
|
| 317 |
+
let v:=((Fintype.equivFin {v : Slots D // v∈slots D s r hs Fs q₀ b₀}).symm i).val
|
| 318 |
+
have hv : v∈slots D s r hs Fs q₀ b₀:=((Fintype.equivFin _).symm i).property
|
| 319 |
+
change (primorial w:ℤ)∣slotValue D (L N) (heightCoeff D q₀ ht N) (fun j=>(y j:ℤ)) v ∧ _
|
| 320 |
+
by_cases hn : Nonempty (Fin D.targets)
|
| 321 |
+
· let t:=Classical.choice hn
|
| 322 |
+
have hh:=(source_exposure_slots D (L N) (primorial w:ℤ) hL hWL (heightCoeff D q₀ ht N) hcoeff
|
| 323 |
+
(fun j=>(y j:ℤ)) (fun j=>(y j:ℤ)) (hunits y hy) t
|
| 324 |
+
(fun j hj=>Int.ModEq.refl _) (fun j hj=>rfl) hd).2.2 v
|
| 325 |
+
refine ⟨hh.2.1,?_⟩
|
| 326 |
+
have hbi:=hh.2.2.trans (mul_le_mul_of_nonneg_right (hbudget v hv) hL.le)
|
| 327 |
+
change |(slotValue D (L N) (heightCoeff D q₀ ht N) (fun j=>(y j:ℤ)) v:ℝ)|≤_
|
| 328 |
+
dsimp only [B]
|
| 329 |
+
exact_mod_cast hbi
|
| 330 |
+
· let : IsEmpty (Fin D.pairs):=⟨fun e=>hn ⟨D.owner e⟩⟩
|
| 331 |
+
simp only [slotValue,Finset.univ_eq_empty,Finset.sum_empty,dvd_zero,true_and]
|
| 332 |
+
change |((∑ e,v e*rValue D (L N) (heightCoeff D q₀ ht N) (fun j=>(y j:ℤ)) e:ℤ):ℝ)|≤B
|
| 333 |
+
simpa using hB
|
| 334 |
+
have ho : ∀ᵐ z ∂μ,z.1∈outsideDomain X (primorial w) :=
|
| 335 |
+
(measurePreserving_fst (μ:=outsideLaw X (primorial w) hW hX)
|
| 336 |
+
(ν:=(law Xp (primorial w) hW hXp:Measure ℕ))).quasiMeasurePreserving.ae
|
| 337 |
+
(outside_ae_domain X (primorial w) hW hX)
|
| 338 |
+
have hbad : μ.real {z | conditionalSlotMass X Xp (primorial w) (M N) (J N) hW hX hXp slot A z≤c}≤μ.real bad := by
|
| 339 |
+
apply ENNReal.toReal_mono (by finiteness)
|
| 340 |
+
apply measure_mono_ae
|
| 341 |
+
filter_upwards [ho] with z hz
|
| 342 |
+
intro hpost
|
| 343 |
+
have hh:=source_posterior_domination D s r hs Fs q₀ b₀ G₀ Γ₀ M J R H L g₀ x₀ obs₀ ht
|
| 344 |
+
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
|
| 345 |
+
(fun v hv=>(mul_le_mul_of_nonneg_right (hbudget v hv) hL.le).trans_lt hlarge) τ
|
| 346 |
+
exact hh.trans hpost
|
| 347 |
+
have hh:=raw_pivot_extension X Xp (primorial w) (M N) (J N) hW hX hXp E A slot B c hB hc hslot
|
| 348 |
+
change c*(μ.real {z | z.1∈E}-μ.real bad)≤_
|
| 349 |
+
apply le_trans (mul_le_mul_of_nonneg_left (sub_le_sub_left hbad _) hc)
|
| 350 |
+
apply hh.trans
|
| 351 |
+
apply mul_le_mul_of_nonneg_left _ (by positivity)
|
| 352 |
+
have hp : μ.real {z | z.1∈E ∧ (z.2:ℤ)∈A z.1}≤
|
| 353 |
+
μ.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
|
| 354 |
+
refine measureReal_mono ?_ (by finiteness)
|
| 355 |
+
rintro z ⟨hz,hp⟩
|
| 356 |
+
exact ⟨hz,hp.2⟩
|
| 357 |
+
have he : 4*(primorial w:ℝ)*B/Xp=4*(primorial w:ℝ)*(slotBudget D s r hs Fs q₀ b₀:ℝ)*(L N:ℝ)/Xp := by
|
| 358 |
+
dsimp [B]
|
| 359 |
+
ring
|
| 360 |
+
rw [he]
|
| 361 |
+
exact add_le_add hp le_rfl
|
| 362 |
+
|
| 363 |
+
end SourceIntegerArrays.GlobalJoint.SourceFrozenFamily
|
| 364 |
+
|
| 365 |
+
end
|
| 366 |
+
end
|
| 367 |
+
|
| 368 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PivotPaths01.lean
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.IntegerArrays14
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
section
|
| 9 |
+
noncomputable section
|
| 10 |
+
open scoped BigOperators BoundedContinuousFunction Topology NNReal ENNReal
|
| 11 |
+
end
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
noncomputable section
|
| 20 |
+
open Filter MeasureTheory
|
| 21 |
+
open scoped BigOperators ENNReal Topology
|
| 22 |
+
namespace SourceRawPrefix
|
| 23 |
+
variable {n : ℕ}
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def Earlier (i : Fin n) (E : Set (Fin n → ℕ)) : Prop :=
|
| 27 |
+
∀ u v, (∀ j, j < i → u j = v j) → (u ∈ E ↔ v ∈ E)
|
| 28 |
+
|
| 29 |
+
def Through (i : Fin n) (E : Set (Fin n → ℕ)) : Prop :=
|
| 30 |
+
∀ u v, (∀ j, j ≤ i → u j = v j) → (u ∈ E ↔ v ∈ E)
|
| 31 |
+
|
| 32 |
+
lemma Earlier.update_iff {i : Fin n} {E : Set (Fin n → ℕ)} (hE : Earlier i E)
|
| 33 |
+
(u : Fin n → ℕ) (x : ℕ) : Function.update u i x ∈ E ↔ u ∈ E := by
|
| 34 |
+
apply hE
|
| 35 |
+
intro j hj
|
| 36 |
+
exact Function.update_of_ne (ne_of_lt hj) _ _
|
| 37 |
+
|
| 38 |
+
lemma Through.earlier {i j : Fin n} {E : Set (Fin n → ℕ)} (hE : Through i E)
|
| 39 |
+
(hij : i < j) : Earlier j E := by
|
| 40 |
+
intro u v huv
|
| 41 |
+
apply hE
|
| 42 |
+
intro k hk
|
| 43 |
+
exact huv k (hk.trans_lt hij)
|
| 44 |
+
|
| 45 |
+
lemma earlier_univ (i : Fin n) : Earlier i Set.univ := by
|
| 46 |
+
intro u v h
|
| 47 |
+
simp
|
| 48 |
+
|
| 49 |
+
lemma through_inter {i : Fin n} {E F : Set (Fin n → ℕ)}
|
| 50 |
+
(hE : Through i E) (hF : Through i F) : Through i (E ∩ F) := by
|
| 51 |
+
intro u v h
|
| 52 |
+
exact and_congr (hE u v h) (hF u v h)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
theorem resample_preserves (ν : Fin n → Measure ℕ) [∀ i, IsProbabilityMeasure (ν i)]
|
| 57 |
+
(i : Fin n) :
|
| 58 |
+
MeasurePreserving (fun z : (Fin n → ℕ) × ℕ => Function.update z.1 i z.2)
|
| 59 |
+
((Measure.pi ν).prod (ν i)) (Measure.pi ν) := by
|
| 60 |
+
refine ⟨measurable_of_countable _, ?_⟩
|
| 61 |
+
apply Measure.ext_of_singleton
|
| 62 |
+
intro u
|
| 63 |
+
rw [Measure.map_apply (measurable_of_countable _) (measurableSet_singleton _)]
|
| 64 |
+
have he : (fun z : (Fin n → ℕ) × ℕ => Function.update z.1 i z.2) ⁻¹' {u} =
|
| 65 |
+
(Set.univ.pi (Function.update (fun j => {u j}) i Set.univ)) ×ˢ {u i} := by
|
| 66 |
+
ext z
|
| 67 |
+
simp only [Set.mem_preimage, Set.mem_singleton_iff, Set.mem_prod,
|
| 68 |
+
Set.mem_pi, Set.mem_univ, forall_true_left]
|
| 69 |
+
constructor
|
| 70 |
+
· intro hz
|
| 71 |
+
constructor
|
| 72 |
+
· intro j
|
| 73 |
+
by_cases hji : j = i
|
| 74 |
+
· subst j; simp
|
| 75 |
+
· simpa [Function.update_of_ne hji] using congrFun hz j
|
| 76 |
+
· simpa using congrFun hz i
|
| 77 |
+
· rintro ⟨hy,hx⟩
|
| 78 |
+
ext j
|
| 79 |
+
by_cases hji : j = i
|
| 80 |
+
· subst j; simpa using hx
|
| 81 |
+
· simpa [Function.update_of_ne hji] using hy j
|
| 82 |
+
rw [he, Measure.prod_prod, Measure.pi_pi, Measure.pi_singleton]
|
| 83 |
+
have hf : (fun j => ν j (Function.update (fun k : Fin n => ({u k} : Set ℕ)) i (Set.univ : Set ℕ) j)) =
|
| 84 |
+
Function.update (fun j => ν j {u j}) i 1 := by
|
| 85 |
+
funext j
|
| 86 |
+
by_cases hji : j = i
|
| 87 |
+
· subst j; simp
|
| 88 |
+
· simp [hji]
|
| 89 |
+
rw [hf, Finset.prod_update_of_mem (Finset.mem_univ i)]
|
| 90 |
+
simp only [one_mul]
|
| 91 |
+
simpa only [Finset.sdiff_singleton_eq_erase] using Finset.prod_erase_mul Finset.univ (fun j => ν j {u j}) (Finset.mem_univ i)
|
| 92 |
+
|
| 93 |
+
open RawHarmonicProbability ProductExposureLaw
|
| 94 |
+
|
| 95 |
+
lemma raw_resample (X : Fin n → ℕ) (W : ℕ) (hW : 0 < W)
|
| 96 |
+
(hX : ∀ j, 4*W ≤ X j) (i : Fin n) :
|
| 97 |
+
MeasurePreserving (fun z : (Fin n → ℕ) × ℕ => Function.update z.1 i z.2)
|
| 98 |
+
(jointLaw X (X i) W hW hX (hX i)) (outsideLaw X W hW hX) :=
|
| 99 |
+
resample_preserves (fun j => (law (X j) W hW (hX j) : Measure ℕ)) i
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
lemma raw_resample_real (X : Fin n → ℕ) (W : ℕ) (hW : 0 < W)
|
| 103 |
+
(hX : ∀ j, 4*W ≤ X j) (i : Fin n) (E : Set (Fin n → ℕ)) :
|
| 104 |
+
(jointLaw X (X i) W hW hX (hX i)).real
|
| 105 |
+
{z | Function.update z.1 i z.2 ∈ E} = (outsideLaw X W hW hX).real E := by
|
| 106 |
+
apply congrArg ENNReal.toReal
|
| 107 |
+
exact (raw_resample X W hW hX i).measure_preimage (Set.to_countable E).measurableSet.nullMeasurableSet
|
| 108 |
+
|
| 109 |
+
end SourceRawPrefix
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
noncomputable section
|
| 118 |
+
open scoped BigOperators Topology BoundedContinuousFunction
|
| 119 |
+
namespace SourcePivotPaths
|
| 120 |
+
open ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScales
|
| 121 |
+
open ConstructedWordPlan.RationalPivotPlan
|
| 122 |
+
open ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmetic
|
| 123 |
+
open SourceIntegerArrays.GlobalJoint.SourceFrozenFamily
|
| 124 |
+
open SourceRawPrefix
|
| 125 |
+
attribute [local instance] Classical.propDecidable
|
| 126 |
+
variable {a : ℕ} (D : Pivot a) (r : ℕ)
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
abbrev ScalarModels := Fin D.targets → ℚ → Fin r → ℤ → ℝ
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def comparison (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a)
|
| 134 |
+
(u : Fin a → ℕ) (x : ℕ) (τ : ℝ) : Prop :=
|
| 135 |
+
∀ (t : Fin D.targets) (U : OwnSubset D t) (c : Fin r),
|
| 136 |
+
let av := blockProduct b (block D.index D.tail t)
|
| 137 |
+
∃ Δ : ℤ,
|
| 138 |
+
(Δ : ℚ) = ∑ e ∈ U.val,
|
| 139 |
+
((height ht (D.added e) : ℚ)*blockProduct b (D.added e)/
|
| 140 |
+
((height ht (block D.index D.tail (D.owner e)) : ℚ)*
|
| 141 |
+
blockProduct b (block D.index D.tail (D.owner e))))*
|
| 142 |
+
(height (fun j => (u j : ℤ)) (D.added e) : ℚ) ∧
|
| 143 |
+
(2*τ < S t av c (height (fun j => (u j : ℤ)) (D.tail t)*(x : ��)) →
|
| 144 |
+
τ < S t av c (height (fun j => (u j : ℤ)) (D.tail t)*(x : ℤ)+Δ))
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
def outcome (Fs : Finset (Scale a)) (S : ScalarModels D r) (ht : Fin a → ℤ)
|
| 148 |
+
(b : Scale a) (p : Path D) (u : Fin a → ℕ) (x : ℕ) (τ : ℝ) : Prop :=
|
| 149 |
+
∀ d ∈ Fs, comparison D r S ht (scaleRun D 0 p b*d) u x τ
|
| 150 |
+
|
| 151 |
+
def success (s : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a))
|
| 152 |
+
(S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a)
|
| 153 |
+
(u : Fin a → ℕ) (x : ℕ) (τ : ℝ) : Prop :=
|
| 154 |
+
∃ p ∈ pivotOptions s r hs D Fs, outcome D r Fs S ht b p u x τ
|
| 155 |
+
|
| 156 |
+
lemma comparison_congr (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a)
|
| 157 |
+
(u v : Fin a → ℕ) (huv : ∀ j, j < D.index → u j = v j) (x : ℕ) (τ : ℝ) :
|
| 158 |
+
comparison D r S ht b u x τ ↔ comparison D r S ht b v x τ := by
|
| 159 |
+
have ha (e) : height (fun j => (u j : ℤ)) (D.added e) =
|
| 160 |
+
height (fun j => (v j : ℤ)) (D.added e) := by
|
| 161 |
+
apply Finset.prod_congr rfl
|
| 162 |
+
intro j hj
|
| 163 |
+
exact congrArg (fun m : ℕ => (m : ℤ)) (huv j (D.added_lt e j hj))
|
| 164 |
+
have ht' (t) : height (fun j => (u j : ℤ)) (D.tail t) =
|
| 165 |
+
height (fun j => (v j : ℤ)) (D.tail t) := by
|
| 166 |
+
apply Finset.prod_congr rfl
|
| 167 |
+
intro j hj
|
| 168 |
+
exact congrArg (fun m : ℕ => (m : ℤ)) (huv j (D.tail_lt t j hj))
|
| 169 |
+
simp only [comparison, ha, ht']
|
| 170 |
+
|
| 171 |
+
lemma comparison_through (S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (τ : ℝ) :
|
| 172 |
+
Through D.index {u | comparison D r S ht b u (u D.index) τ} := by
|
| 173 |
+
intro u v huv
|
| 174 |
+
change comparison D r S ht b u (u D.index) τ ↔ comparison D r S ht b v (v D.index) τ
|
| 175 |
+
rw [huv D.index le_rfl]
|
| 176 |
+
exact comparison_congr D r S ht b u v (fun j hj => huv j hj.le) _ τ
|
| 177 |
+
|
| 178 |
+
lemma outcome_through (Fs : Finset (Scale a)) (S : ScalarModels D r)
|
| 179 |
+
(ht : Fin a → ℤ) (b : Scale a) (p : Path D) (τ : ℝ) :
|
| 180 |
+
Through D.index {u | outcome D r Fs S ht b p u (u D.index) τ} := by
|
| 181 |
+
intro u v huv
|
| 182 |
+
simp only [Set.mem_ofPred_eq, outcome]
|
| 183 |
+
apply forall_congr'
|
| 184 |
+
intro d
|
| 185 |
+
apply forall_congr'
|
| 186 |
+
intro hd
|
| 187 |
+
exact comparison_through D r S ht _ τ u v huv
|
| 188 |
+
|
| 189 |
+
lemma success_through (s : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a))
|
| 190 |
+
(S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (τ : ℝ) :
|
| 191 |
+
Through D.index {u | success D r s hs Fs S ht b u (u D.index) τ} := by
|
| 192 |
+
intro u v huv
|
| 193 |
+
simp only [Set.mem_ofPred_eq, success]
|
| 194 |
+
apply exists_congr
|
| 195 |
+
intro p
|
| 196 |
+
apply and_congr_right
|
| 197 |
+
intro hp
|
| 198 |
+
exact outcome_through D r Fs S ht b p τ u v huv
|
| 199 |
+
|
| 200 |
+
lemma success_update_iff (s : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a))
|
| 201 |
+
(S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a)
|
| 202 |
+
(u : Fin a → ℕ) (x : ℕ) (τ : ℝ) :
|
| 203 |
+
success D r s hs Fs S ht b (Function.update u D.index x) x τ ↔
|
| 204 |
+
success D r s hs Fs S ht b u x τ := by
|
| 205 |
+
simp only [success, outcome]
|
| 206 |
+
apply exists_congr
|
| 207 |
+
intro p
|
| 208 |
+
apply and_congr_right
|
| 209 |
+
intro hp
|
| 210 |
+
apply forall_congr'
|
| 211 |
+
intro d
|
| 212 |
+
apply forall_congr'
|
| 213 |
+
intro hd
|
| 214 |
+
apply comparison_congr
|
| 215 |
+
intro j hj
|
| 216 |
+
exact Function.update_of_ne (ne_of_lt hj) _ _
|
| 217 |
+
|
| 218 |
+
section OriginalModels
|
| 219 |
+
variable (s : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (b : Scale a)
|
| 220 |
+
variable (G : Fin D.targets → ℚ → Fin r → Type)
|
| 221 |
+
[∀ t v c, Group (G t v c)] [∀ t v c, TopologicalSpace (G t v c)]
|
| 222 |
+
(Γ : ∀ t v c, Subgroup (G t v c))
|
| 223 |
+
(M H : ℕ → ℕ) (ht : ℕ → Fin a → ℤ)
|
| 224 |
+
(g x : ∀ t, ℕ → ∀ v c, ℤ → ℤ → G t v c)
|
| 225 |
+
(F : ∀ t, ℕ → ∀ v c, ℤ → ℤ → ((G t v c) ⧸ Γ t v c) →ᵇ ℝ)
|
| 226 |
+
|
| 227 |
+
def scalarModels (N : ℕ) : ScalarModels D r :=
|
| 228 |
+
fun t v c k => SourceIntegerArrays.pieceModel (Γ t v c) (M N) (H N)
|
| 229 |
+
(g t N v c) (x t N v c) (fun b r => F t N v c b r) k
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
lemma original_success (N : ℕ) (u : Fin a → ℕ) (xp : ℕ) (τ : ℝ) :
|
| 233 |
+
pivotProperty D s r hs Fs b G Γ M H
|
| 234 |
+
(fun t N _ => g t N) (fun t N _ => x t N) (fun t N _ => F t N) ht N u xp τ ↔
|
| 235 |
+
success D r s hs Fs (scalarModels D r G Γ M H g x F N) (ht N) b u xp τ := by
|
| 236 |
+
simp only [pivotProperty, success]
|
| 237 |
+
apply exists_congr
|
| 238 |
+
intro p
|
| 239 |
+
apply and_congr_right
|
| 240 |
+
intro hp
|
| 241 |
+
constructor
|
| 242 |
+
· intro h d hd t U c
|
| 243 |
+
exact h (⟨d,hd⟩,⟨t,U⟩,c)
|
| 244 |
+
· intro h i
|
| 245 |
+
exact h i.1.val i.1.property i.2.1.1 i.2.1.2 i.2.2
|
| 246 |
+
end OriginalModels
|
| 247 |
+
|
| 248 |
+
open MeasureTheory ProductExposureLaw RawHarmonicProbability
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
theorem success_mass_resample (s : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a))
|
| 253 |
+
(S : ScalarModels D r) (ht : Fin a → ℤ) (b : Scale a) (τ : ℝ)
|
| 254 |
+
(X : Fin a → ℕ) (W : ℕ) (hW : 0 < W) (hX : ∀ j, 4*W ≤ X j)
|
| 255 |
+
(E : Set (Fin a → ℕ)) (hE : Earlier D.index E) :
|
| 256 |
+
(jointLaw X (X D.index) W hW hX (hX D.index)).real
|
| 257 |
+
{z | z.1 ∈ E ∧ success D r s hs Fs S ht b z.1 z.2 τ} =
|
| 258 |
+
(outsideLaw X W hW hX).real
|
| 259 |
+
{u | u ∈ E ∧ success D r s hs Fs S ht b u (u D.index) τ} := by
|
| 260 |
+
rw [← raw_resample_real X W hW hX D.index]
|
| 261 |
+
congr 1
|
| 262 |
+
ext z
|
| 263 |
+
simp only [Set.mem_ofPred_eq, Function.update_self, hE.update_iff,
|
| 264 |
+
success_update_iff]
|
| 265 |
+
|
| 266 |
+
end SourcePivotPaths
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
end
|
| 273 |
+
end
|
| 274 |
+
end
|
| 275 |
+
|
| 276 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PivotPaths02.lean
ADDED
|
@@ -0,0 +1,406 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.HierarchyRates01
|
| 3 |
+
import OAI.Combinatorics.SumProduct.Alignment.PivotPaths01
|
| 4 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
section
|
| 10 |
+
noncomputable section
|
| 11 |
+
open Filter MeasureTheory
|
| 12 |
+
open scoped BigOperators ENNReal Topology
|
| 13 |
+
noncomputable section
|
| 14 |
+
open scoped BigOperators Topology BoundedContinuousFunction
|
| 15 |
+
noncomputable section
|
| 16 |
+
open scoped BigOperators BoundedContinuousFunction Topology NNReal ENNReal
|
| 17 |
+
namespace SourceIntegerArrays.GlobalJoint.SourceFrozenFamily
|
| 18 |
+
open ProductExposureLabels ProductExposureLaw SourceExposureSlots SourceResidueAlignment
|
| 19 |
+
open ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScales
|
| 20 |
+
open ConstructedWordPlan.RationalPivotPlan
|
| 21 |
+
open ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmetic
|
| 22 |
+
open RawHarmonicProbability
|
| 23 |
+
attribute [local instance] Classical.propDecidable
|
| 24 |
+
variable {a : ℕ} (D : Pivot a)
|
| 25 |
+
|
| 26 |
+
variable (s r : ℕ) (hs : 1 ≤ s) (Fs : Finset (Scale a)) (q₀ : ℕ) (b₀ : Scale a)
|
| 27 |
+
local notation "I" => FiniteModelSlots.Index D s r hs Fs q₀ b₀
|
| 28 |
+
|
| 29 |
+
open Filter MeasureTheory RationalLattice MalcevCharacters
|
| 30 |
+
open MicrocellScale AdmissibleMicrocellBoundary RoughScales IntegerAlignment
|
| 31 |
+
open RoughSamplingWeights SourceMacroSelection
|
| 32 |
+
|
| 33 |
+
section Harmonic
|
| 34 |
+
variable (G₀ : Fin D.targets → ℚ → Fin r → Type)
|
| 35 |
+
variable [∀ t v c, Group (G₀ t v c)] [∀ t v c, TopologicalSpace (G₀ t v c)]
|
| 36 |
+
variable [∀ t v c, IsTopologicalGroup (G₀ t v c)]
|
| 37 |
+
variable (Γ₀ : ∀ t v c, Subgroup (G₀ t v c))
|
| 38 |
+
variable (n₀ : Fin D.targets → ℚ → Fin r → ℕ)
|
| 39 |
+
variable (c₀ : ∀ t v c, RealCoordinates (G₀ t v c) (n₀ t v c))
|
| 40 |
+
variable (hsk : ∀ t v c, SecondKind (c₀ t v c))
|
| 41 |
+
variable (A₀ : ∀ t v c, CubeFaces.Filtration (G₀ t v c))
|
| 42 |
+
variable (weight : ∀ t v c, Fin (n₀ t v c) → ℕ)
|
| 43 |
+
variable (hA : ∀ t v c k (g : G₀ t v c), g ∈ (A₀ t v c).level k ↔
|
| 44 |
+
∀ j, weight t v c j < k → (c₀ t v c).coord g j = 0)
|
| 45 |
+
variable (hw : ∀ t v c j, 0 < weight t v c j)
|
| 46 |
+
include hsk hA hw
|
| 47 |
+
open SourcePivotPaths SourceRawPrefix
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
theorem source_uniform_prefix_extension
|
| 52 |
+
(hΓ : ∀ t v c g, g ∈ Γ₀ t v c ↔ ∀ j, ∃ z : ℤ, (c₀ t v c).coord g j = z)
|
| 53 |
+
(hmono : ∀ t v c, Monotone (weight t v c))
|
| 54 |
+
(h0 : ∀ t v c, (A₀ t v c).level 0 = ⊤)
|
| 55 |
+
(h1 : ∀ t v c, (A₀ t v c).level 1 = ⊤)
|
| 56 |
+
(hstep : ∀ t v c, (A₀ t v c).level (s+1) = ⊥)
|
| 57 |
+
(M J R H : ℕ → ℕ) (L : ℕ → ℤ) (ht : ℕ → Fin a → ℤ)
|
| 58 |
+
(g₀ x₀ : ∀ t, ℕ → ∀ v c, ℤ → ℤ → G₀ t v c)
|
| 59 |
+
(obs₀ : ∀ t, ℕ → ∀ v c, ℤ → ℤ → ((G₀ t v c) ⧸ Γ₀ t v c) →ᵇ ℝ)
|
| 60 |
+
(w0 : ℕ → ℕ) (X : ℕ → Fin a → ℕ)
|
| 61 |
+
(hw0 : Tendsto w0 atTop atTop)
|
| 62 |
+
(hX : ∀ N j, 4*primorial (w0 N) ≤ X N j)
|
| 63 |
+
(hXt : ∀ j, Tendsto (fun N => X N j) atTop atTop)
|
| 64 |
+
(hWM : ∀ N, (primorial (w0 N) : ℤ) ∣ (M N : ℤ))
|
| 65 |
+
(hM : ∀ N, 0 < M N) (hMs : ∀ N, RoughScales.Smooth (w0 N) (M N : ℤ))
|
| 66 |
+
(hJ : ∀ N, 0 < J N) (hRJ : ∀ N, R N = M N*J N)
|
| 67 |
+
(hL : ∀ N, 0 < L N) (hsm : ∀ N, RoughScales.Smooth (w0 N) (L N))
|
| 68 |
+
(hWL : ∀ N, (primorial (w0 N) : ℤ) ∣ L N) (hML : ∀ N, (M N : ℤ) ∣ L N)
|
| 69 |
+
(hLexact : ∀ N, L N = (M N : ℤ)*(primorial (w0 N) : ℤ)^(w0 N))
|
| 70 |
+
(hXL : ∀ t (j : Fin (m D t)), Tendsto (fun N =>
|
| 71 |
+
(X N (perm D t (j.castAdd (h D t))) : ℝ)/(L N : ℝ)) atTop atTop)
|
| 72 |
+
(hH : ∀ N, 0 < H N) (hRrad : ∀ N, R N = radius (M N) (H N))
|
| 73 |
+
(hdom : Dominates (fun N => (H N : ℝ)) (earlierScale M (fun N => previousProduct D (X N))))
|
| 74 |
+
(hxdom : Dominates (fun N => Real.log (X N D.index : ℝ)) (fun N => (H N : ℝ)))
|
| 75 |
+
(hpowWM : ∀ N, primorial (w0 N)^(w0 N) ∣ M N)
|
| 76 |
+
(hq₀ : 0 < q₀) (hht : ∀ N j, 0 < ht N j)
|
| 77 |
+
(hheight : ∀ N e, height (ht N) (D.added e) ≤ M N)
|
| 78 |
+
(hd : ∀ e, Disjoint (D.added e) (D.tail (D.owner e)))
|
| 79 |
+
(hQq : terminalDenom D s r hs Fs b₀ ∣ q₀)
|
| 80 |
+
(hb₀ : ∀ j, 0 < b₀ j) (hFs : ∀ b ∈ Fs, ∀ j, 0 < b j)
|
| 81 |
+
(hratio : ∀ N e, ∃ d : ℤ, height (ht N) (D.added e) =
|
| 82 |
+
height (ht N) (block D.index D.tail (D.owner e)) * ((primorial (w0 N) : ℤ)^(w0 N) * d))
|
| 83 |
+
(metric : ∀ t v c, MetricSpace ((G₀ t v c) ⧸ Γ₀ t v c))
|
| 84 |
+
(hmetric : ∀ t v c, QuotientGroup.instTopologicalSpace (Γ₀ t v c) =
|
| 85 |
+
(metric t v c).toUniformSpace.toTopologicalSpace) :
|
| 86 |
+
letI : ∀ t v c, MetricSpace ((G₀ t v c) ⧸ Γ₀ t v c) :=
|
| 87 |
+
fun t v c => (metric t v c).replaceTopology (hmetric t v c)
|
| 88 |
+
∀ (Kobs : ℝ≥0) (Bobs : ℝ),
|
| 89 |
+
(∀ t N v c b r', LipschitzWith Kobs (obs₀ t N v c b r')) →
|
| 90 |
+
(∀ t N v c b r' z, |obs₀ t N v c b r' z| ≤ Bobs) →
|
| 91 |
+
∀ (Bs : Finset (Scale a)), b₀ ∈ Bs →
|
| 92 |
+
pivotModulus s r hs D Fs Bs ∣ q₀ → ∀ (τ : ℝ), 0 < τ →
|
| 93 |
+
∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ E : Set (Fin a → ℕ), Earlier D.index E →
|
| 94 |
+
let μ := outsideLaw (X N) (primorial (w0 N)) (primorial_pos _) (hX N)
|
| 95 |
+
let Q : ℝ := (pivotOptions s r hs D Fs).card
|
| 96 |
+
(Q⁻¹/3/Q)*μ.real E ≤ μ.real {u | u ∈ E ∧
|
| 97 |
+
success D r s hs Fs (scalarModels D r G₀ Γ₀ M H g₀ x₀ obs₀ N) (ht N) b₀ u (u D.index) τ} + ε := by
|
| 98 |
+
let : ∀ t v c, MetricSpace ((G₀ t v c) ⧸ Γ₀ t v c) :=
|
| 99 |
+
fun t v c => (metric t v c).replaceTopology (hmetric t v c)
|
| 100 |
+
intro Kobs Bobs hLip hBound Bs hb hq τ hτ ε hε
|
| 101 |
+
let Q : ℝ := (pivotOptions s r hs D Fs).card
|
| 102 |
+
have hQ : 0 < Q := by
|
| 103 |
+
dsimp only [Q]
|
| 104 |
+
exact_mod_cast Finset.card_pos.mpr (pivotOptions_nonempty s r hs D Fs)
|
| 105 |
+
have hV : (slotCount D s r hs Fs q₀ b₀ : ℝ) ≤ Q := by
|
| 106 |
+
have hh : slotCount D s r hs Fs q₀ b₀ ≤ (pivotOptions s r hs D Fs).card := by
|
| 107 |
+
dsimp only [slotCount]
|
| 108 |
+
rw [Fintype.card_coe (slots D s r hs Fs q₀ b₀)]
|
| 109 |
+
unfold slots
|
| 110 |
+
exact Finset.card_image_le
|
| 111 |
+
dsimp only [Q]
|
| 112 |
+
exact_mod_cast hh
|
| 113 |
+
have hExt := source_uniform_extension D s r hs Fs q₀ b₀ G₀ Γ₀ n₀ c₀ hsk A₀ weight hA hw
|
| 114 |
+
hΓ hmono h0 h1 hstep M J R H L ht (fun t N _ => g₀ t N) (fun t N _ => x₀ t N)
|
| 115 |
+
(fun t N _ => obs₀ t N) w0 (fun N => X N D.index) X hw0 hX (fun N => hX N D.index)
|
| 116 |
+
hXt (hXt D.index) hWM hM hMs hJ hRJ hL hsm hWL hML hLexact hXL hH hRrad hdom hxdom
|
| 117 |
+
hpowWM hq₀ hht hheight hd hQq hb₀ hFs hratio metric hmetric Kobs Bobs
|
| 118 |
+
(fun t N _ v c b r' => hLip t N v c b r')
|
| 119 |
+
(fun t N _ v c b r' z => hBound t N v c b r' z)
|
| 120 |
+
Bs hb hq τ hτ (ε*Q) (mul_pos hε hQ)
|
| 121 |
+
filter_upwards [hExt] with N hN
|
| 122 |
+
intro E hE
|
| 123 |
+
let μ := outsideLaw (X N) (primorial (w0 N)) (primorial_pos _) (hX N)
|
| 124 |
+
let ν := jointLaw (X N) (X N D.index) (primorial (w0 N)) (primorial_pos _) (hX N) (hX N D.index)
|
| 125 |
+
let S := scalarModels D r G₀ Γ₀ M H g₀ x₀ obs₀ N
|
| 126 |
+
have hEarly : ν.real {z | z.1 ∈ E} = μ.real E := by
|
| 127 |
+
apply congrArg ENNReal.toReal
|
| 128 |
+
exact (measurePreserving_fst (μ := μ)
|
| 129 |
+
(ν := (law (X N D.index) (primorial (w0 N)) (primorial_pos _) (hX N D.index) : Measure ℕ))).measure_preimage
|
| 130 |
+
(Set.to_countable E).measurableSet.nullMeasurableSet
|
| 131 |
+
have he := hN E
|
| 132 |
+
simp_rw [original_success] at he
|
| 133 |
+
change (Q⁻¹/3)*ν.real {z | z.1 ∈ E} ≤ (slotCount D s r hs Fs q₀ b₀ : ℝ)*
|
| 134 |
+
ν.real {z | z.1 ∈ E ∧ success D r s hs Fs S (ht N) b₀ z.1 z.2 τ}+ε*Q at he
|
| 135 |
+
rw [hEarly, success_mass_resample D r s hs Fs S (ht N) b₀ τ (X N)
|
| 136 |
+
(primorial (w0 N)) (primorial_pos _) (hX N) E hE] at he
|
| 137 |
+
have hem := mul_le_mul_of_nonneg_right hV
|
| 138 |
+
(show 0 ≤ μ.real {u | u ∈ E ∧ success D r s hs Fs S (ht N) b₀ u (u D.index) τ} from measureReal_nonneg)
|
| 139 |
+
change (Q⁻¹/3/Q)*μ.real E ≤ μ.real {u | u ∈ E ∧
|
| 140 |
+
success D r s hs Fs S (ht N) b₀ u (u D.index) τ}+ε
|
| 141 |
+
apply (mul_le_mul_iff_right₀ hQ).mp
|
| 142 |
+
calc
|
| 143 |
+
_ = (Q⁻¹/3)*μ.real E := by field_simp
|
| 144 |
+
_ ≤ Q*μ.real {u | u ∈ E ∧ success D r s hs Fs S (ht N) b₀ u (u D.index) τ}+ε*Q :=
|
| 145 |
+
he.trans (add_le_add hem le_rfl)
|
| 146 |
+
_ = _ := by ring
|
| 147 |
+
|
| 148 |
+
end Harmonic
|
| 149 |
+
end SourceIntegerArrays.GlobalJoint.SourceFrozenFamily
|
| 150 |
+
end
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
noncomputable section
|
| 159 |
+
open scoped BigOperators
|
| 160 |
+
open MeasureTheory Filter Function
|
| 161 |
+
namespace SourcePivotPaths
|
| 162 |
+
open ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScales
|
| 163 |
+
open ConstructedWordPlan.RationalPivotPlan
|
| 164 |
+
open SourceRawPrefix
|
| 165 |
+
attribute [local instance] Classical.propDecidable
|
| 166 |
+
variable {a : ℕ} (s r : ℕ) (hs : 1 ≤ s)
|
| 167 |
+
|
| 168 |
+
def sourcePlan : (Ds : List (Pivot a)) → Plan Ds
|
| 169 |
+
| [] => ()
|
| 170 |
+
| D :: Ds => (pivotOptions s r hs D (multipliers (sourcePlan Ds)), sourcePlan Ds)
|
| 171 |
+
|
| 172 |
+
def gain (D : Pivot a) (Fs : Finset (Scale a)) : ℝ :=
|
| 173 |
+
((pivotOptions s r hs D Fs).card : ℝ)⁻¹/3/(pivotOptions s r hs D Fs).card
|
| 174 |
+
|
| 175 |
+
lemma gain_pos (D : Pivot a) (Fs : Finset (Scale a)) : 0 < gain s r hs D Fs := by
|
| 176 |
+
have hp : 0 < ((pivotOptions s r hs D Fs).card : ℝ) := by
|
| 177 |
+
exact_mod_cast Finset.card_pos.mpr (pivotOptions_nonempty s r hs D Fs)
|
| 178 |
+
exact div_pos (div_pos (inv_pos.mpr hp) (by norm_num)) hp
|
| 179 |
+
|
| 180 |
+
lemma gain_le_one (D : Pivot a) (Fs : Finset (Scale a)) : gain s r hs D Fs ≤ 1 := by
|
| 181 |
+
have hp : 1 ≤ ((pivotOptions s r hs D Fs).card : ℝ) := by
|
| 182 |
+
exact_mod_cast Finset.card_pos.mpr (pivotOptions_nonempty s r hs D Fs)
|
| 183 |
+
have hi : ((pivotOptions s r hs D Fs).card : ℝ)⁻¹ ≤ 1 := inv_le_one_of_one_le₀ hp
|
| 184 |
+
unfold gain
|
| 185 |
+
apply div_le_one_of_le₀ _ (by linarith)
|
| 186 |
+
exact (div_le_self (inv_nonneg.mpr (by linarith)) (by norm_num : (1 : ℝ) ≤ 3)).trans (hi.trans hp)
|
| 187 |
+
|
| 188 |
+
def delta : List (Pivot a) → ℝ
|
| 189 |
+
| [] => 1
|
| 190 |
+
| D :: Ds => gain s r hs D (multipliers (sourcePlan s r hs Ds)) * delta Ds
|
| 191 |
+
|
| 192 |
+
def errorCost : List (Pivot a) → ℕ
|
| 193 |
+
| [] => 0
|
| 194 |
+
| D :: Ds => 1 + (pivotOptions s r hs D (multipliers (sourcePlan s r hs Ds))).card * errorCost Ds
|
| 195 |
+
|
| 196 |
+
lemma delta_pos (Ds : List (Pivot a)) : 0 < delta s r hs Ds := by
|
| 197 |
+
induction Ds with
|
| 198 |
+
| nil => exact zero_lt_one
|
| 199 |
+
| cons D Ds ih => exact mul_pos (gain_pos s r hs D _) ih
|
| 200 |
+
|
| 201 |
+
lemma delta_le_one (Ds : List (Pivot a)) : delta s r hs Ds ≤ 1 := by
|
| 202 |
+
induction Ds with
|
| 203 |
+
| nil => exact le_rfl
|
| 204 |
+
| cons D Ds ih =>
|
| 205 |
+
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)))
|
| 206 |
+
|
| 207 |
+
variable (S : (D : Pivot a) → ScalarModels D r) (ht : Fin a → ℤ) (τ : ℝ)
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
def runSuccess : List (Pivot a) → Scale a → (Fin a → ℕ) → Prop
|
| 212 |
+
| [], _, _ => True
|
| 213 |
+
| D :: Ds, b, u => ∃ p ∈ (sourcePlan s r hs (D :: Ds)).1,
|
| 214 |
+
outcome D r (multipliers (sourcePlan s r hs Ds)) (S D) ht b p u (u D.index) τ ∧
|
| 215 |
+
runSuccess Ds (scaleRun D 0 p b) u
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
theorem runSuccess_final (Ds : List (Pivot a)) (b : Scale a) (u : Fin a → ℕ)
|
| 219 |
+
(h : runSuccess s r hs S ht τ Ds b u) :
|
| 220 |
+
∃ p : ChoicePath Ds, Admitted (sourcePlan s r hs Ds) p ∧
|
| 221 |
+
∀ D ∈ Ds, comparison D r (S D) ht (b * pathMultiplier p) u (u D.index) τ := by
|
| 222 |
+
induction Ds generalizing b with
|
| 223 |
+
| nil => exact ⟨(), True.intro, by simp⟩
|
| 224 |
+
| cons D Ds ih =>
|
| 225 |
+
obtain ⟨p,hp,hhead,htail⟩ := h
|
| 226 |
+
obtain ⟨q,hq,hfinal⟩ := ih (scaleRun D 0 p b) htail
|
| 227 |
+
refine ⟨(p,q), ⟨hp,hq⟩, ?_⟩
|
| 228 |
+
have he : b * pathMultiplier (Ds := D :: Ds) (p,q) =
|
| 229 |
+
scaleRun D 0 p b * pathMultiplier q := by
|
| 230 |
+
change b * (scaleRun D 0 p 1 * pathMultiplier q) = _
|
| 231 |
+
rw [scaleRun_eq_mul D p 0 b, mul_assoc]
|
| 232 |
+
intro E hE
|
| 233 |
+
rw [he]
|
| 234 |
+
rcases List.mem_cons.mp hE with rfl | hE
|
| 235 |
+
· exact hhead (pathMultiplier q) (pathMultiplier_mem _ _ hq)
|
| 236 |
+
· exact hfinal E hE
|
| 237 |
+
|
| 238 |
+
variable (μ : Measure (Fin a → ℕ)) [IsProbabilityMeasure μ]
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
def stepBounds (η : ℝ) : List (Pivot a) → Scale a → Prop
|
| 243 |
+
| [], _ => True
|
| 244 |
+
| D :: Ds, b =>
|
| 245 |
+
(∀ E : Set (Fin a → ℕ), Earlier D.index E →
|
| 246 |
+
gain s r hs D (multipliers (sourcePlan s r hs Ds)) * μ.real E ≤
|
| 247 |
+
μ.real {u | u ∈ E ∧ success D r s hs (multipliers (sourcePlan s r hs Ds))
|
| 248 |
+
(S D) ht b u (u D.index) τ} + η) ∧
|
| 249 |
+
∀ p ∈ (sourcePlan s r hs (D :: Ds)).1,
|
| 250 |
+
stepBounds η Ds (scaleRun D 0 p b)
|
| 251 |
+
|
| 252 |
+
private lemma through_disjointed {i : Fin a} {v : ℕ}
|
| 253 |
+
(f : Fin v → Set (Fin a → ℕ)) (h : ∀ j, Through i (f j)) (j : Fin v) :
|
| 254 |
+
Through i (disjointed f j) := by
|
| 255 |
+
intro u w huw
|
| 256 |
+
simp only [disjointed_eq_inter_compl, Set.mem_inter_iff, Set.mem_iInter,
|
| 257 |
+
Set.mem_compl_iff]
|
| 258 |
+
exact and_congr (h j u w huw) (forall_congr' (fun k => forall_congr' (fun _ => not_congr (h k u w huw))))
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
theorem iterate_mass (Ds : List (Pivot a)) (b : Scale a)
|
| 263 |
+
(horder : Ds.Pairwise (fun D E => D.index < E.index))
|
| 264 |
+
(η : ℝ) (hη : 0 ≤ η) (hsteps : stepBounds s r hs S ht τ μ η Ds b)
|
| 265 |
+
(E : Set (Fin a → ℕ)) (hE : ∀ D ∈ Ds, Earlier D.index E) :
|
| 266 |
+
delta s r hs Ds * μ.real E ≤
|
| 267 |
+
μ.real {u | u ∈ E ∧ runSuccess s r hs S ht τ Ds b u} + errorCost s r hs Ds * η := by
|
| 268 |
+
induction Ds generalizing b E with
|
| 269 |
+
| nil => simp [delta, runSuccess, errorCost]
|
| 270 |
+
| cons D Ds ih =>
|
| 271 |
+
let P := pivotOptions s r hs D (multipliers (sourcePlan s r hs Ds))
|
| 272 |
+
let f : Fin P.card → Path D := fun j => ((Finset.equivFin P).symm j).val
|
| 273 |
+
have hf (j : Fin P.card) : f j ∈ P := ((Finset.equivFin P).symm j).property
|
| 274 |
+
let A (j : Fin P.card) : Set (Fin a → ℕ) := {u | u ∈ E ∧
|
| 275 |
+
outcome D r (multipliers (sourcePlan s r hs Ds)) (S D) ht b (f j) u (u D.index) τ}
|
| 276 |
+
let C := disjointed A
|
| 277 |
+
have hEh : Earlier D.index E := hE D (by simp)
|
| 278 |
+
have hEth : Through D.index E := fun u v hv => hEh u v (fun j hj => hv j hj.le)
|
| 279 |
+
have hCth (j : Fin P.card) : Through D.index (C j) :=
|
| 280 |
+
through_disjointed A (fun j => through_inter hEth (outcome_through D r _ (S D) ht b (f j) τ)) j
|
| 281 |
+
have hlist := List.pairwise_cons.mp horder
|
| 282 |
+
let T (j : Fin P.card) : Set (Fin a → ℕ) := {u | u ∈ C j ∧
|
| 283 |
+
runSuccess s r hs S ht τ Ds (scaleRun D 0 (f j) b) u}
|
| 284 |
+
have htail (j : Fin P.card) : delta s r hs Ds * μ.real (C j) ≤
|
| 285 |
+
μ.real (T j) + errorCost s r hs Ds * η :=
|
| 286 |
+
ih (scaleRun D 0 (f j) b) hlist.2 (hsteps.2 (f j) (hf j)) (C j)
|
| 287 |
+
(fun D' hD' => (hCth j).earlier (hlist.1 D' hD'))
|
| 288 |
+
have hCu : (⋃ j, C j) = {u | u ∈ E ∧
|
| 289 |
+
success D r s hs (multipliers (sourcePlan s r hs Ds)) (S D) ht b u (u D.index) τ} := by
|
| 290 |
+
rw [show (⋃ j, C j) = ⋃ j, A j from iUnion_disjointed]
|
| 291 |
+
ext u
|
| 292 |
+
simp only [Set.mem_iUnion, A, Set.mem_ofPred_eq, success]
|
| 293 |
+
constructor
|
| 294 |
+
· rintro ⟨j,hu,hj⟩
|
| 295 |
+
exact ⟨hu,f j,hf j,hj⟩
|
| 296 |
+
· rintro ⟨hu,p,hp,hp'⟩
|
| 297 |
+
refine ⟨Finset.equivFin P ⟨p,hp⟩,hu,?_⟩
|
| 298 |
+
simpa only [f, Equiv.symm_apply_apply] using hp'
|
| 299 |
+
have hCeq : μ.real (⋃ j, C j) = ∑ j, μ.real (C j) :=
|
| 300 |
+
measureReal_iUnion_fintype (disjoint_disjointed A) (fun j => (Set.to_countable _).measurableSet)
|
| 301 |
+
have hTdisj : Pairwise (Disjoint on T) := by
|
| 302 |
+
intro i j hij
|
| 303 |
+
exact (disjoint_disjointed A hij).mono Set.inter_subset_left Set.inter_subset_left
|
| 304 |
+
have hTeq : μ.real (⋃ j, T j) = ∑ j, μ.real (T j) :=
|
| 305 |
+
measureReal_iUnion_fintype hTdisj (fun j => (Set.to_countable _).measurableSet)
|
| 306 |
+
have hTu : (⋃ j, T j) ⊆ {u | u ∈ E ∧ runSuccess s r hs S ht τ (D :: Ds) b u} := by
|
| 307 |
+
apply Set.iUnion_subset
|
| 308 |
+
intro j u hu
|
| 309 |
+
have hA : u ∈ A j := disjointed_subset A j hu.1
|
| 310 |
+
exact ⟨hA.1,f j,hf j,hA.2,hu.2⟩
|
| 311 |
+
have hsum := Finset.sum_le_sum (s := Finset.univ) (fun j _ => htail j)
|
| 312 |
+
rw [Finset.sum_add_distrib, ← Finset.mul_sum] at hsum
|
| 313 |
+
simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] at hsum
|
| 314 |
+
rw [← hCeq, ← hTeq, hCu] at hsum
|
| 315 |
+
have hh := mul_le_mul_of_nonneg_left (hsteps.1 E hEh) (delta_pos s r hs Ds).le
|
| 316 |
+
have hde : delta s r hs Ds * η ≤ η := mul_le_of_le_one_left hη (delta_le_one s r hs Ds)
|
| 317 |
+
have hmono := measureReal_mono (μ := μ) hTu
|
| 318 |
+
change (gain s r hs D (multipliers (sourcePlan s r hs Ds)) * delta s r hs Ds) * μ.real E ≤ _
|
| 319 |
+
simp only [errorCost, Nat.cast_add, Nat.cast_one, Nat.cast_mul]
|
| 320 |
+
dsimp only [P] at hsum
|
| 321 |
+
nlinarith
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
def localEstimates (μs : ℕ → Measure (Fin a → ℕ))
|
| 326 |
+
(Ss : ℕ → (D : Pivot a) → ScalarModels D r) (hts : ℕ → Fin a → ℤ) :
|
| 327 |
+
List (Pivot a) → Scale a → Prop
|
| 328 |
+
| [], _ => True
|
| 329 |
+
| D :: Ds, b =>
|
| 330 |
+
(∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop,
|
| 331 |
+
∀ E : Set (Fin a → ℕ), Earlier D.index E →
|
| 332 |
+
gain s r hs D (multipliers (sourcePlan s r hs Ds)) * (μs N).real E ≤
|
| 333 |
+
(μs N).real {u | u ∈ E ∧ success D r s hs (multipliers (sourcePlan s r hs Ds))
|
| 334 |
+
(Ss N D) (hts N) b u (u D.index) τ} + ε) ∧
|
| 335 |
+
∀ p ∈ (sourcePlan s r hs (D :: Ds)).1,
|
| 336 |
+
localEstimates μs Ss hts Ds (scaleRun D 0 p b)
|
| 337 |
+
|
| 338 |
+
lemma eventually_stepBounds (μs : ℕ → Measure (Fin a → ℕ))
|
| 339 |
+
(Ss : ℕ → (D : Pivot a) → ScalarModels D r) (hts : ℕ → Fin a → ℤ)
|
| 340 |
+
(Ds : List (Pivot a)) (b : Scale a)
|
| 341 |
+
(h : localEstimates s r hs τ μs Ss hts Ds b) (ε : ℝ) (hε : 0 < ε) :
|
| 342 |
+
∀ᶠ N in atTop, stepBounds s r hs (Ss N) (hts N) τ (μs N) ε Ds b := by
|
| 343 |
+
induction Ds generalizing b with
|
| 344 |
+
| nil => exact Eventually.of_forall (fun _ => True.intro)
|
| 345 |
+
| cons D Ds ih =>
|
| 346 |
+
let P := (sourcePlan s r hs (D :: Ds)).1
|
| 347 |
+
have ht : ∀ p : P, ∀ᶠ N in atTop,
|
| 348 |
+
stepBounds s r hs (Ss N) (hts N) τ (μs N) ε Ds (scaleRun D 0 p.val b) :=
|
| 349 |
+
fun p => ih _ (h.2 p.val p.property)
|
| 350 |
+
filter_upwards [h.1 ε hε, eventually_all.mpr ht] with N hN hT
|
| 351 |
+
exact ⟨hN, fun p hp => hT ⟨p,hp⟩⟩
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
theorem iterate_eventually (μs : ℕ → Measure (Fin a → ℕ)) [∀ N, IsProbabilityMeasure (μs N)]
|
| 356 |
+
(Ss : ℕ → (D : Pivot a) → ScalarModels D r) (hts : ℕ → Fin a → ℤ)
|
| 357 |
+
(Ds : List (Pivot a)) (b : Scale a)
|
| 358 |
+
(horder : Ds.Pairwise (fun D E => D.index < E.index))
|
| 359 |
+
(h : localEstimates s r hs τ μs Ss hts Ds b) (ε : ℝ) (hε : 0 < ε) :
|
| 360 |
+
∀ᶠ N in atTop, ∀ E : Set (Fin a → ℕ), (∀ D ∈ Ds, Earlier D.index E) →
|
| 361 |
+
delta s r hs Ds * (μs N).real E ≤
|
| 362 |
+
(μs N).real {u | u ∈ E ∧ runSuccess s r hs (Ss N) (hts N) τ Ds b u} + ε := by
|
| 363 |
+
let η := ε / (errorCost s r hs Ds + 1)
|
| 364 |
+
have hc : (0 : ℝ) < errorCost s r hs Ds + 1 := by positivity
|
| 365 |
+
have hη : 0 < η := div_pos hε hc
|
| 366 |
+
have hcost : (errorCost s r hs Ds : ℝ) * η ≤ ε := by
|
| 367 |
+
have he : η * (errorCost s r hs Ds + 1) = ε := div_mul_cancel₀ _ hc.ne'
|
| 368 |
+
have heta : 0 ≤ η := hη.le
|
| 369 |
+
nlinarith
|
| 370 |
+
filter_upwards [eventually_stepBounds s r hs τ μs Ss hts Ds b h η hη] with N hN
|
| 371 |
+
intro E hE
|
| 372 |
+
exact (iterate_mass s r hs (Ss N) (hts N) τ (μs N) Ds b horder η hη.le hN E hE).trans
|
| 373 |
+
(add_le_add le_rfl hcost)
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
theorem eventual_final_alignment (μs : ℕ → Measure (Fin a → ℕ)) [∀ N, IsProbabilityMeasure (μs N)]
|
| 378 |
+
(Ss : ℕ → (D : Pivot a) → ScalarModels D r) (hts : ℕ → Fin a → ℤ)
|
| 379 |
+
(Ds : List (Pivot a)) (horder : Ds.Pairwise (fun D E => D.index < E.index))
|
| 380 |
+
(h : localEstimates s r hs τ μs Ss hts Ds 1) (ε : ℝ) (hε : 0 < ε) :
|
| 381 |
+
∀ᶠ N in atTop, delta s r hs Ds ≤
|
| 382 |
+
(μs N).real {u | ∃ b ∈ multipliers (sourcePlan s r hs Ds),
|
| 383 |
+
∀ D ∈ Ds, comparison D r (Ss N D) (hts N) b u (u D.index) τ} + ε := by
|
| 384 |
+
filter_upwards [iterate_eventually s r hs τ μs Ss hts Ds 1 horder h ε hε] with N hN
|
| 385 |
+
have hm := hN Set.univ (fun D _ => earlier_univ D.index)
|
| 386 |
+
have hsub : {u | u ∈ Set.univ ∧ runSuccess s r hs (Ss N) (hts N) τ Ds 1 u} ⊆
|
| 387 |
+
{u | ∃ b ∈ multipliers (sourcePlan s r hs Ds),
|
| 388 |
+
∀ D ∈ Ds, comparison D r (Ss N D) (hts N) b u (u D.index) τ} := by
|
| 389 |
+
intro u hu
|
| 390 |
+
obtain ⟨p,hp,hfinal⟩ := runSuccess_final s r hs (Ss N) (hts N) τ Ds 1 u hu.2
|
| 391 |
+
exact ⟨pathMultiplier p, pathMultiplier_mem _ _ hp, by simpa only [one_mul] using hfinal⟩
|
| 392 |
+
simpa only [probReal_univ, mul_one] using hm.trans
|
| 393 |
+
(add_le_add (measureReal_mono hsub) le_rfl)
|
| 394 |
+
|
| 395 |
+
end SourcePivotPaths
|
| 396 |
+
|
| 397 |
+
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
|
| 401 |
+
end
|
| 402 |
+
end
|
| 403 |
+
end
|
| 404 |
+
end
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.PivotPaths02
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
section
|
| 9 |
+
noncomputable section
|
| 10 |
+
open Filter MeasureTheory
|
| 11 |
+
open scoped BigOperators ENNReal Topology
|
| 12 |
+
noncomputable section
|
| 13 |
+
open scoped BigOperators Topology BoundedContinuousFunction
|
| 14 |
+
noncomputable section
|
| 15 |
+
open scoped BigOperators
|
| 16 |
+
open MeasureTheory Filter Function
|
| 17 |
+
noncomputable section
|
| 18 |
+
open scoped BigOperators
|
| 19 |
+
namespace SourcePivotPaths
|
| 20 |
+
open ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScales
|
| 21 |
+
open ConstructedWordPlan.RationalPivotPlan
|
| 22 |
+
open ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmetic
|
| 23 |
+
open SourceIntegerArrays.GlobalJoint.SourceFrozenFamily
|
| 24 |
+
attribute [local instance] Classical.propDecidable
|
| 25 |
+
variable {a : ℕ} (s r : ℕ) (hs : 1 ≤ s)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
lemma scaleRun_pos (D : Pivot a) (p : Path D) (hp : ∀ o ∈ p, 0 < o.1)
|
| 29 |
+
(j : ℕ) (b : Scale a) (hb : ∀ l, 0 < b l) : ∀ l, 0 < scaleRun D j p b l := by
|
| 30 |
+
induction p generalizing j b with
|
| 31 |
+
| nil => exact hb
|
| 32 |
+
| cons o p ih =>
|
| 33 |
+
apply ih (fun o ho => hp o (List.mem_cons_of_mem _ ho))
|
| 34 |
+
intro l
|
| 35 |
+
exact mul_pos (hb l) (multiplier_pos D.index (tailAt D.tail j)
|
| 36 |
+
(by exact_mod_cast hp o List.mem_cons_self) l)
|
| 37 |
+
|
| 38 |
+
lemma sourcePlan_positive (Ds : List (Pivot a)) : positivePlan (sourcePlan s r hs Ds) := by
|
| 39 |
+
induction Ds with
|
| 40 |
+
| nil => trivial
|
| 41 |
+
| cons D Ds ih => exact ⟨pivotOptions_paths s r hs D _, ih⟩
|
| 42 |
+
|
| 43 |
+
lemma source_multipliers_pos (Ds : List (Pivot a)) :
|
| 44 |
+
∀ b ∈ multipliers (sourcePlan s r hs Ds), ∀ l, 0 < b l := by
|
| 45 |
+
induction Ds with
|
| 46 |
+
| nil =>
|
| 47 |
+
intro b hb
|
| 48 |
+
simp only [multipliers, Finset.mem_singleton] at hb
|
| 49 |
+
subst b
|
| 50 |
+
simp
|
| 51 |
+
| cons D Ds ih =>
|
| 52 |
+
intro b hb
|
| 53 |
+
obtain ⟨p,hp,hb⟩ := Finset.mem_biUnion.mp hb
|
| 54 |
+
obtain ⟨d,hd,rfl⟩ := Finset.mem_image.mp hb
|
| 55 |
+
exact fun l => mul_pos
|
| 56 |
+
(scaleRun_pos D p (pivotOptions_paths s r hs D _ p hp).2 0 1 (by simp) l) (ih d hd l)
|
| 57 |
+
|
| 58 |
+
def nextScales (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a)) : Finset (Scale a) :=
|
| 59 |
+
B.biUnion (fun b => (pivotOptions s r hs D (multipliers (sourcePlan s r hs Ds))).image
|
| 60 |
+
(fun p => scaleRun D 0 p b))
|
| 61 |
+
|
| 62 |
+
lemma mem_nextScales (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a))
|
| 63 |
+
(b : Scale a) (hb : b ∈ B) (p : Path D)
|
| 64 |
+
(hp : p ∈ pivotOptions s r hs D (multipliers (sourcePlan s r hs Ds))) :
|
| 65 |
+
scaleRun D 0 p b ∈ nextScales s r hs D Ds B :=
|
| 66 |
+
Finset.mem_biUnion.mpr ⟨b,hb,Finset.mem_image.mpr ⟨p,hp,rfl⟩⟩
|
| 67 |
+
|
| 68 |
+
lemma nextScales_pos (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a))
|
| 69 |
+
(hB : ∀ b ∈ B, ∀ l, 0 < b l) :
|
| 70 |
+
∀ b ∈ nextScales s r hs D Ds B, ∀ l, 0 < b l := by
|
| 71 |
+
intro b hb
|
| 72 |
+
obtain ⟨b₀,hb₀,hb⟩ := Finset.mem_biUnion.mp hb
|
| 73 |
+
obtain ⟨p,hp,rfl⟩ := Finset.mem_image.mp hb
|
| 74 |
+
exact scaleRun_pos D p (pivotOptions_paths s r hs D _ p hp).2 0 b₀ (hB b₀ hb₀)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def planModulus : List (Pivot a) → Finset (Scale a) → ℕ
|
| 79 |
+
| [], _ => 1
|
| 80 |
+
| D :: Ds, B =>
|
| 81 |
+
(pivotModulus s r hs D (multipliers (sourcePlan s r hs Ds)) B *
|
| 82 |
+
∏ b ∈ B, terminalDenom D s r hs (multipliers (sourcePlan s r hs Ds)) b) *
|
| 83 |
+
planModulus Ds (nextScales s r hs D Ds B)
|
| 84 |
+
|
| 85 |
+
lemma terminalDenom_pos (D : Pivot a) (Fs : Finset (Scale a)) (b : Scale a) :
|
| 86 |
+
0 < terminalDenom D s r hs Fs b :=
|
| 87 |
+
(source_terminal_arithmetic D (outcomeScales D s r hs Fs b)).choose_spec.1
|
| 88 |
+
|
| 89 |
+
lemma planModulus_pos (Ds : List (Pivot a)) (B : Finset (Scale a)) :
|
| 90 |
+
0 < planModulus s r hs Ds B := by
|
| 91 |
+
induction Ds generalizing B with
|
| 92 |
+
| nil => exact Nat.zero_lt_one
|
| 93 |
+
| cons D Ds ih =>
|
| 94 |
+
exact Nat.mul_pos (Nat.mul_pos (pivotModulus_pos s r hs D _ B)
|
| 95 |
+
(Finset.prod_pos fun b _ => terminalDenom_pos s r hs D _ b)) (ih _)
|
| 96 |
+
|
| 97 |
+
lemma planModulus_head (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a)) :
|
| 98 |
+
pivotModulus s r hs D (multipliers (sourcePlan s r hs Ds)) B ∣ planModulus s r hs (D :: Ds) B :=
|
| 99 |
+
dvd_trans (dvd_mul_right _ _) (dvd_mul_right _ _)
|
| 100 |
+
|
| 101 |
+
lemma planModulus_terminal (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a))
|
| 102 |
+
(b : Scale a) (hb : b ∈ B) :
|
| 103 |
+
terminalDenom D s r hs (multipliers (sourcePlan s r hs Ds)) b ∣ planModulus s r hs (D :: Ds) B :=
|
| 104 |
+
dvd_trans (Finset.dvd_prod_of_mem _ hb) (dvd_trans (dvd_mul_left _ _) (dvd_mul_right _ _))
|
| 105 |
+
|
| 106 |
+
lemma planModulus_tail (D : Pivot a) (Ds : List (Pivot a)) (B : Finset (Scale a)) :
|
| 107 |
+
planModulus s r hs Ds (nextScales s r hs D Ds B) ∣ planModulus s r hs (D :: Ds) B :=
|
| 108 |
+
dvd_mul_left _ _
|
| 109 |
+
|
| 110 |
+
end SourcePivotPaths
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
noncomputable section
|
| 119 |
+
open Filter MeasureTheory
|
| 120 |
+
open scoped Topology BoundedContinuousFunction NNReal
|
| 121 |
+
namespace SourceChartedAlignment
|
| 122 |
+
open RationalLattice MalcevCharacters CubeFaces
|
| 123 |
+
open MicrocellScale AdmissibleMicrocellBoundary RoughScales
|
| 124 |
+
open ConstructedWordPlan.GlobalWordPlan ConstructedWordPlan.AlignmentScales
|
| 125 |
+
open SourceIntegerArrays
|
| 126 |
+
open ConstructedWordPlan.GlobalWordPlan.SourceTerminalArithmetic
|
| 127 |
+
open SourceIntegerArrays.GlobalJoint.SourceFrozenFamily
|
| 128 |
+
open SourceIntegerArrays.GlobalJoint.SourceExposureSlots ProductExposureLaw SourceResidueAlignment
|
| 129 |
+
open ConstructedWordPlan.RationalPivotPlan
|
| 130 |
+
|
| 131 |
+
structure CommonScales (a : ℕ) where
|
| 132 |
+
w : ℕ → ℕ
|
| 133 |
+
M : ℕ → ℕ
|
| 134 |
+
X : ℕ → Fin a → ℕ
|
| 135 |
+
ht : ℕ → Fin a → ℤ
|
| 136 |
+
L : ℕ → ℤ
|
| 137 |
+
hw : Tendsto w atTop atTop
|
| 138 |
+
hX : ∀ N j, 4 * primorial (w N) ≤ X N j
|
| 139 |
+
hXt : ∀ j, Tendsto (fun N => X N j) atTop atTop
|
| 140 |
+
hWM : ∀ N, (primorial (w N) : ℤ) ∣ (M N : ℤ)
|
| 141 |
+
hM : ∀ N, 0 < M N
|
| 142 |
+
hMs : ∀ N, RoughScales.Smooth (w N) (M N : ℤ)
|
| 143 |
+
hL : ∀ N, 0 < L N
|
| 144 |
+
hLs : ∀ N, RoughScales.Smooth (w N) (L N)
|
| 145 |
+
hWL : ∀ N, (primorial (w N) : ℤ) ∣ L N
|
| 146 |
+
hML : ∀ N, (M N : ℤ) ∣ L N
|
| 147 |
+
hLexact : ∀ N, L N = (M N : ℤ) * (primorial (w N) : ℤ) ^ w N
|
| 148 |
+
hpowWM : ∀ N, primorial (w N) ^ w N ∣ M N
|
| 149 |
+
hht : ∀ N j, 0 < ht N j
|
| 150 |
+
hXL : ∀ j, Tendsto (fun N => (X N j : ℝ) / (L N : ℝ)) atTop atTop
|
| 151 |
+
|
| 152 |
+
structure PivotScales {a : ℕ} (C : CommonScales a) (D : Pivot a) where
|
| 153 |
+
H : ℕ → ℕ
|
| 154 |
+
J : ℕ → ℕ
|
| 155 |
+
R : ℕ → ℕ
|
| 156 |
+
hJ : ∀ N, 0 < J N
|
| 157 |
+
hRJ : ∀ N, R N = C.M N * J N
|
| 158 |
+
hH : ∀ N, 0 < H N
|
| 159 |
+
hRrad : ∀ N, R N = radius (C.M N) (H N)
|
| 160 |
+
hdom : Dominates (fun N => (H N : ℝ)) (earlierScale C.M (fun N => previousProduct D (C.X N)))
|
| 161 |
+
hxdom : Dominates (fun N => Real.log (C.X N D.index : ℝ)) (fun N => (H N : ℝ))
|
| 162 |
+
hheight : ∀ N e, height (C.ht N) (D.added e) ≤ C.M N
|
| 163 |
+
hdisj : ∀ e, Disjoint (D.added e) (D.tail (D.owner e))
|
| 164 |
+
hratio : ∀ N e, ∃ d : ℤ, height (C.ht N) (D.added e) =
|
| 165 |
+
height (C.ht N) (block D.index D.tail (D.owner e)) *
|
| 166 |
+
((primorial (C.w N) : ℤ) ^ C.w N * d)
|
| 167 |
+
|
| 168 |
+
structure ChartedModels {a : ℕ} (s r : ℕ) (D : Pivot a) where
|
| 169 |
+
G : Fin D.targets → ℚ → Fin r → Type
|
| 170 |
+
[group : ∀ t v c, Group (G t v c)]
|
| 171 |
+
[topology : ∀ t v c, TopologicalSpace (G t v c)]
|
| 172 |
+
[topGroup : ∀ t v c, IsTopologicalGroup (G t v c)]
|
| 173 |
+
Γ : ∀ t v c, Subgroup (G t v c)
|
| 174 |
+
dim : Fin D.targets → ℚ → Fin r → ℕ
|
| 175 |
+
coords : ∀ t v c, RealCoordinates (G t v c) (dim t v c)
|
| 176 |
+
second : ∀ t v c, SecondKind (coords t v c)
|
| 177 |
+
filtration : ∀ t v c, CubeFaces.Filtration (G t v c)
|
| 178 |
+
weight : ∀ t v c, Fin (dim t v c) → ℕ
|
| 179 |
+
level_iff : ∀ t v c k (g : G t v c), g ∈ (filtration t v c).level k ↔
|
| 180 |
+
∀ j, weight t v c j < k → (coords t v c).coord g j = 0
|
| 181 |
+
weight_pos : ∀ t v c j, 0 < weight t v c j
|
| 182 |
+
lattice_iff : ∀ t v c g, g ∈ Γ t v c ↔ ∀ j, ∃ z : ℤ, (coords t v c).coord g j = z
|
| 183 |
+
weight_mono : ∀ t v c, Monotone (weight t v c)
|
| 184 |
+
level0 : ∀ t v c, (filtration t v c).level 0 = ⊤
|
| 185 |
+
level1 : ∀ t v c, (filtration t v c).level 1 = ⊤
|
| 186 |
+
step : ∀ t v c, (filtration t v c).level (s+1) = ⊥
|
| 187 |
+
g : ∀ t, ℕ → ∀ v c, ℤ → ℤ → G t v c
|
| 188 |
+
x : ∀ t, ℕ → ∀ v c, ℤ → ℤ → G t v c
|
| 189 |
+
obs : ∀ t, ℕ → ∀ v c, ℤ → ℤ → ((G t v c) ⧸ Γ t v c) →ᵇ ℝ
|
| 190 |
+
metric : ∀ t v c, MetricSpace ((G t v c) ⧸ Γ t v c)
|
| 191 |
+
compatible : ∀ t v c, QuotientGroup.instTopologicalSpace (Γ t v c) =
|
| 192 |
+
(metric t v c).toUniformSpace.toTopologicalSpace
|
| 193 |
+
K : ℝ≥0
|
| 194 |
+
B : ℝ
|
| 195 |
+
lip : letI : ∀ t v c, MetricSpace ((G t v c) ⧸ Γ t v c) :=
|
| 196 |
+
fun t v c => (metric t v c).replaceTopology (compatible t v c)
|
| 197 |
+
∀ t N v c b r', LipschitzWith K (obs t N v c b r')
|
| 198 |
+
bound : ∀ t N v c b r' z, |obs t N v c b r' z| ≤ B
|
| 199 |
+
|
| 200 |
+
attribute [instance] ChartedModels.group ChartedModels.topology ChartedModels.topGroup
|
| 201 |
+
|
| 202 |
+
variable {a : ℕ}
|
| 203 |
+
def CommonScales.law (C : CommonScales a) (N : ℕ) : Measure (Fin a → ℕ) :=
|
| 204 |
+
outsideLaw (C.X N) (primorial (C.w N)) (primorial_pos _) (C.hX N)
|
| 205 |
+
|
| 206 |
+
instance (C : CommonScales a) (N : ℕ) : IsProbabilityMeasure (C.law N) := by
|
| 207 |
+
unfold CommonScales.law
|
| 208 |
+
infer_instance
|
| 209 |
+
|
| 210 |
+
def ChartedModels.scalar {s r : ℕ} {D : Pivot a} (C : CommonScales a) (P : PivotScales C D)
|
| 211 |
+
(F : ChartedModels s r D) (N : ℕ) : SourcePivotPaths.ScalarModels D r :=
|
| 212 |
+
SourcePivotPaths.scalarModels D r F.G F.Γ C.M P.H F.g F.x F.obs N
|
| 213 |
+
|
| 214 |
+
end SourceChartedAlignment
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
noncomputable section
|
| 223 |
+
open scoped Topology BigOperators
|
| 224 |
+
namespace SourceProductCoordinates
|
| 225 |
+
open RationalLattice MalcevCharacters
|
| 226 |
+
attribute [local instance] Classical.propDecidable
|
| 227 |
+
variable {d N : ℕ} (n : Fin d → ℕ)
|
| 228 |
+
(G : Fin d → Type) [∀ i, Group (G i)] [∀ i, TopologicalSpace (G i)]
|
| 229 |
+
(c : ∀ i, RealCoordinates (G i) (n i))
|
| 230 |
+
(e : Fin N ≃ Σ i, Fin (n i))
|
| 231 |
+
(he : ∀ i, StrictMono (fun j : Fin (n i) => e.symm ⟨i,j⟩))
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
def homeomorph : (∀ i, G i) ≃ₜ (Fin N → ℝ) where
|
| 235 |
+
toFun g k := (c (e k).1).coord (g (e k).1) (e k).2
|
| 236 |
+
invFun v i := (c i).coord.symm (fun j => v (e.symm ⟨i,j⟩))
|
| 237 |
+
left_inv g := by
|
| 238 |
+
funext i
|
| 239 |
+
apply (c i).coord.injective
|
| 240 |
+
ext j
|
| 241 |
+
simp only [Homeomorph.apply_symm_apply]
|
| 242 |
+
exact congrArg (fun z : Σ i, Fin (n i) => (c z.1).coord (g z.1) z.2)
|
| 243 |
+
(e.apply_symm_apply ⟨i,j⟩)
|
| 244 |
+
right_inv v := by
|
| 245 |
+
funext k
|
| 246 |
+
simp
|
| 247 |
+
continuous_toFun := continuous_pi fun k =>
|
| 248 |
+
(continuous_apply (e k).2).comp ((c (e k).1).coord.continuous.comp (continuous_apply (e k).1))
|
| 249 |
+
continuous_invFun := continuous_pi fun i =>
|
| 250 |
+
(c i).coord.symm.continuous.comp (continuous_pi fun j => continuous_apply (e.symm ⟨i,j⟩))
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
def lower (k : Fin N) (j : Fin (e k).2.val) : Fin k.val :=
|
| 254 |
+
⟨(e.symm ⟨(e k).1,⟨j.val,lt_trans j.isLt (e k).2.isLt⟩⟩).val, by
|
| 255 |
+
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)
|
| 256 |
+
simpa only [Sigma.eta, Equiv.symm_apply_apply, Fin.lt_def] using h⟩
|
| 257 |
+
|
| 258 |
+
lemma homeomorph_lower (g : ∀ i, G i) (k : Fin N) (j : Fin (e k).2.val) :
|
| 259 |
+
homeomorph n G c e g ⟨(lower n e he k j).val,lt_trans (lower n e he k j).isLt k.isLt⟩ =
|
| 260 |
+
(c (e k).1).coord (g (e k).1) ⟨j.val,lt_trans j.isLt (e k).2.isLt⟩ := by
|
| 261 |
+
change (c (e (e.symm _)).1).coord (g (e (e.symm _)).1) (e (e.symm _)).2 = _
|
| 262 |
+
exact congrArg (fun z : Σ i, Fin (n i) => (c z.1).coord (g z.1) z.2)
|
| 263 |
+
(e.apply_symm_apply _)
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
def coordinates : RealCoordinates (∀ i, G i) N where
|
| 267 |
+
coord := homeomorph n G c e
|
| 268 |
+
one_coord k := (c (e k).1).one_coord (e k).2
|
| 269 |
+
correction k := MvPolynomial.rename (Sum.map (lower n e he k) (lower n e he k))
|
| 270 |
+
((c (e k).1).correction (e k).2)
|
| 271 |
+
mul_coord g h k := by
|
| 272 |
+
change (c (e k).1).coord (g (e k).1 * h (e k).1) (e k).2 = _
|
| 273 |
+
rw [(c (e k).1).mul_coord]
|
| 274 |
+
congr 1
|
| 275 |
+
rw [MvPolynomial.eval₂_rename]
|
| 276 |
+
congr 1
|
| 277 |
+
funext j
|
| 278 |
+
cases j with
|
| 279 |
+
| inl j => exact (homeomorph_lower n G c e he g k j).symm
|
| 280 |
+
| inr j => exact (homeomorph_lower n G c e he h k j).symm
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
def select (i : Fin d) (k : Fin N) : Option (Fin (n i)) :=
|
| 284 |
+
if h : (e k).1 = i then some (h ▸ (e k).2) else none
|
| 285 |
+
|
| 286 |
+
lemma select_some_iff (i : Fin d) (k : Fin N) (j : Fin (n i)) :
|
| 287 |
+
select n e i k = some j ↔ e k = ⟨i,j⟩ := by
|
| 288 |
+
unfold select
|
| 289 |
+
split_ifs with h
|
| 290 |
+
· subst i
|
| 291 |
+
simp only [Option.some.injEq]
|
| 292 |
+
constructor
|
| 293 |
+
· intro h
|
| 294 |
+
cases h
|
| 295 |
+
rfl
|
| 296 |
+
· intro h
|
| 297 |
+
exact eq_of_heq (Sigma.mk.inj h).2
|
| 298 |
+
· constructor
|
| 299 |
+
· intro h'
|
| 300 |
+
cases h'
|
| 301 |
+
· intro h'
|
| 302 |
+
exact False.elim (h (congrArg Sigma.fst h'))
|
| 303 |
+
|
| 304 |
+
include he in
|
| 305 |
+
lemma select_enumeration (i : Fin d) :
|
| 306 |
+
(List.ofFn (fun k : Fin N => k)).filterMap (select n e i) =
|
| 307 |
+
List.ofFn (fun j : Fin (n i) => j) := by
|
| 308 |
+
apply List.Pairwise.eq_of_mem_iff (r := (· < ·))
|
| 309 |
+
· apply List.pairwise_filterMap.mpr
|
| 310 |
+
apply List.pairwise_ofFn.mpr
|
| 311 |
+
intro k l hkl j hj j' hj'
|
| 312 |
+
have hk : e.symm ⟨i,j⟩ = k := e.symm_apply_eq.mpr ((select_some_iff n e i k j).mp hj).symm
|
| 313 |
+
have hl : e.symm ⟨i,j'⟩ = l := e.symm_apply_eq.mpr ((select_some_iff n e i l j').mp hj').symm
|
| 314 |
+
exact (he i).lt_iff_lt.mp (by simpa only [hk,hl] using hkl)
|
| 315 |
+
· exact List.pairwise_ofFn.mpr (fun _ _ h => h)
|
| 316 |
+
· intro j
|
| 317 |
+
simp only [List.mem_filterMap, List.mem_ofFn]
|
| 318 |
+
constructor
|
| 319 |
+
· intro h
|
| 320 |
+
exact ⟨j,rfl⟩
|
| 321 |
+
· intro h
|
| 322 |
+
refine ⟨e.symm ⟨i,j⟩,⟨e.symm ⟨i,j⟩,rfl⟩,?_⟩
|
| 323 |
+
exact (select_some_iff n e i _ j).mpr (e.apply_symm_apply _)
|
| 324 |
+
|
| 325 |
+
lemma axis_selected (k : Fin N) (t : ℝ) (i : Fin d) (j : Fin (n i))
|
| 326 |
+
(hk : e k = ⟨i,j⟩) :
|
| 327 |
+
axis (coordinates n G c e he) k t i = axis (c i) j t := by
|
| 328 |
+
apply (c i).coord.injective
|
| 329 |
+
ext v
|
| 330 |
+
change (c i).coord ((c i).coord.symm (fun v => (Pi.single k t : Fin N → ℝ) (e.symm ⟨i,v⟩))) v = _
|
| 331 |
+
rw [(c i).coord.apply_symm_apply]
|
| 332 |
+
simp only [axis, Homeomorph.apply_symm_apply]
|
| 333 |
+
have hkv : e.symm ⟨i,v⟩ = k ↔ v=j := by
|
| 334 |
+
rw [e.symm_apply_eq, hk]
|
| 335 |
+
constructor
|
| 336 |
+
· intro h
|
| 337 |
+
exact eq_of_heq (Sigma.mk.inj h).2
|
| 338 |
+
· rintro rfl
|
| 339 |
+
rfl
|
| 340 |
+
simp only [Pi.single_apply, hkv]
|
| 341 |
+
|
| 342 |
+
lemma axis_other (k : Fin N) (t : ℝ) (i : Fin d) (hk : (e k).1 ≠ i) :
|
| 343 |
+
axis (coordinates n G c e he) k t i = 1 := by
|
| 344 |
+
apply (c i).coord.injective
|
| 345 |
+
ext v
|
| 346 |
+
change (c i).coord ((c i).coord.symm (fun v => (Pi.single k t : Fin N → ℝ) (e.symm ⟨i,v⟩))) v = _
|
| 347 |
+
rw [(c i).coord.apply_symm_apply, (c i).one_coord]
|
| 348 |
+
apply Pi.single_eq_of_ne
|
| 349 |
+
intro h
|
| 350 |
+
have h' := e.symm_apply_eq.mp h
|
| 351 |
+
exact hk (congrArg Sigma.fst h').symm
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
lemma prod_select {α β M : Type*} [Monoid M] (l : List α)
|
| 355 |
+
(f : α → Option β) (g : β → M) (h : α → M)
|
| 356 |
+
(hh : ∀ x, h x = (f x).elim 1 g) :
|
| 357 |
+
(l.map h).prod = ((l.filterMap f).map g).prod := by
|
| 358 |
+
induction l with
|
| 359 |
+
| nil => rfl
|
| 360 |
+
| cons x xs ih =>
|
| 361 |
+
cases hf : f x with
|
| 362 |
+
| none => simpa [hh x, hf] using ih
|
| 363 |
+
| some y => simpa [hh x, hf] using congrArg (fun z => g y*z) ih
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
theorem secondKind (hs : ∀ i, SecondKind (c i)) :
|
| 368 |
+
SecondKind (coordinates n G c e he) where
|
| 369 |
+
axis_add k s t := by
|
| 370 |
+
funext i
|
| 371 |
+
by_cases hi : (e k).1 = i
|
| 372 |
+
· subst i
|
| 373 |
+
rw [axis_selected n G c e he k (s+t) (e k).1 (e k).2 rfl,
|
| 374 |
+
Pi.mul_apply, axis_selected n G c e he k s (e k).1 (e k).2 rfl,
|
| 375 |
+
axis_selected n G c e he k t (e k).1 (e k).2 rfl]
|
| 376 |
+
exact (hs _).axis_add _ _ _
|
| 377 |
+
· rw [axis_other n G c e he k (s+t) i hi, Pi.mul_apply,
|
| 378 |
+
axis_other n G c e he k s i hi, axis_other n G c e he k t i hi, one_mul]
|
| 379 |
+
ordered g := by
|
| 380 |
+
funext i
|
| 381 |
+
change g i = (Pi.evalMonoidHom G i)
|
| 382 |
+
(List.ofFn (fun k => axis (coordinates n G c e he) k ((coordinates n G c e he).coord g k))).prod
|
| 383 |
+
rw [map_list_prod, List.map_ofFn]
|
| 384 |
+
change g i = (List.ofFn (fun k : Fin N =>
|
| 385 |
+
axis (coordinates n G c e he) k ((coordinates n G c e he).coord g k) i)).prod
|
| 386 |
+
have hprod := prod_select (List.ofFn (fun k : Fin N => k)) (select n e i)
|
| 387 |
+
(fun j => axis (c i) j ((c i).coord (g i) j))
|
| 388 |
+
(fun k => axis (coordinates n G c e he) k ((coordinates n G c e he).coord g k) i) (by
|
| 389 |
+
intro k
|
| 390 |
+
by_cases hi : (e k).1 = i
|
| 391 |
+
· have hk : e k = ⟨i,hi ▸ (e k).2⟩ := by cases hi; rfl
|
| 392 |
+
rw [select, dite_eq_left hi, Option.elim_some, axis_selected n G c e he _ _ _ _ hk]
|
| 393 |
+
congr 1
|
| 394 |
+
change (c (e k).1).coord (g (e k).1) (e k).2 = _
|
| 395 |
+
exact congrArg (fun z : Σ i, Fin (n i) => (c z.1).coord (g z.1) z.2) hk
|
| 396 |
+
· rw [select, dite_eq_right hi, Option.elim_none, axis_other n G c e he _ _ _ hi])
|
| 397 |
+
rw [List.map_ofFn, select_enumeration n e he i, List.map_ofFn] at hprod
|
| 398 |
+
exact ((hs i).ordered (g i)).trans hprod.symm
|
| 399 |
+
|
| 400 |
+
end SourceProductCoordinates
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
|
| 404 |
+
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
|
| 408 |
+
end
|
| 409 |
+
end
|
| 410 |
+
end
|
| 411 |
+
end
|
| 412 |
+
end
|
| 413 |
+
end
|
| 414 |
+
end
|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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
section
|
| 7 |
+
section RawSuccessInlineScope0
|
| 8 |
+
noncomputable section
|
| 9 |
+
open MeasureTheory Filter Topology
|
| 10 |
+
open scoped BigOperators
|
| 11 |
+
end
|
| 12 |
+
end RawSuccessInlineScope0
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
section RawSuccessInlineScope1
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
open scoped Topology BigOperators
|
| 23 |
+
open Filter MeasureTheory Set
|
| 24 |
+
|
| 25 |
+
namespace SourcePointLaw
|
| 26 |
+
|
| 27 |
+
noncomputable section
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
theorem interval_induction (p : ℝ → ℝ → Prop)
|
| 32 |
+
(hjoin : ∀ a b : ℝ, 0 ≤ a → a < b → b ≤ 1 →
|
| 33 |
+
p a ((a + b) / 2) → p ((a + b) / 2) b → p a b)
|
| 34 |
+
(hlocal : ∀ x ∈ Icc (0 : ℝ) 1, ∃ δ > 0, ∀ a b : ℝ,
|
| 35 |
+
0 ≤ a → a < b → b ≤ 1 → a ≤ x → x ≤ b → b - a < δ → p a b) :
|
| 36 |
+
p 0 1 := by
|
| 37 |
+
let I : BoxIntegral.Box Unit := ⟨fun _ => 0, fun _ => 1, fun _ => by norm_num⟩
|
| 38 |
+
change p (I.lower ()) (I.upper ())
|
| 39 |
+
apply I.subbox_induction_on' (p := fun J => p (J.lower ()) (J.upper ()))
|
| 40 |
+
· intro J hJ hs
|
| 41 |
+
have hlo : 0 ≤ J.lower () := (BoxIntegral.Box.le_iff_bounds.mp hJ).1 ()
|
| 42 |
+
have hup : J.upper () ≤ 1 := (BoxIntegral.Box.le_iff_bounds.mp hJ).2 ()
|
| 43 |
+
have h₁ := hs (∅ : Set Unit)
|
| 44 |
+
have h₂ := hs (univ : Set Unit)
|
| 45 |
+
simp [BoxIntegral.Box.splitCenterBox] at h₁ h₂
|
| 46 |
+
exact hjoin _ _ hlo (J.lower_lt_upper ()) hup h₁ h₂
|
| 47 |
+
· intro z hz
|
| 48 |
+
have hz' : z () ∈ Icc (0 : ℝ) 1 := ⟨hz.1 (), hz.2 ()⟩
|
| 49 |
+
obtain ⟨δ, hδ, hδp⟩ := hlocal (z ()) hz'
|
| 50 |
+
refine ⟨{y : Unit → ℝ | |y () - z ()| < δ / 3}, ?_, ?_⟩
|
| 51 |
+
· apply mem_nhdsWithin_of_mem_nhds
|
| 52 |
+
have hh : Continuous (fun y : Unit → ℝ => |y () - z ()|) :=
|
| 53 |
+
((continuous_apply ()).sub continuous_const).abs
|
| 54 |
+
exact IsOpen.mem_nhds (isOpen_lt hh continuous_const) (by simp only [Set.mem_ofPred_eq, sub_self, abs_zero]; positivity)
|
| 55 |
+
· intro J hJ m hzJ hsub _
|
| 56 |
+
have hlo : 0 ≤ J.lower () := (BoxIntegral.Box.le_iff_bounds.mp hJ).1 ()
|
| 57 |
+
have hup : J.upper () ≤ 1 := (BoxIntegral.Box.le_iff_bounds.mp hJ).2 ()
|
| 58 |
+
have hl := hsub J.lower_mem_Icc
|
| 59 |
+
have hu := hsub J.upper_mem_Icc
|
| 60 |
+
change |J.lower () - z ()| < δ / 3 at hl
|
| 61 |
+
change |J.upper () - z ()| < δ / 3 at hu
|
| 62 |
+
apply hδp _ _ hlo (J.lower_lt_upper ()) hup (hzJ.1 ()) (hzJ.2 ())
|
| 63 |
+
have hl' := (abs_lt.mp hl).1
|
| 64 |
+
have hu' := (abs_lt.mp hu).2
|
| 65 |
+
linarith
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
theorem tendsto_of_local_interval_law
|
| 70 |
+
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
|
| 71 |
+
{ι : Type*} (l : Filter ι) (A : ι → ℝ → ℝ → E) (f : ℝ → E)
|
| 72 |
+
(hadd : ∀ N a b c, 0 ≤ a → a ≤ b → b ≤ c → c ≤ 1 →
|
| 73 |
+
A N a c = A N a b + A N b c)
|
| 74 |
+
(hf : ContinuousOn f (Icc (0 : ℝ) 1))
|
| 75 |
+
(hlocal : ∀ x ∈ Icc (0 : ℝ) 1, ∀ ε > 0, ∃ δ > 0,
|
| 76 |
+
∀ a b : ℝ, 0 ≤ a → a < b → b ≤ 1 → a ≤ x → x ≤ b → b - a < δ →
|
| 77 |
+
∀ᶠ N : ι in l, ‖A N a b - (b - a) • f x‖ ≤ ε * (b - a)) :
|
| 78 |
+
Tendsto (fun N => A N 0 1) l (𝓝 (∫ x in (0 : ℝ)..1, f x)) := by
|
| 79 |
+
have hint (a b : ℝ) (ha : 0 ≤ a) (hab : a ≤ b) (hb : b ≤ 1) :
|
| 80 |
+
IntervalIntegrable f volume a b :=
|
| 81 |
+
ContinuousOn.intervalIntegrable_of_Icc hab (hf.mono (Icc_subset_Icc ha hb))
|
| 82 |
+
apply Metric.tendsto_nhds.mpr
|
| 83 |
+
intro ε hε
|
| 84 |
+
have hε4 : 0 < ε / 4 := by positivity
|
| 85 |
+
have hevent : ∀ᶠ N : ι in l,
|
| 86 |
+
‖A N 0 1 - ∫ x in (0 : ℝ)..1, f x‖ ≤ ε / 2 * (1 - 0) := by
|
| 87 |
+
apply interval_induction (fun a b => ∀ᶠ N : ι in l,
|
| 88 |
+
‖A N a b - ∫ x in a..b, f x‖ ≤ ε / 2 * (b - a))
|
| 89 |
+
· intro a b ha hab hb hl hr
|
| 90 |
+
let c := (a + b) / 2
|
| 91 |
+
have hac : a ≤ c := by dsimp [c]; linarith
|
| 92 |
+
have hcb : c ≤ b := by dsimp [c]; linarith
|
| 93 |
+
have hic := hint a c ha hac (hcb.trans hb)
|
| 94 |
+
have hci := hint c b (ha.trans hac) hcb hb
|
| 95 |
+
filter_upwards [hl, hr] with N hNl hNr
|
| 96 |
+
rw [hadd N a c b ha hac hcb hb,
|
| 97 |
+
← intervalIntegral.integral_add_adjacent_intervals hic hci]
|
| 98 |
+
calc
|
| 99 |
+
‖A N a c + A N c b -
|
| 100 |
+
((∫ x in a..c, f x) + ∫ x in c..b, f x)‖ =
|
| 101 |
+
‖(A N a c - ∫ x in a..c, f x) + (A N c b - ∫ x in c..b, f x)‖ :=
|
| 102 |
+
congrArg norm (by abel)
|
| 103 |
+
_ ≤ ‖A N a c - ∫ x in a..c, f x‖ + ‖A N c b - ∫ x in c..b, f x‖ :=
|
| 104 |
+
norm_add_le _ _
|
| 105 |
+
_ ≤ ε / 2 * (b - a) := by dsimp [c] at *; linarith
|
| 106 |
+
· intro x hx
|
| 107 |
+
obtain ⟨δ₁, hδ₁, hδ₁p⟩ := hlocal x hx (ε / 4) hε4
|
| 108 |
+
obtain ⟨δ₂, hδ₂, hδ₂p⟩ := Metric.continuousWithinAt_iff.mp (hf x hx) (ε / 4) hε4
|
| 109 |
+
refine ⟨min δ₁ δ₂, lt_min hδ₁ hδ₂, ?_⟩
|
| 110 |
+
intro a b ha hab hb hax hxb hδ
|
| 111 |
+
have hδa : b - a < δ₁ := hδ.trans_le (min_le_left _ _)
|
| 112 |
+
have hδb : b - a < δ₂ := hδ.trans_le (min_le_right _ _)
|
| 113 |
+
have hi := hint a b ha hab.le hb
|
| 114 |
+
have herr : ‖(b - a) • f x - ∫ y in a..b, f y‖ ≤ ε / 4 * (b - a) := by
|
| 115 |
+
rw [← intervalIntegral.integral_const,
|
| 116 |
+
← intervalIntegral.integral_sub intervalIntegrable_const hi]
|
| 117 |
+
have hbound : ∀ y ∈ uIoc a b, ‖f x - f y‖ ≤ ε / 4 := by
|
| 118 |
+
intro y hy
|
| 119 |
+
rw [uIoc_of_le hab.le] at hy
|
| 120 |
+
have hy' : y ∈ Icc (0 : ℝ) 1 := ⟨ha.trans hy.1.le, hy.2.trans hb⟩
|
| 121 |
+
have hdist : dist y x ≤ b - a := by
|
| 122 |
+
rw [Real.dist_eq, abs_le]
|
| 123 |
+
constructor <;> linarith [hy.1, hy.2]
|
| 124 |
+
have hc := (hδ₂p hy' (hdist.trans_lt hδb)).le
|
| 125 |
+
simpa only [dist_eq_norm, norm_sub_rev] using hc
|
| 126 |
+
simpa only [abs_of_pos (sub_pos.mpr hab)] using
|
| 127 |
+
intervalIntegral.norm_integral_le_of_norm_le_const hbound
|
| 128 |
+
filter_upwards [hδ₁p a b ha hab hb hax hxb hδa] with N hN
|
| 129 |
+
calc
|
| 130 |
+
‖A N a b - ∫ y in a..b, f y‖ ≤
|
| 131 |
+
‖A N a b - (b - a) • f x‖ + ‖(b - a) • f x - ∫ y in a..b, f y‖ :=
|
| 132 |
+
by simpa only [dist_eq_norm] using
|
| 133 |
+
dist_triangle (A N a b) ((b - a) • f x) (∫ y in a..b, f y)
|
| 134 |
+
_ ≤ ε / 2 * (b - a) := by linarith
|
| 135 |
+
filter_upwards [hevent] with N hN
|
| 136 |
+
rw [dist_eq_norm]
|
| 137 |
+
have : ε / 2 < ε := by linarith
|
| 138 |
+
exact hN.trans_lt (by simpa using this)
|
| 139 |
+
|
| 140 |
+
end
|
| 141 |
+
end SourcePointLaw
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
open scoped Topology BigOperators
|
| 146 |
+
open Filter MeasureTheory Set
|
| 147 |
+
|
| 148 |
+
namespace SourcePointLaw
|
| 149 |
+
noncomputable section
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
def residueInterval (d : ℕ) (r : ℤ) (a b : ℝ) : Finset ℤ :=
|
| 153 |
+
(Finset.Ico ⌈a⌉ ⌈b⌉).filter (fun n => n % (d : ℤ) = r)
|
| 154 |
+
|
| 155 |
+
lemma mem_residueInterval (d : ℕ) (r n : ℤ) (a b : ℝ) :
|
| 156 |
+
n ∈ residueInterval d r a b ↔ (a ≤ (n : ℝ) ∧ (n : ℝ) < b) ∧ n % (d : ℤ) = r := by
|
| 157 |
+
simp only [residueInterval, Finset.mem_filter, Finset.mem_Ico, Int.ceil_le, Int.lt_ceil]
|
| 158 |
+
|
| 159 |
+
lemma residueInterval_affine (d : ℕ) (hd : 0 < d) (r : ℤ)
|
| 160 |
+
(hr : 0 ≤ r ∧ r < (d : ℤ)) (a b : ℝ) :
|
| 161 |
+
residueInterval d r a b =
|
| 162 |
+
(Finset.Ico ⌈(a - (r : ℝ)) / (d : ℝ)⌉ ⌈(b - (r : ℝ)) / (d : ℝ)⌉).map
|
| 163 |
+
⟨fun k => r + (d : ℤ) * k, by
|
| 164 |
+
intro x y h
|
| 165 |
+
have hd' : (d : ℤ) ≠ 0 := by exact_mod_cast hd.ne'
|
| 166 |
+
exact mul_left_cancel₀ hd' (add_left_cancel h)⟩ := by
|
| 167 |
+
have hdR : (0 : ℝ) < d := by exact_mod_cast hd
|
| 168 |
+
have hmem (k : ℤ) :
|
| 169 |
+
k ∈ Finset.Ico ⌈(a - (r : ℝ)) / (d : ℝ)⌉ ⌈(b - (r : ℝ)) / (d : ℝ)⌉ ↔
|
| 170 |
+
a ≤ ((r + (d : ℤ) * k : ℤ) : ℝ) ∧ ((r + (d : ℤ) * k : ℤ) : ℝ) < b := by
|
| 171 |
+
simp only [Finset.mem_Ico, Int.ceil_le, Int.lt_ceil, Int.cast_add, Int.cast_mul,
|
| 172 |
+
Int.cast_natCast, div_le_iff₀ hdR, lt_div_iff₀ hdR]
|
| 173 |
+
constructor <;> intro h <;> constructor <;> nlinarith [h.1, h.2]
|
| 174 |
+
ext n
|
| 175 |
+
rw [mem_residueInterval, Finset.mem_map]
|
| 176 |
+
constructor
|
| 177 |
+
· rintro ⟨hn, hmod⟩
|
| 178 |
+
have he : r + (d : ℤ) * (n / (d : ℤ)) = n := by
|
| 179 |
+
rw [← hmod]
|
| 180 |
+
exact Int.emod_add_mul_ediv n d
|
| 181 |
+
refine ⟨n / (d : ℤ), hmem _ |>.mpr ?_, he⟩
|
| 182 |
+
simpa only [he] using hn
|
| 183 |
+
· rintro ⟨k, hk, rfl⟩
|
| 184 |
+
refine ⟨(hmem k).mp hk, ?_⟩
|
| 185 |
+
change (r + (d : ℤ) * k) % (d : ℤ) = r
|
| 186 |
+
rw [Int.add_mul_emod_self_left]
|
| 187 |
+
exact Int.emod_eq_of_lt hr.1 hr.2
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
theorem residueInterval_card_error (d : ℕ) (hd : 0 < d) (r : ℤ)
|
| 191 |
+
(hr : 0 ≤ r ∧ r < (d : ℤ)) (a b : ℝ) (hab : a ≤ b) :
|
| 192 |
+
|((residueInterval d r a b).card : ℝ) - (b - a) / (d : ℝ)| < 1 := by
|
| 193 |
+
have hdR : (0 : ℝ) < d := by exact_mod_cast hd
|
| 194 |
+
let u := (a - (r : ℝ)) / (d : ℝ)
|
| 195 |
+
let v := (b - (r : ℝ)) / (d : ℝ)
|
| 196 |
+
have huv : u ≤ v := div_le_div_of_nonneg_right (sub_le_sub_right hab _) hdR.le
|
| 197 |
+
have hceil : ⌈u⌉ ≤ ⌈v⌉ := Int.ceil_mono huv
|
| 198 |
+
have hcard : ((residueInterval d r a b).card : ℤ) = ⌈v⌉ - ⌈u⌉ := by
|
| 199 |
+
rw [residueInterval_affine d hd r hr, Finset.card_map, Int.card_Ico]
|
| 200 |
+
exact Int.toNat_of_nonneg (sub_nonneg.mpr hceil)
|
| 201 |
+
have hcardR : ((residueInterval d r a b).card : ℝ) = (⌈v⌉ : ℝ) - (⌈u⌉ : ℝ) := by
|
| 202 |
+
exact_mod_cast hcard
|
| 203 |
+
have hvu : v - u = (b - a) / (d : ℝ) := by dsimp [v, u]; ring
|
| 204 |
+
rw [hcardR, ← hvu, abs_lt]
|
| 205 |
+
constructor <;> linarith [Int.le_ceil u, Int.ceil_lt_add_one u,
|
| 206 |
+
Int.le_ceil v, Int.ceil_lt_add_one v]
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
theorem residueInterval_card_scaled_error (d : ℕ) (hd : 0 < d) (r : ℤ)
|
| 210 |
+
(hr : 0 ≤ r ∧ r < (d : ℤ)) (a b : ℝ) (hab : a ≤ b)
|
| 211 |
+
(N : ℕ) (hN : 0 < N) :
|
| 212 |
+
|((residueInterval d r (a * N) (b * N)).card : ℝ) / N - (b - a) / (d : ℝ)| <
|
| 213 |
+
1 / (N : ℝ) := by
|
| 214 |
+
have hNR : (0 : ℝ) < N := by exact_mod_cast hN
|
| 215 |
+
have he := residueInterval_card_error d hd r hr (a * N) (b * N)
|
| 216 |
+
(mul_le_mul_of_nonneg_right hab hNR.le)
|
| 217 |
+
have hi : ((residueInterval d r (a * N) (b * N)).card : ℝ) / N - (b - a) / (d : ℝ) =
|
| 218 |
+
(((residueInterval d r (a * N) (b * N)).card : ℝ) -
|
| 219 |
+
(b * N - a * N) / (d : ℝ)) / N := by
|
| 220 |
+
field_simp
|
| 221 |
+
rw [hi, abs_div, abs_of_pos hNR]
|
| 222 |
+
exact (div_lt_div_iff_of_pos_right hNR).mpr he
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
theorem residueInterval_card_tendsto (d : ℕ) (hd : 0 < d) (r : ℤ)
|
| 226 |
+
(hr : 0 ≤ r ∧ r < (d : ℤ)) (a b : ℝ) (hab : a ≤ b) :
|
| 227 |
+
Tendsto (fun N : ℕ => ((residueInterval d r (a * N) (b * N)).card : ℝ) / N)
|
| 228 |
+
atTop (𝓝 ((b - a) / (d : ℝ))) := by
|
| 229 |
+
apply tendsto_iff_norm_sub_tendsto_zero.mpr
|
| 230 |
+
apply squeeze_zero' (Filter.Eventually.of_forall (fun _ => norm_nonneg _))
|
| 231 |
+
· filter_upwards [Filter.eventually_ge_atTop (1 : ℕ)] with N hN
|
| 232 |
+
simpa only [Real.norm_eq_abs] using
|
| 233 |
+
(residueInterval_card_scaled_error d hd r hr a b hab N (by omega)).le
|
| 234 |
+
· exact tendsto_const_div_atTop_nhds_zero_nat (1 : ℝ)
|
| 235 |
+
|
| 236 |
+
lemma residueInterval_union (d : ℕ) (r : ℤ) (a b c : ℝ)
|
| 237 |
+
(hab : a ≤ b) (hbc : b ≤ c) :
|
| 238 |
+
residueInterval d r a c = residueInterval d r a b ∪ residueInterval d r b c := by
|
| 239 |
+
ext n
|
| 240 |
+
simp only [mem_residueInterval, Finset.mem_union]
|
| 241 |
+
constructor
|
| 242 |
+
· rintro ⟨⟨hna, hnc⟩, hnmod⟩
|
| 243 |
+
by_cases hnb : (n : ℝ) < b
|
| 244 |
+
· exact Or.inl ⟨⟨hna, hnb⟩, hnmod⟩
|
| 245 |
+
· exact Or.inr ⟨⟨le_of_not_gt hnb, hnc⟩, hnmod⟩
|
| 246 |
+
· rintro (⟨⟨hna, hnb⟩, hnmod⟩ | ⟨⟨hnb, hnc⟩, hnmod⟩)
|
| 247 |
+
· exact ⟨⟨hna, hnb.trans_le hbc⟩, hnmod⟩
|
| 248 |
+
· exact ⟨⟨hab.trans hnb, hnc⟩, hnmod⟩
|
| 249 |
+
|
| 250 |
+
lemma residueInterval_disjoint (d : ℕ) (r : ℤ) (a b c : ℝ) :
|
| 251 |
+
Disjoint (residueInterval d r a b) (residueInterval d r b c) := by
|
| 252 |
+
apply Finset.disjoint_left.mpr
|
| 253 |
+
intro n hn hm
|
| 254 |
+
rw [mem_residueInterval] at hn hm
|
| 255 |
+
exact (not_lt_of_ge hm.1.1) hn.1.2
|
| 256 |
+
|
| 257 |
+
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
def windowSum (P : ℕ → ℤ → E) (d : ℕ) (r : ℤ) (N : ℕ) (a b : ℝ) : E :=
|
| 262 |
+
(N : ℝ)⁻¹ • ∑ n ∈ residueInterval d r (a * N) (b * N), P N n
|
| 263 |
+
|
| 264 |
+
lemma windowSum_add (P : ℕ → ℤ → E) (d : ℕ) (r : ℤ) (N : ℕ)
|
| 265 |
+
(a b c : ℝ) (hab : a ≤ b) (hbc : b ≤ c) :
|
| 266 |
+
windowSum P d r N a c = windowSum P d r N a b + windowSum P d r N b c := by
|
| 267 |
+
have hN : (0 : ℝ) ≤ N := Nat.cast_nonneg _
|
| 268 |
+
simp only [windowSum, residueInterval_union d r _ _ _
|
| 269 |
+
(mul_le_mul_of_nonneg_right hab hN) (mul_le_mul_of_nonneg_right hbc hN),
|
| 270 |
+
Finset.sum_union (residueInterval_disjoint d r _ _ _), smul_add]
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
|
| 274 |
+
lemma windowSum_eq [Module ℚ≥0 E] (P : ℕ → ℤ → E) (d : ℕ) (r : ℤ) (N : ℕ) (a b : ℝ) :
|
| 275 |
+
windowSum P d r N a b =
|
| 276 |
+
(((residueInterval d r (a * N) (b * N)).card : ℝ) / N) •
|
| 277 |
+
(𝔼 n ∈ residueInterval d r (a * N) (b * N), P N n) := by
|
| 278 |
+
rw [windowSum, ← Finset.card_smul_expect]
|
| 279 |
+
rw [← Nat.cast_smul_eq_nsmul ℝ, smul_smul]
|
| 280 |
+
congr 1
|
| 281 |
+
ring
|
| 282 |
+
|
| 283 |
+
end
|
| 284 |
+
end SourcePointLaw
|
| 285 |
+
|
| 286 |
+
end RawSuccessInlineScope1
|
| 287 |
+
end
|
| 288 |
+
|
| 289 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PointLaw02.lean
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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aw01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section RawSuccessInlineScope1
|
| 9 |
+
open scoped Topology BigOperators
|
| 10 |
+
open Filter MeasureTheory Set
|
| 11 |
+
open scoped Topology BigOperators
|
| 12 |
+
open Filter MeasureTheory Set
|
| 13 |
+
namespace SourcePointLaw
|
| 14 |
+
noncomputable section
|
| 15 |
+
open scoped Topology BigOperators
|
| 16 |
+
open Filter MeasureTheory Set
|
| 17 |
+
|
| 18 |
+
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
|
| 19 |
+
[CompleteSpace E] [Module ℚ≥0 E]
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
theorem residue_point_law
|
| 24 |
+
(P : ℕ → ℤ → E) (d : ℕ) (hd : 0 < d) (r : ℤ)
|
| 25 |
+
(hr : 0 ≤ r ∧ r < (d : ℤ)) (f : ℝ → E)
|
| 26 |
+
(hf : ContinuousOn f (Icc (0 : ℝ) 1))
|
| 27 |
+
(hloc : ∀ x ∈ Icc (0 : ℝ) 1, ∀ ε > 0,
|
| 28 |
+
∀ᶠ α : ℝ in 𝓝[>] 0, ∀ᶠ N : ℕ in atTop,
|
| 29 |
+
∀ a b : ℝ, 0 ≤ a → a ≤ x → x ≤ b → b ≤ 1 → b - a = α →
|
| 30 |
+
‖(𝔼 n ∈ residueInterval d r (a * N) (b * N), P N n) - f x‖ < ε) :
|
| 31 |
+
Tendsto (fun N => windowSum P d r N 0 1) atTop
|
| 32 |
+
(𝓝 ((d : ℝ)⁻¹ • ∫ x in (0 : ℝ)..1, f x)) := by
|
| 33 |
+
have hdR : (0 : ℝ) < d := by exact_mod_cast hd
|
| 34 |
+
rw [← intervalIntegral.integral_smul]
|
| 35 |
+
apply tendsto_of_local_interval_law atTop (windowSum P d r)
|
| 36 |
+
(fun x => (d : ℝ)⁻¹ • f x)
|
| 37 |
+
· intro N a b c _ hab hbc _
|
| 38 |
+
exact windowSum_add P d r N a b c hab hbc
|
| 39 |
+
· exact hf.const_smul _
|
| 40 |
+
· intro x hx ε hε
|
| 41 |
+
have hη : 0 < ε * (d : ℝ) / 4 := by positivity
|
| 42 |
+
obtain ⟨δ, hδ, hδp⟩ := mem_nhdsGT_iff_exists_Ioo_subset.mp (hloc x hx _ hη)
|
| 43 |
+
refine ⟨δ, hδ, ?_⟩
|
| 44 |
+
intro a b ha hab hb hax hxb hlen
|
| 45 |
+
have hlocal := hδp ⟨sub_pos.mpr hab, hlen⟩
|
| 46 |
+
have hm := residueInterval_card_tendsto d hd r hr a b hab.le
|
| 47 |
+
have hup : ∀ᶠ N : ℕ in atTop,
|
| 48 |
+
((residueInterval d r (a * N) (b * N)).card : ℝ) / N <
|
| 49 |
+
2 * (b - a) / (d : ℝ) :=
|
| 50 |
+
(tendsto_order.mp hm).2 _ (by rw [mul_div_assoc]; have : 0 < (b-a)/(d:ℝ) := div_pos (sub_pos.mpr hab) hdR; linarith)
|
| 51 |
+
have hsm := hm.smul (tendsto_const_nhds (x := f x))
|
| 52 |
+
have heps : 0 < ε * (b - a) / 2 := by positivity
|
| 53 |
+
have herr := (Metric.tendsto_nhds.mp hsm) _ heps
|
| 54 |
+
filter_upwards [hlocal, hup, herr] with N hN hupper herror
|
| 55 |
+
have hmass : 0 ≤ ((residueInterval d r (a * N) (b * N)).card : ℝ) / N :=
|
| 56 |
+
div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _)
|
| 57 |
+
have havg := hN a b ha hax hxb hb rfl
|
| 58 |
+
rw [windowSum_eq]
|
| 59 |
+
have hscale : (b - a) • ((d : ℝ)⁻¹ • f x) = ((b - a)/(d : ℝ)) • f x := by
|
| 60 |
+
simp only [smul_smul, div_eq_mul_inv]
|
| 61 |
+
rw [hscale]
|
| 62 |
+
calc
|
| 63 |
+
_ ≤ ‖(((residueInterval d r (a * N) (b * N)).card : ℝ) / N) •
|
| 64 |
+
((𝔼 n ∈ residueInterval d r (a * N) (b * N), P N n) - f x)‖ +
|
| 65 |
+
‖(((residueInterval d r (a * N) (b * N)).card : ℝ) / N) • f x -
|
| 66 |
+
((b - a)/(d : ℝ)) • f x‖ := by
|
| 67 |
+
rw [smul_sub]
|
| 68 |
+
exact (show _ from norm_add_le _ _).trans_eq' (congrArg norm (by abel))
|
| 69 |
+
_ ≤ (2 * (b - a) / (d : ℝ)) * (ε * (d : ℝ) / 4) + ε * (b - a) / 2 := by
|
| 70 |
+
apply add_le_add
|
| 71 |
+
· rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hmass]
|
| 72 |
+
exact mul_le_mul hupper.le havg.le (norm_nonneg _) (by positivity)
|
| 73 |
+
· simpa only [dist_eq_norm] using herror.le
|
| 74 |
+
_ = ε * (b - a) := by field_simp; ring
|
| 75 |
+
|
| 76 |
+
end
|
| 77 |
+
end SourcePointLaw
|
| 78 |
+
|
| 79 |
+
namespace SourcePointLaw
|
| 80 |
+
noncomputable section
|
| 81 |
+
open scoped Topology BigOperators
|
| 82 |
+
open Filter MeasureTheory Set
|
| 83 |
+
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
omit [NormedSpace ℝ E] in
|
| 87 |
+
lemma residueInterval_sum (d : ℕ) (hd : 0 < d) (a b : ℝ) (F : ℤ → E) :
|
| 88 |
+
∑ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), ∑ n ∈ residueInterval d r a b, F n =
|
| 89 |
+
∑ n ∈ Finset.Ico ⌈a⌉ ⌈b⌉, F n := by
|
| 90 |
+
apply Finset.sum_fiberwise_of_maps_to
|
| 91 |
+
intro n hn
|
| 92 |
+
have hd' : (0 : ℤ) < d := by exact_mod_cast hd
|
| 93 |
+
exact Finset.mem_Ico.mpr ⟨Int.emod_nonneg n hd'.ne', Int.emod_lt_of_pos n hd'⟩
|
| 94 |
+
|
| 95 |
+
omit [NormedSpace ℝ E] in
|
| 96 |
+
lemma sum_int_Ico_zero_nat (N : ℕ) (F : ℤ → E) :
|
| 97 |
+
∑ n ∈ Finset.Ico (0 : ℤ) (N : ℤ), F n = ∑ n ∈ Finset.range N, F n := by
|
| 98 |
+
symm
|
| 99 |
+
apply Finset.sum_bij (fun (n : ℕ) _ => (n : ℤ))
|
| 100 |
+
· intro n hn
|
| 101 |
+
simp only [Finset.mem_range] at hn
|
| 102 |
+
exact Finset.mem_Ico.mpr ⟨Int.natCast_nonneg _, by exact_mod_cast hn⟩
|
| 103 |
+
· intro a ha b hb hab
|
| 104 |
+
exact_mod_cast hab
|
| 105 |
+
· intro n hn
|
| 106 |
+
obtain ⟨hn0, hnN⟩ := Finset.mem_Ico.mp hn
|
| 107 |
+
refine ⟨n.toNat, ?_, Int.toNat_of_nonneg hn0⟩
|
| 108 |
+
simp only [Finset.mem_range]
|
| 109 |
+
have : (n.toNat : ℤ) < (N : ℤ) := by simpa only [Int.toNat_of_nonneg hn0] using hnN
|
| 110 |
+
exact_mod_cast this
|
| 111 |
+
· intro n hn
|
| 112 |
+
rfl
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
lemma sum_windowSum (P : ℕ → ℤ → E) (d : ℕ) (hd : 0 < d) (N : ℕ) :
|
| 117 |
+
∑ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), windowSum P d r N 0 1 =
|
| 118 |
+
(N : ℝ)⁻¹ • ∑ n ∈ Finset.range N, P N n := by
|
| 119 |
+
simp only [windowSum, ← Finset.smul_sum]
|
| 120 |
+
rw [residueInterval_sum d hd]
|
| 121 |
+
simp only [zero_mul, one_mul, Int.ceil_zero, Int.ceil_natCast]
|
| 122 |
+
rw [sum_int_Ico_zero_nat]
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
theorem global_point_law [CompleteSpace E] [Module ℚ≥0 E]
|
| 127 |
+
(P : ℕ → ℤ → E) (d : ℕ) (hd : 0 < d) (f : ℤ → ℝ → E)
|
| 128 |
+
(hf : ∀ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), ContinuousOn (f r) (Icc (0 : ℝ) 1))
|
| 129 |
+
(hloc : ∀ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), ∀ x ∈ Icc (0 : ℝ) 1, ∀ ε > 0,
|
| 130 |
+
∀ᶠ α : ℝ in 𝓝[>] 0, ∀ᶠ N : ℕ in atTop,
|
| 131 |
+
∀ a b : ℝ, 0 ≤ a → a ≤ x → x ≤ b → b ≤ 1 → b - a = α →
|
| 132 |
+
‖(𝔼 n ∈ residueInterval d r (a * N) (b * N), P N n) - f r x‖ < ε) :
|
| 133 |
+
Tendsto (fun N : ℕ => (N : ℝ)⁻¹ • ∑ n ∈ Finset.range N, P N n) atTop
|
| 134 |
+
(𝓝 ((d : ℝ)⁻¹ • ∑ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), ∫ x in (0 : ℝ)..1, f r x)) := by
|
| 135 |
+
simpa only [sum_windowSum P d hd, Finset.smul_sum] using
|
| 136 |
+
tendsto_finsetSum (Finset.Ico (0 : ℤ) (d : ℤ)) (fun r hr =>
|
| 137 |
+
residue_point_law P d hd r (Finset.mem_Ico.mp hr) (f r) (hf r hr) (hloc r hr))
|
| 138 |
+
|
| 139 |
+
end
|
| 140 |
+
end SourcePointLaw
|
| 141 |
+
|
| 142 |
+
namespace SourcePointLaw
|
| 143 |
+
noncomputable section
|
| 144 |
+
open scoped Topology BigOperators
|
| 145 |
+
open Filter MeasureTheory Set
|
| 146 |
+
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
|
| 147 |
+
|
| 148 |
+
lemma sum_windowSum_fin (P : ℕ → ℤ → E) (d : ℕ) (hd : 0 < d) (N : ℕ) :
|
| 149 |
+
∑ r : Fin d, windowSum P d r.val N 0 1 =
|
| 150 |
+
(N : ℝ)⁻¹ • ∑ n ∈ Finset.range N, P N n := by
|
| 151 |
+
calc
|
| 152 |
+
_ = ∑ r ∈ Finset.range d, windowSum P d r N 0 1 := (Finset.sum_range _).symm
|
| 153 |
+
_ = ∑ r ∈ Finset.Ico (0 : ℤ) (d : ℤ), windowSum P d r N 0 1 :=
|
| 154 |
+
(sum_int_Ico_zero_nat d (fun r => windowSum P d r N 0 1)).symm
|
| 155 |
+
_ = _ := sum_windowSum P d hd N
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
theorem global_point_law_fin [CompleteSpace E] [Module ℚ≥0 E]
|
| 160 |
+
(P : ℕ → ℤ → E) (d : ℕ) (hd : 0 < d) (f : Fin d → ℝ → E)
|
| 161 |
+
(hf : ∀ r, ContinuousOn (f r) (Icc (0 : ℝ) 1))
|
| 162 |
+
(hloc : ∀ r, ∀ x ∈ Icc (0 : ℝ) 1, ∀ ε > 0,
|
| 163 |
+
∀ᶠ α : ℝ in 𝓝[>] 0, ∀ᶠ N : ℕ in atTop,
|
| 164 |
+
∀ a b : ℝ, 0 ≤ a → a ≤ x → x ≤ b → b ≤ 1 → b - a = α →
|
| 165 |
+
‖(𝔼 n ∈ residueInterval d r.val (a * N) (b * N), P N n) - f r x‖ < ε) :
|
| 166 |
+
Tendsto (fun N : ℕ => (N : ℝ)⁻¹ • ∑ n ∈ Finset.range N, P N n) atTop
|
| 167 |
+
(𝓝 ((d : ℝ)⁻¹ • ∑ r : Fin d, ∫ x in (0 : ℝ)..1, f r x)) := by
|
| 168 |
+
have hres (r : Fin d) := residue_point_law P d hd r.val
|
| 169 |
+
(show 0 ≤ (r.val : ℤ) ∧ (r.val : ℤ) < (d : ℤ) from
|
| 170 |
+
⟨Int.natCast_nonneg _, by exact_mod_cast r.isLt⟩) (f r) (hf r) (hloc r)
|
| 171 |
+
simpa only [sum_windowSum_fin P d hd, Finset.smul_sum] using
|
| 172 |
+
tendsto_finsetSum Finset.univ (fun r _ => hres r)
|
| 173 |
+
|
| 174 |
+
end
|
| 175 |
+
end SourcePointLaw
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
open scoped Topology BigOperators BoundedContinuousFunction ENNReal
|
| 180 |
+
open MeasureTheory Set Filter
|
| 181 |
+
|
| 182 |
+
namespace SourcePointLaw
|
| 183 |
+
noncomputable section
|
| 184 |
+
|
| 185 |
+
def betaMeasure : Measure ℝ := volume.restrict (Icc (0 : ℝ) 1)
|
| 186 |
+
|
| 187 |
+
instance betaMeasure_probability : IsProbabilityMeasure betaMeasure where
|
| 188 |
+
measure_univ := by simp [betaMeasure]
|
| 189 |
+
|
| 190 |
+
variable {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y]
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def betaImage (μ : ProbabilityMeasure X) (T : ℝ × X → Y) (hT : Measurable T) :
|
| 195 |
+
ProbabilityMeasure Y :=
|
| 196 |
+
⟨Measure.map T (betaMeasure.prod (μ : Measure X)),
|
| 197 |
+
(Measure.isProbabilityMeasure_map_iff hT.aemeasurable).mpr inferInstance⟩
|
| 198 |
+
|
| 199 |
+
variable [TopologicalSpace Y] [OpensMeasurableSpace Y]
|
| 200 |
+
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
|
| 201 |
+
[SecondCountableTopology E] [MeasurableSpace E] [BorelSpace E]
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
theorem integral_betaImage (μ : ProbabilityMeasure X) (T : ℝ × X → Y)
|
| 206 |
+
(hT : Measurable T) (F : Y →ᵇ E) :
|
| 207 |
+
∫ y, F y ∂(betaImage μ T hT : Measure Y) =
|
| 208 |
+
∫ β in (0 : ℝ)..1, ∫ x, F (T (β, x)) ∂(μ : Measure X) := by
|
| 209 |
+
change (∫ y, F y ∂Measure.map T (betaMeasure.prod (μ : Measure X))) = _
|
| 210 |
+
rw [integral_map hT.aemeasurable F.continuous.measurable.aestronglyMeasurable]
|
| 211 |
+
have hi : Integrable (fun z : ℝ × X => F (T z)) (betaMeasure.prod (μ : Measure X)) :=
|
| 212 |
+
(integrable_const ‖F‖).mono'
|
| 213 |
+
(F.continuous.measurable.comp hT).aestronglyMeasurable
|
| 214 |
+
(Eventually.of_forall (fun z => F.norm_coe_le_norm (T z)))
|
| 215 |
+
rw [integral_prod _ hi]
|
| 216 |
+
rw [intervalIntegral.integral_of_le (by norm_num : (0 : ℝ) ≤ 1)]
|
| 217 |
+
exact integral_Icc_eq_integral_Ioc
|
| 218 |
+
|
| 219 |
+
end
|
| 220 |
+
end SourcePointLaw
|
| 221 |
+
|
| 222 |
+
namespace SourcePointLaw
|
| 223 |
+
noncomputable section
|
| 224 |
+
open scoped Topology BigOperators BoundedContinuousFunction ENNReal
|
| 225 |
+
open MeasureTheory Set Filter
|
| 226 |
+
|
| 227 |
+
variable {I Y : Type*} [Fintype I] [Nonempty I] [MeasurableSpace Y]
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
def uniformMixture (μ : I → ProbabilityMeasure Y) : ProbabilityMeasure Y :=
|
| 231 |
+
⟨(Fintype.card I : ℝ≥0∞)⁻¹ • ∑ i, (μ i : Measure Y), by
|
| 232 |
+
constructor
|
| 233 |
+
simp [Measure.smul_apply, Finset.sum_apply, ENNReal.inv_mul_cancel,
|
| 234 |
+
Fintype.card_ne_zero]⟩
|
| 235 |
+
|
| 236 |
+
variable [TopologicalSpace Y] [OpensMeasurableSpace Y]
|
| 237 |
+
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
|
| 238 |
+
[SecondCountableTopology E] [MeasurableSpace E] [BorelSpace E]
|
| 239 |
+
|
| 240 |
+
lemma integral_uniformMixture (μ : I → ProbabilityMeasure Y) (F : Y →ᵇ E) :
|
| 241 |
+
∫ y, F y ∂(uniformMixture μ : Measure Y) =
|
| 242 |
+
(Fintype.card I : ℝ)⁻¹ • ∑ i, ∫ y, F y ∂(μ i : Measure Y) := by
|
| 243 |
+
change (∫ y, F y ∂((Fintype.card I : ℝ≥0∞)⁻¹ • ∑ i, (μ i : Measure Y))) = _
|
| 244 |
+
rw [integral_smul_measure, integral_finsetSum_measure]
|
| 245 |
+
· simp only [ENNReal.toReal_inv, ENNReal.toReal_natCast]
|
| 246 |
+
· intro i hi
|
| 247 |
+
exact F.integrable _
|
| 248 |
+
|
| 249 |
+
end
|
| 250 |
+
end SourcePointLaw
|
| 251 |
+
|
| 252 |
+
end RawSuccessInlineScope1
|
| 253 |
+
end
|
| 254 |
+
|
| 255 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialArray01.lean
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
end
|
| 10 |
+
|
| 11 |
+
section
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
noncomputable section
|
| 17 |
+
open scoped BigOperators
|
| 18 |
+
namespace PolynomialArrayInterpolation
|
| 19 |
+
open CorrectedBoxLeibman MvPolynomial WeightedPolynomial
|
| 20 |
+
open IntegerGridInterpolation (tensorWeight tensor_orthogonality)
|
| 21 |
+
abbrev Grid := IntegerGridInterpolation.Grid
|
| 22 |
+
|
| 23 |
+
lemma bounded_totalDegree {q d : ℕ} {p : MvPolynomial (Fin q) ℝ}
|
| 24 |
+
(hp : Bounded (fun _ : Fin q=>1) d p) : p.totalDegree≤d := by
|
| 25 |
+
rw [MvPolynomial.totalDegree]
|
| 26 |
+
apply Finset.sup_le
|
| 27 |
+
intro e he
|
| 28 |
+
have hh:=hp e (MvPolynomial.mem_support_iff.mp he)
|
| 29 |
+
simpa only [Finsupp.weight_apply,smul_eq_mul,mul_one] using hh
|
| 30 |
+
|
| 31 |
+
lemma real_orthogonality (q d : ℕ) (e f : Grid q d) :
|
| 32 |
+
∑ v : Grid q d,(tensorWeight q d e v:ℝ)*∏ i,((v i).val:ℝ)^(f i).val=
|
| 33 |
+
if e=f then 1 else 0 := by
|
| 34 |
+
have hh:=congrArg (fun x : ℚ => (x:ℝ)) (tensor_orthogonality q d e f)
|
| 35 |
+
push_cast at hh
|
| 36 |
+
split_ifs at hh ⊢ <;> simpa only [Rat.cast_one,Rat.cast_zero] using hh
|
| 37 |
+
|
| 38 |
+
lemma reconstruction (q d : ℕ) (a : Grid q d → ℝ) (e : Grid q d) :
|
| 39 |
+
∑ v : Grid q d,(tensorWeight q d e v:ℝ)*
|
| 40 |
+
(∑ f : Grid q d,a f*∏ i,((v i).val:ℝ)^(f i).val)=a e := by
|
| 41 |
+
classical
|
| 42 |
+
simp_rw [Finset.mul_sum]
|
| 43 |
+
rw [Finset.sum_comm]
|
| 44 |
+
simp_rw [mul_left_comm (tensorWeight q d e _:ℝ) (a _)]
|
| 45 |
+
simp_rw [← Finset.mul_sum,real_orthogonality]
|
| 46 |
+
simp
|
| 47 |
+
|
| 48 |
+
def coefficients {q d : ℕ} (f : (Fin q → ℝ) → ℝ) (e : Grid q d) : ℝ:=
|
| 49 |
+
∑ v : Grid q d,(tensorWeight q d e v:ℝ)*f (fun i=>((v i).val:ℝ))
|
| 50 |
+
|
| 51 |
+
lemma coefficients_eval {q d : ℕ} (p : MvPolynomial (Fin q) ℝ) (hp : p.totalDegree≤d)
|
| 52 |
+
(e : Grid q d) : coefficients (fun x=>eval x p) e=polynomialGrid p e := by
|
| 53 |
+
unfold coefficients
|
| 54 |
+
simp_rw [← gridEval_polynomial p hp]
|
| 55 |
+
exact reconstruction q d (polynomialGrid p) e
|
| 56 |
+
|
| 57 |
+
lemma reconstruction_function {q d : ℕ} {f : (Fin q → ℝ) → ℝ}
|
| 58 |
+
(hf : IsWeighted (fun _ : Fin q=>1) d f) (x : Fin q → ℝ) :
|
| 59 |
+
gridEval (coefficients f : Grid q d → ℝ) x=f x := by
|
| 60 |
+
obtain ⟨p,hp,he⟩:=hf
|
| 61 |
+
have htd:=bounded_totalDegree hp
|
| 62 |
+
have hf : f=fun x=>eval x p:=funext he
|
| 63 |
+
rw [hf]
|
| 64 |
+
have hc : (coefficients (fun x=>eval x p) : Grid q d → ℝ)=polynomialGrid p :=
|
| 65 |
+
funext (coefficients_eval p htd)
|
| 66 |
+
rw [hc]
|
| 67 |
+
exact gridEval_polynomial p htd x
|
| 68 |
+
|
| 69 |
+
lemma coefficients_zero_high {q d : ℕ} {f : (Fin q → ℝ) → ℝ} {k : ℕ}
|
| 70 |
+
(hf : IsWeighted (fun _ : Fin q=>1) k f) (hkd : k≤d) (e : Grid q d)
|
| 71 |
+
(he : k<PolynomialLineCoefficients.totalDegree e) : coefficients f e=0 := by
|
| 72 |
+
obtain ⟨p,hp,hf⟩:=hf
|
| 73 |
+
have htd:=bounded_totalDegree hp
|
| 74 |
+
have hfun : f=fun x=>eval x p:=funext hf
|
| 75 |
+
rw [hfun,coefficients_eval p (htd.trans hkd)]
|
| 76 |
+
change p.coeff (gridExponent e)=0
|
| 77 |
+
by_contra hn
|
| 78 |
+
have hh:=hp (gridExponent e) hn
|
| 79 |
+
have hd : Finsupp.weight (fun _ : Fin q=>1) (gridExponent e)=PolynomialLineCoefficients.totalDegree e := by
|
| 80 |
+
rw [Finsupp.weight_apply]
|
| 81 |
+
simpa only [smul_eq_mul,mul_one] using gridExponent_degree e
|
| 82 |
+
rw [hd] at hh
|
| 83 |
+
omega
|
| 84 |
+
|
| 85 |
+
lemma coefficients_continuous {q d : ℕ} (e : Grid q d) :
|
| 86 |
+
Continuous (fun f : ((Fin q → ℝ) → ℝ)=>coefficients f e) := by
|
| 87 |
+
apply continuous_finsetSum
|
| 88 |
+
intro v hv
|
| 89 |
+
exact continuous_const.mul (continuous_apply _)
|
| 90 |
+
|
| 91 |
+
lemma gridEval_weighted {q d k : ℕ} (a : Grid q d → ℝ)
|
| 92 |
+
(ha : ∀ e,k<PolynomialLineCoefficients.totalDegree e → a e=0) :
|
| 93 |
+
IsWeighted (fun _ : Fin q=>1) k (gridEval a) := by
|
| 94 |
+
classical
|
| 95 |
+
refine ⟨∑ e : Grid q d,monomial (gridExponent e) (a e),?_,?_⟩
|
| 96 |
+
· apply bounded_sum
|
| 97 |
+
intro e he m hm
|
| 98 |
+
have hme : gridExponent e=m := by
|
| 99 |
+
by_contra h
|
| 100 |
+
simp only [coeff_monomial,h,ite_false] at hm
|
| 101 |
+
exact hm rfl
|
| 102 |
+
subst m
|
| 103 |
+
have hae : a e≠0 := by simpa only [coeff_monomial,ite_true] using hm
|
| 104 |
+
have hd : Finsupp.weight (fun _ : Fin q=>1) (gridExponent e)=
|
| 105 |
+
PolynomialLineCoefficients.totalDegree e := by
|
| 106 |
+
rw [Finsupp.weight_apply]
|
| 107 |
+
simpa only [smul_eq_mul,mul_one] using gridExponent_degree e
|
| 108 |
+
rw [hd]
|
| 109 |
+
by_contra h
|
| 110 |
+
exact hae (ha e (Nat.lt_of_not_ge h))
|
| 111 |
+
· intro x
|
| 112 |
+
simp only [gridEval,map_sum,eval_monomial]
|
| 113 |
+
apply Finset.sum_congr rfl
|
| 114 |
+
intro e he
|
| 115 |
+
congr 1
|
| 116 |
+
rw [Finsupp.prod_fintype _ _ (by intro i; simp)]
|
| 117 |
+
rfl
|
| 118 |
+
|
| 119 |
+
lemma coefficients_gridEval {q d : ℕ} (a : Grid q d → ℝ) (e : Grid q d) :
|
| 120 |
+
coefficients (gridEval a) e=a e := reconstruction q d a e
|
| 121 |
+
|
| 122 |
+
lemma grid_injective {q d : ℕ} {f g : (Fin q → ℝ) → ℝ}
|
| 123 |
+
(hf : IsWeighted (fun _ : Fin q=>1) d f)
|
| 124 |
+
(hg : IsWeighted (fun _ : Fin q=>1) d g)
|
| 125 |
+
(hfg : ∀ v : Grid q d,f (fun i=>((v i).val:ℝ))=g (fun i=>((v i).val:ℝ))) : f=g := by
|
| 126 |
+
have hc : (coefficients f : Grid q d → ℝ)=coefficients g := by
|
| 127 |
+
funext e
|
| 128 |
+
simp only [coefficients,hfg]
|
| 129 |
+
funext x
|
| 130 |
+
rw [← reconstruction_function hf x,← reconstruction_function hg x,hc]
|
| 131 |
+
|
| 132 |
+
end PolynomialArrayInterpolation
|
| 133 |
+
end
|
| 134 |
+
|
| 135 |
+
end
|
| 136 |
+
|
| 137 |
+
section
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
noncomputable section
|
| 142 |
+
namespace SortedFiniteWeights
|
| 143 |
+
variable {σ : Type*} [Fintype σ]
|
| 144 |
+
lemma exists_ordered (w : σ → ℕ) :
|
| 145 |
+
∃ e : Fin (Fintype.card σ) ≃ σ,Monotone (fun i=>w (e i)) := by
|
| 146 |
+
classical
|
| 147 |
+
let f (i : σ) : ℕ ×ₗ Fin (Fintype.card σ):=toLex (w i,Fintype.equivFin σ i)
|
| 148 |
+
have hf : Function.Injective f := by
|
| 149 |
+
intro i j h
|
| 150 |
+
apply (Fintype.equivFin σ).injective
|
| 151 |
+
exact congrArg (fun x=> (ofLex x).2) h
|
| 152 |
+
let : LinearOrder σ:=LinearOrder.lift' f hf
|
| 153 |
+
let e:=Fintype.orderIsoFinOfCardEq σ rfl
|
| 154 |
+
refine ⟨e.toEquiv,?_⟩
|
| 155 |
+
intro i j hij
|
| 156 |
+
have hh : f (e i) ≤ f (e j):=e.monotone hij
|
| 157 |
+
rcases Prod.Lex.le_iff.mp hh with h|h
|
| 158 |
+
· exact Nat.le_of_lt h
|
| 159 |
+
· exact le_of_eq h.1
|
| 160 |
+
|
| 161 |
+
def indexing (w : σ → ℕ) : Fin (Fintype.card σ) ≃ σ:=(exists_ordered w).choose
|
| 162 |
+
lemma indexing_monotone (w : σ → ℕ) : Monotone (fun i=>w (indexing w i)) :=
|
| 163 |
+
(exists_ordered w).choose_spec
|
| 164 |
+
|
| 165 |
+
end SortedFiniteWeights
|
| 166 |
+
end
|
| 167 |
+
|
| 168 |
+
end
|
| 169 |
+
|
| 170 |
+
section
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
noncomputable section
|
| 176 |
+
open scoped BigOperators
|
| 177 |
+
namespace RationalLattice.PolynomialArrays
|
| 178 |
+
open PolynomialArrayInterpolation WeightedPolynomial MalcevCharacters
|
| 179 |
+
open CorrectedBoxLeibman (gridEval)
|
| 180 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 181 |
+
variable {n q : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c)
|
| 182 |
+
variable (A : CubeFaces.Filtration G) (w : Fin n → ℕ)
|
| 183 |
+
variable (hA : ∀ k (g : G),g∈A.level k ↔ ∀ i : Fin n,w i<k → c.coord g i=0)
|
| 184 |
+
|
| 185 |
+
abbrev Index (w : Fin n → ℕ) (q : ℕ) :=
|
| 186 |
+
Σ i : Fin n,{e : Grid q (w i) // PolynomialLineCoefficients.totalDegree e≤w i}
|
| 187 |
+
|
| 188 |
+
def fullCoeff (x : Index w q → ℝ) (i : Fin n) (e : Grid q (w i)) : ℝ :=
|
| 189 |
+
if he : PolynomialLineCoefficients.totalDegree e≤w i then x ⟨i,⟨e,he⟩⟩ else 0
|
| 190 |
+
|
| 191 |
+
def toLog (x : Index w q → ℝ) (u : Fin q → ℝ) (i : Fin n) : ℝ :=
|
| 192 |
+
gridEval (fullCoeff w x i) u
|
| 193 |
+
|
| 194 |
+
omit [IsTopologicalGroup G] in
|
| 195 |
+
lemma toLog_array (x : Index w q → ℝ) :
|
| 196 |
+
IsArray c w (fun u=>canonicalExp c (toLog w x u)) := by
|
| 197 |
+
intro i
|
| 198 |
+
simp only [canonicalLog_exp]
|
| 199 |
+
apply gridEval_weighted
|
| 200 |
+
intro e he
|
| 201 |
+
simp only [fullCoeff,dite_eq_right (not_le.mpr he)]
|
| 202 |
+
|
| 203 |
+
def coefficients (f : group (q:=q) c hsk A w hA) (a : Index w q) : ℝ :=
|
| 204 |
+
PolynomialArrayInterpolation.coefficients (fun u=>canonicalLog c (f.val u) a.1) a.2.val
|
| 205 |
+
|
| 206 |
+
lemma fullCoeff_coefficients (f : group (q:=q) c hsk A w hA) (i : Fin n) :
|
| 207 |
+
fullCoeff w (coefficients c hsk A w hA f) i=
|
| 208 |
+
PolynomialArrayInterpolation.coefficients (fun u=>canonicalLog c (f.val u) i) := by
|
| 209 |
+
funext e
|
| 210 |
+
dsimp only [fullCoeff]
|
| 211 |
+
split_ifs with he
|
| 212 |
+
· rfl
|
| 213 |
+
· exact (coefficients_zero_high (f.property i) le_rfl e (Nat.lt_of_not_ge he)).symm
|
| 214 |
+
|
| 215 |
+
lemma toLog_coefficients (f : group (q:=q) c hsk A w hA) (u : Fin q → ℝ) :
|
| 216 |
+
toLog w (coefficients c hsk A w hA f) u=canonicalLog c (f.val u) := by
|
| 217 |
+
funext i
|
| 218 |
+
rw [toLog,fullCoeff_coefficients]
|
| 219 |
+
exact reconstruction_function (f.property i) u
|
| 220 |
+
|
| 221 |
+
lemma coefficients_toLog (x : Index w q → ℝ) (a : Index w q) :
|
| 222 |
+
PolynomialArrayInterpolation.coefficients (fun u=>toLog w x u a.1) a.2.val=x a := by
|
| 223 |
+
rw [show (fun u=>toLog w x u a.1)=gridEval (fullCoeff w x a.1) from rfl,
|
| 224 |
+
coefficients_gridEval]
|
| 225 |
+
simp only [fullCoeff,dite_eq_left a.2.property]
|
| 226 |
+
|
| 227 |
+
lemma toLog_continuous (u : Fin q → ℝ) : Continuous (fun x : Index w q → ℝ=>toLog w x u) := by
|
| 228 |
+
apply continuous_pi
|
| 229 |
+
intro i
|
| 230 |
+
apply continuous_finsetSum
|
| 231 |
+
intro e he
|
| 232 |
+
apply Continuous.mul _ continuous_const
|
| 233 |
+
unfold fullCoeff
|
| 234 |
+
split_ifs
|
| 235 |
+
· exact continuous_apply _
|
| 236 |
+
· exact continuous_const
|
| 237 |
+
|
| 238 |
+
lemma coefficients_continuous : Continuous (coefficients (q:=q) c hsk A w hA) := by
|
| 239 |
+
apply continuous_pi
|
| 240 |
+
intro a
|
| 241 |
+
apply (PolynomialArrayInterpolation.coefficients_continuous a.2.val).comp
|
| 242 |
+
apply continuous_pi
|
| 243 |
+
intro u
|
| 244 |
+
exact (continuous_apply a.1).comp ((canonicalLog_continuous c).comp
|
| 245 |
+
((continuous_apply u).comp continuous_subtype_val))
|
| 246 |
+
|
| 247 |
+
def coefficientHomeomorph : group (q:=q) c hsk A w hA ≃ₜ (Index w q → ℝ) where
|
| 248 |
+
toFun:=coefficients c hsk A w hA
|
| 249 |
+
invFun x:=⟨fun u=>canonicalExp c (toLog w x u),toLog_array c w x⟩
|
| 250 |
+
left_inv f:=by
|
| 251 |
+
apply Subtype.ext
|
| 252 |
+
funext u
|
| 253 |
+
change canonicalExp c (toLog w (coefficients c hsk A w hA f) u)=f.val u
|
| 254 |
+
rw [toLog_coefficients,canonicalExp_log]
|
| 255 |
+
right_inv x:=by
|
| 256 |
+
funext a
|
| 257 |
+
change PolynomialArrayInterpolation.coefficients
|
| 258 |
+
(fun u=>canonicalLog c (canonicalExp c (toLog w x u)) a.1) a.2.val=x a
|
| 259 |
+
simp only [canonicalLog_exp]
|
| 260 |
+
exact coefficients_toLog w x a
|
| 261 |
+
continuous_toFun:=coefficients_continuous c hsk A w hA
|
| 262 |
+
continuous_invFun:=by
|
| 263 |
+
apply Continuous.subtype_mk
|
| 264 |
+
apply continuous_pi
|
| 265 |
+
intro u
|
| 266 |
+
exact (logHomeomorph c).symm.continuous.comp (toLog_continuous w u)
|
| 267 |
+
|
| 268 |
+
lemma coefficientHomeomorph_one : coefficientHomeomorph (q:=q) c hsk A w hA 1=0 := by
|
| 269 |
+
funext a
|
| 270 |
+
change PolynomialArrayInterpolation.coefficients (fun u=>canonicalLog c (1:G) a.1) a.2.val=0
|
| 271 |
+
simp [PolynomialArrayInterpolation.coefficients,canonicalLog_one]
|
| 272 |
+
|
| 273 |
+
end RationalLattice.PolynomialArrays
|
| 274 |
+
|
| 275 |
+
end
|
| 276 |
+
end
|
| 277 |
+
end
|
| 278 |
+
|
| 279 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialCharacter01.lean
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.MalcevHorizontal02
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
open _root_.Polynomial _root_.OAI.Polynomial Finset
|
| 13 |
+
open scoped BigOperators
|
| 14 |
+
end
|
| 15 |
+
end
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
section
|
| 20 |
+
noncomputable section
|
| 21 |
+
open _root_.Polynomial _root_.OAI.Polynomial Finset
|
| 22 |
+
open scoped BigOperators
|
| 23 |
+
namespace PolynomialCharacterDescent
|
| 24 |
+
|
| 25 |
+
lemma derivative_bound (d N : ℕ) (hN : 0 < N) (C : ℝ) (hC : 0 ≤ C)
|
| 26 |
+
(p : ℝ[X]) (hp : p.natDegree ≤ d)
|
| 27 |
+
(hc : ∀ j : ℕ, 0 < j → j ≤ d → |p.coeff j| ≤ C/(N:ℝ)^j)
|
| 28 |
+
(x : ℝ) (hx : x ∈ Set.Icc 0 (N:ℝ)) :
|
| 29 |
+
|p.derivative.eval x| ≤ ((d+1):ℝ)*d*C/N := by
|
| 30 |
+
have hNr : (0:ℝ)<N := Nat.cast_pos.mpr hN
|
| 31 |
+
have hterm (j : ℕ) (hj : j ∈ range (d+1)) :
|
| 32 |
+
|p.coeff j*(j:ℝ)*x^(j-1)| ≤ (d:ℝ)*C/N := by
|
| 33 |
+
have hd : j ≤ d := Nat.le_of_lt_succ (mem_range.mp hj)
|
| 34 |
+
by_cases hz : j=0
|
| 35 |
+
· subst j; simp only [Nat.cast_zero,mul_zero,zero_mul,abs_zero]; positivity
|
| 36 |
+
have hjpos : 0 < j := Nat.pos_of_ne_zero hz
|
| 37 |
+
have hpow : (N:ℝ)^j = (N:ℝ)^(j-1)*N := by
|
| 38 |
+
rw [← pow_succ]; congr 1; omega
|
| 39 |
+
have hh := (le_div_iff₀ (pow_pos hNr j)).mp (hc j hjpos hd)
|
| 40 |
+
have hjr : (j:ℝ) ≤ d := by exact_mod_cast hd
|
| 41 |
+
simp only [abs_mul,abs_of_nonneg (Nat.cast_nonneg j : (0:ℝ) ≤ j),abs_of_nonneg (pow_nonneg hx.1 _)]
|
| 42 |
+
apply (le_div_iff₀ hNr).mpr
|
| 43 |
+
have hxpow := pow_le_pow_left₀ hx.1 hx.2 (j-1)
|
| 44 |
+
have hh' : |p.coeff j| *x^(j-1)*N ≤ C := by
|
| 45 |
+
calc
|
| 46 |
+
_ ≤ |p.coeff j| *(N:ℝ)^(j-1)*N := by gcongr
|
| 47 |
+
_ = |p.coeff j| *(N:ℝ)^j := by rw [hpow]; ring
|
| 48 |
+
_ ≤ C := hh
|
| 49 |
+
nlinarith [mul_le_mul_of_nonneg_left hh' (Nat.cast_nonneg j),
|
| 50 |
+
mul_le_mul_of_nonneg_right hjr hC]
|
| 51 |
+
rw [derivative_eval, sum_over_range' _ _ (d+1) (Nat.lt_succ_of_le hp)]
|
| 52 |
+
· calc
|
| 53 |
+
_ ≤ ∑ j ∈ range (d+1), |p.coeff j*(j:ℝ)*x^(j-1)| := abs_sum_le_sum_abs _ _
|
| 54 |
+
_ ≤ ∑ _j ∈ range (d+1), (d:ℝ)*C/N := sum_le_sum hterm
|
| 55 |
+
_ = _ := by simp only [sum_const,card_range,nsmul_eq_mul]; push_cast; ring
|
| 56 |
+
· intro i; simp
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
lemma linear_residual (d N : ℕ) (hd : 2 ≤ d) (hN : 0 < N)
|
| 61 |
+
(Q : ℝ[X]) (hQ : Q.natDegree ≤ d) (q : ℤ) (C : ℝ) (hC : 0 ≤ C)
|
| 62 |
+
(m : ℕ → ℤ)
|
| 63 |
+
(hm : ∀ j : ℕ, 2 < j → j ≤ d → |(q:ℝ)*Q.coeff j-m j| ≤ C/(N:ℝ)^j) :
|
| 64 |
+
∀ h : ℕ, h < N → ∃ z : ℤ,
|
| 65 |
+
|(q:ℝ)*((taylor (h:ℝ) Q-Q).coeff 1)-2*(q:ℝ)*Q.coeff 2*h-z|
|
| 66 |
+
≤ ((d+1):ℝ)*d*C/N := by
|
| 67 |
+
let u := PolynomialIntegralResidual.integerPart d (fun j => if 2<j then m j else 0)
|
| 68 |
+
let low : ℝ[X] := Polynomial.C (q:ℝ)*Polynomial.C (Q.coeff 0) + Polynomial.C ((q:ℝ)*Q.coeff 1)*X +
|
| 69 |
+
Polynomial.C ((q:ℝ)*Q.coeff 2)*X^2
|
| 70 |
+
let p : ℝ[X] := Polynomial.C (q:ℝ)*Q-low-u.map (Int.castRingHom ℝ)
|
| 71 |
+
have hu (j : ℕ) (hj : j ≤ d) : u.coeff j = if 2<j then m j else 0 :=
|
| 72 |
+
PolynomialIntegralResidual.integerPart_coeff _ _ _ hj
|
| 73 |
+
have hl (j : ℕ) : low.coeff j =
|
| 74 |
+
(if j=0 then (q:ℝ)*Q.coeff 0 else 0)+
|
| 75 |
+
(if j=1 then (q:ℝ)*Q.coeff 1 else 0)+
|
| 76 |
+
(if j=2 then (q:ℝ)*Q.coeff 2 else 0) := by
|
| 77 |
+
simp only [low,coeff_add,coeff_C_mul,coeff_C,coeff_X,coeff_X_pow,mul_ite,mul_one,mul_zero]
|
| 78 |
+
simp only [eq_comm]
|
| 79 |
+
have hpd : p.natDegree ≤ d := by
|
| 80 |
+
apply (natDegree_sub_le _ _).trans
|
| 81 |
+
apply max_le
|
| 82 |
+
· apply (natDegree_sub_le _ _).trans
|
| 83 |
+
apply max_le
|
| 84 |
+
· exact (natDegree_C_mul_le _ _).trans hQ
|
| 85 |
+
· apply natDegree_add_le_of_degree_le
|
| 86 |
+
· apply natDegree_add_le_of_degree_le
|
| 87 |
+
· exact (natDegree_C_mul_le _ _).trans (by simpa only [natDegree_C] using (Nat.zero_le d))
|
| 88 |
+
· exact (natDegree_C_mul_le _ _).trans (by simpa using (show 1 ≤ d by omega))
|
| 89 |
+
· exact (natDegree_C_mul_le _ _).trans (by simpa using hd)
|
| 90 |
+
· exact natDegree_map_le.trans (PolynomialIntegralResidual.integerPart_degree _ _)
|
| 91 |
+
have hpc (j : ℕ) (hj : 0 < j) (hjd : j ≤ d) : |p.coeff j| ≤ C/(N:ℝ)^j := by
|
| 92 |
+
dsimp [p]
|
| 93 |
+
rw [coeff_sub,coeff_sub,coeff_C_mul,coeff_map,hu j hjd,hl]
|
| 94 |
+
by_cases hj2 : 2<j
|
| 95 |
+
· simpa [ne_of_gt hj,show j≠1 by omega,show j≠2 by omega,hj2] using hm j hj2 hjd
|
| 96 |
+
· have he : j=1 ∨ j=2 := by omega
|
| 97 |
+
rcases he with rfl | rfl <;> norm_num <;> positivity
|
| 98 |
+
intro h hh
|
| 99 |
+
have hbound := derivative_bound d N hN C hC p hpd hpc h
|
| 100 |
+
⟨Nat.cast_nonneg _,by exact_mod_cast hh.le⟩
|
| 101 |
+
have huval : (u.map (Int.castRingHom ℝ)).derivative.eval (h:ℝ) =
|
| 102 |
+
((u.derivative.eval (h:ℤ):ℤ):ℝ) := by
|
| 103 |
+
rw [derivative_map,eval_map]
|
| 104 |
+
exact eval₂_at_apply (Int.castRingHom ℝ) (h:ℤ)
|
| 105 |
+
refine ⟨u.derivative.eval h,?_⟩
|
| 106 |
+
convert hbound using 2
|
| 107 |
+
simp only [p,derivative_sub,derivative_C_mul,eval_sub,eval_mul,eval_C,huval,
|
| 108 |
+
coeff_sub,taylor_coeff_one]
|
| 109 |
+
simp only [low,derivative_add,derivative_mul,derivative_C,zero_mul,derivative_X,
|
| 110 |
+
mul_one,derivative_pow,eval_add,eval_mul,eval_C]
|
| 111 |
+
norm_num
|
| 112 |
+
ring
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
theorem polynomial_descent (d : ���) (hd : 2 ≤ d) (δ A : ℝ) (hδ : 0 < δ) (hA : 0 ≤ A) :
|
| 117 |
+
∃ B : ℕ, 0 < B ∧ ∃ C : ℝ, 0 < C ∧ ∃ N₀ : ℕ, 0 < N₀ ∧
|
| 118 |
+
∀ N : ℕ, N₀ ≤ N → ∀ P Q : ℝ[X], Q.natDegree ≤ d →
|
| 119 |
+
∀ σ : ℕ → ℝ, ∀ S : Finset ℕ, S ⊆ range N → δ*N ≤ (S.card:ℝ) →
|
| 120 |
+
(∀ h ∈ S, ∃ z : ℤ, |(P+taylor (h:ℝ) Q-Q).coeff 2-z| ≤ A/(N:ℝ)^2) →
|
| 121 |
+
(∀ h ∈ S, ∃ z : ℤ, |(P+taylor (h:ℝ) Q-Q).coeff 1+σ h-z| ≤ A/N) →
|
| 122 |
+
∃ q : ℤ, q ≠ 0 ∧ |q| ≤ B ∧
|
| 123 |
+
(∀ j : ℕ, 2 < j → j ≤ d → ∃ m : ℤ, |(q:ℝ)*Q.coeff j-m| ≤ C/(N:ℝ)^j) ∧
|
| 124 |
+
(∀ h ∈ S, ∃ z : ℤ, |(q:ℝ)*P.coeff 1+2*(q:ℝ)*Q.coeff 2*h+(q:ℝ)*σ h-z| ≤ C/N) := by
|
| 125 |
+
classical
|
| 126 |
+
obtain ⟨B,hB,C,hC,L,hL,hdesc⟩ := high_coefficients d δ A hδ hA
|
| 127 |
+
let C' := max C ((B:ℝ)*A+((d+1):ℝ)*d*C)
|
| 128 |
+
have hCC : C ≤ C' := le_max_left _ _
|
| 129 |
+
have hsum : (B:ℝ)*A+((d+1):ℝ)*d*C ≤ C' := le_max_right _ _
|
| 130 |
+
refine ⟨B,hB,C',hC.trans_le hCC,L,hL,?_⟩
|
| 131 |
+
intro N hLN P Q hQ σ S hSN hS hsecond hfirst
|
| 132 |
+
have hN : 0<N := hL.trans_le hLN
|
| 133 |
+
have hNr : (0:ℝ)<N := Nat.cast_pos.mpr hN
|
| 134 |
+
obtain ⟨q,hq,hqB,hcoeff⟩ := hdesc N hLN P Q hQ S hSN hS hsecond
|
| 135 |
+
have hex (j : ℕ) : ∃ m : ℤ, 2<j → j≤d → |(q:ℝ)*Q.coeff j-m| ≤ C/(N:ℝ)^j := by
|
| 136 |
+
by_cases hj : 2<j ∧ j≤d
|
| 137 |
+
· obtain ⟨m,hm⟩ := hcoeff j hj.1 hj.2; exact ⟨m,fun _ _ => hm⟩
|
| 138 |
+
· exact ⟨0,fun h₁ h₂ => False.elim (hj ⟨h₁,h₂⟩)⟩
|
| 139 |
+
choose m hm using hex
|
| 140 |
+
refine ⟨q,hq,hqB,?_,?_⟩
|
| 141 |
+
· intro j hj hjd
|
| 142 |
+
exact ⟨m j,(hm j hj hjd).trans (div_le_div_of_nonneg_right hCC (by positivity))⟩
|
| 143 |
+
· intro h hh
|
| 144 |
+
obtain ⟨z,hz⟩ := linear_residual d N hd hN Q hQ q C hC.le m hm h (mem_range.mp (hSN hh))
|
| 145 |
+
obtain ⟨k,hk⟩ := hfirst h hh
|
| 146 |
+
have hqR : |(q:ℝ)| ≤ B := by exact_mod_cast hqB
|
| 147 |
+
refine ⟨q*k-z,?_⟩
|
| 148 |
+
calc
|
| 149 |
+
_ = |(q:ℝ)*((P+taylor (h:ℝ) Q-Q).coeff 1+σ h-k)-
|
| 150 |
+
((q:ℝ)*(taylor (h:ℝ) Q-Q).coeff 1-2*(q:ℝ)*Q.coeff 2*h-z)| := by
|
| 151 |
+
push_cast
|
| 152 |
+
congr 1
|
| 153 |
+
simp only [coeff_sub,coeff_add]
|
| 154 |
+
ring
|
| 155 |
+
_ ≤ |(q:ℝ)*((P+taylor (h:ℝ) Q-Q).coeff 1+σ h-k)|+
|
| 156 |
+
|(q:ℝ)*(taylor (h:ℝ) Q-Q).coeff 1-2*(q:ℝ)*Q.coeff 2*h-z| := abs_sub _ _
|
| 157 |
+
_ ≤ (B:ℝ)*(A/N)+((d+1):ℝ)*d*C/N := by
|
| 158 |
+
apply add_le_add _ hz
|
| 159 |
+
rw [abs_mul]
|
| 160 |
+
exact mul_le_mul hqR hk (abs_nonneg _) (Nat.cast_nonneg B)
|
| 161 |
+
_ = ((B:ℝ)*A+((d+1):ℝ)*d*C)/N := by ring
|
| 162 |
+
_ ≤ C'/N := div_le_div_of_nonneg_right hsum hNr.le
|
| 163 |
+
|
| 164 |
+
end PolynomialCharacterDescent
|
| 165 |
+
end
|
| 166 |
+
end
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
section
|
| 171 |
+
noncomputable section
|
| 172 |
+
open _root_.Polynomial _root_.OAI.Polynomial Finset
|
| 173 |
+
open scoped BigOperators
|
| 174 |
+
namespace PolynomialCharacterDescent
|
| 175 |
+
|
| 176 |
+
lemma taylor_coefficient_bound (d N : ℕ) (hN : 0<N) (C : ℝ) (hC : 0≤C)
|
| 177 |
+
(p : ℝ[X]) (hp : p.natDegree≤d)
|
| 178 |
+
(hc : ∀ j : ℕ, 0<j → j≤d → |p.coeff j|≤C/(N:ℝ)^j)
|
| 179 |
+
(j : ℕ) (hj : 0<j) (x : ℝ) (hx : x∈Set.Icc 0 (N:ℝ)) :
|
| 180 |
+
|(taylor x p).coeff j|≤((d+1):ℝ)*(2:ℝ)^d*C/(N:ℝ)^j := by
|
| 181 |
+
have hNr : (0:ℝ)<N := Nat.cast_pos.mpr hN
|
| 182 |
+
have hdeg : (hasseDeriv j p).natDegree≤d :=
|
| 183 |
+
(natDegree_hasseDeriv_le p j).trans ((Nat.sub_le _ _).trans hp)
|
| 184 |
+
rw [taylor_coeff,eval_eq_sum_range' (Nat.lt_succ_of_le hdeg)]
|
| 185 |
+
have hterm (k : ℕ) (hk : k∈range (d+1)) :
|
| 186 |
+
|((hasseDeriv j p).coeff k)*x^k|≤(2:ℝ)^d*C/(N:ℝ)^j := by
|
| 187 |
+
rw [hasseDeriv_coeff]
|
| 188 |
+
by_cases hkj : k+j≤d
|
| 189 |
+
· have hcoef := (le_div_iff₀ (pow_pos hNr (k+j))).mp (hc (k+j) (by omega) hkj)
|
| 190 |
+
have hchoose : ((k+j).choose j:ℝ)≤(2:ℝ)^d := by
|
| 191 |
+
have hh := Nat.choose_le_two_pow (k+j) j
|
| 192 |
+
exact_mod_cast hh.trans (Nat.pow_le_pow_right (by norm_num) hkj)
|
| 193 |
+
have hsmall : |p.coeff (k+j)| * x^k*(N:ℝ)^j≤C := by
|
| 194 |
+
calc
|
| 195 |
+
_ ≤ |p.coeff (k+j)| * (N:ℝ)^k*(N:ℝ)^j := by gcongr <;> first | exact hx.1 | exact hx.2
|
| 196 |
+
_ = |p.coeff (k+j)| * (N:ℝ)^(k+j) := by rw [pow_add]; ring
|
| 197 |
+
_ ≤ C := hcoef
|
| 198 |
+
rw [abs_mul,abs_mul,abs_of_nonneg (Nat.cast_nonneg _),abs_of_nonneg (pow_nonneg hx.1 _)]
|
| 199 |
+
apply (le_div_iff₀ (pow_pos hNr j)).mpr
|
| 200 |
+
calc
|
| 201 |
+
_ = ((k+j).choose j:ℝ)*(|p.coeff (k+j)| * x^k*(N:ℝ)^j) := by ring
|
| 202 |
+
_ ≤ ((k+j).choose j:ℝ)*C := mul_le_mul_of_nonneg_left hsmall (Nat.cast_nonneg _)
|
| 203 |
+
_ ≤ _ := mul_le_mul_of_nonneg_right hchoose hC
|
| 204 |
+
· rw [coeff_eq_zero_of_natDegree_lt (by omega),mul_zero,zero_mul,abs_zero]
|
| 205 |
+
positivity
|
| 206 |
+
calc
|
| 207 |
+
_ ≤ ∑ k∈range (d+1),|((hasseDeriv j p).coeff k)*x^k| := abs_sum_le_sum_abs _ _
|
| 208 |
+
_ ≤ ∑ _k∈range (d+1),(2:ℝ)^d*C/(N:ℝ)^j := sum_le_sum hterm
|
| 209 |
+
_ = _ := by simp only [sum_const,card_range,nsmul_eq_mul]; push_cast; ring
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
lemma nonlinear_shift_residual (d N : ℕ) (hd : 1≤d) (hN : 0<N)
|
| 214 |
+
(Q : ℝ[X]) (hQ : Q.natDegree≤d) (q : ℤ) (C : ℝ) (hC : 0≤C)
|
| 215 |
+
(m : ℕ → ℤ)
|
| 216 |
+
(hm : ∀ j : ℕ, 1<j → j≤d → |(q:ℝ)*Q.coeff j-m j|≤C/(N:ℝ)^j) :
|
| 217 |
+
∀ h : ℕ, h<N → �� j : ℕ, 0<j → j≤d → ∃ z : ℤ,
|
| 218 |
+
|(q:ℝ)*((taylor (h:ℝ) Q-Q).coeff j)-z|
|
| 219 |
+
≤ (((d+1):ℝ)*(2:ℝ)^d+1)*C/(N:ℝ)^j := by
|
| 220 |
+
let u := PolynomialIntegralResidual.integerPart d (fun j => if 1<j then m j else 0)
|
| 221 |
+
let low : ℝ[X] := Polynomial.C ((q:ℝ)*Q.coeff 0) + Polynomial.C ((q:ℝ)*Q.coeff 1)*X
|
| 222 |
+
let p : ℝ[X] := Polynomial.C (q:ℝ)*Q-low-u.map (Int.castRingHom ℝ)
|
| 223 |
+
have hu (j : ℕ) (hj : j≤d) : u.coeff j = if 1<j then m j else 0 :=
|
| 224 |
+
PolynomialIntegralResidual.integerPart_coeff _ _ _ hj
|
| 225 |
+
have hl (j : ℕ) : low.coeff j =
|
| 226 |
+
(if j=0 then (q:ℝ)*Q.coeff 0 else 0)+(if j=1 then (q:ℝ)*Q.coeff 1 else 0) := by
|
| 227 |
+
simp only [low,coeff_add,coeff_C_mul,coeff_C,coeff_X,mul_ite,mul_one,mul_zero]
|
| 228 |
+
simp only [eq_comm]
|
| 229 |
+
have hpd : p.natDegree≤d := by
|
| 230 |
+
apply (natDegree_sub_le _ _).trans
|
| 231 |
+
apply max_le
|
| 232 |
+
· apply (natDegree_sub_le _ _).trans
|
| 233 |
+
apply max_le
|
| 234 |
+
· exact (natDegree_C_mul_le _ _).trans hQ
|
| 235 |
+
· apply natDegree_add_le_of_degree_le
|
| 236 |
+
· exact (natDegree_C _).trans_le (Nat.zero_le d)
|
| 237 |
+
· exact (natDegree_C_mul_le _ _).trans (by simpa using hd)
|
| 238 |
+
· exact natDegree_map_le.trans (PolynomialIntegralResidual.integerPart_degree _ _)
|
| 239 |
+
have hpc (j : ℕ) (hj : 0<j) (hjd : j≤d) : |p.coeff j|≤C/(N:ℝ)^j := by
|
| 240 |
+
dsimp [p]
|
| 241 |
+
rw [coeff_sub,coeff_sub,coeff_C_mul,coeff_map,hu j hjd,hl]
|
| 242 |
+
by_cases hj1 : 1<j
|
| 243 |
+
· simpa [ne_of_gt hj,show j≠1 by omega,hj1] using hm j hj1 hjd
|
| 244 |
+
· have he : j=1 := by omega
|
| 245 |
+
subst j; norm_num; positivity
|
| 246 |
+
intro h hh j hj hjd
|
| 247 |
+
have hbound := taylor_coefficient_bound d N hN C hC p hpd hpc j hj h
|
| 248 |
+
⟨Nat.cast_nonneg _,by exact_mod_cast hh.le⟩
|
| 249 |
+
have hdiff : |(taylor (h:ℝ) p-p).coeff j|≤(((d+1):ℝ)*(2:ℝ)^d+1)*C/(N:ℝ)^j := by
|
| 250 |
+
rw [coeff_sub]
|
| 251 |
+
calc
|
| 252 |
+
_ ≤ |(taylor (h:ℝ) p).coeff j|+|p.coeff j| := abs_sub _ _
|
| 253 |
+
_ ≤ ((d+1):ℝ)*(2:ℝ)^d*C/(N:ℝ)^j+C/(N:ℝ)^j := add_le_add hbound (hpc j hj hjd)
|
| 254 |
+
_ = _ := by ring
|
| 255 |
+
have he : taylor (h:ℝ) p-p =
|
| 256 |
+
Polynomial.C (q:ℝ)*(taylor (h:ℝ) Q-Q) -
|
| 257 |
+
(taylor (h:ℤ) u-u).map (Int.castRingHom ℝ) - Polynomial.C ((q:ℝ)*Q.coeff 1*h) := by
|
| 258 |
+
simp only [p,low,taylor_apply,sub_comp,add_comp,C_mul_comp,C_comp,X_comp,
|
| 259 |
+
Polynomial.map_sub,map_comp,Polynomial.map_add,map_X,map_C,Int.coe_castRingHom,Int.cast_natCast]
|
| 260 |
+
simp only [map_mul]
|
| 261 |
+
ring
|
| 262 |
+
refine ⟨(taylor (h:ℤ) u-u).coeff j,?_⟩
|
| 263 |
+
simpa only [he,coeff_sub,coeff_C_mul,coeff_map,coeff_C,ite_eq_right (ne_of_gt hj),sub_zero,
|
| 264 |
+
Int.coe_castRingHom] using hdiff
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
theorem zero_commutator_descent (d : ℕ) (hd : 1≤d) (δ A : ℝ) (hδ : 0<δ) (hA : 0≤A) :
|
| 269 |
+
∃ B : ℕ, 0<B ∧ ∃ C : ℝ, 0<C ∧ ∃ N₀ : ℕ, 0<N₀ ∧
|
| 270 |
+
∀ N : ℕ, N₀≤N → ∀ P Q : ℝ[X], P.natDegree≤d → Q.natDegree≤d →
|
| 271 |
+
∀ S : Finset ℕ, S⊆range N → δ*N≤(S.card:ℝ) →
|
| 272 |
+
(∀ h∈S, ∀ j : ℕ, 0<j → j≤d → ∃ z : ℤ,
|
| 273 |
+
|(P+taylor (h:ℝ) Q-Q).coeff j-z|≤A/(N:ℝ)^j) →
|
| 274 |
+
∃ q : ℤ, q≠0 ∧ |q|≤B ∧
|
| 275 |
+
(∀ j : ℕ, 0<j → ∃ m : ℤ, |(q:ℝ)*P.coeff j-m|≤C/(N:ℝ)^j) ∧
|
| 276 |
+
(∀ j : ℕ, 1<j → ∃ m : ℤ, |(q:ℝ)*Q.coeff j-m|≤C/(N:ℝ)^j) := by
|
| 277 |
+
classical
|
| 278 |
+
obtain ⟨B,hB,C,hC,L,hL,hdesc⟩ := shift_coefficients d 1 (by decide) δ A hδ hA
|
| 279 |
+
let D := (((d+1):ℝ)*(2:ℝ)^d+1)*C
|
| 280 |
+
let C' := max C ((B:ℝ)*A+D)
|
| 281 |
+
have hCC : C≤C' := le_max_left _ _
|
| 282 |
+
have hsum : (B:ℝ)*A+D≤C' := le_max_right _ _
|
| 283 |
+
refine ⟨B,hB,C',hC.trans_le hCC,L,hL,?_⟩
|
| 284 |
+
intro N hLN P Q hP hQ S hSN hS hsmall
|
| 285 |
+
have hN : 0<N := hL.trans_le hLN
|
| 286 |
+
have hNr : (0:ℝ)<N := Nat.cast_pos.mpr hN
|
| 287 |
+
obtain ⟨q,hq,hqB,hcoeff⟩ := hdesc N hLN P Q hQ S hSN hS
|
| 288 |
+
(fun h hh => hsmall h hh 1 (by decide) hd)
|
| 289 |
+
have hex (j : ℕ) : ∃ m : ℤ, 1<j → j≤d → |(q:ℝ)*Q.coeff j-m|≤C/(N:ℝ)^j := by
|
| 290 |
+
by_cases hj : 1<j ∧ j≤d
|
| 291 |
+
· obtain ⟨m,hm⟩ := hcoeff j hj.1 hj.2
|
| 292 |
+
exact ⟨m,fun _ _ => hm⟩
|
| 293 |
+
· exact ⟨0,fun h1 h2 => (hj ⟨h1,h2⟩).elim⟩
|
| 294 |
+
choose m hm using hex
|
| 295 |
+
have hres := nonlinear_shift_residual d N hd hN Q hQ q C hC.le m hm
|
| 296 |
+
have hqBr : |(q:ℝ)|≤B := by exact_mod_cast hqB
|
| 297 |
+
refine ⟨q,hq,hqB,?_,?_⟩
|
| 298 |
+
· intro j hj
|
| 299 |
+
by_cases hjd : j≤d
|
| 300 |
+
· have hpos : (0:ℝ)<S.card := (mul_pos hδ hNr).trans_le hS
|
| 301 |
+
obtain ⟨h,hh⟩ := card_pos.mp (by exact_mod_cast hpos)
|
| 302 |
+
obtain ⟨z,hz⟩ := hsmall h hh j hj hjd
|
| 303 |
+
obtain ⟨w,hw⟩ := hres h (mem_range.mp (hSN hh)) j hj hjd
|
| 304 |
+
refine ⟨q*z-w,?_⟩
|
| 305 |
+
have hz' : |(q:ℝ)*((P+taylor (h:ℝ) Q-Q).coeff j-z)|≤(B:ℝ)*A/(N:ℝ)^j := by
|
| 306 |
+
rw [abs_mul]
|
| 307 |
+
calc
|
| 308 |
+
_ ≤ (B:ℝ)*(A/(N:ℝ)^j) := mul_le_mul hqBr hz (abs_nonneg _) (Nat.cast_nonneg _)
|
| 309 |
+
_ = _ := by ring
|
| 310 |
+
have he : (q:ℝ)*P.coeff j-((q*z-w:ℤ):ℝ) =
|
| 311 |
+
(q:ℝ)*((P+taylor (h:ℝ) Q-Q).coeff j-z)-
|
| 312 |
+
((q:ℝ)*((taylor (h:ℝ) Q-Q).coeff j)-w) := by
|
| 313 |
+
simp only [coeff_sub,coeff_add,Int.cast_sub,Int.cast_mul]
|
| 314 |
+
ring
|
| 315 |
+
rw [he]
|
| 316 |
+
calc
|
| 317 |
+
_ ≤ |(q:ℝ)*((P+taylor (h:ℝ) Q-Q).coeff j-z)|+
|
| 318 |
+
|(q:ℝ)*((taylor (h:ℝ) Q-Q).coeff j)-w| := abs_sub _ _
|
| 319 |
+
_ ≤ (B:ℝ)*A/(N:ℝ)^j+D/(N:ℝ)^j := add_le_add hz' hw
|
| 320 |
+
_ = ((B:ℝ)*A+D)/(N:ℝ)^j := by ring
|
| 321 |
+
_ ≤ _ := div_le_div_of_nonneg_right hsum (pow_nonneg hNr.le _)
|
| 322 |
+
· refine ⟨0,?_⟩
|
| 323 |
+
rw [coeff_eq_zero_of_natDegree_lt (by omega)]
|
| 324 |
+
simp only [mul_zero,Int.cast_zero,sub_zero,abs_zero]
|
| 325 |
+
exact div_nonneg (hC.le.trans hCC) (pow_nonneg hNr.le _)
|
| 326 |
+
· intro j hj
|
| 327 |
+
by_cases hjd : j≤d
|
| 328 |
+
· exact ⟨m j,(hm j hj hjd).trans (div_le_div_of_nonneg_right hCC (pow_nonneg hNr.le _))⟩
|
| 329 |
+
· refine ⟨0,?_⟩
|
| 330 |
+
rw [coeff_eq_zero_of_natDegree_lt (by omega)]
|
| 331 |
+
simp only [mul_zero,Int.cast_zero,sub_zero,abs_zero]
|
| 332 |
+
exact div_nonneg (hC.le.trans hCC) (pow_nonneg hNr.le _)
|
| 333 |
+
|
| 334 |
+
end PolynomialCharacterDescent
|
| 335 |
+
|
| 336 |
+
end
|
| 337 |
+
end
|
| 338 |
+
end
|
| 339 |
+
end
|
| 340 |
+
end
|
| 341 |
+
|
| 342 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialDephasing01.lean
ADDED
|
@@ -0,0 +1,477 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.WeylInverse01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
namespace PolynomialDephasing
|
| 12 |
+
open scoped BigOperators ComplexConjugate
|
| 13 |
+
open PolynomialWeyl
|
| 14 |
+
noncomputable section
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
theorem norm_phase_sub_one_le (t : ℝ) : ‖phase t - 1‖ ≤ 2 * Real.pi * |t| := by
|
| 18 |
+
unfold phase
|
| 19 |
+
rw [mul_comm _ Complex.I, Complex.norm_exp_I_mul_ofReal_sub_one]
|
| 20 |
+
have he : 2 * Real.pi * t / 2 = Real.pi * t := by ring
|
| 21 |
+
rw [he, Real.norm_eq_abs, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)]
|
| 22 |
+
have h : |Real.sin (Real.pi * t)| ≤ |Real.pi * t| := Real.abs_sin_le_abs
|
| 23 |
+
rw [abs_mul, abs_of_pos Real.pi_pos] at h
|
| 24 |
+
nlinarith only [h]
|
| 25 |
+
|
| 26 |
+
theorem norm_phase_sub_le (x y : ℝ) : ‖phase x - phase y‖ ≤ 2 * Real.pi * |x - y| := by
|
| 27 |
+
have he : phase x - phase y = (phase (x - y) - 1) * phase y := by
|
| 28 |
+
rw [sub_mul, one_mul, ← phase_add]
|
| 29 |
+
congr 2
|
| 30 |
+
ring
|
| 31 |
+
rw [he, norm_mul, norm_phase, mul_one]
|
| 32 |
+
exact norm_phase_sub_one_le _
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
theorem monomial_phase_variation (N d : ℕ) (ε : ℝ) :
|
| 36 |
+
∑ n ∈ Finset.range (N - 1),
|
| 37 |
+
‖phase (ε * ((n + 1 : ℕ) : ℝ) ^ d) - phase (ε * (n : ℝ) ^ d)‖ ≤
|
| 38 |
+
2 * Real.pi * |ε| * (N : ℝ) ^ d := by
|
| 39 |
+
calc
|
| 40 |
+
_ ≤ ∑ n ∈ Finset.range (N - 1),
|
| 41 |
+
2 * Real.pi * |ε| * (((n + 1 : ℕ) : ℝ) ^ d - (n : ℝ) ^ d) := by
|
| 42 |
+
apply Finset.sum_le_sum
|
| 43 |
+
intro n _
|
| 44 |
+
have h := norm_phase_sub_le (ε * ((n + 1 : ℕ) : ℝ) ^ d) (ε * (n : ℝ) ^ d)
|
| 45 |
+
have hpow : (0 : ℝ) ≤ ((n + 1 : ℕ) : ℝ) ^ d - (n : ℝ) ^ d :=
|
| 46 |
+
sub_nonneg.mpr (pow_le_pow_left₀ (Nat.cast_nonneg n)
|
| 47 |
+
(by exact_mod_cast Nat.le_succ n) d)
|
| 48 |
+
rw [← mul_sub, abs_mul, abs_of_nonneg hpow] at h
|
| 49 |
+
nlinarith only [h]
|
| 50 |
+
_ = 2 * Real.pi * |ε| * (((N - 1 : ℕ) : ℝ) ^ d - (0 : ℝ) ^ d) := by
|
| 51 |
+
rw [← Finset.mul_sum]
|
| 52 |
+
congr 1
|
| 53 |
+
simpa only [Nat.cast_zero] using Finset.sum_range_sub (fun n : ℕ => (n : ℝ) ^ d) (N - 1)
|
| 54 |
+
_ ≤ _ := by
|
| 55 |
+
apply mul_le_mul_of_nonneg_left _ (by positivity)
|
| 56 |
+
have h := pow_le_pow_left₀ (by positivity : (0 : ℝ) ≤ ((N - 1 : ℕ) : ℝ))
|
| 57 |
+
(show ((N - 1 : ℕ) : ℝ) ≤ N by exact_mod_cast Nat.sub_le N 1) d
|
| 58 |
+
linarith [pow_nonneg (show (0 : ℝ) ≤ 0 by rfl) d]
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
theorem weighted_mean_large_prefix (N : ℕ) (hN : 0 < N)
|
| 63 |
+
(f w : ℕ → ℂ) (hf : ∀ n, ‖f n‖ ≤ 1) (hw : ∀ n, ‖w n‖ ≤ 1)
|
| 64 |
+
(V δ : ℝ) (hV : 0 ≤ V) (hδ : 0 < δ)
|
| 65 |
+
(hvar : ∑ n ∈ Finset.range (N - 1), ‖w (n + 1) - w n‖ ≤ V)
|
| 66 |
+
(hlarge : δ ≤ ‖mean N (fun n => w n * f n)‖) :
|
| 67 |
+
∃ M : ℕ, 0 < M ∧ M ≤ N ∧ δ * N / (1 + V) ≤ M ∧
|
| 68 |
+
δ / (1 + V) ≤ ‖mean M f‖ := by
|
| 69 |
+
classical
|
| 70 |
+
let F : ℕ → ℂ := fun M => ∑ n ∈ Finset.range M, f n
|
| 71 |
+
obtain ⟨M, hM, hmax⟩ := (Finset.Icc 1 N).exists_max_image (fun M => ‖F M‖)
|
| 72 |
+
⟨1, Finset.mem_Icc.mpr ⟨le_rfl, hN⟩⟩
|
| 73 |
+
have hM₀ : 0 < M := (Finset.mem_Icc.mp hM).1
|
| 74 |
+
have hMN : M ≤ N := (Finset.mem_Icc.mp hM).2
|
| 75 |
+
have hbound : ‖∑ n ∈ Finset.range N, w n * f n‖ ≤ (1 + V) * ‖F M‖ := by
|
| 76 |
+
have he := Finset.sum_range_by_parts w f N
|
| 77 |
+
simp only [smul_eq_mul] at he
|
| 78 |
+
rw [he]
|
| 79 |
+
calc
|
| 80 |
+
_ ≤ ‖w (N - 1) * F N‖ +
|
| 81 |
+
‖∑ n ∈ Finset.range (N - 1), (w (n + 1) - w n) * F (n + 1)‖ := norm_sub_le _ _
|
| 82 |
+
_ ≤ 1 * ‖F M‖ + ∑ n ∈ Finset.range (N - 1), ‖w (n + 1) - w n‖ * ‖F M‖ := by
|
| 83 |
+
apply add_le_add
|
| 84 |
+
· rw [norm_mul]
|
| 85 |
+
exact mul_le_mul (hw _) (hmax N (Finset.mem_Icc.mpr ⟨hN, le_rfl⟩))
|
| 86 |
+
(norm_nonneg _) (by norm_num)
|
| 87 |
+
· apply (norm_sum_le _ _).trans
|
| 88 |
+
apply Finset.sum_le_sum
|
| 89 |
+
intro n hn
|
| 90 |
+
rw [norm_mul]
|
| 91 |
+
apply mul_le_mul_of_nonneg_left _ (norm_nonneg _)
|
| 92 |
+
exact hmax (n + 1) (Finset.mem_Icc.mpr ⟨by omega,
|
| 93 |
+
by have := Finset.mem_range.mp hn; omega⟩)
|
| 94 |
+
_ ≤ (1 + V) * ‖F M‖ := by
|
| 95 |
+
rw [← Finset.sum_mul]
|
| 96 |
+
nlinarith only [mul_le_mul_of_nonneg_right hvar (norm_nonneg (F M))]
|
| 97 |
+
have hsum : δ * N ≤ (1 + V) * ‖F M‖ := by
|
| 98 |
+
have he : ‖mean N (fun n => w n * f n)‖ =
|
| 99 |
+
‖∑ n ∈ Finset.range N, w n * f n‖ / N := by
|
| 100 |
+
simp [mean, Finset.expect_eq_sum_div_card ]
|
| 101 |
+
rw [he] at hlarge
|
| 102 |
+
exact ((le_div_iff₀ (Nat.cast_pos.mpr hN)).mp hlarge).trans hbound
|
| 103 |
+
have hF : ‖F M‖ ≤ M := by
|
| 104 |
+
apply (norm_sum_le _ _).trans
|
| 105 |
+
calc
|
| 106 |
+
(∑ n ∈ Finset.range M, ‖f n‖) ≤ ∑ n ∈ Finset.range M, (1 : ℝ) :=
|
| 107 |
+
Finset.sum_le_sum (fun n _ => hf n)
|
| 108 |
+
_ = M := by simp
|
| 109 |
+
have hVM : 0 < 1 + V := by linarith
|
| 110 |
+
refine ⟨M, hM₀, hMN, ?_, ?_⟩
|
| 111 |
+
· apply (div_le_iff₀ hVM).mpr
|
| 112 |
+
nlinarith only [hsum, hF, mul_le_mul_of_nonneg_left hF hVM.le]
|
| 113 |
+
· have he : ‖mean M f‖ = ‖F M‖ / M := by
|
| 114 |
+
simp [mean, F, Finset.expect_eq_sum_div_card ]
|
| 115 |
+
rw [he]
|
| 116 |
+
apply (div_le_div_iff₀ hVM (Nat.cast_pos.mpr hM₀)).mpr
|
| 117 |
+
have hMN' : (M : ℝ) ≤ N := by exact_mod_cast hMN
|
| 118 |
+
nlinarith only [hsum, mul_le_mul_of_nonneg_left hMN' hδ.le]
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
def fourierCoefficient {q : ℕ} [NeZero q] (F : ZMod q → ℂ) (k : ZMod q) : ℂ :=
|
| 122 |
+
(q : ℂ)⁻¹ * ZMod.dft F k
|
| 123 |
+
|
| 124 |
+
theorem norm_fourierCoefficient_le_one {q : ℕ} [NeZero q]
|
| 125 |
+
(F : ZMod q → ℂ) (hF : ∀ x, ‖F x‖ ≤ 1) (k : ZMod q) :
|
| 126 |
+
‖fourierCoefficient F k‖ ≤ 1 := by
|
| 127 |
+
have he : fourierCoefficient F k =
|
| 128 |
+
𝔼 j : ZMod q, ZMod.stdAddChar (-(j * k)) * F j := by
|
| 129 |
+
simp [fourierCoefficient, ZMod.dft_apply, Finset.expect_eq_sum_div_card, div_eq_mul_inv,
|
| 130 |
+
mul_comm]
|
| 131 |
+
rw [he]
|
| 132 |
+
apply (RCLike.norm_expect_le (K := ℂ)).trans
|
| 133 |
+
apply Finset.expect_le Finset.univ_nonempty
|
| 134 |
+
intro j _
|
| 135 |
+
simpa only [norm_mul, ZMod.stdAddChar_apply, Circle.norm_coe, one_mul] using hF j
|
| 136 |
+
|
| 137 |
+
theorem fourier_expansion {q : ℕ} [NeZero q] (F : ZMod q → ℂ) (x : ZMod q) :
|
| 138 |
+
F x = ∑ k : ZMod q, fourierCoefficient F k * ZMod.stdAddChar (k * x) := by
|
| 139 |
+
have h := congrFun (ZMod.dft.symm_apply_apply F) x
|
| 140 |
+
rw [ZMod.invDFT_apply] at h
|
| 141 |
+
rw [← h]
|
| 142 |
+
simp only [smul_eq_mul, Finset.mul_sum, fourierCoefficient]
|
| 143 |
+
apply Finset.sum_congr rfl
|
| 144 |
+
intro k _
|
| 145 |
+
ring
|
| 146 |
+
|
| 147 |
+
theorem stdAddChar_int_phase {q : ℕ} [NeZero q] (z : ℤ) :
|
| 148 |
+
ZMod.stdAddChar (z : ZMod q) = phase ((z : ℝ) / q) := by
|
| 149 |
+
rw [ZMod.stdAddChar_coe, phase]
|
| 150 |
+
congr 1
|
| 151 |
+
push_cast
|
| 152 |
+
ring
|
| 153 |
+
|
| 154 |
+
theorem stdAddChar_mul_nat_phase {q : ℕ} [NeZero q] (k : ZMod q) (n : ℕ) :
|
| 155 |
+
ZMod.stdAddChar (k * (n : ZMod q)) = phase ((k.val : ℝ) / q * n) := by
|
| 156 |
+
have he : (((k.val : ℤ) * n : ℤ) : ZMod q) = k * (n : ZMod q) := by simp
|
| 157 |
+
rw [← he, stdAddChar_int_phase]
|
| 158 |
+
congr 1
|
| 159 |
+
push_cast
|
| 160 |
+
ring
|
| 161 |
+
|
| 162 |
+
theorem rational_monomial_phase {q : ℕ} [NeZero q] (m : ℤ) (d n : ℕ) :
|
| 163 |
+
phase ((m : ℝ) / q * (n : ℝ) ^ d) =
|
| 164 |
+
ZMod.stdAddChar ((m : ZMod q) * (n : ZMod q) ^ d) := by
|
| 165 |
+
have he : ((m * (n : ℤ) ^ d : ℤ) : ZMod q) =
|
| 166 |
+
(m : ZMod q) * (n : ZMod q) ^ d := by push_cast; rfl
|
| 167 |
+
rw [← he, stdAddChar_int_phase]
|
| 168 |
+
congr 1
|
| 169 |
+
push_cast
|
| 170 |
+
ring
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
theorem periodic_weight_large_frequency {q : ℕ} [NeZero q]
|
| 175 |
+
(F : ZMod q → ℂ) (hF : ∀ x, ‖F x‖ ≤ 1) (f : ℕ → ℂ)
|
| 176 |
+
(N : ℕ) (δ : ℝ) (hlarge : δ ≤ ‖mean N (fun n => F (n : ZMod q) * f n)‖) :
|
| 177 |
+
∃ k : ZMod q, δ / q ≤
|
| 178 |
+
‖mean N (fun n => ZMod.stdAddChar (k * (n : ZMod q)) * f n)‖ := by
|
| 179 |
+
classical
|
| 180 |
+
let G := fun k : ZMod q => mean N (fun n => ZMod.stdAddChar (k * (n : ZMod q)) * f n)
|
| 181 |
+
have he : mean N (fun n => F (n : ZMod q) * f n) =
|
| 182 |
+
∑ k : ZMod q, fourierCoefficient F k * G k := by
|
| 183 |
+
unfold mean
|
| 184 |
+
conv_lhs => arg 2; ext n; dsimp only; rw [fourier_expansion F (n : ZMod q)]
|
| 185 |
+
simp_rw [Finset.sum_mul, mul_assoc]
|
| 186 |
+
rw [Finset.expect_sum_comm]
|
| 187 |
+
simp_rw [← Finset.mul_expect]
|
| 188 |
+
rfl
|
| 189 |
+
obtain ⟨k, _, hmax⟩ := Finset.univ.exists_max_image (fun k : ZMod q => ‖G k‖)
|
| 190 |
+
Finset.univ_nonempty
|
| 191 |
+
refine ⟨k, ?_⟩
|
| 192 |
+
have hbound : δ ≤ (q : ℝ) * ‖G k‖ := by
|
| 193 |
+
apply hlarge.trans
|
| 194 |
+
rw [he]
|
| 195 |
+
apply (norm_sum_le _ _).trans
|
| 196 |
+
calc
|
| 197 |
+
(∑ j : ZMod q, ‖fourierCoefficient F j * G j‖) ≤ ∑ _j : ZMod q, ‖G k‖ := by
|
| 198 |
+
apply Finset.sum_le_sum
|
| 199 |
+
intro j _
|
| 200 |
+
rw [norm_mul]
|
| 201 |
+
exact (mul_le_mul (norm_fourierCoefficient_le_one F hF j)
|
| 202 |
+
(hmax j (Finset.mem_univ j)) (norm_nonneg _) (by norm_num)).trans_eq (one_mul _)
|
| 203 |
+
_ = (q : ℝ) * ‖G k‖ := by simp
|
| 204 |
+
apply (div_le_iff₀ (show 0 < (q : ℝ) by exact_mod_cast Nat.pos_of_ne_zero (NeZero.ne q))).mpr
|
| 205 |
+
nlinarith only [hbound]
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
theorem remove_rational_monomial (q B N d : ℕ) (hq : 0 < q) (hqB : q ≤ B)
|
| 210 |
+
(hN : 0 < N) (m : ℤ) (ε A δ : ℝ) (hA : 0 ≤ A) (hδ : 0 < δ)
|
| 211 |
+
(hε : |ε| * (N : ℝ) ^ d ≤ A) (f : ℕ → ℂ) (hf : ∀ n, ‖f n‖ ≤ 1)
|
| 212 |
+
(hlarge : δ ≤ ‖mean N (fun n =>
|
| 213 |
+
phase ((m : ℝ) / q * (n : ℝ) ^ d) * phase (ε * (n : ℝ) ^ d) * f n)‖) :
|
| 214 |
+
∃ l : ℕ, l < q ∧ ∃ M : ℕ, 0 < M ∧ M ≤ N ∧
|
| 215 |
+
δ / ((B : ℝ) * (1 + 2 * Real.pi * A)) * N ≤ M ∧
|
| 216 |
+
δ / ((B : ℝ) * (1 + 2 * Real.pi * A)) ≤
|
| 217 |
+
‖mean M (fun n => phase ((l : ℝ) / q * n) * f n)‖ := by
|
| 218 |
+
let : NeZero q := ⟨Nat.ne_of_gt hq⟩
|
| 219 |
+
let F : ZMod q → ℂ := fun x => ZMod.stdAddChar ((m : ZMod q) * x ^ d)
|
| 220 |
+
have hlarge' : δ ≤ ‖mean N (fun n =>
|
| 221 |
+
F (n : ZMod q) * (phase (ε * (n : ℝ) ^ d) * f n))‖ := by
|
| 222 |
+
simpa only [F, ← rational_monomial_phase, mul_assoc] using hlarge
|
| 223 |
+
obtain ⟨k, hk⟩ := periodic_weight_large_frequency F
|
| 224 |
+
(fun x => by simp [F, ZMod.stdAddChar_apply, Circle.norm_coe])
|
| 225 |
+
(fun n => phase (ε * (n : ℝ) ^ d) * f n) N δ hlarge'
|
| 226 |
+
have hk' : δ / q ≤ ‖mean N (fun n => phase (ε * (n : ℝ) ^ d) *
|
| 227 |
+
(phase ((k.val : ℝ) / q * n) * f n))‖ := by
|
| 228 |
+
simpa only [stdAddChar_mul_nat_phase, mul_left_comm] using hk
|
| 229 |
+
obtain ⟨M, hM, hMN, hlength, hmean⟩ := weighted_mean_large_prefix N hN
|
| 230 |
+
(fun n => phase ((k.val : ℝ) / q * n) * f n)
|
| 231 |
+
(fun n => phase (ε * (n : ℝ) ^ d))
|
| 232 |
+
(fun n => by simpa only [norm_mul, norm_phase, one_mul] using hf n)
|
| 233 |
+
(fun n => by simp) (2 * Real.pi * A) (δ / q) (by positivity) (by positivity)
|
| 234 |
+
(by
|
| 235 |
+
apply (monomial_phase_variation N d ε).trans
|
| 236 |
+
have h := mul_le_mul_of_nonneg_left hε (by positivity : 0 ≤ 2 * Real.pi)
|
| 237 |
+
nlinarith only [h]) hk'
|
| 238 |
+
have hq₀ : 0 < (q : ℝ) := Nat.cast_pos.mpr hq
|
| 239 |
+
have hB₀ : 0 < (B : ℝ) := Nat.cast_pos.mpr (hq.trans_le hqB)
|
| 240 |
+
have hden : 0 < 1 + 2 * Real.pi * A := by positivity
|
| 241 |
+
have hweak : δ / ((B : ℝ) * (1 + 2 * Real.pi * A)) ≤
|
| 242 |
+
(δ / q) / (1 + 2 * Real.pi * A) := by
|
| 243 |
+
rw [div_div]
|
| 244 |
+
apply div_le_div_of_nonneg_left hδ.le (by positivity)
|
| 245 |
+
exact mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hqB) hden.le
|
| 246 |
+
refine ⟨k.val, ZMod.val_lt k, M, hM, hMN, ?_, hweak.trans hmean⟩
|
| 247 |
+
have he : (δ / q) * N / (1 + 2 * Real.pi * A) =
|
| 248 |
+
((δ / q) / (1 + 2 * Real.pi * A)) * N := by ring
|
| 249 |
+
rw [he] at hlength
|
| 250 |
+
exact (mul_le_mul_of_nonneg_right hweak (Nat.cast_nonneg N)).trans hlength
|
| 251 |
+
|
| 252 |
+
end
|
| 253 |
+
end PolynomialDephasing
|
| 254 |
+
|
| 255 |
+
namespace WeylCoefficients
|
| 256 |
+
open scoped BigOperators ComplexConjugate
|
| 257 |
+
open PolynomialWeyl PolynomialDephasing WeylInverse
|
| 258 |
+
noncomputable section
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
def lowerWithFrequency (p : Polynomial ℝ) (d l q : ℕ) : Polynomial ℝ :=
|
| 263 |
+
p.erase (d + 1) + Polynomial.monomial 1 ((l : ℝ) / q)
|
| 264 |
+
|
| 265 |
+
theorem lowerWithFrequency_degree (p : Polynomial ℝ) (d l q : ℕ)
|
| 266 |
+
(hd : 0 < d) (hp : p.natDegree ≤ d + 1) :
|
| 267 |
+
(lowerWithFrequency p d l q).natDegree ≤ d := by
|
| 268 |
+
apply Polynomial.natDegree_add_le_of_degree_le
|
| 269 |
+
· rw [Polynomial.natDegree_le_iff_coeff_eq_zero]
|
| 270 |
+
intro j hj
|
| 271 |
+
by_cases he : j = d + 1
|
| 272 |
+
· simp [he]
|
| 273 |
+
· rw [Polynomial.erase_ne p he]
|
| 274 |
+
exact Polynomial.coeff_eq_zero_of_natDegree_lt (by omega)
|
| 275 |
+
· exact (Polynomial.natDegree_monomial_le _).trans hd
|
| 276 |
+
|
| 277 |
+
theorem lowerWithFrequency_coeff (p : Polynomial ℝ) (d l q j : ℕ) (hj : j ≤ d) :
|
| 278 |
+
(lowerWithFrequency p d l q).coeff j = p.coeff j + if j = 1 then (l : ℝ) / q else 0 := by
|
| 279 |
+
simp only [lowerWithFrequency, Polynomial.coeff_add,
|
| 280 |
+
Polynomial.erase_ne p (show j ≠ d + 1 by omega), Polynomial.coeff_monomial]
|
| 281 |
+
by_cases he : j = 1 <;> simp [he, eq_comm]
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
theorem remove_leading_coefficient (d A N q : ℕ) (_hA : 0 < A) (hN : 0 < N)
|
| 286 |
+
(hq : 0 < q) (hqA : q ≤ A) (p : Polynomial ℝ) (m : ℤ) (δ : ℝ) (hδ : 0 < δ)
|
| 287 |
+
(hm : |(q : ℝ) * p.coeff (d + 1) - m| ≤ (A : ℝ) / (N : ℝ) ^ (d + 1))
|
| 288 |
+
(hlarge : δ ≤ ‖mean N (polynomialPhase p)‖) :
|
| 289 |
+
∃ l : ℕ, l < q ∧ ∃ M : ℕ, 0 < M ∧ M ≤ N ∧
|
| 290 |
+
δ / ((A : ℝ) * (1 + 2 * Real.pi * A)) * N ≤ M ∧
|
| 291 |
+
δ / ((A : ℝ) * (1 + 2 * Real.pi * A)) ≤
|
| 292 |
+
‖mean M (polynomialPhase (lowerWithFrequency p d l q))‖ := by
|
| 293 |
+
let ε := p.coeff (d + 1) - (m : ℝ) / q
|
| 294 |
+
have hq₀ : 0 < (q : ℝ) := Nat.cast_pos.mpr hq
|
| 295 |
+
have hq₁ : 1 ≤ (q : ℝ) := by exact_mod_cast hq
|
| 296 |
+
have hεeq : (q : ℝ) * ε = (q : ℝ) * p.coeff (d + 1) - m := by
|
| 297 |
+
dsimp [ε]
|
| 298 |
+
field_simp
|
| 299 |
+
have hε : |ε| * (N : ℝ) ^ (d + 1) ≤ A := by
|
| 300 |
+
apply (le_div_iff₀ (pow_pos (Nat.cast_pos.mpr hN) _)).mp
|
| 301 |
+
apply le_trans _ hm
|
| 302 |
+
rw [← hεeq, abs_mul, abs_of_pos hq₀]
|
| 303 |
+
have h := mul_le_mul_of_nonneg_right hq₁ (abs_nonneg ε)
|
| 304 |
+
simpa only [one_mul] using h
|
| 305 |
+
have he (n : ℕ) : p.eval (n : ℝ) =
|
| 306 |
+
(m : ℝ) / q * (n : ℝ) ^ (d + 1) + ε * (n : ℝ) ^ (d + 1) +
|
| 307 |
+
(p.erase (d + 1)).eval (n : ℝ) := by
|
| 308 |
+
have h := congrArg (fun u : Polynomial ℝ => u.eval (n : ℝ)) (p.monomial_add_erase (d + 1))
|
| 309 |
+
simp only [Polynomial.eval_add, Polynomial.eval_monomial] at h
|
| 310 |
+
dsimp [ε]
|
| 311 |
+
linarith only [h]
|
| 312 |
+
obtain ⟨l, hl, M, hM, hMN, hlength, hmean⟩ := remove_rational_monomial q A N (d + 1)
|
| 313 |
+
hq hqA hN m ε A δ (Nat.cast_nonneg _) hδ hε (polynomialPhase (p.erase (d + 1)))
|
| 314 |
+
(fun n => by simp [polynomialPhase]) (by
|
| 315 |
+
change δ ≤ ‖mean N (fun n => phase (p.eval (n : ℝ)))‖ at hlarge
|
| 316 |
+
simp_rw [he, phase_add] at hlarge
|
| 317 |
+
exact hlarge)
|
| 318 |
+
refine ⟨l, hl, M, hM, hMN, hlength, ?_⟩
|
| 319 |
+
have hfun : polynomialPhase (lowerWithFrequency p d l q) =
|
| 320 |
+
(fun n : ℕ => phase ((l : ℝ) / q * (n : ℝ)) * polynomialPhase (p.erase (d + 1)) n) := by
|
| 321 |
+
funext n
|
| 322 |
+
simp [polynomialPhase, lowerWithFrequency, Polynomial.eval_add,
|
| 323 |
+
Polynomial.eval_monomial, phase_add, mul_comm]
|
| 324 |
+
rw [hfun]
|
| 325 |
+
exact hmean
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
theorem prefix_error_transfer (N M T d j : ℕ) (hN : 0 < N) (hM : 0 < M)
|
| 330 |
+
(hT : 1 ≤ T) (hj : j ≤ d) (hNM : (N : ℝ) ≤ (T : ℝ) * M)
|
| 331 |
+
(C : ℝ) (hC : 0 ≤ C) :
|
| 332 |
+
C / (M : ℝ) ^ j ≤ C * (T : ℝ) ^ d / (N : ℝ) ^ j := by
|
| 333 |
+
apply (div_le_div_iff₀ (pow_pos (Nat.cast_pos.mpr hM) _)
|
| 334 |
+
(pow_pos (Nat.cast_pos.mpr hN) _)).mpr
|
| 335 |
+
have hpow : (N : ℝ) ^ j ≤ (T : ℝ) ^ d * (M : ℝ) ^ j := by
|
| 336 |
+
calc
|
| 337 |
+
_ ≤ ((T : ℝ) * M) ^ j := pow_le_pow_left₀ (Nat.cast_nonneg _) hNM _
|
| 338 |
+
_ = (T : ℝ) ^ j * (M : ℝ) ^ j := mul_pow ..
|
| 339 |
+
_ ≤ _ := mul_le_mul_of_nonneg_right (pow_le_pow_right₀ (by exact_mod_cast hT) hj)
|
| 340 |
+
(by positivity)
|
| 341 |
+
have h := mul_le_mul_of_nonneg_left hpow hC
|
| 342 |
+
nlinarith only [h]
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
|
| 346 |
+
def CoefficientInverse (d : ℕ) : Prop :=
|
| 347 |
+
∀ δ : ℝ, 0 < δ → ∃ A : ℕ, 0 < A ∧
|
| 348 |
+
∀ N : ℕ, 0 < N → ∀ p : Polynomial ℝ, p.natDegree ≤ d →
|
| 349 |
+
δ ≤ ‖mean N (polynomialPhase p)‖ →
|
| 350 |
+
∃ q : ℕ, 0 < q ∧ q ≤ A ∧ ∃ m : ℕ → ℤ,
|
| 351 |
+
∀ j : ℕ, 0 < j → j ≤ d →
|
| 352 |
+
|(q : ℝ) * p.coeff j - m j| ≤ (A : ℝ) / (N : ℝ) ^ j
|
| 353 |
+
|
| 354 |
+
theorem coefficient_inverse_zero : CoefficientInverse 0 := by
|
| 355 |
+
intro δ _
|
| 356 |
+
refine ⟨1, by omega, ?_⟩
|
| 357 |
+
intro N _ p _ _
|
| 358 |
+
exact ⟨1, by omega, le_rfl, fun _ => 0, fun j hj hj' => by omega⟩
|
| 359 |
+
|
| 360 |
+
theorem coefficient_inverse_one : CoefficientInverse 1 := by
|
| 361 |
+
intro δ hδ
|
| 362 |
+
obtain ⟨A, hA, hinv⟩ := leading_inverse_one δ hδ
|
| 363 |
+
refine ⟨A, hA, ?_⟩
|
| 364 |
+
intro N hN p hp hlarge
|
| 365 |
+
obtain ⟨q, hq, hqA, m, hm⟩ := hinv N hN p hp hlarge
|
| 366 |
+
refine ⟨q, hq, hqA, fun _ => m, ?_⟩
|
| 367 |
+
intro j hj hj'
|
| 368 |
+
have : j = 1 := by omega
|
| 369 |
+
subst j
|
| 370 |
+
exact hm
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
theorem coefficient_inverse_succ (d : ℕ) (hd : 0 < d)
|
| 375 |
+
(ih : CoefficientInverse d) : CoefficientInverse (d + 1) := by
|
| 376 |
+
intro δ hδ
|
| 377 |
+
obtain ⟨A, hA, hlead⟩ := leading_inverse (d + 1) (by omega) δ hδ
|
| 378 |
+
let τ := δ / ((A : ℝ) * (1 + 2 * Real.pi * A))
|
| 379 |
+
have hτ : 0 < τ := by dsimp [τ]; positivity
|
| 380 |
+
obtain ⟨A', hA', hlower⟩ := ih τ hτ
|
| 381 |
+
obtain ⟨T, hT⟩ := exists_nat_gt (max (1 : ℝ) (1 / τ))
|
| 382 |
+
have hT₁ : 1 ≤ (T : ℝ) := (le_max_left _ _).trans hT.le
|
| 383 |
+
have hTnat : 1 ≤ T := by exact_mod_cast hT₁
|
| 384 |
+
have hTτ : 1 ≤ (T : ℝ) * τ :=
|
| 385 |
+
(div_le_iff₀ hτ).mp ((le_max_right _ _).trans hT.le)
|
| 386 |
+
let C := A * A'
|
| 387 |
+
let B := C * T ^ d + C + 1
|
| 388 |
+
have hB : 0 < B := by dsimp [B]; omega
|
| 389 |
+
have hCB : C ≤ B := by dsimp [B]; omega
|
| 390 |
+
have hCTB : C * T ^ d ≤ B := by dsimp [B]; omega
|
| 391 |
+
refine ⟨B, hB, ?_⟩
|
| 392 |
+
intro N hN p hp hlarge
|
| 393 |
+
obtain ⟨q, hq, hqA, m, hm⟩ := hlead N hN p hp hlarge
|
| 394 |
+
obtain ⟨l, _, M, hM, _, hlength, hmean⟩ := remove_leading_coefficient d A N q
|
| 395 |
+
hA hN hq hqA p m δ hδ hm hlarge
|
| 396 |
+
obtain ⟨b, hb, hbA', z, hz⟩ := hlower M hM (lowerWithFrequency p d l q)
|
| 397 |
+
(lowerWithFrequency_degree p d l q hd hp) hmean
|
| 398 |
+
have hNM : (N : ℝ) ≤ (T : ℝ) * M := by
|
| 399 |
+
change τ * N ≤ (M : ℝ) at hlength
|
| 400 |
+
have h₁ := mul_le_mul_of_nonneg_right hTτ (Nat.cast_nonneg N)
|
| 401 |
+
have h₂ := mul_le_mul_of_nonneg_left hlength (Nat.cast_nonneg T)
|
| 402 |
+
nlinarith only [h₁, h₂]
|
| 403 |
+
let z' : ℕ → ℤ := fun j => if j = d + 1 then (b : ℤ) * m else
|
| 404 |
+
(q : ℤ) * z j - if j = 1 then (b : ℤ) * l else 0
|
| 405 |
+
refine ⟨q * b, by positivity, (Nat.mul_le_mul hqA hbA').trans hCB, z', ?_⟩
|
| 406 |
+
intro j hj hjd
|
| 407 |
+
have hN₀ : 0 < (N : ℝ) := Nat.cast_pos.mpr hN
|
| 408 |
+
have hM₀ : 0 < (M : ℝ) := Nat.cast_pos.mpr hM
|
| 409 |
+
have hq₀ : 0 < (q : ℝ) := Nat.cast_pos.mpr hq
|
| 410 |
+
have hb₀ : 0 < (b : ℝ) := Nat.cast_pos.mpr hb
|
| 411 |
+
have hCB' : (C : ℝ) ≤ B := by exact_mod_cast hCB
|
| 412 |
+
by_cases hjtop : j = d + 1
|
| 413 |
+
· subst j
|
| 414 |
+
have he : ((q * b : ℕ) : ℝ) * p.coeff (d + 1) - (z' (d + 1) : ℝ) =
|
| 415 |
+
(b : ℝ) * ((q : ℝ) * p.coeff (d + 1) - m) := by
|
| 416 |
+
simp only [z', ite_eq_left rfl, Int.cast_mul, Int.cast_natCast, Nat.cast_mul]
|
| 417 |
+
ring
|
| 418 |
+
rw [he, abs_mul, abs_of_pos hb₀]
|
| 419 |
+
calc
|
| 420 |
+
_ ≤ (b : ℝ) * ((A : ℝ) / (N : ℝ) ^ (d + 1)) :=
|
| 421 |
+
mul_le_mul_of_nonneg_left hm hb₀.le
|
| 422 |
+
_ ≤ (C : ℝ) / (N : ℝ) ^ (d + 1) := by
|
| 423 |
+
rw [← mul_div_assoc]
|
| 424 |
+
apply div_le_div_of_nonneg_right _ (by positivity)
|
| 425 |
+
have h := mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hbA' : (b : ℝ) ≤ A')
|
| 426 |
+
(Nat.cast_nonneg A)
|
| 427 |
+
simp only [C, Nat.cast_mul]
|
| 428 |
+
nlinarith only [h]
|
| 429 |
+
_ ≤ _ := div_le_div_of_nonneg_right hCB' (by positivity)
|
| 430 |
+
· have hjd' : j ≤ d := by omega
|
| 431 |
+
have he : ((q * b : ℕ) : ℝ) * p.coeff j - (z' j : ℝ) =
|
| 432 |
+
(q : ℝ) * ((b : ℝ) * (lowerWithFrequency p d l q).coeff j - z j) := by
|
| 433 |
+
rw [lowerWithFrequency_coeff p d l q j hjd']
|
| 434 |
+
by_cases hjone : j = 1
|
| 435 |
+
· simp only [z', ite_eq_right hjtop, ite_eq_left hjone, Int.cast_sub, Int.cast_mul,
|
| 436 |
+
Int.cast_natCast, Nat.cast_mul]
|
| 437 |
+
field_simp
|
| 438 |
+
ring
|
| 439 |
+
· simp only [z', ite_eq_right hjtop, ite_eq_right hjone, Int.cast_mul,
|
| 440 |
+
Int.cast_natCast, Nat.cast_mul, sub_zero, add_zero]
|
| 441 |
+
ring
|
| 442 |
+
rw [he, abs_mul, abs_of_pos hq₀]
|
| 443 |
+
calc
|
| 444 |
+
_ ≤ (q : ℝ) * ((A' : ℝ) / (M : ℝ) ^ j) :=
|
| 445 |
+
mul_le_mul_of_nonneg_left (hz j hj hjd') hq₀.le
|
| 446 |
+
_ ≤ (C : ℝ) / (M : ℝ) ^ j := by
|
| 447 |
+
rw [← mul_div_assoc]
|
| 448 |
+
apply div_le_div_of_nonneg_right _ (by positivity)
|
| 449 |
+
have h := mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hqA : (q : ℝ) ≤ A)
|
| 450 |
+
(Nat.cast_nonneg A')
|
| 451 |
+
simpa only [C, Nat.cast_mul] using h
|
| 452 |
+
_ ≤ (C : ℝ) * (T : ℝ) ^ d / (N : ℝ) ^ j :=
|
| 453 |
+
prefix_error_transfer N M T d j hN hM hTnat hjd' hNM C (Nat.cast_nonneg _)
|
| 454 |
+
_ ≤ _ := by
|
| 455 |
+
apply div_le_div_of_nonneg_right _ (by positivity)
|
| 456 |
+
exact_mod_cast hCTB
|
| 457 |
+
|
| 458 |
+
|
| 459 |
+
|
| 460 |
+
theorem coefficient_inverse (d : ℕ) : CoefficientInverse d := by
|
| 461 |
+
induction d with
|
| 462 |
+
| zero => exact coefficient_inverse_zero
|
| 463 |
+
| succ d ih =>
|
| 464 |
+
by_cases hd : d = 0
|
| 465 |
+
· subst d
|
| 466 |
+
exact coefficient_inverse_one
|
| 467 |
+
· exact coefficient_inverse_succ d (Nat.pos_of_ne_zero hd) ih
|
| 468 |
+
|
| 469 |
+
end
|
| 470 |
+
end WeylCoefficients
|
| 471 |
+
|
| 472 |
+
end
|
| 473 |
+
end
|
| 474 |
+
end
|
| 475 |
+
end
|
| 476 |
+
|
| 477 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialLine01.lean
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.SquareInduction14
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 13 |
+
open scoped BigOperators
|
| 14 |
+
end
|
| 15 |
+
end
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
section
|
| 20 |
+
noncomputable section
|
| 21 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 22 |
+
open scoped BigOperators
|
| 23 |
+
namespace SquareInduction
|
| 24 |
+
open CubeFaces CubePolynomials LeibmanSquare RationalLattice MalcevCharacters
|
| 25 |
+
open MeasureTheory PolynomialWeyl AbelianMalcevTorus RationalTailCoordinates UnitAddTorus
|
| 26 |
+
variable {G : Type} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 27 |
+
variable {t d : ℕ} (c : RealCoordinates G (t+d)) (hsk : SecondKind c)
|
| 28 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 29 |
+
variable [∀ i, (H.level i).Normal]
|
| 30 |
+
variable (s : ℕ) (hs : H.level (s+1)=⊥)
|
| 31 |
+
variable (q : ℕ→ℕ) (hqbound : ∀ k, q k ≤ t+d) (hq2 : q 2=t)
|
| 32 |
+
variable (hq : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin (t+d), i.val<q k → c.coord g i=0)
|
| 33 |
+
variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
|
| 34 |
+
variable [MeasurableSpace (G⧸Γ)] [hBorel : @BorelSpace (G⧸Γ) (QuotientGroup.instTopologicalSpace Γ) inferInstance]
|
| 35 |
+
variable [mtr : MetricSpace (G⧸Γ)]
|
| 36 |
+
variable (htop : mtr.toUniformSpace.toTopologicalSpace=QuotientGroup.instTopologicalSpace Γ)
|
| 37 |
+
|
| 38 |
+
local instance polynomialLine01BinomialTopology : TopologicalSpace (G⧸Γ) :=
|
| 39 |
+
mtr.toUniformSpace.toTopologicalSpace
|
| 40 |
+
|
| 41 |
+
include hsk h0 h1 hs hqbound hq hΓ htop in
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
theorem degree_general_leibman_binomial
|
| 45 |
+
(μ : Measure (G⧸Γ)) [IsProbabilityMeasure μ] [SMulInvariantMeasure G (G⧸Γ) μ]
|
| 46 |
+
(δ : ℝ) (hδ : 0<δ) :
|
| 47 |
+
letI : CompactSpace (G⧸Γ) := metric_compact c Γ hΓ mtr htop
|
| 48 |
+
letI : BorelSpace (G⧸Γ) := metric_borelSpace Γ mtr htop
|
| 49 |
+
∃ U : Finset (G→*Multiplicative ℝ), ∃ A : ℝ, 0<A ∧
|
| 50 |
+
∀ N : ℕ, 0<N → ∀ f : ℤ→G, LeibmanSquare.Polynomial H 0 f →
|
| 51 |
+
(∃ F : C(G⧸Γ,ℂ), LipschitzWith 1 F ∧ ‖F‖≤1 ∧
|
| 52 |
+
δ ≤ ‖FourierObstruction.discrepancy μ N (fun k => QuotientGroup.mk (f k)) F‖) →
|
| 53 |
+
∃ ξ∈U, ξ≠1 ∧ Continuous ξ ∧ (∀ g∈Γ, ∃ z : ℤ, (ξ g).toAdd=z) ∧
|
| 54 |
+
∃ b : Fin (t+d)→ℤ, b≠0 ∧ (∀ i, |(b i:ℝ)|≤A) ∧ (∀ a b : G, ξ (a*b*a⁻¹*b⁻¹)=1) ∧
|
| 55 |
+
(∀ g : G, (ξ g).toAdd=∑ i, c.coord g i*(b i:ℝ)) ∧
|
| 56 |
+
∃ α : ℕ→ℝ, (∀ j : ℕ, s<j → α j=0) ∧
|
| 57 |
+
(∀ z : ℤ, (ξ (f z)).toAdd=∑ j : Fin (s+1), α j.val*(Ring.choose z j.val:ℤ)) ∧
|
| 58 |
+
∀ j : ℕ, 0<j → (N:ℝ)^j*‖(α j : UnitAddCircle)‖≤A := by
|
| 59 |
+
classical
|
| 60 |
+
let : CompactSpace (G⧸Γ) := metric_compact c Γ hΓ mtr htop
|
| 61 |
+
let : BorelSpace (G⧸Γ) := metric_borelSpace Γ mtr htop
|
| 62 |
+
obtain ⟨U,C,hC,hprod⟩ := degree_general_metric_producer c hsk H h0 h1 s hs
|
| 63 |
+
q hqbound hq Γ hΓ htop μ δ hδ
|
| 64 |
+
let S : ℝ := ∑ ξ∈U, ∑ i, |(ξ (axis c i 1)).toAdd|
|
| 65 |
+
have hS : 0≤S := Finset.sum_nonneg (fun ξ _ => Finset.sum_nonneg (fun i _ => abs_nonneg _))
|
| 66 |
+
let A : ℝ := 1+S+BinomialDifference.conversionBound s*C
|
| 67 |
+
have hconv : 0<BinomialDifference.conversionBound s*C :=
|
| 68 |
+
mul_pos (BinomialDifference.conversionBound_pos s) hC
|
| 69 |
+
have hA : 0<A := by dsimp [A]; linarith
|
| 70 |
+
refine ⟨U,A,hA,?_⟩
|
| 71 |
+
intro N hN f hf hdisc
|
| 72 |
+
obtain ⟨ξ,hξ,hξ0,hξc,hξΓ,P,hP,hPe,hPc⟩ := hprod N hN f hf hdisc
|
| 73 |
+
obtain ⟨b,hb⟩ := integer_character_coordinates c hsk ξ Γ hΓ hξc hξΓ
|
| 74 |
+
have hbi (i : Fin (t+d)) : (b i:ℝ)=(ξ (axis c i 1)).toAdd := by
|
| 75 |
+
rw [hb]
|
| 76 |
+
simp [coord_axis,Pi.single_apply]
|
| 77 |
+
refine ⟨ξ,hξ,hξ0,hξc,hξΓ,b,?_,?_,?_,hb,
|
| 78 |
+
fun j => BinomialDifference.coefficient ℝ j P,?_,?_,?_⟩
|
| 79 |
+
· intro hb0
|
| 80 |
+
apply hξ0
|
| 81 |
+
ext g
|
| 82 |
+
apply Multiplicative.toAdd.injective
|
| 83 |
+
change (ξ g).toAdd=0
|
| 84 |
+
rw [hb,hb0]
|
| 85 |
+
simp
|
| 86 |
+
· intro i
|
| 87 |
+
have h1 : |(ξ (axis c i 1)).toAdd| ≤ ∑ j, |(ξ (axis c j 1)).toAdd| :=
|
| 88 |
+
Finset.single_le_sum (f := fun j : Fin (t+d) => |(ξ (axis c j 1)).toAdd|) (fun j _ => abs_nonneg _) (Finset.mem_univ i)
|
| 89 |
+
have h2 : (∑ j, |(ξ (axis c j 1)).toAdd|)≤S :=
|
| 90 |
+
Finset.single_le_sum (f := fun χ : G→*Multiplicative ℝ => ∑ j, |(χ (axis c j 1)).toAdd|) (fun χ _ => Finset.sum_nonneg (fun j _ => abs_nonneg _)) hξ
|
| 91 |
+
rw [hbi]
|
| 92 |
+
dsimp [A]
|
| 93 |
+
linarith
|
| 94 |
+
· intro a b
|
| 95 |
+
apply Multiplicative.toAdd.injective
|
| 96 |
+
simp only [map_mul,map_inv,toAdd_mul,toAdd_inv]
|
| 97 |
+
change (ξ a).toAdd+(ξ b).toAdd+(-(ξ a).toAdd)+(-(ξ b).toAdd)=0
|
| 98 |
+
ring
|
| 99 |
+
· intro j hj
|
| 100 |
+
exact BinomialDifference.coefficient_eq_zero ℝ j P (hP.trans_lt hj)
|
| 101 |
+
· exact character_binomial_expansion H s hs hf ξ P hPe
|
| 102 |
+
· intro j hj
|
| 103 |
+
have hNr : 1≤(N:ℝ) := by exact_mod_cast hN
|
| 104 |
+
have hbnd := BinomialDifference.coefficient_bound s 1 P hP (N:ℝ) C hNr hC.le
|
| 105 |
+
(fun i hi => hPc i hi) j hj
|
| 106 |
+
apply hbnd.trans
|
| 107 |
+
dsimp [A]
|
| 108 |
+
linarith
|
| 109 |
+
|
| 110 |
+
end SquareInduction
|
| 111 |
+
end
|
| 112 |
+
end
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
section
|
| 117 |
+
|
| 118 |
+
namespace IntegerGridInterpolation
|
| 119 |
+
open scoped BigOperators
|
| 120 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 121 |
+
noncomputable section
|
| 122 |
+
|
| 123 |
+
abbrev Grid (n d : ℕ) := Fin n → Fin (d + 1)
|
| 124 |
+
|
| 125 |
+
def weight (d : ℕ) (j t : Fin (d + 1)) : ℚ :=
|
| 126 |
+
(Lagrange.basis Finset.univ (fun t : Fin (d + 1) => (t.val : ℚ)) t).coeff j.val
|
| 127 |
+
|
| 128 |
+
theorem one_dimensional (d : ℕ) (j k : Fin (d + 1)) :
|
| 129 |
+
∑ t : Fin (d + 1), weight d j t * (t.val : ℚ) ^ k.val =
|
| 130 |
+
if j = k then 1 else 0 := by
|
| 131 |
+
classical
|
| 132 |
+
have hinj : Set.InjOn (fun t : Fin (d + 1) => (t.val : ℚ))
|
| 133 |
+
(↑(Finset.univ : Finset (Fin (d + 1))) : Set (Fin (d + 1))) := by
|
| 134 |
+
intro a _ b _ hab
|
| 135 |
+
apply Fin.ext
|
| 136 |
+
exact_mod_cast (show (a.val : ℚ) = b.val from hab)
|
| 137 |
+
have hp : (X ^ k.val : ℚ[X]).degree < (Finset.univ : Finset (Fin (d + 1))).card := by
|
| 138 |
+
simp only [degree_X_pow, Finset.card_univ, Fintype.card_fin, Nat.cast_lt]
|
| 139 |
+
exact_mod_cast k.isLt
|
| 140 |
+
have h := congrArg (fun p : ℚ[X] => p.coeff j.val)
|
| 141 |
+
(Lagrange.eq_interpolate (v := fun t : Fin (d + 1) => (t.val : ℚ))
|
| 142 |
+
hinj hp : (X ^ k.val : ℚ[X]) = _)
|
| 143 |
+
simp only [Lagrange.interpolate_apply, finsetSum_coeff, eval_pow, eval_X,
|
| 144 |
+
coeff_C_mul, coeff_X_pow] at h
|
| 145 |
+
simpa only [weight, mul_comm, Fin.ext_iff] using h.symm
|
| 146 |
+
|
| 147 |
+
def tensorWeight (n d : ℕ) (e v : Grid n d) : ℚ := ∏ i, weight d (e i) (v i)
|
| 148 |
+
|
| 149 |
+
theorem tensor_orthogonality (n d : ℕ) (e f : Grid n d) :
|
| 150 |
+
∑ v : Grid n d, tensorWeight n d e v * (∏ i, ((v i).val : ℚ) ^ (f i).val) =
|
| 151 |
+
if e = f then 1 else 0 := by
|
| 152 |
+
classical
|
| 153 |
+
simp only [tensorWeight, ← Finset.prod_mul_distrib]
|
| 154 |
+
rw [← Fintype.prod_sum (fun i (t : Fin (d + 1)) => weight d (e i) t * (t.val : ℚ) ^ (f i).val)]
|
| 155 |
+
simp_rw [one_dimensional]
|
| 156 |
+
by_cases h : e = f
|
| 157 |
+
· subst f; simp
|
| 158 |
+
· rw [ite_eq_right h]
|
| 159 |
+
obtain ⟨i, hi⟩ := Function.ne_iff.mp h
|
| 160 |
+
exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi)
|
| 161 |
+
|
| 162 |
+
theorem reconstruction (n d : ℕ) (a : Grid n d → ℚ) (e : Grid n d) :
|
| 163 |
+
∑ v : Grid n d, tensorWeight n d e v *
|
| 164 |
+
(∑ f : Grid n d, a f * ∏ i, ((v i).val : ℚ) ^ (f i).val) = a e := by
|
| 165 |
+
classical
|
| 166 |
+
simp_rw [Finset.mul_sum]
|
| 167 |
+
rw [Finset.sum_comm]
|
| 168 |
+
simp_rw [mul_left_comm (tensorWeight n d e _) (a _)]
|
| 169 |
+
simp_rw [← Finset.mul_sum]
|
| 170 |
+
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
|
| 171 |
+
simp_rw [tensor_orthogonality]
|
| 172 |
+
simp
|
| 173 |
+
|
| 174 |
+
theorem clear_denominators {ι : Type*} [Fintype ι] (f : ι → ℚ) :
|
| 175 |
+
∃ (B : ℕ), 0 < B ∧ ∃ w : ι → ℤ, ∀ i, (B : ℚ) * f i = w i := by
|
| 176 |
+
classical
|
| 177 |
+
let B := ∏ i, (f i).den
|
| 178 |
+
have hB : 0 < B := Finset.prod_pos (fun i _ => (f i).den_pos)
|
| 179 |
+
refine ⟨B, hB, (fun i => (B / (f i).den : ℕ) * (f i).num), ?_⟩
|
| 180 |
+
intro i
|
| 181 |
+
have hd : (f i).den ∣ B := Finset.dvd_prod_of_mem (fun i => (f i).den) (Finset.mem_univ i)
|
| 182 |
+
have he : (B : ℚ) = ((B / (f i).den : ℕ) : ℚ) * (f i).den := by
|
| 183 |
+
exact_mod_cast (Nat.div_mul_cancel hd).symm
|
| 184 |
+
have hq : ((f i).den : ℚ) * f i = (f i).num := by
|
| 185 |
+
rw [mul_comm]
|
| 186 |
+
exact (eq_div_iff (by exact_mod_cast (f i).den_ne_zero)).mp (f i).num_div_den.symm
|
| 187 |
+
rw [he, mul_assoc, hq]
|
| 188 |
+
push_cast
|
| 189 |
+
rfl
|
| 190 |
+
|
| 191 |
+
theorem exists_integer_weights (n d : ℕ) :
|
| 192 |
+
∃ B : ℕ, 0 < B ∧ ∃ w : Grid n d → Grid n d → ℤ,
|
| 193 |
+
∀ e f : Grid n d,
|
| 194 |
+
∑ v : Grid n d, (w e v : ℝ) * ∏ i, ((v i).val : ℝ) ^ (f i).val =
|
| 195 |
+
if e = f then (B : ℝ) else 0 := by
|
| 196 |
+
classical
|
| 197 |
+
obtain ⟨B, hB, w, hw⟩ := clear_denominators
|
| 198 |
+
(fun p : Grid n d × Grid n d => tensorWeight n d p.1 p.2)
|
| 199 |
+
refine ⟨B, hB, (fun e v => w (e, v)), ?_⟩
|
| 200 |
+
intro e f
|
| 201 |
+
have hh : ∀ v, (w (e,v) : ℝ) = (B : ℝ) * (tensorWeight n d e v : ℝ) := by
|
| 202 |
+
intro v
|
| 203 |
+
exact_mod_cast (hw (e,v)).symm
|
| 204 |
+
simp_rw [hh, mul_assoc]
|
| 205 |
+
rw [← Finset.mul_sum]
|
| 206 |
+
have hid : (∑ v : Grid n d, (tensorWeight n d e v : ℝ) *
|
| 207 |
+
∏ i, ((v i).val : ℝ) ^ (f i).val) = if e = f then 1 else 0 := by
|
| 208 |
+
have h := congrArg (fun q : ℚ => (q : ℝ)) (tensor_orthogonality n d e f)
|
| 209 |
+
push_cast at h
|
| 210 |
+
split_ifs at h ⊢ <;> simpa only [Rat.cast_one, Rat.cast_zero] using h
|
| 211 |
+
rw [hid]
|
| 212 |
+
split_ifs <;> simp
|
| 213 |
+
|
| 214 |
+
theorem real_reconstruction {n d B : ℕ} (w : Grid n d → Grid n d → ℤ)
|
| 215 |
+
(hw : ∀ e f : Grid n d,
|
| 216 |
+
∑ v : Grid n d, (w e v : ℝ) * ∏ i, ((v i).val : ℝ) ^ (f i).val =
|
| 217 |
+
if e = f then (B : ℝ) else 0)
|
| 218 |
+
(a : Grid n d → ℝ) (e : Grid n d) :
|
| 219 |
+
∑ v : Grid n d, (w e v : ℝ) *
|
| 220 |
+
(∑ f : Grid n d, a f * ∏ i, ((v i).val : ℝ) ^ (f i).val) = B * a e := by
|
| 221 |
+
classical
|
| 222 |
+
simp_rw [Finset.mul_sum]
|
| 223 |
+
rw [Finset.sum_comm]
|
| 224 |
+
simp_rw [mul_left_comm (w e _ : ℝ) (a _)]
|
| 225 |
+
simp_rw [← Finset.mul_sum, hw]
|
| 226 |
+
simp [mul_comm]
|
| 227 |
+
|
| 228 |
+
end
|
| 229 |
+
end IntegerGridInterpolation
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
namespace PolynomialLineCoefficients
|
| 233 |
+
open scoped BigOperators
|
| 234 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 235 |
+
noncomputable section
|
| 236 |
+
|
| 237 |
+
abbrev Grid (n d : ℕ) := Fin n → Fin (d + 1)
|
| 238 |
+
def totalDegree {n d : ℕ} (e : Grid n d) : ℕ := ∑ i, (e i).val
|
| 239 |
+
|
| 240 |
+
def natLine {n d : ℕ} (e : Grid n d) (x v : Fin n → ℕ) : ℕ[X] :=
|
| 241 |
+
∏ i, (C (x i) + C (v i) * X) ^ (e i).val
|
| 242 |
+
|
| 243 |
+
theorem linear_degree (x v : ℕ) : (C x + C v * X : ℕ[X]).natDegree ≤ 1 := by
|
| 244 |
+
apply natDegree_add_le_of_degree_le
|
| 245 |
+
· simp
|
| 246 |
+
· exact (natDegree_C_mul_le _ _).trans natDegree_X_le
|
| 247 |
+
|
| 248 |
+
theorem prod_degree {ι : Type*} [DecidableEq ι] (s : Finset ι)
|
| 249 |
+
(f : ι → ℕ[X]) (d : ι → ℕ) (hd : ∀ i ∈ s, (f i).natDegree ≤ d i) :
|
| 250 |
+
(∏ i ∈ s, f i).natDegree ≤ ∑ i ∈ s, d i :=
|
| 251 |
+
(natDegree_prod_le s f).trans (Finset.sum_le_sum hd)
|
| 252 |
+
|
| 253 |
+
theorem prod_top_coeff {ι : Type*} [DecidableEq ι] (s : Finset ι)
|
| 254 |
+
(f : ι → ℕ[X]) (d : ι → ℕ) (hd : ∀ i ∈ s, (f i).natDegree ≤ d i) :
|
| 255 |
+
(∏ i ∈ s, f i).coeff (∑ i ∈ s, d i) = ∏ i ∈ s, (f i).coeff (d i) := by
|
| 256 |
+
induction s using Finset.induction_on with
|
| 257 |
+
| empty => simp
|
| 258 |
+
| @insert i s hi ih =>
|
| 259 |
+
rw [Finset.prod_insert hi, Finset.sum_insert hi, Finset.prod_insert hi]
|
| 260 |
+
rw [coeff_mul_add_eq_of_natDegree_le (hd i (Finset.mem_insert_self _ _))
|
| 261 |
+
(prod_degree s f d (fun j hj => hd j (Finset.mem_insert_of_mem hj)))]
|
| 262 |
+
rw [ih (fun j hj => hd j (Finset.mem_insert_of_mem hj))]
|
| 263 |
+
|
| 264 |
+
theorem natLine_degree {n d : ℕ} (e : Grid n d) (x v : Fin n → ℕ) :
|
| 265 |
+
(natLine e x v).natDegree ≤ totalDegree e := by
|
| 266 |
+
apply prod_degree
|
| 267 |
+
intro i _
|
| 268 |
+
simpa using natDegree_pow_le_of_le (e i).val (linear_degree (x i) (v i))
|
| 269 |
+
|
| 270 |
+
theorem natLine_coeff_zero {n d j : ℕ} (e : Grid n d) (x v : Fin n → ℕ)
|
| 271 |
+
(hj : totalDegree e < j) : (natLine e x v).coeff j = 0 :=
|
| 272 |
+
coeff_eq_zero_of_natDegree_lt ((natLine_degree e x v).trans_lt hj)
|
| 273 |
+
|
| 274 |
+
theorem natLine_top_coeff {n d : ℕ} (e : Grid n d) (x v : Fin n → ℕ) :
|
| 275 |
+
(natLine e x v).coeff (totalDegree e) = ∏ i, v i ^ (e i).val := by
|
| 276 |
+
rw [natLine, totalDegree, prod_top_coeff]
|
| 277 |
+
· apply Finset.prod_congr rfl
|
| 278 |
+
intro i _
|
| 279 |
+
have hh := coeff_pow_of_natDegree_le (m := (e i).val) (linear_degree (x i) (v i))
|
| 280 |
+
simpa using hh
|
| 281 |
+
· intro i _
|
| 282 |
+
simpa using natDegree_pow_le_of_le (e i).val (linear_degree (x i) (v i))
|
| 283 |
+
|
| 284 |
+
theorem coeff_times_pow_le_eval (p : ℕ[X]) (j N : ℕ) :
|
| 285 |
+
p.coeff j * N ^ j ≤ p.eval N := by
|
| 286 |
+
classical
|
| 287 |
+
rw [eval_eq_sum, Polynomial.sum]
|
| 288 |
+
by_cases hj : j ∈ p.support
|
| 289 |
+
· exact Finset.single_le_sum (f := fun i => p.coeff i * N ^ i) (fun i _ => Nat.zero_le _) hj
|
| 290 |
+
· have hh : p.coeff j = 0 := notMem_support_iff.mp hj
|
| 291 |
+
simp [hh]
|
| 292 |
+
|
| 293 |
+
theorem totalDegree_le {n d : ℕ} (e : Grid n d) : totalDegree e ≤ n * d := by
|
| 294 |
+
calc
|
| 295 |
+
_ ≤ ∑ _i : Fin n, d := Finset.sum_le_sum (fun i _ => Nat.le_of_lt_succ (e i).isLt)
|
| 296 |
+
_ = _ := by simp
|
| 297 |
+
|
| 298 |
+
theorem natLine_eval_bound {n d N : ℕ} (e : Grid n d) (x v : Fin n → ℕ)
|
| 299 |
+
(hx : ∀ i, x i ≤ N) (hv : ∀ i, v i ≤ d) :
|
| 300 |
+
(natLine e x v).eval N ≤ ((d + 1) * N) ^ totalDegree e := by
|
| 301 |
+
simp only [natLine, eval_prod, eval_pow, eval_add, eval_C, eval_mul, eval_X]
|
| 302 |
+
rw [totalDegree, ← Finset.prod_pow_eq_pow_sum]
|
| 303 |
+
apply Finset.prod_le_prod₀ (fun i _ => Nat.zero_le _)
|
| 304 |
+
intro i _
|
| 305 |
+
apply Nat.pow_le_pow_left
|
| 306 |
+
nlinarith [hx i, hv i]
|
| 307 |
+
|
| 308 |
+
theorem natLine_coeff_bound {n d N j : ℕ} (hN : 0 < N) (e : Grid n d)
|
| 309 |
+
(x v : Fin n → ℕ) (hx : ∀ i, x i ≤ N) (hv : ∀ i, v i ≤ d)
|
| 310 |
+
(hj : j ≤ totalDegree e) :
|
| 311 |
+
((natLine e x v).coeff j : ℝ) ≤ (d + 1 : ℝ) ^ (n * d) * (N : ℝ) ^ (totalDegree e - j) := by
|
| 312 |
+
have h := (coeff_times_pow_le_eval (natLine e x v) j N).trans (natLine_eval_bound e x v hx hv)
|
| 313 |
+
have h' : ((natLine e x v).coeff j : ℝ) * (N : ℝ) ^ j ≤
|
| 314 |
+
((d + 1 : ℝ) * N) ^ totalDegree e := by exact_mod_cast h
|
| 315 |
+
have hp : 0 < (N : ℝ) ^ j := pow_pos (Nat.cast_pos.mpr hN) _
|
| 316 |
+
apply (mul_le_mul_iff_left₀ hp).mp
|
| 317 |
+
have he : (N : ℝ) ^ (totalDegree e - j) * N ^ j = N ^ totalDegree e := by
|
| 318 |
+
rw [← pow_add, Nat.sub_add_cancel hj]
|
| 319 |
+
calc
|
| 320 |
+
_ ≤ ((d + 1 : ℝ) * N) ^ totalDegree e := h'
|
| 321 |
+
_ ≤ (d + 1 : ℝ) ^ (n * d) * (N : ℝ) ^ totalDegree e := by
|
| 322 |
+
rw [mul_pow]
|
| 323 |
+
exact mul_le_mul_of_nonneg_right
|
| 324 |
+
(pow_le_pow_right₀ (by have := Nat.cast_nonneg (α := ℝ) d; linarith : (1 : ℝ) ≤ d + 1) (totalDegree_le e))
|
| 325 |
+
(pow_nonneg (Nat.cast_nonneg N) _)
|
| 326 |
+
_ = _ := by rw [mul_assoc, he]
|
| 327 |
+
|
| 328 |
+
def line {n d : ℕ} (a : Grid n d → ℝ) (x v : Fin n → ℕ) : ℝ[X] :=
|
| 329 |
+
∑ e : Grid n d, C (a e) * (natLine e x v).map (Nat.castRingHom ℝ)
|
| 330 |
+
|
| 331 |
+
theorem line_coeff {n d : ℕ} (a : Grid n d → ℝ) (x v : Fin n → ℕ) (j : ℕ) :
|
| 332 |
+
(line a x v).coeff j = ∑ e : Grid n d, a e * ((natLine e x v).coeff j : ℝ) := by
|
| 333 |
+
simp [line, finsetSum_coeff]
|
| 334 |
+
|
| 335 |
+
theorem line_eval {n d : ℕ} (a : Grid n d → ℝ) (x v : Fin n → ℕ) (t : ℕ) :
|
| 336 |
+
(line a x v).eval (t : ℝ) =
|
| 337 |
+
∑ e : Grid n d, a e * ∏ i, ((x i + t * v i : ℕ) : ℝ) ^ (e i).val := by
|
| 338 |
+
simp only [line, eval_finsetSum, eval_mul, eval_C, eval_map, eval₂_at_natCast,
|
| 339 |
+
natLine, eval_prod, eval_pow, eval_add, eval_C, eval_mul, eval_X]
|
| 340 |
+
push_cast
|
| 341 |
+
simp only [mul_comm (v _ : ℝ) (t : ℝ)]
|
| 342 |
+
|
| 343 |
+
theorem line_degree {n d : ℕ} (a : Grid n d → ℝ) (x v : Fin n → ℕ) :
|
| 344 |
+
(line a x v).natDegree ≤ n * d := by
|
| 345 |
+
apply natDegree_sum_le_of_forall_le
|
| 346 |
+
intro e _
|
| 347 |
+
exact (natDegree_C_mul_le _ _).trans
|
| 348 |
+
(natDegree_map_le.trans ((natLine_degree e x v).trans (totalDegree_le e)))
|
| 349 |
+
|
| 350 |
+
end
|
| 351 |
+
end PolynomialLineCoefficients
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
end
|
| 356 |
+
end
|
| 357 |
+
end
|
| 358 |
+
end
|
| 359 |
+
|
| 360 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/PolynomialWeyl01.lean
ADDED
|
@@ -0,0 +1,618 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.RationalFactor01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
end
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
section
|
| 16 |
+
open scoped BigOperators
|
| 17 |
+
noncomputable section
|
| 18 |
+
namespace RationalFactorPeriods
|
| 19 |
+
open CubeFaces CubePolynomials
|
| 20 |
+
variable {G : Type*} [Group G]
|
| 21 |
+
|
| 22 |
+
lemma orderedWord_mem {H : Filtration G} {k l : ℕ} (a : Fin l → G) (j : Fin l → ℕ)
|
| 23 |
+
(ha : ∀ i, a i ∈ H.level (j i+k)) : orderedWord a j ∈ polynomials H k := by
|
| 24 |
+
have hs : ((List.finRange l).map (fun i => (fun n : ℤ => a i ^ Ring.choose n (j i)))).prod
|
| 25 |
+
∈ polynomials H k := by
|
| 26 |
+
apply Subgroup.list_prod_mem
|
| 27 |
+
intro f hf
|
| 28 |
+
obtain ⟨i,_,rfl⟩ := List.mem_map.mp hf
|
| 29 |
+
exact NilpotentTaylor.binomial_mem (j i) k (a i) (ha i)
|
| 30 |
+
convert hs using 1
|
| 31 |
+
funext n
|
| 32 |
+
simp [orderedWord,Pi.list_prod_apply,List.map_map,Function.comp_def]
|
| 33 |
+
|
| 34 |
+
lemma orderedWord_character (χ : G →* Multiplicative ℝ) {l : ℕ}
|
| 35 |
+
(a : Fin l → G) (j : Fin l → ℕ) (n : ℤ) :
|
| 36 |
+
(χ (orderedWord a j n)).toAdd = ∑ i, ((Ring.choose n (j i) : ℤ) : ℝ) * (χ (a i)).toAdd := by
|
| 37 |
+
rw [orderedWord_map]
|
| 38 |
+
simp only [orderedWord,toAdd_list_sum,List.map_map,Function.comp_def,toAdd_zpow,zsmul_eq_mul]
|
| 39 |
+
exact (Fin.sum_univ_def (fun i : Fin l => ((Ring.choose n (j i) : ℤ) : ℝ) * (χ (a i)).toAdd)).symm
|
| 40 |
+
|
| 41 |
+
lemma List.prod_finRange_castSucc {d : ℕ} (f : Fin (d+1) → G) :
|
| 42 |
+
((List.finRange (d+1)).map f).prod =
|
| 43 |
+
((List.finRange d).map (fun i => f i.castSucc)).prod * f (Fin.last d) := by
|
| 44 |
+
rw [List.finRange_succ_last,List.map_append,List.prod_append]
|
| 45 |
+
simp [List.map_map,Function.comp_def]
|
| 46 |
+
|
| 47 |
+
lemma word_eq_orderedWord (a : ℕ → G) (d : ℕ) :
|
| 48 |
+
NilpotentTaylor.word a d = orderedWord (fun i : Fin d => a i.val) (fun i => i.val) := by
|
| 49 |
+
induction d with
|
| 50 |
+
| zero => funext n; simp [NilpotentTaylor.word,orderedWord]
|
| 51 |
+
| succ d ih =>
|
| 52 |
+
funext n
|
| 53 |
+
simp only [NilpotentTaylor.word,Pi.mul_apply,ih,orderedWord,List.prod_finRange_castSucc]
|
| 54 |
+
rfl
|
| 55 |
+
|
| 56 |
+
end RationalFactorPeriods
|
| 57 |
+
end
|
| 58 |
+
end
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
section
|
| 63 |
+
open scoped BigOperators
|
| 64 |
+
noncomputable section
|
| 65 |
+
namespace NilpotentTaylor
|
| 66 |
+
open CubeFaces CubePolynomials RationalFactorPeriods
|
| 67 |
+
variable {G : Type*} [Group G]
|
| 68 |
+
|
| 69 |
+
lemma word_zero (a : ℕ → G) (d : ℕ) : word a (d+1) 0 = a 0 := by
|
| 70 |
+
induction d with
|
| 71 |
+
| zero => simp [word]
|
| 72 |
+
| succ d ih => simpa [word,Ring.choose_zero_succ] using ih
|
| 73 |
+
|
| 74 |
+
lemma choose_one_high {d : ℕ} (hd : 2 ≤ d) : Ring.choose (1:ℤ) d = 0 := by
|
| 75 |
+
rw [← Int.natCast_one,Ring.choose_natCast,Nat.choose_eq_zero_of_lt (by omega : 1 < d),Nat.cast_zero]
|
| 76 |
+
|
| 77 |
+
lemma word_one (a : ℕ → G) (d : ℕ) : word a (d+2) 1 = a 0 * a 1 := by
|
| 78 |
+
induction d with
|
| 79 |
+
| zero => simp [word]
|
| 80 |
+
| succ d ih =>
|
| 81 |
+
change word a (d+2) 1 * a (d+2) ^ Ring.choose (1:ℤ) (d+2) = _
|
| 82 |
+
rw [choose_one_high (by omega),zpow_zero,mul_one,ih]
|
| 83 |
+
|
| 84 |
+
lemma word_tail_two (a : ℕ → G) (d : ℕ) (h0 : a 0=1) (h1 : a 1=1) :
|
| 85 |
+
word a (d+2) = orderedWord (fun i : Fin d => a (i.val+2)) (fun i => i.val+2) := by
|
| 86 |
+
induction d with
|
| 87 |
+
| zero => funext n; simp [word,orderedWord,h0,h1]
|
| 88 |
+
| succ d ih =>
|
| 89 |
+
funext n
|
| 90 |
+
change word a (d+2) n * a (d+2) ^ Ring.choose n (d+2) = _
|
| 91 |
+
rw [ih]
|
| 92 |
+
simp only [orderedWord,RationalFactorPeriods.List.prod_finRange_castSucc]
|
| 93 |
+
rfl
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
theorem normalized_taylor (H : Filtration G) (s : ℕ) (hbot : H.level s = ⊥)
|
| 98 |
+
(g : ℤ → G) (hg : g ∈ polynomials H 0) (h0 : g 0=1) (h1 : g 1=1) :
|
| 99 |
+
∃ a : Fin s → G, (∀ i, a i ∈ H.level (i.val+2)) ∧
|
| 100 |
+
g = orderedWord a (fun i => i.val+2) := by
|
| 101 |
+
have hb : H.level ((s+2)+0) = ⊥ := by
|
| 102 |
+
apply le_bot_iff.mp
|
| 103 |
+
simpa [hbot] using H.antitone (show s ≤ (s+2)+0 by omega)
|
| 104 |
+
obtain ⟨a,ha,he⟩ := exists_taylor hb hg
|
| 105 |
+
have ha0 : a 0=1 := by
|
| 106 |
+
have hx := congrFun he 0
|
| 107 |
+
rw [h0,show s+2=(s+1)+1 by omega,word_zero] at hx
|
| 108 |
+
exact hx.symm
|
| 109 |
+
have ha1 : a 1=1 := by
|
| 110 |
+
have hx := congrFun he 1
|
| 111 |
+
rw [h1,word_one,ha0,one_mul] at hx
|
| 112 |
+
exact hx.symm
|
| 113 |
+
refine ⟨fun i => a (i.val+2),fun i => ?_,?_⟩
|
| 114 |
+
· simpa using ha (i.val+2) (by omega)
|
| 115 |
+
· exact he.trans (word_tail_two a s ha0 ha1)
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
theorem normalized_subgroup_taylor (H : Filtration G) (s : ℕ) (hbot : H.level s = ⊥)
|
| 120 |
+
(g : ℤ → G) (hg : g ∈ polynomials H 0) (h0 : g 0=1)
|
| 121 |
+
(h1 : g 1 ∈ H.level 1) :
|
| 122 |
+
∃ a : Fin s → H.level 2,
|
| 123 |
+
(∀ i, (a i).val ∈ H.level (i.val+2)) ∧
|
| 124 |
+
∀ z, g z = (orderedWord a (fun i => i.val+2) z).val * g 1 ^ z := by
|
| 125 |
+
let lin : ℤ → G := fun z => g 1 ^ z
|
| 126 |
+
have hlin : lin ∈ polynomials H 0 := by
|
| 127 |
+
simpa [lin] using binomial_mem (H:=H) 1 0 (g 1) h1
|
| 128 |
+
let f : ℤ → G := g * lin⁻¹
|
| 129 |
+
have hf : f ∈ polynomials H 0 := (polynomials H 0).mul_mem hg ((polynomials H 0).inv_mem hlin)
|
| 130 |
+
have hf0 : f 0=1 := by simp [f,lin,h0]
|
| 131 |
+
have hf1 : f 1=1 := by simp [f,lin]
|
| 132 |
+
obtain ⟨a,ha,he⟩ := normalized_taylor H s hbot f hf hf0 hf1
|
| 133 |
+
let a' : Fin s → H.level 2 := fun i => ⟨a i,H.antitone (by omega : 2 ≤ i.val+2) (ha i)⟩
|
| 134 |
+
refine ⟨a',ha,fun z => ?_⟩
|
| 135 |
+
have hz := congrFun he z
|
| 136 |
+
change g z * (g 1 ^ z)⁻¹ = orderedWord a (fun i => i.val+2) z at hz
|
| 137 |
+
have hm := orderedWord_map (H.level 2).subtype a' (fun i => i.val+2) z
|
| 138 |
+
change ((orderedWord a' (fun i => i.val+2) z : H.level 2):G) = orderedWord a _ z at hm
|
| 139 |
+
rw [hm,←hz]
|
| 140 |
+
group
|
| 141 |
+
|
| 142 |
+
end NilpotentTaylor
|
| 143 |
+
end
|
| 144 |
+
end
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
section
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
namespace PolynomialWeyl
|
| 153 |
+
open scoped BigOperators ComplexConjugate
|
| 154 |
+
noncomputable section
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
def mean (N : ℕ) (f : ℕ → ℂ) : ℂ := 𝔼 x ∈ Finset.range N, f x
|
| 158 |
+
|
| 159 |
+
def derivative (a b : ℕ) (f : ℕ → ℂ) (x : ℕ) : ℂ :=
|
| 160 |
+
f (x + a) * conj (f (x + b))
|
| 161 |
+
|
| 162 |
+
theorem norm_mean_le_one {N : ℕ} (f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) :
|
| 163 |
+
‖mean N f‖ ≤ 1 := by
|
| 164 |
+
by_cases hN : N = 0
|
| 165 |
+
· simp [mean, hN]
|
| 166 |
+
· exact (RCLike.norm_expect_le (K := ℂ)).trans
|
| 167 |
+
(Finset.expect_le (Finset.nonempty_range_iff.mpr hN)
|
| 168 |
+
(fun x _ => hf x))
|
| 169 |
+
|
| 170 |
+
theorem norm_derivative_le_one (a b : ℕ) (f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) :
|
| 171 |
+
∀ x, ‖derivative a b f x‖ ≤ 1 := by
|
| 172 |
+
intro x
|
| 173 |
+
simp only [derivative, norm_mul, RCLike.norm_conj]
|
| 174 |
+
calc
|
| 175 |
+
_ ≤ 1 * 1 := mul_le_mul (hf (x + a)) (hf (x + b)) (norm_nonneg _) (by norm_num)
|
| 176 |
+
_ = 1 := by norm_num
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
theorem norm_mean_shift_sub_le {N : ℕ} (hN : 0 < N) (h : ℕ) (f : ℕ → ℂ)
|
| 180 |
+
(hf : ∀ x, ‖f x‖ ≤ 1) :
|
| 181 |
+
‖mean N (fun x => f (x + h)) - mean N f‖ ≤ 2 * (h : ℝ) / N := by
|
| 182 |
+
have hs : (∑ x ∈ Finset.range N, f (x + h)) - (∑ x ∈ Finset.range N, f x) =
|
| 183 |
+
(∑ x ∈ Finset.range h, f (x + N)) - (∑ x ∈ Finset.range h, f x) := by
|
| 184 |
+
have h₁ := Finset.sum_range_add f N h
|
| 185 |
+
have h₂ := Finset.sum_range_add f h N
|
| 186 |
+
rw [Nat.add_comm h N] at h₂
|
| 187 |
+
have e₁ : (∑ x ∈ Finset.range h, f (N + x)) = ∑ x ∈ Finset.range h, f (x + N) := by
|
| 188 |
+
apply Finset.sum_congr rfl
|
| 189 |
+
intro x _
|
| 190 |
+
rw [Nat.add_comm N x]
|
| 191 |
+
have e₂ : (∑ x ∈ Finset.range N, f (h + x)) = ∑ x ∈ Finset.range N, f (x + h) := by
|
| 192 |
+
apply Finset.sum_congr rfl
|
| 193 |
+
intro x _
|
| 194 |
+
rw [Nat.add_comm h x]
|
| 195 |
+
rw [e₁] at h₁
|
| 196 |
+
rw [e₂] at h₂
|
| 197 |
+
linear_combination h₁ - h₂
|
| 198 |
+
have hb (k : ℕ) : ‖∑ x ∈ Finset.range h, f (x + k)‖ ≤ (h : ℝ) := by
|
| 199 |
+
calc
|
| 200 |
+
_ ≤ ∑ x ∈ Finset.range h, ‖f (x + k)‖ := norm_sum_le _ _
|
| 201 |
+
_ ≤ ∑ x ∈ Finset.range h, (1 : ℝ) := Finset.sum_le_sum (fun x _ => hf (x + k))
|
| 202 |
+
_ = _ := by simp
|
| 203 |
+
have hb₀ : ‖∑ x ∈ Finset.range h, f x‖ ≤ (h : ℝ) := by simpa using hb 0
|
| 204 |
+
rw [mean, mean, Finset.expect_eq_sum_div_card, Finset.expect_eq_sum_div_card]
|
| 205 |
+
simp only [Finset.card_range, ← sub_div, hs, norm_div, Complex.norm_natCast]
|
| 206 |
+
apply div_le_div_of_nonneg_right _ (Nat.cast_pos.mpr hN).le
|
| 207 |
+
calc
|
| 208 |
+
_ ≤ ‖∑ x ∈ Finset.range h, f (x + N)‖ + ‖∑ x ∈ Finset.range h, f x‖ := norm_sub_le _ _
|
| 209 |
+
_ ≤ 2 * (h : ℝ) := by linarith [hb N]
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
theorem norm_expect_sq_le {ι : Type*} (s : Finset ι) (f : ι → ℂ) :
|
| 213 |
+
‖𝔼 i ∈ s, f i‖ ^ 2 ≤ 𝔼 i ∈ s, ‖f i‖ ^ 2 := by
|
| 214 |
+
classical
|
| 215 |
+
by_cases hs : s.Nonempty
|
| 216 |
+
· have h₁ := RCLike.norm_expect_le (K := ℂ) (s := s) (f := f)
|
| 217 |
+
have h₂ := Finset.expect_mul_sq_le_sq_mul_sq s (fun i => ‖f i‖) (fun _ => (1 : ℝ))
|
| 218 |
+
simp only [mul_one, one_pow, Finset.expect_const hs] at h₂
|
| 219 |
+
nlinarith [norm_nonneg (𝔼 i ∈ s, f i)]
|
| 220 |
+
· simp [Finset.not_nonempty_iff_eq_empty.mp hs]
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
theorem shift_average_error {N H : ℕ} (hN : 0 < N) (hH : 0 < H)
|
| 224 |
+
(f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) :
|
| 225 |
+
‖(𝔼 x ∈ Finset.range N, 𝔼 h ∈ Finset.range H, f (x + h)) - mean N f‖ ≤
|
| 226 |
+
2 * (H : ℝ) / N := by
|
| 227 |
+
rw [Finset.expect_comm]
|
| 228 |
+
conv_lhs => rhs; rw [← Finset.expect_const (Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hH)) (mean N f)]
|
| 229 |
+
rw [← Finset.expect_sub_distrib]
|
| 230 |
+
apply (RCLike.norm_expect_le (K := ℂ)).trans
|
| 231 |
+
apply Finset.expect_le (Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hH))
|
| 232 |
+
intro h hh
|
| 233 |
+
apply (norm_mean_shift_sub_le hN h f hf).trans
|
| 234 |
+
apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg N)
|
| 235 |
+
have : (h : ℝ) ≤ H := by exact_mod_cast (Finset.mem_range.mp hh).le
|
| 236 |
+
linarith
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
theorem norm_expect_sq_eq {ι : Type*} (s : Finset ι) (f : ι → ℂ) :
|
| 240 |
+
‖𝔼 i ∈ s, f i‖ ^ 2 = (𝔼 a ∈ s, 𝔼 b ∈ s, f a * conj (f b)).re := by
|
| 241 |
+
simp_rw [← Finset.mul_expect, ← map_expect (starRingEnd ℂ)]
|
| 242 |
+
rw [← Finset.expect_mul, Complex.mul_conj]
|
| 243 |
+
rw [Complex.ofReal_re, Complex.normSq_eq_norm_sq]
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
theorem van_der_corput {N H : ℕ} (hN : 0 < N) (hH : 0 < H)
|
| 248 |
+
(f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) :
|
| 249 |
+
‖mean N f‖ ^ 2 ≤
|
| 250 |
+
(𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H, ‖mean N (derivative a b f)‖) +
|
| 251 |
+
4 * (H : ℝ) / N := by
|
| 252 |
+
let z := 𝔼 x ∈ Finset.range N, 𝔼 h ∈ Finset.range H, f (x + h)
|
| 253 |
+
have hz : ‖z‖ ≤ 1 := by
|
| 254 |
+
apply (RCLike.norm_expect_le (K := ℂ)).trans
|
| 255 |
+
apply Finset.expect_le (Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hN))
|
| 256 |
+
intro x _
|
| 257 |
+
apply (RCLike.norm_expect_le (K := ℂ)).trans
|
| 258 |
+
exact Finset.expect_le (Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hH)) (fun h _ => hf (x + h))
|
| 259 |
+
have hm := norm_mean_le_one f hf (N := N)
|
| 260 |
+
have he := shift_average_error hN hH f hf
|
| 261 |
+
have ht : ‖mean N f‖ - ‖z‖ ≤ 2 * (H : ℝ) / N := by
|
| 262 |
+
have ht := norm_sub_norm_le (mean N f) z
|
| 263 |
+
rw [norm_sub_rev] at ht
|
| 264 |
+
exact ht.trans he
|
| 265 |
+
have hs : ‖mean N f‖ ^ 2 ≤ ‖z‖ ^ 2 + 4 * (H : ℝ) / N := by
|
| 266 |
+
have he₀ : 0 ≤ 2 * (H : ℝ) / N := by positivity
|
| 267 |
+
have he₁ := mul_le_mul_of_nonneg_right ht (show 0 ≤ ‖mean N f‖ + ‖z‖ by positivity)
|
| 268 |
+
have he₂ := mul_le_mul_of_nonneg_left (show ‖mean N f‖ + ‖z‖ ≤ 2 by linarith) he₀
|
| 269 |
+
have hr : 2 * (H : ℝ) / N * 2 = 4 * H / N := by ring
|
| 270 |
+
rw [hr] at he₂
|
| 271 |
+
nlinarith
|
| 272 |
+
apply hs.trans
|
| 273 |
+
apply add_le_add _ le_rfl
|
| 274 |
+
calc
|
| 275 |
+
‖z‖ ^ 2 ≤ 𝔼 x ∈ Finset.range N, ‖𝔼 h ∈ Finset.range H, f (x + h)‖ ^ 2 :=
|
| 276 |
+
norm_expect_sq_le _ _
|
| 277 |
+
_ = (𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H,
|
| 278 |
+
mean N (derivative a b f)).re := by
|
| 279 |
+
simp only [norm_expect_sq_eq, ← Complex.re_expect]
|
| 280 |
+
congr 1
|
| 281 |
+
rw [Finset.expect_comm]
|
| 282 |
+
apply Finset.expect_congr rfl
|
| 283 |
+
intro a _
|
| 284 |
+
rw [Finset.expect_comm]
|
| 285 |
+
rfl
|
| 286 |
+
_ ≤ _ := by
|
| 287 |
+
rw [Complex.re_expect]
|
| 288 |
+
apply Finset.expect_le_expect
|
| 289 |
+
intro a _
|
| 290 |
+
rw [Complex.re_expect]
|
| 291 |
+
exact Finset.expect_le_expect (fun b _ => Complex.re_le_norm _)
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
theorem pow_le_pow_add_error {x y e : ℝ} (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1)
|
| 295 |
+
(hy₀ : 0 ≤ y) (hy₁ : y ≤ 1) (he : 0 ≤ e) (hxy : x ≤ y + e) (n : ℕ) :
|
| 296 |
+
x ^ n ≤ y ^ n + n * e := by
|
| 297 |
+
induction n with
|
| 298 |
+
| zero => simp
|
| 299 |
+
| succ n ih =>
|
| 300 |
+
have hy := pow_le_one₀ hy₀ hy₁ (n := n)
|
| 301 |
+
have hp := pow_nonneg hy₀ n
|
| 302 |
+
have hn : 0 ≤ (n : ℝ) * e := mul_nonneg (Nat.cast_nonneg _) he
|
| 303 |
+
have h₁ := mul_le_mul_of_nonneg_right ih hx₀
|
| 304 |
+
have h₂ := mul_le_mul_of_nonneg_left hxy hp
|
| 305 |
+
have h₃ := mul_le_mul_of_nonneg_right hy he
|
| 306 |
+
have h₄ := mul_le_mul_of_nonneg_left hx₁ hn
|
| 307 |
+
rw [pow_succ, pow_succ, Nat.cast_add, Nat.cast_one]
|
| 308 |
+
nlinarith
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
theorem expect_pow_two_pow_le {ι : Type*} (s : Finset ι) (hs : s.Nonempty)
|
| 312 |
+
(f : ι → ℝ) (k : ℕ) :
|
| 313 |
+
(𝔼 i ∈ s, f i) ^ (2 ^ k) ≤ 𝔼 i ∈ s, (f i) ^ (2 ^ k) := by
|
| 314 |
+
induction k generalizing f with
|
| 315 |
+
| zero => simp
|
| 316 |
+
| succ k ih =>
|
| 317 |
+
have hcs := Finset.expect_mul_sq_le_sq_mul_sq s f (fun _ => (1 : ℝ))
|
| 318 |
+
simp only [mul_one, one_pow, Finset.expect_const hs] at hcs
|
| 319 |
+
calc
|
| 320 |
+
_ = ((𝔼 i ∈ s, f i) ^ 2) ^ (2 ^ k) := by rw [← pow_mul]; congr 1; omega
|
| 321 |
+
_ ≤ (𝔼 i ∈ s, (f i) ^ 2) ^ (2 ^ k) := pow_le_pow_left₀ (sq_nonneg _) hcs _
|
| 322 |
+
_ ≤ 𝔼 i ∈ s, ((f i) ^ 2) ^ (2 ^ k) := ih _
|
| 323 |
+
_ = _ := by
|
| 324 |
+
apply Finset.expect_congr rfl
|
| 325 |
+
intro i _
|
| 326 |
+
rw [← pow_mul]
|
| 327 |
+
congr 1
|
| 328 |
+
omega
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
def differencedMean (N H : ℕ) : ℕ → (ℕ → ℂ) → ℝ
|
| 333 |
+
| 0, f => ‖mean N f‖
|
| 334 |
+
| k + 1, f => 𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H,
|
| 335 |
+
differencedMean N H k (derivative a b f)
|
| 336 |
+
|
| 337 |
+
theorem differencedMean_nonneg (N H k : ℕ) (f : ℕ → ℂ) :
|
| 338 |
+
0 ≤ differencedMean N H k f := by
|
| 339 |
+
induction k generalizing f with
|
| 340 |
+
| zero => exact norm_nonneg _
|
| 341 |
+
| succ k ih =>
|
| 342 |
+
exact Finset.expect_nonneg (fun a _ => Finset.expect_nonneg (fun b _ => ih _))
|
| 343 |
+
|
| 344 |
+
theorem differencedMean_le_one (N H k : ℕ) (f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) :
|
| 345 |
+
differencedMean N H k f ≤ 1 := by
|
| 346 |
+
induction k generalizing f with
|
| 347 |
+
| zero => exact norm_mean_le_one f hf
|
| 348 |
+
| succ k ih =>
|
| 349 |
+
by_cases hH : H = 0
|
| 350 |
+
· simp [differencedMean, hH]
|
| 351 |
+
· exact Finset.expect_le (Finset.nonempty_range_iff.mpr hH) (fun a _ =>
|
| 352 |
+
Finset.expect_le (Finset.nonempty_range_iff.mpr hH) (fun b _ =>
|
| 353 |
+
ih _ (norm_derivative_le_one a b f hf)))
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
theorem iterated_van_der_corput {N H : ℕ} (hN : 0 < N) (hH : 0 < H)
|
| 358 |
+
(k : ℕ) (f : ℕ → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) :
|
| 359 |
+
‖mean N f‖ ^ (2 ^ k) ≤
|
| 360 |
+
differencedMean N H k f + ((2 : ℝ) ^ k - 1) * (4 * H / N) := by
|
| 361 |
+
induction k generalizing f with
|
| 362 |
+
| zero => simp [differencedMean]
|
| 363 |
+
| succ k ih =>
|
| 364 |
+
let u (a b : ℕ) := ‖mean N (derivative a b f)‖
|
| 365 |
+
let v := 𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H, u a b
|
| 366 |
+
have hs := Finset.nonempty_range_iff.mpr (Nat.ne_of_gt hH)
|
| 367 |
+
have hv₀ : 0 ≤ v := Finset.expect_nonneg (fun a _ =>
|
| 368 |
+
Finset.expect_nonneg (fun b _ => norm_nonneg _))
|
| 369 |
+
have hv₁ : v ≤ 1 := Finset.expect_le hs (fun a _ => Finset.expect_le hs
|
| 370 |
+
(fun b _ => norm_mean_le_one _ (norm_derivative_le_one a b f hf)))
|
| 371 |
+
have hf₁ := norm_mean_le_one f hf (N := N)
|
| 372 |
+
have hf₀ := norm_nonneg (mean N f)
|
| 373 |
+
have hn : (‖mean N f‖ ^ 2) ≤ 1 := by nlinarith
|
| 374 |
+
have he : 0 ≤ 4 * (H : ℝ) / N := by positivity
|
| 375 |
+
have hpow := pow_le_pow_add_error (sq_nonneg _) hn hv₀ hv₁ he
|
| 376 |
+
(van_der_corput hN hH f hf) (2 ^ k)
|
| 377 |
+
calc
|
| 378 |
+
_ = (‖mean N f‖ ^ 2) ^ (2 ^ k) := by rw [← pow_mul]; congr 1; omega
|
| 379 |
+
_ ≤ v ^ (2 ^ k) + (2 ^ k : ℕ) * (4 * (H : ℝ) / N) := hpow
|
| 380 |
+
_ ≤ (𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H, (u a b) ^ (2 ^ k)) +
|
| 381 |
+
(2 ^ k : ℕ) * (4 * (H : ℝ) / N) := by
|
| 382 |
+
apply add_le_add _ le_rfl
|
| 383 |
+
exact (expect_pow_two_pow_le _ hs _ k).trans
|
| 384 |
+
(Finset.expect_le_expect (fun a _ => expect_pow_two_pow_le _ hs _ k))
|
| 385 |
+
_ ≤ (𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H,
|
| 386 |
+
(differencedMean N H k (derivative a b f) +
|
| 387 |
+
((2 : ℝ) ^ k - 1) * (4 * H / N))) +
|
| 388 |
+
(2 ^ k : ℕ) * (4 * (H : ℝ) / N) := by
|
| 389 |
+
apply add_le_add _ le_rfl
|
| 390 |
+
exact Finset.expect_le_expect (fun a _ => Finset.expect_le_expect (fun b _ =>
|
| 391 |
+
ih _ (norm_derivative_le_one a b f hf)))
|
| 392 |
+
_ = _ := by
|
| 393 |
+
simp only [Finset.expect_add_distrib, Finset.expect_const hs,
|
| 394 |
+
differencedMean, Nat.cast_pow, Nat.cast_ofNat, pow_succ]
|
| 395 |
+
ring
|
| 396 |
+
|
| 397 |
+
|
| 398 |
+
def phase (t : ℝ) : ℂ := Complex.exp ((2 * Real.pi * t : ℝ) * Complex.I)
|
| 399 |
+
|
| 400 |
+
@[simp] theorem norm_phase (t : ℝ) : ‖phase t‖ = 1 :=
|
| 401 |
+
Complex.norm_exp_ofReal_mul_I _
|
| 402 |
+
|
| 403 |
+
@[simp] theorem phase_add (x y : ℝ) : phase (x + y) = phase x * phase y := by
|
| 404 |
+
simp only [phase, mul_add, Complex.ofReal_add, Complex.exp_add, add_mul]
|
| 405 |
+
|
| 406 |
+
@[simp] theorem phase_neg (x : ℝ) : phase (-x) = conj (phase x) := by
|
| 407 |
+
rw [phase, phase, ← Complex.exp_conj]
|
| 408 |
+
congr 1
|
| 409 |
+
simp only [map_mul, Complex.conj_ofReal, Complex.conj_I, mul_neg, Complex.ofReal_neg]
|
| 410 |
+
ring
|
| 411 |
+
|
| 412 |
+
@[simp] theorem phase_sub (x y : ℝ) : phase (x - y) = phase x * conj (phase y) := by
|
| 413 |
+
rw [sub_eq_add_neg, phase_add, phase_neg]
|
| 414 |
+
|
| 415 |
+
@[simp] theorem phase_nat_mul (x : ℝ) (n : ℕ) : phase ((n : ℝ) * x) = (phase x) ^ n := by
|
| 416 |
+
rw [phase, phase, ← Complex.exp_nat_mul]
|
| 417 |
+
congr 1
|
| 418 |
+
push_cast
|
| 419 |
+
ring
|
| 420 |
+
|
| 421 |
+
|
| 422 |
+
def polynomialPhase (p : Polynomial ℝ) (x : ℕ) : ℂ := phase (p.eval (x : ℝ))
|
| 423 |
+
|
| 424 |
+
|
| 425 |
+
def polynomialDifference (a b : ℕ) (p : Polynomial ℝ) : Polynomial ℝ :=
|
| 426 |
+
Polynomial.taylor (a : ℝ) p - Polynomial.taylor (b : ℝ) p
|
| 427 |
+
|
| 428 |
+
@[simp] theorem polynomialPhase_difference (a b : ℕ) (p : Polynomial ℝ) :
|
| 429 |
+
polynomialPhase (polynomialDifference a b p) = derivative a b (polynomialPhase p) := by
|
| 430 |
+
funext x
|
| 431 |
+
simp [polynomialPhase, polynomialDifference, derivative, Polynomial.taylor_eval,
|
| 432 |
+
Nat.cast_add]
|
| 433 |
+
|
| 434 |
+
|
| 435 |
+
theorem taylor_coeff_top (p : Polynomial ℝ) (d : ℕ) (hp : p.natDegree ≤ d) (a : ℝ) :
|
| 436 |
+
(Polynomial.taylor a p).coeff d = p.coeff d := by
|
| 437 |
+
by_cases hd : p.natDegree = d
|
| 438 |
+
· subst d
|
| 439 |
+
exact Polynomial.coeff_taylor_natDegree a p
|
| 440 |
+
· have hl : p.natDegree < d := lt_of_le_of_ne hp hd
|
| 441 |
+
rw [Polynomial.coeff_eq_zero_of_natDegree_lt hl,
|
| 442 |
+
Polynomial.coeff_eq_zero_of_natDegree_lt]
|
| 443 |
+
rwa [Polynomial.natDegree_taylor]
|
| 444 |
+
|
| 445 |
+
|
| 446 |
+
|
| 447 |
+
theorem polynomialDifference_degree (a b : ℕ) (p : Polynomial ℝ) (d : ℕ)
|
| 448 |
+
(hp : p.natDegree ≤ d + 1) :
|
| 449 |
+
(polynomialDifference a b p).natDegree ≤ d := by
|
| 450 |
+
rw [Polynomial.natDegree_le_iff_coeff_eq_zero]
|
| 451 |
+
intro n hn
|
| 452 |
+
simp only [polynomialDifference, Polynomial.coeff_sub]
|
| 453 |
+
by_cases he : n = d + 1
|
| 454 |
+
· subst n
|
| 455 |
+
rw [taylor_coeff_top p _ hp, taylor_coeff_top p _ hp, sub_self]
|
| 456 |
+
· have hlt : p.natDegree < n := by omega
|
| 457 |
+
have h₁ : (Polynomial.taylor (a : ℝ) p).natDegree < n := by
|
| 458 |
+
rwa [Polynomial.natDegree_taylor]
|
| 459 |
+
have h₂ : (Polynomial.taylor (b : ℝ) p).natDegree < n := by
|
| 460 |
+
rwa [Polynomial.natDegree_taylor]
|
| 461 |
+
rw [Polynomial.coeff_eq_zero_of_natDegree_lt h₁,
|
| 462 |
+
Polynomial.coeff_eq_zero_of_natDegree_lt h₂, sub_self]
|
| 463 |
+
|
| 464 |
+
|
| 465 |
+
theorem taylor_coeff_below_top (p : Polynomial ℝ) (d : ℕ) (hp : p.natDegree ≤ d + 1) (a : ℝ) :
|
| 466 |
+
(Polynomial.taylor a p).coeff d = p.coeff d + (d + 1 : ℕ) * p.coeff (d + 1) * a := by
|
| 467 |
+
rw [Polynomial.taylor_coeff]
|
| 468 |
+
have hdeg : ((Polynomial.hasseDeriv d) p).natDegree < 2 := by
|
| 469 |
+
have h := Polynomial.natDegree_hasseDeriv_le p d
|
| 470 |
+
omega
|
| 471 |
+
rw [Polynomial.eval_eq_sum_range' hdeg]
|
| 472 |
+
simp only [Finset.sum_range_succ, Finset.sum_range_zero, zero_add,
|
| 473 |
+
Polynomial.hasseDeriv_coeff, Nat.choose_self, Nat.cast_one,
|
| 474 |
+
one_mul, pow_zero, mul_one, pow_one]
|
| 475 |
+
rw [Nat.add_comm 1 d, Nat.choose_succ_self_right]
|
| 476 |
+
|
| 477 |
+
|
| 478 |
+
theorem polynomialDifference_coeff (a b : ℕ) (p : Polynomial ℝ) (d : ℕ)
|
| 479 |
+
(hp : p.natDegree ≤ d + 1) :
|
| 480 |
+
(polynomialDifference a b p).coeff d =
|
| 481 |
+
(d + 1 : ℕ) * p.coeff (d + 1) * ((a : ℝ) - b) := by
|
| 482 |
+
simp only [polynomialDifference, Polynomial.coeff_sub, taylor_coeff_below_top p d hp]
|
| 483 |
+
ring
|
| 484 |
+
|
| 485 |
+
|
| 486 |
+
def linearBound (N : ℕ) (α : ℝ) : ℝ :=
|
| 487 |
+
if phase α = 1 then 1 else min 1 (2 / ((N : ℝ) * ‖phase α - 1‖))
|
| 488 |
+
|
| 489 |
+
theorem norm_linear_mean_le {N : ℕ} (hN : 0 < N) (α β : ℝ) :
|
| 490 |
+
‖mean N (fun x => phase (α * x + β))‖ ≤ linearBound N α := by
|
| 491 |
+
have hunit : ∀ x : ℕ, ‖phase (α * x + β)‖ ≤ 1 := by simp
|
| 492 |
+
have h₁ := norm_mean_le_one _ hunit (N := N)
|
| 493 |
+
unfold linearBound
|
| 494 |
+
split_ifs with hα
|
| 495 |
+
· exact h₁
|
| 496 |
+
· apply le_min h₁
|
| 497 |
+
have heq : mean N (fun x => phase (α * x + β)) =
|
| 498 |
+
phase β * (∑ x ∈ Finset.range N, (phase α) ^ x) / (N : ℂ) := by
|
| 499 |
+
simp only [mean, Finset.expect_eq_sum_div_card, Finset.card_range]
|
| 500 |
+
congr 1
|
| 501 |
+
rw [Finset.mul_sum]
|
| 502 |
+
apply Finset.sum_congr rfl
|
| 503 |
+
intro x _
|
| 504 |
+
rw [phase_add, mul_comm α, phase_nat_mul, mul_comm]
|
| 505 |
+
rw [heq, norm_div, norm_mul, norm_phase, one_mul, Complex.norm_natCast,
|
| 506 |
+
geom_sum_eq hα, norm_div]
|
| 507 |
+
have hb : ‖(phase α) ^ N - 1‖ ≤ 2 := by
|
| 508 |
+
calc
|
| 509 |
+
_ ≤ ‖(phase α) ^ N‖ + ‖(1 : ℂ)‖ := norm_sub_le _ _
|
| 510 |
+
_ = 2 := by simp only [norm_pow, norm_phase, one_pow, norm_one]; norm_num
|
| 511 |
+
calc
|
| 512 |
+
_ ≤ (2 / ‖phase α - 1‖) / N :=
|
| 513 |
+
div_le_div_of_nonneg_right (div_le_div_of_nonneg_right hb (norm_nonneg _))
|
| 514 |
+
(Nat.cast_pos.mpr hN).le
|
| 515 |
+
_ = _ := by ring
|
| 516 |
+
|
| 517 |
+
|
| 518 |
+
|
| 519 |
+
def weylBound (N H : ℕ) : ℕ → ℝ → ℝ
|
| 520 |
+
| 0, α => linearBound N α
|
| 521 |
+
| d + 1, α => 𝔼 a ∈ Finset.range H, 𝔼 b ∈ Finset.range H,
|
| 522 |
+
weylBound N H d ((d + 2 : ℕ) * α * ((a : ℝ) - b))
|
| 523 |
+
|
| 524 |
+
theorem differencedMean_polynomial_le {N : ℕ} (hN : 0 < N) (H d : ℕ)
|
| 525 |
+
(p : Polynomial ℝ) (hp : p.natDegree ≤ d + 1) :
|
| 526 |
+
differencedMean N H d (polynomialPhase p) ≤ weylBound N H d (p.coeff (d + 1)) := by
|
| 527 |
+
induction d generalizing p with
|
| 528 |
+
| zero =>
|
| 529 |
+
have he (x : ℕ) : p.eval (x : ℝ) = p.coeff 1 * x + p.coeff 0 := by
|
| 530 |
+
rw [Polynomial.eval_eq_sum_range' (show p.natDegree < 2 by omega)]
|
| 531 |
+
simp only [Finset.sum_range_succ, Finset.sum_range_zero, zero_add,
|
| 532 |
+
pow_zero, mul_one, pow_one]
|
| 533 |
+
ring
|
| 534 |
+
change ‖mean N (fun x => phase (p.eval (x : ℝ)))‖ ≤ linearBound N (p.coeff 1)
|
| 535 |
+
simp_rw [he]
|
| 536 |
+
exact norm_linear_mean_le hN (p.coeff 1) (p.coeff 0)
|
| 537 |
+
| succ d ih =>
|
| 538 |
+
apply Finset.expect_le_expect
|
| 539 |
+
intro a _
|
| 540 |
+
apply Finset.expect_le_expect
|
| 541 |
+
intro b _
|
| 542 |
+
have h := ih (polynomialDifference a b p) (polynomialDifference_degree a b p (d + 1) hp)
|
| 543 |
+
rwa [polynomialPhase_difference, polynomialDifference_coeff a b p (d + 1) hp] at h
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
|
| 547 |
+
theorem polynomial_weyl_inequality {N H : ℕ} (hN : 0 < N) (hH : 0 < H)
|
| 548 |
+
(d : ℕ) (p : Polynomial ℝ) (hp : p.natDegree ≤ d + 1) :
|
| 549 |
+
‖mean N (polynomialPhase p)‖ ^ (2 ^ d) ≤
|
| 550 |
+
weylBound N H d (p.coeff (d + 1)) + ((2 : ℝ) ^ d - 1) * (4 * H / N) := by
|
| 551 |
+
apply (iterated_van_der_corput hN hH d (polynomialPhase p) (fun x => by simp [polynomialPhase])).trans
|
| 552 |
+
exact add_le_add (differencedMean_polynomial_le hN H d p hp) le_rfl
|
| 553 |
+
|
| 554 |
+
@[simp] theorem phase_int (m : ℤ) : phase (m : ℝ) = 1 := by
|
| 555 |
+
unfold phase
|
| 556 |
+
convert Complex.exp_int_mul_two_pi_mul_I m using 1
|
| 557 |
+
congr 1
|
| 558 |
+
push_cast
|
| 559 |
+
ring
|
| 560 |
+
|
| 561 |
+
|
| 562 |
+
|
| 563 |
+
theorem exists_int_close_of_phase (α : ℝ) :
|
| 564 |
+
∃ m : ℤ, |α - m| ≤ ‖phase α - 1‖ / 4 := by
|
| 565 |
+
let m : ℤ := ⌊α + 1 / 2⌋
|
| 566 |
+
let t : ℝ := α - m
|
| 567 |
+
have ht : |t| ≤ 1 / 2 := by
|
| 568 |
+
apply abs_le.mpr
|
| 569 |
+
have h₁ := Int.floor_le (α + 1 / 2)
|
| 570 |
+
have h₂ := Int.lt_floor_add_one (α + 1 / 2)
|
| 571 |
+
dsimp [t, m]
|
| 572 |
+
constructor <;> linarith
|
| 573 |
+
have he : phase t = phase α := by simp [t]
|
| 574 |
+
have hnorm : ‖phase t - 1‖ = 2 * |Real.sin (Real.pi * t)| := by
|
| 575 |
+
unfold phase
|
| 576 |
+
rw [mul_comm _ Complex.I, Complex.norm_exp_I_mul_ofReal_sub_one]
|
| 577 |
+
have harg : 2 * Real.pi * t / 2 = Real.pi * t := by ring
|
| 578 |
+
rw [harg, Real.norm_eq_abs, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)]
|
| 579 |
+
have hbound : |Real.pi * t| ≤ Real.pi / 2 := by
|
| 580 |
+
rw [abs_mul, abs_of_pos Real.pi_pos]
|
| 581 |
+
nlinarith [Real.pi_pos]
|
| 582 |
+
have hs := Real.mul_abs_le_abs_sin hbound
|
| 583 |
+
rw [abs_mul, abs_of_pos Real.pi_pos] at hs
|
| 584 |
+
have hsim : 2 / Real.pi * (Real.pi * |t|) = 2 * |t| := by field_simp
|
| 585 |
+
rw [hsim] at hs
|
| 586 |
+
refine ⟨m, ?_⟩
|
| 587 |
+
change |t| ≤ _
|
| 588 |
+
rw [← he, hnorm]
|
| 589 |
+
linarith
|
| 590 |
+
|
| 591 |
+
theorem linear_inverse {N : ℕ} (hN : 0 < N) (α β δ : ℝ)
|
| 592 |
+
(hδ : 0 < δ) (hlarge : δ ≤ ‖mean N (fun x => phase (α * x + β))‖) :
|
| 593 |
+
∃ m : ℤ, |α - m| ≤ 1 / (δ * N) := by
|
| 594 |
+
obtain ⟨m, hm⟩ := exists_int_close_of_phase α
|
| 595 |
+
refine ⟨m, hm.trans ?_⟩
|
| 596 |
+
have hNp : 0 < (N : ℝ) := Nat.cast_pos.mpr hN
|
| 597 |
+
by_cases hα : phase α = 1
|
| 598 |
+
· simp only [hα, sub_self, norm_zero, zero_div]
|
| 599 |
+
positivity
|
| 600 |
+
· have hnorm : 0 < ‖phase α - 1‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hα)
|
| 601 |
+
have hl := norm_linear_mean_le hN α β
|
| 602 |
+
simp only [linearBound, ite_eq_right hα] at hl
|
| 603 |
+
have hd : δ ≤ 2 / ((N : ℝ) * ‖phase α - 1‖) := hlarge.trans (hl.trans (min_le_right _ _))
|
| 604 |
+
have hd' := (le_div_iff₀ (mul_pos hNp hnorm)).mp hd
|
| 605 |
+
apply (le_div_iff₀ (mul_pos hδ hNp)).mpr
|
| 606 |
+
nlinarith
|
| 607 |
+
|
| 608 |
+
end
|
| 609 |
+
end PolynomialWeyl
|
| 610 |
+
|
| 611 |
+
|
| 612 |
+
|
| 613 |
+
end
|
| 614 |
+
end
|
| 615 |
+
end
|
| 616 |
+
end
|
| 617 |
+
|
| 618 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure01.lean
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.MicrocellSaturation01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section RawSuccessInlineScope16
|
| 9 |
+
noncomputable section
|
| 10 |
+
open scoped BigOperators
|
| 11 |
+
open Finset MeasureTheory
|
| 12 |
+
end
|
| 13 |
+
end RawSuccessInlineScope16
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
section RawSuccessInlineScope17
|
| 20 |
+
noncomputable section
|
| 21 |
+
open Filter Topology
|
| 22 |
+
namespace MicrocellEarlierScale
|
| 23 |
+
open MicrocellScale AdmissibleMicrocellBoundary
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
theorem radius_dominates_square {M P H:ℕ→ℕ}
|
| 28 |
+
(hM:∀ᶠ n in atTop,0<M n)
|
| 29 |
+
(hd:Dominates (fun n=>(H n:ℝ)) (earlierScale M P)) :
|
| 30 |
+
Dominates (fun n=>(radius (M n) (H n):ℝ)) (fun n=>(M n:ℝ)+(P n:ℝ)^2) := by
|
| 31 |
+
have hm:∀ᶠ n in atTop,0<M n ∧ (M n:ℝ)≤earlierScale M P n := by
|
| 32 |
+
filter_upwards [hM] with n hn
|
| 33 |
+
refine ⟨hn,?_⟩
|
| 34 |
+
unfold earlierScale
|
| 35 |
+
linarith [Nat.cast_nonneg (α:=ℝ) (P n)]
|
| 36 |
+
have hr:=radius_dominates hm (Filter.Eventually.of_forall (scale_one M P)) hd
|
| 37 |
+
intro C hC
|
| 38 |
+
have hh: Tendsto (fun n=>((radius (M n) (H n):ℝ)/(earlierScale M P n)^(2*C))/2^C) atTop atTop :=
|
| 39 |
+
(hr (2*C) (by positivity)).atTop_div_const (Real.rpow_pos_of_pos (by norm_num) C)
|
| 40 |
+
apply tendsto_atTop_mono' atTop _ hh
|
| 41 |
+
filter_upwards [hM] with n hn
|
| 42 |
+
let S:=earlierScale M P n
|
| 43 |
+
let T:ℝ:=(M n:ℝ)+(P n:ℝ)^2
|
| 44 |
+
have hS:1≤S:=scale_one M P n
|
| 45 |
+
have hs:0<S:=by linarith
|
| 46 |
+
have hm0:(0:ℝ)<M n:=by exact_mod_cast hn
|
| 47 |
+
have ht:0<T:=by dsimp [T]; positivity
|
| 48 |
+
have hp:(P n:ℝ)≤S:=by dsimp [S,earlierScale]; linarith [Nat.cast_nonneg (α:=ℝ) (M n)]
|
| 49 |
+
have hm':(M n:ℝ)≤S:=by dsimp [S,earlierScale]; linarith [Nat.cast_nonneg (α:=ℝ) (P n)]
|
| 50 |
+
have hT:T≤2*S^2 := by
|
| 51 |
+
have hp2:(P n:ℝ)^2≤S^2:=pow_le_pow_left₀ (by positivity) hp 2
|
| 52 |
+
dsimp [T]
|
| 53 |
+
nlinarith
|
| 54 |
+
have hpow:T^C≤(2:ℝ)^C*S^(2*C) := by
|
| 55 |
+
calc
|
| 56 |
+
_ ≤ (2*S^2)^C := Real.rpow_le_rpow ht.le hT hC.le
|
| 57 |
+
_ = _ := by
|
| 58 |
+
rw [Real.mul_rpow (by norm_num) (sq_nonneg S),Real.rpow_mul hs.le 2 C,Real.rpow_two]
|
| 59 |
+
change ((radius (M n) (H n):ℝ)/S^(2*C))/2^C ≤ (radius (M n) (H n):ℝ)/T^C
|
| 60 |
+
calc
|
| 61 |
+
_ = (radius (M n) (H n):ℝ)/(2^C*S^(2*C)) := by ring
|
| 62 |
+
_ ≤ _ := div_le_div_of_nonneg_left (by positivity) (Real.rpow_pos_of_pos ht C) hpow
|
| 63 |
+
|
| 64 |
+
lemma length_cast (M H:ℕ) : (length M H:ℝ)=(radius M H:ℝ)/(M:ℝ) := by
|
| 65 |
+
exact Nat.cast_div_charZero (modulus_dvd M H)
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
theorem length_tendsto {M P H:ℕ→ℕ}
|
| 70 |
+
(hM:∀ᶠ n in atTop,0<M n)
|
| 71 |
+
(hd:Dominates (fun n=>(H n:ℝ)) (earlierScale M P)) :
|
| 72 |
+
Tendsto (fun n=>length (M n) (H n)) atTop atTop := by
|
| 73 |
+
have hm:∀ᶠ n in atTop,0<M n ∧ (M n:ℝ)≤earlierScale M P n := by
|
| 74 |
+
filter_upwards [hM] with n hn
|
| 75 |
+
refine ⟨hn,?_⟩
|
| 76 |
+
unfold earlierScale
|
| 77 |
+
linarith [Nat.cast_nonneg (α:=ℝ) (P n)]
|
| 78 |
+
have hr:=radius_dominates hm (Filter.Eventually.of_forall (scale_one M P)) hd 1 (by norm_num)
|
| 79 |
+
have hr':Tendsto (fun n=>(radius (M n) (H n):ℝ)/earlierScale M P n) atTop atTop := by
|
| 80 |
+
simpa only [Real.rpow_one] using hr
|
| 81 |
+
apply (tendsto_natCast_atTop_iff (R:=ℝ)).mp
|
| 82 |
+
apply tendsto_atTop_mono' atTop _ hr'
|
| 83 |
+
filter_upwards [hm] with n hn
|
| 84 |
+
rw [length_cast]
|
| 85 |
+
apply div_le_div_of_nonneg_left (by positivity) (by exact_mod_cast hn.1) hn.2
|
| 86 |
+
|
| 87 |
+
end MicrocellEarlierScale
|
| 88 |
+
end
|
| 89 |
+
end RawSuccessInlineScope17
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
section RawSuccessInlineScope18
|
| 96 |
+
noncomputable section
|
| 97 |
+
open scoped BigOperators
|
| 98 |
+
open Finset MeasureTheory Filter Topology
|
| 99 |
+
namespace AdmissibleRawSuccess
|
| 100 |
+
open MicrocellScale AdmissibleMicrocellBoundary MicrocellSaturation RawHarmonicProbability
|
| 101 |
+
attribute [local instance] Classical.propDecidable
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
theorem eventually_global {J : Type*} [Fintype J]
|
| 106 |
+
{M P H X W : ℕ→ℕ} (c : ℝ) (hc : 0<c)
|
| 107 |
+
(hbase : ∀ᶠ n in atTop,0<W n ∧ 0<M n ∧ W n∣M n ∧ 0<H n ∧ 0<X n)
|
| 108 |
+
(hd : Dominates (fun n=>(H n:ℝ)) (earlierScale M P))
|
| 109 |
+
(hx : Dominates (fun n=>Real.log (X n:ℝ)) (fun n=>(H n:ℝ))) :
|
| 110 |
+
∀ᶠ n in atTop,∃ (hw : 0<W n) (hX : 4*W n≤X n)
|
| 111 |
+
(hN : 0<length (M n) (H n)),∀ (t:J→ℕ) (A:Set ℕ),
|
| 112 |
+
(∀ j,0<t j ∧ t j≤(P n)^2) →
|
| 113 |
+
(∀ i∈(units (X n) (W n)).image (label (radius (M n) (H n)) (M n)),
|
| 114 |
+
good (X n) (radius (M n) (H n)) (H n) t i →
|
| 115 |
+
letI : Nonempty (Fin (length (M n) (H n))) := Fin.pos_iff_nonempty.mp hN
|
| 116 |
+
c/2<(MicrocellProbability.uniformLaw
|
| 117 |
+
(fun b:Fin (length (M n) (H n)) =>
|
| 118 |
+
MicrocellFibers.point (M n) (length (M n) (H n)*i.1) i.2 b):Measure ℕ).real A) →
|
| 119 |
+
c/4 ≤ (law (X n) (W n) hw hX : Measure ℕ).real A := by
|
| 120 |
+
have hbase' : ∀ᶠ n in atTop,0<W n ∧ 0<M n ∧ W n≤M n ∧ 0<H n ∧ 0<X n := by
|
| 121 |
+
filter_upwards [hbase] with n hn
|
| 122 |
+
exact ⟨hn.1,hn.2.1,Nat.le_of_dvd hn.2.1 hn.2.2.1,hn.2.2.2⟩
|
| 123 |
+
have hM := hbase.mono (fun _ hn=>hn.2.1)
|
| 124 |
+
have hH := hbase.mono (fun _ hn=>hn.2.2.2.1)
|
| 125 |
+
obtain ⟨ε,hε,hbd⟩ := uniform_raw_boundary 2 (by decide) hbase' hd hx
|
| 126 |
+
have hfour := radius_four_modulus (P:=P)
|
| 127 |
+
(hbase'.mono (fun _ hn=>⟨hn.2.1,hn.2.2.1⟩)) hd
|
| 128 |
+
have hR := endpoint_rate hM hH (by simpa only [Real.rpow_one] using hx 1 (by norm_num))
|
| 129 |
+
have hL := MicrocellEarlierScale.length_tendsto hM hd
|
| 130 |
+
have herror : Tendsto (fun n=>24*((radius (M n) (H n):ℝ)/X n)+
|
| 131 |
+
(Fintype.card J:ℝ)*ε n) atTop (𝓝 0) := by
|
| 132 |
+
simpa using (hR.const_mul 24).add (hε.const_mul (Fintype.card J:ℝ))
|
| 133 |
+
filter_upwards [hbase,hfour,hbd,hL.eventually_ge_atTop 1,
|
| 134 |
+
hR.eventually_lt_const (show (0:ℝ)<1 by norm_num),
|
| 135 |
+
hR.eventually_le_const (show (0:ℝ)<c/6 by positivity),
|
| 136 |
+
herror.eventually_le_const (show (0:ℝ)<1/4 by norm_num)] with n hn hfour hbd hL hRX hsmall herr
|
| 137 |
+
have hxp : (0:ℝ)<X n := by exact_mod_cast hn.2.2.2.2
|
| 138 |
+
have hRX' : radius (M n) (H n)≤X n := by
|
| 139 |
+
have hh : (radius (M n) (H n):ℝ)<X n := by
|
| 140 |
+
simpa only [one_mul] using (div_lt_iff₀ hxp).mp hRX
|
| 141 |
+
exact_mod_cast hh.le
|
| 142 |
+
have hX : 4*W n≤X n := hfour.trans hRX'
|
| 143 |
+
have hN : 0<length (M n) (H n) := by omega
|
| 144 |
+
have hlen : M n*length (M n) (H n)=radius (M n) (H n) :=
|
| 145 |
+
Nat.mul_div_cancel' (modulus_dvd _ _)
|
| 146 |
+
refine ⟨hn.1,hX,hN,?_⟩
|
| 147 |
+
intro t A ht hs
|
| 148 |
+
have hp := global_success (X n) (W n) (M n) (length (M n) (H n)) (H n)
|
| 149 |
+
hn.1 hX hn.2.1 hN hn.2.2.1 t c (ε n) hc.le A
|
| 150 |
+
(by simpa only [hlen] using hsmall)
|
| 151 |
+
(by simpa only [hlen] using (fun j=>hbd (t j) (ht j).1 (ht j).2))
|
| 152 |
+
(by simpa only [hlen] using hs)
|
| 153 |
+
rw [hlen] at hp
|
| 154 |
+
have hWR : (W n:ℝ)≤radius (M n) (H n) := by
|
| 155 |
+
exact_mod_cast (show W n≤radius (M n) (H n) by omega)
|
| 156 |
+
have hcost : (8*(radius (M n) (H n):ℝ)+16*W n)/X n ≤
|
| 157 |
+
24*((radius (M n) (H n):ℝ)/X n) := by
|
| 158 |
+
rw [←mul_div_assoc]
|
| 159 |
+
apply div_le_div_of_nonneg_right _ hxp.le
|
| 160 |
+
linarith
|
| 161 |
+
have hlo : (3/4:ℝ)≤1-(8*(radius (M n) (H n):ℝ)+16*W n)/X n-
|
| 162 |
+
(Fintype.card J:ℝ)*ε n := by linarith
|
| 163 |
+
have hh := mul_le_mul_of_nonneg_left hlo (show 0≤c/3 by positivity)
|
| 164 |
+
linarith
|
| 165 |
+
|
| 166 |
+
end AdmissibleRawSuccess
|
| 167 |
+
end
|
| 168 |
+
end RawSuccessInlineScope18
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
end
|
| 172 |
+
|
| 173 |
+
section
|
| 174 |
+
noncomputable section
|
| 175 |
+
namespace ProductExposureLaw
|
| 176 |
+
open MeasureTheory Filter Topology
|
| 177 |
+
open scoped BigOperators
|
| 178 |
+
open HarmonicExposure RawHarmonicProbability DyadicHarmonicBoundary
|
| 179 |
+
attribute [local instance] Classical.propDecidable
|
| 180 |
+
|
| 181 |
+
def jointLaw {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W)
|
| 182 |
+
(hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) : Measure ((Fin m→ℕ)×ℕ) :=
|
| 183 |
+
(Measure.pi (fun j=>(law (X j) W hW (hX j):Measure ℕ))).prod
|
| 184 |
+
(law Xp W hW hXp:Measure ℕ)
|
| 185 |
+
|
| 186 |
+
instance jointLaw_probability {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W)
|
| 187 |
+
(hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) :
|
| 188 |
+
IsProbabilityMeasure (jointLaw X Xp W hW hX hXp) := by
|
| 189 |
+
unfold jointLaw
|
| 190 |
+
infer_instance
|
| 191 |
+
|
| 192 |
+
def jointFiber {m : ℕ} (E : Set (Fin m→ℤ)) (X : Fin m→ℕ) (Xp W : ℕ)
|
| 193 |
+
(S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (Q Δ : ℝ) (a M : ℤ) :
|
| 194 |
+
Finset ((Fin m→ℕ)×ℕ) :=
|
| 195 |
+
((rawTailFiber X W S r L).product (Finset.Ico Xp (Xp^2))).filter (fun z=>
|
| 196 |
+
(fun j=>(z.1 j:ℤ))∈E ∧ M∣(z.2:ℤ)-a ∧
|
| 197 |
+
Q≤(∏ j,(z.1 j:ℝ))*(z.2:ℝ) ∧ (∏ j,(z.1 j:ℝ))*(z.2:ℝ)<Q+Δ)
|
| 198 |
+
|
| 199 |
+
lemma law_singleton (X W : ℕ) (hW : 0<W) (hX : 4*W≤X) (p : ℕ) :
|
| 200 |
+
(law X W hW hX:Measure ℕ).real {p} =
|
| 201 |
+
(if p∈RawHarmonicProbability.units X W then (p:ℝ)⁻¹ else 0)/mass X (X^2) W := by
|
| 202 |
+
rw [MicrocellConditional.law_apply_units]
|
| 203 |
+
simp [MicrocellConditional.eventMass]
|
| 204 |
+
|
| 205 |
+
lemma joint_singleton_mem {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ)
|
| 206 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp)
|
| 207 |
+
(S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (t : Fin m→ℕ) (p : ℕ)
|
| 208 |
+
(ht : t∈rawTailFiber X W S r L) (hp : p∈Finset.Ico Xp (Xp^2)) :
|
| 209 |
+
(jointLaw X Xp W hW hX hXp).real {(t,p)} =
|
| 210 |
+
((∏ j,(t j:ℝ)⁻¹)*(if W.Coprime p then (p:ℝ)⁻¹ else 0)) /
|
| 211 |
+
((∏ j,mass (X j) ((X j)^2) W)*mass Xp (Xp^2) W) := by
|
| 212 |
+
have hj (j : Fin m) :
|
| 213 |
+
(law (X j) W hW (hX j):Measure ℕ).real {t j}=(t j:ℝ)⁻¹/mass (X j) ((X j)^2) W := by
|
| 214 |
+
rw [law_singleton,ite_eq_left]
|
| 215 |
+
obtain ⟨hi,hc,hs⟩ := Finset.mem_filter.mp (Fintype.mem_piFinset.mp ht j)
|
| 216 |
+
exact Finset.mem_filter.mpr ⟨hi,hc⟩
|
| 217 |
+
have hpp : (law Xp W hW hXp:Measure ℕ).real {p}=
|
| 218 |
+
(if W.Coprime p then (p:ℝ)⁻¹ else 0)/mass Xp (Xp^2) W := by
|
| 219 |
+
rw [law_singleton]
|
| 220 |
+
simp only [RawHarmonicProbability.units,Finset.mem_filter,hp,true_and]
|
| 221 |
+
have hpi : (Measure.pi (fun j=>(law (X j) W hW (hX j):Measure ℕ))).real {t} =
|
| 222 |
+
∏ j,(law (X j) W hW (hX j):Measure ℕ).real {t j} := by
|
| 223 |
+
simp only [measureReal_def,Measure.pi_singleton,ENNReal.toReal_prod]
|
| 224 |
+
rw [jointLaw,←Set.singleton_prod_singleton,measureReal_prod_prod,hpi,hpp]
|
| 225 |
+
simp_rw [hj]
|
| 226 |
+
rw [Finset.prod_div_distrib]
|
| 227 |
+
ring
|
| 228 |
+
|
| 229 |
+
lemma joint_fiber_mass {m : ℕ} (E : Set (Fin m→ℤ)) (X : Fin m→ℕ) (Xp W : ℕ)
|
| 230 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp)
|
| 231 |
+
(S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (Q Δ : ℝ) (a M : ℤ) :
|
| 232 |
+
(jointLaw X Xp W hW hX hXp).real (jointFiber E X Xp W S r L Q Δ a M : Set _) =
|
| 233 |
+
literalFiberMass E X Xp W S r L Q Δ a M /
|
| 234 |
+
((∏ j,mass (X j) ((X j)^2) W)*mass Xp (Xp^2) W) := by
|
| 235 |
+
rw [←sum_measureReal_singleton]
|
| 236 |
+
unfold jointFiber literalFiberMass pivotFiber
|
| 237 |
+
simp only [Finset.sum_filter,Finset.product_eq_sprod,Finset.sum_product,
|
| 238 |
+
Finset.sum_div,Finset.mul_sum]
|
| 239 |
+
apply Finset.sum_congr rfl
|
| 240 |
+
intro t ht
|
| 241 |
+
by_cases hE : (fun j=>(t j:ℤ))∈E
|
| 242 |
+
· simp only [hE,true_and,ite_true]
|
| 243 |
+
rw [Finset.sum_div]
|
| 244 |
+
apply Finset.sum_congr rfl
|
| 245 |
+
intro p hp
|
| 246 |
+
by_cases hb : M∣(p:ℤ)-a ∧ Q≤(∏ j,(t j:ℝ))*(p:ℝ) ∧
|
| 247 |
+
(∏ j,(t j:ℝ))*(p:ℝ)<Q+Δ
|
| 248 |
+
· simp only [hb]
|
| 249 |
+
exact joint_singleton_mem X Xp W hW hX hXp S r L t p ht hp
|
| 250 |
+
· simp [hb]
|
| 251 |
+
· simp [hE]
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
theorem conditional_exact {m : ℕ} (E : Set (Fin m→ℤ)) (X : Fin m→ℕ) (Xp W : ℕ)
|
| 256 |
+
(hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp)
|
| 257 |
+
(S : Fin m→ℝ) (r : Fin m→ℤ) (L : ℤ) (Q Δ : ℝ) (a M : ℤ) :
|
| 258 |
+
(jointLaw X Xp W hW hX hXp).real (jointFiber E X Xp W S r L Q Δ a M : Set _) /
|
| 259 |
+
(jointLaw X Xp W hW hX hXp).real (jointFiber Set.univ X Xp W S r L Q Δ a M : Set _) =
|
| 260 |
+
literalFiberMass E X Xp W S r L Q Δ a M /
|
| 261 |
+
literalFiberMass Set.univ X Xp W S r L Q Δ a M
|
| 262 |
+
:= by
|
| 263 |
+
rw [joint_fiber_mass,joint_fiber_mass]
|
| 264 |
+
have hN : (∏ j,mass (X j) ((X j)^2) W)*mass Xp (Xp^2) W≠0 := by
|
| 265 |
+
apply mul_ne_zero
|
| 266 |
+
· exact Finset.prod_ne_zero_iff.mpr (fun j _=>(mass_pos (X j) W hW (hX j)).ne')
|
| 267 |
+
· exact (mass_pos Xp W hW hXp).ne'
|
| 268 |
+
exact div_div_div_cancel_right₀ hN _ _
|
| 269 |
+
|
| 270 |
+
end ProductExposureLaw
|
| 271 |
+
|
| 272 |
+
end
|
| 273 |
+
end
|
| 274 |
+
|
| 275 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure02.lean
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
| 10 |
+
end
|
| 11 |
+
|
| 12 |
+
section
|
| 13 |
+
noncomputable section
|
| 14 |
+
namespace RoughFaceShift
|
| 15 |
+
open RationalLattice MalcevCharacters RealPolynomialDegree RoughScales Filter
|
| 16 |
+
open RoughSamplingWeights FinitePieceAverages RoughSourceExceptional RoughProductRemoval
|
| 17 |
+
open scoped BigOperators Topology
|
| 18 |
+
variable {G : Type} [Group G] [TopologicalSpace G] {dim : ℕ}
|
| 19 |
+
variable (Γ : Subgroup G) [MetricSpace (G⧸Γ)]
|
| 20 |
+
variable [IsTopologicalGroup G] (c : RealCoordinates G dim)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
theorem source_raw_joint_face_uniform (hsk : SecondKind c)
|
| 24 |
+
(hΓ : ∀ g : G,g∈Γ ↔ ∀ i,∃ z : ℤ,c.coord g i=z)
|
| 25 |
+
(htop : (inferInstance : MetricSpace (G⧸Γ)).toUniformSpace.toTopologicalSpace =
|
| 26 |
+
QuotientGroup.instTopologicalSpace Γ)
|
| 27 |
+
(m v D d : ℕ) (hd : 0<d) (c₀ C₀ : ℝ) (B K : NNReal) (η : ℝ)
|
| 28 |
+
(hc₀ : 0<c₀) (hC₀ : 0<C₀) (hB : 0<B) (hη : 0<η)
|
| 29 |
+
(w M : ℕ→ℕ) (U V : ℕ → Fin m → ℝ) (Z0 H : ℕ→ℝ) (L : ℕ→ℤ)
|
| 30 |
+
(hw : Tendsto w atTop atTop) (hU : ∀ j,Tendsto (fun n=>U n j) atTop atTop)
|
| 31 |
+
(hUV : ∀ n j,U n j≤V n j)
|
| 32 |
+
(hZ : ∀ a : ℝ,0<a →Tendsto (fun n=>Z0 n/(1+∑ j,V n j)^a) atTop atTop)
|
| 33 |
+
(hH : ∀ n,0≤H n) (hHZ : Tendsto (fun n=>H n/Z0 n) atTop (𝓝 0))
|
| 34 |
+
(hWM : ∀ n,(primorial (w n):ℤ)∣(M n:ℤ))
|
| 35 |
+
(hM : ∀ n,0<M n) (hMs : ∀ n,Smooth (w n) (M n:ℤ))
|
| 36 |
+
(hL : ∀ n,0<L n) (hsm : ∀ n,Smooth (w n) (L n))
|
| 37 |
+
(hWL : ∀ n,(primorial (w n):ℤ)∣L n)
|
| 38 |
+
(hUL : ∀ j,Tendsto (fun n=>U n j/(L n:ℝ)) atTop atTop) :
|
| 39 |
+
∀ ε : ℝ,0<ε →∀ᶠ n in atTop,
|
| 40 |
+
∀ b : Exposure m,b.Legal (U n) (V n) (Z0 n) (w n) (M n) →
|
| 41 |
+
∀ (X : Fin m→ℕ) (Xp : ℕ) (hX : ∀ j,4*primorial (w n)≤X j)
|
| 42 |
+
(hXp : 4*primorial (w n)≤Xp),b.a.natAbs.Coprime (primorial (w n)) →
|
| 43 |
+
(∀ j,(X j:ℝ)≤b.S j) → (∀ j,2*b.S j≤(X j:ℝ)^2) →
|
| 44 |
+
(∀ t∈productTimes b.S b.r (L n),(Xp:ℝ)≤b.Q/(∏ j,(t j:ℝ))) →
|
| 45 |
+
(∀ t∈productTimes b.S b.r (L n),(b.Q+b.Δ)/(∏ j,(t j:ℝ))≤(Xp:ℝ)^2) →
|
| 46 |
+
∀ (A : Fin v → ℤ) (P : (Fin (m+v)→ℝ)→G),
|
| 47 |
+
(∀ i,HasDegree (fun y=>canonicalLog c (P y) i) D) →
|
| 48 |
+
∀ (σ : (G⧸Γ) → (G⧸Γ)),LipschitzWith K σ →
|
| 49 |
+
∀ h : (Fin m → ℤ) → Fin v → ℤ,
|
| 50 |
+
(∀ t∈productTimes b.S b.r (L n),∀ i,(d:ℤ)∣h t i ∧ |(h t i:ℝ)|≤H n) →
|
| 51 |
+
(∀ t∈productTimes b.S b.r (L n),∀ x : Fin v → ℤ,
|
| 52 |
+
σ (QuotientGroup.mk (P (Fin.append (fun j=>(t j:ℝ)) (fun i=>(x i:ℝ)))))=
|
| 53 |
+
QuotientGroup.mk (P (Fin.append (fun j=>(t j:ℝ)) (fun i=>((x i+h t i:ℤ):ℝ))))) →
|
| 54 |
+
(ProductExposureLaw.jointLaw X Xp (primorial (w n)) (primorial_pos _) hX hXp).real
|
| 55 |
+
(ProductExposureLaw.jointFiber
|
| 56 |
+
{t | badFace Γ m v c₀ C₀ B η b.Z d (M n) A P σ t}
|
| 57 |
+
X Xp (primorial (w n)) b.S b.r (L n) b.Q b.Δ b.a (M n) : Set _) /
|
| 58 |
+
(ProductExposureLaw.jointLaw X Xp (primorial (w n)) (primorial_pos _) hX hXp).real
|
| 59 |
+
(ProductExposureLaw.jointFiber Set.univ
|
| 60 |
+
X Xp (primorial (w n)) b.S b.r (L n) b.Q b.Δ b.a (M n) : Set _) < ε
|
| 61 |
+
:= by
|
| 62 |
+
classical
|
| 63 |
+
intro ε hε
|
| 64 |
+
have hu := raw_conditional_face_uniform (Γ:=Γ) (c:=c) hsk hΓ htop m v D d hd
|
| 65 |
+
c₀ C₀ B K η hc₀ hC₀ hB hη w M U V Z0 H L hw hU hUV hZ hH hHZ
|
| 66 |
+
hM hMs hL hsm hWL hUL ε hε
|
| 67 |
+
filter_upwards [hu] with n hn
|
| 68 |
+
intro b hb X Xp hX hXp ha hloD hhiD hloP hhiP A P hP σ hσ h hh hid
|
| 69 |
+
rw [ProductExposureLaw.conditional_exact,
|
| 70 |
+
HarmonicExposure.literal_mass_eq _ X Xp _ b.S b.r (L n) b.Q b.Δ b.a (M n)
|
| 71 |
+
(hL n) (hWL n) hb.2.2.1 hloD hhiD,
|
| 72 |
+
HarmonicExposure.literal_mass_eq Set.univ X Xp _ b.S b.r (L n) b.Q b.Δ b.a (M n)
|
| 73 |
+
(hL n) (hWL n) hb.2.2.1 hloD hhiD]
|
| 74 |
+
simpa only [exceptionalFace,Set.mem_ofPred_eq,Set.mem_univ,Finset.filter_true_of_mem (fun _ _=>True.intro)] using
|
| 75 |
+
hn b hb Xp (primorial (w n)) (hWM n) ha hloP hhiP A P hP σ hσ h hh hid
|
| 76 |
+
|
| 77 |
+
end RoughFaceShift
|
| 78 |
+
end
|
| 79 |
+
end
|
| 80 |
+
|
| 81 |
+
section
|
| 82 |
+
noncomputable section
|
| 83 |
+
namespace ProductExposureLabels
|
| 84 |
+
open scoped BigOperators
|
| 85 |
+
open HarmonicExposure ProductExposureLaw
|
| 86 |
+
attribute [local instance] Classical.propDecidable
|
| 87 |
+
|
| 88 |
+
structure Label (m : ℕ) where
|
| 89 |
+
dyadic : Fin m → ℕ
|
| 90 |
+
residue : Fin m → ℤ
|
| 91 |
+
pivotResidue : ℤ
|
| 92 |
+
bin : ℤ
|
| 93 |
+
|
| 94 |
+
def Label.scales {m : ℕ} (b : Label m) (j : Fin m) : ℝ := 2 ^ b.dyadic j
|
| 95 |
+
|
| 96 |
+
def Label.width {m : ℕ} (b : Label m) (R : ℝ) : ℝ := (∏ j,b.scales j)*R
|
| 97 |
+
|
| 98 |
+
def Label.left {m : ℕ} (b : Label m) (R : ℝ) : ℝ := b.bin*b.width R
|
| 99 |
+
|
| 100 |
+
def expose {m : ℕ} (L M : ℤ) (R : ℝ) (z : (Fin m→ℕ)×ℕ) : Label m where
|
| 101 |
+
dyadic := fun j=>(z.1 j).log2
|
| 102 |
+
residue := fun j=>(z.1 j:ℤ)%L
|
| 103 |
+
pivotResidue := (z.2:ℤ)%M
|
| 104 |
+
bin := ⌊(∏ j,(z.1 j:ℝ))*(z.2:ℝ) / ((∏ j,(2:ℝ)^(z.1 j).log2)*R)⌋
|
| 105 |
+
|
| 106 |
+
def rawDomain {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) : Finset ((Fin m→ℕ)×ℕ) :=
|
| 107 |
+
(Fintype.piFinset (fun j=>RawHarmonicProbability.units (X j) W)).product
|
| 108 |
+
(Finset.Ico Xp (Xp^2))
|
| 109 |
+
|
| 110 |
+
@[ext] lemma Label.ext {m : ℕ} {a b : Label m} (h₁ : a.dyadic=b.dyadic)
|
| 111 |
+
(h₂ : a.residue=b.residue) (h₃ : a.pivotResidue=b.pivotResidue)
|
| 112 |
+
(h₄ : a.bin=b.bin) : a=b := by cases a; cases b; simp_all
|
| 113 |
+
|
| 114 |
+
lemma dyadic_iff (t k : ℕ) (ht : 0<t) :
|
| 115 |
+
t.log2=k ↔ (2:ℝ)^k≤(t:ℝ) ∧ (t:ℝ)<2*(2:ℝ)^k := by
|
| 116 |
+
rw [Nat.log2_eq_iff (by omega)]
|
| 117 |
+
constructor <;> intro h
|
| 118 |
+
· constructor
|
| 119 |
+
· exact_mod_cast h.1
|
| 120 |
+
· have hh : (t:ℝ)<(2:ℝ)^(k+1) := by exact_mod_cast h.2
|
| 121 |
+
simpa [pow_succ,mul_comm] using hh
|
| 122 |
+
· constructor
|
| 123 |
+
· exact_mod_cast h.1
|
| 124 |
+
· have hh : (t:ℝ)<(2:ℝ)^(k+1) := by simpa [pow_succ,mul_comm] using h.2
|
| 125 |
+
exact_mod_cast hh
|
| 126 |
+
|
| 127 |
+
lemma residue_iff (t L r : ℤ) (hr : 0≤r ∧ r<L) :
|
| 128 |
+
t%L=r ↔ L∣t-r := by
|
| 129 |
+
rw [Int.dvd_iff_emod_eq_zero, ←Int.emod_eq_emod_iff_emod_sub_eq_zero,
|
| 130 |
+
Int.emod_eq_of_lt hr.1 hr.2]
|
| 131 |
+
|
| 132 |
+
lemma floor_bin_iff (x Δ : ℝ) (k : ℤ) (hΔ : 0<Δ) :
|
| 133 |
+
⌊x/Δ⌋=k ↔ (k:ℝ)*Δ≤x ∧ x<(k:ℝ)*Δ+Δ := by
|
| 134 |
+
rw [Int.floor_eq_iff,le_div_iff₀ hΔ,div_lt_iff₀ hΔ]
|
| 135 |
+
ring_nf
|
| 136 |
+
|
| 137 |
+
lemma Label.width_pos {m : ℕ} (b : Label m) (R : ℝ) (hR : 0<R) :
|
| 138 |
+
0<b.width R := by
|
| 139 |
+
unfold Label.width Label.scales
|
| 140 |
+
exact mul_pos (Finset.prod_pos (fun _ _=>pow_pos (by norm_num) _)) hR
|
| 141 |
+
|
| 142 |
+
lemma expose_eq_iff {m : ℕ} (L M : ℤ) (R : ℝ) (hR : 0<R)
|
| 143 |
+
(z : (Fin m→ℕ)×ℕ) (ht : ∀ j,0<z.1 j) (b : Label m)
|
| 144 |
+
(hr : ∀ j,0≤b.residue j ∧ b.residue j<L)
|
| 145 |
+
(ha : 0≤b.pivotResidue ∧ b.pivotResidue<M) :
|
| 146 |
+
expose L M R z=b ↔
|
| 147 |
+
(∀ j,b.scales j≤(z.1 j:ℝ) ∧ (z.1 j:ℝ)<2*b.scales j) ∧
|
| 148 |
+
(∀ j,L∣(z.1 j:ℤ)-b.residue j) ∧ M∣(z.2:ℤ)-b.pivotResidue ∧
|
| 149 |
+
b.left R≤(∏ j,(z.1 j:ℝ))*(z.2:ℝ) ∧
|
| 150 |
+
(∏ j,(z.1 j:ℝ))*(z.2:ℝ)<b.left R+b.width R := by
|
| 151 |
+
have hw (hd : (fun j=>(z.1 j).log2)=b.dyadic) :
|
| 152 |
+
((∏ j,(2:ℝ)^(z.1 j).log2)*R)=b.width R := by
|
| 153 |
+
unfold Label.width Label.scales
|
| 154 |
+
congr 1
|
| 155 |
+
apply Finset.prod_congr rfl
|
| 156 |
+
intro j hj
|
| 157 |
+
rw [congrFun hd j]
|
| 158 |
+
constructor
|
| 159 |
+
· intro heq
|
| 160 |
+
have hd : (fun j=>(z.1 j).log2)=b.dyadic := congrArg Label.dyadic heq
|
| 161 |
+
have hre : (fun j=>(z.1 j:ℤ)%L)=b.residue := congrArg Label.residue heq
|
| 162 |
+
have hap : (z.2:ℤ)%M=b.pivotResidue := congrArg Label.pivotResidue heq
|
| 163 |
+
have hb : ⌊(∏ j,(z.1 j:ℝ))*(z.2:ℝ)/((∏ j,(2:ℝ)^(z.1 j).log2)*R)⌋=b.bin :=
|
| 164 |
+
congrArg Label.bin heq
|
| 165 |
+
rw [hw hd] at hb
|
| 166 |
+
exact ⟨fun j=>(dyadic_iff _ _ (ht j)).mp (congrFun hd j),
|
| 167 |
+
fun j=>(residue_iff _ _ _ (hr j)).mp (congrFun hre j),
|
| 168 |
+
(residue_iff _ _ _ ha).mp hap,
|
| 169 |
+
(floor_bin_iff _ _ _ (b.width_pos R hR)).mp hb⟩
|
| 170 |
+
· rintro ⟨hd,hrd,had,hb⟩
|
| 171 |
+
have hde : (fun j=>(z.1 j).log2)=b.dyadic :=
|
| 172 |
+
funext (fun j=>(dyadic_iff _ _ (ht j)).mpr (hd j))
|
| 173 |
+
apply Label.ext hde
|
| 174 |
+
· exact funext (fun j=>(residue_iff _ _ _ (hr j)).mpr (hrd j))
|
| 175 |
+
· exact (residue_iff _ _ _ ha).mpr had
|
| 176 |
+
· change ⌊(∏ j,(z.1 j:ℝ))*(z.2:ℝ)/((∏ j,(2:ℝ)^(z.1 j).log2)*R)⌋=b.bin
|
| 177 |
+
rw [hw hde]
|
| 178 |
+
exact (floor_bin_iff _ _ _ (b.width_pos R hR)).mpr hb
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
theorem fiber_eq {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hX : ∀ j,0<X j)
|
| 183 |
+
(L M : ℤ) (R : ℝ) (_ : 0<L) (_ : 0<M) (hR : 0<R)
|
| 184 |
+
(b : Label m) (hr : ∀ j,0≤b.residue j ∧ b.residue j<L)
|
| 185 |
+
(ha : 0≤b.pivotResidue ∧ b.pivotResidue<M) :
|
| 186 |
+
(rawDomain X Xp W).filter (fun z=>expose L M R z=b) =
|
| 187 |
+
jointFiber Set.univ X Xp W b.scales b.residue L (b.left R) (b.width R)
|
| 188 |
+
b.pivotResidue M
|
| 189 |
+
:= by
|
| 190 |
+
classical
|
| 191 |
+
apply Finset.ext
|
| 192 |
+
rintro ⟨t,p⟩
|
| 193 |
+
simp only [rawDomain,Finset.product_eq_sprod,Finset.mem_filter,Finset.mem_product,Fintype.mem_piFinset,
|
| 194 |
+
RawHarmonicProbability.units,Finset.mem_filter,jointFiber,rawTailFiber,Finset.product_eq_sprod,
|
| 195 |
+
Set.mem_univ,true_and]
|
| 196 |
+
constructor
|
| 197 |
+
· rintro ⟨⟨ht,hp⟩,he⟩
|
| 198 |
+
have htpos : ∀ j,0<t j := fun j=>(hX j).trans_le (Finset.mem_Ico.mp (ht j).1).1
|
| 199 |
+
obtain ⟨hd,hrd,ha,hb⟩ := (expose_eq_iff L M R hR (t,p) htpos b hr ha).mp he
|
| 200 |
+
exact ⟨⟨fun j=>⟨(ht j).1,(ht j).2,(hd j).1,(hd j).2,hrd j⟩,hp⟩,ha,hb⟩
|
| 201 |
+
· rintro ⟨⟨ht,hp⟩,had,hb⟩
|
| 202 |
+
have htpos : ∀ j,0<t j := fun j=>(hX j).trans_le (Finset.mem_Ico.mp (ht j).1).1
|
| 203 |
+
refine ⟨⟨fun j=>⟨(ht j).1,(ht j).2.1⟩,hp⟩,?_⟩
|
| 204 |
+
exact (expose_eq_iff L M R hR (t,p) htpos b hr ha).mpr
|
| 205 |
+
⟨fun j=>⟨(ht j).2.2.1,(ht j).2.2.2.1⟩,fun j=>(ht j).2.2.2.2,had,hb⟩
|
| 206 |
+
|
| 207 |
+
end ProductExposureLabels
|
| 208 |
+
end
|
| 209 |
+
end
|
| 210 |
+
|
| 211 |
+
section
|
| 212 |
+
noncomputable section
|
| 213 |
+
namespace ProductExposureCutoff
|
| 214 |
+
open DyadicHarmonicBoundary RawHarmonicProbability Finset Filter MeasureTheory
|
| 215 |
+
open scoped Topology BigOperators
|
| 216 |
+
|
| 217 |
+
def cutoff (X C : ℕ) : Set ℕ := {p | p ≤ 2^C*X ∨ X^2 ≤ 2^C*p}
|
| 218 |
+
|
| 219 |
+
lemma mass_mono_interval {A B C D W : ℕ} (hCA : C≤A) (hBD : B≤D) :
|
| 220 |
+
mass A B W≤ mass C D W :=
|
| 221 |
+
sum_le_sum_of_subset_of_nonneg (Ico_subset_Ico hCA hBD) (by intros; positivity)
|
| 222 |
+
|
| 223 |
+
lemma many_dyadic_lower (X W K : ℕ) (hW : 0<W) (hX : 4*W≤X) :
|
| 224 |
+
(K:ℝ)*((W.totient:ℝ)/(4*W))≤ mass X (X*2^K) W := by
|
| 225 |
+
rw [mass,←dyadic_sum]
|
| 226 |
+
calc
|
| 227 |
+
_ = ∑ _k∈range K, (W.totient:ℝ)/(4*W) := by simp
|
| 228 |
+
_ ≤ _ := by
|
| 229 |
+
apply sum_le_sum
|
| 230 |
+
intro k hk
|
| 231 |
+
have hpow := Nat.one_le_pow k 2 (by omega)
|
| 232 |
+
have hxk : 4*W≤X*2^k := by nlinarith
|
| 233 |
+
have h := dyadic_lower (X*2^k) W hW hxk
|
| 234 |
+
have hend : X*2^(k+1)=X*2^k+X*2^k := by rw [pow_succ]; ring
|
| 235 |
+
simpa only [hend,mass] using h
|
| 236 |
+
|
| 237 |
+
lemma dyadic_upper_simple (Y W : ℕ) (hW : 0<W) (hY : 4*W≤Y) :
|
| 238 |
+
mass Y (Y+Y) W≤ (3/2:ℝ)*((W.totient:ℝ)/W) := by
|
| 239 |
+
have hw : (0:ℝ)<W := by exact_mod_cast hW
|
| 240 |
+
have hy : (0:ℝ)<Y := by exact_mod_cast (show 0<Y by omega)
|
| 241 |
+
have hY' : (4:ℝ)*W≤Y := by exact_mod_cast hY
|
| 242 |
+
have hu := dyadic_upper Y W hW (by omega)
|
| 243 |
+
have hd : 2*(W.totient:ℝ)/Y≤2*(W.totient:ℝ)/(4*W) :=
|
| 244 |
+
div_le_div_of_nonneg_left (by positivity) (by positivity) hY'
|
| 245 |
+
calc
|
| 246 |
+
_ ≤ (W.totient:ℝ)/W+2*W.totient/Y := hu
|
| 247 |
+
_ ≤ (W.totient:ℝ)/W+2*W.totient/(4*W) := add_le_add_right hd _
|
| 248 |
+
_ = _ := by ring
|
| 249 |
+
|
| 250 |
+
lemma many_dyadic_upper (X W K : ℕ) (hW : 0<W) (hX : 4*W≤X) :
|
| 251 |
+
mass X (X*2^K) W≤(K:ℝ)*(3/2)*((W.totient:ℝ)/W) := by
|
| 252 |
+
rw [mass,←dyadic_sum]
|
| 253 |
+
calc
|
| 254 |
+
_ ≤ ∑ _k∈range K, (3/2:ℝ)*((W.totient:ℝ)/W) := by
|
| 255 |
+
apply sum_le_sum
|
| 256 |
+
intro k hk
|
| 257 |
+
have hpow := Nat.one_le_pow k 2 (by omega)
|
| 258 |
+
have hxk : 4*W≤X*2^k := by nlinarith
|
| 259 |
+
have h := dyadic_upper_simple (X*2^k) W hW hxk
|
| 260 |
+
have hend : X*2^(k+1)=X*2^k+X*2^k := by rw [pow_succ]; ring
|
| 261 |
+
simpa only [hend,mass] using h
|
| 262 |
+
_ = _ := by simp; ring
|
| 263 |
+
|
| 264 |
+
lemma cutoff_mass_bound (X W C : ℕ) (hW : 0<W) (hX : 4*W≤X) (hCX : 2^C≤X) :
|
| 265 |
+
MicrocellConditional.eventMass (units X W) (cutoff X C) ≤
|
| 266 |
+
3*((C:ℝ)+1)*((W.totient:ℝ)/W) := by
|
| 267 |
+
classical
|
| 268 |
+
let A := X^2/2^C
|
| 269 |
+
have hpow0 : 0<2^C := by positivity
|
| 270 |
+
have hx : 0<X := by omega
|
| 271 |
+
have hAx : X≤A := by
|
| 272 |
+
dsimp [A]
|
| 273 |
+
apply (Nat.le_div_iff_mul_le hpow0).mpr
|
| 274 |
+
nlinarith
|
| 275 |
+
have hA : 0<A := hx.trans_le hAx
|
| 276 |
+
have hupper : X^2<A*2^(C+1) := by
|
| 277 |
+
have hh := Nat.lt_div_mul_add (a:=X^2) hpow0
|
| 278 |
+
change X^2<A*2^C+2^C at hh
|
| 279 |
+
rw [pow_succ 2 C]
|
| 280 |
+
nlinarith
|
| 281 |
+
have hlower : 2^C*X<X*2^(C+1) := by rw [pow_succ 2 C]; nlinarith
|
| 282 |
+
let E := (units X W).filter (·∈cutoff X C)
|
| 283 |
+
have hE : MicrocellConditional.eventMass (units X W) (cutoff X C)=
|
| 284 |
+
∑ p∈E,(p:ℝ)⁻¹ := by simp [MicrocellConditional.eventMass,E,sum_filter]
|
| 285 |
+
have hs₁ : E.filter (fun p=>p≤2^C*X) ⊆ (Ico X (X*2^(C+1))).filter W.Coprime := by
|
| 286 |
+
intro p hp
|
| 287 |
+
have hp₁ := mem_filter.mp hp
|
| 288 |
+
have hp₂ := mem_filter.mp hp₁.1
|
| 289 |
+
have hp₃ := mem_filter.mp hp₂.1
|
| 290 |
+
have hlo := hp₁.2
|
| 291 |
+
have hc := hp₂.2
|
| 292 |
+
have hwp := hp₃.2
|
| 293 |
+
obtain ⟨hxp,hpx⟩ := mem_Ico.mp hp₃.1
|
| 294 |
+
exact mem_filter.mpr ⟨mem_Ico.mpr ⟨hxp,hlo.trans_lt hlower⟩,hwp⟩
|
| 295 |
+
have hs₂ : E.filter (fun p=>¬p≤2^C*X) ⊆ (Ico A (A*2^(C+1))).filter W.Coprime := by
|
| 296 |
+
intro p hp
|
| 297 |
+
have hp₁ := mem_filter.mp hp
|
| 298 |
+
have hp₂ := mem_filter.mp hp₁.1
|
| 299 |
+
have hp₃ := mem_filter.mp hp₂.1
|
| 300 |
+
have hlo := hp₁.2
|
| 301 |
+
have hc := hp₂.2
|
| 302 |
+
have hwp := hp₃.2
|
| 303 |
+
obtain ⟨hxp,hpx⟩ := mem_Ico.mp hp₃.1
|
| 304 |
+
have hc' : X^2≤2^C*p := (show p≤2^C*X ∨ X^2≤2^C*p from hc).resolve_left hlo
|
| 305 |
+
have hap : A≤p := by
|
| 306 |
+
dsimp [A]
|
| 307 |
+
apply (Nat.div_le_iff_le_mul hpow0).mpr
|
| 308 |
+
have hh : X^2≤p*2^C := by simpa only [mul_comm] using hc'
|
| 309 |
+
omega
|
| 310 |
+
exact mem_filter.mpr ⟨mem_Ico.mpr ⟨hap,hpx.trans hupper⟩,hwp⟩
|
| 311 |
+
have hb₁ : (∑ p∈E.filter (fun p=>p≤2^C*X),(p:ℝ)⁻¹) ≤ mass X (X*2^(C+1)) W := by
|
| 312 |
+
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:ℝ)⁻¹)
|
| 313 |
+
simpa only [sum_filter,mass] using h
|
| 314 |
+
have hb₂ : (∑ p∈E.filter (fun p=>¬p≤2^C*X),(p:ℝ)⁻¹) ≤ mass A (A*2^(C+1)) W := by
|
| 315 |
+
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:ℝ)⁻¹)
|
| 316 |
+
simpa only [sum_filter,mass] using h
|
| 317 |
+
rw [hE,←sum_filter_add_sum_filter_not E (fun p=>p≤2^C*X)]
|
| 318 |
+
have h₁ := many_dyadic_upper X W (C+1) hW hX
|
| 319 |
+
have h₂ := many_dyadic_upper A W (C+1) hW (hX.trans hAx)
|
| 320 |
+
push_cast at h₁ h₂
|
| 321 |
+
linarith
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
theorem raw_cutoff_bound (X W C K : ℕ) (hW : 0<W) (hX : 4*W≤X)
|
| 325 |
+
(hK : 0<K) (hKX : 2^K≤X) (hCX : 2^C≤X) :
|
| 326 |
+
(law X W hW hX : Measure ℕ).real (cutoff X C) ≤
|
| 327 |
+
12*((C:ℝ)+1)/K := by
|
| 328 |
+
have ht : (0:ℝ)<W.totient := by exact_mod_cast Nat.totient_pos.mpr hW
|
| 329 |
+
have hw : (0:ℝ)<W := by exact_mod_cast hW
|
| 330 |
+
have hk : (0:ℝ)<K := by exact_mod_cast hK
|
| 331 |
+
have hm := mass_pos X W hW hX
|
| 332 |
+
have hl := (many_dyadic_lower X W K hW hX).trans
|
| 333 |
+
(mass_mono (show X*2^K≤X^2 by nlinarith))
|
| 334 |
+
rw [MicrocellConditional.law_apply_units]
|
| 335 |
+
apply (div_le_iff₀ hm).mpr
|
| 336 |
+
have hu := cutoff_mass_bound X W C hW hX hCX
|
| 337 |
+
have hratio : 0≤12*((C:ℝ)+1)/K := by positivity
|
| 338 |
+
have hh := mul_le_mul_of_nonneg_left hl hratio
|
| 339 |
+
have he : (12*((C:ℝ)+1)/K)*((K:ℝ)*((W.totient:ℝ)/(4*W))) =
|
| 340 |
+
3*((C:ℝ)+1)*((W.totient:ℝ)/W) := by field_simp; ring
|
| 341 |
+
rw [he] at hh
|
| 342 |
+
exact hu.trans hh
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
theorem raw_cutoff_decay (X W : ℕ→ℕ) (C : ℕ)
|
| 346 |
+
(hW : ∀ n,0<W n) (hX : ∀ n,4*W n≤X n) (hXt : Tendsto X atTop atTop) :
|
| 347 |
+
Tendsto (fun n=>(law (X n) (W n) (hW n) (hX n) : Measure ℕ).real
|
| 348 |
+
(cutoff (X n) C)) atTop (𝓝 0) := by
|
| 349 |
+
apply tendsto_order.mpr
|
| 350 |
+
constructor
|
| 351 |
+
· intro a ha
|
| 352 |
+
exact Filter.Eventually.of_forall (fun n=>ha.trans_le (measureReal_nonneg))
|
| 353 |
+
· intro ε hε
|
| 354 |
+
obtain ⟨K,hK⟩ := exists_nat_gt (12*((C:ℝ)+1)/ε)
|
| 355 |
+
have hk : (0:ℝ)<K := lt_trans (by positivity) hK
|
| 356 |
+
have hkN : 0<K := by exact_mod_cast hk
|
| 357 |
+
have he : 12*((C:ℝ)+1)/K<ε := by
|
| 358 |
+
have hh := (div_lt_iff₀ hε).mp hK
|
| 359 |
+
exact (div_lt_iff₀ hk).mpr (by nlinarith)
|
| 360 |
+
filter_upwards [hXt.eventually (eventually_ge_atTop (2^K)),
|
| 361 |
+
hXt.eventually (eventually_ge_atTop (2^C))] with n hkn hcn
|
| 362 |
+
exact (raw_cutoff_bound (X n) (W n) C K (hW n) (hX n) hkN hkn hcn).trans_lt he
|
| 363 |
+
|
| 364 |
+
end ProductExposureCutoff
|
| 365 |
+
|
| 366 |
+
end
|
| 367 |
+
end
|
| 368 |
+
|
| 369 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure03.lean
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.ProductExposure02
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
noncomputable section
|
| 9 |
+
end
|
| 10 |
+
end
|
| 11 |
+
|
| 12 |
+
section
|
| 13 |
+
noncomputable section
|
| 14 |
+
namespace ProductExposureCutoff
|
| 15 |
+
open RawHarmonicProbability Finset Filter MeasureTheory
|
| 16 |
+
open scoped Topology BigOperators
|
| 17 |
+
|
| 18 |
+
def badBin (X : ℕ) (R : ℝ) (m : ℕ) (tlo τ : ℝ) : Set ℕ := {p | ∃ Q : ℝ,
|
| 19 |
+
Q≤τ*p ∧ τ*p<Q+tlo*R ∧ ∃ τ' : ℝ, tlo≤τ' ∧ τ'≤2^m*tlo ∧
|
| 20 |
+
(Q/τ'<X+2*R ∨ (X:ℝ)^2-2*R<(Q+tlo*R)/τ')}
|
| 21 |
+
|
| 22 |
+
lemma bad_bin_geometry (X R B tlo τ τ' Q p : ℝ)
|
| 23 |
+
(hX : 4≤X) (hRX : R≤X) (hR : 0≤R) (hB : 1≤B) (htlo : 0<tlo)
|
| 24 |
+
(ht : tlo≤τ) (ht' : τ≤B*tlo) (hu : tlo≤τ') (hu' : τ'≤B*tlo)
|
| 25 |
+
(hp : X≤p) (hQ : Q≤τ*p) (hQ' : τ*p<Q+tlo*R)
|
| 26 |
+
(hbad : Q/τ'<X+2*R ∨ X^2-2*R<(Q+tlo*R)/τ') :
|
| 27 |
+
p≤4*B*X ∨ X^2≤4*B*p := by
|
| 28 |
+
have hp0 : 0≤p := by linarith
|
| 29 |
+
have hu0 : 0<τ' := htlo.trans_le hu
|
| 30 |
+
have hB0 : 0≤B := by linarith
|
| 31 |
+
have hX0 : 0≤X := by linarith
|
| 32 |
+
have hUX : 0≤X+2*R := by positivity
|
| 33 |
+
have hVX : 0≤X^2-2*R := by nlinarith
|
| 34 |
+
rcases hbad with hbad | hbad
|
| 35 |
+
· left
|
| 36 |
+
have hbad' := (div_lt_iff₀ hu0).mp hbad
|
| 37 |
+
have hmu := mul_le_mul_of_nonneg_right hu' hUX
|
| 38 |
+
have hmt := mul_le_mul_of_nonneg_right ht hp0
|
| 39 |
+
have hbr := mul_le_mul_of_nonneg_left hRX hB0
|
| 40 |
+
have hbx := mul_le_mul_of_nonneg_right hB hX0
|
| 41 |
+
have hsmall : p<B*(X+2*R)+R := by
|
| 42 |
+
apply (mul_lt_mul_iff_left₀ htlo).mp
|
| 43 |
+
nlinarith
|
| 44 |
+
nlinarith
|
| 45 |
+
· right
|
| 46 |
+
have hbad' := (lt_div_iff₀ hu0).mp hbad
|
| 47 |
+
have hmu := mul_le_mul_of_nonneg_right hu hVX
|
| 48 |
+
have hmt := mul_le_mul_of_nonneg_right ht' hp0
|
| 49 |
+
have hlarge : X^2-3*R<B*p := by
|
| 50 |
+
apply (mul_lt_mul_iff_left₀ htlo).mp
|
| 51 |
+
nlinarith
|
| 52 |
+
nlinarith
|
| 53 |
+
|
| 54 |
+
lemma bad_bin_subset_cutoff (X : ℕ) (R : ℝ) (m : ℕ) (tlo τ : ℝ)
|
| 55 |
+
(hX : 4≤X) (hR : 0≤R) (hRX : R≤X) (htlo : 0<tlo)
|
| 56 |
+
(ht : tlo≤τ) (ht' : τ≤2^m*tlo) :
|
| 57 |
+
badBin X R m tlo τ ∩ {p | X≤p} ⊆ cutoff X (m+2) := by
|
| 58 |
+
rintro p ⟨⟨Q,hQ,hQ',τ',hu,hu',hbad⟩,hp⟩
|
| 59 |
+
have hh := bad_bin_geometry (X:ℝ) R (2^m) tlo τ τ' Q p (by exact_mod_cast hX)
|
| 60 |
+
hRX hR (one_le_pow₀ (by norm_num)) htlo ht ht' hu hu' (by exact_mod_cast hp) hQ hQ' hbad
|
| 61 |
+
have he : (2:ℝ)^(m+2)=4*2^m := by rw [pow_add]; norm_num; ring
|
| 62 |
+
change p≤2^(m+2)*X ∨ X^2≤2^(m+2)*p
|
| 63 |
+
rw [←he] at hh
|
| 64 |
+
exact_mod_cast hh
|
| 65 |
+
|
| 66 |
+
lemma raw_bad_bin_le_cutoff (X W : ℕ) (m : ℕ)
|
| 67 |
+
(hW : 0<W) (hX : 4*W≤X) (R tlo τ : ℝ) (hR : 0≤R) (hRX : R≤X)
|
| 68 |
+
(htlo : 0<tlo) (ht : tlo≤τ) (ht' : τ≤2^m*tlo) :
|
| 69 |
+
(law X W hW hX : Measure ℕ).real (badBin X R m tlo τ) ≤
|
| 70 |
+
(law X W hW hX : Measure ℕ).real (cutoff X (m+2)) := by
|
| 71 |
+
classical
|
| 72 |
+
rw [law_apply,law_apply]
|
| 73 |
+
apply div_le_div_of_nonneg_right _ (mass_pos X W hW hX).le
|
| 74 |
+
apply sum_le_sum
|
| 75 |
+
intro p hp
|
| 76 |
+
obtain ⟨hxp,hpx⟩ := mem_Ico.mp hp
|
| 77 |
+
have hs := bad_bin_subset_cutoff X R m tlo τ (by omega) hR hRX htlo ht ht'
|
| 78 |
+
split_ifs with h₁ h₂ h₂
|
| 79 |
+
· rfl
|
| 80 |
+
· exact False.elim (h₂ ⟨h₁.1,hs ⟨h₁.2,hxp⟩⟩)
|
| 81 |
+
· positivity
|
| 82 |
+
· rfl
|
| 83 |
+
|
| 84 |
+
theorem raw_bad_bin_decay (X W : ℕ→ℕ) (m : ℕ)
|
| 85 |
+
(hW : ∀ n,0<W n) (hX : ∀ n,4*W n≤X n) (hXt : Tendsto X atTop atTop) :
|
| 86 |
+
∀ ε : ℝ,0<ε → ∀ᶠ n in atTop,
|
| 87 |
+
∀ (R tlo τ : ℝ), 0≤R → R≤X n → 0<tlo → tlo≤τ → τ≤2^m*tlo →
|
| 88 |
+
(law (X n) (W n) (hW n) (hX n) : Measure ℕ).real
|
| 89 |
+
(badBin (X n) R m tlo τ)<ε := by
|
| 90 |
+
intro ε hε
|
| 91 |
+
have hh := (raw_cutoff_decay X W (m+2) hW hX hXt).eventually_lt_const hε
|
| 92 |
+
filter_upwards [hh] with n hn
|
| 93 |
+
intro R tlo τ hR hRX htlo ht ht'
|
| 94 |
+
exact (raw_bad_bin_le_cutoff (X n) (W n) m (hW n) (hX n) R tlo τ
|
| 95 |
+
hR hRX htlo ht ht').trans_lt hn
|
| 96 |
+
|
| 97 |
+
end ProductExposureCutoff
|
| 98 |
+
end
|
| 99 |
+
end
|
| 100 |
+
|
| 101 |
+
section
|
| 102 |
+
noncomputable section
|
| 103 |
+
namespace ProductExposureLabels
|
| 104 |
+
open scoped BigOperators Topology
|
| 105 |
+
open MeasureTheory Filter RawHarmonicProbability ProductExposureLaw ProductExposureCutoff
|
| 106 |
+
attribute [local instance] Classical.propDecidable
|
| 107 |
+
|
| 108 |
+
def Good {m : ℕ} (X : Fin m→ℕ) (Xp : ℕ) (R : ℝ) (b : Label m) : Prop :=
|
| 109 |
+
(∀ j,(X j:ℝ)≤b.scales j ∧ 2*b.scales j≤(X j:ℝ)^2) ∧
|
| 110 |
+
∀ τ : ℝ,(∏ j,b.scales j)≤τ →τ≤2^m*(∏ j,b.scales j) →
|
| 111 |
+
Xp+2*R≤b.left R/τ ∧ (b.left R+b.width R)/τ≤(Xp:ℝ)^2-2*R
|
| 112 |
+
|
| 113 |
+
lemma tail_marginal {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W)
|
| 114 |
+
(hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (j : Fin m) (A : Set ℕ) :
|
| 115 |
+
(jointLaw X Xp W hW hX hXp).real {z | z.1 j∈A} =
|
| 116 |
+
(law (X j) W hW (hX j):Measure ℕ).real A := by
|
| 117 |
+
have hf : MeasurePreserving (fun z : (Fin m→ℕ)×ℕ=>z.1 j)
|
| 118 |
+
(jointLaw X Xp W hW hX hXp) (law (X j) W hW (hX j):Measure ℕ) :=
|
| 119 |
+
(measurePreserving_eval (fun i=>(law (X i) W hW (hX i):Measure ℕ)) j).comp
|
| 120 |
+
measurePreserving_fst
|
| 121 |
+
exact hf.measureReal_preimage MeasurableSet.of_discrete.nullMeasurableSet
|
| 122 |
+
|
| 123 |
+
lemma pivot_marginal {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W)
|
| 124 |
+
(hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (A : Set ℕ) :
|
| 125 |
+
(jointLaw X Xp W hW hX hXp).real {z | z.2∈A} =
|
| 126 |
+
(law Xp W hW hXp:Measure ℕ).real A := by
|
| 127 |
+
exact (measurePreserving_snd (μ:=Measure.pi (fun j=>(law (X j) W hW (hX j):Measure ℕ)))
|
| 128 |
+
(ν:=(law Xp W hW hXp:Measure ℕ))).measureReal_preimage
|
| 129 |
+
MeasurableSet.of_discrete.nullMeasurableSet
|
| 130 |
+
|
| 131 |
+
lemma law_ae_units (X W : ℕ) (hW : 0<W) (hX : 4*W≤X) :
|
| 132 |
+
∀ᵐ t ∂(law X W hW hX:Measure ℕ),t∈units X W := by
|
| 133 |
+
rw [ae_iff,←measureReal_eq_zero_iff]
|
| 134 |
+
have hh := MicrocellSaturation.law_restrict_units X W hW hX ((units X W:Set ℕ)ᶜ)
|
| 135 |
+
change (law X W hW hX:Measure ℕ).real ((units X W:Set ℕ)ᶜ)=0
|
| 136 |
+
simpa only [Set.compl_inter_self,measureReal_empty] using hh.symm
|
| 137 |
+
|
| 138 |
+
lemma joint_ae_domain {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W)
|
| 139 |
+
(hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) :
|
| 140 |
+
∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z∈rawDomain X Xp W := by
|
| 141 |
+
have ht : ∀ j,∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z.1 j∈units (X j) W := by
|
| 142 |
+
intro j
|
| 143 |
+
rw [ae_iff,←measureReal_eq_zero_iff]
|
| 144 |
+
change (jointLaw X Xp W hW hX hXp).real {z | z.1 j∈(units (X j) W:Set ℕ)ᶜ}=0
|
| 145 |
+
rw [tail_marginal]
|
| 146 |
+
exact (measureReal_eq_zero_iff (by finiteness)).mpr (ae_iff.mp (law_ae_units (X j) W hW (hX j)))
|
| 147 |
+
have hp : ∀ᵐ z ∂jointLaw X Xp W hW hX hXp,z.2∈units Xp W := by
|
| 148 |
+
rw [ae_iff,←measureReal_eq_zero_iff]
|
| 149 |
+
change (jointLaw X Xp W hW hX hXp).real {z | z.2∈(units Xp W:Set ℕ)ᶜ}=0
|
| 150 |
+
rw [pivot_marginal]
|
| 151 |
+
exact (measureReal_eq_zero_iff (by finiteness)).mpr (ae_iff.mp (law_ae_units Xp W hW hXp))
|
| 152 |
+
filter_upwards [ae_all_iff.mpr ht,hp] with z hz hp
|
| 153 |
+
simpa only [rawDomain,Finset.product_eq_sprod,Finset.mem_product,Fintype.mem_piFinset] using
|
| 154 |
+
And.intro hz (Finset.mem_filter.mp hp).1
|
| 155 |
+
|
| 156 |
+
lemma joint_restrict_domain {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W)
|
| 157 |
+
(hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (A : Set ((Fin m→ℕ)×ℕ)) :
|
| 158 |
+
(jointLaw X Xp W hW hX hXp).real (A∩(rawDomain X Xp W:Set _)) =
|
| 159 |
+
(jointLaw X Xp W hW hX hXp).real A := by
|
| 160 |
+
apply measureReal_congr
|
| 161 |
+
filter_upwards [joint_ae_domain X Xp W hW hX hXp] with z hz
|
| 162 |
+
change (z∈A ∧ z∈rawDomain X Xp W) = (z∈A)
|
| 163 |
+
exact propext ⟨And.left,fun ha=>⟨ha,hz⟩⟩
|
| 164 |
+
|
| 165 |
+
lemma expose_bounds {m : ℕ} (L M : ℤ) (R : ℝ) (hR : 0<R)
|
| 166 |
+
(z : (Fin m→ℕ)×ℕ) (ht : ∀ j,0<z.1 j) :
|
| 167 |
+
(∀ j,(expose L M R z).scales j≤(z.1 j:ℝ) ∧
|
| 168 |
+
(z.1 j:ℝ)<2*(expose L M R z).scales j) ∧
|
| 169 |
+
(expose L M R z).left R≤(∏ j,(z.1 j:ℝ))*(z.2:ℝ) ∧
|
| 170 |
+
(∏ j,(z.1 j:ℝ))*(z.2:ℝ)<(expose L M R z).left R+(expose L M R z).width R := by
|
| 171 |
+
refine ⟨fun j=>(dyadic_iff _ _ (ht j)).mp rfl,?_⟩
|
| 172 |
+
exact (floor_bin_iff _ _ _ ((expose L M R z).width_pos R hR)).mp rfl
|
| 173 |
+
|
| 174 |
+
lemma product_dyadic_bounds {m : ℕ} (b : Label m) (t : Fin m→ℕ)
|
| 175 |
+
(ht : ∀ j,b.scales j≤(t j:ℝ) ∧ (t j:ℝ)<2*b.scales j) :
|
| 176 |
+
(∏ j,b.scales j)≤(∏ j,(t j:ℝ)) ∧
|
| 177 |
+
(∏ j,(t j:ℝ))≤2^m*(∏ j,b.scales j) := by
|
| 178 |
+
constructor
|
| 179 |
+
· exact Finset.prod_le_prod₀ (fun j _=>by unfold Label.scales; positivity) (fun j _=>(ht j).1)
|
| 180 |
+
· calc
|
| 181 |
+
_ ≤ ∏ j,2*b.scales j := Finset.prod_le_prod₀ (fun _ _=>by positivity) (fun j _=>(ht j).2.le)
|
| 182 |
+
_ = _ := by rw [Finset.prod_mul_distrib]; simp
|
| 183 |
+
|
| 184 |
+
lemma good_of_not_cutoff {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ)
|
| 185 |
+
(hX : ∀ j,0<X j) (hXp : 4≤Xp) (L M : ℤ) (R : ℝ) (hR : 0<R) (hRX : R≤Xp)
|
| 186 |
+
(z : (Fin m→ℕ)×ℕ) (hz : z∈rawDomain X Xp W)
|
| 187 |
+
(htc : ∀ j,z.1 j∉cutoff (X j) 1) (hpc : z.2∉cutoff Xp (m+2)) :
|
| 188 |
+
Good X Xp R (expose L M R z) := by
|
| 189 |
+
obtain ⟨hzT,hzP⟩ : (∀ j,z.1 j∈units (X j) W) ∧ z.2∈Finset.Ico Xp (Xp^2) := by
|
| 190 |
+
simpa [rawDomain,Finset.product_eq_sprod] using hz
|
| 191 |
+
have htpos : ∀ j,0<z.1 j := fun j=>(hX j).trans_le (Finset.mem_Ico.mp
|
| 192 |
+
(Finset.mem_filter.mp (hzT j)).1).1
|
| 193 |
+
obtain ⟨hdy,hq,hq'⟩ := expose_bounds L M R hR z htpos
|
| 194 |
+
obtain ⟨hprod,hprod'⟩ := product_dyadic_bounds (expose L M R z) z.1 hdy
|
| 195 |
+
have hspos : 0<∏ j,(expose L M R z).scales j :=
|
| 196 |
+
Finset.prod_pos (fun j _=>pow_pos (by norm_num) _)
|
| 197 |
+
constructor
|
| 198 |
+
· intro j
|
| 199 |
+
have hcut : ¬(z.1 j≤2*X j ∨(X j)^2≤2*z.1 j) := by
|
| 200 |
+
simpa [cutoff] using htc j
|
| 201 |
+
push Not at hcut
|
| 202 |
+
have hl : (2:ℝ)*X j<(z.1 j:ℝ) := by exact_mod_cast hcut.1
|
| 203 |
+
have hu : (2:ℝ)*(z.1 j:ℝ)<(X j:ℝ)^2 := by exact_mod_cast hcut.2
|
| 204 |
+
constructor <;> nlinarith [(hdy j).1,(hdy j).2]
|
| 205 |
+
· intro τ hτ hτ'
|
| 206 |
+
by_contra hn
|
| 207 |
+
have hbad : (expose L M R z).left R/τ<Xp+2*R ∨
|
| 208 |
+
(Xp:ℝ)^2-2*R<((expose L M R z).left R+(expose L M R z).width R)/τ := by
|
| 209 |
+
rcases not_and_or.mp hn with hn | hn
|
| 210 |
+
· exact Or.inl (lt_of_not_ge hn)
|
| 211 |
+
· exact Or.inr (lt_of_not_ge hn)
|
| 212 |
+
have hh := bad_bin_geometry (Xp:ℝ) R (2^m) (∏ j,(expose L M R z).scales j)
|
| 213 |
+
(∏ j,(z.1 j:ℝ)) τ ((expose L M R z).left R) z.2
|
| 214 |
+
(by exact_mod_cast hXp) hRX hR.le (one_le_pow₀ (by norm_num)) hspos
|
| 215 |
+
hprod hprod' hτ hτ' (by exact_mod_cast (Finset.mem_Ico.mp hzP).1) hq hq' hbad
|
| 216 |
+
have he : (2:ℝ)^(m+2)=4*2^m := by rw [pow_add]; norm_num; ring
|
| 217 |
+
apply hpc
|
| 218 |
+
change z.2≤2^(m+2)*Xp ∨ Xp^2≤2^(m+2)*z.2
|
| 219 |
+
rw [←he] at hh
|
| 220 |
+
exact_mod_cast hh
|
| 221 |
+
|
| 222 |
+
lemma bad_good_bound {m : ℕ} (X : Fin m→ℕ) (Xp W : ℕ) (hW : 0<W)
|
| 223 |
+
(hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) (L M : ℤ) (R : ℝ) (hR : 0<R) (hRX : R≤Xp) :
|
| 224 |
+
(jointLaw X Xp W hW hX hXp).real {z | ¬Good X Xp R (expose L M R z)} ≤
|
| 225 |
+
(∑ j,(law (X j) W hW (hX j):Measure ℕ).real (cutoff (X j) 1)) +
|
| 226 |
+
(law Xp W hW hXp:Measure ℕ).real (cutoff Xp (m+2)) := by
|
| 227 |
+
rw [←joint_restrict_domain]
|
| 228 |
+
have hsub : {z | ¬Good X Xp R (expose L M R z)}∩(rawDomain X Xp W:Set _) ⊆
|
| 229 |
+
(⋃ j,{z | z.1 j∈cutoff (X j) 1})∪{z | z.2∈cutoff Xp (m+2)} := by
|
| 230 |
+
intro z hz
|
| 231 |
+
by_contra hn
|
| 232 |
+
have hp : z.2∉cutoff Xp (m+2) := fun h=>hn (Or.inr h)
|
| 233 |
+
have ht : ∀ j,z.1 j∉cutoff (X j) 1 := fun j h=>hn (Or.inl (Set.mem_iUnion.mpr ⟨j,h⟩))
|
| 234 |
+
exact hz.1 (good_of_not_cutoff X Xp W (fun j=>by have:=hX j; omega)
|
| 235 |
+
(by omega) L M R hR hRX z hz.2 ht hp)
|
| 236 |
+
calc
|
| 237 |
+
_ ≤ _ := measureReal_mono hsub
|
| 238 |
+
_ ≤ _ := measureReal_union_le _ _
|
| 239 |
+
_ ≤ (∑ j,(jointLaw X Xp W hW hX hXp).real {z | z.1 j∈cutoff (X j) 1})+
|
| 240 |
+
(jointLaw X Xp W hW hX hXp).real {z | z.2∈cutoff Xp (m+2)} :=
|
| 241 |
+
add_le_add (measureReal_iUnion_fintype_le _) le_rfl
|
| 242 |
+
_ = _ := by simp only [tail_marginal,pivot_marginal]
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
theorem raw_good_decay {m : ℕ} (X : ℕ→Fin m→ℕ) (Xp W : ℕ→ℕ)
|
| 247 |
+
(L M : ℕ→ℤ) (R : ℕ→ℝ) (hW : ∀ n,0<W n)
|
| 248 |
+
(hX : ∀ n j,4*W n≤X n j) (hXp : ∀ n,4*W n≤Xp n)
|
| 249 |
+
(hXt : ∀ j,Tendsto (fun n=>X n j) atTop atTop)
|
| 250 |
+
(hXpt : Tendsto Xp atTop atTop) (hR : ∀ n,0<R n) (hRX : ∀ n,R n≤Xp n) :
|
| 251 |
+
Tendsto (fun n=>(jointLaw (X n) (Xp n) (W n) (hW n) (hX n) (hXp n)).real
|
| 252 |
+
{z | ¬Good (X n) (Xp n) (R n) (expose (L n) (M n) (R n) z)}) atTop (𝓝 0)
|
| 253 |
+
:= by
|
| 254 |
+
apply squeeze_zero (fun _=>measureReal_nonneg) (fun n=>
|
| 255 |
+
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))
|
| 256 |
+
have htail := tendsto_finsetSum Finset.univ (fun j _=>
|
| 257 |
+
raw_cutoff_decay (fun n=>X n j) W 1 hW (fun n=>hX n j) (hXt j))
|
| 258 |
+
have hp := raw_cutoff_decay Xp W (m+2) hW hXp hXpt
|
| 259 |
+
simpa using htail.add hp
|
| 260 |
+
|
| 261 |
+
end ProductExposureLabels
|
| 262 |
+
|
| 263 |
+
end
|
| 264 |
+
end
|
| 265 |
+
|
| 266 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/ProductExposure04.lean
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.ResidueAlignment01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
noncomputable section
|
| 9 |
+
end
|
| 10 |
+
|
| 11 |
+
noncomputable section
|
| 12 |
+
namespace ProductExposureLaw
|
| 13 |
+
open MeasureTheory ProductExposureLabels RawHarmonicProbability
|
| 14 |
+
open scoped BigOperators ENNReal
|
| 15 |
+
attribute [local instance] Classical.propDecidable
|
| 16 |
+
|
| 17 |
+
def outsideDomain {h : ℕ} (X : Fin h→ℕ) (W : ℕ) : Finset (Fin h→ℕ) :=
|
| 18 |
+
Fintype.piFinset (fun j=>units (X j) W)
|
| 19 |
+
|
| 20 |
+
def outsideLaw {h : ℕ} (X : Fin h→ℕ) (W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) :
|
| 21 |
+
Measure (Fin h→ℕ) := Measure.pi (fun j=>(law (X j) W hW (hX j):Measure ℕ))
|
| 22 |
+
|
| 23 |
+
instance outsideLaw_probability {h : ℕ} (X : Fin h→ℕ) (W : ℕ) (hW : 0<W)
|
| 24 |
+
(hX : ∀ j,4*W≤X j) : IsProbabilityMeasure (outsideLaw X W hW hX) := by
|
| 25 |
+
unfold outsideLaw
|
| 26 |
+
infer_instance
|
| 27 |
+
|
| 28 |
+
def reassemble {m h n : ℕ} (e : Fin (m+h)≃Fin n)
|
| 29 |
+
(y : Fin h→ℕ) (z : (Fin m→ℕ)×ℕ) : (Fin n→ℕ)×ℕ :=
|
| 30 |
+
(fun j=>Fin.append z.1 y (e.symm j),z.2)
|
| 31 |
+
lemma outside_ae_domain {h : ℕ} (X : Fin h→ℕ) (W : ℕ) (hW : 0<W)
|
| 32 |
+
(hX : ∀ j,4*W≤X j) : ∀ᵐ y ∂outsideLaw X W hW hX,y∈outsideDomain X W := by
|
| 33 |
+
have hh (j : Fin h) : ∀ᵐ y ∂outsideLaw X W hW hX,y j∈units (X j) W :=
|
| 34 |
+
(measurePreserving_eval (fun j=>(law (X j) W hW (hX j):Measure ℕ)) j).quasiMeasurePreserving.ae
|
| 35 |
+
(law_ae_units (X j) W hW (hX j))
|
| 36 |
+
filter_upwards [ae_all_iff.mpr hh] with y hy
|
| 37 |
+
exact Fintype.mem_piFinset.mpr hy
|
| 38 |
+
|
| 39 |
+
lemma outside_weights_sum {h : ℕ} (X : Fin h→ℕ) (W : ℕ) (hW : 0<W)
|
| 40 |
+
(hX : ∀ j,4*W≤X j) :
|
| 41 |
+
∑ y∈outsideDomain X W,(outsideLaw X W hW hX).real {y}=1 := by
|
| 42 |
+
rw [sum_measureReal_singleton]
|
| 43 |
+
have hh : (outsideLaw X W hW hX).real (outsideDomain X W:Set _) =
|
| 44 |
+
(outsideLaw X W hW hX).real Set.univ := by
|
| 45 |
+
apply measureReal_congr
|
| 46 |
+
filter_upwards [outside_ae_domain X W hW hX] with y hy
|
| 47 |
+
change (y∈outsideDomain X W)=(y∈(Set.univ : Set (Fin h→ℕ)))
|
| 48 |
+
exact propext ⟨fun _=>Set.mem_univ _,fun _=>hy⟩
|
| 49 |
+
simpa using hh
|
| 50 |
+
|
| 51 |
+
lemma joint_reassemble {m h n : ℕ} (e : Fin (m+h)≃Fin n)
|
| 52 |
+
(X : Fin n→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp) :
|
| 53 |
+
Measure.map (fun yz=>reassemble e yz.1 yz.2)
|
| 54 |
+
((outsideLaw (fun j : Fin h=>X (e (j.natAdd m))) W hW (fun _=>hX _)).prod
|
| 55 |
+
(jointLaw (fun j : Fin m=>X (e (j.castAdd h))) Xp W hW (fun _=>hX _) hXp)) =
|
| 56 |
+
jointLaw X Xp W hW hX hXp := by
|
| 57 |
+
apply Measure.ext_of_singleton
|
| 58 |
+
intro z
|
| 59 |
+
rw [Measure.map_apply (measurable_of_countable _) (measurableSet_singleton _)]
|
| 60 |
+
have he : (fun yz=>reassemble e yz.1 yz.2) ⁻¹' {z} =
|
| 61 |
+
{fun j : Fin h=>z.1 (e (j.natAdd m))} ×ˢ
|
| 62 |
+
{(fun j : Fin m=>z.1 (e (j.castAdd h)),z.2)} := by
|
| 63 |
+
ext yz
|
| 64 |
+
constructor
|
| 65 |
+
· intro hy
|
| 66 |
+
change reassemble e yz.1 yz.2=z at hy
|
| 67 |
+
have h1 := congrArg Prod.fst hy
|
| 68 |
+
have h2 := congrArg Prod.snd hy
|
| 69 |
+
refine ⟨?_,?_⟩
|
| 70 |
+
· apply funext
|
| 71 |
+
intro j
|
| 72 |
+
have hh := congrFun h1 (e (j.natAdd m))
|
| 73 |
+
simpa [reassemble] using hh
|
| 74 |
+
· apply Prod.ext
|
| 75 |
+
· apply funext
|
| 76 |
+
intro j
|
| 77 |
+
have hh := congrFun h1 (e (j.castAdd h))
|
| 78 |
+
simpa [reassemble] using hh
|
| 79 |
+
· exact h2
|
| 80 |
+
· rintro ⟨hy,hz⟩
|
| 81 |
+
change yz.1=(fun j : Fin h=>z.1 (e (j.natAdd m))) at hy
|
| 82 |
+
change yz.2=(fun j : Fin m=>z.1 (e (j.castAdd h)),z.2) at hz
|
| 83 |
+
change reassemble e yz.1 yz.2=z
|
| 84 |
+
rw [hy,hz]
|
| 85 |
+
apply Prod.ext
|
| 86 |
+
· funext j
|
| 87 |
+
rcases e.surjective j with ⟨i,rfl⟩
|
| 88 |
+
refine Fin.addCases ?_ ?_ i
|
| 89 |
+
· intro a
|
| 90 |
+
simp [reassemble]
|
| 91 |
+
· intro a
|
| 92 |
+
simp [reassemble]
|
| 93 |
+
· rfl
|
| 94 |
+
rw [he,Measure.prod_prod]
|
| 95 |
+
change _ = (jointLaw X Xp W hW hX hXp) {(z.1,z.2)}
|
| 96 |
+
simp only [outsideLaw,jointLaw,←Set.singleton_prod_singleton,Measure.prod_prod,Measure.pi_singleton]
|
| 97 |
+
rw [mul_left_comm,←mul_assoc]
|
| 98 |
+
congr 1
|
| 99 |
+
calc
|
| 100 |
+
_ = ∏ i : Fin (m+h),(law (X (e i)) W hW (hX (e i)):Measure ℕ) {z.1 (e i)} := by
|
| 101 |
+
simpa using (Fin.prod_univ_add (fun i : Fin (m+h)=>
|
| 102 |
+
(law (X (e i)) W hW (hX (e i)):Measure ℕ) {z.1 (e i)})).symm
|
| 103 |
+
_ = _ := e.prod_comp (fun j=>(law (X j) W hW (hX j):Measure ℕ) {z.1 j})
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
theorem joint_outside_disintegration {m h n : ℕ} (e : Fin (m+h)≃Fin n)
|
| 107 |
+
(X : Fin n→ℕ) (Xp W : ℕ) (hW : 0<W) (hX : ∀ j,4*W≤X j) (hXp : 4*W≤Xp)
|
| 108 |
+
(E : Set ((Fin n→ℕ)×ℕ)) :
|
| 109 |
+
let Xi := fun j : Fin m=>X (e (j.castAdd h))
|
| 110 |
+
let Xo := fun j : Fin h=>X (e (j.natAdd m))
|
| 111 |
+
(jointLaw X Xp W hW hX hXp).real E =
|
| 112 |
+
∑ y∈outsideDomain Xo W,(outsideLaw Xo W hW (fun _=>hX _)).real {y} *
|
| 113 |
+
(jointLaw Xi Xp W hW (fun _=>hX _) hXp).real {z | reassemble e y z∈E}
|
| 114 |
+
:= by
|
| 115 |
+
classical
|
| 116 |
+
dsimp only
|
| 117 |
+
have hm := joint_reassemble e X Xp W hW hX hXp
|
| 118 |
+
rw [←hm,measureReal_def,Measure.map_apply (measurable_of_countable _) MeasurableSet.of_discrete,
|
| 119 |
+
Measure.prod_apply MeasurableSet.of_discrete]
|
| 120 |
+
conv_lhs => rw [←Measure.restrict_eq_self_of_ae_mem
|
| 121 |
+
(outside_ae_domain (fun j : Fin h=>X (e (j.natAdd m))) W hW (fun j=>hX _))]
|
| 122 |
+
rw [lintegral_finset,ENNReal.toReal_sum]
|
| 123 |
+
· apply Finset.sum_congr rfl
|
| 124 |
+
intro y hy
|
| 125 |
+
rw [ENNReal.toReal_mul,mul_comm]
|
| 126 |
+
rfl
|
| 127 |
+
· intro y hy
|
| 128 |
+
exact ENNReal.mul_ne_top (by finiteness) (by finiteness)
|
| 129 |
+
|
| 130 |
+
end ProductExposureLaw
|
| 131 |
+
end
|
| 132 |
+
|
| 133 |
+
noncomputable section
|
| 134 |
+
namespace RoughArrayFace
|
| 135 |
+
open RationalLattice MalcevCharacters RoughFaceShift RoughTopologicalFace RoughArrayCoordinates SourceResidueAlignment
|
| 136 |
+
open RoughScales RoughSamplingWeights FinitePieceAverages RoughSourceExceptional RoughProductRemoval
|
| 137 |
+
open ProductExposureLabels ProductExposureLaw ProductExposureCutoff MeasureTheory Filter
|
| 138 |
+
open scoped BigOperators Topology
|
| 139 |
+
attribute [local instance] Classical.propDecidable
|
| 140 |
+
variable {ι : Type} [Fintype ι] (G : ι→Type) [∀ i,Group (G i)]
|
| 141 |
+
variable [∀ i,TopologicalSpace (G i)] [∀ i,IsTopologicalGroup (G i)]
|
| 142 |
+
variable (n : ι→ℕ) (q : ℕ) (c : ∀ i,RealCoordinates (G i) (n i))
|
| 143 |
+
variable (hsk : ∀ i,SecondKind (c i)) (A : ∀ i,CubeFaces.Filtration (G i))
|
| 144 |
+
variable (w : ∀ i,Fin (n i)→ℕ)
|
| 145 |
+
variable (hA : ∀ i k (g : G i),g∈(A i).level k ↔ ∀ j,w i j<k → (c i).coord g j=0)
|
| 146 |
+
variable (hw : ∀ i j,0<w i j) (Γ : ∀ i,Subgroup (G i))
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
theorem source_full_earlier_face_decay
|
| 150 |
+
(hΓ : ∀ i g,g∈Γ i ↔ ∀ j,∃ z : ℤ,(c i).coord g j=z)
|
| 151 |
+
[MetricSpace ((Carrier G n q c hsk A w hA)⧸lattice G n q c hsk A w hA Γ)]
|
| 152 |
+
(htop : (inferInstance : MetricSpace
|
| 153 |
+
((Carrier G n q c hsk A w hA)⧸lattice G n q c hsk A w hA Γ)).toUniformSpace.toTopologicalSpace =
|
| 154 |
+
QuotientGroup.instTopologicalSpace (lattice G n q c hsk A w hA Γ))
|
| 155 |
+
(m h a v d : ℕ) (perm : Fin (m+h)≃Fin a) (hd : 0<d) (c₀ C₀ : ℝ) (B : NNReal) (η : ℝ)
|
| 156 |
+
(hc₀ : 0<c₀) (hC₀ : 0<C₀) (hB : 0<B) (hη : 0<η)
|
| 157 |
+
(w0 M Xp : ℕ→ℕ) (X : ℕ→Fin a→ℕ) (R Q : ℕ→ℝ) (L : ℕ→ℤ)
|
| 158 |
+
(hw0 : Tendsto w0 atTop atTop)
|
| 159 |
+
(hX : ∀ N j,4*primorial (w0 N)≤X N j) (hXp : ∀ N,4*primorial (w0 N)≤Xp N)
|
| 160 |
+
(hXt : ∀ j,Tendsto (fun N=>X N j) atTop atTop) (hXpt : Tendsto Xp atTop atTop)
|
| 161 |
+
(hR : ∀ N,0<R N) (hRX : Tendsto (fun N=>R N/(Xp N:ℝ)) atTop (𝓝 0))
|
| 162 |
+
(hZ : ∀ a : ℝ,0<a →Tendsto (fun N=>(R N/(M N:ℝ))/
|
| 163 |
+
(1+∑ j : Fin m,(X N (perm (j.castAdd h)):ℝ)^2)^a) atTop atTop)
|
| 164 |
+
(hQ0 : ∀ N,0≤Q N)
|
| 165 |
+
(hSize : Tendsto (fun N=>(Q N+(∏ l : Fin m,(X N (perm (l.castAdd h)):ℝ)^2)*(L N:ℝ))/R N) atTop (𝓝 0))
|
| 166 |
+
(hWM : ∀ N,(primorial (w0 N):ℤ)∣(M N:ℤ))
|
| 167 |
+
(hM : ∀ N,0<M N) (hMs : ∀ N,Smooth (w0 N) (M N:ℤ))
|
| 168 |
+
(hL : ∀ N,0<L N) (hsm : ∀ N,Smooth (w0 N) (L N))
|
| 169 |
+
(hWL : ∀ N,(primorial (w0 N):ℤ)∣L N)
|
| 170 |
+
(hML : ∀ N,(M N:ℤ)∣L N)
|
| 171 |
+
(hLexact : ∀ N,L N=(M N:ℤ)*(primorial (w0 N):ℤ)^(w0 N))
|
| 172 |
+
(hXL : ∀ j : Fin m,Tendsto (fun N=>(X N (perm (j.castAdd h)):ℝ)/(L N:ℝ)) atTop atTop)
|
| 173 |
+
(pattern : ι→Fin (v+1)→ℤ) (e : Fin q) (j : Fin (v+1))
|
| 174 |
+
(g x : ℕ→(Fin h→ℕ)→Label m→∀ i,G i) (b0 b1 : ℕ→(Fin h→ℕ)→Label m→ι→ℝ)
|
| 175 |
+
(qval : ℕ→(Fin h→ℕ)→Label m→Fin q→ℤ)
|
| 176 |
+
(hQ : ∀ N y,y∈outsideDomain (fun l : Fin h=>X N (perm (l.natAdd m))) (primorial (w0 N)) →
|
| 177 |
+
∀ b,b∈(fullDomain (fun l : Fin m=>X N (perm (l.castAdd h))) (Xp N) (primorial (w0 N))).image
|
| 178 |
+
(expose (L N) (M N:ℤ) (R N)) →∀ k,|(qval N y b k:ℝ)|≤Q N) :
|
| 179 |
+
Tendsto (fun N=>(jointLaw (X N) (Xp N) (primorial (w0 N)) (primorial_pos _)
|
| 180 |
+
(hX N) (hXp N)).real {z |
|
| 181 |
+
let y := fun l : Fin h=>z.1 (perm (l.natAdd m))
|
| 182 |
+
(fun l : Fin m=>z.1 (perm (l.castAdd h)),z.2)∈
|
| 183 |
+
rawPhysicalEvent (lattice G n q c hsk A w hA Γ) m v c₀ C₀ B η (R N) d (M N) (L N)
|
| 184 |
+
(fun b=>actualData G n q c hsk A w hA hw Γ pattern (g N y b) (x N y b)
|
| 185 |
+
(b0 N y b) (b1 N y b) (fun k=>(qval N y b k:ℝ)/(M N:ℝ))
|
| 186 |
+
(fun k=>-(residueData (L N) (qval N y b k) b:ℝ)/(M N:ℝ)) e j
|
| 187 |
+
(coarseOrigin v (M N) (R N) b) (shift (M N) (L N) (qval N y b e) b))})
|
| 188 |
+
atTop (𝓝 0)
|
| 189 |
+
:= by
|
| 190 |
+
classical
|
| 191 |
+
let Xo (N : ℕ) (l : Fin h) := X N (perm (l.natAdd m))
|
| 192 |
+
let Xi (N : ℕ) (l : Fin m) := X N (perm (l.castAdd h))
|
| 193 |
+
let κ (N : ℕ) := ↥(outsideDomain (Xo N) (primorial (w0 N)))
|
| 194 |
+
let p (N : ℕ) (y : κ N) :=
|
| 195 |
+
(outsideLaw (Xo N) (primorial (w0 N)) (primorial_pos _) (fun l=>hX N _)).real {y.val}
|
| 196 |
+
have hsum (N : ℕ) (f : (Fin h→ℕ)→ℝ) :
|
| 197 |
+
∑ y : κ N,f y.val = ∑ y∈outsideDomain (Xo N) (primorial (w0 N)),f y := by
|
| 198 |
+
exact (Finset.sum_subtype _ (fun _=>Iff.rfl) f).symm
|
| 199 |
+
have hp (N : ℕ) (y : κ N) : 0≤p N y := measureReal_nonneg
|
| 200 |
+
have hmass (N : ℕ) : ∑ y,p N y=1 := by
|
| 201 |
+
dsimp only [p]
|
| 202 |
+
exact (hsum N (fun y=>(outsideLaw (Xo N) (primorial (w0 N))
|
| 203 |
+
(primorial_pos _) (fun l=>hX N _)).real {y})).trans
|
| 204 |
+
(outside_weights_sum (Xo N) (primorial (w0 N)) (primorial_pos _) (fun l=>hX N _))
|
| 205 |
+
have hh := source_outside_conditioning_face_decay G n q c hsk A w hA hw Γ hΓ htop
|
| 206 |
+
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
|
| 207 |
+
(fun l=>hXt _) hXpt hR hRX hZ hQ0 hSize hWM hM hMs hL hsm hWL hML hLexact hXL
|
| 208 |
+
pattern e j κ p hp hmass (fun N y=>g N y.val) (fun N y=>x N y.val)
|
| 209 |
+
(fun N y=>b0 N y.val) (fun N y=>b1 N y.val) (fun N y=>qval N y.val)
|
| 210 |
+
(fun N y=>hQ N y.val y.property)
|
| 211 |
+
apply hh.congr' (Eventually.of_forall (fun N=>?_))
|
| 212 |
+
rw [joint_outside_disintegration perm]
|
| 213 |
+
dsimp only [p]
|
| 214 |
+
rw [hsum N (fun y=>(outsideLaw (Xo N) (primorial (w0 N))
|
| 215 |
+
(primorial_pos _) (fun l=>hX N _)).real {y} *
|
| 216 |
+
(jointLaw (Xi N) (Xp N) (primorial (w0 N)) (primorial_pos _) (fun l=>hX N _) (hXp N)).real
|
| 217 |
+
(rawPhysicalEvent (lattice G n q c hsk A w hA Γ) m v c₀ C₀ B η (R N) d (M N) (L N)
|
| 218 |
+
(fun b=>actualData G n q c hsk A w hA hw Γ pattern (g N y b) (x N y b)
|
| 219 |
+
(b0 N y b) (b1 N y b) (fun k=>(qval N y b k:ℝ)/(M N:ℝ))
|
| 220 |
+
(fun k=>-(residueData (L N) (qval N y b k) b:ℝ)/(M N:ℝ)) e j
|
| 221 |
+
(coarseOrigin v (M N) (R N) b) (shift (M N) (L N) (qval N y b e) b))))]
|
| 222 |
+
apply Finset.sum_congr rfl
|
| 223 |
+
intro y hy
|
| 224 |
+
congr 2
|
| 225 |
+
ext z
|
| 226 |
+
simp only [Set.mem_ofPred_eq,reassemble,Equiv.symm_apply_apply,Fin.append_left,Fin.append_right]
|
| 227 |
+
|
| 228 |
+
end RoughArrayFace
|
| 229 |
+
end
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
noncomputable section
|
| 234 |
+
open MeasureTheory Filter Topology
|
| 235 |
+
open scoped ENNReal BigOperators
|
| 236 |
+
namespace ConditionalDiagonal
|
| 237 |
+
variable (Ω : ℕ → Type) [∀ N,MeasurableSpace (Ω N)]
|
| 238 |
+
variable (μ : ∀ N,Measure (Ω N)) (A : ∀ N,Set (Ω N))
|
| 239 |
+
variable (E : ∀ N,ℕ → Ω N → ℝ) (ε : ℝ≥0∞) (hε : 0<ε)
|
| 240 |
+
variable (hA : ∀ N,ε≤μ N (A N))
|
| 241 |
+
variable (hE : ∀ i δ,0<δ → Tendsto
|
| 242 |
+
(fun N=>μ N {x | δ≤|E N i x|}) atTop (𝓝 0))
|
| 243 |
+
|
| 244 |
+
include hε hA hE in
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
theorem select : ∃ φ : ℕ → ℕ,StrictMono φ ∧ ∃ x : ∀ k,Ω (φ k),
|
| 248 |
+
(∀ k,x k∈A (φ k)) ∧ ∀ i,Tendsto (fun k=>E (φ k) i (x k)) atTop (𝓝 0) := by
|
| 249 |
+
classical
|
| 250 |
+
have hev (k : ℕ) : ∀ᶠ N in atTop,∃ x∈A N,∀ i≤k,|E N i x|<1/((k:ℝ)+1) := by
|
| 251 |
+
let δ : ℝ:=1/((k:ℝ)+1)
|
| 252 |
+
have hδ : 0<δ := by dsimp [δ]; positivity
|
| 253 |
+
have ht : Tendsto (fun N=>∑ i∈Finset.range (k+1),μ N {x | δ≤|E N i x|})
|
| 254 |
+
atTop (𝓝 0) := by
|
| 255 |
+
simpa only [Finset.sum_const_zero] using
|
| 256 |
+
(tendsto_finsetSum (Finset.range (k+1)) (fun i _=>hE i δ hδ))
|
| 257 |
+
filter_upwards [ht.eventually (gt_mem_nhds hε)] with N hN
|
| 258 |
+
let Bad : Set (Ω N):=⋃ i∈Finset.range (k+1),{x | δ≤|E N i x|}
|
| 259 |
+
have hm : μ N Bad<μ N (A N) :=
|
| 260 |
+
(measure_biUnion_finset_le (Finset.range (k+1)) _).trans_lt (hN.trans_le (hA N))
|
| 261 |
+
have hn : ¬A N⊆Bad := fun h=>not_lt_of_ge (measure_mono h) hm
|
| 262 |
+
obtain ⟨x,hx,hxb⟩:=Set.not_subset.mp hn
|
| 263 |
+
refine ⟨x,hx,?_⟩
|
| 264 |
+
intro i hi
|
| 265 |
+
by_contra! h
|
| 266 |
+
exact hxb (Set.mem_iUnion.mpr ⟨i,Set.mem_iUnion.mpr ⟨Finset.mem_range.mpr (by omega),h⟩⟩)
|
| 267 |
+
have hth (k : ℕ) : ∃ T : ℕ,∀ N≥T,∃ x∈A N,∀ i≤k,|E N i x|<1/((k:ℝ)+1) :=
|
| 268 |
+
Filter.eventually_atTop.mp (hev k)
|
| 269 |
+
choose T hT using hth
|
| 270 |
+
let φ (k : ℕ):=k+∑ j∈Finset.range (k+1),T j
|
| 271 |
+
have hφ : StrictMono φ := by
|
| 272 |
+
apply strictMono_nat_of_lt_succ
|
| 273 |
+
intro k
|
| 274 |
+
simp only [φ,Finset.sum_range_succ]
|
| 275 |
+
omega
|
| 276 |
+
have hφT (k : ℕ) : T k≤φ k := by
|
| 277 |
+
have hsum : T k≤∑ j∈Finset.range (k+1),T j :=
|
| 278 |
+
Finset.single_le_sum (fun _ _=>Nat.zero_le _) (Finset.mem_range.mpr (Nat.lt_succ_self k))
|
| 279 |
+
exact hsum.trans (Nat.le_add_left _ _)
|
| 280 |
+
choose x hx hxe using (fun k=>hT k (φ k) (hφT k))
|
| 281 |
+
refine ⟨φ,hφ,x,hx,?_⟩
|
| 282 |
+
intro i
|
| 283 |
+
apply Metric.tendsto_atTop.mpr
|
| 284 |
+
intro δ hδ
|
| 285 |
+
have ht : ∀ᶠ k : ℕ in atTop,1/((k:ℝ)+1)<δ :=
|
| 286 |
+
(tendsto_one_div_add_atTop_nhds_zero_nat (𝕜:=ℝ)).eventually (gt_mem_nhds hδ)
|
| 287 |
+
obtain ⟨N,hN⟩:=Filter.eventually_atTop.mp ht
|
| 288 |
+
refine ⟨max N i,?_⟩
|
| 289 |
+
intro k hk
|
| 290 |
+
simpa only [Real.dist_eq,sub_zero] using
|
| 291 |
+
(hxe k i ((le_max_right N i).trans hk)).trans (hN k ((le_max_left N i).trans hk))
|
| 292 |
+
|
| 293 |
+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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.CubePolynomials01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
open scoped ComplexConjugate
|
| 13 |
+
end
|
| 14 |
+
end
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
section
|
| 19 |
+
noncomputable section
|
| 20 |
+
open scoped BigOperators
|
| 21 |
+
namespace FactorProgression
|
| 22 |
+
open CubeFaces CubePolynomials
|
| 23 |
+
variable {G : Type*} [Group G]
|
| 24 |
+
|
| 25 |
+
lemma affine_polynomial (H : Filtration G) {k : ℕ} {f : ℤ → G}
|
| 26 |
+
(hf : f∈polynomials H k) (a b : ℤ) :
|
| 27 |
+
(fun z => f (a*z+b))∈polynomials H k := by
|
| 28 |
+
rw [mem_polynomials] at hf ⊢
|
| 29 |
+
intro I h n
|
| 30 |
+
convert hf I (fun i => a*h i) (a*n+b) using 1
|
| 31 |
+
ext v
|
| 32 |
+
change f (a*(n+∑ i∈v∩I,h i)+b)=f (a*n+b+∑ i∈v∩I,a*h i)
|
| 33 |
+
rw [← Finset.mul_sum]
|
| 34 |
+
congr 1
|
| 35 |
+
ring
|
| 36 |
+
|
| 37 |
+
lemma conjugate_polynomial (H : Filtration G) (h0 : H.level 0=⊤)
|
| 38 |
+
{f : ℤ → G} (hf : f∈polynomials H 0) (v : G) :
|
| 39 |
+
(fun z => v⁻¹*f z*v)∈polynomials H 0 := by
|
| 40 |
+
have hv : (fun _ : ℤ => v)∈polynomials H 0 := const_mem (by rw [h0]; trivial)
|
| 41 |
+
exact (polynomials H 0).mul_mem ((polynomials H 0).mul_mem ((polynomials H 0).inv_mem hv) hf) hv
|
| 42 |
+
|
| 43 |
+
lemma affine_conjugate_polynomial (H : Filtration G) (h0 : H.level 0=⊤)
|
| 44 |
+
{f : ℤ → G} (hf : f∈polynomials H 0) (a b : ℤ) (v : G) :
|
| 45 |
+
(fun z => v⁻¹*f (a*z+b)*v)∈polynomials H 0 :=
|
| 46 |
+
conjugate_polynomial H h0 (affine_polynomial H hf a b) v
|
| 47 |
+
|
| 48 |
+
lemma factor_coset (Γ : Subgroup G) (e f b v : G)
|
| 49 |
+
(hv : (QuotientGroup.mk b : G⧸Γ)=QuotientGroup.mk v) :
|
| 50 |
+
(QuotientGroup.mk (e*f*b) : G⧸Γ) = (e*v) • QuotientGroup.mk (v⁻¹*f*v) := by
|
| 51 |
+
calc
|
| 52 |
+
_ = (e*f) • (QuotientGroup.mk b : G⧸Γ) := rfl
|
| 53 |
+
_ = (e*f) • QuotientGroup.mk v := by rw [hv]
|
| 54 |
+
_ = QuotientGroup.mk ((e*f)*v) := rfl
|
| 55 |
+
_ = QuotientGroup.mk ((e*v)*(v⁻¹*f*v)) := by congr 1; group
|
| 56 |
+
_ = _ := rfl
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
theorem periodic_factor_coset (Γ : Subgroup G) (f e f' b : ℤ → G)
|
| 61 |
+
(he : ∀ z, f z=e z*f' z*b z) (T : ℤ)
|
| 62 |
+
(hper : Function.Periodic (fun z => (QuotientGroup.mk (b z) : G⧸Γ)) T)
|
| 63 |
+
(r : ℤ) (v : G) (hv : (QuotientGroup.mk (b r) : G⧸Γ)=QuotientGroup.mk v) (z : ℤ) :
|
| 64 |
+
(QuotientGroup.mk (f (T*z+r)) : G⧸Γ) =
|
| 65 |
+
(e (T*z+r)*v) • QuotientGroup.mk (v⁻¹*f' (T*z+r)*v) := by
|
| 66 |
+
rw [he]
|
| 67 |
+
apply factor_coset
|
| 68 |
+
have hh := (hper.int_mul z) r
|
| 69 |
+
have hi : T*z+r=r+z*T := by ring
|
| 70 |
+
rw [hi]
|
| 71 |
+
have hh' : (QuotientGroup.mk (b (r+z*T)) : G⧸Γ)=QuotientGroup.mk (b r) := by simpa using hh
|
| 72 |
+
exact hh'.trans hv
|
| 73 |
+
|
| 74 |
+
end FactorProgression
|
| 75 |
+
end
|
| 76 |
+
end
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
section
|
| 81 |
+
noncomputable section
|
| 82 |
+
open scoped Topology
|
| 83 |
+
namespace CompactActionFreeze
|
| 84 |
+
variable {G V X : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 85 |
+
[NormedAddCommGroup V] [MetricSpace X] [CompactSpace X]
|
| 86 |
+
[MulAction G X] [ContinuousSMul G X]
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
omit [IsTopologicalGroup G] in
|
| 91 |
+
theorem small_displacement [IsTopologicalGroup G] (c : G ≃ₜ V) (hc : c 1=0) (ε : ℝ) (hε : 0<ε) :
|
| 92 |
+
∃ u : ℝ, 0<u ∧ ∀ g : G, ‖c g‖ ≤ u → ∀ x : X, dist (g • x) x ≤ ε := by
|
| 93 |
+
let F : C(V × X,ℝ) := ⟨fun p => dist (c.symm p.1 • p.2) p.2,by fun_prop⟩
|
| 94 |
+
let A : C(V,C(X,ℝ)) := F.curry
|
| 95 |
+
have hA0 : A 0=0 := by
|
| 96 |
+
ext x
|
| 97 |
+
have he : c.symm 0=1 := by rw [← hc,c.symm_apply_apply]
|
| 98 |
+
simp [A,F,ContinuousMap.curry_apply,he]
|
| 99 |
+
obtain ⟨u,hu,hs⟩ := Metric.continuousAt_iff.mp A.continuous.continuousAt ε hε
|
| 100 |
+
refine ⟨u/2,by positivity,fun g hg x => ?_⟩
|
| 101 |
+
have hd : dist (c g) 0<u := by simpa only [dist_zero_right] using (show ‖c g‖<u by linarith)
|
| 102 |
+
have hh := hs hd
|
| 103 |
+
rw [hA0,dist_zero_right] at hh
|
| 104 |
+
have hx := (A (c g)).norm_coe_le_norm x
|
| 105 |
+
have hv : (A (c g)) x=dist (g • x) x := by simp [A,F,ContinuousMap.curry_apply]
|
| 106 |
+
rw [hv,Real.norm_eq_abs,abs_of_nonneg dist_nonneg] at hx
|
| 107 |
+
exact (hx.trans_lt hh).le
|
| 108 |
+
|
| 109 |
+
end CompactActionFreeze
|
| 110 |
+
end
|
| 111 |
+
end
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
section
|
| 116 |
+
noncomputable section
|
| 117 |
+
open scoped BigOperators
|
| 118 |
+
namespace ProgressionPartition
|
| 119 |
+
lemma sum_blocks {M : Type*} [AddCommMonoid M] (f : ℕ → M) (A B : ℕ) :
|
| 120 |
+
(∑ i ∈ Finset.range (A*B), f i) =
|
| 121 |
+
∑ a ∈ Finset.range A, ∑ b ∈ Finset.range B, f (a*B+b) := by
|
| 122 |
+
induction A with
|
| 123 |
+
| zero => simp
|
| 124 |
+
| succ A ih =>
|
| 125 |
+
rw [Nat.succ_mul,Finset.sum_range_add,ih,Finset.sum_range_succ]
|
| 126 |
+
|
| 127 |
+
lemma sum_progressions {M : Type*} [AddCommMonoid M] (f : ℕ → M) (J K T : ℕ) :
|
| 128 |
+
(∑ i ∈ Finset.range (J*K*T), f i) =
|
| 129 |
+
∑ a ∈ Finset.range J, ∑ r ∈ Finset.range T,
|
| 130 |
+
∑ n ∈ Finset.range K, f ((a*K+n)*T+r) := by
|
| 131 |
+
rw [sum_blocks f (J*K) T,sum_blocks (fun i => ∑ r ∈ Finset.range T, f (i*T+r)) J K]
|
| 132 |
+
apply Finset.sum_congr rfl
|
| 133 |
+
intro a ha
|
| 134 |
+
exact Finset.sum_comm
|
| 135 |
+
|
| 136 |
+
lemma residual_bound (f : ℕ → ℂ) (μ : ℂ) (hf : ∀ i, ‖f i‖ ≤ 1) (hμ : ‖μ‖ ≤ 1)
|
| 137 |
+
(A B : ℕ) :
|
| 138 |
+
‖∑ i ∈ Finset.range (A+B), (f i-μ)‖ ≤
|
| 139 |
+
‖∑ i ∈ Finset.range A, (f i-μ)‖+2*B := by
|
| 140 |
+
rw [Finset.sum_range_add]
|
| 141 |
+
refine (norm_add_le _ _).trans (add_le_add le_rfl ?_)
|
| 142 |
+
calc
|
| 143 |
+
_ ≤ ∑ i ∈ Finset.range B, ‖f (A+i)-μ‖ := norm_sum_le _ _
|
| 144 |
+
_ ≤ ∑ _i ∈ Finset.range B, (2:ℝ) := Finset.sum_le_sum (fun i _ =>
|
| 145 |
+
(norm_sub_le _ _).trans (by linarith [hf (A+i)]))
|
| 146 |
+
_ = _ := by simp; ring
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
theorem obstruction (f : ℕ → ℂ) (g : ℕ → ℕ → ℕ → ℂ) (μ : ℂ)
|
| 151 |
+
(J K T N : ℕ) (δ : ℝ) (hδ : 0<δ) (hN : 0<N)
|
| 152 |
+
(hM : J*K*T ≤ N) (hf : ∀ i, ‖f i‖ ≤ 1) (hμ : ‖μ‖ ≤ 1)
|
| 153 |
+
(htail : 2*((N-J*K*T:ℕ):ℝ) ≤ δ*N/4)
|
| 154 |
+
(hfreeze : ∀ a<J, ∀ r<T, ∀ n<K,
|
| 155 |
+
‖f ((a*K+n)*T+r)-g a r n‖ ≤ δ/4)
|
| 156 |
+
(hlarge : δ*N ≤ ‖∑ i ∈ Finset.range N, (f i-μ)‖) :
|
| 157 |
+
∃ a<J, ∃ r<T, δ/4*K ≤ ‖∑ n ∈ Finset.range K, (g a r n-μ)‖ := by
|
| 158 |
+
by_contra hno
|
| 159 |
+
push Not at hno
|
| 160 |
+
have hcell (a : ℕ) (ha : a<J) (r : ℕ) (hr : r<T) :
|
| 161 |
+
‖∑ n ∈ Finset.range K, (f ((a*K+n)*T+r)-μ)‖ ≤ δ/2*K := by
|
| 162 |
+
have he : (∑ n ∈ Finset.range K, (f ((a*K+n)*T+r)-μ)) =
|
| 163 |
+
(∑ n ∈ Finset.range K, (f ((a*K+n)*T+r)-g a r n))+
|
| 164 |
+
∑ n ∈ Finset.range K, (g a r n-μ) := by
|
| 165 |
+
rw [← Finset.sum_add_distrib]
|
| 166 |
+
apply Finset.sum_congr rfl
|
| 167 |
+
intro n hn
|
| 168 |
+
ring
|
| 169 |
+
rw [he]
|
| 170 |
+
calc
|
| 171 |
+
_ ≤ ‖∑ n ∈ Finset.range K, (f ((a*K+n)*T+r)-g a r n)‖+
|
| 172 |
+
‖∑ n ∈ Finset.range K, (g a r n-μ)‖ := norm_add_le _ _
|
| 173 |
+
_ ≤ (∑ n ∈ Finset.range K, δ/4)+δ/4*K := by
|
| 174 |
+
apply add_le_add
|
| 175 |
+
· exact (norm_sum_le _ _).trans (Finset.sum_le_sum (fun n hn => hfreeze a ha r hr n (Finset.mem_range.mp hn)))
|
| 176 |
+
· exact (hno a ha r hr).le
|
| 177 |
+
_ = _ := by simp; ring
|
| 178 |
+
have hblock : ‖∑ i ∈ Finset.range (J*K*T), (f i-μ)‖ ≤ δ/2*(J*K*T:ℕ) := by
|
| 179 |
+
rw [sum_progressions]
|
| 180 |
+
calc
|
| 181 |
+
_ ≤ ∑ a ∈ Finset.range J, ‖∑ r ∈ Finset.range T,
|
| 182 |
+
∑ n ∈ Finset.range K, (f ((a*K+n)*T+r)-μ)‖ := norm_sum_le _ _
|
| 183 |
+
_ ≤ ∑ a ∈ Finset.range J, ∑ r ∈ Finset.range T, δ/2*K := by
|
| 184 |
+
apply Finset.sum_le_sum
|
| 185 |
+
intro a ha
|
| 186 |
+
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)))
|
| 187 |
+
_ = _ := by simp; ring
|
| 188 |
+
have hres := residual_bound f μ hf hμ (J*K*T) (N-J*K*T)
|
| 189 |
+
rw [Nat.add_sub_of_le hM] at hres
|
| 190 |
+
have hm : (J*K*T:ℕ) ≤ (N:ℝ) := by exact_mod_cast hM
|
| 191 |
+
have hn : (0:ℝ)<N := by exact_mod_cast hN
|
| 192 |
+
have hmδ := mul_le_mul_of_nonneg_left hm (show 0 ≤ δ/2 by positivity)
|
| 193 |
+
have hp : 0<δ*(N:ℝ) := mul_pos hδ hn
|
| 194 |
+
linarith
|
| 195 |
+
|
| 196 |
+
end ProgressionPartition
|
| 197 |
+
end
|
| 198 |
+
end
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
section
|
| 203 |
+
noncomputable section
|
| 204 |
+
namespace ProgressionPartition
|
| 205 |
+
lemma radix_lt {a A b B : ℕ} (ha : a<A) (hb : b<B) : a*B+b<A*B := by
|
| 206 |
+
calc
|
| 207 |
+
_ < a*B+B := Nat.add_lt_add_left hb _
|
| 208 |
+
_ = (a+1)*B := by ring
|
| 209 |
+
_ ≤ A*B := Nat.mul_le_mul_right B (by omega)
|
| 210 |
+
|
| 211 |
+
lemma cell_lt {J K T a n r : ℕ} (ha : a<J) (hn : n<K) (hr : r<T) :
|
| 212 |
+
(a*K+n)*T+r<J*K*T := radix_lt (radix_lt ha hn) hr
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
theorem uniform_scales (J Tmax : ℕ) (hJ : 0<J) (hTmax : 0<Tmax)
|
| 217 |
+
(δ : ℝ) (hδ : 0<δ) :
|
| 218 |
+
∃ N₀ : ℕ, 0<N₀ ∧ ∀ N : ℕ, N₀ ≤ N → ∀ T : ℕ, 0<T → T ≤ Tmax →
|
| 219 |
+
let K := N/(J*T)
|
| 220 |
+
0<K ∧ J*K*T ≤ N ∧ N ≤ 2*J*Tmax*K ∧
|
| 221 |
+
2*((N-J*K*T:ℕ):ℝ) ≤ δ*N/4 := by
|
| 222 |
+
obtain ⟨N₀,hN₀⟩ := exists_nat_gt (max ((J*Tmax:ℕ):ℝ) (8*(J*Tmax:ℕ)/δ))
|
| 223 |
+
have h₀ : (J*Tmax:ℕ)<(N₀:ℝ) := lt_of_le_of_lt (le_max_left _ _) hN₀
|
| 224 |
+
have h₁ : 8*(J*Tmax:ℕ)/δ<(N₀:ℝ) := lt_of_le_of_lt (le_max_right _ _) hN₀
|
| 225 |
+
have hn₀ : 0<N₀ := by exact_mod_cast (lt_of_le_of_lt (by positivity : (0:ℝ) ≤ (J*Tmax:ℕ)) h₀)
|
| 226 |
+
refine ⟨N₀,hn₀,fun N hN T hT hTT => ?_⟩
|
| 227 |
+
dsimp only
|
| 228 |
+
have hd : 0<J*T := Nat.mul_pos hJ hT
|
| 229 |
+
have hJN : J*T ≤ N := by
|
| 230 |
+
have hJNm : J*Tmax<N₀ := by exact_mod_cast h₀
|
| 231 |
+
exact (Nat.mul_le_mul_left J hTT).trans (Nat.le_of_lt hJNm |>.trans hN)
|
| 232 |
+
have hK : 0<N/(J*T) := Nat.div_pos hJN hd
|
| 233 |
+
have hM : J*(N/(J*T))*T ≤ N := by
|
| 234 |
+
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)
|
| 235 |
+
have hmod := Nat.mod_lt N hd
|
| 236 |
+
have hid := Nat.mod_add_div N (J*T)
|
| 237 |
+
have hremainder : N-J*(N/(J*T))*T < J*T := by
|
| 238 |
+
have he : J*(N/(J*T))*T=(J*T)*(N/(J*T)) := by ring
|
| 239 |
+
rw [he]
|
| 240 |
+
omega
|
| 241 |
+
refine ⟨hK,hM,?_,?_⟩
|
| 242 |
+
· have hsmall : J*T ≤ J*T*(N/(J*T)) := Nat.le_mul_of_pos_right _ hK
|
| 243 |
+
have hstep : N ≤ 2*J*T*(N/(J*T)) := by nlinarith only [hid,hmod,hsmall]
|
| 244 |
+
exact hstep.trans (Nat.mul_le_mul_right _ (Nat.mul_le_mul_left (2*J) hTT))
|
| 245 |
+
· have he : 8*(J*Tmax:ℕ)/δ ≤ (N:ℝ) := h₁.le.trans (by exact_mod_cast hN)
|
| 246 |
+
have hh : 8*(J*Tmax:ℕ) ≤ (N:ℝ)*δ := (div_le_iff₀ hδ).mp he
|
| 247 |
+
have hr : ((N-J*(N/(J*T))*T:ℕ):ℝ) ≤ (J*Tmax:ℕ) := by
|
| 248 |
+
exact_mod_cast (hremainder.le.trans (Nat.mul_le_mul_left J hTT))
|
| 249 |
+
linarith
|
| 250 |
+
|
| 251 |
+
end ProgressionPartition
|
| 252 |
+
end
|
| 253 |
+
|
| 254 |
+
end
|
| 255 |
+
end
|
| 256 |
+
end
|
| 257 |
+
end
|
| 258 |
+
|
| 259 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/RationalEchelon01.lean
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.WordPlan03
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
noncomputable section
|
| 15 |
+
open MeasureTheory Filter Topology
|
| 16 |
+
open scoped NNReal ENNReal
|
| 17 |
+
namespace AllLevelFactorization.Factorization
|
| 18 |
+
open RationalLattice CubeFaces ResidueCover
|
| 19 |
+
open ConstructedWordPlan.GlobalWordPlan
|
| 20 |
+
open ConstructedWordPlan.AlignmentScales ConstructedWordPlan.RationalPivotPlan
|
| 21 |
+
variable {G : Type} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 22 |
+
variable {k s : ℕ} {c : RealCoordinates G k} {Γ : Subgroup G}
|
| 23 |
+
variable {K : Filtration G} {P : ℕ → ℤ → G} {L : ℕ → ℝ}
|
| 24 |
+
variable (E : Factorization c Γ s K P L)
|
| 25 |
+
variable (C : (r : Fin E.period) → E.ResidueCover r)
|
| 26 |
+
variable [∀ r,MeasurableSpace ((C r).CubeSpace (ι:=Empty))]
|
| 27 |
+
variable [∀ r,BorelSpace ((C r).CubeSpace (ι:=Empty))]
|
| 28 |
+
variable [MeasurableSpace (G⧸Γ)] [BorelSpace (G⧸Γ)]
|
| 29 |
+
variable [CompactSpace (G⧸Γ)] [SecondCountableTopology (G⧸Γ)]
|
| 30 |
+
variable [HasOuterApproxClosed (G⧸Γ)] [MeasurableSingletonClass (G⧸Γ)]
|
| 31 |
+
variable {n r : ℕ} (hs : 1 ≤ s) (D : Pivot n)
|
| 32 |
+
variable (F B : Finset (Scale n))
|
| 33 |
+
variable (q₀ : ℕ) (hq₀ : pivotModulus s r hs D F B∣q₀)
|
| 34 |
+
variable (b : Scale n) (hb : b∈B) {τ : ℝ} (hτ : 0<τ)
|
| 35 |
+
variable (Y : Fin D.targets → Type) [∀ j,TopologicalSpace (Y j)]
|
| 36 |
+
variable [∀ j,MulAction (Shifts D) (Y j)]
|
| 37 |
+
variable (π : (j : Fin D.targets) → (G⧸Γ) → Y j)
|
| 38 |
+
variable (Read : (j : Fin D.targets) → ℚ → Y j × Slots D → Fin r → ℝ)
|
| 39 |
+
variable (hπ : ∀ j,Continuous (π j))
|
| 40 |
+
variable (hRead : ∀ j a t,Continuous (fun y=>Read j a y t))
|
| 41 |
+
variable (hS : ∀ j (a : Shifts D),Continuous (fun y : Y j=>a • y))
|
| 42 |
+
variable (M : ∀ a : Fin E.period,∀ β : ℝ,
|
| 43 |
+
PhysicalMarginalFaceData D (C a).pivotChart.chart (C a).pointFiltration (C a).pointLattice
|
| 44 |
+
π ((C a).pivotImage β) s)
|
| 45 |
+
|
| 46 |
+
include hπ hRead hS M hq₀ hb hτ in
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
theorem physical_pivot_empirical_success_mass (hL : ∀ N,0<L N) (ht : Tendsto L atTop atTop)
|
| 50 |
+
(ReadN : ℕ → (j : Fin D.targets) → ℚ → Y j × Slots D → Fin r → ℝ)
|
| 51 |
+
(he : ∀ᶠ N in atTop,∀ p∈pivotOptions s r hs D F,∀ i x,
|
| 52 |
+
|centerReading D Y π (ReadN N) F q₀ b p i x-centerReading D Y π Read F q₀ b p i x| ≤ τ/4 ∧
|
| 53 |
+
|translatedReading D Y π (ReadN N) F q₀ b p i x-translatedReading D Y π Read F q₀ b p i x| ≤ τ/4) :
|
| 54 |
+
∀ᶠ N in atTop,(((((pivotOptions s r hs D F).card : ℝ≥0)⁻¹/2) : ℝ≥0) : ℝ≥0∞) <
|
| 55 |
+
(E.empiricalPointLaw N : Measure (G⧸Γ))
|
| 56 |
+
(⋃ p∈pivotOptions s r hs D F,AlignmentMass.Success τ
|
| 57 |
+
(centerReading D Y π (ReadN N) F q₀ b p)
|
| 58 |
+
(translatedReading D Y π (ReadN N) F q₀ b p)) := by
|
| 59 |
+
classical
|
| 60 |
+
let O:=↥(pivotOptions s r hs D F)
|
| 61 |
+
let : Nonempty O:=⟨⟨(pivotOptions_nonempty s r hs D F).choose,
|
| 62 |
+
(pivotOptions_nonempty s r hs D F).choose_spec⟩⟩
|
| 63 |
+
let A (p : O):=centerReading D Y π Read F q₀ b p.val
|
| 64 |
+
let T (p : O):=translatedReading D Y π Read F q₀ b p.val
|
| 65 |
+
let AN (N : ℕ) (p : O):=centerReading D Y π (ReadN N) F q₀ b p.val
|
| 66 |
+
let TN (N : ℕ) (p : O):=translatedReading D Y π (ReadN N) F q₀ b p.val
|
| 67 |
+
have hq : 0<((pivotOptions s r hs D F).card : ℝ≥0) := by
|
| 68 |
+
exact_mod_cast Finset.card_pos.mpr (pivotOptions_nonempty s r hs D F)
|
| 69 |
+
have hhalf : (((((pivotOptions s r hs D F).card : ℝ≥0)⁻¹/2) : ℝ≥0) : ℝ≥0∞) <
|
| 70 |
+
(((pivotOptions s r hs D F).card : ℝ≥0)⁻¹ : ℝ≥0∞) :=
|
| 71 |
+
by simpa only [ENNReal.coe_inv (ne_of_gt hq)] using
|
| 72 |
+
(ENNReal.coe_lt_coe.mpr (half_lt_self (inv_pos.mpr hq)))
|
| 73 |
+
have hm:=E.physical_pivot_mixture_mass C hs D F B q₀ hq₀ b hb τ Y π Read hπ hRead hS M
|
| 74 |
+
have hm' : (((pivotOptions s r hs D F).card : ℝ≥0)⁻¹ : ℝ≥0∞) ≤
|
| 75 |
+
(E.pointMixture C : Measure (G⧸Γ)) (⋃ p : O,AlignmentMass.ClosedGood τ (A p) (T p)) := by
|
| 76 |
+
simpa only [O,A,T,Set.iUnion_subtype,closedOption] using hm
|
| 77 |
+
have he' : ∀ᶠ N in atTop,∀ (p : O) i x,
|
| 78 |
+
|AN N p i x-A p i x| ≤ τ/4 ∧ |TN N p i x-T p i x| ≤ τ/4 := by
|
| 79 |
+
filter_upwards [he] with N hN p i x
|
| 80 |
+
exact hN p.val p.property i x
|
| 81 |
+
have hh:=AlignmentMass.eventually_success_mass (E.pointMixture C) E.empiricalPointLaw
|
| 82 |
+
(E.weak_point_law C hL ht) hτ A T AN TN
|
| 83 |
+
(fun p=>centerReading_continuous D π Read hπ hRead F q₀ b p.val)
|
| 84 |
+
(fun p=>translatedReading_continuous D π Read hπ hRead hS F q₀ b p.val)
|
| 85 |
+
he' hhalf hm'
|
| 86 |
+
simpa only [O,AN,TN,Set.iUnion_subtype] using hh
|
| 87 |
+
|
| 88 |
+
end AllLevelFactorization.Factorization
|
| 89 |
+
end
|
| 90 |
+
|
| 91 |
+
end
|
| 92 |
+
|
| 93 |
+
section
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
noncomputable section
|
| 99 |
+
namespace CubeFaces
|
| 100 |
+
variable {G H ι : Type*} [Group G] [Group H] [DecidableEq ι]
|
| 101 |
+
variable (p : G →* H)
|
| 102 |
+
|
| 103 |
+
def vertexMap : (Finset ι → G) →* (Finset ι → H) where
|
| 104 |
+
toFun f w:=p (f w)
|
| 105 |
+
map_one' := by ext w; exact p.map_one
|
| 106 |
+
map_mul' f g:=by ext w; exact p.map_mul _ _
|
| 107 |
+
|
| 108 |
+
omit [DecidableEq ι] in
|
| 109 |
+
@[simp] lemma vertexMap_apply (f : Finset ι → G) (w : Finset ι) :
|
| 110 |
+
vertexMap p f w=p (f w) := rfl
|
| 111 |
+
|
| 112 |
+
lemma vertexMap_face (D : Finset ι) :
|
| 113 |
+
(vertexMap p).comp (face D)=(face D).comp p := by
|
| 114 |
+
ext g w
|
| 115 |
+
simp only [MonoidHom.comp_apply,vertexMap_apply,face_apply]
|
| 116 |
+
split_ifs <;> simp
|
| 117 |
+
|
| 118 |
+
lemma map_cube (K : Filtration G) (L : Filtration H)
|
| 119 |
+
(honto : ∀ j,(K.level j).map p=L.level j) (I : Finset ι) (l : ℕ) :
|
| 120 |
+
(cube K I l).map (vertexMap p)=cube L I l := by
|
| 121 |
+
simp only [cube,Subgroup.map_iSup,Subgroup.map_map,vertexMap_face]
|
| 122 |
+
simp only [←Subgroup.map_map,honto]
|
| 123 |
+
|
| 124 |
+
lemma exists_cube_lift (K : Filtration G) (L : Filtration H)
|
| 125 |
+
(honto : ∀ j,(K.level j).map p=L.level j) (I : Finset ι) (l : ℕ)
|
| 126 |
+
(f : Finset ι → H) (hf : f∈cube L I l) :
|
| 127 |
+
∃ g∈cube K I l,∀ w,p (g w)=f w := by
|
| 128 |
+
rw [←map_cube p K L honto I l] at hf
|
| 129 |
+
obtain ⟨g,hg,he⟩:=hf
|
| 130 |
+
exact ⟨g,hg,fun w=>congrFun he w⟩
|
| 131 |
+
|
| 132 |
+
end CubeFaces
|
| 133 |
+
end
|
| 134 |
+
|
| 135 |
+
end
|
| 136 |
+
|
| 137 |
+
section
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
noncomputable section
|
| 143 |
+
open scoped BigOperators
|
| 144 |
+
namespace RationalEchelon
|
| 145 |
+
|
| 146 |
+
variable {K : Type*} [Field K]
|
| 147 |
+
|
| 148 |
+
structure Chart {n : ℕ} (W : Submodule K (Fin n → K)) where
|
| 149 |
+
dim : ℕ
|
| 150 |
+
pivot : Fin dim → Fin n
|
| 151 |
+
mono : StrictMono pivot
|
| 152 |
+
embed : (Fin dim → K) →ₗ[K] (Fin n → K)
|
| 153 |
+
mem : ∀ x,embed x∈W
|
| 154 |
+
onto : ∀ v∈W,∃ x,embed x=v
|
| 155 |
+
at_pivot : ∀ x i,embed x (pivot i)=x i
|
| 156 |
+
prefix_eq : ∀ j x y,(∀ i,pivot i ≤ j → x i=y i) → embed x j=embed y j
|
| 157 |
+
|
| 158 |
+
def dropLast (n : ℕ) : (Fin (n+1) → K) →ₗ[K] (Fin n → K) where
|
| 159 |
+
toFun x i:=x i.castSucc
|
| 160 |
+
map_add' _ _:=rfl
|
| 161 |
+
map_smul' _ _:=rfl
|
| 162 |
+
|
| 163 |
+
def snocZero (n : ℕ) : (Fin n → K) →ₗ[K] (Fin (n+1) → K) where
|
| 164 |
+
toFun x:=Fin.snoc x 0
|
| 165 |
+
map_add' x y:=by ext i; refine Fin.lastCases ?_ (fun i=>?_) i <;> simp
|
| 166 |
+
map_smul' a x:=by ext i; refine Fin.lastCases ?_ (fun i=>?_) i <;> simp
|
| 167 |
+
|
| 168 |
+
lemma expansion {n : ℕ} (x : Fin n → K) : x=∑ i : Fin n,x i • Pi.single i 1 := by
|
| 169 |
+
ext j
|
| 170 |
+
simp [Finset.sum_apply,Pi.smul_apply,Pi.single_apply]
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
lemma lift {n d : ℕ} (W : Submodule K (Fin (n+1) → K))
|
| 175 |
+
(e : (Fin d → K) →ₗ[K] (Fin n → K))
|
| 176 |
+
(he : ∀ x,e x∈W.map (dropLast n)) :
|
| 177 |
+
∃ f : (Fin d → K) →ₗ[K] (Fin (n+1) → K),
|
| 178 |
+
(∀ x,f x∈W) ∧ ∀ x,dropLast n (f x)=e x := by
|
| 179 |
+
have hex (i : Fin d) : ∃ b∈W,dropLast n b=e (Pi.single i 1) :=
|
| 180 |
+
Submodule.mem_map.mp (he _)
|
| 181 |
+
choose b hb hpb using hex
|
| 182 |
+
let f : (Fin d → K) →ₗ[K] (Fin (n+1) → K):=
|
| 183 |
+
∑ i : Fin d,(LinearMap.proj i).smulRight (b i)
|
| 184 |
+
have hf (x) : f x=∑ i : Fin d,x i • b i := by simp [f,LinearMap.sum_apply]
|
| 185 |
+
refine ⟨f,?_,?_⟩
|
| 186 |
+
· intro x
|
| 187 |
+
rw [hf]
|
| 188 |
+
exact W.sum_mem (fun i _=>W.smul_mem _ (hb i))
|
| 189 |
+
· intro x
|
| 190 |
+
rw [hf,map_sum]
|
| 191 |
+
simp only [map_smul,hpb]
|
| 192 |
+
conv_rhs=>rw [expansion x,map_sum]
|
| 193 |
+
simp
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
theorem chart_exists {n : ℕ} (W : Submodule K (Fin n → K)) : Nonempty (Chart W) := by
|
| 198 |
+
induction n with
|
| 199 |
+
| zero =>
|
| 200 |
+
exact ⟨{ dim:=0
|
| 201 |
+
pivot:=Fin.elim0
|
| 202 |
+
mono:=by intro i; exact Fin.elim0 i
|
| 203 |
+
embed:=0
|
| 204 |
+
mem:=by intro x; exact W.zero_mem
|
| 205 |
+
onto:=by intro v hv; exact ⟨Fin.elim0,Subsingleton.elim _ _⟩
|
| 206 |
+
at_pivot:=by intro x i; exact Fin.elim0 i
|
| 207 |
+
prefix_eq:=by intro j; exact Fin.elim0 j }⟩
|
| 208 |
+
| succ n ih =>
|
| 209 |
+
let V:=W.map (dropLast n)
|
| 210 |
+
obtain ⟨E⟩:=ih V
|
| 211 |
+
obtain ⟨f,hf,hpf⟩:=lift W E.embed E.mem
|
| 212 |
+
by_cases hker : ∀ v∈W,dropLast n v=0 → v=0
|
| 213 |
+
· have hinj : ∀ u∈W,∀ v∈W,dropLast n u=dropLast n v → u=v := by
|
| 214 |
+
intro u hu v hv huv
|
| 215 |
+
apply sub_eq_zero.mp
|
| 216 |
+
apply hker (u-v) (W.sub_mem hu hv)
|
| 217 |
+
rw [map_sub,huv,sub_self]
|
| 218 |
+
refine ⟨{ dim:=E.dim
|
| 219 |
+
pivot:=fun i=>(E.pivot i).castSucc
|
| 220 |
+
mono:=by intro i j hij; exact E.mono hij
|
| 221 |
+
embed:=f
|
| 222 |
+
mem:=hf
|
| 223 |
+
onto:=?_
|
| 224 |
+
at_pivot:=?_
|
| 225 |
+
prefix_eq:=?_ }⟩
|
| 226 |
+
· intro v hv
|
| 227 |
+
obtain ⟨x,hx⟩:=E.onto (dropLast n v) (Submodule.mem_map.mpr ⟨v,hv,rfl⟩)
|
| 228 |
+
exact ⟨x,hinj _ (hf _) _ hv ((hpf x).trans hx)⟩
|
| 229 |
+
· intro x i
|
| 230 |
+
exact (congrFun (hpf x) (E.pivot i)).trans (E.at_pivot x i)
|
| 231 |
+
· intro j x y hxy
|
| 232 |
+
revert hxy
|
| 233 |
+
refine Fin.lastCases ?_ (fun j=>?_) j <;> intro hxy
|
| 234 |
+
· have he : x=y:=funext fun i=>hxy i (Fin.le_last _)
|
| 235 |
+
rw [he]
|
| 236 |
+
· exact (congrFun (hpf x) j).trans ((E.prefix_eq j x y (fun i hi=>hxy i hi)).trans
|
| 237 |
+
(congrFun (hpf y) j).symm)
|
| 238 |
+
· push Not at hker
|
| 239 |
+
obtain ⟨v,hv,hpv,hv0⟩:=hker
|
| 240 |
+
have hvl : v (Fin.last n)≠0 := by
|
| 241 |
+
intro hh
|
| 242 |
+
apply hv0
|
| 243 |
+
ext i
|
| 244 |
+
refine Fin.lastCases hh (fun i=>?_) i
|
| 245 |
+
exact congrFun hpv i
|
| 246 |
+
have haxis : Pi.single (Fin.last n) (1:K)∈W := by
|
| 247 |
+
have he : (v (Fin.last n))⁻¹ • v=Pi.single (Fin.last n) 1 := by
|
| 248 |
+
ext i
|
| 249 |
+
refine Fin.lastCases ?_ (fun i=>?_) i
|
| 250 |
+
· simp [hvl]
|
| 251 |
+
· have hz : v i.castSucc=0:=congrFun hpv i
|
| 252 |
+
simp [hz,Fin.castSucc_ne_last]
|
| 253 |
+
rw [← he]
|
| 254 |
+
exact W.smul_mem _ hv
|
| 255 |
+
have hzero (x : Fin E.dim → K) : snocZero n (E.embed x)∈W := by
|
| 256 |
+
have hx:=hf x
|
| 257 |
+
have he : snocZero n (E.embed x)=f x-f x (Fin.last n) • Pi.single (Fin.last n) 1 := by
|
| 258 |
+
ext i
|
| 259 |
+
refine Fin.lastCases ?_ (fun i=>?_) i
|
| 260 |
+
· simp [snocZero]
|
| 261 |
+
· have hh:=congrFun (hpf x) i
|
| 262 |
+
simpa [snocZero,dropLast,Fin.castSucc_ne_last] using hh.symm
|
| 263 |
+
rw [he]
|
| 264 |
+
exact W.sub_mem hx (W.smul_mem _ haxis)
|
| 265 |
+
let e : (Fin (E.dim+1) → K) →ₗ[K] (Fin (n+1) → K) :=
|
| 266 |
+
(snocZero n).comp (E.embed.comp (dropLast E.dim)) +
|
| 267 |
+
(LinearMap.proj (Fin.last E.dim)).smulRight (Pi.single (Fin.last n) 1)
|
| 268 |
+
have he (x : Fin (E.dim+1) → K) : e x=Fin.snoc (E.embed (dropLast E.dim x)) (x (Fin.last E.dim)) := by
|
| 269 |
+
ext i
|
| 270 |
+
refine Fin.lastCases ?_ (fun i=>?_) i <;>
|
| 271 |
+
simp [e,snocZero,Fin.castSucc_ne_last]
|
| 272 |
+
let p : Fin (E.dim+1) → Fin (n+1):=Fin.snoc (fun i=>(E.pivot i).castSucc) (Fin.last n)
|
| 273 |
+
refine ⟨{ dim:=E.dim+1
|
| 274 |
+
pivot:=p
|
| 275 |
+
mono:=?_
|
| 276 |
+
embed:=e
|
| 277 |
+
mem:=?_
|
| 278 |
+
onto:=?_
|
| 279 |
+
at_pivot:=?_
|
| 280 |
+
prefix_eq:=?_ }⟩
|
| 281 |
+
· intro i j hij
|
| 282 |
+
revert hij
|
| 283 |
+
refine Fin.lastCases ?_ (fun j=>?_) j <;> intro hij
|
| 284 |
+
· have hi : i≠Fin.last E.dim:=ne_of_lt hij
|
| 285 |
+
obtain ⟨i,rfl⟩:=Fin.eq_castSucc_of_ne_last hi
|
| 286 |
+
simp [p]
|
| 287 |
+
· revert hij
|
| 288 |
+
refine Fin.lastCases ?_ (fun i=>?_) i <;> intro hij
|
| 289 |
+
· exact False.elim (not_lt_of_ge (Fin.le_last _) hij)
|
| 290 |
+
· simpa [p] using E.mono hij
|
| 291 |
+
· intro x
|
| 292 |
+
exact W.add_mem (hzero _) (W.smul_mem _ haxis)
|
| 293 |
+
· intro y hy
|
| 294 |
+
obtain ⟨x,hx⟩:=E.onto (dropLast n y) (Submodule.mem_map.mpr ⟨y,hy,rfl⟩)
|
| 295 |
+
refine ⟨Fin.snoc x (y (Fin.last n)),?_⟩
|
| 296 |
+
rw [he]
|
| 297 |
+
have hd : dropLast E.dim (Fin.snoc x (y (Fin.last n)))=x:=by ext i; simp [dropLast]
|
| 298 |
+
rw [hd,hx]
|
| 299 |
+
ext i
|
| 300 |
+
refine Fin.lastCases ?_ (fun i=>?_) i <;> simp [dropLast]
|
| 301 |
+
· intro x i
|
| 302 |
+
refine Fin.lastCases ?_ (fun i=>?_) i
|
| 303 |
+
· simp [he,p]
|
| 304 |
+
· simpa [he,p,dropLast] using E.at_pivot (dropLast E.dim x) i
|
| 305 |
+
· intro j x y hxy
|
| 306 |
+
revert hxy
|
| 307 |
+
refine Fin.lastCases ?_ (fun j=>?_) j <;> intro hxy
|
| 308 |
+
· simp only [he,Fin.snoc_last]
|
| 309 |
+
exact hxy (Fin.last E.dim) (by simp [p])
|
| 310 |
+
· simp only [he,Fin.snoc_castSucc]
|
| 311 |
+
apply E.prefix_eq
|
| 312 |
+
intro i hi
|
| 313 |
+
exact hxy i.castSucc (by simpa [p] using hi)
|
| 314 |
+
|
| 315 |
+
end RationalEchelon
|
| 316 |
+
|
| 317 |
+
end
|
| 318 |
+
end
|
| 319 |
+
end
|
| 320 |
+
|
| 321 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/RationalEchelon02.lean
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.RationalEchelon01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
noncomputable section
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
end
|
| 13 |
+
|
| 14 |
+
end
|
| 15 |
+
|
| 16 |
+
section
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
noncomputable section
|
| 22 |
+
open scoped BigOperators
|
| 23 |
+
namespace RationalMatrix
|
| 24 |
+
variable {n m k : ℕ}
|
| 25 |
+
|
| 26 |
+
def real (f : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) :
|
| 27 |
+
(Fin n → ℝ) →ₗ[ℝ] (Fin m → ℝ) :=
|
| 28 |
+
∑ i : Fin n,(LinearMap.proj i).smulRight (fun j=>(f (Pi.single i 1) j:ℝ))
|
| 29 |
+
|
| 30 |
+
lemma real_apply (f : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) (x : Fin n → ℝ) (j : Fin m) :
|
| 31 |
+
real f x j=∑ i : Fin n,x i*(f (Pi.single i 1) j:ℝ) := by
|
| 32 |
+
simp [real,LinearMap.sum_apply,Finset.sum_apply,Pi.smul_apply,smul_eq_mul]
|
| 33 |
+
|
| 34 |
+
lemma real_single (f : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) (i : Fin n) :
|
| 35 |
+
real f (Pi.single i 1)=fun j=>(f (Pi.single i 1) j:ℝ) := by
|
| 36 |
+
ext j
|
| 37 |
+
simp [real_apply,Pi.single_apply]
|
| 38 |
+
|
| 39 |
+
lemma real_rat (f : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) (x : Fin n → ℚ) :
|
| 40 |
+
real f (fun i=>(x i:ℝ))=fun j=>(f x j:ℝ) := by
|
| 41 |
+
ext j
|
| 42 |
+
rw [real_apply]
|
| 43 |
+
conv_rhs=>rw [RationalEchelon.expansion x,map_sum]
|
| 44 |
+
simp [map_smul,Finset.sum_apply,Pi.smul_apply,smul_eq_mul]
|
| 45 |
+
|
| 46 |
+
lemma real_comp (f : (Fin m → ℚ) →ₗ[ℚ] (Fin k → ℚ))
|
| 47 |
+
(g : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) :
|
| 48 |
+
real (f.comp g)=(real f).comp (real g) := by
|
| 49 |
+
apply (Pi.basisFun ℝ (Fin n)).ext
|
| 50 |
+
intro i
|
| 51 |
+
simp only [Pi.basisFun_apply,real_single,LinearMap.comp_apply]
|
| 52 |
+
exact (real_rat f (g (Pi.single i 1))).symm
|
| 53 |
+
|
| 54 |
+
lemma real_id : real (LinearMap.id : (Fin n → ℚ) →ₗ[ℚ] (Fin n → ℚ))=LinearMap.id := by
|
| 55 |
+
apply (Pi.basisFun ℝ (Fin n)).ext
|
| 56 |
+
intro i
|
| 57 |
+
ext j
|
| 58 |
+
simp [real_single,Pi.basisFun_apply,Pi.single_apply,apply_ite]
|
| 59 |
+
|
| 60 |
+
lemma real_sub (f g : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) :
|
| 61 |
+
real (f-g)=real f-real g := by
|
| 62 |
+
ext x j
|
| 63 |
+
simp [real_apply,mul_sub,Finset.sum_sub_distrib]
|
| 64 |
+
|
| 65 |
+
lemma real_injective : Function.Injective (@real n m) := by
|
| 66 |
+
intro f g h
|
| 67 |
+
apply (Pi.basisFun ℚ (Fin n)).ext
|
| 68 |
+
intro i
|
| 69 |
+
ext j
|
| 70 |
+
have hh:=congrArg (fun p=>(p (Pi.single i 1)) j) h
|
| 71 |
+
simpa only [real_single,Pi.basisFun_apply,Rat.cast_inj] using hh
|
| 72 |
+
|
| 73 |
+
lemma real_injective_of_injective (f : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ))
|
| 74 |
+
(hf : Function.Injective f) : Function.Injective (real f) := by
|
| 75 |
+
obtain ⟨g,hg⟩:=f.exists_leftInverse_of_injective (LinearMap.ker_eq_bot.mpr hf)
|
| 76 |
+
have hh:=congrArg real hg
|
| 77 |
+
rw [real_comp,real_id] at hh
|
| 78 |
+
exact Function.LeftInverse.injective (fun x=>LinearMap.congr_fun hh x)
|
| 79 |
+
|
| 80 |
+
end RationalMatrix
|
| 81 |
+
|
| 82 |
+
namespace RationalEchelon.Chart
|
| 83 |
+
variable {n : ℕ} {W : Submodule ℚ (Fin n → ℚ)} (E : Chart W)
|
| 84 |
+
|
| 85 |
+
def coords : (Fin n → ℚ) →ₗ[ℚ] (Fin E.dim → ℚ) where
|
| 86 |
+
toFun x i:=x (E.pivot i)
|
| 87 |
+
map_add' _ _:=rfl
|
| 88 |
+
map_smul' _ _:=rfl
|
| 89 |
+
|
| 90 |
+
lemma coords_embed (x : Fin E.dim → ℚ) : E.coords (E.embed x)=x := by
|
| 91 |
+
ext i
|
| 92 |
+
exact E.at_pivot x i
|
| 93 |
+
|
| 94 |
+
lemma embed_coords {x : Fin n → ℚ} (hx : x∈W) : E.embed (E.coords x)=x := by
|
| 95 |
+
obtain ⟨y,rfl⟩:=E.onto x hx
|
| 96 |
+
rw [coords_embed]
|
| 97 |
+
|
| 98 |
+
lemma real_coords (x : Fin n → ℝ) (i : Fin E.dim) :
|
| 99 |
+
RationalMatrix.real E.coords x i=x (E.pivot i) := by
|
| 100 |
+
simp [RationalMatrix.real_apply,coords,Pi.single_apply,apply_ite]
|
| 101 |
+
|
| 102 |
+
lemma real_at_pivot (x : Fin E.dim → ℝ) (i : Fin E.dim) :
|
| 103 |
+
RationalMatrix.real E.embed x (E.pivot i)=x i := by
|
| 104 |
+
simp [RationalMatrix.real_apply,E.at_pivot,Pi.single_apply,apply_ite]
|
| 105 |
+
|
| 106 |
+
lemma coeff_zero (j : Fin n) (i : Fin E.dim) (hji : j<E.pivot i) :
|
| 107 |
+
E.embed (Pi.single i 1) j=0 := by
|
| 108 |
+
have hh:=E.prefix_eq j (Pi.single i 1) 0 (by
|
| 109 |
+
intro l hl
|
| 110 |
+
have hli : l≠i:=by intro he; subst l; exact (not_le_of_gt hji hl)
|
| 111 |
+
simp [hli])
|
| 112 |
+
simpa using hh
|
| 113 |
+
|
| 114 |
+
lemma real_prefix (j : Fin n) (x y : Fin E.dim → ℝ)
|
| 115 |
+
(hxy : ∀ i,E.pivot i ≤ j → x i=y i) :
|
| 116 |
+
RationalMatrix.real E.embed x j=RationalMatrix.real E.embed y j := by
|
| 117 |
+
simp only [RationalMatrix.real_apply]
|
| 118 |
+
apply Finset.sum_congr rfl
|
| 119 |
+
intro i hi
|
| 120 |
+
by_cases hij : E.pivot i≤j
|
| 121 |
+
· rw [hxy i hij]
|
| 122 |
+
· rw [E.coeff_zero j i (lt_of_not_ge hij),Rat.cast_zero,mul_zero,mul_zero]
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
def normal : (Fin n → ℚ) →ₗ[ℚ] (Fin n → ℚ) := LinearMap.id-E.embed.comp E.coords
|
| 127 |
+
|
| 128 |
+
lemma normal_apply (x : Fin n → ℚ) : E.normal x=x-E.embed (E.coords x) := rfl
|
| 129 |
+
|
| 130 |
+
lemma normal_pivot (x : Fin n → ℚ) (i : Fin E.dim) : E.normal x (E.pivot i)=0 := by
|
| 131 |
+
simp [normal,coords,E.at_pivot]
|
| 132 |
+
|
| 133 |
+
lemma normal_sub (x : Fin n → ℚ) : x-E.normal x∈W := by
|
| 134 |
+
simpa [normal] using E.mem (E.coords x)
|
| 135 |
+
|
| 136 |
+
lemma normal_eq_zero_iff (x : Fin n → ℚ) : E.normal x=0 ↔ x∈W := by
|
| 137 |
+
constructor
|
| 138 |
+
· intro h
|
| 139 |
+
simpa [h] using E.normal_sub x
|
| 140 |
+
· intro hx
|
| 141 |
+
rw [normal_apply,E.embed_coords hx,sub_self]
|
| 142 |
+
|
| 143 |
+
lemma real_normal (x : Fin n → ℝ) :
|
| 144 |
+
RationalMatrix.real E.normal x=x-RationalMatrix.real E.embed (fun i=>x (E.pivot i)) := by
|
| 145 |
+
rw [normal,RationalMatrix.real_sub,RationalMatrix.real_id,RationalMatrix.real_comp]
|
| 146 |
+
have hh : RationalMatrix.real E.coords x=(fun i=>x (E.pivot i)):=funext (E.real_coords x)
|
| 147 |
+
change x-RationalMatrix.real E.embed (RationalMatrix.real E.coords x)=_
|
| 148 |
+
rw [hh]
|
| 149 |
+
|
| 150 |
+
lemma real_normal_pivot (x : Fin n → ℝ) (i : Fin E.dim) :
|
| 151 |
+
RationalMatrix.real E.normal x (E.pivot i)=0 := by
|
| 152 |
+
rw [E.real_normal]
|
| 153 |
+
simp [E.real_at_pivot]
|
| 154 |
+
|
| 155 |
+
lemma real_normal_tail (q : ℕ) (x : Fin n → ℝ) (hx : ∀ j : Fin n,j.val<q → x j=0) :
|
| 156 |
+
∀ j : Fin n,j.val<q → RationalMatrix.real E.normal x j=0 := by
|
| 157 |
+
intro j hj
|
| 158 |
+
rw [E.real_normal]
|
| 159 |
+
change x j-RationalMatrix.real E.embed (fun i=>x (E.pivot i)) j=0
|
| 160 |
+
rw [hx j hj]
|
| 161 |
+
have he:=E.real_prefix j (fun i=>x (E.pivot i)) 0 (by
|
| 162 |
+
intro i hi
|
| 163 |
+
exact hx _ (lt_of_le_of_lt hi hj))
|
| 164 |
+
simpa using congrArg Neg.neg he
|
| 165 |
+
|
| 166 |
+
end RationalEchelon.Chart
|
| 167 |
+
end
|
| 168 |
+
|
| 169 |
+
end
|
| 170 |
+
|
| 171 |
+
section
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
noncomputable section
|
| 177 |
+
open scoped BigOperators
|
| 178 |
+
namespace RationalMatrix
|
| 179 |
+
variable {a b : ℕ}
|
| 180 |
+
def select (u : Fin a → Fin b) : (Fin b → ℚ) →ₗ[ℚ] (Fin a → ℚ) where
|
| 181 |
+
toFun x i:=x (u i)
|
| 182 |
+
map_add' _ _:=rfl
|
| 183 |
+
map_smul' _ _:=rfl
|
| 184 |
+
lemma real_select (u : Fin a → Fin b) (x : Fin b → ℝ) (i : Fin a) :
|
| 185 |
+
real (select u) x i=x (u i) := by
|
| 186 |
+
simp [real_apply,select,Pi.single_apply,apply_ite]
|
| 187 |
+
end RationalMatrix
|
| 188 |
+
|
| 189 |
+
namespace RationalEchelon.Chart
|
| 190 |
+
variable {n : ℕ} {W : Submodule ℚ (Fin n → ℚ)} (E : Chart W)
|
| 191 |
+
|
| 192 |
+
def freeSet : Finset (Fin n):=Finset.univ.filter (fun j=>j∉Set.range E.pivot)
|
| 193 |
+
def free : Fin E.freeSet.card ↪o Fin n:=E.freeSet.orderEmbOfFin rfl
|
| 194 |
+
|
| 195 |
+
lemma free_ne_pivot (i : Fin E.freeSet.card) (j : Fin E.dim) : E.free i≠E.pivot j := by
|
| 196 |
+
have hh:=(Finset.mem_filter.mp (E.freeSet.orderEmbOfFin_mem rfl i)).2
|
| 197 |
+
exact fun he=>hh ⟨j,he.symm⟩
|
| 198 |
+
|
| 199 |
+
lemma pivot_or_free (j : Fin n) :
|
| 200 |
+
(∃ i : Fin E.dim,E.pivot i=j) ∨ ∃ i : Fin E.freeSet.card,E.free i=j := by
|
| 201 |
+
by_cases h : j∈Set.range E.pivot
|
| 202 |
+
· exact Or.inl h
|
| 203 |
+
· right
|
| 204 |
+
have hh : j∈E.freeSet:=Finset.mem_filter.mpr ⟨Finset.mem_univ _,h⟩
|
| 205 |
+
have he:=E.freeSet.range_orderEmbOfFin rfl
|
| 206 |
+
change j∈Set.range E.free
|
| 207 |
+
rw [show Set.range E.free=E.freeSet from he]
|
| 208 |
+
exact hh
|
| 209 |
+
|
| 210 |
+
def sectionMap : (Fin E.freeSet.card → ℚ) →ₗ[ℚ] (Fin n → ℚ):=
|
| 211 |
+
∑ i : Fin E.freeSet.card,(LinearMap.proj i).smulRight (Pi.single (E.free i) 1)
|
| 212 |
+
|
| 213 |
+
def quotientMap : (Fin n → ℚ) →ₗ[ℚ] (Fin E.freeSet.card → ℚ):=
|
| 214 |
+
(RationalMatrix.select E.free).comp E.normal
|
| 215 |
+
|
| 216 |
+
lemma section_apply (x : Fin E.freeSet.card → ℚ) (j : Fin n) :
|
| 217 |
+
E.sectionMap x j=∑ i : Fin E.freeSet.card,x i*(Pi.single (E.free i) 1 : Fin n → ℚ) j := by
|
| 218 |
+
simp [sectionMap,LinearMap.sum_apply,Finset.sum_apply,Pi.smul_apply,smul_eq_mul]
|
| 219 |
+
|
| 220 |
+
lemma section_free (x : Fin E.freeSet.card → ℚ) (i : Fin E.freeSet.card) :
|
| 221 |
+
E.sectionMap x (E.free i)=x i := by
|
| 222 |
+
simp [E.section_apply,Pi.single_apply,E.free.injective.eq_iff]
|
| 223 |
+
|
| 224 |
+
lemma section_pivot (x : Fin E.freeSet.card → ℚ) (j : Fin E.dim) :
|
| 225 |
+
E.sectionMap x (E.pivot j)=0 := by
|
| 226 |
+
rw [E.section_apply]
|
| 227 |
+
apply Finset.sum_eq_zero
|
| 228 |
+
intro i hi
|
| 229 |
+
simp [(E.free_ne_pivot i j).symm]
|
| 230 |
+
|
| 231 |
+
lemma normal_section (x : Fin E.freeSet.card → ℚ) : E.normal (E.sectionMap x)=E.sectionMap x := by
|
| 232 |
+
have he : E.coords (E.sectionMap x)=0:=funext (E.section_pivot x)
|
| 233 |
+
rw [normal_apply,he,map_zero,sub_zero]
|
| 234 |
+
|
| 235 |
+
lemma quotient_section (x : Fin E.freeSet.card → ℚ) : E.quotientMap (E.sectionMap x)=x := by
|
| 236 |
+
change (RationalMatrix.select E.free) (E.normal (E.sectionMap x))=x
|
| 237 |
+
rw [E.normal_section]
|
| 238 |
+
ext i
|
| 239 |
+
exact E.section_free x i
|
| 240 |
+
|
| 241 |
+
lemma section_quotient (x : Fin n → ℚ) : E.sectionMap (E.quotientMap x)=E.normal x := by
|
| 242 |
+
ext j
|
| 243 |
+
rcases E.pivot_or_free j with ⟨i,rfl⟩|⟨i,rfl⟩
|
| 244 |
+
· rw [E.section_pivot,E.normal_pivot]
|
| 245 |
+
· rw [E.section_free]
|
| 246 |
+
rfl
|
| 247 |
+
|
| 248 |
+
lemma quotient_eq_zero_iff (x : Fin n → ℚ) : E.quotientMap x=0 ↔ x∈W := by
|
| 249 |
+
rw [← E.normal_eq_zero_iff,← E.section_quotient]
|
| 250 |
+
constructor
|
| 251 |
+
· intro h
|
| 252 |
+
rw [h,map_zero]
|
| 253 |
+
· intro hx
|
| 254 |
+
have hh:=congrArg E.quotientMap hx
|
| 255 |
+
simpa only [E.quotient_section,map_zero] using hh
|
| 256 |
+
|
| 257 |
+
lemma remainder_mem (x : Fin n → ℚ) : x-E.sectionMap (E.quotientMap x)∈W := by
|
| 258 |
+
rw [E.section_quotient]
|
| 259 |
+
exact E.normal_sub x
|
| 260 |
+
|
| 261 |
+
lemma real_quotient (x : Fin n → ℝ) (i : Fin E.freeSet.card) :
|
| 262 |
+
RationalMatrix.real E.quotientMap x i=RationalMatrix.real E.normal x (E.free i) := by
|
| 263 |
+
rw [quotientMap,RationalMatrix.real_comp]
|
| 264 |
+
exact RationalMatrix.real_select E.free _ i
|
| 265 |
+
|
| 266 |
+
lemma real_section_free (x : Fin E.freeSet.card → ℝ) (i : Fin E.freeSet.card) :
|
| 267 |
+
RationalMatrix.real E.sectionMap x (E.free i)=x i := by
|
| 268 |
+
simp [RationalMatrix.real_apply,E.section_free,Pi.single_apply,apply_ite]
|
| 269 |
+
|
| 270 |
+
lemma real_section_pivot (x : Fin E.freeSet.card → ℝ) (j : Fin E.dim) :
|
| 271 |
+
RationalMatrix.real E.sectionMap x (E.pivot j)=0 := by
|
| 272 |
+
simp [RationalMatrix.real_apply,E.section_pivot]
|
| 273 |
+
|
| 274 |
+
lemma real_quotient_section (x : Fin E.freeSet.card → ℝ) :
|
| 275 |
+
RationalMatrix.real E.quotientMap (RationalMatrix.real E.sectionMap x)=x := by
|
| 276 |
+
have he : E.quotientMap.comp E.sectionMap=LinearMap.id:=LinearMap.ext E.quotient_section
|
| 277 |
+
have hh:=congrArg RationalMatrix.real he
|
| 278 |
+
rw [RationalMatrix.real_comp,RationalMatrix.real_id] at hh
|
| 279 |
+
exact LinearMap.congr_fun hh x
|
| 280 |
+
|
| 281 |
+
lemma real_section_quotient (x : Fin n → ℝ) :
|
| 282 |
+
RationalMatrix.real E.sectionMap (RationalMatrix.real E.quotientMap x)=RationalMatrix.real E.normal x := by
|
| 283 |
+
have he : E.sectionMap.comp E.quotientMap=E.normal:=LinearMap.ext E.section_quotient
|
| 284 |
+
have hh:=congrArg RationalMatrix.real he
|
| 285 |
+
rw [RationalMatrix.real_comp] at hh
|
| 286 |
+
exact LinearMap.congr_fun hh x
|
| 287 |
+
|
| 288 |
+
lemma real_normal_level (w : Fin n → ℕ) (hw : Monotone w) (l : ℕ) (x : Fin n → ℝ)
|
| 289 |
+
(hx : ∀ j,w j<l → x j=0) : ∀ j,w j<l → RationalMatrix.real E.normal x j=0 := by
|
| 290 |
+
intro j hj
|
| 291 |
+
rw [E.real_normal]
|
| 292 |
+
change x j-RationalMatrix.real E.embed (fun i=>x (E.pivot i)) j=0
|
| 293 |
+
rw [hx j hj]
|
| 294 |
+
have he:=E.real_prefix j (fun i=>x (E.pivot i)) 0 (by
|
| 295 |
+
intro i hi
|
| 296 |
+
exact hx _ (lt_of_le_of_lt (hw hi) hj))
|
| 297 |
+
simpa using congrArg Neg.neg he
|
| 298 |
+
|
| 299 |
+
lemma real_quotient_level (w : Fin n → ℕ) (hw : Monotone w) (l : ℕ) (x : Fin n → ℝ)
|
| 300 |
+
(hx : ∀ j,w j<l → x j=0) :
|
| 301 |
+
∀ i,w (E.free i)<l → RationalMatrix.real E.quotientMap x i=0 := by
|
| 302 |
+
intro i hi
|
| 303 |
+
rw [E.real_quotient]
|
| 304 |
+
exact E.real_normal_level w hw l x hx (E.free i) hi
|
| 305 |
+
|
| 306 |
+
lemma real_section_level (w : Fin n → ℕ) (l : ℕ) (x : Fin E.freeSet.card → ℝ)
|
| 307 |
+
(hx : ∀ i,w (E.free i)<l → x i=0) :
|
| 308 |
+
∀ j,w j<l → RationalMatrix.real E.sectionMap x j=0 := by
|
| 309 |
+
intro j hj
|
| 310 |
+
rcases E.pivot_or_free j with ⟨i,rfl⟩|⟨i,rfl⟩
|
| 311 |
+
· exact E.real_section_pivot x i
|
| 312 |
+
· rw [E.real_section_free]
|
| 313 |
+
exact hx i hj
|
| 314 |
+
|
| 315 |
+
variable {m : ℕ} (p : (Fin n → ℚ) →ₗ[ℚ] (Fin m → ℚ)) (hW : W=LinearMap.ker p)
|
| 316 |
+
include hW in
|
| 317 |
+
lemma section_map_injective : Function.Injective (p.comp E.sectionMap) := by
|
| 318 |
+
have hmem (z : Fin n → ℚ) : z∈W ↔ p z=0 := by rw [hW]; rfl
|
| 319 |
+
intro x y hxy
|
| 320 |
+
have hh : E.sectionMap (x-y)∈W := by
|
| 321 |
+
rw [hmem,map_sub,map_sub,sub_eq_zero]
|
| 322 |
+
exact hxy
|
| 323 |
+
have hz:=(E.quotient_eq_zero_iff _).mpr hh
|
| 324 |
+
rw [E.quotient_section] at hz
|
| 325 |
+
exact sub_eq_zero.mp hz
|
| 326 |
+
|
| 327 |
+
include hW in
|
| 328 |
+
lemma map_section_quotient (x : Fin n → ℚ) : p (E.sectionMap (E.quotientMap x))=p x := by
|
| 329 |
+
have hmem (z : Fin n → ℚ) : z∈W ↔ p z=0 := by rw [hW]; rfl
|
| 330 |
+
have hh:=E.remainder_mem x
|
| 331 |
+
rw [hmem,map_sub,sub_eq_zero] at hh
|
| 332 |
+
exact hh.symm
|
| 333 |
+
|
| 334 |
+
include hW in
|
| 335 |
+
lemma real_map_section_quotient (x : Fin n → ℝ) :
|
| 336 |
+
RationalMatrix.real p (RationalMatrix.real E.sectionMap (RationalMatrix.real E.quotientMap x))=
|
| 337 |
+
RationalMatrix.real p x := by
|
| 338 |
+
have he : (p.comp E.sectionMap).comp E.quotientMap=p:=LinearMap.ext (E.map_section_quotient p hW)
|
| 339 |
+
have hh:=congrArg RationalMatrix.real he
|
| 340 |
+
rw [RationalMatrix.real_comp,RationalMatrix.real_comp] at hh
|
| 341 |
+
exact LinearMap.congr_fun hh x
|
| 342 |
+
|
| 343 |
+
include hW in
|
| 344 |
+
lemma real_kernel_iff (x : Fin n → ℝ) :
|
| 345 |
+
RationalMatrix.real p x=0 ↔ RationalMatrix.real E.quotientMap x=0 := by
|
| 346 |
+
have hi:=RationalMatrix.real_injective_of_injective _ (E.section_map_injective p hW)
|
| 347 |
+
rw [RationalMatrix.real_comp] at hi
|
| 348 |
+
constructor
|
| 349 |
+
· intro hx
|
| 350 |
+
apply hi
|
| 351 |
+
simpa only [LinearMap.comp_apply,map_zero,E.real_map_section_quotient p hW] using hx
|
| 352 |
+
· intro hx
|
| 353 |
+
rw [← E.real_map_section_quotient p hW x,hx,map_zero,map_zero]
|
| 354 |
+
|
| 355 |
+
end RationalEchelon.Chart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| 3 |
+
import OAI.Combinatorics.SumProduct.Alignment.RationalLattice01
|
| 4 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
section
|
| 12 |
+
open scoped commutatorElement
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
section
|
| 18 |
+
open scoped commutatorElement
|
| 19 |
+
noncomputable section
|
| 20 |
+
namespace CubeFaces
|
| 21 |
+
variable {G A : Type*} [Group G] [Group A]
|
| 22 |
+
|
| 23 |
+
def Filtration.pullback (H : Filtration G) (φ : A →* G) : Filtration A where
|
| 24 |
+
level i := (H.level i).comap φ
|
| 25 |
+
antitone i j hij := Subgroup.comap_mono (H.antitone hij)
|
| 26 |
+
commutator_le i j := by
|
| 27 |
+
apply Subgroup.commutator_le.mpr
|
| 28 |
+
intro a ha b hb
|
| 29 |
+
change φ ⁅a,b⁆ ∈ H.level (i+j)
|
| 30 |
+
rw [map_commutatorElement]
|
| 31 |
+
exact H.commutator_le i j (Subgroup.commutator_mem_commutator ha hb)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def Filtration.refine (H : Filtration G) (K : Subgroup G)
|
| 36 |
+
(hcomm : ∀ a b : G, ⁅a,b⁆ ∈ K) : Filtration G where
|
| 37 |
+
level i := if i < 2 then H.level i else H.level i ⊓ K
|
| 38 |
+
antitone := by
|
| 39 |
+
intro i j hij
|
| 40 |
+
by_cases hi : i < 2
|
| 41 |
+
· simp only [hi,ite_true]
|
| 42 |
+
split_ifs
|
| 43 |
+
· exact H.antitone hij
|
| 44 |
+
· exact inf_le_left.trans (H.antitone hij)
|
| 45 |
+
· have hj : ¬ j < 2 := by omega
|
| 46 |
+
simp only [hi,hj,ite_false]
|
| 47 |
+
exact inf_le_inf (H.antitone hij) le_rfl
|
| 48 |
+
commutator_le := by
|
| 49 |
+
intro i j
|
| 50 |
+
apply Subgroup.commutator_le.mpr
|
| 51 |
+
intro a ha b hb
|
| 52 |
+
have hia : a ∈ H.level i := by split_ifs at ha <;> aesop
|
| 53 |
+
have hjb : b ∈ H.level j := by split_ifs at hb <;> aesop
|
| 54 |
+
have hc := H.commutator_le i j (Subgroup.commutator_mem_commutator hia hjb)
|
| 55 |
+
split_ifs
|
| 56 |
+
· exact hc
|
| 57 |
+
· exact ⟨hc,hcomm a b⟩
|
| 58 |
+
end CubeFaces
|
| 59 |
+
|
| 60 |
+
namespace CubePolynomials
|
| 61 |
+
open CubeFaces
|
| 62 |
+
variable {G A : Type*} [Group G] [Group A]
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
theorem pullback_mem (H : Filtration G) (φ : A →* G) (hφ : Function.Injective φ)
|
| 67 |
+
(q k : ℕ) (hbot : H.level (k+q) = ⊥) (f : ℤ → A)
|
| 68 |
+
(hf : (fun n => φ (f n)) ∈ polynomials H k) :
|
| 69 |
+
f ∈ polynomials (H.pullback φ) k := by
|
| 70 |
+
induction q generalizing k f with
|
| 71 |
+
| zero =>
|
| 72 |
+
have he : f = 1 := by
|
| 73 |
+
funext n
|
| 74 |
+
apply hφ
|
| 75 |
+
have hv := eval_mem hf n
|
| 76 |
+
have hb : H.level k = ⊥ := by simpa using hbot
|
| 77 |
+
simpa [hb] using hv
|
| 78 |
+
rw [he]
|
| 79 |
+
exact (polynomials _ _).one_mem
|
| 80 |
+
| succ q ih =>
|
| 81 |
+
apply mem_of_derivatives
|
| 82 |
+
· intro n
|
| 83 |
+
exact eval_mem hf n
|
| 84 |
+
· intro t
|
| 85 |
+
apply ih (k+1) (by convert hbot using 1; congr 1; omega)
|
| 86 |
+
convert derivative_mem hf t using 1
|
| 87 |
+
ext n
|
| 88 |
+
simp [shift,map_mul,map_inv]
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
theorem refine_mem (H : Filtration G) (K : Subgroup G)
|
| 93 |
+
(hcomm : ∀ a b : G, ⁅a,b⁆ ∈ K) (q k : ℕ) (hbot : H.level (k+q) = ⊥)
|
| 94 |
+
(f : ℤ → G) (hf : f ∈ polynomials H k) (hK : ∀ n, f n ∈ K) :
|
| 95 |
+
f ∈ polynomials (H.refine K hcomm) k := by
|
| 96 |
+
induction q generalizing k f with
|
| 97 |
+
| zero =>
|
| 98 |
+
have he : f = 1 := by
|
| 99 |
+
funext n
|
| 100 |
+
have hv := eval_mem hf n
|
| 101 |
+
have hb : H.level k = ⊥ := by simpa using hbot
|
| 102 |
+
simpa [hb] using hv
|
| 103 |
+
rw [he]
|
| 104 |
+
exact (polynomials _ _).one_mem
|
| 105 |
+
| succ q ih =>
|
| 106 |
+
apply mem_of_derivatives
|
| 107 |
+
· intro n
|
| 108 |
+
change f n ∈ (if k < 2 then H.level k else H.level k ⊓ K)
|
| 109 |
+
split_ifs
|
| 110 |
+
· exact eval_mem hf n
|
| 111 |
+
· exact ⟨eval_mem hf n,hK n⟩
|
| 112 |
+
· intro t
|
| 113 |
+
apply ih (k+1) (by convert hbot using 1; congr 1; omega)
|
| 114 |
+
_ (derivative_mem hf t)
|
| 115 |
+
intro n
|
| 116 |
+
exact K.mul_mem (K.inv_mem (hK n)) (hK (n+t))
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
theorem refine_of_linear_coset (H : Filtration G) (K : Subgroup G)
|
| 121 |
+
(hcomm : ∀ a b : G, ⁅a,b⁆ ∈ K) (s : ℕ) (hbot : H.level s = ⊥)
|
| 122 |
+
(f : ℤ → G) (hf : f ∈ polynomials H 0) (a : G) (ha : a ∈ H.level 1)
|
| 123 |
+
(hK : ∀ n, f n * (a^n)⁻¹ ∈ K) : f ∈ polynomials (H.refine K hcomm) 0 := by
|
| 124 |
+
have hl : (fun n : ℤ => a^n) ∈ polynomials H 0 := by
|
| 125 |
+
simpa using NilpotentTaylor.binomial_mem (H:=H) 1 0 a ha
|
| 126 |
+
have hl' : (fun n : ℤ => a^n) ∈ polynomials (H.refine K hcomm) 0 := by
|
| 127 |
+
apply (by simpa using NilpotentTaylor.binomial_mem (H:=H.refine K hcomm) 1 0 a ha)
|
| 128 |
+
have hr := refine_mem H K hcomm s 0 (by simpa using hbot)
|
| 129 |
+
(f*(fun n : ℤ => a^n)⁻¹) ((polynomials H 0).mul_mem hf ((polynomials H 0).inv_mem hl)) hK
|
| 130 |
+
have he : (f*(fun n : ℤ => a^n)⁻¹) * (fun n : ℤ => a^n) = f := by group
|
| 131 |
+
rw [← he]
|
| 132 |
+
exact (polynomials _ _).mul_mem hr hl'
|
| 133 |
+
|
| 134 |
+
end CubePolynomials
|
| 135 |
+
end
|
| 136 |
+
end
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
section
|
| 141 |
+
namespace RationalFactorPeriods
|
| 142 |
+
noncomputable section
|
| 143 |
+
lemma eval_desc (n : ℤ) (j : ℕ) :
|
| 144 |
+
(descPochhammer ℤ j).eval n = (j.factorial : ℤ) * Ring.choose n j := by
|
| 145 |
+
have h := Ring.descPochhammer_eq_factorial_smul_choose n j
|
| 146 |
+
rw [← Polynomial.aeval_eq_smeval] at h
|
| 147 |
+
simpa using h
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
lemma choose_period_dvd (m : ℕ) {j d : ℕ} (hj : j ≤ d) (n : ℤ) :
|
| 152 |
+
(m : ℤ) ∣ Ring.choose (n + (m * d.factorial : ℕ)) j - Ring.choose n j := by
|
| 153 |
+
have h := Polynomial.sub_dvd_eval_sub (n + (m*d.factorial : ℕ)) n
|
| 154 |
+
(descPochhammer ℤ j)
|
| 155 |
+
rw [add_sub_cancel_left,eval_desc,eval_desc,← mul_sub] at h
|
| 156 |
+
have hfac : (j.factorial : ℤ) ∣ (d.factorial : ℤ) :=
|
| 157 |
+
Int.natCast_dvd_natCast.mpr (Nat.factorial_dvd_factorial hj)
|
| 158 |
+
have hdiv : (j.factorial : ℤ) * m ∣ (m*d.factorial : ℕ) := by
|
| 159 |
+
rw [Nat.cast_mul,mul_comm (j.factorial : ℤ)]
|
| 160 |
+
exact mul_dvd_mul_left (m : ℤ) hfac
|
| 161 |
+
exact (Int.mul_dvd_mul_iff_left (by exact_mod_cast j.factorial_ne_zero)).mp (hdiv.trans h)
|
| 162 |
+
|
| 163 |
+
variable {G : Type*} [Group G]
|
| 164 |
+
lemma zpow_eq_of_sub_dvd {a : G} {m : ℕ} (ha : a^m = 1) {u v : ℤ}
|
| 165 |
+
(h : (m : ℤ) ∣ u-v) : a^u = a^v := by
|
| 166 |
+
obtain ⟨z,hz⟩ := h
|
| 167 |
+
have he : u = (m : ℤ)*z+v := by omega
|
| 168 |
+
rw [he,zpow_add,zpow_mul,zpow_natCast,ha,one_zpow,one_mul]
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
def orderedWord {k : ℕ} (a : Fin k → G) (j : Fin k → ℕ) (b : ℤ) : G :=
|
| 173 |
+
((List.finRange k).map (fun i => a i ^ Ring.choose b (j i))).prod
|
| 174 |
+
|
| 175 |
+
lemma orderedWord_map {K : Type*} [Group K] (φ : G →* K) {k : ℕ}
|
| 176 |
+
(a : Fin k → G) (j : Fin k → ℕ) (b : ℤ) :
|
| 177 |
+
φ (orderedWord a j b) = orderedWord (fun i => φ (a i)) j b := by
|
| 178 |
+
simp [orderedWord,map_list_prod,List.map_map,Function.comp_def]
|
| 179 |
+
|
| 180 |
+
lemma orderedWord_congr {k : ℕ} {a a' : Fin k → G}
|
| 181 |
+
(ha : ∀ i, a i = a' i) (j : Fin k → ℕ) (b : ℤ) :
|
| 182 |
+
orderedWord a j b = orderedWord a' j b := by
|
| 183 |
+
have h : a = a' := funext ha
|
| 184 |
+
rw [h]
|
| 185 |
+
|
| 186 |
+
lemma orderedWord_periodic {k : ℕ} (a : Fin k → G) (j : Fin k → ℕ)
|
| 187 |
+
(m s : ℕ) (ha : ∀ i, a i ^ m = 1) (hj : ∀ i, j i ≤ s) :
|
| 188 |
+
Function.Periodic (orderedWord a j) (m * s.factorial : ℕ) := by
|
| 189 |
+
intro b
|
| 190 |
+
unfold orderedWord
|
| 191 |
+
congr 1
|
| 192 |
+
apply List.map_congr_left
|
| 193 |
+
intro i _
|
| 194 |
+
exact zpow_eq_of_sub_dvd (ha i) (choose_period_dvd m (hj i) b)
|
| 195 |
+
|
| 196 |
+
lemma finite_image_periodic {K : Type*} [Group K] [Fintype K]
|
| 197 |
+
(φ : G →* K) {k : ℕ} (a : Fin k → G) (j : Fin k → ℕ)
|
| 198 |
+
(s : ℕ) (hj : ∀ i, j i ≤ s) :
|
| 199 |
+
Function.Periodic (fun b => φ (orderedWord a j b))
|
| 200 |
+
(Fintype.card K * s.factorial : ℕ) := by
|
| 201 |
+
intro b
|
| 202 |
+
simp only [orderedWord_map]
|
| 203 |
+
exact orderedWord_periodic (fun i => φ (a i)) j (Fintype.card K) s
|
| 204 |
+
(fun _ => pow_card_eq_one) hj b
|
| 205 |
+
|
| 206 |
+
lemma finite_image_stabilizes {K : Type*} [Group K] [Finite K]
|
| 207 |
+
(φ : G →* K) {k : ℕ} (a : ℕ → Fin k → G) (j : Fin k → ℕ) :
|
| 208 |
+
∃ u : ℕ → ℕ, StrictMono u ∧ ∀ l b,
|
| 209 |
+
φ (orderedWord (a (u l)) j b) = φ (orderedWord (a (u 0)) j b) := by
|
| 210 |
+
classical
|
| 211 |
+
let F : ℕ → (Fin k → K) := fun l i => φ (a l i)
|
| 212 |
+
obtain ⟨v,hv⟩ := Finite.exists_infinite_fiber F
|
| 213 |
+
have hi : (Set.ofPred (fun l => F l = v)).Infinite := Set.infinite_coe_iff.mp hv
|
| 214 |
+
refine ⟨Nat.nth (fun l => F l = v),Nat.nth_strictMono hi,?_⟩
|
| 215 |
+
intro l b
|
| 216 |
+
simp only [orderedWord_map]
|
| 217 |
+
apply orderedWord_congr
|
| 218 |
+
intro i
|
| 219 |
+
have hl := congrFun (Nat.nth_mem_of_infinite hi l) i
|
| 220 |
+
have hz := congrFun (Nat.nth_mem_of_infinite hi 0) i
|
| 221 |
+
exact hl.trans hz.symm
|
| 222 |
+
|
| 223 |
+
lemma coset_pattern_stabilizes (Γ : Subgroup G) [Γ.FiniteIndex]
|
| 224 |
+
{k : ℕ} (a : ℕ → Fin k → G) (j : Fin k → ℕ)
|
| 225 |
+
(s : ℕ) (hj : ∀ i, j i ≤ s) :
|
| 226 |
+
∃ (u : ℕ → ℕ) (T : ℕ), StrictMono u ∧ 0 < T ∧
|
| 227 |
+
(∀ l b, (QuotientGroup.mk (orderedWord (a (u l)) j b) : G ⧸ Γ) =
|
| 228 |
+
QuotientGroup.mk (orderedWord (a (u 0)) j b)) ∧
|
| 229 |
+
Function.Periodic
|
| 230 |
+
(fun b => (QuotientGroup.mk (orderedWord (a (u 0)) j b) : G ⧸ Γ)) (T : ℤ) := by
|
| 231 |
+
classical
|
| 232 |
+
let : Fintype (G ⧸ Γ) := Fintype.ofFinite _
|
| 233 |
+
let K := Equiv.Perm (G ⧸ Γ)
|
| 234 |
+
let φ : G →* K := MulAction.toPermHom G (G ⧸ Γ)
|
| 235 |
+
obtain ⟨u,hu,he⟩ := finite_image_stabilizes φ a j
|
| 236 |
+
refine ⟨u,Fintype.card K * s.factorial,hu,
|
| 237 |
+
Nat.mul_pos Fintype.card_pos s.factorial_pos,?_,?_⟩
|
| 238 |
+
· intro l b
|
| 239 |
+
have h := congrArg (fun e : K => e (QuotientGroup.mk (1:G))) (he l b)
|
| 240 |
+
simpa [φ,K,MulAction.toPermHom] using h
|
| 241 |
+
· intro b
|
| 242 |
+
have h := congrArg (fun e : K => e (QuotientGroup.mk (1:G)))
|
| 243 |
+
(finite_image_periodic φ (a (u 0)) j s hj b)
|
| 244 |
+
simpa [φ,K,MulAction.toPermHom] using h
|
| 245 |
+
|
| 246 |
+
lemma periodic_mod {α : Type*} {f : ℤ → α} {T : ℤ}
|
| 247 |
+
(hf : Function.Periodic f T) (b : ℤ) : f (b % T) = f b := by
|
| 248 |
+
have h := hf.sub_int_mul_eq (x := b) (b / T)
|
| 249 |
+
simpa [Int.emod_def,mul_comm] using h
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
theorem rational_right_factors [TopologicalSpace G] [IsTopologicalGroup G]
|
| 254 |
+
[PreconnectedSpace G] [LocallyCompactSpace G] [T2Space G] {n k : ℕ}
|
| 255 |
+
(c : RationalLattice.RealCoordinates G n) (Γ : Subgroup G) [DiscreteTopology Γ]
|
| 256 |
+
(hΓrat : Γ ≤ RationalLattice.rationalSubgroup c)
|
| 257 |
+
(C : Set G) (hC : IsCompact C) (hreps : ∀ g : G, ∃ x ∈ C, x⁻¹*g ∈ Γ)
|
| 258 |
+
(v : Fin k → G) (hv : ∀ i, RationalLattice.IsRational c (v i))
|
| 259 |
+
(m : ℕ → Fin k → ℤ) (j : Fin k → ℕ) (s : ℕ) (hj : ∀ i, j i ≤ s) :
|
| 260 |
+
∃ (u : ℕ → ℕ) (T : ℕ) (σ : Fin T → G), StrictMono u ∧ 0 < T ∧
|
| 261 |
+
(∀ r, RationalLattice.IsRational c (σ r)) ∧
|
| 262 |
+
∀ l b, ∃ r : Fin T, (r.val : ℤ) = b % (T : ℤ) ∧
|
| 263 |
+
(QuotientGroup.mk (orderedWord (fun i => v i ^ m (u l) i) j b) : G ⧸ Γ) =
|
| 264 |
+
QuotientGroup.mk (σ r) := by
|
| 265 |
+
classical
|
| 266 |
+
let S := Finset.univ.image v
|
| 267 |
+
have hSrat : ∀ g ∈ S, RationalLattice.IsRational c g := by
|
| 268 |
+
intro g hg
|
| 269 |
+
obtain ⟨i,_,rfl⟩ := Finset.mem_image.mp hg
|
| 270 |
+
exact hv i
|
| 271 |
+
obtain ⟨H,hΓH,hSH,hHrat,hHd,hHi⟩ :=
|
| 272 |
+
RationalLattice.finite_rational_extension c Γ hΓrat C hC hreps S hSrat
|
| 273 |
+
let : (Γ.subgroupOf H).FiniteIndex := hHi
|
| 274 |
+
have hvH (i : Fin k) : v i ∈ H := hSH (Finset.mem_image.mpr ⟨i,Finset.mem_univ _,rfl⟩)
|
| 275 |
+
let a : ℕ → Fin k → H := fun l i => ⟨v i ^ m l i,H.zpow_mem (hvH i) _⟩
|
| 276 |
+
obtain ⟨u,T,hu,hT,hfix,hper⟩ := coset_pattern_stabilizes (Γ.subgroupOf H) a j s hj
|
| 277 |
+
let σ : Fin T → G := fun r => (orderedWord (a (u 0)) j (r.val : ℤ) : H)
|
| 278 |
+
refine ⟨u,T,σ,hu,hT,?_,?_⟩
|
| 279 |
+
· intro r
|
| 280 |
+
exact hHrat (orderedWord (a (u 0)) j (r.val : ℤ)).property
|
| 281 |
+
· intro l b
|
| 282 |
+
have hnonneg : 0 ≤ b % (T : ℤ) := Int.emod_nonneg _ (by omega)
|
| 283 |
+
have hlt : b % (T : ℤ) < T := Int.emod_lt_of_pos _ (by omega)
|
| 284 |
+
let r : Fin T := ⟨(b % (T : ℤ)).toNat,by omega⟩
|
| 285 |
+
have hr : (r.val : ℤ) = b % (T : ℤ) := Int.toNat_of_nonneg hnonneg
|
| 286 |
+
refine ⟨r,hr,?_⟩
|
| 287 |
+
have he : (QuotientGroup.mk (orderedWord (a (u l)) j b) : H ⧸ Γ.subgroupOf H) =
|
| 288 |
+
QuotientGroup.mk (orderedWord (a (u 0)) j (r.val : ℤ)) := by
|
| 289 |
+
rw [hr]
|
| 290 |
+
exact (hfix l b).trans (periodic_mod hper b).symm
|
| 291 |
+
have hmem := QuotientGroup.eq.mp he
|
| 292 |
+
have hquot : (QuotientGroup.mk ((orderedWord (a (u l)) j b : H) : G) : G ⧸ Γ) =
|
| 293 |
+
QuotientGroup.mk (σ r) := QuotientGroup.eq.mpr hmem
|
| 294 |
+
have hmap : ((orderedWord (a (u l)) j b : H) : G) =
|
| 295 |
+
orderedWord (fun i => v i ^ m (u l) i) j b :=
|
| 296 |
+
orderedWord_map H.subtype (a (u l)) j b
|
| 297 |
+
rw [hmap] at hquot
|
| 298 |
+
exact hquot
|
| 299 |
+
|
| 300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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.TriangularDenominators01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Coordinates
|
| 4 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
section
|
| 12 |
+
namespace RationalLattice
|
| 13 |
+
noncomputable section
|
| 14 |
+
variable {G : Type*} [Group G] [TopologicalSpace G]
|
| 15 |
+
variable {n : ℕ}
|
| 16 |
+
|
| 17 |
+
def IsRational (c : RealCoordinates G n) (g : G) : Prop :=
|
| 18 |
+
∀ i, ∃ x : ℚ, (x : ℝ) = c.coord g i
|
| 19 |
+
|
| 20 |
+
lemma eval_rational {ι : Type*} (P : MvPolynomial ι ℚ) (x : ι → ℝ)
|
| 21 |
+
(hx : ∀ i, ∃ q : ℚ, (q : ℝ) = x i) :
|
| 22 |
+
∃ q : ℚ, (q : ℝ) = MvPolynomial.eval₂ (algebraMap ℚ ℝ) x P := by
|
| 23 |
+
classical
|
| 24 |
+
let q : ι → ℚ := fun i => Classical.choose (hx i)
|
| 25 |
+
have hq : (algebraMap ℚ ℝ) ∘ q = x := funext (fun i => Classical.choose_spec (hx i))
|
| 26 |
+
refine ⟨MvPolynomial.eval q P,?_⟩
|
| 27 |
+
simpa [hq] using (MvPolynomial.eval₂_comp (algebraMap ℚ ℝ) q P)
|
| 28 |
+
|
| 29 |
+
lemma rational_one (c : RealCoordinates G n) : IsRational c 1 := by
|
| 30 |
+
intro i
|
| 31 |
+
exact ⟨0,by simp [c.one_coord]⟩
|
| 32 |
+
|
| 33 |
+
lemma rational_mul (c : RealCoordinates G n) {g h : G}
|
| 34 |
+
(hg : IsRational c g) (hh : IsRational c h) : IsRational c (g*h) := by
|
| 35 |
+
intro i
|
| 36 |
+
obtain ⟨a,ha⟩ := hg i
|
| 37 |
+
obtain ⟨b,hb⟩ := hh i
|
| 38 |
+
obtain ⟨e,he⟩ := eval_rational (c.correction i)
|
| 39 |
+
(Sum.elim (fun j => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 40 |
+
(fun j => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩))
|
| 41 |
+
(by intro k; cases k with | inl j => exact hg _ | inr j => exact hh _)
|
| 42 |
+
exact ⟨a+b+e,by rw [Rat.cast_add,Rat.cast_add,ha,hb,he,c.mul_coord]⟩
|
| 43 |
+
|
| 44 |
+
lemma rational_inv (c : RealCoordinates G n) {g : G} (hg : IsRational c g) :
|
| 45 |
+
IsRational c g⁻¹ := by
|
| 46 |
+
intro i
|
| 47 |
+
have hpartial : ∀ j (hj : j < n), ∃ q : ℚ, (q : ℝ) = c.coord g⁻¹ ⟨j,hj⟩ := by
|
| 48 |
+
intro j
|
| 49 |
+
induction j using Nat.strong_induction_on with
|
| 50 |
+
| h j ih =>
|
| 51 |
+
intro hj
|
| 52 |
+
let i : Fin n := ⟨j,hj⟩
|
| 53 |
+
obtain ⟨a,ha⟩ := hg i
|
| 54 |
+
obtain ⟨e,he⟩ := eval_rational (c.correction i)
|
| 55 |
+
(Sum.elim (fun k => c.coord g ⟨k.val,lt_trans k.isLt i.isLt⟩)
|
| 56 |
+
(fun k => c.coord g⁻¹ ⟨k.val,lt_trans k.isLt i.isLt⟩))
|
| 57 |
+
(by
|
| 58 |
+
intro k
|
| 59 |
+
cases k with
|
| 60 |
+
| inl k => exact hg _
|
| 61 |
+
| inr k => exact ih k.val k.isLt _)
|
| 62 |
+
refine ⟨-(a+e),?_⟩
|
| 63 |
+
have hmul := c.mul_coord g g⁻¹ i
|
| 64 |
+
rw [mul_inv_cancel,c.one_coord,← ha,← he] at hmul
|
| 65 |
+
rw [Rat.cast_neg,Rat.cast_add]
|
| 66 |
+
change -((a : ℝ)+e) = c.coord g⁻¹ i
|
| 67 |
+
linarith
|
| 68 |
+
exact hpartial i.val i.isLt
|
| 69 |
+
|
| 70 |
+
def rationalSubgroup (c : RealCoordinates G n) : Subgroup G where
|
| 71 |
+
carrier := IsRational c
|
| 72 |
+
one_mem' := rational_one c
|
| 73 |
+
mul_mem' := rational_mul c
|
| 74 |
+
inv_mem' := rational_inv c
|
| 75 |
+
|
| 76 |
+
def qcoord (c : RealCoordinates G n) (g : rationalSubgroup c) (i : Fin n) : ℚ :=
|
| 77 |
+
Classical.choose (g.property i)
|
| 78 |
+
|
| 79 |
+
lemma qcoord_spec (c : RealCoordinates G n) (g : rationalSubgroup c) (i : Fin n) :
|
| 80 |
+
(qcoord c g i : ℝ) = c.coord g i := Classical.choose_spec (g.property i)
|
| 81 |
+
|
| 82 |
+
lemma qcoord_injective (c : RealCoordinates G n) : Function.Injective (qcoord c) := by
|
| 83 |
+
intro g h heq
|
| 84 |
+
apply Subtype.ext
|
| 85 |
+
apply c.coord.injective
|
| 86 |
+
funext i
|
| 87 |
+
rw [← qcoord_spec c g i,← qcoord_spec c h i,heq]
|
| 88 |
+
|
| 89 |
+
lemma qcoord_continuous (c : RealCoordinates G n) (i : Fin n) :
|
| 90 |
+
Continuous (fun g => qcoord c g i) := by
|
| 91 |
+
apply Rat.isEmbedding_coe_real.isInducing.continuous_iff.mpr
|
| 92 |
+
change Continuous (fun g : rationalSubgroup c => (qcoord c g i : ℝ))
|
| 93 |
+
simp_rw [qcoord_spec]
|
| 94 |
+
exact (continuous_apply i).comp (c.coord.continuous.comp continuous_subtype_val)
|
| 95 |
+
|
| 96 |
+
def rationalCoordinates (c : RealCoordinates G n) :
|
| 97 |
+
TriangularDenominators.Coordinates (rationalSubgroup c) n where
|
| 98 |
+
coord := qcoord c
|
| 99 |
+
one_coord i := by
|
| 100 |
+
apply Rat.cast_injective (α := ℝ)
|
| 101 |
+
rw [qcoord_spec]
|
| 102 |
+
exact (c.one_coord i).trans Rat.cast_zero.symm
|
| 103 |
+
correction := c.correction
|
| 104 |
+
mul_coord g h i := by
|
| 105 |
+
apply Rat.cast_injective (α := ℝ)
|
| 106 |
+
rw [Rat.cast_add,Rat.cast_add,qcoord_spec,qcoord_spec,qcoord_spec]
|
| 107 |
+
have hp := MvPolynomial.eval₂_comp (algebraMap ℚ ℝ)
|
| 108 |
+
(Sum.elim (fun j => qcoord c g ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 109 |
+
(fun j => qcoord c h ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i)
|
| 110 |
+
have hcast (q : ℚ) : (algebraMap ℚ ℝ) q = (q : ℝ) := by simp
|
| 111 |
+
simp only [hcast] at hp
|
| 112 |
+
rw [hp]
|
| 113 |
+
change c.coord ((g:G)*(h:G)) i = _
|
| 114 |
+
rw [c.mul_coord]
|
| 115 |
+
congr 2
|
| 116 |
+
funext k
|
| 117 |
+
cases k with
|
| 118 |
+
| inl j => exact (qcoord_spec c g _).symm
|
| 119 |
+
| inr j => exact (qcoord_spec c h _).symm
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
theorem rational_fg_discrete [IsTopologicalGroup G] (c : RealCoordinates G n)
|
| 124 |
+
(H : Subgroup (rationalSubgroup c)) (hH : H.FG) : DiscreteTopology H := by
|
| 125 |
+
obtain ⟨S,hS⟩ := hH
|
| 126 |
+
rw [← hS]
|
| 127 |
+
exact TriangularDenominators.closure_discrete (rationalCoordinates c)
|
| 128 |
+
(qcoord_injective c) (qcoord_continuous c) S
|
| 129 |
+
|
| 130 |
+
end
|
| 131 |
+
end RationalLattice
|
| 132 |
+
|
| 133 |
+
namespace RationalLattice
|
| 134 |
+
noncomputable section
|
| 135 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 136 |
+
[PreconnectedSpace G] [LocallyCompactSpace G] [T2Space G] {n : ℕ}
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
theorem finite_rational_extension (c : RealCoordinates G n) (Γ : Subgroup G)
|
| 141 |
+
[DiscreteTopology Γ] (hΓrat : Γ ≤ rationalSubgroup c)
|
| 142 |
+
(C : Set G) (hC : IsCompact C) (hreps : ∀ g : G, ∃ x ∈ C, x⁻¹*g ∈ Γ)
|
| 143 |
+
(S : Finset G) (hSrat : ∀ g ∈ S, IsRational c g) :
|
| 144 |
+
∃ H : Subgroup G, Γ ≤ H ∧ (S : Set G) ⊆ H ∧ H ≤ rationalSubgroup c ∧
|
| 145 |
+
DiscreteTopology H ∧ (Γ.subgroupOf H).FiniteIndex := by
|
| 146 |
+
let H := Γ ⊔ Subgroup.closure (S : Set G)
|
| 147 |
+
have hHrat : H ≤ rationalSubgroup c := by
|
| 148 |
+
apply sup_le hΓrat
|
| 149 |
+
rw [Subgroup.closure_le]
|
| 150 |
+
exact hSrat
|
| 151 |
+
have hH : H.FG := (CocompactLattice.fg_of_compact_reps Γ C hC hreps).sup ⟨S,rfl⟩
|
| 152 |
+
let : Group.FG H := (Group.fg_iff_subgroup_fg H).mpr hH
|
| 153 |
+
let e := Subgroup.subgroupOfContinuousMulEquivOfLe hHrat
|
| 154 |
+
have hqG : Group.FG (H.subgroupOf (rationalSubgroup c)) :=
|
| 155 |
+
Group.fg_of_surjective (f := e.symm.toMonoidHom) e.symm.surjective
|
| 156 |
+
have hq : (H.subgroupOf (rationalSubgroup c)).FG :=
|
| 157 |
+
(Group.fg_iff_subgroup_fg _).mp hqG
|
| 158 |
+
have hdq := rational_fg_discrete c _ hq
|
| 159 |
+
have hd : DiscreteTopology H := e.discreteTopology_iff.mp hdq
|
| 160 |
+
let : DiscreteTopology H := hd
|
| 161 |
+
refine ⟨H,le_sup_left,?_,hHrat,hd,?_⟩
|
| 162 |
+
· exact fun _ hg => Subgroup.mem_sup_right (Subgroup.subset_closure hg)
|
| 163 |
+
· exact TriangularDenominators.finiteIndex_of_compact_reps Γ H le_sup_left C hC hreps
|
| 164 |
+
|
| 165 |
+
end
|
| 166 |
+
end RationalLattice
|
| 167 |
+
end
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
section
|
| 172 |
+
open scoped BigOperators
|
| 173 |
+
noncomputable section
|
| 174 |
+
namespace Polynomial
|
| 175 |
+
open scoped _root_.Polynomial
|
| 176 |
+
variable {K : Type*} [Field K] [CharZero K]
|
| 177 |
+
|
| 178 |
+
lemma exists_antidifference_monomial (i : ℕ) (a : K) :
|
| 179 |
+
∃ q : K[X], q.comp (1+_root_.Polynomial.X) - q = _root_.Polynomial.C a * _root_.Polynomial.X^i := by
|
| 180 |
+
let b : K[X] := (_root_.Polynomial.bernoulli (i+1)).map (algebraMap ℚ K)
|
| 181 |
+
have hb : b.comp (1+_root_.Polynomial.X) = b + _root_.Polynomial.C (i+1 : K) * _root_.Polynomial.X^i := by
|
| 182 |
+
have h := congrArg (Polynomial.map (algebraMap ℚ K)) (_root_.Polynomial.bernoulli_comp_one_add_X (i+1))
|
| 183 |
+
simpa [b, _root_.Polynomial.map_comp, nsmul_eq_mul] using h
|
| 184 |
+
refine ⟨_root_.Polynomial.C (a / (i+1 : K)) * b,?_⟩
|
| 185 |
+
rw [_root_.Polynomial.mul_comp,_root_.Polynomial.C_comp,hb]
|
| 186 |
+
have hi : (i+1 : K) ≠ 0 := by exact_mod_cast Nat.succ_ne_zero i
|
| 187 |
+
calc
|
| 188 |
+
_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 =
|
| 189 |
+
(_root_.Polynomial.C (a / (i+1 : K)) * _root_.Polynomial.C (i+1 : K)) * _root_.Polynomial.X^i := by ring
|
| 190 |
+
_ = _root_.Polynomial.C a * _root_.Polynomial.X^i := by rw [← _root_.Polynomial.C_mul,div_mul_cancel₀ _ hi]
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
theorem exists_antidifference (p : K[X]) : ∃ q : K[X],
|
| 194 |
+
q.eval 0 = 0 ∧ q.comp (1+_root_.Polynomial.X) - q = p := by
|
| 195 |
+
have hex : ∃ q : K[X], q.comp (1+_root_.Polynomial.X) - q = p := by
|
| 196 |
+
induction p using Polynomial.induction_on' with
|
| 197 |
+
| add p r hp hr =>
|
| 198 |
+
obtain ⟨q,hq⟩ := hp
|
| 199 |
+
obtain ⟨s,hs⟩ := hr
|
| 200 |
+
refine ⟨q+s,?_⟩
|
| 201 |
+
rw [_root_.Polynomial.add_comp]
|
| 202 |
+
linear_combination hq+hs
|
| 203 |
+
| monomial i a =>
|
| 204 |
+
simpa only [_root_.Polynomial.C_mul_X_pow_eq_monomial] using exists_antidifference_monomial i a
|
| 205 |
+
obtain ⟨q,hq⟩ := hex
|
| 206 |
+
exact ⟨q-_root_.Polynomial.C (q.eval 0),by simp,by simpa [_root_.Polynomial.sub_comp] using hq⟩
|
| 207 |
+
|
| 208 |
+
end Polynomial
|
| 209 |
+
|
| 210 |
+
namespace Polynomial
|
| 211 |
+
open scoped _root_.Polynomial
|
| 212 |
+
variable {A : Type*} [CommRing A] [Algebra ℚ A]
|
| 213 |
+
|
| 214 |
+
lemma exists_antidifference_monomial_algebra (i : ℕ) (a : A) :
|
| 215 |
+
∃ q : A[X], q.comp (1+_root_.Polynomial.X) - q = _root_.Polynomial.C a * _root_.Polynomial.X^i := by
|
| 216 |
+
let b : A[X] := (_root_.Polynomial.bernoulli (i+1)).map (algebraMap ℚ A)
|
| 217 |
+
have hb : b.comp (1+_root_.Polynomial.X) = b + _root_.Polynomial.C (i+1 : A) * _root_.Polynomial.X^i := by
|
| 218 |
+
have h := congrArg (Polynomial.map (algebraMap ℚ A)) (_root_.Polynomial.bernoulli_comp_one_add_X (i+1))
|
| 219 |
+
simpa [b,_root_.Polynomial.map_comp,nsmul_eq_mul] using h
|
| 220 |
+
let u : A := (algebraMap ℚ A) ((i+1:ℚ)⁻¹)
|
| 221 |
+
have hui : u*(i+1:A) = 1 := by
|
| 222 |
+
have hi : (i+1:ℚ) ≠ 0 := by positivity
|
| 223 |
+
have h := congrArg (algebraMap ℚ A) (inv_mul_cancel₀ hi)
|
| 224 |
+
simpa [u] using h
|
| 225 |
+
refine ⟨_root_.Polynomial.C (a*u)*b,?_⟩
|
| 226 |
+
rw [_root_.Polynomial.mul_comp,_root_.Polynomial.C_comp,hb]
|
| 227 |
+
calc
|
| 228 |
+
_root_.Polynomial.C (a*u) * (b + _root_.Polynomial.C (i+1:A) * _root_.Polynomial.X^i) - _root_.Polynomial.C (a*u)*b =
|
| 229 |
+
(_root_.Polynomial.C (a*u)*_root_.Polynomial.C (i+1:A))*_root_.Polynomial.X^i := by ring
|
| 230 |
+
_ = _root_.Polynomial.C a*_root_.Polynomial.X^i := by rw [← _root_.Polynomial.C_mul,mul_assoc,hui,mul_one]
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
theorem exists_antidifference_algebra (p : A[X]) : ∃ q : A[X],
|
| 235 |
+
q.eval 0 = 0 ∧ q.comp (1+_root_.Polynomial.X) - q = p := by
|
| 236 |
+
have hex : ∃ q : A[X], q.comp (1+_root_.Polynomial.X) - q = p := by
|
| 237 |
+
induction p using Polynomial.induction_on' with
|
| 238 |
+
| add p r hp hr =>
|
| 239 |
+
obtain ⟨q,hq⟩ := hp
|
| 240 |
+
obtain ⟨s,hs⟩ := hr
|
| 241 |
+
refine ⟨q+s,?_⟩
|
| 242 |
+
rw [_root_.Polynomial.add_comp]
|
| 243 |
+
linear_combination hq+hs
|
| 244 |
+
| monomial i a =>
|
| 245 |
+
simpa only [_root_.Polynomial.C_mul_X_pow_eq_monomial] using exists_antidifference_monomial_algebra i a
|
| 246 |
+
obtain ⟨q,hq⟩ := hex
|
| 247 |
+
exact ⟨q-_root_.Polynomial.C (q.eval 0),by simp,by simpa [_root_.Polynomial.sub_comp] using hq⟩
|
| 248 |
+
|
| 249 |
+
end Polynomial
|
| 250 |
+
|
| 251 |
+
end
|
| 252 |
+
end
|
| 253 |
+
end
|
| 254 |
+
end
|
| 255 |
+
end
|
| 256 |
+
|
| 257 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice02.lean
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.RationalLattice01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
noncomputable section
|
| 13 |
+
end
|
| 14 |
+
end
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
section
|
| 19 |
+
open scoped BigOperators
|
| 20 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 21 |
+
noncomputable section
|
| 22 |
+
namespace Polynomial
|
| 23 |
+
open scoped _root_.Polynomial
|
| 24 |
+
variable {K : Type*} [Field K] [CharZero K]
|
| 25 |
+
lemma eq_of_eval_nat_eq {p q : K[X]} (h : ∀ m : ℕ, p.eval (m : K) = q.eval (m : K)) : p = q := by
|
| 26 |
+
apply _root_.Polynomial.eq_of_infinite_eval_eq
|
| 27 |
+
apply (Set.infinite_range_of_injective (Nat.cast_injective (R := K))).mono
|
| 28 |
+
rintro x ⟨m,rfl⟩
|
| 29 |
+
exact h m
|
| 30 |
+
end Polynomial
|
| 31 |
+
namespace RationalLattice
|
| 32 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 33 |
+
variable (c : RealCoordinates G n)
|
| 34 |
+
|
| 35 |
+
lemma polynomial_substitute_eval {ι : Type*} (P : MvPolynomial ι ℚ)
|
| 36 |
+
(p : ι → ℝ[X]) (t : ℝ) :
|
| 37 |
+
(MvPolynomial.eval₂ (Polynomial.C.comp (algebraMap ℚ ℝ)) p P).eval t =
|
| 38 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun i => (p i).eval t) P := by
|
| 39 |
+
have h := MvPolynomial.eval₂_comp_left (Polynomial.evalRingHom t)
|
| 40 |
+
(Polynomial.C.comp (algebraMap ℚ ℝ)) p P
|
| 41 |
+
have hc : (Polynomial.evalRingHom t).comp (Polynomial.C.comp (algebraMap ℚ ℝ)) =
|
| 42 |
+
algebraMap ℚ ℝ := by
|
| 43 |
+
ext q
|
| 44 |
+
simp
|
| 45 |
+
rw [hc] at h
|
| 46 |
+
exact h
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
theorem natpow_polynomial (g : G) (i : Fin n) :
|
| 51 |
+
∃ p : ℝ[X], ∀ m : ℕ, p.eval (m : ℝ) = c.coord (g^m) i := by
|
| 52 |
+
have aux : ∀ l : ℕ, ∀ hl : l<n, ∃ p : ℝ[X],
|
| 53 |
+
∀ m : ℕ, p.eval (m : ℝ) = c.coord (g^m) ⟨l,hl⟩ := by
|
| 54 |
+
intro l
|
| 55 |
+
induction l using Nat.strong_induction_on with
|
| 56 |
+
| h l ih =>
|
| 57 |
+
intro hl
|
| 58 |
+
choose p hp using (fun j : Fin l => ih j.val j.isLt (lt_trans j.isLt hl))
|
| 59 |
+
let x : (Fin l ⊕ Fin l) → ℝ[X] := Sum.elim p
|
| 60 |
+
(fun j => Polynomial.C (c.coord g ⟨j.val,lt_trans j.isLt hl⟩))
|
| 61 |
+
let Q : ℝ[X] := Polynomial.C (c.coord g ⟨l,hl⟩) +
|
| 62 |
+
MvPolynomial.eval₂ (Polynomial.C.comp (algebraMap ℚ ℝ)) x (c.correction ⟨l,hl⟩)
|
| 63 |
+
obtain ⟨P,hP0,hP⟩ := Polynomial.exists_antidifference Q
|
| 64 |
+
refine ⟨P,?_⟩
|
| 65 |
+
intro m
|
| 66 |
+
induction m with
|
| 67 |
+
| zero => simpa [c.one_coord] using hP0
|
| 68 |
+
| succ m hm =>
|
| 69 |
+
have he := congrArg (Polynomial.eval (m : ℝ)) hP
|
| 70 |
+
simp only [Polynomial.eval_sub,Polynomial.eval_comp,Polynomial.eval_add,
|
| 71 |
+
Polynomial.eval_one,Polynomial.eval_X] at he
|
| 72 |
+
have hx : (fun a => (x a).eval (m : ℝ)) =
|
| 73 |
+
Sum.elim (fun j => c.coord (g^m) ⟨j.val,lt_trans j.isLt hl⟩)
|
| 74 |
+
(fun j => c.coord g ⟨j.val,lt_trans j.isLt hl⟩) := by
|
| 75 |
+
funext j
|
| 76 |
+
cases j with
|
| 77 |
+
| inl j => exact hp j m
|
| 78 |
+
| inr j => simp [x]
|
| 79 |
+
simp only [Q,Polynomial.eval_add,Polynomial.eval_C,polynomial_substitute_eval,hx] at he
|
| 80 |
+
rw [pow_succ,c.mul_coord]
|
| 81 |
+
rw [Nat.cast_succ,add_comm (m:ℝ) 1]
|
| 82 |
+
linarith
|
| 83 |
+
exact aux i.val i.isLt
|
| 84 |
+
|
| 85 |
+
def powerPolynomial (g : G) (i : Fin n) : ℝ[X] := (natpow_polynomial c g i).choose
|
| 86 |
+
lemma powerPolynomial_nat (g : G) (i : Fin n) (m : ℕ) :
|
| 87 |
+
(powerPolynomial c g i).eval (m : ℝ) = c.coord (g^m) i :=
|
| 88 |
+
(natpow_polynomial c g i).choose_spec m
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def realPower (g : G) (t : ℝ) : G :=
|
| 92 |
+
c.coord.symm (fun i => (powerPolynomial c g i).eval t)
|
| 93 |
+
|
| 94 |
+
lemma realPower_coord (g : G) (t : ℝ) (i : Fin n) :
|
| 95 |
+
c.coord (realPower c g t) i = (powerPolynomial c g i).eval t := by
|
| 96 |
+
simp [realPower]
|
| 97 |
+
|
| 98 |
+
lemma realPower_nat (g : G) (m : ℕ) : realPower c g m = g^m := by
|
| 99 |
+
apply c.coord.injective
|
| 100 |
+
funext i
|
| 101 |
+
rw [realPower_coord,powerPolynomial_nat]
|
| 102 |
+
|
| 103 |
+
@[simp] lemma realPower_zero (g : G) : realPower c g 0 = 1 := by
|
| 104 |
+
simpa using realPower_nat c g 0
|
| 105 |
+
@[simp] lemma realPower_one (g : G) : realPower c g 1 = g := by
|
| 106 |
+
simpa using realPower_nat c g 1
|
| 107 |
+
|
| 108 |
+
lemma realPower_continuous (g : G) : Continuous (realPower c g) :=
|
| 109 |
+
c.coord.symm.continuous.comp (continuous_pi fun i => (powerPolynomial c g i).continuous)
|
| 110 |
+
|
| 111 |
+
end RationalLattice
|
| 112 |
+
|
| 113 |
+
namespace RationalLattice
|
| 114 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 115 |
+
variable (c : RealCoordinates G n)
|
| 116 |
+
|
| 117 |
+
def evalPath (p : Fin n → ℝ[X]) (t : ℝ) : G := c.coord.symm (fun i => (p i).eval t)
|
| 118 |
+
def pathMul (p q : Fin n → ℝ[X]) (i : Fin n) : ℝ[X] :=
|
| 119 |
+
p i + q i + MvPolynomial.eval₂ (C.comp (algebraMap ℚ ℝ))
|
| 120 |
+
(Sum.elim (fun j => p ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 121 |
+
(fun j => q ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i)
|
| 122 |
+
|
| 123 |
+
lemma evalPath_coord (p : Fin n → ℝ[X]) (t : ℝ) (i : Fin n) :
|
| 124 |
+
c.coord (evalPath c p t) i = (p i).eval t := by simp [evalPath]
|
| 125 |
+
lemma evalPath_C (g : G) (t : ℝ) : evalPath c (fun i => C (c.coord g i)) t = g := by
|
| 126 |
+
simp [evalPath]
|
| 127 |
+
lemma evalPath_comp (p : Fin n → ℝ[X]) (q : ℝ[X]) (t : ℝ) :
|
| 128 |
+
evalPath c (fun i => (p i).comp q) t = evalPath c p (q.eval t) := by
|
| 129 |
+
simp [evalPath,Polynomial.eval_comp]
|
| 130 |
+
lemma evalPath_mul (p q : Fin n → ℝ[X]) (t : ℝ) :
|
| 131 |
+
evalPath c (pathMul c p q) t = evalPath c p t * evalPath c q t := by
|
| 132 |
+
apply c.coord.injective
|
| 133 |
+
funext i
|
| 134 |
+
rw [evalPath_coord,c.mul_coord]
|
| 135 |
+
simp only [pathMul,Polynomial.eval_add,polynomial_substitute_eval,evalPath_coord]
|
| 136 |
+
congr 2
|
| 137 |
+
funext a
|
| 138 |
+
cases a <;> rfl
|
| 139 |
+
|
| 140 |
+
lemma evalPath_ext_nat {p q : Fin n → ℝ[X]}
|
| 141 |
+
(h : ∀ m : ℕ, evalPath c p (m:ℝ) = evalPath c q (m:ℝ)) :
|
| 142 |
+
∀ t : ℝ, evalPath c p t = evalPath c q t := by
|
| 143 |
+
have hpq : p=q := by
|
| 144 |
+
funext i
|
| 145 |
+
apply Polynomial.eq_of_eval_nat_eq
|
| 146 |
+
intro m
|
| 147 |
+
have h' := congrArg (fun g => c.coord g i) (h m)
|
| 148 |
+
simpa [evalPath] using h'
|
| 149 |
+
rw [hpq]
|
| 150 |
+
exact fun _ => rfl
|
| 151 |
+
|
| 152 |
+
lemma realPower_add_nat (g : G) (t : ℝ) (m : ℕ) :
|
| 153 |
+
realPower c g (t+m) = realPower c g t * g^m := by
|
| 154 |
+
let p := powerPolynomial c g
|
| 155 |
+
let q : Fin n → ℝ[X] := fun i => (p i).comp (X+C (m:ℝ))
|
| 156 |
+
let r := pathMul c p (fun i => C (c.coord (g^m) i))
|
| 157 |
+
have hq (s : ℝ) : evalPath c q s = realPower c g (s+m) := by
|
| 158 |
+
simp [q,realPower,evalPath,p]
|
| 159 |
+
have hr (s : ℝ) : evalPath c r s = realPower c g s * g^m := by
|
| 160 |
+
rw [evalPath_mul,evalPath_C]
|
| 161 |
+
rfl
|
| 162 |
+
have he : ∀ k : ℕ, evalPath c q k = evalPath c r k := by
|
| 163 |
+
intro k
|
| 164 |
+
rw [hq,hr,← Nat.cast_add,realPower_nat,realPower_nat,pow_add]
|
| 165 |
+
simpa only [hq,hr] using evalPath_ext_nat c he t
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
theorem realPower_add (g : G) (s t : ℝ) :
|
| 170 |
+
realPower c g (s+t) = realPower c g s * realPower c g t := by
|
| 171 |
+
let p := powerPolynomial c g
|
| 172 |
+
let q : Fin n → ℝ[X] := fun i => (p i).comp (C s+X)
|
| 173 |
+
let r := pathMul c (fun i => C (c.coord (realPower c g s) i)) p
|
| 174 |
+
have hq (v : ℝ) : evalPath c q v = realPower c g (s+v) := by
|
| 175 |
+
simp [q,realPower,evalPath,p]
|
| 176 |
+
have hr (v : ℝ) : evalPath c r v = realPower c g s * realPower c g v := by
|
| 177 |
+
rw [evalPath_mul,evalPath_C]
|
| 178 |
+
rfl
|
| 179 |
+
have he : ∀ k : ℕ, evalPath c q k = evalPath c r k := by
|
| 180 |
+
intro k
|
| 181 |
+
rw [hq,hr,realPower_nat]
|
| 182 |
+
exact realPower_add_nat c g s k
|
| 183 |
+
simpa only [hq,hr] using evalPath_ext_nat c he t
|
| 184 |
+
|
| 185 |
+
lemma realPower_neg (g : G) (s : ℝ) : realPower c g (-s) = (realPower c g s)⁻¹ := by
|
| 186 |
+
symm
|
| 187 |
+
apply inv_eq_of_mul_eq_one_right
|
| 188 |
+
rw [← realPower_add,add_neg_cancel,realPower_zero]
|
| 189 |
+
|
| 190 |
+
end RationalLattice
|
| 191 |
+
end
|
| 192 |
+
end
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
section
|
| 197 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 198 |
+
noncomputable section
|
| 199 |
+
namespace RationalLattice
|
| 200 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 201 |
+
variable (c : RealCoordinates G n)
|
| 202 |
+
|
| 203 |
+
abbrev ParamPoly (n : ℕ) := Polynomial (MvPolynomial (Fin n) ℚ)
|
| 204 |
+
|
| 205 |
+
def parameterEval (x : Fin n → ℝ) : MvPolynomial (Fin n) ℚ →+* ℝ :=
|
| 206 |
+
MvPolynomial.eval₂Hom (algebraMap ℚ ℝ) x
|
| 207 |
+
|
| 208 |
+
@[simp] lemma parameterEval_X (x : Fin n → ℝ) (i : Fin n) :
|
| 209 |
+
parameterEval x (MvPolynomial.X i) = x i := by simp [parameterEval]
|
| 210 |
+
|
| 211 |
+
lemma universal_substitute_eval {ι : Type*} (P : MvPolynomial ι ℚ)
|
| 212 |
+
(p : ι → ParamPoly n) (x : Fin n → ℝ) (t : ℝ) :
|
| 213 |
+
(MvPolynomial.eval₂ (C.comp MvPolynomial.C) p P).eval₂ (parameterEval x) t =
|
| 214 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 215 |
+
(fun i => (p i).eval₂ (parameterEval x) t) P := by
|
| 216 |
+
have h := MvPolynomial.eval₂_comp_left (Polynomial.eval₂RingHom (parameterEval x) t)
|
| 217 |
+
(C.comp MvPolynomial.C) p P
|
| 218 |
+
have hc : (Polynomial.eval₂RingHom (parameterEval x) t).comp (C.comp MvPolynomial.C) =
|
| 219 |
+
algebraMap ℚ ℝ := by
|
| 220 |
+
ext q
|
| 221 |
+
simp [parameterEval]
|
| 222 |
+
rw [hc] at h
|
| 223 |
+
exact h
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
theorem universal_natpow_polynomial (i : Fin n) :
|
| 228 |
+
∃ P : ParamPoly n, ∀ (g : G) (m : ℕ),
|
| 229 |
+
P.eval₂ (parameterEval (c.coord g)) (m:ℝ) = c.coord (g^m) i := by
|
| 230 |
+
have aux : ∀ l : ℕ, ∀ hl : l<n, ∃ P : ParamPoly n, ∀ (g:G) (m:ℕ),
|
| 231 |
+
P.eval₂ (parameterEval (c.coord g)) (m:ℝ) = c.coord (g^m) ⟨l,hl⟩ := by
|
| 232 |
+
intro l
|
| 233 |
+
induction l using Nat.strong_induction_on with
|
| 234 |
+
| h l ih =>
|
| 235 |
+
intro hl
|
| 236 |
+
choose p hp using (fun j : Fin l => ih j.val j.isLt (lt_trans j.isLt hl))
|
| 237 |
+
let x : (Fin l ⊕ Fin l) → ParamPoly n := Sum.elim p
|
| 238 |
+
(fun j => C (MvPolynomial.X ⟨j.val,lt_trans j.isLt hl⟩))
|
| 239 |
+
let Q : ParamPoly n := C (MvPolynomial.X ⟨l,hl⟩) +
|
| 240 |
+
MvPolynomial.eval₂ (C.comp MvPolynomial.C) x (c.correction ⟨l,hl⟩)
|
| 241 |
+
obtain ⟨P,hP0,hP⟩ := Polynomial.exists_antidifference_algebra Q
|
| 242 |
+
refine ⟨P,?_⟩
|
| 243 |
+
intro g m
|
| 244 |
+
induction m with
|
| 245 |
+
| zero =>
|
| 246 |
+
have he := congrArg (parameterEval (c.coord g)) hP0
|
| 247 |
+
simpa [Polynomial.eval₂_at_apply,← Polynomial.eval₂_at_apply,
|
| 248 |
+
c.one_coord] using he
|
| 249 |
+
| succ m hm =>
|
| 250 |
+
have he := congrArg (Polynomial.eval₂ (parameterEval (c.coord g)) (m:ℝ)) hP
|
| 251 |
+
simp only [Polynomial.eval₂_sub,Polynomial.eval₂_comp,Polynomial.eval₂_add,
|
| 252 |
+
Polynomial.eval₂_one,Polynomial.eval₂_X] at he
|
| 253 |
+
have hx : (fun a => (x a).eval₂ (parameterEval (c.coord g)) (m:ℝ)) =
|
| 254 |
+
Sum.elim (fun j => c.coord (g^m) ⟨j.val,lt_trans j.isLt hl⟩)
|
| 255 |
+
(fun j => c.coord g ⟨j.val,lt_trans j.isLt hl⟩) := by
|
| 256 |
+
funext j
|
| 257 |
+
cases j with
|
| 258 |
+
| inl j => exact hp j g m
|
| 259 |
+
| inr j => simp [x,parameterEval]
|
| 260 |
+
simp only [Q,Polynomial.eval₂_add,Polynomial.eval₂_C,universal_substitute_eval,hx] at he
|
| 261 |
+
simp only [parameterEval_X] at he
|
| 262 |
+
rw [pow_succ,c.mul_coord]
|
| 263 |
+
rw [Nat.cast_succ,add_comm (m:ℝ) 1]
|
| 264 |
+
linarith
|
| 265 |
+
exact aux i.val i.isLt
|
| 266 |
+
|
| 267 |
+
def universalPowerPolynomial (i : Fin n) : ParamPoly n := (universal_natpow_polynomial c i).choose
|
| 268 |
+
lemma universalPowerPolynomial_nat (g : G) (i : Fin n) (m : ℕ) :
|
| 269 |
+
(universalPowerPolynomial c i).eval₂ (parameterEval (c.coord g)) (m:ℝ) =
|
| 270 |
+
c.coord (g^m) i := (universal_natpow_polynomial c i).choose_spec g m
|
| 271 |
+
|
| 272 |
+
theorem powerPolynomial_eq_universal (g : G) (i : Fin n) :
|
| 273 |
+
powerPolynomial c g i = (universalPowerPolynomial c i).map (parameterEval (c.coord g)) := by
|
| 274 |
+
apply Polynomial.eq_of_eval_nat_eq
|
| 275 |
+
intro m
|
| 276 |
+
rw [powerPolynomial_nat,Polynomial.eval_map,universalPowerPolynomial_nat]
|
| 277 |
+
|
| 278 |
+
lemma realPower_coord_universal (g : G) (t : ℝ) (i : Fin n) :
|
| 279 |
+
c.coord (realPower c g t) i =
|
| 280 |
+
(universalPowerPolynomial c i).eval₂ (parameterEval (c.coord g)) t := by
|
| 281 |
+
rw [realPower_coord,powerPolynomial_eq_universal,Polynomial.eval_map]
|
| 282 |
+
|
| 283 |
+
end RationalLattice
|
| 284 |
+
|
| 285 |
+
end
|
| 286 |
+
end
|
| 287 |
+
end
|
| 288 |
+
end
|
| 289 |
+
end
|
| 290 |
+
|
| 291 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice03.lean
ADDED
|
@@ -0,0 +1,308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Polynomial _root_.OAI.Polynomial
|
| 12 |
+
noncomputable section
|
| 13 |
+
end
|
| 14 |
+
end
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
section
|
| 19 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 20 |
+
noncomputable section
|
| 21 |
+
namespace RationalLattice
|
| 22 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 23 |
+
variable (c : RealCoordinates G n)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
lemma realPower_mem_of_coordinates (H : Subgroup G) (I : Set (Fin n))
|
| 27 |
+
(hH : ∀ g : G, g ∈ H ↔ ∀ i ∈ I, c.coord g i = 0)
|
| 28 |
+
{g : G} (hg : g ∈ H) (t : ℝ) : realPower c g t ∈ H := by
|
| 29 |
+
apply (hH _).mpr
|
| 30 |
+
intro i hi
|
| 31 |
+
rw [realPower_coord]
|
| 32 |
+
have hp : powerPolynomial c g i = 0 := by
|
| 33 |
+
apply Polynomial.eq_of_eval_nat_eq
|
| 34 |
+
intro m
|
| 35 |
+
rw [powerPolynomial_nat,Polynomial.eval_zero]
|
| 36 |
+
exact (hH (g^m)).mp (H.pow_mem hg m) i hi
|
| 37 |
+
simp [hp]
|
| 38 |
+
|
| 39 |
+
def characterPower (χ : G →* Multiplicative ℝ) (g : G) : ℝ →+ ℝ where
|
| 40 |
+
toFun t := Multiplicative.toAdd (χ (realPower c g t))
|
| 41 |
+
map_zero' := by simp
|
| 42 |
+
map_add' s t := by rw [realPower_add,map_mul]; rfl
|
| 43 |
+
|
| 44 |
+
lemma character_realPower (χ : G →* Multiplicative ℝ) (hχ : Continuous χ)
|
| 45 |
+
(g : G) (t : ℝ) :
|
| 46 |
+
Multiplicative.toAdd (χ (realPower c g t)) = t * Multiplicative.toAdd (χ g) := by
|
| 47 |
+
have hc : Continuous (characterPower c χ g) := hχ.comp (realPower_continuous c g)
|
| 48 |
+
have h := map_real_smul (characterPower c χ g) hc t 1
|
| 49 |
+
simpa [characterPower] using h
|
| 50 |
+
|
| 51 |
+
include c in
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
theorem character_kernel_pathConnected (χ : G →* Multiplicative ℝ) (hχ : Continuous χ) :
|
| 55 |
+
IsPathConnected (χ.ker : Set G) := by
|
| 56 |
+
refine ⟨1,χ.ker.one_mem,?_⟩
|
| 57 |
+
intro g hg
|
| 58 |
+
let p : Path (1:G) g :=
|
| 59 |
+
{ toFun := fun t => realPower c g t
|
| 60 |
+
continuous_toFun := (realPower_continuous c g).comp continuous_subtype_val
|
| 61 |
+
source' := by simp
|
| 62 |
+
target' := by simp }
|
| 63 |
+
refine ⟨p,?_⟩
|
| 64 |
+
intro t
|
| 65 |
+
change χ (realPower c g t) = 1
|
| 66 |
+
apply Multiplicative.toAdd.injective
|
| 67 |
+
rw [character_realPower c χ hχ]
|
| 68 |
+
change χ g = 1 at hg
|
| 69 |
+
simp [hg]
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
theorem character_kernel_inter_pathConnected (χ : G →* Multiplicative ℝ)
|
| 73 |
+
(hχ : Continuous χ) (H : Subgroup G) (I : Set (Fin n))
|
| 74 |
+
(hH : ∀ g : G, g ∈ H ↔ ∀ i ∈ I, c.coord g i = 0) :
|
| 75 |
+
IsPathConnected ((H ⊓ χ.ker : Subgroup G) : Set G) := by
|
| 76 |
+
refine ⟨1,(H ⊓ χ.ker).one_mem,?_⟩
|
| 77 |
+
intro g hg
|
| 78 |
+
let p : Path (1:G) g :=
|
| 79 |
+
{ toFun := fun t => realPower c g t
|
| 80 |
+
continuous_toFun := (realPower_continuous c g).comp continuous_subtype_val
|
| 81 |
+
source' := by simp
|
| 82 |
+
target' := by simp }
|
| 83 |
+
refine ⟨p,?_⟩
|
| 84 |
+
intro t
|
| 85 |
+
refine ⟨realPower_mem_of_coordinates c H I hH hg.1 t,?_⟩
|
| 86 |
+
change χ (realPower c g t) = 1
|
| 87 |
+
apply Multiplicative.toAdd.injective
|
| 88 |
+
rw [character_realPower c χ hχ]
|
| 89 |
+
have hg' : χ g = 1 := hg.2
|
| 90 |
+
simp [hg']
|
| 91 |
+
|
| 92 |
+
end RationalLattice
|
| 93 |
+
end
|
| 94 |
+
end
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
section
|
| 99 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 100 |
+
noncomputable section
|
| 101 |
+
namespace RationalLattice
|
| 102 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 103 |
+
variable (c : RealCoordinates G n)
|
| 104 |
+
|
| 105 |
+
lemma parameterEval_continuous (P : MvPolynomial (Fin n) ℚ) :
|
| 106 |
+
Continuous (fun x : Fin n → ℝ => parameterEval x P) := by
|
| 107 |
+
simpa only [parameterEval,MvPolynomial.coe_eval₂Hom,MvPolynomial.eval₂_eq_eval_map] using
|
| 108 |
+
(MvPolynomial.continuous_eval (P.map (algebraMap ℚ ℝ)))
|
| 109 |
+
|
| 110 |
+
lemma paramPoly_continuous (P : ParamPoly n) :
|
| 111 |
+
Continuous (fun v : (Fin n → ℝ) × ℝ => P.eval₂ (parameterEval v.1) v.2) := by
|
| 112 |
+
induction P using Polynomial.induction_on' with
|
| 113 |
+
| add p q hp hq => simpa only [Polynomial.eval₂_add,Pi.add_apply] using hp.fun_add hq
|
| 114 |
+
| monomial i a =>
|
| 115 |
+
simpa only [Polynomial.eval₂_monomial,Pi.mul_apply,Pi.pow_apply,Function.comp_apply] using
|
| 116 |
+
((parameterEval_continuous a).comp continuous_fst).fun_mul (continuous_snd.fun_pow i)
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
theorem realPower_joint_continuous : Continuous (fun v : G × ℝ => realPower c v.1 v.2) := by
|
| 121 |
+
have h (v : G × ℝ) : realPower c v.1 v.2 =
|
| 122 |
+
c.coord.symm (fun i => (universalPowerPolynomial c i).eval₂
|
| 123 |
+
(parameterEval (c.coord v.1)) v.2) := by
|
| 124 |
+
apply c.coord.injective
|
| 125 |
+
funext i
|
| 126 |
+
simp [realPower_coord_universal]
|
| 127 |
+
simp_rw [h]
|
| 128 |
+
apply c.coord.symm.continuous.comp
|
| 129 |
+
apply continuous_pi
|
| 130 |
+
intro i
|
| 131 |
+
exact (paramPoly_continuous _).comp ((c.coord.continuous.comp continuous_fst).prodMk continuous_snd)
|
| 132 |
+
|
| 133 |
+
include c in
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
theorem contractible_of_realPower_closed (S : Set G) (h1 : (1:G) ∈ S)
|
| 137 |
+
(hS : ∀ g ∈ S, ∀ t : ℝ, realPower c g t ∈ S) : ContractibleSpace S := by
|
| 138 |
+
apply (contractible_iff_id_nullhomotopic S).mpr
|
| 139 |
+
refine ⟨⟨1,h1⟩,⟨?_⟩⟩
|
| 140 |
+
refine
|
| 141 |
+
{ toFun := fun v => ⟨realPower c v.2.val (1-(v.1:ℝ)),hS _ v.2.property _⟩
|
| 142 |
+
continuous_toFun := ?_
|
| 143 |
+
map_zero_left := ?_
|
| 144 |
+
map_one_left := ?_ }
|
| 145 |
+
· apply Continuous.subtype_mk
|
| 146 |
+
exact (realPower_joint_continuous c).comp
|
| 147 |
+
((continuous_subtype_val.comp continuous_snd).prodMk
|
| 148 |
+
(continuous_const.sub (continuous_subtype_val.comp continuous_fst)))
|
| 149 |
+
· intro g
|
| 150 |
+
apply Subtype.ext
|
| 151 |
+
simp
|
| 152 |
+
· intro g
|
| 153 |
+
apply Subtype.ext
|
| 154 |
+
simp
|
| 155 |
+
|
| 156 |
+
include c in
|
| 157 |
+
|
| 158 |
+
theorem character_kernel_contractible (χ : G →* Multiplicative ℝ) (hχ : Continuous χ) :
|
| 159 |
+
ContractibleSpace χ.ker := by
|
| 160 |
+
apply contractible_of_realPower_closed c (χ.ker:Set G) χ.ker.one_mem
|
| 161 |
+
intro g hg t
|
| 162 |
+
change χ (realPower c g t) = 1
|
| 163 |
+
apply Multiplicative.toAdd.injective
|
| 164 |
+
rw [character_realPower c χ hχ]
|
| 165 |
+
change χ g = 1 at hg
|
| 166 |
+
simp [hg]
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
theorem character_kernel_inter_contractible (χ : G →* Multiplicative ℝ)
|
| 171 |
+
(hχ : Continuous χ) (H : Subgroup G) (I : Set (Fin n))
|
| 172 |
+
(hH : ∀ g : G, g ∈ H ↔ ∀ i ∈ I, c.coord g i = 0) :
|
| 173 |
+
ContractibleSpace ↥(H ⊓ χ.ker) := by
|
| 174 |
+
apply contractible_of_realPower_closed c ((H ⊓ χ.ker : Subgroup G):Set G) (H ⊓ χ.ker).one_mem
|
| 175 |
+
intro g hg t
|
| 176 |
+
refine ⟨realPower_mem_of_coordinates c H I hH hg.1 t,?_⟩
|
| 177 |
+
change χ (realPower c g t) = 1
|
| 178 |
+
apply Multiplicative.toAdd.injective
|
| 179 |
+
rw [character_realPower c χ hχ]
|
| 180 |
+
have hg' : χ g = 1 := hg.2
|
| 181 |
+
simp [hg']
|
| 182 |
+
|
| 183 |
+
end RationalLattice
|
| 184 |
+
|
| 185 |
+
namespace RationalLattice
|
| 186 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 187 |
+
variable (c : RealCoordinates G n) (H : Subgroup G) (I : Set (Fin n))
|
| 188 |
+
variable (hH : ∀ g : G, g ∈ H ↔ ∀ i ∈ I, c.coord g i = 0)
|
| 189 |
+
|
| 190 |
+
def subgroupRealPower (g : H) (t : ℝ) : H :=
|
| 191 |
+
⟨realPower c g t,realPower_mem_of_coordinates c H I hH g.property t⟩
|
| 192 |
+
|
| 193 |
+
lemma subgroupRealPower_continuous (g : H) : Continuous (subgroupRealPower c H I hH g) :=
|
| 194 |
+
(realPower_continuous c g).subtype_mk _
|
| 195 |
+
|
| 196 |
+
lemma subgroupRealPower_zero (g : H) : subgroupRealPower c H I hH g 0 = 1 := by
|
| 197 |
+
apply Subtype.ext
|
| 198 |
+
exact realPower_zero c g
|
| 199 |
+
lemma subgroupRealPower_one (g : H) : subgroupRealPower c H I hH g 1 = g := by
|
| 200 |
+
apply Subtype.ext
|
| 201 |
+
exact realPower_one c g
|
| 202 |
+
lemma subgroupRealPower_add (g : H) (s t : ℝ) :
|
| 203 |
+
subgroupRealPower c H I hH g (s+t) =
|
| 204 |
+
subgroupRealPower c H I hH g s * subgroupRealPower c H I hH g t := by
|
| 205 |
+
apply Subtype.ext
|
| 206 |
+
exact realPower_add c g s t
|
| 207 |
+
|
| 208 |
+
def subgroupCharacterPower (χ : H →* Multiplicative ℝ) (g : H) : ℝ →+ ℝ where
|
| 209 |
+
toFun t := Multiplicative.toAdd (χ (subgroupRealPower c H I hH g t))
|
| 210 |
+
map_zero' := by rw [subgroupRealPower_zero,map_one]; rfl
|
| 211 |
+
map_add' s t := by rw [subgroupRealPower_add,map_mul]; rfl
|
| 212 |
+
|
| 213 |
+
lemma character_subgroupRealPower (χ : H →* Multiplicative ℝ) (hχ : Continuous χ)
|
| 214 |
+
(g : H) (t : ℝ) :
|
| 215 |
+
Multiplicative.toAdd (χ (subgroupRealPower c H I hH g t)) =
|
| 216 |
+
t * Multiplicative.toAdd (χ g) := by
|
| 217 |
+
have hc : Continuous (subgroupCharacterPower c H I hH χ g) :=
|
| 218 |
+
hχ.comp (subgroupRealPower_continuous c H I hH g)
|
| 219 |
+
have he := map_real_smul (subgroupCharacterPower c H I hH χ g) hc t 1
|
| 220 |
+
simpa [subgroupCharacterPower,subgroupRealPower_one] using he
|
| 221 |
+
|
| 222 |
+
include hH in
|
| 223 |
+
lemma realPower_mem_mapped_kernel (χ : H →* Multiplicative ℝ) (hχ : Continuous χ)
|
| 224 |
+
{g : G} (hg : g ∈ χ.ker.map H.subtype) (t : ℝ) :
|
| 225 |
+
realPower c g t ∈ χ.ker.map H.subtype := by
|
| 226 |
+
obtain ⟨u,hu,rfl⟩ := hg
|
| 227 |
+
refine ⟨subgroupRealPower c H I hH u t,?_,rfl⟩
|
| 228 |
+
change χ (subgroupRealPower c H I hH u t) = 1
|
| 229 |
+
apply Multiplicative.toAdd.injective
|
| 230 |
+
rw [character_subgroupRealPower c H I hH χ hχ]
|
| 231 |
+
change χ u = 1 at hu
|
| 232 |
+
simp [hu]
|
| 233 |
+
|
| 234 |
+
include hH in
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
theorem lower_kernel_inter_contractible (χ : H →* Multiplicative ℝ)
|
| 238 |
+
(hχ : Continuous χ) (K : Subgroup G) (J : Set (Fin n))
|
| 239 |
+
(hK : ∀ g : G, g ∈ K ↔ ∀ i ∈ J, c.coord g i = 0) :
|
| 240 |
+
ContractibleSpace ↥(K ⊓ χ.ker.map H.subtype) := by
|
| 241 |
+
apply contractible_of_realPower_closed c
|
| 242 |
+
((K ⊓ χ.ker.map H.subtype : Subgroup G):Set G) (K ⊓ χ.ker.map H.subtype).one_mem
|
| 243 |
+
intro g hg t
|
| 244 |
+
exact ⟨realPower_mem_of_coordinates c K J hK hg.1 t,
|
| 245 |
+
realPower_mem_mapped_kernel c H I hH χ hχ hg.2 t⟩
|
| 246 |
+
|
| 247 |
+
end RationalLattice
|
| 248 |
+
end
|
| 249 |
+
end
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
section
|
| 254 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 255 |
+
noncomputable section
|
| 256 |
+
namespace TriangularDenominators
|
| 257 |
+
variable {G : Type*} [Group G] {n : ℕ}
|
| 258 |
+
lemma substitute_eval {ι : Type*} (P : MvPolynomial ι ℚ) (p : ι → ℚ[X]) (t : ℚ) :
|
| 259 |
+
(MvPolynomial.eval₂ C p P).eval t = MvPolynomial.eval (fun i => (p i).eval t) P := by
|
| 260 |
+
have h := MvPolynomial.eval₂_comp_left (Polynomial.evalRingHom t) C p P
|
| 261 |
+
have hc : (Polynomial.evalRingHom t).comp C = RingHom.id ℚ := by ext; simp
|
| 262 |
+
rw [hc] at h
|
| 263 |
+
exact h
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
theorem natpow_polynomial (c : Coordinates G n) (g : G) (i : Fin n) :
|
| 267 |
+
∃ p : ℚ[X], ∀ m : ℕ, p.eval (m:ℚ) = c.coord (g^m) i := by
|
| 268 |
+
have aux : ∀ l : ℕ, ∀ hl : l<n, ∃ p : ℚ[X],
|
| 269 |
+
∀ m : ℕ, p.eval (m:ℚ) = c.coord (g^m) ⟨l,hl⟩ := by
|
| 270 |
+
intro l
|
| 271 |
+
induction l using Nat.strong_induction_on with
|
| 272 |
+
| h l ih =>
|
| 273 |
+
intro hl
|
| 274 |
+
choose p hp using (fun j : Fin l => ih j.val j.isLt (lt_trans j.isLt hl))
|
| 275 |
+
let x : (Fin l ⊕ Fin l) → ℚ[X] := Sum.elim p
|
| 276 |
+
(fun j => C (c.coord g ⟨j.val,lt_trans j.isLt hl⟩))
|
| 277 |
+
let Q : ℚ[X] := C (c.coord g ⟨l,hl⟩) +
|
| 278 |
+
MvPolynomial.eval₂ C x (c.correction ⟨l,hl⟩)
|
| 279 |
+
obtain ⟨P,hP0,hP⟩ := Polynomial.exists_antidifference Q
|
| 280 |
+
refine ⟨P,?_⟩
|
| 281 |
+
intro m
|
| 282 |
+
induction m with
|
| 283 |
+
| zero => simpa [c.one_coord] using hP0
|
| 284 |
+
| succ m hm =>
|
| 285 |
+
have he := congrArg (Polynomial.eval (m : ℚ)) hP
|
| 286 |
+
simp only [Polynomial.eval_sub,Polynomial.eval_comp,Polynomial.eval_add,
|
| 287 |
+
Polynomial.eval_one,Polynomial.eval_X] at he
|
| 288 |
+
have hx : (fun a => (x a).eval (m : ℚ)) =
|
| 289 |
+
Sum.elim (fun j => c.coord (g^m) ⟨j.val,lt_trans j.isLt hl⟩)
|
| 290 |
+
(fun j => c.coord g ⟨j.val,lt_trans j.isLt hl⟩) := by
|
| 291 |
+
funext j
|
| 292 |
+
cases j with
|
| 293 |
+
| inl j => exact hp j m
|
| 294 |
+
| inr j => simp [x]
|
| 295 |
+
simp only [Q,Polynomial.eval_add,Polynomial.eval_C,substitute_eval,hx] at he
|
| 296 |
+
rw [pow_succ,c.mul_coord]
|
| 297 |
+
rw [Nat.cast_succ,add_comm (m:ℚ) 1]
|
| 298 |
+
linarith
|
| 299 |
+
exact aux i.val i.isLt
|
| 300 |
+
end TriangularDenominators
|
| 301 |
+
|
| 302 |
+
end
|
| 303 |
+
end
|
| 304 |
+
end
|
| 305 |
+
end
|
| 306 |
+
end
|
| 307 |
+
|
| 308 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice04.lean
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.RationalLattice03
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 12 |
+
noncomputable section
|
| 13 |
+
namespace RationalLattice
|
| 14 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 15 |
+
variable (c : RealCoordinates G n)
|
| 16 |
+
|
| 17 |
+
theorem powerPolynomial_rational {g : G} (hg : IsRational c g) (i : Fin n) :
|
| 18 |
+
∃ p : ℚ[X], powerPolynomial c g i = p.map (algebraMap ℚ ℝ) := by
|
| 19 |
+
let h : rationalSubgroup c := ⟨g,hg⟩
|
| 20 |
+
obtain ⟨p,hp⟩ := TriangularDenominators.natpow_polynomial (rationalCoordinates c) h i
|
| 21 |
+
refine ⟨p,Polynomial.eq_of_eval_nat_eq ?_⟩
|
| 22 |
+
intro m
|
| 23 |
+
rw [powerPolynomial_nat]
|
| 24 |
+
have he := congrArg (fun q : ℚ => (q:ℝ)) (hp m)
|
| 25 |
+
change ((p.eval (m:ℚ) : ℚ) : ℝ) = (qcoord c (h^m) i : ℝ) at he
|
| 26 |
+
rw [qcoord_spec] at he
|
| 27 |
+
change ((p.eval (m:ℚ) : ℚ) : ℝ) = c.coord (g^m) i at he
|
| 28 |
+
rw [← he]
|
| 29 |
+
simpa using (Polynomial.eval_map_apply (p:=p) (algebraMap ℚ ℝ) (m:ℚ)).symm
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
theorem realPower_rational {g : G} (hg : IsRational c g) (t : ℚ) :
|
| 34 |
+
IsRational c (realPower c g t) := by
|
| 35 |
+
intro i
|
| 36 |
+
obtain ⟨p,hp⟩ := powerPolynomial_rational c hg i
|
| 37 |
+
refine ⟨p.eval t,?_⟩
|
| 38 |
+
rw [realPower_coord,hp]
|
| 39 |
+
exact (Polynomial.eval_map_apply (p:=p) (algebraMap ℚ ℝ) t).symm
|
| 40 |
+
|
| 41 |
+
end RationalLattice
|
| 42 |
+
end
|
| 43 |
+
end
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
section
|
| 48 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 49 |
+
noncomputable section
|
| 50 |
+
namespace RationalLattice
|
| 51 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 52 |
+
variable (c : RealCoordinates G n)
|
| 53 |
+
|
| 54 |
+
lemma coord_mul_of_left_zero (g h : G) (i : Fin n)
|
| 55 |
+
(hg : ∀ j : Fin n, j < i → c.coord g j = 0) :
|
| 56 |
+
c.coord (g*h) i = c.coord g i + c.coord h i := by
|
| 57 |
+
have he : (Sum.elim (fun j : Fin i.val => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 58 |
+
(fun j : Fin i.val => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) =
|
| 59 |
+
(Sum.elim (fun j : Fin i.val => c.coord 1 ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 60 |
+
(fun j : Fin i.val => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) := by
|
| 61 |
+
funext a
|
| 62 |
+
cases a with
|
| 63 |
+
| inl j => simp only [Sum.elim_inl]; rw [hg _ j.isLt,c.one_coord]
|
| 64 |
+
| inr j => rfl
|
| 65 |
+
have hm := c.mul_coord 1 h i
|
| 66 |
+
rw [one_mul,c.one_coord,zero_add] at hm
|
| 67 |
+
rw [c.mul_coord,he]
|
| 68 |
+
linarith
|
| 69 |
+
|
| 70 |
+
lemma coord_mul_of_right_zero (g h : G) (i : Fin n)
|
| 71 |
+
(hh : ∀ j : Fin n, j < i → c.coord h j = 0) :
|
| 72 |
+
c.coord (g*h) i = c.coord g i + c.coord h i := by
|
| 73 |
+
have he : (Sum.elim (fun j : Fin i.val => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 74 |
+
(fun j : Fin i.val => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) =
|
| 75 |
+
(Sum.elim (fun j : Fin i.val => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 76 |
+
(fun j : Fin i.val => c.coord 1 ⟨j.val,lt_trans j.isLt i.isLt⟩)) := by
|
| 77 |
+
funext a
|
| 78 |
+
cases a with
|
| 79 |
+
| inl j => rfl
|
| 80 |
+
| inr j => simp only [Sum.elim_inr]; rw [hh _ j.isLt,c.one_coord]
|
| 81 |
+
have hm := c.mul_coord g 1 i
|
| 82 |
+
rw [mul_one,c.one_coord,add_zero] at hm
|
| 83 |
+
rw [c.mul_coord,he]
|
| 84 |
+
linarith
|
| 85 |
+
|
| 86 |
+
lemma realPower_coord_of_lower_zero (g : G) (i : Fin n)
|
| 87 |
+
(hg : ∀ j : Fin n, j < i → c.coord g j = 0) (t : ℝ) :
|
| 88 |
+
c.coord (realPower c g t) i = t * c.coord g i := by
|
| 89 |
+
have hp : powerPolynomial c g i = X * C (c.coord g i) := by
|
| 90 |
+
apply Polynomial.eq_of_eval_nat_eq
|
| 91 |
+
intro m
|
| 92 |
+
rw [powerPolynomial_nat]
|
| 93 |
+
simp only [Polynomial.eval_mul,Polynomial.eval_X,Polynomial.eval_C]
|
| 94 |
+
induction m with
|
| 95 |
+
| zero => simp [c.one_coord]
|
| 96 |
+
| succ m ih => rw [pow_succ,coord_mul_of_right_zero c _ _ i hg,ih]; push_cast; ring
|
| 97 |
+
rw [realPower_coord,hp]
|
| 98 |
+
simp only [Polynomial.eval_mul,Polynomial.eval_X,Polynomial.eval_C]
|
| 99 |
+
|
| 100 |
+
def basisElement (i : Fin n) : G := c.coord.symm (Pi.single i 1)
|
| 101 |
+
def basisFlow (i : Fin n) (t : ℝ) : G := realPower c (basisElement c i) t
|
| 102 |
+
|
| 103 |
+
lemma basisFlow_continuous (i : Fin n) : Continuous (basisFlow c i) :=
|
| 104 |
+
realPower_continuous c _
|
| 105 |
+
@[simp] lemma basisFlow_zero (i : Fin n) : basisFlow c i 0 = 1 := realPower_zero c _
|
| 106 |
+
lemma basisFlow_add (i : Fin n) (s t : ℝ) :
|
| 107 |
+
basisFlow c i (s+t) = basisFlow c i s * basisFlow c i t := realPower_add c _ _ _
|
| 108 |
+
lemma basisFlow_neg (i : Fin n) (t : ℝ) : basisFlow c i (-t) = (basisFlow c i t)⁻¹ :=
|
| 109 |
+
realPower_neg c _ _
|
| 110 |
+
|
| 111 |
+
lemma basisFlow_coord (i j : Fin n) (hji : j ≤ i) (t : ℝ) :
|
| 112 |
+
c.coord (basisFlow c i t) j = if j=i then t else 0 := by
|
| 113 |
+
classical
|
| 114 |
+
have hzero (k : Fin n) (hk : k < j) : c.coord (basisElement c i) k = 0 := by
|
| 115 |
+
have hki : k ≠ i := ne_of_lt (lt_of_lt_of_le hk hji)
|
| 116 |
+
simp [basisElement,hki]
|
| 117 |
+
change c.coord (realPower c (basisElement c i) t) j = _
|
| 118 |
+
rw [realPower_coord_of_lower_zero c _ j hzero]
|
| 119 |
+
simp only [basisElement,Homeomorph.apply_symm_apply,Pi.single_apply]
|
| 120 |
+
split_ifs <;> simp_all
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
def peel (g : G) : ℕ → G
|
| 124 |
+
| 0 => g
|
| 125 |
+
| k+1 => if h : k<n then
|
| 126 |
+
basisFlow c ⟨k,h⟩ (-c.coord (peel g k) ⟨k,h⟩) * peel g k
|
| 127 |
+
else peel g k
|
| 128 |
+
|
| 129 |
+
lemma peel_continuous [IsTopologicalGroup G] (k : ℕ) : Continuous (fun g => peel c g k) := by
|
| 130 |
+
induction k with
|
| 131 |
+
| zero => exact continuous_id
|
| 132 |
+
| succ k ih =>
|
| 133 |
+
simp only [peel]
|
| 134 |
+
split_ifs with h
|
| 135 |
+
· exact ((basisFlow_continuous c _).comp ((continuous_apply _).comp
|
| 136 |
+
(c.coord.continuous.comp ih)).neg).mul ih
|
| 137 |
+
· exact ih
|
| 138 |
+
|
| 139 |
+
lemma peel_zero_coordinates (g : G) (k : ℕ) :
|
| 140 |
+
∀ i : Fin n, i.val < k → c.coord (peel c g k) i = 0 := by
|
| 141 |
+
induction k with
|
| 142 |
+
| zero => intro i hi; omega
|
| 143 |
+
| succ k ih =>
|
| 144 |
+
intro i hi
|
| 145 |
+
by_cases hk : k<n
|
| 146 |
+
· rw [peel,dite_eq_left hk]
|
| 147 |
+
rw [coord_mul_of_left_zero c _ _ i (by
|
| 148 |
+
intro j hj
|
| 149 |
+
rw [basisFlow_coord c _ j (show j.val ≤ k from by change j.val < i.val at hj; omega)]
|
| 150 |
+
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])]
|
| 151 |
+
by_cases hik : i.val < k
|
| 152 |
+
· rw [ih i hik,basisFlow_coord c _ i (show i.val ≤ k from by omega)]
|
| 153 |
+
simp [show i ≠ (⟨k,hk⟩:Fin n) from fun h => by have := congrArg Fin.val h; dsimp at this; omega]
|
| 154 |
+
· have he : i = (⟨k,hk⟩:Fin n) := Fin.ext (show i.val = k from by omega)
|
| 155 |
+
subst i
|
| 156 |
+
rw [basisFlow_coord c _ _ le_rfl]
|
| 157 |
+
simp
|
| 158 |
+
· rw [peel,dite_eq_right hk]
|
| 159 |
+
exact ih i (by omega)
|
| 160 |
+
|
| 161 |
+
lemma peel_dimension (g : G) : peel c g n = 1 := by
|
| 162 |
+
apply c.coord.injective
|
| 163 |
+
funext i
|
| 164 |
+
rw [peel_zero_coordinates c g n i i.isLt,c.one_coord]
|
| 165 |
+
|
| 166 |
+
def expCoordinates (g : G) (i : Fin n) : ℝ := c.coord (peel c g i.val) i
|
| 167 |
+
|
| 168 |
+
def tailProduct (x : Fin n → ℝ) (k : ℕ) : G :=
|
| 169 |
+
((List.ofFn (fun i => basisFlow c i (x i))).drop k).prod
|
| 170 |
+
|
| 171 |
+
def expProduct (x : Fin n → ℝ) : G := tailProduct c x 0
|
| 172 |
+
|
| 173 |
+
lemma tailProduct_dimension (x : Fin n → ℝ) : tailProduct c x n = 1 := by
|
| 174 |
+
have h := List.drop_length (l := List.ofFn (fun i => basisFlow c i (x i)))
|
| 175 |
+
simp only [List.length_ofFn] at h
|
| 176 |
+
simp only [tailProduct,h,List.prod_nil]
|
| 177 |
+
|
| 178 |
+
lemma tailProduct_step (x : Fin n → ℝ) (k : ℕ) (hk : k<n) :
|
| 179 |
+
tailProduct c x k = basisFlow c ⟨k,hk⟩ (x ⟨k,hk⟩) * tailProduct c x (k+1) := by
|
| 180 |
+
unfold tailProduct
|
| 181 |
+
rw [List.drop_eq_getElem_cons (by simpa using hk),List.prod_cons,List.getElem_ofFn]
|
| 182 |
+
|
| 183 |
+
lemma tailProduct_lower (x : Fin n → ℝ) (k : ℕ) (hk : k ≤ n) :
|
| 184 |
+
∀ i : Fin n, i.val < k → c.coord (tailProduct c x k) i = 0 := by
|
| 185 |
+
induction hk using Nat.decreasingInduction with
|
| 186 |
+
| self => intro i hi; rw [tailProduct_dimension,c.one_coord]
|
| 187 |
+
| of_succ k hk ih =>
|
| 188 |
+
intro i hi
|
| 189 |
+
rw [tailProduct_step c x k hk,coord_mul_of_left_zero c _ _ i (by
|
| 190 |
+
intro j hj
|
| 191 |
+
rw [basisFlow_coord c _ j (show j.val ≤ k from by change j.val < i.val at hj; omega)]
|
| 192 |
+
rw [ite_eq_right (fun h => by have := congrArg Fin.val h; change j.val < i.val at hj; dsimp at this; omega)])]
|
| 193 |
+
rw [basisFlow_coord c _ i (show i.val ≤ k from by omega),ih i (by omega)]
|
| 194 |
+
rw [ite_eq_right (fun h => by have := congrArg Fin.val h; dsimp at this; omega),zero_add]
|
| 195 |
+
|
| 196 |
+
lemma tailProduct_coord (x : Fin n → ℝ) (i : Fin n) :
|
| 197 |
+
c.coord (tailProduct c x i.val) i = x i := by
|
| 198 |
+
rw [tailProduct_step c x i.val i.isLt,coord_mul_of_left_zero c _ _ i (by
|
| 199 |
+
intro j hj
|
| 200 |
+
rw [basisFlow_coord c i j (le_of_lt hj),ite_eq_right (ne_of_lt hj)])]
|
| 201 |
+
rw [basisFlow_coord c i i le_rfl,ite_eq_left rfl,
|
| 202 |
+
tailProduct_lower c x (i.val+1) i.isLt i (Nat.lt_succ_self _),add_zero]
|
| 203 |
+
|
| 204 |
+
lemma peel_expProduct (x : Fin n → ℝ) (k : ℕ) (hk : k ≤ n) :
|
| 205 |
+
peel c (expProduct c x) k = tailProduct c x k := by
|
| 206 |
+
induction k with
|
| 207 |
+
| zero => rfl
|
| 208 |
+
| succ k ih =>
|
| 209 |
+
have hkn : k<n := by omega
|
| 210 |
+
rw [peel,dite_eq_left hkn,ih (by omega)]
|
| 211 |
+
rw [tailProduct_coord c x ⟨k,hkn⟩,tailProduct_step c x k hkn,basisFlow_neg]
|
| 212 |
+
exact inv_mul_cancel_left _ _
|
| 213 |
+
|
| 214 |
+
lemma expCoordinates_expProduct (x : Fin n → ℝ) : expCoordinates c (expProduct c x) = x := by
|
| 215 |
+
funext i
|
| 216 |
+
rw [expCoordinates,peel_expProduct c x i.val (Nat.le_of_lt i.isLt),tailProduct_coord]
|
| 217 |
+
|
| 218 |
+
lemma tailProduct_expCoordinates (g : G) (k : ℕ) (hk : k ≤ n) :
|
| 219 |
+
tailProduct c (expCoordinates c g) k = peel c g k := by
|
| 220 |
+
induction hk using Nat.decreasingInduction with
|
| 221 |
+
| self => rw [tailProduct_dimension,peel_dimension]
|
| 222 |
+
| of_succ k hk ih =>
|
| 223 |
+
rw [tailProduct_step c _ k hk,ih,expCoordinates,peel,dite_eq_left hk,basisFlow_neg]
|
| 224 |
+
exact mul_inv_cancel_left _ _
|
| 225 |
+
|
| 226 |
+
lemma expProduct_expCoordinates (g : G) : expProduct c (expCoordinates c g) = g := by
|
| 227 |
+
simpa only [expProduct,peel] using tailProduct_expCoordinates c g 0 (Nat.zero_le n)
|
| 228 |
+
|
| 229 |
+
lemma expCoordinates_continuous [IsTopologicalGroup G] : Continuous (expCoordinates c) := by
|
| 230 |
+
apply continuous_pi
|
| 231 |
+
intro i
|
| 232 |
+
exact (continuous_apply i).comp (c.coord.continuous.comp (peel_continuous c i.val))
|
| 233 |
+
|
| 234 |
+
lemma expProduct_continuous [IsTopologicalGroup G] : Continuous (expProduct c) := by
|
| 235 |
+
change Continuous (fun x : Fin n → ℝ => (List.ofFn (fun i => basisFlow c i (x i))).prod)
|
| 236 |
+
simp only [List.ofFn_eq_map]
|
| 237 |
+
exact continuous_list_prod _ (fun i _ => (basisFlow_continuous c i).comp (continuous_apply i))
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
def secondKindHomeomorph [IsTopologicalGroup G] : G ��ₜ (Fin n → ℝ) where
|
| 242 |
+
toFun := expCoordinates c
|
| 243 |
+
invFun := expProduct c
|
| 244 |
+
left_inv := expProduct_expCoordinates c
|
| 245 |
+
right_inv := expCoordinates_expProduct c
|
| 246 |
+
continuous_toFun := expCoordinates_continuous c
|
| 247 |
+
continuous_invFun := expProduct_continuous c
|
| 248 |
+
|
| 249 |
+
end RationalLattice
|
| 250 |
+
end
|
| 251 |
+
end
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
section
|
| 256 |
+
noncomputable section
|
| 257 |
+
namespace MalcevPrefixQuotient
|
| 258 |
+
open RationalLattice
|
| 259 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n r : ℕ}
|
| 260 |
+
variable (c : RealCoordinates G n) (hr : r ≤ n)
|
| 261 |
+
|
| 262 |
+
include hr in
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
lemma prefix_eq_iff (g h : G) :
|
| 266 |
+
(∀ i : Fin n, i.val < r → c.coord g i = c.coord h i) ↔
|
| 267 |
+
(∀ i : Fin n, i.val < r → c.coord (g⁻¹*h) i = 0) := by
|
| 268 |
+
constructor
|
| 269 |
+
· intro he i hi
|
| 270 |
+
have haux : ∀ m : ℕ, ∀ hm : m < r, c.coord (g⁻¹*h) ⟨m,lt_of_lt_of_le hm hr⟩ = 0 := by
|
| 271 |
+
intro m
|
| 272 |
+
induction m using Nat.strong_induction_on with
|
| 273 |
+
| h m ih =>
|
| 274 |
+
intro hm
|
| 275 |
+
let j : Fin n := ⟨m,lt_of_lt_of_le hm hr⟩
|
| 276 |
+
have hd : ∀ u : Fin n, u < j → c.coord (g⁻¹*h) u = 0 := by
|
| 277 |
+
intro u hu
|
| 278 |
+
exact ih u.val hu (lt_trans hu hm)
|
| 279 |
+
have hc := coord_mul_of_right_zero c g (g⁻¹*h) j hd
|
| 280 |
+
rw [mul_inv_cancel_left] at hc
|
| 281 |
+
have he' := he j hm
|
| 282 |
+
linarith
|
| 283 |
+
exact haux i.val hi
|
| 284 |
+
· intro hd i hi
|
| 285 |
+
have hc := coord_mul_of_right_zero c g (g⁻¹*h) i (fun u hu => hd u (lt_trans hu hi))
|
| 286 |
+
rw [mul_inv_cancel_left,hd i hi,add_zero] at hc
|
| 287 |
+
exact hc.symm
|
| 288 |
+
|
| 289 |
+
variable (N : Subgroup G)
|
| 290 |
+
variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin n, i.val < r → c.coord g i = 0)
|
| 291 |
+
include hr hN in
|
| 292 |
+
lemma eq_coset_iff (g h : G) :
|
| 293 |
+
(QuotientGroup.mk g : G ⧸ N) = QuotientGroup.mk h ↔
|
| 294 |
+
∀ i : Fin n, i.val < r → c.coord g i = c.coord h i := by
|
| 295 |
+
rw [QuotientGroup.eq,hN]
|
| 296 |
+
exact (prefix_eq_iff c hr g h).symm
|
| 297 |
+
|
| 298 |
+
def embed (i : Fin r) : Fin n := ⟨i.val,lt_of_lt_of_le i.isLt hr⟩
|
| 299 |
+
def lift (x : Fin r → ℝ) (i : Fin n) : ℝ := if h : i.val < r then x ⟨i.val,h⟩ else 0
|
| 300 |
+
@[simp] lemma lift_embed (x : Fin r → ℝ) (i : Fin r) : lift x (embed hr i) = x i := by
|
| 301 |
+
simp [lift,embed,i.isLt]
|
| 302 |
+
lemma lift_continuous : Continuous (lift (n:=n) (r:=r)) := by
|
| 303 |
+
apply continuous_pi
|
| 304 |
+
intro i
|
| 305 |
+
unfold lift
|
| 306 |
+
split_ifs
|
| 307 |
+
· exact continuous_apply _
|
| 308 |
+
· exact continuous_const
|
| 309 |
+
|
| 310 |
+
def coordinates (x : G ⧸ N) (i : Fin r) : ℝ := Quotient.lift (fun g : G => c.coord g (embed hr i))
|
| 311 |
+
(by
|
| 312 |
+
intro g h he
|
| 313 |
+
exact ((prefix_eq_iff c hr g h).mpr ((hN _).mp (QuotientGroup.leftRel_apply.mp he))) (embed hr i) i.isLt) x
|
| 314 |
+
|
| 315 |
+
@[simp] lemma coordinates_mk (g : G) (i : Fin r) :
|
| 316 |
+
coordinates c hr N hN (QuotientGroup.mk g) i = c.coord g (embed hr i) := rfl
|
| 317 |
+
|
| 318 |
+
def represent (x : Fin r → ℝ) : G := c.coord.symm (lift x)
|
| 319 |
+
def rebuild (x : Fin r → ℝ) : G ⧸ N := QuotientGroup.mk (represent c x)
|
| 320 |
+
|
| 321 |
+
lemma coordinates_rebuild (x : Fin r → ℝ) : coordinates c hr N hN (rebuild c N x) = x := by
|
| 322 |
+
funext i
|
| 323 |
+
simp [rebuild,represent,coordinates_mk]
|
| 324 |
+
lemma rebuild_coordinates (x : G ⧸ N) : rebuild c N (coordinates c hr N hN x) = x := by
|
| 325 |
+
induction x using Quotient.inductionOn with | h g =>
|
| 326 |
+
apply (eq_coset_iff c hr N hN _ _).mpr
|
| 327 |
+
intro i hi
|
| 328 |
+
simp [represent,lift,hi,embed]
|
| 329 |
+
lemma coordinates_continuous : Continuous (coordinates c hr N hN) := by
|
| 330 |
+
rw [(QuotientGroup.isQuotientMap_mk N).continuous_iff]
|
| 331 |
+
apply continuous_pi
|
| 332 |
+
intro i
|
| 333 |
+
change Continuous (fun g : G => c.coord g (embed hr i))
|
| 334 |
+
exact (continuous_apply (embed hr i)).comp c.coord.continuous
|
| 335 |
+
lemma rebuild_continuous : Continuous (rebuild c (r:=r) N) :=
|
| 336 |
+
QuotientGroup.continuous_mk.comp (c.coord.symm.continuous.comp lift_continuous)
|
| 337 |
+
|
| 338 |
+
def homeomorph : (G ⧸ N) ≃ₜ (Fin r → ℝ) where
|
| 339 |
+
toFun := coordinates c hr N hN
|
| 340 |
+
invFun := rebuild c N
|
| 341 |
+
left_inv := rebuild_coordinates c hr N hN
|
| 342 |
+
right_inv := coordinates_rebuild c hr N hN
|
| 343 |
+
continuous_toFun := coordinates_continuous c hr N hN
|
| 344 |
+
continuous_invFun := rebuild_continuous c N
|
| 345 |
+
|
| 346 |
+
variable [N.Normal]
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
def quotientChart : RealCoordinates (G ⧸ N) r where
|
| 351 |
+
coord := homeomorph c hr N hN
|
| 352 |
+
one_coord i := c.one_coord _
|
| 353 |
+
correction i := c.correction (embed hr i)
|
| 354 |
+
mul_coord g h i := by
|
| 355 |
+
induction g using Quotient.inductionOn with | h g =>
|
| 356 |
+
induction h using Quotient.inductionOn with | h h =>
|
| 357 |
+
exact c.mul_coord g h (embed hr i)
|
| 358 |
+
|
| 359 |
+
end MalcevPrefixQuotient
|
| 360 |
+
|
| 361 |
+
end
|
| 362 |
+
end
|
| 363 |
+
end
|
| 364 |
+
end
|
| 365 |
+
end
|
| 366 |
+
|
| 367 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice05.lean
ADDED
|
@@ -0,0 +1,443 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 12 |
+
noncomputable section
|
| 13 |
+
namespace RationalLattice
|
| 14 |
+
open RationalPolynomialMap
|
| 15 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 16 |
+
variable (c : RealCoordinates G n) {σ : Type*}
|
| 17 |
+
|
| 18 |
+
def IsPolynomialMap (f : (σ → ℝ) → G) : Prop :=
|
| 19 |
+
∀ i, RationalPolynomialMap.IsPolynomial (fun x => c.coord (f x) i)
|
| 20 |
+
|
| 21 |
+
lemma polynomialMap_const {g : G} (hg : IsRational c g) :
|
| 22 |
+
IsPolynomialMap c (fun _ : σ → ℝ => g) := by
|
| 23 |
+
intro i
|
| 24 |
+
obtain ⟨q,hq⟩ := hg i
|
| 25 |
+
simpa only [← hq] using RationalPolynomialMap.const (σ:=σ) q
|
| 26 |
+
|
| 27 |
+
lemma polynomialMap_one : IsPolynomialMap c (fun _ : σ → ℝ => (1:G)) :=
|
| 28 |
+
polynomialMap_const c (rational_one c)
|
| 29 |
+
|
| 30 |
+
lemma polynomialMap_mul {f g : (σ → ℝ) → G} (hf : IsPolynomialMap c f)
|
| 31 |
+
(hg : IsPolynomialMap c g) : IsPolynomialMap c (fun x => f x*g x) := by
|
| 32 |
+
intro i
|
| 33 |
+
have hc : IsPolynomial (fun x => MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 34 |
+
(Sum.elim (fun j : Fin i.val => c.coord (f x) ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 35 |
+
(fun j : Fin i.val => c.coord (g x) ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i)) := by
|
| 36 |
+
apply RationalPolynomialMap.eval
|
| 37 |
+
intro j
|
| 38 |
+
cases j with
|
| 39 |
+
| inl j => exact hf _
|
| 40 |
+
| inr j => exact hg _
|
| 41 |
+
simpa only [c.mul_coord] using RationalPolynomialMap.add (RationalPolynomialMap.add (hf i) (hg i)) hc
|
| 42 |
+
|
| 43 |
+
lemma polynomialMap_basisFlow (i : Fin n) {f : (σ → ℝ) → ℝ} (hf : IsPolynomial f) :
|
| 44 |
+
IsPolynomialMap c (fun x => basisFlow c i (f x)) := by
|
| 45 |
+
intro j
|
| 46 |
+
obtain ⟨p,hp⟩ := powerPolynomial_rational c (g := basisElement c i) (by
|
| 47 |
+
intro k
|
| 48 |
+
classical
|
| 49 |
+
refine ⟨if k=i then 1 else 0,?_⟩
|
| 50 |
+
simp only [basisElement,Homeomorph.apply_symm_apply,Pi.single_apply]
|
| 51 |
+
split_ifs <;> simp) j
|
| 52 |
+
change IsPolynomial (fun x => c.coord (realPower c (basisElement c i) (f x)) j)
|
| 53 |
+
simpa only [realPower_coord,hp,Polynomial.eval_map] using polynomial_eval p hf
|
| 54 |
+
|
| 55 |
+
lemma polynomialMap_peel {f : (σ → ℝ) → G} (hf : IsPolynomialMap c f) (k : ℕ) :
|
| 56 |
+
IsPolynomialMap c (fun x => peel c (f x) k) := by
|
| 57 |
+
induction k with
|
| 58 |
+
| zero => exact hf
|
| 59 |
+
| succ k ih =>
|
| 60 |
+
simp only [peel]
|
| 61 |
+
split_ifs with hk
|
| 62 |
+
· exact polynomialMap_mul c
|
| 63 |
+
(polynomialMap_basisFlow c ⟨k,hk⟩ (RationalPolynomialMap.neg (ih _))) ih
|
| 64 |
+
· exact ih
|
| 65 |
+
|
| 66 |
+
lemma polynomial_expCoordinates {f : (σ → ℝ) → G} (hf : IsPolynomialMap c f) (i : Fin n) :
|
| 67 |
+
IsPolynomial (fun x => expCoordinates c (f x) i) := polynomialMap_peel c hf i.val i
|
| 68 |
+
|
| 69 |
+
lemma polynomialMap_expProduct {f : (σ → ℝ) → (Fin n → ℝ)}
|
| 70 |
+
(hf : ∀ i, IsPolynomial (fun x => f x i)) : IsPolynomialMap c (fun x => expProduct c (f x)) := by
|
| 71 |
+
change IsPolynomialMap c (fun x => (List.ofFn (fun i => basisFlow c i (f x i))).prod)
|
| 72 |
+
simp only [List.ofFn_eq_map]
|
| 73 |
+
generalize List.finRange n = l
|
| 74 |
+
induction l with
|
| 75 |
+
| nil => exact polynomialMap_one c
|
| 76 |
+
| cons i l ih =>
|
| 77 |
+
simp only [List.map_cons,List.prod_cons]
|
| 78 |
+
exact polynomialMap_mul c (polynomialMap_basisFlow c i (hf i)) ih
|
| 79 |
+
|
| 80 |
+
end RationalLattice
|
| 81 |
+
end
|
| 82 |
+
end
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
section
|
| 87 |
+
open scoped BigOperators
|
| 88 |
+
noncomputable section
|
| 89 |
+
namespace MalcevCharacters
|
| 90 |
+
open RationalLattice
|
| 91 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 92 |
+
variable {n : ℕ} (c : RealCoordinates G n)
|
| 93 |
+
|
| 94 |
+
omit [IsTopologicalGroup G] in
|
| 95 |
+
@[simp] lemma coord_axis (i : Fin n) (t : ℝ) : c.coord (axis c i t) = Pi.single i t :=
|
| 96 |
+
c.coord.apply_symm_apply _
|
| 97 |
+
|
| 98 |
+
omit [IsTopologicalGroup G] in
|
| 99 |
+
@[simp] lemma axis_zero (i : Fin n) : axis c i 0 = 1 := by
|
| 100 |
+
apply c.coord.injective
|
| 101 |
+
ext j
|
| 102 |
+
simp [c.one_coord]
|
| 103 |
+
|
| 104 |
+
omit [IsTopologicalGroup G] in
|
| 105 |
+
lemma axis_continuous (i : Fin n) : Continuous (axis c i) := by
|
| 106 |
+
apply c.coord.symm.continuous.comp
|
| 107 |
+
exact continuous_pi (fun j => by
|
| 108 |
+
by_cases h : j = i
|
| 109 |
+
· subst j
|
| 110 |
+
change Continuous (fun t : ℝ => (Pi.single i t : Fin n → ℝ) i)
|
| 111 |
+
simp only [Pi.single_eq_same]
|
| 112 |
+
exact continuous_id
|
| 113 |
+
· simpa [Pi.single_apply,h] using (continuous_const : Continuous (fun _ : ℝ => (0 : ℝ))))
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
variable (hsk : SecondKind c) (χ : G →* Multiplicative ℝ)
|
| 118 |
+
include hsk
|
| 119 |
+
|
| 120 |
+
def axisCharacter (i : Fin n) : ℝ →+ ℝ where
|
| 121 |
+
toFun t := Multiplicative.toAdd (χ (axis c i t))
|
| 122 |
+
map_zero' := by simp
|
| 123 |
+
map_add' s t := by
|
| 124 |
+
change Multiplicative.toAdd (χ (axis c i (s+t))) = _
|
| 125 |
+
rw [hsk.axis_add, map_mul]
|
| 126 |
+
rfl
|
| 127 |
+
|
| 128 |
+
omit [IsTopologicalGroup G] in
|
| 129 |
+
lemma axisCharacter_continuous (hχ : Continuous χ) (i : Fin n) :
|
| 130 |
+
Continuous (axisCharacter c hsk χ i) := hχ.comp (axis_continuous c i)
|
| 131 |
+
|
| 132 |
+
omit [IsTopologicalGroup G] in
|
| 133 |
+
lemma character_axis (hχ : Continuous χ) (i : Fin n) (t : ℝ) :
|
| 134 |
+
Multiplicative.toAdd (χ (axis c i t)) = t * Multiplicative.toAdd (χ (axis c i 1)) := by
|
| 135 |
+
change axisCharacter c hsk χ i t = t * axisCharacter c hsk χ i 1
|
| 136 |
+
have h := map_real_smul (axisCharacter c hsk χ i) (axisCharacter_continuous c hsk χ hχ i) t 1
|
| 137 |
+
simpa using h
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
omit [IsTopologicalGroup G] in
|
| 142 |
+
theorem character_coordinates (hχ : Continuous χ) (g : G) :
|
| 143 |
+
Multiplicative.toAdd (χ g) =
|
| 144 |
+
∑ i, c.coord g i * Multiplicative.toAdd (χ (axis c i 1)) := by
|
| 145 |
+
conv_lhs => rw [hsk.ordered g]
|
| 146 |
+
rw [map_list_prod, List.map_ofFn]
|
| 147 |
+
change Multiplicative.toAdd ((List.ofFn fun i => χ (axis c i (c.coord g i))).prod) = _
|
| 148 |
+
simp only [toAdd_list_sum, List.map_ofFn, List.sum_ofFn]
|
| 149 |
+
apply Finset.sum_congr rfl
|
| 150 |
+
intro i _
|
| 151 |
+
exact character_axis c hsk χ hχ i _
|
| 152 |
+
|
| 153 |
+
variable (Γ : Subgroup G)
|
| 154 |
+
variable (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z)
|
| 155 |
+
|
| 156 |
+
omit hsk [IsTopologicalGroup G] in
|
| 157 |
+
include hΓ in
|
| 158 |
+
lemma axis_one_mem (i : Fin n) : axis c i 1 ∈ Γ := by
|
| 159 |
+
classical
|
| 160 |
+
apply (hΓ _).mpr
|
| 161 |
+
intro j
|
| 162 |
+
by_cases h : j = i
|
| 163 |
+
· subst j
|
| 164 |
+
exact ⟨1,by simp⟩
|
| 165 |
+
· exact ⟨0,by simp [h]⟩
|
| 166 |
+
|
| 167 |
+
include hΓ in
|
| 168 |
+
|
| 169 |
+
omit [IsTopologicalGroup G] in
|
| 170 |
+
theorem integer_character_coordinates (hχ : Continuous χ)
|
| 171 |
+
(hz : ∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (χ g) = z) :
|
| 172 |
+
∃ k : Fin n → ℤ, ∀ g : G, Multiplicative.toAdd (χ g) = ∑ i, c.coord g i * (k i : ℝ) := by
|
| 173 |
+
choose k hk using (fun i => hz _ (axis_one_mem c Γ hΓ i))
|
| 174 |
+
refine ⟨k,fun g => ?_⟩
|
| 175 |
+
rw [character_coordinates c hsk χ hχ g]
|
| 176 |
+
simp_rw [hk]
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
def coordinateForm (a : Fin n → ℝ) : (Fin n → ℝ) →ₗ[ℝ] ℝ where
|
| 180 |
+
toFun x := ∑ i, x i * a i
|
| 181 |
+
map_add' x y := by simp [add_mul,Finset.sum_add_distrib]
|
| 182 |
+
map_smul' r x := by simp [Finset.mul_sum,mul_assoc]
|
| 183 |
+
|
| 184 |
+
omit [IsTopologicalGroup G] in
|
| 185 |
+
lemma kernel_eq_image (hχ : Continuous χ) :
|
| 186 |
+
(χ.ker : Set G) = c.coord.symm ''
|
| 187 |
+
((coordinateForm (fun i => Multiplicative.toAdd (χ (axis c i 1)))).ker : Set (Fin n → ℝ)) := by
|
| 188 |
+
ext g
|
| 189 |
+
constructor
|
| 190 |
+
· intro hg
|
| 191 |
+
refine ⟨c.coord g,?_,c.coord.symm_apply_apply g⟩
|
| 192 |
+
change (∑ i, c.coord g i * Multiplicative.toAdd (χ (axis c i 1))) = 0
|
| 193 |
+
rw [← character_coordinates c hsk χ hχ g]
|
| 194 |
+
change χ g = 1 at hg
|
| 195 |
+
rw [hg]
|
| 196 |
+
rfl
|
| 197 |
+
· rintro ⟨x,hx,rfl⟩
|
| 198 |
+
change χ (c.coord.symm x) = 1
|
| 199 |
+
apply Multiplicative.toAdd.injective
|
| 200 |
+
rw [character_coordinates c hsk χ hχ]
|
| 201 |
+
simpa [coordinateForm] using hx
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
omit [IsTopologicalGroup G] in
|
| 206 |
+
theorem kernel_connected (hχ : Continuous χ) : IsConnected (χ.ker : Set G) := by
|
| 207 |
+
rw [kernel_eq_image c hsk χ hχ]
|
| 208 |
+
exact ((coordinateForm (fun i => Multiplicative.toAdd (χ (axis c i 1)))).ker.convex.isConnected
|
| 209 |
+
⟨0,by simp⟩).image _ c.coord.symm.continuous.continuousOn
|
| 210 |
+
|
| 211 |
+
end MalcevCharacters
|
| 212 |
+
end
|
| 213 |
+
end
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
section
|
| 218 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 219 |
+
noncomputable section
|
| 220 |
+
namespace RationalLattice
|
| 221 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 222 |
+
variable (c : RealCoordinates G n)
|
| 223 |
+
|
| 224 |
+
def prefixProduct (x : Fin n → ℝ) (k : ℕ) : G :=
|
| 225 |
+
((List.ofFn (fun i => basisFlow c i (x i))).take k).prod
|
| 226 |
+
|
| 227 |
+
lemma prefix_mul_tail (x : Fin n → ℝ) (k : ℕ) :
|
| 228 |
+
prefixProduct c x k * tailProduct c x k = expProduct c x :=
|
| 229 |
+
List.prod_take_mul_prod_drop _ _
|
| 230 |
+
|
| 231 |
+
lemma expProduct_coord (x : Fin n → ℝ) (i : Fin n) :
|
| 232 |
+
c.coord (expProduct c x) i = c.coord (prefixProduct c x i.val) i + x i := by
|
| 233 |
+
rw [← prefix_mul_tail c x i.val]
|
| 234 |
+
rw [coord_mul_of_right_zero c _ _ i (fun j hj =>
|
| 235 |
+
tailProduct_lower c x i.val (Nat.le_of_lt i.isLt) j hj),tailProduct_coord]
|
| 236 |
+
|
| 237 |
+
lemma prefixProduct_eq (x y : Fin n → ℝ) (k : ℕ)
|
| 238 |
+
(h : ∀ i : Fin n, i.val < k → x i = y i) : prefixProduct c x k = prefixProduct c y k := by
|
| 239 |
+
apply congrArg List.prod
|
| 240 |
+
apply List.ext_getElem
|
| 241 |
+
· simp only [List.length_take,List.length_ofFn]
|
| 242 |
+
· intro i h1 h2
|
| 243 |
+
simp only [List.getElem_take,List.getElem_ofFn]
|
| 244 |
+
congr 1
|
| 245 |
+
apply h
|
| 246 |
+
simp only [List.length_take,List.length_ofFn] at h1
|
| 247 |
+
exact lt_of_lt_of_le h1 (min_le_left _ _)
|
| 248 |
+
|
| 249 |
+
lemma expProduct_coord_sub (x y : Fin n → ℝ) (i : Fin n)
|
| 250 |
+
(h : ∀ j : Fin n, j < i → x j = y j) :
|
| 251 |
+
c.coord (expProduct c x) i - c.coord (expProduct c y) i = x i-y i := by
|
| 252 |
+
rw [expProduct_coord,expProduct_coord,prefixProduct_eq c x y i.val h]
|
| 253 |
+
ring
|
| 254 |
+
|
| 255 |
+
lemma expProduct_coord_eq (x y : Fin n → ℝ) (i : Fin n)
|
| 256 |
+
(h : ∀ j : Fin n, j ≤ i → x j = y j) :
|
| 257 |
+
c.coord (expProduct c x) i = c.coord (expProduct c y) i := by
|
| 258 |
+
have he := expProduct_coord_sub c x y i (fun j hj => h j (le_of_lt hj))
|
| 259 |
+
rw [h i le_rfl,sub_self] at he
|
| 260 |
+
linarith
|
| 261 |
+
|
| 262 |
+
lemma expCoordinates_prefix_eq (g h : G) (i : Fin n)
|
| 263 |
+
(he : ∀ j : Fin n, j ≤ i → c.coord g j = c.coord h j) :
|
| 264 |
+
expCoordinates c g i = expCoordinates c h i := by
|
| 265 |
+
have aux : ∀ k : ℕ, ∀ hk : k<n,
|
| 266 |
+
(∀ j : Fin n, j.val ≤ k → c.coord g j = c.coord h j) →
|
| 267 |
+
expCoordinates c g ⟨k,hk⟩ = expCoordinates c h ⟨k,hk⟩ := by
|
| 268 |
+
intro k
|
| 269 |
+
induction k using Nat.strong_induction_on with
|
| 270 |
+
| h k ih =>
|
| 271 |
+
intro hk he
|
| 272 |
+
have hl : ∀ j : Fin n, j < (⟨k,hk⟩:Fin n) → expCoordinates c g j = expCoordinates c h j := by
|
| 273 |
+
intro j hj
|
| 274 |
+
apply ih j.val hj j.isLt
|
| 275 |
+
intro a ha
|
| 276 |
+
exact he a (by change j.val < k at hj; omega)
|
| 277 |
+
have hs := expProduct_coord_sub c (expCoordinates c g) (expCoordinates c h) ⟨k,hk⟩ hl
|
| 278 |
+
rw [expProduct_expCoordinates,expProduct_expCoordinates,he _ le_rfl,sub_self] at hs
|
| 279 |
+
linarith
|
| 280 |
+
exact aux i.val i.isLt he
|
| 281 |
+
|
| 282 |
+
lemma expCoordinates_coord_sub (g h : G) (i : Fin n)
|
| 283 |
+
(he : ∀ j : Fin n, j < i → c.coord g j = c.coord h j) :
|
| 284 |
+
expCoordinates c g i - expCoordinates c h i = c.coord g i - c.coord h i := by
|
| 285 |
+
have hl : ∀ j : Fin n, j < i → expCoordinates c g j = expCoordinates c h j := by
|
| 286 |
+
intro j hj
|
| 287 |
+
exact expCoordinates_prefix_eq c g h j (fun a ha => he a (lt_of_le_of_lt ha hj))
|
| 288 |
+
have hs := expProduct_coord_sub c (expCoordinates c g) (expCoordinates c h) i hl
|
| 289 |
+
rw [expProduct_expCoordinates,expProduct_expCoordinates] at hs
|
| 290 |
+
exact hs.symm
|
| 291 |
+
|
| 292 |
+
def lowerExtend (i : Fin n) (x : Fin i.val → ℝ) (j : Fin n) : ℝ :=
|
| 293 |
+
if h : j.val< i.val then x ⟨j.val,h⟩ else 0
|
| 294 |
+
|
| 295 |
+
lemma expCoordinates_mul_difference (x y : Fin n → ℝ) (i : Fin n) :
|
| 296 |
+
expCoordinates c (expProduct c x * expProduct c y) i = x i + y i +
|
| 297 |
+
expCoordinates c (expProduct c (lowerExtend i (fun j => x ⟨j.val,lt_trans j.isLt i.isLt⟩)) *
|
| 298 |
+
expProduct c (lowerExtend i (fun j => y ⟨j.val,lt_trans j.isLt i.isLt⟩))) i := by
|
| 299 |
+
let x0 := lowerExtend i (fun j => x ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 300 |
+
let y0 := lowerExtend i (fun j => y ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 301 |
+
have hx : ∀ j : Fin n, j< i → x j = x0 j := by intro j hj; simp [x0,lowerExtend,hj]
|
| 302 |
+
have hy : ∀ j : Fin n, j< i → y j = y0 j := by intro j hj; simp [y0,lowerExtend,hj]
|
| 303 |
+
have cx : ∀ j : Fin n, j< i → c.coord (expProduct c x) j = c.coord (expProduct c x0) j := by
|
| 304 |
+
intro j hj
|
| 305 |
+
exact expProduct_coord_eq c x x0 j (fun a ha => hx a (lt_of_le_of_lt ha hj))
|
| 306 |
+
have cy : ∀ j : Fin n, j< i → c.coord (expProduct c y) j = c.coord (expProduct c y0) j := by
|
| 307 |
+
intro j hj
|
| 308 |
+
exact expProduct_coord_eq c y y0 j (fun a ha => hy a (lt_of_le_of_lt ha hj))
|
| 309 |
+
have cm : ∀ j : Fin n, j< i →
|
| 310 |
+
c.coord (expProduct c x * expProduct c y) j = c.coord (expProduct c x0 * expProduct c y0) j := by
|
| 311 |
+
intro j hj
|
| 312 |
+
rw [c.mul_coord,c.mul_coord,cx j hj,cy j hj]
|
| 313 |
+
congr 2
|
| 314 |
+
funext a
|
| 315 |
+
cases a with
|
| 316 |
+
| inl a => exact cx _ (lt_trans a.isLt hj)
|
| 317 |
+
| inr a => exact cy _ (lt_trans a.isLt hj)
|
| 318 |
+
have hcorr : MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 319 |
+
(Sum.elim (fun j : Fin i.val => c.coord (expProduct c x) ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 320 |
+
(fun j : Fin i.val => c.coord (expProduct c y) ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i) =
|
| 321 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 322 |
+
(Sum.elim (fun j : Fin i.val => c.coord (expProduct c x0) ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 323 |
+
(fun j : Fin i.val => c.coord (expProduct c y0) ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i) := by
|
| 324 |
+
congr 1
|
| 325 |
+
funext a
|
| 326 |
+
cases a with
|
| 327 |
+
| inl a => exact cx _ a.isLt
|
| 328 |
+
| inr a => exact cy _ a.isLt
|
| 329 |
+
have hs := expCoordinates_coord_sub c _ _ i cm
|
| 330 |
+
rw [c.mul_coord,c.mul_coord,hcorr] at hs
|
| 331 |
+
have hdx := expProduct_coord_sub c x x0 i hx
|
| 332 |
+
have hdy := expProduct_coord_sub c y y0 i hy
|
| 333 |
+
have hx0 : x0 i = 0 := by simp [x0,lowerExtend]
|
| 334 |
+
have hy0 : y0 i = 0 := by simp [y0,lowerExtend]
|
| 335 |
+
rw [hx0] at hdx
|
| 336 |
+
rw [hy0] at hdy
|
| 337 |
+
change expCoordinates c (expProduct c x * expProduct c y) i = x i+y i+
|
| 338 |
+
expCoordinates c (expProduct c x0 * expProduct c y0) i
|
| 339 |
+
linarith
|
| 340 |
+
|
| 341 |
+
lemma exists_second_correction (i : Fin n) :
|
| 342 |
+
∃ P : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ,
|
| 343 |
+
∀ v : (Fin i.val ⊕ Fin i.val) → ℝ,
|
| 344 |
+
expCoordinates c
|
| 345 |
+
(expProduct c (lowerExtend i (fun j => v (Sum.inl j))) *
|
| 346 |
+
expProduct c (lowerExtend i (fun j => v (Sum.inr j)))) i =
|
| 347 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ) v P := by
|
| 348 |
+
apply polynomial_expCoordinates c
|
| 349 |
+
apply polynomialMap_mul c <;> apply polynomialMap_expProduct c <;> intro j
|
| 350 |
+
all_goals
|
| 351 |
+
unfold lowerExtend
|
| 352 |
+
split_ifs with hj
|
| 353 |
+
· exact RationalPolynomialMap.coordinate _
|
| 354 |
+
· exact RationalPolynomialMap.zero
|
| 355 |
+
|
| 356 |
+
lemma expProduct_zero : expProduct c 0 = 1 := by
|
| 357 |
+
change (List.ofFn (fun i => basisFlow c i 0)).prod = 1
|
| 358 |
+
apply List.prod_eq_one
|
| 359 |
+
intro x hx
|
| 360 |
+
obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hx
|
| 361 |
+
exact basisFlow_zero c i
|
| 362 |
+
|
| 363 |
+
lemma expCoordinates_one : expCoordinates c 1 = 0 := by
|
| 364 |
+
rw [← expProduct_zero c,expCoordinates_expProduct]
|
| 365 |
+
|
| 366 |
+
def secondCorrection (i : Fin n) : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ :=
|
| 367 |
+
(exists_second_correction c i).choose
|
| 368 |
+
|
| 369 |
+
lemma second_mul_coord (g h : G) (i : Fin n) :
|
| 370 |
+
expCoordinates c (g*h) i = expCoordinates c g i + expCoordinates c h i +
|
| 371 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 372 |
+
(Sum.elim (fun j => expCoordinates c g ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 373 |
+
(fun j => expCoordinates c h ⟨j.val,lt_trans j.isLt i.isLt⟩)) (secondCorrection c i) := by
|
| 374 |
+
have hm := expCoordinates_mul_difference c (expCoordinates c g) (expCoordinates c h) i
|
| 375 |
+
rw [expProduct_expCoordinates,expProduct_expCoordinates] at hm
|
| 376 |
+
rw [hm]
|
| 377 |
+
congr 1
|
| 378 |
+
exact (exists_second_correction c i).choose_spec
|
| 379 |
+
(Sum.elim (fun j => expCoordinates c g ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 380 |
+
(fun j => expCoordinates c h ⟨j.val,lt_trans j.isLt i.isLt⟩))
|
| 381 |
+
|
| 382 |
+
|
| 383 |
+
def secondCoordinates [IsTopologicalGroup G] : RealCoordinates G n where
|
| 384 |
+
coord := secondKindHomeomorph c
|
| 385 |
+
one_coord i := congrFun (expCoordinates_one c) i
|
| 386 |
+
correction := secondCorrection c
|
| 387 |
+
mul_coord := second_mul_coord c
|
| 388 |
+
|
| 389 |
+
lemma expProduct_single (i : Fin n) (t : ℝ) : expProduct c (Pi.single i t) = basisFlow c i t := by
|
| 390 |
+
classical
|
| 391 |
+
change (List.ofFn (fun j => basisFlow c j ((Pi.single i t : Fin n → ℝ) j))).prod = _
|
| 392 |
+
rw [List.ofFn_eq_map,List.prod_map_eq_pow_single i]
|
| 393 |
+
· simp
|
| 394 |
+
· intro j hji hj
|
| 395 |
+
simp [hji]
|
| 396 |
+
|
| 397 |
+
lemma second_axis [IsTopologicalGroup G] (i : Fin n) (t : ℝ) :
|
| 398 |
+
MalcevCharacters.axis (secondCoordinates c) i t = basisFlow c i t := expProduct_single c i t
|
| 399 |
+
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
theorem secondCoordinates_secondKind [IsTopologicalGroup G] :
|
| 403 |
+
MalcevCharacters.SecondKind (secondCoordinates c) where
|
| 404 |
+
axis_add i s t := by simp only [second_axis]; exact basisFlow_add c i s t
|
| 405 |
+
ordered g := by
|
| 406 |
+
simp only [second_axis]
|
| 407 |
+
exact (expProduct_expCoordinates c g).symm
|
| 408 |
+
|
| 409 |
+
lemma coordinates_prefix_zeros_iff (g : G) (k : ℕ) :
|
| 410 |
+
(∀ i : Fin n, i.val < k → expCoordinates c g i = 0) ↔
|
| 411 |
+
(∀ i : Fin n, i.val < k → c.coord g i = 0) := by
|
| 412 |
+
constructor
|
| 413 |
+
· intro hg i hi
|
| 414 |
+
have he := expProduct_coord_eq c (expCoordinates c g) 0 i (fun j hj => hg j (by
|
| 415 |
+
change j.val ≤ i.val at hj; omega))
|
| 416 |
+
rw [expProduct_expCoordinates,expProduct_zero,c.one_coord] at he
|
| 417 |
+
exact he
|
| 418 |
+
· intro hg i hi
|
| 419 |
+
have he := expCoordinates_prefix_eq c g 1 i (by
|
| 420 |
+
intro j hj
|
| 421 |
+
rw [c.one_coord]
|
| 422 |
+
apply hg
|
| 423 |
+
change j.val ≤ i.val at hj
|
| 424 |
+
omega)
|
| 425 |
+
rw [expCoordinates_one] at he
|
| 426 |
+
exact he
|
| 427 |
+
|
| 428 |
+
|
| 429 |
+
|
| 430 |
+
theorem secondCoordinates_adapted [IsTopologicalGroup G] (H : Subgroup G) (k : ℕ)
|
| 431 |
+
(hH : ∀ g : G, g ∈ H ↔ ∀ i : Fin n, i.val < k → c.coord g i = 0) (g : G) :
|
| 432 |
+
g ∈ H ↔ ∀ i : Fin n, i.val < k → (secondCoordinates c).coord g i = 0 := by
|
| 433 |
+
exact (hH g).trans (coordinates_prefix_zeros_iff c g k).symm
|
| 434 |
+
|
| 435 |
+
end RationalLattice
|
| 436 |
+
|
| 437 |
+
end
|
| 438 |
+
end
|
| 439 |
+
end
|
| 440 |
+
end
|
| 441 |
+
end
|
| 442 |
+
|
| 443 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice06.lean
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.IntegerHyperplane01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
noncomputable section
|
| 13 |
+
end
|
| 14 |
+
end
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
section
|
| 19 |
+
open scoped BigOperators
|
| 20 |
+
noncomputable section
|
| 21 |
+
namespace RationalLattice
|
| 22 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 23 |
+
variable (c : RealCoordinates G n)
|
| 24 |
+
|
| 25 |
+
lemma realPower_int (g : G) (z : ℤ) : realPower c g z = g^z := by
|
| 26 |
+
cases z with
|
| 27 |
+
| ofNat m => simpa using realPower_nat c g m
|
| 28 |
+
| negSucc m =>
|
| 29 |
+
rw [Int.cast_negSucc,realPower_neg]
|
| 30 |
+
simp only [realPower_nat,zpow_negSucc]
|
| 31 |
+
|
| 32 |
+
lemma basisElement_rational (i : Fin n) : IsRational c (basisElement c i) := by
|
| 33 |
+
classical
|
| 34 |
+
intro j
|
| 35 |
+
refine ⟨if j=i then 1 else 0,?_⟩
|
| 36 |
+
simp only [basisElement,Homeomorph.apply_symm_apply,Pi.single_apply]
|
| 37 |
+
split_ifs <;> simp
|
| 38 |
+
|
| 39 |
+
lemma basisFlow_rational (i : Fin n) (t : ℚ) : IsRational c (basisFlow c i t) :=
|
| 40 |
+
realPower_rational c (basisElement_rational c i) t
|
| 41 |
+
|
| 42 |
+
variable (Γ : Subgroup G)
|
| 43 |
+
variable (hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z)
|
| 44 |
+
include hΓ
|
| 45 |
+
|
| 46 |
+
lemma basisElement_mem (i : Fin n) : basisElement c i ∈ Γ := by
|
| 47 |
+
classical
|
| 48 |
+
apply (hΓ _).mpr
|
| 49 |
+
intro j
|
| 50 |
+
refine ⟨if j=i then 1 else 0,?_⟩
|
| 51 |
+
simp only [basisElement,Homeomorph.apply_symm_apply,Pi.single_apply]
|
| 52 |
+
split_ifs <;> simp
|
| 53 |
+
|
| 54 |
+
lemma basisFlow_int_mem (i : Fin n) (t : ℤ) : basisFlow c i t ∈ Γ := by
|
| 55 |
+
change realPower c (basisElement c i) t ∈ Γ
|
| 56 |
+
rw [realPower_int]
|
| 57 |
+
exact Γ.zpow_mem (basisElement_mem c Γ hΓ i) _
|
| 58 |
+
|
| 59 |
+
lemma peel_mem_lattice {g : G} (hg : g ∈ Γ) (k : ℕ) : peel c g k ∈ Γ := by
|
| 60 |
+
induction k with
|
| 61 |
+
| zero => exact hg
|
| 62 |
+
| succ k ih =>
|
| 63 |
+
simp only [peel]
|
| 64 |
+
split_ifs with hk
|
| 65 |
+
· obtain ⟨z,hz⟩ := (hΓ _).mp ih ⟨k,hk⟩
|
| 66 |
+
rw [hz,← Int.cast_neg]
|
| 67 |
+
exact Γ.mul_mem (basisFlow_int_mem c Γ hΓ _ _) ih
|
| 68 |
+
· exact ih
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
theorem expCoordinates_lattice (g : G) :
|
| 73 |
+
g ∈ Γ ↔ ∀ i, ∃ z : ℤ, expCoordinates c g i = z := by
|
| 74 |
+
constructor
|
| 75 |
+
· intro hg i
|
| 76 |
+
exact (hΓ _).mp (peel_mem_lattice c Γ hΓ hg i.val) i
|
| 77 |
+
· intro hg
|
| 78 |
+
rw [← expProduct_expCoordinates c g]
|
| 79 |
+
change (List.ofFn (fun i => basisFlow c i (expCoordinates c g i))).prod ∈ Γ
|
| 80 |
+
apply list_prod_mem
|
| 81 |
+
intro x hx
|
| 82 |
+
obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hx
|
| 83 |
+
obtain ⟨z,hz⟩ := hg i
|
| 84 |
+
rw [hz]
|
| 85 |
+
exact basisFlow_int_mem c Γ hΓ i z
|
| 86 |
+
|
| 87 |
+
omit hΓ in
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
theorem character_expCoordinates (χ : G →* Multiplicative ℝ) (hχ : Continuous χ) (g : G) :
|
| 91 |
+
Multiplicative.toAdd (χ g) =
|
| 92 |
+
∑ i, expCoordinates c g i * Multiplicative.toAdd (χ (basisElement c i)) := by
|
| 93 |
+
conv_lhs => rw [← expProduct_expCoordinates c g]
|
| 94 |
+
change Multiplicative.toAdd (χ ((List.ofFn (fun i =>
|
| 95 |
+
basisFlow c i (expCoordinates c g i))).prod)) = _
|
| 96 |
+
rw [map_list_prod,List.map_ofFn]
|
| 97 |
+
simp only [toAdd_list_sum,List.map_ofFn,List.sum_ofFn]
|
| 98 |
+
apply Finset.sum_congr rfl
|
| 99 |
+
intro i _
|
| 100 |
+
exact character_realPower c χ hχ _ _
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
theorem integer_character_expCoordinates (χ : G →* Multiplicative ℝ) (hχ : Continuous χ)
|
| 105 |
+
(hz : ∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (χ g) = z) :
|
| 106 |
+
∃ k : Fin n → ℤ, ∀ g : G, Multiplicative.toAdd (χ g) =
|
| 107 |
+
∑ i, expCoordinates c g i * (k i : ℝ) := by
|
| 108 |
+
choose k hk using (fun i => hz _ (basisElement_mem c Γ hΓ i))
|
| 109 |
+
refine ⟨k,fun g => ?_⟩
|
| 110 |
+
rw [character_expCoordinates c χ hχ]
|
| 111 |
+
simp_rw [hk]
|
| 112 |
+
|
| 113 |
+
end RationalLattice
|
| 114 |
+
end
|
| 115 |
+
end
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
section
|
| 120 |
+
open Set Topology
|
| 121 |
+
noncomputable section
|
| 122 |
+
namespace CharacterKernelLattice
|
| 123 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 124 |
+
variable (χ : G →* Multiplicative ℝ) (hχ : Continuous χ)
|
| 125 |
+
variable (Γ : Subgroup G) (C : Set G) (hC : IsCompact C)
|
| 126 |
+
variable (hreps : ∀ g : G, ∃ c ∈ C, c⁻¹*g ∈ Γ)
|
| 127 |
+
variable (hZ : ∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (χ g) = z)
|
| 128 |
+
include hχ hC hreps hZ
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
theorem compact_kernel_representatives :
|
| 133 |
+
∃ D : Set G, IsCompact D ∧ D ⊆ χ.ker ∧
|
| 134 |
+
∀ g ∈ χ.ker, ∃ d ∈ D, d⁻¹*g ∈ Γ := by
|
| 135 |
+
classical
|
| 136 |
+
let p : G → ℝ := fun g => Multiplicative.toAdd (χ g)
|
| 137 |
+
have hp : Continuous p := hχ
|
| 138 |
+
let J : Set ℤ := {z | (z : ℝ) ∈ p '' C ∧ ∃ γ ∈ Γ, p γ = z}
|
| 139 |
+
have hJ : J.Finite := by
|
| 140 |
+
apply Set.Finite.subset ((Int.isClosedEmbedding_coe_real.isCompact_preimage (hC.image hp)).finite ⟨inferInstance⟩)
|
| 141 |
+
exact fun z hz => hz.1
|
| 142 |
+
have hex (z : J) : ∃ γ ∈ Γ, p γ = (z.val : ℝ) := z.property.2
|
| 143 |
+
choose δ hδΓ hδp using hex
|
| 144 |
+
let D : Set G := ⋃ z : J, (fun c => c * (δ z)⁻¹) '' (C ∩ {c | p c = (z.val : ℝ)})
|
| 145 |
+
refine ⟨D,?_,?_,?_⟩
|
| 146 |
+
· have : Finite J := hJ.to_subtype
|
| 147 |
+
exact isCompact_iUnion fun z => (hC.inter_right (isClosed_eq hp continuous_const)).image
|
| 148 |
+
(continuous_id.mul continuous_const)
|
| 149 |
+
· intro d hd
|
| 150 |
+
obtain ⟨z,c,hc,rfl⟩ := Set.mem_iUnion.mp hd
|
| 151 |
+
change χ (c*(δ z)⁻¹) = 1
|
| 152 |
+
apply Multiplicative.toAdd.injective
|
| 153 |
+
change p (c*(δ z)⁻¹) = 0
|
| 154 |
+
change Multiplicative.toAdd (χ (c*(δ z)⁻¹)) = 0
|
| 155 |
+
rw [map_mul,map_inv]
|
| 156 |
+
change p c - p (δ z) = 0
|
| 157 |
+
rw [hc.2,hδp]
|
| 158 |
+
exact sub_self _
|
| 159 |
+
· intro g hg
|
| 160 |
+
obtain ⟨c,hc,hcg⟩ := hreps g
|
| 161 |
+
obtain ⟨z,hz⟩ := hZ (c⁻¹*g) hcg
|
| 162 |
+
have hp0 : p g = 0 := hg
|
| 163 |
+
have hpc : p c = (-z : ℤ) := by
|
| 164 |
+
have hh : p (c⁻¹*g) = -p c + p g := by
|
| 165 |
+
dsimp [p]; rw [map_mul,map_inv]; rfl
|
| 166 |
+
change p (c⁻¹*g) = (z : ℝ) at hz
|
| 167 |
+
rw [hh,hp0,add_zero] at hz
|
| 168 |
+
push_cast
|
| 169 |
+
linarith
|
| 170 |
+
have hzJ : (-z) ∈ J := by
|
| 171 |
+
refine ⟨⟨c,hc,hpc⟩, (c⁻¹*g)⁻¹,Γ.inv_mem hcg,?_⟩
|
| 172 |
+
change Multiplicative.toAdd (χ ((c⁻¹*g)⁻¹)) = _
|
| 173 |
+
rw [map_inv]
|
| 174 |
+
change -Multiplicative.toAdd (χ (c⁻¹*g)) = _
|
| 175 |
+
rw [hz]
|
| 176 |
+
simp
|
| 177 |
+
let j : J := ⟨-z,hzJ⟩
|
| 178 |
+
refine ⟨c*(δ j)⁻¹,Set.mem_iUnion.mpr ⟨j,c,⟨hc,hpc⟩,rfl⟩,?_⟩
|
| 179 |
+
have he : (c*(δ j)⁻¹)⁻¹*g = δ j*(c⁻¹*g) := by group
|
| 180 |
+
rw [he]
|
| 181 |
+
exact Γ.mul_mem (hδΓ j) hcg
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
theorem compact_kernel_representatives_inter :
|
| 186 |
+
∃ D : Set G, IsCompact D ∧ D ⊆ χ.ker ∧
|
| 187 |
+
∀ g ∈ χ.ker, ∃ d ∈ D, d⁻¹*g ∈ Γ ⊓ χ.ker := by
|
| 188 |
+
obtain ⟨D,hD,hDK,hrep⟩ := compact_kernel_representatives χ hχ Γ C hC hreps hZ
|
| 189 |
+
refine ⟨D,hD,hDK,fun g hg => ?_⟩
|
| 190 |
+
obtain ⟨d,hd,hdg⟩ := hrep g hg
|
| 191 |
+
exact ⟨d,hd,hdg,χ.ker.mul_mem (χ.ker.inv_mem (hDK hd)) hg⟩
|
| 192 |
+
|
| 193 |
+
end CharacterKernelLattice
|
| 194 |
+
end
|
| 195 |
+
end
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
section
|
| 200 |
+
open scoped BigOperators
|
| 201 |
+
noncomputable section
|
| 202 |
+
namespace MalcevCharacters
|
| 203 |
+
open RationalLattice
|
| 204 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 205 |
+
variable {n : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c)
|
| 206 |
+
|
| 207 |
+
include hsk in
|
| 208 |
+
omit [IsTopologicalGroup G] in
|
| 209 |
+
lemma character_ext_coordinates {χ ψ : G →* Multiplicative ℝ}
|
| 210 |
+
(hχ : Continuous χ) (hψ : Continuous ψ)
|
| 211 |
+
(he : ∀ i, χ (axis c i 1) = ψ (axis c i 1)) : χ = ψ := by
|
| 212 |
+
ext g
|
| 213 |
+
apply Multiplicative.toAdd.injective
|
| 214 |
+
rw [character_coordinates c hsk χ hχ,character_coordinates c hsk ψ hψ]
|
| 215 |
+
simp_rw [he]
|
| 216 |
+
|
| 217 |
+
include hsk in
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
omit [IsTopologicalGroup G] in
|
| 221 |
+
theorem bounded_integral_characters_finite (Γ : Subgroup G)
|
| 222 |
+
(hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z) (A : ℝ) :
|
| 223 |
+
{χ : G →* Multiplicative ℝ | Continuous χ ∧
|
| 224 |
+
(∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (χ g) = z) ∧
|
| 225 |
+
∀ i, |Multiplicative.toAdd (χ (axis c i 1))| ≤ A}.Finite := by
|
| 226 |
+
classical
|
| 227 |
+
let S : Set ℝ := (Int.cast : ℤ → ℝ) '' {z : ℤ | |(z : ℝ)| ≤ A}
|
| 228 |
+
have hs : S.Finite := by
|
| 229 |
+
apply Set.Finite.image
|
| 230 |
+
have hc := Int.isClosedEmbedding_coe_real.isCompact_preimage
|
| 231 |
+
(isCompact_closedBall (0 : ℝ) A)
|
| 232 |
+
have hf := hc.finite (show IsDiscrete ((Int.cast : ℤ → ℝ) ⁻¹' Metric.closedBall 0 A) from ⟨inferInstance⟩)
|
| 233 |
+
simpa only [Set.preimage_ofPred_eq, Metric.closedBall, dist_zero_right,Real.norm_eq_abs] using hf
|
| 234 |
+
let f (χ : G →* Multiplicative ℝ) (i : Fin n) := Multiplicative.toAdd (χ (axis c i 1))
|
| 235 |
+
apply Set.Finite.of_finite_image (f := f)
|
| 236 |
+
· apply (Set.Finite.pi' (fun _ : Fin n => hs)).subset
|
| 237 |
+
rintro y ⟨χ,hχ,rfl⟩ i
|
| 238 |
+
obtain ⟨z,hz⟩ := hχ.2.1 _ (axis_one_mem c Γ hΓ i)
|
| 239 |
+
exact ⟨z,by simpa [← hz] using hχ.2.2 i,hz.symm⟩
|
| 240 |
+
· intro χ hχ ψ hψ he
|
| 241 |
+
apply character_ext_coordinates c hsk hχ.1 hψ.1
|
| 242 |
+
intro i
|
| 243 |
+
exact Multiplicative.toAdd.injective (congrFun he i)
|
| 244 |
+
|
| 245 |
+
variable (χ : G →* Multiplicative ℝ) (hχ : Continuous χ)
|
| 246 |
+
include hsk hχ
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
omit [IsTopologicalGroup G] in
|
| 251 |
+
theorem kernel_inter_connected (H : Subgroup G) (V : Submodule ℝ (Fin n → ℝ))
|
| 252 |
+
(hV : ∀ g : G, g ∈ H ↔ c.coord g ∈ V) : IsConnected (↑H ∩ (χ.ker : Set G)) := by
|
| 253 |
+
let W := V ⊓ (coordinateForm (fun i => Multiplicative.toAdd (χ (axis c i 1)))).ker
|
| 254 |
+
have he : (↑H ∩ (χ.ker : Set G)) = c.coord.symm '' (W : Set (Fin n → ℝ)) := by
|
| 255 |
+
ext g
|
| 256 |
+
constructor
|
| 257 |
+
· intro hg
|
| 258 |
+
refine ⟨c.coord g,⟨(hV g).mp hg.1,?_⟩,c.coord.symm_apply_apply g⟩
|
| 259 |
+
change (∑ i, c.coord g i * Multiplicative.toAdd (χ (axis c i 1))) = 0
|
| 260 |
+
rw [← character_coordinates c hsk χ hχ g]
|
| 261 |
+
exact congrArg Multiplicative.toAdd hg.2
|
| 262 |
+
· rintro ⟨x,hx,rfl⟩
|
| 263 |
+
refine ⟨(hV _).mpr (by simpa using hx.1),?_⟩
|
| 264 |
+
apply Multiplicative.toAdd.injective
|
| 265 |
+
rw [character_coordinates c hsk χ hχ]
|
| 266 |
+
simpa [coordinateForm] using hx.2
|
| 267 |
+
rw [he]
|
| 268 |
+
exact (W.convex.isConnected ⟨0,by simp⟩).image _ c.coord.symm.continuous.continuousOn
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
omit [IsTopologicalGroup G] in
|
| 273 |
+
theorem nontrivial_kernel_geometry (Γ : Subgroup G)
|
| 274 |
+
(hΓ : ∀ g : G, g ∈ Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i = z)
|
| 275 |
+
(hz : ∀ g ∈ Γ, ∃ z : ℤ, Multiplicative.toAdd (χ g) = z) (hne : χ ≠ 1) :
|
| 276 |
+
∃ k : Fin n → ℤ, k ≠ 0 ∧
|
| 277 |
+
(∀ g, Multiplicative.toAdd (χ g) = ∑ i, c.coord g i * (k i : ℝ)) ∧
|
| 278 |
+
(χ.ker : Set G) = c.coord.symm '' ((IntegerHyperplane.form k).ker : Set (Fin n → ℝ)) ∧
|
| 279 |
+
Module.finrank ℝ (IntegerHyperplane.form k).ker = n-1 := by
|
| 280 |
+
obtain ⟨k,hk⟩ := integer_character_coordinates c hsk χ Γ hΓ hχ hz
|
| 281 |
+
have hk0 : k ≠ 0 := by
|
| 282 |
+
intro he
|
| 283 |
+
apply hne
|
| 284 |
+
ext g
|
| 285 |
+
apply Multiplicative.toAdd.injective
|
| 286 |
+
rw [hk,he]
|
| 287 |
+
simp
|
| 288 |
+
refine ⟨k,hk0,hk,?_,IntegerHyperplane.kernel_finrank k hk0⟩
|
| 289 |
+
ext g
|
| 290 |
+
constructor
|
| 291 |
+
· intro hg
|
| 292 |
+
refine ⟨c.coord g,?_,c.coord.symm_apply_apply g⟩
|
| 293 |
+
change (∑ i, (k i : ℝ) * c.coord g i) = 0
|
| 294 |
+
rw [Finset.sum_congr rfl (fun i _ => mul_comm _ _), ← hk]
|
| 295 |
+
exact congrArg Multiplicative.toAdd hg
|
| 296 |
+
· rintro ⟨x,hx,rfl⟩
|
| 297 |
+
apply Multiplicative.toAdd.injective
|
| 298 |
+
rw [hk]
|
| 299 |
+
simpa [IntegerHyperplane.form,mul_comm] using hx
|
| 300 |
+
|
| 301 |
+
end MalcevCharacters
|
| 302 |
+
|
| 303 |
+
end
|
| 304 |
+
end
|
| 305 |
+
end
|
| 306 |
+
end
|
| 307 |
+
end
|
| 308 |
+
|
| 309 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice07.lean
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.RationalTail01
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
noncomputable section
|
| 13 |
+
end
|
| 14 |
+
end
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
section
|
| 19 |
+
noncomputable section
|
| 20 |
+
namespace RationalPolynomialMap
|
| 21 |
+
variable {σ : Type*} [Fintype σ]
|
| 22 |
+
lemma contDiff {f : (σ → ℝ) → ℝ} (hf : IsPolynomial f) : ContDiff ℝ (⊤ : ℕ∞) f := by
|
| 23 |
+
obtain ⟨p,hp⟩ := hf
|
| 24 |
+
have he : f = fun x => MvPolynomial.eval₂ (algebraMap ℚ ℝ) x p := funext hp
|
| 25 |
+
rw [he]
|
| 26 |
+
clear hp he f
|
| 27 |
+
induction p using MvPolynomial.induction_on with
|
| 28 |
+
| C q => simpa using (contDiff_const : ContDiff ℝ (⊤ : ℕ∞) (fun _ : σ → ℝ => (q:ℝ)))
|
| 29 |
+
| add p q hp hq => simpa using hp.add hq
|
| 30 |
+
| mul_X p i hp => simpa using hp.mul (by fun_prop)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
lemma bounded_lipschitz {f : (σ → ℝ) → ℝ} (hf : IsPolynomial f) (B : ℝ) :
|
| 35 |
+
∃ M > 0,
|
| 36 |
+
(∀ x, ‖x‖ ≤ B → |f x| ≤ M) ∧
|
| 37 |
+
(∀ x y, ‖x‖ ≤ B → ‖y‖ ≤ B → |f x-f y| ≤ M*‖x-y‖) := by
|
| 38 |
+
have hd := contDiff hf
|
| 39 |
+
obtain ⟨M,hM⟩ := (isCompact_closedBall (0 : σ → ℝ) B).exists_bound_of_continuousOn hd.continuous.continuousOn
|
| 40 |
+
obtain ⟨D,hD⟩ := (isCompact_closedBall (0 : σ → ℝ) B).exists_bound_of_continuousOn
|
| 41 |
+
(hd.continuous_fderiv (by simp)).continuousOn
|
| 42 |
+
refine ⟨max (max M D) 0 + 1,by positivity,?_,?_⟩
|
| 43 |
+
· intro x hx
|
| 44 |
+
have he := hM x (by simpa using hx)
|
| 45 |
+
change |f x| ≤ M at he
|
| 46 |
+
exact he.trans (by grind)
|
| 47 |
+
· intro x y hx hy
|
| 48 |
+
have he := Convex.norm_image_sub_le_of_norm_fderiv_le
|
| 49 |
+
(fun x (_ : x ∈ Metric.closedBall (0 : σ → ℝ) B) => hd.differentiable (by simp) x)
|
| 50 |
+
hD (convex_closedBall (0 : σ → ℝ) B) (by simpa using hy) (by simpa using hx)
|
| 51 |
+
change |f x-f y| ≤ D * ‖x-y‖ at he
|
| 52 |
+
exact he.trans (mul_le_mul_of_nonneg_right (by grind) (norm_nonneg _))
|
| 53 |
+
|
| 54 |
+
end RationalPolynomialMap
|
| 55 |
+
end
|
| 56 |
+
end
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
section
|
| 61 |
+
noncomputable section
|
| 62 |
+
namespace RationalLattice
|
| 63 |
+
open RationalPolynomialMap
|
| 64 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 65 |
+
variable (c : RealCoordinates G n) {σ τ : Type*}
|
| 66 |
+
|
| 67 |
+
lemma polynomialMap_comp {f : (τ → ℝ) → G} (hf : IsPolynomialMap c f)
|
| 68 |
+
{g : (σ → ℝ) → (τ → ℝ)} (hg : ∀ i, IsPolynomial (fun x => g x i)) :
|
| 69 |
+
IsPolynomialMap c (fun x => f (g x)) := fun i => RationalPolynomialMap.comp (hf i) hg
|
| 70 |
+
|
| 71 |
+
lemma polynomialMap_inv {f : (σ → ℝ) → G} (hf : IsPolynomialMap c f) :
|
| 72 |
+
IsPolynomialMap c (fun x => (f x)⁻¹) := by
|
| 73 |
+
have h : ∀ m : ℕ, ∀ hm : m < n,
|
| 74 |
+
IsPolynomial (fun x => c.coord ((f x)⁻¹) ⟨m,hm⟩) := by
|
| 75 |
+
intro m
|
| 76 |
+
induction m using Nat.strong_induction_on with
|
| 77 |
+
| h m ih =>
|
| 78 |
+
intro hm
|
| 79 |
+
let i : Fin n := ⟨m,hm⟩
|
| 80 |
+
have he (x : σ → ℝ) : c.coord ((f x)⁻¹) i = -c.coord (f x) i -
|
| 81 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 82 |
+
(Sum.elim (fun j : Fin i.val => c.coord (f x) ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 83 |
+
(fun j : Fin i.val => c.coord ((f x)⁻¹) ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i) := by
|
| 84 |
+
have he := c.mul_coord (f x) ((f x)⁻¹) i
|
| 85 |
+
rw [mul_inv_cancel,c.one_coord] at he
|
| 86 |
+
linarith
|
| 87 |
+
simp_rw [show (⟨m,hm⟩ : Fin n)=i from rfl,he]
|
| 88 |
+
apply RationalPolynomialMap.sub (RationalPolynomialMap.neg (hf i))
|
| 89 |
+
apply RationalPolynomialMap.eval
|
| 90 |
+
intro j
|
| 91 |
+
cases j with
|
| 92 |
+
| inl j => exact hf _
|
| 93 |
+
| inr j => exact ih j.val j.isLt (lt_trans j.isLt hm)
|
| 94 |
+
intro i
|
| 95 |
+
exact h i.val i.isLt
|
| 96 |
+
|
| 97 |
+
end RationalLattice
|
| 98 |
+
end
|
| 99 |
+
end
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
section
|
| 104 |
+
noncomputable section
|
| 105 |
+
namespace RationalLattice
|
| 106 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 107 |
+
variable (c : RealCoordinates G n)
|
| 108 |
+
|
| 109 |
+
lemma correction_eq_of_lower_eq (i : Fin n) {g g' h h' : G}
|
| 110 |
+
(hg : ∀ j : Fin n, j < i → c.coord g j = c.coord g' j)
|
| 111 |
+
(hh : ∀ j : Fin n, j < i → c.coord h j = c.coord h' j) :
|
| 112 |
+
c.coord (g*h) i - c.coord g i - c.coord h i =
|
| 113 |
+
c.coord (g'*h') i - c.coord g' i - c.coord h' i := by
|
| 114 |
+
rw [c.mul_coord g h,c.mul_coord g' h']
|
| 115 |
+
have he : (Sum.elim (fun j : Fin i.val => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 116 |
+
(fun j : Fin i.val => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) =
|
| 117 |
+
(Sum.elim (fun j : Fin i.val => c.coord g' ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 118 |
+
(fun j : Fin i.val => c.coord h' ⟨j.val,lt_trans j.isLt i.isLt⟩)) := by
|
| 119 |
+
funext j
|
| 120 |
+
cases j with
|
| 121 |
+
| inl j => exact hg _ j.isLt
|
| 122 |
+
| inr j => exact hh _ j.isLt
|
| 123 |
+
rw [he]
|
| 124 |
+
ring
|
| 125 |
+
|
| 126 |
+
lemma mul_lower_congr (i : Fin n) {g g' h h' : G}
|
| 127 |
+
(hg : ∀ j : Fin n, j < i → c.coord g j = c.coord g' j)
|
| 128 |
+
(hh : ∀ j : Fin n, j < i → c.coord h j = c.coord h' j) :
|
| 129 |
+
∀ j : Fin n, j < i → c.coord (g*h) j = c.coord (g'*h') j := by
|
| 130 |
+
intro j hj
|
| 131 |
+
have he := correction_eq_of_lower_eq c j (fun k hk => hg k (lt_trans hk hj))
|
| 132 |
+
(fun k hk => hh k (lt_trans hk hj))
|
| 133 |
+
rw [hg j hj,hh j hj] at he
|
| 134 |
+
linarith
|
| 135 |
+
|
| 136 |
+
lemma conj_lower_congr (a : G) (i : Fin n) {u v : G}
|
| 137 |
+
(huv : ∀ j : Fin n, j < i → c.coord u j = c.coord v j) :
|
| 138 |
+
∀ j : Fin n, j < i → c.coord (a⁻¹*u*a) j = c.coord (a⁻¹*v*a) j := by
|
| 139 |
+
exact mul_lower_congr c i (mul_lower_congr c i (fun _ _ => rfl) huv) (fun _ _ => rfl)
|
| 140 |
+
|
| 141 |
+
lemma conj_coord_difference (a : G) (i : Fin n) {u v : G}
|
| 142 |
+
(huv : ∀ j : Fin n, j < i → c.coord u j = c.coord v j) :
|
| 143 |
+
c.coord (a⁻¹*u*a) i - c.coord (a⁻¹*v*a) i = c.coord u i - c.coord v i := by
|
| 144 |
+
have h1 := correction_eq_of_lower_eq c i (g:=a⁻¹) (g':=a⁻¹) (fun _ _ => rfl) huv
|
| 145 |
+
have h2 := correction_eq_of_lower_eq c i
|
| 146 |
+
(mul_lower_congr c i (g:=a⁻¹) (g':=a⁻¹) (fun _ _ => rfl) huv) (h:=a) (h':=a) (fun _ _ => rfl)
|
| 147 |
+
linarith
|
| 148 |
+
|
| 149 |
+
lemma conj_mul_coord_difference (a : G) (i : Fin n) {u u' v v' : G}
|
| 150 |
+
(hu : ∀ j : Fin n, j < i → c.coord u j = c.coord u' j)
|
| 151 |
+
(hv : ∀ j : Fin n, j < i → c.coord v j = c.coord v' j) :
|
| 152 |
+
c.coord (a⁻¹*u*a*v) i - c.coord (a⁻¹*u'*a*v') i =
|
| 153 |
+
c.coord u i - c.coord u' i + c.coord v i - c.coord v' i := by
|
| 154 |
+
have h1 := conj_coord_difference c a i hu
|
| 155 |
+
have h2 := correction_eq_of_lower_eq c i (conj_lower_congr c a i hu) hv
|
| 156 |
+
linarith
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def truncate (i : Fin n) (v : Fin i.val → ℝ) : G :=
|
| 160 |
+
c.coord.symm (fun j => if h : j < i then v ⟨j.val,h⟩ else 0)
|
| 161 |
+
@[simp] lemma truncate_coord_self (i : Fin n) (v : Fin i.val → ℝ) :
|
| 162 |
+
c.coord (truncate c i v) i = 0 := by simp [truncate]
|
| 163 |
+
lemma truncate_coord_lower (i : Fin n) (v : Fin i.val → ℝ) (j : Fin n) (hj : j < i) :
|
| 164 |
+
c.coord (truncate c i v) j = v ⟨j.val,hj⟩ := by simp [truncate,hj]
|
| 165 |
+
|
| 166 |
+
lemma conj_mul_truncated (a u v : G) (i : Fin n) :
|
| 167 |
+
c.coord (a⁻¹*u*a*v) i = c.coord u i + c.coord v i +
|
| 168 |
+
c.coord (a⁻¹*truncate c i (fun j => c.coord u ⟨j.val,lt_trans j.isLt i.isLt⟩)*a*
|
| 169 |
+
truncate c i (fun j => c.coord v ⟨j.val,lt_trans j.isLt i.isLt⟩)) i := by
|
| 170 |
+
have hu : ∀ j : Fin n, j < i → c.coord u j =
|
| 171 |
+
c.coord (truncate c i (fun j => c.coord u ⟨j.val,lt_trans j.isLt i.isLt⟩)) j := by
|
| 172 |
+
intro j hj
|
| 173 |
+
rw [truncate_coord_lower c i _ j hj]
|
| 174 |
+
have hv : ∀ j : Fin n, j < i → c.coord v j =
|
| 175 |
+
c.coord (truncate c i (fun j => c.coord v ⟨j.val,lt_trans j.isLt i.isLt⟩)) j := by
|
| 176 |
+
intro j hj
|
| 177 |
+
rw [truncate_coord_lower c i _ j hj]
|
| 178 |
+
have he := conj_mul_coord_difference c a i hu hv
|
| 179 |
+
rw [truncate_coord_self,truncate_coord_self] at he
|
| 180 |
+
linarith
|
| 181 |
+
|
| 182 |
+
lemma polynomialMap_truncate {σ : Type*} (i : Fin n) {f : (σ → ℝ) → (Fin i.val → ℝ)}
|
| 183 |
+
(hf : ∀ j, RationalPolynomialMap.IsPolynomial (fun x => f x j)) :
|
| 184 |
+
IsPolynomialMap c (fun x => truncate c i (f x)) := by
|
| 185 |
+
intro j
|
| 186 |
+
simp only [truncate,Homeomorph.apply_symm_apply]
|
| 187 |
+
split_ifs
|
| 188 |
+
· exact hf _
|
| 189 |
+
· exact RationalPolynomialMap.zero
|
| 190 |
+
|
| 191 |
+
end RationalLattice
|
| 192 |
+
end
|
| 193 |
+
end
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
section
|
| 198 |
+
noncomputable section
|
| 199 |
+
namespace PairTail
|
| 200 |
+
open RationalLattice
|
| 201 |
+
|
| 202 |
+
def joinHomeomorph (r d : ℕ) : ((Fin r → ℝ) × (Fin d → ℝ)) ≃ₜ (Fin (r+d) → ℝ) where
|
| 203 |
+
toFun x := Fin.append x.1 x.2
|
| 204 |
+
invFun x := (fun i => x (i.castAdd d),fun j => x (j.natAdd r))
|
| 205 |
+
left_inv x := by simp
|
| 206 |
+
right_inv x := by funext i; exact Fin.addCases (fun _ => by simp) (fun _ => by simp) i
|
| 207 |
+
continuous_toFun := by
|
| 208 |
+
apply continuous_pi
|
| 209 |
+
intro i
|
| 210 |
+
refine Fin.addCases (fun j => ?_) (fun j => ?_) i
|
| 211 |
+
· simp only [Fin.append_left]
|
| 212 |
+
exact (continuous_apply j).comp continuous_fst
|
| 213 |
+
· simp only [Fin.append_right]
|
| 214 |
+
exact (continuous_apply j).comp continuous_snd
|
| 215 |
+
continuous_invFun := (continuous_pi (fun _ => continuous_apply _)).prodMk
|
| 216 |
+
(continuous_pi (fun _ => continuous_apply _))
|
| 217 |
+
|
| 218 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 219 |
+
variable {t d r : ℕ} (c : RealCoordinates G (t+d))
|
| 220 |
+
variable (K : Subgroup G) [K.Normal]
|
| 221 |
+
variable (hK : ∀ g : G, g ∈ K ↔ ∀ i : Fin (t+d), i.val < t → c.coord g i = 0)
|
| 222 |
+
variable (hr : r ≤ t+d) (N : Subgroup G) [N.Normal]
|
| 223 |
+
variable (hN : ∀ g : G, g ∈ N ↔ ∀ i : Fin (t+d), i.val < r → c.coord g i = 0)
|
| 224 |
+
variable (hcent : N ≤ Subgroup.center G)
|
| 225 |
+
|
| 226 |
+
def baseSection (x : G ⧸ N) : G := MalcevPrefixQuotient.represent c
|
| 227 |
+
(MalcevPrefixQuotient.coordinates c hr N hN x)
|
| 228 |
+
omit [IsTopologicalGroup G] [N.Normal] in
|
| 229 |
+
lemma section_spec (x : G ⧸ N) : (QuotientGroup.mk (baseSection c hr N hN x) : G ⧸ N) = x :=
|
| 230 |
+
MalcevPrefixQuotient.rebuild_coordinates c hr N hN x
|
| 231 |
+
omit [IsTopologicalGroup G] [N.Normal] in
|
| 232 |
+
lemma section_continuous : Continuous (baseSection c hr N hN) :=
|
| 233 |
+
c.coord.symm.continuous.comp (MalcevPrefixQuotient.lift_continuous.comp
|
| 234 |
+
(MalcevPrefixQuotient.coordinates_continuous c hr N hN))
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
def chartHomeomorph : (square K ⧸ diagonal K N) ≃ₜ (Fin (r+d) → ℝ) :=
|
| 239 |
+
(quotientHomeomorph K N hcent (baseSection c hr N hN) (section_spec c hr N hN)
|
| 240 |
+
(section_continuous c hr N hN)).trans
|
| 241 |
+
(((MalcevPrefixQuotient.homeomorph c hr N hN).prodCongr
|
| 242 |
+
(RationalTailCoordinates.tailHomeomorph c K hK)).trans (joinHomeomorph r d))
|
| 243 |
+
|
| 244 |
+
omit [N.Normal] in
|
| 245 |
+
@[simp] lemma chart_base (x : square K) (i : Fin r) :
|
| 246 |
+
chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk x) (i.castAdd d) =
|
| 247 |
+
c.coord x.val.1 (MalcevPrefixQuotient.embed hr i) := by
|
| 248 |
+
change Fin.append _ _ (i.castAdd d) = _
|
| 249 |
+
rw [Fin.append_left]
|
| 250 |
+
rfl
|
| 251 |
+
omit [N.Normal] in
|
| 252 |
+
@[simp] lemma chart_tail (x : square K) (j : Fin d) :
|
| 253 |
+
chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk x) (j.natAdd r) =
|
| 254 |
+
c.coord (x.val.1⁻¹*x.val.2) (RationalTailCoordinates.embed t j) := by
|
| 255 |
+
change Fin.append _ _ (j.natAdd r) = _
|
| 256 |
+
rw [Fin.append_right]
|
| 257 |
+
rfl
|
| 258 |
+
|
| 259 |
+
omit [N.Normal] in
|
| 260 |
+
lemma chart_one : chartHomeomorph c K hK hr N hN hcent (QuotientGroup.mk (1:square K)) = 0 := by
|
| 261 |
+
funext i
|
| 262 |
+
refine Fin.addCases (fun j => ?_) (fun j => ?_) i
|
| 263 |
+
· simpa using c.one_coord (MalcevPrefixQuotient.embed hr j)
|
| 264 |
+
· simpa using c.one_coord (RationalTailCoordinates.embed t j)
|
| 265 |
+
|
| 266 |
+
omit [N.Normal] in
|
| 267 |
+
lemma chart_rebuild_base (x : Fin (r+d) → ℝ) :
|
| 268 |
+
(chartHomeomorph c K hK hr N hN hcent).symm x =
|
| 269 |
+
QuotientGroup.mk (pair K
|
| 270 |
+
(MalcevPrefixQuotient.represent c (fun i : Fin r => x (i.castAdd d)))
|
| 271 |
+
(RationalTailCoordinates.rebuild c K hK (fun i : Fin d => x (i.natAdd r)))) := by
|
| 272 |
+
apply (chartHomeomorph c K hK hr N hN hcent).injective
|
| 273 |
+
rw [Homeomorph.apply_symm_apply]
|
| 274 |
+
funext i
|
| 275 |
+
refine Fin.addCases (fun j => ?_) (fun j => ?_) i
|
| 276 |
+
· rw [chart_base]
|
| 277 |
+
simp [pair,MalcevPrefixQuotient.represent]
|
| 278 |
+
· rw [chart_tail]
|
| 279 |
+
simp [pair,RationalTailCoordinates.rebuild]
|
| 280 |
+
|
| 281 |
+
end PairTail
|
| 282 |
+
|
| 283 |
+
end
|
| 284 |
+
end
|
| 285 |
+
end
|
| 286 |
+
end
|
| 287 |
+
end
|
| 288 |
+
|
| 289 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice08.lean
ADDED
|
@@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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.IntegerHyperplane02
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
open scoped BigOperators
|
| 13 |
+
end
|
| 14 |
+
end
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
section
|
| 19 |
+
noncomputable section
|
| 20 |
+
open scoped BigOperators
|
| 21 |
+
namespace RationalCharacterFirst
|
| 22 |
+
open RationalLattice IntegerHyperplane RationalPolynomialMap
|
| 23 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 24 |
+
variable (c : RealCoordinates G (n+1)) (χ : G →* Multiplicative ℝ)
|
| 25 |
+
variable (k : Fin (n+1) → ℤ) (p : Fin (n+1)) (hp : k p ≠ 0)
|
| 26 |
+
variable (hχ : ∀ g : G, Multiplicative.toAdd (χ g) = form k (c.coord g))
|
| 27 |
+
variable (hlast : ∀ j : Fin (n+1), p < j → k j = 0)
|
| 28 |
+
|
| 29 |
+
def coordinates (g : G) : Fin (n+1) → ℝ := splitCoordinates k p (c.coord g)
|
| 30 |
+
|
| 31 |
+
lemma exists_correction (i : Fin n) :
|
| 32 |
+
∃ P : MvPolynomial (Fin (i.val+1) ⊕ Fin (i.val+1)) ℚ,
|
| 33 |
+
∀ v : (Fin (i.val+1) ⊕ Fin (i.val+1)) → ℝ,
|
| 34 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 35 |
+
(Sum.elim
|
| 36 |
+
(fun a => splitLift k p (lowerExtend i.succ (fun j => v (Sum.inl j)))
|
| 37 |
+
⟨a.val,lt_trans a.isLt (p.succAbove i).isLt⟩)
|
| 38 |
+
(fun a => splitLift k p (lowerExtend i.succ (fun j => v (Sum.inr j)))
|
| 39 |
+
⟨a.val,lt_trans a.isLt (p.succAbove i).isLt⟩)) (c.correction (p.succAbove i)) =
|
| 40 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ) v P := by
|
| 41 |
+
apply RationalPolynomialMap.eval
|
| 42 |
+
intro a
|
| 43 |
+
cases a with
|
| 44 |
+
| inl a =>
|
| 45 |
+
apply RationalPolynomialMap.comp (splitLift_polynomial k p _)
|
| 46 |
+
intro j
|
| 47 |
+
unfold lowerExtend
|
| 48 |
+
split_ifs
|
| 49 |
+
· exact RationalPolynomialMap.coordinate _
|
| 50 |
+
· exact RationalPolynomialMap.zero
|
| 51 |
+
| inr a =>
|
| 52 |
+
apply RationalPolynomialMap.comp (splitLift_polynomial k p _)
|
| 53 |
+
intro j
|
| 54 |
+
unfold lowerExtend
|
| 55 |
+
split_ifs
|
| 56 |
+
· exact RationalPolynomialMap.coordinate _
|
| 57 |
+
· exact RationalPolynomialMap.zero
|
| 58 |
+
|
| 59 |
+
def tailCorrection (i : Fin n) : MvPolynomial (Fin (i.val+1) ⊕ Fin (i.val+1)) ℚ :=
|
| 60 |
+
(exists_correction c k p i).choose
|
| 61 |
+
|
| 62 |
+
include hp hlast in
|
| 63 |
+
lemma tail_mul_coord (g h : G) (i : Fin n) :
|
| 64 |
+
coordinates c k p (g*h) i.succ = coordinates c k p g i.succ + coordinates c k p h i.succ +
|
| 65 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 66 |
+
(Sum.elim (fun j => coordinates c k p g ⟨j.val,lt_trans j.isLt i.succ.isLt⟩)
|
| 67 |
+
(fun j => coordinates c k p h ⟨j.val,lt_trans j.isLt i.succ.isLt⟩)) (tailCorrection c k p i) := by
|
| 68 |
+
change c.coord (g*h) (p.succAbove i) = _
|
| 69 |
+
rw [c.mul_coord]
|
| 70 |
+
change coordinates c k p g i.succ + coordinates c k p h i.succ + _ = _
|
| 71 |
+
congr 1
|
| 72 |
+
let v : (Fin (i.val+1) ⊕ Fin (i.val+1)) → ℝ :=
|
| 73 |
+
Sum.elim (fun j => coordinates c k p g ⟨j.val,lt_trans j.isLt i.succ.isLt⟩)
|
| 74 |
+
(fun j => coordinates c k p h ⟨j.val,lt_trans j.isLt i.succ.isLt⟩)
|
| 75 |
+
unfold tailCorrection
|
| 76 |
+
rw [← (exists_correction c k p i).choose_spec v]
|
| 77 |
+
congr 1
|
| 78 |
+
funext a
|
| 79 |
+
have hl (u : G) (a : Fin (p.succAbove i).val) :
|
| 80 |
+
c.coord u ⟨a.val,lt_trans a.isLt (p.succAbove i).isLt⟩ =
|
| 81 |
+
splitLift k p (lowerExtend i.succ
|
| 82 |
+
(fun j => coordinates c k p u ⟨j.val,lt_trans j.isLt i.succ.isLt⟩))
|
| 83 |
+
⟨a.val,lt_trans a.isLt (p.succAbove i).isLt⟩ := by
|
| 84 |
+
conv_lhs => rw [← splitLift_splitCoordinates k p hp (c.coord u)]
|
| 85 |
+
apply splitLift_lower_dep k p hlast i
|
| 86 |
+
· intro j hj
|
| 87 |
+
have hj' : j.val < i.succ.val := hj
|
| 88 |
+
simp only [lowerExtend,hj',dite_eq_left,coordinates]
|
| 89 |
+
· exact a.isLt
|
| 90 |
+
cases a with
|
| 91 |
+
| inl a => exact hl g a
|
| 92 |
+
| inr a => exact hl h a
|
| 93 |
+
|
| 94 |
+
include hχ in
|
| 95 |
+
lemma head_mul_coord (g h : G) :
|
| 96 |
+
coordinates c k p (g*h) 0 = coordinates c k p g 0+coordinates c k p h 0 := by
|
| 97 |
+
change form k (c.coord (g*h))/(k p:ℝ) = form k (c.coord g)/(k p:ℝ)+form k (c.coord h)/(k p:ℝ)
|
| 98 |
+
rw [← hχ,← hχ,← hχ,map_mul]
|
| 99 |
+
exact add_div _ _ _
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def characterFirstCoordinates : RealCoordinates G (n+1) where
|
| 104 |
+
coord := c.coord.trans (splitHomeomorph k p hp)
|
| 105 |
+
one_coord i := by
|
| 106 |
+
refine Fin.cases ?_ (fun j => ?_) i
|
| 107 |
+
· change form k (c.coord 1)/(k p:ℝ) = 0
|
| 108 |
+
simp [form,c.one_coord]
|
| 109 |
+
· exact c.one_coord _
|
| 110 |
+
correction := Fin.cases 0 (tailCorrection c k p)
|
| 111 |
+
mul_coord g h i := by
|
| 112 |
+
refine Fin.cases ?_ (fun j => ?_) i
|
| 113 |
+
· change coordinates c k p (g*h) 0 = coordinates c k p g 0+coordinates c k p h 0+
|
| 114 |
+
MvPolynomial.eval₂ _ _ 0
|
| 115 |
+
rw [MvPolynomial.eval₂_zero,add_zero]
|
| 116 |
+
exact head_mul_coord c χ k p hχ g h
|
| 117 |
+
· exact tail_mul_coord c k p hp hlast g h j
|
| 118 |
+
|
| 119 |
+
lemma inclusion_polynomial (i : Fin (n+1)) :
|
| 120 |
+
RationalPolynomialMap.IsPolynomial (fun x : Fin (n+1) → ℝ =>
|
| 121 |
+
c.coord ((characterFirstCoordinates c χ k p hp hχ hlast).coord.symm x) i) := by
|
| 122 |
+
change RationalPolynomialMap.IsPolynomial (fun x => c.coord (c.coord.symm (splitLift k p x)) i)
|
| 123 |
+
simp only [Homeomorph.apply_symm_apply]
|
| 124 |
+
exact splitLift_polynomial k p i
|
| 125 |
+
|
| 126 |
+
include hp hχ hlast in
|
| 127 |
+
lemma characterFirst_adapted (H : Subgroup G) (r : ℕ)
|
| 128 |
+
(hH : ∀ g : G, g ∈ H ↔ ∀ i : Fin (n+1), i.val < r �� c.coord g i = 0) (g : G) :
|
| 129 |
+
g ∈ H ⊓ χ.ker ↔ ∀ i : Fin (n+1), i.val < deletedCutoff p r+1 →
|
| 130 |
+
(characterFirstCoordinates c χ k p hp hχ hlast).coord g i = 0 := by
|
| 131 |
+
have hpR : (k p:ℝ) ≠ 0 := by exact_mod_cast hp
|
| 132 |
+
have hhead : (characterFirstCoordinates c χ k p hp hχ hlast).coord g 0 = 0 ↔ g ∈ χ.ker := by
|
| 133 |
+
change form k (c.coord g)/(k p:ℝ) = 0 ↔ χ g=1
|
| 134 |
+
rw [← hχ,div_eq_zero_iff]
|
| 135 |
+
simp only [hpR,or_false]
|
| 136 |
+
constructor
|
| 137 |
+
· intro h
|
| 138 |
+
exact Multiplicative.toAdd.injective h
|
| 139 |
+
· intro h
|
| 140 |
+
rw [h]
|
| 141 |
+
rfl
|
| 142 |
+
constructor
|
| 143 |
+
· rintro ⟨hg,hker⟩ i
|
| 144 |
+
refine Fin.cases ?_ (fun j => ?_) i
|
| 145 |
+
· intro _; exact hhead.mpr hker
|
| 146 |
+
· intro hi
|
| 147 |
+
have ha := (RationalCharacterKernel.kernelCoordinates_adapted c χ k p hp hχ hlast H r hH ⟨g,hker⟩).mp hg
|
| 148 |
+
exact ha j (by change j.val+1 < deletedCutoff p r+1 at hi; omega)
|
| 149 |
+
· intro hg
|
| 150 |
+
have hker := hhead.mp (hg 0 (by change 0 < deletedCutoff p r+1; omega))
|
| 151 |
+
refine ⟨?_,hker⟩
|
| 152 |
+
apply (RationalCharacterKernel.kernelCoordinates_adapted c χ k p hp hχ hlast H r hH ⟨g,hker⟩).mpr
|
| 153 |
+
intro j hj
|
| 154 |
+
exact hg j.succ (by change j.val+1 < deletedCutoff p r+1; omega)
|
| 155 |
+
|
| 156 |
+
end RationalCharacterFirst
|
| 157 |
+
end
|
| 158 |
+
end
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
section
|
| 163 |
+
open scoped BigOperators
|
| 164 |
+
noncomputable section
|
| 165 |
+
namespace TriangularDenominators
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
theorem polynomial_origin_grid {ι : Type*} (P : MvPolynomial ι ℚ) :
|
| 170 |
+
∃ D : ℕ, 0 < D ∧ ∀ T : ℕ, ∀ x : ι → ℤ, ∃ z : ℤ,
|
| 171 |
+
MvPolynomial.eval (fun j => (D:ℚ)*(T:ℚ)*(x j:ℚ)) P -
|
| 172 |
+
MvPolynomial.eval (fun _ => 0) P = (T:ℚ)*(z:ℚ) := by
|
| 173 |
+
induction P using MvPolynomial.induction_on with
|
| 174 |
+
| C a => exact ⟨1,by norm_num,fun T x => ⟨0,by simp⟩⟩
|
| 175 |
+
| add P Q hP hQ =>
|
| 176 |
+
obtain ⟨D,hD,hP⟩ := hP
|
| 177 |
+
obtain ⟨E,hE,hQ⟩ := hQ
|
| 178 |
+
refine ⟨D*E,Nat.mul_pos hD hE,?_⟩
|
| 179 |
+
intro T x
|
| 180 |
+
obtain ⟨a,ha⟩ := hP T (fun j => (E:ℤ)*x j)
|
| 181 |
+
obtain ⟨b,hb⟩ := hQ T (fun j => (D:ℤ)*x j)
|
| 182 |
+
have hDE : (fun j => (D:ℚ)*(T:ℚ)*(((E:ℤ)*x j):ℚ)) =
|
| 183 |
+
(fun j => ((D*E:ℕ):ℚ)*(T:ℚ)*(x j:ℚ)) := by funext j; push_cast; ring
|
| 184 |
+
have hED : (fun j => (E:ℚ)*(T:ℚ)*(((D:ℤ)*x j):ℚ)) =
|
| 185 |
+
(fun j => ((D*E:ℕ):ℚ)*(T:ℚ)*(x j:ℚ)) := by funext j; push_cast; ring
|
| 186 |
+
simp only [Int.cast_mul] at ha hb
|
| 187 |
+
rw [hDE] at ha
|
| 188 |
+
rw [hED] at hb
|
| 189 |
+
refine ⟨a+b,?_⟩
|
| 190 |
+
simp only [map_add,Int.cast_add]
|
| 191 |
+
linarith
|
| 192 |
+
| mul_X P i hP =>
|
| 193 |
+
obtain ⟨D,hD,hgrid⟩ := polynomial_grid P 1 (by norm_num)
|
| 194 |
+
refine ⟨D,hD,?_⟩
|
| 195 |
+
intro T x
|
| 196 |
+
obtain ⟨a,ha⟩ := hgrid (fun j => (D:ℚ)*(T:ℚ)*(x j:ℚ)) (by
|
| 197 |
+
intro j
|
| 198 |
+
refine ⟨(D:ℤ)*(T:ℤ)*x j,?_⟩
|
| 199 |
+
simp)
|
| 200 |
+
refine ⟨a*x i,?_⟩
|
| 201 |
+
simp only [map_mul,MvPolynomial.eval_X,mul_zero,sub_zero,Int.cast_mul]
|
| 202 |
+
calc
|
| 203 |
+
_ = (T:ℚ)*((D:ℚ)*MvPolynomial.eval (fun j => (D:ℚ)*(T:ℚ)*(x j:ℚ)) P)*(x i:ℚ) := by ring
|
| 204 |
+
_ = _ := by rw [ha]; ring
|
| 205 |
+
|
| 206 |
+
theorem polynomial_origin_grid_real {ι : Type*} (P : MvPolynomial ι ℚ) :
|
| 207 |
+
∃ D : ℕ, 0 < D ∧ ∀ T : ℕ, ∀ x : ι → ℝ,
|
| 208 |
+
(∀ j, ∃ z : ℤ, x j = ((D*T:ℕ):ℝ)*(z:ℝ)) → ∃ z : ℤ,
|
| 209 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ) x P -
|
| 210 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun _ => 0) P = (T:ℝ)*(z:ℝ) := by
|
| 211 |
+
obtain ⟨D,hD,hgrid⟩ := polynomial_origin_grid P
|
| 212 |
+
refine ⟨D,hD,?_⟩
|
| 213 |
+
intro T x hx
|
| 214 |
+
choose z hz using hx
|
| 215 |
+
obtain ⟨a,ha⟩ := hgrid T z
|
| 216 |
+
refine ⟨a,?_⟩
|
| 217 |
+
have he : ∀ v : ι → ℚ, ((MvPolynomial.eval v P : ℚ):ℝ) =
|
| 218 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun i => (v i:ℝ)) P := by
|
| 219 |
+
intro v
|
| 220 |
+
exact MvPolynomial.eval₂_comp_left (algebraMap ℚ ℝ) (RingHom.id ℚ) v P
|
| 221 |
+
have hh := congrArg (fun q : ℚ => (q:ℝ)) ha
|
| 222 |
+
simp only [Rat.cast_sub,Rat.cast_mul,Rat.cast_natCast,Rat.cast_intCast] at hh
|
| 223 |
+
rw [he,he] at hh
|
| 224 |
+
simp only [Rat.cast_zero] at hh
|
| 225 |
+
convert hh using 1
|
| 226 |
+
· congr 1
|
| 227 |
+
congr 1
|
| 228 |
+
funext j
|
| 229 |
+
simpa only [Rat.cast_mul,Rat.cast_natCast,Rat.cast_intCast,Nat.cast_mul] using hz j
|
| 230 |
+
end TriangularDenominators
|
| 231 |
+
|
| 232 |
+
end
|
| 233 |
+
end
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
section
|
| 238 |
+
open scoped BigOperators
|
| 239 |
+
noncomputable section
|
| 240 |
+
namespace RationalLattice
|
| 241 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] {n : ℕ}
|
| 242 |
+
variable (c : RealCoordinates G n)
|
| 243 |
+
|
| 244 |
+
def correctionDenom (i : Fin n) : ℕ :=
|
| 245 |
+
(TriangularDenominators.polynomial_origin_grid_real (c.correction i)).choose
|
| 246 |
+
|
| 247 |
+
lemma correctionDenom_pos (i : Fin n) : 0 < correctionDenom c i :=
|
| 248 |
+
(TriangularDenominators.polynomial_origin_grid_real (c.correction i)).choose_spec.1
|
| 249 |
+
|
| 250 |
+
lemma correction_at_zero (i : Fin n) :
|
| 251 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ) (fun _ => 0) (c.correction i) = 0 := by
|
| 252 |
+
have h := c.mul_coord 1 1 i
|
| 253 |
+
simp only [mul_one,c.one_coord,zero_add] at h
|
| 254 |
+
have he : (Sum.elim (fun _ : Fin i.val => (0:ℝ)) (fun _ : Fin i.val => (0:ℝ))) = (fun _ => (0:ℝ)) := by
|
| 255 |
+
funext j; cases j <;> rfl
|
| 256 |
+
rw [he] at h
|
| 257 |
+
exact h.symm
|
| 258 |
+
|
| 259 |
+
variable (w : Fin n → ℕ)
|
| 260 |
+
variable (hw : ∀ i : Fin n, ∀ j : Fin n, j < i → correctionDenom c i * w i ∣ w j)
|
| 261 |
+
|
| 262 |
+
def OnGrid (g : G) : Prop := ∀ i, ∃ z : ℤ, c.coord g i = (w i:ℝ)*(z:ℝ)
|
| 263 |
+
|
| 264 |
+
include hw in
|
| 265 |
+
lemma correction_on_grid (g h : G) (i : Fin n)
|
| 266 |
+
(hg : ∀ j : Fin n, j < i → ∃ z : ℤ, c.coord g j = (w j:ℝ)*(z:ℝ))
|
| 267 |
+
(hh : ∀ j : Fin n, j < i → ∃ z : ℤ, c.coord h j = (w j:ℝ)*(z:ℝ)) :
|
| 268 |
+
∃ z : ℤ, MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 269 |
+
(Sum.elim (fun j => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 270 |
+
(fun j => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) (c.correction i) = (w i:ℝ)*(z:ℝ) := by
|
| 271 |
+
have hl (a : G) (ha : ∀ j : Fin n, j < i → ∃ z : ℤ, c.coord a j = (w j:ℝ)*(z:ℝ))
|
| 272 |
+
(j : Fin i.val) : ∃ z : ℤ, c.coord a ⟨j.val,lt_trans j.isLt i.isLt⟩ =
|
| 273 |
+
((correctionDenom c i*w i:ℕ):ℝ)*(z:ℝ) := by
|
| 274 |
+
let k : Fin n := ⟨j.val,lt_trans j.isLt i.isLt⟩
|
| 275 |
+
obtain ⟨z,hz⟩ := ha k j.isLt
|
| 276 |
+
obtain ⟨b,hb⟩ := hw i k j.isLt
|
| 277 |
+
refine ⟨(b:ℤ)*z,?_⟩
|
| 278 |
+
change c.coord a k = _
|
| 279 |
+
rw [hz,hb]
|
| 280 |
+
push_cast
|
| 281 |
+
ring
|
| 282 |
+
have he := (TriangularDenominators.polynomial_origin_grid_real (c.correction i)).choose_spec.2
|
| 283 |
+
(w i) (Sum.elim (fun j => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩)
|
| 284 |
+
(fun j => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩)) (by
|
| 285 |
+
intro j
|
| 286 |
+
cases j with
|
| 287 |
+
| inl j => exact hl g hg j
|
| 288 |
+
| inr j => exact hl h hh j)
|
| 289 |
+
simpa only [correction_at_zero,sub_zero] using he
|
| 290 |
+
|
| 291 |
+
include hw in
|
| 292 |
+
lemma onGrid_mul {g h : G} (hg : OnGrid c w g) (hh : OnGrid c w h) : OnGrid c w (g*h) := by
|
| 293 |
+
intro i
|
| 294 |
+
obtain ⟨a,ha⟩ := hg i
|
| 295 |
+
obtain ⟨b,hb⟩ := hh i
|
| 296 |
+
obtain ⟨d,hd⟩ := correction_on_grid c w hw g h i (fun j _ => hg j) (fun j _ => hh j)
|
| 297 |
+
refine ⟨a+b+d,?_⟩
|
| 298 |
+
rw [c.mul_coord,ha,hb,hd]
|
| 299 |
+
push_cast
|
| 300 |
+
ring
|
| 301 |
+
|
| 302 |
+
include hw in
|
| 303 |
+
lemma onGrid_inv {g : G} (hg : OnGrid c w g) : OnGrid c w g⁻¹ := by
|
| 304 |
+
have hi : ∀ a : ℕ, ∀ ha : a < n, ∃ z : ℤ,
|
| 305 |
+
c.coord g⁻¹ ⟨a,ha⟩ = (w ⟨a,ha⟩:ℝ)*(z:ℝ) := by
|
| 306 |
+
intro a
|
| 307 |
+
induction a using Nat.strong_induction_on with
|
| 308 |
+
| h a ih =>
|
| 309 |
+
intro ha
|
| 310 |
+
let i : Fin n := ⟨a,ha⟩
|
| 311 |
+
obtain ⟨b,hb⟩ := hg i
|
| 312 |
+
obtain ⟨d,hd⟩ := correction_on_grid c w hw g g⁻¹ i (fun j _ => hg j)
|
| 313 |
+
(fun j hj => ih j.val hj j.isLt)
|
| 314 |
+
have he := c.mul_coord g g⁻¹ i
|
| 315 |
+
rw [mul_inv_cancel,c.one_coord,hb,hd] at he
|
| 316 |
+
refine ⟨-b-d,?_⟩
|
| 317 |
+
change c.coord g⁻¹ i = _
|
| 318 |
+
push_cast
|
| 319 |
+
linarith
|
| 320 |
+
exact fun i => hi i.val i.isLt
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
def weightedLattice : Subgroup G where
|
| 325 |
+
carrier := OnGrid c w
|
| 326 |
+
one_mem' := fun i => ⟨0,by simp [c.one_coord]⟩
|
| 327 |
+
mul_mem' := onGrid_mul c w hw
|
| 328 |
+
inv_mem' := onGrid_inv c w hw
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
theorem exists_lattice_weights (E : ℕ) (hE : 0 < E) : ∃ w : Fin n → ℕ,
|
| 333 |
+
(∀ i, 0 < w i) ∧ (∀ i, E ∣ w i) ∧
|
| 334 |
+
∀ i : Fin n, ∀ j : Fin n, j < i → correctionDenom c i*w i ∣ w j := by
|
| 335 |
+
let D : ℕ := E * ∏ i, correctionDenom c i
|
| 336 |
+
have hD : 0 < D := Nat.mul_pos hE (Finset.prod_pos (fun i _ => correctionDenom_pos c i))
|
| 337 |
+
refine ⟨fun i => D^(n-i.val),fun i => pow_pos hD _,?_,?_⟩
|
| 338 |
+
· intro i
|
| 339 |
+
exact (dvd_mul_right E _).trans (dvd_pow_self D (by omega))
|
| 340 |
+
· intro i j hji
|
| 341 |
+
have hc : correctionDenom c i ∣ D :=
|
| 342 |
+
(Finset.dvd_prod_of_mem (fun i => correctionDenom c i) (Finset.mem_univ i)).trans (dvd_mul_left _ _)
|
| 343 |
+
have he : correctionDenom c i*D^(n-i.val) ∣ D^(n-i.val+1) := by
|
| 344 |
+
rw [pow_succ]
|
| 345 |
+
rw [mul_comm (D^(n-i.val)) D]
|
| 346 |
+
exact mul_dvd_mul_right hc _
|
| 347 |
+
exact he.trans (pow_dvd_pow D (by change j.val < i.val at hji; omega))
|
| 348 |
+
|
| 349 |
+
variable (hpos : ∀ i, 0 < w i)
|
| 350 |
+
|
| 351 |
+
def divideCoordinates : (Fin n → ℝ) ≃ₜ (Fin n → ℝ) where
|
| 352 |
+
toFun x i := x i/(w i:ℝ)
|
| 353 |
+
invFun x i := (w i:ℝ)*x i
|
| 354 |
+
left_inv x := by funext i; exact mul_div_cancel₀ (x i) (by exact_mod_cast (hpos i).ne')
|
| 355 |
+
right_inv x := by funext i; exact mul_div_cancel_left₀ (x i) (by exact_mod_cast (hpos i).ne')
|
| 356 |
+
continuous_toFun := continuous_pi (fun i => (continuous_apply i).div_const _)
|
| 357 |
+
continuous_invFun := continuous_pi (fun i => continuous_const.mul (continuous_apply i))
|
| 358 |
+
|
| 359 |
+
lemma exists_scaled_correction (i : Fin n) :
|
| 360 |
+
∃ P : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ, ∀ x : (Fin i.val ⊕ Fin i.val) → ℝ,
|
| 361 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 362 |
+
(Sum.elim (fun j => (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ)*x (Sum.inl j))
|
| 363 |
+
(fun j => (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ)*x (Sum.inr j)))
|
| 364 |
+
(c.correction i) / (w i:ℝ) = MvPolynomial.eval₂ (algebraMap ℚ ℝ) x P := by
|
| 365 |
+
have he : RationalPolynomialMap.IsPolynomial (fun x : (Fin i.val ⊕ Fin i.val) → ℝ =>
|
| 366 |
+
MvPolynomial.eval₂ (algebraMap ℚ ℝ)
|
| 367 |
+
(Sum.elim (fun j => (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ)*x (Sum.inl j))
|
| 368 |
+
(fun j => (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ)*x (Sum.inr j))) (c.correction i)) := by
|
| 369 |
+
apply RationalPolynomialMap.eval
|
| 370 |
+
intro j
|
| 371 |
+
cases j with
|
| 372 |
+
| inl j => simpa using RationalPolynomialMap.mul (RationalPolynomialMap.const (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℚ)) (RationalPolynomialMap.coordinate (Sum.inl j))
|
| 373 |
+
| inr j => simpa using RationalPolynomialMap.mul (RationalPolynomialMap.const (w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℚ)) (RationalPolynomialMap.coordinate (Sum.inr j))
|
| 374 |
+
have hm := RationalPolynomialMap.mul he (RationalPolynomialMap.const (w i:ℚ)⁻¹)
|
| 375 |
+
simpa only [RationalPolynomialMap.IsPolynomial,div_eq_mul_inv,Rat.cast_inv,Rat.cast_natCast] using hm
|
| 376 |
+
|
| 377 |
+
def scaledCorrection (i : Fin n) : MvPolynomial (Fin i.val ⊕ Fin i.val) ℚ :=
|
| 378 |
+
(exists_scaled_correction c w i).choose
|
| 379 |
+
|
| 380 |
+
|
| 381 |
+
def scaledCoordinates : RealCoordinates G n where
|
| 382 |
+
coord := c.coord.trans (divideCoordinates w hpos)
|
| 383 |
+
one_coord i := by change c.coord 1 i / (w i:ℝ) = 0; rw [c.one_coord,zero_div]
|
| 384 |
+
correction := scaledCorrection c w
|
| 385 |
+
mul_coord g h i := by
|
| 386 |
+
change c.coord (g*h) i/(w i:ℝ) = _
|
| 387 |
+
have he := (exists_scaled_correction c w i).choose_spec
|
| 388 |
+
(Sum.elim (fun j => c.coord g ⟨j.val,lt_trans j.isLt i.isLt⟩/(w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ))
|
| 389 |
+
(fun j => c.coord h ⟨j.val,lt_trans j.isLt i.isLt⟩/(w ⟨j.val,lt_trans j.isLt i.isLt⟩:ℝ)))
|
| 390 |
+
have hc (v : ℝ) (j : Fin n) : (w j:ℝ)*(v/(w j:ℝ)) = v := mul_div_cancel₀ _ (by exact_mod_cast (hpos j).ne')
|
| 391 |
+
simp only [Sum.elim_inl,Sum.elim_inr,hc] at he
|
| 392 |
+
change c.coord (g*h) i/(w i:ℝ) = c.coord g i/(w i:ℝ)+c.coord h i/(w i:ℝ)+_
|
| 393 |
+
dsimp [scaledCorrection,divideCoordinates]
|
| 394 |
+
rw [← he,c.mul_coord]
|
| 395 |
+
ring
|
| 396 |
+
|
| 397 |
+
lemma weightedLattice_iff (g : G) : g ∈ weightedLattice c w hw ↔
|
| 398 |
+
∀ i, ∃ z : ℤ, (scaledCoordinates c w hpos).coord g i = z := by
|
| 399 |
+
constructor <;> intro hg i <;> obtain ⟨z,hz⟩ := hg i <;> refine ⟨z,?_⟩
|
| 400 |
+
· change c.coord g i/(w i:ℝ) = z
|
| 401 |
+
rw [hz]
|
| 402 |
+
exact mul_div_cancel_left₀ _ (by exact_mod_cast (hpos i).ne')
|
| 403 |
+
· change c.coord g i/(w i:ℝ) = z at hz
|
| 404 |
+
exact (div_eq_iff (by exact_mod_cast (hpos i).ne')).mp hz |>.trans (mul_comm _ _)
|
| 405 |
+
|
| 406 |
+
end RationalLattice
|
| 407 |
+
|
| 408 |
+
end
|
| 409 |
+
end
|
| 410 |
+
end
|
| 411 |
+
end
|
| 412 |
+
end
|
| 413 |
+
|
| 414 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice09.lean
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.MalcevCentral01
|
| 3 |
+
import OAI.Combinatorics.SumProduct.Alignment.SquareInduction02
|
| 4 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
section
|
| 12 |
+
noncomputable section
|
| 13 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 14 |
+
open scoped BigOperators
|
| 15 |
+
end
|
| 16 |
+
end
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
section
|
| 21 |
+
noncomputable section
|
| 22 |
+
namespace RationalLattice
|
| 23 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 24 |
+
variable {n : ℕ} (c : RealCoordinates G n)
|
| 25 |
+
variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
|
| 26 |
+
|
| 27 |
+
include hΓ in
|
| 28 |
+
|
| 29 |
+
lemma coordinate_quotient_t2 : T2Space (G⧸Γ) := by
|
| 30 |
+
let : T2Space G := c.coord.symm.t2Space
|
| 31 |
+
let : DiscreteTopology Γ := integerCoordinates_discrete c Γ hΓ
|
| 32 |
+
have hc : IsClosed (Γ : Set G) := Γ.isClosed_of_discreteTopology
|
| 33 |
+
apply (t2Space_iff_of_isOpenQuotientMap (QuotientGroup.isOpenQuotientMap_mk (N:=Γ))).mpr
|
| 34 |
+
have he : {p : G×G | (QuotientGroup.mk p.1 : G⧸Γ)=QuotientGroup.mk p.2}=
|
| 35 |
+
(fun p : G×G => p.1⁻¹*p.2) ⁻¹' (Γ:Set G) := by
|
| 36 |
+
ext p
|
| 37 |
+
exact QuotientGroup.eq
|
| 38 |
+
rw [he]
|
| 39 |
+
exact hc.preimage (continuous_fst.inv.mul continuous_snd)
|
| 40 |
+
|
| 41 |
+
include hΓ in
|
| 42 |
+
lemma coordinate_quotient_metrizable : TopologicalSpace.MetrizableSpace (G⧸Γ) := by
|
| 43 |
+
let : T2Space (G⧸Γ) := coordinate_quotient_t2 c Γ hΓ
|
| 44 |
+
let : CompactSpace (G⧸Γ) := AbelianMalcevTorus.quotient_compact c Γ hΓ
|
| 45 |
+
let : SecondCountableTopology G := c.coord.secondCountableTopology
|
| 46 |
+
infer_instance
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
abbrev coordinateQuotientMetric : MetricSpace (G⧸Γ) :=
|
| 51 |
+
letI := coordinate_quotient_metrizable c Γ hΓ
|
| 52 |
+
TopologicalSpace.metrizableSpaceMetric (G⧸Γ)
|
| 53 |
+
|
| 54 |
+
lemma coordinateQuotientMetric_topology :
|
| 55 |
+
(coordinateQuotientMetric c Γ hΓ).toUniformSpace.toTopologicalSpace=
|
| 56 |
+
QuotientGroup.instTopologicalSpace Γ := rfl
|
| 57 |
+
|
| 58 |
+
end RationalLattice
|
| 59 |
+
end
|
| 60 |
+
end
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
section
|
| 65 |
+
noncomputable section
|
| 66 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 67 |
+
namespace AbelianMalcevTorus
|
| 68 |
+
open RationalLattice MalcevCharacters CubeFaces LeibmanSquare MeasureTheory RationalQuotientFunctions
|
| 69 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 70 |
+
variable {n r : ℕ} (c : RealCoordinates G n) (hsk : SecondKind c) (hr : r ≤ n)
|
| 71 |
+
variable (N Γ : Subgroup G) [N.Normal] (hcomm : _root_.commutator G ≤ N)
|
| 72 |
+
variable (hN : ∀ g : G, g∈N ↔ ∀ i : Fin n, i.val<r → c.coord g i=0)
|
| 73 |
+
variable (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
|
| 74 |
+
variable [MeasurableSpace (G⧸Γ)] [BorelSpace (G⧸Γ)]
|
| 75 |
+
|
| 76 |
+
include hsk hr hcomm hN hΓ in
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
theorem quantitative_abelian_quotient_observable (H : Filtration G) (s : ℕ) (hs : H.level (s+1)=⊥)
|
| 80 |
+
(μ : Measure (G⧸Γ)) [IsProbabilityMeasure μ] [SMulInvariantMeasure G (G⧸Γ) μ]
|
| 81 |
+
(F : C(G⧸Γ,ℂ)) (hF : ∀ g a, a∈N → F (QuotientGroup.mk (g*a))=F (QuotientGroup.mk g))
|
| 82 |
+
(δ : ℝ) (hδ : 0<δ) :
|
| 83 |
+
letI : CompactSpace (G⧸Γ) := quotient_compact c Γ hΓ
|
| 84 |
+
∃ U : Finset (G→*Multiplicative ℝ),
|
| 85 |
+
(∀ χ∈U, Continuous χ ∧ (∀ g∈Γ, ∃ z : ℤ, (χ g).toAdd=z)) ∧
|
| 86 |
+
∃ A : ℝ, 0<A ∧ ∀ L : ℕ, 0<L → ∀ f : ℤ→G, Polynomial H 0 f →
|
| 87 |
+
δ ≤ ‖FourierObstruction.discrepancy μ L (fun k => QuotientGroup.mk (f k)) F‖ →
|
| 88 |
+
∃ χ∈U, χ≠1 ∧ ∃ P : ℝ[X], P.natDegree ≤ s ∧
|
| 89 |
+
(∀ z : ℤ, P.eval (z:ℝ)=(χ (f z)).toAdd) ∧
|
| 90 |
+
∀ j : ℕ, 0<j → ∃ z : ℤ, |P.coeff j-z| ≤ A/(L:ℝ)^j := by
|
| 91 |
+
classical
|
| 92 |
+
let : CompactSpace (G⧸Γ) := quotient_compact c Γ hΓ
|
| 93 |
+
let cQ := MalcevPrefixQuotient.quotientChart c hr N hN
|
| 94 |
+
let ΓQ := Γ.map (QuotientGroup.mk' N)
|
| 95 |
+
have hΓQ : ∀ g : G⧸N, g∈ΓQ ↔ ∀ i, ∃ z : ℤ, cQ.coord g i=z :=
|
| 96 |
+
MalcevPrefixQuotient.quotient_lattice c hr N hN Γ hΓ
|
| 97 |
+
have hadd : ∀ g h : G⧸N, ∀ i, cQ.coord (g*h) i=cQ.coord g i+cQ.coord h i := by
|
| 98 |
+
intro g h i
|
| 99 |
+
induction g using Quotient.inductionOn with | h g =>
|
| 100 |
+
induction h using Quotient.inductionOn with | h h =>
|
| 101 |
+
exact prefix_coord_mul c hsk N r hcomm (fun a ha => (hN a).mp ha)
|
| 102 |
+
(MalcevPrefixQuotient.embed hr i) i.isLt g h
|
| 103 |
+
let : MetricSpace ((G⧸N)⧸ΓQ) := coordinateQuotientMetric cQ ΓQ hΓQ
|
| 104 |
+
let : CompactSpace ((G⧸N)⧸ΓQ) := quotient_compact cQ ΓQ hΓQ
|
| 105 |
+
let : MeasurableSpace ((G⧸N)⧸ΓQ) := borel _
|
| 106 |
+
let : BorelSpace ((G⧸N)⧸ΓQ) := ⟨rfl⟩
|
| 107 |
+
let Q := quotientMap N Γ
|
| 108 |
+
have hQ : Continuous Q := continuous_quotientMap N Γ
|
| 109 |
+
let ν := Measure.map Q μ
|
| 110 |
+
let : IsProbabilityMeasure ν :=
|
| 111 |
+
(Measure.isProbabilityMeasure_map_iff hQ.measurable.aemeasurable).mpr inferInstance
|
| 112 |
+
let : SMulInvariantMeasure (G⧸N) ((G⧸N)⧸ΓQ) ν := CentralQuotientAction.invariant_quotientMap N Γ μ
|
| 113 |
+
obtain ⟨FQ,hFQ,_⟩ := existsUnique_normalDescend N Γ
|
| 114 |
+
(⟨fun g => F (QuotientGroup.mk g),F.continuous.comp QuotientGroup.continuous_mk⟩ : C(G,ℂ)) hF
|
| 115 |
+
(fun g a ha => congrArg F (QuotientGroup.mk_mul_of_mem g ha))
|
| 116 |
+
have hFQall : ∀ x : G⧸Γ, FQ (Q x)=F x := by
|
| 117 |
+
intro x
|
| 118 |
+
induction x using Quotient.inductionOn with | h g => exact hFQ g
|
| 119 |
+
let HQ := mapFiltration H (QuotientGroup.mk' N)
|
| 120 |
+
have hsQ : HQ.level (s+1)=⊥ := by
|
| 121 |
+
change (H.level (s+1)).map (QuotientGroup.mk' N)=⊥
|
| 122 |
+
rw [hs,Subgroup.map_bot]
|
| 123 |
+
obtain ⟨U,hU,A,hA,hprod⟩ := quantitative_abelian_compact_producer cQ hadd ΓQ hΓQ rfl
|
| 124 |
+
HQ s hsQ ν {FQ} (isCompact_singleton) δ hδ
|
| 125 |
+
let liftχ : (G⧸N →* Multiplicative ℝ) → (G→*Multiplicative ℝ) := fun χ => χ.comp (QuotientGroup.mk' N)
|
| 126 |
+
refine ⟨U.image liftχ,?_,A,hA,?_⟩
|
| 127 |
+
· intro χ hχ
|
| 128 |
+
obtain ⟨ξ,hξ,rfl⟩ := Finset.mem_image.mp hχ
|
| 129 |
+
refine ⟨(hU ξ hξ).1.comp QuotientGroup.continuous_mk,?_⟩
|
| 130 |
+
intro g hg
|
| 131 |
+
exact (hU ξ hξ).2 _ ⟨g,hg,rfl⟩
|
| 132 |
+
· intro L hL f hf hdisc
|
| 133 |
+
have hint : (∫ x, FQ x ∂ν)=(∫ x,F x ∂μ) := by
|
| 134 |
+
rw [show ν=Measure.map Q μ from rfl,integral_map hQ.measurable.aemeasurable FQ.continuous.aestronglyMeasurable]
|
| 135 |
+
apply integral_congr_ae
|
| 136 |
+
exact Filter.Eventually.of_forall hFQall
|
| 137 |
+
have hdiscQ : δ ≤ ‖FourierObstruction.discrepancy ν L
|
| 138 |
+
(fun k => QuotientGroup.mk (QuotientGroup.mk' N (f k))) FQ‖ := by
|
| 139 |
+
change δ ≤ ‖PolynomialWeyl.mean L (fun k => FQ (QuotientGroup.mk (QuotientGroup.mk' N (f k))))-(∫ x,FQ x ∂ν)‖
|
| 140 |
+
simp only [hFQ,hint]
|
| 141 |
+
exact hdisc
|
| 142 |
+
obtain ⟨χ,hχ,hχ0,P,hP,hPe,hPc⟩ := hprod L hL (fun z => QuotientGroup.mk' N (f z))
|
| 143 |
+
(polynomial_map H (QuotientGroup.mk' N) hf) ⟨FQ,Set.mem_singleton FQ,hdiscQ⟩
|
| 144 |
+
refine ⟨liftχ χ,Finset.mem_image.mpr ⟨χ,hχ,rfl⟩,?_,P,hP,hPe,hPc⟩
|
| 145 |
+
intro he
|
| 146 |
+
apply hχ0
|
| 147 |
+
apply MonoidHom.ext
|
| 148 |
+
intro x
|
| 149 |
+
obtain ⟨g,rfl⟩ := QuotientGroup.mk_surjective x
|
| 150 |
+
exact congrArg (fun ψ : G→*Multiplicative ℝ => ψ g) he
|
| 151 |
+
|
| 152 |
+
end AbelianMalcevTorus
|
| 153 |
+
end
|
| 154 |
+
end
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
section
|
| 159 |
+
noncomputable section
|
| 160 |
+
open _root_.Polynomial _root_.OAI.Polynomial
|
| 161 |
+
namespace SquareInduction
|
| 162 |
+
open CubeFaces CubePolynomials LeibmanSquare RationalLattice MalcevCharacters
|
| 163 |
+
open MeasureTheory PolynomialWeyl AbelianMalcevTorus MalcevCentralTorus RationalTailCoordinates UnitAddTorus
|
| 164 |
+
variable {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G]
|
| 165 |
+
variable {t d : ℕ} (c : RealCoordinates G (t+d)) (hsk : SecondKind c)
|
| 166 |
+
variable (H : Filtration G) (h0 : H.level 0=⊤) (h1 : H.level 1=⊤)
|
| 167 |
+
variable [∀ i, (H.level i).Normal]
|
| 168 |
+
variable (hs : H.level 3=⊥) (hcomm : H.level 2=_root_.commutator G)
|
| 169 |
+
variable (q : ℕ→ℕ) (hqbound : ∀ k, q k ≤ t+d) (hq2 : q 2=t)
|
| 170 |
+
variable (hq : ∀ k (g : G), g∈H.level k ↔ ∀ i : Fin (t+d), i.val<q k → c.coord g i=0)
|
| 171 |
+
variable (Γ : Subgroup G) (hΓ : ∀ g : G, g∈Γ ↔ ∀ i, ∃ z : ℤ, c.coord g i=z)
|
| 172 |
+
variable [MeasurableSpace (G⧸Γ)] [BorelSpace (G⧸Γ)]
|
| 173 |
+
|
| 174 |
+
include hsk h0 h1 hs hcomm hqbound hq2 hq hΓ in
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
theorem quadratic_eigenfunction_observable
|
| 178 |
+
(μ : Measure (G⧸Γ)) [IsProbabilityMeasure μ] [SMulInvariantMeasure G (G⧸Γ) μ]
|
| 179 |
+
(δ : ℝ) (hδ : 0<δ) :
|
| 180 |
+
letI : MetricSpace (G⧸Γ) := coordinateQuotientMetric c Γ hΓ
|
| 181 |
+
letI : CompactSpace (G⧸Γ) := quotient_compact c Γ hΓ
|
| 182 |
+
let htail : ∀ g : G, g∈H.level 2 ↔ ∀ i : Fin (t+d), i.val<t → c.coord g i=0 :=
|
| 183 |
+
fun g => by simpa only [hq2] using hq 2 g
|
| 184 |
+
letI := tailAction c hsk (H.level 2) Γ (last_central_ambient H h1 2 hs) htail hΓ
|
| 185 |
+
∀ (F : C(G⧸Γ,ℂ)) (k : Fin d→ℤ), TorusVerticalFourier.HasWeight k F →
|
| 186 |
+
∃ U : Finset (G→*Multiplicative ℝ), ∃ A : ℝ, 0<A ∧ ∃ N₀ : ℕ, 0<N₀ ∧
|
| 187 |
+
∀ N : ℕ, N₀ ≤ N → ∀ f : ℤ→G, LeibmanSquare.Polynomial H 0 f → f 0=1 →
|
| 188 |
+
δ ≤ ‖FourierObstruction.discrepancy μ N (fun k => QuotientGroup.mk (f k)) F‖ →
|
| 189 |
+
∃ ξ∈U, ξ≠1 ∧ Continuous ξ ∧ (∀ g∈Γ, ∃ z : ℤ, (ξ g).toAdd=z) ∧
|
| 190 |
+
∃ P : ℝ[X], P.natDegree ≤ 2 ∧ (∀ z : ℤ, P.eval (z:ℝ)=(ξ (f z)).toAdd) ∧
|
| 191 |
+
∀ j : ℕ, 0<j → ∃ z : ℤ, |P.coeff j-z| ≤ A/(N:ℝ)^j := by
|
| 192 |
+
classical
|
| 193 |
+
let : MetricSpace (G⧸Γ) := coordinateQuotientMetric c Γ hΓ
|
| 194 |
+
let : CompactSpace (G⧸Γ) := quotient_compact c Γ hΓ
|
| 195 |
+
let htail : ∀ g : G, g∈H.level 2 ↔ ∀ i : Fin (t+d), i.val<t → c.coord g i=0 :=
|
| 196 |
+
fun g => by simpa only [hq2] using hq 2 g
|
| 197 |
+
let hcent := last_central_ambient H h1 2 hs
|
| 198 |
+
let := tailAction c hsk (H.level 2) Γ hcent htail hΓ
|
| 199 |
+
let := continuous_tailAction c hsk (H.level 2) Γ hcent htail hΓ
|
| 200 |
+
let := invariant_tailAction c hsk (H.level 2) Γ hcent htail hΓ μ
|
| 201 |
+
dsimp only
|
| 202 |
+
intro F k hw
|
| 203 |
+
by_cases hk : k=0
|
| 204 |
+
· have hF : ∀ g a, a∈H.level 2 → F (QuotientGroup.mk (g*a))=F (QuotientGroup.mk g) := by
|
| 205 |
+
intro g a ha
|
| 206 |
+
have he := hw (torusProjection (tailCoordinates c (H.level 2) htail) ⟨a,ha⟩) (QuotientGroup.mk g)
|
| 207 |
+
rw [tailProjection_vadd c hsk (H.level 2) Γ hcent htail hΓ] at he
|
| 208 |
+
simpa only [hk,mFourier_zero,ContinuousMap.one_apply,one_mul] using he
|
| 209 |
+
obtain ⟨U,hU,A,hA,hprod⟩ := quantitative_abelian_quotient_observable c hsk
|
| 210 |
+
(Nat.le_add_right t d) (H.level 2) Γ hcomm.ge htail hΓ H 2 hs μ F hF δ hδ
|
| 211 |
+
refine ⟨U,A,hA,1,by decide,?_⟩
|
| 212 |
+
intro N hN f hf _ hdisc
|
| 213 |
+
obtain ⟨ξ,hξ,hξ0,P,hP,hPe,hPc⟩ := hprod N hN f hf hdisc
|
| 214 |
+
exact ⟨ξ,hξ,hξ0,(hU ξ hξ).1,(hU ξ hξ).2,P,hP,hPe,hPc⟩
|
| 215 |
+
· let D : ℝ := 1+‖F‖
|
| 216 |
+
have hD : 0<D := by dsimp [D]; positivity
|
| 217 |
+
let F' : C(G⧸Γ,ℂ) := (D:ℂ)⁻¹ • F
|
| 218 |
+
have hw' : TorusVerticalFourier.HasWeight k F' := hw.smul _
|
| 219 |
+
have hF' : ∀ x, ‖F' x‖ ≤ 1 := by
|
| 220 |
+
intro x
|
| 221 |
+
change ‖(D:ℂ)⁻¹ * F x‖ ≤ 1
|
| 222 |
+
rw [norm_mul,norm_inv,Complex.norm_real,Real.norm_eq_abs,abs_of_pos hD]
|
| 223 |
+
have hFx := F.norm_coe_le_norm x
|
| 224 |
+
apply (inv_mul_le_iff₀ hD).mpr
|
| 225 |
+
dsimp [D]
|
| 226 |
+
linarith
|
| 227 |
+
let χ : G→ℂ := fun g => if hg : g∈H.level 2 then
|
| 228 |
+
mFourier k (torusProjection (tailCoordinates c (H.level 2) htail) ⟨g,hg⟩) else 1
|
| 229 |
+
have hχ : ∀ g∈H.level 2, ‖χ g‖=1 := by
|
| 230 |
+
intro g hg
|
| 231 |
+
simp only [χ,dite_eq_left hg]
|
| 232 |
+
exact TorusVerticalFourier.character_norm _ _
|
| 233 |
+
have hright : ∀ a∈H.level 2, ∀ g : G,
|
| 234 |
+
F' (QuotientGroup.mk (g*a))=χ a*F' (QuotientGroup.mk g) := by
|
| 235 |
+
intro a ha g
|
| 236 |
+
have he := hw' (torusProjection (tailCoordinates c (H.level 2) htail) ⟨a,ha⟩) (QuotientGroup.mk g)
|
| 237 |
+
rw [tailProjection_vadd c hsk (H.level 2) Γ hcent htail hΓ] at he
|
| 238 |
+
simpa only [χ,dite_eq_left ha] using he
|
| 239 |
+
obtain ⟨s,hs⟩ := TorusVerticalFourier.character_nontrivial hk
|
| 240 |
+
obtain ⟨a,ha⟩ := torusProjection_surjective (tailCoordinates c (H.level 2) htail) s
|
| 241 |
+
have hχa : χ a.val≠1 := by simpa only [χ,dite_eq_left a.property,ha] using hs
|
| 242 |
+
obtain ⟨U,A,hA,N₀,hN₀,hprod⟩ := quadratic_source_vertical_correlation c hsk H h0 h1
|
| 243 |
+
(show H.level 3=⊥ from ‹H.level 3=⊥›) hcomm q hqbound hq2 hq Γ hΓ F' hF' χ hχ hright a.val a.property hχa
|
| 244 |
+
(δ/D) (div_pos hδ hD)
|
| 245 |
+
refine ⟨U,A,hA,N₀,hN₀,?_⟩
|
| 246 |
+
intro N hN f hf hf0 hdisc
|
| 247 |
+
apply hprod N hN f hf hf0
|
| 248 |
+
have hzero := TorusVerticalFourier.integral_hasWeight_eq_zero μ F' hk hw'
|
| 249 |
+
have hdisc' : δ/D ≤ ‖FourierObstruction.discrepancy μ N (fun k => QuotientGroup.mk (f k)) F'‖ := by
|
| 250 |
+
change δ/D ≤ ‖FourierObstruction.discrepancy μ N _ ((D:ℂ)⁻¹ • F)‖
|
| 251 |
+
rw [map_smul,norm_smul,norm_inv,Complex.norm_real,Real.norm_eq_abs,abs_of_pos hD,div_eq_inv_mul]
|
| 252 |
+
exact mul_le_mul_of_nonneg_left hdisc (inv_nonneg.mpr hD.le)
|
| 253 |
+
change δ/D ≤ ‖mean N (fun n => F' (QuotientGroup.mk (f n)))-(∫ x,F' x ∂μ)‖ at hdisc'
|
| 254 |
+
simpa only [hzero,sub_zero] using hdisc'
|
| 255 |
+
|
| 256 |
+
end SquareInduction
|
| 257 |
+
end
|
| 258 |
+
end
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
end
|
| 264 |
+
end
|
| 265 |
+
end
|
| 266 |
+
|
| 267 |
+
end OAI
|
lean/OAI/Combinatorics/SumProduct/Alignment/RationalLattice10.lean
ADDED
|
@@ -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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
import OAI.Combinatorics.SumProduct.Alignment.CubeLocal09
|
| 3 |
+
import OAI.Geometry.NilpotentCharts.Main
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
section
|
| 9 |
+
section
|
| 10 |
+
section
|
| 11 |
+
noncomputable section
|
| 12 |
+
open scoped BigOperators
|
| 13 |
+
end
|
| 14 |
+
end
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
section
|
| 19 |
+
noncomputable section
|
| 20 |
+
open scoped BigOperators Topology commutatorElement NNReal
|
| 21 |
+
namespace CubeLocalHaar
|
| 22 |
+
open CubeFaces LeibmanSquare CubeTaylorExpansion CubeHorizontalIrrationality
|
| 23 |
+
open RationalLattice MeasureTheory Filter ComparableBoxLeibman MalcevCharacters AbelianMalcevTorus
|
| 24 |
+
variable {G ι : Type} [Group G] [PseudoMetricSpace G] [IsTopologicalGroup G]
|
| 25 |
+
variable [Fintype ι] [DecidableEq ι]
|
| 26 |
+
variable {n t d v : ℕ} (c : RealCoordinates G n) (H : Filtration G)
|
| 27 |
+
variable (S : ℕ→Set (Fin n))
|
| 28 |
+
variable (hH : ∀ k (g : G),g∈H.level k ↔ ∀ i∈S k,c.coord g i=0)
|
| 29 |
+
variable (Λ : Subgroup G) (σ : G) (h01 : H.level 0=H.level 1)
|
| 30 |
+
variable (s : ℕ) (hs : H.level (s+1)=⊥) (e : Option ι≃Fin v)
|
| 31 |
+
variable (cc : RealCoordinates (cube H (Finset.univ : Finset ι) 0) (t+d))
|
| 32 |
+
variable (hsk : SecondKind cc)
|
| 33 |
+
variable (q : ℕ→ℕ) (hqbound : ∀ k,q k ≤ t+d)
|
| 34 |
+
variable (hq : ∀ k (g : cube H (Finset.univ : Finset ι) 0),
|
| 35 |
+
g∈(CubeMaxFiltration.filtration H Finset.univ).level k ↔
|
| 36 |
+
∀ i : Fin (t+d),i.val < q k → cc.coord g i=0)
|
| 37 |
+
variable (hΓ : ∀ g : cube H (Finset.univ : Finset ι) 0,
|
| 38 |
+
g∈cubeLattice H (conjugateLattice Λ σ) ↔ ∀ i,∃ z : ℤ,cc.coord g i=z)
|
| 39 |
+
variable [MeasurableSpace ((cube H (Finset.univ : Finset ι) 0)⧸cubeLattice H (conjugateLattice Λ σ))]
|
| 40 |
+
variable [hBorel : @BorelSpace ((cube H (Finset.univ : Finset ι) 0)⧸cubeLattice H (conjugateLattice Λ σ)) (QuotientGroup.instTopologicalSpace (cubeLattice H (conjugateLattice Λ σ))) inferInstance]
|
| 41 |
+
variable (mtr : MetricSpace ((cube H (Finset.univ : Finset ι) 0)⧸cubeLattice H (conjugateLattice Λ σ)))
|
| 42 |
+
variable (htop : mtr.toUniformSpace.toTopologicalSpace=QuotientGroup.instTopologicalSpace (cubeLattice H (conjugateLattice Λ σ)))
|
| 43 |
+
|
| 44 |
+
variable [MeasurableSpace (G⧸Λ)] [BorelSpace (G⧸Λ)]
|
| 45 |
+
variable [SecondCountableTopology (G⧸Λ)]
|
| 46 |
+
|
| 47 |
+
variable [CompactSpace (G⧸Λ)]
|
| 48 |
+
variable (qmtr : MetricSpace (G⧸Λ))
|
| 49 |
+
variable (hqtop : qmtr.toUniformSpace.toTopologicalSpace=QuotientGroup.instTopologicalSpace Λ)
|
| 50 |
+
|
| 51 |
+
include S hH h01 hs hsk hqbound hq hΓ htop hqtop in
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
theorem source_comparable_physical_cube_haar
|
| 55 |
+
(μ : Measure ((cube H (Finset.univ : Finset ι) 0)⧸cubeLattice H (conjugateLattice Λ σ)))
|
| 56 |
+
[IsProbabilityMeasure μ]
|
| 57 |
+
[SMulInvariantMeasure (cube H (Finset.univ : Finset ι) 0) _ μ]
|
| 58 |
+
(a : ℕ→∀ k : ℕ,H.level k)
|
| 59 |
+
(hirr : ∀ j : ℕ,0 < j → j ≤ s → ∀ ξ : H.level j→*Multiplicative ℝ,
|
| 60 |
+
ξ≠1 → Continuous ξ → RationalCharacter (conjugateLattice Λ σ) ξ →
|
| 61 |
+
(∀ x (hx : x∈H.level (j+1)),ξ ⟨x,H.antitone (Nat.le_succ _) hx⟩=1) →
|
| 62 |
+
(∀ i k : ℕ,0 < i → 0 < k → ∀ h : i+k=j,
|
| 63 |
+
∀ x (hx : x∈H.level i) y (hy : y∈H.level k),
|
| 64 |
+
ξ ⟨⁅x,y⁆,by rw [←h]; exact H.commutator_le i k (Subgroup.commutator_mem_commutator hx hy)⟩=1) →
|
| 65 |
+
Tendsto (fun N : ℕ => ‖((ξ (a N j)).toAdd:UnitAddCircle)‖*(N:ℝ)^j)
|
| 66 |
+
atTop atTop)
|
| 67 |
+
|
| 68 |
+
(d₀ r₀ : ℕ) (hd₀ : 0<d₀) (hr₀ : r₀<d₀)
|
| 69 |
+
(β : ℝ) (hβ : β∈Set.Icc (0:ℝ) 1)
|
| 70 |
+
(cBox CBox C : ℝ) (hcBox : 0<cBox) (hCBox : 0<CBox) (hC : 0≤C)
|
| 71 |
+
(g : ℕ→ℝ→G) (h : ℝ→G) (hh : ContinuousAt h β)
|
| 72 |
+
(ρ : ℝ) (hρ : 0<ρ)
|
| 73 |
+
(hg : ∀ ε : ℝ,0<ε → ∀ᶠ N : ℕ in atTop,
|
| 74 |
+
∀ t : ℝ,dist t β<ρ → dist (g N t) (h t)<ε)
|
| 75 |
+
|
| 76 |
+
(P γ : ℕ→ℤ→G)
|
| 77 |
+
(hfactor : ∀ N : ℕ,∀ b : ℤ,
|
| 78 |
+
QuotientGroup.mk (P N b) = (QuotientGroup.mk
|
| 79 |
+
(g N ((b:ℝ)/(N:ℝ))*taylorPolynomial c H (a N) s (b:ℝ)*γ N b) : G⧸Λ))
|
| 80 |
+
(hperiod : ∀ N : ℕ,∀ b : ℤ,b%(d₀:ℤ)=(r₀:ℤ) →
|
| 81 |
+
QuotientGroup.mk (γ N b)=(QuotientGroup.mk σ:G⧸Λ))
|
| 82 |
+
|
| 83 |
+
(L : ℝ≥0) (B : ℝ) :
|
| 84 |
+
letI : MetricSpace (G⧸Λ) := MetricSpace.replaceTopology qmtr hqtop.symm
|
| 85 |
+
let m : ProbabilityMeasure (Finset ι→G⧸Λ) :=
|
| 86 |
+
imageProbability H Λ σ ⟨μ,inferInstance⟩ (fun _ => h β)
|
| 87 |
+
∀ ε : ℝ,0<ε → ∀ᶠ α : ℝ in 𝓝[>] 0,∀ᶠ N : ℕ in atTop,
|
| 88 |
+
∀ lo hi : Fin v→ℝ,
|
| 89 |
+
(∀ i,(cBox*α)*(N:ℝ)≤hi i-lo i) →
|
| 90 |
+
(∀ i,-CBox*(N:ℝ)≤lo i ∧ hi i≤CBox*(N:ℝ)) →
|
| 91 |
+
(∀ b∈physicalResidueRectangle lo hi (sourceResidue e r₀) d₀,
|
| 92 |
+
|((b (e none):ℝ)/(N:ℝ))-β|≤C*α ∧
|
| 93 |
+
∀ i : ι,|((b (e (some i)):ℝ)/(N:ℝ))|≤C*α) →
|
| 94 |
+
∀ F : C((Finset ι→G⧸Λ),ℂ),
|
| 95 |
+
LipschitzWith L F → ‖F‖≤B →
|
| 96 |
+
‖(𝔼 b∈physicalResidueRectangle lo hi (sourceResidue e r₀) d₀,
|
| 97 |
+
F (fun w : Finset ι => QuotientGroup.mk
|
| 98 |
+
(P N (b (e none)+∑ i∈w,b (e (some i))))))-
|
| 99 |
+
(∫ y,F y ∂(m:Measure (Finset ι→G⧸Λ)))‖<ε := by
|
| 100 |
+
let : MetricSpace (G⧸Λ) := MetricSpace.replaceTopology qmtr hqtop.symm
|
| 101 |
+
intro m
|
| 102 |
+
have hd : 0<(d₀:ℝ) := by exact_mod_cast hd₀
|
| 103 |
+
have hr : ∀ i : Fin v,0 ≤ sourceResidue e r₀ i ∧ sourceResidue e r₀ i<(d₀:ℤ) := by
|
| 104 |
+
intro i
|
| 105 |
+
have hd' : (0:ℤ)<d₀ := by exact_mod_cast hd₀
|
| 106 |
+
have hr' : (r₀:ℤ)<d₀ := by exact_mod_cast hr₀
|
| 107 |
+
unfold sourceResidue
|
| 108 |
+
split_ifs
|
| 109 |
+
· exact ⟨by positivity,hr'⟩
|
| 110 |
+
· exact ⟨le_refl 0,hd'⟩
|
| 111 |
+
let C' : ℝ := (CBox+(d₀:ℝ))/(d₀:ℝ)
|
| 112 |
+
have hC' : 0<C' := div_pos (add_pos hCBox hd) hd
|
| 113 |
+
have he := source_comparable_boxes_cube_haar c H S hH Λ σ h01 s hs e cc hsk q hqbound hq hΓ
|
| 114 |
+
mtr htop qmtr hqtop μ a hirr d₀ r₀ hd₀ hr₀ β hβ
|
| 115 |
+
(cBox/(d₀:ℝ)) C' C (div_pos hcBox hd) hC' hC
|
| 116 |
+
g h hh ρ hρ hg P γ hfactor hperiod L B
|
| 117 |
+
have hv (z : Fin v→ℤ) (w : Finset ι) :
|
| 118 |
+
sourceResidue e r₀ (e none)+(d₀:ℤ)*z (e none)+
|
| 119 |
+
∑ i∈w,(sourceResidue e r₀ (e (some i))+(d₀:ℤ)*z (e (some i))) =
|
| 120 |
+
sourceVertex e d₀ r₀ z w := by
|
| 121 |
+
simp [sourceResidue,sourceVertex,mul_add,Finset.mul_sum,add_assoc]
|
| 122 |
+
intro ε hε
|
| 123 |
+
filter_upwards [he ε hε] with α hα
|
| 124 |
+
filter_upwards [hα,Filter.eventually_ge_atTop (1:ℕ)] with N hN hN1
|
| 125 |
+
intro lo hi hside habs hlocal F hL hB
|
| 126 |
+
let lo' : Fin v→ℝ := fun i => (lo i-(sourceResidue e r₀ i:ℝ))/(d₀:ℝ)
|
| 127 |
+
let hi' : Fin v→ℝ := fun i => (hi i-(sourceResidue e r₀ i:ℝ))/(d₀:ℝ)
|
| 128 |
+
have hs' : ∀ i,((cBox/(d₀:ℝ))*α)*(N:ℝ)≤hi' i-lo' i := by
|
| 129 |
+
intro i
|
| 130 |
+
have hh := div_le_div_of_nonneg_right (hside i) hd.le
|
| 131 |
+
dsimp only [hi',lo']
|
| 132 |
+
have h₁ : ((cBox/(d₀:ℝ))*α)*(N:ℝ)=((cBox*α)*(N:ℝ))/(d₀:ℝ) := by ring
|
| 133 |
+
have h₂ : (hi i-(sourceResidue e r₀ i:ℝ))/(d₀:ℝ)-
|
| 134 |
+
(lo i-(sourceResidue e r₀ i:ℝ))/(d₀:ℝ)=(hi i-lo i)/(d₀:ℝ) := by ring
|
| 135 |
+
rw [h₁,h₂]
|
| 136 |
+
exact hh
|
| 137 |
+
have ha' : ∀ i,-C'*(N:ℝ)≤lo' i ∧ hi' i≤C'*(N:ℝ) := by
|
| 138 |
+
intro i
|
| 139 |
+
have hn : (1:ℝ)≤N := by exact_mod_cast hN1
|
| 140 |
+
have hr0 : (0:ℝ)≤(sourceResidue e r₀ i:ℝ) := by exact_mod_cast (hr i).1
|
| 141 |
+
have hrd : (sourceResidue e r₀ i:ℝ)<(d₀:ℝ) := by exact_mod_cast (hr i).2
|
| 142 |
+
dsimp only [lo',hi',C']
|
| 143 |
+
rw [le_div_iff₀ hd,div_le_iff₀ hd]
|
| 144 |
+
have hx : -((CBox+(d₀:ℝ))/(d₀:ℝ))*(N:ℝ)*(d₀:ℝ)=
|
| 145 |
+
-(CBox+(d₀:ℝ))*(N:ℝ) := by field_simp
|
| 146 |
+
have hy : ((CBox+(d₀:ℝ))/(d₀:ℝ))*(N:ℝ)*(d₀:ℝ)=
|
| 147 |
+
(CBox+(d₀:ℝ))*(N:ℝ) := by field_simp
|
| 148 |
+
rw [hx,hy]
|
| 149 |
+
constructor <;> nlinarith [(habs i).1,(habs i).2]
|
| 150 |
+
have hl' : ∀ z∈halfOpenBox v lo' hi',
|
| 151 |
+
|(((sourceResidue e r₀ (e none)+(d₀:ℤ)*z (e none):ℤ):ℝ)/(N:ℝ))-β|≤C*α ∧
|
| 152 |
+
∀ i : ι,|(((sourceResidue e r₀ (e (some i))+(d₀:ℤ)*z (e (some i)):ℤ):ℝ)/(N:ℝ))|≤C*α := by
|
| 153 |
+
intro z hz
|
| 154 |
+
exact hlocal _ ((physicalResidueRectangle_affine lo hi (sourceResidue e r₀) d₀ hd₀ hr z).mpr hz)
|
| 155 |
+
rw [physicalResidueRectangle_expect lo hi (sourceResidue e r₀) d₀ hd₀ hr]
|
| 156 |
+
simp_rw [hv]
|
| 157 |
+
exact hN lo' hi' hs' ha' hl' F hL hB
|
| 158 |
+
|
| 159 |
+
end CubeLocalHaar
|
| 160 |
+
end
|
| 161 |
+
end
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
end
|
| 165 |
+
|
| 166 |
+
section
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
noncomputable section
|
| 171 |
+
namespace RationalLattice
|
| 172 |
+
variable {G K : Type*} [Group G] [Group K] [TopologicalSpace G] [TopologicalSpace K]
|
| 173 |
+
variable {m n : ℕ}
|
| 174 |
+
|
| 175 |
+
lemma scaledCoordinates_rational (d : RealCoordinates K n) (w : Fin n → ℕ)
|
| 176 |
+
(hpos : ∀ i,0<w i) (g : K) :
|
| 177 |
+
IsRational (scaledCoordinates d w hpos) g ↔ IsRational d g := by
|
| 178 |
+
constructor
|
| 179 |
+
· intro hg i
|
| 180 |
+
obtain ⟨q,hq⟩:=hg i
|
| 181 |
+
refine ⟨(w i:ℚ)*q,?_⟩
|
| 182 |
+
push_cast
|
| 183 |
+
change (w i:ℝ)*q=d.coord g i
|
| 184 |
+
change (q:ℝ)=d.coord g i/(w i:ℝ) at hq
|
| 185 |
+
rw [hq]
|
| 186 |
+
exact mul_div_cancel₀ _ (by exact_mod_cast (hpos i).ne')
|
| 187 |
+
· intro hg i
|
| 188 |
+
obtain ⟨q,hq⟩:=hg i
|
| 189 |
+
refine ⟨q/(w i:ℚ),?_⟩
|
| 190 |
+
push_cast
|
| 191 |
+
change (q:ℝ)/(w i:ℝ)=d.coord g i/(w i:ℝ)
|
| 192 |
+
rw [hq]
|
| 193 |
+
|
| 194 |
+
lemma secondCoordinates_rational [IsTopologicalGroup K] (d : RealCoordinates K n) (g : K) :
|
| 195 |
+
IsRational (secondCoordinates d) g ↔ IsRational d g := by
|
| 196 |
+
constructor
|
| 197 |
+
· intro h
|
| 198 |
+
have he:=expProduct_rational d h
|
| 199 |
+
change IsRational d (expProduct d (expCoordinates d g)) at he
|
| 200 |
+
rwa [expProduct_expCoordinates] at he
|
| 201 |
+
· exact expCoordinates_rational d
|
| 202 |
+
|
| 203 |
+
variable (c : RealCoordinates G m) (d : RealCoordinates K n)
|
| 204 |
+
variable (F : K →* G)
|
| 205 |
+
variable (hpoly : ∀ i,RationalPolynomialMap.IsPolynomial
|
| 206 |
+
(fun x : Fin n → ℝ => c.coord (F (d.coord.symm x)) i))
|
| 207 |
+
|
| 208 |
+
include hpoly in
|
| 209 |
+
lemma rationalHom_rational {g : K} (hg : IsRational d g) : IsRational c (F g) := by
|
| 210 |
+
intro i
|
| 211 |
+
obtain ⟨P,hP⟩:=hpoly i
|
| 212 |
+
obtain ⟨q,hq⟩:=eval_rational P (d.coord g) hg
|
| 213 |
+
refine ⟨q,?_⟩
|
| 214 |
+
rw [hq,←hP]
|
| 215 |
+
simp
|
| 216 |
+
|
| 217 |
+
variable [IsTopologicalGroup G] [IsTopologicalGroup K]
|
| 218 |
+
variable (Γ : Subgroup G)
|
| 219 |
+
variable (hΓ : ∀ g : G,g∈Γ ↔ ∀ i,∃ z : ℤ,c.coord g i=z)
|
| 220 |
+
variable (hc : Continuous F) (hinj : Function.Injective F)
|
| 221 |
+
include hpoly hΓ hc hinj in
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
theorem exists_integer_sublattice_rational :
|
| 225 |
+
∃ Λ : Subgroup K,∃ e : RealCoordinates K n,
|
| 226 |
+
(∀ g : K,g∈Λ ↔ ∀ i,∃ z : ℤ,e.coord g i=z) ∧
|
| 227 |
+
Λ≤Γ.comap F ∧ (Λ.subgroupOf (Γ.comap F)).FiniteIndex ∧
|
| 228 |
+
(∀ g : K,∀ i,e.coord g i=0 ↔ d.coord g i=0) ∧
|
| 229 |
+
(∀ g : K,IsRational e g ↔ IsRational d g) := by
|
| 230 |
+
classical
|
| 231 |
+
obtain ⟨E,hE,hgrid⟩:=rationalHom_origin_grid c d F hpoly
|
| 232 |
+
obtain ⟨w,hpos,hEw,hw⟩:=exists_lattice_weights d E hE
|
| 233 |
+
let Λ:=weightedLattice d w hw
|
| 234 |
+
let e:=scaledCoordinates d w hpos
|
| 235 |
+
have hΛ : ∀ g : K,g∈Λ ↔ ∀ i,∃ z : ℤ,e.coord g i=z :=
|
| 236 |
+
weightedLattice_iff d w hw hpos
|
| 237 |
+
have hle : Λ≤Γ.comap F := by
|
| 238 |
+
intro g hg
|
| 239 |
+
apply (hΓ (F g)).mpr
|
| 240 |
+
have hx : ∀ j,∃ z : ℤ,d.coord g j=(E:ℝ)*(z:ℝ) := by
|
| 241 |
+
intro j
|
| 242 |
+
obtain ⟨a,ha⟩:=hg j
|
| 243 |
+
obtain ⟨b,hb⟩:=hEw j
|
| 244 |
+
refine ⟨(b:ℤ)*a,?_⟩
|
| 245 |
+
rw [ha,hb]
|
| 246 |
+
push_cast
|
| 247 |
+
ring
|
| 248 |
+
simpa using hgrid (d.coord g) hx
|
| 249 |
+
let : T2Space K:=d.coord.symm.t2Space
|
| 250 |
+
let : DiscreteTopology Γ:=integerCoordinates_discrete c Γ hΓ
|
| 251 |
+
let : DiscreteTopology (Γ.comap F):=
|
| 252 |
+
DiscreteTopology.preimage_of_continuous_injective (Γ:Set G) hc hinj
|
| 253 |
+
obtain ⟨C,hC,hrep⟩:=compact_reps_of_integerCoordinates e Λ hΛ
|
| 254 |
+
have hi:=TriangularDenominators.finiteIndex_of_compact_reps Λ (Γ.comap F) hle C hC hrep
|
| 255 |
+
refine ⟨Λ,e,hΛ,hle,hi,?_,scaledCoordinates_rational d w hpos⟩
|
| 256 |
+
intro g i
|
| 257 |
+
change d.coord g i/(w i:ℝ)=0 ↔ d.coord g i=0
|
| 258 |
+
rw [div_eq_zero_iff]
|
| 259 |
+
have hn : (w i:ℝ)≠0 := by exact_mod_cast (hpos i).ne'
|
| 260 |
+
simp [hn]
|
| 261 |
+
|
| 262 |
+
end RationalLattice
|
| 263 |
+
|
| 264 |
+
end
|
| 265 |
+
end
|
| 266 |
+
end
|
| 267 |
+
end
|
| 268 |
+
|
| 269 |
+
end OAI
|