import OAI.NumberTheory.Quaternion.Arithmetic.PrimeLocalIntegral import Mathlib.Data.Nat.ChineseRemainder /-! # Prime Mask Exponentials -/ namespace OAI.NumberTheory.Quaternion.Arithmetic.PrimeMaskExponentials noncomputable section section /-! Chinese remainders give sequences of nonnegative integers converging to one at a chosen residue characteristic and to zero at the others. -/ open scoped Classical _root_.NumberField open IsDedekindDomain Filter _root_.Topology variable {F : Type} [Field F] [NumberField F] theorem natCast_sub_norm_le_of_modEq (v : HeightOneSpectrum (π“ž F)) {a b j : β„•} (h : a ≑ b [MOD LocalCompletion.residuePrime v ^ j]) : β€–(a : v.adicCompletion F) - (b : v.adicCompletion F)β€– ≀ β€–(LocalCompletion.residuePrime v : v.adicCompletion F)β€– ^ j := by obtain ⟨z, hz⟩ := h.symm.dvd have he : (a : v.adicCompletion F) - (b : v.adicCompletion F) = (LocalCompletion.residuePrime v : v.adicCompletion F) ^ j * (z : v.adicCompletion F) := by have hh := congrArg (Int.castRingHom (v.adicCompletion F)) hz simpa only [map_sub, map_mul, Int.coe_castRingHom, Int.cast_pow, Int.cast_natCast, Nat.cast_pow] using hh rw [he, norm_mul, norm_pow] exact mul_le_of_le_one_right (pow_nonneg (norm_nonneg _) _) (PrimeLocalIntegral.intCast_norm_le_one v z) theorem natCast_tendsto_of_modEq_powers (v : HeightOneSpectrum (π“ž F)) (m : β„• β†’ β„•) (a : β„•) (h : βˆ€ j, m j ≑ a [MOD LocalCompletion.residuePrime v ^ j]) : Tendsto (fun j => (m j : v.adicCompletion F)) atTop (𝓝 (a : v.adicCompletion F)) := by apply tendsto_iff_norm_sub_tendsto_zero.mpr apply squeeze_zero (fun j => norm_nonneg _) (fun j => natCast_sub_norm_le_of_modEq v (h j)) exact tendsto_pow_atTop_nhds_zero_of_lt_one (norm_nonneg _) ((LocalCompletion.natCast_norm_lt_one_iff v _).mpr dvd_rfl) theorem exists_natCast_prime_mask_sequence {ΞΉ : Type*} [Fintype ΞΉ] (v : ΞΉ β†’ HeightOneSpectrum (π“ž F)) (q : β„•) : βˆƒ m : β„• β†’ β„•, βˆ€ i, Tendsto (fun j => (m j : (v i).adicCompletion F)) atTop (𝓝 (if LocalCompletion.residuePrime (v i) = q then 1 else 0)) := by let P := Finset.univ.image (fun i => LocalCompletion.residuePrime (v i)) have hP : βˆ€ p ∈ P, p.Prime := by intro p hp obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hp exact LocalCompletion.residuePrime_prime (v i) let a : β„• β†’ β„• := fun p => if p = q then 1 else 0 have hex (j : β„•) : βˆƒ m : β„•, βˆ€ p ∈ P, m ≑ a p [MOD p ^ j] := by let r := Nat.chineseRemainderOfFinset a (fun p => p ^ j) P (fun p hp => pow_ne_zero _ (hP p hp).ne_zero) (by intro p hp r hr hpr exact Nat.coprime_pow_primes j j (hP p hp) (hP r hr) hpr) exact ⟨r.val, r.property⟩ choose m hm using hex refine ⟨m, fun i => ?_⟩ have hi : LocalCompletion.residuePrime (v i) ∈ P := Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩ have ht := natCast_tendsto_of_modEq_powers (v i) m (a (LocalCompletion.residuePrime (v i))) (fun j => hm j _ hi) simpa only [a, apply_ite, Nat.cast_one, Nat.cast_zero] using ht end /-! Closed subgroups of a finite local product contain the residue-prime blocks of sufficiently small exponential elements. Integer powers and Chinese remainders separate the blocks. -/ open scoped Classical _root_.NumberField open IsDedekindDomain NormedSpace Filter _root_.Topology variable {F : Type} [Field F] [NumberField F] theorem prime_mask_exp_mem_closed_submonoid {ΞΉ : Type*} [Fintype ΞΉ] (v : ΞΉ β†’ HeightOneSpectrum (π“ž F)) {A : ΞΉ β†’ Type*} [βˆ€ i, NormedRing (A i)] [βˆ€ i, NormedAlgebra ((v i).adicCompletion F) (A i)] [βˆ€ i, CompleteSpace (A i)] (H : Submonoid (βˆ€ i, A i)) (hH : IsClosed (H : Set (βˆ€ i, A i))) (X : βˆ€ i, A i) (hX : βˆ€ i, X i ∈ Metric.eball 0 (expSeries ((v i).adicCompletion F) (A i)).radius) (hexp : (fun i => exp (X i)) ∈ H) (q : β„•) : (fun i => if LocalCompletion.residuePrime (v i) = q then exp (X i) else 1) ∈ H := by obtain ⟨m, hm⟩ := exists_natCast_prime_mask_sequence v q let Y : βˆ€ i, A i := fun i => if LocalCompletion.residuePrime (v i) = q then exp (X i) else 1 have ht : Tendsto (fun j => fun i => exp ((m j : (v i).adicCompletion F) β€’ X i)) atTop (𝓝 Y) := by apply tendsto_pi_nhds.mpr intro i let : CharZero ((v i).adicCompletion F) := Algebra.charZero_of_charZero F _ have hs := (hm i).smul (tendsto_const_nhds (x := X i)) have hb : (if LocalCompletion.residuePrime (v i) = q then (1 : (v i).adicCompletion F) else 0) β€’ X i ∈ Metric.eball 0 (expSeries ((v i).adicCompletion F) (A i)).radius := by split_ifs Β· simpa using hX i Β· simpa using LocalCompletion.finite_expSeries_radius_pos (v i) (A i) have he := (analyticAt_exp_of_mem_ball _ hb).continuousAt.tendsto.comp hs simpa only [Y, ite_smul, one_smul, zero_smul, apply_ite, exp_zero, Function.comp_def] using he apply hH.mem_of_tendsto ht apply Filter.Eventually.of_forall intro j have he : (fun i => exp ((m j : (v i).adicCompletion F) β€’ X i)) = (fun i => exp (X i)) ^ m j := by funext i rw [Nat.cast_smul_eq_nsmul, PrimeLocalIntegral.finite_exp_nsmul (v i) _ (hX i)] rfl rw [he] exact H.pow_mem hexp _ end end OAI.NumberTheory.Quaternion.Arithmetic.PrimeMaskExponentials